@cosmicdrift/kumiko-framework 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 (463) hide show
  1. package/AGENTS.md +5 -2
  2. package/agents/api/framework-db.md +14 -3
  3. package/agents/api/framework-engine.md +63 -13
  4. package/agents/api/framework-event-store.md +14 -0
  5. package/agents/api/framework-ui-types.md +149 -21
  6. package/agents/api/renderer-web.md +93 -9
  7. package/agents/api/testing-helpers.md +3 -2
  8. package/agents/api/testing-stack.md +3 -0
  9. package/agents/api/types.md +205 -14
  10. package/agents/api.md +7 -7
  11. package/agents/boot-rules.md +63 -9
  12. package/agents/examples/api-docs.md +2 -6
  13. package/agents/examples/auth-mfa.md +57 -10
  14. package/agents/examples/chat-channels.md +2 -0
  15. package/agents/examples/currencies-global.md +1 -0
  16. package/agents/examples/env-composition.md +7 -11
  17. package/agents/examples/managed-pages.md +90 -1
  18. package/agents/examples/pwa-shell.md +210 -0
  19. package/agents/examples/rate-limiting.md +3 -3
  20. package/agents/examples/record-detail-layout.md +1537 -67
  21. package/agents/examples/workflow-engine.md +16 -12
  22. package/agents/examples.md +1 -0
  23. package/agents/features-index.md +4 -2
  24. package/agents/features.md +22 -7
  25. package/agents/widgets.md +19 -1
  26. package/dist/api/api-constants.d.ts +1 -0
  27. package/dist/api/api-constants.js +4 -0
  28. package/dist/api/auth-middleware.js +4 -3
  29. package/dist/api/auth-routes-shared.js +2 -1
  30. package/dist/api/entity-read-access.d.ts +1 -0
  31. package/dist/api/entity-read-access.js +18 -0
  32. package/dist/api/export/export-route.d.ts +6 -1
  33. package/dist/api/export/export-route.js +27 -1
  34. package/dist/api/export/export-rows.js +19 -3
  35. package/dist/api/routes.d.ts +2 -0
  36. package/dist/api/routes.js +9 -1
  37. package/dist/api/server-extra-routes.js +2 -1
  38. package/dist/api/server-feature-http-routes.d.ts +9 -0
  39. package/dist/api/server-feature-http-routes.js +109 -0
  40. package/dist/api/server-middleware.js +2 -19
  41. package/dist/api/server-pat-rate-limit-guard.d.ts +3 -0
  42. package/dist/api/server-pat-rate-limit-guard.js +19 -0
  43. package/dist/api/server-rate-limit-wiring.d.ts +10 -0
  44. package/dist/api/server-rate-limit-wiring.js +37 -0
  45. package/dist/api/server-routes.d.ts +4 -12
  46. package/dist/api/server-routes.js +12 -171
  47. package/dist/api/server-schema-route.d.ts +3 -0
  48. package/dist/api/server-schema-route.js +58 -0
  49. package/dist/api/server-wiring.js +2 -37
  50. package/dist/api/server.js +3 -1
  51. package/dist/compliance/override-schema.js +5 -5
  52. package/dist/compliance/sub-processors.js +10 -1
  53. package/dist/crypto/index.d.ts +1 -1
  54. package/dist/crypto/index.js +1 -1
  55. package/dist/crypto/pii-field-encryption.d.ts +2 -0
  56. package/dist/crypto/pii-field-encryption.js +16 -1
  57. package/dist/db/apply-entity-event.js +4 -0
  58. package/dist/db/bun-sql-connection-codes.d.ts +1 -0
  59. package/dist/db/bun-sql-connection-codes.js +7 -0
  60. package/dist/db/collect-table-metas.js +4 -1
  61. package/dist/db/config-seed.js +1 -1
  62. package/dist/db/derived-field-sql.js +15 -13
  63. package/dist/db/derived-related-sql.d.ts +2 -2
  64. package/dist/db/derived-related-sql.js +4 -2
  65. package/dist/db/dialect.d.ts +3 -0
  66. package/dist/db/dialect.js +1 -3
  67. package/dist/db/driver-row-coercion.js +2 -2
  68. package/dist/db/driver-value-preparation.js +1 -1
  69. package/dist/db/eagerload.js +15 -12
  70. package/dist/db/entity-table-meta.d.ts +2 -0
  71. package/dist/db/entity-table-meta.js +7 -0
  72. package/dist/db/event-store-executor-context.js +13 -8
  73. package/dist/db/event-store-executor-read-aggregate-currencies.js +2 -2
  74. package/dist/db/event-store-executor-read-aggregate.js +2 -2
  75. package/dist/db/event-store-executor-read-filter.d.ts +4 -0
  76. package/dist/db/event-store-executor-read-filter.js +28 -11
  77. package/dist/db/event-store-executor-read-search.d.ts +1 -0
  78. package/dist/db/event-store-executor-read-search.js +6 -6
  79. package/dist/db/event-store-executor-read-sort.js +3 -3
  80. package/dist/db/event-store-executor-read-where.js +14 -5
  81. package/dist/db/event-store-executor-read.js +7 -7
  82. package/dist/db/event-store-executor-write.js +50 -95
  83. package/dist/db/executor-managed-tables.js +4 -1
  84. package/dist/db/index.d.ts +4 -2
  85. package/dist/db/index.js +4 -2
  86. package/dist/db/known-table-names.d.ts +1 -0
  87. package/dist/db/known-table-names.js +7 -5
  88. package/dist/db/list-aggregate-labels.d.ts +1 -0
  89. package/dist/db/list-aggregate-labels.js +9 -1
  90. package/dist/db/migrate-generator.js +23 -4
  91. package/dist/db/migrate-rls-diff.d.ts +1 -0
  92. package/dist/db/migrate-rls-diff.js +15 -1
  93. package/dist/db/migrate-runner.js +2 -2
  94. package/dist/db/money.d.ts +1 -1
  95. package/dist/db/money.js +1 -4
  96. package/dist/db/parent-ref-clause.d.ts +6 -2
  97. package/dist/db/parent-ref-clause.js +76 -23
  98. package/dist/db/parent-ref-global-hosts.d.ts +20 -0
  99. package/dist/db/parent-ref-global-hosts.js +47 -0
  100. package/dist/db/production-schema-command-hint.d.ts +1 -0
  101. package/dist/db/production-schema-command-hint.js +3 -0
  102. package/dist/db/queries/backfill-pii.js +55 -29
  103. package/dist/db/queries/ddl.js +13 -2
  104. package/dist/db/queries/event-store-open-streams.d.ts +15 -0
  105. package/dist/db/queries/event-store-open-streams.js +33 -0
  106. package/dist/db/queries/event-store-payload-scrub.d.ts +5 -0
  107. package/dist/db/queries/event-store-payload-scrub.js +11 -0
  108. package/dist/db/queries/event-store.js +0 -1
  109. package/dist/db/queries/raw-sql.js +0 -1
  110. package/dist/db/queries/rebuild-rls-guard.d.ts +2 -1
  111. package/dist/db/queries/rebuild-rls-guard.js +24 -11
  112. package/dist/db/queries/rls-boot-catalog.d.ts +1 -0
  113. package/dist/db/queries/rls-boot-catalog.js +13 -8
  114. package/dist/db/queries/rls-shape.d.ts +2 -1
  115. package/dist/db/queries/rls-shape.js +10 -0
  116. package/dist/db/queries/session-advisory-lock.js +2 -1
  117. package/dist/db/queries/test-stack.js +7 -7
  118. package/dist/db/query.js +16 -11
  119. package/dist/db/rebuild-marker.js +11 -2
  120. package/dist/db/render-rls-ddl.d.ts +2 -0
  121. package/dist/db/render-rls-ddl.js +16 -11
  122. package/dist/db/replay-migration-sql.js +1 -1
  123. package/dist/db/row-level-security-boot-check.js +18 -5
  124. package/dist/db/row-level-security-connection.js +25 -12
  125. package/dist/db/row-level-security-scope.d.ts +2 -1
  126. package/dist/db/row-level-security-scope.js +9 -5
  127. package/dist/db/sql-identifier.d.ts +1 -0
  128. package/dist/db/sql-identifier.js +3 -0
  129. package/dist/db/system-tenant-read-db.d.ts +5 -0
  130. package/dist/db/system-tenant-read-db.js +28 -0
  131. package/dist/db/table-builder.d.ts +3 -1
  132. package/dist/db/table-builder.js +18 -8
  133. package/dist/db/table-info.d.ts +1 -2
  134. package/dist/db/table-introspection.d.ts +3 -0
  135. package/dist/db/table-introspection.js +6 -0
  136. package/dist/db/table-push.d.ts +1 -0
  137. package/dist/db/table-push.js +7 -1
  138. package/dist/db/tenant-db-runner.d.ts +3 -0
  139. package/dist/db/tenant-db-runner.js +19 -1
  140. package/dist/db/transaction-serialization.d.ts +1 -0
  141. package/dist/db/transaction-serialization.js +20 -3
  142. package/dist/db/where-clause.js +11 -2
  143. package/dist/db/write-ownership-failures.d.ts +25 -0
  144. package/dist/db/write-ownership-failures.js +82 -0
  145. package/dist/engine/boot-validator/boot-check.js +7 -1
  146. package/dist/engine/boot-validator/boot-phases-app.js +5 -5
  147. package/dist/engine/boot-validator/boot-phases.js +3 -2
  148. package/dist/engine/boot-validator/boot-rules.d.ts +293 -26
  149. package/dist/engine/boot-validator/boot-rules.js +4 -0
  150. package/dist/engine/boot-validator/bundled-lists-table.js +2 -2
  151. package/dist/engine/boot-validator/card-meta-overflow.js +1 -0
  152. package/dist/engine/boot-validator/config-deps.d.ts +0 -1
  153. package/dist/engine/boot-validator/config-deps.js +0 -28
  154. package/dist/engine/boot-validator/config-key-rules.d.ts +0 -15
  155. package/dist/engine/boot-validator/config-key-rules.js +0 -15
  156. package/dist/engine/boot-validator/dashboard-screen-target.d.ts +22 -0
  157. package/dist/engine/boot-validator/dashboard-screen-target.js +20 -0
  158. package/dist/engine/boot-validator/dashboard-stat-navigate.d.ts +1 -0
  159. package/dist/engine/boot-validator/dashboard-stat-navigate.js +25 -17
  160. package/dist/engine/boot-validator/definition-webhook-events-rules.d.ts +5 -0
  161. package/dist/engine/boot-validator/definition-webhook-events-rules.js +5 -0
  162. package/dist/engine/boot-validator/derived-sql-fields.js +1 -2
  163. package/dist/engine/boot-validator/entity-declaration-rules.d.ts +5 -0
  164. package/dist/engine/boot-validator/entity-declaration-rules.js +5 -0
  165. package/dist/engine/boot-validator/entity-list-screens.d.ts +1 -0
  166. package/dist/engine/boot-validator/entity-list-screens.js +33 -6
  167. package/dist/engine/boot-validator/entity-structure-rules.d.ts +5 -0
  168. package/dist/engine/boot-validator/entity-structure-rules.js +5 -0
  169. package/dist/engine/boot-validator/list-column-layout.js +10 -6
  170. package/dist/engine/boot-validator/list-row-guidance-rules.d.ts +67 -0
  171. package/dist/engine/boot-validator/list-row-guidance-rules.js +67 -0
  172. package/dist/engine/boot-validator/list-row-guidance.d.ts +20 -0
  173. package/dist/engine/boot-validator/list-row-guidance.js +129 -0
  174. package/dist/engine/boot-validator/list-sort-summary-rules.d.ts +42 -0
  175. package/dist/engine/boot-validator/list-sort-summary-rules.js +42 -0
  176. package/dist/engine/boot-validator/list-sort-summary.d.ts +5 -0
  177. package/dist/engine/boot-validator/list-sort-summary.js +149 -0
  178. package/dist/engine/boot-validator/list-table-options.js +15 -1
  179. package/dist/engine/boot-validator/list-table-rules.d.ts +10 -5
  180. package/dist/engine/boot-validator/list-table-rules.js +10 -5
  181. package/dist/engine/boot-validator/list-toolbar-options.d.ts +10 -0
  182. package/dist/engine/boot-validator/list-toolbar-options.js +31 -0
  183. package/dist/engine/boot-validator/named-filter-rules.d.ts +32 -2
  184. package/dist/engine/boot-validator/named-filter-rules.js +32 -2
  185. package/dist/engine/boot-validator/ownership.js +10 -1
  186. package/dist/engine/boot-validator/parent-ref.js +87 -50
  187. package/dist/engine/boot-validator/projection-list-screens.d.ts +1 -0
  188. package/dist/engine/boot-validator/projection-list-screens.js +31 -1
  189. package/dist/engine/boot-validator/query-output-columns.js +62 -9
  190. package/dist/engine/boot-validator/query-output-guidance.d.ts +7 -0
  191. package/dist/engine/boot-validator/query-output-guidance.js +39 -0
  192. package/dist/engine/boot-validator/query-refs.js +24 -1
  193. package/dist/engine/boot-validator/row-decoration.d.ts +11 -0
  194. package/dist/engine/boot-validator/row-decoration.js +16 -0
  195. package/dist/engine/boot-validator/screens-dashboard-links.d.ts +10 -0
  196. package/dist/engine/boot-validator/screens-dashboard-links.js +36 -0
  197. package/dist/engine/boot-validator/screens-dashboard-narrow.d.ts +4 -0
  198. package/dist/engine/boot-validator/screens-dashboard-narrow.js +211 -0
  199. package/dist/engine/boot-validator/screens-dashboard-rules.d.ts +84 -4
  200. package/dist/engine/boot-validator/screens-dashboard-rules.js +84 -4
  201. package/dist/engine/boot-validator/screens-dashboard.js +29 -7
  202. package/dist/engine/boot-validator/screens-kind-entity-list.js +32 -27
  203. package/dist/engine/boot-validator/screens-kind-projection-detail-guidance.d.ts +3 -0
  204. package/dist/engine/boot-validator/screens-kind-projection-detail-guidance.js +46 -0
  205. package/dist/engine/boot-validator/screens-kind-projection-detail-rules.d.ts +20 -0
  206. package/dist/engine/boot-validator/screens-kind-projection-detail-rules.js +20 -0
  207. package/dist/engine/boot-validator/screens-kind-projection-detail.js +2 -0
  208. package/dist/engine/boot-validator/screens-kind-projection-list.js +4 -0
  209. package/dist/engine/boot-validator/screens-kind-rules.d.ts +25 -0
  210. package/dist/engine/boot-validator/screens-kind-rules.js +25 -0
  211. package/dist/engine/boot-validator/screens-lists.d.ts +8 -2
  212. package/dist/engine/boot-validator/screens-lists.js +19 -3
  213. package/dist/engine/boot-validator/screens.js +1 -1
  214. package/dist/engine/boot-validator/sort-nulls.d.ts +2 -0
  215. package/dist/engine/boot-validator/sort-nulls.js +15 -0
  216. package/dist/engine/boot-validator/zod-shape.d.ts +2 -1
  217. package/dist/engine/boot-validator/zod-shape.js +19 -1
  218. package/dist/engine/build-app-schema.js +4 -0
  219. package/dist/engine/config-helpers.d.ts +1 -2
  220. package/dist/engine/config-helpers.js +6 -7
  221. package/dist/engine/define-feature.js +1 -0
  222. package/dist/engine/define-handler.d.ts +1 -0
  223. package/dist/engine/define-handler.js +4 -2
  224. package/dist/engine/definition-violations.js +2 -2
  225. package/dist/engine/entity-handlers.js +3 -8
  226. package/dist/engine/entity-list-runtime-options.js +9 -8
  227. package/dist/engine/factories.d.ts +2 -0
  228. package/dist/engine/feature-config-events-jobs.js +1 -0
  229. package/dist/engine/feature-entity-handlers.js +5 -2
  230. package/dist/engine/field-access.d.ts +1 -1
  231. package/dist/engine/field-access.js +7 -10
  232. package/dist/engine/find-entity.js +3 -3
  233. package/dist/engine/form-derivations.js +3 -3
  234. package/dist/engine/index.d.ts +3 -3
  235. package/dist/engine/index.js +2 -2
  236. package/dist/engine/named-filter-roles.d.ts +3 -0
  237. package/dist/engine/named-filter-roles.js +23 -0
  238. package/dist/engine/pipeline.js +0 -1
  239. package/dist/engine/project-app-schema-for-roles.js +17 -2
  240. package/dist/engine/qualified-name.js +0 -1
  241. package/dist/engine/registry-facade.js +1 -2
  242. package/dist/engine/registry-state.d.ts +1 -1
  243. package/dist/engine/registry-state.js +5 -2
  244. package/dist/engine/registry-validate.js +2 -1
  245. package/dist/engine/resolve-named-list-filters.js +5 -2
  246. package/dist/engine/schema-builder.js +6 -10
  247. package/dist/engine/screen-helpers.d.ts +12 -0
  248. package/dist/engine/screen-helpers.js +17 -1
  249. package/dist/engine/soft-delete-cleanup.js +1 -5
  250. package/dist/engine/state-machine.js +0 -1
  251. package/dist/engine/steps/_database-clock.d.ts +2 -0
  252. package/dist/engine/steps/_database-clock.js +6 -0
  253. package/dist/engine/steps/compute.js +1 -1
  254. package/dist/engine/steps/retry.js +5 -1
  255. package/dist/engine/steps/return.js +0 -1
  256. package/dist/engine/steps/wait-for-event.js +2 -1
  257. package/dist/engine/steps/wait.js +2 -1
  258. package/dist/engine/system-user.d.ts +2 -2
  259. package/dist/engine/system-user.js +2 -2
  260. package/dist/engine/types/handlers.d.ts +1 -1
  261. package/dist/engine/types/handlers.js +1 -1
  262. package/dist/engine/types/screen.d.ts +1 -1
  263. package/dist/engine/types/screen.js +1 -1
  264. package/dist/engine/webhook-contracts.d.ts +2 -3
  265. package/dist/engine/webhook-contracts.js +2 -25
  266. package/dist/engine/webhook-events.js +48 -29
  267. package/dist/engine/webhook-payload-strictness.d.ts +7 -0
  268. package/dist/engine/webhook-payload-strictness.js +53 -0
  269. package/dist/env/_zod-introspect.d.ts +1 -0
  270. package/dist/env/dry-run.d.ts +1 -1
  271. package/dist/env/dry-run.js +1 -1
  272. package/dist/env/field-meta.d.ts +4 -0
  273. package/dist/env/field-meta.js +67 -0
  274. package/dist/env/field-rules.d.ts +9 -0
  275. package/dist/env/field-rules.js +46 -0
  276. package/dist/env/index.d.ts +3 -3
  277. package/dist/env/index.js +16 -71
  278. package/dist/env/internals.d.ts +3 -0
  279. package/dist/env/internals.js +1 -2
  280. package/dist/env/required-env.d.ts +3 -1
  281. package/dist/env/required-env.js +5 -2
  282. package/dist/errors/serialize.js +2 -2
  283. package/dist/errors/write-error-info.js +0 -2
  284. package/dist/es-ops/operations-schema.js +18 -7
  285. package/dist/event-store/admin-api.js +3 -3
  286. package/dist/event-store/event-store.js +0 -3
  287. package/dist/event-store/index.d.ts +1 -0
  288. package/dist/event-store/index.js +1 -0
  289. package/dist/event-store/transfer.js +1 -1
  290. package/dist/files/assert-file-refs-belong-to-tenant.d.ts +2 -1
  291. package/dist/files/assert-file-refs-belong-to-tenant.js +15 -13
  292. package/dist/files/bind-pending-file-refs.d.ts +3 -1
  293. package/dist/files/bind-pending-file-refs.js +54 -27
  294. package/dist/files/copy-pending-file-refs-to-tenant.js +7 -3
  295. package/dist/files/create-file-ref.d.ts +4 -1
  296. package/dist/files/create-file-ref.js +14 -3
  297. package/dist/files/default-file-guard.js +4 -1
  298. package/dist/files/file-claim.d.ts +6 -0
  299. package/dist/files/file-claim.js +17 -0
  300. package/dist/files/file-field-slots.d.ts +2 -0
  301. package/dist/files/file-field-slots.js +28 -0
  302. package/dist/files/file-ref-entity.d.ts +3 -0
  303. package/dist/files/file-ref-entity.js +2 -0
  304. package/dist/files/file-ref-table.d.ts +3 -0
  305. package/dist/files/file-routes.d.ts +4 -1
  306. package/dist/files/file-routes.js +80 -16
  307. package/dist/files/in-memory-provider.d.ts +1 -1
  308. package/dist/files/in-memory-provider.js +2 -1
  309. package/dist/files/index.d.ts +1 -1
  310. package/dist/files/index.js +1 -1
  311. package/dist/files/invalid-file-ref-error.d.ts +2 -0
  312. package/dist/files/invalid-file-ref-error.js +15 -0
  313. package/dist/files/local-provider.js +9 -2
  314. package/dist/files/provider-resolver.js +1 -1
  315. package/dist/files/rebind-file-ref.d.ts +3 -2
  316. package/dist/files/rebind-file-ref.js +24 -18
  317. package/dist/files/resolve-file-handles.d.ts +13 -0
  318. package/dist/files/resolve-file-handles.js +57 -0
  319. package/dist/files/storage-tracking.d.ts +1 -1
  320. package/dist/files/storage-tracking.js +5 -2
  321. package/dist/files/sweep-stale-pending-file-refs.js +10 -4
  322. package/dist/files/types.d.ts +4 -0
  323. package/dist/files/types.js +10 -0
  324. package/dist/files/upload-field-resolution.d.ts +1 -0
  325. package/dist/files/upload-field-resolution.js +16 -2
  326. package/dist/files/upload-ledger.js +1 -1
  327. package/dist/i18n/required-surface-guidance-keys.d.ts +3 -0
  328. package/dist/i18n/required-surface-guidance-keys.js +9 -0
  329. package/dist/i18n/required-surface-keys.js +19 -4
  330. package/dist/internal/boot-rule-table-expectations.d.ts +2 -0
  331. package/dist/internal/boot-rule-table-expectations.js +29 -0
  332. package/dist/internal/row-level-security.d.ts +1 -0
  333. package/dist/internal/row-level-security.js +1 -0
  334. package/dist/internal/testing.d.ts +1 -0
  335. package/dist/internal/testing.js +1 -0
  336. package/dist/jobs/index.d.ts +1 -0
  337. package/dist/jobs/index.js +1 -0
  338. package/dist/jobs/job-load-events.d.ts +10 -0
  339. package/dist/jobs/job-load-events.js +12 -0
  340. package/dist/jobs/job-runner-context.js +6 -158
  341. package/dist/jobs/job-runner-dispatch.d.ts +7 -0
  342. package/dist/jobs/job-runner-dispatch.js +57 -0
  343. package/dist/jobs/job-runner-event-triggers.js +18 -9
  344. package/dist/jobs/job-runner-execution.js +2 -2
  345. package/dist/jobs/job-runner-facets.d.ts +48 -0
  346. package/dist/jobs/job-runner-facets.js +156 -0
  347. package/dist/jobs/job-runner-gates.js +19 -11
  348. package/dist/jobs/job-runner-helpers.d.ts +5 -1
  349. package/dist/jobs/job-runner-helpers.js +18 -3
  350. package/dist/jobs/job-runner-scope.d.ts +1 -0
  351. package/dist/jobs/job-runner-scope.js +2 -0
  352. package/dist/jobs/job-runner-tenant-cap-lock.d.ts +2 -0
  353. package/dist/jobs/job-runner-tenant-cap-lock.js +30 -0
  354. package/dist/jobs/job-runner.js +31 -70
  355. package/dist/jobs/obliterate-job-queues.d.ts +6 -0
  356. package/dist/jobs/obliterate-job-queues.js +23 -0
  357. package/dist/lifecycle/lifecycle.js +1 -1
  358. package/dist/migrations/event-header-scrub.d.ts +11 -0
  359. package/dist/migrations/event-header-scrub.js +33 -0
  360. package/dist/migrations/event-payload-scrub.d.ts +1 -1
  361. package/dist/migrations/event-payload-scrub.js +36 -4
  362. package/dist/migrations/index.d.ts +1 -0
  363. package/dist/migrations/index.js +2 -0
  364. package/dist/migrations/kumiko-drift.d.ts +5 -2
  365. package/dist/migrations/kumiko-drift.js +51 -14
  366. package/dist/migrations/pending-rebuilds.js +4 -5
  367. package/dist/observability/sensitive-filter.js +0 -12
  368. package/dist/pipeline/aggregate-type-removal.js +17 -4
  369. package/dist/pipeline/context-services.d.ts +2 -0
  370. package/dist/pipeline/context-services.js +5 -2
  371. package/dist/pipeline/dispatch-batch.js +4 -3
  372. package/dist/pipeline/dispatch-context-helpers.d.ts +11 -0
  373. package/dist/pipeline/dispatch-context-helpers.js +58 -0
  374. package/dist/pipeline/dispatch-nested-write.d.ts +7 -0
  375. package/dist/pipeline/dispatch-nested-write.js +119 -0
  376. package/dist/pipeline/dispatch-query.js +10 -3
  377. package/dist/pipeline/dispatch-scope.js +4 -3
  378. package/dist/pipeline/dispatch-shared.d.ts +2 -6
  379. package/dist/pipeline/dispatch-shared.js +6 -38
  380. package/dist/pipeline/dispatch-write.d.ts +0 -1
  381. package/dist/pipeline/dispatch-write.js +3 -302
  382. package/dist/pipeline/dispatcher-utils.js +6 -0
  383. package/dist/pipeline/effective-system-scope.d.ts +3 -0
  384. package/dist/pipeline/effective-system-scope.js +22 -0
  385. package/dist/pipeline/event-dispatcher-delivery.d.ts +1 -0
  386. package/dist/pipeline/event-dispatcher-delivery.js +17 -9
  387. package/dist/pipeline/event-dispatcher.d.ts +4 -1
  388. package/dist/pipeline/event-dispatcher.js +6 -7
  389. package/dist/pipeline/handler-context-auth.d.ts +3 -2
  390. package/dist/pipeline/handler-context-auth.js +3 -4
  391. package/dist/pipeline/handler-context-db.js +11 -4
  392. package/dist/pipeline/handler-context-dispatch.js +2 -2
  393. package/dist/pipeline/handler-context-events.d.ts +8 -3
  394. package/dist/pipeline/handler-context-events.js +20 -65
  395. package/dist/pipeline/handler-context-member-resolution.js +16 -8
  396. package/dist/pipeline/handler-context-notify.d.ts +1 -0
  397. package/dist/pipeline/handler-context-notify.js +2 -0
  398. package/dist/pipeline/handler-context-phase-denials.js +3 -2
  399. package/dist/pipeline/handler-context-projection.d.ts +3 -0
  400. package/dist/pipeline/handler-context-projection.js +39 -0
  401. package/dist/pipeline/handler-context-scope.d.ts +1 -1
  402. package/dist/pipeline/handler-context-scope.js +14 -2
  403. package/dist/pipeline/index.d.ts +1 -1
  404. package/dist/pipeline/index.js +1 -1
  405. package/dist/pipeline/lifecycle-pipeline.d.ts +1 -0
  406. package/dist/pipeline/lifecycle-pipeline.js +7 -4
  407. package/dist/pipeline/member-reader.js +4 -2
  408. package/dist/pipeline/msp-rebuild.js +1 -1
  409. package/dist/pipeline/nested-write-parent-guard.d.ts +5 -0
  410. package/dist/pipeline/nested-write-parent-guard.js +81 -0
  411. package/dist/pipeline/projection-rebuild.d.ts +2 -0
  412. package/dist/pipeline/projection-rebuild.js +16 -7
  413. package/dist/pipeline/projection-state.js +4 -6
  414. package/dist/pipeline/system-hooks.js +36 -6
  415. package/dist/pipeline/write-result-masking.js +31 -3
  416. package/dist/pipeline/write-transition-guard.d.ts +7 -0
  417. package/dist/pipeline/write-transition-guard.js +95 -0
  418. package/dist/schema-cli/shared.d.ts +2 -0
  419. package/dist/schema-cli/shared.js +4 -2
  420. package/dist/schema-cli/validate-command.js +43 -28
  421. package/dist/search/meilisearch-adapter.js +14 -9
  422. package/dist/search/reindex-entity.d.ts +2 -0
  423. package/dist/search/reindex-entity.js +32 -4
  424. package/dist/search/reindex-tenants-search.js +20 -4
  425. package/dist/time/tz-context.js +1 -1
  426. package/dist/ui-types/card-column-roles.d.ts +4 -0
  427. package/dist/ui-types/card-column-roles.js +6 -3
  428. package/dist/ui-types/index.d.ts +2 -2
  429. package/dist/ui-types/index.js +1 -1
  430. package/dist/utils/ids.js +0 -1
  431. package/dist/utils/index.d.ts +1 -0
  432. package/dist/utils/index.js +1 -0
  433. package/dist/utils/return-path-limit.d.ts +1 -0
  434. package/dist/utils/return-path-limit.js +1 -0
  435. package/package.json +5 -3
  436. package/presets/biome-app.json +39 -21
  437. package/presets/biome-plugins/admin-api.grit +10 -0
  438. package/presets/biome-plugins/error-reasons.grit +53 -0
  439. package/presets/biome-plugins/es-literal-writes-tests.grit +18 -0
  440. package/presets/biome-plugins/es-literal-writes.grit +22 -0
  441. package/presets/biome-plugins/i18n-locale-terminology-de.grit +15 -0
  442. package/presets/biome-plugins/i18n-locale-terminology-romance.grit +10 -0
  443. package/presets/biome-plugins/no-create-test-dispatcher.grit +5 -0
  444. package/presets/biome-plugins/no-css-properties-type.grit +7 -0
  445. package/presets/biome-plugins/no-date-api.grit +9 -0
  446. package/presets/biome-plugins/no-direct-fetch.grit +16 -0
  447. package/presets/biome-plugins/no-direct-fs.grit +16 -0
  448. package/presets/biome-plugins/no-external-font-cdn-css.grit +9 -0
  449. package/presets/biome-plugins/no-external-font-cdn.grit +12 -0
  450. package/presets/biome-plugins/no-raw-hooks.grit +10 -0
  451. package/presets/biome-plugins/no-same-folder-barrel-import.grit +11 -0
  452. package/presets/biome-plugins/no-screen-container-classes.grit +7 -0
  453. package/presets/biome-plugins/no-skipped-or-retried-tests.grit +34 -0
  454. package/presets/biome-plugins/no-temporal-polyfill-require.grit +10 -0
  455. package/presets/biome-plugins/raw-html-in-web.grit +40 -0
  456. package/presets/biome-plugins/raw-ui-in-app.grit +142 -0
  457. package/presets/biome-plugins/restricted-event-store-symbols.grit +18 -0
  458. package/presets/biome-plugins/test-title.grit +20 -0
  459. package/presets/biome-plugins/unsafe-json-parse.grit +6 -0
  460. package/presets/biome-rules.json +465 -0
  461. package/src/changes.json +309 -0
  462. package/dist/engine/minor-units.d.ts +0 -2
  463. package/dist/engine/minor-units.js +0 -8
package/AGENTS.md CHANGED
@@ -210,8 +210,11 @@ produces code that compiles and then fails in production.
210
210
  handler: `r.crud`, the `defineEntity*Handler` helpers, the executor from
211
211
  `createEntityExecutor`, or `emitEvent` / `ctx.events.append`. The query
212
212
  helpers and `ctx.db` throw `AccessDeniedError` on such a write, also
213
- through `ctx.db.unsafeRaw()`. Test seeds use `seedRow` / `deleteRows` from
214
- `@cosmicdrift/kumiko-testing`.
213
+ through `ctx.db.unsafeRaw()`. Test seeds on an entity table use
214
+ `seedRowViaEventStore` / `seedRowsViaEventStore` from
215
+ `@cosmicdrift/kumiko-testing/helpers`; `seedRow` is for tables without
216
+ event sourcing and throws on an entity table unless the test passes
217
+ `{ projectionOnly: "<why>" }`.
215
218
  - Never store a value that can be computed. Derive it in a query or a
216
219
  projection.
217
220
  - Never hand-write SQL for reads that an executor `list` or `detail` covers.
@@ -68,7 +68,7 @@ function entityTableFromRegistry(registry: Registry, entityName: string, entity:
68
68
  function enumerateFeatureTableSources(feature: FeatureDefinition): FeatureTableSource[];
69
69
  function executeRawQuery<T = Record<string, unknown>>(db: AnyDb, sqlText: string, params?: unknown[]): Promise<T[]>; // Escape hatch for caller-built SQL that may write (or lock).
70
70
  function extractPgError(e: unknown): PgErrorInfo | null;
71
- function extractTableInfo(table: TableLike): TableInfo;
71
+ function extractTableInfo(table: unknown): TableInfo;
72
72
  function extractTableName(table: unknown, context?): string; // Reads the `kumiko:schema:Name` symbol from a table object.
73
73
  function fetchOne<TRow = AnyRow>(db: AnyDb, table: TableLike, where: WhereObject): Promise<TRow | undefined>;
74
74
  function generateMigration(input: GenerateMigrationInput): GenerateMigrationOutput;
@@ -100,6 +100,7 @@ function insertOne<TRow = AnyRow>(db: ExecutorManagedWriteCapability, table: Ent
100
100
  function instant(name: string, opts?: { precision?: 0 | 1 | 2 | 3 | 4 | 5 | 6; }): ColumnBuilder<Temporal.Instant>;
101
101
  function instantToTimestamptzParam(instant: Temporal.Instant): string;
102
102
  function integer(name: string): ColumnBuilder<number>;
103
+ function isSchemaTable(value: unknown): value is SchemaTable; // True for tables built by table(): all three identity slots are present and well-formed.
103
104
  function isTimestamptzType(pgType: string | undefined): boolean;
104
105
  function isUndefinedTable(e: unknown): boolean;
105
106
  function isUniqueViolation(e: unknown): boolean;
@@ -108,9 +109,11 @@ function knownTablesOf(features: FeatureDefinition[]): KnownTables;
108
109
  function listEventTenantIds(db: AnyDb): Promise<string[]>;
109
110
  function loadSnapshotJson(path: string): Snapshot | null;
110
111
  function nullBlindIndexesForSubject(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, subjectKey: string): Promise<void>;
112
+ function outsideRowLevelSecurityScope<T>(fn: () => T): T;
111
113
  function outsideTransactionPoolOptionsFromEnv(env?: Readonly<Record<string, string | undefined>>): DbConnectionOptions;
112
- function physicalColumnName(table: unknown, field: string): string;
114
+ function physicalColumnName(table: SchemaTable, field: string): string;
113
115
  function primaryKey(opts: { columns: ColumnHandle[]; name?: string; }): PrimaryKeyDescriptor;
116
+ function queryDatabaseNow(runner: AnyDb): Promise<Date>;
114
117
  function readDatabaseNow(db: TenantDb): Promise<Date>; // Postgres clock; inside a transaction `now()` is the transaction start, so repeated reads agree.
115
118
  function recordEventsOwnedExclusivelyByTenant(db: DbRunner, aggregateType: string, aggregateId: string, tenantId: string): Promise<boolean>;
116
119
  function recordRowExistsInTenant(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, entityName: string, recordId: string, tenantId: string): Promise<boolean>;
@@ -137,6 +140,11 @@ function serial(name: string): ColumnBuilder<number>;
137
140
  function serverTimeoutOptionsFromEnv(env?: Readonly<Record<string, string | undefined>>): DbConnectionOptions;
138
141
  function sql(strings: TemplateStringsArray, ...values: unknown[]): SqlExpression;
139
142
  function subjectRowExistsInTenant(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, subjectId: string, tenantId: string): Promise<boolean>;
143
+ function table<TCols extends ColumnMap>(tableName: `read_${string}`, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): SchemaTable;
144
+ function table<TCols extends ColumnMap>(tableName: string, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): WritableSchemaTable;
145
+ function table<TCols extends ColumnMap>(tableName: `read_${string}`, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): SchemaTable;
146
+ function table<TCols extends ColumnMap>(tableName: string, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): WritableSchemaTable;
147
+ function table<TCols extends ColumnMap>(tableName: `read_${string}`, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): SchemaTable;
140
148
  function table<TCols extends ColumnMap>(tableName: string, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): WritableSchemaTable;
141
149
  function tableExists(db: DbConnection | DbTx, fullyQualifiedName: string): Promise<boolean>;
142
150
  function text(name: string): ColumnBuilder<string>;
@@ -172,6 +180,7 @@ function writeSnapshotJson(path: string, snapshot: Snapshot): void;
172
180
  ## Constants
173
181
 
174
182
  ```ts
183
+ const BUN_SQL_CONNECTION_ERROR_CODES: string[];
175
184
  const DEFAULT_OUTSIDE_TRANSACTION_POOL_MAX: 3;
176
185
  const ROW_LEVEL_SECURITY_MODES: ["off", "on"];
177
186
  const WritePurposes: { retention: "retention"; erasure: "erasure"; };
@@ -202,11 +211,12 @@ type EntityTableMeta = {
202
211
  source: "managed" | "unmanaged";
203
212
  piiSubjectFields?: string[];
204
213
  tenancy?: "global";
214
+ systemRowsReadable?: true;
205
215
  };
206
216
  type EventStoreExecutor<Row extends Record<string, unknown> = Record<string, unknown>> = {
207
217
  create: (payload: Record<string, unknown>, user: SessionUser, db: TenantDb, options?: StreamTenantOption & { preSave?: PreSaveRunner; }) => Promise<WriteResult<SaveContext>>;
208
218
  update: (payload: { id: EntityId; version?: number | undefined; changes: Record<string, unknown>; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & LockGuardOption & ParentVisibilityGateOption & { skipOptimisticLock?: boolean; ski…;
209
- delete: (payload: { id: EntityId; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & LockGuardOption & ParentVisibilityGateOption) => Promise<WriteResult<DeleteContext>>;
219
+ delete: (payload: { id: EntityId; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & LockGuardOption & ParentVisibilityGateOption & { expect?: Readonly<Record<string, string | number | boolean | null>>; }) => Promise<WriteResult<De…;
210
220
  forget: (payload: { id: EntityId; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & ParentVisibilityGateOption) => Promise<WriteResult<DeleteContext>>;
211
221
  restore: (payload: { id: EntityId; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & ParentVisibilityGateOption) => Promise<WriteResult<SaveContext>>;
212
222
  list: (payload: { cursor?: string | undefined; limit?: number | undefined; search?: string | undefined; sort?: string | undefined; sortDirection?: "asc" | "desc" | undefined; offset?: number | undefined; totalCount?: boolean | undefined; filter?…;
@@ -221,6 +231,7 @@ type JsonTextMatch = {
221
231
  };
222
232
  type KnownTables = {
223
233
  has: (tableName: string) => boolean;
234
+ readsSystemRows: (tableName: string) => boolean;
224
235
  };
225
236
  type MoneyRead = { // Shape of a single rehydrated money field — {amount major, currency, amountScaled exact integer value in MINOR_UNIT_SCALE units}.
226
237
  amount: number;
@@ -35,7 +35,7 @@ function createDecimalField<R extends true | false = false>(config: { precision:
35
35
  function createDerivedField(spec: DerivedFieldDef): DerivedFieldDef; // Read-time computed field for `EntityDefinition.derivedFields` (NOT `fields`), never persisted.
36
36
  function createEmbeddedField(schema: EmbeddedFieldDef["schema"], overrides?: Partial<Omit<EmbeddedFieldDef, "type" | "schema" | keyof ResolvedPiiFlags>> & PersonalAnnotationsNoFind): EmbeddedFieldDef;
37
37
  function createEmbeddedListField(schema: EmbeddedFieldDef["schema"], overrides?: Partial<Omit<EmbeddedFieldDef, "type" | "schema" | "multiple" | keyof ResolvedPiiFlags>> & PersonalAnnotationsNoFind): EmbeddedFieldDef & { multiple: true; };
38
- function createEntity<const F, const T extends EntityTenancy = "tenant">(def: { table?: string; fields: F; description?: string; softDelete?: boolean; systemStream?: boolean; webhookEvents?: boolean; eventVersion?: number; eventMigrations?: EntityDefinition["eventMigrations"]; searchWeight?: number; defaultCurrency?: string; transitions?: Readonly<Record<string, Readonly<Record<string, string[]>>>>; lockedWhen?: EntityDefinition["lockedWhen"]; indexes?: EntityIndexDef[]; idType?: "serial" | "uuid"; access?: EntityDefinition["access"]; parentRef?: EntityDefinition["parentRef"]; readGate?: EntityDefinition["readGate"]; retention?: RetentionDef; derivedFields?: EntityDefinition["derivedFields"]; namedFilters?: EntityDefinition["namedFilters"]; tenancy?: T; transferable?: boolean; attachedFileAccess?: EntityDefinition["attachedFileAccess"]; }): F extends FieldsMap ? EntityDefinition<F, T> : never;
38
+ function createEntity<const F, const T extends EntityTenancy = "tenant">(def: { table?: string; fields: F; description?: string; softDelete?: boolean; systemStream?: boolean; systemRowsReadable?: boolean; webhookEvents?: boolean; eventVersion?: number; eventMigrations?: EntityDefinition["eventMigrations"]; searchWeight?: number; defaultCurrency?: string; transitions?: Readonly<Record<string, Readonly<Record<string, string[]>>>>; lockedWhen?: EntityDefinition["lockedWhen"]; indexes?: EntityIndexDef[]; idType?: "serial" | "uuid"; access?: EntityDefinition["access"]; parentRef?: EntityDefinition["parentRef"]; readGate?: EntityDefinition["readGate"]; retention?: RetentionDef; derivedFields?: EntityDefinition["derivedFields"]; namedFilters?: EntityDefinition["namedFilters"]; tenancy?: T; transferable?: boolean; attachedFileAccess?: EntityDefinition["attachedFileAccess"]; }): F extends FieldsMap ? EntityDefinition<F, T> : never;
39
39
  function createEntityExecutor<E extends EntityDefinition>(entityName: string, entity: E): { table: EntityTable; executor: EventStoreExecutor<EntityRow<E>>; };
40
40
  function createFileField(overrides?: Partial<Omit<FileFieldDef, "type" | keyof ResolvedPiiFlags>> & PersonalAnnotationsNoFind): FileFieldDef;
41
41
  function createFilesField(overrides?: Partial<Omit<FilesFieldDef, "type" | keyof ResolvedPiiFlags>> & PersonalAnnotationsNoFind): FilesFieldDef;
@@ -117,6 +117,7 @@ function isTenantDataExtensionHooks(o: unknown): o is TenantDataExtensionHooks;
117
117
  function isTenantResourceExtensionHooks(o: unknown): o is TenantResourceExtensionHooks;
118
118
  function isTierResolverPlugin(v: unknown): v is TierResolverPlugin; // Narrows a registration's untyped `options` bag to the tier-resolver plugin shape — the only thing every implementation must provide is the `build` factory.
119
119
  function isToggleableFeature(feature: FeatureDefinition): feature is FeatureDefinition & { toggleableDefault: boolean; };
120
+ function isUnchangedValue(a: unknown, b: unknown): boolean;
120
121
  function isUuid(value: unknown): value is string;
121
122
  function isValidQn(value: string): boolean;
122
123
  function maskWriteOnlyFields<T extends Readonly<Record<string, unknown>>>(entity: EntityDefinition, row: T): T;
@@ -146,6 +147,7 @@ function resolveEntityTransferAdjacency(entities: ReadonlyMap<string, EntityDefi
146
147
  function resolveNamedListFilters(ctx: HandlerContext, user: SessionUser, entityName: string, name: string): Promise<NamedListFilterCondition[]>;
147
148
  function runPipeline<TPayload, TData, TMap extends object = KumikoEventTypeMap>(pipelineDef: PipelineDef<TPayload, TData>, event: WriteEvent<TPayload>, handlerCtx: HandlerContext<TMap>, workflow?: PipelineCtx["workflow"], resumeFrom?: number): Promise<WriteResult<TData>>;
148
149
  function runStepList<TPayload, TMap extends object = KumikoEventTypeMap>(steps: StepInstance[], event: WriteEvent<TPayload>, handlerCtx: HandlerContext<TMap>, stepsAcc: Record<string, unknown>, scopeAcc: Record<string, unknown>, workflow?: PipelineCtx["workflow"], resumeFrom?: number): Promise<StepListOutcome>; // Walk a step-list.
150
+ function screenShortId(ref: string): string;
149
151
  function sectionFieldSpecs(section: FieldsOrGroupsSection): EditFieldSpec[];
150
152
  function selectablePluginIds(registry: Pick<Registry, "getExtensionUsages">, extensionName: string): string[];
151
153
  function serializeManifest(manifest: FeatureManifest): string;
@@ -223,6 +225,7 @@ const SYSTEM_USER_ID: "00000000-0000-0000-0000-000000000000";
223
225
  const TENANT_CURRENCY_CONFIG_KEY: "tenant-settings:config:currency"; // Qualified config key a `{ kind: "tenant" }` MoneyCurrencySource resolves against — the tenant-settings bundle's per-tenant currency.
224
226
  const TENANT_MEMBERSHIPS_QUERY: "tenant:query:memberships";
225
227
  const TENANT_TIER_RESOLVER_EXT: "tenantTierResolver"; // Extension name under which a tier-resolver plugin must be registered in the registry.
228
+ const WEBHOOK_ENTITY_VERBS: WebhookEntityVerb[];
226
229
  const WORKFLOW_AGGREGATE_TYPE: "workflow-run";
227
230
  const WORKFLOW_RESUMED_TYPE: "kumiko:system:workflow.step.resumed";
228
231
  const WORKFLOW_RETRY_SCHEDULED_TYPE: "kumiko:system:workflow.retry.scheduled";
@@ -232,7 +235,7 @@ const WORKFLOW_RUN_STARTED_TYPE: "kumiko:system:workflow.run-started";
232
235
  const WORKFLOW_SYSTEM_EVENT_DEFS: ReadonlyMap<string, EventDef>;
233
236
  const WORKFLOW_WAITING_FOR_EVENT_TYPE: "kumiko:system:workflow.step.waiting-for-event";
234
237
  const WORKFLOW_WAITING_TYPE: "kumiko:system:workflow.step.waiting";
235
- const access: { all; admin; systemAdmin; system; privileged; authenticated; anonymous; roles; withSystem };
238
+ const access: { all; admin; systemAdmin; system; privileged; builtinUserRoles; anonymous; roles; withSystem };
236
239
  const entityListSchema;
237
240
  const templateVariable: { text; link; richText; money; date; percent; images; list };
238
241
  ```
@@ -314,7 +317,7 @@ type AppContext = SharedContextFields & {
314
317
  systemUser?: SessionUser;
315
318
  log?: Logger;
316
319
  triggeredBy?: { id: string; tenantId: TenantId; } | null;
317
- triggerName?: string; // For job-handler calls triggered by an event (`r.job` with `trigger: { on: ...
320
+ triggerName?: string; // For job-handler calls triggered by an `on` entry (`r.job` with `trigger: { on: ...
318
321
  geoTzProvider?: GeoTzProvider; // Optional Geo→zone adapter.
319
322
  clock?: Clock; // Overrides the system clock behind ctx.tz in handlers and jobs; tests inject a fixed time.
320
323
  _tenantId?: TenantId; // Tenant of the current pipeline call.
@@ -428,7 +431,6 @@ type ConfigKeyDefinition<T extends ConfigKeyType = ConfigKeyType> = {
428
431
  };
429
432
  computed?: ConfigComputedFn<T>;
430
433
  validate?: ConfigValidateFn<T>;
431
- allowPerRequest?: boolean;
432
434
  required?: boolean;
433
435
  env?: string;
434
436
  inheritedToTenant?: boolean;
@@ -478,10 +480,11 @@ type ContentCollectionDefinition = {
478
480
  actions?: TreeAction[];
479
481
  };
480
482
  };
481
- type DashboardCustomPanel = {
483
+ type DashboardCustomPanel = DashboardPanelNarrow & {
482
484
  kind: "custom";
483
485
  id: string;
484
486
  component: PlatformComponent;
487
+ span?: DashboardPanelSpan; // Grid width like the other panels; default is the full row.
485
488
  params?: Readonly<Record<string, unknown>>; // Static author values laid over the screen's filterParams, like `DashboardPanelQueryOptions.params`; the panel wins on a name clash.
486
489
  };
487
490
  type DashboardI18nText = { // Text a query handler can send untranslated: the renderer translates it.
@@ -496,6 +499,16 @@ type DeleteContext = {
496
499
  event: StoredEvent;
497
500
  lockGuardBypassed?: boolean | undefined;
498
501
  };
502
+ type DeliveryAttemptLogEntry = {
503
+ notificationType: string;
504
+ channel: string;
505
+ recipientAddress: string | null;
506
+ status: NotifyDeliveryStatus;
507
+ error: DeliveryErrorCode | null;
508
+ priority: NotifyPriority;
509
+ };
510
+ type DeliveryAttemptLogFactory = (user: SessionUser, tenantId: TenantId, deliveryDb?: DbConnection) => DeliveryAttemptLogFn;
511
+ type DeliveryAttemptLogFn = (entry: DeliveryAttemptLogEntry) => Promise<void>;
499
512
  type DeliveryErrorCode = DeliveryFailureCode | DeliverySkipReason | `http_${number}`;
500
513
  type DeliveryFailureCode = (typeof DELIVERY_FAILURE_CODES)[number];
501
514
  type DeliverySkipReason = (typeof DELIVERY_SKIP_REASONS)[number];
@@ -567,6 +580,7 @@ type EntityDefinition<F extends FieldsMap = FieldsMap, T extends EntityTenancy =
567
580
  softDelete?: boolean;
568
581
  tenancy?: T; // "tenant" (default): auto-filtered by every db accessor.
569
582
  systemStream?: boolean; // This aggregate's event stream lives on SYSTEM_TENANT_ID rather than the creator's tenant.
583
+ systemRowsReadable?: boolean; // Tenant sessions may read this entity's SYSTEM_TENANT_ID rows (shared templates, config defaults, catalogs).
570
584
  webhookEvents?: boolean; // Lets token scopes release `<entity>.created/.updated/.deleted` as webhook events.
571
585
  eventVersion?: number; // Schema version stamped on every lifecycle event (default 1, integer 1..999).
572
586
  eventMigrations?: EntityEventMigration[]; // One step per version, fromVersion → fromVersion+1.
@@ -604,6 +618,7 @@ type EntityEditScreenDefinition = {
604
618
  writeExcludedFields?: EntityWriteExcludedFields; // Derived by buildAppSchema from the entity's create/update write handlers (`excludeFields`): create hides these fields, update shows them read-only.
605
619
  entity: string;
606
620
  recordTitleField?: string; // Entity field whose value names the loaded record in the header breadcrumb (edit mode only).
621
+ focus?: boolean; // Focused shell while the record is open: the app header actions leave the shell header, and on phones a top bar with the record title, a back arrow to the parent list and the page-header overflow menu replaces it.
607
622
  titleTemplate?: string; // Screen title (i18n key) with `{field}` placeholders filled from the current form values, so the title follows what the user types (create wizard: "Add {make} {model}").
608
623
  readOnly?: FieldCondition; // Shows a saved record read-only while the condition holds for the loaded record (not for unsaved form values): all fields disabled, no save, discard or delete button; record `actions` stay.
609
624
  layout: EditLayout;
@@ -635,8 +650,9 @@ type EntityListScreenDefinition = {
635
650
  createUnavailable?: boolean; // Set by the role projection when `createScreen` is not reachable for the role: the renderer then shows no create button instead of falling back to the entity's edit screen.
636
651
  allowCreate?: boolean; // `false` hides this list's "+ New" button (and the empty-state create CTA) while the entity's edit screen keeps its create branch for other entry points, e.g. a prefilled action.
637
652
  columns: ListColumnSpec[];
653
+ rowToneField?: string; // Row field holding a SelectOptionTone; the row is toned like relatedList `rowTone`, other values leave it untoned.
654
+ rowDecoration?: ListRowDecoration; // Computed row fields from an app query, readable by `rowToneField`, column `hint`, `linkScreenField`/`linkParamsField` and rowAction `visible`/`params`/`payload`; a column may name a decoration field.
638
655
  rowRenderer?: PlatformComponent;
639
- cardRenderer?: PlatformComponent;
640
656
  rowActions?: RowAction[]; // Per-row actions, rendered as an actions column on the right.
641
657
  rowActionMode?: RowActionMode; // Layout of the row-action column — see `RowActionMode`.
642
658
  bulkActions?: ListBulkAction[]; // Bulk actions over checkbox-selected rows, each pointing at a writeHandler row action.
@@ -647,11 +663,18 @@ type EntityListScreenDefinition = {
647
663
  pageSize?: number;
648
664
  table?: ListTableOptions; // Opt-in table behaviour: remembered state, reset, column picker, density.
649
665
  defaultSort?: ListSortSpec;
666
+ sortOptions?: ListSortOption[]; // Choices of the "Sorted by" select in the toolbar (and the narrow-width sort control) instead of one entry per column; every field must be sortable.
650
667
  defaultFilters?: Readonly<Record<string, string[] | boolean>>; // Initial facet selection, per filterable field: option values (string facets) or a boolean.
651
668
  facets?: Readonly<Record<string, EntityListFacetConfig | false>>; // Per-facet display options for the entity's `filterable` fields, keyed by field name.
652
669
  namedFilters?: NamedListFilterRef[]; // Named work-queue rules offered on this list: ids declared in `EntityDefinition.namedFilters`, `label` an i18n key.
670
+ namedFilterFacet?: NamedFilterFacetOptions; // Presentation of `namedFilters` in the toolbar; needs `namedFilters`.
653
671
  emptyState?: ListEmptyStateSpec; // Replaces the default empty-list title/hint; the create button stays when the list can create.
654
672
  createLabel?: string; // i18n key for the primary create button label (default `kumiko.actions.create`).
673
+ createPlacement?: "header" | "toolbar"; // "toolbar": from `sm` up the create button ends the filter row instead of standing in the header.
674
+ toolbarSort?: true; // From `sm` up, a "Sorted by" select in the filter row (same options as the narrow sort control); column headers stay sortable.
675
+ narrowFacets?: ListNarrowFacets; // "pills": below `sm` the select facets render as rounded pill triggers with a stronger border; from `sm` up unchanged.
676
+ toolbarActionsPlacement?: "header" | "toolbar"; // "toolbar": from `md` up the `toolbarActions` end the filter row, after the "Sorted by" select and the create button, instead of standing in the page header.
677
+ itemNounKey?: string; // i18n key of the plural noun for the list size in the phone sort line (`{count}` pluralised).
655
678
  searchPlaceholder?: string; // i18n key for the search field placeholder (default `kumiko.list.search-placeholder`).
656
679
  searchable?: boolean;
657
680
  slots?: ScreenSlots;
@@ -874,6 +897,7 @@ interface FieldFormatRegistry {
874
897
  }; // List cell: FileRef id (or id array) as a thumbnail.
875
898
  file: {
876
899
  previewOpenByDefault?: boolean;
900
+ viewInDrawer?: boolean;
877
901
  }; // FileRef id (or id array) as a download link with the file name.
878
902
  }
879
903
  type HandlerAuth = {
@@ -918,7 +942,7 @@ type HandlerEvents<TMap extends object = KumikoEventTypeMap> = { // Event-store
918
942
  unsafeAppend: UnsafeAppendEventFn; // Untyped append (`payload: unknown`) with the same runtime as `append`.
919
943
  tryAppend: TryAppendEventFn; // Optimistic append: runs in a savepoint and returns a version conflict as a result instead of throwing, so the handler can continue after losing a race on the same aggregate stream.
920
944
  fetchForWriting: (args: FetchForWritingArgs) => Promise<AggregateStreamHandle>;
921
- load: (aggregateId: string, options?: { asOf?: Temporal.Instant; atVersion?: never; } | { atVersion?: number; asOf?: never; }) => Promise<StoredEvent[]>;
945
+ load: (aggregateId: string, options?: { asOf?: Temporal.Instant; atVersion?: never; includeArchived?: boolean; } | { atVersion?: number; asOf?: never; includeArchived?: boolean; }) => Promise<StoredEvent[]>;
922
946
  archive: (aggregateId: string, args: { aggregateType: string; reason?: string; }) => Promise<void>;
923
947
  restore: (aggregateId: string) => Promise<void>;
924
948
  isArchived: (aggregateId: string) => Promise<boolean>;
@@ -949,7 +973,6 @@ type JobContext = {
949
973
  dispatch: JobDispatch;
950
974
  triggerName?: string;
951
975
  triggerEvent?: JobTriggerEvent;
952
- _tenantId?: TenantId;
953
976
  config?: ConfigAccessor;
954
977
  notify?: NotifyFn;
955
978
  services: ContextServices;
@@ -981,7 +1004,7 @@ type JobDefinition = {
981
1004
  tenantVisibleRun?: { subjectFields?: string[] | undefined; } | undefined;
982
1005
  };
983
1006
  type JobDispatch = Pick<HandlerDispatch, "write" | "writeAs" | "queryAs" | "queryAsMember">;
984
- type JobEvents = Pick<HandlerEvents, "append">;
1007
+ type JobEvents = Pick<HandlerEvents, "append" | "load">;
985
1008
  type JobHandlerFn = (payload: Record<string, unknown>, context: JobContext) => Promise<void | JobDeferral>;
986
1009
  type JobObservability = Pick<HandlerObservability, "log" | "metricsFor" | "meter">;
987
1010
  type JobTrigger =
@@ -1024,15 +1047,20 @@ type ListColumnSpec =
1024
1047
  refEntity?: string; // Marks this column as a reference lookup instead of a plain value — for projectionList/relatedList columns, which have no `EntityDefinition` to carry a real `reference` field type.
1025
1048
  refLabelField?: string; // Row field on the referenced entity shown as the label (default "id").
1026
1049
  sortable?: boolean; // Marks this column as sortable via a clickable header — for relatedList columns, which have no `EntityDefinition` field to carry `sortable` on.
1027
- valueType?: "number" | "decimal" | "bigInt" | "money"; // Value type of a relatedList column, which has no `EntityDefinition` field to derive it from.
1050
+ valueType?: "number" | "decimal" | "bigInt" | "money"; // Value type of a projectionList or relatedList column, which has no `EntityDefinition` field to derive it from.
1051
+ emptyPlaceholder?: false; // `false` leaves an empty cell blank instead of drawing the "—" placeholder.
1028
1052
  hideOnNarrow?: boolean; // Leaves the column out of the compact card layout used below the `md` breakpoint (tables keep it).
1053
+ showOnNarrowOnly?: true; // Counterpart of `hideOnNarrow`: the column shows only in the compact card layout and not in the table.
1029
1054
  hidden?: boolean; // Start state for the column picker: the column begins hidden and the user can show it.
1030
1055
  pinned?: ListColumnPin; // Start pin for the column: it sticks to this edge while the table scrolls horizontally.
1031
1056
  width?: number; // Start width in px.
1032
1057
  minWidth?: number; // Smallest width in px the user can resize to.
1033
- display?: ListColumnDisplay; // Dashboard list panels only.
1058
+ display?: ListColumnDisplay; // One of "bar" | "badge" | "datetime" | "button".
1034
1059
  badgeToneField?: string; // Row field naming the badge tone; only with `display: "badge"`.
1060
+ badgeDot?: false; // `false` draws the badge pill without its leading dot; only with `display: "badge"`.
1035
1061
  linkScreenField?: string; // Row field holding a screen QN (`<feature>:screen:<id>`): the cell links to that screen when the row sets it and the user may open it.
1062
+ linkParamsField?: string; // Row field holding a params object for the linkScreenField target: `entityId` opens that record, the other keys become search params (e.g. actionForm prefill).
1063
+ hint?: ListColumnHint; // "To do" cell: the column's field holds a sentence, shown emphasized in the row tone; an empty value shows `emptyLabel`.
1036
1064
  }
1037
1065
  ;
1038
1066
  type ListFacetSpec =
@@ -1074,6 +1102,7 @@ type ListTableOptions = { // Opt-in table behaviour of a list.
1074
1102
  resizing?: boolean; // Switches the table to table-layout fixed; the user drags or uses the arrow keys on the header edge to resize.
1075
1103
  keyboardNavigation?: boolean; // Rows become one tab stop; ArrowUp/ArrowDown move, Home/End jump, Enter runs the row click.
1076
1104
  compactHeader?: boolean; // Renders the header row smaller (12px) and semibold.
1105
+ frame?: ListTableFrame; // "card": from `sm` up the table, summary row and pager sit in one bordered, rounded card (toolbar and description stay above it); below `sm` the cards of the card layout are bordered, rounded cards with a gap.
1077
1106
  density?: {
1078
1107
  default?: ListTableDensity; // Row density on first visit.
1079
1108
  userChoice?: boolean; // Shows the density choice in the view menu and remembers it per session.
@@ -1081,6 +1110,7 @@ type ListTableOptions = { // Opt-in table behaviour of a list.
1081
1110
  export?: ListTableExportOptions; // Shows an export button; the server reads the whole filtered list (not just the visible page).
1082
1111
  grouping?: ListTableGrouping; // Server-side grouping: group headers with count and the `totals` measures over all matching rows; each open group loads its own rows.
1083
1112
  totals?: ListTableTotal[]; // Footer row under the rows, computed by the server over all rows matching the current filters and search.
1113
+ summaryRow?: ListTableSummaryRow; // One line under the rows (above `totals`), computed by a query of your own: "label value · label value"; an item without `label` shows its value alone.
1084
1114
  };
1085
1115
  type ManifestConfigKey = {
1086
1116
  key: string;
@@ -1337,6 +1367,7 @@ type ProjectionDetailScreenDefinition = {
1337
1367
  fallback?: ScreenFallback; // Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice).
1338
1368
  query: string;
1339
1369
  recordTitleField?: string; // Query output field whose value titles the page header (breadcrumb) when no `header` is set.
1370
+ focus?: boolean; // Focused shell while the record is open: the app header actions leave the shell header, and on phones a top bar with the record title, a back arrow to the parent list and the page-header overflow menu replaces it.
1340
1371
  idParam?: string; // Query-payload key for the row-id.
1341
1372
  singleton?: boolean; // The server determines the shown row from the caller's session/context instead of a row id in the path — a self-service screen ("my profile", "my data") that has no row to link to (unlike `EntityEditScreenDefinition.
1342
1373
  live?: boolean; // Refetches the record and its relatedList sections when their entity changes (live SSE), for a screen that shows work a background job is still doing.
@@ -1345,6 +1376,14 @@ type ProjectionDetailScreenDefinition = {
1345
1376
  header?: RecordHeaderSpec; // Record header above the layout — title/subtitle/status name columns in the query row (not literals).
1346
1377
  metrics?: MetricSpec[]; // Metric band above the layout — column names in the query row, each with its own i18n `label`.
1347
1378
  metricsStyle?: "band" | "tiles"; // "tiles" draws the metrics as the dashboard KPI tiles (StatCard) instead of the plain band.
1379
+ metricsPlacement?: {
1380
+ narrow?: "after-guidance";
1381
+ }; // `narrow: "after-guidance"` moves the metrics below the summary, banner and steps on screens under md, ahead of the tabs.
1382
+ breadcrumb?: RecordBreadcrumbSpec; // Path above the header (query column holding items).
1383
+ summary?: RecordSummarySpec; // One emphasized sentence below the header.
1384
+ banner?: RecordBannerSpec; // Notice below the summary.
1385
+ steps?: RecordStepsSpec; // "Next steps" panel.
1386
+ progress?: RecordProgressSpec; // Process chains the record is part of, drawn as step bars between the banner and the steps panel.
1348
1387
  listScreenId?: string; // Parent list screen (short id) for a "back" navigation.
1349
1388
  slots?: ScreenSlots;
1350
1389
  access?: AccessRule;
@@ -1366,18 +1405,24 @@ type ProjectionListScreenDefinition = {
1366
1405
  fallback?: ScreenFallback; // Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice).
1367
1406
  query: string;
1368
1407
  columns: ListColumnSpec[];
1408
+ rowToneField?: string; // Row field holding a SelectOptionTone; the row is toned like relatedList `rowTone`, other values leave it untoned.
1409
+ rowDecoration?: ListRowDecoration; // Computed row fields from an app query, merged into the query rows; see `ListRowDecoration`.
1369
1410
  rowRenderer?: PlatformComponent;
1370
- cardRenderer?: PlatformComponent;
1371
1411
  rowActions?: RowAction[];
1372
1412
  rowActionMode?: RowActionMode; // Layout of the row-action column — see `RowActionMode`.
1373
1413
  bulkActions?: ListBulkAction[]; // Bulk actions over checkbox-selected rows, each pointing at a writeHandler row action.
1374
1414
  toolbarActions?: ToolbarAction[];
1415
+ toolbarActionsPlacement?: "header" | "toolbar"; // "toolbar": from `md` up the `toolbarActions` end the filter row, after the "Sorted by" select, instead of standing in the page header.
1416
+ toolbarSort?: true; // From `sm` up, a "Sorted by" select in the filter row (same options as the narrow sort control); column headers stay sortable.
1417
+ narrowFacets?: ListNarrowFacets; // "pills": below `sm` the select facets render as rounded pill triggers with a stronger border; from `sm` up unchanged.
1375
1418
  pagination?: ListPaginationMode;
1376
1419
  pageSize?: number;
1377
1420
  table?: ListTableOptions; // Opt-in table behaviour: remembered state, reset, column picker, density.
1378
1421
  defaultSort?: ListSortSpec;
1422
+ sortOptions?: ListSortOption[]; // Choices of the "Sorted by" select in the toolbar (and the narrow-width sort control) instead of one entry per column; every field must be sortable.
1379
1423
  emptyState?: ListEmptyStateSpec; // Replaces the default empty-list title/hint; the create button stays when the list can create.
1380
1424
  createLabel?: string; // i18n key for the primary create button label (default `kumiko.actions.create`).
1425
+ itemNounKey?: string; // i18n key of the plural noun for the list size in the phone sort line ('{count}' pluralised, e.g. "contract"/"contracts").
1381
1426
  searchPlaceholder?: string; // i18n key for the search field placeholder (default `kumiko.list.search-placeholder`).
1382
1427
  searchable?: boolean;
1383
1428
  sortable?: boolean; // Derived by buildAppSchema from the query handler's Zod schema (`sort` param present).
@@ -1385,6 +1430,7 @@ type ProjectionListScreenDefinition = {
1385
1430
  filter?: ScreenFilter; // Server-side filter, fixed on the screen — see `ScreenFilter` doc above (entityList).
1386
1431
  facets?: ListFacetSpec[]; // User-toggleable facet dropdowns — see `ListFacetSpec` doc.
1387
1432
  namedFilters?: NamedListFilterRef[]; // Named work-queue rules the bound query understands: its Zod schema must have a `namedFilter` key (boot-checked) and is sent the selected id in every list and count query.
1433
+ namedFilterFacet?: NamedFilterFacetOptions; // Presentation of `namedFilters` in the toolbar; needs `namedFilters`.
1388
1434
  slots?: ScreenSlots;
1389
1435
  access?: AccessRule;
1390
1436
  };
@@ -1557,6 +1603,7 @@ type SaveContext = {
1557
1603
  isNew: boolean;
1558
1604
  entityName?: string | undefined;
1559
1605
  event: StoredEvent;
1606
+ claimedFileRefIds?: string[] | undefined;
1560
1607
  };
1561
1608
  type ScreenDefinition = EntityListScreenDefinition | ProjectionListScreenDefinition | ProjectionDetailScreenDefinition | DashboardScreenDefinition | EntityEditScreenDefinition | ActionFormScreenDefinition | ConfigEditScreenDefinition | SecretsEditScreenDefinition | SecretMintScreenDefinition | CustomScreenDefinition;
1562
1609
  type SecretKeyDefinition = {
@@ -1571,6 +1618,7 @@ type SecretKeyDefinition = {
1571
1618
  };
1572
1619
  scope: "tenant";
1573
1620
  required?: boolean;
1621
+ requiredWhenConfigSet?: string;
1574
1622
  writeRoles?: string[];
1575
1623
  valueSchema?: ZodType<string>;
1576
1624
  };
@@ -1708,6 +1756,7 @@ type TierResolverPlugin = { // Plugin shape for the tier-resolver extension.
1708
1756
  };
1709
1757
  type ToggleReader = (featureName: string) => boolean | undefined;
1710
1758
  type ToolbarAction = ({ kind: "navigate"; id: string; label: string; screen: string; tab?: string; style?: "primary" | "secondary" | "danger"; } | { kind: "writeHandler"; id: string; label: string; handler: string; payload?: Record<string, unknown>; confirm?: string; confirmLabel?: string; style?: "primary" | "secondary" | "danger"; } | { kind: "drawer"; id: string; label: string; screen: string; style?: "primary" | "secondary" | "danger"; title?: string; subtitle?: string; }) & {
1759
+ icon?: IconKey; // Icon of the button, in every list (entityList, projectionList, relatedList).
1711
1760
  visibleWhen?: DashboardPanelVisibility; // Shown only while the query's `field` equals `eq` (live, empty payload).
1712
1761
  };
1713
1762
  type TransferAdjacency = ReadonlyMap<string, TransferEdge[]>; // Outgoing edges per type: keyed by the type an edge hangs off, so the mover can ask "what hangs off the rows I just moved" for any type it reaches, at any depth, as often as it reaches it.
@@ -1846,6 +1895,7 @@ type WriteHandlerDef = {
1846
1895
  name: string;
1847
1896
  schema: ZodType;
1848
1897
  handler: WriteHandlerFn;
1898
+ [ENTITY_CONVENTION_WRITE_BRAND]?: true; // Set only by defineEntityWriteHandler, which wires the parent-ref visibility gate.
1849
1899
  access: AccessRule;
1850
1900
  description?: string;
1851
1901
  agent?: AgentHandlerHints;
@@ -1868,7 +1918,7 @@ type WriteHandlerDefinition<TName extends string = string, TSchema extends ZodTy
1868
1918
  access: AccessRule;
1869
1919
  description?: string;
1870
1920
  agent?: AgentHandlerHints;
1871
- excludedFields?: string[]; // Set by the entity convention create/update handlers; see WriteHandlerDef.excludedFields.
1921
+ excludedFields?: string[]; // Set by the entity convention create/update handlers; a hand-written handler may declare it for its form, its own schema still decides what it accepts.
1872
1922
  unsafeSkipTransitionGuard?: boolean;
1873
1923
  rateLimit?: RateLimitDeclaration;
1874
1924
  additionalRateLimits?: PayloadRateLimitOption[];
@@ -28,6 +28,7 @@ function isStreamArchived(db: DbRunner, tenantId: TenantId, aggregateId: string)
28
28
  function loadAggregate(db: DbRunner, aggregateId: string, tenantId: TenantId, options?: { includeArchived?: boolean; aggregateType?: string; atVersion?: number; }): Promise<StoredEvent[]>;
29
29
  function makeUpcastCtx(db: DbRunner, tenantId: TenantId): EventUpcastCtx;
30
30
  function runSeedWritesAt<T>(createdAt: Temporal.Instant, fn: () => Promise<T>): Promise<T>; // Runs `fn` so that every event appended inside it (through the normal write path: handlers, validation, projections) is stored with `createdAt` instead of the database `now()`.
31
+ function selectOpenStreamsStartedBefore(db: DbRunner, args: OpenStreamsArgs): Promise<OpenStream[]>;
31
32
  function streamAllEventsByType(db: DbRunner, aggregateType: string, batchSize?, signal?: AbortSignal): AsyncIterable<StoredEvent>;
32
33
  function transferAggregateStreams(db: DbRunner, args: TransferAggregateStreamsArgs): Promise<number>;
33
34
  function upcastStoredEvent(event: StoredEvent, upcasters: EventUpcasters, ctx: EventUpcastCtx): Promise<StoredEvent>;
@@ -83,6 +84,19 @@ type EventMetadata = {
83
84
  handler?: string;
84
85
  writeOrigin?: WriteOrigin;
85
86
  };
87
+ type OpenStream = {
88
+ id: string;
89
+ tenantId: string;
90
+ aggregateId: string;
91
+ };
92
+ type OpenStreamsArgs = {
93
+ aggregateType: string;
94
+ startedType: string;
95
+ closingTypes: string[];
96
+ startedBeforeIso: string;
97
+ limit: number;
98
+ afterId?: string;
99
+ };
86
100
  type StoredEvent<TPayload = Record<string, unknown>> = {
87
101
  id: string;
88
102
  aggregateId: string;