@fuzdev/fuz_app 0.168.1 → 0.170.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +17 -19
- package/dist/actions/action_codegen.d.ts +32 -23
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +101 -80
- package/dist/actions/action_event.d.ts +0 -8
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -6
- package/dist/actions/action_event_data.d.ts +18 -18
- package/dist/actions/action_rpc.d.ts +1 -1
- package/dist/actions/action_rpc.js +1 -1
- package/dist/actions/action_spec.d.ts +8 -10
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +1 -1
- package/dist/actions/action_types.d.ts +4 -4
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +2 -2
- package/dist/actions/broadcast_api.d.ts +2 -2
- package/dist/actions/broadcast_api.js +4 -4
- package/dist/actions/compile_action_registry.d.ts +6 -7
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/compile_action_registry.js +8 -9
- package/dist/actions/perform_action.d.ts +6 -6
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +11 -10
- package/dist/actions/socket.svelte.d.ts +1 -1
- package/dist/actions/socket.svelte.js +2 -2
- package/dist/auth/CLAUDE.md +11 -11
- package/dist/auth/account_action_specs.d.ts +11 -11
- package/dist/auth/account_action_specs.js +1 -1
- package/dist/auth/account_route_schema.d.ts +18 -18
- package/dist/auth/account_route_schema.js +1 -1
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/account_schema.d.ts +38 -40
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +7 -8
- package/dist/auth/actor_lookup_action_specs.d.ts +7 -7
- package/dist/auth/actor_lookup_action_specs.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts +6 -6
- package/dist/auth/actor_search_action_specs.js +1 -1
- package/dist/auth/admin_action_specs.d.ts +166 -166
- package/dist/auth/admin_action_specs.js +1 -1
- package/dist/auth/app_settings_schema.d.ts +3 -3
- package/dist/auth/app_settings_schema.d.ts.map +1 -1
- package/dist/auth/app_settings_schema.js +1 -1
- package/dist/auth/audit_emitter.d.ts +6 -7
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +11 -22
- package/dist/auth/audit_log_ddl.d.ts +1 -1
- package/dist/auth/audit_log_ddl.js +1 -1
- package/dist/auth/audit_log_queries.d.ts +0 -13
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +3 -3
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.js +1 -1
- package/dist/auth/audit_log_schema.d.ts +69 -70
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +2 -2
- package/dist/auth/auth_ddl.d.ts +1 -1
- package/dist/auth/auth_ddl.js +1 -1
- package/dist/auth/bootstrap_route_schema.d.ts +4 -4
- package/dist/auth/bootstrap_route_schema.js +1 -1
- package/dist/auth/cell_action_specs.d.ts +466 -466
- package/dist/auth/cell_action_specs.js +1 -1
- package/dist/auth/cell_actions.d.ts +2 -2
- package/dist/auth/cell_actions.js +5 -5
- package/dist/auth/cell_audit_action_specs.d.ts +14 -14
- package/dist/auth/cell_audit_action_specs.js +1 -1
- package/dist/auth/cell_audit_metadata.d.ts +8 -8
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_action_specs.d.ts +55 -55
- package/dist/auth/cell_field_action_specs.js +1 -1
- package/dist/auth/cell_field_audit_metadata.d.ts +4 -4
- package/dist/auth/cell_field_audit_metadata.js +1 -1
- package/dist/auth/cell_grant_action_specs.d.ts +61 -61
- package/dist/auth/cell_grant_action_specs.js +1 -1
- package/dist/auth/cell_grant_audit_metadata.d.ts +10 -10
- package/dist/auth/cell_grant_audit_metadata.js +1 -1
- package/dist/auth/cell_item_action_specs.d.ts +76 -76
- package/dist/auth/cell_item_action_specs.js +1 -1
- package/dist/auth/cell_item_audit_metadata.d.ts +5 -5
- package/dist/auth/cell_item_audit_metadata.js +1 -1
- package/dist/auth/invite_schema.d.ts +11 -11
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +1 -1
- package/dist/auth/name_schema.js +1 -1
- package/dist/auth/password.js +1 -1
- package/dist/auth/request_context.js +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts +182 -182
- package/dist/auth/role_grant_offer_action_specs.js +1 -1
- package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
- package/dist/auth/role_grant_offer_ddl.js +1 -1
- package/dist/auth/role_grant_offer_notifications.d.ts +107 -107
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +3 -4
- package/dist/auth/role_grant_offer_schema.d.ts +9 -9
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/self_service_role_action_specs.d.ts +2 -2
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/signup_route_schema.d.ts +2 -2
- package/dist/auth/signup_route_schema.js +1 -1
- package/dist/auth/token_scope.d.ts +8 -8
- package/dist/db/file_fact_url.d.ts +1 -1
- package/dist/env/env_schemas.d.ts +1 -2
- package/dist/env/env_schemas.d.ts.map +1 -1
- package/dist/env/env_schemas.js +3 -4
- package/dist/http/CLAUDE.md +30 -32
- package/dist/http/auth_shape.d.ts +17 -52
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +19 -61
- package/dist/http/db_routes.d.ts +1 -1
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +1 -1
- package/dist/http/error_schemas.d.ts +36 -36
- package/dist/http/jsonrpc.d.ts +11 -11
- package/dist/http/jsonrpc_helpers.js +1 -1
- package/dist/http/route_error_check.d.ts +2 -2
- package/dist/http/route_error_check.d.ts.map +1 -1
- package/dist/http/route_error_check.js +2 -3
- package/dist/http/route_errors.d.ts +4 -4
- package/dist/http/route_errors.d.ts.map +1 -1
- package/dist/http/route_errors.js +0 -13
- package/dist/http/route_spec.d.ts +33 -36
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +21 -22
- package/dist/http/schema_helpers.d.ts +75 -67
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +54 -76
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +6 -8
- package/dist/primitive_schemas.d.ts +162 -112
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +129 -161
- package/dist/realtime/sse.d.ts +3 -3
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +2 -2
- package/dist/schema_issues.d.ts +41 -146
- package/dist/schema_issues.d.ts.map +1 -1
- package/dist/schema_issues.js +39 -322
- package/dist/schema_meta.d.ts +63 -136
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +37 -184
- package/dist/sensitivity.d.ts +3 -5
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -5
- package/dist/server/serve_fact_route.js +1 -1
- package/dist/server/surface_route.js +1 -1
- package/dist/testing/CLAUDE.md +23 -25
- package/dist/testing/adversarial_headers.js +2 -2
- package/dist/testing/adversarial_input_cases.d.ts +19 -18
- package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
- package/dist/testing/adversarial_input_cases.js +29 -42
- package/dist/testing/assertions.d.ts +2 -2
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +3 -3
- package/dist/testing/cross_backend/account_lifecycle.js +2 -2
- package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +4 -3
- package/dist/testing/cross_backend/cell_crud.js +1 -1
- package/dist/testing/cross_backend/conformance_case.d.ts +96 -114
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_case.js +0 -256
- package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
- package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +3 -3
- package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
- package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
- package/dist/testing/cross_backend/cross_rpc.js +4 -4
- package/dist/testing/cross_backend/differential.js +2 -2
- package/dist/testing/cross_backend/fact_serving.js +1 -1
- package/dist/testing/cross_backend/identity_parity.js +9 -9
- package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
- package/dist/testing/cross_backend/query_shape.js +1 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts +26 -4
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +7 -8
- package/dist/testing/cross_backend/sse_round_trip.js +2 -2
- package/dist/testing/cross_backend/testing_origin_check.d.ts +12 -12
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +608 -201
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +46 -55
- package/dist/testing/cross_backend/token_lifetime.js +3 -3
- package/dist/testing/cross_backend/wire_shapes.js +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +35 -0
- package/dist/testing/cross_backend/ws_round_trip.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +1 -1
- package/dist/testing/integration.js +2 -2
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -2
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +2 -2
- package/dist/testing/rpc_attack_surface.js +1 -1
- package/dist/testing/rpc_envelope_cases.d.ts +3 -3
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +1 -1
- package/dist/testing/rpc_helpers.d.ts +12 -14
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +9 -11
- package/dist/testing/schema_generators.d.ts +67 -60
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +144 -151
- package/dist/testing/schema_introspect.d.ts +438 -78
- package/dist/testing/schema_introspect.d.ts.map +1 -1
- package/dist/testing/schema_introspect.js +26 -26
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/surface_invariants.d.ts +1 -1
- package/dist/testing/surface_invariants.js +1 -1
- package/dist/testing/transports/bootstrap.d.ts +1 -1
- package/dist/testing/transports/bootstrap.d.ts.map +1 -1
- package/dist/testing/transports/bootstrap.js +1 -1
- package/dist/ui/BootstrapForm.svelte +1 -2
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +1 -2
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +5 -5
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/form_state.svelte.d.ts +1 -1
- package/dist/ui/form_state.svelte.js +1 -1
- package/dist/ui/role_grant_offers_state.svelte.d.ts +1 -1
- package/package.json +7 -9
- package/dist/primitive_schemas_fuz.d.ts +0 -178
- package/dist/primitive_schemas_fuz.d.ts.map +0 -1
- package/dist/primitive_schemas_fuz.js +0 -149
- package/dist/zod.d.ts +0 -101
- package/dist/zod.d.ts.map +0 -1
- package/dist/zod.js +0 -195
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -255,7 +255,7 @@ middleware never sets `TEST_CONTEXT_PRESET_KEY`, and only the symbol counts
|
|
|
255
255
|
### `schema_introspect.ts` — `query_schema_snapshot`
|
|
256
256
|
|
|
257
257
|
- `query_schema_snapshot(db, options?)` — introspects a live DB into a deterministic `SchemaSnapshot` via `pg_catalog` + `information_schema`. Throws on pglet when the snapshot holds an index, unless `accept_pglet_index_definitions` is passed: pglet's `indexdef` omits index modifiers, so its index definitions read as false differences against PostgreSQL and false agreement between two pglet schemas. Captures tables, columns (with `udt_name` to distinguish int4/int8), indexes (`indexdef`), constraints (`pg_get_constraintdef`), sequences, and enum types (`pg_enum` labels in declared `enumsortorder`, so a `cell_visibility` label-set/order drift is gated). The `schema_version` migration tracker is always excluded — it's framework bookkeeping, not domain schema; twin impls keep it identical (same namespaces, names and partitioning), which `query_migration_tracker` + `assert_migration_trackers_equal` gate separately. Twinned by `fuz_db::query_schema_snapshot` (Rust); the `_testing_schema_snapshot` RPC's wire validator is the shared `SchemaSnapshot`, so the enum field must serialize on both sides.
|
|
258
|
-
- `SchemaSnapshot` — the
|
|
258
|
+
- `SchemaSnapshot` — the schema is canonical (a fuz_schema `strip_object`, co-located in `schema_introspect.ts` with its parts; the cross-impl `_testing_schema_snapshot` RPC action reuses it as its wire validator, and the type is `Infer`'d from it). Fully JSON-serializable; every collection deterministically sorted on capture so structural equality is stable across runs.
|
|
259
259
|
- `query_migration_tracker(db)` / `MigrationTracker` — the migration-_identity_ twin of the snapshot: reads the `schema_version` tracker rows (`[{namespace, name, sequence}]`) the snapshot deliberately _excludes_. `MigrationTracker` is the `_testing_migration_tracker` RPC's wire validator; pairs with `assert_migration_trackers_equal` to gate that the two spines record byte-identical migration identity (the swap-freely invariant), catching a migration-name or namespace-partitioning drift the provenance-agnostic schema snapshot can't see.
|
|
260
260
|
|
|
261
261
|
### `schema_parity.ts` — `assert_schema_snapshots_equal`
|
|
@@ -276,10 +276,10 @@ spine and the Rust `testing_spine_stub` mount the same method set with the same
|
|
|
276
276
|
per-method auth shape.
|
|
277
277
|
|
|
278
278
|
- `cross_backend/action_manifest.ts` — `ActionManifest` / `ActionManifestEntry`
|
|
279
|
-
|
|
279
|
+
fuz_schema schema (the `_testing_action_manifest` wire validator) + `build_action_manifest(specs)`,
|
|
280
280
|
which normalizes each spec to `{method, input, side_effects, account, actor, roles,
|
|
281
|
-
credential_types, rate_limit}` (`input` is `'void'` for
|
|
282
|
-
|
|
281
|
+
credential_types, rate_limit}` (`input` is `'void'` for an `s.void` input, by
|
|
282
|
+
`is_void_schema`, else `'object'` — the Rust
|
|
283
283
|
`InputShape`; auth axes pass through; `roles` /
|
|
284
284
|
`credential_types` flatten to sorted arrays; `rate_limit` is the declared
|
|
285
285
|
class or an explicit `null`, so a missing key reads as drift rather than a
|
|
@@ -419,7 +419,7 @@ or Postgres and runs in the `cross-ts` CI job.
|
|
|
419
419
|
- `assert_only_expected_public_routes(surface, list)` — bidirectional: no unexpected public routes, no missing expected ones. Format: `['GET /health', 'POST /api/account/login']`.
|
|
420
420
|
- `assert_full_middleware_stack(surface, prefix, mws)` — every route under `prefix` has exactly `mws` as its middleware chain, less each layer that carves it out (a layer whose `path` and one of whose `carve_outs` apply to the route, `middleware_carves_out`, with no other layer of its name running there) — the rule `applicable_middleware` and the route error map read. A route missing a layer no carve-out explains fails, and so does a carved-out route still listing it.
|
|
421
421
|
- `get_route_error_schema(lookup, route, status)` — reads the route's error map (`lookup` is `AppSurfaceSpec.route_error_maps`) at a status, a fuz_schema schema.
|
|
422
|
-
- `assert_error_schema_valid(lookup, route, status, body)` — assert the route declares the status, and the body parses against the status's schema (`
|
|
422
|
+
- `assert_error_schema_valid(lookup, route, status, body)` — assert the route declares the status, and the body parses against the status's schema (`parse`), a union of its definitions' `literal(code)` bodies, so a code the route doesn't declare at the status fails the parse; a mismatch throws an `Error` carrying the issues. Every adversarial refusal runs through it.
|
|
423
423
|
- `assert_error_response_declared(errors, jsonrpc, response, label)` — a JSON error response (400 and up) is one the route's map declares, by `check_route_error` (the DEV error check's rule: 500 `internal_error` / 503 `service_unavailable` always accepted, a JSON-RPC envelope on a `jsonrpc` route skipped, a success or non-JSON response passing); what the attack-surface suite's `correct auth passes guard` holds each answer to.
|
|
424
424
|
|
|
425
425
|
### `surface_invariants.ts` — structural + policy invariants
|
|
@@ -499,20 +499,18 @@ Support functions:
|
|
|
499
499
|
|
|
500
500
|
### `schema_generators.ts` — valid-value generation
|
|
501
501
|
|
|
502
|
-
Walks
|
|
503
|
-
adversarial/round-trip tests.
|
|
504
|
-
(`ValidationSchema`) and parses with `parse_any`; a schema of neither throws,
|
|
505
|
-
naming it.
|
|
502
|
+
Walks `@fuzdev/fuz_schema` schemas to generate valid values for
|
|
503
|
+
adversarial/round-trip tests. A value that is no schema throws, naming it.
|
|
506
504
|
|
|
507
|
-
- `to_object_schema_view(schema, label)` → `ObjectSchemaView` — the fields (`SchemaFieldInfo[]`, from `
|
|
505
|
+
- `to_object_schema_view(schema, label)` → `ObjectSchemaView` — the fields (`SchemaFieldInfo[]`, from `http/schema_helpers.ts`) of an object schema through its wrappers, each `base_type` its innermost kind (an object of any strictness reads `'object'`, `literal(null)` `'null'`, `literal(undefined)` `'void'`, `one_of` `'enum'`, `variant` `'union'`), and each field's schema, throwing on a schema that is no object schema. `to_body_input(input_schema, label)` is the body generators' gate: `null` for a void or null input, else the object view, and a throw for any other input — no body is never silently what an unbuildable input yields.
|
|
508
506
|
|
|
509
|
-
- `to_field_json_schema(field_schema)` — the field's JSON Schema rendered with `io: 'input'`, so a
|
|
507
|
+
- `to_field_json_schema(field_schema)` — the field's JSON Schema rendered with `io: 'input'`, so a field piped through a `transform` (`Username`) yields its input-side bounds and pattern instead of throwing; a `nullable` field's one non-null `anyOf` branch (or one non-null `type` of a `type` array) is returned. It renders with `unrepresentable: 'any'`, so it is never `null`: a part JSON Schema can't say (a `check`) is left out or `{}` and the bounds around it still read; it throws on a schema the emitter refuses even then. A pipe yields its input stage only, and a `check` never appears (a code-point length bound generates nothing). Every JSON Schema read in the generators goes through it.
|
|
510
508
|
- `detect_format(field_schema)` — `detect_json_schema_format` over `to_field_json_schema`: the `format`, `'pattern'` for a regex, or `null`.
|
|
511
509
|
- `generate_valid_value(field, field_schema)` — base-type switch producing a valid sample (UUIDs → nil UUID, strings → `'xxxxxxxxxx'`, numbers → `1`, objects → `generate_valid_object` against the field schema, so a nested refinement is satisfied too, enums → first entry, records → `{}`, a void field → `undefined`, etc.). For branded-string refinements, walks a fallback chain synthesized from the `pattern` string the JSON Schema representation exposes: fixed-length hex (`^[0-9a-f]{N}$` — blake3 / sha256 / md5 digests; `0`.repeat(N)), prefix-lengthed slug (`^<prefix>_[A-Za-z0-9_-]{N}$` — `ApiTokenId`-style ids; `<prefix>_` + `x`.repeat(N)), absolute path prefix, URL prefix, two `/`-joined segments (an `owner/name` slug). First candidate the field accepts is used.
|
|
512
|
-
- `generate_valid_string_param(field, field_schema)` — a string a URL-sourced field (route param, query value) accepts: the nil UUID for a UUID field, else the first of `test_value`, the generated valid value as a string, `1`, `0`, `true`, `false`, the field's JSON Schema `default` or lower bound as a string (a
|
|
510
|
+
- `generate_valid_string_param(field, field_schema)` — a string a URL-sourced field (route param, query value) accepts: the nil UUID for a UUID field, else the first of `test_value`, the generated valid value as a string, `1`, `0`, `true`, `false`, the field's JSON Schema `default` or lower bound as a string, each `min_value` / `max_value` bound anywhere in the schema as an integer (a string parsed into an integer whose range excludes the small candidates, as `db_routes`' `query_int` — bounds past a `transform`, which JSON Schema can't say) and a synthesized string the field accepts; `null` when none does. The params and query case generators build their base from it.
|
|
513
511
|
- `resolve_valid_path(path, params_schema?, param_values?)` — swaps each whole param segment (`:name`, `:name{re}`, optional or not, read as Hono reads a template: `split_route_template` / `parse_route_param`) for a value the params schema accepts; a `:` inside a literal segment (`files:upload`) stays. Prefers `test_<name>` wherever the field schema admits it (the param name keeps failure messages readable); otherwise a UUID param takes the nil UUID and anything else is synthesized from the schema, percent-encoded. A synthesized value containing `/` is refused (it would route elsewhere) and falls back to `test_<name>`. A value in `param_values` (the route's entry of `RouteParamValues`, `'METHOD /path'` → param name → value, the option the path-resolving suites take) comes first, percent-encoded like the rest. A `:name{re}` param's value, supplied or generated, must match its pattern grouped and anchored, `^(?:re)$` (`compile_route_param_pattern`, over the value as Hono decodes it, `decode_route_path`) — Hono's RegExpRouter reading, the stricter of its routers', as TrieRouter leaves a top-level alternation ungrouped — else it throws naming the route and the param and pointing at `param_values`: no value is guessed from the pattern, and no route is skipped silently. A `param_values` entry naming no param of the path throws too, and so does a supplied `''`, `.` or `..` (the URL normalizes it away) or a lone surrogate. Supplied values are always encoded, so a `{re}` needing a literal `/` can't be met by one.
|
|
514
512
|
- `to_route_content_type(route)` — the `Content-Type` a well-formed request to the route sends: `application/json`, or `application/octet-stream` for a `raw_body` route. Every `POST` route refuses anything else with 415 before its other gates, so every probe in the harnesses (auth, params and query fuzz, 404, data exposure, round trip) sends it, body or not.
|
|
515
|
-
- `generate_valid_object(object_schema, schema) => {value, result}` — required and defaulted fields; when `schema` (refinements included) refuses those, each optional field alone in declaration order, the first that parses; failing that, the optional fields added cumulatively until it parses. Covers a
|
|
513
|
+
- `generate_valid_object(object_schema, schema) => {value, result}` — required and defaulted fields; when `schema` (refinements included) refuses those, each optional field alone in declaration order, the first that parses; failing that, the optional fields added cumulatively until it parses. Covers a `check` over optional fields (at least one of, exactly one of, both of) at any depth, and, where one optional field suffices, keeps the others (an `acting` declared first) out. Returns the last `parse` result (`GeneratedObject`) and leaves the throw to the caller, which renders its issues with `format_issues` (`schema_issues.ts`).
|
|
516
514
|
- `generate_valid_object_with_field(object_schema, schema, base, field)` — a valid object carrying `field`, built from the valid `base`: `base` itself when it carries the field; else the field joins `base`, with the optional fields `base` omits filled as `generate_valid_object` fills them (a pair rule: `scope_kind` needs `scope_id`); failing that, the field replaces `base`'s optional fields, refilled around it (exactly one of: adding `slug` drops `id`). `null` when no object the generator builds carries the field. The body a single-fault case on a field the base omits changes.
|
|
517
515
|
- `generate_valid_body(input_schema) => Record<string, unknown> | undefined` — builds a body satisfying the input schema (`generate_valid_object`); `undefined` for a void or null input. Throws for an input that is no object, void or null schema (`to_body_input`), and with the parse's issues if the generated body fails validation — surfaces broken generation logic with a descriptive error rather than a confusing 400 downstream.
|
|
518
516
|
|
|
@@ -570,7 +568,7 @@ accepts (`assert_error_schema_valid`).
|
|
|
570
568
|
The generators live in the hono-free `adversarial_input_cases.ts`, so the
|
|
571
569
|
cross-process suites reuse them:
|
|
572
570
|
|
|
573
|
-
- `generate_input_test_cases(input_schema, options?)` → `InputTestCase[]` — whole-body structural (non-object, extra key when the input refuses unknown keys — a
|
|
571
|
+
- `generate_input_test_cases(input_schema, options?)` → `InputTestCase[]` — whole-body structural (non-object, extra key when the input refuses unknown keys — a fuz_schema `object`), missing required fields, one wrong-type per field, null for required non-nullable, one format violation per constrained field, and boundary cases read from the field's input-side JSON Schema (`to_field_json_schema` — through a transform or pipe, and under a nullable's `anyOf`): the empty string, one under `minLength` (above one; a prefix of the valid value) and one over `maxLength`; below `minimum`, above `maximum`, zero and negative for a positive-only field, and a non-integer for an integer field (half a step from the valid value, inside the range); the empty array, one under `minItems` (above one; the valid value's own items) and one over `maxItems`. A per-field case is emitted only when the field refuses its value (a field whose transform accepts the wrong type, a pattern admitting the violation string, a preprocess that repairs the value: dropped), so no generated case is accidentally valid. Each per-field case is single-fault — valid but for the field it breaks: it changes one field of a valid base (`generate_valid_object`'s, or `options.base` (`InputTestCaseOptions`) for an input whose valid shape the generator can't reach), or, for a field that base omits, of the body `generate_valid_object_with_field` builds around it, so a case can't also break an object-level rule. A field no valid body carries keeps its wrong-type and null cases on the base and gets no format or boundary cases. Either base failing the schema throws, naming `options.label` (the method or route) when given. A per-field case names the field it breaks (`InputTestCase.field`; absent on the whole-body cases). A void or null input gets no cases; any other input that is no object schema throws (`to_body_input`).
|
|
574
572
|
- `expected_invalid_reason(input_schema, test_case)` → `string | undefined` — the `data.reason` an RPC refusal of the case owes: the broken field's `invalid_reason` (`schema_meta.ts`), resolved by the same `resolve_invalid_reason` the dispatcher resolves through, or none for an undeclared field or a whole-body case.
|
|
575
573
|
- `generate_params_test_cases(params_schema)` → `ParamsTestCase[]` — format violations only (unconstrained string params accept anything), each one the field refuses.
|
|
576
574
|
- `generate_query_test_cases(query_schema)` → `QueryTestCase[]` — missing required fields the field refuses to go without (a preprocessed field with a default accepts its absence) + format violations the field refuses.
|
|
@@ -783,7 +781,7 @@ waiter on timeout so the `waiters` array doesn't grow.
|
|
|
783
781
|
Six tests in two top-level groups:
|
|
784
782
|
|
|
785
783
|
1. **schema-level** (3 tests, no DB) — walks JSON Schema representations:
|
|
786
|
-
- `no sensitive fields in any output schema` — `sensitive_field_blocklist`, over every route, RPC method and WS method output, and the params the server pushes over WS (a `remote_notification`'s payload, whose `output` is `
|
|
784
|
+
- `no sensitive fields in any output schema` — `sensitive_field_blocklist`, over every route, RPC method and WS method output, and the params the server pushes over WS (a `remote_notification`'s payload, whose `output` is `s.void`, and the request of a `request_response` with `initiator` `'backend'` or `'both'`)
|
|
787
785
|
- `no admin-only fields in non-admin output schemas` — `admin_only_field_blocklist`, over the route outputs a non-admin reaches; routes only, since the blocklist matches by name and domain RPC/WS outputs carry `created_by`/`updated_by` legitimately. Admin-gated means every role in an any-of `roles` (or a WS endpoint's `required_roles`) is `admin` or `keeper`, or the daemon token is required
|
|
788
786
|
- `no sensitive fields in any error schema`
|
|
789
787
|
2. **runtime** (3 tests, DB-backed via `create_test_app`):
|
|
@@ -794,7 +792,7 @@ Six tests in two top-level groups:
|
|
|
794
792
|
Support functions: `collect_json_schema_property_names(schema)` (walks
|
|
795
793
|
`properties`/`patternProperties`/`additionalProperties`/`items`/`prefixItems`/`contains`,
|
|
796
794
|
`allOf`/`anyOf`/`oneOf`/`not`/`if`/`then`/`else`, and `$defs`/`definitions`
|
|
797
|
-
values, where a
|
|
795
|
+
values, where a schema's body may sit behind a `$ref`),
|
|
798
796
|
`assert_output_schemas_no_sensitive_fields(surface_source, fields?, skip_routes?)`,
|
|
799
797
|
`assert_non_admin_schemas_no_admin_fields(surface_source, fields?, skip_routes?)`.
|
|
800
798
|
Both read each output from its spec on both sides (`schema_to_surface`): the
|
|
@@ -1005,7 +1003,7 @@ Request builders:
|
|
|
1005
1003
|
Response assertions:
|
|
1006
1004
|
|
|
1007
1005
|
- `assert_jsonrpc_error_response(body, expected_code?)` — validates `JsonrpcErrorResponse`; optional code check.
|
|
1008
|
-
- `assert_jsonrpc_success_response(body, output_schema?)` — validates `JsonrpcResponse`; optional `output_schema` check on `result
|
|
1006
|
+
- `assert_jsonrpc_success_response(body, output_schema?)` — validates `JsonrpcResponse`; optional `output_schema` check on `result` (`parse`).
|
|
1009
1007
|
|
|
1010
1008
|
One-shot transport:
|
|
1011
1009
|
|
|
@@ -1016,7 +1014,7 @@ One-shot transport:
|
|
|
1016
1014
|
- `RpcCallArgs` — `{app, path, method, params?, params_json?, headers?, id?, verb?}`. `verb` defaults to `'POST'`; use `'GET'` for `side_effects: false` methods. `params_json` sends raw JSON text in place of `params` (exclusive with it) on either verb.
|
|
1017
1015
|
- `rpc_call_raw(args)` — the same request as `rpc_call`, the response unparsed: `RpcCallRawResult` `{status, headers, body}` with the whole envelope. `parse_rpc_call_result(raw, method)` turns it into an `RpcCallResult`; `rpc_call` is the two composed.
|
|
1018
1016
|
- `rpc_call(args)` — merges `RPC_CALL_DEFAULT_HEADERS` (`host: 'localhost'`, `origin: TEST_ORIGIN`, `Content-Type: 'application/json'`) under caller headers. Envelope-shape violations throw; JSON-RPC errors return `{ok: false, error}` so callers assert on `error.code` / `error.data.reason`.
|
|
1019
|
-
- `rpc_call_typed<T>(args, output_schema)` — parses the success `result` through the schema
|
|
1017
|
+
- `rpc_call_typed<T>(args, output_schema)` — parses the success `result` through the schema (`parse`); throws on envelope failure, error response, or schema mismatch. Use `rpc_call` when the test needs to assert on error shapes.
|
|
1020
1018
|
- `rpc_call_for_spec<TSpec>(args)` — spec-bound variant: takes `{..., spec, params}` in place of `{..., method, params}`. `params` is typed from `spec.input` and the success `result` is typed from `spec.output` (runtime-validated, same contract as `rpc_call_typed`). Error branch stays untyped (JSON-RPC `error.data` shapes vary per call site). Use at happy-path + denial-path call sites; fall back to `rpc_call` for adversarial tests that send deliberately-malformed params.
|
|
1021
1019
|
|
|
1022
1020
|
Registry lookups:
|
|
@@ -1444,7 +1442,7 @@ conformance cases assert _expected behavior_ — the security negatives
|
|
|
1444
1442
|
(must be refused / must not leak / found-vs-not-found same shape) a
|
|
1445
1443
|
wire-shape check passes green on even when behavior is wrong.
|
|
1446
1444
|
|
|
1447
|
-
- `conformance_case.ts` — `ConformanceCase`
|
|
1445
|
+
- `conformance_case.ts` — the `ConformanceCase` type (types only; nothing parses a case):
|
|
1448
1446
|
`{name, request: {method, params?, params_json?, as, acting?, verb?}, expect: {status,
|
|
1449
1447
|
error_reason?, fields?, headers?, equivalence_group?}, note?, xfail?}`. A case is **data** — `method`
|
|
1450
1448
|
resolves its `input`/`output` from the live registry (RPC) or `RouteSpec`
|
|
@@ -1947,11 +1945,11 @@ token, no `Origin`).
|
|
|
1947
1945
|
|
|
1948
1946
|
The cell-layer parity coverage is split across two sibling suites. Cells
|
|
1949
1947
|
can't ride the generic `describe_rpc_round_trip_tests` (stateful verbs need a
|
|
1950
|
-
real id threaded across calls; `cell_get` has a top-level
|
|
1948
|
+
real id threaded across calls; `cell_get` has a top-level `check`), so —
|
|
1951
1949
|
like ws/sse — the full cell surface **live-mounts** on the spine RPC path but
|
|
1952
1950
|
stays **off** `create_spine_surface_spec`, and these dedicated suites are the
|
|
1953
1951
|
cell validators (`describe_standard_cross_process_tests`' generic round-trip
|
|
1954
|
-
never sees them). Both parse every success response against the verb's
|
|
1952
|
+
never sees them). Both parse every success response against the verb's
|
|
1955
1953
|
**output** schema, so a TS↔Rust envelope drift fails the suite — not just a
|
|
1956
1954
|
payload-field drift. Call-site primitives (`cross_rpc_call` / `error_reason` /
|
|
1957
1955
|
`expect_output`) live in `cross_backend/cross_rpc.ts`, shared by every
|
|
@@ -1973,7 +1971,7 @@ options shape is `RpcPathCapabilityGatedCrossSuiteOptions` from
|
|
|
1973
1971
|
`cross_backend/setup.ts`. `cross_backend/wire_shapes.ts` carries
|
|
1974
1972
|
`assert_iso8601_seconds` / `assert_iso8601_seconds_nullable` — the byte-level
|
|
1975
1973
|
gate on the canonical second-precision UTC timestamp shape, which a
|
|
1976
|
-
`
|
|
1974
|
+
`string` output schema can't catch (a millisecond stamp parses fine).
|
|
1977
1975
|
The shared suites pin it on the account-status account + role grants, a
|
|
1978
1976
|
session, a minted + listed API token, a cell's `created_at` / `updated_at`,
|
|
1979
1977
|
an audit row, an admin account listing, and an offer's `created_at` /
|
|
@@ -2777,15 +2775,15 @@ round-trip / conformance suites never vary:
|
|
|
2777
2775
|
USERNAME_LENGTH_MAX]` = `[3, 39]` boundary edges (just-outside → 400,
|
|
2778
2776
|
just-inside → 403 no-matching-invite) and the creation regex shape (leading
|
|
2779
2777
|
non-letter / trailing punctuation / embedded disallowed char → 400; mid-string
|
|
2780
|
-
`_`/`-` accepted), catching an off-by-one or position bug in the TS
|
|
2781
|
-
|
|
2778
|
+
`_`/`-` accepted), catching an off-by-one or position bug in the TS
|
|
2779
|
+
`Username` bounds and regex vs the Rust byte-scan `is_valid_username_for_creation`.
|
|
2782
2780
|
- **Email format (creation)** — the optional signup `email` validated to the
|
|
2783
2781
|
loose `local@domain.tld` shape (TS `Email`, `EMAIL_REGEX` + 254-byte
|
|
2784
2782
|
bound, Rust `is_valid_email`): malformed (no `@` / no domain dot / empty
|
|
2785
2783
|
side / dot at a domain edge, beside another dot inside it too / whitespace /
|
|
2786
2784
|
over-length) → 400, well-formed → 403 no-invite. Accepted siblings include
|
|
2787
2785
|
the single-char-TLD `a@b.c` and the consecutive dots inside a domain that
|
|
2788
|
-
|
|
2786
|
+
a stricter email grammar rejects — the deliberately-looser shared rule. **Closed a
|
|
2789
2787
|
real divergence**: the Rust spine previously length-checked the email only,
|
|
2790
2788
|
accepting any non-empty string TS rejected.
|
|
2791
2789
|
- **Malformed JSON body** — an unparseable (`{`) or non-object (`[]`) body typed
|
|
@@ -16,7 +16,7 @@ import './assert_dev_env.js';
|
|
|
16
16
|
* @module
|
|
17
17
|
*/
|
|
18
18
|
import { test, assert, describe } from 'vitest';
|
|
19
|
-
import {
|
|
19
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
20
20
|
import { REST_FORBIDDEN_ORIGIN } from '../http/error_schemas.js';
|
|
21
21
|
import { create_test_middleware_stack_app, TEST_MIDDLEWARE_PATH } from './middleware.js';
|
|
22
22
|
import { create_test_raw_api_token } from './entities.js';
|
|
@@ -132,7 +132,7 @@ export const describe_standard_adversarial_headers = (suite_name, options, allow
|
|
|
132
132
|
if (tc.expected_error) {
|
|
133
133
|
assert.strictEqual(body.error, tc.expected_error.code);
|
|
134
134
|
assert.strictEqual(res.status, tc.expected_error.status);
|
|
135
|
-
const parsed =
|
|
135
|
+
const parsed = parse(tc.expected_error.schema, body);
|
|
136
136
|
assert.ok(parsed.ok, `error body fails its schema: ${JSON.stringify(body)}`);
|
|
137
137
|
}
|
|
138
138
|
if (tc.expected_status === 200) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
2
|
import { ERROR_INVALID_REQUEST_BODY, ERROR_INVALID_JSON_BODY } from '../http/error_schemas.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type AnySchema } from '@fuzdev/fuz_schema/schema.ts';
|
|
4
4
|
/** One adversarial body for an input schema, and the error code it owes. */
|
|
5
5
|
export interface InputTestCase {
|
|
6
6
|
label: string;
|
|
@@ -46,13 +46,13 @@ export interface InputTestCaseOptions {
|
|
|
46
46
|
* - Null for required non-nullable fields
|
|
47
47
|
* - One format violation per constrained field
|
|
48
48
|
* - String length (empty, one under `minLength`, one over `maxLength`), numeric
|
|
49
|
-
* (out of range, non-integer
|
|
49
|
+
* (out of range, non-integer) and array-length
|
|
50
50
|
* (empty, one under `minItems`, one over `maxItems`) boundaries
|
|
51
51
|
*
|
|
52
52
|
* Format and boundaries come from the field's input-side JSON Schema
|
|
53
|
-
* (`to_field_json_schema`), so a field carrying a
|
|
54
|
-
*
|
|
55
|
-
*
|
|
53
|
+
* (`to_field_json_schema`), so a field carrying a `transform` in a pipe and a
|
|
54
|
+
* `nullable` field get them too. A bound only a `check` enforces generates
|
|
55
|
+
* nothing — JSON Schema can't express it.
|
|
56
56
|
*
|
|
57
57
|
* Each per-field case is single-fault: valid except for the field it breaks.
|
|
58
58
|
* It changes one field of a valid base body — `options.base` when given, else
|
|
@@ -65,29 +65,30 @@ export interface InputTestCaseOptions {
|
|
|
65
65
|
* emitted only when the field refuses its value, so no case is accidentally
|
|
66
66
|
* valid.
|
|
67
67
|
*
|
|
68
|
-
* A void or null input takes no body and gets no cases;
|
|
69
|
-
*
|
|
68
|
+
* A void or null input takes no body and gets no cases; a value that is no
|
|
69
|
+
* schema, or an input that is no object schema, throws rather than yielding
|
|
70
|
+
* none.
|
|
70
71
|
*
|
|
71
|
-
* @param input_schema - the input schema to attack
|
|
72
|
+
* @param input_schema - the input schema to attack
|
|
72
73
|
* @param options - a base body to seed the cases, and a label for errors
|
|
73
|
-
* @throws Error if the input is
|
|
74
|
+
* @throws Error if the input is no schema or is neither void, null,
|
|
74
75
|
* nor an object schema, or if the base body fails `input_schema` — a seeded
|
|
75
76
|
* base the schema refuses, or a generated one that surfaces broken
|
|
76
77
|
* generation logic — naming the issues rather than producing nonsense
|
|
77
78
|
* adversarial cases.
|
|
78
79
|
*/
|
|
79
|
-
export declare const generate_input_test_cases: (input_schema:
|
|
80
|
+
export declare const generate_input_test_cases: (input_schema: AnySchema, options?: InputTestCaseOptions) => Array<InputTestCase>;
|
|
80
81
|
/**
|
|
81
82
|
* The `error.data.reason` an RPC refusal of `test_case` owes: the declared
|
|
82
83
|
* `invalid_reason` of the field it breaks, resolved as the dispatcher resolves
|
|
83
84
|
* a failure on that field (`resolve_invalid_reason`), or `undefined` — no
|
|
84
85
|
* reason — for an undeclared field or a whole-body case.
|
|
85
86
|
*
|
|
86
|
-
* @param input_schema - the input schema the case was generated from
|
|
87
|
+
* @param input_schema - the input schema the case was generated from
|
|
87
88
|
* @param test_case - a case `generate_input_test_cases` produced from it
|
|
88
89
|
* @returns the owed reason, or `undefined` when the refusal carries none
|
|
89
90
|
*/
|
|
90
|
-
export declare const expected_invalid_reason: (input_schema:
|
|
91
|
+
export declare const expected_invalid_reason: (input_schema: AnySchema, test_case: InputTestCase) => string | undefined;
|
|
91
92
|
/**
|
|
92
93
|
* Generate adversarial test cases for a route's params schema.
|
|
93
94
|
*
|
|
@@ -96,11 +97,11 @@ export declare const expected_invalid_reason: (input_schema: ValidationSchema, t
|
|
|
96
97
|
* params accept any string value, and only a violation the field refuses.
|
|
97
98
|
* Each case breaks one field of a valid params record.
|
|
98
99
|
*
|
|
99
|
-
* @param params_schema - the params schema,
|
|
100
|
+
* @param params_schema - the params schema, an object schema
|
|
100
101
|
* @throws Error if no valid params record can be generated, or `params_schema`
|
|
101
|
-
* is no object schema or
|
|
102
|
+
* is no object schema or no schema
|
|
102
103
|
*/
|
|
103
|
-
export declare const generate_params_test_cases: (params_schema:
|
|
104
|
+
export declare const generate_params_test_cases: (params_schema: AnySchema) => Array<ParamsTestCase>;
|
|
104
105
|
/**
|
|
105
106
|
* Generate adversarial test cases for a route's query schema.
|
|
106
107
|
*
|
|
@@ -111,9 +112,9 @@ export declare const generate_params_test_cases: (params_schema: ValidationSchem
|
|
|
111
112
|
*
|
|
112
113
|
* Each case breaks one field of a valid query record.
|
|
113
114
|
*
|
|
114
|
-
* @param query_schema - the query schema,
|
|
115
|
+
* @param query_schema - the query schema, an object schema
|
|
115
116
|
* @throws Error if no valid query record can be generated, or `query_schema`
|
|
116
|
-
* is no object schema or
|
|
117
|
+
* is no object schema or no schema
|
|
117
118
|
*/
|
|
118
|
-
export declare const generate_query_test_cases: (query_schema:
|
|
119
|
+
export declare const generate_query_test_cases: (query_schema: AnySchema) => Array<QueryTestCase>;
|
|
119
120
|
//# sourceMappingURL=adversarial_input_cases.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversarial_input_cases.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_input_cases.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,
|
|
1
|
+
{"version":3,"file":"adversarial_input_cases.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_input_cases.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAsErE,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,0BAA0B,GAAG,OAAO,uBAAuB,CAAC;CACnF;AAED,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAID,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,yBAAyB,GACrC,cAAc,SAAS,EACvB,UAAU,oBAAoB,KAC5B,KAAK,CAAC,aAAa,CAyMrB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,cAAc,SAAS,EACvB,WAAW,aAAa,KACtB,MAAM,GAAG,SAG+C,CAAC;AAmC5D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,GAAI,eAAe,SAAS,KAAG,KAAK,CAAC,cAAc,CAoBzF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,SAAS,KAAG,KAAK,CAAC,aAAa,CAkCtF,CAAC"}
|
|
@@ -14,10 +14,11 @@ import './assert_dev_env.js';
|
|
|
14
14
|
*/
|
|
15
15
|
import { resolve_invalid_reason } from '../schema_meta.js';
|
|
16
16
|
import { ERROR_INVALID_REQUEST_BODY, ERROR_INVALID_JSON_BODY } from '../http/error_schemas.js';
|
|
17
|
-
import {
|
|
17
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
18
|
+
import { format_issues } from '../schema_issues.js';
|
|
18
19
|
import { detect_format, detect_json_schema_format, generate_valid_object, generate_valid_object_with_field, generate_valid_string_param, to_body_input, to_field_json_schema, to_object_schema_view } from './schema_generators.js';
|
|
19
|
-
/** Whether `schema` accepts `value
|
|
20
|
-
const accepts = (schema, value) =>
|
|
20
|
+
/** Whether `schema` accepts `value`. */
|
|
21
|
+
const accepts = (schema, value) => parse(schema, value).ok;
|
|
21
22
|
// --- Payload generation ---
|
|
22
23
|
/** One wrong-type value per base type — one representative is sufficient. */
|
|
23
24
|
const wrong_type_for = (base_type) => {
|
|
@@ -27,7 +28,6 @@ const wrong_type_for = (base_type) => {
|
|
|
27
28
|
case 'email':
|
|
28
29
|
return { label: 'number instead of string', value: 42 };
|
|
29
30
|
case 'number':
|
|
30
|
-
case 'int':
|
|
31
31
|
return { label: 'string instead of number', value: 'not_a_number' };
|
|
32
32
|
case 'boolean':
|
|
33
33
|
return { label: 'number instead of boolean', value: 42 };
|
|
@@ -58,14 +58,12 @@ const format_violation = (format) => {
|
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
60
|
* `value` moved by `step`, up when that stays inside the field's numeric range
|
|
61
|
-
* and down otherwise — a number off the integer
|
|
62
|
-
*
|
|
61
|
+
* and down otherwise — a number off the integer grid that still meets the
|
|
62
|
+
* range, so the integer check is the one a refusal names.
|
|
63
63
|
*/
|
|
64
64
|
const off_grid_in_range = (json, value, step) => {
|
|
65
65
|
const up = value + step;
|
|
66
|
-
|
|
67
|
-
(typeof json.exclusiveMaximum === 'number' && up >= json.exclusiveMaximum);
|
|
68
|
-
return over ? value - step : up;
|
|
66
|
+
return typeof json.maximum === 'number' && up > json.maximum ? value - step : up;
|
|
69
67
|
};
|
|
70
68
|
/**
|
|
71
69
|
* Generate adversarial test cases for a route's input schema.
|
|
@@ -77,13 +75,13 @@ const off_grid_in_range = (json, value, step) => {
|
|
|
77
75
|
* - Null for required non-nullable fields
|
|
78
76
|
* - One format violation per constrained field
|
|
79
77
|
* - String length (empty, one under `minLength`, one over `maxLength`), numeric
|
|
80
|
-
* (out of range, non-integer
|
|
78
|
+
* (out of range, non-integer) and array-length
|
|
81
79
|
* (empty, one under `minItems`, one over `maxItems`) boundaries
|
|
82
80
|
*
|
|
83
81
|
* Format and boundaries come from the field's input-side JSON Schema
|
|
84
|
-
* (`to_field_json_schema`), so a field carrying a
|
|
85
|
-
*
|
|
86
|
-
*
|
|
82
|
+
* (`to_field_json_schema`), so a field carrying a `transform` in a pipe and a
|
|
83
|
+
* `nullable` field get them too. A bound only a `check` enforces generates
|
|
84
|
+
* nothing — JSON Schema can't express it.
|
|
87
85
|
*
|
|
88
86
|
* Each per-field case is single-fault: valid except for the field it breaks.
|
|
89
87
|
* It changes one field of a valid base body — `options.base` when given, else
|
|
@@ -96,12 +94,13 @@ const off_grid_in_range = (json, value, step) => {
|
|
|
96
94
|
* emitted only when the field refuses its value, so no case is accidentally
|
|
97
95
|
* valid.
|
|
98
96
|
*
|
|
99
|
-
* A void or null input takes no body and gets no cases;
|
|
100
|
-
*
|
|
97
|
+
* A void or null input takes no body and gets no cases; a value that is no
|
|
98
|
+
* schema, or an input that is no object schema, throws rather than yielding
|
|
99
|
+
* none.
|
|
101
100
|
*
|
|
102
|
-
* @param input_schema - the input schema to attack
|
|
101
|
+
* @param input_schema - the input schema to attack
|
|
103
102
|
* @param options - a base body to seed the cases, and a label for errors
|
|
104
|
-
* @throws Error if the input is
|
|
103
|
+
* @throws Error if the input is no schema or is neither void, null,
|
|
105
104
|
* nor an object schema, or if the base body fails `input_schema` — a seeded
|
|
106
105
|
* base the schema refuses, or a generated one that surfaces broken
|
|
107
106
|
* generation logic — naming the issues rather than producing nonsense
|
|
@@ -118,7 +117,7 @@ export const generate_input_test_cases = (input_schema, options) => {
|
|
|
118
117
|
let base;
|
|
119
118
|
if (options?.base) {
|
|
120
119
|
base = { ...options.base };
|
|
121
|
-
const base_result =
|
|
120
|
+
const base_result = parse(input_schema, base);
|
|
122
121
|
if (!base_result.ok) {
|
|
123
122
|
throw new Error(`adversarial_input: the seeded base${for_label} fails validation — ` +
|
|
124
123
|
`fix the base for: ${format_issues(base_result.issues)}`);
|
|
@@ -138,8 +137,8 @@ export const generate_input_test_cases = (input_schema, options) => {
|
|
|
138
137
|
body: [1, 2, 3],
|
|
139
138
|
expected_error: ERROR_INVALID_JSON_BODY
|
|
140
139
|
});
|
|
141
|
-
// whole-body structural: extra unknown key (enforces
|
|
142
|
-
// only emit if the schema rejects unknown keys
|
|
140
|
+
// whole-body structural: extra unknown key (enforces a strict `object`)
|
|
141
|
+
// only emit if the schema rejects unknown keys
|
|
143
142
|
if (!accepts(input_schema, { ...base, __adversarial_extra: 'rejected' })) {
|
|
144
143
|
cases.push({
|
|
145
144
|
label: 'extra unknown key',
|
|
@@ -154,8 +153,8 @@ export const generate_input_test_cases = (input_schema, options) => {
|
|
|
154
153
|
// can't also break an object-level rule (exactly one of, both or neither)
|
|
155
154
|
const field_base = generate_valid_object_with_field(input_schema, input_schema, base, field);
|
|
156
155
|
// every per-field case breaks the field, so the field itself must refuse
|
|
157
|
-
// its value — a candidate it accepts (a
|
|
158
|
-
//
|
|
156
|
+
// its value — a candidate it accepts (a field that coerces a wrong type,
|
|
157
|
+
// a pattern that admits the violation string) is no invalid case.
|
|
159
158
|
// A type case (wrong type, null) on a field no valid body carries falls
|
|
160
159
|
// back to the base; a value case — a format or a bound — is built only on
|
|
161
160
|
// a body that is valid but for the field, or it tests no bound at all
|
|
@@ -228,37 +227,25 @@ export const generate_input_test_cases = (input_schema, options) => {
|
|
|
228
227
|
}
|
|
229
228
|
}
|
|
230
229
|
// numeric boundaries
|
|
231
|
-
if (field.base_type === 'number'
|
|
230
|
+
if (field.base_type === 'number') {
|
|
232
231
|
if (typeof json.minimum === 'number') {
|
|
233
232
|
push_field_case(`below minimum: ${field.name} (${json.minimum - 1})`, json.minimum - 1, 'value');
|
|
234
233
|
}
|
|
235
234
|
if (typeof json.maximum === 'number') {
|
|
236
235
|
push_field_case(`above maximum: ${field.name} (${json.maximum + 1})`, json.maximum + 1, 'value');
|
|
237
236
|
}
|
|
238
|
-
if (typeof json.exclusiveMinimum === 'number') {
|
|
239
|
-
push_field_case(`at exclusive minimum: ${field.name} (${json.exclusiveMinimum})`, json.exclusiveMinimum, 'value');
|
|
240
|
-
}
|
|
241
|
-
if (typeof json.exclusiveMaximum === 'number') {
|
|
242
|
-
push_field_case(`at exclusive maximum: ${field.name} (${json.exclusiveMaximum})`, json.exclusiveMaximum, 'value');
|
|
243
|
-
}
|
|
244
237
|
// 0 and negative for positive-only fields
|
|
245
238
|
if (typeof json.minimum === 'number' && json.minimum > 0) {
|
|
246
239
|
push_field_case(`zero for positive-only: ${field.name}`, 0, 'value');
|
|
247
240
|
push_field_case(`negative for positive-only: ${field.name}`, -1, 'value');
|
|
248
241
|
}
|
|
249
242
|
// off the grid by half a step from the valid value, inside the range,
|
|
250
|
-
// so the integer
|
|
243
|
+
// so the integer check is the one that refuses
|
|
251
244
|
const valid_number = typeof valid_value === 'number' ? valid_value : 1;
|
|
252
245
|
if (json.type === 'integer') {
|
|
253
246
|
const value = off_grid_in_range(json, valid_number, 0.5);
|
|
254
247
|
push_field_case(`non-integer: ${field.name} (${value})`, value, 'value');
|
|
255
248
|
}
|
|
256
|
-
if (typeof json.multipleOf === 'number' && json.multipleOf > 0) {
|
|
257
|
-
// a whole step for an integer field, so the integer check still holds
|
|
258
|
-
const step = json.type === 'integer' && json.multipleOf > 1 ? 1 : json.multipleOf / 2;
|
|
259
|
-
const value = off_grid_in_range(json, valid_number, step);
|
|
260
|
-
push_field_case(`not multipleOf: ${field.name} (${value}, multipleOf ${json.multipleOf})`, value, 'value');
|
|
261
|
-
}
|
|
262
249
|
}
|
|
263
250
|
// array length boundaries
|
|
264
251
|
if (field.base_type === 'array') {
|
|
@@ -287,7 +274,7 @@ export const generate_input_test_cases = (input_schema, options) => {
|
|
|
287
274
|
* a failure on that field (`resolve_invalid_reason`), or `undefined` — no
|
|
288
275
|
* reason — for an undeclared field or a whole-body case.
|
|
289
276
|
*
|
|
290
|
-
* @param input_schema - the input schema the case was generated from
|
|
277
|
+
* @param input_schema - the input schema the case was generated from
|
|
291
278
|
* @param test_case - a case `generate_input_test_cases` produced from it
|
|
292
279
|
* @returns the owed reason, or `undefined` when the refusal carries none
|
|
293
280
|
*/
|
|
@@ -312,7 +299,7 @@ const generate_string_record_base = (schema, view, kind) => {
|
|
|
312
299
|
}
|
|
313
300
|
base[field.name] = value;
|
|
314
301
|
}
|
|
315
|
-
const result =
|
|
302
|
+
const result = parse(schema, base);
|
|
316
303
|
if (!result.ok) {
|
|
317
304
|
throw new Error(`adversarial_input: generated ${kind} base fails validation — ` +
|
|
318
305
|
`fix generate_valid_string_param for: ${format_issues(result.issues)}`);
|
|
@@ -327,9 +314,9 @@ const generate_string_record_base = (schema, view, kind) => {
|
|
|
327
314
|
* params accept any string value, and only a violation the field refuses.
|
|
328
315
|
* Each case breaks one field of a valid params record.
|
|
329
316
|
*
|
|
330
|
-
* @param params_schema - the params schema,
|
|
317
|
+
* @param params_schema - the params schema, an object schema
|
|
331
318
|
* @throws Error if no valid params record can be generated, or `params_schema`
|
|
332
|
-
* is no object schema or
|
|
319
|
+
* is no object schema or no schema
|
|
333
320
|
*/
|
|
334
321
|
export const generate_params_test_cases = (params_schema) => {
|
|
335
322
|
const view = to_object_schema_view(params_schema, 'adversarial_input: the params schema');
|
|
@@ -360,9 +347,9 @@ export const generate_params_test_cases = (params_schema) => {
|
|
|
360
347
|
*
|
|
361
348
|
* Each case breaks one field of a valid query record.
|
|
362
349
|
*
|
|
363
|
-
* @param query_schema - the query schema,
|
|
350
|
+
* @param query_schema - the query schema, an object schema
|
|
364
351
|
* @throws Error if no valid query record can be generated, or `query_schema`
|
|
365
|
-
* is no object schema or
|
|
352
|
+
* is no object schema or no schema
|
|
366
353
|
*/
|
|
367
354
|
export const generate_query_test_cases = (query_schema) => {
|
|
368
355
|
const view = to_object_schema_view(query_schema, 'adversarial_input: the query schema');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type AnySchema } from '@fuzdev/fuz_schema/schema.ts';
|
|
3
3
|
import type { AppSurface, AppSurfaceRoute } from '../http/surface.js';
|
|
4
4
|
import type { RouteErrorMap } from '../http/route_errors.js';
|
|
5
5
|
/**
|
|
@@ -64,7 +64,7 @@ export declare const get_route_error_schema: (lookup: ReadonlyMap<string, RouteE
|
|
|
64
64
|
* @throws AssertionError if no schema is declared for the route+status pair.
|
|
65
65
|
* @throws Error if the body does not satisfy the declared schema, a code the
|
|
66
66
|
* route doesn't declare at the status included, its message carrying the
|
|
67
|
-
* failed parse's issues (`
|
|
67
|
+
* failed parse's issues (`parse`).
|
|
68
68
|
*/
|
|
69
69
|
export declare const assert_error_schema_valid: (lookup: ReadonlyMap<string, RouteErrorMap>, route: AppSurfaceRoute, status: number, body: unknown) => void;
|
|
70
70
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAe7B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAe7B,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAe7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,MAAM,EAAE,iBAAiB,MAAM,KAAG,MACtB,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,GAC3C,SAAS,UAAU,EACnB,eAAe,MAAM,KACnB,IAOF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,eAAe,MAAM,UAAU,KAAG,IAE9E,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,GAC9C,SAAS,UAAU,EACnB,iBAAiB,KAAK,CAAC,MAAM,CAAC,KAC5B,IAWF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,QAAQ,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EAC1C,OAAO,eAAe,EACtB,QAAQ,MAAM,KACZ,SAAS,GAAG,SAEd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,GACrC,QAAQ,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EAC1C,OAAO,eAAe,EACtB,QAAQ,MAAM,EACd,MAAM,OAAO,KACX,IAUF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,GAC1C,QAAQ,aAAa,EACrB,SAAS,OAAO,EAChB,UAAU,QAAQ,EAClB,OAAO,MAAM,KACX,OAAO,CAAC,IAAI,CAiBd,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,UAAU,EACnB,aAAa,MAAM,EACnB,qBAAqB,KAAK,CAAC,MAAM,CAAC,KAChC,IAsBF,CAAC"}
|
|
@@ -11,9 +11,9 @@ import { readFileSync } from 'node:fs';
|
|
|
11
11
|
import { resolve, dirname } from 'node:path';
|
|
12
12
|
import { fileURLToPath } from 'node:url';
|
|
13
13
|
import { assert } from 'vitest';
|
|
14
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
14
15
|
import { format_route_key } from '../http/surface_query.js';
|
|
15
16
|
import { is_public_auth } from '../http/auth_shape.js';
|
|
16
|
-
import { parse_any } from '../schema_issues.js';
|
|
17
17
|
import { check_route_error, format_route_error_check, is_error_status, is_json_response } from '../http/route_error_check.js';
|
|
18
18
|
import { middleware_applies, middleware_carves_out, middleware_spec_applies } from '../http/schema_helpers.js';
|
|
19
19
|
/**
|
|
@@ -94,13 +94,13 @@ export const get_route_error_schema = (lookup, route, status) => {
|
|
|
94
94
|
* @throws AssertionError if no schema is declared for the route+status pair.
|
|
95
95
|
* @throws Error if the body does not satisfy the declared schema, a code the
|
|
96
96
|
* route doesn't declare at the status included, its message carrying the
|
|
97
|
-
* failed parse's issues (`
|
|
97
|
+
* failed parse's issues (`parse`).
|
|
98
98
|
*/
|
|
99
99
|
export const assert_error_schema_valid = (lookup, route, status, body) => {
|
|
100
100
|
const key = format_route_key(route);
|
|
101
101
|
const schema = get_route_error_schema(lookup, route, status);
|
|
102
102
|
assert.ok(schema, `missing error schema for ${status} on ${key}`);
|
|
103
|
-
const result =
|
|
103
|
+
const result = parse(schema, body);
|
|
104
104
|
if (!result.ok) {
|
|
105
105
|
throw new Error(`error schema mismatch for ${status} on ${key} (error ${JSON.stringify(body?.error)}): ${JSON.stringify(result.issues)}`);
|
|
106
106
|
}
|
|
@@ -11,7 +11,7 @@ import '../assert_dev_env.js';
|
|
|
11
11
|
* generic round-trip would tombstone the bootstrapped keeper). They
|
|
12
12
|
* live-mount on every spine's RPC path but stay off the declared surface,
|
|
13
13
|
* so this dedicated suite is their cross-impl validator. Every success
|
|
14
|
-
* `result` is parsed against the verb's declared
|
|
14
|
+
* `result` is parsed against the verb's declared **output** schema, so
|
|
15
15
|
* a TS↔Rust envelope drift fails the assertion.
|
|
16
16
|
*
|
|
17
17
|
* @module
|
|
@@ -141,7 +141,7 @@ export const describe_account_lifecycle_cross_tests = (options) => {
|
|
|
141
141
|
const failure = events.find((e) => e.outcome === 'failure' &&
|
|
142
142
|
e.metadata?.reason === ERROR_CANNOT_DELETE_KEEPER);
|
|
143
143
|
assert.ok(failure, 'keeper-removal guard must emit an account_delete outcome=failure audit row with reason cannot_delete_keeper');
|
|
144
|
-
// Byte-shape gate on the audit row's timestamp — `
|
|
144
|
+
// Byte-shape gate on the audit row's timestamp — the `Timestamp` in
|
|
145
145
|
// `AuditLogEventWithUsernamesJson` accepts a millisecond stamp too.
|
|
146
146
|
assert_iso8601_seconds(failure.created_at, 'audit_log_list.created_at');
|
|
147
147
|
});
|
|
@@ -30,10 +30,9 @@ import '../assert_dev_env.js';
|
|
|
30
30
|
*
|
|
31
31
|
* @module
|
|
32
32
|
*/
|
|
33
|
-
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
33
|
+
import { type Infer, type AnySchema } from '@fuzdev/fuz_schema/schema.ts';
|
|
34
34
|
import { type RouteAuth } from '../../http/auth_shape.js';
|
|
35
35
|
import { RateLimitKey } from '../../rate_limiter.js';
|
|
36
|
-
import type { ValidationSchema } from '../../schema_issues.js';
|
|
37
36
|
import type { RequestResponseActionSpec } from '../../actions/action_spec.js';
|
|
38
37
|
/**
|
|
39
38
|
* One method's normalized RPC metadata — the cross-impl-comparable unit.
|
|
@@ -66,9 +65,10 @@ export declare const ActionManifestEntry: import("@fuzdev/fuz_schema/schema.ts")
|
|
|
66
65
|
/** RPC method name (`spec.method`). */
|
|
67
66
|
method: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
68
67
|
/**
|
|
69
|
-
* `'void'` when the input is a void schema (`is_void_schema`: `
|
|
70
|
-
*
|
|
71
|
-
*
|
|
68
|
+
* `'void'` when the input is a void schema (`is_void_schema`: `s.void`, a
|
|
69
|
+
* parameterless method), else `'object'` — the Rust spine's declared
|
|
70
|
+
* `InputShape`, which its dispatcher enforces. An `object({})` input is
|
|
71
|
+
* `'object'`.
|
|
72
72
|
*/
|
|
73
73
|
input: import("@fuzdev/fuz_schema/schema.ts").Schema<"object" | "void", "object" | "void", "one_of", readonly ["void", "object"]>;
|
|
74
74
|
/** `true` when the action declares `side_effects` (mutation; POST-only on the RPC transport). */
|
|
@@ -149,9 +149,10 @@ export declare const ActionManifest: import("@fuzdev/fuz_schema/schema.ts").Sche
|
|
|
149
149
|
/** RPC method name (`spec.method`). */
|
|
150
150
|
method: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
151
151
|
/**
|
|
152
|
-
* `'void'` when the input is a void schema (`is_void_schema`: `
|
|
153
|
-
*
|
|
154
|
-
*
|
|
152
|
+
* `'void'` when the input is a void schema (`is_void_schema`: `s.void`, a
|
|
153
|
+
* parameterless method), else `'object'` — the Rust spine's declared
|
|
154
|
+
* `InputShape`, which its dispatcher enforces. An `object({})` input is
|
|
155
|
+
* `'object'`.
|
|
155
156
|
*/
|
|
156
157
|
input: import("@fuzdev/fuz_schema/schema.ts").Schema<"object" | "void", "object" | "void", "one_of", readonly ["void", "object"]>;
|
|
157
158
|
/** `true` when the action declares `side_effects` (mutation; POST-only on the RPC transport). */
|
|
@@ -177,7 +178,7 @@ export type ActionManifest = Infer<typeof ActionManifest>;
|
|
|
177
178
|
*/
|
|
178
179
|
export declare const action_manifest_entry: (spec: {
|
|
179
180
|
readonly method: string;
|
|
180
|
-
readonly input:
|
|
181
|
+
readonly input: AnySchema;
|
|
181
182
|
readonly auth: RouteAuth;
|
|
182
183
|
readonly side_effects: boolean;
|
|
183
184
|
readonly rate_limit?: RateLimitKey;
|