@fuzdev/fuz_app 0.180.0 → 0.182.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/dist/actions/CLAUDE.md +38 -20
- package/dist/actions/action_rpc.d.ts +25 -6
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -48
- package/dist/actions/action_types.d.ts +31 -13
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +1 -1
- package/dist/actions/notification_sender.d.ts +83 -0
- package/dist/actions/notification_sender.d.ts.map +1 -0
- package/dist/actions/notification_sender.js +85 -0
- package/dist/actions/perform_action.d.ts +13 -4
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +27 -18
- package/dist/actions/register_action_ws.d.ts +20 -2
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +17 -5
- package/dist/actions/ws_socket_session.d.ts +3 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +3 -2
- package/dist/auth/CLAUDE.md +84 -59
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +30 -3
- package/dist/auth/account_queries.d.ts +213 -2
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +255 -2
- package/dist/auth/account_route_schema.d.ts +26 -16
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +10 -24
- package/dist/auth/account_routes.d.ts +5 -7
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +110 -89
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +117 -25
- package/dist/auth/api_token_queries.d.ts +29 -12
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +42 -27
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +10 -12
- package/dist/auth/audit_log_schema.js +4 -4
- package/dist/auth/bearer_auth.d.ts +4 -3
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +37 -32
- package/dist/auth/bootstrap_account.d.ts +65 -37
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +115 -66
- package/dist/auth/bootstrap_route_schema.d.ts +6 -2
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +7 -2
- package/dist/auth/bootstrap_routes.d.ts +50 -33
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +109 -87
- package/dist/auth/bootstrap_token_store.d.ts +60 -0
- package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
- package/dist/auth/bootstrap_token_store.js +39 -0
- package/dist/auth/credential_headers.d.ts +71 -0
- package/dist/auth/credential_headers.d.ts.map +1 -0
- package/dist/auth/credential_headers.js +100 -0
- package/dist/auth/daemon_token.d.ts +13 -1
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token.js +14 -2
- package/dist/auth/daemon_token_middleware.d.ts +10 -11
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +39 -30
- package/dist/auth/deps.d.ts +10 -11
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/invite_queries.d.ts +18 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +24 -0
- package/dist/auth/request_context.d.ts +97 -76
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +93 -104
- package/dist/auth/resolved_auth.d.ts +10 -5
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +5 -3
- package/dist/auth/role_grant_offer_actions.d.ts +7 -11
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +97 -106
- package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
- package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_ddl.js +9 -2
- package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +75 -22
- package/dist/auth/role_grant_offer_queries.d.ts +143 -9
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +266 -66
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/role_grant_queries.d.ts +57 -10
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +81 -22
- package/dist/auth/role_grant_sql.d.ts +21 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -1
- package/dist/auth/role_grant_sql.js +21 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +9 -2
- package/dist/auth/session_cookie.d.ts +105 -25
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +124 -15
- package/dist/auth/session_middleware.d.ts +83 -54
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +92 -66
- package/dist/auth/session_queries.d.ts +95 -14
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +98 -19
- package/dist/auth/signup_route_schema.d.ts +5 -5
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +4 -4
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +17 -14
- package/dist/auth/standard_rpc_actions.d.ts +6 -19
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/standard_rpc_actions.js +5 -6
- package/dist/auth/token_scope.d.ts +6 -8
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +6 -9
- package/dist/dev/setup.d.ts +6 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -34
- package/dist/hono_context.d.ts +21 -0
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +17 -0
- package/dist/http/CLAUDE.md +156 -48
- package/dist/http/auth_shape.d.ts +4 -4
- package/dist/http/common_routes.js +1 -1
- package/dist/http/db_routes.d.ts +4 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +14 -14
- package/dist/http/dev_route_error_check.d.ts +6 -3
- package/dist/http/dev_route_error_check.d.ts.map +1 -1
- package/dist/http/dev_route_error_check.js +6 -3
- package/dist/http/dev_set_cookie_check.d.ts +53 -0
- package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
- package/dist/http/dev_set_cookie_check.js +80 -0
- package/dist/http/error_schemas.d.ts +45 -22
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +53 -26
- package/dist/http/header_lines.d.ts +42 -0
- package/dist/http/header_lines.d.ts.map +1 -0
- package/dist/http/header_lines.js +80 -0
- package/dist/http/host.d.ts +12 -9
- package/dist/http/host.d.ts.map +1 -1
- package/dist/http/host.js +25 -20
- package/dist/http/origin.d.ts +7 -22
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +11 -25
- package/dist/http/proxy.d.ts +1 -0
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -0
- package/dist/http/request_headers.d.ts +95 -0
- package/dist/http/request_headers.d.ts.map +1 -0
- package/dist/http/request_headers.js +110 -0
- package/dist/http/request_target.d.ts +134 -0
- package/dist/http/request_target.d.ts.map +1 -0
- package/dist/http/request_target.js +193 -0
- package/dist/http/route_error_check.d.ts +4 -11
- package/dist/http/route_error_check.d.ts.map +1 -1
- package/dist/http/route_error_check.js +4 -21
- package/dist/http/route_result.d.ts +127 -23
- package/dist/http/route_result.d.ts.map +1 -1
- package/dist/http/route_result.js +97 -19
- package/dist/http/route_spec.d.ts +299 -83
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +548 -71
- package/dist/http/simple_request.d.ts +19 -14
- package/dist/http/simple_request.d.ts.map +1 -1
- package/dist/http/simple_request.js +17 -29
- package/dist/http/surface.d.ts +2 -0
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +4 -1
- package/dist/realtime/outbound_budget.d.ts +1 -2
- package/dist/realtime/outbound_budget.d.ts.map +1 -1
- package/dist/realtime/outbound_budget.js +1 -2
- package/dist/realtime/sse.d.ts +47 -17
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +115 -93
- package/dist/realtime/sse_constants.d.ts +7 -1
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +12 -1
- package/dist/realtime/sse_registry.d.ts +3 -3
- package/dist/realtime/sse_registry.js +3 -3
- package/dist/runtime/deps.d.ts +20 -4
- package/dist/runtime/deps.d.ts.map +1 -1
- package/dist/runtime/mock.d.ts +7 -1
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +33 -3
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +2 -1
- package/dist/runtime/secure_file.d.ts +71 -10
- package/dist/runtime/secure_file.d.ts.map +1 -1
- package/dist/runtime/secure_file.js +91 -11
- package/dist/server/app_backend.d.ts +0 -8
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +4 -4
- package/dist/server/app_server.d.ts +54 -33
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +69 -41
- package/dist/server/serve_fact_route.d.ts +3 -3
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -55
- package/dist/server/static.d.ts +20 -0
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +56 -8
- package/dist/server/unmatched_route.d.ts +42 -0
- package/dist/server/unmatched_route.d.ts.map +1 -0
- package/dist/server/unmatched_route.js +64 -0
- package/dist/testing/CLAUDE.md +406 -1202
- package/dist/testing/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +5 -9
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +3 -2
- package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +320 -6
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +68 -5
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +20 -4
- package/dist/testing/cross_backend/cell_gated_create.js +1 -1
- package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +179 -23
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
- package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
- package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance.js +296 -0
- package/dist/testing/cross_backend/credential_conformance.json +1284 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
- package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
- package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
- package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_wire.js +188 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +22 -2
- package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +3 -7
- package/dist/testing/cross_backend/differential.d.ts +1 -1
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +3 -2
- package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +11 -5
- package/dist/testing/cross_backend/full_spine_mount.d.ts +4 -10
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +11 -4
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +4 -0
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +78 -4
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +13 -10
- package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
- package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
- package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance.js +196 -0
- package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance.js +186 -0
- package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +185 -31
- package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
- package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +82 -34
- package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
- package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
- package/dist/testing/cross_backend/session_login.d.ts +24 -0
- package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_login.js +31 -0
- package/dist/testing/cross_backend/setup.d.ts +117 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +193 -9
- package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
- package/dist/testing/cross_backend/simple_request.js +5 -0
- package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +88 -5
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +205 -64
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +5 -2
- package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
- package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_credential_read.js +175 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +58 -2
- package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +13 -10
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_endpoint.js +19 -2
- package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_role_gated.js +2 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +28 -12
- package/dist/testing/cross_backend/xfail.d.ts +44 -11
- package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
- package/dist/testing/cross_backend/xfail.js +68 -23
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +4 -3
- package/dist/testing/integration.d.ts +1 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +14 -8
- package/dist/testing/integration_helpers.d.ts +50 -3
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +87 -9
- package/dist/testing/middleware.d.ts +3 -1
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +14 -7
- package/dist/testing/resolved_auth.d.ts +3 -1
- package/dist/testing/resolved_auth.d.ts.map +1 -1
- package/dist/testing/resolved_auth.js +4 -4
- package/dist/testing/round_trip.d.ts +6 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +17 -6
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +7 -0
- package/dist/testing/rpc_helpers.d.ts +4 -2
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +6 -1
- package/dist/testing/rpc_round_trip.d.ts +13 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +25 -6
- package/dist/testing/schema_generators.d.ts +2 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +4 -4
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +13 -10
- package/dist/testing/transports/fetch_transport.d.ts +6 -3
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
- package/dist/testing/transports/fetch_transport.js +31 -19
- package/dist/testing/transports/raw_http.d.ts +61 -1
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +61 -1
- package/dist/testing/transports/ws_raw_client.d.ts +20 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +10 -4
- package/dist/testing/transports/ws_transport.d.ts +21 -1
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +58 -20
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +8 -4
- package/package.json +1 -1
package/dist/http/db_routes.js
CHANGED
|
@@ -12,12 +12,11 @@
|
|
|
12
12
|
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
13
13
|
import { array, boolean, integer, literal, loose_object, max_value, min_value, nullable, number, object, pipe, record, regex, safe_integer, string, transform, unknown, with_default } from '@fuzdev/fuz_schema/schema.ts';
|
|
14
14
|
import { ActingActor } from '../primitive_schemas.js';
|
|
15
|
-
import { define_route
|
|
15
|
+
import { define_route } from './route_spec.js';
|
|
16
16
|
import { route_fail, route_ok } from './route_result.js';
|
|
17
17
|
import { REST_DATABASE_CONNECTION_FAILED, REST_FOREIGN_KEY_VIOLATION, REST_ROW_NOT_FOUND, REST_TABLE_NO_PRIMARY_KEY, REST_TABLE_NOT_DELETABLE, REST_TABLE_NOT_FOUND } from './error_schemas.js';
|
|
18
18
|
import { assert_valid_sql_identifier, VALID_SQL_IDENTIFIER } from '../db/sql_identifier.js';
|
|
19
19
|
import { pg_error_code } from '../db/pg_error.js';
|
|
20
|
-
import { get_client_ip } from './client_ip.js';
|
|
21
20
|
import { emit_after_commit } from './pending_effects.js';
|
|
22
21
|
// the spellings `query_int` reads as an integer: decimal digits with an optional sign
|
|
23
22
|
const QUERY_INT_PATTERN = /^[+-]?\d+$/;
|
|
@@ -84,9 +83,10 @@ export const NON_BROWSABLE_TABLES = Object.freeze([
|
|
|
84
83
|
* surface. It is also part of how revocation propagates: the revocation guard
|
|
85
84
|
* (`create_revocation_guard`) closes live connections by listening to audit
|
|
86
85
|
* events, so a raw row delete here is invisible to it.
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
86
|
+
* - `bootstrap_lock` — deleting the singleton closes bootstrap for good:
|
|
87
|
+
* `check_bootstrap_status` reads a missing row as unavailable (logged as an
|
|
88
|
+
* error), so a database that has not bootstrapped never can until the row
|
|
89
|
+
* is restored.
|
|
90
90
|
* - `app_settings` — deleting the singleton makes every settings read throw.
|
|
91
91
|
* - `schema_version` — the migration tracker. Already refused by the
|
|
92
92
|
* single-column-primary-key rule (its key is `(namespace, name)`), but that
|
|
@@ -179,7 +179,7 @@ export const create_db_route_specs = (deps, options) => {
|
|
|
179
179
|
input: literal(null),
|
|
180
180
|
output: loose_object({ connected: boolean }),
|
|
181
181
|
errors: [REST_DATABASE_CONNECTION_FAILED],
|
|
182
|
-
handler: async (
|
|
182
|
+
handler: async (route) => {
|
|
183
183
|
try {
|
|
184
184
|
await route.db.query('SELECT 1');
|
|
185
185
|
// Deliberately schema-wide (not allowlist-filtered): the count
|
|
@@ -218,7 +218,7 @@ export const create_db_route_specs = (deps, options) => {
|
|
|
218
218
|
tables: array(object({ name: string, row_count: Count }))
|
|
219
219
|
}),
|
|
220
220
|
transaction: true,
|
|
221
|
-
handler: async (
|
|
221
|
+
handler: async (route) => {
|
|
222
222
|
await set_statement_timeout(route.db);
|
|
223
223
|
// Existence still comes from `information_schema` — a listed table
|
|
224
224
|
// that hasn't migrated in yet is silently absent, not a 500.
|
|
@@ -266,9 +266,9 @@ export const create_db_route_specs = (deps, options) => {
|
|
|
266
266
|
deletable: boolean
|
|
267
267
|
}),
|
|
268
268
|
transaction: true,
|
|
269
|
-
handler: async (
|
|
270
|
-
const { name } =
|
|
271
|
-
const { offset, limit } =
|
|
269
|
+
handler: async (route) => {
|
|
270
|
+
const { name } = route.params;
|
|
271
|
+
const { offset, limit } = route.query;
|
|
272
272
|
// Allowlist gate, masked: an unlisted (or floor) table answers
|
|
273
273
|
// exactly like one that doesn't exist.
|
|
274
274
|
if (!(await gate_browsable_table(route.db, name))) {
|
|
@@ -338,8 +338,8 @@ export const create_db_route_specs = (deps, options) => {
|
|
|
338
338
|
REST_ROW_NOT_FOUND,
|
|
339
339
|
REST_FOREIGN_KEY_VIOLATION
|
|
340
340
|
],
|
|
341
|
-
handler: async (
|
|
342
|
-
const { name, id } =
|
|
341
|
+
handler: async (route) => {
|
|
342
|
+
const { name, id } = route.params;
|
|
343
343
|
// Same allowlist gate and masking as the detail route — an
|
|
344
344
|
// unbrowsable table exposes no rows to delete either.
|
|
345
345
|
if (!(await gate_browsable_table(route.db, name))) {
|
|
@@ -403,8 +403,8 @@ export const create_db_route_specs = (deps, options) => {
|
|
|
403
403
|
// `emit_pool`, not the transaction-routing `emit`. Account-grain
|
|
404
404
|
// attribution — the browser is a raw storage surface, so no actor
|
|
405
405
|
// is claimed.
|
|
406
|
-
const account_id =
|
|
407
|
-
const ip =
|
|
406
|
+
const account_id = route.auth.account.id;
|
|
407
|
+
const ip = route.client_ip;
|
|
408
408
|
emit_after_commit(route, () => deps.audit.emit_pool({
|
|
409
409
|
event_type: 'db_admin_row_delete',
|
|
410
410
|
account_id,
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* status the map lacks, or a body off the status's schema, is logged. A 500
|
|
12
12
|
* `internal_error` and a 503 `service_unavailable` are always accepted, a
|
|
13
13
|
* JSON-RPC error envelope on a `jsonrpc` route is not a REST error body, a
|
|
14
|
-
* non-JSON response is skipped, and so is a request no route spec matches
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* non-JSON response is skipped, and so is a request no route spec matches:
|
|
15
|
+
* the unmatched-route handler's `405` and `404` (`server/unmatched_route.ts`)
|
|
16
|
+
* answer for no route, so no route's map can hold them.
|
|
17
17
|
*
|
|
18
18
|
* Logs, never throws — a throw inside it, its logger's included, is swallowed
|
|
19
19
|
* — and leaves the response unchanged. Outside DEV
|
|
@@ -37,6 +37,9 @@ import { type RouteErrorMap, type RouteErrorMapSpec } from './route_errors.js';
|
|
|
37
37
|
* lookup has a `RegExpRouter`. Where the two differ the cost is a missed DEV
|
|
38
38
|
* log, and rarely a wrong route.
|
|
39
39
|
*
|
|
40
|
+
* The path is matched as the app's router matches it: the raw request path
|
|
41
|
+
* (`get_request_path`), nothing percent-decoded.
|
|
42
|
+
*
|
|
40
43
|
* @param routes - the routes, in the order they were mounted
|
|
41
44
|
* @param to_value - what to keep beside each route
|
|
42
45
|
* @returns a function from a request's method and path to the matched route's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev_route_error_check.d.ts","sourceRoot":"","sources":["../../src/lib/http/dev_route_error_check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAQtD,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEpG
|
|
1
|
+
{"version":3,"file":"dev_route_error_check.d.ts","sourceRoot":"","sources":["../../src/lib/http/dev_route_error_check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAQtD,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEpG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACjE,CAAC,EAED,QAAQ,aAAa,CAAC,MAAM,CAAC,EAC7B,UAAU,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,KAC5B,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,GAAG,SAAS,CAclD,CAAC;AAEF,iEAAiE;AACjE,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,kDAAkD;AAClD,MAAM,WAAW,yBAAyB;IACzC,6CAA6C;IAC7C,WAAW,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;IACnD,oFAAoF;IACpF,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrD,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,yBAAyB,KAChC,iBAAiB,GAAG,IA2CtB,CAAC"}
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* status the map lacks, or a body off the status's schema, is logged. A 500
|
|
12
12
|
* `internal_error` and a 503 `service_unavailable` are always accepted, a
|
|
13
13
|
* JSON-RPC error envelope on a `jsonrpc` route is not a REST error body, a
|
|
14
|
-
* non-JSON response is skipped, and so is a request no route spec matches
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* non-JSON response is skipped, and so is a request no route spec matches:
|
|
15
|
+
* the unmatched-route handler's `405` and `404` (`server/unmatched_route.ts`)
|
|
16
|
+
* answer for no route, so no route's map can hold them.
|
|
17
17
|
*
|
|
18
18
|
* Logs, never throws — a throw inside it, its logger's included, is swallowed
|
|
19
19
|
* — and leaves the response unchanged. Outside DEV
|
|
@@ -40,6 +40,9 @@ import { get_route_error_map } from './route_errors.js';
|
|
|
40
40
|
* lookup has a `RegExpRouter`. Where the two differ the cost is a missed DEV
|
|
41
41
|
* log, and rarely a wrong route.
|
|
42
42
|
*
|
|
43
|
+
* The path is matched as the app's router matches it: the raw request path
|
|
44
|
+
* (`get_request_path`), nothing percent-decoded.
|
|
45
|
+
*
|
|
43
46
|
* @param routes - the routes, in the order they were mounted
|
|
44
47
|
* @param to_value - what to keep beside each route
|
|
45
48
|
* @returns a function from a request's method and path to the matched route's
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DEV-only `Set-Cookie` check: an outer middleware that logs a response
|
|
3
|
+
* which does not lead with the `Set-Cookie` line a middleware put on the
|
|
4
|
+
* context for every response.
|
|
5
|
+
*
|
|
6
|
+
* A middleware that writes a line on the context's prepared headers — the
|
|
7
|
+
* session middleware's clear of a stale cookie — records it under
|
|
8
|
+
* `EXPECTED_FIRST_SET_COOKIE_KEY`. Every response built through the context
|
|
9
|
+
* then carries it first: every route result, which the spine emits there,
|
|
10
|
+
* and every middleware and catch layer answering with `c.json` or `c.text`.
|
|
11
|
+
* A response built past the context does not — a consumer's
|
|
12
|
+
* `post_route_middleware`, a `transform_middleware` layer, or a raw Hono route
|
|
13
|
+
* answering with a `Response` it made — and only a check of the finished
|
|
14
|
+
* response can see that, so this one runs after the request: when a line was
|
|
15
|
+
* recorded, the response's first `Set-Cookie` must be that line, else it logs
|
|
16
|
+
* an error naming the method and path, and whether the response carries no
|
|
17
|
+
* `Set-Cookie` or another one first.
|
|
18
|
+
*
|
|
19
|
+
* One response is skipped: an accepted WebSocket upgrade's placeholder. No
|
|
20
|
+
* runtime adapter hands Hono a `101` — `@hono/node-server`'s and `@hono/bun`'s
|
|
21
|
+
* `upgradeWebSocket` return a bodiless `200` and the runtime writes the real
|
|
22
|
+
* `101` itself — so the check recognizes the placeholder by its shape: a
|
|
23
|
+
* request with `Upgrade: websocket` answered `200` with no body. That
|
|
24
|
+
* placeholder is no response a client reads, and no layer builds it through
|
|
25
|
+
* the context. The cost: a raw route answering a bodiless `200` to an upgrade
|
|
26
|
+
* request it did not accept goes unchecked too.
|
|
27
|
+
*
|
|
28
|
+
* Generic: it knows a line and an order, nothing of sessions. A sibling of
|
|
29
|
+
* the DEV error check (`http/dev_route_error_check.ts`) rather than part of
|
|
30
|
+
* it, as that one reads the route a request reached and only its error
|
|
31
|
+
* answers, where this one holds every answer of every path, routed or not.
|
|
32
|
+
* Mounted outermost beside it by `create_app_server`. Logs, never throws — a
|
|
33
|
+
* throw inside it, its logger's included, is swallowed — and leaves the
|
|
34
|
+
* response unchanged. Outside DEV `create_dev_set_cookie_check` returns `null`
|
|
35
|
+
* and nothing is mounted.
|
|
36
|
+
*
|
|
37
|
+
* @module
|
|
38
|
+
*/
|
|
39
|
+
import type { MiddlewareHandler } from 'hono';
|
|
40
|
+
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
41
|
+
/** Options for `create_dev_set_cookie_check`. */
|
|
42
|
+
export interface DevSetCookieCheckOptions {
|
|
43
|
+
/** Receives each response that does not lead with the recorded line. */
|
|
44
|
+
log: Logger;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Build the DEV `Set-Cookie` check (module doc), or `null` outside DEV.
|
|
48
|
+
*
|
|
49
|
+
* @param options - the logger
|
|
50
|
+
* @returns the middleware to mount outermost, or `null` in production
|
|
51
|
+
*/
|
|
52
|
+
export declare const create_dev_set_cookie_check: (options: DevSetCookieCheckOptions) => MiddlewareHandler | null;
|
|
53
|
+
//# sourceMappingURL=dev_set_cookie_check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev_set_cookie_check.d.ts","sourceRoot":"","sources":["../../src/lib/http/dev_set_cookie_check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD,iDAAiD;AACjD,MAAM,WAAW,wBAAwB;IACxC,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GACvC,SAAS,wBAAwB,KAC/B,iBAAiB,GAAG,IAkCtB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DEV-only `Set-Cookie` check: an outer middleware that logs a response
|
|
3
|
+
* which does not lead with the `Set-Cookie` line a middleware put on the
|
|
4
|
+
* context for every response.
|
|
5
|
+
*
|
|
6
|
+
* A middleware that writes a line on the context's prepared headers — the
|
|
7
|
+
* session middleware's clear of a stale cookie — records it under
|
|
8
|
+
* `EXPECTED_FIRST_SET_COOKIE_KEY`. Every response built through the context
|
|
9
|
+
* then carries it first: every route result, which the spine emits there,
|
|
10
|
+
* and every middleware and catch layer answering with `c.json` or `c.text`.
|
|
11
|
+
* A response built past the context does not — a consumer's
|
|
12
|
+
* `post_route_middleware`, a `transform_middleware` layer, or a raw Hono route
|
|
13
|
+
* answering with a `Response` it made — and only a check of the finished
|
|
14
|
+
* response can see that, so this one runs after the request: when a line was
|
|
15
|
+
* recorded, the response's first `Set-Cookie` must be that line, else it logs
|
|
16
|
+
* an error naming the method and path, and whether the response carries no
|
|
17
|
+
* `Set-Cookie` or another one first.
|
|
18
|
+
*
|
|
19
|
+
* One response is skipped: an accepted WebSocket upgrade's placeholder. No
|
|
20
|
+
* runtime adapter hands Hono a `101` — `@hono/node-server`'s and `@hono/bun`'s
|
|
21
|
+
* `upgradeWebSocket` return a bodiless `200` and the runtime writes the real
|
|
22
|
+
* `101` itself — so the check recognizes the placeholder by its shape: a
|
|
23
|
+
* request with `Upgrade: websocket` answered `200` with no body. That
|
|
24
|
+
* placeholder is no response a client reads, and no layer builds it through
|
|
25
|
+
* the context. The cost: a raw route answering a bodiless `200` to an upgrade
|
|
26
|
+
* request it did not accept goes unchecked too.
|
|
27
|
+
*
|
|
28
|
+
* Generic: it knows a line and an order, nothing of sessions. A sibling of
|
|
29
|
+
* the DEV error check (`http/dev_route_error_check.ts`) rather than part of
|
|
30
|
+
* it, as that one reads the route a request reached and only its error
|
|
31
|
+
* answers, where this one holds every answer of every path, routed or not.
|
|
32
|
+
* Mounted outermost beside it by `create_app_server`. Logs, never throws — a
|
|
33
|
+
* throw inside it, its logger's included, is swallowed — and leaves the
|
|
34
|
+
* response unchanged. Outside DEV `create_dev_set_cookie_check` returns `null`
|
|
35
|
+
* and nothing is mounted.
|
|
36
|
+
*
|
|
37
|
+
* @module
|
|
38
|
+
*/
|
|
39
|
+
import { DEV } from 'esm-env';
|
|
40
|
+
import { EXPECTED_FIRST_SET_COOKIE_KEY } from '../hono_context.js';
|
|
41
|
+
/**
|
|
42
|
+
* Build the DEV `Set-Cookie` check (module doc), or `null` outside DEV.
|
|
43
|
+
*
|
|
44
|
+
* @param options - the logger
|
|
45
|
+
* @returns the middleware to mount outermost, or `null` in production
|
|
46
|
+
*/
|
|
47
|
+
export const create_dev_set_cookie_check = (options) => {
|
|
48
|
+
if (!DEV)
|
|
49
|
+
return null;
|
|
50
|
+
const { log } = options;
|
|
51
|
+
// named, so an assembled app's route table shows it
|
|
52
|
+
const dev_set_cookie_check = async (c, next) => {
|
|
53
|
+
await next();
|
|
54
|
+
try {
|
|
55
|
+
const expected = c.get(EXPECTED_FIRST_SET_COOKIE_KEY);
|
|
56
|
+
if (expected === undefined)
|
|
57
|
+
return;
|
|
58
|
+
const response = c.res;
|
|
59
|
+
// an accepted upgrade's placeholder (module doc)
|
|
60
|
+
if (c.req.header('upgrade')?.toLowerCase() === 'websocket' &&
|
|
61
|
+
response.status === 200 &&
|
|
62
|
+
response.body === null) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const first = response.headers.getSetCookie()[0];
|
|
66
|
+
if (first === expected)
|
|
67
|
+
return;
|
|
68
|
+
log.error(`Response without the expected first Set-Cookie: ${c.req.method} ${c.req.path} — ${first === undefined ? 'it carries no Set-Cookie' : 'another Set-Cookie comes first'}`);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
try {
|
|
72
|
+
log.error('dev_set_cookie_check failed:', err);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// the logger itself threw; nothing left to tell
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return dev_set_cookie_check;
|
|
80
|
+
};
|
|
@@ -80,6 +80,27 @@ export declare const ERROR_PAYLOAD_TOO_LARGE: "payload_too_large";
|
|
|
80
80
|
export declare const ERROR_SERVICE_UNAVAILABLE: "service_unavailable";
|
|
81
81
|
/** Request `Content-Length` header is not a plain run of ASCII digits. */
|
|
82
82
|
export declare const ERROR_INVALID_CONTENT_LENGTH: "invalid_content_length";
|
|
83
|
+
/**
|
|
84
|
+
* A request whose method its path doesn't serve (405, with `Allow` naming
|
|
85
|
+
* the methods it does) — `server/unmatched_route.ts`; the Rust spine's
|
|
86
|
+
* `fuz_http::METHOD_NOT_ALLOWED_REASON`.
|
|
87
|
+
*/
|
|
88
|
+
export declare const ERROR_METHOD_NOT_ALLOWED: "method_not_allowed";
|
|
89
|
+
/**
|
|
90
|
+
* A path under the auth scope that no route serves (404) —
|
|
91
|
+
* `server/unmatched_route.ts`; the Rust spine's
|
|
92
|
+
* `fuz_http::ROUTE_NOT_FOUND_REASON`. Distinct from a handler's own
|
|
93
|
+
* `not_found`, so a client — or a test asking whether a route is mounted —
|
|
94
|
+
* can tell a missing route from a missing row.
|
|
95
|
+
*/
|
|
96
|
+
export declare const ERROR_ROUTE_NOT_FOUND: "route_not_found";
|
|
97
|
+
/**
|
|
98
|
+
* The body of the `404` an unrouted path outside the auth scope answers, as
|
|
99
|
+
* `text/plain` — no code, since nothing outside the scope speaks the JSON
|
|
100
|
+
* error convention; the Rust spine's `fuz_actions::server::NOT_FOUND_TEXT`,
|
|
101
|
+
* byte for byte.
|
|
102
|
+
*/
|
|
103
|
+
export declare const NOT_FOUND_TEXT = "404 Not Found";
|
|
83
104
|
/** Request origin not in allowlist. */
|
|
84
105
|
export declare const ERROR_FORBIDDEN_ORIGIN: "forbidden_origin";
|
|
85
106
|
/**
|
|
@@ -115,28 +136,25 @@ export declare const ERROR_ACTOR_NOT_ON_ACCOUNT: "actor_not_on_account";
|
|
|
115
136
|
* violation — signup / bootstrap always create an actor in the same
|
|
116
137
|
* transaction. Surfaced from the dispatcher's authorization phase as a
|
|
117
138
|
* 500 so the operator sees the corruption signal rather than a confusing
|
|
118
|
-
* 4xx.
|
|
119
|
-
*
|
|
139
|
+
* 4xx. An account removed after its credential was read reaches it too: the
|
|
140
|
+
* removal takes the account's actors with it.
|
|
120
141
|
*/
|
|
121
142
|
export declare const ERROR_NO_ACTORS_ON_ACCOUNT: "no_actors_on_account";
|
|
122
|
-
/**
|
|
123
|
-
* Authentication validated an account, but a follow-up read in the
|
|
124
|
-
* authorization phase came back null — the account or its named actor
|
|
125
|
-
* row was deleted between the credential check and the dispatcher's
|
|
126
|
-
* `build_request_context` / `build_account_context` step. Torn read,
|
|
127
|
-
* not a missing-actor invariant violation. Surfaced as 500 so the
|
|
128
|
-
* operator sees the race signal; clients can retry. Distinct from
|
|
129
|
-
* `ERROR_ACCOUNT_NOT_FOUND` (stale token referencing a long-deleted
|
|
130
|
-
* account, raised at credential validation) and
|
|
131
|
-
* `ERROR_NO_ACTORS_ON_ACCOUNT` (the actor list enumerated empty).
|
|
132
|
-
*/
|
|
133
|
-
export declare const ERROR_ACCOUNT_VANISHED: "account_vanished";
|
|
134
143
|
/** Keeper account ID set but account row not found. */
|
|
135
144
|
export declare const ERROR_KEEPER_ACCOUNT_NOT_FOUND: "keeper_account_not_found";
|
|
136
145
|
/** Bootstrap lock already acquired — system already bootstrapped. */
|
|
137
146
|
export declare const ERROR_ALREADY_BOOTSTRAPPED: "already_bootstrapped";
|
|
138
147
|
/** Bootstrap token file not found on disk. */
|
|
139
148
|
export declare const ERROR_TOKEN_FILE_MISSING: "token_file_missing";
|
|
149
|
+
/**
|
|
150
|
+
* The bootstrap token matched, but its file couldn't be burned (deleted
|
|
151
|
+
* durably) inside the bootstrap transaction, so the bootstrap rolled back and
|
|
152
|
+
* nothing was created. A 500 with a code of its own because the operator can
|
|
153
|
+
* fix it — the server user needs write access to the token's directory — and
|
|
154
|
+
* then retry the same token: the window stays open. Twin of the Rust
|
|
155
|
+
* `BootstrapErrorKind::TokenFileUndeletable`.
|
|
156
|
+
*/
|
|
157
|
+
export declare const ERROR_TOKEN_FILE_UNDELETABLE: "token_file_undeletable";
|
|
140
158
|
/** No unclaimed invite matches the signup credentials. */
|
|
141
159
|
export declare const ERROR_NO_MATCHING_INVITE: "no_matching_invite";
|
|
142
160
|
/** Signup conflict — username or email already taken (intentionally vague for enumeration prevention). */
|
|
@@ -376,9 +394,9 @@ export declare const REST_RATE_LIMIT_EXCEEDED: RestErrorDef<429, "rate_limit_exc
|
|
|
376
394
|
}>;
|
|
377
395
|
/** The account's actors enumerated empty, a signup invariant broken. */
|
|
378
396
|
export declare const REST_NO_ACTORS_ON_ACCOUNT: RestErrorDef<500, "no_actors_on_account", Record<never, never>>;
|
|
379
|
-
/** The account or actor row was deleted between credential validation and the actor read. */
|
|
380
|
-
export declare const REST_ACCOUNT_VANISHED: RestErrorDef<500, "account_vanished", Record<never, never>>;
|
|
381
397
|
export declare const REST_INTERNAL_ERROR: RestErrorDef<500, "internal_error", Record<never, never>>;
|
|
398
|
+
/** Bootstrap's token matched and its file couldn't be burned; the bootstrap rolled back. */
|
|
399
|
+
export declare const REST_TOKEN_FILE_UNDELETABLE: RestErrorDef<500, "token_file_undeletable", Record<never, never>>;
|
|
382
400
|
export declare const REST_SERVICE_UNAVAILABLE: RestErrorDef<503, "service_unavailable", Record<never, never>>;
|
|
383
401
|
/** `GET /health`'s failed check: the database is not connected, and its type. */
|
|
384
402
|
export declare const REST_DATABASE_CONNECTION_FAILED: RestErrorDef<503, "database_connection_failed", {
|
|
@@ -416,12 +434,17 @@ export interface DeriveRouteErrorsOptions {
|
|
|
416
434
|
*
|
|
417
435
|
* Derivation rules:
|
|
418
436
|
* - **A body**, an `input` other than `null` on a method other than `GET`:
|
|
419
|
-
* 400 `invalid_request_body` and `invalid_json_body`. A `GET` reads no body
|
|
437
|
+
* 400 `invalid_request_body` and `invalid_json_body`. A `GET` reads no body:
|
|
438
|
+
* `apply_route_specs` refuses one with an input, but a surface is built from
|
|
439
|
+
* the specs alone (`generate_app_surface`), so such a spec derives none of
|
|
440
|
+
* the body's errors there either.
|
|
420
441
|
* - **`params`**: 400 `invalid_route_params`. **`query`**: 400
|
|
421
442
|
* `invalid_query_params`.
|
|
422
|
-
* - **`auth.account === 'required'`** or **`auth.actor
|
|
443
|
+
* - **`auth.account === 'required'`** or **`auth.actor !== 'none'`**: 401
|
|
423
444
|
* `authentication_required` — the pre-authorization gate's refusal when the
|
|
424
|
-
* credential isn't there
|
|
445
|
+
* credential isn't there, and the authorization phase's when the account it
|
|
446
|
+
* resolved was removed before the phase listed its actors. An optional
|
|
447
|
+
* account with no actor axis does not derive 401.
|
|
425
448
|
* - **`auth.required_scope`**: 403 `token_scope_required` (carrying
|
|
426
449
|
* `required_scope`). **`auth.credential_types?.length`**: 403
|
|
427
450
|
* `credential_type_required` (carrying `required_credential_types`).
|
|
@@ -429,9 +452,9 @@ export interface DeriveRouteErrorsOptions {
|
|
|
429
452
|
* `required_roles`). In the order the gates fire; a route with more than
|
|
430
453
|
* one has each.
|
|
431
454
|
* - **`auth.actor !== 'none'`**: 400 `actor_required` and
|
|
432
|
-
* `actor_not_on_account`, and 500 `no_actors_on_account`
|
|
433
|
-
*
|
|
434
|
-
*
|
|
455
|
+
* `actor_not_on_account`, and 500 `no_actors_on_account` — what the
|
|
456
|
+
* dispatcher's authorization phase emits when it resolves an actor (its 401
|
|
457
|
+
* is the rule above).
|
|
435
458
|
* - **`rate_limit`**: 429 `rate_limit_exceeded` (with `retry_after`).
|
|
436
459
|
* - **`POST`**: 415 `unsupported_content_type` (see
|
|
437
460
|
* `is_post_content_type_refused` in `http/simple_request.ts`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_schemas.d.ts","sourceRoot":"","sources":["../../src/lib/http/error_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAYN,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,uDAAuD;AACvD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE,2CAA2C;AAC3C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAG,kBAA2B,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAG,YAAqB,CAAC;AAItD,wCAAwC;AACxC,eAAO,MAAM,6BAA6B,EAAG,yBAAkC,CAAC;AAEhF,+CAA+C;AAC/C,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAElF;;;;;;;;GAQG;AACH,eAAO,MAAM,8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AILABLE = 'service_unavailable';
|
|
83
83
|
/** Request `Content-Length` header is not a plain run of ASCII digits. */
|
|
84
84
|
export const ERROR_INVALID_CONTENT_LENGTH = 'invalid_content_length';
|
|
85
|
+
// --- Routing: what no route answers ---
|
|
86
|
+
/**
|
|
87
|
+
* A request whose method its path doesn't serve (405, with `Allow` naming
|
|
88
|
+
* the methods it does) — `server/unmatched_route.ts`; the Rust spine's
|
|
89
|
+
* `fuz_http::METHOD_NOT_ALLOWED_REASON`.
|
|
90
|
+
*/
|
|
91
|
+
export const ERROR_METHOD_NOT_ALLOWED = 'method_not_allowed';
|
|
92
|
+
/**
|
|
93
|
+
* A path under the auth scope that no route serves (404) —
|
|
94
|
+
* `server/unmatched_route.ts`; the Rust spine's
|
|
95
|
+
* `fuz_http::ROUTE_NOT_FOUND_REASON`. Distinct from a handler's own
|
|
96
|
+
* `not_found`, so a client — or a test asking whether a route is mounted —
|
|
97
|
+
* can tell a missing route from a missing row.
|
|
98
|
+
*/
|
|
99
|
+
export const ERROR_ROUTE_NOT_FOUND = 'route_not_found';
|
|
100
|
+
/**
|
|
101
|
+
* The body of the `404` an unrouted path outside the auth scope answers, as
|
|
102
|
+
* `text/plain` — no code, since nothing outside the scope speaks the JSON
|
|
103
|
+
* error convention; the Rust spine's `fuz_actions::server::NOT_FOUND_TEXT`,
|
|
104
|
+
* byte for byte.
|
|
105
|
+
*/
|
|
106
|
+
export const NOT_FOUND_TEXT = '404 Not Found';
|
|
85
107
|
// --- Origin & bearer token verification ---
|
|
86
108
|
/** Request origin not in allowlist. */
|
|
87
109
|
export const ERROR_FORBIDDEN_ORIGIN = 'forbidden_origin';
|
|
@@ -118,22 +140,10 @@ export const ERROR_ACTOR_NOT_ON_ACCOUNT = 'actor_not_on_account';
|
|
|
118
140
|
* violation — signup / bootstrap always create an actor in the same
|
|
119
141
|
* transaction. Surfaced from the dispatcher's authorization phase as a
|
|
120
142
|
* 500 so the operator sees the corruption signal rather than a confusing
|
|
121
|
-
* 4xx.
|
|
122
|
-
*
|
|
143
|
+
* 4xx. An account removed after its credential was read reaches it too: the
|
|
144
|
+
* removal takes the account's actors with it.
|
|
123
145
|
*/
|
|
124
146
|
export const ERROR_NO_ACTORS_ON_ACCOUNT = 'no_actors_on_account';
|
|
125
|
-
/**
|
|
126
|
-
* Authentication validated an account, but a follow-up read in the
|
|
127
|
-
* authorization phase came back null — the account or its named actor
|
|
128
|
-
* row was deleted between the credential check and the dispatcher's
|
|
129
|
-
* `build_request_context` / `build_account_context` step. Torn read,
|
|
130
|
-
* not a missing-actor invariant violation. Surfaced as 500 so the
|
|
131
|
-
* operator sees the race signal; clients can retry. Distinct from
|
|
132
|
-
* `ERROR_ACCOUNT_NOT_FOUND` (stale token referencing a long-deleted
|
|
133
|
-
* account, raised at credential validation) and
|
|
134
|
-
* `ERROR_NO_ACTORS_ON_ACCOUNT` (the actor list enumerated empty).
|
|
135
|
-
*/
|
|
136
|
-
export const ERROR_ACCOUNT_VANISHED = 'account_vanished';
|
|
137
147
|
// --- Keeper / daemon token ---
|
|
138
148
|
/** Keeper account ID set but account row not found. */
|
|
139
149
|
export const ERROR_KEEPER_ACCOUNT_NOT_FOUND = 'keeper_account_not_found';
|
|
@@ -142,6 +152,15 @@ export const ERROR_KEEPER_ACCOUNT_NOT_FOUND = 'keeper_account_not_found';
|
|
|
142
152
|
export const ERROR_ALREADY_BOOTSTRAPPED = 'already_bootstrapped';
|
|
143
153
|
/** Bootstrap token file not found on disk. */
|
|
144
154
|
export const ERROR_TOKEN_FILE_MISSING = 'token_file_missing';
|
|
155
|
+
/**
|
|
156
|
+
* The bootstrap token matched, but its file couldn't be burned (deleted
|
|
157
|
+
* durably) inside the bootstrap transaction, so the bootstrap rolled back and
|
|
158
|
+
* nothing was created. A 500 with a code of its own because the operator can
|
|
159
|
+
* fix it — the server user needs write access to the token's directory — and
|
|
160
|
+
* then retry the same token: the window stays open. Twin of the Rust
|
|
161
|
+
* `BootstrapErrorKind::TokenFileUndeletable`.
|
|
162
|
+
*/
|
|
163
|
+
export const ERROR_TOKEN_FILE_UNDELETABLE = 'token_file_undeletable';
|
|
145
164
|
// --- Signup / Invites ---
|
|
146
165
|
/** No unclaimed invite matches the signup credentials. */
|
|
147
166
|
export const ERROR_NO_MATCHING_INVITE = 'no_matching_invite';
|
|
@@ -391,9 +410,9 @@ export const REST_RATE_LIMIT_EXCEEDED = rest_error(429, ERROR_RATE_LIMIT_EXCEEDE
|
|
|
391
410
|
// 500: the authorization phase, and the catch layer any route can answer with
|
|
392
411
|
/** The account's actors enumerated empty, a signup invariant broken. */
|
|
393
412
|
export const REST_NO_ACTORS_ON_ACCOUNT = rest_error(500, ERROR_NO_ACTORS_ON_ACCOUNT);
|
|
394
|
-
/** The account or actor row was deleted between credential validation and the actor read. */
|
|
395
|
-
export const REST_ACCOUNT_VANISHED = rest_error(500, ERROR_ACCOUNT_VANISHED);
|
|
396
413
|
export const REST_INTERNAL_ERROR = rest_error(500, ERROR_INTERNAL_ERROR);
|
|
414
|
+
/** Bootstrap's token matched and its file couldn't be burned; the bootstrap rolled back. */
|
|
415
|
+
export const REST_TOKEN_FILE_UNDELETABLE = rest_error(500, ERROR_TOKEN_FILE_UNDELETABLE);
|
|
397
416
|
// 503: a failed pool checkout any route can answer with, and the health and readiness checks
|
|
398
417
|
export const REST_SERVICE_UNAVAILABLE = rest_error(503, ERROR_SERVICE_UNAVAILABLE);
|
|
399
418
|
/** `GET /health`'s failed check: the database is not connected, and its type. */
|
|
@@ -414,12 +433,17 @@ export const REST_DB_UNREACHABLE = rest_error(503, ERROR_DB_UNREACHABLE);
|
|
|
414
433
|
*
|
|
415
434
|
* Derivation rules:
|
|
416
435
|
* - **A body**, an `input` other than `null` on a method other than `GET`:
|
|
417
|
-
* 400 `invalid_request_body` and `invalid_json_body`. A `GET` reads no body
|
|
436
|
+
* 400 `invalid_request_body` and `invalid_json_body`. A `GET` reads no body:
|
|
437
|
+
* `apply_route_specs` refuses one with an input, but a surface is built from
|
|
438
|
+
* the specs alone (`generate_app_surface`), so such a spec derives none of
|
|
439
|
+
* the body's errors there either.
|
|
418
440
|
* - **`params`**: 400 `invalid_route_params`. **`query`**: 400
|
|
419
441
|
* `invalid_query_params`.
|
|
420
|
-
* - **`auth.account === 'required'`** or **`auth.actor
|
|
442
|
+
* - **`auth.account === 'required'`** or **`auth.actor !== 'none'`**: 401
|
|
421
443
|
* `authentication_required` — the pre-authorization gate's refusal when the
|
|
422
|
-
* credential isn't there
|
|
444
|
+
* credential isn't there, and the authorization phase's when the account it
|
|
445
|
+
* resolved was removed before the phase listed its actors. An optional
|
|
446
|
+
* account with no actor axis does not derive 401.
|
|
423
447
|
* - **`auth.required_scope`**: 403 `token_scope_required` (carrying
|
|
424
448
|
* `required_scope`). **`auth.credential_types?.length`**: 403
|
|
425
449
|
* `credential_type_required` (carrying `required_credential_types`).
|
|
@@ -427,9 +451,9 @@ export const REST_DB_UNREACHABLE = rest_error(503, ERROR_DB_UNREACHABLE);
|
|
|
427
451
|
* `required_roles`). In the order the gates fire; a route with more than
|
|
428
452
|
* one has each.
|
|
429
453
|
* - **`auth.actor !== 'none'`**: 400 `actor_required` and
|
|
430
|
-
* `actor_not_on_account`, and 500 `no_actors_on_account`
|
|
431
|
-
*
|
|
432
|
-
*
|
|
454
|
+
* `actor_not_on_account`, and 500 `no_actors_on_account` — what the
|
|
455
|
+
* dispatcher's authorization phase emits when it resolves an actor (its 401
|
|
456
|
+
* is the rule above).
|
|
433
457
|
* - **`rate_limit`**: 429 `rate_limit_exceeded` (with `retry_after`).
|
|
434
458
|
* - **`POST`**: 415 `unsupported_content_type` (see
|
|
435
459
|
* `is_post_content_type_refused` in `http/simple_request.ts`).
|
|
@@ -439,7 +463,8 @@ export const REST_DB_UNREACHABLE = rest_error(503, ERROR_DB_UNREACHABLE);
|
|
|
439
463
|
*/
|
|
440
464
|
export const derive_route_errors = ({ method, auth, has_input = false, has_params = false, has_query = false, rate_limit }) => {
|
|
441
465
|
const defs = [];
|
|
442
|
-
//
|
|
466
|
+
// a GET reads no body — registration refuses one with an input, and a
|
|
467
|
+
// surface built without registering derives what the runtime would answer
|
|
443
468
|
if (has_input && method !== 'GET') {
|
|
444
469
|
defs.push(REST_INVALID_REQUEST_BODY, REST_INVALID_JSON_BODY);
|
|
445
470
|
}
|
|
@@ -448,13 +473,15 @@ export const derive_route_errors = ({ method, auth, has_input = false, has_param
|
|
|
448
473
|
if (has_query)
|
|
449
474
|
defs.push(REST_INVALID_QUERY_PARAMS);
|
|
450
475
|
if (needs_actor(auth)) {
|
|
451
|
-
defs.push(REST_ACTOR_REQUIRED, REST_ACTOR_NOT_ON_ACCOUNT, REST_NO_ACTORS_ON_ACCOUNT
|
|
476
|
+
defs.push(REST_ACTOR_REQUIRED, REST_ACTOR_NOT_ON_ACCOUNT, REST_NO_ACTORS_ON_ACCOUNT);
|
|
452
477
|
}
|
|
453
478
|
// 401 fires when the dispatcher's pre-authorization gate rejects an
|
|
454
479
|
// unauthenticated caller — `account === 'required'` (no credential) or
|
|
455
480
|
// `actor === 'required'` (no credential to resolve an actor against,
|
|
456
|
-
// per registry-time invariant 3 forbidding accountless actors in v1)
|
|
457
|
-
|
|
481
|
+
// per registry-time invariant 3 forbidding accountless actors in v1) — and
|
|
482
|
+
// when the authorization phase, resolving an actor, finds the account
|
|
483
|
+
// removed since its credential was read
|
|
484
|
+
if (auth.account === 'required' || needs_actor(auth)) {
|
|
458
485
|
defs.push(REST_AUTHENTICATION_REQUIRED);
|
|
459
486
|
}
|
|
460
487
|
// 403 fires from any of three gates: the token-scope refusal
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A request header as the lines the client sent — one field value per header
|
|
3
|
+
* line, in order — where the Fetch `Headers` a handler normally reads has
|
|
4
|
+
* already folded them into one string.
|
|
5
|
+
*
|
|
6
|
+
* The credential readers (`auth/credential_headers.ts`) and the gate readers
|
|
7
|
+
* (`http/request_headers.ts`) decide on the lines: a credential header sent
|
|
8
|
+
* twice is discarded, an `Origin` or `Host` sent twice is refused, and that
|
|
9
|
+
* takes knowing it was sent twice. `Headers.get` joins repeated lines with
|
|
10
|
+
* `, `, and `@hono/node-server` builds a WebSocket upgrade's `Headers` from
|
|
11
|
+
* Node's deduplicated view, which keeps only the first `Authorization`,
|
|
12
|
+
* `Host`, `Referer` or `Content-Type` line and drops every empty one — so on
|
|
13
|
+
* that path neither the join nor an empty line shows.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import type { Context } from 'hono';
|
|
18
|
+
/**
|
|
19
|
+
* Strip HTTP optional whitespace — SP and HTAB, nothing else — from both ends
|
|
20
|
+
* of a field value or a part of one. `String.prototype.trim` strips more: a
|
|
21
|
+
* header byte 0xA0 reaches a handler as U+00A0, which it counts as whitespace.
|
|
22
|
+
*
|
|
23
|
+
* @param text - a field value, or a part of one
|
|
24
|
+
* @returns `text` without its leading and trailing SP and HTAB
|
|
25
|
+
*/
|
|
26
|
+
export declare const trim_optional_whitespace: (text: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Read one request header as the lines it was sent in.
|
|
29
|
+
*
|
|
30
|
+
* On `@hono/node-server` the lines come from the request's raw header list
|
|
31
|
+
* (`c.env.incoming.rawHeaders`), so a header sent twice is two entries. A
|
|
32
|
+
* runtime with no per-line view — Bun, and an in-process `app.request` — gives
|
|
33
|
+
* the Fetch `Headers` value as the single line: repeated lines arrive already
|
|
34
|
+
* joined (`; ` for `Cookie`, `, ` otherwise), and a caller that must tell a
|
|
35
|
+
* repeat from one line reads a grammar that refuses the join.
|
|
36
|
+
*
|
|
37
|
+
* @param c - the request context
|
|
38
|
+
* @param name - the header name, in any case
|
|
39
|
+
* @returns the header's field values, outer SP and HTAB stripped, in the order sent — `[]` when the request carries no such header
|
|
40
|
+
*/
|
|
41
|
+
export declare const get_header_lines: (c: Context, name: string) => Array<string>;
|
|
42
|
+
//# sourceMappingURL=header_lines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header_lines.d.ts","sourceRoot":"","sources":["../../src/lib/http/header_lines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAiBpC;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,MAAM,MAAM,KAAG,MAMvD,CAAC;AAIF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,OAAO,EAAE,MAAM,MAAM,KAAG,KAAK,CAAC,MAAM,CAcvE,CAAC"}
|