From bf1c63938afc55ab758cee2ba2315c2178dca038 Mon Sep 17 00:00:00 2001 From: Will Schurman Date: Thu, 26 Feb 2026 11:47:42 -0800 Subject: [PATCH] fix: correct discriminated union type for forward/backward pagination --- ...uthorizationResultBasedKnexEntityLoader.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/entity-database-adapter-knex/src/AuthorizationResultBasedKnexEntityLoader.ts b/packages/entity-database-adapter-knex/src/AuthorizationResultBasedKnexEntityLoader.ts index 64c82824f..9537fca37 100644 --- a/packages/entity-database-adapter-knex/src/AuthorizationResultBasedKnexEntityLoader.ts +++ b/packages/entity-database-adapter-knex/src/AuthorizationResultBasedKnexEntityLoader.ts @@ -260,10 +260,22 @@ export interface EntityLoaderForwardUnifiedPaginationArgs< */ first: number; + /** + * The number of entities to return starting from the entity before the cursor. Must be a positive integer. + * Not allowed with forward pagination. + */ + last?: never; + /** * The cursor to paginate after for forward pagination. */ after?: string; + + /** + * The cursor to paginate before for backward pagination. + * Not allowed with forward pagination. + */ + before?: never; } /** @@ -273,11 +285,23 @@ export interface EntityLoaderBackwardUnifiedPaginationArgs< TFields extends Record, TSelectedFields extends keyof TFields = keyof TFields, > extends EntityLoaderBaseUnifiedPaginationArgs { + /** + * The number of entities to return starting from the entity after the cursor. Must be a positive integer. + * Not allowed with backward pagination. + */ + first?: never; + /** * The number of entities to return starting from the entity before the cursor. Must be a positive integer. */ last: number; + /** + * The cursor to paginate after for forward pagination. + * Not allowed with backward pagination. + */ + after?: never; + /** * The cursor to paginate before for backward pagination. */