@hexclave/shared 1.0.30 → 1.0.33
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/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +11 -37
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
- package/dist/config/schema.d.ts +90 -90
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +11 -37
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
- package/dist/esm/config/schema.d.ts +90 -90
- package/dist/esm/helpers/init-prompt.js +1 -1
- package/dist/esm/helpers/init-prompt.js.map +1 -1
- package/dist/esm/interface/admin-metrics.d.ts +26 -26
- package/dist/esm/interface/conversations.d.ts +16 -16
- package/dist/esm/interface/crud/current-user.d.ts +11 -11
- package/dist/esm/interface/crud/email-outbox.d.ts +248 -248
- package/dist/esm/interface/crud/invoices.d.ts +2 -2
- package/dist/esm/interface/crud/products.d.ts +13 -13
- package/dist/esm/interface/crud/project-api-keys.d.ts +6 -6
- package/dist/esm/interface/crud/projects.d.ts +7 -7
- package/dist/esm/interface/crud/team-member-profiles.d.ts +20 -20
- package/dist/esm/interface/crud/transactions.d.ts +6 -6
- package/dist/esm/interface/crud/users.d.ts +14 -14
- package/dist/esm/interface/plan-usage.d.ts +1 -1
- 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/esm/schema-fields.d.ts +12 -12
- package/dist/esm/sessions.d.ts +8 -8
- package/dist/helpers/init-prompt.js +1 -1
- package/dist/helpers/init-prompt.js.map +1 -1
- package/dist/interface/admin-metrics.d.ts +26 -26
- package/dist/interface/conversations.d.ts +16 -16
- package/dist/interface/crud/current-user.d.ts +11 -11
- package/dist/interface/crud/email-outbox.d.ts +248 -248
- package/dist/interface/crud/invoices.d.ts +2 -2
- package/dist/interface/crud/products.d.ts +13 -13
- package/dist/interface/crud/project-api-keys.d.ts +6 -6
- package/dist/interface/crud/projects.d.ts +7 -7
- package/dist/interface/crud/team-member-profiles.d.ts +20 -20
- package/dist/interface/crud/transactions.d.ts +6 -6
- package/dist/interface/crud/users.d.ts +14 -14
- package/dist/interface/plan-usage.d.ts +1 -1
- 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/dist/schema-fields.d.ts +12 -12
- package/dist/sessions.d.ts +8 -8
- package/package.json +1 -1
- package/src/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.ts +11 -37
- package/src/helpers/init-prompt.ts +1 -1
- package/src/interface/server-interface.ts +4 -0
|
@@ -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 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.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,uC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mC,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"}
|
|
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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,SAAS,OAAO,CAAC;EAI5F,MAAM,kBADO,MAAM,SAAS,KAAK,MAAM,EACX;AAC5B,MAAI,OAAO,mBAAmB,SAAU,OAAM,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"}
|
|
@@ -20,9 +20,9 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
20
20
|
client_metadata?: {} | null | undefined;
|
|
21
21
|
client_read_only_metadata?: {} | null | undefined;
|
|
22
22
|
server_metadata?: {} | null | undefined;
|
|
23
|
-
display_name: string;
|
|
24
23
|
id: string;
|
|
25
24
|
created_at_millis: number;
|
|
25
|
+
display_name: string;
|
|
26
26
|
profile_image_url: string | null;
|
|
27
27
|
} | null;
|
|
28
28
|
selected_team_id: string | null;
|
|
@@ -110,9 +110,9 @@ declare const webhookEvents: readonly [WebhookEvent<yup$1.ObjectSchema<{
|
|
|
110
110
|
client_metadata?: {} | null | undefined;
|
|
111
111
|
client_read_only_metadata?: {} | null | undefined;
|
|
112
112
|
server_metadata?: {} | null | undefined;
|
|
113
|
-
display_name: string;
|
|
114
113
|
id: string;
|
|
115
114
|
created_at_millis: number;
|
|
115
|
+
display_name: string;
|
|
116
116
|
profile_image_url: string | null;
|
|
117
117
|
} | null;
|
|
118
118
|
selected_team_id: string | null;
|
|
@@ -203,6 +203,9 @@ declare const productPriceSchema: yup$1.ObjectSchema<{
|
|
|
203
203
|
CAD: undefined;
|
|
204
204
|
}, "">;
|
|
205
205
|
declare const pricesSchema: yup$1.MixedSchema<Record<string, {
|
|
206
|
+
interval?: DayInterval | undefined;
|
|
207
|
+
freeTrial?: DayInterval | undefined;
|
|
208
|
+
serverOnly?: boolean | undefined;
|
|
206
209
|
USD?: string | undefined;
|
|
207
210
|
EUR?: string | undefined;
|
|
208
211
|
GBP?: string | undefined;
|
|
@@ -210,9 +213,6 @@ declare const pricesSchema: yup$1.MixedSchema<Record<string, {
|
|
|
210
213
|
INR?: string | undefined;
|
|
211
214
|
AUD?: string | undefined;
|
|
212
215
|
CAD?: string | undefined;
|
|
213
|
-
interval?: DayInterval | undefined;
|
|
214
|
-
serverOnly?: boolean | undefined;
|
|
215
|
-
freeTrial?: DayInterval | undefined;
|
|
216
216
|
}>, yup$1.AnyObject, undefined, "">;
|
|
217
217
|
declare const productSchema: yup$1.ObjectSchema<{
|
|
218
218
|
displayName: string | undefined;
|
|
@@ -223,6 +223,9 @@ declare const productSchema: yup$1.ObjectSchema<{
|
|
|
223
223
|
serverOnly: boolean | undefined;
|
|
224
224
|
stackable: boolean | undefined;
|
|
225
225
|
prices: Record<string, {
|
|
226
|
+
interval?: DayInterval | undefined;
|
|
227
|
+
freeTrial?: DayInterval | undefined;
|
|
228
|
+
serverOnly?: boolean | undefined;
|
|
226
229
|
USD?: string | undefined;
|
|
227
230
|
EUR?: string | undefined;
|
|
228
231
|
GBP?: string | undefined;
|
|
@@ -230,9 +233,6 @@ declare const productSchema: yup$1.ObjectSchema<{
|
|
|
230
233
|
INR?: string | undefined;
|
|
231
234
|
AUD?: string | undefined;
|
|
232
235
|
CAD?: string | undefined;
|
|
233
|
-
interval?: DayInterval | undefined;
|
|
234
|
-
serverOnly?: boolean | undefined;
|
|
235
|
-
freeTrial?: DayInterval | undefined;
|
|
236
236
|
}>;
|
|
237
237
|
includedItems: Record<string, {
|
|
238
238
|
repeat?: "never" | DayInterval | undefined;
|
|
@@ -262,6 +262,9 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
|
|
|
262
262
|
serverOnly: boolean | undefined;
|
|
263
263
|
stackable: boolean | undefined;
|
|
264
264
|
prices: Record<string, {
|
|
265
|
+
interval?: DayInterval | undefined;
|
|
266
|
+
freeTrial?: DayInterval | undefined;
|
|
267
|
+
serverOnly?: boolean | undefined;
|
|
265
268
|
USD?: string | undefined;
|
|
266
269
|
EUR?: string | undefined;
|
|
267
270
|
GBP?: string | undefined;
|
|
@@ -269,9 +272,6 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
|
|
|
269
272
|
INR?: string | undefined;
|
|
270
273
|
AUD?: string | undefined;
|
|
271
274
|
CAD?: string | undefined;
|
|
272
|
-
interval?: DayInterval | undefined;
|
|
273
|
-
serverOnly?: boolean | undefined;
|
|
274
|
-
freeTrial?: DayInterval | undefined;
|
|
275
275
|
}>;
|
|
276
276
|
includedItems: Record<string, {
|
|
277
277
|
repeat?: "never" | DayInterval | undefined;
|
|
@@ -303,6 +303,7 @@ declare const inlineProductSchema: yup$1.ObjectSchema<{
|
|
|
303
303
|
server_only: boolean;
|
|
304
304
|
stackable: boolean;
|
|
305
305
|
prices: Record<string, {
|
|
306
|
+
interval?: DayInterval | undefined;
|
|
306
307
|
USD?: string | undefined;
|
|
307
308
|
EUR?: string | undefined;
|
|
308
309
|
GBP?: string | undefined;
|
|
@@ -310,12 +311,11 @@ declare const inlineProductSchema: yup$1.ObjectSchema<{
|
|
|
310
311
|
INR?: string | undefined;
|
|
311
312
|
AUD?: string | undefined;
|
|
312
313
|
CAD?: string | undefined;
|
|
313
|
-
interval?: DayInterval | undefined;
|
|
314
314
|
free_trial?: DayInterval | undefined;
|
|
315
315
|
}>;
|
|
316
316
|
included_items: Record<string, {
|
|
317
|
-
repeat?: "never" | DayInterval | undefined;
|
|
318
317
|
quantity?: number | undefined;
|
|
318
|
+
repeat?: "never" | DayInterval | undefined;
|
|
319
319
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
320
320
|
}>;
|
|
321
321
|
client_metadata: {} | null | undefined;
|
|
@@ -470,9 +470,9 @@ declare function yupDefinedAndNonEmptyWhen<S extends yup$1.StringSchema>(schema:
|
|
|
470
470
|
declare const branchConfigSourceSchema: yup$1.MixedSchema<{
|
|
471
471
|
workflow_path?: string | undefined;
|
|
472
472
|
type: "pushed-from-github";
|
|
473
|
+
branch: string;
|
|
473
474
|
owner: string;
|
|
474
475
|
repo: string;
|
|
475
|
-
branch: string;
|
|
476
476
|
commit_hash: string;
|
|
477
477
|
config_file_path: string;
|
|
478
478
|
} | {
|
package/dist/esm/sessions.d.ts
CHANGED
|
@@ -9,24 +9,24 @@ declare class AccessToken {
|
|
|
9
9
|
private constructor();
|
|
10
10
|
get payload(): {
|
|
11
11
|
exp?: number | undefined;
|
|
12
|
+
name: string | null;
|
|
12
13
|
sub: string;
|
|
13
|
-
project_id: string;
|
|
14
|
-
refresh_token_id: string;
|
|
15
|
-
email: string | null;
|
|
16
|
-
restricted_reason: {
|
|
17
|
-
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
18
|
-
} | null;
|
|
19
|
-
branch_id: string;
|
|
20
14
|
iat: number;
|
|
21
15
|
iss: string;
|
|
22
16
|
aud: string;
|
|
17
|
+
project_id: string;
|
|
18
|
+
branch_id: string;
|
|
19
|
+
refresh_token_id: string;
|
|
23
20
|
role: "authenticated";
|
|
24
|
-
|
|
21
|
+
email: string | null;
|
|
25
22
|
email_verified: boolean;
|
|
26
23
|
selected_team_id: string | null;
|
|
27
24
|
signed_up_at: number;
|
|
28
25
|
is_anonymous: boolean;
|
|
29
26
|
is_restricted: boolean;
|
|
27
|
+
restricted_reason: {
|
|
28
|
+
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
29
|
+
} | null;
|
|
30
30
|
requires_totp_mfa: boolean;
|
|
31
31
|
};
|
|
32
32
|
get expiresAt(): Date;
|
|
@@ -25,7 +25,7 @@ HEXCLAVE SETUP INSTRUCTIONS
|
|
|
25
25
|
|
|
26
26
|
These instructions describe how to set up Hexclave.
|
|
27
27
|
${web ? `
|
|
28
|
-
First of all,
|
|
28
|
+
First of all, use the full setup prompt below as the source of truth. Do not run the Hexclave CLI initializer unless the user explicitly asks for the CLI workflow.
|
|
29
29
|
` : ""}
|
|
30
30
|
|
|
31
31
|
${getCliProjectSetupContext(configPath)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-prompt.js","names":["aiSetupPrompt"],"sources":["../../src/helpers/init-prompt.ts"],"sourcesContent":["import { aiSetupPrompt } from \"../ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt\";\n\nfunction getCliProjectSetupContext(configPath?: string): string {\n if (configPath != null) {\n return `\nThe Hexclave CLI already created or linked this project to a local Hexclave development environment config file:\n\n\\`\\`\\`text\n${configPath}\n\\`\\`\\`\n\nDo not create or link another Hexclave project. When the SDK setup instructions mention creating \\`stack.config.ts\\` or wrapping the dev script with \\`stack dev --config-file\\`, use the config file path above.\n`;\n }\n\n return `\nThe Hexclave CLI already created or linked this project to a hosted Hexclave cloud project and wrote or printed the Hexclave environment variables.\n\nDo not create or link another Hexclave project. Use the existing environment variables in this workspace. If the variables were printed instead of written because the user declined to append them to an env file, tell the user exactly which variables still need to be added.\n`;\n}\n\nexport const createInitPrompt = (web: boolean, configPath?: string) => `=============================\nHEXCLAVE SETUP INSTRUCTIONS\n=============================\n\nThese instructions describe how to set up Hexclave.\n${web ? `\nFirst of all,
|
|
1
|
+
{"version":3,"file":"init-prompt.js","names":["aiSetupPrompt"],"sources":["../../src/helpers/init-prompt.ts"],"sourcesContent":["import { aiSetupPrompt } from \"../ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt\";\n\nfunction getCliProjectSetupContext(configPath?: string): string {\n if (configPath != null) {\n return `\nThe Hexclave CLI already created or linked this project to a local Hexclave development environment config file:\n\n\\`\\`\\`text\n${configPath}\n\\`\\`\\`\n\nDo not create or link another Hexclave project. When the SDK setup instructions mention creating \\`stack.config.ts\\` or wrapping the dev script with \\`stack dev --config-file\\`, use the config file path above.\n`;\n }\n\n return `\nThe Hexclave CLI already created or linked this project to a hosted Hexclave cloud project and wrote or printed the Hexclave environment variables.\n\nDo not create or link another Hexclave project. Use the existing environment variables in this workspace. If the variables were printed instead of written because the user declined to append them to an env file, tell the user exactly which variables still need to be added.\n`;\n}\n\nexport const createInitPrompt = (web: boolean, configPath?: string) => `=============================\nHEXCLAVE SETUP INSTRUCTIONS\n=============================\n\nThese instructions describe how to set up Hexclave.\n${web ? `\nFirst of all, use the full setup prompt below as the source of truth. Do not run the Hexclave CLI initializer unless the user explicitly asks for the CLI workflow.\n` : \"\"}\n\n${getCliProjectSetupContext(configPath)}\n\nUse the full setup guide below as the source of truth, with one important CLI-specific adjustment: the \"Setting up the project\" step is already complete. Use that section only to understand how the existing config/env files should connect to the SDK wiring; do not ask the user for project IDs or keys that the CLI already generated or linked.\n\nApply only the sections relevant to this project. For example, do not add Convex, Supabase, or command-line-app authentication unless the existing project already uses that surface or the user explicitly asked for it.\n\n${aiSetupPrompt}\n`;\n"],"mappings":";;;;;AAEA,SAAS,0BAA0B,YAA6B;AAC9D,KAAI,cAAc,KAChB,QAAO;;;;EAIT,WAAW;;;;;AAOX,QAAO;;;;;;AAOT,MAAa,oBAAoB,KAAc,eAAwB;;;;;EAKrE,MAAM;;IAEJ,GAAG;;EAEL,0BAA0B,WAAW,CAAC;;;;;;EAMtCA,+EAAc"}
|
|
@@ -150,17 +150,17 @@ declare const MetricsEmailOverviewSchema: yup.ObjectSchema<{
|
|
|
150
150
|
activity: number;
|
|
151
151
|
}[];
|
|
152
152
|
daily_emails_by_status: {
|
|
153
|
-
error: number;
|
|
154
153
|
date: string;
|
|
155
154
|
ok: number;
|
|
155
|
+
error: number;
|
|
156
156
|
in_progress: number;
|
|
157
157
|
}[];
|
|
158
158
|
emails_sent: number;
|
|
159
159
|
recent_emails: {
|
|
160
|
-
status: string;
|
|
161
160
|
id: string;
|
|
162
|
-
|
|
161
|
+
status: string;
|
|
163
162
|
subject: string;
|
|
163
|
+
created_at_millis: number;
|
|
164
164
|
}[];
|
|
165
165
|
deliverability_status: {
|
|
166
166
|
error: number;
|
|
@@ -292,16 +292,16 @@ declare const MetricsAnalyticsOverviewSchema: yup.ObjectSchema<{
|
|
|
292
292
|
activity: number;
|
|
293
293
|
}[];
|
|
294
294
|
top_browsers: {
|
|
295
|
-
name: string;
|
|
296
295
|
visitors: number;
|
|
296
|
+
name: string;
|
|
297
297
|
}[];
|
|
298
298
|
top_operating_systems: {
|
|
299
|
-
name: string;
|
|
300
299
|
visitors: number;
|
|
300
|
+
name: string;
|
|
301
301
|
}[];
|
|
302
302
|
top_devices: {
|
|
303
|
-
name: string;
|
|
304
303
|
visitors: number;
|
|
304
|
+
name: string;
|
|
305
305
|
}[];
|
|
306
306
|
conversion_rate: number | undefined;
|
|
307
307
|
deltas: {} | undefined;
|
|
@@ -369,7 +369,7 @@ declare const UserActivityResponseBodySchema: yup.ObjectSchema<{
|
|
|
369
369
|
data_points: undefined;
|
|
370
370
|
}, "">;
|
|
371
371
|
declare const AnalyticsClickmapKindSchema: yup.StringSchema<"team_user_hour_of_week" | "session_replay_clicks", yup.AnyObject, undefined, "">;
|
|
372
|
-
declare const AnalyticsClickmapDeviceSchema: yup.StringSchema<"
|
|
372
|
+
declare const AnalyticsClickmapDeviceSchema: yup.StringSchema<"tv" | "widescreen" | "desktop" | "laptop" | "tablet" | "mobile", yup.AnyObject, undefined, "">;
|
|
373
373
|
declare const AnalyticsClickmapTokenResponseBodySchema: yup.ObjectSchema<{
|
|
374
374
|
token: string;
|
|
375
375
|
origin: string;
|
|
@@ -392,30 +392,30 @@ declare const AnalyticsClickmapResponseBodySchema: yup.ObjectSchema<{
|
|
|
392
392
|
kind: "team_user_hour_of_week" | "session_replay_clicks";
|
|
393
393
|
cells: {
|
|
394
394
|
value: number;
|
|
395
|
-
hour: number;
|
|
396
395
|
weekday: number;
|
|
396
|
+
hour: number;
|
|
397
397
|
}[];
|
|
398
398
|
sampling: number;
|
|
399
399
|
routes: {
|
|
400
400
|
path: string;
|
|
401
|
-
users: number;
|
|
402
401
|
clicks: number;
|
|
402
|
+
users: number;
|
|
403
403
|
replays: number;
|
|
404
404
|
}[];
|
|
405
405
|
users: {
|
|
406
|
-
primary_email: string | null;
|
|
407
|
-
display_name: string | null;
|
|
408
406
|
id: string;
|
|
407
|
+
display_name: string | null;
|
|
408
|
+
primary_email: string | null;
|
|
409
409
|
profile_image_url: string | null;
|
|
410
410
|
clicks: number;
|
|
411
411
|
replays: number;
|
|
412
412
|
last_event_at_millis: number;
|
|
413
413
|
}[];
|
|
414
414
|
replays: {
|
|
415
|
-
user_id: string | null;
|
|
416
415
|
id: string;
|
|
417
416
|
clicks: number;
|
|
418
417
|
last_event_at_millis: number;
|
|
418
|
+
user_id: string | null;
|
|
419
419
|
route_path: string | null;
|
|
420
420
|
viewport_width: number | null;
|
|
421
421
|
viewport_height: number | null;
|
|
@@ -443,9 +443,9 @@ declare const AnalyticsClickmapResponseBodySchema: yup.ObjectSchema<{
|
|
|
443
443
|
elements: never[];
|
|
444
444
|
}, "">;
|
|
445
445
|
declare const MetricsActiveUsersByCountrySchema: yup.MixedSchema<Record<string, {
|
|
446
|
-
primary_email: string | null;
|
|
447
|
-
display_name: string | null;
|
|
448
446
|
id: string;
|
|
447
|
+
display_name: string | null;
|
|
448
|
+
primary_email: string | null;
|
|
449
449
|
profile_image_url: string | null;
|
|
450
450
|
signed_up_at_millis: number;
|
|
451
451
|
last_active_at_millis: number | null;
|
|
@@ -471,25 +471,25 @@ declare const MetricsResponseBodySchema: yup.ObjectSchema<{
|
|
|
471
471
|
}[];
|
|
472
472
|
users_by_country: Record<string, number>;
|
|
473
473
|
active_users_by_country: Record<string, {
|
|
474
|
-
primary_email: string | null;
|
|
475
|
-
display_name: string | null;
|
|
476
474
|
id: string;
|
|
475
|
+
display_name: string | null;
|
|
476
|
+
primary_email: string | null;
|
|
477
477
|
profile_image_url: string | null;
|
|
478
478
|
signed_up_at_millis: number;
|
|
479
479
|
last_active_at_millis: number | null;
|
|
480
480
|
}[]>;
|
|
481
481
|
recently_registered: {
|
|
482
|
-
primary_email: string | null;
|
|
483
|
-
display_name: string | null;
|
|
484
482
|
id: string;
|
|
483
|
+
display_name: string | null;
|
|
484
|
+
primary_email: string | null;
|
|
485
485
|
profile_image_url: string | null;
|
|
486
486
|
signed_up_at_millis: number;
|
|
487
487
|
last_active_at_millis: number | null;
|
|
488
488
|
}[];
|
|
489
489
|
recently_active: {
|
|
490
|
-
primary_email: string | null;
|
|
491
|
-
display_name: string | null;
|
|
492
490
|
id: string;
|
|
491
|
+
display_name: string | null;
|
|
492
|
+
primary_email: string | null;
|
|
493
493
|
profile_image_url: string | null;
|
|
494
494
|
signed_up_at_millis: number;
|
|
495
495
|
last_active_at_millis: number | null;
|
|
@@ -563,17 +563,17 @@ declare const MetricsResponseBodySchema: yup.ObjectSchema<{
|
|
|
563
563
|
emails_by_status: Record<string, number>;
|
|
564
564
|
total_emails: number;
|
|
565
565
|
daily_emails_by_status: {
|
|
566
|
-
error: number;
|
|
567
566
|
date: string;
|
|
568
567
|
ok: number;
|
|
568
|
+
error: number;
|
|
569
569
|
in_progress: number;
|
|
570
570
|
}[];
|
|
571
571
|
emails_sent: number;
|
|
572
572
|
recent_emails: {
|
|
573
|
-
status: string;
|
|
574
573
|
id: string;
|
|
575
|
-
|
|
574
|
+
status: string;
|
|
576
575
|
subject: string;
|
|
576
|
+
created_at_millis: number;
|
|
577
577
|
}[];
|
|
578
578
|
deliverability_status: {
|
|
579
579
|
error: number;
|
|
@@ -652,16 +652,16 @@ declare const MetricsResponseBodySchema: yup.ObjectSchema<{
|
|
|
652
652
|
activity: number;
|
|
653
653
|
}[];
|
|
654
654
|
top_browsers: {
|
|
655
|
-
name: string;
|
|
656
655
|
visitors: number;
|
|
656
|
+
name: string;
|
|
657
657
|
}[];
|
|
658
658
|
top_operating_systems: {
|
|
659
|
-
name: string;
|
|
660
659
|
visitors: number;
|
|
660
|
+
name: string;
|
|
661
661
|
}[];
|
|
662
662
|
top_devices: {
|
|
663
|
-
name: string;
|
|
664
663
|
visitors: number;
|
|
664
|
+
name: string;
|
|
665
665
|
}[];
|
|
666
666
|
};
|
|
667
667
|
}, yup.AnyObject, {
|