@fuzdev/fuz_app 0.150.0 → 0.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/actions/CLAUDE.md +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -34
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +52 -75
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +70 -44
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +179 -158
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -77
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +9 -2
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +23 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +45 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +2 -1
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -239
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuzdev/fuz_app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.151.0",
|
|
4
4
|
"description": "fullstack app library",
|
|
5
5
|
"glyph": "🗝",
|
|
6
6
|
"logo": "logo.svg",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"test:cross:rust-spine-stub": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_rust_spine_stub",
|
|
20
20
|
"test:cross:parity": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_parity",
|
|
21
21
|
"test:cross:security": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_security",
|
|
22
|
+
"test:cross:timing": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_timing",
|
|
22
23
|
"test:cross:ts-differential": "FUZ_TEST_CROSS_BACKEND=1 vitest run --project cross_backend_ts_differential",
|
|
23
24
|
"benchmark:cross-impl": "gro run src/benchmarks/cross_impl.bench.ts",
|
|
24
25
|
"preview": "vite preview",
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Composed WebSocket endpoint registration — the primitive
|
|
3
|
-
* `create_app_server` mounts each `ws_endpoints` entry with. An app assembled
|
|
4
|
-
* by `create_app_server` declares its endpoints there rather than calling this,
|
|
5
|
-
* and gets the shared action rate limiters, the origin default, the surface
|
|
6
|
-
* entry, and the audit guard with them.
|
|
7
|
-
*
|
|
8
|
-
* Wraps the standard upgrade stack:
|
|
9
|
-
*
|
|
10
|
-
* 1. `verify_request_source(allowed_origins)` — reject disallowed origins
|
|
11
|
-
* before the upgrade handshake runs.
|
|
12
|
-
* 2. `require_auth` — reject unauthenticated upgrades.
|
|
13
|
-
* 3. `require_token_scope('surface:ws_upgrade')` — rule 3: a narrowed token
|
|
14
|
-
* cannot hold a socket. Mounted here, ahead of the role guard, so a
|
|
15
|
-
* narrowed token is told about its scope rather than about a role it
|
|
16
|
-
* also lacks. `register_action_ws` repeats the check on its own route
|
|
17
|
-
* chain, which is what covers consumers mounting it directly; the
|
|
18
|
-
* earlier answer wins when both are wired.
|
|
19
|
-
* 4. **Authorization phase** — resolve the acting actor against the
|
|
20
|
-
* authenticated account plus an optional `?acting=<uuid>` query string,
|
|
21
|
-
* and build the `RequestContext` that per-message dispatch reads.
|
|
22
|
-
* Multi-actor accounts must supply `?acting` to pick a persona;
|
|
23
|
-
* single-actor accounts work without it.
|
|
24
|
-
* 5. Optional `require_role(required_roles)` — for endpoints gated to a
|
|
25
|
-
* non-empty any-of set of roles. `register_action_ws` records the roles on
|
|
26
|
-
* each registration and re-reads them at admission, so the gate holds for
|
|
27
|
-
* the socket's life (a revoked role closes it with
|
|
28
|
-
* `WS_CLOSE_PERMISSION_REVOKED`).
|
|
29
|
-
*
|
|
30
|
-
* Then delegates to `register_action_ws` for per-message JSON-RPC
|
|
31
|
-
* dispatch.
|
|
32
|
-
*
|
|
33
|
-
* @module
|
|
34
|
-
*/
|
|
35
|
-
import type { RoleName } from '../auth/role_schema.js';
|
|
36
|
-
import { type RegisterActionWsOptions, type RegisterActionWsResult } from './register_action_ws.js';
|
|
37
|
-
/** Options for `register_ws_endpoint`. */
|
|
38
|
-
export interface RegisterWsEndpointOptions extends RegisterActionWsOptions {
|
|
39
|
-
/**
|
|
40
|
-
* Origin allowlist regexes — typically parsed from the `FUZ_ALLOWED_ORIGINS`
|
|
41
|
-
* env var via `parse_allowed_origins`. Passed straight to
|
|
42
|
-
* `verify_request_source`.
|
|
43
|
-
*/
|
|
44
|
-
allowed_origins: ReadonlyArray<RegExp>;
|
|
45
|
-
/**
|
|
46
|
-
* Roles permitted to upgrade — any-of disjunction (matches the
|
|
47
|
-
* underlying `require_role` semantics, global grants only). Omit (or pass
|
|
48
|
-
* `[]`) for any authenticated account (`require_auth` + actor resolution
|
|
49
|
-
* alone); set to e.g. `[ROLE_ADMIN]` to gate the endpoint behind a single
|
|
50
|
-
* role or `[ROLE_ADMIN, ROLE_KEEPER]` to permit either. The per-action
|
|
51
|
-
* `auth` in each spec still applies at dispatch time — this is a coarse
|
|
52
|
-
* upgrade-time gate on who may hold a socket, and so on who receives
|
|
53
|
-
* the endpoint's server pushes.
|
|
54
|
-
*
|
|
55
|
-
* It holds for the socket's life: `register_action_ws` re-reads it at
|
|
56
|
-
* admission, and a revoked global grant of a listed role closes the
|
|
57
|
-
* account's sockets here with `WS_CLOSE_PERMISSION_REVOKED` (any listed
|
|
58
|
-
* role — see `close_sockets_for_role` on the over-close).
|
|
59
|
-
*/
|
|
60
|
-
required_roles?: ReadonlyArray<RoleName>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Mount a WebSocket endpoint with the standard upgrade stack (origin check
|
|
64
|
-
* + auth + token scope + actor resolution + optional role) and JSON-RPC
|
|
65
|
-
* dispatch.
|
|
66
|
-
*
|
|
67
|
-
* Returns the `BackendWebsocketTransport` (supplied or freshly
|
|
68
|
-
* created), same as `register_action_ws` — retain it to wire
|
|
69
|
-
* `create_ws_auth_guard` on `on_audit_event` or to broadcast.
|
|
70
|
-
*
|
|
71
|
-
* @mutates options.app - applies origin/auth/scope/authorization/role middleware
|
|
72
|
-
* via `app.use`, then registers the `GET path` route via the inner
|
|
73
|
-
* `register_action_ws`
|
|
74
|
-
* @mutates options.connection_closer - adds the endpoint's transport, once the
|
|
75
|
-
* mount has succeeded, for good — pass `null` and add it yourself to hold the
|
|
76
|
-
* remover
|
|
77
|
-
*/
|
|
78
|
-
export declare const register_ws_endpoint: (options: RegisterWsEndpointOptions) => RegisterActionWsResult;
|
|
79
|
-
//# sourceMappingURL=register_ws_endpoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register_ws_endpoint.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_ws_endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAcH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAEN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,MAAM,yBAAyB,CAAC;AAEjC,0CAA0C;AAC1C,MAAM,WAAW,yBAA0B,SAAQ,uBAAuB;IACzE;;;;OAIG;IACH,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC;;;;;;;;;;;;;;OAcG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;CACzC;AA6CD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,GAChC,SAAS,yBAAyB,KAChC,sBAoBF,CAAC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Composed WebSocket endpoint registration — the primitive
|
|
3
|
-
* `create_app_server` mounts each `ws_endpoints` entry with. An app assembled
|
|
4
|
-
* by `create_app_server` declares its endpoints there rather than calling this,
|
|
5
|
-
* and gets the shared action rate limiters, the origin default, the surface
|
|
6
|
-
* entry, and the audit guard with them.
|
|
7
|
-
*
|
|
8
|
-
* Wraps the standard upgrade stack:
|
|
9
|
-
*
|
|
10
|
-
* 1. `verify_request_source(allowed_origins)` — reject disallowed origins
|
|
11
|
-
* before the upgrade handshake runs.
|
|
12
|
-
* 2. `require_auth` — reject unauthenticated upgrades.
|
|
13
|
-
* 3. `require_token_scope('surface:ws_upgrade')` — rule 3: a narrowed token
|
|
14
|
-
* cannot hold a socket. Mounted here, ahead of the role guard, so a
|
|
15
|
-
* narrowed token is told about its scope rather than about a role it
|
|
16
|
-
* also lacks. `register_action_ws` repeats the check on its own route
|
|
17
|
-
* chain, which is what covers consumers mounting it directly; the
|
|
18
|
-
* earlier answer wins when both are wired.
|
|
19
|
-
* 4. **Authorization phase** — resolve the acting actor against the
|
|
20
|
-
* authenticated account plus an optional `?acting=<uuid>` query string,
|
|
21
|
-
* and build the `RequestContext` that per-message dispatch reads.
|
|
22
|
-
* Multi-actor accounts must supply `?acting` to pick a persona;
|
|
23
|
-
* single-actor accounts work without it.
|
|
24
|
-
* 5. Optional `require_role(required_roles)` — for endpoints gated to a
|
|
25
|
-
* non-empty any-of set of roles. `register_action_ws` records the roles on
|
|
26
|
-
* each registration and re-reads them at admission, so the gate holds for
|
|
27
|
-
* the socket's life (a revoked role closes it with
|
|
28
|
-
* `WS_CLOSE_PERMISSION_REVOKED`).
|
|
29
|
-
*
|
|
30
|
-
* Then delegates to `register_action_ws` for per-message JSON-RPC
|
|
31
|
-
* dispatch.
|
|
32
|
-
*
|
|
33
|
-
* @module
|
|
34
|
-
*/
|
|
35
|
-
import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
36
|
-
import { apply_authorization_phase, REQUEST_CONTEXT_KEY, require_auth, require_role, require_token_scope } from '../auth/request_context.js';
|
|
37
|
-
import { verify_request_source } from '../http/origin.js';
|
|
38
|
-
import { parse_acting } from '../http/auth_shape.js';
|
|
39
|
-
import { ACCOUNT_ID_KEY, TEST_CONTEXT_PRESET_KEY } from '../hono_context.js';
|
|
40
|
-
import { register_action_ws } from './register_action_ws.js';
|
|
41
|
-
/** Synthesized auth shape for WS upgrade: account + actor both required. */
|
|
42
|
-
const WS_UPGRADE_AUTH = {
|
|
43
|
-
account: 'required',
|
|
44
|
-
actor: 'required'
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Upgrade-time authorization middleware. Resolves the acting actor for
|
|
48
|
-
* the WS connection (single-actor default; multi-actor must supply
|
|
49
|
-
* `?acting=<uuid>`) and builds the `RequestContext` that per-message
|
|
50
|
-
* dispatch reads. Returns 400 on resolution failure.
|
|
51
|
-
*
|
|
52
|
-
* Sets `REQUEST_CONTEXT_KEY` on resolved outcomes so the inner
|
|
53
|
-
* `register_action_ws` reads the upgrade-time context via
|
|
54
|
-
* `require_request_context(c)`. Honors the test-preset escape hatch the
|
|
55
|
-
* same way the REST and HTTP RPC binders do.
|
|
56
|
-
*/
|
|
57
|
-
const create_ws_authorization_middleware = (db) => {
|
|
58
|
-
return async (c, next) => {
|
|
59
|
-
// Test escape hatch — harnesses pre-populate `REQUEST_CONTEXT_KEY`
|
|
60
|
-
// + flag `TEST_CONTEXT_PRESET_KEY = true`. Production middleware
|
|
61
|
-
// never sets this flag.
|
|
62
|
-
if (c.get(TEST_CONTEXT_PRESET_KEY)) {
|
|
63
|
-
await next();
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
// through the `ActingActor` schema like every other selector: lowercased,
|
|
67
|
-
// and a malformed value reads as omitted (`parse_acting`)
|
|
68
|
-
const acting = parse_acting(c.req.query('acting'));
|
|
69
|
-
const account_id = c.get(ACCOUNT_ID_KEY) ?? null;
|
|
70
|
-
const result = await apply_authorization_phase({ db }, account_id, WS_UPGRADE_AUTH, acting);
|
|
71
|
-
if (!result.ok)
|
|
72
|
-
return c.json(result.body, result.status);
|
|
73
|
-
if (result.request_context !== null) {
|
|
74
|
-
c.set(REQUEST_CONTEXT_KEY, result.request_context);
|
|
75
|
-
}
|
|
76
|
-
// `request_context: null` is unreachable here — `WS_UPGRADE_AUTH` is
|
|
77
|
-
// `account: 'required', actor: 'required'`, and `require_auth` ran
|
|
78
|
-
// upstream, so neither the public nor the unauthenticated branch
|
|
79
|
-
// resolves through this middleware.
|
|
80
|
-
await next();
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Mount a WebSocket endpoint with the standard upgrade stack (origin check
|
|
85
|
-
* + auth + token scope + actor resolution + optional role) and JSON-RPC
|
|
86
|
-
* dispatch.
|
|
87
|
-
*
|
|
88
|
-
* Returns the `BackendWebsocketTransport` (supplied or freshly
|
|
89
|
-
* created), same as `register_action_ws` — retain it to wire
|
|
90
|
-
* `create_ws_auth_guard` on `on_audit_event` or to broadcast.
|
|
91
|
-
*
|
|
92
|
-
* @mutates options.app - applies origin/auth/scope/authorization/role middleware
|
|
93
|
-
* via `app.use`, then registers the `GET path` route via the inner
|
|
94
|
-
* `register_action_ws`
|
|
95
|
-
* @mutates options.connection_closer - adds the endpoint's transport, once the
|
|
96
|
-
* mount has succeeded, for good — pass `null` and add it yourself to hold the
|
|
97
|
-
* remover
|
|
98
|
-
*/
|
|
99
|
-
export const register_ws_endpoint = (options) => {
|
|
100
|
-
const { app, path, allowed_origins, db, required_roles, log = new Logger('[ws]'), ...rest } = options;
|
|
101
|
-
app.use(path, verify_request_source(allowed_origins));
|
|
102
|
-
app.use(path, require_auth);
|
|
103
|
-
app.use(path, require_token_scope('surface:ws_upgrade'));
|
|
104
|
-
app.use(path, create_ws_authorization_middleware(db));
|
|
105
|
-
if (required_roles?.length) {
|
|
106
|
-
app.use(path, require_role(required_roles));
|
|
107
|
-
}
|
|
108
|
-
return register_action_ws({ app, path, db, log, required_roles, ...rest });
|
|
109
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket auth guard — the audit-event listener that closes live
|
|
3
|
-
* connections when a row reports a revocation.
|
|
4
|
-
*
|
|
5
|
-
* **Why this exists.** `register_action_ws` captures `account_id` and
|
|
6
|
-
* `credential_type` at upgrade time and reuses them for every message.
|
|
7
|
-
* `perform_action`'s per-message authorization phase reloads role_grants
|
|
8
|
-
* from the DB, but session and token VALIDITY are not re-queried per message
|
|
9
|
-
* — they are re-read once, at admission (`revalidate_resolved_auth`) — a
|
|
10
|
-
* trade-off that keeps chatty WS connections fast. The cost: nothing in the
|
|
11
|
-
* dispatch path notices when a session is revoked or a token is rotated, so a
|
|
12
|
-
* revocation reaches an open connection only when something closes it.
|
|
13
|
-
*
|
|
14
|
-
* Two things do. The revocation handlers close directly, after their
|
|
15
|
-
* transaction commits (`queue_connection_close` in
|
|
16
|
-
* `actions/connection_closer.ts`) — that close does not depend on the audit
|
|
17
|
-
* write. This guard repeats it when the audit row is announced, which covers
|
|
18
|
-
* a revocation emitted by code that holds no closer. Closing is idempotent, so
|
|
19
|
-
* the overlap is a repeat, not a conflict. A success row is announced only
|
|
20
|
-
* after its request's transaction commits (`auth/audit_emitter.ts`), so the
|
|
21
|
-
* guard's close is post-commit too.
|
|
22
|
-
*
|
|
23
|
-
* ## Which rows close
|
|
24
|
-
*
|
|
25
|
-
* The guard dispatches on the `RevocationScope` each audit event declares in
|
|
26
|
-
* `audit_event_revocation_scopes` (`auth/audit_log_schema.ts`), the table the
|
|
27
|
-
* SSE guard (`realtime/sse_auth_guard.ts`) reads too — one declaration, so the
|
|
28
|
-
* two cannot drift into closing a revoked token's socket while leaving its
|
|
29
|
-
* stream open.
|
|
30
|
-
*
|
|
31
|
-
* `role` closes the target account's sockets whose endpoint gated the upgrade
|
|
32
|
-
* on the revoked role (`close_sockets_for_role`), with
|
|
33
|
-
* `WS_CLOSE_PERMISSION_REVOKED`, when the revoked grant was global
|
|
34
|
-
* (`to_global_role_revocation` — a role gate admits on global grants only).
|
|
35
|
-
* `perform_action` re-authorizes every *request* against its own action, but
|
|
36
|
-
* the role gate is the only check on what the socket *receives*: broadcasts
|
|
37
|
-
* and notifications reach every admitted connection of the endpoint with no
|
|
38
|
-
* per-recipient filter, so a socket left open past the revocation would keep
|
|
39
|
-
* receiving what the gate exists to withhold. The role is the only revocation
|
|
40
|
-
* no handler closes for, so this guard is its one closer.
|
|
41
|
-
*
|
|
42
|
-
* For standard WS endpoints mounted via `AppServerOptions.ws_endpoints`,
|
|
43
|
-
* `create_app_server` registers the guard automatically per
|
|
44
|
-
* `WsEndpointSpec.auth_guard`. For custom wiring, register the handler
|
|
45
|
-
* inside the consumer's `audit_factory` body (or via
|
|
46
|
-
* `audit.add_listener(...)` post-assembly).
|
|
47
|
-
*
|
|
48
|
-
* Twin of the Rust spine's `register_socket_revocation_listeners`.
|
|
49
|
-
*
|
|
50
|
-
* @module
|
|
51
|
-
*/
|
|
52
|
-
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
53
|
-
import { type AuditLogEvent } from '../auth/audit_log_schema.js';
|
|
54
|
-
import type { ConnectionCloser } from './connection_closer.js';
|
|
55
|
-
/**
|
|
56
|
-
* Audit-event callback shape — the function `CreateAuditEmitterOptions.on_audit_event`
|
|
57
|
-
* accepts and that `create_ws_auth_guard` returns.
|
|
58
|
-
*
|
|
59
|
-
* Exported so consumers composing multiple handlers (typically
|
|
60
|
-
* `create_ws_auth_guard` + their own pre-existing `on_audit_event`) can
|
|
61
|
-
* annotate their composed callback without reaching for
|
|
62
|
-
* `Parameters<typeof create_ws_auth_guard>[0]`.
|
|
63
|
-
*/
|
|
64
|
-
export type AuditEventHandler = (event: AuditLogEvent) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Create an audit event handler that closes connections on a successful
|
|
67
|
-
* revocation row, dispatching on the event's `RevocationScope`:
|
|
68
|
-
*
|
|
69
|
-
* - `session` → `close_sockets_for_session(metadata.session_id)`
|
|
70
|
-
* - `token` → `close_sockets_for_token(metadata.token_id)`
|
|
71
|
-
* - `account` → `close_sockets_for_account(target_account_id ?? account_id)`
|
|
72
|
-
* — `logout`, `password_change`, `session_revoke_all`, `token_revoke_all`,
|
|
73
|
-
* `account_delete`, `account_purge`
|
|
74
|
-
* - `role` → `close_sockets_for_role(target_account_id ?? account_id,
|
|
75
|
-
* metadata.role)` when the revoked grant was global; a scoped revoke closes
|
|
76
|
-
* nothing (module doc)
|
|
77
|
-
* - `none` → nothing — every other event, and any event type fuz_app does not
|
|
78
|
-
* define
|
|
79
|
-
*
|
|
80
|
-
* Acts only on `outcome === 'success'` events — a failure carries
|
|
81
|
-
* attacker-controlled identifiers (e.g. a `session_revoke` that the DB
|
|
82
|
-
* rejected still records the submitted session_id), so reacting to it would
|
|
83
|
-
* let any authenticated user close another user's socket by guessing a
|
|
84
|
-
* session hash or token id. Matching the success rather than skipping the
|
|
85
|
-
* failure keeps an outcome outside the enum inert, as on the Rust spine.
|
|
86
|
-
*
|
|
87
|
-
* @param closer - what to close on — a `BackendWebsocketTransport`, or a
|
|
88
|
-
* `RealtimeCloser` to reach every transport from one listener
|
|
89
|
-
* @param log - logger for disconnect events (info level on non-zero closures)
|
|
90
|
-
* @returns an `on_audit_event` callback suitable for `create_audit_emitter`'s
|
|
91
|
-
* `on_audit_event` slot, or for registering via
|
|
92
|
-
* `audit.add_listener` post-assembly. The returned callback closes matching
|
|
93
|
-
* connections on `closer` on every relevant event.
|
|
94
|
-
*/
|
|
95
|
-
export declare const create_ws_auth_guard: (closer: ConnectionCloser, log: Logger) => AuditEventHandler;
|
|
96
|
-
//# sourceMappingURL=transports_ws_auth_guard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transports_ws_auth_guard.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports_ws_auth_guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAGN,KAAK,aAAa,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,gBAAgB,EAAE,KAAK,MAAM,KAAG,iBA6D5E,CAAC"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket auth guard — the audit-event listener that closes live
|
|
3
|
-
* connections when a row reports a revocation.
|
|
4
|
-
*
|
|
5
|
-
* **Why this exists.** `register_action_ws` captures `account_id` and
|
|
6
|
-
* `credential_type` at upgrade time and reuses them for every message.
|
|
7
|
-
* `perform_action`'s per-message authorization phase reloads role_grants
|
|
8
|
-
* from the DB, but session and token VALIDITY are not re-queried per message
|
|
9
|
-
* — they are re-read once, at admission (`revalidate_resolved_auth`) — a
|
|
10
|
-
* trade-off that keeps chatty WS connections fast. The cost: nothing in the
|
|
11
|
-
* dispatch path notices when a session is revoked or a token is rotated, so a
|
|
12
|
-
* revocation reaches an open connection only when something closes it.
|
|
13
|
-
*
|
|
14
|
-
* Two things do. The revocation handlers close directly, after their
|
|
15
|
-
* transaction commits (`queue_connection_close` in
|
|
16
|
-
* `actions/connection_closer.ts`) — that close does not depend on the audit
|
|
17
|
-
* write. This guard repeats it when the audit row is announced, which covers
|
|
18
|
-
* a revocation emitted by code that holds no closer. Closing is idempotent, so
|
|
19
|
-
* the overlap is a repeat, not a conflict. A success row is announced only
|
|
20
|
-
* after its request's transaction commits (`auth/audit_emitter.ts`), so the
|
|
21
|
-
* guard's close is post-commit too.
|
|
22
|
-
*
|
|
23
|
-
* ## Which rows close
|
|
24
|
-
*
|
|
25
|
-
* The guard dispatches on the `RevocationScope` each audit event declares in
|
|
26
|
-
* `audit_event_revocation_scopes` (`auth/audit_log_schema.ts`), the table the
|
|
27
|
-
* SSE guard (`realtime/sse_auth_guard.ts`) reads too — one declaration, so the
|
|
28
|
-
* two cannot drift into closing a revoked token's socket while leaving its
|
|
29
|
-
* stream open.
|
|
30
|
-
*
|
|
31
|
-
* `role` closes the target account's sockets whose endpoint gated the upgrade
|
|
32
|
-
* on the revoked role (`close_sockets_for_role`), with
|
|
33
|
-
* `WS_CLOSE_PERMISSION_REVOKED`, when the revoked grant was global
|
|
34
|
-
* (`to_global_role_revocation` — a role gate admits on global grants only).
|
|
35
|
-
* `perform_action` re-authorizes every *request* against its own action, but
|
|
36
|
-
* the role gate is the only check on what the socket *receives*: broadcasts
|
|
37
|
-
* and notifications reach every admitted connection of the endpoint with no
|
|
38
|
-
* per-recipient filter, so a socket left open past the revocation would keep
|
|
39
|
-
* receiving what the gate exists to withhold. The role is the only revocation
|
|
40
|
-
* no handler closes for, so this guard is its one closer.
|
|
41
|
-
*
|
|
42
|
-
* For standard WS endpoints mounted via `AppServerOptions.ws_endpoints`,
|
|
43
|
-
* `create_app_server` registers the guard automatically per
|
|
44
|
-
* `WsEndpointSpec.auth_guard`. For custom wiring, register the handler
|
|
45
|
-
* inside the consumer's `audit_factory` body (or via
|
|
46
|
-
* `audit.add_listener(...)` post-assembly).
|
|
47
|
-
*
|
|
48
|
-
* Twin of the Rust spine's `register_socket_revocation_listeners`.
|
|
49
|
-
*
|
|
50
|
-
* @module
|
|
51
|
-
*/
|
|
52
|
-
import { UnreachableError } from '@fuzdev/fuz_util/error.ts';
|
|
53
|
-
import { to_global_role_revocation, to_revocation_scope } from '../auth/audit_log_schema.js';
|
|
54
|
-
/**
|
|
55
|
-
* Create an audit event handler that closes connections on a successful
|
|
56
|
-
* revocation row, dispatching on the event's `RevocationScope`:
|
|
57
|
-
*
|
|
58
|
-
* - `session` → `close_sockets_for_session(metadata.session_id)`
|
|
59
|
-
* - `token` → `close_sockets_for_token(metadata.token_id)`
|
|
60
|
-
* - `account` → `close_sockets_for_account(target_account_id ?? account_id)`
|
|
61
|
-
* — `logout`, `password_change`, `session_revoke_all`, `token_revoke_all`,
|
|
62
|
-
* `account_delete`, `account_purge`
|
|
63
|
-
* - `role` → `close_sockets_for_role(target_account_id ?? account_id,
|
|
64
|
-
* metadata.role)` when the revoked grant was global; a scoped revoke closes
|
|
65
|
-
* nothing (module doc)
|
|
66
|
-
* - `none` → nothing — every other event, and any event type fuz_app does not
|
|
67
|
-
* define
|
|
68
|
-
*
|
|
69
|
-
* Acts only on `outcome === 'success'` events — a failure carries
|
|
70
|
-
* attacker-controlled identifiers (e.g. a `session_revoke` that the DB
|
|
71
|
-
* rejected still records the submitted session_id), so reacting to it would
|
|
72
|
-
* let any authenticated user close another user's socket by guessing a
|
|
73
|
-
* session hash or token id. Matching the success rather than skipping the
|
|
74
|
-
* failure keeps an outcome outside the enum inert, as on the Rust spine.
|
|
75
|
-
*
|
|
76
|
-
* @param closer - what to close on — a `BackendWebsocketTransport`, or a
|
|
77
|
-
* `RealtimeCloser` to reach every transport from one listener
|
|
78
|
-
* @param log - logger for disconnect events (info level on non-zero closures)
|
|
79
|
-
* @returns an `on_audit_event` callback suitable for `create_audit_emitter`'s
|
|
80
|
-
* `on_audit_event` slot, or for registering via
|
|
81
|
-
* `audit.add_listener` post-assembly. The returned callback closes matching
|
|
82
|
-
* connections on `closer` on every relevant event.
|
|
83
|
-
*/
|
|
84
|
-
export const create_ws_auth_guard = (closer, log) => {
|
|
85
|
-
return (event) => {
|
|
86
|
-
// only a committed revocation closes — failed mutations carry
|
|
87
|
-
// attacker-controlled metadata, and anything else is not a revocation
|
|
88
|
-
if (event.outcome !== 'success')
|
|
89
|
-
return;
|
|
90
|
-
const scope = to_revocation_scope(event.event_type);
|
|
91
|
-
switch (scope) {
|
|
92
|
-
case 'none':
|
|
93
|
-
return;
|
|
94
|
-
case 'role': {
|
|
95
|
-
// global grants only — a role gate never admitted on a scoped one
|
|
96
|
-
const revoked = to_global_role_revocation(event);
|
|
97
|
-
if (!revoked)
|
|
98
|
-
return;
|
|
99
|
-
const closed = closer.close_sockets_for_role(revoked.account_id, revoked.role);
|
|
100
|
-
if (closed > 0) {
|
|
101
|
-
log.info(`WS auth guard: closed ${closed} socket(s) gated on ${revoked.role} for account ${revoked.account_id} (${event.event_type})`);
|
|
102
|
-
}
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
case 'session': {
|
|
106
|
-
const session_id = event.metadata?.session_id;
|
|
107
|
-
if (typeof session_id !== 'string' || session_id.length === 0)
|
|
108
|
-
return;
|
|
109
|
-
const closed = closer.close_sockets_for_session(session_id);
|
|
110
|
-
if (closed > 0) {
|
|
111
|
-
log.info(`WS auth guard: closed ${closed} socket(s) for session ${session_id} (${event.event_type})`);
|
|
112
|
-
}
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
case 'token': {
|
|
116
|
-
const token_id = event.metadata?.token_id;
|
|
117
|
-
if (typeof token_id !== 'string' || token_id.length === 0)
|
|
118
|
-
return;
|
|
119
|
-
const closed = closer.close_sockets_for_token(token_id);
|
|
120
|
-
if (closed > 0) {
|
|
121
|
-
log.info(`WS auth guard: closed ${closed} socket(s) for token ${token_id} (${event.event_type})`);
|
|
122
|
-
}
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
case 'account': {
|
|
126
|
-
// Admin actions set `target_account_id`; self-service actions only
|
|
127
|
-
// set `account_id`.
|
|
128
|
-
const target = event.target_account_id ?? event.account_id;
|
|
129
|
-
if (!target)
|
|
130
|
-
return;
|
|
131
|
-
const closed = closer.close_sockets_for_account(target);
|
|
132
|
-
if (closed > 0) {
|
|
133
|
-
log.info(`WS auth guard: closed ${closed} socket(s) for account ${target} (${event.event_type})`);
|
|
134
|
-
}
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
default:
|
|
138
|
-
throw new UnreachableError(scope);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transports_ws_backend.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports_ws_backend.ts"],"names":[],"mappings":"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"}
|
package/dist/cli/args.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared CLI argument parsing utilities.
|
|
3
|
-
*
|
|
4
|
-
* Provides `parse_command_args` for schema-validated command parsing and
|
|
5
|
-
* `create_extract_global_flags` as a factory for project-specific global flag extraction.
|
|
6
|
-
*
|
|
7
|
-
* Both take `@fuzdev/fuz_schema` object schemas, the schemas `args_parse` from
|
|
8
|
-
* `@fuzdev/fuz_util/args.ts` reads, with aliases given by `meta(entry, {aliases})`.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
import { type ParsedArgs } from '@fuzdev/fuz_util/args.ts';
|
|
13
|
-
import { type Schema } from '@fuzdev/fuz_schema/schema.ts';
|
|
14
|
-
/**
|
|
15
|
-
* Discriminated union result for CLI argument parsing.
|
|
16
|
-
*/
|
|
17
|
-
export type ParseCommandArgsResult<T> = {
|
|
18
|
-
ok: true;
|
|
19
|
-
value: T;
|
|
20
|
-
} | {
|
|
21
|
-
ok: false;
|
|
22
|
-
error: string;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Parse command-specific args against a fuz_schema object schema.
|
|
26
|
-
*
|
|
27
|
-
* Validates `remaining` args (after global flag extraction) with alias expansion
|
|
28
|
-
* and returns a typed result or an error string, each issue formatted by
|
|
29
|
-
* `format_issue` on a line of its own.
|
|
30
|
-
*
|
|
31
|
-
* @param remaining - remaining args after global flag extraction
|
|
32
|
-
* @param schema - fuz_schema object schema for the command
|
|
33
|
-
* @returns parse result with the typed value or an error message
|
|
34
|
-
*/
|
|
35
|
-
export declare const parse_command_args: <T extends Record<string, unknown>>(remaining: ParsedArgs, schema: Schema<T, any>) => ParseCommandArgsResult<T>;
|
|
36
|
-
/**
|
|
37
|
-
* Create a project-specific global flag extractor.
|
|
38
|
-
*
|
|
39
|
-
* Returns a function that separates global flags from command-specific args.
|
|
40
|
-
* The schema defines which flags are global (with aliases via `meta(entry, {aliases})`,
|
|
41
|
-
* read on any wrapper layer of the entry), and the fallback provides defaults
|
|
42
|
-
* when parsing fails. Every entry is global, both of a `no-` pair like `color`
|
|
43
|
-
* and `no-color` included, so `--no-color`, which `argv_parse` reads as
|
|
44
|
-
* `color: false`, never lands in `remaining`. A `no-` pair and aliases resolve
|
|
45
|
-
* as `args_parse` resolves them.
|
|
46
|
-
*
|
|
47
|
-
* @param schema - fuz_schema object schema for global flags
|
|
48
|
-
* @param fallback - default values when parsing fails
|
|
49
|
-
* @returns extractor function `(unparsed) => {flags, remaining}`
|
|
50
|
-
*/
|
|
51
|
-
export declare const create_extract_global_flags: <T extends Record<string, unknown>>(schema: Schema<T, any>, fallback: T) => ((unparsed: ParsedArgs) => {
|
|
52
|
-
flags: T;
|
|
53
|
-
remaining: ParsedArgs;
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=args.d.ts.map
|
package/dist/cli/args.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAyB,KAAK,UAAU,EAAiB,MAAM,0BAA0B,CAAC;AACjG,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGzE;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,WAAW,UAAU,EACrB,QAAQ,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,KACpB,sBAAsB,CAAC,CAAC,CAM1B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5E,QAAQ,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,EACtB,UAAU,CAAC,KACT,CAAC,CAAC,QAAQ,EAAE,UAAU,KAAK;IAAE,KAAK,EAAE,CAAC,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,CA0ChE,CAAC"}
|
package/dist/cli/args.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared CLI argument parsing utilities.
|
|
3
|
-
*
|
|
4
|
-
* Provides `parse_command_args` for schema-validated command parsing and
|
|
5
|
-
* `create_extract_global_flags` as a factory for project-specific global flag extraction.
|
|
6
|
-
*
|
|
7
|
-
* Both take `@fuzdev/fuz_schema` object schemas, the schemas `args_parse` from
|
|
8
|
-
* `@fuzdev/fuz_util/args.ts` reads, with aliases given by `meta(entry, {aliases})`.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
import { args_parse } from '@fuzdev/fuz_util/args.ts';
|
|
13
|
-
import { format_issue } from '@fuzdev/fuz_schema/schema.ts';
|
|
14
|
-
import { get_schema_entries, get_schema_meta } from '@fuzdev/fuz_schema/introspect.ts';
|
|
15
|
-
/**
|
|
16
|
-
* Parse command-specific args against a fuz_schema object schema.
|
|
17
|
-
*
|
|
18
|
-
* Validates `remaining` args (after global flag extraction) with alias expansion
|
|
19
|
-
* and returns a typed result or an error string, each issue formatted by
|
|
20
|
-
* `format_issue` on a line of its own.
|
|
21
|
-
*
|
|
22
|
-
* @param remaining - remaining args after global flag extraction
|
|
23
|
-
* @param schema - fuz_schema object schema for the command
|
|
24
|
-
* @returns parse result with the typed value or an error message
|
|
25
|
-
*/
|
|
26
|
-
export const parse_command_args = (remaining, schema) => {
|
|
27
|
-
const parsed = args_parse(remaining, schema);
|
|
28
|
-
if (!parsed.ok) {
|
|
29
|
-
return { ok: false, error: parsed.issues.map(format_issue).join('\n') };
|
|
30
|
-
}
|
|
31
|
-
return { ok: true, value: parsed.value };
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Create a project-specific global flag extractor.
|
|
35
|
-
*
|
|
36
|
-
* Returns a function that separates global flags from command-specific args.
|
|
37
|
-
* The schema defines which flags are global (with aliases via `meta(entry, {aliases})`,
|
|
38
|
-
* read on any wrapper layer of the entry), and the fallback provides defaults
|
|
39
|
-
* when parsing fails. Every entry is global, both of a `no-` pair like `color`
|
|
40
|
-
* and `no-color` included, so `--no-color`, which `argv_parse` reads as
|
|
41
|
-
* `color: false`, never lands in `remaining`. A `no-` pair and aliases resolve
|
|
42
|
-
* as `args_parse` resolves them.
|
|
43
|
-
*
|
|
44
|
-
* @param schema - fuz_schema object schema for global flags
|
|
45
|
-
* @param fallback - default values when parsing fails
|
|
46
|
-
* @returns extractor function `(unparsed) => {flags, remaining}`
|
|
47
|
-
*/
|
|
48
|
-
export const create_extract_global_flags = (schema, fallback) => {
|
|
49
|
-
return (unparsed) => {
|
|
50
|
-
// get all global flag names and aliases from schema, `input_names` with
|
|
51
|
-
// those of a `_` entry, which is read but never stripped from `remaining`
|
|
52
|
-
const global_props = to_global_props(schema);
|
|
53
|
-
const global_names = new Set();
|
|
54
|
-
const input_names = new Set();
|
|
55
|
-
for (const prop of global_props) {
|
|
56
|
-
input_names.add(prop.name);
|
|
57
|
-
for (const alias of prop.aliases)
|
|
58
|
-
input_names.add(alias);
|
|
59
|
-
if (prop.name === '_')
|
|
60
|
-
continue;
|
|
61
|
-
global_names.add(prop.name);
|
|
62
|
-
for (const alias of prop.aliases)
|
|
63
|
-
global_names.add(alias);
|
|
64
|
-
}
|
|
65
|
-
// copy the given global flags in the order they were given, aliases included,
|
|
66
|
-
// so `args_parse` expands aliases and resolves a `no-` pair given both ways
|
|
67
|
-
// to the side given last; a null prototype keeps every key an own key
|
|
68
|
-
const flags_input = Object.create(null);
|
|
69
|
-
for (const [key, value] of Object.entries(unparsed)) {
|
|
70
|
-
if (input_names.has(key))
|
|
71
|
-
flags_input[key] = value;
|
|
72
|
-
}
|
|
73
|
-
// parse global flags
|
|
74
|
-
const global_parsed = args_parse(flags_input, schema);
|
|
75
|
-
const flags = global_parsed.ok ? global_parsed.value : fallback;
|
|
76
|
-
// build remaining args without global flags, `__proto__` as an own key
|
|
77
|
-
const remaining = Object.create(null);
|
|
78
|
-
remaining._ = [...unparsed._];
|
|
79
|
-
for (const [key, value] of Object.entries(unparsed)) {
|
|
80
|
-
if (key === '_')
|
|
81
|
-
continue;
|
|
82
|
-
if (global_names.has(key))
|
|
83
|
-
continue;
|
|
84
|
-
remaining[key] = value;
|
|
85
|
-
}
|
|
86
|
-
Object.setPrototypeOf(remaining, Object.prototype);
|
|
87
|
-
return { flags, remaining };
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
// each entry of an object schema with its aliases, a `no-` pair as two entries
|
|
91
|
-
const to_global_props = (schema) => {
|
|
92
|
-
const entries = get_schema_entries(schema);
|
|
93
|
-
if (!entries)
|
|
94
|
-
return [];
|
|
95
|
-
const props = [];
|
|
96
|
-
for (const name in entries) {
|
|
97
|
-
props.push({ name, aliases: get_schema_meta(entries[name], 'aliases') ?? [] });
|
|
98
|
-
}
|
|
99
|
-
return props;
|
|
100
|
-
};
|