@cosmicdrift/kumiko-bundled-features 0.366.0 → 0.368.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 (365) hide show
  1. package/dist/audit/handlers/details.query.js +1 -1
  2. package/dist/audit/handlers/list.query.js +1 -1
  3. package/dist/audit/run-escape-hatch-retention.js +1 -1
  4. package/dist/auth-email-password/bootstrap.js +1 -1
  5. package/dist/auth-email-password/handlers/invite-accept-with-login.write.js +6 -3
  6. package/dist/auth-email-password/handlers/invite-accept.write.js +6 -3
  7. package/dist/auth-email-password/handlers/invite-info.query.js +1 -1
  8. package/dist/auth-email-password/handlers/invite-signup-complete.write.js +6 -3
  9. package/dist/auth-email-password/handlers/signup-confirm.write.js +1 -1
  10. package/dist/auth-email-password/seeding.js +2 -2
  11. package/dist/auth-foundation/feature.d.ts +4 -0
  12. package/dist/auth-foundation/feature.js +37 -33
  13. package/dist/auth-foundation/index.d.ts +1 -1
  14. package/dist/auth-foundation/index.js +1 -1
  15. package/dist/auth-mfa/db/queries.js +1 -2
  16. package/dist/auth-mfa/handlers/enable-confirm-preauth.write.js +1 -1
  17. package/dist/auth-mfa/handlers/enable-start-preauth.write.js +1 -1
  18. package/dist/auth-mfa/handlers/reencrypt.job.js +2 -3
  19. package/dist/auth-mfa/handlers/status.query.js +1 -1
  20. package/dist/auth-mfa/handlers/verify.write.js +1 -1
  21. package/dist/auth-mfa/mfa-code-verifier.js +1 -1
  22. package/dist/auth-mfa/mfa-status-checker.js +1 -1
  23. package/dist/auth-mfa-user-data/index.d.ts +4 -0
  24. package/dist/auth-mfa-user-data/index.js +13 -9
  25. package/dist/billing-foundation/billing-info-query.js +1 -1
  26. package/dist/billing-foundation/feature.d.ts +1 -0
  27. package/dist/billing-foundation/feature.js +5 -6
  28. package/dist/billing-foundation/handlers/create-portal-session.write.js +1 -1
  29. package/dist/billing-foundation/projection.js +1 -2
  30. package/dist/cap-counter/calendar-cap-usage-reservation.d.ts +7 -0
  31. package/dist/cap-counter/calendar-cap-usage-reservation.js +28 -2
  32. package/dist/cap-counter/cap-reservation.d.ts +16 -0
  33. package/dist/cap-counter/cap-reservation.js +144 -14
  34. package/dist/cap-counter/feature.d.ts +4 -0
  35. package/dist/cap-counter/feature.js +74 -68
  36. package/dist/cap-counter/handlers/increment-rolling.write.js +3 -4
  37. package/dist/cap-counter/index.d.ts +3 -2
  38. package/dist/cap-counter/index.js +3 -2
  39. package/dist/cap-counter/tables.js +10 -3
  40. package/dist/cap-overview/handlers/caps-usage.query.js +1 -2
  41. package/dist/cap-overview/handlers/tenant-caps-list.query.js +1 -2
  42. package/dist/cap-overview/handlers/tenant-options.query.js +1 -1
  43. package/dist/channel-email/email-channel.d.ts +5 -1
  44. package/dist/channel-email/email-channel.js +8 -2
  45. package/dist/channel-email/feature.js +1 -1
  46. package/dist/channel-in-app/handlers/inbox.query.js +1 -1
  47. package/dist/channel-in-app/handlers/mark-all-read.write.js +1 -1
  48. package/dist/channel-in-app/handlers/mark-read.write.js +1 -1
  49. package/dist/channel-in-app/handlers/unread-count.query.js +1 -1
  50. package/dist/channel-in-app/tables.js +1 -2
  51. package/dist/compliance-profiles/handlers/for-tenant.query.js +1 -1
  52. package/dist/compliance-profiles/handlers/needs-profile.query.js +1 -1
  53. package/dist/compliance-profiles/handlers/set-profile.write.js +1 -2
  54. package/dist/compliance-profiles/resolve-for-tenant.js +1 -1
  55. package/dist/compliance-profiles/seeding.js +3 -5
  56. package/dist/compliance-profiles-ops/index.d.ts +8 -0
  57. package/dist/compliance-profiles-ops/index.js +19 -15
  58. package/dist/config/db/queries/resolver.js +1 -1
  59. package/dist/config/handlers/reencrypt.job.js +2 -2
  60. package/dist/config/resolver.js +1 -1
  61. package/dist/config/write-helpers.js +1 -1
  62. package/dist/crypto-shredding/handlers/forget-subject.write.js +6 -3
  63. package/dist/custom-fields/db/queries/field-access.js +1 -1
  64. package/dist/custom-fields/db/queries/projection.js +1 -1
  65. package/dist/custom-fields/db/queries/quota.js +1 -1
  66. package/dist/custom-fields/db/queries/retention.js +1 -2
  67. package/dist/custom-fields/db/queries/user-data-rights.js +1 -1
  68. package/dist/custom-fields/feature.d.ts +20 -2
  69. package/dist/custom-fields/feature.js +9 -13
  70. package/dist/custom-fields/handlers/clear-custom-field.write.js +2 -2
  71. package/dist/custom-fields/handlers/delete-system-field.write.js +2 -2
  72. package/dist/custom-fields/handlers/delete-tenant-field.write.js +2 -2
  73. package/dist/custom-fields/handlers/set-custom-field.write.js +2 -2
  74. package/dist/custom-fields/wire-for-entity.js +4 -4
  75. package/dist/data-retention/resolve-for-tenant.js +1 -1
  76. package/dist/data-retention/run-retention-cleanup.js +17 -13
  77. package/dist/delivery/address-opt-out.js +1 -2
  78. package/dist/delivery/attempt-log-retention.js +1 -1
  79. package/dist/delivery/channel-context.js +2 -1
  80. package/dist/delivery/db/queries/address-opt-outs.js +1 -1
  81. package/dist/delivery/db/queries/preferences.js +1 -1
  82. package/dist/delivery/delivery-service.d.ts +2 -0
  83. package/dist/delivery/delivery-service.js +46 -11
  84. package/dist/delivery/feature.js +2 -2
  85. package/dist/delivery/handlers/log.query.js +2 -3
  86. package/dist/delivery/handlers/preferences.query.js +1 -1
  87. package/dist/delivery/handlers/unsubscribe-address.write.d.ts +6 -0
  88. package/dist/delivery/handlers/unsubscribe-address.write.js +8 -5
  89. package/dist/delivery/index.d.ts +3 -0
  90. package/dist/delivery/index.js +2 -0
  91. package/dist/delivery/testing.d.ts +2 -0
  92. package/dist/delivery/types.d.ts +2 -1
  93. package/dist/delivery/unsubscribe-link.d.ts +25 -0
  94. package/dist/delivery/unsubscribe-link.js +40 -0
  95. package/dist/delivery/unsubscribe-page-strings.d.ts +11 -0
  96. package/dist/delivery/unsubscribe-page-strings.js +15 -0
  97. package/dist/delivery/unsubscribe.d.ts +3 -0
  98. package/dist/delivery/unsubscribe.js +65 -29
  99. package/dist/delivery/upsert-preference.js +1 -2
  100. package/dist/derivatives-sharp/feature.d.ts +4 -0
  101. package/dist/derivatives-sharp/feature.js +15 -11
  102. package/dist/derivatives-sharp/index.d.ts +1 -1
  103. package/dist/derivatives-sharp/index.js +1 -1
  104. package/dist/document-ingest-foundation/feature.d.ts +7 -0
  105. package/dist/document-ingest-foundation/feature.js +94 -90
  106. package/dist/document-ingest-foundation/forget-extract-with-file-ref.js +3 -3
  107. package/dist/document-ingest-foundation/index.d.ts +1 -1
  108. package/dist/document-ingest-foundation/index.js +1 -1
  109. package/dist/feature-toggles/global-feature-state-table.js +1 -2
  110. package/dist/feature-toggles/handlers/set.write.js +3 -5
  111. package/dist/feature-toggles/toggle-runtime.js +1 -1
  112. package/dist/file-derivatives/feature.d.ts +1 -0
  113. package/dist/file-derivatives/feature.js +2 -1
  114. package/dist/file-derivatives/handlers/public-variant-by-file-ref.query.js +1 -1
  115. package/dist/file-derivatives/handlers/public-variant.query.js +1 -1
  116. package/dist/file-foundation/feature.d.ts +6 -0
  117. package/dist/file-foundation/feature.js +29 -25
  118. package/dist/file-foundation/index.d.ts +1 -1
  119. package/dist/file-foundation/index.js +1 -1
  120. package/dist/file-foundation/read-file-ref-content.js +1 -1
  121. package/dist/file-provider-inmemory/feature.d.ts +4 -0
  122. package/dist/file-provider-inmemory/feature.js +24 -20
  123. package/dist/file-provider-inmemory/index.d.ts +1 -1
  124. package/dist/file-provider-inmemory/index.js +1 -1
  125. package/dist/file-provider-s3/env-feature.d.ts +3 -0
  126. package/dist/file-provider-s3/env-feature.js +46 -0
  127. package/dist/file-provider-s3/feature.d.ts +26 -0
  128. package/dist/file-provider-s3/feature.js +84 -72
  129. package/dist/file-provider-s3/index.d.ts +1 -1
  130. package/dist/file-provider-s3/index.js +1 -1
  131. package/dist/file-provider-s3/lib/index.d.ts +3 -0
  132. package/dist/file-provider-s3/lib/index.js +2 -0
  133. package/dist/{files-provider-s3 → file-provider-s3/lib}/s3-provider.js +19 -19
  134. package/dist/file-provider-s3-env/index.d.ts +8 -1
  135. package/dist/file-provider-s3-env/index.js +7 -2
  136. package/dist/files-provider-s3/index.d.ts +5 -3
  137. package/dist/files-provider-s3/index.js +5 -2
  138. package/dist/files-tenant-data/handlers/sweep-orphaned-derivatives.job.js +1 -1
  139. package/dist/files-tenant-data/hooks.js +1 -2
  140. package/dist/folders/feature.d.ts +6 -2
  141. package/dist/folders/feature.js +4 -2
  142. package/dist/folders-user-data/index.d.ts +4 -0
  143. package/dist/folders-user-data/index.js +21 -17
  144. package/dist/form-draft/db/queries/cleanup.js +1 -1
  145. package/dist/form-draft/db/queries/draft-count.js +1 -1
  146. package/dist/form-draft/db/queries/owned-file-refs.js +1 -2
  147. package/dist/form-draft/feature.d.ts +4 -0
  148. package/dist/form-draft/feature.js +5 -1
  149. package/dist/form-draft/handlers/cleanup.job.js +2 -2
  150. package/dist/form-draft/index.d.ts +1 -1
  151. package/dist/form-draft/index.js +1 -1
  152. package/dist/form-draft/lookup.js +1 -1
  153. package/dist/form-draft-user-data/index.d.ts +4 -0
  154. package/dist/form-draft-user-data/index.js +13 -9
  155. package/dist/inbound-mail-foundation/feature.d.ts +4 -0
  156. package/dist/inbound-mail-foundation/feature.js +151 -147
  157. package/dist/inbound-mail-foundation/handlers/ingest-message.write.js +1 -2
  158. package/dist/inbound-mail-foundation/index.d.ts +1 -1
  159. package/dist/inbound-mail-foundation/index.js +1 -1
  160. package/dist/inbound-mail-foundation/oauth-access-token.js +1 -2
  161. package/dist/inbound-mail-foundation/projection.js +1 -2
  162. package/dist/inbound-mail-foundation/watch-supervisor.js +1 -1
  163. package/dist/inbound-provider-imap/feature.d.ts +4 -0
  164. package/dist/inbound-provider-imap/feature.js +16 -12
  165. package/dist/inbound-provider-imap/index.d.ts +1 -1
  166. package/dist/inbound-provider-imap/index.js +1 -1
  167. package/dist/inbound-provider-inmemory/feature.d.ts +4 -0
  168. package/dist/inbound-provider-inmemory/feature.js +14 -10
  169. package/dist/inbound-provider-inmemory/index.d.ts +1 -1
  170. package/dist/inbound-provider-inmemory/index.js +1 -1
  171. package/dist/jobs/db/queries/retention.js +1 -1
  172. package/dist/jobs/db/queries/stale-run-sweep.js +1 -1
  173. package/dist/jobs/handlers/detail.query.js +1 -1
  174. package/dist/jobs/handlers/list.query.js +1 -2
  175. package/dist/jobs/handlers/retry.write.js +1 -1
  176. package/dist/jobs/handlers/tenant-failures.query.js +1 -1
  177. package/dist/jobs/handlers/tenant-runs.query.js +1 -1
  178. package/dist/jobs/job-run-logger.js +1 -2
  179. package/dist/jobs/tenant-job-failure-table.js +1 -2
  180. package/dist/jobs/tenant-job-run-table.js +1 -2
  181. package/dist/ledger/feature.d.ts +6 -2
  182. package/dist/ledger/feature.js +4 -2
  183. package/dist/mail-foundation/feature.d.ts +23 -1
  184. package/dist/mail-foundation/feature.js +76 -49
  185. package/dist/mail-foundation/index.d.ts +1 -1
  186. package/dist/mail-foundation/index.js +1 -1
  187. package/dist/mail-transport-inmemory/feature.d.ts +4 -0
  188. package/dist/mail-transport-inmemory/feature.js +20 -16
  189. package/dist/mail-transport-inmemory/index.d.ts +1 -1
  190. package/dist/mail-transport-inmemory/index.js +1 -1
  191. package/dist/mail-transport-smtp/feature.d.ts +16 -0
  192. package/dist/mail-transport-smtp/feature.js +85 -79
  193. package/dist/mail-transport-smtp/index.d.ts +1 -1
  194. package/dist/mail-transport-smtp/index.js +1 -1
  195. package/dist/managed-pages/handlers/by-slug.query.js +1 -1
  196. package/dist/managed-pages/handlers/by-tenant-published.query.js +1 -2
  197. package/dist/managed-pages/handlers/set.write.js +1 -2
  198. package/dist/managed-pages/seeding.js +3 -5
  199. package/dist/metrics/compute.d.ts +1 -1
  200. package/dist/metrics/filters.d.ts +1 -1
  201. package/dist/metrics/filters.js +1 -1
  202. package/dist/metrics/validate.js +1 -1
  203. package/dist/notes-history/feature.d.ts +7 -2
  204. package/dist/notes-history/feature.js +4 -2
  205. package/dist/notes-history/handlers/add-note.write.js +1 -1
  206. package/dist/notes-history-user-data/hooks.js +1 -1
  207. package/dist/notes-history-user-data/index.d.ts +4 -0
  208. package/dist/notes-history-user-data/index.js +21 -17
  209. package/dist/personal-access-tokens/feature.d.ts +4 -1
  210. package/dist/personal-access-tokens/feature.js +10 -2
  211. package/dist/personal-access-tokens/handlers/create.write.js +1 -1
  212. package/dist/personal-access-tokens/handlers/list.query.js +2 -2
  213. package/dist/personal-access-tokens/handlers/revoke.write.js +1 -1
  214. package/dist/personal-access-tokens/resolver.js +1 -1
  215. package/dist/personal-access-tokens/revoke-for-user.js +1 -1
  216. package/dist/personal-access-tokens/roles.js +3 -5
  217. package/dist/personal-access-tokens/screens.js +2 -0
  218. package/dist/readiness/feature.d.ts +8 -0
  219. package/dist/readiness/feature.js +18 -14
  220. package/dist/readiness/index.d.ts +1 -1
  221. package/dist/readiness/index.js +1 -1
  222. package/dist/secrets/db/queries/read.js +1 -1
  223. package/dist/secrets/feature.d.ts +3 -0
  224. package/dist/secrets/feature.js +3 -2
  225. package/dist/secrets/handlers/rotate.job.js +2 -3
  226. package/dist/secrets/secrets-context.js +3 -4
  227. package/dist/sessions/db/queries/cleanup.js +1 -1
  228. package/dist/sessions/handlers/detail.query.js +1 -1
  229. package/dist/sessions/handlers/list.query.js +2 -2
  230. package/dist/sessions/handlers/mine.query.js +1 -1
  231. package/dist/sessions/handlers/revoke-all-for-user.write.js +1 -1
  232. package/dist/sessions/handlers/revoke-all-others.write.js +1 -1
  233. package/dist/sessions/handlers/revoke.write.js +1 -1
  234. package/dist/sessions/session-callbacks.js +4 -6
  235. package/dist/sessions/testing.d.ts +1 -1
  236. package/dist/tags/feature.d.ts +6 -2
  237. package/dist/tags/feature.js +4 -2
  238. package/dist/template-resolver/api.js +1 -1
  239. package/dist/template-resolver/compile-document-body.js +47 -11
  240. package/dist/template-resolver/document-sanitizer.d.ts +2 -0
  241. package/dist/template-resolver/document-sanitizer.js +16 -1
  242. package/dist/template-resolver/document-schema.d.ts +2 -0
  243. package/dist/template-resolver/document-schema.js +31 -0
  244. package/dist/template-resolver/handlers/bundle-import.js +4 -3
  245. package/dist/template-resolver/handlers/by-slug.query.js +1 -1
  246. package/dist/template-resolver/handlers/by-tenant.query.js +1 -2
  247. package/dist/template-resolver/handlers/collection-item.query.js +1 -1
  248. package/dist/template-resolver/handlers/collection-list.query.js +1 -2
  249. package/dist/template-resolver/handlers/collection-set.write.js +1 -1
  250. package/dist/template-resolver/handlers/copy-locale.write.js +4 -3
  251. package/dist/template-resolver/handlers/diff-to-system.query.js +1 -1
  252. package/dist/template-resolver/handlers/export-bundle.query.js +1 -1
  253. package/dist/template-resolver/handlers/find-by-id.query.js +6 -2
  254. package/dist/template-resolver/handlers/layout-source.query.js +1 -1
  255. package/dist/template-resolver/handlers/list.query.js +4 -2
  256. package/dist/template-resolver/handlers/overview.query.js +5 -3
  257. package/dist/template-resolver/handlers/reset-to-system.write.js +1 -1
  258. package/dist/template-resolver/handlers/resource-remove.write.js +1 -1
  259. package/dist/template-resolver/handlers/set.write.js +1 -1
  260. package/dist/template-resolver/handlers/template-write.d.ts +2 -1
  261. package/dist/template-resolver/handlers/template-write.js +13 -2
  262. package/dist/template-resolver/handlers/tenant-overrides.query.js +1 -1
  263. package/dist/template-resolver/handlers/toggle-status.write.js +1 -1
  264. package/dist/template-resolver/handlers/usage.query.js +1 -1
  265. package/dist/template-resolver/handlers/validate.query.js +1 -1
  266. package/dist/template-resolver/index.d.ts +3 -2
  267. package/dist/template-resolver/index.js +3 -2
  268. package/dist/template-resolver/qualified-names.d.ts +1 -0
  269. package/dist/template-resolver/qualified-names.js +1 -0
  270. package/dist/template-resolver/seeding.d.ts +4 -0
  271. package/dist/template-resolver/seeding.js +43 -9
  272. package/dist/template-resolver/store-template-resource.js +1 -1
  273. package/dist/template-resolver/template-preview.js +3 -1
  274. package/dist/template-resolver/template-resources.js +1 -1
  275. package/dist/template-resolver/template-system-only.d.ts +8 -0
  276. package/dist/template-resolver/template-system-only.js +11 -0
  277. package/dist/template-resolver/template-validation.js +42 -28
  278. package/dist/template-resolver/testing.js +1 -1
  279. package/dist/template-resolver/web/i18n.js +1 -0
  280. package/dist/template-resolver-user-data/index.d.ts +4 -0
  281. package/dist/template-resolver-user-data/index.js +17 -13
  282. package/dist/tenant/handlers/active-tenant-ids.query.js +1 -1
  283. package/dist/tenant/handlers/add-member.write.js +1 -2
  284. package/dist/tenant/handlers/cancel-invitation.write.js +1 -1
  285. package/dist/tenant/handlers/invitations.query.js +1 -1
  286. package/dist/tenant/handlers/me.query.js +1 -1
  287. package/dist/tenant/handlers/member-directory.query.js +1 -1
  288. package/dist/tenant/handlers/members.query.js +1 -1
  289. package/dist/tenant/handlers/memberships.query.js +1 -1
  290. package/dist/tenant/handlers/remove-member.write.js +1 -2
  291. package/dist/tenant/handlers/resolve-user-ids.query.js +1 -1
  292. package/dist/tenant/handlers/team-list.query.js +1 -1
  293. package/dist/tenant/handlers/tenant-directory.query.js +1 -1
  294. package/dist/tenant/handlers/update-member-roles.write.js +1 -2
  295. package/dist/tenant/invited-membership.js +2 -3
  296. package/dist/tenant/last-tenant-admin.js +1 -2
  297. package/dist/tenant/seeding.js +12 -6
  298. package/dist/tenant-lifecycle/handlers/cancel-destruction.write.js +1 -2
  299. package/dist/tenant-lifecycle/handlers/request-destruction.write.js +1 -2
  300. package/dist/tenant-lifecycle/lib/revoke-tenant-sessions.js +1 -1
  301. package/dist/tenant-lifecycle/lifecycle-gate.js +1 -1
  302. package/dist/tenant-lifecycle/run-tenant-destroy.js +3 -5
  303. package/dist/tenant-lifecycle/stages.js +10 -6
  304. package/dist/tenant-lifecycle/testing.d.ts +1 -1
  305. package/dist/tenant-lifecycle/testing.js +2 -2
  306. package/dist/tenant-settings/feature.d.ts +1 -0
  307. package/dist/tenant-settings/feature.js +2 -1
  308. package/dist/tier-engine/feature.d.ts +1 -8
  309. package/dist/tier-engine/feature.js +71 -78
  310. package/dist/tier-engine/handlers/get-tenant-tier.query.js +2 -3
  311. package/dist/tier-engine/handlers/set-tenant-tier.write.js +1 -2
  312. package/dist/user/db/queries/stream-tenant-backfill.js +1 -1
  313. package/dist/user/handlers/create.write.js +1 -2
  314. package/dist/user/handlers/find-for-auth.query.js +1 -1
  315. package/dist/user/handlers/list.query.js +1 -1
  316. package/dist/user/handlers/update-roles.js +1 -2
  317. package/dist/user/index.d.ts +1 -1
  318. package/dist/user/index.js +1 -1
  319. package/dist/user/invited-global-roles.js +2 -3
  320. package/dist/user/principal-status.d.ts +4 -0
  321. package/dist/user/principal-status.js +9 -3
  322. package/dist/user/resolve-display-names.js +1 -1
  323. package/dist/user/seeding.js +5 -6
  324. package/dist/user-data-rights/audit-download.js +2 -2
  325. package/dist/user-data-rights/db/queries/export-jobs.js +1 -1
  326. package/dist/user-data-rights/db/queries/forget-cleanup.js +1 -1
  327. package/dist/user-data-rights/handlers/download-by-job.query.js +1 -1
  328. package/dist/user-data-rights/handlers/download-by-token.query.js +1 -1
  329. package/dist/user-data-rights/handlers/export-status.query.js +1 -1
  330. package/dist/user-data-rights/handlers/list-download-attempts.query.js +1 -1
  331. package/dist/user-data-rights/handlers/my-audit-log.query.js +1 -1
  332. package/dist/user-data-rights/handlers/request-export.write.js +1 -2
  333. package/dist/user-data-rights/handlers/run-forget-cleanup.write.js +3 -3
  334. package/dist/user-data-rights/lib/deny-if-target-outside-admin-tenant.d.ts +1 -1
  335. package/dist/user-data-rights/lib/deny-if-target-outside-admin-tenant.js +1 -1
  336. package/dist/user-data-rights/lib/update-user-lifecycle.d.ts +1 -0
  337. package/dist/user-data-rights/lib/update-user-lifecycle.js +3 -3
  338. package/dist/user-data-rights/run-export-jobs.js +2 -3
  339. package/dist/user-data-rights/run-forget-cleanup.js +9 -5
  340. package/dist/user-data-rights/run-user-export.js +9 -5
  341. package/dist/waitlist/handlers/invite.write.js +1 -2
  342. package/dist/waitlist/handlers/reject.write.js +1 -1
  343. package/dist/waitlist/lib.js +1 -2
  344. package/dist/workflow-runner/event-subscriber.js +1 -1
  345. package/dist/workflow-runner/feature.d.ts +4 -0
  346. package/dist/workflow-runner/feature.js +44 -40
  347. package/dist/workflow-runner/handlers/resume-run.write.js +1 -1
  348. package/dist/workflow-runner/index.d.ts +1 -1
  349. package/dist/workflow-runner/index.js +1 -1
  350. package/dist/workflow-runner/pending-projection.js +1 -1
  351. package/package.json +28 -11
  352. package/src/cap-counter/changes.json +13 -0
  353. package/src/channel-email/changes.json +6 -0
  354. package/src/crypto-shredding/changes.json +6 -0
  355. package/src/delivery/changes.json +12 -0
  356. package/src/file-provider-s3/changes.json +10 -1
  357. package/src/personal-access-tokens/changes.json +6 -0
  358. package/src/template-resolver/changes.json +25 -0
  359. package/src/user/changes.json +6 -0
  360. package/src/user-data-rights/changes.json +6 -0
  361. package/dist/file-provider-s3-env/feature.d.ts +0 -3
  362. package/dist/file-provider-s3-env/feature.js +0 -46
  363. /package/dist/{files-provider-s3 → file-provider-s3/lib}/env-helper.d.ts +0 -0
  364. /package/dist/{files-provider-s3 → file-provider-s3/lib}/env-helper.js +0 -0
  365. /package/dist/{files-provider-s3 → file-provider-s3/lib}/s3-provider.d.ts +0 -0
@@ -2,7 +2,7 @@
2
2
  // screen. Tenant-isolated at the WHERE level like list.query, so a caller
3
3
  // can only read events in their own tenant; a SystemAdmin can pass scope
4
4
  // "system" to read app-instance system events (e.g. app.started).
5
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
5
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
6
6
  import { access, defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
7
7
  import { eventsTable } from "@cosmicdrift/kumiko-framework/event-store";
8
8
  import * as z from "zod";
@@ -11,7 +11,7 @@
11
11
  //
12
12
  // Event payloads hold PII as subject-KMS ciphertext; it is replaced by
13
13
  // REDACTED_PII_PLACEHOLDER before returning, since the API leak guard refuses ciphertext.
14
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
14
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
15
15
  import { access, defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
16
16
  import { eventsTable } from "@cosmicdrift/kumiko-framework/event-store";
17
17
  import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
@@ -1,5 +1,5 @@
1
- import { aggregateWhere, runnerCanBeginTransaction, selectMany, } from "@cosmicdrift/kumiko-framework/bun-db";
2
1
  import { COMPLIANCE_PROFILES, subtractRetentionSpec, } from "@cosmicdrift/kumiko-framework/compliance";
2
+ import { aggregateWhere, runnerCanBeginTransaction, selectMany, } from "@cosmicdrift/kumiko-framework/db";
3
3
  import { parseTenantId, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-framework/engine";
4
4
  import { eventsTable } from "@cosmicdrift/kumiko-framework/event-store";
5
5
  import { pruneEvents } from "@cosmicdrift/kumiko-framework/pipeline";
@@ -5,7 +5,7 @@
5
5
  // invitation row holds membership role + global roles until the invitee
6
6
  // accepts through the regular invite-accept routes.
7
7
  import { makeDispatchSystemWrite, makeDispatchWriteAs, } from "@cosmicdrift/kumiko-framework/api";
8
- import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
8
+ import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
9
9
  import { ConfigScopes, createSystemUser, } from "@cosmicdrift/kumiko-framework/engine";
10
10
  import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
11
11
  // kumiko-lint-ignore cross-feature-import bootstrap sets per-tenant config through the config feature's write handler
@@ -20,8 +20,7 @@
20
20
  // Unlike signup-confirm: no new tenant is created, no new user is created —
21
21
  // both already exist. The magic is the combined login+accept operation in
22
22
  // one round trip.
23
- import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
24
- import { createEventStoreExecutor, createTenantDb } from "@cosmicdrift/kumiko-framework/db";
23
+ import { createEventStoreExecutor, createTenantDb, fetchOne, } from "@cosmicdrift/kumiko-framework/db";
25
24
  import { buildSessionRoles, createSystemUser, defineWriteHandler, } from "@cosmicdrift/kumiko-framework/engine";
26
25
  import { InternalError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
27
26
  import * as z from "zod";
@@ -128,7 +127,11 @@ export function createInviteAcceptWithLoginHandler(opts = {}) {
128
127
  if (!globalGrant.isSuccess)
129
128
  return globalGrant;
130
129
  // Invitation → accepted: TenantDb for the invitation's tenant.
131
- const invitationTdb = createTenantDb(dbConn, invitationTenantId, "system");
130
+ const invitationTdb = createTenantDb({
131
+ db: dbConn,
132
+ tenantId: invitationTenantId,
133
+ mode: "system",
134
+ });
132
135
  const updateResult = await invitationExecutor.update({
133
136
  id: invitationId,
134
137
  version: invitationVersion,
@@ -14,8 +14,7 @@
14
14
  // Branch 1 ist der klassische "shared workspace bei eingeloggter
15
15
  // Session"-Flow. Branch 2 (anon + existing email) und Branch 3 (anon +
16
16
  // new email) kommen als separate Handler.
17
- import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
18
- import { createEventStoreExecutor, createTenantDb } from "@cosmicdrift/kumiko-framework/db";
17
+ import { createEventStoreExecutor, createTenantDb, fetchOne, } from "@cosmicdrift/kumiko-framework/db";
19
18
  import { createSystemUser, defineWriteHandler, } from "@cosmicdrift/kumiko-framework/engine";
20
19
  import { InternalError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
21
20
  import * as z from "zod";
@@ -108,7 +107,11 @@ export function createInviteAcceptHandler() {
108
107
  // Tenant-scoping: ctx.db ist auf event.user.tenantId gescopt
109
108
  // (= NICHT der invitation-tenant). Eigene TenantDb für den
110
109
  // invitation-tenant bauen damit der executor die row findet.
111
- const invitationTdb = createTenantDb(dbConn, invitationTenantId, "system");
110
+ const invitationTdb = createTenantDb({
111
+ db: dbConn,
112
+ tenantId: invitationTenantId,
113
+ mode: "system",
114
+ });
112
115
  const updateResult = await invitationExecutor.update({
113
116
  id: invitationId,
114
117
  version: invitationVersion,
@@ -4,7 +4,7 @@
4
4
  // the user submits anything. Unlike the accept handlers, this never touches
5
5
  // the token store — the token is not burned and stays usable for the
6
6
  // actual accept call.
7
- import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
7
+ import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
8
8
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
9
9
  import { UnprocessableError } from "@cosmicdrift/kumiko-framework/errors";
10
10
  import * as z from "zod";
@@ -16,8 +16,7 @@
16
16
  // d. Add membership im invited Tenant
17
17
  // e. Invitation → accepted, Token gelöscht
18
18
  // 5. Response: SessionUser + tenantId für Auto-Login
19
- import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
20
- import { createEventStoreExecutor, createTenantDb, } from "@cosmicdrift/kumiko-framework/db";
19
+ import { createEventStoreExecutor, createTenantDb, fetchOne, } from "@cosmicdrift/kumiko-framework/db";
21
20
  import { buildSessionRoles, createSystemUser, defineWriteHandler, } from "@cosmicdrift/kumiko-framework/engine";
22
21
  import { InternalError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
23
22
  import * as z from "zod";
@@ -114,7 +113,11 @@ export function createInviteSignupCompleteHandler(opts = {}) {
114
113
  roles: [invitationRole],
115
114
  });
116
115
  // Invitation → accepted: TenantDb für invitation-tenant
117
- const invitationTdb = createTenantDb(dbConn, invitationTenantId, "system");
116
+ const invitationTdb = createTenantDb({
117
+ db: dbConn,
118
+ tenantId: invitationTenantId,
119
+ mode: "system",
120
+ });
118
121
  const updateResult = await invitationExecutor.update({
119
122
  id: invitationId,
120
123
  version: invitationVersion,
@@ -18,7 +18,7 @@
18
18
  // Failure-Recovery: jeder Pfad nach dem burn checked `committed`-Flag;
19
19
  // bei !committed wird der burn released damit ein legitimer Retry
20
20
  // nicht durch einen stale Marker geblockt wird (wie reset/verify).
21
- import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
21
+ import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
22
22
  import { defineWriteHandler, } from "@cosmicdrift/kumiko-framework/engine";
23
23
  import { ConflictError, InternalError, reraiseAsKumikoError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
24
24
  import { generateUniqueName } from "@cosmicdrift/kumiko-framework/random";
@@ -11,11 +11,11 @@
11
11
  // 3. seedTenant + seedTenantMembership aus tenant/seeding
12
12
  // Damit Sample-Server und Tests keine drei sub-paths zusammensammeln
13
13
  // müssen.
14
- import { fetchOne, selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
15
14
  import { configuredBlindIndexKey, configuredPiiSubjectKms, decryptPiiFieldValues, } from "@cosmicdrift/kumiko-framework/crypto";
15
+ import { fetchOne, selectMany } from "@cosmicdrift/kumiko-framework/db";
16
16
  import { ConflictError } from "@cosmicdrift/kumiko-framework/errors";
17
17
  import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
18
- import { TestUsers } from "@cosmicdrift/kumiko-framework/stack";
18
+ import { TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
19
19
  import { hashPassword } from "../shared/index.js";
20
20
  // kumiko-lint-ignore cross-feature-import auth-tests need user+tenant seed-helpers
21
21
  import { seedTenant, seedTenantMembership } from "../tenant/seeding.js";
@@ -2,6 +2,10 @@ import type { SessionUser } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { type Registry } from "@cosmicdrift/kumiko-framework/engine";
3
3
  import { type AuthProviderBuildDeps, type SessionStore, type TenantExistsFn, type TenantResolverFn, type TenantResolverTrust } from "./types.js";
4
4
  export { EXT_SESSION_STORE, EXT_TENANT_EXISTENCE, EXT_TENANT_RESOLVER, EXT_TOKEN_VERIFIER, } from "./types.js";
5
+ export declare function createAuthFoundationFeature(): import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
6
+ readonly exports: void;
7
+ };
8
+ /** @deprecated Use createAuthFoundationFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
5
9
  export declare const authFoundationFeature: import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
6
10
  readonly exports: void;
7
11
  };
@@ -14,39 +14,43 @@ import { validateSessionStoreMultiplicity, validateTenantExistenceMultiplicity,
14
14
  import { EXT_SESSION_STORE, EXT_TENANT_EXISTENCE, EXT_TENANT_RESOLVER, EXT_TOKEN_VERIFIER, isAuthProviderPlugin, isSessionStoreProvider, isTenantExistenceProvider, isTenantResolverProvider, tokenShapeMatches, } from "./types.js";
15
15
  export { EXT_SESSION_STORE, EXT_TENANT_EXISTENCE, EXT_TENANT_RESOLVER, EXT_TOKEN_VERIFIER, } from "./types.js";
16
16
  const FEATURE_NAME = "auth-foundation";
17
- export const authFoundationFeature = defineFeature(FEATURE_NAME, (r) => {
18
- r.describe("Declares auth-middleware extension points: `tokenVerifier` (Bearer), `sessionStore` (revocable JWT sid), optional `tenantResolver` + `tenantExistence` for anonymous multi-tenant. Provider-features register via r.useExtension; mount auth-foundation with the matching provider features.");
19
- r.uiHints({
20
- displayLabel: "Auth Provider Foundation",
21
- category: "identity",
22
- recommended: false,
23
- });
24
- r.extendsRegistrar(EXT_TOKEN_VERIFIER, {
25
- onRegister: () => {
26
- // No side-effects at register-time — registry stores the usage,
27
- // resolveTokenVerifier looks it up at request-time.
28
- },
29
- });
30
- r.bootCheck(({ features }) => validateTokenVerifierMultiplicity(features));
31
- r.extendsRegistrar(EXT_SESSION_STORE, {
32
- onRegister: () => {
33
- // No side-effects at register-time — resolveSessionStore at boot/request.
34
- },
35
- });
36
- r.bootCheck(({ features }) => validateSessionStoreMultiplicity(features));
37
- r.extendsRegistrar(EXT_TENANT_RESOLVER, {
38
- onRegister: () => {
39
- // Optional — zero providers is fine (single-tenant / header-cookie).
40
- },
41
- });
42
- r.bootCheck(({ features }) => validateTenantResolverMultiplicity(features));
43
- r.extendsRegistrar(EXT_TENANT_EXISTENCE, {
44
- onRegister: () => {
45
- // Optional — zero providers skips the existence check.
46
- },
47
- });
48
- r.bootCheck(({ features }) => validateTenantExistenceMultiplicity(features));
49
- });
17
+ export function createAuthFoundationFeature() {
18
+ return defineFeature(FEATURE_NAME, (r) => {
19
+ r.describe("Declares auth-middleware extension points: `tokenVerifier` (Bearer), `sessionStore` (revocable JWT sid), optional `tenantResolver` + `tenantExistence` for anonymous multi-tenant. Provider-features register via r.useExtension; mount auth-foundation with the matching provider features.");
20
+ r.uiHints({
21
+ displayLabel: "Auth Provider Foundation",
22
+ category: "identity",
23
+ recommended: false,
24
+ });
25
+ r.extendsRegistrar(EXT_TOKEN_VERIFIER, {
26
+ onRegister: () => {
27
+ // No side-effects at register-time — registry stores the usage,
28
+ // resolveTokenVerifier looks it up at request-time.
29
+ },
30
+ });
31
+ r.bootCheck(({ features }) => validateTokenVerifierMultiplicity(features));
32
+ r.extendsRegistrar(EXT_SESSION_STORE, {
33
+ onRegister: () => {
34
+ // No side-effects at register-time — resolveSessionStore at boot/request.
35
+ },
36
+ });
37
+ r.bootCheck(({ features }) => validateSessionStoreMultiplicity(features));
38
+ r.extendsRegistrar(EXT_TENANT_RESOLVER, {
39
+ onRegister: () => {
40
+ // Optional — zero providers is fine (single-tenant / header-cookie).
41
+ },
42
+ });
43
+ r.bootCheck(({ features }) => validateTenantResolverMultiplicity(features));
44
+ r.extendsRegistrar(EXT_TENANT_EXISTENCE, {
45
+ onRegister: () => {
46
+ // Optional — zero providers skips the existence check.
47
+ },
48
+ });
49
+ r.bootCheck(({ features }) => validateTenantExistenceMultiplicity(features));
50
+ }, { dedupeOptions: {} });
51
+ }
52
+ /** @deprecated Use createAuthFoundationFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
53
+ export const authFoundationFeature = createAuthFoundationFeature();
50
54
  /**
51
55
  * Tries every registered tokenVerifier provider's shape against `rawToken`
52
56
  * in registration order and calls the first match's verifier. Returns null
@@ -1,3 +1,3 @@
1
- export { authFoundationFeature, type ResolvedTenantResolver, resolveSessionStore, resolveTenantExistence, resolveTenantResolver, resolveTokenVerifier, } from "./feature.js";
1
+ export { authFoundationFeature, createAuthFoundationFeature, type ResolvedTenantResolver, resolveSessionStore, resolveTenantExistence, resolveTenantResolver, resolveTokenVerifier, } from "./feature.js";
2
2
  export { resolveAnonymousAccessFromRegistry } from "./resolve-anonymous-access.js";
3
3
  export { type AuthProviderBuildDeps, type AuthProviderPlugin, type AuthVerifier, EXT_SESSION_STORE, EXT_TENANT_EXISTENCE, EXT_TENANT_RESOLVER, EXT_TOKEN_VERIFIER, isAuthProviderPlugin, isSessionStoreProvider, isTenantExistenceProvider, isTenantResolverProvider, isTenantResolverTrust, isValidTokenShape, type SessionMassRevoker, type SessionStore, type SessionStoreProvider, type TenantExistenceProvider, type TenantExistsFn, type TenantResolverFn, type TenantResolverProvider, type TenantResolverTrust, type TokenShape, tokenShapeKey, tokenShapeMatches, } from "./types.js";
@@ -1,4 +1,4 @@
1
1
  // Public API of the auth-foundation bundled-feature.
2
- export { authFoundationFeature, resolveSessionStore, resolveTenantExistence, resolveTenantResolver, resolveTokenVerifier, } from "./feature.js";
2
+ export { authFoundationFeature, createAuthFoundationFeature, resolveSessionStore, resolveTenantExistence, resolveTenantResolver, resolveTokenVerifier, } from "./feature.js";
3
3
  export { resolveAnonymousAccessFromRegistry } from "./resolve-anonymous-access.js";
4
4
  export { EXT_SESSION_STORE, EXT_TENANT_EXISTENCE, EXT_TENANT_RESOLVER, EXT_TOKEN_VERIFIER, isAuthProviderPlugin, isSessionStoreProvider, isTenantExistenceProvider, isTenantResolverProvider, isTenantResolverTrust, isValidTokenShape, tokenShapeKey, tokenShapeMatches, } from "./types.js";
@@ -1,5 +1,4 @@
1
- import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
2
- import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
1
+ import { createEventStoreExecutor, fetchOne, } from "@cosmicdrift/kumiko-framework/db";
3
2
  import { parseJsonOrThrow } from "@cosmicdrift/kumiko-framework/utils";
4
3
  import { userMfaEntity, userMfaTable } from "../schema/user-mfa.js";
5
4
  const executor = createEventStoreExecutor(userMfaTable, userMfaEntity, {
@@ -92,7 +92,7 @@ export function createEnableConfirmPreauthHandler(opts) {
92
92
  return invalidSetupToken();
93
93
  // "system" mode: no session exists yet, tenantId comes from the
94
94
  // verified token, mirroring enable-start-preauth.write.ts.
95
- const scopedDb = createTenantDb(ctx.db.unsafeRaw(), tenantId, "system");
95
+ const scopedDb = createTenantDb({ db: ctx.db.unsafeRaw(), tenantId, mode: "system" });
96
96
  const scopedUser = { id: userId, tenantId, roles: ["User"] };
97
97
  const existing = await findUserMfaRow(scopedDb, scopedUser);
98
98
  if (existing)
@@ -44,7 +44,7 @@ export function createEnableStartPreauthHandler(opts) {
44
44
  // "system" mode: the guest dispatch identity's own tenantId is
45
45
  // meaningless here — the preauthSetupToken is the source of truth
46
46
  // for which tenant's row to read, mirroring verify.write.ts.
47
- const scopedDb = createTenantDb(ctx.db.unsafeRaw(), tenantId, "system");
47
+ const scopedDb = createTenantDb({ db: ctx.db.unsafeRaw(), tenantId, mode: "system" });
48
48
  const scopedUser = { id: userId, tenantId, roles: ["User"] };
49
49
  const existing = await findUserMfaRow(scopedDb, scopedUser);
50
50
  if (existing)
@@ -22,9 +22,8 @@
22
22
  // (the very risk this job's plan entry called out: a rebuild resurrecting
23
23
  // an old-KEK wrap would happen if rotation only touched the read-side
24
24
  // projection instead of appending a real `.updated` event).
25
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
26
25
  import { collectPiiSubjectFields, configuredPiiSubjectKms, decryptPiiFieldValues, } from "@cosmicdrift/kumiko-framework/crypto";
27
- import { configuredEntityFieldEncryption, createEventStoreExecutor, createTenantDb, } from "@cosmicdrift/kumiko-framework/db";
26
+ import { configuredEntityFieldEncryption, createEventStoreExecutor, createTenantDb, selectMany, } from "@cosmicdrift/kumiko-framework/db";
28
27
  import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
29
28
  import { classifyStoredEnvelope, runChunkedMigration, } from "../../shared/index.js";
30
29
  import { userMfaEntity, userMfaTable } from "../schema/user-mfa.js";
@@ -66,7 +65,7 @@ export async function mfaReencryptJob(rawPayload, ctx, db) {
66
65
  function tdbFor(tenantId) {
67
66
  let existing = tdbCache.get(tenantId);
68
67
  if (!existing) {
69
- existing = createTenantDb(db, tenantId, "system");
68
+ existing = createTenantDb({ db, tenantId, mode: "system" });
70
69
  tdbCache.set(tenantId, existing);
71
70
  }
72
71
  return existing;
@@ -1,4 +1,4 @@
1
- import { fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
1
+ import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
2
2
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
3
3
  import * as z from "zod";
4
4
  import { userMfaTable } from "../schema/user-mfa.js";
@@ -69,7 +69,7 @@ export function createMfaVerifyHandler(opts) {
69
69
  // "system" mode: this handler runs with a guest identity whose own
70
70
  // tenantId is meaningless here — the challenge token is the source
71
71
  // of truth for which tenant's row to read.
72
- const scopedDb = createTenantDb(ctx.db.unsafeRaw(), tenantId, "system");
72
+ const scopedDb = createTenantDb({ db: ctx.db.unsafeRaw(), tenantId, mode: "system" });
73
73
  const scopedUser = { id: userId, tenantId, roles: ["User"] };
74
74
  const row = await findUserMfaRow(scopedDb, scopedUser);
75
75
  // MFA got disabled between login and verify (race, or a stale
@@ -14,7 +14,7 @@ export function createMfaCodeVerifier() {
14
14
  declareEscapeHatch({
15
15
  reason: "reads the MFA enrollment of the user being re-authenticated on the caller's handler context; the calling handler declares its own escapeHatch",
16
16
  });
17
- const scopedDb = createTenantDb(ctx.db.unsafeRaw(), tenantId, "system");
17
+ const scopedDb = createTenantDb({ db: ctx.db.unsafeRaw(), tenantId, mode: "system" });
18
18
  const row = await findUserMfaRow(scopedDb, { id: userId, tenantId, roles: [] });
19
19
  if (!row)
20
20
  return { enrolled: false, ok: false };
@@ -10,7 +10,7 @@ export function createMfaStatusChecker(opts) {
10
10
  declareEscapeHatch({
11
11
  reason: "reads the MFA enrollment of the tenant named in the signed login/setup token, not the guest dispatch tenant, on the caller's handler context; the calling handler declares its own escapeHatch",
12
12
  });
13
- const scopedDb = createTenantDb(ctx.db.unsafeRaw(), tenantId, "system");
13
+ const scopedDb = createTenantDb({ db: ctx.db.unsafeRaw(), tenantId, mode: "system" });
14
14
  const scopedUser = { id: userId, tenantId, roles: ["User"] };
15
15
  const row = await findUserMfaRow(scopedDb, scopedUser);
16
16
  if (row) {
@@ -1,3 +1,7 @@
1
+ export declare function createAuthMfaUserDataFeature(): import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
2
+ readonly exports: void;
3
+ };
4
+ /** @deprecated Use createAuthMfaUserDataFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
1
5
  export declare const authMfaUserDataFeature: import("@cosmicdrift/kumiko-types/feature").FeatureDefinition & {
2
6
  readonly exports: void;
3
7
  };
@@ -6,12 +6,16 @@
6
6
  // Mirrors folders-user-data.
7
7
  import { defineFeature, EXT_USER_DATA } from "@cosmicdrift/kumiko-framework/engine";
8
8
  import { userMfaDeleteHook, userMfaExportHook } from "./hooks.js";
9
- export const authMfaUserDataFeature = defineFeature("auth-mfa-user-data", (r) => {
10
- r.describe("GDPR (Art. 20 export / Art. 17 erasure) coverage for the `auth-mfa` feature's `user-mfa` entity. Mounts the EXT_USER_DATA export + delete hooks so 2FA enrollment status is included in the user-data export bundle and a user's TOTP secret + recovery codes are hard-deleted (via executor.forget, rebuild-safe) on a data-subject erasure request. Kept separate from `auth-mfa` so consumers without the user-data-rights pipeline don't pull a hard dependency — requires `user-data-rights`, optionalRequires `auth-mfa`.");
11
- r.requires({ features: ["user-data-rights"] });
12
- r.optionalRequires("auth-mfa");
13
- r.useExtension(EXT_USER_DATA, "user-mfa", {
14
- export: userMfaExportHook,
15
- delete: userMfaDeleteHook,
16
- });
17
- });
9
+ export function createAuthMfaUserDataFeature() {
10
+ return defineFeature("auth-mfa-user-data", (r) => {
11
+ r.describe("GDPR (Art. 20 export / Art. 17 erasure) coverage for the `auth-mfa` feature's `user-mfa` entity. Mounts the EXT_USER_DATA export + delete hooks so 2FA enrollment status is included in the user-data export bundle and a user's TOTP secret + recovery codes are hard-deleted (via executor.forget, rebuild-safe) on a data-subject erasure request. Kept separate from `auth-mfa` so consumers without the user-data-rights pipeline don't pull a hard dependency — requires `user-data-rights`, optionalRequires `auth-mfa`.");
12
+ r.requires({ features: ["user-data-rights"] });
13
+ r.optionalRequires("auth-mfa");
14
+ r.useExtension(EXT_USER_DATA, "user-mfa", {
15
+ export: userMfaExportHook,
16
+ delete: userMfaDeleteHook,
17
+ });
18
+ }, { dedupeOptions: {} });
19
+ }
20
+ /** @deprecated Use createAuthMfaUserDataFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
21
+ export const authMfaUserDataFeature = createAuthMfaUserDataFeature();
@@ -5,7 +5,7 @@
5
5
  // off the app's extraContext.
6
6
  //
7
7
  // Deliberately does NOT call defineQueryHandler itself: apps use different
8
- // wrappers around it (publicstatus's `@app/define`, which adds
8
+ // wrappers around it (publicstatus's own wrapper, which adds
9
9
  // `agent: { expose: false }`; show-pony's plain framework
10
10
  // `defineQueryHandler`). Calling defineQueryHandler here would bypass
11
11
  // whatever an app's own wrapper does. Instead this factory returns just the
@@ -1,4 +1,5 @@
1
1
  import { type FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import type { BillingFoundationOptions } from "./types.js";
3
3
  export declare function createBillingFoundationFeature<TTier extends string = string>(options?: BillingFoundationOptions<TTier>): FeatureDefinition;
4
+ /** @deprecated Use createBillingFoundationFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
4
5
  export declare const billingFoundationFeature: FeatureDefinition;
@@ -111,7 +111,9 @@ export function createBillingFoundationFeature(options = {}) {
111
111
  r.defineEvent(SUBSCRIPTION_CANCELED_EVENT_SHORT, subscriptionEventPayloadSchema, {
112
112
  piiFields: "none",
113
113
  });
114
- r.defineEvent(INVOICE_PAID_EVENT_SHORT, subscriptionEventPayloadSchema, { piiFields: "none" });
114
+ r.defineEvent(INVOICE_PAID_EVENT_SHORT, subscriptionEventPayloadSchema, {
115
+ piiFields: "none",
116
+ });
115
117
  r.defineEvent(INVOICE_PAYMENT_FAILED_EVENT_SHORT, subscriptionEventPayloadSchema, {
116
118
  piiFields: "none",
117
119
  });
@@ -215,10 +217,7 @@ export function createBillingFoundationFeature(options = {}) {
215
217
  destroy: paymentTenantDestroyHook,
216
218
  escapeHatch: { reason: PAYMENT_TENANT_DESTROY_ARCHIVE_REASON },
217
219
  });
218
- });
220
+ }, Object.keys(options).length === 0 ? { dedupeOptions: {} } : undefined);
219
221
  }
220
- // Back-compat: existing consumers importing the plain const keep working
221
- // unchanged (no baseUrl/catalog — create-checkout-session's redirect-origin
222
- // check then rejects every call as UnconfiguredError, matching the
223
- // changes.json migration note).
222
+ /** @deprecated Use createBillingFoundationFeature(). Run `bun kumiko-upgrade --apply`. Removed in the first release after 2026-10-29. */
224
223
  export const billingFoundationFeature = createBillingFoundationFeature();
@@ -12,8 +12,8 @@
12
12
  // **returnUrl:** computed server-side via `portalReturnUrl` (catalog's
13
13
  // returnPath, or baseUrl itself) — the client no longer supplies one, so
14
14
  // there is no client-controlled redirect to harden against.
15
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
16
15
  import { configuredPiiSubjectKms, decryptPiiFieldValues, } from "@cosmicdrift/kumiko-framework/crypto";
16
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
17
17
  import * as z from "zod";
18
18
  import { subscriptionAggregateId } from "../aggregate-id.js";
19
19
  import { portalReturnUrl, resolveProviderPlugin } from "../checkout-core.js";
@@ -13,8 +13,7 @@
13
13
  // foundation production mounten müssen die Tabelle in ihre eigene
14
14
  // `drizzle/generate.ts` ergänzen (= via subscriptionsProjectionTable-
15
15
  // import). setupTestStack pusht sie automatisch via r.projection.table.
16
- import { insertOnConflictDoNothing, requireEntityTableMeta, upsertOnConflict, } from "@cosmicdrift/kumiko-framework/bun-db";
17
- import { buildEntityTable } from "@cosmicdrift/kumiko-framework/db";
16
+ import { buildEntityTable, insertOnConflictDoNothing, requireEntityTableMeta, upsertOnConflict, } from "@cosmicdrift/kumiko-framework/db";
18
17
  import { defineApply } from "@cosmicdrift/kumiko-framework/engine";
19
18
  import { paymentRowId } from "./aggregate-id.js";
20
19
  import { paymentEntity, subscriptionEntity } from "./entities.js";
@@ -8,6 +8,7 @@ export type CalendarCapUsageReservationSpec = Omit<CalendarCapDef, "amount" | "n
8
8
  readonly outsideTransaction?: boolean;
9
9
  };
10
10
  export type CalendarCapUsageReservation = {
11
+ readonly reservationId: string;
11
12
  readonly amount: number;
12
13
  readonly counterValue: number;
13
14
  settle(actualAmount: number): Promise<void>;
@@ -15,3 +16,9 @@ export type CalendarCapUsageReservation = {
15
16
  };
16
17
  export declare function reserveEnforcedCalendarCap(ctx: CapCounterContext, cap: CalendarCapUsageReservationSpec): Promise<CalendarCapReservation>;
17
18
  export declare function reserveCalendarCapUsage(ctx: CapCounterContext, spec: CalendarCapUsageReservationSpec): Promise<CalendarCapUsageReservation>;
19
+ export type CalendarCapReservationHandleSpec = Pick<CalendarCapUsageReservationSpec, "capName" | "periodStartIso" | "outsideTransaction">;
20
+ export type CalendarCapReservationHandle = {
21
+ consume(units: number): Promise<void>;
22
+ release(): Promise<void>;
23
+ };
24
+ export declare function calendarCapReservationHandle(ctx: CapCounterContext, reservationId: string, spec: CalendarCapReservationHandleSpec): CalendarCapReservationHandle;
@@ -1,4 +1,4 @@
1
- import { releaseExpiredCapReservations, reserveCalendarCap, settleCalendarCapReservation, } from "./cap-reservation.js";
1
+ import { consumeCalendarCapReservation, releaseCapReservation, releaseExpiredCapReservations, reserveCalendarCap, settleCalendarCapReservation, } from "./cap-reservation.js";
2
2
  import { assertBelowHardCap, enforceCapAndMaybeNotify, } from "./enforce-cap.js";
3
3
  // Shared by withCapEnforcement and the public reservation API so both enforce identically.
4
4
  export async function reserveEnforcedCalendarCap(ctx, cap) {
@@ -29,6 +29,7 @@ export async function reserveCalendarCapUsage(ctx, spec) {
29
29
  const reservation = await reserveEnforcedCalendarCap(ctx, spec);
30
30
  let state = "open";
31
31
  return {
32
+ reservationId: reservation.reservationId,
32
33
  amount: spec.amount,
33
34
  counterValue: reservation.counterValue,
34
35
  async settle(actualAmount) {
@@ -37,7 +38,11 @@ export async function reserveCalendarCapUsage(ctx, spec) {
37
38
  }
38
39
  state = "settled";
39
40
  try {
40
- await settleCalendarCapReservation(ctx, reservation.reservationId, { capName: spec.capName, periodStartIso: spec.periodStartIso, actualAmount }, outsideTransaction);
41
+ await settleCalendarCapReservation(ctx, reservation.reservationId, {
42
+ capName: spec.capName,
43
+ periodStartIso: spec.periodStartIso,
44
+ actualAmount,
45
+ }, outsideTransaction);
41
46
  }
42
47
  catch (error) {
43
48
  state = "open";
@@ -53,3 +58,24 @@ export async function reserveCalendarCapUsage(ctx, spec) {
53
58
  },
54
59
  };
55
60
  }
61
+ // Addresses a reservation by id so a job can consume it per unit; capName and period are needed
62
+ // because the row may already be swept, in which case consume books the units directly.
63
+ export function calendarCapReservationHandle(ctx, reservationId, spec) {
64
+ const outsideTransaction = spec.outsideTransaction ?? true;
65
+ let released = false;
66
+ return {
67
+ async consume(units) {
68
+ if (released) {
69
+ throw new Error(`cap-counter: reservation for "${spec.capName}" is already released`);
70
+ }
71
+ await consumeCalendarCapReservation(ctx, reservationId, { capName: spec.capName, periodStartIso: spec.periodStartIso, units }, outsideTransaction);
72
+ },
73
+ async release() {
74
+ // skip: release is idempotent, a second call has nothing left to give back
75
+ if (released)
76
+ return;
77
+ await releaseCapReservation(ctx, reservationId, outsideTransaction);
78
+ released = true;
79
+ },
80
+ };
81
+ }
@@ -1,3 +1,4 @@
1
+ import { UnprocessableError } from "@cosmicdrift/kumiko-framework/errors";
1
2
  import type { ReservationHandle } from "@cosmicdrift/kumiko-types/handlers";
2
3
  import { type BookCapUsageOptions, type CapCounterContext, type ReadRollingCapUsageOptions } from "./book-cap-usage.js";
3
4
  export type CalendarCapReservation = ReservationHandle & {
@@ -17,5 +18,20 @@ export type SettleCalendarCapOptions = {
17
18
  readonly periodStartIso: string;
18
19
  readonly actualAmount: number;
19
20
  };
21
+ export declare class CapSettleBelowConsumedError extends UnprocessableError {
22
+ constructor(capName: string, consumed: number, actualAmount: number);
23
+ }
24
+ export declare class CapReservationSettledError extends UnprocessableError {
25
+ constructor(capName: string);
26
+ }
20
27
  export declare function settleCalendarCapReservation(ctx: CapCounterContext, id: string, options: SettleCalendarCapOptions, outsideTransaction?: boolean): Promise<void>;
28
+ export type ConsumeCalendarCapOptions = {
29
+ readonly capName: string;
30
+ readonly periodStartIso: string;
31
+ readonly units: number;
32
+ };
33
+ export declare class CapReservationOverConsumedError extends UnprocessableError {
34
+ constructor(capName: string, remaining: number, requested: number);
35
+ }
36
+ export declare function consumeCalendarCapReservation(ctx: CapCounterContext, id: string, options: ConsumeCalendarCapOptions, outsideTransaction?: boolean): Promise<void>;
21
37
  export declare function releaseExpiredCapReservations(ctx: CapCounterContext, capName: string, outsideTransaction?: boolean): Promise<void>;