@cosmicdrift/kumiko-server-runtime 0.345.0 → 0.347.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.
@@ -1,7 +1,8 @@
1
1
  import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
2
2
  export declare const APP_VERSION_ENV = "KUMIKO_APP_VERSION";
3
3
  export declare const GIT_COMMIT_ENV = "KUMIKO_GIT_COMMIT";
4
- export declare const INSTANCE_ID_ENV = "HOSTNAME";
4
+ export declare const INSTANCE_ID_ENV = "KUMIKO_INSTANCE_ID";
5
+ export declare const HOSTNAME_ENV = "HOSTNAME";
5
6
  export declare const UNKNOWN_APP_VERSION = "unknown";
6
7
  type EnvSource = Readonly<Record<string, string | undefined>>;
7
8
  export type AppStartedPayload = {
@@ -5,7 +5,8 @@ import { generateId } from "@cosmicdrift/kumiko-framework/utils";
5
5
  import { SYSTEM_TENANT_ID, SYSTEM_USER_ID } from "@cosmicdrift/kumiko-types/identifiers";
6
6
  export const APP_VERSION_ENV = "KUMIKO_APP_VERSION";
7
7
  export const GIT_COMMIT_ENV = "KUMIKO_GIT_COMMIT";
8
- export const INSTANCE_ID_ENV = "HOSTNAME";
8
+ export const INSTANCE_ID_ENV = "KUMIKO_INSTANCE_ID";
9
+ export const HOSTNAME_ENV = "HOSTNAME";
9
10
  export const UNKNOWN_APP_VERSION = "unknown";
10
11
  function nonEmpty(value) {
11
12
  return value === undefined || value === "" ? undefined : value;
@@ -15,7 +16,7 @@ export function resolveAppStartedPayload(envSource, fallbackHostname, startedAt)
15
16
  return {
16
17
  version: nonEmpty(envSource[APP_VERSION_ENV]) ?? UNKNOWN_APP_VERSION,
17
18
  ...(commit !== undefined ? { commit } : {}),
18
- instanceId: nonEmpty(envSource[INSTANCE_ID_ENV]) ?? fallbackHostname,
19
+ instanceId: nonEmpty(envSource[INSTANCE_ID_ENV]) ?? nonEmpty(envSource[HOSTNAME_ENV]) ?? fallbackHostname,
19
20
  startedAt,
20
21
  };
21
22
  }
@@ -132,6 +132,9 @@ export type RunProdAppAuthOptions = {
132
132
  * AuthRoutesConfig.cookieDomain). Set to the registrable parent
133
133
  * domain when login and app live on different subdomains. */
134
134
  readonly cookieDomain?: string;
135
+ /** Former cookie domains cleared on login/logout (see
136
+ * AuthRoutesConfig.retiredCookieDomains). */
137
+ readonly retiredCookieDomains?: readonly string[];
135
138
  /** Server-side Origin allowlist for the CSRF guard (see
136
139
  * AuthRoutesConfig.allowedOrigins). REQUIRED once `cookieDomain` is set —
137
140
  * buildServer fails closed otherwise. Apex + admin host, never tenant
@@ -514,6 +514,9 @@ export async function runProdApp(options) {
514
514
  ...(effectiveAuth.cookieDomain !== undefined && {
515
515
  cookieDomain: effectiveAuth.cookieDomain,
516
516
  }),
517
+ ...(effectiveAuth.retiredCookieDomains !== undefined && {
518
+ retiredCookieDomains: effectiveAuth.retiredCookieDomains,
519
+ }),
517
520
  ...(effectiveAuth.allowedOrigins !== undefined && {
518
521
  allowedOrigins: effectiveAuth.allowedOrigins,
519
522
  }),
@@ -15,6 +15,7 @@
15
15
  // Container/Coolify sets the same env vars as runProdApp:
16
16
  // DATABASE_URL, REDIS_URL, JWT_SECRET — PORT is not needed.
17
17
  import { startPiiEventBackfillOnBoot } from "./boot/pii-event-backfill-on-boot.js";
18
+ import { recordAppStartedOnBoot } from "./boot/record-app-started-on-boot.js";
18
19
  import { bootWorkerProcess, resolveWorkerEnvSource } from "./boot/worker-boot-core.js";
19
20
  import { startWorkerMetricsServer, } from "./boot/worker-metrics-server.js";
20
21
  import { makeDispatchSystemWrite } from "./extra-routes-deps.js";
@@ -55,6 +56,7 @@ export async function runWorkerApp(options) {
55
56
  stop: boot.close,
56
57
  ...(metricsServer && { metricsServer }),
57
58
  };
59
+ await recordAppStartedOnBoot({ db, envSource });
58
60
  startPiiEventBackfillOnBoot({
59
61
  db,
60
62
  registry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-server-runtime",
3
- "version": "0.345.0",
3
+ "version": "0.347.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/codegen tooling.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -80,10 +80,10 @@
80
80
  }
81
81
  },
82
82
  "dependencies": {
83
- "@cosmicdrift/kumiko-bundled-features": "0.345.0",
84
- "@cosmicdrift/kumiko-framework": "0.345.0",
85
- "@cosmicdrift/kumiko-headless": "0.345.0",
86
- "@cosmicdrift/kumiko-renderer-web": "0.345.0",
83
+ "@cosmicdrift/kumiko-bundled-features": "0.347.0",
84
+ "@cosmicdrift/kumiko-framework": "0.347.0",
85
+ "@cosmicdrift/kumiko-headless": "0.347.0",
86
+ "@cosmicdrift/kumiko-renderer-web": "0.347.0",
87
87
  "bun-types": "^1.3.13",
88
88
  "ioredis": "^5.10.1",
89
89
  "temporal-polyfill": "^0.3.2"
package/src/changes.json CHANGED
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "version": "0.347.0",
4
+ "type": "fix",
5
+ "title": "runProdApp and runDevApp forward auth.retiredCookieDomains to the auth routes",
6
+ "detail": "runProdApp and runDevApp pass retiredCookieDomains through\n`auth.retiredCookieDomains` is now accepted by both runners and reaches the auth routes. Before, the option existed only on the lower-level route config, so apps starting through the runners could not clear a retired cookie domain."
7
+ },
8
+ {
9
+ "version": "0.346.0",
10
+ "type": "improvement",
11
+ "title": "runWorkerApp records app.started; instance id prefers KUMIKO_INSTANCE_ID over HOSTNAME",
12
+ "detail": "runWorkerApp records app.started too\nThe worker now appends the same `kumiko:system:app.started` event as `runProdApp`. The instance id prefers `KUMIKO_INSTANCE_ID` and falls back to `HOSTNAME`, then the OS hostname."
13
+ },
2
14
  {
3
15
  "version": "0.345.0",
4
16
  "type": "improvement",