@hexclave/js 1.0.0 → 1.0.2

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 (134) hide show
  1. package/README.md +7 -23
  2. package/dist/dev-tool/dev-tool-core.d.ts.map +1 -1
  3. package/dist/dev-tool/dev-tool-core.js +23 -23
  4. package/dist/dev-tool/dev-tool-core.js.map +1 -1
  5. package/dist/dev-tool/index.js +6 -6
  6. package/dist/dev-tool/index.js.map +1 -1
  7. package/dist/esm/dev-tool/dev-tool-core.d.ts.map +1 -1
  8. package/dist/esm/dev-tool/dev-tool-core.js +2 -2
  9. package/dist/esm/dev-tool/dev-tool-core.js.map +1 -1
  10. package/dist/esm/dev-tool/index.js.map +1 -1
  11. package/dist/esm/index.d.ts +1 -1
  12. package/dist/esm/index.js +1 -2
  13. package/dist/esm/integrations/convex.js.map +1 -1
  14. package/dist/esm/lib/auth.js.map +1 -1
  15. package/dist/esm/lib/auth.test.js.map +1 -1
  16. package/dist/esm/lib/cookie.js.map +1 -1
  17. package/dist/esm/lib/stack-app/api-keys/index.js.map +1 -1
  18. package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.d.ts +11 -11
  19. package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  20. package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js +3 -1
  21. package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
  22. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.cross-domain.test.js +67 -1
  23. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
  24. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.d.ts +4 -3
  25. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.d.ts.map +1 -1
  26. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js +18 -2
  27. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
  28. package/dist/esm/lib/stack-app/apps/implementations/common.d.ts.map +1 -1
  29. package/dist/esm/lib/stack-app/apps/implementations/common.js +1 -1
  30. package/dist/esm/lib/stack-app/apps/implementations/common.js.map +1 -1
  31. package/dist/esm/lib/stack-app/apps/implementations/event-tracker.js.map +1 -1
  32. package/dist/esm/lib/stack-app/apps/implementations/event-tracker.test.js.map +1 -1
  33. package/dist/esm/lib/stack-app/apps/implementations/index.js.map +1 -1
  34. package/dist/esm/lib/stack-app/apps/implementations/redirect-page-urls.js.map +1 -1
  35. package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
  36. package/dist/esm/lib/stack-app/apps/implementations/session-replay.d.ts.map +1 -1
  37. package/dist/esm/lib/stack-app/apps/implementations/session-replay.js +3 -2
  38. package/dist/esm/lib/stack-app/apps/implementations/session-replay.js.map +1 -1
  39. package/dist/esm/lib/stack-app/apps/interfaces/admin-app.d.ts +4 -0
  40. package/dist/esm/lib/stack-app/apps/interfaces/admin-app.d.ts.map +1 -1
  41. package/dist/esm/lib/stack-app/apps/interfaces/admin-app.js +1 -0
  42. package/dist/esm/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
  43. package/dist/esm/lib/stack-app/apps/interfaces/client-app.d.ts +5 -0
  44. package/dist/esm/lib/stack-app/apps/interfaces/client-app.d.ts.map +1 -1
  45. package/dist/esm/lib/stack-app/apps/interfaces/client-app.js +1 -0
  46. package/dist/esm/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
  47. package/dist/esm/lib/stack-app/apps/interfaces/server-app.d.ts +4 -0
  48. package/dist/esm/lib/stack-app/apps/interfaces/server-app.d.ts.map +1 -1
  49. package/dist/esm/lib/stack-app/apps/interfaces/server-app.js +1 -0
  50. package/dist/esm/lib/stack-app/apps/interfaces/server-app.js.map +1 -1
  51. package/dist/esm/lib/stack-app/common.js.map +1 -1
  52. package/dist/esm/lib/stack-app/contact-channels/index.js.map +1 -1
  53. package/dist/esm/lib/stack-app/email-templates/index.js.map +1 -1
  54. package/dist/esm/lib/stack-app/internal-api-keys/index.js.map +1 -1
  55. package/dist/esm/lib/stack-app/permissions/index.js.map +1 -1
  56. package/dist/esm/lib/stack-app/projects/index.js.map +1 -1
  57. package/dist/esm/lib/stack-app/teams/index.js.map +1 -1
  58. package/dist/esm/lib/stack-app/url-targets.js.map +1 -1
  59. package/dist/esm/lib/stack-app/url-targets.test.js +1 -1
  60. package/dist/esm/lib/stack-app/url-targets.test.js.map +1 -1
  61. package/dist/esm/lib/stack-app/users/index.js.map +1 -1
  62. package/dist/esm/utils/url.js.map +1 -1
  63. package/dist/index.d.ts +1 -1
  64. package/dist/index.js +3 -4
  65. package/dist/integrations/convex.js +5 -5
  66. package/dist/integrations/convex.js.map +1 -1
  67. package/dist/lib/auth.js +12 -12
  68. package/dist/lib/auth.js.map +1 -1
  69. package/dist/lib/auth.test.js +2 -2
  70. package/dist/lib/auth.test.js.map +1 -1
  71. package/dist/lib/cookie.js +9 -9
  72. package/dist/lib/cookie.js.map +1 -1
  73. package/dist/lib/stack-app/api-keys/index.js +2 -2
  74. package/dist/lib/stack-app/api-keys/index.js.map +1 -1
  75. package/dist/lib/stack-app/apps/implementations/admin-app-impl.d.ts +11 -11
  76. package/dist/lib/stack-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  77. package/dist/lib/stack-app/apps/implementations/admin-app-impl.js +38 -36
  78. package/dist/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
  79. package/dist/lib/stack-app/apps/implementations/client-app-impl.cross-domain.test.js +66 -0
  80. package/dist/lib/stack-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
  81. package/dist/lib/stack-app/apps/implementations/client-app-impl.d.ts +4 -3
  82. package/dist/lib/stack-app/apps/implementations/client-app-impl.d.ts.map +1 -1
  83. package/dist/lib/stack-app/apps/implementations/client-app-impl.js +210 -194
  84. package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
  85. package/dist/lib/stack-app/apps/implementations/common.d.ts.map +1 -1
  86. package/dist/lib/stack-app/apps/implementations/common.js +25 -25
  87. package/dist/lib/stack-app/apps/implementations/common.js.map +1 -1
  88. package/dist/lib/stack-app/apps/implementations/event-tracker.js +7 -7
  89. package/dist/lib/stack-app/apps/implementations/event-tracker.js.map +1 -1
  90. package/dist/lib/stack-app/apps/implementations/event-tracker.test.js +3 -3
  91. package/dist/lib/stack-app/apps/implementations/event-tracker.test.js.map +1 -1
  92. package/dist/lib/stack-app/apps/implementations/index.js +4 -4
  93. package/dist/lib/stack-app/apps/implementations/index.js.map +1 -1
  94. package/dist/lib/stack-app/apps/implementations/redirect-page-urls.js +8 -8
  95. package/dist/lib/stack-app/apps/implementations/redirect-page-urls.js.map +1 -1
  96. package/dist/lib/stack-app/apps/implementations/server-app-impl.js +59 -59
  97. package/dist/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
  98. package/dist/lib/stack-app/apps/implementations/session-replay.d.ts.map +1 -1
  99. package/dist/lib/stack-app/apps/implementations/session-replay.js +13 -12
  100. package/dist/lib/stack-app/apps/implementations/session-replay.js.map +1 -1
  101. package/dist/lib/stack-app/apps/interfaces/admin-app.d.ts +4 -0
  102. package/dist/lib/stack-app/apps/interfaces/admin-app.d.ts.map +1 -1
  103. package/dist/lib/stack-app/apps/interfaces/admin-app.js +1 -0
  104. package/dist/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
  105. package/dist/lib/stack-app/apps/interfaces/client-app.d.ts +5 -0
  106. package/dist/lib/stack-app/apps/interfaces/client-app.d.ts.map +1 -1
  107. package/dist/lib/stack-app/apps/interfaces/client-app.js +1 -0
  108. package/dist/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
  109. package/dist/lib/stack-app/apps/interfaces/server-app.d.ts +4 -0
  110. package/dist/lib/stack-app/apps/interfaces/server-app.d.ts.map +1 -1
  111. package/dist/lib/stack-app/apps/interfaces/server-app.js +1 -0
  112. package/dist/lib/stack-app/apps/interfaces/server-app.js.map +1 -1
  113. package/dist/lib/stack-app/common.js.map +1 -1
  114. package/dist/lib/stack-app/contact-channels/index.js.map +1 -1
  115. package/dist/lib/stack-app/email-templates/index.js.map +1 -1
  116. package/dist/lib/stack-app/internal-api-keys/index.js.map +1 -1
  117. package/dist/lib/stack-app/permissions/index.js.map +1 -1
  118. package/dist/lib/stack-app/projects/index.js.map +1 -1
  119. package/dist/lib/stack-app/teams/index.js.map +1 -1
  120. package/dist/lib/stack-app/url-targets.js +6 -6
  121. package/dist/lib/stack-app/url-targets.js.map +1 -1
  122. package/dist/lib/stack-app/url-targets.test.js +1 -1
  123. package/dist/lib/stack-app/url-targets.test.js.map +1 -1
  124. package/dist/lib/stack-app/users/index.js +3 -3
  125. package/dist/lib/stack-app/users/index.js.map +1 -1
  126. package/dist/utils/url.js +2 -2
  127. package/dist/utils/url.js.map +1 -1
  128. package/package.json +3 -3
  129. package/dist/esm/internal/deprecation-warning.d.ts +0 -1
  130. package/dist/esm/internal/deprecation-warning.js +0 -24
  131. package/dist/esm/internal/deprecation-warning.js.map +0 -1
  132. package/dist/internal/deprecation-warning.d.ts +0 -1
  133. package/dist/internal/deprecation-warning.js +0 -24
  134. package/dist/internal/deprecation-warning.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/lib/stack-app/api-keys/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { TeamApiKeysCrud, UserApiKeysCrud, teamApiKeysCreateInputSchema, userApiKeysCreateInputSchema } from \"@stackframe/stack-shared/dist/interface/crud/project-api-keys\";\nimport { filterUndefined } from \"@stackframe/stack-shared/dist/utils/objects\";\nimport { IfAndOnlyIf, PrettifyType } from \"@stackframe/stack-shared/dist/utils/types\";\nimport type * as yup from \"yup\";\n\nexport type ApiKeyType = \"user\" | \"team\";\n\nexport type ApiKey<Type extends ApiKeyType = ApiKeyType, IsFirstView extends boolean = false> =\n & {\n id: string,\n description: string,\n expiresAt?: Date,\n manuallyRevokedAt?: Date | null,\n createdAt: Date,\n value: IfAndOnlyIf<IsFirstView, true, string, { lastFour: string }>,\n update(options: ApiKeyUpdateOptions<Type>): Promise<void>,\n revoke: () => Promise<void>,\n isValid: () => boolean,\n whyInvalid: () => \"manually-revoked\" | \"expired\" | null,\n }\n & (\n | (\"user\" extends Type ? { type: \"user\", userId: string } : never)\n | (\"team\" extends Type ? { type: \"team\", teamId: string } : never)\n );\n\nexport type UserApiKeyFirstView = PrettifyType<ApiKey<\"user\", true>>;\nexport type UserApiKey = PrettifyType<ApiKey<\"user\", false>>;\n\nexport type TeamApiKeyFirstView = PrettifyType<ApiKey<\"team\", true>>;\nexport type TeamApiKey = PrettifyType<ApiKey<\"team\", false>>;\n\nexport type ApiKeyCreationOptions<Type extends ApiKeyType = ApiKeyType> =\n & {\n description: string,\n expiresAt: Date | null,\n /**\n * Whether the API key should be considered public. A public API key will not be detected by the secret scanner, which\n * automatically revokes API keys when it detects that they may have been exposed to the public.\n */\n isPublic?: boolean,\n };\nexport function apiKeyCreationOptionsToCrud(type: \"user\", userId: string, options: ApiKeyCreationOptions<\"user\">): Promise<yup.InferType<typeof userApiKeysCreateInputSchema>>;\nexport function apiKeyCreationOptionsToCrud(type: \"team\", teamId: string, options: ApiKeyCreationOptions<\"team\">): Promise<yup.InferType<typeof teamApiKeysCreateInputSchema>>;\nexport function apiKeyCreationOptionsToCrud(type: ApiKeyType, userIdOrTeamId: string, options: ApiKeyCreationOptions): Promise<yup.InferType<typeof userApiKeysCreateInputSchema> | yup.InferType<typeof teamApiKeysCreateInputSchema>>;\nexport async function apiKeyCreationOptionsToCrud(type: ApiKeyType, userIdOrTeamId: string, options: ApiKeyCreationOptions): Promise<yup.InferType<typeof userApiKeysCreateInputSchema> | yup.InferType<typeof teamApiKeysCreateInputSchema>> {\n return {\n description: options.description,\n expires_at_millis: options.expiresAt == null ? options.expiresAt : options.expiresAt.getTime(),\n is_public: options.isPublic,\n ...(type === \"user\" ? { user_id: userIdOrTeamId } : { team_id: userIdOrTeamId }),\n };\n}\n\n\nexport type ApiKeyUpdateOptions<Type extends ApiKeyType = ApiKeyType> = {\n description?: string,\n expiresAt?: Date | null,\n revoked?: boolean,\n};\nexport function apiKeyUpdateOptionsToCrud(type: \"user\", options: ApiKeyUpdateOptions<\"user\">): Promise<UserApiKeysCrud[\"Client\"][\"Update\"]>;\nexport function apiKeyUpdateOptionsToCrud(type: \"team\", options: ApiKeyUpdateOptions<\"team\">): Promise<TeamApiKeysCrud[\"Client\"][\"Update\"]>;\nexport function apiKeyUpdateOptionsToCrud(type: ApiKeyType, options: ApiKeyUpdateOptions): Promise<UserApiKeysCrud[\"Client\"][\"Update\"] | TeamApiKeysCrud[\"Client\"][\"Update\"]>;\nexport async function apiKeyUpdateOptionsToCrud(type: ApiKeyType, options: ApiKeyUpdateOptions): Promise<UserApiKeysCrud[\"Client\"][\"Update\"] | TeamApiKeysCrud[\"Client\"][\"Update\"]> {\n return filterUndefined({\n description: options.description,\n expires_at_millis: options.expiresAt == null ? options.expiresAt : options.expiresAt.getTime(),\n revoked: options.revoked,\n });\n}\n"],"mappings":";;;AAgDA,eAAsB,4BAA4B,MAAkB,gBAAwB,SAAkJ;AAC5O,QAAO;EACL,aAAa,QAAQ;EACrB,mBAAmB,QAAQ,aAAa,OAAO,QAAQ,YAAY,QAAQ,UAAU,SAAS;EAC9F,WAAW,QAAQ;EACnB,GAAI,SAAS,SAAS,EAAE,SAAS,gBAAgB,GAAG,EAAE,SAAS,gBAAgB;EAChF;;AAYH,eAAsB,0BAA0B,MAAkB,SAAkH;AAClL,QAAO,gBAAgB;EACrB,aAAa,QAAQ;EACrB,mBAAmB,QAAQ,aAAa,OAAO,QAAQ,YAAY,QAAQ,UAAU,SAAS;EAC9F,SAAS,QAAQ;EAClB,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/lib/stack-app/api-keys/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { TeamApiKeysCrud, UserApiKeysCrud, teamApiKeysCreateInputSchema, userApiKeysCreateInputSchema } from \"@hexclave/shared/dist/interface/crud/project-api-keys\";\nimport { filterUndefined } from \"@hexclave/shared/dist/utils/objects\";\nimport { IfAndOnlyIf, PrettifyType } from \"@hexclave/shared/dist/utils/types\";\nimport type * as yup from \"yup\";\n\nexport type ApiKeyType = \"user\" | \"team\";\n\nexport type ApiKey<Type extends ApiKeyType = ApiKeyType, IsFirstView extends boolean = false> =\n & {\n id: string,\n description: string,\n expiresAt?: Date,\n manuallyRevokedAt?: Date | null,\n createdAt: Date,\n value: IfAndOnlyIf<IsFirstView, true, string, { lastFour: string }>,\n update(options: ApiKeyUpdateOptions<Type>): Promise<void>,\n revoke: () => Promise<void>,\n isValid: () => boolean,\n whyInvalid: () => \"manually-revoked\" | \"expired\" | null,\n }\n & (\n | (\"user\" extends Type ? { type: \"user\", userId: string } : never)\n | (\"team\" extends Type ? { type: \"team\", teamId: string } : never)\n );\n\nexport type UserApiKeyFirstView = PrettifyType<ApiKey<\"user\", true>>;\nexport type UserApiKey = PrettifyType<ApiKey<\"user\", false>>;\n\nexport type TeamApiKeyFirstView = PrettifyType<ApiKey<\"team\", true>>;\nexport type TeamApiKey = PrettifyType<ApiKey<\"team\", false>>;\n\nexport type ApiKeyCreationOptions<Type extends ApiKeyType = ApiKeyType> =\n & {\n description: string,\n expiresAt: Date | null,\n /**\n * Whether the API key should be considered public. A public API key will not be detected by the secret scanner, which\n * automatically revokes API keys when it detects that they may have been exposed to the public.\n */\n isPublic?: boolean,\n };\nexport function apiKeyCreationOptionsToCrud(type: \"user\", userId: string, options: ApiKeyCreationOptions<\"user\">): Promise<yup.InferType<typeof userApiKeysCreateInputSchema>>;\nexport function apiKeyCreationOptionsToCrud(type: \"team\", teamId: string, options: ApiKeyCreationOptions<\"team\">): Promise<yup.InferType<typeof teamApiKeysCreateInputSchema>>;\nexport function apiKeyCreationOptionsToCrud(type: ApiKeyType, userIdOrTeamId: string, options: ApiKeyCreationOptions): Promise<yup.InferType<typeof userApiKeysCreateInputSchema> | yup.InferType<typeof teamApiKeysCreateInputSchema>>;\nexport async function apiKeyCreationOptionsToCrud(type: ApiKeyType, userIdOrTeamId: string, options: ApiKeyCreationOptions): Promise<yup.InferType<typeof userApiKeysCreateInputSchema> | yup.InferType<typeof teamApiKeysCreateInputSchema>> {\n return {\n description: options.description,\n expires_at_millis: options.expiresAt == null ? options.expiresAt : options.expiresAt.getTime(),\n is_public: options.isPublic,\n ...(type === \"user\" ? { user_id: userIdOrTeamId } : { team_id: userIdOrTeamId }),\n };\n}\n\n\nexport type ApiKeyUpdateOptions<Type extends ApiKeyType = ApiKeyType> = {\n description?: string,\n expiresAt?: Date | null,\n revoked?: boolean,\n};\nexport function apiKeyUpdateOptionsToCrud(type: \"user\", options: ApiKeyUpdateOptions<\"user\">): Promise<UserApiKeysCrud[\"Client\"][\"Update\"]>;\nexport function apiKeyUpdateOptionsToCrud(type: \"team\", options: ApiKeyUpdateOptions<\"team\">): Promise<TeamApiKeysCrud[\"Client\"][\"Update\"]>;\nexport function apiKeyUpdateOptionsToCrud(type: ApiKeyType, options: ApiKeyUpdateOptions): Promise<UserApiKeysCrud[\"Client\"][\"Update\"] | TeamApiKeysCrud[\"Client\"][\"Update\"]>;\nexport async function apiKeyUpdateOptionsToCrud(type: ApiKeyType, options: ApiKeyUpdateOptions): Promise<UserApiKeysCrud[\"Client\"][\"Update\"] | TeamApiKeysCrud[\"Client\"][\"Update\"]> {\n return filterUndefined({\n description: options.description,\n expires_at_millis: options.expiresAt == null ? options.expiresAt : options.expiresAt.getTime(),\n revoked: options.revoked,\n });\n}\n"],"mappings":";;;AAgDA,eAAsB,4BAA4B,MAAkB,gBAAwB,SAAkJ;AAC5O,QAAO;EACL,aAAa,QAAQ;EACrB,mBAAmB,QAAQ,aAAa,OAAO,QAAQ,YAAY,QAAQ,UAAU,SAAS;EAC9F,WAAW,QAAQ;EACnB,GAAI,SAAS,SAAS,EAAE,SAAS,gBAAgB,GAAG,EAAE,SAAS,gBAAgB;EAChF;;AAYH,eAAsB,0BAA0B,MAAkB,SAAkH;AAClL,QAAO,gBAAgB;EACrB,aAAa,QAAQ;EACrB,mBAAmB,QAAQ,aAAa,OAAO,QAAQ,YAAY,QAAQ,UAAU,SAAS;EAC9F,SAAS,QAAQ;EAClB,CAAC"}
@@ -1,15 +1,15 @@
1
1
  import { HexclaveAdminInterface } from "@hexclave/shared";
2
2
  import { Result } from "@hexclave/shared/dist/utils/results";
3
- import * as _stackframe_stack_shared_dist_interface_handler_urls0 from "@hexclave/shared/dist/interface/handler-urls";
4
- import * as _stackframe_stack_shared_dist_sessions0 from "@hexclave/shared/dist/sessions";
3
+ import * as _hexclave_shared_dist_interface_handler_urls0 from "@hexclave/shared/dist/interface/handler-urls";
4
+ import * as _hexclave_shared_dist_sessions0 from "@hexclave/shared/dist/sessions";
5
5
  import * as _____0 from "../..";
6
6
  import { AdminEmailOutbox, AdminSentEmail } from "../..";
7
7
  import * as ______common0 from "../../common";
8
8
  import { EmailConfig, stackAppInternalsSymbol } from "../../common";
9
9
  import * as __0 from "..";
10
10
  import * as __session_replay0 from "./session-replay";
11
- import * as _stackframe_stack_shared_dist_interface_crud_current_user0 from "@hexclave/shared/dist/interface/crud/current-user";
12
- import * as _stackframe_stack_shared_dist_interface_client_interface0 from "@hexclave/shared/dist/interface/client-interface";
11
+ import * as _hexclave_shared_dist_interface_crud_current_user0 from "@hexclave/shared/dist/interface/crud/current-user";
12
+ import * as _hexclave_shared_dist_interface_client_interface0 from "@hexclave/shared/dist/interface/client-interface";
13
13
  import { InternalApiKeyCreateCrudResponse } from "@hexclave/shared/dist/interface/admin-interface";
14
14
  import { AnalyticsQueryOptions, AnalyticsQueryResponse } from "@hexclave/shared/dist/interface/crud/analytics";
15
15
  import { EmailTemplateCrud } from "@hexclave/shared/dist/interface/crud/email-templates";
@@ -111,7 +111,7 @@ declare class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, Projec
111
111
  extraRequestHeaders?: Record<string, string>;
112
112
  projectId?: ProjectId | undefined;
113
113
  publishableClientKey?: string;
114
- urls?: _stackframe_stack_shared_dist_interface_handler_urls0.HandlerUrlOptions;
114
+ urls?: _hexclave_shared_dist_interface_handler_urls0.HandlerUrlOptions;
115
115
  oauthScopesOnSignIn?: Partial<_____0.OAuthScopesOnSignIn>;
116
116
  tokenStore?: ______common0.TokenStoreInit<HasTokenStore> | undefined;
117
117
  redirectMethod?: ______common0.RedirectMethod;
@@ -130,7 +130,7 @@ declare class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, Projec
130
130
  } & {
131
131
  uniqueIdentifier: string;
132
132
  };
133
- setCurrentUser: (userJsonPromise: Promise<_stackframe_stack_shared_dist_interface_crud_current_user0.CurrentUserCrud["Client"]["Read"] | null>) => void;
133
+ setCurrentUser: (userJsonPromise: Promise<_hexclave_shared_dist_interface_crud_current_user0.CurrentUserCrud["Client"]["Read"] | null>) => void;
134
134
  getConstructorOptions: () => {
135
135
  baseUrl?: string | {
136
136
  browser: string;
@@ -139,7 +139,7 @@ declare class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, Projec
139
139
  extraRequestHeaders?: Record<string, string>;
140
140
  projectId?: ProjectId | undefined;
141
141
  publishableClientKey?: string;
142
- urls?: _stackframe_stack_shared_dist_interface_handler_urls0.HandlerUrlOptions;
142
+ urls?: _hexclave_shared_dist_interface_handler_urls0.HandlerUrlOptions;
143
143
  oauthScopesOnSignIn?: Partial<_____0.OAuthScopesOnSignIn>;
144
144
  tokenStore?: ______common0.TokenStoreInit<HasTokenStore> | undefined;
145
145
  redirectMethod?: ______common0.RedirectMethod;
@@ -162,18 +162,18 @@ declare class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, Projec
162
162
  sendAnalyticsEventBatch: (body: string, options: {
163
163
  keepalive: boolean;
164
164
  }) => Promise<Result<Response, Error>>;
165
- addRequestListener: (listener: _stackframe_stack_shared_dist_interface_client_interface0.RequestListener) => () => void;
165
+ addRequestListener: (listener: _hexclave_shared_dist_interface_client_interface0.RequestListener) => () => void;
166
166
  sendRequest: (path: string, requestOptions: RequestInit, requestType?: "client" | "server" | "admin") => Promise<Response & {
167
167
  usedTokens: {
168
- accessToken: _stackframe_stack_shared_dist_sessions0.AccessToken;
169
- refreshToken: _stackframe_stack_shared_dist_sessions0.RefreshToken | null;
168
+ accessToken: _hexclave_shared_dist_sessions0.AccessToken;
169
+ refreshToken: _hexclave_shared_dist_sessions0.RefreshToken | null;
170
170
  } | null;
171
171
  }>;
172
172
  getRedirectMethod: () => ______common0.RedirectMethod;
173
173
  redirectToUrl: (url: string | URL, options?: {
174
174
  replace?: boolean;
175
175
  } | undefined) => Promise<void>;
176
- redirectToHandler: (handlerName: keyof _stackframe_stack_shared_dist_interface_handler_urls0.HandlerUrls, options?: ______common0.RedirectToOptions) => Promise<void>;
176
+ redirectToHandler: (handlerName: keyof _hexclave_shared_dist_interface_handler_urls0.HandlerUrls, options?: ______common0.RedirectToOptions) => Promise<void>;
177
177
  refreshOwnedProjects: () => Promise<void>;
178
178
  signInWithTokens: (tokens: {
179
179
  accessToken: string;
@@ -1 +1 @@
1
- {"version":3,"file":"admin-app-impl.d.ts","names":[],"sources":["../../../../../../src/lib/stack-app/apps/implementations/admin-app-impl.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyEa,4BAAA,kEAA8F,6BAAA,CAA8B,aAAA,EAAe,SAAA,aAAsB,aAAA,CAAc,aAAA,EAAe,SAAA;EAAA,UACvL,UAAA,EAAY,sBAAA;EAAA,iBAEb,kBAAA;EAAA,iBAGA,qBAAA;EAAA,iBAIA,qBAAA;EAAA,iBAGA,sBAAA;EAAA,iBAGA,yBAAA;EAAA,iBAGA,sBAAA;EAAA,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O,gBAAA;IAAoB,UAAA;EAAA;EAa9I,cAAA,CAAe,EAAA,WAAa,OAAA,CAAQ,gBAAA;EAKpC,iBAAA,CAAkB,EAAA,UAAY,OAAA,EAAS,wBAAA,GAA2B,OAAA,CAAQ,gBAAA;EAW1E,gBAAA,CAAiB,EAAA,WAAa,OAAA,CAAQ,gBAAA;EAItC,kBAAA,CAAmB,EAAA,WAAa,OAAA,CAAQ,gBAAA;EAIxC,iBAAA,CAAkB,EAAA,WAAa,OAAA,CAAQ,gBAAA;EAKvC,oBAAA,CAAA,GAAwB,OAAA;IAAiB,UAAA;IAAoB,eAAA;IAA0B,iBAAA;IAA4B,eAAA;EAAA;EAKnH,cAAA,CAAe,OAAA,EAAS,qBAAA,GAAwB,OAAA,CAAQ,sBAAA;EAIxD,kBAAA,CAAmB,OAAA,GAAU,yBAAA,GAA4B,OAAA,CAAQ,wBAAA;EAgCjE,gBAAA,CAAiB,eAAA,WAA0B,OAAA,CAAQ,kBAAA;EAgBnD,uBAAA,CAAwB,eAAA,UAAyB,OAAA,GAAU,8BAAA,GAAiC,OAAA,CAAQ,6BAAA;EAwBpG,2BAAA,CAA4B,eAAA,UAAyB,OAAA,WAAkB,OAAA,CAAQ,wCAAA;EAI/E,sBAAA,CAAuB,eAAA,UAAyB,OAAA;IAAY,MAAA;IAAiB,KAAA;EAAA,IAAmB,OAAA,CAAQ,4BAAA;EAoBxG,sCAAA,CACJ,UAAA;IAAc,wBAAA;EAAA,GACd,KAAA,YACC,OAAA;IACD,aAAA,EAAe,KAAA;MACb,EAAA;MACA,WAAA;MACA,YAAA;MACA,gBAAA,EAAkB,gBAAA;IAAA;IAEpB,kBAAA;EAAA;AAAA"}
@@ -564,7 +564,9 @@ var _StackAdminAppImplIncomplete = class extends _StackServerAppImplIncomplete {
564
564
  return { renderedHtml: result.rendered_html };
565
565
  }
566
566
  async setupPayments() {
567
- return await this._interface.setupPayments();
567
+ const result = await this._interface.setupPayments();
568
+ await this._stripeAccountInfoCache.refresh([]);
569
+ return result;
568
570
  }
569
571
  async createStripeWidgetAccountSession() {
570
572
  return await this._interface.createStripeWidgetAccountSession();
@@ -1 +1 @@
1
- {"version":3,"file":"admin-app-impl.js","names":[],"sources":["../../../../../../src/lib/stack-app/apps/implementations/admin-app-impl.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { KnownErrors, HexclaveAdminInterface } from \"@stackframe/stack-shared\";\nimport { getProductionModeErrors } from \"@stackframe/stack-shared/dist/helpers/production-mode\";\nimport { InternalApiKeyCreateCrudResponse } from \"@stackframe/stack-shared/dist/interface/admin-interface\";\nimport type { MetricsResponse, MetricsUserCounts, UserActivityResponse } from \"@stackframe/stack-shared/dist/interface/admin-metrics\";\nimport { AnalyticsQueryOptions, AnalyticsQueryResponse } from \"@stackframe/stack-shared/dist/interface/crud/analytics\";\nimport { EmailTemplateCrud } from \"@stackframe/stack-shared/dist/interface/crud/email-templates\";\nimport { InternalApiKeysCrud } from \"@stackframe/stack-shared/dist/interface/crud/internal-api-keys\";\nimport { ProjectsCrud } from \"@stackframe/stack-shared/dist/interface/crud/projects\";\nimport type { AdminGetSessionReplayChunkEventsResponse } from \"@stackframe/stack-shared/dist/interface/crud/session-replays\";\nimport type { Transaction, TransactionType } from \"@stackframe/stack-shared/dist/interface/crud/transactions\";\nimport type { RestrictedReason } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport type { MoneyAmount } from \"@stackframe/stack-shared/dist/utils/currency-constants\";\nimport { HexclaveAssertionError, throwErr } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport type { Json } from \"@stackframe/stack-shared/dist/utils/json\";\nimport { pick, typedEntries, typedValues } from \"@stackframe/stack-shared/dist/utils/objects\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { AdminEmailOutbox, AdminSentEmail } from \"../..\";\nimport { EmailConfig, stackAppInternalsSymbol } from \"../../common\";\nimport { AdminEmailTemplate } from \"../../email-templates\";\nimport { InternalApiKey, InternalApiKeyBase, InternalApiKeyBaseCrudRead, InternalApiKeyCreateOptions, InternalApiKeyFirstView, internalApiKeyCreateOptionsToCrud } from \"../../internal-api-keys\";\nimport { AdminProjectPermission, AdminProjectPermissionDefinition, AdminProjectPermissionDefinitionCreateOptions, AdminProjectPermissionDefinitionUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, adminProjectPermissionDefinitionCreateOptionsToCrud, adminProjectPermissionDefinitionUpdateOptionsToCrud, adminTeamPermissionDefinitionCreateOptionsToCrud, adminTeamPermissionDefinitionUpdateOptionsToCrud } from \"../../permissions\";\nimport { AdminOwnedProject, AdminProject, AdminProjectUpdateOptions, PushConfigOptions, adminProjectUpdateOptionsToCrud } from \"../../projects\";\nimport type { AdminSessionReplay, AdminSessionReplayChunk, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, ListSessionReplaysOptions, ListSessionReplaysResult, SessionReplayAllEventsResult } from \"../../session-replays\";\nimport { ManagedEmailProviderListItem, ManagedEmailProviderSetupResult, ManagedEmailProviderStatus, EmailOutboxUpdateOptions, StackAdminApp, StackAdminAppConstructorOptions } from \"../interfaces/admin-app\";\nimport { clientVersion, createCache, getDefaultExtraRequestHeaders, getDefaultProjectId, getDefaultPublishableClientKey, getDefaultSecretServerKey, getDefaultSuperSecretAdminKey, resolveApiUrls, resolveConstructorOptions } from \"./common\";\nimport { _StackServerAppImplIncomplete } from \"./server-app-impl\";\n\nimport { CompleteConfig, EnvironmentConfigOverrideOverride } from \"@stackframe/stack-shared/dist/config/schema\";\nimport { branchConfigSourceSchema } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport * as yup from \"yup\";\nimport { PushedConfigSource } from \"../../projects\";\n\ntype BranchConfigSourceApi = yup.InferType<typeof branchConfigSourceSchema>;\n/**\n * Converts a PushedConfigSource (SDK camelCase) to BranchConfigSourceApi (API snake_case).\n */\nfunction pushedConfigSourceToApi(source: PushedConfigSource): BranchConfigSourceApi {\n if (source.type === \"pushed-from-github\") {\n return {\n type: \"pushed-from-github\",\n owner: source.owner,\n repo: source.repo,\n branch: source.branch,\n commit_hash: source.commitHash,\n config_file_path: source.configFilePath,\n workflow_path: source.workflowPath,\n };\n }\n return source;\n}\n\n/**\n * Converts a BranchConfigSourceApi (API snake_case) to PushedConfigSource (SDK camelCase).\n */\nfunction apiToPushedConfigSource(source: BranchConfigSourceApi): PushedConfigSource {\n if (source.type === \"pushed-from-github\") {\n return {\n type: \"pushed-from-github\",\n owner: source.owner,\n repo: source.repo,\n branch: source.branch,\n commitHash: source.commit_hash,\n configFilePath: source.config_file_path,\n workflowPath: source.workflow_path,\n };\n }\n return source;\n}\n\nexport class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, ProjectId extends string> extends _StackServerAppImplIncomplete<HasTokenStore, ProjectId> implements StackAdminApp<HasTokenStore, ProjectId> {\n declare protected _interface: HexclaveAdminInterface;\n\n private readonly _adminProjectCache = createCache(async () => {\n return await this._interface.getProject();\n });\n private readonly _internalApiKeysCache = createCache(async () => {\n const res = await this._interface.listInternalApiKeys();\n return res;\n });\n private readonly _adminEmailThemeCache = createCache(async ([id]: [string]) => {\n return await this._interface.getEmailTheme(id);\n });\n private readonly _adminEmailThemesCache = createCache(async () => {\n return await this._interface.listEmailThemes();\n });\n private readonly _adminEmailTemplatesCache = createCache(async () => {\n return await this._interface.listInternalEmailTemplates();\n });\n private readonly _adminEmailDraftsCache = createCache(async () => {\n return await this._interface.listInternalEmailDrafts();\n });\n private readonly _adminTeamPermissionDefinitionsCache = createCache(async () => {\n return await this._interface.listTeamPermissionDefinitions();\n });\n private readonly _adminProjectPermissionDefinitionsCache = createCache(async () => {\n return await this._interface.listProjectPermissionDefinitions();\n });\n private readonly _svixTokenCache = createCache(async () => {\n return await this._interface.getSvixToken();\n });\n private readonly _metricsCache = createCache(async ([includeAnonymous]: [boolean]) => {\n return await this._interface.getMetrics(includeAnonymous);\n });\n private readonly _userActivityCache = createCache(async ([userId]: [string]) => {\n return await this._interface.getUserActivity(userId);\n });\n private readonly _metricsUserCountsCache = createCache(async () => {\n return await this._interface.getMetricsUserCounts();\n });\n private readonly _emailPreviewCache = createCache(async ([themeId, themeTsxSource, templateId, templateTsxSource]: [string | null | false | undefined, string | undefined, string | undefined, string | undefined]) => {\n return await this._interface.renderEmailPreview({ themeId, themeTsxSource, templateId, templateTsxSource });\n });\n private readonly _emailPreviewWithEditableMarkersCache = createCache(async ([themeId, themeTsxSource, templateId, templateTsxSource, editableSource]: [string | null | false | undefined, string | undefined, string | undefined, string | undefined, 'template' | 'theme' | 'both' | undefined]) => {\n return await this._interface.renderEmailPreview({ themeId, themeTsxSource, templateId, templateTsxSource, editableMarkers: true, editableSource });\n });\n private readonly _configOverridesCache = createCache(async () => {\n return await this._interface.getConfig();\n });\n private readonly _stripeAccountInfoCache = createCache(async () => {\n try {\n return await this._interface.getStripeAccountInfo();\n } catch (error: any) {\n if (error?.status === 404) {\n return null;\n }\n throw error;\n }\n });\n private readonly _transactionsCache = createCache(async ([cursor, limit, type, customerType, customerId]: [string | undefined, number | undefined, TransactionType | undefined, 'user' | 'team' | 'custom' | undefined, string | undefined]) => {\n return await this._interface.listTransactions({ cursor, limit, type, customerType, customerId });\n });\n\n constructor(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>, extraOptions?: { uniqueIdentifier?: string, checkString?: string, interface?: HexclaveAdminInterface }) {\n const resolvedOptions = resolveConstructorOptions(options);\n\n const publishableClientKey = resolvedOptions.publishableClientKey ?? getDefaultPublishableClientKey();\n\n super(resolvedOptions, {\n ...extraOptions,\n interface: extraOptions?.interface ?? (() => {\n const apiUrls = resolveApiUrls(resolvedOptions.baseUrl);\n return new HexclaveAdminInterface({\n getBaseUrl: () => apiUrls()[0],\n getApiUrls: apiUrls,\n projectId: resolvedOptions.projectId ?? getDefaultProjectId(),\n extraRequestHeaders: resolvedOptions.extraRequestHeaders ?? getDefaultExtraRequestHeaders(),\n clientVersion,\n ...resolvedOptions.projectOwnerSession ? {\n projectOwnerSession: resolvedOptions.projectOwnerSession,\n } : {\n ...(publishableClientKey ? { publishableClientKey } : {}),\n secretServerKey: resolvedOptions.secretServerKey ?? getDefaultSecretServerKey(),\n superSecretAdminKey: resolvedOptions.superSecretAdminKey ?? getDefaultSuperSecretAdminKey(),\n },\n });\n })(),\n });\n }\n\n _adminConfigFromCrud(data: { config_string: string }): CompleteConfig {\n return JSON.parse(data.config_string);\n }\n\n _adminOwnedProjectFromCrud(data: ProjectsCrud['Admin']['Read'], onRefresh: () => Promise<void>): AdminOwnedProject {\n if (this._tokenStoreInit !== null) {\n throw new HexclaveAssertionError(\"Owned apps must always have tokenStore === null — did you not create this project with app._createOwnedApp()?\");\n }\n return {\n ...this._adminProjectFromCrud(data, onRefresh),\n app: this as StackAdminApp<false>,\n };\n }\n\n _adminProjectFromCrud(data: ProjectsCrud['Admin']['Read'], onRefresh: () => Promise<void>): AdminProject {\n if (data.id !== this.projectId) {\n throw new HexclaveAssertionError(`The project ID of the provided project JSON (${data.id}) does not match the project ID of the app (${this.projectId})!`);\n }\n\n const app = this;\n return {\n id: data.id,\n displayName: data.display_name,\n description: data.description,\n createdAt: new Date(data.created_at_millis),\n isProductionMode: data.is_production_mode,\n isDevelopmentEnvironment: data.is_development_environment,\n ownerTeamId: data.owner_team_id,\n onboardingStatus: data.onboarding_status,\n logoUrl: data.logo_url,\n logoFullUrl: data.logo_full_url,\n logoDarkModeUrl: data.logo_dark_mode_url,\n logoFullDarkModeUrl: data.logo_full_dark_mode_url,\n config: {\n signUpEnabled: data.config.sign_up_enabled,\n credentialEnabled: data.config.credential_enabled,\n magicLinkEnabled: data.config.magic_link_enabled,\n passkeyEnabled: data.config.passkey_enabled,\n clientTeamCreationEnabled: data.config.client_team_creation_enabled,\n clientUserDeletionEnabled: data.config.client_user_deletion_enabled,\n allowLocalhost: data.config.allow_localhost,\n oauthAccountMergeStrategy: data.config.oauth_account_merge_strategy,\n allowUserApiKeys: data.config.allow_user_api_keys,\n allowTeamApiKeys: data.config.allow_team_api_keys,\n oauthProviders: data.config.oauth_providers.map((p) => ((p.type === 'shared' ? {\n id: p.id,\n type: 'shared',\n } as const : {\n id: p.id,\n type: 'standard',\n clientId: p.client_id ?? throwErr(\"Client ID is missing\"),\n clientSecret: p.client_secret ?? throwErr(\"Client secret is missing\"),\n facebookConfigId: p.facebook_config_id,\n microsoftTenantId: p.microsoft_tenant_id,\n appleBundleIds: p.apple_bundle_ids,\n } as const))),\n emailConfig: data.config.email_config.type === 'shared' ? {\n type: 'shared'\n } : {\n type: 'standard',\n host: data.config.email_config.host ?? throwErr(\"Email host is missing\"),\n port: data.config.email_config.port ?? throwErr(\"Email port is missing\"),\n username: data.config.email_config.username ?? throwErr(\"Email username is missing\"),\n password: data.config.email_config.password ?? throwErr(\"Email password is missing\"),\n senderName: data.config.email_config.sender_name ?? throwErr(\"Email sender name is missing\"),\n senderEmail: data.config.email_config.sender_email ?? throwErr(\"Email sender email is missing\"),\n },\n emailTheme: data.config.email_theme,\n domains: data.config.domains.map((d) => ({\n domain: d.domain,\n handlerPath: d.handler_path,\n })),\n createTeamOnSignUp: data.config.create_team_on_sign_up,\n teamCreatorDefaultPermissions: data.config.team_creator_default_permissions,\n teamMemberDefaultPermissions: data.config.team_member_default_permissions,\n userDefaultPermissions: data.config.user_default_permissions,\n },\n async getConfig() {\n return app._adminConfigFromCrud(await app._interface.getConfig());\n },\n async updateConfig(configOverride: EnvironmentConfigOverrideOverride) {\n await app._interface.updateConfigOverride(\"environment\", configOverride);\n await app._refreshProjectConfig();\n },\n async pushConfig(config: EnvironmentConfigOverrideOverride, options: PushConfigOptions) {\n await app._interface.setConfigOverride(\"branch\", config, pushedConfigSourceToApi(options.source));\n await app._refreshProjectConfig();\n },\n async updatePushedConfig(config: EnvironmentConfigOverrideOverride) {\n await app._interface.updateConfigOverride(\"branch\", config);\n await app._refreshProjectConfig();\n },\n async getPushedConfigSource(): Promise<PushedConfigSource> {\n const apiSource = await app._interface.getPushedConfigSource();\n return apiToPushedConfigSource(apiSource);\n },\n async unlinkPushedConfigSource(): Promise<void> {\n await app._interface.unlinkPushedConfigSource();\n await app._refreshProjectConfig();\n },\n async resetConfigOverrideKeys(level: \"branch\" | \"environment\", keys: string[]): Promise<void> {\n await app._interface.resetConfigOverrideKeys(level, keys);\n await app._refreshProjectConfig();\n },\n async getConfigOverride(level: \"branch\" | \"environment\"): Promise<Record<string, unknown>> {\n const result = await app._interface.getConfigOverride(level);\n return JSON.parse(result.config_string);\n },\n async replaceConfigOverride(level: \"branch\" | \"environment\", config: Record<string, unknown>): Promise<void> {\n if (level === \"branch\") {\n const source = await app._interface.getPushedConfigSource();\n await app._interface.setConfigOverride(level, config, source);\n } else {\n await app._interface.setConfigOverride(level, config);\n }\n await app._refreshProjectConfig();\n },\n async update(update: AdminProjectUpdateOptions) {\n const { requirePublishableClientKey, ...projectUpdate } = update;\n const updateOptions = adminProjectUpdateOptionsToCrud(projectUpdate);\n const hasConfigUpdate = !!updateOptions.config\n && typedValues(updateOptions.config).some((value) => value !== undefined);\n const hasProjectUpdate = typedEntries(updateOptions).some(([key, value]) => {\n if (key === \"config\") return hasConfigUpdate;\n return value !== undefined;\n });\n\n if (hasProjectUpdate) {\n await app._interface.updateProject(updateOptions);\n await onRefresh();\n }\n\n if (requirePublishableClientKey !== undefined) {\n await app._interface.updateConfigOverride(\"project\", {\n \"project.requirePublishableClientKey\": requirePublishableClientKey,\n });\n await app._refreshProjectConfig();\n }\n },\n async delete() {\n await app._interface.deleteProject();\n },\n async getProductionModeErrors() {\n return getProductionModeErrors(data);\n },\n };\n }\n\n _adminEmailTemplateFromCrud(data: EmailTemplateCrud['Admin']['Read']): AdminEmailTemplate {\n return {\n type: data.type,\n subject: data.subject,\n content: data.content,\n isDefault: data.is_default,\n };\n }\n\n override async getProject(): Promise<AdminProject> {\n return this._adminProjectFromCrud(\n Result.orThrow(await this._adminProjectCache.getOrWait([], \"write-only\")),\n () => this._refreshProject()\n );\n }\n\n\n protected _createInternalApiKeyBaseFromCrud(data: InternalApiKeyBaseCrudRead): InternalApiKeyBase {\n const app = this;\n return {\n id: data.id,\n description: data.description,\n expiresAt: new Date(data.expires_at_millis),\n manuallyRevokedAt: data.manually_revoked_at_millis ? new Date(data.manually_revoked_at_millis) : null,\n createdAt: new Date(data.created_at_millis),\n isValid() {\n return this.whyInvalid() === null;\n },\n whyInvalid() {\n if (this.expiresAt.getTime() < Date.now()) return \"expired\";\n if (this.manuallyRevokedAt) return \"manually-revoked\";\n return null;\n },\n async revoke() {\n const res = await app._interface.revokeInternalApiKeyById(data.id);\n await app._refreshInternalApiKeys();\n return res;\n }\n };\n }\n\n protected _createInternalApiKeyFromCrud(data: InternalApiKeysCrud[\"Admin\"][\"Read\"]): InternalApiKey {\n return {\n ...this._createInternalApiKeyBaseFromCrud(data),\n publishableClientKey: data.publishable_client_key ? { lastFour: data.publishable_client_key.last_four } : null,\n secretServerKey: data.secret_server_key ? { lastFour: data.secret_server_key.last_four } : null,\n superSecretAdminKey: data.super_secret_admin_key ? { lastFour: data.super_secret_admin_key.last_four } : null,\n };\n }\n\n protected _createInternalApiKeyFirstViewFromCrud(data: InternalApiKeyCreateCrudResponse): InternalApiKeyFirstView {\n return {\n ...this._createInternalApiKeyBaseFromCrud(data),\n publishableClientKey: data.publishable_client_key,\n secretServerKey: data.secret_server_key,\n superSecretAdminKey: data.super_secret_admin_key,\n };\n }\n\n async listInternalApiKeys(): Promise<InternalApiKey[]> {\n const crud = Result.orThrow(await this._internalApiKeysCache.getOrWait([], \"write-only\"));\n return crud.map((j) => this._createInternalApiKeyFromCrud(j));\n }\n\n\n async createInternalApiKey(options: InternalApiKeyCreateOptions): Promise<InternalApiKeyFirstView> {\n const crud = await this._interface.createInternalApiKey(internalApiKeyCreateOptionsToCrud(options));\n await this._refreshInternalApiKeys();\n return this._createInternalApiKeyFirstViewFromCrud(crud);\n }\n\n\n async listEmailThemes(): Promise<{ id: string, displayName: string }[]> {\n const crud = Result.orThrow(await this._adminEmailThemesCache.getOrWait([], \"write-only\"));\n return crud.map((theme) => ({\n id: theme.id,\n displayName: theme.display_name,\n }));\n }\n\n async listEmailTemplates(): Promise<{ id: string, displayName: string, themeId?: string, tsxSource: string }[]> {\n const crud = Result.orThrow(await this._adminEmailTemplatesCache.getOrWait([], \"write-only\"));\n return crud.map((template) => ({\n id: template.id,\n displayName: template.display_name,\n themeId: template.theme_id,\n tsxSource: template.tsx_source,\n }));\n }\n\n async listEmailDrafts(): Promise<{ id: string, displayName: string, themeId: string | undefined | false, tsxSource: string, sentAt: Date | null }[]> {\n const crud = Result.orThrow(await this._adminEmailDraftsCache.getOrWait([], \"write-only\"));\n return crud.map((draft) => ({\n id: draft.id,\n displayName: draft.display_name,\n themeId: draft.theme_id,\n tsxSource: draft.tsx_source,\n sentAt: draft.sent_at_millis ? new Date(draft.sent_at_millis) : null,\n }));\n }\n\n\n async createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise<AdminTeamPermission> {\n const crud = await this._interface.createTeamPermissionDefinition(adminTeamPermissionDefinitionCreateOptionsToCrud(data));\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n return this._serverTeamPermissionDefinitionFromCrud(crud);\n }\n\n async updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions) {\n await this._interface.updateTeamPermissionDefinition(permissionId, adminTeamPermissionDefinitionUpdateOptionsToCrud(data));\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n }\n\n async deleteTeamPermissionDefinition(permissionId: string): Promise<void> {\n await this._interface.deleteTeamPermissionDefinition(permissionId);\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n }\n\n async listTeamPermissionDefinitions(): Promise<AdminTeamPermissionDefinition[]> {\n const crud = Result.orThrow(await this._adminTeamPermissionDefinitionsCache.getOrWait([], \"write-only\"));\n return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));\n }\n\n async listTeamPermissionDefinitionsPaginated(\n options: { limit: number, cursor?: string, query?: string },\n ): Promise<{ items: AdminTeamPermissionDefinition[], nextCursor: string | null }> {\n const result = await this._interface.listTeamPermissionDefinitionsPaginated(options);\n return {\n items: result.items.map((p) => this._serverTeamPermissionDefinitionFromCrud(p)),\n nextCursor: result.nextCursor,\n };\n }\n\n\n async createProjectPermissionDefinition(data: AdminProjectPermissionDefinitionCreateOptions): Promise<AdminProjectPermission> {\n const crud = await this._interface.createProjectPermissionDefinition(adminProjectPermissionDefinitionCreateOptionsToCrud(data));\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n return this._serverProjectPermissionDefinitionFromCrud(crud);\n }\n\n async updateProjectPermissionDefinition(permissionId: string, data: AdminProjectPermissionDefinitionUpdateOptions) {\n await this._interface.updateProjectPermissionDefinition(permissionId, adminProjectPermissionDefinitionUpdateOptionsToCrud(data));\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n }\n\n async deleteProjectPermissionDefinition(permissionId: string): Promise<void> {\n await this._interface.deleteProjectPermissionDefinition(permissionId);\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n }\n\n async listProjectPermissionDefinitions(): Promise<AdminProjectPermissionDefinition[]> {\n const crud = Result.orThrow(await this._adminProjectPermissionDefinitionsCache.getOrWait([], \"write-only\"));\n return crud.map((p) => this._serverProjectPermissionDefinitionFromCrud(p));\n }\n\n\n protected override async _refreshProject() {\n await Promise.all([\n super._refreshProject(),\n this._adminProjectCache.refresh([]),\n ]);\n }\n\n protected async _refreshProjectConfig() {\n await Promise.all([\n this._configOverridesCache.refresh([]),\n this._adminProjectCache.refresh([]),\n ]);\n }\n\n protected async _refreshInternalApiKeys() {\n await this._internalApiKeysCache.refresh([]);\n }\n\n protected override async _refreshUsers() {\n await Promise.all([\n super._refreshUsers(),\n this._metricsCache.refresh([false]),\n this._metricsCache.refresh([true]),\n this._metricsUserCountsCache.refresh([]),\n ]);\n }\n\n get [stackAppInternalsSymbol]() {\n return {\n ...super[stackAppInternalsSymbol],\n };\n }\n\n async sendTestEmail(options: {\n recipientEmail: string,\n emailConfig: EmailConfig,\n }): Promise<Result<undefined, { errorMessage: string }>> {\n let response: { success: boolean, error_message?: string };\n try {\n response = await this._interface.sendTestEmail({\n recipient_email: options.recipientEmail,\n email_config: {\n ...(pick(options.emailConfig, ['host', 'port', 'username', 'password'])),\n sender_email: options.emailConfig.senderEmail,\n sender_name: options.emailConfig.senderName,\n },\n });\n } catch (error) {\n // Translate the quota-exhaustion KnownError into the existing\n // Result.error shape so SDK/dashboard callers don't need to branch on\n // exceptions. The backend throws `ItemQuantityInsufficientAmount`\n // (consistent with every other limit-rejection endpoint), but this\n // method's historical contract has always been a `Result`.\n if (error instanceof KnownErrors.ItemQuantityInsufficientAmount) {\n return Result.error({\n errorMessage: \"Monthly email sending limit exceeded for your plan. Please upgrade your plan or wait until next month before sending more test emails.\",\n });\n }\n throw error;\n }\n\n if (response.success) {\n return Result.ok(undefined);\n } else {\n return Result.error({ errorMessage: response.error_message ?? throwErr(\"Email test error not specified\") });\n }\n }\n\n async sendTestWebhook(options: { endpointId: string }): Promise<Result<undefined, { errorMessage: string }>> {\n const response = await this._interface.sendTestWebhook({\n endpoint_id: options.endpointId,\n });\n\n if (response.success) {\n return Result.ok(undefined);\n } else {\n return Result.error({ errorMessage: response.error_message ?? throwErr(\"Webhook test error not specified\") });\n }\n }\n\n async listSentEmails(): Promise<AdminSentEmail[]> {\n const response = await this._interface.listSentEmails();\n return response.items.map((email) => ({\n id: email.id,\n to: email.to ?? [],\n subject: email.subject,\n recipient: email.to?.[0] ?? \"\",\n sentAt: new Date(email.sent_at_millis),\n error: email.error,\n }));\n }\n\n async setupManagedEmailProvider(options: { subdomain: string, senderLocalPart: string }): Promise<ManagedEmailProviderSetupResult> {\n const response = await this._interface.setupManagedEmailProvider({\n subdomain: options.subdomain,\n sender_local_part: options.senderLocalPart,\n });\n return {\n domainId: response.domain_id,\n subdomain: response.subdomain,\n senderLocalPart: response.sender_local_part,\n nameServerRecords: response.name_server_records,\n status: response.status,\n };\n }\n\n async checkManagedEmailStatus(options: { domainId: string, subdomain: string, senderLocalPart: string }): Promise<ManagedEmailProviderStatus> {\n const response = await this._interface.checkManagedEmailStatus({\n domain_id: options.domainId,\n subdomain: options.subdomain,\n sender_local_part: options.senderLocalPart,\n });\n return {\n status: response.status,\n };\n }\n\n async listManagedEmailDomains(): Promise<ManagedEmailProviderListItem[]> {\n const response = await this._interface.listManagedEmailDomains();\n return response.items.map((item) => ({\n domainId: item.domain_id,\n subdomain: item.subdomain,\n senderLocalPart: item.sender_local_part,\n status: item.status,\n nameServerRecords: item.name_server_records,\n }));\n }\n\n async applyManagedEmailProvider(options: { domainId: string }): Promise<{ status: \"applied\" }> {\n const result = await this._interface.applyManagedEmailProvider({\n domain_id: options.domainId,\n });\n await this._refreshProjectConfig();\n return result;\n }\n\n async deleteManagedEmailDomain(options: { resendDomainId: string }): Promise<{ status: \"deleted\" }> {\n return await this._interface.deleteManagedEmailDomain({\n resend_domain_id: options.resendDomainId,\n });\n }\n\n async sendSignInInvitationEmail(email: string, callbackUrl: string): Promise<void> {\n await this._interface.sendSignInInvitationEmail(email, callbackUrl);\n }\n\n async createEmailTemplate(displayName: string): Promise<{ id: string }> {\n const result = await this._interface.createEmailTemplate(displayName);\n await this._adminEmailTemplatesCache.refresh([]);\n\n return result;\n }\n\n async deleteEmailTemplate(id: string): Promise<void> {\n await this._interface.deleteEmailTemplate(id);\n await this._adminEmailTemplatesCache.refresh([]);\n }\n\n async createEmailDraft(options: { displayName: string, themeId?: string | false, tsxSource?: string }): Promise<{ id: string }> {\n const result = await this._interface.createEmailDraft({\n display_name: options.displayName,\n theme_id: options.themeId,\n tsx_source: options.tsxSource,\n });\n await this._adminEmailDraftsCache.refresh([]);\n return result;\n }\n\n async updateEmailDraft(id: string, data: { displayName?: string, themeId?: string | undefined | false, tsxSource?: string }): Promise<void> {\n await this._interface.updateEmailDraft(id, {\n display_name: data.displayName,\n theme_id: data.themeId,\n tsx_source: data.tsxSource,\n });\n await this._adminEmailDraftsCache.refresh([]);\n }\n\n async deleteEmailDraft(id: string): Promise<void> {\n await this._interface.deleteEmailDraft(id);\n const current = this._adminEmailDraftsCache.getIfCached([]);\n if (current.status === \"ok\" && current.data.status === \"ok\") {\n this._adminEmailDraftsCache.forceSetCachedValue([], Result.ok(current.data.data.filter((d) => d.id !== id)));\n }\n await this._adminEmailDraftsCache.refresh([]);\n }\n\n async refreshEmailDrafts(): Promise<void> {\n await this._adminEmailDraftsCache.refresh([]);\n }\n\n async saveChatMessage(threadId: string, message: any): Promise<void> {\n await this._interface.saveChatMessage(threadId, message);\n }\n\n async listChatMessages(threadId: string): Promise<{ messages: Array<any> }> {\n return await this._interface.listChatMessages(threadId);\n }\n\n async rewriteTemplateSourceWithAI(templateTsxSource: string): Promise<{ tsxSource: string }> {\n const result = await this._interface.rewriteTemplateSourceWithAI(templateTsxSource);\n return { tsxSource: result.tsx_source };\n }\n\n async createEmailTheme(displayName: string): Promise<{ id: string }> {\n const result = await this._interface.createEmailTheme(displayName);\n await this._adminEmailThemesCache.refresh([]);\n return result;\n }\n\n async getEmailPreview(options: { themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string }): Promise<string> {\n return (await this._interface.renderEmailPreview(options)).html;\n }\n async getEmailPreviewWithEditableMarkers(options: { themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string, editableSource?: 'template' | 'theme' | 'both' }): Promise<{ html: string, editableRegions?: Record<string, unknown> }> {\n const result = await this._interface.renderEmailPreview({ ...options, editableMarkers: true, editableSource: options.editableSource });\n return { html: result.html, editableRegions: result.editable_regions };\n }\n async updateEmailTheme(id: string, tsxSource: string): Promise<void> {\n await this._interface.updateEmailTheme(id, tsxSource);\n await this._adminEmailThemesCache.refresh([]);\n await this._adminEmailThemeCache.invalidate([id]);\n }\n\n async deleteEmailTheme(id: string): Promise<void> {\n await this._interface.deleteEmailTheme(id);\n await this._adminEmailThemesCache.refresh([]);\n await this._adminEmailThemeCache.invalidate([id]);\n }\n\n async updateEmailTemplate(id: string, tsxSource: string, themeId: string | null | false): Promise<{ renderedHtml: string }> {\n const result = await this._interface.updateEmailTemplate(id, tsxSource, themeId);\n await this._adminEmailTemplatesCache.refresh([]);\n return { renderedHtml: result.rendered_html };\n }\n\n async setupPayments(): Promise<{ url: string }> {\n return await this._interface.setupPayments();\n }\n\n async createStripeWidgetAccountSession(): Promise<{ client_secret: string }> {\n return await this._interface.createStripeWidgetAccountSession();\n }\n\n async getPaymentMethodConfigs(): Promise<{ configId: string, methods: Array<{ id: string, name: string, enabled: boolean, available: boolean, overridable: boolean }> } | null> {\n return await this._interface.getPaymentMethodConfigs();\n }\n\n async updatePaymentMethodConfigs(configId: string, updates: Record<string, 'on' | 'off'>): Promise<void> {\n await this._interface.updatePaymentMethodConfigs(configId, updates);\n }\n\n async createItemQuantityChange(options: (\n { userId: string, itemId: string, quantity: number, expiresAt?: string, description?: string } |\n { teamId: string, itemId: string, quantity: number, expiresAt?: string, description?: string } |\n { customCustomerId: string, itemId: string, quantity: number, expiresAt?: string, description?: string }\n )): Promise<void> {\n await this._interface.updateItemQuantity(\n { itemId: options.itemId, ...(\"userId\" in options ? { userId: options.userId } : (\"teamId\" in options ? { teamId: options.teamId } : { customCustomerId: options.customCustomerId })) },\n {\n delta: options.quantity,\n expires_at: options.expiresAt,\n description: options.description,\n allow_negative: true,\n }\n );\n }\n\n async refundTransaction(options: {\n type: \"subscription\" | \"one-time-purchase\",\n id: string,\n invoiceId?: string,\n amountUsd: MoneyAmount,\n endAction?: \"now\" | \"at-period-end\",\n }): Promise<{ refundTransactionId: string }> {\n const result = await this._interface.refundTransaction({\n type: options.type,\n id: options.id,\n invoiceId: options.invoiceId,\n amountUsd: options.amountUsd,\n endAction: options.endAction,\n });\n await this._transactionsCache.invalidateWhere(() => true);\n return { refundTransactionId: result.refundTransactionId };\n }\n\n async listTransactions(params: { cursor?: string, limit?: number, type?: TransactionType, customerType?: 'user' | 'team' | 'custom', customerId?: string }): Promise<{ transactions: Transaction[], nextCursor: string | null }> {\n const crud = Result.orThrow(await this._transactionsCache.getOrWait([params.cursor, params.limit, params.type, params.customerType, params.customerId] as const, \"write-only\"));\n return crud;\n }\n\n // Email Outbox methods\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Complex discriminated union conversion from API response\n private _emailOutboxCrudToAdmin(crud: any): AdminEmailOutbox {\n const recipient = crud.to;\n let to: AdminEmailOutbox[\"to\"];\n if (recipient.type === \"user-primary-email\") {\n to = { type: \"user-primary-email\", userId: recipient.user_id };\n } else if (recipient.type === \"user-custom-emails\") {\n to = { type: \"user-custom-emails\", userId: recipient.user_id, emails: recipient.emails };\n } else {\n to = { type: \"custom-emails\", emails: recipient.emails };\n }\n\n // Base fields present on all emails\n const base = {\n id: crud.id as string,\n createdAt: new Date(crud.created_at_millis),\n updatedAt: new Date(crud.updated_at_millis),\n tsxSource: crud.tsx_source as string,\n themeId: (crud.theme_id as string | null) ?? null,\n to,\n scheduledAt: new Date(crud.scheduled_at_millis),\n // Source tracking for grouping emails by template/draft\n createdWith: crud.created_with as \"draft\" | \"programmatic-call\",\n emailDraftId: crud.email_draft_id as string | null,\n emailProgrammaticCallTemplateId: crud.email_programmatic_call_template_id as string | null,\n variables: (crud.variables ?? {}) as Record<string, Json>,\n isPaused: false as const,\n hasRendered: false as const,\n hasDelivered: false as const,\n // Retry tracking fields\n sendRetries: crud.send_retries as number,\n nextSendRetryAt: crud.next_send_retry_at_millis ? new Date(crud.next_send_retry_at_millis) : null,\n sendAttemptErrors: crud.send_attempt_errors ? (crud.send_attempt_errors as Array<{\n attempt_number: number,\n timestamp: string,\n external_message: string,\n external_details: Record<string, unknown>,\n internal_message: string,\n internal_details: Record<string, unknown>,\n }>).map((e) => ({\n attemptNumber: e.attempt_number,\n timestamp: e.timestamp,\n externalMessage: e.external_message,\n externalDetails: e.external_details,\n internalMessage: e.internal_message,\n internalDetails: e.internal_details,\n })) : null,\n };\n\n // Rendered fields (available after rendering completes successfully)\n const rendered = crud.has_rendered ? {\n ...base,\n startedRenderingAt: new Date(crud.started_rendering_at_millis),\n renderedAt: new Date(crud.rendered_at_millis),\n subject: crud.subject as string,\n html: crud.html as string | null,\n text: crud.text as string | null,\n isTransactional: crud.is_transactional as boolean,\n isHighPriority: crud.is_high_priority as boolean,\n notificationCategoryId: crud.notification_category_id as string | null,\n hasRendered: true as const,\n } : null;\n\n // Started sending fields\n const startedSending = rendered && crud.started_sending_at_millis ? {\n ...rendered,\n startedSendingAt: new Date(crud.started_sending_at_millis),\n } : null;\n\n // Finished delivering fields\n const finishedDelivering = startedSending && crud.has_delivered ? {\n ...startedSending,\n deliveredAt: new Date(crud.delivered_at_millis),\n hasDelivered: true as const,\n } : null;\n\n // Use type assertion at the end because TypeScript has trouble with\n // spread + override patterns on discriminated unions with const literal types\n const result = (() => {\n switch (crud.status) {\n case \"paused\": {\n return {\n ...base,\n status: \"paused\" as const,\n simpleStatus: \"in-progress\" as const,\n isPaused: true as const,\n };\n }\n case \"preparing\": {\n return {\n ...base,\n status: \"preparing\" as const,\n simpleStatus: \"in-progress\" as const,\n };\n }\n case \"rendering\": {\n return {\n ...base,\n status: \"rendering\" as const,\n simpleStatus: \"in-progress\" as const,\n startedRenderingAt: new Date(crud.started_rendering_at_millis),\n };\n }\n case \"render-error\": {\n return {\n ...base,\n status: \"render-error\" as const,\n simpleStatus: \"error\" as const,\n startedRenderingAt: new Date(crud.started_rendering_at_millis),\n renderedAt: new Date(crud.rendered_at_millis),\n renderError: crud.render_error,\n };\n }\n case \"scheduled\": {\n return {\n ...rendered!,\n status: \"scheduled\" as const,\n simpleStatus: \"in-progress\" as const,\n };\n }\n case \"queued\": {\n return {\n ...rendered!,\n status: \"queued\" as const,\n simpleStatus: \"in-progress\" as const,\n };\n }\n case \"sending\": {\n return {\n ...startedSending!,\n status: \"sending\" as const,\n simpleStatus: \"in-progress\" as const,\n };\n }\n case \"server-error\": {\n return {\n ...startedSending!,\n status: \"server-error\" as const,\n simpleStatus: \"error\" as const,\n errorAt: new Date(crud.error_at_millis),\n serverError: crud.server_error,\n };\n }\n case \"skipped\": {\n return {\n ...base,\n status: \"skipped\" as const,\n simpleStatus: \"ok\" as const,\n skippedAt: new Date(crud.skipped_at_millis),\n skippedReason: crud.skipped_reason,\n skippedDetails: crud.skipped_details ?? {},\n hasRendered: crud.has_rendered as boolean,\n // Optional fields\n startedRenderingAt: crud.started_rendering_at_millis ? new Date(crud.started_rendering_at_millis) : undefined,\n renderedAt: crud.rendered_at_millis ? new Date(crud.rendered_at_millis) : undefined,\n subject: crud.subject,\n html: crud.html,\n text: crud.text,\n isTransactional: crud.is_transactional,\n isHighPriority: crud.is_high_priority,\n notificationCategoryId: crud.notification_category_id,\n startedSendingAt: crud.started_sending_at_millis ? new Date(crud.started_sending_at_millis) : undefined,\n };\n }\n case \"bounced\": {\n return {\n ...startedSending!,\n status: \"bounced\" as const,\n simpleStatus: \"error\" as const,\n bouncedAt: new Date(crud.bounced_at_millis),\n };\n }\n case \"delivery-delayed\": {\n return {\n ...startedSending!,\n status: \"delivery-delayed\" as const,\n simpleStatus: \"ok\" as const,\n deliveryDelayedAt: new Date(crud.delivery_delayed_at_millis),\n };\n }\n case \"sent\": {\n return {\n ...finishedDelivering!,\n status: \"sent\" as const,\n simpleStatus: \"ok\" as const,\n canHaveDeliveryInfo: crud.can_have_delivery_info,\n };\n }\n case \"opened\": {\n return {\n ...finishedDelivering!,\n status: \"opened\" as const,\n simpleStatus: \"ok\" as const,\n openedAt: new Date(crud.opened_at_millis),\n canHaveDeliveryInfo: true as const,\n };\n }\n case \"clicked\": {\n return {\n ...finishedDelivering!,\n status: \"clicked\" as const,\n simpleStatus: \"ok\" as const,\n clickedAt: new Date(crud.clicked_at_millis),\n canHaveDeliveryInfo: true as const,\n };\n }\n case \"marked-as-spam\": {\n return {\n ...finishedDelivering!,\n status: \"marked-as-spam\" as const,\n simpleStatus: \"ok\" as const,\n markedAsSpamAt: new Date(crud.marked_as_spam_at_millis),\n canHaveDeliveryInfo: true as const,\n };\n }\n default: {\n throw new HexclaveAssertionError(`Unknown email outbox status: ${crud.status}`, { status: crud.status });\n }\n }\n })();\n // The type system has difficulty with spread + override patterns on discriminated unions,\n // so we use a type assertion here. The switch statement above ensures we return the correct shape.\n return result as AdminEmailOutbox;\n }\n\n async listOutboxEmails(options?: { status?: string, simpleStatus?: string, limit?: number, cursor?: string }): Promise<{ items: AdminEmailOutbox[], nextCursor: string | null }> {\n const response = await this._interface.listOutboxEmails({\n status: options?.status,\n simple_status: options?.simpleStatus,\n limit: options?.limit,\n cursor: options?.cursor,\n });\n return {\n items: response.items.map((item) => this._emailOutboxCrudToAdmin(item)),\n nextCursor: response.pagination?.next_cursor ?? null,\n };\n }\n\n async getOutboxEmail(id: string): Promise<AdminEmailOutbox> {\n const response = await this._interface.getOutboxEmail(id);\n return this._emailOutboxCrudToAdmin(response);\n }\n\n async updateOutboxEmail(id: string, options: EmailOutboxUpdateOptions): Promise<AdminEmailOutbox> {\n const response = await this._interface.updateOutboxEmail(id, {\n is_paused: options.isPaused,\n scheduled_at_millis: options.scheduledAtMillis,\n cancel: options.cancel,\n tsx_source: options.tsxSource,\n theme_id: options.themeId,\n });\n return this._emailOutboxCrudToAdmin(response);\n }\n\n async pauseOutboxEmail(id: string): Promise<AdminEmailOutbox> {\n return await this.updateOutboxEmail(id, { isPaused: true });\n }\n\n async unpauseOutboxEmail(id: string): Promise<AdminEmailOutbox> {\n return await this.updateOutboxEmail(id, { isPaused: false });\n }\n\n async cancelOutboxEmail(id: string): Promise<AdminEmailOutbox> {\n return await this.updateOutboxEmail(id, { cancel: true });\n }\n\n\n async getStripeAccountInfo(): Promise<null | { account_id: string, charges_enabled: boolean, details_submitted: boolean, payouts_enabled: boolean }> {\n return await this._interface.getStripeAccountInfo();\n }\n\n\n async queryAnalytics(options: AnalyticsQueryOptions): Promise<AnalyticsQueryResponse> {\n return await this._interface.queryAnalytics(options);\n }\n\n async listSessionReplays(options?: ListSessionReplaysOptions): Promise<ListSessionReplaysResult> {\n const response = await this._interface.listSessionReplays({\n cursor: options?.cursor,\n limit: options?.limit,\n user_ids: options?.userIds,\n team_ids: options?.teamIds,\n duration_ms_min: options?.durationMsMin,\n duration_ms_max: options?.durationMsMax,\n last_event_at_from_millis: options?.lastEventAtFromMillis,\n last_event_at_to_millis: options?.lastEventAtToMillis,\n click_count_min: options?.clickCountMin,\n });\n\n const items: AdminSessionReplay[] = response.items.map((r) => ({\n id: r.id,\n projectUser: {\n id: r.project_user.id,\n displayName: r.project_user.display_name,\n primaryEmail: r.project_user.primary_email,\n },\n startedAt: new Date(r.started_at_millis),\n lastEventAt: new Date(r.last_event_at_millis),\n chunkCount: r.chunk_count,\n eventCount: r.event_count,\n }));\n\n return {\n items,\n nextCursor: response.pagination.next_cursor,\n };\n }\n\n async getSessionReplay(sessionReplayId: string): Promise<AdminSessionReplay> {\n const response = await this._interface.getSessionReplay(sessionReplayId);\n return {\n id: response.id,\n projectUser: {\n id: response.project_user.id,\n displayName: response.project_user.display_name,\n primaryEmail: response.project_user.primary_email,\n },\n startedAt: new Date(response.started_at_millis),\n lastEventAt: new Date(response.last_event_at_millis),\n chunkCount: response.chunk_count,\n eventCount: response.event_count,\n };\n }\n\n async listSessionReplayChunks(sessionReplayId: string, options?: ListSessionReplayChunksOptions): Promise<ListSessionReplayChunksResult> {\n const response = await this._interface.listSessionReplayChunks(sessionReplayId, {\n cursor: options?.cursor,\n limit: options?.limit,\n });\n\n const items: AdminSessionReplayChunk[] = response.items.map((c) => ({\n id: c.id,\n batchId: c.batch_id,\n sessionReplaySegmentId: c.session_replay_segment_id,\n browserSessionId: c.browser_session_id,\n eventCount: c.event_count,\n byteLength: c.byte_length,\n firstEventAt: new Date(c.first_event_at_millis),\n lastEventAt: new Date(c.last_event_at_millis),\n createdAt: new Date(c.created_at_millis),\n }));\n\n return {\n items,\n nextCursor: response.pagination.next_cursor,\n };\n }\n\n async getSessionReplayChunkEvents(sessionReplayId: string, chunkId: string): Promise<AdminGetSessionReplayChunkEventsResponse> {\n return await this._interface.getSessionReplayChunkEvents(sessionReplayId, chunkId);\n }\n\n async getSessionReplayEvents(sessionReplayId: string, options?: { offset?: number, limit?: number }): Promise<SessionReplayAllEventsResult> {\n const response = await this._interface.getSessionReplayEvents(sessionReplayId, options);\n return {\n chunks: response.chunks.map((c) => ({\n id: c.id,\n batchId: c.batch_id,\n sessionReplaySegmentId: c.session_replay_segment_id,\n eventCount: c.event_count,\n byteLength: c.byte_length,\n firstEventAt: new Date(c.first_event_at_millis),\n lastEventAt: new Date(c.last_event_at_millis),\n createdAt: new Date(c.created_at_millis),\n })),\n chunkEvents: response.chunk_events.map((ce) => ({\n chunkId: ce.chunk_id,\n events: ce.events,\n })),\n };\n }\n\n async previewAffectedUsersByOnboardingChange(\n onboarding: { requireEmailVerification?: boolean },\n limit?: number,\n ): Promise<{\n affectedUsers: Array<{\n id: string,\n displayName: string | null,\n primaryEmail: string | null,\n restrictedReason: RestrictedReason,\n }>,\n totalAffectedCount: number,\n }> {\n const result = await this._interface.previewAffectedUsersByOnboardingChange(\n { require_email_verification: onboarding.requireEmailVerification },\n limit,\n );\n return {\n affectedUsers: result.affected_users.map(u => ({\n id: u.id,\n displayName: u.display_name,\n primaryEmail: u.primary_email,\n restrictedReason: u.restricted_reason as RestrictedReason,\n })),\n totalAffectedCount: result.total_affected_count,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,SAAS,wBAAwB,QAAmD;AAClF,KAAI,OAAO,SAAS,qBAClB,QAAO;EACL,MAAM;EACN,OAAO,OAAO;EACd,MAAM,OAAO;EACb,QAAQ,OAAO;EACf,aAAa,OAAO;EACpB,kBAAkB,OAAO;EACzB,eAAe,OAAO;EACvB;AAEH,QAAO;;;;;AAMT,SAAS,wBAAwB,QAAmD;AA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E;IACd,cAAc,IAAI,KAAK,EAAE,sBAAsB;IAC/C,aAAa,IAAI,KAAK,EAAE,qBAAqB;IAC7C,WAAW,IAAI,KAAK,EAAE,kBAAkB;IACzC,EAAE;GACH,aAAa,SAAS,aAAa,KAAK,QAAQ;IAC9C,SAAS,GAAG;IACZ,QAAQ,GAAG;IACZ,EAAE;GACJ;;CAGH,MAAM,uCACJ,YACA,OASC;EACD,MAAM,SAAS,MAAM,KAAK,WAAW,uCACnC,EAAE,4BAA4B,WAAW,0BAA0B,EACnE,MACD;AACD,SAAO;GACL,eAAe,OAAO,eAAe,KAAI,OAAM;IAC7C,IAAI,EAAE;IACN,aAAa,EAAE;IACf,cAAc,EAAE;IAChB,kBAAkB,EAAE;IACrB,EAAE;GACH,oBAAoB,OAAO;GAC5B"}
1
+ {"version":3,"file":"admin-app-impl.js","names":[],"sources":["../../../../../../src/lib/stack-app/apps/implementations/admin-app-impl.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { KnownErrors, HexclaveAdminInterface } from \"@hexclave/shared\";\nimport { getProductionModeErrors } from \"@hexclave/shared/dist/helpers/production-mode\";\nimport { InternalApiKeyCreateCrudResponse } from \"@hexclave/shared/dist/interface/admin-interface\";\nimport type { MetricsResponse, MetricsUserCounts, UserActivityResponse } from \"@hexclave/shared/dist/interface/admin-metrics\";\nimport { AnalyticsQueryOptions, AnalyticsQueryResponse } from \"@hexclave/shared/dist/interface/crud/analytics\";\nimport { EmailTemplateCrud } from \"@hexclave/shared/dist/interface/crud/email-templates\";\nimport { InternalApiKeysCrud } from \"@hexclave/shared/dist/interface/crud/internal-api-keys\";\nimport { ProjectsCrud } from \"@hexclave/shared/dist/interface/crud/projects\";\nimport type { AdminGetSessionReplayChunkEventsResponse } from \"@hexclave/shared/dist/interface/crud/session-replays\";\nimport type { Transaction, TransactionType } from \"@hexclave/shared/dist/interface/crud/transactions\";\nimport type { RestrictedReason } from \"@hexclave/shared/dist/schema-fields\";\nimport type { MoneyAmount } from \"@hexclave/shared/dist/utils/currency-constants\";\nimport { HexclaveAssertionError, throwErr } from \"@hexclave/shared/dist/utils/errors\";\nimport type { Json } from \"@hexclave/shared/dist/utils/json\";\nimport { pick, typedEntries, typedValues } from \"@hexclave/shared/dist/utils/objects\";\nimport { Result } from \"@hexclave/shared/dist/utils/results\";\nimport { AdminEmailOutbox, AdminSentEmail } from \"../..\";\nimport { EmailConfig, stackAppInternalsSymbol } from \"../../common\";\nimport { AdminEmailTemplate } from \"../../email-templates\";\nimport { InternalApiKey, InternalApiKeyBase, InternalApiKeyBaseCrudRead, InternalApiKeyCreateOptions, InternalApiKeyFirstView, internalApiKeyCreateOptionsToCrud } from \"../../internal-api-keys\";\nimport { AdminProjectPermission, AdminProjectPermissionDefinition, AdminProjectPermissionDefinitionCreateOptions, AdminProjectPermissionDefinitionUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, adminProjectPermissionDefinitionCreateOptionsToCrud, adminProjectPermissionDefinitionUpdateOptionsToCrud, adminTeamPermissionDefinitionCreateOptionsToCrud, adminTeamPermissionDefinitionUpdateOptionsToCrud } from \"../../permissions\";\nimport { AdminOwnedProject, AdminProject, AdminProjectUpdateOptions, PushConfigOptions, adminProjectUpdateOptionsToCrud } from \"../../projects\";\nimport type { AdminSessionReplay, AdminSessionReplayChunk, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, ListSessionReplaysOptions, ListSessionReplaysResult, SessionReplayAllEventsResult } from \"../../session-replays\";\nimport { ManagedEmailProviderListItem, ManagedEmailProviderSetupResult, ManagedEmailProviderStatus, EmailOutboxUpdateOptions, StackAdminApp, StackAdminAppConstructorOptions } from \"../interfaces/admin-app\";\nimport { clientVersion, createCache, getDefaultExtraRequestHeaders, getDefaultProjectId, getDefaultPublishableClientKey, getDefaultSecretServerKey, getDefaultSuperSecretAdminKey, resolveApiUrls, resolveConstructorOptions } from \"./common\";\nimport { _StackServerAppImplIncomplete } from \"./server-app-impl\";\n\nimport { CompleteConfig, EnvironmentConfigOverrideOverride } from \"@hexclave/shared/dist/config/schema\";\nimport { branchConfigSourceSchema } from \"@hexclave/shared/dist/schema-fields\";\nimport * as yup from \"yup\";\nimport { PushedConfigSource } from \"../../projects\";\n\ntype BranchConfigSourceApi = yup.InferType<typeof branchConfigSourceSchema>;\n/**\n * Converts a PushedConfigSource (SDK camelCase) to BranchConfigSourceApi (API snake_case).\n */\nfunction pushedConfigSourceToApi(source: PushedConfigSource): BranchConfigSourceApi {\n if (source.type === \"pushed-from-github\") {\n return {\n type: \"pushed-from-github\",\n owner: source.owner,\n repo: source.repo,\n branch: source.branch,\n commit_hash: source.commitHash,\n config_file_path: source.configFilePath,\n workflow_path: source.workflowPath,\n };\n }\n return source;\n}\n\n/**\n * Converts a BranchConfigSourceApi (API snake_case) to PushedConfigSource (SDK camelCase).\n */\nfunction apiToPushedConfigSource(source: BranchConfigSourceApi): PushedConfigSource {\n if (source.type === \"pushed-from-github\") {\n return {\n type: \"pushed-from-github\",\n owner: source.owner,\n repo: source.repo,\n branch: source.branch,\n commitHash: source.commit_hash,\n configFilePath: source.config_file_path,\n workflowPath: source.workflow_path,\n };\n }\n return source;\n}\n\nexport class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, ProjectId extends string> extends _StackServerAppImplIncomplete<HasTokenStore, ProjectId> implements StackAdminApp<HasTokenStore, ProjectId> {\n declare protected _interface: HexclaveAdminInterface;\n\n private readonly _adminProjectCache = createCache(async () => {\n return await this._interface.getProject();\n });\n private readonly _internalApiKeysCache = createCache(async () => {\n const res = await this._interface.listInternalApiKeys();\n return res;\n });\n private readonly _adminEmailThemeCache = createCache(async ([id]: [string]) => {\n return await this._interface.getEmailTheme(id);\n });\n private readonly _adminEmailThemesCache = createCache(async () => {\n return await this._interface.listEmailThemes();\n });\n private readonly _adminEmailTemplatesCache = createCache(async () => {\n return await this._interface.listInternalEmailTemplates();\n });\n private readonly _adminEmailDraftsCache = createCache(async () => {\n return await this._interface.listInternalEmailDrafts();\n });\n private readonly _adminTeamPermissionDefinitionsCache = createCache(async () => {\n return await this._interface.listTeamPermissionDefinitions();\n });\n private readonly _adminProjectPermissionDefinitionsCache = createCache(async () => {\n return await this._interface.listProjectPermissionDefinitions();\n });\n private readonly _svixTokenCache = createCache(async () => {\n return await this._interface.getSvixToken();\n });\n private readonly _metricsCache = createCache(async ([includeAnonymous]: [boolean]) => {\n return await this._interface.getMetrics(includeAnonymous);\n });\n private readonly _userActivityCache = createCache(async ([userId]: [string]) => {\n return await this._interface.getUserActivity(userId);\n });\n private readonly _metricsUserCountsCache = createCache(async () => {\n return await this._interface.getMetricsUserCounts();\n });\n private readonly _emailPreviewCache = createCache(async ([themeId, themeTsxSource, templateId, templateTsxSource]: [string | null | false | undefined, string | undefined, string | undefined, string | undefined]) => {\n return await this._interface.renderEmailPreview({ themeId, themeTsxSource, templateId, templateTsxSource });\n });\n private readonly _emailPreviewWithEditableMarkersCache = createCache(async ([themeId, themeTsxSource, templateId, templateTsxSource, editableSource]: [string | null | false | undefined, string | undefined, string | undefined, string | undefined, 'template' | 'theme' | 'both' | undefined]) => {\n return await this._interface.renderEmailPreview({ themeId, themeTsxSource, templateId, templateTsxSource, editableMarkers: true, editableSource });\n });\n private readonly _configOverridesCache = createCache(async () => {\n return await this._interface.getConfig();\n });\n private readonly _stripeAccountInfoCache = createCache(async () => {\n try {\n return await this._interface.getStripeAccountInfo();\n } catch (error: any) {\n if (error?.status === 404) {\n return null;\n }\n throw error;\n }\n });\n private readonly _transactionsCache = createCache(async ([cursor, limit, type, customerType, customerId]: [string | undefined, number | undefined, TransactionType | undefined, 'user' | 'team' | 'custom' | undefined, string | undefined]) => {\n return await this._interface.listTransactions({ cursor, limit, type, customerType, customerId });\n });\n\n constructor(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>, extraOptions?: { uniqueIdentifier?: string, checkString?: string, interface?: HexclaveAdminInterface }) {\n const resolvedOptions = resolveConstructorOptions(options);\n\n const publishableClientKey = resolvedOptions.publishableClientKey ?? getDefaultPublishableClientKey();\n\n super(resolvedOptions, {\n ...extraOptions,\n interface: extraOptions?.interface ?? (() => {\n const apiUrls = resolveApiUrls(resolvedOptions.baseUrl);\n return new HexclaveAdminInterface({\n getBaseUrl: () => apiUrls()[0],\n getApiUrls: apiUrls,\n projectId: resolvedOptions.projectId ?? getDefaultProjectId(),\n extraRequestHeaders: resolvedOptions.extraRequestHeaders ?? getDefaultExtraRequestHeaders(),\n clientVersion,\n ...resolvedOptions.projectOwnerSession ? {\n projectOwnerSession: resolvedOptions.projectOwnerSession,\n } : {\n ...(publishableClientKey ? { publishableClientKey } : {}),\n secretServerKey: resolvedOptions.secretServerKey ?? getDefaultSecretServerKey(),\n superSecretAdminKey: resolvedOptions.superSecretAdminKey ?? getDefaultSuperSecretAdminKey(),\n },\n });\n })(),\n });\n }\n\n _adminConfigFromCrud(data: { config_string: string }): CompleteConfig {\n return JSON.parse(data.config_string);\n }\n\n _adminOwnedProjectFromCrud(data: ProjectsCrud['Admin']['Read'], onRefresh: () => Promise<void>): AdminOwnedProject {\n if (this._tokenStoreInit !== null) {\n throw new HexclaveAssertionError(\"Owned apps must always have tokenStore === null — did you not create this project with app._createOwnedApp()?\");\n }\n return {\n ...this._adminProjectFromCrud(data, onRefresh),\n app: this as StackAdminApp<false>,\n };\n }\n\n _adminProjectFromCrud(data: ProjectsCrud['Admin']['Read'], onRefresh: () => Promise<void>): AdminProject {\n if (data.id !== this.projectId) {\n throw new HexclaveAssertionError(`The project ID of the provided project JSON (${data.id}) does not match the project ID of the app (${this.projectId})!`);\n }\n\n const app = this;\n return {\n id: data.id,\n displayName: data.display_name,\n description: data.description,\n createdAt: new Date(data.created_at_millis),\n isProductionMode: data.is_production_mode,\n isDevelopmentEnvironment: data.is_development_environment,\n ownerTeamId: data.owner_team_id,\n onboardingStatus: data.onboarding_status,\n logoUrl: data.logo_url,\n logoFullUrl: data.logo_full_url,\n logoDarkModeUrl: data.logo_dark_mode_url,\n logoFullDarkModeUrl: data.logo_full_dark_mode_url,\n config: {\n signUpEnabled: data.config.sign_up_enabled,\n credentialEnabled: data.config.credential_enabled,\n magicLinkEnabled: data.config.magic_link_enabled,\n passkeyEnabled: data.config.passkey_enabled,\n clientTeamCreationEnabled: data.config.client_team_creation_enabled,\n clientUserDeletionEnabled: data.config.client_user_deletion_enabled,\n allowLocalhost: data.config.allow_localhost,\n oauthAccountMergeStrategy: data.config.oauth_account_merge_strategy,\n allowUserApiKeys: data.config.allow_user_api_keys,\n allowTeamApiKeys: data.config.allow_team_api_keys,\n oauthProviders: data.config.oauth_providers.map((p) => ((p.type === 'shared' ? {\n id: p.id,\n type: 'shared',\n } as const : {\n id: p.id,\n type: 'standard',\n clientId: p.client_id ?? throwErr(\"Client ID is missing\"),\n clientSecret: p.client_secret ?? throwErr(\"Client secret is missing\"),\n facebookConfigId: p.facebook_config_id,\n microsoftTenantId: p.microsoft_tenant_id,\n appleBundleIds: p.apple_bundle_ids,\n } as const))),\n emailConfig: data.config.email_config.type === 'shared' ? {\n type: 'shared'\n } : {\n type: 'standard',\n host: data.config.email_config.host ?? throwErr(\"Email host is missing\"),\n port: data.config.email_config.port ?? throwErr(\"Email port is missing\"),\n username: data.config.email_config.username ?? throwErr(\"Email username is missing\"),\n password: data.config.email_config.password ?? throwErr(\"Email password is missing\"),\n senderName: data.config.email_config.sender_name ?? throwErr(\"Email sender name is missing\"),\n senderEmail: data.config.email_config.sender_email ?? throwErr(\"Email sender email is missing\"),\n },\n emailTheme: data.config.email_theme,\n domains: data.config.domains.map((d) => ({\n domain: d.domain,\n handlerPath: d.handler_path,\n })),\n createTeamOnSignUp: data.config.create_team_on_sign_up,\n teamCreatorDefaultPermissions: data.config.team_creator_default_permissions,\n teamMemberDefaultPermissions: data.config.team_member_default_permissions,\n userDefaultPermissions: data.config.user_default_permissions,\n },\n async getConfig() {\n return app._adminConfigFromCrud(await app._interface.getConfig());\n },\n async updateConfig(configOverride: EnvironmentConfigOverrideOverride) {\n await app._interface.updateConfigOverride(\"environment\", configOverride);\n await app._refreshProjectConfig();\n },\n async pushConfig(config: EnvironmentConfigOverrideOverride, options: PushConfigOptions) {\n await app._interface.setConfigOverride(\"branch\", config, pushedConfigSourceToApi(options.source));\n await app._refreshProjectConfig();\n },\n async updatePushedConfig(config: EnvironmentConfigOverrideOverride) {\n await app._interface.updateConfigOverride(\"branch\", config);\n await app._refreshProjectConfig();\n },\n async getPushedConfigSource(): Promise<PushedConfigSource> {\n const apiSource = await app._interface.getPushedConfigSource();\n return apiToPushedConfigSource(apiSource);\n },\n async unlinkPushedConfigSource(): Promise<void> {\n await app._interface.unlinkPushedConfigSource();\n await app._refreshProjectConfig();\n },\n async resetConfigOverrideKeys(level: \"branch\" | \"environment\", keys: string[]): Promise<void> {\n await app._interface.resetConfigOverrideKeys(level, keys);\n await app._refreshProjectConfig();\n },\n async getConfigOverride(level: \"branch\" | \"environment\"): Promise<Record<string, unknown>> {\n const result = await app._interface.getConfigOverride(level);\n return JSON.parse(result.config_string);\n },\n async replaceConfigOverride(level: \"branch\" | \"environment\", config: Record<string, unknown>): Promise<void> {\n if (level === \"branch\") {\n const source = await app._interface.getPushedConfigSource();\n await app._interface.setConfigOverride(level, config, source);\n } else {\n await app._interface.setConfigOverride(level, config);\n }\n await app._refreshProjectConfig();\n },\n async update(update: AdminProjectUpdateOptions) {\n const { requirePublishableClientKey, ...projectUpdate } = update;\n const updateOptions = adminProjectUpdateOptionsToCrud(projectUpdate);\n const hasConfigUpdate = !!updateOptions.config\n && typedValues(updateOptions.config).some((value) => value !== undefined);\n const hasProjectUpdate = typedEntries(updateOptions).some(([key, value]) => {\n if (key === \"config\") return hasConfigUpdate;\n return value !== undefined;\n });\n\n if (hasProjectUpdate) {\n await app._interface.updateProject(updateOptions);\n await onRefresh();\n }\n\n if (requirePublishableClientKey !== undefined) {\n await app._interface.updateConfigOverride(\"project\", {\n \"project.requirePublishableClientKey\": requirePublishableClientKey,\n });\n await app._refreshProjectConfig();\n }\n },\n async delete() {\n await app._interface.deleteProject();\n },\n async getProductionModeErrors() {\n return getProductionModeErrors(data);\n },\n };\n }\n\n _adminEmailTemplateFromCrud(data: EmailTemplateCrud['Admin']['Read']): AdminEmailTemplate {\n return {\n type: data.type,\n subject: data.subject,\n content: data.content,\n isDefault: data.is_default,\n };\n }\n\n override async getProject(): Promise<AdminProject> {\n return this._adminProjectFromCrud(\n Result.orThrow(await this._adminProjectCache.getOrWait([], \"write-only\")),\n () => this._refreshProject()\n );\n }\n\n\n protected _createInternalApiKeyBaseFromCrud(data: InternalApiKeyBaseCrudRead): InternalApiKeyBase {\n const app = this;\n return {\n id: data.id,\n description: data.description,\n expiresAt: new Date(data.expires_at_millis),\n manuallyRevokedAt: data.manually_revoked_at_millis ? new Date(data.manually_revoked_at_millis) : null,\n createdAt: new Date(data.created_at_millis),\n isValid() {\n return this.whyInvalid() === null;\n },\n whyInvalid() {\n if (this.expiresAt.getTime() < Date.now()) return \"expired\";\n if (this.manuallyRevokedAt) return \"manually-revoked\";\n return null;\n },\n async revoke() {\n const res = await app._interface.revokeInternalApiKeyById(data.id);\n await app._refreshInternalApiKeys();\n return res;\n }\n };\n }\n\n protected _createInternalApiKeyFromCrud(data: InternalApiKeysCrud[\"Admin\"][\"Read\"]): InternalApiKey {\n return {\n ...this._createInternalApiKeyBaseFromCrud(data),\n publishableClientKey: data.publishable_client_key ? { lastFour: data.publishable_client_key.last_four } : null,\n secretServerKey: data.secret_server_key ? { lastFour: data.secret_server_key.last_four } : null,\n superSecretAdminKey: data.super_secret_admin_key ? { lastFour: data.super_secret_admin_key.last_four } : null,\n };\n }\n\n protected _createInternalApiKeyFirstViewFromCrud(data: InternalApiKeyCreateCrudResponse): InternalApiKeyFirstView {\n return {\n ...this._createInternalApiKeyBaseFromCrud(data),\n publishableClientKey: data.publishable_client_key,\n secretServerKey: data.secret_server_key,\n superSecretAdminKey: data.super_secret_admin_key,\n };\n }\n\n async listInternalApiKeys(): Promise<InternalApiKey[]> {\n const crud = Result.orThrow(await this._internalApiKeysCache.getOrWait([], \"write-only\"));\n return crud.map((j) => this._createInternalApiKeyFromCrud(j));\n }\n\n\n async createInternalApiKey(options: InternalApiKeyCreateOptions): Promise<InternalApiKeyFirstView> {\n const crud = await this._interface.createInternalApiKey(internalApiKeyCreateOptionsToCrud(options));\n await this._refreshInternalApiKeys();\n return this._createInternalApiKeyFirstViewFromCrud(crud);\n }\n\n\n async listEmailThemes(): Promise<{ id: string, displayName: string }[]> {\n const crud = Result.orThrow(await this._adminEmailThemesCache.getOrWait([], \"write-only\"));\n return crud.map((theme) => ({\n id: theme.id,\n displayName: theme.display_name,\n }));\n }\n\n async listEmailTemplates(): Promise<{ id: string, displayName: string, themeId?: string, tsxSource: string }[]> {\n const crud = Result.orThrow(await this._adminEmailTemplatesCache.getOrWait([], \"write-only\"));\n return crud.map((template) => ({\n id: template.id,\n displayName: template.display_name,\n themeId: template.theme_id,\n tsxSource: template.tsx_source,\n }));\n }\n\n async listEmailDrafts(): Promise<{ id: string, displayName: string, themeId: string | undefined | false, tsxSource: string, sentAt: Date | null }[]> {\n const crud = Result.orThrow(await this._adminEmailDraftsCache.getOrWait([], \"write-only\"));\n return crud.map((draft) => ({\n id: draft.id,\n displayName: draft.display_name,\n themeId: draft.theme_id,\n tsxSource: draft.tsx_source,\n sentAt: draft.sent_at_millis ? new Date(draft.sent_at_millis) : null,\n }));\n }\n\n\n async createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise<AdminTeamPermission> {\n const crud = await this._interface.createTeamPermissionDefinition(adminTeamPermissionDefinitionCreateOptionsToCrud(data));\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n return this._serverTeamPermissionDefinitionFromCrud(crud);\n }\n\n async updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions) {\n await this._interface.updateTeamPermissionDefinition(permissionId, adminTeamPermissionDefinitionUpdateOptionsToCrud(data));\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n }\n\n async deleteTeamPermissionDefinition(permissionId: string): Promise<void> {\n await this._interface.deleteTeamPermissionDefinition(permissionId);\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n }\n\n async listTeamPermissionDefinitions(): Promise<AdminTeamPermissionDefinition[]> {\n const crud = Result.orThrow(await this._adminTeamPermissionDefinitionsCache.getOrWait([], \"write-only\"));\n return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));\n }\n\n async listTeamPermissionDefinitionsPaginated(\n options: { limit: number, cursor?: string, query?: string },\n ): Promise<{ items: AdminTeamPermissionDefinition[], nextCursor: string | null }> {\n const result = await this._interface.listTeamPermissionDefinitionsPaginated(options);\n return {\n items: result.items.map((p) => this._serverTeamPermissionDefinitionFromCrud(p)),\n nextCursor: result.nextCursor,\n };\n }\n\n\n async createProjectPermissionDefinition(data: AdminProjectPermissionDefinitionCreateOptions): Promise<AdminProjectPermission> {\n const crud = await this._interface.createProjectPermissionDefinition(adminProjectPermissionDefinitionCreateOptionsToCrud(data));\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n return this._serverProjectPermissionDefinitionFromCrud(crud);\n }\n\n async updateProjectPermissionDefinition(permissionId: string, data: AdminProjectPermissionDefinitionUpdateOptions) {\n await this._interface.updateProjectPermissionDefinition(permissionId, adminProjectPermissionDefinitionUpdateOptionsToCrud(data));\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n }\n\n async deleteProjectPermissionDefinition(permissionId: string): Promise<void> {\n await this._interface.deleteProjectPermissionDefinition(permissionId);\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n }\n\n async listProjectPermissionDefinitions(): Promise<AdminProjectPermissionDefinition[]> {\n const crud = Result.orThrow(await this._adminProjectPermissionDefinitionsCache.getOrWait([], \"write-only\"));\n return crud.map((p) => this._serverProjectPermissionDefinitionFromCrud(p));\n }\n\n\n protected override async _refreshProject() {\n await Promise.all([\n super._refreshProject(),\n this._adminProjectCache.refresh([]),\n ]);\n }\n\n protected async _refreshProjectConfig() {\n await Promise.all([\n this._configOverridesCache.refresh([]),\n this._adminProjectCache.refresh([]),\n ]);\n }\n\n protected async _refreshInternalApiKeys() {\n await this._internalApiKeysCache.refresh([]);\n }\n\n protected override async _refreshUsers() {\n await Promise.all([\n super._refreshUsers(),\n this._metricsCache.refresh([false]),\n this._metricsCache.refresh([true]),\n this._metricsUserCountsCache.refresh([]),\n ]);\n }\n\n get [stackAppInternalsSymbol]() {\n return {\n ...super[stackAppInternalsSymbol],\n };\n }\n\n async sendTestEmail(options: {\n recipientEmail: string,\n emailConfig: EmailConfig,\n }): Promise<Result<undefined, { errorMessage: string }>> {\n let response: { success: boolean, error_message?: string };\n try {\n response = await this._interface.sendTestEmail({\n recipient_email: options.recipientEmail,\n email_config: {\n ...(pick(options.emailConfig, ['host', 'port', 'username', 'password'])),\n sender_email: options.emailConfig.senderEmail,\n sender_name: options.emailConfig.senderName,\n },\n });\n } catch (error) {\n // Translate the quota-exhaustion KnownError into the existing\n // Result.error shape so SDK/dashboard callers don't need to branch on\n // exceptions. The backend throws `ItemQuantityInsufficientAmount`\n // (consistent with every other limit-rejection endpoint), but this\n // method's historical contract has always been a `Result`.\n if (error instanceof KnownErrors.ItemQuantityInsufficientAmount) {\n return Result.error({\n errorMessage: \"Monthly email sending limit exceeded for your plan. Please upgrade your plan or wait until next month before sending more test emails.\",\n });\n }\n throw error;\n }\n\n if (response.success) {\n return Result.ok(undefined);\n } else {\n return Result.error({ errorMessage: response.error_message ?? throwErr(\"Email test error not specified\") });\n }\n }\n\n async sendTestWebhook(options: { endpointId: string }): Promise<Result<undefined, { errorMessage: string }>> {\n const response = await this._interface.sendTestWebhook({\n endpoint_id: options.endpointId,\n });\n\n if (response.success) {\n return Result.ok(undefined);\n } else {\n return Result.error({ errorMessage: response.error_message ?? throwErr(\"Webhook test error not specified\") });\n }\n }\n\n async listSentEmails(): Promise<AdminSentEmail[]> {\n const response = await this._interface.listSentEmails();\n return response.items.map((email) => ({\n id: email.id,\n to: email.to ?? [],\n subject: email.subject,\n recipient: email.to?.[0] ?? \"\",\n sentAt: new Date(email.sent_at_millis),\n error: email.error,\n }));\n }\n\n async setupManagedEmailProvider(options: { subdomain: string, senderLocalPart: string }): Promise<ManagedEmailProviderSetupResult> {\n const response = await this._interface.setupManagedEmailProvider({\n subdomain: options.subdomain,\n sender_local_part: options.senderLocalPart,\n });\n return {\n domainId: response.domain_id,\n subdomain: response.subdomain,\n senderLocalPart: response.sender_local_part,\n nameServerRecords: response.name_server_records,\n status: response.status,\n };\n }\n\n async checkManagedEmailStatus(options: { domainId: string, subdomain: string, senderLocalPart: string }): Promise<ManagedEmailProviderStatus> {\n const response = await this._interface.checkManagedEmailStatus({\n domain_id: options.domainId,\n subdomain: options.subdomain,\n sender_local_part: options.senderLocalPart,\n });\n return {\n status: response.status,\n };\n }\n\n async listManagedEmailDomains(): Promise<ManagedEmailProviderListItem[]> {\n const response = await this._interface.listManagedEmailDomains();\n return response.items.map((item) => ({\n domainId: item.domain_id,\n subdomain: item.subdomain,\n senderLocalPart: item.sender_local_part,\n status: item.status,\n nameServerRecords: item.name_server_records,\n }));\n }\n\n async applyManagedEmailProvider(options: { domainId: string }): Promise<{ status: \"applied\" }> {\n const result = await this._interface.applyManagedEmailProvider({\n domain_id: options.domainId,\n });\n await this._refreshProjectConfig();\n return result;\n }\n\n async deleteManagedEmailDomain(options: { resendDomainId: string }): Promise<{ status: \"deleted\" }> {\n return await this._interface.deleteManagedEmailDomain({\n resend_domain_id: options.resendDomainId,\n });\n }\n\n async sendSignInInvitationEmail(email: string, callbackUrl: string): Promise<void> {\n await this._interface.sendSignInInvitationEmail(email, callbackUrl);\n }\n\n async createEmailTemplate(displayName: string): Promise<{ id: string }> {\n const result = await this._interface.createEmailTemplate(displayName);\n await this._adminEmailTemplatesCache.refresh([]);\n\n return result;\n }\n\n async deleteEmailTemplate(id: string): Promise<void> {\n await this._interface.deleteEmailTemplate(id);\n await this._adminEmailTemplatesCache.refresh([]);\n }\n\n async createEmailDraft(options: { displayName: string, themeId?: string | false, tsxSource?: string }): Promise<{ id: string }> {\n const result = await this._interface.createEmailDraft({\n display_name: options.displayName,\n theme_id: options.themeId,\n tsx_source: options.tsxSource,\n });\n await this._adminEmailDraftsCache.refresh([]);\n return result;\n }\n\n async updateEmailDraft(id: string, data: { displayName?: string, themeId?: string | undefined | false, tsxSource?: string }): Promise<void> {\n await this._interface.updateEmailDraft(id, {\n display_name: data.displayName,\n theme_id: data.themeId,\n tsx_source: data.tsxSource,\n });\n await this._adminEmailDraftsCache.refresh([]);\n }\n\n async deleteEmailDraft(id: string): Promise<void> {\n await this._interface.deleteEmailDraft(id);\n const current = this._adminEmailDraftsCache.getIfCached([]);\n if (current.status === \"ok\" && current.data.status === \"ok\") {\n this._adminEmailDraftsCache.forceSetCachedValue([], Result.ok(current.data.data.filter((d) => d.id !== id)));\n }\n await this._adminEmailDraftsCache.refresh([]);\n }\n\n async refreshEmailDrafts(): Promise<void> {\n await this._adminEmailDraftsCache.refresh([]);\n }\n\n async saveChatMessage(threadId: string, message: any): Promise<void> {\n await this._interface.saveChatMessage(threadId, message);\n }\n\n async listChatMessages(threadId: string): Promise<{ messages: Array<any> }> {\n return await this._interface.listChatMessages(threadId);\n }\n\n async rewriteTemplateSourceWithAI(templateTsxSource: string): Promise<{ tsxSource: string }> {\n const result = await this._interface.rewriteTemplateSourceWithAI(templateTsxSource);\n return { tsxSource: result.tsx_source };\n }\n\n async createEmailTheme(displayName: string): Promise<{ id: string }> {\n const result = await this._interface.createEmailTheme(displayName);\n await this._adminEmailThemesCache.refresh([]);\n return result;\n }\n\n async getEmailPreview(options: { themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string }): Promise<string> {\n return (await this._interface.renderEmailPreview(options)).html;\n }\n async getEmailPreviewWithEditableMarkers(options: { themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string, editableSource?: 'template' | 'theme' | 'both' }): Promise<{ html: string, editableRegions?: Record<string, unknown> }> {\n const result = await this._interface.renderEmailPreview({ ...options, editableMarkers: true, editableSource: options.editableSource });\n return { html: result.html, editableRegions: result.editable_regions };\n }\n async updateEmailTheme(id: string, tsxSource: string): Promise<void> {\n await this._interface.updateEmailTheme(id, tsxSource);\n await this._adminEmailThemesCache.refresh([]);\n await this._adminEmailThemeCache.invalidate([id]);\n }\n\n async deleteEmailTheme(id: string): Promise<void> {\n await this._interface.deleteEmailTheme(id);\n await this._adminEmailThemesCache.refresh([]);\n await this._adminEmailThemeCache.invalidate([id]);\n }\n\n async updateEmailTemplate(id: string, tsxSource: string, themeId: string | null | false): Promise<{ renderedHtml: string }> {\n const result = await this._interface.updateEmailTemplate(id, tsxSource, themeId);\n await this._adminEmailTemplatesCache.refresh([]);\n return { renderedHtml: result.rendered_html };\n }\n\n async setupPayments(): Promise<{ url: string }> {\n const result = await this._interface.setupPayments();\n await this._stripeAccountInfoCache.refresh([]);\n return result;\n }\n\n async createStripeWidgetAccountSession(): Promise<{ client_secret: string }> {\n return await this._interface.createStripeWidgetAccountSession();\n }\n\n async getPaymentMethodConfigs(): Promise<{ configId: string, methods: Array<{ id: string, name: string, enabled: boolean, available: boolean, overridable: boolean }> } | null> {\n return await this._interface.getPaymentMethodConfigs();\n }\n\n async updatePaymentMethodConfigs(configId: string, updates: Record<string, 'on' | 'off'>): Promise<void> {\n await this._interface.updatePaymentMethodConfigs(configId, updates);\n }\n\n async createItemQuantityChange(options: (\n { userId: string, itemId: string, quantity: number, expiresAt?: string, description?: string } |\n { teamId: string, itemId: string, quantity: number, expiresAt?: string, description?: string } |\n { customCustomerId: string, itemId: string, quantity: number, expiresAt?: string, description?: string }\n )): Promise<void> {\n await this._interface.updateItemQuantity(\n { itemId: options.itemId, ...(\"userId\" in options ? { userId: options.userId } : (\"teamId\" in options ? { teamId: options.teamId } : { customCustomerId: options.customCustomerId })) },\n {\n delta: options.quantity,\n expires_at: options.expiresAt,\n description: options.description,\n allow_negative: true,\n }\n );\n }\n\n async refundTransaction(options: {\n type: \"subscription\" | \"one-time-purchase\",\n id: string,\n invoiceId?: string,\n amountUsd: MoneyAmount,\n endAction?: \"now\" | \"at-period-end\",\n }): Promise<{ refundTransactionId: string }> {\n const result = await this._interface.refundTransaction({\n type: options.type,\n id: options.id,\n invoiceId: options.invoiceId,\n amountUsd: options.amountUsd,\n endAction: options.endAction,\n });\n await this._transactionsCache.invalidateWhere(() => true);\n return { refundTransactionId: result.refundTransactionId };\n }\n\n async listTransactions(params: { cursor?: string, limit?: number, type?: TransactionType, customerType?: 'user' | 'team' | 'custom', customerId?: string }): Promise<{ transactions: Transaction[], nextCursor: string | null }> {\n const crud = Result.orThrow(await this._transactionsCache.getOrWait([params.cursor, params.limit, params.type, params.customerType, params.customerId] as const, \"write-only\"));\n return crud;\n }\n\n // Email Outbox methods\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Complex discriminated union conversion from API response\n private _emailOutboxCrudToAdmin(crud: any): AdminEmailOutbox {\n const recipient = crud.to;\n let to: AdminEmailOutbox[\"to\"];\n if (recipient.type === \"user-primary-email\") {\n to = { type: \"user-primary-email\", userId: recipient.user_id };\n } else if (recipient.type === \"user-custom-emails\") {\n to = { type: \"user-custom-emails\", userId: recipient.user_id, emails: recipient.emails };\n } else {\n to = { type: \"custom-emails\", emails: recipient.emails };\n }\n\n // Base fields present on all emails\n const base = {\n id: crud.id as string,\n createdAt: new Date(crud.created_at_millis),\n updatedAt: new Date(crud.updated_at_millis),\n tsxSource: crud.tsx_source as string,\n themeId: (crud.theme_id as string | null) ?? null,\n to,\n scheduledAt: new Date(crud.scheduled_at_millis),\n // Source tracking for grouping emails by template/draft\n createdWith: crud.created_with as \"draft\" | \"programmatic-call\",\n emailDraftId: crud.email_draft_id as string | null,\n emailProgrammaticCallTemplateId: crud.email_programmatic_call_template_id as string | null,\n variables: (crud.variables ?? {}) as Record<string, Json>,\n isPaused: false as const,\n hasRendered: false as const,\n hasDelivered: false as const,\n // Retry tracking fields\n sendRetries: crud.send_retries as number,\n nextSendRetryAt: crud.next_send_retry_at_millis ? new Date(crud.next_send_retry_at_millis) : null,\n sendAttemptErrors: crud.send_attempt_errors ? (crud.send_attempt_errors as Array<{\n attempt_number: number,\n timestamp: string,\n external_message: string,\n external_details: Record<string, unknown>,\n internal_message: string,\n internal_details: Record<string, unknown>,\n }>).map((e) => ({\n attemptNumber: e.attempt_number,\n timestamp: e.timestamp,\n externalMessage: e.external_message,\n externalDetails: e.external_details,\n internalMessage: e.internal_message,\n internalDetails: e.internal_details,\n })) : null,\n };\n\n // Rendered fields (available after rendering completes successfully)\n const rendered = crud.has_rendered ? {\n ...base,\n startedRenderingAt: new Date(crud.started_rendering_at_millis),\n renderedAt: new Date(crud.rendered_at_millis),\n subject: crud.subject as string,\n html: crud.html as string | null,\n text: crud.text as string | null,\n isTransactional: crud.is_transactional as boolean,\n isHighPriority: crud.is_high_priority as boolean,\n notificationCategoryId: crud.notification_category_id as string | null,\n hasRendered: true as const,\n } : null;\n\n // Started sending fields\n const startedSending = rendered && crud.started_sending_at_millis ? {\n ...rendered,\n startedSendingAt: new Date(crud.started_sending_at_millis),\n } : null;\n\n // Finished delivering fields\n const finishedDelivering = startedSending && crud.has_delivered ? {\n ...startedSending,\n deliveredAt: new Date(crud.delivered_at_millis),\n hasDelivered: true as const,\n } : null;\n\n // Use type assertion at the end because TypeScript has trouble with\n // spread + override patterns on discriminated unions with const literal types\n const result = (() => {\n switch (crud.status) {\n case \"paused\": {\n return {\n ...base,\n status: \"paused\" as const,\n simpleStatus: \"in-progress\" as const,\n isPaused: true as const,\n };\n }\n case \"preparing\": {\n return {\n ...base,\n status: \"preparing\" as const,\n simpleStatus: \"in-progress\" as const,\n };\n }\n case \"rendering\": {\n return {\n ...base,\n status: \"rendering\" as const,\n simpleStatus: \"in-progress\" as const,\n startedRenderingAt: new Date(crud.started_rendering_at_millis),\n };\n }\n case \"render-error\": {\n return {\n ...base,\n status: \"render-error\" as const,\n simpleStatus: \"error\" as const,\n startedRenderingAt: new Date(crud.started_rendering_at_millis),\n renderedAt: new Date(crud.rendered_at_millis),\n renderError: crud.render_error,\n };\n }\n case \"scheduled\": {\n return {\n ...rendered!,\n status: \"scheduled\" as const,\n simpleStatus: \"in-progress\" as const,\n };\n }\n case \"queued\": {\n return {\n ...rendered!,\n status: \"queued\" as const,\n simpleStatus: \"in-progress\" as const,\n };\n }\n case \"sending\": {\n return {\n ...startedSending!,\n status: \"sending\" as const,\n simpleStatus: \"in-progress\" as const,\n };\n }\n case \"server-error\": {\n return {\n ...startedSending!,\n status: \"server-error\" as const,\n simpleStatus: \"error\" as const,\n errorAt: new Date(crud.error_at_millis),\n serverError: crud.server_error,\n };\n }\n case \"skipped\": {\n return {\n ...base,\n status: \"skipped\" as const,\n simpleStatus: \"ok\" as const,\n skippedAt: new Date(crud.skipped_at_millis),\n skippedReason: crud.skipped_reason,\n skippedDetails: crud.skipped_details ?? {},\n hasRendered: crud.has_rendered as boolean,\n // Optional fields\n startedRenderingAt: crud.started_rendering_at_millis ? new Date(crud.started_rendering_at_millis) : undefined,\n renderedAt: crud.rendered_at_millis ? new Date(crud.rendered_at_millis) : undefined,\n subject: crud.subject,\n html: crud.html,\n text: crud.text,\n isTransactional: crud.is_transactional,\n isHighPriority: crud.is_high_priority,\n notificationCategoryId: crud.notification_category_id,\n startedSendingAt: crud.started_sending_at_millis ? new Date(crud.started_sending_at_millis) : undefined,\n };\n }\n case \"bounced\": {\n return {\n ...startedSending!,\n status: \"bounced\" as const,\n simpleStatus: \"error\" as const,\n bouncedAt: new Date(crud.bounced_at_millis),\n };\n }\n case \"delivery-delayed\": {\n return {\n ...startedSending!,\n status: \"delivery-delayed\" as const,\n simpleStatus: \"ok\" as const,\n deliveryDelayedAt: new Date(crud.delivery_delayed_at_millis),\n };\n }\n case \"sent\": {\n return {\n ...finishedDelivering!,\n status: \"sent\" as const,\n simpleStatus: \"ok\" as const,\n canHaveDeliveryInfo: crud.can_have_delivery_info,\n };\n }\n case \"opened\": {\n return {\n ...finishedDelivering!,\n status: \"opened\" as const,\n simpleStatus: \"ok\" as const,\n openedAt: new Date(crud.opened_at_millis),\n canHaveDeliveryInfo: true as const,\n };\n }\n case \"clicked\": {\n return {\n ...finishedDelivering!,\n status: \"clicked\" as const,\n simpleStatus: \"ok\" as const,\n clickedAt: new Date(crud.clicked_at_millis),\n canHaveDeliveryInfo: true as const,\n };\n }\n case \"marked-as-spam\": {\n return {\n ...finishedDelivering!,\n status: \"marked-as-spam\" as const,\n simpleStatus: \"ok\" as const,\n markedAsSpamAt: new Date(crud.marked_as_spam_at_millis),\n canHaveDeliveryInfo: true as const,\n };\n }\n default: {\n throw new HexclaveAssertionError(`Unknown email outbox status: ${crud.status}`, { status: crud.status });\n }\n }\n })();\n // The type system has difficulty with spread + override patterns on discriminated unions,\n // so we use a type assertion here. The switch statement above ensures we return the correct shape.\n return result as AdminEmailOutbox;\n }\n\n async listOutboxEmails(options?: { status?: string, simpleStatus?: string, limit?: number, cursor?: string }): Promise<{ items: AdminEmailOutbox[], nextCursor: string | null }> {\n const response = await this._interface.listOutboxEmails({\n status: options?.status,\n simple_status: options?.simpleStatus,\n limit: options?.limit,\n cursor: options?.cursor,\n });\n return {\n items: response.items.map((item) => this._emailOutboxCrudToAdmin(item)),\n nextCursor: response.pagination?.next_cursor ?? null,\n };\n }\n\n async getOutboxEmail(id: string): Promise<AdminEmailOutbox> {\n const response = await this._interface.getOutboxEmail(id);\n return this._emailOutboxCrudToAdmin(response);\n }\n\n async updateOutboxEmail(id: string, options: EmailOutboxUpdateOptions): Promise<AdminEmailOutbox> {\n const response = await this._interface.updateOutboxEmail(id, {\n is_paused: options.isPaused,\n scheduled_at_millis: options.scheduledAtMillis,\n cancel: options.cancel,\n tsx_source: options.tsxSource,\n theme_id: options.themeId,\n });\n return this._emailOutboxCrudToAdmin(response);\n }\n\n async pauseOutboxEmail(id: string): Promise<AdminEmailOutbox> {\n return await this.updateOutboxEmail(id, { isPaused: true });\n }\n\n async unpauseOutboxEmail(id: string): Promise<AdminEmailOutbox> {\n return await this.updateOutboxEmail(id, { isPaused: false });\n }\n\n async cancelOutboxEmail(id: string): Promise<AdminEmailOutbox> {\n return await this.updateOutboxEmail(id, { cancel: true });\n }\n\n\n async getStripeAccountInfo(): Promise<null | { account_id: string, charges_enabled: boolean, details_submitted: boolean, payouts_enabled: boolean }> {\n return await this._interface.getStripeAccountInfo();\n }\n\n\n async queryAnalytics(options: AnalyticsQueryOptions): Promise<AnalyticsQueryResponse> {\n return await this._interface.queryAnalytics(options);\n }\n\n async listSessionReplays(options?: ListSessionReplaysOptions): Promise<ListSessionReplaysResult> {\n const response = await this._interface.listSessionReplays({\n cursor: options?.cursor,\n limit: options?.limit,\n user_ids: options?.userIds,\n team_ids: options?.teamIds,\n duration_ms_min: options?.durationMsMin,\n duration_ms_max: options?.durationMsMax,\n last_event_at_from_millis: options?.lastEventAtFromMillis,\n last_event_at_to_millis: options?.lastEventAtToMillis,\n click_count_min: options?.clickCountMin,\n });\n\n const items: AdminSessionReplay[] = response.items.map((r) => ({\n id: r.id,\n projectUser: {\n id: r.project_user.id,\n displayName: r.project_user.display_name,\n primaryEmail: r.project_user.primary_email,\n },\n startedAt: new Date(r.started_at_millis),\n lastEventAt: new Date(r.last_event_at_millis),\n chunkCount: r.chunk_count,\n eventCount: r.event_count,\n }));\n\n return {\n items,\n nextCursor: response.pagination.next_cursor,\n };\n }\n\n async getSessionReplay(sessionReplayId: string): Promise<AdminSessionReplay> {\n const response = await this._interface.getSessionReplay(sessionReplayId);\n return {\n id: response.id,\n projectUser: {\n id: response.project_user.id,\n displayName: response.project_user.display_name,\n primaryEmail: response.project_user.primary_email,\n },\n startedAt: new Date(response.started_at_millis),\n lastEventAt: new Date(response.last_event_at_millis),\n chunkCount: response.chunk_count,\n eventCount: response.event_count,\n };\n }\n\n async listSessionReplayChunks(sessionReplayId: string, options?: ListSessionReplayChunksOptions): Promise<ListSessionReplayChunksResult> {\n const response = await this._interface.listSessionReplayChunks(sessionReplayId, {\n cursor: options?.cursor,\n limit: options?.limit,\n });\n\n const items: AdminSessionReplayChunk[] = response.items.map((c) => ({\n id: c.id,\n batchId: c.batch_id,\n sessionReplaySegmentId: c.session_replay_segment_id,\n browserSessionId: c.browser_session_id,\n eventCount: c.event_count,\n byteLength: c.byte_length,\n firstEventAt: new Date(c.first_event_at_millis),\n lastEventAt: new Date(c.last_event_at_millis),\n createdAt: new Date(c.created_at_millis),\n }));\n\n return {\n items,\n nextCursor: response.pagination.next_cursor,\n };\n }\n\n async getSessionReplayChunkEvents(sessionReplayId: string, chunkId: string): Promise<AdminGetSessionReplayChunkEventsResponse> {\n return await this._interface.getSessionReplayChunkEvents(sessionReplayId, chunkId);\n }\n\n async getSessionReplayEvents(sessionReplayId: string, options?: { offset?: number, limit?: number }): Promise<SessionReplayAllEventsResult> {\n const response = await this._interface.getSessionReplayEvents(sessionReplayId, options);\n return {\n chunks: response.chunks.map((c) => ({\n id: c.id,\n batchId: c.batch_id,\n sessionReplaySegmentId: c.session_replay_segment_id,\n eventCount: c.event_count,\n byteLength: c.byte_length,\n firstEventAt: new Date(c.first_event_at_millis),\n lastEventAt: new Date(c.last_event_at_millis),\n createdAt: new Date(c.created_at_millis),\n })),\n chunkEvents: response.chunk_events.map((ce) => ({\n chunkId: ce.chunk_id,\n events: ce.events,\n })),\n };\n }\n\n async previewAffectedUsersByOnboardingChange(\n onboarding: { requireEmailVerification?: boolean },\n limit?: number,\n ): Promise<{\n affectedUsers: Array<{\n id: string,\n displayName: string | null,\n primaryEmail: string | null,\n restrictedReason: RestrictedReason,\n }>,\n totalAffectedCount: number,\n }> {\n const result = await this._interface.previewAffectedUsersByOnboardingChange(\n { require_email_verification: onboarding.requireEmailVerification },\n limit,\n );\n return {\n affectedUsers: result.affected_users.map(u => ({\n id: u.id,\n displayName: u.display_name,\n primaryEmail: u.primary_email,\n restrictedReason: u.restricted_reason as RestrictedReason,\n })),\n totalAffectedCount: result.total_affected_count,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,SAAS,wBAAwB,QAAmD;AAClF,KAAI,OAAO,SAAS,qBAClB,QAAO;EACL,MAAM;EACN,OAAO,OAAO;EACd,MAAM,OAAO;EACb,QAAQ,OAAO;EACf,aAAa,OAAO;EACpB,kBAAkB,OAAO;EACzB,eAAe,OAAO;EACvB;AAEH,QAAO;;;;;AAMT,SAAS,wBAAwB,QAAmD;AAClF,KAAI,OAAO,SAAS,qBAClB,QAAO;EACL,MAAM;EACN,OAAO,OAAO;EACd,MAAM,OAAO;EACb,QAAQ,OAAO;EACf,YAAY,OAAO;EACnB,gBAAgB,OAAO;EACvB,cAAc,OAAO;EACtB;AAEH,QAAO;;AAGT,IAAa,+BAAb,cAA2G,8BAA2G;CA+DpN,YAAY,SAAoE,cAAwG;EACtL,MAAM,kBAAkB,0BAA0B,QAAQ;EAE1D,MAAM,uBAAuB,gBAAgB,wBAAwB,gCAAgC;AAErG,QAAM,iBAAiB;GACrB,GAAG;GACH,WAAW,cAAc,oBAAoB;IAC3C,MAAM,UAAU,eAAe,gBAAgB,QAAQ;AACvD,WAAO,IAAI,uBAAuB;KAChC,kBAAkB,SAAS,CAAC;KAC5B,YAAY;KACZ,WAAW,gBAAgB,aAAa,qBAAqB;KAC7D,qBAAqB,gBAAgB,uBAAuB,+BAA+B;KAC3F;KACA,GAAG,gBAAgB,sBAAsB,EACvC,qBAAqB,gBAAgB,qBACtC,GAAG;MACF,GAAI,uBAAuB,EAAE,sBAAsB,GAAG,EAAE;MACxD,iBAAiB,gBAAgB,mBAAmB,2BAA2B;MAC/E,qBAAqB,gBAAgB,uBAAuB,+BAA+B;MAC5F;KACF,CAAC;OACA;GACL,CAAC;4BApFkC,YAAY,YAAY;AAC5D,UAAO,MAAM,KAAK,WAAW,YAAY;IACzC;+BACuC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IAAI,KAAK,EAAE,qBAAqB;IAC7C,WAAW,IAAI,KAAK,EAAE,kBAAkB;IACzC,EAAE;GAID,YAAY,SAAS,WAAW;GACjC;;CAGH,MAAM,4BAA4B,iBAAyB,SAAoE;AAC7H,SAAO,MAAM,KAAK,WAAW,4BAA4B,iBAAiB,QAAQ;;CAGpF,MAAM,uBAAuB,iBAAyB,SAAsF;EAC1I,MAAM,WAAW,MAAM,KAAK,WAAW,uBAAuB,iBAAiB,QAAQ;AACvF,SAAO;GACL,QAAQ,SAAS,OAAO,KAAK,OAAO;IAClC,IAAI,EAAE;IACN,SAAS,EAAE;IACX,wBAAwB,EAAE;IAC1B,YAAY,EAAE;IACd,YAAY,EAAE;IACd,cAAc,IAAI,KAAK,EAAE,sBAAsB;IAC/C,aAAa,IAAI,KAAK,EAAE,qBAAqB;IAC7C,WAAW,IAAI,KAAK,EAAE,kBAAkB;IACzC,EAAE;GACH,aAAa,SAAS,aAAa,KAAK,QAAQ;IAC9C,SAAS,GAAG;IACZ,QAAQ,GAAG;IACZ,EAAE;GACJ;;CAGH,MAAM,uCACJ,YACA,OASC;EACD,MAAM,SAAS,MAAM,KAAK,WAAW,uCACnC,EAAE,4BAA4B,WAAW,0BAA0B,EACnE,MACD;AACD,SAAO;GACL,eAAe,OAAO,eAAe,KAAI,OAAM;IAC7C,IAAI,EAAE;IACN,aAAa,EAAE;IACf,cAAc,EAAE;IAChB,kBAAkB,EAAE;IACrB,EAAE;GACH,oBAAoB,OAAO;GAC5B"}
@@ -1,7 +1,22 @@
1
- import { describe, expect, it } from "vitest";
1
+ import { describe, expect, it, vi } from "vitest";
2
2
  import { StackClientApp } from "../interfaces/client-app.js";
3
3
 
4
4
  //#region src/lib/stack-app/apps/implementations/client-app-impl.cross-domain.test.ts
5
+ function createMockDocument() {
6
+ const cookieJar = /* @__PURE__ */ new Map();
7
+ return {
8
+ get cookie() {
9
+ return [...cookieJar.entries()].map(([key, value]) => `${key}=${value}`).join("; ");
10
+ },
11
+ set cookie(str) {
12
+ const [nameValue] = str.split(";");
13
+ const eqIndex = nameValue.indexOf("=");
14
+ if (eqIndex < 0) return;
15
+ cookieJar.set(nameValue.slice(0, eqIndex).trim(), nameValue.slice(eqIndex + 1).trim());
16
+ },
17
+ createElement: () => ({})
18
+ };
19
+ }
5
20
  describe("StackClientApp cross-domain auth", () => {
6
21
  it("uses the fresh post-auth refresh token when minting a cross-domain handoff", async () => {
7
22
  const clientApp = new StackClientApp({
@@ -48,6 +63,57 @@ describe("StackClientApp cross-domain auth", () => {
48
63
  }
49
64
  expect(capturedRefreshTokens).toEqual(["fresh-refresh-token"]);
50
65
  });
66
+ it("uses a fresh nested OAuth state while preserving the outer cross-domain return state", async () => {
67
+ const projectId = "00000000-0000-4000-8000-000000000002";
68
+ const clientApp = new StackClientApp({
69
+ baseUrl: "http://localhost:12345",
70
+ projectId,
71
+ publishableClientKey: "stack-pk-test",
72
+ tokenStore: "memory",
73
+ redirectMethod: "window",
74
+ urls: { default: { type: "hosted" } },
75
+ noAutomaticPrefetch: true
76
+ });
77
+ const outerState = "outer-cross-domain-state";
78
+ const outerCodeChallenge = "abcdefghijklmnopqrstuvwxyzABCDEFG_0123456789-._~";
79
+ const currentUrl = new URL(`https://${projectId}.example-stack-hosted.test/handler/sign-in`);
80
+ currentUrl.searchParams.set("after_auth_return_to", `https://demo.stack-auth.com/?hexclave_cross_domain_auth=1&hexclave_cross_domain_state=${outerState}`);
81
+ currentUrl.searchParams.set("hexclave_cross_domain_state", outerState);
82
+ currentUrl.searchParams.set("hexclave_cross_domain_code_challenge", outerCodeChallenge);
83
+ currentUrl.searchParams.set("hexclave_cross_domain_after_callback_redirect_url", "https://demo.stack-auth.com/");
84
+ currentUrl.searchParams.set("stack_nested_cross_domain_auth_refresh_token_id", "source-session");
85
+ currentUrl.searchParams.set("stack_nested_cross_domain_auth_callback_url", "https://demo.stack-auth.com/");
86
+ const previousWindow = globalThis.window;
87
+ const previousDocument = globalThis.document;
88
+ let redirectedUrl = "";
89
+ vi.spyOn(clientApp, "_getCurrentRefreshTokenIdIfSignedIn").mockResolvedValue(null);
90
+ vi.spyOn(clientApp, "_getNestedCrossDomainAuthParamsForRedirect").mockResolvedValue({
91
+ state: "fresh-nested-state",
92
+ codeChallenge: "fresh-nested-code-challenge"
93
+ });
94
+ vi.spyOn(clientApp, "_isTrusted").mockResolvedValue(true);
95
+ globalThis.document = createMockDocument();
96
+ globalThis.window = { location: {
97
+ href: currentUrl.toString(),
98
+ replace: (url) => {
99
+ redirectedUrl = url;
100
+ throw new Error("INTENTIONAL_TEST_ABORT");
101
+ }
102
+ } };
103
+ try {
104
+ await expect(clientApp._maybeHandleNestedCrossDomainAuth()).rejects.toThrowError("INTENTIONAL_TEST_ABORT");
105
+ } finally {
106
+ globalThis.window = previousWindow;
107
+ globalThis.document = previousDocument;
108
+ }
109
+ const redirectUrl = new URL(redirectedUrl);
110
+ expect(redirectUrl.searchParams.get("state")).toBe("fresh-nested-state");
111
+ expect(redirectUrl.searchParams.get("code_challenge")).toBe("fresh-nested-code-challenge");
112
+ const redirectUri = new URL(redirectUrl.searchParams.get("redirect_uri") ?? "");
113
+ expect(redirectUri.searchParams.get("hexclave_cross_domain_state")).toBe(outerState);
114
+ expect(redirectUri.searchParams.get("hexclave_cross_domain_code_challenge")).toBe(outerCodeChallenge);
115
+ expect(redirectUri.searchParams.get("hexclave_cross_domain_after_callback_redirect_url")).toBe("https://demo.stack-auth.com/");
116
+ });
51
117
  });
52
118
 
53
119
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"client-app-impl.cross-domain.test.js","names":[],"sources":["../../../../../../src/lib/stack-app/apps/implementations/client-app-impl.cross-domain.test.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { describe, expect, it } from \"vitest\";\nimport { StackClientApp } from \"../interfaces/client-app\";\n\ndescribe(\"StackClientApp cross-domain auth\", () => {\n it(\"uses the fresh post-auth refresh token when minting a cross-domain handoff\", async () => {\n const clientApp = new StackClientApp({\n baseUrl: \"http://localhost:12345\",\n projectId: \"00000000-0000-4000-8000-000000000000\",\n publishableClientKey: \"stack-pk-test\",\n tokenStore: {\n accessToken: \"stale-access-token\",\n refreshToken: \"stale-refresh-token\",\n },\n redirectMethod: \"none\",\n noAutomaticPrefetch: true,\n });\n\n const clientInterface = Reflect.get(clientApp, \"_interface\");\n const originalSendClientRequest = Reflect.get(clientInterface, \"sendClientRequest\");\n const capturedRefreshTokens: string[] = [];\n\n Reflect.set(clientInterface, \"sendClientRequest\", async (_path: unknown, _requestOptions: unknown, session: unknown) => {\n const getRefreshToken = Reflect.get(session ?? {}, \"getRefreshToken\");\n if (typeof getRefreshToken !== \"function\") {\n throw new Error(\"Expected cross-domain auth to pass a session to the client interface.\");\n }\n const refreshToken = getRefreshToken.call(session);\n const refreshTokenString = Reflect.get(refreshToken ?? {}, \"token\");\n if (typeof refreshTokenString !== \"string\") {\n throw new Error(\"Expected cross-domain auth to pass a refresh-token-backed session.\");\n }\n capturedRefreshTokens.push(refreshTokenString);\n return {\n ok: true,\n json: async () => ({ redirect_url: \"https://example.com/handler/oauth-callback?code=handoff-code&state=handoff-state\" }),\n };\n });\n\n try {\n const createCrossDomainAuthRedirectUrl = Reflect.get(clientApp, \"_createCrossDomainAuthRedirectUrl\");\n if (typeof createCrossDomainAuthRedirectUrl !== \"function\") {\n throw new Error(\"Expected StackClientApp to expose _createCrossDomainAuthRedirectUrl in tests.\");\n }\n\n await expect(createCrossDomainAuthRedirectUrl.call(clientApp, {\n redirectUri: \"https://example.com/handler/oauth-callback\",\n state: \"handoff-state\",\n codeChallenge: \"abcdefghijklmnopqrstuvwxyzABCDEFG_0123456789-._~\",\n afterCallbackRedirectUrl: \"https://example.com/account-settings\",\n overrideTokenStoreInit: {\n accessToken: \"fresh-access-token\",\n refreshToken: \"fresh-refresh-token\",\n },\n })).resolves.toBe(\"https://example.com/handler/oauth-callback?code=handoff-code&state=handoff-state\");\n } finally {\n Reflect.set(clientInterface, \"sendClientRequest\", originalSendClientRequest);\n }\n\n expect(capturedRefreshTokens).toEqual([\"fresh-refresh-token\"]);\n });\n});\n"],"mappings":";;;;AAOA,SAAS,0CAA0C;AACjD,IAAG,8EAA8E,YAAY;EAC3F,MAAM,YAAY,IAAI,eAAe;GACnC,SAAS;GACT,WAAW;GACX,sBAAsB;GACtB,YAAY;IACV,aAAa;IACb,cAAc;IACf;GACD,gBAAgB;GAChB,qBAAqB;GACtB,CAAC;EAEF,MAAM,kBAAkB,QAAQ,IAAI,WAAW,aAAa;EAC5D,MAAM,4BAA4B,QAAQ,IAAI,iBAAiB,oBAAoB;EACnF,MAAM,wBAAkC,EAAE;AAE1C,UAAQ,IAAI,iBAAiB,qBAAqB,OAAO,OAAgB,iBAA0B,YAAqB;GACtH,MAAM,kBAAkB,QAAQ,IAAI,WAAW,EAAE,EAAE,kBAAkB;AACrE,OAAI,OAAO,oBAAoB,WAC7B,OAAM,IAAI,MAAM,wEAAwE;GAE1F,MAAM,eAAe,gBAAgB,KAAK,QAAQ;GAClD,MAAM,qBAAqB,QAAQ,IAAI,gBAAgB,EAAE,EAAE,QAAQ;AACnE,OAAI,OAAO,uBAAuB,SAChC,OAAM,IAAI,MAAM,qEAAqE;AAEvF,yBAAsB,KAAK,mBAAmB;AAC9C,UAAO;IACL,IAAI;IACJ,MAAM,aAAa,EAAE,cAAc,oFAAoF;IACxH;IACD;AAEF,MAAI;GACF,MAAM,mCAAmC,QAAQ,IAAI,WAAW,oCAAoC;AACpG,OAAI,OAAO,qCAAqC,WAC9C,OAAM,IAAI,MAAM,gFAAgF;AAGlG,SAAM,OAAO,iCAAiC,KAAK,WAAW;IAC5D,aAAa;IACb,OAAO;IACP,eAAe;IACf,0BAA0B;IAC1B,wBAAwB;KACtB,aAAa;KACb,cAAc;KACf;IACF,CAAC,CAAC,CAAC,SAAS,KAAK,mFAAmF;YAC7F;AACR,WAAQ,IAAI,iBAAiB,qBAAqB,0BAA0B;;AAG9E,SAAO,sBAAsB,CAAC,QAAQ,CAAC,sBAAsB,CAAC;GAC9D;EACF"}
1
+ {"version":3,"file":"client-app-impl.cross-domain.test.js","names":[],"sources":["../../../../../../src/lib/stack-app/apps/implementations/client-app-impl.cross-domain.test.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { describe, expect, it, vi } from \"vitest\";\nimport { StackClientApp } from \"../interfaces/client-app\";\n\nfunction createMockDocument(): Document {\n const cookieJar = new Map<string, string>();\n return {\n get cookie() {\n return [...cookieJar.entries()].map(([key, value]) => `${key}=${value}`).join(\"; \");\n },\n set cookie(str: string) {\n const [nameValue] = str.split(\";\");\n const eqIndex = nameValue.indexOf(\"=\");\n if (eqIndex < 0) return;\n cookieJar.set(nameValue.slice(0, eqIndex).trim(), nameValue.slice(eqIndex + 1).trim());\n },\n createElement: () => ({}),\n } as any;\n}\n\ndescribe(\"StackClientApp cross-domain auth\", () => {\n it(\"uses the fresh post-auth refresh token when minting a cross-domain handoff\", async () => {\n const clientApp = new StackClientApp({\n baseUrl: \"http://localhost:12345\",\n projectId: \"00000000-0000-4000-8000-000000000000\",\n publishableClientKey: \"stack-pk-test\",\n tokenStore: {\n accessToken: \"stale-access-token\",\n refreshToken: \"stale-refresh-token\",\n },\n redirectMethod: \"none\",\n noAutomaticPrefetch: true,\n });\n\n const clientInterface = Reflect.get(clientApp, \"_interface\");\n const originalSendClientRequest = Reflect.get(clientInterface, \"sendClientRequest\");\n const capturedRefreshTokens: string[] = [];\n\n Reflect.set(clientInterface, \"sendClientRequest\", async (_path: unknown, _requestOptions: unknown, session: unknown) => {\n const getRefreshToken = Reflect.get(session ?? {}, \"getRefreshToken\");\n if (typeof getRefreshToken !== \"function\") {\n throw new Error(\"Expected cross-domain auth to pass a session to the client interface.\");\n }\n const refreshToken = getRefreshToken.call(session);\n const refreshTokenString = Reflect.get(refreshToken ?? {}, \"token\");\n if (typeof refreshTokenString !== \"string\") {\n throw new Error(\"Expected cross-domain auth to pass a refresh-token-backed session.\");\n }\n capturedRefreshTokens.push(refreshTokenString);\n return {\n ok: true,\n json: async () => ({ redirect_url: \"https://example.com/handler/oauth-callback?code=handoff-code&state=handoff-state\" }),\n };\n });\n\n try {\n const createCrossDomainAuthRedirectUrl = Reflect.get(clientApp, \"_createCrossDomainAuthRedirectUrl\");\n if (typeof createCrossDomainAuthRedirectUrl !== \"function\") {\n throw new Error(\"Expected StackClientApp to expose _createCrossDomainAuthRedirectUrl in tests.\");\n }\n\n await expect(createCrossDomainAuthRedirectUrl.call(clientApp, {\n redirectUri: \"https://example.com/handler/oauth-callback\",\n state: \"handoff-state\",\n codeChallenge: \"abcdefghijklmnopqrstuvwxyzABCDEFG_0123456789-._~\",\n afterCallbackRedirectUrl: \"https://example.com/account-settings\",\n overrideTokenStoreInit: {\n accessToken: \"fresh-access-token\",\n refreshToken: \"fresh-refresh-token\",\n },\n })).resolves.toBe(\"https://example.com/handler/oauth-callback?code=handoff-code&state=handoff-state\");\n } finally {\n Reflect.set(clientInterface, \"sendClientRequest\", originalSendClientRequest);\n }\n\n expect(capturedRefreshTokens).toEqual([\"fresh-refresh-token\"]);\n });\n\n it(\"uses a fresh nested OAuth state while preserving the outer cross-domain return state\", async () => {\n const projectId = \"00000000-0000-4000-8000-000000000002\";\n const clientApp = new StackClientApp({\n baseUrl: \"http://localhost:12345\",\n projectId,\n publishableClientKey: \"stack-pk-test\",\n tokenStore: \"memory\",\n redirectMethod: \"window\",\n urls: {\n default: { type: \"hosted\" },\n },\n noAutomaticPrefetch: true,\n });\n const outerState = \"outer-cross-domain-state\";\n const outerCodeChallenge = \"abcdefghijklmnopqrstuvwxyzABCDEFG_0123456789-._~\";\n const currentUrl = new URL(`https://${projectId}.example-stack-hosted.test/handler/sign-in`);\n currentUrl.searchParams.set(\"after_auth_return_to\", `https://demo.stack-auth.com/?hexclave_cross_domain_auth=1&hexclave_cross_domain_state=${outerState}`);\n currentUrl.searchParams.set(\"hexclave_cross_domain_state\", outerState);\n currentUrl.searchParams.set(\"hexclave_cross_domain_code_challenge\", outerCodeChallenge);\n currentUrl.searchParams.set(\"hexclave_cross_domain_after_callback_redirect_url\", \"https://demo.stack-auth.com/\");\n currentUrl.searchParams.set(\"stack_nested_cross_domain_auth_refresh_token_id\", \"source-session\");\n currentUrl.searchParams.set(\"stack_nested_cross_domain_auth_callback_url\", \"https://demo.stack-auth.com/\");\n\n const previousWindow = globalThis.window;\n const previousDocument = globalThis.document;\n let redirectedUrl = \"\";\n vi.spyOn(clientApp as any, \"_getCurrentRefreshTokenIdIfSignedIn\").mockResolvedValue(null);\n vi.spyOn(clientApp as any, \"_getNestedCrossDomainAuthParamsForRedirect\").mockResolvedValue({\n state: \"fresh-nested-state\",\n codeChallenge: \"fresh-nested-code-challenge\",\n });\n vi.spyOn(clientApp as any, \"_isTrusted\").mockResolvedValue(true);\n\n globalThis.document = createMockDocument();\n globalThis.window = {\n location: {\n href: currentUrl.toString(),\n replace: (url: string) => {\n redirectedUrl = url;\n throw new Error(\"INTENTIONAL_TEST_ABORT\");\n },\n },\n } as any;\n\n try {\n await expect((clientApp as any)._maybeHandleNestedCrossDomainAuth()).rejects.toThrowError(\"INTENTIONAL_TEST_ABORT\");\n } finally {\n globalThis.window = previousWindow;\n globalThis.document = previousDocument;\n }\n\n const redirectUrl = new URL(redirectedUrl);\n expect(redirectUrl.searchParams.get(\"state\")).toBe(\"fresh-nested-state\");\n expect(redirectUrl.searchParams.get(\"code_challenge\")).toBe(\"fresh-nested-code-challenge\");\n const redirectUri = new URL(redirectUrl.searchParams.get(\"redirect_uri\") ?? \"\");\n expect(redirectUri.searchParams.get(\"hexclave_cross_domain_state\")).toBe(outerState);\n expect(redirectUri.searchParams.get(\"hexclave_cross_domain_code_challenge\")).toBe(outerCodeChallenge);\n expect(redirectUri.searchParams.get(\"hexclave_cross_domain_after_callback_redirect_url\")).toBe(\"https://demo.stack-auth.com/\");\n });\n});\n"],"mappings":";;;;AAOA,SAAS,qBAA+B;CACtC,MAAM,4BAAY,IAAI,KAAqB;AAC3C,QAAO;EACL,IAAI,SAAS;AACX,UAAO,CAAC,GAAG,UAAU,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,GAAG,QAAQ,CAAC,KAAK,KAAK;;EAErF,IAAI,OAAO,KAAa;GACtB,MAAM,CAAC,aAAa,IAAI,MAAM,IAAI;GAClC,MAAM,UAAU,UAAU,QAAQ,IAAI;AACtC,OAAI,UAAU,EAAG;AACjB,aAAU,IAAI,UAAU,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,UAAU,MAAM,UAAU,EAAE,CAAC,MAAM,CAAC;;EAExF,sBAAsB,EAAE;EACzB;;AAGH,SAAS,0CAA0C;AACjD,IAAG,8EAA8E,YAAY;EAC3F,MAAM,YAAY,IAAI,eAAe;GACnC,SAAS;GACT,WAAW;GACX,sBAAsB;GACtB,YAAY;IACV,aAAa;IACb,cAAc;IACf;GACD,gBAAgB;GAChB,qBAAqB;GACtB,CAAC;EAEF,MAAM,kBAAkB,QAAQ,IAAI,WAAW,aAAa;EAC5D,MAAM,4BAA4B,QAAQ,IAAI,iBAAiB,oBAAoB;EACnF,MAAM,wBAAkC,EAAE;AAE1C,UAAQ,IAAI,iBAAiB,qBAAqB,OAAO,OAAgB,iBAA0B,YAAqB;GACtH,MAAM,kBAAkB,QAAQ,IAAI,WAAW,EAAE,EAAE,kBAAkB;AACrE,OAAI,OAAO,oBAAoB,WAC7B,OAAM,IAAI,MAAM,wEAAwE;GAE1F,MAAM,eAAe,gBAAgB,KAAK,QAAQ;GAClD,MAAM,qBAAqB,QAAQ,IAAI,gBAAgB,EAAE,EAAE,QAAQ;AACnE,OAAI,OAAO,uBAAuB,SAChC,OAAM,IAAI,MAAM,qEAA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