@fuzdev/fuz_app 0.51.0 → 0.53.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 +43 -10
- package/dist/actions/action_bridge.d.ts +3 -1
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +3 -1
- package/dist/actions/action_codegen.d.ts +28 -43
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +31 -50
- package/dist/actions/action_event.d.ts +44 -1
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +44 -1
- package/dist/actions/action_event_helpers.d.ts +26 -0
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +26 -1
- package/dist/actions/action_peer.d.ts +17 -0
- package/dist/actions/action_peer.d.ts.map +1 -1
- package/dist/actions/action_peer.js +8 -9
- package/dist/actions/action_registry.d.ts +1 -5
- package/dist/actions/action_registry.d.ts.map +1 -1
- package/dist/actions/action_registry.js +5 -11
- package/dist/actions/action_rpc.d.ts +20 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +45 -20
- package/dist/actions/action_spec.d.ts +75 -6
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +36 -6
- package/dist/actions/frontend_rpc_client.d.ts +1 -9
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +1 -9
- package/dist/actions/register_action_ws.d.ts +19 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +44 -1
- package/dist/actions/register_ws_endpoint.d.ts +3 -0
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +3 -0
- package/dist/actions/request_tracker.svelte.d.ts +24 -16
- package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
- package/dist/actions/request_tracker.svelte.js +24 -16
- package/dist/actions/rpc_client.d.ts +0 -1
- package/dist/actions/rpc_client.d.ts.map +1 -1
- package/dist/actions/rpc_client.js +3 -17
- package/dist/actions/socket.svelte.d.ts +35 -16
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +33 -14
- package/dist/actions/transports.d.ts +15 -5
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +15 -15
- package/dist/actions/transports_http.d.ts +7 -0
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +7 -0
- package/dist/actions/transports_ws.d.ts +13 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +13 -0
- package/dist/actions/transports_ws_auth_guard.d.ts +6 -4
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +6 -4
- package/dist/actions/transports_ws_backend.d.ts +14 -1
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +14 -10
- package/dist/auth/CLAUDE.md +64 -18
- package/dist/auth/account_queries.d.ts +7 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +7 -0
- package/dist/auth/admin_action_specs.d.ts +5 -0
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +5 -0
- package/dist/auth/admin_actions.d.ts +1 -0
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +1 -0
- package/dist/auth/api_token_queries.d.ts +6 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +6 -0
- package/dist/auth/app_settings_queries.d.ts +4 -0
- package/dist/auth/app_settings_queries.d.ts.map +1 -1
- package/dist/auth/app_settings_queries.js +4 -0
- package/dist/auth/audit_log_queries.d.ts +5 -0
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +5 -0
- package/dist/auth/audit_log_routes.d.ts +2 -2
- package/dist/auth/audit_log_routes.js +2 -2
- package/dist/auth/audit_log_schema.d.ts +2 -0
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +134 -55
- package/dist/auth/bearer_auth.d.ts +2 -0
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +2 -0
- package/dist/auth/bootstrap_account.d.ts +3 -0
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +3 -0
- package/dist/auth/cleanup.d.ts +6 -0
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -0
- package/dist/auth/daemon_token_middleware.d.ts +4 -0
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +4 -0
- package/dist/auth/invite_queries.d.ts +3 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -0
- package/dist/auth/permit_offer_action_specs.d.ts +6 -0
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +11 -0
- package/dist/auth/permit_offer_queries.d.ts +18 -0
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +18 -0
- package/dist/auth/permit_queries.d.ts +7 -0
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +7 -0
- package/dist/auth/request_context.d.ts +1 -0
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +1 -0
- package/dist/auth/role_schema.d.ts +2 -0
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +2 -0
- package/dist/auth/self_service_role_actions.d.ts +1 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -0
- package/dist/auth/session_lifecycle.d.ts +2 -0
- package/dist/auth/session_lifecycle.d.ts.map +1 -1
- package/dist/auth/session_lifecycle.js +2 -0
- package/dist/auth/session_middleware.d.ts +1 -0
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +1 -0
- package/dist/auth/session_queries.d.ts +9 -0
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +9 -0
- package/dist/cli/config.d.ts +1 -2
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +1 -2
- package/dist/cli/daemon.d.ts +6 -1
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/daemon.js +6 -1
- package/dist/db/assert_row.d.ts +2 -1
- package/dist/db/assert_row.d.ts.map +1 -1
- package/dist/db/assert_row.js +2 -1
- package/dist/db/create_db.d.ts +3 -1
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +3 -1
- package/dist/db/db.d.ts +15 -4
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +14 -3
- package/dist/db/db_pg.d.ts +4 -3
- package/dist/db/db_pg.d.ts.map +1 -1
- package/dist/db/db_pg.js +7 -5
- package/dist/db/db_pglite.d.ts +4 -4
- package/dist/db/db_pglite.js +4 -4
- package/dist/db/migrate.d.ts +7 -4
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +5 -2
- package/dist/db/sql_identifier.d.ts +2 -1
- package/dist/db/sql_identifier.d.ts.map +1 -1
- package/dist/db/sql_identifier.js +2 -1
- package/dist/db/status.d.ts +4 -1
- package/dist/db/status.d.ts.map +1 -1
- package/dist/db/status.js +5 -2
- package/dist/dev/setup.d.ts +15 -2
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +15 -2
- package/dist/env/dotenv.d.ts +2 -1
- package/dist/env/dotenv.d.ts.map +1 -1
- package/dist/env/dotenv.js +2 -1
- package/dist/env/load.d.ts +1 -3
- package/dist/env/load.d.ts.map +1 -1
- package/dist/env/load.js +1 -3
- package/dist/env/resolve.d.ts +1 -1
- package/dist/env/resolve.js +1 -1
- package/dist/env/update_env_variable.d.ts +2 -0
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +2 -0
- package/dist/hono_context.d.ts +2 -5
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +2 -5
- package/dist/http/common_routes.d.ts +0 -8
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +0 -8
- package/dist/http/db_routes.d.ts +0 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +0 -3
- package/dist/http/error_schemas.d.ts +12 -11
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +11 -7
- package/dist/http/jsonrpc_errors.d.ts +0 -6
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +0 -6
- package/dist/http/origin.d.ts +6 -13
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +7 -14
- package/dist/http/pending_effects.d.ts +4 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +4 -0
- package/dist/http/proxy.d.ts +3 -6
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -6
- package/dist/http/route_spec.d.ts +14 -35
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +17 -22
- package/dist/http/schema_helpers.d.ts +0 -4
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +0 -4
- package/dist/http/surface.d.ts +2 -12
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +1 -12
- package/dist/rate_limiter.d.ts +30 -1
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +40 -1
- package/dist/realtime/sse.d.ts +7 -2
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +3 -2
- package/dist/realtime/sse_auth_guard.d.ts +21 -21
- package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
- package/dist/realtime/sse_auth_guard.js +24 -24
- package/dist/realtime/subscriber_registry.d.ts +4 -5
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +4 -5
- package/dist/runtime/fs.d.ts +5 -3
- package/dist/runtime/fs.d.ts.map +1 -1
- package/dist/runtime/fs.js +5 -3
- package/dist/runtime/mock.d.ts +6 -3
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +6 -3
- package/dist/server/app_backend.d.ts +1 -0
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +1 -0
- package/dist/server/app_server.d.ts +31 -5
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +23 -7
- package/dist/server/startup.d.ts +0 -2
- package/dist/server/startup.d.ts.map +1 -1
- package/dist/server/startup.js +0 -2
- package/dist/server/static.d.ts +0 -1
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +0 -1
- package/dist/server/validate_nginx.d.ts +3 -3
- package/dist/server/validate_nginx.d.ts.map +1 -1
- package/dist/server/validate_nginx.js +0 -3
- package/dist/testing/CLAUDE.md +1 -1
- package/dist/testing/admin_integration.d.ts +5 -1
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +8 -6
- package/dist/testing/adversarial_404.d.ts +0 -2
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +0 -2
- package/dist/testing/adversarial_headers.d.ts +5 -4
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +5 -4
- package/dist/testing/adversarial_input.d.ts +4 -2
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +4 -2
- package/dist/testing/app_server.d.ts +25 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +11 -2
- package/dist/testing/assertions.d.ts +23 -11
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +23 -11
- package/dist/testing/attack_surface.d.ts +0 -4
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +0 -4
- package/dist/testing/audit_completeness.d.ts +4 -1
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -1
- package/dist/testing/auth_apps.d.ts +5 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +5 -10
- package/dist/testing/data_exposure.d.ts +0 -11
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +0 -11
- package/dist/testing/db.d.ts +9 -7
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +9 -7
- package/dist/testing/error_coverage.d.ts +9 -14
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +9 -14
- package/dist/testing/integration.d.ts +4 -1
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -1
- package/dist/testing/integration_helpers.d.ts +5 -34
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +5 -41
- package/dist/testing/middleware.d.ts +5 -10
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +5 -10
- package/dist/testing/mock_fs.d.ts +0 -2
- package/dist/testing/mock_fs.d.ts.map +1 -1
- package/dist/testing/mock_fs.js +0 -2
- package/dist/testing/rate_limiting.d.ts +3 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -1
- package/dist/testing/round_trip.d.ts +0 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +0 -2
- package/dist/testing/rpc_attack_surface.d.ts +0 -2
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +0 -2
- package/dist/testing/rpc_helpers.d.ts +21 -14
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +21 -14
- package/dist/testing/rpc_round_trip.d.ts +0 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +0 -2
- package/dist/testing/schema_generators.d.ts +5 -3
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +22 -3
- package/dist/testing/sse_round_trip.d.ts +3 -1
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +3 -1
- package/dist/testing/standard.d.ts +0 -2
- package/dist/testing/standard.d.ts.map +1 -1
- package/dist/testing/standard.js +0 -2
- package/dist/testing/stubs.d.ts +8 -3
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +10 -3
- package/dist/testing/surface_invariants.d.ts +14 -3
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +14 -3
- package/dist/testing/ws_round_trip.d.ts +13 -1
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/ui/AccountSessions.svelte +9 -0
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +10 -0
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAuditLog.svelte +10 -0
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +9 -0
- package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
- package/dist/ui/AdminOverview.svelte +10 -0
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminPermitHistory.svelte +9 -0
- package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSessions.svelte +10 -0
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSettings.svelte +9 -0
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSurface.svelte +9 -0
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
- package/dist/ui/AppShell.svelte +24 -0
- package/dist/ui/AppShell.svelte.d.ts +23 -0
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/BootstrapForm.svelte +17 -0
- package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +1 -1
- package/dist/ui/ColumnLayout.svelte +11 -0
- package/dist/ui/ColumnLayout.svelte.d.ts +10 -0
- package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -1
- package/dist/ui/Datatable.svelte +18 -0
- package/dist/ui/Datatable.svelte.d.ts +17 -0
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/LoginForm.svelte +18 -0
- package/dist/ui/LoginForm.svelte.d.ts +9 -0
- package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
- package/dist/ui/LogoutButton.svelte +9 -0
- package/dist/ui/LogoutButton.svelte.d.ts +8 -0
- package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
- package/dist/ui/MenuLink.svelte +10 -0
- package/dist/ui/MenuLink.svelte.d.ts +9 -0
- package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +9 -0
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +16 -0
- package/dist/ui/SignupForm.svelte.d.ts +4 -0
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +9 -0
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +6 -1
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +7 -2
- package/dist/ui/auth_state.svelte.d.ts +16 -4
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +16 -4
- package/dist/ui/form_state.svelte.d.ts +9 -0
- package/dist/ui/form_state.svelte.d.ts.map +1 -1
- package/dist/ui/form_state.svelte.js +9 -0
- package/dist/ui/loadable.svelte.d.ts +6 -1
- package/dist/ui/loadable.svelte.d.ts.map +1 -1
- package/dist/ui/loadable.svelte.js +6 -1
- package/dist/ui/permit_offers_state.svelte.d.ts +2 -0
- package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/permit_offers_state.svelte.js +2 -0
- package/dist/ui/popover.svelte.d.ts +17 -4
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +17 -4
- package/dist/ui/position_helpers.d.ts +1 -3
- package/dist/ui/position_helpers.d.ts.map +1 -1
- package/dist/ui/position_helpers.js +1 -3
- package/dist/ui/sidebar_state.svelte.d.ts +21 -9
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
- package/dist/ui/sidebar_state.svelte.js +16 -2
- package/dist/ui/table_state.svelte.d.ts +14 -0
- package/dist/ui/table_state.svelte.d.ts.map +1 -1
- package/dist/ui/table_state.svelte.js +14 -0
- package/dist/ui/ui_fetch.d.ts +1 -7
- package/dist/ui/ui_fetch.d.ts.map +1 -1
- package/dist/ui/ui_fetch.js +1 -7
- package/dist/ui/ui_format.d.ts +2 -14
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +2 -14
- package/package.json +2 -2
package/dist/env/resolve.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare const resolve_env_vars_in_object: <T extends Record<string, unkno
|
|
|
56
56
|
* @param value - string with `$$VAR$$` references
|
|
57
57
|
* @param context - description for error message (e.g., `"target.host"`)
|
|
58
58
|
* @returns resolved string
|
|
59
|
-
* @throws
|
|
59
|
+
* @throws Error if any referenced env var is missing or empty
|
|
60
60
|
*/
|
|
61
61
|
export declare const resolve_env_vars_required: (runtime: Pick<EnvDeps, "env_get">, value: string, context: string) => string;
|
|
62
62
|
/**
|
package/dist/env/resolve.js
CHANGED
|
@@ -85,7 +85,7 @@ export const resolve_env_vars_in_object = (runtime, obj) => {
|
|
|
85
85
|
* @param value - string with `$$VAR$$` references
|
|
86
86
|
* @param context - description for error message (e.g., `"target.host"`)
|
|
87
87
|
* @returns resolved string
|
|
88
|
-
* @throws
|
|
88
|
+
* @throws Error if any referenced env var is missing or empty
|
|
89
89
|
*/
|
|
90
90
|
export const resolve_env_vars_required = (runtime, value, context) => {
|
|
91
91
|
const missing = [];
|
|
@@ -31,6 +31,8 @@ export interface UpdateEnvVariableOptions {
|
|
|
31
31
|
* @param key - the environment variable name (e.g., `'SOME_CONFIGURATION_KEY'`)
|
|
32
32
|
* @param value - the new value for the environment variable
|
|
33
33
|
* @param options - file path and optional read/write overrides
|
|
34
|
+
* @mutates filesystem - writes the updated content back to `options.env_file_path`
|
|
35
|
+
* @throws Error if the file read fails for any reason other than `ENOENT`, or if the write fails
|
|
34
36
|
*/
|
|
35
37
|
export declare const update_env_variable: (key: string, value: string, options: UpdateEnvVariableOptions) => Promise<void>;
|
|
36
38
|
//# sourceMappingURL=update_env_variable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_env_variable.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/update_env_variable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,oFAAoF;IACpF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;AAED
|
|
1
|
+
{"version":3,"file":"update_env_variable.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/update_env_variable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,oFAAoF;IACpF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,KAAK,MAAM,EACX,OAAO,MAAM,EACb,SAAS,wBAAwB,KAC/B,OAAO,CAAC,IAAI,CAmDd,CAAC"}
|
|
@@ -22,6 +22,8 @@ import { resolve } from 'node:path';
|
|
|
22
22
|
* @param key - the environment variable name (e.g., `'SOME_CONFIGURATION_KEY'`)
|
|
23
23
|
* @param value - the new value for the environment variable
|
|
24
24
|
* @param options - file path and optional read/write overrides
|
|
25
|
+
* @mutates filesystem - writes the updated content back to `options.env_file_path`
|
|
26
|
+
* @throws Error if the file read fails for any reason other than `ENOENT`, or if the write fails
|
|
25
27
|
*/
|
|
26
28
|
export const update_env_variable = async (key, value, options) => {
|
|
27
29
|
const { env_file_path, read_file = readFile, write_file = writeFile } = options;
|
package/dist/hono_context.d.ts
CHANGED
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
* Cross-cutting shared vocabulary — defines the Hono `ContextVariableMap`
|
|
5
5
|
* variables used by auth, http, server, and testing modules.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* In practice, this is auto-loaded by `server/app_server.ts` (side-effect import)
|
|
11
|
-
* and transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
|
|
7
|
+
* Auto-loaded by `server/app_server.ts` (side-effect import) and
|
|
8
|
+
* transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
|
|
12
9
|
* Consumers don't need a manual import unless bypassing the standard server assembly.
|
|
13
10
|
*
|
|
14
11
|
* @module
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono_context.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/hono_context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hono_context.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/hono_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAE9D,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,mDAAoD,CAAC;AAElF,yDAAyD;AACzD,eAAO,MAAM,cAAc;;;;EAA2B,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,qEAAqE;AACrE,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD,OAAO,QAAQ,MAAM,CAAC;IACrB,UAAU,kBAAkB;QAC3B,+DAA+D;QAC/D,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;QACvC,eAAe,EAAE,OAAO,CAAC;QACzB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,eAAe,EAAE,OAAO,CAAC;QACzB,2FAA2F;QAC3F,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;QACvC;;;;;WAKG;QACH,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;QACvC;;;;;;WAMG;QACH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC;;;;WAIG;QACH,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KACtC;CACD"}
|
package/dist/hono_context.js
CHANGED
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
* Cross-cutting shared vocabulary — defines the Hono `ContextVariableMap`
|
|
5
5
|
* variables used by auth, http, server, and testing modules.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* In practice, this is auto-loaded by `server/app_server.ts` (side-effect import)
|
|
11
|
-
* and transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
|
|
7
|
+
* Auto-loaded by `server/app_server.ts` (side-effect import) and
|
|
8
|
+
* transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
|
|
12
9
|
* Consumers don't need a manual import unless bypassing the standard server assembly.
|
|
13
10
|
*
|
|
14
11
|
* @module
|
|
@@ -13,8 +13,6 @@ import type { AppSurface } from './surface.js';
|
|
|
13
13
|
*
|
|
14
14
|
* Infrastructure endpoint for uptime monitors and load balancers.
|
|
15
15
|
* Bootstrap availability is exposed via `/api/account/status` instead.
|
|
16
|
-
*
|
|
17
|
-
* @returns a single health check route spec
|
|
18
16
|
*/
|
|
19
17
|
export declare const create_health_route_spec: () => RouteSpec;
|
|
20
18
|
/** Options for the authenticated server status route. */
|
|
@@ -29,9 +27,6 @@ export interface ServerStatusOptions {
|
|
|
29
27
|
*
|
|
30
28
|
* Returns version and uptime. Unlike the public health check,
|
|
31
29
|
* this requires authentication.
|
|
32
|
-
*
|
|
33
|
-
* @param options - version and uptime source
|
|
34
|
-
* @returns route spec for `GET /api/server/status`
|
|
35
30
|
*/
|
|
36
31
|
export declare const create_server_status_route_spec: (options: ServerStatusOptions) => RouteSpec;
|
|
37
32
|
/** Options for the surface explorer route. */
|
|
@@ -44,9 +39,6 @@ export interface SurfaceRouteOptions {
|
|
|
44
39
|
*
|
|
45
40
|
* Surface data reveals API structure (routes, auth, schemas), so this
|
|
46
41
|
* requires authentication like the server status route.
|
|
47
|
-
*
|
|
48
|
-
* @param options - surface data source
|
|
49
|
-
* @returns route spec for `GET /api/surface`
|
|
50
42
|
*/
|
|
51
43
|
export declare const create_surface_route_spec: (options: SurfaceRouteOptions) => RouteSpec;
|
|
52
44
|
//# sourceMappingURL=common_routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/common_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"common_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/common_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAO,SAQ1C,CAAC;AAEH,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IACnC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,aAAa,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,GAAI,SAAS,mBAAmB,KAAG,SAQ7E,CAAC;AAEH,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IACnC,0CAA0C;IAC1C,OAAO,EAAE,UAAU,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,mBAAmB,KAAG,SAWvE,CAAC"}
|
|
@@ -12,8 +12,6 @@ import { z } from 'zod';
|
|
|
12
12
|
*
|
|
13
13
|
* Infrastructure endpoint for uptime monitors and load balancers.
|
|
14
14
|
* Bootstrap availability is exposed via `/api/account/status` instead.
|
|
15
|
-
*
|
|
16
|
-
* @returns a single health check route spec
|
|
17
15
|
*/
|
|
18
16
|
export const create_health_route_spec = () => ({
|
|
19
17
|
method: 'GET',
|
|
@@ -29,9 +27,6 @@ export const create_health_route_spec = () => ({
|
|
|
29
27
|
*
|
|
30
28
|
* Returns version and uptime. Unlike the public health check,
|
|
31
29
|
* this requires authentication.
|
|
32
|
-
*
|
|
33
|
-
* @param options - version and uptime source
|
|
34
|
-
* @returns route spec for `GET /api/server/status`
|
|
35
30
|
*/
|
|
36
31
|
export const create_server_status_route_spec = (options) => ({
|
|
37
32
|
method: 'GET',
|
|
@@ -47,9 +42,6 @@ export const create_server_status_route_spec = (options) => ({
|
|
|
47
42
|
*
|
|
48
43
|
* Surface data reveals API structure (routes, auth, schemas), so this
|
|
49
44
|
* requires authentication like the server status route.
|
|
50
|
-
*
|
|
51
|
-
* @param options - surface data source
|
|
52
|
-
* @returns route spec for `GET /api/surface`
|
|
53
45
|
*/
|
|
54
46
|
export const create_surface_route_spec = (options) => ({
|
|
55
47
|
method: 'GET',
|
package/dist/http/db_routes.d.ts
CHANGED
|
@@ -49,9 +49,6 @@ export interface DbRouteOptions {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Create the db API route specs.
|
|
52
|
-
*
|
|
53
|
-
* @param options - route configuration (db_type, db_name, extra_stats)
|
|
54
|
-
* @returns route specs for database administration
|
|
55
52
|
*/
|
|
56
53
|
export declare const create_db_route_specs: (options: DbRouteOptions) => Array<RouteSpec>;
|
|
57
54
|
//# sourceMappingURL=db_routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAmB,KAAK,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAYjE;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED
|
|
1
|
+
{"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAmB,KAAK,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAYjE;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,cAAc,KAAG,KAAK,CAAC,SAAS,CA8N9E,CAAC"}
|
package/dist/http/db_routes.js
CHANGED
|
@@ -12,9 +12,6 @@ import { ForeignKeyError, ERROR_TABLE_NOT_FOUND, ERROR_TABLE_NO_PRIMARY_KEY, ERR
|
|
|
12
12
|
import { assert_valid_sql_identifier, VALID_SQL_IDENTIFIER } from '../db/sql_identifier.js';
|
|
13
13
|
/**
|
|
14
14
|
* Create the db API route specs.
|
|
15
|
-
*
|
|
16
|
-
* @param options - route configuration (db_type, db_name, extra_stats)
|
|
17
|
-
* @returns route specs for database administration
|
|
18
15
|
*/
|
|
19
16
|
export const create_db_route_specs = (options) => {
|
|
20
17
|
const { db_type, db_name, extra_stats, log } = options;
|
|
@@ -139,13 +139,21 @@ export type ForeignKeyError = z.infer<typeof ForeignKeyError>;
|
|
|
139
139
|
*/
|
|
140
140
|
export type RouteErrorSchemas = Partial<Record<number, z.ZodType>>;
|
|
141
141
|
/**
|
|
142
|
-
* Rate limit key type — declares what a route's rate limiter
|
|
142
|
+
* Rate limit key type — declares what a route or RPC action's rate limiter
|
|
143
|
+
* is keyed on.
|
|
143
144
|
*
|
|
144
145
|
* - `'ip'` — per-IP rate limiting (bootstrap, password change, bearer auth)
|
|
145
|
-
* - `'account'` — per-account rate limiting
|
|
146
|
-
*
|
|
146
|
+
* - `'account'` — per-account rate limiting. On REST auth routes the key is
|
|
147
|
+
* the submitted identifier (login). On RPC actions (post-auth) the key is
|
|
148
|
+
* the resolved actor id (`request_context.actor.id`) — separate namespace.
|
|
149
|
+
* - `'both'` — both keys.
|
|
147
150
|
*/
|
|
148
|
-
export
|
|
151
|
+
export declare const RateLimitKey: z.ZodEnum<{
|
|
152
|
+
account: "account";
|
|
153
|
+
ip: "ip";
|
|
154
|
+
both: "both";
|
|
155
|
+
}>;
|
|
156
|
+
export type RateLimitKey = z.infer<typeof RateLimitKey>;
|
|
149
157
|
/**
|
|
150
158
|
* Derive error schemas from a route's auth requirement, input schema, and rate limit config.
|
|
151
159
|
*
|
|
@@ -159,13 +167,6 @@ export type RateLimitKey = 'ip' | 'account' | 'both';
|
|
|
159
167
|
* - **auth: role**: 401 + 403 (with `required_role`)
|
|
160
168
|
* - **auth: keeper**: 401 + 403 (keeper-specific)
|
|
161
169
|
* - **rate_limit**: 429 (rate limit exceeded with `retry_after`)
|
|
162
|
-
*
|
|
163
|
-
* @param auth - the route's auth requirement
|
|
164
|
-
* @param has_input - whether the route has a non-null input schema
|
|
165
|
-
* @param has_params - whether the route has a params schema
|
|
166
|
-
* @param has_query - whether the route has a query schema
|
|
167
|
-
* @param rate_limit - the rate limit key type, if any
|
|
168
|
-
* @returns error schemas keyed by HTTP status code
|
|
169
170
|
*/
|
|
170
171
|
export declare const derive_error_schemas: (auth: RouteAuth, has_input: boolean, has_params?: boolean, has_query?: boolean, rate_limit?: RateLimitKey) => RouteErrorSchemas;
|
|
171
172
|
//# sourceMappingURL=error_schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/error_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAI/C,0CAA0C;AAC1C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,uDAAuD;AACvD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAI1E,wCAAwC;AACxC,eAAO,MAAM,6BAA6B,EAAG,yBAAkC,CAAC;AAEhF,+CAA+C;AAC/C,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAElF,yCAAyC;AACzC,eAAO,MAAM,yBAAyB,EAAG,qBAA8B,CAAC;AAExE,sFAAsF;AACtF,eAAO,MAAM,yBAAyB,EAAG,qBAA8B,CAAC;AAExE,qDAAqD;AACrD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAIpE,uCAAuC;AACvC,eAAO,MAAM,sBAAsB,EAAG,kBAA2B,CAAC;AAElE,wCAAwC;AACxC,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE,sEAAsE;AACtE,eAAO,MAAM,6BAA6B,EAAG,0CAAmD,CAAC;AAEjG,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,EAAG,eAAwB,CAAC;AAE5D,0CAA0C;AAC1C,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAIpE,0DAA0D;AAC1D,eAAO,MAAM,kCAAkC,EAAG,8BAA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ChC,MAAM,SAAS,EACf,WAAW,OAAO,EAClB,oBAAkB,EAClB,mBAAiB,EACjB,aAAa,YAAY,KACvB,iBA4BF,CAAC"}
|
|
@@ -132,6 +132,17 @@ export const PayloadTooLargeError = z.looseObject({
|
|
|
132
132
|
export const ForeignKeyError = z.looseObject({
|
|
133
133
|
error: z.literal(ERROR_FOREIGN_KEY_VIOLATION),
|
|
134
134
|
});
|
|
135
|
+
/**
|
|
136
|
+
* Rate limit key type — declares what a route or RPC action's rate limiter
|
|
137
|
+
* is keyed on.
|
|
138
|
+
*
|
|
139
|
+
* - `'ip'` — per-IP rate limiting (bootstrap, password change, bearer auth)
|
|
140
|
+
* - `'account'` — per-account rate limiting. On REST auth routes the key is
|
|
141
|
+
* the submitted identifier (login). On RPC actions (post-auth) the key is
|
|
142
|
+
* the resolved actor id (`request_context.actor.id`) — separate namespace.
|
|
143
|
+
* - `'both'` — both keys.
|
|
144
|
+
*/
|
|
145
|
+
export const RateLimitKey = z.enum(['ip', 'account', 'both']);
|
|
135
146
|
/**
|
|
136
147
|
* Derive error schemas from a route's auth requirement, input schema, and rate limit config.
|
|
137
148
|
*
|
|
@@ -145,13 +156,6 @@ export const ForeignKeyError = z.looseObject({
|
|
|
145
156
|
* - **auth: role**: 401 + 403 (with `required_role`)
|
|
146
157
|
* - **auth: keeper**: 401 + 403 (keeper-specific)
|
|
147
158
|
* - **rate_limit**: 429 (rate limit exceeded with `retry_after`)
|
|
148
|
-
*
|
|
149
|
-
* @param auth - the route's auth requirement
|
|
150
|
-
* @param has_input - whether the route has a non-null input schema
|
|
151
|
-
* @param has_params - whether the route has a params schema
|
|
152
|
-
* @param has_query - whether the route has a query schema
|
|
153
|
-
* @param rate_limit - the rate limit key type, if any
|
|
154
|
-
* @returns error schemas keyed by HTTP status code
|
|
155
159
|
*/
|
|
156
160
|
export const derive_error_schemas = (auth, has_input, has_params = false, has_query = false, rate_limit) => {
|
|
157
161
|
const errors = {};
|
|
@@ -98,18 +98,12 @@ export declare const HTTP_STATUS_TO_JSONRPC_ERROR_CODE: Record<number, JsonrpcEr
|
|
|
98
98
|
*
|
|
99
99
|
* Returns 500 for unrecognized codes (consumer-defined codes
|
|
100
100
|
* without a mapping default to internal server error).
|
|
101
|
-
*
|
|
102
|
-
* @param code - the JSON-RPC error code
|
|
103
|
-
* @returns the corresponding HTTP status code
|
|
104
101
|
*/
|
|
105
102
|
export declare const jsonrpc_error_code_to_http_status: (code: JsonrpcErrorCode) => number;
|
|
106
103
|
/**
|
|
107
104
|
* Map an HTTP status code to a JSON-RPC error code.
|
|
108
105
|
*
|
|
109
106
|
* Returns `internal_error` (-32603) for unrecognized status codes.
|
|
110
|
-
*
|
|
111
|
-
* @param status - the HTTP status code
|
|
112
|
-
* @returns the corresponding JSON-RPC error code
|
|
113
107
|
*/
|
|
114
108
|
export declare const http_status_to_jsonrpc_error_code: (status: number) => JsonrpcErrorCode;
|
|
115
109
|
//# sourceMappingURL=jsonrpc_errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonrpc_errors.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/jsonrpc_errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAMN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,MAAM,cAAc,CAAC;AAEtB,0CAA0C;AAC1C,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAErD,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GACzB,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,WAAW,GACX,WAAW,GACX,UAAU,GACV,kBAAkB,GAClB,cAAc,GACd,qBAAqB,GACrB,SAAS,GACT,gBAAgB,GAChB,mBAAmB,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EA0C1B,QAAQ,CAAC,MAAM,CAAC,gBAAgB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M,CAAC,MAAM,EAAE,gBAAgB,CAMzC,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,GAAI,MAAM,gBAAgB,KAAG,MAClB,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,GAAI,QAAQ,MAAM,KAAG,gBACa,CAAC"}
|
|
@@ -243,17 +243,11 @@ export const HTTP_STATUS_TO_JSONRPC_ERROR_CODE = Object.fromEntries(Object.entri
|
|
|
243
243
|
*
|
|
244
244
|
* Returns 500 for unrecognized codes (consumer-defined codes
|
|
245
245
|
* without a mapping default to internal server error).
|
|
246
|
-
*
|
|
247
|
-
* @param code - the JSON-RPC error code
|
|
248
|
-
* @returns the corresponding HTTP status code
|
|
249
246
|
*/
|
|
250
247
|
export const jsonrpc_error_code_to_http_status = (code) => JSONRPC_ERROR_CODE_TO_HTTP_STATUS[code] ?? 500;
|
|
251
248
|
/**
|
|
252
249
|
* Map an HTTP status code to a JSON-RPC error code.
|
|
253
250
|
*
|
|
254
251
|
* Returns `internal_error` (-32603) for unrecognized status codes.
|
|
255
|
-
*
|
|
256
|
-
* @param status - the HTTP status code
|
|
257
|
-
* @returns the corresponding JSON-RPC error code
|
|
258
252
|
*/
|
|
259
253
|
export const http_status_to_jsonrpc_error_code = (status) => HTTP_STATUS_TO_JSONRPC_ERROR_CODE[status] ?? JSONRPC_ERROR_CODES.internal_error;
|
package/dist/http/origin.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import type { Handler } from 'hono';
|
|
|
28
28
|
* - `https://*.api.fuz.dev,http://127.0.0.1:*`
|
|
29
29
|
* - `http://[::1]:*,https://*.*.corp.fuz.dev:*`
|
|
30
30
|
*
|
|
31
|
-
* @throws if any individual pattern is invalid (missing protocol, partial wildcards, etc.)
|
|
31
|
+
* @throws Error if any individual pattern is invalid (missing protocol, partial wildcards, etc.)
|
|
32
32
|
*/
|
|
33
33
|
export declare const parse_allowed_origins: (env_value: string | undefined) => Array<RegExp>;
|
|
34
34
|
/**
|
|
@@ -39,19 +39,12 @@ export declare const should_allow_origin: (origin: string, allowed_patterns: Arr
|
|
|
39
39
|
/**
|
|
40
40
|
* Middleware that verifies the request source against an allowlist.
|
|
41
41
|
*
|
|
42
|
-
* Origin allowlisting (not the CSRF layer — that's `SameSite: strict` cookies)
|
|
43
|
-
* - Checks the Origin header first (if present)
|
|
44
|
-
* - Falls back to Referer header (if no Origin)
|
|
45
|
-
* - Allows requests without Origin
|
|
42
|
+
* Origin allowlisting (not the CSRF layer — that's `SameSite: strict` cookies):
|
|
43
|
+
* - Checks the `Origin` header first (if present)
|
|
44
|
+
* - Falls back to `Referer` header (if no `Origin`)
|
|
45
|
+
* - Allows requests without `Origin`/`Referer` headers (direct access, curl, etc.)
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
* - Protecting locally-running services from being called by
|
|
49
|
-
* untrusted websites as the user browses the web
|
|
50
|
-
* - Restricting which domains can make requests to your API
|
|
51
|
-
* - Preventing embedding of your service in unexpected sites
|
|
52
|
-
* - Basic source verification for locally-running services
|
|
53
|
-
*
|
|
54
|
-
* @param allowed_patterns - array of compiled regex patterns from parse_allowed_origins
|
|
47
|
+
* @param allowed_patterns - compiled regex patterns from `parse_allowed_origins`
|
|
55
48
|
*/
|
|
56
49
|
export declare const verify_request_source: (allowed_patterns: Array<RegExp>) => Handler;
|
|
57
50
|
//# sourceMappingURL=origin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAIlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,GAAG,SAAS,KAAG,KAAK,CAAC,MAAM,CAO5E,CAAC;AAEP;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,EAAE,kBAAkB,KAAK,CAAC,MAAM,CAAC,KAAG,OACzC,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"origin.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAIlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,GAAG,SAAS,KAAG,KAAK,CAAC,MAAM,CAO5E,CAAC;AAEP;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,EAAE,kBAAkB,KAAK,CAAC,MAAM,CAAC,KAAG,OACzC,CAAC;AAE9C;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GAChC,kBAAkB,KAAK,CAAC,MAAM,CAAC,KAAG,OA2BlC,CAAC"}
|
package/dist/http/origin.js
CHANGED
|
@@ -29,7 +29,7 @@ import { ERROR_FORBIDDEN_ORIGIN, ERROR_FORBIDDEN_REFERER } from './error_schemas
|
|
|
29
29
|
* - `https://*.api.fuz.dev,http://127.0.0.1:*`
|
|
30
30
|
* - `http://[::1]:*,https://*.*.corp.fuz.dev:*`
|
|
31
31
|
*
|
|
32
|
-
* @throws if any individual pattern is invalid (missing protocol, partial wildcards, etc.)
|
|
32
|
+
* @throws Error if any individual pattern is invalid (missing protocol, partial wildcards, etc.)
|
|
33
33
|
*/
|
|
34
34
|
export const parse_allowed_origins = (env_value) => env_value
|
|
35
35
|
? env_value
|
|
@@ -46,19 +46,12 @@ export const should_allow_origin = (origin, allowed_patterns) => allowed_pattern
|
|
|
46
46
|
/**
|
|
47
47
|
* Middleware that verifies the request source against an allowlist.
|
|
48
48
|
*
|
|
49
|
-
* Origin allowlisting (not the CSRF layer — that's `SameSite: strict` cookies)
|
|
50
|
-
* - Checks the Origin header first (if present)
|
|
51
|
-
* - Falls back to Referer header (if no Origin)
|
|
52
|
-
* - Allows requests without Origin
|
|
49
|
+
* Origin allowlisting (not the CSRF layer — that's `SameSite: strict` cookies):
|
|
50
|
+
* - Checks the `Origin` header first (if present)
|
|
51
|
+
* - Falls back to `Referer` header (if no `Origin`)
|
|
52
|
+
* - Allows requests without `Origin`/`Referer` headers (direct access, curl, etc.)
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
* - Protecting locally-running services from being called by
|
|
56
|
-
* untrusted websites as the user browses the web
|
|
57
|
-
* - Restricting which domains can make requests to your API
|
|
58
|
-
* - Preventing embedding of your service in unexpected sites
|
|
59
|
-
* - Basic source verification for locally-running services
|
|
60
|
-
*
|
|
61
|
-
* @param allowed_patterns - array of compiled regex patterns from parse_allowed_origins
|
|
54
|
+
* @param allowed_patterns - compiled regex patterns from `parse_allowed_origins`
|
|
62
55
|
*/
|
|
63
56
|
export const verify_request_source = (allowed_patterns) => (c, next) => {
|
|
64
57
|
// Check origin header (preferred, sent by browsers for CORS requests).
|
|
@@ -106,7 +99,7 @@ export const verify_request_source = (allowed_patterns) => (c, next) => {
|
|
|
106
99
|
* like `[::ffff:127.0.0.1]` will be normalized to `[::ffff:7f00:1]`. IPv6 zone
|
|
107
100
|
* identifiers (e.g., `%eth0`) are not supported.
|
|
108
101
|
*
|
|
109
|
-
* @throws if pattern format is invalid
|
|
102
|
+
* @throws Error if pattern format is invalid
|
|
110
103
|
*/
|
|
111
104
|
const origin_pattern_to_regexp = (pattern) => {
|
|
112
105
|
// Quick validation: no paths, query strings, or fragments allowed
|
|
@@ -24,6 +24,10 @@ export interface PendingEffectsContext {
|
|
|
24
24
|
* Exceptions thrown by `fn` are caught and logged via `ctx.log.error`, so one
|
|
25
25
|
* failed send cannot corrupt the already-committed response or starve other
|
|
26
26
|
* queued effects in the same tick.
|
|
27
|
+
*
|
|
28
|
+
* @param ctx - context carrying `log` and the `pending_effects` queue
|
|
29
|
+
* @param fn - synchronous side effect to run after commit
|
|
30
|
+
* @mutates `ctx.pending_effects` - appends a never-rejecting promise wrapping `fn`
|
|
27
31
|
*/
|
|
28
32
|
export declare const emit_after_commit: (ctx: PendingEffectsContext, fn: () => void) => void;
|
|
29
33
|
//# sourceMappingURL=pending_effects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pending_effects.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/pending_effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,kEAAkE;AAClE,MAAM,WAAW,qBAAqB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CACtC;AAED
|
|
1
|
+
{"version":3,"file":"pending_effects.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/pending_effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,kEAAkE;AAClE,MAAM,WAAW,qBAAqB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CACtC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,qBAAqB,EAAE,IAAI,MAAM,IAAI,KAAG,IAU9E,CAAC"}
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
* Exceptions thrown by `fn` are caught and logged via `ctx.log.error`, so one
|
|
19
19
|
* failed send cannot corrupt the already-committed response or starve other
|
|
20
20
|
* queued effects in the same tick.
|
|
21
|
+
*
|
|
22
|
+
* @param ctx - context carrying `log` and the `pending_effects` queue
|
|
23
|
+
* @param fn - synchronous side effect to run after commit
|
|
24
|
+
* @mutates `ctx.pending_effects` - appends a never-rejecting promise wrapping `fn`
|
|
21
25
|
*/
|
|
22
26
|
export const emit_after_commit = (ctx, fn) => {
|
|
23
27
|
ctx.pending_effects.push(Promise.resolve().then(() => {
|
package/dist/http/proxy.d.ts
CHANGED
|
@@ -18,8 +18,6 @@ import type { MiddlewareSpec } from './middleware_spec.js';
|
|
|
18
18
|
* - Lowercases for case-insensitive IPv6 comparison
|
|
19
19
|
* - Idempotent: calling twice produces the same result
|
|
20
20
|
* - Safe on non-IP strings: `normalize_ip('unknown')` returns `'unknown'`
|
|
21
|
-
*
|
|
22
|
-
* @param ip - IP address string to normalize
|
|
23
21
|
*/
|
|
24
22
|
export declare const normalize_ip: (ip: string) => string;
|
|
25
23
|
/**
|
|
@@ -53,16 +51,13 @@ export type ParsedProxy = {
|
|
|
53
51
|
* CIDR prefixes are validated against address family bounds.
|
|
54
52
|
*
|
|
55
53
|
* @param entry - IP address or CIDR notation
|
|
56
|
-
* @throws on invalid IP, invalid CIDR network, or NaN/negative/over-range prefix
|
|
54
|
+
* @throws Error on invalid IP, invalid CIDR network, or NaN/negative/over-range prefix
|
|
57
55
|
*/
|
|
58
56
|
export declare const parse_proxy_entry: (entry: string) => ParsedProxy;
|
|
59
57
|
/**
|
|
60
58
|
* Check whether `ip` matches any entry in the trusted proxy list.
|
|
61
59
|
*
|
|
62
60
|
* Normalizes `ip` before matching (lowercase, IPv4-mapped IPv6 stripped).
|
|
63
|
-
*
|
|
64
|
-
* @param ip - the IP address to check
|
|
65
|
-
* @param proxies - parsed proxy entries
|
|
66
61
|
*/
|
|
67
62
|
export declare const is_trusted_ip: (ip: string, proxies: Array<ParsedProxy>) => boolean;
|
|
68
63
|
/**
|
|
@@ -92,6 +87,8 @@ export declare const resolve_client_ip: (forwarded_for: string, proxies: Array<P
|
|
|
92
87
|
* right-to-left, strip trusted entries, use first untrusted entry.
|
|
93
88
|
*
|
|
94
89
|
* @param options - trusted proxy configuration
|
|
90
|
+
* @mutates `c.var.client_ip` - set to the resolved (or `'unknown'`) client IP per request
|
|
91
|
+
* @throws Error if any entry in `options.trusted_proxies` is invalid (parsed eagerly via `parse_proxy_entry`)
|
|
95
92
|
*/
|
|
96
93
|
export declare const create_proxy_middleware: (options: ProxyOptions) => MiddlewareHandler;
|
|
97
94
|
/**
|
package/dist/http/proxy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAErD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAErD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAEzD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,KAAG,MAQzC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,sFAAsF;IACtF,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,+DAA+D;IAC/D,iBAAiB,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IACtD,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GACpB;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GAC7B;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,CAAC;AAElF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,KAAG,WA6CjD,CAAC;AAiBF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,EAAE,SAAS,KAAK,CAAC,WAAW,CAAC,KAAG,OAqBvE,CAAC;AAQF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAC7B,eAAe,MAAM,EACrB,SAAS,KAAK,CAAC,WAAW,CAAC,KACzB,MAAM,GAAG,SAiBX,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,YAAY,KAAG,iBAyC/D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,YAAY,KAAG,cAInE,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,GAAG,OAAO,KAAG,MAAyC,CAAC"}
|
package/dist/http/proxy.js
CHANGED
|
@@ -16,8 +16,6 @@ import { convertIPv4ToBinary, convertIPv6ToBinary, distinctRemoteAddr } from 'ho
|
|
|
16
16
|
* - Lowercases for case-insensitive IPv6 comparison
|
|
17
17
|
* - Idempotent: calling twice produces the same result
|
|
18
18
|
* - Safe on non-IP strings: `normalize_ip('unknown')` returns `'unknown'`
|
|
19
|
-
*
|
|
20
|
-
* @param ip - IP address string to normalize
|
|
21
19
|
*/
|
|
22
20
|
export const normalize_ip = (ip) => {
|
|
23
21
|
const lowered = ip.toLowerCase();
|
|
@@ -36,7 +34,7 @@ export const normalize_ip = (ip) => {
|
|
|
36
34
|
* CIDR prefixes are validated against address family bounds.
|
|
37
35
|
*
|
|
38
36
|
* @param entry - IP address or CIDR notation
|
|
39
|
-
* @throws on invalid IP, invalid CIDR network, or NaN/negative/over-range prefix
|
|
37
|
+
* @throws Error on invalid IP, invalid CIDR network, or NaN/negative/over-range prefix
|
|
40
38
|
*/
|
|
41
39
|
export const parse_proxy_entry = (entry) => {
|
|
42
40
|
const slash_index = entry.indexOf('/');
|
|
@@ -97,9 +95,6 @@ const cidr_contains = (ip_binary, network, prefix, total_bits) => {
|
|
|
97
95
|
* Check whether `ip` matches any entry in the trusted proxy list.
|
|
98
96
|
*
|
|
99
97
|
* Normalizes `ip` before matching (lowercase, IPv4-mapped IPv6 stripped).
|
|
100
|
-
*
|
|
101
|
-
* @param ip - the IP address to check
|
|
102
|
-
* @param proxies - parsed proxy entries
|
|
103
98
|
*/
|
|
104
99
|
export const is_trusted_ip = (ip, proxies) => {
|
|
105
100
|
const normalized = normalize_ip(ip);
|
|
@@ -176,6 +171,8 @@ export const resolve_client_ip = (forwarded_for, proxies) => {
|
|
|
176
171
|
* right-to-left, strip trusted entries, use first untrusted entry.
|
|
177
172
|
*
|
|
178
173
|
* @param options - trusted proxy configuration
|
|
174
|
+
* @mutates `c.var.client_ip` - set to the resolved (or `'unknown'`) client IP per request
|
|
175
|
+
* @throws Error if any entry in `options.trusted_proxies` is invalid (parsed eagerly via `parse_proxy_entry`)
|
|
179
176
|
*/
|
|
180
177
|
export const create_proxy_middleware = (options) => {
|
|
181
178
|
const parsed_proxies = options.trusted_proxies.map(parse_proxy_entry);
|