@meistrari/auth-core 3.2.0 → 3.3.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 +149 -97
- package/dist/index.d.ts +149 -97
- package/dist/index.mjs +89 -18
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5218,6 +5218,97 @@ type InviteAdminOrganizationUsersResult = {
|
|
|
5218
5218
|
message?: string;
|
|
5219
5219
|
}[];
|
|
5220
5220
|
};
|
|
5221
|
+
/**
|
|
5222
|
+
* Entitlement that decides access to an application for one organization: the
|
|
5223
|
+
* organization's own, or global access shared by every organization.
|
|
5224
|
+
*/
|
|
5225
|
+
type AdminOrganizationApplicationEntitlement = {
|
|
5226
|
+
id: string;
|
|
5227
|
+
type: 'organization' | 'global';
|
|
5228
|
+
enabled: boolean;
|
|
5229
|
+
createdAt: string;
|
|
5230
|
+
};
|
|
5231
|
+
/**
|
|
5232
|
+
* Application available to one organization, as its admins see it.
|
|
5233
|
+
*/
|
|
5234
|
+
type AdminOrganizationEntitledApplication = {
|
|
5235
|
+
id: string;
|
|
5236
|
+
name: string;
|
|
5237
|
+
imageUrl: string | null;
|
|
5238
|
+
homeUrl: string | null;
|
|
5239
|
+
entitlement: AdminOrganizationApplicationEntitlement;
|
|
5240
|
+
/** Whether the caller can edit the rules here: only global admins, and only on the organization's own entitlement. */
|
|
5241
|
+
editable: boolean;
|
|
5242
|
+
/** When the application was disabled, or `null`. A disabled application refuses every sign-in, whatever its rules. */
|
|
5243
|
+
disabledAt: string | null;
|
|
5244
|
+
/** Rules in evaluation order; the first one that matches a member decides. */
|
|
5245
|
+
rules: Array<AdminEntitlementRule & {
|
|
5246
|
+
/** User-facing name of the role from the application role catalog. Null for denials and unknown roles. */
|
|
5247
|
+
roleDisplayName: string | null;
|
|
5248
|
+
}>;
|
|
5249
|
+
/** Active members the rules grant a role to. Zero while the entitlement or the application is disabled. */
|
|
5250
|
+
memberCount: number;
|
|
5251
|
+
members: AdminApplicationMember[];
|
|
5252
|
+
};
|
|
5253
|
+
/**
|
|
5254
|
+
* Role an application can grant, from its role catalog.
|
|
5255
|
+
*/
|
|
5256
|
+
type AdminOrganizationApplicationRole = {
|
|
5257
|
+
name: string;
|
|
5258
|
+
displayName: string;
|
|
5259
|
+
description: string;
|
|
5260
|
+
};
|
|
5261
|
+
/**
|
|
5262
|
+
* One application of an organization with the roles its rules can grant.
|
|
5263
|
+
*/
|
|
5264
|
+
type AdminOrganizationApplicationAccess = AdminOrganizationEntitledApplication & {
|
|
5265
|
+
roles: AdminOrganizationApplicationRole[];
|
|
5266
|
+
};
|
|
5267
|
+
/** Options accepted when listing the applications of an organization. */
|
|
5268
|
+
type ListAdminOrganizationApplicationsOptions = {
|
|
5269
|
+
organizationId: string;
|
|
5270
|
+
/** Case-insensitive application name match. */
|
|
5271
|
+
search?: string;
|
|
5272
|
+
};
|
|
5273
|
+
/** Options accepted when reading or listing members of one application of an organization. */
|
|
5274
|
+
type GetAdminOrganizationApplicationOptions = {
|
|
5275
|
+
organizationId: string;
|
|
5276
|
+
applicationId: string;
|
|
5277
|
+
};
|
|
5278
|
+
/** Options accepted when replacing the rules of an organization's own entitlement. */
|
|
5279
|
+
type SetAdminOrganizationApplicationRulesOptions = GetAdminOrganizationApplicationOptions & {
|
|
5280
|
+
/** Rules in evaluation order. Positions are assigned from the order. */
|
|
5281
|
+
rules: Array<Omit<AdminEntitlementRule, 'position'>>;
|
|
5282
|
+
};
|
|
5283
|
+
/** Options accepted when listing the members of an organization against one application. */
|
|
5284
|
+
type ListAdminOrganizationApplicationMembersOptions = GetAdminOrganizationApplicationOptions & {
|
|
5285
|
+
/** Case-insensitive name or email match. */
|
|
5286
|
+
query?: string;
|
|
5287
|
+
/** Maximum number of members to return. Defaults to 50. */
|
|
5288
|
+
limit?: number;
|
|
5289
|
+
/** Number of members to skip. Defaults to 0. */
|
|
5290
|
+
offset?: number;
|
|
5291
|
+
};
|
|
5292
|
+
/**
|
|
5293
|
+
* Active organization member with the outcome of an application's rules for them.
|
|
5294
|
+
*/
|
|
5295
|
+
type AdminOrganizationApplicationMember = AdminApplicationMember & {
|
|
5296
|
+
/** Role granted to the member, or null when no rule grants access. */
|
|
5297
|
+
role: string | null;
|
|
5298
|
+
roleDisplayName: string | null;
|
|
5299
|
+
/** First rule that matched the member, or null when none did. A matched rule with a null role denies access. */
|
|
5300
|
+
matchedRule: {
|
|
5301
|
+
type: AdminEntitlementRuleType;
|
|
5302
|
+
position: number;
|
|
5303
|
+
} | null;
|
|
5304
|
+
};
|
|
5305
|
+
/** Paginated listing of an organization's members against one application. */
|
|
5306
|
+
type ListAdminOrganizationApplicationMembersResult = {
|
|
5307
|
+
members: AdminOrganizationApplicationMember[];
|
|
5308
|
+
total: number;
|
|
5309
|
+
limit: number;
|
|
5310
|
+
offset: number;
|
|
5311
|
+
};
|
|
5221
5312
|
|
|
5222
5313
|
/**
|
|
5223
5314
|
* Service for global admin operations.
|
|
@@ -5250,6 +5341,12 @@ declare class AdminService {
|
|
|
5250
5341
|
* @returns The parsed JSON response
|
|
5251
5342
|
*/
|
|
5252
5343
|
private requestApplicationRoute;
|
|
5344
|
+
/**
|
|
5345
|
+
* Calls an admin endpoint and returns its JSON body. The client is configured
|
|
5346
|
+
* to throw on error responses, but better-auth types `$fetch` as returning
|
|
5347
|
+
* `{ data, error }`; this narrows the result to the body it actually resolves to.
|
|
5348
|
+
*/
|
|
5349
|
+
private fetchAdminRoute;
|
|
5253
5350
|
/**
|
|
5254
5351
|
* Lists applications, optionally filtered by organization.
|
|
5255
5352
|
*
|
|
@@ -5343,17 +5440,7 @@ declare class AdminService {
|
|
|
5343
5440
|
* @param options - Pagination, ordering, search, and preview options
|
|
5344
5441
|
* @returns The paginated organization listing
|
|
5345
5442
|
*/
|
|
5346
|
-
listOrganizations(options?: ListAdminOrganizationsOptions): Promise<
|
|
5347
|
-
data: null;
|
|
5348
|
-
error: {
|
|
5349
|
-
message?: string | undefined;
|
|
5350
|
-
status: number;
|
|
5351
|
-
statusText: string;
|
|
5352
|
-
};
|
|
5353
|
-
} | {
|
|
5354
|
-
data: ListAdminOrganizationsResult;
|
|
5355
|
-
error: null;
|
|
5356
|
-
}>;
|
|
5443
|
+
listOrganizations(options?: ListAdminOrganizationsOptions): Promise<ListAdminOrganizationsResult>;
|
|
5357
5444
|
/**
|
|
5358
5445
|
* Lists users, optionally with organization previews and totals when a
|
|
5359
5446
|
* preview size is requested. Global admins list across every organization
|
|
@@ -5363,17 +5450,7 @@ declare class AdminService {
|
|
|
5363
5450
|
* @param options - Pagination, ordering, search, preview, and organization options
|
|
5364
5451
|
* @returns The paginated user listing
|
|
5365
5452
|
*/
|
|
5366
|
-
listUsers(options?: ListAdminUsersOptions): Promise<
|
|
5367
|
-
data: null;
|
|
5368
|
-
error: {
|
|
5369
|
-
message?: string | undefined;
|
|
5370
|
-
status: number;
|
|
5371
|
-
statusText: string;
|
|
5372
|
-
};
|
|
5373
|
-
} | {
|
|
5374
|
-
data: ListAdminUsersResult;
|
|
5375
|
-
error: null;
|
|
5376
|
-
}>;
|
|
5453
|
+
listUsers(options?: ListAdminUsersOptions): Promise<ListAdminUsersResult>;
|
|
5377
5454
|
/**
|
|
5378
5455
|
* Fetches a single user by ID.
|
|
5379
5456
|
*
|
|
@@ -5388,9 +5465,7 @@ declare class AdminService {
|
|
|
5388
5465
|
* @param options - Organization ID and listing adjacency options
|
|
5389
5466
|
* @returns The organization
|
|
5390
5467
|
*/
|
|
5391
|
-
getOrganization(options: GetAdminOrganizationOptions): Promise<
|
|
5392
|
-
data: AdminOrganization;
|
|
5393
|
-
} | null>;
|
|
5468
|
+
getOrganization(options: GetAdminOrganizationOptions): Promise<AdminOrganization>;
|
|
5394
5469
|
/**
|
|
5395
5470
|
* Fetches minimal identity and branding (id, name, logo) for several
|
|
5396
5471
|
* organizations at once, for surfaces such as the vault pages that resolve
|
|
@@ -5402,7 +5477,7 @@ declare class AdminService {
|
|
|
5402
5477
|
* @param options - The workspace (organization) IDs to resolve
|
|
5403
5478
|
* @returns The organization summaries for the IDs that exist
|
|
5404
5479
|
*/
|
|
5405
|
-
getOrganizationsSummary(options: GetAdminOrganizationsSummaryOptions): Promise<
|
|
5480
|
+
getOrganizationsSummary(options: GetAdminOrganizationsSummaryOptions): Promise<AdminOrganizationSummary[]>;
|
|
5406
5481
|
/**
|
|
5407
5482
|
* Fetches the per-organization access report for a single user: their
|
|
5408
5483
|
* organizations with role, membership ID, and teams, plus each
|
|
@@ -5411,9 +5486,7 @@ declare class AdminService {
|
|
|
5411
5486
|
* @param userId - The ID of the user to fetch access for
|
|
5412
5487
|
* @returns The user access report
|
|
5413
5488
|
*/
|
|
5414
|
-
getUserAccess(userId: string): Promise<
|
|
5415
|
-
data: AdminUserAccess;
|
|
5416
|
-
} | null>;
|
|
5489
|
+
getUserAccess(userId: string): Promise<AdminUserAccess>;
|
|
5417
5490
|
/**
|
|
5418
5491
|
* Lists applications with their entitlements as a global admin. Unlike
|
|
5419
5492
|
* {@link listApplications}, which goes through the session-only application
|
|
@@ -5422,17 +5495,7 @@ declare class AdminService {
|
|
|
5422
5495
|
* @param options - Pagination, ordering, organization filter, search, and member preview options
|
|
5423
5496
|
* @returns The application listing with entitlement details
|
|
5424
5497
|
*/
|
|
5425
|
-
listAdminApplications(options?: ListAdminApplicationsOptions): Promise<
|
|
5426
|
-
data: null;
|
|
5427
|
-
error: {
|
|
5428
|
-
message?: string | undefined;
|
|
5429
|
-
status: number;
|
|
5430
|
-
statusText: string;
|
|
5431
|
-
};
|
|
5432
|
-
} | {
|
|
5433
|
-
data: ListAdminApplicationsResult;
|
|
5434
|
-
error: null;
|
|
5435
|
-
}>;
|
|
5498
|
+
listAdminApplications(options?: ListAdminApplicationsOptions): Promise<ListAdminApplicationsResult>;
|
|
5436
5499
|
/**
|
|
5437
5500
|
* Lists the users with access to an application as a global admin, one row
|
|
5438
5501
|
* per user with every organization that grants them access and the role it
|
|
@@ -5441,34 +5504,47 @@ declare class AdminService {
|
|
|
5441
5504
|
* @param options - Application ID, organization filter, pagination, and search options
|
|
5442
5505
|
* @returns The paginated application member listing
|
|
5443
5506
|
*/
|
|
5444
|
-
listApplicationMembers(options: ListAdminApplicationMembersOptions): Promise<
|
|
5445
|
-
data: null;
|
|
5446
|
-
error: {
|
|
5447
|
-
message?: string | undefined;
|
|
5448
|
-
status: number;
|
|
5449
|
-
statusText: string;
|
|
5450
|
-
};
|
|
5451
|
-
} | {
|
|
5452
|
-
data: ListAdminApplicationMembersResult;
|
|
5453
|
-
error: null;
|
|
5454
|
-
}>;
|
|
5507
|
+
listApplicationMembers(options: ListAdminApplicationMembersOptions): Promise<ListAdminApplicationMembersResult>;
|
|
5455
5508
|
/**
|
|
5456
5509
|
* Lists active members for one organization as a global admin.
|
|
5457
5510
|
*
|
|
5458
5511
|
* @param options - Organization ID, pagination, and search options
|
|
5459
5512
|
* @returns The paginated organization member listing
|
|
5460
5513
|
*/
|
|
5461
|
-
listOrganizationMembers(options: ListAdminOrganizationMembersOptions): Promise<
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5514
|
+
listOrganizationMembers(options: ListAdminOrganizationMembersOptions): Promise<ListAdminOrganizationMembersResult>;
|
|
5515
|
+
/**
|
|
5516
|
+
* Lists the applications available to one organization with the entitlement
|
|
5517
|
+
* that decides their access and its rules. Global admins may list any
|
|
5518
|
+
* organization; an organization admin only their own.
|
|
5519
|
+
*
|
|
5520
|
+
* @param options - Organization ID and search options
|
|
5521
|
+
* @returns The organization's applications
|
|
5522
|
+
*/
|
|
5523
|
+
listOrganizationApplications(options: ListAdminOrganizationApplicationsOptions): Promise<AdminOrganizationEntitledApplication[]>;
|
|
5524
|
+
/**
|
|
5525
|
+
* Fetches one application of an organization with its rules and the roles
|
|
5526
|
+
* those rules can grant.
|
|
5527
|
+
*
|
|
5528
|
+
* @param options - Organization and application IDs
|
|
5529
|
+
* @returns The application access
|
|
5530
|
+
*/
|
|
5531
|
+
getOrganizationApplication(options: GetAdminOrganizationApplicationOptions): Promise<AdminOrganizationApplicationAccess>;
|
|
5532
|
+
/**
|
|
5533
|
+
* Replaces the rules of an organization's own entitlement to an application,
|
|
5534
|
+
* in the order given, as a global admin. Global access is edited on the application.
|
|
5535
|
+
*
|
|
5536
|
+
* @param options - Organization and application IDs, and the rules in evaluation order
|
|
5537
|
+
* @returns The updated application access
|
|
5538
|
+
*/
|
|
5539
|
+
setOrganizationApplicationRules(options: SetAdminOrganizationApplicationRulesOptions): Promise<AdminOrganizationApplicationAccess>;
|
|
5540
|
+
/**
|
|
5541
|
+
* Lists every active member of an organization with the rule that decides
|
|
5542
|
+
* their access to an application and the role it grants.
|
|
5543
|
+
*
|
|
5544
|
+
* @param options - Organization and application IDs, pagination, and search options
|
|
5545
|
+
* @returns The paginated member listing
|
|
5546
|
+
*/
|
|
5547
|
+
listOrganizationApplicationMembers(options: ListAdminOrganizationApplicationMembersOptions): Promise<ListAdminOrganizationApplicationMembersResult>;
|
|
5472
5548
|
/**
|
|
5473
5549
|
* Lists teams for one organization. Global admins may list any organization;
|
|
5474
5550
|
* an organization admin only their own.
|
|
@@ -5476,26 +5552,14 @@ declare class AdminService {
|
|
|
5476
5552
|
* @param options - Organization ID, pagination, search, and ordering options
|
|
5477
5553
|
* @returns The paginated organization team listing
|
|
5478
5554
|
*/
|
|
5479
|
-
listOrganizationTeams(options: ListAdminOrganizationTeamsOptions): Promise<
|
|
5480
|
-
data: null;
|
|
5481
|
-
error: {
|
|
5482
|
-
message?: string | undefined;
|
|
5483
|
-
status: number;
|
|
5484
|
-
statusText: string;
|
|
5485
|
-
};
|
|
5486
|
-
} | {
|
|
5487
|
-
data: ListAdminOrganizationTeamsResult;
|
|
5488
|
-
error: null;
|
|
5489
|
-
}>;
|
|
5555
|
+
listOrganizationTeams(options: ListAdminOrganizationTeamsOptions): Promise<ListAdminOrganizationTeamsResult>;
|
|
5490
5556
|
/**
|
|
5491
5557
|
* Creates a team for one organization as a global admin.
|
|
5492
5558
|
*
|
|
5493
5559
|
* @param options - Organization ID, team name, and optional team members
|
|
5494
5560
|
* @returns The created team
|
|
5495
5561
|
*/
|
|
5496
|
-
createOrganizationTeam(options: CreateAdminOrganizationTeamOptions): Promise<
|
|
5497
|
-
data: AdminOrganizationTeamRecord;
|
|
5498
|
-
} | null>;
|
|
5562
|
+
createOrganizationTeam(options: CreateAdminOrganizationTeamOptions): Promise<AdminOrganizationTeamRecord>;
|
|
5499
5563
|
/**
|
|
5500
5564
|
* Updates a team for one organization. Global admins may update any
|
|
5501
5565
|
* organization; an organization admin only their own.
|
|
@@ -5503,9 +5567,7 @@ declare class AdminService {
|
|
|
5503
5567
|
* @param options - Organization ID, team ID, new name, and optional replacement member IDs
|
|
5504
5568
|
* @returns The updated team
|
|
5505
5569
|
*/
|
|
5506
|
-
updateOrganizationTeam(options: UpdateAdminOrganizationTeamOptions): Promise<
|
|
5507
|
-
data: AdminOrganizationTeamRecord;
|
|
5508
|
-
} | null>;
|
|
5570
|
+
updateOrganizationTeam(options: UpdateAdminOrganizationTeamOptions): Promise<AdminOrganizationTeamRecord>;
|
|
5509
5571
|
/**
|
|
5510
5572
|
* Deletes a team for one organization, detaching its members with it.
|
|
5511
5573
|
* Global admins may delete from any organization; an organization admin
|
|
@@ -5550,9 +5612,7 @@ declare class AdminService {
|
|
|
5550
5612
|
* @param options - Organization name and optional slug, logo, metadata, and settings
|
|
5551
5613
|
* @returns The created organization
|
|
5552
5614
|
*/
|
|
5553
|
-
createOrganization(options: CreateAdminOrganizationOptions): Promise<
|
|
5554
|
-
data: AdminOrganization;
|
|
5555
|
-
} | null>;
|
|
5615
|
+
createOrganization(options: CreateAdminOrganizationOptions): Promise<AdminOrganization>;
|
|
5556
5616
|
/**
|
|
5557
5617
|
* Updates an organization's profile and settings. Global admins may update
|
|
5558
5618
|
* any organization; an organization admin only their own, and only the
|
|
@@ -5562,27 +5622,21 @@ declare class AdminService {
|
|
|
5562
5622
|
* @param options - Organization ID and the fields to update
|
|
5563
5623
|
* @returns The updated organization
|
|
5564
5624
|
*/
|
|
5565
|
-
updateOrganization(options: UpdateAdminOrganizationOptions): Promise<
|
|
5566
|
-
data: AdminOrganization;
|
|
5567
|
-
} | null>;
|
|
5625
|
+
updateOrganization(options: UpdateAdminOrganizationOptions): Promise<AdminOrganization>;
|
|
5568
5626
|
/**
|
|
5569
5627
|
* Updates an organization member's role.
|
|
5570
5628
|
*
|
|
5571
5629
|
* @param options - Membership ID and the new role
|
|
5572
5630
|
* @returns The updated membership
|
|
5573
5631
|
*/
|
|
5574
|
-
updateMemberRole(options: UpdateAdminMemberRoleOptions): Promise<
|
|
5575
|
-
data: AdminMember;
|
|
5576
|
-
} | null>;
|
|
5632
|
+
updateMemberRole(options: UpdateAdminMemberRoleOptions): Promise<AdminMember>;
|
|
5577
5633
|
/**
|
|
5578
5634
|
* Removes an organization member.
|
|
5579
5635
|
*
|
|
5580
5636
|
* @param options - Membership ID to remove
|
|
5581
5637
|
* @returns The removed membership
|
|
5582
5638
|
*/
|
|
5583
|
-
removeMember(options: RemoveAdminMemberOptions): Promise<
|
|
5584
|
-
data: AdminMember;
|
|
5585
|
-
} | null>;
|
|
5639
|
+
removeMember(options: RemoveAdminMemberOptions): Promise<AdminMember>;
|
|
5586
5640
|
/**
|
|
5587
5641
|
* Sets a user's effective application role within an organization. A
|
|
5588
5642
|
* non-null role grants access, a null role denies access (leave
|
|
@@ -5644,9 +5698,7 @@ declare class AdminService {
|
|
|
5644
5698
|
* @param options - Organization, emails, role, and optional teams/application
|
|
5645
5699
|
* @returns Per-email invite outcomes
|
|
5646
5700
|
*/
|
|
5647
|
-
inviteOrganizationUsers(options: InviteAdminOrganizationUsersOptions): Promise<
|
|
5648
|
-
data: InviteAdminOrganizationUsersResult;
|
|
5649
|
-
} | null>;
|
|
5701
|
+
inviteOrganizationUsers(options: InviteAdminOrganizationUsersOptions): Promise<InviteAdminOrganizationUsersResult>;
|
|
5650
5702
|
}
|
|
5651
5703
|
|
|
5652
5704
|
/**
|
|
@@ -5680,8 +5732,8 @@ type AcceptInvitationResult = {
|
|
|
5680
5732
|
homeUrl: string | null;
|
|
5681
5733
|
/** Configured post-acceptance URL for plain organization invitations. */
|
|
5682
5734
|
inviteAcceptedUrl: string | null;
|
|
5683
|
-
/** The accepted organization membership. This may be an existing membership. */
|
|
5684
|
-
member: Member
|
|
5735
|
+
/** The accepted organization membership. This may be an existing membership. It does not include the user record. */
|
|
5736
|
+
member: Omit<Member, 'user'>;
|
|
5685
5737
|
};
|
|
5686
5738
|
/**
|
|
5687
5739
|
* Fields that can be updated on an organization.
|
|
@@ -6677,4 +6729,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
6677
6729
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
6678
6730
|
|
|
6679
6731
|
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationDisabledError, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, ApplicationTokenStorage, 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, LOGIN_METHODS, 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, normalizeAmr, organizationAdditionalFields, parseApplicationDisabledPayload, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
6680
|
-
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationIdentity, AdminApplicationMember, AdminApplicationMemberOrganization, AdminApplicationMemberRecord, AdminApplicationOrganization, AdminApplicationRecord, AdminApplicationRole, AdminApplicationSecret, AdminEntitlementRule, AdminEntitlementRuleType, AdminEntitlementWithRules, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationSummary, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, ApplicationDeprecation, ApplicationDisabledPayload, ApplicationRole, ApplicationScopedMember, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, DisableAdminApplicationOptions, EmailOTPSignInOptions, FullOrganization, FullOrganizationMember, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, GetTokenOptions, Invitation, InvitationPasswordSetupResult, InvitationSignupStatus, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationMembersOptions, ListAdminApplicationMembersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsInclude, ListCandidateOrganizationsOptions, ListCandidateOrganizationsResponse, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithRoleOptions, LoginMethod, LoginMethodsResponse, Member, ExtendedOrganization as Organization, OrganizationSettings, OrganizationWithRole, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminEntitlementRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserPasswordOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSsoOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, TeamMembersResponse, UpdateAdminApplicationRoleOptions, UpdateAdminEntitlementOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
|
6732
|
+
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationIdentity, AdminApplicationMember, AdminApplicationMemberOrganization, AdminApplicationMemberRecord, AdminApplicationOrganization, AdminApplicationRecord, AdminApplicationRole, AdminApplicationSecret, AdminEntitlementRule, AdminEntitlementRuleType, AdminEntitlementWithRules, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationApplicationAccess, AdminOrganizationApplicationEntitlement, AdminOrganizationApplicationMember, AdminOrganizationApplicationRole, AdminOrganizationEntitledApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationSummary, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, ApplicationDeprecation, ApplicationDisabledPayload, ApplicationRole, ApplicationScopedMember, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, DisableAdminApplicationOptions, EmailOTPSignInOptions, FullOrganization, FullOrganizationMember, GetAdminOrganizationApplicationOptions, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, GetTokenOptions, Invitation, InvitationPasswordSetupResult, InvitationSignupStatus, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationMembersOptions, ListAdminApplicationMembersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationApplicationMembersOptions, ListAdminOrganizationApplicationMembersResult, ListAdminOrganizationApplicationsOptions, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsInclude, ListCandidateOrganizationsOptions, ListCandidateOrganizationsResponse, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithRoleOptions, LoginMethod, LoginMethodsResponse, Member, ExtendedOrganization as Organization, OrganizationSettings, OrganizationWithRole, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminEntitlementRulesOptions, SetAdminOrganizationApplicationRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserPasswordOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSsoOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, TeamMembersResponse, UpdateAdminApplicationRoleOptions, UpdateAdminEntitlementOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -5218,6 +5218,97 @@ type InviteAdminOrganizationUsersResult = {
|
|
|
5218
5218
|
message?: string;
|
|
5219
5219
|
}[];
|
|
5220
5220
|
};
|
|
5221
|
+
/**
|
|
5222
|
+
* Entitlement that decides access to an application for one organization: the
|
|
5223
|
+
* organization's own, or global access shared by every organization.
|
|
5224
|
+
*/
|
|
5225
|
+
type AdminOrganizationApplicationEntitlement = {
|
|
5226
|
+
id: string;
|
|
5227
|
+
type: 'organization' | 'global';
|
|
5228
|
+
enabled: boolean;
|
|
5229
|
+
createdAt: string;
|
|
5230
|
+
};
|
|
5231
|
+
/**
|
|
5232
|
+
* Application available to one organization, as its admins see it.
|
|
5233
|
+
*/
|
|
5234
|
+
type AdminOrganizationEntitledApplication = {
|
|
5235
|
+
id: string;
|
|
5236
|
+
name: string;
|
|
5237
|
+
imageUrl: string | null;
|
|
5238
|
+
homeUrl: string | null;
|
|
5239
|
+
entitlement: AdminOrganizationApplicationEntitlement;
|
|
5240
|
+
/** Whether the caller can edit the rules here: only global admins, and only on the organization's own entitlement. */
|
|
5241
|
+
editable: boolean;
|
|
5242
|
+
/** When the application was disabled, or `null`. A disabled application refuses every sign-in, whatever its rules. */
|
|
5243
|
+
disabledAt: string | null;
|
|
5244
|
+
/** Rules in evaluation order; the first one that matches a member decides. */
|
|
5245
|
+
rules: Array<AdminEntitlementRule & {
|
|
5246
|
+
/** User-facing name of the role from the application role catalog. Null for denials and unknown roles. */
|
|
5247
|
+
roleDisplayName: string | null;
|
|
5248
|
+
}>;
|
|
5249
|
+
/** Active members the rules grant a role to. Zero while the entitlement or the application is disabled. */
|
|
5250
|
+
memberCount: number;
|
|
5251
|
+
members: AdminApplicationMember[];
|
|
5252
|
+
};
|
|
5253
|
+
/**
|
|
5254
|
+
* Role an application can grant, from its role catalog.
|
|
5255
|
+
*/
|
|
5256
|
+
type AdminOrganizationApplicationRole = {
|
|
5257
|
+
name: string;
|
|
5258
|
+
displayName: string;
|
|
5259
|
+
description: string;
|
|
5260
|
+
};
|
|
5261
|
+
/**
|
|
5262
|
+
* One application of an organization with the roles its rules can grant.
|
|
5263
|
+
*/
|
|
5264
|
+
type AdminOrganizationApplicationAccess = AdminOrganizationEntitledApplication & {
|
|
5265
|
+
roles: AdminOrganizationApplicationRole[];
|
|
5266
|
+
};
|
|
5267
|
+
/** Options accepted when listing the applications of an organization. */
|
|
5268
|
+
type ListAdminOrganizationApplicationsOptions = {
|
|
5269
|
+
organizationId: string;
|
|
5270
|
+
/** Case-insensitive application name match. */
|
|
5271
|
+
search?: string;
|
|
5272
|
+
};
|
|
5273
|
+
/** Options accepted when reading or listing members of one application of an organization. */
|
|
5274
|
+
type GetAdminOrganizationApplicationOptions = {
|
|
5275
|
+
organizationId: string;
|
|
5276
|
+
applicationId: string;
|
|
5277
|
+
};
|
|
5278
|
+
/** Options accepted when replacing the rules of an organization's own entitlement. */
|
|
5279
|
+
type SetAdminOrganizationApplicationRulesOptions = GetAdminOrganizationApplicationOptions & {
|
|
5280
|
+
/** Rules in evaluation order. Positions are assigned from the order. */
|
|
5281
|
+
rules: Array<Omit<AdminEntitlementRule, 'position'>>;
|
|
5282
|
+
};
|
|
5283
|
+
/** Options accepted when listing the members of an organization against one application. */
|
|
5284
|
+
type ListAdminOrganizationApplicationMembersOptions = GetAdminOrganizationApplicationOptions & {
|
|
5285
|
+
/** Case-insensitive name or email match. */
|
|
5286
|
+
query?: string;
|
|
5287
|
+
/** Maximum number of members to return. Defaults to 50. */
|
|
5288
|
+
limit?: number;
|
|
5289
|
+
/** Number of members to skip. Defaults to 0. */
|
|
5290
|
+
offset?: number;
|
|
5291
|
+
};
|
|
5292
|
+
/**
|
|
5293
|
+
* Active organization member with the outcome of an application's rules for them.
|
|
5294
|
+
*/
|
|
5295
|
+
type AdminOrganizationApplicationMember = AdminApplicationMember & {
|
|
5296
|
+
/** Role granted to the member, or null when no rule grants access. */
|
|
5297
|
+
role: string | null;
|
|
5298
|
+
roleDisplayName: string | null;
|
|
5299
|
+
/** First rule that matched the member, or null when none did. A matched rule with a null role denies access. */
|
|
5300
|
+
matchedRule: {
|
|
5301
|
+
type: AdminEntitlementRuleType;
|
|
5302
|
+
position: number;
|
|
5303
|
+
} | null;
|
|
5304
|
+
};
|
|
5305
|
+
/** Paginated listing of an organization's members against one application. */
|
|
5306
|
+
type ListAdminOrganizationApplicationMembersResult = {
|
|
5307
|
+
members: AdminOrganizationApplicationMember[];
|
|
5308
|
+
total: number;
|
|
5309
|
+
limit: number;
|
|
5310
|
+
offset: number;
|
|
5311
|
+
};
|
|
5221
5312
|
|
|
5222
5313
|
/**
|
|
5223
5314
|
* Service for global admin operations.
|
|
@@ -5250,6 +5341,12 @@ declare class AdminService {
|
|
|
5250
5341
|
* @returns The parsed JSON response
|
|
5251
5342
|
*/
|
|
5252
5343
|
private requestApplicationRoute;
|
|
5344
|
+
/**
|
|
5345
|
+
* Calls an admin endpoint and returns its JSON body. The client is configured
|
|
5346
|
+
* to throw on error responses, but better-auth types `$fetch` as returning
|
|
5347
|
+
* `{ data, error }`; this narrows the result to the body it actually resolves to.
|
|
5348
|
+
*/
|
|
5349
|
+
private fetchAdminRoute;
|
|
5253
5350
|
/**
|
|
5254
5351
|
* Lists applications, optionally filtered by organization.
|
|
5255
5352
|
*
|
|
@@ -5343,17 +5440,7 @@ declare class AdminService {
|
|
|
5343
5440
|
* @param options - Pagination, ordering, search, and preview options
|
|
5344
5441
|
* @returns The paginated organization listing
|
|
5345
5442
|
*/
|
|
5346
|
-
listOrganizations(options?: ListAdminOrganizationsOptions): Promise<
|
|
5347
|
-
data: null;
|
|
5348
|
-
error: {
|
|
5349
|
-
message?: string | undefined;
|
|
5350
|
-
status: number;
|
|
5351
|
-
statusText: string;
|
|
5352
|
-
};
|
|
5353
|
-
} | {
|
|
5354
|
-
data: ListAdminOrganizationsResult;
|
|
5355
|
-
error: null;
|
|
5356
|
-
}>;
|
|
5443
|
+
listOrganizations(options?: ListAdminOrganizationsOptions): Promise<ListAdminOrganizationsResult>;
|
|
5357
5444
|
/**
|
|
5358
5445
|
* Lists users, optionally with organization previews and totals when a
|
|
5359
5446
|
* preview size is requested. Global admins list across every organization
|
|
@@ -5363,17 +5450,7 @@ declare class AdminService {
|
|
|
5363
5450
|
* @param options - Pagination, ordering, search, preview, and organization options
|
|
5364
5451
|
* @returns The paginated user listing
|
|
5365
5452
|
*/
|
|
5366
|
-
listUsers(options?: ListAdminUsersOptions): Promise<
|
|
5367
|
-
data: null;
|
|
5368
|
-
error: {
|
|
5369
|
-
message?: string | undefined;
|
|
5370
|
-
status: number;
|
|
5371
|
-
statusText: string;
|
|
5372
|
-
};
|
|
5373
|
-
} | {
|
|
5374
|
-
data: ListAdminUsersResult;
|
|
5375
|
-
error: null;
|
|
5376
|
-
}>;
|
|
5453
|
+
listUsers(options?: ListAdminUsersOptions): Promise<ListAdminUsersResult>;
|
|
5377
5454
|
/**
|
|
5378
5455
|
* Fetches a single user by ID.
|
|
5379
5456
|
*
|
|
@@ -5388,9 +5465,7 @@ declare class AdminService {
|
|
|
5388
5465
|
* @param options - Organization ID and listing adjacency options
|
|
5389
5466
|
* @returns The organization
|
|
5390
5467
|
*/
|
|
5391
|
-
getOrganization(options: GetAdminOrganizationOptions): Promise<
|
|
5392
|
-
data: AdminOrganization;
|
|
5393
|
-
} | null>;
|
|
5468
|
+
getOrganization(options: GetAdminOrganizationOptions): Promise<AdminOrganization>;
|
|
5394
5469
|
/**
|
|
5395
5470
|
* Fetches minimal identity and branding (id, name, logo) for several
|
|
5396
5471
|
* organizations at once, for surfaces such as the vault pages that resolve
|
|
@@ -5402,7 +5477,7 @@ declare class AdminService {
|
|
|
5402
5477
|
* @param options - The workspace (organization) IDs to resolve
|
|
5403
5478
|
* @returns The organization summaries for the IDs that exist
|
|
5404
5479
|
*/
|
|
5405
|
-
getOrganizationsSummary(options: GetAdminOrganizationsSummaryOptions): Promise<
|
|
5480
|
+
getOrganizationsSummary(options: GetAdminOrganizationsSummaryOptions): Promise<AdminOrganizationSummary[]>;
|
|
5406
5481
|
/**
|
|
5407
5482
|
* Fetches the per-organization access report for a single user: their
|
|
5408
5483
|
* organizations with role, membership ID, and teams, plus each
|
|
@@ -5411,9 +5486,7 @@ declare class AdminService {
|
|
|
5411
5486
|
* @param userId - The ID of the user to fetch access for
|
|
5412
5487
|
* @returns The user access report
|
|
5413
5488
|
*/
|
|
5414
|
-
getUserAccess(userId: string): Promise<
|
|
5415
|
-
data: AdminUserAccess;
|
|
5416
|
-
} | null>;
|
|
5489
|
+
getUserAccess(userId: string): Promise<AdminUserAccess>;
|
|
5417
5490
|
/**
|
|
5418
5491
|
* Lists applications with their entitlements as a global admin. Unlike
|
|
5419
5492
|
* {@link listApplications}, which goes through the session-only application
|
|
@@ -5422,17 +5495,7 @@ declare class AdminService {
|
|
|
5422
5495
|
* @param options - Pagination, ordering, organization filter, search, and member preview options
|
|
5423
5496
|
* @returns The application listing with entitlement details
|
|
5424
5497
|
*/
|
|
5425
|
-
listAdminApplications(options?: ListAdminApplicationsOptions): Promise<
|
|
5426
|
-
data: null;
|
|
5427
|
-
error: {
|
|
5428
|
-
message?: string | undefined;
|
|
5429
|
-
status: number;
|
|
5430
|
-
statusText: string;
|
|
5431
|
-
};
|
|
5432
|
-
} | {
|
|
5433
|
-
data: ListAdminApplicationsResult;
|
|
5434
|
-
error: null;
|
|
5435
|
-
}>;
|
|
5498
|
+
listAdminApplications(options?: ListAdminApplicationsOptions): Promise<ListAdminApplicationsResult>;
|
|
5436
5499
|
/**
|
|
5437
5500
|
* Lists the users with access to an application as a global admin, one row
|
|
5438
5501
|
* per user with every organization that grants them access and the role it
|
|
@@ -5441,34 +5504,47 @@ declare class AdminService {
|
|
|
5441
5504
|
* @param options - Application ID, organization filter, pagination, and search options
|
|
5442
5505
|
* @returns The paginated application member listing
|
|
5443
5506
|
*/
|
|
5444
|
-
listApplicationMembers(options: ListAdminApplicationMembersOptions): Promise<
|
|
5445
|
-
data: null;
|
|
5446
|
-
error: {
|
|
5447
|
-
message?: string | undefined;
|
|
5448
|
-
status: number;
|
|
5449
|
-
statusText: string;
|
|
5450
|
-
};
|
|
5451
|
-
} | {
|
|
5452
|
-
data: ListAdminApplicationMembersResult;
|
|
5453
|
-
error: null;
|
|
5454
|
-
}>;
|
|
5507
|
+
listApplicationMembers(options: ListAdminApplicationMembersOptions): Promise<ListAdminApplicationMembersResult>;
|
|
5455
5508
|
/**
|
|
5456
5509
|
* Lists active members for one organization as a global admin.
|
|
5457
5510
|
*
|
|
5458
5511
|
* @param options - Organization ID, pagination, and search options
|
|
5459
5512
|
* @returns The paginated organization member listing
|
|
5460
5513
|
*/
|
|
5461
|
-
listOrganizationMembers(options: ListAdminOrganizationMembersOptions): Promise<
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5514
|
+
listOrganizationMembers(options: ListAdminOrganizationMembersOptions): Promise<ListAdminOrganizationMembersResult>;
|
|
5515
|
+
/**
|
|
5516
|
+
* Lists the applications available to one organization with the entitlement
|
|
5517
|
+
* that decides their access and its rules. Global admins may list any
|
|
5518
|
+
* organization; an organization admin only their own.
|
|
5519
|
+
*
|
|
5520
|
+
* @param options - Organization ID and search options
|
|
5521
|
+
* @returns The organization's applications
|
|
5522
|
+
*/
|
|
5523
|
+
listOrganizationApplications(options: ListAdminOrganizationApplicationsOptions): Promise<AdminOrganizationEntitledApplication[]>;
|
|
5524
|
+
/**
|
|
5525
|
+
* Fetches one application of an organization with its rules and the roles
|
|
5526
|
+
* those rules can grant.
|
|
5527
|
+
*
|
|
5528
|
+
* @param options - Organization and application IDs
|
|
5529
|
+
* @returns The application access
|
|
5530
|
+
*/
|
|
5531
|
+
getOrganizationApplication(options: GetAdminOrganizationApplicationOptions): Promise<AdminOrganizationApplicationAccess>;
|
|
5532
|
+
/**
|
|
5533
|
+
* Replaces the rules of an organization's own entitlement to an application,
|
|
5534
|
+
* in the order given, as a global admin. Global access is edited on the application.
|
|
5535
|
+
*
|
|
5536
|
+
* @param options - Organization and application IDs, and the rules in evaluation order
|
|
5537
|
+
* @returns The updated application access
|
|
5538
|
+
*/
|
|
5539
|
+
setOrganizationApplicationRules(options: SetAdminOrganizationApplicationRulesOptions): Promise<AdminOrganizationApplicationAccess>;
|
|
5540
|
+
/**
|
|
5541
|
+
* Lists every active member of an organization with the rule that decides
|
|
5542
|
+
* their access to an application and the role it grants.
|
|
5543
|
+
*
|
|
5544
|
+
* @param options - Organization and application IDs, pagination, and search options
|
|
5545
|
+
* @returns The paginated member listing
|
|
5546
|
+
*/
|
|
5547
|
+
listOrganizationApplicationMembers(options: ListAdminOrganizationApplicationMembersOptions): Promise<ListAdminOrganizationApplicationMembersResult>;
|
|
5472
5548
|
/**
|
|
5473
5549
|
* Lists teams for one organization. Global admins may list any organization;
|
|
5474
5550
|
* an organization admin only their own.
|
|
@@ -5476,26 +5552,14 @@ declare class AdminService {
|
|
|
5476
5552
|
* @param options - Organization ID, pagination, search, and ordering options
|
|
5477
5553
|
* @returns The paginated organization team listing
|
|
5478
5554
|
*/
|
|
5479
|
-
listOrganizationTeams(options: ListAdminOrganizationTeamsOptions): Promise<
|
|
5480
|
-
data: null;
|
|
5481
|
-
error: {
|
|
5482
|
-
message?: string | undefined;
|
|
5483
|
-
status: number;
|
|
5484
|
-
statusText: string;
|
|
5485
|
-
};
|
|
5486
|
-
} | {
|
|
5487
|
-
data: ListAdminOrganizationTeamsResult;
|
|
5488
|
-
error: null;
|
|
5489
|
-
}>;
|
|
5555
|
+
listOrganizationTeams(options: ListAdminOrganizationTeamsOptions): Promise<ListAdminOrganizationTeamsResult>;
|
|
5490
5556
|
/**
|
|
5491
5557
|
* Creates a team for one organization as a global admin.
|
|
5492
5558
|
*
|
|
5493
5559
|
* @param options - Organization ID, team name, and optional team members
|
|
5494
5560
|
* @returns The created team
|
|
5495
5561
|
*/
|
|
5496
|
-
createOrganizationTeam(options: CreateAdminOrganizationTeamOptions): Promise<
|
|
5497
|
-
data: AdminOrganizationTeamRecord;
|
|
5498
|
-
} | null>;
|
|
5562
|
+
createOrganizationTeam(options: CreateAdminOrganizationTeamOptions): Promise<AdminOrganizationTeamRecord>;
|
|
5499
5563
|
/**
|
|
5500
5564
|
* Updates a team for one organization. Global admins may update any
|
|
5501
5565
|
* organization; an organization admin only their own.
|
|
@@ -5503,9 +5567,7 @@ declare class AdminService {
|
|
|
5503
5567
|
* @param options - Organization ID, team ID, new name, and optional replacement member IDs
|
|
5504
5568
|
* @returns The updated team
|
|
5505
5569
|
*/
|
|
5506
|
-
updateOrganizationTeam(options: UpdateAdminOrganizationTeamOptions): Promise<
|
|
5507
|
-
data: AdminOrganizationTeamRecord;
|
|
5508
|
-
} | null>;
|
|
5570
|
+
updateOrganizationTeam(options: UpdateAdminOrganizationTeamOptions): Promise<AdminOrganizationTeamRecord>;
|
|
5509
5571
|
/**
|
|
5510
5572
|
* Deletes a team for one organization, detaching its members with it.
|
|
5511
5573
|
* Global admins may delete from any organization; an organization admin
|
|
@@ -5550,9 +5612,7 @@ declare class AdminService {
|
|
|
5550
5612
|
* @param options - Organization name and optional slug, logo, metadata, and settings
|
|
5551
5613
|
* @returns The created organization
|
|
5552
5614
|
*/
|
|
5553
|
-
createOrganization(options: CreateAdminOrganizationOptions): Promise<
|
|
5554
|
-
data: AdminOrganization;
|
|
5555
|
-
} | null>;
|
|
5615
|
+
createOrganization(options: CreateAdminOrganizationOptions): Promise<AdminOrganization>;
|
|
5556
5616
|
/**
|
|
5557
5617
|
* Updates an organization's profile and settings. Global admins may update
|
|
5558
5618
|
* any organization; an organization admin only their own, and only the
|
|
@@ -5562,27 +5622,21 @@ declare class AdminService {
|
|
|
5562
5622
|
* @param options - Organization ID and the fields to update
|
|
5563
5623
|
* @returns The updated organization
|
|
5564
5624
|
*/
|
|
5565
|
-
updateOrganization(options: UpdateAdminOrganizationOptions): Promise<
|
|
5566
|
-
data: AdminOrganization;
|
|
5567
|
-
} | null>;
|
|
5625
|
+
updateOrganization(options: UpdateAdminOrganizationOptions): Promise<AdminOrganization>;
|
|
5568
5626
|
/**
|
|
5569
5627
|
* Updates an organization member's role.
|
|
5570
5628
|
*
|
|
5571
5629
|
* @param options - Membership ID and the new role
|
|
5572
5630
|
* @returns The updated membership
|
|
5573
5631
|
*/
|
|
5574
|
-
updateMemberRole(options: UpdateAdminMemberRoleOptions): Promise<
|
|
5575
|
-
data: AdminMember;
|
|
5576
|
-
} | null>;
|
|
5632
|
+
updateMemberRole(options: UpdateAdminMemberRoleOptions): Promise<AdminMember>;
|
|
5577
5633
|
/**
|
|
5578
5634
|
* Removes an organization member.
|
|
5579
5635
|
*
|
|
5580
5636
|
* @param options - Membership ID to remove
|
|
5581
5637
|
* @returns The removed membership
|
|
5582
5638
|
*/
|
|
5583
|
-
removeMember(options: RemoveAdminMemberOptions): Promise<
|
|
5584
|
-
data: AdminMember;
|
|
5585
|
-
} | null>;
|
|
5639
|
+
removeMember(options: RemoveAdminMemberOptions): Promise<AdminMember>;
|
|
5586
5640
|
/**
|
|
5587
5641
|
* Sets a user's effective application role within an organization. A
|
|
5588
5642
|
* non-null role grants access, a null role denies access (leave
|
|
@@ -5644,9 +5698,7 @@ declare class AdminService {
|
|
|
5644
5698
|
* @param options - Organization, emails, role, and optional teams/application
|
|
5645
5699
|
* @returns Per-email invite outcomes
|
|
5646
5700
|
*/
|
|
5647
|
-
inviteOrganizationUsers(options: InviteAdminOrganizationUsersOptions): Promise<
|
|
5648
|
-
data: InviteAdminOrganizationUsersResult;
|
|
5649
|
-
} | null>;
|
|
5701
|
+
inviteOrganizationUsers(options: InviteAdminOrganizationUsersOptions): Promise<InviteAdminOrganizationUsersResult>;
|
|
5650
5702
|
}
|
|
5651
5703
|
|
|
5652
5704
|
/**
|
|
@@ -5680,8 +5732,8 @@ type AcceptInvitationResult = {
|
|
|
5680
5732
|
homeUrl: string | null;
|
|
5681
5733
|
/** Configured post-acceptance URL for plain organization invitations. */
|
|
5682
5734
|
inviteAcceptedUrl: string | null;
|
|
5683
|
-
/** The accepted organization membership. This may be an existing membership. */
|
|
5684
|
-
member: Member
|
|
5735
|
+
/** The accepted organization membership. This may be an existing membership. It does not include the user record. */
|
|
5736
|
+
member: Omit<Member, 'user'>;
|
|
5685
5737
|
};
|
|
5686
5738
|
/**
|
|
5687
5739
|
* Fields that can be updated on an organization.
|
|
@@ -6677,4 +6729,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
6677
6729
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
6678
6730
|
|
|
6679
6731
|
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationDisabledError, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, ApplicationTokenStorage, 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, LOGIN_METHODS, 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, normalizeAmr, organizationAdditionalFields, parseApplicationDisabledPayload, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
6680
|
-
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationIdentity, AdminApplicationMember, AdminApplicationMemberOrganization, AdminApplicationMemberRecord, AdminApplicationOrganization, AdminApplicationRecord, AdminApplicationRole, AdminApplicationSecret, AdminEntitlementRule, AdminEntitlementRuleType, AdminEntitlementWithRules, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationSummary, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, ApplicationDeprecation, ApplicationDisabledPayload, ApplicationRole, ApplicationScopedMember, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, DisableAdminApplicationOptions, EmailOTPSignInOptions, FullOrganization, FullOrganizationMember, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, GetTokenOptions, Invitation, InvitationPasswordSetupResult, InvitationSignupStatus, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationMembersOptions, ListAdminApplicationMembersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsInclude, ListCandidateOrganizationsOptions, ListCandidateOrganizationsResponse, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithRoleOptions, LoginMethod, LoginMethodsResponse, Member, ExtendedOrganization as Organization, OrganizationSettings, OrganizationWithRole, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminEntitlementRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserPasswordOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSsoOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, TeamMembersResponse, UpdateAdminApplicationRoleOptions, UpdateAdminEntitlementOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
|
6732
|
+
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationIdentity, AdminApplicationMember, AdminApplicationMemberOrganization, AdminApplicationMemberRecord, AdminApplicationOrganization, AdminApplicationRecord, AdminApplicationRole, AdminApplicationSecret, AdminEntitlementRule, AdminEntitlementRuleType, AdminEntitlementWithRules, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationApplicationAccess, AdminOrganizationApplicationEntitlement, AdminOrganizationApplicationMember, AdminOrganizationApplicationRole, AdminOrganizationEntitledApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationSummary, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, ApplicationDeprecation, ApplicationDisabledPayload, ApplicationRole, ApplicationScopedMember, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, DisableAdminApplicationOptions, EmailOTPSignInOptions, FullOrganization, FullOrganizationMember, GetAdminOrganizationApplicationOptions, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, GetTokenOptions, Invitation, InvitationPasswordSetupResult, InvitationSignupStatus, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationMembersOptions, ListAdminApplicationMembersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationApplicationMembersOptions, ListAdminOrganizationApplicationMembersResult, ListAdminOrganizationApplicationsOptions, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsInclude, ListCandidateOrganizationsOptions, ListCandidateOrganizationsResponse, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithRoleOptions, LoginMethod, LoginMethodsResponse, Member, ExtendedOrganization as Organization, OrganizationSettings, OrganizationWithRole, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminEntitlementRulesOptions, SetAdminOrganizationApplicationRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserPasswordOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSsoOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, TeamMembersResponse, UpdateAdminApplicationRoleOptions, UpdateAdminEntitlementOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ function isTokenExpired(token, expiresInMs) {
|
|
|
21
21
|
return nowInSeconds > expirationTime;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const version = "3.
|
|
24
|
+
const version = "3.3.0";
|
|
25
25
|
|
|
26
26
|
function parsedEnumValues(schema) {
|
|
27
27
|
return Object.fromEntries(
|
|
@@ -548,7 +548,7 @@ class AdminService {
|
|
|
548
548
|
async requestApplicationRoute(path, request = {}) {
|
|
549
549
|
const base = this.apiUrl.endsWith("/") ? this.apiUrl : `${this.apiUrl}/`;
|
|
550
550
|
const hasBody = request.body !== void 0;
|
|
551
|
-
const
|
|
551
|
+
const response = await this.client.$fetch(`${base}${path}`, {
|
|
552
552
|
method: request.method ?? "GET",
|
|
553
553
|
params: request.params,
|
|
554
554
|
query: request.query,
|
|
@@ -561,10 +561,19 @@ class AdminService {
|
|
|
561
561
|
jsonParser: (text) => JSON.parse(text),
|
|
562
562
|
throw: false
|
|
563
563
|
});
|
|
564
|
+
const { data, error } = response;
|
|
564
565
|
if (error)
|
|
565
566
|
throw new ApplicationRouteError(error);
|
|
566
567
|
return data;
|
|
567
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* Calls an admin endpoint and returns its JSON body. The client is configured
|
|
571
|
+
* to throw on error responses, but better-auth types `$fetch` as returning
|
|
572
|
+
* `{ data, error }`; this narrows the result to the body it actually resolves to.
|
|
573
|
+
*/
|
|
574
|
+
async fetchAdminRoute(path, options) {
|
|
575
|
+
return await this.client.$fetch(path, options);
|
|
576
|
+
}
|
|
568
577
|
/**
|
|
569
578
|
* Lists applications, optionally filtered by organization.
|
|
570
579
|
*
|
|
@@ -737,7 +746,7 @@ class AdminService {
|
|
|
737
746
|
* @returns The paginated organization listing
|
|
738
747
|
*/
|
|
739
748
|
async listOrganizations(options = {}) {
|
|
740
|
-
return await this.
|
|
749
|
+
return await this.fetchAdminRoute("/admin/organizations", {
|
|
741
750
|
method: "GET",
|
|
742
751
|
query: {
|
|
743
752
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
@@ -760,7 +769,7 @@ class AdminService {
|
|
|
760
769
|
* @returns The paginated user listing
|
|
761
770
|
*/
|
|
762
771
|
async listUsers(options = {}) {
|
|
763
|
-
return await this.
|
|
772
|
+
return await this.fetchAdminRoute("/admin/users", {
|
|
764
773
|
method: "GET",
|
|
765
774
|
query: {
|
|
766
775
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
@@ -802,7 +811,7 @@ class AdminService {
|
|
|
802
811
|
* @returns The organization
|
|
803
812
|
*/
|
|
804
813
|
async getOrganization(options) {
|
|
805
|
-
const { data } = await this.
|
|
814
|
+
const { data } = await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}`, {
|
|
806
815
|
method: "GET",
|
|
807
816
|
query: {
|
|
808
817
|
...options.sortBy ? { sortBy: options.sortBy } : {},
|
|
@@ -824,7 +833,7 @@ class AdminService {
|
|
|
824
833
|
* @returns The organization summaries for the IDs that exist
|
|
825
834
|
*/
|
|
826
835
|
async getOrganizationsSummary(options) {
|
|
827
|
-
const { organizations } = await this.
|
|
836
|
+
const { organizations } = await this.fetchAdminRoute("/admin/organizations/summary", {
|
|
828
837
|
method: "GET",
|
|
829
838
|
query: {
|
|
830
839
|
ids: options.ids
|
|
@@ -841,7 +850,7 @@ class AdminService {
|
|
|
841
850
|
* @returns The user access report
|
|
842
851
|
*/
|
|
843
852
|
async getUserAccess(userId) {
|
|
844
|
-
const { data } = await this.
|
|
853
|
+
const { data } = await this.fetchAdminRoute(`/admin/users/${encodeURIComponent(userId)}/access`, {
|
|
845
854
|
method: "GET"
|
|
846
855
|
});
|
|
847
856
|
return data;
|
|
@@ -855,7 +864,7 @@ class AdminService {
|
|
|
855
864
|
* @returns The application listing with entitlement details
|
|
856
865
|
*/
|
|
857
866
|
async listAdminApplications(options = {}) {
|
|
858
|
-
return await this.
|
|
867
|
+
return await this.fetchAdminRoute("/admin/applications", {
|
|
859
868
|
method: "GET",
|
|
860
869
|
query: {
|
|
861
870
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
@@ -877,7 +886,7 @@ class AdminService {
|
|
|
877
886
|
* @returns The paginated application member listing
|
|
878
887
|
*/
|
|
879
888
|
async listApplicationMembers(options) {
|
|
880
|
-
return await this.
|
|
889
|
+
return await this.fetchAdminRoute(`/admin/applications/${encodeURIComponent(options.applicationId)}/members`, {
|
|
881
890
|
method: "GET",
|
|
882
891
|
query: {
|
|
883
892
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
@@ -894,7 +903,7 @@ class AdminService {
|
|
|
894
903
|
* @returns The paginated organization member listing
|
|
895
904
|
*/
|
|
896
905
|
async listOrganizationMembers(options) {
|
|
897
|
-
return await this.
|
|
906
|
+
return await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}/members`, {
|
|
898
907
|
method: "GET",
|
|
899
908
|
query: {
|
|
900
909
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
@@ -910,6 +919,67 @@ class AdminService {
|
|
|
910
919
|
}
|
|
911
920
|
});
|
|
912
921
|
}
|
|
922
|
+
/**
|
|
923
|
+
* Lists the applications available to one organization with the entitlement
|
|
924
|
+
* that decides their access and its rules. Global admins may list any
|
|
925
|
+
* organization; an organization admin only their own.
|
|
926
|
+
*
|
|
927
|
+
* @param options - Organization ID and search options
|
|
928
|
+
* @returns The organization's applications
|
|
929
|
+
*/
|
|
930
|
+
async listOrganizationApplications(options) {
|
|
931
|
+
const { data } = await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}/applications`, {
|
|
932
|
+
method: "GET",
|
|
933
|
+
query: {
|
|
934
|
+
...options.search ? { search: options.search } : {}
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
return data;
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Fetches one application of an organization with its rules and the roles
|
|
941
|
+
* those rules can grant.
|
|
942
|
+
*
|
|
943
|
+
* @param options - Organization and application IDs
|
|
944
|
+
* @returns The application access
|
|
945
|
+
*/
|
|
946
|
+
async getOrganizationApplication(options) {
|
|
947
|
+
const { data } = await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}/applications/${encodeURIComponent(options.applicationId)}`, {
|
|
948
|
+
method: "GET"
|
|
949
|
+
});
|
|
950
|
+
return data;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Replaces the rules of an organization's own entitlement to an application,
|
|
954
|
+
* in the order given, as a global admin. Global access is edited on the application.
|
|
955
|
+
*
|
|
956
|
+
* @param options - Organization and application IDs, and the rules in evaluation order
|
|
957
|
+
* @returns The updated application access
|
|
958
|
+
*/
|
|
959
|
+
async setOrganizationApplicationRules(options) {
|
|
960
|
+
const { data } = await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}/applications/${encodeURIComponent(options.applicationId)}/rules`, {
|
|
961
|
+
method: "POST",
|
|
962
|
+
body: { rules: options.rules }
|
|
963
|
+
});
|
|
964
|
+
return data;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Lists every active member of an organization with the rule that decides
|
|
968
|
+
* their access to an application and the role it grants.
|
|
969
|
+
*
|
|
970
|
+
* @param options - Organization and application IDs, pagination, and search options
|
|
971
|
+
* @returns The paginated member listing
|
|
972
|
+
*/
|
|
973
|
+
async listOrganizationApplicationMembers(options) {
|
|
974
|
+
return await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}/applications/${encodeURIComponent(options.applicationId)}/members`, {
|
|
975
|
+
method: "GET",
|
|
976
|
+
query: {
|
|
977
|
+
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
978
|
+
...options.offset !== void 0 ? { offset: options.offset } : {},
|
|
979
|
+
...options.query ? { query: options.query } : {}
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
}
|
|
913
983
|
/**
|
|
914
984
|
* Lists teams for one organization. Global admins may list any organization;
|
|
915
985
|
* an organization admin only their own.
|
|
@@ -918,7 +988,7 @@ class AdminService {
|
|
|
918
988
|
* @returns The paginated organization team listing
|
|
919
989
|
*/
|
|
920
990
|
async listOrganizationTeams(options) {
|
|
921
|
-
return await this.
|
|
991
|
+
return await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}/teams`, {
|
|
922
992
|
method: "GET",
|
|
923
993
|
query: {
|
|
924
994
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
@@ -936,7 +1006,7 @@ class AdminService {
|
|
|
936
1006
|
* @returns The created team
|
|
937
1007
|
*/
|
|
938
1008
|
async createOrganizationTeam(options) {
|
|
939
|
-
const { data } = await this.
|
|
1009
|
+
const { data } = await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}/teams`, {
|
|
940
1010
|
method: "POST",
|
|
941
1011
|
body: {
|
|
942
1012
|
name: options.name,
|
|
@@ -953,7 +1023,7 @@ class AdminService {
|
|
|
953
1023
|
* @returns The updated team
|
|
954
1024
|
*/
|
|
955
1025
|
async updateOrganizationTeam(options) {
|
|
956
|
-
const { data } = await this.
|
|
1026
|
+
const { data } = await this.fetchAdminRoute(`/admin/organizations/${encodeURIComponent(options.organizationId)}/teams/update`, {
|
|
957
1027
|
method: "POST",
|
|
958
1028
|
body: {
|
|
959
1029
|
teamId: options.teamId,
|
|
@@ -1032,7 +1102,7 @@ class AdminService {
|
|
|
1032
1102
|
* @returns The created organization
|
|
1033
1103
|
*/
|
|
1034
1104
|
async createOrganization(options) {
|
|
1035
|
-
const { data } = await this.
|
|
1105
|
+
const { data } = await this.fetchAdminRoute("/admin/organizations", {
|
|
1036
1106
|
method: "POST",
|
|
1037
1107
|
body: options
|
|
1038
1108
|
});
|
|
@@ -1048,7 +1118,7 @@ class AdminService {
|
|
|
1048
1118
|
* @returns The updated organization
|
|
1049
1119
|
*/
|
|
1050
1120
|
async updateOrganization(options) {
|
|
1051
|
-
const { data } = await this.
|
|
1121
|
+
const { data } = await this.fetchAdminRoute("/admin/organizations/update", {
|
|
1052
1122
|
method: "POST",
|
|
1053
1123
|
body: options
|
|
1054
1124
|
});
|
|
@@ -1061,7 +1131,7 @@ class AdminService {
|
|
|
1061
1131
|
* @returns The updated membership
|
|
1062
1132
|
*/
|
|
1063
1133
|
async updateMemberRole(options) {
|
|
1064
|
-
const { data } = await this.
|
|
1134
|
+
const { data } = await this.fetchAdminRoute("/admin/organizations/members/update-role", {
|
|
1065
1135
|
method: "POST",
|
|
1066
1136
|
body: options
|
|
1067
1137
|
});
|
|
@@ -1074,7 +1144,7 @@ class AdminService {
|
|
|
1074
1144
|
* @returns The removed membership
|
|
1075
1145
|
*/
|
|
1076
1146
|
async removeMember(options) {
|
|
1077
|
-
const { data } = await this.
|
|
1147
|
+
const { data } = await this.fetchAdminRoute("/admin/organizations/members/remove", {
|
|
1078
1148
|
method: "POST",
|
|
1079
1149
|
body: options
|
|
1080
1150
|
});
|
|
@@ -1173,7 +1243,7 @@ class AdminService {
|
|
|
1173
1243
|
* @returns Per-email invite outcomes
|
|
1174
1244
|
*/
|
|
1175
1245
|
async inviteOrganizationUsers(options) {
|
|
1176
|
-
const { data } = await this.
|
|
1246
|
+
const { data } = await this.fetchAdminRoute("/admin/organizations/users", {
|
|
1177
1247
|
method: "POST",
|
|
1178
1248
|
body: { ...options, sendInvite: options.sendInvite ?? true }
|
|
1179
1249
|
});
|
|
@@ -1954,6 +2024,7 @@ class OrganizationService {
|
|
|
1954
2024
|
applicationName: responseWithContext.applicationName ?? null,
|
|
1955
2025
|
homeUrl: responseWithContext.homeUrl ?? null,
|
|
1956
2026
|
inviteAcceptedUrl: responseWithContext.inviteAcceptedUrl ?? null,
|
|
2027
|
+
// better-auth types the role as a plain string; the organization plugin only stores configured roles.
|
|
1957
2028
|
member: response.member
|
|
1958
2029
|
};
|
|
1959
2030
|
}
|