@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
package/dist/cli/help.js
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema-driven CLI help generator.
|
|
3
|
-
*
|
|
4
|
-
* Generalized from the identical pattern in tx and zzz. Consumers configure
|
|
5
|
-
* once with `create_help` and get back `generate_main_help`,
|
|
6
|
-
* `generate_command_help`, and `get_help_text`.
|
|
7
|
-
*
|
|
8
|
-
* Schemas are `@fuzdev/fuz_schema` object schemas, the ones `parse_command_args`
|
|
9
|
-
* and `create_extract_global_flags` take, read with fuz_schema's `introspect.ts`:
|
|
10
|
-
* each entry's `description` and `aliases` metadata, its default, and its type
|
|
11
|
-
* as `format_schema_type` renders it.
|
|
12
|
-
*
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
import { format_schema_type, get_schema_fields, get_schema_meta } from '@fuzdev/fuz_schema/introspect.ts';
|
|
16
|
-
import { colors } from './util.js';
|
|
17
|
-
/**
|
|
18
|
-
* Read the args of an object schema for help output, in order.
|
|
19
|
-
*
|
|
20
|
-
* An entry whose `no-` negation is also an entry is left out, so a pair like
|
|
21
|
-
* `color` and `no-color` is shown once, as `--no-color`.
|
|
22
|
-
*
|
|
23
|
-
* @param schema - fuz_schema object schema
|
|
24
|
-
* @returns the args, none when `schema` is not an object schema
|
|
25
|
-
*/
|
|
26
|
-
export const to_help_arg_properties = (schema) => {
|
|
27
|
-
const fields = get_schema_fields(schema);
|
|
28
|
-
const names = new Set(fields.map((f) => f.name));
|
|
29
|
-
const properties = [];
|
|
30
|
-
for (const field of fields) {
|
|
31
|
-
if (names.has('no-' + field.name))
|
|
32
|
-
continue;
|
|
33
|
-
properties.push({
|
|
34
|
-
name: field.name,
|
|
35
|
-
type: format_schema_type(field.schema),
|
|
36
|
-
description: field.description ?? '',
|
|
37
|
-
default: to_field_default(field),
|
|
38
|
-
aliases: get_schema_meta(field.schema, 'aliases') ?? []
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return properties;
|
|
42
|
-
};
|
|
43
|
-
// the default a field's help shows: a `with_default_fn`'s is made by calling its `make`,
|
|
44
|
-
// as each parse that fills the key in does, found by walking the layers `get_schema_fields`
|
|
45
|
-
// reads, whose first `optional` or default it is when `default_computed`
|
|
46
|
-
const to_field_default = (field) => {
|
|
47
|
-
if (!field.default_computed)
|
|
48
|
-
return field.default;
|
|
49
|
-
let layer = field.schema;
|
|
50
|
-
for (;;) {
|
|
51
|
-
switch (layer.kind) {
|
|
52
|
-
case 'with_default_fn':
|
|
53
|
-
return layer.def.make();
|
|
54
|
-
case 'optional':
|
|
55
|
-
case 'nullable':
|
|
56
|
-
case 'with_default':
|
|
57
|
-
layer = layer.def.schema;
|
|
58
|
-
break;
|
|
59
|
-
case 'pipe':
|
|
60
|
-
layer = layer.def[0];
|
|
61
|
-
break;
|
|
62
|
-
case 'lazy':
|
|
63
|
-
layer = layer.def();
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Format a default value for display, `''` for none.
|
|
72
|
-
*
|
|
73
|
-
* Strings and arrays are written as JSON, as the type column writes a string literal.
|
|
74
|
-
*
|
|
75
|
-
* @param value - the default
|
|
76
|
-
* @returns display text
|
|
77
|
-
*/
|
|
78
|
-
export const format_arg_default = (value) => {
|
|
79
|
-
if (value === undefined)
|
|
80
|
-
return '';
|
|
81
|
-
if (value === null)
|
|
82
|
-
return 'null';
|
|
83
|
-
if (typeof value === 'string' || typeof value === 'object')
|
|
84
|
-
return JSON.stringify(value);
|
|
85
|
-
if (typeof value === 'boolean' || typeof value === 'number')
|
|
86
|
-
return String(value);
|
|
87
|
-
return '';
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Get maximum length from array.
|
|
91
|
-
*
|
|
92
|
-
* @param items - array of items
|
|
93
|
-
* @param to_string - function to convert item to string for length measurement
|
|
94
|
-
* @returns maximum string length
|
|
95
|
-
*/
|
|
96
|
-
export const to_max_length = (items, to_string) => items.reduce((max, item) => Math.max(to_string(item).length, max), 0);
|
|
97
|
-
/**
|
|
98
|
-
* Format argument name with short aliases for display.
|
|
99
|
-
*
|
|
100
|
-
* Only single-char aliases are shown (e.g., `-h, --help`).
|
|
101
|
-
* Flags use snake_case (e.g., `--env_file`, `--detect_only`).
|
|
102
|
-
*
|
|
103
|
-
* @param prop - schema property
|
|
104
|
-
* @returns formatted name string
|
|
105
|
-
*/
|
|
106
|
-
export const format_arg_name = (prop) => {
|
|
107
|
-
if (prop.name === '_') {
|
|
108
|
-
return '[...args]';
|
|
109
|
-
}
|
|
110
|
-
let name = `--${prop.name}`;
|
|
111
|
-
const short_aliases = prop.aliases.filter((a) => a.length === 1);
|
|
112
|
-
if (short_aliases.length > 0) {
|
|
113
|
-
const alias_str = short_aliases.map((a) => `-${a}`).join(', ');
|
|
114
|
-
name = `${alias_str}, ${name}`;
|
|
115
|
-
}
|
|
116
|
-
return name;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Create a help generator configured for an application.
|
|
120
|
-
*
|
|
121
|
-
* @param options - help configuration
|
|
122
|
-
* @returns help generator with `generate_main_help`, `generate_command_help`, and `get_help_text`
|
|
123
|
-
*/
|
|
124
|
-
export const create_help = (options) => {
|
|
125
|
-
const use_colors = options.use_colors !== false;
|
|
126
|
-
const c = use_colors
|
|
127
|
-
? colors
|
|
128
|
-
: { green: '', yellow: '', blue: '', red: '', cyan: '', dim: '', bold: '', reset: '' };
|
|
129
|
-
const generate_global_options = () => {
|
|
130
|
-
const properties = to_help_arg_properties(options.global_args_schema);
|
|
131
|
-
const max_width = to_max_length(properties, (p) => ` ${format_arg_name(p)}`);
|
|
132
|
-
return properties.map((prop) => {
|
|
133
|
-
const name = format_arg_name(prop);
|
|
134
|
-
const desc = prop.description || '';
|
|
135
|
-
return ` ${name}`.padEnd(max_width + 2) + desc;
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
const generate_command_help = (command, meta) => {
|
|
139
|
-
const lines = [];
|
|
140
|
-
lines.push(`${c.cyan}${options.name} ${command}${c.reset}: ${meta.summary}`);
|
|
141
|
-
lines.push('');
|
|
142
|
-
lines.push(`${c.yellow}Usage${c.reset}: ${meta.usage}`);
|
|
143
|
-
lines.push('');
|
|
144
|
-
if (meta.schema) {
|
|
145
|
-
const properties = to_help_arg_properties(meta.schema);
|
|
146
|
-
const flag_props = properties.filter((p) => p.name !== '_');
|
|
147
|
-
const positional_prop = properties.find((p) => p.name === '_');
|
|
148
|
-
if (positional_prop?.description) {
|
|
149
|
-
lines.push(`Positional: ${positional_prop.description}`);
|
|
150
|
-
lines.push('');
|
|
151
|
-
}
|
|
152
|
-
if (flag_props.length > 0) {
|
|
153
|
-
lines.push(`${c.yellow}Options${c.reset}:`);
|
|
154
|
-
const longest_name = to_max_length(flag_props, format_arg_name);
|
|
155
|
-
const longest_type = to_max_length(flag_props, (p) => p.type);
|
|
156
|
-
for (const prop of flag_props) {
|
|
157
|
-
const name = format_arg_name(prop).padEnd(longest_name);
|
|
158
|
-
const type = prop.type.padEnd(longest_type);
|
|
159
|
-
const def = format_arg_default(prop.default);
|
|
160
|
-
const desc = prop.description || '';
|
|
161
|
-
const default_str = def ? ` (default: ${def})` : '';
|
|
162
|
-
lines.push(` ${name} ${type} ${desc}${default_str}`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// global options
|
|
167
|
-
lines.push('');
|
|
168
|
-
lines.push(`${c.yellow}Global Options${c.reset}:`);
|
|
169
|
-
for (const opt_line of generate_global_options()) {
|
|
170
|
-
lines.push(opt_line);
|
|
171
|
-
}
|
|
172
|
-
return lines.join('\n');
|
|
173
|
-
};
|
|
174
|
-
const generate_main_help = () => {
|
|
175
|
-
const lines = [];
|
|
176
|
-
lines.push(`${c.cyan}${options.name}${c.reset} v${options.version} - ${options.description}`);
|
|
177
|
-
lines.push('');
|
|
178
|
-
// categories with commands
|
|
179
|
-
for (const { key, title } of options.categories) {
|
|
180
|
-
const cat_commands = Object.entries(options.commands).filter(([_, meta]) => meta.category === key);
|
|
181
|
-
if (cat_commands.length === 0)
|
|
182
|
-
continue;
|
|
183
|
-
lines.push(`${c.yellow}${title}${c.reset}:`);
|
|
184
|
-
cat_commands.sort(([a], [b]) => a.localeCompare(b));
|
|
185
|
-
const max_usage_width = to_max_length(cat_commands, ([_, meta]) => ` ${meta.usage}`);
|
|
186
|
-
for (const [_, meta] of cat_commands) {
|
|
187
|
-
const padded = ` ${meta.usage}`.padEnd(Math.max(max_usage_width + 2, 40));
|
|
188
|
-
lines.push(`${padded}${meta.summary}`);
|
|
189
|
-
}
|
|
190
|
-
lines.push('');
|
|
191
|
-
}
|
|
192
|
-
// global options
|
|
193
|
-
lines.push(`${c.yellow}OPTIONS${c.reset}:`);
|
|
194
|
-
for (const opt_line of generate_global_options()) {
|
|
195
|
-
lines.push(opt_line);
|
|
196
|
-
}
|
|
197
|
-
lines.push('');
|
|
198
|
-
// examples
|
|
199
|
-
if (options.examples.length > 0) {
|
|
200
|
-
lines.push(`${c.yellow}EXAMPLES${c.reset}:`);
|
|
201
|
-
for (const example of options.examples) {
|
|
202
|
-
lines.push(` ${example}`);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return lines.join('\n');
|
|
206
|
-
};
|
|
207
|
-
const get_help_text = (command, subcommand) => {
|
|
208
|
-
const cmd_key = subcommand ? `${command} ${subcommand}` : command;
|
|
209
|
-
if (cmd_key && options.commands[cmd_key]) {
|
|
210
|
-
return generate_command_help(cmd_key, options.commands[cmd_key]);
|
|
211
|
-
}
|
|
212
|
-
return generate_main_help();
|
|
213
|
-
};
|
|
214
|
-
return { generate_main_help, generate_command_help, get_help_text };
|
|
215
|
-
};
|
package/dist/cli/logger.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI logger wrapping `Logger` with semantic output methods.
|
|
3
|
-
*
|
|
4
|
-
* Why wrapper, not subclass: Logger has variadic `...args` methods, CLI adds
|
|
5
|
-
* single-string semantic methods. Mixing calling conventions on one class is confusing.
|
|
6
|
-
* Composition keeps both APIs clean.
|
|
7
|
-
*
|
|
8
|
-
* Why Logger prefixes for error/warn: Unifies error/warn visual style across CLI
|
|
9
|
-
* and backend. CLI-specific methods (success/skip/step/header) add their own semantic
|
|
10
|
-
* prefixes via `logger.info()`.
|
|
11
|
-
*
|
|
12
|
-
* @module
|
|
13
|
-
*/
|
|
14
|
-
import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
15
|
-
export interface CliLogger {
|
|
16
|
-
/** Logs an error via Logger (gets Logger's error prefix). */
|
|
17
|
-
error: (...args: Array<unknown>) => void;
|
|
18
|
-
/** Logs a warning via Logger (gets Logger's warn prefix). */
|
|
19
|
-
warn: (...args: Array<unknown>) => void;
|
|
20
|
-
/** Logs info via Logger (gets Logger's label prefix). */
|
|
21
|
-
info: (...args: Array<unknown>) => void;
|
|
22
|
-
/** Logs debug via Logger (gets Logger's debug prefix). */
|
|
23
|
-
debug: (...args: Array<unknown>) => void;
|
|
24
|
-
/** Logs raw output via Logger (no prefix, no level filtering). */
|
|
25
|
-
raw: (...args: Array<unknown>) => void;
|
|
26
|
-
/** Logs a success message with `[done]` prefix at info level. */
|
|
27
|
-
success: (msg: string) => void;
|
|
28
|
-
/** Logs a skip message with `[skip]` prefix at info level. */
|
|
29
|
-
skip: (msg: string) => void;
|
|
30
|
-
/** Logs a step message with `==>` prefix at info level. */
|
|
31
|
-
step: (msg: string) => void;
|
|
32
|
-
/** Logs a header with `=== title ===` decoration at info level. */
|
|
33
|
-
header: (title: string) => void;
|
|
34
|
-
/** Logs a dimmed message at info level. */
|
|
35
|
-
dim: (msg: string) => void;
|
|
36
|
-
/** The underlying Logger instance. */
|
|
37
|
-
logger: Logger;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Creates a CLI logger wrapping a Logger with semantic output methods.
|
|
41
|
-
*
|
|
42
|
-
* @param logger - the Logger instance to wrap
|
|
43
|
-
* @returns a `CliLogger` with CLI semantic methods mapped to Logger levels
|
|
44
|
-
*/
|
|
45
|
-
export declare const create_cli_logger: (logger: Logger) => CliLogger;
|
|
46
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/dist/cli/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAKjD,MAAM,WAAW,SAAS;IACzB,6DAA6D;IAC7D,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACzC,6DAA6D;IAC7D,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACxC,yDAAyD;IACzD,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACxC,0DAA0D;IAC1D,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACzC,kEAAkE;IAClE,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAEvC,iEAAiE;IACjE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,2DAA2D;IAC3D,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,mEAAmE;IACnE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,2CAA2C;IAG3C,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAE3B,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,SA6BjD,CAAC"}
|
package/dist/cli/logger.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI logger wrapping `Logger` with semantic output methods.
|
|
3
|
-
*
|
|
4
|
-
* Why wrapper, not subclass: Logger has variadic `...args` methods, CLI adds
|
|
5
|
-
* single-string semantic methods. Mixing calling conventions on one class is confusing.
|
|
6
|
-
* Composition keeps both APIs clean.
|
|
7
|
-
*
|
|
8
|
-
* Why Logger prefixes for error/warn: Unifies error/warn visual style across CLI
|
|
9
|
-
* and backend. CLI-specific methods (success/skip/step/header) add their own semantic
|
|
10
|
-
* prefixes via `logger.info()`.
|
|
11
|
-
*
|
|
12
|
-
* @module
|
|
13
|
-
*/
|
|
14
|
-
import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
15
|
-
/**
|
|
16
|
-
* Creates a CLI logger wrapping a Logger with semantic output methods.
|
|
17
|
-
*
|
|
18
|
-
* @param logger - the Logger instance to wrap
|
|
19
|
-
* @returns a `CliLogger` with CLI semantic methods mapped to Logger levels
|
|
20
|
-
*/
|
|
21
|
-
export const create_cli_logger = (logger) => ({
|
|
22
|
-
error: (...args) => logger.error(...args),
|
|
23
|
-
warn: (...args) => logger.warn(...args),
|
|
24
|
-
info: (...args) => logger.info(...args),
|
|
25
|
-
debug: (...args) => logger.debug(...args),
|
|
26
|
-
raw: (...args) => logger.raw(...args),
|
|
27
|
-
success: (msg) => {
|
|
28
|
-
const c = logger.colors;
|
|
29
|
-
logger.info(c ? `\x1b[32m[done]\x1b[0m ${msg}` : `[done] ${msg}`);
|
|
30
|
-
},
|
|
31
|
-
skip: (msg) => {
|
|
32
|
-
const c = logger.colors;
|
|
33
|
-
logger.info(c ? `\x1b[33m[skip]\x1b[0m ${msg}` : `[skip] ${msg}`);
|
|
34
|
-
},
|
|
35
|
-
step: (msg) => {
|
|
36
|
-
const c = logger.colors;
|
|
37
|
-
logger.info(c ? `\n\x1b[36m==>\x1b[0m ${msg}` : `\n==> ${msg}`);
|
|
38
|
-
},
|
|
39
|
-
header: (title) => {
|
|
40
|
-
const c = logger.colors;
|
|
41
|
-
logger.info(c ? `\n\x1b[33m=== ${title} ===\x1b[0m\n` : `\n=== ${title} ===\n`);
|
|
42
|
-
},
|
|
43
|
-
dim: (msg) => {
|
|
44
|
-
const c = logger.colors;
|
|
45
|
-
logger.info(c ? `\x1b[2m${msg}\x1b[0m` : msg);
|
|
46
|
-
},
|
|
47
|
-
logger
|
|
48
|
-
});
|
package/dist/cli/util.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI utilities for colors, confirmation, and command delegation.
|
|
3
|
-
*
|
|
4
|
-
* For structured CLI logging, see `create_cli_logger` in `cli/logger.ts`.
|
|
5
|
-
*
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
import type { CommandDeps, CommandResult, TerminalDeps } from '../runtime/deps.js';
|
|
9
|
-
export declare const colors: {
|
|
10
|
-
readonly green: "" | "\u001B[32m";
|
|
11
|
-
readonly yellow: "" | "\u001B[33m";
|
|
12
|
-
readonly blue: "" | "\u001B[34m";
|
|
13
|
-
readonly red: "" | "\u001B[31m";
|
|
14
|
-
readonly cyan: "" | "\u001B[36m";
|
|
15
|
-
readonly dim: "" | "\u001B[2m";
|
|
16
|
-
readonly bold: "" | "\u001B[1m";
|
|
17
|
-
readonly reset: "" | "\u001B[0m";
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Run a local command and return the result.
|
|
21
|
-
*
|
|
22
|
-
* @param runtime - runtime with `run_command` capability
|
|
23
|
-
* @param command - command to run
|
|
24
|
-
* @param args - command arguments
|
|
25
|
-
* @returns command result
|
|
26
|
-
*/
|
|
27
|
-
export declare const run_local: (runtime: CommandDeps, command: string, args: Array<string>) => Promise<CommandResult>;
|
|
28
|
-
/**
|
|
29
|
-
* Prompt for yes/no confirmation.
|
|
30
|
-
*
|
|
31
|
-
* @param runtime - runtime with `stdout_write` and `stdin_read` capabilities
|
|
32
|
-
* @param message - message to display
|
|
33
|
-
* @returns `true` if user confirms, `false` otherwise
|
|
34
|
-
*/
|
|
35
|
-
export declare const confirm: (runtime: TerminalDeps, message: string) => Promise<boolean>;
|
|
36
|
-
//# sourceMappingURL=util.d.ts.map
|
package/dist/cli/util.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/util.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQnF,eAAO,MAAM,MAAM;;;;;;;;;CAST,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GACrB,SAAS,WAAW,EACpB,SAAS,MAAM,EACf,MAAM,KAAK,CAAC,MAAM,CAAC,KACjB,OAAO,CAAC,aAAa,CAEvB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAU,SAAS,YAAY,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,OAAO,CAYrF,CAAC"}
|
package/dist/cli/util.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI utilities for colors, confirmation, and command delegation.
|
|
3
|
-
*
|
|
4
|
-
* For structured CLI logging, see `create_cli_logger` in `cli/logger.ts`.
|
|
5
|
-
*
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
// TODO: `colors` duplicates the NO_COLOR detection Logger does internally.
|
|
9
|
-
// Long-term, converge with Logger's color system or expose a shared color helper.
|
|
10
|
-
const no_color = typeof process !== 'undefined' &&
|
|
11
|
-
(process.env.NO_COLOR !== undefined || process.env.CLAUDECODE !== undefined);
|
|
12
|
-
export const colors = {
|
|
13
|
-
green: no_color ? '' : '\x1b[32m',
|
|
14
|
-
yellow: no_color ? '' : '\x1b[33m',
|
|
15
|
-
blue: no_color ? '' : '\x1b[34m',
|
|
16
|
-
red: no_color ? '' : '\x1b[31m',
|
|
17
|
-
cyan: no_color ? '' : '\x1b[36m',
|
|
18
|
-
dim: no_color ? '' : '\x1b[2m',
|
|
19
|
-
bold: no_color ? '' : '\x1b[1m',
|
|
20
|
-
reset: no_color ? '' : '\x1b[0m'
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Run a local command and return the result.
|
|
24
|
-
*
|
|
25
|
-
* @param runtime - runtime with `run_command` capability
|
|
26
|
-
* @param command - command to run
|
|
27
|
-
* @param args - command arguments
|
|
28
|
-
* @returns command result
|
|
29
|
-
*/
|
|
30
|
-
export const run_local = async (runtime, command, args) => {
|
|
31
|
-
return runtime.run_command(command, args);
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Prompt for yes/no confirmation.
|
|
35
|
-
*
|
|
36
|
-
* @param runtime - runtime with `stdout_write` and `stdin_read` capabilities
|
|
37
|
-
* @param message - message to display
|
|
38
|
-
* @returns `true` if user confirms, `false` otherwise
|
|
39
|
-
*/
|
|
40
|
-
export const confirm = async (runtime, message) => {
|
|
41
|
-
const encoder = new TextEncoder();
|
|
42
|
-
const decoder = new TextDecoder();
|
|
43
|
-
await runtime.stdout_write(encoder.encode(`${message} [y/N] `));
|
|
44
|
-
const buf = new Uint8Array(1024);
|
|
45
|
-
const n = await runtime.stdin_read(buf);
|
|
46
|
-
if (n === null)
|
|
47
|
-
return false;
|
|
48
|
-
const input = decoder.decode(buf.subarray(0, n)).trim().toLowerCase();
|
|
49
|
-
return input === 'y' || input === 'yes';
|
|
50
|
-
};
|
|
@@ -1,197 +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 type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
23
|
-
import { type AuditLogEvent } from '../auth/audit_log_schema.js';
|
|
24
|
-
import type { ConnectionCloser, RealtimeCloser } from '../actions/connection_closer.js';
|
|
25
|
-
import { SubscriberRegistry } from './subscriber_registry.js';
|
|
26
|
-
import type { SseNotification, EventSpec } from './sse.js';
|
|
27
|
-
/** SSE channel the audit-log stream route publishes on. */
|
|
28
|
-
export declare const AUDIT_LOG_CHANNEL = "audit_log";
|
|
29
|
-
/**
|
|
30
|
-
* Adapt a `SubscriberRegistry` to `ConnectionCloser`, so a revocation handler's
|
|
31
|
-
* close reaches its streams.
|
|
32
|
-
*
|
|
33
|
-
* Each method is `SubscriberRegistry.close_by_identity` on the id it is given,
|
|
34
|
-
* so it closes the streams registered under that id as their `scope` or in
|
|
35
|
-
* their `groups` — pending registrations included. The audit stream route
|
|
36
|
-
* registers `scope = session hash` and `groups = [account id]`; a route that
|
|
37
|
-
* admits bearer tokens registers the API token id too, and
|
|
38
|
-
* `close_sockets_for_token` then reaches it. `close_sockets_for_role` closes
|
|
39
|
-
* the account's streams when `role` is the one the registry's streams are
|
|
40
|
-
* gated on — the registry keeps one gating role for all its streams, not one
|
|
41
|
-
* per stream. `close_all_sockets` is `SubscriberRegistry.close_all` — every
|
|
42
|
-
* stream, for shutdown.
|
|
43
|
-
*
|
|
44
|
-
* Twin of the Rust spine's `SocketRevoker` impl on `SseRegistry`.
|
|
45
|
-
*
|
|
46
|
-
* @param registry - the registry to close streams on
|
|
47
|
-
* @param required_role - the role every stream of `registry` was gated on,
|
|
48
|
-
* or `null` when they are not role-gated (`close_sockets_for_role` then
|
|
49
|
-
* closes nothing)
|
|
50
|
-
*/
|
|
51
|
-
export declare const create_sse_connection_closer: <T>(registry: SubscriberRegistry<T>, required_role: string | null) => ConnectionCloser;
|
|
52
|
-
/**
|
|
53
|
-
* Create an audit event handler that closes SSE streams on a successful
|
|
54
|
-
* revocation row, dispatching on the event's `RevocationScope`
|
|
55
|
-
* (`audit_event_revocation_scopes`, the table `create_ws_auth_guard` reads
|
|
56
|
-
* too):
|
|
57
|
-
*
|
|
58
|
-
* - `session` → the stream registered under the revoked session's hash
|
|
59
|
-
* (`metadata.session_id`). Closing all of an account's streams for a
|
|
60
|
-
* single-session revoke would be over-aggressive.
|
|
61
|
-
* - `token` → the stream registered under the revoked API token's id
|
|
62
|
-
* (`metadata.token_id`). The audit stream route admits sessions only, so no
|
|
63
|
-
* stream of its own is keyed that way; a consumer route that admits bearers
|
|
64
|
-
* registers the token id and is closed here.
|
|
65
|
-
* - `account` → every stream of `target_account_id ?? account_id`.
|
|
66
|
-
* - `role` → every stream of the target account, when the revoked role
|
|
67
|
-
* (`metadata.role`) is `required_role` and the revoked grant was global
|
|
68
|
-
* (`to_global_role_revocation`): the stream's role gate admits on global
|
|
69
|
-
* grants only, so revoking a scoped grant of the same role takes away
|
|
70
|
-
* nothing it admitted on. A stream is authorized once at open and has no
|
|
71
|
-
* later check; the WebSocket guard closes its role-gated sockets on the
|
|
72
|
-
* same rows.
|
|
73
|
-
* - `none` → nothing.
|
|
74
|
-
*
|
|
75
|
-
* Over-closing a one-way feed is cheap: the client reconnects if it is still
|
|
76
|
-
* authorized.
|
|
77
|
-
*
|
|
78
|
-
* The registry's subscribers must carry `account_id` as an identity key (in
|
|
79
|
-
* `SubscribeOptions.groups`), and the session hash as `scope` for the
|
|
80
|
-
* session-scoped close.
|
|
81
|
-
*
|
|
82
|
-
* @param registry - the subscriber registry to guard
|
|
83
|
-
* @param required_role - the role that grants access to the SSE endpoint,
|
|
84
|
-
* or `null` to skip `role_grant_revoke` handling entirely (for streams not gated
|
|
85
|
-
* by a specific role_grant)
|
|
86
|
-
* @param log - logger for disconnect events
|
|
87
|
-
* @returns an `on_audit_event` callback
|
|
88
|
-
*/
|
|
89
|
-
export declare const create_sse_auth_guard: <T>(registry: SubscriberRegistry<T>, required_role: string | null, log: Logger) => ((event: AuditLogEvent) => void);
|
|
90
|
-
/**
|
|
91
|
-
* Convenience factory result for audit log SSE.
|
|
92
|
-
*
|
|
93
|
-
* Satisfies `AuditLogRouteOptions['stream']` and provides the combined
|
|
94
|
-
* `on_audit_event` callback (broadcast + guard).
|
|
95
|
-
*/
|
|
96
|
-
export interface AuditLogSse {
|
|
97
|
-
/**
|
|
98
|
-
* The subscriber registry the audit stream route registers each stream on
|
|
99
|
-
* (two-phase: `subscribe_pending` then `admit`) — pass as part of the
|
|
100
|
-
* `stream` option to `create_audit_log_route_specs`. Also exposed for
|
|
101
|
-
* subscriber count monitoring.
|
|
102
|
-
*/
|
|
103
|
-
registry: SubscriberRegistry<SseNotification>;
|
|
104
|
-
/** Logger — pass as part of `stream` option to `create_audit_log_route_specs`. */
|
|
105
|
-
log: Logger;
|
|
106
|
-
/** Combined broadcast + guard callback. Wired by `create_app_server`'s `audit_log_sse` option, or compose inside the consumer's `audit_factory` body. */
|
|
107
|
-
on_audit_event: (event: AuditLogEvent) => void;
|
|
108
|
-
/**
|
|
109
|
-
* The role the stream requires — what a caller adapting `registry` passes
|
|
110
|
-
* `create_sse_connection_closer`, so its role close matches the guard's.
|
|
111
|
-
*/
|
|
112
|
-
required_role: string;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* SSE event specs for audit log events.
|
|
116
|
-
*
|
|
117
|
-
* One spec per `AUDIT_EVENT_TYPES` entry, all sharing the `AuditLogEventJson` params schema.
|
|
118
|
-
* Pass to `create_app_server`'s `event_specs` for surface generation and DEV validation.
|
|
119
|
-
*/
|
|
120
|
-
export declare const audit_log_event_specs: Array<EventSpec>;
|
|
121
|
-
/**
|
|
122
|
-
* Default max concurrent SSE subscribers per session scope for the audit log.
|
|
123
|
-
*
|
|
124
|
-
* The audit log SSE subscribes with `scope = session_hash` and
|
|
125
|
-
* `groups = [account_id]`. Only `scope` is capped — so this limits tabs
|
|
126
|
-
* per session. An account's total streams across all sessions is bounded
|
|
127
|
-
* transitively by `max_sessions × AUDIT_LOG_SSE_MAX_PER_SCOPE`. 10 tabs
|
|
128
|
-
* per session is a comfortable ceiling for normal use; consumers raising
|
|
129
|
-
* it above ~50 should consider server-side connection limits.
|
|
130
|
-
*/
|
|
131
|
-
export declare const AUDIT_LOG_SSE_MAX_PER_SCOPE = 10;
|
|
132
|
-
/**
|
|
133
|
-
* Create a complete audit log SSE setup with broadcasting, auth guard, and
|
|
134
|
-
* connection closer.
|
|
135
|
-
*
|
|
136
|
-
* Combines `SubscriberRegistry`, `create_sse_auth_guard`, and the broadcast
|
|
137
|
-
* call into a single object, and adds the registry to `connection_closer` for
|
|
138
|
-
* good — the remover `add` returns is dropped, so a caller that must take the
|
|
139
|
-
* registry out again passes `null` and adds it itself.
|
|
140
|
-
* The result satisfies `AuditLogRouteOptions['stream']`
|
|
141
|
-
* and provides the `on_audit_event` listener for the audit emitter.
|
|
142
|
-
*
|
|
143
|
-
* Most consumers pass `audit_log_sse: true` to `create_app_server` and never
|
|
144
|
-
* touch this directly — the factory builds an `AuditLogSse`, registers
|
|
145
|
-
* `audit_sse.on_audit_event` via `backend.deps.audit.add_listener`, and
|
|
146
|
-
* exposes it via `AppServerContext.audit_sse`. Reach for the manual path
|
|
147
|
-
* (compose inside `audit_factory` body, or
|
|
148
|
-
* `audit.add_listener(audit_sse.on_audit_event)` post-assembly) only
|
|
149
|
-
* when wiring outside `create_app_server`.
|
|
150
|
-
*
|
|
151
|
-
* @param options - factory options
|
|
152
|
-
* @returns audit log SSE setup (stream options + `on_audit_event` + registry)
|
|
153
|
-
*
|
|
154
|
-
* @example
|
|
155
|
-
* ```ts
|
|
156
|
-
* const connection_closer = create_realtime_closer();
|
|
157
|
-
* const audit_sse = create_audit_log_sse({log, connection_closer});
|
|
158
|
-
*
|
|
159
|
-
* // On CreateAppBackendOptions — the same closer, and the listener inside
|
|
160
|
-
* // the audit_factory body:
|
|
161
|
-
* connection_closer,
|
|
162
|
-
* audit_factory: ({db, log}) => create_audit_emitter({
|
|
163
|
-
* db,
|
|
164
|
-
* log,
|
|
165
|
-
* on_audit_event: audit_sse.on_audit_event,
|
|
166
|
-
* }),
|
|
167
|
-
*
|
|
168
|
-
* // In create_route_specs:
|
|
169
|
-
* create_audit_log_route_specs({stream: audit_sse});
|
|
170
|
-
*
|
|
171
|
-
* // In create_app_server options:
|
|
172
|
-
* event_specs: audit_log_event_specs,
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
175
|
-
export declare const create_audit_log_sse: (options: {
|
|
176
|
-
/** Role required to access the SSE endpoint. Default `'admin'`. */
|
|
177
|
-
role?: string;
|
|
178
|
-
log: Logger;
|
|
179
|
-
/**
|
|
180
|
-
* The backend's closer — `deps.connection_closer`. The new registry is
|
|
181
|
-
* added to it, so every revocation handler's close reaches these streams.
|
|
182
|
-
* Required so it can't be forgotten: without it a revoked credential's
|
|
183
|
-
* streams close only through the audit listener, which a failed audit write
|
|
184
|
-
* or a cap eviction never reaches. Pass `null` only for a registry no
|
|
185
|
-
* revocation has to reach (tests of the registry itself), or when the
|
|
186
|
-
* caller adds `create_sse_connection_closer(registry)` itself — as
|
|
187
|
-
* `create_app_server` does, to hold the remover `add` returns.
|
|
188
|
-
*/
|
|
189
|
-
connection_closer: RealtimeCloser | null;
|
|
190
|
-
/**
|
|
191
|
-
* Max concurrent SSE subscribers per session scope. On overflow, the oldest
|
|
192
|
-
* matching subscriber is closed. Default `AUDIT_LOG_SSE_MAX_PER_SCOPE`.
|
|
193
|
-
* Pass `null` to disable the cap.
|
|
194
|
-
*/
|
|
195
|
-
max_per_scope?: number | null;
|
|
196
|
-
}) => AuditLogSse;
|
|
197
|
-
//# sourceMappingURL=sse_auth_guard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sse_auth_guard.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/sse_auth_guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAKN,KAAK,aAAa,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE3D,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,4BAA4B,GAAI,CAAC,EAC7C,UAAU,kBAAkB,CAAC,CAAC,CAAC,EAC/B,eAAe,MAAM,GAAG,IAAI,KAC1B,gBAOD,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EACtC,UAAU,kBAAkB,CAAC,CAAC,CAAC,EAC/B,eAAe,MAAM,GAAG,IAAI,EAC5B,KAAK,MAAM,KACT,CAAC,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAoEjC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B;;;;;OAKG;IACH,QAAQ,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC9C,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC;IACZ,yJAAyJ;IACzJ,cAAc,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,SAAS,CAOlD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS;IAC7C,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;OASG;IACH,iBAAiB,EAAE,cAAc,GAAG,IAAI,CAAC;IACzC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,KAAG,WAiBH,CAAC"}
|