Skip to content

Commit

Permalink
fix: export ResultsIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-pousette committed Jul 21, 2024
1 parent 22124da commit 64d9a92
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
21 changes: 19 additions & 2 deletions packages/programs/data/document/document/src/index.ts
Original file line number Diff line number Diff line change
@@ -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";
2 changes: 1 addition & 1 deletion packages/programs/data/document/document/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export type SearchOptions<R> = QueryOptions<R>;

type Transformer<T, I> = (obj: T, context: types.Context) => MaybePromise<I>;

type ResultsIterator<T> = {
export type ResultsIterator<T> = {
close: () => Promise<void>;
next: (number: number) => Promise<T[]>;
done: () => boolean;
Expand Down
14 changes: 14 additions & 0 deletions packages/programs/data/document/document/test/types.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { type ResultsIterator } from "../src/index.js";

describe("types", () => {
it("ResultsIterator", () => {
// @ts-expect-error unused
const iterator: ResultsIterator<any> = {
next: async (count: number) => {
return [] as any[];
},
done: () => true,
close: async () => {},
};
});
});

0 comments on commit 64d9a92

Please sign in to comment.