@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
|
@@ -101,7 +101,8 @@ export interface MintTestSessionOptions {
|
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Mint a real `auth_session` row for an existing account and return a
|
|
104
|
-
* validly-signed session cookie value referencing it
|
|
104
|
+
* validly-signed session cookie value referencing it, with the row's id (the
|
|
105
|
+
* token's hash) for a caller that revokes it. Test-only — the
|
|
105
106
|
* forge behind the cross-backend expiry conformance cases (the
|
|
106
107
|
* `expired_session` principal): pass a negative `expires_in_seconds` to
|
|
107
108
|
* produce an *expired server-side session* whose signed cookie envelope is
|
|
@@ -113,6 +114,7 @@ export interface MintTestSessionOptions {
|
|
|
113
114
|
*/
|
|
114
115
|
export declare const mint_test_session: (options: MintTestSessionOptions) => Promise<{
|
|
115
116
|
session_cookie: string;
|
|
117
|
+
session_hash: string;
|
|
116
118
|
}>;
|
|
117
119
|
/**
|
|
118
120
|
* Bootstrap the test-DB keeper. Direct-query shortcut for the default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAU5D,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3E,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEN,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAOvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAKhE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAIhC,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAA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MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,cAAc,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9B,kEAAkE;IAClE,sBAAsB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnF,gEAAgE;IAChE,qBAAqB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClF,iEAAiE;IACjE,2BAA2B,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxF,qDAAqD;IACrD,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7E,2PAA2P;IAC3P,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC,QAAO,IAAI,CACzD,gBAAgB,EAChB,iBAAiB,GAAG,OAAO,GAAG,YAAY,CAa1C,CAAC;AAgCF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS,oBAAoB,KAAG,OAAO,CAAC,OAAO,CAqFpF,CAAC"}
|
|
@@ -121,7 +121,8 @@ export const create_test_account_with_credentials = async (options) => {
|
|
|
121
121
|
};
|
|
122
122
|
/**
|
|
123
123
|
* Mint a real `auth_session` row for an existing account and return a
|
|
124
|
-
* validly-signed session cookie value referencing it
|
|
124
|
+
* validly-signed session cookie value referencing it, with the row's id (the
|
|
125
|
+
* token's hash) for a caller that revokes it. Test-only — the
|
|
125
126
|
* forge behind the cross-backend expiry conformance cases (the
|
|
126
127
|
* `expired_session` principal): pass a negative `expires_in_seconds` to
|
|
127
128
|
* produce an *expired server-side session* whose signed cookie envelope is
|
|
@@ -138,7 +139,7 @@ export const mint_test_session = async (options) => {
|
|
|
138
139
|
const expires_at = new Date(Date.now() + expires_in_seconds * 1000);
|
|
139
140
|
await query_create_session({ db }, session_hash, account_id, expires_at);
|
|
140
141
|
const session_cookie = await create_session_cookie_value(keyring, session_token, session_options);
|
|
141
|
-
return { session_cookie };
|
|
142
|
+
return { session_cookie, session_hash };
|
|
142
143
|
};
|
|
143
144
|
/**
|
|
144
145
|
* Bootstrap the test-DB keeper. Direct-query shortcut for the default
|
|
@@ -164,12 +165,6 @@ export const bootstrap_test_keeper = async (options) => {
|
|
|
164
165
|
};
|
|
165
166
|
/** Silent logger for tests — suppresses all output. */
|
|
166
167
|
const test_log = new Logger('test', { level: 'off' });
|
|
167
|
-
const test_fs_stubs = {
|
|
168
|
-
read_secure_file: async (path) => {
|
|
169
|
-
throw new Error(`ENOENT: no such file or directory: ${path}`);
|
|
170
|
-
},
|
|
171
|
-
delete_file: async () => { }
|
|
172
|
-
};
|
|
173
168
|
/**
|
|
174
169
|
* Backend-assembly path for `create_test_app_server`. Returns the raw
|
|
175
170
|
* `AppBackend` + the keyring used to sign session cookies.
|
|
@@ -223,8 +218,7 @@ const _build_test_backend = async (options) => {
|
|
|
223
218
|
db,
|
|
224
219
|
log: test_log,
|
|
225
220
|
audit: audit_factory({ db, log: test_log }),
|
|
226
|
-
connection_closer: create_realtime_closer()
|
|
227
|
-
...test_fs_stubs
|
|
221
|
+
connection_closer: create_realtime_closer()
|
|
228
222
|
}
|
|
229
223
|
};
|
|
230
224
|
return { backend, keyring: keyring_result.keyring };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_apps.d.ts","sourceRoot":"","sources":["../../src/lib/testing/auth_apps.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;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AO,MAAM,qBAAqB,GACjC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,KAClB,YAsBF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,YAAY,EAAE,MAAM,SAAS,KAAG,IAwBrE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACpC,aAAa,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,KACpC,CAAC,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAGvD,CAAC"}
|
|
@@ -19,6 +19,7 @@ import { REQUEST_CONTEXT_KEY, create_fuz_authorization_handler } from '../auth/r
|
|
|
19
19
|
import { RESOLVED_AUTH_KEY, TEST_CONTEXT_PRESET, TEST_CONTEXT_PRESET_KEY } from '../hono_context.js';
|
|
20
20
|
import { create_test_resolved_auth } from './resolved_auth.js';
|
|
21
21
|
import { create_stub_db } from './stubs.js';
|
|
22
|
+
import { create_sse_stream } from '../realtime/sse.js';
|
|
22
23
|
import { create_test_account, create_test_actor, create_test_role_grant } from './entities.js';
|
|
23
24
|
/**
|
|
24
25
|
* Create a mock `RequestContext` with optional role role_grant.
|
|
@@ -51,7 +52,7 @@ export const create_test_app_from_specs = (route_specs, auth_ctx, credential_typ
|
|
|
51
52
|
}
|
|
52
53
|
await next();
|
|
53
54
|
});
|
|
54
|
-
apply_route_specs(app, route_specs, fuz_auth_guard_resolver, new Logger('test', { level: 'off' }), db, create_fuz_authorization_handler({ db }));
|
|
55
|
+
apply_route_specs(app, route_specs, fuz_auth_guard_resolver, new Logger('test', { level: 'off' }), db, { authorize: create_fuz_authorization_handler({ db }), open_sse: create_sse_stream });
|
|
55
56
|
return app;
|
|
56
57
|
};
|
|
57
58
|
/**
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import type { RpcPathCapabilityGatedCrossSuiteOptions } from './setup.js';
|
|
3
3
|
/**
|
|
4
|
-
* Options for the account-lifecycle parity suite
|
|
4
|
+
* Options for the account-lifecycle parity suite: the standard
|
|
5
5
|
* capability-gating RPC-dispatched cross-suite shape (`setup_test` /
|
|
6
|
-
* `capabilities` / `rpc_path`)
|
|
7
|
-
*
|
|
6
|
+
* `capabilities` / `rpc_path`) plus the two REST account routes the
|
|
7
|
+
* credential cases call.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export interface AccountLifecycleCrossTestOptions extends RpcPathCapabilityGatedCrossSuiteOptions {
|
|
10
|
+
/** REST login route path. Default `/api/account/login`. */
|
|
11
|
+
readonly login_path?: string;
|
|
12
|
+
/** REST password-change route path. Default `/api/account/password`. */
|
|
13
|
+
readonly password_path?: string;
|
|
14
|
+
/** REST signup route path. Default `/api/account/signup`. */
|
|
15
|
+
readonly signup_path?: string;
|
|
16
|
+
}
|
|
10
17
|
export declare const describe_account_lifecycle_cross_tests: (options: AccountLifecycleCrossTestOptions) => void;
|
|
11
18
|
//# sourceMappingURL=account_lifecycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/account_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"account_lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/account_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA2E9B,OAAO,KAAK,EAAE,uCAAuC,EAAe,MAAM,YAAY,CAAC;AAQvF;;;;;GAKG;AACH,MAAM,WAAW,gCAAiC,SAAQ,uCAAuC;IAChG,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAQD,eAAO,MAAM,sCAAsC,GAClD,SAAS,gCAAgC,KACvC,IAy2BF,CAAC"}
|
|
@@ -8,26 +8,133 @@ import '../assert_dev_env.js';
|
|
|
8
8
|
*
|
|
9
9
|
* Like the cell suites, these verbs can't ride the generic
|
|
10
10
|
* `describe_rpc_round_trip_tests`: they're stateful and destructive (a
|
|
11
|
-
* generic round-trip would tombstone the bootstrapped keeper). They
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* generic round-trip would tombstone the bootstrapped keeper). They are on
|
|
12
|
+
* the declared surface, so shape and auth are auto-enumerated; this suite is
|
|
13
|
+
* the behavioral parity the generic round-trip can't drive. Every success
|
|
14
14
|
* `result` is parsed against the verb's declared **output** schema, so
|
|
15
15
|
* a TS↔Rust envelope drift fails the assertion.
|
|
16
16
|
*
|
|
17
|
+
* Also pinned: a soft-deleted account's session and bearer stop
|
|
18
|
+
* authenticating; a bearer self-delete is 403 `credential_type_required` with
|
|
19
|
+
* the session left live; the delete, undelete and purge success rows snapshot
|
|
20
|
+
* the victim's `username`; the keeper guard and a second undelete each write
|
|
21
|
+
* an `outcome: 'failure'` row; `admin_account_list` with `include_deleted`
|
|
22
|
+
* lists tombstoned rows with `deleted_at` set.
|
|
23
|
+
*
|
|
24
|
+
* Two credential end states, each proven live before it is killed: a session
|
|
25
|
+
* and an API token minted before a soft delete stay dead after the undelete
|
|
26
|
+
* (the delete removed their rows, and the undelete clears only the
|
|
27
|
+
* tombstones), each answering as an anonymous request does, while a fresh
|
|
28
|
+
* login authenticates; and a password change made over one session ends the
|
|
29
|
+
* account's other session and its API token as well as its own, leaves
|
|
30
|
+
* another account's session live, and only the new password logs in. The
|
|
31
|
+
* password case needs no lifecycle verb, so it runs on every backend.
|
|
32
|
+
*
|
|
33
|
+
* What an undelete brings back, and what it doesn't. The account's role
|
|
34
|
+
* grants are kept through the delete — listed, conferring nothing while no
|
|
35
|
+
* credential of the account authenticates — and confer again once a fresh
|
|
36
|
+
* login has a session. Nothing the delete ended comes back: the offers made to
|
|
37
|
+
* the account, account- and actor-addressed, stay superseded (gone from its
|
|
38
|
+
* inbox, an accept answers `role_grant_offer_terminal` and grants nothing),
|
|
39
|
+
* and the unclaimed invites it issued stay deleted, a signup with one
|
|
40
|
+
* answering what a signup with no invite answers, while the invite it issued
|
|
41
|
+
* that was already claimed is untouched.
|
|
42
|
+
*
|
|
17
43
|
* @module
|
|
18
44
|
*/
|
|
19
|
-
import { describe, assert } from 'vitest';
|
|
20
|
-
import { AccountDeleteOutput, AccountUndeleteOutput, AccountPurgeOutput, AdminAccountListOutput, ERROR_CANNOT_DELETE_KEEPER } from '../../auth/admin_action_specs.js';
|
|
45
|
+
import { describe, assert, test } from 'vitest';
|
|
46
|
+
import { AccountDeleteOutput, AccountUndeleteOutput, AccountPurgeOutput, AdminAccountListOutput, ERROR_CANNOT_DELETE_KEEPER, InviteListOutput } from '../../auth/admin_action_specs.js';
|
|
47
|
+
import { ERROR_ROLE_GRANT_OFFER_TERMINAL, RoleGrantOfferHistoryOutput, RoleGrantOfferListOutput } from '../../auth/role_grant_offer_action_specs.js';
|
|
48
|
+
import { ROLE_ADMIN } from '../../auth/role_schema.js';
|
|
49
|
+
import { JSONRPC_INVALID_REQUEST } from '../../http/jsonrpc.js';
|
|
21
50
|
import { ERROR_ACCOUNT_NOT_FOUND, ERROR_AUTHENTICATION_REQUIRED, ERROR_CREDENTIAL_TYPE_REQUIRED } from '../../http/error_schemas.js';
|
|
22
51
|
import { JSONRPC_ERROR_CODES } from '../../http/jsonrpc_errors.js';
|
|
23
52
|
import { assert_audit_metadata_fields, list_audit_events } from './audit_cross_helpers.js';
|
|
24
53
|
import { test_if } from './capabilities.js';
|
|
25
54
|
import { cross_rpc_call, error_reason, expect_output } from './cross_rpc.js';
|
|
26
55
|
import { assert_iso8601_seconds } from './wire_shapes.js';
|
|
27
|
-
import {
|
|
56
|
+
import { create_test_request_headers } from '../test_origin.js';
|
|
57
|
+
import { SPINE_ACCOUNT_LOGIN_PATH, SPINE_ACCOUNT_PASSWORD_PATH, SPINE_ACCOUNT_SIGNUP_PATH, SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
58
|
+
/** The password the credential cases create their accounts with. */
|
|
59
|
+
const LIFECYCLE_PASSWORD = 'lifecycle-password-before';
|
|
60
|
+
/** The password the password-change case changes to. */
|
|
61
|
+
const LIFECYCLE_PASSWORD_CHANGED = 'lifecycle-password-after';
|
|
28
62
|
export const describe_account_lifecycle_cross_tests = (options) => {
|
|
29
63
|
const { setup_test, capabilities } = options;
|
|
30
64
|
const rpc_path = options.rpc_path ?? SPINE_RPC_PATH;
|
|
65
|
+
const login_path = options.login_path ?? SPINE_ACCOUNT_LOGIN_PATH;
|
|
66
|
+
const password_path = options.password_path ?? SPINE_ACCOUNT_PASSWORD_PATH;
|
|
67
|
+
const signup_path = options.signup_path ?? SPINE_ACCOUNT_SIGNUP_PATH;
|
|
68
|
+
/** One RPC call on a fresh transport carrying `headers` alone. */
|
|
69
|
+
const rpc = (fixture, method, params, headers) => cross_rpc_call(fixture.fresh_transport(), rpc_path, method, params, headers);
|
|
70
|
+
/** `account_delete` of `account_id`, as the keeper. */
|
|
71
|
+
const delete_account = async (fixture, account_id) => {
|
|
72
|
+
const res = await rpc(fixture, 'account_delete', { account_id }, fixture.create_session_headers());
|
|
73
|
+
assert.ok(res.ok, `account_delete must succeed: ${JSON.stringify(res)}`);
|
|
74
|
+
};
|
|
75
|
+
/** `account_undelete` of `account_id`, as the keeper. */
|
|
76
|
+
const undelete_account = async (fixture, account_id) => {
|
|
77
|
+
const res = await rpc(fixture, 'account_undelete', { account_id }, fixture.create_session_headers());
|
|
78
|
+
assert.ok(res.ok, `account_undelete must succeed: ${JSON.stringify(res)}`);
|
|
79
|
+
};
|
|
80
|
+
/** `account`'s `admin_account_list` entry, tombstoned or not. */
|
|
81
|
+
const listed_account = async (fixture, account_id) => {
|
|
82
|
+
const { accounts } = expect_output(await rpc(fixture, 'admin_account_list', { include_deleted: true }, fixture.create_session_headers()), AdminAccountListOutput);
|
|
83
|
+
const entry = accounts.find((a) => a.account.id === account_id);
|
|
84
|
+
assert.ok(entry, 'admin_account_list lists the account');
|
|
85
|
+
return entry;
|
|
86
|
+
};
|
|
87
|
+
/** A signup with `username` on a fresh transport, its status and body. */
|
|
88
|
+
const signup = async (fixture, username) => {
|
|
89
|
+
const res = await fixture.fresh_transport()(signup_path, {
|
|
90
|
+
method: 'POST',
|
|
91
|
+
headers: create_test_request_headers({ 'content-type': 'application/json' }),
|
|
92
|
+
body: JSON.stringify({ username, password: LIFECYCLE_PASSWORD })
|
|
93
|
+
});
|
|
94
|
+
return { status: res.status, body: await res.json() };
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* `account_verify` carrying `headers` and no other credential — a
|
|
98
|
+
* cookie-free transport, no `Origin` added (a bearer beside one is
|
|
99
|
+
* discarded as browser context).
|
|
100
|
+
*/
|
|
101
|
+
const verify = (fixture, headers) => cross_rpc_call(fixture.fresh_transport({ origin: null }), rpc_path, 'account_verify', undefined, headers);
|
|
102
|
+
/** Who `headers` authenticate as: the account id `account_verify` answers, or `null`. */
|
|
103
|
+
const verified_account_id = async (fixture, headers) => {
|
|
104
|
+
const res = await verify(fixture, headers);
|
|
105
|
+
return res.ok ? res.result.id : null;
|
|
106
|
+
};
|
|
107
|
+
/** A request carrying no credential, with `account`'s non-credential headers. */
|
|
108
|
+
const anonymous_headers = (account) => {
|
|
109
|
+
const { authorization: _, ...rest } = account.create_bearer_headers();
|
|
110
|
+
return rest;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Assert `headers` answer exactly as an anonymous request does — a dead
|
|
114
|
+
* credential must not be told apart from no credential.
|
|
115
|
+
*/
|
|
116
|
+
const assert_answers_as_anonymous = async (fixture, account, headers, label) => {
|
|
117
|
+
const dead = await verify(fixture, headers);
|
|
118
|
+
const anonymous = await verify(fixture, anonymous_headers(account));
|
|
119
|
+
assert.strictEqual(anonymous.status, 401, 'the anonymous control is refused');
|
|
120
|
+
assert.strictEqual(dead.status, anonymous.status, label);
|
|
121
|
+
assert.strictEqual(error_reason(dead), ERROR_AUTHENTICATION_REQUIRED, label);
|
|
122
|
+
assert.deepStrictEqual(dead.error, anonymous.error, label);
|
|
123
|
+
};
|
|
124
|
+
/** Log in on a fresh transport; the session cookie the login sets, as a `Cookie` value. */
|
|
125
|
+
const login = async (fixture, username, password) => {
|
|
126
|
+
const res = await fixture.fresh_transport()(login_path, {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
headers: create_test_request_headers({ 'content-type': 'application/json' }),
|
|
129
|
+
body: JSON.stringify({ username, password })
|
|
130
|
+
});
|
|
131
|
+
await res.body?.cancel();
|
|
132
|
+
const lines = res.headers.getSetCookie();
|
|
133
|
+
if (res.status !== 200)
|
|
134
|
+
return { status: res.status, cookie: null };
|
|
135
|
+
assert.strictEqual(lines.length, 1, 'a login sets exactly the session cookie');
|
|
136
|
+
return { status: res.status, cookie: lines[0].split(';')[0] };
|
|
137
|
+
};
|
|
31
138
|
describe('account lifecycle parity', () => {
|
|
32
139
|
test_if(capabilities.account_lifecycle, 'soft-delete → undelete round-trip (admin)', async () => {
|
|
33
140
|
const fixture = await setup_test();
|
|
@@ -195,5 +302,169 @@ export const describe_account_lifecycle_cross_tests = (options) => {
|
|
|
195
302
|
assert_iso8601_seconds(row.account.updated_at, 'admin_account_list.updated_at');
|
|
196
303
|
assert_iso8601_seconds(row.account.deleted_at, 'admin_account_list.deleted_at');
|
|
197
304
|
});
|
|
305
|
+
test_if(capabilities.account_lifecycle, 'credentials minted before a delete stay dead after the undelete; a fresh login authenticates', async () => {
|
|
306
|
+
const fixture = await setup_test();
|
|
307
|
+
const victim = await fixture.create_account({
|
|
308
|
+
username: 'lifecycle_revived',
|
|
309
|
+
password_value: LIFECYCLE_PASSWORD
|
|
310
|
+
});
|
|
311
|
+
const admin_headers = fixture.create_session_headers();
|
|
312
|
+
const victim_id = victim.account.id;
|
|
313
|
+
// each credential authenticates as the victim before the delete, so
|
|
314
|
+
// its refusal after the undelete is a transition
|
|
315
|
+
assert.strictEqual(await verified_account_id(fixture, victim.create_session_headers()), victim_id);
|
|
316
|
+
assert.strictEqual(await verified_account_id(fixture, victim.create_bearer_headers()), victim_id);
|
|
317
|
+
for (const method of ['account_delete', 'account_undelete']) {
|
|
318
|
+
const res = await cross_rpc_call(fixture.fresh_transport(), rpc_path, method, { account_id: victim_id }, admin_headers);
|
|
319
|
+
assert.ok(res.ok, `${method} must succeed: ${JSON.stringify(res)}`);
|
|
320
|
+
}
|
|
321
|
+
await assert_answers_as_anonymous(fixture, victim, victim.create_session_headers(), 'a session minted before the delete stays dead after the undelete');
|
|
322
|
+
await assert_answers_as_anonymous(fixture, victim, victim.create_bearer_headers(), 'an API token minted before the delete stays dead after the undelete');
|
|
323
|
+
const fresh = await login(fixture, victim.account.username, LIFECYCLE_PASSWORD);
|
|
324
|
+
assert.strictEqual(fresh.status, 200, 'the reactivated account logs in');
|
|
325
|
+
assert.ok(fresh.cookie);
|
|
326
|
+
assert.strictEqual(await verified_account_id(fixture, {
|
|
327
|
+
...anonymous_headers(victim),
|
|
328
|
+
cookie: fresh.cookie
|
|
329
|
+
}), victim_id, 'the fresh session authenticates as the reactivated account');
|
|
330
|
+
});
|
|
331
|
+
test_if(capabilities.account_lifecycle, "an account's role grants are kept through a delete, inert, and confer again after the undelete", async () => {
|
|
332
|
+
const fixture = await setup_test();
|
|
333
|
+
const victim = await fixture.create_account({
|
|
334
|
+
username: 'lifecycle_granted',
|
|
335
|
+
password_value: LIFECYCLE_PASSWORD,
|
|
336
|
+
roles: [ROLE_ADMIN]
|
|
337
|
+
});
|
|
338
|
+
const victim_id = victim.account.id;
|
|
339
|
+
// an admin-gated read, so a 200 is the grant conferring
|
|
340
|
+
const admin_read = (headers) => rpc(fixture, 'admin_account_list', {}, headers);
|
|
341
|
+
assert.strictEqual((await admin_read(victim.create_session_headers())).status, 200, 'the grant confers before the delete');
|
|
342
|
+
const admin_grant_ids = (entry) => entry.role_grants.filter((g) => g.role === ROLE_ADMIN).map((g) => g.id);
|
|
343
|
+
const before = admin_grant_ids(await listed_account(fixture, victim_id));
|
|
344
|
+
assert.strictEqual(before.length, 1, 'one admin grant');
|
|
345
|
+
await delete_account(fixture, victim_id);
|
|
346
|
+
const during = await listed_account(fixture, victim_id);
|
|
347
|
+
assert.ok(during.account.deleted_at, 'tombstoned');
|
|
348
|
+
assert.deepStrictEqual(admin_grant_ids(during), before, 'the grant is kept, listed');
|
|
349
|
+
await assert_answers_as_anonymous(fixture, victim, victim.create_session_headers(), 'no credential of the deleted account authenticates');
|
|
350
|
+
assert.strictEqual((await login(fixture, victim.account.username, LIFECYCLE_PASSWORD)).status, 401, 'nor can one be minted');
|
|
351
|
+
await undelete_account(fixture, victim_id);
|
|
352
|
+
assert.deepStrictEqual(admin_grant_ids(await listed_account(fixture, victim_id)), before, 'the same grant after the undelete');
|
|
353
|
+
const fresh = await login(fixture, victim.account.username, LIFECYCLE_PASSWORD);
|
|
354
|
+
assert.ok(fresh.cookie, 'the reactivated account logs in');
|
|
355
|
+
assert.strictEqual((await admin_read({ ...anonymous_headers(victim), cookie: fresh.cookie })).status, 200, 'the grant confers again');
|
|
356
|
+
});
|
|
357
|
+
test_if(capabilities.account_lifecycle, 'offers made to an account before its delete stay superseded after the undelete and grant nothing', async () => {
|
|
358
|
+
const fixture = await setup_test();
|
|
359
|
+
const victim = await fixture.create_account({
|
|
360
|
+
username: 'lifecycle_offered',
|
|
361
|
+
password_value: LIFECYCLE_PASSWORD
|
|
362
|
+
});
|
|
363
|
+
const grantor = await fixture.create_account({
|
|
364
|
+
username: 'lifecycle_offerer',
|
|
365
|
+
roles: [ROLE_ADMIN]
|
|
366
|
+
});
|
|
367
|
+
const victim_id = victim.account.id;
|
|
368
|
+
const offer = async (headers, params) => {
|
|
369
|
+
const res = await rpc(fixture, 'role_grant_offer_create', { to_account_id: victim_id, role: ROLE_ADMIN, ...params }, headers);
|
|
370
|
+
if (!res.ok)
|
|
371
|
+
assert.fail(`role_grant_offer_create: ${JSON.stringify(res)}`);
|
|
372
|
+
return res.result.offer.id;
|
|
373
|
+
};
|
|
374
|
+
const by_account = await offer(fixture.create_session_headers(), {});
|
|
375
|
+
const by_actor = await offer(grantor.create_session_headers(), {
|
|
376
|
+
to_actor_id: victim.actor.id
|
|
377
|
+
});
|
|
378
|
+
const inbox = async (headers) => expect_output(await rpc(fixture, 'role_grant_offer_list', {}, headers), RoleGrantOfferListOutput).offers.map((o) => o.id);
|
|
379
|
+
assert.deepStrictEqual((await inbox(victim.create_session_headers())).sort(), [by_account, by_actor].sort(), 'both offers are pending before the delete');
|
|
380
|
+
await delete_account(fixture, victim_id);
|
|
381
|
+
await undelete_account(fixture, victim_id);
|
|
382
|
+
const fresh = await login(fixture, victim.account.username, LIFECYCLE_PASSWORD);
|
|
383
|
+
assert.ok(fresh.cookie, 'the reactivated account logs in');
|
|
384
|
+
const victim_headers = { ...anonymous_headers(victim), cookie: fresh.cookie };
|
|
385
|
+
assert.deepStrictEqual(await inbox(victim_headers), [], 'no offer is pending');
|
|
386
|
+
for (const offer_id of [by_account, by_actor]) {
|
|
387
|
+
const res = await rpc(fixture, 'role_grant_offer_accept', { offer_id }, victim_headers);
|
|
388
|
+
assert.ok(!res.ok, `an accept of a superseded offer is refused: ${JSON.stringify(res)}`);
|
|
389
|
+
assert.strictEqual(res.status, 400);
|
|
390
|
+
assert.strictEqual(res.error?.code, JSONRPC_INVALID_REQUEST);
|
|
391
|
+
assert.strictEqual(error_reason(res), ERROR_ROLE_GRANT_OFFER_TERMINAL);
|
|
392
|
+
}
|
|
393
|
+
assert.deepStrictEqual((await listed_account(fixture, victim_id)).role_grants.filter((g) => g.role === ROLE_ADMIN), [], 'no admin grant was minted');
|
|
394
|
+
const { offers } = expect_output(await rpc(fixture, 'role_grant_offer_history', {}, fixture.create_session_headers()), RoleGrantOfferHistoryOutput);
|
|
395
|
+
const sent = offers.find((o) => o.id === by_account);
|
|
396
|
+
assert.ok(sent?.superseded_at, "the grantor's history lists it superseded");
|
|
397
|
+
assert.strictEqual(sent.accepted_at, null);
|
|
398
|
+
});
|
|
399
|
+
test_if(capabilities.account_lifecycle, "a deleted account's unclaimed invites are void and stay void after the undelete; a claimed one is untouched", async () => {
|
|
400
|
+
const fixture = await setup_test();
|
|
401
|
+
const inviter = await fixture.create_account({
|
|
402
|
+
username: 'lifecycle_inviter',
|
|
403
|
+
roles: [ROLE_ADMIN]
|
|
404
|
+
});
|
|
405
|
+
const invite = async (username) => {
|
|
406
|
+
const res = await rpc(fixture, 'invite_create', { username }, inviter.create_session_headers());
|
|
407
|
+
if (!res.ok)
|
|
408
|
+
assert.fail(`invite_create: ${JSON.stringify(res)}`);
|
|
409
|
+
return res.result.invite.id;
|
|
410
|
+
};
|
|
411
|
+
const open_id = await invite('lifecycle_invitee_open');
|
|
412
|
+
const claimed_id = await invite('lifecycle_invitee_claimed');
|
|
413
|
+
assert.strictEqual((await signup(fixture, 'lifecycle_invitee_claimed')).status, 200, 'the claimed invite admits its signup');
|
|
414
|
+
// what a signup with no invite answers
|
|
415
|
+
const no_invite = await signup(fixture, 'lifecycle_invitee_none');
|
|
416
|
+
assert.strictEqual(no_invite.status, 403, 'signup is invite-gated');
|
|
417
|
+
const invites = async () => expect_output(await rpc(fixture, 'invite_list', {}, fixture.create_session_headers()), InviteListOutput).invites;
|
|
418
|
+
await delete_account(fixture, inviter.account.id);
|
|
419
|
+
assert.deepStrictEqual(await signup(fixture, 'lifecycle_invitee_open'), no_invite, "a signup with the deleted account's unclaimed invite answers as one with none");
|
|
420
|
+
const during = await invites();
|
|
421
|
+
assert.ok(!during.some((i) => i.id === open_id), 'the unclaimed invite is gone');
|
|
422
|
+
assert.ok(during.find((i) => i.id === claimed_id)?.claimed_at, 'the claimed invite is untouched');
|
|
423
|
+
const voided = (await list_audit_events(fixture, { event_type: 'invite_delete' }, rpc_path)).filter((e) => e.metadata?.invite_id === open_id);
|
|
424
|
+
assert.strictEqual(voided.length, 1, 'one invite_delete row for the voided invite');
|
|
425
|
+
await undelete_account(fixture, inviter.account.id);
|
|
426
|
+
assert.ok(!(await invites()).some((i) => i.id === open_id), 'the undelete does not bring the invite back');
|
|
427
|
+
assert.deepStrictEqual(await signup(fixture, 'lifecycle_invitee_open'), no_invite, 'and a signup with it is still refused');
|
|
428
|
+
});
|
|
429
|
+
test('a password change ends every session and API token of the account, and only the new password logs in', async () => {
|
|
430
|
+
const fixture = await setup_test();
|
|
431
|
+
const account = await fixture.create_account({
|
|
432
|
+
username: 'lifecycle_rotated',
|
|
433
|
+
password_value: LIFECYCLE_PASSWORD
|
|
434
|
+
});
|
|
435
|
+
const account_id = account.account.id;
|
|
436
|
+
const sibling = await login(fixture, account.account.username, LIFECYCLE_PASSWORD);
|
|
437
|
+
assert.strictEqual(sibling.status, 200, 'a second session for the account');
|
|
438
|
+
assert.ok(sibling.cookie);
|
|
439
|
+
const sibling_headers = { ...anonymous_headers(account), cookie: sibling.cookie };
|
|
440
|
+
// both sessions and the token authenticate as the account first
|
|
441
|
+
assert.strictEqual(await verified_account_id(fixture, account.create_session_headers()), account_id);
|
|
442
|
+
assert.strictEqual(await verified_account_id(fixture, sibling_headers), account_id);
|
|
443
|
+
assert.strictEqual(await verified_account_id(fixture, account.create_bearer_headers()), account_id);
|
|
444
|
+
// the change goes through the sibling session; the account's first
|
|
445
|
+
// session is the other one
|
|
446
|
+
const change = await fixture.fresh_transport()(password_path, {
|
|
447
|
+
method: 'POST',
|
|
448
|
+
headers: create_test_request_headers({
|
|
449
|
+
'content-type': 'application/json',
|
|
450
|
+
cookie: sibling.cookie
|
|
451
|
+
}),
|
|
452
|
+
body: JSON.stringify({
|
|
453
|
+
current_password: LIFECYCLE_PASSWORD,
|
|
454
|
+
new_password: LIFECYCLE_PASSWORD_CHANGED
|
|
455
|
+
})
|
|
456
|
+
});
|
|
457
|
+
await change.body?.cancel();
|
|
458
|
+
assert.strictEqual(change.status, 200, 'the password change succeeds');
|
|
459
|
+
await assert_answers_as_anonymous(fixture, account, account.create_session_headers(), 'the session the change was not made on is ended');
|
|
460
|
+
await assert_answers_as_anonymous(fixture, account, sibling_headers, 'the session the change was made on is ended');
|
|
461
|
+
await assert_answers_as_anonymous(fixture, account, account.create_bearer_headers(), 'the account’s API token is ended');
|
|
462
|
+
// scoped to the account: the keeper's session is untouched
|
|
463
|
+
assert.strictEqual(await verified_account_id(fixture, fixture.create_session_headers()), fixture.account.id, 'another account’s session stays live');
|
|
464
|
+
const old_login = await login(fixture, account.account.username, LIFECYCLE_PASSWORD);
|
|
465
|
+
assert.strictEqual(old_login.status, 401, 'the old password no longer logs in');
|
|
466
|
+
const new_login = await login(fixture, account.account.username, LIFECYCLE_PASSWORD_CHANGED);
|
|
467
|
+
assert.strictEqual(new_login.status, 200, 'the new password logs in');
|
|
468
|
+
});
|
|
198
469
|
});
|
|
199
470
|
};
|
|
@@ -6,7 +6,10 @@ import '../assert_dev_env.js';
|
|
|
6
6
|
* - `root` — the per-backend subtree under `os.tmpdir()`. Compose
|
|
7
7
|
* consumer-specific paths under here.
|
|
8
8
|
* - `bootstrap_token_path` — `FUZ_BOOTSTRAP_TOKEN_PATH`; harness writes
|
|
9
|
-
* the bootstrap token here before spawn.
|
|
9
|
+
* the bootstrap token here before spawn. In a directory of its own
|
|
10
|
+
* (`{root}/bootstrap/`), holding nothing else, so a probe can take the
|
|
11
|
+
* directory's write permission away — what makes a backend's burn of the
|
|
12
|
+
* token fail — without touching the backend's other state.
|
|
10
13
|
* - `daemon_token_path` — where `init_daemon_token` (Rust) and the TS
|
|
11
14
|
* server's daemon-token writer land the token (under `{root}/run/`);
|
|
12
15
|
* `spawn_backend` deletes it before each spawn, so a token a previous run
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_test_backend_paths.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/build_test_backend_paths.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAyB9B
|
|
1
|
+
{"version":3,"file":"build_test_backend_paths.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/build_test_backend_paths.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAyB9B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACnC;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,MAAM,KAAG,gBASzD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,MAAM,KAAG,MACtB,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,MAAM,MAAM,KAAG,gBACE,CAAC"}
|
|
@@ -30,7 +30,7 @@ export const build_test_backend_paths = (prefix) => {
|
|
|
30
30
|
const root = join(tmpdir(), prefix);
|
|
31
31
|
return {
|
|
32
32
|
root,
|
|
33
|
-
bootstrap_token_path: join(root, 'bootstrap_token'),
|
|
33
|
+
bootstrap_token_path: join(root, 'bootstrap', 'bootstrap_token'),
|
|
34
34
|
// `init_daemon_token` (Rust) and the TS server's daemon-token
|
|
35
35
|
// writer both land the token at `{root}/run/daemon_token`.
|
|
36
36
|
daemon_token_path: join(root, 'run', 'daemon_token')
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import type { TestingBackdoorMethod } from './spine_surface_constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* The upgrade refusals a runtime makes before the app runs, which
|
|
5
|
+
* `BackendCapabilities.ws_upgrade_runtime_refusals` declares: `empty_host`, an
|
|
6
|
+
* upgrade whose first `Host` line is empty.
|
|
7
|
+
*/
|
|
8
|
+
export declare const WS_UPGRADE_RUNTIME_REFUSALS: readonly ["empty_host"];
|
|
9
|
+
/** One of `WS_UPGRADE_RUNTIME_REFUSALS`. */
|
|
10
|
+
export type WsUpgradeRuntimeRefusal = (typeof WS_UPGRADE_RUNTIME_REFUSALS)[number];
|
|
3
11
|
/**
|
|
4
12
|
* Optional behaviors a backend may support. Each flag's TSDoc names the
|
|
5
13
|
* tests that gate on it; add a new flag here before referencing it from
|
|
@@ -207,16 +215,70 @@ export interface BackendCapabilities {
|
|
|
207
215
|
/**
|
|
208
216
|
* A refused WebSocket upgrade carries its refusal body — the flat
|
|
209
217
|
* `{error, ...}` the same refusal answers over plain HTTP. Not a gate: it
|
|
210
|
-
* forks how `describe_transport_composition_cross_tests` reads its WS rows
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
218
|
+
* forks how `describe_transport_composition_cross_tests` reads its WS rows
|
|
219
|
+
* and how `describe_cross_process_ws_tests` reads its disallowed-origin
|
|
220
|
+
* refusal. `true`, an empty refusal body fails the case; `false`, an empty
|
|
221
|
+
* body is allowed (the case pins the status alone) and a non-empty one is
|
|
222
|
+
* still asserted.
|
|
214
223
|
*
|
|
215
224
|
* `false` on Node: `@hono/node-server` writes a refused upgrade to the raw
|
|
216
225
|
* socket with `Content-Length: 0`, dropping the response body. `true` on
|
|
217
226
|
* Bun and the Rust spine, which send the response as built.
|
|
218
227
|
*/
|
|
219
228
|
readonly ws_refusal_body: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* The upgrade requests the runtime refuses itself, before the app runs —
|
|
231
|
+
* each a `WsUpgradeRuntimeRefusal`. Not a gate: the request header wire
|
|
232
|
+
* leg (`describe_request_header_conformance_wire_cross_tests`) expects that
|
|
233
|
+
* runtime answer, a `400` and no `101`, for a row naming a refusal the
|
|
234
|
+
* backend declares, and the table's own answer on every other backend — so
|
|
235
|
+
* the declaration fails the day the runtime stops refusing.
|
|
236
|
+
*
|
|
237
|
+
* `['empty_host']` on Node: `@hono/node-server` builds an upgrade's URL from
|
|
238
|
+
* the first `Host` line, and an empty one makes that throw, which it
|
|
239
|
+
* answers with a bodiless `400`. `[]` on Bun and the Rust spine, whose host
|
|
240
|
+
* gate answers the request.
|
|
241
|
+
*/
|
|
242
|
+
readonly ws_upgrade_runtime_refusals: ReadonlyArray<WsUpgradeRuntimeRefusal>;
|
|
243
|
+
/**
|
|
244
|
+
* The backend's runtime resolves dot segments — `.` and `..`, literal or
|
|
245
|
+
* percent-encoded (`%2e`) — before the app sees the request, so the router
|
|
246
|
+
* reads `/api/../health` as `/health`. Not a gate: the request target wire
|
|
247
|
+
* leg (`describe_request_target_conformance_wire_cross_tests`) expects a
|
|
248
|
+
* dot-segment row's `expect_where_dot_segments_resolved` answer where it is
|
|
249
|
+
* `true` and the row's raw-path `expect` where it is `false`, so the
|
|
250
|
+
* declaration fails the day the runtime changes.
|
|
251
|
+
*
|
|
252
|
+
* `true` on Node and Bun, which build the request's URL by the WHATWG URL
|
|
253
|
+
* parser (Bun keeps no raw target at all), and in-process, where the
|
|
254
|
+
* `Request` does the same; `false` on the Rust spine, whose router matches
|
|
255
|
+
* the raw path, dot segments kept.
|
|
256
|
+
*/
|
|
257
|
+
readonly runtime_resolves_dot_segments: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* An unmatched path outside the auth scope is answered by the spine's own
|
|
260
|
+
* fallback — the plain-text `404 Not Found`. Gates the request target wire leg's
|
|
261
|
+
* rows that land outside `/api` (`requires`), so a backend serving a
|
|
262
|
+
* static or SPA fallback of its own there declares `false` and keeps the
|
|
263
|
+
* rest of the leg; those rows then show as a skipped test.
|
|
264
|
+
*
|
|
265
|
+
* `true` in both families' defaults, on fuz_app's spine presets and
|
|
266
|
+
* in-process.
|
|
267
|
+
*/
|
|
268
|
+
readonly spine_fallback: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* The host gate (DNS rebinding) is on, refusing a `Host` that is neither
|
|
271
|
+
* loopback nor allowlisted with 403 `forbidden_host`. Gates the request
|
|
272
|
+
* header wire leg's rows the table expects the host gate to refuse
|
|
273
|
+
* (`describe_request_header_conformance_wire_cross_tests`), so a backend
|
|
274
|
+
* running with the gate off (`host_gate: false` on `create_app_server`)
|
|
275
|
+
* declares `false` and keeps the rest of the leg; those rows then show as a
|
|
276
|
+
* skipped test.
|
|
277
|
+
*
|
|
278
|
+
* `true` in both families' defaults, on fuz_app's spine presets and
|
|
279
|
+
* in-process — the gate is on by default on both spines.
|
|
280
|
+
*/
|
|
281
|
+
readonly host_gate: boolean;
|
|
220
282
|
/**
|
|
221
283
|
* The `_testing_*` backdoors the backend mounts on its RPC endpoint, from
|
|
222
284
|
* `TESTING_BACKDOOR_METHODS` (a consumer's own seams stay off it). Not a
|
|
@@ -226,7 +288,8 @@ export interface BackendCapabilities {
|
|
|
226
288
|
* must answer `method_not_found` — and runs its credential-gate rows over
|
|
227
289
|
* the declared ones; `describe_spine_cross_suites` requires `_testing_reset`
|
|
228
290
|
* and `_testing_drain_effects` (the per-test reset and the audit barrier),
|
|
229
|
-
* skips a suite whose backdoor is undeclared, naming it — `
|
|
291
|
+
* skips a suite whose backdoor is undeclared, naming it — `credential_conformance`
|
|
292
|
+
* (`_testing_credential_read`), `credential_deadline`
|
|
230
293
|
* (`_testing_shorten_credential_expiry`), `origin_conformance`
|
|
231
294
|
* (`_testing_origin_check`), `ws_outbound_overflow`
|
|
232
295
|
* (`_testing_flood_notifications`) — and requires `_testing_put_fact` of a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAmD9B,OAAO,KAAK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