@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.
- package/dist/actions/CLAUDE.md +17 -19
- package/dist/actions/action_codegen.d.ts +32 -23
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +101 -80
- package/dist/actions/action_event.d.ts +0 -8
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -6
- package/dist/actions/action_event_data.d.ts +18 -18
- package/dist/actions/action_rpc.d.ts +1 -1
- package/dist/actions/action_rpc.js +1 -1
- package/dist/actions/action_spec.d.ts +8 -10
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +1 -1
- package/dist/actions/action_types.d.ts +4 -4
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +2 -2
- package/dist/actions/broadcast_api.d.ts +2 -2
- package/dist/actions/broadcast_api.js +4 -4
- package/dist/actions/compile_action_registry.d.ts +6 -7
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/compile_action_registry.js +8 -9
- package/dist/actions/perform_action.d.ts +6 -6
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +11 -10
- package/dist/actions/socket.svelte.d.ts +1 -1
- package/dist/actions/socket.svelte.js +2 -2
- package/dist/auth/CLAUDE.md +11 -11
- package/dist/auth/account_action_specs.d.ts +11 -11
- package/dist/auth/account_action_specs.js +1 -1
- package/dist/auth/account_route_schema.d.ts +18 -18
- package/dist/auth/account_route_schema.js +1 -1
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/account_schema.d.ts +38 -40
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +7 -8
- package/dist/auth/actor_lookup_action_specs.d.ts +7 -7
- package/dist/auth/actor_lookup_action_specs.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts +6 -6
- package/dist/auth/actor_search_action_specs.js +1 -1
- package/dist/auth/admin_action_specs.d.ts +166 -166
- package/dist/auth/admin_action_specs.js +1 -1
- package/dist/auth/app_settings_schema.d.ts +3 -3
- package/dist/auth/app_settings_schema.d.ts.map +1 -1
- package/dist/auth/app_settings_schema.js +1 -1
- package/dist/auth/audit_emitter.d.ts +6 -7
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +11 -22
- package/dist/auth/audit_log_ddl.d.ts +1 -1
- package/dist/auth/audit_log_ddl.js +1 -1
- package/dist/auth/audit_log_queries.d.ts +0 -13
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +3 -3
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.js +1 -1
- package/dist/auth/audit_log_schema.d.ts +69 -70
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +2 -2
- package/dist/auth/auth_ddl.d.ts +1 -1
- package/dist/auth/auth_ddl.js +1 -1
- package/dist/auth/bootstrap_route_schema.d.ts +4 -4
- package/dist/auth/bootstrap_route_schema.js +1 -1
- package/dist/auth/cell_action_specs.d.ts +466 -466
- package/dist/auth/cell_action_specs.js +1 -1
- package/dist/auth/cell_actions.d.ts +2 -2
- package/dist/auth/cell_actions.js +5 -5
- package/dist/auth/cell_audit_action_specs.d.ts +14 -14
- package/dist/auth/cell_audit_action_specs.js +1 -1
- package/dist/auth/cell_audit_metadata.d.ts +8 -8
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_action_specs.d.ts +55 -55
- package/dist/auth/cell_field_action_specs.js +1 -1
- package/dist/auth/cell_field_audit_metadata.d.ts +4 -4
- package/dist/auth/cell_field_audit_metadata.js +1 -1
- package/dist/auth/cell_grant_action_specs.d.ts +61 -61
- package/dist/auth/cell_grant_action_specs.js +1 -1
- package/dist/auth/cell_grant_audit_metadata.d.ts +10 -10
- package/dist/auth/cell_grant_audit_metadata.js +1 -1
- package/dist/auth/cell_item_action_specs.d.ts +76 -76
- package/dist/auth/cell_item_action_specs.js +1 -1
- package/dist/auth/cell_item_audit_metadata.d.ts +5 -5
- package/dist/auth/cell_item_audit_metadata.js +1 -1
- package/dist/auth/invite_schema.d.ts +11 -11
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +1 -1
- package/dist/auth/name_schema.js +1 -1
- package/dist/auth/password.js +1 -1
- package/dist/auth/request_context.js +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts +182 -182
- package/dist/auth/role_grant_offer_action_specs.js +1 -1
- package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
- package/dist/auth/role_grant_offer_ddl.js +1 -1
- package/dist/auth/role_grant_offer_notifications.d.ts +107 -107
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +3 -4
- package/dist/auth/role_grant_offer_schema.d.ts +9 -9
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/self_service_role_action_specs.d.ts +2 -2
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/signup_route_schema.d.ts +2 -2
- package/dist/auth/signup_route_schema.js +1 -1
- package/dist/auth/token_scope.d.ts +8 -8
- package/dist/db/file_fact_url.d.ts +1 -1
- package/dist/env/env_schemas.d.ts +1 -2
- package/dist/env/env_schemas.d.ts.map +1 -1
- package/dist/env/env_schemas.js +3 -4
- package/dist/http/CLAUDE.md +30 -32
- package/dist/http/auth_shape.d.ts +17 -52
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +19 -61
- package/dist/http/db_routes.d.ts +1 -1
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +1 -1
- package/dist/http/error_schemas.d.ts +36 -36
- package/dist/http/jsonrpc.d.ts +11 -11
- package/dist/http/jsonrpc_helpers.js +1 -1
- package/dist/http/route_error_check.d.ts +2 -2
- package/dist/http/route_error_check.d.ts.map +1 -1
- package/dist/http/route_error_check.js +2 -3
- package/dist/http/route_errors.d.ts +4 -4
- package/dist/http/route_errors.d.ts.map +1 -1
- package/dist/http/route_errors.js +0 -13
- package/dist/http/route_spec.d.ts +33 -36
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +21 -22
- package/dist/http/schema_helpers.d.ts +75 -67
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +54 -76
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +6 -8
- package/dist/primitive_schemas.d.ts +162 -112
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +129 -161
- package/dist/realtime/sse.d.ts +3 -3
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +2 -2
- package/dist/schema_issues.d.ts +41 -146
- package/dist/schema_issues.d.ts.map +1 -1
- package/dist/schema_issues.js +39 -322
- package/dist/schema_meta.d.ts +63 -136
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +37 -184
- package/dist/sensitivity.d.ts +3 -5
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -5
- package/dist/server/serve_fact_route.js +1 -1
- package/dist/server/surface_route.js +1 -1
- package/dist/testing/CLAUDE.md +23 -25
- package/dist/testing/adversarial_headers.js +2 -2
- package/dist/testing/adversarial_input_cases.d.ts +19 -18
- package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
- package/dist/testing/adversarial_input_cases.js +29 -42
- package/dist/testing/assertions.d.ts +2 -2
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +3 -3
- package/dist/testing/cross_backend/account_lifecycle.js +2 -2
- package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +4 -3
- package/dist/testing/cross_backend/cell_crud.js +1 -1
- package/dist/testing/cross_backend/conformance_case.d.ts +96 -114
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_case.js +0 -256
- package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
- package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +3 -3
- package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
- package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
- package/dist/testing/cross_backend/cross_rpc.js +4 -4
- package/dist/testing/cross_backend/differential.js +2 -2
- package/dist/testing/cross_backend/fact_serving.js +1 -1
- package/dist/testing/cross_backend/identity_parity.js +9 -9
- package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
- package/dist/testing/cross_backend/query_shape.js +1 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts +26 -4
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +7 -8
- package/dist/testing/cross_backend/sse_round_trip.js +2 -2
- package/dist/testing/cross_backend/testing_origin_check.d.ts +12 -12
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +608 -201
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +46 -55
- package/dist/testing/cross_backend/token_lifetime.js +3 -3
- package/dist/testing/cross_backend/wire_shapes.js +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +35 -0
- package/dist/testing/cross_backend/ws_round_trip.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +1 -1
- package/dist/testing/integration.js +2 -2
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -2
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +2 -2
- package/dist/testing/rpc_attack_surface.js +1 -1
- package/dist/testing/rpc_envelope_cases.d.ts +3 -3
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +1 -1
- package/dist/testing/rpc_helpers.d.ts +12 -14
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +9 -11
- package/dist/testing/schema_generators.d.ts +67 -60
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +144 -151
- package/dist/testing/schema_introspect.d.ts +438 -78
- package/dist/testing/schema_introspect.d.ts.map +1 -1
- package/dist/testing/schema_introspect.js +26 -26
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/surface_invariants.d.ts +1 -1
- package/dist/testing/surface_invariants.js +1 -1
- package/dist/testing/transports/bootstrap.d.ts +1 -1
- package/dist/testing/transports/bootstrap.d.ts.map +1 -1
- package/dist/testing/transports/bootstrap.js +1 -1
- package/dist/ui/BootstrapForm.svelte +1 -2
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +1 -2
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +5 -5
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/form_state.svelte.d.ts +1 -1
- package/dist/ui/form_state.svelte.js +1 -1
- package/dist/ui/role_grant_offers_state.svelte.d.ts +1 -1
- package/package.json +7 -9
- package/dist/primitive_schemas_fuz.d.ts +0 -178
- package/dist/primitive_schemas_fuz.d.ts.map +0 -1
- package/dist/primitive_schemas_fuz.js +0 -149
- package/dist/zod.d.ts +0 -101
- package/dist/zod.d.ts.map +0 -1
- package/dist/zod.js +0 -195
package/dist/schema_issues.d.ts
CHANGED
|
@@ -1,101 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Validation issues
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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 {
|
|
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
|
-
*
|
|
19
|
-
*
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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:
|
|
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<
|
|
52
|
+
export declare const unknown_key_targets: (issues: ReadonlyArray<SchemaIssue>) => Array<UnknownKeyTarget> | null;
|
|
118
53
|
/**
|
|
119
|
-
* A failed parse's issues as text
|
|
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
|
|
56
|
+
* @param issues - a failed parse's issues
|
|
123
57
|
*/
|
|
124
|
-
export declare const format_issues: (issues: ReadonlyArray<
|
|
58
|
+
export declare const format_issues: (issues: ReadonlyArray<SchemaIssue>) => string;
|
|
125
59
|
/**
|
|
126
|
-
* Whether `err` is a thrown validation failure
|
|
127
|
-
* `
|
|
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
|
|
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
|
|
136
|
-
*
|
|
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
|
-
|
|
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
|
|
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
|
|
168
|
-
*
|
|
169
|
-
* A
|
|
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
|
-
* -
|
|
176
|
-
*
|
|
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<
|
|
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
|
|
1
|
+
{"version":3,"file":"schema_issues.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/schema_issues.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAMN,WAAW,EAGX,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,KAAK,IAAI,SAAS,CAG5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,WAAW,KAAG,OAC8B,CAAC;AAEtF,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;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC/B,QAAQ,aAAa,CAAC,WAAW,CAAC,KAChC,KAAK,CAAC,gBAAgB,CAAC,GAAG,IAO5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,aAAa,CAAC,WAAW,CAAC,KAAG,MAC/B,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,WACtC,CAAC;AAE5B;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;IACrB,sFAAsF;;IAEtF,wEAAwE;;IAExE,4DAA4D;;IAE5D,qHAAqH;;IAErH,2CAA2C;;EAE1C,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,aAAa,CAAC,WAAW,CAAC,KAAG,KAAK,CAAC,SAAS,CAO/E,CAAC"}
|