@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAmG9B,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAO3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAsBzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiBpC;;;;;;;;WAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAMH,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AAI,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,OAAO,EACb,SAAS,2BAA2B,KAClC,KAAK,CAAC,SAAS,CAwJjB,CAAC"}
|
|
@@ -78,7 +78,8 @@ import '../assert_dev_env.js';
|
|
|
78
78
|
*
|
|
79
79
|
* @module
|
|
80
80
|
*/
|
|
81
|
-
import {
|
|
81
|
+
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
82
|
+
import { array, boolean, max_value, min_value, number, object, optional, pipe, safe_integer, string, void as fuz_void } from '@fuzdev/fuz_schema/schema.ts';
|
|
82
83
|
import { Uuid, FactHashSchema } from '../../primitive_schemas.js';
|
|
83
84
|
import { fact_hash_bytes } from '@fuzdev/fuz_util/fact_hash.ts';
|
|
84
85
|
import { rpc_action } from '../../actions/action_types.js';
|
|
@@ -95,11 +96,11 @@ import { create_test_account_with_credentials, mint_test_session } from '../app_
|
|
|
95
96
|
import { DEFAULT_TEST_PASSWORD } from '../test_credentials.js';
|
|
96
97
|
import { TESTING_ACTION_AUTH } from './spine_surface_constants.js';
|
|
97
98
|
/** Output shape for an individual seeded account (keeper or extra). */
|
|
98
|
-
const SeededAccountShape =
|
|
99
|
-
account:
|
|
100
|
-
actor:
|
|
101
|
-
api_token:
|
|
102
|
-
session_cookie:
|
|
99
|
+
const SeededAccountShape = object({
|
|
100
|
+
account: object({ id: Uuid, username: string }),
|
|
101
|
+
actor: object({ id: Uuid }),
|
|
102
|
+
api_token: string,
|
|
103
|
+
session_cookie: string
|
|
103
104
|
});
|
|
104
105
|
/**
|
|
105
106
|
* The `_testing_reset` action spec.
|
|
@@ -132,15 +133,13 @@ export const testing_reset_action_spec = {
|
|
|
132
133
|
initiator: 'frontend',
|
|
133
134
|
auth: TESTING_ACTION_AUTH,
|
|
134
135
|
side_effects: true,
|
|
135
|
-
input:
|
|
136
|
-
extra_keeper_roles:
|
|
137
|
-
extra_accounts:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}))
|
|
143
|
-
.optional(),
|
|
136
|
+
input: object({
|
|
137
|
+
extra_keeper_roles: optional(array(string)),
|
|
138
|
+
extra_accounts: optional(array(object({
|
|
139
|
+
username: string,
|
|
140
|
+
password_value: optional(string),
|
|
141
|
+
roles: array(string)
|
|
142
|
+
}))),
|
|
144
143
|
/**
|
|
145
144
|
* Additional actor names to seed on the **keeper** account, beyond
|
|
146
145
|
* its single bootstrap actor. Drives the multi-actor `acting`
|
|
@@ -150,12 +149,13 @@ export const testing_reset_action_spec = {
|
|
|
150
149
|
* production wire path adds a second. Bootstrap-cradle seeding, same
|
|
151
150
|
* rationale as `extra_accounts`.
|
|
152
151
|
*/
|
|
153
|
-
extra_actors:
|
|
152
|
+
extra_actors: optional(array(string))
|
|
154
153
|
}),
|
|
155
|
-
output:
|
|
156
|
-
|
|
154
|
+
output: object({
|
|
155
|
+
...SeededAccountShape.def,
|
|
156
|
+
extra_accounts: array(SeededAccountShape),
|
|
157
157
|
/** The keeper's additional actors (from input `extra_actors`), in order. */
|
|
158
|
-
extra_actors:
|
|
158
|
+
extra_actors: array(object({ id: Uuid, name: string }))
|
|
159
159
|
}),
|
|
160
160
|
async: true,
|
|
161
161
|
description: 'Test-binary only — wipe auth tables, re-bootstrap a fresh keeper (+ optional extras), fire the domain-state reset.'
|
|
@@ -195,10 +195,10 @@ export const testing_drain_effects_action_spec = {
|
|
|
195
195
|
initiator: 'frontend',
|
|
196
196
|
auth: TESTING_ACTION_AUTH,
|
|
197
197
|
side_effects: false,
|
|
198
|
-
input:
|
|
199
|
-
output:
|
|
200
|
-
ok:
|
|
201
|
-
tracked:
|
|
198
|
+
input: fuz_void,
|
|
199
|
+
output: object({
|
|
200
|
+
ok: boolean,
|
|
201
|
+
tracked: meta(boolean, {
|
|
202
202
|
description: "Whether the backend's audit emitter tracks in-flight writes — false means the drain " +
|
|
203
203
|
'waited on nothing and is no barrier.'
|
|
204
204
|
})
|
|
@@ -210,7 +210,7 @@ export const testing_drain_effects_action_spec = {
|
|
|
210
210
|
* `_testing_mint_session` — mint an expired-by-construction server-side
|
|
211
211
|
* session for an existing account and return its signed cookie value.
|
|
212
212
|
*
|
|
213
|
-
* `expires_in_seconds` is **constrained negative** (`
|
|
213
|
+
* `expires_in_seconds` is **constrained negative** (a safe integer at most `-1`)
|
|
214
214
|
* so the action is structurally incapable of minting a *usable* session: it
|
|
215
215
|
* can only produce an already-backdated, already-dead `auth_session` row. The
|
|
216
216
|
* daemon-token gate + loopback binding already fence the backdoor, but the
|
|
@@ -242,19 +242,15 @@ export const testing_mint_session_action_spec = {
|
|
|
242
242
|
initiator: 'frontend',
|
|
243
243
|
auth: TESTING_ACTION_AUTH,
|
|
244
244
|
side_effects: true,
|
|
245
|
-
input:
|
|
245
|
+
input: object({
|
|
246
246
|
account_id: Uuid,
|
|
247
|
-
expires_in_seconds:
|
|
248
|
-
.number()
|
|
249
|
-
.int()
|
|
250
|
-
.negative()
|
|
251
|
-
.meta({
|
|
247
|
+
expires_in_seconds: meta(pipe(number, safe_integer, max_value(-1)), {
|
|
252
248
|
description: 'Seconds to offset the session row from NOW(). Constrained negative so this ' +
|
|
253
249
|
'backdoor can ONLY mint an already-expired (backdated) row — never a usable ' +
|
|
254
250
|
'session for an arbitrary account. Its sole use is the expired-session gate.'
|
|
255
251
|
})
|
|
256
252
|
}),
|
|
257
|
-
output:
|
|
253
|
+
output: object({ session_cookie: string }),
|
|
258
254
|
async: true,
|
|
259
255
|
description: 'Test-binary only — mint a backdated-expiry auth_session row for an account and return its ' +
|
|
260
256
|
'signed cookie value (exercises the authoritative server-side DB-row expiry gate).'
|
|
@@ -299,13 +295,13 @@ export const testing_put_fact_action_spec = {
|
|
|
299
295
|
initiator: 'frontend',
|
|
300
296
|
auth: TESTING_ACTION_AUTH,
|
|
301
297
|
side_effects: true,
|
|
302
|
-
input:
|
|
303
|
-
content:
|
|
304
|
-
content_type:
|
|
305
|
-
holder:
|
|
306
|
-
external_url:
|
|
298
|
+
input: object({
|
|
299
|
+
content: string,
|
|
300
|
+
content_type: optional(string),
|
|
301
|
+
holder: optional(Uuid),
|
|
302
|
+
external_url: optional(string)
|
|
307
303
|
}),
|
|
308
|
-
output:
|
|
304
|
+
output: object({ hash: FactHashSchema }),
|
|
309
305
|
async: true,
|
|
310
306
|
description: 'Test-binary only — seed a fact row for the blake3 of the UTF-8 content (embedded, or with ' +
|
|
311
307
|
'external_url an external row naming that URL) and return its hash, so the cross-process ' +
|
|
@@ -367,16 +363,16 @@ export const testing_flood_notifications_action_spec = {
|
|
|
367
363
|
initiator: 'frontend',
|
|
368
364
|
auth: TESTING_ACTION_AUTH,
|
|
369
365
|
side_effects: false,
|
|
370
|
-
input:
|
|
371
|
-
count:
|
|
366
|
+
input: object({
|
|
367
|
+
count: meta(pipe(number, safe_integer, min_value(0), max_value(TESTING_FLOOD_MAX_COUNT)), {
|
|
372
368
|
description: 'How many notifications to queue.'
|
|
373
369
|
}),
|
|
374
|
-
size:
|
|
370
|
+
size: meta(pipe(number, safe_integer, min_value(0), max_value(TESTING_FLOOD_MAX_SIZE)), {
|
|
375
371
|
description: "The byte length of each notification's `payload` string."
|
|
376
372
|
})
|
|
377
373
|
}),
|
|
378
|
-
output:
|
|
379
|
-
queued:
|
|
374
|
+
output: object({
|
|
375
|
+
queued: meta(pipe(number, safe_integer), {
|
|
380
376
|
description: 'The number of notifications asked for — not the number that fit.'
|
|
381
377
|
})
|
|
382
378
|
}),
|
|
@@ -427,7 +423,7 @@ export const testing_schema_snapshot_action_spec = {
|
|
|
427
423
|
initiator: 'frontend',
|
|
428
424
|
auth: TESTING_ACTION_AUTH,
|
|
429
425
|
side_effects: false,
|
|
430
|
-
input:
|
|
426
|
+
input: object({ exclude_tables: optional(array(string)) }),
|
|
431
427
|
output: SchemaSnapshot,
|
|
432
428
|
async: true,
|
|
433
429
|
description: 'Test-binary only — introspect the live schema into a normalized snapshot for cross-impl parity diffing.'
|
|
@@ -458,7 +454,7 @@ export const testing_migration_tracker_action_spec = {
|
|
|
458
454
|
initiator: 'frontend',
|
|
459
455
|
auth: TESTING_ACTION_AUTH,
|
|
460
456
|
side_effects: false,
|
|
461
|
-
input:
|
|
457
|
+
input: fuz_void,
|
|
462
458
|
output: MigrationTracker,
|
|
463
459
|
async: true,
|
|
464
460
|
description: 'Test-binary only — dump the schema_version tracker rows as a normalized {namespace, name, ' +
|
|
@@ -515,21 +511,16 @@ export const testing_shorten_credential_expiry_action_spec = {
|
|
|
515
511
|
initiator: 'frontend',
|
|
516
512
|
auth: TESTING_ACTION_AUTH,
|
|
517
513
|
side_effects: true,
|
|
518
|
-
input:
|
|
514
|
+
input: object({
|
|
519
515
|
account_id: Uuid,
|
|
520
|
-
seconds:
|
|
521
|
-
.number()
|
|
522
|
-
.int()
|
|
523
|
-
.min(TESTING_SHORTEN_CREDENTIAL_EXPIRY_MIN_SECONDS)
|
|
524
|
-
.max(TESTING_SHORTEN_CREDENTIAL_EXPIRY_MAX_SECONDS)
|
|
525
|
-
.meta({
|
|
516
|
+
seconds: meta(pipe(number, safe_integer, min_value(TESTING_SHORTEN_CREDENTIAL_EXPIRY_MIN_SECONDS), max_value(TESTING_SHORTEN_CREDENTIAL_EXPIRY_MAX_SECONDS)), {
|
|
526
517
|
description: 'Seconds from now the credentials expire, unless already due sooner — this ' +
|
|
527
518
|
'backdoor can only shorten a credential, never extend it.'
|
|
528
519
|
})
|
|
529
520
|
}),
|
|
530
|
-
output:
|
|
531
|
-
sessions:
|
|
532
|
-
api_tokens:
|
|
521
|
+
output: object({
|
|
522
|
+
sessions: pipe(number, safe_integer, min_value(0)),
|
|
523
|
+
api_tokens: pipe(number, safe_integer, min_value(0))
|
|
533
524
|
}),
|
|
534
525
|
async: true,
|
|
535
526
|
description: "Test-binary only — pull an account's session and API token expiries in to seconds from " +
|
|
@@ -570,7 +561,7 @@ export const testing_action_manifest_action_spec = {
|
|
|
570
561
|
initiator: 'frontend',
|
|
571
562
|
auth: TESTING_ACTION_AUTH,
|
|
572
563
|
side_effects: false,
|
|
573
|
-
input:
|
|
564
|
+
input: fuz_void,
|
|
574
565
|
output: ActionManifest,
|
|
575
566
|
async: true,
|
|
576
567
|
description: 'Test-binary only — dump the live RPC registry as a normalized ' +
|
|
@@ -7,8 +7,8 @@ import '../assert_dev_env.js';
|
|
|
7
7
|
* ## Why this suite exists
|
|
8
8
|
*
|
|
9
9
|
* The action-manifest parity gate captures `{method, side_effects, auth}` and
|
|
10
|
-
* **no param schemas**, while the TS spine validates params against a
|
|
11
|
-
* `
|
|
10
|
+
* **no param schemas**, while the TS spine validates params against a strict
|
|
11
|
+
* `object` and the Rust spine hand-parses with `params.get(...)`. So a
|
|
12
12
|
* spine that silently ignored the `lifetime` field would answer the same mint
|
|
13
13
|
* request with a **200 and an eternal token** — same method, same status,
|
|
14
14
|
* nothing red anywhere. The forcing function has to observe the *stored*
|
|
@@ -95,7 +95,7 @@ export const describe_token_lifetime_cross_tests = (options) => {
|
|
|
95
95
|
}, fixture.create_session_headers());
|
|
96
96
|
const created = expect_output(create_res, TokenCreateOutput);
|
|
97
97
|
assert.ok(created.expires_at !== null, 'a ttl mint must return a non-null expires_at — null means the spine dropped the field');
|
|
98
|
-
// Byte-shape gate: `
|
|
98
|
+
// Byte-shape gate: `Timestamp` accepts a millisecond stamp too, so
|
|
99
99
|
// `expect_output` above can't tell the two spines apart.
|
|
100
100
|
assert_iso8601_seconds(created.expires_at, 'token_create.expires_at');
|
|
101
101
|
const expires_ms = Date.parse(created.expires_at);
|
|
@@ -5,7 +5,7 @@ import '../assert_dev_env.js';
|
|
|
5
5
|
* A field can carry the right value on both backends and still be a parity
|
|
6
6
|
* defect if the two serialize it differently — a millisecond
|
|
7
7
|
* `2026-05-17T12:34:56.789Z` and a second-precision `2026-05-17T12:34:56Z`
|
|
8
|
-
* both parse as the same instant, so a
|
|
8
|
+
* both parse as the same instant, so a `Timestamp` check and an
|
|
9
9
|
* `assert.ok(value)` pass on either. These helpers pin the bytes.
|
|
10
10
|
*
|
|
11
11
|
* @module
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_outbound_overflow.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/ws_outbound_overflow.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ws_outbound_overflow.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/ws_outbound_overflow.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAgF9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AAGtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AACzD,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AA+F1E,sDAAsD;AACtD,MAAM,WAAW,kCAAmC,SAAQ,gBAAgB;IAC3E,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,yCAAyC,GACrD,SAAS,kCAAkC,KACzC,IAgPF,CAAC"}
|
|
@@ -39,6 +39,10 @@ import '../assert_dev_env.js';
|
|
|
39
39
|
* and before they build a payload, so the boundaries are read off the
|
|
40
40
|
* refusal and no burst is ever allocated — which pins the two spines'
|
|
41
41
|
* limits equal.
|
|
42
|
+
* - **integral spellings** — over HTTP RPC a `count` written `3.0`, `1e1` or
|
|
43
|
+
* `-0` is the integer it spells, refused for having no connection, and one
|
|
44
|
+
* written `1.5` is refused `invalid_params` with no reason, as the TS
|
|
45
|
+
* twin's safe-integer check reads them.
|
|
42
46
|
*
|
|
43
47
|
* What the suite does **not** assert, because it is each implementation's own:
|
|
44
48
|
* how many frames accepted before the overflow reach the client (the Rust
|
|
@@ -64,6 +68,7 @@ import { create_admitted_ws_transport } from '../transports/ws_transport.js';
|
|
|
64
68
|
import { is_notification, is_response_for } from '../transports/ws_client.js';
|
|
65
69
|
import { test_if } from './capabilities.js';
|
|
66
70
|
import { cross_rpc_call } from './cross_rpc.js';
|
|
71
|
+
import { create_rpc_request_text } from '../rpc_helpers.js';
|
|
67
72
|
import { open_session_ws } from './ws_endpoint.js';
|
|
68
73
|
const FLOOD_METHOD = '_testing_flood_notifications';
|
|
69
74
|
const FLOOD_NOTIFICATION_METHOD = '_testing_flood';
|
|
@@ -126,6 +131,18 @@ const FLOOD_LIMIT_CASES = [
|
|
|
126
131
|
within: false
|
|
127
132
|
}
|
|
128
133
|
];
|
|
134
|
+
/**
|
|
135
|
+
* Flood params as raw JSON text, for the spellings `JSON.stringify` loses,
|
|
136
|
+
* and whether each is within the limits (so refused for no connection).
|
|
137
|
+
*/
|
|
138
|
+
const FLOOD_SPELLING_CASES = [
|
|
139
|
+
{ params_json: '{"count":3.0,"size":8}', within: true },
|
|
140
|
+
{ params_json: '{"count":1e1,"size":0}', within: true },
|
|
141
|
+
{ params_json: '{"count":-0,"size":0}', within: true },
|
|
142
|
+
{ params_json: '{"count":0,"size":8.0}', within: true },
|
|
143
|
+
{ params_json: '{"count":1.5,"size":0}', within: false },
|
|
144
|
+
{ params_json: '{"count":-1.0,"size":0}', within: false }
|
|
145
|
+
];
|
|
129
146
|
/** How long the test waits for the megabyte burst and its response. */
|
|
130
147
|
const LARGE_BURST_TIMEOUT_MS = 15_000;
|
|
131
148
|
/** How long the test waits for the overflow close. */
|
|
@@ -265,5 +282,23 @@ export const describe_ws_outbound_overflow_cross_tests = (options) => {
|
|
|
265
282
|
assert.strictEqual(res.error?.data?.reason, within ? REASON_NO_CONNECTION : undefined, `${name}: ${JSON.stringify(params)}`);
|
|
266
283
|
}
|
|
267
284
|
});
|
|
285
|
+
test_if(rpc_path !== undefined, 'over HTTP a flood count spelled as a float is the integer it spells, a fraction refused', async () => {
|
|
286
|
+
const fixture = await setup_test();
|
|
287
|
+
const transport = fixture.fresh_transport({ origin: null });
|
|
288
|
+
for (const { params_json, within } of FLOOD_SPELLING_CASES) {
|
|
289
|
+
const res = await transport(rpc_path, {
|
|
290
|
+
method: 'POST',
|
|
291
|
+
headers: {
|
|
292
|
+
'Content-Type': 'application/json',
|
|
293
|
+
...fixture.create_daemon_token_headers()
|
|
294
|
+
},
|
|
295
|
+
body: create_rpc_request_text(FLOOD_METHOD, params_json)
|
|
296
|
+
});
|
|
297
|
+
const body = (await res.json());
|
|
298
|
+
assert.ok(body.error, `${params_json}: expected a refusal over HTTP`);
|
|
299
|
+
assert.strictEqual(body.error.code, INVALID_PARAMS, params_json);
|
|
300
|
+
assert.strictEqual(body.error.data?.reason, within ? REASON_NO_CONNECTION : undefined, params_json);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
268
303
|
});
|
|
269
304
|
};
|
|
@@ -184,7 +184,7 @@ export const describe_cross_process_ws_tests = (options) => {
|
|
|
184
184
|
client.destroy();
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
// `heartbeat` is parameterless on both spines (`
|
|
187
|
+
// `heartbeat` is parameterless on both spines (`s.void` /
|
|
188
188
|
// `require_void_params`): the empty shapes are the no-arg call, and a
|
|
189
189
|
// declared param is `invalid_params`, not ignored.
|
|
190
190
|
test_if(capabilities.ws, 'heartbeat admits only the parameterless shapes', async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data_exposure.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/data_exposure.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"data_exposure.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/data_exposure.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAyB7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKzD,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,wBAAwB,CAAC;AAahC,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,0BAA0B,CAAC;AAIvE;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,GAAI,QAAQ,OAAO,KAAG,GAAG,CAAC,MAAM,CAmC9E,CAAC;AA0HF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,yCAAyC,GACrD,gBAAgB,cAAc,EAC9B,mBAAkB,aAAa,CAAC,MAAM,CAA6B,EACnE,cAAc,aAAa,CAAC,MAAM,CAAC,KACjC,IAOF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wCAAwC,GACpD,gBAAgB,cAAc,EAC9B,oBAAmB,aAAa,CAAC,MAAM,CAA8B,EACrE,cAAc,aAAa,CAAC,MAAM,CAAC,KACjC,IAYF,CAAC;AAIF,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACvC,kEAAkE;IAClE,UAAU,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,iGAAiG;IACjG,iBAAiB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B;;;;OAIG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,uBAAuB,KAAG,IAiM/E,CAAC"}
|
|
@@ -120,7 +120,7 @@ const collect_output_schema_entries = (surface_source) => {
|
|
|
120
120
|
elevated: endpoint_elevated
|
|
121
121
|
};
|
|
122
122
|
if (spec.kind === 'remote_notification') {
|
|
123
|
-
// its `output` is `
|
|
123
|
+
// its `output` is `s.void`: the payload is its params
|
|
124
124
|
entries.push(params_entry);
|
|
125
125
|
continue;
|
|
126
126
|
}
|
|
@@ -268,7 +268,7 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
268
268
|
assert.strictEqual(wrong_pw_body.error, no_user_body.error, 'Error codes must be identical');
|
|
269
269
|
});
|
|
270
270
|
// Wire-shape gate: the successful `POST /login` body must strict-parse
|
|
271
|
-
// against `LoginOutput` (`{ok: true}`).
|
|
271
|
+
// against `LoginOutput` (`{ok: true}`). A strict `object` rejects any
|
|
272
272
|
// extra field, so a backend leaking `username` / `account_id` (the
|
|
273
273
|
// Rust spine's old shape) fails here on either impl.
|
|
274
274
|
test('successful login body strict-parses against LoginOutput', async () => {
|
|
@@ -296,7 +296,7 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
296
296
|
// Wire-shape gate: the authenticated `GET /api/account/status` body
|
|
297
297
|
// must strict-parse against `AccountStatusOutput` — the full shape
|
|
298
298
|
// `{account: SessionAccountJson, actor: ActorSummaryJson | null,
|
|
299
|
-
// role_grants: RoleGrantSummaryJson[]}`.
|
|
299
|
+
// role_grants: RoleGrantSummaryJson[]}`. A strict `object` rejects any
|
|
300
300
|
// extra or missing field on `account` / `actor` / each role_grant, so
|
|
301
301
|
// a backend returning the old narrow shape (Rust's `{account:{id,
|
|
302
302
|
// username}, role_grants:[{role}]}`) fails here on either impl. The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"integration_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpE,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AAC;AAE7F;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,GACzC,WAAW,aAAa,EACxB,cAAc,OAAO,KACnB,OAAiD,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,MAAM,EAAE,QAAQ,OAAO,KAAG,OACQ,CAAC"}
|
|
@@ -5,13 +5,13 @@ import './assert_dev_env.js';
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
import { assert } from 'vitest';
|
|
8
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
8
9
|
import { is_null_schema } from '../http/schema_helpers.js';
|
|
9
10
|
import { get_route_error_map } from '../http/route_errors.js';
|
|
10
11
|
import { is_public_auth } from '../http/auth_shape.js';
|
|
11
12
|
import { ERROR_AUTHENTICATION_REQUIRED } from '../http/error_schemas.js';
|
|
12
13
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
13
14
|
import { create_test_request_headers } from './test_origin.js';
|
|
14
|
-
import { parse_any } from '../schema_issues.js';
|
|
15
15
|
import { decode_route_path, find_mounted_route, is_json_response, to_mounted_routes } from '../http/route_error_check.js';
|
|
16
16
|
import { assert_error_response_declared } from './assertions.js';
|
|
17
17
|
/** Each spec list's compiled routes, so a list is compiled once. */
|
|
@@ -145,7 +145,7 @@ export const assert_response_matches_spec = async (route_specs, method, path, re
|
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
if (response.ok) {
|
|
148
|
-
const result =
|
|
148
|
+
const result = parse(spec.output, body);
|
|
149
149
|
if (!result.ok) {
|
|
150
150
|
throw new Error(`Output schema mismatch for ${method} ${path} (${response.status}): ${JSON.stringify(result.issues)}`);
|
|
151
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;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CAAC;AAEhD,sDAAsD;AACtD,MAAM,WAAW,0BAA0B;IAC1C,iDAAiD;IACjD,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,oFAAoF;IACpF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;CACpD;AAED,yDAAyD;AACzD,MAAM,WAAW,sBAAsB;IACtC,GAAG,EAAE,IAAI,CAAC;IACV,aAAa,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACxC,eAAe,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1C,qBAAqB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAChD,2BAA2B,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACtD,0BAA0B,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACrD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gCAAgC,GAC5C,UAAU,0BAA0B,KAClC,sBA4DF,CAAC"}
|
|
@@ -16,6 +16,7 @@ import './assert_dev_env.js';
|
|
|
16
16
|
import { vi, test, assert, describe } from 'vitest';
|
|
17
17
|
import { Hono } from 'hono';
|
|
18
18
|
import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
19
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
19
20
|
import { create_bearer_auth_middleware } from '../auth/bearer_auth.js';
|
|
20
21
|
import { AUTH_MIDDLEWARE_PATH, ORIGIN_MIDDLEWARE_PATH } from '../auth/middleware.js';
|
|
21
22
|
import { query_validate_api_token } from '../auth/api_token_queries.js';
|
|
@@ -28,7 +29,6 @@ import { REQUEST_CONTEXT_KEY } from '../auth/request_context.js';
|
|
|
28
29
|
import { RESOLVED_AUTH_KEY, TEST_CONTEXT_PRESET, TEST_CONTEXT_PRESET_KEY } from '../hono_context.js';
|
|
29
30
|
import { get_resolved_auth } from '../auth/resolved_auth.js';
|
|
30
31
|
import { create_test_resolved_auth } from './resolved_auth.js';
|
|
31
|
-
import { parse_any } from '../schema_issues.js';
|
|
32
32
|
// Mock the query modules so test cases can control return values.
|
|
33
33
|
// vi.mock() is hoisted by vitest, so these run before any imports resolve.
|
|
34
34
|
vi.mock('../auth/api_token_queries.js', () => ({
|
|
@@ -177,7 +177,7 @@ export const describe_bearer_auth_cases = (suite_name, cases) => {
|
|
|
177
177
|
if (tc.expected_error) {
|
|
178
178
|
assert.strictEqual(body.error, tc.expected_error.code);
|
|
179
179
|
assert.strictEqual(res.status, tc.expected_error.status);
|
|
180
|
-
const parsed =
|
|
180
|
+
const parsed = parse(tc.expected_error.schema, body);
|
|
181
181
|
assert.ok(parsed.ok, `error body fails its schema: ${JSON.stringify(body)}`);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -221,7 +221,7 @@ const describe_rpc_adversarial_params = (options) => {
|
|
|
221
221
|
continue;
|
|
222
222
|
describe(endpoint.path, () => {
|
|
223
223
|
for (const method of methods_with_input) {
|
|
224
|
-
// look up the source RpcAction for the
|
|
224
|
+
// look up the source RpcAction for the input schema
|
|
225
225
|
const action = find_rpc_action(rpc_endpoint_specs, endpoint.path, method.name);
|
|
226
226
|
if (!action) {
|
|
227
227
|
test(`${method.name} — missing RpcAction source spec`, () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
|
+
import type { AnySchema } from '@fuzdev/fuz_schema/schema.ts';
|
|
2
3
|
import type { AppSurfaceRpcEndpoint, AppSurfaceRpcMethod } from '../http/surface.js';
|
|
3
4
|
import type { JsonrpcErrorCode, JsonrpcRequestId } from '../http/jsonrpc.js';
|
|
4
|
-
import type { ValidationSchema } from '../schema_issues.js';
|
|
5
5
|
import { type InputTestCase, type InputTestCaseOptions } from './adversarial_input_cases.js';
|
|
6
6
|
/** The request id every envelope case sends where it sends one. */
|
|
7
7
|
export declare const RPC_ENVELOPE_PROBE_ID = "envelope_probe";
|
|
@@ -104,11 +104,11 @@ export declare const assert_rpc_envelope_refusal: (status: number, body: unknown
|
|
|
104
104
|
* (`invalid_request`) before params validation runs, and the envelope cases
|
|
105
105
|
* cover it. Every case returned owes 400 `invalid_params`.
|
|
106
106
|
*
|
|
107
|
-
* @param input - the method's input schema
|
|
107
|
+
* @param input - the method's input schema
|
|
108
108
|
* @param options - a valid base `params` to seed the cases (`InputTestCaseOptions.base`),
|
|
109
109
|
* and the method name for error messages
|
|
110
110
|
* @returns the cases, each a `params` object
|
|
111
111
|
* @throws Error if the base `params`, seeded or generated, fails the input schema
|
|
112
112
|
*/
|
|
113
|
-
export declare const generate_rpc_params_test_cases: (input:
|
|
113
|
+
export declare const generate_rpc_params_test_cases: (input: AnySchema, options?: InputTestCaseOptions) => Array<InputTestCase>;
|
|
114
114
|
//# sourceMappingURL=rpc_envelope_cases.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_envelope_cases.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_envelope_cases.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc_envelope_cases.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_envelope_cases.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAe7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAK7E,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,MAAM,8BAA8B,CAAC;AA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;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GACnC,eAAe,MAAM,EACrB,GAAG,eAAe,EAClB,UAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KAClC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAUgD,CAAC;AAEpF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,MAAM,EACd,MAAM,OAAO,EACb,GAAG,eAAe,KAChB,IAUF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,8BAA8B,GAC1C,OAAO,SAAS,EAChB,UAAU,oBAAoB,KAC5B,KAAK,CAAC,aAAa,CAGpB,CAAC"}
|
|
@@ -237,7 +237,7 @@ export const assert_rpc_envelope_refusal = (status, body, c) => {
|
|
|
237
237
|
* (`invalid_request`) before params validation runs, and the envelope cases
|
|
238
238
|
* cover it. Every case returned owes 400 `invalid_params`.
|
|
239
239
|
*
|
|
240
|
-
* @param input - the method's input schema
|
|
240
|
+
* @param input - the method's input schema
|
|
241
241
|
* @param options - a valid base `params` to seed the cases (`InputTestCaseOptions.base`),
|
|
242
242
|
* and the method name for error messages
|
|
243
243
|
* @returns the cases, each a `params` object
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
|
-
import {
|
|
3
|
-
import { type Schema } from '@fuzdev/fuz_schema/schema.ts';
|
|
2
|
+
import { type Schema, type Infer, type AnySchema } from '@fuzdev/fuz_schema/schema.ts';
|
|
4
3
|
import { type JsonrpcErrorCode } from '../http/jsonrpc.js';
|
|
5
4
|
import type { RequestResponseActionSpec } from '../actions/action_spec.js';
|
|
6
5
|
import type { RpcAction } from '../actions/action_types.js';
|
|
7
6
|
import type { AppSurfaceRpcEndpoint, AppSurfaceRpcMethod, RpcEndpointSpec } from '../http/surface.js';
|
|
8
7
|
import type { AppServerContext } from '../server/app_server_context.js';
|
|
9
8
|
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
10
|
-
import { type ValidationOutput, type ValidationSchema } from '../schema_issues.js';
|
|
11
9
|
/**
|
|
12
10
|
* Union accepted by the suite-level `rpc_endpoints` option — eager array or
|
|
13
11
|
* a factory that takes an `AppServerContext` and returns endpoint specs. The
|
|
@@ -48,7 +46,7 @@ export declare const resolve_rpc_endpoints_for_setup: (rpc_endpoints: RpcEndpoin
|
|
|
48
46
|
* @param params - params (omit for parameterless methods; `null` is also
|
|
49
47
|
* stripped for ergonomic call sites — JSON-RPC 2.0 §4.2
|
|
50
48
|
* forbids `"params": null` on the wire, and `create_rpc_endpoint`
|
|
51
|
-
* rejects `
|
|
49
|
+
* rejects `literal(null)` action input schemas at registration).
|
|
52
50
|
* Tests that need to construct a literal `"params": null`
|
|
53
51
|
* envelope (e.g. asserting envelope-level rejection) should
|
|
54
52
|
* build the body inline rather than route through this helper.
|
|
@@ -93,9 +91,9 @@ export declare const assert_jsonrpc_error_response: (body: unknown, expected_cod
|
|
|
93
91
|
* is provided, also validates the `result` field against the declared
|
|
94
92
|
* output schema — matching the REST round-trip's `assert_response_matches_spec`.
|
|
95
93
|
*
|
|
96
|
-
* @param output_schema - optional
|
|
94
|
+
* @param output_schema - optional schema to validate the `result` field against
|
|
97
95
|
*/
|
|
98
|
-
export declare const assert_jsonrpc_success_response: (body: unknown, output_schema?:
|
|
96
|
+
export declare const assert_jsonrpc_success_response: (body: unknown, output_schema?: AnySchema) => void;
|
|
99
97
|
/**
|
|
100
98
|
* Minimal transport surface — the duck type `Hono.request` already satisfies.
|
|
101
99
|
* Extracted so test setups that want an in-process / WS / mock path can plug
|
|
@@ -153,7 +151,7 @@ export interface RpcCallArgs {
|
|
|
153
151
|
method: string;
|
|
154
152
|
/**
|
|
155
153
|
* Params for the call. Omit (or pass `undefined`) for parameterless
|
|
156
|
-
* (`
|
|
154
|
+
* (`s.void`) methods — the helper drops `params` from the envelope
|
|
157
155
|
* either way. See `create_rpc_post_init` for the null-stripping
|
|
158
156
|
* affordance and JSON-RPC 2.0 §4.2's prohibition on `params: null`.
|
|
159
157
|
*/
|
|
@@ -240,7 +238,7 @@ export type RpcCallResultForSpec<TSpec extends RequestResponseActionSpec> = {
|
|
|
240
238
|
ok: true;
|
|
241
239
|
status: number;
|
|
242
240
|
headers: Record<string, string>;
|
|
243
|
-
result:
|
|
241
|
+
result: Infer<TSpec['output']>;
|
|
244
242
|
} | {
|
|
245
243
|
ok: false;
|
|
246
244
|
status: number;
|
|
@@ -256,12 +254,12 @@ export type RpcCallForSpecArgs<TSpec extends RequestResponseActionSpec> = Omit<R
|
|
|
256
254
|
/** Action spec whose `method` drives the envelope and whose `input`/`output` types pin params + result. */
|
|
257
255
|
spec: TSpec;
|
|
258
256
|
/** Params, typed against `spec.input`. */
|
|
259
|
-
params:
|
|
257
|
+
params: Infer<TSpec['input']>;
|
|
260
258
|
};
|
|
261
259
|
/**
|
|
262
260
|
* Typed wrapper over `rpc_call` — binds `params` and the success `result` to
|
|
263
|
-
* the output types of `spec.input` and `spec.output` (`
|
|
264
|
-
* the generic
|
|
261
|
+
* the output types of `spec.input` and `spec.output` (`Infer`) via
|
|
262
|
+
* the generic.
|
|
265
263
|
*
|
|
266
264
|
* Success results are validated at runtime against `spec.output` (same
|
|
267
265
|
* contract as `rpc_call_typed`); a mismatch throws. Error responses come
|
|
@@ -281,10 +279,10 @@ export declare const rpc_call_for_spec: <TSpec extends RequestResponseActionSpec
|
|
|
281
279
|
* assert on specific error shapes.
|
|
282
280
|
*
|
|
283
281
|
* @throws Error if the response is a JSON-RPC error, if `rpc_call` throws
|
|
284
|
-
* on an envelope violation, or if the result fails `output_schema` (
|
|
285
|
-
*
|
|
282
|
+
* on an envelope violation, or if the result fails `output_schema` (parsed with
|
|
283
|
+
* `parse`).
|
|
286
284
|
*/
|
|
287
|
-
export declare const rpc_call_typed: <T>(args: RpcCallArgs, output_schema:
|
|
285
|
+
export declare const rpc_call_typed: <T>(args: RpcCallArgs, output_schema: Schema<T, any>) => Promise<T>;
|
|
288
286
|
/**
|
|
289
287
|
* Find the `RpcAction` for a method within a set of RPC endpoint specs.
|
|
290
288
|
* Returns both the endpoint path and the matched action. `undefined` when
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,
|
|
1
|
+
{"version":3,"file":"rpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,EAAa,KAAK,MAAM,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAElG,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EACX,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE;;;;;;;;;GASG;AACH,MAAM,MAAM,uBAAuB,GAClC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,+BAA+B,GAC3C,eAAe,uBAAuB,EACtC,iBAAiB,cAAc,CAAC,MAAM,CAAC,KACrC,KAAK,CAAC,eAAe,CAuBvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oB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