@cosmicdrift/kumiko-bundled-features 0.406.0 → 0.410.0

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 (353) hide show
  1. package/dist/account-security/feature.js +9 -1
  2. package/dist/admin-shell/feature.d.ts +3 -0
  3. package/dist/admin-shell/feature.js +1 -1
  4. package/dist/agent-tools/agent-manifest.js +1 -0
  5. package/dist/agent-tools/tool-catalog.js +1 -0
  6. package/dist/agent-tools/types.d.ts +4 -1
  7. package/dist/audit/event-classification.js +1 -0
  8. package/dist/auth-email-password/bootstrap.js +1 -0
  9. package/dist/auth-email-password/errors.js +16 -41
  10. package/dist/auth-email-password/handlers/login-options.query.js +1 -1
  11. package/dist/auth-email-password/handlers/self-registration-status.query.js +1 -1
  12. package/dist/auth-email-password/web/auth-client.d.ts +8 -32
  13. package/dist/auth-email-password/web/auth-client.js +18 -52
  14. package/dist/auth-email-password/web/auth-redirect.js +2 -2
  15. package/dist/auth-email-password/web/confirm-account-unlock-screen.d.ts +2 -2
  16. package/dist/auth-email-password/web/confirm-account-unlock-screen.js +14 -35
  17. package/dist/auth-email-password/web/index.d.ts +1 -0
  18. package/dist/auth-email-password/web/index.js +1 -0
  19. package/dist/auth-email-password/web/read-path-param.d.ts +1 -0
  20. package/dist/auth-email-password/web/read-path-param.js +4 -0
  21. package/dist/auth-email-password/web/return-path.js +2 -2
  22. package/dist/auth-email-password/web/token-confirm-screen.d.ts +20 -0
  23. package/dist/auth-email-password/web/token-confirm-screen.js +38 -0
  24. package/dist/auth-email-password/web/verify-email-screen.d.ts +2 -2
  25. package/dist/auth-email-password/web/verify-email-screen.js +14 -37
  26. package/dist/auth-foundation/boot-checks.js +24 -12
  27. package/dist/auth-foundation/boot-rules.d.ts +27 -0
  28. package/dist/auth-foundation/boot-rules.js +27 -0
  29. package/dist/auth-mfa/errors.d.ts +1 -1
  30. package/dist/auth-mfa/errors.js +11 -24
  31. package/dist/auth-mfa/feature-exports.js +6 -45
  32. package/dist/auth-mfa/feature.js +7 -18
  33. package/dist/auth-mfa/web/mfa-client.js +11 -25
  34. package/dist/billing-foundation/consumer-protection/termination-notify.js +1 -0
  35. package/dist/billing-foundation/web/plan-price.js +7 -8
  36. package/dist/cap-counter/stock-cap-guard.js +1 -0
  37. package/dist/channel-in-app/constants.d.ts +1 -0
  38. package/dist/channel-in-app/feature.js +2 -0
  39. package/dist/channel-in-app/handlers/read-state-by-keys.query.d.ts +9 -0
  40. package/dist/channel-in-app/handlers/read-state-by-keys.query.js +21 -0
  41. package/dist/channel-in-app/in-app-channel.js +1 -0
  42. package/dist/channel-in-app/tables.js +5 -1
  43. package/dist/compliance-profiles/handlers/sub-processors.query.js +4 -1
  44. package/dist/contact/challenge.d.ts +14 -0
  45. package/dist/contact/challenge.js +30 -0
  46. package/dist/contact/client/contact-client-source.d.ts +1 -0
  47. package/dist/contact/client/contact-client-source.js +203 -0
  48. package/dist/contact/client/contact-website-client.d.ts +26 -0
  49. package/dist/contact/client/contact-website-client.js +1 -0
  50. package/dist/contact/client/index.d.ts +2 -0
  51. package/dist/contact/client/index.js +1 -0
  52. package/dist/contact/entity.d.ts +777 -0
  53. package/dist/contact/entity.js +145 -0
  54. package/dist/contact/feature.d.ts +3 -0
  55. package/dist/contact/feature.js +134 -0
  56. package/dist/contact/handlers/access.d.ts +7 -0
  57. package/dist/contact/handlers/access.js +9 -0
  58. package/dist/contact/handlers/attempts.d.ts +14 -0
  59. package/dist/contact/handlers/attempts.js +54 -0
  60. package/dist/contact/handlers/challenge.query.d.ts +9 -0
  61. package/dist/contact/handlers/challenge.query.js +35 -0
  62. package/dist/contact/handlers/forward-request.write.d.ts +9 -0
  63. package/dist/contact/handlers/forward-request.write.js +61 -0
  64. package/dist/contact/handlers/mark-done.write.d.ts +7 -0
  65. package/dist/contact/handlers/mark-done.write.js +30 -0
  66. package/dist/contact/handlers/notify-reporter-in-app.write.d.ts +10 -0
  67. package/dist/contact/handlers/notify-reporter-in-app.write.js +36 -0
  68. package/dist/contact/handlers/open-count.d.ts +2 -0
  69. package/dist/contact/handlers/open-count.js +11 -0
  70. package/dist/contact/handlers/open-count.query.d.ts +3 -0
  71. package/dist/contact/handlers/open-count.query.js +13 -0
  72. package/dist/contact/handlers/replies.query.d.ts +11 -0
  73. package/dist/contact/handlers/replies.query.js +28 -0
  74. package/dist/contact/handlers/reply.write.d.ts +12 -0
  75. package/dist/contact/handlers/reply.write.js +118 -0
  76. package/dist/contact/handlers/report.write.d.ts +16 -0
  77. package/dist/contact/handlers/report.write.js +90 -0
  78. package/dist/contact/handlers/request-delivery.query.d.ts +16 -0
  79. package/dist/contact/handlers/request-delivery.query.js +85 -0
  80. package/dist/contact/handlers/request-detail.query.d.ts +41 -0
  81. package/dist/contact/handlers/request-detail.query.js +32 -0
  82. package/dist/contact/handlers/request-list.query.d.ts +2 -0
  83. package/dist/contact/handlers/request-list.query.js +9 -0
  84. package/dist/contact/handlers/send-reply-mail.write.d.ts +8 -0
  85. package/dist/contact/handlers/send-reply-mail.write.js +82 -0
  86. package/dist/contact/handlers/send-test.write.d.ts +5 -0
  87. package/dist/contact/handlers/send-test.write.js +36 -0
  88. package/dist/contact/handlers/submit.write.d.ts +20 -0
  89. package/dist/contact/handlers/submit.write.js +137 -0
  90. package/dist/contact/handlers/take-over-uploads.d.ts +9 -0
  91. package/dist/contact/handlers/take-over-uploads.js +33 -0
  92. package/dist/contact/i18n.d.ts +6 -0
  93. package/dist/contact/i18n.js +189 -0
  94. package/dist/contact/index.d.ts +5 -0
  95. package/dist/contact/index.js +4 -0
  96. package/dist/contact/lib.d.ts +101 -0
  97. package/dist/contact/lib.js +109 -0
  98. package/dist/contact/mail.d.ts +91 -0
  99. package/dist/contact/mail.js +279 -0
  100. package/dist/contact/options.d.ts +51 -0
  101. package/dist/contact/options.js +32 -0
  102. package/dist/contact/panels.d.ts +2 -0
  103. package/dist/contact/panels.js +21 -0
  104. package/dist/contact/payloads.d.ts +56 -0
  105. package/dist/contact/payloads.js +82 -0
  106. package/dist/contact/pow.d.ts +6 -0
  107. package/dist/contact/pow.js +19 -0
  108. package/dist/contact/screens.d.ts +5 -0
  109. package/dist/contact/screens.js +465 -0
  110. package/dist/contact/subject.d.ts +1 -0
  111. package/dist/contact/subject.js +13 -0
  112. package/dist/contact/user-agent.d.ts +1 -0
  113. package/dist/contact/user-agent.js +35 -0
  114. package/dist/contact/user-data-hooks.d.ts +3 -0
  115. package/dist/contact/user-data-hooks.js +129 -0
  116. package/dist/contact/web/constants.d.ts +127 -0
  117. package/dist/contact/web/constants.js +126 -0
  118. package/dist/contact/web/index.d.ts +1 -0
  119. package/dist/contact/web/index.js +1 -0
  120. package/dist/crypto-shredding/handlers/forget-subject.write.js +5 -13
  121. package/dist/data-retention/feature.js +16 -2
  122. package/dist/data-retention/index.d.ts +1 -0
  123. package/dist/data-retention/index.js +1 -0
  124. package/dist/data-retention/run-retention-cleanup.d.ts +14 -2
  125. package/dist/data-retention/run-retention-cleanup.js +102 -36
  126. package/dist/data-retention/tenant-destruction-hold.d.ts +23 -0
  127. package/dist/data-retention/tenant-destruction-hold.js +132 -0
  128. package/dist/delivery/address-opt-out.js +1 -0
  129. package/dist/delivery/channel-context.d.ts +1 -1
  130. package/dist/delivery/channel-context.js +2 -1
  131. package/dist/delivery/delivery-service.js +18 -8
  132. package/dist/delivery/events.d.ts +1 -0
  133. package/dist/delivery/events.js +2 -0
  134. package/dist/delivery/feature.js +3 -0
  135. package/dist/delivery/handlers/attempts-by-keys.query.d.ts +15 -0
  136. package/dist/delivery/handlers/attempts-by-keys.query.js +35 -0
  137. package/dist/delivery/handlers/log.query.d.ts +1 -0
  138. package/dist/delivery/handlers/log.query.js +1 -1
  139. package/dist/delivery/jobs.js +5 -2
  140. package/dist/delivery/tables.js +12 -2
  141. package/dist/delivery/types.d.ts +2 -0
  142. package/dist/delivery/unsubscribe-page.js +2 -0
  143. package/dist/delivery/web/delivery-channel-cell.js +1 -1
  144. package/dist/delivery/web/delivery-error-cell.js +1 -1
  145. package/dist/delivery/web/delivery-status-cell.js +1 -1
  146. package/dist/delivery/web/delivery-time-cell.js +3 -2
  147. package/dist/delivery/web/delivery-type-cell.js +1 -1
  148. package/dist/delivery/web/public-names.d.ts +1 -0
  149. package/dist/delivery/web/public-names.js +1 -0
  150. package/dist/document-ingest-foundation/boot-checks.js +19 -11
  151. package/dist/document-ingest-foundation/boot-rules.d.ts +17 -0
  152. package/dist/document-ingest-foundation/boot-rules.js +17 -0
  153. package/dist/document-ingest-foundation/events.d.ts +8 -0
  154. package/dist/document-ingest-foundation/events.js +12 -0
  155. package/dist/document-ingest-foundation/feature.js +30 -2
  156. package/dist/document-ingest-foundation/index.d.ts +3 -1
  157. package/dist/document-ingest-foundation/index.js +3 -1
  158. package/dist/document-ingest-foundation/report-ingest-progress.d.ts +14 -0
  159. package/dist/document-ingest-foundation/report-ingest-progress.js +20 -0
  160. package/dist/document-ingest-foundation/tables.d.ts +3 -0
  161. package/dist/document-ingest-foundation/tables.js +26 -0
  162. package/dist/file-derivatives/handlers/public-variant-by-file-ref.query.js +1 -1
  163. package/dist/file-derivatives/handlers/public-variant.query.js +1 -1
  164. package/dist/files-tenant-data/hooks.js +4 -1
  165. package/dist/folders/web/folder-manager.js +3 -10
  166. package/dist/folders/web/folder-section.js +1 -1
  167. package/dist/form-draft-user-data/index.js +4 -1
  168. package/dist/inbound-mail-foundation/entities.d.ts +3 -0
  169. package/dist/inbound-mail-foundation/entities.js +2 -0
  170. package/dist/inbound-mail-foundation/events.d.ts +2 -0
  171. package/dist/inbound-mail-foundation/events.js +2 -0
  172. package/dist/inbound-mail-foundation/feature.js +6 -6
  173. package/dist/inbound-mail-foundation/handlers/attach-message-content.write.js +3 -1
  174. package/dist/inbound-mail-foundation/handlers/ingest-message.write.js +5 -0
  175. package/dist/inbound-mail-foundation/handlers/list-messages.query.js +4 -2
  176. package/dist/inbound-mail-foundation/handlers/message-content.d.ts +1 -0
  177. package/dist/inbound-mail-foundation/handlers/message-content.js +8 -0
  178. package/dist/inbound-mail-foundation/handlers/message-content.query.d.ts +2 -0
  179. package/dist/inbound-mail-foundation/handlers/message-content.query.js +1 -0
  180. package/dist/inbound-mail-foundation/projection.d.ts +3 -0
  181. package/dist/inbound-mail-foundation/projection.js +2 -0
  182. package/dist/inbound-mail-foundation/sanitize-inbound-html.d.ts +2 -0
  183. package/dist/inbound-mail-foundation/sanitize-inbound-html.js +135 -0
  184. package/dist/inbound-mail-foundation/types.js +1 -0
  185. package/dist/jobs/job-run-logger.js +16 -20
  186. package/dist/ledger/handlers/reports.query.js +25 -27
  187. package/dist/ledger/recurring.js +1 -0
  188. package/dist/managed-pages/handlers/branding.query.js +1 -1
  189. package/dist/managed-pages/handlers/by-slug.query.js +1 -1
  190. package/dist/managed-pages/handlers/by-tenant-published.query.js +1 -1
  191. package/dist/notes-history/web/notes-section.js +3 -2
  192. package/dist/personal-access-tokens/feature.js +5 -18
  193. package/dist/personal-access-tokens/handlers/create.write.js +2 -5
  194. package/dist/secrets/handlers/delete.write.d.ts +4 -0
  195. package/dist/secrets/handlers/delete.write.js +9 -4
  196. package/dist/secrets/handlers/list.query.d.ts +6 -1
  197. package/dist/secrets/handlers/list.query.js +7 -3
  198. package/dist/secrets/handlers/set.write.d.ts +4 -0
  199. package/dist/secrets/handlers/set.write.js +10 -4
  200. package/dist/secrets/secret-scope.d.ts +17 -0
  201. package/dist/secrets/secret-scope.js +18 -0
  202. package/dist/seo/handlers/seo-config.query.js +1 -1
  203. package/dist/sessions/feature.d.ts +3 -0
  204. package/dist/sessions/feature.js +13 -19
  205. package/dist/sessions/handlers/last-activity-probe.query.d.ts +7 -0
  206. package/dist/sessions/handlers/last-activity-probe.query.js +40 -0
  207. package/dist/sessions/handlers/last-activity-probe.route.d.ts +2 -0
  208. package/dist/sessions/handlers/last-activity-probe.route.js +30 -0
  209. package/dist/sessions/screens.js +1 -0
  210. package/dist/sessions/session-callbacks.d.ts +2 -0
  211. package/dist/sessions/session-callbacks.js +9 -7
  212. package/dist/sessions/web/i18n.js +4 -1
  213. package/dist/shared/assert-billing-live.d.ts +2 -0
  214. package/dist/shared/assert-billing-live.js +7 -0
  215. package/dist/shared/collect-extension-options.d.ts +1 -0
  216. package/dist/shared/collect-extension-options.js +8 -0
  217. package/dist/shared/index.d.ts +7 -1
  218. package/dist/shared/index.js +7 -1
  219. package/dist/shared/late-bound-slot.d.ts +5 -0
  220. package/dist/shared/late-bound-slot.js +13 -0
  221. package/dist/shared/mail-locale-templates.d.ts +1 -0
  222. package/dist/shared/mail-locale-templates.js +1 -1
  223. package/dist/shared/price-env-shape.d.ts +11 -0
  224. package/dist/shared/price-env-shape.js +15 -0
  225. package/dist/shared/purge-row-file-refs.d.ts +1 -0
  226. package/dist/shared/purge-row-file-refs.js +1 -1
  227. package/dist/shared/read-feature-export-fn.d.ts +2 -0
  228. package/dist/shared/read-feature-export-fn.js +11 -0
  229. package/dist/shared/signup-handover.js +3 -5
  230. package/dist/shared/tenant-destruction-hold.d.ts +23 -0
  231. package/dist/shared/tenant-destruction-hold.js +15 -0
  232. package/dist/shared/unprocessable.d.ts +4 -0
  233. package/dist/shared/unprocessable.js +4 -0
  234. package/dist/shared/web/index.d.ts +3 -0
  235. package/dist/shared/web/index.js +3 -0
  236. package/dist/subscription-paddle/checkout-config.query.js +1 -1
  237. package/dist/subscription-paddle/feature.d.ts +1 -5
  238. package/dist/subscription-paddle/feature.js +7 -9
  239. package/dist/subscription-paddle/runtime.js +3 -7
  240. package/dist/subscription-stripe/feature.d.ts +1 -5
  241. package/dist/subscription-stripe/feature.js +7 -9
  242. package/dist/subscription-stripe/runtime.js +3 -7
  243. package/dist/tags/entity.js +1 -0
  244. package/dist/tags/web/tag-chip.d.ts +7 -0
  245. package/dist/tags/web/tag-chip.js +4 -0
  246. package/dist/tags/web/tag-filter.js +2 -5
  247. package/dist/tags/web/tag-manager.js +1 -1
  248. package/dist/tags/web/tag-section.js +3 -6
  249. package/dist/tags/web/tags-cell.js +2 -5
  250. package/dist/template-resolver/compile-document-body.js +12 -17
  251. package/dist/template-resolver/handlers/by-slug.query.js +1 -1
  252. package/dist/template-resolver/handlers/by-tenant.query.js +4 -2
  253. package/dist/template-resolver/handlers/discard-draft.write.js +1 -0
  254. package/dist/template-resolver/handlers/overview.query.js +3 -1
  255. package/dist/template-resolver/handlers/send-test.write.js +2 -4
  256. package/dist/template-resolver/handlers/toggle-status.write.js +3 -0
  257. package/dist/template-resolver/linked-resources.js +6 -5
  258. package/dist/template-resolver/store-template-resource.js +5 -10
  259. package/dist/template-resolver/web/document-images.js +6 -6
  260. package/dist/template-resolver/web/document-insert-fields.js +22 -4
  261. package/dist/template-resolver/web/document-schema.js +11 -12
  262. package/dist/template-resolver/web/tiptap-attribute-parse-rule.d.ts +15 -0
  263. package/dist/template-resolver/web/tiptap-attribute-parse-rule.js +11 -0
  264. package/dist/tenant/i18n.js +3 -0
  265. package/dist/tenant/schema/tenant.d.ts +9 -7
  266. package/dist/tenant/schema/tenant.js +1 -0
  267. package/dist/tenant/web/member-roles-cell.js +1 -1
  268. package/dist/tenant/web/member-status-cell.js +1 -1
  269. package/dist/tenant-inactivity/check-inactive-tenants.d.ts +3 -0
  270. package/dist/tenant-inactivity/check-inactive-tenants.js +184 -0
  271. package/dist/tenant-inactivity/constants.d.ts +10 -0
  272. package/dist/tenant-inactivity/constants.js +10 -0
  273. package/dist/tenant-inactivity/email-templates.d.ts +3 -0
  274. package/dist/tenant-inactivity/email-templates.js +16 -0
  275. package/dist/tenant-inactivity/feature.d.ts +8 -0
  276. package/dist/tenant-inactivity/feature.js +45 -0
  277. package/dist/tenant-inactivity/handlers/inactivity-state.query.d.ts +11 -0
  278. package/dist/tenant-inactivity/handlers/inactivity-state.query.js +45 -0
  279. package/dist/tenant-inactivity/handlers/keep-account.write.d.ts +8 -0
  280. package/dist/tenant-inactivity/handlers/keep-account.write.js +51 -0
  281. package/dist/tenant-inactivity/inactivity-plan.d.ts +51 -0
  282. package/dist/tenant-inactivity/inactivity-plan.js +113 -0
  283. package/dist/tenant-inactivity/index.d.ts +5 -0
  284. package/dist/tenant-inactivity/index.js +3 -0
  285. package/dist/tenant-inactivity/keep-token.d.ts +16 -0
  286. package/dist/tenant-inactivity/keep-token.js +24 -0
  287. package/dist/tenant-inactivity/mail-notifications.d.ts +4 -0
  288. package/dist/tenant-inactivity/mail-notifications.js +42 -0
  289. package/dist/tenant-inactivity/options.d.ts +27 -0
  290. package/dist/tenant-inactivity/options.js +5 -0
  291. package/dist/tenant-inactivity/remote-activity.d.ts +15 -0
  292. package/dist/tenant-inactivity/remote-activity.js +24 -0
  293. package/dist/tenant-inactivity/state-store.d.ts +10 -0
  294. package/dist/tenant-inactivity/state-store.js +50 -0
  295. package/dist/tenant-inactivity/state-table.d.ts +109 -0
  296. package/dist/tenant-inactivity/state-table.js +38 -0
  297. package/dist/tenant-lifecycle/boot-checks.js +8 -3
  298. package/dist/tenant-lifecycle/boot-rules.d.ts +12 -0
  299. package/dist/tenant-lifecycle/boot-rules.js +12 -0
  300. package/dist/tenant-lifecycle/feature.js +17 -2
  301. package/dist/tenant-lifecycle/handlers/request-destruction.write.js +11 -67
  302. package/dist/tenant-lifecycle/index.d.ts +1 -0
  303. package/dist/tenant-lifecycle/index.js +1 -0
  304. package/dist/tenant-lifecycle/request-tenant-destruction.d.ts +20 -0
  305. package/dist/tenant-lifecycle/request-tenant-destruction.js +66 -0
  306. package/dist/tenant-lifecycle/retention-config-destroy-hooks.d.ts +5 -0
  307. package/dist/tenant-lifecycle/retention-config-destroy-hooks.js +29 -0
  308. package/dist/tenant-lifecycle/run-tenant-destroy.d.ts +3 -0
  309. package/dist/tenant-lifecycle/run-tenant-destroy.js +43 -5
  310. package/dist/tenant-lifecycle/stages.d.ts +2 -0
  311. package/dist/tenant-lifecycle/stages.js +23 -2
  312. package/dist/tenant-lifecycle/testing.js +1 -1
  313. package/dist/tier-engine/caps-for-tier-from-map.d.ts +5 -0
  314. package/dist/tier-engine/caps-for-tier-from-map.js +12 -0
  315. package/dist/tier-engine/compose-app.d.ts +0 -22
  316. package/dist/tier-engine/compose-app.js +9 -16
  317. package/dist/tier-engine/index.d.ts +1 -0
  318. package/dist/tier-engine/index.js +1 -0
  319. package/dist/user/handlers/detail.query.d.ts +1 -1
  320. package/dist/user-data-rights/feature.js +2 -0
  321. package/dist/user-data-rights/handlers/confirm-deletion-by-token.write.js +4 -1
  322. package/dist/user-data-rights/handlers/download-by-token.query.js +1 -0
  323. package/dist/user-data-rights/handlers/request-deletion-by-email.write.js +4 -1
  324. package/dist/user-data-rights/run-forget-cleanup.js +2 -0
  325. package/dist/user-data-rights/web/privacy-center-screen.js +1 -1
  326. package/dist/user-data-rights/zip-path.js +1 -0
  327. package/dist/user-data-rights-defaults/hooks/config-value.userdata-hook.d.ts +1 -1
  328. package/dist/user-data-rights-defaults/hooks/config-value.userdata-hook.js +7 -20
  329. package/dist/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.js +3 -1
  330. package/dist/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.d.ts +10 -0
  331. package/dist/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.js +26 -0
  332. package/dist/user-data-rights-defaults/hooks/notification-preference.userdata-hook.d.ts +1 -1
  333. package/dist/user-data-rights-defaults/hooks/notification-preference.userdata-hook.js +7 -20
  334. package/dist/user-profile/handlers/change-email.write.js +2 -4
  335. package/dist/user-profile/web/profile-screen.js +2 -3
  336. package/dist/waitlist/handlers/submit.write.js +1 -2
  337. package/kumiko-es-tables.json +12 -0
  338. package/package.json +54 -12
  339. package/src/admin-shell/changes.json +6 -0
  340. package/src/agent-tools/changes.json +6 -0
  341. package/src/channel-in-app/changes.json +7 -0
  342. package/src/contact/changes.json +33 -0
  343. package/src/data-retention/changes.json +6 -0
  344. package/src/delivery/changes.json +7 -0
  345. package/src/document-ingest-foundation/changes.json +6 -0
  346. package/src/files-tenant-data/changes.json +6 -0
  347. package/src/inbound-mail-foundation/changes.json +13 -0
  348. package/src/secrets/changes.json +6 -0
  349. package/src/sessions/changes.json +6 -0
  350. package/src/tenant-inactivity/changes.json +8 -0
  351. package/src/tenant-lifecycle/changes.json +18 -0
  352. package/src/tier-engine/changes.json +6 -0
  353. package/src/waitlist/changes.json +6 -0
@@ -1,9 +1,11 @@
1
1
  import { EXT_SESSION_STORE, } from "@cosmicdrift/kumiko-bundled-features/auth-foundation";
2
2
  import { deriveEntityTableMeta } from "@cosmicdrift/kumiko-framework/db";
3
3
  import { access, defineFeature, } from "@cosmicdrift/kumiko-framework/engine";
4
+ import { createLateBoundSlot, readFeatureExportFn } from "../shared/index.js";
4
5
  import { USER_SESSION_ENTITY_NAME } from "./constants.js";
5
6
  import { cleanupJob } from "./handlers/cleanup.job.js";
6
7
  import { createDetailQuery } from "./handlers/detail.query.js";
8
+ import { registerLastActivityProbe } from "./handlers/last-activity-probe.route.js";
7
9
  import { createListQuery } from "./handlers/list.query.js";
8
10
  import { mineQuery } from "./handlers/mine.query.js";
9
11
  import { revokeWrite } from "./handlers/revoke.write.js";
@@ -20,15 +22,7 @@ const CLEANUP_ESCAPE_HATCH_REASON = "deletes expired session rows of every tenan
20
22
  // itself is constructed in app run-config long before a db exists, so the
21
23
  // revoker can't be a constructor argument.
22
24
  export function bindAutoRevokeFromFeature(feature) {
23
- const exports = feature.exports;
24
- if (exports && typeof exports === "object" && "bindAutoRevokeOnPasswordChange" in exports) {
25
- const { bindAutoRevokeOnPasswordChange } = exports;
26
- if (typeof bindAutoRevokeOnPasswordChange === "function") {
27
- // @cast-boundary feature-exports — feature.exports is untyped by design
28
- return bindAutoRevokeOnPasswordChange;
29
- }
30
- }
31
- return undefined;
25
+ return readFeatureExportFn(feature, "bindAutoRevokeOnPasswordChange");
32
26
  }
33
27
  // The sessions feature registers the store_user_sessions table (as an
34
28
  // unmanaged direct-write store, NOT an r.entity — see below) and the three
@@ -85,6 +79,7 @@ export function createSessionsFeature(options) {
85
79
  const callbacks = createSessionCallbacks({
86
80
  db: deps.db,
87
81
  ...(options?.expiresInMs !== undefined && { expiresInMs: options.expiresInMs }),
82
+ ...(options?.clock !== undefined && { clock: options.clock }),
88
83
  });
89
84
  return {
90
85
  creator: callbacks.sessionCreator,
@@ -125,6 +120,9 @@ export function createSessionsFeature(options) {
125
120
  escapeHatch: { reason: CLEANUP_ESCAPE_HATCH_REASON },
126
121
  handler: (payload, ctx) => cleanupJob(payload, ctx, ctx.db.unsafeRaw()),
127
122
  });
123
+ const probeSecret = options?.lastActivityProbeSecret;
124
+ if (probeSecret !== undefined)
125
+ registerLastActivityProbe(r, probeSecret);
128
126
  // Cross-feature entity hook on "user". `r.entityHook` (NOT `r.hook`) is
129
127
  // the supported cross-feature path: entity-keyed, not prefixed by the
130
128
  // registering feature. Fires after every successful write on any
@@ -147,12 +145,12 @@ export function createSessionsFeature(options) {
147
145
  // Explicit option wins; the runtime binding is replaceable so a second boot of the same
148
146
  // feature instance (a new app or test stack in one process) binds its own database.
149
147
  const explicitAutoRevoke = options?.autoRevokeOnPasswordChange;
150
- let boundAutoRevoke;
148
+ const autoRevokeSlot = createLateBoundSlot();
151
149
  r.hook({
152
150
  type: "postSave",
153
151
  target: { allOf: "user" },
154
152
  handler: async (ctx) => {
155
- const autoRevoke = explicitAutoRevoke ?? boundAutoRevoke;
153
+ const autoRevoke = explicitAutoRevoke ?? autoRevokeSlot.current();
156
154
  // skip: nothing bound — stateless-JWT deployments without a runtime
157
155
  // that calls bindAutoRevokeOnPasswordChange keep the old behavior.
158
156
  if (!autoRevoke)
@@ -169,13 +167,7 @@ export function createSessionsFeature(options) {
169
167
  await autoRevoke(String(ctx.id));
170
168
  },
171
169
  });
172
- const bindAutoRevokeOnPasswordChange = (revoker) => {
173
- boundAutoRevoke = revoker;
174
- return () => {
175
- if (boundAutoRevoke === revoker)
176
- boundAutoRevoke = undefined;
177
- };
178
- };
170
+ const bindAutoRevokeOnPasswordChange = autoRevokeSlot.bind;
179
171
  r.translations({ keys: SESSIONS_I18N });
180
172
  r.screen(createSessionListScreen(adminRoles));
181
173
  r.screen(createSessionDetailScreen(adminRoles));
@@ -188,5 +180,7 @@ export function createSessionsFeature(options) {
188
180
  order: 10,
189
181
  });
190
182
  return { handlers, queries, bindAutoRevokeOnPasswordChange };
191
- }, { dedupeOptions: options ?? {} });
183
+ },
184
+ // A clock object is not a comparable dedupe option; a stack that injects one never dedupes.
185
+ options?.clock === undefined ? { dedupeOptions: options ?? {} } : undefined);
192
186
  }
@@ -0,0 +1,7 @@
1
+ import * as z from "zod";
2
+ export declare const LAST_ACTIVITY_PROBE_QUERY = "sessions:query:last-activity-probe";
3
+ export declare function createLastActivityProbeQuery(secret: string): import("@cosmicdrift/kumiko-types/define-handler").QueryHandlerDefinition<"last-activity-probe", z.ZodObject<{
4
+ bearerToken: z.ZodString;
5
+ }, z.core.$strip>, {
6
+ lastActivityAt: string | null;
7
+ }, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap>;
@@ -0,0 +1,40 @@
1
+ import { timingSafeEqual } from "node:crypto";
2
+ import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
3
+ import { AccessDeniedError, InternalError } from "@cosmicdrift/kumiko-framework/errors";
4
+ import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
5
+ import * as z from "zod";
6
+ import { userSessionTable } from "../schema/user-session.js";
7
+ export const LAST_ACTIVITY_PROBE_QUERY = "sessions:query:last-activity-probe";
8
+ const EPOCH = Temporal.Instant.fromEpochMilliseconds(0);
9
+ const PROBE_ESCAPE_HATCH_REASON = "answers one sibling app with the newest session activity across every tenant of this app, guarded by a shared secret";
10
+ function secretsMatch(provided, expected) {
11
+ const providedBytes = Buffer.from(provided);
12
+ const expectedBytes = Buffer.from(expected);
13
+ return (providedBytes.length === expectedBytes.length && timingSafeEqual(providedBytes, expectedBytes));
14
+ }
15
+ // The route's systemQuery runs as an anonymous user, so the query must accept that role. The
16
+ // secret is checked here as well as in the route, so no other dispatch path that reaches the
17
+ // query can expose the app-wide activity time without it.
18
+ export function createLastActivityProbeQuery(secret) {
19
+ return defineQueryHandler({
20
+ name: "last-activity-probe",
21
+ schema: z.object({ bearerToken: z.string().min(1).max(512) }),
22
+ access: { roles: ["anonymous"] },
23
+ agent: { expose: false },
24
+ rateLimit: { per: "ip", limit: 30, windowSeconds: 60 },
25
+ escapeHatch: { grants: ["crossTenantReads"], reason: PROBE_ESCAPE_HATCH_REASON },
26
+ description: "Returns the newest session activity time across every tenant of this app to a sibling app that presents the shared probe secret.",
27
+ handler: async (query, ctx) => {
28
+ if (!secretsMatch(query.payload.bearerToken, secret)) {
29
+ throw new AccessDeniedError();
30
+ }
31
+ if (!ctx.crossTenantReads) {
32
+ throw new InternalError({
33
+ message: "sessions last-activity probe: crossTenantReads missing",
34
+ });
35
+ }
36
+ const [newest] = await ctx.crossTenantReads.selectMany(userSessionTable, { lastSeenAt: { gte: EPOCH } }, { limit: 1, orderBy: { col: "lastSeenAt", direction: "desc" } });
37
+ return { lastActivityAt: newest ? newest.lastSeenAt.toString() : null };
38
+ },
39
+ });
40
+ }
@@ -0,0 +1,2 @@
1
+ import { type FeatureRegistrar } from "@cosmicdrift/kumiko-framework/engine";
2
+ export declare function registerLastActivityProbe(r: FeatureRegistrar, secret: string): void;
@@ -0,0 +1,30 @@
1
+ import { SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { createLastActivityProbeQuery, LAST_ACTIVITY_PROBE_QUERY, } from "./last-activity-probe.query.js";
3
+ // The route is reachable anonymously, so a short secret would be guessable within the rate limit.
4
+ const MIN_PROBE_SECRET_LENGTH = 32;
5
+ export function registerLastActivityProbe(r, secret) {
6
+ if (secret.length < MIN_PROBE_SECRET_LENGTH) {
7
+ throw new Error(`sessions: lastActivityProbeSecret must be at least ${MIN_PROBE_SECRET_LENGTH} characters`);
8
+ }
9
+ r.queryHandler(createLastActivityProbeQuery(secret));
10
+ r.httpRoute({
11
+ method: "GET",
12
+ // A string literal so feature-ast can read the route; r.httpRoute paths stay outside /api/*.
13
+ path: "/sessions/last-activity",
14
+ anonymous: true,
15
+ rateLimit: { per: "ip+handler", limit: 30, windowSeconds: 60 },
16
+ handler: async (c, { systemQuery }) => {
17
+ const bearerToken = /^Bearer (.+)$/.exec(c.req.header("authorization") ?? "")?.[1];
18
+ if (bearerToken === undefined)
19
+ return c.body(null, 401);
20
+ try {
21
+ const answer = await systemQuery(LAST_ACTIVITY_PROBE_QUERY, { bearerToken }, SYSTEM_TENANT_ID);
22
+ return c.json(answer);
23
+ }
24
+ catch {
25
+ // Wrong secret and any handler failure look the same to the caller.
26
+ return c.body(null, 401);
27
+ }
28
+ },
29
+ });
30
+ }
@@ -98,6 +98,7 @@ export const createSessionDetailScreen = (adminRoles = access.admin) => ({
98
98
  export const sessionMineScreen = {
99
99
  id: SESSION_MINE_SCREEN_ID,
100
100
  type: "projectionList",
101
+ description: i18nKey("sessions.mine.description"),
101
102
  query: SessionQueries.mine,
102
103
  columns: [
103
104
  {
@@ -1,10 +1,12 @@
1
1
  import type { SessionChecker, SessionCreator, SessionMassRevoker, SessionRevoker } from "@cosmicdrift/kumiko-framework/api";
2
2
  export type { SessionMassRevoker } from "@cosmicdrift/kumiko-framework/api";
3
3
  import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
4
+ import type { Clock } from "@cosmicdrift/kumiko-types/tz-context";
4
5
  export type SessionAllOthersRevoker = (userId: string, currentSid: string | undefined) => Promise<number>;
5
6
  export type SessionCallbacksOptions = {
6
7
  readonly db: DbConnection;
7
8
  readonly expiresInMs?: number;
9
+ readonly clock?: Clock;
8
10
  };
9
11
  export type SessionCallbacks = {
10
12
  sessionCreator: SessionCreator;
@@ -9,16 +9,18 @@ import { isPrincipalRowBlocked, userTable } from "../user/index.js";
9
9
  import { DEFAULT_SESSION_EXPIRY_MS, LAST_SEEN_REFRESH_MS, USER_SESSION_ENTITY_NAME, } from "./constants.js";
10
10
  import { userSessionEntity, userSessionTable } from "./schema/user-session.js";
11
11
  import { SESSION_REVOKED_AGGREGATE_TYPE, SESSION_REVOKED_EVENT_QN, sessionRevokedSchema, } from "./session-revoked-event.js";
12
+ const realClock = { now: () => Temporal.Now.instant() };
12
13
  function settleLookup(lookup) {
13
14
  return lookup.then((value) => ({ ok: true, value }), () => ({ ok: false }));
14
15
  }
15
16
  export function createSessionCallbacks(opts) {
16
17
  const ttlMs = opts.expiresInMs ?? DEFAULT_SESSION_EXPIRY_MS;
17
18
  const { db } = opts;
19
+ const clock = opts.clock ?? realClock;
18
20
  return {
19
21
  async sessionCreator(user, meta) {
20
22
  const sid = generateId();
21
- const now = Temporal.Now.instant();
23
+ const now = clock.now();
22
24
  const expiresAt = now.add({ milliseconds: ttlMs });
23
25
  await insertOne(db, userSessionTable, await encryptForDirectWrite(userSessionEntity, USER_SESSION_ENTITY_NAME, {
24
26
  id: sid,
@@ -42,7 +44,7 @@ export function createSessionCallbacks(opts) {
42
44
  // retried logout would match no live row (revokedAt IS NULL) and never
43
45
  // emit the event, leaving the SSE stream of this sid open until JWT expiry.
44
46
  await transaction(db, async (tx) => {
45
- const result = await updateMany(tx, userSessionTable, { revokedAt: Temporal.Now.instant() }, { id: sid, revokedAt: null });
47
+ const result = await updateMany(tx, userSessionTable, { revokedAt: clock.now() }, { id: sid, revokedAt: null });
46
48
  // This is the ONLY caller of sessionRevoker — logout and tenant-switch
47
49
  // — so it's also the only source of streamScope: "revoked-sessions".
48
50
  // Without this append, a live SSE stream on this exact sid outlives its
@@ -89,7 +91,7 @@ export function createSessionCallbacks(opts) {
89
91
  return "revoked";
90
92
  // Temporal-native clock read (Sprint F migration) — keeps the feature
91
93
  // free of raw Date.now() for consistency with the rest of the codebase.
92
- if (row.expiresAt.epochMilliseconds <= Temporal.Now.instant().epochMilliseconds) {
94
+ if (row.expiresAt.epochMilliseconds <= clock.now().epochMilliseconds) {
93
95
  return "expired";
94
96
  }
95
97
  // Membership is keyed by the session's tenantId, so it can only start now;
@@ -100,10 +102,10 @@ export function createSessionCallbacks(opts) {
100
102
  }));
101
103
  // Hourly, not per-request: this check runs on every authenticated
102
104
  // request, so a write here has to stay off the hot path.
103
- const nowMs = Temporal.Now.instant().epochMilliseconds;
105
+ const nowMs = clock.now().epochMilliseconds;
104
106
  if (!row.lastSeenAt || row.lastSeenAt.epochMilliseconds + LAST_SEEN_REFRESH_MS <= nowMs) {
105
107
  try {
106
- await updateMany(db, userSessionTable, { lastSeenAt: Temporal.Now.instant() }, { id: sid });
108
+ await updateMany(db, userSessionTable, { lastSeenAt: clock.now() }, { id: sid });
107
109
  }
108
110
  catch {
109
111
  // fail-open: a refresh failure must not block the session check
@@ -151,7 +153,7 @@ export function createSessionCallbacks(opts) {
151
153
  // One transaction, same reason as sessionRevoker: a failed append must
152
154
  // not leave sessions revoked without the event.
153
155
  return transaction(db, async (tx) => {
154
- const result = await updateMany(tx, userSessionTable, { revokedAt: Temporal.Now.instant() }, { userId, revokedAt: null });
156
+ const result = await updateMany(tx, userSessionTable, { revokedAt: clock.now() }, { userId, revokedAt: null });
155
157
  // Lightweight append alongside the direct-write above, same pattern
156
158
  // as revoke.write.ts — this callback is the password-change
157
159
  // auto-revoke path (sessions/feature.ts postSave hook) and has no
@@ -180,7 +182,7 @@ export function createSessionCallbacks(opts) {
180
182
  },
181
183
  async sessionRevokeAllOthers(userId, currentSid) {
182
184
  return transaction(db, async (tx) => {
183
- const result = await updateMany(tx, userSessionTable, { revokedAt: Temporal.Now.instant() }, currentSid
185
+ const result = await updateMany(tx, userSessionTable, { revokedAt: clock.now() }, currentSid
184
186
  ? { userId, revokedAt: null, id: { ne: currentSid } }
185
187
  : { userId, revokedAt: null });
186
188
  // Same reasoning as sessionMassRevoker above — this raw callback
@@ -16,7 +16,10 @@ export const SESSIONS_I18N = {
16
16
  "sessions.detail.field.revokedAt": { en: "Revoked" },
17
17
  "sessions.detail.field.ip": { en: "IP address" },
18
18
  "sessions.detail.field.userAgent": { en: "User agent" },
19
- "screen:my-sessions.title": { en: "Your sessions" },
19
+ "screen:my-sessions.title": { en: "Signed-in devices" },
20
+ "sessions.mine.description": {
21
+ en: "Devices you are currently signed in on. Sign out unfamiliar devices here.",
22
+ },
20
23
  "sessions.mine.col.ip": { en: "IP address" },
21
24
  "sessions.mine.col.userAgent": { en: "Device" },
22
25
  "sessions.mine.col.current": { en: "Session" },
@@ -0,0 +1,2 @@
1
+ import type { ConfigKeyHandle, HandlerContext } from "@cosmicdrift/kumiko-framework/engine";
2
+ export declare function assertBillingLive(ctx: HandlerContext, billingLiveHandle: ConfigKeyHandle<"boolean">, featureName: string, handlerName: string): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { FeatureDisabledError } from "@cosmicdrift/kumiko-framework/errors";
2
+ export async function assertBillingLive(ctx, billingLiveHandle, featureName, handlerName) {
3
+ const live = ctx.config ? await ctx.config(billingLiveHandle) : undefined;
4
+ if (live !== true) {
5
+ throw new FeatureDisabledError(featureName, handlerName);
6
+ }
7
+ }
@@ -2,3 +2,4 @@ import type { Registry } from "@cosmicdrift/kumiko-framework/engine";
2
2
  export declare function collectExtensionOptions<TOptions extends object>(registry: Registry, extension: string, isOptions: (candidate: unknown) => candidate is TOptions): Array<{
3
3
  name: string;
4
4
  } & TOptions>;
5
+ export declare function findExtensionOptions<TOptions extends object>(registry: Registry, extension: string, isOptions: (candidate: unknown) => candidate is TOptions): TOptions | undefined;
@@ -6,3 +6,11 @@ export function collectExtensionOptions(registry, extension, isOptions) {
6
6
  return { name: usage.entityName, ...usage.options };
7
7
  });
8
8
  }
9
+ // Optional single-provider extension points: a usage with foreign options is skipped, not an error.
10
+ export function findExtensionOptions(registry, extension, isOptions) {
11
+ for (const usage of registry.getExtensionUsages(extension)) {
12
+ if (isOptions(usage.options))
13
+ return usage.options;
14
+ }
15
+ return undefined;
16
+ }
@@ -1,3 +1,4 @@
1
+ export { assertBillingLive } from "./assert-billing-live.ts";
1
2
  export { collectErasureFailure, throwIfErasureFailed } from "./assert-erased.ts";
2
3
  export { assertNoWhereRuleInOwnershipWrite } from "./assert-no-where-rule-in-ownership-write.ts";
3
4
  export { attachmentFileNameSchema, sanitizePdfAttachmentFileName, } from "./attachment-file-name.ts";
@@ -12,15 +13,18 @@ export { hmacSignatureMatches, signHmacSha256Base64Url } from "./hmac-signature.
12
13
  export { isIdentityV3Hash, verifyIdentityV3Hash } from "./identity-v3-hash.ts";
13
14
  export { isTenantDb } from "./is-tenant-db.ts";
14
15
  export { isUniqueConstraintFailure } from "./is-unique-constraint-failure.ts";
16
+ export { createLateBoundSlot, type LateBoundSlot } from "./late-bound-slot.ts";
15
17
  export { createLockoutCounter, type LockoutCounterState } from "./lockout-counter.ts";
16
18
  export { createMailLocaleTemplates } from "./mail-locale-templates.ts";
17
19
  export { mailHeading, mailParagraph, mailParagraphWithLink, mailRepeatedRows, } from "./mail-template-body.ts";
18
20
  export { mapWithConcurrency } from "./map-with-concurrency.ts";
19
21
  export { denyUnlessJoinRowParentVisible, hostRowIsGone, joinRowParentIsVisible, parentRowIsVisible, } from "./parent-visibility.ts";
20
22
  export { hashPassword, verifyDummyPassword, verifyPassword } from "./password-hashing.ts";
23
+ export { type PriceEnvProvider, type PriceEnvShape, priceEnvSchema, priceEnvShape, } from "./price-env-shape.ts";
21
24
  export { type DeleteFileBytes, FileSweepError, type MissingStoragePolicy, purgeFilesReachingSubject, } from "./purge-files-reaching-subject.ts";
22
- export { collectSingleFileHolders, type FileFieldPlan, type FileRefPurgeOutcome, planFileFields, purgeRowFileRefs, type SingleFileHolder, } from "./purge-row-file-refs.ts";
25
+ export { collectFileRefIds, collectSingleFileHolders, type FileFieldPlan, type FileRefPurgeOutcome, planFileFields, purgeRowFileRefs, type SingleFileHolder, } from "./purge-row-file-refs.ts";
23
26
  export { rateLimitedTextResponse } from "./rate-limited-text-response.ts";
27
+ export { readFeatureExportFn } from "./read-feature-export-fn.ts";
24
28
  export { redactBotTokens, redactEmailAddresses, redactErrorText, redactUrls, } from "./redact.ts";
25
29
  export { REDACTED_PII_PLACEHOLDER, redactPiiCiphertext } from "./redact-pii-ciphertext.ts";
26
30
  export { requireForTenant } from "./require-for-tenant.ts";
@@ -38,4 +42,6 @@ export { backfillAggregateStreamTenants, type StreamBackfillCandidate, type Stre
38
42
  export { createSearchBucketCleanup, type DerivedStateMode, rebuildAndReindex, type StreamBackfillStepFailure, stepFailures, } from "./stream-tenant-derived-state.ts";
39
43
  export type { SystemQueryFn } from "./system-query.ts";
40
44
  export { createTenantDbCache } from "./tenant-db-cache.ts";
45
+ export { EXT_TENANT_DESTRUCTION_HOLD, findTenantDestructionHoldProvider, type TenantDestructionHoldProvider, } from "./tenant-destruction-hold.ts";
41
46
  export { type BurnResult, burnToken, unburnToken } from "./token-burn-store.ts";
47
+ export { unprocessable } from "./unprocessable.ts";
@@ -1,3 +1,4 @@
1
+ export { assertBillingLive } from "./assert-billing-live.js";
1
2
  export { collectErasureFailure, throwIfErasureFailed } from "./assert-erased.js";
2
3
  export { assertNoWhereRuleInOwnershipWrite } from "./assert-no-where-rule-in-ownership-write.js";
3
4
  export { attachmentFileNameSchema, sanitizePdfAttachmentFileName, } from "./attachment-file-name.js";
@@ -12,15 +13,18 @@ export { hmacSignatureMatches, signHmacSha256Base64Url } from "./hmac-signature.
12
13
  export { isIdentityV3Hash, verifyIdentityV3Hash } from "./identity-v3-hash.js";
13
14
  export { isTenantDb } from "./is-tenant-db.js";
14
15
  export { isUniqueConstraintFailure } from "./is-unique-constraint-failure.js";
16
+ export { createLateBoundSlot } from "./late-bound-slot.js";
15
17
  export { createLockoutCounter } from "./lockout-counter.js";
16
18
  export { createMailLocaleTemplates } from "./mail-locale-templates.js";
17
19
  export { mailHeading, mailParagraph, mailParagraphWithLink, mailRepeatedRows, } from "./mail-template-body.js";
18
20
  export { mapWithConcurrency } from "./map-with-concurrency.js";
19
21
  export { denyUnlessJoinRowParentVisible, hostRowIsGone, joinRowParentIsVisible, parentRowIsVisible, } from "./parent-visibility.js";
20
22
  export { hashPassword, verifyDummyPassword, verifyPassword } from "./password-hashing.js";
23
+ export { priceEnvSchema, priceEnvShape, } from "./price-env-shape.js";
21
24
  export { FileSweepError, purgeFilesReachingSubject, } from "./purge-files-reaching-subject.js";
22
- export { collectSingleFileHolders, planFileFields, purgeRowFileRefs, } from "./purge-row-file-refs.js";
25
+ export { collectFileRefIds, collectSingleFileHolders, planFileFields, purgeRowFileRefs, } from "./purge-row-file-refs.js";
23
26
  export { rateLimitedTextResponse } from "./rate-limited-text-response.js";
27
+ export { readFeatureExportFn } from "./read-feature-export-fn.js";
24
28
  export { redactBotTokens, redactEmailAddresses, redactErrorText, redactUrls, } from "./redact.js";
25
29
  export { REDACTED_PII_PLACEHOLDER, redactPiiCiphertext } from "./redact-pii-ciphertext.js";
26
30
  export { requireForTenant } from "./require-for-tenant.js";
@@ -37,4 +41,6 @@ export { createSingleUseTokenStore, hashSingleUseToken } from "./single-use-toke
37
41
  export { backfillAggregateStreamTenants, } from "./stream-tenant-backfill.js";
38
42
  export { createSearchBucketCleanup, rebuildAndReindex, stepFailures, } from "./stream-tenant-derived-state.js";
39
43
  export { createTenantDbCache } from "./tenant-db-cache.js";
44
+ export { EXT_TENANT_DESTRUCTION_HOLD, findTenantDestructionHoldProvider, } from "./tenant-destruction-hold.js";
40
45
  export { burnToken, unburnToken } from "./token-burn-store.js";
46
+ export { unprocessable } from "./unprocessable.js";
@@ -0,0 +1,5 @@
1
+ export type LateBoundSlot<TValue> = {
2
+ readonly bind: (value: TValue) => () => void;
3
+ readonly current: () => TValue | undefined;
4
+ };
5
+ export declare function createLateBoundSlot<TValue>(): LateBoundSlot<TValue>;
@@ -0,0 +1,13 @@
1
+ export function createLateBoundSlot() {
2
+ let bound;
3
+ return {
4
+ bind: (value) => {
5
+ bound = value;
6
+ return () => {
7
+ if (bound === value)
8
+ bound = undefined;
9
+ };
10
+ },
11
+ current: () => bound,
12
+ };
13
+ }
@@ -4,6 +4,7 @@ type MailLocaleTemplateConfig<Kind extends string> = {
4
4
  readonly notificationTypes: Readonly<Record<Kind, string>>;
5
5
  readonly subjectKey: (kind: Kind) => string;
6
6
  readonly bodyFor: (kind: Kind, locale: string) => string;
7
+ readonly subjectSlots?: (kind: Kind) => Readonly<Record<string, string>>;
7
8
  };
8
9
  export declare function createMailLocaleTemplates<Kind extends string>(config: MailLocaleTemplateConfig<Kind>): {
9
10
  templateLocale: (notificationType: string, requestedLocale: string) => string;
@@ -25,7 +25,7 @@ export function createMailLocaleTemplates(config) {
25
25
  {
26
26
  body: config.bodyFor(kind, locale),
27
27
  meta: {
28
- subject: mailT(locale, kindSubjectKey, { app: "{{appName}}" }),
28
+ subject: mailT(locale, kindSubjectKey, config.subjectSlots?.(kind) ?? { app: "{{appName}}" }),
29
29
  category: "transactional",
30
30
  },
31
31
  },
@@ -0,0 +1,11 @@
1
+ import * as z from "zod";
2
+ export type PriceEnvProvider<TEnvPrefix extends string> = {
3
+ readonly envPrefix: TEnvPrefix;
4
+ readonly label: string;
5
+ readonly priceIdPrefix: string;
6
+ };
7
+ export type PriceEnvShape<TEnvPrefix extends string, TPrice extends string> = {
8
+ [Key in `${TEnvPrefix}_PRICE_${TPrice}`]: z.ZodOptional<z.ZodString>;
9
+ };
10
+ export declare function priceEnvShape<const TEnvPrefix extends string, const TPrice extends string>(provider: PriceEnvProvider<TEnvPrefix>, prices: readonly TPrice[]): PriceEnvShape<TEnvPrefix, TPrice>;
11
+ export declare function priceEnvSchema<TBaseShape extends z.ZodRawShape, const TEnvPrefix extends string, const TPrice extends string>(base: z.ZodObject<TBaseShape>, provider: PriceEnvProvider<TEnvPrefix>, prices: readonly TPrice[]): z.ZodObject<TBaseShape & PriceEnvShape<TEnvPrefix, TPrice> extends infer T ? { -readonly [P in keyof T]: T[P]; } : never, z.core.$strip>;
@@ -0,0 +1,15 @@
1
+ import * as z from "zod";
2
+ export function priceEnvShape(provider, prices) {
3
+ const { envPrefix, label, priceIdPrefix } = provider;
4
+ return Object.fromEntries(prices.map((price) => [
5
+ `${envPrefix}_PRICE_${price}`,
6
+ z
7
+ .string()
8
+ .regex(new RegExp(`^${priceIdPrefix}`), `${envPrefix}_PRICE_${price} must start with '${priceIdPrefix}'`)
9
+ .optional()
10
+ .describe(`${label} price id (\`${priceIdPrefix}...\`) of the ${price} plan.`),
11
+ ]));
12
+ }
13
+ export function priceEnvSchema(base, provider, prices) {
14
+ return z.object({ ...base.shape, ...priceEnvShape(provider, prices) });
15
+ }
@@ -16,6 +16,7 @@ export type SingleFileHolder = {
16
16
  export type FileRefPurgeOutcome = "purged" | "missing_file_storage" | "file_delete_failed";
17
17
  export declare function planFileFields(fields: EntityFields, fieldNames?: readonly string[]): FileFieldPlan;
18
18
  export declare function collectSingleFileHolders(registry: Registry): readonly SingleFileHolder[];
19
+ export declare function collectFileRefIds(db: DbRunner, tenantId: TenantId, entityName: string, row: Record<string, unknown>, plan: FileFieldPlan): Promise<readonly string[]>;
19
20
  export declare function purgeRowFileRefs(args: {
20
21
  readonly db: DbRunner;
21
22
  readonly tenantId: TenantId;
@@ -46,7 +46,7 @@ export function collectSingleFileHolders(registry) {
46
46
  // Every fileRef-id a row's file-fields reference: single fields hold the id in
47
47
  // their own column, plural fields resolve via file_refs (tenantId, entityType,
48
48
  // entityId, fieldName).
49
- async function collectFileRefIds(db, tenantId, entityName, row, plan) {
49
+ export async function collectFileRefIds(db, tenantId, entityName, row, plan) {
50
50
  const ids = new Set();
51
51
  for (const field of plan.singleFields) {
52
52
  const value = row[field];
@@ -0,0 +1,2 @@
1
+ import type { FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
2
+ export declare function readFeatureExportFn<TFn extends (...args: never[]) => unknown>(feature: FeatureDefinition, exportName: string): TFn | undefined;
@@ -0,0 +1,11 @@
1
+ export function readFeatureExportFn(feature, exportName) {
2
+ const exports = feature.exports;
3
+ if (exports && typeof exports === "object" && exportName in exports) {
4
+ const candidate = Reflect.get(exports, exportName);
5
+ if (typeof candidate === "function") {
6
+ // @cast-boundary feature-exports — feature.exports is untyped by design
7
+ return candidate;
8
+ }
9
+ }
10
+ return undefined;
11
+ }
@@ -10,6 +10,7 @@
10
10
  // the { entityType, rowId, sourceTenantId } binding, and mintClaim returns a
11
11
  // freshly signed short-lived token rather than handing back the original.
12
12
  import { isPlainObject } from "@cosmicdrift/kumiko-types/type-guards";
13
+ import { findExtensionOptions } from "./collect-extension-options.js";
13
14
  export const EXT_SIGNUP_HANDOVER = "signupHandover";
14
15
  // Part of the contract: a provider's minted claim write may reject two
15
16
  // different ways. Benign — this code, nothing was written (forged,
@@ -19,15 +20,12 @@ export const EXT_SIGNUP_HANDOVER = "signupHandover";
19
20
  // but a declared child couldn't) — the caller must roll its own work back
20
21
  // together with it, never treat that as a skippable no-op.
21
22
  export const SIGNUP_HANDOVER_BENIGN_CLAIM_REJECTION_CODE = "invalid_or_expired_grant";
23
+ // guard:dup-ok type guard over this provider's own two members; only the guard shape is shared
22
24
  export function isSignupHandoverProvider(options) {
23
25
  return (isPlainObject(options) &&
24
26
  typeof options["verifyGrant"] === "function" &&
25
27
  typeof options["mintClaim"] === "function");
26
28
  }
27
29
  export function findSignupHandoverProvider(registry) {
28
- for (const usage of registry.getExtensionUsages(EXT_SIGNUP_HANDOVER)) {
29
- if (isSignupHandoverProvider(usage.options))
30
- return usage.options;
31
- }
32
- return undefined;
30
+ return findExtensionOptions(registry, EXT_SIGNUP_HANDOVER, isSignupHandoverProvider);
33
31
  }
@@ -0,0 +1,23 @@
1
+ import type { DbRunner } from "@cosmicdrift/kumiko-framework/db";
2
+ import type { Registry, TenantId } from "@cosmicdrift/kumiko-framework/engine";
3
+ import type { Temporal } from "@cosmicdrift/kumiko-types/temporal";
4
+ export declare const EXT_TENANT_DESTRUCTION_HOLD: "tenantDestructionHold";
5
+ export type TenantDestructionHoldProvider = {
6
+ isParked(args: {
7
+ readonly db: DbRunner;
8
+ readonly tenantId: TenantId;
9
+ }): Promise<boolean>;
10
+ /** Hands a parked tenant back to the destroy sweep once nothing holds it; true only when it did. */
11
+ releaseIfFree(args: {
12
+ readonly db: DbRunner;
13
+ readonly registry: Registry;
14
+ readonly tenantId: TenantId;
15
+ readonly now: Temporal.Instant;
16
+ }): Promise<boolean>;
17
+ };
18
+ export declare function findTenantDestructionHoldProvider(registry: Registry): TenantDestructionHoldProvider | undefined;
19
+ declare module "@cosmicdrift/kumiko-framework/engine" {
20
+ interface KumikoExtensionOptionsMap {
21
+ [EXT_TENANT_DESTRUCTION_HOLD]: TenantDestructionHoldProvider;
22
+ }
23
+ }
@@ -0,0 +1,15 @@
1
+ // data-retention deletes the last retention-held rows of a tenant whose destruction is parked, and
2
+ // has to hand the tenant back to the destroy sweep afterwards. The status belongs to
3
+ // tenant-lifecycle, which already imports data-retention, so data-retention reaches it through this
4
+ // extension point instead of importing it back.
5
+ import { isPlainObject } from "@cosmicdrift/kumiko-types/type-guards";
6
+ import { findExtensionOptions } from "./collect-extension-options.js";
7
+ export const EXT_TENANT_DESTRUCTION_HOLD = "tenantDestructionHold";
8
+ function isTenantDestructionHoldProvider(options) {
9
+ return (isPlainObject(options) &&
10
+ typeof options["isParked"] === "function" &&
11
+ typeof options["releaseIfFree"] === "function");
12
+ }
13
+ export function findTenantDestructionHoldProvider(registry) {
14
+ return findExtensionOptions(registry, EXT_TENANT_DESTRUCTION_HOLD, isTenantDestructionHoldProvider);
15
+ }
@@ -0,0 +1,4 @@
1
+ import { UnprocessableError, type WriteFailure } from "@cosmicdrift/kumiko-framework/errors";
2
+ type UnprocessableDetails = NonNullable<ConstructorParameters<typeof UnprocessableError>[1]>["details"];
3
+ export declare function unprocessable(reason: string, i18nKey: string, details?: UnprocessableDetails): WriteFailure;
4
+ export {};
@@ -0,0 +1,4 @@
1
+ import { UnprocessableError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
2
+ export function unprocessable(reason, i18nKey, details) {
3
+ return writeFailure(new UnprocessableError(reason, details === undefined ? { i18nKey } : { i18nKey, details }));
4
+ }
@@ -0,0 +1,3 @@
1
+ export { type SectionStatus, StatusBanner } from "./status-banner.tsx";
2
+ export { translateOrRaw } from "./translate-or-raw.ts";
3
+ export { useDispatchedWrites } from "./use-dispatched-writes.ts";
@@ -0,0 +1,3 @@
1
+ export { StatusBanner } from "./status-banner.js";
2
+ export { translateOrRaw } from "./translate-or-raw.js";
3
+ export { useDispatchedWrites } from "./use-dispatched-writes.js";
@@ -6,7 +6,7 @@ export function makeCheckoutConfigQuery(readCheckoutConfig) {
6
6
  return defineQueryHandler({
7
7
  name: "checkout-config",
8
8
  schema: z.object({}),
9
- access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"] },
9
+ access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"], anySignedIn: true },
10
10
  rateLimit: { per: "ip+handler", limit: 60, windowSeconds: 60 },
11
11
  description: "Answers the public Paddle.js client token and the Paddle environment for the checkout page; the client token is public by design and no other config leaves this handler.",
12
12
  handler: async (_query, ctx) => readCheckoutConfig(ctx),
@@ -9,9 +9,6 @@ export declare const subscriptionPaddleEnvSchema: z.ZodObject<{
9
9
  PADDLE_TENANT_BINDING_KEY: z.ZodOptional<z.ZodString>;
10
10
  PADDLE_CLIENT_TOKEN: z.ZodOptional<z.ZodString>;
11
11
  }, z.core.$strip>;
12
- type PaddlePriceEnvShape<TPrice extends string> = {
13
- [Key in `PADDLE_PRICE_${TPrice}`]: z.ZodOptional<z.ZodString>;
14
- };
15
12
  /** Paddle env block plus one `PADDLE_PRICE_<NAME>` slot per plan price the app
16
13
  * maps to a tier, e.g. `paddleEnvSchema({ prices: ["PRO", "TEAM"] })`.
17
14
  * Shares its bridge fields with `subscriptionPaddleEnvSchema`, so spreading
@@ -24,7 +21,7 @@ export declare function paddleEnvSchema<const TPrice extends string>(options: {
24
21
  PADDLE_WEBHOOK_SECRET: z.ZodOptional<z.ZodString>;
25
22
  PADDLE_TENANT_BINDING_KEY: z.ZodOptional<z.ZodString>;
26
23
  PADDLE_CLIENT_TOKEN: z.ZodOptional<z.ZodString>;
27
- } & PaddlePriceEnvShape<TPrice> extends infer T ? { -readonly [P in keyof T]: T[P]; } : never, z.core.$strip>;
24
+ } & import("../shared/price-env-shape.ts").PriceEnvShape<"PADDLE", TPrice> extends infer T ? { -readonly [P in keyof T]: T[P]; } : never, z.core.$strip>;
28
25
  export type SubscriptionPaddleOptions = {
29
26
  /** Bridge-fallback API key; the `api-key` config key wins when set. */
30
27
  readonly apiKey?: string;
@@ -46,4 +43,3 @@ export type SubscriptionPaddleOptions = {
46
43
  readonly nowSeconds?: () => number;
47
44
  };
48
45
  export declare function createSubscriptionPaddleFeature(options?: SubscriptionPaddleOptions): FeatureWithEnvSchema<FeatureDefinition, typeof subscriptionPaddleEnvSchema.shape>;
49
- export {};