@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_db.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/create_db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AAIxC,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,EAAE,CAAC;IACP,iFAAiF;IACjF,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"create_db.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/create_db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AAIxC,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,EAAE,CAAC;IACP,iFAAiF;IACjF,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,cAAc,CAgC5E,CAAC"}
|
package/dist/db/create_db.js
CHANGED
|
@@ -17,7 +17,6 @@ import { create_pglite_db } from './db_pglite.js';
|
|
|
17
17
|
/**
|
|
18
18
|
* Create a database connection based on a URL.
|
|
19
19
|
*
|
|
20
|
-
* Returns the `Db` instance, a typed `close` callback, driver type, and display name.
|
|
21
20
|
* The `close` callback is bound to the actual driver — callers never need to
|
|
22
21
|
* know which driver is in use.
|
|
23
22
|
*
|
|
@@ -26,6 +25,9 @@ import { create_pglite_db } from './db_pglite.js';
|
|
|
26
25
|
*
|
|
27
26
|
* @param database_url - connection URL (`postgres://`, `postgresql://`, `file://`, or `memory://`)
|
|
28
27
|
* @returns database instance, close callback, type, and display name
|
|
28
|
+
* @throws Error if `database_url` uses an unsupported scheme. Driver
|
|
29
|
+
* construction (`pg.Pool` or `PGlite`) may also throw on bad connection
|
|
30
|
+
* parameters or missing peer-dependency packages.
|
|
29
31
|
*/
|
|
30
32
|
export const create_db = async (database_url) => {
|
|
31
33
|
if (database_url.startsWith('postgres://') || database_url.startsWith('postgresql://')) {
|
package/dist/db/db.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Transaction safety is provided by an injected `transaction` callback —
|
|
8
8
|
* the driver adapters (`db/db_pg.ts`, `db/db_pglite.ts`) supply the driver-appropriate
|
|
9
|
-
* implementation. Close is handled externally (returned alongside the Db
|
|
9
|
+
* implementation. Close is handled externally (returned alongside the `Db`
|
|
10
10
|
* as `DbDriverResult`), not as a method on this class.
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
@@ -23,7 +23,7 @@ export interface DbClient {
|
|
|
23
23
|
* Configuration for constructing a `Db` with transaction support.
|
|
24
24
|
*
|
|
25
25
|
* `transaction` is injected by `create_db` which knows the driver.
|
|
26
|
-
* For pg
|
|
26
|
+
* For `pg`: acquires a dedicated pool client per transaction.
|
|
27
27
|
* For PGlite: delegates to `pglite.transaction()`.
|
|
28
28
|
*/
|
|
29
29
|
export interface DbDeps {
|
|
@@ -47,9 +47,10 @@ export type DbType = 'postgres' | 'pglite-file' | 'pglite-memory';
|
|
|
47
47
|
/**
|
|
48
48
|
* Sentinel transaction function for transaction-scoped `Db` instances.
|
|
49
49
|
*
|
|
50
|
-
* Throws immediately — nested transactions are not supported.
|
|
51
50
|
* Used by driver adapters when constructing the inner `Db` passed
|
|
52
51
|
* to transaction callbacks.
|
|
52
|
+
*
|
|
53
|
+
* @throws Error always — nested transactions are not supported
|
|
53
54
|
*/
|
|
54
55
|
export declare const no_nested_transaction: DbDeps['transaction'];
|
|
55
56
|
/**
|
|
@@ -76,10 +77,18 @@ export declare class Db {
|
|
|
76
77
|
constructor(options: DbDeps);
|
|
77
78
|
/**
|
|
78
79
|
* Execute a query and return all rows.
|
|
80
|
+
*
|
|
81
|
+
* @param text - SQL text with `$1`, `$2`, ... parameter placeholders
|
|
82
|
+
* @param values - parameter values bound to the placeholders in `text`
|
|
83
|
+
* @returns the result rows, typed as `T`
|
|
79
84
|
*/
|
|
80
85
|
query<T>(text: string, values?: Array<unknown>): Promise<Array<T>>;
|
|
81
86
|
/**
|
|
82
|
-
* Execute a query and return the first row, or undefined if no rows.
|
|
87
|
+
* Execute a query and return the first row, or `undefined` if no rows.
|
|
88
|
+
*
|
|
89
|
+
* @param text - SQL text with `$1`, `$2`, ... parameter placeholders
|
|
90
|
+
* @param values - parameter values bound to the placeholders in `text`
|
|
91
|
+
* @returns the first row, or `undefined` when the result set is empty
|
|
83
92
|
*/
|
|
84
93
|
query_one<T>(text: string, values?: Array<unknown>): Promise<T | undefined>;
|
|
85
94
|
/**
|
|
@@ -91,6 +100,8 @@ export declare class Db {
|
|
|
91
100
|
*
|
|
92
101
|
* @param fn - async function receiving a transaction-scoped `Db`
|
|
93
102
|
* @returns the value returned by `fn`
|
|
103
|
+
* @throws Error propagated from `fn` after `ROLLBACK`, or from the driver
|
|
104
|
+
* if `BEGIN` / `COMMIT` / `ROLLBACK` itself fails
|
|
94
105
|
*/
|
|
95
106
|
transaction<T>(fn: (tx_db: Db) => Promise<T>): Promise<T>;
|
|
96
107
|
}
|
package/dist/db/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,KAAK,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC;QAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;KAAC,CAAC,CAAC;CACzF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACtB,MAAM,EAAE,QAAQ,CAAC;IACjB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,OAAO,CAA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CAAC,MAAM,EAAE,QAAQ,CAAC;gBAId,OAAO,EAAE,MAAM;IAK3B;;;;;;OAMG;IACG,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAKxE;;;;;;OAMG;IACG,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAKjF;;;;;;;;;;;OAWG;IACG,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAG/D"}
|
package/dist/db/db.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Transaction safety is provided by an injected `transaction` callback —
|
|
8
8
|
* the driver adapters (`db/db_pg.ts`, `db/db_pglite.ts`) supply the driver-appropriate
|
|
9
|
-
* implementation. Close is handled externally (returned alongside the Db
|
|
9
|
+
* implementation. Close is handled externally (returned alongside the `Db`
|
|
10
10
|
* as `DbDriverResult`), not as a method on this class.
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* Sentinel transaction function for transaction-scoped `Db` instances.
|
|
16
16
|
*
|
|
17
|
-
* Throws immediately — nested transactions are not supported.
|
|
18
17
|
* Used by driver adapters when constructing the inner `Db` passed
|
|
19
18
|
* to transaction callbacks.
|
|
19
|
+
*
|
|
20
|
+
* @throws Error always — nested transactions are not supported
|
|
20
21
|
*/
|
|
21
22
|
export const no_nested_transaction = () => {
|
|
22
23
|
throw new Error('Nested transactions are not supported');
|
|
@@ -48,13 +49,21 @@ export class Db {
|
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Execute a query and return all rows.
|
|
52
|
+
*
|
|
53
|
+
* @param text - SQL text with `$1`, `$2`, ... parameter placeholders
|
|
54
|
+
* @param values - parameter values bound to the placeholders in `text`
|
|
55
|
+
* @returns the result rows, typed as `T`
|
|
51
56
|
*/
|
|
52
57
|
async query(text, values) {
|
|
53
58
|
const result = await this.client.query(text, values);
|
|
54
59
|
return result.rows;
|
|
55
60
|
}
|
|
56
61
|
/**
|
|
57
|
-
* Execute a query and return the first row, or undefined if no rows.
|
|
62
|
+
* Execute a query and return the first row, or `undefined` if no rows.
|
|
63
|
+
*
|
|
64
|
+
* @param text - SQL text with `$1`, `$2`, ... parameter placeholders
|
|
65
|
+
* @param values - parameter values bound to the placeholders in `text`
|
|
66
|
+
* @returns the first row, or `undefined` when the result set is empty
|
|
58
67
|
*/
|
|
59
68
|
async query_one(text, values) {
|
|
60
69
|
const rows = await this.query(text, values);
|
|
@@ -69,6 +78,8 @@ export class Db {
|
|
|
69
78
|
*
|
|
70
79
|
* @param fn - async function receiving a transaction-scoped `Db`
|
|
71
80
|
* @returns the value returned by `fn`
|
|
81
|
+
* @throws Error propagated from `fn` after `ROLLBACK`, or from the driver
|
|
82
|
+
* if `BEGIN` / `COMMIT` / `ROLLBACK` itself fails
|
|
72
83
|
*/
|
|
73
84
|
async transaction(fn) {
|
|
74
85
|
return this.#transaction(fn);
|
package/dist/db/db_pg.d.ts
CHANGED
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
import type { Pool } from 'pg';
|
|
11
11
|
import { type DbDriverResult } from './db.js';
|
|
12
12
|
/**
|
|
13
|
-
* Create a `Db` backed by a pg
|
|
13
|
+
* Create a `Db` backed by a `pg.Pool`.
|
|
14
14
|
*
|
|
15
|
-
* Owns the transaction implementation
|
|
16
|
-
* per transaction
|
|
15
|
+
* Owns the transaction implementation, acquiring a dedicated pool client
|
|
16
|
+
* per transaction.
|
|
17
17
|
*
|
|
18
18
|
* @param pool - an already-constructed `pg.Pool`
|
|
19
|
+
* @returns the `Db` instance and a `close` callback bound to `pool.end()`
|
|
19
20
|
*/
|
|
20
21
|
export declare const create_pg_db: (pool: Pool) => DbDriverResult;
|
|
21
22
|
//# sourceMappingURL=db_pg.d.ts.map
|
package/dist/db/db_pg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db_pg.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/db_pg.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAE7B,OAAO,EAA4B,KAAK,cAAc,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"db_pg.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/db_pg.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAE7B,OAAO,EAA4B,KAAK,cAAc,EAAC,MAAM,SAAS,CAAC;AA2BvE;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,cAGxC,CAAC"}
|
package/dist/db/db_pg.js
CHANGED
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Db, no_nested_transaction } from './db.js';
|
|
11
11
|
/**
|
|
12
|
-
* Create a transaction implementation for a pg
|
|
12
|
+
* Create a transaction implementation for a `pg.Pool`.
|
|
13
13
|
*
|
|
14
14
|
* Acquires a dedicated client from the pool for each transaction,
|
|
15
|
-
* ensuring BEGIN/COMMIT/ROLLBACK all hit the same connection.
|
|
15
|
+
* ensuring `BEGIN` / `COMMIT` / `ROLLBACK` all hit the same connection.
|
|
16
|
+
* Releases the client in `finally` regardless of outcome.
|
|
16
17
|
*/
|
|
17
18
|
const create_pg_transaction = (pool) => async (fn) => {
|
|
18
19
|
const client = await pool.connect();
|
|
@@ -32,12 +33,13 @@ const create_pg_transaction = (pool) => async (fn) => {
|
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
/**
|
|
35
|
-
* Create a `Db` backed by a pg
|
|
36
|
+
* Create a `Db` backed by a `pg.Pool`.
|
|
36
37
|
*
|
|
37
|
-
* Owns the transaction implementation
|
|
38
|
-
* per transaction
|
|
38
|
+
* Owns the transaction implementation, acquiring a dedicated pool client
|
|
39
|
+
* per transaction.
|
|
39
40
|
*
|
|
40
41
|
* @param pool - an already-constructed `pg.Pool`
|
|
42
|
+
* @returns the `Db` instance and a `close` callback bound to `pool.end()`
|
|
41
43
|
*/
|
|
42
44
|
export const create_pg_db = (pool) => ({
|
|
43
45
|
db: new Db({ client: pool, transaction: create_pg_transaction(pool) }),
|
package/dist/db/db_pglite.d.ts
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
import type { PGlite } from '@electric-sql/pglite';
|
|
11
11
|
import { type DbDriverResult } from './db.js';
|
|
12
12
|
/**
|
|
13
|
-
* Create a `Db` backed by a PGlite instance.
|
|
13
|
+
* Create a `Db` backed by a `PGlite` instance.
|
|
14
14
|
*
|
|
15
|
-
* Delegates transactions to PGlite's native `transaction()` method
|
|
16
|
-
* and returns a `close` callback bound to `pglite.close()`.
|
|
15
|
+
* Delegates transactions to PGlite's native `transaction()` method.
|
|
17
16
|
*
|
|
18
|
-
* @param pglite - an already-constructed PGlite instance
|
|
17
|
+
* @param pglite - an already-constructed `PGlite` instance
|
|
18
|
+
* @returns the `Db` instance and a `close` callback bound to `pglite.close()`
|
|
19
19
|
*/
|
|
20
20
|
export declare const create_pglite_db: (pglite: PGlite) => DbDriverResult;
|
|
21
21
|
//# sourceMappingURL=db_pglite.d.ts.map
|
package/dist/db/db_pglite.js
CHANGED
|
@@ -15,12 +15,12 @@ import { Db, no_nested_transaction } from './db.js';
|
|
|
15
15
|
*/
|
|
16
16
|
const create_pglite_transaction = (pglite) => async (fn) => pglite.transaction(async (tx) => fn(new Db({ client: tx, transaction: no_nested_transaction })));
|
|
17
17
|
/**
|
|
18
|
-
* Create a `Db` backed by a PGlite instance.
|
|
18
|
+
* Create a `Db` backed by a `PGlite` instance.
|
|
19
19
|
*
|
|
20
|
-
* Delegates transactions to PGlite's native `transaction()` method
|
|
21
|
-
* and returns a `close` callback bound to `pglite.close()`.
|
|
20
|
+
* Delegates transactions to PGlite's native `transaction()` method.
|
|
22
21
|
*
|
|
23
|
-
* @param pglite - an already-constructed PGlite instance
|
|
22
|
+
* @param pglite - an already-constructed `PGlite` instance
|
|
23
|
+
* @returns the `Db` instance and a `close` callback bound to `pglite.close()`
|
|
24
24
|
*/
|
|
25
25
|
export const create_pglite_db = (pglite) => ({
|
|
26
26
|
db: new Db({ client: pglite, transaction: create_pglite_transaction(pglite) }),
|
package/dist/db/migrate.d.ts
CHANGED
|
@@ -66,13 +66,13 @@ export interface MigrationResult {
|
|
|
66
66
|
applied_names: Array<string>;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* Tagged error vocabulary for
|
|
69
|
+
* Tagged error vocabulary for `run_migrations` and `baseline`.
|
|
70
70
|
*
|
|
71
71
|
* Callers branch on `.kind` rather than matching error messages — message
|
|
72
72
|
* text is for operators, not control flow.
|
|
73
73
|
*/
|
|
74
74
|
export type MigrationErrorKind = 'binary-older-than-db' | 'name-divergence-at-N' | 'old-tracker-shape' | 'migration-failed' | 'baseline-name-not-in-code' | 'baseline-name-out-of-order' | 'baseline-namespace-already-populated';
|
|
75
|
-
/** Structured context passed alongside a
|
|
75
|
+
/** Structured context passed alongside a `MigrationError`. */
|
|
76
76
|
export interface MigrationErrorContext {
|
|
77
77
|
namespace?: string;
|
|
78
78
|
at_index?: number;
|
|
@@ -80,7 +80,7 @@ export interface MigrationErrorContext {
|
|
|
80
80
|
cause?: unknown;
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* Tagged error thrown by
|
|
83
|
+
* Tagged error thrown by `run_migrations` and `baseline`.
|
|
84
84
|
*
|
|
85
85
|
* Branch on `.kind`; the message carries an operator-facing remediation hint.
|
|
86
86
|
*/
|
|
@@ -111,7 +111,7 @@ export declare class MigrationError extends Error {
|
|
|
111
111
|
*
|
|
112
112
|
* **Concurrency**: per-namespace advisory locks reduce contention in
|
|
113
113
|
* multi-instance deployments but are best-effort on pool drivers (see
|
|
114
|
-
* module docstring
|
|
114
|
+
* the module docstring's "Advisory locking" notes). Correctness on concurrent boots
|
|
115
115
|
* falls out of chain-tx atomicity + the `(namespace, name)` PK — the
|
|
116
116
|
* loser's INSERT triggers PK violation and rollback; subsequent boots
|
|
117
117
|
* see the committed state.
|
|
@@ -120,6 +120,7 @@ export declare class MigrationError extends Error {
|
|
|
120
120
|
* @param namespaces - migration namespaces, processed in the order passed
|
|
121
121
|
* @returns one result per namespace where work happened (already-up-to-date
|
|
122
122
|
* namespaces are omitted)
|
|
123
|
+
* @mutates schema_version - inserts one row per applied migration
|
|
123
124
|
* @throws MigrationError with `kind` of `binary-older-than-db`,
|
|
124
125
|
* `name-divergence-at-N`, `old-tracker-shape`, or `migration-failed`
|
|
125
126
|
*/
|
|
@@ -154,6 +155,8 @@ export declare const run_migrations: (db: Db, namespaces: Array<MigrationNamespa
|
|
|
154
155
|
* @param db - the database instance
|
|
155
156
|
* @param ns - the namespace whose migrations are being baselined
|
|
156
157
|
* @param names - prefix of `ns.migrations[].name` to record as already-applied
|
|
158
|
+
* @mutates schema_version - inserts tracker rows for `names` without running
|
|
159
|
+
* the corresponding migration bodies
|
|
157
160
|
* @throws MigrationError with `kind` of `old-tracker-shape`,
|
|
158
161
|
* `baseline-name-not-in-code`, `baseline-name-out-of-order`, or
|
|
159
162
|
* `baseline-namespace-already-populated`
|
package/dist/db/migrate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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|
/**
|
|
44
|
-
* Tagged error thrown by
|
|
44
|
+
* Tagged error thrown by `run_migrations` and `baseline`.
|
|
45
45
|
*
|
|
46
46
|
* Branch on `.kind`; the message carries an operator-facing remediation hint.
|
|
47
47
|
*/
|
|
@@ -145,7 +145,7 @@ const with_namespace_lock = async (db, namespace, fn) => {
|
|
|
145
145
|
*
|
|
146
146
|
* **Concurrency**: per-namespace advisory locks reduce contention in
|
|
147
147
|
* multi-instance deployments but are best-effort on pool drivers (see
|
|
148
|
-
* module docstring
|
|
148
|
+
* the module docstring's "Advisory locking" notes). Correctness on concurrent boots
|
|
149
149
|
* falls out of chain-tx atomicity + the `(namespace, name)` PK — the
|
|
150
150
|
* loser's INSERT triggers PK violation and rollback; subsequent boots
|
|
151
151
|
* see the committed state.
|
|
@@ -154,6 +154,7 @@ const with_namespace_lock = async (db, namespace, fn) => {
|
|
|
154
154
|
* @param namespaces - migration namespaces, processed in the order passed
|
|
155
155
|
* @returns one result per namespace where work happened (already-up-to-date
|
|
156
156
|
* namespaces are omitted)
|
|
157
|
+
* @mutates schema_version - inserts one row per applied migration
|
|
157
158
|
* @throws MigrationError with `kind` of `binary-older-than-db`,
|
|
158
159
|
* `name-divergence-at-N`, `old-tracker-shape`, or `migration-failed`
|
|
159
160
|
*/
|
|
@@ -250,6 +251,8 @@ export const run_migrations = async (db, namespaces) => {
|
|
|
250
251
|
* @param db - the database instance
|
|
251
252
|
* @param ns - the namespace whose migrations are being baselined
|
|
252
253
|
* @param names - prefix of `ns.migrations[].name` to record as already-applied
|
|
254
|
+
* @mutates schema_version - inserts tracker rows for `names` without running
|
|
255
|
+
* the corresponding migration bodies
|
|
253
256
|
* @throws MigrationError with `kind` of `old-tracker-shape`,
|
|
254
257
|
* `baseline-name-not-in-code`, `baseline-name-out-of-order`, or
|
|
255
258
|
* `baseline-namespace-already-populated`
|
|
@@ -21,7 +21,8 @@ export declare const VALID_SQL_IDENTIFIER: RegExp;
|
|
|
21
21
|
*
|
|
22
22
|
* @param name - the identifier to validate
|
|
23
23
|
* @returns the validated identifier
|
|
24
|
-
* @throws if the identifier contains
|
|
24
|
+
* @throws Error if the identifier contains characters outside `[a-zA-Z0-9_]`
|
|
25
|
+
* or starts with a digit
|
|
25
26
|
*/
|
|
26
27
|
export declare const assert_valid_sql_identifier: (name: string) => string;
|
|
27
28
|
//# sourceMappingURL=sql_identifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql_identifier.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/sql_identifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAA6B,CAAC;AAE/D
|
|
1
|
+
{"version":3,"file":"sql_identifier.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/sql_identifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAA6B,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,MAAM,KAAG,MAK1D,CAAC"}
|
|
@@ -21,7 +21,8 @@ export const VALID_SQL_IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
|
21
21
|
*
|
|
22
22
|
* @param name - the identifier to validate
|
|
23
23
|
* @returns the validated identifier
|
|
24
|
-
* @throws if the identifier contains
|
|
24
|
+
* @throws Error if the identifier contains characters outside `[a-zA-Z0-9_]`
|
|
25
|
+
* or starts with a digit
|
|
25
26
|
*/
|
|
26
27
|
export const assert_valid_sql_identifier = (name) => {
|
|
27
28
|
if (!VALID_SQL_IDENTIFIER.test(name)) {
|
package/dist/db/status.d.ts
CHANGED
|
@@ -55,7 +55,10 @@ export interface DbStatus {
|
|
|
55
55
|
*
|
|
56
56
|
* @param db - the database instance
|
|
57
57
|
* @param namespaces - migration namespaces to check status for
|
|
58
|
-
* @returns a snapshot of database status
|
|
58
|
+
* @returns a snapshot of database status; `connected: false` with `error`
|
|
59
|
+
* set when the initial connectivity probe fails
|
|
60
|
+
* @throws Error propagated from the driver if a query fails after the
|
|
61
|
+
* connectivity probe (e.g. a table is dropped mid-scan)
|
|
59
62
|
*/
|
|
60
63
|
export declare const query_db_status: (db: Db, namespaces?: Array<MigrationNamespace>) => Promise<DbStatus>;
|
|
61
64
|
/**
|
package/dist/db/status.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/status.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,2EAA2E;IAC3E,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3B,sCAAsC;IACtC,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACnC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B;AA8BD
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/status.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,2EAA2E;IAC3E,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3B,sCAAsC;IACtC,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACnC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B;AA8BD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,GAC3B,IAAI,EAAE,EACN,aAAa,KAAK,CAAC,kBAAkB,CAAC,KACpC,OAAO,CAAC,QAAQ,CAmFlB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,QAAQ,KAAG,MA4CnD,CAAC"}
|
package/dist/db/status.js
CHANGED
|
@@ -29,7 +29,10 @@ const has_table = async (db, table_name) => {
|
|
|
29
29
|
*
|
|
30
30
|
* @param db - the database instance
|
|
31
31
|
* @param namespaces - migration namespaces to check status for
|
|
32
|
-
* @returns a snapshot of database status
|
|
32
|
+
* @returns a snapshot of database status; `connected: false` with `error`
|
|
33
|
+
* set when the initial connectivity probe fails
|
|
34
|
+
* @throws Error propagated from the driver if a query fails after the
|
|
35
|
+
* connectivity probe (e.g. a table is dropped mid-scan)
|
|
33
36
|
*/
|
|
34
37
|
export const query_db_status = async (db, namespaces) => {
|
|
35
38
|
// check connectivity
|
|
@@ -51,7 +54,7 @@ export const query_db_status = async (db, namespaces) => {
|
|
|
51
54
|
ORDER BY table_name`);
|
|
52
55
|
const tables = [];
|
|
53
56
|
for (const { table_name } of table_rows) {
|
|
54
|
-
// table_name from information_schema is trusted
|
|
57
|
+
// table_name from information_schema is trusted (no parameterized DDL)
|
|
55
58
|
const result = await db.query_one(`SELECT COUNT(*) as count FROM "${table_name}"`);
|
|
56
59
|
tables.push({
|
|
57
60
|
name: table_name,
|
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,7 @@ 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`
|
|
115
117
|
*/
|
|
116
118
|
export declare const setup_env_file: (deps: FsReadDeps & FsWriteDeps & CommandDeps, env_path: string, example_path: string, options?: SetupEnvOptions) => Promise<SetupEnvResult>;
|
|
117
119
|
/**
|
|
@@ -124,6 +126,7 @@ export declare const setup_env_file: (deps: FsReadDeps & FsWriteDeps & CommandDe
|
|
|
124
126
|
* @param app_name - application name (used for default state directory)
|
|
125
127
|
* @param options - state_dir override, permissions, logger
|
|
126
128
|
* @returns result indicating whether a token was created
|
|
129
|
+
* @mutates filesystem - creates state directory and writes the token file (optionally chmods to `0o700` / `0o600`)
|
|
127
130
|
*/
|
|
128
131
|
export declare const setup_bootstrap_token: (deps: FsReadDeps & FsWriteDeps & CommandDeps & EnvDeps, app_name: string, options?: SetupBootstrapTokenOptions) => Promise<SetupTokenResult>;
|
|
129
132
|
/**
|
|
@@ -133,15 +136,20 @@ export declare const setup_bootstrap_token: (deps: FsReadDeps & FsWriteDeps & Co
|
|
|
133
136
|
* @param app_name - application name
|
|
134
137
|
* @param options - state_dir override, permissions, logger
|
|
135
138
|
* @returns result from creating the new token
|
|
139
|
+
* @mutates filesystem - removes the existing token file (if any) then writes a fresh one
|
|
136
140
|
*/
|
|
137
141
|
export declare const reset_bootstrap_token: (deps: FsReadDeps & FsWriteDeps & FsRemoveDeps & CommandDeps & EnvDeps, app_name: string, options?: SetupBootstrapTokenOptions) => Promise<SetupTokenResult>;
|
|
138
142
|
/**
|
|
139
143
|
* Create a PostgreSQL database if `createdb` is available.
|
|
140
144
|
*
|
|
145
|
+
* Does not throw — returns the underlying command result so callers can
|
|
146
|
+
* decide how to react to a missing `createdb` or an "already exists" failure.
|
|
147
|
+
*
|
|
141
148
|
* @param deps - command execution capability
|
|
142
149
|
* @param db_name - database name to create
|
|
143
150
|
* @param options - logger
|
|
144
151
|
* @returns the command result
|
|
152
|
+
* @mutates external database - invokes `createdb` to create `db_name` when available
|
|
145
153
|
*/
|
|
146
154
|
export declare const create_database: (deps: CommandDeps, db_name: string, options?: CreateDatabaseOptions) => Promise<CommandResult>;
|
|
147
155
|
/**
|
|
@@ -152,9 +160,11 @@ export declare const create_database: (deps: CommandDeps, db_name: string, optio
|
|
|
152
160
|
* For empty/missing URLs: skips.
|
|
153
161
|
*
|
|
154
162
|
* @param deps - command and file capabilities
|
|
155
|
-
* @param database_url - the DATABASE_URL value
|
|
156
|
-
* @param options - pglite_data_dir
|
|
163
|
+
* @param database_url - the `DATABASE_URL` value
|
|
164
|
+
* @param options - `pglite_data_dir`, logger
|
|
157
165
|
* @returns result describing what happened
|
|
166
|
+
* @mutates external database - drops and recreates the PostgreSQL database, or removes the PGlite data directory
|
|
167
|
+
* @mutates filesystem - removes `options.pglite_data_dir` recursively for PGlite URLs
|
|
158
168
|
*/
|
|
159
169
|
export declare const reset_database: (deps: CommandDeps & FsReadDeps & FsRemoveDeps, database_url: string, options?: ResetDatabaseOptions) => Promise<ResetDbResult>;
|
|
160
170
|
/** Input to `seed_dev_account`. */
|
|
@@ -186,6 +196,9 @@ export interface SeedDevAccountDeps extends QueryDeps {
|
|
|
186
196
|
* updates an existing password (rerun would silently rotate it).
|
|
187
197
|
*
|
|
188
198
|
* Intended for `scripts/dev_setup.ts` — do not call in production.
|
|
199
|
+
*
|
|
200
|
+
* @mutates database - inserts an account/actor pair when missing and grants any requested role permits
|
|
201
|
+
* @throws Error if an existing account is found without an associated actor row
|
|
189
202
|
*/
|
|
190
203
|
export declare const seed_dev_account: (deps: SeedDevAccountDeps, input: SeedDevAccountInput, options?: {
|
|
191
204
|
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,CA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CAAC,MAAM,CAAC,CAAC;CAC9B;AAED,oCAAoC;AACpC,MAAM,WAAW,oBAAoB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAC;CACjB;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,7 @@ 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`
|
|
81
83
|
*/
|
|
82
84
|
export const setup_env_file = async (deps, env_path, example_path, options) => {
|
|
83
85
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -136,6 +138,7 @@ export const setup_env_file = async (deps, env_path, example_path, options) => {
|
|
|
136
138
|
* @param app_name - application name (used for default state directory)
|
|
137
139
|
* @param options - state_dir override, permissions, logger
|
|
138
140
|
* @returns result indicating whether a token was created
|
|
141
|
+
* @mutates filesystem - creates state directory and writes the token file (optionally chmods to `0o700` / `0o600`)
|
|
139
142
|
*/
|
|
140
143
|
export const setup_bootstrap_token = async (deps, app_name, options) => {
|
|
141
144
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -169,6 +172,7 @@ export const setup_bootstrap_token = async (deps, app_name, options) => {
|
|
|
169
172
|
* @param app_name - application name
|
|
170
173
|
* @param options - state_dir override, permissions, logger
|
|
171
174
|
* @returns result from creating the new token
|
|
175
|
+
* @mutates filesystem - removes the existing token file (if any) then writes a fresh one
|
|
172
176
|
*/
|
|
173
177
|
export const reset_bootstrap_token = async (deps, app_name, options) => {
|
|
174
178
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -191,10 +195,14 @@ export const reset_bootstrap_token = async (deps, app_name, options) => {
|
|
|
191
195
|
/**
|
|
192
196
|
* Create a PostgreSQL database if `createdb` is available.
|
|
193
197
|
*
|
|
198
|
+
* Does not throw — returns the underlying command result so callers can
|
|
199
|
+
* decide how to react to a missing `createdb` or an "already exists" failure.
|
|
200
|
+
*
|
|
194
201
|
* @param deps - command execution capability
|
|
195
202
|
* @param db_name - database name to create
|
|
196
203
|
* @param options - logger
|
|
197
204
|
* @returns the command result
|
|
205
|
+
* @mutates external database - invokes `createdb` to create `db_name` when available
|
|
198
206
|
*/
|
|
199
207
|
export const create_database = async (deps, db_name, options) => {
|
|
200
208
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -220,9 +228,11 @@ export const create_database = async (deps, db_name, options) => {
|
|
|
220
228
|
* For empty/missing URLs: skips.
|
|
221
229
|
*
|
|
222
230
|
* @param deps - command and file capabilities
|
|
223
|
-
* @param database_url - the DATABASE_URL value
|
|
224
|
-
* @param options - pglite_data_dir
|
|
231
|
+
* @param database_url - the `DATABASE_URL` value
|
|
232
|
+
* @param options - `pglite_data_dir`, logger
|
|
225
233
|
* @returns result describing what happened
|
|
234
|
+
* @mutates external database - drops and recreates the PostgreSQL database, or removes the PGlite data directory
|
|
235
|
+
* @mutates filesystem - removes `options.pglite_data_dir` recursively for PGlite URLs
|
|
226
236
|
*/
|
|
227
237
|
export const reset_database = async (deps, database_url, options) => {
|
|
228
238
|
const log = options?.log ?? default_setup_logger;
|
|
@@ -273,6 +283,9 @@ export const reset_database = async (deps, database_url, options) => {
|
|
|
273
283
|
* updates an existing password (rerun would silently rotate it).
|
|
274
284
|
*
|
|
275
285
|
* Intended for `scripts/dev_setup.ts` — do not call in production.
|
|
286
|
+
*
|
|
287
|
+
* @mutates database - inserts an account/actor pair when missing and grants any requested role permits
|
|
288
|
+
* @throws Error if an existing account is found without an associated actor row
|
|
276
289
|
*/
|
|
277
290
|
export const seed_dev_account = async (deps, input, options) => {
|
|
278
291
|
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
|
@@ -41,12 +41,10 @@ export declare const log_env_validation_error: (error: EnvValidationError, label
|
|
|
41
41
|
/**
|
|
42
42
|
* Load and validate env vars against a Zod schema.
|
|
43
43
|
*
|
|
44
|
-
* Reads each key from the schema using `get_env`, then validates.
|
|
45
|
-
* Throws `EnvValidationError` on failure.
|
|
46
|
-
*
|
|
47
44
|
* @param schema - Zod object schema defining expected env vars
|
|
48
45
|
* @param get_env - function to read an env var by key
|
|
49
46
|
* @returns validated env object
|
|
47
|
+
* @throws EnvValidationError if Zod validation fails
|
|
50
48
|
*/
|
|
51
49
|
export declare const load_env: <T extends z.ZodObject>(schema: T, get_env: (key: string) => string | undefined) => z.infer<T>;
|
|
52
50
|
//# sourceMappingURL=load.d.ts.map
|
package/dist/env/load.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/load.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC5C,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD,gCAAgC;IAChC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;gBAEpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS;IAOhF;;;;OAIG;IACH,aAAa,IAAI,KAAK,CAAC,MAAM,CAAC;CAG9B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,kBAAkB,EAAE,QAAQ,MAAM,KAAG,IAUpF,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/load.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC5C,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD,gCAAgC;IAChC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;gBAEpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS;IAOhF;;;;OAIG;IACH,aAAa,IAAI,KAAK,CAAC,MAAM,CAAC;CAG9B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,kBAAkB,EAAE,QAAQ,MAAM,KAAG,IAUpF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,CAAC,CAAC,SAAS,EAC7C,QAAQ,CAAC,EACT,SAAS,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,KAC1C,CAAC,CAAC,KAAK,CAAC,CAAC,CAaX,CAAC"}
|
package/dist/env/load.js
CHANGED
|
@@ -59,12 +59,10 @@ export const log_env_validation_error = (error, label) => {
|
|
|
59
59
|
/**
|
|
60
60
|
* Load and validate env vars against a Zod schema.
|
|
61
61
|
*
|
|
62
|
-
* Reads each key from the schema using `get_env`, then validates.
|
|
63
|
-
* Throws `EnvValidationError` on failure.
|
|
64
|
-
*
|
|
65
62
|
* @param schema - Zod object schema defining expected env vars
|
|
66
63
|
* @param get_env - function to read an env var by key
|
|
67
64
|
* @returns validated env object
|
|
65
|
+
* @throws EnvValidationError if Zod validation fails
|
|
68
66
|
*/
|
|
69
67
|
export const load_env = (schema, get_env) => {
|
|
70
68
|
const raw = {};
|