@finueva/auth 0.12.0 → 0.13.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/README.md +2 -1
- package/dist/device.d.ts +3 -2
- package/dist/device.js +43 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -0
- package/dist/server.d.ts +3 -2
- package/dist/server.js +43 -0
- package/dist/{types-Sh23XMKv.d.ts → types-Dsu3nEaN.d.ts} +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,7 @@ The browser owns the session cookie. The SDK does not expose or persist it.
|
|
|
88
88
|
| Reset a password | `requestPasswordReset()`, `resetPassword()` | Not available | Not available |
|
|
89
89
|
| Verify an email | `sendVerificationEmail()` | Not available | Not available |
|
|
90
90
|
| List organizations | `listOrganizations()` | `listOrganizations()` | `listOrganizations()` |
|
|
91
|
+
| Read member authority | `getOrganizationMemberAuthority()` | `getOrganizationMemberAuthority()` | `getOrganizationMemberAuthority()` |
|
|
91
92
|
| Create an ordinary team | `createOrganizationTeam()` | `createOrganizationTeam()` | `createOrganizationTeam()` |
|
|
92
93
|
| Invite an ordinary member | `createOrganizationMemberInvitation()` | `createOrganizationMemberInvitation()` | `createOrganizationMemberInvitation()` |
|
|
93
94
|
| Resend a member invitation | `resendOrganizationInvitation()` | `resendOrganizationInvitation()` (cookie) | Not available |
|
|
@@ -225,7 +226,7 @@ import { createServerAuth } from "@finueva/auth/server";
|
|
|
225
226
|
export async function handleRequest(request: Request): Promise<Response> {
|
|
226
227
|
const auth = createServerAuth({
|
|
227
228
|
authOrigin: "https://auth.finueva.com",
|
|
228
|
-
appOrigin: "https://
|
|
229
|
+
appOrigin: "https://app.heylomeet.com",
|
|
229
230
|
request,
|
|
230
231
|
});
|
|
231
232
|
|
package/dist/device.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as OrganizationPage, D as OrganizationTeamMemberPage, E as OrganizationTeamDisplay, G as SocialIdTokenProvider, J as UpdateProfileInput, K as UpdateOrganizationDisplayInput, O as OrganizationTeamPage, Q as AuthErrorStatus, R as ReceivedOrganizationInvitation, S as OrganizationMemberPage, T as OrganizationTeam, W as SocialIdTokenInput, X as AuthError, Z as AuthErrorCode, _ as OrganizationDisplay, b as OrganizationMember, d as CreatedOrganizationMemberInvitation, f as CreatedOrganizationTeam, m as DriveCredentialInput, o as AuthSession, p as DriveCredential, q as UpdateOrganizationTeamDisplayInput, r as AuthOrganization, u as CreateOrganizationMemberInvitationInput, v as OrganizationInvitation, w as OrganizationPageInput, x as OrganizationMemberAuthority, y as OrganizationInvitationPage, z as ReceivedOrganizationInvitationPage } from "./types-Dsu3nEaN.js";
|
|
2
2
|
//#region src/device.d.ts
|
|
3
3
|
type DeviceAuthorizationErrorCode = "device_access_denied" | "device_authorization_cancelled" | "device_code_expired" | "invalid_device_authorization" | "identity_authority_unavailable";
|
|
4
4
|
declare class DeviceAuthorizationError extends Error {
|
|
@@ -45,6 +45,7 @@ interface DeviceAuthClient {
|
|
|
45
45
|
getSession(): Promise<AuthSession | null>;
|
|
46
46
|
listOrganizations(input?: OrganizationPageInput): Promise<OrganizationPage>;
|
|
47
47
|
getOrganization(organizationId: string): Promise<AuthOrganization>;
|
|
48
|
+
getOrganizationMemberAuthority(organizationId: string, memberId: string): Promise<OrganizationMemberAuthority>;
|
|
48
49
|
createOrganizationTeam(organizationId: string, name: string, idempotencyKey: string): Promise<CreatedOrganizationTeam>;
|
|
49
50
|
createOrganizationMemberInvitation(organizationId: string, input: CreateOrganizationMemberInvitationInput): Promise<CreatedOrganizationMemberInvitation>;
|
|
50
51
|
updateOrganizationDisplay(organizationId: string, input: UpdateOrganizationDisplayInput): Promise<OrganizationDisplay>;
|
|
@@ -68,4 +69,4 @@ interface DeviceAuthClient {
|
|
|
68
69
|
}
|
|
69
70
|
declare function createDeviceAuth(options: DeviceAuthOptions): DeviceAuthClient;
|
|
70
71
|
//#endregion
|
|
71
|
-
export { AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, DeviceAuthClient, DeviceAuthOptions, DeviceAuthorization, DeviceAuthorizationError, DeviceAuthorizationErrorCode, DeviceToken, DeviceTokenPersistence, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, PollDeviceOptions, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, createDeviceAuth };
|
|
72
|
+
export { AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, DeviceAuthClient, DeviceAuthOptions, DeviceAuthorization, DeviceAuthorizationError, DeviceAuthorizationErrorCode, DeviceToken, DeviceTokenPersistence, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberAuthority, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, PollDeviceOptions, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, createDeviceAuth };
|
package/dist/device.js
CHANGED
|
@@ -897,6 +897,44 @@ function fromOrganizationMutationAuthorityError(value, status, retryAfter) {
|
|
|
897
897
|
if (status === 403 && code === "REQUEST_ORIGIN_DENIED") return new AuthError("request_origin_denied", 403);
|
|
898
898
|
return fromOrganizationReadAuthorityError(value, status);
|
|
899
899
|
}
|
|
900
|
+
function normalizeOrganizationMemberAuthority(value, organizationId, memberId) {
|
|
901
|
+
exact(value, [
|
|
902
|
+
"organizationId",
|
|
903
|
+
"actor",
|
|
904
|
+
"target"
|
|
905
|
+
]);
|
|
906
|
+
if (!isId(value.organizationId) || value.organizationId !== organizationId) throw authorityUnavailable();
|
|
907
|
+
const actor = normalizeOrganizationAuthorityMemberOutcome(value.actor);
|
|
908
|
+
const target = normalizeOrganizationAuthorityMemberOutcome(value.target);
|
|
909
|
+
if (target.memberId !== memberId || actor.manualRole !== "owner" && actor.manualRole !== "admin") throw authorityUnavailable();
|
|
910
|
+
for (const member of [actor, target]) if (member.manualRole === "member" ? member.role === "owner" : member.role !== member.manualRole) throw authorityUnavailable();
|
|
911
|
+
if (actor.memberId === target.memberId && (actor.manualRole !== target.manualRole || actor.role !== target.role || actor.authorityRevision !== target.authorityRevision)) throw authorityUnavailable();
|
|
912
|
+
return {
|
|
913
|
+
organizationId: value.organizationId,
|
|
914
|
+
actor,
|
|
915
|
+
target
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
function normalizeOrganizationAuthorityMemberOutcome(value, includesStatus = false) {
|
|
919
|
+
exact(value, [
|
|
920
|
+
"memberId",
|
|
921
|
+
"manualRole",
|
|
922
|
+
"role",
|
|
923
|
+
"authorityRevision",
|
|
924
|
+
...includesStatus ? ["status"] : []
|
|
925
|
+
]);
|
|
926
|
+
if (!isId(value.memberId) || value.manualRole !== "owner" && value.manualRole !== "admin" && value.manualRole !== "member" || value.role !== "owner" && value.role !== "admin" && value.role !== "member") throw authorityUnavailable();
|
|
927
|
+
return {
|
|
928
|
+
memberId: value.memberId,
|
|
929
|
+
manualRole: value.manualRole,
|
|
930
|
+
role: value.role,
|
|
931
|
+
authorityRevision: normalizeAuthorityResultRevision(value.authorityRevision)
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
function normalizeAuthorityResultRevision(value) {
|
|
935
|
+
if (!Number.isSafeInteger(value) || value < 0 || value >= Number.MAX_SAFE_INTEGER) throw authorityUnavailable();
|
|
936
|
+
return value;
|
|
937
|
+
}
|
|
900
938
|
function mapError(code, status) {
|
|
901
939
|
if (code === "authentication_required") return {
|
|
902
940
|
code,
|
|
@@ -1476,6 +1514,11 @@ function createDeviceAuth(options) {
|
|
|
1476
1514
|
return Promise.reject(error);
|
|
1477
1515
|
}
|
|
1478
1516
|
},
|
|
1517
|
+
async getOrganizationMemberAuthority(organizationId, memberId) {
|
|
1518
|
+
const organization = normalizeIdInput(organizationId);
|
|
1519
|
+
const member = normalizeIdInput(memberId);
|
|
1520
|
+
return serializeAuthority(() => organizationRead(`${organization}/members/${member}/authority`, void 0, (value) => normalizeOrganizationMemberAuthority(value, organization, member)));
|
|
1521
|
+
},
|
|
1479
1522
|
createOrganizationTeam(organizationId, name, idempotencyKey) {
|
|
1480
1523
|
let id;
|
|
1481
1524
|
let body;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as PersonalWorkspaceSelection, B as RecentAuthenticationStatus, C as OrganizationPage, D as OrganizationTeamMemberPage, E as OrganizationTeamDisplay, F as PlatformRoleChangeRecentAuthenticationInput, G as SocialIdTokenProvider, H as SendVerificationEmailInput, I as PlatformRoleFirstApproval, J as UpdateProfileInput, K as UpdateOrganizationDisplayInput, L as PlatformStatus, M as PlatformRole, N as PlatformRoleApplied, O as OrganizationTeamPage, P as PlatformRoleApproval, Q as AuthErrorStatus, R as ReceivedOrganizationInvitation, S as OrganizationMemberPage, T as OrganizationTeam, U as SignInInput, V as ResentOrganizationInvitation, W as SocialIdTokenInput, X as AuthError, Y as WorkspaceSelection, Z as AuthErrorCode, _ as OrganizationDisplay, a as AuthPersistenceDriver, b as OrganizationMember, c as AuthUser, d as CreatedOrganizationMemberInvitation, f as CreatedOrganizationTeam, g as InvitationAcceptance, h as FinuevaAuthClient, i as AuthPersistence, j as PlatformBootstrapRoleChangeInput, k as OrganizationWorkspaceSelection, l as CanceledOrganizationInvitation, m as DriveCredentialInput, n as AuthClientOptions, o as AuthSession, p as DriveCredential, q as UpdateOrganizationTeamDisplayInput, r as AuthOrganization, s as AuthState, t as AcceptInvitationInput, u as CreateOrganizationMemberInvitationInput, v as OrganizationInvitation, w as OrganizationPageInput, x as OrganizationMemberAuthority, y as OrganizationInvitationPage, z as ReceivedOrganizationInvitationPage } from "./types-Dsu3nEaN.js";
|
|
2
2
|
//#region src/client.d.ts
|
|
3
3
|
declare function createAuthClient(options: AuthClientOptions): FinuevaAuthClient;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { type AcceptInvitationInput, type AuthClientOptions, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthPersistence, type AuthPersistenceDriver, type AuthSession, type AuthState, type AuthUser, type CanceledOrganizationInvitation, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, type DriveCredential, type DriveCredentialInput, type FinuevaAuthClient, type InvitationAcceptance, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PersonalWorkspaceSelection, type PlatformBootstrapRoleChangeInput, type PlatformRole, type PlatformRoleApplied, type PlatformRoleApproval, type PlatformRoleChangeRecentAuthenticationInput, type PlatformRoleFirstApproval, type PlatformStatus, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type RecentAuthenticationStatus, type ResentOrganizationInvitation, type SendVerificationEmailInput, type SignInInput, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, type UpdateProfileInput, type WorkspaceSelection, createAuthClient };
|
|
5
|
+
export { type AcceptInvitationInput, type AuthClientOptions, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthPersistence, type AuthPersistenceDriver, type AuthSession, type AuthState, type AuthUser, type CanceledOrganizationInvitation, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, type DriveCredential, type DriveCredentialInput, type FinuevaAuthClient, type InvitationAcceptance, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberAuthority, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PersonalWorkspaceSelection, type PlatformBootstrapRoleChangeInput, type PlatformRole, type PlatformRoleApplied, type PlatformRoleApproval, type PlatformRoleChangeRecentAuthenticationInput, type PlatformRoleFirstApproval, type PlatformStatus, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type RecentAuthenticationStatus, type ResentOrganizationInvitation, type SendVerificationEmailInput, type SignInInput, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, type UpdateProfileInput, type WorkspaceSelection, createAuthClient };
|
package/dist/index.js
CHANGED
|
@@ -3382,6 +3382,24 @@ function normalizeOrganizationManualRoleChangeResult(value) {
|
|
|
3382
3382
|
...normalizeOrganizationAuthorityMemberOutcome(value, true)
|
|
3383
3383
|
};
|
|
3384
3384
|
}
|
|
3385
|
+
function normalizeOrganizationMemberAuthority(value, organizationId, memberId) {
|
|
3386
|
+
exact(value, [
|
|
3387
|
+
"organizationId",
|
|
3388
|
+
"actor",
|
|
3389
|
+
"target"
|
|
3390
|
+
]);
|
|
3391
|
+
if (!isId(value.organizationId) || value.organizationId !== organizationId) throw authorityUnavailable();
|
|
3392
|
+
const actor = normalizeOrganizationAuthorityMemberOutcome(value.actor);
|
|
3393
|
+
const target = normalizeOrganizationAuthorityMemberOutcome(value.target);
|
|
3394
|
+
if (target.memberId !== memberId || actor.manualRole !== "owner" && actor.manualRole !== "admin") throw authorityUnavailable();
|
|
3395
|
+
for (const member of [actor, target]) if (member.manualRole === "member" ? member.role === "owner" : member.role !== member.manualRole) throw authorityUnavailable();
|
|
3396
|
+
if (actor.memberId === target.memberId && (actor.manualRole !== target.manualRole || actor.role !== target.role || actor.authorityRevision !== target.authorityRevision)) throw authorityUnavailable();
|
|
3397
|
+
return {
|
|
3398
|
+
organizationId: value.organizationId,
|
|
3399
|
+
actor,
|
|
3400
|
+
target
|
|
3401
|
+
};
|
|
3402
|
+
}
|
|
3385
3403
|
function normalizeOrganizationOwnershipTransferResult(value) {
|
|
3386
3404
|
exact(value, [
|
|
3387
3405
|
"status",
|
|
@@ -4930,6 +4948,11 @@ function createAuthClient(options) {
|
|
|
4930
4948
|
async getOrganization(organizationId) {
|
|
4931
4949
|
return organizationRead(normalizeIdInput(organizationId), void 0, normalizeOrganization);
|
|
4932
4950
|
},
|
|
4951
|
+
async getOrganizationMemberAuthority(organizationId, memberId) {
|
|
4952
|
+
const organization = normalizeIdInput(organizationId);
|
|
4953
|
+
const member = normalizeIdInput(memberId);
|
|
4954
|
+
return organizationRead(`${organization}/members/${member}/authority`, void 0, (value) => normalizeOrganizationMemberAuthority(value, organization, member));
|
|
4955
|
+
},
|
|
4933
4956
|
async createOrganizationTeam(organizationId, name, idempotencyKey) {
|
|
4934
4957
|
const id = normalizeIdInput(organizationId);
|
|
4935
4958
|
const body = normalizeOrganizationTeamCreationInput(name, idempotencyKey);
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as PersonalWorkspaceSelection, C as OrganizationPage, D as OrganizationTeamMemberPage, E as OrganizationTeamDisplay, G as SocialIdTokenProvider, K as UpdateOrganizationDisplayInput, O as OrganizationTeamPage, Q as AuthErrorStatus, R as ReceivedOrganizationInvitation, S as OrganizationMemberPage, T as OrganizationTeam, V as ResentOrganizationInvitation, W as SocialIdTokenInput, X as AuthError, Y as WorkspaceSelection, Z as AuthErrorCode, _ as OrganizationDisplay, b as OrganizationMember, c as AuthUser, d as CreatedOrganizationMemberInvitation, f as CreatedOrganizationTeam, g as InvitationAcceptance, k as OrganizationWorkspaceSelection, l as CanceledOrganizationInvitation, m as DriveCredentialInput, o as AuthSession, p as DriveCredential, q as UpdateOrganizationTeamDisplayInput, r as AuthOrganization, t as AcceptInvitationInput, u as CreateOrganizationMemberInvitationInput, v as OrganizationInvitation, w as OrganizationPageInput, x as OrganizationMemberAuthority, y as OrganizationInvitationPage, z as ReceivedOrganizationInvitationPage } from "./types-Dsu3nEaN.js";
|
|
2
2
|
//#region src/server.d.ts
|
|
3
3
|
interface ServerAuthOptions {
|
|
4
4
|
authOrigin: string;
|
|
@@ -22,6 +22,7 @@ interface FinuevaServerAuth {
|
|
|
22
22
|
getSession(): Promise<AuthSession | null>;
|
|
23
23
|
listOrganizations(input?: OrganizationPageInput): Promise<OrganizationPage>;
|
|
24
24
|
getOrganization(organizationId: string): Promise<AuthOrganization>;
|
|
25
|
+
getOrganizationMemberAuthority(organizationId: string, memberId: string): Promise<OrganizationMemberAuthority>;
|
|
25
26
|
createOrganizationTeam(organizationId: string, name: string, idempotencyKey: string): Promise<CreatedOrganizationTeam>;
|
|
26
27
|
createOrganizationMemberInvitation(organizationId: string, input: CreateOrganizationMemberInvitationInput): Promise<CreatedOrganizationMemberInvitation>;
|
|
27
28
|
resendOrganizationInvitation(organizationId: string, invitationId: string, idempotencyKey: string): Promise<ResentOrganizationInvitation>;
|
|
@@ -41,4 +42,4 @@ interface FinuevaServerAuth {
|
|
|
41
42
|
}
|
|
42
43
|
declare function createServerAuth(options: ServerAuthOptions): FinuevaServerAuth;
|
|
43
44
|
//#endregion
|
|
44
|
-
export { type AcceptInvitationInput, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthSession, type AuthUser, type CanceledOrganizationInvitation, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, type DriveCredential, type DriveCredentialInput, FinuevaServerAuth, type InvitationAcceptance, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PersonalWorkspaceSelection, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type ResentOrganizationInvitation, ServerAuthOptions, ServerInvitationAcceptance, ServerSignOutResult, ServerSocialIdTokenSession, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, type WorkspaceSelection, createServerAuth };
|
|
45
|
+
export { type AcceptInvitationInput, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthSession, type AuthUser, type CanceledOrganizationInvitation, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, type DriveCredential, type DriveCredentialInput, FinuevaServerAuth, type InvitationAcceptance, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberAuthority, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PersonalWorkspaceSelection, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type ResentOrganizationInvitation, ServerAuthOptions, ServerInvitationAcceptance, ServerSignOutResult, ServerSocialIdTokenSession, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, type WorkspaceSelection, createServerAuth };
|
package/dist/server.js
CHANGED
|
@@ -909,6 +909,44 @@ function fromOrganizationInvitationAdministrationError(value, status, retryAfter
|
|
|
909
909
|
if (status === 422 && isObject(value) && value.code === "RECOVERY_REQUIRED") return new AuthError("invitation_recovery_required", 422);
|
|
910
910
|
return fromOrganizationMutationAuthorityError(value, status, retryAfter);
|
|
911
911
|
}
|
|
912
|
+
function normalizeOrganizationMemberAuthority(value, organizationId, memberId) {
|
|
913
|
+
exact(value, [
|
|
914
|
+
"organizationId",
|
|
915
|
+
"actor",
|
|
916
|
+
"target"
|
|
917
|
+
]);
|
|
918
|
+
if (!isId(value.organizationId) || value.organizationId !== organizationId) throw authorityUnavailable();
|
|
919
|
+
const actor = normalizeOrganizationAuthorityMemberOutcome(value.actor);
|
|
920
|
+
const target = normalizeOrganizationAuthorityMemberOutcome(value.target);
|
|
921
|
+
if (target.memberId !== memberId || actor.manualRole !== "owner" && actor.manualRole !== "admin") throw authorityUnavailable();
|
|
922
|
+
for (const member of [actor, target]) if (member.manualRole === "member" ? member.role === "owner" : member.role !== member.manualRole) throw authorityUnavailable();
|
|
923
|
+
if (actor.memberId === target.memberId && (actor.manualRole !== target.manualRole || actor.role !== target.role || actor.authorityRevision !== target.authorityRevision)) throw authorityUnavailable();
|
|
924
|
+
return {
|
|
925
|
+
organizationId: value.organizationId,
|
|
926
|
+
actor,
|
|
927
|
+
target
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
function normalizeOrganizationAuthorityMemberOutcome(value, includesStatus = false) {
|
|
931
|
+
exact(value, [
|
|
932
|
+
"memberId",
|
|
933
|
+
"manualRole",
|
|
934
|
+
"role",
|
|
935
|
+
"authorityRevision",
|
|
936
|
+
...includesStatus ? ["status"] : []
|
|
937
|
+
]);
|
|
938
|
+
if (!isId(value.memberId) || value.manualRole !== "owner" && value.manualRole !== "admin" && value.manualRole !== "member" || value.role !== "owner" && value.role !== "admin" && value.role !== "member") throw authorityUnavailable();
|
|
939
|
+
return {
|
|
940
|
+
memberId: value.memberId,
|
|
941
|
+
manualRole: value.manualRole,
|
|
942
|
+
role: value.role,
|
|
943
|
+
authorityRevision: normalizeAuthorityResultRevision(value.authorityRevision)
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
function normalizeAuthorityResultRevision(value) {
|
|
947
|
+
if (!Number.isSafeInteger(value) || value < 0 || value >= Number.MAX_SAFE_INTEGER) throw authorityUnavailable();
|
|
948
|
+
return value;
|
|
949
|
+
}
|
|
912
950
|
function fromInvitationAuthorityError(value, status) {
|
|
913
951
|
const code = isObject(value) && typeof value.code === "string" ? value.code : void 0;
|
|
914
952
|
if (status === 401 && code === "UNAUTHORIZED") return new AuthError("authentication_required", 401);
|
|
@@ -1173,6 +1211,11 @@ function createServerAuth(options) {
|
|
|
1173
1211
|
getOrganization(organizationId) {
|
|
1174
1212
|
return organizationRead(normalizeIdInput(organizationId), void 0, normalizeOrganization);
|
|
1175
1213
|
},
|
|
1214
|
+
async getOrganizationMemberAuthority(organizationId, memberId) {
|
|
1215
|
+
const organization = normalizeIdInput(organizationId);
|
|
1216
|
+
const member = normalizeIdInput(memberId);
|
|
1217
|
+
return organizationRead(`${organization}/members/${member}/authority`, void 0, (value) => normalizeOrganizationMemberAuthority(value, organization, member));
|
|
1218
|
+
},
|
|
1176
1219
|
async createOrganizationTeam(organizationId, name, idempotencyKey) {
|
|
1177
1220
|
const id = normalizeIdInput(organizationId);
|
|
1178
1221
|
const body = normalizeOrganizationTeamCreationInput(name, idempotencyKey);
|
|
@@ -251,6 +251,11 @@ interface OrganizationManualRoleChangeResult {
|
|
|
251
251
|
role: OrganizationManualRole;
|
|
252
252
|
authorityRevision: number;
|
|
253
253
|
}
|
|
254
|
+
interface OrganizationMemberAuthority {
|
|
255
|
+
organizationId: string;
|
|
256
|
+
actor: Omit<OrganizationManualRoleChangeResult, "status">;
|
|
257
|
+
target: Omit<OrganizationManualRoleChangeResult, "status">;
|
|
258
|
+
}
|
|
254
259
|
interface OrganizationOwnershipTransferInput {
|
|
255
260
|
outgoingOwnerMembershipId: string;
|
|
256
261
|
successorMembershipId: string;
|
|
@@ -287,6 +292,7 @@ interface FinuevaAuthClient {
|
|
|
287
292
|
getSession(): Promise<AuthSession | null>;
|
|
288
293
|
listOrganizations(input?: OrganizationPageInput): Promise<OrganizationPage>;
|
|
289
294
|
getOrganization(organizationId: string): Promise<AuthOrganization>;
|
|
295
|
+
getOrganizationMemberAuthority(organizationId: string, memberId: string): Promise<OrganizationMemberAuthority>;
|
|
290
296
|
createOrganizationTeam(organizationId: string, name: string, idempotencyKey: string): Promise<CreatedOrganizationTeam>;
|
|
291
297
|
createOrganizationMemberInvitation(organizationId: string, input: CreateOrganizationMemberInvitationInput): Promise<CreatedOrganizationMemberInvitation>;
|
|
292
298
|
resendOrganizationInvitation(organizationId: string, invitationId: string, idempotencyKey: string): Promise<ResentOrganizationInvitation>;
|
|
@@ -316,4 +322,4 @@ interface FinuevaAuthClient {
|
|
|
316
322
|
onSessionChange(listener: (session: AuthSession | null) => void): () => void;
|
|
317
323
|
}
|
|
318
324
|
//#endregion
|
|
319
|
-
export {
|
|
325
|
+
export { PersonalWorkspaceSelection as A, RecentAuthenticationStatus as B, OrganizationPage as C, OrganizationTeamMemberPage as D, OrganizationTeamDisplay as E, PlatformRoleChangeRecentAuthenticationInput as F, SocialIdTokenProvider as G, SendVerificationEmailInput as H, PlatformRoleFirstApproval as I, UpdateProfileInput as J, UpdateOrganizationDisplayInput as K, PlatformStatus as L, PlatformRole as M, PlatformRoleApplied as N, OrganizationTeamPage as O, PlatformRoleApproval as P, AuthErrorStatus as Q, ReceivedOrganizationInvitation as R, OrganizationMemberPage as S, OrganizationTeam as T, SignInInput as U, ResentOrganizationInvitation as V, SocialIdTokenInput as W, AuthError as X, WorkspaceSelection as Y, AuthErrorCode as Z, OrganizationDisplay as _, AuthPersistenceDriver as a, OrganizationMember as b, AuthUser as c, CreatedOrganizationMemberInvitation as d, CreatedOrganizationTeam as f, InvitationAcceptance as g, FinuevaAuthClient as h, AuthPersistence as i, PlatformBootstrapRoleChangeInput as j, OrganizationWorkspaceSelection as k, CanceledOrganizationInvitation as l, DriveCredentialInput as m, AuthClientOptions as n, AuthSession as o, DriveCredential as p, UpdateOrganizationTeamDisplayInput as q, AuthOrganization as r, AuthState as s, AcceptInvitationInput as t, CreateOrganizationMemberInvitationInput as u, OrganizationInvitation as v, OrganizationPageInput as w, OrganizationMemberAuthority as x, OrganizationInvitationPage as y, ReceivedOrganizationInvitationPage as z };
|