diff --git a/packages/programs/data/document/document/src/index.ts b/packages/programs/data/document/document/src/index.ts index 1545356b7..f90d32781 100644 --- a/packages/programs/data/document/document/src/index.ts +++ b/packages/programs/data/document/document/src/index.ts @@ -1,4 +1,21 @@ +export * from "@peerbit/indexer-interface"; export * from "./program.js"; -export * from "./search.js"; +export type { + CanRead, + BORSH_ENCODING_OPERATION, + CanSearch, + DeleteOperation, + DocumentIndex, + IDocumentWithContext, + OpenOptions, + Operation, + PutOperation, + QueryOptions, + RemoteQueryOptions, + ResultsIterator, + SearchOptions, + TransformOptions, + TransformerAsConstructor, + TransformerAsFunction, +} from "./search.js"; export { MAX_BATCH_SIZE as MAX_DOCUMENT_SIZE } from "./constants.js"; -export * from "@peerbit/indexer-interface"; diff --git a/packages/programs/data/document/document/src/search.ts b/packages/programs/data/document/document/src/search.ts index c3a3a6f4a..7082220a3 100644 --- a/packages/programs/data/document/document/src/search.ts +++ b/packages/programs/data/document/document/src/search.ts @@ -97,7 +97,7 @@ export type SearchOptions = QueryOptions; type Transformer = (obj: T, context: types.Context) => MaybePromise; -type ResultsIterator = { +export type ResultsIterator = { close: () => Promise; next: (number: number) => Promise; done: () => boolean; diff --git a/packages/programs/data/document/document/test/types.spec.ts b/packages/programs/data/document/document/test/types.spec.ts new file mode 100644 index 000000000..114ff1547 --- /dev/null +++ b/packages/programs/data/document/document/test/types.spec.ts @@ -0,0 +1,14 @@ +import { type ResultsIterator } from "../src/index.js"; + +describe("types", () => { + it("ResultsIterator", () => { + // @ts-expect-error unused + const iterator: ResultsIterator = { + next: async (count: number) => { + return [] as any[]; + }, + done: () => true, + close: async () => {}, + }; + }); +});