@meistrari/auth-core 1.27.0 → 1.28.1
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 +89 -5
- package/dist/index.d.ts +89 -5
- package/dist/index.mjs +46 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -712,7 +712,13 @@ type DeviceAuthorizationActionResponse = {
|
|
|
712
712
|
* `ApplicationError` to handle any application-related failure.
|
|
713
713
|
*/
|
|
714
714
|
declare class ApplicationError extends BaseError {
|
|
715
|
-
|
|
715
|
+
/**
|
|
716
|
+
* HTTP status of the upstream failure, when one was received.
|
|
717
|
+
*/
|
|
718
|
+
readonly status?: number;
|
|
719
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
720
|
+
status?: number;
|
|
721
|
+
});
|
|
716
722
|
}
|
|
717
723
|
/**
|
|
718
724
|
* Thrown when a refresh token has expired or been revoked.
|
|
@@ -721,7 +727,9 @@ declare class ApplicationError extends BaseError {
|
|
|
721
727
|
* to re-authenticate.
|
|
722
728
|
*/
|
|
723
729
|
declare class RefreshTokenExpiredError extends ApplicationError {
|
|
724
|
-
constructor(options?: ErrorOptions
|
|
730
|
+
constructor(options?: ErrorOptions & {
|
|
731
|
+
status?: number;
|
|
732
|
+
});
|
|
725
733
|
}
|
|
726
734
|
/**
|
|
727
735
|
* Thrown when an authorization flow fails unexpectedly.
|
|
@@ -903,7 +911,7 @@ declare class ApplicationService {
|
|
|
903
911
|
* @throws {RefreshTokenExpiredError} When the refresh token has expired or is invalid
|
|
904
912
|
* @throws {ApplicationError} For other API errors
|
|
905
913
|
*/
|
|
906
|
-
refreshAccessToken(refreshToken: string): Promise<CompleteAuthorizationFlowResponse
|
|
914
|
+
refreshAccessToken(refreshToken: string): Promise<CompleteAuthorizationFlowResponse>;
|
|
907
915
|
/**
|
|
908
916
|
* Gets the current user and organization for a specific application.
|
|
909
917
|
*
|
|
@@ -5759,6 +5767,36 @@ type ListAdminOrganizationMembersOptions = {
|
|
|
5759
5767
|
limit?: number;
|
|
5760
5768
|
/** Number of members to skip. Defaults to 0. */
|
|
5761
5769
|
offset?: number;
|
|
5770
|
+
/** Free-text search matched against member name, email, role, user ID, and member ID. */
|
|
5771
|
+
query?: string;
|
|
5772
|
+
};
|
|
5773
|
+
/**
|
|
5774
|
+
* Options accepted when listing teams for a single organization as a global admin.
|
|
5775
|
+
*/
|
|
5776
|
+
type ListAdminOrganizationTeamsOptions = {
|
|
5777
|
+
/** ID of the organization whose teams should be listed. */
|
|
5778
|
+
organizationId: string;
|
|
5779
|
+
/** Maximum number of teams to return. Defaults to 50. */
|
|
5780
|
+
limit?: number;
|
|
5781
|
+
/** Number of teams to skip. Defaults to 0. */
|
|
5782
|
+
offset?: number;
|
|
5783
|
+
/** Free-text search matched against team name and ID. */
|
|
5784
|
+
query?: string;
|
|
5785
|
+
/** Column used to order the listing. Defaults to creation date. */
|
|
5786
|
+
sortBy?: 'createdAt' | 'name';
|
|
5787
|
+
/** Order direction. Defaults to descending. */
|
|
5788
|
+
sortDirection?: 'asc' | 'desc';
|
|
5789
|
+
};
|
|
5790
|
+
/**
|
|
5791
|
+
* Options accepted when creating a team for a single organization as a global admin.
|
|
5792
|
+
*/
|
|
5793
|
+
type CreateAdminOrganizationTeamOptions = {
|
|
5794
|
+
/** ID of the organization that should own the team. */
|
|
5795
|
+
organizationId: string;
|
|
5796
|
+
/** Display name of the team. */
|
|
5797
|
+
name: string;
|
|
5798
|
+
/** User IDs of organization members to add to the team. */
|
|
5799
|
+
memberIds?: string[];
|
|
5762
5800
|
};
|
|
5763
5801
|
/**
|
|
5764
5802
|
* Options accepted when creating an organization as a global admin.
|
|
@@ -5848,6 +5886,26 @@ type ListAdminOrganizationMembersResult = {
|
|
|
5848
5886
|
limit: number;
|
|
5849
5887
|
offset: number;
|
|
5850
5888
|
};
|
|
5889
|
+
/**
|
|
5890
|
+
* Full team row returned by the admin organization team listing endpoint.
|
|
5891
|
+
*/
|
|
5892
|
+
type AdminOrganizationTeamRecord = {
|
|
5893
|
+
id: string;
|
|
5894
|
+
name: string;
|
|
5895
|
+
organizationId: string;
|
|
5896
|
+
createdAt: string;
|
|
5897
|
+
updatedAt: string;
|
|
5898
|
+
memberCount: number;
|
|
5899
|
+
};
|
|
5900
|
+
/**
|
|
5901
|
+
* Paginated organization team listing response.
|
|
5902
|
+
*/
|
|
5903
|
+
type ListAdminOrganizationTeamsResult = {
|
|
5904
|
+
teams: AdminOrganizationTeamRecord[];
|
|
5905
|
+
total: number;
|
|
5906
|
+
limit: number;
|
|
5907
|
+
offset: number;
|
|
5908
|
+
};
|
|
5851
5909
|
/**
|
|
5852
5910
|
* Organization row embedded in an admin application entitlement.
|
|
5853
5911
|
*/
|
|
@@ -6027,7 +6085,7 @@ declare class AdminService {
|
|
|
6027
6085
|
/**
|
|
6028
6086
|
* Lists active members for one organization as a global admin.
|
|
6029
6087
|
*
|
|
6030
|
-
* @param options - Organization ID and
|
|
6088
|
+
* @param options - Organization ID, pagination, and search options
|
|
6031
6089
|
* @returns The paginated organization member listing
|
|
6032
6090
|
*/
|
|
6033
6091
|
listOrganizationMembers(options: ListAdminOrganizationMembersOptions): Promise<{
|
|
@@ -6041,6 +6099,32 @@ declare class AdminService {
|
|
|
6041
6099
|
data: ListAdminOrganizationMembersResult;
|
|
6042
6100
|
error: null;
|
|
6043
6101
|
}>;
|
|
6102
|
+
/**
|
|
6103
|
+
* Lists teams for one organization as a global admin.
|
|
6104
|
+
*
|
|
6105
|
+
* @param options - Organization ID, pagination, search, and ordering options
|
|
6106
|
+
* @returns The paginated organization team listing
|
|
6107
|
+
*/
|
|
6108
|
+
listOrganizationTeams(options: ListAdminOrganizationTeamsOptions): Promise<{
|
|
6109
|
+
data: null;
|
|
6110
|
+
error: {
|
|
6111
|
+
message?: string | undefined;
|
|
6112
|
+
status: number;
|
|
6113
|
+
statusText: string;
|
|
6114
|
+
};
|
|
6115
|
+
} | {
|
|
6116
|
+
data: ListAdminOrganizationTeamsResult;
|
|
6117
|
+
error: null;
|
|
6118
|
+
}>;
|
|
6119
|
+
/**
|
|
6120
|
+
* Creates a team for one organization as a global admin.
|
|
6121
|
+
*
|
|
6122
|
+
* @param options - Organization ID, team name, and optional team members
|
|
6123
|
+
* @returns The created team
|
|
6124
|
+
*/
|
|
6125
|
+
createOrganizationTeam(options: CreateAdminOrganizationTeamOptions): Promise<{
|
|
6126
|
+
data: AdminOrganizationTeamRecord;
|
|
6127
|
+
} | null>;
|
|
6044
6128
|
/**
|
|
6045
6129
|
* Creates an organization without adding the creator as a member.
|
|
6046
6130
|
*
|
|
@@ -6992,4 +7076,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
6992
7076
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
6993
7077
|
|
|
6994
7078
|
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, AuthClient, AuthMethod, AuthMethodBrand, AuthMethods, AuthorizationFlowError, DEFAULT_APPLICATION_CONFIG, DEFAULT_JWT_ASSURANCE, DEFAULT_SESSION_ASSURANCE_CONFIG, DeviceAccessDeniedError, DeviceAuthorizationPendingError, DeviceAuthorizationSlowDownError, DeviceCodeExpiredError, DeviceTransientServerError, EmailOTPService, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, JWTPayload, JWTPayloadAssurance, JWTPayloadUser, JWTPayloadWorkspace, OAuthBeginStepUpResponse, OAuthCompleteStepUpResponse, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, SendOtpResponse, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceResponse, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, createAPIClient, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, organizationAdditionalFields, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
6995
|
-
export type { APIClient, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationMember, AdminApplicationOrganization, AdminApplicationRecord, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberRecord, AdminUser, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminOrganizationOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
|
7079
|
+
export type { APIClient, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationMember, AdminApplicationOrganization, AdminApplicationRecord, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberRecord, AdminOrganizationTeamRecord, AdminUser, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -712,7 +712,13 @@ type DeviceAuthorizationActionResponse = {
|
|
|
712
712
|
* `ApplicationError` to handle any application-related failure.
|
|
713
713
|
*/
|
|
714
714
|
declare class ApplicationError extends BaseError {
|
|
715
|
-
|
|
715
|
+
/**
|
|
716
|
+
* HTTP status of the upstream failure, when one was received.
|
|
717
|
+
*/
|
|
718
|
+
readonly status?: number;
|
|
719
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
720
|
+
status?: number;
|
|
721
|
+
});
|
|
716
722
|
}
|
|
717
723
|
/**
|
|
718
724
|
* Thrown when a refresh token has expired or been revoked.
|
|
@@ -721,7 +727,9 @@ declare class ApplicationError extends BaseError {
|
|
|
721
727
|
* to re-authenticate.
|
|
722
728
|
*/
|
|
723
729
|
declare class RefreshTokenExpiredError extends ApplicationError {
|
|
724
|
-
constructor(options?: ErrorOptions
|
|
730
|
+
constructor(options?: ErrorOptions & {
|
|
731
|
+
status?: number;
|
|
732
|
+
});
|
|
725
733
|
}
|
|
726
734
|
/**
|
|
727
735
|
* Thrown when an authorization flow fails unexpectedly.
|
|
@@ -903,7 +911,7 @@ declare class ApplicationService {
|
|
|
903
911
|
* @throws {RefreshTokenExpiredError} When the refresh token has expired or is invalid
|
|
904
912
|
* @throws {ApplicationError} For other API errors
|
|
905
913
|
*/
|
|
906
|
-
refreshAccessToken(refreshToken: string): Promise<CompleteAuthorizationFlowResponse
|
|
914
|
+
refreshAccessToken(refreshToken: string): Promise<CompleteAuthorizationFlowResponse>;
|
|
907
915
|
/**
|
|
908
916
|
* Gets the current user and organization for a specific application.
|
|
909
917
|
*
|
|
@@ -5759,6 +5767,36 @@ type ListAdminOrganizationMembersOptions = {
|
|
|
5759
5767
|
limit?: number;
|
|
5760
5768
|
/** Number of members to skip. Defaults to 0. */
|
|
5761
5769
|
offset?: number;
|
|
5770
|
+
/** Free-text search matched against member name, email, role, user ID, and member ID. */
|
|
5771
|
+
query?: string;
|
|
5772
|
+
};
|
|
5773
|
+
/**
|
|
5774
|
+
* Options accepted when listing teams for a single organization as a global admin.
|
|
5775
|
+
*/
|
|
5776
|
+
type ListAdminOrganizationTeamsOptions = {
|
|
5777
|
+
/** ID of the organization whose teams should be listed. */
|
|
5778
|
+
organizationId: string;
|
|
5779
|
+
/** Maximum number of teams to return. Defaults to 50. */
|
|
5780
|
+
limit?: number;
|
|
5781
|
+
/** Number of teams to skip. Defaults to 0. */
|
|
5782
|
+
offset?: number;
|
|
5783
|
+
/** Free-text search matched against team name and ID. */
|
|
5784
|
+
query?: string;
|
|
5785
|
+
/** Column used to order the listing. Defaults to creation date. */
|
|
5786
|
+
sortBy?: 'createdAt' | 'name';
|
|
5787
|
+
/** Order direction. Defaults to descending. */
|
|
5788
|
+
sortDirection?: 'asc' | 'desc';
|
|
5789
|
+
};
|
|
5790
|
+
/**
|
|
5791
|
+
* Options accepted when creating a team for a single organization as a global admin.
|
|
5792
|
+
*/
|
|
5793
|
+
type CreateAdminOrganizationTeamOptions = {
|
|
5794
|
+
/** ID of the organization that should own the team. */
|
|
5795
|
+
organizationId: string;
|
|
5796
|
+
/** Display name of the team. */
|
|
5797
|
+
name: string;
|
|
5798
|
+
/** User IDs of organization members to add to the team. */
|
|
5799
|
+
memberIds?: string[];
|
|
5762
5800
|
};
|
|
5763
5801
|
/**
|
|
5764
5802
|
* Options accepted when creating an organization as a global admin.
|
|
@@ -5848,6 +5886,26 @@ type ListAdminOrganizationMembersResult = {
|
|
|
5848
5886
|
limit: number;
|
|
5849
5887
|
offset: number;
|
|
5850
5888
|
};
|
|
5889
|
+
/**
|
|
5890
|
+
* Full team row returned by the admin organization team listing endpoint.
|
|
5891
|
+
*/
|
|
5892
|
+
type AdminOrganizationTeamRecord = {
|
|
5893
|
+
id: string;
|
|
5894
|
+
name: string;
|
|
5895
|
+
organizationId: string;
|
|
5896
|
+
createdAt: string;
|
|
5897
|
+
updatedAt: string;
|
|
5898
|
+
memberCount: number;
|
|
5899
|
+
};
|
|
5900
|
+
/**
|
|
5901
|
+
* Paginated organization team listing response.
|
|
5902
|
+
*/
|
|
5903
|
+
type ListAdminOrganizationTeamsResult = {
|
|
5904
|
+
teams: AdminOrganizationTeamRecord[];
|
|
5905
|
+
total: number;
|
|
5906
|
+
limit: number;
|
|
5907
|
+
offset: number;
|
|
5908
|
+
};
|
|
5851
5909
|
/**
|
|
5852
5910
|
* Organization row embedded in an admin application entitlement.
|
|
5853
5911
|
*/
|
|
@@ -6027,7 +6085,7 @@ declare class AdminService {
|
|
|
6027
6085
|
/**
|
|
6028
6086
|
* Lists active members for one organization as a global admin.
|
|
6029
6087
|
*
|
|
6030
|
-
* @param options - Organization ID and
|
|
6088
|
+
* @param options - Organization ID, pagination, and search options
|
|
6031
6089
|
* @returns The paginated organization member listing
|
|
6032
6090
|
*/
|
|
6033
6091
|
listOrganizationMembers(options: ListAdminOrganizationMembersOptions): Promise<{
|
|
@@ -6041,6 +6099,32 @@ declare class AdminService {
|
|
|
6041
6099
|
data: ListAdminOrganizationMembersResult;
|
|
6042
6100
|
error: null;
|
|
6043
6101
|
}>;
|
|
6102
|
+
/**
|
|
6103
|
+
* Lists teams for one organization as a global admin.
|
|
6104
|
+
*
|
|
6105
|
+
* @param options - Organization ID, pagination, search, and ordering options
|
|
6106
|
+
* @returns The paginated organization team listing
|
|
6107
|
+
*/
|
|
6108
|
+
listOrganizationTeams(options: ListAdminOrganizationTeamsOptions): Promise<{
|
|
6109
|
+
data: null;
|
|
6110
|
+
error: {
|
|
6111
|
+
message?: string | undefined;
|
|
6112
|
+
status: number;
|
|
6113
|
+
statusText: string;
|
|
6114
|
+
};
|
|
6115
|
+
} | {
|
|
6116
|
+
data: ListAdminOrganizationTeamsResult;
|
|
6117
|
+
error: null;
|
|
6118
|
+
}>;
|
|
6119
|
+
/**
|
|
6120
|
+
* Creates a team for one organization as a global admin.
|
|
6121
|
+
*
|
|
6122
|
+
* @param options - Organization ID, team name, and optional team members
|
|
6123
|
+
* @returns The created team
|
|
6124
|
+
*/
|
|
6125
|
+
createOrganizationTeam(options: CreateAdminOrganizationTeamOptions): Promise<{
|
|
6126
|
+
data: AdminOrganizationTeamRecord;
|
|
6127
|
+
} | null>;
|
|
6044
6128
|
/**
|
|
6045
6129
|
* Creates an organization without adding the creator as a member.
|
|
6046
6130
|
*
|
|
@@ -6992,4 +7076,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
6992
7076
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
6993
7077
|
|
|
6994
7078
|
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, AuthClient, AuthMethod, AuthMethodBrand, AuthMethods, AuthorizationFlowError, DEFAULT_APPLICATION_CONFIG, DEFAULT_JWT_ASSURANCE, DEFAULT_SESSION_ASSURANCE_CONFIG, DeviceAccessDeniedError, DeviceAuthorizationPendingError, DeviceAuthorizationSlowDownError, DeviceCodeExpiredError, DeviceTransientServerError, EmailOTPService, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, JWTPayload, JWTPayloadAssurance, JWTPayloadUser, JWTPayloadWorkspace, OAuthBeginStepUpResponse, OAuthCompleteStepUpResponse, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, SendOtpResponse, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceResponse, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, createAPIClient, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, organizationAdditionalFields, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
6995
|
-
export type { APIClient, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationMember, AdminApplicationOrganization, AdminApplicationRecord, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberRecord, AdminUser, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminOrganizationOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
|
7079
|
+
export type { APIClient, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationMember, AdminApplicationOrganization, AdminApplicationRecord, AdminOrganization, AdminOrganizationApplication, AdminOrganizationMember, AdminOrganizationMemberRecord, AdminOrganizationTeamRecord, AdminUser, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, DecodedJWTPayload, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, EmailOTPSignInOptions, FullOrganization, GetAdminOrganizationOptions, Invitation, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsResponse, ListMembersOptions, Member, ExtendedOrganization as Organization, OrganizationSettings, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SignInWithEmailAndPasswordOptions, SignInWithSamlOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, UpdateAdminOrganizationOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { defaultStatements } from 'better-auth/plugins/organization/access';
|
|
|
8
8
|
import z, { z as z$1 } from 'zod';
|
|
9
9
|
export { APIError } from 'better-auth';
|
|
10
10
|
|
|
11
|
-
const version = "1.
|
|
11
|
+
const version = "1.28.1";
|
|
12
12
|
|
|
13
13
|
function parsedEnumValues(schema) {
|
|
14
14
|
return Object.fromEntries(
|
|
@@ -482,7 +482,7 @@ class AdminService {
|
|
|
482
482
|
/**
|
|
483
483
|
* Lists active members for one organization as a global admin.
|
|
484
484
|
*
|
|
485
|
-
* @param options - Organization ID and
|
|
485
|
+
* @param options - Organization ID, pagination, and search options
|
|
486
486
|
* @returns The paginated organization member listing
|
|
487
487
|
*/
|
|
488
488
|
async listOrganizationMembers(options) {
|
|
@@ -490,9 +490,44 @@ class AdminService {
|
|
|
490
490
|
method: "GET",
|
|
491
491
|
query: {
|
|
492
492
|
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
493
|
-
...options.offset !== void 0 ? { offset: options.offset } : {}
|
|
493
|
+
...options.offset !== void 0 ? { offset: options.offset } : {},
|
|
494
|
+
...options.query ? { query: options.query } : {}
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Lists teams for one organization as a global admin.
|
|
500
|
+
*
|
|
501
|
+
* @param options - Organization ID, pagination, search, and ordering options
|
|
502
|
+
* @returns The paginated organization team listing
|
|
503
|
+
*/
|
|
504
|
+
async listOrganizationTeams(options) {
|
|
505
|
+
return await this.client.$fetch(`/admin/organizations/${encodeURIComponent(options.organizationId)}/teams`, {
|
|
506
|
+
method: "GET",
|
|
507
|
+
query: {
|
|
508
|
+
...options.limit !== void 0 ? { limit: options.limit } : {},
|
|
509
|
+
...options.offset !== void 0 ? { offset: options.offset } : {},
|
|
510
|
+
...options.query ? { query: options.query } : {},
|
|
511
|
+
...options.sortBy ? { sortBy: options.sortBy } : {},
|
|
512
|
+
...options.sortDirection ? { sortDirection: options.sortDirection } : {}
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Creates a team for one organization as a global admin.
|
|
518
|
+
*
|
|
519
|
+
* @param options - Organization ID, team name, and optional team members
|
|
520
|
+
* @returns The created team
|
|
521
|
+
*/
|
|
522
|
+
async createOrganizationTeam(options) {
|
|
523
|
+
const { data } = await this.client.$fetch(`/admin/organizations/${encodeURIComponent(options.organizationId)}/teams`, {
|
|
524
|
+
method: "POST",
|
|
525
|
+
body: {
|
|
526
|
+
name: options.name,
|
|
527
|
+
memberIds: options.memberIds ?? []
|
|
494
528
|
}
|
|
495
529
|
});
|
|
530
|
+
return data;
|
|
496
531
|
}
|
|
497
532
|
/**
|
|
498
533
|
* Creates an organization without adding the creator as a member.
|
|
@@ -544,8 +579,13 @@ class BaseError extends Error {
|
|
|
544
579
|
}
|
|
545
580
|
|
|
546
581
|
class ApplicationError extends BaseError {
|
|
582
|
+
/**
|
|
583
|
+
* HTTP status of the upstream failure, when one was received.
|
|
584
|
+
*/
|
|
585
|
+
status;
|
|
547
586
|
constructor(message, options) {
|
|
548
587
|
super("APPLICATION_ERROR", message, options);
|
|
588
|
+
this.status = options?.status;
|
|
549
589
|
}
|
|
550
590
|
}
|
|
551
591
|
class RefreshTokenExpiredError extends ApplicationError {
|
|
@@ -995,11 +1035,11 @@ class ApplicationService {
|
|
|
995
1035
|
async refreshAccessToken(refreshToken) {
|
|
996
1036
|
const handleRefreshError = (error) => {
|
|
997
1037
|
const status = error?.status;
|
|
998
|
-
if (status === 404) {
|
|
999
|
-
throw new RefreshTokenExpiredError({ cause: error });
|
|
1038
|
+
if (status === 401 || status === 404) {
|
|
1039
|
+
throw new RefreshTokenExpiredError({ cause: error, status });
|
|
1000
1040
|
}
|
|
1001
1041
|
const message = error?.message;
|
|
1002
|
-
throw new ApplicationError(message || "Failed to refresh access token", { cause: error });
|
|
1042
|
+
throw new ApplicationError(message || "Failed to refresh access token", { cause: error, status });
|
|
1003
1043
|
};
|
|
1004
1044
|
try {
|
|
1005
1045
|
const response = await this.client.applications.refreshAccessToken(refreshToken);
|