@fuzdev/fuz_app 0.180.0 → 0.182.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 +38 -20
- package/dist/actions/action_rpc.d.ts +25 -6
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -48
- package/dist/actions/action_types.d.ts +31 -13
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +1 -1
- package/dist/actions/notification_sender.d.ts +83 -0
- package/dist/actions/notification_sender.d.ts.map +1 -0
- package/dist/actions/notification_sender.js +85 -0
- package/dist/actions/perform_action.d.ts +13 -4
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +27 -18
- package/dist/actions/register_action_ws.d.ts +20 -2
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +17 -5
- package/dist/actions/ws_socket_session.d.ts +3 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +3 -2
- package/dist/auth/CLAUDE.md +84 -59
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +30 -3
- package/dist/auth/account_queries.d.ts +213 -2
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +255 -2
- 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 +5 -7
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +110 -89
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +117 -25
- package/dist/auth/api_token_queries.d.ts +29 -12
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +42 -27
- 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 +37 -32
- 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 +39 -30
- package/dist/auth/deps.d.ts +10 -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 +97 -76
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +93 -104
- package/dist/auth/resolved_auth.d.ts +10 -5
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +5 -3
- package/dist/auth/role_grant_offer_actions.d.ts +7 -11
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +97 -106
- 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_notifications.d.ts +87 -38
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +75 -22
- package/dist/auth/role_grant_offer_queries.d.ts +143 -9
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +266 -66
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/role_grant_queries.d.ts +57 -10
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +81 -22
- package/dist/auth/role_grant_sql.d.ts +21 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -1
- package/dist/auth/role_grant_sql.js +21 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +9 -2
- 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 +95 -14
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +98 -19
- 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/standard_rpc_actions.d.ts +6 -19
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/standard_rpc_actions.js +5 -6
- package/dist/auth/token_scope.d.ts +6 -8
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +6 -9
- 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 +156 -48
- package/dist/http/auth_shape.d.ts +4 -4
- 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 +45 -22
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +53 -26
- 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 +299 -83
- 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 +4 -4
- package/dist/server/app_server.d.ts +54 -33
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +69 -41
- package/dist/server/serve_fact_route.d.ts +3 -3
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -55
- 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 +406 -1202
- 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 +5 -9
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +3 -2
- 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 +320 -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.d.ts +1 -26
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +3 -7
- 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 +4 -10
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +11 -4
- 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 +5 -4
- 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 +185 -31
- 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 +82 -34
- 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 +3 -1
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +14 -7
- package/dist/testing/resolved_auth.d.ts +3 -1
- package/dist/testing/resolved_auth.d.ts.map +1 -1
- package/dist/testing/resolved_auth.js +4 -4
- 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 +13 -10
- 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/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +8 -4
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { type BackendCapabilities } from './capabilities.js';
|
|
3
|
+
import type { SetupTest } from './setup.js';
|
|
4
|
+
/** Options for `describe_request_target_conformance_wire_cross_tests`. */
|
|
5
|
+
export interface RequestTargetConformanceWireCrossTestOptions {
|
|
6
|
+
/** Per-test fixture producer (cross-process), seeding no `extra_actors`. */
|
|
7
|
+
readonly setup_test: SetupTest;
|
|
8
|
+
/**
|
|
9
|
+
* `ws`, `sse`, `account_status`, `fact_serving`,
|
|
10
|
+
* `fact_serving_admin_hash` and `spine_fallback` gate the rows that require
|
|
11
|
+
* them;
|
|
12
|
+
* `ws_refusal_body` whether a refused upgrade's code is read, and
|
|
13
|
+
* `runtime_resolves_dot_segments` which answer a dot-segment row expects.
|
|
14
|
+
*/
|
|
15
|
+
readonly capabilities: BackendCapabilities;
|
|
16
|
+
/** Base URL the spawned backend is reachable at (e.g. `http://localhost:1178`). */
|
|
17
|
+
readonly base_url: string;
|
|
18
|
+
/** JSON-RPC endpoint path. Default `SPINE_RPC_PATH`. */
|
|
19
|
+
readonly rpc_path?: string;
|
|
20
|
+
/** WebSocket endpoint path. Default `SPINE_WS_PATH`. */
|
|
21
|
+
readonly ws_path?: string;
|
|
22
|
+
/** Account status route path. Default `SPINE_ACCOUNT_STATUS_PATH`. */
|
|
23
|
+
readonly account_status_path?: string;
|
|
24
|
+
/** Login route path, the `POST`-only route. Default `SPINE_ACCOUNT_LOGIN_PATH`. */
|
|
25
|
+
readonly account_login_path?: string;
|
|
26
|
+
/** Audit stream path, the SSE route. Default `SPINE_SSE_PATH`. */
|
|
27
|
+
readonly sse_path?: string;
|
|
28
|
+
/** Health probe path, the route outside the auth scope. Default `/health`. */
|
|
29
|
+
readonly health_path?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const describe_request_target_conformance_wire_cross_tests: (options: RequestTargetConformanceWireCrossTestOptions) => void;
|
|
32
|
+
//# sourceMappingURL=request_target_conformance_wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request_target_conformance_wire.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/request_target_conformance_wire.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA8D9B,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AASzD,0EAA0E;AAC1E,MAAM,WAAW,4CAA4C;IAC5D,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,mFAAmF;IACnF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AA6HD,eAAO,MAAM,oDAAoD,GAChE,SAAS,4CAA4C,KACnD,IAgKF,CAAC"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The request target conformance table over raw sockets: each `wire` row of
|
|
4
|
+
* `request_target_conformance.json` sent to the live backend with its target
|
|
5
|
+
* written byte for byte, and the answer's status, error code and — on a
|
|
6
|
+
* JSON-RPC answer — envelope `id`, error code and `data.reason` asserted,
|
|
7
|
+
* with the `Allow` methods, a plain-text body, a `HEAD` answer's media type
|
|
8
|
+
* and the session cookie's clear where the row pins them.
|
|
9
|
+
*
|
|
10
|
+
* Where the unit legs run each spine's strict readers over a query string or
|
|
11
|
+
* a path segment, this sends the target: the runtime's request-line parser,
|
|
12
|
+
* its URL, the router and the route's own phases sit between the bytes and
|
|
13
|
+
* the answer, so it is what proves every surface that reads the query or the
|
|
14
|
+
* path params reads them through the strict readers, in the phase order the
|
|
15
|
+
* row pins, and that both routers answer a method a path doesn't serve, and
|
|
16
|
+
* a path nothing serves, alike. A fetch client can't send these targets — it would re-encode
|
|
17
|
+
* them — so the leg is raw-socket, and **cross-process only**. It needs no
|
|
18
|
+
* backdoor.
|
|
19
|
+
*
|
|
20
|
+
* A row is sent by its principal (`keeper_session`: the fixture's keeper
|
|
21
|
+
* cookie; `none`: no credential; `invalid_session`: the session cookie's name
|
|
22
|
+
* with a value that doesn't verify), with its `origin` as the one `Origin`
|
|
23
|
+
* line or none, its `host` in place of the backend's `Host`, and its
|
|
24
|
+
* `headers` as written. The rows run as one test per set of capabilities
|
|
25
|
+
* they require, each skipped — visibly — on a backend not declaring every
|
|
26
|
+
* one: a backend serving a fallback of its own outside `/api`
|
|
27
|
+
* (`spine_fallback: false`) skips the rows that land there and runs the
|
|
28
|
+
* rest. A row
|
|
29
|
+
* holding `expect_where_dot_segments_resolved` expects that answer on a
|
|
30
|
+
* backend whose runtime resolves dot segments
|
|
31
|
+
* (`capabilities.runtime_resolves_dot_segments`) and its `expect` on one
|
|
32
|
+
* whose router reads the raw path. A `HEAD` row's answer must carry no body.
|
|
33
|
+
* An `upgrade` row is a WebSocket upgrade (`capabilities.ws`): a `101` is the
|
|
34
|
+
* handshake accepted, and a refusal's code is read where the runtime sends
|
|
35
|
+
* its body (`capabilities.ws_refusal_body`).
|
|
36
|
+
*
|
|
37
|
+
* **What it needs of a backend**: the spine's RPC endpoint with
|
|
38
|
+
* `account_verify` on `rpc_path`, the account status and login routes, the
|
|
39
|
+
* WebSocket endpoint on `ws_path`, the audit stream on `sse_path`, `GET` alone
|
|
40
|
+
* on `health_path`, nothing else at the paths its routing rows name as
|
|
41
|
+
* unmatched, and the fact routes at `/api/facts/:hash` and
|
|
42
|
+
* `/api/cells/:cell_id/facts/:hash`, each as its capability declares, and a
|
|
43
|
+
* single-actor keeper (no `extra_actors`) that holds the WebSocket upgrade's
|
|
44
|
+
* roles.
|
|
45
|
+
*
|
|
46
|
+
* @module
|
|
47
|
+
*/
|
|
48
|
+
import { assert, describe } from 'vitest';
|
|
49
|
+
import { raw_http_error_code, raw_http_exchange, raw_http_header_values, raw_http_parse_json, raw_http_parse_response, raw_http_request, RAW_HTTP_READ_TIMEOUT_MS } from '../transports/raw_http.js';
|
|
50
|
+
import { connect_raw_ws } from '../transports/ws_raw_client.js';
|
|
51
|
+
import { test_if } from './capabilities.js';
|
|
52
|
+
import { send_raw_upgrade } from './credential_wire.js';
|
|
53
|
+
import { fill_request_target_conformance_placeholders, load_request_target_conformance } from './request_target_conformance.js';
|
|
54
|
+
import { SPINE_ACCOUNT_LOGIN_PATH, SPINE_ACCOUNT_STATUS_PATH, SPINE_RPC_PATH, SPINE_SSE_PATH, SPINE_WS_PATH } from './spine_surface_constants.js';
|
|
55
|
+
/** A raw response's body read as the UTF-8 it is — the raw transport reads one character a byte. */
|
|
56
|
+
const utf8_body = (response) => Buffer.from(response.body, 'latin1').toString('utf8');
|
|
57
|
+
const read_envelope = (response) => {
|
|
58
|
+
const body = raw_http_parse_json(utf8_body(response));
|
|
59
|
+
if (body?.jsonrpc !== '2.0')
|
|
60
|
+
return null;
|
|
61
|
+
return { id: body.id, code: body.error?.code, reason: body.error?.data?.reason };
|
|
62
|
+
};
|
|
63
|
+
const format_expect = (expect) => [
|
|
64
|
+
String(expect.status),
|
|
65
|
+
expect.error,
|
|
66
|
+
expect.allow && `Allow {${expect.allow.join(',')}}`,
|
|
67
|
+
expect.text !== undefined && `text ${JSON.stringify(expect.text)}`,
|
|
68
|
+
expect.media,
|
|
69
|
+
expect.jsonrpc && `id ${JSON.stringify(expect.jsonrpc.id)}`,
|
|
70
|
+
expect.jsonrpc?.code,
|
|
71
|
+
expect.jsonrpc?.reason
|
|
72
|
+
]
|
|
73
|
+
.filter((part) => part !== undefined && part !== false)
|
|
74
|
+
.join(' ');
|
|
75
|
+
/** The `Allow` header's methods, upper-cased and sorted, or `[]` without one. */
|
|
76
|
+
const read_allow = (response) => (response.headers.allow ?? '')
|
|
77
|
+
.split(',')
|
|
78
|
+
.map((method) => method.trim().toUpperCase())
|
|
79
|
+
.filter((method) => method !== '')
|
|
80
|
+
.sort();
|
|
81
|
+
/** The kind of a response's `Content-Type`, by its essence. */
|
|
82
|
+
const read_media = (response) => {
|
|
83
|
+
const essence = (response.headers['content-type'] ?? '').split(';')[0].trim().toLowerCase();
|
|
84
|
+
if (essence === 'application/json')
|
|
85
|
+
return 'json';
|
|
86
|
+
if (essence === 'text/plain')
|
|
87
|
+
return 'text';
|
|
88
|
+
return essence === '' ? '(none)' : essence;
|
|
89
|
+
};
|
|
90
|
+
/** Hold one answer to its row's `expect`. */
|
|
91
|
+
const check_answer = (response, expect, context) => {
|
|
92
|
+
const got = `got ${response.status} (${utf8_body(response).slice(0, 120)})`;
|
|
93
|
+
if (response.status !== expect.status)
|
|
94
|
+
return [`expected status ${expect.status}, ${got}`];
|
|
95
|
+
const failures = [];
|
|
96
|
+
if (expect.allow !== undefined) {
|
|
97
|
+
const allow = read_allow(response);
|
|
98
|
+
const expected = [...expect.allow].sort();
|
|
99
|
+
if (allow.join(',') !== expected.join(',')) {
|
|
100
|
+
failures.push(`expected Allow {${expected.join(',')}}, got {${allow.join(',')}} (${got})`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (expect.clears_session !== undefined) {
|
|
104
|
+
const clears = context.set_cookies.some((line) => line.startsWith(`${context.cookie_name}=;`) && /;\s*Max-Age=0(?:;|$)/i.test(line));
|
|
105
|
+
if (clears !== expect.clears_session) {
|
|
106
|
+
failures.push(`expected ${expect.clears_session ? 'the session cookie cleared' : 'no session clear'}, got Set-Cookie ${JSON.stringify(context.set_cookies)}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (expect.media !== undefined && read_media(response) !== expect.media) {
|
|
110
|
+
failures.push(`expected a ${expect.media} Content-Type, got ${read_media(response)}`);
|
|
111
|
+
}
|
|
112
|
+
if (context.head_request) {
|
|
113
|
+
if (response.body !== '')
|
|
114
|
+
failures.push(`expected no body on a HEAD answer, ${got}`);
|
|
115
|
+
return failures;
|
|
116
|
+
}
|
|
117
|
+
if (context.body_optional && response.body === '')
|
|
118
|
+
return failures;
|
|
119
|
+
if (expect.text !== undefined) {
|
|
120
|
+
if (read_media(response) !== 'text') {
|
|
121
|
+
failures.push(`expected a text Content-Type, got ${read_media(response)}`);
|
|
122
|
+
}
|
|
123
|
+
if (utf8_body(response) !== expect.text) {
|
|
124
|
+
failures.push(`expected the body ${JSON.stringify(expect.text)}, ${got}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (expect.error !== undefined) {
|
|
128
|
+
const code = raw_http_error_code(response);
|
|
129
|
+
if (code !== expect.error)
|
|
130
|
+
failures.push(`expected the code ${expect.error}, ${got}`);
|
|
131
|
+
}
|
|
132
|
+
if (expect.jsonrpc !== undefined) {
|
|
133
|
+
const envelope = read_envelope(response);
|
|
134
|
+
if (!envelope)
|
|
135
|
+
return [...failures, `expected a JSON-RPC envelope, ${got}`];
|
|
136
|
+
if (envelope.id !== expect.jsonrpc.id) {
|
|
137
|
+
failures.push(`expected the id ${JSON.stringify(expect.jsonrpc.id)}, ${got}`);
|
|
138
|
+
}
|
|
139
|
+
if (expect.jsonrpc.code !== undefined && envelope.code !== expect.jsonrpc.code) {
|
|
140
|
+
failures.push(`expected the error code ${expect.jsonrpc.code}, ${got}`);
|
|
141
|
+
}
|
|
142
|
+
if (expect.jsonrpc.reason !== undefined && envelope.reason !== expect.jsonrpc.reason) {
|
|
143
|
+
failures.push(`expected the reason ${JSON.stringify(expect.jsonrpc.reason)}, ${got}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return failures;
|
|
147
|
+
};
|
|
148
|
+
export const describe_request_target_conformance_wire_cross_tests = (options) => {
|
|
149
|
+
const { setup_test, capabilities, base_url } = options;
|
|
150
|
+
const url = new URL(base_url);
|
|
151
|
+
const placeholders = {
|
|
152
|
+
rpc_path: options.rpc_path ?? SPINE_RPC_PATH,
|
|
153
|
+
ws_path: options.ws_path ?? SPINE_WS_PATH,
|
|
154
|
+
account_status_path: options.account_status_path ?? SPINE_ACCOUNT_STATUS_PATH,
|
|
155
|
+
account_login_path: options.account_login_path ?? SPINE_ACCOUNT_LOGIN_PATH,
|
|
156
|
+
sse_path: options.sse_path ?? SPINE_SSE_PATH,
|
|
157
|
+
health_path: options.health_path ?? '/health'
|
|
158
|
+
};
|
|
159
|
+
const table = load_request_target_conformance();
|
|
160
|
+
/** The answer a row expects of this backend. */
|
|
161
|
+
const expected = (row) => capabilities.runtime_resolves_dot_segments && row.expect_where_dot_segments_resolved
|
|
162
|
+
? row.expect_where_dot_segments_resolved
|
|
163
|
+
: row.expect;
|
|
164
|
+
/** The session cookie's `name=value` the fixture sends. */
|
|
165
|
+
const session_cookie = (fixture) => {
|
|
166
|
+
const cookie = fixture.create_session_headers().cookie;
|
|
167
|
+
if (!cookie?.includes('='))
|
|
168
|
+
throw new Error('the fixture sends its session as one cookie pair');
|
|
169
|
+
return cookie;
|
|
170
|
+
};
|
|
171
|
+
/** The header lines a row's principal and its `origin` send. */
|
|
172
|
+
const principal_lines = (row, fixture) => {
|
|
173
|
+
const lines = row.as === 'none'
|
|
174
|
+
? []
|
|
175
|
+
: row.as === 'invalid_session'
|
|
176
|
+
? [`cookie: ${session_cookie(fixture).split('=')[0]}=invalid`]
|
|
177
|
+
: Object.entries(fixture.create_session_headers()).map(([name, value]) => `${name}: ${value}`);
|
|
178
|
+
if (row.origin !== undefined)
|
|
179
|
+
lines.push(`origin: ${row.origin}`);
|
|
180
|
+
return row.headers === undefined ? lines : [...lines, ...row.headers];
|
|
181
|
+
};
|
|
182
|
+
const check_request = async (row, fixture) => {
|
|
183
|
+
const { received } = await raw_http_exchange(base_url, raw_http_request({
|
|
184
|
+
method: row.method,
|
|
185
|
+
path: fill_request_target_conformance_placeholders(row.target, placeholders),
|
|
186
|
+
host: row.host ?? url.host,
|
|
187
|
+
header_lines: [...principal_lines(row, fixture), 'Connection: close']
|
|
188
|
+
}), { read_timeout_ms: RAW_HTTP_READ_TIMEOUT_MS });
|
|
189
|
+
const head_request = row.method === 'HEAD';
|
|
190
|
+
const response = raw_http_parse_response(received, { head_request });
|
|
191
|
+
if (!response)
|
|
192
|
+
return [`no whole response (${received.slice(0, 80)})`];
|
|
193
|
+
return check_answer(response, expected(row), {
|
|
194
|
+
body_optional: false,
|
|
195
|
+
head_request,
|
|
196
|
+
set_cookies: raw_http_header_values(received, 'set-cookie'),
|
|
197
|
+
cookie_name: session_cookie(fixture).split('=')[0]
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const check_upgrade = async (row, fixture) => {
|
|
201
|
+
const target = fill_request_target_conformance_placeholders(row.target, placeholders);
|
|
202
|
+
const host = row.host ?? url.host;
|
|
203
|
+
const header_lines = principal_lines(row, fixture);
|
|
204
|
+
if (expected(row).status === 101) {
|
|
205
|
+
let client;
|
|
206
|
+
try {
|
|
207
|
+
client = await connect_raw_ws({
|
|
208
|
+
port: Number(url.port),
|
|
209
|
+
hostname: url.hostname,
|
|
210
|
+
host,
|
|
211
|
+
path: target,
|
|
212
|
+
header_lines
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
return [`expected 101: ${error instanceof Error ? error.message : String(error)}`];
|
|
217
|
+
}
|
|
218
|
+
client.destroy();
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
const { received, response } = await send_raw_upgrade({
|
|
222
|
+
base_url,
|
|
223
|
+
ws_path: target,
|
|
224
|
+
host,
|
|
225
|
+
header_lines
|
|
226
|
+
});
|
|
227
|
+
if (!response)
|
|
228
|
+
return [`no whole response (${received.slice(0, 80)})`];
|
|
229
|
+
return check_answer(response, expected(row), {
|
|
230
|
+
body_optional: !capabilities.ws_refusal_body,
|
|
231
|
+
head_request: false,
|
|
232
|
+
set_cookies: raw_http_header_values(received, 'set-cookie'),
|
|
233
|
+
cookie_name: session_cookie(fixture).split('=')[0]
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
const run_rows = async (rows, upgrade) => {
|
|
237
|
+
const fixture = await setup_test();
|
|
238
|
+
assert.strictEqual(fixture.extra_actors.length, 0, "the suite's setup_test must seed no extra_actors: the rows carry no usable acting selector");
|
|
239
|
+
const failures = [];
|
|
240
|
+
for (const row of rows) {
|
|
241
|
+
const label = `${row.name} [${row.method} ${row.target} as ${row.as}${row.origin ? ` from ${row.origin}` : ''}, expected ${format_expect(expected(row))}]`;
|
|
242
|
+
const row_failures = upgrade
|
|
243
|
+
? await check_upgrade(row, fixture)
|
|
244
|
+
: await check_request(row, fixture);
|
|
245
|
+
for (const failure of row_failures)
|
|
246
|
+
failures.push(`${label}: ${failure}`);
|
|
247
|
+
}
|
|
248
|
+
assert.ok(failures.length === 0, `${failures.length} of ${rows.length} request target conformance rows disagree:\n${failures.join('\n')}`);
|
|
249
|
+
};
|
|
250
|
+
/** The rows of one kind grouped by the capabilities they require, the unrequiring group first. */
|
|
251
|
+
const group_rows = (upgrade) => {
|
|
252
|
+
const groups = new Map([['', []]]);
|
|
253
|
+
for (const row of table.wire) {
|
|
254
|
+
if ((row.upgrade ?? false) !== upgrade)
|
|
255
|
+
continue;
|
|
256
|
+
const key = [...new Set(row.requires)].sort().join(' + ');
|
|
257
|
+
let group = groups.get(key);
|
|
258
|
+
if (!group)
|
|
259
|
+
groups.set(key, (group = []));
|
|
260
|
+
group.push(row);
|
|
261
|
+
}
|
|
262
|
+
return groups;
|
|
263
|
+
};
|
|
264
|
+
describe('request target conformance on the wire', () => {
|
|
265
|
+
for (const upgrade of [false, true]) {
|
|
266
|
+
const kind = upgrade ? 'WebSocket upgrade row' : 'request row';
|
|
267
|
+
for (const [key, rows] of group_rows(upgrade)) {
|
|
268
|
+
if (rows.length === 0)
|
|
269
|
+
continue;
|
|
270
|
+
const required = rows[0].requires ?? [];
|
|
271
|
+
test_if((!upgrade || capabilities.ws) &&
|
|
272
|
+
required.every((requirement) => capabilities[requirement]), key === ''
|
|
273
|
+
? `every ${kind} answers as the table says`
|
|
274
|
+
: `every ${kind} requiring ${key} answers as the table says`, () => run_rows(rows, upgrade));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"role_grant_offer_lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA6F9B,OAAO,KAAK,EAAE,wBAAwB,EAAe,MAAM,YAAY,CAAC;AAMxE,qEAAqE;AACrE,MAAM,WAAW,uCAAwC,SAAQ,wBAAwB;IACxF;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,+CAA+C,GAC3D,SAAS,uCAAuC,KAC9C,IAqpBF,CAAC"}
|
|
@@ -20,6 +20,11 @@ import '../assert_dev_env.js';
|
|
|
20
20
|
* - **already decided → 400** `invalid_request` with reason
|
|
21
21
|
* `role_grant_offer_terminal` — a decline or retract after an accept, a
|
|
22
22
|
* second decline, a second retract, and either one after the other.
|
|
23
|
+
* - **a decided offer can't be accepted.** An accept after a decline or a
|
|
24
|
+
* retract is `role_grant_offer_terminal` and grants nothing — the
|
|
25
|
+
* recipient holds no grant of the role and the offer reads back unaccepted.
|
|
26
|
+
* A second accept of an accepted offer is the idempotent replay: it answers
|
|
27
|
+
* the grant the first one minted, and the recipient holds that one grant.
|
|
23
28
|
* - **a grantor's lost authority ends its pending offers.** Revoking a
|
|
24
29
|
* grantor's grant, or deleting its account, supersedes every pending offer
|
|
25
30
|
* it made — gone from the recipient's inbox, an accept answers
|
|
@@ -27,6 +32,20 @@ import '../assert_dev_env.js';
|
|
|
27
32
|
* it (`role_grant_revoked` with the grant as cause, `account_deleted` with
|
|
28
33
|
* the account). The keeper's own `admin` grant refuses a revoke, 403
|
|
29
34
|
* `cannot_revoke_keeper_admin`.
|
|
35
|
+
* - **a recipient's delete ends the offers made to it.** Deleting an account
|
|
36
|
+
* supersedes every pending offer to it, account- or actor-addressed and
|
|
37
|
+
* whoever made it, each with its `account_deleted` row and the account as
|
|
38
|
+
* cause, and the grantor's history lists it superseded. That an undelete
|
|
39
|
+
* brings none back is `describe_account_lifecycle_cross_tests`'.
|
|
40
|
+
* - **a deleted recipient is a missing one.** An offer to a deleted account,
|
|
41
|
+
* or naming its actor, answers exactly what one to an account or actor that
|
|
42
|
+
* does not exist answers (404 `not_found`, or 400
|
|
43
|
+
* `role_grant_offer_actor_account_mismatch` when an actor is named) — the
|
|
44
|
+
* answers `role_grant_assign` gives the same requests — and creates
|
|
45
|
+
* nothing. A grantor without the authority to confer hears its 403
|
|
46
|
+
* `role_grant_offer_not_authorized` whatever the recipient — deleted,
|
|
47
|
+
* missing, or live — and an offer to one's own account is
|
|
48
|
+
* `role_grant_offer_self_target` whatever actor it names.
|
|
30
49
|
* - **one audit row per success, none per refusal.** A decline writes
|
|
31
50
|
* `role_grant_offer_decline` attributed to the recipient and targeting the
|
|
32
51
|
* grantor, a retract `role_grant_offer_retract` attributed to the grantor
|
|
@@ -47,7 +66,7 @@ import '../assert_dev_env.js';
|
|
|
47
66
|
*/
|
|
48
67
|
import { assert, describe, test } from 'vitest';
|
|
49
68
|
import { rpc_call } from '../rpc_helpers.js';
|
|
50
|
-
import { ERROR_CANNOT_REVOKE_KEEPER_ADMIN, ERROR_ROLE_GRANT_OFFER_NOT_FOUND, ERROR_ROLE_GRANT_OFFER_TERMINAL, RoleGrantOfferDeclineOutput, RoleGrantOfferHistoryOutput, RoleGrantOfferRetractOutput } from '../../auth/role_grant_offer_action_specs.js';
|
|
69
|
+
import { ERROR_CANNOT_REVOKE_KEEPER_ADMIN, ERROR_ROLE_GRANT_OFFER_ACTOR_ACCOUNT_MISMATCH, ERROR_ROLE_GRANT_OFFER_NOT_AUTHORIZED, ERROR_ROLE_GRANT_OFFER_NOT_FOUND, ERROR_ROLE_GRANT_OFFER_SELF_TARGET, ERROR_ROLE_GRANT_OFFER_TERMINAL, RoleGrantOfferDeclineOutput, RoleGrantOfferHistoryOutput, RoleGrantOfferRetractOutput } from '../../auth/role_grant_offer_action_specs.js';
|
|
51
70
|
import { AdminAccountListOutput } from '../../auth/admin_action_specs.js';
|
|
52
71
|
import { ROLE_ADMIN } from '../../auth/role_schema.js';
|
|
53
72
|
import { expect_output } from './cross_rpc.js';
|
|
@@ -168,6 +187,48 @@ export const describe_role_grant_offer_lifecycle_cross_tests = (options) => {
|
|
|
168
187
|
assert_terminal(await retract(fixture, retracted.id, grantor_headers), 'a second retract');
|
|
169
188
|
assert_terminal(await decline(fixture, retracted.id, recipient_headers), 'a decline after retract');
|
|
170
189
|
});
|
|
190
|
+
test('an accept after a decline or a retract → 400 role_grant_offer_terminal, granting nothing; a second accept answers the first grant', async () => {
|
|
191
|
+
const fixture = await setup_test();
|
|
192
|
+
const recipient = await fixture.create_account({ username: 'lifecycle_late_accept' });
|
|
193
|
+
const recipient_headers = recipient.create_session_headers();
|
|
194
|
+
const grantor_headers = fixture.create_session_headers();
|
|
195
|
+
/** The recipient's active grants of `role`, by id. */
|
|
196
|
+
const held_grant_ids = async () => {
|
|
197
|
+
const listed = expect_output(await rpc(fixture, 'admin_account_list', {}, grantor_headers), AdminAccountListOutput);
|
|
198
|
+
const entry = listed.accounts.find((a) => a.account.id === recipient.account.id);
|
|
199
|
+
assert.ok(entry, 'the recipient is listed');
|
|
200
|
+
return entry.role_grants.filter((g) => g.role === role).map((g) => g.id);
|
|
201
|
+
};
|
|
202
|
+
const declined = await create_offer(fixture, recipient);
|
|
203
|
+
assert_ok(await decline(fixture, declined.id, recipient_headers), 'decline');
|
|
204
|
+
assert_terminal(await accept(fixture, declined.id, recipient_headers), 'an accept after decline');
|
|
205
|
+
const retracted = await create_offer(fixture, recipient);
|
|
206
|
+
assert_ok(await retract(fixture, retracted.id, grantor_headers), 'retract');
|
|
207
|
+
assert_terminal(await accept(fixture, retracted.id, recipient_headers), 'an accept after retract');
|
|
208
|
+
// the refused accepts changed nothing: no grant, and each offer still
|
|
209
|
+
// reads as it was decided
|
|
210
|
+
assert.deepStrictEqual(await held_grant_ids(), [], 'a refused accept grants nothing');
|
|
211
|
+
const { offers } = expect_output(await rpc(fixture, 'role_grant_offer_history', {}, grantor_headers), RoleGrantOfferHistoryOutput);
|
|
212
|
+
for (const [offer_id, label] of [
|
|
213
|
+
[declined.id, 'declined'],
|
|
214
|
+
[retracted.id, 'retracted']
|
|
215
|
+
]) {
|
|
216
|
+
const offer = offers.find((o) => o.id === offer_id);
|
|
217
|
+
assert.ok(offer, `the ${label} offer is in the history`);
|
|
218
|
+
assert.strictEqual(offer.accepted_at, null, `the ${label} offer stays unaccepted`);
|
|
219
|
+
assert.strictEqual(offer.resulting_role_grant_id, null, label);
|
|
220
|
+
}
|
|
221
|
+
// a replayed accept is idempotent: the grant the first one minted,
|
|
222
|
+
// and no second grant
|
|
223
|
+
const accepted = await create_offer(fixture, recipient);
|
|
224
|
+
const first = await accept(fixture, accepted.id, recipient_headers);
|
|
225
|
+
assert.ok(first.ok, `the first accept must succeed: ${JSON.stringify(first)}`);
|
|
226
|
+
const second = await accept(fixture, accepted.id, recipient_headers);
|
|
227
|
+
assert.ok(second.ok, `a second accept must answer: ${JSON.stringify(second)}`);
|
|
228
|
+
const { role_grant_id } = first.result;
|
|
229
|
+
assert.strictEqual(second.result.role_grant_id, role_grant_id, 'a second accept answers the first grant');
|
|
230
|
+
assert.deepStrictEqual(await held_grant_ids(), [role_grant_id], 'one grant, not two');
|
|
231
|
+
});
|
|
171
232
|
test('a decline and a retract each write one audit row; their refusals write none', async () => {
|
|
172
233
|
const fixture = await setup_test();
|
|
173
234
|
const recipient = await fixture.create_account({ username: 'lifecycle_audited' });
|
|
@@ -294,4 +355,115 @@ export const describe_role_grant_offer_lifecycle_cross_tests = (options) => {
|
|
|
294
355
|
assert.deepStrictEqual(refused.error.data, { reason: ERROR_CANNOT_REVOKE_KEEPER_ADMIN });
|
|
295
356
|
});
|
|
296
357
|
});
|
|
358
|
+
describe("a recipient's delete ends the offers made to it", () => {
|
|
359
|
+
const delete_account = async (fixture, account) => {
|
|
360
|
+
assert_ok(await rpc(fixture, 'account_delete', { account_id: account.account.id }, fixture.create_session_headers()), 'account_delete');
|
|
361
|
+
};
|
|
362
|
+
/** The offers `headers`' account made or received, as its history lists them. */
|
|
363
|
+
const history = async (fixture, headers) => expect_output(await rpc(fixture, 'role_grant_offer_history', {}, headers), RoleGrantOfferHistoryOutput).offers;
|
|
364
|
+
test('deleting the recipient supersedes every pending offer to it, account- and actor-addressed', async () => {
|
|
365
|
+
const fixture = await setup_test();
|
|
366
|
+
const recipient = await fixture.create_account({ username: 'incoming_deleted_to' });
|
|
367
|
+
const bystander = await fixture.create_account({ username: 'incoming_bystander' });
|
|
368
|
+
const grantor = await fixture.create_account({ username: 'incoming_grantor' });
|
|
369
|
+
await create_active_role_grant(fixture, grantor, { role: ROLE_ADMIN, rpc_path });
|
|
370
|
+
const by_account = await create_offer(fixture, recipient);
|
|
371
|
+
const created = await rpc(fixture, 'role_grant_offer_create', { to_account_id: recipient.account.id, to_actor_id: recipient.actor.id, role }, grantor.create_session_headers());
|
|
372
|
+
if (!created.ok)
|
|
373
|
+
assert.fail(`actor-addressed offer: ${JSON.stringify(created)}`);
|
|
374
|
+
const by_actor = created.result.offer;
|
|
375
|
+
const control = await create_offer(fixture, bystander);
|
|
376
|
+
await delete_account(fixture, recipient);
|
|
377
|
+
const supersedes = await list_audit_events(fixture, { event_type: 'role_grant_offer_supersede' }, rpc_path);
|
|
378
|
+
for (const [offer_id, grantor_headers, label] of [
|
|
379
|
+
[by_account.id, fixture.create_session_headers(), 'the account-addressed offer'],
|
|
380
|
+
[by_actor.id, grantor.create_session_headers(), 'the actor-addressed offer']
|
|
381
|
+
]) {
|
|
382
|
+
const rows = supersedes.filter((e) => e.metadata?.offer_id === offer_id);
|
|
383
|
+
assert.strictEqual(rows.length, 1, `one role_grant_offer_supersede row for ${label}`);
|
|
384
|
+
assert_audit_metadata_fields(fixture, rows[0].metadata, {
|
|
385
|
+
offer_id,
|
|
386
|
+
role,
|
|
387
|
+
scope_id: null,
|
|
388
|
+
reason: 'account_deleted',
|
|
389
|
+
cause_id: recipient.account.id
|
|
390
|
+
});
|
|
391
|
+
const listed = (await history(fixture, grantor_headers)).find((o) => o.id === offer_id);
|
|
392
|
+
assert.ok(listed?.superseded_at, `the grantor's history lists ${label} superseded`);
|
|
393
|
+
assert.strictEqual(listed.accepted_at, null, label);
|
|
394
|
+
}
|
|
395
|
+
assert.ok(await is_pending(fixture, bystander, control.id), "another account's offer stays pending");
|
|
396
|
+
});
|
|
397
|
+
test('an offer to a deleted account or actor answers as one to a missing account or actor does, as role_grant_assign does', async () => {
|
|
398
|
+
const fixture = await setup_test();
|
|
399
|
+
const recipient = await fixture.create_account({ username: 'incoming_refused_to' });
|
|
400
|
+
const live = await fixture.create_account({ username: 'incoming_refused_live' });
|
|
401
|
+
await delete_account(fixture, recipient);
|
|
402
|
+
const call = (method, params) => rpc(fixture, method, { ...params, role }, fixture.create_session_headers());
|
|
403
|
+
const answer = (res, label) => {
|
|
404
|
+
assert.ok(!res.ok, `${label} must be refused: ${JSON.stringify(res)}`);
|
|
405
|
+
return { status: res.status, error: res.error };
|
|
406
|
+
};
|
|
407
|
+
const deleted_account = { to_account_id: recipient.account.id };
|
|
408
|
+
const missing_account = { to_account_id: NIL_UUID };
|
|
409
|
+
const deleted_actor = {
|
|
410
|
+
to_account_id: recipient.account.id,
|
|
411
|
+
to_actor_id: recipient.actor.id
|
|
412
|
+
};
|
|
413
|
+
const missing_actor = { to_account_id: live.account.id, to_actor_id: NIL_UUID };
|
|
414
|
+
const account_refusal = answer(await call('role_grant_offer_create', missing_account), 'an offer to a missing account');
|
|
415
|
+
assert.strictEqual(account_refusal.status, 404);
|
|
416
|
+
assert.strictEqual(account_refusal.error.code, JSONRPC_ERROR_CODES.not_found);
|
|
417
|
+
const actor_refusal = answer(await call('role_grant_offer_create', missing_actor), 'an offer naming a missing actor');
|
|
418
|
+
assert.strictEqual(actor_refusal.status, 400);
|
|
419
|
+
assert.strictEqual(actor_refusal.error.code, JSONRPC_ERROR_CODES.invalid_params);
|
|
420
|
+
assert.deepStrictEqual(actor_refusal.error.data, {
|
|
421
|
+
reason: ERROR_ROLE_GRANT_OFFER_ACTOR_ACCOUNT_MISMATCH
|
|
422
|
+
});
|
|
423
|
+
for (const [method, params, expected, label] of [
|
|
424
|
+
[
|
|
425
|
+
'role_grant_offer_create',
|
|
426
|
+
deleted_account,
|
|
427
|
+
account_refusal,
|
|
428
|
+
'an offer to a deleted account'
|
|
429
|
+
],
|
|
430
|
+
[
|
|
431
|
+
'role_grant_offer_create',
|
|
432
|
+
deleted_actor,
|
|
433
|
+
actor_refusal,
|
|
434
|
+
'an offer naming a deleted actor'
|
|
435
|
+
],
|
|
436
|
+
['role_grant_assign', deleted_account, account_refusal, 'an assign to a deleted account'],
|
|
437
|
+
['role_grant_assign', missing_account, account_refusal, 'an assign to a missing account'],
|
|
438
|
+
['role_grant_assign', deleted_actor, actor_refusal, 'an assign naming a deleted actor'],
|
|
439
|
+
['role_grant_assign', missing_actor, actor_refusal, 'an assign naming a missing actor']
|
|
440
|
+
]) {
|
|
441
|
+
assert.deepStrictEqual(answer(await call(method, params), label), expected, label);
|
|
442
|
+
}
|
|
443
|
+
// a grantor with no authority to confer learns nothing of the recipient
|
|
444
|
+
const unauthorized = await fixture.create_account({ username: 'incoming_refused_by' });
|
|
445
|
+
const refusals = [];
|
|
446
|
+
for (const params of [deleted_account, missing_account, { to_account_id: live.account.id }]) {
|
|
447
|
+
const res = await rpc(fixture, 'role_grant_offer_create', { ...params, role }, unauthorized.create_session_headers());
|
|
448
|
+
const refusal = answer(res, 'an offer by a grantor without authority');
|
|
449
|
+
assert.strictEqual(refusal.status, 403);
|
|
450
|
+
assert.strictEqual(refusal.error.code, JSONRPC_ERROR_CODES.forbidden);
|
|
451
|
+
assert.deepStrictEqual(refusal.error.data, {
|
|
452
|
+
reason: ERROR_ROLE_GRANT_OFFER_NOT_AUTHORIZED
|
|
453
|
+
});
|
|
454
|
+
refusals.push(refusal);
|
|
455
|
+
}
|
|
456
|
+
assert.deepStrictEqual(refusals[0], refusals[2], 'a deleted recipient: as a live one');
|
|
457
|
+
assert.deepStrictEqual(refusals[1], refusals[2], 'a missing recipient: as a live one');
|
|
458
|
+
// the self-target check comes first, whatever actor is named
|
|
459
|
+
const self = answer(await call('role_grant_offer_create', {
|
|
460
|
+
to_account_id: fixture.account.id,
|
|
461
|
+
to_actor_id: live.actor.id
|
|
462
|
+
}), 'an offer to oneself naming another account’s actor');
|
|
463
|
+
assert.strictEqual(self.status, 400);
|
|
464
|
+
assert.deepStrictEqual(self.error.data, { reason: ERROR_ROLE_GRANT_OFFER_SELF_TARGET });
|
|
465
|
+
const offers = await history(fixture, fixture.create_session_headers());
|
|
466
|
+
assert.ok(!offers.some((o) => o.to_account_id === recipient.account.id), 'no offer to the deleted account was created');
|
|
467
|
+
});
|
|
468
|
+
});
|
|
297
469
|
};
|
|
@@ -32,10 +32,11 @@ export interface RoleGrantOfferNotificationWsTestOptions extends WsEndpointTarge
|
|
|
32
32
|
/**
|
|
33
33
|
* Register the role-grant-offer WS notification suite — cases over a real
|
|
34
34
|
* upgrade, one per server-initiated notification (received / accepted /
|
|
35
|
-
* declined / retracted / revoke, global and scoped, + supersede on
|
|
36
|
-
*
|
|
37
|
-
* lifecycle RPC, and strict-parses the delivered
|
|
38
|
-
* params schema. Gated on `capabilities.ws
|
|
35
|
+
* declined / retracted / revoke, global and scoped, + supersede on the accept,
|
|
36
|
+
* revoke, delete and purge cascades). Each opens every party's socket, drives
|
|
37
|
+
* the lifecycle RPC, and strict-parses the delivered frames against their
|
|
38
|
+
* canonical params schema. Gated on `capabilities.ws`, the removals on
|
|
39
|
+
* `capabilities.account_lifecycle` too.
|
|
39
40
|
*/
|
|
40
41
|
export declare const describe_role_grant_offer_notification_ws_tests: (options: RoleGrantOfferNotificationWsTestOptions) => void;
|
|
41
42
|
//# sourceMappingURL=role_grant_offer_notification_ws.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_notification_ws.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_notification_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"role_grant_offer_notification_ws.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_notification_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAuG9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AAOtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAmB,KAAK,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAwBjG,2EAA2E;AAC3E,MAAM,WAAW,uCAAwC,SAAQ,gBAAgB;IAChF,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,+CAA+C,GAC3D,SAAS,uCAAuC,KAC9C,IA4qBF,CAAC"}
|