@meistrari/auth-core 1.28.2 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +332 -43
- package/dist/index.d.ts +332 -43
- package/dist/index.mjs +136 -14
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4402,15 +4402,15 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
4402
4402
|
} & {
|
|
4403
4403
|
applications: {
|
|
4404
4404
|
getApplicationAuthContext: (applicationId: string) => Promise<{
|
|
4405
|
-
data: ApplicationAuthContextResponse;
|
|
4406
|
-
error: null;
|
|
4407
|
-
} | {
|
|
4408
4405
|
data: null;
|
|
4409
4406
|
error: {
|
|
4410
4407
|
message?: string | undefined;
|
|
4411
4408
|
status: number;
|
|
4412
4409
|
statusText: string;
|
|
4413
4410
|
};
|
|
4411
|
+
} | {
|
|
4412
|
+
data: ApplicationAuthContextResponse;
|
|
4413
|
+
error: null;
|
|
4414
4414
|
}>;
|
|
4415
4415
|
listCandidateOrganizations: (applicationId: string) => Promise<{
|
|
4416
4416
|
data: ListCandidateOrganizationsResponse;
|
|
@@ -5576,8 +5576,16 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
5576
5576
|
type APIClient = ReturnType<typeof createAPIClient>;
|
|
5577
5577
|
/** An authenticated user. */
|
|
5578
5578
|
type User = APIClient['$Infer']['Session']['user'];
|
|
5579
|
-
/**
|
|
5580
|
-
|
|
5579
|
+
/**
|
|
5580
|
+
* A user session record.
|
|
5581
|
+
*
|
|
5582
|
+
* Breaking change in 1.12: this was previously the full `{ user, session }`
|
|
5583
|
+
* response object, even though runtime session state only ever held the
|
|
5584
|
+
* inner record. Use {@link SessionData} for the full response shape.
|
|
5585
|
+
*/
|
|
5586
|
+
type Session = APIClient['$Infer']['Session']['session'];
|
|
5587
|
+
/** A full session response containing the user and the session record. */
|
|
5588
|
+
type SessionData = APIClient['$Infer']['Session'];
|
|
5581
5589
|
/** An organization the user belongs to. */
|
|
5582
5590
|
type BaseOrganization = Strict<APIClient['$Infer']['Organization']>;
|
|
5583
5591
|
/** A team within an organization. */
|
|
@@ -5649,29 +5657,39 @@ type TeamMember = {
|
|
|
5649
5657
|
};
|
|
5650
5658
|
|
|
5651
5659
|
/**
|
|
5652
|
-
* Options accepted when listing users
|
|
5660
|
+
* Options accepted when listing users as a global admin.
|
|
5653
5661
|
*/
|
|
5654
5662
|
type ListAdminUsersOptions = {
|
|
5655
|
-
/** Maximum number of users to return. */
|
|
5663
|
+
/** Maximum number of users to return. Defaults to 50. */
|
|
5656
5664
|
limit?: number;
|
|
5657
|
-
/** Number of users to skip. */
|
|
5665
|
+
/** Number of users to skip. Defaults to 0. */
|
|
5658
5666
|
offset?: number;
|
|
5659
|
-
/**
|
|
5660
|
-
|
|
5661
|
-
/**
|
|
5662
|
-
searchField?: 'email' | 'name';
|
|
5663
|
-
/** Search comparison operator. Defaults to contains. */
|
|
5664
|
-
searchOperator?: 'contains' | 'starts_with' | 'ends_with';
|
|
5665
|
-
/** Field used to sort the listing. */
|
|
5666
|
-
sortBy?: string;
|
|
5667
|
-
/** Sort direction. */
|
|
5667
|
+
/** Column used to order the listing. Defaults to creation date. */
|
|
5668
|
+
sortBy?: 'createdAt' | 'name';
|
|
5669
|
+
/** Order direction. Defaults to descending. */
|
|
5668
5670
|
sortDirection?: 'asc' | 'desc';
|
|
5669
|
-
/**
|
|
5670
|
-
|
|
5671
|
-
/**
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5671
|
+
/** Free-text search matched against user name, email, and ID. */
|
|
5672
|
+
query?: string;
|
|
5673
|
+
/**
|
|
5674
|
+
* Number of organization previews to include per user (max 10).
|
|
5675
|
+
* When greater than 0, each row also includes the total organization count.
|
|
5676
|
+
* Defaults to 0.
|
|
5677
|
+
*/
|
|
5678
|
+
organizationsPreview?: number;
|
|
5679
|
+
/**
|
|
5680
|
+
* When true, invitation-only rows for people invited but not yet registered
|
|
5681
|
+
* are merged into the listing, grouped by email. Defaults to false.
|
|
5682
|
+
*/
|
|
5683
|
+
includeInvitations?: boolean;
|
|
5684
|
+
};
|
|
5685
|
+
/**
|
|
5686
|
+
* Organization preview returned alongside each admin user row.
|
|
5687
|
+
*/
|
|
5688
|
+
type AdminUserOrganization = {
|
|
5689
|
+
id: string;
|
|
5690
|
+
name: string;
|
|
5691
|
+
logo: string | null;
|
|
5692
|
+
createdAt: string;
|
|
5675
5693
|
};
|
|
5676
5694
|
/**
|
|
5677
5695
|
* Options accepted when listing all organizations as a global admin.
|
|
@@ -5775,8 +5793,16 @@ type ListAdminOrganizationMembersOptions = {
|
|
|
5775
5793
|
limit?: number;
|
|
5776
5794
|
/** Number of members to skip. Defaults to 0. */
|
|
5777
5795
|
offset?: number;
|
|
5778
|
-
/**
|
|
5796
|
+
/** Case-insensitive name/email match; also matches an exact user ID when a UUID. */
|
|
5779
5797
|
query?: string;
|
|
5798
|
+
/** Organization role filter, e.g. 'org:admin'. */
|
|
5799
|
+
role?: string;
|
|
5800
|
+
/** Restricts the listing to members belonging to any of these teams. */
|
|
5801
|
+
teamIds?: string[];
|
|
5802
|
+
/** When true, pending invitation rows for the organization are merged into the listing. */
|
|
5803
|
+
includeInvitations?: boolean;
|
|
5804
|
+
/** When true, each row includes the member's teams and accessible applications. */
|
|
5805
|
+
includeAccess?: boolean;
|
|
5780
5806
|
};
|
|
5781
5807
|
/**
|
|
5782
5808
|
* Options accepted when listing teams for a single organization as a global admin.
|
|
@@ -5806,6 +5832,66 @@ type CreateAdminOrganizationTeamOptions = {
|
|
|
5806
5832
|
/** User IDs of organization members to add to the team. */
|
|
5807
5833
|
memberIds?: string[];
|
|
5808
5834
|
};
|
|
5835
|
+
/**
|
|
5836
|
+
* Options accepted when updating an organization member's role as a global admin.
|
|
5837
|
+
*/
|
|
5838
|
+
type UpdateAdminMemberRoleOptions = {
|
|
5839
|
+
/** ID of the membership to update. */
|
|
5840
|
+
memberId: string;
|
|
5841
|
+
/** New organization role for the membership. */
|
|
5842
|
+
role: string;
|
|
5843
|
+
};
|
|
5844
|
+
/**
|
|
5845
|
+
* Options accepted when removing an organization member as a global admin.
|
|
5846
|
+
*/
|
|
5847
|
+
type RemoveAdminMemberOptions = {
|
|
5848
|
+
/** ID of the membership to remove. */
|
|
5849
|
+
memberId: string;
|
|
5850
|
+
};
|
|
5851
|
+
/**
|
|
5852
|
+
* Options accepted when setting a user's effective application role as a global admin.
|
|
5853
|
+
*/
|
|
5854
|
+
type SetAdminUserApplicationRoleOptions = {
|
|
5855
|
+
/** ID of the user whose application role is being set. */
|
|
5856
|
+
userId: string;
|
|
5857
|
+
/** Organization the entitlement belongs to. */
|
|
5858
|
+
organizationId: string;
|
|
5859
|
+
/** Application the entitlement grants access to. */
|
|
5860
|
+
applicationId: string;
|
|
5861
|
+
/** Non-null grants access with the role, null denies access (leave application). Ignored when clear is true. */
|
|
5862
|
+
role?: string | null;
|
|
5863
|
+
/** When true, removes the user's override rule so broader organization rules apply again. */
|
|
5864
|
+
clear?: boolean;
|
|
5865
|
+
};
|
|
5866
|
+
/**
|
|
5867
|
+
* Options accepted when assigning or clearing a user's team as a global admin.
|
|
5868
|
+
*/
|
|
5869
|
+
type SetAdminUserTeamOptions = {
|
|
5870
|
+
/** ID of the user whose team membership is being set. */
|
|
5871
|
+
userId: string;
|
|
5872
|
+
/** Organization the teams belong to. */
|
|
5873
|
+
organizationId: string;
|
|
5874
|
+
/** Desired teams within the organization; an empty array clears the user's team memberships. */
|
|
5875
|
+
teamIds: string[];
|
|
5876
|
+
};
|
|
5877
|
+
/**
|
|
5878
|
+
* Team row returned by the admin organization team listing endpoint.
|
|
5879
|
+
*/
|
|
5880
|
+
type AdminOrganizationTeam = {
|
|
5881
|
+
id: string;
|
|
5882
|
+
name: string;
|
|
5883
|
+
};
|
|
5884
|
+
/**
|
|
5885
|
+
* Organization membership row returned by the admin member mutation endpoints.
|
|
5886
|
+
*/
|
|
5887
|
+
type AdminMember = {
|
|
5888
|
+
id: string;
|
|
5889
|
+
organizationId: string;
|
|
5890
|
+
userId: string;
|
|
5891
|
+
role: string;
|
|
5892
|
+
createdAt: string;
|
|
5893
|
+
deletedAt: string | null;
|
|
5894
|
+
};
|
|
5809
5895
|
/**
|
|
5810
5896
|
* Options accepted when creating an organization as a global admin.
|
|
5811
5897
|
*/
|
|
@@ -5841,7 +5927,36 @@ type UpdateAdminOrganizationOptions = {
|
|
|
5841
5927
|
settings?: OrganizationSettings;
|
|
5842
5928
|
};
|
|
5843
5929
|
/**
|
|
5844
|
-
*
|
|
5930
|
+
* Invitation attached to an invitation row in the admin user listing.
|
|
5931
|
+
*/
|
|
5932
|
+
type AdminUserInvitation = {
|
|
5933
|
+
id: string;
|
|
5934
|
+
organizationId: string;
|
|
5935
|
+
organizationName: string;
|
|
5936
|
+
organizationLogo: string | null;
|
|
5937
|
+
applicationId: string | null;
|
|
5938
|
+
role: string | null;
|
|
5939
|
+
teamIds: string[];
|
|
5940
|
+
status: 'pending' | 'expired';
|
|
5941
|
+
expiresAt: string;
|
|
5942
|
+
createdAt: string;
|
|
5943
|
+
};
|
|
5944
|
+
/**
|
|
5945
|
+
* Options accepted when resending an organization invitation as a global admin.
|
|
5946
|
+
*/
|
|
5947
|
+
type ResendAdminInviteOptions = {
|
|
5948
|
+
organizationId: string;
|
|
5949
|
+
email: string;
|
|
5950
|
+
role: string;
|
|
5951
|
+
applicationId?: string;
|
|
5952
|
+
/**
|
|
5953
|
+
* Teams joined when the re-sent invitation is accepted. Resending replaces the
|
|
5954
|
+
* invitation, so these must be provided to preserve the original team assignments.
|
|
5955
|
+
*/
|
|
5956
|
+
teamIds?: string[];
|
|
5957
|
+
};
|
|
5958
|
+
/**
|
|
5959
|
+
* User row returned by the admin user listing endpoint.
|
|
5845
5960
|
*/
|
|
5846
5961
|
type AdminUser = {
|
|
5847
5962
|
id: string;
|
|
@@ -5857,15 +5972,25 @@ type AdminUser = {
|
|
|
5857
5972
|
banExpires: string | Date | null;
|
|
5858
5973
|
lastActiveAt?: string | Date | null;
|
|
5859
5974
|
twoFactorEnabled?: boolean | null;
|
|
5975
|
+
/** Discriminates registered users from invitation-only rows. */
|
|
5976
|
+
type: 'user' | 'invitation';
|
|
5977
|
+
/** Aggregate invitation status. Present on invitation rows. */
|
|
5978
|
+
invitationStatus?: 'pending' | 'expired';
|
|
5979
|
+
/** Pending invitations grouped on this row. Present on invitation rows. */
|
|
5980
|
+
invitations?: AdminUserInvitation[];
|
|
5981
|
+
/** Total number of organizations the user belongs to. Present when requested via organizationsPreview. */
|
|
5982
|
+
organizationCount?: number;
|
|
5983
|
+
/** Preview of the first organizations the user belongs to. Present when requested via organizationsPreview. */
|
|
5984
|
+
organizations?: AdminUserOrganization[];
|
|
5860
5985
|
};
|
|
5861
5986
|
/**
|
|
5862
|
-
* Paginated
|
|
5987
|
+
* Paginated admin user listing response.
|
|
5863
5988
|
*/
|
|
5864
5989
|
type ListAdminUsersResult = {
|
|
5865
5990
|
users: AdminUser[];
|
|
5866
5991
|
total: number;
|
|
5867
|
-
limit
|
|
5868
|
-
offset
|
|
5992
|
+
limit: number;
|
|
5993
|
+
offset: number;
|
|
5869
5994
|
};
|
|
5870
5995
|
/**
|
|
5871
5996
|
* Member preview returned alongside each admin organization row.
|
|
@@ -5877,13 +6002,40 @@ type AdminOrganizationMember = {
|
|
|
5877
6002
|
image: string | null;
|
|
5878
6003
|
};
|
|
5879
6004
|
/**
|
|
5880
|
-
*
|
|
6005
|
+
* Team row attached to an organization member listing row.
|
|
5881
6006
|
*/
|
|
5882
|
-
type
|
|
5883
|
-
|
|
6007
|
+
type AdminOrganizationMemberTeam = {
|
|
6008
|
+
id: string;
|
|
6009
|
+
name: string;
|
|
6010
|
+
};
|
|
6011
|
+
/**
|
|
6012
|
+
* Application row attached to an organization member listing row.
|
|
6013
|
+
*/
|
|
6014
|
+
type AdminOrganizationMemberApplication = {
|
|
6015
|
+
id: string;
|
|
6016
|
+
name: string;
|
|
6017
|
+
imageUrl: string | null;
|
|
6018
|
+
};
|
|
6019
|
+
/**
|
|
6020
|
+
* Row returned by the admin organization member listing endpoint. Members and
|
|
6021
|
+
* pending invitations share this shape, discriminated by type.
|
|
6022
|
+
*/
|
|
6023
|
+
type AdminOrganizationMemberRecord = {
|
|
6024
|
+
type: 'member' | 'invitation';
|
|
6025
|
+
id: string;
|
|
6026
|
+
memberId: string | null;
|
|
5884
6027
|
organizationId: string;
|
|
5885
|
-
|
|
6028
|
+
name: string | null;
|
|
6029
|
+
email: string;
|
|
6030
|
+
image: string | null;
|
|
6031
|
+
role: string | null;
|
|
6032
|
+
lastActiveAt: string | null;
|
|
5886
6033
|
createdAt: string;
|
|
6034
|
+
invitationId?: string;
|
|
6035
|
+
invitationStatus?: 'pending' | 'expired';
|
|
6036
|
+
expiresAt?: string;
|
|
6037
|
+
teams?: AdminOrganizationMemberTeam[];
|
|
6038
|
+
applications?: AdminOrganizationMemberApplication[];
|
|
5887
6039
|
};
|
|
5888
6040
|
/**
|
|
5889
6041
|
* Paginated organization member listing response.
|
|
@@ -5914,6 +6066,41 @@ type ListAdminOrganizationTeamsResult = {
|
|
|
5914
6066
|
limit: number;
|
|
5915
6067
|
offset: number;
|
|
5916
6068
|
};
|
|
6069
|
+
/**
|
|
6070
|
+
* Application row in an admin user access report.
|
|
6071
|
+
*/
|
|
6072
|
+
type AdminUserAccessApplication = {
|
|
6073
|
+
id: string;
|
|
6074
|
+
name: string;
|
|
6075
|
+
imageUrl: string | null;
|
|
6076
|
+
/** Effective role from entitlement rule evaluation. Null when the first matching rule denies access or no rule matches. */
|
|
6077
|
+
role: string | null;
|
|
6078
|
+
};
|
|
6079
|
+
/**
|
|
6080
|
+
* Team row in an admin user access report.
|
|
6081
|
+
*/
|
|
6082
|
+
type AdminUserAccessTeam = {
|
|
6083
|
+
id: string;
|
|
6084
|
+
name: string;
|
|
6085
|
+
};
|
|
6086
|
+
/**
|
|
6087
|
+
* Organization row in an admin user access report.
|
|
6088
|
+
*/
|
|
6089
|
+
type AdminUserAccessOrganization = {
|
|
6090
|
+
id: string;
|
|
6091
|
+
name: string;
|
|
6092
|
+
logo: string | null;
|
|
6093
|
+
memberId: string;
|
|
6094
|
+
role: string;
|
|
6095
|
+
teams: AdminUserAccessTeam[];
|
|
6096
|
+
applications: AdminUserAccessApplication[];
|
|
6097
|
+
};
|
|
6098
|
+
/**
|
|
6099
|
+
* Access report returned by the admin user access endpoint.
|
|
6100
|
+
*/
|
|
6101
|
+
type AdminUserAccess = {
|
|
6102
|
+
organizations: AdminUserAccessOrganization[];
|
|
6103
|
+
};
|
|
5917
6104
|
/**
|
|
5918
6105
|
* Organization row embedded in an admin application entitlement.
|
|
5919
6106
|
*/
|
|
@@ -6031,6 +6218,27 @@ type ListAdminOrganizationsResult = {
|
|
|
6031
6218
|
limit: number;
|
|
6032
6219
|
offset: number;
|
|
6033
6220
|
};
|
|
6221
|
+
/**
|
|
6222
|
+
* Options accepted when inviting several users to an organization as a global admin.
|
|
6223
|
+
*/
|
|
6224
|
+
type InviteAdminOrganizationUsersOptions = {
|
|
6225
|
+
organizationId: string;
|
|
6226
|
+
emails: string[];
|
|
6227
|
+
role: string;
|
|
6228
|
+
/** Teams joined when each invitation is accepted. */
|
|
6229
|
+
teamIds?: string[];
|
|
6230
|
+
applicationId?: string;
|
|
6231
|
+
};
|
|
6232
|
+
/**
|
|
6233
|
+
* Per-email outcome of a batch organization invite.
|
|
6234
|
+
*/
|
|
6235
|
+
type InviteAdminOrganizationUsersResult = {
|
|
6236
|
+
results: {
|
|
6237
|
+
email: string;
|
|
6238
|
+
status: 'invited' | 'added' | 'error';
|
|
6239
|
+
message?: string;
|
|
6240
|
+
}[];
|
|
6241
|
+
};
|
|
6034
6242
|
|
|
6035
6243
|
/**
|
|
6036
6244
|
* Service for global admin operations.
|
|
@@ -6053,20 +6261,21 @@ declare class AdminService {
|
|
|
6053
6261
|
* @returns The paginated organization listing
|
|
6054
6262
|
*/
|
|
6055
6263
|
listOrganizations(options?: ListAdminOrganizationsOptions): Promise<{
|
|
6264
|
+
data: ListAdminOrganizationsResult;
|
|
6265
|
+
error: null;
|
|
6266
|
+
} | {
|
|
6056
6267
|
data: null;
|
|
6057
6268
|
error: {
|
|
6058
6269
|
message?: string | undefined;
|
|
6059
6270
|
status: number;
|
|
6060
6271
|
statusText: string;
|
|
6061
6272
|
};
|
|
6062
|
-
} | {
|
|
6063
|
-
data: ListAdminOrganizationsResult;
|
|
6064
|
-
error: null;
|
|
6065
6273
|
}>;
|
|
6066
6274
|
/**
|
|
6067
|
-
* Lists
|
|
6275
|
+
* Lists users as a global admin, optionally with organization previews
|
|
6276
|
+
* and totals when a preview size is requested.
|
|
6068
6277
|
*
|
|
6069
|
-
* @param options - Pagination,
|
|
6278
|
+
* @param options - Pagination, ordering, search, and preview options
|
|
6070
6279
|
* @returns The paginated user listing
|
|
6071
6280
|
*/
|
|
6072
6281
|
listUsers(options?: ListAdminUsersOptions): Promise<{
|
|
@@ -6090,6 +6299,17 @@ declare class AdminService {
|
|
|
6090
6299
|
getOrganization(options: GetAdminOrganizationOptions): Promise<{
|
|
6091
6300
|
data: AdminOrganization;
|
|
6092
6301
|
} | null>;
|
|
6302
|
+
/**
|
|
6303
|
+
* Fetches the per-organization access report for a single user: their
|
|
6304
|
+
* organizations with role, membership ID, and teams, plus each
|
|
6305
|
+
* organization's entitled applications with the user's effective role.
|
|
6306
|
+
*
|
|
6307
|
+
* @param userId - The ID of the user to fetch access for
|
|
6308
|
+
* @returns The user access report
|
|
6309
|
+
*/
|
|
6310
|
+
getUserAccess(userId: string): Promise<{
|
|
6311
|
+
data: AdminUserAccess;
|
|
6312
|
+
} | null>;
|
|
6093
6313
|
/**
|
|
6094
6314
|
* Lists active members for one organization as a global admin.
|
|
6095
6315
|
*
|
|
@@ -6151,13 +6371,84 @@ declare class AdminService {
|
|
|
6151
6371
|
updateOrganization(options: UpdateAdminOrganizationOptions): Promise<{
|
|
6152
6372
|
data: AdminOrganization;
|
|
6153
6373
|
} | null>;
|
|
6374
|
+
/**
|
|
6375
|
+
* Updates an organization member's role.
|
|
6376
|
+
*
|
|
6377
|
+
* @param options - Membership ID and the new role
|
|
6378
|
+
* @returns The updated membership
|
|
6379
|
+
*/
|
|
6380
|
+
updateMemberRole(options: UpdateAdminMemberRoleOptions): Promise<{
|
|
6381
|
+
data: AdminMember;
|
|
6382
|
+
} | null>;
|
|
6383
|
+
/**
|
|
6384
|
+
* Removes an organization member.
|
|
6385
|
+
*
|
|
6386
|
+
* @param options - Membership ID to remove
|
|
6387
|
+
* @returns The removed membership
|
|
6388
|
+
*/
|
|
6389
|
+
removeMember(options: RemoveAdminMemberOptions): Promise<{
|
|
6390
|
+
data: AdminMember;
|
|
6391
|
+
} | null>;
|
|
6392
|
+
/**
|
|
6393
|
+
* Sets a user's effective application role within an organization. A
|
|
6394
|
+
* non-null role grants access, a null role denies access (leave
|
|
6395
|
+
* application), and clear removes the user-specific override.
|
|
6396
|
+
*
|
|
6397
|
+
* @param options - User, organization, application, and the role or clear flag
|
|
6398
|
+
*/
|
|
6399
|
+
setUserApplicationRole(options: SetAdminUserApplicationRoleOptions): Promise<void>;
|
|
6400
|
+
/**
|
|
6401
|
+
* Reconciles a user's team memberships within an organization to a given set.
|
|
6402
|
+
*
|
|
6403
|
+
* @param options - User, organization, and the desired teams (empty to clear)
|
|
6404
|
+
*/
|
|
6405
|
+
setUserTeam(options: SetAdminUserTeamOptions): Promise<void>;
|
|
6154
6406
|
/**
|
|
6155
6407
|
* Bans a user from the auth system and invalidates all their sessions.
|
|
6156
6408
|
* @param userId - The ID of the user to ban
|
|
6157
6409
|
*/
|
|
6158
6410
|
banUser(userId: string): Promise<void>;
|
|
6411
|
+
/**
|
|
6412
|
+
* Lifts a user's ban.
|
|
6413
|
+
* @param userId - The ID of the user to unban
|
|
6414
|
+
*/
|
|
6415
|
+
unbanUser(userId: string): Promise<void>;
|
|
6416
|
+
/**
|
|
6417
|
+
* Permanently removes a user from the auth system.
|
|
6418
|
+
* @param userId - The ID of the user to remove
|
|
6419
|
+
*/
|
|
6420
|
+
removeUser(userId: string): Promise<void>;
|
|
6421
|
+
/**
|
|
6422
|
+
* Cancels a pending invitation as a global admin.
|
|
6423
|
+
* @param invitationId - The ID of the invitation to cancel
|
|
6424
|
+
*/
|
|
6425
|
+
cancelInvite(invitationId: string): Promise<void>;
|
|
6426
|
+
/**
|
|
6427
|
+
* Re-sends an organization invitation email as a global admin.
|
|
6428
|
+
* @param options - Organization, email, role, and optional application and teams
|
|
6429
|
+
*/
|
|
6430
|
+
resendInvite(options: ResendAdminInviteOptions): Promise<void>;
|
|
6431
|
+
/**
|
|
6432
|
+
* Invites several users to an organization in one call. Failures are
|
|
6433
|
+
* isolated per email in the results payload.
|
|
6434
|
+
*
|
|
6435
|
+
* @param options - Organization, emails, role, and optional teams/application
|
|
6436
|
+
* @returns Per-email invite outcomes
|
|
6437
|
+
*/
|
|
6438
|
+
inviteOrganizationUsers(options: InviteAdminOrganizationUsersOptions): Promise<{
|
|
6439
|
+
data: InviteAdminOrganizationUsersResult;
|
|
6440
|
+
} | null>;
|
|
6159
6441
|
}
|
|
6160
6442
|
|
|
6443
|
+
/**
|
|
6444
|
+
* Result of accepting an organization invitation.
|
|
6445
|
+
*/
|
|
6446
|
+
type AcceptInvitationResult = {
|
|
6447
|
+
/** Application home URL for application-scoped invitations, otherwise `null`. */
|
|
6448
|
+
homeUrl: string | null;
|
|
6449
|
+
/** The accepted organization membership. This may be an existing membership. */
|
|
6450
|
+
member: Member;
|
|
6451
|
+
};
|
|
6161
6452
|
/**
|
|
6162
6453
|
* Fields that can be updated on an organization.
|
|
6163
6454
|
*/
|
|
@@ -6412,12 +6703,10 @@ declare class OrganizationService {
|
|
|
6412
6703
|
* Accepts an organization invitation.
|
|
6413
6704
|
*
|
|
6414
6705
|
* @param id - The invitation ID to accept
|
|
6415
|
-
* @returns
|
|
6416
|
-
* scoped to an application that defines one; otherwise `null`.
|
|
6706
|
+
* @returns The accepted member and the application's `homeUrl` when the invitation
|
|
6707
|
+
* is scoped to an application that defines one; otherwise `null`.
|
|
6417
6708
|
*/
|
|
6418
|
-
acceptInvitation(id: string): Promise<
|
|
6419
|
-
homeUrl: string | null;
|
|
6420
|
-
}>;
|
|
6709
|
+
acceptInvitation(id: string): Promise<AcceptInvitationResult>;
|
|
6421
6710
|
/**
|
|
6422
6711
|
* Removes a user from the active organization.
|
|
6423
6712
|
*
|
|
@@ -7084,4 +7373,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
7084
7373
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
7085
7374
|
|
|
7086
7375
|
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, AuthClient, AuthMethod, AuthMethodBrand, AuthMethods, AuthorizationFlowError, DEFAULT_APPLICATION_CONFIG, DEFAULT_JWT_ASSURANCE, DEFAULT_SESSION_ASSURANCE_CONFIG, DeviceAccessDeniedError, DeviceAuthorizationPendingError, DeviceAuthorizationSlowDownError, DeviceCodeExpiredError, DeviceTransientServerError, EmailOTPService, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, JWTPayload, JWTPayloadAssurance, JWTPayloadUser, JWTPayloadWorkspace, OAuthBeginStepUpResponse, OAuthCompleteStepUpResponse, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, STEP_UP_MAX_AGE_SECONDS, SendOtpResponse, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceResponse, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, createAPIClient, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, organizationAdditionalFields, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
7087
|
-
export type { APIClient, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationMember, AdminApplicationOrganization, AdminApplicationRecord, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberRecord, AdminOrganizationTeamRecord, AdminUser, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
|
7376
|
+
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationMember, AdminApplicationOrganization, AdminApplicationRecord, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, ResendAdminInviteOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminUserApplicationRoleOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -4402,15 +4402,15 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
4402
4402
|
} & {
|
|
4403
4403
|
applications: {
|
|
4404
4404
|
getApplicationAuthContext: (applicationId: string) => Promise<{
|
|
4405
|
-
data: ApplicationAuthContextResponse;
|
|
4406
|
-
error: null;
|
|
4407
|
-
} | {
|
|
4408
4405
|
data: null;
|
|
4409
4406
|
error: {
|
|
4410
4407
|
message?: string | undefined;
|
|
4411
4408
|
status: number;
|
|
4412
4409
|
statusText: string;
|
|
4413
4410
|
};
|
|
4411
|
+
} | {
|
|
4412
|
+
data: ApplicationAuthContextResponse;
|
|
4413
|
+
error: null;
|
|
4414
4414
|
}>;
|
|
4415
4415
|
listCandidateOrganizations: (applicationId: string) => Promise<{
|
|
4416
4416
|
data: ListCandidateOrganizationsResponse;
|
|
@@ -5576,8 +5576,16 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
5576
5576
|
type APIClient = ReturnType<typeof createAPIClient>;
|
|
5577
5577
|
/** An authenticated user. */
|
|
5578
5578
|
type User = APIClient['$Infer']['Session']['user'];
|
|
5579
|
-
/**
|
|
5580
|
-
|
|
5579
|
+
/**
|
|
5580
|
+
* A user session record.
|
|
5581
|
+
*
|
|
5582
|
+
* Breaking change in 1.12: this was previously the full `{ user, session }`
|
|
5583
|
+
* response object, even though runtime session state only ever held the
|
|
5584
|
+
* inner record. Use {@link SessionData} for the full response shape.
|
|
5585
|
+
*/
|
|
5586
|
+
type Session = APIClient['$Infer']['Session']['session'];
|
|
5587
|
+
/** A full session response containing the user and the session record. */
|
|
5588
|
+
type SessionData = APIClient['$Infer']['Session'];
|
|
5581
5589
|
/** An organization the user belongs to. */
|
|
5582
5590
|
type BaseOrganization = Strict<APIClient['$Infer']['Organization']>;
|
|
5583
5591
|
/** A team within an organization. */
|
|
@@ -5649,29 +5657,39 @@ type TeamMember = {
|
|
|
5649
5657
|
};
|
|
5650
5658
|
|
|
5651
5659
|
/**
|
|
5652
|
-
* Options accepted when listing users
|
|
5660
|
+
* Options accepted when listing users as a global admin.
|
|
5653
5661
|
*/
|
|
5654
5662
|
type ListAdminUsersOptions = {
|
|
5655
|
-
/** Maximum number of users to return. */
|
|
5663
|
+
/** Maximum number of users to return. Defaults to 50. */
|
|
5656
5664
|
limit?: number;
|
|
5657
|
-
/** Number of users to skip. */
|
|
5665
|
+
/** Number of users to skip. Defaults to 0. */
|
|
5658
5666
|
offset?: number;
|
|
5659
|
-
/**
|
|
5660
|
-
|
|
5661
|
-
/**
|
|
5662
|
-
searchField?: 'email' | 'name';
|
|
5663
|
-
/** Search comparison operator. Defaults to contains. */
|
|
5664
|
-
searchOperator?: 'contains' | 'starts_with' | 'ends_with';
|
|
5665
|
-
/** Field used to sort the listing. */
|
|
5666
|
-
sortBy?: string;
|
|
5667
|
-
/** Sort direction. */
|
|
5667
|
+
/** Column used to order the listing. Defaults to creation date. */
|
|
5668
|
+
sortBy?: 'createdAt' | 'name';
|
|
5669
|
+
/** Order direction. Defaults to descending. */
|
|
5668
5670
|
sortDirection?: 'asc' | 'desc';
|
|
5669
|
-
/**
|
|
5670
|
-
|
|
5671
|
-
/**
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5671
|
+
/** Free-text search matched against user name, email, and ID. */
|
|
5672
|
+
query?: string;
|
|
5673
|
+
/**
|
|
5674
|
+
* Number of organization previews to include per user (max 10).
|
|
5675
|
+
* When greater than 0, each row also includes the total organization count.
|
|
5676
|
+
* Defaults to 0.
|
|
5677
|
+
*/
|
|
5678
|
+
organizationsPreview?: number;
|
|
5679
|
+
/**
|
|
5680
|
+
* When true, invitation-only rows for people invited but not yet registered
|
|
5681
|
+
* are merged into the listing, grouped by email. Defaults to false.
|
|
5682
|
+
*/
|
|
5683
|
+
includeInvitations?: boolean;
|
|
5684
|
+
};
|
|
5685
|
+
/**
|
|
5686
|
+
* Organization preview returned alongside each admin user row.
|
|
5687
|
+
*/
|
|
5688
|
+
type AdminUserOrganization = {
|
|
5689
|
+
id: string;
|
|
5690
|
+
name: string;
|
|
5691
|
+
logo: string | null;
|
|
5692
|
+
createdAt: string;
|
|
5675
5693
|
};
|
|
5676
5694
|
/**
|
|
5677
5695
|
* Options accepted when listing all organizations as a global admin.
|
|
@@ -5775,8 +5793,16 @@ type ListAdminOrganizationMembersOptions = {
|
|
|
5775
5793
|
limit?: number;
|
|
5776
5794
|
/** Number of members to skip. Defaults to 0. */
|
|
5777
5795
|
offset?: number;
|
|
5778
|
-
/**
|
|
5796
|
+
/** Case-insensitive name/email match; also matches an exact user ID when a UUID. */
|
|
5779
5797
|
query?: string;
|
|
5798
|
+
/** Organization role filter, e.g. 'org:admin'. */
|
|
5799
|
+
role?: string;
|
|
5800
|
+
/** Restricts the listing to members belonging to any of these teams. */
|
|
5801
|
+
teamIds?: string[];
|
|
5802
|
+
/** When true, pending invitation rows for the organization are merged into the listing. */
|
|
5803
|
+
includeInvitations?: boolean;
|
|
5804
|
+
/** When true, each row includes the member's teams and accessible applications. */
|
|
5805
|
+
includeAccess?: boolean;
|
|
5780
5806
|
};
|
|
5781
5807
|
/**
|
|
5782
5808
|
* Options accepted when listing teams for a single organization as a global admin.
|
|
@@ -5806,6 +5832,66 @@ type CreateAdminOrganizationTeamOptions = {
|
|
|
5806
5832
|
/** User IDs of organization members to add to the team. */
|
|
5807
5833
|
memberIds?: string[];
|
|
5808
5834
|
};
|
|
5835
|
+
/**
|
|
5836
|
+
* Options accepted when updating an organization member's role as a global admin.
|
|
5837
|
+
*/
|
|
5838
|
+
type UpdateAdminMemberRoleOptions = {
|
|
5839
|
+
/** ID of the membership to update. */
|
|
5840
|
+
memberId: string;
|
|
5841
|
+
/** New organization role for the membership. */
|
|
5842
|
+
role: string;
|
|
5843
|
+
};
|
|
5844
|
+
/**
|
|
5845
|
+
* Options accepted when removing an organization member as a global admin.
|
|
5846
|
+
*/
|
|
5847
|
+
type RemoveAdminMemberOptions = {
|
|
5848
|
+
/** ID of the membership to remove. */
|
|
5849
|
+
memberId: string;
|
|
5850
|
+
};
|
|
5851
|
+
/**
|
|
5852
|
+
* Options accepted when setting a user's effective application role as a global admin.
|
|
5853
|
+
*/
|
|
5854
|
+
type SetAdminUserApplicationRoleOptions = {
|
|
5855
|
+
/** ID of the user whose application role is being set. */
|
|
5856
|
+
userId: string;
|
|
5857
|
+
/** Organization the entitlement belongs to. */
|
|
5858
|
+
organizationId: string;
|
|
5859
|
+
/** Application the entitlement grants access to. */
|
|
5860
|
+
applicationId: string;
|
|
5861
|
+
/** Non-null grants access with the role, null denies access (leave application). Ignored when clear is true. */
|
|
5862
|
+
role?: string | null;
|
|
5863
|
+
/** When true, removes the user's override rule so broader organization rules apply again. */
|
|
5864
|
+
clear?: boolean;
|
|
5865
|
+
};
|
|
5866
|
+
/**
|
|
5867
|
+
* Options accepted when assigning or clearing a user's team as a global admin.
|
|
5868
|
+
*/
|
|
5869
|
+
type SetAdminUserTeamOptions = {
|
|
5870
|
+
/** ID of the user whose team membership is being set. */
|
|
5871
|
+
userId: string;
|
|
5872
|
+
/** Organization the teams belong to. */
|
|
5873
|
+
organizationId: string;
|
|
5874
|
+
/** Desired teams within the organization; an empty array clears the user's team memberships. */
|
|
5875
|
+
teamIds: string[];
|
|
5876
|
+
};
|
|
5877
|
+
/**
|
|
5878
|
+
* Team row returned by the admin organization team listing endpoint.
|
|
5879
|
+
*/
|
|
5880
|
+
type AdminOrganizationTeam = {
|
|
5881
|
+
id: string;
|
|
5882
|
+
name: string;
|
|
5883
|
+
};
|
|
5884
|
+
/**
|
|
5885
|
+
* Organization membership row returned by the admin member mutation endpoints.
|
|
5886
|
+
*/
|
|
5887
|
+
type AdminMember = {
|
|
5888
|
+
id: string;
|
|
5889
|
+
organizationId: string;
|
|
5890
|
+
userId: string;
|
|
5891
|
+
role: string;
|
|
5892
|
+
createdAt: string;
|
|
5893
|
+
deletedAt: string | null;
|
|
5894
|
+
};
|
|
5809
5895
|
/**
|
|
5810
5896
|
* Options accepted when creating an organization as a global admin.
|
|
5811
5897
|
*/
|
|
@@ -5841,7 +5927,36 @@ type UpdateAdminOrganizationOptions = {
|
|
|
5841
5927
|
settings?: OrganizationSettings;
|
|
5842
5928
|
};
|
|
5843
5929
|
/**
|
|
5844
|
-
*
|
|
5930
|
+
* Invitation attached to an invitation row in the admin user listing.
|
|
5931
|
+
*/
|
|
5932
|
+
type AdminUserInvitation = {
|
|
5933
|
+
id: string;
|
|
5934
|
+
organizationId: string;
|
|
5935
|
+
organizationName: string;
|
|
5936
|
+
organizationLogo: string | null;
|
|
5937
|
+
applicationId: string | null;
|
|
5938
|
+
role: string | null;
|
|
5939
|
+
teamIds: string[];
|
|
5940
|
+
status: 'pending' | 'expired';
|
|
5941
|
+
expiresAt: string;
|
|
5942
|
+
createdAt: string;
|
|
5943
|
+
};
|
|
5944
|
+
/**
|
|
5945
|
+
* Options accepted when resending an organization invitation as a global admin.
|
|
5946
|
+
*/
|
|
5947
|
+
type ResendAdminInviteOptions = {
|
|
5948
|
+
organizationId: string;
|
|
5949
|
+
email: string;
|
|
5950
|
+
role: string;
|
|
5951
|
+
applicationId?: string;
|
|
5952
|
+
/**
|
|
5953
|
+
* Teams joined when the re-sent invitation is accepted. Resending replaces the
|
|
5954
|
+
* invitation, so these must be provided to preserve the original team assignments.
|
|
5955
|
+
*/
|
|
5956
|
+
teamIds?: string[];
|
|
5957
|
+
};
|
|
5958
|
+
/**
|
|
5959
|
+
* User row returned by the admin user listing endpoint.
|
|
5845
5960
|
*/
|
|
5846
5961
|
type AdminUser = {
|
|
5847
5962
|
id: string;
|
|
@@ -5857,15 +5972,25 @@ type AdminUser = {
|
|
|
5857
5972
|
banExpires: string | Date | null;
|
|
5858
5973
|
lastActiveAt?: string | Date | null;
|
|
5859
5974
|
twoFactorEnabled?: boolean | null;
|
|
5975
|
+
/** Discriminates registered users from invitation-only rows. */
|
|
5976
|
+
type: 'user' | 'invitation';
|
|
5977
|
+
/** Aggregate invitation status. Present on invitation rows. */
|
|
5978
|
+
invitationStatus?: 'pending' | 'expired';
|
|
5979
|
+
/** Pending invitations grouped on this row. Present on invitation rows. */
|
|
5980
|
+
invitations?: AdminUserInvitation[];
|
|
5981
|
+
/** Total number of organizations the user belongs to. Present when requested via organizationsPreview. */
|
|
5982
|
+
organizationCount?: number;
|
|
5983
|
+
/** Preview of the first organizations the user belongs to. Present when requested via organizationsPreview. */
|
|
5984
|
+
organizations?: AdminUserOrganization[];
|
|
5860
5985
|
};
|
|
5861
5986
|
/**
|
|
5862
|
-
* Paginated
|
|
5987
|
+
* Paginated admin user listing response.
|
|
5863
5988
|
*/
|
|
5864
5989
|
type ListAdminUsersResult = {
|
|
5865
5990
|
users: AdminUser[];
|
|
5866
5991
|
total: number;
|
|
5867
|
-
limit
|
|
5868
|
-
offset
|
|
5992
|
+
limit: number;
|
|
5993
|
+
offset: number;
|
|
5869
5994
|
};
|
|
5870
5995
|
/**
|
|
5871
5996
|
* Member preview returned alongside each admin organization row.
|
|
@@ -5877,13 +6002,40 @@ type AdminOrganizationMember = {
|
|
|
5877
6002
|
image: string | null;
|
|
5878
6003
|
};
|
|
5879
6004
|
/**
|
|
5880
|
-
*
|
|
6005
|
+
* Team row attached to an organization member listing row.
|
|
5881
6006
|
*/
|
|
5882
|
-
type
|
|
5883
|
-
|
|
6007
|
+
type AdminOrganizationMemberTeam = {
|
|
6008
|
+
id: string;
|
|
6009
|
+
name: string;
|
|
6010
|
+
};
|
|
6011
|
+
/**
|
|
6012
|
+
* Application row attached to an organization member listing row.
|
|
6013
|
+
*/
|
|
6014
|
+
type AdminOrganizationMemberApplication = {
|
|
6015
|
+
id: string;
|
|
6016
|
+
name: string;
|
|
6017
|
+
imageUrl: string | null;
|
|
6018
|
+
};
|
|
6019
|
+
/**
|
|
6020
|
+
* Row returned by the admin organization member listing endpoint. Members and
|
|
6021
|
+
* pending invitations share this shape, discriminated by type.
|
|
6022
|
+
*/
|
|
6023
|
+
type AdminOrganizationMemberRecord = {
|
|
6024
|
+
type: 'member' | 'invitation';
|
|
6025
|
+
id: string;
|
|
6026
|
+
memberId: string | null;
|
|
5884
6027
|
organizationId: string;
|
|
5885
|
-
|
|
6028
|
+
name: string | null;
|
|
6029
|
+
email: string;
|
|
6030
|
+
image: string | null;
|
|
6031
|
+
role: string | null;
|
|
6032
|
+
lastActiveAt: string | null;
|
|
5886
6033
|
createdAt: string;
|
|
6034
|
+
invitationId?: string;
|
|
6035
|
+
invitationStatus?: 'pending' | 'expired';
|
|
6036
|
+
expiresAt?: string;
|
|
6037
|
+
teams?: AdminOrganizationMemberTeam[];
|
|
6038
|
+
applications?: AdminOrganizationMemberApplication[];
|
|
5887
6039
|
};
|
|
5888
6040
|
/**
|
|
5889
6041
|
* Paginated organization member listing response.
|
|
@@ -5914,6 +6066,41 @@ type ListAdminOrganizationTeamsResult = {
|
|
|
5914
6066
|
limit: number;
|
|
5915
6067
|
offset: number;
|
|
5916
6068
|
};
|
|
6069
|
+
/**
|
|
6070
|
+
* Application row in an admin user access report.
|
|
6071
|
+
*/
|
|
6072
|
+
type AdminUserAccessApplication = {
|
|
6073
|
+
id: string;
|
|
6074
|
+
name: string;
|
|
6075
|
+
imageUrl: string | null;
|
|
6076
|
+
/** Effective role from entitlement rule evaluation. Null when the first matching rule denies access or no rule matches. */
|
|
6077
|
+
role: string | null;
|
|
6078
|
+
};
|
|
6079
|
+
/**
|
|
6080
|
+
* Team row in an admin user access report.
|
|
6081
|
+
*/
|
|
6082
|
+
type AdminUserAccessTeam = {
|
|
6083
|
+
id: string;
|
|
6084
|
+
name: string;
|
|
6085
|
+
};
|
|
6086
|
+
/**
|
|
6087
|
+
* Organization row in an admin user access report.
|
|
6088
|
+
*/
|
|
6089
|
+
type AdminUserAccessOrganization = {
|
|
6090
|
+
id: string;
|
|
6091
|
+
name: string;
|
|
6092
|
+
logo: string | null;
|
|
6093
|
+
memberId: string;
|
|
6094
|
+
role: string;
|
|
6095
|
+
teams: AdminUserAccessTeam[];
|
|
6096
|
+
applications: AdminUserAccessApplication[];
|
|
6097
|
+
};
|
|
6098
|
+
/**
|
|
6099
|
+
* Access report returned by the admin user access endpoint.
|
|
6100
|
+
*/
|
|
6101
|
+
type AdminUserAccess = {
|
|
6102
|
+
organizations: AdminUserAccessOrganization[];
|
|
6103
|
+
};
|
|
5917
6104
|
/**
|
|
5918
6105
|
* Organization row embedded in an admin application entitlement.
|
|
5919
6106
|
*/
|
|
@@ -6031,6 +6218,27 @@ type ListAdminOrganizationsResult = {
|
|
|
6031
6218
|
limit: number;
|
|
6032
6219
|
offset: number;
|
|
6033
6220
|
};
|
|
6221
|
+
/**
|
|
6222
|
+
* Options accepted when inviting several users to an organization as a global admin.
|
|
6223
|
+
*/
|
|
6224
|
+
type InviteAdminOrganizationUsersOptions = {
|
|
6225
|
+
organizationId: string;
|
|
6226
|
+
emails: string[];
|
|
6227
|
+
role: string;
|
|
6228
|
+
/** Teams joined when each invitation is accepted. */
|
|
6229
|
+
teamIds?: string[];
|
|
6230
|
+
applicationId?: string;
|
|
6231
|
+
};
|
|
6232
|
+
/**
|
|
6233
|
+
* Per-email outcome of a batch organization invite.
|
|
6234
|
+
*/
|
|
6235
|
+
type InviteAdminOrganizationUsersResult = {
|
|
6236
|
+
results: {
|
|
6237
|
+
email: string;
|
|
6238
|
+
status: 'invited' | 'added' | 'error';
|
|
6239
|
+
message?: string;
|
|
6240
|
+
}[];
|
|
6241
|
+
};
|
|
6034
6242
|
|
|
6035
6243
|
/**
|
|
6036
6244
|
* Service for global admin operations.
|
|
@@ -6053,20 +6261,21 @@ declare class AdminService {
|
|
|
6053
6261
|
* @returns The paginated organization listing
|
|
6054
6262
|
*/
|
|
6055
6263
|
listOrganizations(options?: ListAdminOrganizationsOptions): Promise<{
|
|
6264
|
+
data: ListAdminOrganizationsResult;
|
|
6265
|
+
error: null;
|
|
6266
|
+
} | {
|
|
6056
6267
|
data: null;
|
|
6057
6268
|
error: {
|
|
6058
6269
|
message?: string | undefined;
|
|
6059
6270
|
status: number;
|
|
6060
6271
|
statusText: string;
|
|
6061
6272
|
};
|
|
6062
|
-
} | {
|
|
6063
|
-
data: ListAdminOrganizationsResult;
|
|
6064
|
-
error: null;
|
|
6065
6273
|
}>;
|
|
6066
6274
|
/**
|
|
6067
|
-
* Lists
|
|
6275
|
+
* Lists users as a global admin, optionally with organization previews
|
|
6276
|
+
* and totals when a preview size is requested.
|
|
6068
6277
|
*
|
|
6069
|
-
* @param options - Pagination,
|
|
6278
|
+
* @param options - Pagination, ordering, search, and preview options
|
|
6070
6279
|
* @returns The paginated user listing
|
|
6071
6280
|
*/
|
|
6072
6281
|
listUsers(options?: ListAdminUsersOptions): Promise<{
|
|
@@ -6090,6 +6299,17 @@ declare class AdminService {
|
|
|
6090
6299
|
getOrganization(options: GetAdminOrganizationOptions): Promise<{
|
|
6091
6300
|
data: AdminOrganization;
|
|
6092
6301
|
} | null>;
|
|
6302
|
+
/**
|
|
6303
|
+
* Fetches the per-organization access report for a single user: their
|
|
6304
|
+
* organizations with role, membership ID, and teams, plus each
|
|
6305
|
+
* organization's entitled applications with the user's effective role.
|
|
6306
|
+
*
|
|
6307
|
+
* @param userId - The ID of the user to fetch access for
|
|
6308
|
+
* @returns The user access report
|
|
6309
|
+
*/
|
|
6310
|
+
getUserAccess(userId: string): Promise<{
|
|
6311
|
+
data: AdminUserAccess;
|
|
6312
|
+
} | null>;
|
|
6093
6313
|
/**
|
|
6094
6314
|
* Lists active members for one organization as a global admin.
|
|
6095
6315
|
*
|
|
@@ -6151,13 +6371,84 @@ declare class AdminService {
|
|
|
6151
6371
|
updateOrganization(options: UpdateAdminOrganizationOptions): Promise<{
|
|
6152
6372
|
data: AdminOrganization;
|
|
6153
6373
|
} | null>;
|
|
6374
|
+
/**
|
|
6375
|
+
* Updates an organization member's role.
|
|
6376
|
+
*
|
|
6377
|
+
* @param options - Membership ID and the new role
|
|
6378
|
+
* @returns The updated membership
|
|
6379
|
+
*/
|
|
6380
|
+
updateMemberRole(options: UpdateAdminMemberRoleOptions): Promise<{
|
|
6381
|
+
data: AdminMember;
|
|
6382
|
+
} | null>;
|
|
6383
|
+
/**
|
|
6384
|
+
* Removes an organization member.
|
|
6385
|
+
*
|
|
6386
|
+
* @param options - Membership ID to remove
|
|
6387
|
+
* @returns The removed membership
|
|
6388
|
+
*/
|
|
6389
|
+
removeMember(options: RemoveAdminMemberOptions): Promise<{
|
|
6390
|
+
data: AdminMember;
|
|
6391
|
+
} | null>;
|
|
6392
|
+
/**
|
|
6393
|
+
* Sets a user's effective application role within an organization. A
|
|
6394
|
+
* non-null role grants access, a null role denies access (leave
|
|
6395
|
+
* application), and clear removes the user-specific override.
|
|
6396
|
+
*
|
|
6397
|
+
* @param options - User, organization, application, and the role or clear flag
|
|
6398
|
+
*/
|
|
6399
|
+
setUserApplicationRole(options: SetAdminUserApplicationRoleOptions): Promise<void>;
|
|
6400
|
+
/**
|
|
6401
|
+
* Reconciles a user's team memberships within an organization to a given set.
|
|
6402
|
+
*
|
|
6403
|
+
* @param options - User, organization, and the desired teams (empty to clear)
|
|
6404
|
+
*/
|
|
6405
|
+
setUserTeam(options: SetAdminUserTeamOptions): Promise<void>;
|
|
6154
6406
|
/**
|
|
6155
6407
|
* Bans a user from the auth system and invalidates all their sessions.
|
|
6156
6408
|
* @param userId - The ID of the user to ban
|
|
6157
6409
|
*/
|
|
6158
6410
|
banUser(userId: string): Promise<void>;
|
|
6411
|
+
/**
|
|
6412
|
+
* Lifts a user's ban.
|
|
6413
|
+
* @param userId - The ID of the user to unban
|
|
6414
|
+
*/
|
|
6415
|
+
unbanUser(userId: string): Promise<void>;
|
|
6416
|
+
/**
|
|
6417
|
+
* Permanently removes a user from the auth system.
|
|
6418
|
+
* @param userId - The ID of the user to remove
|
|
6419
|
+
*/
|
|
6420
|
+
removeUser(userId: string): Promise<void>;
|
|
6421
|
+
/**
|
|
6422
|
+
* Cancels a pending invitation as a global admin.
|
|
6423
|
+
* @param invitationId - The ID of the invitation to cancel
|
|
6424
|
+
*/
|
|
6425
|
+
cancelInvite(invitationId: string): Promise<void>;
|
|
6426
|
+
/**
|
|
6427
|
+
* Re-sends an organization invitation email as a global admin.
|
|
6428
|
+
* @param options - Organization, email, role, and optional application and teams
|
|
6429
|
+
*/
|
|
6430
|
+
resendInvite(options: ResendAdminInviteOptions): Promise<void>;
|
|
6431
|
+
/**
|
|
6432
|
+
* Invites several users to an organization in one call. Failures are
|
|
6433
|
+
* isolated per email in the results payload.
|
|
6434
|
+
*
|
|
6435
|
+
* @param options - Organization, emails, role, and optional teams/application
|
|
6436
|
+
* @returns Per-email invite outcomes
|
|
6437
|
+
*/
|
|
6438
|
+
inviteOrganizationUsers(options: InviteAdminOrganizationUsersOptions): Promise<{
|
|
6439
|
+
data: InviteAdminOrganizationUsersResult;
|
|
6440
|
+
} | null>;
|
|
6159
6441
|
}
|
|
6160
6442
|
|
|
6443
|
+
/**
|
|
6444
|
+
* Result of accepting an organization invitation.
|
|
6445
|
+
*/
|
|
6446
|
+
type AcceptInvitationResult = {
|
|
6447
|
+
/** Application home URL for application-scoped invitations, otherwise `null`. */
|
|
6448
|
+
homeUrl: string | null;
|
|
6449
|
+
/** The accepted organization membership. This may be an existing membership. */
|
|
6450
|
+
member: Member;
|
|
6451
|
+
};
|
|
6161
6452
|
/**
|
|
6162
6453
|
* Fields that can be updated on an organization.
|
|
6163
6454
|
*/
|
|
@@ -6412,12 +6703,10 @@ declare class OrganizationService {
|
|
|
6412
6703
|
* Accepts an organization invitation.
|
|
6413
6704
|
*
|
|
6414
6705
|
* @param id - The invitation ID to accept
|
|
6415
|
-
* @returns
|
|
6416
|
-
* scoped to an application that defines one; otherwise `null`.
|
|
6706
|
+
* @returns The accepted member and the application's `homeUrl` when the invitation
|
|
6707
|
+
* is scoped to an application that defines one; otherwise `null`.
|
|
6417
6708
|
*/
|
|
6418
|
-
acceptInvitation(id: string): Promise<
|
|
6419
|
-
homeUrl: string | null;
|
|
6420
|
-
}>;
|
|
6709
|
+
acceptInvitation(id: string): Promise<AcceptInvitationResult>;
|
|
6421
6710
|
/**
|
|
6422
6711
|
* Removes a user from the active organization.
|
|
6423
6712
|
*
|
|
@@ -7084,4 +7373,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
7084
7373
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
7085
7374
|
|
|
7086
7375
|
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, AuthClient, AuthMethod, AuthMethodBrand, AuthMethods, AuthorizationFlowError, DEFAULT_APPLICATION_CONFIG, DEFAULT_JWT_ASSURANCE, DEFAULT_SESSION_ASSURANCE_CONFIG, DeviceAccessDeniedError, DeviceAuthorizationPendingError, DeviceAuthorizationSlowDownError, DeviceCodeExpiredError, DeviceTransientServerError, EmailOTPService, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, JWTPayload, JWTPayloadAssurance, JWTPayloadUser, JWTPayloadWorkspace, OAuthBeginStepUpResponse, OAuthCompleteStepUpResponse, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, STEP_UP_MAX_AGE_SECONDS, SendOtpResponse, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceResponse, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, createAPIClient, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, organizationAdditionalFields, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
7087
|
-
export type { APIClient, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationMember, AdminApplicationOrganization, AdminApplicationRecord, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberRecord, AdminOrganizationTeamRecord, AdminUser, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
|
7376
|
+
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationMember, AdminApplicationOrganization, AdminApplicationRecord, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, ResendAdminInviteOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminUserApplicationRoleOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { defaultStatements } from 'better-auth/plugins/organization/access';
|
|
|
8
8
|
import z, { z as z$1 } from 'zod';
|
|
9
9
|
export { APIError } from 'better-auth';
|
|
10
10
|
|
|
11
|
-
const version = "1.
|
|
11
|
+
const version = "1.30.0";
|
|
12
12
|
|
|
13
13
|
function parsedEnumValues(schema) {
|
|
14
14
|
return Object.fromEntries(
|
|
@@ -439,25 +439,23 @@ class AdminService {
|
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
442
|
-
* Lists
|
|
442
|
+
* Lists users as a global admin, optionally with organization previews
|
|
443
|
+
* and totals when a preview size is requested.
|
|
443
444
|
*
|
|
444
|
-
* @param options - Pagination,
|
|
445
|
+
* @param options - Pagination, ordering, search, and preview options
|
|
445
446
|
* @returns The paginated user listing
|
|
446
447
|
*/
|
|
447
448
|
async listUsers(options = {}) {
|
|
448
|
-
return await this.client.$fetch("/admin/
|
|
449
|
+
return await this.client.$fetch("/admin/users", {
|
|
449
450
|
method: "GET",
|
|
450
451
|
query: {
|
|
451
452
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
452
453
|
...options.offset !== void 0 ? { offset: options.offset } : {},
|
|
453
|
-
...options.searchValue ? { searchValue: options.searchValue } : {},
|
|
454
|
-
...options.searchField ? { searchField: options.searchField } : {},
|
|
455
|
-
...options.searchOperator ? { searchOperator: options.searchOperator } : {},
|
|
456
454
|
...options.sortBy ? { sortBy: options.sortBy } : {},
|
|
457
455
|
...options.sortDirection ? { sortDirection: options.sortDirection } : {},
|
|
458
|
-
...options.
|
|
459
|
-
...options.
|
|
460
|
-
...options.
|
|
456
|
+
...options.query ? { query: options.query } : {},
|
|
457
|
+
...options.organizationsPreview !== void 0 ? { organizations_preview: options.organizationsPreview } : {},
|
|
458
|
+
...options.includeInvitations !== void 0 ? { include_invitations: options.includeInvitations } : {}
|
|
461
459
|
}
|
|
462
460
|
});
|
|
463
461
|
}
|
|
@@ -479,6 +477,20 @@ class AdminService {
|
|
|
479
477
|
});
|
|
480
478
|
return data;
|
|
481
479
|
}
|
|
480
|
+
/**
|
|
481
|
+
* Fetches the per-organization access report for a single user: their
|
|
482
|
+
* organizations with role, membership ID, and teams, plus each
|
|
483
|
+
* organization's entitled applications with the user's effective role.
|
|
484
|
+
*
|
|
485
|
+
* @param userId - The ID of the user to fetch access for
|
|
486
|
+
* @returns The user access report
|
|
487
|
+
*/
|
|
488
|
+
async getUserAccess(userId) {
|
|
489
|
+
const { data } = await this.client.$fetch(`/admin/users/${encodeURIComponent(userId)}/access`, {
|
|
490
|
+
method: "GET"
|
|
491
|
+
});
|
|
492
|
+
return data;
|
|
493
|
+
}
|
|
482
494
|
/**
|
|
483
495
|
* Lists active members for one organization as a global admin.
|
|
484
496
|
*
|
|
@@ -491,7 +503,11 @@ class AdminService {
|
|
|
491
503
|
query: {
|
|
492
504
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
493
505
|
...options.offset !== void 0 ? { offset: options.offset } : {},
|
|
494
|
-
...options.query ? { query: options.query } : {}
|
|
506
|
+
...options.query ? { query: options.query } : {},
|
|
507
|
+
...options.role ? { role: options.role } : {},
|
|
508
|
+
...options.teamIds !== void 0 && options.teamIds.length > 0 ? { team_ids: options.teamIds } : {},
|
|
509
|
+
...options.includeInvitations !== void 0 ? { include_invitations: options.includeInvitations } : {},
|
|
510
|
+
...options.includeAccess !== void 0 ? { include_access: options.includeAccess } : {}
|
|
495
511
|
}
|
|
496
512
|
});
|
|
497
513
|
}
|
|
@@ -555,6 +571,63 @@ class AdminService {
|
|
|
555
571
|
});
|
|
556
572
|
return data;
|
|
557
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* Updates an organization member's role.
|
|
576
|
+
*
|
|
577
|
+
* @param options - Membership ID and the new role
|
|
578
|
+
* @returns The updated membership
|
|
579
|
+
*/
|
|
580
|
+
async updateMemberRole(options) {
|
|
581
|
+
const { data } = await this.client.$fetch("/admin/organizations/members/update-role", {
|
|
582
|
+
method: "POST",
|
|
583
|
+
body: options
|
|
584
|
+
});
|
|
585
|
+
return data;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Removes an organization member.
|
|
589
|
+
*
|
|
590
|
+
* @param options - Membership ID to remove
|
|
591
|
+
* @returns The removed membership
|
|
592
|
+
*/
|
|
593
|
+
async removeMember(options) {
|
|
594
|
+
const { data } = await this.client.$fetch("/admin/organizations/members/remove", {
|
|
595
|
+
method: "POST",
|
|
596
|
+
body: options
|
|
597
|
+
});
|
|
598
|
+
return data;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Sets a user's effective application role within an organization. A
|
|
602
|
+
* non-null role grants access, a null role denies access (leave
|
|
603
|
+
* application), and clear removes the user-specific override.
|
|
604
|
+
*
|
|
605
|
+
* @param options - User, organization, application, and the role or clear flag
|
|
606
|
+
*/
|
|
607
|
+
async setUserApplicationRole(options) {
|
|
608
|
+
await this.client.$fetch(`/admin/users/${encodeURIComponent(options.userId)}/applications/role`, {
|
|
609
|
+
method: "POST",
|
|
610
|
+
body: {
|
|
611
|
+
organizationId: options.organizationId,
|
|
612
|
+
applicationId: options.applicationId,
|
|
613
|
+
...options.clear === true ? { clear: true } : { role: options.role }
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Reconciles a user's team memberships within an organization to a given set.
|
|
619
|
+
*
|
|
620
|
+
* @param options - User, organization, and the desired teams (empty to clear)
|
|
621
|
+
*/
|
|
622
|
+
async setUserTeam(options) {
|
|
623
|
+
await this.client.$fetch(`/admin/users/${encodeURIComponent(options.userId)}/team`, {
|
|
624
|
+
method: "POST",
|
|
625
|
+
body: {
|
|
626
|
+
organizationId: options.organizationId,
|
|
627
|
+
teamIds: options.teamIds
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
}
|
|
558
631
|
/**
|
|
559
632
|
* Bans a user from the auth system and invalidates all their sessions.
|
|
560
633
|
* @param userId - The ID of the user to ban
|
|
@@ -562,6 +635,51 @@ class AdminService {
|
|
|
562
635
|
async banUser(userId) {
|
|
563
636
|
await this.client.$fetch("/admin/ban-user", { method: "POST", body: { userId } });
|
|
564
637
|
}
|
|
638
|
+
/**
|
|
639
|
+
* Lifts a user's ban.
|
|
640
|
+
* @param userId - The ID of the user to unban
|
|
641
|
+
*/
|
|
642
|
+
async unbanUser(userId) {
|
|
643
|
+
await this.client.$fetch("/admin/unban-user", { method: "POST", body: { userId } });
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Permanently removes a user from the auth system.
|
|
647
|
+
* @param userId - The ID of the user to remove
|
|
648
|
+
*/
|
|
649
|
+
async removeUser(userId) {
|
|
650
|
+
await this.client.$fetch("/admin/remove-user", { method: "POST", body: { userId } });
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Cancels a pending invitation as a global admin.
|
|
654
|
+
* @param invitationId - The ID of the invitation to cancel
|
|
655
|
+
*/
|
|
656
|
+
async cancelInvite(invitationId) {
|
|
657
|
+
await this.client.$fetch("/admin/invites/cancel", { method: "POST", body: { invitationId } });
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Re-sends an organization invitation email as a global admin.
|
|
661
|
+
* @param options - Organization, email, role, and optional application and teams
|
|
662
|
+
*/
|
|
663
|
+
async resendInvite(options) {
|
|
664
|
+
await this.client.$fetch("/admin/organizations/users", {
|
|
665
|
+
method: "POST",
|
|
666
|
+
body: { ...options, sendInvite: true, resend: true }
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Invites several users to an organization in one call. Failures are
|
|
671
|
+
* isolated per email in the results payload.
|
|
672
|
+
*
|
|
673
|
+
* @param options - Organization, emails, role, and optional teams/application
|
|
674
|
+
* @returns Per-email invite outcomes
|
|
675
|
+
*/
|
|
676
|
+
async inviteOrganizationUsers(options) {
|
|
677
|
+
const { data } = await this.client.$fetch("/admin/organizations/users", {
|
|
678
|
+
method: "POST",
|
|
679
|
+
body: { ...options, sendInvite: true }
|
|
680
|
+
});
|
|
681
|
+
return data;
|
|
682
|
+
}
|
|
565
683
|
}
|
|
566
684
|
|
|
567
685
|
class BaseError extends Error {
|
|
@@ -1226,14 +1344,18 @@ class OrganizationService {
|
|
|
1226
1344
|
* Accepts an organization invitation.
|
|
1227
1345
|
*
|
|
1228
1346
|
* @param id - The invitation ID to accept
|
|
1229
|
-
* @returns
|
|
1230
|
-
* scoped to an application that defines one; otherwise `null`.
|
|
1347
|
+
* @returns The accepted member and the application's `homeUrl` when the invitation
|
|
1348
|
+
* is scoped to an application that defines one; otherwise `null`.
|
|
1231
1349
|
*/
|
|
1232
1350
|
async acceptInvitation(id) {
|
|
1233
1351
|
const response = await this.client.organization.acceptInvitation({
|
|
1234
1352
|
invitationId: id
|
|
1235
1353
|
});
|
|
1236
|
-
|
|
1354
|
+
const responseWithHomeUrl = response;
|
|
1355
|
+
return {
|
|
1356
|
+
homeUrl: responseWithHomeUrl.homeUrl ?? null,
|
|
1357
|
+
member: response.member
|
|
1358
|
+
};
|
|
1237
1359
|
}
|
|
1238
1360
|
/**
|
|
1239
1361
|
* Removes a user from the active organization.
|