@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":["HexclaveClientInterface","Result","KnownErrors","HexclaveAssertionError","InternalSession"],"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,cAA6CA,sBAAAA,wBAAwB;CACnE,YAAY,SAAuD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AAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,MAAM,KAAK,UAAU,EAAE,YAAY,UAAU,CAAC;EAChD,GACA,MACA,CAACD,mBAAAA,YAAY,mCAAmC,CAClD;EACA,IAAI,SAAS,WAAW,SACtB,IAAIA,mBAAAA,YAAY,oCAAoC,WAAW,SAAS,KAAK,GAC3E,OAAO;OAEP,MAAM,IAAIC,mBAAAA,uBAAuB,6BAA6B,EAAE,OAAO,SAAS,MAAM,CAAC;EAI3F,MAAM,kBAAiB,MADJ,SAAS,KAAK,KAAK,EAAA,CACV;EAC5B,IAAI,OAAO,mBAAmB,UAAU,MAAM,IAAIA,mBAAAA,uBAAuB,mCAAmC,EAAE,MAAM,OAAO,eAAe,CAAC;EAC3I,OAAO,OAAA,GAAA,gCAAA,aAAA,CAAmB,QAAQ,KAAK,cAAc;CACvD;CAEA,MAAM,uBAAuB,QAAgB,SAAiB,KAAa,OAAe;EACxF,MAAM,YAAY,OAAA,GAAA,gCAAA,QAAA,CAAc,QAAQ,GAAG;EAC3C,MAAM,iBAAiB,OAAA,GAAA,gCAAA,aAAA,CAAmB,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,IAAIC,eAAAA,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":["HexclaveClientInterface","Result","KnownErrors","HexclaveAssertionError","InternalSession"],"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,cAA6CA,sBAAAA,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;GACb;EACF,GACA,SACA,WACF;CACF;CAEA,MAAe,mBACb,cACA,YACA,SAUC;EAMD,OAAO,OAAM,MALU,KAAK,kBAC1B,iBAAA,SAAS,qBAAqB,aAAa,GAAG,cAC9C,CAAC,GACD,OACF,EAAA,CACsB,KAAK;CAC7B;CAEA,MAAe,uCACb,cACA,YACA,SAIC;EAYD,OAAO,OAAM,MAXU,KAAK,kBAC1B,iBAAA,SAAS,4BAA4B,aAAa,GAAG,WAAW,gBAChE;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,mBAClB;GACA,MAAM,KAAK,UAAU,CAAC,CAAC;EACzB,GACA,OACF,EAAA,CACsB,KAAK;CAC7B;CAEA,MAAe,+CACb,cACA,YACA,eACA,SASC;EAcD,OAAO,OAAM,MAbU,KAAK,kBAC1B,i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AAmC,EAAE,MAAM,OAAO,eAAe,CAAC;EAC3I,OAAO,OAAA,GAAA,gCAAA,aAAA,CAAmB,QAAQ,KAAK,cAAc;CACvD;CAEA,MAAM,uBAAuB,QAAgB,SAAiB,KAAa,OAAe;EACxF,MAAM,YAAY,OAAA,GAAA,gCAAA,QAAA,CAAc,QAAQ,GAAG;EAC3C,MAAM,iBAAiB,OAAA,GAAA,gCAAA,aAAA,CAAmB,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,IAAIC,eAAAA,gBAAgB;GACtC;GACA;GACA,4BAA4B,YAAY;EAC1C,CAAC;EAGD,OAAO,MAAM,KAAK,4BAA4B,CAAC,GAAG,WAAW;CAC/D;AACF"}
@@ -1,2 +1,2 @@
1
- import { n as webhookEvents, t as WebhookEvent } from "../webhooks-8Ts1Clcb.js";
1
+ import { n as webhookEvents, t as WebhookEvent } from "../webhooks-C5gG85Ce.js";
2
2
  export { WebhookEvent, webhookEvents };
@@ -3,7 +3,7 @@ import * as yup$1 from "yup";
3
3
  //#region src/interface/crud/invoices.d.ts
4
4
  declare const customerInvoiceReadSchema: yup$1.ObjectSchema<{
5
5
  created_at_millis: number;
6
- status: "open" | "draft" | "paid" | "uncollectible" | "void" | null;
6
+ status: "draft" | "open" | "paid" | "uncollectible" | "void" | null;
7
7
  amount_total: number;
8
8
  hosted_invoice_url: string | null;
9
9
  }, yup$1.AnyObject, {
@@ -15,8 +15,8 @@ declare const customerInvoiceReadSchema: yup$1.ObjectSchema<{
15
15
  type CustomerInvoiceRead = yup$1.InferType<typeof customerInvoiceReadSchema>;
16
16
  declare const customerInvoicesListResponseSchema: yup$1.ObjectSchema<{
17
17
  items: {
18
- status: "open" | "draft" | "paid" | "uncollectible" | "void" | null;
19
18
  created_at_millis: number;
19
+ status: "draft" | "open" | "paid" | "uncollectible" | "void" | null;
20
20
  amount_total: number;
21
21
  hosted_invoice_url: string | null;
22
22
  }[];
@@ -40,4 +40,4 @@ type ListCustomerInvoicesOptions = {
40
40
  };
41
41
  //#endregion
42
42
  export { customerInvoicesListResponseSchema as a, customerInvoiceReadSchema as i, CustomerInvoicesListResponse as n, ListCustomerInvoicesOptions as r, CustomerInvoiceRead as t };
43
- //# sourceMappingURL=invoices-CHo9YKbI.d.ts.map
43
+ //# sourceMappingURL=invoices-BGLLnTlR.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invoices-CHo9YKbI.d.ts","names":[],"sources":["../src/interface/crud/invoices.ts"],"mappings":";;;cAWa,yBAAA,EAAyB,KAAA,CAAA,YAAA;;;;;GAK1B,KAAA,CAAA,SAAA;;;;;;KAEA,mBAAA,GAAsB,KAAA,CAAI,SAAS,QAAQ,yBAAA;AAAA,cAE1C,kCAAA,EAAkC,KAAA,CAAA,YAAA;;;;;;;;;;;GAMnC,KAAA,CAAA,SAAA;;;;;;;KAEA,4BAAA,GAA+B,KAAA,CAAI,SAAS,QAAQ,kCAAA;AAAA,KAEpD,2BAAA;EACV,aAAA;EACA,WAAA;EACA,MAAA;EACA,KAAA;AAAA"}
1
+ {"version":3,"file":"invoices-BGLLnTlR.d.ts","names":[],"sources":["../src/interface/crud/invoices.ts"],"mappings":";;;cAWa,yBAAA,EAAyB,KAAA,CAAA,YAAA;;;;;GAK1B,KAAA,CAAA,SAAA;;;;;;KAEA,mBAAA,GAAsB,KAAA,CAAI,SAAS,QAAQ,yBAAA;AAAA,cAE1C,kCAAA,EAAkC,KAAA,CAAA,YAAA;;;;;;;;;;;GAMnC,KAAA,CAAA,SAAA;;;;;;;KAEA,4BAAA,GAA+B,KAAA,CAAI,SAAS,QAAQ,kCAAA;AAAA,KAEpD,2BAAA;EACV,aAAA;EACA,WAAA;EACA,MAAA;EACA,KAAA;AAAA"}
@@ -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">, []> & {
@@ -572,4 +572,4 @@ declare const KnownErrors: {
572
572
  };
573
573
  //#endregion
574
574
  export { KnownErrors as a, KnownErrorJson as i, KnownError as n, KnownErrorConstructor as r, AbstractKnownErrorConstructor as t };
575
- //# sourceMappingURL=known-errors-Bm4a61wL.d.ts.map
575
+ //# sourceMappingURL=known-errors-g7JC8z58.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"known-errors-Bm4a61wL.d.ts","names":[],"sources":["../src/known-errors.tsx"],"mappings":";;;;KAKY,cAAA;EACV,IAAA;EACA,OAAA;EACA,OAAA,GAAU,IAAI;AAAA;AAAA,KAGJ,6BAAA,yCACU,IAAA,EAAM,IAAA,KAAS,UAAA;EAEjC,uBAA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C,UAAA;EAAA,QAC/C,IAAA,EAAM,IAAA,GAAO,aAAA;IAAkB,eAAA,EAAiB,IAAA;EAAA;EACvD,SAAA;EACA,uBAAA,GAA0B,IAAA,EAAM,cAAA,KAAmB,IAAA;EACnD,UAAA,GAAa,KAAA,cAAmB,KAAA,IAAS,aAAA;IAAkB,eAAA,EAAiB,IAAA;EAAA;AAAA;AAAA,uBAGxD,UAAA,SAAmB,WAAA;EAAA,SAKrB,UAAA;EAAA,SACA,oBAAA;EAAA,SACA,OAAA,GAAU,IAAA;EAAA,iBANX,sBAAA;EACV,IAAA;cAGW,UAAA,UACA,oBAAA,UACA,OAAA,GAAU,IAAA;EAAA,OAQd,YAAA,CAAa,KAAA,YAAiB,KAAA,IAAS,UAAA;EAKrC,OAAA,IAAW,UAAA;EAIX,UAAA,IAAc,MAAA;EASd,iBAAA,IAAqB,IAAA;EAAA,IAQjC,SAAA;EAAA,OAIU,uBAAA,CAAwB,IAAA,EAAM,cAAA,GAAiB,qBAAA,QAA6B,UAAA;EAAA,OAQ5E,QAAA,CAAS,IAAA,EAAM,cAAA,GAAiB,UAAA;AAAA;AAAA,cAe1C,sCAAA;;;;KAID,eAAA;EA5E6B;;;;;EAAA,CAkF/B,sCAAsC,WAC/B,SAAA;AAAA;AAAA,KA2uDE,WAAA,wBACS,WAAA,GAAc,YAAA,QAAoB,WAAA,CAAY,CAAA;AAAA,cAGtD,WAAA"}
@@ -1,2 +1,2 @@
1
- import { a as KnownErrors, i as KnownErrorJson, n as KnownError, r as KnownErrorConstructor, t as AbstractKnownErrorConstructor } from "./known-errors-Bm4a61wL.js";
1
+ import { a as KnownErrors, i as KnownErrorJson, n as KnownError, r as KnownErrorConstructor, t as AbstractKnownErrorConstructor } from "./known-errors-g7JC8z58.js";
2
2
  export { AbstractKnownErrorConstructor, KnownError, KnownErrorConstructor, KnownErrorJson, KnownErrors };
@@ -30,8 +30,8 @@ declare const planUsageResponseSchema: yup$1.ObjectSchema<{
30
30
  period_end_millis: number;
31
31
  next_plan_id: "team" | "growth" | null;
32
32
  rows: {
33
- item_id: "dashboard_admins" | "auth_users" | "emails_per_month" | "analytics_timeout_seconds" | "analytics_events" | "session_replays" | "onboarding_call";
34
33
  display_name: string;
34
+ item_id: "dashboard_admins" | "auth_users" | "emails_per_month" | "analytics_timeout_seconds" | "analytics_events" | "session_replays" | "onboarding_call";
35
35
  kind: "current" | "metered" | "capability";
36
36
  used: number | null;
37
37
  limit: number | null;
@@ -54,4 +54,4 @@ type PlanUsageRow = yup$1.InferType<typeof planUsageRowSchema>;
54
54
  type PlanUsageResponse = yup$1.InferType<typeof planUsageResponseSchema>;
55
55
  //#endregion
56
56
  export { planUsageResponseSchema as a, planUsageKindSchema as i, PlanUsageResponse as n, planUsageRowSchema as o, PlanUsageRow as r, PlanUsageKind as t };
57
- //# sourceMappingURL=plan-usage-ChUZqQWw.d.ts.map
57
+ //# sourceMappingURL=plan-usage-BigvGIcT.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plan-usage-ChUZqQWw.d.ts","names":[],"sources":["../src/interface/plan-usage.ts"],"mappings":";;;cAOa,mBAAA,EAAmB,KAAA,CAAA,YAAA,uCAAA,KAAA,CAAA,SAAA;AAAA,cAEnB,kBAAA,EAAkB,KAAA,CAAA,YAAA;;;;;;;;;GASnB,KAAA,CAAA,SAAA;;;;;;;;;;cAEC,uBAAA,EAAuB,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;GASxB,KAAA,CAAA,SAAA;;;;;;;;;;KAEA,aAAA,GAAgB,KAAA,CAAI,SAAS,QAAQ,mBAAA;AAAA,KACrC,YAAA,GAAe,KAAA,CAAI,SAAS,QAAQ,kBAAA;AAAA,KACpC,iBAAA,GAAoB,KAAA,CAAI,SAAS,QAAQ,uBAAA"}
1
+ {"version":3,"file":"plan-usage-BigvGIcT.d.ts","names":[],"sources":["../src/interface/plan-usage.ts"],"mappings":";;;cAOa,mBAAA,EAAmB,KAAA,CAAA,YAAA,uCAAA,KAAA,CAAA,SAAA;AAAA,cAEnB,kBAAA,EAAkB,KAAA,CAAA,YAAA;;;;;;;;;GASnB,KAAA,CAAA,SAAA;;;;;;;;;;cAEC,uBAAA,EAAuB,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;GASxB,KAAA,CAAA,SAAA;;;;;;;;;;KAEA,aAAA,GAAgB,KAAA,CAAI,SAAS,QAAQ,mBAAA;AAAA,KACrC,YAAA,GAAe,KAAA,CAAI,SAAS,QAAQ,kBAAA;AAAA,KACpC,iBAAA,GAAoB,KAAA,CAAI,SAAS,QAAQ,uBAAA"}
@@ -6,14 +6,16 @@ declare const customerProductReadSchema: yup$1.ObjectSchema<{
6
6
  id: string | null;
7
7
  quantity: number;
8
8
  product: {
9
- free_trial?: DayInterval | undefined;
10
9
  client_metadata?: {} | null | undefined;
11
10
  client_read_only_metadata?: {} | null | undefined;
12
11
  server_metadata?: {} | null | undefined;
12
+ free_trial?: DayInterval | undefined;
13
+ display_name: string;
13
14
  server_only: boolean;
14
- customer_type: "team" | "user" | "custom";
15
+ customer_type: "user" | "team" | "custom";
15
16
  stackable: boolean;
16
17
  prices: Record<string, {
18
+ free_trial?: DayInterval | undefined;
17
19
  USD?: string | undefined;
18
20
  EUR?: string | undefined;
19
21
  GBP?: string | undefined;
@@ -22,12 +24,10 @@ declare const customerProductReadSchema: yup$1.ObjectSchema<{
22
24
  AUD?: string | undefined;
23
25
  CAD?: string | undefined;
24
26
  interval?: DayInterval | undefined;
25
- free_trial?: DayInterval | undefined;
26
27
  }>;
27
- display_name: string;
28
28
  included_items: Record<string, {
29
- quantity?: number | undefined;
30
29
  repeat?: "never" | DayInterval | undefined;
30
+ quantity?: number | undefined;
31
31
  expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
32
32
  }>;
33
33
  };
@@ -41,14 +41,16 @@ declare const customerProductReadSchema: yup$1.ObjectSchema<{
41
41
  switch_options: {
42
42
  product_id: string;
43
43
  product: {
44
- free_trial?: DayInterval | undefined;
45
44
  client_metadata?: {} | null | undefined;
46
45
  client_read_only_metadata?: {} | null | undefined;
47
46
  server_metadata?: {} | null | undefined;
47
+ free_trial?: DayInterval | undefined;
48
+ display_name: string;
48
49
  server_only: boolean;
49
- customer_type: "team" | "user" | "custom";
50
+ customer_type: "user" | "team" | "custom";
50
51
  stackable: boolean;
51
52
  prices: Record<string, {
53
+ free_trial?: DayInterval | undefined;
52
54
  USD?: string | undefined;
53
55
  EUR?: string | undefined;
54
56
  GBP?: string | undefined;
@@ -57,12 +59,10 @@ declare const customerProductReadSchema: yup$1.ObjectSchema<{
57
59
  AUD?: string | undefined;
58
60
  CAD?: string | undefined;
59
61
  interval?: DayInterval | undefined;
60
- free_trial?: DayInterval | undefined;
61
62
  }>;
62
- display_name: string;
63
63
  included_items: Record<string, {
64
- quantity?: number | undefined;
65
64
  repeat?: "never" | DayInterval | undefined;
65
+ quantity?: number | undefined;
66
66
  expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
67
67
  }>;
68
68
  };
@@ -104,14 +104,16 @@ declare const customerProductsListResponseSchema: yup$1.ObjectSchema<{
104
104
  switch_options?: {
105
105
  product_id: string;
106
106
  product: {
107
- free_trial?: DayInterval | undefined;
108
107
  client_metadata?: {} | null | undefined;
109
108
  client_read_only_metadata?: {} | null | undefined;
110
109
  server_metadata?: {} | null | undefined;
110
+ free_trial?: DayInterval | undefined;
111
+ display_name: string;
111
112
  server_only: boolean;
112
- customer_type: "team" | "user" | "custom";
113
+ customer_type: "user" | "team" | "custom";
113
114
  stackable: boolean;
114
115
  prices: Record<string, {
116
+ free_trial?: DayInterval | undefined;
115
117
  USD?: string | undefined;
116
118
  EUR?: string | undefined;
117
119
  GBP?: string | undefined;
@@ -120,26 +122,27 @@ declare const customerProductsListResponseSchema: yup$1.ObjectSchema<{
120
122
  AUD?: string | undefined;
121
123
  CAD?: string | undefined;
122
124
  interval?: DayInterval | undefined;
123
- free_trial?: DayInterval | undefined;
124
125
  }>;
125
- display_name: string;
126
126
  included_items: Record<string, {
127
- quantity?: number | undefined;
128
127
  repeat?: "never" | DayInterval | undefined;
128
+ quantity?: number | undefined;
129
129
  expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
130
130
  }>;
131
131
  };
132
132
  }[] | undefined;
133
+ id: string | null;
133
134
  quantity: number;
134
135
  product: {
135
- free_trial?: DayInterval | undefined;
136
136
  client_metadata?: {} | null | undefined;
137
137
  client_read_only_metadata?: {} | null | undefined;
138
138
  server_metadata?: {} | null | undefined;
139
+ free_trial?: DayInterval | undefined;
140
+ display_name: string;
139
141
  server_only: boolean;
140
- customer_type: "team" | "user" | "custom";
142
+ customer_type: "user" | "team" | "custom";
141
143
  stackable: boolean;
142
144
  prices: Record<string, {
145
+ free_trial?: DayInterval | undefined;
143
146
  USD?: string | undefined;
144
147
  EUR?: string | undefined;
145
148
  GBP?: string | undefined;
@@ -148,16 +151,13 @@ declare const customerProductsListResponseSchema: yup$1.ObjectSchema<{
148
151
  AUD?: string | undefined;
149
152
  CAD?: string | undefined;
150
153
  interval?: DayInterval | undefined;
151
- free_trial?: DayInterval | undefined;
152
154
  }>;
153
- display_name: string;
154
155
  included_items: Record<string, {
155
- quantity?: number | undefined;
156
156
  repeat?: "never" | DayInterval | undefined;
157
+ quantity?: number | undefined;
157
158
  expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
158
159
  }>;
159
160
  };
160
- id: string | null;
161
161
  }[];
162
162
  is_paginated: boolean;
163
163
  pagination: {
@@ -179,4 +179,4 @@ type ListCustomerProductsOptions = {
179
179
  };
180
180
  //#endregion
181
181
  export { customerProductsListResponseSchema as a, customerProductReadSchema as i, CustomerProductsListResponse as n, ListCustomerProductsOptions as r, CustomerProductRead as t };
182
- //# sourceMappingURL=products-Bs74ld-v.d.ts.map
182
+ //# sourceMappingURL=products-D_fcxfR0.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"products-Bs74ld-v.d.ts","names":[],"sources":["../src/interface/crud/products.ts"],"mappings":";;;;cAQa,yBAAA,EAAyB,KAAA,CAAA,YAAA;;;;iBAc1B,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,mBAAA,GAAsB,KAAA,CAAI,SAAS,QAAQ,yBAAA;AAAA,cAE1C,kCAAA,EAAkC,KAAA,CAAA,YAAA;;;;;;;;;;;;qBAMnC,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,4BAAA,GAA+B,KAAA,CAAI,SAAS,QAAQ,kCAAA;AAAA,KAEpD,2BAAA;EACV,aAAA;EACA,WAAA;EACA,MAAA;EACA,KAAA;AAAA"}
1
+ {"version":3,"file":"products-D_fcxfR0.d.ts","names":[],"sources":["../src/interface/crud/products.ts"],"mappings":";;;;cAQa,yBAAA,EAAyB,KAAA,CAAA,YAAA;;;;;;;iBAc1B,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,mBAAA,GAAsB,KAAA,CAAI,SAAS,QAAQ,yBAAA;AAAA,cAE1C,kCAAA,EAAkC,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;qBAMnC,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,4BAAA,GAA+B,KAAA,CAAI,SAAS,QAAQ,kCAAA;AAAA,KAEpD,2BAAA;EACV,aAAA;EACA,WAAA;EACA,MAAA;EACA,KAAA;AAAA"}
@@ -78,9 +78,9 @@ declare const userApiKeysCrud: CrudSchemaFromOptions<{
78
78
  is_public: undefined;
79
79
  user_id: undefined;
80
80
  }, "">, userApiKeysCreateOutputSchema: yup$1.ObjectSchema<{
81
- user_id: string;
82
- type: "user";
83
81
  description: string;
82
+ type: "user";
83
+ user_id: string;
84
84
  id: string;
85
85
  created_at_millis: number;
86
86
  expires_at_millis: number | undefined;
@@ -176,11 +176,11 @@ declare const teamApiKeysCrud: CrudSchemaFromOptions<{
176
176
  is_public: undefined;
177
177
  team_id: undefined;
178
178
  }, "">, teamApiKeysCreateOutputSchema: yup$1.ObjectSchema<{
179
- type: "team";
180
- team_id: string;
181
179
  description: string;
180
+ type: "team";
182
181
  id: string;
183
182
  created_at_millis: number;
183
+ team_id: string;
184
184
  expires_at_millis: number | undefined;
185
185
  manually_revoked_at_millis: number | undefined;
186
186
  is_public: boolean;
@@ -200,4 +200,4 @@ declare const teamApiKeysCrud: CrudSchemaFromOptions<{
200
200
  type TeamApiKeysCrud = CrudTypeOf<typeof teamApiKeysCrud>;
201
201
  //#endregion
202
202
  export { teamApiKeysCrud as a, userApiKeysCrud as c, teamApiKeysCreateOutputSchema as i, UserApiKeysCrud as n, userApiKeysCreateInputSchema as o, teamApiKeysCreateInputSchema as r, userApiKeysCreateOutputSchema as s, TeamApiKeysCrud as t };
203
- //# sourceMappingURL=project-api-keys--7V5X_UW.d.ts.map
203
+ //# sourceMappingURL=project-api-keys-OQqmKtMS.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-api-keys--7V5X_UW.d.ts","names":[],"sources":["../src/interface/crud/project-api-keys.ts"],"mappings":";;;;cAwFQ,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCACyC,KAAA,CAAA,YAAA;;;;;;;;;;yCACE,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;KAEvC,eAAA,GAAkB,UAAU,QAAQ,eAAA;AAAA,cAGxC,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCACyC,KAAA,CAAA,YAAA;;;;;;;;;;yCACE,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;KAEvC,eAAA,GAAkB,UAAU,QAAQ,eAAA"}
1
+ {"version":3,"file":"project-api-keys-OQqmKtMS.d.ts","names":[],"sources":["../src/interface/crud/project-api-keys.ts"],"mappings":";;;;cAwFQ,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCACyC,KAAA,CAAA,YAAA;;;;;;;;;;yCACE,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;KAEvC,eAAA,GAAkB,UAAU,QAAQ,eAAA;AAAA,cAGxC,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCACyC,KAAA,CAAA,YAAA;;;;;;;;;;yCACE,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;KAEvC,eAAA,GAAkB,UAAU,QAAQ,eAAA"}