@fuzdev/fuz_app 0.153.0 → 0.155.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 (65) hide show
  1. package/dist/actions/CLAUDE.md +2 -2
  2. package/dist/actions/action_event.d.ts.map +1 -1
  3. package/dist/actions/action_event.js +14 -14
  4. package/dist/actions/peer_ping.js +3 -3
  5. package/dist/actions/perform_action.d.ts +12 -10
  6. package/dist/actions/perform_action.d.ts.map +1 -1
  7. package/dist/actions/perform_action.js +19 -16
  8. package/dist/auth/cell_actions.d.ts +6 -4
  9. package/dist/auth/cell_actions.d.ts.map +1 -1
  10. package/dist/auth/cell_actions.js +10 -9
  11. package/dist/env/env_schemas.d.ts +41 -0
  12. package/dist/env/env_schemas.d.ts.map +1 -0
  13. package/dist/env/env_schemas.js +55 -0
  14. package/dist/env/load.d.ts +23 -15
  15. package/dist/env/load.d.ts.map +1 -1
  16. package/dist/env/load.js +38 -22
  17. package/dist/http/CLAUDE.md +14 -8
  18. package/dist/http/schema_helpers.d.ts +102 -23
  19. package/dist/http/schema_helpers.d.ts.map +1 -1
  20. package/dist/http/schema_helpers.js +241 -38
  21. package/dist/http/surface.d.ts +20 -11
  22. package/dist/http/surface.d.ts.map +1 -1
  23. package/dist/http/surface.js +59 -32
  24. package/dist/primitive_schemas.d.ts +13 -4
  25. package/dist/primitive_schemas.d.ts.map +1 -1
  26. package/dist/primitive_schemas.js +13 -4
  27. package/dist/schema_issues.d.ts +96 -0
  28. package/dist/schema_issues.d.ts.map +1 -0
  29. package/dist/schema_issues.js +110 -0
  30. package/dist/schema_meta.d.ts +38 -13
  31. package/dist/schema_meta.d.ts.map +1 -1
  32. package/dist/schema_meta.js +63 -13
  33. package/dist/sensitivity.d.ts +34 -1
  34. package/dist/sensitivity.d.ts.map +1 -1
  35. package/dist/sensitivity.js +32 -2
  36. package/dist/server/app_server.d.ts +6 -5
  37. package/dist/server/app_server.d.ts.map +1 -1
  38. package/dist/server/app_server.js +0 -1
  39. package/dist/server/env.d.ts +52 -30
  40. package/dist/server/env.d.ts.map +1 -1
  41. package/dist/server/env.js +38 -43
  42. package/dist/testing/CLAUDE.md +23 -10
  43. package/dist/testing/adversarial_404.d.ts +15 -0
  44. package/dist/testing/adversarial_404.d.ts.map +1 -1
  45. package/dist/testing/adversarial_404.js +26 -19
  46. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  47. package/dist/testing/adversarial_input_cases.js +2 -2
  48. package/dist/testing/app_server.js +2 -2
  49. package/dist/testing/cross_backend/cell_crud.d.ts.map +1 -1
  50. package/dist/testing/cross_backend/cell_crud.js +7 -5
  51. package/dist/testing/cross_backend/identity_parity.js +2 -2
  52. package/dist/testing/cross_backend/standard.d.ts +3 -2
  53. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  54. package/dist/testing/daemon_info.d.ts +7 -2
  55. package/dist/testing/daemon_info.d.ts.map +1 -1
  56. package/dist/testing/daemon_info.js +8 -3
  57. package/dist/testing/data_exposure.d.ts +43 -9
  58. package/dist/testing/data_exposure.d.ts.map +1 -1
  59. package/dist/testing/data_exposure.js +151 -35
  60. package/dist/testing/schema_generators.d.ts +21 -9
  61. package/dist/testing/schema_generators.d.ts.map +1 -1
  62. package/dist/testing/schema_generators.js +52 -47
  63. package/dist/testing/stubs.d.ts +2 -2
  64. package/dist/testing/stubs.d.ts.map +1 -1
  65. package/package.json +4 -4
@@ -1,47 +1,69 @@
1
1
  /**
2
2
  * Base server environment schema and validation.
3
3
  *
4
- * Provides `BaseServerEnv` — a shared Zod schema for common server env vars
5
- * that apps can use directly or extend with app-specific fields.
4
+ * Provides `BaseServerEnv` — a shared `@fuzdev/fuz_schema` object schema for
5
+ * common server env vars that apps can use directly or extend with
6
+ * app-specific fields.
6
7
  *
7
- * Generic env loading lives in `env/load.ts`.
8
+ * Generic env loading lives in `env/load.ts`, and the value schemas
9
+ * (`env_integer`, `EnvStringbool`) in `env/env_schemas.ts`.
8
10
  *
9
11
  * @module
10
12
  */
11
- import { z } from 'zod';
13
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
12
14
  import type { Result } from '@fuzdev/fuz_util/result.ts';
13
15
  import { type Keyring } from '../auth/keyring.js';
16
+ import '../sensitivity.js';
14
17
  /**
15
- * Base Zod schema for server environment variables.
18
+ * Base schema for server environment variables, a strict `object`.
16
19
  *
17
20
  * Declares only what the spine reads — server config, database and its pool
18
21
  * checkout bounds, cookie keys, allowed origins and the wildcard opt-in, and
19
22
  * the bootstrap token path — matching the Rust spine's `BaseServerEnv`. The
20
- * numeric vars parse as loosely as `PORT` (`z.coerce`, so `5e3` reads as 5000
21
- * where the Rust twin refuses it); a blank or out-of-range value is refused on
22
- * both. Anything else (fact storage,
23
- * X-Accel delivery, public URLs) is the app's own var: extend with
24
- * app-specific fields via `.extend()`.
23
+ * numeric vars read as the Rust twin reads them (`env_integer`: trimmed,
24
+ * then decimal digits after at most one `+`, so `5e3` and a blank value are
25
+ * refused on both, as is one out of range). Anything else (fact storage, X-Accel delivery, public
26
+ * URLs) is the app's own var: extend by spreading `def` into a new `object`,
27
+ * `object({...BaseServerEnv.def, MY_VAR: ...})`.
28
+ *
29
+ * Each field's description and `sensitivity` are `meta`, read by
30
+ * `env_schema_to_surface`.
25
31
  */
26
- export declare const BaseServerEnv: z.ZodObject<{
27
- NODE_ENV: z.ZodEnum<{
28
- development: "development";
29
- production: "production";
30
- }>;
31
- PORT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
32
- HOST: z.ZodDefault<z.ZodString>;
33
- DATABASE_URL: z.ZodString;
34
- SECRET_FUZ_COOKIE_KEYS: z.ZodString;
35
- FUZ_ALLOWED_ORIGINS: z.ZodString;
36
- FUZ_ALLOW_ORIGIN_WILDCARDS: z.ZodOptional<z.ZodEnum<{
37
- true: "true";
38
- false: "false";
39
- }>>;
40
- FUZ_BOOTSTRAP_TOKEN_PATH: z.ZodOptional<z.ZodString>;
41
- FUZ_DB_CHECKOUT_TIMEOUT_MS: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
42
- FUZ_DB_AUDIT_CHECKOUT_TIMEOUT_MS: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
43
- }, z.core.$strict>;
44
- export type BaseServerEnv = z.infer<typeof BaseServerEnv>;
32
+ export declare const BaseServerEnv: import("@fuzdev/fuz_schema/schema.ts").Schema<{
33
+ SECRET_FUZ_COOKIE_KEYS: string;
34
+ FUZ_ALLOWED_ORIGINS: string;
35
+ NODE_ENV: "development" | "production";
36
+ PORT: number;
37
+ HOST: string;
38
+ DATABASE_URL: string;
39
+ FUZ_ALLOW_ORIGIN_WILDCARDS?: "true" | "false" | undefined;
40
+ FUZ_BOOTSTRAP_TOKEN_PATH?: string | undefined;
41
+ FUZ_DB_CHECKOUT_TIMEOUT_MS?: number | undefined;
42
+ FUZ_DB_AUDIT_CHECKOUT_TIMEOUT_MS?: number | undefined;
43
+ }, {
44
+ SECRET_FUZ_COOKIE_KEYS: string;
45
+ FUZ_ALLOWED_ORIGINS: string;
46
+ NODE_ENV: "development" | "production";
47
+ DATABASE_URL: string;
48
+ FUZ_ALLOW_ORIGIN_WILDCARDS?: "true" | "false" | undefined;
49
+ PORT?: string | undefined;
50
+ HOST?: string | undefined;
51
+ FUZ_BOOTSTRAP_TOKEN_PATH?: string | undefined;
52
+ FUZ_DB_CHECKOUT_TIMEOUT_MS?: string | undefined;
53
+ FUZ_DB_AUDIT_CHECKOUT_TIMEOUT_MS?: string | undefined;
54
+ }, "object", {
55
+ NODE_ENV: import("@fuzdev/fuz_schema/schema.ts").Schema<"development" | "production", "development" | "production", "one_of", readonly ["development", "production"]>;
56
+ PORT: import("@fuzdev/fuz_schema/schema.ts").Schema<number, string | undefined, "with_default", import("@fuzdev/fuz_schema/schema.ts").SchemaDefaultDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
57
+ HOST: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string | undefined, "with_default", import("@fuzdev/fuz_schema/schema.ts").SchemaDefaultDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
58
+ DATABASE_URL: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
59
+ SECRET_FUZ_COOKIE_KEYS: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
60
+ FUZ_ALLOWED_ORIGINS: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
61
+ FUZ_ALLOW_ORIGIN_WILDCARDS: import("@fuzdev/fuz_schema/schema.ts").Schema<"true" | "false" | undefined, "true" | "false" | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<"true" | "false", "true" | "false", "one_of", readonly ["true", "false"]>>>;
62
+ FUZ_BOOTSTRAP_TOKEN_PATH: import("@fuzdev/fuz_schema/schema.ts").Schema<string | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
63
+ FUZ_DB_CHECKOUT_TIMEOUT_MS: import("@fuzdev/fuz_schema/schema.ts").Schema<number | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
64
+ FUZ_DB_AUDIT_CHECKOUT_TIMEOUT_MS: import("@fuzdev/fuz_schema/schema.ts").Schema<number | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
65
+ }>;
66
+ export type BaseServerEnv = Infer<typeof BaseServerEnv>;
45
67
  /**
46
68
  * Validated server env config — the artifacts `create_app_server()` needs.
47
69
  */
@@ -72,7 +94,7 @@ export interface ServerEnvValidationError {
72
94
  * bootstrap token path extraction.
73
95
  * Returns a Result so callers handle errors their own way (exit, logging, etc).
74
96
  *
75
- * @param env - a loaded and Zod-validated `BaseServerEnv`
97
+ * @param env - a loaded and validated `BaseServerEnv`
76
98
  * @returns `{ok: true, keyring, allowed_origins, allow_origin_wildcards, bootstrap_token_path}`
77
99
  * or `{ok: false, field, errors}`
78
100
  */
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAKlE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;kBAiDxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B;;;OAGG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,KAAK,EAAE,wBAAwB,GAAG,qBAAqB,CAAC;IACxD,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAC/B,KAAK,aAAa,KAChB,MAAM,CAAC,kBAAkB,EAAE,wBAAwB,CA2BrD,CAAC"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAMlE,OAAO,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B;;;OAGG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,KAAK,EAAE,wBAAwB,GAAG,qBAAqB,CAAC;IACxD,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAC/B,KAAK,aAAa,KAChB,MAAM,CAAC,kBAAkB,EAAE,wBAAwB,CA2BrD,CAAC"}
@@ -1,74 +1,69 @@
1
1
  /**
2
2
  * Base server environment schema and validation.
3
3
  *
4
- * Provides `BaseServerEnv` — a shared Zod schema for common server env vars
5
- * that apps can use directly or extend with app-specific fields.
4
+ * Provides `BaseServerEnv` — a shared `@fuzdev/fuz_schema` object schema for
5
+ * common server env vars that apps can use directly or extend with
6
+ * app-specific fields.
6
7
  *
7
- * Generic env loading lives in `env/load.ts`.
8
+ * Generic env loading lives in `env/load.ts`, and the value schemas
9
+ * (`env_integer`, `EnvStringbool`) in `env/env_schemas.ts`.
8
10
  *
9
11
  * @module
10
12
  */
11
- import { z } from 'zod';
13
+ import { meta } from '@fuzdev/fuz_schema/meta.ts';
14
+ import { message, min_length, object, one_of, optional, pipe, string, with_default } from '@fuzdev/fuz_schema/schema.ts';
12
15
  import { create_keyring } from '../auth/keyring.js';
13
16
  import { format_allowed_origins_error, parse_allowed_origins } from '../http/origin.js';
14
17
  import { admit_origin_wildcards } from '../http/origin_wildcard.js';
15
18
  import { DB_CHECKOUT_TIMEOUT_MAX_MS } from '../db/db_pg.js';
19
+ import { env_integer } from '../env/env_schemas.js';
20
+ // declares `sensitivity` on fuz_schema's `SchemaMeta`, for the fields here and consumers'
21
+ import '../sensitivity.js';
16
22
  /**
17
- * Base Zod schema for server environment variables.
23
+ * Base schema for server environment variables, a strict `object`.
18
24
  *
19
25
  * Declares only what the spine reads — server config, database and its pool
20
26
  * checkout bounds, cookie keys, allowed origins and the wildcard opt-in, and
21
27
  * the bootstrap token path — matching the Rust spine's `BaseServerEnv`. The
22
- * numeric vars parse as loosely as `PORT` (`z.coerce`, so `5e3` reads as 5000
23
- * where the Rust twin refuses it); a blank or out-of-range value is refused on
24
- * both. Anything else (fact storage,
25
- * X-Accel delivery, public URLs) is the app's own var: extend with
26
- * app-specific fields via `.extend()`.
28
+ * numeric vars read as the Rust twin reads them (`env_integer`: trimmed,
29
+ * then decimal digits after at most one `+`, so `5e3` and a blank value are
30
+ * refused on both, as is one out of range). Anything else (fact storage, X-Accel delivery, public
31
+ * URLs) is the app's own var: extend by spreading `def` into a new `object`,
32
+ * `object({...BaseServerEnv.def, MY_VAR: ...})`.
33
+ *
34
+ * Each field's description and `sensitivity` are `meta`, read by
35
+ * `env_schema_to_surface`.
27
36
  */
28
- export const BaseServerEnv = z.strictObject({
29
- NODE_ENV: z.enum(['development', 'production']).meta({ description: 'Runtime environment mode' }),
30
- PORT: z.coerce
31
- .number()
32
- .int()
33
- .min(1)
34
- .max(65535)
35
- .default(4040)
36
- .meta({ description: 'HTTP server port' }),
37
- HOST: z.string().default('localhost').meta({ description: 'HTTP server bind address' }),
38
- DATABASE_URL: z.string().min(1).meta({
37
+ export const BaseServerEnv = object({
38
+ NODE_ENV: meta(one_of(['development', 'production']), {
39
+ description: 'Runtime environment mode'
40
+ }),
41
+ PORT: meta(with_default(env_integer({ min: 1, max: 65535 }), 4040), {
42
+ description: 'HTTP server port'
43
+ }),
44
+ HOST: meta(with_default(string, 'localhost'), { description: 'HTTP server bind address' }),
45
+ DATABASE_URL: meta(pipe(string, min_length(1)), {
39
46
  description: 'Database URL (postgres://, file://, or memory://)',
40
47
  sensitivity: 'secret'
41
48
  }),
42
- SECRET_FUZ_COOKIE_KEYS: z.string().min(32).meta({
49
+ SECRET_FUZ_COOKIE_KEYS: meta(pipe(string, min_length(32)), {
43
50
  description: 'Cookie signing keys, separated by __ for rotation',
44
51
  sensitivity: 'secret'
45
52
  }),
46
- FUZ_ALLOWED_ORIGINS: z.string().min(1, 'FUZ_ALLOWED_ORIGINS is required').meta({
53
+ FUZ_ALLOWED_ORIGINS: meta(pipe(string, message(min_length(1), 'FUZ_ALLOWED_ORIGINS is required')), {
47
54
  description: 'Comma-separated origin patterns for API verification'
48
55
  }),
49
- FUZ_ALLOW_ORIGIN_WILDCARDS: z.enum(['true', 'false']).optional().meta({
56
+ FUZ_ALLOW_ORIGIN_WILDCARDS: meta(optional(one_of(['true', 'false'])), {
50
57
  description: 'Exactly `true` lets a wildcard FUZ_ALLOWED_ORIGINS entry (`:*`, a `*` label) boot, warned of on every boot; unset or `false` refuses one'
51
58
  }),
52
- FUZ_BOOTSTRAP_TOKEN_PATH: z
53
- .string()
54
- .optional()
55
- .meta({ description: 'Path to one-shot admin bootstrap token', sensitivity: 'secret' }),
56
- FUZ_DB_CHECKOUT_TIMEOUT_MS: z.coerce
57
- .number()
58
- .int()
59
- .min(1)
60
- .max(DB_CHECKOUT_TIMEOUT_MAX_MS)
61
- .optional()
62
- .meta({
59
+ FUZ_BOOTSTRAP_TOKEN_PATH: meta(optional(string), {
60
+ description: 'Path to one-shot admin bootstrap token',
61
+ sensitivity: 'secret'
62
+ }),
63
+ FUZ_DB_CHECKOUT_TIMEOUT_MS: meta(optional(env_integer({ min: 1, max: DB_CHECKOUT_TIMEOUT_MAX_MS })), {
63
64
  description: 'Bound on the pool checkouts a request makes, in ms (default 5000); a failed checkout answers 503. Audit writes use FUZ_DB_AUDIT_CHECKOUT_TIMEOUT_MS instead, including the failed-login row a request waits on. Postgres only — PGlite and pglet have no pool'
64
65
  }),
65
- FUZ_DB_AUDIT_CHECKOUT_TIMEOUT_MS: z.coerce
66
- .number()
67
- .int()
68
- .min(1)
69
- .max(DB_CHECKOUT_TIMEOUT_MAX_MS)
70
- .optional()
71
- .meta({
66
+ FUZ_DB_AUDIT_CHECKOUT_TIMEOUT_MS: meta(optional(env_integer({ min: 1, max: DB_CHECKOUT_TIMEOUT_MAX_MS })), {
72
67
  description: 'Bound on the checkout behind each audit pool write, in ms (default 30000); a failed login waits on its row, so up to this bound. Postgres only'
73
68
  })
74
69
  });
@@ -82,7 +77,7 @@ export const BaseServerEnv = z.strictObject({
82
77
  * bootstrap token path extraction.
83
78
  * Returns a Result so callers handle errors their own way (exit, logging, etc).
84
79
  *
85
- * @param env - a loaded and Zod-validated `BaseServerEnv`
80
+ * @param env - a loaded and validated `BaseServerEnv`
86
81
  * @returns `{ok: true, keyring, allowed_origins, allow_origin_wildcards, bootstrap_token_path}`
87
82
  * or `{ok: false, field, errors}`
88
83
  */
@@ -196,7 +196,7 @@ Types:
196
196
  `create_test_app` hard-codes the test-friendly `AppServerOptions`:
197
197
  `allowed_origins` exactly `TEST_ORIGIN` (built by
198
198
  `parse_allowed_origins`, as `create_app_server` requires), stub proxy pinned to `127.0.0.1`,
199
- `env_schema: z.object({})`, `rate_limiters: 'disabled_for_testing'` (every
199
+ `env_schema: object({})` (fuz_schema), `rate_limiters: 'disabled_for_testing'` (every
200
200
  rate limiter `null` — a limiter passed through `app_options` wins over the
201
201
  mode, so a rate-limit test enables just the one it pins; the mode's stderr
202
202
  banner prints once per module instance — once per test file in an isolated
@@ -481,7 +481,7 @@ Support functions:
481
481
 
482
482
  Walks Zod schemas to generate valid values for adversarial/round-trip tests.
483
483
 
484
- - `to_field_json_schema(field_schema)` — the field's JSON Schema rendered with `io: 'input'`, so a `.transform()` or pipe field (`Username`) yields its input-side bounds and pattern instead of throwing; a `.nullable()` / `.nullish()` field's one non-null `anyOf` branch is returned; `null` for a type JSON Schema can't represent. A pipe yields its input stage only, and a `.refine()` never appears (a code-point length bound generates nothing). Every JSON Schema read in the generators goes through it.
484
+ - `to_field_json_schema(field_schema)` — the field's JSON Schema rendered with `io: 'input'`, so a `.transform()` or pipe field (`Username`) yields its input-side bounds and pattern instead of throwing; a `.nullable()` / `.nullish()` field's one non-null `anyOf` branch (or one non-null `type` of a `type` array) is returned. Both libraries render with `unrepresentable: 'any'`, so it is never `null`: a part JSON Schema can't say (a `z.date()`, a `z.custom()`, a fuz_schema `check`) is left out or `{}` and the bounds around it still read; it throws on a schema an emitter refuses even then. A pipe yields its input stage only, and a `.refine()` never appears (a code-point length bound generates nothing). Every JSON Schema read in the generators goes through it.
485
485
  - `detect_format(field_schema)` — `detect_json_schema_format` over `to_field_json_schema`: the `format`, `'pattern'` for a regex, or `null`.
486
486
  - `generate_valid_value(field, field_schema)` — base-type switch producing a valid sample (UUIDs → nil UUID, strings → `'xxxxxxxxxx'`, numbers → `1`, objects → `generate_valid_object` against the field schema, so a nested refinement is satisfied too, enums → first entry, etc.). For branded-string refinements, walks a fallback chain synthesized from the `pattern` string the JSON Schema representation exposes: fixed-length hex (`^[0-9a-f]{N}$` — blake3 / sha256 / md5 digests; `0`.repeat(N)), prefix-lengthed slug (`^<prefix>_[A-Za-z0-9_-]{N}$` — `ApiTokenId`-style ids; `<prefix>_` + `x`.repeat(N)), absolute path prefix, URL prefix, two `/`-joined segments (an `owner/name` slug). First candidate that `safeParse` accepts is used.
487
487
  - `generate_valid_string_param(field, field_schema)` — a string a URL-sourced field (route param, query value) accepts: the nil UUID for a UUID field, else the first of `test_value`, the generated valid value as a string, `1`, `0`, `true`, `false`, the field's JSON Schema `default` or lower bound as a string (a preprocessed integer whose minimum is above one) and a synthesized string the field accepts; `null` when none does. The params and query case generators build their base from it.
@@ -560,7 +560,10 @@ rather than `ERROR_INVALID_JSON_BODY`.
560
560
  404 in `error_schemas` + an extractable error code (`z.literal` or first
561
561
  `z.enum`), replaces the handler with a stub returning `{error: <code>}`,
562
562
  fires with nil-UUID params, asserts 404 + body matches the declared 404 Zod
563
- schema. No DB needed.
563
+ schema. No DB needed. The code comes from `extract_404_error_code(schema)`,
564
+ which reads the output-side JSON Schema of a Zod or fuz_schema schema with
565
+ `unrepresentable: 'any'`, so a field JSON Schema can't say beside `error`
566
+ (a transform) no longer drops the route from the suite.
564
567
 
565
568
  ### `adversarial_headers.ts` — header injection suite
566
569
 
@@ -756,8 +759,8 @@ waiter on timeout so the `waiters` array doesn't grow.
756
759
  Six tests in two top-level groups:
757
760
 
758
761
  1. **schema-level** (3 tests, no DB) — walks JSON Schema representations:
759
- - `no sensitive fields in any output schema` — `sensitive_field_blocklist`
760
- - `no admin-only fields in non-admin output schemas` — `admin_only_field_blocklist`
762
+ - `no sensitive fields in any output schema` — `sensitive_field_blocklist`, over every route, RPC method and WS method output, and the params the server pushes over WS (a `remote_notification`'s payload, whose `output` is `z.void()`, and the request of a `request_response` with `initiator` `'backend'` or `'both'`)
763
+ - `no admin-only fields in non-admin output schemas` — `admin_only_field_blocklist`, over the route outputs a non-admin reaches; routes only, since the blocklist matches by name and domain RPC/WS outputs carry `created_by`/`updated_by` legitimately. Admin-gated means every role in an any-of `roles` (or a WS endpoint's `required_roles`) is `admin` or `keeper`, or the daemon token is required
761
764
  - `no sensitive fields in any error schema`
762
765
  2. **runtime** (3 tests, DB-backed via `create_test_app`):
763
766
  - `unauthenticated error responses contain no sensitive fields`
@@ -765,11 +768,21 @@ Six tests in two top-level groups:
765
768
  - `all 2xx responses pass field blocklists` — GETs sorted before POSTs so data-returning routes fire before destructive ones (logout, revoke-all) invalidate sessions
766
769
 
767
770
  Support functions: `collect_json_schema_property_names(schema)` (walks
768
- `properties`/`items`/`allOf`/`anyOf`/`oneOf`/`additionalProperties`),
769
- `assert_output_schemas_no_sensitive_fields(surface, fields?)`,
770
- `assert_non_admin_schemas_no_admin_fields(surface, fields?)`.
771
+ `properties`/`patternProperties`/`additionalProperties`/`items`/`prefixItems`/`contains`,
772
+ `allOf`/`anyOf`/`oneOf`/`not`/`if`/`then`/`else`, and `$defs`/`definitions`
773
+ values, where a lazy or `.meta({id})` schema's body sits behind a `$ref`),
774
+ `assert_output_schemas_no_sensitive_fields(surface_source, fields?, skip_routes?)`,
775
+ `assert_non_admin_schemas_no_admin_fields(surface_source, fields?, skip_routes?)`.
776
+ Both read each output from its spec on both sides (`schema_to_surface`): the
777
+ output side the surface records, and the input side, since a transform's output
778
+ has no JSON Schema form and a field inside a transformed subtree shows only
779
+ there. The input side is a superset, so a transform that deliberately drops a
780
+ blocklisted field is flagged too — skip that output by its key.
771
781
 
772
782
  Options: `{setup_test, surface_source, sensitive_fields?, admin_only_fields?, skip_routes?}`.
783
+ `skip_routes` keys a route as `'METHOD /path'`, an RPC or WS method output
784
+ as `'/path method_name'`, and pushed WS params as `'/path method_name params'`
785
+ (the schema-level checks only).
773
786
 
774
787
  ### `rate_limiting.ts` — `describe_rate_limiting_tests`
775
788
 
@@ -1917,7 +1930,7 @@ the option type states whether the bundle is read.
1917
1930
  pages tiling every row; a `data` that is no `CellData` — a non-object, or a
1918
1931
  non-string `label` / `summary` — refused 400 `invalid_params` with the
1919
1932
  generic message and no reason (no `data` beyond a TS spine's DEV-only
1920
- `issues`, an array of Zod issues) on `cell_create`, on `cell_update` of a
1933
+ `issues`, an array of the schema library's issues) on `cell_create`, on `cell_update` of a
1921
1934
  missing and of a hidden cell, and, with `cell_relations`, on `cell_clone`'s
1922
1935
  `with_data_patch` — ahead of the 404 mask the same hidden-cell call answers
1923
1936
  when well-typed, with the keeper's cell count unchanged; those cases run as
@@ -2681,7 +2694,7 @@ USERNAME_LENGTH_MAX]` = `[3, 39]` boundary edges (just-outside → 400,
2681
2694
  `_`/`-` accepted), catching an off-by-one or position bug in the TS Zod
2682
2695
  `.min/.max/.regex` vs the Rust byte-scan `is_valid_username_for_creation`.
2683
2696
  - **Email format (creation)** — the optional signup `email` validated to the
2684
- loose `local@domain.tld` shape (TS `Email` `^[^\s@]+@[^\s@]+\.[^\s@]+$` + 254-byte
2697
+ loose `local@domain.tld` shape (TS `Email` `^[^\s\u0085@]+@[^\s\u0085@]+\.[^\s\u0085@]+$` + 254-byte
2685
2698
  bound, Rust `is_valid_email`): malformed (no `@` / no domain dot / empty
2686
2699
  side / dot at a domain edge / whitespace / over-length) → 400, well-formed →
2687
2700
  403 no-invite. Accepted siblings include the single-char-TLD `a@b.c` that
@@ -1,5 +1,20 @@
1
1
  import './assert_dev_env.js';
2
+ import type { ValidationSchema } from '../schema_issues.js';
2
3
  import type { AdversarialTestOptions } from './attack_surface.js';
4
+ /**
5
+ * Extract the error code from a 404 error schema, Zod or `@fuzdev/fuz_schema`,
6
+ * for use in the stub handler.
7
+ *
8
+ * Reads the schema's output-side JSON Schema with `unrepresentable: 'any'`,
9
+ * so a field JSON Schema can't say (a transform, a `z.custom()`) beside
10
+ * `error` doesn't hide the code. Supports a literal (`{const: '...'}`) and an
11
+ * enum (`{enum: [...]}`, uses first value); `null` when `error` is neither.
12
+ * A schema either emitter refuses outright throws.
13
+ *
14
+ * @param schema - a route's declared 404 error schema
15
+ * @returns the code the stub handler answers with, or `null`
16
+ */
17
+ export declare const extract_404_error_code: (schema: ValidationSchema) => string | null;
3
18
  /**
4
19
  * Generate adversarial 404 response validation tests.
5
20
  *
@@ -1 +1 @@
1
- {"version":3,"file":"adversarial_404.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_404.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAoB7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AA6BlE;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,sBAAsB,KAAG,IA+E1E,CAAC"}
1
+ {"version":3,"file":"adversarial_404.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_404.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAqB7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAOlE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,gBAAgB,KAAG,MAAM,GAAG,IAe1E,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,sBAAsB,KAAG,IA+E1E,CAAC"}
@@ -12,31 +12,38 @@ import './assert_dev_env.js';
12
12
  */
13
13
  import { test, assert, describe } from 'vitest';
14
14
  import { z } from 'zod';
15
+ import { is_schema } from '@fuzdev/fuz_schema/schema.ts';
16
+ import { to_json_schema } from '@fuzdev/fuz_schema/json_schema.ts';
15
17
  import { is_null_schema } from '../http/schema_helpers.js';
16
18
  import { create_auth_test_apps, create_route_skip_filter, select_auth_app } from './auth_apps.js';
17
19
  import { resolve_valid_path, generate_valid_body, to_route_content_type } from './schema_generators.js';
18
20
  /**
19
- * Extract the error code from a 404 Zod schema for use in the stub handler.
21
+ * Extract the error code from a 404 error schema, Zod or `@fuzdev/fuz_schema`,
22
+ * for use in the stub handler.
20
23
  *
21
- * Supports `z.literal()` (`{const: '...'}`) and `z.enum()` (`{enum: [...]}`, uses first value).
24
+ * Reads the schema's output-side JSON Schema with `unrepresentable: 'any'`,
25
+ * so a field JSON Schema can't say (a transform, a `z.custom()`) beside
26
+ * `error` doesn't hide the code. Supports a literal (`{const: '...'}`) and an
27
+ * enum (`{enum: [...]}`, uses first value); `null` when `error` is neither.
28
+ * A schema either emitter refuses outright throws.
29
+ *
30
+ * @param schema - a route's declared 404 error schema
31
+ * @returns the code the stub handler answers with, or `null`
22
32
  */
23
- const extract_404_error_code = (schema) => {
24
- try {
25
- const json = z.toJSONSchema(schema);
26
- if (json.type !== 'object' || !json.properties || typeof json.properties !== 'object')
27
- return null;
28
- const props = json.properties;
29
- if (!props.error || typeof props.error !== 'object')
30
- return null;
31
- const error_schema = props.error;
32
- if (typeof error_schema.const === 'string')
33
- return error_schema.const;
34
- if (Array.isArray(error_schema.enum) && typeof error_schema.enum[0] === 'string')
35
- return error_schema.enum[0];
36
- }
37
- catch {
38
- // schema can't be converted
39
- }
33
+ export const extract_404_error_code = (schema) => {
34
+ const json = (is_schema(schema)
35
+ ? to_json_schema(schema, { unrepresentable: 'any' })
36
+ : z.toJSONSchema(schema, { unrepresentable: 'any' }));
37
+ if (json.type !== 'object' || !json.properties || typeof json.properties !== 'object')
38
+ return null;
39
+ const props = json.properties;
40
+ if (!props.error || typeof props.error !== 'object')
41
+ return null;
42
+ const error_schema = props.error;
43
+ if (typeof error_schema.const === 'string')
44
+ return error_schema.const;
45
+ if (Array.isArray(error_schema.enum) && typeof error_schema.enum[0] === 'string')
46
+ return error_schema.enum[0];
40
47
  return null;
41
48
  };
42
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"adversarial_input_cases.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_input_cases.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAA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G;AACH,eAAO,MAAM,0BAA0B,GAAI,eAAe,CAAC,CAAC,SAAS,KAAG,KAAK,CAAC,cAAc,CAoB3F,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,CAAC,CAAC,SAAS,KAAG,KAAK,CAAC,aAAa,CAkCxF,CAAC"}
@@ -195,11 +195,11 @@ export const generate_input_test_cases = (input_schema, options) => {
195
195
  if (field.required && !field.nullable && field.base_type !== 'null') {
196
196
  push_field_case(`null: ${field.name}`, null, 'type');
197
197
  }
198
+ if (!field_base)
199
+ continue; // no body to break a constraint on
198
200
  // the field's input-side JSON Schema — format, pattern and bounds, read
199
201
  // through a transform or pipe and under a nullable's `anyOf`
200
202
  const json = to_field_json_schema(field_schema);
201
- if (!json || !field_base)
202
- continue; // no constraints, or no body to break them on
203
203
  // format violation for constrained string fields
204
204
  const format = detect_json_schema_format(json);
205
205
  if (format) {
@@ -1,5 +1,5 @@
1
1
  import './assert_dev_env.js';
2
- import { z } from 'zod';
2
+ import { object } from '@fuzdev/fuz_schema/schema.ts';
3
3
  import { Logger } from '@fuzdev/fuz_util/log.ts';
4
4
  import { DEFAULT_TEST_PASSWORD } from './test_credentials.js';
5
5
  import { ROLE_KEEPER } from '../auth/role_schema.js';
@@ -280,7 +280,7 @@ export const create_loopback_app_server_options = () => {
280
280
  return {
281
281
  allowed_origins: parsed.origins,
282
282
  proxy: { trusted_proxies: ['127.0.0.1'], get_connection_ip: () => '127.0.0.1' },
283
- env_schema: z.object({})
283
+ env_schema: object({})
284
284
  };
285
285
  };
286
286
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"cell_crud.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/cell_crud.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA0E9B,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,YAAY,CAAC;AAgE1E,eAAO,MAAM,8BAA8B,GAC1C,SAAS,uCAAuC,KAC9C,IA4uBF,CAAC"}
1
+ {"version":3,"file":"cell_crud.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/cell_crud.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA0E9B,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,YAAY,CAAC;AAkE1E,eAAO,MAAM,8BAA8B,GAC1C,SAAS,uCAAuC,KAC9C,IA4uBF,CAAC"}
@@ -79,9 +79,10 @@ const MISTYPED_CELL_DATA = [
79
79
  const INVALID_PARAMS_MESSAGE = jsonrpc_error_messages.invalid_params().message;
80
80
  /**
81
81
  * Assert `r` is a schema refusal: 400 `invalid_params` with the generic
82
- * message and no `data`, save the Zod `issues` a TS spine adds under DEV
83
- * alone — an array of issue objects, each with a string `code` and
84
- * `message`, and never a `reason`.
82
+ * message and no `data`, save the issues a TS spine adds under DEV alone —
83
+ * an array of the schema library's issue objects, and never a `reason`. A Zod
84
+ * issue has a string `code` and `message`; a fuz_schema issue a string
85
+ * `kind`, and a `message` only when one was set.
85
86
  */
86
87
  const assert_schema_refusal = (r, label) => {
87
88
  const detail = `${label}: got ${r.status} ${JSON.stringify(r.error ?? r.result)}`;
@@ -97,10 +98,11 @@ const assert_schema_refusal = (r, label) => {
97
98
  const { issues } = data;
98
99
  assert.ok(Array.isArray(issues), `${detail} — DEV-only issues that are no array`);
99
100
  for (const issue of issues) {
101
+ const { code, kind, message } = (issue ?? {});
100
102
  assert.ok(typeof issue === 'object' &&
101
103
  issue !== null &&
102
- typeof issue.code === 'string' &&
103
- typeof issue.message === 'string', `${detail} — a DEV-only issue that is no Zod issue`);
104
+ ((typeof code === 'string' && typeof message === 'string') ||
105
+ (typeof kind === 'string' && (message === undefined || typeof message === 'string'))), `${detail} — a DEV-only issue that is no Zod or fuz_schema issue`);
104
106
  }
105
107
  };
106
108
  /**
@@ -76,7 +76,7 @@ import '../assert_dev_env.js';
76
76
  *
77
77
  * **Email format (creation):** the optional signup `email` is validated to a
78
78
  * loose `local@domain.tld` shape on both spines — TS `Email`
79
- * (`^[^\s@]+@[^\s@]+\.[^\s@]+$` plus a 254-byte (RFC 5321 octet) length bound; whitespace `White_Space ∪ {U+FEFF}`), Rust the
79
+ * (`^[^\s\u0085@]+@[^\s\u0085@]+\.[^\s\u0085@]+$` plus a 254-byte (RFC 5321 octet) length bound; whitespace `White_Space ∪ {U+FEFF}`), Rust the
80
80
  * hand-rolled `is_valid_email`. A malformed email → 400, a well-formed one →
81
81
  * 403 no-matching-invite (the same accept/reject settle the username tables
82
82
  * use). The accepted siblings include the single-char-TLD `a@b.c` that Zod's
@@ -195,7 +195,7 @@ const USERNAME_FORMAT_CASES = [
195
195
  ];
196
196
  /**
197
197
  * Signup email-format cases for the loose `Email` shape `local@domain.tld`
198
- * (TS `^[^\s@]+@[^\s@]+\.[^\s@]+$` plus the 254 length bound; Rust the
198
+ * (TS `^[^\s\u0085@]+@[^\s\u0085@]+\.[^\s\u0085@]+$` plus the 254 length bound; Rust the
199
199
  * hand-rolled `is_valid_email`). The rejected cases each violate the shape at
200
200
  * a different point — no `@`, no dot in the domain, empty local/domain, a dot
201
201
  * at a domain edge, surrounding whitespace, over the length bound — so a
@@ -95,8 +95,9 @@ export interface StandardCrossProcessTestOptions {
95
95
  round_trip_skip_routes?: Array<string>;
96
96
  /**
97
97
  * Forwarded to `describe_data_exposure_tests` as `skip_routes`
98
- * (`'METHOD /path'` keys), as the in-process bundle's consumers pass it
99
- * directly.
98
+ * (`'METHOD /path'` keys for routes, `'/path method_name'` for RPC or WS
99
+ * method outputs, `'/path method_name params'` for params the server pushes
100
+ * over WS), as the in-process bundle's consumers pass it directly.
100
101
  */
101
102
  data_exposure_skip_routes?: Array<string>;
102
103
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"standard.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/standard.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;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AKG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,GAAG,CAC1B,MAAM,EACN,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CACnF,CAAC;CACF;AAED;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,+BAA+B,KACtC,IAuCF,CAAC"}
@@ -38,8 +38,13 @@ export declare const DaemonInfo: import("@fuzdev/fuz_schema/schema.ts").Schema<{
38
38
  pid: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
39
39
  /** Port the server is listening on. */
40
40
  port: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
41
- /** ISO timestamp when server started. */
42
- started: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
41
+ /**
42
+ * When the server started, an RFC 3339 date and time in UTC
43
+ * (`2026-01-01T00:00:00.000Z`): a four-digit year, seconds required, a
44
+ * fraction of up to 9 digits or none, `Z` and no offset — fuz_schema's
45
+ * `iso_datetime`.
46
+ */
47
+ started: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
43
48
  /** Package version of the application. */
44
49
  app_version: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
45
50
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"daemon_info.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/daemon_info.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;GAKG;AAEH,OAAO,EAMN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGjG;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,IAGtF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;IACtB,sBAAsB;;IAEtB,yBAAyB;;IAEzB,uCAAuC;;IAEvC,yCAAyC;;IAEzC,0CAA0C;;EAEzC,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAChC,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EACjC,MAAM,MAAM,KACV,MAAM,GAAG,IAGX,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC7B,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB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F;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC7B,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,QAAQ,CAAC,EAC7F,MAAM,MAAM,EACZ,MAAM,UAAU,KACd,OAAO,CAAC,IAAI,CAWd,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC5B,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,OAAO,EACzF,MAAM,MAAM,KACV,OAAO,CAAC,UAAU,GAAG,IAAI,CAwB3B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,WAAW,EAAE,KAAK,MAAM,KAAG,OAAO,CAAC,OAAO,CAG1F,CAAC"}
@@ -5,7 +5,7 @@ import './assert_dev_env.js';
5
5
  *
6
6
  * @module
7
7
  */
8
- import { format_issue, number, object, parse, string } from '@fuzdev/fuz_schema/schema.ts';
8
+ import { format_issue, iso_datetime, number, object, parse, pipe, string } from '@fuzdev/fuz_schema/schema.ts';
9
9
  import { write_file_atomic } from '../runtime/fs.js';
10
10
  /**
11
11
  * Get an app's home directory path (`~/.{name}`).
@@ -29,8 +29,13 @@ export const DaemonInfo = object({
29
29
  pid: number,
30
30
  /** Port the server is listening on. */
31
31
  port: number,
32
- /** ISO timestamp when server started. */
33
- started: string,
32
+ /**
33
+ * When the server started, an RFC 3339 date and time in UTC
34
+ * (`2026-01-01T00:00:00.000Z`): a four-digit year, seconds required, a
35
+ * fraction of up to 9 digits or none, `Z` and no offset — fuz_schema's
36
+ * `iso_datetime`.
37
+ */
38
+ started: pipe(string, iso_datetime),
34
39
  /** Package version of the application. */
35
40
  app_version: string
36
41
  });