Skip to content

Commit b0cd81f

Browse files
committed
allow limit to be passed instead of pagination opts to list
1 parent f3373f0 commit b0cd81f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/client/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,14 +558,17 @@ export class RAG<
558558
ctx: RunQueryCtx,
559559
args: {
560560
namespaceId?: NamespaceId;
561-
paginationOpts: PaginationOptions;
562561
order?: "desc" | "asc";
563562
status?: Status;
564-
}
563+
} & ({ paginationOpts: PaginationOptions } | { limit: number })
565564
): Promise<PaginationResult<Entry<FitlerSchemas, EntryMetadata>>> {
565+
const paginationOpts =
566+
"paginationOpts" in args
567+
? args.paginationOpts
568+
: { cursor: null, numItems: args.limit };
566569
const results = await ctx.runQuery(this.component.entries.list, {
567570
namespaceId: args.namespaceId,
568-
paginationOpts: args.paginationOpts,
571+
paginationOpts,
569572
order: args.order ?? "asc",
570573
status: args.status ?? "ready",
571574
});

0 commit comments

Comments
 (0)