@fuzdev/fuz_app 0.154.0 → 0.155.1

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 (47) hide show
  1. package/dist/actions/CLAUDE.md +2 -2
  2. package/dist/actions/action_event.d.ts.map +1 -1
  3. package/dist/actions/action_event.js +14 -14
  4. package/dist/actions/peer_ping.js +3 -3
  5. package/dist/actions/perform_action.d.ts +12 -10
  6. package/dist/actions/perform_action.d.ts.map +1 -1
  7. package/dist/actions/perform_action.js +19 -16
  8. package/dist/auth/cell_actions.d.ts +6 -4
  9. package/dist/auth/cell_actions.d.ts.map +1 -1
  10. package/dist/auth/cell_actions.js +10 -9
  11. package/dist/http/CLAUDE.md +14 -8
  12. package/dist/http/schema_helpers.d.ts +102 -23
  13. package/dist/http/schema_helpers.d.ts.map +1 -1
  14. package/dist/http/schema_helpers.js +241 -38
  15. package/dist/http/surface.d.ts +7 -2
  16. package/dist/http/surface.d.ts.map +1 -1
  17. package/dist/http/surface.js +37 -14
  18. package/dist/primitive_schemas.d.ts +13 -4
  19. package/dist/primitive_schemas.d.ts.map +1 -1
  20. package/dist/primitive_schemas.js +13 -4
  21. package/dist/schema_issues.d.ts +96 -0
  22. package/dist/schema_issues.d.ts.map +1 -0
  23. package/dist/schema_issues.js +110 -0
  24. package/dist/schema_meta.d.ts +35 -12
  25. package/dist/schema_meta.d.ts.map +1 -1
  26. package/dist/schema_meta.js +60 -12
  27. package/dist/testing/CLAUDE.md +22 -9
  28. package/dist/testing/adversarial_404.d.ts +15 -0
  29. package/dist/testing/adversarial_404.d.ts.map +1 -1
  30. package/dist/testing/adversarial_404.js +26 -19
  31. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  32. package/dist/testing/adversarial_input_cases.js +2 -2
  33. package/dist/testing/cross_backend/cell_crud.d.ts.map +1 -1
  34. package/dist/testing/cross_backend/cell_crud.js +7 -5
  35. package/dist/testing/cross_backend/identity_parity.js +2 -2
  36. package/dist/testing/cross_backend/standard.d.ts +3 -2
  37. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  38. package/dist/testing/daemon_info.d.ts +7 -2
  39. package/dist/testing/daemon_info.d.ts.map +1 -1
  40. package/dist/testing/daemon_info.js +8 -3
  41. package/dist/testing/data_exposure.d.ts +43 -9
  42. package/dist/testing/data_exposure.d.ts.map +1 -1
  43. package/dist/testing/data_exposure.js +151 -35
  44. package/dist/testing/schema_generators.d.ts +21 -9
  45. package/dist/testing/schema_generators.d.ts.map +1 -1
  46. package/dist/testing/schema_generators.js +52 -47
  47. package/package.json +3 -3
@@ -281,7 +281,7 @@ Pipeline (401 → authz → 403 → 429 → 400 → handler):
281
281
  2. Authorization phase — `apply_authorization_phase` against `account_id` + `read_acting(auth, raw_params)`, which takes the selector off the raw params (malformed reads as omitted) since validation runs later. Test escape hatch via `preset.request_context`
282
282
  3. Post-authorization auth (403) — credential-type gate, then token scope, then role
283
283
  4. Rate limit (429) — throttle-requests semantics, ahead of validation so malformed params charge the budget and a throttled caller pays no schema work
284
- 5. Validate params (400) — first, object params holding an own `__proto__` key at any depth are refused on every input with `data.reason` `params_proto_key` (`json_has_own_proto_key` in `http/schema_helpers.ts`, an iterative walk; `ERROR_PARAMS_PROTO_KEY`; the Rust twin walks after its params-shape check, so a non-object `params` stays the schema's reasonless refusal); then `spec.input.safeParse` with `z.void()` / `?? {}` rules; a `z.void()` input reads absent, `null` (GET `?params=null`), and `{}` alike as the no-arg call (`to_input_params` in `http/schema_helpers.ts`, via `to_void_params`, the twin of the Rust `require_void_params`; the peer receive path in `ActionDispatcher` runs the same normalizer) and refuses any other shape. A refusal is `to_invalid_params_error`: the generic `invalid params`, `data.reason` when the first issue's field declares an `invalid_reason` in its `.meta()` and no issue sits on the input itself, such as an unknown key (`resolve_issues_invalid_reason`, `schema_meta.ts` — see ../../../docs/architecture.md §Error Schema System), and the Zod issues DEV-only
284
+ 5. Validate params (400) — first, object params holding an own `__proto__` key at any depth are refused on every input with `data.reason` `params_proto_key` (`json_has_own_proto_key` in `http/schema_helpers.ts`, an iterative walk; `ERROR_PARAMS_PROTO_KEY`; the Rust twin walks after its params-shape check, so a non-object `params` stays the schema's reasonless refusal); then `spec.input` parses them (`parse_any`, `schema_issues.ts` — a Zod or fuz_schema schema) with `z.void()` / `?? {}` rules; a `z.void()` input reads absent, `null` (GET `?params=null`), and `{}` alike as the no-arg call (`to_input_params` in `http/schema_helpers.ts`, via `to_void_params`, the twin of the Rust `require_void_params`; the peer receive path in `ActionDispatcher` runs the same normalizer) and refuses any other shape. A refusal is `to_invalid_params_error`: the generic `invalid params`, `data.reason` when the first issue's field declares an `invalid_reason` in its `.meta()` and no issue sits on the input itself, such as an unknown key (`resolve_issues_invalid_reason`, `schema_meta.ts` — see ../../../docs/architecture.md §Error Schema System), and the library's issues DEV-only
285
285
  6. Dispatch + DEV output validation + error normalization — `spec.side_effects` picks transaction vs pool. `ThrownJsonrpcError` preserves code + data; generic throws become `internal_error`
286
286
 
287
287
  `PerformActionInput` carries `auth` (the request's `ResolvedAuth`, `null` for
@@ -1072,7 +1072,7 @@ high-level shapes that span modules:
1072
1072
  - **39-variant discriminated union** — `ActionEventDataUnion<TMethod, TInput, TOutput>` across `kind` + `phase` + `step` (28 for `request_response`, 6 for `remote_notification`, 5 for `local_call`). Narrows `input` / `output` / `error` / `request` / `response` / `notification` / `progress` at each lifecycle point.
1073
1073
  - **Step transitions** — `initial → parsed | failed`, `parsed → handling | failed`, `handling → handled | failed`, `handled`/`failed` terminal. `validate_step_transition(from, to)` throws on illegal moves.
1074
1074
  - **Phase transitions** — chained: `send_request → receive_response`, `receive_request → send_response`; everything else terminal. `validate_phase_transition` enforces.
1075
- - **`ActionEvent.parse()`** — `initial → parsed` via `spec.input.safeParse`. Input validation failures **fail immediately** without routing through an error phase (client-side programming errors, not runtime conditions with handlers); their `invalid_params` `data` is `{validation_errors, reason?}`, `reason` the declared `invalid_reason` the server would answer. Handler errors DO route through `send_error` / `receive_error`. On `receive_response` with error response, transitions to `receive_error` instead of failing; a success response's `result` is validated against `spec.output` (always, not DEV-only — it's inbound data; undeclared keys are dropped rather than refused, so an older client survives an added response field) and `output` becomes the parsed value, or the event moves to `receive_error` with an `internal_error` carrying `data: {reason: ERROR_RESPONSE_OUTPUT_INVALID, validation_errors}` — a remote contract break, deliberately distinct from the `invalid_params` / `validation_error` of bad caller input.
1075
+ - **`ActionEvent.parse()`** — `initial → parsed` via `parse_any(spec.input, …)`. Input validation failures **fail immediately** without routing through an error phase (client-side programming errors, not runtime conditions with handlers); their `invalid_params` `data` is `{validation_errors, reason?}`, `reason` the declared `invalid_reason` the server would answer. Handler errors DO route through `send_error` / `receive_error`. On `receive_response` with error response, transitions to `receive_error` instead of failing; a success response's `result` is validated against `spec.output` (always, not DEV-only — it's inbound data; undeclared keys are dropped rather than refused, so an older client survives an added response field) and `output` becomes the parsed value, or the event moves to `receive_error` with an `internal_error` carrying `data: {reason: ERROR_RESPONSE_OUTPUT_INVALID, validation_errors}` — a remote contract break, deliberately distinct from the `invalid_params` / `validation_error` of bad caller input.
1076
1076
  - **Handler throws** — `ThrownJsonrpcError` keeps code/message/data; any other throw becomes `internal_error` carrying the thrown message. When the error answers a remote caller (`receive_request` / `send_response`), the raw message goes through `dev_only` like the server dispatch core.
1077
1077
  - **Protocol message creation is automatic** — transitioning `parsed → handling` on `send_request` materializes the outgoing `JsonrpcRequest` with a fresh `create_uuid()` id; on `send` (notification) it materializes the `JsonrpcNotification`.
1078
1078
 
@@ -1 +1 @@
1
- {"version":3,"file":"action_event.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_event.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAc,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAiBtF,OAAO,KAAK,EACX,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EAGnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,sBAAsB,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C,QAAQ,EAAE,OAAO,GAAG,IAAI;IAIxC,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAQ1C,YAAY,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAUpD,gBAAgB,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI;CAgMzD;AAGD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EAClE,aAAa,sBAAsB,EACnC,MAAM,eAAe,EACrB,OAAO,OAAO,EACd,gBAAgB,gBAAgB,KAC9B,WAAW,CAAC,OAAO,CAmBrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EAC5E,MAAM,oBAAoB,CAAC,OAAO,CAAC,EACnC,aAAa,sBAAsB,KACjC,WAAW,CAAC,OAAO,CAOrB,CAAC"}
@@ -6,13 +6,13 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { z } from 'zod';
10
9
  import { create_uuid } from '../primitive_schemas.js';
11
10
  import { to_error_message } from '@fuzdev/fuz_util/error.ts';
12
11
  import { create_jsonrpc_request, create_jsonrpc_response, create_jsonrpc_error_response, create_jsonrpc_notification, to_jsonrpc_params, is_jsonrpc_error_response } from '../http/jsonrpc_helpers.js';
13
12
  import { dev_only, jsonrpc_error_messages, to_thrown_jsonrpc_error, UNKNOWN_ERROR_MESSAGE } from '../http/jsonrpc_errors.js';
14
13
  import { safe_parse_dropping_unknown_keys } from '../http/schema_helpers.js';
15
14
  import { resolve_issues_invalid_reason } from '../schema_meta.js';
15
+ import { format_issues, parse_any } from '../schema_issues.js';
16
16
  import { validate_step_transition, validate_phase_transition, should_validate_output, is_action_complete, create_initial_data, get_initial_phase, is_request_response, is_send_request_with_parsed_input, is_notification_send_with_parsed_input } from './action_event_helpers.js';
17
17
  /**
18
18
  * `error.data.reason` on the `internal_error` a client reports when a
@@ -26,8 +26,8 @@ export const ERROR_RESPONSE_OUTPUT_INVALID = 'response_output_invalid';
26
26
  * answer the same input with, so a caller matching `data.reason` reads one
27
27
  * value whichever side refused.
28
28
  */
29
- const to_local_invalid_params_data = (input, issues) => {
30
- const reason = resolve_issues_invalid_reason(input, issues);
29
+ const to_local_invalid_params_data = (input, issues, value) => {
30
+ const reason = resolve_issues_invalid_reason(input, issues, value);
31
31
  return reason === undefined
32
32
  ? { validation_errors: issues }
33
33
  : { validation_errors: issues, reason };
@@ -123,11 +123,11 @@ export class ActionEvent {
123
123
  // Input was already validated in the predecessor phase.
124
124
  if (this.#data.phase === 'receive_response') {
125
125
  const parsed = safe_parse_dropping_unknown_keys(this.spec.output, this.#data.output);
126
- if (parsed.success) {
127
- this.#transition_step('parsed', { output: parsed.data });
126
+ if (parsed.ok) {
127
+ this.#transition_step('parsed', { output: parsed.value });
128
128
  }
129
129
  else {
130
- this.#transition_to_error_phase('receive_error', jsonrpc_error_messages.internal_error(`response failed output validation for ${this.spec.method}: ${z.prettifyError(parsed.error)}`, { reason: ERROR_RESPONSE_OUTPUT_INVALID, validation_errors: parsed.error.issues }));
130
+ this.#transition_to_error_phase('receive_error', jsonrpc_error_messages.internal_error(`response failed output validation for ${this.spec.method}: ${format_issues(parsed.issues)}`, { reason: ERROR_RESPONSE_OUTPUT_INVALID, validation_errors: parsed.issues }));
131
131
  }
132
132
  return this;
133
133
  }
@@ -137,9 +137,9 @@ export class ActionEvent {
137
137
  return this;
138
138
  }
139
139
  }
140
- const parsed = this.spec.input.safeParse(this.#data.input);
141
- if (parsed.success) {
142
- this.#transition_step('parsed', { input: parsed.data });
140
+ const parsed = parse_any(this.spec.input, this.#data.input);
141
+ if (parsed.ok) {
142
+ this.#transition_step('parsed', { input: parsed.value });
143
143
  }
144
144
  else {
145
145
  // Input validation errors fail immediately without transitioning to error phases.
@@ -148,7 +148,7 @@ export class ActionEvent {
148
148
  // Handler errors (network, server, business logic) DO transition to error phases.
149
149
  this.#fail(
150
150
  // no need to protect this info
151
- jsonrpc_error_messages.invalid_params(`failed to parse input: ${z.prettifyError(parsed.error)}`, to_local_invalid_params_data(this.spec.input, parsed.error.issues)));
151
+ jsonrpc_error_messages.invalid_params(`failed to parse input: ${format_issues(parsed.issues)}`, to_local_invalid_params_data(this.spec.input, parsed.issues, this.#data.input)));
152
152
  }
153
153
  return this;
154
154
  }
@@ -370,12 +370,12 @@ export class ActionEvent {
370
370
  }
371
371
  #complete_handling(output) {
372
372
  if (output !== undefined && should_validate_output(this.spec.kind, this.#data.phase)) {
373
- const parsed = this.spec.output.safeParse(output);
374
- if (parsed.success) {
375
- this.#transition_step('handled', { output: parsed.data });
373
+ const parsed = parse_any(this.spec.output, output);
374
+ if (parsed.ok) {
375
+ this.#transition_step('handled', { output: parsed.value });
376
376
  }
377
377
  else {
378
- this.#fail(jsonrpc_error_messages.validation_error(`failed to parse output: ${z.prettifyError(parsed.error)}`, { output, validation_errors: parsed.error.issues }));
378
+ this.#fail(jsonrpc_error_messages.validation_error(`failed to parse output: ${format_issues(parsed.issues)}`, { output, validation_errors: parsed.issues }));
379
379
  }
380
380
  }
381
381
  else {
@@ -157,13 +157,13 @@ export const peer_ping_handler = async (input, ctx) => {
157
157
  throw peer_request_error_to_jsonrpc(outcome.error);
158
158
  // the reply is remote-authored — a newer client may add fields
159
159
  const parsed = safe_parse_dropping_unknown_keys(PingResponse, outcome.value);
160
- if (!parsed.success) {
160
+ if (!parsed.ok) {
161
161
  throw new ThrownJsonrpcError(JSONRPC_ERROR_CODES.validation_error, 'peer/ping reply failed validation', { reason: REASON_PEER_PING_INVALID_REPLY });
162
162
  }
163
- if (parsed.data.nonce !== nonce) {
163
+ if (parsed.value.nonce !== nonce) {
164
164
  throw new ThrownJsonrpcError(JSONRPC_ERROR_CODES.validation_error, 'peer/ping reply nonce mismatch', { reason: REASON_PEER_PING_NONCE_MISMATCH });
165
165
  }
166
- return parsed.data;
166
+ return parsed.value;
167
167
  };
168
168
  /**
169
169
  * Reusable responder for an inbound *server→client* `peer/ping` request — the
@@ -31,11 +31,11 @@
31
31
  * `__proto__` key at any depth (`json_has_own_proto_key`) are refused
32
32
  * with `data.reason` `params_proto_key` (`ERROR_PARAMS_PROTO_KEY`), on
33
33
  * every input schema, before it runs; then
34
- * `spec.input.safeParse(raw_params)` with
34
+ * `spec.input` parses the params (`parse_any`, Zod or fuz_schema) with
35
35
  * `z.void()` / `?? {}` rules (`to_input_params`). A refusal is the generic
36
36
  * `invalid params`, with `data.reason` when the first issue's field
37
- * declares an `invalid_reason` (`to_invalid_params_error`) and the Zod
38
- * issues under DEV only. Runs **after** the authority gates: a
37
+ * declares an `invalid_reason` (`to_invalid_params_error`) and the
38
+ * library's issues under DEV only. Runs **after** the authority gates: a
39
39
  * 400 describing the action's input shape to a caller those gates
40
40
  * refuse would confirm the method exists and describe how to call it,
41
41
  * to a channel that should have learned nothing. Coarse authority
@@ -61,11 +61,11 @@
61
61
  * @module
62
62
  */
63
63
  import type { Logger } from '@fuzdev/fuz_util/log.ts';
64
- import type { z } from 'zod';
65
64
  import type { Uuid } from '../primitive_schemas.js';
66
65
  import { type RequestContext } from '../auth/request_context.js';
67
66
  import { type ResolvedAuth } from '../auth/resolved_auth.js';
68
67
  import type { Db } from '../db/db.js';
68
+ import { type AnyIssue, type ValidationSchema } from '../schema_issues.js';
69
69
  import { type JsonrpcRequestId, type JsonrpcErrorObject } from '../http/jsonrpc.js';
70
70
  import type { RateLimiter } from '../rate_limiter.js';
71
71
  import type { RpcAction } from './action_types.js';
@@ -77,7 +77,7 @@ import type { RequestClient } from './peer_request.js';
77
77
  export interface PerformActionInput {
78
78
  /** The resolved spec + handler (transport does method lookup). */
79
79
  action: RpcAction;
80
- /** Raw params from the wire envelope (post-`JsonrpcRequest.parse`, pre-`spec.input.safeParse`). */
80
+ /** Raw params from the wire envelope (post-`JsonrpcRequest.parse`, pre-`parse_any(spec.input, …)`). */
81
81
  raw_params: unknown;
82
82
  /** JSON-RPC request id — echoed onto the response. */
83
83
  request_id: JsonrpcRequestId;
@@ -170,14 +170,16 @@ export declare const perform_action: (input: PerformActionInput, deps: PerformAc
170
170
  * The `invalid_params` error an input validation failure answers: the generic
171
171
  * `invalid params` message, `data.reason` when the field the first issue lands
172
172
  * on declares an `invalid_reason` and no issue sits on the input itself
173
- * (`resolve_issues_invalid_reason`), and the Zod issues under DEV only
174
- * (`dev_only`). With no declared reason, production sends no `data` at all.
173
+ * (`resolve_issues_invalid_reason`), and the library's issues under DEV
174
+ * only (`dev_only`). With no declared reason, production sends no `data` at
175
+ * all.
175
176
  *
176
- * @param input - the action's input schema
177
- * @param issues - the failed parse's issues, in Zod's order
177
+ * @param input - the action's input schema, Zod or fuz_schema
178
+ * @param issues - the failed parse's issues, in the library's order
179
+ * @param params - the value that was parsed
178
180
  * @returns the JSON-RPC error object
179
181
  */
180
- export declare const to_invalid_params_error: (input: z.ZodType, issues: ReadonlyArray<z.core.$ZodIssue>) => JsonrpcErrorObject;
182
+ export declare const to_invalid_params_error: (input: ValidationSchema, issues: ReadonlyArray<AnyIssue>, params: unknown) => JsonrpcErrorObject;
181
183
  /**
182
184
  * The credential-type 403 — one builder, so the dispatcher's gate below and a
183
185
  * handler that gates a credential channel on its input (`account_delete`'s
@@ -1 +1 @@
1
- {"version":3,"file":"perform_action.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,K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AQ,mBAAmB,EAC3B,QAAQ,MAAM,EACd,KAAK,MAAM,KACT,sBAkBF,CAAC"}
@@ -31,11 +31,11 @@
31
31
  * `__proto__` key at any depth (`json_has_own_proto_key`) are refused
32
32
  * with `data.reason` `params_proto_key` (`ERROR_PARAMS_PROTO_KEY`), on
33
33
  * every input schema, before it runs; then
34
- * `spec.input.safeParse(raw_params)` with
34
+ * `spec.input` parses the params (`parse_any`, Zod or fuz_schema) with
35
35
  * `z.void()` / `?? {}` rules (`to_input_params`). A refusal is the generic
36
36
  * `invalid params`, with `data.reason` when the first issue's field
37
- * declares an `invalid_reason` (`to_invalid_params_error`) and the Zod
38
- * issues under DEV only. Runs **after** the authority gates: a
37
+ * declares an `invalid_reason` (`to_invalid_params_error`) and the
38
+ * library's issues under DEV only. Runs **after** the authority gates: a
39
39
  * 400 describing the action's input shape to a caller those gates
40
40
  * refuse would confirm the method exists and describe how to call it,
41
41
  * to a channel that should have learned nothing. Coarse authority
@@ -65,6 +65,7 @@ import { apply_authorization_phase, has_any_scoped_role } from '../auth/request_
65
65
  import { resolved_auth_scope, resolved_auth_session_hash } from '../auth/resolved_auth.js';
66
66
  import { is_db_checkout_error } from '../db/db_checkout_error.js';
67
67
  import { resolve_issues_invalid_reason } from '../schema_meta.js';
68
+ import { parse_any } from '../schema_issues.js';
68
69
  import { json_has_own_proto_key, to_input_params } from '../http/schema_helpers.js';
69
70
  import { rate_limit_ip_key } from '../http/ip_canonical.js';
70
71
  import { dispatch_with_post_commit_rollback } from '../http/pending_effects.js';
@@ -184,11 +185,11 @@ export const perform_action = async (input, deps) => {
184
185
  return error_result(jsonrpc_error_messages.invalid_params('invalid params', { reason: ERROR_PARAMS_PROTO_KEY }));
185
186
  }
186
187
  const params = to_input_params(spec.input, raw_params);
187
- const parse_result = spec.input.safeParse(params);
188
- if (!parse_result.success) {
189
- return error_result(to_invalid_params_error(spec.input, parse_result.error.issues));
188
+ const parse_result = parse_any(spec.input, params);
189
+ if (!parse_result.ok) {
190
+ return error_result(to_invalid_params_error(spec.input, parse_result.issues, params));
190
191
  }
191
- const validated_input = parse_result.data;
192
+ const validated_input = parse_result.value;
192
193
  // step 6: dispatch — transaction for mutations, pool for reads.
193
194
  const use_transaction = spec.side_effects;
194
195
  const execute = async (effective_db) => {
@@ -210,9 +211,9 @@ export const perform_action = async (input, deps) => {
210
211
  const output = await handler(validated_input, action_context);
211
212
  // DEV-only output validation — logs on mismatch, never throws.
212
213
  if (DEV) {
213
- const output_result = spec.output.safeParse(output);
214
- if (!output_result.success) {
215
- log.error(`action output schema mismatch: ${spec.method}`, output_result.error.issues);
214
+ const output_result = parse_any(spec.output, output);
215
+ if (!output_result.ok) {
216
+ log.error(`action output schema mismatch: ${spec.method}`, output_result.issues);
216
217
  }
217
218
  }
218
219
  return { kind: 'ok', result: output };
@@ -258,15 +259,17 @@ const thrown_error_result = (err, context, log) => {
258
259
  * The `invalid_params` error an input validation failure answers: the generic
259
260
  * `invalid params` message, `data.reason` when the field the first issue lands
260
261
  * on declares an `invalid_reason` and no issue sits on the input itself
261
- * (`resolve_issues_invalid_reason`), and the Zod issues under DEV only
262
- * (`dev_only`). With no declared reason, production sends no `data` at all.
262
+ * (`resolve_issues_invalid_reason`), and the library's issues under DEV
263
+ * only (`dev_only`). With no declared reason, production sends no `data` at
264
+ * all.
263
265
  *
264
- * @param input - the action's input schema
265
- * @param issues - the failed parse's issues, in Zod's order
266
+ * @param input - the action's input schema, Zod or fuz_schema
267
+ * @param issues - the failed parse's issues, in the library's order
268
+ * @param params - the value that was parsed
266
269
  * @returns the JSON-RPC error object
267
270
  */
268
- export const to_invalid_params_error = (input, issues) => {
269
- const reason = resolve_issues_invalid_reason(input, issues);
271
+ export const to_invalid_params_error = (input, issues, params) => {
272
+ const reason = resolve_issues_invalid_reason(input, issues, params);
270
273
  const issues_data = dev_only({ issues });
271
274
  return jsonrpc_error_messages.invalid_params('invalid params', reason === undefined ? issues_data : { reason, ...issues_data });
272
275
  };
@@ -114,7 +114,8 @@ export type CellCreateVerdict = {
114
114
  * It runs after the manage and root-only gates, so it decides validity, never
115
115
  * authority: throw `jsonrpc_errors.invalid_params` with
116
116
  * `ERROR_CELL_POLICY_INVALID` (or a reason of the consumer's), or a
117
- * `ZodError`, which the handler turns into `invalid_params`. **Omitted
117
+ * `ZodError` or fuz_schema `SchemaError`, which the handler turns into
118
+ * `invalid_params`. **Omitted
118
119
  * refuses every policy** (`ERROR_CELL_POLICY_UNSUPPORTED`, the Rust trait's
119
120
  * default): an authorizer that reads no policy stores none.
120
121
  */
@@ -132,9 +133,10 @@ export interface CellCreateAuthorize {
132
133
  * existing cell's on an update carrying `data` (`kind` is write-once), the
133
134
  * source's for every row a clone writes (on the merged data). It accepts or
134
135
  * throws, never rewrites: the handler stores the caller's `data` as sent, and
135
- * it must not mutate it. A thrown `ZodError` becomes the standard
136
- * `invalid_params` JSON-RPC error so per-kind validation failures surface to
137
- * clients with code -32602 (not -32603 / internal); throw a `JsonrpcError`
136
+ * it must not mutate it. A thrown `ZodError` or fuz_schema `SchemaError`
137
+ * (`parse_or_throw`) becomes the standard `invalid_params` JSON-RPC error so
138
+ * per-kind validation failures surface to clients with code -32602 (not
139
+ * -32603 / internal); throw a `JsonrpcError`
138
140
  * (`jsonrpc_errors.invalid_params` with a reason) to choose the reason. When
139
141
  * omitted, payloads pass through as-is.
140
142
  *
@@ -1 +1 @@
1
- {"version":3,"file":"cell_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/cell_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAIH,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAEN,KAAK,mBAAmB,EAExB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,KAAK,EA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I,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,mBAAmB,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjG;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,mBAAmB;IACnC,SAAS,EAAE,CACV,IAAI,EAAE,mBAAmB,EACzB,KAAK,EAAE,wBAAwB,EAC/B,GAAG,EAAE,aAAa,KACd,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpD,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG;IAChD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACxE,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;CACvC,CAAC;AA+CF,eAAO,MAAM,YAAY,GAAI,KAAK,OAAO,KAAG,QAiB1C,CAAC;AAsDH,2CAA2C;AAC3C,eAAO,MAAM,mBAAmB,GAAI,MAAM,cAAc,KAAG,KAAK,CAAC,SAAS,CAitBzE,CAAC"}
@@ -51,9 +51,9 @@
51
51
  *
52
52
  * @module
53
53
  */
54
- import { z } from 'zod';
55
54
  import { rpc_action } from '../actions/action_types.js';
56
55
  import { jsonrpc_errors, dev_only } from '../http/jsonrpc_errors.js';
56
+ import { is_schema_validation_error } from '../schema_issues.js';
57
57
  import { is_pg_unique_violation } from '../db/pg_error.js';
58
58
  import { has_scoped_role } from './request_context.js';
59
59
  import { ROLE_ADMIN } from './role_schema.js';
@@ -170,10 +170,11 @@ export const create_cell_actions = (deps) => {
170
170
  const { validate_data, authorize_create } = deps;
171
171
  /**
172
172
  * Run the optional `validate_data` deps callback and convert any thrown
173
- * `ZodError` into the standard `invalid_params` JSON-RPC error so per-
174
- * kind validation failures surface to clients with code -32602 (not
175
- * -32603 / internal). The dispatcher only auto-converts ZodError for
176
- * wire-level input schemas; sub-API validation runs inside the handler.
173
+ * `ZodError` or `SchemaError` (`is_schema_validation_error`) into the
174
+ * standard `invalid_params` JSON-RPC error so per-kind validation
175
+ * failures surface to clients with code -32602 (not -32603 / internal).
176
+ * The dispatcher only converts validation failures of wire-level input
177
+ * schemas; sub-API validation runs inside the handler.
177
178
  */
178
179
  const validate_data_or_throw = (kind, data) => {
179
180
  if (validate_data === undefined)
@@ -182,7 +183,7 @@ export const create_cell_actions = (deps) => {
182
183
  validate_data(kind, data);
183
184
  }
184
185
  catch (err) {
185
- if (err instanceof z.ZodError) {
186
+ if (is_schema_validation_error(err)) {
186
187
  throw jsonrpc_errors.invalid_params('cell.data shape validation failed', dev_only({ issues: err.issues }));
187
188
  }
188
189
  throw err;
@@ -191,8 +192,8 @@ export const create_cell_actions = (deps) => {
191
192
  /**
192
193
  * Validate a non-null policy write through the mounted authorizer's
193
194
  * `validate_policy` — `ERROR_CELL_POLICY_UNSUPPORTED` when there is none
194
- * (no authorizer, or one without the member). A thrown `ZodError` becomes
195
- * `invalid_params`, as `validate_data_or_throw` does.
195
+ * (no authorizer, or one without the member). A thrown `ZodError` or
196
+ * `SchemaError` becomes `invalid_params`, as `validate_data_or_throw` does.
196
197
  */
197
198
  const validate_policy_write = (policy) => {
198
199
  if (authorize_create?.validate_policy === undefined)
@@ -201,7 +202,7 @@ export const create_cell_actions = (deps) => {
201
202
  authorize_create.validate_policy(policy);
202
203
  }
203
204
  catch (err) {
204
- if (err instanceof z.ZodError) {
205
+ if (is_schema_validation_error(err)) {
205
206
  throw jsonrpc_errors.invalid_params('cell.policy validation failed', dev_only({ issues: err.issues }));
206
207
  }
207
208
  throw err;
@@ -222,7 +222,7 @@ confirmation.
222
222
 
223
223
  ## Schema Helpers
224
224
 
225
- `http/schema_helpers.ts` is the canonical home for shared Zod introspection
225
+ `http/schema_helpers.ts` is the canonical home for shared schema introspection (Zod, and fuz_schema where a helper takes either)
226
226
  — extracted to break a circular dependency between `http/route_spec.ts`
227
227
  (input validation) and `http/surface.ts` (surface generation).
228
228
 
@@ -233,14 +233,14 @@ only imports and re-uses them for generation logic.
233
233
 
234
234
  Key helpers:
235
235
 
236
- - `is_null_schema(schema)` — `instanceof z.ZodNull` (not parse-null, to avoid false positives from `z.nullable(z.string())`)
237
- - `is_void_schema(schema)` — `instanceof z.ZodVoid`; a `z.void()` input declares a parameterless RPC method
236
+ - `is_null_schema(schema)` — `instanceof z.ZodNull`, or a fuz_schema `literal(null)` (a kind check, not parse-null, to avoid false positives from `z.nullable(z.string())`)
237
+ - `is_void_schema(schema)` — `instanceof z.ZodVoid`; a `z.void()` input declares a parameterless RPC method (false for any fuz_schema schema, which has no void kind)
238
238
  - `to_void_params(raw_params)` — reads absent, `null`, and `{}` params of a `z.void()` input as the no-arg call (`undefined`), passing any other shape through for `z.void()` to refuse — the twin of the Rust spine's `require_void_params`
239
- - `to_input_params(input, raw_params)` — the one params normalizer every receiving end runs before `input.safeParse`: `to_void_params` for a `z.void()` input, else absent/`null` → `{}`; used by both the server dispatch core (`perform_action`) and the peer receive path (`ActionDispatcher`)
239
+ - `to_input_params(input, raw_params)` — the one params normalizer every receiving end runs before the input parse (`parse_any`): `to_void_params` for a `z.void()` input, else absent/`null` → `{}`; used by both the server dispatch core (`perform_action`) and the peer receive path (`ActionDispatcher`)
240
240
  - `json_has_own_proto_key(value)` — whether any object in a parsed JSON value has an own `__proto__` key, by an iterative walk (no recursion — `JSON.parse` nests deeper than the call stack); the dispatcher refuses such params with `ERROR_PARAMS_PROTO_KEY`. Twin of the Rust `fuz_http::json_has_own_proto_key`
241
- - `safe_parse_dropping_unknown_keys(schema, value)` — the forward-compatible read of a remote-authored payload: when every issue is an unrecognized key, strips those keys from a copy and reparses; any other issue still fails. Used for response `result`s (`ActionEvent`) and peer replies (`peer/ping`); matches serde's ignore-unknown-fields default on the Rust spine
242
- - `is_strict_object_schema(schema)` — detects `z.strictObject()` by checking `schema.def.catchall instanceof z.ZodNever`
243
- - `schema_to_surface(schema)` — Zod → JSON Schema, with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise)
241
+ - `safe_parse_dropping_unknown_keys(schema, value)` — the forward-compatible read of a remote-authored payload, Zod or fuz_schema, returning `parse_any`'s `{ok, value}` / `{ok: false, issues}`: while every issue is an unknown key (`unknown_key_targets`), strips them from a copy and reparses — after the first parse that reports unknown keys, one schema-guided pass deletes every key a strict fuz_schema `object` doesn't name anywhere the schema reaches (entries, array items, record values, the `variant` option), as a fuz_schema parse reports at most a hundred issues; a key under a fuz_schema `union` is never stripped (the union fails as one issue of its own), and a later `pipe` stage is stripped only as reported — until nothing is left to strip, capped at `UNKNOWN_KEY_PASSES_MAX` passes (the last failure returned past it); any other issue still fails. A Zod union of strict objects reports the key and is stripped, a fuz_schema `union` reports one issue of its own and is not. Used for response `result`s (`ActionEvent`) and peer replies (`peer/ping`); matches serde's ignore-unknown-fields default on the Rust spine
242
+ - `is_strict_object_schema(schema)` — detects `z.strictObject()` by checking `schema.def.catchall instanceof z.ZodNever`, or a fuz_schema `object` (not `strip_object` / `loose_object`); a fuz_schema `pipe` is read through to its first schema when no stage is a `transform` (so a refined `object` reads strict), while any Zod `ZodPipe` — even `O.pipe(O)` with no transform — reads not strict
243
+ - `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — Zod or fuz_schema → JSON Schema (`z.toJSONSchema` or fuz_schema's `to_json_schema`, by `is_schema`), on the side `io` names (`'output'` by default), with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise). `null` for a null or void schema. A part JSON Schema can't say (an output-side transform, a `z.custom()`, a fuz_schema `check`) is left out or written as `{}` (`unrepresentable: 'any'`) and reported to `on_unrepresentable`; a schema with nothing describable (`{}` from a schema other than `z.unknown()` / `z.any()`) or one an emitter refuses outright throws, prefixed with `source` — so a root-level transform output (`z.unknown().transform(f)` included), `z.custom()` or `z.date()` fails server assembly. It never answers `null` for a failure, which would read as "no input" and drop the schema from every suite that reads the surface
244
244
  - `middleware_applies(mw_path, route_path)` — Hono pattern matching: `'*'`, exact, `'/api/*'` prefix (handles `prefix.slice(0, -1)` so `/api/*` also matches the bare `/api`)
245
245
  - `middleware_spec_applies(spec, route_path)` — the layer runs on the route: its `path` applies and none of its `carve_outs` does; what surface generation merges middleware errors by
246
246
  - `merge_error_schemas(spec, middleware_errors?)` — the three-layer merge described above
@@ -263,7 +263,13 @@ policy invariants.
263
263
 
264
264
  `generate_app_surface(options)` emits a `warning` diagnostic for every
265
265
  input schema that's not strict (unknown keys silently strip under
266
- `z.object()`), runs the three-layer merge per route, derives `is_mutation`
266
+ `z.object()`), writes every schema through `schema_to_surface` — inputs,
267
+ params and query on the input side (what the server accepts, so a
268
+ `Username` transform keeps its bounds and pattern), outputs, error bodies and
269
+ event params on the output side — with an `info` diagnostic (category
270
+ `schema`, `source` naming the route or method and side) for each schema
271
+ part of which is left out or written as `{}`, throws naming the same source for one
272
+ that can't be written, runs the three-layer merge per route, derives `is_mutation`
267
273
  and `transaction` from method/spec, and surfaces RPC methods with their
268
274
  `RouteAuth` directly (same shape on both `ActionSpec.auth` and
269
275
  `RouteSpec.auth`, no translation step).
@@ -11,14 +11,16 @@ import { z } from 'zod';
11
11
  import type { RouteAuth } from './auth_shape.js';
12
12
  import type { RouteMethod } from './route_spec.js';
13
13
  import { type RateLimitKey, type RouteErrorSchemas } from './error_schemas.js';
14
+ import { type ParseAnyResult, type ValidationOutput, type ValidationSchema } from '../schema_issues.js';
14
15
  /**
15
- * Check if a schema is exactly `z.null()`.
16
+ * Check if a schema is exactly `z.null()`, or a `@fuzdev/fuz_schema`
17
+ * `literal(null)`.
16
18
  *
17
- * Uses `instanceof` rather than runtime parsing to avoid false positives
18
- * from `z.nullable(z.string())` or similar schemas that accept null
19
- * but also accept other values.
19
+ * Reads the schema's kind rather than parsing `null`, to avoid false
20
+ * positives from `z.nullable(z.string())` or similar schemas that accept
21
+ * null but also accept other values.
20
22
  */
21
- export declare const is_null_schema: (schema: z.ZodType) => boolean;
23
+ export declare const is_null_schema: (schema: ValidationSchema) => boolean;
22
24
  /**
23
25
  * Check if a schema is exactly `z.void()`.
24
26
  *
@@ -27,7 +29,7 @@ export declare const is_null_schema: (schema: z.ZodType) => boolean;
27
29
  * Structured value), so `z.void()` is the correct schema for "no params"
28
30
  * and the dispatcher maps absent params to `undefined` for these specs.
29
31
  */
30
- export declare const is_void_schema: (schema: z.ZodType) => boolean;
32
+ export declare const is_void_schema: (schema: ValidationSchema) => boolean;
31
33
  /**
32
34
  * Normalize the raw `params` of a `z.void()` input: an absent `params`, an
33
35
  * empty object, and the `null` a GET `?params=null` parses to are all the
@@ -56,7 +58,7 @@ export declare const to_void_params: (raw_params: unknown) => unknown;
56
58
  *
57
59
  * @param input - the action's input schema
58
60
  * @param raw_params - the call's `params` as parsed off the wire
59
- * @returns the value to run `input.safeParse` on
61
+ * @returns the value the input parse (`parse_any`) reads
60
62
  */
61
63
  export declare const to_input_params: (input: z.ZodType, raw_params: unknown) => unknown;
62
64
  /**
@@ -81,43 +83,120 @@ export declare const to_input_params: (input: z.ZodType, raw_params: unknown) =>
81
83
  */
82
84
  export declare const json_has_own_proto_key: (value: unknown) => boolean;
83
85
  /**
84
- * `schema.safeParse(value)`, except that keys the schema doesn't declare are
86
+ * `parse_any(schema, value)`, except that keys the schema doesn't declare are
85
87
  * dropped rather than refused — the forward-compatible read of a payload a
86
- * remote authored.
88
+ * remote authored. Takes a Zod or a `@fuzdev/fuz_schema` schema.
87
89
  *
88
90
  * Output schemas are strict so the server's DEV output validation catches a
89
91
  * handler leaking fields it shouldn't. The receiving side, though, is often
90
92
  * older than the remote it talks to — a deploy lands before open tabs reload
91
93
  * — and a remote that adds a field is making a compatible change. So when
92
- * every issue is an unrecognized key, those keys are stripped from a copy of
93
- * `value` and it's parsed again; any other issue (a wrong type, a missing
94
+ * every issue is an unknown key (`unknown_key_targets`), those keys are
95
+ * stripped from a copy of `value` and it's parsed again, until a parse
96
+ * succeeds or reports anything else; any other issue (a wrong type, a missing
94
97
  * field, `null` where a value is required) still fails. `value` itself is
95
98
  * never mutated. This matches serde's default on the Rust spine, which
96
- * ignores unknown fields. Keys nested in a `z.union` branch surface as a
97
- * union issue and aren't stripped; a `z.discriminatedUnion` reports its
98
- * matched branch's issues directly, so those are.
99
+ * ignores unknown fields.
100
+ *
101
+ * A fuz_schema parse reports at most a hundred issues, so a pass that only
102
+ * deleted the reported keys would take a parse per hundred unknown keys,
103
+ * quadratic in a payload of many. So after the first parse that reports
104
+ * unknown keys, one schema-guided pass deletes every key a strict fuz_schema
105
+ * `object` doesn't name anywhere the schema reaches — object entries, array
106
+ * items, record values, the `variant` option the discriminator picks — and
107
+ * the next parse usually succeeds. A key under a fuz_schema `union` is never
108
+ * stripped: which option will match isn't known, and the union fails as one
109
+ * issue of its own. A later `pipe` stage is stripped only as reported, as the
110
+ * pass reads only a pipe's first schema, so keys a later stage refuses that
111
+ * the first names still go a hundred a parse. A pass that finds
112
+ * nothing to strip ends it, and the passes are capped at
113
+ * `UNKNOWN_KEY_PASSES_MAX` for both libraries, past which the last failure is
114
+ * returned, so the work stays linear in the payload whatever its shape.
115
+ *
116
+ * Unions differ by library. A Zod `z.union` of strict objects reports the
117
+ * unknown key itself (`unrecognized_keys` on the object), so it is stripped,
118
+ * as are a `z.discriminatedUnion`'s matched-branch keys. A fuz_schema `union`
119
+ * reports one issue of its own, so a key inside one is not stripped and the
120
+ * parse fails; a `variant` reports its matched option's issues, so those are.
99
121
  *
100
122
  * Used for a response's `result` (`ActionEvent`) and for a peer's reply to a
101
123
  * server-initiated request (`peer/ping`).
102
124
  *
103
- * @param schema - the declared shape
125
+ * @param schema - the declared shape, Zod or fuz_schema
104
126
  * @param value - the remote-authored payload
105
127
  * @returns the parse result, with undeclared keys dropped on success
106
128
  */
107
- export declare const safe_parse_dropping_unknown_keys: <T extends z.ZodType>(schema: T, value: unknown) => z.ZodSafeParseResult<z.output<T>>;
129
+ export declare const safe_parse_dropping_unknown_keys: <T extends ValidationSchema>(schema: T, value: unknown) => ParseAnyResult<ValidationOutput<T>>;
108
130
  /**
109
- * Check if a schema is a strict object (`z.strictObject()`).
131
+ * The most parses after the first that `safe_parse_dropping_unknown_keys`
132
+ * runs, each after stripping the keys the one before refused.
133
+ */
134
+ export declare const UNKNOWN_KEY_PASSES_MAX = 4;
135
+ /**
136
+ * Check if a schema is a strict object: `z.strictObject()`, or a
137
+ * `@fuzdev/fuz_schema` `object` (which refuses unknown keys, where
138
+ * `strip_object` drops them and `loose_object` keeps them).
110
139
  *
111
- * Strict objects set `catchall` to `ZodNever` to reject unknown keys.
140
+ * Strict Zod objects set `catchall` to `ZodNever` to reject unknown keys.
112
141
  * Regular `z.object()` has `catchall: undefined` (strips unknown keys in Zod 4).
142
+ * A refined strict object reads strict in both libraries: Zod keeps a
143
+ * `.refine()` on the `ZodObject`, and a fuz_schema `pipe` is read through to
144
+ * its first schema when no stage of it is a `transform` (`message`, `flavor`,
145
+ * `brand` and `meta` keep the kind they wrap). A transformed object is not a
146
+ * strict object in either: Zod's is a `ZodPipe`. The two libraries differ on a
147
+ * pipe without a transform: Zod's `O.pipe(O)` is a `ZodPipe` and reads not
148
+ * strict, where fuz_schema's `pipe(F, F)` reads strict through to `F`.
113
149
  */
114
- export declare const is_strict_object_schema: (schema: z.ZodType) => boolean;
150
+ export declare const is_strict_object_schema: (schema: ValidationSchema) => boolean;
151
+ /** Options of `schema_to_surface`. */
152
+ export interface SchemaToSurfaceOptions {
153
+ /**
154
+ * Which side of a parse to describe: `'input'`, what it accepts (a
155
+ * request body, params, query), or `'output'`, what it returns (a
156
+ * response, an error body, a pushed event).
157
+ *
158
+ * @default 'output'
159
+ */
160
+ io?: 'input' | 'output';
161
+ /** Names the schema in a thrown error, e.g. `POST /api/thing input`. */
162
+ source?: string;
163
+ /**
164
+ * Called with the library's message when part of the schema has no JSON
165
+ * Schema form and is left out or written as `{}` there.
166
+ */
167
+ on_unrepresentable?: (message: string) => void;
168
+ }
115
169
  /**
116
- * Convert a Zod schema to a JSON-serializable representation for the surface.
117
- *
118
- * Returns `null` for null schemas, JSON Schema for object schemas.
170
+ * Convert a Zod or `@fuzdev/fuz_schema` schema to its JSON Schema for the
171
+ * surface, with `$schema` and `default` stripped at every depth.
172
+ *
173
+ * Returns `null` for a null schema (`is_null_schema`) and a `z.void()`
174
+ * (`is_void_schema`): no body, no params. Any other schema is written with
175
+ * its library's emitter (`to_json_schema` for fuz_schema, `z.toJSONSchema`
176
+ * for Zod) on the side `options.io` names. A part JSON Schema can't say (a
177
+ * transform on the output side, a `z.custom()`, a fuz_schema `check`) is left
178
+ * out or written as `{}` (a `pipe(string, check(…))` writes as
179
+ * `{type: 'string'}`), and `options.on_unrepresentable` hears the library's
180
+ * message, so the surface describes what it can and records the gap.
181
+ *
182
+ * It never answers `null` for a schema it failed to write, as that would
183
+ * read as "takes no input" and drop the schema out of every suite reading the
184
+ * surface: a schema with no JSON Schema form at all (`{}` where the schema
185
+ * isn't `z.unknown()` or `z.any()`), and one either emitter refuses outright
186
+ * (a fuz_schema entry named like a member of `Object.prototype`, metadata
187
+ * that isn't JSON), throw. So an output whose root is a transform (a Zod
188
+ * `.transform()`, a fuz_schema `pipe(object(…), transform(…))`), a
189
+ * `z.custom()`, or a `z.date()` throws, and since `generate_app_surface`
190
+ * runs at server assembly, a route or action declaring one fails the server
191
+ * at boot. That includes `z.unknown().transform(f)`, though `{}` would
192
+ * describe it: the output side of a transform is unknown, whatever its input.
193
+ *
194
+ * @param schema - the schema to describe, Zod or fuz_schema
195
+ * @param options - the side to describe, the schema's name for errors, and a listener for gaps
196
+ * @returns the JSON Schema, or `null` for a null or void schema
197
+ * @throws Error naming `options.source` when the schema can't be written, or nothing of it can
119
198
  */
120
- export declare const schema_to_surface: (schema: z.ZodType) => unknown;
199
+ export declare const schema_to_surface: (schema: ValidationSchema, options?: SchemaToSurfaceOptions) => unknown;
121
200
  /**
122
201
  * Check if a middleware path pattern applies to a route path.
123
202
  *