@cosmicdrift/kumiko-framework 0.369.0 → 0.371.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 (451) hide show
  1. package/AGENTS.md +14 -1
  2. package/agents/examples/apex-surface-auth.md +2 -1
  3. package/agents/examples/app-config.md +98 -0
  4. package/agents/examples/auth-mfa.md +72 -0
  5. package/agents/examples/chat-channels.md +1 -1
  6. package/agents/examples/compose-stacks.md +188 -0
  7. package/agents/examples/env-composition.md +278 -0
  8. package/agents/examples/host-routing.md +181 -0
  9. package/agents/examples/inbound-mail-triage.md +1 -1
  10. package/agents/examples/legal-pages.md +52 -3
  11. package/agents/examples/managed-config.md +1 -0
  12. package/agents/examples/managed-pages.md +1 -0
  13. package/agents/examples/prod-boot-options.md +180 -0
  14. package/agents/examples/relations.md +4 -0
  15. package/agents/examples/secrets-demo.md +4 -2
  16. package/agents/examples/security-baseline.md +20 -17
  17. package/agents/examples.md +6 -1
  18. package/agents/features.md +14 -2
  19. package/dist/api/anonymous-cookie.d.ts +1 -1
  20. package/dist/api/anonymous-live-entities.d.ts +1 -1
  21. package/dist/api/auth-middleware.d.ts +2 -2
  22. package/dist/api/auth-routes.d.ts +7 -7
  23. package/dist/api/extra-route.d.ts +2 -2
  24. package/dist/api/index.d.ts +37 -37
  25. package/dist/api/jwt.d.ts +1 -1
  26. package/dist/api/observability-middleware.d.ts +1 -1
  27. package/dist/api/readiness.d.ts +1 -1
  28. package/dist/api/redis-sse-broker.d.ts +2 -2
  29. package/dist/api/request-context.d.ts +1 -1
  30. package/dist/api/request-id-middleware.d.ts +3 -3
  31. package/dist/api/route-registrars.d.ts +4 -4
  32. package/dist/api/routes.d.ts +1 -1
  33. package/dist/api/server.d.ts +16 -16
  34. package/dist/api/sse-broker.d.ts +1 -1
  35. package/dist/api/sse-route.d.ts +1 -1
  36. package/dist/api/websocket-route.d.ts +3 -3
  37. package/dist/auth/index.d.ts +2 -2
  38. package/dist/compliance/duration-spec.d.ts +2 -2
  39. package/dist/compliance/index.d.ts +6 -6
  40. package/dist/compliance/profiles.d.ts +1 -1
  41. package/dist/config/index.d.ts +44 -0
  42. package/dist/config/index.js +61 -0
  43. package/dist/crypto/blind-index.d.ts +1 -1
  44. package/dist/crypto/event-pii.d.ts +1 -1
  45. package/dist/crypto/in-memory-kms-adapter.d.ts +1 -1
  46. package/dist/crypto/index.d.ts +11 -11
  47. package/dist/crypto/is-self-pii-field.d.ts +1 -1
  48. package/dist/crypto/kms-wiring.d.ts +2 -2
  49. package/dist/crypto/owner-transition-rekey.d.ts +1 -1
  50. package/dist/crypto/pg-kms-adapter.d.ts +1 -1
  51. package/dist/crypto/pii-field-encryption.d.ts +4 -4
  52. package/dist/crypto/request-kms-cache.d.ts +1 -1
  53. package/dist/crypto/subject-resolver.d.ts +3 -3
  54. package/dist/db/apply-entity-event.d.ts +4 -4
  55. package/dist/db/assert-exists-in.d.ts +4 -4
  56. package/dist/db/blind-index-cleanup.d.ts +2 -2
  57. package/dist/db/collect-table-metas.d.ts +2 -2
  58. package/dist/db/compound-types.d.ts +1 -1
  59. package/dist/db/config-seed.d.ts +5 -5
  60. package/dist/db/connection.d.ts +1 -6
  61. package/dist/db/connection.js +15 -4
  62. package/dist/db/dialect.d.ts +1 -1
  63. package/dist/db/eagerload.d.ts +3 -3
  64. package/dist/db/entity-field-encryption.d.ts +3 -3
  65. package/dist/db/entity-field-encryption.js +3 -1
  66. package/dist/db/entity-table-from-registry.d.ts +3 -3
  67. package/dist/db/entity-table-meta.d.ts +3 -3
  68. package/dist/db/event-store-executor-context.d.ts +9 -9
  69. package/dist/db/event-store-executor-read.d.ts +2 -2
  70. package/dist/db/event-store-executor-write.d.ts +2 -2
  71. package/dist/db/event-store-executor.d.ts +8 -8
  72. package/dist/db/feature-table-sources.d.ts +1 -1
  73. package/dist/db/index.d.ts +39 -39
  74. package/dist/db/located-timestamp.d.ts +1 -1
  75. package/dist/db/lock-guard.d.ts +2 -2
  76. package/dist/db/migrate-generator.d.ts +2 -2
  77. package/dist/db/migrate-runner.d.ts +1 -1
  78. package/dist/db/money.d.ts +1 -1
  79. package/dist/db/parent-ref-clause.d.ts +4 -4
  80. package/dist/db/projection-registry-binding.d.ts +1 -1
  81. package/dist/db/queries/advisory-lock.d.ts +1 -1
  82. package/dist/db/queries/backfill-pii.d.ts +2 -2
  83. package/dist/db/queries/ddl.d.ts +1 -1
  84. package/dist/db/queries/entity-read.d.ts +1 -1
  85. package/dist/db/queries/es-ops.d.ts +1 -1
  86. package/dist/db/queries/event-consumer.d.ts +2 -2
  87. package/dist/db/queries/event-store-admin.d.ts +1 -1
  88. package/dist/db/queries/event-store-transfer.d.ts +1 -1
  89. package/dist/db/queries/event-store.d.ts +1 -1
  90. package/dist/db/queries/pii-backfill-state.d.ts +1 -1
  91. package/dist/db/queries/projection-rebuild.d.ts +1 -1
  92. package/dist/db/queries/raw-sql.d.ts +1 -1
  93. package/dist/db/queries/seed-context.d.ts +2 -2
  94. package/dist/db/queries/shadow-swap.d.ts +3 -3
  95. package/dist/db/queries/table-ops.d.ts +1 -1
  96. package/dist/db/queries/test-stack.d.ts +2 -2
  97. package/dist/db/query.d.ts +3 -3
  98. package/dist/db/rebuild-marker.d.ts +1 -1
  99. package/dist/db/reference-data.d.ts +3 -3
  100. package/dist/db/render-ddl.d.ts +1 -1
  101. package/dist/db/replay-migration-sql.d.ts +1 -1
  102. package/dist/db/retired-framework-tables.d.ts +1 -1
  103. package/dist/db/schema-inspection.d.ts +1 -1
  104. package/dist/db/table-builder.d.ts +4 -4
  105. package/dist/db/table-push.d.ts +3 -3
  106. package/dist/db/tenant-db-runner.d.ts +2 -2
  107. package/dist/db/tenant-db.d.ts +7 -9
  108. package/dist/db/tenant-db.js +2 -12
  109. package/dist/derivatives/derivatives-context.d.ts +3 -3
  110. package/dist/derivatives/field-variants.d.ts +1 -1
  111. package/dist/derivatives/index.d.ts +6 -6
  112. package/dist/engine/access.d.ts +1 -1
  113. package/dist/engine/active-membership.d.ts +2 -2
  114. package/dist/engine/boot-validator/access-declarations.d.ts +1 -1
  115. package/dist/engine/boot-validator/access-roles.d.ts +1 -1
  116. package/dist/engine/boot-validator/action-wiring.d.ts +1 -1
  117. package/dist/engine/boot-validator/api-ext.d.ts +1 -1
  118. package/dist/engine/boot-validator/boot-check.d.ts +1 -1
  119. package/dist/engine/boot-validator/card-meta-overflow.d.ts +1 -1
  120. package/dist/engine/boot-validator/config-deps.d.ts +1 -1
  121. package/dist/engine/boot-validator/detail-screens.d.ts +2 -2
  122. package/dist/engine/boot-validator/entity-handler.d.ts +1 -1
  123. package/dist/engine/boot-validator/entity-list-screens.d.ts +1 -1
  124. package/dist/engine/boot-validator/gdpr-storage.d.ts +1 -1
  125. package/dist/engine/boot-validator/global-tenancy.d.ts +1 -1
  126. package/dist/engine/boot-validator/handler-field-references.d.ts +1 -1
  127. package/dist/engine/boot-validator/i18n-keys.d.ts +1 -1
  128. package/dist/engine/boot-validator/index.d.ts +7 -7
  129. package/dist/engine/boot-validator/nav.d.ts +1 -1
  130. package/dist/engine/boot-validator/ownership.d.ts +2 -2
  131. package/dist/engine/boot-validator/parent-ref.d.ts +1 -1
  132. package/dist/engine/boot-validator/pii-retention.d.ts +2 -2
  133. package/dist/engine/boot-validator/projection-list-screens.d.ts +1 -1
  134. package/dist/engine/boot-validator/query-output-columns.d.ts +1 -1
  135. package/dist/engine/boot-validator/query-refs.d.ts +1 -1
  136. package/dist/engine/boot-validator/record-owned.d.ts +1 -1
  137. package/dist/engine/boot-validator/screens.d.ts +2 -2
  138. package/dist/engine/boot-validator/security-baseline.d.ts +1 -1
  139. package/dist/engine/boot-validator/selector-owner-panels.d.ts +1 -1
  140. package/dist/engine/boot-validator/transfer-graph.d.ts +2 -2
  141. package/dist/engine/boot-validator/url-prefill-fields.d.ts +1 -1
  142. package/dist/engine/boot-validator/workspaces.d.ts +1 -1
  143. package/dist/engine/boot-validator.d.ts +1 -1
  144. package/dist/engine/bridge-stub.d.ts +1 -1
  145. package/dist/engine/build-app-schema.d.ts +2 -2
  146. package/dist/engine/build-config-feature-schema.d.ts +5 -5
  147. package/dist/engine/build-target.d.ts +2 -2
  148. package/dist/engine/changeset-changes.d.ts +1 -1
  149. package/dist/engine/codemod/index.d.ts +2 -2
  150. package/dist/engine/config-helpers.d.ts +1 -1
  151. package/dist/engine/constants.d.ts +1 -1
  152. package/dist/engine/create-app.d.ts +2 -2
  153. package/dist/engine/cross-tenant.d.ts +2 -2
  154. package/dist/engine/dedupe-features.d.ts +1 -1
  155. package/dist/engine/define-feature.d.ts +1 -1
  156. package/dist/engine/define-feature.js +2 -2
  157. package/dist/engine/define-handler.d.ts +4 -4
  158. package/dist/engine/define-step.d.ts +1 -1
  159. package/dist/engine/define-workflow.d.ts +2 -2
  160. package/dist/engine/effective-features.d.ts +1 -1
  161. package/dist/engine/embedded-derived.d.ts +1 -1
  162. package/dist/engine/entity-handlers.d.ts +6 -5
  163. package/dist/engine/entity-handlers.js +6 -3
  164. package/dist/engine/event-def.d.ts +15 -0
  165. package/dist/engine/event-def.js +123 -0
  166. package/dist/engine/event-helpers.d.ts +1 -1
  167. package/dist/engine/extension-names.d.ts +8 -8
  168. package/dist/engine/extension-selector-plugins.d.ts +2 -2
  169. package/dist/engine/extensions/escape-hatch-usage.d.ts +1 -1
  170. package/dist/engine/extensions/storage-provider.d.ts +1 -1
  171. package/dist/engine/extensions/tenant-data.d.ts +3 -3
  172. package/dist/engine/extensions/tenant-resource.d.ts +2 -2
  173. package/dist/engine/extensions/user-data.d.ts +2 -2
  174. package/dist/engine/factories.d.ts +1 -1
  175. package/dist/engine/feature-ast/extractors/ai-steps.d.ts +2 -2
  176. package/dist/engine/feature-ast/extractors/events.d.ts +2 -2
  177. package/dist/engine/feature-ast/extractors/handlers.d.ts +4 -4
  178. package/dist/engine/feature-ast/extractors/hooks.d.ts +5 -5
  179. package/dist/engine/feature-ast/extractors/index.d.ts +14 -14
  180. package/dist/engine/feature-ast/extractors/jobs-routes.d.ts +3 -3
  181. package/dist/engine/feature-ast/extractors/projections-screens.d.ts +3 -3
  182. package/dist/engine/feature-ast/extractors/round1.d.ts +2 -2
  183. package/dist/engine/feature-ast/extractors/round2.d.ts +2 -2
  184. package/dist/engine/feature-ast/extractors/round3.d.ts +4 -4
  185. package/dist/engine/feature-ast/extractors/round5.d.ts +2 -2
  186. package/dist/engine/feature-ast/extractors/round6.d.ts +2 -2
  187. package/dist/engine/feature-ast/extractors/shared.d.ts +2 -2
  188. package/dist/engine/feature-ast/index.d.ts +16 -16
  189. package/dist/engine/feature-ast/parse.d.ts +2 -2
  190. package/dist/engine/feature-ast/patch.d.ts +1 -1
  191. package/dist/engine/feature-ast/patcher.d.ts +15 -15
  192. package/dist/engine/feature-ast/pattern-change-schema.d.ts +10 -10
  193. package/dist/engine/feature-ast/patterns.d.ts +15 -15
  194. package/dist/engine/feature-ast/render.d.ts +1 -1
  195. package/dist/engine/feature-builder-state.d.ts +5 -5
  196. package/dist/engine/feature-config-events-jobs.d.ts +3 -3
  197. package/dist/engine/feature-config-events-jobs.js +8 -130
  198. package/dist/engine/feature-entity-handlers.d.ts +4 -4
  199. package/dist/engine/feature-entity-handlers.js +11 -5
  200. package/dist/engine/feature-manifest.d.ts +1 -1
  201. package/dist/engine/feature-ui-extensions.d.ts +7 -7
  202. package/dist/engine/feature-ui-extensions.js +2 -2
  203. package/dist/engine/field-access.d.ts +1 -1
  204. package/dist/engine/field-helpers.d.ts +1 -1
  205. package/dist/engine/handler-helpers.d.ts +1 -1
  206. package/dist/engine/index.d.ts +89 -88
  207. package/dist/engine/index.js +1 -0
  208. package/dist/engine/instruction-fields.d.ts +1 -1
  209. package/dist/engine/object-form.d.ts +1 -1
  210. package/dist/engine/object-form.js +5 -6
  211. package/dist/engine/ownership.d.ts +3 -3
  212. package/dist/engine/pattern-library/index.d.ts +2 -2
  213. package/dist/engine/pattern-library/library.d.ts +2 -2
  214. package/dist/engine/pattern-library/mixed-schemas.d.ts +1 -1
  215. package/dist/engine/pattern-library/opaque-schemas.d.ts +1 -1
  216. package/dist/engine/pattern-library/shared-fields.d.ts +1 -1
  217. package/dist/engine/pattern-library/static-schemas.d.ts +1 -1
  218. package/dist/engine/pattern-library/types.d.ts +1 -1
  219. package/dist/engine/personal-data-fields.d.ts +2 -2
  220. package/dist/engine/pipeline.d.ts +2 -2
  221. package/dist/engine/project-app-schema-for-roles.d.ts +1 -1
  222. package/dist/engine/projection-helpers.d.ts +4 -4
  223. package/dist/engine/read-claim.d.ts +1 -1
  224. package/dist/engine/registry-facade.d.ts +2 -2
  225. package/dist/engine/registry-ingest.d.ts +2 -2
  226. package/dist/engine/registry-state.d.ts +2 -2
  227. package/dist/engine/registry-validate.d.ts +3 -3
  228. package/dist/engine/registry.d.ts +1 -1
  229. package/dist/engine/resolve-config-or-param.d.ts +2 -2
  230. package/dist/engine/role-assignment.d.ts +1 -1
  231. package/dist/engine/run-in.d.ts +1 -1
  232. package/dist/engine/run-pipeline.d.ts +3 -3
  233. package/dist/engine/schema-builder.d.ts +1 -1
  234. package/dist/engine/screen-filter-ops.d.ts +1 -1
  235. package/dist/engine/screen-helpers.d.ts +2 -2
  236. package/dist/engine/soft-delete-cleanup.d.ts +2 -2
  237. package/dist/engine/steps/_event-match.d.ts +1 -1
  238. package/dist/engine/steps/_no-return-guard.d.ts +1 -1
  239. package/dist/engine/steps/_read-source.d.ts +4 -4
  240. package/dist/engine/steps/_resolver-utils.d.ts +1 -1
  241. package/dist/engine/steps/aggregate-append-event.d.ts +1 -1
  242. package/dist/engine/steps/aggregate-create.d.ts +2 -2
  243. package/dist/engine/steps/aggregate-update.d.ts +3 -3
  244. package/dist/engine/steps/branch.d.ts +1 -1
  245. package/dist/engine/steps/call-feature.d.ts +2 -2
  246. package/dist/engine/steps/compute.d.ts +1 -1
  247. package/dist/engine/steps/for-each.d.ts +1 -1
  248. package/dist/engine/steps/mail-send.d.ts +1 -1
  249. package/dist/engine/steps/read-find-many.d.ts +2 -2
  250. package/dist/engine/steps/read-find-one.d.ts +2 -2
  251. package/dist/engine/steps/retry.d.ts +1 -1
  252. package/dist/engine/steps/return.d.ts +2 -2
  253. package/dist/engine/steps/unsafe-projection-delete.d.ts +2 -2
  254. package/dist/engine/steps/unsafe-projection-upsert.d.ts +1 -1
  255. package/dist/engine/steps/wait-for-event.d.ts +1 -1
  256. package/dist/engine/steps/wait.d.ts +1 -1
  257. package/dist/engine/steps/webhook-send.d.ts +1 -1
  258. package/dist/engine/strip-disabled-features-from-app-schema.d.ts +4 -4
  259. package/dist/engine/system-user.d.ts +2 -2
  260. package/dist/engine/template-variables.d.ts +1 -1
  261. package/dist/engine/tier-resolver-extension.d.ts +4 -4
  262. package/dist/engine/transfer-adjacency.d.ts +1 -1
  263. package/dist/engine/types/index.d.ts +6 -6
  264. package/dist/engine/validate-projection-allowlist.d.ts +1 -1
  265. package/dist/engine/validation.d.ts +1 -1
  266. package/dist/entrypoint/index.d.ts +12 -12
  267. package/dist/env/dry-run.d.ts +14 -1
  268. package/dist/env/dry-run.js +50 -0
  269. package/dist/env/index.d.ts +54 -16
  270. package/dist/env/index.js +76 -7
  271. package/dist/errors/classes.d.ts +3 -3
  272. package/dist/errors/docs-url.d.ts +1 -1
  273. package/dist/errors/index.d.ts +18 -18
  274. package/dist/errors/member-resolution.d.ts +1 -1
  275. package/dist/errors/serialize.d.ts +2 -2
  276. package/dist/errors/subject-erased.d.ts +1 -1
  277. package/dist/errors/to-kumiko-error.d.ts +1 -1
  278. package/dist/errors/write-error-info.d.ts +1 -1
  279. package/dist/errors/zod-bridge.d.ts +1 -1
  280. package/dist/es-ops/context.d.ts +4 -4
  281. package/dist/es-ops/index.d.ts +4 -4
  282. package/dist/es-ops/operations-schema.d.ts +1 -1
  283. package/dist/es-ops/runner.d.ts +3 -3
  284. package/dist/es-ops/runner.js +9 -1
  285. package/dist/es-ops/types.d.ts +2 -2
  286. package/dist/event-store/admin-api.d.ts +3 -3
  287. package/dist/event-store/archive.d.ts +2 -2
  288. package/dist/event-store/event-store.d.ts +2 -2
  289. package/dist/event-store/events-schema.d.ts +1 -1
  290. package/dist/event-store/index.d.ts +15 -15
  291. package/dist/event-store/provenance-append.d.ts +3 -3
  292. package/dist/event-store/rebuild-dead-letter.d.ts +2 -2
  293. package/dist/event-store/row-to-stored-event.d.ts +2 -2
  294. package/dist/event-store/snapshot.d.ts +2 -2
  295. package/dist/event-store/tenant-db-append.d.ts +2 -2
  296. package/dist/event-store/transfer.d.ts +3 -3
  297. package/dist/event-store/upcaster-dead-letter.d.ts +2 -2
  298. package/dist/event-store/upcaster.d.ts +3 -3
  299. package/dist/files/assert-file-refs-belong-to-tenant.d.ts +2 -2
  300. package/dist/files/bind-pending-file-refs.d.ts +3 -3
  301. package/dist/files/create-file-ref-from-bytes.d.ts +4 -4
  302. package/dist/files/create-file-ref.d.ts +3 -3
  303. package/dist/files/dispose-removed-file-refs.d.ts +2 -2
  304. package/dist/files/feature.d.ts +3 -3
  305. package/dist/files/file-handle.d.ts +1 -1
  306. package/dist/files/file-ref-entity.d.ts +1 -1
  307. package/dist/files/file-ref-table.d.ts +1 -1
  308. package/dist/files/file-routes.d.ts +5 -5
  309. package/dist/files/in-memory-provider.d.ts +1 -1
  310. package/dist/files/index.d.ts +20 -20
  311. package/dist/files/load-save-file-refs.d.ts +2 -2
  312. package/dist/files/local-provider.d.ts +1 -1
  313. package/dist/files/provider-resolver.d.ts +5 -5
  314. package/dist/files/purge-expired-file-ref-bytes.d.ts +2 -2
  315. package/dist/files/record-read-check.d.ts +1 -1
  316. package/dist/files/record-write-check.d.ts +3 -3
  317. package/dist/files/storage-tracking.d.ts +2 -2
  318. package/dist/files/types.d.ts +1 -1
  319. package/dist/files/zip-stream.d.ts +1 -1
  320. package/dist/i18n/index.d.ts +4 -4
  321. package/dist/i18n/mail-registry.d.ts +1 -1
  322. package/dist/i18n/required-surface-keys.d.ts +1 -1
  323. package/dist/i18n/settings-hub-keys.d.ts +1 -1
  324. package/dist/internal/stack-support.d.ts +12 -12
  325. package/dist/internal/testing.d.ts +4 -4
  326. package/dist/jobs/index.d.ts +2 -2
  327. package/dist/jobs/job-runner.d.ts +1 -1
  328. package/dist/jobs/max-per-tenant.d.ts +1 -1
  329. package/dist/lifecycle/index.d.ts +2 -2
  330. package/dist/lifecycle/lifecycle.d.ts +1 -1
  331. package/dist/lifecycle/signal-handlers.d.ts +1 -1
  332. package/dist/logging/index.d.ts +4 -4
  333. package/dist/logging/pino-logger.d.ts +1 -1
  334. package/dist/logging/utils.d.ts +1 -1
  335. package/dist/migrations/index.d.ts +4 -4
  336. package/dist/migrations/kumiko-drift.d.ts +1 -1
  337. package/dist/migrations/pending-rebuilds.d.ts +5 -5
  338. package/dist/migrations/pii-event-backfill.d.ts +4 -4
  339. package/dist/migrations/projection-table-index.d.ts +1 -1
  340. package/dist/observability/console-provider.d.ts +1 -1
  341. package/dist/observability/context.d.ts +1 -1
  342. package/dist/observability/escape-hatch-report.d.ts +3 -3
  343. package/dist/observability/fallback.d.ts +1 -1
  344. package/dist/observability/index.d.ts +16 -16
  345. package/dist/observability/metric-validator.d.ts +1 -1
  346. package/dist/observability/metrics-handle.d.ts +1 -1
  347. package/dist/observability/metrics-wiring.d.ts +2 -2
  348. package/dist/observability/noop-provider.d.ts +1 -1
  349. package/dist/observability/prometheus-meter.d.ts +1 -1
  350. package/dist/observability/recording-meter.d.ts +1 -1
  351. package/dist/observability/recording-tracer.d.ts +1 -1
  352. package/dist/observability/redis-wrapper.d.ts +1 -1
  353. package/dist/observability/sensitive-filter.d.ts +1 -1
  354. package/dist/observability/standard-metrics.d.ts +1 -1
  355. package/dist/pipeline/active-membership.d.ts +4 -4
  356. package/dist/pipeline/append-event-core.d.ts +3 -3
  357. package/dist/pipeline/auth-claims-resolver.d.ts +2 -2
  358. package/dist/pipeline/cascade-handler.d.ts +3 -3
  359. package/dist/pipeline/dispatch-batch.d.ts +2 -2
  360. package/dist/pipeline/dispatch-query.d.ts +4 -4
  361. package/dist/pipeline/dispatch-shared.d.ts +17 -17
  362. package/dist/pipeline/dispatch-stream.d.ts +2 -2
  363. package/dist/pipeline/dispatch-write.d.ts +4 -4
  364. package/dist/pipeline/dispatcher-utils.d.ts +2 -2
  365. package/dist/pipeline/dispatcher.d.ts +12 -12
  366. package/dist/pipeline/event-consumer-state.d.ts +1 -1
  367. package/dist/pipeline/event-dispatcher-admin.d.ts +1 -1
  368. package/dist/pipeline/event-dispatcher-delivery.d.ts +7 -7
  369. package/dist/pipeline/event-dispatcher.d.ts +7 -7
  370. package/dist/pipeline/event-retention.d.ts +1 -1
  371. package/dist/pipeline/handler-access-error.d.ts +2 -2
  372. package/dist/pipeline/index.d.ts +42 -42
  373. package/dist/pipeline/irreversible-operation-gate.d.ts +1 -1
  374. package/dist/pipeline/lifecycle-pipeline.d.ts +2 -2
  375. package/dist/pipeline/member-read-only-transaction.d.ts +2 -2
  376. package/dist/pipeline/member-reader.d.ts +5 -5
  377. package/dist/pipeline/msp-rebuild.d.ts +4 -4
  378. package/dist/pipeline/multi-stream-apply-context.d.ts +3 -3
  379. package/dist/pipeline/notify-scope.d.ts +3 -3
  380. package/dist/pipeline/pending-gap-ranges.d.ts +2 -2
  381. package/dist/pipeline/pre-handler-gates.d.ts +3 -3
  382. package/dist/pipeline/pre-transaction-reservations.d.ts +4 -4
  383. package/dist/pipeline/projection-rebuild.d.ts +3 -3
  384. package/dist/pipeline/projection-state.d.ts +1 -1
  385. package/dist/pipeline/projections-runner.d.ts +3 -3
  386. package/dist/pipeline/projections-runner.js +3 -4
  387. package/dist/pipeline/system-hooks.d.ts +4 -4
  388. package/dist/pipeline/system-identity-switch.d.ts +3 -3
  389. package/dist/pipeline/tenant-timezone-cache.d.ts +1 -1
  390. package/dist/pipeline/write-origin.d.ts +3 -3
  391. package/dist/pipeline/write-result-masking.d.ts +2 -2
  392. package/dist/random/index.d.ts +2 -2
  393. package/dist/rate-limit/bucket.d.ts +1 -1
  394. package/dist/rate-limit/index.d.ts +3 -3
  395. package/dist/rate-limit/middleware.d.ts +3 -3
  396. package/dist/redis/cache-sync-bus.d.ts +2 -2
  397. package/dist/redis/cache-sync-topics.d.ts +1 -1
  398. package/dist/redis/index.d.ts +8 -8
  399. package/dist/redis/pubsub-signal.d.ts +1 -1
  400. package/dist/schema-cli.d.ts +1 -1
  401. package/dist/schema-cli.js +21 -2
  402. package/dist/search/derive-search-adapter-config.d.ts +2 -2
  403. package/dist/search/in-memory-adapter.d.ts +1 -1
  404. package/dist/search/index.d.ts +6 -6
  405. package/dist/search/meilisearch-adapter.d.ts +2 -2
  406. package/dist/search/purge-subject.d.ts +4 -4
  407. package/dist/search/reindex-entity.d.ts +3 -3
  408. package/dist/secrets/dek-cache.d.ts +1 -1
  409. package/dist/secrets/env-master-key-provider.d.ts +1 -1
  410. package/dist/secrets/env-master-key-provider.js +26 -11
  411. package/dist/secrets/envelope-cipher.d.ts +2 -2
  412. package/dist/secrets/envelope.d.ts +1 -1
  413. package/dist/secrets/index.d.ts +9 -9
  414. package/dist/secrets/rotation.d.ts +1 -1
  415. package/dist/secrets/stored-envelope.d.ts +1 -1
  416. package/dist/seeding/entity-seed.d.ts +1 -1
  417. package/dist/seeding/index.d.ts +3 -3
  418. package/dist/seeding/seed-users.d.ts +1 -1
  419. package/dist/time/index.d.ts +6 -6
  420. package/dist/ui-types/app-schema.d.ts +5 -5
  421. package/dist/ui-types/index.d.ts +23 -23
  422. package/dist/upgrade-cli.js +13 -3
  423. package/dist/utils/index.d.ts +9 -9
  424. package/package.json +19 -66
  425. package/presets/biome-app.json +80 -0
  426. package/presets/tsconfig.app.json +19 -0
  427. package/src/changes.json +84 -2
  428. package/src/scripts/codemod/README.md +18 -0
  429. package/src/scripts/codemod/codemod-support.ts +1 -1
  430. package/src/scripts/codemod/db-factory.ts +1 -1
  431. package/src/scripts/codemod/feature-factory.ts +1 -1
  432. package/src/scripts/codemod/import-extensions.ts +118 -0
  433. package/src/scripts/codemod/migrate-cross-tenant.ts +2 -2
  434. package/src/scripts/codemod/migrate-db-raw.ts +1 -1
  435. package/src/scripts/codemod/migrate-open-to-all.ts +1 -1
  436. package/src/scripts/codemod/object-form.ts +1 -1
  437. package/src/scripts/codemod/s3-imports.ts +1 -1
  438. package/src/scripts/codemod/tenant-db-options.ts +1 -1
  439. package/src/scripts/codemod/testing-move.ts +2 -2
  440. package/dist/db/bun-db-deprecated.d.ts +0 -10
  441. package/dist/db/bun-db-deprecated.js +0 -5
  442. package/dist/stack/index.d.ts +0 -10
  443. package/dist/stack/index.js +0 -11
  444. package/dist/testing/e2e-generator.d.ts +0 -5
  445. package/dist/testing/e2e-generator.js +0 -5
  446. package/dist/testing/handler-context.d.ts +0 -5
  447. package/dist/testing/handler-context.js +0 -5
  448. package/dist/testing/index.d.ts +0 -10
  449. package/dist/testing/index.js +0 -10
  450. package/dist/testing/real-providers.d.ts +0 -5
  451. package/dist/testing/real-providers.js +0 -5
@@ -1,6 +1,6 @@
1
1
  import { type WriteOrigin } from "@cosmicdrift/kumiko-types/event-store-types";
2
2
  import type { AgentRisk } from "@cosmicdrift/kumiko-types/handlers";
3
- import type { ErrorDocsConfig } from "../errors/docs-url.js";
3
+ import type { ErrorDocsConfig } from "../errors/docs-url.ts";
4
4
  export type RequestContextData = {
5
5
  readonly requestId: string;
6
6
  readonly correlationId: string;
@@ -1,7 +1,7 @@
1
1
  import type { Context, Next } from "hono";
2
- import type { ErrorDocsConfig } from "../errors/docs-url.js";
3
- import { type ClientIpResolver } from "./client-ip.js";
4
- import { type RequestContextData } from "./request-context.js";
2
+ import type { ErrorDocsConfig } from "../errors/docs-url.ts";
3
+ import { type ClientIpResolver } from "./client-ip.ts";
4
+ import { type RequestContextData } from "./request-context.ts";
5
5
  /**
6
6
  * Builds the RequestContextData record for a raw Fetch Request — requestId
7
7
  * (client-supplied + sanitized, or generated), correlationId (mirrors
@@ -1,8 +1,8 @@
1
1
  import { Hono, type MiddlewareHandler } from "hono";
2
- import type { DbConnection } from "../db/connection.js";
3
- import type { Lifecycle } from "../lifecycle/index.js";
4
- import type { Meter, PrometheusMeter } from "../observability/index.js";
5
- import type { EventConsumer } from "../pipeline/event-dispatcher.js";
2
+ import type { DbConnection } from "../db/connection.ts";
3
+ import type { Lifecycle } from "../lifecycle/index.ts";
4
+ import type { Meter, PrometheusMeter } from "../observability/index.ts";
5
+ import type { EventConsumer } from "../pipeline/event-dispatcher.ts";
6
6
  export declare const DEFAULT_MAX_REQUEST_BYTES = 1048576;
7
7
  export declare function registerBodyLimit(app: Hono, maxBytes: number): void;
8
8
  export declare function bodyLimitForRoutePath(path: string, maxBytes: number): readonly MiddlewareHandler[];
@@ -1,5 +1,5 @@
1
1
  import { type Context, Hono } from "hono";
2
- import type { Dispatcher } from "../pipeline/dispatcher.js";
2
+ import type { Dispatcher } from "../pipeline/dispatcher.ts";
3
3
  export declare const StreamFrame: {
4
4
  readonly chunk: "chunk";
5
5
  readonly ping: "ping";
@@ -1,21 +1,21 @@
1
1
  import type { CacheSyncBus } from "@cosmicdrift/kumiko-types/cache-sync-types";
2
2
  import { Hono } from "hono";
3
- import type { PgListenClient } from "../db/connection.js";
4
- import { type AppContext, type Registry, type RunIn, type WriteResult } from "../engine/types/index.js";
5
- import type { ErrorDocsConfig } from "../errors/docs-url.js";
6
- import type { Lifecycle } from "../lifecycle/index.js";
7
- import { type ObservabilityOptions, type ObservabilityProvider } from "../observability/index.js";
8
- import type { DispatcherOptions } from "../pipeline/dispatcher.js";
9
- import { type Dispatcher } from "../pipeline/dispatcher.js";
10
- import type { EventDedup } from "../pipeline/event-dedup.js";
11
- import type { EventDispatcher } from "../pipeline/event-dispatcher.js";
12
- import { type SystemHooks } from "../pipeline/lifecycle-pipeline.js";
13
- import { type AuthEndpointRateLimitOptions, type GlobalIpRateLimitOptions } from "../rate-limit/index.js";
14
- import { type AnonymousAccessResolved } from "./auth-middleware.js";
15
- import { type AuthRoutesConfig } from "./auth-routes.js";
16
- import { type ExtraRouteDefinition, type RoleDispatchArgs, type SystemDispatchArgs } from "./extra-route.js";
17
- import { type JwtHelper, type JwtKeyring } from "./jwt.js";
18
- import type { SseBroker } from "./sse-broker.js";
3
+ import type { PgListenClient } from "../db/connection.ts";
4
+ import { type AppContext, type Registry, type RunIn, type WriteResult } from "../engine/types/index.ts";
5
+ import type { ErrorDocsConfig } from "../errors/docs-url.ts";
6
+ import type { Lifecycle } from "../lifecycle/index.ts";
7
+ import { type ObservabilityOptions, type ObservabilityProvider } from "../observability/index.ts";
8
+ import type { DispatcherOptions } from "../pipeline/dispatcher.ts";
9
+ import { type Dispatcher } from "../pipeline/dispatcher.ts";
10
+ import type { EventDedup } from "../pipeline/event-dedup.ts";
11
+ import type { EventDispatcher } from "../pipeline/event-dispatcher.ts";
12
+ import { type SystemHooks } from "../pipeline/lifecycle-pipeline.ts";
13
+ import { type AuthEndpointRateLimitOptions, type GlobalIpRateLimitOptions } from "../rate-limit/index.ts";
14
+ import { type AnonymousAccessResolved } from "./auth-middleware.ts";
15
+ import { type AuthRoutesConfig } from "./auth-routes.ts";
16
+ import { type ExtraRouteDefinition, type RoleDispatchArgs, type SystemDispatchArgs } from "./extra-route.ts";
17
+ import { type JwtHelper, type JwtKeyring } from "./jwt.ts";
18
+ import type { SseBroker } from "./sse-broker.ts";
19
19
  export type ServerOptions = {
20
20
  registry: Registry;
21
21
  context: AppContext;
@@ -1,4 +1,4 @@
1
- import type { SessionUser } from "../engine/types/index.js";
1
+ import type { SessionUser } from "../engine/types/index.ts";
2
2
  export type SseClient = {
3
3
  id: string;
4
4
  send: (event: SseEvent) => void;
@@ -1,5 +1,5 @@
1
1
  import { Hono } from "hono";
2
- import { type SseBroker } from "./sse-broker.js";
2
+ import { type SseBroker } from "./sse-broker.ts";
3
3
  /**
4
4
  * Heartbeat-Cadence für SSE-Streams.
5
5
  *
@@ -1,7 +1,7 @@
1
1
  import { WEBSOCKET_BACKPRESSURE_LIMIT_BYTES, WEBSOCKET_DEFAULT_MAX_CONNECTIONS_PER_USER, WEBSOCKET_DEFAULT_MAX_MESSAGE_BYTES, WEBSOCKET_MAX_PAYLOAD_BYTES, WEBSOCKET_ROUTE_PATH_PREFIX, type WebSocketMessageData, type WebSocketSessionHandlers } from "@cosmicdrift/kumiko-types/websocket-route";
2
- import type { SessionUser } from "../engine/types/index.js";
3
- import { type AuthSessionChecker, type TenantLifecycleStatusResolver } from "./auth-middleware.js";
4
- import { type RequestContextData } from "./request-context.js";
2
+ import type { SessionUser } from "../engine/types/index.ts";
3
+ import { type AuthSessionChecker, type TenantLifecycleStatusResolver } from "./auth-middleware.ts";
4
+ import { type RequestContextData } from "./request-context.ts";
5
5
  export { WEBSOCKET_BACKPRESSURE_LIMIT_BYTES, WEBSOCKET_DEFAULT_MAX_CONNECTIONS_PER_USER, WEBSOCKET_DEFAULT_MAX_MESSAGE_BYTES, WEBSOCKET_MAX_PAYLOAD_BYTES, WEBSOCKET_ROUTE_PATH_PREFIX, };
6
6
  export declare const WEBSOCKET_HEARTBEAT_INTERVAL_MS = 25000;
7
7
  export declare const WEBSOCKET_PENDING_BUFFER_LIMIT_BYTES: number;
@@ -1,2 +1,2 @@
1
- export type { Role } from "./roles.js";
2
- export { ROLES } from "./roles.js";
1
+ export type { Role } from "./roles.ts";
2
+ export { ROLES } from "./roles.ts";
@@ -1,5 +1,5 @@
1
- import { getTemporal } from "../time/index.js";
2
- import type { DurationSpec, RetentionSpec } from "./profiles.js";
1
+ import { getTemporal } from "../time/index.ts";
2
+ import type { DurationSpec, RetentionSpec } from "./profiles.ts";
3
3
  type Instant = InstanceType<ReturnType<typeof getTemporal>["Instant"]>;
4
4
  export declare function durationSpecToMs(spec: DurationSpec): number;
5
5
  export declare function addDurationSpec(now: Instant, spec: DurationSpec): Instant;
@@ -1,6 +1,6 @@
1
- export { addDurationSpec, describeDurationSpec, durationSpecToMs, subtractRetentionSpec, } from "./duration-spec.js";
2
- export { complianceProfileOverrideSchema } from "./override-schema.js";
3
- export type { AuthorityNotificationDeadline, ComplianceProfile, ComplianceProfileKey, ComplianceProfileOverride, DurationSpec, EffectiveComplianceProfile, RetentionSpec, UserNotificationRequiredPolicy, } from "./profiles.js";
4
- export { COMPLIANCE_PROFILES, OVERRIDABLE_PROFILE_KEYS, resolveComplianceProfile, SELECTABLE_PROFILE_KEYS, } from "./profiles.js";
5
- export type { BundleTier, SubProcessor } from "./sub-processors.js";
6
- export { getActiveSubProcessors, getPlannedSubProcessors, KUMIKO_SUB_PROCESSORS, } from "./sub-processors.js";
1
+ export { addDurationSpec, describeDurationSpec, durationSpecToMs, subtractRetentionSpec, } from "./duration-spec.ts";
2
+ export { complianceProfileOverrideSchema } from "./override-schema.ts";
3
+ export type { AuthorityNotificationDeadline, ComplianceProfile, ComplianceProfileKey, ComplianceProfileOverride, DurationSpec, EffectiveComplianceProfile, RetentionSpec, UserNotificationRequiredPolicy, } from "./profiles.ts";
4
+ export { COMPLIANCE_PROFILES, OVERRIDABLE_PROFILE_KEYS, resolveComplianceProfile, SELECTABLE_PROFILE_KEYS, } from "./profiles.ts";
5
+ export type { BundleTier, SubProcessor } from "./sub-processors.ts";
6
+ export { getActiveSubProcessors, getPlannedSubProcessors, KUMIKO_SUB_PROCESSORS, } from "./sub-processors.ts";
@@ -1,4 +1,4 @@
1
- import type { BundleTier } from "./sub-processors.js";
1
+ import type { BundleTier } from "./sub-processors.ts";
2
2
  export type ComplianceProfileKey = "eu-dsgvo" | "swiss-dsg" | "de-hr-dsgvo-hgb" | "minimal-no-region";
3
3
  export type DurationSpec = {
4
4
  readonly days: number;
@@ -0,0 +1,44 @@
1
+ import type { FeatureDefinition } from "../engine/types/index.ts";
2
+ export type AppInfraPorts = {
3
+ readonly postgres?: number;
4
+ readonly redis?: number;
5
+ readonly meilisearch?: number;
6
+ /** S3 mock (MinIO) used by integration and E2E runs. */
7
+ readonly s3?: number;
8
+ };
9
+ export type AppPorts = {
10
+ /** `bun run dev` listens here. */
11
+ readonly dev: number;
12
+ /** The E2E server (playwright.config.ts webServer) listens here. */
13
+ readonly e2e: number;
14
+ /** Local infrastructure of this app. One port per app, so parallel E2E runs
15
+ * of several apps never share a Meilisearch or Postgres. */
16
+ readonly infra?: AppInfraPorts;
17
+ };
18
+ export type AppClientConfig = {
19
+ /** Client bundle entry files, relative to the app root (e.g. "src/client.tsx"). */
20
+ readonly entries: readonly string[];
21
+ };
22
+ export type AppConfig = {
23
+ /** Features mounted in every environment: dev, tests, prod. */
24
+ readonly features: readonly FeatureDefinition[];
25
+ /** Features mounted only in production on top of `features`. */
26
+ readonly prodFeatures?: readonly FeatureDefinition[];
27
+ readonly client: AppClientConfig;
28
+ readonly ports: AppPorts;
29
+ };
30
+ export declare const APP_CONFIG_FILE = "kumiko.config.ts";
31
+ declare const INFRA_PORT_NAMES: readonly ["postgres", "redis", "meilisearch", "s3"];
32
+ export type AppPortRole = "dev" | "e2e" | (typeof INFRA_PORT_NAMES)[number];
33
+ export type AppPortEntry = {
34
+ readonly role: AppPortRole;
35
+ readonly port: number;
36
+ };
37
+ /** Every port the app claims, in a stable order. */
38
+ export declare function listAppPorts(ports: AppPorts): readonly AppPortEntry[];
39
+ /** Problems with the declared ports: out of range or claimed twice by this app. */
40
+ export declare function findAppPortProblems(ports: AppPorts): readonly string[];
41
+ export declare function defineAppConfig(config: AppConfig): AppConfig;
42
+ /** The full feature list prod boots with: `features` plus `prodFeatures`. */
43
+ export declare function allAppFeatures(config: Pick<AppConfig, "features" | "prodFeatures">): readonly FeatureDefinition[];
44
+ export {};
@@ -0,0 +1,61 @@
1
+ export const APP_CONFIG_FILE = "kumiko.config.ts";
2
+ const INFRA_PORT_NAMES = [
3
+ "postgres",
4
+ "redis",
5
+ "meilisearch",
6
+ "s3",
7
+ ];
8
+ /** Every port the app claims, in a stable order. */
9
+ export function listAppPorts(ports) {
10
+ const entries = [
11
+ { role: "dev", port: ports.dev },
12
+ { role: "e2e", port: ports.e2e },
13
+ ];
14
+ for (const role of INFRA_PORT_NAMES) {
15
+ const port = ports.infra?.[role];
16
+ if (port !== undefined)
17
+ entries.push({ role, port });
18
+ }
19
+ return entries;
20
+ }
21
+ function isValidPort(port) {
22
+ return Number.isInteger(port) && port >= 1 && port <= 65535;
23
+ }
24
+ /** Problems with the declared ports: out of range or claimed twice by this app. */
25
+ export function findAppPortProblems(ports) {
26
+ const problems = [];
27
+ const owners = new Map();
28
+ for (const { role, port } of listAppPorts(ports)) {
29
+ if (!isValidPort(port)) {
30
+ problems.push(`ports.${role} must be an integer in 1..65535, got ${port}`);
31
+ continue;
32
+ }
33
+ const owner = owners.get(port);
34
+ if (owner !== undefined)
35
+ problems.push(`ports.${role} reuses port ${port} of ports.${owner}`);
36
+ else
37
+ owners.set(port, role);
38
+ }
39
+ return problems;
40
+ }
41
+ // Entries end up in the server's bundle list and in generated files, so only
42
+ // plain relative paths inside the app are accepted.
43
+ const CLIENT_ENTRY_RE = /^(?!\/)(?!.*\.\.)[A-Za-z0-9_./-]+\.(ts|tsx)$/;
44
+ export function defineAppConfig(config) {
45
+ const problems = [...findAppPortProblems(config.ports)];
46
+ if (config.client.entries.length === 0)
47
+ problems.push("client.entries must name at least one entry");
48
+ for (const entry of config.client.entries) {
49
+ if (!CLIENT_ENTRY_RE.test(entry)) {
50
+ problems.push(`client.entries: "${entry}" must be a relative .ts/.tsx path inside the app`);
51
+ }
52
+ }
53
+ if (problems.length > 0) {
54
+ throw new Error(`defineAppConfig: ${problems.join("; ")}`);
55
+ }
56
+ return config;
57
+ }
58
+ /** The full feature list prod boots with: `features` plus `prodFeatures`. */
59
+ export function allAppFeatures(config) {
60
+ return [...config.features, ...(config.prodFeatures ?? [])];
61
+ }
@@ -1,4 +1,4 @@
1
- import type { EntityDefinition } from "../engine/types/fields.js";
1
+ import type { EntityDefinition } from "../engine/types/fields.ts";
2
2
  export declare function computeBlindIndex(key: Uint8Array, plaintext: string): string;
3
3
  export declare function decodeBlindIndexKey(base64Key: string): Uint8Array;
4
4
  export declare function configureBlindIndexKey(base64Key: string | undefined): void;
@@ -1,5 +1,5 @@
1
1
  import type { EventPiiFields } from "@cosmicdrift/kumiko-types/handlers";
2
- import { type EventSubjectEnvelope } from "./subject-resolver.js";
2
+ import { type EventSubjectEnvelope } from "./subject-resolver.ts";
3
3
  export type EventPiiCatalog = ReadonlyMap<string, EventPiiFields>;
4
4
  export declare function configureEventPiiCatalog(next: EventPiiCatalog): void;
5
5
  export declare function configuredEventPiiCatalog(): EventPiiCatalog;
@@ -1,4 +1,4 @@
1
- import { type KmsHealth, type LocalKeyKmsAdapter, type SubjectDek, type SubjectId } from "./kms-adapter.js";
1
+ import { type KmsHealth, type LocalKeyKmsAdapter, type SubjectDek, type SubjectId } from "./kms-adapter.ts";
2
2
  export declare class InMemoryKmsAdapter implements LocalKeyKmsAdapter {
3
3
  readonly capabilities: {
4
4
  readonly mode: "local-key";
@@ -1,11 +1,11 @@
1
- export { blindIndexFieldName, collectLookupableFields, computeBlindIndex, computeBlindIndexValues, configureBlindIndexKey, configuredBlindIndexKey, decodeBlindIndexKey, } from "./blind-index.js";
2
- export { configuredEventPiiCatalog, configureEventPiiCatalog, type EventPiiCatalog, encryptEventPayloadPii, } from "./event-pii.js";
3
- export { InMemoryKmsAdapter } from "./in-memory-kms-adapter.js";
4
- export { isSelfPiiField } from "./is-self-pii-field.js";
5
- export { type KekSourceEnv, type KekSourceOptions, resolvePlatformKeks } from "./kek-source.js";
6
- export { isLocalKeyKmsAdapter, KeyAlreadyExistsError, KeyErasedError, KeyNotFoundError, type KmsAdapter, type KmsContext, type KmsHealth, type LocalKeyKmsAdapter, RECORD_ENTITY_PATTERN, type RemoteCryptoKmsAdapter, type SubjectDek, type SubjectId, type SubjectKey, subjectIdFromKey, subjectIdSchema, subjectIdToKey, subjectKeyForRecord, subjectKeyForTenant, subjectKeyForUser, } from "./kms-adapter.js";
7
- export { type ActiveKmsWiring, buildPgKmsOptions, type KmsWiring, type KmsWiringEnv, type KmsWiringOptions, type KmsWiringRelease, type PgKmsRotationEnv, type PlaintextPiiWiring, requireKmsWiring, requireKmsWiringAsync, resolveKmsWiring, resolveKmsWiringAsync, } from "./kms-wiring.js";
8
- export { createPgKmsAdapter, PgKmsAdapter, type PgKmsAdapterOptions, type RewrapOptions, type RewrapResult, rewrapSubjectKeys, } from "./pg-kms-adapter.js";
9
- export { configuredPiiSubjectKms, configurePiiSubjectKms, decryptPiiFieldValues, decryptPiiValueForSubject, type EncryptPiiOptions, encryptPiiFieldValues, encryptPiiJsonValueForSubject, encryptPiiValueForSubject, isPiiCiphertext, PII_CIPHERTEXT_PREFIX, PII_CIPHERTEXT_PREFIX_JSON, PII_ERASED_SENTINEL, } from "./pii-field-encryption.js";
10
- export { createRequestKmsCache, type RequestKmsCache, } from "./request-kms-cache.js";
11
- export { collectPiiEncryptedFields, collectPiiSubjectFields, collectSearchableSubjectFields, isRecordKeyedField, type ResolveSubjectOptions, resolveSubjectForField, SubjectResolutionError, } from "./subject-resolver.js";
1
+ export { blindIndexFieldName, collectLookupableFields, computeBlindIndex, computeBlindIndexValues, configureBlindIndexKey, configuredBlindIndexKey, decodeBlindIndexKey, } from "./blind-index.ts";
2
+ export { configuredEventPiiCatalog, configureEventPiiCatalog, type EventPiiCatalog, encryptEventPayloadPii, } from "./event-pii.ts";
3
+ export { InMemoryKmsAdapter } from "./in-memory-kms-adapter.ts";
4
+ export { isSelfPiiField } from "./is-self-pii-field.ts";
5
+ export { type KekSourceEnv, type KekSourceOptions, resolvePlatformKeks } from "./kek-source.ts";
6
+ export { isLocalKeyKmsAdapter, KeyAlreadyExistsError, KeyErasedError, KeyNotFoundError, type KmsAdapter, type KmsContext, type KmsHealth, type LocalKeyKmsAdapter, RECORD_ENTITY_PATTERN, type RemoteCryptoKmsAdapter, type SubjectDek, type SubjectId, type SubjectKey, subjectIdFromKey, subjectIdSchema, subjectIdToKey, subjectKeyForRecord, subjectKeyForTenant, subjectKeyForUser, } from "./kms-adapter.ts";
7
+ export { type ActiveKmsWiring, buildPgKmsOptions, type KmsWiring, type KmsWiringEnv, type KmsWiringOptions, type KmsWiringRelease, type PgKmsRotationEnv, type PlaintextPiiWiring, requireKmsWiring, requireKmsWiringAsync, resolveKmsWiring, resolveKmsWiringAsync, } from "./kms-wiring.ts";
8
+ export { createPgKmsAdapter, PgKmsAdapter, type PgKmsAdapterOptions, type RewrapOptions, type RewrapResult, rewrapSubjectKeys, } from "./pg-kms-adapter.ts";
9
+ export { configuredPiiSubjectKms, configurePiiSubjectKms, decryptPiiFieldValues, decryptPiiValueForSubject, type EncryptPiiOptions, encryptPiiFieldValues, encryptPiiJsonValueForSubject, encryptPiiValueForSubject, isPiiCiphertext, PII_CIPHERTEXT_PREFIX, PII_CIPHERTEXT_PREFIX_JSON, PII_ERASED_SENTINEL, } from "./pii-field-encryption.ts";
10
+ export { createRequestKmsCache, type RequestKmsCache, } from "./request-kms-cache.ts";
11
+ export { collectPiiEncryptedFields, collectPiiSubjectFields, collectSearchableSubjectFields, isRecordKeyedField, type ResolveSubjectOptions, resolveSubjectForField, SubjectResolutionError, } from "./subject-resolver.ts";
@@ -1,4 +1,4 @@
1
- import type { EntityDefinition } from "../engine/types/fields.js";
1
+ import type { EntityDefinition } from "../engine/types/fields.ts";
2
2
  type AnyField = EntityDefinition["fields"][string];
3
3
  /** True when the field's own row id is the PII subject (`pii: true`). */
4
4
  export declare function isSelfPiiField(field: AnyField): boolean;
@@ -1,5 +1,5 @@
1
- import { type KekSourceOptions } from "./kek-source.js";
2
- import { type PgKmsAdapter, type PgKmsAdapterOptions } from "./pg-kms-adapter.js";
1
+ import { type KekSourceOptions } from "./kek-source.ts";
2
+ import { type PgKmsAdapter, type PgKmsAdapterOptions } from "./pg-kms-adapter.ts";
3
3
  export type KmsWiringEnv = {
4
4
  readonly PLATFORM_KEK?: string | undefined;
5
5
  readonly SUBJECT_KEYS_DATABASE_URL?: string | undefined;
@@ -1,3 +1,3 @@
1
- import type { EntityDefinition } from "../engine/types/fields.js";
1
+ import type { EntityDefinition } from "../engine/types/fields.ts";
2
2
  export declare function isPlainUserOwnedField(field: EntityDefinition["fields"][string]): boolean;
3
3
  export declare function personalFieldsRekeyedOnOwnerTransition(entity: EntityDefinition, previous: Record<string, unknown>, mergedNew: Record<string, unknown>, submittedChanges: Record<string, unknown>): Record<string, unknown>;
@@ -1,4 +1,4 @@
1
- import { type KmsContext, type KmsHealth, type LocalKeyKmsAdapter, type SubjectDek, type SubjectId } from "./kms-adapter.js";
1
+ import { type KmsContext, type KmsHealth, type LocalKeyKmsAdapter, type SubjectDek, type SubjectId } from "./kms-adapter.ts";
2
2
  export interface PgKmsAdapterOptions {
3
3
  /** Connection string of the DEDICATED subject-keys cluster — never the app DB (its backup retention must stay shorter, see kms-adapter.md). */
4
4
  readonly databaseUrl: string;
@@ -1,7 +1,7 @@
1
- import type { EntityDefinition } from "../engine/types/fields.js";
2
- import type { TenantId } from "../engine/types/identifiers.js";
3
- import { type KmsAdapter, type KmsContext, type LocalKeyKmsAdapter, PII_ERASED_SENTINEL, type SubjectId } from "./kms-adapter.js";
4
- import { isPiiCiphertext, PII_CIPHERTEXT_PREFIX, PII_CIPHERTEXT_PREFIX_JSON } from "./pii-ciphertext-format.js";
1
+ import type { EntityDefinition } from "../engine/types/fields.ts";
2
+ import type { TenantId } from "../engine/types/identifiers.ts";
3
+ import { type KmsAdapter, type KmsContext, type LocalKeyKmsAdapter, PII_ERASED_SENTINEL, type SubjectId } from "./kms-adapter.ts";
4
+ import { isPiiCiphertext, PII_CIPHERTEXT_PREFIX, PII_CIPHERTEXT_PREFIX_JSON } from "./pii-ciphertext-format.ts";
5
5
  export { isPiiCiphertext, PII_CIPHERTEXT_PREFIX, PII_CIPHERTEXT_PREFIX_JSON, PII_ERASED_SENTINEL };
6
6
  export declare function piiCiphertextSubject(value: string): SubjectId;
7
7
  export declare function encryptPiiValueForSubject(kms: LocalKeyKmsAdapter, subject: SubjectId, value: string, kmsCtx: KmsContext, field: string): Promise<string>;
@@ -1,4 +1,4 @@
1
- import type { KmsContext, LocalKeyKmsAdapter, SubjectDek, SubjectId } from "./kms-adapter.js";
1
+ import type { KmsContext, LocalKeyKmsAdapter, SubjectDek, SubjectId } from "./kms-adapter.ts";
2
2
  export interface RequestKmsCache {
3
3
  getKey(subject: SubjectId, ctx: KmsContext): Promise<SubjectDek>;
4
4
  /** Drops one subject's cached DEK — called when its key is shredded mid-request. */
@@ -1,7 +1,7 @@
1
1
  import { type EventPiiSubject } from "@cosmicdrift/kumiko-types/handlers";
2
- import type { EntityDefinition } from "../engine/types/fields.js";
3
- import type { TenantId } from "../engine/types/identifiers.js";
4
- import { type SubjectId } from "./kms-adapter.js";
2
+ import type { EntityDefinition } from "../engine/types/fields.ts";
3
+ import type { TenantId } from "../engine/types/identifiers.ts";
4
+ import { type SubjectId } from "./kms-adapter.ts";
5
5
  export declare class SubjectResolutionError extends Error {
6
6
  readonly fieldName: string;
7
7
  constructor(fieldName: string, reason: string);
@@ -1,7 +1,7 @@
1
- import type { EntityDefinition } from "../engine/types/index.js";
2
- import type { StoredEvent } from "../event-store/index.js";
3
- import type { DbRow, DbRunner } from "./connection.js";
4
- import type { TableColumns } from "./dialect.js";
1
+ import type { EntityDefinition } from "../engine/types/index.ts";
2
+ import type { StoredEvent } from "../event-store/index.ts";
3
+ import type { DbRow, DbRunner } from "./connection.ts";
4
+ import type { TableColumns } from "./dialect.ts";
5
5
  type Table = TableColumns<any>;
6
6
  export type AutoVerb = "created" | "updated" | "deleted" | "restored" | "forgotten";
7
7
  export type ApplyResult = {
@@ -1,7 +1,7 @@
1
- import type { TenantId } from "../engine/types/identifiers.js";
2
- import { NotFoundError } from "../errors/index.js";
3
- import type { DbConnection } from "./connection.js";
4
- import type { TenantDb } from "./tenant-db.js";
1
+ import type { TenantId } from "../engine/types/identifiers.ts";
2
+ import { NotFoundError } from "../errors/index.ts";
3
+ import type { DbConnection } from "./connection.ts";
4
+ import type { TenantDb } from "./tenant-db.ts";
5
5
  /**
6
6
  * Generic constraint helper: asserts a value exists in a table.
7
7
  * Returns a ready-to-return NotFoundError when the row is missing, or null
@@ -1,5 +1,5 @@
1
- import type { FeatureDefinition } from "../engine/types/index.js";
2
- import type { DbRunner } from "./connection.js";
1
+ import type { FeatureDefinition } from "../engine/types/index.ts";
2
+ import type { DbRunner } from "./connection.ts";
3
3
  export declare function nullBlindIndexesForSubject(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, subjectKey: string): Promise<void>;
4
4
  export declare function subjectRowExistsInTenant(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, subjectId: string, tenantId: string): Promise<boolean>;
5
5
  export declare function recordRowExistsInTenant(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, entityName: string, recordId: string, tenantId: string): Promise<boolean>;
@@ -1,3 +1,3 @@
1
- import type { FeatureDefinition } from "../engine/types/index.js";
2
- import { type EntityTableMeta } from "./entity-table-meta.js";
1
+ import type { FeatureDefinition } from "../engine/types/index.ts";
2
+ import { type EntityTableMeta } from "./entity-table-meta.ts";
3
3
  export declare function collectTableMetas(features: readonly FeatureDefinition[]): readonly EntityTableMeta[];
@@ -1,4 +1,4 @@
1
- import type { EntityDefinition } from "../engine/types/index.js";
1
+ import type { EntityDefinition } from "../engine/types/index.ts";
2
2
  /**
3
3
  * API-Form (combined) → DB-Form (flat). Wird vor jedem Insert/Update aufgerufen.
4
4
  */
@@ -1,8 +1,8 @@
1
- import type { EntityDefinition } from "../engine/index.js";
2
- import type { ConfigSeedDef, Registry } from "../engine/types/index.js";
3
- import type { EnvelopeCipher } from "../secrets/envelope-cipher.js";
4
- import type { DbConnection } from "./connection.js";
5
- import type { EntityTable } from "./table-builder.js";
1
+ import type { EntityDefinition } from "../engine/index.ts";
2
+ import type { ConfigSeedDef, Registry } from "../engine/types/index.ts";
3
+ import type { EnvelopeCipher } from "../secrets/envelope-cipher.ts";
4
+ import type { DbConnection } from "./connection.ts";
5
+ import type { EntityTable } from "./table-builder.ts";
6
6
  /**
7
7
  * Seed config values at boot time via the event-store executor.
8
8
  *
@@ -19,12 +19,7 @@ export type DbConnectionHandle = {
19
19
  close: () => Promise<void>;
20
20
  };
21
21
  export declare const DEFAULT_DB_CLOSE_TIMEOUT_SECONDS = 5;
22
- export declare function createDbConnection(options: CreateDbConnectionOptions): DbConnectionHandle;
23
- /**
24
- * @deprecated Positional form, use `createDbConnection({ url, ... })`. Run
25
- * `bun kumiko-upgrade --apply` to rewrite call sites. Removed in the first release after 2026-10-29.
26
- */
27
- export declare function createDbConnection(url: string, options?: DbConnectionOptions): DbConnectionHandle;
22
+ export declare function createDbConnection({ url, ...options }: CreateDbConnectionOptions): DbConnectionHandle;
28
23
  export declare function dbConnectionOptionsFromEnv(env?: Readonly<Record<string, string | undefined>>): DbConnectionOptions;
29
24
  export declare const DEFAULT_OUTSIDE_TRANSACTION_POOL_MAX = 3;
30
25
  export declare function outsideTransactionPoolOptionsFromEnv(env?: Readonly<Record<string, string | undefined>>): DbConnectionOptions;
@@ -4,13 +4,13 @@ import { readPositiveIntEnv } from "../utils/env-parse.js";
4
4
  // so a plain end() (no timeout = wait for queries to finish) hangs forever —
5
5
  // close() must always bound how long shutdown waits.
6
6
  export const DEFAULT_DB_CLOSE_TIMEOUT_SECONDS = 5;
7
- export function createDbConnection(urlOrOptions, legacyOptions = {}) {
8
- const { url, ...options } = typeof urlOrOptions === "string" ? { ...legacyOptions, url: urlOrOptions } : urlOrOptions;
7
+ export function createDbConnection({ url, ...options }) {
9
8
  const pgOptions = {};
10
9
  if (options.maxConnections !== undefined)
11
10
  pgOptions.max = options.maxConnections;
12
- if (options.idleTimeoutSeconds !== undefined)
11
+ if (options.idleTimeoutSeconds !== undefined) {
13
12
  pgOptions.idle_timeout = options.idleTimeoutSeconds;
13
+ }
14
14
  if (options.connectTimeoutSeconds !== undefined) {
15
15
  pgOptions.connect_timeout = options.connectTimeoutSeconds;
16
16
  }
@@ -22,10 +22,21 @@ export function createDbConnection(urlOrOptions, legacyOptions = {}) {
22
22
  return {
23
23
  db: client,
24
24
  client,
25
- close: () => client.end({ timeout: options.closeTimeoutSeconds ?? DEFAULT_DB_CLOSE_TIMEOUT_SECONDS }),
25
+ close: () => client.end({
26
+ timeout: options.closeTimeoutSeconds ?? DEFAULT_DB_CLOSE_TIMEOUT_SECONDS,
27
+ }),
26
28
  };
27
29
  }
30
+ // DB_PROVIDER=bun selected the removed Bun.SQL driver; ignoring it would boot
31
+ // postgres-js under a config that still claims Bun.SQL.
32
+ function assertNoRemovedDbProvider(env) {
33
+ const provider = env["DB_PROVIDER"];
34
+ if (provider !== undefined && provider !== "" && provider !== "postgres") {
35
+ throw new Error(`DB_PROVIDER="${provider}" is no longer supported: postgres-js is the only driver. Remove DB_PROVIDER from the environment.`);
36
+ }
37
+ }
28
38
  export function dbConnectionOptionsFromEnv(env = process.env) {
39
+ assertNoRemovedDbProvider(env);
29
40
  const opts = {};
30
41
  const max = readPositiveIntEnv(env, "DATABASE_POOL_MAX");
31
42
  const idle = readPositiveIntEnv(env, "DATABASE_POOL_IDLE_TIMEOUT");
@@ -1,6 +1,6 @@
1
1
  import { type ColumnHandle, type SchemaTable } from "@cosmicdrift/kumiko-types/schema-table-types";
2
2
  import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
3
- import type { PgType } from "./entity-table-meta.js";
3
+ import type { PgType } from "./entity-table-meta.ts";
4
4
  export type { ColumnHandle, SchemaTable } from "@cosmicdrift/kumiko-types/schema-table-types";
5
5
  export type TableColumns<_T = any> = SchemaTable;
6
6
  export type SelectQuery = any;
@@ -1,6 +1,6 @@
1
- import type { EntityDefinition, SessionUser } from "../engine/types/index.js";
2
- import { type ParentVisibilityOption } from "./parent-ref-clause.js";
3
- import type { TenantDb } from "./tenant-db.js";
1
+ import type { EntityDefinition, SessionUser } from "../engine/types/index.ts";
2
+ import { type ParentVisibilityOption } from "./parent-ref-clause.ts";
3
+ import type { TenantDb } from "./tenant-db.ts";
4
4
  export type EagerLoadEntityResolver = (entityName: string) => EntityDefinition | undefined;
5
5
  export type EagerloadedRow<T extends Record<string, unknown> = Record<string, unknown>> = T & {
6
6
  readonly _refs?: Readonly<Record<string, Record<string, unknown> | ReadonlyArray<Record<string, unknown>> | undefined>>;
@@ -1,6 +1,6 @@
1
- import type { EntityDefinition } from "../engine/types/index.js";
2
- import { type Logger } from "../logging/index.js";
3
- import type { EnvelopeCipher } from "../secrets/envelope-cipher.js";
1
+ import type { EntityDefinition } from "../engine/types/index.ts";
2
+ import { type Logger } from "../logging/index.ts";
3
+ import type { EnvelopeCipher } from "../secrets/envelope-cipher.ts";
4
4
  export declare function collectEncryptedFieldNames(entity: EntityDefinition): ReadonlySet<string>;
5
5
  export declare function isSensitiveLabelField(entity: EntityDefinition, field: string): boolean;
6
6
  export declare function isListFilterAllowed(entity: EntityDefinition, field: string, filter: {
@@ -170,12 +170,14 @@ export function validateEntityFieldEncryptionAvailable(env = process.env, bootCi
170
170
  if (bootCipher ?? injectedCipher)
171
171
  return;
172
172
  try {
173
+ // currentVersion() forces the keyring check: under KUMIKO_DRY_RUN_ENV the
174
+ // provider defers it past construction.
173
175
  createEnvMasterKeyProvider({
174
176
  env: {
175
177
  ...env,
176
178
  KUMIKO_SECRETS_MASTER_KEY_CURRENT_VERSION: env["KUMIKO_SECRETS_MASTER_KEY_CURRENT_VERSION"] ?? "1",
177
179
  },
178
- });
180
+ }).currentVersion();
179
181
  }
180
182
  catch (err) {
181
183
  const reason = err instanceof Error ? err.message : String(err);
@@ -1,4 +1,4 @@
1
- import type { Registry } from "../engine/index.js";
2
- import type { SchemaTable } from "./dialect.js";
3
- import { buildEntityTable } from "./table-builder.js";
1
+ import type { Registry } from "../engine/index.ts";
2
+ import type { SchemaTable } from "./dialect.ts";
3
+ import { buildEntityTable } from "./table-builder.ts";
4
4
  export declare function entityTableFromRegistry(registry: Registry, entityName: string, entity: Parameters<typeof buildEntityTable>[1]): SchemaTable;
@@ -1,7 +1,7 @@
1
1
  import type { EntityTenancy, TenancyBrand } from "@cosmicdrift/kumiko-types/tenancy-brand";
2
- import type { EntityDefinition } from "../engine/types/index.js";
3
- import type { BuildEntityTableMetaOptions, EntityTableMeta, UnmanagedTableInput } from "./entity-table-meta-types.js";
4
- export type { BuildEntityTableMetaOptions, ColumnMeta, CompositePrimaryKeyMeta, EntityTableMeta, IndexMeta, PgType, UnmanagedTableInput, } from "./entity-table-meta-types.js";
2
+ import type { EntityDefinition } from "../engine/types/index.ts";
3
+ import type { BuildEntityTableMetaOptions, EntityTableMeta, UnmanagedTableInput } from "./entity-table-meta-types.ts";
4
+ export type { BuildEntityTableMetaOptions, ColumnMeta, CompositePrimaryKeyMeta, EntityTableMeta, IndexMeta, PgType, UnmanagedTableInput, } from "./entity-table-meta-types.ts";
5
5
  export declare function resolveTableName(entityName: string, entity: EntityDefinition, featureName: string | undefined): string;
6
6
  /**
7
7
  * Derive EntityTableMeta from an EntityDefinition (base columns + field DDL).
@@ -1,12 +1,12 @@
1
- import type { WhereObject } from "../db/query.js";
2
- import type { EntityDefinition, EntityId, SessionUser, TenantId } from "../engine/types/index.js";
3
- import { type WriteFailure } from "../errors/index.js";
4
- import { type EventMetadata } from "../event-store/index.js";
5
- import type { EntityCache } from "../pipeline/entity-cache.js";
6
- import type { SearchAdapter } from "../search/types.js";
7
- import type { TableColumns } from "./dialect.js";
8
- import type { EventStoreExecutorOptions } from "./event-store-executor.js";
9
- import type { TenantDb } from "./tenant-db.js";
1
+ import type { WhereObject } from "../db/query.ts";
2
+ import type { EntityDefinition, EntityId, SessionUser, TenantId } from "../engine/types/index.ts";
3
+ import { type WriteFailure } from "../errors/index.ts";
4
+ import { type EventMetadata } from "../event-store/index.ts";
5
+ import type { EntityCache } from "../pipeline/entity-cache.ts";
6
+ import type { SearchAdapter } from "../search/types.ts";
7
+ import type { TableColumns } from "./dialect.ts";
8
+ import type { EventStoreExecutorOptions } from "./event-store-executor.ts";
9
+ import type { TenantDb } from "./tenant-db.ts";
10
10
  export type Table = TableColumns<any>;
11
11
  export declare function buildFilterWhere(field: string, op: "eq" | "ne" | "lt" | "gt" | "lte" | "gte" | "in", value: unknown): WhereObject | null;
12
12
  export declare function ownershipSubject(user: SessionUser, streamTenantId: TenantId | undefined): SessionUser;
@@ -1,5 +1,5 @@
1
- import type { EventStoreExecutor } from "./event-store-executor.js";
2
- import { type ExecutorContext } from "./event-store-executor-context.js";
1
+ import type { EventStoreExecutor } from "./event-store-executor.ts";
2
+ import { type ExecutorContext } from "./event-store-executor-context.ts";
3
3
  export declare function resolveListPagination(payload: {
4
4
  readonly limit?: unknown;
5
5
  readonly offset?: unknown;
@@ -1,3 +1,3 @@
1
- import { type EventStoreExecutor } from "./event-store-executor.js";
2
- import { type ExecutorContext } from "./event-store-executor-context.js";
1
+ import { type EventStoreExecutor } from "./event-store-executor.ts";
2
+ import { type ExecutorContext } from "./event-store-executor-context.ts";
3
3
  export declare function createWriteVerbs(ctx: ExecutorContext): Pick<EventStoreExecutor, "create" | "update" | "delete" | "forget" | "restore">;