Skip to content

Commit 6408ab6

Browse files
authored
feat(backend): add RoleSet JSON types and missing OrganizationJSON fields (#8502)
1 parent 888a68c commit 6408ab6

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

.changeset/role-set-json-types.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/backend": patch
3+
---
4+
5+
Add `RoleSetJSON`, `RoleSetItemJSON`, and `RoleSetMigrationJSON` types matching the BAPI OpenAPI schema. Add `role_set_key`, `last_active_at`, and `missing_member_with_elevated_permissions` to `OrganizationJSON`.

packages/backend/src/api/resources/JSON.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ export const ObjectType = {
6666
TotalCount: 'total_count',
6767
TestingToken: 'testing_token',
6868
Role: 'role',
69+
RoleSet: 'role_set',
70+
RoleSetItem: 'role_set_item',
71+
RoleSetMigration: 'role_set_migration',
6972
Permission: 'permission',
7073
BillingPayer: 'commerce_payer',
7174
BillingPaymentAttempt: 'commerce_payment_attempt',
@@ -377,6 +380,53 @@ export interface OrganizationJSON extends ClerkResourceJSON {
377380
created_by?: string;
378381
created_at: number;
379382
updated_at: number;
383+
last_active_at?: number;
384+
missing_member_with_elevated_permissions?: boolean;
385+
role_set_key?: string | null;
386+
}
387+
388+
export interface RoleSetItemJSON {
389+
object: typeof ObjectType.RoleSetItem;
390+
id: string;
391+
name: string;
392+
key: string;
393+
description: string | null;
394+
members_count?: number | null;
395+
has_members?: boolean | null;
396+
created_at: number;
397+
updated_at: number;
398+
}
399+
400+
export interface RoleSetMigrationJSON {
401+
object: typeof ObjectType.RoleSetMigration;
402+
id: string;
403+
organization_id: string | null;
404+
instance_id: string;
405+
source_role_set_id: string;
406+
dest_role_set_id: string | null;
407+
trigger_type: string;
408+
status: string;
409+
migrated_members: number;
410+
mappings: Record<string, string> | null;
411+
started_at?: number;
412+
completed_at?: number;
413+
created_at: number;
414+
updated_at: number;
415+
}
416+
417+
export interface RoleSetJSON {
418+
object: typeof ObjectType.RoleSet;
419+
id: string;
420+
name: string;
421+
key: string;
422+
description: string | null;
423+
roles: RoleSetItemJSON[];
424+
default_role: RoleSetItemJSON | null;
425+
creator_role: RoleSetItemJSON | null;
426+
type: 'initial' | 'custom';
427+
role_set_migration: RoleSetMigrationJSON | null;
428+
created_at: number;
429+
updated_at: number;
380430
}
381431

382432
export interface OrganizationDomainJSON extends ClerkResourceJSON {

packages/backend/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ export type {
8686
PublicOrganizationDataJSON,
8787
OrganizationMembershipJSON,
8888
OrganizationMembershipPublicUserDataJSON,
89+
RoleSetJSON,
90+
RoleSetItemJSON,
91+
RoleSetMigrationJSON,
8992
PhoneNumberJSON,
9093
ProxyCheckJSON,
9194
RedirectUrlJSON,

0 commit comments

Comments
 (0)