Skip to content

Commit f85e8be

Browse files
esussmannclaude
andauthored
feat(sso): Add state filter to listConnections (#1763)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 99ee9aa commit f85e8be

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎src/sso/interfaces/list-connections-options.interface.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ export interface ListConnectionsOptions extends PaginationOptions {
88
domain?: string;
99
/** Filter Connections by their associated organization. */
1010
organizationId?: string;
11+
/** Filter Connections by their state. */
12+
state?: 'active' | 'inactive' | 'validating';
1113
}
1214

1315
export interface SerializedListConnectionsOptions extends PaginationOptions {
1416
connection_type?: ConnectionType;
1517
domain?: string;
1618
organization_id?: string;
19+
state?: 'active' | 'inactive' | 'validating';
1720
}

‎src/sso/serializers/list-connections-options.serializer.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const serializeListConnectionsOptions = (
99
connection_type: options.connectionType,
1010
domain: options.domain,
1111
organization_id: options.organizationId,
12+
state: options.state,
1213
limit: options.limit,
1314
before: options.before,
1415
after: options.after,

‎src/sso/sso.spec.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,19 @@ describe('SSO', () => {
787787

788788
expect(subject.data).toHaveLength(1);
789789
});
790+
791+
it('filters Connections by state', async () => {
792+
fetchOnce({
793+
data: [connectionResponse],
794+
list_metadata: {},
795+
});
796+
797+
const workos = new WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
798+
799+
await workos.sso.listConnections({ state: 'active' });
800+
801+
expect(fetchSearchParams()).toMatchObject({ state: 'active' });
802+
});
790803
});
791804
});
792805

0 commit comments

Comments
 (0)