Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/role-set-json-types.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
"@clerk/backend": patch
---

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`.
50 changes: 50 additions & 0 deletions packages/backend/src/api/resources/JSON.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,6 +66,9 @@ export const ObjectType = {
TotalCount: 'total_count',
TestingToken: 'testing_token',
Role: 'role',
RoleSet: 'role_set',
RoleSetItem: 'role_set_item',
RoleSetMigration: 'role_set_migration',
Permission: 'permission',
BillingPayer: 'commerce_payer',
BillingPaymentAttempt: 'commerce_payment_attempt',
Expand DownExpand Up@@ -377,6 +380,53 @@ export interface OrganizationJSON extends ClerkResourceJSON {
created_by?: string;
created_at: number;
updated_at: number;
last_active_at?: number;
missing_member_with_elevated_permissions?: boolean;
role_set_key?: string | null;
}

export interface RoleSetItemJSON {
object: typeof ObjectType.RoleSetItem;
id: string;
name: string;
key: string;
description: string | null;
members_count?: number | null;
has_members?: boolean | null;
created_at: number;
updated_at: number;
}

export interface RoleSetMigrationJSON {
object: typeof ObjectType.RoleSetMigration;
id: string;
organization_id: string | null;
instance_id: string;
source_role_set_id: string;
dest_role_set_id: string | null;
trigger_type: string;
status: string;
migrated_members: number;
mappings: Record<string, string> | null;
started_at?: number;
completed_at?: number;
created_at: number;
updated_at: number;
}

export interface RoleSetJSON {
object: typeof ObjectType.RoleSet;
id: string;
name: string;
key: string;
description: string | null;
roles: RoleSetItemJSON[];
default_role: RoleSetItemJSON | null;
creator_role: RoleSetItemJSON | null;
type: 'initial' | 'custom';
role_set_migration: RoleSetMigrationJSON | null;
created_at: number;
updated_at: number;
}

export interface OrganizationDomainJSON extends ClerkResourceJSON {
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -86,6 +86,9 @@ export type {
PublicOrganizationDataJSON,
OrganizationMembershipJSON,
OrganizationMembershipPublicUserDataJSON,
RoleSetJSON,
RoleSetItemJSON,
RoleSetMigrationJSON,
PhoneNumberJSON,
ProxyCheckJSON,
RedirectUrlJSON,
Expand Down
Loading