@fuzdev/fuz_app 0.155.1 → 0.156.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 (131) hide show
  1. package/dist/actions/CLAUDE.md +27 -14
  2. package/dist/actions/action_codegen.d.ts +10 -3
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +52 -13
  5. package/dist/actions/action_event.d.ts.map +1 -1
  6. package/dist/actions/action_event.js +13 -11
  7. package/dist/actions/action_rpc.d.ts +4 -3
  8. package/dist/actions/action_rpc.d.ts.map +1 -1
  9. package/dist/actions/action_rpc.js +4 -3
  10. package/dist/actions/action_spec.d.ts +102 -206
  11. package/dist/actions/action_spec.d.ts.map +1 -1
  12. package/dist/actions/action_spec.js +18 -96
  13. package/dist/actions/action_types.d.ts +4 -4
  14. package/dist/actions/action_types.d.ts.map +1 -1
  15. package/dist/actions/action_types.js +2 -2
  16. package/dist/actions/broadcast_api.d.ts.map +1 -1
  17. package/dist/actions/broadcast_api.js +6 -5
  18. package/dist/actions/compile_action_registry.d.ts +11 -6
  19. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  20. package/dist/actions/compile_action_registry.js +15 -9
  21. package/dist/actions/perform_action.d.ts +4 -4
  22. package/dist/actions/perform_action.d.ts.map +1 -1
  23. package/dist/actions/perform_action.js +11 -11
  24. package/dist/auth/CLAUDE.md +1 -1
  25. package/dist/auth/account_action_specs.d.ts +50 -23
  26. package/dist/auth/account_action_specs.d.ts.map +1 -1
  27. package/dist/auth/account_action_specs.js +18 -8
  28. package/dist/auth/account_route_schema.d.ts +10 -10
  29. package/dist/auth/account_schema.d.ts +21 -21
  30. package/dist/auth/actor_lookup_action_specs.d.ts +7 -7
  31. package/dist/auth/actor_search_action_specs.d.ts +6 -6
  32. package/dist/auth/admin_action_specs.d.ts +98 -98
  33. package/dist/auth/app_settings_schema.d.ts +2 -2
  34. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  35. package/dist/auth/audit_log_schema.d.ts +44 -44
  36. package/dist/auth/auth_guard_resolver.d.ts +2 -2
  37. package/dist/auth/auth_guard_resolver.js +2 -2
  38. package/dist/auth/bootstrap_route_schema.d.ts +4 -4
  39. package/dist/auth/cell_action_specs.d.ts +241 -241
  40. package/dist/auth/cell_actions.js +3 -3
  41. package/dist/auth/cell_audit_action_specs.d.ts +14 -14
  42. package/dist/auth/cell_audit_metadata.d.ts +6 -6
  43. package/dist/auth/cell_field_action_specs.d.ts +38 -38
  44. package/dist/auth/cell_field_audit_metadata.d.ts +4 -4
  45. package/dist/auth/cell_grant_action_specs.d.ts +61 -61
  46. package/dist/auth/cell_grant_audit_metadata.d.ts +10 -10
  47. package/dist/auth/cell_item_action_specs.d.ts +50 -50
  48. package/dist/auth/cell_item_audit_metadata.d.ts +5 -5
  49. package/dist/auth/invite_schema.d.ts +6 -6
  50. package/dist/auth/role_grant_offer_action_specs.d.ts +120 -120
  51. package/dist/auth/role_grant_offer_notifications.d.ts +66 -66
  52. package/dist/auth/role_grant_offer_schema.d.ts +6 -6
  53. package/dist/auth/self_service_role_action_specs.d.ts +2 -2
  54. package/dist/auth/signup_route_schema.d.ts +2 -2
  55. package/dist/http/CLAUDE.md +9 -8
  56. package/dist/http/auth_shape.d.ts +54 -17
  57. package/dist/http/auth_shape.d.ts.map +1 -1
  58. package/dist/http/auth_shape.js +104 -52
  59. package/dist/http/error_schemas.d.ts +6 -4
  60. package/dist/http/error_schemas.d.ts.map +1 -1
  61. package/dist/http/error_schemas.js +4 -9
  62. package/dist/http/jsonrpc_errors.d.ts +11 -4
  63. package/dist/http/jsonrpc_errors.d.ts.map +1 -1
  64. package/dist/http/jsonrpc_errors.js +11 -4
  65. package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
  66. package/dist/http/jsonrpc_helpers.js +2 -1
  67. package/dist/http/route_spec.d.ts +3 -2
  68. package/dist/http/route_spec.d.ts.map +1 -1
  69. package/dist/http/route_spec.js +20 -8
  70. package/dist/http/schema_helpers.d.ts +24 -20
  71. package/dist/http/schema_helpers.d.ts.map +1 -1
  72. package/dist/http/schema_helpers.js +24 -19
  73. package/dist/primitive_schemas.d.ts +10 -3
  74. package/dist/primitive_schemas.d.ts.map +1 -1
  75. package/dist/primitive_schemas.js +10 -2
  76. package/dist/primitive_schemas_fuz.d.ts +69 -0
  77. package/dist/primitive_schemas_fuz.d.ts.map +1 -0
  78. package/dist/primitive_schemas_fuz.js +49 -0
  79. package/dist/realtime/sse.d.ts +3 -3
  80. package/dist/realtime/sse.d.ts.map +1 -1
  81. package/dist/realtime/sse.js +4 -4
  82. package/dist/schema_issues.d.ts +91 -4
  83. package/dist/schema_issues.d.ts.map +1 -1
  84. package/dist/schema_issues.js +262 -1
  85. package/dist/schema_meta.d.ts +24 -8
  86. package/dist/schema_meta.d.ts.map +1 -1
  87. package/dist/schema_meta.js +31 -10
  88. package/dist/server/serve_fact_route.d.ts.map +1 -1
  89. package/dist/server/serve_fact_route.js +2 -1
  90. package/dist/testing/CLAUDE.md +17 -11
  91. package/dist/testing/adversarial_input_cases.d.ts +18 -23
  92. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  93. package/dist/testing/adversarial_input_cases.js +51 -46
  94. package/dist/testing/cross_backend/action_manifest.d.ts +2 -1
  95. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  96. package/dist/testing/cross_backend/action_manifest.js +3 -3
  97. package/dist/testing/cross_backend/cell_crud.d.ts.map +1 -1
  98. package/dist/testing/cross_backend/cell_crud.js +3 -8
  99. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  100. package/dist/testing/cross_backend/conformance_table.js +5 -4
  101. package/dist/testing/cross_backend/cross_rpc.d.ts +4 -2
  102. package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
  103. package/dist/testing/cross_backend/cross_rpc.js +6 -4
  104. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  105. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  106. package/dist/testing/cross_backend/sse_round_trip.js +3 -2
  107. package/dist/testing/cross_backend/testing_reset_actions.d.ts +8 -8
  108. package/dist/testing/integration_helpers.d.ts.map +1 -1
  109. package/dist/testing/integration_helpers.js +4 -3
  110. package/dist/testing/rpc_envelope_cases.d.ts +3 -3
  111. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  112. package/dist/testing/rpc_envelope_cases.js +1 -1
  113. package/dist/testing/rpc_helpers.d.ts +12 -8
  114. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  115. package/dist/testing/rpc_helpers.js +18 -15
  116. package/dist/testing/schema_generators.d.ts +75 -40
  117. package/dist/testing/schema_generators.d.ts.map +1 -1
  118. package/dist/testing/schema_generators.js +273 -99
  119. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  120. package/dist/testing/sse_round_trip.js +4 -3
  121. package/dist/ui/admin_accounts_state.svelte.d.ts +10 -10
  122. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  123. package/dist/ui/admin_invites_state.svelte.d.ts +1 -1
  124. package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
  125. package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
  126. package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
  127. package/dist/ui/role_grant_offers_state.svelte.d.ts +6 -6
  128. package/dist/zod.d.ts +23 -5
  129. package/dist/zod.d.ts.map +1 -1
  130. package/dist/zod.js +2 -2
  131. package/package.json +6 -6
@@ -22,19 +22,23 @@ import { type ParseAnyResult, type ValidationOutput, type ValidationSchema } fro
22
22
  */
23
23
  export declare const is_null_schema: (schema: ValidationSchema) => boolean;
24
24
  /**
25
- * Check if a schema is exactly `z.void()`.
25
+ * Check if a schema is exactly `z.void()`, or a `@fuzdev/fuz_schema`
26
+ * `literal(undefined)` (what its `s.void` is, `meta` copies included).
26
27
  *
27
- * RPC action specs use `z.void()` to declare a parameterless method —
28
+ * RPC action specs use a void schema to declare a parameterless method —
28
29
  * JSON-RPC 2.0 forbids `params: null` (params must be omitted or be a
29
- * Structured value), so `z.void()` is the correct schema for "no params"
30
- * and the dispatcher maps absent params to `undefined` for these specs.
30
+ * Structured value), so void is the correct schema for "no params" and the
31
+ * dispatcher maps absent params to `undefined` for these specs. Like
32
+ * `is_null_schema`, it reads the schema's kind rather than parsing
33
+ * `undefined`, so an optional schema is not void. `z.undefined()` is not
34
+ * void either.
31
35
  */
32
36
  export declare const is_void_schema: (schema: ValidationSchema) => boolean;
33
37
  /**
34
- * Normalize the raw `params` of a `z.void()` input: an absent `params`, an
35
- * empty object, and the `null` a GET `?params=null` parses to are all the
36
- * no-arg call (`undefined`); anything else passes through for `z.void()` to
37
- * refuse.
38
+ * Normalize the raw `params` of a void input (`is_void_schema`): an absent
39
+ * `params`, an empty object, and the `null` a GET `?params=null` parses to
40
+ * are all the no-arg call (`undefined`); anything else passes through for the
41
+ * void schema to refuse.
38
42
  *
39
43
  * JSON-RPC 2.0 lets a parameterless call omit `params`, and an empty by-name
40
44
  * structure carries no parameters, so refusing `{}` would only break clients
@@ -49,18 +53,18 @@ export declare const is_void_schema: (schema: ValidationSchema) => boolean;
49
53
  export declare const to_void_params: (raw_params: unknown) => unknown;
50
54
  /**
51
55
  * Normalize the raw `params` of an RPC call for `input` to validate: for a
52
- * `z.void()` input, `to_void_params`; for any other input, an absent or
53
- * `null` `params` reads as `{}`, so an all-optional object input accepts a
54
- * call that omits them. Every receiving end — the server dispatch
55
- * (`perform_action`) and a peer receiving a request or notification
56
- * (`ActionDispatcher`) — reads params through this, so a peer is never
57
- * stricter than the server.
58
- *
59
- * @param input - the action's input schema
56
+ * void input (`is_void_schema`, Zod or fuz_schema), `to_void_params`; for
57
+ * any other input, an absent or `null` `params` reads as `{}`, so an
58
+ * all-optional object input accepts a call that omits them. Every receiving
59
+ * end — the server dispatch (`perform_action`) and a peer receiving a
60
+ * request or notification (`ActionDispatcher`) — reads params through this,
61
+ * so a peer is never stricter than the server.
62
+ *
63
+ * @param input - the action's input schema, Zod or fuz_schema
60
64
  * @param raw_params - the call's `params` as parsed off the wire
61
65
  * @returns the value the input parse (`parse_any`) reads
62
66
  */
63
- export declare const to_input_params: (input: z.ZodType, raw_params: unknown) => unknown;
67
+ export declare const to_input_params: (input: ValidationSchema, raw_params: unknown) => unknown;
64
68
  /**
65
69
  * Check whether a parsed JSON value holds an own `__proto__` key in any
66
70
  * object, at any depth — what the dispatcher refuses in a request's `params`
@@ -170,9 +174,9 @@ export interface SchemaToSurfaceOptions {
170
174
  * Convert a Zod or `@fuzdev/fuz_schema` schema to its JSON Schema for the
171
175
  * surface, with `$schema` and `default` stripped at every depth.
172
176
  *
173
- * Returns `null` for a null schema (`is_null_schema`) and a `z.void()`
174
- * (`is_void_schema`): no body, no params. Any other schema is written with
175
- * its library's emitter (`to_json_schema` for fuz_schema, `z.toJSONSchema`
177
+ * Returns `null` for a null schema (`is_null_schema`) and a void schema
178
+ * (`is_void_schema`), in either library: no body, no params. Any other
179
+ * schema is written with its library's emitter (`to_json_schema` for fuz_schema, `z.toJSONSchema`
176
180
  * for Zod) on the side `options.io` names. A part JSON Schema can't say (a
177
181
  * transform on the output side, a `z.custom()`, a fuz_schema `check`) is left
178
182
  * out or written as `{}` (a `pipe(string, check(…))` writes as
@@ -1 +1 @@
1
- {"version":3,"file":"schema_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/schema_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,E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iB,GAC7B,QAAQ,gBAAgB,EACxB,UAAU,sBAAsB,KAC9B,OA8BF,CAAC;AAoBF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,EAAE,YAAY,MAAM,KAAG,OAQxE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,OAM/D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,GACnC,MAAM;IACL,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;CACtE,EACD,YAAY,MAAM,KAChB,OAE0F,CAAC;AAE9F;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM;IACL,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC3B,EACD,oBAAoB,iBAAiB,GAAG,IAAI,KAC1C,iBAAiB,GAAG,IAWtB,CAAC"}
@@ -25,19 +25,24 @@ import { parse_any, unknown_key_targets } from '../schema_issues.js';
25
25
  export const is_null_schema = (schema) => schema instanceof z.ZodNull ||
26
26
  (is_schema(schema) && schema.kind === 'literal' && schema.def === null);
27
27
  /**
28
- * Check if a schema is exactly `z.void()`.
28
+ * Check if a schema is exactly `z.void()`, or a `@fuzdev/fuz_schema`
29
+ * `literal(undefined)` (what its `s.void` is, `meta` copies included).
29
30
  *
30
- * RPC action specs use `z.void()` to declare a parameterless method —
31
+ * RPC action specs use a void schema to declare a parameterless method —
31
32
  * JSON-RPC 2.0 forbids `params: null` (params must be omitted or be a
32
- * Structured value), so `z.void()` is the correct schema for "no params"
33
- * and the dispatcher maps absent params to `undefined` for these specs.
33
+ * Structured value), so void is the correct schema for "no params" and the
34
+ * dispatcher maps absent params to `undefined` for these specs. Like
35
+ * `is_null_schema`, it reads the schema's kind rather than parsing
36
+ * `undefined`, so an optional schema is not void. `z.undefined()` is not
37
+ * void either.
34
38
  */
35
- export const is_void_schema = (schema) => schema instanceof z.ZodVoid;
39
+ export const is_void_schema = (schema) => schema instanceof z.ZodVoid ||
40
+ (is_schema(schema) && schema.kind === 'literal' && schema.def === undefined);
36
41
  /**
37
- * Normalize the raw `params` of a `z.void()` input: an absent `params`, an
38
- * empty object, and the `null` a GET `?params=null` parses to are all the
39
- * no-arg call (`undefined`); anything else passes through for `z.void()` to
40
- * refuse.
42
+ * Normalize the raw `params` of a void input (`is_void_schema`): an absent
43
+ * `params`, an empty object, and the `null` a GET `?params=null` parses to
44
+ * are all the no-arg call (`undefined`); anything else passes through for the
45
+ * void schema to refuse.
41
46
  *
42
47
  * JSON-RPC 2.0 lets a parameterless call omit `params`, and an empty by-name
43
48
  * structure carries no parameters, so refusing `{}` would only break clients
@@ -61,14 +66,14 @@ export const to_void_params = (raw_params) => {
61
66
  };
62
67
  /**
63
68
  * Normalize the raw `params` of an RPC call for `input` to validate: for a
64
- * `z.void()` input, `to_void_params`; for any other input, an absent or
65
- * `null` `params` reads as `{}`, so an all-optional object input accepts a
66
- * call that omits them. Every receiving end — the server dispatch
67
- * (`perform_action`) and a peer receiving a request or notification
68
- * (`ActionDispatcher`) — reads params through this, so a peer is never
69
- * stricter than the server.
69
+ * void input (`is_void_schema`, Zod or fuz_schema), `to_void_params`; for
70
+ * any other input, an absent or `null` `params` reads as `{}`, so an
71
+ * all-optional object input accepts a call that omits them. Every receiving
72
+ * end — the server dispatch (`perform_action`) and a peer receiving a
73
+ * request or notification (`ActionDispatcher`) — reads params through this,
74
+ * so a peer is never stricter than the server.
70
75
  *
71
- * @param input - the action's input schema
76
+ * @param input - the action's input schema, Zod or fuz_schema
72
77
  * @param raw_params - the call's `params` as parsed off the wire
73
78
  * @returns the value the input parse (`parse_any`) reads
74
79
  */
@@ -325,9 +330,9 @@ const fuz_schema_untransformed_head = (schema) => {
325
330
  * Convert a Zod or `@fuzdev/fuz_schema` schema to its JSON Schema for the
326
331
  * surface, with `$schema` and `default` stripped at every depth.
327
332
  *
328
- * Returns `null` for a null schema (`is_null_schema`) and a `z.void()`
329
- * (`is_void_schema`): no body, no params. Any other schema is written with
330
- * its library's emitter (`to_json_schema` for fuz_schema, `z.toJSONSchema`
333
+ * Returns `null` for a null schema (`is_null_schema`) and a void schema
334
+ * (`is_void_schema`), in either library: no body, no params. Any other
335
+ * schema is written with its library's emitter (`to_json_schema` for fuz_schema, `z.toJSONSchema`
331
336
  * for Zod) on the side `options.io` names. A part JSON Schema can't say (a
332
337
  * transform on the output side, a `z.custom()`, a fuz_schema `check`) is left
333
338
  * out or written as `{}` (a `pipe(string, check(…))` writes as
@@ -19,6 +19,7 @@
19
19
  * @module
20
20
  */
21
21
  import { z } from 'zod';
22
+ import type { Branded } from '@fuzdev/fuz_schema/schema.ts';
22
23
  import { type FactHash } from '@fuzdev/fuz_util/hash_schemas.ts';
23
24
  /** Length bounds for `bounded_string`, in UTF-16 code units. */
24
25
  export interface BoundedStringOptions {
@@ -123,16 +124,22 @@ export declare const create_uuid: () => Uuid;
123
124
  * compares equal to the same id read back from the database. The Rust spine
124
125
  * canonicalizes the same way. One exception: `z.uuid()` takes the max UUID
125
126
  * (`ffffffff-ffff-ffff-ffff-ffffffffffff`) only in lowercase, and
126
- * `.toLowerCase()` runs after the check, so the uppercase max is refused.
127
+ * `.toLowerCase()` runs after the check, so the uppercase max is refused,
128
+ * where the fuz_schema twin in `primitive_schemas_fuz.ts` and the Rust spine
129
+ * accept it.
127
130
  *
128
131
  * `.toLowerCase()` rather than `.transform()`: an overwrite keeps the output
129
132
  * type and stays invisible to `z.toJSONSchema`, where a transform would leave
130
133
  * no input schema to render.
134
+ *
135
+ * The output type is fuz_schema's `Branded<string, 'Uuid'>`, the twin's, by a
136
+ * cast as on `FactHashSchema`: Zod's `.brand('Uuid')` would output Zod's own
137
+ * brand, which a fuz_schema `Uuid` isn't assignable to.
131
138
  */
132
- export declare const Uuid: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
139
+ export declare const Uuid: z.ZodUUID & z.ZodType<Branded<string, 'Uuid'>, string>;
133
140
  export type Uuid = z.infer<typeof Uuid>;
134
141
  /** `Uuid` that defaults to a fresh `create_uuid()` when the input is `undefined`. */
135
- export declare const UuidWithDefault: z.ZodDefault<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
142
+ export declare const UuidWithDefault: z.ZodDefault<z.ZodUUID & z.ZodType<Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<Branded<string, "Uuid">, string>>>;
136
143
  export type UuidWithDefault = z.infer<typeof UuidWithDefault>;
137
144
  /**
138
145
  * Branded datetime schema, zod's default `z.iso.datetime()`: an RFC 3339 date
@@ -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;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,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UAAU,aAEuD,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"}
@@ -188,13 +188,21 @@ export const create_uuid = () => crypto.randomUUID();
188
188
  * compares equal to the same id read back from the database. The Rust spine
189
189
  * canonicalizes the same way. One exception: `z.uuid()` takes the max UUID
190
190
  * (`ffffffff-ffff-ffff-ffff-ffffffffffff`) only in lowercase, and
191
- * `.toLowerCase()` runs after the check, so the uppercase max is refused.
191
+ * `.toLowerCase()` runs after the check, so the uppercase max is refused,
192
+ * where the fuz_schema twin in `primitive_schemas_fuz.ts` and the Rust spine
193
+ * accept it.
192
194
  *
193
195
  * `.toLowerCase()` rather than `.transform()`: an overwrite keeps the output
194
196
  * type and stays invisible to `z.toJSONSchema`, where a transform would leave
195
197
  * no input schema to render.
198
+ *
199
+ * The output type is fuz_schema's `Branded<string, 'Uuid'>`, the twin's, by a
200
+ * cast as on `FactHashSchema`: Zod's `.brand('Uuid')` would output Zod's own
201
+ * brand, which a fuz_schema `Uuid` isn't assignable to.
196
202
  */
197
- export const Uuid = z.uuid().toLowerCase().brand('Uuid');
203
+ export const Uuid = z
204
+ .uuid()
205
+ .toLowerCase();
198
206
  /** `Uuid` that defaults to a fresh `create_uuid()` when the input is `undefined`. */
199
207
  export const UuidWithDefault = Uuid.default(create_uuid);
200
208
  /**
@@ -0,0 +1,69 @@
1
+ /**
2
+ * `@fuzdev/fuz_schema` twins of the Zod `Uuid`, `UuidWithDefault`
3
+ * (`primitive_schemas.ts`), and `ActingActor` (`http/auth_shape.ts`), under the
4
+ * same names, for inputs written in fuz_schema.
5
+ *
6
+ * The output type is shared: the Zod `Uuid` outputs fuz_schema's
7
+ * `Branded<string, 'Uuid'>` too, so a value parsed by either twin goes where
8
+ * the other's is taken.
9
+ *
10
+ * One declared difference: this `Uuid` takes the max UUID in any case, as RFC
11
+ * 9562 §4 reads a UUID case-insensitively, and lowercases it; the Zod `Uuid`
12
+ * refuses the uppercase max, as `z.uuid()` spells that alternative in
13
+ * lowercase only. Every other string gets the same verdict and output from
14
+ * both.
15
+ *
16
+ * The exports are `@nodocs` while the Zod schemas of the same names stay, as
17
+ * the docs build refuses two exports of one name.
18
+ *
19
+ * @module
20
+ */
21
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
22
+ /**
23
+ * Branded UUID schema: a UUID of RFC 9562 in either case, output in
24
+ * lowercase, the form Postgres renders a `uuid` in and every id the server
25
+ * mints. The brand goes outside the `to_lower_case`, which outputs a new
26
+ * string.
27
+ *
28
+ * @nodocs
29
+ */
30
+ export declare const Uuid: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
31
+ readonly '~types'?: {
32
+ readonly input: string;
33
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
34
+ } | undefined;
35
+ };
36
+ /** @nodocs */
37
+ export type Uuid = Infer<typeof Uuid>;
38
+ /**
39
+ * `Uuid` that defaults to a fresh `create_uuid()` when the input is `undefined`.
40
+ *
41
+ * @nodocs
42
+ */
43
+ export declare const UuidWithDefault: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string | undefined, "with_default_fn", import("@fuzdev/fuz_schema/schema.ts").SchemaDefaultFnDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
44
+ readonly '~types'?: {
45
+ readonly input: string;
46
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
47
+ } | undefined;
48
+ }>>;
49
+ /** @nodocs */
50
+ export type UuidWithDefault = Infer<typeof UuidWithDefault>;
51
+ /** The `description` both `ActingActor` twins carry. */
52
+ export declare const ACTING_ACTOR_DESCRIPTION = "Actor on the authenticated account that this request acts as. Omit on single-actor accounts; required on multi-actor.";
53
+ /**
54
+ * The `acting` field of an input that needs the caller's acting actor, the
55
+ * twin of `ActingActor` in `http/auth_shape.ts`, whose doc has the resolution
56
+ * rules. The dispatcher finds either twin by reference, so an input declares
57
+ * this export, not a copy of it.
58
+ *
59
+ * @nodocs
60
+ */
61
+ export declare const ActingActor: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
62
+ readonly '~types'?: {
63
+ readonly input: string;
64
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
65
+ } | undefined;
66
+ }>>;
67
+ /** @nodocs */
68
+ export type ActingActor = Infer<typeof ActingActor>;
69
+ //# sourceMappingURL=primitive_schemas_fuz.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitive_schemas_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAQN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAItC;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI;;;;;CAAmD,CAAC;AACrE,cAAc;AACd,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;GAAqC,CAAC;AAClE,cAAc;AACd,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE5D,wDAAwD;AACxD,eAAO,MAAM,wBAAwB,0HACmF,CAAC;AAEzH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;GAAkE,CAAC;AAC3F,cAAc;AACd,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * `@fuzdev/fuz_schema` twins of the Zod `Uuid`, `UuidWithDefault`
3
+ * (`primitive_schemas.ts`), and `ActingActor` (`http/auth_shape.ts`), under the
4
+ * same names, for inputs written in fuz_schema.
5
+ *
6
+ * The output type is shared: the Zod `Uuid` outputs fuz_schema's
7
+ * `Branded<string, 'Uuid'>` too, so a value parsed by either twin goes where
8
+ * the other's is taken.
9
+ *
10
+ * One declared difference: this `Uuid` takes the max UUID in any case, as RFC
11
+ * 9562 §4 reads a UUID case-insensitively, and lowercases it; the Zod `Uuid`
12
+ * refuses the uppercase max, as `z.uuid()` spells that alternative in
13
+ * lowercase only. Every other string gets the same verdict and output from
14
+ * both.
15
+ *
16
+ * The exports are `@nodocs` while the Zod schemas of the same names stay, as
17
+ * the docs build refuses two exports of one name.
18
+ *
19
+ * @module
20
+ */
21
+ import { meta } from '@fuzdev/fuz_schema/meta.ts';
22
+ import { brand, optional, pipe, string, to_lower_case, uuid, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
23
+ import { create_uuid } from './primitive_schemas.js';
24
+ /**
25
+ * Branded UUID schema: a UUID of RFC 9562 in either case, output in
26
+ * lowercase, the form Postgres renders a `uuid` in and every id the server
27
+ * mints. The brand goes outside the `to_lower_case`, which outputs a new
28
+ * string.
29
+ *
30
+ * @nodocs
31
+ */
32
+ export const Uuid = brand(pipe(string, uuid, to_lower_case), 'Uuid');
33
+ /**
34
+ * `Uuid` that defaults to a fresh `create_uuid()` when the input is `undefined`.
35
+ *
36
+ * @nodocs
37
+ */
38
+ export const UuidWithDefault = with_default_fn(Uuid, create_uuid);
39
+ /** The `description` both `ActingActor` twins carry. */
40
+ export const ACTING_ACTOR_DESCRIPTION = 'Actor on the authenticated account that this request acts as. Omit on single-actor accounts; required on multi-actor.';
41
+ /**
42
+ * The `acting` field of an input that needs the caller's acting actor, the
43
+ * twin of `ActingActor` in `http/auth_shape.ts`, whose doc has the resolution
44
+ * rules. The dispatcher finds either twin by reference, so an input declares
45
+ * this export, not a copy of it.
46
+ *
47
+ * @nodocs
48
+ */
49
+ export const ActingActor = meta(optional(Uuid), { description: ACTING_ACTOR_DESCRIPTION });
@@ -31,8 +31,8 @@
31
31
  * @module
32
32
  */
33
33
  import type { Context } from 'hono';
34
- import { z } from 'zod';
35
34
  import type { Logger } from '@fuzdev/fuz_util/log.ts';
35
+ import { type ValidationSchema } from '../schema_issues.js';
36
36
  /**
37
37
  * Generic SSE stream controller interface.
38
38
  *
@@ -118,8 +118,8 @@ export declare const create_sse_response: <T = unknown>(c: Context, log: Logger,
118
118
  export interface EventSpec {
119
119
  /** Event method name, used as the JSON-RPC notification `method`. */
120
120
  method: string;
121
- /** Zod schema for the notification `params` payload. */
122
- params: z.ZodType;
121
+ /** Schema for the notification `params` payload, Zod or `@fuzdev/fuz_schema`. */
122
+ params: ValidationSchema;
123
123
  /** Human-readable description for surface output and docs. */
124
124
  description: string;
125
125
  /** Channel this event broadcasts on. Omit for cross-channel events. */
@@ -1 +1 @@
1
- {"version":3,"file":"sse.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAYtD;;;;GAIG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACrC;;;;OAIG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACxB,wBAAwB;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,yCAAyC;AACzC,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;I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K,CAAC,SAAS,CAAC,EAC7B,KAAK,MAAM,KACT;IAAE,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CAmBjD,CAAC"}
@@ -31,10 +31,10 @@
31
31
  * @module
32
32
  */
33
33
  import { streamSSE } from 'hono/streaming';
34
- import { z } from 'zod';
35
34
  import { DEV } from 'esm-env';
36
35
  import { utf8_length } from '../actions/transports.js';
37
36
  import { OutboundBudget } from './outbound_budget.js';
37
+ import { parse_any } from '../schema_issues.js';
38
38
  import { SSE_CONNECTED_COMMENT, SSE_KEEP_ALIVE_COMMENT, SSE_KEEP_ALIVE_INTERVAL_MS, SSE_OUTBOUND_QUEUE_BYTES, validate_sse_keep_alive_ms } from './sse_constants.js';
39
39
  const is_node_connection_stream = (value) => {
40
40
  if (typeof value !== 'object' || value === null)
@@ -249,9 +249,9 @@ export const create_validated_broadcaster = (broadcaster, event_specs, log) => {
249
249
  log.warn(`Unknown event method: '${data.method}'`);
250
250
  }
251
251
  else {
252
- const result = spec.params.safeParse(data.params);
253
- if (!result.success) {
254
- log.warn(`Params mismatch for '${data.method}':`, result.error.issues);
252
+ const result = parse_any(spec.params, data.params);
253
+ if (!result.ok) {
254
+ log.warn(`Params mismatch for '${data.method}':`, result.issues);
255
255
  }
256
256
  }
257
257
  broadcaster.broadcast(channel, data);
@@ -4,17 +4,42 @@
4
4
  * wholly one library, so one parse's issues are all of one kind; these
5
5
  * helpers read either, so the dispatcher, `ActionEvent` and the
6
6
  * forward-compatible reads treat a spec the same whichever library it is
7
- * written in.
7
+ * written in, and an error response carries either library's issues in one
8
+ * shape, `WireIssue`.
8
9
  *
9
10
  * @module
10
11
  */
11
12
  import { z } from 'zod';
12
- import { SchemaError, type AnySchema, type Infer, type SchemaIssue } from '@fuzdev/fuz_schema/schema.ts';
13
+ import { SchemaError, type AnySchema, type Infer, type InferInput, type Schema, type SchemaIssue } from '@fuzdev/fuz_schema/schema.ts';
13
14
  import type { Result } from '@fuzdev/fuz_util/result.ts';
14
15
  /** A schema of either library: a Zod schema or a `@fuzdev/fuz_schema` one. */
15
16
  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;
17
+ /**
18
+ * Whether `value` is a Zod schema. Zod's `instanceof` reads the schema's
19
+ * traits, so a schema made by another copy of Zod is one too.
20
+ *
21
+ * @param value - any value
22
+ */
23
+ export declare const is_zod_schema: (value: unknown) => value is z.ZodType;
24
+ /**
25
+ * Throw unless `value` is a Zod schema, naming `label` — what a reader of a
26
+ * spec's schema calls once it has ruled out a `@fuzdev/fuz_schema` schema
27
+ * (`is_schema`), so a value of neither library fails loudly where it is read,
28
+ * rather than as a `TypeError` deeper in or a silent `undefined`.
29
+ *
30
+ * @param value - the schema, known not to be a fuz_schema schema
31
+ * @param label - names the schema in the error, e.g. `` `action 'foo' input` ``
32
+ * @throws Error when `value` is not a Zod schema, saying it is of neither library
33
+ */
34
+ export declare function assert_zod_schema(value: unknown, label: string): asserts value is z.ZodType;
35
+ /**
36
+ * The output type of a `ValidationSchema`: fuz_schema's `Infer` or Zod's
37
+ * `z.output`. The test narrows `T` itself: `Infer<T & Schema>` would read as
38
+ * `unknown`.
39
+ */
40
+ export type ValidationOutput<T extends ValidationSchema> = T extends Schema ? Infer<T> : T extends z.ZodType ? z.output<T> : never;
41
+ /** The input type of a `ValidationSchema`: fuz_schema's `InferInput` or Zod's `z.input`. */
42
+ export type ValidationInput<T extends ValidationSchema> = T extends Schema ? InferInput<T> : T extends z.ZodType ? z.input<T> : never;
18
43
  /** One issue of a failed parse, in the library's own shape. */
19
44
  export type AnyIssue = z.core.$ZodIssue | SchemaIssue;
20
45
  /** What `parse_any` returns: the output, or the failed parse's issues in the library's order. */
@@ -33,6 +58,7 @@ export type ParseAnyResult<T> = Result<{
33
58
  * @param schema - a Zod or fuz_schema schema
34
59
  * @param value - the value to validate
35
60
  * @returns the output, or the issues
61
+ * @throws Error when `schema` is neither a Zod nor a fuz_schema schema
36
62
  */
37
63
  export declare const parse_any: <T extends ValidationSchema>(schema: T, value: unknown) => ParseAnyResult<ValidationOutput<T>>;
38
64
  /**
@@ -93,4 +119,65 @@ export declare const format_issues: (issues: ReadonlyArray<AnyIssue>) => string;
93
119
  * @param err - a caught value
94
120
  */
95
121
  export declare const is_schema_validation_error: (err: unknown) => err is z.ZodError | SchemaError;
122
+ /**
123
+ * A validation issue as an error response carries it, for either schema
124
+ * library: `@fuzdev/fuz_schema`'s `SchemaIssue` as JSON, with `message` the
125
+ * text of the issue. `to_wire_issues` builds it from either library's issues.
126
+ *
127
+ * Loose: a client reads it, and a newer server may add fields.
128
+ */
129
+ export declare const WireIssue: z.ZodObject<{
130
+ kind: z.ZodString;
131
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
132
+ expected: z.ZodString;
133
+ received: z.ZodString;
134
+ message: z.ZodString;
135
+ }, z.core.$loose>;
136
+ export type WireIssue = z.infer<typeof WireIssue>;
137
+ /**
138
+ * A failed parse's issues as `WireIssue`s, whichever library made them.
139
+ *
140
+ * A fuz_schema issue keeps its `kind`, `path`, `expected` and `received`, and
141
+ * its `message` is `format_issue`'s text, the path included.
142
+ *
143
+ * A Zod issue maps to the kind fuz_schema reports for the same check, its
144
+ * `message` Zod's own text, which names no path:
145
+ *
146
+ * - `invalid_type` — the type's kind (`string`, `number`, `boolean`,
147
+ * `bigint`, `object`, `record`, `array`); `int` is `integer`, a `tuple` an
148
+ * `array`, `null`, `undefined`, `void` and `nan` a `literal` of the value,
149
+ * `nonoptional` a `missing_key`, and a type fuz_schema has no kind for
150
+ * (`date`, `map`, `set`, `file`, `symbol`, `function`, `never`) a `check`
151
+ * expecting the type's name. A missing key is reported as fuz_schema
152
+ * reports it, as the type expected with `received: 'undefined'`.
153
+ * - `too_small` / `too_big` — `min_length` / `max_length` for a string,
154
+ * array, set or file (`length >= N`), `min_value` / `max_value` otherwise
155
+ * (`>= N`); an exclusive bound writes `>` or `<`, which fuz_schema has no
156
+ * check for, and an exact length is reported as the bound it broke.
157
+ * - `invalid_format` — `uuid` for a `uuid` or `guid`, `iso_datetime` for a
158
+ * `datetime`, `regex` for a `regex` (expecting its pattern), and a `check`
159
+ * expecting the format's name for every other format.
160
+ * - `unrecognized_keys` — an `unknown_key` per key, the key appended to the
161
+ * path, as fuz_schema reports them.
162
+ * - `invalid_union` — a `variant` expecting the options when Zod names a
163
+ * discriminator, else a `union` expecting each option as fuz_schema names
164
+ * it: by the type or the values it expected of the value, or by the
165
+ * value's type when the option took the type and failed a refinement or a
166
+ * field below. A union refused because more than one option matched is a
167
+ * `union` expecting `exactly one option`.
168
+ * - `invalid_value` — a `literal` of one value, a `one_of` of more.
169
+ * - `custom` — a `check`; `not_multiple_of` a `check` expecting
170
+ * `multiple of N`; `invalid_key` and `invalid_element` a `check` expecting
171
+ * `a valid key` / `a valid element`.
172
+ *
173
+ * A Zod issue holds no value, so `received` is read from `input` at the
174
+ * issue's path: `'undefined'` where a key is missing or the path leads
175
+ * through something that isn't an object. Where an earlier step of a Zod
176
+ * pipe replaced the value, it names the input's value, not the replacement.
177
+ *
178
+ * @param issues - a failed parse's issues, either library
179
+ * @param input - the value that was parsed
180
+ * @returns the issues, one per issue but for a Zod `unrecognized_keys`, which is one per key
181
+ */
182
+ export declare const to_wire_issues: (issues: ReadonlyArray<AnyIssue>, input: unknown) => Array<WireIssue>;
96
183
  //# sourceMappingURL=schema_issues.d.ts.map
@@ -1 +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,M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