@meistrari/auth-core 3.0.0 → 3.1.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 +97 -46
- package/dist/index.d.ts +97 -46
- package/dist/index.mjs +46 -13
- 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.
|
|
@@ -771,6 +777,17 @@ type DeviceAuthorizationContextResponse = {
|
|
|
771
777
|
/** Seconds remaining before the device code expires. */
|
|
772
778
|
expiresIn: number;
|
|
773
779
|
};
|
|
780
|
+
/**
|
|
781
|
+
* Role of the application an application session was issued for.
|
|
782
|
+
*/
|
|
783
|
+
type ApplicationRole = {
|
|
784
|
+
applicationId: string;
|
|
785
|
+
name: string;
|
|
786
|
+
displayName: string;
|
|
787
|
+
description: string;
|
|
788
|
+
/** Roles of the same application this role may grant, change, revoke and invite. */
|
|
789
|
+
manageableRoles: string[];
|
|
790
|
+
};
|
|
774
791
|
/**
|
|
775
792
|
* Response returned when approving or denying a device authorization request.
|
|
776
793
|
*/
|
|
@@ -1038,6 +1055,12 @@ declare class ApplicationService {
|
|
|
1038
1055
|
* @param refreshToken - The refresh token to invalidate
|
|
1039
1056
|
*/
|
|
1040
1057
|
logout(refreshToken: string): Promise<void>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Lists the roles of the application the current session was issued for.
|
|
1060
|
+
*
|
|
1061
|
+
* @returns The application's roles
|
|
1062
|
+
*/
|
|
1063
|
+
listRoles(): Promise<ApplicationRole[]>;
|
|
1041
1064
|
}
|
|
1042
1065
|
|
|
1043
1066
|
declare const ApiKeyMetadata: zod__default.ZodObject<{
|
|
@@ -3561,6 +3584,17 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
3561
3584
|
data: void;
|
|
3562
3585
|
error: null;
|
|
3563
3586
|
}>;
|
|
3587
|
+
listApplicationRoles: () => Promise<{
|
|
3588
|
+
data: null;
|
|
3589
|
+
error: {
|
|
3590
|
+
message?: string | undefined;
|
|
3591
|
+
status: number;
|
|
3592
|
+
statusText: string;
|
|
3593
|
+
};
|
|
3594
|
+
} | {
|
|
3595
|
+
data: ApplicationRole[];
|
|
3596
|
+
error: null;
|
|
3597
|
+
}>;
|
|
3564
3598
|
};
|
|
3565
3599
|
};
|
|
3566
3600
|
} | {
|
|
@@ -4316,11 +4350,19 @@ type OrganizationSettings = {
|
|
|
4316
4350
|
type ExtendedOrganization = BaseOrganization & {
|
|
4317
4351
|
settings?: OrganizationSettings;
|
|
4318
4352
|
};
|
|
4353
|
+
/**
|
|
4354
|
+
* A member of a {@link FullOrganization}.
|
|
4355
|
+
*/
|
|
4356
|
+
type FullOrganizationMember = Member & {
|
|
4357
|
+
/** The member's role in the session's application. Only set for application sessions. */
|
|
4358
|
+
applicationRole?: string | null;
|
|
4359
|
+
};
|
|
4319
4360
|
/**
|
|
4320
4361
|
* A complete organization object including its members, invitations, and teams.
|
|
4321
4362
|
*/
|
|
4322
4363
|
type FullOrganization = ExtendedOrganization & {
|
|
4323
|
-
members
|
|
4364
|
+
/** With an application session, only members with access to the application. */
|
|
4365
|
+
members: FullOrganizationMember[];
|
|
4324
4366
|
invitations: Invitation[];
|
|
4325
4367
|
teams: Team[];
|
|
4326
4368
|
};
|
|
@@ -4379,6 +4421,8 @@ type ListAdminUsersOptions = {
|
|
|
4379
4421
|
* admin, whose listing is always pinned to their own organization.
|
|
4380
4422
|
*/
|
|
4381
4423
|
organizationId?: string;
|
|
4424
|
+
/** Restricts the listing to people with access to this application. Requires organizationId when listing users. */
|
|
4425
|
+
applicationId?: string;
|
|
4382
4426
|
};
|
|
4383
4427
|
/**
|
|
4384
4428
|
* Organization preview returned alongside each admin user row.
|
|
@@ -4538,6 +4582,8 @@ type ListAdminOrganizationMembersOptions = {
|
|
|
4538
4582
|
sortBy?: 'createdAt' | 'name';
|
|
4539
4583
|
/** Sort direction for the listing. Defaults to 'desc'. */
|
|
4540
4584
|
sortDirection?: 'asc' | 'desc';
|
|
4585
|
+
/** Restricts the listing to people with access to this application. */
|
|
4586
|
+
applicationId?: string;
|
|
4541
4587
|
};
|
|
4542
4588
|
/**
|
|
4543
4589
|
* Options accepted when listing teams for a single organization as a global admin.
|
|
@@ -4707,20 +4753,6 @@ type AdminUserInvitation = {
|
|
|
4707
4753
|
expiresAt: string;
|
|
4708
4754
|
createdAt: string;
|
|
4709
4755
|
};
|
|
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
4756
|
/**
|
|
4725
4757
|
* User row returned by the admin user listing endpoint.
|
|
4726
4758
|
*/
|
|
@@ -4748,6 +4780,8 @@ type AdminUser = {
|
|
|
4748
4780
|
organizationCount?: number;
|
|
4749
4781
|
/** Preview of the first organizations the user belongs to. Present when requested via organizationsPreview. */
|
|
4750
4782
|
organizations?: AdminUserOrganization[];
|
|
4783
|
+
/** App role. Present when the listing is scoped to an application; null on invitation rows. */
|
|
4784
|
+
applicationRole?: string | null;
|
|
4751
4785
|
};
|
|
4752
4786
|
/**
|
|
4753
4787
|
* Paginated admin user listing response.
|
|
@@ -4802,6 +4836,8 @@ type AdminOrganizationMemberRecord = {
|
|
|
4802
4836
|
expiresAt?: string;
|
|
4803
4837
|
teams?: AdminOrganizationMemberTeam[];
|
|
4804
4838
|
applications?: AdminOrganizationMemberApplication[];
|
|
4839
|
+
/** App role. Present when the listing is scoped to an application; null on invitation rows. */
|
|
4840
|
+
applicationRole?: string | null;
|
|
4805
4841
|
};
|
|
4806
4842
|
/**
|
|
4807
4843
|
* Paginated organization member listing response.
|
|
@@ -4908,9 +4944,16 @@ type AdminApplicationRole = {
|
|
|
4908
4944
|
name: string;
|
|
4909
4945
|
displayName: string;
|
|
4910
4946
|
description: string;
|
|
4947
|
+
/** Roles of the same application this role may grant, change, revoke and invite. */
|
|
4948
|
+
manageableRoles: string[];
|
|
4949
|
+
};
|
|
4950
|
+
/**
|
|
4951
|
+
* Options accepted when creating an application role. Omitting `manageableRoles`
|
|
4952
|
+
* creates the role with none, and on update keeps the stored list.
|
|
4953
|
+
*/
|
|
4954
|
+
type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'applicationId' | 'manageableRoles'> & {
|
|
4955
|
+
manageableRoles?: string[];
|
|
4911
4956
|
};
|
|
4912
|
-
/** Options accepted when creating an application role. */
|
|
4913
|
-
type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'applicationId'>;
|
|
4914
4957
|
/** Options accepted when updating an application role. */
|
|
4915
4958
|
type UpdateAdminApplicationRoleOptions = CreateAdminApplicationRoleOptions;
|
|
4916
4959
|
/** Kind of matcher an entitlement rule applies. */
|
|
@@ -5513,10 +5556,11 @@ declare class AdminService {
|
|
|
5513
5556
|
*/
|
|
5514
5557
|
cancelInvite(invitationId: string): Promise<void>;
|
|
5515
5558
|
/**
|
|
5516
|
-
*
|
|
5517
|
-
*
|
|
5559
|
+
* Replaces a pending invitation with a new one that keeps its roles and
|
|
5560
|
+
* teams, and emails it, as a global admin.
|
|
5561
|
+
* @param invitationId - The ID of the invitation to resend
|
|
5518
5562
|
*/
|
|
5519
|
-
resendInvite(
|
|
5563
|
+
resendInvite(invitationId: string): Promise<void>;
|
|
5520
5564
|
/**
|
|
5521
5565
|
* Invites several users to an organization in one call, or — with
|
|
5522
5566
|
* `sendInvite: false` — adds them as members immediately, creating user
|
|
@@ -5581,6 +5625,18 @@ type ListMembersOptions = {
|
|
|
5581
5625
|
sortBy?: 'createdAt';
|
|
5582
5626
|
/** Sort direction for the member page. */
|
|
5583
5627
|
sortDirection?: 'asc' | 'desc';
|
|
5628
|
+
/** With an application session, also lists organization members without access to the application, marked hasAccess: false. Requires permission to grant access. */
|
|
5629
|
+
includeWithoutAccess?: boolean;
|
|
5630
|
+
};
|
|
5631
|
+
/**
|
|
5632
|
+
* Organization member as returned to an application session, with the member's
|
|
5633
|
+
* role in the application.
|
|
5634
|
+
*/
|
|
5635
|
+
type ApplicationScopedMember = Member & {
|
|
5636
|
+
/** The member's role in the application, or null without access. */
|
|
5637
|
+
applicationRole?: string | null;
|
|
5638
|
+
/** Present when includeWithoutAccess was requested. */
|
|
5639
|
+
hasAccess?: boolean;
|
|
5584
5640
|
};
|
|
5585
5641
|
/**
|
|
5586
5642
|
* Options for inviting a user to the active organization.
|
|
@@ -5594,6 +5650,8 @@ type InviteUserToOrganizationOptions = {
|
|
|
5594
5650
|
userEmail: string;
|
|
5595
5651
|
/** Organization role to assign to the invited user. */
|
|
5596
5652
|
role: Role;
|
|
5653
|
+
/** Application role granted on acceptance. Required with an application-scoped session. */
|
|
5654
|
+
applicationRole?: string;
|
|
5597
5655
|
/** Optional team to add the user to upon acceptance. */
|
|
5598
5656
|
teamId?: string;
|
|
5599
5657
|
/** Whether to resend the invitation if one already exists for this email. */
|
|
@@ -5615,12 +5673,16 @@ type RemoveUserFromOrganizationOptions = {
|
|
|
5615
5673
|
};
|
|
5616
5674
|
/**
|
|
5617
5675
|
* Options for updating a member's role within the organization.
|
|
5676
|
+
*
|
|
5677
|
+
* With an application-scoped session, `role` is an application role and the
|
|
5678
|
+
* update grants or changes access to that application. The organization role
|
|
5679
|
+
* is left unchanged.
|
|
5618
5680
|
*/
|
|
5619
5681
|
type UpdateMemberRoleOptions = {
|
|
5620
5682
|
/** The member ID whose role should be updated. */
|
|
5621
5683
|
memberId: string;
|
|
5622
|
-
/** The new role to assign. */
|
|
5623
|
-
role: Role;
|
|
5684
|
+
/** The new role to assign: an organization role, or an application role in app mode. */
|
|
5685
|
+
role: Role | (string & {});
|
|
5624
5686
|
};
|
|
5625
5687
|
/**
|
|
5626
5688
|
* Payload for creating a new team.
|
|
@@ -5752,29 +5814,10 @@ declare class OrganizationService {
|
|
|
5752
5814
|
* @param options - Pagination options
|
|
5753
5815
|
* @param options.limit - Maximum number of members to return
|
|
5754
5816
|
* @param options.offset - Number of members to skip
|
|
5755
|
-
* @
|
|
5817
|
+
* @param options.includeWithoutAccess - With an application session, also list members without access to the application
|
|
5818
|
+
* @returns An array of organization members, with their application role when the session is an application session
|
|
5756
5819
|
*/
|
|
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
|
-
})[]>;
|
|
5820
|
+
listMembers(options?: ListMembersOptions): Promise<ApplicationScopedMember[]>;
|
|
5778
5821
|
/**
|
|
5779
5822
|
* Gets the currently active organization member for the authenticated user.
|
|
5780
5823
|
*
|
|
@@ -5820,11 +5863,12 @@ declare class OrganizationService {
|
|
|
5820
5863
|
* @param options - Invitation configuration
|
|
5821
5864
|
* @param options.userEmail - Email address of the user to invite
|
|
5822
5865
|
* @param options.role - Role to assign to the invited user
|
|
5866
|
+
* @param options.applicationRole - Application role granted on acceptance; required with an application-scoped session
|
|
5823
5867
|
* @param options.teamId - Team ID to add the user to
|
|
5824
5868
|
* @param options.resend - Whether to resend if invitation already exists
|
|
5825
5869
|
* @returns The created invitation
|
|
5826
5870
|
*/
|
|
5827
|
-
inviteUserToOrganization({ userEmail, role, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
|
|
5871
|
+
inviteUserToOrganization({ userEmail, role, applicationRole, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
|
|
5828
5872
|
id: string;
|
|
5829
5873
|
organizationId: string;
|
|
5830
5874
|
email: string;
|
|
@@ -5885,6 +5929,9 @@ declare class OrganizationService {
|
|
|
5885
5929
|
/**
|
|
5886
5930
|
* Removes a user from the active organization.
|
|
5887
5931
|
*
|
|
5932
|
+
* With an application-scoped session, revokes the member's access to that
|
|
5933
|
+
* application and keeps the membership.
|
|
5934
|
+
*
|
|
5888
5935
|
* @param options - Provide either `memberId` or `userEmail` to identify the user
|
|
5889
5936
|
* @param options.memberId - Membership ID to remove
|
|
5890
5937
|
* @param options.userEmail - Email address of the member to remove
|
|
@@ -5893,6 +5940,10 @@ declare class OrganizationService {
|
|
|
5893
5940
|
/**
|
|
5894
5941
|
* Updates the role of an organization member.
|
|
5895
5942
|
*
|
|
5943
|
+
* With an application-scoped session, `role` is an application role: the
|
|
5944
|
+
* update grants or changes the member's access to that application and
|
|
5945
|
+
* keeps the organization role.
|
|
5946
|
+
*
|
|
5896
5947
|
* @param options - Role update configuration
|
|
5897
5948
|
* @param options.memberId - The member ID to update
|
|
5898
5949
|
* @param options.role - The new role to assign
|
|
@@ -6552,4 +6603,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
6552
6603
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
6553
6604
|
|
|
6554
6605
|
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,
|
|
6606
|
+
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, 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, 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.
|
|
@@ -771,6 +777,17 @@ type DeviceAuthorizationContextResponse = {
|
|
|
771
777
|
/** Seconds remaining before the device code expires. */
|
|
772
778
|
expiresIn: number;
|
|
773
779
|
};
|
|
780
|
+
/**
|
|
781
|
+
* Role of the application an application session was issued for.
|
|
782
|
+
*/
|
|
783
|
+
type ApplicationRole = {
|
|
784
|
+
applicationId: string;
|
|
785
|
+
name: string;
|
|
786
|
+
displayName: string;
|
|
787
|
+
description: string;
|
|
788
|
+
/** Roles of the same application this role may grant, change, revoke and invite. */
|
|
789
|
+
manageableRoles: string[];
|
|
790
|
+
};
|
|
774
791
|
/**
|
|
775
792
|
* Response returned when approving or denying a device authorization request.
|
|
776
793
|
*/
|
|
@@ -1038,6 +1055,12 @@ declare class ApplicationService {
|
|
|
1038
1055
|
* @param refreshToken - The refresh token to invalidate
|
|
1039
1056
|
*/
|
|
1040
1057
|
logout(refreshToken: string): Promise<void>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Lists the roles of the application the current session was issued for.
|
|
1060
|
+
*
|
|
1061
|
+
* @returns The application's roles
|
|
1062
|
+
*/
|
|
1063
|
+
listRoles(): Promise<ApplicationRole[]>;
|
|
1041
1064
|
}
|
|
1042
1065
|
|
|
1043
1066
|
declare const ApiKeyMetadata: zod__default.ZodObject<{
|
|
@@ -3561,6 +3584,17 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
|
|
|
3561
3584
|
data: void;
|
|
3562
3585
|
error: null;
|
|
3563
3586
|
}>;
|
|
3587
|
+
listApplicationRoles: () => Promise<{
|
|
3588
|
+
data: null;
|
|
3589
|
+
error: {
|
|
3590
|
+
message?: string | undefined;
|
|
3591
|
+
status: number;
|
|
3592
|
+
statusText: string;
|
|
3593
|
+
};
|
|
3594
|
+
} | {
|
|
3595
|
+
data: ApplicationRole[];
|
|
3596
|
+
error: null;
|
|
3597
|
+
}>;
|
|
3564
3598
|
};
|
|
3565
3599
|
};
|
|
3566
3600
|
} | {
|
|
@@ -4316,11 +4350,19 @@ type OrganizationSettings = {
|
|
|
4316
4350
|
type ExtendedOrganization = BaseOrganization & {
|
|
4317
4351
|
settings?: OrganizationSettings;
|
|
4318
4352
|
};
|
|
4353
|
+
/**
|
|
4354
|
+
* A member of a {@link FullOrganization}.
|
|
4355
|
+
*/
|
|
4356
|
+
type FullOrganizationMember = Member & {
|
|
4357
|
+
/** The member's role in the session's application. Only set for application sessions. */
|
|
4358
|
+
applicationRole?: string | null;
|
|
4359
|
+
};
|
|
4319
4360
|
/**
|
|
4320
4361
|
* A complete organization object including its members, invitations, and teams.
|
|
4321
4362
|
*/
|
|
4322
4363
|
type FullOrganization = ExtendedOrganization & {
|
|
4323
|
-
members
|
|
4364
|
+
/** With an application session, only members with access to the application. */
|
|
4365
|
+
members: FullOrganizationMember[];
|
|
4324
4366
|
invitations: Invitation[];
|
|
4325
4367
|
teams: Team[];
|
|
4326
4368
|
};
|
|
@@ -4379,6 +4421,8 @@ type ListAdminUsersOptions = {
|
|
|
4379
4421
|
* admin, whose listing is always pinned to their own organization.
|
|
4380
4422
|
*/
|
|
4381
4423
|
organizationId?: string;
|
|
4424
|
+
/** Restricts the listing to people with access to this application. Requires organizationId when listing users. */
|
|
4425
|
+
applicationId?: string;
|
|
4382
4426
|
};
|
|
4383
4427
|
/**
|
|
4384
4428
|
* Organization preview returned alongside each admin user row.
|
|
@@ -4538,6 +4582,8 @@ type ListAdminOrganizationMembersOptions = {
|
|
|
4538
4582
|
sortBy?: 'createdAt' | 'name';
|
|
4539
4583
|
/** Sort direction for the listing. Defaults to 'desc'. */
|
|
4540
4584
|
sortDirection?: 'asc' | 'desc';
|
|
4585
|
+
/** Restricts the listing to people with access to this application. */
|
|
4586
|
+
applicationId?: string;
|
|
4541
4587
|
};
|
|
4542
4588
|
/**
|
|
4543
4589
|
* Options accepted when listing teams for a single organization as a global admin.
|
|
@@ -4707,20 +4753,6 @@ type AdminUserInvitation = {
|
|
|
4707
4753
|
expiresAt: string;
|
|
4708
4754
|
createdAt: string;
|
|
4709
4755
|
};
|
|
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
4756
|
/**
|
|
4725
4757
|
* User row returned by the admin user listing endpoint.
|
|
4726
4758
|
*/
|
|
@@ -4748,6 +4780,8 @@ type AdminUser = {
|
|
|
4748
4780
|
organizationCount?: number;
|
|
4749
4781
|
/** Preview of the first organizations the user belongs to. Present when requested via organizationsPreview. */
|
|
4750
4782
|
organizations?: AdminUserOrganization[];
|
|
4783
|
+
/** App role. Present when the listing is scoped to an application; null on invitation rows. */
|
|
4784
|
+
applicationRole?: string | null;
|
|
4751
4785
|
};
|
|
4752
4786
|
/**
|
|
4753
4787
|
* Paginated admin user listing response.
|
|
@@ -4802,6 +4836,8 @@ type AdminOrganizationMemberRecord = {
|
|
|
4802
4836
|
expiresAt?: string;
|
|
4803
4837
|
teams?: AdminOrganizationMemberTeam[];
|
|
4804
4838
|
applications?: AdminOrganizationMemberApplication[];
|
|
4839
|
+
/** App role. Present when the listing is scoped to an application; null on invitation rows. */
|
|
4840
|
+
applicationRole?: string | null;
|
|
4805
4841
|
};
|
|
4806
4842
|
/**
|
|
4807
4843
|
* Paginated organization member listing response.
|
|
@@ -4908,9 +4944,16 @@ type AdminApplicationRole = {
|
|
|
4908
4944
|
name: string;
|
|
4909
4945
|
displayName: string;
|
|
4910
4946
|
description: string;
|
|
4947
|
+
/** Roles of the same application this role may grant, change, revoke and invite. */
|
|
4948
|
+
manageableRoles: string[];
|
|
4949
|
+
};
|
|
4950
|
+
/**
|
|
4951
|
+
* Options accepted when creating an application role. Omitting `manageableRoles`
|
|
4952
|
+
* creates the role with none, and on update keeps the stored list.
|
|
4953
|
+
*/
|
|
4954
|
+
type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'applicationId' | 'manageableRoles'> & {
|
|
4955
|
+
manageableRoles?: string[];
|
|
4911
4956
|
};
|
|
4912
|
-
/** Options accepted when creating an application role. */
|
|
4913
|
-
type CreateAdminApplicationRoleOptions = Omit<AdminApplicationRole, 'applicationId'>;
|
|
4914
4957
|
/** Options accepted when updating an application role. */
|
|
4915
4958
|
type UpdateAdminApplicationRoleOptions = CreateAdminApplicationRoleOptions;
|
|
4916
4959
|
/** Kind of matcher an entitlement rule applies. */
|
|
@@ -5513,10 +5556,11 @@ declare class AdminService {
|
|
|
5513
5556
|
*/
|
|
5514
5557
|
cancelInvite(invitationId: string): Promise<void>;
|
|
5515
5558
|
/**
|
|
5516
|
-
*
|
|
5517
|
-
*
|
|
5559
|
+
* Replaces a pending invitation with a new one that keeps its roles and
|
|
5560
|
+
* teams, and emails it, as a global admin.
|
|
5561
|
+
* @param invitationId - The ID of the invitation to resend
|
|
5518
5562
|
*/
|
|
5519
|
-
resendInvite(
|
|
5563
|
+
resendInvite(invitationId: string): Promise<void>;
|
|
5520
5564
|
/**
|
|
5521
5565
|
* Invites several users to an organization in one call, or — with
|
|
5522
5566
|
* `sendInvite: false` — adds them as members immediately, creating user
|
|
@@ -5581,6 +5625,18 @@ type ListMembersOptions = {
|
|
|
5581
5625
|
sortBy?: 'createdAt';
|
|
5582
5626
|
/** Sort direction for the member page. */
|
|
5583
5627
|
sortDirection?: 'asc' | 'desc';
|
|
5628
|
+
/** With an application session, also lists organization members without access to the application, marked hasAccess: false. Requires permission to grant access. */
|
|
5629
|
+
includeWithoutAccess?: boolean;
|
|
5630
|
+
};
|
|
5631
|
+
/**
|
|
5632
|
+
* Organization member as returned to an application session, with the member's
|
|
5633
|
+
* role in the application.
|
|
5634
|
+
*/
|
|
5635
|
+
type ApplicationScopedMember = Member & {
|
|
5636
|
+
/** The member's role in the application, or null without access. */
|
|
5637
|
+
applicationRole?: string | null;
|
|
5638
|
+
/** Present when includeWithoutAccess was requested. */
|
|
5639
|
+
hasAccess?: boolean;
|
|
5584
5640
|
};
|
|
5585
5641
|
/**
|
|
5586
5642
|
* Options for inviting a user to the active organization.
|
|
@@ -5594,6 +5650,8 @@ type InviteUserToOrganizationOptions = {
|
|
|
5594
5650
|
userEmail: string;
|
|
5595
5651
|
/** Organization role to assign to the invited user. */
|
|
5596
5652
|
role: Role;
|
|
5653
|
+
/** Application role granted on acceptance. Required with an application-scoped session. */
|
|
5654
|
+
applicationRole?: string;
|
|
5597
5655
|
/** Optional team to add the user to upon acceptance. */
|
|
5598
5656
|
teamId?: string;
|
|
5599
5657
|
/** Whether to resend the invitation if one already exists for this email. */
|
|
@@ -5615,12 +5673,16 @@ type RemoveUserFromOrganizationOptions = {
|
|
|
5615
5673
|
};
|
|
5616
5674
|
/**
|
|
5617
5675
|
* Options for updating a member's role within the organization.
|
|
5676
|
+
*
|
|
5677
|
+
* With an application-scoped session, `role` is an application role and the
|
|
5678
|
+
* update grants or changes access to that application. The organization role
|
|
5679
|
+
* is left unchanged.
|
|
5618
5680
|
*/
|
|
5619
5681
|
type UpdateMemberRoleOptions = {
|
|
5620
5682
|
/** The member ID whose role should be updated. */
|
|
5621
5683
|
memberId: string;
|
|
5622
|
-
/** The new role to assign. */
|
|
5623
|
-
role: Role;
|
|
5684
|
+
/** The new role to assign: an organization role, or an application role in app mode. */
|
|
5685
|
+
role: Role | (string & {});
|
|
5624
5686
|
};
|
|
5625
5687
|
/**
|
|
5626
5688
|
* Payload for creating a new team.
|
|
@@ -5752,29 +5814,10 @@ declare class OrganizationService {
|
|
|
5752
5814
|
* @param options - Pagination options
|
|
5753
5815
|
* @param options.limit - Maximum number of members to return
|
|
5754
5816
|
* @param options.offset - Number of members to skip
|
|
5755
|
-
* @
|
|
5817
|
+
* @param options.includeWithoutAccess - With an application session, also list members without access to the application
|
|
5818
|
+
* @returns An array of organization members, with their application role when the session is an application session
|
|
5756
5819
|
*/
|
|
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
|
-
})[]>;
|
|
5820
|
+
listMembers(options?: ListMembersOptions): Promise<ApplicationScopedMember[]>;
|
|
5778
5821
|
/**
|
|
5779
5822
|
* Gets the currently active organization member for the authenticated user.
|
|
5780
5823
|
*
|
|
@@ -5820,11 +5863,12 @@ declare class OrganizationService {
|
|
|
5820
5863
|
* @param options - Invitation configuration
|
|
5821
5864
|
* @param options.userEmail - Email address of the user to invite
|
|
5822
5865
|
* @param options.role - Role to assign to the invited user
|
|
5866
|
+
* @param options.applicationRole - Application role granted on acceptance; required with an application-scoped session
|
|
5823
5867
|
* @param options.teamId - Team ID to add the user to
|
|
5824
5868
|
* @param options.resend - Whether to resend if invitation already exists
|
|
5825
5869
|
* @returns The created invitation
|
|
5826
5870
|
*/
|
|
5827
|
-
inviteUserToOrganization({ userEmail, role, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
|
|
5871
|
+
inviteUserToOrganization({ userEmail, role, applicationRole, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
|
|
5828
5872
|
id: string;
|
|
5829
5873
|
organizationId: string;
|
|
5830
5874
|
email: string;
|
|
@@ -5885,6 +5929,9 @@ declare class OrganizationService {
|
|
|
5885
5929
|
/**
|
|
5886
5930
|
* Removes a user from the active organization.
|
|
5887
5931
|
*
|
|
5932
|
+
* With an application-scoped session, revokes the member's access to that
|
|
5933
|
+
* application and keeps the membership.
|
|
5934
|
+
*
|
|
5888
5935
|
* @param options - Provide either `memberId` or `userEmail` to identify the user
|
|
5889
5936
|
* @param options.memberId - Membership ID to remove
|
|
5890
5937
|
* @param options.userEmail - Email address of the member to remove
|
|
@@ -5893,6 +5940,10 @@ declare class OrganizationService {
|
|
|
5893
5940
|
/**
|
|
5894
5941
|
* Updates the role of an organization member.
|
|
5895
5942
|
*
|
|
5943
|
+
* With an application-scoped session, `role` is an application role: the
|
|
5944
|
+
* update grants or changes the member's access to that application and
|
|
5945
|
+
* keeps the organization role.
|
|
5946
|
+
*
|
|
5896
5947
|
* @param options - Role update configuration
|
|
5897
5948
|
* @param options.memberId - The member ID to update
|
|
5898
5949
|
* @param options.role - The new role to assign
|
|
@@ -6552,4 +6603,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
6552
6603
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
6553
6604
|
|
|
6554
6605
|
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,
|
|
6606
|
+
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, 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, 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.1.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
|
};
|
|
@@ -730,7 +741,8 @@ class AdminService {
|
|
|
730
741
|
...options.query ? { query: options.query } : {},
|
|
731
742
|
...options.organizationsPreview !== void 0 ? { organizations_preview: options.organizationsPreview } : {},
|
|
732
743
|
...options.includeInvitations !== void 0 ? { include_invitations: options.includeInvitations } : {},
|
|
733
|
-
...options.organizationId ? { organization_id: options.organizationId } : {}
|
|
744
|
+
...options.organizationId ? { organization_id: options.organizationId } : {},
|
|
745
|
+
...options.applicationId ? { application_id: options.applicationId } : {}
|
|
734
746
|
}
|
|
735
747
|
});
|
|
736
748
|
}
|
|
@@ -864,7 +876,8 @@ class AdminService {
|
|
|
864
876
|
...options.includeInvitations !== void 0 ? { include_invitations: options.includeInvitations } : {},
|
|
865
877
|
...options.includeAccess !== void 0 ? { include_access: options.includeAccess } : {},
|
|
866
878
|
...options.sortBy ? { sortBy: options.sortBy } : {},
|
|
867
|
-
...options.sortDirection ? { sortDirection: options.sortDirection } : {}
|
|
879
|
+
...options.sortDirection ? { sortDirection: options.sortDirection } : {},
|
|
880
|
+
...options.applicationId ? { application_id: options.applicationId } : {}
|
|
868
881
|
}
|
|
869
882
|
});
|
|
870
883
|
}
|
|
@@ -1114,14 +1127,12 @@ class AdminService {
|
|
|
1114
1127
|
await this.client.$fetch("/admin/invites/cancel", { method: "POST", body: { invitationId } });
|
|
1115
1128
|
}
|
|
1116
1129
|
/**
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1130
|
+
* Replaces a pending invitation with a new one that keeps its roles and
|
|
1131
|
+
* teams, and emails it, as a global admin.
|
|
1132
|
+
* @param invitationId - The ID of the invitation to resend
|
|
1119
1133
|
*/
|
|
1120
|
-
async resendInvite(
|
|
1121
|
-
await this.client.$fetch("/admin/
|
|
1122
|
-
method: "POST",
|
|
1123
|
-
body: { ...options, sendInvite: true, resend: true }
|
|
1124
|
-
});
|
|
1134
|
+
async resendInvite(invitationId) {
|
|
1135
|
+
await this.client.$fetch("/admin/invites/resend", { method: "POST", body: { invitationId } });
|
|
1125
1136
|
}
|
|
1126
1137
|
/**
|
|
1127
1138
|
* Invites several users to an organization in one call, or — with
|
|
@@ -1714,6 +1725,18 @@ class ApplicationService {
|
|
|
1714
1725
|
async logout(refreshToken) {
|
|
1715
1726
|
await this.client.applications.logout(refreshToken);
|
|
1716
1727
|
}
|
|
1728
|
+
/**
|
|
1729
|
+
* Lists the roles of the application the current session was issued for.
|
|
1730
|
+
*
|
|
1731
|
+
* @returns The application's roles
|
|
1732
|
+
*/
|
|
1733
|
+
async listRoles() {
|
|
1734
|
+
const response = await this.client.applications.listApplicationRoles();
|
|
1735
|
+
if (!response.data) {
|
|
1736
|
+
throw new Error("No data returned from the API", { cause: response.error });
|
|
1737
|
+
}
|
|
1738
|
+
return response.data;
|
|
1739
|
+
}
|
|
1717
1740
|
}
|
|
1718
1741
|
|
|
1719
1742
|
class OrganizationService {
|
|
@@ -1776,7 +1799,8 @@ class OrganizationService {
|
|
|
1776
1799
|
* @param options - Pagination options
|
|
1777
1800
|
* @param options.limit - Maximum number of members to return
|
|
1778
1801
|
* @param options.offset - Number of members to skip
|
|
1779
|
-
* @
|
|
1802
|
+
* @param options.includeWithoutAccess - With an application session, also list members without access to the application
|
|
1803
|
+
* @returns An array of organization members, with their application role when the session is an application session
|
|
1780
1804
|
*/
|
|
1781
1805
|
async listMembers(options) {
|
|
1782
1806
|
const members = await this.client.organization.listMembers({
|
|
@@ -1801,16 +1825,18 @@ class OrganizationService {
|
|
|
1801
1825
|
* @param options - Invitation configuration
|
|
1802
1826
|
* @param options.userEmail - Email address of the user to invite
|
|
1803
1827
|
* @param options.role - Role to assign to the invited user
|
|
1828
|
+
* @param options.applicationRole - Application role granted on acceptance; required with an application-scoped session
|
|
1804
1829
|
* @param options.teamId - Team ID to add the user to
|
|
1805
1830
|
* @param options.resend - Whether to resend if invitation already exists
|
|
1806
1831
|
* @returns The created invitation
|
|
1807
1832
|
*/
|
|
1808
|
-
async inviteUserToOrganization({ userEmail, role, teamId, resend }) {
|
|
1833
|
+
async inviteUserToOrganization({ userEmail, role, applicationRole, teamId, resend }) {
|
|
1809
1834
|
return await this.client.organization.inviteMember({
|
|
1810
1835
|
email: userEmail,
|
|
1811
1836
|
role,
|
|
1812
1837
|
teamId,
|
|
1813
|
-
resend: resend ?? false
|
|
1838
|
+
resend: resend ?? false,
|
|
1839
|
+
...applicationRole ? { applicationRole } : {}
|
|
1814
1840
|
});
|
|
1815
1841
|
}
|
|
1816
1842
|
/**
|
|
@@ -1873,6 +1899,9 @@ class OrganizationService {
|
|
|
1873
1899
|
/**
|
|
1874
1900
|
* Removes a user from the active organization.
|
|
1875
1901
|
*
|
|
1902
|
+
* With an application-scoped session, revokes the member's access to that
|
|
1903
|
+
* application and keeps the membership.
|
|
1904
|
+
*
|
|
1876
1905
|
* @param options - Provide either `memberId` or `userEmail` to identify the user
|
|
1877
1906
|
* @param options.memberId - Membership ID to remove
|
|
1878
1907
|
* @param options.userEmail - Email address of the member to remove
|
|
@@ -1885,6 +1914,10 @@ class OrganizationService {
|
|
|
1885
1914
|
/**
|
|
1886
1915
|
* Updates the role of an organization member.
|
|
1887
1916
|
*
|
|
1917
|
+
* With an application-scoped session, `role` is an application role: the
|
|
1918
|
+
* update grants or changes the member's access to that application and
|
|
1919
|
+
* keeps the organization role.
|
|
1920
|
+
*
|
|
1888
1921
|
* @param options - Role update configuration
|
|
1889
1922
|
* @param options.memberId - The member ID to update
|
|
1890
1923
|
* @param options.role - The new role to assign
|