@fuzdev/fuz_app 0.179.0 → 0.181.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 +14 -14
- package/dist/actions/action_rpc.d.ts +14 -5
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +53 -46
- package/dist/actions/action_types.d.ts +15 -12
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/perform_action.d.ts +4 -4
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +6 -6
- package/dist/actions/register_action_ws.d.ts +6 -2
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +14 -3
- package/dist/actions/ws_socket_session.js +1 -1
- package/dist/auth/CLAUDE.md +36 -30
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +18 -1
- package/dist/auth/account_queries.d.ts +69 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +82 -0
- package/dist/auth/account_route_schema.d.ts +26 -16
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +10 -24
- package/dist/auth/account_routes.d.ts +4 -6
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +86 -66
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +63 -14
- package/dist/auth/api_token_queries.d.ts +16 -7
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +18 -18
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +10 -12
- package/dist/auth/audit_log_schema.js +4 -4
- package/dist/auth/bearer_auth.d.ts +4 -3
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +35 -31
- package/dist/auth/bootstrap_account.d.ts +65 -37
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +115 -66
- package/dist/auth/bootstrap_route_schema.d.ts +6 -2
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +7 -2
- package/dist/auth/bootstrap_routes.d.ts +50 -33
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +109 -87
- package/dist/auth/bootstrap_token_store.d.ts +60 -0
- package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
- package/dist/auth/bootstrap_token_store.js +39 -0
- package/dist/auth/credential_headers.d.ts +71 -0
- package/dist/auth/credential_headers.d.ts.map +1 -0
- package/dist/auth/credential_headers.js +100 -0
- package/dist/auth/daemon_token.d.ts +13 -1
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token.js +14 -2
- package/dist/auth/daemon_token_middleware.d.ts +10 -11
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +27 -29
- package/dist/auth/deps.d.ts +0 -11
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/invite_queries.d.ts +18 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +24 -0
- package/dist/auth/request_context.d.ts +26 -5
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +17 -10
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +3 -2
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +37 -14
- package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
- package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_ddl.js +9 -2
- package/dist/auth/role_grant_offer_queries.d.ts +56 -3
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +93 -8
- package/dist/auth/role_grant_queries.d.ts +7 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +8 -0
- package/dist/auth/session_cookie.d.ts +105 -25
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +124 -15
- package/dist/auth/session_middleware.d.ts +83 -54
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +92 -66
- package/dist/auth/session_queries.d.ts +64 -4
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +53 -4
- package/dist/auth/signup_route_schema.d.ts +5 -5
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +4 -4
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +17 -14
- package/dist/auth/token_scope.d.ts +5 -7
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +5 -8
- package/dist/dev/setup.d.ts +6 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -34
- package/dist/hono_context.d.ts +21 -0
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +17 -0
- package/dist/http/CLAUDE.md +150 -43
- package/dist/http/auth_shape.d.ts +3 -3
- package/dist/http/common_routes.js +1 -1
- package/dist/http/db_routes.d.ts +4 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +14 -14
- package/dist/http/dev_route_error_check.d.ts +6 -3
- package/dist/http/dev_route_error_check.d.ts.map +1 -1
- package/dist/http/dev_route_error_check.js +6 -3
- package/dist/http/dev_set_cookie_check.d.ts +53 -0
- package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
- package/dist/http/dev_set_cookie_check.js +80 -0
- package/dist/http/error_schemas.d.ts +36 -1
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +39 -2
- package/dist/http/header_lines.d.ts +42 -0
- package/dist/http/header_lines.d.ts.map +1 -0
- package/dist/http/header_lines.js +80 -0
- package/dist/http/host.d.ts +12 -9
- package/dist/http/host.d.ts.map +1 -1
- package/dist/http/host.js +25 -20
- package/dist/http/origin.d.ts +7 -22
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +11 -25
- package/dist/http/proxy.d.ts +1 -0
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -0
- package/dist/http/request_headers.d.ts +95 -0
- package/dist/http/request_headers.d.ts.map +1 -0
- package/dist/http/request_headers.js +110 -0
- package/dist/http/request_target.d.ts +134 -0
- package/dist/http/request_target.d.ts.map +1 -0
- package/dist/http/request_target.js +193 -0
- package/dist/http/route_error_check.d.ts +4 -11
- package/dist/http/route_error_check.d.ts.map +1 -1
- package/dist/http/route_error_check.js +4 -21
- package/dist/http/route_result.d.ts +127 -23
- package/dist/http/route_result.d.ts.map +1 -1
- package/dist/http/route_result.js +97 -19
- package/dist/http/route_spec.d.ts +298 -82
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +548 -71
- package/dist/http/simple_request.d.ts +19 -14
- package/dist/http/simple_request.d.ts.map +1 -1
- package/dist/http/simple_request.js +17 -29
- package/dist/http/surface.d.ts +2 -0
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +4 -1
- package/dist/realtime/outbound_budget.d.ts +1 -2
- package/dist/realtime/outbound_budget.d.ts.map +1 -1
- package/dist/realtime/outbound_budget.js +1 -2
- package/dist/realtime/sse.d.ts +47 -17
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +115 -93
- package/dist/realtime/sse_constants.d.ts +7 -1
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +12 -1
- package/dist/realtime/sse_registry.d.ts +3 -3
- package/dist/realtime/sse_registry.js +3 -3
- package/dist/runtime/deps.d.ts +20 -4
- package/dist/runtime/deps.d.ts.map +1 -1
- package/dist/runtime/mock.d.ts +7 -1
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +33 -3
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +2 -1
- package/dist/runtime/secure_file.d.ts +71 -10
- package/dist/runtime/secure_file.d.ts.map +1 -1
- package/dist/runtime/secure_file.js +91 -11
- package/dist/server/app_backend.d.ts +0 -8
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +1 -3
- package/dist/server/app_server.d.ts +28 -17
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +52 -34
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +49 -45
- package/dist/server/static.d.ts +20 -0
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +56 -8
- package/dist/server/unmatched_route.d.ts +42 -0
- package/dist/server/unmatched_route.d.ts.map +1 -0
- package/dist/server/unmatched_route.js +64 -0
- package/dist/testing/CLAUDE.md +404 -1200
- package/dist/testing/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +4 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +2 -1
- package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +277 -6
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +68 -5
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +20 -4
- package/dist/testing/cross_backend/cell_gated_create.js +1 -1
- package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +179 -23
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
- package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
- package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance.js +296 -0
- package/dist/testing/cross_backend/credential_conformance.json +1284 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
- package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
- package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
- package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_wire.js +188 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +22 -2
- package/dist/testing/cross_backend/default_spine_surface.js +1 -1
- package/dist/testing/cross_backend/differential.d.ts +1 -1
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +3 -2
- package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +11 -5
- package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +7 -0
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +4 -0
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +78 -4
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +13 -10
- package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
- package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
- package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance.js +196 -0
- package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance.js +186 -0
- package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +2 -1
- package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
- package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +56 -29
- package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
- package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
- package/dist/testing/cross_backend/session_login.d.ts +24 -0
- package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_login.js +31 -0
- package/dist/testing/cross_backend/setup.d.ts +117 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +193 -9
- package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
- package/dist/testing/cross_backend/simple_request.js +5 -0
- package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +88 -5
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +205 -64
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +5 -2
- package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
- package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_credential_read.js +175 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +58 -2
- package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +13 -10
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_endpoint.js +19 -2
- package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_role_gated.js +2 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +28 -12
- package/dist/testing/cross_backend/xfail.d.ts +44 -11
- package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
- package/dist/testing/cross_backend/xfail.js +68 -23
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +4 -3
- package/dist/testing/integration.d.ts +1 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +14 -8
- package/dist/testing/integration_helpers.d.ts +50 -3
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +87 -9
- package/dist/testing/middleware.d.ts +2 -0
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +9 -2
- package/dist/testing/round_trip.d.ts +6 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +17 -6
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +7 -0
- package/dist/testing/rpc_helpers.d.ts +4 -2
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +6 -1
- package/dist/testing/rpc_round_trip.d.ts +13 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +25 -6
- package/dist/testing/schema_generators.d.ts +2 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +4 -4
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +8 -8
- package/dist/testing/transports/fetch_transport.d.ts +6 -3
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
- package/dist/testing/transports/fetch_transport.js +31 -19
- package/dist/testing/transports/raw_http.d.ts +61 -1
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +61 -1
- package/dist/testing/transports/ws_raw_client.d.ts +20 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +10 -4
- package/dist/testing/transports/ws_transport.d.ts +21 -1
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +58 -20
- package/package.json +5 -5
|
@@ -68,6 +68,8 @@ export interface BearerAuthTestCase extends BearerAuthTestOptions {
|
|
|
68
68
|
/** Mocks bundle returned by `create_bearer_auth_mocks`. */
|
|
69
69
|
export interface BearerAuthMocks {
|
|
70
70
|
mock_validate: ReturnType<typeof vi.fn>;
|
|
71
|
+
/** `query_api_token_touch` — the usage record a token that authenticated gets. */
|
|
72
|
+
mock_touch: ReturnType<typeof vi.fn>;
|
|
71
73
|
mock_find_by_id: ReturnType<typeof vi.fn>;
|
|
72
74
|
mock_find_actor_by_id: ReturnType<typeof vi.fn>;
|
|
73
75
|
mock_find_actors_by_account: ReturnType<typeof vi.fn>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/lib/testing/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,EAAE,EAA0B,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAqB5B,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAOtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/lib/testing/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,EAAE,EAA0B,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAqB5B,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAOtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAqB7D,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACrC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,oEAAoE;IACpE,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4CAA4C;IAC5C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,0CAA0C;IAC1C,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,+DAA+D;IAC/D,uBAAuB,CAAC,EAAE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|
20
20
|
import { create_bearer_auth_middleware } from '../auth/bearer_auth.js';
|
|
21
21
|
import { AUTH_MIDDLEWARE_PATH, ORIGIN_MIDDLEWARE_PATH } from '../auth/middleware.js';
|
|
22
|
-
import { query_validate_api_token } from '../auth/api_token_queries.js';
|
|
22
|
+
import { query_api_token_touch, query_validate_api_token } from '../auth/api_token_queries.js';
|
|
23
23
|
import { query_account_by_id, query_actor_by_id, query_active_actors_by_account } from '../auth/account_queries.js';
|
|
24
24
|
import { query_role_grant_find_active_for_actor } from '../auth/role_grant_queries.js';
|
|
25
25
|
import { create_proxy_middleware } from '../http/proxy.js';
|
|
@@ -32,7 +32,8 @@ import { create_test_resolved_auth } from './resolved_auth.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', () => ({
|
|
35
|
-
query_validate_api_token: vi.fn()
|
|
35
|
+
query_validate_api_token: vi.fn(),
|
|
36
|
+
query_api_token_touch: vi.fn()
|
|
36
37
|
}));
|
|
37
38
|
vi.mock('../auth/account_queries.js', () => ({
|
|
38
39
|
query_account_by_id: vi.fn(),
|
|
@@ -58,6 +59,7 @@ const STUB_DEPS = { db: {} };
|
|
|
58
59
|
*/
|
|
59
60
|
export const create_bearer_auth_mocks = (tc) => {
|
|
60
61
|
const mock_validate = vi.mocked(query_validate_api_token);
|
|
62
|
+
const mock_touch = vi.mocked(query_api_token_touch);
|
|
61
63
|
const mock_find_by_id = vi.mocked(query_account_by_id);
|
|
62
64
|
const mock_find_actor_by_id = vi.mocked(query_actor_by_id);
|
|
63
65
|
const mock_find_actors_by_account = vi.mocked(query_active_actors_by_account);
|
|
@@ -65,6 +67,7 @@ export const create_bearer_auth_mocks = (tc) => {
|
|
|
65
67
|
mock_validate
|
|
66
68
|
.mockReset()
|
|
67
69
|
.mockImplementation(() => Promise.resolve(tc.mock_validate_result));
|
|
70
|
+
mock_touch.mockReset().mockImplementation(() => Promise.resolve());
|
|
68
71
|
mock_find_by_id
|
|
69
72
|
.mockReset()
|
|
70
73
|
.mockImplementation(() => Promise.resolve(tc.mock_find_by_id_result));
|
|
@@ -85,6 +88,7 @@ export const create_bearer_auth_mocks = (tc) => {
|
|
|
85
88
|
.mockImplementation(() => Promise.resolve(tc.mock_role_grants_result ?? []));
|
|
86
89
|
return {
|
|
87
90
|
mock_validate,
|
|
91
|
+
mock_touch,
|
|
88
92
|
mock_find_by_id,
|
|
89
93
|
mock_find_actor_by_id,
|
|
90
94
|
mock_find_actors_by_account,
|
|
@@ -247,6 +251,9 @@ export const create_test_middleware_stack_app = (options) => {
|
|
|
247
251
|
const mock_find_actors_by_account = vi.mocked(query_active_actors_by_account);
|
|
248
252
|
const mock_find_active_for_actor = vi.mocked(query_role_grant_find_active_for_actor);
|
|
249
253
|
mock_validate.mockReset().mockImplementation(() => Promise.resolve(undefined));
|
|
254
|
+
vi.mocked(query_api_token_touch)
|
|
255
|
+
.mockReset()
|
|
256
|
+
.mockImplementation(() => Promise.resolve());
|
|
250
257
|
mock_find_by_id.mockReset().mockImplementation(() => Promise.resolve(undefined));
|
|
251
258
|
mock_find_actor_by_id.mockReset().mockImplementation(() => Promise.resolve(undefined));
|
|
252
259
|
mock_find_actors_by_account.mockReset().mockImplementation(() => Promise.resolve([]));
|
|
@@ -54,7 +54,10 @@ export interface RoundTripTestOptions {
|
|
|
54
54
|
* naming no reason, means the credential stopped working — most often because
|
|
55
55
|
* an earlier request ended it. A public route may answer 401 (a login with a
|
|
56
56
|
* wrong password), and so may a handler refusing an authenticated request
|
|
57
|
-
* with a reason of its own (`invalid_credentials`).
|
|
57
|
+
* with a reason of its own (`invalid_credentials`). A 403
|
|
58
|
+
* `credential_type_required` fails too, as in `assert_rpc_authenticated`: the
|
|
59
|
+
* principal was picked because the route's auth admits its credential type,
|
|
60
|
+
* so that refusal means the credential never arrived as sent.
|
|
58
61
|
*
|
|
59
62
|
* @param route_key - the route, as `METHOD /path`
|
|
60
63
|
* @param status - the HTTP status
|
|
@@ -69,7 +72,8 @@ export declare const assert_route_authenticated: (route_key: string, status: num
|
|
|
69
72
|
* 1. Resolve URL with valid params
|
|
70
73
|
* 2. Generate a valid request body (or use override)
|
|
71
74
|
* 3. Pick auth headers matching the route's auth requirement
|
|
72
|
-
* 4. Fire the request through
|
|
75
|
+
* 4. Fire the request through the principal's transport (`to_principal_transport`)
|
|
76
|
+
* and validate the response
|
|
73
77
|
*
|
|
74
78
|
* SSE routes are skipped by Content-Type sniff. Routes returning non-2xx
|
|
75
79
|
* with valid input are still validated against their declared error schemas.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round_trip.d.ts","sourceRoot":"","sources":["../../src/lib/testing/round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"round_trip.d.ts","sourceRoot":"","sources":["../../src/lib/testing/round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA+B7B,OAAO,EASN,KAAK,aAAa,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kDAAkD;IAClD,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,+EAA+E;IAC/E,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD;;;;OAIG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,EAAE,GAAG,CACrB,MAAM,EACN,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CACnF,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,0BAA0B,GACtC,WAAW,MAAM,EACjB,QAAQ,MAAM,EACd,MAAM,OAAO,EACb,WAAW,aAAa,KACtB,IAiBF,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,8BAA8B,GAAI,SAAS,oBAAoB,KAAG,IAmK9E,CAAC"}
|
|
@@ -23,8 +23,9 @@ import './assert_dev_env.js';
|
|
|
23
23
|
import { describe, test, beforeAll, assert } from 'vitest';
|
|
24
24
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
25
25
|
import { format_route_key } from '../http/surface_query.js';
|
|
26
|
+
import { ERROR_CREDENTIAL_TYPE_REQUIRED } from '../http/error_schemas.js';
|
|
26
27
|
import { needs_actor, input_schema_declares_acting } from '../http/auth_shape.js';
|
|
27
|
-
import { assert_response_matches_spec, is_unauthenticated_refusal, pick_auth_headers, pick_auth_principal, round_trip_uses_fresh_account, to_principal_headers } from './integration_helpers.js';
|
|
28
|
+
import { assert_response_matches_spec, is_credential_type_refusal, is_unauthenticated_refusal, pick_auth_headers, pick_auth_principal, round_trip_uses_fresh_account, to_principal_headers, to_principal_transport } from './integration_helpers.js';
|
|
28
29
|
import { resolve_valid_path, generate_valid_body, to_route_content_type } from './schema_generators.js';
|
|
29
30
|
/**
|
|
30
31
|
* Guard against a refusal that says the request carried no valid credential
|
|
@@ -34,7 +35,10 @@ import { resolve_valid_path, generate_valid_body, to_route_content_type } from '
|
|
|
34
35
|
* naming no reason, means the credential stopped working — most often because
|
|
35
36
|
* an earlier request ended it. A public route may answer 401 (a login with a
|
|
36
37
|
* wrong password), and so may a handler refusing an authenticated request
|
|
37
|
-
* with a reason of its own (`invalid_credentials`).
|
|
38
|
+
* with a reason of its own (`invalid_credentials`). A 403
|
|
39
|
+
* `credential_type_required` fails too, as in `assert_rpc_authenticated`: the
|
|
40
|
+
* principal was picked because the route's auth admits its credential type,
|
|
41
|
+
* so that refusal means the credential never arrived as sent.
|
|
38
42
|
*
|
|
39
43
|
* @param route_key - the route, as `METHOD /path`
|
|
40
44
|
* @param status - the HTTP status
|
|
@@ -45,6 +49,11 @@ export const assert_route_authenticated = (route_key, status, body, principal) =
|
|
|
45
49
|
if (principal === 'public')
|
|
46
50
|
return;
|
|
47
51
|
const reason = body !== null && typeof body === 'object' ? body.error : undefined;
|
|
52
|
+
if (is_credential_type_refusal(status, reason)) {
|
|
53
|
+
assert.fail(`${route_key} answered 403 ${ERROR_CREDENTIAL_TYPE_REQUIRED} to the ${principal}` +
|
|
54
|
+
` principal — the principal was picked because the route's auth admits its` +
|
|
55
|
+
` credential type, so the credential never arrived as sent`);
|
|
56
|
+
}
|
|
48
57
|
if (!is_unauthenticated_refusal(status, reason))
|
|
49
58
|
return;
|
|
50
59
|
assert.fail(`${route_key} answered 401 (${JSON.stringify(reason ?? null)}) to the ${principal}` +
|
|
@@ -58,7 +67,8 @@ export const assert_route_authenticated = (route_key, status, body, principal) =
|
|
|
58
67
|
* 1. Resolve URL with valid params
|
|
59
68
|
* 2. Generate a valid request body (or use override)
|
|
60
69
|
* 3. Pick auth headers matching the route's auth requirement
|
|
61
|
-
* 4. Fire the request through
|
|
70
|
+
* 4. Fire the request through the principal's transport (`to_principal_transport`)
|
|
71
|
+
* and validate the response
|
|
62
72
|
*
|
|
63
73
|
* SSE routes are skipped by Content-Type sniff. Routes returning non-2xx
|
|
64
74
|
* with valid input are still validated against their declared error schemas.
|
|
@@ -139,13 +149,13 @@ export const describe_round_trip_validation = (options) => {
|
|
|
139
149
|
headers: { ...headers, 'content-type': to_route_content_type(spec) },
|
|
140
150
|
...(body ? { body: JSON.stringify(body) } : {})
|
|
141
151
|
};
|
|
142
|
-
const res = await fixture
|
|
152
|
+
const res = await to_principal_transport(principal, fixture)(request_url, request_init);
|
|
143
153
|
if (res.headers.get('Content-Type')?.includes('text/event-stream')) {
|
|
144
154
|
await res.body?.cancel();
|
|
145
155
|
return;
|
|
146
156
|
}
|
|
147
157
|
try {
|
|
148
|
-
if (res.status === 401) {
|
|
158
|
+
if (res.status === 401 || res.status === 403) {
|
|
149
159
|
const body = await res
|
|
150
160
|
.clone()
|
|
151
161
|
.json()
|
|
@@ -173,7 +183,8 @@ export const describe_round_trip_validation = (options) => {
|
|
|
173
183
|
resolve_valid_path(spec.path, spec.params, options.param_values?.[route_key]);
|
|
174
184
|
const body = seeded.body;
|
|
175
185
|
const headers = pick_auth_headers(spec, fixture, authed_account, admin_account);
|
|
176
|
-
const
|
|
186
|
+
const transport = to_principal_transport(pick_auth_principal(spec.auth), fixture);
|
|
187
|
+
const res = await transport(url, {
|
|
177
188
|
method: spec.method,
|
|
178
189
|
headers: { ...headers, 'content-type': to_route_content_type(spec) },
|
|
179
190
|
...(body ? { body: JSON.stringify(body) } : {})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_envelope_cases.d.ts","sourceRoot":"","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;AAItC,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,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EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC;CACF;AAED,+CAA+C;AAC/C,MAAM,WAAW,sBAAsB;IACtC,oDAAoD;IACpD,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAgC,CAAC;AAIzF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAO3F,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,2BAA2B,GAAI,QAAQ,MAAM,KAAG,MACL,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,yBAAyB,GACrC,UAAU,qBAAqB,EAC/B,UAAS,sBAA2B,KAClC,KAAK,CAAC,eAAe,CA+LvB,CAAC;AAEF;;;;;;;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"}
|
|
@@ -129,6 +129,13 @@ export const create_rpc_envelope_cases = (endpoint, options = {}) => {
|
|
|
129
129
|
id: null,
|
|
130
130
|
reason: 'missing id query parameter'
|
|
131
131
|
});
|
|
132
|
+
// the whole query is decoded before any key is read, so the refusal
|
|
133
|
+
// echoes no id — a key the endpoint never reads included
|
|
134
|
+
get('GET undecodable query → invalid_request', `?method=${q(m)}&id=${id}&junk=%FF`, {
|
|
135
|
+
...invalid_request,
|
|
136
|
+
id: null,
|
|
137
|
+
reason: 'undecodable query string'
|
|
138
|
+
});
|
|
132
139
|
get('GET invalid JSON params → invalid_params', `?method=${q(m)}&id=${id}¶ms=not-json`, {
|
|
133
140
|
status: 400,
|
|
134
141
|
code: JSONRPC_ERROR_CODES.invalid_params,
|
|
@@ -177,12 +177,14 @@ export interface RpcCallArgs {
|
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* The unparsed response `rpc_call_raw` returns: the HTTP status, the
|
|
180
|
-
* response-headers snapshot (lowercased keys),
|
|
181
|
-
* the
|
|
180
|
+
* response-headers snapshot (lowercased keys), every `Set-Cookie` line in
|
|
181
|
+
* order (the snapshot keeps one), and the JSON body exactly as the server sent
|
|
182
|
+
* it — the whole envelope, `jsonrpc` and `id` included.
|
|
182
183
|
*/
|
|
183
184
|
export interface RpcCallRawResult {
|
|
184
185
|
status: number;
|
|
185
186
|
headers: Record<string, string>;
|
|
187
|
+
set_cookies: ReadonlyArray<string>;
|
|
186
188
|
body: unknown;
|
|
187
189
|
}
|
|
188
190
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_helpers.d.ts","sourceRoot":"","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,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;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAAU,KAAK,SAAS,yBAAyB,EAC9E,MAAM,kBAAkB,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAoBrC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAU,CAAC,EACrC,MAAM,WAAW,EACjB,eAAe,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,KAC3B,OAAO,CAAC,CAAC,CAkBX,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC3B,eAAe,aAAa,CAAC,eAAe,CAAC,EAC7C,QAAQ,MAAM,KACZ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,GAAG,SAOxC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC3B,eAAe,aAAa,CAAC,qBAAqB,CAAC,EACnD,QAAQ,MAAM,KACZ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,GAAG,SAOvD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GACrC,eAAe,aAAa,CAAC,eAAe,CAAC,KAC3C,MAcF,CAAC"}
|
|
@@ -223,7 +223,12 @@ export const rpc_call_raw = async (args) => {
|
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
const res = await (typeof app === 'function' ? app(url, init) : app.request(url, init));
|
|
226
|
-
return {
|
|
226
|
+
return {
|
|
227
|
+
status: res.status,
|
|
228
|
+
headers: headers_to_record(res.headers),
|
|
229
|
+
set_cookies: res.headers.getSetCookie(),
|
|
230
|
+
body: await res.json()
|
|
231
|
+
};
|
|
227
232
|
};
|
|
228
233
|
/**
|
|
229
234
|
* Parse a raw JSON-RPC response into `rpc_call`'s discriminated result.
|
|
@@ -19,7 +19,7 @@ export interface RpcRoundTripTestOptions {
|
|
|
19
19
|
* Session config — only needed to resolve factory-form `rpc_endpoints`
|
|
20
20
|
* against a stub `AppServerContext` at setup time (the actions' input
|
|
21
21
|
* schemas drive params generation; auth/dispatch run against the real
|
|
22
|
-
* backend through
|
|
22
|
+
* backend through the fixture's transports).
|
|
23
23
|
*/
|
|
24
24
|
session_options: SessionOptions<string>;
|
|
25
25
|
/**
|
|
@@ -68,7 +68,10 @@ export interface RpcSuccessFixtureCase {
|
|
|
68
68
|
params: Record<string, unknown>;
|
|
69
69
|
/**
|
|
70
70
|
* Auth headers to send in place of the identity the suite picks from the
|
|
71
|
-
* method's auth — for a row that only its owner may act on.
|
|
71
|
+
* method's auth — for a row that only its owner may act on. They must
|
|
72
|
+
* carry a session `Cookie`: the request goes through a cookie-free
|
|
73
|
+
* transport with the default `Origin` (`fixture.fresh_transport()`), so a
|
|
74
|
+
* bearer or daemon token here would be discarded as browser context.
|
|
72
75
|
*/
|
|
73
76
|
headers?: Record<string, string>;
|
|
74
77
|
}
|
|
@@ -99,6 +102,14 @@ export declare const pick_rpc_auth: (method: AppSurfaceRpcMethod, keeper: Keeper
|
|
|
99
102
|
* answer 401 (a login with a wrong password), and so may a handler refusing
|
|
100
103
|
* an authenticated call with a reason of its own (`invalid_credentials`).
|
|
101
104
|
*
|
|
105
|
+
* A 403 `credential_type_required` fails too: the principal was picked
|
|
106
|
+
* because the method's auth admits its credential type
|
|
107
|
+
* (`pick_auth_principal`), so that refusal means the credential never
|
|
108
|
+
* arrived as sent — dropped on the way, or another one answering in its
|
|
109
|
+
* place (a daemon token discarded as browser context behind a session
|
|
110
|
+
* cookie). A method admitting no credential the round trip sends (a session
|
|
111
|
+
* or the daemon token) can't be driven here; skip it.
|
|
112
|
+
*
|
|
102
113
|
* @param method - the RPC method name
|
|
103
114
|
* @param status - the HTTP status
|
|
104
115
|
* @param body - the parsed response body (or raw text when not JSON)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_round_trip.d.ts","sourceRoot":"","sources":["../../src/lib/testing/rpc_round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc_round_trip.d.ts","sourceRoot":"","sources":["../../src/lib/testing/rpc_round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAwC7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAQN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAON,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,mDAAmD;AACnD,MAAM,WAAW,uBAAuB;IACvC,kEAAkE;IAClE,UAAU,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B;;;;;OAKG;IACH,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;OAKG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC,qDAAqD;IACrD,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,6EAA6E;IAC7E,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;CACtC;AAED,oFAAoF;AACpF,MAAM,WAAW,qBAAqB;IACrC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,0GAA0G;AAC1G,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEzF,0GAA0G;AAC1G,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAEhE,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GACzB,QAAQ,mBAAmB,EAC3B,QAAQ,oBAAoB,EAC5B,gBAAgB,WAAW,EAC3B,eAAe,WAAW,KACxB,gBAMF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,wBAAwB,GACpC,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,MAAM,OAAO,EACb,WAAW,aAAa,KACtB,IAwBF,CAAC;AA8GF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,6BAA6B,GAAI,SAAS,uBAAuB,KAAG,IAqKhF,CAAC"}
|
|
@@ -30,9 +30,10 @@ import { is, parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
|
30
30
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
31
31
|
import { JSONRPC_INTERNAL_ERROR, JSONRPC_METHOD_NOT_FOUND, JsonrpcErrorResponse } from '../http/jsonrpc.js';
|
|
32
32
|
import { jsonrpc_error_code_to_http_status } from '../http/jsonrpc_errors.js';
|
|
33
|
+
import { ERROR_CREDENTIAL_TYPE_REQUIRED } from '../http/error_schemas.js';
|
|
33
34
|
import { generate_valid_body } from './schema_generators.js';
|
|
34
35
|
import { create_rpc_post_init, create_rpc_get_url, assert_jsonrpc_error_response, assert_jsonrpc_success_response, resolve_rpc_endpoints_for_setup, find_rpc_action, find_rpc_method } from './rpc_helpers.js';
|
|
35
|
-
import { is_unauthenticated_refusal, pick_auth_principal, round_trip_uses_fresh_account, to_principal_headers } from './integration_helpers.js';
|
|
36
|
+
import { is_credential_type_refusal, is_unauthenticated_refusal, pick_auth_principal, round_trip_uses_fresh_account, to_principal_headers, to_principal_transport } from './integration_helpers.js';
|
|
36
37
|
/**
|
|
37
38
|
* Pick the principal matching an RPC method's auth requirement
|
|
38
39
|
* (`pick_auth_principal`, shared with the REST round-trip), and the headers
|
|
@@ -57,6 +58,14 @@ export const pick_rpc_auth = (method, keeper, authed_account, admin_account) =>
|
|
|
57
58
|
* answer 401 (a login with a wrong password), and so may a handler refusing
|
|
58
59
|
* an authenticated call with a reason of its own (`invalid_credentials`).
|
|
59
60
|
*
|
|
61
|
+
* A 403 `credential_type_required` fails too: the principal was picked
|
|
62
|
+
* because the method's auth admits its credential type
|
|
63
|
+
* (`pick_auth_principal`), so that refusal means the credential never
|
|
64
|
+
* arrived as sent — dropped on the way, or another one answering in its
|
|
65
|
+
* place (a daemon token discarded as browser context behind a session
|
|
66
|
+
* cookie). A method admitting no credential the round trip sends (a session
|
|
67
|
+
* or the daemon token) can't be driven here; skip it.
|
|
68
|
+
*
|
|
60
69
|
* @param method - the RPC method name
|
|
61
70
|
* @param status - the HTTP status
|
|
62
71
|
* @param body - the parsed response body (or raw text when not JSON)
|
|
@@ -68,6 +77,11 @@ export const assert_rpc_authenticated = (method, status, body, principal) => {
|
|
|
68
77
|
const parsed = parse(JsonrpcErrorResponse, body);
|
|
69
78
|
const data = parsed.ok ? parsed.value.error.data : undefined;
|
|
70
79
|
const reason = data !== null && typeof data === 'object' ? data.reason : undefined;
|
|
80
|
+
if (is_credential_type_refusal(status, reason)) {
|
|
81
|
+
assert.fail(`method '${method}' answered 403 ${ERROR_CREDENTIAL_TYPE_REQUIRED} to the ${principal}` +
|
|
82
|
+
` principal (data ${JSON.stringify(data)}) — the principal was picked because the` +
|
|
83
|
+
` method's auth admits its credential type, so the credential never arrived as sent`);
|
|
84
|
+
}
|
|
71
85
|
if (!is_unauthenticated_refusal(status, reason))
|
|
72
86
|
return;
|
|
73
87
|
const detail = parsed.ok
|
|
@@ -231,7 +245,7 @@ export const describe_rpc_round_trip_tests = (options) => {
|
|
|
231
245
|
: picked;
|
|
232
246
|
const init = create_rpc_post_init(action.spec.method, params);
|
|
233
247
|
Object.assign(init.headers, headers);
|
|
234
|
-
const res = await fixture
|
|
248
|
+
const res = await to_principal_transport(principal, fixture)(ep_spec.path, init);
|
|
235
249
|
const body = await read_rpc_body(res);
|
|
236
250
|
try {
|
|
237
251
|
if (res.ok) {
|
|
@@ -263,7 +277,7 @@ export const describe_rpc_round_trip_tests = (options) => {
|
|
|
263
277
|
const params = override ?? generate_valid_body(action.spec.input) ?? undefined;
|
|
264
278
|
const { principal, headers } = pick_rpc_auth(surface_method, fixture, authed_account, admin_account);
|
|
265
279
|
const url = create_rpc_get_url(ep_spec.path, action.spec.method, params);
|
|
266
|
-
const res = await fixture
|
|
280
|
+
const res = await to_principal_transport(principal, fixture)(url, { headers });
|
|
267
281
|
const body = await read_rpc_body(res);
|
|
268
282
|
try {
|
|
269
283
|
if (res.ok) {
|
|
@@ -289,11 +303,16 @@ export const describe_rpc_round_trip_tests = (options) => {
|
|
|
289
303
|
const surface = find_rpc_method(surface_rpc_endpoints, method);
|
|
290
304
|
assert.ok(surface, `success_fixtures method '${method}' missing from generated surface`);
|
|
291
305
|
const fixture_case = await build(fixture);
|
|
292
|
-
const
|
|
293
|
-
|
|
306
|
+
const picked = pick_rpc_auth(surface.method_spec, fixture, authed_account, admin_account);
|
|
307
|
+
const headers = fixture_case.headers ?? picked.headers;
|
|
294
308
|
const init = create_rpc_post_init(method, fixture_case.params);
|
|
295
309
|
Object.assign(init.headers, headers);
|
|
296
|
-
|
|
310
|
+
// a fixture's own headers carry a session cookie, sent with no jar so
|
|
311
|
+
// the keeper's can't stand in for one they lack
|
|
312
|
+
const transport = fixture_case.headers
|
|
313
|
+
? fixture.fresh_transport()
|
|
314
|
+
: to_principal_transport(picked.principal, fixture);
|
|
315
|
+
const res = await transport(located.path, init);
|
|
297
316
|
const body = await read_rpc_body(res);
|
|
298
317
|
try {
|
|
299
318
|
assert_method_implemented(method, body);
|
|
@@ -212,8 +212,8 @@ export type RouteParamValues = Readonly<Record<string, Readonly<Record<string, s
|
|
|
212
212
|
* A `{re}` param's value, supplied or not, must match its pattern, grouped
|
|
213
213
|
* and anchored as Hono's RegExpRouter reads it — the stricter of its
|
|
214
214
|
* routers' readings, as TrieRouter leaves a top-level alternation ungrouped
|
|
215
|
-
* (`compile_route_param_pattern`, over the value
|
|
216
|
-
*
|
|
215
|
+
* (`compile_route_param_pattern`, over the percent-encoded value the router
|
|
216
|
+
* matches) — or the request would reach no route; no value is
|
|
217
217
|
* guessed from the pattern. A supplied value the URL would normalize away
|
|
218
218
|
* (`''`, `.`, `..`) is refused by name.
|
|
219
219
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_generators.d.ts","sourceRoot":"","sources":["../../src/lib/testing/schema_generators.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;GAUG;AAEH,OAAO,EAEN,KAAK,SAAS,EAEd,KAAK,YAAY,EACjB,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EAIN,KAAK,eAAe,EACpB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"schema_generators.d.ts","sourceRoot":"","sources":["../../src/lib/testing/schema_generators.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;GAUG;AAEH,OAAO,EAEN,KAAK,SAAS,EAEd,KAAK,YAAY,EACjB,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EAIN,KAAK,eAAe,EACpB,MAAM,2BAA2B,CAAC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AAM,EAAE,OAAO,CAAC,GAAG,IA8B5B,CAAC;AAsCF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B,GACvC,OAAO,eAAe,EACtB,cAAc,SAAS,KACrB,MAAM,GAAG,IA2BX,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,SAAS,EAAE,OAAO,MAAM,KAAG,gBAAgB,GAAG,IAgBzF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,MACL,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,kBAAkB,GAC9B,MAAM,MAAM,EACZ,gBAAgB,SAAS,EACzB,eAAe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAC7C,MA+DF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC/B,cAAc,SAAS,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAW5B,CAAC"}
|
|
@@ -14,7 +14,7 @@ import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
|
14
14
|
import { get_schema_entries, get_schema_fields, unwrap_schema } from '@fuzdev/fuz_schema/introspect.ts';
|
|
15
15
|
import { to_json_schema } from '@fuzdev/fuz_schema/json_schema.ts';
|
|
16
16
|
import { is_null_schema, is_void_schema } from '../http/schema_helpers.js';
|
|
17
|
-
import { compile_route_param_pattern,
|
|
17
|
+
import { compile_route_param_pattern, parse_route_param, split_route_template } from '../http/route_error_check.js';
|
|
18
18
|
import { assert_validation_schema, format_issues } from '../schema_issues.js';
|
|
19
19
|
/**
|
|
20
20
|
* The JSON Schema of a field's input side — where its format, pattern and
|
|
@@ -672,8 +672,8 @@ export const to_route_content_type = (route) => route.raw_body ? 'application/oc
|
|
|
672
672
|
* A `{re}` param's value, supplied or not, must match its pattern, grouped
|
|
673
673
|
* and anchored as Hono's RegExpRouter reads it — the stricter of its
|
|
674
674
|
* routers' readings, as TrieRouter leaves a top-level alternation ungrouped
|
|
675
|
-
* (`compile_route_param_pattern`, over the value
|
|
676
|
-
*
|
|
675
|
+
* (`compile_route_param_pattern`, over the percent-encoded value the router
|
|
676
|
+
* matches) — or the request would reach no route; no value is
|
|
677
677
|
* guessed from the pattern. A supplied value the URL would normalize away
|
|
678
678
|
* (`''`, `.`, `..`) is refused by name.
|
|
679
679
|
*
|
|
@@ -728,7 +728,7 @@ export const resolve_valid_path = (path, params_schema, param_values) => {
|
|
|
728
728
|
names.add(name);
|
|
729
729
|
const supplied = param_values && Object.hasOwn(param_values, name) ? param_values[name] : undefined;
|
|
730
730
|
const value = supplied === undefined ? generate(name) : encode_supplied(name, supplied);
|
|
731
|
-
if (pattern !== null && !compile_route_param_pattern(pattern).test(
|
|
731
|
+
if (pattern !== null && !compile_route_param_pattern(pattern).test(value)) {
|
|
732
732
|
throw new Error(`resolve_valid_path: the param \`${name}\` of \`${path}\` resolves to ${JSON.stringify(value)}${supplied === undefined ? ',' : ', the value supplied for it,'} which its pattern \`{${pattern}}\` refuses, so the request would reach no route — supply a value the pattern accepts in the suite's \`param_values\`, under the route's key (\`'METHOD ${path}'\`) and then \`${name}\``);
|
|
733
733
|
}
|
|
734
734
|
return value;
|
package/dist/testing/stubs.d.ts
CHANGED
|
@@ -194,8 +194,8 @@ export interface CreateTestAppSurfaceSpecOptions {
|
|
|
194
194
|
/**
|
|
195
195
|
* Bootstrap config — symmetric with `AppServerOptions.bootstrap`. Discriminated
|
|
196
196
|
* by `mode`: `'disabled'` skips the route (same as omission), `'surface_only'`
|
|
197
|
-
* mounts the route shape, `'live'` accepts a `
|
|
198
|
-
* symmetry (surface assembly only
|
|
197
|
+
* mounts the route shape, `'live'` accepts a `token_store` for production
|
|
198
|
+
* symmetry (surface assembly reads only the shape; the store is a
|
|
199
199
|
* live-execution concern handled by `create_test_app` → `create_app_server`).
|
|
200
200
|
*
|
|
201
201
|
* Surface assembly only reads `route_prefix` (default `'/api/account'`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/lib/testing/stubs.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAGN,KAAK,UAAU,EACf,KAAK,SAAS,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAInE,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,KAAK,EAAE,SAAS,EAAmB,M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,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,KAAK,CAAC,cAAc,CAAC,CAAC;IAC/E;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC9C;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,cAkHF,CAAC"}
|
package/dist/testing/stubs.js
CHANGED
|
@@ -93,7 +93,7 @@ export const create_stub_db = () => new Db({
|
|
|
93
93
|
transaction: async (fn) => fn(create_stub_db())
|
|
94
94
|
});
|
|
95
95
|
/** Stub handler that answers a 200 `stub` text response, as a raw result. */
|
|
96
|
-
export const stub_handler = () => route_raw(
|
|
96
|
+
export const stub_handler = () => route_raw({ status: 200, headers: { 'Content-Type': 'text/plain;charset=UTF-8' }, body: 'stub' });
|
|
97
97
|
/**
|
|
98
98
|
* A route spec for a surface that is described and never served — a
|
|
99
99
|
* backend's routes declared from their shapes: `shape` with a handler that
|
|
@@ -161,11 +161,11 @@ export const create_stub_audit_sse = () => {
|
|
|
161
161
|
* Create no-op `AppDeps` for auth surface testing.
|
|
162
162
|
*/
|
|
163
163
|
export const create_stub_app_deps = () => ({
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
// `sign` answers a string, as a keyring does: `create_app_server` mints a
|
|
165
|
+
// sample session cookie at assembly and refuses a value that is none
|
|
166
|
+
keyring: create_noop_stub('keyring', {
|
|
167
|
+
sign: async (value) => `${value}.stub_signature`
|
|
168
|
+
}),
|
|
169
169
|
password: create_noop_stub('password'),
|
|
170
170
|
db: stub_db,
|
|
171
171
|
log: new Logger('test', { level: 'off' }),
|
|
@@ -242,7 +242,7 @@ export const create_stub_app_server_context = (session_options) => {
|
|
|
242
242
|
return {
|
|
243
243
|
deps: backend.deps,
|
|
244
244
|
backend,
|
|
245
|
-
bootstrap_status: { available: false
|
|
245
|
+
bootstrap_status: { available: false },
|
|
246
246
|
session_options,
|
|
247
247
|
login_ip_rate_limiter: null,
|
|
248
248
|
signup_ip_rate_limiter: null,
|
|
@@ -337,7 +337,7 @@ export const create_test_app_surface_spec = (options) => {
|
|
|
337
337
|
// and `live` modes; omitted for `disabled` / undefined. Surface generation
|
|
338
338
|
// uses an `available: false` placeholder regardless of mode — the handler
|
|
339
339
|
// short-circuits to 403 ALREADY_BOOTSTRAPPED, which is what surface tests
|
|
340
|
-
// assert on.
|
|
340
|
+
// assert on. A live token store is passed through for shape symmetry only.
|
|
341
341
|
const bootstrap_route_specs = options.bootstrap && options.bootstrap.mode !== 'disabled'
|
|
342
342
|
? prefix_route_specs(options.bootstrap.route_prefix ?? '/api/account', [
|
|
343
343
|
// Surface generation reads the route shape only — the live hono
|
|
@@ -18,7 +18,10 @@ import '../assert_dev_env.js';
|
|
|
18
18
|
* The cookie jar is intentionally simple — it does not honour `Domain`,
|
|
19
19
|
* `Path`, `Expires`, or `SameSite` attributes. Cross-process tests
|
|
20
20
|
* always hit a single host:port, so name-keyed last-write-wins matches
|
|
21
|
-
* the behaviour real browsers exhibit against the same surface.
|
|
21
|
+
* the behaviour real browsers exhibit against the same surface. It does
|
|
22
|
+
* honour a `Max-Age` of zero or less, dropping the cookie as a browser does:
|
|
23
|
+
* a cleared session cookie kept as `name=` would be re-sent as an invalid
|
|
24
|
+
* cookie, which both spines answer by clearing it again.
|
|
22
25
|
*
|
|
23
26
|
* @module
|
|
24
27
|
*/
|
|
@@ -64,8 +67,8 @@ export interface FetchTransport extends RpcTestTransport {
|
|
|
64
67
|
/**
|
|
65
68
|
* Build a cookie-threading transport pinned to `options.base_url`. The
|
|
66
69
|
* returned function carries a private `Map<name, cookie-head>` jar that
|
|
67
|
-
* updates on every response's `Set-Cookie`
|
|
68
|
-
* subsequent request.
|
|
70
|
+
* updates on every response's `Set-Cookie` (a `Max-Age<=0` one deletes its
|
|
71
|
+
* cookie) and re-sends on every subsequent request.
|
|
69
72
|
*
|
|
70
73
|
* Request rewriting:
|
|
71
74
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_transport.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/transports/fetch_transport.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B
|
|
1
|
+
{"version":3,"file":"fetch_transport.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/transports/fetch_transport.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,yDAAyD;AACzD,MAAM,WAAW,qBAAqB;IACrC,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACvD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9C;AAsCD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,qBAAqB,KAAG,cAmCvE,CAAC"}
|