@fuzdev/fuz_app 0.149.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 +327 -300
- package/dist/actions/action_bridge.d.ts +5 -79
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -74
- 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_event_types.d.ts +1 -1
- package/dist/actions/action_event_types.d.ts.map +1 -1
- 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 -31
- 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 -292
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -903
- 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 +53 -76
- 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 +132 -68
- 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_lookup_queries.d.ts +3 -2
- package/dist/auth/actor_lookup_queries.d.ts.map +1 -1
- package/dist/auth/actor_lookup_queries.js +6 -3
- 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 +10 -7
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +18 -11
- package/dist/auth/admin_action_specs.d.ts +4 -4
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +7 -5
- 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 +47 -48
- package/dist/auth/all_cell_actions.d.ts +14 -3
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +2 -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 +12 -6
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +11 -5
- 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 +14 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +19 -23
- 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/bootstrap_account.d.ts +25 -1
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +37 -4
- package/dist/auth/bootstrap_routes.d.ts +3 -2
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +5 -4
- 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_action_specs.d.ts +215 -15
- package/dist/auth/cell_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_action_specs.js +103 -16
- package/dist/auth/cell_actions.d.ts +58 -27
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +206 -161
- 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_events.d.ts +1 -1
- package/dist/auth/cell_audit_events.d.ts.map +1 -1
- package/dist/auth/cell_audit_events.js +3 -2
- package/dist/auth/cell_audit_metadata.d.ts +12 -1
- package/dist/auth/cell_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_audit_metadata.js +11 -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 +9 -2
- package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_grant_action_specs.js +10 -3
- package/dist/auth/cell_grant_actions.d.ts +105 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +81 -56
- 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 +8 -7
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +8 -7
- 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 +117 -16
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +51 -16
- package/dist/auth/role_grant_offer_actions.d.ts +22 -11
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +72 -19
- package/dist/auth/role_grant_offer_notifications.d.ts +6 -5
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +4 -3
- package/dist/auth/role_grant_offer_queries.d.ts +20 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +40 -37
- package/dist/auth/role_grant_queries.d.ts +44 -76
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +73 -118
- 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/role_schema.d.ts +14 -8
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +6 -3
- 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 +21 -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 +18 -6
- package/dist/db/cell_ddl.d.ts +5 -134
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +28 -17
- 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 +65 -55
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +85 -62
- 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/body_limit.d.ts +3 -1
- package/dist/http/body_limit.d.ts.map +1 -1
- package/dist/http/body_limit.js +6 -1
- 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.d.ts +9 -0
- package/dist/http/jsonrpc.d.ts.map +1 -1
- package/dist/http/jsonrpc.js +17 -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 +70 -23
- 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/proxy.d.ts +4 -2
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +7 -2
- 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 +4 -2
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +7 -4
- 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 +52 -1
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +123 -6
- 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 +73 -54
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +115 -78
- 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 +213 -179
- 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 -75
- 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/actor_lookup.d.ts.map +1 -1
- package/dist/testing/cross_backend/actor_lookup.js +27 -0
- 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 +15 -8
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_gated_create.js +109 -13
- 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_moderate.d.ts +7 -1
- package/dist/testing/cross_backend/cell_moderate.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_moderate.js +68 -4
- package/dist/testing/cross_backend/cell_ref_admission.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_ref_admission.js +18 -9
- 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 +6 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +12 -10
- 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/differential.d.ts +7 -0
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +17 -0
- package/dist/testing/cross_backend/expected_schema.json +1 -0
- 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 +13 -5
- 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 +96 -2
- 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_gated_create_authorize.d.ts +18 -19
- package/dist/testing/cross_backend/test_cell_gated_create_authorize.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_gated_create_authorize.js +66 -42
- 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 +48 -6
- 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 -94
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -138
- 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 -238
- 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,268 +1,86 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* WebSocket JSON-RPC
|
|
2
|
+
* WebSocket JSON-RPC endpoint — the WS transport binding.
|
|
3
3
|
*
|
|
4
4
|
* Consumers declare WS endpoints on `create_app_server`'s `ws_endpoints`,
|
|
5
|
-
* which mounts each through `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* resolution + optional role). This module stays exported as the
|
|
9
|
-
* lower-level entry point for tests that drive the dispatcher directly via
|
|
10
|
-
* `create_ws_test_harness`.
|
|
5
|
+
* which mounts each through `register_action_ws`; call it directly only to
|
|
6
|
+
* mount an endpoint outside that assembly. Tests drive the dispatcher
|
|
7
|
+
* directly via `create_ws_test_harness`.
|
|
11
8
|
*
|
|
12
|
-
*
|
|
13
|
-
* both transports parse their wire envelope, then call the shared
|
|
14
|
-
* `perform_action` core (`actions/perform_action.ts`) for the post-parse
|
|
15
|
-
* pipeline. WS-specific concerns — connection lifecycle, heartbeat,
|
|
16
|
-
* cancel-notification interception, socket-scoped notify — stay in this
|
|
17
|
-
* module; everything else (auth gates, input validation, authorization
|
|
18
|
-
* phase, rate limiting, transactional dispatch, DEV output validation,
|
|
19
|
-
* thrown-error normalization) is shared.
|
|
20
|
-
*
|
|
21
|
-
* ## Auth expectations
|
|
22
|
-
*
|
|
23
|
-
* The consumer is responsible for rejecting unauthenticated upgrades
|
|
24
|
-
* *before* routing to this handler (fuz_app's `require_auth` middleware,
|
|
25
|
-
* or `register_ws_endpoint` which wires it for you). Per-action auth
|
|
26
|
-
* runs inside `perform_action` on every message via the same gates HTTP
|
|
27
|
-
* RPC uses.
|
|
28
|
-
*
|
|
29
|
-
* ## Admission: the revocation race
|
|
9
|
+
* ## The upgrade route
|
|
30
10
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* logout, password change, token revoke, account delete) closes the sockets
|
|
34
|
-
* *registered* under what it revoked, so one landing in that gap would close
|
|
35
|
-
* nothing, and the socket would then be admitted on the dead credential and
|
|
36
|
-
* keep it: per-message dispatch re-authorizes the *actor*, never the session
|
|
37
|
-
* or token — and its admission could evict a live socket of the same account
|
|
38
|
-
* past the cap.
|
|
11
|
+
* One `GET path` route, its guards in coarse-to-fine order — the route-spec
|
|
12
|
+
* pipeline's, from `fuz_auth_guard_resolver`:
|
|
39
13
|
*
|
|
40
|
-
* `
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* (`
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
14
|
+
* 1. `verify_request_source(allowed_origins)` — a disallowed origin is
|
|
15
|
+
* refused before the upgrade handshake runs (403).
|
|
16
|
+
* 2. `require_auth` — an unauthenticated upgrade is refused (401).
|
|
17
|
+
* 3. `require_token_scope('surface:ws_upgrade')` — rule 3: a narrowed token
|
|
18
|
+
* cannot hold a socket (403 `token_scope_required`). Server-initiated
|
|
19
|
+
* pushes (broadcasts, role-grant-offer notifications, peer requests)
|
|
20
|
+
* reach whatever the account's connection reaches, with no per-recipient
|
|
21
|
+
* filter to narrow them by, so a scoped token that could upgrade would
|
|
22
|
+
* observe far more than it was granted.
|
|
23
|
+
* 4. **Authorization phase** (`run_authorization_phase`) — the acting actor
|
|
24
|
+
* from the `?acting=<uuid>` query string (`parse_acting`; malformed reads
|
|
25
|
+
* as omitted), against the authenticated account, building the
|
|
26
|
+
* `RequestContext` per-message dispatch reads (400s on actor selection).
|
|
27
|
+
* Multi-actor accounts must supply `?acting`; single-actor accounts work
|
|
28
|
+
* without it.
|
|
29
|
+
* 5. `require_role(required_roles)`, for a gated endpoint (403).
|
|
48
30
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* announces a success row to the listeners behind it too. So no interleaving
|
|
54
|
-
* admits a revoked credential; `docs/security.md` §Connection Admission says
|
|
55
|
-
* what that rests on.
|
|
31
|
+
* Only `GET` is mounted (Hono serves `HEAD` through it), so any other method
|
|
32
|
+
* on the path is a 404. The guards run as middleware ahead of
|
|
33
|
+
* `upgradeWebSocket`, whose callback must return `WSEvents` and so cannot
|
|
34
|
+
* produce a refusal.
|
|
56
35
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* reason a revoked socket gets) for a dead credential,
|
|
66
|
-
* `WS_CLOSE_PERMISSION_REVOKED` (4006) for a lost role, or
|
|
67
|
-
* `WS_CLOSE_INTERNAL_ERROR` (1011) when either re-read itself failed — fail
|
|
68
|
-
* closed, never admitted unchecked. The handshake has already answered `101`,
|
|
69
|
-
* so a refusal can only be a close frame.
|
|
70
|
-
*
|
|
71
|
-
* Once the server is shutting down (`AppServer.close` ran the transport's
|
|
72
|
-
* `close_all_sockets`) a refusal is `WS_CLOSE_GOING_AWAY` instead, so the
|
|
73
|
-
* client reconnects rather than treating its credential as revoked: an upgrade
|
|
74
|
-
* pending at the close-all is closed by it — and its abort makes the refusal
|
|
75
|
-
* that follows the re-read send nothing more, even when the database closed
|
|
76
|
-
* under that re-read — and one that registers after it is born closed and
|
|
77
|
-
* skips the re-read (`BackendWebsocketTransport` module doc, "Shutdown").
|
|
78
|
-
*
|
|
79
|
-
* Frames that arrive before admission are queued, not dispatched: nothing runs
|
|
80
|
-
* on a credential that has not been re-read. They dispatch in arrival order
|
|
81
|
-
* once the socket is admitted and `on_socket_open` has completed, and are
|
|
82
|
-
* dropped unread on a refusal. The queue holds at most
|
|
83
|
-
* `MAX_PRE_ADMISSION_FRAMES` frames and
|
|
84
|
-
* `PRE_ADMISSION_QUEUE_BYTES_FACTOR` × `max_message_bytes` bytes; past either
|
|
85
|
-
* the socket is closed.
|
|
36
|
+
* Symmetric to `create_rpc_endpoint` (from `actions/action_rpc.ts`):
|
|
37
|
+
* both transports parse their wire envelope, then call the shared
|
|
38
|
+
* `perform_action` core (`actions/perform_action.ts`) for the post-parse
|
|
39
|
+
* pipeline. WS-specific concerns — connection lifecycle, heartbeat,
|
|
40
|
+
* cancel-notification interception, socket-scoped notify — live in
|
|
41
|
+
* `actions/ws_socket_session.ts`; everything else (auth gates, input
|
|
42
|
+
* validation, authorization phase, rate limiting, transactional dispatch, DEV
|
|
43
|
+
* output validation, thrown-error normalization) is shared.
|
|
86
44
|
*
|
|
87
|
-
* ##
|
|
45
|
+
* ## Per-message auth
|
|
88
46
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* the earlier of a session's cookie and row, an API token's row, none for a
|
|
92
|
-
* daemon token or an eternal token). From admission, a timer closes it at the
|
|
93
|
-
* deadline with `WS_CLOSE_SESSION_REVOKED` (4001) and
|
|
94
|
-
* `WS_CLOSE_CREDENTIAL_EXPIRED_REASON`. The wait is a chain of timers of at
|
|
95
|
-
* most an hour (`schedule_credential_deadline`), so a session's 30 days — past
|
|
96
|
-
* `setTimeout`'s ceiling — does not fire at once, and each wake-up checks the
|
|
97
|
-
* wall clock too, so a host suspend does not extend the deadline.
|
|
47
|
+
* Per-action auth runs inside `perform_action` on every message via the same
|
|
48
|
+
* gates HTTP RPC uses.
|
|
98
49
|
*
|
|
99
|
-
* ##
|
|
50
|
+
* ## Per-socket lifecycle
|
|
100
51
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* So every server-side close — revocation, cap eviction, heartbeat timeout,
|
|
105
|
-
* an oversized message, a refused admission — removes the connection from the
|
|
106
|
-
* transport and aborts the socket's signal *at close time*, and `onMessage`
|
|
107
|
-
* drops any frame on a socket that has ended. A connection the transport no
|
|
108
|
-
* longer holds though nothing closed its socket (a bare `remove_connection`)
|
|
109
|
-
* is ended on its next frame (`BackendWebsocketTransport.is_registered`), with
|
|
110
|
-
* `WS_CLOSE_INTERNAL_ERROR` — it must not linger as a socket that reads
|
|
111
|
-
* everything and answers nothing.
|
|
52
|
+
* Admission (the revocation race), the credential deadline, and the rule that a
|
|
53
|
+
* server-closed socket dispatches nothing are the per-socket half, in
|
|
54
|
+
* `actions/ws_socket_session.ts`.
|
|
112
55
|
*
|
|
113
56
|
* @module
|
|
114
57
|
*/
|
|
115
58
|
import type { Hono } from 'hono';
|
|
116
|
-
import type { UpgradeWebSocket
|
|
59
|
+
import type { UpgradeWebSocket } from 'hono/ws';
|
|
117
60
|
import { type Logger as LoggerType } from '@fuzdev/fuz_util/log.ts';
|
|
118
|
-
import type { Uuid } from '../primitive_schemas.js';
|
|
119
61
|
import type { RoleName } from '../auth/role_schema.js';
|
|
62
|
+
import type { EffectErrorContext } from '../http/pending_effects.js';
|
|
120
63
|
import type { RateLimiter } from '../rate_limiter.js';
|
|
121
64
|
import type { Db } from '../db/db.js';
|
|
122
65
|
import { type Action } from './action_types.js';
|
|
123
66
|
import type { RealtimeCloser } from './connection_closer.js';
|
|
124
|
-
import {
|
|
125
|
-
|
|
126
|
-
export declare const DEFAULT_SERVER_HEARTBEAT_TIMEOUT = 60000;
|
|
67
|
+
import { ConnectionRegistry } from './connection_registry.js';
|
|
68
|
+
import { type SocketCloseContext, type SocketOpenContext } from './ws_socket_session.js';
|
|
127
69
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* `
|
|
131
|
-
* `WS_CLOSE_POLICY_VIOLATION`.
|
|
132
|
-
*
|
|
133
|
-
* Frames sent before the socket is open wait rather than dispatch (nothing
|
|
134
|
-
* runs on a credential that has not been re-read), and a runtime adapter hands
|
|
135
|
-
* them over with no backpressure, so the wait needs a bound. This is the count
|
|
136
|
-
* half; `PRE_ADMISSION_QUEUE_BYTES_FACTOR` is the byte half.
|
|
137
|
-
*
|
|
138
|
-
* Sized so a client flushing its durable queue on reopen never meets it at the
|
|
139
|
-
* default `DEFAULT_QUEUE_MAX_SIZE` (`actions/socket.svelte.ts`). A consumer
|
|
140
|
-
* that raises the client's queue above this cap makes a full flush overflow
|
|
141
|
-
* it: the socket closes with `WS_CLOSE_POLICY_VIOLATION`, the flushed requests
|
|
142
|
-
* fail, and the client reconnects.
|
|
70
|
+
* Default receive silence (ms) past which the server closes a socket with
|
|
71
|
+
* `WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT` — the `receive_timeout` of
|
|
72
|
+
* `register_action_ws`. Twin of the Rust spine's `DEFAULT_WS_RECEIVE_TIMEOUT`.
|
|
143
73
|
*/
|
|
144
|
-
export declare const
|
|
74
|
+
export declare const DEFAULT_WS_RECEIVE_TIMEOUT = 60000;
|
|
145
75
|
/**
|
|
146
|
-
* The
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* socket hold that many full-size messages, and pending sockets are not
|
|
153
|
-
* capped per account — a registration that is never admitted must not be able
|
|
154
|
-
* to pin that much memory. Small requests, which is what a client flushes on
|
|
155
|
-
* reopen, meet the count cap long before this one.
|
|
156
|
-
*
|
|
157
|
-
* A client whose queued requests total more than this budget and flushes
|
|
158
|
-
* them all on reopen overflows it: the socket closes, the flushed requests
|
|
159
|
-
* fail, and the client reconnects.
|
|
76
|
+
* The longest `receive_timeout` `register_action_ws` accepts — 2³¹ − 1 ms,
|
|
77
|
+
* about 24.8 days, the longest delay a timer honors (the same bound as the
|
|
78
|
+
* SSE keep-alive). It keeps the receive check's half-timeout tick well inside
|
|
79
|
+
* that delay; `Infinity`, or a timeout of about 2³² ms and up, would make the
|
|
80
|
+
* tick fire every millisecond on every socket. TS-only: the Rust spine's
|
|
81
|
+
* `Duration` takes any length.
|
|
160
82
|
*/
|
|
161
|
-
export declare const
|
|
162
|
-
/**
|
|
163
|
-
* The close reason sent with `WS_CLOSE_POLICY_VIOLATION` when a socket
|
|
164
|
-
* overflows its pre-admission queue, by count or by bytes.
|
|
165
|
-
*/
|
|
166
|
-
export declare const WS_CLOSE_PRE_ADMISSION_OVERFLOW_REASON = "too much sent before the socket opened";
|
|
167
|
-
/**
|
|
168
|
-
* Max requests one socket may have dispatching at once. A request that
|
|
169
|
-
* arrives past it is answered `queue_overflow` with its id
|
|
170
|
-
* (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched; the socket
|
|
171
|
-
* stays open, and the requests already running keep answering.
|
|
172
|
-
*
|
|
173
|
-
* A runtime adapter can hand frames over without awaiting the previous one's
|
|
174
|
-
* dispatch (`@hono/node-ws` does not await `onMessage`), so without a ceiling
|
|
175
|
-
* one socket could hold any number of handlers — and their pooled database
|
|
176
|
-
* work — at once. Shedding rather than queueing keeps the socket reading, so a
|
|
177
|
-
* reply to a server-initiated request still reaches the handler awaiting it.
|
|
178
|
-
* Generous, so ordinary pipelining never meets it. Same value as the Rust
|
|
179
|
-
* spine's `MAX_INBOUND_DISPATCHES_PER_CONN`.
|
|
180
|
-
*
|
|
181
|
-
* Counted are the requests that passed envelope validation and are not yet
|
|
182
|
-
* answered — the entries of the socket's cancellation map. Notifications,
|
|
183
|
-
* replies to server-initiated requests, and refused frames never count.
|
|
184
|
-
*/
|
|
185
|
-
export declare const MAX_INBOUND_DISPATCHES_PER_CONNECTION = 128;
|
|
186
|
-
/**
|
|
187
|
-
* The `queue_overflow` message a request gets past
|
|
188
|
-
* `MAX_INBOUND_DISPATCHES_PER_CONNECTION`. Same text as the Rust spine's.
|
|
189
|
-
*/
|
|
190
|
-
export declare const WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE = "too many concurrent requests on this connection";
|
|
191
|
-
/**
|
|
192
|
-
* The `data.reason` of the `invalid_request` a WebSocket request gets when its
|
|
193
|
-
* id names a request still running on the same socket. The duplicate is not
|
|
194
|
-
* dispatched; the running request keeps its id, so its reply, and a `cancel`
|
|
195
|
-
* naming that id, stay its own. An id is free again once its request has been
|
|
196
|
-
* answered.
|
|
197
|
-
*/
|
|
198
|
-
export declare const ERROR_DUPLICATE_REQUEST_ID = "duplicate_request_id";
|
|
199
|
-
/**
|
|
200
|
-
* Context passed to the `on_socket_open` hook.
|
|
201
|
-
*
|
|
202
|
-
* Fires once the connection is **admitted** — registered in the transport and
|
|
203
|
-
* its credential re-checked (so `connection_id` is valid, and broadcasts reach
|
|
204
|
-
* it) — and before any client message dispatches. A socket refused at
|
|
205
|
-
* admission never reaches it. Consumers use this to bootstrap per-socket
|
|
206
|
-
* domain state — e.g. spawning a per-account unit and pushing an initial state
|
|
207
|
-
* snapshot.
|
|
208
|
-
*/
|
|
209
|
-
export interface SocketOpenContext {
|
|
210
|
-
/**
|
|
211
|
-
* The raw WebSocket context — exposed for edge cases; prefer `notify` for
|
|
212
|
-
* sends. A frame sent on it directly bypasses the connection's outbound
|
|
213
|
-
* budget and its ordering with queued frames.
|
|
214
|
-
*/
|
|
215
|
-
ws: WSContext;
|
|
216
|
-
/** Connection id assigned by `BackendWebsocketTransport.register_pending`. */
|
|
217
|
-
connection_id: Uuid;
|
|
218
|
-
/** Auth identity registered for this connection. */
|
|
219
|
-
identity: ConnectionIdentity;
|
|
220
|
-
/**
|
|
221
|
-
* Send a JSON-RPC notification to just this socket. Mirrors `ctx.notify`
|
|
222
|
-
* on per-message handler contexts — same socket-scoped semantics.
|
|
223
|
-
*/
|
|
224
|
-
notify: (method: string, params: unknown) => void;
|
|
225
|
-
/**
|
|
226
|
-
* Fires when this socket ends — the client closed it, or the server did
|
|
227
|
-
* (revocation, cap eviction, heartbeat timeout), at the moment the server
|
|
228
|
-
* closes rather than when the close handshake lands. Threaded through to
|
|
229
|
-
* every handler's `ctx.signal`.
|
|
230
|
-
*/
|
|
231
|
-
signal: AbortSignal;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Context passed to the `on_socket_close` hook.
|
|
235
|
-
*
|
|
236
|
-
* Fires after the transport has removed the connection — `connection_id` and
|
|
237
|
-
* `identity` are the values captured at open, so consumer cleanup reads them
|
|
238
|
-
* from here, not from the transport. Fires for both client-initiated closes
|
|
239
|
-
* (Hono onClose) and server-initiated closes — a revocation, the per-account
|
|
240
|
-
* connection cap's eviction, and a heartbeat timeout all call `ws.close()`,
|
|
241
|
-
* which triggers Hono's onClose. Fires only for a socket that was admitted: one
|
|
242
|
-
* refused at admission never ran `on_socket_open`, so it has no close hook
|
|
243
|
-
* either.
|
|
244
|
-
*/
|
|
245
|
-
export interface SocketCloseContext {
|
|
246
|
-
/**
|
|
247
|
-
* The WebSocket context the close event carried. Not necessarily the object
|
|
248
|
-
* `on_socket_open` received — an adapter may build one per event — so key
|
|
249
|
-
* per-socket state on `connection_id`.
|
|
250
|
-
*/
|
|
251
|
-
ws: WSContext;
|
|
252
|
-
/** Connection id captured at open time. */
|
|
253
|
-
connection_id: Uuid;
|
|
254
|
-
/** Auth identity captured at open time — the transport no longer holds it. */
|
|
255
|
-
identity: ConnectionIdentity;
|
|
256
|
-
}
|
|
257
|
-
export interface ServerHeartbeatOptions {
|
|
258
|
-
/**
|
|
259
|
-
* Receive-silence (ms) past which the server closes the socket with
|
|
260
|
-
* `WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT`. Any incoming message resets
|
|
261
|
-
* the counter — chatty clients never trip it. First `timeout`
|
|
262
|
-
* window after socket open is exempt (cold-start grace).
|
|
263
|
-
*/
|
|
264
|
-
timeout?: number;
|
|
265
|
-
}
|
|
83
|
+
export declare const WS_RECEIVE_TIMEOUT_MAX = 2147483647;
|
|
266
84
|
/** Options for `register_action_ws`. */
|
|
267
85
|
export interface RegisterActionWsOptions {
|
|
268
86
|
/** Mount path (e.g., `/api/ws`). */
|
|
@@ -271,6 +89,13 @@ export interface RegisterActionWsOptions {
|
|
|
271
89
|
app: Hono;
|
|
272
90
|
/** Hono's `upgradeWebSocket` helper from the runtime adapter. */
|
|
273
91
|
upgradeWebSocket: UpgradeWebSocket;
|
|
92
|
+
/**
|
|
93
|
+
* Origin allowlist regexes for the upgrade — passed straight to
|
|
94
|
+
* `verify_request_source`, the route's first guard. `create_app_server`
|
|
95
|
+
* passes the server's `allowed_origins` unless the `WsEndpointSpec` narrows
|
|
96
|
+
* them.
|
|
97
|
+
*/
|
|
98
|
+
allowed_origins: ReadonlyArray<RegExp>;
|
|
274
99
|
/**
|
|
275
100
|
* The actions registered on this endpoint — each carries a spec (drives
|
|
276
101
|
* method lookup, per-action auth, input/output validation) and an
|
|
@@ -292,46 +117,48 @@ export interface RegisterActionWsOptions {
|
|
|
292
117
|
*/
|
|
293
118
|
db: Db;
|
|
294
119
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
120
|
+
* Roles permitted to upgrade — any-of disjunction, global grants only,
|
|
121
|
+
* mounted as the route's `require_role` gate (403). Omit (or pass `[]`)
|
|
122
|
+
* for any authenticated account. The per-action `auth` in each spec still
|
|
123
|
+
* applies at dispatch time — this is a coarse upgrade-time gate on who may
|
|
124
|
+
* hold a socket, and so on who receives the endpoint's server pushes.
|
|
125
|
+
*
|
|
126
|
+
* It holds for the socket's life: recorded on every registration
|
|
298
127
|
* (`ConnectionIdentity.required_roles`), so a revoked global grant of a
|
|
299
|
-
* listed role closes the socket (`
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
* the upgrade; mount the 403 gate in front (`register_ws_endpoint` does).
|
|
304
|
-
* Omit, or pass `[]`, for an ungated endpoint.
|
|
128
|
+
* listed role closes the socket (a `role` close target, any listed role
|
|
129
|
+
* — see its over-close), and re-read at admission against the acting
|
|
130
|
+
* actor's grants, so a revocation that landed between the gate and the
|
|
131
|
+
* registration refuses the upgrade with `WS_CLOSE_PERMISSION_REVOKED`.
|
|
305
132
|
*/
|
|
306
133
|
required_roles?: ReadonlyArray<RoleName>;
|
|
307
134
|
/**
|
|
308
|
-
* Existing
|
|
135
|
+
* Existing registry to register connections with. When omitted, a fresh
|
|
309
136
|
* one is created and returned in the result. Pass your own to keep a
|
|
310
|
-
* handle for `
|
|
137
|
+
* handle for `send_to` / `broadcast` before the mount.
|
|
311
138
|
*/
|
|
312
|
-
|
|
139
|
+
registry?: ConnectionRegistry;
|
|
313
140
|
/**
|
|
314
141
|
* The backend's closer — `deps.connection_closer`. This endpoint's
|
|
315
|
-
*
|
|
142
|
+
* registry is added to it, so every revocation handler's close reaches
|
|
316
143
|
* the sockets opened here. Required so it can't be forgotten: left out of
|
|
317
|
-
* the closer, a
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
* (a harness driving the dispatcher directly), or when the
|
|
144
|
+
* the closer, no revocation closes a registry's sockets — neither the
|
|
145
|
+
* handlers' closes nor the revocation guard, which closes through the same
|
|
146
|
+
* closer. Pass `null` only when no revocation has to reach this registry
|
|
147
|
+
* (a harness driving the dispatcher directly), or when the registry was
|
|
321
148
|
* added by hand.
|
|
322
149
|
*
|
|
323
|
-
* The
|
|
150
|
+
* The registry is added once the mount succeeds, so a mount that throws
|
|
324
151
|
* adds nothing. The addition is permanent — its remover is not returned.
|
|
325
152
|
* A caller that must release the membership (as `create_app_server` does
|
|
326
|
-
* on close) passes `null` and adds the
|
|
153
|
+
* on close) passes `null` and adds the registry itself, holding the
|
|
327
154
|
* remover `RealtimeCloser.add` returns.
|
|
328
155
|
*/
|
|
329
156
|
connection_closer: RealtimeCloser | null;
|
|
330
157
|
/**
|
|
331
|
-
* Per-account connection cap for the
|
|
332
|
-
* `
|
|
158
|
+
* Per-account connection cap for the registry this call creates — see
|
|
159
|
+
* `ConnectionRegistryOptions.max_connections_per_account`
|
|
333
160
|
* (evict-oldest, closing with `WS_CLOSE_CONNECTION_LIMIT`; `null`
|
|
334
|
-
* disables). Rejected alongside `
|
|
161
|
+
* disables). Rejected alongside `registry`: a supplied registry carries
|
|
335
162
|
* its own cap, set where it was constructed.
|
|
336
163
|
*
|
|
337
164
|
* @default DEFAULT_MAX_CONNECTIONS_PER_ACCOUNT
|
|
@@ -339,32 +166,41 @@ export interface RegisterActionWsOptions {
|
|
|
339
166
|
max_connections_per_account?: number | null;
|
|
340
167
|
/**
|
|
341
168
|
* Byte budget of the frames waiting to be written to one connection, for
|
|
342
|
-
* the
|
|
343
|
-
* `
|
|
169
|
+
* the registry this call creates — see
|
|
170
|
+
* `ConnectionRegistryOptions.outbound_queue_bytes` (a frame that does
|
|
344
171
|
* not fit closes the socket with `WS_CLOSE_OUTBOUND_OVERFLOW`). Not derived
|
|
345
|
-
* from `max_message_bytes`. Rejected alongside `
|
|
346
|
-
*
|
|
172
|
+
* from `max_message_bytes`. Rejected alongside `registry`: a supplied
|
|
173
|
+
* registry carries its own budget, set where it was constructed.
|
|
347
174
|
*
|
|
348
175
|
* @default DEFAULT_WS_OUTBOUND_QUEUE_BYTES
|
|
349
176
|
*/
|
|
350
177
|
outbound_queue_bytes?: number;
|
|
351
178
|
/**
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
179
|
+
* Receive silence (ms) past which the server closes a socket with
|
|
180
|
+
* `WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT`. Any incoming message resets the
|
|
181
|
+
* count — chatty clients never trip it — and the first window after
|
|
182
|
+
* admission is exempt (cold-start grace). `null` keeps silent sockets open:
|
|
183
|
+
* only do this if the upstream stack (TCP keepalive, a proxy's idle
|
|
184
|
+
* timeout) already owns disconnect detection. Must be positive and at most
|
|
185
|
+
* `WS_RECEIVE_TIMEOUT_MAX` — registration throws otherwise. Twin of the
|
|
186
|
+
* Rust spine's `ActionWsOptions.receive_timeout`.
|
|
187
|
+
*
|
|
188
|
+
* @default DEFAULT_WS_RECEIVE_TIMEOUT
|
|
356
189
|
*/
|
|
357
|
-
|
|
358
|
-
/** Optional per-message delay for testing loading states. Ignored when `0`. */
|
|
359
|
-
artificial_delay?: number;
|
|
190
|
+
receive_timeout?: number | null;
|
|
360
191
|
/**
|
|
361
192
|
* Cap on one inbound message, in bytes (UTF-8 for text frames). A larger
|
|
362
193
|
* message closes the socket with `WS_CLOSE_MESSAGE_TOO_BIG` before it's
|
|
363
194
|
* parsed — there's no per-message error reply, matching the Rust spine.
|
|
364
195
|
* The cap is checked after the runtime adapter has buffered the message,
|
|
365
196
|
* so it bounds dispatch work, not memory; bound the adapter's own frame
|
|
366
|
-
* limit too (e.g. `ws`'s `maxPayload`) where memory matters
|
|
367
|
-
*
|
|
197
|
+
* limit too (e.g. `ws`'s `maxPayload`) where memory matters, set above this
|
|
198
|
+
* cap — twice it, as the cross-backend test adapters do. A message past the
|
|
199
|
+
* frame limit is refused by the adapter without
|
|
200
|
+
* `WS_CLOSE_MESSAGE_TOO_BIG_REASON` (`ws` closes with the code and an empty
|
|
201
|
+
* reason, Bun drops the socket), so a frame limit equal to this cap loses
|
|
202
|
+
* the reason a message just over it gets. A consumer that raises it passes
|
|
203
|
+
* the same value to the client's
|
|
368
204
|
* `FrontendWebsocketTransportOptions.max_message_bytes`.
|
|
369
205
|
*
|
|
370
206
|
* @default DEFAULT_WS_MAX_MESSAGE_BYTES
|
|
@@ -373,11 +209,12 @@ export interface RegisterActionWsOptions {
|
|
|
373
209
|
/** Optional logger; defaults to `[ws]` namespace. */
|
|
374
210
|
log?: LoggerType;
|
|
375
211
|
/**
|
|
376
|
-
* Called once per socket, after the connection is admitted
|
|
377
|
-
* "Admission").
|
|
212
|
+
* Called once per socket, after the connection is admitted
|
|
213
|
+
* (`actions/ws_socket_session.ts`, "Admission: the revocation race").
|
|
214
|
+
* Awaited before any inbound frame is dispatched — every
|
|
378
215
|
* frame the client sends meanwhile waits in arrival order, replies to
|
|
379
216
|
* server-initiated requests included: a hook that awaits
|
|
380
|
-
* `
|
|
217
|
+
* `registry.request_connection` on its own connection gets no reply until
|
|
381
218
|
* it returns, so start such a request without awaiting it. Throwing logs an
|
|
382
219
|
* error and closes the socket with an `internal_error` frame and
|
|
383
220
|
* `WS_CLOSE_INTERNAL_ERROR` — a failing bootstrap should not leave a
|
|
@@ -385,7 +222,7 @@ export interface RegisterActionWsOptions {
|
|
|
385
222
|
*/
|
|
386
223
|
on_socket_open?: (ctx: SocketOpenContext) => void | Promise<void>;
|
|
387
224
|
/**
|
|
388
|
-
* Called once per admitted socket on close, *after* the
|
|
225
|
+
* Called once per admitted socket on close, *after* the registry has
|
|
389
226
|
* removed the connection — a slow hook never holds a dead entry that
|
|
390
227
|
* broadcasts still target and the per-account cap still counts. Receives
|
|
391
228
|
* `connection_id` and `identity` captured at open time, the same whether the
|
|
@@ -411,15 +248,23 @@ export interface RegisterActionWsOptions {
|
|
|
411
248
|
* dispatcher.
|
|
412
249
|
*/
|
|
413
250
|
action_account_rate_limiter: RateLimiter | null;
|
|
251
|
+
/**
|
|
252
|
+
* Called when an eager pending effect of a frame's action rejects, after
|
|
253
|
+
* the rejection is logged — the WS half of `create_app_server`'s
|
|
254
|
+
* `on_effect_error`, which threads it here for the endpoints it mounts.
|
|
255
|
+
* The context carries `transport: 'ws'`, the action method, and `path`.
|
|
256
|
+
*/
|
|
257
|
+
on_effect_error?: (error: unknown, context: EffectErrorContext) => void;
|
|
414
258
|
}
|
|
415
259
|
/** Result of `register_action_ws`. */
|
|
416
260
|
export interface RegisterActionWsResult {
|
|
417
|
-
/** The
|
|
418
|
-
|
|
261
|
+
/** The registry bound to the endpoint — supplied or freshly created. */
|
|
262
|
+
registry: ConnectionRegistry;
|
|
419
263
|
}
|
|
420
264
|
/**
|
|
421
|
-
* Mount a JSON-RPC WebSocket endpoint
|
|
422
|
-
*
|
|
265
|
+
* Mount a JSON-RPC WebSocket endpoint — the upgrade route with its origin,
|
|
266
|
+
* auth, token-scope, acting-actor, and role guards (module doc, "The upgrade
|
|
267
|
+
* route") — that dispatches via the shared `perform_action` core.
|
|
423
268
|
*
|
|
424
269
|
* Wire behavior:
|
|
425
270
|
* - Batch JSON-RPC is rejected (single-message only).
|
|
@@ -439,8 +284,8 @@ export interface RegisterActionWsResult {
|
|
|
439
284
|
* - Authorization phase runs **per message** — role_grant changes during a
|
|
440
285
|
* connection lifetime are picked up on the next message without any
|
|
441
286
|
* in-place refresh. Authentication invalidation closes the socket: the
|
|
442
|
-
* revocation handlers through `connection_closer`, and
|
|
443
|
-
* on the audit row.
|
|
287
|
+
* revocation handlers through `connection_closer`, and the revocation guard
|
|
288
|
+
* (`create_revocation_guard`) on the audit row.
|
|
444
289
|
* - Admission re-reads the credential once, after the handshake: a socket
|
|
445
290
|
* whose session or token was revoked while it was upgrading closes with
|
|
446
291
|
* `WS_CLOSE_SESSION_REVOKED`, one that lost a role `required_roles` lists
|
|
@@ -448,23 +293,23 @@ export interface RegisterActionWsResult {
|
|
|
448
293
|
* `WS_CLOSE_INTERNAL_ERROR`. Frames sent before admission wait for it.
|
|
449
294
|
* - A revoked global grant of a role `required_roles` lists closes the
|
|
450
295
|
* account's sockets on this endpoint with `WS_CLOSE_PERMISSION_REVOKED`,
|
|
451
|
-
* through
|
|
296
|
+
* through the revocation guard; nothing more is sent on them.
|
|
452
297
|
* - A socket the server has closed dispatches nothing more, whether or not
|
|
453
298
|
* its client answers the close.
|
|
454
299
|
* - Every frame sent — responses, error frames, notifications — goes through
|
|
455
|
-
* the
|
|
300
|
+
* the registry's outbound queue. A connection with more waiting than its
|
|
456
301
|
* `outbound_queue_bytes` budget closes with `WS_CLOSE_OUTBOUND_OVERFLOW`, and
|
|
457
302
|
* the response of the request whose handler overflowed it is not sent.
|
|
458
303
|
*
|
|
459
|
-
* @returns the
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
* @mutates options.
|
|
304
|
+
* @returns the registry (supplied or freshly created) — retain it to broadcast
|
|
305
|
+
* @mutates options.app - registers the `GET path` upgrade route, its guards
|
|
306
|
+
* ahead of `upgradeWebSocket`
|
|
307
|
+
* @mutates options.registry - per socket, registers, admits, and removes a
|
|
463
308
|
* connection via `register_pending` / `admit` / `remove_connection`
|
|
464
|
-
* @mutates options.connection_closer - adds the endpoint's
|
|
309
|
+
* @mutates options.connection_closer - adds the endpoint's registry, once the
|
|
465
310
|
* mount has succeeded
|
|
466
311
|
* @throws Error when `max_connections_per_account` or `outbound_queue_bytes`
|
|
467
|
-
* is passed alongside `
|
|
312
|
+
* is passed alongside `registry`, when the cap is neither `null` nor a
|
|
468
313
|
* positive integer, when the budget is not a positive integer, or when
|
|
469
314
|
* `actions` fails to compile (`compile_action_registry`)
|
|
470
315
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register_action_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"register_action_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAS5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAKvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAGN,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,aAAgB,CAAC;AAEpD,wCAAwC;AACxC,MAAM,WAAW,uBAAuB;IACvC,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,GAAG,EAAE,IAAI,CAAC;IACV,iEAAiE;IACjE,gBAAgB,EAAE,gBAAgB,CAAC;IACnC;;;;;OAKG;IACH,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC;;;;;;;OAOG;IACH,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B;;;;;;;;;OASG;IACH,EAAE,EAAE,EAAE,CAAC;IACP;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,EAAE,cAAc,GAAG,IAAI,CAAC;IACzC;;;;;;;;OAQG;IACH,2BAA2B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C;;;;;;;;;OASG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;;;;;;;OAQG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C;;;;;;OAMG;IACH,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACxE;AAED,sCAAsC;AACtC,MAAM,WAAW,sBAAsB;IACtC,wEAAwE;IACxE,QAAQ,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,uBAAuB,KAAG,sBAoLrE,CAAC"}
|