@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,238 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SSE auth guard, connection closer, and convenience factory for audit log SSE.
|
|
3
|
-
*
|
|
4
|
-
* An SSE stream is authorized once, at open, and then only emits — nothing
|
|
5
|
-
* re-reads its credential or its role. Two things close it when its access is
|
|
6
|
-
* revoked:
|
|
7
|
-
*
|
|
8
|
-
* - `create_sse_connection_closer` adapts a `SubscriberRegistry` to
|
|
9
|
-
* `ConnectionCloser`, so the revocation handlers close streams directly
|
|
10
|
-
* after their transaction commits (`queue_connection_close`), whatever
|
|
11
|
-
* happens to the audit write.
|
|
12
|
-
* - `create_sse_auth_guard` is the audit-event listener: it repeats those
|
|
13
|
-
* closes when the row is announced, and it is the only closer for a role
|
|
14
|
-
* revocation.
|
|
15
|
-
*
|
|
16
|
-
* `create_audit_log_sse` is a convenience factory that combines the registry,
|
|
17
|
-
* guard, closer, and broadcaster — making the secure path the easy path for
|
|
18
|
-
* consumers.
|
|
19
|
-
*
|
|
20
|
-
* @module
|
|
21
|
-
*/
|
|
22
|
-
import { UnreachableError } from '@fuzdev/fuz_util/error.ts';
|
|
23
|
-
import { AUDIT_EVENT_TYPES, AuditLogEventJson, to_global_role_revocation, to_revocation_scope } from '../auth/audit_log_schema.js';
|
|
24
|
-
import { SubscriberRegistry } from './subscriber_registry.js';
|
|
25
|
-
/** SSE channel the audit-log stream route publishes on. */
|
|
26
|
-
export const AUDIT_LOG_CHANNEL = 'audit_log';
|
|
27
|
-
/**
|
|
28
|
-
* Adapt a `SubscriberRegistry` to `ConnectionCloser`, so a revocation handler's
|
|
29
|
-
* close reaches its streams.
|
|
30
|
-
*
|
|
31
|
-
* Each method is `SubscriberRegistry.close_by_identity` on the id it is given,
|
|
32
|
-
* so it closes the streams registered under that id as their `scope` or in
|
|
33
|
-
* their `groups` — pending registrations included. The audit stream route
|
|
34
|
-
* registers `scope = session hash` and `groups = [account id]`; a route that
|
|
35
|
-
* admits bearer tokens registers the API token id too, and
|
|
36
|
-
* `close_sockets_for_token` then reaches it. `close_sockets_for_role` closes
|
|
37
|
-
* the account's streams when `role` is the one the registry's streams are
|
|
38
|
-
* gated on — the registry keeps one gating role for all its streams, not one
|
|
39
|
-
* per stream. `close_all_sockets` is `SubscriberRegistry.close_all` — every
|
|
40
|
-
* stream, for shutdown.
|
|
41
|
-
*
|
|
42
|
-
* Twin of the Rust spine's `SocketRevoker` impl on `SseRegistry`.
|
|
43
|
-
*
|
|
44
|
-
* @param registry - the registry to close streams on
|
|
45
|
-
* @param required_role - the role every stream of `registry` was gated on,
|
|
46
|
-
* or `null` when they are not role-gated (`close_sockets_for_role` then
|
|
47
|
-
* closes nothing)
|
|
48
|
-
*/
|
|
49
|
-
export const create_sse_connection_closer = (registry, required_role) => ({
|
|
50
|
-
close_sockets_for_session: (session_token_hash) => registry.close_by_identity(session_token_hash),
|
|
51
|
-
close_sockets_for_token: (api_token_id) => registry.close_by_identity(api_token_id),
|
|
52
|
-
close_sockets_for_account: (account_id) => registry.close_by_identity(account_id),
|
|
53
|
-
close_sockets_for_role: (account_id, role) => required_role !== null && role === required_role ? registry.close_by_identity(account_id) : 0,
|
|
54
|
-
close_all_sockets: () => registry.close_all()
|
|
55
|
-
});
|
|
56
|
-
/**
|
|
57
|
-
* Create an audit event handler that closes SSE streams on a successful
|
|
58
|
-
* revocation row, dispatching on the event's `RevocationScope`
|
|
59
|
-
* (`audit_event_revocation_scopes`, the table `create_ws_auth_guard` reads
|
|
60
|
-
* too):
|
|
61
|
-
*
|
|
62
|
-
* - `session` → the stream registered under the revoked session's hash
|
|
63
|
-
* (`metadata.session_id`). Closing all of an account's streams for a
|
|
64
|
-
* single-session revoke would be over-aggressive.
|
|
65
|
-
* - `token` → the stream registered under the revoked API token's id
|
|
66
|
-
* (`metadata.token_id`). The audit stream route admits sessions only, so no
|
|
67
|
-
* stream of its own is keyed that way; a consumer route that admits bearers
|
|
68
|
-
* registers the token id and is closed here.
|
|
69
|
-
* - `account` → every stream of `target_account_id ?? account_id`.
|
|
70
|
-
* - `role` → every stream of the target account, when the revoked role
|
|
71
|
-
* (`metadata.role`) is `required_role` and the revoked grant was global
|
|
72
|
-
* (`to_global_role_revocation`): the stream's role gate admits on global
|
|
73
|
-
* grants only, so revoking a scoped grant of the same role takes away
|
|
74
|
-
* nothing it admitted on. A stream is authorized once at open and has no
|
|
75
|
-
* later check; the WebSocket guard closes its role-gated sockets on the
|
|
76
|
-
* same rows.
|
|
77
|
-
* - `none` → nothing.
|
|
78
|
-
*
|
|
79
|
-
* Over-closing a one-way feed is cheap: the client reconnects if it is still
|
|
80
|
-
* authorized.
|
|
81
|
-
*
|
|
82
|
-
* The registry's subscribers must carry `account_id` as an identity key (in
|
|
83
|
-
* `SubscribeOptions.groups`), and the session hash as `scope` for the
|
|
84
|
-
* session-scoped close.
|
|
85
|
-
*
|
|
86
|
-
* @param registry - the subscriber registry to guard
|
|
87
|
-
* @param required_role - the role that grants access to the SSE endpoint,
|
|
88
|
-
* or `null` to skip `role_grant_revoke` handling entirely (for streams not gated
|
|
89
|
-
* by a specific role_grant)
|
|
90
|
-
* @param log - logger for disconnect events
|
|
91
|
-
* @returns an `on_audit_event` callback
|
|
92
|
-
*/
|
|
93
|
-
export const create_sse_auth_guard = (registry, required_role, log) => {
|
|
94
|
-
return (event) => {
|
|
95
|
-
// Only act on successful revocations. Failed attempts carry
|
|
96
|
-
// attacker-controlled identifiers (e.g., session_revoke with outcome=failure
|
|
97
|
-
// carries the submitted session_id even when the DB rejected the cross-account
|
|
98
|
-
// mutation) — reacting to them lets any authenticated user close another
|
|
99
|
-
// user's SSE stream by guessing or leaking a session hash.
|
|
100
|
-
if (event.outcome === 'failure')
|
|
101
|
-
return;
|
|
102
|
-
const scope = to_revocation_scope(event.event_type);
|
|
103
|
-
switch (scope) {
|
|
104
|
-
case 'none':
|
|
105
|
-
return;
|
|
106
|
-
case 'session': {
|
|
107
|
-
const session_id = event.metadata?.session_id;
|
|
108
|
-
if (typeof session_id !== 'string' || session_id.length === 0)
|
|
109
|
-
return;
|
|
110
|
-
const closed = registry.close_by_identity(session_id);
|
|
111
|
-
if (closed > 0) {
|
|
112
|
-
log.info(`SSE auth guard: closed ${closed} stream(s) for session ${session_id} (${event.event_type})`);
|
|
113
|
-
}
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
case 'token': {
|
|
117
|
-
const token_id = event.metadata?.token_id;
|
|
118
|
-
if (typeof token_id !== 'string' || token_id.length === 0)
|
|
119
|
-
return;
|
|
120
|
-
const closed = registry.close_by_identity(token_id);
|
|
121
|
-
if (closed > 0) {
|
|
122
|
-
log.info(`SSE auth guard: closed ${closed} stream(s) for token ${token_id} (${event.event_type})`);
|
|
123
|
-
}
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
case 'role': {
|
|
127
|
-
// `null` means the stream isn't gated by a specific role_grant, so
|
|
128
|
-
// a role revocation closes nothing.
|
|
129
|
-
if (required_role === null)
|
|
130
|
-
return;
|
|
131
|
-
// global grants only — the gate never admitted on a scoped one
|
|
132
|
-
const revoked = to_global_role_revocation(event);
|
|
133
|
-
if (!revoked || revoked.role !== required_role)
|
|
134
|
-
return;
|
|
135
|
-
const closed = registry.close_by_identity(revoked.account_id);
|
|
136
|
-
if (closed > 0) {
|
|
137
|
-
log.info(`SSE auth guard: closed ${closed} stream(s) for account ${revoked.account_id} (${event.event_type})`);
|
|
138
|
-
}
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
case 'account':
|
|
142
|
-
break;
|
|
143
|
-
default:
|
|
144
|
-
throw new UnreachableError(scope);
|
|
145
|
-
}
|
|
146
|
-
// admin actions set target_account_id, self-service actions only set
|
|
147
|
-
// account_id
|
|
148
|
-
const target = event.target_account_id ?? event.account_id;
|
|
149
|
-
if (!target)
|
|
150
|
-
return;
|
|
151
|
-
const closed = registry.close_by_identity(target);
|
|
152
|
-
if (closed > 0) {
|
|
153
|
-
log.info(`SSE auth guard: closed ${closed} stream(s) for account ${target} (${event.event_type})`);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* SSE event specs for audit log events.
|
|
159
|
-
*
|
|
160
|
-
* One spec per `AUDIT_EVENT_TYPES` entry, all sharing the `AuditLogEventJson` params schema.
|
|
161
|
-
* Pass to `create_app_server`'s `event_specs` for surface generation and DEV validation.
|
|
162
|
-
*/
|
|
163
|
-
export const audit_log_event_specs = AUDIT_EVENT_TYPES.map((event_type) => ({
|
|
164
|
-
method: event_type,
|
|
165
|
-
params: AuditLogEventJson,
|
|
166
|
-
description: `Audit log: ${event_type.replaceAll('_', ' ')}`,
|
|
167
|
-
channel: AUDIT_LOG_CHANNEL
|
|
168
|
-
}));
|
|
169
|
-
/**
|
|
170
|
-
* Default max concurrent SSE subscribers per session scope for the audit log.
|
|
171
|
-
*
|
|
172
|
-
* The audit log SSE subscribes with `scope = session_hash` and
|
|
173
|
-
* `groups = [account_id]`. Only `scope` is capped — so this limits tabs
|
|
174
|
-
* per session. An account's total streams across all sessions is bounded
|
|
175
|
-
* transitively by `max_sessions × AUDIT_LOG_SSE_MAX_PER_SCOPE`. 10 tabs
|
|
176
|
-
* per session is a comfortable ceiling for normal use; consumers raising
|
|
177
|
-
* it above ~50 should consider server-side connection limits.
|
|
178
|
-
*/
|
|
179
|
-
export const AUDIT_LOG_SSE_MAX_PER_SCOPE = 10;
|
|
180
|
-
/**
|
|
181
|
-
* Create a complete audit log SSE setup with broadcasting, auth guard, and
|
|
182
|
-
* connection closer.
|
|
183
|
-
*
|
|
184
|
-
* Combines `SubscriberRegistry`, `create_sse_auth_guard`, and the broadcast
|
|
185
|
-
* call into a single object, and adds the registry to `connection_closer` for
|
|
186
|
-
* good — the remover `add` returns is dropped, so a caller that must take the
|
|
187
|
-
* registry out again passes `null` and adds it itself.
|
|
188
|
-
* The result satisfies `AuditLogRouteOptions['stream']`
|
|
189
|
-
* and provides the `on_audit_event` listener for the audit emitter.
|
|
190
|
-
*
|
|
191
|
-
* Most consumers pass `audit_log_sse: true` to `create_app_server` and never
|
|
192
|
-
* touch this directly — the factory builds an `AuditLogSse`, registers
|
|
193
|
-
* `audit_sse.on_audit_event` via `backend.deps.audit.add_listener`, and
|
|
194
|
-
* exposes it via `AppServerContext.audit_sse`. Reach for the manual path
|
|
195
|
-
* (compose inside `audit_factory` body, or
|
|
196
|
-
* `audit.add_listener(audit_sse.on_audit_event)` post-assembly) only
|
|
197
|
-
* when wiring outside `create_app_server`.
|
|
198
|
-
*
|
|
199
|
-
* @param options - factory options
|
|
200
|
-
* @returns audit log SSE setup (stream options + `on_audit_event` + registry)
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* ```ts
|
|
204
|
-
* const connection_closer = create_realtime_closer();
|
|
205
|
-
* const audit_sse = create_audit_log_sse({log, connection_closer});
|
|
206
|
-
*
|
|
207
|
-
* // On CreateAppBackendOptions — the same closer, and the listener inside
|
|
208
|
-
* // the audit_factory body:
|
|
209
|
-
* connection_closer,
|
|
210
|
-
* audit_factory: ({db, log}) => create_audit_emitter({
|
|
211
|
-
* db,
|
|
212
|
-
* log,
|
|
213
|
-
* on_audit_event: audit_sse.on_audit_event,
|
|
214
|
-
* }),
|
|
215
|
-
*
|
|
216
|
-
* // In create_route_specs:
|
|
217
|
-
* create_audit_log_route_specs({stream: audit_sse});
|
|
218
|
-
*
|
|
219
|
-
* // In create_app_server options:
|
|
220
|
-
* event_specs: audit_log_event_specs,
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
export const create_audit_log_sse = (options) => {
|
|
224
|
-
const role = options.role ?? 'admin';
|
|
225
|
-
const max_per_scope = options.max_per_scope === undefined ? AUDIT_LOG_SSE_MAX_PER_SCOPE : options.max_per_scope;
|
|
226
|
-
const registry = new SubscriberRegistry({ max_per_scope, log: options.log });
|
|
227
|
-
const guard = create_sse_auth_guard(registry, role, options.log);
|
|
228
|
-
options.connection_closer?.add(create_sse_connection_closer(registry, role));
|
|
229
|
-
return {
|
|
230
|
-
log: options.log,
|
|
231
|
-
required_role: role,
|
|
232
|
-
on_audit_event: (event) => {
|
|
233
|
-
registry.broadcast(AUDIT_LOG_CHANNEL, { method: event.event_type, params: event });
|
|
234
|
-
guard(event);
|
|
235
|
-
},
|
|
236
|
-
registry
|
|
237
|
-
};
|
|
238
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber_registry.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/subscriber_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,0EAA0E;AAC1E,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,sEAAsE;IACtE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7B,mDAAmD;IACnD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qEAAqE;IACrE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC3B;AASD,wCAAwC;AACxC,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,WAAW,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FG;AACH,qBAAa,kBAAkB,CAAC,CAAC;;gBAYpB,OAAO,CAAC,EAAE,yBAAyB;IAK/C;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,CAMlB;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,MAAM,CAM1B;IAED;;;;;OAKG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAavE;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,mBAAmB;IAYlE;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO;IASlE;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IASzC;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAM3C;;;;;;;;;;;;OAYG;IACH,SAAS,IAAI,MAAM;CAsFnB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import './assert_dev_env.js';
|
|
2
|
-
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
3
|
-
import type { BootstrapLiveOptions } from '../server/app_server.js';
|
|
4
|
-
import type { AppServerContext } from '../server/app_server_context.js';
|
|
5
|
-
import type { RouteSpec } from '../http/route_spec.js';
|
|
6
|
-
import type { RpcEndpointsSuiteOption } from './rpc_helpers.js';
|
|
7
|
-
/** Options for `describe_bootstrap_success_tests`. */
|
|
8
|
-
export interface BootstrapSuccessTestOptions {
|
|
9
|
-
session_options: SessionOptions<string>;
|
|
10
|
-
/** Same factory the consumer's production server uses. */
|
|
11
|
-
create_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
12
|
-
/** RPC endpoints — passed through to `create_app_server` for shape parity. */
|
|
13
|
-
rpc_endpoints?: RpcEndpointsSuiteOption;
|
|
14
|
-
/**
|
|
15
|
-
* Live bootstrap config — the suite drives `POST /bootstrap` against
|
|
16
|
-
* `bootstrap.token_path`. The suite does NOT assert on `on_bootstrap`
|
|
17
|
-
* callback invocation (Hono-coupled signature is in-process only);
|
|
18
|
-
* assertions land on observable DB state.
|
|
19
|
-
*/
|
|
20
|
-
bootstrap: BootstrapLiveOptions;
|
|
21
|
-
/** Override the synthetic token text. Default deterministic. */
|
|
22
|
-
bootstrap_token?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Run the bootstrap success-path test suite against the consumer's
|
|
26
|
-
* production-shaped wiring.
|
|
27
|
-
*/
|
|
28
|
-
export declare const describe_bootstrap_success_tests: (options: BootstrapSuccessTestOptions) => void;
|
|
29
|
-
//# sourceMappingURL=bootstrap_success.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap_success.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/bootstrap_success.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAMhE,sDAAsD;AACtD,MAAM,WAAW,2BAA2B;IAC3C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,0DAA0D;IAC1D,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,8EAA8E;IAC9E,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,SAAS,EAAE,oBAAoB,CAAC;IAChC,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,GAAI,SAAS,2BAA2B,KAAG,IAyIvF,CAAC"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import './assert_dev_env.js';
|
|
2
|
-
/**
|
|
3
|
-
* Bootstrap success-path suite for consumer projects.
|
|
4
|
-
*
|
|
5
|
-
* Exercises `POST /bootstrap` against an empty DB (no pre-keeper, lock
|
|
6
|
-
* unflipped) through the real `bootstrap_account` flow. Asserts on
|
|
7
|
-
* observable state — account exists, `bootstrap_lock.bootstrapped` is
|
|
8
|
-
* true, audit row emitted, response body shape — rather than
|
|
9
|
-
* `on_bootstrap` callback invocation, so the suite stays cross-impl
|
|
10
|
-
* friendly when cross-process testing wires it against a spawned
|
|
11
|
-
* Rust backend.
|
|
12
|
-
*
|
|
13
|
-
* Folded into `describe_standard_tests` with a `bootstrap.mode === 'live'`
|
|
14
|
-
* silent-skip gate; consumers wiring live bootstrap pick up success-path
|
|
15
|
-
* coverage by default.
|
|
16
|
-
*
|
|
17
|
-
* @module
|
|
18
|
-
*/
|
|
19
|
-
import { describe, test, assert } from 'vitest';
|
|
20
|
-
import { ERROR_ALREADY_BOOTSTRAPPED, ERROR_INVALID_TOKEN } from '../http/error_schemas.js';
|
|
21
|
-
import { create_test_app_for_bootstrap } from './app_server.js';
|
|
22
|
-
const DEFAULT_TEST_TOKEN = 'test-bootstrap-token-value-deterministic';
|
|
23
|
-
const TEST_USERNAME = 'keeper';
|
|
24
|
-
const TEST_PASSWORD = 'test-password-with-min-12-chars';
|
|
25
|
-
/**
|
|
26
|
-
* Run the bootstrap success-path test suite against the consumer's
|
|
27
|
-
* production-shaped wiring.
|
|
28
|
-
*/
|
|
29
|
-
export const describe_bootstrap_success_tests = (options) => {
|
|
30
|
-
const token = options.bootstrap_token ?? DEFAULT_TEST_TOKEN;
|
|
31
|
-
const route_prefix = options.bootstrap.route_prefix ?? '/api/account';
|
|
32
|
-
const bootstrap_path = `${route_prefix}/bootstrap`;
|
|
33
|
-
describe('bootstrap success path', () => {
|
|
34
|
-
test('POST /bootstrap with valid token creates the keeper account and flips the lock', async () => {
|
|
35
|
-
const test_app = await create_test_app_for_bootstrap({
|
|
36
|
-
session_options: options.session_options,
|
|
37
|
-
create_route_specs: options.create_route_specs,
|
|
38
|
-
rpc_endpoints: options.rpc_endpoints,
|
|
39
|
-
bootstrap: options.bootstrap,
|
|
40
|
-
bootstrap_token: token
|
|
41
|
-
});
|
|
42
|
-
try {
|
|
43
|
-
const response = await test_app.app.request(bootstrap_path, {
|
|
44
|
-
method: 'POST',
|
|
45
|
-
headers: test_app.create_request_headers({ 'content-type': 'application/json' }),
|
|
46
|
-
body: JSON.stringify({
|
|
47
|
-
token,
|
|
48
|
-
username: TEST_USERNAME,
|
|
49
|
-
password: TEST_PASSWORD
|
|
50
|
-
})
|
|
51
|
-
});
|
|
52
|
-
// Response shape
|
|
53
|
-
assert.strictEqual(response.status, 200);
|
|
54
|
-
const body = (await response.json());
|
|
55
|
-
assert.strictEqual(body.ok, true);
|
|
56
|
-
assert.strictEqual(body.account.username, TEST_USERNAME);
|
|
57
|
-
assert.ok(body.account.id);
|
|
58
|
-
assert.ok(body.actor.id);
|
|
59
|
-
// Observable state: account exists in DB
|
|
60
|
-
const account = await test_app.backend.deps.db.query_one('SELECT username FROM account WHERE username = $1', [TEST_USERNAME]);
|
|
61
|
-
assert.ok(account);
|
|
62
|
-
// Observable state: bootstrap_lock flipped to true
|
|
63
|
-
const lock = await test_app.backend.deps.db.query_one('SELECT bootstrapped FROM bootstrap_lock WHERE id = 1');
|
|
64
|
-
assert.ok(lock);
|
|
65
|
-
assert.strictEqual(lock.bootstrapped, true);
|
|
66
|
-
// Observable state: audit row emitted
|
|
67
|
-
const audit_row = await test_app.backend.deps.db.query_one("SELECT event_type, account_id FROM audit_log WHERE event_type = 'bootstrap' AND outcome = 'success' LIMIT 1");
|
|
68
|
-
assert.ok(audit_row);
|
|
69
|
-
assert.strictEqual(audit_row.account_id, body.account.id);
|
|
70
|
-
}
|
|
71
|
-
finally {
|
|
72
|
-
await test_app.cleanup();
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
test('second POST /bootstrap returns 403 ALREADY_BOOTSTRAPPED', async () => {
|
|
76
|
-
const test_app = await create_test_app_for_bootstrap({
|
|
77
|
-
session_options: options.session_options,
|
|
78
|
-
create_route_specs: options.create_route_specs,
|
|
79
|
-
rpc_endpoints: options.rpc_endpoints,
|
|
80
|
-
bootstrap: options.bootstrap,
|
|
81
|
-
bootstrap_token: token
|
|
82
|
-
});
|
|
83
|
-
try {
|
|
84
|
-
// First bootstrap succeeds
|
|
85
|
-
const first = await test_app.app.request(bootstrap_path, {
|
|
86
|
-
method: 'POST',
|
|
87
|
-
headers: test_app.create_request_headers({ 'content-type': 'application/json' }),
|
|
88
|
-
body: JSON.stringify({
|
|
89
|
-
token,
|
|
90
|
-
username: TEST_USERNAME,
|
|
91
|
-
password: TEST_PASSWORD
|
|
92
|
-
})
|
|
93
|
-
});
|
|
94
|
-
assert.strictEqual(first.status, 200);
|
|
95
|
-
// Second attempt blocked by lock
|
|
96
|
-
const second = await test_app.app.request(bootstrap_path, {
|
|
97
|
-
method: 'POST',
|
|
98
|
-
headers: test_app.create_request_headers({ 'content-type': 'application/json' }),
|
|
99
|
-
body: JSON.stringify({
|
|
100
|
-
token,
|
|
101
|
-
username: 'another_user',
|
|
102
|
-
password: TEST_PASSWORD
|
|
103
|
-
})
|
|
104
|
-
});
|
|
105
|
-
assert.strictEqual(second.status, 403);
|
|
106
|
-
const body = (await second.json());
|
|
107
|
-
assert.strictEqual(body.error, ERROR_ALREADY_BOOTSTRAPPED);
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
await test_app.cleanup();
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
test('POST /bootstrap with wrong token returns 401 INVALID_TOKEN', async () => {
|
|
114
|
-
const test_app = await create_test_app_for_bootstrap({
|
|
115
|
-
session_options: options.session_options,
|
|
116
|
-
create_route_specs: options.create_route_specs,
|
|
117
|
-
rpc_endpoints: options.rpc_endpoints,
|
|
118
|
-
bootstrap: options.bootstrap,
|
|
119
|
-
bootstrap_token: token
|
|
120
|
-
});
|
|
121
|
-
try {
|
|
122
|
-
const response = await test_app.app.request(bootstrap_path, {
|
|
123
|
-
method: 'POST',
|
|
124
|
-
headers: test_app.create_request_headers({ 'content-type': 'application/json' }),
|
|
125
|
-
body: JSON.stringify({
|
|
126
|
-
token: 'wrong-token-value-that-does-not-match',
|
|
127
|
-
username: TEST_USERNAME,
|
|
128
|
-
password: TEST_PASSWORD
|
|
129
|
-
})
|
|
130
|
-
});
|
|
131
|
-
assert.strictEqual(response.status, 401);
|
|
132
|
-
const body = (await response.json());
|
|
133
|
-
assert.strictEqual(body.error, ERROR_INVALID_TOKEN);
|
|
134
|
-
// Observable state: lock NOT flipped (transaction rolled back on auth failure)
|
|
135
|
-
const lock = await test_app.backend.deps.db.query_one('SELECT bootstrapped FROM bootstrap_lock WHERE id = 1');
|
|
136
|
-
assert.ok(lock);
|
|
137
|
-
assert.strictEqual(lock.bootstrapped, false);
|
|
138
|
-
}
|
|
139
|
-
finally {
|
|
140
|
-
await test_app.cleanup();
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import './assert_dev_env.js';
|
|
2
|
-
/**
|
|
3
|
-
* In-memory file system mock for tests that use dependency-injected
|
|
4
|
-
* `read_file` and `write_file` callbacks. Avoids module-level mocking.
|
|
5
|
-
*
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
export interface MockFs {
|
|
9
|
-
read_file: (path: string, encoding: string) => Promise<string>;
|
|
10
|
-
write_file: (path: string, content: string, encoding: string) => Promise<void>;
|
|
11
|
-
get_file: (path: string) => string | undefined;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Creates an in-memory file system for tests.
|
|
15
|
-
*
|
|
16
|
-
* `read_file` throws an `ENOENT`-tagged error for missing paths so callers
|
|
17
|
-
* can exercise the same "file doesn't exist" code path as `node:fs`.
|
|
18
|
-
*/
|
|
19
|
-
export declare const create_mock_fs: (initial_files?: Record<string, string>) => MockFs;
|
|
20
|
-
//# sourceMappingURL=mock_fs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock_fs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/mock_fs.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACtB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC/C;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,gBAAe,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KAAG,MAsB3E,CAAC"}
|
package/dist/testing/mock_fs.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import './assert_dev_env.js';
|
|
2
|
-
/**
|
|
3
|
-
* Creates an in-memory file system for tests.
|
|
4
|
-
*
|
|
5
|
-
* `read_file` throws an `ENOENT`-tagged error for missing paths so callers
|
|
6
|
-
* can exercise the same "file doesn't exist" code path as `node:fs`.
|
|
7
|
-
*/
|
|
8
|
-
export const create_mock_fs = (initial_files = {}) => {
|
|
9
|
-
const files = { ...initial_files };
|
|
10
|
-
return {
|
|
11
|
-
read_file: async (path, _encoding) => {
|
|
12
|
-
if (!(path in files)) {
|
|
13
|
-
const error = new Error(`ENOENT: no such file or directory, open '${path}'`);
|
|
14
|
-
error.code = 'ENOENT';
|
|
15
|
-
throw error;
|
|
16
|
-
}
|
|
17
|
-
const file_content = files[path];
|
|
18
|
-
if (file_content === undefined) {
|
|
19
|
-
throw new Error(`File at ${path} exists in record but has undefined content`);
|
|
20
|
-
}
|
|
21
|
-
return file_content;
|
|
22
|
-
},
|
|
23
|
-
write_file: async (path, content, _encoding) => {
|
|
24
|
-
files[path] = content;
|
|
25
|
-
},
|
|
26
|
-
get_file: (path) => files[path]
|
|
27
|
-
};
|
|
28
|
-
};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import './assert_dev_env.js';
|
|
2
|
-
/**
|
|
3
|
-
* Combined standard test suite helper.
|
|
4
|
-
*
|
|
5
|
-
* Bundles every DB-backed suite carrying the standard option shape, each
|
|
6
|
-
* gated on its relevant config — silent-skip when the gate isn't met
|
|
7
|
-
* (same precedent as `describe_standard_admin_integration_tests` skipping
|
|
8
|
-
* when `roles` isn't provided). Consumers wire the standard surface in
|
|
9
|
-
* one call instead of seven; forgetting a suite no longer silently loses
|
|
10
|
-
* coverage.
|
|
11
|
-
*
|
|
12
|
-
* Attack surface suites stay separate — their option shape is
|
|
13
|
-
* `{build, snapshot_path, expected_public_routes, ...}` rather than
|
|
14
|
-
* `{setup_test, surface_source, capabilities}`. A peer bundler lives
|
|
15
|
-
* for that side if/when needed.
|
|
16
|
-
*
|
|
17
|
-
* @module
|
|
18
|
-
*/
|
|
19
|
-
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
20
|
-
import type { RoleSchemaResult } from '../auth/role_schema.js';
|
|
21
|
-
import type { BootstrapServerOptions } from '../server/app_server.js';
|
|
22
|
-
import type { AppServerContext } from '../server/app_server_context.js';
|
|
23
|
-
import type { RouteSpec } from '../http/route_spec.js';
|
|
24
|
-
import { type RpcSuccessFixtures } from './rpc_round_trip.js';
|
|
25
|
-
import type { RpcEndpointsSuiteOption } from './rpc_helpers.js';
|
|
26
|
-
import type { BackendCapabilities } from './cross_backend/capabilities.js';
|
|
27
|
-
import type { SetupTest } from './cross_backend/setup.js';
|
|
28
|
-
import type { AppSurfaceSpec } from '../http/surface.js';
|
|
29
|
-
import type { SuiteAppOptions } from './app_server.js';
|
|
30
|
-
/**
|
|
31
|
-
* Configuration for `describe_standard_tests`.
|
|
32
|
-
*/
|
|
33
|
-
export interface StandardTestOptions {
|
|
34
|
-
/** Per-test fixture-producing function. */
|
|
35
|
-
setup_test: SetupTest;
|
|
36
|
-
/**
|
|
37
|
-
* App surface. Constructed in TS by the consumer; same shape for
|
|
38
|
-
* in-process and cross-process tests.
|
|
39
|
-
*/
|
|
40
|
-
surface_source: AppSurfaceSpec;
|
|
41
|
-
/**
|
|
42
|
-
* Backend capability declarations. Forwarded to the one bundled suite
|
|
43
|
-
* that gates on them (`describe_standard_integration_tests`); the other
|
|
44
|
-
* suites in the bundle read no flags and take no capability field.
|
|
45
|
-
*/
|
|
46
|
-
capabilities: BackendCapabilities;
|
|
47
|
-
/** Session config — needed for cookie_name + factory-form rpc_endpoints resolution. */
|
|
48
|
-
session_options: SessionOptions<string>;
|
|
49
|
-
/**
|
|
50
|
-
* Route spec factory — same one used in production. Required by
|
|
51
|
-
* `describe_rate_limiting_tests`, which builds a fresh `TestApp` per test
|
|
52
|
-
* (bypasses the shared `setup_test` fixture) so it can pass tight
|
|
53
|
-
* per-test rate-limiter overrides.
|
|
54
|
-
*/
|
|
55
|
-
create_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
56
|
-
/**
|
|
57
|
-
* RPC endpoint specs — required. The standard integration tests drive
|
|
58
|
-
* `account_verify`, `account_session_*`, `account_token_*` through the
|
|
59
|
-
* RPC surface (and admin tests, when wired, drive role_grant grant/revoke
|
|
60
|
-
* through it too).
|
|
61
|
-
*/
|
|
62
|
-
rpc_endpoints: RpcEndpointsSuiteOption;
|
|
63
|
-
/**
|
|
64
|
-
* Role schema result from `create_role_schema()`.
|
|
65
|
-
* When provided, admin integration + audit completeness suites are included.
|
|
66
|
-
*/
|
|
67
|
-
roles?: RoleSchemaResult;
|
|
68
|
-
/**
|
|
69
|
-
* Bootstrap config — when set to `mode: 'live'`, the bootstrap success
|
|
70
|
-
* suite runs against `create_test_app_for_bootstrap`. Other modes
|
|
71
|
-
* (`'disabled'` / `'surface_only'` / omission) silent-skip the suite.
|
|
72
|
-
*/
|
|
73
|
-
bootstrap?: BootstrapServerOptions;
|
|
74
|
-
/** Optional overrides forwarded to `describe_rate_limiting_tests`. */
|
|
75
|
-
rate_limiting_app_options?: SuiteAppOptions;
|
|
76
|
-
/**
|
|
77
|
-
* Path prefix where admin routes are mounted.
|
|
78
|
-
* Default `'/api/admin'`.
|
|
79
|
-
*/
|
|
80
|
-
admin_prefix?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Forwarded to `describe_standard_integration_tests` — overrides the
|
|
83
|
-
* default error-coverage threshold on the scoped REST surface. Set to
|
|
84
|
-
* `0` to skip the assertion entirely.
|
|
85
|
-
*/
|
|
86
|
-
error_coverage_min?: number;
|
|
87
|
-
/** Override the bootstrap-success suite's synthetic token. */
|
|
88
|
-
bootstrap_token?: string;
|
|
89
|
-
/**
|
|
90
|
-
* Forwarded to `describe_rpc_round_trip_tests` as `success_fixtures`
|
|
91
|
-
* (method name → async params factory) — drives a populated **success**
|
|
92
|
-
* body for methods that act on an existing row, validated against the
|
|
93
|
-
* method's `output` schema. `create_spine_rpc_success_fixtures`
|
|
94
|
-
* (`cross_backend/rpc_success_fixtures.ts`) builds the map for the
|
|
95
|
-
* standard spine methods. See `RpcRoundTripTestOptions.success_fixtures`.
|
|
96
|
-
*/
|
|
97
|
-
rpc_success_fixtures?: RpcSuccessFixtures;
|
|
98
|
-
/**
|
|
99
|
-
* Forwarded to `describe_rpc_round_trip_tests` as `skip_methods` — the
|
|
100
|
-
* consumer escape hatch for a method the generic round-trip can't drive at
|
|
101
|
-
* all (a handler whose test wiring stubs out the deps it reaches, or reads
|
|
102
|
-
* tables the suite's database doesn't migrate). Each entry hides the
|
|
103
|
-
* method from both the crash check and the envelope check, so name the
|
|
104
|
-
* reason beside it.
|
|
105
|
-
*/
|
|
106
|
-
rpc_skip_methods?: Array<string>;
|
|
107
|
-
/**
|
|
108
|
-
* Forwarded to `describe_rpc_round_trip_tests` as `input_overrides`
|
|
109
|
-
* (method name → params) — for a method whose generated params can't
|
|
110
|
-
* reach its handler cleanly. The response is held to the same rules as a
|
|
111
|
-
* generated one.
|
|
112
|
-
*/
|
|
113
|
-
rpc_input_overrides?: Map<string, Record<string, unknown>>;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Run the full standard test bundle — integration, admin (when `roles`
|
|
117
|
-
* provided), audit completeness (when `roles` provided), bootstrap
|
|
118
|
-
* success (when `bootstrap.mode === 'live'`), round trip, RPC round
|
|
119
|
-
* trip, data exposure, rate limiting.
|
|
120
|
-
*/
|
|
121
|
-
export declare const describe_standard_tests: (options: StandardTestOptions) => void;
|
|
122
|
-
//# sourceMappingURL=standard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standard.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/standard.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI7F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,2CAA2C;IAC3C,UAAU,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B;;;;OAIG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAClC,uFAAuF;IACvF,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;OAKG;IACH,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE;;;;;OAKG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,sEAAsE;IACtE,yBAAyB,CAAC,EAAE,eAAe,CAAC;IAC5C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3D;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,mBAAmB,KAAG,IAyDtE,CAAC"}
|