@hexclave/shared 1.0.38 → 1.0.40
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/ai/unified-prompts/reminders.js +2 -2
- package/dist/ai/unified-prompts/reminders.js.map +1 -1
- package/dist/config/schema.d.ts +149 -149
- package/dist/esm/ai/unified-prompts/reminders.js +2 -2
- package/dist/esm/ai/unified-prompts/reminders.js.map +1 -1
- package/dist/esm/config/schema.d.ts +149 -149
- package/dist/esm/hooks/use-async-callback.js +1 -1
- package/dist/esm/hooks/use-async-external-store.js +1 -1
- package/dist/esm/hooks/use-strict-memo.js +1 -1
- package/dist/esm/interface/admin-metrics.d.ts +4 -4
- package/dist/esm/interface/conversations.d.ts +24 -24
- package/dist/esm/interface/crud/current-user.d.ts +2 -2
- package/dist/esm/interface/crud/email-outbox.d.ts +42 -42
- package/dist/esm/interface/crud/invoices.d.ts +2 -2
- package/dist/esm/interface/crud/team-member-profiles.d.ts +10 -10
- package/dist/esm/interface/crud/users.d.ts +8 -8
- package/dist/esm/interface/server-interface.d.ts +1 -0
- package/dist/esm/interface/server-interface.d.ts.map +1 -1
- package/dist/esm/interface/server-interface.js +1 -0
- package/dist/esm/interface/server-interface.js.map +1 -1
- package/dist/esm/interface/webhooks.d.ts +2 -2
- package/dist/hooks/use-async-callback.js +1 -1
- package/dist/hooks/use-async-external-store.js +1 -1
- package/dist/hooks/use-strict-memo.js +1 -1
- package/dist/interface/admin-metrics.d.ts +4 -4
- package/dist/interface/conversations.d.ts +24 -24
- package/dist/interface/crud/current-user.d.ts +2 -2
- package/dist/interface/crud/email-outbox.d.ts +42 -42
- package/dist/interface/crud/invoices.d.ts +2 -2
- package/dist/interface/crud/team-member-profiles.d.ts +10 -10
- package/dist/interface/crud/users.d.ts +8 -8
- package/dist/interface/server-interface.d.ts +1 -0
- package/dist/interface/server-interface.d.ts.map +1 -1
- package/dist/interface/server-interface.js +1 -0
- package/dist/interface/server-interface.js.map +1 -1
- package/dist/interface/webhooks.d.ts +2 -2
- package/package.json +1 -1
- package/src/ai/unified-prompts/reminders.ts +1 -1
- package/src/interface/server-interface.ts +2 -0
- package/dist/esm/local-emulator.d.ts +0 -6
- package/dist/esm/local-emulator.d.ts.map +0 -1
- package/dist/esm/local-emulator.js +0 -7
- package/dist/esm/local-emulator.js.map +0 -1
- package/dist/local-emulator.d.ts +0 -6
- package/dist/local-emulator.d.ts.map +0 -1
- package/dist/local-emulator.js +0 -10
- package/dist/local-emulator.js.map +0 -1
- package/src/local-emulator.ts +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-interface.js","names":[],"sources":["../../../src/interface/server-interface.ts"],"sourcesContent":["import * as yup from \"yup\";\nimport { decryptValue, encryptValue, hashKey } from \"../helpers/vault/client-side\";\nimport { KnownErrors } from \"../known-errors\";\nimport { inlineProductSchema } from \"../schema-fields\";\nimport { AccessToken, InternalSession, RefreshToken } from \"../sessions\";\nimport { HexclaveAssertionError } from \"../utils/errors\";\nimport { filterUndefined } from \"../utils/objects\";\nimport { Result } from \"../utils/results\";\nimport { urlString } from \"../utils/urls\";\nimport {\n ClientInterfaceOptions,\n HexclaveClientInterface\n} from \"./client-interface\";\nimport { ConnectedAccountAccessTokenCrud, ConnectedAccountCrud } from \"./crud/connected-accounts\";\nimport { ContactChannelsCrud } from \"./crud/contact-channels\";\nimport { CurrentUserCrud } from \"./crud/current-user\";\nimport { ItemCrud } from \"./crud/items\";\nimport { NotificationPreferenceCrud } from \"./crud/notification-preferences\";\nimport { OAuthProviderCrud } from \"./crud/oauth-providers\";\nimport { ProjectPermissionsCrud } from \"./crud/project-permissions\";\nimport { SessionsCrud } from \"./crud/sessions\";\nimport { TeamInvitationCrud } from \"./crud/team-invitation\";\nimport { TeamMemberProfilesCrud } from \"./crud/team-member-profiles\";\nimport { TeamMembershipsCrud } from \"./crud/team-memberships\";\nimport { TeamPermissionsCrud } from \"./crud/team-permissions\";\nimport { TeamsCrud } from \"./crud/teams\";\nimport { UsersCrud } from \"./crud/users\";\n\nexport type ServerAuthApplicationOptions = (\n & ClientInterfaceOptions\n & (\n | {\n readonly secretServerKey: string,\n }\n | {\n readonly projectOwnerSession: InternalSession | (() => Promise<string | null>),\n }\n )\n);\n\nexport class HexclaveServerInterface extends HexclaveClientInterface {\n constructor(public override options: ServerAuthApplicationOptions) {\n super(options);\n }\n\n protected async sendServerRequest(path: string, options: RequestInit, session: InternalSession | null, requestType: \"server\" | \"admin\" = \"server\") {\n return await this.sendClientRequest(\n path,\n {\n ...options,\n headers: {\n // Hexclave rebrand: emit x-hexclave-* request header; the backend proxy dual-accepts both names.\n \"x-hexclave-secret-server-key\": \"secretServerKey\" in this.options ? this.options.secretServerKey : \"\",\n ...options.headers,\n },\n },\n session,\n requestType,\n );\n }\n\n override async getCustomerBilling(\n customerType: \"user\" | \"team\",\n customerId: string,\n session: InternalSession | null,\n ): Promise<{\n has_customer: boolean,\n default_payment_method: {\n id: string,\n brand: string | null,\n last4: string | null,\n exp_month: number | null,\n exp_year: number | null,\n } | null,\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/billing/${customerType}/${customerId}`,\n {},\n session,\n );\n return await response.json();\n }\n\n override async createCustomerPaymentMethodSetupIntent(\n customerType: \"user\" | \"team\",\n customerId: string,\n session: InternalSession | null,\n ): Promise<{\n client_secret: string,\n stripe_account_id: string,\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/payment-method/${customerType}/${customerId}/setup-intent`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n session,\n );\n return await response.json();\n }\n\n override async setDefaultCustomerPaymentMethodFromSetupIntent(\n customerType: \"user\" | \"team\",\n customerId: string,\n setupIntentId: string,\n session: InternalSession | null,\n ): Promise<{\n default_payment_method: {\n id: string,\n brand: string | null,\n last4: string | null,\n exp_month: number | null,\n exp_year: number | null,\n },\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/payment-method/${customerType}/${customerId}/set-default`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n setup_intent_id: setupIntentId,\n }),\n },\n session,\n );\n return await response.json();\n }\n\n\n protected async sendServerRequestAndCatchKnownError<E extends typeof KnownErrors[keyof KnownErrors]>(\n path: string,\n requestOptions: RequestInit,\n tokenStoreOrNull: InternalSession | null,\n errorsToCatch: readonly E[],\n ): Promise<Result<\n Response & {\n usedTokens: {\n accessToken: AccessToken,\n refreshToken: RefreshToken | null,\n } | null,\n },\n InstanceType<E>\n >> {\n try {\n return Result.ok(await this.sendServerRequest(path, requestOptions, tokenStoreOrNull));\n } catch (e) {\n for (const errorType of errorsToCatch) {\n if (errorType.isInstance(e)) {\n return Result.error(e as InstanceType<E>);\n }\n }\n throw e;\n }\n }\n\n async createServerUser(data: UsersCrud['Server']['Create']): Promise<UsersCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/users\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async getServerUserByToken(session: InternalSession): Promise<CurrentUserCrud['Server']['Read'] | null> {\n const responseOrError = await this.sendServerRequestAndCatchKnownError(\n \"/users/me\",\n {},\n session,\n [KnownErrors.CannotGetOwnUserWithoutUser],\n );\n if (responseOrError.status === \"error\") {\n if (KnownErrors.CannotGetOwnUserWithoutUser.isInstance(responseOrError.error)) {\n return null;\n } else {\n throw new HexclaveAssertionError(\"Unexpected uncaught error\", { cause: responseOrError.error });\n }\n }\n const response = responseOrError.data;\n const user: CurrentUserCrud['Server']['Read'] = await response.json();\n if (!(user as any)) throw new HexclaveAssertionError(\"User endpoint returned null; this should never happen\");\n return user;\n }\n\n async getServerUserById(userId: string): Promise<Result<UsersCrud['Server']['Read']>> {\n const responseOrError = await this.sendServerRequestAndCatchKnownError(\n urlString`/users/${userId}`,\n {},\n null,\n [KnownErrors.UserNotFound],\n );\n if (responseOrError.status === \"error\") {\n return Result.error(responseOrError.error);\n }\n const user: UsersCrud['Server']['Read'] = await responseOrError.data.json();\n return Result.ok(user);\n }\n\n async listServerTeamInvitations(options: {\n teamId: string,\n }): Promise<TeamInvitationCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/team-invitations?team_id=${options.teamId}`,\n {},\n null,\n );\n const result = await response.json() as TeamInvitationCrud['Server']['List'];\n return result.items;\n }\n\n async revokeServerTeamInvitation(invitationId: string, teamId: string) {\n await this.sendServerRequest(\n urlString`/team-invitations/${invitationId}?team_id=${teamId}`,\n { method: \"DELETE\" },\n null,\n );\n }\n\n async listServerTeamMemberProfiles(\n options: {\n teamId: string,\n },\n ): Promise<TeamMemberProfilesCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/team-member-profiles?team_id=${options.teamId}`,\n {},\n null,\n );\n const result = await response.json() as TeamMemberProfilesCrud['Server']['List'];\n return result.items;\n }\n\n async getServerTeamMemberProfile(\n options: {\n teamId: string,\n userId: string,\n },\n ): Promise<TeamMemberProfilesCrud['Client']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/team-member-profiles/${options.teamId}/${options.userId}`,\n {},\n null,\n );\n return await response.json();\n }\n\n async listServerTeamPermissions(\n options: {\n userId?: string,\n teamId?: string,\n recursive: boolean,\n },\n session: InternalSession | null,\n ): Promise<TeamPermissionsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n `/team-permissions?${new URLSearchParams(filterUndefined({\n user_id: options.userId,\n team_id: options.teamId,\n recursive: options.recursive.toString(),\n }))}`,\n {},\n session,\n );\n const result = await response.json() as TeamPermissionsCrud['Server']['List'];\n return result.items;\n }\n\n async listServerProjectPermissions(\n options: {\n userId?: string,\n recursive: boolean,\n },\n session: InternalSession | null,\n ): Promise<ProjectPermissionsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n `/project-permissions?${new URLSearchParams(filterUndefined({\n user_id: options.userId,\n recursive: options.recursive.toString(),\n }))}`,\n {},\n session,\n );\n const result = await response.json() as ProjectPermissionsCrud['Server']['List'];\n return result.items;\n }\n\n async listServerUsers(options: (\n & {\n cursor?: string,\n limit?: number,\n orderBy?: 'signedUpAt' | 'lastActiveAt',\n desc?: boolean,\n query?: string,\n excludedEmailDomains?: string[],\n includeRestricted?: boolean,\n teamId?: string,\n }\n & (\n {\n includeAnonymous?: boolean,\n onlyAnonymous?: false,\n }\n | {\n includeAnonymous: true,\n onlyAnonymous: true,\n }\n )\n )): Promise<UsersCrud['Server']['List']> {\n const searchParams = new URLSearchParams(filterUndefined({\n cursor: options.cursor,\n limit: options.limit?.toString(),\n desc: options.desc?.toString(),\n team_id: options.teamId,\n ...options.orderBy ? {\n order_by: {\n signedUpAt: \"signed_up_at\",\n lastActiveAt: \"last_active_at\",\n }[options.orderBy],\n } : {},\n ...options.query ? {\n query: options.query,\n } : {},\n ...options.excludedEmailDomains && options.excludedEmailDomains.length > 0 ? {\n excluded_email_domains: options.excludedEmailDomains.join(\",\"), // backend expects comma-separated list of domains.\n } : {},\n ...options.includeRestricted ? {\n include_restricted: 'true',\n } : {},\n ...options.includeAnonymous ? {\n include_anonymous: 'true',\n } : {},\n ...options.onlyAnonymous ? {\n only_anonymous: 'true',\n } : {},\n }));\n const response = await this.sendServerRequest(\"/users?\" + searchParams.toString(), {}, null);\n return await response.json();\n }\n\n async listServerTeams(options?: {\n userId?: string,\n }): Promise<TeamsCrud['Server']['Read'][]> {\n const result = await this.listServerTeamsPaginated(options);\n return result.items;\n }\n\n async listServerTeamsPaginated(options?: {\n userId?: string,\n orderBy?: 'createdAt',\n desc?: boolean,\n cursor?: string,\n limit?: number,\n query?: string,\n }): Promise<TeamsCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n `/teams?${new URLSearchParams(filterUndefined({\n user_id: options?.userId,\n // SDK option uses camelCase `createdAt`; backend uses snake_case.\n order_by: options?.orderBy === 'createdAt' ? 'created_at' : options?.orderBy,\n desc: options?.desc !== undefined ? String(options.desc) : undefined,\n cursor: options?.cursor,\n limit: options?.limit?.toString(),\n query: options?.query,\n }))}`,\n {},\n null\n );\n return await response.json() as TeamsCrud['Server']['List'];\n }\n\n async getServerTeam(teamId: string): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n `/teams/${teamId}`,\n {},\n null\n );\n return await response.json();\n }\n\n async listServerTeamUsers(teamId: string): Promise<UsersCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(`/users?team_id=${teamId}`, {}, null);\n const result = await response.json() as UsersCrud['Server']['List'];\n return result.items;\n }\n\n /* when passing a session, the user will be added to the team */\n async createServerTeam(data: TeamsCrud['Server']['Create']): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/teams\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null\n );\n return await response.json();\n }\n\n async updateServerTeam(teamId: string, data: TeamsCrud['Server']['Update']): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/teams/${teamId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerTeam(teamId: string): Promise<void> {\n await this.sendServerRequest(\n urlString`/teams/${teamId}`,\n { method: \"DELETE\" },\n null,\n );\n }\n\n async addServerUserToTeam(options: {\n userId: string,\n teamId: string,\n }): Promise<TeamMembershipsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n return await response.json();\n }\n\n async removeServerUserFromTeam(options: {\n userId: string,\n teamId: string,\n }) {\n await this.sendServerRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async listServerUserTeamInvitations(userId: string): Promise<TeamInvitationCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n \"/team-invitations?\" + new URLSearchParams({ user_id: userId }),\n {},\n null,\n );\n const result = await response.json() as TeamInvitationCrud['Server']['List'];\n return result.items;\n }\n\n async acceptServerTeamInvitationById(\n invitationId: string,\n userId: string,\n ) {\n await this.sendServerRequest(\n urlString`/team-invitations/${invitationId}/accept` + \"?\" + new URLSearchParams({ user_id: userId }),\n { method: \"POST\" },\n null,\n );\n }\n\n async updateServerUser(userId: string, update: UsersCrud['Server']['Update']): Promise<UsersCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/users/${userId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(update),\n },\n null,\n );\n return await response.json();\n }\n\n async createServerProviderAccessToken(\n userId: string,\n provider: string,\n scope: string,\n ): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}/${provider}/access-token`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ scope }),\n },\n null,\n );\n return await response.json();\n }\n\n /**\n * Get access token for a specific connected account by provider ID and provider account ID.\n * This is the preferred method when dealing with multiple accounts of the same provider.\n */\n async createServerProviderAccessTokenByAccount(\n userId: string,\n providerId: string,\n providerAccountId: string,\n scope: string,\n ): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}/${providerId}/${providerAccountId}/access-token`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ scope }),\n },\n null,\n );\n return await response.json();\n }\n\n /**\n * List all connected accounts for a user.\n */\n async listServerConnectedAccounts(\n userId: string,\n ): Promise<ConnectedAccountCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}`,\n { method: \"GET\" },\n null,\n );\n return await response.json();\n }\n\n async createServerUserSession(userId: string, expiresInMillis: number, isImpersonation: boolean): Promise<{ accessToken: string, refreshToken: string }> {\n const response = await this.sendServerRequest(\n \"/auth/sessions\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n user_id: userId,\n expires_in_millis: expiresInMillis,\n is_impersonation: isImpersonation,\n }),\n },\n null,\n );\n const result = await response.json();\n return {\n accessToken: result.access_token,\n refreshToken: result.refresh_token,\n };\n }\n\n async leaveServerTeam(\n options: {\n teamId: string,\n userId: string,\n },\n ) {\n await this.sendClientRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async updateServerTeamMemberProfile(options: {\n teamId: string,\n userId: string,\n profile: TeamMemberProfilesCrud['Server']['Update'],\n }) {\n await this.sendServerRequest(\n urlString`/team-member-profiles/${options.teamId}/${options.userId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(options.profile),\n },\n null,\n );\n }\n\n async grantServerTeamUserPermission(teamId: string, userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async grantServerProjectPermission(userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/project-permissions/${userId}/${permissionId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async revokeServerTeamUserPermission(teamId: string, userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async revokeServerProjectPermission(userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/project-permissions/${userId}/${permissionId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async deleteServerUser(userId: string) {\n await this.sendServerRequest(\n urlString`/users/${userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async createServerContactChannel(\n data: ContactChannelsCrud['Server']['Create'],\n ): Promise<ContactChannelsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/contact-channels\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async updateServerContactChannel(\n userId: string,\n contactChannelId: string,\n data: ContactChannelsCrud['Server']['Update'],\n ): Promise<ContactChannelsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerContactChannel(\n userId: string,\n contactChannelId: string,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n }\n\n async listServerContactChannels(\n userId: string,\n ): Promise<ContactChannelsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/contact-channels?user_id=${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n const json = await response.json() as ContactChannelsCrud['Server']['List'];\n return json.items;\n }\n\n async listServerNotificationCategories(\n userId: string,\n ): Promise<NotificationPreferenceCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/emails/notification-preference/${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n const json = await response.json() as NotificationPreferenceCrud['Server']['List'];\n return json.items;\n }\n\n async setServerNotificationsEnabled(\n userId: string,\n notificationCategoryId: string,\n enabled: boolean,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/emails/notification-preference/${userId}/${notificationCategoryId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n enabled,\n }),\n },\n null,\n );\n }\n\n async sendServerContactChannelVerificationEmail(\n userId: string,\n contactChannelId: string,\n callbackUrl: string,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}/send-verification-code`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ callback_url: callbackUrl }),\n },\n null,\n );\n }\n\n\n async listServerSessions(userId: string): Promise<SessionsCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n urlString`/auth/sessions?user_id=${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerSession(sessionId: string) {\n await this.sendServerRequest(\n urlString`/auth/sessions/${sessionId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n }\n\n\n async sendServerTeamInvitation(options: {\n email: string,\n teamId: string,\n callbackUrl: string,\n }): Promise<void> {\n await this.sendServerRequest(\n \"/team-invitations/send-code\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n email: options.email,\n team_id: options.teamId,\n callback_url: options.callbackUrl,\n }),\n },\n null,\n );\n }\n\n async updatePassword(\n options: { oldPassword: string, newPassword: string },\n ): Promise<KnownErrors[\"PasswordConfirmationMismatch\"] | KnownErrors[\"PasswordRequirementsNotMet\"] | undefined> {\n const res = await this.sendServerRequestAndCatchKnownError(\n \"/auth/password/update\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n old_password: options.oldPassword,\n new_password: options.newPassword,\n }),\n },\n null,\n [KnownErrors.PasswordConfirmationMismatch, KnownErrors.PasswordRequirementsNotMet]\n );\n\n if (res.status === \"error\") {\n return res.error;\n }\n }\n\n // OAuth Providers CRUD operations\n async createServerOAuthProvider(\n data: OAuthProviderCrud['Server']['Create'],\n ): Promise<OAuthProviderCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/oauth-providers\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n\n async listServerOAuthProviders(\n options: {\n user_id?: string,\n } = {},\n ): Promise<OAuthProviderCrud['Server']['Read'][]> {\n const queryParams = new URLSearchParams(filterUndefined(options));\n const response = await this.sendServerRequest(\n `/oauth-providers${queryParams.toString() ? `?${queryParams.toString()}` : ''}`,\n {\n method: \"GET\",\n },\n null,\n );\n const result = await response.json();\n return result.items;\n }\n\n async updateServerOAuthProvider(\n userId: string,\n providerId: string,\n data: OAuthProviderCrud['Server']['Update'],\n ): Promise<OAuthProviderCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/oauth-providers/${userId}/${providerId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerOAuthProvider(\n userId: string,\n providerId: string,\n ): Promise<void> {\n const response = await this.sendServerRequest(\n urlString`/oauth-providers/${userId}/${providerId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n return await response.json();\n }\n\n async sendEmail(options: {\n userIds?: string[],\n allUsers?: true,\n themeId?: string | null | false,\n html?: string,\n subject?: string,\n notificationCategoryName?: string,\n templateId?: string,\n variables?: Record<string, any>,\n draftId?: string,\n scheduledAt?: Date,\n }): Promise<Result<void, KnownErrors[\"RequiresCustomEmailServer\"] | KnownErrors[\"SchemaError\"] | KnownErrors[\"UserIdDoesNotExist\"]>> {\n const res = await this.sendServerRequest(\n \"/emails/send-email\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n user_ids: options.userIds,\n all_users: options.allUsers,\n theme_id: options.themeId,\n html: options.html,\n subject: options.subject,\n notification_category_name: options.notificationCategoryName,\n template_id: options.templateId,\n variables: options.variables,\n draft_id: options.draftId,\n scheduled_at_millis: options.scheduledAt?.getTime(),\n }),\n },\n null,\n );\n return Result.ok(undefined);\n }\n\n async getEmailDeliveryInfo(): Promise<{\n stats: {\n hour: { sent: number, bounced: number, marked_as_spam: number },\n day: { sent: number, bounced: number, marked_as_spam: number },\n week: { sent: number, bounced: number, marked_as_spam: number },\n month: { sent: number, bounced: number, marked_as_spam: number },\n },\n capacity: {\n rate_per_second: number,\n boost_multiplier: number,\n penalty_factor: number,\n is_boost_active: boolean,\n boost_expires_at: string | null,\n },\n }> {\n const res = await this.sendServerRequest(\n \"/emails/delivery-info\",\n {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n },\n null,\n );\n return await res.json();\n }\n\n async activateEmailCapacityBoost(): Promise<{ expires_at: string }> {\n const res = await this.sendServerRequest(\n \"/emails/capacity-boost\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({}),\n },\n null,\n );\n return await res.json();\n }\n\n async updateItemQuantity(\n options: (\n { itemId: string, userId: string } |\n { itemId: string, teamId: string } |\n { itemId: string, customCustomerId: string }\n ),\n data: ItemCrud['Server']['Update'],\n ): Promise<void> {\n let customerType: \"user\" | \"team\" | \"custom\";\n let customerId: string;\n const itemId: string = options.itemId;\n\n if (\"userId\" in options) {\n customerType = \"user\";\n customerId = options.userId;\n } else if (\"teamId\" in options) {\n customerType = \"team\";\n customerId = options.teamId;\n } else if (\"customCustomerId\" in options) {\n customerType = \"custom\";\n customerId = options.customCustomerId;\n } else {\n throw new HexclaveAssertionError(\"updateItemQuantity requires one of userId, teamId, or customCustomerId\");\n }\n\n const queryParams = new URLSearchParams({ allow_negative: (data.allow_negative ?? false).toString() });\n await this.sendServerRequest(\n `/payments/items/${customerType}/${customerId}/${itemId}/update-quantity?${queryParams.toString()}`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ delta: data.delta, expires_at: data.expires_at, description: data.description }),\n },\n null\n );\n }\n\n async grantProduct(\n options: {\n customerType: \"user\" | \"team\" | \"custom\",\n customerId: string,\n productId?: string,\n product?: yup.InferType<typeof inlineProductSchema>,\n quantity?: number,\n },\n ): Promise<void> {\n if (!options.productId && !options.product) {\n throw new HexclaveAssertionError(\"grantProduct requires either productId or product\");\n }\n if (options.productId && options.product) {\n throw new HexclaveAssertionError(\"grantProduct should not receive both productId and product\");\n }\n const body = filterUndefined({\n product_id: options.productId,\n product_inline: options.product,\n quantity: options.quantity,\n });\n await this.sendServerRequest(\n urlString`/payments/products/${options.customerType}/${options.customerId}`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(body),\n },\n null,\n );\n }\n\n async getDataVaultStoreValue(secret: string, storeId: string, key: string) {\n const hashedKey = await hashKey(secret, key);\n const response = await this.sendServerRequestAndCatchKnownError(\n `/data-vault/stores/${storeId}/get`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ hashed_key: hashedKey }),\n },\n null,\n [KnownErrors.DataVaultStoreHashedKeyDoesNotExist] as const,\n );\n if (response.status === \"error\") {\n if (KnownErrors.DataVaultStoreHashedKeyDoesNotExist.isInstance(response.error)) {\n return null;\n } else {\n throw new HexclaveAssertionError(\"Unexpected uncaught error\", { cause: response.error });\n }\n }\n const json = await response.data.json();\n const encryptedValue = json.encrypted_value;\n if (typeof encryptedValue !== \"string\") throw new HexclaveAssertionError(\"encrypted_value is not a string\", { type: typeof encryptedValue });\n return await decryptValue(secret, key, encryptedValue);\n }\n\n async setDataVaultStoreValue(secret: string, storeId: string, key: string, value: string) {\n const hashedKey = await hashKey(secret, key);\n const encryptedValue = await encryptValue(secret, key, value);\n await this.sendServerRequest(\n `/data-vault/stores/${storeId}/set`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ hashed_key: hashedKey, encrypted_value: encryptedValue }),\n },\n null,\n );\n }\n\n async initiateServerPasskeyRegistration(userId: string): Promise<Result<{ options_json: any, code: string }, KnownErrors[]>> {\n // Create a temporary session for this user to use for passkey registration\n // TODO instead of creating a new session, this should just call the endpoint in a way in which it doesn't require a session\n // (currently this shows up on session history etc... not ideal)\n const { accessToken, refreshToken } = await this.createServerUserSession(userId, 60000 * 2, false); // 2 minute session\n const tempSession = new InternalSession({\n accessToken,\n refreshToken,\n refreshAccessTokenCallback: async () => null, // No refresh for temporary sessions\n });\n\n // Use the existing initiatePasskeyRegistration method with the temporary session\n return await this.initiatePasskeyRegistration({}, tempSession);\n }\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAa,0BAAb,cAA6C,wBAAwB;CACnE,YAAY,AAAgB,SAAuC;AACjE,QAAM,QAAQ;EADY;;CAI5B,MAAgB,kBAAkB,MAAc,SAAsB,SAAiC,cAAkC,UAAU;AACjJ,SAAO,MAAM,KAAK,kBAChB,MACA;GACE,GAAG;GACH,SAAS;IAEP,gCAAgC,qBAAqB,KAAK,UAAU,KAAK,QAAQ,kBAAkB;IACnG,GAAG,QAAQ;IACZ;GACF,EACD,SACA,YACD;;CAGH,MAAe,mBACb,cACA,YACA,SAUC;AAMD,SAAO,OALU,MAAM,KAAK,kBAC1B,SAAS,qBAAqB,aAAa,GAAG,cAC9C,EAAE,EACF,QACD,EACqB,MAAM;;CAG9B,MAAe,uCACb,cACA,YACA,SAIC;AAYD,SAAO,OAXU,MAAM,KAAK,kBAC1B,SAAS,4BAA4B,aAAa,GAAG,WAAW,gBAChE;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,oBACjB;GACD,MAAM,KAAK,UAAU,EAAE,CAAC;GACzB,EACD,QACD,EACqB,MAAM;;CAG9B,MAAe,+CACb,cACA,YACA,eACA,SASC;AAcD,SAAO,OAbU,M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Y,MAAM,QAAQ,QAAQ,IAAI;EAC5C,MAAM,iBAAiB,MAAM,aAAa,QAAQ,KAAK,MAAM;AAC7D,QAAM,KAAK,kBACT,sBAAsB,QAAQ,OAC9B;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAC/C,MAAM,KAAK,UAAU;IAAE,YAAY;IAAW,iBAAiB;IAAgB,CAAC;GACjF,EACD,KACD;;CAGH,MAAM,kCAAkC,QAAqF;EAI3H,MAAM,EAAE,aAAa,iBAAiB,MAAM,KAAK,wBAAwB,QAAQ,MAAQ,GAAG,MAAM;EAClG,MAAM,cAAc,IAAI,gBAAgB;GACtC;GACA;GACA,4BAA4B,YAAY;GACzC,CAAC;AAGF,SAAO,MAAM,KAAK,4BAA4B,EAAE,EAAE,YAAY"}
|
|
1
|
+
{"version":3,"file":"server-interface.js","names":[],"sources":["../../../src/interface/server-interface.ts"],"sourcesContent":["import * as yup from \"yup\";\nimport { decryptValue, encryptValue, hashKey } from \"../helpers/vault/client-side\";\nimport { KnownErrors } from \"../known-errors\";\nimport { inlineProductSchema } from \"../schema-fields\";\nimport { AccessToken, InternalSession, RefreshToken } from \"../sessions\";\nimport { HexclaveAssertionError } from \"../utils/errors\";\nimport { filterUndefined } from \"../utils/objects\";\nimport { Result } from \"../utils/results\";\nimport { urlString } from \"../utils/urls\";\nimport {\n ClientInterfaceOptions,\n HexclaveClientInterface\n} from \"./client-interface\";\nimport { ConnectedAccountAccessTokenCrud, ConnectedAccountCrud } from \"./crud/connected-accounts\";\nimport { ContactChannelsCrud } from \"./crud/contact-channels\";\nimport { CurrentUserCrud } from \"./crud/current-user\";\nimport { ItemCrud } from \"./crud/items\";\nimport { NotificationPreferenceCrud } from \"./crud/notification-preferences\";\nimport { OAuthProviderCrud } from \"./crud/oauth-providers\";\nimport { ProjectPermissionsCrud } from \"./crud/project-permissions\";\nimport { SessionsCrud } from \"./crud/sessions\";\nimport { TeamInvitationCrud } from \"./crud/team-invitation\";\nimport { TeamMemberProfilesCrud } from \"./crud/team-member-profiles\";\nimport { TeamMembershipsCrud } from \"./crud/team-memberships\";\nimport { TeamPermissionsCrud } from \"./crud/team-permissions\";\nimport { TeamsCrud } from \"./crud/teams\";\nimport { UsersCrud } from \"./crud/users\";\n\nexport type ServerAuthApplicationOptions = (\n & ClientInterfaceOptions\n & (\n | {\n readonly secretServerKey: string,\n }\n | {\n readonly projectOwnerSession: InternalSession | (() => Promise<string | null>),\n }\n )\n);\n\nexport class HexclaveServerInterface extends HexclaveClientInterface {\n constructor(public override options: ServerAuthApplicationOptions) {\n super(options);\n }\n\n protected async sendServerRequest(path: string, options: RequestInit, session: InternalSession | null, requestType: \"server\" | \"admin\" = \"server\") {\n return await this.sendClientRequest(\n path,\n {\n ...options,\n headers: {\n // Hexclave rebrand: emit x-hexclave-* request header; the backend proxy dual-accepts both names.\n \"x-hexclave-secret-server-key\": \"secretServerKey\" in this.options ? this.options.secretServerKey : \"\",\n ...options.headers,\n },\n },\n session,\n requestType,\n );\n }\n\n override async getCustomerBilling(\n customerType: \"user\" | \"team\",\n customerId: string,\n session: InternalSession | null,\n ): Promise<{\n has_customer: boolean,\n default_payment_method: {\n id: string,\n brand: string | null,\n last4: string | null,\n exp_month: number | null,\n exp_year: number | null,\n } | null,\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/billing/${customerType}/${customerId}`,\n {},\n session,\n );\n return await response.json();\n }\n\n override async createCustomerPaymentMethodSetupIntent(\n customerType: \"user\" | \"team\",\n customerId: string,\n session: InternalSession | null,\n ): Promise<{\n client_secret: string,\n stripe_account_id: string,\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/payment-method/${customerType}/${customerId}/setup-intent`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n session,\n );\n return await response.json();\n }\n\n override async setDefaultCustomerPaymentMethodFromSetupIntent(\n customerType: \"user\" | \"team\",\n customerId: string,\n setupIntentId: string,\n session: InternalSession | null,\n ): Promise<{\n default_payment_method: {\n id: string,\n brand: string | null,\n last4: string | null,\n exp_month: number | null,\n exp_year: number | null,\n },\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/payment-method/${customerType}/${customerId}/set-default`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n setup_intent_id: setupIntentId,\n }),\n },\n session,\n );\n return await response.json();\n }\n\n\n protected async sendServerRequestAndCatchKnownError<E extends typeof KnownErrors[keyof KnownErrors]>(\n path: string,\n requestOptions: RequestInit,\n tokenStoreOrNull: InternalSession | null,\n errorsToCatch: readonly E[],\n ): Promise<Result<\n Response & {\n usedTokens: {\n accessToken: AccessToken,\n refreshToken: RefreshToken | null,\n } | null,\n },\n InstanceType<E>\n >> {\n try {\n return Result.ok(await this.sendServerRequest(path, requestOptions, tokenStoreOrNull));\n } catch (e) {\n for (const errorType of errorsToCatch) {\n if (errorType.isInstance(e)) {\n return Result.error(e as InstanceType<E>);\n }\n }\n throw e;\n }\n }\n\n async createServerUser(data: UsersCrud['Server']['Create']): Promise<UsersCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/users\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async getServerUserByToken(session: InternalSession): Promise<CurrentUserCrud['Server']['Read'] | null> {\n const responseOrError = await this.sendServerRequestAndCatchKnownError(\n \"/users/me\",\n {},\n session,\n [KnownErrors.CannotGetOwnUserWithoutUser],\n );\n if (responseOrError.status === \"error\") {\n if (KnownErrors.CannotGetOwnUserWithoutUser.isInstance(responseOrError.error)) {\n return null;\n } else {\n throw new HexclaveAssertionError(\"Unexpected uncaught error\", { cause: responseOrError.error });\n }\n }\n const response = responseOrError.data;\n const user: CurrentUserCrud['Server']['Read'] = await response.json();\n if (!(user as any)) throw new HexclaveAssertionError(\"User endpoint returned null; this should never happen\");\n return user;\n }\n\n async getServerUserById(userId: string): Promise<Result<UsersCrud['Server']['Read']>> {\n const responseOrError = await this.sendServerRequestAndCatchKnownError(\n urlString`/users/${userId}`,\n {},\n null,\n [KnownErrors.UserNotFound],\n );\n if (responseOrError.status === \"error\") {\n return Result.error(responseOrError.error);\n }\n const user: UsersCrud['Server']['Read'] = await responseOrError.data.json();\n return Result.ok(user);\n }\n\n async listServerTeamInvitations(options: {\n teamId: string,\n }): Promise<TeamInvitationCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/team-invitations?team_id=${options.teamId}`,\n {},\n null,\n );\n const result = await response.json() as TeamInvitationCrud['Server']['List'];\n return result.items;\n }\n\n async revokeServerTeamInvitation(invitationId: string, teamId: string) {\n await this.sendServerRequest(\n urlString`/team-invitations/${invitationId}?team_id=${teamId}`,\n { method: \"DELETE\" },\n null,\n );\n }\n\n async listServerTeamMemberProfiles(\n options: {\n teamId: string,\n },\n ): Promise<TeamMemberProfilesCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/team-member-profiles?team_id=${options.teamId}`,\n {},\n null,\n );\n const result = await response.json() as TeamMemberProfilesCrud['Server']['List'];\n return result.items;\n }\n\n async getServerTeamMemberProfile(\n options: {\n teamId: string,\n userId: string,\n },\n ): Promise<TeamMemberProfilesCrud['Client']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/team-member-profiles/${options.teamId}/${options.userId}`,\n {},\n null,\n );\n return await response.json();\n }\n\n async listServerTeamPermissions(\n options: {\n userId?: string,\n teamId?: string,\n recursive: boolean,\n },\n session: InternalSession | null,\n ): Promise<TeamPermissionsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n `/team-permissions?${new URLSearchParams(filterUndefined({\n user_id: options.userId,\n team_id: options.teamId,\n recursive: options.recursive.toString(),\n }))}`,\n {},\n session,\n );\n const result = await response.json() as TeamPermissionsCrud['Server']['List'];\n return result.items;\n }\n\n async listServerProjectPermissions(\n options: {\n userId?: string,\n recursive: boolean,\n },\n session: InternalSession | null,\n ): Promise<ProjectPermissionsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n `/project-permissions?${new URLSearchParams(filterUndefined({\n user_id: options.userId,\n recursive: options.recursive.toString(),\n }))}`,\n {},\n session,\n );\n const result = await response.json() as ProjectPermissionsCrud['Server']['List'];\n return result.items;\n }\n\n async listServerUsers(options: (\n & {\n cursor?: string,\n limit?: number,\n orderBy?: 'signedUpAt' | 'lastActiveAt',\n desc?: boolean,\n query?: string,\n excludedEmailDomains?: string[],\n includeRestricted?: boolean,\n teamId?: string,\n }\n & (\n {\n includeAnonymous?: boolean,\n onlyAnonymous?: false,\n }\n | {\n includeAnonymous: true,\n onlyAnonymous: true,\n }\n )\n )): Promise<UsersCrud['Server']['List']> {\n const searchParams = new URLSearchParams(filterUndefined({\n cursor: options.cursor,\n limit: options.limit?.toString(),\n desc: options.desc?.toString(),\n team_id: options.teamId,\n ...options.orderBy ? {\n order_by: {\n signedUpAt: \"signed_up_at\",\n lastActiveAt: \"last_active_at\",\n }[options.orderBy],\n } : {},\n ...options.query ? {\n query: options.query,\n } : {},\n ...options.excludedEmailDomains && options.excludedEmailDomains.length > 0 ? {\n excluded_email_domains: options.excludedEmailDomains.join(\",\"), // backend expects comma-separated list of domains.\n } : {},\n ...options.includeRestricted ? {\n include_restricted: 'true',\n } : {},\n ...options.includeAnonymous ? {\n include_anonymous: 'true',\n } : {},\n ...options.onlyAnonymous ? {\n only_anonymous: 'true',\n } : {},\n }));\n const response = await this.sendServerRequest(\"/users?\" + searchParams.toString(), {}, null);\n return await response.json();\n }\n\n async listServerTeams(options?: {\n userId?: string,\n }): Promise<TeamsCrud['Server']['Read'][]> {\n const result = await this.listServerTeamsPaginated(options);\n return result.items;\n }\n\n async listServerTeamsPaginated(options?: {\n userId?: string,\n orderBy?: 'createdAt',\n desc?: boolean,\n cursor?: string,\n limit?: number,\n query?: string,\n }): Promise<TeamsCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n `/teams?${new URLSearchParams(filterUndefined({\n user_id: options?.userId,\n // SDK option uses camelCase `createdAt`; backend uses snake_case.\n order_by: options?.orderBy === 'createdAt' ? 'created_at' : options?.orderBy,\n desc: options?.desc !== undefined ? String(options.desc) : undefined,\n cursor: options?.cursor,\n limit: options?.limit?.toString(),\n query: options?.query,\n }))}`,\n {},\n null\n );\n return await response.json() as TeamsCrud['Server']['List'];\n }\n\n async getServerTeam(teamId: string): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n `/teams/${teamId}`,\n {},\n null\n );\n return await response.json();\n }\n\n async listServerTeamUsers(teamId: string): Promise<UsersCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(`/users?team_id=${teamId}`, {}, null);\n const result = await response.json() as UsersCrud['Server']['List'];\n return result.items;\n }\n\n /* when passing a session, the user will be added to the team */\n async createServerTeam(data: TeamsCrud['Server']['Create']): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/teams\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null\n );\n return await response.json();\n }\n\n async updateServerTeam(teamId: string, data: TeamsCrud['Server']['Update']): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/teams/${teamId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerTeam(teamId: string): Promise<void> {\n await this.sendServerRequest(\n urlString`/teams/${teamId}`,\n { method: \"DELETE\" },\n null,\n );\n }\n\n async addServerUserToTeam(options: {\n userId: string,\n teamId: string,\n }): Promise<TeamMembershipsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n return await response.json();\n }\n\n async removeServerUserFromTeam(options: {\n userId: string,\n teamId: string,\n }) {\n await this.sendServerRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async listServerUserTeamInvitations(userId: string): Promise<TeamInvitationCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n \"/team-invitations?\" + new URLSearchParams({ user_id: userId }),\n {},\n null,\n );\n const result = await response.json() as TeamInvitationCrud['Server']['List'];\n return result.items;\n }\n\n async acceptServerTeamInvitationById(\n invitationId: string,\n userId: string,\n ) {\n await this.sendServerRequest(\n urlString`/team-invitations/${invitationId}/accept` + \"?\" + new URLSearchParams({ user_id: userId }),\n { method: \"POST\" },\n null,\n );\n }\n\n async updateServerUser(userId: string, update: UsersCrud['Server']['Update']): Promise<UsersCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/users/${userId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(update),\n },\n null,\n );\n return await response.json();\n }\n\n async createServerProviderAccessToken(\n userId: string,\n provider: string,\n scope: string,\n ): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}/${provider}/access-token`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ scope }),\n },\n null,\n );\n return await response.json();\n }\n\n /**\n * Get access token for a specific connected account by provider ID and provider account ID.\n * This is the preferred method when dealing with multiple accounts of the same provider.\n */\n async createServerProviderAccessTokenByAccount(\n userId: string,\n providerId: string,\n providerAccountId: string,\n scope: string,\n ): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}/${providerId}/${providerAccountId}/access-token`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ scope }),\n },\n null,\n );\n return await response.json();\n }\n\n /**\n * List all connected accounts for a user.\n */\n async listServerConnectedAccounts(\n userId: string,\n ): Promise<ConnectedAccountCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}`,\n { method: \"GET\" },\n null,\n );\n return await response.json();\n }\n\n async createServerUserSession(userId: string, expiresInMillis: number, isImpersonation: boolean): Promise<{ accessToken: string, refreshToken: string }> {\n const response = await this.sendServerRequest(\n \"/auth/sessions\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n user_id: userId,\n expires_in_millis: expiresInMillis,\n is_impersonation: isImpersonation,\n }),\n },\n null,\n );\n const result = await response.json();\n return {\n accessToken: result.access_token,\n refreshToken: result.refresh_token,\n };\n }\n\n async leaveServerTeam(\n options: {\n teamId: string,\n userId: string,\n },\n ) {\n await this.sendClientRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async updateServerTeamMemberProfile(options: {\n teamId: string,\n userId: string,\n profile: TeamMemberProfilesCrud['Server']['Update'],\n }) {\n await this.sendServerRequest(\n urlString`/team-member-profiles/${options.teamId}/${options.userId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(options.profile),\n },\n null,\n );\n }\n\n async grantServerTeamUserPermission(teamId: string, userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async grantServerProjectPermission(userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/project-permissions/${userId}/${permissionId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async revokeServerTeamUserPermission(teamId: string, userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async revokeServerProjectPermission(userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/project-permissions/${userId}/${permissionId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async deleteServerUser(userId: string) {\n await this.sendServerRequest(\n urlString`/users/${userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async createServerContactChannel(\n data: ContactChannelsCrud['Server']['Create'],\n ): Promise<ContactChannelsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/contact-channels\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async updateServerContactChannel(\n userId: string,\n contactChannelId: string,\n data: ContactChannelsCrud['Server']['Update'],\n ): Promise<ContactChannelsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerContactChannel(\n userId: string,\n contactChannelId: string,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n }\n\n async listServerContactChannels(\n userId: string,\n ): Promise<ContactChannelsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/contact-channels?user_id=${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n const json = await response.json() as ContactChannelsCrud['Server']['List'];\n return json.items;\n }\n\n async listServerNotificationCategories(\n userId: string,\n ): Promise<NotificationPreferenceCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/emails/notification-preference/${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n const json = await response.json() as NotificationPreferenceCrud['Server']['List'];\n return json.items;\n }\n\n async setServerNotificationsEnabled(\n userId: string,\n notificationCategoryId: string,\n enabled: boolean,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/emails/notification-preference/${userId}/${notificationCategoryId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n enabled,\n }),\n },\n null,\n );\n }\n\n async sendServerContactChannelVerificationEmail(\n userId: string,\n contactChannelId: string,\n callbackUrl: string,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}/send-verification-code`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ callback_url: callbackUrl }),\n },\n null,\n );\n }\n\n\n async listServerSessions(userId: string): Promise<SessionsCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n urlString`/auth/sessions?user_id=${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerSession(sessionId: string) {\n await this.sendServerRequest(\n urlString`/auth/sessions/${sessionId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n }\n\n\n async sendServerTeamInvitation(options: {\n email: string,\n teamId: string,\n callbackUrl: string,\n }): Promise<void> {\n await this.sendServerRequest(\n \"/team-invitations/send-code\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n email: options.email,\n team_id: options.teamId,\n callback_url: options.callbackUrl,\n }),\n },\n null,\n );\n }\n\n async updatePassword(\n options: { oldPassword: string, newPassword: string },\n ): Promise<KnownErrors[\"PasswordConfirmationMismatch\"] | KnownErrors[\"PasswordRequirementsNotMet\"] | undefined> {\n const res = await this.sendServerRequestAndCatchKnownError(\n \"/auth/password/update\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n old_password: options.oldPassword,\n new_password: options.newPassword,\n }),\n },\n null,\n [KnownErrors.PasswordConfirmationMismatch, KnownErrors.PasswordRequirementsNotMet]\n );\n\n if (res.status === \"error\") {\n return res.error;\n }\n }\n\n // OAuth Providers CRUD operations\n async createServerOAuthProvider(\n data: OAuthProviderCrud['Server']['Create'],\n ): Promise<OAuthProviderCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/oauth-providers\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n\n async listServerOAuthProviders(\n options: {\n user_id?: string,\n } = {},\n ): Promise<OAuthProviderCrud['Server']['Read'][]> {\n const queryParams = new URLSearchParams(filterUndefined(options));\n const response = await this.sendServerRequest(\n `/oauth-providers${queryParams.toString() ? `?${queryParams.toString()}` : ''}`,\n {\n method: \"GET\",\n },\n null,\n );\n const result = await response.json();\n return result.items;\n }\n\n async updateServerOAuthProvider(\n userId: string,\n providerId: string,\n data: OAuthProviderCrud['Server']['Update'],\n ): Promise<OAuthProviderCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/oauth-providers/${userId}/${providerId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerOAuthProvider(\n userId: string,\n providerId: string,\n ): Promise<void> {\n const response = await this.sendServerRequest(\n urlString`/oauth-providers/${userId}/${providerId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n return await response.json();\n }\n\n async sendEmail(options: {\n userIds?: string[],\n allUsers?: true,\n emails?: string[],\n themeId?: string | null | false,\n html?: string,\n subject?: string,\n notificationCategoryName?: string,\n templateId?: string,\n variables?: Record<string, any>,\n draftId?: string,\n scheduledAt?: Date,\n }): Promise<Result<void, KnownErrors[\"RequiresCustomEmailServer\"] | KnownErrors[\"SchemaError\"] | KnownErrors[\"UserIdDoesNotExist\"]>> {\n const res = await this.sendServerRequest(\n \"/emails/send-email\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n user_ids: options.userIds,\n all_users: options.allUsers,\n emails: options.emails,\n theme_id: options.themeId,\n html: options.html,\n subject: options.subject,\n notification_category_name: options.notificationCategoryName,\n template_id: options.templateId,\n variables: options.variables,\n draft_id: options.draftId,\n scheduled_at_millis: options.scheduledAt?.getTime(),\n }),\n },\n null,\n );\n return Result.ok(undefined);\n }\n\n async getEmailDeliveryInfo(): Promise<{\n stats: {\n hour: { sent: number, bounced: number, marked_as_spam: number },\n day: { sent: number, bounced: number, marked_as_spam: number },\n week: { sent: number, bounced: number, marked_as_spam: number },\n month: { sent: number, bounced: number, marked_as_spam: number },\n },\n capacity: {\n rate_per_second: number,\n boost_multiplier: number,\n penalty_factor: number,\n is_boost_active: boolean,\n boost_expires_at: string | null,\n },\n }> {\n const res = await this.sendServerRequest(\n \"/emails/delivery-info\",\n {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n },\n null,\n );\n return await res.json();\n }\n\n async activateEmailCapacityBoost(): Promise<{ expires_at: string }> {\n const res = await this.sendServerRequest(\n \"/emails/capacity-boost\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({}),\n },\n null,\n );\n return await res.json();\n }\n\n async updateItemQuantity(\n options: (\n { itemId: string, userId: string } |\n { itemId: string, teamId: string } |\n { itemId: string, customCustomerId: string }\n ),\n data: ItemCrud['Server']['Update'],\n ): Promise<void> {\n let customerType: \"user\" | \"team\" | \"custom\";\n let customerId: string;\n const itemId: string = options.itemId;\n\n if (\"userId\" in options) {\n customerType = \"user\";\n customerId = options.userId;\n } else if (\"teamId\" in options) {\n customerType = \"team\";\n customerId = options.teamId;\n } else if (\"customCustomerId\" in options) {\n customerType = \"custom\";\n customerId = options.customCustomerId;\n } else {\n throw new HexclaveAssertionError(\"updateItemQuantity requires one of userId, teamId, or customCustomerId\");\n }\n\n const queryParams = new URLSearchParams({ allow_negative: (data.allow_negative ?? false).toString() });\n await this.sendServerRequest(\n `/payments/items/${customerType}/${customerId}/${itemId}/update-quantity?${queryParams.toString()}`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ delta: data.delta, expires_at: data.expires_at, description: data.description }),\n },\n null\n );\n }\n\n async grantProduct(\n options: {\n customerType: \"user\" | \"team\" | \"custom\",\n customerId: string,\n productId?: string,\n product?: yup.InferType<typeof inlineProductSchema>,\n quantity?: number,\n },\n ): Promise<void> {\n if (!options.productId && !options.product) {\n throw new HexclaveAssertionError(\"grantProduct requires either productId or product\");\n }\n if (options.productId && options.product) {\n throw new HexclaveAssertionError(\"grantProduct should not receive both productId and product\");\n }\n const body = filterUndefined({\n product_id: options.productId,\n product_inline: options.product,\n quantity: options.quantity,\n });\n await this.sendServerRequest(\n urlString`/payments/products/${options.customerType}/${options.customerId}`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(body),\n },\n null,\n );\n }\n\n async getDataVaultStoreValue(secret: string, storeId: string, key: string) {\n const hashedKey = await hashKey(secret, key);\n const response = await this.sendServerRequestAndCatchKnownError(\n `/data-vault/stores/${storeId}/get`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ hashed_key: hashedKey }),\n },\n null,\n [KnownErrors.DataVaultStoreHashedKeyDoesNotExist] as const,\n );\n if (response.status === \"error\") {\n if (KnownErrors.DataVaultStoreHashedKeyDoesNotExist.isInstance(response.error)) {\n return null;\n } else {\n throw new HexclaveAssertionError(\"Unexpected uncaught error\", { cause: response.error });\n }\n }\n const json = await response.data.json();\n const encryptedValue = json.encrypted_value;\n if (typeof encryptedValue !== \"string\") throw new HexclaveAssertionError(\"encrypted_value is not a string\", { type: typeof encryptedValue });\n return await decryptValue(secret, key, encryptedValue);\n }\n\n async setDataVaultStoreValue(secret: string, storeId: string, key: string, value: string) {\n const hashedKey = await hashKey(secret, key);\n const encryptedValue = await encryptValue(secret, key, value);\n await this.sendServerRequest(\n `/data-vault/stores/${storeId}/set`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ hashed_key: hashedKey, encrypted_value: encryptedValue }),\n },\n null,\n );\n }\n\n async initiateServerPasskeyRegistration(userId: string): Promise<Result<{ options_json: any, code: string }, KnownErrors[]>> {\n // Create a temporary session for this user to use for passkey registration\n // TODO instead of creating a new session, this should just call the endpoint in a way in which it doesn't require a session\n // (currently this shows up on session history etc... not ideal)\n const { accessToken, refreshToken } = await this.createServerUserSession(userId, 60000 * 2, false); // 2 minute session\n const tempSession = new InternalSession({\n accessToken,\n refreshToken,\n refreshAccessTokenCallback: async () => null, // No refresh for temporary sessions\n });\n\n // Use the existing initiatePasskeyRegistration method with the temporary session\n return await this.initiatePasskeyRegistration({}, tempSession);\n }\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAa,0BAAb,cAA6C,wBAAwB;CACnE,YAAY,AAAgB,SAAuC;AACjE,QAAM,QAAQ;EADY;;CAI5B,MAAgB,kBAAkB,MAAc,SAAsB,SAAiC,cAAkC,UAAU;AACjJ,SAAO,MAAM,KAAK,kBAChB,MACA;GACE,GAAG;GACH,SAAS;IAEP,gCAAgC,qBAAqB,KAAK,UAAU,KAAK,QAAQ,kBAAkB;IACnG,GAAG,QAAQ;IACZ;GACF,EACD,SACA,YACD;;CAGH,MAAe,mBACb,cACA,YACA,SAUC;AAMD,SAAO,OALU,MAAM,KAAK,kBAC1B,SAAS,qBAAqB,aAAa,GAAG,cAC9C,EAAE,EACF,QACD,EACqB,MAAM;;CAG9B,MAAe,uCACb,cACA,YACA,SAIC;AAYD,SAAO,OAXU,MAAM,KAAK,kBAC1B,SAAS,4BAA4B,aAAa,GAAG,WAAW,gBAChE;GACE,QAAQ;GACR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AAM,IAAI,uBAAuB,mCAAmC,EAAE,MAAM,OAAO,gBAAgB,CAAC;AAC5I,SAAO,MAAM,aAAa,QAAQ,KAAK,eAAe;;CAGxD,MAAM,uBAAuB,QAAgB,SAAiB,KAAa,OAAe;EACxF,MAAM,YAAY,MAAM,QAAQ,QAAQ,IAAI;EAC5C,MAAM,iBAAiB,MAAM,aAAa,QAAQ,KAAK,MAAM;AAC7D,QAAM,KAAK,kBACT,sBAAsB,QAAQ,OAC9B;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAC/C,MAAM,KAAK,UAAU;IAAE,YAAY;IAAW,iBAAiB;IAAgB,CAAC;GACjF,EACD,KACD;;CAGH,MAAM,kCAAkC,QAAqF;EAI3H,MAAM,EAAE,aAAa,iBAAiB,MAAM,KAAK,wBAAwB,QAAQ,MAAQ,GAAG,MAAM;EAClG,MAAM,cAAc,IAAI,gBAAgB;GACtC;GACA;GACA,4BAA4B,YAAY;GACzC,CAAC;AAGF,SAAO,MAAM,KAAK,4BAA4B,EAAE,EAAE,YAAY"}
|
|
@@ -22,8 +22,8 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
22
22
|
server_metadata?: {} | null | undefined;
|
|
23
23
|
display_name: string;
|
|
24
24
|
id: string;
|
|
25
|
-
profile_image_url: string | null;
|
|
26
25
|
created_at_millis: number;
|
|
26
|
+
profile_image_url: string | null;
|
|
27
27
|
} | null;
|
|
28
28
|
selected_team_id: string | null;
|
|
29
29
|
profile_image_url: string | null;
|
|
@@ -112,8 +112,8 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
112
112
|
server_metadata?: {} | null | undefined;
|
|
113
113
|
display_name: string;
|
|
114
114
|
id: string;
|
|
115
|
-
profile_image_url: string | null;
|
|
116
115
|
created_at_millis: number;
|
|
116
|
+
profile_image_url: string | null;
|
|
117
117
|
} | null;
|
|
118
118
|
selected_team_id: string | null;
|
|
119
119
|
profile_image_url: string | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
3
|
-
let ___utils_errors_js = require("../utils/errors.js");
|
|
4
3
|
let react = require("react");
|
|
5
4
|
react = require_chunk.__toESM(react);
|
|
5
|
+
let ___utils_errors_js = require("../utils/errors.js");
|
|
6
6
|
|
|
7
7
|
//#region src/hooks/use-async-callback.tsx
|
|
8
8
|
function useAsyncCallback(callback, deps) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
3
|
-
let ___utils_results_js = require("../utils/results.js");
|
|
4
3
|
let react = require("react");
|
|
4
|
+
let ___utils_results_js = require("../utils/results.js");
|
|
5
5
|
|
|
6
6
|
//#region src/hooks/use-async-external-store.tsx
|
|
7
7
|
function useAsyncExternalStore(subscribe) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
3
|
-
let ___utils_results_js = require("../utils/results.js");
|
|
4
3
|
let react = require("react");
|
|
4
|
+
let ___utils_results_js = require("../utils/results.js");
|
|
5
5
|
|
|
6
6
|
//#region src/hooks/use-strict-memo.tsx
|
|
7
7
|
const cached = /* @__PURE__ */ new Map();
|
|
@@ -151,16 +151,16 @@ declare const MetricsEmailOverviewSchema: yup.ObjectSchema<{
|
|
|
151
151
|
}[];
|
|
152
152
|
daily_emails_by_status: {
|
|
153
153
|
error: number;
|
|
154
|
-
date: string;
|
|
155
154
|
ok: number;
|
|
155
|
+
date: string;
|
|
156
156
|
in_progress: number;
|
|
157
157
|
}[];
|
|
158
158
|
emails_sent: number;
|
|
159
159
|
recent_emails: {
|
|
160
160
|
status: string;
|
|
161
161
|
id: string;
|
|
162
|
-
created_at_millis: number;
|
|
163
162
|
subject: string;
|
|
163
|
+
created_at_millis: number;
|
|
164
164
|
}[];
|
|
165
165
|
deliverability_status: {
|
|
166
166
|
error: number;
|
|
@@ -564,16 +564,16 @@ declare const MetricsResponseBodySchema: yup.ObjectSchema<{
|
|
|
564
564
|
total_emails: number;
|
|
565
565
|
daily_emails_by_status: {
|
|
566
566
|
error: number;
|
|
567
|
-
date: string;
|
|
568
567
|
ok: number;
|
|
568
|
+
date: string;
|
|
569
569
|
in_progress: number;
|
|
570
570
|
}[];
|
|
571
571
|
emails_sent: number;
|
|
572
572
|
recent_emails: {
|
|
573
573
|
status: string;
|
|
574
574
|
id: string;
|
|
575
|
-
created_at_millis: number;
|
|
576
575
|
subject: string;
|
|
576
|
+
created_at_millis: number;
|
|
577
577
|
}[];
|
|
578
578
|
deliverability_status: {
|
|
579
579
|
error: number;
|
|
@@ -174,8 +174,18 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
|
|
|
174
174
|
closedAt?: string | null | undefined;
|
|
175
175
|
recordMetadata?: {} | null | undefined;
|
|
176
176
|
status: "pending" | "open" | "closed";
|
|
177
|
+
subject: string;
|
|
177
178
|
priority: "low" | "normal" | "high" | "urgent";
|
|
179
|
+
conversationId: string;
|
|
180
|
+
userId: string | null;
|
|
181
|
+
teamId: string | null;
|
|
182
|
+
userDisplayName: string | null;
|
|
183
|
+
userPrimaryEmail: string | null;
|
|
184
|
+
userProfileImageUrl: string | null;
|
|
178
185
|
source: "email" | "manual" | "chat" | "api";
|
|
186
|
+
lastMessageType: "message" | "internal-note" | "status-change";
|
|
187
|
+
preview: string | null;
|
|
188
|
+
lastActivityAt: string;
|
|
179
189
|
metadata: {
|
|
180
190
|
tags: string[];
|
|
181
191
|
assignedToUserId: string | null;
|
|
@@ -186,16 +196,6 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
|
|
|
186
196
|
lastCustomerReplyAt: string | null;
|
|
187
197
|
lastAgentReplyAt: string | null;
|
|
188
198
|
};
|
|
189
|
-
subject: string;
|
|
190
|
-
conversationId: string;
|
|
191
|
-
userId: string | null;
|
|
192
|
-
teamId: string | null;
|
|
193
|
-
userDisplayName: string | null;
|
|
194
|
-
userPrimaryEmail: string | null;
|
|
195
|
-
userProfileImageUrl: string | null;
|
|
196
|
-
lastMessageType: "message" | "internal-note" | "status-change";
|
|
197
|
-
preview: string | null;
|
|
198
|
-
lastActivityAt: string;
|
|
199
199
|
}[];
|
|
200
200
|
hasMore: boolean;
|
|
201
201
|
}, yup$1.AnyObject, {
|
|
@@ -212,8 +212,18 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
212
212
|
closedAt?: string | null | undefined;
|
|
213
213
|
recordMetadata?: {} | null | undefined;
|
|
214
214
|
status: "pending" | "open" | "closed";
|
|
215
|
+
subject: string;
|
|
215
216
|
priority: "low" | "normal" | "high" | "urgent";
|
|
217
|
+
conversationId: string;
|
|
218
|
+
userId: string | null;
|
|
219
|
+
teamId: string | null;
|
|
220
|
+
userDisplayName: string | null;
|
|
221
|
+
userPrimaryEmail: string | null;
|
|
222
|
+
userProfileImageUrl: string | null;
|
|
216
223
|
source: "email" | "manual" | "chat" | "api";
|
|
224
|
+
lastMessageType: "message" | "internal-note" | "status-change";
|
|
225
|
+
preview: string | null;
|
|
226
|
+
lastActivityAt: string;
|
|
217
227
|
metadata: {
|
|
218
228
|
tags: string[];
|
|
219
229
|
assignedToUserId: string | null;
|
|
@@ -224,30 +234,20 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
224
234
|
lastCustomerReplyAt: string | null;
|
|
225
235
|
lastAgentReplyAt: string | null;
|
|
226
236
|
};
|
|
227
|
-
subject: string;
|
|
228
|
-
conversationId: string;
|
|
229
|
-
userId: string | null;
|
|
230
|
-
teamId: string | null;
|
|
231
|
-
userDisplayName: string | null;
|
|
232
|
-
userPrimaryEmail: string | null;
|
|
233
|
-
userProfileImageUrl: string | null;
|
|
234
|
-
lastMessageType: "message" | "internal-note" | "status-change";
|
|
235
|
-
preview: string | null;
|
|
236
|
-
lastActivityAt: string;
|
|
237
237
|
};
|
|
238
238
|
messages: {
|
|
239
239
|
status: "pending" | "open" | "closed";
|
|
240
240
|
id: string;
|
|
241
|
-
priority: "low" | "normal" | "high" | "urgent";
|
|
242
|
-
body: string | null;
|
|
243
|
-
source: "email" | "manual" | "chat" | "api";
|
|
244
|
-
metadata: {} | null;
|
|
245
241
|
subject: string;
|
|
242
|
+
priority: "low" | "normal" | "high" | "urgent";
|
|
246
243
|
conversationId: string;
|
|
247
244
|
userId: string | null;
|
|
248
245
|
teamId: string | null;
|
|
246
|
+
source: "email" | "manual" | "chat" | "api";
|
|
247
|
+
metadata: {} | null;
|
|
249
248
|
createdAt: string;
|
|
250
249
|
messageType: "message" | "internal-note" | "status-change";
|
|
250
|
+
body: string | null;
|
|
251
251
|
attachments: {}[];
|
|
252
252
|
sender: {
|
|
253
253
|
type: "user" | "agent" | "system";
|
|
@@ -16,9 +16,9 @@ declare const currentUserCrud: CrudSchemaFromOptions<{
|
|
|
16
16
|
is_anonymous: boolean;
|
|
17
17
|
is_restricted: boolean;
|
|
18
18
|
requires_totp_mfa: boolean;
|
|
19
|
-
primary_email_verified: boolean;
|
|
20
19
|
profile_image_url: string | null;
|
|
21
20
|
signed_up_at_millis: number;
|
|
21
|
+
primary_email_verified: boolean;
|
|
22
22
|
has_password: boolean;
|
|
23
23
|
otp_auth_enabled: boolean;
|
|
24
24
|
passkey_auth_enabled: boolean;
|
|
@@ -92,8 +92,8 @@ declare const currentUserCrud: CrudSchemaFromOptions<{
|
|
|
92
92
|
server_metadata?: {} | null | undefined;
|
|
93
93
|
display_name: string;
|
|
94
94
|
id: string;
|
|
95
|
-
profile_image_url: string | null;
|
|
96
95
|
created_at_millis: number;
|
|
96
|
+
profile_image_url: string | null;
|
|
97
97
|
} | null;
|
|
98
98
|
selected_team_id: string | null;
|
|
99
99
|
profile_image_url: string | null;
|