@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/domain-provider.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 * How a hostname gets served — the one seam the hosting vendor lives behind.\n *\n * ## The lock-in this removes\n *\n * Attaching a name was `POST https://api.vercel.com/...`, written out five\n * times across the console routes and this library. Every workspace subdomain\n * and every customer's custom domain therefore required a Vercel project and a\n * Vercel token, and a self-hosted install had no way to register a name at all\n * — it got `skipped` and a console that advertised a URL nothing resolved.\n * \"Bring your own Firebase, run it on Docker\" cannot be true while the way a\n * site becomes reachable is one vendor's API.\n *\n * So the vendor is a driver now. The three operations a name needs are the\n * whole contract, and an operator picks — or writes — the implementation:\n *\n * | provider | for |\n * |------------|-----------------------------------------------------------|\n * | `vercel` | Aglyn's own hosting, and anyone else on Vercel |\n * | `wildcard` | a container behind a proxy with `*.example.com` DNS |\n * | `webhook` | anything else — Caddy, Traefik, cert-manager, a registrar |\n * | `none` | names are somebody else's job entirely |\n *\n * ## Why a webhook is the extension point and not a module path\n *\n * The obvious \"supply your own layer\" is a file path the app imports at boot.\n * It does not survive the product: both apps are bundled by Next, so a path\n * resolved at runtime is not in the bundle, and an operator running the\n * published image has no build step to add one to. A webhook needs no rebuild,\n * works from the shipped image, and is the same shape whether the operator's\n * DNS lives in Caddy's admin API, a Traefik provider, or a shell script behind\n * `nc`. The cost is one HTTP hop on an operation that already makes one.\n *\n * ## The contract every driver owes\n *\n * 1. **Never throw.** A caller creates orgs and renders cards with these\n * results; an exception takes down an org creation over a DNS API. Return\n * `failed` — or `skipped`, which is not a failure.\n * 2. **Idempotent.** `attach` on a name already attached is `already-exists`,\n * which is success. Reconcile passes and create paths both run.\n * 3. **`skipped` means \"not my job\", not \"it went wrong\".** It is what an\n * unconfigured driver returns, and callers treat it as neither success nor\n * failure.\n * 4. **`unknown` status is not evidence of a problem.** {@link domainStateServes}\n * returns true for it deliberately: a probe that could not answer must not\n * strand every domain on a deployment whose provider has no status API.\n */\n\n/**\n * Which deployment a name should reach.\n *\n * Two, because Aglyn runs two apps: the console at `app.<domain>` with its\n * per-workspace subdomains, and the tenant runtime that serves published\n * sites and every customer's own domain. On Vercel they are separate projects;\n * behind a proxy they are separate upstreams; for a webhook they are a field.\n */\nexport type DomainScope = 'console' | 'tenant'\n\nexport type DomainOutcome =\n | 'attached'\n | 'detached'\n | 'already-exists'\n | 'not-found'\n | 'skipped'\n | 'failed'\n\nexport interface DomainResult {\n outcome: DomainOutcome\n domain: string\n /** Why, when the outcome alone does not say it. Never user-facing prose. */\n detail?: string\n}\n\nexport interface DomainAttachOptions {\n /**\n * Register the name as a REDIRECT to this bare hostname rather than serving\n * the app on it — how a renamed workspace keeps its old slug working.\n *\n * A driver that cannot express a redirect returns `skipped` rather than\n * attaching a serving name, because the two are not interchangeable: a\n * serving twin is a second live copy of the console on a name that was\n * supposed to forward.\n */\n redirectTo?: string\n}\n\nexport type ProjectDomainState =\n | 'serving'\n | 'certificate-pending'\n | 'ownership-pending'\n | 'dns-misconfigured'\n | 'not-attached'\n | 'skipped'\n | 'unknown'\n\n/** One challenge record a provider wants before it will serve the name. */\nexport interface ProjectDomainVerification {\n type: string\n domain: string\n value: string\n reason?: string\n}\n\nexport interface ProjectDomainStatus {\n state: ProjectDomainState\n domain: string\n /** Present when `state` is `ownership-pending`; what to add at the registrar. */\n verification: ProjectDomainVerification[]\n /**\n * Records answering for this name that are not ours, as the provider sees\n * them. A non-empty list on an otherwise-serving domain is the shadowing\n * case: it resolves correctly some of the time.\n */\n conflicts: { type?: string; name?: string; value?: string }[]\n /** Why, when the state alone does not say it. */\n detail?: string\n}\n\nexport interface DomainProvider {\n /** Stable id, used in this module's log lines. Never a display name. */\n readonly id: string\n /** Whether this deployment can actually register names for `scope`. */\n configured(scope: DomainScope): boolean\n attach(\n scope: DomainScope,\n domain: string,\n options?: DomainAttachOptions,\n ): Promise<DomainResult>\n detach(scope: DomainScope, domain: string): Promise<DomainResult>\n status(scope: DomainScope, domain: string): Promise<ProjectDomainStatus>\n}\n\n/**\n * Whether a probed state means visitors may be sent to the domain (AGL-2011).\n *\n * The ONE definition of \"serving\", because it has to be. The predicate lived\n * inline in `/api/domains/attach` and again in\n * `/api/admin/finish-domain-attachments`, and the sweeper's own comment says\n * why that is dangerous: a sweeper using a looser definition than the door it\n * completes for re-introduces the bug that door was fixed to avoid.\n *\n * `certificate-pending` is NOT serving (AGL-1996): the name is accepted and\n * routed but no certificate exists yet, so the destination answers with a TLS\n * error. `unknown` and `skipped` ARE, deliberately — a status probe that could\n * not answer is not evidence of a problem, and treating it as one would strand\n * every domain on a deployment whose provider has no status API to ask.\n */\nexport function domainStateServes(state: ProjectDomainState): boolean {\n return (\n state !== 'not-attached' &&\n state !== 'ownership-pending' &&\n state !== 'dns-misconfigured' &&\n state !== 'certificate-pending'\n )\n}\n\nexport function domainStatus(\n domain: string,\n state: ProjectDomainState,\n extra: Partial<ProjectDomainStatus> = {},\n): ProjectDomainStatus {\n return { state, domain, verification: [], conflicts: [], ...extra }\n}\n\nconst HOSTNAME_PATTERN =\n /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$/\n\nexport function normalizeHost(input: string): string {\n return String(input ?? '')\n .trim()\n .toLowerCase()\n .replace(/\\.$/, '')\n}\n\n/**\n * A redirect target reduced to a BARE HOSTNAME, or `null` if it is not one.\n *\n * Vercel rejects `https://aglyn.com` here with `bad_request`, whose message\n * reads \"Unable to redirect to https://…, because that domain is not added to\n * the project\" — it blames the target for being absent when the format was\n * wrong. That misreading is why AGL-1273's redirect shipped looking correct\n * and never once succeeded, and survived weeks before AGL-1365 caught it.\n *\n * Enforced at the seam rather than trusted per driver, so a webhook operator\n * receives the same shape Vercel demands and no driver has to re-derive it.\n */\nexport function redirectHostname(target: string): string | null {\n const raw = normalizeHost(target)\n if (!raw) return null\n const host = raw\n .replace(/^[a-z][a-z0-9+.-]*:\\/\\//, '')\n .split(/[/?#]/)[0]\n .replace(/\\.$/, '')\n return HOSTNAME_PATTERN.test(host) ? host : null\n}\n\n/**\n * Ceiling on any provider call (AGL-1136).\n *\n * These are awaited — org creation and rename wait for them — so an\n * unresponsive DNS API would otherwise hang the operation until the platform\n * killed the function, turning \"the subdomain is not attached yet\" into \"the\n * workspace could not be created\". The whole point of the call being\n * best-effort is that it can lose without taking anything with it, and a\n * promise with no timeout cannot lose.\n */\nexport const DOMAIN_PROVIDER_TIMEOUT_MS = 5000\n\n/** `AbortSignal.timeout`, without assuming the runtime has it. */\nexport function domainDeadline(): AbortSignal | undefined {\n try {\n return AbortSignal.timeout(DOMAIN_PROVIDER_TIMEOUT_MS)\n } catch {\n return undefined\n }\n}\n\n/** Whether a rejection was our own deadline rather than the network's. */\nexport function abortedDetail(error: unknown): 'timeout' | 'network' {\n const name = (error as { name?: string })?.name\n return name === 'TimeoutError' || name === 'AbortError' ? 'timeout' : 'network'\n}\n\n/**\n * The driver that registers nothing.\n *\n * Not an error state. A deployment can legitimately have names handled\n * entirely outside the product — a platform team's own DNS pipeline, or an\n * install that only ever uses path routing — and the correct behaviour there\n * is silence, not a failure logged on every signup forever.\n */\nexport const NO_DOMAIN_PROVIDER: DomainProvider = {\n id: 'none',\n configured: () => false,\n attach: async (_scope, domain) => ({ outcome: 'skipped', domain }),\n detach: async (_scope, domain) => ({ outcome: 'skipped', domain }),\n status: async (_scope, domain) => domainStatus(domain, 'skipped'),\n}\n\nexport type DomainProviderId = 'vercel' | 'wildcard' | 'webhook' | 'none'\n\n/**\n * The configured provider id, or `null` to let {@link domainProvider} infer it.\n *\n * An explicit value always wins, including `none` — an operator switching a\n * driver off while its credentials are still in the environment means it.\n */\nfunction requestedProviderId(): DomainProviderId | null {\n const raw = String(process.env.AGLYN_DOMAIN_PROVIDER ?? '')\n .trim()\n .toLowerCase()\n if (!raw) return null\n if (\n raw === 'vercel' ||\n raw === 'wildcard' ||\n raw === 'webhook' ||\n raw === 'none'\n ) {\n return raw\n }\n console.error(\n `[domain-provider] unknown AGLYN_DOMAIN_PROVIDER \"${raw}\" — falling back ` +\n 'to detection. Valid values: vercel, wildcard, webhook, none.',\n )\n return null\n}\n\nlet cached: { key: string; provider: DomainProvider } | null = null\n\n/**\n * The provider this deployment uses.\n *\n * ⚠️ Detection, when `AGLYN_DOMAIN_PROVIDER` is unset, deliberately only ever\n * selects `vercel` — never `wildcard`. Wildcard reports a name as SERVING\n * without checking anything, and inferring it from an apex an operator merely\n * configured would have the console advertise addresses that resolve nowhere\n * while showing a green chip. Claiming to serve a name is the operator's\n * assertion to make, so it takes their explicit setting.\n *\n * Memoized on the environment values it reads rather than once per process, so\n * a spec can change them between cases without a reset hook that production\n * would carry for nobody.\n */\nexport function domainProvider(): DomainProvider {\n const requested = requestedProviderId()\n const key = [\n requested ?? '',\n process.env.VERCEL_TOKEN ? '1' : '',\n process.env.AGLYN_DOMAIN_WEBHOOK_URL ?? '',\n process.env.AGLYN_DOMAIN_WILDCARD_SUFFIXES ?? '',\n process.env.NEXT_PUBLIC_WORKSPACE_DOMAIN ?? '',\n process.env.NEXT_PUBLIC_TENANT_DOMAIN ?? '',\n ].join('\\x00')\n if (cached?.key === key) return cached.provider\n\n const provider = selectProvider(requested)\n cached = { key, provider }\n return provider\n}\n\nfunction selectProvider(requested: DomainProviderId | null): DomainProvider {\n // Required lazily so a deployment pays for only the driver it uses, and so\n // this module stays importable from an edge runtime that has no `fetch`\n // credentials of its own.\n switch (requested ?? (process.env.VERCEL_TOKEN ? 'vercel' : 'none')) {\n case 'vercel':\n return require('./domain-provider-vercel').VERCEL_DOMAIN_PROVIDER\n case 'wildcard':\n return require('./domain-provider-wildcard').wildcardDomainProvider()\n case 'webhook':\n return require('./domain-provider-webhook').webhookDomainProvider()\n default:\n return NO_DOMAIN_PROVIDER\n }\n}\n"],"names":["domainStateServes","state","domainStatus","domain","extra","verification","conflicts","HOSTNAME_PATTERN","normalizeHost","input","String","trim","toLowerCase","replace","redirectHostname","target","raw","host","split","test","DOMAIN_PROVIDER_TIMEOUT_MS","domainDeadline","AbortSignal","timeout","undefined","abortedDetail","error","name","NO_DOMAIN_PROVIDER","id","configured","attach","_scope","outcome","detach","status","requestedProviderId","process","env","AGLYN_DOMAIN_PROVIDER","console","cached","domainProvider","requested","key","VERCEL_TOKEN","AGLYN_DOMAIN_WEBHOOK_URL","AGLYN_DOMAIN_WILDCARD_SUFFIXES","NEXT_PUBLIC_WORKSPACE_DOMAIN","NEXT_PUBLIC_TENANT_DOMAIN","join","provider","selectProvider","require","VERCEL_DOMAIN_PROVIDER","wildcardDomainProvider","webhookDomainProvider"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CC,GAED;;;;;;;CAOC;AA6ED;;;;;;;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QACnE,KAAK;YACH,OAAOD,QAAQ,8BAA8BE,sBAAsB;QACrE,KAAK;YACH,OAAOF,QAAQ,6BAA6BG,qBAAqB;QACnE;YACE,OAAO5B;IACX;AACF"}
@@ -0,0 +1,54 @@
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 activity writer for a whole-resource copy (AGL-2936).
19
+ *
20
+ * One row per copy in the site's feed and one in the workspace's, both
21
+ * carrying the `<kind>.duplicated` code from the shared catalog so the feed
22
+ * translates it once and a filter on "duplicated" finds every kind's copies
23
+ * together. The row's target is the COPY — that is the document a reader
24
+ * wants to open from the feed — and the original is named in the free text
25
+ * beside it, because the target shape carries one id and the copy's is the
26
+ * one every deep link needs.
27
+ *
28
+ * A kind the activity unions have no member for files under `content`, the
29
+ * same classification the create routes give it: a persisted type no
30
+ * presenter branches on would render as an unlinked row.
31
+ */
32
+ import { type DuplicableResourceKind } from '@aglyn/aglyn/app-utils/duplicate-resource';
33
+ export interface ResourceDuplicatedActor {
34
+ uid: string;
35
+ email?: string | null;
36
+ }
37
+ export interface ResourceDuplicated {
38
+ orgId: string;
39
+ /** Absent for a workspace-level resource, which has no site feed. */
40
+ hostId?: string | null;
41
+ source: {
42
+ id: string;
43
+ name: string;
44
+ };
45
+ target: {
46
+ id: string;
47
+ name: string;
48
+ versionId?: string | null;
49
+ };
50
+ }
51
+ /** `<name> · from <source name>`, the only free text the row carries. */
52
+ export declare function duplicatedTargetName(copy: ResourceDuplicated): string;
53
+ /** `<kind>.duplicated` — a whole copy of a resource was made. */
54
+ export declare function logResourceDuplicated(kind: DuplicableResourceKind, actor: ResourceDuplicatedActor, copy: ResourceDuplicated): Promise<void>;
@@ -0,0 +1,67 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ /**
18
+ * The activity writer for a whole-resource copy (AGL-2936).
19
+ *
20
+ * One row per copy in the site's feed and one in the workspace's, both
21
+ * carrying the `<kind>.duplicated` code from the shared catalog so the feed
22
+ * translates it once and a filter on "duplicated" finds every kind's copies
23
+ * together. The row's target is the COPY — that is the document a reader
24
+ * wants to open from the feed — and the original is named in the free text
25
+ * beside it, because the target shape carries one id and the copy's is the
26
+ * one every deep link needs.
27
+ *
28
+ * A kind the activity unions have no member for files under `content`, the
29
+ * same classification the create routes give it: a persisted type no
30
+ * presenter branches on would render as an unlinked row.
31
+ */ import { DUPLICATE_ACTIVITY_ACTIONS } from "@aglyn/aglyn/app-utils/duplicate-resource";
32
+ import { logHostActivity, logOrgActivity } from "./organizations.js";
33
+ /** The target type each kind's row is filed under, in both feeds. */ const TARGET_TYPE = {
34
+ screen: 'screen',
35
+ emailDesign: 'screen',
36
+ component: 'component',
37
+ layout: 'layout',
38
+ template: 'template',
39
+ workflow: 'workflow',
40
+ form: 'content',
41
+ emailTemplate: 'content',
42
+ campaign: 'content'
43
+ };
44
+ /** `<name> · from <source name>`, the only free text the row carries. */ export function duplicatedTargetName(copy) {
45
+ const target = copy.target.name.trim();
46
+ const source = copy.source.name.trim();
47
+ return source ? `${target} · from ${source}` : target;
48
+ }
49
+ /** `<kind>.duplicated` — a whole copy of a resource was made. */ export async function logResourceDuplicated(kind, actor, copy) {
50
+ var _actor_email;
51
+ const action = DUPLICATE_ACTIVITY_ACTIONS[kind];
52
+ const target = _extends({
53
+ type: TARGET_TYPE[kind],
54
+ id: copy.target.id,
55
+ name: duplicatedTargetName(copy)
56
+ }, copy.target.versionId ? {
57
+ versionId: copy.target.versionId
58
+ } : {});
59
+ const person = {
60
+ uid: actor.uid,
61
+ email: (_actor_email = actor.email) != null ? _actor_email : null
62
+ };
63
+ if (copy.hostId) await logHostActivity(copy.hostId, person, action, target);
64
+ await logOrgActivity(copy.orgId, person, action, target);
65
+ }
66
+
67
+ //# sourceMappingURL=duplicate-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/tenant/data/admin/src/lib/server/duplicate-activity.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 * The activity writer for a whole-resource copy (AGL-2936).\n *\n * One row per copy in the site's feed and one in the workspace's, both\n * carrying the `<kind>.duplicated` code from the shared catalog so the feed\n * translates it once and a filter on \"duplicated\" finds every kind's copies\n * together. The row's target is the COPY — that is the document a reader\n * wants to open from the feed — and the original is named in the free text\n * beside it, because the target shape carries one id and the copy's is the\n * one every deep link needs.\n *\n * A kind the activity unions have no member for files under `content`, the\n * same classification the create routes give it: a persisted type no\n * presenter branches on would render as an unlinked row.\n */\n\nimport {\n DUPLICATE_ACTIVITY_ACTIONS,\n type DuplicableResourceKind,\n} from '@aglyn/aglyn/app-utils/duplicate-resource'\nimport {\n logHostActivity,\n logOrgActivity,\n type HostActivityTarget,\n type OrgActivityTarget,\n} from './organizations'\n\n/** The target type each kind's row is filed under, in both feeds. */\nconst TARGET_TYPE: Record<\n DuplicableResourceKind,\n Extract<OrgActivityTarget['type'], HostActivityTarget['type']>\n> = {\n screen: 'screen',\n emailDesign: 'screen',\n component: 'component',\n layout: 'layout',\n template: 'template',\n workflow: 'workflow',\n form: 'content',\n emailTemplate: 'content',\n campaign: 'content',\n}\n\nexport interface ResourceDuplicatedActor {\n uid: string\n email?: string | null\n}\n\nexport interface ResourceDuplicated {\n orgId: string\n /** Absent for a workspace-level resource, which has no site feed. */\n hostId?: string | null\n source: { id: string; name: string }\n target: { id: string; name: string; versionId?: string | null }\n}\n\n/** `<name> · from <source name>`, the only free text the row carries. */\nexport function duplicatedTargetName(copy: ResourceDuplicated): string {\n const target = copy.target.name.trim()\n const source = copy.source.name.trim()\n return source ? `${target} · from ${source}` : target\n}\n\n/** `<kind>.duplicated` — a whole copy of a resource was made. */\nexport async function logResourceDuplicated(\n kind: DuplicableResourceKind,\n actor: ResourceDuplicatedActor,\n copy: ResourceDuplicated,\n): Promise<void> {\n const action = DUPLICATE_ACTIVITY_ACTIONS[kind]\n const target = {\n type: TARGET_TYPE[kind],\n id: copy.target.id,\n name: duplicatedTargetName(copy),\n ...(copy.target.versionId ? { versionId: copy.target.versionId } : {}),\n }\n const person = { uid: actor.uid, email: actor.email ?? null }\n if (copy.hostId) await logHostActivity(copy.hostId, person, action, target)\n await logOrgActivity(copy.orgId, person, action, target)\n}\n"],"names":["DUPLICATE_ACTIVITY_ACTIONS","logHostActivity","logOrgActivity","TARGET_TYPE","screen","emailDesign","component","layout","template","workflow","form","emailTemplate","campaign","duplicatedTargetName","copy","target","name","trim","source","logResourceDuplicated","kind","actor","action","type","id","versionId","person","uid","email","hostId","orgId"],"mappings":";AAA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 * 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 DuplicableHostResourceKind } from '@aglyn/aglyn/app-utils/duplicate-resource';
18
+ export interface DuplicateResourceOptions {
19
+ orgId: string;
20
+ hostId: string;
21
+ sourceId: string;
22
+ /** The name the copy takes; blank means `Copy of <source>`. */
23
+ name?: string | null;
24
+ /** The verified person making the copy. */
25
+ uid: string;
26
+ email?: string | null;
27
+ /**
28
+ * The owning org's document, when the caller already holds it; read
29
+ * here otherwise. The bands are resolved from it.
30
+ */
31
+ org?: Record<string, unknown> | null;
32
+ /**
33
+ * A client-minted key for this attempt, so a double click makes one copy
34
+ * and a retry of a finished attempt answers what the first did. A caller
35
+ * with no client behind it — the AI runtime — sends none and is not
36
+ * claimed.
37
+ */
38
+ attemptKey?: string | null;
39
+ }
40
+ export type DuplicateResourceResult = {
41
+ ok: true;
42
+ id: string;
43
+ /** The copy's first version, for the kinds that version. */
44
+ versionId: string | null;
45
+ name: string;
46
+ } | {
47
+ ok: false;
48
+ status: number;
49
+ error: string;
50
+ };
51
+ /**
52
+ * Makes the copy. The caller has authenticated `uid` and verified that they
53
+ * may write content on `hostId`; this decides everything after that.
54
+ */
55
+ export declare function duplicateResource(kind: DuplicableHostResourceKind, options: DuplicateResourceOptions): Promise<DuplicateResourceResult>;