@cosmicdrift/kumiko-framework 0.366.0 → 0.368.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/AGENTS.md +1 -7
  2. package/README.md +1 -1
  3. package/agents/examples/access-control.md +2 -2
  4. package/agents/examples/anonymous-access-multitenant.md +2 -2
  5. package/agents/examples/anonymous-access.md +3 -3
  6. package/agents/examples/apex-landing.md +1 -1
  7. package/agents/examples/apex-surface-auth.md +6 -7
  8. package/agents/examples/api-worker-split.md +7 -8
  9. package/agents/examples/auth-claims.md +2 -1
  10. package/agents/examples/auth-foundation-providers.md +3 -3
  11. package/agents/examples/auth-mfa.md +3 -4
  12. package/agents/examples/basic-entity.md +3 -4
  13. package/agents/examples/chat-channels.md +4 -4
  14. package/agents/examples/compliance-profiles-demo.md +2 -3
  15. package/agents/examples/cross-feature-events.md +4 -4
  16. package/agents/examples/crypto-shredding-hr.md +14 -9
  17. package/agents/examples/currencies-global.md +3 -4
  18. package/agents/examples/currencies-per-tenant.md +3 -4
  19. package/agents/examples/custom-fields-basic.md +2 -3
  20. package/agents/examples/custom-handlers.md +3 -5
  21. package/agents/examples/dashboard-stats.md +2 -3
  22. package/agents/examples/delivery-notifications.md +5 -6
  23. package/agents/examples/e2e-generator.md +1 -1
  24. package/agents/examples/embedded-entity-form.md +2 -3
  25. package/agents/examples/embedded.md +2 -3
  26. package/agents/examples/encrypted-tenant-config.md +5 -6
  27. package/agents/examples/error-contract.md +3 -4
  28. package/agents/examples/event-sourcing.md +19 -23
  29. package/agents/examples/feature-toggles.md +4 -4
  30. package/agents/examples/field-access.md +3 -4
  31. package/agents/examples/files-post-processing.md +12 -13
  32. package/agents/examples/golden-path.md +208 -0
  33. package/agents/examples/idempotency.md +2 -2
  34. package/agents/examples/inbound-mail-triage.md +7 -7
  35. package/agents/examples/lane-routing.md +3 -3
  36. package/agents/examples/ledger-banking.md +2 -3
  37. package/agents/examples/ledger-invoicing.md +2 -3
  38. package/agents/examples/legal-pages.md +1 -1
  39. package/agents/examples/lifecycle-hooks.md +3 -3
  40. package/agents/examples/managed-config.md +3 -4
  41. package/agents/examples/managed-pages.md +2 -2
  42. package/agents/examples/notes-history-basic.md +4 -5
  43. package/agents/examples/ownership.md +3 -5
  44. package/agents/examples/pdf-audit-export.md +2 -3
  45. package/agents/examples/pipeline-basics.md +2 -2
  46. package/agents/examples/public-share-token.md +3 -3
  47. package/agents/examples/rate-limiting.md +2 -1
  48. package/agents/examples/realtime-sse.md +2 -3
  49. package/agents/examples/record-detail-layout.md +1 -1
  50. package/agents/examples/reference-data.md +3 -3
  51. package/agents/examples/relations.md +2 -2
  52. package/agents/examples/screens-nav.md +1 -1
  53. package/agents/examples/search.md +2 -2
  54. package/agents/examples/secrets-demo.md +8 -8
  55. package/agents/examples/security-baseline.md +2 -2
  56. package/agents/examples/session-revocation.md +7 -8
  57. package/agents/examples/state-machine.md +181 -165
  58. package/agents/examples/tags-basic.md +2 -3
  59. package/agents/examples/tenant-isolation.md +2 -3
  60. package/agents/examples/tenant-settings.md +2 -2
  61. package/agents/examples/tier-admin.md +3 -4
  62. package/agents/examples/timezones.md +3 -3
  63. package/agents/examples/user-data-rights.md +22 -33
  64. package/agents/examples/user-profile.md +3 -3
  65. package/agents/examples/webhook-step.md +2 -3
  66. package/agents/examples/wizard-form.md +4 -5
  67. package/agents/examples/workflow-engine.md +7 -3
  68. package/agents/examples/writeform-section.md +1 -1
  69. package/agents/examples.md +1 -0
  70. package/agents/features.md +4 -4
  71. package/dist/consumer-cli.js +2 -3
  72. package/dist/crypto/index.d.ts +1 -1
  73. package/dist/crypto/index.js +1 -1
  74. package/dist/crypto/owner-transition-rekey.js +2 -0
  75. package/dist/crypto/pg-kms-adapter.js +1 -1
  76. package/dist/crypto/subject-resolver.d.ts +2 -0
  77. package/dist/crypto/subject-resolver.js +30 -15
  78. package/dist/db/bun-db-deprecated.d.ts +10 -0
  79. package/dist/{bun-db/index.js → db/bun-db-deprecated.js} +4 -3
  80. package/dist/db/config-seed.js +1 -1
  81. package/dist/db/connection.d.ts +23 -5
  82. package/dist/db/connection.js +10 -5
  83. package/dist/db/dialect.js +1 -1
  84. package/dist/db/entity-field-encryption.d.ts +5 -0
  85. package/dist/db/entity-field-encryption.js +29 -0
  86. package/dist/db/entity-table-meta.js +6 -5
  87. package/dist/db/event-store-executor-read.js +26 -5
  88. package/dist/db/index.d.ts +4 -4
  89. package/dist/db/index.js +1 -1
  90. package/dist/db/migrate-runner.js +1 -1
  91. package/dist/db/queries/backfill-pii.js +16 -9
  92. package/dist/db/queries/ddl.js +1 -1
  93. package/dist/db/queries/event-store.d.ts +2 -0
  94. package/dist/db/queries/event-store.js +26 -0
  95. package/dist/db/queries/seed-context.js +3 -3
  96. package/dist/db/queries/test-stack.js +1 -1
  97. package/dist/db/query.d.ts +105 -1
  98. package/dist/db/query.js +1450 -3
  99. package/dist/{stack/table-helpers.d.ts → db/table-push.d.ts} +5 -15
  100. package/dist/{stack/table-helpers.js → db/table-push.js} +6 -46
  101. package/dist/db/tenant-db.d.ts +11 -0
  102. package/dist/db/tenant-db.js +51 -12
  103. package/dist/derivatives/derivatives-context.d.ts +1 -1
  104. package/dist/derivatives/derivatives-context.js +1 -1
  105. package/dist/engine/boot-validator/gdpr-storage.js +3 -3
  106. package/dist/engine/boot-validator/pii-retention.js +3 -3
  107. package/dist/engine/boot-validator/record-owned.js +3 -3
  108. package/dist/engine/boot-validator/screens.js +8 -1
  109. package/dist/engine/bridge-stub.d.ts +4 -0
  110. package/dist/engine/bridge-stub.js +62 -0
  111. package/dist/engine/event-helpers.d.ts +2 -1
  112. package/dist/engine/event-helpers.js +1 -0
  113. package/dist/engine/feature-config-events-jobs.d.ts +4 -0
  114. package/dist/engine/feature-config-events-jobs.js +4 -2
  115. package/dist/engine/index.d.ts +1 -0
  116. package/dist/engine/index.js +1 -0
  117. package/dist/engine/registry-ingest.js +3 -0
  118. package/dist/engine/template-variables.d.ts +3 -0
  119. package/dist/engine/template-variables.js +3 -0
  120. package/dist/es-ops/operations-schema.js +1 -1
  121. package/dist/event-store/admin-api.js +1 -1
  122. package/dist/event-store/archive.js +1 -1
  123. package/dist/event-store/errors.d.ts +2 -1
  124. package/dist/event-store/errors.js +6 -2
  125. package/dist/event-store/event-store.js +17 -9
  126. package/dist/event-store/events-schema.js +1 -1
  127. package/dist/event-store/rebuild-dead-letter.js +3 -3
  128. package/dist/event-store/snapshot.js +1 -1
  129. package/dist/event-store/upcaster-dead-letter.js +3 -3
  130. package/dist/files/create-file-ref-from-bytes.d.ts +1 -0
  131. package/dist/files/create-file-ref-from-bytes.js +8 -3
  132. package/dist/files/file-routes.js +1 -1
  133. package/dist/internal/stack-support.d.ts +12 -0
  134. package/dist/internal/stack-support.js +12 -0
  135. package/dist/internal/testing.d.ts +4 -0
  136. package/dist/internal/testing.js +5 -0
  137. package/dist/jobs/job-runner.js +23 -11
  138. package/dist/migrations/pending-rebuilds.js +1 -1
  139. package/dist/migrations/pii-event-backfill.js +2 -2
  140. package/dist/pipeline/dispatch-shared.js +43 -23
  141. package/dist/pipeline/dispatch-write.js +6 -2
  142. package/dist/pipeline/dispatcher-utils.js +6 -2
  143. package/dist/pipeline/event-consumer-state.js +1 -1
  144. package/dist/pipeline/projection-rebuild.d.ts +1 -0
  145. package/dist/pipeline/projection-rebuild.js +1 -1
  146. package/dist/pipeline/projection-state.js +1 -1
  147. package/dist/pipeline/system-hooks.js +1 -1
  148. package/dist/schema-cli.js +3 -3
  149. package/dist/search/purge-subject.js +20 -10
  150. package/dist/seeding/index.d.ts +1 -0
  151. package/dist/seeding/index.js +1 -0
  152. package/dist/stack/index.d.ts +10 -9
  153. package/dist/stack/index.js +11 -19
  154. package/dist/testing/e2e-generator.d.ts +5 -49
  155. package/dist/testing/e2e-generator.js +5 -382
  156. package/dist/testing/handler-context.d.ts +5 -4
  157. package/dist/testing/handler-context.js +5 -69
  158. package/dist/testing/index.d.ts +10 -26
  159. package/dist/testing/index.js +10 -34
  160. package/dist/testing/real-providers.d.ts +5 -3
  161. package/dist/testing/real-providers.js +5 -21
  162. package/package.json +37 -9
  163. package/src/changes.json +70 -0
  164. package/src/scripts/codemod/README.md +43 -0
  165. package/src/scripts/codemod/codemod-support.ts +276 -0
  166. package/src/scripts/codemod/db-factory.ts +810 -0
  167. package/src/scripts/codemod/feature-factory.ts +429 -0
  168. package/src/scripts/codemod/s3-imports.ts +274 -0
  169. package/src/scripts/codemod/tenant-db-options.ts +454 -0
  170. package/src/scripts/codemod/testing-move-targets.ts +161 -0
  171. package/src/scripts/codemod/testing-move.ts +520 -0
  172. package/dist/bun-db/connection.d.ts +0 -17
  173. package/dist/bun-db/connection.js +0 -40
  174. package/dist/bun-db/index.d.ts +0 -4
  175. package/dist/bun-db/query.d.ts +0 -106
  176. package/dist/bun-db/query.js +0 -1457
  177. package/dist/db/api.d.ts +0 -19
  178. package/dist/db/api.js +0 -23
  179. package/dist/db/bun-provider.d.ts +0 -2
  180. package/dist/db/bun-provider.js +0 -28
  181. package/dist/db/postgres-provider.d.ts +0 -2
  182. package/dist/db/postgres-provider.js +0 -21
  183. package/dist/db/query-api.d.ts +0 -2
  184. package/dist/db/query-api.js +0 -6
  185. package/dist/stack/db.d.ts +0 -22
  186. package/dist/stack/db.js +0 -67
  187. package/dist/stack/drain-event-consumers.d.ts +0 -4
  188. package/dist/stack/drain-event-consumers.js +0 -51
  189. package/dist/stack/drain-jobs.d.ts +0 -22
  190. package/dist/stack/drain-jobs.js +0 -141
  191. package/dist/stack/event-collector.d.ts +0 -9
  192. package/dist/stack/event-collector.js +0 -12
  193. package/dist/stack/push-entity-projection-tables.d.ts +0 -24
  194. package/dist/stack/push-entity-projection-tables.js +0 -74
  195. package/dist/stack/redis.d.ts +0 -17
  196. package/dist/stack/redis.js +0 -52
  197. package/dist/stack/request-helper.d.ts +0 -35
  198. package/dist/stack/request-helper.js +0 -144
  199. package/dist/stack/test-stack.d.ts +0 -192
  200. package/dist/stack/test-stack.js +0 -429
  201. package/dist/testing/access-assertions.d.ts +0 -2
  202. package/dist/testing/access-assertions.js +0 -13
  203. package/dist/testing/assertions.d.ts +0 -10
  204. package/dist/testing/assertions.js +0 -22
  205. package/dist/testing/boot-validator-fixture.d.ts +0 -3
  206. package/dist/testing/boot-validator-fixture.js +0 -101
  207. package/dist/testing/closed-connection-error.d.ts +0 -7
  208. package/dist/testing/closed-connection-error.js +0 -46
  209. package/dist/testing/db-cleanup.d.ts +0 -9
  210. package/dist/testing/db-cleanup.js +0 -31
  211. package/dist/testing/expect-error.d.ts +0 -2
  212. package/dist/testing/expect-error.js +0 -22
  213. package/dist/testing/file-provider-contract.d.ts +0 -2
  214. package/dist/testing/file-provider-contract.js +0 -102
  215. package/dist/testing/http-cookies.d.ts +0 -7
  216. package/dist/testing/http-cookies.js +0 -47
  217. package/dist/testing/late-bound.d.ts +0 -9
  218. package/dist/testing/late-bound.js +0 -31
  219. package/dist/testing/manual-clock.d.ts +0 -14
  220. package/dist/testing/manual-clock.js +0 -12
  221. package/dist/testing/multipart-helper.d.ts +0 -22
  222. package/dist/testing/multipart-helper.js +0 -77
  223. package/dist/testing/mutable-master-key-provider.d.ts +0 -7
  224. package/dist/testing/mutable-master-key-provider.js +0 -35
  225. package/dist/testing/observability-recorder.d.ts +0 -9
  226. package/dist/testing/observability-recorder.js +0 -29
  227. package/dist/testing/seed.d.ts +0 -9
  228. package/dist/testing/seed.js +0 -21
  229. package/dist/testing/shared-entities.d.ts +0 -286
  230. package/dist/testing/shared-entities.js +0 -56
  231. package/dist/testing/utils.d.ts +0 -1
  232. package/dist/testing/utils.js +0 -1
  233. package/dist/testing/wait-for.d.ts +0 -20
  234. package/dist/testing/wait-for.js +0 -47
  235. package/dist/testing/without-ambient-temporal.d.ts +0 -5
  236. package/dist/testing/without-ambient-temporal.js +0 -17
  237. package/dist/testing/zip-fixture.d.ts +0 -1
  238. package/dist/testing/zip-fixture.js +0 -33
  239. /package/dist/{stack/test-users.d.ts → seeding/seed-users.d.ts} +0 -0
  240. /package/dist/{stack/test-users.js → seeding/seed-users.js} +0 -0
package/AGENTS.md CHANGED
@@ -309,19 +309,13 @@ Each `agents/examples/<name>.md` starts with the sample's README, then every
309
309
  source file with its path. `src/feature.ts` holds the feature;
310
310
  `src/__tests__/*.integration.test.ts` shows how it is tested. Samples inside
311
311
  the framework repo set up their stack with `setupTestStack` from
312
- `@cosmicdrift/kumiko-framework/stack` and create tables in the test. In an
312
+ `@cosmicdrift/kumiko-testing/stack` and create tables in the test. In an
313
313
  app, `setupAppTestStack` and `seedTenant` do that for you; keep the
314
314
  assertions, take the setup from your scaffolded integration test. Table
315
315
  setup in sample tests (`unsafeCreateEntityTable`, `createEventsTable`) and
316
316
  any raw `DELETE FROM` cleanup are framework internals. Never copy them;
317
317
  isolate tests with one tenant each.
318
318
 
319
- Some samples import from `@app/define`. That alias points at the generated
320
- `.kumiko/define.ts`, which re-exports the engine with event types narrowed to
321
- the app's own `r.defineEvent` declarations. `bun dev` and `bun run build`
322
- regenerate it; never edit it. Without it, import the same names from
323
- `@cosmicdrift/kumiko-framework/engine`.
324
-
325
319
  ## Package entry points
326
320
 
327
321
  Import only from these subpaths of `@cosmicdrift/kumiko-framework`. Deep
package/README.md CHANGED
@@ -93,7 +93,7 @@ export const taskFeature = defineFeature("tasks", (r) => {
93
93
  | `@cosmicdrift/kumiko-framework/files` | Signed-URL upload/download, tenant-scoped storage |
94
94
  | `@cosmicdrift/kumiko-framework/i18n` | i18next setup, per-feature translation registration |
95
95
  | `@cosmicdrift/kumiko-framework/ui` | React hooks (Zustand stores, SSE subscription, optimistic mutations) |
96
- | `@cosmicdrift/kumiko-framework/testing` | `setupTestStack`, `createTestDb`, request helpers |
96
+ | `@cosmicdrift/kumiko-testing/stack` | `setupTestStack`, `createTestDb`, request helpers |
97
97
  | `@cosmicdrift/kumiko-framework/utils` | Safe JSON, qualified-name helpers |
98
98
  | `@cosmicdrift/kumiko-framework/errors` | Error classes, `writeFailure`, reason contracts |
99
99
 
@@ -36,12 +36,12 @@ bun test
36
36
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
37
37
  import { defineFeature } from "@cosmicdrift/kumiko-framework/engine";
38
38
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
39
+ import { TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
39
40
  import {
40
41
  setupTestStack,
41
42
  type TestStack,
42
- TestUsers,
43
43
  unsafeCreateEntityTable,
44
- } from "@cosmicdrift/kumiko-framework/stack";
44
+ } from "@cosmicdrift/kumiko-testing/stack";
45
45
  import { z } from "zod";
46
46
  import {
47
47
  accessControlFeature,
@@ -41,12 +41,12 @@ import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:tes
41
41
  import { setTenantCookie } from "@cosmicdrift/kumiko-framework/api";
42
42
  import type { TenantId } from "@cosmicdrift/kumiko-framework/engine";
43
43
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
44
+ import { TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
44
45
  import {
45
46
  setupTestStack,
46
47
  type TestStack,
47
- TestUsers,
48
48
  unsafeCreateEntityTable,
49
- } from "@cosmicdrift/kumiko-framework/stack";
49
+ } from "@cosmicdrift/kumiko-testing/stack";
50
50
  import { multiTenantShopFeature, productEntity } from "../feature";
51
51
  import { createSubdomainResolver, extractSubdomain } from "../subdomain-resolver";
52
52
 
@@ -42,15 +42,15 @@ bun test
42
42
  // callback that confirms the tenant is real (against DB or cache).
43
43
 
44
44
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
45
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
45
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
46
46
  import { ANONYMOUS_USER_ID, type TenantId } from "@cosmicdrift/kumiko-framework/engine";
47
47
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
48
+ import { TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
48
49
  import {
49
50
  setupTestStack,
50
51
  type TestStack,
51
- TestUsers,
52
52
  unsafeCreateEntityTable,
53
- } from "@cosmicdrift/kumiko-framework/stack";
53
+ } from "@cosmicdrift/kumiko-testing/stack";
54
54
  import {
55
55
  anonymousAccessFeature,
56
56
  guestOrderEntity,
@@ -143,7 +143,7 @@ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
143
143
  import { createConfigFeature } from "@cosmicdrift/kumiko-bundled-features/config";
144
144
  import { createSeoFeature } from "@cosmicdrift/kumiko-bundled-features/seo";
145
145
  import { defineFeature, SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
146
- import { setupTestStack, type TestStack } from "@cosmicdrift/kumiko-framework/stack";
146
+ import { setupTestStack, type TestStack } from "@cosmicdrift/kumiko-testing/stack";
147
147
  import { renderLanding, SAMPLE_PLANS } from "../feature";
148
148
 
149
149
  const LANDING_URL = "https://tasklane.example/";
@@ -137,16 +137,15 @@ import {
137
137
  } from "@cosmicdrift/kumiko-bundled-features/compliance-profiles";
138
138
  import { USER_STATUS, userEntity, userTable } from "@cosmicdrift/kumiko-bundled-features/user";
139
139
  import type { SendDeletionVerificationEmailFn } from "@cosmicdrift/kumiko-bundled-features/user-data-rights";
140
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
140
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
141
141
  import { createEventsTable, eventsTable } from "@cosmicdrift/kumiko-framework/event-store";
142
+ import { createTestUser, testTenantId } from "@cosmicdrift/kumiko-framework/seeding";
143
+ import { resetTestTables, seedRow } from "@cosmicdrift/kumiko-testing/helpers";
142
144
  import {
143
- createTestUser,
144
145
  setupTestStack,
145
146
  type TestStack,
146
- testTenantId,
147
147
  unsafeCreateEntityTable,
148
- } from "@cosmicdrift/kumiko-framework/stack";
149
- import { resetTestTables, seedRow } from "@cosmicdrift/kumiko-framework/testing";
148
+ } from "@cosmicdrift/kumiko-testing/stack";
150
149
  import { composeApexAccountApp } from "../feature";
151
150
 
152
151
  const REQUEST_BY_EMAIL = "user-data-rights:write:request-deletion-by-email";
@@ -304,7 +303,7 @@ describe("apex-surface-auth recipe", () => {
304
303
  // anonymousAccess: { defaultTenantId: APEX_TENANT_ID } })
305
304
 
306
305
  import { createAuthEmailPasswordFeature } from "@cosmicdrift/kumiko-bundled-features/auth-email-password";
307
- import { authFoundationFeature } from "@cosmicdrift/kumiko-bundled-features/auth-foundation";
306
+ import { createAuthFoundationFeature } from "@cosmicdrift/kumiko-bundled-features/auth-foundation";
308
307
  import { createComplianceProfilesFeature } from "@cosmicdrift/kumiko-bundled-features/compliance-profiles";
309
308
  import { createConfigFeature } from "@cosmicdrift/kumiko-bundled-features/config";
310
309
  import { createDataRetentionFeature } from "@cosmicdrift/kumiko-bundled-features/data-retention";
@@ -342,7 +341,7 @@ export function composeApexAccountApp(opts: ApexAccountAppOptions): FeatureDefin
342
341
  createAuthEmailPasswordFeature(),
343
342
  createDataRetentionFeature(),
344
343
  createComplianceProfilesFeature(),
345
- authFoundationFeature,
344
+ createAuthFoundationFeature(),
346
345
  createPersonalAccessTokensFeature({ scopes: {} }),
347
346
  createSessionsFeature(),
348
347
  createUserDataRightsFeature({
@@ -97,8 +97,8 @@ before the worker picks up the job and writes the fulfillment back.
97
97
  // dispatcher (dispatchSystemWrite → orders:write:fulfillment:create).
98
98
 
99
99
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
100
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
101
- import { buildEntityTable } from "@cosmicdrift/kumiko-framework/db";
100
+
101
+ import { buildEntityTable, selectMany } from "@cosmicdrift/kumiko-framework/db";
102
102
  import { createRegistry } from "@cosmicdrift/kumiko-framework/engine";
103
103
  import {
104
104
  createApiEntrypoint,
@@ -109,17 +109,17 @@ import {
109
109
  createEventsTable,
110
110
  } from "@cosmicdrift/kumiko-framework/event-store";
111
111
  import { createEventConsumerStateTable } from "@cosmicdrift/kumiko-framework/pipeline";
112
+ import { TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
113
+ import { makeDispatchSystemWrite } from "@cosmicdrift/kumiko-server-runtime/extra-routes-deps";
114
+ import { waitFor } from "@cosmicdrift/kumiko-testing/helpers";
112
115
  import {
113
116
  createTestDb,
114
117
  createTestRedis,
115
118
  type TestDb,
116
119
  type TestRedis,
117
- TestUsers,
118
120
  unsafeCreateEntityTable,
119
121
  unsafePushTables,
120
- } from "@cosmicdrift/kumiko-framework/stack";
121
- import { waitFor } from "@cosmicdrift/kumiko-framework/testing";
122
- import { makeDispatchSystemWrite } from "@cosmicdrift/kumiko-server-runtime/extra-routes-deps";
122
+ } from "@cosmicdrift/kumiko-testing/stack";
123
123
  import {
124
124
  createApiWorkerSplitFeature,
125
125
  fulfillmentEntity,
@@ -278,8 +278,7 @@ describe("api-worker-split", () => {
278
278
  // dispatcher — JobContext has no write/query (fw#1717), so the app
279
279
  // wires a write-bridge at boot (see setOrderFulfillWrite below).
280
280
 
281
- import { insertOne } from "@cosmicdrift/kumiko-framework/bun-db";
282
- import { table, text, uuid } from "@cosmicdrift/kumiko-framework/db";
281
+ import { insertOne, table, text, uuid } from "@cosmicdrift/kumiko-framework/db";
283
282
  import {
284
283
  createEntity,
285
284
  createNumberField,
@@ -43,7 +43,8 @@ import { afterAll, beforeAll, beforeEach, describe, expect, mock, test } from "b
43
43
  import type { AuthClaimsContext } from "@cosmicdrift/kumiko-framework/engine";
44
44
  import { defineFeature, readClaim } from "@cosmicdrift/kumiko-framework/engine";
45
45
  import { resolveAuthClaims } from "@cosmicdrift/kumiko-framework/pipeline";
46
- import { setupTestStack, type TestStack, testTenantId } from "@cosmicdrift/kumiko-framework/stack";
46
+ import { testTenantId } from "@cosmicdrift/kumiko-framework/seeding";
47
+ import { setupTestStack, type TestStack } from "@cosmicdrift/kumiko-testing/stack";
47
48
  import {
48
49
  type BetaFlagStore,
49
50
  fakeSession,
@@ -33,7 +33,7 @@ bun test
33
33
  ```ts
34
34
  import { describe, expect, test } from "bun:test";
35
35
  import {
36
- authFoundationFeature,
36
+ createAuthFoundationFeature,
37
37
  resolveAnonymousAccessFromRegistry,
38
38
  resolveTenantExistence,
39
39
  resolveTenantResolver,
@@ -52,7 +52,7 @@ describe("auth-foundation-providers recipe", () => {
52
52
  existsById: async (id) => id === TENANT,
53
53
  trust: "authoritative",
54
54
  });
55
- const registry = createRegistry([authFoundationFeature, routing]);
55
+ const registry = createRegistry([createAuthFoundationFeature(), routing]);
56
56
 
57
57
  const resolved = await resolveTenantResolver({ db: fakeDb, registry });
58
58
  expect(resolved?.trust).toBe("authoritative");
@@ -87,7 +87,7 @@ describe("auth-foundation-providers recipe", () => {
87
87
  // What to copy:
88
88
  //
89
89
  // composeFeatures([
90
- // authFoundationFeature,
90
+ // createAuthFoundationFeature(),
91
91
  // createSubdomainTenantRoutingFeature({ lookupBySubdomain, existsById }),
92
92
  // …appFeatures,
93
93
  // ], { includeBundled: true })
@@ -110,15 +110,14 @@ import {
110
110
  } from "@cosmicdrift/kumiko-bundled-features/user";
111
111
  import { configureEntityFieldEncryption } from "@cosmicdrift/kumiko-framework/db";
112
112
  import type { TenantId } from "@cosmicdrift/kumiko-framework/engine";
113
+ import { TestUsers, testTenantId } from "@cosmicdrift/kumiko-framework/seeding";
114
+ import { createTestEnvelopeCipher } from "@cosmicdrift/kumiko-testing/helpers";
113
115
  import {
114
116
  setupTestStack,
115
117
  type TestStack,
116
- TestUsers,
117
- testTenantId,
118
118
  unsafeCreateEntityTable,
119
119
  unsafePushTables,
120
- } from "@cosmicdrift/kumiko-framework/stack";
121
- import { createTestEnvelopeCipher } from "@cosmicdrift/kumiko-framework/testing";
120
+ } from "@cosmicdrift/kumiko-testing/stack";
122
121
  import {
123
122
  AuthMfaHandlers,
124
123
  base32Decode,
@@ -82,14 +82,13 @@ soft-delete + restore, and per-verb access boundaries (Editor vs Admin).
82
82
  import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
83
83
  import type { SaveContext } from "@cosmicdrift/kumiko-framework/engine";
84
84
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
85
+ import { createTestUser, TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
86
+ import { expectErrorIncludes } from "@cosmicdrift/kumiko-testing/helpers";
85
87
  import {
86
- createTestUser,
87
88
  setupTestStack,
88
89
  type TestStack,
89
- TestUsers,
90
90
  unsafeCreateEntityTable,
91
- } from "@cosmicdrift/kumiko-framework/stack";
92
- import { expectErrorIncludes } from "@cosmicdrift/kumiko-framework/testing";
91
+ } from "@cosmicdrift/kumiko-testing/stack";
93
92
  import { taskEntity, taskFeature } from "../feature";
94
93
 
95
94
  let stack: TestStack;
@@ -61,17 +61,17 @@ import {
61
61
  tenantEntity,
62
62
  tenantMembershipsTable,
63
63
  } from "@cosmicdrift/kumiko-bundled-features/tenant";
64
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
64
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
65
65
  import { createJobRunner, type JobRunner } from "@cosmicdrift/kumiko-framework/jobs";
66
66
  import { createEnvMasterKeyProvider } from "@cosmicdrift/kumiko-framework/secrets";
67
+ import { createTestUser } from "@cosmicdrift/kumiko-framework/seeding";
68
+ import { waitFor } from "@cosmicdrift/kumiko-testing/helpers";
67
69
  import {
68
- createTestUser,
69
70
  setupTestStack,
70
71
  type TestStack,
71
72
  unsafeCreateEntityTable,
72
73
  unsafePushTables,
73
- } from "@cosmicdrift/kumiko-framework/stack";
74
- import { waitFor } from "@cosmicdrift/kumiko-framework/testing";
74
+ } from "@cosmicdrift/kumiko-testing/stack";
75
75
  import { OPS_ANNOUNCEMENT_TYPE, opsFeature } from "../feature";
76
76
 
77
77
  const admin = createTestUser({ roles: ["Admin", "TenantAdmin"] });
@@ -105,13 +105,12 @@ try interactively, mount `complianceProfilesDemoFeatures` in your own
105
105
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
106
106
  import { tenantComplianceProfileEntity } from "@cosmicdrift/kumiko-bundled-features/compliance-profiles";
107
107
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
108
+ import { createTestUser, testTenantId } from "@cosmicdrift/kumiko-framework/seeding";
108
109
  import {
109
- createTestUser,
110
110
  setupTestStack,
111
111
  type TestStack,
112
- testTenantId,
113
112
  unsafeCreateEntityTable,
114
- } from "@cosmicdrift/kumiko-framework/stack";
113
+ } from "@cosmicdrift/kumiko-testing/stack";
115
114
  import { complianceProfilesDemoFeatures } from "../feature";
116
115
 
117
116
  const SET_PROFILE = "compliance-profiles:write:set-profile";
@@ -88,15 +88,15 @@ bun kumiko test integration samples/cross-feature-events
88
88
  // callbacks. runOnce() drains deterministically.
89
89
 
90
90
  import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
91
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
91
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
92
92
  import { eventsTable } from "@cosmicdrift/kumiko-framework/event-store";
93
+ import { createTestUser } from "@cosmicdrift/kumiko-framework/seeding";
93
94
  import {
94
- createTestUser,
95
95
  resetEventStore,
96
96
  setupTestStack,
97
97
  type TestStack,
98
98
  unsafeCreateEntityTable,
99
- } from "@cosmicdrift/kumiko-framework/stack";
99
+ } from "@cosmicdrift/kumiko-testing/stack";
100
100
  import { capturedEvents, orderEntity, pubsubOrderFeature } from "../feature";
101
101
 
102
102
  let stack: TestStack;
@@ -229,7 +229,7 @@ import {
229
229
  defineFeature,
230
230
  emitEvent,
231
231
  typedPayload,
232
- } from "@app/define";
232
+ } from "@cosmicdrift/kumiko-framework/engine";
233
233
  import { z } from "zod";
234
234
 
235
235
  // --- Entity ---
@@ -92,7 +92,7 @@ deletion grace period.
92
92
  // subject's key was used, events untouched).
93
93
 
94
94
  import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
95
- import { asRawClient, fetchOne } from "@cosmicdrift/kumiko-framework/bun-db";
95
+
96
96
  import {
97
97
  configureBlindIndexKey,
98
98
  configurePiiSubjectKms,
@@ -101,20 +101,25 @@ import {
101
101
  PII_ERASED_SENTINEL,
102
102
  subjectIdToKey,
103
103
  } from "@cosmicdrift/kumiko-framework/crypto";
104
- import { buildEntityTable, nullBlindIndexesForSubject } from "@cosmicdrift/kumiko-framework/db";
104
+ import {
105
+ asRawClient,
106
+ buildEntityTable,
107
+ fetchOne,
108
+ nullBlindIndexesForSubject,
109
+ } from "@cosmicdrift/kumiko-framework/db";
105
110
  import type { SaveContext } from "@cosmicdrift/kumiko-framework/engine";
106
111
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
107
- import {
108
- setupTestStack,
109
- type TestStack,
110
- TestUsers,
111
- unsafeCreateEntityTable,
112
- } from "@cosmicdrift/kumiko-framework/stack";
112
+ import { TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
113
113
  import {
114
114
  resetBlindIndexKeyForTests,
115
115
  resetPiiSubjectKmsForTests,
116
116
  resetTestTables,
117
- } from "@cosmicdrift/kumiko-framework/testing";
117
+ } from "@cosmicdrift/kumiko-testing/helpers";
118
+ import {
119
+ setupTestStack,
120
+ type TestStack,
121
+ unsafeCreateEntityTable,
122
+ } from "@cosmicdrift/kumiko-testing/stack";
118
123
  import { employeeEntity, hrCommentEntity, hrFeature } from "../feature";
119
124
 
120
125
  let stack: TestStack;
@@ -52,14 +52,13 @@ bun test
52
52
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
53
53
  import { seedReferenceData } from "@cosmicdrift/kumiko-framework/db";
54
54
  import type { SaveContext } from "@cosmicdrift/kumiko-framework/engine";
55
+ import { createTestUser, TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
56
+ import { expectErrorIncludes } from "@cosmicdrift/kumiko-testing/helpers";
55
57
  import {
56
- createTestUser,
57
58
  setupTestStack,
58
59
  type TestStack,
59
- TestUsers,
60
60
  unsafeCreateEntityTable,
61
- } from "@cosmicdrift/kumiko-framework/stack";
62
- import { expectErrorIncludes } from "@cosmicdrift/kumiko-framework/testing";
61
+ } from "@cosmicdrift/kumiko-testing/stack";
63
62
  import { currencyEntity, currencyTable } from "../entities/currency";
64
63
  import { invoiceEntity } from "../entities/invoice";
65
64
  import { tenantCurrencyEntity } from "../entities/tenant-currency";
@@ -50,14 +50,13 @@ bun test
50
50
 
51
51
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
52
52
  import type { SaveContext } from "@cosmicdrift/kumiko-framework/engine";
53
+ import { createTestUser, TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
54
+ import { expectErrorIncludes } from "@cosmicdrift/kumiko-testing/helpers";
53
55
  import {
54
- createTestUser,
55
56
  setupTestStack,
56
57
  type TestStack,
57
- TestUsers,
58
58
  unsafeCreateEntityTable,
59
- } from "@cosmicdrift/kumiko-framework/stack";
60
- import { expectErrorIncludes } from "@cosmicdrift/kumiko-framework/testing";
59
+ } from "@cosmicdrift/kumiko-testing/stack";
61
60
  import { currencyEntity } from "../entities/currency";
62
61
  import { invoiceEntity } from "../entities/invoice";
63
62
  import { currenciesPerTenantFeature } from "../feature";
@@ -114,13 +114,12 @@ import {
114
114
  fieldDefinitionEntity,
115
115
  } from "@cosmicdrift/kumiko-bundled-features/custom-fields";
116
116
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
117
+ import { createTestUser, testTenantId } from "@cosmicdrift/kumiko-framework/seeding";
117
118
  import {
118
- createTestUser,
119
119
  setupTestStack,
120
120
  type TestStack,
121
- testTenantId,
122
121
  unsafeCreateEntityTable,
123
- } from "@cosmicdrift/kumiko-framework/stack";
122
+ } from "@cosmicdrift/kumiko-testing/stack";
124
123
  import { propertyEntity, propertyFeature } from "../feature";
125
124
 
126
125
  // Each test runs in its own tenant, so rows from other tests never show up.
@@ -65,15 +65,13 @@ bun kumiko test integration samples/custom-handlers
65
65
  import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
66
66
  import type { SaveContext } from "@cosmicdrift/kumiko-framework/engine";
67
67
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
68
+ import { createTestUser, TestUsers, testTenantId } from "@cosmicdrift/kumiko-framework/seeding";
69
+ import { expectErrorIncludes } from "@cosmicdrift/kumiko-testing/helpers";
68
70
  import {
69
- createTestUser,
70
71
  setupTestStack,
71
72
  type TestStack,
72
- TestUsers,
73
- testTenantId,
74
73
  unsafeCreateEntityTable,
75
- } from "@cosmicdrift/kumiko-framework/stack";
76
- import { expectErrorIncludes } from "@cosmicdrift/kumiko-framework/testing";
74
+ } from "@cosmicdrift/kumiko-testing/stack";
77
75
  import { counterEntity, counterFeature } from "../feature";
78
76
 
79
77
  let stack: TestStack;
@@ -57,13 +57,12 @@ bun kumiko test integration samples/dashboard-stats
57
57
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
58
58
  import type { SaveContext } from "@cosmicdrift/kumiko-framework/engine";
59
59
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
60
+ import { createTestUser, testTenantId } from "@cosmicdrift/kumiko-framework/seeding";
60
61
  import {
61
- createTestUser,
62
62
  setupTestStack,
63
63
  type TestStack,
64
- testTenantId,
65
64
  unsafeCreateEntityTable,
66
- } from "@cosmicdrift/kumiko-framework/stack";
65
+ } from "@cosmicdrift/kumiko-testing/stack";
67
66
  import { TICKET_STATS_QUERY, ticketEntity, ticketFeature } from "../feature";
68
67
 
69
68
  let stack: TestStack;
@@ -105,19 +105,18 @@ import {
105
105
  TenantQueries,
106
106
  tenantMembershipsTable,
107
107
  } from "@cosmicdrift/kumiko-bundled-features/tenant";
108
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
109
108
  import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
109
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
110
110
  import type { SessionUser } from "@cosmicdrift/kumiko-framework/engine";
111
111
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
112
+ import { createTestUser, TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
113
+ import { createRendererMailHtmlFeature } from "@cosmicdrift/kumiko-renderer-mail-html";
114
+ import { expectErrorIncludes } from "@cosmicdrift/kumiko-testing/helpers";
112
115
  import {
113
- createTestUser,
114
116
  setupTestStack,
115
117
  type TestStack,
116
- TestUsers,
117
118
  unsafePushTables,
118
- } from "@cosmicdrift/kumiko-framework/stack";
119
- import { expectErrorIncludes } from "@cosmicdrift/kumiko-framework/testing";
120
- import { createRendererMailHtmlFeature } from "@cosmicdrift/kumiko-renderer-mail-html";
119
+ } from "@cosmicdrift/kumiko-testing/stack";
121
120
  import { supportFeature, TICKET_ASSIGNED, ticketTable } from "../feature";
122
121
 
123
122
  // --- Test Infrastructure ---
@@ -43,7 +43,7 @@ import {
43
43
  createRegistry,
44
44
  validateBoot as validateBootRaw,
45
45
  } from "@cosmicdrift/kumiko-framework/engine";
46
- import { generateE2ESpec, withBootValidatorFixture } from "@cosmicdrift/kumiko-framework/testing";
46
+ import { generateE2ESpec, withBootValidatorFixture } from "@cosmicdrift/kumiko-testing/helpers";
47
47
  import { createShopFeature } from "../feature";
48
48
 
49
49
  function validateBoot(features: Parameters<typeof validateBootRaw>[0]): void {
@@ -85,13 +85,12 @@ rejection, and per-role access.
85
85
 
86
86
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
87
87
  import type { SaveContext } from "@cosmicdrift/kumiko-framework/engine";
88
+ import { createTestUser, TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
88
89
  import {
89
- createTestUser,
90
90
  setupTestStack,
91
91
  type TestStack,
92
- TestUsers,
93
92
  unsafeCreateEntityTable,
94
- } from "@cosmicdrift/kumiko-framework/stack";
93
+ } from "@cosmicdrift/kumiko-testing/stack";
95
94
  import { prospectEntity, prospectsFeature, suggestionEntity } from "../feature";
96
95
 
97
96
  let stack: TestStack;
@@ -52,13 +52,12 @@ screen.
52
52
 
53
53
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
54
54
  import type { EntityId, SaveContext } from "@cosmicdrift/kumiko-framework/engine";
55
+ import { createTestUser, TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
55
56
  import {
56
- createTestUser,
57
57
  setupTestStack,
58
58
  type TestStack,
59
- TestUsers,
60
59
  unsafeCreateEntityTable,
61
- } from "@cosmicdrift/kumiko-framework/stack";
60
+ } from "@cosmicdrift/kumiko-testing/stack";
62
61
  import { contactEntity } from "../entities/contact";
63
62
  import { invoiceEntity } from "../entities/invoice";
64
63
  import { productEntity } from "../entities/product";
@@ -71,7 +71,7 @@ custom boots pass their own cipher:
71
71
 
72
72
  ```ts illustration
73
73
  import { createConfigResolver } from "@cosmicdrift/kumiko-bundled-features/config";
74
- import { createTestEnvelopeCipher } from "@cosmicdrift/kumiko-framework/testing";
74
+ import { createTestEnvelopeCipher } from "@cosmicdrift/kumiko-testing/helpers";
75
75
 
76
76
  const cipher = createTestEnvelopeCipher();
77
77
  const configResolver = createConfigResolver({ cipher });
@@ -155,15 +155,14 @@ import {
155
155
  createConfigFeature,
156
156
  createConfigResolver,
157
157
  } from "@cosmicdrift/kumiko-bundled-features/config";
158
- import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
158
+ import { selectMany } from "@cosmicdrift/kumiko-framework/db";
159
+ import { TestUsers, testTenantId } from "@cosmicdrift/kumiko-framework/seeding";
160
+ import { createTestEnvelopeCipher } from "@cosmicdrift/kumiko-testing/helpers";
159
161
  import {
160
162
  setupTestStack,
161
163
  type TestStack,
162
- TestUsers,
163
- testTenantId,
164
164
  unsafePushTables,
165
- } from "@cosmicdrift/kumiko-framework/stack";
166
- import { createTestEnvelopeCipher } from "@cosmicdrift/kumiko-framework/testing";
165
+ } from "@cosmicdrift/kumiko-testing/stack";
167
166
  import { billingFeature, stripeApiKeyHandle } from "../feature";
168
167
 
169
168
  // Each test gets its own pair of tenants, so config rows from other tests never show up.
@@ -118,14 +118,13 @@ The chain lands in the log (for forensics), but **not** in the response to the c
118
118
  import { afterAll, beforeAll, describe, expect, test } from "bun:test";
119
119
  import { buildEntityTable } from "@cosmicdrift/kumiko-framework/db";
120
120
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
121
+ import { createTestUser, TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
122
+ import { updateRows } from "@cosmicdrift/kumiko-testing/helpers";
121
123
  import {
122
- createTestUser,
123
124
  setupTestStack,
124
125
  type TestStack,
125
- TestUsers,
126
126
  unsafeCreateEntityTable,
127
- } from "@cosmicdrift/kumiko-framework/stack";
128
- import { updateRows } from "@cosmicdrift/kumiko-framework/testing";
127
+ } from "@cosmicdrift/kumiko-testing/stack";
129
128
  import { OrdersLiteReasons, orderEntity, ordersLiteFeature } from "../feature";
130
129
 
131
130
  let stack: TestStack;