@fuzdev/fuz_app 0.168.1 → 0.170.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 (239) hide show
  1. package/dist/actions/CLAUDE.md +17 -19
  2. package/dist/actions/action_codegen.d.ts +32 -23
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +101 -80
  5. package/dist/actions/action_event.d.ts +0 -8
  6. package/dist/actions/action_event.d.ts.map +1 -1
  7. package/dist/actions/action_event.js +7 -6
  8. package/dist/actions/action_event_data.d.ts +18 -18
  9. package/dist/actions/action_rpc.d.ts +1 -1
  10. package/dist/actions/action_rpc.js +1 -1
  11. package/dist/actions/action_spec.d.ts +8 -10
  12. package/dist/actions/action_spec.d.ts.map +1 -1
  13. package/dist/actions/action_spec.js +1 -1
  14. package/dist/actions/action_types.d.ts +4 -4
  15. package/dist/actions/action_types.d.ts.map +1 -1
  16. package/dist/actions/action_types.js +2 -2
  17. package/dist/actions/broadcast_api.d.ts +2 -2
  18. package/dist/actions/broadcast_api.js +4 -4
  19. package/dist/actions/compile_action_registry.d.ts +6 -7
  20. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  21. package/dist/actions/compile_action_registry.js +8 -9
  22. package/dist/actions/perform_action.d.ts +6 -6
  23. package/dist/actions/perform_action.d.ts.map +1 -1
  24. package/dist/actions/perform_action.js +11 -10
  25. package/dist/actions/socket.svelte.d.ts +1 -1
  26. package/dist/actions/socket.svelte.js +2 -2
  27. package/dist/auth/CLAUDE.md +11 -11
  28. package/dist/auth/account_action_specs.d.ts +11 -11
  29. package/dist/auth/account_action_specs.js +1 -1
  30. package/dist/auth/account_route_schema.d.ts +18 -18
  31. package/dist/auth/account_route_schema.js +1 -1
  32. package/dist/auth/account_routes.js +1 -1
  33. package/dist/auth/account_schema.d.ts +38 -40
  34. package/dist/auth/account_schema.d.ts.map +1 -1
  35. package/dist/auth/account_schema.js +7 -8
  36. package/dist/auth/actor_lookup_action_specs.d.ts +7 -7
  37. package/dist/auth/actor_lookup_action_specs.js +1 -1
  38. package/dist/auth/actor_search_action_specs.d.ts +6 -6
  39. package/dist/auth/actor_search_action_specs.js +1 -1
  40. package/dist/auth/admin_action_specs.d.ts +166 -166
  41. package/dist/auth/admin_action_specs.js +1 -1
  42. package/dist/auth/app_settings_schema.d.ts +3 -3
  43. package/dist/auth/app_settings_schema.d.ts.map +1 -1
  44. package/dist/auth/app_settings_schema.js +1 -1
  45. package/dist/auth/audit_emitter.d.ts +6 -7
  46. package/dist/auth/audit_emitter.d.ts.map +1 -1
  47. package/dist/auth/audit_emitter.js +11 -22
  48. package/dist/auth/audit_log_ddl.d.ts +1 -1
  49. package/dist/auth/audit_log_ddl.js +1 -1
  50. package/dist/auth/audit_log_queries.d.ts +0 -13
  51. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  52. package/dist/auth/audit_log_queries.js +3 -3
  53. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  54. package/dist/auth/audit_log_route_schema.js +1 -1
  55. package/dist/auth/audit_log_schema.d.ts +69 -70
  56. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  57. package/dist/auth/audit_log_schema.js +2 -2
  58. package/dist/auth/auth_ddl.d.ts +1 -1
  59. package/dist/auth/auth_ddl.js +1 -1
  60. package/dist/auth/bootstrap_route_schema.d.ts +4 -4
  61. package/dist/auth/bootstrap_route_schema.js +1 -1
  62. package/dist/auth/cell_action_specs.d.ts +466 -466
  63. package/dist/auth/cell_action_specs.js +1 -1
  64. package/dist/auth/cell_actions.d.ts +2 -2
  65. package/dist/auth/cell_actions.js +5 -5
  66. package/dist/auth/cell_audit_action_specs.d.ts +14 -14
  67. package/dist/auth/cell_audit_action_specs.js +1 -1
  68. package/dist/auth/cell_audit_metadata.d.ts +8 -8
  69. package/dist/auth/cell_audit_metadata.js +1 -1
  70. package/dist/auth/cell_field_action_specs.d.ts +55 -55
  71. package/dist/auth/cell_field_action_specs.js +1 -1
  72. package/dist/auth/cell_field_audit_metadata.d.ts +4 -4
  73. package/dist/auth/cell_field_audit_metadata.js +1 -1
  74. package/dist/auth/cell_grant_action_specs.d.ts +61 -61
  75. package/dist/auth/cell_grant_action_specs.js +1 -1
  76. package/dist/auth/cell_grant_audit_metadata.d.ts +10 -10
  77. package/dist/auth/cell_grant_audit_metadata.js +1 -1
  78. package/dist/auth/cell_item_action_specs.d.ts +76 -76
  79. package/dist/auth/cell_item_action_specs.js +1 -1
  80. package/dist/auth/cell_item_audit_metadata.d.ts +5 -5
  81. package/dist/auth/cell_item_audit_metadata.js +1 -1
  82. package/dist/auth/invite_schema.d.ts +11 -11
  83. package/dist/auth/invite_schema.d.ts.map +1 -1
  84. package/dist/auth/invite_schema.js +1 -1
  85. package/dist/auth/name_schema.js +1 -1
  86. package/dist/auth/password.js +1 -1
  87. package/dist/auth/request_context.js +2 -2
  88. package/dist/auth/role_grant_offer_action_specs.d.ts +182 -182
  89. package/dist/auth/role_grant_offer_action_specs.js +1 -1
  90. package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
  91. package/dist/auth/role_grant_offer_ddl.js +1 -1
  92. package/dist/auth/role_grant_offer_notifications.d.ts +107 -107
  93. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  94. package/dist/auth/role_grant_offer_notifications.js +3 -4
  95. package/dist/auth/role_grant_offer_schema.d.ts +9 -9
  96. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
  97. package/dist/auth/role_grant_offer_schema.js +1 -1
  98. package/dist/auth/self_service_role_action_specs.d.ts +2 -2
  99. package/dist/auth/self_service_role_action_specs.js +1 -1
  100. package/dist/auth/self_service_role_actions.d.ts +1 -1
  101. package/dist/auth/self_service_role_actions.js +1 -1
  102. package/dist/auth/signup_route_schema.d.ts +2 -2
  103. package/dist/auth/signup_route_schema.js +1 -1
  104. package/dist/auth/token_scope.d.ts +8 -8
  105. package/dist/db/file_fact_url.d.ts +1 -1
  106. package/dist/env/env_schemas.d.ts +1 -2
  107. package/dist/env/env_schemas.d.ts.map +1 -1
  108. package/dist/env/env_schemas.js +3 -4
  109. package/dist/http/CLAUDE.md +30 -32
  110. package/dist/http/auth_shape.d.ts +17 -52
  111. package/dist/http/auth_shape.d.ts.map +1 -1
  112. package/dist/http/auth_shape.js +19 -61
  113. package/dist/http/db_routes.d.ts +1 -1
  114. package/dist/http/db_routes.d.ts.map +1 -1
  115. package/dist/http/db_routes.js +1 -1
  116. package/dist/http/error_schemas.d.ts +36 -36
  117. package/dist/http/jsonrpc.d.ts +11 -11
  118. package/dist/http/jsonrpc_helpers.js +1 -1
  119. package/dist/http/route_error_check.d.ts +2 -2
  120. package/dist/http/route_error_check.d.ts.map +1 -1
  121. package/dist/http/route_error_check.js +2 -3
  122. package/dist/http/route_errors.d.ts +4 -4
  123. package/dist/http/route_errors.d.ts.map +1 -1
  124. package/dist/http/route_errors.js +0 -13
  125. package/dist/http/route_spec.d.ts +33 -36
  126. package/dist/http/route_spec.d.ts.map +1 -1
  127. package/dist/http/route_spec.js +21 -22
  128. package/dist/http/schema_helpers.d.ts +75 -67
  129. package/dist/http/schema_helpers.d.ts.map +1 -1
  130. package/dist/http/schema_helpers.js +54 -76
  131. package/dist/http/surface.d.ts.map +1 -1
  132. package/dist/http/surface.js +6 -8
  133. package/dist/primitive_schemas.d.ts +162 -112
  134. package/dist/primitive_schemas.d.ts.map +1 -1
  135. package/dist/primitive_schemas.js +129 -161
  136. package/dist/realtime/sse.d.ts +3 -3
  137. package/dist/realtime/sse.d.ts.map +1 -1
  138. package/dist/realtime/sse.js +2 -2
  139. package/dist/schema_issues.d.ts +41 -146
  140. package/dist/schema_issues.d.ts.map +1 -1
  141. package/dist/schema_issues.js +39 -322
  142. package/dist/schema_meta.d.ts +63 -136
  143. package/dist/schema_meta.d.ts.map +1 -1
  144. package/dist/schema_meta.js +37 -184
  145. package/dist/sensitivity.d.ts +3 -5
  146. package/dist/sensitivity.d.ts.map +1 -1
  147. package/dist/sensitivity.js +3 -5
  148. package/dist/server/serve_fact_route.js +1 -1
  149. package/dist/server/surface_route.js +1 -1
  150. package/dist/testing/CLAUDE.md +23 -25
  151. package/dist/testing/adversarial_headers.js +2 -2
  152. package/dist/testing/adversarial_input_cases.d.ts +19 -18
  153. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  154. package/dist/testing/adversarial_input_cases.js +29 -42
  155. package/dist/testing/assertions.d.ts +2 -2
  156. package/dist/testing/assertions.d.ts.map +1 -1
  157. package/dist/testing/assertions.js +3 -3
  158. package/dist/testing/cross_backend/account_lifecycle.js +2 -2
  159. package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
  160. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  161. package/dist/testing/cross_backend/action_manifest.js +4 -3
  162. package/dist/testing/cross_backend/cell_crud.js +1 -1
  163. package/dist/testing/cross_backend/conformance_case.d.ts +96 -114
  164. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  165. package/dist/testing/cross_backend/conformance_case.js +0 -256
  166. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
  167. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
  168. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  169. package/dist/testing/cross_backend/conformance_table.js +3 -3
  170. package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
  171. package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
  172. package/dist/testing/cross_backend/cross_rpc.js +4 -4
  173. package/dist/testing/cross_backend/differential.js +2 -2
  174. package/dist/testing/cross_backend/fact_serving.js +1 -1
  175. package/dist/testing/cross_backend/identity_parity.js +9 -9
  176. package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
  177. package/dist/testing/cross_backend/query_shape.js +1 -1
  178. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  179. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  180. package/dist/testing/cross_backend/setup.d.ts +26 -4
  181. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  182. package/dist/testing/cross_backend/setup.js +7 -8
  183. package/dist/testing/cross_backend/sse_round_trip.js +2 -2
  184. package/dist/testing/cross_backend/testing_origin_check.d.ts +12 -12
  185. package/dist/testing/cross_backend/testing_reset_actions.d.ts +608 -201
  186. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  187. package/dist/testing/cross_backend/testing_reset_actions.js +46 -55
  188. package/dist/testing/cross_backend/token_lifetime.js +3 -3
  189. package/dist/testing/cross_backend/wire_shapes.js +1 -1
  190. package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
  191. package/dist/testing/cross_backend/ws_outbound_overflow.js +35 -0
  192. package/dist/testing/cross_backend/ws_round_trip.js +1 -1
  193. package/dist/testing/data_exposure.d.ts.map +1 -1
  194. package/dist/testing/data_exposure.js +1 -1
  195. package/dist/testing/integration.js +2 -2
  196. package/dist/testing/integration_helpers.d.ts.map +1 -1
  197. package/dist/testing/integration_helpers.js +2 -2
  198. package/dist/testing/middleware.d.ts.map +1 -1
  199. package/dist/testing/middleware.js +2 -2
  200. package/dist/testing/rpc_attack_surface.js +1 -1
  201. package/dist/testing/rpc_envelope_cases.d.ts +3 -3
  202. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  203. package/dist/testing/rpc_envelope_cases.js +1 -1
  204. package/dist/testing/rpc_helpers.d.ts +12 -14
  205. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  206. package/dist/testing/rpc_helpers.js +9 -11
  207. package/dist/testing/schema_generators.d.ts +67 -60
  208. package/dist/testing/schema_generators.d.ts.map +1 -1
  209. package/dist/testing/schema_generators.js +144 -151
  210. package/dist/testing/schema_introspect.d.ts +438 -78
  211. package/dist/testing/schema_introspect.d.ts.map +1 -1
  212. package/dist/testing/schema_introspect.js +26 -26
  213. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  214. package/dist/testing/sse_round_trip.js +2 -2
  215. package/dist/testing/surface_invariants.d.ts +1 -1
  216. package/dist/testing/surface_invariants.js +1 -1
  217. package/dist/testing/transports/bootstrap.d.ts +1 -1
  218. package/dist/testing/transports/bootstrap.d.ts.map +1 -1
  219. package/dist/testing/transports/bootstrap.js +1 -1
  220. package/dist/ui/BootstrapForm.svelte +1 -2
  221. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  222. package/dist/ui/SignupForm.svelte +1 -2
  223. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  224. package/dist/ui/admin_accounts_state.svelte.d.ts +5 -5
  225. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  226. package/dist/ui/admin_invites_state.svelte.d.ts +1 -1
  227. package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
  228. package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
  229. package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
  230. package/dist/ui/form_state.svelte.d.ts +1 -1
  231. package/dist/ui/form_state.svelte.js +1 -1
  232. package/dist/ui/role_grant_offers_state.svelte.d.ts +1 -1
  233. package/package.json +7 -9
  234. package/dist/primitive_schemas_fuz.d.ts +0 -178
  235. package/dist/primitive_schemas_fuz.d.ts.map +0 -1
  236. package/dist/primitive_schemas_fuz.js +0 -149
  237. package/dist/zod.d.ts +0 -101
  238. package/dist/zod.d.ts.map +0 -1
  239. package/dist/zod.js +0 -195
@@ -1,101 +1,39 @@
1
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, and an error response carries either library's issues in one
8
- * shape, `WireIssue`.
2
+ * Validation issues of a `@fuzdev/fuz_schema` parse (`SchemaIssue`) as the
3
+ * stack reads them: on the input or on a field, unknown keys, text, and the
4
+ * one shape every error response carries them in, `WireIssue`.
9
5
  *
10
6
  * @module
11
7
  */
12
- import { z } from 'zod';
13
- import { SchemaError, type AnySchema, type Infer, type InferInput, type Schema, type SchemaIssue } from '@fuzdev/fuz_schema/schema.ts';
14
- import type { Result } from '@fuzdev/fuz_util/result.ts';
15
- /** A schema of either library: a Zod schema or a `@fuzdev/fuz_schema` one. */
16
- export type ValidationSchema = z.ZodType | AnySchema;
8
+ import { SchemaError, type AnySchema, type Infer, type SchemaIssue } from '@fuzdev/fuz_schema/schema.ts';
17
9
  /**
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
- * Throw unless `value` is a schema of either library (`is_schema` or
37
- * `is_zod_schema`), naming `label` — what spec registration runs on each
38
- * schema slot, so a value of neither library fails at registration rather
39
- * than at request time.
10
+ * Throw unless `value` is a `@fuzdev/fuz_schema` schema (`is_schema`), naming
11
+ * `label` — what spec registration runs on each schema slot, so a value that
12
+ * is no schema fails at registration rather than at request time.
40
13
  *
41
14
  * @param value - the value a spec declares as a schema
42
15
  * @param label - names the spec and slot in the error, e.g. `` `RPC action "foo": input` ``
43
- * @throws Error when `value` is neither a Zod nor a fuz_schema schema
44
- */
45
- export declare function assert_validation_schema(value: unknown, label: string): asserts value is ValidationSchema;
46
- /**
47
- * The output type of a `ValidationSchema`: fuz_schema's `Infer` or Zod's
48
- * `z.output`. The test narrows `T` itself: `Infer<T & Schema>` would read as
49
- * `unknown`.
50
- */
51
- export type ValidationOutput<T extends ValidationSchema> = T extends Schema ? Infer<T> : T extends z.ZodType ? z.output<T> : never;
52
- /** The input type of a `ValidationSchema`: fuz_schema's `InferInput` or Zod's `z.input`. */
53
- export type ValidationInput<T extends ValidationSchema> = T extends Schema ? InferInput<T> : T extends z.ZodType ? z.input<T> : never;
54
- /** One issue of a failed parse, in the library's own shape. */
55
- export type AnyIssue = z.core.$ZodIssue | SchemaIssue;
56
- /** What `parse_any` returns: the output, or the failed parse's issues in the library's order. */
57
- export type ParseAnyResult<T> = Result<{
58
- value: T;
59
- }, {
60
- issues: Array<AnyIssue>;
61
- }>;
62
- /**
63
- * Parse `value` with a schema of either library: `parse` for a fuz_schema
64
- * schema (`is_schema`), `safeParse` for a Zod one.
65
- *
66
- * A fuz_schema parse reports at most its first hundred issues, a Zod parse
67
- * every issue.
68
- *
69
- * @param schema - a Zod or fuz_schema schema
70
- * @param value - the value to validate
71
- * @returns the output, or the issues
72
- * @throws Error when `schema` is neither a Zod nor a fuz_schema schema
73
- */
74
- export declare const parse_any: <T extends ValidationSchema>(schema: T, value: unknown) => ParseAnyResult<ValidationOutput<T>>;
75
- /**
76
- * Whether `issue` is Zod's: every Zod issue has a `code`, a fuz_schema issue a `kind`.
16
+ * @throws Error when `value` is not a fuz_schema schema
77
17
  */
78
- export declare const is_zod_issue: (issue: AnyIssue) => issue is z.core.$ZodIssue;
18
+ export declare function assert_validation_schema(value: unknown, label: string): asserts value is AnySchema;
79
19
  /**
80
20
  * Whether `issue` sits on the input itself rather than on one of its fields:
81
21
  * a non-object input, or an unknown key on the input object — what the Rust
82
22
  * twin refuses before reading any field.
83
23
  *
84
- * Zod reports both at an empty path, its `unrecognized_keys` naming the keys.
85
- * fuz_schema reports a non-object at an empty path and each unknown key as an
24
+ * A non-object is reported at an empty path, and each unknown key as an
86
25
  * `unknown_key` issue whose path ends at the key, so one on the input has a
87
- * path of the key alone. An unknown key on a nested object is on that field,
88
- * as Zod's is.
26
+ * path of the key alone. An unknown key on a nested object is on that field.
89
27
  *
90
28
  * On the wire the `unknown_key` rule changes no answer today: a root
91
29
  * `unknown_key` comes from a root `object`, which `resolve_issues_invalid_reason`
92
30
  * already answers with none from its check of the input's keys, or from a
93
31
  * schema such as a `variant` whose fields resolve no reason. It is kept as the
94
- * direct statement of Zod's rule.
32
+ * direct statement of the rule.
95
33
  *
96
34
  * @param issue - one issue of a failed parse
97
35
  */
98
- export declare const issue_is_on_input: (issue: AnyIssue) => boolean;
36
+ export declare const issue_is_on_input: (issue: SchemaIssue) => boolean;
99
37
  /** Keys a parse refused as unknown, and the path of the object holding them. */
100
38
  export interface UnknownKeyTarget {
101
39
  /** The path of the object the keys are on, `[]` for the input itself. */
@@ -105,108 +43,65 @@ export interface UnknownKeyTarget {
105
43
  }
106
44
  /**
107
45
  * The unknown keys among `issues`, each with the path of its object, or
108
- * `null` when any issue is something else.
109
- *
110
- * A Zod `unrecognized_keys` issue is at its object's path and names every
111
- * key; a fuz_schema `unknown_key` issue is one key, the last element of its
112
- * path.
46
+ * `null` when any issue is something else. An `unknown_key` issue is one
47
+ * key, the last element of its path.
113
48
  *
114
49
  * @param issues - a failed parse's issues
115
50
  * @returns a target per issue, or `null` when not every issue is an unknown key
116
51
  */
117
- export declare const unknown_key_targets: (issues: ReadonlyArray<AnyIssue>) => Array<UnknownKeyTarget> | null;
52
+ export declare const unknown_key_targets: (issues: ReadonlyArray<SchemaIssue>) => Array<UnknownKeyTarget> | null;
118
53
  /**
119
- * A failed parse's issues as text: Zod's `z.prettifyError` text for Zod
120
- * issues, and for fuz_schema issues their `format_issue` lines.
54
+ * A failed parse's issues as text, a `format_issue` line each.
121
55
  *
122
- * @param issues - a failed parse's issues, all of one library
56
+ * @param issues - a failed parse's issues
123
57
  */
124
- export declare const format_issues: (issues: ReadonlyArray<AnyIssue>) => string;
58
+ export declare const format_issues: (issues: ReadonlyArray<SchemaIssue>) => string;
125
59
  /**
126
- * Whether `err` is a thrown validation failure of either library: a
127
- * `z.ZodError` or a fuz_schema `SchemaError` (`parse_or_throw`). Both carry
128
- * the failed parse's `issues`.
60
+ * Whether `err` is a thrown validation failure, a `SchemaError`
61
+ * (`parse_or_throw`), which carries the failed parse's `issues`.
129
62
  *
130
63
  * @param err - a caught value
131
64
  */
132
- export declare const is_schema_validation_error: (err: unknown) => err is z.ZodError | SchemaError;
65
+ export declare const is_schema_validation_error: (err: unknown) => err is SchemaError;
133
66
  /**
134
67
  * A `@fuzdev/fuz_schema` `loose_object`: a validation issue as an error
135
- * response carries it, for either schema library — fuz_schema's `SchemaIssue`
136
- * as JSON, with `message` the text of the issue. `to_wire_issues` builds it
137
- * from either library's issues.
68
+ * response carries it — `SchemaIssue` as JSON, with `message` the text of the
69
+ * issue. `to_wire_issues` builds it.
138
70
  *
139
71
  * Loose: a client reads it, and a newer server may add fields.
140
72
  */
141
- export declare const WireIssue: Schema<{
142
- message: string;
73
+ export declare const WireIssue: import("@fuzdev/fuz_schema/schema.ts").Schema<{
74
+ kind: string;
143
75
  path: (string | number)[];
144
76
  expected: string;
145
- kind: string;
146
77
  received: string;
147
- } & Record<string, unknown>, {
148
78
  message: string;
79
+ } & Record<string, unknown>, {
80
+ kind: string;
149
81
  path: (string | number)[];
150
82
  expected: string;
151
- kind: string;
152
83
  received: string;
84
+ message: string;
153
85
  } & Record<string, unknown>, "loose_object", {
154
86
  /** The fuz_schema kind of the check that failed, or `unknown_key` / `missing_key`. */
155
- kind: Schema<string, string, "string", undefined>;
87
+ kind: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
156
88
  /** Keys from the root value to the one that failed, outermost first. */
157
- path: Schema<(string | number)[], (string | number)[], "array", Schema<string | number, string | number, "union", readonly [Schema<string, string, "string", undefined>, Schema<number, number, "number", undefined>]>>;
89
+ path: import("@fuzdev/fuz_schema/schema.ts").Schema<(string | number)[], (string | number)[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<string | number, string | number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>]>>;
158
90
  /** Describes what was expected, as fuz_schema writes it. */
159
- expected: Schema<string, string, "string", undefined>;
91
+ expected: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
160
92
  /** The type of the value that failed: `'null'`, `'array'`, `'NaN'`, `'Infinity'`, `'-Infinity'`, or its `typeof`. */
161
- received: Schema<string, string, "string", undefined>;
162
- /** The issue as text: `format_issue` for a fuz_schema issue, Zod's own message for a Zod one. */
163
- message: Schema<string, string, "string", undefined>;
93
+ received: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
94
+ /** The issue as text, `format_issue`'s. */
95
+ message: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
164
96
  }>;
165
97
  export type WireIssue = Infer<typeof WireIssue>;
166
98
  /**
167
- * A failed parse's issues as `WireIssue`s, whichever library made them.
168
- *
169
- * A fuz_schema issue keeps its `kind`, `path`, `expected` and `received`, and
170
- * its `message` is `format_issue`'s text, the path included.
171
- *
172
- * A Zod issue maps to the kind fuz_schema reports for the same check, its
173
- * `message` Zod's own text, which names no path:
99
+ * A failed parse's issues as `WireIssue`s: each keeps its `kind`, `path`,
100
+ * `expected` and `received`, and its `message` is `format_issue`'s text, the
101
+ * path included. A symbol key in a path goes as its text.
174
102
  *
175
- * - `invalid_type` — the type's kind (`string`, `number`, `boolean`,
176
- * `bigint`, `object`, `record`, `array`); `int` is `integer`, a `tuple` an
177
- * `array`, `null`, `undefined`, `void` and `nan` a `literal` of the value,
178
- * `nonoptional` a `missing_key`, and a type fuz_schema has no kind for
179
- * (`date`, `map`, `set`, `file`, `symbol`, `function`, `never`) a `check`
180
- * expecting the type's name. A missing key is reported as fuz_schema
181
- * reports it, as the type expected with `received: 'undefined'`.
182
- * - `too_small` / `too_big` — `min_length` / `max_length` for a string,
183
- * array, set or file (`length >= N`), `min_value` / `max_value` otherwise
184
- * (`>= N`); an exclusive bound writes `>` or `<`, which fuz_schema has no
185
- * check for, and an exact length is reported as the bound it broke.
186
- * - `invalid_format` — `uuid` for a `uuid` or `guid`, `iso_datetime` for a
187
- * `datetime`, `regex` for a `regex` (expecting its pattern), and a `check`
188
- * expecting the format's name for every other format.
189
- * - `unrecognized_keys` — an `unknown_key` per key, the key appended to the
190
- * path, as fuz_schema reports them.
191
- * - `invalid_union` — a `variant` expecting the options when Zod names a
192
- * discriminator, else a `union` expecting each option as fuz_schema names
193
- * it: by the type or the values it expected of the value, or by the
194
- * value's type when the option took the type and failed a refinement or a
195
- * field below. A union refused because more than one option matched is a
196
- * `union` expecting `exactly one option`.
197
- * - `invalid_value` — a `literal` of one value, a `one_of` of more.
198
- * - `custom` — a `check`; `not_multiple_of` a `check` expecting
199
- * `multiple of N`; `invalid_key` and `invalid_element` a `check` expecting
200
- * `a valid key` / `a valid element`.
201
- *
202
- * A Zod issue holds no value, so `received` is read from `input` at the
203
- * issue's path: `'undefined'` where a key is missing or the path leads
204
- * through something that isn't an object. Where an earlier step of a Zod
205
- * pipe replaced the value, it names the input's value, not the replacement.
206
- *
207
- * @param issues - a failed parse's issues, either library
208
- * @param input - the value that was parsed
209
- * @returns the issues, one per issue but for a Zod `unrecognized_keys`, which is one per key
103
+ * @param issues - a failed parse's issues
104
+ * @returns one per issue
210
105
  */
211
- export declare const to_wire_issues: (issues: ReadonlyArray<AnyIssue>, input: unknown) => Array<WireIssue>;
106
+ export declare const to_wire_issues: (issues: ReadonlyArray<SchemaIssue>) => Array<WireIssue>;
212
107
  //# 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;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EA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