@hexclave/shared 1.0.44 → 1.0.45

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.
Files changed (101) hide show
  1. package/dist/{admin-interface-BSW1mzGs.d.ts → admin-interface-B-UjGQ0i.d.ts} +11 -13
  2. package/dist/admin-interface-B-UjGQ0i.d.ts.map +1 -0
  3. package/dist/{admin-metrics-bsOkw4YQ.d.ts → admin-metrics-1yiWGq9z.d.ts} +15 -15
  4. package/dist/{admin-metrics-bsOkw4YQ.d.ts.map → admin-metrics-1yiWGq9z.d.ts.map} +1 -1
  5. package/dist/ai/unified-prompts/reminders.js +1 -2
  6. package/dist/ai/unified-prompts/reminders.js.map +1 -1
  7. package/dist/{client-interface-iIw4nU5k.d.ts → client-interface-DjVtlQix.d.ts} +10 -10
  8. package/dist/{client-interface-iIw4nU5k.d.ts.map → client-interface-DjVtlQix.d.ts.map} +1 -1
  9. package/dist/config/schema.d.ts +1 -1
  10. package/dist/config-authoring.d.ts +1 -1
  11. package/dist/{current-user-BBoN3hsn.d.ts → current-user-BCkMYzHx.d.ts} +17 -17
  12. package/dist/{current-user-BBoN3hsn.d.ts.map → current-user-BCkMYzHx.d.ts.map} +1 -1
  13. package/dist/{email-outbox-B1wmVPRG.d.ts → email-outbox-BRZiK0ZG.d.ts} +221 -221
  14. package/dist/{email-outbox-B1wmVPRG.d.ts.map → email-outbox-BRZiK0ZG.d.ts.map} +1 -1
  15. package/dist/esm/ai/unified-prompts/reminders.js +1 -1
  16. package/dist/esm/config/schema.d.ts +116 -116
  17. package/dist/esm/interface/admin-interface.d.ts +0 -2
  18. package/dist/esm/interface/admin-interface.d.ts.map +1 -1
  19. package/dist/esm/interface/admin-interface.js +0 -12
  20. package/dist/esm/interface/admin-interface.js.map +1 -1
  21. package/dist/esm/interface/admin-metrics.d.ts +14 -14
  22. package/dist/esm/interface/conversations.d.ts +18 -18
  23. package/dist/esm/interface/crud/current-user.d.ts +16 -16
  24. package/dist/esm/interface/crud/email-outbox.d.ts +220 -220
  25. package/dist/esm/interface/crud/invoices.d.ts +2 -2
  26. package/dist/esm/interface/crud/products.d.ts +21 -21
  27. package/dist/esm/interface/crud/project-api-keys.d.ts +4 -4
  28. package/dist/esm/interface/crud/projects.d.ts +59 -59
  29. package/dist/esm/interface/crud/team-member-profiles.d.ts +32 -32
  30. package/dist/esm/interface/crud/transactions.d.ts +17 -17
  31. package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
  32. package/dist/esm/interface/crud/users.d.ts +22 -22
  33. package/dist/esm/interface/plan-usage.d.ts +1 -1
  34. package/dist/esm/interface/server-interface.d.ts +2 -0
  35. package/dist/esm/interface/server-interface.d.ts.map +1 -1
  36. package/dist/esm/interface/server-interface.js +12 -0
  37. package/dist/esm/interface/server-interface.js.map +1 -1
  38. package/dist/esm/interface/webhooks.d.ts +4 -4
  39. package/dist/esm/known-errors.d.ts +3 -3
  40. package/dist/esm/schema-fields.d.ts +12 -12
  41. package/dist/esm/sessions.d.ts +9 -9
  42. package/dist/helpers/password.d.ts +1 -1
  43. package/dist/helpers/production-mode.d.ts +1 -1
  44. package/dist/index.d.ts +4 -4
  45. package/dist/interface/admin-interface.d.ts +2 -2
  46. package/dist/interface/admin-interface.js +0 -12
  47. package/dist/interface/admin-interface.js.map +1 -1
  48. package/dist/interface/admin-metrics.d.ts +1 -1
  49. package/dist/interface/client-interface.d.ts +1 -1
  50. package/dist/interface/conversations.d.ts +18 -18
  51. package/dist/interface/crud/current-user.d.ts +1 -1
  52. package/dist/interface/crud/email-outbox.d.ts +1 -1
  53. package/dist/interface/crud/invoices.d.ts +1 -1
  54. package/dist/interface/crud/products.d.ts +1 -1
  55. package/dist/interface/crud/project-api-keys.d.ts +1 -1
  56. package/dist/interface/crud/projects.d.ts +1 -1
  57. package/dist/interface/crud/team-member-profiles.d.ts +1 -1
  58. package/dist/interface/crud/transactions.d.ts +1 -1
  59. package/dist/interface/crud/users.d.ts +1 -1
  60. package/dist/interface/plan-usage.d.ts +1 -1
  61. package/dist/interface/server-interface.d.ts +1 -1
  62. package/dist/interface/server-interface.js +12 -0
  63. package/dist/interface/server-interface.js.map +1 -1
  64. package/dist/interface/webhooks.d.ts +1 -1
  65. package/dist/{invoices-CHo9YKbI.d.ts → invoices-BGLLnTlR.d.ts} +3 -3
  66. package/dist/{invoices-CHo9YKbI.d.ts.map → invoices-BGLLnTlR.d.ts.map} +1 -1
  67. package/dist/{known-errors-Bm4a61wL.d.ts → known-errors-g7JC8z58.d.ts} +4 -4
  68. package/dist/{known-errors-Bm4a61wL.d.ts.map → known-errors-g7JC8z58.d.ts.map} +1 -1
  69. package/dist/known-errors.d.ts +1 -1
  70. package/dist/{plan-usage-ChUZqQWw.d.ts → plan-usage-BigvGIcT.d.ts} +2 -2
  71. package/dist/{plan-usage-ChUZqQWw.d.ts.map → plan-usage-BigvGIcT.d.ts.map} +1 -1
  72. package/dist/{products-Bs74ld-v.d.ts → products-D_fcxfR0.d.ts} +22 -22
  73. package/dist/{products-Bs74ld-v.d.ts.map → products-D_fcxfR0.d.ts.map} +1 -1
  74. package/dist/{project-api-keys--7V5X_UW.d.ts → project-api-keys-OQqmKtMS.d.ts} +5 -5
  75. package/dist/{project-api-keys--7V5X_UW.d.ts.map → project-api-keys-OQqmKtMS.d.ts.map} +1 -1
  76. package/dist/{projects-CFTNXRfG.d.ts → projects-C42SVFvm.d.ts} +60 -60
  77. package/dist/{projects-CFTNXRfG.d.ts.map → projects-C42SVFvm.d.ts.map} +1 -1
  78. package/dist/{schema-DIefUvKi.d.ts → schema-Bgy-GC70.d.ts} +117 -117
  79. package/dist/{schema-DIefUvKi.d.ts.map → schema-Bgy-GC70.d.ts.map} +1 -1
  80. package/dist/{schema-fields-DqGQ4kF7.d.ts → schema-fields-BljhsWsa.d.ts} +13 -13
  81. package/dist/{schema-fields-DqGQ4kF7.d.ts.map → schema-fields-BljhsWsa.d.ts.map} +1 -1
  82. package/dist/schema-fields.d.ts +1 -1
  83. package/dist/{server-interface-CgpxsLT_.d.ts → server-interface-C1W1tZ_y.d.ts} +10 -8
  84. package/dist/server-interface-C1W1tZ_y.d.ts.map +1 -0
  85. package/dist/{sessions-d8qtvBUB.d.ts → sessions-C0nM8bE_.d.ts} +11 -11
  86. package/dist/{sessions-d8qtvBUB.d.ts.map → sessions-C0nM8bE_.d.ts.map} +1 -1
  87. package/dist/sessions.d.ts +1 -1
  88. package/dist/{team-member-profiles-BoDEqx-0.d.ts → team-member-profiles-CgYXR-Rx.d.ts} +33 -33
  89. package/dist/{team-member-profiles-BoDEqx-0.d.ts.map → team-member-profiles-CgYXR-Rx.d.ts.map} +1 -1
  90. package/dist/{transactions-DhnbvGH5.d.ts → transactions-BomBBiph.d.ts} +18 -18
  91. package/dist/transactions-BomBBiph.d.ts.map +1 -0
  92. package/dist/{users-DHNRwoSz.d.ts → users-7MKfEyyq.d.ts} +24 -24
  93. package/dist/{users-DHNRwoSz.d.ts.map → users-7MKfEyyq.d.ts.map} +1 -1
  94. package/dist/{webhooks-8Ts1Clcb.d.ts → webhooks-C5gG85Ce.d.ts} +5 -5
  95. package/dist/{webhooks-8Ts1Clcb.d.ts.map → webhooks-C5gG85Ce.d.ts.map} +1 -1
  96. package/package.json +1 -1
  97. package/src/interface/admin-interface.ts +0 -20
  98. package/src/interface/server-interface.ts +20 -0
  99. package/dist/admin-interface-BSW1mzGs.d.ts.map +0 -1
  100. package/dist/server-interface-CgpxsLT_.d.ts.map +0 -1
  101. package/dist/transactions-DhnbvGH5.d.ts.map +0 -1
@@ -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 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,SAAuD;EACjE,MAAM,OAAO;EADa,KAAA,UAAA;CAE5B;CAEA,MAAgB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AAM,iBAAiB,MAAM,aAAa,QAAQ,KAAK,KAAK;EAC5D,MAAM,KAAK,kBACT,sBAAsB,QAAQ,OAC9B;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,MAAM,KAAK,UAAU;IAAE,YAAY;IAAW,iBAAiB;GAAe,CAAC;EACjF,GACA,IACF;CACF;CAEA,MAAM,kCAAkC,QAAqF;EAI3H,MAAM,EAAE,aAAa,iBAAiB,MAAM,KAAK,wBAAwB,QAAQ,MAAQ,GAAG,KAAK;EACjG,MAAM,cAAc,IAAI,gBAAgB;GACtC;GACA;GACA,4BAA4B,YAAY;EAC1C,CAAC;EAGD,OAAO,MAAM,KAAK,4BAA4B,CAAC,GAAG,WAAW;CAC/D;AACF"}
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 type { AnalyticsQueryOptions, AnalyticsQueryResponse } from \"./crud/analytics\";\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 queryAnalytics(options: AnalyticsQueryOptions): Promise<AnalyticsQueryResponse> {\n const response = await this.sendServerRequest(\n \"/analytics/query\",\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n query: options.query,\n params: options.params ?? {},\n timeout_ms: options.timeout_ms ?? 1000,\n include_all_branches: options.include_all_branches ?? false,\n }),\n },\n null,\n );\n\n return await response.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":";;;;;;;;;AAyCA,IAAa,0BAAb,cAA6C,wBAAwB;CACnE,YAAY,SAAuD;EACjE,MAAM,OAAO;EADa,KAAA,UAAA;CAE5B;CAEA,MAAgB,kBAAkB,MAAc,SAAsB,SAAiC,cAAkC,UAAU;EACjJ,OAAO,MAAM,KAAK,kBAChB,MACA;GACE,GAAG;GACH,SAAS;IAEP,gCAAgC,qBAAqB,KAAK,UAAU,KAAK,QAAQ,kBAAkB;IACnG,GAAG,QAAQ;G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AAQ,KAAK,cAAc;CACvD;CAEA,MAAM,uBAAuB,QAAgB,SAAiB,KAAa,OAAe;EACxF,MAAM,YAAY,MAAM,QAAQ,QAAQ,GAAG;EAC3C,MAAM,iBAAiB,MAAM,aAAa,QAAQ,KAAK,KAAK;EAC5D,MAAM,KAAK,kBACT,sBAAsB,QAAQ,OAC9B;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,MAAM,KAAK,UAAU;IAAE,YAAY;IAAW,iBAAiB;GAAe,CAAC;EACjF,GACA,IACF;CACF;CAEA,MAAM,kCAAkC,QAAqF;EAI3H,MAAM,EAAE,aAAa,iBAAiB,MAAM,KAAK,wBAAwB,QAAQ,MAAQ,GAAG,KAAK;EACjG,MAAM,cAAc,IAAI,gBAAgB;GACtC;GACA;GACA,4BAA4B,YAAY;EAC1C,CAAC;EAGD,OAAO,MAAM,KAAK,4BAA4B,CAAC,GAAG,WAAW;CAC/D;AACF"}
@@ -20,10 +20,10 @@ 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
- created_at_millis: number;
24
+ display_name: string;
26
25
  profile_image_url: string | null;
26
+ created_at_millis: number;
27
27
  } | null;
28
28
  selected_team_id: string | null;
29
29
  profile_image_url: string | null;
@@ -110,10 +110,10 @@ 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
- created_at_millis: number;
114
+ display_name: string;
116
115
  profile_image_url: string | null;
116
+ created_at_millis: number;
117
117
  } | null;
118
118
  selected_team_id: string | null;
119
119
  profile_image_url: string | null;
@@ -512,7 +512,7 @@ declare const KnownErrors: {
512
512
  ItemNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_NOT_FOUND">, [itemId: string]> & {
513
513
  errorCode: "ITEM_NOT_FOUND";
514
514
  };
515
- ItemCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH">, [itemId: string, customerId: string, itemCustomerType: "team" | "user" | "custom" | undefined, actualCustomerType: "team" | "user" | "custom"]> & {
515
+ ItemCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH">, [itemId: string, customerId: string, itemCustomerType: "user" | "team" | "custom" | undefined, actualCustomerType: "user" | "team" | "custom"]> & {
516
516
  errorCode: "ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH";
517
517
  };
518
518
  CustomerDoesNotExist: KnownErrorConstructor<KnownError & KnownErrorBrand<"CUSTOMER_DOES_NOT_EXIST">, [customerId: string]> & {
@@ -521,7 +521,7 @@ declare const KnownErrors: {
521
521
  ProductDoesNotExist: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_DOES_NOT_EXIST">, [productId: string, context: "item_exists" | "server_only" | null]> & {
522
522
  errorCode: "PRODUCT_DOES_NOT_EXIST";
523
523
  };
524
- ProductCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH">, [productId: string | undefined, customerId: string, productCustomerType: "team" | "user" | "custom" | undefined, actualCustomerType: "team" | "user" | "custom"]> & {
524
+ ProductCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH">, [productId: string | undefined, customerId: string, productCustomerType: "user" | "team" | "custom" | undefined, actualCustomerType: "user" | "team" | "custom"]> & {
525
525
  errorCode: "PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH";
526
526
  };
527
527
  ProductAlreadyGranted: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_ALREADY_GRANTED">, [productId: string, customerId: string]> & {
@@ -548,7 +548,7 @@ declare const KnownErrors: {
548
548
  StripeAccountInfoNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"STRIPE_ACCOUNT_INFO_NOT_FOUND">, []> & {
549
549
  errorCode: "STRIPE_ACCOUNT_INFO_NOT_FOUND";
550
550
  };
551
- DefaultPaymentMethodRequired: KnownErrorConstructor<KnownError & KnownErrorBrand<"DEFAULT_PAYMENT_METHOD_REQUIRED">, [customerType: "team" | "user", customerId: string]> & {
551
+ DefaultPaymentMethodRequired: KnownErrorConstructor<KnownError & KnownErrorBrand<"DEFAULT_PAYMENT_METHOD_REQUIRED">, [customerType: "user" | "team", customerId: string]> & {
552
552
  errorCode: "DEFAULT_PAYMENT_METHOD_REQUIRED";
553
553
  };
554
554
  NewPurchasesBlocked: KnownErrorConstructor<KnownError & KnownErrorBrand<"NEW_PURCHASES_BLOCKED">, []> & {
@@ -140,7 +140,7 @@ declare const projectSignUpEnabledSchema: yup$1.BooleanSchema<boolean | undefine
140
140
  declare const projectCredentialEnabledSchema: yup$1.BooleanSchema<boolean | undefined, yup$1.AnyObject, undefined, "">;
141
141
  declare const oauthIdSchema: yup$1.StringSchema<"google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "twitch" | undefined, yup$1.AnyObject, undefined, "">;
142
142
  declare const oauthEnabledSchema: yup$1.BooleanSchema<boolean | undefined, yup$1.AnyObject, undefined, "">;
143
- declare const oauthTypeSchema: yup$1.StringSchema<"shared" | "standard" | undefined, yup$1.AnyObject, undefined, "">;
143
+ declare const oauthTypeSchema: yup$1.StringSchema<"standard" | "shared" | undefined, yup$1.AnyObject, undefined, "">;
144
144
  declare const oauthClientIdSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
145
145
  declare const oauthClientSecretSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
146
146
  declare const oauthCustomCallbackUrlSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
@@ -151,7 +151,7 @@ declare const oauthAppleBundleIdSchema: yup$1.StringSchema<string, yup$1.AnyObje
151
151
  declare const oauthAccountMergeStrategySchema: yup$1.StringSchema<"link_method" | "raise_error" | "allow_duplicates" | undefined, yup$1.AnyObject, undefined, "">;
152
152
  declare const oauthIssuerUrlSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
153
153
  declare const oauthScopeSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
154
- declare const emailTypeSchema: yup$1.StringSchema<"shared" | "standard" | undefined, yup$1.AnyObject, undefined, "">;
154
+ declare const emailTypeSchema: yup$1.StringSchema<"standard" | "shared" | undefined, yup$1.AnyObject, undefined, "">;
155
155
  declare const emailSenderNameSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
156
156
  declare const emailHostSchema: yup$1.StringSchema<string | undefined, yup$1.AnyObject, undefined, "">;
157
157
  declare const emailPortSchema: yup$1.NumberSchema<number | undefined, yup$1.AnyObject, undefined, "">;
@@ -174,7 +174,7 @@ declare const customDashboardsSchema: yup$1.MixedSchema<Record<string, {
174
174
  displayName: string;
175
175
  tsxSource: string;
176
176
  }>, yup$1.AnyObject, undefined, "">;
177
- declare const customerTypeSchema: yup$1.StringSchema<"team" | "user" | "custom" | undefined, yup$1.AnyObject, undefined, "">;
177
+ declare const customerTypeSchema: yup$1.StringSchema<"user" | "team" | "custom" | undefined, yup$1.AnyObject, undefined, "">;
178
178
  /**
179
179
  * Schema for a single product price. Each currency field (USD, EUR, etc.) is a decimal string
180
180
  * like `"9.99"` or `"1000"` — never cent integers. See `MoneyAmount` for the exact format.
@@ -211,14 +211,14 @@ declare const pricesSchema: yup$1.MixedSchema<Record<string, {
211
211
  AUD?: string | undefined;
212
212
  CAD?: string | undefined;
213
213
  interval?: DayInterval | undefined;
214
- serverOnly?: boolean | undefined;
215
214
  freeTrial?: DayInterval | undefined;
215
+ serverOnly?: boolean | undefined;
216
216
  }>, yup$1.AnyObject, undefined, "">;
217
217
  declare const productSchema: yup$1.ObjectSchema<{
218
218
  displayName: string | undefined;
219
219
  productLineId: string | undefined;
220
220
  isAddOnTo: false | Record<string, true> | undefined;
221
- customerType: "team" | "user" | "custom";
221
+ customerType: "user" | "team" | "custom";
222
222
  freeTrial: DayInterval | undefined;
223
223
  serverOnly: boolean | undefined;
224
224
  stackable: boolean | undefined;
@@ -231,8 +231,8 @@ declare const productSchema: yup$1.ObjectSchema<{
231
231
  AUD?: string | undefined;
232
232
  CAD?: string | undefined;
233
233
  interval?: DayInterval | undefined;
234
- serverOnly?: boolean | undefined;
235
234
  freeTrial?: DayInterval | undefined;
235
+ serverOnly?: boolean | undefined;
236
236
  }>;
237
237
  includedItems: Record<string, {
238
238
  repeat?: "never" | DayInterval | undefined;
@@ -257,7 +257,7 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
257
257
  displayName: string | undefined;
258
258
  productLineId: string | undefined;
259
259
  isAddOnTo: false | Record<string, true> | undefined;
260
- customerType: "team" | "user" | "custom";
260
+ customerType: "user" | "team" | "custom";
261
261
  freeTrial: DayInterval | undefined;
262
262
  serverOnly: boolean | undefined;
263
263
  stackable: boolean | undefined;
@@ -270,8 +270,8 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
270
270
  AUD?: string | undefined;
271
271
  CAD?: string | undefined;
272
272
  interval?: DayInterval | undefined;
273
- serverOnly?: boolean | undefined;
274
273
  freeTrial?: DayInterval | undefined;
274
+ serverOnly?: boolean | undefined;
275
275
  }>;
276
276
  includedItems: Record<string, {
277
277
  repeat?: "never" | DayInterval | undefined;
@@ -298,11 +298,12 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
298
298
  }, "">;
299
299
  declare const inlineProductSchema: yup$1.ObjectSchema<{
300
300
  display_name: string;
301
- customer_type: "team" | "user" | "custom";
301
+ customer_type: "user" | "team" | "custom";
302
302
  free_trial: DayInterval | undefined;
303
303
  server_only: boolean;
304
304
  stackable: boolean;
305
305
  prices: Record<string, {
306
+ free_trial?: DayInterval | undefined;
306
307
  USD?: string | undefined;
307
308
  EUR?: string | undefined;
308
309
  GBP?: string | undefined;
@@ -311,11 +312,10 @@ declare const inlineProductSchema: yup$1.ObjectSchema<{
311
312
  AUD?: string | undefined;
312
313
  CAD?: string | undefined;
313
314
  interval?: DayInterval | undefined;
314
- free_trial?: DayInterval | undefined;
315
315
  }>;
316
316
  included_items: Record<string, {
317
- quantity?: number | undefined;
318
317
  repeat?: "never" | DayInterval | undefined;
318
+ quantity?: number | undefined;
319
319
  expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
320
320
  }>;
321
321
  client_metadata: {} | null | undefined;
@@ -473,9 +473,9 @@ declare function yupDefinedAndNonEmptyWhen<S extends yup$1.StringSchema>(schema:
473
473
  declare const branchConfigSourceSchema: yup$1.MixedSchema<{
474
474
  workflow_path?: string | undefined;
475
475
  type: "pushed-from-github";
476
+ branch: string;
476
477
  owner: string;
477
478
  repo: string;
478
- branch: string;
479
479
  commit_hash: string;
480
480
  config_file_path: string;
481
481
  } | {
@@ -9,25 +9,25 @@ declare class AccessToken {
9
9
  private constructor();
10
10
  get payload(): {
11
11
  exp?: number | undefined;
12
- project_id: string;
13
- refresh_token_id: string;
12
+ sub: string;
13
+ name: string | null;
14
14
  email: string | null;
15
+ selected_team_id: string | null;
16
+ is_anonymous: boolean;
17
+ is_restricted: boolean;
15
18
  restricted_reason: {
16
19
  type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
17
20
  } | null;
21
+ requires_totp_mfa: boolean;
22
+ project_id: string;
23
+ refresh_token_id: string;
18
24
  branch_id: string;
19
- sub: string;
25
+ role: "authenticated";
20
26
  iat: number;
21
27
  iss: string;
22
28
  aud: string;
23
- role: "authenticated";
24
- name: string | null;
25
29
  email_verified: boolean;
26
- selected_team_id: string | null;
27
30
  signed_up_at: number;
28
- is_anonymous: boolean;
29
- is_restricted: boolean;
30
- requires_totp_mfa: boolean;
31
31
  };
32
32
  get expiresAt(): Date;
33
33
  get issuedAt(): Date;
@@ -1,4 +1,4 @@
1
- import { a as KnownErrors } from "../known-errors-Bm4a61wL.js";
1
+ import { a as KnownErrors } from "../known-errors-g7JC8z58.js";
2
2
  //#region src/helpers/password.d.ts
3
3
  declare function getPasswordError(password: string): KnownErrors["PasswordRequirementsNotMet"] | undefined;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { r as ProjectsCrud } from "../projects-CFTNXRfG.js";
1
+ import { r as ProjectsCrud } from "../projects-C42SVFvm.js";
2
2
 
3
3
  //#region src/helpers/production-mode.d.ts
4
4
  type ProductionModeError = {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as KnownErrors, n as KnownError } from "./known-errors-Bm4a61wL.js";
2
- import { n as HexclaveClientInterface } from "./client-interface-iIw4nU5k.js";
3
- import { t as HexclaveServerInterface } from "./server-interface-CgpxsLT_.js";
4
- import { r as HexclaveAdminInterface } from "./admin-interface-BSW1mzGs.js";
1
+ import { a as KnownErrors, n as KnownError } from "./known-errors-g7JC8z58.js";
2
+ import { n as HexclaveClientInterface } from "./client-interface-DjVtlQix.js";
3
+ import { t as HexclaveServerInterface } from "./server-interface-C1W1tZ_y.js";
4
+ import { r as HexclaveAdminInterface } from "./admin-interface-B-UjGQ0i.js";
5
5
  export { HexclaveAdminInterface, HexclaveClientInterface, HexclaveServerInterface, KnownError, KnownErrors };
@@ -1,3 +1,3 @@
1
- import { n as PlanUsageResponse } from "../plan-usage-ChUZqQWw.js";
2
- import { a as InternalApiKeyCreateCrudResponse, i as InternalApiKeyCreateCrudRequest, n as ChatContent, r as HexclaveAdminInterface, t as AdminAuthApplicationOptions } from "../admin-interface-BSW1mzGs.js";
1
+ import { n as PlanUsageResponse } from "../plan-usage-BigvGIcT.js";
2
+ import { a as InternalApiKeyCreateCrudResponse, i as InternalApiKeyCreateCrudRequest, n as ChatContent, r as HexclaveAdminInterface, t as AdminAuthApplicationOptions } from "../admin-interface-B-UjGQ0i.js";
3
3
  export { AdminAuthApplicationOptions, ChatContent, HexclaveAdminInterface, InternalApiKeyCreateCrudRequest, InternalApiKeyCreateCrudResponse, type PlanUsageResponse };
@@ -528,18 +528,6 @@ var HexclaveAdminInterface = class extends __server_interface_js.HexclaveServerI
528
528
  body: JSON.stringify({ onboarding })
529
529
  }, null)).json();
530
530
  }
531
- async queryAnalytics(options) {
532
- return await (await this.sendAdminRequest("/internal/analytics/query", {
533
- method: "POST",
534
- headers: { "content-type": "application/json" },
535
- body: JSON.stringify({
536
- query: options.query,
537
- params: options.params ?? {},
538
- timeout_ms: options.timeout_ms ?? 1e3,
539
- include_all_branches: options.include_all_branches ?? false
540
- })
541
- }, null)).json();
542
- }
543
531
  async listOutboxEmails(options) {
544
532
  const qs = new URLSearchParams();
545
533
  if (options?.status) qs.set("status", options.status);