@cosmicdrift/kumiko-samples 0.413.1 → 0.415.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 (479) hide show
  1. package/package.json +1 -1
  2. package/packages/bundled-features/package.json +16 -1
  3. package/packages/bundled-features/src/admin-shell/changes.json +6 -0
  4. package/packages/bundled-features/src/admin-shell/feature.ts +8 -7
  5. package/packages/bundled-features/src/agent-tools/agent-doc-lint.ts +5 -1
  6. package/packages/bundled-features/src/agent-tools/agent-manifest.ts +36 -27
  7. package/packages/bundled-features/src/agent-tools/api-docs/collect-events.ts +8 -1
  8. package/packages/bundled-features/src/agent-tools/api-docs/collect.ts +3 -2
  9. package/packages/bundled-features/src/agent-tools/api-docs/generate.ts +6 -0
  10. package/packages/bundled-features/src/agent-tools/api-docs/index.ts +1 -0
  11. package/packages/bundled-features/src/agent-tools/api-docs/problems.ts +38 -1
  12. package/packages/bundled-features/src/agent-tools/api-docs/render-openapi.ts +1 -0
  13. package/packages/bundled-features/src/agent-tools/api-docs/resolve-config.ts +17 -0
  14. package/packages/bundled-features/src/agent-tools/api-docs/scope-slug-collisions.ts +17 -0
  15. package/packages/bundled-features/src/agent-tools/api-docs/translation-gaps.ts +42 -0
  16. package/packages/bundled-features/src/agent-tools/api-docs/webhook-example-problems.ts +30 -0
  17. package/packages/bundled-features/src/agent-tools/changes.json +12 -0
  18. package/packages/bundled-features/src/agent-tools/index.ts +1 -0
  19. package/packages/bundled-features/src/agent-tools/labels.ts +19 -6
  20. package/packages/bundled-features/src/agent-tools/tool-catalog.ts +18 -7
  21. package/packages/bundled-features/src/agent-tools/tool-dispatch.ts +14 -1
  22. package/packages/bundled-features/src/agent-tools/types.ts +4 -0
  23. package/packages/bundled-features/src/audit/event-classification.ts +6 -0
  24. package/packages/bundled-features/src/audit/web/i18n.ts +1 -0
  25. package/packages/bundled-features/src/auth-email-password/changes.json +18 -0
  26. package/packages/bundled-features/src/auth-email-password/errors.ts +0 -13
  27. package/packages/bundled-features/src/auth-email-password/handlers/invite-signup-complete.write.ts +147 -121
  28. package/packages/bundled-features/src/auth-email-password/handlers/login-options.query.ts +1 -1
  29. package/packages/bundled-features/src/auth-email-password/handlers/request-account-unlock.write.ts +1 -1
  30. package/packages/bundled-features/src/auth-email-password/handlers/request-email-verification.write.ts +0 -1
  31. package/packages/bundled-features/src/auth-email-password/handlers/request-password-reset.write.ts +0 -1
  32. package/packages/bundled-features/src/auth-email-password/handlers/self-registration-status.query.ts +1 -1
  33. package/packages/bundled-features/src/auth-email-password/reset-token.ts +0 -2
  34. package/packages/bundled-features/src/auth-email-password/seeding.ts +39 -7
  35. package/packages/bundled-features/src/auth-email-password/signup-token-store.ts +2 -3
  36. package/packages/bundled-features/src/auth-email-password/unlock-token.ts +0 -2
  37. package/packages/bundled-features/src/auth-email-password/verification-token.ts +0 -2
  38. package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +2 -2
  39. package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +2 -2
  40. package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +5 -0
  41. package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +1 -6
  42. package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +1 -1
  43. package/packages/bundled-features/src/auth-email-password/web/return-path.ts +2 -1
  44. package/packages/bundled-features/src/auth-email-password/web/session.tsx +12 -13
  45. package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +1 -6
  46. package/packages/bundled-features/src/auth-email-password/web/static-account.ts +6 -1
  47. package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +1 -1
  48. package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +4 -5
  49. package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +1 -1
  50. package/packages/bundled-features/src/auth-mfa/changes.json +6 -0
  51. package/packages/bundled-features/src/auth-mfa/web/mfa-code-or-recovery-field.tsx +17 -1
  52. package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -1
  53. package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -1
  54. package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +1 -1
  55. package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +16 -47
  56. package/packages/bundled-features/src/auth-mfa-user-data/index.ts +5 -6
  57. package/packages/bundled-features/src/billing-foundation/aggregate-id.ts +0 -4
  58. package/packages/bundled-features/src/billing-foundation/changes.json +61 -0
  59. package/packages/bundled-features/src/billing-foundation/checkout-core.ts +19 -1
  60. package/packages/bundled-features/src/billing-foundation/checkout-ledger.ts +67 -0
  61. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-gate.ts +2 -1
  62. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +49 -2
  63. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-open-cancels.ts +5 -0
  64. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-provider-timeout.ts +23 -0
  65. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +12 -7
  66. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +1 -1
  67. package/packages/bundled-features/src/billing-foundation/events.ts +51 -10
  68. package/packages/bundled-features/src/billing-foundation/feature.ts +15 -1
  69. package/packages/bundled-features/src/billing-foundation/handlers/billing-plans.query.ts +47 -14
  70. package/packages/bundled-features/src/billing-foundation/handlers/create-checkout-session.write.ts +9 -1
  71. package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +183 -17
  72. package/packages/bundled-features/src/billing-foundation/handlers/process-payment-event.write.ts +35 -10
  73. package/packages/bundled-features/src/billing-foundation/handlers/record-checkout-opened.write.ts +25 -0
  74. package/packages/bundled-features/src/billing-foundation/handlers/start-plan-checkout.write.ts +9 -1
  75. package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +16 -4
  76. package/packages/bundled-features/src/billing-foundation/i18n.ts +3 -0
  77. package/packages/bundled-features/src/billing-foundation/pending-plan-switch.ts +80 -0
  78. package/packages/bundled-features/src/billing-foundation/scrub-raw-payload-headers.ts +50 -0
  79. package/packages/bundled-features/src/billing-foundation/types.ts +47 -30
  80. package/packages/bundled-features/src/billing-foundation/validate-options.ts +18 -0
  81. package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +10 -5
  82. package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -1
  83. package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -1
  84. package/packages/bundled-features/src/billing-foundation/web/constants.ts +5 -2
  85. package/packages/bundled-features/src/billing-foundation/web/plan-switch-confirm-dialog.tsx +1 -1
  86. package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +65 -17
  87. package/packages/bundled-features/src/cap-counter/aggregate-id.ts +0 -2
  88. package/packages/bundled-features/src/cap-counter/changes.json +6 -0
  89. package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +19 -4
  90. package/packages/bundled-features/src/cap-overview/changes.json +6 -0
  91. package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +22 -6
  92. package/packages/bundled-features/src/cap-overview/i18n.ts +1 -0
  93. package/packages/bundled-features/src/cap-overview/index.ts +1 -0
  94. package/packages/bundled-features/src/cap-overview/types.ts +11 -1
  95. package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +6 -2
  96. package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +10 -1
  97. package/packages/bundled-features/src/cap-overview/web/usage-math.ts +5 -0
  98. package/packages/bundled-features/src/channel-in-app/changes.json +6 -0
  99. package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +2 -2
  100. package/packages/bundled-features/src/channel-whatsapp/aggregate-id.ts +29 -0
  101. package/packages/bundled-features/src/channel-whatsapp/changes.json +32 -0
  102. package/packages/bundled-features/src/channel-whatsapp/constants.ts +46 -0
  103. package/packages/bundled-features/src/channel-whatsapp/events.ts +94 -0
  104. package/packages/bundled-features/src/channel-whatsapp/feature.ts +72 -0
  105. package/packages/bundled-features/src/channel-whatsapp/graph-client.ts +398 -0
  106. package/packages/bundled-features/src/channel-whatsapp/in-memory-meta.ts +300 -0
  107. package/packages/bundled-features/src/channel-whatsapp/inbound-handlers.ts +210 -0
  108. package/packages/bundled-features/src/channel-whatsapp/index.ts +66 -0
  109. package/packages/bundled-features/src/channel-whatsapp/meta-signature.ts +26 -0
  110. package/packages/bundled-features/src/channel-whatsapp/options.ts +149 -0
  111. package/packages/bundled-features/src/channel-whatsapp/pii.ts +109 -0
  112. package/packages/bundled-features/src/channel-whatsapp/webhook-normalize.ts +247 -0
  113. package/packages/bundled-features/src/channel-whatsapp/webhook-routes.ts +185 -0
  114. package/packages/bundled-features/src/compliance-profiles/changes.json +5 -0
  115. package/packages/bundled-features/src/compliance-profiles/handlers/set-profile.write.ts +2 -0
  116. package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +1 -1
  117. package/packages/bundled-features/src/config/changes.json +12 -0
  118. package/packages/bundled-features/src/config/handlers/set.write.ts +7 -0
  119. package/packages/bundled-features/src/config/handlers/values.query.ts +8 -1
  120. package/packages/bundled-features/src/config/index.ts +1 -0
  121. package/packages/bundled-features/src/config/read-redaction.ts +6 -3
  122. package/packages/bundled-features/src/config/table.ts +1 -0
  123. package/packages/bundled-features/src/config/write-helpers.ts +3 -2
  124. package/packages/bundled-features/src/crypto-shredding/changes.json +18 -0
  125. package/packages/bundled-features/src/crypto-shredding/constants.ts +2 -0
  126. package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +38 -18
  127. package/packages/bundled-features/src/crypto-shredding/index.ts +4 -0
  128. package/packages/bundled-features/src/crypto-shredding/subject-forget-after-delete-hook.ts +49 -0
  129. package/packages/bundled-features/src/custom-fields/aggregate-id.ts +0 -1
  130. package/packages/bundled-features/src/custom-fields/entity.ts +1 -0
  131. package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +0 -1
  132. package/packages/bundled-features/src/data-retention/changes.json +12 -0
  133. package/packages/bundled-features/src/data-retention/erase-notes-of-deleted-row.ts +23 -0
  134. package/packages/bundled-features/src/data-retention/feature.ts +2 -5
  135. package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +38 -18
  136. package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +9 -0
  137. package/packages/bundled-features/src/delivery/attempt-log-factory.ts +11 -0
  138. package/packages/bundled-features/src/delivery/attempt-log.ts +3 -3
  139. package/packages/bundled-features/src/delivery/changes.json +12 -0
  140. package/packages/bundled-features/src/delivery/channel-context.ts +6 -3
  141. package/packages/bundled-features/src/delivery/db/queries/preferences.ts +0 -1
  142. package/packages/bundled-features/src/delivery/delivery-service.ts +3 -0
  143. package/packages/bundled-features/src/delivery/feature.ts +4 -13
  144. package/packages/bundled-features/src/delivery/handlers/opted-in-user-ids.query.ts +54 -0
  145. package/packages/bundled-features/src/delivery/handlers/preferences.query.ts +2 -20
  146. package/packages/bundled-features/src/delivery/handlers/resubscribe-user.write.ts +2 -25
  147. package/packages/bundled-features/src/delivery/handlers/unsubscribe-page-chrome.query.ts +2 -0
  148. package/packages/bundled-features/src/delivery/handlers/unsubscribe-user.write.ts +2 -27
  149. package/packages/bundled-features/src/delivery/index.ts +3 -1
  150. package/packages/bundled-features/src/delivery/options.ts +11 -0
  151. package/packages/bundled-features/src/delivery/preference-rows.ts +33 -0
  152. package/packages/bundled-features/src/delivery/set-preference-enabled.ts +40 -0
  153. package/packages/bundled-features/src/delivery/testing.ts +3 -1
  154. package/packages/bundled-features/src/delivery/types.ts +1 -0
  155. package/packages/bundled-features/src/delivery/unsubscribe-page.ts +7 -1
  156. package/packages/bundled-features/src/delivery/upsert-preference.ts +0 -1
  157. package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
  158. package/packages/bundled-features/src/derivatives-sharp/render.ts +9 -9
  159. package/packages/bundled-features/src/document-ingest-foundation/aggregate-id.ts +0 -1
  160. package/packages/bundled-features/src/document-ingest-foundation/append-missing-extract-event.ts +37 -25
  161. package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
  162. package/packages/bundled-features/src/document-ingest-foundation/feature.ts +1 -0
  163. package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +34 -14
  164. package/packages/bundled-features/src/documents/aggregate-id.ts +0 -2
  165. package/packages/bundled-features/src/documents/changes.json +24 -0
  166. package/packages/bundled-features/src/documents/constants.ts +10 -2
  167. package/packages/bundled-features/src/documents/ensure-link.ts +3 -4
  168. package/packages/bundled-features/src/documents/feature.ts +33 -6
  169. package/packages/bundled-features/src/documents/handlers/import.write.ts +2 -2
  170. package/packages/bundled-features/src/documents/queries/expiry-overview.query.ts +2 -1
  171. package/packages/bundled-features/src/documents/queries/for-record.query.ts +3 -4
  172. package/packages/bundled-features/src/documents/queries/list-page.ts +11 -3
  173. package/packages/bundled-features/src/documents/queries/overview.query.ts +2 -2
  174. package/packages/bundled-features/src/documents/screens.ts +8 -3
  175. package/packages/bundled-features/src/documents/tab.ts +1 -1
  176. package/packages/bundled-features/src/feature-toggles/toggle-sync-signal.ts +6 -3
  177. package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +1 -1
  178. package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
  179. package/packages/bundled-features/src/file-foundation/probe.ts +9 -3
  180. package/packages/bundled-features/src/file-foundation/read-file-ref-content.ts +24 -11
  181. package/packages/bundled-features/src/file-provider-inmemory/feature.ts +1 -1
  182. package/packages/bundled-features/src/file-provider-s3/changes.json +14 -0
  183. package/packages/bundled-features/src/file-provider-s3/env-feature.ts +1 -1
  184. package/packages/bundled-features/src/file-provider-s3/env-named-feature.ts +1 -1
  185. package/packages/bundled-features/src/file-provider-s3/env-schema.ts +24 -7
  186. package/packages/bundled-features/src/file-provider-s3/feature.ts +1 -1
  187. package/packages/bundled-features/src/file-provider-s3/index.ts +7 -1
  188. package/packages/bundled-features/src/file-provider-s3/lib/env-helper.ts +21 -13
  189. package/packages/bundled-features/src/file-provider-s3/lib/s3-provider.ts +8 -1
  190. package/packages/bundled-features/src/files/changes.json +7 -0
  191. package/packages/bundled-features/src/folders/aggregate-id.ts +0 -1
  192. package/packages/bundled-features/src/folders/web/folder-manager.tsx +6 -6
  193. package/packages/bundled-features/src/folders-user-data/index.ts +12 -14
  194. package/packages/bundled-features/src/form-draft/feature.ts +1 -0
  195. package/packages/bundled-features/src/helpdesk/changes.json +56 -0
  196. package/packages/bundled-features/src/helpdesk/entity.ts +4 -1
  197. package/packages/bundled-features/src/helpdesk/feature.ts +42 -0
  198. package/packages/bundled-features/src/helpdesk/handlers/access.ts +0 -10
  199. package/packages/bundled-features/src/helpdesk/handlers/attempts.ts +7 -14
  200. package/packages/bundled-features/src/helpdesk/handlers/challenge.query.ts +1 -2
  201. package/packages/bundled-features/src/helpdesk/handlers/reply.write.ts +5 -12
  202. package/packages/bundled-features/src/helpdesk/handlers/report.write.ts +4 -10
  203. package/packages/bundled-features/src/helpdesk/handlers/submit.write.ts +5 -12
  204. package/packages/bundled-features/src/helpdesk/index.ts +1 -0
  205. package/packages/bundled-features/src/helpdesk/legacy-contact-config.ts +61 -0
  206. package/packages/bundled-features/src/helpdesk/legacy-contact-erasure.ts +45 -0
  207. package/packages/bundled-features/src/helpdesk/legacy-contact-retention.ts +65 -0
  208. package/packages/bundled-features/src/helpdesk/legacy-contact-streams.ts +187 -0
  209. package/packages/bundled-features/src/helpdesk/legacy-contact-user-data.ts +84 -0
  210. package/packages/bundled-features/src/helpdesk/lib.ts +55 -37
  211. package/packages/bundled-features/src/helpdesk/user-data-hooks.ts +89 -48
  212. package/packages/bundled-features/src/helpdesk/web/constants.ts +0 -1
  213. package/packages/bundled-features/src/inbound-mail-foundation/account-health.ts +1 -1
  214. package/packages/bundled-features/src/inbound-mail-foundation/account-poll.ts +9 -2
  215. package/packages/bundled-features/src/inbound-mail-foundation/aggregate-id.ts +0 -2
  216. package/packages/bundled-features/src/inbound-mail-foundation/changes.json +54 -0
  217. package/packages/bundled-features/src/inbound-mail-foundation/constants.ts +6 -0
  218. package/packages/bundled-features/src/inbound-mail-foundation/content-refetch.ts +23 -2
  219. package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +73 -15
  220. package/packages/bundled-features/src/inbound-mail-foundation/events.ts +24 -16
  221. package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +3 -1
  222. package/packages/bundled-features/src/inbound-mail-foundation/handlers/account-address.ts +16 -2
  223. package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +10 -3
  224. package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +23 -9
  225. package/packages/bundled-features/src/inbound-mail-foundation/handlers/forget-message.write.ts +79 -0
  226. package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message-schema.ts +18 -5
  227. package/packages/bundled-features/src/inbound-mail-foundation/i18n.ts +3 -0
  228. package/packages/bundled-features/src/inbound-mail-foundation/index.ts +1 -0
  229. package/packages/bundled-features/src/inbound-mail-foundation/normalize-inbound-message.ts +22 -8
  230. package/packages/bundled-features/src/inbound-mail-foundation/oauth-access-token.ts +1 -1
  231. package/packages/bundled-features/src/inbound-mail-foundation/outbound-mail.ts +2 -0
  232. package/packages/bundled-features/src/inbound-mail-foundation/personal-address.ts +20 -0
  233. package/packages/bundled-features/src/inbound-mail-foundation/purge-messages.ts +54 -0
  234. package/packages/bundled-features/src/inbound-mail-foundation/quarantine.ts +15 -5
  235. package/packages/bundled-features/src/inbound-mail-foundation/retention-job.ts +1 -5
  236. package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +21 -34
  237. package/packages/bundled-features/src/inbound-mail-foundation/sanitize-inbound-html.ts +2 -5
  238. package/packages/bundled-features/src/inbound-mail-foundation/send-from-account.ts +9 -1
  239. package/packages/bundled-features/src/inbound-mail-foundation/supervisor-ingest.ts +7 -1
  240. package/packages/bundled-features/src/inbound-mail-foundation/sync-account-now.ts +1 -1
  241. package/packages/bundled-features/src/inbound-mail-foundation/tenant-destroy-hook.ts +14 -17
  242. package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +1 -1
  243. package/packages/bundled-features/src/inbound-provider-imap/byte-budget.ts +80 -0
  244. package/packages/bundled-features/src/inbound-provider-imap/changes.json +13 -0
  245. package/packages/bundled-features/src/inbound-provider-imap/connect-mailbox.ts +8 -4
  246. package/packages/bundled-features/src/inbound-provider-imap/connect-my-mailbox.ts +23 -6
  247. package/packages/bundled-features/src/inbound-provider-imap/connect-target-rate-limit.ts +46 -0
  248. package/packages/bundled-features/src/inbound-provider-imap/download-batch.ts +47 -10
  249. package/packages/bundled-features/src/inbound-provider-imap/feature.ts +7 -4
  250. package/packages/bundled-features/src/inbound-provider-imap/fetch-content.ts +43 -29
  251. package/packages/bundled-features/src/inbound-provider-imap/i18n.ts +2 -2
  252. package/packages/bundled-features/src/inbound-provider-imap/parse-message.ts +14 -0
  253. package/packages/bundled-features/src/inbound-provider-imap/reconnect-mailbox.ts +5 -4
  254. package/packages/bundled-features/src/inbound-provider-imap/send-mail.ts +39 -7
  255. package/packages/bundled-features/src/inbound-provider-imap/smtp-client.ts +19 -4
  256. package/packages/bundled-features/src/inbound-provider-imap/watch-mailbox.ts +8 -23
  257. package/packages/bundled-features/src/inbound-provider-inmemory/feature.ts +1 -1
  258. package/packages/bundled-features/src/jobs/events.ts +10 -0
  259. package/packages/bundled-features/src/jobs/feature.ts +2 -0
  260. package/packages/bundled-features/src/jobs/handlers/consumer.write.ts +41 -16
  261. package/packages/bundled-features/src/jobs/web/constants.ts +4 -0
  262. package/packages/bundled-features/src/mail-foundation/changes.json +6 -0
  263. package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +1 -1
  264. package/packages/bundled-features/src/mail-transport-smtp/feature.ts +3 -2
  265. package/packages/bundled-features/src/managed-pages/changes.json +12 -0
  266. package/packages/bundled-features/src/managed-pages/handlers/branding.query.ts +1 -1
  267. package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +1 -1
  268. package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +1 -1
  269. package/packages/bundled-features/src/managed-pages/render-page-body.ts +18 -10
  270. package/packages/bundled-features/src/managed-pages/screens/page-screens.ts +18 -38
  271. package/packages/bundled-features/src/managed-pages/table.ts +1 -0
  272. package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +8 -6
  273. package/packages/bundled-features/src/managed-pages/web/constants.ts +8 -1
  274. package/packages/bundled-features/src/managed-pages/web/i18n.ts +11 -3
  275. package/packages/bundled-features/src/managed-pages/web/markdown-to-document.ts +1 -1
  276. package/packages/bundled-features/src/managed-pages/web/page-edit-draft.ts +108 -0
  277. package/packages/bundled-features/src/managed-pages/web/page-edit-screen.tsx +204 -0
  278. package/packages/bundled-features/src/managed-pages/web/page-settings-rail.tsx +117 -0
  279. package/packages/bundled-features/src/notes-history-user-data/index.ts +8 -14
  280. package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +5 -0
  281. package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +0 -1
  282. package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +31 -5
  283. package/packages/bundled-features/src/presence/changes.json +6 -0
  284. package/packages/bundled-features/src/presence/handlers/list.query.ts +28 -11
  285. package/packages/bundled-features/src/presence/room.ts +21 -7
  286. package/packages/bundled-features/src/presence/store.ts +79 -21
  287. package/packages/bundled-features/src/readiness/changes.json +25 -0
  288. package/packages/bundled-features/src/readiness/handlers/latest-summary.query.ts +11 -6
  289. package/packages/bundled-features/src/readiness/handlers/run-probes.write.ts +35 -5
  290. package/packages/bundled-features/src/readiness/handlers/run-tone.ts +3 -2
  291. package/packages/bundled-features/src/readiness/handlers/status.query.ts +15 -1
  292. package/packages/bundled-features/src/readiness/probe-context.ts +11 -10
  293. package/packages/bundled-features/src/readiness/screens.ts +4 -4
  294. package/packages/bundled-features/src/readiness/visible-results.ts +5 -3
  295. package/packages/bundled-features/src/renderer-foundation/api.ts +6 -13
  296. package/packages/bundled-features/src/renderer-foundation/types.ts +2 -2
  297. package/packages/bundled-features/src/secrets/changes.json +7 -0
  298. package/packages/bundled-features/src/secrets/db/queries/read.ts +18 -4
  299. package/packages/bundled-features/src/secrets/handlers/list.query.ts +8 -2
  300. package/packages/bundled-features/src/secrets/secret-scope.ts +2 -3
  301. package/packages/bundled-features/src/secrets/secrets-context.ts +6 -4
  302. package/packages/bundled-features/src/secrets/write-gate.ts +4 -2
  303. package/packages/bundled-features/src/seo/handlers/seo-config.query.ts +1 -1
  304. package/packages/bundled-features/src/shared/acknowledged-system-db.ts +20 -0
  305. package/packages/bundled-features/src/shared/assert-billing-live.ts +9 -2
  306. package/packages/bundled-features/src/shared/changes.json +12 -0
  307. package/packages/bundled-features/src/shared/hmac-signature.ts +4 -2
  308. package/packages/bundled-features/src/shared/index.ts +7 -1
  309. package/packages/bundled-features/src/shared/normalize-email.ts +3 -0
  310. package/packages/bundled-features/src/shared/parent-visibility.ts +25 -1
  311. package/packages/bundled-features/src/shared/password-hashing.ts +0 -1
  312. package/packages/bundled-features/src/shared/price-env-shape.ts +1 -4
  313. package/packages/bundled-features/src/shared/register-user-data-hooks.ts +29 -0
  314. package/packages/bundled-features/src/shared/require-bootstrap-extension.ts +26 -0
  315. package/packages/bundled-features/src/shared/send-best-effort.ts +29 -0
  316. package/packages/bundled-features/src/shared/stream-tenant-backfill.ts +22 -1
  317. package/packages/bundled-features/src/shared/stream-tenant-derived-state.ts +31 -1
  318. package/packages/bundled-features/src/step-dispatcher/changes.json +18 -0
  319. package/packages/bundled-features/src/step-dispatcher/constants.ts +13 -0
  320. package/packages/bundled-features/src/step-dispatcher/deliver-dispatch-request.ts +50 -2
  321. package/packages/bundled-features/src/step-dispatcher/feature.ts +42 -1
  322. package/packages/bundled-features/src/step-dispatcher/mail-runner.ts +0 -1
  323. package/packages/bundled-features/src/step-dispatcher/sweep-abandoned.ts +61 -0
  324. package/packages/bundled-features/src/subscription-mollie/changes.json +7 -0
  325. package/packages/bundled-features/src/subscription-mollie/plugin-methods.ts +5 -3
  326. package/packages/bundled-features/src/subscription-mollie/verify-webhook.ts +5 -5
  327. package/packages/bundled-features/src/subscription-paddle/backfill-checkout-ledger.ts +161 -0
  328. package/packages/bundled-features/src/subscription-paddle/changes.json +19 -0
  329. package/packages/bundled-features/src/subscription-paddle/checkout-config.query.ts +1 -1
  330. package/packages/bundled-features/src/subscription-paddle/checkout-methods.ts +2 -8
  331. package/packages/bundled-features/src/subscription-paddle/constants.ts +1 -2
  332. package/packages/bundled-features/src/subscription-paddle/feature.ts +26 -24
  333. package/packages/bundled-features/src/subscription-paddle/ledger-backfill-marker.ts +70 -0
  334. package/packages/bundled-features/src/subscription-paddle/plan-switch-methods.ts +2 -8
  335. package/packages/bundled-features/src/subscription-paddle/redeliver-legacy-checkout.ts +57 -0
  336. package/packages/bundled-features/src/subscription-paddle/runtime.ts +13 -24
  337. package/packages/bundled-features/src/subscription-paddle/subscription-state.ts +1 -0
  338. package/packages/bundled-features/src/subscription-paddle/webhook-events.ts +68 -21
  339. package/packages/bundled-features/src/subscription-stripe/changes.json +13 -0
  340. package/packages/bundled-features/src/subscription-stripe/feature.ts +5 -0
  341. package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +6 -6
  342. package/packages/bundled-features/src/subscription-stripe/runtime.ts +8 -7
  343. package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +38 -6
  344. package/packages/bundled-features/src/tags/aggregate-id.ts +0 -1
  345. package/packages/bundled-features/src/tags/web/tag-chip.tsx +4 -5
  346. package/packages/bundled-features/src/tags/web/tag-manager.tsx +2 -1
  347. package/packages/bundled-features/src/template-resolver/api.ts +6 -13
  348. package/packages/bundled-features/src/template-resolver/changes.json +48 -0
  349. package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +25 -0
  350. package/packages/bundled-features/src/template-resolver/feature.ts +2 -0
  351. package/packages/bundled-features/src/template-resolver/handlers/body-preview.query.ts +41 -0
  352. package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +1 -1
  353. package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +1 -1
  354. package/packages/bundled-features/src/template-resolver/handlers/collection-shared.ts +5 -11
  355. package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +3 -2
  356. package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +37 -8
  357. package/packages/bundled-features/src/template-resolver/linked-resources.ts +2 -5
  358. package/packages/bundled-features/src/template-resolver/seeding.ts +107 -0
  359. package/packages/bundled-features/src/template-resolver/table.ts +1 -0
  360. package/packages/bundled-features/src/template-resolver/template-draft.ts +2 -1
  361. package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -3
  362. package/packages/bundled-features/src/template-resolver/testing.ts +0 -2
  363. package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +3 -0
  364. package/packages/bundled-features/src/template-resolver/web/collection-entry-create-form.tsx +33 -33
  365. package/packages/bundled-features/src/template-resolver/web/constants.ts +7 -0
  366. package/packages/bundled-features/src/template-resolver/web/content-tree-provider.ts +0 -1
  367. package/packages/bundled-features/src/template-resolver/web/content-workbench.tsx +142 -0
  368. package/packages/bundled-features/src/template-resolver/web/document-insert-model.ts +3 -8
  369. package/packages/bundled-features/src/template-resolver/web/document-link-policy.ts +58 -0
  370. package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -57
  371. package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +2 -4
  372. package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +4 -5
  373. package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +2 -2
  374. package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +6 -3
  375. package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +2 -3
  376. package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -0
  377. package/packages/bundled-features/src/template-resolver/web/fill-document-variables.ts +24 -0
  378. package/packages/bundled-features/src/template-resolver/web/i18n.ts +14 -0
  379. package/packages/bundled-features/src/template-resolver/web/index.ts +3 -0
  380. package/packages/bundled-features/src/template-resolver/web/preview-targets.ts +25 -0
  381. package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +1 -0
  382. package/packages/bundled-features/src/template-resolver/web/snippet-preview-renderer.tsx +24 -0
  383. package/packages/bundled-features/src/template-resolver/web/string-values.ts +7 -0
  384. package/packages/bundled-features/src/template-resolver/web/text-block-editor.tsx +38 -50
  385. package/packages/bundled-features/src/template-resolver/web/use-collection-entry-create.ts +7 -0
  386. package/packages/bundled-features/src/template-resolver/web/use-content-write.ts +1 -3
  387. package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +1 -2
  388. package/packages/bundled-features/src/template-resolver/web/use-text-block-editor.ts +28 -7
  389. package/packages/bundled-features/src/template-resolver/web/web-preview-renderer.tsx +132 -0
  390. package/packages/bundled-features/src/template-resolver-user-data/index.ts +11 -10
  391. package/packages/bundled-features/src/tenant/changes.json +6 -0
  392. package/packages/bundled-features/src/tenant/handlers/create.write.ts +7 -8
  393. package/packages/bundled-features/src/tenant/handlers/list.query.ts +7 -9
  394. package/packages/bundled-features/src/tenant/handlers/member-directory.query.ts +10 -4
  395. package/packages/bundled-features/src/tenant/handlers/toggle-enabled.write.ts +1 -1
  396. package/packages/bundled-features/src/tenant/invited-membership.ts +10 -1
  397. package/packages/bundled-features/src/tenant/seeding.ts +4 -2
  398. package/packages/bundled-features/src/tenant/stream-tenant-backfill.ts +5 -1
  399. package/packages/bundled-features/src/tenant/testing.ts +1 -1
  400. package/packages/bundled-features/src/tenant-inactivity/changes.json +6 -0
  401. package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +36 -17
  402. package/packages/bundled-features/src/tenant-inactivity/constants.ts +1 -2
  403. package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +7 -2
  404. package/packages/bundled-features/src/tenant-inactivity/state-store.ts +22 -2
  405. package/packages/bundled-features/src/tenant-lifecycle/changes.json +24 -0
  406. package/packages/bundled-features/src/tenant-lifecycle/constants.ts +4 -0
  407. package/packages/bundled-features/src/tenant-lifecycle/feature.ts +1 -0
  408. package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +43 -6
  409. package/packages/bundled-features/src/tenant-lifecycle/stages.ts +15 -2
  410. package/packages/bundled-features/src/tier-engine/aggregate-id.ts +0 -1
  411. package/packages/bundled-features/src/tier-engine/changes.json +6 -0
  412. package/packages/bundled-features/src/tier-engine/feature.ts +8 -2
  413. package/packages/bundled-features/src/user/changes.json +6 -0
  414. package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +2 -1
  415. package/packages/bundled-features/src/user/handlers/me.query.ts +3 -1
  416. package/packages/bundled-features/src/user/index.ts +1 -0
  417. package/packages/bundled-features/src/user/resolve-verified-user-email.ts +17 -0
  418. package/packages/bundled-features/src/user-data-rights/db/queries/export-jobs.ts +0 -1
  419. package/packages/bundled-features/src/user-data-rights/feature.ts +1 -0
  420. package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +1 -1
  421. package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -1
  422. package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +1 -1
  423. package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +0 -2
  424. package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +3 -3
  425. package/packages/bundled-features/src/user-data-rights/schema/download-attempt.ts +3 -2
  426. package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +1 -1
  427. package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
  428. package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +1 -1
  429. package/packages/bundled-features/src/user-data-rights-defaults/hooks/api-token.userdata-hook.ts +5 -5
  430. package/packages/bundled-features/src/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.ts +17 -0
  431. package/packages/bundled-features/src/user-data-rights-defaults/hooks/in-app-message.userdata-hook.ts +5 -5
  432. package/packages/bundled-features/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts +2 -1
  433. package/packages/bundled-features/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts +5 -5
  434. package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +0 -1
  435. package/packages/bundled-features/src/waitlist/changes.json +6 -0
  436. package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
  437. package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +5 -29
  438. package/packages/bundled-features/src/waitlist/import.ts +2 -1
  439. package/packages/bundled-features/src/waitlist/lib.ts +2 -11
  440. package/packages/bundled-features/src/waitlist/link-on-signup.ts +2 -2
  441. package/packages/bundled-features/src/waitlist/user-data-hooks.ts +6 -19
  442. package/packages/bundled-features/src/workflow-runner/aggregate-id.ts +0 -1
  443. package/packages/bundled-features/src/workflow-runner/changes.json +6 -0
  444. package/packages/bundled-features/src/workflow-runner/event-trigger.ts +6 -2
  445. package/packages/bundled-features/src/workflow-runner/feature.ts +1 -5
  446. package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +7 -4
  447. package/packages/bundled-features/src/workflow-runner/runner.ts +2 -0
  448. package/samples/apps/admin-console/src/app/shell.tsx +1 -0
  449. package/samples/apps/showcase/src/features/demos/web/pages/dialog.tsx +0 -1
  450. package/samples/apps/showcase/src/features/demos/web/pages/layout.tsx +1 -1
  451. package/samples/apps/showcase/src/features/demos/web/pages/sidebar-panel.tsx +0 -1
  452. package/samples/apps/styleguide/src/features/gallery/web/Gallery.tsx +1 -4
  453. package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +6 -2
  454. package/samples/apps/use-all-bundled/e2e-billing-gallery/gallery-features.ts +12 -14
  455. package/samples/apps/use-all-bundled/feature-manifest.json +60 -29
  456. package/samples/apps/use-all-bundled/playwright.billing-docs.config.ts +1 -1
  457. package/samples/apps/use-all-bundled/playwright.config.ts +1 -0
  458. package/samples/apps/use-all-bundled/src/app/seed.ts +1 -1
  459. package/samples/apps/use-all-bundled/src/run-config.ts +2 -1
  460. package/samples/recipes/auth-mfa/src/web/confirmation-code-step.tsx +32 -10
  461. package/samples/recipes/chat-channels/README.md +2 -0
  462. package/samples/recipes/crypto-shredding-hr/README.md +11 -0
  463. package/samples/recipes/crypto-shredding-hr/src/feature.ts +27 -0
  464. package/samples/recipes/currencies-global/src/entities/currency.ts +1 -0
  465. package/samples/recipes/managed-pages/README.md +5 -1
  466. package/samples/recipes/managed-pages/package.json +3 -2
  467. package/samples/recipes/managed-pages/src/web/branded-preview.tsx +21 -0
  468. package/samples/recipes/managed-pages/tsconfig.json +8 -0
  469. package/samples/recipes/pwa-shell/README.md +52 -0
  470. package/samples/recipes/pwa-shell/bin/server.ts +12 -0
  471. package/samples/recipes/pwa-shell/package.json +13 -0
  472. package/samples/recipes/pwa-shell/src/app.ts +34 -0
  473. package/samples/recipes/rate-limiting/README.md +3 -3
  474. package/samples/recipes/record-detail-layout/README.md +33 -0
  475. package/samples/recipes/record-detail-layout/src/feature.ts +556 -44
  476. package/samples/recipes/record-detail-layout/src/order-board.ts +529 -0
  477. package/packages/bundled-features/src/managed-pages/web/page-body-section.tsx +0 -72
  478. package/packages/bundled-features/src/subscription-paddle/tenant-binding.ts +0 -34
  479. package/packages/bundled-features/src/template-resolver/web/content-field.tsx +0 -61
@@ -1,6 +1,7 @@
1
1
  import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { apiTokenTable } from "../../personal-access-tokens/index.ts";
3
3
  import { featureMounted } from "./feature-mounted.ts";
4
+ import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.ts";
4
5
 
5
6
  // userData-Hooks for personal-access-tokens rows. Same shape as user-session:
6
7
  // unmanaged direct-write store (no event stream, rebuild-safe DELETE), and a
@@ -29,8 +30,7 @@ export const apiTokenExportHook: UserDataExportHook = async (ctx) => {
29
30
  };
30
31
  };
31
32
 
32
- export const apiTokenDeleteHook: UserDataDeleteHook = async (ctx) => {
33
- // skip: personal-access-tokens not mounted — its table doesn't exist, nothing to erase.
34
- if (!featureMounted(ctx, "personal-access-tokens")) return;
35
- await ctx.db.deleteMany(apiTokenTable, { userId: ctx.userId, tenantId: ctx.tenantId });
36
- };
33
+ export const apiTokenDeleteHook: UserDataDeleteHook = hardDeleteOwnRowsDeleteHook({
34
+ featureName: "personal-access-tokens",
35
+ table: apiTokenTable,
36
+ });
@@ -0,0 +1,17 @@
1
+ import type { UserDataDeleteHook, UserDataHookCtx } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { featureMounted } from "./feature-mounted.ts";
3
+
4
+ type OwnRowsTable = Parameters<UserDataHookCtx["db"]["deleteMany"]>[0];
5
+
6
+ // Unmanaged direct-write stores (no event stream): a direct DELETE is rebuild-safe.
7
+ export function hardDeleteOwnRowsDeleteHook(source: {
8
+ readonly featureName: string;
9
+ readonly table: OwnRowsTable;
10
+ }): UserDataDeleteHook {
11
+ const { featureName, table } = source;
12
+ return async (ctx) => {
13
+ // skip: source feature not mounted — its table doesn't exist, nothing to erase.
14
+ if (!featureMounted(ctx, featureName)) return;
15
+ await ctx.db.deleteMany(table, { userId: ctx.userId, tenantId: ctx.tenantId });
16
+ };
17
+ }
@@ -1,6 +1,7 @@
1
1
  import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { inAppMessagesTable } from "../../channel-in-app/index.ts";
3
3
  import { featureMounted } from "./feature-mounted.ts";
4
+ import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.ts";
4
5
 
5
6
  // userData-Hooks for channel-in-app's in_app_messages. Plain SQL table (no
6
7
  // r.entity, no event stream — see channel-in-app/tables.ts), written by
@@ -30,8 +31,7 @@ export const inAppMessageExportHook: UserDataExportHook = async (ctx) => {
30
31
  };
31
32
  };
32
33
 
33
- export const inAppMessageDeleteHook: UserDataDeleteHook = async (ctx) => {
34
- // skip: channel-in-app not mounted — its table doesn't exist, nothing to erase.
35
- if (!featureMounted(ctx, "channel-in-app")) return;
36
- await ctx.db.deleteMany(inAppMessagesTable, { userId: ctx.userId, tenantId: ctx.tenantId });
37
- };
34
+ export const inAppMessageDeleteHook: UserDataDeleteHook = hardDeleteOwnRowsDeleteHook({
35
+ featureName: "channel-in-app",
36
+ table: inAppMessagesTable,
37
+ });
@@ -1,4 +1,5 @@
1
1
  import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { systemTenantReadDb } from "@cosmicdrift/kumiko-framework/internal/row-level-security";
2
3
  import { jobRunsTable } from "../../jobs/index.ts";
3
4
  import { featureMounted } from "./feature-mounted.ts";
4
5
 
@@ -10,7 +11,7 @@ import { featureMounted } from "./feature-mounted.ts";
10
11
 
11
12
  export const jobRunExportHook: UserDataExportHook = async (ctx) => {
12
13
  if (!featureMounted(ctx, "jobs")) return null;
13
- const rows = await ctx.db.selectMany<Record<string, unknown>>(jobRunsTable, {
14
+ const rows = await systemTenantReadDb(ctx.db).selectMany<Record<string, unknown>>(jobRunsTable, {
14
15
  triggeredById: ctx.userId,
15
16
  });
16
17
  if (rows.length === 0) return null;
@@ -1,6 +1,7 @@
1
1
  import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { userSessionTable } from "../../sessions/index.ts";
3
3
  import { featureMounted } from "./feature-mounted.ts";
4
+ import { hardDeleteOwnRowsDeleteHook } from "./hard-delete-own-rows-hook.ts";
4
5
 
5
6
  // userData-Hooks for the sessions feature's user-session rows (ip, userAgent).
6
7
  //
@@ -34,8 +35,7 @@ export const userSessionExportHook: UserDataExportHook = async (ctx) => {
34
35
  };
35
36
  };
36
37
 
37
- export const userSessionDeleteHook: UserDataDeleteHook = async (ctx) => {
38
- // skip: sessions not mounted — its table doesn't exist, nothing to erase.
39
- if (!featureMounted(ctx, "sessions")) return;
40
- await ctx.db.deleteMany(userSessionTable, { userId: ctx.userId, tenantId: ctx.tenantId });
41
- };
38
+ export const userSessionDeleteHook: UserDataDeleteHook = hardDeleteOwnRowsDeleteHook({
39
+ featureName: "sessions",
40
+ table: userSessionTable,
41
+ });
@@ -13,7 +13,6 @@ import { UserProfileErrors } from "../web/constants.ts";
13
13
  // Same failure shape as auth-email-password (anti-enumeration):
14
14
  // its errors.ts is not part of the feature barrel, but the reason code
15
15
  // and i18nKey are stable public API.
16
- // @wrapper-known error-helper
17
16
  function invalidCredentials() {
18
17
  return unprocessable(AuthErrors.invalidCredentials, "auth.errors.invalidCredentials");
19
18
  }
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.414.0",
4
+ "type": "fix",
5
+ "title": "Public handlers declare only the anonymous role",
6
+ "detail": "Handlers declaring access.anySignedIn next to the anonymous role list only anonymous in roles (the dropped signed-in roles never had an effect); the SUBMIT_ROLES constant of waitlist is removed."
7
+ },
2
8
  {
3
9
  "version": "0.411.0",
4
10
  "type": "improvement",
@@ -12,6 +12,7 @@ import {
12
12
  type WriteFailure,
13
13
  writeFailure,
14
14
  } from "@cosmicdrift/kumiko-framework/errors";
15
+ import { normalizeEmail } from "../../shared/index.ts";
15
16
  import {
16
17
  cancelPendingInvitation,
17
18
  INVITATION_STATUS,
@@ -21,7 +22,6 @@ import { isOpenWaitlistStatus } from "../entity.ts";
21
22
  import {
22
23
  adminAccess,
23
24
  isTenantMember,
24
- normalizeEmail,
25
25
  platformActor,
26
26
  waitlistDb,
27
27
  waitlistExecutor,
@@ -5,7 +5,6 @@ import {
5
5
  runInSavepointIfSupported,
6
6
  } from "@cosmicdrift/kumiko-framework/db";
7
7
  import {
8
- access,
9
8
  defineWriteHandler,
10
9
  type HandlerContext,
11
10
  type TenantId,
@@ -13,7 +12,8 @@ import {
13
12
  } from "@cosmicdrift/kumiko-framework/engine";
14
13
  import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
15
14
  import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
16
- import { normalizeEmail, platformActor, waitlistDb, waitlistExecutor } from "../lib.ts";
15
+ import { normalizeEmail, sendBestEffort } from "../../shared/index.ts";
16
+ import { platformActor, waitlistDb, waitlistExecutor } from "../lib.ts";
17
17
  import {
18
18
  resolveWaitlistMailLocale,
19
19
  waitlistAdminNoticeVariables,
@@ -33,13 +33,6 @@ const SUBMIT_LOCK_NAMESPACE = 0x776c7374;
33
33
  const SUBMIT_LOCK_REASON =
34
34
  "takes the per-email advisory lock so parallel submits cannot both pass the duplicate check and wraps the admin-recipient resolver in a savepoint so a failing statement cannot abort the submit transaction; TenantDb has neither API";
35
35
 
36
- const SUBMIT_ROLES = access.roles(
37
- ...access.anonymous,
38
- ...access.authenticated,
39
- "Member",
40
- "TenantAdmin",
41
- );
42
-
43
36
  const OPEN_STATUSES = [WAITLIST_STATUS.Pending, WAITLIST_STATUS.Invited];
44
37
 
45
38
  export type WaitlistSubmitData = { readonly kind: "submitted" };
@@ -109,29 +102,12 @@ async function resolveAdminRecipient(
109
102
  }
110
103
  }
111
104
 
112
- async function sendBestEffort(
113
- ctx: HandlerContext,
114
- label: string,
115
- send: (notify: NonNullable<HandlerContext["notify"]>) => Promise<unknown>,
116
- ): Promise<void> {
117
- try {
118
- if (!ctx.notify) {
119
- throw new InternalError({ message: "ctx.notify unavailable — mount the delivery feature" });
120
- }
121
- await send(ctx.notify);
122
- } catch (err) {
123
- ctx.obs.log?.warn(`[waitlist:submit] ${label} mail failed`, {
124
- error: err instanceof Error ? err.message : String(err),
125
- });
126
- }
127
- }
128
-
129
105
  export function createSubmitHandler(opts: WaitlistOptions) {
130
106
  const emailRateLimits = opts.emailRateLimits ?? DEFAULT_SUBMIT_EMAIL_RATE_LIMITS;
131
107
  return defineWriteHandler<"submit", typeof WaitlistSubmitSchema, WaitlistSubmitData>({
132
108
  name: "submit",
133
109
  schema: WaitlistSubmitSchema,
134
- access: { roles: SUBMIT_ROLES, personalData: "public-intake", anySignedIn: true },
110
+ access: { roles: ["anonymous"], personalData: "public-intake", anySignedIn: true },
135
111
  rateLimit: opts.rateLimit ?? DEFAULT_SUBMIT_RATE_LIMIT,
136
112
  // An empty array means "disabled"; boot validation rejects an empty additionalRateLimits.
137
113
  ...(emailRateLimits.length > 0 && { additionalRateLimits: emailRateLimits }),
@@ -175,7 +151,7 @@ export function createSubmitHandler(opts: WaitlistOptions) {
175
151
  );
176
152
  if (!created.isSuccess) return created;
177
153
 
178
- await sendBestEffort(ctx, "confirmation", (notify) =>
154
+ await sendBestEffort(ctx, "[waitlist:submit] confirmation mail failed", (notify) =>
179
155
  notify(WAITLIST_NOTIFICATION_TYPES.confirmation, {
180
156
  route: { email },
181
157
  data: waitlistConfirmationVariables({
@@ -187,7 +163,7 @@ export function createSubmitHandler(opts: WaitlistOptions) {
187
163
  }),
188
164
  );
189
165
 
190
- await sendBestEffort(ctx, "admin notice", async (notify) => {
166
+ await sendBestEffort(ctx, "[waitlist:submit] admin notice mail failed", async (notify) => {
191
167
  // skip: no admin recipient configured
192
168
  if (!adminRecipient) return;
193
169
  await notify(WAITLIST_NOTIFICATION_TYPES.adminNotice, {
@@ -2,7 +2,8 @@ import { createHash } from "node:crypto";
2
2
  import type { TenantDb } from "@cosmicdrift/kumiko-framework/db";
3
3
  import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
4
4
  import type { Temporal } from "@cosmicdrift/kumiko-types/temporal";
5
- import { normalizeEmail, platformActor, waitlistExecutor } from "./lib.ts";
5
+ import { normalizeEmail } from "../shared/index.ts";
6
+ import { platformActor, waitlistExecutor } from "./lib.ts";
6
7
  import { WAITLIST_FIELD_LIMITS, type WaitlistStatus } from "./web/constants.ts";
7
8
 
8
9
  export type WaitlistImportEntry = {
@@ -11,7 +11,7 @@ import {
11
11
  SYSTEM_TENANT_ID,
12
12
  type TenantId,
13
13
  } from "@cosmicdrift/kumiko-framework/engine";
14
- import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
14
+ import { acknowledgedSystemDb, normalizeEmail } from "../shared/index.ts";
15
15
  import { tenantMembershipsTable } from "../tenant/index.ts";
16
16
  import { userTable } from "../user/index.ts";
17
17
  import { waitlistEntryEntity, waitlistEntryTable } from "./entity.ts";
@@ -24,17 +24,8 @@ export const waitlistExecutor = createEventStoreExecutor(waitlistEntryTable, wai
24
24
  entityName: "waitlistEntry",
25
25
  });
26
26
 
27
- export function normalizeEmail(email: string): string {
28
- return email.toLowerCase();
29
- }
30
-
31
27
  export function waitlistDb(ctx: Pick<AppContext, "systemDb">): TenantDb {
32
- if (!ctx.systemDb) {
33
- throw new InternalError({
34
- message: "waitlist requires ctx.systemDb — is r.systemScope() set on the feature?",
35
- });
36
- }
37
- return ctx.systemDb.acknowledgeCrossTenant(WAITLIST_CROSS_TENANT_REASON);
28
+ return acknowledgedSystemDb(ctx, "waitlist", WAITLIST_CROSS_TENANT_REASON);
38
29
  }
39
30
 
40
31
  // Entries are systemStream rows, so every write targets the system tenant's stream.
@@ -7,10 +7,10 @@ import {
7
7
  import { type MultiStreamApplyFn, SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
8
8
  import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
9
9
  import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
10
- import { decryptStoredPii } from "../shared/index.ts";
10
+ import { decryptStoredPii, normalizeEmail } from "../shared/index.ts";
11
11
  import { tenantMembershipsTable } from "../tenant/index.ts";
12
12
  import { userTable } from "../user/index.ts";
13
- import { normalizeEmail, platformActor, waitlistExecutor } from "./lib.ts";
13
+ import { platformActor, waitlistExecutor } from "./lib.ts";
14
14
  import { DEFAULT_OWN_TENANT_INVITE_ROLE, WAITLIST_STATUS } from "./web/constants.ts";
15
15
 
16
16
  const PII_DECRYPT_REASON = "waitlist:link-on-signup";
@@ -4,29 +4,16 @@ import type {
4
4
  UserDataExportHook,
5
5
  UserDataHookCtx,
6
6
  } from "@cosmicdrift/kumiko-framework/engine";
7
- import { collectErasureFailure, decryptStoredPii, throwIfErasureFailed } from "../shared/index.ts";
8
- import { userTable } from "../user/index.ts";
9
- import { normalizeEmail, platformActor, waitlistExecutor } from "./lib.ts";
7
+ import { collectErasureFailure, throwIfErasureFailed } from "../shared/index.ts";
8
+ import { resolveVerifiedUserEmail } from "../user/index.ts";
9
+ import { platformActor, waitlistExecutor } from "./lib.ts";
10
10
 
11
11
  const PII_DECRYPT_REASON = "waitlist:user-data";
12
12
  const ERASE_REASON = "waitlist:user-data-forget";
13
13
  const ENTRY_LOOKUP_LIMIT = 100;
14
14
 
15
- // Entries are matched by email, so the user must have proven they own it:
16
- // otherwise registering with someone else's address would expose or erase that
17
- // person's entries. The forget anonymization leaves emailVerified untouched,
18
- // so the live row stays a reliable source; only the email needs the pre-tx
19
- // copy because the user hook has already rewritten it by now.
20
- async function resolveVerifiedUserEmail(ctx: UserDataHookCtx): Promise<string | null> {
21
- const row = await ctx.db.fetchOne<{ email: string; emailVerified: boolean }>(userTable, {
22
- id: ctx.userId,
23
- });
24
- if (row?.emailVerified !== true) return null;
25
- if (ctx.userEmailBeforeDelete) return normalizeEmail(ctx.userEmailBeforeDelete);
26
- return normalizeEmail(await decryptStoredPii(row.email, "email", PII_DECRYPT_REASON));
27
- }
28
-
29
15
  // Entries are decrypted by the executor's list (subject-encrypted name/email/message).
16
+ // guard:dup-ok executor and foreign-key field differ; a generic executor abstraction would obscure row types.
30
17
  async function findEntriesByEmail(ctx: UserDataHookCtx, email: string) {
31
18
  const found = await waitlistExecutor.list(
32
19
  { filter: { field: "email", op: "eq", value: email }, limit: ENTRY_LOOKUP_LIMIT },
@@ -37,7 +24,7 @@ async function findEntriesByEmail(ctx: UserDataHookCtx, email: string) {
37
24
  }
38
25
 
39
26
  export const waitlistEntryExportHook: UserDataExportHook = async (ctx) => {
40
- const email = await resolveVerifiedUserEmail(ctx);
27
+ const email = await resolveVerifiedUserEmail(ctx, PII_DECRYPT_REASON);
41
28
  // skip: unverified or missing email must not be matched against waitlist entries
42
29
  if (!email) return null;
43
30
  const rows = await findEntriesByEmail(ctx, email);
@@ -61,7 +48,7 @@ export const waitlistEntryExportHook: UserDataExportHook = async (ctx) => {
61
48
  // is purged through the executor (replays on rebuild) and its record subject
62
49
  // key is shredded so the event log's ciphertext becomes unreadable.
63
50
  export const waitlistEntryDeleteHook: UserDataDeleteHook = async (ctx) => {
64
- const email = await resolveVerifiedUserEmail(ctx);
51
+ const email = await resolveVerifiedUserEmail(ctx, PII_DECRYPT_REASON);
65
52
  // skip: unverified or missing email must not be matched against waitlist entries
66
53
  if (!email) return;
67
54
  const kms = configuredPiiSubjectKms();
@@ -14,7 +14,6 @@ const WORKFLOW_RUN_NAMESPACE = "1f8a6c3e-7d2b-4a91-9e3f-5c8b2a41d6f0";
14
14
  * re-triggers of the same key — those land as version 2, 3, ... on the same
15
15
  * stream and each starts its own run; that's out of scope.
16
16
  */
17
- // @wrapper-known uuid-domain
18
17
  export function workflowRunAggregateId(workflowName: string, key: string): string {
19
18
  return uuidv5(`${workflowName}|${key}`, WORKFLOW_RUN_NAMESPACE);
20
19
  }
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.415.0",
4
+ "type": "fix",
5
+ "title": "Resumed steps receive a registered TenantDb",
6
+ "detail": "The resume-run handler handed steps a spread copy of the tenant db. Framework helpers that look a TenantDb up by identity (executors, runInOwnTransaction) rejected that copy with \"TenantDb not built by createTenantDb\". The steps now get the same db with outsideTransaction dropped in place."
7
+ },
2
8
  {
3
9
  "version": "0.391.1",
4
10
  "type": "improvement",
@@ -9,6 +9,7 @@
9
9
  // the pipeline are not atomic. A throw from startAndRunWorkflow is recorded
10
10
  // as `workflow.run-failed` and swallowed, so the dispatcher moves on.
11
11
 
12
+ import { queryDatabaseNow } from "@cosmicdrift/kumiko-framework/db";
12
13
  import type {
13
14
  FeatureRegistrar,
14
15
  MultiStreamProjectionDefinition,
@@ -107,7 +108,7 @@ export function registerEventTrigger(r: FeatureRegistrar, workflow: WorkflowDefi
107
108
  // replay the historical log and fire every side-effect step retroactively.
108
109
  startFrom: "now",
109
110
  apply: {
110
- [eventType]: async (event, _tx, ctx) => {
111
+ [eventType]: async (event, tx, ctx) => {
111
112
  // skip: unreachable — the guard above already established this, but the
112
113
  // closure does not carry that narrowing, and re-narrowing here keeps
113
114
  // `trigger.filter` below typed without a cast.
@@ -145,7 +146,10 @@ export function registerEventTrigger(r: FeatureRegistrar, workflow: WorkflowDefi
145
146
  },
146
147
  ...(idempotencyKey && { idempotencyKey }),
147
148
  // The MSP context is still flat; the runner reads the namespaced shape.
148
- handlerCtx: { events: { unsafeAppend: ctx.unsafeAppendEvent } },
149
+ handlerCtx: {
150
+ events: { unsafeAppend: ctx.unsafeAppendEvent },
151
+ db: { databaseNow: () => queryDatabaseNow(tx) },
152
+ },
149
153
  });
150
154
  } catch (error) {
151
155
  // Failures outside the step loop (run-started append) have no step yet, so 0.
@@ -64,11 +64,7 @@ export function createWorkflowRunnerFeature() {
64
64
  if (!ctx.systemDb) {
65
65
  throw new Error("resume-due-runs: ctx.systemDb required (r.systemScope() feature)");
66
66
  }
67
- const tenantId = ctx.systemUser?.tenantId ?? ctx._tenantId;
68
- if (tenantId === undefined) {
69
- // skip: cron fired without a perTenant fan-out tenant — nothing scoped
70
- return;
71
- }
67
+ const tenantId = ctx.systemUser.tenantId;
72
68
 
73
69
  const dueRows = await selectDueWorkflowRunPending(
74
70
  ctx.systemDb.assertTenantMatch(tenantId),
@@ -30,8 +30,9 @@
30
30
  // resultKey on steps/wait-for-event.ts) — pre-seeded into stepsAcc below so
31
31
  // a subsequent step's resolver can read `ctx.steps[awaits.someKey]`.
32
32
 
33
- import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
33
+ import { fetchOne, type TenantDb } from "@cosmicdrift/kumiko-framework/db";
34
34
  import {
35
+ attachOutsideTransaction,
35
36
  buildPipelineSteps,
36
37
  computeDefinitionFingerprint,
37
38
  describeWorkflowStepError,
@@ -334,7 +335,7 @@ type ResumedPipelineInput = {
334
335
  };
335
336
  };
336
337
 
337
- async function runResumedPipeline(ctx: HandlerContext, input: ResumedPipelineInput) {
338
+ async function runResumedPipeline(ctx: HandlerContext, db: TenantDb, input: ResumedPipelineInput) {
338
339
  const {
339
340
  workflow,
340
341
  workflowName,
@@ -362,10 +363,12 @@ async function runResumedPipeline(ctx: HandlerContext, input: ResumedPipelineInp
362
363
  stepIndex,
363
364
  );
364
365
 
366
+ // The handler is system-scoped, so ctx.db is unusable; the steps get the tenant db without
367
+ // outsideTransaction. Dropped in place: a copy would fall out of the identity-keyed TenantDb registries.
365
368
  const outcome = await runStepList(
366
369
  steps,
367
370
  triggerEvent,
368
- ctx,
371
+ { ...ctx, db: attachOutsideTransaction(db, undefined) },
369
372
  stepsAcc,
370
373
  {},
371
374
  workflowCtx,
@@ -514,7 +517,7 @@ export const resumeRunHandler: WriteHandlerDef = {
514
517
  const resumeFrom =
515
518
  pending.suspensionEventType === WORKFLOW_RETRY_SCHEDULED_TYPE ? stepIndex : stepIndex + 1;
516
519
 
517
- return runResumedPipeline(ctx, {
520
+ return runResumedPipeline(ctx, db, {
518
521
  workflow,
519
522
  workflowName,
520
523
  runId,
@@ -77,6 +77,8 @@ export type WorkflowRunFailedPayload = {
77
77
 
78
78
  export type WorkflowRunContext = {
79
79
  readonly events: Pick<HandlerContext["events"], "unsafeAppend">;
80
+ // wait, waitForEvent and retry derive their wake time from the database clock.
81
+ readonly db: Pick<HandlerContext["db"], "databaseNow">;
80
82
  };
81
83
 
82
84
  export class WorkflowSuspensionUnsupportedError extends Error {
@@ -34,6 +34,7 @@ export function AppShell({
34
34
  <WorkspaceShell
35
35
  brand={<Brand />}
36
36
  schema={schema}
37
+ navStyle="plain"
37
38
  topbarActions={
38
39
  <DefaultTopbarActions
39
40
  lightIcon={<Sun className="h-4 w-4" />}
@@ -62,7 +62,6 @@ export function DialogDemo(): ReactNode {
62
62
  </DemoSection>
63
63
 
64
64
  <DemoSection title="Lightbox">
65
- {/* kumiko-lint-ignore primitives-discipline clickable image thumbnail (lightbox trigger) — not a text button, <Button> cannot wrap a full-bleed <img> */}
66
65
  <button
67
66
  type="button"
68
67
  onClick={() => setLightboxOpen(true)}
@@ -31,7 +31,7 @@ function Slot({
31
31
  readonly className?: string;
32
32
  }): ReactNode {
33
33
  const toneClass =
34
- tone === "muted" ? "bg-muted/40" : tone === "actionBar" ? "bg-muted/30" : "bg-card"; // kumiko-lint-ignore primitives-discipline layout-tone helper (Default-Tone, kein Card-Panel)
34
+ tone === "muted" ? "bg-muted/40" : tone === "actionBar" ? "bg-muted/30" : "bg-card";
35
35
  return (
36
36
  <div
37
37
  className={`flex flex-col items-start justify-center px-3 py-2 ${toneClass} ${className ?? ""}`}
@@ -104,7 +104,6 @@ export function SidebarPanelDemo(): ReactNode {
104
104
  </div>
105
105
  <div className="flex min-h-0 flex-1 flex-col overflow-y-auto">
106
106
  {MAILS.map((mail) => (
107
- // kumiko-lint-ignore primitives-discipline multi-line clickable row (from/subject/teaser stacked) — the core Button primitive is a single-line inline control
108
107
  <button
109
108
  type="button"
110
109
  key={mail.subject}
@@ -12,7 +12,7 @@ import type { ReactNode } from "react";
12
12
  const SWATCHES: ReadonlyArray<readonly [string, string]> = [
13
13
  ["background", "bg-background"],
14
14
  ["foreground", "bg-foreground"],
15
- ["card", "bg-card"], // kumiko-lint-ignore primitives-discipline foundation-token swatch (zeigt das bg-card-Token selbst)
15
+ ["card", "bg-card"],
16
16
  ["primary", "bg-primary"],
17
17
  ["secondary", "bg-secondary"],
18
18
  ["muted", "bg-muted"],
@@ -359,7 +359,6 @@ export function Gallery(): ReactNode {
359
359
  <div className="flex items-center gap-3 p-2">
360
360
  <div className="relative min-w-0 flex-1">
361
361
  <Search className="text-muted-foreground absolute left-3 top-1/2 size-4 -translate-y-1/2" />
362
- {/* kumiko-lint-ignore primitives-discipline readOnly search-pill visual (rounded-full with inset icon) — pattern demo, not a form field */}
363
362
  <input
364
363
  className="bg-muted/50 placeholder:text-muted-foreground focus-visible:ring-ring h-10 w-full rounded-full border-none pl-9 pr-4 text-sm outline-none focus-visible:ring-2"
365
364
  placeholder="Search holdings or tickers…"
@@ -780,7 +779,6 @@ export function Gallery(): ReactNode {
780
779
  <Block id="nav" title="Navigation">
781
780
  {/* ponytail: static replica of the nav standard — the LIVE nav is
782
781
  the sidebar on the left (NavTree), isolated here for the docs. */}
783
- {/* kumiko-lint-ignore primitives-discipline nav-surface demo (navigation surface, not a card) */}
784
782
  <div className="bg-card w-60 rounded-lg border p-3 text-sm shadow-sm">
785
783
  <div className="text-muted-foreground/70 px-2 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wider">
786
784
  Workspace
@@ -815,7 +813,6 @@ export function Gallery(): ReactNode {
815
813
  <div className="flex flex-wrap items-end gap-6">
816
814
  {SHADOWS.map(([name, cls]) => (
817
815
  <div key={name} className="flex flex-col items-center gap-2">
818
- {/* kumiko-lint-ignore primitives-discipline elevation-swatch (Foundation-Token-Demo, kein Card) */}
819
816
  <div className={`bg-card size-16 rounded-lg ${cls}`} />
820
817
  <span className="text-muted-foreground text-xs">{name}</span>
821
818
  </div>
@@ -4,6 +4,7 @@ import {
4
4
  type SubscriptionProviderPlugin,
5
5
  } from "@cosmicdrift/kumiko-bundled-features/billing-foundation";
6
6
  import { defineFeature, i18nKey } from "@cosmicdrift/kumiko-framework/engine";
7
+ import { parseJsonOrThrow } from "@cosmicdrift/kumiko-framework/utils";
7
8
  import { toKeyFirst } from "../translations";
8
9
  import { subscriptionPlansTranslations } from "./i18n";
9
10
 
@@ -36,10 +37,13 @@ const PRICES: readonly ProviderPrice[] = [
36
37
 
37
38
  // The sample talks to no payment provider: prices are fixed and checkout just returns to the plans screen.
38
39
  const mockProvider: SubscriptionProviderPlugin = {
39
- verifyAndParseWebhook: async (rawBody) => JSON.parse(rawBody),
40
+ verifyAndParseWebhook: async (rawBody) => parseJsonOrThrow(rawBody, "mock provider webhook body"),
40
41
  priceToTier: { [PRICE_IDS.starter]: "starter", [PRICE_IDS.pro]: "pro" },
41
42
  retrievePrices: async (_ctx, priceIds) => PRICES.filter((p) => priceIds.includes(p.priceId)),
42
- createCheckoutSession: async (_ctx, options) => ({ url: options.successUrl }),
43
+ createCheckoutSession: async (_ctx, options) => ({
44
+ url: options.successUrl,
45
+ providerCheckoutId: `cs_sample_${options.tenantId}`,
46
+ }),
43
47
  cancelSubscription: async () => {},
44
48
  };
45
49
 
@@ -4,6 +4,7 @@
4
4
  // provider (the only fake — real handlers, real dispatcher), the catalog and
5
5
  // the nav entry that makes billing-foundation's dormant plans screen reachable.
6
6
 
7
+ import { randomUUID } from "node:crypto";
7
8
  import {
8
9
  createBillingFoundationFeature,
9
10
  type ProviderPrice,
@@ -145,8 +146,8 @@ export function createGalleryEmailFeature(): FeatureDefinition {
145
146
  });
146
147
  }
147
148
 
148
- // The page URL carries the consent id so the spec can echo it on the webhook,
149
- // exactly as a real provider echoes the checkout metadata.
149
+ // The page URL carries the checkout id so the spec can echo it on the webhook, exactly as a real
150
+ // provider names its checkout in the created event.
150
151
  const galleryProviderPlugin: SubscriptionProviderPlugin = {
151
152
  displayName: "Stripe",
152
153
  verifyAndParseWebhook: async (rawBody) => JSON.parse(rawBody),
@@ -156,17 +157,17 @@ const galleryProviderPlugin: SubscriptionProviderPlugin = {
156
157
  },
157
158
  retrievePrices: async (_ctx, priceIds) => PRICES.filter((p) => priceIds.includes(p.priceId)),
158
159
  createCheckoutSession: async (_ctx, options) => {
160
+ const providerCheckoutId = `cs_gallery_${randomUUID()}`;
159
161
  const url = new URL(options.successUrl);
160
- if (options.consentId !== undefined) url.searchParams.set("consentId", options.consentId);
161
- return { url: url.toString() };
162
+ url.searchParams.set("providerCheckoutId", providerCheckoutId);
163
+ return { url: url.toString(), providerCheckoutId };
162
164
  },
163
165
  cancelSubscription: async () => {},
164
166
  };
165
167
 
166
168
  // Merchant-of-record stand-in: switches plans in the app with fixed figures
167
- // (Starter to Pro: 6.67 EUR due now, 1.06 EUR of it VAT). Applying without a
168
- // consent id fails, so a successful switch in the spec proves the consent went
169
- // through.
169
+ // (Starter to Pro: 6.67 EUR due now, 1.06 EUR of it VAT). The consent of the switch
170
+ // is recorded by billing-foundation before this mock runs.
170
171
  const galleryMorProviderPlugin: SubscriptionProviderPlugin = {
171
172
  displayName: "Paddle",
172
173
  isBillingEnabled: async (ctx) => morEnabledTenants.has(ctx.user.tenantId),
@@ -179,8 +180,9 @@ const galleryMorProviderPlugin: SubscriptionProviderPlugin = {
179
180
  createCheckoutSession: async (_ctx, options) => {
180
181
  const url = new URL(options.successUrl);
181
182
  url.searchParams.set("provider", "mor");
182
- if (options.consentId !== undefined) url.searchParams.set("consentId", options.consentId);
183
- return { url: url.toString() };
183
+ const providerCheckoutId = `txn_gallery_${randomUUID()}`;
184
+ url.searchParams.set("providerCheckoutId", providerCheckoutId);
185
+ return { url: url.toString(), providerCheckoutId };
184
186
  },
185
187
  cancelSubscription: async () => {},
186
188
  previewPlanSwitch: async () => ({
@@ -191,11 +193,7 @@ const galleryMorProviderPlugin: SubscriptionProviderPlugin = {
191
193
  ...(isDocsVariant && { recurringAmount: 2368, recurringTax: 378 }),
192
194
  effectiveAt: "2027-01-15T00:00:00Z",
193
195
  }),
194
- applyPlanSwitch: async (_ctx, options) => {
195
- if (options.consentId === undefined) {
196
- throw new Error("gallery MoR mock: plan switch applied without a consent id");
197
- }
198
- },
196
+ applyPlanSwitch: async () => {},
199
197
  };
200
198
 
201
199
  export const galleryProviderFeature: FeatureDefinition = defineFeature(