@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/dist/realtime/sse.js
CHANGED
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
* between. The twin of the Rust spine's `fuz_realtime` SSE bound — the same
|
|
21
21
|
* budget and charge.
|
|
22
22
|
*
|
|
23
|
+
* ## Keep-alive
|
|
24
|
+
*
|
|
25
|
+
* Every `SSE_KEEP_ALIVE_INTERVAL_MS` an open stream writes
|
|
26
|
+
* `SSE_KEEP_ALIVE_COMMENT`, so a proxy's idle read timeout never cuts a quiet
|
|
27
|
+
* stream. The comment is a frame like any other — held to the same budget, so
|
|
28
|
+
* a client that stopped reading ends its stream on a keep-alive as on data —
|
|
29
|
+
* and the timer stops when the stream closes. `keep_alive_ms: null` turns it off.
|
|
30
|
+
*
|
|
23
31
|
* @module
|
|
24
32
|
*/
|
|
25
33
|
import { streamSSE } from 'hono/streaming';
|
|
@@ -27,7 +35,7 @@ import { z } from 'zod';
|
|
|
27
35
|
import { DEV } from 'esm-env';
|
|
28
36
|
import { utf8_length } from '../actions/transports.js';
|
|
29
37
|
import { OutboundBudget } from './outbound_budget.js';
|
|
30
|
-
import { SSE_CONNECTED_COMMENT, SSE_OUTBOUND_QUEUE_BYTES } from './sse_constants.js';
|
|
38
|
+
import { SSE_CONNECTED_COMMENT, SSE_KEEP_ALIVE_COMMENT, SSE_KEEP_ALIVE_INTERVAL_MS, SSE_OUTBOUND_QUEUE_BYTES, validate_sse_keep_alive_ms } from './sse_constants.js';
|
|
31
39
|
const is_node_connection_stream = (value) => {
|
|
32
40
|
if (typeof value !== 'object' || value === null)
|
|
33
41
|
return false;
|
|
@@ -88,7 +96,7 @@ const watch_client_disconnect = (c, on_gone) => {
|
|
|
88
96
|
* Create an SSE response for a Hono context.
|
|
89
97
|
*
|
|
90
98
|
* Wraps Hono's `streamSSE` to provide a `{response, stream}` API
|
|
91
|
-
* compatible with `
|
|
99
|
+
* compatible with `SseRegistry` push-based broadcasting.
|
|
92
100
|
* The callback suspends via a promise that resolves on client disconnect
|
|
93
101
|
* or explicit `close()`, keeping the stream alive for external sends.
|
|
94
102
|
*
|
|
@@ -97,7 +105,7 @@ const watch_client_disconnect = (c, on_gone) => {
|
|
|
97
105
|
* cancelling the body. A client already gone when this is called yields a
|
|
98
106
|
* stream that is already closed, so register cleanup with `on_close` (which
|
|
99
107
|
* runs a late listener at once) before handing the stream anywhere that would
|
|
100
|
-
* count it — `
|
|
108
|
+
* count it — `SseRegistry.admit` after `on_close(pending.unsubscribe)`
|
|
101
109
|
* refuses it.
|
|
102
110
|
*
|
|
103
111
|
* Uses `hono_stream.write()` directly (not `writeSSE`) to avoid
|
|
@@ -108,17 +116,25 @@ const watch_client_disconnect = (c, on_gone) => {
|
|
|
108
116
|
*
|
|
109
117
|
* @param log - logger for serialization and `on_close` listener errors, and
|
|
110
118
|
* for the warning when the stream ends on its outbound budget
|
|
111
|
-
* @param options - what the overflow warning names
|
|
119
|
+
* @param options - what the overflow warning names, and the keep-alive interval
|
|
112
120
|
* @returns object with the streaming `Response` and an `SseStream` controller
|
|
121
|
+
* @throws Error when `options.keep_alive_ms` is out of range
|
|
122
|
+
* (`validate_sse_keep_alive_ms`)
|
|
113
123
|
*/
|
|
114
124
|
export const create_sse_response = (c, log, options) => {
|
|
125
|
+
validate_sse_keep_alive_ms(options?.keep_alive_ms);
|
|
115
126
|
const { promise, resolve } = Promise.withResolvers();
|
|
116
127
|
const close_listeners = [];
|
|
117
128
|
let resolved = false;
|
|
129
|
+
let keep_alive_timer = null;
|
|
118
130
|
const do_close = () => {
|
|
119
131
|
if (resolved)
|
|
120
132
|
return;
|
|
121
133
|
resolved = true;
|
|
134
|
+
if (keep_alive_timer !== null) {
|
|
135
|
+
clearInterval(keep_alive_timer);
|
|
136
|
+
keep_alive_timer = null;
|
|
137
|
+
}
|
|
122
138
|
resolve();
|
|
123
139
|
for (const fn of close_listeners) {
|
|
124
140
|
try {
|
|
@@ -173,11 +189,6 @@ export const create_sse_response = (c, log, options) => {
|
|
|
173
189
|
}
|
|
174
190
|
write(frame);
|
|
175
191
|
},
|
|
176
|
-
comment(text) {
|
|
177
|
-
if (resolved || hono_stream.aborted)
|
|
178
|
-
return;
|
|
179
|
-
write(`: ${text}\n`);
|
|
180
|
-
},
|
|
181
192
|
close: do_close,
|
|
182
193
|
on_close(fn) {
|
|
183
194
|
if (!resolved) {
|
|
@@ -196,6 +207,18 @@ export const create_sse_response = (c, log, options) => {
|
|
|
196
207
|
// flush an SSE comment to push headers through proxies (Vite, nginx),
|
|
197
208
|
// ensuring EventSource fires onopen without waiting for the first data event
|
|
198
209
|
write(SSE_CONNECTED_COMMENT);
|
|
210
|
+
const keep_alive_ms = options?.keep_alive_ms === undefined ? SSE_KEEP_ALIVE_INTERVAL_MS : options.keep_alive_ms;
|
|
211
|
+
// a client that left before this ran has closed the stream already
|
|
212
|
+
if (keep_alive_ms !== null && !resolved) {
|
|
213
|
+
keep_alive_timer = setInterval(() => {
|
|
214
|
+
if (resolved || hono_stream.aborted)
|
|
215
|
+
return;
|
|
216
|
+
write(SSE_KEEP_ALIVE_COMMENT);
|
|
217
|
+
}, keep_alive_ms);
|
|
218
|
+
// a stream left open never holds the process alive on its own
|
|
219
|
+
if (typeof keep_alive_timer === 'object')
|
|
220
|
+
keep_alive_timer.unref?.();
|
|
221
|
+
}
|
|
199
222
|
await promise;
|
|
200
223
|
});
|
|
201
224
|
// after the callback above has built `sse_stream`, which runs synchronously
|
|
@@ -209,7 +232,7 @@ export const create_sse_response = (c, log, options) => {
|
|
|
209
232
|
* In DEV: warns on unknown methods and invalid params.
|
|
210
233
|
* In production: passes through with zero overhead.
|
|
211
234
|
*
|
|
212
|
-
* @param broadcaster - duck-typed broadcaster (e.g. `
|
|
235
|
+
* @param broadcaster - duck-typed broadcaster (e.g. `SseRegistry`)
|
|
213
236
|
* @param event_specs - event specs to validate against
|
|
214
237
|
* @param log - logger used to emit DEV warnings on unknown methods or param mismatches
|
|
215
238
|
* @returns validated broadcaster wrapper (passthrough in production)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hono-free SSE wire constants.
|
|
2
|
+
* Hono-free SSE wire constants, and the keep-alive interval's check.
|
|
3
3
|
*
|
|
4
4
|
* Split from `sse.ts` (which pulls `hono/streaming` via `streamSSE`) so the
|
|
5
5
|
* stream-framing constants are importable by cross-process test suites
|
|
@@ -14,12 +14,39 @@
|
|
|
14
14
|
* SSE tests assert the stream emits this on connect.
|
|
15
15
|
*/
|
|
16
16
|
export declare const SSE_CONNECTED_COMMENT = ": connected\n\n";
|
|
17
|
+
/**
|
|
18
|
+
* The comment line an idle SSE stream writes every
|
|
19
|
+
* `SSE_KEEP_ALIVE_INTERVAL_MS`, so a proxy that cuts a connection idle past
|
|
20
|
+
* its read timeout (nginx's default is 60 s) keeps an open stream open.
|
|
21
|
+
* `EventSource` ignores comments.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SSE_KEEP_ALIVE_COMMENT = ": keepalive\n\n";
|
|
24
|
+
/**
|
|
25
|
+
* How often an SSE stream writes `SSE_KEEP_ALIVE_COMMENT` — 15 s, a quarter of
|
|
26
|
+
* nginx's default 60 s read timeout. Per stream, from its open, whether or not
|
|
27
|
+
* data frames were written in between.
|
|
28
|
+
*/
|
|
29
|
+
export declare const SSE_KEEP_ALIVE_INTERVAL_MS = 15000;
|
|
30
|
+
/** The longest keep-alive interval a timer honors — 2³¹ − 1 ms, about 24.8 days. */
|
|
31
|
+
export declare const SSE_KEEP_ALIVE_INTERVAL_MS_MAX = 2147483647;
|
|
32
|
+
/**
|
|
33
|
+
* Throw unless `keep_alive_ms` is a valid keep-alive interval
|
|
34
|
+
* (`SseResponseOptions.keep_alive_ms`):
|
|
35
|
+
* `undefined` (the default), `null` (off), or a positive number of ms up to
|
|
36
|
+
* `SSE_KEEP_ALIVE_INTERVAL_MS_MAX`. Timers read anything else — zero, a
|
|
37
|
+
* negative, `NaN`, `Infinity`, or past the max — as an interval of about
|
|
38
|
+
* 1 ms, which would write keep-alives as fast as the event loop turns.
|
|
39
|
+
*
|
|
40
|
+
* @param keep_alive_ms - the interval to check
|
|
41
|
+
* @throws Error when it is a number outside `(0, SSE_KEEP_ALIVE_INTERVAL_MS_MAX]`
|
|
42
|
+
*/
|
|
43
|
+
export declare const validate_sse_keep_alive_ms: (keep_alive_ms: number | null | undefined) => void;
|
|
17
44
|
/**
|
|
18
45
|
* The byte budget of what one SSE stream holds for its client to read
|
|
19
46
|
* (`realtime/sse.ts` module doc, "Outbound bound").
|
|
20
47
|
*
|
|
21
48
|
* 1 MiB — equal to the default cap on one request body
|
|
22
|
-
* (`
|
|
49
|
+
* (`DEFAULT_BODY_LIMIT_BYTES`). An audit row is bounded by the request that
|
|
23
50
|
* produced it, so on a server that keeps that default the budget holds a burst
|
|
24
51
|
* of ordinary rows or one at the largest. The value is fixed and does not
|
|
25
52
|
* follow the server's body limit. Same value as the Rust spine's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse_constants.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/sse_constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,QAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"sse_constants.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/sse_constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,oBAAoB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,oFAAoF;AACpF,eAAO,MAAM,8BAA8B,aAAgB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,GAAI,eAAe,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,IAOrF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,QAAc,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hono-free SSE wire constants.
|
|
2
|
+
* Hono-free SSE wire constants, and the keep-alive interval's check.
|
|
3
3
|
*
|
|
4
4
|
* Split from `sse.ts` (which pulls `hono/streaming` via `streamSSE`) so the
|
|
5
5
|
* stream-framing constants are importable by cross-process test suites
|
|
@@ -14,12 +14,45 @@
|
|
|
14
14
|
* SSE tests assert the stream emits this on connect.
|
|
15
15
|
*/
|
|
16
16
|
export const SSE_CONNECTED_COMMENT = `: connected\n\n`;
|
|
17
|
+
/**
|
|
18
|
+
* The comment line an idle SSE stream writes every
|
|
19
|
+
* `SSE_KEEP_ALIVE_INTERVAL_MS`, so a proxy that cuts a connection idle past
|
|
20
|
+
* its read timeout (nginx's default is 60 s) keeps an open stream open.
|
|
21
|
+
* `EventSource` ignores comments.
|
|
22
|
+
*/
|
|
23
|
+
export const SSE_KEEP_ALIVE_COMMENT = `: keepalive\n\n`;
|
|
24
|
+
/**
|
|
25
|
+
* How often an SSE stream writes `SSE_KEEP_ALIVE_COMMENT` — 15 s, a quarter of
|
|
26
|
+
* nginx's default 60 s read timeout. Per stream, from its open, whether or not
|
|
27
|
+
* data frames were written in between.
|
|
28
|
+
*/
|
|
29
|
+
export const SSE_KEEP_ALIVE_INTERVAL_MS = 15_000;
|
|
30
|
+
/** The longest keep-alive interval a timer honors — 2³¹ − 1 ms, about 24.8 days. */
|
|
31
|
+
export const SSE_KEEP_ALIVE_INTERVAL_MS_MAX = 2_147_483_647;
|
|
32
|
+
/**
|
|
33
|
+
* Throw unless `keep_alive_ms` is a valid keep-alive interval
|
|
34
|
+
* (`SseResponseOptions.keep_alive_ms`):
|
|
35
|
+
* `undefined` (the default), `null` (off), or a positive number of ms up to
|
|
36
|
+
* `SSE_KEEP_ALIVE_INTERVAL_MS_MAX`. Timers read anything else — zero, a
|
|
37
|
+
* negative, `NaN`, `Infinity`, or past the max — as an interval of about
|
|
38
|
+
* 1 ms, which would write keep-alives as fast as the event loop turns.
|
|
39
|
+
*
|
|
40
|
+
* @param keep_alive_ms - the interval to check
|
|
41
|
+
* @throws Error when it is a number outside `(0, SSE_KEEP_ALIVE_INTERVAL_MS_MAX]`
|
|
42
|
+
*/
|
|
43
|
+
export const validate_sse_keep_alive_ms = (keep_alive_ms) => {
|
|
44
|
+
if (keep_alive_ms == null)
|
|
45
|
+
return;
|
|
46
|
+
if (!(keep_alive_ms > 0 && keep_alive_ms <= SSE_KEEP_ALIVE_INTERVAL_MS_MAX)) {
|
|
47
|
+
throw new Error(`SSE keep_alive_ms must be a positive number of ms up to ${SSE_KEEP_ALIVE_INTERVAL_MS_MAX}, or null to turn keep-alives off; got ${keep_alive_ms}`);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
17
50
|
/**
|
|
18
51
|
* The byte budget of what one SSE stream holds for its client to read
|
|
19
52
|
* (`realtime/sse.ts` module doc, "Outbound bound").
|
|
20
53
|
*
|
|
21
54
|
* 1 MiB — equal to the default cap on one request body
|
|
22
|
-
* (`
|
|
55
|
+
* (`DEFAULT_BODY_LIMIT_BYTES`). An audit row is bounded by the request that
|
|
23
56
|
* produced it, so on a server that keeps that default the budget holds a burst
|
|
24
57
|
* of ordinary rows or one at the largest. The value is fixed and does not
|
|
25
58
|
* follow the server's body limit. Same value as the Rust spine's
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generic
|
|
2
|
+
* Generic registry of SSE streams for broadcasting to SSE clients.
|
|
3
3
|
*
|
|
4
4
|
* Supports channel-based filtering — subscribers connect with optional
|
|
5
5
|
* channel filters, and broadcasts reach only matching subscribers.
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
26
26
|
import type { SseStream } from './sse.js';
|
|
27
|
-
/** One admitted subscriber, as `
|
|
27
|
+
/** One admitted subscriber, as `SseRegistry.broadcast` sees it. */
|
|
28
28
|
export interface Subscriber<T> {
|
|
29
29
|
stream: SseStream<T>;
|
|
30
30
|
/** Channels this subscriber listens to. `null` means all channels. */
|
|
@@ -34,8 +34,8 @@ export interface Subscriber<T> {
|
|
|
34
34
|
/** Grouping identities for `close_by_identity`. `null` when none. */
|
|
35
35
|
groups: Set<string> | null;
|
|
36
36
|
}
|
|
37
|
-
/** Options for `
|
|
38
|
-
export interface
|
|
37
|
+
/** Options for `SseRegistry`. */
|
|
38
|
+
export interface SseRegistryOptions {
|
|
39
39
|
/**
|
|
40
40
|
* Max admitted subscribers sharing a single `scope`. When a subscriber is
|
|
41
41
|
* admitted and the count of admitted subscribers with the same `scope` has
|
|
@@ -51,7 +51,7 @@ export interface SubscriberRegistryOptions {
|
|
|
51
51
|
*/
|
|
52
52
|
log?: Logger | null;
|
|
53
53
|
}
|
|
54
|
-
/** Options for `
|
|
54
|
+
/** Options for `SseRegistry.subscribe` and `subscribe_pending`. */
|
|
55
55
|
export interface SubscribeOptions {
|
|
56
56
|
/** Channels to subscribe to. Empty/absent = all channels. */
|
|
57
57
|
channels?: ReadonlyArray<string>;
|
|
@@ -68,8 +68,8 @@ export interface SubscribeOptions {
|
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* A registered subscription awaiting admission — what
|
|
71
|
-
* `
|
|
72
|
-
* `
|
|
71
|
+
* `SseRegistry.subscribe_pending` returns and
|
|
72
|
+
* `SseRegistry.admit` takes.
|
|
73
73
|
*
|
|
74
74
|
* Its entry is already in the registry, so every `close_by_identity` can reach
|
|
75
75
|
* it, but nothing is delivered to it and it does not count toward the
|
|
@@ -84,7 +84,7 @@ export interface PendingSubscription {
|
|
|
84
84
|
unsubscribe: () => void;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* Generic
|
|
87
|
+
* Generic registry of SSE streams with channel-based filtering and identity-keyed disconnection.
|
|
88
88
|
*
|
|
89
89
|
* Subscribers connect with optional channel filters, a capped `scope`, and
|
|
90
90
|
* uncapped `groups`. Broadcasts go to a specific channel and reach only
|
|
@@ -125,7 +125,7 @@ export interface PendingSubscription {
|
|
|
125
125
|
*
|
|
126
126
|
* @example
|
|
127
127
|
* ```ts
|
|
128
|
-
* const registry = new
|
|
128
|
+
* const registry = new SseRegistry<SseNotification>();
|
|
129
129
|
*
|
|
130
130
|
* // subscriber connects (from SSE endpoint)
|
|
131
131
|
* const unsubscribe = registry.subscribe(stream, {channels: ['runs']});
|
|
@@ -178,9 +178,9 @@ export interface PendingSubscription {
|
|
|
178
178
|
* return response;
|
|
179
179
|
* ```
|
|
180
180
|
*/
|
|
181
|
-
export declare class
|
|
181
|
+
export declare class SseRegistry<T> {
|
|
182
182
|
#private;
|
|
183
|
-
constructor(options?:
|
|
183
|
+
constructor(options?: SseRegistryOptions);
|
|
184
184
|
/**
|
|
185
185
|
* Number of open — **admitted** — subscribers. A registration still pending
|
|
186
186
|
* admission is counted by `pending_count` instead.
|
|
@@ -294,4 +294,4 @@ export declare class SubscriberRegistry<T> {
|
|
|
294
294
|
*/
|
|
295
295
|
close_all(): number;
|
|
296
296
|
}
|
|
297
|
-
//# sourceMappingURL=
|
|
297
|
+
//# sourceMappingURL=sse_registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse_registry.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/sse_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,mEAAmE;AACnE,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,sEAAsE;IACtE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7B,mDAAmD;IACnD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qEAAqE;IACrE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC3B;AASD,iCAAiC;AACjC,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,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AkBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAM3C;;;;;;;;;;;;OAYG;IACH,SAAS,IAAI,MAAM;CAsFnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generic
|
|
2
|
+
* Generic registry of SSE streams for broadcasting to SSE clients.
|
|
3
3
|
*
|
|
4
4
|
* Supports channel-based filtering — subscribers connect with optional
|
|
5
5
|
* channel filters, and broadcasts reach only matching subscribers.
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
26
26
|
/**
|
|
27
|
-
* Generic
|
|
27
|
+
* Generic registry of SSE streams with channel-based filtering and identity-keyed disconnection.
|
|
28
28
|
*
|
|
29
29
|
* Subscribers connect with optional channel filters, a capped `scope`, and
|
|
30
30
|
* uncapped `groups`. Broadcasts go to a specific channel and reach only
|
|
@@ -65,7 +65,7 @@ import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
|
65
65
|
*
|
|
66
66
|
* @example
|
|
67
67
|
* ```ts
|
|
68
|
-
* const registry = new
|
|
68
|
+
* const registry = new SseRegistry<SseNotification>();
|
|
69
69
|
*
|
|
70
70
|
* // subscriber connects (from SSE endpoint)
|
|
71
71
|
* const unsubscribe = registry.subscribe(stream, {channels: ['runs']});
|
|
@@ -118,7 +118,7 @@ import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
|
118
118
|
* return response;
|
|
119
119
|
* ```
|
|
120
120
|
*/
|
|
121
|
-
export class
|
|
121
|
+
export class SseRegistry {
|
|
122
122
|
// insertion order is registration order — the cap's "oldest"
|
|
123
123
|
#subscribers = new Set();
|
|
124
124
|
// each pending handle's entry; keyed per registry, so a handle from
|
package/dist/schema_meta.d.ts
CHANGED
|
@@ -12,9 +12,10 @@ import type { Sensitivity } from './sensitivity.js';
|
|
|
12
12
|
export interface SchemaFieldMeta {
|
|
13
13
|
description?: string;
|
|
14
14
|
/**
|
|
15
|
-
* Sensitivity level
|
|
16
|
-
* Read through every wrapping
|
|
17
|
-
* `.meta({sensitivity: 'secret'}).optional()`
|
|
15
|
+
* Sensitivity level (`Sensitivity`): `'secret'` masks the value,
|
|
16
|
+
* `'personal'` only keeps it out of URLs. Read through every wrapping
|
|
17
|
+
* layer (`schema_sensitivity`), so `.meta({sensitivity: 'secret'}).optional()`
|
|
18
|
+
* masks too.
|
|
18
19
|
*/
|
|
19
20
|
sensitivity?: Sensitivity;
|
|
20
21
|
/**
|
|
@@ -84,17 +85,36 @@ export declare const schema_invalid_reason: (schema: z.ZodType) => string | unde
|
|
|
84
85
|
* a secret stays masked however the field is wrapped. Fail-safe where
|
|
85
86
|
* `schema_meta_value` reads one chain: the walk follows the `innerType` of
|
|
86
87
|
* every wrapper that has one (optional, nullable, default, prefault,
|
|
87
|
-
* nonoptional, catch, readonly), both sides of a pipe (so
|
|
88
|
-
* `z.preprocess()` and `.pipe(secret)` all reach the
|
|
89
|
-
* `z.lazy()` getter,
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
88
|
+
* nonoptional, catch, readonly, promise), both sides of a pipe (so
|
|
89
|
+
* `.transform()`, `z.preprocess()` and `.pipe(secret)` all reach the
|
|
90
|
+
* secret), a `z.lazy()` getter, every member of a union (the value is one of
|
|
91
|
+
* them), both sides of an intersection (it is both), and a template
|
|
92
|
+
* literal's schema parts (the value contains them), visiting each schema
|
|
93
|
+
* once, and answers the strongest level any layer reached declares —
|
|
94
|
+
* `'secret'` over `'personal'`. It stops at structural schemas — an object's fields and an
|
|
95
|
+
* array's element carry their own.
|
|
93
96
|
*
|
|
94
97
|
* @param schema - a field schema, possibly wrapped
|
|
95
|
-
* @returns
|
|
98
|
+
* @returns the strongest level any reachable layer declares, else `undefined`
|
|
96
99
|
*/
|
|
97
100
|
export declare const schema_sensitivity: (schema: z.ZodType) => Sensitivity | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Whether an input schema carries a sensitive value at any depth — `'secret'`
|
|
103
|
+
* or `'personal'` on the schema itself or anywhere inside it: through its
|
|
104
|
+
* wrappers (as `schema_sensitivity`), and into object fields, array and set
|
|
105
|
+
* elements, tuple items, record and map keys and values, template literal
|
|
106
|
+
* parts, union members and intersection sides.
|
|
107
|
+
*
|
|
108
|
+
* What keeps a read's input off the URL: `FrontendHttpTransport` sends a
|
|
109
|
+
* read (`side_effects: false`) as a `GET` with the params in the query string,
|
|
110
|
+
* which proxies and server logs record, unless its input carries a sensitive
|
|
111
|
+
* value — that call goes as a `POST` (the transport walks each spec's input
|
|
112
|
+
* once).
|
|
113
|
+
*
|
|
114
|
+
* @param schema - an action input schema
|
|
115
|
+
* @returns `true` when any value the schema admits may hold a sensitive field
|
|
116
|
+
*/
|
|
117
|
+
export declare const schema_has_sensitive_field: (schema: z.ZodType) => boolean;
|
|
98
118
|
/**
|
|
99
119
|
* The `error.data.reason` an input validation failure at `path` carries: the
|
|
100
120
|
* `invalid_reason` of the deepest field along `path` that declares one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_meta.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/schema_meta.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB
|
|
1
|
+
{"version":3,"file":"schema_meta.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/schema_meta.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,mEAAmE;AACnE,MAAM,WAAW,eAAe;IA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
|
|
42
42
|
export const schema_invalid_reason = (schema) => schema_meta_value(schema, 'invalid_reason');
|
|
43
43
|
/**
|
|
44
|
-
* The `sensitivity`
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* The strongest `sensitivity` declared on any schema `walk_sensitivity`
|
|
45
|
+
* reaches from `schema` — `'secret'` over `'personal'` — visiting each schema
|
|
46
|
+
* once, so a recursive `z.lazy()` terminates. It follows the `innerType` of
|
|
47
47
|
* every wrapper that has one (optional, nullable, default, prefault,
|
|
48
|
-
* nonoptional, catch, readonly), both sides of a pipe
|
|
49
|
-
*
|
|
50
|
-
* `z.lazy()` getter
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* object's fields and an array's element carry their own.
|
|
54
|
-
*
|
|
55
|
-
* @param schema - a field schema, possibly wrapped
|
|
56
|
-
* @returns `'secret'` when any reachable layer declares it, else `undefined`
|
|
48
|
+
* nonoptional, catch, readonly, promise), both sides of a pipe and an
|
|
49
|
+
* intersection, every member of a union (discriminated or not), a
|
|
50
|
+
* template literal's schema parts, and a `z.lazy()` getter; with
|
|
51
|
+
* `structural`, also an object's fields and catchall, an array's element, a
|
|
52
|
+
* tuple's items and rest, and a record's, map's or set's keys and values.
|
|
57
53
|
*/
|
|
58
|
-
|
|
54
|
+
const walk_sensitivity = (schema, structural) => {
|
|
55
|
+
let found;
|
|
59
56
|
const seen = new Set();
|
|
60
57
|
const pending = [schema];
|
|
58
|
+
const push = (sub) => {
|
|
59
|
+
if (sub && typeof sub === 'object' && 'def' in sub)
|
|
60
|
+
pending.push(sub);
|
|
61
|
+
};
|
|
61
62
|
while (pending.length > 0) {
|
|
62
63
|
const layer = pending.pop();
|
|
63
64
|
if (seen.has(layer))
|
|
64
65
|
continue;
|
|
65
66
|
seen.add(layer);
|
|
66
|
-
|
|
67
|
+
const sensitivity = layer.meta()?.sensitivity;
|
|
68
|
+
if (sensitivity === 'secret')
|
|
67
69
|
return 'secret';
|
|
70
|
+
if (sensitivity === 'personal')
|
|
71
|
+
found = 'personal';
|
|
68
72
|
const def = layer.def;
|
|
69
73
|
if (def.type === 'lazy') {
|
|
70
|
-
|
|
74
|
+
push(layer._zod.innerType);
|
|
71
75
|
continue;
|
|
72
76
|
}
|
|
73
77
|
if (def.type === 'union' && Array.isArray(def.options)) {
|
|
74
|
-
|
|
78
|
+
for (const option of def.options)
|
|
79
|
+
push(option);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
// the value is one string containing each part, so its schema parts count
|
|
83
|
+
// like a wrapper's; `push` skips the literal parts (strings, numbers, …)
|
|
84
|
+
if (def.type === 'template_literal' && Array.isArray(def.parts)) {
|
|
85
|
+
for (const part of def.parts)
|
|
86
|
+
push(part);
|
|
87
|
+
}
|
|
88
|
+
for (const key of ['innerType', 'in', 'out', 'left', 'right'])
|
|
89
|
+
push(def[key]);
|
|
90
|
+
if (!structural)
|
|
75
91
|
continue;
|
|
92
|
+
if (def.type === 'object') {
|
|
93
|
+
for (const field of Object.values(layer.shape))
|
|
94
|
+
push(field);
|
|
95
|
+
push(def.catchall);
|
|
96
|
+
}
|
|
97
|
+
else if (def.type === 'array' || def.type === 'set') {
|
|
98
|
+
push(def.element);
|
|
99
|
+
push(def.valueType);
|
|
76
100
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
101
|
+
else if (def.type === 'tuple') {
|
|
102
|
+
if (Array.isArray(def.items))
|
|
103
|
+
for (const item of def.items)
|
|
104
|
+
push(item);
|
|
105
|
+
push(def.rest);
|
|
106
|
+
}
|
|
107
|
+
else if (def.type === 'record' || def.type === 'map') {
|
|
108
|
+
push(def.keyType);
|
|
109
|
+
push(def.valueType);
|
|
81
110
|
}
|
|
82
111
|
}
|
|
83
|
-
return
|
|
112
|
+
return found;
|
|
84
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* The `sensitivity` a schema declares anywhere among its wrapping layers, so
|
|
116
|
+
* a secret stays masked however the field is wrapped. Fail-safe where
|
|
117
|
+
* `schema_meta_value` reads one chain: the walk follows the `innerType` of
|
|
118
|
+
* every wrapper that has one (optional, nullable, default, prefault,
|
|
119
|
+
* nonoptional, catch, readonly, promise), both sides of a pipe (so
|
|
120
|
+
* `.transform()`, `z.preprocess()` and `.pipe(secret)` all reach the
|
|
121
|
+
* secret), a `z.lazy()` getter, every member of a union (the value is one of
|
|
122
|
+
* them), both sides of an intersection (it is both), and a template
|
|
123
|
+
* literal's schema parts (the value contains them), visiting each schema
|
|
124
|
+
* once, and answers the strongest level any layer reached declares —
|
|
125
|
+
* `'secret'` over `'personal'`. It stops at structural schemas — an object's fields and an
|
|
126
|
+
* array's element carry their own.
|
|
127
|
+
*
|
|
128
|
+
* @param schema - a field schema, possibly wrapped
|
|
129
|
+
* @returns the strongest level any reachable layer declares, else `undefined`
|
|
130
|
+
*/
|
|
131
|
+
export const schema_sensitivity = (schema) => walk_sensitivity(schema, false);
|
|
132
|
+
/**
|
|
133
|
+
* Whether an input schema carries a sensitive value at any depth — `'secret'`
|
|
134
|
+
* or `'personal'` on the schema itself or anywhere inside it: through its
|
|
135
|
+
* wrappers (as `schema_sensitivity`), and into object fields, array and set
|
|
136
|
+
* elements, tuple items, record and map keys and values, template literal
|
|
137
|
+
* parts, union members and intersection sides.
|
|
138
|
+
*
|
|
139
|
+
* What keeps a read's input off the URL: `FrontendHttpTransport` sends a
|
|
140
|
+
* read (`side_effects: false`) as a `GET` with the params in the query string,
|
|
141
|
+
* which proxies and server logs record, unless its input carries a sensitive
|
|
142
|
+
* value — that call goes as a `POST` (the transport walks each spec's input
|
|
143
|
+
* once).
|
|
144
|
+
*
|
|
145
|
+
* @param schema - an action input schema
|
|
146
|
+
* @returns `true` when any value the schema admits may hold a sensitive field
|
|
147
|
+
*/
|
|
148
|
+
export const schema_has_sensitive_field = (schema) => walk_sensitivity(schema, true) !== undefined;
|
|
85
149
|
/**
|
|
86
150
|
* The `error.data.reason` an input validation failure at `path` carries: the
|
|
87
151
|
* `invalid_reason` of the deepest field along `path` that declares one.
|
package/dist/sensitivity.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sensitivity levels for schema metadata.
|
|
3
3
|
*
|
|
4
|
-
* Used by env schemas and
|
|
5
|
-
* in startup logs, surface explorers, and test output
|
|
4
|
+
* Used by env schemas and action input schemas to control masking/redaction
|
|
5
|
+
* in startup logs, surface explorers, and test output, and to keep values
|
|
6
|
+
* out of URLs.
|
|
6
7
|
*
|
|
7
8
|
* @module
|
|
8
9
|
*/
|
|
@@ -10,6 +11,11 @@
|
|
|
10
11
|
* Sensitivity level for a schema field.
|
|
11
12
|
*
|
|
12
13
|
* - `'secret'` — value is masked in logs and UI (e.g. passwords, API keys, signing keys)
|
|
14
|
+
* and kept out of URLs
|
|
15
|
+
* - `'personal'` — personal data (email fragments, names, search terms about
|
|
16
|
+
* people): kept out of URLs — a read whose input carries it is sent as a
|
|
17
|
+
* `POST`, not a `GET` (`schema_has_sensitive_field`) — but not masked in
|
|
18
|
+
* logs or UI
|
|
13
19
|
*/
|
|
14
|
-
export type Sensitivity = 'secret';
|
|
20
|
+
export type Sensitivity = 'secret' | 'personal';
|
|
15
21
|
//# sourceMappingURL=sensitivity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitivity.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sensitivity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sensitivity.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sensitivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC"}
|
package/dist/sensitivity.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sensitivity levels for schema metadata.
|
|
3
3
|
*
|
|
4
|
-
* Used by env schemas and
|
|
5
|
-
* in startup logs, surface explorers, and test output
|
|
4
|
+
* Used by env schemas and action input schemas to control masking/redaction
|
|
5
|
+
* in startup logs, surface explorers, and test output, and to keep values
|
|
6
|
+
* out of URLs.
|
|
6
7
|
*
|
|
7
8
|
* @module
|
|
8
9
|
*/
|
|
@@ -114,8 +114,8 @@ export interface CreateAppBackendOptions {
|
|
|
114
114
|
* })
|
|
115
115
|
* ```
|
|
116
116
|
*
|
|
117
|
-
* Additional listeners (factory-managed audit SSE,
|
|
118
|
-
*
|
|
117
|
+
* Additional listeners (factory-managed audit SSE, the revocation guard)
|
|
118
|
+
* are registered at `create_app_server` time via
|
|
119
119
|
* `audit.add_listener(...)`.
|
|
120
120
|
*/
|
|
121
121
|
audit_factory: AuditFactory;
|
|
@@ -134,8 +134,11 @@ export interface CreateAppBackendOptions {
|
|
|
134
134
|
* (`namespace`, `name`, `sequence`); order is append-only so forward-only
|
|
135
135
|
* guarantees hold per-namespace.
|
|
136
136
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
137
|
+
* A name in `reserved_migration_namespaces` is rejected at startup
|
|
138
|
+
* (`run_migrations` refuses it before touching the database) unless the
|
|
139
|
+
* entry is the spine's own `CELL_MIGRATION_NS` / `FACT_MIGRATION_NS`
|
|
140
|
+
* object; auth always runs first, so it is never passed here.
|
|
141
|
+
* Omit for no extra namespaces. This is the only
|
|
139
142
|
* place to splice consumer migrations — DB init belongs to the backend
|
|
140
143
|
* lifecycle, not server assembly.
|
|
141
144
|
*/
|
|
@@ -151,7 +154,7 @@ export interface CreateAppBackendOptions {
|
|
|
151
154
|
*
|
|
152
155
|
* @param options - keyring, password deps, `audit_factory`, optional database URL, and optional `migration_namespaces`
|
|
153
156
|
* @returns app backend with deps, database metadata, and combined migration results
|
|
154
|
-
* @throws
|
|
157
|
+
* @throws MigrationError `namespace-reserved` if a `migration_namespaces` entry bears a `reserved_migration_namespaces` name and is not the spine's own namespace
|
|
155
158
|
*/
|
|
156
159
|
export declare const create_app_backend: (options: CreateAppBackendOptions) => Promise<AppBackend>;
|
|
157
160
|
//# sourceMappingURL=app_backend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_backend.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/app_backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAkB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIjG;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,oIAAoI;IACpI,QAAQ,CAAC,iBAAiB,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC3D,iEAAiE;IACjE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,KAAK,YAAY,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,EAAE,YACF,CAAC;AAEnC;;;;;GA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