@hexclave/shared 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +11 -37
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
- package/dist/config/schema.d.ts +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +11 -37
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
- package/dist/esm/config/schema.d.ts +1 -1
- package/dist/esm/interface/admin-metrics.d.ts +3 -3
- package/dist/esm/interface/conversations.d.ts +31 -31
- package/dist/esm/interface/crud/current-user.d.ts +6 -6
- package/dist/esm/interface/crud/email-outbox.d.ts +86 -86
- package/dist/esm/interface/crud/products.d.ts +4 -4
- package/dist/esm/interface/crud/project-api-keys.d.ts +4 -4
- package/dist/esm/interface/crud/team-member-profiles.d.ts +16 -16
- package/dist/esm/interface/crud/transactions.d.ts +2 -2
- package/dist/esm/interface/crud/users.d.ts +6 -6
- package/dist/esm/interface/server-interface.d.ts +1 -0
- package/dist/esm/interface/server-interface.d.ts.map +1 -1
- package/dist/esm/interface/server-interface.js +1 -0
- package/dist/esm/interface/server-interface.js.map +1 -1
- package/dist/esm/schema-fields.d.ts +1 -1
- package/dist/esm/sessions.d.ts +1 -1
- package/dist/interface/admin-metrics.d.ts +3 -3
- package/dist/interface/conversations.d.ts +31 -31
- package/dist/interface/crud/current-user.d.ts +6 -6
- package/dist/interface/crud/email-outbox.d.ts +86 -86
- package/dist/interface/crud/products.d.ts +4 -4
- package/dist/interface/crud/project-api-keys.d.ts +4 -4
- package/dist/interface/crud/team-member-profiles.d.ts +16 -16
- package/dist/interface/crud/transactions.d.ts +2 -2
- package/dist/interface/crud/users.d.ts +6 -6
- package/dist/interface/server-interface.d.ts +1 -0
- package/dist/interface/server-interface.d.ts.map +1 -1
- package/dist/interface/server-interface.js +1 -0
- package/dist/interface/server-interface.js.map +1 -1
- package/dist/schema-fields.d.ts +1 -1
- package/dist/sessions.d.ts +1 -1
- package/package.json +1 -1
- package/src/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.ts +11 -37
- package/src/interface/server-interface.ts +4 -0
|
@@ -164,21 +164,21 @@ declare const usersCrudServerReadSchema: yup$1.ObjectSchema<{
|
|
|
164
164
|
}, "">;
|
|
165
165
|
declare const usersCrudServerCreateSchema: yup$1.ObjectSchema<{
|
|
166
166
|
primary_email: string | null | undefined;
|
|
167
|
-
is_anonymous: boolean | undefined;
|
|
168
167
|
display_name: string | null | undefined;
|
|
169
168
|
client_metadata: {} | null | undefined;
|
|
170
169
|
client_read_only_metadata: {} | null | undefined;
|
|
171
170
|
server_metadata: {} | null | undefined;
|
|
171
|
+
is_anonymous: boolean | undefined;
|
|
172
172
|
password: string | null | undefined;
|
|
173
|
+
country_code: string | null | undefined;
|
|
174
|
+
profile_image_url: string | null | undefined;
|
|
173
175
|
primary_email_verified: boolean | undefined;
|
|
174
176
|
primary_email_auth_enabled: boolean | undefined;
|
|
175
|
-
profile_image_url: string | null | undefined;
|
|
176
177
|
otp_auth_enabled: boolean | undefined;
|
|
177
178
|
passkey_auth_enabled: boolean | undefined;
|
|
178
179
|
restricted_by_admin: boolean | undefined;
|
|
179
180
|
restricted_by_admin_reason: string | null | undefined;
|
|
180
181
|
restricted_by_admin_private_details: string | null | undefined;
|
|
181
|
-
country_code: string | null | undefined;
|
|
182
182
|
risk_scores: {
|
|
183
183
|
sign_up: {
|
|
184
184
|
bot: number;
|
|
@@ -370,21 +370,21 @@ declare const usersCrud: ______crud0.CrudSchemaFromOptions<{
|
|
|
370
370
|
}, "">;
|
|
371
371
|
serverCreateSchema: yup$1.ObjectSchema<{
|
|
372
372
|
primary_email: string | null | undefined;
|
|
373
|
-
is_anonymous: boolean | undefined;
|
|
374
373
|
display_name: string | null | undefined;
|
|
375
374
|
client_metadata: {} | null | undefined;
|
|
376
375
|
client_read_only_metadata: {} | null | undefined;
|
|
377
376
|
server_metadata: {} | null | undefined;
|
|
377
|
+
is_anonymous: boolean | undefined;
|
|
378
378
|
password: string | null | undefined;
|
|
379
|
+
country_code: string | null | undefined;
|
|
380
|
+
profile_image_url: string | null | undefined;
|
|
379
381
|
primary_email_verified: boolean | undefined;
|
|
380
382
|
primary_email_auth_enabled: boolean | undefined;
|
|
381
|
-
profile_image_url: string | null | undefined;
|
|
382
383
|
otp_auth_enabled: boolean | undefined;
|
|
383
384
|
passkey_auth_enabled: boolean | undefined;
|
|
384
385
|
restricted_by_admin: boolean | undefined;
|
|
385
386
|
restricted_by_admin_reason: string | null | undefined;
|
|
386
387
|
restricted_by_admin_private_details: string | null | undefined;
|
|
387
|
-
country_code: string | null | undefined;
|
|
388
388
|
risk_scores: {
|
|
389
389
|
sign_up: {
|
|
390
390
|
bot: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-interface.d.ts","names":[],"sources":["../../../src/interface/server-interface.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;KA4BY,4BAAA,IACR,sBAAA;EAAA,SAGW,eAAA;AAAA;EAAA,SAGA,mBAAA,EAAqB,eAAA,UAAyB,OAAA;AAAA;AAAA,cAKhD,uBAAA,SAAgC,uBAAA;EACf,OAAA,EAAS,4BAAA;cAAT,OAAA,EAAS,4BAAA;EAAA,UAIrB,iBAAA,CAAkB,IAAA,UAAc,OAAA,EAAS,WAAA,EAAa,OAAA,EAAS,eAAA,SAAwB,WAAA,wBAA0C,OAAA,CAAA,QAAA;;;;;;EAgBlI,kBAAA,CACb,YAAA,mBACA,UAAA,UACA,OAAA,EAAS,eAAA,UACR,OAAA;IACD,YAAA;IACA,sBAAA;MACE,E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OAAA,EAAS,eAAA,UACR,OAAA,CAAQ,sBAAA;EAaL,eAAA,CAAgB,OAAA;IAElB,MAAA;IACA,KAAA;IACA,OAAA;IACA,IAAA;IACA,KAAA;IACA,iBAAA;IACA,MAAA;EAAA;IAIE,gBAAA;IACA,aAAA;EAAA;IAGA,gBAAA;IACA,aAAA;EAAA,MAGF,OAAA,CAAQ,SAAA;
|
|
1
|
+
{"version":3,"file":"server-interface.d.ts","names":[],"sources":["../../../src/interface/server-interface.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;KA4BY,4BAAA,IACR,sBAAA;EAAA,SAGW,eAAA;AAAA;EAAA,SAGA,mBAAA,EAAqB,eAAA,UAAyB,OAAA;AAAA;AAAA,cAKhD,uBAAA,SAAgC,uBAAA;EACf,OAAA,EAAS,4BAAA;cAAT,OAAA,EAAS,4BAAA;EAAA,UAIrB,iBAAA,CAAkB,IAAA,UAAc,OAAA,EAAS,WAAA,EAAa,OAAA,EAAS,eAAA,SAAwB,WAAA,wBAA0C,OAAA,CAAA,QAAA;;;;;;EAgBlI,kBAAA,CACb,YAAA,mBACA,UAAA,UACA,OAAA,EAAS,eAAA,UACR,OAAA;IACD,YAAA;IACA,sBAAA;MACE,EAAA;MACA,KAAA;MACA,KAAA;MACA,SAAA;MACA,QAAA;IAAA;EAAA;EAWW,sCAAA,CACb,YAAA,mBACA,UAAA,UACA,OAAA,EAAS,eAAA,UACR,OAAA;IACD,aAAA;IACA,iBAAA;EAAA;EAgBa,8CAAA,CACb,YAAA,mBACA,UAAA,UACA,aAAA,UACA,OAAA,EAAS,eAAA,UACR,OAAA;IACD,sBAAA;MACE,EAAA;MACA,KAAA;MACA,KAAA;MACA,SAAA;MACA,QAAA;IAAA;EAAA;EAAA,UAoBY,mCAAA,kBAAqD,WAAA,OAAkB,WAAA,EAAA,CACrF,IAAA,UACA,cAAA,EAAgB,WAAA,EAChB,gBAAA,EAAkB,eAAA,SAClB,aAAA,WAAwB,CAAA,KACvB,OAAA,CAAQ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,IAAA;EAAA,IACZ,OAAA,CAAQ,MAAA,OAAa,WAAA,gCAA2C,WAAA,kBAA6B,WAAA;EA0B3F,oBAAA,CAAA,GAAwB,OAAA;IAC5B,KAAA;MACE,IAAA;QAAQ,IAAA;QAAc,OAAA;QAAiB,cAAA;MAAA;MACvC,GAAA;QAAO,IAAA;QAAc,OAAA;QAAiB,cAAA;MAAA;MACtC,IAAA;QAAQ,IAAA;QAAc,OAAA;QAAiB,cAAA;MAAA;MACvC,KAAA;QAAS,IAAA;QAAc,OAAA;QAAiB,cAAA;MAAA;IAAA;IAE1C,QAAA;MACE,eAAA;MACA,gBAAA;MACA,cAAA;MACA,eAAA;MACA,gBAAA;IAAA;EAAA;EAgBE,0BAAA,CAAA,GAA8B,OAAA;IAAU,UAAA;EAAA;EAexC,kBAAA,CACJ,OAAA;IACI,MAAA;IAAgB,MAAA;EAAA;IAChB,MAAA;IAAgB,MAAA;EAAA;IAChB,MAAA;IAAgB,gBAAA;EAAA,IAEpB,IAAA,EAAM,QAAA,uBACL,OAAA;EA8BG,YAAA,CACJ,OAAA;IACE,YAAA;IACA,UAAA;IACA,SAAA;IACA,OAAA,GAAU,KAAA,CAAI,SAAA,QAAiB,mBAAA;IAC/B,QAAA;EAAA,IAED,OAAA;EAuBG,sBAAA,CAAuB,MAAA,UAAgB,OAAA,UAAiB,GAAA,WAAW,OAAA;EAyBnE,sBAAA,CAAuB,MAAA,UAAgB,OAAA,UAAiB,GAAA,UAAa,KAAA,WAAa,OAAA;EAclF,iCAAA,CAAkC,MAAA,WAAiB,OAAA,CAAQ,MAAA;IAAS,YAAA;IAAmB,IAAA;EAAA,GAAgB,WAAA;AAAA"}
|
|
@@ -104,6 +104,7 @@ var HexclaveServerInterface = class extends HexclaveClientInterface {
|
|
|
104
104
|
lastActiveAt: "last_active_at"
|
|
105
105
|
}[options.orderBy] } : {},
|
|
106
106
|
...options.query ? { query: options.query } : {},
|
|
107
|
+
...options.excludedEmailDomains && options.excludedEmailDomains.length > 0 ? { excluded_email_domains: options.excludedEmailDomains.join(",") } : {},
|
|
107
108
|
...options.includeRestricted ? { include_restricted: "true" } : {},
|
|
108
109
|
...options.includeAnonymous ? { include_anonymous: "true" } : {},
|
|
109
110
|
...options.onlyAnonymous ? { only_anonymous: "true" } : {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-interface.js","names":[],"sources":["../../../src/interface/server-interface.ts"],"sourcesContent":["import * as yup from \"yup\";\nimport { decryptValue, encryptValue, hashKey } from \"../helpers/vault/client-side\";\nimport { KnownErrors } from \"../known-errors\";\nimport { inlineProductSchema } from \"../schema-fields\";\nimport { AccessToken, InternalSession, RefreshToken } from \"../sessions\";\nimport { HexclaveAssertionError } from \"../utils/errors\";\nimport { filterUndefined } from \"../utils/objects\";\nimport { Result } from \"../utils/results\";\nimport { urlString } from \"../utils/urls\";\nimport {\n ClientInterfaceOptions,\n HexclaveClientInterface\n} from \"./client-interface\";\nimport { ConnectedAccountAccessTokenCrud, ConnectedAccountCrud } from \"./crud/connected-accounts\";\nimport { ContactChannelsCrud } from \"./crud/contact-channels\";\nimport { CurrentUserCrud } from \"./crud/current-user\";\nimport { ItemCrud } from \"./crud/items\";\nimport { NotificationPreferenceCrud } from \"./crud/notification-preferences\";\nimport { OAuthProviderCrud } from \"./crud/oauth-providers\";\nimport { ProjectPermissionsCrud } from \"./crud/project-permissions\";\nimport { SessionsCrud } from \"./crud/sessions\";\nimport { TeamInvitationCrud } from \"./crud/team-invitation\";\nimport { TeamMemberProfilesCrud } from \"./crud/team-member-profiles\";\nimport { TeamMembershipsCrud } from \"./crud/team-memberships\";\nimport { TeamPermissionsCrud } from \"./crud/team-permissions\";\nimport { TeamsCrud } from \"./crud/teams\";\nimport { UsersCrud } from \"./crud/users\";\n\nexport type ServerAuthApplicationOptions = (\n & ClientInterfaceOptions\n & (\n | {\n readonly secretServerKey: string,\n }\n | {\n readonly projectOwnerSession: InternalSession | (() => Promise<string | null>),\n }\n )\n);\n\nexport class HexclaveServerInterface extends HexclaveClientInterface {\n constructor(public override options: ServerAuthApplicationOptions) {\n super(options);\n }\n\n protected async sendServerRequest(path: string, options: RequestInit, session: InternalSession | null, requestType: \"server\" | \"admin\" = \"server\") {\n return await this.sendClientRequest(\n path,\n {\n ...options,\n headers: {\n // Hexclave rebrand: emit x-hexclave-* request header; the backend proxy dual-accepts both names.\n \"x-hexclave-secret-server-key\": \"secretServerKey\" in this.options ? this.options.secretServerKey : \"\",\n ...options.headers,\n },\n },\n session,\n requestType,\n );\n }\n\n override async getCustomerBilling(\n customerType: \"user\" | \"team\",\n customerId: string,\n session: InternalSession | null,\n ): Promise<{\n has_customer: boolean,\n default_payment_method: {\n id: string,\n brand: string | null,\n last4: string | null,\n exp_month: number | null,\n exp_year: number | null,\n } | null,\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/billing/${customerType}/${customerId}`,\n {},\n session,\n );\n return await response.json();\n }\n\n override async createCustomerPaymentMethodSetupIntent(\n customerType: \"user\" | \"team\",\n customerId: string,\n session: InternalSession | null,\n ): Promise<{\n client_secret: string,\n stripe_account_id: string,\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/payment-method/${customerType}/${customerId}/setup-intent`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n session,\n );\n return await response.json();\n }\n\n override async setDefaultCustomerPaymentMethodFromSetupIntent(\n customerType: \"user\" | \"team\",\n customerId: string,\n setupIntentId: string,\n session: InternalSession | null,\n ): Promise<{\n default_payment_method: {\n id: string,\n brand: string | null,\n last4: string | null,\n exp_month: number | null,\n exp_year: number | null,\n },\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/payment-method/${customerType}/${customerId}/set-default`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n setup_intent_id: setupIntentId,\n }),\n },\n session,\n );\n return await response.json();\n }\n\n\n protected async sendServerRequestAndCatchKnownError<E extends typeof KnownErrors[keyof KnownErrors]>(\n path: string,\n requestOptions: RequestInit,\n tokenStoreOrNull: InternalSession | null,\n errorsToCatch: readonly E[],\n ): Promise<Result<\n Response & {\n usedTokens: {\n accessToken: AccessToken,\n refreshToken: RefreshToken | null,\n } | null,\n },\n InstanceType<E>\n >> {\n try {\n return Result.ok(await this.sendServerRequest(path, requestOptions, tokenStoreOrNull));\n } catch (e) {\n for (const errorType of errorsToCatch) {\n if (errorType.isInstance(e)) {\n return Result.error(e as InstanceType<E>);\n }\n }\n throw e;\n }\n }\n\n async createServerUser(data: UsersCrud['Server']['Create']): Promise<UsersCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/users\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async getServerUserByToken(session: InternalSession): Promise<CurrentUserCrud['Server']['Read'] | null> {\n const responseOrError = await this.sendServerRequestAndCatchKnownError(\n \"/users/me\",\n {},\n session,\n [KnownErrors.CannotGetOwnUserWithoutUser],\n );\n if (responseOrError.status === \"error\") {\n if (KnownErrors.CannotGetOwnUserWithoutUser.isInstance(responseOrError.error)) {\n return null;\n } else {\n throw new HexclaveAssertionError(\"Unexpected uncaught error\", { cause: responseOrError.error });\n }\n }\n const response = responseOrError.data;\n const user: CurrentUserCrud['Server']['Read'] = await response.json();\n if (!(user as any)) throw new HexclaveAssertionError(\"User endpoint returned null; this should never happen\");\n return user;\n }\n\n async getServerUserById(userId: string): Promise<Result<UsersCrud['Server']['Read']>> {\n const responseOrError = await this.sendServerRequestAndCatchKnownError(\n urlString`/users/${userId}`,\n {},\n null,\n [KnownErrors.UserNotFound],\n );\n if (responseOrError.status === \"error\") {\n return Result.error(responseOrError.error);\n }\n const user: UsersCrud['Server']['Read'] = await responseOrError.data.json();\n return Result.ok(user);\n }\n\n async listServerTeamInvitations(options: {\n teamId: string,\n }): Promise<TeamInvitationCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/team-invitations?team_id=${options.teamId}`,\n {},\n null,\n );\n const result = await response.json() as TeamInvitationCrud['Server']['List'];\n return result.items;\n }\n\n async revokeServerTeamInvitation(invitationId: string, teamId: string) {\n await this.sendServerRequest(\n urlString`/team-invitations/${invitationId}?team_id=${teamId}`,\n { method: \"DELETE\" },\n null,\n );\n }\n\n async listServerTeamMemberProfiles(\n options: {\n teamId: string,\n },\n ): Promise<TeamMemberProfilesCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/team-member-profiles?team_id=${options.teamId}`,\n {},\n null,\n );\n const result = await response.json() as TeamMemberProfilesCrud['Server']['List'];\n return result.items;\n }\n\n async getServerTeamMemberProfile(\n options: {\n teamId: string,\n userId: string,\n },\n ): Promise<TeamMemberProfilesCrud['Client']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/team-member-profiles/${options.teamId}/${options.userId}`,\n {},\n null,\n );\n return await response.json();\n }\n\n async listServerTeamPermissions(\n options: {\n userId?: string,\n teamId?: string,\n recursive: boolean,\n },\n session: InternalSession | null,\n ): Promise<TeamPermissionsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n `/team-permissions?${new URLSearchParams(filterUndefined({\n user_id: options.userId,\n team_id: options.teamId,\n recursive: options.recursive.toString(),\n }))}`,\n {},\n session,\n );\n const result = await response.json() as TeamPermissionsCrud['Server']['List'];\n return result.items;\n }\n\n async listServerProjectPermissions(\n options: {\n userId?: string,\n recursive: boolean,\n },\n session: InternalSession | null,\n ): Promise<ProjectPermissionsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n `/project-permissions?${new URLSearchParams(filterUndefined({\n user_id: options.userId,\n recursive: options.recursive.toString(),\n }))}`,\n {},\n session,\n );\n const result = await response.json() as ProjectPermissionsCrud['Server']['List'];\n return result.items;\n }\n\n async listServerUsers(options: (\n & {\n cursor?: string,\n limit?: number,\n orderBy?: 'signedUpAt' | 'lastActiveAt',\n desc?: boolean,\n query?: string,\n includeRestricted?: boolean,\n teamId?: string,\n }\n & (\n {\n includeAnonymous?: boolean,\n onlyAnonymous?: false,\n }\n | {\n includeAnonymous: true,\n onlyAnonymous: true,\n }\n )\n )): Promise<UsersCrud['Server']['List']> {\n const searchParams = new URLSearchParams(filterUndefined({\n cursor: options.cursor,\n limit: options.limit?.toString(),\n desc: options.desc?.toString(),\n team_id: options.teamId,\n ...options.orderBy ? {\n order_by: {\n signedUpAt: \"signed_up_at\",\n lastActiveAt: \"last_active_at\",\n }[options.orderBy],\n } : {},\n ...options.query ? {\n query: options.query,\n } : {},\n ...options.includeRestricted ? {\n include_restricted: 'true',\n } : {},\n ...options.includeAnonymous ? {\n include_anonymous: 'true',\n } : {},\n ...options.onlyAnonymous ? {\n only_anonymous: 'true',\n } : {},\n }));\n const response = await this.sendServerRequest(\"/users?\" + searchParams.toString(), {}, null);\n return await response.json();\n }\n\n async listServerTeams(options?: {\n userId?: string,\n }): Promise<TeamsCrud['Server']['Read'][]> {\n const result = await this.listServerTeamsPaginated(options);\n return result.items;\n }\n\n async listServerTeamsPaginated(options?: {\n userId?: string,\n orderBy?: 'createdAt',\n desc?: boolean,\n cursor?: string,\n limit?: number,\n query?: string,\n }): Promise<TeamsCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n `/teams?${new URLSearchParams(filterUndefined({\n user_id: options?.userId,\n // SDK option uses camelCase `createdAt`; backend uses snake_case.\n order_by: options?.orderBy === 'createdAt' ? 'created_at' : options?.orderBy,\n desc: options?.desc !== undefined ? String(options.desc) : undefined,\n cursor: options?.cursor,\n limit: options?.limit?.toString(),\n query: options?.query,\n }))}`,\n {},\n null\n );\n return await response.json() as TeamsCrud['Server']['List'];\n }\n\n async getServerTeam(teamId: string): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n `/teams/${teamId}`,\n {},\n null\n );\n return await response.json();\n }\n\n async listServerTeamUsers(teamId: string): Promise<UsersCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(`/users?team_id=${teamId}`, {}, null);\n const result = await response.json() as UsersCrud['Server']['List'];\n return result.items;\n }\n\n /* when passing a session, the user will be added to the team */\n async createServerTeam(data: TeamsCrud['Server']['Create']): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/teams\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null\n );\n return await response.json();\n }\n\n async updateServerTeam(teamId: string, data: TeamsCrud['Server']['Update']): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/teams/${teamId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerTeam(teamId: string): Promise<void> {\n await this.sendServerRequest(\n urlString`/teams/${teamId}`,\n { method: \"DELETE\" },\n null,\n );\n }\n\n async addServerUserToTeam(options: {\n userId: string,\n teamId: string,\n }): Promise<TeamMembershipsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n return await response.json();\n }\n\n async removeServerUserFromTeam(options: {\n userId: string,\n teamId: string,\n }) {\n await this.sendServerRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async listServerUserTeamInvitations(userId: string): Promise<TeamInvitationCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n \"/team-invitations?\" + new URLSearchParams({ user_id: userId }),\n {},\n null,\n );\n const result = await response.json() as TeamInvitationCrud['Server']['List'];\n return result.items;\n }\n\n async acceptServerTeamInvitationById(\n invitationId: string,\n userId: string,\n ) {\n await this.sendServerRequest(\n urlString`/team-invitations/${invitationId}/accept` + \"?\" + new URLSearchParams({ user_id: userId }),\n { method: \"POST\" },\n null,\n );\n }\n\n async updateServerUser(userId: string, update: UsersCrud['Server']['Update']): Promise<UsersCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/users/${userId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(update),\n },\n null,\n );\n return await response.json();\n }\n\n async createServerProviderAccessToken(\n userId: string,\n provider: string,\n scope: string,\n ): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}/${provider}/access-token`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ scope }),\n },\n null,\n );\n return await response.json();\n }\n\n /**\n * Get access token for a specific connected account by provider ID and provider account ID.\n * This is the preferred method when dealing with multiple accounts of the same provider.\n */\n async createServerProviderAccessTokenByAccount(\n userId: string,\n providerId: string,\n providerAccountId: string,\n scope: string,\n ): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}/${providerId}/${providerAccountId}/access-token`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ scope }),\n },\n null,\n );\n return await response.json();\n }\n\n /**\n * List all connected accounts for a user.\n */\n async listServerConnectedAccounts(\n userId: string,\n ): Promise<ConnectedAccountCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}`,\n { method: \"GET\" },\n null,\n );\n return await response.json();\n }\n\n async createServerUserSession(userId: string, expiresInMillis: number, isImpersonation: boolean): Promise<{ accessToken: string, refreshToken: string }> {\n const response = await this.sendServerRequest(\n \"/auth/sessions\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n user_id: userId,\n expires_in_millis: expiresInMillis,\n is_impersonation: isImpersonation,\n }),\n },\n null,\n );\n const result = await response.json();\n return {\n accessToken: result.access_token,\n refreshToken: result.refresh_token,\n };\n }\n\n async leaveServerTeam(\n options: {\n teamId: string,\n userId: string,\n },\n ) {\n await this.sendClientRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async updateServerTeamMemberProfile(options: {\n teamId: string,\n userId: string,\n profile: TeamMemberProfilesCrud['Server']['Update'],\n }) {\n await this.sendServerRequest(\n urlString`/team-member-profiles/${options.teamId}/${options.userId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(options.profile),\n },\n null,\n );\n }\n\n async grantServerTeamUserPermission(teamId: string, userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async grantServerProjectPermission(userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/project-permissions/${userId}/${permissionId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async revokeServerTeamUserPermission(teamId: string, userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async revokeServerProjectPermission(userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/project-permissions/${userId}/${permissionId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async deleteServerUser(userId: string) {\n await this.sendServerRequest(\n urlString`/users/${userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async createServerContactChannel(\n data: ContactChannelsCrud['Server']['Create'],\n ): Promise<ContactChannelsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/contact-channels\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async updateServerContactChannel(\n userId: string,\n contactChannelId: string,\n data: ContactChannelsCrud['Server']['Update'],\n ): Promise<ContactChannelsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerContactChannel(\n userId: string,\n contactChannelId: string,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n }\n\n async listServerContactChannels(\n userId: string,\n ): Promise<ContactChannelsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/contact-channels?user_id=${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n const json = await response.json() as ContactChannelsCrud['Server']['List'];\n return json.items;\n }\n\n async listServerNotificationCategories(\n userId: string,\n ): Promise<NotificationPreferenceCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/emails/notification-preference/${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n const json = await response.json() as NotificationPreferenceCrud['Server']['List'];\n return json.items;\n }\n\n async setServerNotificationsEnabled(\n userId: string,\n notificationCategoryId: string,\n enabled: boolean,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/emails/notification-preference/${userId}/${notificationCategoryId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n enabled,\n }),\n },\n null,\n );\n }\n\n async sendServerContactChannelVerificationEmail(\n userId: string,\n contactChannelId: string,\n callbackUrl: string,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}/send-verification-code`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ callback_url: callbackUrl }),\n },\n null,\n );\n }\n\n\n async listServerSessions(userId: string): Promise<SessionsCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n urlString`/auth/sessions?user_id=${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerSession(sessionId: string) {\n await this.sendServerRequest(\n urlString`/auth/sessions/${sessionId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n }\n\n\n async sendServerTeamInvitation(options: {\n email: string,\n teamId: string,\n callbackUrl: string,\n }): Promise<void> {\n await this.sendServerRequest(\n \"/team-invitations/send-code\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n email: options.email,\n team_id: options.teamId,\n callback_url: options.callbackUrl,\n }),\n },\n null,\n );\n }\n\n async updatePassword(\n options: { oldPassword: string, newPassword: string },\n ): Promise<KnownErrors[\"PasswordConfirmationMismatch\"] | KnownErrors[\"PasswordRequirementsNotMet\"] | undefined> {\n const res = await this.sendServerRequestAndCatchKnownError(\n \"/auth/password/update\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n old_password: options.oldPassword,\n new_password: options.newPassword,\n }),\n },\n null,\n [KnownErrors.PasswordConfirmationMismatch, KnownErrors.PasswordRequirementsNotMet]\n );\n\n if (res.status === \"error\") {\n return res.error;\n }\n }\n\n // OAuth Providers CRUD operations\n async createServerOAuthProvider(\n data: OAuthProviderCrud['Server']['Create'],\n ): Promise<OAuthProviderCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/oauth-providers\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n\n async listServerOAuthProviders(\n options: {\n user_id?: string,\n } = {},\n ): Promise<OAuthProviderCrud['Server']['Read'][]> {\n const queryParams = new URLSearchParams(filterUndefined(options));\n const response = await this.sendServerRequest(\n `/oauth-providers${queryParams.toString() ? `?${queryParams.toString()}` : ''}`,\n {\n method: \"GET\",\n },\n null,\n );\n const result = await response.json();\n return result.items;\n }\n\n async updateServerOAuthProvider(\n userId: string,\n providerId: string,\n data: OAuthProviderCrud['Server']['Update'],\n ): Promise<OAuthProviderCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/oauth-providers/${userId}/${providerId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerOAuthProvider(\n userId: string,\n providerId: string,\n ): Promise<void> {\n const response = await this.sendServerRequest(\n urlString`/oauth-providers/${userId}/${providerId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n return await response.json();\n }\n\n async sendEmail(options: {\n userIds?: string[],\n allUsers?: true,\n themeId?: string | null | false,\n html?: string,\n subject?: string,\n notificationCategoryName?: string,\n templateId?: string,\n variables?: Record<string, any>,\n draftId?: string,\n scheduledAt?: Date,\n }): Promise<Result<void, KnownErrors[\"RequiresCustomEmailServer\"] | KnownErrors[\"SchemaError\"] | KnownErrors[\"UserIdDoesNotExist\"]>> {\n const res = await this.sendServerRequest(\n \"/emails/send-email\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n user_ids: options.userIds,\n all_users: options.allUsers,\n theme_id: options.themeId,\n html: options.html,\n subject: options.subject,\n notification_category_name: options.notificationCategoryName,\n template_id: options.templateId,\n variables: options.variables,\n draft_id: options.draftId,\n scheduled_at_millis: options.scheduledAt?.getTime(),\n }),\n },\n null,\n );\n return Result.ok(undefined);\n }\n\n async getEmailDeliveryInfo(): Promise<{\n stats: {\n hour: { sent: number, bounced: number, marked_as_spam: number },\n day: { sent: number, bounced: number, marked_as_spam: number },\n week: { sent: number, bounced: number, marked_as_spam: number },\n month: { sent: number, bounced: number, marked_as_spam: number },\n },\n capacity: {\n rate_per_second: number,\n boost_multiplier: number,\n penalty_factor: number,\n is_boost_active: boolean,\n boost_expires_at: string | null,\n },\n }> {\n const res = await this.sendServerRequest(\n \"/emails/delivery-info\",\n {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n },\n null,\n );\n return await res.json();\n }\n\n async activateEmailCapacityBoost(): Promise<{ expires_at: string }> {\n const res = await this.sendServerRequest(\n \"/emails/capacity-boost\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({}),\n },\n null,\n );\n return await res.json();\n }\n\n async updateItemQuantity(\n options: (\n { itemId: string, userId: string } |\n { itemId: string, teamId: string } |\n { itemId: string, customCustomerId: string }\n ),\n data: ItemCrud['Server']['Update'],\n ): Promise<void> {\n let customerType: \"user\" | \"team\" | \"custom\";\n let customerId: string;\n const itemId: string = options.itemId;\n\n if (\"userId\" in options) {\n customerType = \"user\";\n customerId = options.userId;\n } else if (\"teamId\" in options) {\n customerType = \"team\";\n customerId = options.teamId;\n } else if (\"customCustomerId\" in options) {\n customerType = \"custom\";\n customerId = options.customCustomerId;\n } else {\n throw new HexclaveAssertionError(\"updateItemQuantity requires one of userId, teamId, or customCustomerId\");\n }\n\n const queryParams = new URLSearchParams({ allow_negative: (data.allow_negative ?? false).toString() });\n await this.sendServerRequest(\n `/payments/items/${customerType}/${customerId}/${itemId}/update-quantity?${queryParams.toString()}`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ delta: data.delta, expires_at: data.expires_at, description: data.description }),\n },\n null\n );\n }\n\n async grantProduct(\n options: {\n customerType: \"user\" | \"team\" | \"custom\",\n customerId: string,\n productId?: string,\n product?: yup.InferType<typeof inlineProductSchema>,\n quantity?: number,\n },\n ): Promise<void> {\n if (!options.productId && !options.product) {\n throw new HexclaveAssertionError(\"grantProduct requires either productId or product\");\n }\n if (options.productId && options.product) {\n throw new HexclaveAssertionError(\"grantProduct should not receive both productId and product\");\n }\n const body = filterUndefined({\n product_id: options.productId,\n product_inline: options.product,\n quantity: options.quantity,\n });\n await this.sendServerRequest(\n urlString`/payments/products/${options.customerType}/${options.customerId}`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(body),\n },\n null,\n );\n }\n\n async getDataVaultStoreValue(secret: string, storeId: string, key: string) {\n const hashedKey = await hashKey(secret, key);\n const response = await this.sendServerRequestAndCatchKnownError(\n `/data-vault/stores/${storeId}/get`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ hashed_key: hashedKey }),\n },\n null,\n [KnownErrors.DataVaultStoreHashedKeyDoesNotExist] as const,\n );\n if (response.status === \"error\") {\n if (KnownErrors.DataVaultStoreHashedKeyDoesNotExist.isInstance(response.error)) {\n return null;\n } else {\n throw new HexclaveAssertionError(\"Unexpected uncaught error\", { cause: response.error });\n }\n }\n const json = await response.data.json();\n const encryptedValue = json.encrypted_value;\n if (typeof encryptedValue !== \"string\") throw new HexclaveAssertionError(\"encrypted_value is not a string\", { type: typeof encryptedValue });\n return await decryptValue(secret, key, encryptedValue);\n }\n\n async setDataVaultStoreValue(secret: string, storeId: string, key: string, value: string) {\n const hashedKey = await hashKey(secret, key);\n const encryptedValue = await encryptValue(secret, key, value);\n await this.sendServerRequest(\n `/data-vault/stores/${storeId}/set`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ hashed_key: hashedKey, encrypted_value: encryptedValue }),\n },\n null,\n );\n }\n\n async initiateServerPasskeyRegistration(userId: string): Promise<Result<{ options_json: any, code: string }, KnownErrors[]>> {\n // Create a temporary session for this user to use for passkey registration\n // TODO instead of creating a new session, this should just call the endpoint in a way in which it doesn't require a session\n // (currently this shows up on session history etc... not ideal)\n const { accessToken, refreshToken } = await this.createServerUserSession(userId, 60000 * 2, false); // 2 minute session\n const tempSession = new InternalSession({\n accessToken,\n refreshToken,\n refreshAccessTokenCallback: async () => null, // No refresh for temporary sessions\n });\n\n // Use the existing initiatePasskeyRegistration method with the temporary session\n return await this.initiatePasskeyRegistration({}, tempSession);\n }\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAa,0BAAb,cAA6C,wBAAwB;CACnE,YAAY,AAAgB,SAAuC;AACjE,QAAM,QAAQ;EADY;;CAI5B,MAAgB,kBAAkB,MAAc,SAAsB,SAAiC,cAAkC,UAAU;AACjJ,SAAO,MAAM,KAAK,kBAChB,MACA;GACE,GAAG;GACH,SAAS;IAEP,gCAAgC,qBAAqB,KAAK,UAAU,KAAK,QAAQ,kBAAkB;IACnG,GAAG,QAAQ;IACZ;GACF,EACD,SACA,YACD;;CAGH,MAAe,mBACb,cACA,YACA,SAUC;AAMD,SAAO,OALU,MAAM,KAAK,kBAC1B,SAAS,qBAAqB,aAAa,GAAG,cAC9C,EAAE,EACF,QACD,EACqB,MAAM;;CAG9B,MAAe,uCACb,cACA,YACA,SAIC;AAYD,SAAO,OAXU,MAAM,KAAK,kBAC1B,SAAS,4BAA4B,aAAa,GAAG,WAAW,gBAChE;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,oBACjB;GACD,MAAM,KAAK,UAAU,EAAE,CAAC;GACzB,EACD,QACD,EACqB,MAAM;;CAG9B,MAAe,+CACb,cACA,YACA,eACA,SASC;AAcD,SAAO,OAbU,MAAM,KAAK,kBAC1B,SAAS,4BAA4B,aAAa,GAAG,WAAW,eAChE;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,oBACjB;GACD,MAAM,KAAK,UAAU,EACnB,iBAAiB,eAClB,CAAC;GACH,EACD,QACD,EACqB,MAAM;;CAI9B,MAAgB,oCACd,MACA,gBACA,kBACA,eASC;AACD,MAAI;AACF,UAAO,OAAO,GAAG,MAAM,KAAK,kBAAkB,MAAM,gBAAgB,iB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;GACA,4BAA4B,YAAY;GACzC,CAAC;AAGF,SAAO,MAAM,KAAK,4BAA4B,EAAE,EAAE,YAAY"}
|
|
1
|
+
{"version":3,"file":"server-interface.js","names":[],"sources":["../../../src/interface/server-interface.ts"],"sourcesContent":["import * as yup from \"yup\";\nimport { decryptValue, encryptValue, hashKey } from \"../helpers/vault/client-side\";\nimport { KnownErrors } from \"../known-errors\";\nimport { inlineProductSchema } from \"../schema-fields\";\nimport { AccessToken, InternalSession, RefreshToken } from \"../sessions\";\nimport { HexclaveAssertionError } from \"../utils/errors\";\nimport { filterUndefined } from \"../utils/objects\";\nimport { Result } from \"../utils/results\";\nimport { urlString } from \"../utils/urls\";\nimport {\n ClientInterfaceOptions,\n HexclaveClientInterface\n} from \"./client-interface\";\nimport { ConnectedAccountAccessTokenCrud, ConnectedAccountCrud } from \"./crud/connected-accounts\";\nimport { ContactChannelsCrud } from \"./crud/contact-channels\";\nimport { CurrentUserCrud } from \"./crud/current-user\";\nimport { ItemCrud } from \"./crud/items\";\nimport { NotificationPreferenceCrud } from \"./crud/notification-preferences\";\nimport { OAuthProviderCrud } from \"./crud/oauth-providers\";\nimport { ProjectPermissionsCrud } from \"./crud/project-permissions\";\nimport { SessionsCrud } from \"./crud/sessions\";\nimport { TeamInvitationCrud } from \"./crud/team-invitation\";\nimport { TeamMemberProfilesCrud } from \"./crud/team-member-profiles\";\nimport { TeamMembershipsCrud } from \"./crud/team-memberships\";\nimport { TeamPermissionsCrud } from \"./crud/team-permissions\";\nimport { TeamsCrud } from \"./crud/teams\";\nimport { UsersCrud } from \"./crud/users\";\n\nexport type ServerAuthApplicationOptions = (\n & ClientInterfaceOptions\n & (\n | {\n readonly secretServerKey: string,\n }\n | {\n readonly projectOwnerSession: InternalSession | (() => Promise<string | null>),\n }\n )\n);\n\nexport class HexclaveServerInterface extends HexclaveClientInterface {\n constructor(public override options: ServerAuthApplicationOptions) {\n super(options);\n }\n\n protected async sendServerRequest(path: string, options: RequestInit, session: InternalSession | null, requestType: \"server\" | \"admin\" = \"server\") {\n return await this.sendClientRequest(\n path,\n {\n ...options,\n headers: {\n // Hexclave rebrand: emit x-hexclave-* request header; the backend proxy dual-accepts both names.\n \"x-hexclave-secret-server-key\": \"secretServerKey\" in this.options ? this.options.secretServerKey : \"\",\n ...options.headers,\n },\n },\n session,\n requestType,\n );\n }\n\n override async getCustomerBilling(\n customerType: \"user\" | \"team\",\n customerId: string,\n session: InternalSession | null,\n ): Promise<{\n has_customer: boolean,\n default_payment_method: {\n id: string,\n brand: string | null,\n last4: string | null,\n exp_month: number | null,\n exp_year: number | null,\n } | null,\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/billing/${customerType}/${customerId}`,\n {},\n session,\n );\n return await response.json();\n }\n\n override async createCustomerPaymentMethodSetupIntent(\n customerType: \"user\" | \"team\",\n customerId: string,\n session: InternalSession | null,\n ): Promise<{\n client_secret: string,\n stripe_account_id: string,\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/payment-method/${customerType}/${customerId}/setup-intent`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n session,\n );\n return await response.json();\n }\n\n override async setDefaultCustomerPaymentMethodFromSetupIntent(\n customerType: \"user\" | \"team\",\n customerId: string,\n setupIntentId: string,\n session: InternalSession | null,\n ): Promise<{\n default_payment_method: {\n id: string,\n brand: string | null,\n last4: string | null,\n exp_month: number | null,\n exp_year: number | null,\n },\n }> {\n const response = await this.sendServerRequest(\n urlString`/payments/payment-method/${customerType}/${customerId}/set-default`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n setup_intent_id: setupIntentId,\n }),\n },\n session,\n );\n return await response.json();\n }\n\n\n protected async sendServerRequestAndCatchKnownError<E extends typeof KnownErrors[keyof KnownErrors]>(\n path: string,\n requestOptions: RequestInit,\n tokenStoreOrNull: InternalSession | null,\n errorsToCatch: readonly E[],\n ): Promise<Result<\n Response & {\n usedTokens: {\n accessToken: AccessToken,\n refreshToken: RefreshToken | null,\n } | null,\n },\n InstanceType<E>\n >> {\n try {\n return Result.ok(await this.sendServerRequest(path, requestOptions, tokenStoreOrNull));\n } catch (e) {\n for (const errorType of errorsToCatch) {\n if (errorType.isInstance(e)) {\n return Result.error(e as InstanceType<E>);\n }\n }\n throw e;\n }\n }\n\n async createServerUser(data: UsersCrud['Server']['Create']): Promise<UsersCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/users\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async getServerUserByToken(session: InternalSession): Promise<CurrentUserCrud['Server']['Read'] | null> {\n const responseOrError = await this.sendServerRequestAndCatchKnownError(\n \"/users/me\",\n {},\n session,\n [KnownErrors.CannotGetOwnUserWithoutUser],\n );\n if (responseOrError.status === \"error\") {\n if (KnownErrors.CannotGetOwnUserWithoutUser.isInstance(responseOrError.error)) {\n return null;\n } else {\n throw new HexclaveAssertionError(\"Unexpected uncaught error\", { cause: responseOrError.error });\n }\n }\n const response = responseOrError.data;\n const user: CurrentUserCrud['Server']['Read'] = await response.json();\n if (!(user as any)) throw new HexclaveAssertionError(\"User endpoint returned null; this should never happen\");\n return user;\n }\n\n async getServerUserById(userId: string): Promise<Result<UsersCrud['Server']['Read']>> {\n const responseOrError = await this.sendServerRequestAndCatchKnownError(\n urlString`/users/${userId}`,\n {},\n null,\n [KnownErrors.UserNotFound],\n );\n if (responseOrError.status === \"error\") {\n return Result.error(responseOrError.error);\n }\n const user: UsersCrud['Server']['Read'] = await responseOrError.data.json();\n return Result.ok(user);\n }\n\n async listServerTeamInvitations(options: {\n teamId: string,\n }): Promise<TeamInvitationCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/team-invitations?team_id=${options.teamId}`,\n {},\n null,\n );\n const result = await response.json() as TeamInvitationCrud['Server']['List'];\n return result.items;\n }\n\n async revokeServerTeamInvitation(invitationId: string, teamId: string) {\n await this.sendServerRequest(\n urlString`/team-invitations/${invitationId}?team_id=${teamId}`,\n { method: \"DELETE\" },\n null,\n );\n }\n\n async listServerTeamMemberProfiles(\n options: {\n teamId: string,\n },\n ): Promise<TeamMemberProfilesCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/team-member-profiles?team_id=${options.teamId}`,\n {},\n null,\n );\n const result = await response.json() as TeamMemberProfilesCrud['Server']['List'];\n return result.items;\n }\n\n async getServerTeamMemberProfile(\n options: {\n teamId: string,\n userId: string,\n },\n ): Promise<TeamMemberProfilesCrud['Client']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/team-member-profiles/${options.teamId}/${options.userId}`,\n {},\n null,\n );\n return await response.json();\n }\n\n async listServerTeamPermissions(\n options: {\n userId?: string,\n teamId?: string,\n recursive: boolean,\n },\n session: InternalSession | null,\n ): Promise<TeamPermissionsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n `/team-permissions?${new URLSearchParams(filterUndefined({\n user_id: options.userId,\n team_id: options.teamId,\n recursive: options.recursive.toString(),\n }))}`,\n {},\n session,\n );\n const result = await response.json() as TeamPermissionsCrud['Server']['List'];\n return result.items;\n }\n\n async listServerProjectPermissions(\n options: {\n userId?: string,\n recursive: boolean,\n },\n session: InternalSession | null,\n ): Promise<ProjectPermissionsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n `/project-permissions?${new URLSearchParams(filterUndefined({\n user_id: options.userId,\n recursive: options.recursive.toString(),\n }))}`,\n {},\n session,\n );\n const result = await response.json() as ProjectPermissionsCrud['Server']['List'];\n return result.items;\n }\n\n async listServerUsers(options: (\n & {\n cursor?: string,\n limit?: number,\n orderBy?: 'signedUpAt' | 'lastActiveAt',\n desc?: boolean,\n query?: string,\n excludedEmailDomains?: string[],\n includeRestricted?: boolean,\n teamId?: string,\n }\n & (\n {\n includeAnonymous?: boolean,\n onlyAnonymous?: false,\n }\n | {\n includeAnonymous: true,\n onlyAnonymous: true,\n }\n )\n )): Promise<UsersCrud['Server']['List']> {\n const searchParams = new URLSearchParams(filterUndefined({\n cursor: options.cursor,\n limit: options.limit?.toString(),\n desc: options.desc?.toString(),\n team_id: options.teamId,\n ...options.orderBy ? {\n order_by: {\n signedUpAt: \"signed_up_at\",\n lastActiveAt: \"last_active_at\",\n }[options.orderBy],\n } : {},\n ...options.query ? {\n query: options.query,\n } : {},\n ...options.excludedEmailDomains && options.excludedEmailDomains.length > 0 ? {\n excluded_email_domains: options.excludedEmailDomains.join(\",\"), // backend expects comma-separated list of domains.\n } : {},\n ...options.includeRestricted ? {\n include_restricted: 'true',\n } : {},\n ...options.includeAnonymous ? {\n include_anonymous: 'true',\n } : {},\n ...options.onlyAnonymous ? {\n only_anonymous: 'true',\n } : {},\n }));\n const response = await this.sendServerRequest(\"/users?\" + searchParams.toString(), {}, null);\n return await response.json();\n }\n\n async listServerTeams(options?: {\n userId?: string,\n }): Promise<TeamsCrud['Server']['Read'][]> {\n const result = await this.listServerTeamsPaginated(options);\n return result.items;\n }\n\n async listServerTeamsPaginated(options?: {\n userId?: string,\n orderBy?: 'createdAt',\n desc?: boolean,\n cursor?: string,\n limit?: number,\n query?: string,\n }): Promise<TeamsCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n `/teams?${new URLSearchParams(filterUndefined({\n user_id: options?.userId,\n // SDK option uses camelCase `createdAt`; backend uses snake_case.\n order_by: options?.orderBy === 'createdAt' ? 'created_at' : options?.orderBy,\n desc: options?.desc !== undefined ? String(options.desc) : undefined,\n cursor: options?.cursor,\n limit: options?.limit?.toString(),\n query: options?.query,\n }))}`,\n {},\n null\n );\n return await response.json() as TeamsCrud['Server']['List'];\n }\n\n async getServerTeam(teamId: string): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n `/teams/${teamId}`,\n {},\n null\n );\n return await response.json();\n }\n\n async listServerTeamUsers(teamId: string): Promise<UsersCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(`/users?team_id=${teamId}`, {}, null);\n const result = await response.json() as UsersCrud['Server']['List'];\n return result.items;\n }\n\n /* when passing a session, the user will be added to the team */\n async createServerTeam(data: TeamsCrud['Server']['Create']): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/teams\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null\n );\n return await response.json();\n }\n\n async updateServerTeam(teamId: string, data: TeamsCrud['Server']['Update']): Promise<TeamsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/teams/${teamId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerTeam(teamId: string): Promise<void> {\n await this.sendServerRequest(\n urlString`/teams/${teamId}`,\n { method: \"DELETE\" },\n null,\n );\n }\n\n async addServerUserToTeam(options: {\n userId: string,\n teamId: string,\n }): Promise<TeamMembershipsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n return await response.json();\n }\n\n async removeServerUserFromTeam(options: {\n userId: string,\n teamId: string,\n }) {\n await this.sendServerRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async listServerUserTeamInvitations(userId: string): Promise<TeamInvitationCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n \"/team-invitations?\" + new URLSearchParams({ user_id: userId }),\n {},\n null,\n );\n const result = await response.json() as TeamInvitationCrud['Server']['List'];\n return result.items;\n }\n\n async acceptServerTeamInvitationById(\n invitationId: string,\n userId: string,\n ) {\n await this.sendServerRequest(\n urlString`/team-invitations/${invitationId}/accept` + \"?\" + new URLSearchParams({ user_id: userId }),\n { method: \"POST\" },\n null,\n );\n }\n\n async updateServerUser(userId: string, update: UsersCrud['Server']['Update']): Promise<UsersCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/users/${userId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(update),\n },\n null,\n );\n return await response.json();\n }\n\n async createServerProviderAccessToken(\n userId: string,\n provider: string,\n scope: string,\n ): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}/${provider}/access-token`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ scope }),\n },\n null,\n );\n return await response.json();\n }\n\n /**\n * Get access token for a specific connected account by provider ID and provider account ID.\n * This is the preferred method when dealing with multiple accounts of the same provider.\n */\n async createServerProviderAccessTokenByAccount(\n userId: string,\n providerId: string,\n providerAccountId: string,\n scope: string,\n ): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}/${providerId}/${providerAccountId}/access-token`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ scope }),\n },\n null,\n );\n return await response.json();\n }\n\n /**\n * List all connected accounts for a user.\n */\n async listServerConnectedAccounts(\n userId: string,\n ): Promise<ConnectedAccountCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n urlString`/connected-accounts/${userId}`,\n { method: \"GET\" },\n null,\n );\n return await response.json();\n }\n\n async createServerUserSession(userId: string, expiresInMillis: number, isImpersonation: boolean): Promise<{ accessToken: string, refreshToken: string }> {\n const response = await this.sendServerRequest(\n \"/auth/sessions\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n user_id: userId,\n expires_in_millis: expiresInMillis,\n is_impersonation: isImpersonation,\n }),\n },\n null,\n );\n const result = await response.json();\n return {\n accessToken: result.access_token,\n refreshToken: result.refresh_token,\n };\n }\n\n async leaveServerTeam(\n options: {\n teamId: string,\n userId: string,\n },\n ) {\n await this.sendClientRequest(\n urlString`/team-memberships/${options.teamId}/${options.userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async updateServerTeamMemberProfile(options: {\n teamId: string,\n userId: string,\n profile: TeamMemberProfilesCrud['Server']['Update'],\n }) {\n await this.sendServerRequest(\n urlString`/team-member-profiles/${options.teamId}/${options.userId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(options.profile),\n },\n null,\n );\n }\n\n async grantServerTeamUserPermission(teamId: string, userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async grantServerProjectPermission(userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/project-permissions/${userId}/${permissionId}`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async revokeServerTeamUserPermission(teamId: string, userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async revokeServerProjectPermission(userId: string, permissionId: string) {\n await this.sendServerRequest(\n urlString`/project-permissions/${userId}/${permissionId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async deleteServerUser(userId: string) {\n await this.sendServerRequest(\n urlString`/users/${userId}`,\n {\n method: \"DELETE\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({}),\n },\n null,\n );\n }\n\n async createServerContactChannel(\n data: ContactChannelsCrud['Server']['Create'],\n ): Promise<ContactChannelsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/contact-channels\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async updateServerContactChannel(\n userId: string,\n contactChannelId: string,\n data: ContactChannelsCrud['Server']['Update'],\n ): Promise<ContactChannelsCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerContactChannel(\n userId: string,\n contactChannelId: string,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n }\n\n async listServerContactChannels(\n userId: string,\n ): Promise<ContactChannelsCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/contact-channels?user_id=${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n const json = await response.json() as ContactChannelsCrud['Server']['List'];\n return json.items;\n }\n\n async listServerNotificationCategories(\n userId: string,\n ): Promise<NotificationPreferenceCrud['Server']['Read'][]> {\n const response = await this.sendServerRequest(\n urlString`/emails/notification-preference/${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n const json = await response.json() as NotificationPreferenceCrud['Server']['List'];\n return json.items;\n }\n\n async setServerNotificationsEnabled(\n userId: string,\n notificationCategoryId: string,\n enabled: boolean,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/emails/notification-preference/${userId}/${notificationCategoryId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n enabled,\n }),\n },\n null,\n );\n }\n\n async sendServerContactChannelVerificationEmail(\n userId: string,\n contactChannelId: string,\n callbackUrl: string,\n ): Promise<void> {\n await this.sendServerRequest(\n urlString`/contact-channels/${userId}/${contactChannelId}/send-verification-code`,\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({ callback_url: callbackUrl }),\n },\n null,\n );\n }\n\n\n async listServerSessions(userId: string): Promise<SessionsCrud['Server']['List']> {\n const response = await this.sendServerRequest(\n urlString`/auth/sessions?user_id=${userId}`,\n {\n method: \"GET\",\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerSession(sessionId: string) {\n await this.sendServerRequest(\n urlString`/auth/sessions/${sessionId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n }\n\n\n async sendServerTeamInvitation(options: {\n email: string,\n teamId: string,\n callbackUrl: string,\n }): Promise<void> {\n await this.sendServerRequest(\n \"/team-invitations/send-code\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n email: options.email,\n team_id: options.teamId,\n callback_url: options.callbackUrl,\n }),\n },\n null,\n );\n }\n\n async updatePassword(\n options: { oldPassword: string, newPassword: string },\n ): Promise<KnownErrors[\"PasswordConfirmationMismatch\"] | KnownErrors[\"PasswordRequirementsNotMet\"] | undefined> {\n const res = await this.sendServerRequestAndCatchKnownError(\n \"/auth/password/update\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n old_password: options.oldPassword,\n new_password: options.newPassword,\n }),\n },\n null,\n [KnownErrors.PasswordConfirmationMismatch, KnownErrors.PasswordRequirementsNotMet]\n );\n\n if (res.status === \"error\") {\n return res.error;\n }\n }\n\n // OAuth Providers CRUD operations\n async createServerOAuthProvider(\n data: OAuthProviderCrud['Server']['Create'],\n ): Promise<OAuthProviderCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n \"/oauth-providers\",\n {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n\n async listServerOAuthProviders(\n options: {\n user_id?: string,\n } = {},\n ): Promise<OAuthProviderCrud['Server']['Read'][]> {\n const queryParams = new URLSearchParams(filterUndefined(options));\n const response = await this.sendServerRequest(\n `/oauth-providers${queryParams.toString() ? `?${queryParams.toString()}` : ''}`,\n {\n method: \"GET\",\n },\n null,\n );\n const result = await response.json();\n return result.items;\n }\n\n async updateServerOAuthProvider(\n userId: string,\n providerId: string,\n data: OAuthProviderCrud['Server']['Update'],\n ): Promise<OAuthProviderCrud['Server']['Read']> {\n const response = await this.sendServerRequest(\n urlString`/oauth-providers/${userId}/${providerId}`,\n {\n method: \"PATCH\",\n headers: {\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n null,\n );\n return await response.json();\n }\n\n async deleteServerOAuthProvider(\n userId: string,\n providerId: string,\n ): Promise<void> {\n const response = await this.sendServerRequest(\n urlString`/oauth-providers/${userId}/${providerId}`,\n {\n method: \"DELETE\",\n },\n null,\n );\n return await response.json();\n }\n\n async sendEmail(options: {\n userIds?: string[],\n allUsers?: true,\n themeId?: string | null | false,\n html?: string,\n subject?: string,\n notificationCategoryName?: string,\n templateId?: string,\n variables?: Record<string, any>,\n draftId?: string,\n scheduledAt?: Date,\n }): Promise<Result<void, KnownErrors[\"RequiresCustomEmailServer\"] | KnownErrors[\"SchemaError\"] | KnownErrors[\"UserIdDoesNotExist\"]>> {\n const res = await this.sendServerRequest(\n \"/emails/send-email\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n user_ids: options.userIds,\n all_users: options.allUsers,\n theme_id: options.themeId,\n html: options.html,\n subject: options.subject,\n notification_category_name: options.notificationCategoryName,\n template_id: options.templateId,\n variables: options.variables,\n draft_id: options.draftId,\n scheduled_at_millis: options.scheduledAt?.getTime(),\n }),\n },\n null,\n );\n return Result.ok(undefined);\n }\n\n async getEmailDeliveryInfo(): Promise<{\n stats: {\n hour: { sent: number, bounced: number, marked_as_spam: number },\n day: { sent: number, bounced: number, marked_as_spam: number },\n week: { sent: number, bounced: number, marked_as_spam: number },\n month: { sent: number, bounced: number, marked_as_spam: number },\n },\n capacity: {\n rate_per_second: number,\n boost_multiplier: number,\n penalty_factor: number,\n is_boost_active: boolean,\n boost_expires_at: string | null,\n },\n }> {\n const res = await this.sendServerRequest(\n \"/emails/delivery-info\",\n {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n },\n null,\n );\n return await res.json();\n }\n\n async activateEmailCapacityBoost(): Promise<{ expires_at: string }> {\n const res = await this.sendServerRequest(\n \"/emails/capacity-boost\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({}),\n },\n null,\n );\n return await res.json();\n }\n\n async updateItemQuantity(\n options: (\n { itemId: string, userId: string } |\n { itemId: string, teamId: string } |\n { itemId: string, customCustomerId: string }\n ),\n data: ItemCrud['Server']['Update'],\n ): Promise<void> {\n let customerType: \"user\" | \"team\" | \"custom\";\n let customerId: string;\n const itemId: string = options.itemId;\n\n if (\"userId\" in options) {\n customerType = \"user\";\n customerId = options.userId;\n } else if (\"teamId\" in options) {\n customerType = \"team\";\n customerId = options.teamId;\n } else if (\"customCustomerId\" in options) {\n customerType = \"custom\";\n customerId = options.customCustomerId;\n } else {\n throw new HexclaveAssertionError(\"updateItemQuantity requires one of userId, teamId, or customCustomerId\");\n }\n\n const queryParams = new URLSearchParams({ allow_negative: (data.allow_negative ?? false).toString() });\n await this.sendServerRequest(\n `/payments/items/${customerType}/${customerId}/${itemId}/update-quantity?${queryParams.toString()}`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ delta: data.delta, expires_at: data.expires_at, description: data.description }),\n },\n null\n );\n }\n\n async grantProduct(\n options: {\n customerType: \"user\" | \"team\" | \"custom\",\n customerId: string,\n productId?: string,\n product?: yup.InferType<typeof inlineProductSchema>,\n quantity?: number,\n },\n ): Promise<void> {\n if (!options.productId && !options.product) {\n throw new HexclaveAssertionError(\"grantProduct requires either productId or product\");\n }\n if (options.productId && options.product) {\n throw new HexclaveAssertionError(\"grantProduct should not receive both productId and product\");\n }\n const body = filterUndefined({\n product_id: options.productId,\n product_inline: options.product,\n quantity: options.quantity,\n });\n await this.sendServerRequest(\n urlString`/payments/products/${options.customerType}/${options.customerId}`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(body),\n },\n null,\n );\n }\n\n async getDataVaultStoreValue(secret: string, storeId: string, key: string) {\n const hashedKey = await hashKey(secret, key);\n const response = await this.sendServerRequestAndCatchKnownError(\n `/data-vault/stores/${storeId}/get`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ hashed_key: hashedKey }),\n },\n null,\n [KnownErrors.DataVaultStoreHashedKeyDoesNotExist] as const,\n );\n if (response.status === \"error\") {\n if (KnownErrors.DataVaultStoreHashedKeyDoesNotExist.isInstance(response.error)) {\n return null;\n } else {\n throw new HexclaveAssertionError(\"Unexpected uncaught error\", { cause: response.error });\n }\n }\n const json = await response.data.json();\n const encryptedValue = json.encrypted_value;\n if (typeof encryptedValue !== \"string\") throw new HexclaveAssertionError(\"encrypted_value is not a string\", { type: typeof encryptedValue });\n return await decryptValue(secret, key, encryptedValue);\n }\n\n async setDataVaultStoreValue(secret: string, storeId: string, key: string, value: string) {\n const hashedKey = await hashKey(secret, key);\n const encryptedValue = await encryptValue(secret, key, value);\n await this.sendServerRequest(\n `/data-vault/stores/${storeId}/set`,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ hashed_key: hashedKey, encrypted_value: encryptedValue }),\n },\n null,\n );\n }\n\n async initiateServerPasskeyRegistration(userId: string): Promise<Result<{ options_json: any, code: string }, KnownErrors[]>> {\n // Create a temporary session for this user to use for passkey registration\n // TODO instead of creating a new session, this should just call the endpoint in a way in which it doesn't require a session\n // (currently this shows up on session history etc... not ideal)\n const { accessToken, refreshToken } = await this.createServerUserSession(userId, 60000 * 2, false); // 2 minute session\n const tempSession = new InternalSession({\n accessToken,\n refreshToken,\n refreshAccessTokenCallback: async () => null, // No refresh for temporary sessions\n });\n\n // Use the existing initiatePasskeyRegistration method with the temporary session\n return await this.initiatePasskeyRegistration({}, tempSession);\n }\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAa,0BAAb,cAA6C,wBAAwB;CACnE,YAAY,AAAgB,SAAuC;AACjE,QAAM,QAAQ;EADY;;CAI5B,MAAgB,kBAAkB,MAAc,SAAsB,SAAiC,cAAkC,UAAU;AACjJ,SAAO,MAAM,KAAK,kBAChB,MACA;GACE,GAAG;GACH,SAAS;IAEP,gCAAgC,qBAAqB,KAAK,UAAU,KAAK,QAAQ,kBAAkB;IACnG,GAAG,QAAQ;IACZ;GACF,EACD,SACA,YACD;;CAGH,MAAe,mBACb,cACA,YACA,SAUC;AAMD,SAAO,OALU,MAAM,KAAK,kBAC1B,SAAS,qBAAqB,aAAa,GAAG,cAC9C,EAAE,EACF,QACD,EACqB,MAAM;;CAG9B,MAAe,uCACb,cACA,YACA,SAIC;AAYD,SAAO,OAXU,MAAM,KAAK,kBAC1B,SAAS,4BAA4B,aAAa,GAAG,WAAW,gBAChE;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,oBACjB;GACD,MAAM,KAAK,UAAU,EAAE,CAAC;GACzB,EACD,QACD,EACqB,MAAM;;CAG9B,MAAe,+CACb,cACA,YACA,eACA,SASC;AAcD,SAAO,OAbU,MAAM,KAAK,kBAC1B,SAAS,4BAA4B,aAAa,GAAG,WAAW,eAChE;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,oBACjB;GACD,MAAM,KAAK,UAAU,EACnB,iBAAiB,eAClB,CAAC;GACH,EACD,QACD,EACqB,MAAM;;CAI9B,MAAgB,oCACd,MACA,gBACA,kBACA,eASC;AACD,MAAI;AACF,UAAO,OAAO,GAAG,MAAM,KAAK,kBAAkB,MAAM,g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qF;EAI3H,MAAM,EAAE,aAAa,iBAAiB,MAAM,KAAK,wBAAwB,QAAQ,MAAQ,GAAG,MAAM;EAClG,MAAM,cAAc,IAAI,gBAAgB;GACtC;GACA;GACA,4BAA4B,YAAY;GACzC,CAAC;AAGF,SAAO,MAAM,KAAK,4BAA4B,EAAE,EAAE,YAAY"}
|
|
@@ -314,8 +314,8 @@ declare const inlineProductSchema: yup$1.ObjectSchema<{
|
|
|
314
314
|
free_trial?: DayInterval | undefined;
|
|
315
315
|
}>;
|
|
316
316
|
included_items: Record<string, {
|
|
317
|
-
repeat?: "never" | DayInterval | undefined;
|
|
318
317
|
quantity?: number | undefined;
|
|
318
|
+
repeat?: "never" | DayInterval | undefined;
|
|
319
319
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
320
320
|
}>;
|
|
321
321
|
client_metadata: {} | null | undefined;
|
package/dist/esm/sessions.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ declare class AccessToken {
|
|
|
9
9
|
private constructor();
|
|
10
10
|
get payload(): {
|
|
11
11
|
exp?: number | undefined;
|
|
12
|
-
sub: string;
|
|
13
12
|
project_id: string;
|
|
14
13
|
refresh_token_id: string;
|
|
15
14
|
email: string | null;
|
|
@@ -17,6 +16,7 @@ declare class AccessToken {
|
|
|
17
16
|
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
18
17
|
} | null;
|
|
19
18
|
branch_id: string;
|
|
19
|
+
sub: string;
|
|
20
20
|
iat: number;
|
|
21
21
|
iss: string;
|
|
22
22
|
aud: string;
|
|
@@ -159,8 +159,8 @@ declare const MetricsEmailOverviewSchema: yup.ObjectSchema<{
|
|
|
159
159
|
recent_emails: {
|
|
160
160
|
status: string;
|
|
161
161
|
id: string;
|
|
162
|
-
created_at_millis: number;
|
|
163
162
|
subject: string;
|
|
163
|
+
created_at_millis: number;
|
|
164
164
|
}[];
|
|
165
165
|
deliverability_status: {
|
|
166
166
|
error: number;
|
|
@@ -369,7 +369,7 @@ declare const UserActivityResponseBodySchema: yup.ObjectSchema<{
|
|
|
369
369
|
data_points: undefined;
|
|
370
370
|
}, "">;
|
|
371
371
|
declare const AnalyticsClickmapKindSchema: yup.StringSchema<"team_user_hour_of_week" | "session_replay_clicks", yup.AnyObject, undefined, "">;
|
|
372
|
-
declare const AnalyticsClickmapDeviceSchema: yup.StringSchema<"
|
|
372
|
+
declare const AnalyticsClickmapDeviceSchema: yup.StringSchema<"tv" | "widescreen" | "desktop" | "laptop" | "tablet" | "mobile", yup.AnyObject, undefined, "">;
|
|
373
373
|
declare const AnalyticsClickmapTokenResponseBodySchema: yup.ObjectSchema<{
|
|
374
374
|
token: string;
|
|
375
375
|
origin: string;
|
|
@@ -572,8 +572,8 @@ declare const MetricsResponseBodySchema: yup.ObjectSchema<{
|
|
|
572
572
|
recent_emails: {
|
|
573
573
|
status: string;
|
|
574
574
|
id: string;
|
|
575
|
-
created_at_millis: number;
|
|
576
575
|
subject: string;
|
|
576
|
+
created_at_millis: number;
|
|
577
577
|
}[];
|
|
578
578
|
deliverability_status: {
|
|
579
579
|
error: number;
|
|
@@ -49,16 +49,16 @@ declare const conversationSummarySchema: yup$1.ObjectSchema<{
|
|
|
49
49
|
userPrimaryEmail: string | null;
|
|
50
50
|
userProfileImageUrl: string | null;
|
|
51
51
|
subject: string;
|
|
52
|
-
status: "
|
|
52
|
+
status: "open" | "pending" | "closed";
|
|
53
53
|
priority: "low" | "normal" | "high" | "urgent";
|
|
54
54
|
source: "email" | "manual" | "chat" | "api";
|
|
55
55
|
lastMessageType: "message" | "internal-note" | "status-change";
|
|
56
56
|
preview: string | null;
|
|
57
57
|
lastActivityAt: string;
|
|
58
58
|
metadata: {
|
|
59
|
-
tags: string[];
|
|
60
59
|
assignedToUserId: string | null;
|
|
61
60
|
assignedToDisplayName: string | null;
|
|
61
|
+
tags: string[];
|
|
62
62
|
firstResponseDueAt: string | null;
|
|
63
63
|
firstResponseAt: string | null;
|
|
64
64
|
nextResponseDueAt: string | null;
|
|
@@ -129,7 +129,7 @@ declare const conversationMessageSchema: yup$1.ObjectSchema<{
|
|
|
129
129
|
userId: string | null;
|
|
130
130
|
teamId: string | null;
|
|
131
131
|
subject: string;
|
|
132
|
-
status: "
|
|
132
|
+
status: "open" | "pending" | "closed";
|
|
133
133
|
priority: "low" | "normal" | "high" | "urgent";
|
|
134
134
|
source: "email" | "manual" | "chat" | "api";
|
|
135
135
|
messageType: "message" | "internal-note" | "status-change";
|
|
@@ -173,18 +173,7 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
|
|
|
173
173
|
lastOutboundAt?: string | null | undefined;
|
|
174
174
|
closedAt?: string | null | undefined;
|
|
175
175
|
recordMetadata?: {} | null | undefined;
|
|
176
|
-
status: "
|
|
177
|
-
source: "email" | "manual" | "chat" | "api";
|
|
178
|
-
metadata: {
|
|
179
|
-
tags: string[];
|
|
180
|
-
assignedToUserId: string | null;
|
|
181
|
-
assignedToDisplayName: string | null;
|
|
182
|
-
firstResponseDueAt: string | null;
|
|
183
|
-
firstResponseAt: string | null;
|
|
184
|
-
nextResponseDueAt: string | null;
|
|
185
|
-
lastCustomerReplyAt: string | null;
|
|
186
|
-
lastAgentReplyAt: string | null;
|
|
187
|
-
};
|
|
176
|
+
status: "open" | "pending" | "closed";
|
|
188
177
|
priority: "low" | "normal" | "high" | "urgent";
|
|
189
178
|
subject: string;
|
|
190
179
|
conversationId: string;
|
|
@@ -193,9 +182,20 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
|
|
|
193
182
|
userDisplayName: string | null;
|
|
194
183
|
userPrimaryEmail: string | null;
|
|
195
184
|
userProfileImageUrl: string | null;
|
|
185
|
+
source: "email" | "manual" | "chat" | "api";
|
|
196
186
|
lastMessageType: "message" | "internal-note" | "status-change";
|
|
197
187
|
preview: string | null;
|
|
198
188
|
lastActivityAt: string;
|
|
189
|
+
metadata: {
|
|
190
|
+
assignedToUserId: string | null;
|
|
191
|
+
assignedToDisplayName: string | null;
|
|
192
|
+
tags: string[];
|
|
193
|
+
firstResponseDueAt: string | null;
|
|
194
|
+
firstResponseAt: string | null;
|
|
195
|
+
nextResponseDueAt: string | null;
|
|
196
|
+
lastCustomerReplyAt: string | null;
|
|
197
|
+
lastAgentReplyAt: string | null;
|
|
198
|
+
};
|
|
199
199
|
}[];
|
|
200
200
|
hasMore: boolean;
|
|
201
201
|
}, yup$1.AnyObject, {
|
|
@@ -211,18 +211,7 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
211
211
|
lastOutboundAt?: string | null | undefined;
|
|
212
212
|
closedAt?: string | null | undefined;
|
|
213
213
|
recordMetadata?: {} | null | undefined;
|
|
214
|
-
status: "
|
|
215
|
-
source: "email" | "manual" | "chat" | "api";
|
|
216
|
-
metadata: {
|
|
217
|
-
tags: string[];
|
|
218
|
-
assignedToUserId: string | null;
|
|
219
|
-
assignedToDisplayName: string | null;
|
|
220
|
-
firstResponseDueAt: string | null;
|
|
221
|
-
firstResponseAt: string | null;
|
|
222
|
-
nextResponseDueAt: string | null;
|
|
223
|
-
lastCustomerReplyAt: string | null;
|
|
224
|
-
lastAgentReplyAt: string | null;
|
|
225
|
-
};
|
|
214
|
+
status: "open" | "pending" | "closed";
|
|
226
215
|
priority: "low" | "normal" | "high" | "urgent";
|
|
227
216
|
subject: string;
|
|
228
217
|
conversationId: string;
|
|
@@ -231,23 +220,34 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
231
220
|
userDisplayName: string | null;
|
|
232
221
|
userPrimaryEmail: string | null;
|
|
233
222
|
userProfileImageUrl: string | null;
|
|
223
|
+
source: "email" | "manual" | "chat" | "api";
|
|
234
224
|
lastMessageType: "message" | "internal-note" | "status-change";
|
|
235
225
|
preview: string | null;
|
|
236
226
|
lastActivityAt: string;
|
|
227
|
+
metadata: {
|
|
228
|
+
assignedToUserId: string | null;
|
|
229
|
+
assignedToDisplayName: string | null;
|
|
230
|
+
tags: string[];
|
|
231
|
+
firstResponseDueAt: string | null;
|
|
232
|
+
firstResponseAt: string | null;
|
|
233
|
+
nextResponseDueAt: string | null;
|
|
234
|
+
lastCustomerReplyAt: string | null;
|
|
235
|
+
lastAgentReplyAt: string | null;
|
|
236
|
+
};
|
|
237
237
|
};
|
|
238
238
|
messages: {
|
|
239
|
-
status: "
|
|
239
|
+
status: "open" | "pending" | "closed";
|
|
240
240
|
id: string;
|
|
241
|
-
body: string | null;
|
|
242
|
-
source: "email" | "manual" | "chat" | "api";
|
|
243
|
-
metadata: {} | null;
|
|
244
241
|
priority: "low" | "normal" | "high" | "urgent";
|
|
245
242
|
subject: string;
|
|
246
243
|
conversationId: string;
|
|
247
244
|
userId: string | null;
|
|
248
245
|
teamId: string | null;
|
|
246
|
+
source: "email" | "manual" | "chat" | "api";
|
|
247
|
+
metadata: {} | null;
|
|
249
248
|
createdAt: string;
|
|
250
249
|
messageType: "message" | "internal-note" | "status-change";
|
|
250
|
+
body: string | null;
|
|
251
251
|
attachments: {}[];
|
|
252
252
|
sender: {
|
|
253
253
|
type: "user" | "agent" | "system";
|
|
@@ -8,17 +8,17 @@ declare const currentUserCrud: CrudSchemaFromOptions<{
|
|
|
8
8
|
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
9
9
|
} | null;
|
|
10
10
|
primary_email: string | null;
|
|
11
|
-
selected_team_id: string | null;
|
|
12
|
-
is_anonymous: boolean;
|
|
13
|
-
is_restricted: boolean;
|
|
14
|
-
requires_totp_mfa: boolean;
|
|
15
11
|
display_name: string | null;
|
|
16
12
|
client_metadata: {} | null;
|
|
17
13
|
client_read_only_metadata: {} | null;
|
|
18
14
|
id: string;
|
|
19
|
-
|
|
15
|
+
selected_team_id: string | null;
|
|
16
|
+
is_anonymous: boolean;
|
|
17
|
+
is_restricted: boolean;
|
|
18
|
+
requires_totp_mfa: boolean;
|
|
20
19
|
profile_image_url: string | null;
|
|
21
20
|
signed_up_at_millis: number;
|
|
21
|
+
primary_email_verified: boolean;
|
|
22
22
|
has_password: boolean;
|
|
23
23
|
otp_auth_enabled: boolean;
|
|
24
24
|
passkey_auth_enabled: boolean;
|
|
@@ -173,9 +173,9 @@ declare const currentUserCrud: CrudSchemaFromOptions<{
|
|
|
173
173
|
}, "">;
|
|
174
174
|
clientUpdateSchema: yup$1.ObjectSchema<{
|
|
175
175
|
primary_email: string | null | undefined;
|
|
176
|
-
selected_team_id: string | null | undefined;
|
|
177
176
|
display_name: string | null | undefined;
|
|
178
177
|
client_metadata: {} | null | undefined;
|
|
178
|
+
selected_team_id: string | null | undefined;
|
|
179
179
|
profile_image_url: string | null | undefined;
|
|
180
180
|
otp_auth_enabled: boolean | undefined;
|
|
181
181
|
passkey_auth_enabled: boolean | undefined;
|