@aglyn/tenant-data-admin 1.0.0-beta.143

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 (374) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/jest.integration.config.d.ts +39 -0
  4. package/jest.integration.setup.d.ts +17 -0
  5. package/package.json +51 -0
  6. package/src/index.d.ts +17 -0
  7. package/src/index.js +18 -0
  8. package/src/index.js.map +1 -0
  9. package/src/lib/render-cache.d.ts +184 -0
  10. package/src/lib/render-cache.js +198 -0
  11. package/src/lib/render-cache.js.map +1 -0
  12. package/src/lib/server/account-addresses.d.ts +160 -0
  13. package/src/lib/server/account-addresses.js +311 -0
  14. package/src/lib/server/account-addresses.js.map +1 -0
  15. package/src/lib/server/account-emails.d.ts +219 -0
  16. package/src/lib/server/account-emails.js +640 -0
  17. package/src/lib/server/account-emails.js.map +1 -0
  18. package/src/lib/server/admin-audit.d.ts +180 -0
  19. package/src/lib/server/admin-audit.js +233 -0
  20. package/src/lib/server/admin-audit.js.map +1 -0
  21. package/src/lib/server/analytics-retention.d.ts +63 -0
  22. package/src/lib/server/analytics-retention.js +66 -0
  23. package/src/lib/server/analytics-retention.js.map +1 -0
  24. package/src/lib/server/api-http.d.ts +159 -0
  25. package/src/lib/server/api-http.js +230 -0
  26. package/src/lib/server/api-http.js.map +1 -0
  27. package/src/lib/server/api-keys.d.ts +117 -0
  28. package/src/lib/server/api-keys.js +298 -0
  29. package/src/lib/server/api-keys.js.map +1 -0
  30. package/src/lib/server/auth-handoff.d.ts +165 -0
  31. package/src/lib/server/auth-handoff.js +482 -0
  32. package/src/lib/server/auth-handoff.js.map +1 -0
  33. package/src/lib/server/auth-pools.d.ts +246 -0
  34. package/src/lib/server/auth-pools.js +551 -0
  35. package/src/lib/server/auth-pools.js.map +1 -0
  36. package/src/lib/server/billing-addons.d.ts +171 -0
  37. package/src/lib/server/billing-addons.js +277 -0
  38. package/src/lib/server/billing-addons.js.map +1 -0
  39. package/src/lib/server/campaign-attribution-store.d.ts +55 -0
  40. package/src/lib/server/campaign-attribution-store.js +95 -0
  41. package/src/lib/server/campaign-attribution-store.js.map +1 -0
  42. package/src/lib/server/campaign-conversion-attribution.d.ts +205 -0
  43. package/src/lib/server/campaign-conversion-attribution.js +279 -0
  44. package/src/lib/server/campaign-conversion-attribution.js.map +1 -0
  45. package/src/lib/server/client-error-report.d.ts +301 -0
  46. package/src/lib/server/client-error-report.js +755 -0
  47. package/src/lib/server/client-error-report.js.map +1 -0
  48. package/src/lib/server/connect-account-status.d.ts +74 -0
  49. package/src/lib/server/connect-account-status.js +94 -0
  50. package/src/lib/server/connect-account-status.js.map +1 -0
  51. package/src/lib/server/connect-payout-failure.d.ts +103 -0
  52. package/src/lib/server/connect-payout-failure.js +127 -0
  53. package/src/lib/server/connect-payout-failure.js.map +1 -0
  54. package/src/lib/server/console-api-rate-limit.d.ts +81 -0
  55. package/src/lib/server/console-api-rate-limit.js +111 -0
  56. package/src/lib/server/console-api-rate-limit.js.map +1 -0
  57. package/src/lib/server/console-domains.d.ts +326 -0
  58. package/src/lib/server/console-domains.js +779 -0
  59. package/src/lib/server/console-domains.js.map +1 -0
  60. package/src/lib/server/consume-once.d.ts +91 -0
  61. package/src/lib/server/consume-once.js +96 -0
  62. package/src/lib/server/consume-once.js.map +1 -0
  63. package/src/lib/server/contact-company-link.d.ts +85 -0
  64. package/src/lib/server/contact-company-link.js +105 -0
  65. package/src/lib/server/contact-company-link.js.map +1 -0
  66. package/src/lib/server/contact-email-engagement.d.ts +32 -0
  67. package/src/lib/server/contact-email-engagement.js +145 -0
  68. package/src/lib/server/contact-email-engagement.js.map +1 -0
  69. package/src/lib/server/contact-email-index.d.ts +56 -0
  70. package/src/lib/server/contact-email-index.js +158 -0
  71. package/src/lib/server/contact-email-index.js.map +1 -0
  72. package/src/lib/server/contact-lifecycle-floor.d.ts +89 -0
  73. package/src/lib/server/contact-lifecycle-floor.js +88 -0
  74. package/src/lib/server/contact-lifecycle-floor.js.map +1 -0
  75. package/src/lib/server/contact-merge.d.ts +55 -0
  76. package/src/lib/server/contact-merge.js +279 -0
  77. package/src/lib/server/contact-merge.js.map +1 -0
  78. package/src/lib/server/contact-suppression.d.ts +153 -0
  79. package/src/lib/server/contact-suppression.js +259 -0
  80. package/src/lib/server/contact-suppression.js.map +1 -0
  81. package/src/lib/server/crm-booking-activity.d.ts +86 -0
  82. package/src/lib/server/crm-booking-activity.js +251 -0
  83. package/src/lib/server/crm-booking-activity.js.map +1 -0
  84. package/src/lib/server/crm-email-activity.d.ts +112 -0
  85. package/src/lib/server/crm-email-activity.js +143 -0
  86. package/src/lib/server/crm-email-activity.js.map +1 -0
  87. package/src/lib/server/crm-inbound-email.d.ts +145 -0
  88. package/src/lib/server/crm-inbound-email.js +287 -0
  89. package/src/lib/server/crm-inbound-email.js.map +1 -0
  90. package/src/lib/server/crm-next-activity.d.ts +74 -0
  91. package/src/lib/server/crm-next-activity.js +194 -0
  92. package/src/lib/server/crm-next-activity.js.map +1 -0
  93. package/src/lib/server/crm-records.d.ts +144 -0
  94. package/src/lib/server/crm-records.js +218 -0
  95. package/src/lib/server/crm-records.js.map +1 -0
  96. package/src/lib/server/csp-aggregate.d.ts +62 -0
  97. package/src/lib/server/csp-aggregate.js +276 -0
  98. package/src/lib/server/csp-aggregate.js.map +1 -0
  99. package/src/lib/server/data-storage-gate.d.ts +66 -0
  100. package/src/lib/server/data-storage-gate.js +48 -0
  101. package/src/lib/server/data-storage-gate.js.map +1 -0
  102. package/src/lib/server/dataset-live-pages.d.ts +179 -0
  103. package/src/lib/server/dataset-live-pages.js +421 -0
  104. package/src/lib/server/dataset-live-pages.js.map +1 -0
  105. package/src/lib/server/dns-probe.d.ts +53 -0
  106. package/src/lib/server/dns-probe.js +184 -0
  107. package/src/lib/server/dns-probe.js.map +1 -0
  108. package/src/lib/server/document-id.d.ts +29 -0
  109. package/src/lib/server/document-id.js +100 -0
  110. package/src/lib/server/document-id.js.map +1 -0
  111. package/src/lib/server/domain-provider-vercel.d.ts +33 -0
  112. package/src/lib/server/domain-provider-vercel.js +298 -0
  113. package/src/lib/server/domain-provider-vercel.js.map +1 -0
  114. package/src/lib/server/domain-provider-webhook.d.ts +73 -0
  115. package/src/lib/server/domain-provider-webhook.js +223 -0
  116. package/src/lib/server/domain-provider-webhook.js.map +1 -0
  117. package/src/lib/server/domain-provider-wildcard.d.ts +54 -0
  118. package/src/lib/server/domain-provider-wildcard.js +163 -0
  119. package/src/lib/server/domain-provider-wildcard.js.map +1 -0
  120. package/src/lib/server/domain-provider.d.ts +197 -0
  121. package/src/lib/server/domain-provider.js +221 -0
  122. package/src/lib/server/domain-provider.js.map +1 -0
  123. package/src/lib/server/duplicate-activity.d.ts +54 -0
  124. package/src/lib/server/duplicate-activity.js +67 -0
  125. package/src/lib/server/duplicate-activity.js.map +1 -0
  126. package/src/lib/server/duplicate-resource.d.ts +55 -0
  127. package/src/lib/server/duplicate-resource.js +474 -0
  128. package/src/lib/server/duplicate-resource.js.map +1 -0
  129. package/src/lib/server/dynamic-list-materialize.d.ts +153 -0
  130. package/src/lib/server/dynamic-list-materialize.js +581 -0
  131. package/src/lib/server/dynamic-list-materialize.js.map +1 -0
  132. package/src/lib/server/edit-access-authz.d.ts +56 -0
  133. package/src/lib/server/edit-access-authz.js +107 -0
  134. package/src/lib/server/edit-access-authz.js.map +1 -0
  135. package/src/lib/server/edit-access-token.d.ts +72 -0
  136. package/src/lib/server/edit-access-token.js +116 -0
  137. package/src/lib/server/edit-access-token.js.map +1 -0
  138. package/src/lib/server/edit-hint-token.d.ts +83 -0
  139. package/src/lib/server/edit-hint-token.js +119 -0
  140. package/src/lib/server/edit-hint-token.js.map +1 -0
  141. package/src/lib/server/email-delivery-log.d.ts +509 -0
  142. package/src/lib/server/email-delivery-log.js +1043 -0
  143. package/src/lib/server/email-delivery-log.js.map +1 -0
  144. package/src/lib/server/email-flow-gate.d.ts +80 -0
  145. package/src/lib/server/email-flow-gate.js +153 -0
  146. package/src/lib/server/email-flow-gate.js.map +1 -0
  147. package/src/lib/server/email-marketing-gate.d.ts +333 -0
  148. package/src/lib/server/email-marketing-gate.js +639 -0
  149. package/src/lib/server/email-marketing-gate.js.map +1 -0
  150. package/src/lib/server/email-metering.d.ts +293 -0
  151. package/src/lib/server/email-metering.js +359 -0
  152. package/src/lib/server/email-metering.js.map +1 -0
  153. package/src/lib/server/email-revenue-attribution.d.ts +185 -0
  154. package/src/lib/server/email-revenue-attribution.js +300 -0
  155. package/src/lib/server/email-revenue-attribution.js.map +1 -0
  156. package/src/lib/server/email-send-rate.d.ts +232 -0
  157. package/src/lib/server/email-send-rate.js +417 -0
  158. package/src/lib/server/email-send-rate.js.map +1 -0
  159. package/src/lib/server/email-sender-reputation.d.ts +317 -0
  160. package/src/lib/server/email-sender-reputation.js +464 -0
  161. package/src/lib/server/email-sender-reputation.js.map +1 -0
  162. package/src/lib/server/email-suppression.d.ts +490 -0
  163. package/src/lib/server/email-suppression.js +648 -0
  164. package/src/lib/server/email-suppression.js.map +1 -0
  165. package/src/lib/server/email-topic-confirmation.d.ts +150 -0
  166. package/src/lib/server/email-topic-confirmation.js +272 -0
  167. package/src/lib/server/email-topic-confirmation.js.map +1 -0
  168. package/src/lib/server/email-unsubscribe-link.d.ts +174 -0
  169. package/src/lib/server/email-unsubscribe-link.js +236 -0
  170. package/src/lib/server/email-unsubscribe-link.js.map +1 -0
  171. package/src/lib/server/erase-person.d.ts +116 -0
  172. package/src/lib/server/erase-person.js +272 -0
  173. package/src/lib/server/erase-person.js.map +1 -0
  174. package/src/lib/server/erase.d.ts +458 -0
  175. package/src/lib/server/erase.js +1506 -0
  176. package/src/lib/server/erase.js.map +1 -0
  177. package/src/lib/server/firebase-admin.d.ts +71 -0
  178. package/src/lib/server/firebase-admin.js +343 -0
  179. package/src/lib/server/firebase-admin.js.map +1 -0
  180. package/src/lib/server/form-dataset-binding-token.d.ts +35 -0
  181. package/src/lib/server/form-dataset-binding-token.js +107 -0
  182. package/src/lib/server/form-dataset-binding-token.js.map +1 -0
  183. package/src/lib/server/free-workspace-cap.d.ts +201 -0
  184. package/src/lib/server/free-workspace-cap.js +404 -0
  185. package/src/lib/server/free-workspace-cap.js.map +1 -0
  186. package/src/lib/server/ga4-measurement-protocol.d.ts +256 -0
  187. package/src/lib/server/ga4-measurement-protocol.js +558 -0
  188. package/src/lib/server/ga4-measurement-protocol.js.map +1 -0
  189. package/src/lib/server/host-email-tokens.d.ts +47 -0
  190. package/src/lib/server/host-email-tokens.js +72 -0
  191. package/src/lib/server/host-email-tokens.js.map +1 -0
  192. package/src/lib/server/host-memberships.d.ts +54 -0
  193. package/src/lib/server/host-memberships.js +194 -0
  194. package/src/lib/server/host-memberships.js.map +1 -0
  195. package/src/lib/server/host-sending-domain.d.ts +292 -0
  196. package/src/lib/server/host-sending-domain.js +451 -0
  197. package/src/lib/server/host-sending-domain.js.map +1 -0
  198. package/src/lib/server/host-visitor-records.d.ts +150 -0
  199. package/src/lib/server/host-visitor-records.js +262 -0
  200. package/src/lib/server/host-visitor-records.js.map +1 -0
  201. package/src/lib/server/id-token-refusal.d.ts +28 -0
  202. package/src/lib/server/id-token-refusal.js +111 -0
  203. package/src/lib/server/id-token-refusal.js.map +1 -0
  204. package/src/lib/server/legal-acceptance.d.ts +214 -0
  205. package/src/lib/server/legal-acceptance.js +305 -0
  206. package/src/lib/server/legal-acceptance.js.map +1 -0
  207. package/src/lib/server/list-members.d.ts +211 -0
  208. package/src/lib/server/list-members.js +176 -0
  209. package/src/lib/server/list-members.js.map +1 -0
  210. package/src/lib/server/live-page-usage.d.ts +202 -0
  211. package/src/lib/server/live-page-usage.js +300 -0
  212. package/src/lib/server/live-page-usage.js.map +1 -0
  213. package/src/lib/server/lockdown.d.ts +313 -0
  214. package/src/lib/server/lockdown.js +643 -0
  215. package/src/lib/server/lockdown.js.map +1 -0
  216. package/src/lib/server/media-cdn-rate-limit.d.ts +188 -0
  217. package/src/lib/server/media-cdn-rate-limit.js +204 -0
  218. package/src/lib/server/media-cdn-rate-limit.js.map +1 -0
  219. package/src/lib/server/media-delivery.d.ts +267 -0
  220. package/src/lib/server/media-delivery.js +485 -0
  221. package/src/lib/server/media-delivery.js.map +1 -0
  222. package/src/lib/server/media-download-tokens.d.ts +161 -0
  223. package/src/lib/server/media-download-tokens.js +386 -0
  224. package/src/lib/server/media-download-tokens.js.map +1 -0
  225. package/src/lib/server/media-quarantine.d.ts +127 -0
  226. package/src/lib/server/media-quarantine.js +170 -0
  227. package/src/lib/server/media-quarantine.js.map +1 -0
  228. package/src/lib/server/media-signing.d.ts +126 -0
  229. package/src/lib/server/media-signing.js +159 -0
  230. package/src/lib/server/media-signing.js.map +1 -0
  231. package/src/lib/server/media-storage-path.d.ts +96 -0
  232. package/src/lib/server/media-storage-path.js +111 -0
  233. package/src/lib/server/media-storage-path.js.map +1 -0
  234. package/src/lib/server/media-strong-digest.d.ts +85 -0
  235. package/src/lib/server/media-strong-digest.js +190 -0
  236. package/src/lib/server/media-strong-digest.js.map +1 -0
  237. package/src/lib/server/media-tombstone.d.ts +276 -0
  238. package/src/lib/server/media-tombstone.js +421 -0
  239. package/src/lib/server/media-tombstone.js.map +1 -0
  240. package/src/lib/server/media-variants.d.ts +309 -0
  241. package/src/lib/server/media-variants.js +428 -0
  242. package/src/lib/server/media-variants.js.map +1 -0
  243. package/src/lib/server/member-email-aliases.d.ts +180 -0
  244. package/src/lib/server/member-email-aliases.js +420 -0
  245. package/src/lib/server/member-email-aliases.js.map +1 -0
  246. package/src/lib/server/member-photo.d.ts +88 -0
  247. package/src/lib/server/member-photo.js +185 -0
  248. package/src/lib/server/member-photo.js.map +1 -0
  249. package/src/lib/server/membership-recover-throttle.d.ts +211 -0
  250. package/src/lib/server/membership-recover-throttle.js +231 -0
  251. package/src/lib/server/membership-recover-throttle.js.map +1 -0
  252. package/src/lib/server/notifications.d.ts +55 -0
  253. package/src/lib/server/notifications.js +134 -0
  254. package/src/lib/server/notifications.js.map +1 -0
  255. package/src/lib/server/org-billing.d.ts +97 -0
  256. package/src/lib/server/org-billing.js +236 -0
  257. package/src/lib/server/org-billing.js.map +1 -0
  258. package/src/lib/server/organizations.d.ts +837 -0
  259. package/src/lib/server/organizations.js +1814 -0
  260. package/src/lib/server/organizations.js.map +1 -0
  261. package/src/lib/server/password-reset-throttle.d.ts +84 -0
  262. package/src/lib/server/password-reset-throttle.js +102 -0
  263. package/src/lib/server/password-reset-throttle.js.map +1 -0
  264. package/src/lib/server/personal-data-export.d.ts +241 -0
  265. package/src/lib/server/personal-data-export.js +858 -0
  266. package/src/lib/server/personal-data-export.js.map +1 -0
  267. package/src/lib/server/platform-domain-names.d.ts +62 -0
  268. package/src/lib/server/platform-domain-names.js +197 -0
  269. package/src/lib/server/platform-domain-names.js.map +1 -0
  270. package/src/lib/server/platform-marketing-consent.d.ts +133 -0
  271. package/src/lib/server/platform-marketing-consent.js +209 -0
  272. package/src/lib/server/platform-marketing-consent.js.map +1 -0
  273. package/src/lib/server/rate-limit-store.d.ts +702 -0
  274. package/src/lib/server/rate-limit-store.js +1220 -0
  275. package/src/lib/server/rate-limit-store.js.map +1 -0
  276. package/src/lib/server/realm-plugins.d.ts +67 -0
  277. package/src/lib/server/realm-plugins.js +250 -0
  278. package/src/lib/server/realm-plugins.js.map +1 -0
  279. package/src/lib/server/recaptcha-allowlist.d.ts +90 -0
  280. package/src/lib/server/recaptcha-allowlist.js +409 -0
  281. package/src/lib/server/recaptcha-allowlist.js.map +1 -0
  282. package/src/lib/server/release-flags.d.ts +105 -0
  283. package/src/lib/server/release-flags.js +183 -0
  284. package/src/lib/server/release-flags.js.map +1 -0
  285. package/src/lib/server/replay-erasures.d.ts +126 -0
  286. package/src/lib/server/replay-erasures.js +217 -0
  287. package/src/lib/server/replay-erasures.js.map +1 -0
  288. package/src/lib/server/resolve-people.d.ts +66 -0
  289. package/src/lib/server/resolve-people.js +112 -0
  290. package/src/lib/server/resolve-people.js.map +1 -0
  291. package/src/lib/server/safe-equal.d.ts +45 -0
  292. package/src/lib/server/safe-equal.js +58 -0
  293. package/src/lib/server/safe-equal.js.map +1 -0
  294. package/src/lib/server/sending-domain-debt.d.ts +127 -0
  295. package/src/lib/server/sending-domain-debt.js +268 -0
  296. package/src/lib/server/sending-domain-debt.js.map +1 -0
  297. package/src/lib/server/sending-domain-recheck.d.ts +151 -0
  298. package/src/lib/server/sending-domain-recheck.js +253 -0
  299. package/src/lib/server/sending-domain-recheck.js.map +1 -0
  300. package/src/lib/server/sending-domains.d.ts +364 -0
  301. package/src/lib/server/sending-domains.js +683 -0
  302. package/src/lib/server/sending-domains.js.map +1 -0
  303. package/src/lib/server/serve-media-cdn.d.ts +433 -0
  304. package/src/lib/server/serve-media-cdn.js +1370 -0
  305. package/src/lib/server/serve-media-cdn.js.map +1 -0
  306. package/src/lib/server/serve-plugin-fetch.d.ts +61 -0
  307. package/src/lib/server/serve-plugin-fetch.js +294 -0
  308. package/src/lib/server/serve-plugin-fetch.js.map +1 -0
  309. package/src/lib/server/sms-keywords.d.ts +63 -0
  310. package/src/lib/server/sms-keywords.js +146 -0
  311. package/src/lib/server/sms-keywords.js.map +1 -0
  312. package/src/lib/server/sso-break-glass-owners.d.ts +91 -0
  313. package/src/lib/server/sso-break-glass-owners.js +227 -0
  314. package/src/lib/server/sso-break-glass-owners.js.map +1 -0
  315. package/src/lib/server/sso-domain-policy.d.ts +140 -0
  316. package/src/lib/server/sso-domain-policy.js +239 -0
  317. package/src/lib/server/sso-domain-policy.js.map +1 -0
  318. package/src/lib/server/sso-drift-logic.d.ts +106 -0
  319. package/src/lib/server/sso-drift-logic.js +95 -0
  320. package/src/lib/server/sso-drift-logic.js.map +1 -0
  321. package/src/lib/server/sso-enforcement.d.ts +204 -0
  322. package/src/lib/server/sso-enforcement.js +309 -0
  323. package/src/lib/server/sso-enforcement.js.map +1 -0
  324. package/src/lib/server/sso-provisioning.d.ts +320 -0
  325. package/src/lib/server/sso-provisioning.js +715 -0
  326. package/src/lib/server/sso-provisioning.js.map +1 -0
  327. package/src/lib/server/staff-alert-email.d.ts +41 -0
  328. package/src/lib/server/staff-alert-email.js +63 -0
  329. package/src/lib/server/staff-alert-email.js.map +1 -0
  330. package/src/lib/server/stripe-account-mode.d.ts +156 -0
  331. package/src/lib/server/stripe-account-mode.js +162 -0
  332. package/src/lib/server/stripe-account-mode.js.map +1 -0
  333. package/src/lib/server/tenant-write-lockdown.d.ts +131 -0
  334. package/src/lib/server/tenant-write-lockdown.js +176 -0
  335. package/src/lib/server/tenant-write-lockdown.js.map +1 -0
  336. package/src/lib/server/test-firestore.d.ts +45 -0
  337. package/src/lib/server/test-firestore.js +124 -0
  338. package/src/lib/server/test-firestore.js.map +1 -0
  339. package/src/lib/server/token-revocation.d.ts +140 -0
  340. package/src/lib/server/token-revocation.js +255 -0
  341. package/src/lib/server/token-revocation.js.map +1 -0
  342. package/src/lib/server/update-existing.d.ts +32 -0
  343. package/src/lib/server/update-existing.js +73 -0
  344. package/src/lib/server/update-existing.js.map +1 -0
  345. package/src/lib/server/upload-cors-reconcile.d.ts +118 -0
  346. package/src/lib/server/upload-cors-reconcile.js +234 -0
  347. package/src/lib/server/upload-cors-reconcile.js.map +1 -0
  348. package/src/lib/server/upsert-contact.d.ts +262 -0
  349. package/src/lib/server/upsert-contact.js +546 -0
  350. package/src/lib/server/upsert-contact.js.map +1 -0
  351. package/src/lib/server/usage-invoice.d.ts +203 -0
  352. package/src/lib/server/usage-invoice.js +397 -0
  353. package/src/lib/server/usage-invoice.js.map +1 -0
  354. package/src/lib/server/user-profiles.d.ts +151 -0
  355. package/src/lib/server/user-profiles.js +364 -0
  356. package/src/lib/server/user-profiles.js.map +1 -0
  357. package/src/lib/server/vercel-drain-signature.d.ts +30 -0
  358. package/src/lib/server/vercel-drain-signature.js +61 -0
  359. package/src/lib/server/vercel-drain-signature.js.map +1 -0
  360. package/src/lib/server/vercel-log-drain.d.ts +259 -0
  361. package/src/lib/server/vercel-log-drain.js +479 -0
  362. package/src/lib/server/vercel-log-drain.js.map +1 -0
  363. package/src/lib/server/verify-email-cooldown.d.ts +102 -0
  364. package/src/lib/server/verify-email-cooldown.js +114 -0
  365. package/src/lib/server/verify-email-cooldown.js.map +1 -0
  366. package/src/lib/server/visitor-write-rate-limit.d.ts +87 -0
  367. package/src/lib/server/visitor-write-rate-limit.js +117 -0
  368. package/src/lib/server/visitor-write-rate-limit.js.map +1 -0
  369. package/src/lib/server/workspace-domains.d.ts +156 -0
  370. package/src/lib/server/workspace-domains.js +271 -0
  371. package/src/lib/server/workspace-domains.js.map +1 -0
  372. package/src/tenancy.d.ts +115 -0
  373. package/src/tenancy.js +142 -0
  374. package/src/tenancy.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/tenant/data/admin/src/lib/server/personal-data-export.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Personal-data export — access and portability, in a machine-readable form\n * (AGL-1974).\n *\n * Privacy Policy §7 grants portability (GDPR Art. 20) and nothing in the\n * product exported a person's or a workspace's personal data. Six surfaces\n * told customers to \"export first\" before deleting — the org settings Delete\n * tab, the Close account card, `erase-org-cli.mjs`, the staff org actions,\n * live DPA §11 and Terms §13.3 — all pointing at something that did not\n * exist. An access request was assembled by a staff member reading the console\n * by hand.\n *\n * ## THE PROPERTY THIS FILE EXISTS FOR\n *\n * **An export whose coverage differs from erasure's is a bug in one of them.**\n * Both answer the same question — *what do we hold about this subject* — and\n * the honest failure modes are symmetric: an export that misses a collection\n * under-discloses on an access request, and an erasure that misses the same\n * one leaves data behind after we said it was gone. Historically the second\n * kept happening (AGL-1444, AGL-1448, AGL-1970, AGL-1971 each found a\n * collection outside the cascade), which is exactly the evidence that a list\n * kept in one place and mirrored by hand in another will drift.\n *\n * The ideal is one enumeration both derive from. That is not available here:\n * `erase.ts` is under concurrent change and its sweep list is expressed as\n * code, not data. So the coverage is enumerated ONCE below, as data, and\n * `personal-data-export-coverage.spec.ts` DISCOVERS every collection\n * `erase.ts` touches out of its source and fails when the two disagree. A new\n * sweep added to the erasure turns this file red until somebody decides\n * whether the export discloses it — which is the decision that was being\n * skipped.\n *\n * That guard is worth more than the feature.\n *\n * ## What must NOT come out wholesale\n *\n * Three categories, and each is a way an access request becomes a breach:\n *\n * 1. **Another person's data.** A workspace is shared. A member asking what\n * we hold about THEM gets their own roster row, not the roster; their own\n * support messages, not the thread's other authors. Handled by exporting\n * the person and the workspace as different subjects with different\n * scopes, never by filtering a single blob after the fact.\n * 2. **Secrets.** An `apiKeys` row confirms that a credential exists — its\n * label, scopes, creator and dates, which are all facts about the subject\n * — and never re-discloses the credential. Note the document ID *is* the\n * SHA-256 of the token, so the id itself is withheld too; a hash handed\n * back is a verifier handed back.\n * 3. **Staff-only fields.** Internal notes, override reasons and moderation\n * state are about our handling, not about the person, and several name a\n * staff member.\n *\n * ## What it is NOT\n *\n * Not `GET /api/hosts/export` — that is a Pro+ site-design backup whose own\n * header says it never includes bookings, leads, submissions or secrets, and\n * offering it as a portability answer would be misdescribing it. Not the\n * `firestore-export` cron, which is an unscoped DR snapshot. Not the audit CSV.\n */\n\nimport { firebaseAdmin } from './firebase-admin'\nimport { CONSOLE_DOMAINS_COLLECTION } from './console-domains'\n\nconst firestoreApp = () => firebaseAdmin.app().firestore()\n\n/** Which subject an export source belongs to. */\nexport type ExportSubject = 'user' | 'org'\n\n/** How a source is located — the axis a path cascade is blind to. */\nexport type ExportKeying =\n /** Top-level collection carrying the subject id in a FIELD. */\n | 'field'\n /** Top-level collection whose DOCUMENT ID is the subject id. */\n | 'doc-id'\n /** Under the subject's own document path. */\n | 'path'\n /** Reached through another collection's rows (a collection group). */\n | 'collection-group'\n /** Outside Firestore entirely. */\n | 'external'\n\nexport interface ExportSourceSpec {\n /** Firestore collection name, or an `external:` pseudo-name. */\n collection: string\n keyedBy: ExportKeying\n subjects: readonly ExportSubject[]\n /**\n * `true` when the export discloses it. `false` requires `reason` — and the\n * reason is the whole value of the field: it is a decision recorded at the\n * moment it was made, not an omission discovered later.\n */\n exported: boolean\n /** Why it is withheld, or how it is disclosed. Always present. */\n note: string\n}\n\n/**\n * Every collection `erase.ts` touches, and what the export does with it.\n *\n * Kept in the SAME order as the erasure's steps so a reader comparing the two\n * files reads them in step. `personal-data-export-coverage.spec.ts` proves the\n * set matches; this list carries the decision for each one.\n */\nexport const PERSONAL_DATA_SOURCES: readonly ExportSourceSpec[] = [\n // ── The person ────────────────────────────────────────────────────────\n {\n collection: 'users',\n keyedBy: 'doc-id',\n subjects: ['user'],\n exported: true,\n note: 'Profile: name, phone, postal address, legalAcceptances, and every subcollection (orgs, hostMemberships, notifications, passkeys).',\n },\n {\n collection: 'profiles',\n keyedBy: 'doc-id',\n subjects: ['user'],\n exported: true,\n note: 'The world-readable handle, display name and Stripe Connect account. Not reachable from the user tree (AGL-1970) — the same blind spot on both sides.',\n },\n // ── The workspace ─────────────────────────────────────────────────────\n {\n collection: 'orgs',\n keyedBy: 'doc-id',\n subjects: ['org'],\n exported: true,\n note: 'The org document and every subcollection: members, invites, roles, usage, apiUsage, analytics, datasets/records, contacts, lists, media, installs, activity, assistExchanges, retention.',\n },\n {\n collection: 'hosts',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'Each site tree the org owns — screens, layouts, orders, form submissions. Secrets within are redacted, not omitted, so the export still says a webhook exists.',\n },\n {\n collection: 'hostIndex',\n keyedBy: 'doc-id',\n subjects: ['org'],\n exported: true,\n note: 'Subdomain/CNAME routing for each of the org’s sites. Configuration the customer set, so it is theirs to take.',\n },\n {\n collection: 'supplierDeliveries',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'The dropship outbox for each of the org’s sites, keyed by hostId (AGL-1448). Disclosed to the ORG and to no one else, and the reason is the unusual one: the personal data in the row is a SHOPPER’s — name, email and shipping address in the body we sign and POST to the supplier. That is the merchant’s own order record, which they already read in their console and for which they are the controller and we the processor, so an org access request is entitled to it. It is NOT a `user`-subject source: a console member asking what we hold about THEM is not the shopper, and returning these rows would answer their request with a third party’s address. Withholding it was not an option worth taking — `eraseHost` destroys these rows, so an export that omitted them would delete what it never disclosed.',\n },\n // ── Top-level, field-keyed: what a path cascade cannot see ────────────\n {\n collection: 'apiKeys',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'EXISTENCE ONLY — label, scopes, creating uid, dates. Never the credential, and never the document id, which is the SHA-256 of the token.',\n },\n {\n collection: 'outreachMailboxCredentials',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'EXISTENCE ONLY — which connected mailbox a credential authorizes, its provider, granted scopes and dates (AGL-2974), and since AGL-2978 the connected account’s address, its Google account id and the member who connected it: the organization’s own record of whose mailbox it holds. Every token is redacted by name and by shape (see redactSecrets) and never disclosed; the sealed refresh token and the id of the key that sealed it both carry `token` in their names. The document id is the mailbox id, not derived from any secret, so it is disclosed.',\n },\n {\n collection: 'ssoDomains',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'The public SSO routing document: domain, GCIP tenant and provider ids, IdP display name. `token` is redacted.',\n },\n {\n collection: CONSOLE_DOMAINS_COLLECTION,\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'Custom console domain claims the org holds.',\n },\n {\n collection: 'apiIdempotency',\n keyedBy: 'field',\n subjects: ['org'],\n exported: false,\n note: 'Replay keys. The document id is a SHA-256 of the org id and the caller’s Idempotency-Key, and the row names a record id and nothing about a person. Disclosed as a COUNT so the export does not silently omit a collection the erasure destroys.',\n },\n {\n collection: 'stripeCustomers',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'The local reverse index: which Stripe customer id belongs to this workspace. An identifier the customer already holds on their own invoices.',\n },\n {\n collection: 'orgSlugs',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'Every workspace name the org has ever held, rename tombstones included — naming history is a fact about them.',\n },\n {\n collection: 'publisherHandles',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'Marketplace handle reservations and rename tombstones (AGL-1970).',\n },\n {\n collection: 'publisherProfiles',\n keyedBy: 'doc-id',\n subjects: ['org'],\n exported: true,\n note: 'The public publisher identity — handle, display name, bio, website, avatar, publisher agreement. `stripeAccountId` is the org’s own payout destination and is disclosed; nothing here is a credential.',\n },\n {\n collection: 'marketplaceListings',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'Listings the org published. These deliberately OUTLIVE an erasure (AGL-1448 Tier 3) — which makes disclosing them on an access request more important, not less: they are the part that does not go away.',\n },\n {\n collection: 'supportTickets',\n keyedBy: 'field',\n subjects: ['org', 'user'],\n exported: true,\n note: 'For an ORG: every thread and its messages. For a PERSON: only the messages they themselves authored — a thread has other authors, and handing a member the whole conversation would disclose colleagues’ words to them.',\n },\n // ── Retained past erasure on statutory grounds ────────────────────────\n {\n collection: 'platformRevenue',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'Per-transaction tax filing records. GDPR Art. 17(3)(b) exempts them from ERASURE (AGL-1811); it does not exempt them from ACCESS. If a transaction of theirs is in there it is disclosable — and the export is the only place a customer can see what survived their erasure.',\n },\n {\n collection: 'storefrontTaxCollected',\n keyedBy: 'field',\n subjects: ['org'],\n exported: true,\n note: 'Sales tax charged to shoppers on the org’s storefront (AGL-1904). Same statutory retention, same access obligation.',\n },\n // ── Records of our own handling ───────────────────────────────────────\n {\n collection: 'adminAudit',\n keyedBy: 'field',\n subjects: ['org', 'user'],\n exported: false,\n note: 'STAFF-ONLY. Rows name the staff actor, carry override reasons and internal notes, and are the record of our handling rather than data about the subject. `/admin/audit` → Export CSV serves a request that specifically asks for them, after a staff read.',\n },\n]\n\n/** Sources this export deliberately withholds, with the reason. */\nexport const EXPORT_WITHHELD = PERSONAL_DATA_SOURCES.filter((s) => !s.exported)\n\n/** Collection names the export claims to cover, for the coverage guard. */\nexport const EXPORT_COVERED_COLLECTIONS: readonly string[] =\n PERSONAL_DATA_SOURCES.map((source) => source.collection)\n\n/**\n * ## WHY THIS IS SHAPE-DRIVEN AND NOT A LIST OF NAMES\n *\n * It used to be a list of names, anchored on separators:\n *\n * /(^|[._-])(secret|token|password|apikey|…)($|[._-])/i\n *\n * That pattern requires a `.`, `_`, `-`, or a string boundary on both sides\n * of the word, so it reads `password_hash` and `webhooks.secret` and misses\n * `supplierToken` and `passwordScrypt` — the exact two fields the AGL-1881\n * review found leaving the platform in a customer's own export file. One is\n * a live bearer credential a supplier authenticates with; the other is a\n * shopper's scrypt password hash. **A denylist of names is always one naming\n * convention behind, and camelCase is the proof.**\n *\n * So the name half is now tokenized rather than separator-anchored, and it is\n * no longer the only gate. Three run, in order, and any of them redacts:\n *\n * * **(A) The name, tokenized.** `supplierToken` splits to\n * `['supplier','token']` the same way `supplier_token` and\n * `SUPPLIER-TOKEN` do, so the convention stops mattering. A name matches\n * on a single secret word or on an adjacent pair (`client secret`).\n * * **(B) The VALUE's shape, whatever the key is called.** This is the half\n * that does not need to know the schema: a PEM block, a JWT, a vendor\n * prefix (`sk_live_`, `whsec_`, `ghp_`, `AKIA`…), a `$2b$`/`$argon2` hash,\n * this repo's own `salt:hash` scrypt form, or an opaque high-entropy\n * string is a credential whether the field is called `supplierToken`,\n * `t`, or `notes`. **Gate B is the \"redact unless known safe\" default**:\n * a credential-shaped string is withheld unless its key names it as a\n * content identifier (see {@link SAFE_VALUE_WORDS}).\n * * **(C) Credentials carried inside a URL.** `?token=`, `?sig=`,\n * `?key=`, and `https://user:pass@host` are stripped from the URL rather\n * than the URL being blanked, because a media object's `url` field really\n * does carry a live Firebase download token in a query parameter, and the\n * location of the customer's own file is exactly what an access request\n * asks for. Precision beats blanking here.\n *\n * ### Why the KEY half is still deny-based, when the value half is not\n *\n * A true allowlist of field names is not available on this data. The export\n * walks documents whose field names our customers author — canvas nodes,\n * dataset records, custom metadata, form submissions — so an allowlist of\n * names would blank most of the file and turn an access request into a\n * non-answer, which is the under-disclosure this feature exists to stop. The\n * allowlist therefore lives where the vocabulary IS ours: value shapes. An\n * unrecognized VALUE shape is passed through (it is prose, a number, a date,\n * a customer's own content); an unrecognized value shape that looks like a\n * credential is withheld. That is the inversion the review asked for, put\n * where it can hold.\n *\n * ### The one deliberate carve-out\n *\n * `token`/`tokens` is also a metering word — `tokensUsed: 14203` on an\n * assist exchange is a usage count, and blanking it would blank a real\n * disclosure. A credential is a STRING; a count is a number. So a numeric or\n * boolean value under a name that matched only on a metering word passes\n * through. Nothing else in the vocabulary gets that treatment.\n *\n * A false positive costs a redacted field in an export. A false negative\n * costs a credential. Everything below is tuned in that direction.\n */\n\n/**\n * Split a field name into lowercase word tokens, convention-independently.\n *\n * `supplierToken`, `supplier_token`, `SUPPLIER-TOKEN` and `Supplier.Token`\n * all become `['supplier','token']`. Acronym runs split at the last capital\n * (`SSOTokenId` → `['sso','token','id']`) and digits break a word\n * (`apiKey2` → `['api','key','2']`), so a numbered field cannot hide.\n */\nexport function fieldNameTokens(key: unknown): string[] {\n return String(key ?? '')\n .replace(/[^A-Za-z0-9]+/g, ' ')\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/([A-Za-z])([0-9])/g, '$1 $2')\n .toLowerCase()\n .split(' ')\n .filter(Boolean)\n}\n\n/**\n * Words that make a field a credential on their own.\n *\n * Deliberately short. Every entry here is a word that has no innocent\n * meaning on a stored VALUE — `hmac`, `scrypt` and `bcrypt` name the\n * algorithm that produced a verifier, `passphrase` and `credential` name the\n * thing itself. `key` is NOT here and must never be: `publicKey` on a\n * passkey and `sortKey` on a dataset are not secrets, which is what\n * {@link SECRET_WORD_PAIRS} is for.\n */\nconst SECRET_WORDS = new Set([\n 'secret',\n 'secrets',\n 'password',\n 'passwords',\n 'passwd',\n 'pwd',\n 'passphrase',\n 'token',\n 'tokens',\n 'credential',\n 'credentials',\n 'apikey',\n 'privatekey',\n 'scrypt',\n 'bcrypt',\n 'argon',\n 'argon2',\n 'pbkdf2',\n 'hmac',\n 'otp',\n 'totp',\n 'authorization',\n])\n\n/**\n * Words that are a credential only next to another word.\n *\n * `key` is meaningless alone and decisive after `api`, `private`, `signing`,\n * `secret`, `session` or `encryption`; `token` after `access`/`refresh` is\n * already caught by {@link SECRET_WORDS} and listed here anyway so the pair\n * table reads as the complete statement of the rule.\n */\nconst SECRET_WORD_PAIRS = new Set([\n 'api key',\n 'private key',\n 'signing key',\n 'secret key',\n 'session key',\n 'encryption key',\n 'client secret',\n 'access token',\n 'refresh token',\n 'webhook secret',\n 'shared secret',\n // A Stripe payment link is a live bearer URL: whoever holds it can pay.\n // Named in the AGL-1443 inventory of what the old dump actually carried.\n 'payment link',\n 'auth code',\n 'recovery code',\n 'backup code',\n])\n\n/**\n * The metering carve-out — see the header. A name that matched ONLY on one\n * of these, over a number or a boolean, is a count and is disclosed.\n */\nconst METERING_WORDS = new Set(['token', 'tokens'])\n\n/**\n * Key words that mark a high-entropy value as a content identifier rather\n * than a credential, defusing gate (B) only.\n *\n * A SHA-256 has exactly the shape of a 64-character secret and is not one.\n * Gate (A) is never defused by this list: `apiKeyId` is redacted, because\n * the name says credential and an id of a credential is not worth the\n * argument.\n */\nconst SAFE_VALUE_WORDS = new Set([\n // A passkey's `publicKey` is public by definition and has exactly the shape\n // of a secret. Safe to list because gate (A) is never defused here — a\n // `publicToken` is still redacted, on the strength of `token`.\n 'public',\n 'id',\n 'ids',\n 'uid',\n 'uuid',\n 'guid',\n 'hash',\n 'hashes',\n 'sha',\n 'sha1',\n 'sha256',\n 'sha512',\n 'md5',\n 'crc',\n 'crc32c',\n 'etag',\n 'checksum',\n 'digest',\n 'fingerprint',\n 'generation',\n 'version',\n 'revision',\n 'slug',\n 'path',\n 'url',\n 'uri',\n 'href',\n 'src',\n 'color',\n 'colour',\n 'hex',\n])\n\n/** Vendor credential prefixes — unambiguous, and worth naming explicitly. */\nconst CREDENTIAL_PREFIXES = [\n 'sk_live_',\n 'sk_test_',\n 'rk_live_',\n 'rk_test_',\n 'whsec_',\n 'ghp_',\n 'gho_',\n 'ghu_',\n 'ghs_',\n 'ghr_',\n 'github_pat_',\n 'xoxb-',\n 'xoxp-',\n 'xapp-',\n 'xoxa-',\n 'AKIA',\n 'ASIA',\n 'AIza',\n 'ya29.',\n 'SG.',\n 're_',\n 'shpat_',\n 'shpss_',\n 'npm_',\n 'glpat-',\n 'sq0csp-',\n 'sq0atp-',\n]\n\n/** A PEM block that carries a private key or a certificate request. */\nconst PEM_PATTERN = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/\n\n/** Modular crypt format: bcrypt, argon2, scrypt, PBKDF2, sha512-crypt. */\nconst CRYPT_HASH_PATTERN = /^\\$(2[abxy]?|argon2[a-z]*|scrypt|pbkdf2[^$]*|[56])\\$/\n\n/** This repo's own scrypt storage form: `{16+ hex salt}:{32+ hex hash}`. */\nconst SALTED_HASH_PATTERN = /^[0-9a-f]{16,}:[0-9a-f]{32,}$/i\n\n/** A JSON Web Token — three base64url segments. */\nconst JWT_PATTERN = /^[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]{8,}$/\n\n/** A UUID, which is an identifier far more often than it is a credential. */\nconst UUID_PATTERN =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\n\n/** Charset of an opaque credential: base64, base64url or hex, nothing else. */\nconst OPAQUE_CHARSET = /^[A-Za-z0-9_+/=-]+$/\n\n/**\n * The window an opaque secret lives in.\n *\n * Below 32 characters the false-positive rate against ordinary identifiers is\n * not worth it and the value is too short to be a modern credential anyway.\n * Above 512 it is customer CONTENT — a base64 image, a compressed canvas\n * blob, an encoded document — and blanking those is the \"gutting the export\"\n * failure this file is explicitly trying not to commit.\n */\nconst OPAQUE_MIN_LENGTH = 32\nconst OPAQUE_MAX_LENGTH = 512\n\n/** Shannon entropy per character. Prose and slugs sit well below this. */\nconst OPAQUE_MIN_ENTROPY = 3.2\n\nfunction shannonEntropyPerChar(text: string): number {\n const counts = new Map<string, number>()\n for (const character of text) {\n counts.set(character, (counts.get(character) ?? 0) + 1)\n }\n let entropy = 0\n for (const count of counts.values()) {\n const p = count / text.length\n entropy -= p * Math.log2(p)\n }\n return entropy\n}\n\n/**\n * Does this STRING look like a credential, ignoring what it is called?\n *\n * Exported because the guard spec asserts each limb independently — a shape\n * detector tested only through the redactor is a detector whose gaps are\n * invisible.\n */\nexport function looksLikeCredential(value: string): boolean {\n const text = value.trim()\n if (!text) return false\n if (PEM_PATTERN.test(text)) return true\n if (CRYPT_HASH_PATTERN.test(text)) return true\n if (SALTED_HASH_PATTERN.test(text)) return true\n if (CREDENTIAL_PREFIXES.some((prefix) => text.startsWith(prefix))) return true\n if (JWT_PATTERN.test(text)) return true\n // Anything with whitespace is prose, and `data:` is an inline asset. Both\n // are customer content, and neither is a bearer credential.\n if (/\\s/.test(text)) return false\n if (/^data:/i.test(text)) return false\n if (UUID_PATTERN.test(text)) return false\n if (text.length < OPAQUE_MIN_LENGTH || text.length > OPAQUE_MAX_LENGTH) {\n return false\n }\n if (!OPAQUE_CHARSET.test(text)) return false\n return shannonEntropyPerChar(text) >= OPAQUE_MIN_ENTROPY\n}\n\n/** What a stripped URL parameter reads as, so the removal is visible. */\nexport const REDACTED_URL_PARAM = 'REDACTED'\n\n/** Query parameters that carry a bearer credential inside a URL. */\nconst URL_CREDENTIAL_PARAMS = new Set([\n 'token',\n 'access_token',\n 'accesstoken',\n 'id_token',\n 'refresh_token',\n 'auth',\n 'authorization',\n 'apikey',\n 'api_key',\n 'key',\n 'sig',\n 'signature',\n 'secret',\n 'password',\n 'downloadtoken',\n])\n\n/**\n * Strip the credential out of a URL, keeping the URL.\n *\n * A media object's `url` is `…/o/{path}?alt=media&token={uuid}` — a live,\n * unauthenticated download credential, in a field an access request has a\n * real interest in. Blanking the whole value would tell the customer nothing\n * about where their own file is; keeping it whole hands out the credential.\n * So the parameter is replaced and the rest survives. `user:pass@` userinfo\n * goes the same way.\n *\n * Returns the input unchanged when it is not a URL — every non-URL string\n * has already been decided by the shape gate.\n */\nexport function scrubUrlCredentials(value: string): string {\n if (!/^https?:\\/\\//i.test(value)) return value\n let url: URL\n try {\n url = new URL(value)\n } catch {\n return value\n }\n let changed = false\n if (url.username || url.password) {\n url.username = ''\n url.password = ''\n changed = true\n }\n for (const name of Array.from(url.searchParams.keys())) {\n if (!URL_CREDENTIAL_PARAMS.has(name.toLowerCase())) continue\n if (!url.searchParams.get(name)) continue\n url.searchParams.set(name, REDACTED_URL_PARAM)\n changed = true\n }\n return changed ? url.toString() : value\n}\n\n/**\n * Gate (A): does the NAME say credential?\n *\n * `value` is consulted only for the metering carve-out described in the\n * header — a `tokensUsed: 14203` is a count, not a credential.\n */\nexport function secretByName(key: unknown, value?: unknown): boolean {\n const tokens = fieldNameTokens(key)\n if (!tokens.length) return false\n const hits = tokens.filter((token) => SECRET_WORDS.has(token))\n for (let index = 0; index + 1 < tokens.length; index += 1) {\n if (SECRET_WORD_PAIRS.has(`${tokens[index]} ${tokens[index + 1]}`)) {\n return true\n }\n }\n if (!hits.length) return false\n // Matched only on a metering word, over a number or a boolean: a count.\n const metering = hits.every((token) => METERING_WORDS.has(token))\n if (metering && (typeof value === 'number' || typeof value === 'boolean')) {\n return false\n }\n return true\n}\n\n/** Gate (B)'s defuser: does the NAME say this high-entropy value is an id? */\nfunction nameMarksContentIdentifier(key: unknown): boolean {\n return fieldNameTokens(key).some((token) => SAFE_VALUE_WORDS.has(token))\n}\n\n/** What a redacted value is replaced with — presence, never content. */\nexport interface RedactedValue {\n redacted: true\n /** Whether a value was actually there, so absence is distinguishable. */\n present: boolean\n reason: 'secret'\n}\n\nconst redactedMarker = (present: boolean): RedactedValue => ({\n redacted: true,\n present,\n reason: 'secret',\n})\n\n/**\n * Deep-copy a document, replacing every credential-shaped value with a\n * presence marker.\n *\n * Presence rather than deletion, because \"we hold a webhook secret for you\"\n * is itself a true and disclosable fact, and a silently-absent key would make\n * the export look like it holds less than it does — the under-disclosure this\n * feature exists to stop, reintroduced by the safety measure.\n *\n * Firestore values that are not plain JSON (Timestamp, GeoPoint, DocumentRef,\n * Buffer) are stringified rather than walked: they carry no nested keys to\n * redact, and `JSON.stringify` on a Timestamp yields `{_seconds,_nanoseconds}`,\n * which is not a date to a human reading the file.\n *\n * Three gates, any of which redacts — the name (A), the value's shape (B),\n * and a credential embedded in a URL (C). See the header above\n * {@link fieldNameTokens} for why the value half is the one that carries the\n * \"withhold unless known safe\" default.\n */\nexport function redactSecrets(value: unknown, key = ''): unknown {\n // (A) The name, tokenized — convention-independent.\n if (key && secretByName(key, value)) {\n return redactedMarker(value !== undefined && value !== null && value !== '')\n }\n if (value === null || value === undefined) return value ?? null\n if (typeof value === 'string') {\n // (C) A URL that carries its credential in a parameter keeps the URL and\n // loses the credential — see {@link scrubUrlCredentials}.\n const scrubbed = scrubUrlCredentials(value)\n if (scrubbed !== value) return scrubbed\n // (B) The shape, whatever the field is called. Withheld unless the name\n // marks it as a content identifier.\n if (looksLikeCredential(value) && !nameMarksContentIdentifier(key)) {\n return redactedMarker(true)\n }\n return value\n }\n if (Array.isArray(value)) return value.map((entry) => redactSecrets(entry, key))\n if (typeof value === 'object') {\n const source = value as Record<string, unknown>\n // Firestore Timestamp — the only non-plain value common enough to be\n // worth rendering rather than dumping.\n if (typeof (source as any).toDate === 'function') {\n try {\n return (source as any).toDate().toISOString()\n } catch {\n return String(value)\n }\n }\n if (typeof (source as any).toBase64 === 'function') return '[binary]'\n const out: Record<string, unknown> = {}\n for (const [childKey, childValue] of Object.entries(source)) {\n out[childKey] = redactSecrets(childValue, childKey)\n }\n return out\n }\n return value\n}\n\nexport interface ExportedDocument {\n /** Document id — omitted where the id is itself a secret (see `apiKeys`). */\n id?: string\n path?: string\n data: unknown\n}\n\nexport interface PersonalDataExport {\n subject: { type: ExportSubject; id: string }\n generatedAt: string\n /**\n * The disclosure decision for every source, copied into the file the\n * customer receives. An export that silently omits a collection is\n * indistinguishable from one that has nothing to report; this makes the two\n * different, and it is what a supervisory authority would ask to see.\n */\n coverage: readonly ExportSourceSpec[]\n /** Collection name → the documents disclosed for it. */\n data: Record<string, ExportedDocument[]>\n /** Collection name → row count, for sources disclosed as a count only. */\n counts: Record<string, number>\n /** Places we hold data that is not in Firestore. */\n elsewhere: readonly string[]\n}\n\n/** Data we hold outside Firestore — named, because a file that omits them reads as complete. */\nconst ELSEWHERE = [\n 'Stripe — customer object, payment methods, invoices. Request from Stripe or ask us.',\n 'Resend — transactional email delivery logs.',\n 'Google Analytics — 14-month retention, not keyed to an account.',\n 'Cloud Storage — uploaded media and avatars, under users/{uid}/, orgs/{orgId}/ and hosts/{hostId}/. Listed by path in this file; the bytes are served by their own URLs.',\n]\n\nfunction sourcesFor(subject: ExportSubject): ExportSourceSpec[] {\n return PERSONAL_DATA_SOURCES.filter((source) => source.subjects.includes(subject))\n}\n\n/** Read a top-level collection bounded by a field equal to the subject id. */\nasync function readByField(\n db: any,\n collection: string,\n field: string,\n id: string,\n options: { includeIds?: boolean } = {},\n): Promise<ExportedDocument[]> {\n const rows = await db.collection(collection).where(field, '==', id).get()\n return rows.docs.map((doc: any) => ({\n // `apiKeys` document ids are the SHA-256 of the token: an id handed back\n // is a verifier handed back, so the caller opts in rather than out.\n ...(options.includeIds === false ? {} : { id: doc.id }),\n data: redactSecrets(doc.data()),\n }))\n}\n\n/** Read one document by id, or nothing when it does not exist. */\nasync function readDoc(\n db: any,\n collection: string,\n id: string,\n): Promise<ExportedDocument[]> {\n const snapshot = await db.collection(collection).doc(id).get()\n if (!snapshot.exists) return []\n return [{ id, data: redactSecrets(snapshot.data()) }]\n}\n\n/**\n * Walk a document and everything beneath it.\n *\n * `listCollections()` rather than a hard-coded subcollection list, for the\n * same reason the erasure uses `recursiveDelete`: a subcollection added next\n * quarter is reached without anybody remembering this file exists. Bounded by\n * `maxDepth` because the tree is customer-shaped and an unbounded recursion\n * inside a request is how AGL-1455 lost erasures to a 60-second timeout.\n */\nasync function readSubtree(\n db: any,\n ref: any,\n depth = 0,\n maxDepth = 4,\n): Promise<ExportedDocument[]> {\n const snapshot = await ref.get()\n const found: ExportedDocument[] = []\n if (snapshot.exists) {\n found.push({ path: ref.path, data: redactSecrets(snapshot.data()) })\n }\n if (depth >= maxDepth) return found\n const children = (await ref.listCollections?.()) ?? []\n for (const child of children) {\n const rows = await child.get()\n for (const doc of rows.docs) {\n found.push(...(await readSubtree(db, doc.ref, depth + 1, maxDepth)))\n }\n }\n return found\n}\n\nexport interface ExportOptions {\n /** Injectable for tests; defaults to the admin app's Firestore. */\n firestore?: any\n /** Stops a pathological workspace from building an unbounded file. */\n maxDepth?: number\n}\n\n/**\n * Everything we hold about a PERSON, as the person themselves may ask for it\n * (GDPR Art. 15 and Art. 20).\n *\n * Scoped to them, never to the workspaces they belong to. Their membership row\n * in each org is theirs; the roster around it is their colleagues'. An org\n * export is a separate call with a separate authorization, which is the whole\n * reason the two are different functions rather than one with a flag.\n */\nexport async function exportUserData(\n uid: string,\n options: ExportOptions = {},\n): Promise<PersonalDataExport> {\n const db = options.firestore ?? firestoreApp()\n const data: Record<string, ExportedDocument[]> = {}\n const counts: Record<string, number> = {}\n\n // The profile tree — `users/{uid}` and every subcollection under it.\n data['users'] = await readSubtree(\n db,\n db.collection('users').doc(uid),\n 0,\n options.maxDepth ?? 4,\n )\n\n // The public identity, which the user tree does not reach (AGL-1970).\n data['profiles'] = await readDoc(db, 'profiles', uid)\n\n // ONLY the messages this person wrote. The threads belong to a workspace\n // and carry other people's words; handing a member the whole conversation\n // to answer their own access request is a disclosure nobody consented to.\n const messages = await db\n .collectionGroup('messages')\n .where('authorId', '==', uid)\n .get()\n .catch(() => ({ docs: [] as any[] }))\n data['supportTickets'] = messages.docs.map((doc: any) => ({\n path: doc.ref.path,\n data: redactSecrets(doc.data()),\n }))\n\n return {\n subject: { type: 'user', id: uid },\n generatedAt: new Date().toISOString(),\n coverage: sourcesFor('user'),\n data,\n counts,\n elsewhere: ELSEWHERE,\n }\n}\n\n/**\n * Everything we hold about a WORKSPACE, for its owner (Art. 15 for the\n * personal data in it, and the \"export before you delete\" the Delete tab,\n * DPA §11 and Terms §13.3 have been promising).\n *\n * Every top-level collection the erasure sweeps by `orgId` is read here by the\n * same bound, so the two see the same rows. Where a source is withheld, its\n * COUNT is still reported: a collection that appears in neither the data nor\n * the counts is indistinguishable from one that does not exist, and that\n * ambiguity is what makes an incomplete export undetectable.\n */\nexport async function exportOrgData(\n orgId: string,\n options: ExportOptions = {},\n): Promise<PersonalDataExport> {\n const db = options.firestore ?? firestoreApp()\n const data: Record<string, ExportedDocument[]> = {}\n const counts: Record<string, number> = {}\n\n data['orgs'] = await readSubtree(\n db,\n db.collection('orgs').doc(orgId),\n 0,\n options.maxDepth ?? 4,\n )\n\n // Sites: the routing entry and the whole tree for each.\n const hosts = await db.collection('hosts').where('orgId', '==', orgId).get()\n const hostDocs: ExportedDocument[] = []\n const routing: ExportedDocument[] = []\n const outbox: ExportedDocument[] = []\n for (const host of hosts.docs) {\n hostDocs.push(...(await readSubtree(db, host.ref, 0, options.maxDepth ?? 4)))\n routing.push(...(await readDoc(db, 'hostIndex', host.id)))\n // Keyed by `hostId`, not `orgId`, so it is read here rather than in the\n // field-keyed loop below — the same bound `eraseHostSupplierDeliveries`\n // sweeps by, so the export and the erasure see the same rows.\n outbox.push(...(await readByField(db, 'supplierDeliveries', 'hostId', host.id)))\n }\n data['hosts'] = hostDocs\n data['hostIndex'] = routing\n data['supplierDeliveries'] = outbox\n\n // The field-keyed collections a path cascade is blind to — the ones the\n // erasure had to grow a sweep for, one issue at a time.\n for (const collection of [\n 'ssoDomains',\n CONSOLE_DOMAINS_COLLECTION,\n 'stripeCustomers',\n 'orgSlugs',\n 'publisherHandles',\n 'platformRevenue',\n 'storefrontTaxCollected',\n ]) {\n data[collection] = await readByField(db, collection, 'orgId', orgId)\n }\n\n // Existence, never the credential — and not the id either, which is the\n // token's SHA-256.\n data['apiKeys'] = await readByField(db, 'apiKeys', 'orgId', orgId, {\n includeIds: false,\n })\n\n // Which mailboxes the reps connected, never the grant behind one: the\n // tokens are withheld by `redactSecrets` like every other read here. The id\n // is the mailbox's own, so unlike `apiKeys` it stays.\n data['outreachMailboxCredentials'] = await readByField(\n db,\n 'outreachMailboxCredentials',\n 'orgId',\n orgId,\n )\n\n data['publisherProfiles'] = await readDoc(db, 'publisherProfiles', orgId)\n data['marketplaceListings'] = await readByField(\n db,\n 'marketplaceListings',\n 'profileId',\n orgId,\n )\n\n // Support threads WITH their messages — for an org the whole thread is the\n // org's own record, unlike the person-scoped export above.\n const tickets = await db\n .collection('supportTickets')\n .where('orgId', '==', orgId)\n .get()\n const ticketDocs: ExportedDocument[] = []\n for (const ticket of tickets.docs) {\n ticketDocs.push(...(await readSubtree(db, ticket.ref, 0, 2)))\n }\n data['supportTickets'] = ticketDocs\n\n // Withheld, but counted — see the note on this function.\n const replayKeys = await db\n .collection('apiIdempotency')\n .where('orgId', '==', orgId)\n .get()\n counts['apiIdempotency'] = replayKeys.docs.length\n\n return {\n subject: { type: 'org', id: orgId },\n generatedAt: new Date().toISOString(),\n coverage: sourcesFor('org'),\n data,\n counts,\n elsewhere: ELSEWHERE,\n }\n}\n\n/** A filename a human can file: subject, id and the date it was produced. */\nexport function exportFilename(exported: PersonalDataExport): string {\n const day = exported.generatedAt.slice(0, 10)\n return `aglyn-${exported.subject.type}-data-${exported.subject.id}-${day}.json`\n}\n\nexport default exportUserData\n"],"names":["firebaseAdmin","CONSOLE_DOMAINS_COLLECTION","firestoreApp","app","firestore","PERSONAL_DATA_SOURCES","collection","keyedBy","subjects","exported","note","EXPORT_WITHHELD","filter","s","EXPORT_COVERED_COLLECTIONS","map","source","fieldNameTokens","key","String","replace","toLowerCase","split","Boolean","SECRET_WORDS","Set","SECRET_WORD_PAIRS","METERING_WORDS","SAFE_VALUE_WORDS","CREDENTIAL_PREFIXES","PEM_PATTERN","CRYPT_HASH_PATTERN","SALTED_HASH_PATTERN","JWT_PATTERN","UUID_PATTERN","OPAQUE_CHARSET","OPAQUE_MIN_LENGTH","OPAQUE_MAX_LENGTH","OPAQUE_MIN_ENTROPY","shannonEntropyPerChar","text","counts","Map","character","set","get","entropy","count","values","p","length","Math","log2","looksLikeCredential","value","trim","test","some","prefix","startsWith","REDACTED_URL_PARAM","URL_CREDENTIAL_PARAMS","scrubUrlCredentials","url","URL","changed","username","password","name","Array","from","searchParams","keys","has","toString","secretByName","tokens","hits","token","index","metering","every","nameMarksContentIdentifier","redactedMarker","present","redacted","reason","redactSecrets","undefined","scrubbed","isArray","entry","toDate","toISOString","toBase64","out","childKey","childValue","Object","entries","ELSEWHERE","sourcesFor","subject","includes","readByField","db","field","id","options","rows","where","docs","doc","includeIds","data","readDoc","snapshot","exists","readSubtree","ref","depth","maxDepth","found","push","path","children","listCollections","child","exportUserData","uid","messages","collectionGroup","catch","type","generatedAt","Date","coverage","elsewhere","exportOrgData","orgId","hosts","hostDocs","routing","outbox","host","tickets","ticketDocs","ticket","replayKeys","exportFilename","day","slice"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DC,GAED,SAASA,aAAa,QAAQ,sBAAkB;AAChD,SAASC,0BAA0B,QAAQ,uBAAmB;AAE9D,MAAMC,eAAe,IAAMF,cAAcG,GAAG,GAAGC,SAAS;AAiCxD;;;;;;CAMC,GACD,OAAO,MAAMC,wBAAqD;IAChE,yEAAyE;IACzE;QACEC,YAAY;QACZC,SAAS;QACTC,UAAU;YAAC;SAAO;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EAAE5H,SAAS6F,OAAO,CAACK,EAAE,CAAC,CAAC,EAAE2C,IAAI,KAAK,CAAC;AACjF;AAEA,eAAetB,eAAc"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { DomainCheck } from './sso-provisioning';
18
+ /** Hostname shape: dash-free at label edges, a real TLD, at least two labels. */
19
+ export declare const PLATFORM_DOMAIN_PATTERN: RegExp;
20
+ /** RFC 1035: a fully-qualified name is at most 253 octets. */
21
+ export declare const MAX_DOMAIN_LENGTH = 253;
22
+ /** Reserved as the name itself AND as any subdomain of it. See the header. */
23
+ export declare const RESERVED_DOMAIN_SUFFIXES: readonly string[];
24
+ /** Reserved as a WHOLE name only — `acme.co.uk` stays claimable. */
25
+ export declare const BARE_PUBLIC_SUFFIXES: ReadonlySet<string>;
26
+ /**
27
+ * Trim, lowercase, drop a trailing root dot, and tolerate a pasted URL.
28
+ *
29
+ * People paste `https://console.acme.com/` into a domain field constantly, and
30
+ * refusing that is a support ticket rather than a security control — the value
31
+ * is re-validated against the shape below either way.
32
+ */
33
+ export declare function normalizePlatformDomain(input: string): string;
34
+ /**
35
+ * Whether a normalised name belongs to the platform rather than a customer.
36
+ *
37
+ * `TENANT_APEX` is consulted at call time rather than baked into the list
38
+ * above, and that is the load-bearing half rather than a nicety. The static
39
+ * entries name *our* production zones; the correspondence this file exists to
40
+ * protect is a property of **whichever apex this deployment attaches
41
+ * `{subdomain}.{apex}` redirects to**, which a self-host operator sets with
42
+ * `NEXT_PUBLIC_TENANT_DOMAIN`. A blocklist that only knew `aglyn.app` would
43
+ * leave every self-host install with the hole we are closing here.
44
+ */
45
+ export declare function isPlatformReservedDomain(domain: string): boolean;
46
+ /**
47
+ * Shape, length and reserved-name check for a customer-supplied hostname.
48
+ *
49
+ * `{ domain, error }` with both keys always present rather than a discriminated
50
+ * union, matching `validateSsoDomain` — `strictNullChecks` is off repo-wide and
51
+ * an `{ ok: true } | { ok: false }` union does not narrow reliably once it
52
+ * crosses a library boundary.
53
+ *
54
+ * `copy` is a parameter rather than a constant because the console and site
55
+ * wizards are different products to the customer standing in front of them,
56
+ * and these two strings are the ones a customer reads and acts on. The RULES
57
+ * are shared; only the wording is not.
58
+ */
59
+ export declare function validatePlatformDomain(input: string, copy: {
60
+ invalid: string;
61
+ reserved: string;
62
+ }): DomainCheck;
@@ -0,0 +1,197 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * Which hostnames a customer may claim, and which are the platform's own.
18
+ *
19
+ * ## Why this file exists (AGL-1430)
20
+ *
21
+ * Both domain surfaces — `consoleDomains` (white-label console, AGL-1353) and
22
+ * `hosts.cname` (site custom domain, AGL-166/743) — attach customer names to a
23
+ * Vercel project whose add-domain call **tolerates `domain_already_in_use`**.
24
+ * That tolerance is only safe while the Firestore claim indexes *every* name
25
+ * the platform holds on that project. A name that reaches Vercel without a
26
+ * claim can be claimed by a second org, which reads the tolerated 409 as
27
+ * health and has its visitors redirected to a stranger's site.
28
+ *
29
+ * `console-domains.ts` reasoned this through and built the blocklist. The site
30
+ * path never got one, and it was the path with the live hole: AGL-1273 attaches
31
+ * `{subdomain}.{TENANT_APEX}` to the tenant project as a 307 redirect on every
32
+ * custom-domain connect, and nothing indexes that name as anybody's `cname`.
33
+ * Org B could claim org A's `alice.aglyn.app`, watch `projectDomainStatus`
34
+ * truthfully answer `serving` — the name really is on our project — and end up
35
+ * with its own `{sub}.aglyn.app` 307ing to org A's site.
36
+ *
37
+ * So the lists live here, once, and both surfaces read them. A name added to
38
+ * one blocklist is added to both, which is the property that was missing.
39
+ *
40
+ * ## The two ways a name is reserved
41
+ *
42
+ * **Suffix-reserved** (`RESERVED_DOMAIN_SUFFIXES`) — blocked as the name itself
43
+ * *and as any subdomain of it*. Two families:
44
+ *
45
+ * - **Ours.** `aglyn.com`, `aglyn.io`, `aglyn.app`, `aglyn.dev`. Keying on the
46
+ * registrable domain covers every entry of `PRODUCTION_DOMAINS` in
47
+ * `security-origins.js` without duplicating that list, and keeps covering
48
+ * names added to it later. `console-domains.spec.ts` walks the real file and
49
+ * asserts exactly that.
50
+ * - **Shared app-hosting suffixes.** Nobody controls the zone at
51
+ * `something.vercel.app` in the sense these features need — AGL-1353 measured
52
+ * `aglyn-console-aglyn.vercel.app` already serving a real console. Proving
53
+ * control of a name a platform hands out for free proves something that can
54
+ * be re-handed to someone else.
55
+ *
56
+ * **Bare-suffix-reserved** (`BARE_PUBLIC_SUFFIXES`) — blocked as a *whole name
57
+ * only*. `acme.co.uk` is a perfectly good customer domain; `co.uk` is not a
58
+ * domain at all. A short list rather than the Public Suffix List on purpose:
59
+ * pulling in a PSL dependency to reject a name no registrar would sell is not a
60
+ * trade worth making, and the single-label rule catches the commoner `com` case
61
+ * for free.
62
+ */ import { TENANT_APEX } from "@aglyn/aglyn/server";
63
+ const LABEL = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?';
64
+ /** Hostname shape: dash-free at label edges, a real TLD, at least two labels. */ export const PLATFORM_DOMAIN_PATTERN = new RegExp(`^${LABEL}(?:\\.${LABEL})*\\.[a-z]{2,63}$`);
65
+ /** RFC 1035: a fully-qualified name is at most 253 octets. */ export const MAX_DOMAIN_LENGTH = 253;
66
+ /** Reserved as the name itself AND as any subdomain of it. See the header. */ export const RESERVED_DOMAIN_SUFFIXES = [
67
+ 'aglyn.com',
68
+ 'aglyn.io',
69
+ 'aglyn.app',
70
+ 'aglyn.dev',
71
+ 'vercel.app',
72
+ 'vercel.sh',
73
+ 'web.app',
74
+ 'firebaseapp.com',
75
+ 'appspot.com',
76
+ 'cloudfunctions.net',
77
+ 'run.app',
78
+ 'pages.dev',
79
+ 'workers.dev',
80
+ 'netlify.app',
81
+ 'github.io',
82
+ 'herokuapp.com',
83
+ 'azurewebsites.net',
84
+ 'amplifyapp.com',
85
+ 'onrender.com',
86
+ 'fly.dev',
87
+ 'ngrok.io',
88
+ 'ngrok-free.app',
89
+ 'trycloudflare.com',
90
+ // RFC 2606 / 6761 special-use names, plus the ones a misconfigured resolver
91
+ // answers for. None of these can be proved by a public TXT lookup.
92
+ 'localhost',
93
+ 'local',
94
+ 'localdomain',
95
+ 'internal',
96
+ 'intranet',
97
+ 'lan',
98
+ 'home',
99
+ 'corp',
100
+ 'test',
101
+ 'example',
102
+ 'invalid',
103
+ 'onion'
104
+ ];
105
+ /** Reserved as a WHOLE name only — `acme.co.uk` stays claimable. */ export const BARE_PUBLIC_SUFFIXES = new Set([
106
+ 'co.uk',
107
+ 'org.uk',
108
+ 'me.uk',
109
+ 'ac.uk',
110
+ 'gov.uk',
111
+ 'com.au',
112
+ 'net.au',
113
+ 'org.au',
114
+ 'co.nz',
115
+ 'co.za',
116
+ 'co.jp',
117
+ 'ne.jp',
118
+ 'or.jp',
119
+ 'com.br',
120
+ 'com.mx',
121
+ 'com.cn',
122
+ 'com.tr',
123
+ 'co.in',
124
+ 'co.kr',
125
+ 'com.sg',
126
+ 'com.hk'
127
+ ]);
128
+ /**
129
+ * Trim, lowercase, drop a trailing root dot, and tolerate a pasted URL.
130
+ *
131
+ * People paste `https://console.acme.com/` into a domain field constantly, and
132
+ * refusing that is a support ticket rather than a security control — the value
133
+ * is re-validated against the shape below either way.
134
+ */ export function normalizePlatformDomain(input) {
135
+ const raw = String(input != null ? input : '').trim().toLowerCase();
136
+ if (!raw) return '';
137
+ return raw.replace(/^[a-z][a-z0-9+.-]*:\/\//, '').replace(/^[^@]*@/, '').split(/[/?#]/)[0].replace(/\.+$/, '');
138
+ }
139
+ /**
140
+ * Whether a normalised name belongs to the platform rather than a customer.
141
+ *
142
+ * `TENANT_APEX` is consulted at call time rather than baked into the list
143
+ * above, and that is the load-bearing half rather than a nicety. The static
144
+ * entries name *our* production zones; the correspondence this file exists to
145
+ * protect is a property of **whichever apex this deployment attaches
146
+ * `{subdomain}.{apex}` redirects to**, which a self-host operator sets with
147
+ * `NEXT_PUBLIC_TENANT_DOMAIN`. A blocklist that only knew `aglyn.app` would
148
+ * leave every self-host install with the hole we are closing here.
149
+ */ export function isPlatformReservedDomain(domain) {
150
+ if (!domain) return true;
151
+ if (BARE_PUBLIC_SUFFIXES.has(domain)) return true;
152
+ const apex = String(TENANT_APEX != null ? TENANT_APEX : '').trim().toLowerCase();
153
+ const suffixes = apex ? [
154
+ ...RESERVED_DOMAIN_SUFFIXES,
155
+ apex
156
+ ] : RESERVED_DOMAIN_SUFFIXES;
157
+ return suffixes.some((suffix)=>domain === suffix || domain.endsWith(`.${suffix}`));
158
+ }
159
+ /**
160
+ * Shape, length and reserved-name check for a customer-supplied hostname.
161
+ *
162
+ * `{ domain, error }` with both keys always present rather than a discriminated
163
+ * union, matching `validateSsoDomain` — `strictNullChecks` is off repo-wide and
164
+ * an `{ ok: true } | { ok: false }` union does not narrow reliably once it
165
+ * crosses a library boundary.
166
+ *
167
+ * `copy` is a parameter rather than a constant because the console and site
168
+ * wizards are different products to the customer standing in front of them,
169
+ * and these two strings are the ones a customer reads and acts on. The RULES
170
+ * are shared; only the wording is not.
171
+ */ export function validatePlatformDomain(input, copy) {
172
+ const domain = normalizePlatformDomain(input);
173
+ if (!domain || domain.length > MAX_DOMAIN_LENGTH || !PLATFORM_DOMAIN_PATTERN.test(domain)) {
174
+ return {
175
+ domain: null,
176
+ error: copy.invalid
177
+ };
178
+ }
179
+ if (domain.split('.').length < 2) {
180
+ return {
181
+ domain: null,
182
+ error: 'Enter a full domain name, not a single label'
183
+ };
184
+ }
185
+ if (isPlatformReservedDomain(domain)) {
186
+ return {
187
+ domain: null,
188
+ error: copy.reserved
189
+ };
190
+ }
191
+ return {
192
+ domain,
193
+ error: null
194
+ };
195
+ }
196
+
197
+ //# sourceMappingURL=platform-domain-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/tenant/data/admin/src/lib/server/platform-domain-names.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Which hostnames a customer may claim, and which are the platform's own.\n *\n * ## Why this file exists (AGL-1430)\n *\n * Both domain surfaces — `consoleDomains` (white-label console, AGL-1353) and\n * `hosts.cname` (site custom domain, AGL-166/743) — attach customer names to a\n * Vercel project whose add-domain call **tolerates `domain_already_in_use`**.\n * That tolerance is only safe while the Firestore claim indexes *every* name\n * the platform holds on that project. A name that reaches Vercel without a\n * claim can be claimed by a second org, which reads the tolerated 409 as\n * health and has its visitors redirected to a stranger's site.\n *\n * `console-domains.ts` reasoned this through and built the blocklist. The site\n * path never got one, and it was the path with the live hole: AGL-1273 attaches\n * `{subdomain}.{TENANT_APEX}` to the tenant project as a 307 redirect on every\n * custom-domain connect, and nothing indexes that name as anybody's `cname`.\n * Org B could claim org A's `alice.aglyn.app`, watch `projectDomainStatus`\n * truthfully answer `serving` — the name really is on our project — and end up\n * with its own `{sub}.aglyn.app` 307ing to org A's site.\n *\n * So the lists live here, once, and both surfaces read them. A name added to\n * one blocklist is added to both, which is the property that was missing.\n *\n * ## The two ways a name is reserved\n *\n * **Suffix-reserved** (`RESERVED_DOMAIN_SUFFIXES`) — blocked as the name itself\n * *and as any subdomain of it*. Two families:\n *\n * - **Ours.** `aglyn.com`, `aglyn.io`, `aglyn.app`, `aglyn.dev`. Keying on the\n * registrable domain covers every entry of `PRODUCTION_DOMAINS` in\n * `security-origins.js` without duplicating that list, and keeps covering\n * names added to it later. `console-domains.spec.ts` walks the real file and\n * asserts exactly that.\n * - **Shared app-hosting suffixes.** Nobody controls the zone at\n * `something.vercel.app` in the sense these features need — AGL-1353 measured\n * `aglyn-console-aglyn.vercel.app` already serving a real console. Proving\n * control of a name a platform hands out for free proves something that can\n * be re-handed to someone else.\n *\n * **Bare-suffix-reserved** (`BARE_PUBLIC_SUFFIXES`) — blocked as a *whole name\n * only*. `acme.co.uk` is a perfectly good customer domain; `co.uk` is not a\n * domain at all. A short list rather than the Public Suffix List on purpose:\n * pulling in a PSL dependency to reject a name no registrar would sell is not a\n * trade worth making, and the single-label rule catches the commoner `com` case\n * for free.\n */\n\nimport { TENANT_APEX } from '@aglyn/aglyn/server'\nimport type { DomainCheck } from './sso-provisioning'\n\nconst LABEL = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?'\n\n/** Hostname shape: dash-free at label edges, a real TLD, at least two labels. */\nexport const PLATFORM_DOMAIN_PATTERN = new RegExp(\n `^${LABEL}(?:\\\\.${LABEL})*\\\\.[a-z]{2,63}$`,\n)\n\n/** RFC 1035: a fully-qualified name is at most 253 octets. */\nexport const MAX_DOMAIN_LENGTH = 253\n\n/** Reserved as the name itself AND as any subdomain of it. See the header. */\nexport const RESERVED_DOMAIN_SUFFIXES: readonly string[] = [\n 'aglyn.com',\n 'aglyn.io',\n 'aglyn.app',\n 'aglyn.dev',\n 'vercel.app',\n 'vercel.sh',\n 'web.app',\n 'firebaseapp.com',\n 'appspot.com',\n 'cloudfunctions.net',\n 'run.app',\n 'pages.dev',\n 'workers.dev',\n 'netlify.app',\n 'github.io',\n 'herokuapp.com',\n 'azurewebsites.net',\n 'amplifyapp.com',\n 'onrender.com',\n 'fly.dev',\n 'ngrok.io',\n 'ngrok-free.app',\n 'trycloudflare.com',\n // RFC 2606 / 6761 special-use names, plus the ones a misconfigured resolver\n // answers for. None of these can be proved by a public TXT lookup.\n 'localhost',\n 'local',\n 'localdomain',\n 'internal',\n 'intranet',\n 'lan',\n 'home',\n 'corp',\n 'test',\n 'example',\n 'invalid',\n 'onion',\n]\n\n/** Reserved as a WHOLE name only — `acme.co.uk` stays claimable. */\nexport const BARE_PUBLIC_SUFFIXES: ReadonlySet<string> = new Set([\n 'co.uk',\n 'org.uk',\n 'me.uk',\n 'ac.uk',\n 'gov.uk',\n 'com.au',\n 'net.au',\n 'org.au',\n 'co.nz',\n 'co.za',\n 'co.jp',\n 'ne.jp',\n 'or.jp',\n 'com.br',\n 'com.mx',\n 'com.cn',\n 'com.tr',\n 'co.in',\n 'co.kr',\n 'com.sg',\n 'com.hk',\n])\n\n/**\n * Trim, lowercase, drop a trailing root dot, and tolerate a pasted URL.\n *\n * People paste `https://console.acme.com/` into a domain field constantly, and\n * refusing that is a support ticket rather than a security control — the value\n * is re-validated against the shape below either way.\n */\nexport function normalizePlatformDomain(input: string): string {\n const raw = String(input ?? '')\n .trim()\n .toLowerCase()\n if (!raw) return ''\n return raw\n .replace(/^[a-z][a-z0-9+.-]*:\\/\\//, '')\n .replace(/^[^@]*@/, '')\n .split(/[/?#]/)[0]\n .replace(/\\.+$/, '')\n}\n\n/**\n * Whether a normalised name belongs to the platform rather than a customer.\n *\n * `TENANT_APEX` is consulted at call time rather than baked into the list\n * above, and that is the load-bearing half rather than a nicety. The static\n * entries name *our* production zones; the correspondence this file exists to\n * protect is a property of **whichever apex this deployment attaches\n * `{subdomain}.{apex}` redirects to**, which a self-host operator sets with\n * `NEXT_PUBLIC_TENANT_DOMAIN`. A blocklist that only knew `aglyn.app` would\n * leave every self-host install with the hole we are closing here.\n */\nexport function isPlatformReservedDomain(domain: string): boolean {\n if (!domain) return true\n if (BARE_PUBLIC_SUFFIXES.has(domain)) return true\n const apex = String(TENANT_APEX ?? '')\n .trim()\n .toLowerCase()\n const suffixes = apex\n ? [...RESERVED_DOMAIN_SUFFIXES, apex]\n : RESERVED_DOMAIN_SUFFIXES\n return suffixes.some(\n (suffix) => domain === suffix || domain.endsWith(`.${suffix}`),\n )\n}\n\n/**\n * Shape, length and reserved-name check for a customer-supplied hostname.\n *\n * `{ domain, error }` with both keys always present rather than a discriminated\n * union, matching `validateSsoDomain` — `strictNullChecks` is off repo-wide and\n * an `{ ok: true } | { ok: false }` union does not narrow reliably once it\n * crosses a library boundary.\n *\n * `copy` is a parameter rather than a constant because the console and site\n * wizards are different products to the customer standing in front of them,\n * and these two strings are the ones a customer reads and acts on. The RULES\n * are shared; only the wording is not.\n */\nexport function validatePlatformDomain(\n input: string,\n copy: { invalid: string; reserved: string },\n): DomainCheck {\n const domain = normalizePlatformDomain(input)\n if (\n !domain ||\n domain.length > MAX_DOMAIN_LENGTH ||\n !PLATFORM_DOMAIN_PATTERN.test(domain)\n ) {\n return { domain: null, error: copy.invalid }\n }\n if (domain.split('.').length < 2) {\n return { domain: null, error: 'Enter a full domain name, not a single label' }\n }\n if (isPlatformReservedDomain(domain)) {\n return { domain: null, error: copy.reserved }\n }\n return { domain, error: null }\n}\n"],"names":["TENANT_APEX","LABEL","PLATFORM_DOMAIN_PATTERN","RegExp","MAX_DOMAIN_LENGTH","RESERVED_DOMAIN_SUFFIXES","BARE_PUBLIC_SUFFIXES","Set","normalizePlatformDomain","input","raw","String","trim","toLowerCase","replace","split","isPlatformReservedDomain","domain","has","apex","suffixes","some","suffix","endsWith","validatePlatformDomain","copy","length","test","error","invalid","reserved"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CC,GAED,SAASA,WAAW,QAAQ,sBAAqB;AAGjD,MAAMC,QAAQ;AAEd,+EAA+E,GAC/E,OAAO,MAAMC,0BAA0B,IAAIC,OACzC,CAAC,CAAC,EAAEF,MAAM,MAAM,EAAEA,MAAM,iBAAiB,CAAC,EAC3C;AAED,4DAA4D,GAC5D,OAAO,MAAMG,oBAAoB,IAAG;AAEpC,4EAA4E,GAC5E,OAAO,MAAMC,2BAA8C;IACzD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,4EAA4E;IAC5E,mEAAmE;IACnE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED,kEAAkE,GAClE,OAAO,MAAMC,uBAA4C,IAAIC,IAAI;IAC/D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAC;AAEF;;;;;;CAMC,GACD,OAAO,SAASC,wBAAwBC,KAAa;IACnD,MAAMC,MAAMC,OAAOF,gBAAAA,QAAS,IACzBG,IAAI,GACJC,WAAW;IACd,IAAI,CAACH,KAAK,OAAO;IACjB,OAAOA,IACJI,OAAO,CAAC,2BAA2B,IACnCA,OAAO,CAAC,WAAW,IACnBC,KAAK,CAAC,QAAQ,CAAC,EAAE,CACjBD,OAAO,CAAC,QAAQ;AACrB;AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASE,yBAAyBC,MAAc;IACrD,IAAI,CAACA,QAAQ,OAAO;IACpB,IAAIX,qBAAqBY,GAAG,CAACD,SAAS,OAAO;IAC7C,MAAME,OAAOR,OAAOX,sBAAAA,cAAe,IAChCY,IAAI,GACJC,WAAW;IACd,MAAMO,WAAWD,OACb;WAAId;QAA0Bc;KAAK,GACnCd;IACJ,OAAOe,SAASC,IAAI,CAClB,CAACC,SAAWL,WAAWK,UAAUL,OAAOM,QAAQ,CAAC,CAAC,CAAC,EAAED,QAAQ;AAEjE;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,SAASE,uBACdf,KAAa,EACbgB,IAA2C;IAE3C,MAAMR,SAAST,wBAAwBC;IACvC,IACE,CAACQ,UACDA,OAAOS,MAAM,GAAGtB,qBAChB,CAACF,wBAAwByB,IAAI,CAACV,SAC9B;QACA,OAAO;YAAEA,QAAQ;YAAMW,OAAOH,KAAKI,OAAO;QAAC;IAC7C;IACA,IAAIZ,OAAOF,KAAK,CAAC,KAAKW,MAAM,GAAG,GAAG;QAChC,OAAO;YAAET,QAAQ;YAAMW,OAAO;QAA+C;IAC/E;IACA,IAAIZ,yBAAyBC,SAAS;QACpC,OAAO;YAAEA,QAAQ;YAAMW,OAAOH,KAAKK,QAAQ;QAAC;IAC9C;IACA,OAAO;QAAEb;QAAQW,OAAO;IAAK;AAC/B"}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * The record a console door writes when a person decides about the
19
+ * platform's own product email (AGL-3185).
20
+ *
21
+ * ## Two documents, one decision
22
+ *
23
+ * The decision goes onto the person's own `users/{uid}` first — the console
24
+ * shows the preference from there, and it must not depend on the operator's
25
+ * CRM accepting a row — and then onto the operator's marketing contact for
26
+ * the same address through `upsertHostContact`, which is every other capture
27
+ * door's path and the only one the send-time consent join reads. The contact
28
+ * half carries the decision AND its provenance, so a campaign's audience
29
+ * count reports this basis as the person's own click and never as something
30
+ * asserted on their behalf.
31
+ *
32
+ * ## Server-side, because the client cannot and should not
33
+ *
34
+ * The sign-up page is a client of the person's own project; the operator's
35
+ * marketing org is somebody else's data. Only the Admin SDK writes there, and
36
+ * only after the person's ID token has been verified by the route in front
37
+ * of this module. The user-document half could be a client write — the rules
38
+ * make it owner-writable — but a mirror the client writes and the server
39
+ * reads back is two writers of one fact, so both halves are written here.
40
+ *
41
+ * ## Which host, and why it is a setting
42
+ *
43
+ * The marketing host is the deployment's, not the code's: this repository is
44
+ * what a self-hosted install runs, and an install with no product audience of
45
+ * its own has nowhere for a contact to go. `PLATFORM_MARKETING_HOST_ID` names
46
+ * it, and when it is unset the decision is recorded on the person's document
47
+ * alone. No hostname or document id is hardcoded here for the same reason
48
+ * `platform-marketing-host.ts` gives: nothing in the code knows which site
49
+ * is the operator's.
50
+ */
51
+ import { type PlatformMarketingConsentDecision, type PlatformMarketingConsentSourceKind, type PlatformMarketingConsentState } from '@aglyn/aglyn/app-utils/platform-marketing-consent';
52
+ import { upsertHostContact } from './upsert-contact';
53
+ /**
54
+ * The variable naming the host whose contacts receive product-marketing
55
+ * consent — the operator's own marketing site. Unset on a self-hosted
56
+ * install, and honored as "record the preference, capture no contact".
57
+ */
58
+ export declare const PLATFORM_MARKETING_HOST_ID_ENV = "PLATFORM_MARKETING_HOST_ID";
59
+ /**
60
+ * The configured marketing host, or `null` when the deployment names none.
61
+ *
62
+ * Read at call time rather than at module load, so a test can set it and a
63
+ * process that started without it picks up a later value the same way every
64
+ * other runtime setting here does.
65
+ */
66
+ export declare function platformMarketingHostId(): string | null;
67
+ /** What became of the contact half of the record. */
68
+ export type PlatformMarketingContactOutcome = {
69
+ status: 'recorded';
70
+ contactId: string;
71
+ created: boolean;
72
+ }
73
+ /** No marketing host is configured — a self-hosted install. */
74
+ | {
75
+ status: 'unconfigured';
76
+ }
77
+ /** The account carries no address a contact could be keyed on. */
78
+ | {
79
+ status: 'no-email';
80
+ }
81
+ /** The capture door refused the row — its band, an erasure, or an error. */
82
+ | {
83
+ status: 'refused';
84
+ reason: string;
85
+ };
86
+ export interface RecordPlatformMarketingConsentInput {
87
+ uid: string;
88
+ /** The account's address, from the verified token. */
89
+ email: string | null | undefined;
90
+ /** The name the token carries, for an account whose document holds none. */
91
+ name?: string | null;
92
+ decision: PlatformMarketingConsentDecision;
93
+ source: PlatformMarketingConsentSourceKind;
94
+ /** The wording version the door showed, stamped by the route. */
95
+ textVersion: string;
96
+ /** Injectable for tests; defaults to the clock. */
97
+ now?: number;
98
+ /** Injectable for tests; defaults to the admin app's Firestore. */
99
+ firestore?: any;
100
+ /** Injectable for tests; defaults to {@link platformMarketingHostId}. */
101
+ hostId?: string | null;
102
+ /** Injectable for tests; defaults to the real capture door. */
103
+ upsert?: typeof upsertHostContact;
104
+ }
105
+ export interface RecordPlatformMarketingConsentResult {
106
+ /** The timestamp both documents carry. */
107
+ atMs: number;
108
+ contact: PlatformMarketingContactOutcome;
109
+ }
110
+ /**
111
+ * Records a decision on both documents.
112
+ *
113
+ * Loud on bad input, like `recordLegalAcceptance`: a decision that cannot be
114
+ * attributed to an account, a door and a wording is not a record of anything.
115
+ * Quiet on the contact half — a refused row is returned, not thrown — because
116
+ * the person's own preference has already been recorded by then, and the
117
+ * operator's CRM band is not a reason to tell them their choice failed.
118
+ */
119
+ export declare function recordPlatformMarketingConsent(input: RecordPlatformMarketingConsentInput): Promise<RecordPlatformMarketingConsentResult>;
120
+ /**
121
+ * Stamps a prompt dismissal — no decision — so the console stays quiet for
122
+ * the snooze window and asks once more after it.
123
+ */
124
+ export declare function snoozePlatformMarketingPrompt(uid: string, options?: {
125
+ now?: number;
126
+ firestore?: any;
127
+ }): Promise<{
128
+ atMs: number;
129
+ }>;
130
+ /** The decision the person's own document holds, for the console to show. */
131
+ export declare function readPlatformMarketingConsentForUser(uid: string, options?: {
132
+ firestore?: any;
133
+ }): Promise<PlatformMarketingConsentState>;