Skip to content

Commit f50bc1b

Browse files
authored
fix!: match the backend's standardized single-level pagination shape (#50)
* fix!: match the backend's standardized single-level pagination shape BREAKING CHANGE: the Authorizer backend removed the PaginatedRequest wrapper type entirely (authorizerdev/authorizer, fix(graphql)! commit standardizing pagination on PaginationRequest directly, matching the proto/gRPC surface which never had a double-wrapper). This SDK's verificationRequests/webhooks/emailTemplates methods hardcoded PaginatedRequest in both their query strings and Types.PaginatedRequest parameter type - both now updated to PaginationRequest directly. Callers previously wrote e.g. `.webhooks({ pagination: { limit: 10 } })`; now write `.webhooks({ limit: 10 })` directly. The 6 List*Request types (Clients/TrustedIssuers/SAMLServiceProviders/ Organizations/OrgDomains/OrgMembers) needed no change here: their `pagination` field was already typed as PaginationRequest in this SDK, even though the old backend schema actually required the PaginatedRequest wrapper for those - meaning no strictly-typed caller of this SDK could have constructed the shape the old schema demanded for those 6 endpoints in the first place. This backend fix makes those types correct rather than accidentally correct. Verified against a locally built authorizer image running the backend fix: all 26 admin.test.ts integration tests pass (graphql + rest), full build and typecheck clean. * chore(ci): bump test image to 2.4.0-rc.9 Picks up the backend's pagination schema fix this PR targets.
1 parent 9777e61 commit f50bc1b

4 files changed

Lines changed: 9 additions & 16 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
- name: Run integration tests
3333
run: pnpm test # Make sure this command runs your integration tests
3434
env:
35-
AUTHORIZER_IMAGE: quay.io/authorizer/authorizer:2.4.0-rc.7
35+
AUTHORIZER_IMAGE: quay.io/authorizer/authorizer:2.4.0-rc.9

‎__test__/admin.test.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ describe('Integration Tests - AuthorizerAdmin (graphql + rest)', () => {
190190
});
191191
expect(addRes.errors).toHaveLength(0);
192192

193-
const listRes = await a.webhooks({ pagination: { limit: 50, page: 1 } });
193+
const listRes = await a.webhooks({ limit: 50, page: 1 });
194194
expect(listRes.errors).toHaveLength(0);
195195
const created = listRes.data?.webhooks.find((w) =>
196196
(w.event_name ?? '').startsWith(event),
@@ -219,9 +219,7 @@ describe('Integration Tests - AuthorizerAdmin (graphql + rest)', () => {
219219
});
220220
expect(addRes.errors).toHaveLength(0);
221221

222-
const listRes = await a.emailTemplates({
223-
pagination: { limit: 50, page: 1 },
224-
});
222+
const listRes = await a.emailTemplates({ limit: 50, page: 1 });
225223
expect(listRes.errors).toHaveLength(0);
226224
const created = listRes.data?.email_templates.find(
227225
(t) => t.event_name === event,

‎src/admin.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ export class AuthorizerAdmin {
366366

367367
// verificationRequests returns a paginated list of pending verification requests.
368368
verificationRequests = (
369-
params?: Types.PaginatedRequest,
369+
params?: Types.PaginationRequest,
370370
): Promise<Types.ApiResponse<Types.VerificationRequests>> =>
371371
this.dispatch<Types.VerificationRequests>(
372372
'VerificationRequests',
373373
['graphql', 'rest'],
374374
{
375-
query: `query _verification_requests($params: PaginatedRequest) { _verification_requests(params: $params) { pagination { ${paginationFragment} } verification_requests { id identifier token email expires created_at updated_at nonce redirect_uri } } }`,
375+
query: `query _verification_requests($params: PaginationRequest) { _verification_requests(params: $params) { pagination { ${paginationFragment} } verification_requests { id identifier token email expires created_at updated_at nonce redirect_uri } } }`,
376376
operationName: '_verification_requests',
377377
op: '_verification_requests',
378378
},
@@ -515,13 +515,13 @@ export class AuthorizerAdmin {
515515

516516
// webhooks returns a paginated list of webhooks.
517517
webhooks = (
518-
params?: Types.PaginatedRequest,
518+
params?: Types.PaginationRequest,
519519
): Promise<Types.ApiResponse<Types.Webhooks>> =>
520520
this.dispatch<Types.Webhooks>(
521521
'Webhooks',
522522
['graphql', 'rest'],
523523
{
524-
query: `query _webhooks($params: PaginatedRequest) { _webhooks(params: $params) { pagination { ${paginationFragment} } webhooks { ${webhookFragment} } } }`,
524+
query: `query _webhooks($params: PaginationRequest) { _webhooks(params: $params) { pagination { ${paginationFragment} } webhooks { ${webhookFragment} } } }`,
525525
operationName: '_webhooks',
526526
op: '_webhooks',
527527
},
@@ -626,13 +626,13 @@ export class AuthorizerAdmin {
626626

627627
// emailTemplates returns a paginated list of email templates.
628628
emailTemplates = (
629-
params?: Types.PaginatedRequest,
629+
params?: Types.PaginationRequest,
630630
): Promise<Types.ApiResponse<Types.EmailTemplates>> =>
631631
this.dispatch<Types.EmailTemplates>(
632632
'EmailTemplates',
633633
['graphql', 'rest'],
634634
{
635-
query: `query _email_templates($params: PaginatedRequest) { _email_templates(params: $params) { pagination { ${paginationFragment} } email_templates { ${emailTemplateFragment} } } }`,
635+
query: `query _email_templates($params: PaginationRequest) { _email_templates(params: $params) { pagination { ${paginationFragment} } email_templates { ${emailTemplateFragment} } } }`,
636636
operationName: '_email_templates',
637637
op: '_email_templates',
638638
},

‎src/types.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,6 @@ export interface AdminMeta {
643643
is_multi_factor_auth_service_enabled: boolean;
644644
}
645645

646-
// PaginatedRequest wraps the pagination input for list queries.
647-
export interface PaginatedRequest {
648-
pagination?: PaginationRequest | null;
649-
}
650-
651646
// ListUsersRequest is the admin _users query input. query is an optional
652647
// case-insensitive substring filter matched against email, given_name,
653648
// family_name and nickname. Empty/absent means no filter (full list).

0 commit comments

Comments
 (0)