@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 +1 @@
1
- {"version":3,"file":"primitive_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAIlF,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACpC,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;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CAAC;AAC/E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAEA,CAAC"}
@@ -10,8 +10,8 @@
10
10
  * Split out from `auth/account_schema.ts` so the auth module shrinks to
11
11
  * entity types + client-safe JSON shapes (its real responsibility) and
12
12
  * non-auth consumers can import these primitives without dragging the
13
- * auth domain along. Future cross-domain primitives (phone, url, slug)
14
- * land here too.
13
+ * auth domain along. Future cross-domain primitives (phone, slug) land
14
+ * here too; a URL is `Url` from `@fuzdev/fuz_util/url.ts`.
15
15
  *
16
16
  * Client-safe: nothing here imports `@fuzdev/blake3-wasm`, so wire schemas
17
17
  * that validate a hash don't pull the WASM binary into a bundle.
@@ -186,7 +186,9 @@ export const create_uuid = () => crypto.randomUUID();
186
186
  * Branded UUID schema. Accepts either case and outputs lowercase — the form
187
187
  * Postgres renders a `uuid` in and every id the server mints — so a parsed id
188
188
  * compares equal to the same id read back from the database. The Rust spine
189
- * canonicalizes the same way.
189
+ * canonicalizes the same way. One exception: `z.uuid()` takes the max UUID
190
+ * (`ffffffff-ffff-ffff-ffff-ffffffffffff`) only in lowercase, and
191
+ * `.toLowerCase()` runs after the check, so the uppercase max is refused.
190
192
  *
191
193
  * `.toLowerCase()` rather than `.transform()`: an overwrite keeps the output
192
194
  * type and stays invisible to `z.toJSONSchema`, where a transform would leave
@@ -195,7 +197,14 @@ export const create_uuid = () => crypto.randomUUID();
195
197
  export const Uuid = z.uuid().toLowerCase().brand('Uuid');
196
198
  /** `Uuid` that defaults to a fresh `create_uuid()` when the input is `undefined`. */
197
199
  export const UuidWithDefault = Uuid.default(create_uuid);
198
- /** Branded ISO 8601 datetime schema. */
200
+ /**
201
+ * Branded datetime schema, zod's default `z.iso.datetime()`: an RFC 3339 date
202
+ * and time in UTC with a real calendar date, `Z` and no offset, and a fraction
203
+ * of any length or none. Zod 4.6 requires the seconds; earlier zod 4, which
204
+ * the `zod` peer range admits, also takes `HH:MMZ`. fuz_schema's
205
+ * `iso_datetime` is this grammar with the seconds required and the fraction
206
+ * capped at 9 digits.
207
+ */
199
208
  export const Datetime = z.iso.datetime().brand('Datetime');
200
209
  /** Returns an ISO 8601 datetime string for the current time. */
201
210
  export const get_datetime_now = () => new Date().toISOString();
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Validation issues from either schema library the stack's specs use: Zod
3
+ * (`z.core.$ZodIssue`) and `@fuzdev/fuz_schema` (`SchemaIssue`). A schema is
4
+ * wholly one library, so one parse's issues are all of one kind; these
5
+ * helpers read either, so the dispatcher, `ActionEvent` and the
6
+ * forward-compatible reads treat a spec the same whichever library it is
7
+ * written in.
8
+ *
9
+ * @module
10
+ */
11
+ import { z } from 'zod';
12
+ import { SchemaError, type AnySchema, type Infer, type SchemaIssue } from '@fuzdev/fuz_schema/schema.ts';
13
+ import type { Result } from '@fuzdev/fuz_util/result.ts';
14
+ /** A schema of either library: a Zod schema or a `@fuzdev/fuz_schema` one. */
15
+ export type ValidationSchema = z.ZodType | AnySchema;
16
+ /** The output type of a `ValidationSchema`. */
17
+ export type ValidationOutput<T extends ValidationSchema> = T extends z.ZodType ? z.output<T> : T extends AnySchema ? Infer<T> : never;
18
+ /** One issue of a failed parse, in the library's own shape. */
19
+ export type AnyIssue = z.core.$ZodIssue | SchemaIssue;
20
+ /** What `parse_any` returns: the output, or the failed parse's issues in the library's order. */
21
+ export type ParseAnyResult<T> = Result<{
22
+ value: T;
23
+ }, {
24
+ issues: Array<AnyIssue>;
25
+ }>;
26
+ /**
27
+ * Parse `value` with a schema of either library: `parse` for a fuz_schema
28
+ * schema (`is_schema`), `safeParse` for a Zod one.
29
+ *
30
+ * A fuz_schema parse reports at most its first hundred issues, a Zod parse
31
+ * every issue.
32
+ *
33
+ * @param schema - a Zod or fuz_schema schema
34
+ * @param value - the value to validate
35
+ * @returns the output, or the issues
36
+ */
37
+ export declare const parse_any: <T extends ValidationSchema>(schema: T, value: unknown) => ParseAnyResult<ValidationOutput<T>>;
38
+ /**
39
+ * Whether `issue` is Zod's: every Zod issue has a `code`, a fuz_schema issue a `kind`.
40
+ */
41
+ export declare const is_zod_issue: (issue: AnyIssue) => issue is z.core.$ZodIssue;
42
+ /**
43
+ * Whether `issue` sits on the input itself rather than on one of its fields:
44
+ * a non-object input, or an unknown key on the input object — what the Rust
45
+ * twin refuses before reading any field.
46
+ *
47
+ * Zod reports both at an empty path, its `unrecognized_keys` naming the keys.
48
+ * fuz_schema reports a non-object at an empty path and each unknown key as an
49
+ * `unknown_key` issue whose path ends at the key, so one on the input has a
50
+ * path of the key alone. An unknown key on a nested object is on that field,
51
+ * as Zod's is.
52
+ *
53
+ * On the wire the `unknown_key` rule changes no answer today: a root
54
+ * `unknown_key` comes from a root `object`, which `resolve_issues_invalid_reason`
55
+ * already answers with none from its check of the input's keys, or from a
56
+ * schema such as a `variant` whose fields resolve no reason. It is kept as the
57
+ * direct statement of Zod's rule.
58
+ *
59
+ * @param issue - one issue of a failed parse
60
+ */
61
+ export declare const issue_is_on_input: (issue: AnyIssue) => boolean;
62
+ /** Keys a parse refused as unknown, and the path of the object holding them. */
63
+ export interface UnknownKeyTarget {
64
+ /** The path of the object the keys are on, `[]` for the input itself. */
65
+ path: ReadonlyArray<PropertyKey>;
66
+ /** The unknown keys. */
67
+ keys: ReadonlyArray<PropertyKey>;
68
+ }
69
+ /**
70
+ * The unknown keys among `issues`, each with the path of its object, or
71
+ * `null` when any issue is something else.
72
+ *
73
+ * A Zod `unrecognized_keys` issue is at its object's path and names every
74
+ * key; a fuz_schema `unknown_key` issue is one key, the last element of its
75
+ * path.
76
+ *
77
+ * @param issues - a failed parse's issues
78
+ * @returns a target per issue, or `null` when not every issue is an unknown key
79
+ */
80
+ export declare const unknown_key_targets: (issues: ReadonlyArray<AnyIssue>) => Array<UnknownKeyTarget> | null;
81
+ /**
82
+ * A failed parse's issues as text: Zod's `z.prettifyError` text for Zod
83
+ * issues, and for fuz_schema issues their `format_issue` lines.
84
+ *
85
+ * @param issues - a failed parse's issues, all of one library
86
+ */
87
+ export declare const format_issues: (issues: ReadonlyArray<AnyIssue>) => string;
88
+ /**
89
+ * Whether `err` is a thrown validation failure of either library: a
90
+ * `z.ZodError` or a fuz_schema `SchemaError` (`parse_or_throw`). Both carry
91
+ * the failed parse's `issues`.
92
+ *
93
+ * @param err - a caught value
94
+ */
95
+ export declare const is_schema_validation_error: (err: unknown) => err is z.ZodError | SchemaError;
96
+ //# sourceMappingURL=schema_issues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema_issues.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/schema_issues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIN,WAAW,EACX,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC;AAErD,+CAA+C;AAC/C,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,GAC3E,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACX,CAAC,SAAS,SAAS,GAClB,KAAK,CAAC,CAAC,CAAC,GACR,KAAK,CAAC;AAEV,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC;AAEtD,iGAAiG;AACjG,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,MAAM,CAAC;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,EAAE;IAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;CAAE,CAAC,CAAC;AAElF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,gBAAgB,EACnD,QAAQ,CAAC,EACT,OAAO,OAAO,KACZ,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAWpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,QAAQ,KAAG,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,SAA4B,CAAC;AAE5F;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,QAAQ,KAAG,OAE8B,CAAC;AAEnF,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;IAChC,yEAAyE;IACzE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACjC,wBAAwB;IACxB,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACjC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC/B,QAAQ,aAAa,CAAC,QAAQ,CAAC,KAC7B,KAAK,CAAC,gBAAgB,CAAC,GAAG,IAY5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,aAAa,CAAC,QAAQ,CAAC,KAAG,MAO/D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,CAAC,CAAC,QAAQ,GAAG,WACtB,CAAC"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Validation issues from either schema library the stack's specs use: Zod
3
+ * (`z.core.$ZodIssue`) and `@fuzdev/fuz_schema` (`SchemaIssue`). A schema is
4
+ * wholly one library, so one parse's issues are all of one kind; these
5
+ * helpers read either, so the dispatcher, `ActionEvent` and the
6
+ * forward-compatible reads treat a spec the same whichever library it is
7
+ * written in.
8
+ *
9
+ * @module
10
+ */
11
+ import { z } from 'zod';
12
+ import { format_issue, is_schema, parse, SchemaError } from '@fuzdev/fuz_schema/schema.ts';
13
+ /**
14
+ * Parse `value` with a schema of either library: `parse` for a fuz_schema
15
+ * schema (`is_schema`), `safeParse` for a Zod one.
16
+ *
17
+ * A fuz_schema parse reports at most its first hundred issues, a Zod parse
18
+ * every issue.
19
+ *
20
+ * @param schema - a Zod or fuz_schema schema
21
+ * @param value - the value to validate
22
+ * @returns the output, or the issues
23
+ */
24
+ export const parse_any = (schema, value) => {
25
+ if (is_schema(schema)) {
26
+ const result = parse(schema, value);
27
+ return result.ok
28
+ ? { ok: true, value: result.value }
29
+ : { ok: false, issues: result.issues };
30
+ }
31
+ const result = schema.safeParse(value);
32
+ return result.success
33
+ ? { ok: true, value: result.data }
34
+ : { ok: false, issues: result.error.issues };
35
+ };
36
+ /**
37
+ * Whether `issue` is Zod's: every Zod issue has a `code`, a fuz_schema issue a `kind`.
38
+ */
39
+ export const is_zod_issue = (issue) => 'code' in issue;
40
+ /**
41
+ * Whether `issue` sits on the input itself rather than on one of its fields:
42
+ * a non-object input, or an unknown key on the input object — what the Rust
43
+ * twin refuses before reading any field.
44
+ *
45
+ * Zod reports both at an empty path, its `unrecognized_keys` naming the keys.
46
+ * fuz_schema reports a non-object at an empty path and each unknown key as an
47
+ * `unknown_key` issue whose path ends at the key, so one on the input has a
48
+ * path of the key alone. An unknown key on a nested object is on that field,
49
+ * as Zod's is.
50
+ *
51
+ * On the wire the `unknown_key` rule changes no answer today: a root
52
+ * `unknown_key` comes from a root `object`, which `resolve_issues_invalid_reason`
53
+ * already answers with none from its check of the input's keys, or from a
54
+ * schema such as a `variant` whose fields resolve no reason. It is kept as the
55
+ * direct statement of Zod's rule.
56
+ *
57
+ * @param issue - one issue of a failed parse
58
+ */
59
+ export const issue_is_on_input = (issue) => issue.path.length === 0 ||
60
+ (!is_zod_issue(issue) && issue.kind === 'unknown_key' && issue.path.length === 1);
61
+ /**
62
+ * The unknown keys among `issues`, each with the path of its object, or
63
+ * `null` when any issue is something else.
64
+ *
65
+ * A Zod `unrecognized_keys` issue is at its object's path and names every
66
+ * key; a fuz_schema `unknown_key` issue is one key, the last element of its
67
+ * path.
68
+ *
69
+ * @param issues - a failed parse's issues
70
+ * @returns a target per issue, or `null` when not every issue is an unknown key
71
+ */
72
+ export const unknown_key_targets = (issues) => {
73
+ const targets = [];
74
+ for (const issue of issues) {
75
+ if (is_zod_issue(issue)) {
76
+ if (issue.code !== 'unrecognized_keys')
77
+ return null;
78
+ targets.push({ path: issue.path, keys: issue.keys });
79
+ }
80
+ else {
81
+ if (issue.kind !== 'unknown_key' || issue.path.length === 0)
82
+ return null;
83
+ targets.push({ path: issue.path.slice(0, -1), keys: [issue.path.at(-1)] });
84
+ }
85
+ }
86
+ return targets;
87
+ };
88
+ /**
89
+ * A failed parse's issues as text: Zod's `z.prettifyError` text for Zod
90
+ * issues, and for fuz_schema issues their `format_issue` lines.
91
+ *
92
+ * @param issues - a failed parse's issues, all of one library
93
+ */
94
+ export const format_issues = (issues) => {
95
+ const first = issues[0];
96
+ if (!first)
97
+ return '';
98
+ if (is_zod_issue(first)) {
99
+ return z.prettifyError({ issues: issues });
100
+ }
101
+ return issues.map(format_issue).join('\n');
102
+ };
103
+ /**
104
+ * Whether `err` is a thrown validation failure of either library: a
105
+ * `z.ZodError` or a fuz_schema `SchemaError` (`parse_or_throw`). Both carry
106
+ * the failed parse's `issues`.
107
+ *
108
+ * @param err - a caught value
109
+ */
110
+ export const is_schema_validation_error = (err) => err instanceof z.ZodError || err instanceof SchemaError;
@@ -1,13 +1,29 @@
1
1
  /**
2
2
  * Shared Zod `.meta()` conventions for fuz_app schemas.
3
3
  *
4
- * Cross-cutting metadata shape used by env schemas, auth input schemas,
5
- * surface generation, and test helpers.
4
+ * Cross-cutting metadata shape used by auth and action input schemas,
5
+ * surface generation, and test helpers. The env schemas are
6
+ * `@fuzdev/fuz_schema` and carry the same keys in its `meta`
7
+ * (`sensitivity.ts`, `find_schema_sensitivity`); this module adds
8
+ * `invalid_reason` to fuz_schema's `SchemaMeta`, so the declared refusal
9
+ * reason of an action input reads the same whichever library its schema is.
6
10
  *
7
11
  * @module
8
12
  */
9
13
  import type { z } from 'zod';
10
14
  import type { Sensitivity } from './sensitivity.js';
15
+ import { type AnyIssue, type ValidationSchema } from './schema_issues.js';
16
+ declare module '@fuzdev/fuz_schema/meta.ts' {
17
+ interface SchemaMeta {
18
+ /**
19
+ * The `error.data.reason` an action input refuses this field with, as
20
+ * `SchemaFieldMeta.invalid_reason` declares it on a Zod field. Read
21
+ * through the field's layers (`get_schema_meta`), the outermost
22
+ * declaration winning.
23
+ */
24
+ invalid_reason?: string;
25
+ }
26
+ }
11
27
  /** Zod `.meta()` shape for fuz_app schema metadata conventions. */
12
28
  export interface SchemaFieldMeta {
13
29
  description?: string;
@@ -124,24 +140,33 @@ export declare const schema_has_sensitive_field: (schema: z.ZodType) => boolean;
124
140
  * key) ends the walk, so a fault inside a declared field still resolves to
125
141
  * that field's reason. An empty path — a whole-input fault such as an
126
142
  * unrecognized key on the input object — resolves to none, as does a schema
127
- * that is not an object.
143
+ * that is not an object. A `@fuzdev/fuz_schema` schema is walked through its
144
+ * entries (`get_schema_entries`) and reads the reason with `get_schema_meta`.
128
145
  *
129
- * @param input_schema - an action's input schema
130
- * @param path - the failing issue's path (`ZodError.issues[0].path`)
146
+ * @param input_schema - an action's input schema, Zod or fuz_schema
147
+ * @param path - the failing issue's path
131
148
  * @returns the declared reason, or `undefined`
132
149
  */
133
- export declare const resolve_invalid_reason: (input_schema: z.ZodType, path: ReadonlyArray<PropertyKey>) => string | undefined;
150
+ export declare const resolve_invalid_reason: (input_schema: ValidationSchema, path: ReadonlyArray<PropertyKey>) => string | undefined;
134
151
  /**
135
152
  * The `error.data.reason` a failed input parse answers: the declared reason
136
153
  * of the first issue's field (`resolve_invalid_reason`), or none when any
137
- * issue sits on the input itself. Such an issue is an unknown key on the
138
- * input object (or a non-object input), which the Rust twin refuses before
139
- * reading any field, so a stale client sending an extra key gets the same
140
- * answer from both spines whatever else its body gets wrong.
154
+ * issue sits on the input itself (`issue_is_on_input`). Such an issue is an
155
+ * unknown key on the input object (or a non-object input), which the Rust
156
+ * twin refuses before reading any field, so a stale client sending an extra
157
+ * key gets the same answer from both spines whatever else its body gets
158
+ * wrong.
159
+ *
160
+ * A `@fuzdev/fuz_schema` parse reports at most a hundred issues, so faults on
161
+ * the fields can crowd an unknown key out of them. For a strict `object`
162
+ * input, `input` is checked for a key the schema doesn't name, as the Rust
163
+ * twin checks it, whatever the issues hold. A Zod parse reports every issue
164
+ * and `input` is not read.
141
165
  *
142
- * @param input_schema - an action's input schema
143
- * @param issues - the failed parse's issues, in Zod's order
166
+ * @param input_schema - an action's input schema, Zod or fuz_schema
167
+ * @param issues - the failed parse's issues, in the library's order
168
+ * @param input - the value that was parsed
144
169
  * @returns the declared reason, or `undefined`
145
170
  */
146
- export declare const resolve_issues_invalid_reason: (input_schema: z.ZodType, issues: ReadonlyArray<z.core.$ZodIssue>) => string | undefined;
171
+ export declare const resolve_issues_invalid_reason: (input_schema: ValidationSchema, issues: ReadonlyArray<AnyIssue>, input: unknown) => string | undefined;
147
172
  //# sourceMappingURL=schema_meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema_meta.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/schema_meta.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;;;;OAUG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;;;;;;;;;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ACzC,cAAc,gBAAgB,EAC9B,QAAQ,aAAa,CAAC,QAAQ,CAAC,EAC/B,OAAO,OAAO,KACZ,MAAM,GAAG,SAKX,CAAC"}
@@ -1,12 +1,19 @@
1
1
  /**
2
2
  * Shared Zod `.meta()` conventions for fuz_app schemas.
3
3
  *
4
- * Cross-cutting metadata shape used by env schemas, auth input schemas,
5
- * surface generation, and test helpers.
4
+ * Cross-cutting metadata shape used by auth and action input schemas,
5
+ * surface generation, and test helpers. The env schemas are
6
+ * `@fuzdev/fuz_schema` and carry the same keys in its `meta`
7
+ * (`sensitivity.ts`, `find_schema_sensitivity`); this module adds
8
+ * `invalid_reason` to fuz_schema's `SchemaMeta`, so the declared refusal
9
+ * reason of an action input reads the same whichever library its schema is.
6
10
  *
7
11
  * @module
8
12
  */
13
+ import { is_schema } from '@fuzdev/fuz_schema/schema.ts';
14
+ import { get_schema_entries, get_schema_meta, unwrap_schema } from '@fuzdev/fuz_schema/introspect.ts';
9
15
  import { zod_get_schema_layers, zod_unwrap_to_object } from './zod.js';
16
+ import { issue_is_on_input } from './schema_issues.js';
10
17
  /**
11
18
  * Whether `schema` carries `empty_input_handler_guarded: true` in its `.meta()`.
12
19
  *
@@ -155,13 +162,16 @@ export const schema_has_sensitive_field = (schema) => walk_sensitivity(schema, t
155
162
  * key) ends the walk, so a fault inside a declared field still resolves to
156
163
  * that field's reason. An empty path — a whole-input fault such as an
157
164
  * unrecognized key on the input object — resolves to none, as does a schema
158
- * that is not an object.
165
+ * that is not an object. A `@fuzdev/fuz_schema` schema is walked through its
166
+ * entries (`get_schema_entries`) and reads the reason with `get_schema_meta`.
159
167
  *
160
- * @param input_schema - an action's input schema
161
- * @param path - the failing issue's path (`ZodError.issues[0].path`)
168
+ * @param input_schema - an action's input schema, Zod or fuz_schema
169
+ * @param path - the failing issue's path
162
170
  * @returns the declared reason, or `undefined`
163
171
  */
164
172
  export const resolve_invalid_reason = (input_schema, path) => {
173
+ if (is_schema(input_schema))
174
+ return resolve_schema_invalid_reason(input_schema, path);
165
175
  let reason;
166
176
  let schema = input_schema;
167
177
  for (const segment of path) {
@@ -176,21 +186,61 @@ export const resolve_invalid_reason = (input_schema, path) => {
176
186
  }
177
187
  return reason;
178
188
  };
189
+ // the fuz_schema walk of `resolve_invalid_reason`
190
+ const resolve_schema_invalid_reason = (input_schema, path) => {
191
+ let reason;
192
+ let schema = input_schema;
193
+ for (const segment of path) {
194
+ if (typeof segment !== 'string')
195
+ break;
196
+ const entries = get_schema_entries(schema);
197
+ if (!entries || !Object.hasOwn(entries, segment))
198
+ break;
199
+ const field = entries[segment];
200
+ reason = get_schema_meta(field, 'invalid_reason') ?? reason;
201
+ schema = field;
202
+ }
203
+ return reason;
204
+ };
179
205
  /**
180
206
  * The `error.data.reason` a failed input parse answers: the declared reason
181
207
  * of the first issue's field (`resolve_invalid_reason`), or none when any
182
- * issue sits on the input itself. Such an issue is an unknown key on the
183
- * input object (or a non-object input), which the Rust twin refuses before
184
- * reading any field, so a stale client sending an extra key gets the same
185
- * answer from both spines whatever else its body gets wrong.
208
+ * issue sits on the input itself (`issue_is_on_input`). Such an issue is an
209
+ * unknown key on the input object (or a non-object input), which the Rust
210
+ * twin refuses before reading any field, so a stale client sending an extra
211
+ * key gets the same answer from both spines whatever else its body gets
212
+ * wrong.
213
+ *
214
+ * A `@fuzdev/fuz_schema` parse reports at most a hundred issues, so faults on
215
+ * the fields can crowd an unknown key out of them. For a strict `object`
216
+ * input, `input` is checked for a key the schema doesn't name, as the Rust
217
+ * twin checks it, whatever the issues hold. A Zod parse reports every issue
218
+ * and `input` is not read.
186
219
  *
187
- * @param input_schema - an action's input schema
188
- * @param issues - the failed parse's issues, in Zod's order
220
+ * @param input_schema - an action's input schema, Zod or fuz_schema
221
+ * @param issues - the failed parse's issues, in the library's order
222
+ * @param input - the value that was parsed
189
223
  * @returns the declared reason, or `undefined`
190
224
  */
191
- export const resolve_issues_invalid_reason = (input_schema, issues) => {
225
+ export const resolve_issues_invalid_reason = (input_schema, issues, input) => {
192
226
  const first = issues[0];
193
- if (!first || issues.some((issue) => issue.path.length === 0))
227
+ if (!first || issues.some(issue_is_on_input))
228
+ return undefined;
229
+ if (is_schema(input_schema) && has_unknown_root_key(input_schema, input))
194
230
  return undefined;
195
231
  return resolve_invalid_reason(input_schema, first.path);
196
232
  };
233
+ // whether `input` has a key the strict `object` at the root of `schema` doesn't
234
+ // name, read as that object's own check reads it (`for in`, then `Object.hasOwn`)
235
+ const has_unknown_root_key = (schema, input) => {
236
+ const root = unwrap_schema(schema);
237
+ if (root.kind !== 'object')
238
+ return false;
239
+ if (typeof input !== 'object' || input === null || Array.isArray(input))
240
+ return false;
241
+ for (const key in input) {
242
+ if (!Object.hasOwn(root.def, key))
243
+ return true;
244
+ }
245
+ return false;
246
+ };
@@ -3,10 +3,19 @@
3
3
  *
4
4
  * Used by env schemas and action input schemas to control masking/redaction
5
5
  * in startup logs, surface explorers, and test output, and to keep values
6
- * out of URLs.
6
+ * out of URLs. A Zod schema declares it with `.meta({sensitivity})`
7
+ * (`SchemaFieldMeta`, read by `schema_sensitivity`); a `@fuzdev/fuz_schema`
8
+ * schema with `meta(schema, {sensitivity})`, the key this module adds to
9
+ * fuz_schema's `SchemaMeta` by declaration merging, read by
10
+ * `find_schema_sensitivity`. `server/env.ts` and `env/env_schemas.ts` import
11
+ * this module for the declaration, so a consumer of either has the key; a
12
+ * module that imports neither and marks a fuz_schema field adds
13
+ * `import type {} from '@fuzdev/fuz_app/sensitivity.ts';`, which brings the
14
+ * declaration in without an unused binding.
7
15
  *
8
16
  * @module
9
17
  */
18
+ import type { AnySchema } from '@fuzdev/fuz_schema/schema.ts';
10
19
  /**
11
20
  * Sensitivity level for a schema field.
12
21
  *
@@ -18,4 +27,28 @@
18
27
  * logs or UI
19
28
  */
20
29
  export type Sensitivity = 'secret' | 'personal';
30
+ declare module '@fuzdev/fuz_schema/meta.ts' {
31
+ interface SchemaMeta {
32
+ /**
33
+ * Sensitivity level (`Sensitivity`): `'secret'` masks the value,
34
+ * `'personal'` only keeps it out of URLs. Read fail-safe from every
35
+ * schema the field reaches (`find_schema_sensitivity`).
36
+ */
37
+ sensitivity?: Sensitivity;
38
+ }
39
+ }
40
+ /**
41
+ * The strongest `sensitivity` declared on any schema a `@fuzdev/fuz_schema`
42
+ * field reaches — `'secret'` over `'personal'` — the fuz_schema twin of
43
+ * `schema_sensitivity`. Fail-safe: `find_schema_meta` reads every wrapper,
44
+ * every schema and action of a `pipe` (not only its first), every option of a
45
+ * union, and a `lazy`'s schema, so a secret stays masked however the field is
46
+ * wrapped, `message` included, which carries the metadata of the schema it
47
+ * was given over. It stops at structural schemas — an object's entries and an
48
+ * array's items carry their own.
49
+ *
50
+ * @param schema - a field schema, possibly wrapped
51
+ * @returns the strongest level any reachable schema declares, else `undefined`
52
+ */
53
+ export declare const find_schema_sensitivity: (schema: AnySchema) => Sensitivity | undefined;
21
54
  //# sourceMappingURL=sensitivity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sensitivity.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sensitivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC"}
1
+ {"version":3,"file":"sensitivity.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sensitivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEhD,OAAO,QAAQ,4BAA4B,CAAC;IAC3C,UAAU,UAAU;QACnB;;;;WAIG;QACH,WAAW,CAAC,EAAE,WAAW,CAAC;KAC1B;CACD;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,SAAS,KAAG,WAAW,GAAG,SAOzE,CAAC"}
@@ -3,8 +3,38 @@
3
3
  *
4
4
  * Used by env schemas and action input schemas to control masking/redaction
5
5
  * in startup logs, surface explorers, and test output, and to keep values
6
- * out of URLs.
6
+ * out of URLs. A Zod schema declares it with `.meta({sensitivity})`
7
+ * (`SchemaFieldMeta`, read by `schema_sensitivity`); a `@fuzdev/fuz_schema`
8
+ * schema with `meta(schema, {sensitivity})`, the key this module adds to
9
+ * fuz_schema's `SchemaMeta` by declaration merging, read by
10
+ * `find_schema_sensitivity`. `server/env.ts` and `env/env_schemas.ts` import
11
+ * this module for the declaration, so a consumer of either has the key; a
12
+ * module that imports neither and marks a fuz_schema field adds
13
+ * `import type {} from '@fuzdev/fuz_app/sensitivity.ts';`, which brings the
14
+ * declaration in without an unused binding.
7
15
  *
8
16
  * @module
9
17
  */
10
- export {};
18
+ import { find_schema_meta } from '@fuzdev/fuz_schema/introspect.ts';
19
+ /**
20
+ * The strongest `sensitivity` declared on any schema a `@fuzdev/fuz_schema`
21
+ * field reaches — `'secret'` over `'personal'` — the fuz_schema twin of
22
+ * `schema_sensitivity`. Fail-safe: `find_schema_meta` reads every wrapper,
23
+ * every schema and action of a `pipe` (not only its first), every option of a
24
+ * union, and a `lazy`'s schema, so a secret stays masked however the field is
25
+ * wrapped, `message` included, which carries the metadata of the schema it
26
+ * was given over. It stops at structural schemas — an object's entries and an
27
+ * array's items carry their own.
28
+ *
29
+ * @param schema - a field schema, possibly wrapped
30
+ * @returns the strongest level any reachable schema declares, else `undefined`
31
+ */
32
+ export const find_schema_sensitivity = (schema) => {
33
+ let found;
34
+ for (const sensitivity of find_schema_meta(schema, 'sensitivity')) {
35
+ if (sensitivity === 'secret')
36
+ return 'secret';
37
+ found = sensitivity;
38
+ }
39
+ return found;
40
+ };
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { Hono, type Context } from 'hono';
11
11
  import type { UpgradeWebSocket } from 'hono/ws';
12
- import { z } from 'zod';
12
+ import type { AnySchema } from '@fuzdev/fuz_schema/schema.ts';
13
13
  import { type SessionOptions, type SessionCookieOptions } from '../auth/session_cookie.js';
14
14
  import type { BootstrapAccountSuccess } from '../auth/bootstrap_account.js';
15
15
  import type { EventSpec } from '../realtime/sse.js';
@@ -383,11 +383,12 @@ export interface AppServerOptions {
383
383
  */
384
384
  ws_endpoints?: ReadonlyArray<WsEndpointSpec> | ((context: AppServerContext) => ReadonlyArray<WsEndpointSpec>);
385
385
  /**
386
- * Env schema for surface generation. Defaults to `BaseServerEnv` —
387
- * pass an extended schema (typically `BaseServerEnv.extend({...})`)
388
- * when the consumer adds app-specific env vars.
386
+ * Env schema for surface generation, a `@fuzdev/fuz_schema` object
387
+ * schema. Defaults to `BaseServerEnv` — pass an extended schema
388
+ * (typically `object({...BaseServerEnv.def, ...})`) when the consumer
389
+ * adds app-specific env vars.
389
390
  */
390
- env_schema?: z.ZodObject;
391
+ env_schema?: AnySchema;
391
392
  /** Middleware applied after routes, before static serving. Included in surface. */
392
393
  post_route_middleware?: Array<MiddlewareSpec>;
393
394
  /** Static file serving. Omit if not serving static files. */
@@ -1 +1 @@
1
- {"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAA0B,MAAM,MAAM,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAIN,KAAK,WAAW,EAChB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACN,WAA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e,CAAC;IACtB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9D;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GACjC,SAAS,IAAI,CAAC,gBAAgB,EAAE,uBAAuB,GAAG,eAAe,CAAC,KACxE,oBAkBF,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACtC,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAC;IAC1D,2CAA2C;IAC3C,iBAAiB,EAAE,eAAe,CAAC;IACnC,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;IACnE,uFAAuF;IACvF,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACtC,OAAO,sBAAsB,KAC3B,KAAK,CAAC,oBAAoB,CA0D5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,SAAS,CAQpF,CAAC"}
@@ -9,7 +9,6 @@
9
9
  */
10
10
  import { Hono } from 'hono';
11
11
  import { logger } from 'hono/logger';
12
- import { z } from 'zod';
13
12
  import { session_cookie_options } from '../auth/session_cookie.js';
14
13
  import { create_audit_log_sse, create_sse_connection_closer, audit_log_event_specs } from '../realtime/audit_log_sse.js';
15
14
  import { BaseServerEnv } from './env.js';