@fuzdev/fuz_app 0.168.0 → 0.169.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 +1 -1
- package/dist/actions/action_codegen.d.ts +9 -7
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +20 -15
- package/dist/actions/action_event_data.d.ts +16 -16
- package/dist/actions/heartbeat.d.ts +1 -1
- 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_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 +61 -61
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.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 +424 -424
- package/dist/auth/cell_action_specs.js +1 -1
- 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/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_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 +1 -1
- 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/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/http/CLAUDE.md +7 -7
- package/dist/http/auth_shape.d.ts +15 -32
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +31 -38
- 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 +18 -18
- package/dist/http/jsonrpc.d.ts +11 -11
- package/dist/http/schema_helpers.d.ts +2 -2
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +8 -7
- package/dist/primitive_schemas.d.ts +173 -115
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +134 -158
- package/dist/schema_issues.d.ts +10 -7
- package/dist/schema_issues.d.ts.map +1 -1
- package/dist/schema_issues.js +38 -8
- package/dist/server/serve_fact_route.js +1 -1
- package/dist/server/surface_route.js +1 -1
- package/dist/testing/CLAUDE.md +3 -3
- 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/fact_serving.js +1 -1
- package/dist/testing/cross_backend/setup.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +3 -4
- package/dist/testing/cross_backend/testing_origin_check.d.ts +8 -8
- 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/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +35 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +0 -1
- package/dist/testing/schema_generators.js +1 -13
- 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/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/role_grant_offers_state.svelte.d.ts +1 -1
- package/dist/zod.d.ts +18 -3
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +26 -3
- package/dist/zod_schemas.d.ts +100 -0
- package/dist/zod_schemas.d.ts.map +1 -0
- package/dist/zod_schemas.js +157 -0
- package/package.json +5 -5
- 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/http/auth_shape.js
CHANGED
|
@@ -33,36 +33,28 @@
|
|
|
33
33
|
*
|
|
34
34
|
* @module
|
|
35
35
|
*/
|
|
36
|
-
import { z } from 'zod';
|
|
37
36
|
import { is_schema, one_of, parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
38
37
|
import { get_schema_entries } from '@fuzdev/fuz_schema/introspect.ts';
|
|
39
|
-
import {
|
|
40
|
-
import { ACTING_ACTOR_DESCRIPTION, ActingActor as ActingActorFuz } from '../primitive_schemas_fuz.js';
|
|
38
|
+
import { ActingActor } from '../primitive_schemas.js';
|
|
41
39
|
import { zod_unwrap_to_object } from '../zod.js';
|
|
42
40
|
/**
|
|
43
|
-
* `
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* Account-grain routes — input doesn't declare `acting` and auth doesn't
|
|
54
|
-
* require role_grants — skip resolution entirely; their `RequestContext.actor`
|
|
55
|
-
* is `null` and the audit envelope's `actor_id` stays null.
|
|
56
|
-
*
|
|
57
|
-
* Lives next to `RouteAuth` because the two are paired by registry-time
|
|
58
|
-
* invariant 2: `auth.actor !== 'none'` ⟺ input (or query, on REST GETs)
|
|
59
|
-
* declares `acting?: ActingActor`. Keeping the contract in one module
|
|
60
|
-
* removes the http/ → auth/ import that an earlier split forced.
|
|
41
|
+
* The Zod `ActingActor` forms `input_schema_declares_acting` matches by
|
|
42
|
+
* reference: `ZodActingActor`, registered when `zod_schemas.ts` loads, so
|
|
43
|
+
* this module never imports Zod at runtime. A Zod input holding it has loaded
|
|
44
|
+
* that module, so it is registered before any spec reaches the check.
|
|
45
|
+
*/
|
|
46
|
+
const zod_acting_actors = new WeakSet();
|
|
47
|
+
/**
|
|
48
|
+
* Register a Zod schema as the Zod form of `ActingActor`, which
|
|
49
|
+
* `input_schema_declares_acting` then finds by reference. `zod_schemas.ts`
|
|
50
|
+
* registers `ZodActingActor`, its one caller.
|
|
61
51
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
52
|
+
* @param schema - the Zod `ActingActor`
|
|
53
|
+
* @internal
|
|
64
54
|
*/
|
|
65
|
-
export const
|
|
55
|
+
export const register_zod_acting_actor = (schema) => {
|
|
56
|
+
zod_acting_actors.add(schema);
|
|
57
|
+
};
|
|
66
58
|
/**
|
|
67
59
|
* Read an `acting` selector out of an unvalidated value.
|
|
68
60
|
*
|
|
@@ -83,17 +75,17 @@ export const ActingActor = Uuid.optional().meta({ description: ACTING_ACTOR_DESC
|
|
|
83
75
|
* an input schema behind it, so there a malformed selector is final (the
|
|
84
76
|
* status route answers account-only).
|
|
85
77
|
*
|
|
86
|
-
* The grammar is
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
78
|
+
* The grammar is `ActingActor`'s, which is `ZodActingActor`'s and the Rust
|
|
79
|
+
* spine's, so every value reads as either would, the max UUID in any case
|
|
80
|
+
* included. The id comes back lowercased. A route declaring `acting` on its
|
|
81
|
+
* `query` schema doesn't read it here: that schema runs ahead of the
|
|
82
|
+
* authorization phase, with the same grammar.
|
|
91
83
|
*
|
|
92
84
|
* @param value - the raw `acting` field, from params / query / body
|
|
93
85
|
* @returns the actor id, or `undefined` when absent or malformed
|
|
94
86
|
*/
|
|
95
87
|
export const parse_acting = (value) => {
|
|
96
|
-
const parsed = parse(
|
|
88
|
+
const parsed = parse(ActingActor, value);
|
|
97
89
|
return parsed.ok ? parsed.value : undefined;
|
|
98
90
|
};
|
|
99
91
|
/**
|
|
@@ -230,10 +222,10 @@ export const assert_route_auth_invariants = (auth, context) => {
|
|
|
230
222
|
/**
|
|
231
223
|
* Whether a schema declares the canonical `acting?: ActingActor` field.
|
|
232
224
|
* Reference-equality on the exported `ActingActor` schema of the input's
|
|
233
|
-
* library —
|
|
234
|
-
* `
|
|
235
|
-
* fields don't trip this check, nor does either
|
|
236
|
-
* object.
|
|
225
|
+
* library — `ActingActor` (`primitive_schemas.ts`) in a fuz_schema object,
|
|
226
|
+
* `ZodActingActor` (`zod_schemas.ts`) in a Zod one — so consumer schemas with
|
|
227
|
+
* unrelated `acting` fields don't trip this check, nor does either form in
|
|
228
|
+
* the other library's object.
|
|
237
229
|
*
|
|
238
230
|
* Peels through Zod wrappers (`optional`, `nullable`, `default`,
|
|
239
231
|
* `transform`, `pipe`, `prefault`) via `zod_unwrap_to_object` so a spec
|
|
@@ -248,11 +240,12 @@ export const assert_route_auth_invariants = (auth, context) => {
|
|
|
248
240
|
*/
|
|
249
241
|
export const input_schema_declares_acting = (schema) => {
|
|
250
242
|
if (is_schema(schema))
|
|
251
|
-
return get_schema_entries(schema)?.acting ===
|
|
243
|
+
return get_schema_entries(schema)?.acting === ActingActor;
|
|
252
244
|
const obj = zod_unwrap_to_object(schema);
|
|
253
245
|
if (!obj)
|
|
254
246
|
return false;
|
|
255
|
-
|
|
247
|
+
const acting = obj.shape.acting;
|
|
248
|
+
return acting !== undefined && zod_acting_actors.has(acting);
|
|
256
249
|
};
|
|
257
250
|
/**
|
|
258
251
|
* Registry-time biconditional check: `auth.actor !== 'none' ⟺ some
|
|
@@ -281,7 +274,7 @@ export const assert_route_auth_acting_biconditional = (auth, slots, context) =>
|
|
|
281
274
|
return;
|
|
282
275
|
const slot_phrase = slots.query !== undefined ? 'input or query schema' : 'input schema';
|
|
283
276
|
if (wants_actor) {
|
|
284
|
-
throw new Error(`${context}: auth.actor === '${auth.actor}' requires the ${slot_phrase} to declare 'acting?: ActingActor'
|
|
277
|
+
throw new Error(`${context}: auth.actor === '${auth.actor}' requires the ${slot_phrase} to declare 'acting?: ActingActor' (or ZodActingActor in a Zod schema) (registry-time invariant 2)`);
|
|
285
278
|
}
|
|
286
|
-
throw new Error(`${context}: ${slot_phrase} declares 'acting?: ActingActor' (
|
|
279
|
+
throw new Error(`${context}: ${slot_phrase} declares 'acting?: ActingActor' (or ZodActingActor) but auth.actor === 'none' (registry-time invariant 2)`);
|
|
287
280
|
};
|
package/dist/http/db_routes.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
13
|
-
import type
|
|
13
|
+
import { type Uuid } from '../primitive_schemas.js';
|
|
14
14
|
import type { Db, DbType } from '../db/db.js';
|
|
15
15
|
import { type RouteSpec } from './route_spec.js';
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAsBtD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAsBtD,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAmD,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAelG;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAwCD,sDAAsD;AACtD,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAKrD,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAKrD,CAAC;AAEH;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B;;;;;;OAMG;IACH,KAAK,EAAE;QACN,SAAS,EAAE,CAAC,KAAK,EAAE;YAClB,UAAU,EAAE,qBAAqB,CAAC;YAClC,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;YACxB,EAAE,EAAE,MAAM,CAAC;YACX,QAAQ,EAAE;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAC;gBAAC,EAAE,EAAE,MAAM,CAAA;aAAE,CAAC;SAC3D,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACpB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACxC,8EAA8E;IAC9E,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,oBAAoB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC7C;AA2CD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GACjC,MAAM,WAAW,EACjB,SAAS,cAAc,KACrB,KAAK,CAAC,SAAS,CA8VjB,CAAC"}
|
package/dist/http/db_routes.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
13
13
|
import { array, boolean, integer, literal, loose_object, max_value, min_value, nullable, number, object, pipe, record, regex, safe_integer, string, transform, unknown, with_default } from '@fuzdev/fuz_schema/schema.ts';
|
|
14
|
-
import { ActingActor } from '../
|
|
14
|
+
import { ActingActor } from '../primitive_schemas.js';
|
|
15
15
|
import { define_route, get_route_params, get_route_query } from './route_spec.js';
|
|
16
16
|
import { route_fail, route_ok } from './route_result.js';
|
|
17
17
|
import { REST_DATABASE_CONNECTION_FAILED, REST_FOREIGN_KEY_VIOLATION, REST_ROW_NOT_FOUND, REST_TABLE_NO_PRIMARY_KEY, REST_TABLE_NOT_DELETABLE, REST_TABLE_NOT_FOUND } from './error_schemas.js';
|
|
@@ -279,40 +279,40 @@ export declare const dedupe_rest_errors: (defs: Iterable<RestErrorDef>) => Array
|
|
|
279
279
|
export declare const to_error_schemas: (defs: Iterable<RestErrorDef>) => ErrorSchemas;
|
|
280
280
|
export declare const REST_INVALID_REQUEST_BODY: RestErrorDef<400, "invalid_request_body", {
|
|
281
281
|
readonly issues: Schema<({
|
|
282
|
+
kind: string;
|
|
282
283
|
message: string;
|
|
283
284
|
path: (string | number)[];
|
|
284
285
|
expected: string;
|
|
285
|
-
kind: string;
|
|
286
286
|
received: string;
|
|
287
287
|
} & Record<string, unknown>)[] | undefined, ({
|
|
288
|
+
kind: string;
|
|
288
289
|
message: string;
|
|
289
290
|
path: (string | number)[];
|
|
290
291
|
expected: string;
|
|
291
|
-
kind: string;
|
|
292
292
|
received: string;
|
|
293
293
|
} & Record<string, unknown>)[] | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<Schema<({
|
|
294
|
+
kind: string;
|
|
294
295
|
message: string;
|
|
295
296
|
path: (string | number)[];
|
|
296
297
|
expected: string;
|
|
297
|
-
kind: string;
|
|
298
298
|
received: string;
|
|
299
299
|
} & Record<string, unknown>)[], ({
|
|
300
|
+
kind: string;
|
|
300
301
|
message: string;
|
|
301
302
|
path: (string | number)[];
|
|
302
303
|
expected: string;
|
|
303
|
-
kind: string;
|
|
304
304
|
received: string;
|
|
305
305
|
} & Record<string, unknown>)[], "array", Schema<{
|
|
306
|
+
kind: string;
|
|
306
307
|
message: string;
|
|
307
308
|
path: (string | number)[];
|
|
308
309
|
expected: string;
|
|
309
|
-
kind: string;
|
|
310
310
|
received: string;
|
|
311
311
|
} & Record<string, unknown>, {
|
|
312
|
+
kind: string;
|
|
312
313
|
message: string;
|
|
313
314
|
path: (string | number)[];
|
|
314
315
|
expected: string;
|
|
315
|
-
kind: string;
|
|
316
316
|
received: string;
|
|
317
317
|
} & Record<string, unknown>, "loose_object", {
|
|
318
318
|
kind: Schema<string, string, "string", undefined>;
|
|
@@ -325,40 +325,40 @@ export declare const REST_INVALID_REQUEST_BODY: RestErrorDef<400, "invalid_reque
|
|
|
325
325
|
export declare const REST_INVALID_JSON_BODY: RestErrorDef<400, "invalid_json_body", Record<never, never>>;
|
|
326
326
|
export declare const REST_INVALID_ROUTE_PARAMS: RestErrorDef<400, "invalid_route_params", {
|
|
327
327
|
readonly issues: Schema<({
|
|
328
|
+
kind: string;
|
|
328
329
|
message: string;
|
|
329
330
|
path: (string | number)[];
|
|
330
331
|
expected: string;
|
|
331
|
-
kind: string;
|
|
332
332
|
received: string;
|
|
333
333
|
} & Record<string, unknown>)[] | undefined, ({
|
|
334
|
+
kind: string;
|
|
334
335
|
message: string;
|
|
335
336
|
path: (string | number)[];
|
|
336
337
|
expected: string;
|
|
337
|
-
kind: string;
|
|
338
338
|
received: string;
|
|
339
339
|
} & Record<string, unknown>)[] | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<Schema<({
|
|
340
|
+
kind: string;
|
|
340
341
|
message: string;
|
|
341
342
|
path: (string | number)[];
|
|
342
343
|
expected: string;
|
|
343
|
-
kind: string;
|
|
344
344
|
received: string;
|
|
345
345
|
} & Record<string, unknown>)[], ({
|
|
346
|
+
kind: string;
|
|
346
347
|
message: string;
|
|
347
348
|
path: (string | number)[];
|
|
348
349
|
expected: string;
|
|
349
|
-
kind: string;
|
|
350
350
|
received: string;
|
|
351
351
|
} & Record<string, unknown>)[], "array", Schema<{
|
|
352
|
+
kind: string;
|
|
352
353
|
message: string;
|
|
353
354
|
path: (string | number)[];
|
|
354
355
|
expected: string;
|
|
355
|
-
kind: string;
|
|
356
356
|
received: string;
|
|
357
357
|
} & Record<string, unknown>, {
|
|
358
|
+
kind: string;
|
|
358
359
|
message: string;
|
|
359
360
|
path: (string | number)[];
|
|
360
361
|
expected: string;
|
|
361
|
-
kind: string;
|
|
362
362
|
received: string;
|
|
363
363
|
} & Record<string, unknown>, "loose_object", {
|
|
364
364
|
kind: Schema<string, string, "string", undefined>;
|
|
@@ -370,40 +370,40 @@ export declare const REST_INVALID_ROUTE_PARAMS: RestErrorDef<400, "invalid_route
|
|
|
370
370
|
}>;
|
|
371
371
|
export declare const REST_INVALID_QUERY_PARAMS: RestErrorDef<400, "invalid_query_params", {
|
|
372
372
|
readonly issues: Schema<({
|
|
373
|
+
kind: string;
|
|
373
374
|
message: string;
|
|
374
375
|
path: (string | number)[];
|
|
375
376
|
expected: string;
|
|
376
|
-
kind: string;
|
|
377
377
|
received: string;
|
|
378
378
|
} & Record<string, unknown>)[] | undefined, ({
|
|
379
|
+
kind: string;
|
|
379
380
|
message: string;
|
|
380
381
|
path: (string | number)[];
|
|
381
382
|
expected: string;
|
|
382
|
-
kind: string;
|
|
383
383
|
received: string;
|
|
384
384
|
} & Record<string, unknown>)[] | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<Schema<({
|
|
385
|
+
kind: string;
|
|
385
386
|
message: string;
|
|
386
387
|
path: (string | number)[];
|
|
387
388
|
expected: string;
|
|
388
|
-
kind: string;
|
|
389
389
|
received: string;
|
|
390
390
|
} & Record<string, unknown>)[], ({
|
|
391
|
+
kind: string;
|
|
391
392
|
message: string;
|
|
392
393
|
path: (string | number)[];
|
|
393
394
|
expected: string;
|
|
394
|
-
kind: string;
|
|
395
395
|
received: string;
|
|
396
396
|
} & Record<string, unknown>)[], "array", Schema<{
|
|
397
|
+
kind: string;
|
|
397
398
|
message: string;
|
|
398
399
|
path: (string | number)[];
|
|
399
400
|
expected: string;
|
|
400
|
-
kind: string;
|
|
401
401
|
received: string;
|
|
402
402
|
} & Record<string, unknown>, {
|
|
403
|
+
kind: string;
|
|
403
404
|
message: string;
|
|
404
405
|
path: (string | number)[];
|
|
405
406
|
expected: string;
|
|
406
|
-
kind: string;
|
|
407
407
|
received: string;
|
|
408
408
|
} & Record<string, unknown>, "loose_object", {
|
|
409
409
|
kind: Schema<string, string, "string", undefined>;
|
package/dist/http/jsonrpc.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare const JSONRPC_SERVER_ERROR_END = -32099;
|
|
|
103
103
|
* A server-defined error code, an integer in the -32000 to -32099 range (the
|
|
104
104
|
* Rust spine's codes are `i32`s).
|
|
105
105
|
*/
|
|
106
|
-
export declare const JsonrpcServerErrorCode: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"
|
|
106
|
+
export declare const JsonrpcServerErrorCode: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | 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<"lazy"> | 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<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | 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<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform">)[]> & {
|
|
107
107
|
readonly '~types'?: {
|
|
108
108
|
readonly input: number;
|
|
109
109
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
|
|
@@ -114,7 +114,7 @@ export type JsonrpcServerErrorCode = Infer<typeof JsonrpcServerErrorCode>;
|
|
|
114
114
|
* A valid JSON-RPC error code — one of the standard codes or a
|
|
115
115
|
* server-defined code in the -32000 to -32099 range.
|
|
116
116
|
*/
|
|
117
|
-
export declare const JsonrpcErrorCode: import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603, -32700 | -32600 | -32601 | -32602 | -32603, "one_of", readonly [-32700, -32600, -32601, -32602, -32603]>, import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"
|
|
117
|
+
export declare const JsonrpcErrorCode: import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603, -32700 | -32600 | -32601 | -32602 | -32603, "one_of", readonly [-32700, -32600, -32601, -32602, -32603]>, import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | 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<"lazy"> | 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<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | 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<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform">)[]> & {
|
|
118
118
|
readonly '~types'?: {
|
|
119
119
|
readonly input: number;
|
|
120
120
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
|
|
@@ -140,7 +140,7 @@ export declare const JsonrpcErrorObject: import("@fuzdev/fuz_schema/schema.ts").
|
|
|
140
140
|
code: number;
|
|
141
141
|
data?: unknown;
|
|
142
142
|
} & Record<string, unknown>, "loose_object", {
|
|
143
|
-
code: import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603, -32700 | -32600 | -32601 | -32602 | -32603, "one_of", readonly [-32700, -32600, -32601, -32602, -32603]>, import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"
|
|
143
|
+
code: import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603, -32700 | -32600 | -32601 | -32602 | -32603, "one_of", readonly [-32700, -32600, -32601, -32602, -32603]>, import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | 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<"lazy"> | 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<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | 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<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform">)[]> & {
|
|
144
144
|
readonly '~types'?: {
|
|
145
145
|
readonly input: number;
|
|
146
146
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
|
|
@@ -152,20 +152,20 @@ export declare const JsonrpcErrorObject: import("@fuzdev/fuz_schema/schema.ts").
|
|
|
152
152
|
export type JsonrpcErrorObject = Infer<typeof JsonrpcErrorObject>;
|
|
153
153
|
/** A response that indicates an error occurred. */
|
|
154
154
|
export declare const JsonrpcErrorResponse: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
155
|
+
id: string | number | null;
|
|
155
156
|
error: {
|
|
156
157
|
message: string;
|
|
157
158
|
code: -32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">;
|
|
158
159
|
data?: unknown;
|
|
159
160
|
} & Record<string, unknown>;
|
|
160
|
-
id: string | number | null;
|
|
161
161
|
jsonrpc: "2.0";
|
|
162
162
|
} & Record<string, unknown>, {
|
|
163
|
+
id: string | number | null;
|
|
163
164
|
error: {
|
|
164
165
|
message: string;
|
|
165
166
|
code: number;
|
|
166
167
|
data?: unknown;
|
|
167
168
|
} & Record<string, unknown>;
|
|
168
|
-
id: string | number | null;
|
|
169
169
|
jsonrpc: "2.0";
|
|
170
170
|
} & Record<string, unknown>, "loose_object", {
|
|
171
171
|
jsonrpc: import("@fuzdev/fuz_schema/schema.ts").Schema<"2.0", "2.0", "literal", "2.0">;
|
|
@@ -179,7 +179,7 @@ export declare const JsonrpcErrorResponse: import("@fuzdev/fuz_schema/schema.ts"
|
|
|
179
179
|
code: number;
|
|
180
180
|
data?: unknown;
|
|
181
181
|
} & Record<string, unknown>, "loose_object", {
|
|
182
|
-
code: import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603, -32700 | -32600 | -32601 | -32602 | -32603, "one_of", readonly [-32700, -32600, -32601, -32602, -32603]>, import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"
|
|
182
|
+
code: import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603, -32700 | -32600 | -32601 | -32602 | -32603, "one_of", readonly [-32700, -32600, -32601, -32602, -32603]>, import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | 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<"lazy"> | 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<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | 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<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform">)[]> & {
|
|
183
183
|
readonly '~types'?: {
|
|
184
184
|
readonly input: number;
|
|
185
185
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
|
|
@@ -196,24 +196,24 @@ export declare const JsonrpcResponseOrError: import("@fuzdev/fuz_schema/schema.t
|
|
|
196
196
|
jsonrpc: "2.0";
|
|
197
197
|
result: unknown;
|
|
198
198
|
} & Record<string, unknown>) | ({
|
|
199
|
+
id: string | number | null;
|
|
199
200
|
error: {
|
|
200
201
|
message: string;
|
|
201
202
|
code: -32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">;
|
|
202
203
|
data?: unknown;
|
|
203
204
|
} & Record<string, unknown>;
|
|
204
|
-
id: string | number | null;
|
|
205
205
|
jsonrpc: "2.0";
|
|
206
206
|
} & Record<string, unknown>), ({
|
|
207
207
|
id: string | number;
|
|
208
208
|
jsonrpc: "2.0";
|
|
209
209
|
result: unknown;
|
|
210
210
|
} & Record<string, unknown>) | ({
|
|
211
|
+
id: string | number | null;
|
|
211
212
|
error: {
|
|
212
213
|
message: string;
|
|
213
214
|
code: number;
|
|
214
215
|
data?: unknown;
|
|
215
216
|
} & Record<string, unknown>;
|
|
216
|
-
id: string | number | null;
|
|
217
217
|
jsonrpc: "2.0";
|
|
218
218
|
} & Record<string, unknown>), "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
219
219
|
id: string | number;
|
|
@@ -228,20 +228,20 @@ export declare const JsonrpcResponseOrError: import("@fuzdev/fuz_schema/schema.t
|
|
|
228
228
|
id: 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>]>;
|
|
229
229
|
result: import("@fuzdev/fuz_schema/schema.ts").Schema<unknown, unknown, "unknown", undefined>;
|
|
230
230
|
}>, import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
231
|
+
id: string | number | null;
|
|
231
232
|
error: {
|
|
232
233
|
message: string;
|
|
233
234
|
code: -32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">;
|
|
234
235
|
data?: unknown;
|
|
235
236
|
} & Record<string, unknown>;
|
|
236
|
-
id: string | number | null;
|
|
237
237
|
jsonrpc: "2.0";
|
|
238
238
|
} & Record<string, unknown>, {
|
|
239
|
+
id: string | number | null;
|
|
239
240
|
error: {
|
|
240
241
|
message: string;
|
|
241
242
|
code: number;
|
|
242
243
|
data?: unknown;
|
|
243
244
|
} & Record<string, unknown>;
|
|
244
|
-
id: string | number | null;
|
|
245
245
|
jsonrpc: "2.0";
|
|
246
246
|
} & Record<string, unknown>, "loose_object", {
|
|
247
247
|
jsonrpc: import("@fuzdev/fuz_schema/schema.ts").Schema<"2.0", "2.0", "literal", "2.0">;
|
|
@@ -255,7 +255,7 @@ export declare const JsonrpcResponseOrError: import("@fuzdev/fuz_schema/schema.t
|
|
|
255
255
|
code: number;
|
|
256
256
|
data?: unknown;
|
|
257
257
|
} & Record<string, unknown>, "loose_object", {
|
|
258
|
-
code: import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603, -32700 | -32600 | -32601 | -32602 | -32603, "one_of", readonly [-32700, -32600, -32601, -32602, -32603]>, import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"
|
|
258
|
+
code: import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603 | import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<-32700 | -32600 | -32601 | -32602 | -32603, -32700 | -32600 | -32601 | -32602 | -32603, "one_of", readonly [-32700, -32600, -32601, -32602, -32603]>, import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<number, "JsonrpcServerErrorCode">, number, "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<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | 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<"lazy"> | 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<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | 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<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform">)[]> & {
|
|
259
259
|
readonly '~types'?: {
|
|
260
260
|
readonly input: number;
|
|
261
261
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
|
|
@@ -179,8 +179,8 @@ export interface SchemaToSurfaceOptions {
|
|
|
179
179
|
*
|
|
180
180
|
* Returns `null` for a null schema (`is_null_schema`) and a void schema
|
|
181
181
|
* (`is_void_schema`), in either library: no body, no params. Any other
|
|
182
|
-
* schema is written with its library's emitter (`to_json_schema` for fuz_schema,
|
|
183
|
-
* for Zod) on the side `options.io` names. A part JSON Schema can't say (a
|
|
182
|
+
* schema is written with its library's emitter (`to_json_schema` for fuz_schema, the schema's own
|
|
183
|
+
* `.toJSONSchema()` for Zod) on the side `options.io` names. A part JSON Schema can't say (a
|
|
184
184
|
* transform on the output side, a `z.custom()`, a fuz_schema `check`) is left
|
|
185
185
|
* out or written as `{}` (a `pipe(string, check(…))` writes as
|
|
186
186
|
* `{type: 'string'}`), and `options.on_unrepresentable` hears the library's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/schema_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAIN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/schema_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAIN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAG7B;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,gBAAgB,KAAG,OAEc,CAAC;AAEzE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,gBAAgB,KAAG,OAEmB,CAAC;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,OAAO,KAAG,OAUpD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,gBAAgB,EAAE,YAAY,OAAO,KAAG,OACP,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,OAAO,KAAG,OAavD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,gCAAgC,GAAI,CAAC,SAAS,gBAAgB,EAC1E,QAAQ,CAAC,EACT,OAAO,OAAO,KACZ,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CA0BpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AA8FxC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,gBAAgB,KAAG,OAID,CAAC;AAcnE,sCAAsC;AACtC,MAAM,WAAW,sBAAsB;IACtC;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACxB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,iBAAiB,GAC7B,QAAQ,gBAAgB,EACxB,UAAU,sBAAsB,KAC9B,OA+BF,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;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GACjC,MAAM;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAA;CAAE,EAC/E,YAAY,MAAM,KAChB,OACyF,CAAC;AAE7F;;;;;;;GAOG;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,OAAgG,CAAC"}
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import { z } from 'zod';
|
|
11
10
|
import { to_error_message } from '@fuzdev/fuz_util/error.ts';
|
|
12
11
|
import { is_schema } from '@fuzdev/fuz_schema/schema.ts';
|
|
13
12
|
import { unwrap_schema } from '@fuzdev/fuz_schema/introspect.ts';
|
|
14
13
|
import { to_json_schema } from '@fuzdev/fuz_schema/json_schema.ts';
|
|
15
14
|
import { assert_validation_schema, parse_any, unknown_key_targets } from '../schema_issues.js';
|
|
15
|
+
import { zod_has_trait } from '../zod.js';
|
|
16
16
|
/**
|
|
17
17
|
* Check if a schema is exactly `z.null()`, or a `@fuzdev/fuz_schema`
|
|
18
18
|
* `literal(null)`.
|
|
@@ -21,7 +21,7 @@ import { assert_validation_schema, parse_any, unknown_key_targets } from '../sch
|
|
|
21
21
|
* positives from `z.nullable(z.string())` or similar schemas that accept
|
|
22
22
|
* null but also accept other values.
|
|
23
23
|
*/
|
|
24
|
-
export const is_null_schema = (schema) => schema
|
|
24
|
+
export const is_null_schema = (schema) => zod_has_trait(schema, 'ZodNull') ||
|
|
25
25
|
(is_schema(schema) && schema.kind === 'literal' && schema.def === null);
|
|
26
26
|
/**
|
|
27
27
|
* Check if a schema is exactly `z.void()`, or a `@fuzdev/fuz_schema`
|
|
@@ -35,7 +35,7 @@ export const is_null_schema = (schema) => schema instanceof z.ZodNull ||
|
|
|
35
35
|
* `undefined`, so an optional schema is not void. `z.undefined()` is not
|
|
36
36
|
* void either.
|
|
37
37
|
*/
|
|
38
|
-
export const is_void_schema = (schema) => schema
|
|
38
|
+
export const is_void_schema = (schema) => zod_has_trait(schema, 'ZodVoid') ||
|
|
39
39
|
(is_schema(schema) && schema.kind === 'literal' && schema.def === undefined);
|
|
40
40
|
/**
|
|
41
41
|
* Normalize the raw `params` of a void input (`is_void_schema`): an absent
|
|
@@ -312,7 +312,8 @@ const get_at_path = (value, path) => {
|
|
|
312
312
|
*/
|
|
313
313
|
export const is_strict_object_schema = (schema) => is_schema(schema)
|
|
314
314
|
? fuz_schema_untransformed_head(schema)?.kind === 'object'
|
|
315
|
-
: schema
|
|
315
|
+
: zod_has_trait(schema, 'ZodObject') &&
|
|
316
|
+
zod_has_trait(schema.def.catchall, 'ZodNever');
|
|
316
317
|
// the schema a value reaches first through every `pipe` it starts with, or
|
|
317
318
|
// `null` when any of those pipes has a `transform` stage
|
|
318
319
|
const fuz_schema_untransformed_head = (schema) => {
|
|
@@ -338,8 +339,8 @@ const fuz_schema_untransformed_head = (schema) => {
|
|
|
338
339
|
*
|
|
339
340
|
* Returns `null` for a null schema (`is_null_schema`) and a void schema
|
|
340
341
|
* (`is_void_schema`), in either library: no body, no params. Any other
|
|
341
|
-
* schema is written with its library's emitter (`to_json_schema` for fuz_schema,
|
|
342
|
-
* for Zod) on the side `options.io` names. A part JSON Schema can't say (a
|
|
342
|
+
* schema is written with its library's emitter (`to_json_schema` for fuz_schema, the schema's own
|
|
343
|
+
* `.toJSONSchema()` for Zod) on the side `options.io` names. A part JSON Schema can't say (a
|
|
343
344
|
* transform on the output side, a `z.custom()`, a fuz_schema `check`) is left
|
|
344
345
|
* out or written as `{}` (a `pipe(string, check(…))` writes as
|
|
345
346
|
* `{type: 'string'}`), and `options.on_unrepresentable` hears the library's
|
|
@@ -369,7 +370,7 @@ export const schema_to_surface = (schema, options) => {
|
|
|
369
370
|
const io = options?.io ?? 'output';
|
|
370
371
|
const write = (unrepresentable) => strip_json_schema_noise(is_schema(schema)
|
|
371
372
|
? to_json_schema(schema, { io, unrepresentable })
|
|
372
|
-
:
|
|
373
|
+
: schema.toJSONSchema({ io, unrepresentable }));
|
|
373
374
|
const fail = (message, cause) => new Error(`${options?.source ?? 'schema'}: ${message}`, { cause });
|
|
374
375
|
let gap;
|
|
375
376
|
try {
|