@fuzdev/fuz_app 0.150.0 → 0.152.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 +9 -8
- 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
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-socket half of the WebSocket endpoint — one upgraded socket, from
|
|
3
|
+
* admission to close.
|
|
4
|
+
*
|
|
5
|
+
* `register_action_ws` (`actions/register_action_ws.ts`) mounts the upgrade
|
|
6
|
+
* route; per upgrade it reads the credential off the Hono context into a
|
|
7
|
+
* `WsSocketUpgrade` and hands that, with the endpoint-level `WsSocketEndpoint`,
|
|
8
|
+
* to `create_ws_socket_events`, whose `WSEvents` the runtime adapter drives.
|
|
9
|
+
* Nothing here reads the Hono context or imports the mount, so a socket is
|
|
10
|
+
* reachable with a fake `WSContext` and no app.
|
|
11
|
+
*
|
|
12
|
+
* The WS-specific concerns — connection lifecycle, heartbeat,
|
|
13
|
+
* cancel-notification interception, socket-scoped notify — live here; the
|
|
14
|
+
* relation to `create_rpc_endpoint` and the shared `perform_action` core is in
|
|
15
|
+
* the `register_action_ws` module doc.
|
|
16
|
+
*
|
|
17
|
+
* ## Admission: the revocation race
|
|
18
|
+
*
|
|
19
|
+
* The auth middleware resolves the credential before the handshake, and the
|
|
20
|
+
* socket exists only once `onOpen` fires. Every revocation (session revoke,
|
|
21
|
+
* logout, password change, token revoke, account delete) closes the sockets
|
|
22
|
+
* *registered* under what it revoked, so one landing in that gap would close
|
|
23
|
+
* nothing, and the socket would then be admitted on the dead credential and
|
|
24
|
+
* keep it: per-message dispatch re-authorizes the *actor*, never the session
|
|
25
|
+
* or token — and its admission could evict a live socket of the same account
|
|
26
|
+
* past the cap.
|
|
27
|
+
*
|
|
28
|
+
* `onOpen` closes the gap in three steps: register the connection **pending**
|
|
29
|
+
* (`ConnectionRegistry.register_pending` — closeable by every
|
|
30
|
+
* revocation, inert otherwise), re-read the credential, the acting actor, and
|
|
31
|
+
* the role (`recheck_admission`, which the audit stream shares), then
|
|
32
|
+
* `ConnectionRegistry.admit`. A
|
|
33
|
+
* revocation whose close ran after the registration found the pending entry,
|
|
34
|
+
* so `admit` refuses; one that committed before the re-read is seen by it. The
|
|
35
|
+
* cap is enforced only by `admit`, so a refused upgrade evicts nothing, and
|
|
36
|
+
* pending registrations never count toward it.
|
|
37
|
+
*
|
|
38
|
+
* That argument needs every revocation to close only after its commit —
|
|
39
|
+
* otherwise a close could miss the registration while the re-read still sees
|
|
40
|
+
* the credential alive. Every one does: the revocation handlers queue their
|
|
41
|
+
* close behind the commit (`queue_connection_close`), and the audit emitter
|
|
42
|
+
* announces a success row to the listeners behind it too. So no interleaving
|
|
43
|
+
* admits a revoked credential; `docs/security.md` §Connection Admission says
|
|
44
|
+
* what that rests on.
|
|
45
|
+
*
|
|
46
|
+
* The acting actor the upgrade resolved is re-read beside the credential on
|
|
47
|
+
* every endpoint, gated or not: an actor soft-deleted under its live account
|
|
48
|
+
* keeps the account's sessions and tokens and its own grant rows, so neither
|
|
49
|
+
* the credential nor the role re-read would refuse it. A tombstoned acting
|
|
50
|
+
* actor is refused like a dead credential.
|
|
51
|
+
*
|
|
52
|
+
* An endpoint gated on `required_roles` re-reads them beside the credential:
|
|
53
|
+
* its upgrade passed the role gate before the socket registered, so a role
|
|
54
|
+
* revocation landing in between would close nothing (a `role` close target
|
|
55
|
+
* matches registrations), and the socket would be admitted without the role
|
|
56
|
+
* for its lifetime. The re-read reads the acting actor's grants afresh and
|
|
57
|
+
* admits on a global grant of any listed role, as the gate did.
|
|
58
|
+
*
|
|
59
|
+
* A refused upgrade is closed with `WS_CLOSE_SESSION_REVOKED` (4001, the
|
|
60
|
+
* reason a revoked socket gets) for a dead credential or a deleted acting actor,
|
|
61
|
+
* `WS_CLOSE_PERMISSION_REVOKED` (4006) for a lost role, or
|
|
62
|
+
* `WS_CLOSE_INTERNAL_ERROR` (1011) when a re-read itself failed — fail
|
|
63
|
+
* closed, never admitted unchecked. The handshake has already answered `101`,
|
|
64
|
+
* so a refusal can only be a close frame.
|
|
65
|
+
*
|
|
66
|
+
* Once the server is shutting down (`AppServer.close` ran the registry's
|
|
67
|
+
* `close_all_connections`) a refusal is `WS_CLOSE_GOING_AWAY` instead, so the
|
|
68
|
+
* client reconnects rather than treating its credential as revoked: an upgrade
|
|
69
|
+
* pending at the close-all is closed by it — and its abort makes the refusal
|
|
70
|
+
* that follows the re-read send nothing more, even when the database closed
|
|
71
|
+
* under that re-read — and one that registers after it is born closed and
|
|
72
|
+
* skips the re-read (`ConnectionRegistry` module doc, "Shutdown").
|
|
73
|
+
*
|
|
74
|
+
* Frames that arrive before admission are queued, not dispatched: nothing runs
|
|
75
|
+
* on a credential that has not been re-read. They dispatch in arrival order
|
|
76
|
+
* once the socket is admitted and `on_socket_open` has completed, and are
|
|
77
|
+
* dropped unread on a refusal. The queue holds at most
|
|
78
|
+
* `MAX_PRE_ADMISSION_FRAMES` frames and
|
|
79
|
+
* `PRE_ADMISSION_QUEUE_BYTES_FACTOR` × `max_message_bytes` bytes; past either
|
|
80
|
+
* the socket is closed.
|
|
81
|
+
*
|
|
82
|
+
* ## Credential deadline
|
|
83
|
+
*
|
|
84
|
+
* Expiry writes nothing a revocation listener could hear, so the socket
|
|
85
|
+
* watches its own credential's expiry (`ResolvedAuth.credential_deadline`,
|
|
86
|
+
* the earlier of a session's cookie and row, an API token's row, none for a
|
|
87
|
+
* daemon token or an eternal token). From admission, a timer closes it at the
|
|
88
|
+
* deadline with `WS_CLOSE_SESSION_REVOKED` (4001) and
|
|
89
|
+
* `WS_CLOSE_CREDENTIAL_EXPIRED_REASON`. The wait is a chain of timers of at
|
|
90
|
+
* most an hour (`schedule_credential_deadline`), so a session's 30 days — past
|
|
91
|
+
* `setTimeout`'s ceiling — does not fire at once, and each wake-up checks the
|
|
92
|
+
* wall clock too, so a host suspend does not extend the deadline.
|
|
93
|
+
*
|
|
94
|
+
* ## A server-closed socket dispatches nothing
|
|
95
|
+
*
|
|
96
|
+
* A runtime adapter can keep delivering inbound frames after the server calls
|
|
97
|
+
* `ws.close(…)`, until the close handshake completes (`@hono/node-ws` does —
|
|
98
|
+
* up to the `ws` close timeout when the client withholds its close frame).
|
|
99
|
+
* So every server-side close — revocation, cap eviction, heartbeat timeout,
|
|
100
|
+
* an oversized message, a refused admission — removes the connection from the
|
|
101
|
+
* registry and aborts the socket's signal *at close time*, and `onMessage`
|
|
102
|
+
* drops any frame on a socket that has ended. A connection the registry no
|
|
103
|
+
* longer holds though nothing closed its socket (a bare `remove_connection`)
|
|
104
|
+
* is ended on its next frame (`ConnectionRegistry.is_registered`), with
|
|
105
|
+
* `WS_CLOSE_INTERNAL_ERROR` — it must not linger as a socket that reads
|
|
106
|
+
* everything and answers nothing.
|
|
107
|
+
*
|
|
108
|
+
* @module
|
|
109
|
+
*/
|
|
110
|
+
import type { WSContext, WSEvents } from 'hono/ws';
|
|
111
|
+
import type { Logger as LoggerType } from '@fuzdev/fuz_util/log.ts';
|
|
112
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
113
|
+
import type { RequestContext } from '../auth/request_context.js';
|
|
114
|
+
import type { RoleName } from '../auth/role_schema.js';
|
|
115
|
+
import { type ResolvedAuth } from '../auth/resolved_auth.js';
|
|
116
|
+
import { type EffectErrorContext } from '../http/pending_effects.js';
|
|
117
|
+
import type { RateLimiter } from '../rate_limiter.js';
|
|
118
|
+
import type { Db } from '../db/db.js';
|
|
119
|
+
import type { RpcAction } from './action_types.js';
|
|
120
|
+
import type { ConnectionRegistry, ConnectionIdentity } from './connection_registry.js';
|
|
121
|
+
/**
|
|
122
|
+
* Max inbound frames one socket may have queued while it is still opening —
|
|
123
|
+
* between the handshake and the end of the credential re-check plus
|
|
124
|
+
* `on_socket_open`. One more closes the socket with
|
|
125
|
+
* `WS_CLOSE_POLICY_VIOLATION`.
|
|
126
|
+
*
|
|
127
|
+
* Frames sent before the socket is open wait rather than dispatch (nothing
|
|
128
|
+
* runs on a credential that has not been re-read), and a runtime adapter hands
|
|
129
|
+
* them over with no backpressure, so the wait needs a bound. This is the count
|
|
130
|
+
* half; `PRE_ADMISSION_QUEUE_BYTES_FACTOR` is the byte half.
|
|
131
|
+
*
|
|
132
|
+
* Sized so a client flushing its durable queue on reopen never meets it at the
|
|
133
|
+
* default `DEFAULT_QUEUE_MAX_SIZE` (`actions/socket.svelte.ts`). A consumer
|
|
134
|
+
* that raises the client's queue above this cap makes a full flush overflow
|
|
135
|
+
* it: the socket closes with `WS_CLOSE_POLICY_VIOLATION`, the flushed requests
|
|
136
|
+
* fail, and the client reconnects.
|
|
137
|
+
*/
|
|
138
|
+
export declare const MAX_PRE_ADMISSION_FRAMES = 256;
|
|
139
|
+
/**
|
|
140
|
+
* The byte budget of one socket's pre-admission queue, as a multiple of the
|
|
141
|
+
* endpoint's `max_message_bytes`: the frames queued while the socket is still
|
|
142
|
+
* opening may total at most this many maximum-size messages. The frame that
|
|
143
|
+
* would pass it closes the socket with `WS_CLOSE_POLICY_VIOLATION`.
|
|
144
|
+
*
|
|
145
|
+
* The count cap alone (`MAX_PRE_ADMISSION_FRAMES`) would let each pending
|
|
146
|
+
* socket hold that many full-size messages, and pending sockets are not
|
|
147
|
+
* capped per account — a registration that is never admitted must not be able
|
|
148
|
+
* to pin that much memory. Small requests, which is what a client flushes on
|
|
149
|
+
* reopen, meet the count cap long before this one.
|
|
150
|
+
*
|
|
151
|
+
* A client whose queued requests total more than this budget and flushes
|
|
152
|
+
* them all on reopen overflows it: the socket closes, the flushed requests
|
|
153
|
+
* fail, and the client reconnects.
|
|
154
|
+
*/
|
|
155
|
+
export declare const PRE_ADMISSION_QUEUE_BYTES_FACTOR = 4;
|
|
156
|
+
/**
|
|
157
|
+
* Max requests one socket may have dispatching at once. A request that
|
|
158
|
+
* arrives past it is answered `queue_overflow` with its id
|
|
159
|
+
* (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched; the socket
|
|
160
|
+
* stays open, and the requests already running keep answering.
|
|
161
|
+
*
|
|
162
|
+
* A runtime adapter can hand frames over without awaiting the previous one's
|
|
163
|
+
* dispatch (`@hono/node-ws` does not await `onMessage`), so without a ceiling
|
|
164
|
+
* one socket could hold any number of handlers — and their pooled database
|
|
165
|
+
* work — at once. Shedding rather than queueing keeps the socket reading, so a
|
|
166
|
+
* reply to a server-initiated request still reaches the handler awaiting it.
|
|
167
|
+
* Generous, so ordinary pipelining never meets it. Same value as the Rust
|
|
168
|
+
* spine's `MAX_INBOUND_DISPATCHES_PER_CONNECTION`.
|
|
169
|
+
*
|
|
170
|
+
* Counted are the requests that passed envelope validation and are not yet
|
|
171
|
+
* answered — the entries of the socket's cancellation map. Notifications,
|
|
172
|
+
* replies to server-initiated requests, and refused frames never count.
|
|
173
|
+
*/
|
|
174
|
+
export declare const MAX_INBOUND_DISPATCHES_PER_CONNECTION = 128;
|
|
175
|
+
/**
|
|
176
|
+
* The `queue_overflow` message a request gets past
|
|
177
|
+
* `MAX_INBOUND_DISPATCHES_PER_CONNECTION`. Same text as the Rust spine's.
|
|
178
|
+
*/
|
|
179
|
+
export declare const WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE = "too many concurrent requests on this connection";
|
|
180
|
+
/**
|
|
181
|
+
* The `data.reason` of the `invalid_request` a WebSocket request gets when its
|
|
182
|
+
* id names a request still running on the same socket. The duplicate is not
|
|
183
|
+
* dispatched; the running request keeps its id, so its reply, and a `cancel`
|
|
184
|
+
* naming that id, stay its own. An id is free again once its request has been
|
|
185
|
+
* answered.
|
|
186
|
+
*/
|
|
187
|
+
export declare const ERROR_DUPLICATE_REQUEST_ID = "duplicate_request_id";
|
|
188
|
+
/**
|
|
189
|
+
* Context passed to the `on_socket_open` hook.
|
|
190
|
+
*
|
|
191
|
+
* Fires once the connection is **admitted** — registered in the registry and
|
|
192
|
+
* its credential re-checked (so `connection_id` is valid, and broadcasts reach
|
|
193
|
+
* it) — and before any client message dispatches. A socket refused at
|
|
194
|
+
* admission never reaches it. Consumers use this to bootstrap per-socket
|
|
195
|
+
* domain state — e.g. spawning a per-account unit and pushing an initial state
|
|
196
|
+
* snapshot.
|
|
197
|
+
*/
|
|
198
|
+
export interface SocketOpenContext {
|
|
199
|
+
/**
|
|
200
|
+
* The raw WebSocket context — exposed for edge cases; prefer `notify` for
|
|
201
|
+
* sends. A frame sent on it directly bypasses the connection's outbound
|
|
202
|
+
* budget and its ordering with queued frames.
|
|
203
|
+
*/
|
|
204
|
+
ws: WSContext;
|
|
205
|
+
/** Connection id assigned by `ConnectionRegistry.register_pending`. */
|
|
206
|
+
connection_id: Uuid;
|
|
207
|
+
/**
|
|
208
|
+
* Auth identity registered for this connection. The registry holds its
|
|
209
|
+
* own copy, so this record is not what close targets match on.
|
|
210
|
+
*/
|
|
211
|
+
identity: Readonly<ConnectionIdentity>;
|
|
212
|
+
/**
|
|
213
|
+
* Send a JSON-RPC notification to just this socket. Mirrors `ctx.notify`
|
|
214
|
+
* on per-message handler contexts — same socket-scoped semantics.
|
|
215
|
+
*/
|
|
216
|
+
notify: (method: string, params: unknown) => void;
|
|
217
|
+
/**
|
|
218
|
+
* Fires when this socket ends — the client closed it, or the server did
|
|
219
|
+
* (revocation, cap eviction, heartbeat timeout), at the moment the server
|
|
220
|
+
* closes rather than when the close handshake lands. Threaded through to
|
|
221
|
+
* every handler's `ctx.signal`.
|
|
222
|
+
*/
|
|
223
|
+
signal: AbortSignal;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Context passed to the `on_socket_close` hook.
|
|
227
|
+
*
|
|
228
|
+
* Fires after the registry has removed the connection — `connection_id` and
|
|
229
|
+
* `identity` are the values captured at open, so consumer cleanup reads them
|
|
230
|
+
* from here, not from the registry. Fires for both client-initiated closes
|
|
231
|
+
* (Hono onClose) and server-initiated closes — a revocation, the per-account
|
|
232
|
+
* connection cap's eviction, and a heartbeat timeout all call `ws.close()`,
|
|
233
|
+
* which triggers Hono's onClose. Fires only for a socket that was admitted: one
|
|
234
|
+
* refused at admission never ran `on_socket_open`, so it has no close hook
|
|
235
|
+
* either.
|
|
236
|
+
*/
|
|
237
|
+
export interface SocketCloseContext {
|
|
238
|
+
/**
|
|
239
|
+
* The WebSocket context the close event carried. Not necessarily the object
|
|
240
|
+
* `on_socket_open` received — an adapter may build one per event — so key
|
|
241
|
+
* per-socket state on `connection_id`.
|
|
242
|
+
*/
|
|
243
|
+
ws: WSContext;
|
|
244
|
+
/** Connection id captured at open time. */
|
|
245
|
+
connection_id: Uuid;
|
|
246
|
+
/** Auth identity captured at open time — the registry no longer holds it. */
|
|
247
|
+
identity: Readonly<ConnectionIdentity>;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The endpoint-level values every socket of an endpoint reads — derived once
|
|
251
|
+
* by `register_action_ws`, shared by all of its sockets.
|
|
252
|
+
*
|
|
253
|
+
* @internal
|
|
254
|
+
*/
|
|
255
|
+
export interface WsSocketEndpoint {
|
|
256
|
+
/** Mount path, reported in `on_effect_error` contexts. */
|
|
257
|
+
path: string;
|
|
258
|
+
/** Pool-level DB: the admission re-read and per-message dispatch read through it. */
|
|
259
|
+
db: Db;
|
|
260
|
+
/** Logger for the endpoint's sockets. */
|
|
261
|
+
log: LoggerType;
|
|
262
|
+
/** The registry the endpoint's connections register with. */
|
|
263
|
+
registry: ConnectionRegistry;
|
|
264
|
+
/** Per-method dispatch lookup — `request_response` specs with a handler. */
|
|
265
|
+
action_map: ReadonlyMap<string, RpcAction>;
|
|
266
|
+
/** Receive silence (ms) past which a socket is closed; `null` keeps silent sockets open. */
|
|
267
|
+
receive_timeout: number | null;
|
|
268
|
+
/** The receive check's period (ms); `null` exactly when `receive_timeout` is. */
|
|
269
|
+
receive_tick_interval: number | null;
|
|
270
|
+
/** Cap on one inbound message, in bytes. */
|
|
271
|
+
max_message_bytes: number;
|
|
272
|
+
/** Byte budget of one socket's pre-admission queue. */
|
|
273
|
+
pre_admission_queue_max_bytes: number;
|
|
274
|
+
/** Hook called once per socket after admission; `undefined` for none. */
|
|
275
|
+
on_socket_open: ((ctx: SocketOpenContext) => void | Promise<void>) | undefined;
|
|
276
|
+
/** Hook called once per admitted socket after its connection is removed; `undefined` for none. */
|
|
277
|
+
on_socket_close: ((ctx: SocketCloseContext) => void | Promise<void>) | undefined;
|
|
278
|
+
/** Per-IP action rate limiter; `null` turns the IP check off. */
|
|
279
|
+
action_ip_rate_limiter: RateLimiter | null;
|
|
280
|
+
/** Per-account action rate limiter; `null` turns the account check off. */
|
|
281
|
+
action_account_rate_limiter: RateLimiter | null;
|
|
282
|
+
/** Called when an eager pending effect of a frame's action rejects; `undefined` for none. */
|
|
283
|
+
on_effect_error: ((error: unknown, context: EffectErrorContext) => void) | undefined;
|
|
284
|
+
/** Roles the endpoint's upgrade is gated on; empty for an ungated endpoint. */
|
|
285
|
+
required_roles: ReadonlyArray<RoleName>;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* What `register_action_ws` captures from the upgrade request for one socket.
|
|
289
|
+
* The socket reads these for its whole life; the Hono context itself is not
|
|
290
|
+
* kept.
|
|
291
|
+
*
|
|
292
|
+
* @internal
|
|
293
|
+
*/
|
|
294
|
+
export interface WsSocketUpgrade {
|
|
295
|
+
/** The client IP, keyed by the per-IP action rate limiter. */
|
|
296
|
+
client_ip: string;
|
|
297
|
+
/** The test-context preset, which skips the admission re-read and the live authorization phase. */
|
|
298
|
+
upgrade_preset: {
|
|
299
|
+
request_context: RequestContext | null;
|
|
300
|
+
} | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* The credential the auth middleware resolved — re-read at admission,
|
|
303
|
+
* passed to every message's dispatch, and the source of the connection's
|
|
304
|
+
* identity.
|
|
305
|
+
*/
|
|
306
|
+
resolved: ResolvedAuth;
|
|
307
|
+
/** The request context the upgrade's authorization phase built, on the credential's account. */
|
|
308
|
+
upgrade_context: RequestContext;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Build the Hono `WSEvents` for one upgraded socket: admission, the receive
|
|
312
|
+
* watchdog, the credential deadline, frame dispatch, and close (module doc).
|
|
313
|
+
*
|
|
314
|
+
* @param endpoint - the endpoint-level values, shared by all of its sockets
|
|
315
|
+
* @param upgrade - what the upgrade request captured for this socket
|
|
316
|
+
* @returns the adapter's `onOpen` / `onMessage` / `onClose` for the socket
|
|
317
|
+
*
|
|
318
|
+
* @internal
|
|
319
|
+
*/
|
|
320
|
+
export declare const create_ws_socket_events: (endpoint: WsSocketEndpoint, upgrade: WsSocketUpgrade) => WSEvents;
|
|
321
|
+
//# sourceMappingURL=ws_socket_session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws_socket_session.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/ws_socket_session.ts"],"names":[],"mappings":"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"}
|