@fuzdev/fuz_app 0.150.0 → 0.151.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/README.md +1 -1
- package/dist/actions/CLAUDE.md +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -34
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +52 -75
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +70 -44
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +179 -158
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -77
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +9 -2
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +23 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +45 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +2 -1
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -239
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate_limiting.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rate_limiting.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA0B7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"rate_limiting.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rate_limiting.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA0B7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAIhE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACxC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,uBAAuB,KAAG,IA2J/E,CAAC"}
|
|
@@ -23,8 +23,9 @@ import './assert_dev_env.js';
|
|
|
23
23
|
import { describe, test, assert } from 'vitest';
|
|
24
24
|
import { RateLimiter } from '../rate_limiter.js';
|
|
25
25
|
import { RateLimitError } from '../http/error_schemas.js';
|
|
26
|
-
import {
|
|
26
|
+
import { AUTH_MIGRATION_NS } from '../auth/migrations.js';
|
|
27
27
|
import { create_test_app } from './app_server.js';
|
|
28
|
+
import { create_test_request_headers } from './test_origin.js';
|
|
28
29
|
import { create_default_db_factory, create_describe_db, auth_integration_truncate_tables } from './db.js';
|
|
29
30
|
import { find_auth_route, assert_rate_limit_retry_after_header } from './integration_helpers.js';
|
|
30
31
|
import { run_migrations } from '../db/migrate.js';
|
|
@@ -47,7 +48,7 @@ import { run_migrations } from '../db/migrate.js';
|
|
|
47
48
|
export const describe_rate_limiting_tests = (options) => {
|
|
48
49
|
const max_attempts = options.max_attempts ?? 2;
|
|
49
50
|
const init_schema = async (db) => {
|
|
50
|
-
await run_migrations(db, [
|
|
51
|
+
await run_migrations(db, [AUTH_MIGRATION_NS]);
|
|
51
52
|
};
|
|
52
53
|
const factories = options.db_factories ?? [create_default_db_factory(init_schema)];
|
|
53
54
|
const describe_db = create_describe_db(factories, auth_integration_truncate_tables);
|
|
@@ -76,11 +77,9 @@ export const describe_rate_limiting_tests = (options) => {
|
|
|
76
77
|
for (let i = 0; i < max_attempts; i++) {
|
|
77
78
|
const res = await test_app.app.request(login_route.path, {
|
|
78
79
|
method: 'POST',
|
|
79
|
-
headers: {
|
|
80
|
-
host: 'localhost',
|
|
81
|
-
origin: 'http://localhost:5173',
|
|
80
|
+
headers: create_test_request_headers({
|
|
82
81
|
'content-type': 'application/json'
|
|
83
|
-
},
|
|
82
|
+
}),
|
|
84
83
|
body: JSON.stringify({ username: 'nonexistent', password: 'wrong' })
|
|
85
84
|
});
|
|
86
85
|
assert.notStrictEqual(res.status, 429, `Request ${i + 1}/${max_attempts} should not be rate limited`);
|
|
@@ -88,11 +87,9 @@ export const describe_rate_limiting_tests = (options) => {
|
|
|
88
87
|
// The next request should be rate limited
|
|
89
88
|
const blocked_res = await test_app.app.request(login_route.path, {
|
|
90
89
|
method: 'POST',
|
|
91
|
-
headers: {
|
|
92
|
-
host: 'localhost',
|
|
93
|
-
origin: 'http://localhost:5173',
|
|
90
|
+
headers: create_test_request_headers({
|
|
94
91
|
'content-type': 'application/json'
|
|
95
|
-
},
|
|
92
|
+
}),
|
|
96
93
|
body: JSON.stringify({ username: 'nonexistent', password: 'wrong' })
|
|
97
94
|
});
|
|
98
95
|
assert.strictEqual(blocked_res.status, 429);
|
|
@@ -129,11 +126,9 @@ export const describe_rate_limiting_tests = (options) => {
|
|
|
129
126
|
for (let i = 0; i < max_attempts; i++) {
|
|
130
127
|
const res = await test_app.app.request(login_route.path, {
|
|
131
128
|
method: 'POST',
|
|
132
|
-
headers: {
|
|
133
|
-
host: 'localhost',
|
|
134
|
-
origin: 'http://localhost:5173',
|
|
129
|
+
headers: create_test_request_headers({
|
|
135
130
|
'content-type': 'application/json'
|
|
136
|
-
},
|
|
131
|
+
}),
|
|
137
132
|
body: JSON.stringify({ username: target_username, password: 'wrong' })
|
|
138
133
|
});
|
|
139
134
|
assert.notStrictEqual(res.status, 429, `Request ${i + 1}/${max_attempts} should not be rate limited`);
|
|
@@ -141,11 +136,9 @@ export const describe_rate_limiting_tests = (options) => {
|
|
|
141
136
|
// The next request for the same username should be rate limited
|
|
142
137
|
const blocked_res = await test_app.app.request(login_route.path, {
|
|
143
138
|
method: 'POST',
|
|
144
|
-
headers: {
|
|
145
|
-
host: 'localhost',
|
|
146
|
-
origin: 'http://localhost:5173',
|
|
139
|
+
headers: create_test_request_headers({
|
|
147
140
|
'content-type': 'application/json'
|
|
148
|
-
},
|
|
141
|
+
}),
|
|
149
142
|
body: JSON.stringify({ username: target_username, password: 'wrong' })
|
|
150
143
|
});
|
|
151
144
|
assert.strictEqual(blocked_res.status, 429);
|
|
@@ -156,11 +149,9 @@ export const describe_rate_limiting_tests = (options) => {
|
|
|
156
149
|
// A different username should NOT be rate limited
|
|
157
150
|
const other_res = await test_app.app.request(login_route.path, {
|
|
158
151
|
method: 'POST',
|
|
159
|
-
headers: {
|
|
160
|
-
host: 'localhost',
|
|
161
|
-
origin: 'http://localhost:5173',
|
|
152
|
+
headers: create_test_request_headers({
|
|
162
153
|
'content-type': 'application/json'
|
|
163
|
-
},
|
|
154
|
+
}),
|
|
164
155
|
body: JSON.stringify({ username: 'different_user', password: 'wrong' })
|
|
165
156
|
});
|
|
166
157
|
assert.notStrictEqual(other_res.status, 429, 'Different username should not be rate limited');
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
import type { BuiltinCredentialType } from '../auth/credential_type_schema.js';
|
|
3
|
+
import type { ResolvedAuth } from '../auth/resolved_auth.js';
|
|
4
|
+
import { type TokenScope } from '../auth/token_scope.js';
|
|
5
|
+
/** Options for `create_test_resolved_auth`. */
|
|
6
|
+
export interface TestResolvedAuthOptions {
|
|
7
|
+
credential_type: BuiltinCredentialType;
|
|
8
|
+
account_id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The raw session token a `session` credential carries, hashed into its
|
|
11
|
+
* `session_hash` the way the session leg hashes the cookie's. Default a
|
|
12
|
+
* fresh uuid. Ignored for other credential types.
|
|
13
|
+
*/
|
|
14
|
+
session_id?: string;
|
|
15
|
+
/** The `api_token` credential's token id. Default a fresh uuid. Ignored for other credential types. */
|
|
16
|
+
api_token_id?: string;
|
|
17
|
+
/** The `api_token` credential's scope. Default `full`. Ignored for other credential types. */
|
|
18
|
+
scope?: TokenScope;
|
|
19
|
+
/** The credential deadline. Default `null`; always `null` for a daemon token. */
|
|
20
|
+
credential_deadline?: number | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Build the `ResolvedAuth` arm for a credential type, as the auth middleware
|
|
24
|
+
* would for that credential.
|
|
25
|
+
*
|
|
26
|
+
* @param options - the credential type, account, and the fields of its arm
|
|
27
|
+
* @returns the resolved credential
|
|
28
|
+
*/
|
|
29
|
+
export declare const create_test_resolved_auth: (options: TestResolvedAuthOptions) => ResolvedAuth;
|
|
30
|
+
//# sourceMappingURL=resolved_auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved_auth.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/resolved_auth.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACvC,eAAe,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uGAAuG;IACvG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,iFAAiF;IACjF,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,uBAAuB,KAAG,YAsB5E,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Test factory for `ResolvedAuth` — the credential the auth middleware chain
|
|
4
|
+
* resolves, built directly for harnesses that preset it on a Hono context
|
|
5
|
+
* (`RESOLVED_AUTH_KEY`) instead of running the middleware.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { create_uuid } from '../primitive_schemas.js';
|
|
10
|
+
import { hash_session_token } from '../auth/session_queries.js';
|
|
11
|
+
import { token_scope_full } from '../auth/token_scope.js';
|
|
12
|
+
/**
|
|
13
|
+
* Build the `ResolvedAuth` arm for a credential type, as the auth middleware
|
|
14
|
+
* would for that credential.
|
|
15
|
+
*
|
|
16
|
+
* @param options - the credential type, account, and the fields of its arm
|
|
17
|
+
* @returns the resolved credential
|
|
18
|
+
*/
|
|
19
|
+
export const create_test_resolved_auth = (options) => {
|
|
20
|
+
const { credential_type, account_id } = options;
|
|
21
|
+
const credential_deadline = options.credential_deadline ?? null;
|
|
22
|
+
switch (credential_type) {
|
|
23
|
+
case 'session':
|
|
24
|
+
return {
|
|
25
|
+
credential_type,
|
|
26
|
+
account_id,
|
|
27
|
+
session_hash: hash_session_token(options.session_id ?? create_uuid()),
|
|
28
|
+
credential_deadline
|
|
29
|
+
};
|
|
30
|
+
case 'api_token':
|
|
31
|
+
return {
|
|
32
|
+
credential_type,
|
|
33
|
+
account_id,
|
|
34
|
+
api_token_id: options.api_token_id ?? create_uuid(),
|
|
35
|
+
scope: options.scope ?? token_scope_full(),
|
|
36
|
+
credential_deadline
|
|
37
|
+
};
|
|
38
|
+
case 'daemon_token':
|
|
39
|
+
return { credential_type, account_id, credential_deadline: null };
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_envelope_cases.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_envelope_cases.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAe7B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAK7E,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,MAAM,8BAA8B,CAAC;AAItC,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC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AAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAgC,CAAC;AAEzF,wFAAwF;AACxF,eAAO,MAAM,2BAA2B,GAAI,QAAQ,MAAM,KAAG,MACL,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,yBAAyB,GACrC,UAAU,qBAAqB,EAC/B,UAAS,sBAA2B,KAClC,KAAK,CAAC,eAAe,CA0KvB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GACnC,eAAe,MAAM,EACrB,GAAG,eAAe,EAClB,UAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KAClC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAUgD,CAAC;AAEpF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,MAAM,EACd,MAAM,OAAO,EACb,GAAG,eAAe,KAChB,IAUF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,8BAA8B,GAC1C,OAAO,CAAC,CAAC,OAAO,EAChB,UAAU,oBAAoB,KAC5B,KAAK,CAAC,aAAa,CAGpB,CAAC"}
|
|
@@ -93,6 +93,9 @@ export const create_rpc_envelope_cases = (endpoint, options = {}) => {
|
|
|
93
93
|
id: null,
|
|
94
94
|
reason: null
|
|
95
95
|
});
|
|
96
|
+
// HTTP issues no server-initiated requests, so a reply is refused like a
|
|
97
|
+
// notification, its id unechoed
|
|
98
|
+
post('response-shaped body → invalid_request', JSON.stringify({ jsonrpc: '2.0', id, result: {} }), { ...invalid_request, id: null, reason: null });
|
|
96
99
|
post('batch (array) body → invalid_request', JSON.stringify([{ jsonrpc: '2.0', id, method: m }]), { ...invalid_request, id: null, reason: null });
|
|
97
100
|
post('unknown method name → method_not_found', JSON.stringify({ jsonrpc: '2.0', id, method: '__nonexistent_method__' }), { status: 404, code: JSONRPC_ERROR_CODES.method_not_found, id, reason: null });
|
|
98
101
|
get('GET missing method → invalid_request', `?id=${id}`, {
|
|
@@ -2,7 +2,7 @@ import './assert_dev_env.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { type JsonrpcErrorCode } from '../http/jsonrpc.js';
|
|
4
4
|
import type { RequestResponseActionSpec } from '../actions/action_spec.js';
|
|
5
|
-
import type { RpcAction } from '../actions/
|
|
5
|
+
import type { RpcAction } from '../actions/action_types.js';
|
|
6
6
|
import type { AppSurfaceRpcEndpoint, AppSurfaceRpcMethod, RpcEndpointSpec } from '../http/surface.js';
|
|
7
7
|
import type { AppServerContext } from '../server/app_server_context.js';
|
|
8
8
|
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"rpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EACX,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,MAAM,oBAAoB,CAAC;AAC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
import { create_stub_app_server_context } from './stubs.js';
|
|
15
|
+
import { TEST_ORIGIN } from './test_origin.js';
|
|
15
16
|
/**
|
|
16
17
|
* Resolve a suite's `rpc_endpoints` option to an array for setup-time
|
|
17
18
|
* inspection (path lookup, action presence checks).
|
|
@@ -166,7 +167,7 @@ const merge_header_records = (...sources) => {
|
|
|
166
167
|
/** Default headers merged into every `rpc_call` request. Includes `origin`. */
|
|
167
168
|
const RPC_CALL_DEFAULT_HEADERS = {
|
|
168
169
|
...RPC_CALL_DEFAULT_HEADERS_BASE,
|
|
169
|
-
origin:
|
|
170
|
+
origin: TEST_ORIGIN
|
|
170
171
|
};
|
|
171
172
|
/**
|
|
172
173
|
* Send one JSON-RPC request the way `rpc_call` does — same defaults, verbs
|
|
@@ -45,10 +45,11 @@ export interface SseRouteTestOptions {
|
|
|
45
45
|
db_factories?: Array<DbFactory>;
|
|
46
46
|
/**
|
|
47
47
|
* Backend audit event callback — threaded to `create_test_app_server`.
|
|
48
|
-
* Use to wire a close-on-revoke guard for consumer SSE registries
|
|
49
|
-
* (
|
|
50
|
-
* tested streams — not needed for a
|
|
51
|
-
* `ctx.deps.connection_closer`, which the
|
|
48
|
+
* Use to wire a close-on-revoke guard for consumer SSE registries (e.g.
|
|
49
|
+
* `create_revocation_guard(create_sse_connection_closer(registry, role), log)`)
|
|
50
|
+
* so `session_revoke_all` closes the tested streams — not needed for a
|
|
51
|
+
* registry the route joined to `ctx.deps.connection_closer`, which the
|
|
52
|
+
* revoking handler closes itself.
|
|
52
53
|
*/
|
|
53
54
|
on_audit_event?: (event: AuditLogEvent) => void;
|
|
54
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse_round_trip.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/sse_round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK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ACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC,8BAA8B;IAC9B,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CAChC;AAmDD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,mBAAmB,KAAG,IAkIvE,CAAC"}
|
|
@@ -22,7 +22,7 @@ import { create_default_db_factory } from './db.js';
|
|
|
22
22
|
import { find_route_spec, pick_auth_headers } from './integration_helpers.js';
|
|
23
23
|
import { rpc_call, require_rpc_endpoint_path, resolve_rpc_endpoints_for_setup } from './rpc_helpers.js';
|
|
24
24
|
import { run_migrations } from '../db/migrate.js';
|
|
25
|
-
import {
|
|
25
|
+
import { AUTH_MIGRATION_NS } from '../auth/migrations.js';
|
|
26
26
|
import { account_session_revoke_all_action_spec } from '../auth/account_action_specs.js';
|
|
27
27
|
import { create_sse_frame_reader } from './transports/sse_frame_reader.js';
|
|
28
28
|
/**
|
|
@@ -72,7 +72,7 @@ export const describe_sse_route_tests = (options) => {
|
|
|
72
72
|
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_options);
|
|
73
73
|
const rpc_path = require_rpc_endpoint_path(rpc_endpoints_for_setup);
|
|
74
74
|
const init_schema = async (db) => {
|
|
75
|
-
await run_migrations(db, [
|
|
75
|
+
await run_migrations(db, [AUTH_MIGRATION_NS]);
|
|
76
76
|
};
|
|
77
77
|
const factories = options.db_factories ?? [create_default_db_factory(init_schema)];
|
|
78
78
|
for (const factory of factories) {
|
package/dist/testing/stubs.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { type RouteSpec } from '../http/route_spec.js';
|
|
|
12
12
|
import { type AppSurfaceSpec, type RpcEndpointSpec } from '../http/surface.js';
|
|
13
13
|
import { type WsEndpointSpec } from '../actions/ws_endpoint_spec.js';
|
|
14
14
|
import type { EventSpec } from '../realtime/sse.js';
|
|
15
|
-
import { type AuditLogSse } from '../realtime/
|
|
15
|
+
import { type AuditLogSse } from '../realtime/audit_log_sse.js';
|
|
16
16
|
/**
|
|
17
17
|
* Create a Proxy that throws descriptive errors on any property access or method call.
|
|
18
18
|
*
|
|
@@ -75,7 +75,7 @@ export declare const create_test_audit_emitter: () => AuditEmitter;
|
|
|
75
75
|
* surface helper but don't assert on SSE fan-out or subscriber state.
|
|
76
76
|
*
|
|
77
77
|
* `on_audit_event` is a no-op, so nothing is broadcast; the
|
|
78
|
-
* `registry` is a fresh `
|
|
78
|
+
* `registry` is a fresh `SseRegistry` instance (call sites that
|
|
79
79
|
* inspect `.size` or call `.close_*` see a real registry, so writes are
|
|
80
80
|
* isolated per test). Tests that need real SSE plumbing build it via
|
|
81
81
|
* `create_audit_log_sse` against `create_test_app`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stubs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/stubs.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAErF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAsB,KAAK,SAA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.js';
|
|
|
17
17
|
import { create_surface_route_spec } from '../server/surface_route.js';
|
|
18
18
|
import { create_app_surface_spec } from '../http/surface.js';
|
|
19
19
|
import { resolve_ws_endpoints } from '../actions/ws_endpoint_spec.js';
|
|
20
|
-
import { AUDIT_LOG_SSE_MAX_PER_SCOPE } from '../realtime/
|
|
21
|
-
import {
|
|
20
|
+
import { AUDIT_LOG_SSE_MAX_PER_SCOPE } from '../realtime/audit_log_sse.js';
|
|
21
|
+
import { SseRegistry } from '../realtime/sse_registry.js';
|
|
22
22
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
23
23
|
import { BaseServerEnv } from '../server/env.js';
|
|
24
24
|
import { AUTH_MIDDLEWARE_PATH, ORIGIN_MIDDLEWARE_PATH, assert_credential_routes_in_auth_scope, assert_endpoint_in_auth_scope, assert_middleware_stack_mounted, assert_origin_carve_outs_valid, freeze_origin_carve_outs } from '../auth/middleware.js';
|
|
@@ -124,13 +124,13 @@ export const create_test_audit_emitter = () => ({
|
|
|
124
124
|
* surface helper but don't assert on SSE fan-out or subscriber state.
|
|
125
125
|
*
|
|
126
126
|
* `on_audit_event` is a no-op, so nothing is broadcast; the
|
|
127
|
-
* `registry` is a fresh `
|
|
127
|
+
* `registry` is a fresh `SseRegistry` instance (call sites that
|
|
128
128
|
* inspect `.size` or call `.close_*` see a real registry, so writes are
|
|
129
129
|
* isolated per test). Tests that need real SSE plumbing build it via
|
|
130
130
|
* `create_audit_log_sse` against `create_test_app`.
|
|
131
131
|
*/
|
|
132
132
|
export const create_stub_audit_sse = () => {
|
|
133
|
-
const registry = new
|
|
133
|
+
const registry = new SseRegistry({
|
|
134
134
|
max_per_scope: AUDIT_LOG_SSE_MAX_PER_SCOPE
|
|
135
135
|
});
|
|
136
136
|
return {
|
|
@@ -191,6 +191,16 @@ export const create_stub_api_middleware = (options) => {
|
|
|
191
191
|
errors: { 403: ApiError },
|
|
192
192
|
...(origin_carve_outs.length > 0 && { carve_outs: origin_carve_outs })
|
|
193
193
|
},
|
|
194
|
+
...(options?.include_daemon_token
|
|
195
|
+
? [
|
|
196
|
+
{
|
|
197
|
+
name: 'daemon_token',
|
|
198
|
+
path: AUTH_MIDDLEWARE_PATH,
|
|
199
|
+
handler: create_stub_mw(),
|
|
200
|
+
errors: {}
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
: []),
|
|
194
204
|
{ name: 'session', path: AUTH_MIDDLEWARE_PATH, handler: create_stub_mw() },
|
|
195
205
|
{ name: 'request_context', path: AUTH_MIDDLEWARE_PATH, handler: create_stub_mw() },
|
|
196
206
|
{
|
|
@@ -200,14 +210,6 @@ export const create_stub_api_middleware = (options) => {
|
|
|
200
210
|
errors: {}
|
|
201
211
|
}
|
|
202
212
|
];
|
|
203
|
-
if (options?.include_daemon_token) {
|
|
204
|
-
specs.push({
|
|
205
|
-
name: 'daemon_token',
|
|
206
|
-
path: AUTH_MIDDLEWARE_PATH,
|
|
207
|
-
handler: create_stub_mw(),
|
|
208
|
-
errors: {}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
213
|
return specs;
|
|
212
214
|
};
|
|
213
215
|
/**
|
|
@@ -236,19 +238,18 @@ export const create_stub_app_server_context = (session_options) => {
|
|
|
236
238
|
};
|
|
237
239
|
};
|
|
238
240
|
/**
|
|
239
|
-
*
|
|
241
|
+
* Check that a WS endpoint spec carries its own `allowed_origins` — the only
|
|
240
242
|
* way it resolves when no server list is given to default from.
|
|
241
243
|
*
|
|
242
244
|
* @throws Error when the spec declares no `allowed_origins`
|
|
243
245
|
*/
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
if (!allowed_origins) {
|
|
246
|
+
const assert_self_resolved_ws_origins = (endpoint) => {
|
|
247
|
+
if (!endpoint.allowed_origins) {
|
|
247
248
|
throw new Error(`create_test_app_surface_spec: ws endpoint ${endpoint.path} has no allowed_origins — ` +
|
|
248
249
|
"pass the server's list as create_test_app_surface_spec's allowed_origins option, " +
|
|
249
250
|
'or set allowed_origins on the spec');
|
|
250
251
|
}
|
|
251
|
-
return
|
|
252
|
+
return endpoint;
|
|
252
253
|
};
|
|
253
254
|
/**
|
|
254
255
|
* Create an `AppSurfaceSpec` for the standard testing suites.
|
|
@@ -302,11 +303,13 @@ export const create_test_app_surface_spec = (options) => {
|
|
|
302
303
|
});
|
|
303
304
|
}) ?? [];
|
|
304
305
|
// Resolve ws endpoints (mirrors create_app_server). Surface-only —
|
|
305
|
-
// no `
|
|
306
|
+
// no `register_action_ws` call here, so no `create_upgrade_websocket` needed.
|
|
306
307
|
const declared_ws_endpoints = typeof options.ws_endpoints === 'function' ? options.ws_endpoints(ctx) : options.ws_endpoints;
|
|
307
|
-
const resolved_ws_endpoints = options.allowed_origins
|
|
308
|
-
?
|
|
309
|
-
: declared_ws_endpoints?.map(
|
|
308
|
+
const resolved_ws_endpoints = resolve_ws_endpoints(options.allowed_origins
|
|
309
|
+
? declared_ws_endpoints
|
|
310
|
+
: declared_ws_endpoints?.map(assert_self_resolved_ws_origins),
|
|
311
|
+
// with no server list every spec carries its own, so the empty default never applies
|
|
312
|
+
{ allowed_origins: options.allowed_origins ?? [], rpc_endpoints: resolved_rpc_endpoints });
|
|
310
313
|
for (const endpoint of resolved_ws_endpoints ?? []) {
|
|
311
314
|
assert_endpoint_in_auth_scope('ws_endpoints', endpoint.path);
|
|
312
315
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The origin an in-process test request comes from, and the headers such a
|
|
4
|
+
* request starts from. Dependency-free, so a cross-process suite reads it
|
|
5
|
+
* without pulling in the server assembly `app_server.ts` builds on.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The origin an in-process test request comes from — the dev server's, and
|
|
11
|
+
* the one origin `create_loopback_app_server_options` allows, so a request
|
|
12
|
+
* carrying it passes the origin check. It is also the `Origin` `rpc_call`
|
|
13
|
+
* sends cross-process, so a consumer's backend must allow it for `rpc_call`
|
|
14
|
+
* to pass the backend's origin check.
|
|
15
|
+
*/
|
|
16
|
+
export declare const TEST_ORIGIN = "http://localhost:5173";
|
|
17
|
+
/**
|
|
18
|
+
* The headers every in-process test request starts from: `host: localhost`
|
|
19
|
+
* and `TEST_ORIGIN`, which the loopback allow list admits.
|
|
20
|
+
*
|
|
21
|
+
* @param extra - headers added after, replacing either of the defaults
|
|
22
|
+
* @returns a fresh object
|
|
23
|
+
*/
|
|
24
|
+
export declare const create_test_request_headers: (extra?: Record<string, string>) => Record<string, string>;
|
|
25
|
+
//# sourceMappingURL=test_origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_origin.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/test_origin.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,0BAA0B,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAItB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The origin an in-process test request comes from, and the headers such a
|
|
4
|
+
* request starts from. Dependency-free, so a cross-process suite reads it
|
|
5
|
+
* without pulling in the server assembly `app_server.ts` builds on.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The origin an in-process test request comes from — the dev server's, and
|
|
11
|
+
* the one origin `create_loopback_app_server_options` allows, so a request
|
|
12
|
+
* carrying it passes the origin check. It is also the `Origin` `rpc_call`
|
|
13
|
+
* sends cross-process, so a consumer's backend must allow it for `rpc_call`
|
|
14
|
+
* to pass the backend's origin check.
|
|
15
|
+
*/
|
|
16
|
+
export const TEST_ORIGIN = 'http://localhost:5173';
|
|
17
|
+
/**
|
|
18
|
+
* The headers every in-process test request starts from: `host: localhost`
|
|
19
|
+
* and `TEST_ORIGIN`, which the loopback allow list admits.
|
|
20
|
+
*
|
|
21
|
+
* @param extra - headers added after, replacing either of the defaults
|
|
22
|
+
* @returns a fresh object
|
|
23
|
+
*/
|
|
24
|
+
export const create_test_request_headers = (extra) => ({
|
|
25
|
+
host: 'localhost',
|
|
26
|
+
origin: TEST_ORIGIN,
|
|
27
|
+
...extra
|
|
28
|
+
});
|
|
@@ -60,6 +60,60 @@ export interface RawHttpResponse {
|
|
|
60
60
|
* @param request_bytes - the bytes to send, `latin1`-encoded
|
|
61
61
|
*/
|
|
62
62
|
export declare const raw_http_exchange: (base_url: string, request_bytes: string, options: RawHttpExchangeOptions) => Promise<RawHttpExchange>;
|
|
63
|
+
/** One head-only request for `raw_http_send_head`: where it goes and what it declares. */
|
|
64
|
+
export interface RawHttpHeadRequest {
|
|
65
|
+
/**
|
|
66
|
+
* The request method.
|
|
67
|
+
*
|
|
68
|
+
* @default 'POST'
|
|
69
|
+
*/
|
|
70
|
+
readonly method?: string;
|
|
71
|
+
/** Request path, e.g. `/api/rpc`. */
|
|
72
|
+
readonly path: string;
|
|
73
|
+
/**
|
|
74
|
+
* Request headers beyond `Host` and `Content-Length`, which the helper
|
|
75
|
+
* writes — naming either here, in any casing, throws. Nothing else is
|
|
76
|
+
* defaulted — no `Origin`, no credential — so a request carries exactly
|
|
77
|
+
* what the caller names.
|
|
78
|
+
*/
|
|
79
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
80
|
+
/** The `Content-Length` to declare; no body byte is sent. */
|
|
81
|
+
readonly content_length: number;
|
|
82
|
+
/**
|
|
83
|
+
* How long to wait for the response.
|
|
84
|
+
*
|
|
85
|
+
* @default RAW_HTTP_READ_TIMEOUT_MS
|
|
86
|
+
*/
|
|
87
|
+
readonly read_timeout_ms?: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Send a request head declaring `content_length` body bytes and none of them,
|
|
91
|
+
* then read the one response the server must answer with — the probe for a
|
|
92
|
+
* request the server refuses on its declared length (an over-cap body's `413`).
|
|
93
|
+
*
|
|
94
|
+
* Sending the body instead races the refusal: a server that answers from the
|
|
95
|
+
* head and closes with the upload unread can fail the client's write
|
|
96
|
+
* (`EPIPE`) and lose the response it did send, while one that keeps the
|
|
97
|
+
* connection until the declared body arrives never closes at all. So nothing
|
|
98
|
+
* the server will leave unread is sent, and the read stops at the first whole
|
|
99
|
+
* response rather than at the close.
|
|
100
|
+
*
|
|
101
|
+
* Withholding the body also pins *where* the refusal is made. A server that
|
|
102
|
+
* reads the body before refusing waits for bytes that never arrive and fails
|
|
103
|
+
* the probe on its read timeout; one that carries no cap on the route does the
|
|
104
|
+
* same, or answers whatever the head alone decides. That makes this the wrong
|
|
105
|
+
* tool for a request whose verdict needs body bytes — an under-cap body, an
|
|
106
|
+
* empty one, a chunked upload.
|
|
107
|
+
*
|
|
108
|
+
* @param base_url - the server's base URL; only its host and port are used
|
|
109
|
+
* @param request - the method, path, headers and declared length to send
|
|
110
|
+
* @returns the parsed response; its `body` is the raw text
|
|
111
|
+
* @throws Error when `request.headers` names `Host` or `Content-Length`, or
|
|
112
|
+
* when no whole response arrives — the connection was refused, the server
|
|
113
|
+
* closed it before any byte or partway through a response, or it waited for
|
|
114
|
+
* the body it should have refused without
|
|
115
|
+
*/
|
|
116
|
+
export declare const raw_http_send_head: (base_url: string, request: RawHttpHeadRequest) => Promise<RawHttpResponse>;
|
|
63
117
|
/**
|
|
64
118
|
* Render request headers as raw HTTP/1.1 header lines, each ending in CRLF.
|
|
65
119
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw_http.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/transports/raw_http.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAuB9B;;;;;GAKG;AACH,eAAO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AC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,KAAK,MAAM,KAAG,MACN,CAAC;AAElD,0FAA0F;AAC1F,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAG5D,CAAC;AAyBF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAAI,KAAK,MAAM,KAAG,eAAe,GAAG,IAyBvE,CAAC"}
|
|
@@ -66,6 +66,64 @@ export const raw_http_exchange = (base_url, request_bytes, options) => new Promi
|
|
|
66
66
|
socket.on('error', () => { }); // EPIPE/ECONNRESET on a mid-write close is expected
|
|
67
67
|
socket.on('close', () => finish(true));
|
|
68
68
|
});
|
|
69
|
+
/** Lowercased names of the headers `raw_http_send_head` writes itself. */
|
|
70
|
+
const SEND_HEAD_WRITTEN_HEADERS = ['host', 'content-length'];
|
|
71
|
+
/**
|
|
72
|
+
* Send a request head declaring `content_length` body bytes and none of them,
|
|
73
|
+
* then read the one response the server must answer with — the probe for a
|
|
74
|
+
* request the server refuses on its declared length (an over-cap body's `413`).
|
|
75
|
+
*
|
|
76
|
+
* Sending the body instead races the refusal: a server that answers from the
|
|
77
|
+
* head and closes with the upload unread can fail the client's write
|
|
78
|
+
* (`EPIPE`) and lose the response it did send, while one that keeps the
|
|
79
|
+
* connection until the declared body arrives never closes at all. So nothing
|
|
80
|
+
* the server will leave unread is sent, and the read stops at the first whole
|
|
81
|
+
* response rather than at the close.
|
|
82
|
+
*
|
|
83
|
+
* Withholding the body also pins *where* the refusal is made. A server that
|
|
84
|
+
* reads the body before refusing waits for bytes that never arrive and fails
|
|
85
|
+
* the probe on its read timeout; one that carries no cap on the route does the
|
|
86
|
+
* same, or answers whatever the head alone decides. That makes this the wrong
|
|
87
|
+
* tool for a request whose verdict needs body bytes — an under-cap body, an
|
|
88
|
+
* empty one, a chunked upload.
|
|
89
|
+
*
|
|
90
|
+
* @param base_url - the server's base URL; only its host and port are used
|
|
91
|
+
* @param request - the method, path, headers and declared length to send
|
|
92
|
+
* @returns the parsed response; its `body` is the raw text
|
|
93
|
+
* @throws Error when `request.headers` names `Host` or `Content-Length`, or
|
|
94
|
+
* when no whole response arrives — the connection was refused, the server
|
|
95
|
+
* closed it before any byte or partway through a response, or it waited for
|
|
96
|
+
* the body it should have refused without
|
|
97
|
+
*/
|
|
98
|
+
export const raw_http_send_head = async (base_url, request) => {
|
|
99
|
+
const { method = 'POST', path, headers, content_length, read_timeout_ms = RAW_HTTP_READ_TIMEOUT_MS } = request;
|
|
100
|
+
// a caller-named `Host` or `Content-Length` would replace the helper's line,
|
|
101
|
+
// be dropped under it, or go out beside it as a second one, so the request
|
|
102
|
+
// would no longer be the one the caller describes
|
|
103
|
+
const collision = Object.keys(headers).find((name) => SEND_HEAD_WRITTEN_HEADERS.includes(name.toLowerCase()));
|
|
104
|
+
if (collision !== undefined) {
|
|
105
|
+
throw new Error(`raw_http_send_head writes Host and Content-Length itself; drop '${collision}' from ` +
|
|
106
|
+
'`headers` and declare the length through `content_length`');
|
|
107
|
+
}
|
|
108
|
+
const header_lines = raw_http_header_lines({
|
|
109
|
+
Host: new URL(base_url).host,
|
|
110
|
+
...headers,
|
|
111
|
+
'Content-Length': String(content_length)
|
|
112
|
+
});
|
|
113
|
+
const { received, closed_by_server } = await raw_http_exchange(base_url, `${method} ${path} HTTP/1.1\r\n${header_lines}\r\n`, { read_timeout_ms, until: 'response' });
|
|
114
|
+
const response = raw_http_parse_response(received);
|
|
115
|
+
if (!response) {
|
|
116
|
+
throw new Error(`expected a whole response to ${method} ${path} with the declared body withheld; ` +
|
|
117
|
+
(closed_by_server
|
|
118
|
+
? received
|
|
119
|
+
? 'the server closed the connection first'
|
|
120
|
+
: 'connection refused or closed before any response'
|
|
121
|
+
: `none arrived within ${read_timeout_ms}ms — the server is waiting for a body ` +
|
|
122
|
+
'it should refuse without') +
|
|
123
|
+
`. Received: ${received ? received.slice(0, 120) : 'nothing'}`);
|
|
124
|
+
}
|
|
125
|
+
return response;
|
|
126
|
+
};
|
|
69
127
|
/**
|
|
70
128
|
* Render request headers as raw HTTP/1.1 header lines, each ending in CRLF.
|
|
71
129
|
*
|