@fuzdev/fuz_app 0.50.0 → 0.52.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 +16 -3
- 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 +44 -13
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +58 -20
- 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 -0
- package/dist/actions/action_registry.d.ts +2 -2
- package/dist/actions/action_registry.js +2 -2
- package/dist/actions/action_rpc.d.ts +4 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +4 -0
- package/dist/actions/action_spec.d.ts +23 -3
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +17 -3
- package/dist/actions/action_types.d.ts +2 -2
- package/dist/actions/action_types.js +2 -2
- package/dist/actions/cancel.d.ts +2 -2
- package/dist/actions/cancel.js +2 -2
- package/dist/actions/heartbeat.d.ts +2 -2
- package/dist/actions/heartbeat.js +2 -2
- package/dist/actions/protocol.d.ts +1 -1
- package/dist/actions/protocol.js +1 -1
- package/dist/actions/register_action_ws.d.ts +4 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +4 -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 +14 -1
- package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
- package/dist/actions/request_tracker.svelte.js +14 -1
- package/dist/actions/socket.svelte.d.ts +35 -15
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +33 -13
- package/dist/actions/transports.d.ts +12 -3
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +16 -7
- 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 -2
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +6 -2
- 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 -1
- package/dist/auth/CLAUDE.md +40 -4
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +10 -0
- package/dist/auth/account_routes.d.ts +3 -3
- package/dist/auth/account_routes.js +3 -3
- package/dist/auth/account_schema.d.ts +1 -1
- package/dist/auth/account_schema.js +1 -1
- 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.d.ts +1 -1
- package/dist/auth/api_token.js +1 -1
- package/dist/auth/api_token_queries.d.ts +7 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +7 -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 +6 -0
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +6 -0
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.js +1 -1
- package/dist/auth/audit_log_schema.d.ts +3 -1
- 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.d.ts +1 -1
- package/dist/auth/daemon_token.js +1 -1
- package/dist/auth/daemon_token_middleware.d.ts +5 -1
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +5 -1
- package/dist/auth/ddl.d.ts +1 -1
- package/dist/auth/ddl.js +1 -1
- package/dist/auth/invite_queries.d.ts +4 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +4 -0
- package/dist/auth/password.d.ts +1 -1
- package/dist/auth/password.js +1 -1
- package/dist/auth/permit_offer_action_specs.d.ts +5 -0
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +10 -0
- package/dist/auth/permit_offer_queries.d.ts +19 -0
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +19 -0
- package/dist/auth/permit_queries.d.ts +8 -0
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +8 -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/route_guards.d.ts +1 -1
- package/dist/auth/route_guards.js +1 -1
- package/dist/auth/self_service_role_action_specs.d.ts +1 -1
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +2 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +2 -1
- package/dist/auth/session_lifecycle.d.ts +3 -0
- package/dist/auth/session_lifecycle.d.ts.map +1 -1
- package/dist/auth/session_lifecycle.js +3 -0
- package/dist/auth/session_middleware.d.ts +5 -0
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +5 -0
- package/dist/auth/session_queries.d.ts +10 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +10 -1
- package/dist/auth/signup_routes.d.ts +1 -1
- package/dist/auth/signup_routes.js +1 -1
- package/dist/cli/config.d.ts +2 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +2 -0
- 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/cli/util.d.ts +1 -1
- package/dist/cli/util.js +1 -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 +5 -2
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +5 -2
- package/dist/db/db.d.ts +22 -7
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +21 -6
- package/dist/db/db_pg.d.ts +2 -1
- package/dist/db/db_pg.d.ts.map +1 -1
- package/dist/db/db_pg.js +5 -3
- package/dist/db/db_pglite.d.ts +3 -2
- package/dist/db/db_pglite.d.ts.map +1 -1
- package/dist/db/db_pglite.js +3 -2
- package/dist/db/migrate.d.ts +8 -4
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +6 -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 +18 -2
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +18 -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 -1
- package/dist/env/load.js +1 -1
- 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 +1 -1
- package/dist/hono_context.js +1 -1
- package/dist/http/jsonrpc_errors.d.ts +2 -2
- package/dist/http/jsonrpc_errors.js +2 -2
- package/dist/http/jsonrpc_helpers.d.ts +2 -2
- package/dist/http/jsonrpc_helpers.js +2 -2
- package/dist/http/middleware_spec.d.ts +1 -1
- package/dist/http/middleware_spec.js +1 -1
- package/dist/http/origin.d.ts +1 -1
- package/dist/http/origin.js +1 -1
- 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 -0
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -0
- package/dist/http/route_spec.d.ts +1 -0
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +7 -0
- package/dist/http/schema_helpers.d.ts +1 -1
- package/dist/http/schema_helpers.js +1 -1
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.js +1 -1
- package/dist/rate_limiter.d.ts +14 -1
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +14 -1
- package/dist/realtime/sse.d.ts +7 -1
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +3 -1
- 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 -2
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +4 -2
- package/dist/runtime/deno.d.ts +1 -1
- package/dist/runtime/deno.js +1 -1
- package/dist/runtime/fs.d.ts +5 -0
- package/dist/runtime/fs.d.ts.map +1 -1
- package/dist/runtime/fs.js +5 -0
- package/dist/runtime/mock.d.ts +6 -0
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +6 -0
- package/dist/runtime/node.d.ts +1 -1
- package/dist/runtime/node.js +1 -1
- 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 +4 -0
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +4 -0
- package/dist/server/validate_nginx.d.ts +3 -0
- package/dist/server/validate_nginx.d.ts.map +1 -1
- package/dist/testing/admin_integration.d.ts +5 -0
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +5 -0
- package/dist/testing/adversarial_headers.d.ts +5 -3
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +5 -3
- package/dist/testing/adversarial_input.d.ts +4 -0
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +4 -0
- package/dist/testing/app_server.d.ts +3 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +11 -0
- package/dist/testing/assertions.d.ts +23 -7
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +23 -7
- package/dist/testing/audit_completeness.d.ts +4 -0
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -0
- package/dist/testing/auth_apps.d.ts +3 -0
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +3 -0
- package/dist/testing/db.d.ts +9 -1
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +9 -1
- package/dist/testing/error_coverage.d.ts +9 -0
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +9 -0
- package/dist/testing/integration.d.ts +4 -0
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -0
- package/dist/testing/integration_helpers.d.ts +10 -4
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +10 -4
- package/dist/testing/middleware.d.ts +5 -0
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +5 -0
- package/dist/testing/rate_limiting.d.ts +3 -0
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -0
- package/dist/testing/rpc_attack_surface.js +1 -1
- package/dist/testing/rpc_helpers.d.ts +21 -8
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +22 -9
- package/dist/testing/schema_generators.d.ts +7 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +7 -2
- package/dist/testing/sse_round_trip.d.ts +3 -0
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +3 -0
- package/dist/testing/stubs.d.ts +7 -0
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +7 -0
- package/dist/testing/surface_invariants.d.ts +14 -0
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +14 -0
- package/dist/testing/ws_round_trip.d.ts +13 -1
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +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/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/account_sessions_state.svelte.d.ts +2 -2
- package/dist/ui/account_sessions_state.svelte.js +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +1 -1
- package/dist/ui/admin_rpc_adapters.js +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 +6 -1
- 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 -0
- package/dist/ui/position_helpers.d.ts.map +1 -1
- package/dist/ui/position_helpers.js +1 -0
- package/dist/ui/sidebar_state.svelte.d.ts +22 -9
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
- package/dist/ui/sidebar_state.svelte.js +17 -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/package.json +1 -1
package/dist/dev/setup.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export declare const parse_db_name: (url: string) => string | null;
|
|
|
90
90
|
*
|
|
91
91
|
* @param deps - command execution capability
|
|
92
92
|
* @returns a random 32-byte base64-encoded key
|
|
93
|
+
* @throws Error if `openssl rand` fails or is unavailable
|
|
93
94
|
*/
|
|
94
95
|
export declare const generate_random_key: (deps: CommandDeps) => Promise<string>;
|
|
95
96
|
/**
|
|
@@ -112,6 +113,8 @@ export declare const read_env_var: (deps: Pick<FsReadDeps, "stat" | "read_text_f
|
|
|
112
113
|
* @param example_path - path to the example template
|
|
113
114
|
* @param options - extra replacements, permissions, logger
|
|
114
115
|
* @returns result indicating whether the file was created or updated
|
|
116
|
+
* @mutates filesystem - writes `env_path` (creating from `example_path` if missing) and optionally chmods to `0o600`
|
|
117
|
+
* @throws Error if `example_path` cannot be read when `env_path` is missing, or if a generator / write fails
|
|
115
118
|
*/
|
|
116
119
|
export declare const setup_env_file: (deps: FsReadDeps & FsWriteDeps & CommandDeps, env_path: string, example_path: string, options?: SetupEnvOptions) => Promise<SetupEnvResult>;
|
|
117
120
|
/**
|
|
@@ -124,6 +127,8 @@ export declare const setup_env_file: (deps: FsReadDeps & FsWriteDeps & CommandDe
|
|
|
124
127
|
* @param app_name - application name (used for default state directory)
|
|
125
128
|
* @param options - state_dir override, permissions, logger
|
|
126
129
|
* @returns result indicating whether a token was created
|
|
130
|
+
* @mutates filesystem - creates state directory and writes the token file (optionally chmods to `0o700` / `0o600`)
|
|
131
|
+
* @throws Error if `mkdir`, key generation, or `write_text_file` fails
|
|
127
132
|
*/
|
|
128
133
|
export declare const setup_bootstrap_token: (deps: FsReadDeps & FsWriteDeps & CommandDeps & EnvDeps, app_name: string, options?: SetupBootstrapTokenOptions) => Promise<SetupTokenResult>;
|
|
129
134
|
/**
|
|
@@ -133,15 +138,21 @@ export declare const setup_bootstrap_token: (deps: FsReadDeps & FsWriteDeps & Co
|
|
|
133
138
|
* @param app_name - application name
|
|
134
139
|
* @param options - state_dir override, permissions, logger
|
|
135
140
|
* @returns result from creating the new token
|
|
141
|
+
* @mutates filesystem - removes the existing token file (if any) then writes a fresh one
|
|
142
|
+
* @throws Error if `remove` or the underlying `setup_bootstrap_token` call fails
|
|
136
143
|
*/
|
|
137
144
|
export declare const reset_bootstrap_token: (deps: FsReadDeps & FsWriteDeps & FsRemoveDeps & CommandDeps & EnvDeps, app_name: string, options?: SetupBootstrapTokenOptions) => Promise<SetupTokenResult>;
|
|
138
145
|
/**
|
|
139
146
|
* Create a PostgreSQL database if `createdb` is available.
|
|
140
147
|
*
|
|
148
|
+
* Does not throw — returns the underlying command result so callers can
|
|
149
|
+
* decide how to react to a missing `createdb` or an "already exists" failure.
|
|
150
|
+
*
|
|
141
151
|
* @param deps - command execution capability
|
|
142
152
|
* @param db_name - database name to create
|
|
143
153
|
* @param options - logger
|
|
144
154
|
* @returns the command result
|
|
155
|
+
* @mutates external database - invokes `createdb` to create `db_name` when available
|
|
145
156
|
*/
|
|
146
157
|
export declare const create_database: (deps: CommandDeps, db_name: string, options?: CreateDatabaseOptions) => Promise<CommandResult>;
|
|
147
158
|
/**
|
|
@@ -152,9 +163,11 @@ export declare const create_database: (deps: CommandDeps, db_name: string, optio
|
|
|
152
163
|
* For empty/missing URLs: skips.
|
|
153
164
|
*
|
|
154
165
|
* @param deps - command and file capabilities
|
|
155
|
-
* @param database_url - the DATABASE_URL value
|
|
156
|
-
* @param options - pglite_data_dir
|
|
166
|
+
* @param database_url - the `DATABASE_URL` value
|
|
167
|
+
* @param options - `pglite_data_dir`, logger
|
|
157
168
|
* @returns result describing what happened
|
|
169
|
+
* @mutates external database - drops and recreates the PostgreSQL database, or removes the PGlite data directory
|
|
170
|
+
* @mutates filesystem - removes `options.pglite_data_dir` recursively for PGlite URLs
|
|
158
171
|
*/
|
|
159
172
|
export declare const reset_database: (deps: CommandDeps & FsReadDeps & FsRemoveDeps, database_url: string, options?: ResetDatabaseOptions) => Promise<ResetDbResult>;
|
|
160
173
|
/** Input to `seed_dev_account`. */
|
|
@@ -186,6 +199,9 @@ export interface SeedDevAccountDeps extends QueryDeps {
|
|
|
186
199
|
* updates an existing password (rerun would silently rotate it).
|
|
187
200
|
*
|
|
188
201
|
* Intended for `scripts/dev_setup.ts` — do not call in production.
|
|
202
|
+
*
|
|
203
|
+
* @mutates database - inserts an account/actor pair when missing and grants any requested role permits
|
|
204
|
+
* @throws Error if an existing account is found without an associated actor row
|
|
189
205
|
*/
|
|
190
206
|
export declare const seed_dev_account: (deps: SeedDevAccountDeps, input: SeedDevAccountInput, options?: {
|
|
191
207
|
log?: SetupLogger;
|
package/dist/dev/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/dev/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,aAAa,EACb,OAAO,EACP,UAAU,EACV,YAAY,EACZ,WAAW,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAQnD;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,2CAA2C;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B;AAED,2CAA2C;AAC3C,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACpD,oEAAoE;IACpE,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACrD;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAC5B,MAAM,kBAAkB,EACxB,OAAO,mBAAmB,EAC1B,UAAU;IAAC,GAAG,CAAC,EAAE,WAAW,CAAA;CAAC,KAC3B,OAAO,CAAC,oBAAoB,CAsC9B,CAAC"}
|
package/dist/dev/setup.js
CHANGED
|
@@ -37,6 +37,7 @@ export const parse_db_name = (url) => {
|
|
|
37
37
|
*
|
|
38
38
|
* @param deps - command execution capability
|
|
39
39
|
* @returns a random 32-byte base64-encoded key
|
|
40
|
+
* @throws Error if `openssl rand` fails or is unavailable
|
|
40
41
|
*/
|
|
41
42
|
export const generate_random_key = async (deps) => {
|
|
42
43
|
const result = await deps.run_command('openssl', ['rand', '-base64', '32']);
|
|
@@ -78,6 +79,8 @@ export const read_env_var = async (deps, env_path, name) => {
|
|
|
78
79
|
* @param example_path - path to the example template
|
|
79
80
|
* @param options - extra replacements, permissions, logger
|
|
80
81
|
* @returns result indicating whether the file was created or updated
|
|
82
|
+
* @mutates filesystem - writes `env_path` (creating from `example_path` if missing) and optionally chmods to `0o600`
|
|
83
|
+
* @throws Error if `example_path` cannot be read when `env_path` is missing, or if a generator / write fails
|
|
81
84
|
*/
|
|
82
85
|
export const setup_env_file = async (deps, env_path, example_path, options) => {
|
|
83
86
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -136,6 +139,8 @@ export const setup_env_file = async (deps, env_path, example_path, options) => {
|
|
|
136
139
|
* @param app_name - application name (used for default state directory)
|
|
137
140
|
* @param options - state_dir override, permissions, logger
|
|
138
141
|
* @returns result indicating whether a token was created
|
|
142
|
+
* @mutates filesystem - creates state directory and writes the token file (optionally chmods to `0o700` / `0o600`)
|
|
143
|
+
* @throws Error if `mkdir`, key generation, or `write_text_file` fails
|
|
139
144
|
*/
|
|
140
145
|
export const setup_bootstrap_token = async (deps, app_name, options) => {
|
|
141
146
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -169,6 +174,8 @@ export const setup_bootstrap_token = async (deps, app_name, options) => {
|
|
|
169
174
|
* @param app_name - application name
|
|
170
175
|
* @param options - state_dir override, permissions, logger
|
|
171
176
|
* @returns result from creating the new token
|
|
177
|
+
* @mutates filesystem - removes the existing token file (if any) then writes a fresh one
|
|
178
|
+
* @throws Error if `remove` or the underlying `setup_bootstrap_token` call fails
|
|
172
179
|
*/
|
|
173
180
|
export const reset_bootstrap_token = async (deps, app_name, options) => {
|
|
174
181
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -191,10 +198,14 @@ export const reset_bootstrap_token = async (deps, app_name, options) => {
|
|
|
191
198
|
/**
|
|
192
199
|
* Create a PostgreSQL database if `createdb` is available.
|
|
193
200
|
*
|
|
201
|
+
* Does not throw — returns the underlying command result so callers can
|
|
202
|
+
* decide how to react to a missing `createdb` or an "already exists" failure.
|
|
203
|
+
*
|
|
194
204
|
* @param deps - command execution capability
|
|
195
205
|
* @param db_name - database name to create
|
|
196
206
|
* @param options - logger
|
|
197
207
|
* @returns the command result
|
|
208
|
+
* @mutates external database - invokes `createdb` to create `db_name` when available
|
|
198
209
|
*/
|
|
199
210
|
export const create_database = async (deps, db_name, options) => {
|
|
200
211
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -220,9 +231,11 @@ export const create_database = async (deps, db_name, options) => {
|
|
|
220
231
|
* For empty/missing URLs: skips.
|
|
221
232
|
*
|
|
222
233
|
* @param deps - command and file capabilities
|
|
223
|
-
* @param database_url - the DATABASE_URL value
|
|
224
|
-
* @param options - pglite_data_dir
|
|
234
|
+
* @param database_url - the `DATABASE_URL` value
|
|
235
|
+
* @param options - `pglite_data_dir`, logger
|
|
225
236
|
* @returns result describing what happened
|
|
237
|
+
* @mutates external database - drops and recreates the PostgreSQL database, or removes the PGlite data directory
|
|
238
|
+
* @mutates filesystem - removes `options.pglite_data_dir` recursively for PGlite URLs
|
|
226
239
|
*/
|
|
227
240
|
export const reset_database = async (deps, database_url, options) => {
|
|
228
241
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -273,6 +286,9 @@ export const reset_database = async (deps, database_url, options) => {
|
|
|
273
286
|
* updates an existing password (rerun would silently rotate it).
|
|
274
287
|
*
|
|
275
288
|
* Intended for `scripts/dev_setup.ts` — do not call in production.
|
|
289
|
+
*
|
|
290
|
+
* @mutates database - inserts an account/actor pair when missing and grants any requested role permits
|
|
291
|
+
* @throws Error if an existing account is found without an associated actor row
|
|
276
292
|
*/
|
|
277
293
|
export const seed_dev_account = async (deps, input, options) => {
|
|
278
294
|
const log = options?.log ?? default_setup_logger;
|
package/dist/env/dotenv.d.ts
CHANGED
|
@@ -36,7 +36,8 @@ export declare const parse_dotenv: (content: string) => Record<string, string>;
|
|
|
36
36
|
*
|
|
37
37
|
* @param runtime - runtime with `read_text_file` capability
|
|
38
38
|
* @param path - path to env file
|
|
39
|
-
* @returns parsed env record, or null if file doesn't exist
|
|
39
|
+
* @returns parsed env record, or `null` if file doesn't exist
|
|
40
|
+
* @throws Error if reading fails for any reason other than `ENOENT` / `NotFound`
|
|
40
41
|
*/
|
|
41
42
|
export declare const load_env_file: (runtime: Pick<FsReadDeps, "read_text_file">, path: string) => Promise<Record<string, string> | null>;
|
|
42
43
|
//# sourceMappingURL=dotenv.d.ts.map
|
package/dist/env/dotenv.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotenv.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/dotenv.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;GAkBG;AAGH,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAkCnE,CAAC;AAiEF
|
|
1
|
+
{"version":3,"file":"dotenv.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/dotenv.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;GAkBG;AAGH,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAkCnE,CAAC;AAiEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GACzB,SAAS,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,EAC3C,MAAM,MAAM,KACV,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CASvC,CAAC"}
|
package/dist/env/dotenv.js
CHANGED
|
@@ -135,7 +135,8 @@ const unescape_double_quoted = (s) => {
|
|
|
135
135
|
*
|
|
136
136
|
* @param runtime - runtime with `read_text_file` capability
|
|
137
137
|
* @param path - path to env file
|
|
138
|
-
* @returns parsed env record, or null if file doesn't exist
|
|
138
|
+
* @returns parsed env record, or `null` if file doesn't exist
|
|
139
|
+
* @throws Error if reading fails for any reason other than `ENOENT` / `NotFound`
|
|
139
140
|
*/
|
|
140
141
|
export const load_env_file = async (runtime, path) => {
|
|
141
142
|
try {
|
package/dist/env/load.d.ts
CHANGED
|
@@ -42,11 +42,11 @@ export declare const log_env_validation_error: (error: EnvValidationError, label
|
|
|
42
42
|
* Load and validate env vars against a Zod schema.
|
|
43
43
|
*
|
|
44
44
|
* Reads each key from the schema using `get_env`, then validates.
|
|
45
|
-
* Throws `EnvValidationError` on failure.
|
|
46
45
|
*
|
|
47
46
|
* @param schema - Zod object schema defining expected env vars
|
|
48
47
|
* @param get_env - function to read an env var by key
|
|
49
48
|
* @returns validated env object
|
|
49
|
+
* @throws EnvValidationError if Zod validation fails
|
|
50
50
|
*/
|
|
51
51
|
export declare const load_env: <T extends z.ZodObject>(schema: T, get_env: (key: string) => string | undefined) => z.infer<T>;
|
|
52
52
|
//# sourceMappingURL=load.d.ts.map
|
package/dist/env/load.js
CHANGED
|
@@ -60,11 +60,11 @@ export const log_env_validation_error = (error, label) => {
|
|
|
60
60
|
* Load and validate env vars against a Zod schema.
|
|
61
61
|
*
|
|
62
62
|
* Reads each key from the schema using `get_env`, then validates.
|
|
63
|
-
* Throws `EnvValidationError` on failure.
|
|
64
63
|
*
|
|
65
64
|
* @param schema - Zod object schema defining expected env vars
|
|
66
65
|
* @param get_env - function to read an env var by key
|
|
67
66
|
* @returns validated env object
|
|
67
|
+
* @throws EnvValidationError if Zod validation fails
|
|
68
68
|
*/
|
|
69
69
|
export const load_env = (schema, get_env) => {
|
|
70
70
|
const raw = {};
|
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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Import this module once in your app to get type-safe access to
|
|
8
8
|
* `auth_session_id`, `request_context`, and `credential_type` on the Hono context.
|
|
9
9
|
*
|
|
10
|
-
* In practice, this is auto-loaded by `app_server.ts` (side-effect import)
|
|
10
|
+
* In practice, this is auto-loaded by `server/app_server.ts` (side-effect import)
|
|
11
11
|
* and transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
|
|
12
12
|
* Consumers don't need a manual import unless bypassing the standard server assembly.
|
|
13
13
|
*
|
package/dist/hono_context.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Import this module once in your app to get type-safe access to
|
|
8
8
|
* `auth_session_id`, `request_context`, and `credential_type` on the Hono context.
|
|
9
9
|
*
|
|
10
|
-
* In practice, this is auto-loaded by `app_server.ts` (side-effect import)
|
|
10
|
+
* In practice, this is auto-loaded by `server/app_server.ts` (side-effect import)
|
|
11
11
|
* and transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
|
|
12
12
|
* Consumers don't need a manual import unless bypassing the standard server assembly.
|
|
13
13
|
*
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* codes stay in consumers — add by casting `as JsonrpcErrorCode`.
|
|
8
8
|
*
|
|
9
9
|
* `JsonrpcErrorCode` and `JsonrpcErrorObject` types are Zod-inferred
|
|
10
|
-
* from `jsonrpc.ts` — this module re-uses those as the single source
|
|
10
|
+
* from `http/jsonrpc.ts` — this module re-uses those as the single source
|
|
11
11
|
* of truth.
|
|
12
12
|
*
|
|
13
|
-
* Complementary to `error_schemas.ts`: that module is declarative
|
|
13
|
+
* Complementary to `http/error_schemas.ts`: that module is declarative
|
|
14
14
|
* (Zod schemas for surface introspection), this one is runtime
|
|
15
15
|
* (throw + catch + map).
|
|
16
16
|
*
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* codes stay in consumers — add by casting `as JsonrpcErrorCode`.
|
|
8
8
|
*
|
|
9
9
|
* `JsonrpcErrorCode` and `JsonrpcErrorObject` types are Zod-inferred
|
|
10
|
-
* from `jsonrpc.ts` — this module re-uses those as the single source
|
|
10
|
+
* from `http/jsonrpc.ts` — this module re-uses those as the single source
|
|
11
11
|
* of truth.
|
|
12
12
|
*
|
|
13
|
-
* Complementary to `error_schemas.ts`: that module is declarative
|
|
13
|
+
* Complementary to `http/error_schemas.ts`: that module is declarative
|
|
14
14
|
* (Zod schemas for surface introspection), this one is runtime
|
|
15
15
|
* (throw + catch + map).
|
|
16
16
|
*
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* JSON-RPC message builders, type guards, and converters.
|
|
3
3
|
*
|
|
4
4
|
* Used by the SAES runtime (ActionEvent, ActionPeer, transports) and
|
|
5
|
-
* the RPC endpoint dispatcher. Complements `jsonrpc.ts` (schemas) and
|
|
6
|
-
* `jsonrpc_errors.ts` (error infrastructure).
|
|
5
|
+
* the RPC endpoint dispatcher. Complements `http/jsonrpc.ts` (schemas) and
|
|
6
|
+
* `http/jsonrpc_errors.ts` (error infrastructure).
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* JSON-RPC message builders, type guards, and converters.
|
|
3
3
|
*
|
|
4
4
|
* Used by the SAES runtime (ActionEvent, ActionPeer, transports) and
|
|
5
|
-
* the RPC endpoint dispatcher. Complements `jsonrpc.ts` (schemas) and
|
|
6
|
-
* `jsonrpc_errors.ts` (error infrastructure).
|
|
5
|
+
* the RPC endpoint dispatcher. Complements `http/jsonrpc.ts` (schemas) and
|
|
6
|
+
* `http/jsonrpc_errors.ts` (error infrastructure).
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Middleware spec type — named middleware layer definition.
|
|
3
3
|
*
|
|
4
|
-
* Separated from `route_spec.ts` so middleware modules can import this
|
|
4
|
+
* Separated from `http/route_spec.ts` so middleware modules can import this
|
|
5
5
|
* type without creating an upward dependency on routes.
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Middleware spec type — named middleware layer definition.
|
|
3
3
|
*
|
|
4
|
-
* Separated from `route_spec.ts` so middleware modules can import this
|
|
4
|
+
* Separated from `http/route_spec.ts` so middleware modules can import this
|
|
5
5
|
* type without creating an upward dependency on routes.
|
|
6
6
|
*
|
|
7
7
|
* @module
|
package/dist/http/origin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Verifies requests are coming from expected origins/referers.
|
|
5
5
|
* CSRF protection is provided by `SameSite: strict` on session cookies
|
|
6
|
-
* (see `session_middleware.ts`). This module provides origin allowlisting
|
|
6
|
+
* (see `auth/session_middleware.ts`). This module provides origin allowlisting
|
|
7
7
|
* for locally-running services — preventing untrusted websites from
|
|
8
8
|
* making requests as the user browses the web.
|
|
9
9
|
*
|
package/dist/http/origin.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Verifies requests are coming from expected origins/referers.
|
|
5
5
|
* CSRF protection is provided by `SameSite: strict` on session cookies
|
|
6
|
-
* (see `session_middleware.ts`). This module provides origin allowlisting
|
|
6
|
+
* (see `auth/session_middleware.ts`). This module provides origin allowlisting
|
|
7
7
|
* for locally-running services — preventing untrusted websites from
|
|
8
8
|
* making requests as the user browses the web.
|
|
9
9
|
*
|
|
@@ -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
|
@@ -92,6 +92,8 @@ export declare const resolve_client_ip: (forwarded_for: string, proxies: Array<P
|
|
|
92
92
|
* right-to-left, strip trusted entries, use first untrusted entry.
|
|
93
93
|
*
|
|
94
94
|
* @param options - trusted proxy configuration
|
|
95
|
+
* @mutates `c.var.client_ip` - set to the resolved (or `'unknown'`) client IP per request
|
|
96
|
+
* @throws Error if any entry in `options.trusted_proxies` is invalid (parsed eagerly via `parse_proxy_entry`)
|
|
95
97
|
*/
|
|
96
98
|
export declare const create_proxy_middleware: (options: ProxyOptions) => MiddlewareHandler;
|
|
97
99
|
/**
|
|
@@ -100,6 +102,7 @@ export declare const create_proxy_middleware: (options: ProxyOptions) => Middlew
|
|
|
100
102
|
* Apply before auth middleware so `client_ip` is available for rate limiting.
|
|
101
103
|
*
|
|
102
104
|
* @param options - trusted proxy configuration
|
|
105
|
+
* @throws Error if any entry in `options.trusted_proxies` is invalid (delegates to `create_proxy_middleware`)
|
|
103
106
|
*/
|
|
104
107
|
export declare const create_proxy_middleware_spec: (options: ProxyOptions) => MiddlewareSpec;
|
|
105
108
|
/**
|
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;;;;;;;;;;GAUG;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;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,E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,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;;;;;;;GAOG;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
|
@@ -176,6 +176,8 @@ export const resolve_client_ip = (forwarded_for, proxies) => {
|
|
|
176
176
|
* right-to-left, strip trusted entries, use first untrusted entry.
|
|
177
177
|
*
|
|
178
178
|
* @param options - trusted proxy configuration
|
|
179
|
+
* @mutates `c.var.client_ip` - set to the resolved (or `'unknown'`) client IP per request
|
|
180
|
+
* @throws Error if any entry in `options.trusted_proxies` is invalid (parsed eagerly via `parse_proxy_entry`)
|
|
179
181
|
*/
|
|
180
182
|
export const create_proxy_middleware = (options) => {
|
|
181
183
|
const parsed_proxies = options.trusted_proxies.map(parse_proxy_entry);
|
|
@@ -225,6 +227,7 @@ export const create_proxy_middleware = (options) => {
|
|
|
225
227
|
* Apply before auth middleware so `client_ip` is available for rate limiting.
|
|
226
228
|
*
|
|
227
229
|
* @param options - trusted proxy configuration
|
|
230
|
+
* @throws Error if any entry in `options.trusted_proxies` is invalid (delegates to `create_proxy_middleware`)
|
|
228
231
|
*/
|
|
229
232
|
export const create_proxy_middleware_spec = (options) => ({
|
|
230
233
|
name: 'trusted_proxy',
|
|
@@ -185,6 +185,7 @@ export declare const apply_middleware_specs: (app: Hono, specs: Array<Middleware
|
|
|
185
185
|
* @param log - the logger instance
|
|
186
186
|
* @param db - database instance for transaction wrapping and `RouteContext`
|
|
187
187
|
* @mutates `app`
|
|
188
|
+
* @throws Error if two specs share the same `method` + `path` (each combination must be unique)
|
|
188
189
|
*/
|
|
189
190
|
export declare const apply_route_specs: (app: Hono, specs: Array<RouteSpec>, resolve_auth_guards: AuthGuardResolver, log: Logger, db: Db) => void;
|
|
190
191
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/route_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAW,IAAI,EAAE,iBAAiB,EAAC,MAAM,MAAM,CAAC;AACpE,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAKjB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAClB;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GACd;IAAC,IAAI,EAAE,eAAe,CAAA;CAAC,GACvB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAC5B;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,SAAS,KAAK,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAE9E,6CAA6C;AAC7C,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtE;;;;;;GAMG;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AK,CAAC,SAAS,CAAC,EACvB,qBAAqB,iBAAiB,EACtC,KAAK,MAAM,EACX,IAAI,EAAE,KACJ,IAsCF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,OAAO,KAAK,CAAC,SAAS,CAAC,KAAG,KAAK,CAAC,SAAS,CAK3F,CAAC"}
|
package/dist/http/route_spec.js
CHANGED
|
@@ -60,6 +60,8 @@ export const get_route_query = (c) => {
|
|
|
60
60
|
* and for null-input routes (no body expected). For other routes with input
|
|
61
61
|
* schemas, returns a middleware that parses and validates the JSON body,
|
|
62
62
|
* storing the result on the context as `validated_input`.
|
|
63
|
+
*
|
|
64
|
+
* @mutates `c.var.validated_input` - set to the parsed and validated body on success
|
|
63
65
|
*/
|
|
64
66
|
const create_input_validation = (input_schema, method) => {
|
|
65
67
|
if (method === 'GET')
|
|
@@ -92,6 +94,8 @@ const create_input_validation = (input_schema, method) => {
|
|
|
92
94
|
* Returns an empty array when no params schema is defined.
|
|
93
95
|
* For routes with params schemas, returns a middleware that validates
|
|
94
96
|
* `c.req.param()` against the schema, storing the result on the context as `validated_params`.
|
|
97
|
+
*
|
|
98
|
+
* @mutates `c.var.validated_params` - set to the parsed and validated path params on success
|
|
95
99
|
*/
|
|
96
100
|
const create_params_validation = (params_schema) => {
|
|
97
101
|
if (!params_schema)
|
|
@@ -113,6 +117,8 @@ const create_params_validation = (params_schema) => {
|
|
|
113
117
|
* Returns an empty array when no query schema is defined.
|
|
114
118
|
* For routes with query schemas, returns a middleware that validates
|
|
115
119
|
* `c.req.query()` against the schema, storing the result on the context as `validated_query`.
|
|
120
|
+
*
|
|
121
|
+
* @mutates `c.var.validated_query` - set to the parsed and validated query params on success
|
|
116
122
|
*/
|
|
117
123
|
const create_query_validation = (query_schema) => {
|
|
118
124
|
if (!query_schema)
|
|
@@ -238,6 +244,7 @@ const wrap_error_catch = (handler, log) => {
|
|
|
238
244
|
* @param log - the logger instance
|
|
239
245
|
* @param db - database instance for transaction wrapping and `RouteContext`
|
|
240
246
|
* @mutates `app`
|
|
247
|
+
* @throws Error if two specs share the same `method` + `path` (each combination must be unique)
|
|
241
248
|
*/
|
|
242
249
|
export const apply_route_specs = (app, specs, resolve_auth_guards, log, db) => {
|
|
243
250
|
const registered = new Set();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared pure helpers for schema introspection and middleware matching.
|
|
3
3
|
*
|
|
4
|
-
* Used by both `route_spec.ts` (input validation) and `surface.ts`
|
|
4
|
+
* Used by both `http/route_spec.ts` (input validation) and `http/surface.ts`
|
|
5
5
|
* (attack surface generation). Extracted to avoid circular dependencies
|
|
6
6
|
* between routes and middleware.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared pure helpers for schema introspection and middleware matching.
|
|
3
3
|
*
|
|
4
|
-
* Used by both `route_spec.ts` (input validation) and `surface.ts`
|
|
4
|
+
* Used by both `http/route_spec.ts` (input validation) and `http/surface.ts`
|
|
5
5
|
* (attack surface generation). Extracted to avoid circular dependencies
|
|
6
6
|
* between routes and middleware.
|
|
7
7
|
*
|
package/dist/http/surface.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* App surface generation — JSON-serializable attack surface from route and middleware specs.
|
|
3
3
|
*
|
|
4
4
|
* Pure schema helpers (`is_null_schema`, `schema_to_surface`, `middleware_applies`,
|
|
5
|
-
* `merge_error_schemas`) live in `schema_helpers.ts`.
|
|
5
|
+
* `merge_error_schemas`) live in `http/schema_helpers.ts`.
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
package/dist/http/surface.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* App surface generation — JSON-serializable attack surface from route and middleware specs.
|
|
3
3
|
*
|
|
4
4
|
* Pure schema helpers (`is_null_schema`, `schema_to_surface`, `middleware_applies`,
|
|
5
|
-
* `merge_error_schemas`) live in `schema_helpers.ts`.
|
|
5
|
+
* `merge_error_schemas`) live in `http/schema_helpers.ts`.
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
package/dist/rate_limiter.d.ts
CHANGED
|
@@ -83,8 +83,13 @@ export declare class RateLimiter {
|
|
|
83
83
|
/**
|
|
84
84
|
* Check whether `key` is allowed without recording an attempt.
|
|
85
85
|
*
|
|
86
|
+
* Prunes timestamps that fell outside the window as a side effect (and
|
|
87
|
+
* removes the key entirely when none remain), so the backing map stays
|
|
88
|
+
* bounded even under read-only traffic.
|
|
89
|
+
*
|
|
86
90
|
* @param key - rate limit key (e.g. IP address)
|
|
87
91
|
* @param now - current timestamp in ms (defaults to `Date.now()`)
|
|
92
|
+
* @mutates internal map - prunes expired timestamps for `key`
|
|
88
93
|
*/
|
|
89
94
|
check(key: string, now?: number): RateLimitResult;
|
|
90
95
|
/**
|
|
@@ -92,19 +97,27 @@ export declare class RateLimiter {
|
|
|
92
97
|
*
|
|
93
98
|
* @param key - rate limit key (e.g. IP address)
|
|
94
99
|
* @param now - current timestamp in ms (defaults to `Date.now()`)
|
|
100
|
+
* @mutates internal map - appends `now` to the timestamp list for `key` (after pruning expired entries)
|
|
95
101
|
*/
|
|
96
102
|
record(key: string, now?: number): RateLimitResult;
|
|
97
103
|
/**
|
|
98
104
|
* Clear all attempts for `key` (e.g. after successful login).
|
|
105
|
+
*
|
|
106
|
+
* @mutates internal map - removes the entry for `key`
|
|
99
107
|
*/
|
|
100
108
|
reset(key: string): void;
|
|
101
109
|
/**
|
|
102
110
|
* Remove entries whose timestamps are all outside the window.
|
|
103
111
|
*
|
|
104
112
|
* @param now - current timestamp in ms (defaults to `Date.now()`)
|
|
113
|
+
* @mutates internal map - prunes expired timestamps and deletes empty keys
|
|
105
114
|
*/
|
|
106
115
|
cleanup(now?: number): void;
|
|
107
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Stop the cleanup timer. Safe to call multiple times.
|
|
118
|
+
*
|
|
119
|
+
* @mutates timer - clears the cleanup `setInterval` and nulls the handle
|
|
120
|
+
*/
|
|
108
121
|
dispose(): void;
|
|
109
122
|
}
|
|
110
123
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate_limiter.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/rate_limiter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAKlC;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,EAAE,kBAKzC,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,gCAAgC,EAAE,kBAK9C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAW;;IACvB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;gBAOzB,OAAO,EAAE,kBAAkB;IAcvC,8BAA8B;IAC9B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED
|
|
1
|
+
{"version":3,"file":"rate_limiter.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/rate_limiter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OA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