@meistrari/auth-core 3.0.0 → 3.2.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 +175 -50
- package/dist/index.d.ts +175 -50
- package/dist/index.mjs +138 -17
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -275,6 +275,12 @@ declare const invitationAdditionalFields: {
|
|
|
275
275
|
input: true;
|
|
276
276
|
required: false;
|
|
277
277
|
};
|
|
278
|
+
/** Application role granted when an application invitation is accepted. */
|
|
279
|
+
applicationRole: {
|
|
280
|
+
type: "string";
|
|
281
|
+
input: true;
|
|
282
|
+
required: false;
|
|
283
|
+
};
|
|
278
284
|
};
|
|
279
285
|
/**
|
|
280
286
|
* Zod schema and type for the `user` claim within a JWT payload.
|
|
@@ -645,12 +651,22 @@ type ListCandidateOrganizationsResponse = Array<FullOrganization & {
|
|
|
645
651
|
*/
|
|
646
652
|
lastUsed?: boolean;
|
|
647
653
|
}>;
|
|
654
|
+
/**
|
|
655
|
+
* Whether an application refuses sign-ins, and the notice shown to users who
|
|
656
|
+
* try to sign in through it.
|
|
657
|
+
*/
|
|
658
|
+
type ApplicationDeprecation = {
|
|
659
|
+
/** Whether the application is disabled. A disabled application refuses every sign-in. */
|
|
660
|
+
disabled: boolean;
|
|
661
|
+
/** Plain-text notice written by an admin, or `null` when the application is enabled or has none. */
|
|
662
|
+
deprecationNotice: string | null;
|
|
663
|
+
};
|
|
648
664
|
/**
|
|
649
665
|
* Public application context used to preserve continuity during auth redirects.
|
|
650
666
|
*/
|
|
651
667
|
type ApplicationAuthContextResponse = {
|
|
652
668
|
/** Minimal application identity shown in the hosted auth flow. */
|
|
653
|
-
application: Pick<Application, 'id' | 'name' | 'config'
|
|
669
|
+
application: Pick<Application, 'id' | 'name' | 'config'> & ApplicationDeprecation;
|
|
654
670
|
/**
|
|
655
671
|
* Login methods usable for this application: the environment allowlist
|
|
656
672
|
* intersected with the application's accepted AMRs.
|
|
@@ -751,7 +767,7 @@ type DeviceContextApplication = {
|
|
|
751
767
|
name: string;
|
|
752
768
|
/** Human-readable description, or `null` if not set. */
|
|
753
769
|
description: string | null;
|
|
754
|
-
};
|
|
770
|
+
} & ApplicationDeprecation;
|
|
755
771
|
/**
|
|
756
772
|
* Context information for a pending device authorization request.
|
|
757
773
|
*/
|
|
@@ -762,7 +778,7 @@ type DeviceAuthorizationContextResponse = {
|
|
|
762
778
|
};
|
|
763
779
|
/** The target application the requester wants access to. */
|
|
764
780
|
target: DeviceContextApplication;
|
|
765
|
-
/** Organizations the user can authorize the device for. */
|
|
781
|
+
/** Organizations the user can authorize the device for. Empty when the requester or the target is disabled. */
|
|
766
782
|
organizations: FullOrganization[];
|
|
767
783
|
/** Organization pre-selected by the requester, if any. */
|
|
768
784
|
preselectedOrganizationId: string | null;
|
|
@@ -771,6 +787,17 @@ type DeviceAuthorizationContextResponse = {
|
|
|
771
787
|
/** Seconds remaining before the device code expires. */
|
|
772
788
|
expiresIn: number;
|
|
773
789
|
};
|
|
790
|
+
/**
|
|
791
|
+
* Role of the application an application session was issued for.
|
|
792
|
+
*/
|
|
793
|
+
type ApplicationRole = {
|
|
794
|
+
applicationId: string;
|
|
795
|
+
name: string;
|
|
796
|
+
displayName: string;
|
|
797
|
+
description: string;
|
|
798
|
+
/** Roles of the same application this role may grant, change, revoke and invite. */
|
|
799
|
+
manageableRoles: string[];
|
|
800
|
+
};
|
|
774
801
|
/**
|
|
775
802
|
* Response returned when approving or denying a device authorization request.
|
|
776
803
|
*/
|
|
@@ -825,6 +852,37 @@ declare class ApplicationSessionAssuranceError extends ApplicationError {
|
|
|
825
852
|
readonly validStepUps: SessionAssuranceRequiredPayload['validStepUps'];
|
|
826
853
|
constructor(payload?: SessionAssuranceRequiredPayload | null, options?: ErrorOptions);
|
|
827
854
|
}
|
|
855
|
+
/**
|
|
856
|
+
* Payload the API attaches to an `application_disabled` error.
|
|
857
|
+
*/
|
|
858
|
+
type ApplicationDisabledPayload = {
|
|
859
|
+
applicationId: string;
|
|
860
|
+
applicationName: string;
|
|
861
|
+
deprecationNotice: string | null;
|
|
862
|
+
};
|
|
863
|
+
/**
|
|
864
|
+
* Reads the {@link ApplicationDisabledPayload} from an error returned by the
|
|
865
|
+
* API, following `cause` chains. Returns `null` when the error is not an
|
|
866
|
+
* `application_disabled` error.
|
|
867
|
+
*
|
|
868
|
+
* @param error - The caught error value
|
|
869
|
+
*/
|
|
870
|
+
declare function parseApplicationDisabledPayload(error: unknown): ApplicationDisabledPayload | null;
|
|
871
|
+
/**
|
|
872
|
+
* Thrown when the application was disabled by an admin. Every sign-in, token
|
|
873
|
+
* exchange and refresh through it fails until it is enabled again, so clients
|
|
874
|
+
* must not retry or start a new flow.
|
|
875
|
+
*
|
|
876
|
+
* The message is the application's deprecation notice when it has one.
|
|
877
|
+
*/
|
|
878
|
+
declare class ApplicationDisabledError extends ApplicationError {
|
|
879
|
+
readonly applicationId: string | null;
|
|
880
|
+
readonly applicationName: string | null;
|
|
881
|
+
readonly deprecationNotice: string | null;
|
|
882
|
+
constructor(payload?: ApplicationDisabledPayload | null, options?: ErrorOptions & {
|
|
883
|
+
status?: number;
|
|
884
|
+
});
|
|
885
|
+
}
|
|
828
886
|
/**
|
|
829
887
|
* Thrown when an operation requires an authenticated user but no session exists.
|
|
830
888
|
*/
|
|
@@ -976,6 +1034,7 @@ declare class ApplicationService {
|
|
|
976
1034
|
* @throws {DeviceCodeExpiredError} The device code has expired
|
|
977
1035
|
* @throws {DeviceTransientServerError} Transient server error — safe to retry
|
|
978
1036
|
* @throws {ApplicationSessionAssuranceError} Assurance policy changed or is no longer met — start a new flow
|
|
1037
|
+
* @throws {ApplicationDisabledError} The requester or target application is disabled — stop polling
|
|
979
1038
|
*/
|
|
980
1039
|
exchangeDeviceCodeForTokens(deviceCode: string): Promise<CompleteAuthorizationFlowResponse>;
|
|
981
1040
|
/**
|
|
@@ -1000,6 +1059,7 @@ declare class ApplicationService {
|
|
|
1000
1059
|
*
|
|
1001
1060
|
* @param refreshToken - The refresh token to use for the authentication token refresh
|
|
1002
1061
|
* @throws {RefreshTokenExpiredError} When the refresh token has expired or is invalid
|
|
1062
|
+
* @throws {ApplicationDisabledError} When the application has been disabled
|
|
1003
1063
|
* @throws {ApplicationError} For other API errors
|
|
1004
1064
|
*/
|
|
1005
1065
|
refreshAccessToken(refreshToken: string): Promise<CompleteAuthorizationFlowResponse>;
|
|
@@ -1038,6 +1098,12 @@ declare class ApplicationService {
|
|
|
1038
1098
|
* @param refreshToken - The refresh token to invalidate
|
|
1039
1099
|
*/
|
|
1040
1100
|
logout(refreshToken: string): Promise<void>;
|
|
1101
|
+
/**
|
|
1102
|
+
* Lists the roles of the application the current session was issued for.
|
|
1103
|
+
*
|
|
1104
|
+
* @returns The application's roles
|
|
1105
|
+
*/
|
|
1106
|
+
listRoles(): Promise<ApplicationRole[]>;
|
|
1041
1107
|
}
|
|
1042
1108
|
|
|
1043
1109
|
declare const ApiKeyMetadata: zod__default.ZodObject<{
|
|
@@ -3561,6 +3627,17 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
3561
3627
|
data: void;
|
|
3562
3628
|
error: null;
|
|
3563
3629
|
}>;
|
|
3630
|
+
listApplicationRoles: () => Promise<{
|
|
3631
|
+
data: null;
|
|
3632
|
+
error: {
|
|
3633
|
+
message?: string | undefined;
|
|
3634
|
+
status: number;
|
|
3635
|
+
statusText: string;
|
|
3636
|
+
};
|
|
3637
|
+
} | {
|
|
3638
|
+
data: ApplicationRole[];
|
|
3639
|
+
error: null;
|
|
3640
|
+
}>;
|
|
3564
3641
|
};
|
|
3565
3642
|
};
|
|
3566
3643
|
} | {
|
|
@@ -4316,11 +4393,19 @@ type OrganizationSettings = {
|
|
|
4316
4393
|
type ExtendedOrganization = BaseOrganization & {
|
|
4317
4394
|
settings?: OrganizationSettings;
|
|
4318
4395
|
};
|
|
4396
|
+
/**
|
|
4397
|
+
* A member of a {@link FullOrganization}.
|
|
4398
|
+
*/
|
|
4399
|
+
type FullOrganizationMember = Member & {
|
|
4400
|
+
/** The member's role in the session's application. Only set for application sessions. */
|
|
4401
|
+
applicationRole?: string | null;
|
|
4402
|
+
};
|
|
4319
4403
|
/**
|
|
4320
4404
|
* A complete organization object including its members, invitations, and teams.
|
|
4321
4405
|
*/
|
|
4322
4406
|
type FullOrganization = ExtendedOrganization & {
|
|
4323
|
-
members
|
|
4407
|
+
/** With an application session, only members with access to the application. */
|
|
4408
|
+
members: FullOrganizationMember[];
|
|
4324
4409
|
invitations: Invitation[];
|
|
4325
4410
|
teams: Team[];
|
|
4326
4411
|
};
|
|
@@ -4379,6 +4464,8 @@ type ListAdminUsersOptions = {
|
|
|
4379
4464
|
* admin, whose listing is always pinned to their own organization.
|
|
4380
4465
|
*/
|
|
4381
4466
|
organizationId?: string;
|
|
4467
|
+
/** Restricts the listing to people with access to this application. Requires organizationId when listing users. */
|
|
4468
|
+
applicationId?: string;
|
|
4382
4469
|
};
|
|
4383
4470
|
/**
|
|
4384
4471
|
* Organization preview returned alongside each admin user row.
|
|
@@ -4472,6 +4559,13 @@ type CreateAdminApplicationSecretOptions = {
|
|
|
4472
4559
|
/** Optional display name for the secret. */
|
|
4473
4560
|
name?: string;
|
|
4474
4561
|
};
|
|
4562
|
+
/**
|
|
4563
|
+
* Options accepted when disabling an application.
|
|
4564
|
+
*/
|
|
4565
|
+
type DisableAdminApplicationOptions = {
|
|
4566
|
+
/** Plain-text notice shown to users who try to sign in through the application. Blank or `null` clears it. */
|
|
4567
|
+
deprecationNotice?: string | null;
|
|
4568
|
+
};
|
|
4475
4569
|
/**
|
|
4476
4570
|
* Client secret metadata returned by application management endpoints.
|
|
4477
4571
|
*/
|
|
@@ -4538,6 +4632,8 @@ type ListAdminOrganizationMembersOptions = {
|
|
|
4538
4632
|
sortBy?: 'createdAt' | 'name';
|
|
4539
4633
|
/** Sort direction for the listing. Defaults to 'desc'. */
|
|
4540
4634
|
sortDirection?: 'asc' | 'desc';
|
|
4635
|
+
/** Restricts the listing to people with access to this application. */
|
|
4636
|
+
applicationId?: string;
|
|
4541
4637
|
};
|
|
4542
4638
|
/**
|
|
4543
4639
|
* Options accepted when listing teams for a single organization as a global admin.
|
|
@@ -4707,20 +4803,6 @@ type AdminUserInvitation = {
|
|
|
4707
4803
|
expiresAt: string;
|
|
4708
4804
|
createdAt: string;
|
|
4709
4805
|
};
|
|
4710
|
-
/**
|
|
4711
|
-
* Options accepted when resending an organization invitation as a global admin.
|
|
4712
|
-
*/
|
|
4713
|
-
type ResendAdminInviteOptions = {
|
|
4714
|
-
organizationId: string;
|
|
4715
|
-
email: string;
|
|
4716
|
-
role: string;
|
|
4717
|
-
applicationId?: string;
|
|
4718
|
-
/**
|
|
4719
|
-
* Teams joined when the re-sent invitation is accepted. Resending replaces the
|
|
4720
|
-
* invitation, so these must be provided to preserve the original team assignments.
|
|
4721
|
-
*/
|
|
4722
|
-
teamIds?: string[];
|
|
4723
|
-
};
|
|
4724
4806
|
/**
|
|
4725
4807
|
* User row returned by the admin user listing endpoint.
|
|
4726
4808
|
*/
|
|
@@ -4748,6 +4830,8 @@ type AdminUser = {
|
|
|
4748
4830
|
organizationCount?: number;
|
|
4749
4831
|
/** Preview of the first organizations the user belongs to. Present when requested via organizationsPreview. */
|
|
4750
4832
|
organizations?: AdminUserOrganization[];
|
|
4833
|
+
/** App role. Present when the listing is scoped to an application; null on invitation rows. */
|
|
4834
|
+
applicationRole?: string | null;
|
|
4751
4835
|
};
|
|
4752
4836
|
/**
|
|
4753
4837
|
* Paginated admin user listing response.
|
|
@@ -4802,6 +4886,8 @@ type AdminOrganizationMemberRecord = {
|
|
|
4802
4886
|
expiresAt?: string;
|
|
4803
4887
|
teams?: AdminOrganizationMemberTeam[];
|
|
4804
4888
|
applications?: AdminOrganizationMemberApplication[];
|
|
4889
|
+
/** App role. Present when the listing is scoped to an application; null on invitation rows. */
|
|
4890
|
+
applicationRole?: string | null;
|
|
4805
4891
|
};
|
|
4806
4892
|
/**
|
|
4807
4893
|
* Paginated organization member listing response.
|
|
@@ -4908,9 +4994,16 @@ type AdminApplicationRole = {
|
|
|
4908
4994
|
name: string;
|
|
4909
4995
|
displayName: string;
|
|
4910
4996
|
description: string;
|
|
4997
|
+
/** Roles of the same application this role may grant, change, revoke and invite. */
|
|
4998
|
+
manageableRoles: string[];
|
|
4999
|
+
};
|
|
5000
|
+
/**
|
|
5001
|
+
* Options accepted when creating an application role. Omitting `manageableRoles`
|
|
5002
|
+
* creates the role with none, and on update keeps the stored list.
|
|
5003
|
+
*/
|
|
5004
|
+
type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'applicationId' | 'manageableRoles'> & {
|
|
5005
|
+
manageableRoles?: string[];
|
|
4911
5006
|
};
|
|
4912
|
-
/** Options accepted when creating an application role. */
|
|
4913
|
-
type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'applicationId'>;
|
|
4914
5007
|
/** Options accepted when updating an application role. */
|
|
4915
5008
|
type UpdateAdminApplicationRoleOptions = CreateAdminApplicationRoleOptions;
|
|
4916
5009
|
/** Kind of matcher an entitlement rule applies. */
|
|
@@ -5001,6 +5094,12 @@ type AdminApplication = {
|
|
|
5001
5094
|
config: ApplicationConfig | null;
|
|
5002
5095
|
serviceAccountUserId: string | null;
|
|
5003
5096
|
serviceAccountUser?: AdminApplicationIdentity | null;
|
|
5097
|
+
/** When the application was disabled, or `null` while it is enabled. A disabled application refuses every sign-in. */
|
|
5098
|
+
disabledAt: string | null;
|
|
5099
|
+
/** ID of the admin who disabled the application, or `null`. */
|
|
5100
|
+
disabledBy: string | null;
|
|
5101
|
+
/** Plain-text notice shown to users who try to sign in through the disabled application. */
|
|
5102
|
+
deprecationNotice: string | null;
|
|
5004
5103
|
createdBy: string;
|
|
5005
5104
|
updatedBy: string;
|
|
5006
5105
|
createdAt: string;
|
|
@@ -5173,6 +5272,24 @@ declare class AdminService {
|
|
|
5173
5272
|
* @returns The updated application
|
|
5174
5273
|
*/
|
|
5175
5274
|
updateApplication(applicationId: string, options: CreateAdminApplicationOptions): Promise<AdminApplicationRecord>;
|
|
5275
|
+
/**
|
|
5276
|
+
* Disables an application. Sign-ins, token exchanges, refreshes and
|
|
5277
|
+
* client-credentials exchanges through it fail with `application_disabled`,
|
|
5278
|
+
* which carries the deprecation notice. Disabling an already disabled
|
|
5279
|
+
* application replaces its notice.
|
|
5280
|
+
*
|
|
5281
|
+
* @param applicationId - ID of the application to disable
|
|
5282
|
+
* @param options - Optional deprecation notice
|
|
5283
|
+
* @returns The updated application
|
|
5284
|
+
*/
|
|
5285
|
+
disableApplication(applicationId: string, options?: DisableAdminApplicationOptions): Promise<AdminApplicationRecord>;
|
|
5286
|
+
/**
|
|
5287
|
+
* Enables a disabled application and clears its deprecation notice.
|
|
5288
|
+
*
|
|
5289
|
+
* @param applicationId - ID of the application to enable
|
|
5290
|
+
* @returns The updated application
|
|
5291
|
+
*/
|
|
5292
|
+
enableApplication(applicationId: string): Promise<AdminApplicationRecord>;
|
|
5176
5293
|
/** Lists the role catalog for an application. */
|
|
5177
5294
|
listApplicationRoles(applicationId: string): Promise<AdminApplicationRole[]>;
|
|
5178
5295
|
/** Creates an application-scoped role definition. */
|
|
@@ -5513,10 +5630,11 @@ declare class AdminService {
|
|
|
5513
5630
|
*/
|
|
5514
5631
|
cancelInvite(invitationId: string): Promise<void>;
|
|
5515
5632
|
/**
|
|
5516
|
-
*
|
|
5517
|
-
*
|
|
5633
|
+
* Replaces a pending invitation with a new one that keeps its roles and
|
|
5634
|
+
* teams, and emails it, as a global admin.
|
|
5635
|
+
* @param invitationId - The ID of the invitation to resend
|
|
5518
5636
|
*/
|
|
5519
|
-
resendInvite(
|
|
5637
|
+
resendInvite(invitationId: string): Promise<void>;
|
|
5520
5638
|
/**
|
|
5521
5639
|
* Invites several users to an organization in one call, or — with
|
|
5522
5640
|
* `sendInvite: false` — adds them as members immediately, creating user
|
|
@@ -5581,6 +5699,18 @@ type ListMembersOptions = {
|
|
|
5581
5699
|
sortBy?: 'createdAt';
|
|
5582
5700
|
/** Sort direction for the member page. */
|
|
5583
5701
|
sortDirection?: 'asc' | 'desc';
|
|
5702
|
+
/** With an application session, also lists organization members without access to the application, marked hasAccess: false. Requires permission to grant access. */
|
|
5703
|
+
includeWithoutAccess?: boolean;
|
|
5704
|
+
};
|
|
5705
|
+
/**
|
|
5706
|
+
* Organization member as returned to an application session, with the member's
|
|
5707
|
+
* role in the application.
|
|
5708
|
+
*/
|
|
5709
|
+
type ApplicationScopedMember = Member & {
|
|
5710
|
+
/** The member's role in the application, or null without access. */
|
|
5711
|
+
applicationRole?: string | null;
|
|
5712
|
+
/** Present when includeWithoutAccess was requested. */
|
|
5713
|
+
hasAccess?: boolean;
|
|
5584
5714
|
};
|
|
5585
5715
|
/**
|
|
5586
5716
|
* Options for inviting a user to the active organization.
|
|
@@ -5594,6 +5724,8 @@ type InviteUserToOrganizationOptions = {
|
|
|
5594
5724
|
userEmail: string;
|
|
5595
5725
|
/** Organization role to assign to the invited user. */
|
|
5596
5726
|
role: Role;
|
|
5727
|
+
/** Application role granted on acceptance. Required with an application-scoped session. */
|
|
5728
|
+
applicationRole?: string;
|
|
5597
5729
|
/** Optional team to add the user to upon acceptance. */
|
|
5598
5730
|
teamId?: string;
|
|
5599
5731
|
/** Whether to resend the invitation if one already exists for this email. */
|
|
@@ -5615,12 +5747,16 @@ type RemoveUserFromOrganizationOptions = {
|
|
|
5615
5747
|
};
|
|
5616
5748
|
/**
|
|
5617
5749
|
* Options for updating a member's role within the organization.
|
|
5750
|
+
*
|
|
5751
|
+
* With an application-scoped session, `role` is an application role and the
|
|
5752
|
+
* update grants or changes access to that application. The organization role
|
|
5753
|
+
* is left unchanged.
|
|
5618
5754
|
*/
|
|
5619
5755
|
type UpdateMemberRoleOptions = {
|
|
5620
5756
|
/** The member ID whose role should be updated. */
|
|
5621
5757
|
memberId: string;
|
|
5622
|
-
/** The new role to assign. */
|
|
5623
|
-
role: Role;
|
|
5758
|
+
/** The new role to assign: an organization role, or an application role in app mode. */
|
|
5759
|
+
role: Role | (string & {});
|
|
5624
5760
|
};
|
|
5625
5761
|
/**
|
|
5626
5762
|
* Payload for creating a new team.
|
|
@@ -5752,29 +5888,10 @@ declare class OrganizationService {
|
|
|
5752
5888
|
* @param options - Pagination options
|
|
5753
5889
|
* @param options.limit - Maximum number of members to return
|
|
5754
5890
|
* @param options.offset - Number of members to skip
|
|
5755
|
-
* @
|
|
5891
|
+
* @param options.includeWithoutAccess - With an application session, also list members without access to the application
|
|
5892
|
+
* @returns An array of organization members, with their application role when the session is an application session
|
|
5756
5893
|
*/
|
|
5757
|
-
listMembers(options?: ListMembersOptions): Promise<
|
|
5758
|
-
id: string;
|
|
5759
|
-
organizationId: string;
|
|
5760
|
-
role: "org:admin" | "org:member" | "org:reviewer";
|
|
5761
|
-
createdAt: Date;
|
|
5762
|
-
userId: string;
|
|
5763
|
-
teamId?: string | undefined | undefined;
|
|
5764
|
-
user: {
|
|
5765
|
-
id: string;
|
|
5766
|
-
email: string;
|
|
5767
|
-
name: string;
|
|
5768
|
-
image?: string | undefined;
|
|
5769
|
-
};
|
|
5770
|
-
} & {
|
|
5771
|
-
user: {
|
|
5772
|
-
id: string;
|
|
5773
|
-
name: string;
|
|
5774
|
-
email: string;
|
|
5775
|
-
image: string | null | undefined;
|
|
5776
|
-
};
|
|
5777
|
-
})[]>;
|
|
5894
|
+
listMembers(options?: ListMembersOptions): Promise<ApplicationScopedMember[]>;
|
|
5778
5895
|
/**
|
|
5779
5896
|
* Gets the currently active organization member for the authenticated user.
|
|
5780
5897
|
*
|
|
@@ -5820,11 +5937,12 @@ declare class OrganizationService {
|
|
|
5820
5937
|
* @param options - Invitation configuration
|
|
5821
5938
|
* @param options.userEmail - Email address of the user to invite
|
|
5822
5939
|
* @param options.role - Role to assign to the invited user
|
|
5940
|
+
* @param options.applicationRole - Application role granted on acceptance; required with an application-scoped session
|
|
5823
5941
|
* @param options.teamId - Team ID to add the user to
|
|
5824
5942
|
* @param options.resend - Whether to resend if invitation already exists
|
|
5825
5943
|
* @returns The created invitation
|
|
5826
5944
|
*/
|
|
5827
|
-
inviteUserToOrganization({ userEmail, role, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
|
|
5945
|
+
inviteUserToOrganization({ userEmail, role, applicationRole, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
|
|
5828
5946
|
id: string;
|
|
5829
5947
|
organizationId: string;
|
|
5830
5948
|
email: string;
|
|
@@ -5885,6 +6003,9 @@ declare class OrganizationService {
|
|
|
5885
6003
|
/**
|
|
5886
6004
|
* Removes a user from the active organization.
|
|
5887
6005
|
*
|
|
6006
|
+
* With an application-scoped session, revokes the member's access to that
|
|
6007
|
+
* application and keeps the membership.
|
|
6008
|
+
*
|
|
5888
6009
|
* @param options - Provide either `memberId` or `userEmail` to identify the user
|
|
5889
6010
|
* @param options.memberId - Membership ID to remove
|
|
5890
6011
|
* @param options.userEmail - Email address of the member to remove
|
|
@@ -5893,6 +6014,10 @@ declare class OrganizationService {
|
|
|
5893
6014
|
/**
|
|
5894
6015
|
* Updates the role of an organization member.
|
|
5895
6016
|
*
|
|
6017
|
+
* With an application-scoped session, `role` is an application role: the
|
|
6018
|
+
* update grants or changes the member's access to that application and
|
|
6019
|
+
* keeps the organization role.
|
|
6020
|
+
*
|
|
5896
6021
|
* @param options - Role update configuration
|
|
5897
6022
|
* @param options.memberId - The member ID to update
|
|
5898
6023
|
* @param options.role - The new role to assign
|
|
@@ -6551,5 +6676,5 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
6551
6676
|
*/
|
|
6552
6677
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
6553
6678
|
|
|
6554
|
-
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, 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, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
6555
|
-
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, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, 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,
|
|
6679
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -275,6 +275,12 @@ declare const invitationAdditionalFields: {
|
|
|
275
275
|
input: true;
|
|
276
276
|
required: false;
|
|
277
277
|
};
|
|
278
|
+
/** Application role granted when an application invitation is accepted. */
|
|
279
|
+
applicationRole: {
|
|
280
|
+
type: "string";
|
|
281
|
+
input: true;
|
|
282
|
+
required: false;
|
|
283
|
+
};
|
|
278
284
|
};
|
|
279
285
|
/**
|
|
280
286
|
* Zod schema and type for the `user` claim within a JWT payload.
|
|
@@ -645,12 +651,22 @@ type ListCandidateOrganizationsResponse = Array<FullOrganization & {
|
|
|
645
651
|
*/
|
|
646
652
|
lastUsed?: boolean;
|
|
647
653
|
}>;
|
|
654
|
+
/**
|
|
655
|
+
* Whether an application refuses sign-ins, and the notice shown to users who
|
|
656
|
+
* try to sign in through it.
|
|
657
|
+
*/
|
|
658
|
+
type ApplicationDeprecation = {
|
|
659
|
+
/** Whether the application is disabled. A disabled application refuses every sign-in. */
|
|
660
|
+
disabled: boolean;
|
|
661
|
+
/** Plain-text notice written by an admin, or `null` when the application is enabled or has none. */
|
|
662
|
+
deprecationNotice: string | null;
|
|
663
|
+
};
|
|
648
664
|
/**
|
|
649
665
|
* Public application context used to preserve continuity during auth redirects.
|
|
650
666
|
*/
|
|
651
667
|
type ApplicationAuthContextResponse = {
|
|
652
668
|
/** Minimal application identity shown in the hosted auth flow. */
|
|
653
|
-
application: Pick<Application, 'id' | 'name' | 'config'
|
|
669
|
+
application: Pick<Application, 'id' | 'name' | 'config'> & ApplicationDeprecation;
|
|
654
670
|
/**
|
|
655
671
|
* Login methods usable for this application: the environment allowlist
|
|
656
672
|
* intersected with the application's accepted AMRs.
|
|
@@ -751,7 +767,7 @@ type DeviceContextApplication = {
|
|
|
751
767
|
name: string;
|
|
752
768
|
/** Human-readable description, or `null` if not set. */
|
|
753
769
|
description: string | null;
|
|
754
|
-
};
|
|
770
|
+
} & ApplicationDeprecation;
|
|
755
771
|
/**
|
|
756
772
|
* Context information for a pending device authorization request.
|
|
757
773
|
*/
|
|
@@ -762,7 +778,7 @@ type DeviceAuthorizationContextResponse = {
|
|
|
762
778
|
};
|
|
763
779
|
/** The target application the requester wants access to. */
|
|
764
780
|
target: DeviceContextApplication;
|
|
765
|
-
/** Organizations the user can authorize the device for. */
|
|
781
|
+
/** Organizations the user can authorize the device for. Empty when the requester or the target is disabled. */
|
|
766
782
|
organizations: FullOrganization[];
|
|
767
783
|
/** Organization pre-selected by the requester, if any. */
|
|
768
784
|
preselectedOrganizationId: string | null;
|
|
@@ -771,6 +787,17 @@ type DeviceAuthorizationContextResponse = {
|
|
|
771
787
|
/** Seconds remaining before the device code expires. */
|
|
772
788
|
expiresIn: number;
|
|
773
789
|
};
|
|
790
|
+
/**
|
|
791
|
+
* Role of the application an application session was issued for.
|
|
792
|
+
*/
|
|
793
|
+
type ApplicationRole = {
|
|
794
|
+
applicationId: string;
|
|
795
|
+
name: string;
|
|
796
|
+
displayName: string;
|
|
797
|
+
description: string;
|
|
798
|
+
/** Roles of the same application this role may grant, change, revoke and invite. */
|
|
799
|
+
manageableRoles: string[];
|
|
800
|
+
};
|
|
774
801
|
/**
|
|
775
802
|
* Response returned when approving or denying a device authorization request.
|
|
776
803
|
*/
|
|
@@ -825,6 +852,37 @@ declare class ApplicationSessionAssuranceError extends ApplicationError {
|
|
|
825
852
|
readonly validStepUps: SessionAssuranceRequiredPayload['validStepUps'];
|
|
826
853
|
constructor(payload?: SessionAssuranceRequiredPayload | null, options?: ErrorOptions);
|
|
827
854
|
}
|
|
855
|
+
/**
|
|
856
|
+
* Payload the API attaches to an `application_disabled` error.
|
|
857
|
+
*/
|
|
858
|
+
type ApplicationDisabledPayload = {
|
|
859
|
+
applicationId: string;
|
|
860
|
+
applicationName: string;
|
|
861
|
+
deprecationNotice: string | null;
|
|
862
|
+
};
|
|
863
|
+
/**
|
|
864
|
+
* Reads the {@link ApplicationDisabledPayload} from an error returned by the
|
|
865
|
+
* API, following `cause` chains. Returns `null` when the error is not an
|
|
866
|
+
* `application_disabled` error.
|
|
867
|
+
*
|
|
868
|
+
* @param error - The caught error value
|
|
869
|
+
*/
|
|
870
|
+
declare function parseApplicationDisabledPayload(error: unknown): ApplicationDisabledPayload | null;
|
|
871
|
+
/**
|
|
872
|
+
* Thrown when the application was disabled by an admin. Every sign-in, token
|
|
873
|
+
* exchange and refresh through it fails until it is enabled again, so clients
|
|
874
|
+
* must not retry or start a new flow.
|
|
875
|
+
*
|
|
876
|
+
* The message is the application's deprecation notice when it has one.
|
|
877
|
+
*/
|
|
878
|
+
declare class ApplicationDisabledError extends ApplicationError {
|
|
879
|
+
readonly applicationId: string | null;
|
|
880
|
+
readonly applicationName: string | null;
|
|
881
|
+
readonly deprecationNotice: string | null;
|
|
882
|
+
constructor(payload?: ApplicationDisabledPayload | null, options?: ErrorOptions & {
|
|
883
|
+
status?: number;
|
|
884
|
+
});
|
|
885
|
+
}
|
|
828
886
|
/**
|
|
829
887
|
* Thrown when an operation requires an authenticated user but no session exists.
|
|
830
888
|
*/
|
|
@@ -976,6 +1034,7 @@ declare class ApplicationService {
|
|
|
976
1034
|
* @throws {DeviceCodeExpiredError} The device code has expired
|
|
977
1035
|
* @throws {DeviceTransientServerError} Transient server error — safe to retry
|
|
978
1036
|
* @throws {ApplicationSessionAssuranceError} Assurance policy changed or is no longer met — start a new flow
|
|
1037
|
+
* @throws {ApplicationDisabledError} The requester or target application is disabled — stop polling
|
|
979
1038
|
*/
|
|
980
1039
|
exchangeDeviceCodeForTokens(deviceCode: string): Promise<CompleteAuthorizationFlowResponse>;
|
|
981
1040
|
/**
|
|
@@ -1000,6 +1059,7 @@ declare class ApplicationService {
|
|
|
1000
1059
|
*
|
|
1001
1060
|
* @param refreshToken - The refresh token to use for the authentication token refresh
|
|
1002
1061
|
* @throws {RefreshTokenExpiredError} When the refresh token has expired or is invalid
|
|
1062
|
+
* @throws {ApplicationDisabledError} When the application has been disabled
|
|
1003
1063
|
* @throws {ApplicationError} For other API errors
|
|
1004
1064
|
*/
|
|
1005
1065
|
refreshAccessToken(refreshToken: string): Promise<CompleteAuthorizationFlowResponse>;
|
|
@@ -1038,6 +1098,12 @@ declare class ApplicationService {
|
|
|
1038
1098
|
* @param refreshToken - The refresh token to invalidate
|
|
1039
1099
|
*/
|
|
1040
1100
|
logout(refreshToken: string): Promise<void>;
|
|
1101
|
+
/**
|
|
1102
|
+
* Lists the roles of the application the current session was issued for.
|
|
1103
|
+
*
|
|
1104
|
+
* @returns The application's roles
|
|
1105
|
+
*/
|
|
1106
|
+
listRoles(): Promise<ApplicationRole[]>;
|
|
1041
1107
|
}
|
|
1042
1108
|
|
|
1043
1109
|
declare const ApiKeyMetadata: zod__default.ZodObject<{
|
|
@@ -3561,6 +3627,17 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
3561
3627
|
data: void;
|
|
3562
3628
|
error: null;
|
|
3563
3629
|
}>;
|
|
3630
|
+
listApplicationRoles: () => Promise<{
|
|
3631
|
+
data: null;
|
|
3632
|
+
error: {
|
|
3633
|
+
message?: string | undefined;
|
|
3634
|
+
status: number;
|
|
3635
|
+
statusText: string;
|
|
3636
|
+
};
|
|
3637
|
+
} | {
|
|
3638
|
+
data: ApplicationRole[];
|
|
3639
|
+
error: null;
|
|
3640
|
+
}>;
|
|
3564
3641
|
};
|
|
3565
3642
|
};
|
|
3566
3643
|
} | {
|
|
@@ -4316,11 +4393,19 @@ type OrganizationSettings = {
|
|
|
4316
4393
|
type ExtendedOrganization = BaseOrganization & {
|
|
4317
4394
|
settings?: OrganizationSettings;
|
|
4318
4395
|
};
|
|
4396
|
+
/**
|
|
4397
|
+
* A member of a {@link FullOrganization}.
|
|
4398
|
+
*/
|
|
4399
|
+
type FullOrganizationMember = Member & {
|
|
4400
|
+
/** The member's role in the session's application. Only set for application sessions. */
|
|
4401
|
+
applicationRole?: string | null;
|
|
4402
|
+
};
|
|
4319
4403
|
/**
|
|
4320
4404
|
* A complete organization object including its members, invitations, and teams.
|
|
4321
4405
|
*/
|
|
4322
4406
|
type FullOrganization = ExtendedOrganization & {
|
|
4323
|
-
members
|
|
4407
|
+
/** With an application session, only members with access to the application. */
|
|
4408
|
+
members: FullOrganizationMember[];
|
|
4324
4409
|
invitations: Invitation[];
|
|
4325
4410
|
teams: Team[];
|
|
4326
4411
|
};
|
|
@@ -4379,6 +4464,8 @@ type ListAdminUsersOptions = {
|
|
|
4379
4464
|
* admin, whose listing is always pinned to their own organization.
|
|
4380
4465
|
*/
|
|
4381
4466
|
organizationId?: string;
|
|
4467
|
+
/** Restricts the listing to people with access to this application. Requires organizationId when listing users. */
|
|
4468
|
+
applicationId?: string;
|
|
4382
4469
|
};
|
|
4383
4470
|
/**
|
|
4384
4471
|
* Organization preview returned alongside each admin user row.
|
|
@@ -4472,6 +4559,13 @@ type CreateAdminApplicationSecretOptions = {
|
|
|
4472
4559
|
/** Optional display name for the secret. */
|
|
4473
4560
|
name?: string;
|
|
4474
4561
|
};
|
|
4562
|
+
/**
|
|
4563
|
+
* Options accepted when disabling an application.
|
|
4564
|
+
*/
|
|
4565
|
+
type DisableAdminApplicationOptions = {
|
|
4566
|
+
/** Plain-text notice shown to users who try to sign in through the application. Blank or `null` clears it. */
|
|
4567
|
+
deprecationNotice?: string | null;
|
|
4568
|
+
};
|
|
4475
4569
|
/**
|
|
4476
4570
|
* Client secret metadata returned by application management endpoints.
|
|
4477
4571
|
*/
|
|
@@ -4538,6 +4632,8 @@ type ListAdminOrganizationMembersOptions = {
|
|
|
4538
4632
|
sortBy?: 'createdAt' | 'name';
|
|
4539
4633
|
/** Sort direction for the listing. Defaults to 'desc'. */
|
|
4540
4634
|
sortDirection?: 'asc' | 'desc';
|
|
4635
|
+
/** Restricts the listing to people with access to this application. */
|
|
4636
|
+
applicationId?: string;
|
|
4541
4637
|
};
|
|
4542
4638
|
/**
|
|
4543
4639
|
* Options accepted when listing teams for a single organization as a global admin.
|
|
@@ -4707,20 +4803,6 @@ type AdminUserInvitation = {
|
|
|
4707
4803
|
expiresAt: string;
|
|
4708
4804
|
createdAt: string;
|
|
4709
4805
|
};
|
|
4710
|
-
/**
|
|
4711
|
-
* Options accepted when resending an organization invitation as a global admin.
|
|
4712
|
-
*/
|
|
4713
|
-
type ResendAdminInviteOptions = {
|
|
4714
|
-
organizationId: string;
|
|
4715
|
-
email: string;
|
|
4716
|
-
role: string;
|
|
4717
|
-
applicationId?: string;
|
|
4718
|
-
/**
|
|
4719
|
-
* Teams joined when the re-sent invitation is accepted. Resending replaces the
|
|
4720
|
-
* invitation, so these must be provided to preserve the original team assignments.
|
|
4721
|
-
*/
|
|
4722
|
-
teamIds?: string[];
|
|
4723
|
-
};
|
|
4724
4806
|
/**
|
|
4725
4807
|
* User row returned by the admin user listing endpoint.
|
|
4726
4808
|
*/
|
|
@@ -4748,6 +4830,8 @@ type AdminUser = {
|
|
|
4748
4830
|
organizationCount?: number;
|
|
4749
4831
|
/** Preview of the first organizations the user belongs to. Present when requested via organizationsPreview. */
|
|
4750
4832
|
organizations?: AdminUserOrganization[];
|
|
4833
|
+
/** App role. Present when the listing is scoped to an application; null on invitation rows. */
|
|
4834
|
+
applicationRole?: string | null;
|
|
4751
4835
|
};
|
|
4752
4836
|
/**
|
|
4753
4837
|
* Paginated admin user listing response.
|
|
@@ -4802,6 +4886,8 @@ type AdminOrganizationMemberRecord = {
|
|
|
4802
4886
|
expiresAt?: string;
|
|
4803
4887
|
teams?: AdminOrganizationMemberTeam[];
|
|
4804
4888
|
applications?: AdminOrganizationMemberApplication[];
|
|
4889
|
+
/** App role. Present when the listing is scoped to an application; null on invitation rows. */
|
|
4890
|
+
applicationRole?: string | null;
|
|
4805
4891
|
};
|
|
4806
4892
|
/**
|
|
4807
4893
|
* Paginated organization member listing response.
|
|
@@ -4908,9 +4994,16 @@ type AdminApplicationRole = {
|
|
|
4908
4994
|
name: string;
|
|
4909
4995
|
displayName: string;
|
|
4910
4996
|
description: string;
|
|
4997
|
+
/** Roles of the same application this role may grant, change, revoke and invite. */
|
|
4998
|
+
manageableRoles: string[];
|
|
4999
|
+
};
|
|
5000
|
+
/**
|
|
5001
|
+
* Options accepted when creating an application role. Omitting `manageableRoles`
|
|
5002
|
+
* creates the role with none, and on update keeps the stored list.
|
|
5003
|
+
*/
|
|
5004
|
+
type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'applicationId' | 'manageableRoles'> & {
|
|
5005
|
+
manageableRoles?: string[];
|
|
4911
5006
|
};
|
|
4912
|
-
/** Options accepted when creating an application role. */
|
|
4913
|
-
type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'applicationId'>;
|
|
4914
5007
|
/** Options accepted when updating an application role. */
|
|
4915
5008
|
type UpdateAdminApplicationRoleOptions = CreateAdminApplicationRoleOptions;
|
|
4916
5009
|
/** Kind of matcher an entitlement rule applies. */
|
|
@@ -5001,6 +5094,12 @@ type AdminApplication = {
|
|
|
5001
5094
|
config: ApplicationConfig | null;
|
|
5002
5095
|
serviceAccountUserId: string | null;
|
|
5003
5096
|
serviceAccountUser?: AdminApplicationIdentity | null;
|
|
5097
|
+
/** When the application was disabled, or `null` while it is enabled. A disabled application refuses every sign-in. */
|
|
5098
|
+
disabledAt: string | null;
|
|
5099
|
+
/** ID of the admin who disabled the application, or `null`. */
|
|
5100
|
+
disabledBy: string | null;
|
|
5101
|
+
/** Plain-text notice shown to users who try to sign in through the disabled application. */
|
|
5102
|
+
deprecationNotice: string | null;
|
|
5004
5103
|
createdBy: string;
|
|
5005
5104
|
updatedBy: string;
|
|
5006
5105
|
createdAt: string;
|
|
@@ -5173,6 +5272,24 @@ declare class AdminService {
|
|
|
5173
5272
|
* @returns The updated application
|
|
5174
5273
|
*/
|
|
5175
5274
|
updateApplication(applicationId: string, options: CreateAdminApplicationOptions): Promise<AdminApplicationRecord>;
|
|
5275
|
+
/**
|
|
5276
|
+
* Disables an application. Sign-ins, token exchanges, refreshes and
|
|
5277
|
+
* client-credentials exchanges through it fail with `application_disabled`,
|
|
5278
|
+
* which carries the deprecation notice. Disabling an already disabled
|
|
5279
|
+
* application replaces its notice.
|
|
5280
|
+
*
|
|
5281
|
+
* @param applicationId - ID of the application to disable
|
|
5282
|
+
* @param options - Optional deprecation notice
|
|
5283
|
+
* @returns The updated application
|
|
5284
|
+
*/
|
|
5285
|
+
disableApplication(applicationId: string, options?: DisableAdminApplicationOptions): Promise<AdminApplicationRecord>;
|
|
5286
|
+
/**
|
|
5287
|
+
* Enables a disabled application and clears its deprecation notice.
|
|
5288
|
+
*
|
|
5289
|
+
* @param applicationId - ID of the application to enable
|
|
5290
|
+
* @returns The updated application
|
|
5291
|
+
*/
|
|
5292
|
+
enableApplication(applicationId: string): Promise<AdminApplicationRecord>;
|
|
5176
5293
|
/** Lists the role catalog for an application. */
|
|
5177
5294
|
listApplicationRoles(applicationId: string): Promise<AdminApplicationRole[]>;
|
|
5178
5295
|
/** Creates an application-scoped role definition. */
|
|
@@ -5513,10 +5630,11 @@ declare class AdminService {
|
|
|
5513
5630
|
*/
|
|
5514
5631
|
cancelInvite(invitationId: string): Promise<void>;
|
|
5515
5632
|
/**
|
|
5516
|
-
*
|
|
5517
|
-
*
|
|
5633
|
+
* Replaces a pending invitation with a new one that keeps its roles and
|
|
5634
|
+
* teams, and emails it, as a global admin.
|
|
5635
|
+
* @param invitationId - The ID of the invitation to resend
|
|
5518
5636
|
*/
|
|
5519
|
-
resendInvite(
|
|
5637
|
+
resendInvite(invitationId: string): Promise<void>;
|
|
5520
5638
|
/**
|
|
5521
5639
|
* Invites several users to an organization in one call, or — with
|
|
5522
5640
|
* `sendInvite: false` — adds them as members immediately, creating user
|
|
@@ -5581,6 +5699,18 @@ type ListMembersOptions = {
|
|
|
5581
5699
|
sortBy?: 'createdAt';
|
|
5582
5700
|
/** Sort direction for the member page. */
|
|
5583
5701
|
sortDirection?: 'asc' | 'desc';
|
|
5702
|
+
/** With an application session, also lists organization members without access to the application, marked hasAccess: false. Requires permission to grant access. */
|
|
5703
|
+
includeWithoutAccess?: boolean;
|
|
5704
|
+
};
|
|
5705
|
+
/**
|
|
5706
|
+
* Organization member as returned to an application session, with the member's
|
|
5707
|
+
* role in the application.
|
|
5708
|
+
*/
|
|
5709
|
+
type ApplicationScopedMember = Member & {
|
|
5710
|
+
/** The member's role in the application, or null without access. */
|
|
5711
|
+
applicationRole?: string | null;
|
|
5712
|
+
/** Present when includeWithoutAccess was requested. */
|
|
5713
|
+
hasAccess?: boolean;
|
|
5584
5714
|
};
|
|
5585
5715
|
/**
|
|
5586
5716
|
* Options for inviting a user to the active organization.
|
|
@@ -5594,6 +5724,8 @@ type InviteUserToOrganizationOptions = {
|
|
|
5594
5724
|
userEmail: string;
|
|
5595
5725
|
/** Organization role to assign to the invited user. */
|
|
5596
5726
|
role: Role;
|
|
5727
|
+
/** Application role granted on acceptance. Required with an application-scoped session. */
|
|
5728
|
+
applicationRole?: string;
|
|
5597
5729
|
/** Optional team to add the user to upon acceptance. */
|
|
5598
5730
|
teamId?: string;
|
|
5599
5731
|
/** Whether to resend the invitation if one already exists for this email. */
|
|
@@ -5615,12 +5747,16 @@ type RemoveUserFromOrganizationOptions = {
|
|
|
5615
5747
|
};
|
|
5616
5748
|
/**
|
|
5617
5749
|
* Options for updating a member's role within the organization.
|
|
5750
|
+
*
|
|
5751
|
+
* With an application-scoped session, `role` is an application role and the
|
|
5752
|
+
* update grants or changes access to that application. The organization role
|
|
5753
|
+
* is left unchanged.
|
|
5618
5754
|
*/
|
|
5619
5755
|
type UpdateMemberRoleOptions = {
|
|
5620
5756
|
/** The member ID whose role should be updated. */
|
|
5621
5757
|
memberId: string;
|
|
5622
|
-
/** The new role to assign. */
|
|
5623
|
-
role: Role;
|
|
5758
|
+
/** The new role to assign: an organization role, or an application role in app mode. */
|
|
5759
|
+
role: Role | (string & {});
|
|
5624
5760
|
};
|
|
5625
5761
|
/**
|
|
5626
5762
|
* Payload for creating a new team.
|
|
@@ -5752,29 +5888,10 @@ declare class OrganizationService {
|
|
|
5752
5888
|
* @param options - Pagination options
|
|
5753
5889
|
* @param options.limit - Maximum number of members to return
|
|
5754
5890
|
* @param options.offset - Number of members to skip
|
|
5755
|
-
* @
|
|
5891
|
+
* @param options.includeWithoutAccess - With an application session, also list members without access to the application
|
|
5892
|
+
* @returns An array of organization members, with their application role when the session is an application session
|
|
5756
5893
|
*/
|
|
5757
|
-
listMembers(options?: ListMembersOptions): Promise<
|
|
5758
|
-
id: string;
|
|
5759
|
-
organizationId: string;
|
|
5760
|
-
role: "org:admin" | "org:member" | "org:reviewer";
|
|
5761
|
-
createdAt: Date;
|
|
5762
|
-
userId: string;
|
|
5763
|
-
teamId?: string | undefined | undefined;
|
|
5764
|
-
user: {
|
|
5765
|
-
id: string;
|
|
5766
|
-
email: string;
|
|
5767
|
-
name: string;
|
|
5768
|
-
image?: string | undefined;
|
|
5769
|
-
};
|
|
5770
|
-
} & {
|
|
5771
|
-
user: {
|
|
5772
|
-
id: string;
|
|
5773
|
-
name: string;
|
|
5774
|
-
email: string;
|
|
5775
|
-
image: string | null | undefined;
|
|
5776
|
-
};
|
|
5777
|
-
})[]>;
|
|
5894
|
+
listMembers(options?: ListMembersOptions): Promise<ApplicationScopedMember[]>;
|
|
5778
5895
|
/**
|
|
5779
5896
|
* Gets the currently active organization member for the authenticated user.
|
|
5780
5897
|
*
|
|
@@ -5820,11 +5937,12 @@ declare class OrganizationService {
|
|
|
5820
5937
|
* @param options - Invitation configuration
|
|
5821
5938
|
* @param options.userEmail - Email address of the user to invite
|
|
5822
5939
|
* @param options.role - Role to assign to the invited user
|
|
5940
|
+
* @param options.applicationRole - Application role granted on acceptance; required with an application-scoped session
|
|
5823
5941
|
* @param options.teamId - Team ID to add the user to
|
|
5824
5942
|
* @param options.resend - Whether to resend if invitation already exists
|
|
5825
5943
|
* @returns The created invitation
|
|
5826
5944
|
*/
|
|
5827
|
-
inviteUserToOrganization({ userEmail, role, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
|
|
5945
|
+
inviteUserToOrganization({ userEmail, role, applicationRole, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
|
|
5828
5946
|
id: string;
|
|
5829
5947
|
organizationId: string;
|
|
5830
5948
|
email: string;
|
|
@@ -5885,6 +6003,9 @@ declare class OrganizationService {
|
|
|
5885
6003
|
/**
|
|
5886
6004
|
* Removes a user from the active organization.
|
|
5887
6005
|
*
|
|
6006
|
+
* With an application-scoped session, revokes the member's access to that
|
|
6007
|
+
* application and keeps the membership.
|
|
6008
|
+
*
|
|
5888
6009
|
* @param options - Provide either `memberId` or `userEmail` to identify the user
|
|
5889
6010
|
* @param options.memberId - Membership ID to remove
|
|
5890
6011
|
* @param options.userEmail - Email address of the member to remove
|
|
@@ -5893,6 +6014,10 @@ declare class OrganizationService {
|
|
|
5893
6014
|
/**
|
|
5894
6015
|
* Updates the role of an organization member.
|
|
5895
6016
|
*
|
|
6017
|
+
* With an application-scoped session, `role` is an application role: the
|
|
6018
|
+
* update grants or changes the member's access to that application and
|
|
6019
|
+
* keeps the organization role.
|
|
6020
|
+
*
|
|
5896
6021
|
* @param options - Role update configuration
|
|
5897
6022
|
* @param options.memberId - The member ID to update
|
|
5898
6023
|
* @param options.role - The new role to assign
|
|
@@ -6551,5 +6676,5 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
6551
6676
|
*/
|
|
6552
6677
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
6553
6678
|
|
|
6554
|
-
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, 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, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
6555
|
-
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, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, 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,
|
|
6679
|
+
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 };
|
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.2.0";
|
|
25
25
|
|
|
26
26
|
function parsedEnumValues(schema) {
|
|
27
27
|
return Object.fromEntries(
|
|
@@ -178,6 +178,12 @@ const invitationAdditionalFields = {
|
|
|
178
178
|
type: "string",
|
|
179
179
|
input: true,
|
|
180
180
|
required: false
|
|
181
|
+
},
|
|
182
|
+
/** Application role granted when an application invitation is accepted. */
|
|
183
|
+
applicationRole: {
|
|
184
|
+
type: "string",
|
|
185
|
+
input: true,
|
|
186
|
+
required: false
|
|
181
187
|
}
|
|
182
188
|
};
|
|
183
189
|
const JWTPayloadUser = z$1.object({
|
|
@@ -362,6 +368,11 @@ function applicationsPluginClient() {
|
|
|
362
368
|
method: "POST",
|
|
363
369
|
headers
|
|
364
370
|
});
|
|
371
|
+
},
|
|
372
|
+
listApplicationRoles: async () => {
|
|
373
|
+
return await $fetch("/applications/roles", {
|
|
374
|
+
method: "GET"
|
|
375
|
+
});
|
|
365
376
|
}
|
|
366
377
|
}
|
|
367
378
|
};
|
|
@@ -599,6 +610,35 @@ class AdminService {
|
|
|
599
610
|
body: options
|
|
600
611
|
});
|
|
601
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Disables an application. Sign-ins, token exchanges, refreshes and
|
|
615
|
+
* client-credentials exchanges through it fail with `application_disabled`,
|
|
616
|
+
* which carries the deprecation notice. Disabling an already disabled
|
|
617
|
+
* application replaces its notice.
|
|
618
|
+
*
|
|
619
|
+
* @param applicationId - ID of the application to disable
|
|
620
|
+
* @param options - Optional deprecation notice
|
|
621
|
+
* @returns The updated application
|
|
622
|
+
*/
|
|
623
|
+
async disableApplication(applicationId, options = {}) {
|
|
624
|
+
return await this.requestApplicationRoute("applications/:applicationId/disable", {
|
|
625
|
+
params: { applicationId },
|
|
626
|
+
method: "POST",
|
|
627
|
+
body: options
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Enables a disabled application and clears its deprecation notice.
|
|
632
|
+
*
|
|
633
|
+
* @param applicationId - ID of the application to enable
|
|
634
|
+
* @returns The updated application
|
|
635
|
+
*/
|
|
636
|
+
async enableApplication(applicationId) {
|
|
637
|
+
return await this.requestApplicationRoute("applications/:applicationId/enable", {
|
|
638
|
+
params: { applicationId },
|
|
639
|
+
method: "POST"
|
|
640
|
+
});
|
|
641
|
+
}
|
|
602
642
|
/** Lists the role catalog for an application. */
|
|
603
643
|
async listApplicationRoles(applicationId) {
|
|
604
644
|
return await this.requestApplicationRoute(
|
|
@@ -730,7 +770,8 @@ class AdminService {
|
|
|
730
770
|
...options.query ? { query: options.query } : {},
|
|
731
771
|
...options.organizationsPreview !== void 0 ? { organizations_preview: options.organizationsPreview } : {},
|
|
732
772
|
...options.includeInvitations !== void 0 ? { include_invitations: options.includeInvitations } : {},
|
|
733
|
-
...options.organizationId ? { organization_id: options.organizationId } : {}
|
|
773
|
+
...options.organizationId ? { organization_id: options.organizationId } : {},
|
|
774
|
+
...options.applicationId ? { application_id: options.applicationId } : {}
|
|
734
775
|
}
|
|
735
776
|
});
|
|
736
777
|
}
|
|
@@ -864,7 +905,8 @@ class AdminService {
|
|
|
864
905
|
...options.includeInvitations !== void 0 ? { include_invitations: options.includeInvitations } : {},
|
|
865
906
|
...options.includeAccess !== void 0 ? { include_access: options.includeAccess } : {},
|
|
866
907
|
...options.sortBy ? { sortBy: options.sortBy } : {},
|
|
867
|
-
...options.sortDirection ? { sortDirection: options.sortDirection } : {}
|
|
908
|
+
...options.sortDirection ? { sortDirection: options.sortDirection } : {},
|
|
909
|
+
...options.applicationId ? { application_id: options.applicationId } : {}
|
|
868
910
|
}
|
|
869
911
|
});
|
|
870
912
|
}
|
|
@@ -1114,14 +1156,12 @@ class AdminService {
|
|
|
1114
1156
|
await this.client.$fetch("/admin/invites/cancel", { method: "POST", body: { invitationId } });
|
|
1115
1157
|
}
|
|
1116
1158
|
/**
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1159
|
+
* Replaces a pending invitation with a new one that keeps its roles and
|
|
1160
|
+
* teams, and emails it, as a global admin.
|
|
1161
|
+
* @param invitationId - The ID of the invitation to resend
|
|
1119
1162
|
*/
|
|
1120
|
-
async resendInvite(
|
|
1121
|
-
await this.client.$fetch("/admin/
|
|
1122
|
-
method: "POST",
|
|
1123
|
-
body: { ...options, sendInvite: true, resend: true }
|
|
1124
|
-
});
|
|
1163
|
+
async resendInvite(invitationId) {
|
|
1164
|
+
await this.client.$fetch("/admin/invites/resend", { method: "POST", body: { invitationId } });
|
|
1125
1165
|
}
|
|
1126
1166
|
/**
|
|
1127
1167
|
* Invites several users to an organization in one call, or — with
|
|
@@ -1191,6 +1231,41 @@ class ApplicationSessionAssuranceError extends ApplicationError {
|
|
|
1191
1231
|
this.validStepUps = payload?.validStepUps ?? [];
|
|
1192
1232
|
}
|
|
1193
1233
|
}
|
|
1234
|
+
function parseApplicationDisabledPayload(error) {
|
|
1235
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1236
|
+
let current = error;
|
|
1237
|
+
while (current && typeof current === "object" && !seen.has(current)) {
|
|
1238
|
+
seen.add(current);
|
|
1239
|
+
const candidate = current;
|
|
1240
|
+
for (const details of [candidate.details, candidate.error?.details]) {
|
|
1241
|
+
if (!details || typeof details !== "object") {
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1244
|
+
const payload = details;
|
|
1245
|
+
if (payload.code === "application_disabled" && typeof payload.applicationId === "string") {
|
|
1246
|
+
return {
|
|
1247
|
+
applicationId: payload.applicationId,
|
|
1248
|
+
applicationName: typeof payload.applicationName === "string" ? payload.applicationName : "",
|
|
1249
|
+
deprecationNotice: typeof payload.deprecationNotice === "string" ? payload.deprecationNotice : null
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
current = candidate.cause;
|
|
1254
|
+
}
|
|
1255
|
+
return null;
|
|
1256
|
+
}
|
|
1257
|
+
class ApplicationDisabledError extends ApplicationError {
|
|
1258
|
+
applicationId;
|
|
1259
|
+
applicationName;
|
|
1260
|
+
deprecationNotice;
|
|
1261
|
+
constructor(payload = null, options) {
|
|
1262
|
+
super(payload?.deprecationNotice || `${payload?.applicationName || "The application"} has been disabled`, options);
|
|
1263
|
+
this.code = "APPLICATION_DISABLED";
|
|
1264
|
+
this.applicationId = payload?.applicationId ?? null;
|
|
1265
|
+
this.applicationName = payload?.applicationName || null;
|
|
1266
|
+
this.deprecationNotice = payload?.deprecationNotice ?? null;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1194
1269
|
class UserNotLoggedInError extends ApplicationError {
|
|
1195
1270
|
constructor(message, options) {
|
|
1196
1271
|
super(message, options);
|
|
@@ -1422,8 +1497,17 @@ function parseErrorMessage(error) {
|
|
|
1422
1497
|
const nested = typeof candidateError.error === "string" ? candidateError.error : candidateError.error?.message;
|
|
1423
1498
|
return candidateError.message ?? nested ?? "Failed to exchange device code for tokens";
|
|
1424
1499
|
}
|
|
1500
|
+
function throwIfApplicationDisabled(error) {
|
|
1501
|
+
const payload = parseApplicationDisabledPayload(error);
|
|
1502
|
+
if (payload) {
|
|
1503
|
+
throw new ApplicationDisabledError(payload, { cause: error });
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1425
1506
|
function throwDeviceGrantError(error) {
|
|
1426
1507
|
const code = parseErrorCode(error);
|
|
1508
|
+
if (code === "application_disabled") {
|
|
1509
|
+
throw new ApplicationDisabledError(parseApplicationDisabledPayload(error), { cause: error });
|
|
1510
|
+
}
|
|
1427
1511
|
if (code === "authorization_pending") {
|
|
1428
1512
|
throw new DeviceAuthorizationPendingError({ cause: error });
|
|
1429
1513
|
}
|
|
@@ -1501,6 +1585,7 @@ class ApplicationService {
|
|
|
1501
1585
|
try {
|
|
1502
1586
|
const response = await this.client.applications.startAuthorizationFlow(applicationId, redirectUri, codeChallenge, organizationId);
|
|
1503
1587
|
if (!response.data) {
|
|
1588
|
+
throwIfApplicationDisabled(response.error);
|
|
1504
1589
|
const payload = parseSessionAssuranceRequiredPayload(response.error);
|
|
1505
1590
|
if (payload) {
|
|
1506
1591
|
throw new SessionAssuranceRequiredError(payload, { cause: response.error });
|
|
@@ -1509,9 +1594,10 @@ class ApplicationService {
|
|
|
1509
1594
|
}
|
|
1510
1595
|
return response.data;
|
|
1511
1596
|
} catch (error) {
|
|
1512
|
-
if (error instanceof SessionAssuranceRequiredError) {
|
|
1597
|
+
if (error instanceof SessionAssuranceRequiredError || error instanceof ApplicationDisabledError) {
|
|
1513
1598
|
throw error;
|
|
1514
1599
|
}
|
|
1600
|
+
throwIfApplicationDisabled(error);
|
|
1515
1601
|
const payload = parseSessionAssuranceRequiredPayload(error);
|
|
1516
1602
|
if (payload) {
|
|
1517
1603
|
throw new SessionAssuranceRequiredError(payload, { cause: error });
|
|
@@ -1594,6 +1680,7 @@ class ApplicationService {
|
|
|
1594
1680
|
* @throws {DeviceCodeExpiredError} The device code has expired
|
|
1595
1681
|
* @throws {DeviceTransientServerError} Transient server error — safe to retry
|
|
1596
1682
|
* @throws {ApplicationSessionAssuranceError} Assurance policy changed or is no longer met — start a new flow
|
|
1683
|
+
* @throws {ApplicationDisabledError} The requester or target application is disabled — stop polling
|
|
1597
1684
|
*/
|
|
1598
1685
|
async exchangeDeviceCodeForTokens(deviceCode) {
|
|
1599
1686
|
try {
|
|
@@ -1618,8 +1705,12 @@ class ApplicationService {
|
|
|
1618
1705
|
* @returns A short-lived access token with service-account and organization details
|
|
1619
1706
|
*/
|
|
1620
1707
|
async exchangeClientCredentialsForToken(credentials) {
|
|
1621
|
-
const response = await this.client.applications.exchangeClientCredentialsForToken(credentials)
|
|
1708
|
+
const response = await this.client.applications.exchangeClientCredentialsForToken(credentials).catch((error) => {
|
|
1709
|
+
throwIfApplicationDisabled(error);
|
|
1710
|
+
throw error;
|
|
1711
|
+
});
|
|
1622
1712
|
if (!response.data) {
|
|
1713
|
+
throwIfApplicationDisabled(response.error);
|
|
1623
1714
|
throw new Error("No data returned from the API", { cause: response.error });
|
|
1624
1715
|
}
|
|
1625
1716
|
return response.data;
|
|
@@ -1631,8 +1722,12 @@ class ApplicationService {
|
|
|
1631
1722
|
* @param codeVerifier - The code verifier to use for the authorization flow
|
|
1632
1723
|
*/
|
|
1633
1724
|
async completeAuthorizationFlow(code, codeVerifier) {
|
|
1634
|
-
const response = await this.client.applications.completeAuthorizationFlow(code, codeVerifier)
|
|
1725
|
+
const response = await this.client.applications.completeAuthorizationFlow(code, codeVerifier).catch((error) => {
|
|
1726
|
+
throwIfApplicationDisabled(error);
|
|
1727
|
+
throw error;
|
|
1728
|
+
});
|
|
1635
1729
|
if (!response.data) {
|
|
1730
|
+
throwIfApplicationDisabled(response.error);
|
|
1636
1731
|
throw new Error("No data returned from the API", { cause: response.error });
|
|
1637
1732
|
}
|
|
1638
1733
|
return response.data;
|
|
@@ -1642,11 +1737,15 @@ class ApplicationService {
|
|
|
1642
1737
|
*
|
|
1643
1738
|
* @param refreshToken - The refresh token to use for the authentication token refresh
|
|
1644
1739
|
* @throws {RefreshTokenExpiredError} When the refresh token has expired or is invalid
|
|
1740
|
+
* @throws {ApplicationDisabledError} When the application has been disabled
|
|
1645
1741
|
* @throws {ApplicationError} For other API errors
|
|
1646
1742
|
*/
|
|
1647
1743
|
async refreshAccessToken(refreshToken) {
|
|
1648
1744
|
const handleRefreshError = (error) => {
|
|
1649
1745
|
const status = error?.status;
|
|
1746
|
+
if (parseErrorCode(error) === "application_disabled") {
|
|
1747
|
+
throw new ApplicationDisabledError(parseApplicationDisabledPayload(error), { cause: error, status });
|
|
1748
|
+
}
|
|
1650
1749
|
if (status === 401 || status === 404) {
|
|
1651
1750
|
throw new RefreshTokenExpiredError({ cause: error, status });
|
|
1652
1751
|
}
|
|
@@ -1714,6 +1813,18 @@ class ApplicationService {
|
|
|
1714
1813
|
async logout(refreshToken) {
|
|
1715
1814
|
await this.client.applications.logout(refreshToken);
|
|
1716
1815
|
}
|
|
1816
|
+
/**
|
|
1817
|
+
* Lists the roles of the application the current session was issued for.
|
|
1818
|
+
*
|
|
1819
|
+
* @returns The application's roles
|
|
1820
|
+
*/
|
|
1821
|
+
async listRoles() {
|
|
1822
|
+
const response = await this.client.applications.listApplicationRoles();
|
|
1823
|
+
if (!response.data) {
|
|
1824
|
+
throw new Error("No data returned from the API", { cause: response.error });
|
|
1825
|
+
}
|
|
1826
|
+
return response.data;
|
|
1827
|
+
}
|
|
1717
1828
|
}
|
|
1718
1829
|
|
|
1719
1830
|
class OrganizationService {
|
|
@@ -1776,7 +1887,8 @@ class OrganizationService {
|
|
|
1776
1887
|
* @param options - Pagination options
|
|
1777
1888
|
* @param options.limit - Maximum number of members to return
|
|
1778
1889
|
* @param options.offset - Number of members to skip
|
|
1779
|
-
* @
|
|
1890
|
+
* @param options.includeWithoutAccess - With an application session, also list members without access to the application
|
|
1891
|
+
* @returns An array of organization members, with their application role when the session is an application session
|
|
1780
1892
|
*/
|
|
1781
1893
|
async listMembers(options) {
|
|
1782
1894
|
const members = await this.client.organization.listMembers({
|
|
@@ -1801,16 +1913,18 @@ class OrganizationService {
|
|
|
1801
1913
|
* @param options - Invitation configuration
|
|
1802
1914
|
* @param options.userEmail - Email address of the user to invite
|
|
1803
1915
|
* @param options.role - Role to assign to the invited user
|
|
1916
|
+
* @param options.applicationRole - Application role granted on acceptance; required with an application-scoped session
|
|
1804
1917
|
* @param options.teamId - Team ID to add the user to
|
|
1805
1918
|
* @param options.resend - Whether to resend if invitation already exists
|
|
1806
1919
|
* @returns The created invitation
|
|
1807
1920
|
*/
|
|
1808
|
-
async inviteUserToOrganization({ userEmail, role, teamId, resend }) {
|
|
1921
|
+
async inviteUserToOrganization({ userEmail, role, applicationRole, teamId, resend }) {
|
|
1809
1922
|
return await this.client.organization.inviteMember({
|
|
1810
1923
|
email: userEmail,
|
|
1811
1924
|
role,
|
|
1812
1925
|
teamId,
|
|
1813
|
-
resend: resend ?? false
|
|
1926
|
+
resend: resend ?? false,
|
|
1927
|
+
...applicationRole ? { applicationRole } : {}
|
|
1814
1928
|
});
|
|
1815
1929
|
}
|
|
1816
1930
|
/**
|
|
@@ -1873,6 +1987,9 @@ class OrganizationService {
|
|
|
1873
1987
|
/**
|
|
1874
1988
|
* Removes a user from the active organization.
|
|
1875
1989
|
*
|
|
1990
|
+
* With an application-scoped session, revokes the member's access to that
|
|
1991
|
+
* application and keeps the membership.
|
|
1992
|
+
*
|
|
1876
1993
|
* @param options - Provide either `memberId` or `userEmail` to identify the user
|
|
1877
1994
|
* @param options.memberId - Membership ID to remove
|
|
1878
1995
|
* @param options.userEmail - Email address of the member to remove
|
|
@@ -1885,6 +2002,10 @@ class OrganizationService {
|
|
|
1885
2002
|
/**
|
|
1886
2003
|
* Updates the role of an organization member.
|
|
1887
2004
|
*
|
|
2005
|
+
* With an application-scoped session, `role` is an application role: the
|
|
2006
|
+
* update grants or changes the member's access to that application and
|
|
2007
|
+
* keeps the organization role.
|
|
2008
|
+
*
|
|
1888
2009
|
* @param options - Role update configuration
|
|
1889
2010
|
* @param options.memberId - The member ID to update
|
|
1890
2011
|
* @param options.role - The new role to assign
|
|
@@ -2610,4 +2731,4 @@ function extractTokenPayload(token) {
|
|
|
2610
2731
|
return payload;
|
|
2611
2732
|
}
|
|
2612
2733
|
|
|
2613
|
-
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, 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, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, STEP_UP_MAX_AGE_SECONDS, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, normalizeAmr, organizationAdditionalFields, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
2734
|
+
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, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, STEP_UP_MAX_AGE_SECONDS, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, normalizeAmr, organizationAdditionalFields, parseApplicationDisabledPayload, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|