@cosmicdrift/kumiko-framework 0.342.0 → 0.344.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.
- package/dist/api/auth-routes.d.ts +2 -0
- package/dist/api/auth-routes.js +35 -2
- package/dist/api/request-context.d.ts +2 -0
- package/dist/api/request-id-middleware.d.ts +2 -0
- package/dist/api/request-id-middleware.js +4 -1
- package/dist/api/routes.js +5 -5
- package/dist/api/server.d.ts +3 -0
- package/dist/api/server.js +4 -1
- package/dist/compliance/duration-spec.d.ts +2 -1
- package/dist/compliance/duration-spec.js +11 -0
- package/dist/compliance/index.d.ts +2 -2
- package/dist/compliance/index.js +1 -1
- package/dist/compliance/profiles.d.ts +6 -5
- package/dist/db/entity-field-encryption.d.ts +1 -1
- package/dist/db/entity-field-encryption.js +5 -5
- package/dist/db/event-store-executor-write.js +38 -11
- package/dist/db/projection-registry-binding.d.ts +3 -0
- package/dist/db/projection-registry-binding.js +12 -0
- package/dist/db/tenant-db.d.ts +2 -0
- package/dist/db/tenant-db.js +22 -7
- package/dist/engine/boot-validator/index.d.ts +11 -0
- package/dist/engine/boot-validator/index.js +45 -1
- package/dist/engine/boot-validator/query-output-columns.js +8 -7
- package/dist/engine/boot-validator/query-refs.js +3 -0
- package/dist/engine/boot-validator/screens.js +28 -0
- package/dist/engine/index.d.ts +2 -2
- package/dist/engine/index.js +1 -1
- package/dist/engine/types/index.d.ts +2 -2
- package/dist/engine/types/index.js +1 -1
- package/dist/env/index.d.ts +3 -0
- package/dist/env/index.js +12 -0
- package/dist/errors/docs-url.d.ts +7 -0
- package/dist/errors/docs-url.js +36 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +1 -0
- package/dist/errors/kumiko-error.d.ts +0 -2
- package/dist/errors/kumiko-error.js +0 -24
- package/dist/errors/serialize.d.ts +3 -2
- package/dist/errors/serialize.js +4 -2
- package/dist/jobs/job-runner.js +31 -2
- package/dist/pipeline/dispatch-shared.js +3 -1
- package/dist/pipeline/event-retention.d.ts +1 -0
- package/dist/pipeline/event-retention.js +6 -0
- package/dist/pipeline/index.d.ts +2 -0
- package/dist/pipeline/index.js +1 -0
- package/dist/pipeline/projections-runner.d.ts +1 -0
- package/dist/pipeline/projections-runner.js +23 -14
- package/dist/rate-limit/middleware.js +1 -1
- package/dist/stack/test-stack.d.ts +7 -0
- package/dist/stack/test-stack.js +6 -0
- package/package.json +4 -4
- package/src/changes.json +32 -0
|
@@ -3,6 +3,7 @@ import type { AuthRoutesConfig } from "../api/auth-routes.js";
|
|
|
3
3
|
import type { JwtHelper } from "../api/jwt.js";
|
|
4
4
|
import { type SseBroker } from "../api/sse-broker.js";
|
|
5
5
|
import type { AppContext, FeatureDefinition, JobRunIn, Registry, TenantId } from "../engine/types/index.js";
|
|
6
|
+
import type { ErrorDocsConfig } from "../errors/docs-url.js";
|
|
6
7
|
import { type JobRunner, type JobRunnerOptions } from "../jobs/index.js";
|
|
7
8
|
import type { Lifecycle } from "../lifecycle/index.js";
|
|
8
9
|
import { type ObservabilityProvider } from "../observability/index.js";
|
|
@@ -159,6 +160,8 @@ export type TestStackOptions = {
|
|
|
159
160
|
/** Forwarded to buildServer's top-level `ServerOptions.trustedProxyHops`
|
|
160
161
|
* — see there. Default 0. */
|
|
161
162
|
trustedProxyHops?: number;
|
|
163
|
+
/** Links the app's own error reasons to its own docs (`docsUrl` in error responses); framework reasons keep the framework docs link. Passed to buildServer's `ServerOptions.errorDocs`. */
|
|
164
|
+
errorDocs?: ErrorDocsConfig;
|
|
162
165
|
/** Second stack on the Redis namespace of `owner`: own connection, same
|
|
163
166
|
* keyPrefix, so rate-limit buckets, locks, idempotency keys and the
|
|
164
167
|
* cache-sync channel are shared across both. The derived
|
|
@@ -172,5 +175,9 @@ export type TestStackOptions = {
|
|
|
172
175
|
* Implied by `sharedRedisWith`; set it on the owner stack too, or its writes
|
|
173
176
|
* never reach the borrower. Without it the stack uses a process-local bus. */
|
|
174
177
|
cacheSync?: boolean;
|
|
178
|
+
/** "full" runs the prod-boot validateBoot over `features` (screens and ref
|
|
179
|
+
* entities across features included). Use it with the app's complete feature
|
|
180
|
+
* composition; the default only checks what is safe on a feature subset. */
|
|
181
|
+
validateBoot?: "full";
|
|
175
182
|
};
|
|
176
183
|
export declare function setupTestStack(options: TestStackOptions): Promise<TestStack>;
|
package/dist/stack/test-stack.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildServer } from "../api/server.js";
|
|
2
2
|
import { createSseBroker } from "../api/sse-broker.js";
|
|
3
|
+
import { validateBoot, validateNavBootSubset } from "../engine/boot-validator/index.js";
|
|
3
4
|
import { validateOwnershipBoot } from "../engine/boot-validator/ownership.js";
|
|
4
5
|
import { createRegistry } from "../engine/registry.js";
|
|
5
6
|
import { createArchivedStreamsTable, createEventsTable } from "../event-store/index.js";
|
|
@@ -31,6 +32,10 @@ export async function setupTestStack(options) {
|
|
|
31
32
|
// columns) and before the ephemeral DB/Redis exist, so a throw can't leak
|
|
32
33
|
// a database that nothing will clean up.
|
|
33
34
|
validateOwnershipBoot(options.features);
|
|
35
|
+
// Nav/workspace refs fail the prod boot too; the subset check tolerates refs into unmounted features.
|
|
36
|
+
validateNavBootSubset(options.features);
|
|
37
|
+
if (options.validateBoot === "full")
|
|
38
|
+
validateBoot(options.features);
|
|
34
39
|
// Forward db-name/persistent-flag through to createTestDb. The
|
|
35
40
|
// defaults (undefined dbName, persistent:false) keep the legacy
|
|
36
41
|
// test contract: fresh kumiko_test_<random> DB per setup, dropped
|
|
@@ -280,6 +285,7 @@ export async function setupTestStack(options) {
|
|
|
280
285
|
eventDedup,
|
|
281
286
|
sseBroker,
|
|
282
287
|
...(options.trustedProxyHops !== undefined && { trustedProxyHops: options.trustedProxyHops }),
|
|
288
|
+
...(options.errorDocs && { errorDocs: options.errorDocs }),
|
|
283
289
|
...(options.extraRoutes && { extraRoutes: options.extraRoutes }),
|
|
284
290
|
...(options.metrics && { metrics: options.metrics }),
|
|
285
291
|
// Tests drive the dispatcher via stack.eventDispatcher.runOnce() for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.344.0",
|
|
4
4
|
"description": "Framework core — engine, pipeline, API, DB, and every other bit that makes Kumiko go.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -206,8 +206,8 @@
|
|
|
206
206
|
"./package.json": "./package.json"
|
|
207
207
|
},
|
|
208
208
|
"dependencies": {
|
|
209
|
-
"@cosmicdrift/kumiko-http": "0.
|
|
210
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
209
|
+
"@cosmicdrift/kumiko-http": "0.344.0",
|
|
210
|
+
"@cosmicdrift/kumiko-types": "0.344.0",
|
|
211
211
|
"bullmq": "^5.76.7",
|
|
212
212
|
"bun-types": "^1.3.13",
|
|
213
213
|
"hono": "^4.13.1",
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
"zod": "^4.4.3"
|
|
224
224
|
},
|
|
225
225
|
"devDependencies": {
|
|
226
|
-
"@cosmicdrift/kumiko-dispatcher-live": "0.
|
|
226
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.344.0",
|
|
227
227
|
"bun-types": "^1.3.13",
|
|
228
228
|
"pino-pretty": "^13.1.3"
|
|
229
229
|
},
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.343.0",
|
|
4
|
+
"type": "breaking",
|
|
5
|
+
"title": "App error reasons only carry a docsUrl when errorDocs covers them",
|
|
6
|
+
"detail": "`docsUrl` in error responses is now resolved at serialization by `resolveErrorDocsUrl`. Framework reasons (and errors without a reason) link to the framework docs as before. An app's own reasons no longer link to the framework docs, where no page exists for them: they get a `docsUrl` only if the new option `errorDocs: { baseUrl, reasons: string[] | \"all\" }` (on `runProdApp`, `buildServer`, `createKumikoServer`, `setupTestStack`) covers them.\nMigration: `KumikoError.docsUrl` (the getter) is removed; use `resolveErrorDocsUrl(err, errorDocs?)`. `ErrorResponseBody.docsUrl` is now optional. Apps whose clients read `docsUrl` for app reasons pass `errorDocs` or handle the missing field.",
|
|
7
|
+
"migration": "KumikoError.docsUrl (the getter) is removed; call resolveErrorDocsUrl(err, errorDocs?) instead. ErrorResponseBody.docsUrl is optional. Apps whose clients read docsUrl for app reasons pass errorDocs or handle the missing field."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"version": "0.343.0",
|
|
11
|
+
"type": "fix",
|
|
12
|
+
"title": "Executor writes outside the dispatcher no longer skip custom projections",
|
|
13
|
+
"detail": "Executor writes run custom projections\n`EventStoreExecutor` create, update, delete, forget and restore now run the custom projections registered for the written event, in the same savepoint as the write. The registry is bound to the `TenantDb` by the dispatcher and the job runner; a `TenantDb` built elsewhere skips custom projections. Projection runs are idempotent per event object, so the dispatcher's own pass after the handler does not run them twice.",
|
|
14
|
+
"migration": "Remove manual `runProjections` calls after executor writes in hooks or jobs together with the bump. A call is a no-op only when it passes the exact event object the executor returned; a spread or rebuilt event projects twice."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"version": "0.343.0",
|
|
18
|
+
"type": "improvement",
|
|
19
|
+
"title": "isFailedWriteResult is exported from the pipeline entry",
|
|
20
|
+
"detail": "`isFailedWriteResult` and `FailedWriteResult` are exported from the pipeline entry\nConsumers can narrow a `WriteResult` to its failure branch with `import { isFailedWriteResult } from \"@cosmicdrift/kumiko-framework/pipeline\"` instead of re-implementing the check."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"version": "0.343.0",
|
|
24
|
+
"type": "improvement",
|
|
25
|
+
"title": "retiredCookieDomains clears auth cookies left on a former cookieDomain",
|
|
26
|
+
"detail": "`AuthRoutesConfig.retiredCookieDomains` lists domains that used to carry the auth cookies. Login and logout also send delete headers for `kumiko_auth` and `kumiko_csrf` with `Domain=<entry>`, so a stale cookie from an earlier `cookieDomain` no longer shadows the new session after the value changes. Login sends these deletes before the new `Set-Cookie` headers. `createAuthRoutes` throws on an empty entry, on `;`, comma, whitespace, CR or LF, and on an entry equal to the current `cookieDomain`. Without the option nothing changes. Remove an entry once the session TTL has passed since the switch."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"version": "0.343.0",
|
|
30
|
+
"type": "improvement",
|
|
31
|
+
"title": "Test stacks validate nav references and can run the full boot validation",
|
|
32
|
+
"detail": "`setupTestStack` now validates nav, workspace and tree-action references on the mounted features, with the same error messages as the prod boot. References into features that are not mounted are skipped. The new option `validateBoot: \"full\"` runs the complete `validateBoot`, including the screen and ref-entity checks that span features; give apps one boot test with their prod feature composition and this option."
|
|
33
|
+
},
|
|
2
34
|
{
|
|
3
35
|
"version": "0.342.0",
|
|
4
36
|
"type": "improvement",
|