@cosmicdrift/kumiko-server-runtime 0.386.0 → 0.388.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 (53) hide show
  1. package/LICENSE +21 -57
  2. package/dist/boot/boot-crypto.js +4 -5
  3. package/dist/boot/shared-boot-steps.d.ts +43 -0
  4. package/dist/boot/shared-boot-steps.js +154 -0
  5. package/dist/boot/wait-for-database.d.ts +3 -0
  6. package/dist/boot/wait-for-database.js +3 -3
  7. package/dist/boot/worker-boot-core.js +20 -40
  8. package/dist/boot-options/billing-option.d.ts +18 -9
  9. package/dist/boot-options/billing-option.js +44 -18
  10. package/dist/boot-options/file-storage-option.js +6 -6
  11. package/dist/boot-options/option-env-schema.js +11 -2
  12. package/dist/boot-options/resolve-boot-options.js +9 -3
  13. package/dist/boot-options/stack-boot-requirements.js +1 -1
  14. package/dist/build-prod-bundle.d.ts +16 -15
  15. package/dist/build-prod-bundle.js +106 -108
  16. package/dist/csp-hashes.js +1 -1
  17. package/dist/extra-routes-deps.d.ts +1 -1
  18. package/dist/fatal-error-handlers.js +7 -0
  19. package/dist/index.js +4 -4
  20. package/dist/pii-boot-gate.js +1 -1
  21. package/dist/require-env.d.ts +2 -0
  22. package/dist/require-env.js +21 -0
  23. package/dist/resolve-tailwind-cli.js +5 -7
  24. package/dist/run-bootstrap.d.ts +1 -1
  25. package/dist/run-bootstrap.js +1 -1
  26. package/dist/run-prod-app-auth.d.ts +17 -0
  27. package/dist/run-prod-app-auth.js +83 -0
  28. package/dist/run-prod-app-boot-context.d.ts +2 -2
  29. package/dist/run-prod-app-boot-context.js +28 -25
  30. package/dist/run-prod-app-config.d.ts +36 -0
  31. package/dist/run-prod-app-config.js +169 -0
  32. package/dist/run-prod-app-connections.d.ts +16 -0
  33. package/dist/run-prod-app-connections.js +55 -0
  34. package/dist/run-prod-app-entrypoint.d.ts +14 -0
  35. package/dist/run-prod-app-entrypoint.js +147 -0
  36. package/dist/run-prod-app-handle.d.ts +20 -0
  37. package/dist/run-prod-app-handle.js +104 -0
  38. package/dist/run-prod-app-request-context.d.ts +15 -0
  39. package/dist/run-prod-app-request-context.js +103 -0
  40. package/dist/run-prod-app-seeds.d.ts +13 -0
  41. package/dist/run-prod-app-seeds.js +86 -0
  42. package/dist/run-prod-app-static-files.js +43 -50
  43. package/dist/run-prod-app.d.ts +93 -103
  44. package/dist/run-prod-app.js +75 -772
  45. package/dist/run-worker-app.d.ts +1 -1
  46. package/dist/run-worker-app.js +5 -5
  47. package/dist/session-boot-gate.d.ts +1 -1
  48. package/dist/session-boot-gate.js +1 -1
  49. package/dist/session-wiring.d.ts +1 -1
  50. package/dist/session-wiring.js +1 -1
  51. package/dist/try-hono-first.js +1 -1
  52. package/package.json +16 -8
  53. package/src/changes.json +25 -0
@@ -90,7 +90,7 @@ export type RunWorkerAppOptions = {
90
90
  readonly fileStorage?: FileStorageBootOption;
91
91
  /** Same as RunProdAppOptions["kmsMode"]; cannot be combined with `kms` / `blindIndexKey` / `allowPlaintextPii`. */
92
92
  readonly kmsMode?: KmsMode;
93
- /** Same as RunProdAppOptions["billing"]: mounts subscription-stripe so the registry matches the API. The webhook route belongs to the API process. */
93
+ /** Same as RunProdAppOptions["billing"]: mounts the configured subscription providers so the registry matches the API. The webhook route belongs to the API process. */
94
94
  readonly billing?: BillingBootOption;
95
95
  /** Same as RunProdAppOptions["featureToggles"]: mounts feature-toggles and layers the operator switches over the tier resolver. */
96
96
  readonly featureToggles?: boolean;
@@ -3,11 +3,11 @@
3
3
  // Hono app, no auth routes, no SSE broker, no seeds. Shares the boot core
4
4
  // with runProdApp (env fail-fast, Temporal polyfill, composeFeatures/
5
5
  // registry, PII invariants, KMS health gate, connections, schema-drift
6
- // gate, boot-crypto, extraContext) — see fw#1725: before this function,
7
- // every app deploying a worker rebuilt this boot by hand (solon#42), and
8
- // every deviation was silent: without `ensureTemporalPolyfill`, every job
9
- // in the worker fails with "Temporal is not defined" in a retry loop,
10
- // with no boot-time signal that anything is wrong.
6
+ // gate, boot-crypto, extraContext). Before this function, every app
7
+ // deploying a worker rebuilt this boot by hand, and every deviation was
8
+ // silent: without `ensureTemporalPolyfill`, every job in the worker fails
9
+ // with "Temporal is not defined" in a retry loop, with no boot-time signal
10
+ // that anything is wrong.
11
11
  //
12
12
  // App-author writes:
13
13
  // await runWorkerApp({ features, wireComponents: async (deps) => {...} });
@@ -5,7 +5,7 @@ export type SessionBootGateOptions = {
5
5
  * silently skip server-side revocation and any session-list UI stays
6
6
  * empty); dev only warns — a forgotten sessions mount in a local sample
7
7
  * app shouldn't crash the dev-server boot, but it must not stay silent
8
- * either (#2027 — dev previously had no gate here at all). */
8
+ * either. */
9
9
  readonly mode: "prod" | "dev";
10
10
  };
11
11
  export declare function assertSessionBootInvariants(opts: SessionBootGateOptions): void;
@@ -1,5 +1,5 @@
1
1
  // Catch a forgotten sessions mount at boot instead of silently degrading
2
- // into stateless JWTs (#1372). Mount createSessionsFeature() for revocable
2
+ // into stateless JWTs. Mount createSessionsFeature() for revocable
3
3
  // sessions; there is no auth.sessions opt-out anymore.
4
4
  export function assertSessionBootInvariants(opts) {
5
5
  // skip: no auth mounted — nothing to gate.
@@ -2,7 +2,7 @@
2
2
  * runProdApp session-wiring decision (extracted pure so it is testable without a
3
3
  * full prod boot).
4
4
  *
5
- * Secure-by-default (#1372): mounting a sessionStore provider (sessions feature)
5
+ * Secure-by-default: mounting a sessionStore provider (sessions feature)
6
6
  * turns server-side session revocation ON automatically. There is no
7
7
  * `auth.sessions` opt-in/opt-out — mount sessions for revocable JWTs, omit it
8
8
  * for intentional stateless JWTs (boot-gate warns / aborts unless acknowledged
@@ -2,7 +2,7 @@
2
2
  * runProdApp session-wiring decision (extracted pure so it is testable without a
3
3
  * full prod boot).
4
4
  *
5
- * Secure-by-default (#1372): mounting a sessionStore provider (sessions feature)
5
+ * Secure-by-default: mounting a sessionStore provider (sessions feature)
6
6
  * turns server-side session revocation ON automatically. There is no
7
7
  * `auth.sessions` opt-in/opt-out — mount sessions for revocable JWTs, omit it
8
8
  * for intentional stateless JWTs (boot-gate warns / aborts unless acknowledged
@@ -14,7 +14,7 @@
14
14
  //
15
15
  // The status code alone used to be the only signal ("404 = no match") —
16
16
  // that masked any matched route's deliberate 404 (e.g. default-deny reads)
17
- // as the SPA shell with status 200 (kumiko-framework#2435). buildServer
17
+ // as the SPA shell with status 200. buildServer
18
18
  // (framework/api/server.ts) registers app.notFound() LAST on the app object
19
19
  // and marks exactly the "no handler found" case with
20
20
  // NO_ROUTE_MATCH_HEADER_NAME — a handler that builds its own
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-server-runtime",
3
- "version": "0.386.0",
3
+ "version": "0.388.0",
4
4
  "description": "Production server-boot runtime for Kumiko apps: connections, schema-drift-gate, seeds, lifecycle, graceful shutdown. Symmetric to kumiko-dev-server's runDevApp, without dev/scaffold tooling.",
5
- "license": "BUSL-1.1",
5
+ "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
7
7
  "repository": {
8
8
  "type": "git",
@@ -50,6 +50,10 @@
50
50
  "types": "./dist/boot/apply-boot-seeds.d.ts",
51
51
  "default": "./dist/boot/apply-boot-seeds.js"
52
52
  },
53
+ "./boot/shared-boot-steps": {
54
+ "types": "./dist/boot/shared-boot-steps.d.ts",
55
+ "default": "./dist/boot/shared-boot-steps.js"
56
+ },
53
57
  "./boot/boot-crypto": {
54
58
  "types": "./dist/boot/boot-crypto.d.ts",
55
59
  "default": "./dist/boot/boot-crypto.js"
@@ -88,18 +92,18 @@
88
92
  }
89
93
  },
90
94
  "dependencies": {
91
- "@cosmicdrift/kumiko-bundled-features": "0.386.0",
92
- "@cosmicdrift/kumiko-framework": "0.386.0",
93
- "@cosmicdrift/kumiko-renderer": "0.386.0",
94
- "@cosmicdrift/kumiko-renderer-mail-html": "0.386.0",
95
- "@cosmicdrift/kumiko-types": "0.386.0",
95
+ "@cosmicdrift/kumiko-bundled-features": "0.388.0",
96
+ "@cosmicdrift/kumiko-framework": "0.388.0",
97
+ "@cosmicdrift/kumiko-renderer": "0.388.0",
98
+ "@cosmicdrift/kumiko-renderer-mail-html": "0.388.0",
99
+ "@cosmicdrift/kumiko-types": "0.388.0",
96
100
  "bun-types": "^1.3.13",
97
101
  "ioredis": "^5.10.1",
98
102
  "temporal-polyfill": "^0.3.2",
99
103
  "zod": "^4.4.3"
100
104
  },
101
105
  "devDependencies": {
102
- "@cosmicdrift/kumiko-testing": "0.386.0"
106
+ "@cosmicdrift/kumiko-testing": "0.388.0"
103
107
  },
104
108
  "publishConfig": {
105
109
  "registry": "https://registry.npmjs.org",
@@ -137,6 +141,10 @@
137
141
  "types": "./dist/boot/apply-boot-seeds.d.ts",
138
142
  "default": "./dist/boot/apply-boot-seeds.js"
139
143
  },
144
+ "./boot/shared-boot-steps": {
145
+ "types": "./dist/boot/shared-boot-steps.d.ts",
146
+ "default": "./dist/boot/shared-boot-steps.js"
147
+ },
140
148
  "./boot/boot-crypto": {
141
149
  "types": "./dist/boot/boot-crypto.d.ts",
142
150
  "default": "./dist/boot/boot-crypto.js"
package/src/changes.json CHANGED
@@ -1,4 +1,29 @@
1
1
  [
2
+ {
3
+ "version": "0.388.0",
4
+ "type": "improvement",
5
+ "title": "runProdApp split into boot phases, boot steps shared with dev and worker",
6
+ "detail": "runProdApp() keeps its signature and behavior. Config resolution, feature composition, dependency connection, request context, auth wiring, entrypoint, seeds and the returned handle now live in run-prod-app-*.ts files next to run-prod-app.ts. Steps that prod, dev and the worker ran as copies (env defaults, feature composition, boot validation, the auth-mfa switch-tenant gate, the tier and feature-toggle resolver, standard boot seeds, shared auth routes, the KMS health gate and the database pools) live once in the new subpath @cosmicdrift/kumiko-server-runtime/boot/shared-boot-steps. requireEnv is still exported from run-prod-app under the same name."
7
+ },
8
+ {
9
+ "version": "0.388.0",
10
+ "type": "fix",
11
+ "title": "runProdApp releases connections when the boot fails",
12
+ "detail": "A failing boot closes the database pools, the Redis client and the KMS adapter it already opened. The KMS health wait logs \"KMS not reachable\" instead of \"database not reachable\"."
13
+ },
14
+ {
15
+ "version": "0.388.0",
16
+ "type": "fix",
17
+ "title": "Boot validation and shutdown hardening",
18
+ "detail": "The KMS and app database waits share one deadline so a boot never outlasts the liveness window. An app-supplied master key provider is checked at boot, also in a dry run. Additional fileStorage providers get the same production and S3 checks as the default one, and their env keys are validated. appOverrides without auth or delivery feature abort instead of being dropped. A fatal shutdown keeps its listeners installed, and inline script hashing handles a \">\" inside quoted attributes."
19
+ },
20
+ {
21
+ "version": "0.388.0",
22
+ "type": "breaking",
23
+ "title": "billing boot option takes stripe and/or dodo",
24
+ "detail": "billing.stripe is now optional and billing.dodo is new (priceToTier, oneOffPriceIds). At least one is required. resolveBillingOption returns features (an array) instead of feature, and one webhook route serves every provider on stripe.webhookPath or SUBSCRIPTION_WEBHOOK_PATH. DODO_PAYMENTS_API_KEY and DODO_PAYMENTS_WEBHOOK_KEY are the env bridge.",
25
+ "migration": "Callers of resolveBillingOption use billing.features instead of billing.feature."
26
+ },
2
27
  {
3
28
  "version": "0.385.0",
4
29
  "type": "improvement",