@fuzdev/fuz_app 0.150.0 → 0.152.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/actions/CLAUDE.md +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -34
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +52 -75
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +70 -44
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +179 -158
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -77
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +9 -2
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +23 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +45 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +9 -8
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -239
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import { type JsonrpcErrorResponse, type JsonrpcMethod, type JsonrpcNotification, type JsonrpcNotificationParams, type
|
|
10
|
+
import { JsonrpcRequest, type JsonrpcErrorObject, type JsonrpcErrorResponse, type JsonrpcMethod, type JsonrpcNotification, type JsonrpcNotificationParams, type JsonrpcRequestId, type JsonrpcRequestParams, type JsonrpcResponse, type JsonrpcResult, JSONRPC_VERSION } from './jsonrpc.js';
|
|
11
11
|
/** Creates a JSON-RPC request message. */
|
|
12
12
|
export declare const create_jsonrpc_request: (method: JsonrpcMethod, params: JsonrpcRequestParams | undefined, id: JsonrpcRequestId) => JsonrpcRequest;
|
|
13
13
|
/** Creates a JSON-RPC success response message. */
|
|
@@ -18,8 +18,11 @@ export declare const create_jsonrpc_notification: (method: JsonrpcMethod, params
|
|
|
18
18
|
export declare const create_jsonrpc_error_response: (id: JsonrpcErrorResponse["id"], error: JsonrpcErrorResponse["error"]) => JsonrpcErrorResponse;
|
|
19
19
|
/**
|
|
20
20
|
* Creates a JSON-RPC error response from any error.
|
|
21
|
-
* Handles `ThrownJsonrpcError`
|
|
22
|
-
*
|
|
21
|
+
* Handles a thrown JSON-RPC error — a `ThrownJsonrpcError` from any copy of
|
|
22
|
+
* fuz_app, recognized by its brand (`to_thrown_jsonrpc_error`) — by
|
|
23
|
+
* preserving its code/message/data, and maps any other `Error`, a foreign
|
|
24
|
+
* class carrying a JSON-RPC `code` included, to internal_error, with its
|
|
25
|
+
* message and stack in DEV.
|
|
23
26
|
*/
|
|
24
27
|
export declare const create_jsonrpc_error_response_from_thrown: (id: JsonrpcRequestId | null, error: unknown) => JsonrpcErrorResponse;
|
|
25
28
|
/** Checks if a value is a valid JSON-RPC request id (string or finite number). */
|
|
@@ -28,8 +31,6 @@ export declare const is_jsonrpc_request_id: (id: unknown) => id is JsonrpcReques
|
|
|
28
31
|
export declare const is_jsonrpc_object: (message: unknown) => message is {
|
|
29
32
|
jsonrpc: typeof JSONRPC_VERSION;
|
|
30
33
|
};
|
|
31
|
-
/** Checks if a value is any valid JSON-RPC message or batch array. */
|
|
32
|
-
export declare const is_jsonrpc_message: (message: unknown) => message is JsonrpcMessage | Array<JsonrpcMessage>;
|
|
33
34
|
/** Checks if a value is a JSON-RPC request (has method + id). */
|
|
34
35
|
export declare const is_jsonrpc_request: (message: unknown) => message is JsonrpcRequest;
|
|
35
36
|
/** Checks if a value is a JSON-RPC notification (has method, no id). */
|
|
@@ -44,21 +45,63 @@ export declare const is_jsonrpc_error_response: (message: unknown) => message is
|
|
|
44
45
|
*/
|
|
45
46
|
export declare const to_jsonrpc_message_id: (message_or_id: unknown) => JsonrpcRequestId | null;
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
-
* `
|
|
48
|
+
* Normalizes input to JSON-RPC params format.
|
|
49
|
+
* Returns `undefined` for null/undefined, wraps primitives in `{value}`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const to_jsonrpc_params: (input: unknown) => Record<string, any> | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* A parsed JSON value classified as a JSON-RPC message by
|
|
54
|
+
* `classify_jsonrpc_message` — transport-agnostic, each transport applying
|
|
55
|
+
* its own semantics to the arms:
|
|
49
56
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* `
|
|
57
|
+
* - `request` — a valid request envelope, ready for dispatch.
|
|
58
|
+
* - `notification` — a string `method` and no `id` key. `params` is handed
|
|
59
|
+
* back unvalidated (a notification has no id to answer an error on).
|
|
60
|
+
* The WebSocket path routes `cancel` and drops every other one; HTTP
|
|
61
|
+
* answers `invalid_request` with `id: null`.
|
|
62
|
+
* - `response` — no string `method`, a string or number `id`, and exactly
|
|
63
|
+
* one of `result` / `error`: a reply to a server-initiated request. The
|
|
64
|
+
* WebSocket path routes it to the pending peer request; HTTP issues no
|
|
65
|
+
* server-initiated requests, so it answers `invalid_request` with `id: null`.
|
|
66
|
+
* - `invalid` — the error to answer and the id to answer it on.
|
|
54
67
|
*
|
|
55
|
-
*
|
|
56
|
-
* @returns the echoable id, or `null`
|
|
68
|
+
* Twin of the Rust spine's `fuz_http::Classified`.
|
|
57
69
|
*/
|
|
58
|
-
export
|
|
70
|
+
export type ClassifiedJsonrpcMessage = {
|
|
71
|
+
kind: 'request';
|
|
72
|
+
request: JsonrpcRequest;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'notification';
|
|
75
|
+
method: JsonrpcMethod;
|
|
76
|
+
params: unknown;
|
|
77
|
+
} | {
|
|
78
|
+
kind: 'response';
|
|
79
|
+
response: JsonrpcResponse | JsonrpcErrorResponse;
|
|
80
|
+
} | {
|
|
81
|
+
kind: 'invalid';
|
|
82
|
+
id: JsonrpcRequestId | null;
|
|
83
|
+
error: JsonrpcErrorObject;
|
|
84
|
+
};
|
|
59
85
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
86
|
+
* Classify a parsed JSON value as a JSON-RPC message, in the Rust twin's
|
|
87
|
+
* order: version, then the `method` axis (none, or a non-string one: a
|
|
88
|
+
* response or invalid), then `id` (none: a notification), then the request
|
|
89
|
+
* envelope (`JsonrpcRequest` — string or number `id`, `params` absent or an
|
|
90
|
+
* object).
|
|
91
|
+
*
|
|
92
|
+
* The `method` axis is string-typed like the twin, whose
|
|
93
|
+
* `obj.get("method").and_then(Value::as_str)` reads a present non-string
|
|
94
|
+
* `method` as absent — so `{id, method: 123, result}` is a response on both
|
|
95
|
+
* sides. The `result` / `error` exclusive-or refuses a frame carrying both.
|
|
96
|
+
*
|
|
97
|
+
* Every `invalid` is `invalid_request`. Its `id` is the frame's own when the
|
|
98
|
+
* frame is an object carrying a string or number one, else `null` — a
|
|
99
|
+
* non-object frame (an array included) has none. A refused request envelope
|
|
100
|
+
* carries the schema's issues in DEV, as `data.issues`; nothing else carries
|
|
101
|
+
* data.
|
|
102
|
+
*
|
|
103
|
+
* @param json - the parsed frame or body, of any shape
|
|
104
|
+
* @returns the classification
|
|
62
105
|
*/
|
|
63
|
-
export declare const
|
|
106
|
+
export declare const classify_jsonrpc_message: (json: unknown) => ClassifiedJsonrpcMessage;
|
|
64
107
|
//# sourceMappingURL=jsonrpc_helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonrpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/jsonrpc_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,
|
|
1
|
+
{"version":3,"file":"jsonrpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/jsonrpc_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACN,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,eAAe,EACf,MAAM,cAAc,CAAC;AAUtB,0CAA0C;AAC1C,eAAO,MAAM,sBAAsB,GAClC,QAAQ,aAAa,EACrB,QAAQ,oBAAoB,GAAG,SAAS,EACxC,IAAI,gBAAgB,KAClB,cAUF,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,GACnC,IAAI,gBAAgB,EACpB,QAAQ,aAAa,KACnB,eAID,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,2BAA2B,GACvC,QAAQ,aAAa,EACrB,QAAQ,yBAAyB,GAAG,SAAS,KAC3C,mBASF,CAAC;AAEF,iDAAiD;AACjD,eAAO,MAAM,6BAA6B,GACzC,IAAI,oBAAoB,CAAC,IAAI,CAAC,EAC9B,OAAO,oBAAoB,CAAC,OAAO,CAAC,KAClC,oBAID,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,yCAAyC,GACrD,IAAI,gBAAgB,GAAG,IAAI,EAC3B,OAAO,OAAO,KACZ,oBA0BF,CAAC;AAIF,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,GAAI,IAAI,OAAO,KAAG,EAAE,IAA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AM,OAAO,KAAG,wBAgCxD,CAAC"}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
import { DEV } from 'esm-env';
|
|
11
|
-
import { JSONRPC_VERSION } from './jsonrpc.js';
|
|
12
|
-
import {
|
|
11
|
+
import { JsonrpcRequest, JSONRPC_VERSION } from './jsonrpc.js';
|
|
12
|
+
import { JSONRPC_ERROR_CODES, dev_only, jsonrpc_error_messages, to_thrown_jsonrpc_error } from './jsonrpc_errors.js';
|
|
13
13
|
// --- Message builders ---
|
|
14
14
|
/** Creates a JSON-RPC request message. */
|
|
15
15
|
export const create_jsonrpc_request = (method, params, id) => {
|
|
@@ -48,17 +48,21 @@ export const create_jsonrpc_error_response = (id, error) => ({
|
|
|
48
48
|
});
|
|
49
49
|
/**
|
|
50
50
|
* Creates a JSON-RPC error response from any error.
|
|
51
|
-
* Handles `ThrownJsonrpcError`
|
|
52
|
-
*
|
|
51
|
+
* Handles a thrown JSON-RPC error — a `ThrownJsonrpcError` from any copy of
|
|
52
|
+
* fuz_app, recognized by its brand (`to_thrown_jsonrpc_error`) — by
|
|
53
|
+
* preserving its code/message/data, and maps any other `Error`, a foreign
|
|
54
|
+
* class carrying a JSON-RPC `code` included, to internal_error, with its
|
|
55
|
+
* message and stack in DEV.
|
|
53
56
|
*/
|
|
54
57
|
export const create_jsonrpc_error_response_from_thrown = (id, error) => {
|
|
55
58
|
let code = JSONRPC_ERROR_CODES.internal_error;
|
|
56
59
|
let message = 'internal server error';
|
|
57
60
|
let data = undefined;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
const thrown = to_thrown_jsonrpc_error(error);
|
|
62
|
+
if (thrown) {
|
|
63
|
+
code = thrown.code;
|
|
64
|
+
message = thrown.message;
|
|
65
|
+
data = thrown.data;
|
|
62
66
|
}
|
|
63
67
|
else if (error instanceof Error) {
|
|
64
68
|
if (DEV) {
|
|
@@ -87,10 +91,6 @@ export const is_jsonrpc_object = (message) => typeof message === 'object' &&
|
|
|
87
91
|
message !== null &&
|
|
88
92
|
!Array.isArray(message) &&
|
|
89
93
|
message.jsonrpc === JSONRPC_VERSION;
|
|
90
|
-
/** Checks if a value is any valid JSON-RPC message or batch array. */
|
|
91
|
-
export const is_jsonrpc_message = (message) => Array.isArray(message)
|
|
92
|
-
? message.length > 0 && message.every((m) => is_jsonrpc_object(m))
|
|
93
|
-
: is_jsonrpc_object(message);
|
|
94
94
|
/** Checks if a value is a JSON-RPC request (has method + id). */
|
|
95
95
|
export const is_jsonrpc_request = (message) => is_jsonrpc_object(message) && 'method' in message && 'id' in message;
|
|
96
96
|
/** Checks if a value is a JSON-RPC notification (has method, no id). */
|
|
@@ -110,19 +110,6 @@ export const to_jsonrpc_message_id = (message_or_id) => {
|
|
|
110
110
|
const maybe_id = typeof message_or_id === 'object' ? message_or_id.id : message_or_id;
|
|
111
111
|
return is_jsonrpc_request_id(maybe_id) ? maybe_id : null;
|
|
112
112
|
};
|
|
113
|
-
/**
|
|
114
|
-
* The id an error response to a rejected envelope can echo: the frame's
|
|
115
|
-
* `id` when the frame is an object carrying a valid one, else `null`.
|
|
116
|
-
*
|
|
117
|
-
* Unlike `to_jsonrpc_message_id`, a scalar frame (`5`, `"x"`) is never read
|
|
118
|
-
* as its own id — a non-object body has no id to echo, which is the Rust
|
|
119
|
-
* twin's `classify` answer too. Both transports use this for the
|
|
120
|
-
* `invalid_request` reply.
|
|
121
|
-
*
|
|
122
|
-
* @param frame - the parsed body, of any shape
|
|
123
|
-
* @returns the echoable id, or `null`
|
|
124
|
-
*/
|
|
125
|
-
export const to_jsonrpc_envelope_id = (frame) => typeof frame === 'object' ? to_jsonrpc_message_id(frame) : null;
|
|
126
113
|
/**
|
|
127
114
|
* Normalizes input to JSON-RPC params format.
|
|
128
115
|
* Returns `undefined` for null/undefined, wraps primitives in `{value}`.
|
|
@@ -136,3 +123,58 @@ export const to_jsonrpc_params = (input) => {
|
|
|
136
123
|
}
|
|
137
124
|
return { value: input };
|
|
138
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* Classify a parsed JSON value as a JSON-RPC message, in the Rust twin's
|
|
128
|
+
* order: version, then the `method` axis (none, or a non-string one: a
|
|
129
|
+
* response or invalid), then `id` (none: a notification), then the request
|
|
130
|
+
* envelope (`JsonrpcRequest` — string or number `id`, `params` absent or an
|
|
131
|
+
* object).
|
|
132
|
+
*
|
|
133
|
+
* The `method` axis is string-typed like the twin, whose
|
|
134
|
+
* `obj.get("method").and_then(Value::as_str)` reads a present non-string
|
|
135
|
+
* `method` as absent — so `{id, method: 123, result}` is a response on both
|
|
136
|
+
* sides. The `result` / `error` exclusive-or refuses a frame carrying both.
|
|
137
|
+
*
|
|
138
|
+
* Every `invalid` is `invalid_request`. Its `id` is the frame's own when the
|
|
139
|
+
* frame is an object carrying a string or number one, else `null` — a
|
|
140
|
+
* non-object frame (an array included) has none. A refused request envelope
|
|
141
|
+
* carries the schema's issues in DEV, as `data.issues`; nothing else carries
|
|
142
|
+
* data.
|
|
143
|
+
*
|
|
144
|
+
* @param json - the parsed frame or body, of any shape
|
|
145
|
+
* @returns the classification
|
|
146
|
+
*/
|
|
147
|
+
export const classify_jsonrpc_message = (json) => {
|
|
148
|
+
// an array falls through to the version check, with no `id` to echo
|
|
149
|
+
if (typeof json !== 'object' || json === null) {
|
|
150
|
+
return { kind: 'invalid', id: null, error: jsonrpc_error_messages.invalid_request() };
|
|
151
|
+
}
|
|
152
|
+
const frame = json;
|
|
153
|
+
const id = to_jsonrpc_message_id(frame);
|
|
154
|
+
if (frame.jsonrpc !== JSONRPC_VERSION) {
|
|
155
|
+
return { kind: 'invalid', id, error: jsonrpc_error_messages.invalid_request() };
|
|
156
|
+
}
|
|
157
|
+
const { method } = frame;
|
|
158
|
+
if (typeof method !== 'string') {
|
|
159
|
+
if (id !== null && 'result' in frame !== 'error' in frame) {
|
|
160
|
+
return { kind: 'response', response: frame };
|
|
161
|
+
}
|
|
162
|
+
// a non-string `method` beside an `id` is a malformed request — the
|
|
163
|
+
// envelope schema below refuses it with its issues
|
|
164
|
+
if (!('method' in frame && 'id' in frame)) {
|
|
165
|
+
return { kind: 'invalid', id, error: jsonrpc_error_messages.invalid_request() };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else if (!('id' in frame)) {
|
|
169
|
+
return { kind: 'notification', method, params: frame.params };
|
|
170
|
+
}
|
|
171
|
+
const parsed = JsonrpcRequest.safeParse(frame);
|
|
172
|
+
if (!parsed.success) {
|
|
173
|
+
return {
|
|
174
|
+
kind: 'invalid',
|
|
175
|
+
id,
|
|
176
|
+
error: jsonrpc_error_messages.invalid_request(dev_only({ issues: parsed.error.issues }))
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return { kind: 'request', request: parsed.data };
|
|
180
|
+
};
|
package/dist/http/origin.d.ts
CHANGED
|
@@ -129,13 +129,42 @@ export declare const format_allowed_origins_error: (error: AllowedOriginsError)
|
|
|
129
129
|
* entry is reported, not just the first.
|
|
130
130
|
*
|
|
131
131
|
* @param raw - the comma-separated allowlist value
|
|
132
|
-
* @returns the matchers
|
|
132
|
+
* @returns the matchers and the patterns they were parsed from, or every refusal —
|
|
133
|
+
* `no_origins` when the value is blank
|
|
133
134
|
*/
|
|
134
135
|
export declare const parse_allowed_origins: (raw: string) => Result<{
|
|
135
136
|
origins: Array<RegExp>;
|
|
137
|
+
patterns: Array<OriginPattern>;
|
|
136
138
|
}, {
|
|
137
139
|
errors: Array<AllowedOriginsError>;
|
|
138
140
|
}>;
|
|
141
|
+
/**
|
|
142
|
+
* One validated allowlist entry, as `parse_allowed_origins` parsed it — the
|
|
143
|
+
* twin of the Rust `fuz_http::OriginPattern`.
|
|
144
|
+
*/
|
|
145
|
+
export interface OriginPattern {
|
|
146
|
+
/** The entry as written (trimmed). */
|
|
147
|
+
readonly entry: string;
|
|
148
|
+
/** The matcher `should_allow_origin` tests. */
|
|
149
|
+
readonly regexp: RegExp;
|
|
150
|
+
/**
|
|
151
|
+
* The host as parsed, lowercased: `.`-joined labels (a `*` label as `*`), or
|
|
152
|
+
* a bracketed IPv6 literal.
|
|
153
|
+
*/
|
|
154
|
+
readonly host: string;
|
|
155
|
+
/** The host's labels, lowercased; `null` for a bracketed IPv6 host, which is exact. */
|
|
156
|
+
readonly host_labels: ReadonlyArray<string> | null;
|
|
157
|
+
/** No port, `:*` (any port, or none), or one exact port. */
|
|
158
|
+
readonly port: 'absent' | 'any' | 'exact';
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The pattern `regexp` was parsed from, when `parse_allowed_origins` (of any
|
|
162
|
+
* fuz_app copy) built it.
|
|
163
|
+
*
|
|
164
|
+
* @param regexp - a matcher from an allowlist
|
|
165
|
+
* @returns its `OriginPattern`, or `undefined` for a matcher built another way
|
|
166
|
+
*/
|
|
167
|
+
export declare const origin_pattern_of: (regexp: RegExp) => OriginPattern | undefined;
|
|
139
168
|
/**
|
|
140
169
|
* Tests if an `Origin` value matches any of the allowed patterns.
|
|
141
170
|
* Pattern matching is case-insensitive (web hosts and schemes are). A value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB,GAAI,GAAG,OAAO,KAAG,OAC8B,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;EAiBjC,CAAC;AACH,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Q,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;CAC1C;AAWD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,aAAa,GAAG,SAGlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC/B,QAAQ,MAAM,EACd,kBAAkB,aAAa,CAAC,MAAM,CAAC,KACrC,OAAqF,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,qBAAqB,GAEhC,kBAAkB,aAAa,CAAC,MAAM,CAAC,EACvC,aAAY,aAAa,CAAC,kBAAkB,CAAM,KAChD,OAaF,CAAC"}
|
package/dist/http/origin.js
CHANGED
|
@@ -142,25 +142,50 @@ const trim_ascii_whitespace = (value) => value.replace(ASCII_WHITESPACE_EDGES, '
|
|
|
142
142
|
* entry is reported, not just the first.
|
|
143
143
|
*
|
|
144
144
|
* @param raw - the comma-separated allowlist value
|
|
145
|
-
* @returns the matchers
|
|
145
|
+
* @returns the matchers and the patterns they were parsed from, or every refusal —
|
|
146
|
+
* `no_origins` when the value is blank
|
|
146
147
|
*/
|
|
147
148
|
export const parse_allowed_origins = (raw) => {
|
|
148
149
|
if (trim_ascii_whitespace(raw) === '') {
|
|
149
150
|
return { ok: false, errors: [{ kind: 'no_origins' }] };
|
|
150
151
|
}
|
|
151
|
-
const
|
|
152
|
+
const patterns = [];
|
|
152
153
|
const errors = [];
|
|
153
154
|
raw.split(',').forEach((part, i) => {
|
|
154
155
|
const entry = trim_ascii_whitespace(part);
|
|
155
|
-
const parsed =
|
|
156
|
+
const parsed = parse_origin_pattern(entry);
|
|
156
157
|
if (typeof parsed === 'string') {
|
|
157
158
|
errors.push({ kind: parsed, index: i + 1, entry });
|
|
158
159
|
}
|
|
159
160
|
else {
|
|
160
|
-
|
|
161
|
+
patterns.push(parsed);
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
|
-
|
|
164
|
+
if (errors.length > 0)
|
|
165
|
+
return { ok: false, errors };
|
|
166
|
+
for (const pattern of patterns) {
|
|
167
|
+
Object.defineProperty(pattern.regexp, ORIGIN_PATTERN_BRAND, { value: pattern });
|
|
168
|
+
}
|
|
169
|
+
return { ok: true, origins: patterns.map((p) => p.regexp), patterns };
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Realm-global brand on each matcher `parse_allowed_origins` returns, holding
|
|
173
|
+
* the `OriginPattern` it was parsed from (a non-enumerable property).
|
|
174
|
+
* `Symbol.for` makes every copy of this module that one process resolves mint
|
|
175
|
+
* the same key, so `origin_pattern_of` reads a matcher parsed by any copy of
|
|
176
|
+
* fuz_app. A matcher built any other way has none.
|
|
177
|
+
*/
|
|
178
|
+
const ORIGIN_PATTERN_BRAND = Symbol.for('@fuzdev/fuz_app/OriginPattern');
|
|
179
|
+
/**
|
|
180
|
+
* The pattern `regexp` was parsed from, when `parse_allowed_origins` (of any
|
|
181
|
+
* fuz_app copy) built it.
|
|
182
|
+
*
|
|
183
|
+
* @param regexp - a matcher from an allowlist
|
|
184
|
+
* @returns its `OriginPattern`, or `undefined` for a matcher built another way
|
|
185
|
+
*/
|
|
186
|
+
export const origin_pattern_of = (regexp) => {
|
|
187
|
+
const pattern = regexp[ORIGIN_PATTERN_BRAND];
|
|
188
|
+
return typeof pattern === 'object' && pattern !== null ? pattern : undefined;
|
|
164
189
|
};
|
|
165
190
|
/**
|
|
166
191
|
* Tests if an `Origin` value matches any of the allowed patterns.
|
|
@@ -210,15 +235,15 @@ export const verify_request_source = (allowed_patterns, carve_outs = []) => (c,
|
|
|
210
235
|
return next();
|
|
211
236
|
};
|
|
212
237
|
/**
|
|
213
|
-
* Validates one trimmed entry and
|
|
214
|
-
* refusal. The checks run in a fixed order and the first that fails names the
|
|
238
|
+
* Validates one trimmed entry and parses it — its matcher and its shape — or
|
|
239
|
+
* names its refusal. The checks run in a fixed order and the first that fails names the
|
|
215
240
|
* kind — the Rust spine runs the same order, so both name the same kind.
|
|
216
241
|
*
|
|
217
242
|
* The compiled regex is `^scheme://host(:port)?$`, case-insensitive: an exact
|
|
218
243
|
* label matches itself, a `*` label `[^./:]+` (one non-empty label), a `:*`
|
|
219
244
|
* port `(:\d+)?`.
|
|
220
245
|
*/
|
|
221
|
-
const
|
|
246
|
+
const parse_origin_pattern = (entry) => {
|
|
222
247
|
if (entry === '')
|
|
223
248
|
return 'empty_entry';
|
|
224
249
|
if (!VISIBLE_ASCII.test(entry))
|
|
@@ -235,6 +260,8 @@ const origin_pattern_to_regexp = (entry) => {
|
|
|
235
260
|
if (authority.includes('@'))
|
|
236
261
|
return 'has_userinfo';
|
|
237
262
|
let host_source;
|
|
263
|
+
let host_text;
|
|
264
|
+
let host_labels;
|
|
238
265
|
let port;
|
|
239
266
|
if (authority.startsWith('[')) {
|
|
240
267
|
const end = authority.indexOf(']');
|
|
@@ -254,6 +281,8 @@ const origin_pattern_to_regexp = (entry) => {
|
|
|
254
281
|
return 'invalid_after_ipv6';
|
|
255
282
|
}
|
|
256
283
|
host_source = escape_regexp(authority.slice(0, end + 1));
|
|
284
|
+
host_text = authority.slice(0, end + 1).toLowerCase();
|
|
285
|
+
host_labels = null;
|
|
257
286
|
}
|
|
258
287
|
else {
|
|
259
288
|
const colon = authority.lastIndexOf(':');
|
|
@@ -273,6 +302,8 @@ const origin_pattern_to_regexp = (entry) => {
|
|
|
273
302
|
host_source = labels
|
|
274
303
|
.map((label) => (label === '*' ? '[^./:]+' : escape_regexp(label)))
|
|
275
304
|
.join('\\.');
|
|
305
|
+
host_labels = labels.map((label) => label.toLowerCase());
|
|
306
|
+
host_text = host_labels.join('.');
|
|
276
307
|
}
|
|
277
308
|
let port_source = '';
|
|
278
309
|
if (port === '*') {
|
|
@@ -285,7 +316,13 @@ const origin_pattern_to_regexp = (entry) => {
|
|
|
285
316
|
return 'default_port';
|
|
286
317
|
port_source = ':' + port;
|
|
287
318
|
}
|
|
288
|
-
return
|
|
319
|
+
return {
|
|
320
|
+
entry,
|
|
321
|
+
regexp: new RegExp('^' + escape_regexp(scheme + '://') + host_source + port_source + '$', 'i'),
|
|
322
|
+
host: host_text,
|
|
323
|
+
host_labels,
|
|
324
|
+
port: port === null ? 'absent' : port === '*' ? 'any' : 'exact'
|
|
325
|
+
};
|
|
289
326
|
};
|
|
290
327
|
/**
|
|
291
328
|
* True when `inner` (a bracketed host without its brackets) is an IPv6 address
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wildcard allowlist entries — refused at server assembly unless the operator
|
|
3
|
+
* opts in (`FUZ_ALLOW_ORIGIN_WILDCARDS=true`), and said aloud on every boot
|
|
4
|
+
* that admits them. Twin of the Rust `fuz_http::origin_wildcard`, word for
|
|
5
|
+
* word.
|
|
6
|
+
*
|
|
7
|
+
* Wildcards are origin syntax an operator may want, but each one admits pages
|
|
8
|
+
* the server does not serve, and the server trusts them all. The forms, as
|
|
9
|
+
* `parse_allowed_origins` matches them (`OriginWildcard`):
|
|
10
|
+
*
|
|
11
|
+
* - **port** (`:*`) — the host at any port, or none;
|
|
12
|
+
* - **host** — each `*` label is any one label, in any position
|
|
13
|
+
* (`https://*.example.com`, `https://example.*`), and a host that is all
|
|
14
|
+
* `*` labels (`http://*`, `https://*.*`) is every host with that many
|
|
15
|
+
* labels — four of them cover every IPv4 address;
|
|
16
|
+
* - **both** (`http://*:*`, `https://*.example.com:*`).
|
|
17
|
+
*
|
|
18
|
+
* A bracketed IPv6 host is exact, so it takes only the port form.
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import type { Result } from '@fuzdev/fuz_util/result.ts';
|
|
23
|
+
import { type OriginPattern } from './origin.js';
|
|
24
|
+
/** The env var the allowlist is read from (`BaseServerEnv`). */
|
|
25
|
+
export declare const ALLOWED_ORIGINS_VAR = "FUZ_ALLOWED_ORIGINS";
|
|
26
|
+
/**
|
|
27
|
+
* The env var that admits wildcard allowlist entries: exactly `true` admits
|
|
28
|
+
* them, exactly `false` (or unset) refuses them, and anything else fails the
|
|
29
|
+
* env schema (`BaseServerEnv`).
|
|
30
|
+
*/
|
|
31
|
+
export declare const ALLOW_ORIGIN_WILDCARDS_VAR = "FUZ_ALLOW_ORIGIN_WILDCARDS";
|
|
32
|
+
/** How much of a pattern's host its `*` labels leave open. */
|
|
33
|
+
export type HostWildcard =
|
|
34
|
+
/** Some labels are fixed (`*.example.com`, `example.*`). */
|
|
35
|
+
{
|
|
36
|
+
kind: 'partial';
|
|
37
|
+
}
|
|
38
|
+
/** No label is fixed (`*`, `*.*`): every host of `labels` labels. */
|
|
39
|
+
| {
|
|
40
|
+
kind: 'whole';
|
|
41
|
+
labels: number;
|
|
42
|
+
};
|
|
43
|
+
/** The wildcards an `OriginPattern` holds — `origin_wildcard_kind`. */
|
|
44
|
+
export type OriginWildcard = {
|
|
45
|
+
kind: 'port';
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'host';
|
|
48
|
+
host: HostWildcard;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'host_and_port';
|
|
51
|
+
host: HostWildcard;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Which wildcards `pattern` holds, `null` for an exact entry.
|
|
55
|
+
*
|
|
56
|
+
* @param pattern - a parsed allowlist entry
|
|
57
|
+
* @returns its wildcard shape, or `null`
|
|
58
|
+
*/
|
|
59
|
+
export declare const origin_wildcard_kind: (pattern: OriginPattern) => OriginWildcard | null;
|
|
60
|
+
/**
|
|
61
|
+
* What a wildcard in `pattern` admits — the text `admit_origin_wildcards`
|
|
62
|
+
* warns or refuses with; `null` for an exact entry. The TS spine mounts no
|
|
63
|
+
* `Host` check and adds no note, so this is the Rust text with
|
|
64
|
+
* `OriginWildcardOptions::DEFAULT`.
|
|
65
|
+
*
|
|
66
|
+
* @param pattern - a parsed allowlist entry
|
|
67
|
+
* @returns the text, or `null`
|
|
68
|
+
*/
|
|
69
|
+
export declare const origin_wildcard_warning: (pattern: OriginPattern) => string | null;
|
|
70
|
+
/** One wildcard entry an allowlist holds, with what it admits. */
|
|
71
|
+
export interface OriginWildcardEntry {
|
|
72
|
+
readonly entry: string;
|
|
73
|
+
readonly warning: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Admit `origins`' wildcard entries when `allowed`, returning what each admits
|
|
77
|
+
* for the caller to warn with; an exact list passes either way with none.
|
|
78
|
+
* Classifies the matchers `parse_allowed_origins` built (`origin_pattern_of`,
|
|
79
|
+
* read through a realm-global brand, so a second fuz_app copy's matchers
|
|
80
|
+
* classify too). A matcher built any other way can't be classified, so it is
|
|
81
|
+
* refused whatever `allowed` says — build the list with
|
|
82
|
+
* `parse_allowed_origins`.
|
|
83
|
+
*
|
|
84
|
+
* @param origins - the allowlist's matchers
|
|
85
|
+
* @param allowed - whether the operator opted in (`FUZ_ALLOW_ORIGIN_WILDCARDS=true`)
|
|
86
|
+
* @param origins_var - what the list is called in the refusal: the env var it
|
|
87
|
+
* was read from, or the option that carried it
|
|
88
|
+
* @returns the wildcard entries admitted, or the refusal — naming each
|
|
89
|
+
* unclassifiable matcher, or else each wildcard entry, what it admits, and
|
|
90
|
+
* the flag (the Rust spine's boot error, word for word)
|
|
91
|
+
*/
|
|
92
|
+
export declare const admit_origin_wildcards: (origins: ReadonlyArray<RegExp>, allowed: boolean, origins_var?: string) => Result<{
|
|
93
|
+
wildcards: Array<OriginWildcardEntry>;
|
|
94
|
+
}, {
|
|
95
|
+
message: string;
|
|
96
|
+
}>;
|
|
97
|
+
//# sourceMappingURL=origin_wildcard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origin_wildcard.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/origin_wildcard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAqB,KAAK,aAAa,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