@cosmicdrift/kumiko-samples 0.413.1 → 0.414.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 (457) 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/unlock-token.ts +0 -2
  36. package/packages/bundled-features/src/auth-email-password/verification-token.ts +0 -2
  37. package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +2 -2
  38. package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +2 -2
  39. package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +5 -0
  40. package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +1 -6
  41. package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +1 -1
  42. package/packages/bundled-features/src/auth-email-password/web/return-path.ts +2 -1
  43. package/packages/bundled-features/src/auth-email-password/web/session.tsx +10 -12
  44. package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +1 -6
  45. package/packages/bundled-features/src/auth-email-password/web/static-account.ts +6 -1
  46. package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +1 -1
  47. package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +4 -5
  48. package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +1 -1
  49. package/packages/bundled-features/src/auth-mfa/web/mfa-code-or-recovery-field.tsx +17 -1
  50. package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -1
  51. package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -1
  52. package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +1 -1
  53. package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +16 -47
  54. package/packages/bundled-features/src/auth-mfa-user-data/index.ts +5 -6
  55. package/packages/bundled-features/src/billing-foundation/aggregate-id.ts +0 -4
  56. package/packages/bundled-features/src/billing-foundation/changes.json +37 -0
  57. package/packages/bundled-features/src/billing-foundation/checkout-core.ts +8 -1
  58. package/packages/bundled-features/src/billing-foundation/checkout-ledger.ts +59 -0
  59. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-gate.ts +2 -1
  60. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +49 -2
  61. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-open-cancels.ts +5 -0
  62. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-provider-timeout.ts +23 -0
  63. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +12 -7
  64. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +1 -1
  65. package/packages/bundled-features/src/billing-foundation/events.ts +49 -10
  66. package/packages/bundled-features/src/billing-foundation/feature.ts +15 -1
  67. package/packages/bundled-features/src/billing-foundation/handlers/billing-plans.query.ts +47 -14
  68. package/packages/bundled-features/src/billing-foundation/handlers/create-checkout-session.write.ts +7 -1
  69. package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +124 -10
  70. package/packages/bundled-features/src/billing-foundation/handlers/process-payment-event.write.ts +33 -9
  71. package/packages/bundled-features/src/billing-foundation/handlers/record-checkout-opened.write.ts +25 -0
  72. package/packages/bundled-features/src/billing-foundation/handlers/start-plan-checkout.write.ts +7 -1
  73. package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +16 -4
  74. package/packages/bundled-features/src/billing-foundation/i18n.ts +3 -0
  75. package/packages/bundled-features/src/billing-foundation/pending-plan-switch.ts +80 -0
  76. package/packages/bundled-features/src/billing-foundation/scrub-raw-payload-headers.ts +50 -0
  77. package/packages/bundled-features/src/billing-foundation/types.ts +47 -30
  78. package/packages/bundled-features/src/billing-foundation/validate-options.ts +18 -0
  79. package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +10 -5
  80. package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -1
  81. package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -1
  82. package/packages/bundled-features/src/billing-foundation/web/constants.ts +5 -2
  83. package/packages/bundled-features/src/billing-foundation/web/plan-switch-confirm-dialog.tsx +1 -1
  84. package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +65 -17
  85. package/packages/bundled-features/src/cap-counter/aggregate-id.ts +0 -2
  86. package/packages/bundled-features/src/cap-counter/changes.json +6 -0
  87. package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +19 -4
  88. package/packages/bundled-features/src/cap-overview/changes.json +6 -0
  89. package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +22 -6
  90. package/packages/bundled-features/src/cap-overview/i18n.ts +1 -0
  91. package/packages/bundled-features/src/cap-overview/index.ts +1 -0
  92. package/packages/bundled-features/src/cap-overview/types.ts +11 -1
  93. package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +6 -2
  94. package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +10 -1
  95. package/packages/bundled-features/src/cap-overview/web/usage-math.ts +5 -0
  96. package/packages/bundled-features/src/channel-in-app/changes.json +6 -0
  97. package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +2 -2
  98. package/packages/bundled-features/src/channel-whatsapp/aggregate-id.ts +29 -0
  99. package/packages/bundled-features/src/channel-whatsapp/changes.json +8 -0
  100. package/packages/bundled-features/src/channel-whatsapp/constants.ts +46 -0
  101. package/packages/bundled-features/src/channel-whatsapp/events.ts +93 -0
  102. package/packages/bundled-features/src/channel-whatsapp/feature.ts +72 -0
  103. package/packages/bundled-features/src/channel-whatsapp/graph-client.ts +398 -0
  104. package/packages/bundled-features/src/channel-whatsapp/in-memory-meta.ts +300 -0
  105. package/packages/bundled-features/src/channel-whatsapp/inbound-handlers.ts +189 -0
  106. package/packages/bundled-features/src/channel-whatsapp/index.ts +66 -0
  107. package/packages/bundled-features/src/channel-whatsapp/meta-signature.ts +26 -0
  108. package/packages/bundled-features/src/channel-whatsapp/options.ts +149 -0
  109. package/packages/bundled-features/src/channel-whatsapp/pii.ts +109 -0
  110. package/packages/bundled-features/src/channel-whatsapp/webhook-normalize.ts +226 -0
  111. package/packages/bundled-features/src/channel-whatsapp/webhook-routes.ts +185 -0
  112. package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +1 -1
  113. package/packages/bundled-features/src/config/changes.json +12 -0
  114. package/packages/bundled-features/src/config/handlers/set.write.ts +7 -0
  115. package/packages/bundled-features/src/config/handlers/values.query.ts +8 -1
  116. package/packages/bundled-features/src/config/index.ts +1 -0
  117. package/packages/bundled-features/src/config/read-redaction.ts +6 -3
  118. package/packages/bundled-features/src/config/table.ts +1 -0
  119. package/packages/bundled-features/src/config/write-helpers.ts +3 -2
  120. package/packages/bundled-features/src/crypto-shredding/changes.json +18 -0
  121. package/packages/bundled-features/src/crypto-shredding/constants.ts +2 -0
  122. package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +38 -18
  123. package/packages/bundled-features/src/crypto-shredding/index.ts +4 -0
  124. package/packages/bundled-features/src/crypto-shredding/subject-forget-after-delete-hook.ts +49 -0
  125. package/packages/bundled-features/src/custom-fields/aggregate-id.ts +0 -1
  126. package/packages/bundled-features/src/custom-fields/entity.ts +1 -0
  127. package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +0 -1
  128. package/packages/bundled-features/src/data-retention/changes.json +12 -0
  129. package/packages/bundled-features/src/data-retention/erase-notes-of-deleted-row.ts +23 -0
  130. package/packages/bundled-features/src/data-retention/feature.ts +1 -5
  131. package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +38 -18
  132. package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +9 -0
  133. package/packages/bundled-features/src/delivery/attempt-log-factory.ts +11 -0
  134. package/packages/bundled-features/src/delivery/attempt-log.ts +3 -3
  135. package/packages/bundled-features/src/delivery/changes.json +6 -0
  136. package/packages/bundled-features/src/delivery/channel-context.ts +6 -3
  137. package/packages/bundled-features/src/delivery/db/queries/preferences.ts +0 -1
  138. package/packages/bundled-features/src/delivery/delivery-service.ts +3 -0
  139. package/packages/bundled-features/src/delivery/feature.ts +4 -13
  140. package/packages/bundled-features/src/delivery/handlers/opted-in-user-ids.query.ts +45 -0
  141. package/packages/bundled-features/src/delivery/handlers/preferences.query.ts +2 -20
  142. package/packages/bundled-features/src/delivery/handlers/resubscribe-user.write.ts +2 -25
  143. package/packages/bundled-features/src/delivery/handlers/unsubscribe-page-chrome.query.ts +2 -0
  144. package/packages/bundled-features/src/delivery/handlers/unsubscribe-user.write.ts +2 -27
  145. package/packages/bundled-features/src/delivery/index.ts +3 -1
  146. package/packages/bundled-features/src/delivery/options.ts +11 -0
  147. package/packages/bundled-features/src/delivery/preference-rows.ts +33 -0
  148. package/packages/bundled-features/src/delivery/set-preference-enabled.ts +40 -0
  149. package/packages/bundled-features/src/delivery/testing.ts +3 -1
  150. package/packages/bundled-features/src/delivery/types.ts +1 -0
  151. package/packages/bundled-features/src/delivery/unsubscribe-page.ts +7 -1
  152. package/packages/bundled-features/src/delivery/upsert-preference.ts +0 -1
  153. package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
  154. package/packages/bundled-features/src/derivatives-sharp/render.ts +9 -9
  155. package/packages/bundled-features/src/document-ingest-foundation/aggregate-id.ts +0 -1
  156. package/packages/bundled-features/src/document-ingest-foundation/append-missing-extract-event.ts +37 -25
  157. package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +32 -14
  158. package/packages/bundled-features/src/documents/aggregate-id.ts +0 -2
  159. package/packages/bundled-features/src/documents/changes.json +18 -0
  160. package/packages/bundled-features/src/documents/constants.ts +10 -2
  161. package/packages/bundled-features/src/documents/ensure-link.ts +3 -4
  162. package/packages/bundled-features/src/documents/feature.ts +28 -6
  163. package/packages/bundled-features/src/documents/handlers/import.write.ts +2 -2
  164. package/packages/bundled-features/src/documents/queries/expiry-overview.query.ts +2 -1
  165. package/packages/bundled-features/src/documents/queries/for-record.query.ts +3 -4
  166. package/packages/bundled-features/src/documents/queries/list-page.ts +11 -3
  167. package/packages/bundled-features/src/documents/queries/overview.query.ts +2 -2
  168. package/packages/bundled-features/src/documents/screens.ts +8 -3
  169. package/packages/bundled-features/src/documents/tab.ts +1 -1
  170. package/packages/bundled-features/src/feature-toggles/toggle-sync-signal.ts +6 -3
  171. package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +1 -1
  172. package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
  173. package/packages/bundled-features/src/file-foundation/probe.ts +9 -3
  174. package/packages/bundled-features/src/file-foundation/read-file-ref-content.ts +24 -11
  175. package/packages/bundled-features/src/file-provider-inmemory/feature.ts +1 -1
  176. package/packages/bundled-features/src/file-provider-s3/changes.json +14 -0
  177. package/packages/bundled-features/src/file-provider-s3/env-feature.ts +1 -1
  178. package/packages/bundled-features/src/file-provider-s3/env-named-feature.ts +1 -1
  179. package/packages/bundled-features/src/file-provider-s3/env-schema.ts +24 -7
  180. package/packages/bundled-features/src/file-provider-s3/feature.ts +1 -1
  181. package/packages/bundled-features/src/file-provider-s3/index.ts +7 -1
  182. package/packages/bundled-features/src/file-provider-s3/lib/env-helper.ts +21 -13
  183. package/packages/bundled-features/src/file-provider-s3/lib/s3-provider.ts +8 -1
  184. package/packages/bundled-features/src/files/changes.json +7 -0
  185. package/packages/bundled-features/src/folders/aggregate-id.ts +0 -1
  186. package/packages/bundled-features/src/folders/web/folder-manager.tsx +6 -6
  187. package/packages/bundled-features/src/folders-user-data/index.ts +12 -14
  188. package/packages/bundled-features/src/helpdesk/changes.json +50 -0
  189. package/packages/bundled-features/src/helpdesk/entity.ts +4 -1
  190. package/packages/bundled-features/src/helpdesk/feature.ts +41 -0
  191. package/packages/bundled-features/src/helpdesk/handlers/access.ts +0 -10
  192. package/packages/bundled-features/src/helpdesk/handlers/attempts.ts +7 -14
  193. package/packages/bundled-features/src/helpdesk/handlers/challenge.query.ts +1 -2
  194. package/packages/bundled-features/src/helpdesk/handlers/reply.write.ts +2 -9
  195. package/packages/bundled-features/src/helpdesk/handlers/report.write.ts +2 -9
  196. package/packages/bundled-features/src/helpdesk/handlers/submit.write.ts +3 -11
  197. package/packages/bundled-features/src/helpdesk/index.ts +1 -0
  198. package/packages/bundled-features/src/helpdesk/legacy-contact-config.ts +61 -0
  199. package/packages/bundled-features/src/helpdesk/legacy-contact-erasure.ts +45 -0
  200. package/packages/bundled-features/src/helpdesk/legacy-contact-retention.ts +65 -0
  201. package/packages/bundled-features/src/helpdesk/legacy-contact-streams.ts +185 -0
  202. package/packages/bundled-features/src/helpdesk/legacy-contact-user-data.ts +84 -0
  203. package/packages/bundled-features/src/helpdesk/lib.ts +47 -34
  204. package/packages/bundled-features/src/helpdesk/user-data-hooks.ts +89 -48
  205. package/packages/bundled-features/src/helpdesk/web/constants.ts +0 -1
  206. package/packages/bundled-features/src/inbound-mail-foundation/account-health.ts +1 -1
  207. package/packages/bundled-features/src/inbound-mail-foundation/account-poll.ts +5 -1
  208. package/packages/bundled-features/src/inbound-mail-foundation/aggregate-id.ts +0 -2
  209. package/packages/bundled-features/src/inbound-mail-foundation/changes.json +48 -0
  210. package/packages/bundled-features/src/inbound-mail-foundation/constants.ts +6 -0
  211. package/packages/bundled-features/src/inbound-mail-foundation/content-refetch.ts +15 -1
  212. package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +64 -15
  213. package/packages/bundled-features/src/inbound-mail-foundation/events.ts +15 -16
  214. package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +3 -1
  215. package/packages/bundled-features/src/inbound-mail-foundation/handlers/account-address.ts +16 -2
  216. package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +10 -3
  217. package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +21 -8
  218. package/packages/bundled-features/src/inbound-mail-foundation/handlers/forget-message.write.ts +73 -0
  219. package/packages/bundled-features/src/inbound-mail-foundation/i18n.ts +3 -0
  220. package/packages/bundled-features/src/inbound-mail-foundation/index.ts +1 -0
  221. package/packages/bundled-features/src/inbound-mail-foundation/oauth-access-token.ts +1 -1
  222. package/packages/bundled-features/src/inbound-mail-foundation/outbound-mail.ts +2 -0
  223. package/packages/bundled-features/src/inbound-mail-foundation/personal-address.ts +20 -0
  224. package/packages/bundled-features/src/inbound-mail-foundation/purge-messages.ts +54 -0
  225. package/packages/bundled-features/src/inbound-mail-foundation/quarantine.ts +15 -5
  226. package/packages/bundled-features/src/inbound-mail-foundation/retention-job.ts +1 -5
  227. package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +21 -34
  228. package/packages/bundled-features/src/inbound-mail-foundation/send-from-account.ts +9 -1
  229. package/packages/bundled-features/src/inbound-mail-foundation/supervisor-ingest.ts +7 -1
  230. package/packages/bundled-features/src/inbound-mail-foundation/sync-account-now.ts +1 -1
  231. package/packages/bundled-features/src/inbound-mail-foundation/tenant-destroy-hook.ts +14 -17
  232. package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +1 -1
  233. package/packages/bundled-features/src/inbound-provider-imap/byte-budget.ts +80 -0
  234. package/packages/bundled-features/src/inbound-provider-imap/changes.json +13 -0
  235. package/packages/bundled-features/src/inbound-provider-imap/connect-mailbox.ts +8 -4
  236. package/packages/bundled-features/src/inbound-provider-imap/connect-my-mailbox.ts +23 -6
  237. package/packages/bundled-features/src/inbound-provider-imap/connect-target-rate-limit.ts +46 -0
  238. package/packages/bundled-features/src/inbound-provider-imap/download-batch.ts +47 -10
  239. package/packages/bundled-features/src/inbound-provider-imap/feature.ts +7 -4
  240. package/packages/bundled-features/src/inbound-provider-imap/fetch-content.ts +43 -29
  241. package/packages/bundled-features/src/inbound-provider-imap/i18n.ts +2 -2
  242. package/packages/bundled-features/src/inbound-provider-imap/parse-message.ts +14 -0
  243. package/packages/bundled-features/src/inbound-provider-imap/reconnect-mailbox.ts +5 -4
  244. package/packages/bundled-features/src/inbound-provider-imap/send-mail.ts +39 -7
  245. package/packages/bundled-features/src/inbound-provider-imap/smtp-client.ts +19 -4
  246. package/packages/bundled-features/src/inbound-provider-imap/watch-mailbox.ts +8 -23
  247. package/packages/bundled-features/src/inbound-provider-inmemory/feature.ts +1 -1
  248. package/packages/bundled-features/src/jobs/events.ts +10 -0
  249. package/packages/bundled-features/src/jobs/feature.ts +2 -0
  250. package/packages/bundled-features/src/jobs/handlers/consumer.write.ts +41 -16
  251. package/packages/bundled-features/src/jobs/web/constants.ts +4 -0
  252. package/packages/bundled-features/src/mail-foundation/changes.json +6 -0
  253. package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +1 -1
  254. package/packages/bundled-features/src/mail-transport-smtp/feature.ts +3 -2
  255. package/packages/bundled-features/src/managed-pages/changes.json +12 -0
  256. package/packages/bundled-features/src/managed-pages/handlers/branding.query.ts +1 -1
  257. package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +1 -1
  258. package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +1 -1
  259. package/packages/bundled-features/src/managed-pages/render-page-body.ts +18 -10
  260. package/packages/bundled-features/src/managed-pages/screens/page-screens.ts +18 -38
  261. package/packages/bundled-features/src/managed-pages/table.ts +1 -0
  262. package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +8 -6
  263. package/packages/bundled-features/src/managed-pages/web/constants.ts +8 -1
  264. package/packages/bundled-features/src/managed-pages/web/i18n.ts +11 -3
  265. package/packages/bundled-features/src/managed-pages/web/markdown-to-document.ts +1 -1
  266. package/packages/bundled-features/src/managed-pages/web/page-edit-draft.ts +108 -0
  267. package/packages/bundled-features/src/managed-pages/web/page-edit-screen.tsx +198 -0
  268. package/packages/bundled-features/src/managed-pages/web/page-settings-rail.tsx +117 -0
  269. package/packages/bundled-features/src/notes-history-user-data/index.ts +8 -14
  270. package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +5 -0
  271. package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +0 -1
  272. package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +31 -5
  273. package/packages/bundled-features/src/presence/changes.json +6 -0
  274. package/packages/bundled-features/src/presence/handlers/list.query.ts +28 -11
  275. package/packages/bundled-features/src/presence/room.ts +21 -7
  276. package/packages/bundled-features/src/presence/store.ts +79 -21
  277. package/packages/bundled-features/src/readiness/changes.json +25 -0
  278. package/packages/bundled-features/src/readiness/handlers/latest-summary.query.ts +11 -6
  279. package/packages/bundled-features/src/readiness/handlers/run-probes.write.ts +35 -5
  280. package/packages/bundled-features/src/readiness/handlers/run-tone.ts +3 -2
  281. package/packages/bundled-features/src/readiness/handlers/status.query.ts +15 -1
  282. package/packages/bundled-features/src/readiness/probe-context.ts +11 -10
  283. package/packages/bundled-features/src/readiness/screens.ts +4 -4
  284. package/packages/bundled-features/src/readiness/visible-results.ts +5 -3
  285. package/packages/bundled-features/src/renderer-foundation/api.ts +6 -13
  286. package/packages/bundled-features/src/renderer-foundation/types.ts +2 -2
  287. package/packages/bundled-features/src/secrets/changes.json +7 -0
  288. package/packages/bundled-features/src/secrets/db/queries/read.ts +18 -4
  289. package/packages/bundled-features/src/secrets/handlers/list.query.ts +8 -2
  290. package/packages/bundled-features/src/secrets/secret-scope.ts +2 -3
  291. package/packages/bundled-features/src/secrets/secrets-context.ts +6 -4
  292. package/packages/bundled-features/src/secrets/write-gate.ts +4 -2
  293. package/packages/bundled-features/src/seo/handlers/seo-config.query.ts +1 -1
  294. package/packages/bundled-features/src/shared/acknowledged-system-db.ts +20 -0
  295. package/packages/bundled-features/src/shared/assert-billing-live.ts +9 -2
  296. package/packages/bundled-features/src/shared/changes.json +6 -0
  297. package/packages/bundled-features/src/shared/index.ts +6 -1
  298. package/packages/bundled-features/src/shared/parent-visibility.ts +25 -1
  299. package/packages/bundled-features/src/shared/password-hashing.ts +0 -1
  300. package/packages/bundled-features/src/shared/price-env-shape.ts +1 -4
  301. package/packages/bundled-features/src/shared/register-user-data-hooks.ts +29 -0
  302. package/packages/bundled-features/src/shared/require-bootstrap-extension.ts +26 -0
  303. package/packages/bundled-features/src/shared/send-best-effort.ts +19 -0
  304. package/packages/bundled-features/src/shared/stream-tenant-backfill.ts +22 -1
  305. package/packages/bundled-features/src/shared/stream-tenant-derived-state.ts +31 -1
  306. package/packages/bundled-features/src/step-dispatcher/changes.json +12 -0
  307. package/packages/bundled-features/src/step-dispatcher/constants.ts +13 -0
  308. package/packages/bundled-features/src/step-dispatcher/deliver-dispatch-request.ts +47 -2
  309. package/packages/bundled-features/src/step-dispatcher/feature.ts +28 -1
  310. package/packages/bundled-features/src/step-dispatcher/mail-runner.ts +0 -1
  311. package/packages/bundled-features/src/step-dispatcher/sweep-abandoned.ts +57 -0
  312. package/packages/bundled-features/src/subscription-mollie/changes.json +7 -0
  313. package/packages/bundled-features/src/subscription-mollie/plugin-methods.ts +5 -3
  314. package/packages/bundled-features/src/subscription-mollie/verify-webhook.ts +5 -5
  315. package/packages/bundled-features/src/subscription-paddle/backfill-checkout-ledger.ts +159 -0
  316. package/packages/bundled-features/src/subscription-paddle/changes.json +13 -0
  317. package/packages/bundled-features/src/subscription-paddle/checkout-config.query.ts +1 -1
  318. package/packages/bundled-features/src/subscription-paddle/checkout-methods.ts +2 -8
  319. package/packages/bundled-features/src/subscription-paddle/constants.ts +1 -2
  320. package/packages/bundled-features/src/subscription-paddle/feature.ts +26 -24
  321. package/packages/bundled-features/src/subscription-paddle/ledger-backfill-marker.ts +70 -0
  322. package/packages/bundled-features/src/subscription-paddle/plan-switch-methods.ts +2 -8
  323. package/packages/bundled-features/src/subscription-paddle/redeliver-legacy-checkout.ts +36 -0
  324. package/packages/bundled-features/src/subscription-paddle/runtime.ts +13 -24
  325. package/packages/bundled-features/src/subscription-paddle/subscription-state.ts +1 -0
  326. package/packages/bundled-features/src/subscription-paddle/webhook-events.ts +68 -21
  327. package/packages/bundled-features/src/subscription-stripe/changes.json +7 -0
  328. package/packages/bundled-features/src/subscription-stripe/feature.ts +5 -0
  329. package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +6 -6
  330. package/packages/bundled-features/src/subscription-stripe/runtime.ts +8 -7
  331. package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +24 -6
  332. package/packages/bundled-features/src/tags/aggregate-id.ts +0 -1
  333. package/packages/bundled-features/src/tags/web/tag-chip.tsx +4 -5
  334. package/packages/bundled-features/src/tags/web/tag-manager.tsx +2 -1
  335. package/packages/bundled-features/src/template-resolver/api.ts +6 -13
  336. package/packages/bundled-features/src/template-resolver/changes.json +36 -0
  337. package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +25 -0
  338. package/packages/bundled-features/src/template-resolver/feature.ts +2 -0
  339. package/packages/bundled-features/src/template-resolver/handlers/body-preview.query.ts +41 -0
  340. package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +1 -1
  341. package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +1 -1
  342. package/packages/bundled-features/src/template-resolver/handlers/collection-shared.ts +5 -11
  343. package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +3 -2
  344. package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +37 -8
  345. package/packages/bundled-features/src/template-resolver/linked-resources.ts +2 -5
  346. package/packages/bundled-features/src/template-resolver/seeding.ts +77 -0
  347. package/packages/bundled-features/src/template-resolver/table.ts +1 -0
  348. package/packages/bundled-features/src/template-resolver/template-draft.ts +2 -1
  349. package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -3
  350. package/packages/bundled-features/src/template-resolver/testing.ts +0 -2
  351. package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +3 -0
  352. package/packages/bundled-features/src/template-resolver/web/collection-entry-create-form.tsx +33 -33
  353. package/packages/bundled-features/src/template-resolver/web/constants.ts +7 -0
  354. package/packages/bundled-features/src/template-resolver/web/content-tree-provider.ts +0 -1
  355. package/packages/bundled-features/src/template-resolver/web/content-workbench.tsx +142 -0
  356. package/packages/bundled-features/src/template-resolver/web/document-insert-model.ts +3 -8
  357. package/packages/bundled-features/src/template-resolver/web/document-link-policy.ts +58 -0
  358. package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -57
  359. package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +2 -4
  360. package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +4 -5
  361. package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +2 -2
  362. package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +6 -3
  363. package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +2 -3
  364. package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -0
  365. package/packages/bundled-features/src/template-resolver/web/fill-document-variables.ts +24 -0
  366. package/packages/bundled-features/src/template-resolver/web/i18n.ts +14 -0
  367. package/packages/bundled-features/src/template-resolver/web/index.ts +3 -0
  368. package/packages/bundled-features/src/template-resolver/web/preview-targets.ts +25 -0
  369. package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +1 -0
  370. package/packages/bundled-features/src/template-resolver/web/snippet-preview-renderer.tsx +24 -0
  371. package/packages/bundled-features/src/template-resolver/web/string-values.ts +7 -0
  372. package/packages/bundled-features/src/template-resolver/web/text-block-editor.tsx +38 -50
  373. package/packages/bundled-features/src/template-resolver/web/use-collection-entry-create.ts +7 -0
  374. package/packages/bundled-features/src/template-resolver/web/use-content-write.ts +1 -3
  375. package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +1 -2
  376. package/packages/bundled-features/src/template-resolver/web/use-text-block-editor.ts +28 -7
  377. package/packages/bundled-features/src/template-resolver/web/web-preview-renderer.tsx +126 -0
  378. package/packages/bundled-features/src/template-resolver-user-data/index.ts +11 -10
  379. package/packages/bundled-features/src/tenant/changes.json +6 -0
  380. package/packages/bundled-features/src/tenant/handlers/create.write.ts +7 -8
  381. package/packages/bundled-features/src/tenant/handlers/list.query.ts +7 -9
  382. package/packages/bundled-features/src/tenant/handlers/member-directory.query.ts +10 -4
  383. package/packages/bundled-features/src/tenant/handlers/toggle-enabled.write.ts +1 -1
  384. package/packages/bundled-features/src/tenant/invited-membership.ts +10 -1
  385. package/packages/bundled-features/src/tenant/seeding.ts +4 -2
  386. package/packages/bundled-features/src/tenant/stream-tenant-backfill.ts +5 -1
  387. package/packages/bundled-features/src/tenant/testing.ts +1 -1
  388. package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +4 -3
  389. package/packages/bundled-features/src/tenant-inactivity/constants.ts +1 -2
  390. package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +1 -2
  391. package/packages/bundled-features/src/tenant-inactivity/state-store.ts +10 -1
  392. package/packages/bundled-features/src/tenant-lifecycle/changes.json +18 -0
  393. package/packages/bundled-features/src/tenant-lifecycle/constants.ts +4 -0
  394. package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +43 -6
  395. package/packages/bundled-features/src/tenant-lifecycle/stages.ts +15 -2
  396. package/packages/bundled-features/src/tier-engine/aggregate-id.ts +0 -1
  397. package/packages/bundled-features/src/tier-engine/changes.json +6 -0
  398. package/packages/bundled-features/src/tier-engine/feature.ts +8 -2
  399. package/packages/bundled-features/src/user/changes.json +6 -0
  400. package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +2 -1
  401. package/packages/bundled-features/src/user/handlers/me.query.ts +3 -1
  402. package/packages/bundled-features/src/user/index.ts +1 -0
  403. package/packages/bundled-features/src/user/resolve-verified-user-email.ts +17 -0
  404. package/packages/bundled-features/src/user-data-rights/db/queries/export-jobs.ts +0 -1
  405. package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +1 -1
  406. package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -1
  407. package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +1 -1
  408. package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +0 -2
  409. package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +3 -3
  410. package/packages/bundled-features/src/user-data-rights/schema/download-attempt.ts +3 -2
  411. package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +1 -1
  412. package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
  413. package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +1 -1
  414. package/packages/bundled-features/src/user-data-rights-defaults/hooks/api-token.userdata-hook.ts +5 -5
  415. package/packages/bundled-features/src/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.ts +17 -0
  416. package/packages/bundled-features/src/user-data-rights-defaults/hooks/in-app-message.userdata-hook.ts +5 -5
  417. package/packages/bundled-features/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts +2 -1
  418. package/packages/bundled-features/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts +5 -5
  419. package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +0 -1
  420. package/packages/bundled-features/src/waitlist/changes.json +6 -0
  421. package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +4 -28
  422. package/packages/bundled-features/src/waitlist/lib.ts +2 -7
  423. package/packages/bundled-features/src/waitlist/user-data-hooks.ts +6 -19
  424. package/packages/bundled-features/src/workflow-runner/aggregate-id.ts +0 -1
  425. package/packages/bundled-features/src/workflow-runner/event-trigger.ts +6 -2
  426. package/packages/bundled-features/src/workflow-runner/feature.ts +1 -5
  427. package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +5 -4
  428. package/packages/bundled-features/src/workflow-runner/runner.ts +2 -0
  429. package/samples/apps/showcase/src/features/demos/web/pages/dialog.tsx +0 -1
  430. package/samples/apps/showcase/src/features/demos/web/pages/layout.tsx +1 -1
  431. package/samples/apps/showcase/src/features/demos/web/pages/sidebar-panel.tsx +0 -1
  432. package/samples/apps/styleguide/src/features/gallery/web/Gallery.tsx +1 -4
  433. package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +6 -2
  434. package/samples/apps/use-all-bundled/e2e-billing-gallery/gallery-features.ts +12 -14
  435. package/samples/apps/use-all-bundled/feature-manifest.json +60 -29
  436. package/samples/apps/use-all-bundled/playwright.billing-docs.config.ts +1 -1
  437. package/samples/apps/use-all-bundled/playwright.config.ts +1 -0
  438. package/samples/apps/use-all-bundled/src/app/seed.ts +1 -1
  439. package/samples/apps/use-all-bundled/src/run-config.ts +2 -1
  440. package/samples/recipes/auth-mfa/src/web/confirmation-code-step.tsx +32 -10
  441. package/samples/recipes/chat-channels/README.md +2 -0
  442. package/samples/recipes/currencies-global/src/entities/currency.ts +1 -0
  443. package/samples/recipes/managed-pages/README.md +5 -1
  444. package/samples/recipes/managed-pages/package.json +3 -2
  445. package/samples/recipes/managed-pages/src/web/branded-preview.tsx +21 -0
  446. package/samples/recipes/managed-pages/tsconfig.json +8 -0
  447. package/samples/recipes/pwa-shell/README.md +52 -0
  448. package/samples/recipes/pwa-shell/bin/server.ts +12 -0
  449. package/samples/recipes/pwa-shell/package.json +13 -0
  450. package/samples/recipes/pwa-shell/src/app.ts +34 -0
  451. package/samples/recipes/rate-limiting/README.md +3 -3
  452. package/samples/recipes/record-detail-layout/README.md +33 -0
  453. package/samples/recipes/record-detail-layout/src/feature.ts +525 -44
  454. package/samples/recipes/record-detail-layout/src/order-board.ts +521 -0
  455. package/packages/bundled-features/src/managed-pages/web/page-body-section.tsx +0 -72
  456. package/packages/bundled-features/src/subscription-paddle/tenant-binding.ts +0 -34
  457. package/packages/bundled-features/src/template-resolver/web/content-field.tsx +0 -61
@@ -1,4 +1,5 @@
1
1
  import { type AccessRule, defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { DOCUMENT_LIVE_ENTITIES } from "../constants.ts";
2
3
  import { expiryWindow } from "../expiry.ts";
3
4
  import { expiryOverviewPayloadSchema } from "../schemas.ts";
4
5
  import { linkedDocumentIds, listDocuments } from "./list-page.ts";
@@ -12,7 +13,7 @@ export function createExpiryOverviewQuery(access: AccessRule, expiringWithinDays
12
13
  name: "expiry-overview",
13
14
  schema: expiryOverviewPayloadSchema,
14
15
  access,
15
- liveEntities: ["filed-document", "filed-document-link"],
16
+ liveEntities: DOCUMENT_LIVE_ENTITIES,
16
17
  description:
17
18
  "Counts the documents the caller can read by validity: expired, expiring within the configured window, valid beyond it and without an expiry date; optionally for one record only.",
18
19
  handler: async (query, ctx) => {
@@ -4,12 +4,11 @@ import {
4
4
  type HandlerContext,
5
5
  toKebab,
6
6
  } from "@cosmicdrift/kumiko-framework/engine";
7
- import { DocumentsQueries } from "../constants.ts";
7
+ import { DOCUMENT_LIVE_ENTITIES, DocumentsQueries } from "../constants.ts";
8
8
  import { type ForRecordPayload, forRecordPayloadSchema } from "../schemas.ts";
9
9
  import { linkedDocumentIds, listDocuments } from "./list-page.ts";
10
10
 
11
11
  const EMPTY_PAGE = { rows: [], nextCursor: null, total: 0 };
12
- const LIVE_ENTITIES = ["filed-document", "filed-document-link"];
13
12
 
14
13
  type Dispatching = Pick<HandlerContext, "dispatch">;
15
14
 
@@ -37,7 +36,7 @@ export function createForRecordQuery(access: AccessRule, linkTargets: readonly s
37
36
  name: "for-record",
38
37
  schema: forRecordPayloadSchema,
39
38
  access,
40
- liveEntities: LIVE_ENTITIES,
39
+ liveEntities: DOCUMENT_LIVE_ENTITIES,
41
40
  description:
42
41
  "Lists the documents linked to one record, paged and filterable like the document list; a record the caller cannot read, or a type that takes no documents, yields an empty page.",
43
42
  handler: async (query, ctx) => documentsOfRecord(ctx, linkTargets, query.payload),
@@ -64,7 +63,7 @@ export function createForTypeQuery(
64
63
  id: forRecordPayloadSchema.shape.entityId,
65
64
  }),
66
65
  access,
67
- liveEntities: LIVE_ENTITIES,
66
+ liveEntities: DOCUMENT_LIVE_ENTITIES,
68
67
  description: `Lists the documents linked to one ${entityType} record by its id, paged and filterable like the document list; it feeds the documents tab on the ${entityType} screen.`,
69
68
  handler: async (query, ctx) => {
70
69
  const { id, ...rest } = query.payload;
@@ -1,9 +1,11 @@
1
1
  import type { HandlerContext } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { UnprocessableError } from "@cosmicdrift/kumiko-framework/errors";
2
3
  import * as z from "zod";
3
- import { DocumentsQueries } from "../constants.ts";
4
+ import { DocumentsQueries, DocumentsReasons } from "../constants.ts";
4
5
 
5
- const LINK_LIST = "documents:query:filed-document-link:list";
6
6
  const LINK_PAGE_SIZE = 200;
7
+ // Well below the Postgres bind-parameter limit (65535) that the `id IN (...)` filter would hit.
8
+ const MAX_LINKED_DOCUMENTS = 10_000;
7
9
 
8
10
  const pageSchema = z.object({
9
11
  rows: z.array(z.record(z.string(), z.unknown())),
@@ -32,7 +34,7 @@ export async function linkedDocumentIds(
32
34
  let cursor: string | undefined;
33
35
  do {
34
36
  const page = pageSchema.parse(
35
- await ctx.dispatch.query(LINK_LIST, {
37
+ await ctx.dispatch.query(DocumentsQueries.linkList, {
36
38
  filters: [
37
39
  { field: "entityType", op: "eq", value: target.entityType },
38
40
  { field: "entityId", op: "eq", value: target.entityId },
@@ -45,6 +47,12 @@ export async function linkedDocumentIds(
45
47
  const documentId = row["documentId"];
46
48
  if (typeof documentId === "string") ids.push(documentId);
47
49
  }
50
+ if (ids.length > MAX_LINKED_DOCUMENTS) {
51
+ throw new UnprocessableError(DocumentsReasons.tooManyLinkedDocuments, {
52
+ message: `documents: record ${target.entityType}:${target.entityId} has more than ${MAX_LINKED_DOCUMENTS} linked documents; the id list would exceed the query parameter limit`,
53
+ details: { limit: MAX_LINKED_DOCUMENTS },
54
+ });
55
+ }
48
56
  cursor = page.nextCursor ?? undefined;
49
57
  } while (cursor !== undefined);
50
58
  return ids;
@@ -1,5 +1,5 @@
1
1
  import { type AccessRule, defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
- import { EXPIRING_FACET_VALUE } from "../constants.ts";
2
+ import { DOCUMENT_LIVE_ENTITIES, EXPIRING_FACET_VALUE } from "../constants.ts";
3
3
  import { expiryStateOf, expiryWindow } from "../expiry.ts";
4
4
  import { overviewPayloadSchema } from "../schemas.ts";
5
5
  import { type ListFilter, listDocuments } from "./list-page.ts";
@@ -23,7 +23,7 @@ export function createOverviewQuery(access: AccessRule, expiringWithinDays: numb
23
23
  name: "overview",
24
24
  schema: overviewPayloadSchema,
25
25
  access,
26
- liveEntities: ["filed-document", "filed-document-link"],
26
+ liveEntities: DOCUMENT_LIVE_ENTITIES,
27
27
  description:
28
28
  "Lists the documents the caller can read with an expiry state per row (expired, expiring, valid, none); the expiring filter returns expired and soon-expiring documents. Powers the documents list screen.",
29
29
  handler: async (query, ctx) => {
@@ -3,7 +3,12 @@ import {
3
3
  i18nKey,
4
4
  type ProjectionListScreenDefinition,
5
5
  } from "@cosmicdrift/kumiko-framework/engine";
6
- import { DOCUMENTS_LIST_SCREEN_ID, DocumentsQueries, EXPIRING_FACET_VALUE } from "./constants.ts";
6
+ import {
7
+ DOCUMENTS_LIST_SCREEN_ID,
8
+ DocumentsHandlers,
9
+ DocumentsQueries,
10
+ EXPIRING_FACET_VALUE,
11
+ } from "./constants.ts";
7
12
 
8
13
  // The columns every document list shows; the tab and the standalone screen stay alike.
9
14
  export const DOCUMENT_COLUMNS = ["title", "category", "validUntil", "file"] as const;
@@ -45,7 +50,7 @@ export function createDocumentListScreen(
45
50
  field: "file",
46
51
  label: `${FIELD_PREFIX}file`,
47
52
  sortable: false,
48
- renderer: { format: "file" },
53
+ renderer: { format: "file", viewInDrawer: true },
49
54
  },
50
55
  ],
51
56
  pagination: "pages",
@@ -73,7 +78,7 @@ export function createDocumentListScreen(
73
78
  kind: "writeHandler",
74
79
  id: "delete",
75
80
  label: i18nKey("kumiko.actions.delete"),
76
- handler: "documents:write:filed-document:delete",
81
+ handler: DocumentsHandlers.deleteDocument,
77
82
  payload: { pick: ["id"] },
78
83
  confirm: i18nKey("kumiko.actions.delete-confirm"),
79
84
  style: "danger",
@@ -16,7 +16,7 @@ export function documentsTab(entityType: string): EditRelatedListSection {
16
16
  { field: "title", sortable: true },
17
17
  { field: "category", sortable: true },
18
18
  { field: "validUntil", sortable: true },
19
- { field: "file" },
19
+ { field: "file", renderer: { format: "file", viewInDrawer: true } },
20
20
  ],
21
21
  searchable: true,
22
22
  count: true,
@@ -3,7 +3,7 @@ import {
3
3
  type CacheSyncBus,
4
4
  createRedisPubSubSignal,
5
5
  type RedisClientOptions,
6
- redisChannelPrefixFromEnv,
6
+ type RedisNamespace,
7
7
  redisNamespaceFromEnv,
8
8
  } from "@cosmicdrift/kumiko-framework/redis";
9
9
  import { isPlainObject } from "@cosmicdrift/kumiko-types/type-guards";
@@ -36,9 +36,12 @@ function isTogglePayload(value: unknown): value is { featureName: string; enable
36
36
  export function createRedisToggleSyncSignal(
37
37
  redisUrl: string,
38
38
  clientOptions?: RedisClientOptions,
39
- channelPrefix: string = redisChannelPrefixFromEnv(),
40
- channelSubscribePattern: string | undefined = redisNamespaceFromEnv().channelSubscribePattern,
39
+ namespace: Pick<
40
+ RedisNamespace,
41
+ "channelPrefix" | "channelSubscribePattern"
42
+ > = redisNamespaceFromEnv(),
41
43
  ): RedisToggleSyncSignal {
44
+ const { channelPrefix, channelSubscribePattern } = namespace;
42
45
  const toggleSyncChannel = `${channelPrefix}${TOGGLE_SYNC_CHANNEL_NAME}`;
43
46
  const signal = createRedisPubSubSignal({
44
47
  redisUrl,
@@ -31,7 +31,7 @@ export const PUBLIC_VARIANT_BY_FILE_REF_QN = "file-derivatives:query:public-vari
31
31
  export const publicVariantByFileRefQuery = defineQueryHandler({
32
32
  name: "public-variant-by-file-ref",
33
33
  schema: publicVariantPayloadSchema,
34
- access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"], anySignedIn: true },
34
+ access: { roles: ["anonymous"], anySignedIn: true },
35
35
  agent: { expose: false },
36
36
  rateLimit: { per: "ip", limit: 60, windowSeconds: 60 },
37
37
  escapeHatch: {
@@ -93,7 +93,7 @@ export const publicVariantPayloadSchema = z.object({
93
93
  export const publicVariantQuery = defineQueryHandler({
94
94
  name: "public-variant",
95
95
  schema: publicVariantPayloadSchema,
96
- access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"], anySignedIn: true },
96
+ access: { roles: ["anonymous"], anySignedIn: true },
97
97
  agent: { expose: false },
98
98
  // ponytail: "ip" is the ONLY throttle on an anonymous, internet-facing
99
99
  // render/storage-cost route — its accuracy depends on the server's
@@ -54,14 +54,20 @@ export function registerStorageProbe(r: FeatureRegistrar<"file-foundation">): vo
54
54
  handlerName: "file-foundation:probe",
55
55
  })(ctx.tenantId);
56
56
  const key = `${ctx.tenantId}/__readiness-probe/${ctx.probeRunId}.txt`;
57
+ await provider.write(key, PROBE_CONTENT, "text/plain");
57
58
  try {
58
- await provider.write(key, PROBE_CONTENT, "text/plain");
59
59
  if (!isSameBytes(await provider.read(key), PROBE_CONTENT)) {
60
60
  throw new Error("storage returned different bytes than were written");
61
61
  }
62
- } finally {
63
- await provider.delete(key);
62
+ } catch (error) {
63
+ await provider.delete(key).catch((cleanupError: unknown) => {
64
+ ctx.obs.log.warn("storage probe could not clean up after a failed roundtrip", {
65
+ error: cleanupError instanceof Error ? cleanupError.name : "unknown",
66
+ });
67
+ });
68
+ throw error;
64
69
  }
70
+ await provider.delete(key);
65
71
  return { status: "ok", message: { key: FILE_PROBE_KEYS.reachable } };
66
72
  },
67
73
  });
@@ -1,12 +1,13 @@
1
1
  import type { DbRunner, TenantDb } from "@cosmicdrift/kumiko-framework/db";
2
2
  import { selectMany } from "@cosmicdrift/kumiko-framework/db";
3
- import { isUuid, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
3
+ import { isUuid, SYSTEM_TENANT_ID, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
4
4
  import {
5
5
  createTenantFileContext,
6
6
  type FileContext,
7
7
  type FileProviderResolver,
8
8
  fileRefsTable,
9
9
  } from "@cosmicdrift/kumiko-framework/files";
10
+ import { systemTenantReadDb } from "@cosmicdrift/kumiko-framework/internal/row-level-security";
10
11
 
11
12
  export type FileRefContent = {
12
13
  readonly content: Uint8Array;
@@ -75,16 +76,28 @@ export async function readFileRefContent(args: {
75
76
  readonly maxBytes?: number;
76
77
  }): Promise<FileRefContent | null> {
77
78
  if (!isUuid(args.fileRefId)) return null;
78
- const [row] = await selectMany<FileRefRow>(args.db, fileRefsTable, {
79
- id: args.fileRefId,
80
- tenantId: { in: args.allowedTenantIds },
81
- isDeleted: false,
82
- ...(args.unclaimedUploadOf !== undefined && {
83
- insertedById: args.unclaimedUploadOf,
84
- entityType: null,
85
- entityId: null,
86
- }),
87
- });
79
+ const findRow = async (db: DbRunner | TenantDb, tenantIds: readonly string[]) => {
80
+ const [found] = await selectMany<FileRefRow>(db, fileRefsTable, {
81
+ id: args.fileRefId,
82
+ tenantId: { in: tenantIds },
83
+ isDeleted: false,
84
+ ...(args.unclaimedUploadOf !== undefined && {
85
+ insertedById: args.unclaimedUploadOf,
86
+ entityType: null,
87
+ entityId: null,
88
+ }),
89
+ });
90
+ return found;
91
+ };
92
+ const ownTenantIds = args.allowedTenantIds.filter((id) => id !== SYSTEM_TENANT_ID);
93
+ const ownRow = ownTenantIds.length > 0 ? await findRow(args.db, ownTenantIds) : undefined;
94
+ // System rows of file_refs are invisible to a tenant session; read them through the narrow
95
+ // system-tenant path instead of widening the caller's scope.
96
+ const row =
97
+ ownRow ??
98
+ (args.allowedTenantIds.includes(SYSTEM_TENANT_ID)
99
+ ? await findRow(systemTenantReadDb(args.db), [SYSTEM_TENANT_ID])
100
+ : undefined);
88
101
  if (row === undefined) return null;
89
102
  const size = Number(row.size);
90
103
  // A size that is not a number counts as too large, so the limit cannot be skipped.
@@ -83,7 +83,7 @@ export function createFileProviderInMemoryFeature() {
83
83
  // Returns the per-tenant storage. Identity-stable across calls so
84
84
  // accumulated state is kept.
85
85
  return getOrCreateProviderForTenant(tenantId);
86
- }, // @wrapper-known semantic-alias
86
+ },
87
87
  };
88
88
  r.useExtension("fileProvider", "inmemory", plugin);
89
89
  },
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "version": "0.414.0",
4
+ "type": "breaking",
5
+ "title": "S3 endpoint rule from the booted env",
6
+ "detail": "The https-only rule for remote S3 endpoints in production is no longer a field refinement that read the global process.env. isAcceptableS3Endpoint(value, isProduction) is applied against the env being booted: the endpoint variables carry it as an env rule (parseEnv and the boot dry run check it with the booted env record), runProdApp's fileStorage resolution applies it, and parseS3EnvConfig and createS3ProviderFromEnv take an optional env record (default process.env) and refuse a remote http endpoint when it says NODE_ENV=production. s3EndpointSchema now only validates the URL shape. createS3ProviderFromEnv reports a missing variable through requiredEnvFor (message \"[S3 file provider] required env var X is missing or empty\" instead of \"missing_env: ...\").",
7
+ "migration": "Tests that matched the old \"missing_env:\" message match the requiredEnvFor message; code that parsed s3EndpointSchema alone to enforce the production https rule uses isAcceptableS3Endpoint(value, isProduction) or the env rule through parseEnv."
8
+ },
9
+ {
10
+ "version": "0.414.0",
11
+ "type": "fix",
12
+ "title": "s3EndpointSchema carries the production https rule wherever it is reused",
13
+ "detail": "The env rule lived only on the endpoint field inside `createS3EnvSchema`, so an app that built `s3EndpointSchema` into its own env schema silently lost the production check. The rule is now attached to `s3EndpointSchema` itself, env rules are found through `.optional()`, `.default()` and unions, and `s3EndpointEnvRule` is exported. With NODE_ENV=production a non-loopback `http://` endpoint is rejected by `parseEnv` and the composed boot env without app code; https and loopback http pass.",
14
+ "migration": "Own copies of the rule (an `envRule` built on `isAcceptableS3Endpoint` next to `s3EndpointSchema`) can be removed."
15
+ },
2
16
  {
3
17
  "version": "0.376.0",
4
18
  "type": "improvement",
@@ -55,7 +55,7 @@ export function createFileProviderS3EnvFeature() {
55
55
  // tenant-prefixed / UUID keys). Built fresh per call like file-provider-s3;
56
56
  // the S3 client opens no connection at construction.
57
57
  build: async (_ctx: FileProviderContext, _tenantId: string): Promise<FileStorageProvider> =>
58
- createS3ProviderFromEnv(), // @wrapper-known semantic-alias
58
+ createS3ProviderFromEnv(),
59
59
  };
60
60
  r.useExtension("fileProvider", "s3-env", plugin);
61
61
  },
@@ -33,7 +33,7 @@ export function createFileProviderS3NamedEnvFeature(options: NamedS3EnvProviderO
33
33
  r.envSchema(envSchema);
34
34
  const plugin: FileProviderPlugin = {
35
35
  build: async (_ctx: FileProviderContext, _tenantId: string): Promise<FileStorageProvider> =>
36
- createS3ProviderFromEnv(options.envPrefix), // @wrapper-known semantic-alias
36
+ createS3ProviderFromEnv(options.envPrefix),
37
37
  };
38
38
  r.useExtension("fileProvider", options.name, plugin);
39
39
  },
@@ -2,20 +2,37 @@ import * as z from "zod";
2
2
 
3
3
  const LOOPBACK_HOSTNAMES = new Set(["localhost", "127.0.0.1", "[::1]"]);
4
4
 
5
- // The bucket holds tenant files, so in production a remote endpoint must be
6
- // https. Outside production plain http stays allowed, also for compose-network
7
- // hostnames (minio, rustfs) that are not loopback.
8
- function isAcceptableEndpoint(value: string): boolean {
5
+ /** The bucket holds tenant files, so in production a remote endpoint must be
6
+ * https. Outside production plain http stays allowed, also for compose-network
7
+ * hostnames (minio, rustfs) that are not loopback. `isProduction` comes from the
8
+ * env being booted: a field schema cannot see sibling vars, so the endpoint
9
+ * variables carry it as an env rule and the env readers apply it again. */
10
+ export function isAcceptableS3Endpoint(value: string, isProduction: boolean): boolean {
9
11
  if (!URL.canParse(value)) return false;
10
12
  const url = new URL(value);
11
13
  if (url.protocol === "https:") return true;
12
- return process.env["NODE_ENV"] !== "production" || LOOPBACK_HOSTNAMES.has(url.hostname);
14
+ return !isProduction || LOOPBACK_HOSTNAMES.has(url.hostname);
13
15
  }
14
16
 
15
- /** S3-compatible endpoint URL: https, or http on a loopback host; any http host outside `NODE_ENV=production`. */
17
+ const ENDPOINT_RULE_MESSAGE = "must use https unless the host is loopback (NODE_ENV=production)";
18
+
19
+ /** Env rule for the endpoint variables: the production flag comes from the env being booted. */
20
+ export function s3EndpointEnvRule(
21
+ value: string,
22
+ env: Readonly<Record<string, string | undefined>>,
23
+ ): string | undefined {
24
+ // A blank endpoint means "unset" (the field schema maps it to undefined), so there is nothing to check.
25
+ if (value === "") return undefined;
26
+ return isAcceptableS3Endpoint(value, env["NODE_ENV"] === "production")
27
+ ? undefined
28
+ : ENDPOINT_RULE_MESSAGE;
29
+ }
30
+
31
+ /** S3-compatible endpoint URL (http or https). Carries the production https rule as an env rule,
32
+ * so any env schema that reuses it (also wrapped in `.optional()`) enforces it without app code. */
16
33
  export const s3EndpointSchema = z
17
34
  .url({ protocol: /^https?$/ })
18
- .refine(isAcceptableEndpoint, "must use https unless the host is loopback");
35
+ .meta({ kumiko: { envRule: s3EndpointEnvRule } });
19
36
 
20
37
  function buildS3Shape(prefix: string) {
21
38
  return {
@@ -104,7 +104,7 @@ function createTenantConfigFileProviderS3Feature() {
104
104
  // Plugin registration. The entityName "s3" is what tenants set in
105
105
  // file-foundation's `provider` config key.
106
106
  const plugin: FileProviderPlugin = {
107
- build: async (ctx: FileProviderContext, tenantId: string) => buildS3Provider(ctx, tenantId), // @wrapper-known semantic-alias
107
+ build: async (ctx: FileProviderContext, tenantId: string) => buildS3Provider(ctx, tenantId),
108
108
  };
109
109
  r.useExtension("fileProvider", "s3", plugin);
110
110
 
@@ -4,7 +4,13 @@ export {
4
4
  createFileProviderS3NamedEnvFeature,
5
5
  type NamedS3EnvProviderOptions,
6
6
  } from "./env-named-feature.ts";
7
- export { createS3EnvSchema, s3EndpointSchema, s3EnvSchema } from "./env-schema.ts";
7
+ export {
8
+ createS3EnvSchema,
9
+ isAcceptableS3Endpoint,
10
+ s3EndpointEnvRule,
11
+ s3EndpointSchema,
12
+ s3EnvSchema,
13
+ } from "./env-schema.ts";
8
14
  export {
9
15
  createFileProviderS3Feature,
10
16
  type FileProviderS3FeatureOptions,
@@ -1,4 +1,6 @@
1
+ import { type EnvSource, requiredEnvFor } from "@cosmicdrift/kumiko-framework/env";
1
2
  import type { FileStorageProvider } from "@cosmicdrift/kumiko-framework/files";
3
+ import { isAcceptableS3Endpoint } from "../env-schema.ts";
2
4
  import { createS3Provider, type S3ProviderConfig } from "./s3-provider.ts";
3
5
 
4
6
  // Reads S3 connection details from process.env with a configurable prefix so
@@ -10,20 +12,34 @@ import { createS3Provider, type S3ProviderConfig } from "./s3-provider.ts";
10
12
  // <prefix>SECRET_KEY. Optional: <prefix>ENDPOINT (for R2/Minio),
11
13
  // <prefix>FORCE_PATH_STYLE (explicit override — auto-detected when ENDPOINT
12
14
  // is set).
13
- export function createS3ProviderFromEnv(prefix = "S3_"): FileStorageProvider {
14
- return createS3Provider(parseS3EnvConfig(prefix));
15
+ export function createS3ProviderFromEnv(
16
+ prefix = "S3_",
17
+ env: EnvSource = process.env,
18
+ ): FileStorageProvider {
19
+ return createS3Provider(parseS3EnvConfig(prefix, env));
15
20
  }
16
21
 
17
22
  // Separated from createS3ProviderFromEnv so the env → config translation is
18
23
  // unit-testable without spinning up an S3Client. The returned config is a
19
24
  // plain object — pass it to createS3Provider to get a working provider.
20
- export function parseS3EnvConfig(prefix: string): S3ProviderConfig {
25
+ export function parseS3EnvConfig(prefix: string, env: EnvSource = process.env): S3ProviderConfig {
26
+ const requireEnv = requiredEnvFor("S3 file provider", env);
21
27
  const bucket = requireEnv(`${prefix}BUCKET`);
22
28
  const region = requireEnv(`${prefix}REGION`);
23
29
  const accessKeyId = requireEnv(`${prefix}ACCESS_KEY`);
24
30
  const secretAccessKey = requireEnv(`${prefix}SECRET_KEY`);
25
- const endpoint = process.env[`${prefix}ENDPOINT`];
26
- const forcePathStyleRaw = process.env[`${prefix}FORCE_PATH_STYLE`];
31
+ const endpoint = env[`${prefix}ENDPOINT`];
32
+ const forcePathStyleRaw = env[`${prefix}FORCE_PATH_STYLE`];
33
+
34
+ if (
35
+ endpoint !== undefined &&
36
+ endpoint !== "" &&
37
+ !isAcceptableS3Endpoint(endpoint, env["NODE_ENV"] === "production")
38
+ ) {
39
+ throw new Error(
40
+ `[S3 file provider] ${prefix}ENDPOINT must use https unless the host is loopback (NODE_ENV=production)`,
41
+ );
42
+ }
27
43
 
28
44
  return {
29
45
  bucket,
@@ -39,11 +55,3 @@ export function parseS3EnvConfig(prefix: string): S3ProviderConfig {
39
55
  }),
40
56
  };
41
57
  }
42
-
43
- function requireEnv(name: string): string {
44
- const value = process.env[name];
45
- if (value === undefined || value === "") {
46
- throw new Error(`missing_env: ${name} is required to construct the S3 file provider`);
47
- }
48
- return value;
49
- }
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  assertSafeStorageKey,
3
+ FileObjectMissingError,
3
4
  type FileStorageProvider,
4
5
  type SignedUrlOptions,
5
6
  } from "@cosmicdrift/kumiko-framework/files";
7
+ import { errorCodeOf } from "@cosmicdrift/kumiko-types/type-guards";
6
8
 
7
9
  // =============================================================================
8
10
  // Required operator setup (multipart-upload cleanup)
@@ -138,7 +140,12 @@ export function createS3Provider(config: S3ProviderConfig): FileStorageProvider
138
140
 
139
141
  async read(key): Promise<Uint8Array> {
140
142
  assertSafeStorageKey(key);
141
- return new Uint8Array(await client.file(key).arrayBuffer());
143
+ try {
144
+ return new Uint8Array(await client.file(key).arrayBuffer());
145
+ } catch (e) {
146
+ if (errorCodeOf(e) === "NoSuchKey") throw new FileObjectMissingError(key);
147
+ throw e;
148
+ }
142
149
  },
143
150
 
144
151
  readStream(key): AsyncIterable<Uint8Array> {
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "version": "0.414.0",
4
+ "type": "breaking",
5
+ "title": "Anonymous file uploads need the claim handle to be bound",
6
+ "detail": "All anonymous visitors share one session user id, so \"uploaded by me\" proved nothing and any visitor could attach another visitor's pending upload to a record, or read and delete it. An anonymous `POST /files` now returns `handle` (`<fileRefId>.<claim>`, claim is 32 random bytes in base64url) next to `id`; only the sha256 of the claim is stored in the new nullable `file_refs.claim_hash` column. File and image fields accept a UUID or a handle, the executor resolves handles on create and update with a constant-time claim check (also for system users) and persists only the bare UUID. The save pipeline now rejects with `invalid_element` every pending file ref that the writer neither uploaded as a non-anonymous user nor proved by claim. Anonymous `GET /files/:id`, the meta routes and `DELETE` answer 404 before any app access guard runs. `SaveContext` gains the optional `claimedFileRefIds`; the renderer upload widget lifts the handle instead of the id when the server returns one.",
7
+ "migration": "Clients that upload anonymously must submit `handle` from the POST response (not `id`) in the file or image field; a `writeAs` that passes a bare id of an anonymous upload now fails with `invalid_element`. Anonymous uploads from before the upgrade have no claim, can no longer be bound and are removed by the existing sweep of unbound uploads. Anonymous GET, meta and DELETE of files are blocked. Apply the generated migration that adds `file_refs.claim_hash`."
8
+ },
2
9
  {
3
10
  "version": "0.394.0",
4
11
  "type": "improvement",
@@ -13,7 +13,6 @@ const FOLDER_ASSIGNMENT_NAMESPACE = "b2e1f4a7-3c9d-4e8b-a1f6-5d2c8b3e7a9f";
13
13
  * creating a second row. This is the single-membership counterpart to tags'
14
14
  * many-to-many aggregate-id (which includes the tagId).
15
15
  */
16
- // @wrapper-known uuid-domain
17
16
  export function folderAssignmentAggregateId(
18
17
  tenantId: string,
19
18
  entityType: string,
@@ -113,7 +113,7 @@ export function FolderManager({
113
113
  const [pendingDelete, setPendingDelete] = useState<FolderNode | null>(null);
114
114
 
115
115
  // Persist expand/collapse so a reload (F5) doesn't re-expand everything.
116
- // kumiko-lint-ignore no-raw-hooks DOM integration: writes to window.localStorage, no framework query/mutation equivalent
116
+ // biome-ignore lint/plugin: DOM integration: writes to window.localStorage, no framework query/mutation equivalent
117
117
  useEffect(() => {
118
118
  if (typeof window === "undefined") return;
119
119
  try {
@@ -283,7 +283,7 @@ export function FolderManager({
283
283
  onClick: () => void,
284
284
  danger?: boolean,
285
285
  ): ReactNode => (
286
- // kumiko-lint-ignore primitives-discipline: compact icon action for the Finder-style tree row; the full Button primitive would break the dense single-row layout
286
+ // biome-ignore lint/plugin: compact icon action for the Finder-style tree row; the full Button primitive would break the dense single-row layout
287
287
  <button
288
288
  type="button"
289
289
  disabled={busy}
@@ -308,7 +308,7 @@ export function FolderManager({
308
308
  expandable: boolean,
309
309
  ): ReactNode =>
310
310
  expandable ? (
311
- // kumiko-lint-ignore primitives-discipline: dense Finder-row toggle (chevron + name); the Button primitive would break the single-row layout
311
+ // biome-ignore lint/plugin: dense Finder-row toggle (chevron + name); the Button primitive would break the single-row layout
312
312
  <button
313
313
  type="button"
314
314
  aria-expanded={expanded}
@@ -335,7 +335,7 @@ export function FolderManager({
335
335
  );
336
336
 
337
337
  const draftRow = (depth: number, key: string, stripe: boolean): ReactNode => (
338
- // kumiko-lint-ignore primitives-discipline: native form only to capture Enter-to-submit on the inline draft field
338
+ // biome-ignore lint/plugin: native form only to capture Enter-to-submit on the inline draft field
339
339
  <form
340
340
  key={key}
341
341
  className={rowClass(stripe, false)}
@@ -374,7 +374,7 @@ export function FolderManager({
374
374
  const leafRow = (leaf: FolderLeaf, depth: number, stripe: boolean): ReactNode => {
375
375
  const LeafIcon = filing?.leafIcon ?? File;
376
376
  return (
377
- // kumiko-lint-ignore primitives-discipline: draggable Finder-style leaf row; the Button primitive can't be a dense, full-row drag source
377
+ // biome-ignore lint/plugin: draggable Finder-style leaf row; the Button primitive can't be a dense, full-row drag source
378
378
  <button
379
379
  key={`leaf-${leaf.id}`}
380
380
  type="button"
@@ -448,7 +448,7 @@ export function FolderManager({
448
448
  // Subtle in-tree row to add a root folder (replaces the old floating toolbar
449
449
  // button, which caused an ugly header jump in hosts with their own actions).
450
450
  const newRootRow = (): ReactNode => (
451
- // kumiko-lint-ignore primitives-discipline: dense Finder-row action (add root folder); the Button primitive would break the row layout
451
+ // biome-ignore lint/plugin: dense Finder-row action (add root folder); the Button primitive would break the row layout
452
452
  <button
453
453
  type="button"
454
454
  disabled={busy}
@@ -4,7 +4,8 @@
4
4
  // Kept separate from the folders feature (which only requires "tenant") so
5
5
  // folders stays usable without the user-data-rights stack. Mirrors credit-user-data.
6
6
 
7
- import { defineFeature, EXT_USER_DATA } from "@cosmicdrift/kumiko-framework/engine";
7
+ import { defineFeature } from "@cosmicdrift/kumiko-framework/engine";
8
+ import { registerUserDataHooks } from "../shared/index.ts";
8
9
  import {
9
10
  folderAssignmentDeleteHook,
10
11
  folderAssignmentExportHook,
@@ -19,19 +20,16 @@ export function createFoldersUserDataFeature() {
19
20
  r.describe(
20
21
  "GDPR (Art. 20 export / Art. 17 erasure) coverage for the `folders` feature's `folder` + `folder-assignment` entities. Mounts the EXT_USER_DATA export + delete hooks so a tenant's folder tree and its entity-to-folder assignments are included in the user-data export bundle and erased on a tenant-scoped forget (single-user tenants only; multi-user + anonymize are no-ops since folder rows carry no per-user PII). Kept separate from `folders` so folder consumers without the user-data-rights pipeline don't pull a hard dependency — requires `user-data-rights`, optionalRequires `folders`.",
21
22
  );
22
- // user-data-rights is the hard dependency (EXT_USER_DATA host). `folders` is
23
- // OPTIONAL: if it's mounted toggleable(default=false) (e.g. per-tenant via
24
- // tier), a hard r.requires would throw an "effectively disabled" boot
25
- // warning even though the folder entities exist and the hooks work fine.
26
- r.requires({ features: ["user-data-rights"] });
27
- r.optionalRequires("folders");
28
- r.useExtension(EXT_USER_DATA, "folder", {
29
- export: folderExportHook,
30
- delete: folderDeleteHook,
31
- });
32
- r.useExtension(EXT_USER_DATA, "folder-assignment", {
33
- export: folderAssignmentExportHook,
34
- delete: folderAssignmentDeleteHook,
23
+ registerUserDataHooks(r, {
24
+ sourceFeature: "folders",
25
+ entities: [
26
+ { entity: "folder", export: folderExportHook, delete: folderDeleteHook },
27
+ {
28
+ entity: "folder-assignment",
29
+ export: folderAssignmentExportHook,
30
+ delete: folderAssignmentDeleteHook,
31
+ },
32
+ ],
35
33
  });
36
34
  },
37
35
  { dedupeOptions: {} },