@schema-weaver/pg-connector 0.0.0-stage → 2.0.1
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/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +457 -2
- package/dist/cjs/audit/chain.d.ts +365 -0
- package/dist/cjs/audit/chain.d.ts.map +1 -0
- package/dist/cjs/audit/chain.js +959 -0
- package/dist/cjs/audit/chain.js.map +1 -0
- package/dist/cjs/audit/cloud-client.d.ts +142 -0
- package/dist/cjs/audit/cloud-client.d.ts.map +1 -0
- package/dist/cjs/audit/cloud-client.js +364 -0
- package/dist/cjs/audit/cloud-client.js.map +1 -0
- package/dist/cjs/audit/cloud-writer.d.ts +57 -0
- package/dist/cjs/audit/cloud-writer.d.ts.map +1 -0
- package/dist/cjs/audit/cloud-writer.js +95 -0
- package/dist/cjs/audit/cloud-writer.js.map +1 -0
- package/dist/cjs/audit/context.d.ts +51 -0
- package/dist/cjs/audit/context.d.ts.map +1 -0
- package/dist/cjs/audit/context.js +75 -0
- package/dist/cjs/audit/context.js.map +1 -0
- package/dist/cjs/audit/files.d.ts +111 -0
- package/dist/cjs/audit/files.d.ts.map +1 -0
- package/dist/cjs/audit/files.js +406 -0
- package/dist/cjs/audit/files.js.map +1 -0
- package/dist/cjs/audit/index.d.ts +9 -0
- package/dist/cjs/audit/index.d.ts.map +1 -0
- package/dist/cjs/audit/index.js +68 -0
- package/dist/cjs/audit/index.js.map +1 -0
- package/dist/cjs/audit/local-writer.d.ts +255 -0
- package/dist/cjs/audit/local-writer.d.ts.map +1 -0
- package/dist/cjs/audit/local-writer.js +829 -0
- package/dist/cjs/audit/local-writer.js.map +1 -0
- package/dist/cjs/audit/redact.d.ts +151 -0
- package/dist/cjs/audit/redact.d.ts.map +1 -0
- package/dist/cjs/audit/redact.js +549 -0
- package/dist/cjs/audit/redact.js.map +1 -0
- package/dist/cjs/audit/sanitize.d.ts +78 -0
- package/dist/cjs/audit/sanitize.d.ts.map +1 -0
- package/dist/cjs/audit/sanitize.js +315 -0
- package/dist/cjs/audit/sanitize.js.map +1 -0
- package/dist/cjs/audit/sink.d.ts +278 -0
- package/dist/cjs/audit/sink.d.ts.map +1 -0
- package/dist/cjs/audit/sink.js +819 -0
- package/dist/cjs/audit/sink.js.map +1 -0
- package/dist/cjs/audit/types.d.ts +226 -0
- package/dist/cjs/audit/types.d.ts.map +1 -0
- package/dist/cjs/audit/types.js +3 -0
- package/dist/cjs/audit/types.js.map +1 -0
- package/dist/cjs/audit/verify-cache.d.ts +127 -0
- package/dist/cjs/audit/verify-cache.d.ts.map +1 -0
- package/dist/cjs/audit/verify-cache.js +668 -0
- package/dist/cjs/audit/verify-cache.js.map +1 -0
- package/dist/cjs/channels/agent-session.d.ts +228 -0
- package/dist/cjs/channels/agent-session.d.ts.map +1 -0
- package/dist/cjs/channels/agent-session.js +604 -0
- package/dist/cjs/channels/agent-session.js.map +1 -0
- package/dist/cjs/channels/data-channel.d.ts +181 -0
- package/dist/cjs/channels/data-channel.d.ts.map +1 -0
- package/dist/cjs/channels/data-channel.js +607 -0
- package/dist/cjs/channels/data-channel.js.map +1 -0
- package/dist/cjs/channels/reconnect.d.ts +142 -0
- package/dist/cjs/channels/reconnect.d.ts.map +1 -0
- package/dist/cjs/channels/reconnect.js +247 -0
- package/dist/cjs/channels/reconnect.js.map +1 -0
- package/dist/cjs/channels/types.d.ts +112 -0
- package/dist/cjs/channels/types.d.ts.map +1 -0
- package/dist/cjs/channels/types.js +3 -0
- package/dist/cjs/channels/types.js.map +1 -0
- package/dist/cjs/channels/wake-channel.d.ts +232 -0
- package/dist/cjs/channels/wake-channel.d.ts.map +1 -0
- package/dist/cjs/channels/wake-channel.js +752 -0
- package/dist/cjs/channels/wake-channel.js.map +1 -0
- package/dist/cjs/cli/banner.d.ts +2 -0
- package/dist/cjs/cli/banner.d.ts.map +1 -0
- package/dist/cjs/cli/banner.js +150 -0
- package/dist/cjs/cli/banner.js.map +1 -0
- package/dist/cjs/cli/commands/agent.d.ts +30 -0
- package/dist/cjs/cli/commands/agent.d.ts.map +1 -0
- package/dist/cjs/cli/commands/agent.js +214 -0
- package/dist/cjs/cli/commands/agent.js.map +1 -0
- package/dist/cjs/cli/commands/audit-verify.d.ts +19 -0
- package/dist/cjs/cli/commands/audit-verify.d.ts.map +1 -0
- package/dist/cjs/cli/commands/audit-verify.js +382 -0
- package/dist/cjs/cli/commands/audit-verify.js.map +1 -0
- package/dist/cjs/cli/commands/clean.d.ts +23 -0
- package/dist/cjs/cli/commands/clean.d.ts.map +1 -0
- package/dist/cjs/cli/commands/clean.js +272 -0
- package/dist/cjs/cli/commands/clean.js.map +1 -0
- package/dist/cjs/cli/commands/config-show.d.ts +2 -0
- package/dist/cjs/cli/commands/config-show.d.ts.map +1 -0
- package/dist/cjs/cli/commands/config-show.js +10 -0
- package/dist/cjs/cli/commands/config-show.js.map +1 -0
- package/dist/cjs/cli/commands/config.d.ts +6 -0
- package/dist/cjs/cli/commands/config.d.ts.map +1 -0
- package/dist/cjs/cli/commands/config.js +266 -0
- package/dist/cjs/cli/commands/config.js.map +1 -0
- package/dist/cjs/cli/commands/db-add.d.ts +16 -0
- package/dist/cjs/cli/commands/db-add.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-add.js +613 -0
- package/dist/cjs/cli/commands/db-add.js.map +1 -0
- package/dist/cjs/cli/commands/db-edit.d.ts +2 -0
- package/dist/cjs/cli/commands/db-edit.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-edit.js +388 -0
- package/dist/cjs/cli/commands/db-edit.js.map +1 -0
- package/dist/cjs/cli/commands/db-logs.d.ts +3 -0
- package/dist/cjs/cli/commands/db-logs.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-logs.js +67 -0
- package/dist/cjs/cli/commands/db-logs.js.map +1 -0
- package/dist/cjs/cli/commands/db-ls.d.ts +2 -0
- package/dist/cjs/cli/commands/db-ls.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-ls.js +118 -0
- package/dist/cjs/cli/commands/db-ls.js.map +1 -0
- package/dist/cjs/cli/commands/db-query.d.ts +121 -0
- package/dist/cjs/cli/commands/db-query.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-query.js +802 -0
- package/dist/cjs/cli/commands/db-query.js.map +1 -0
- package/dist/cjs/cli/commands/db-remove.d.ts +2 -0
- package/dist/cjs/cli/commands/db-remove.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-remove.js +51 -0
- package/dist/cjs/cli/commands/db-remove.js.map +1 -0
- package/dist/cjs/cli/commands/db-show.d.ts +2 -0
- package/dist/cjs/cli/commands/db-show.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-show.js +134 -0
- package/dist/cjs/cli/commands/db-show.js.map +1 -0
- package/dist/cjs/cli/commands/db-test.d.ts +3 -0
- package/dist/cjs/cli/commands/db-test.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db-test.js +311 -0
- package/dist/cjs/cli/commands/db-test.js.map +1 -0
- package/dist/cjs/cli/commands/db.d.ts +11 -0
- package/dist/cjs/cli/commands/db.d.ts.map +1 -0
- package/dist/cjs/cli/commands/db.js +90 -0
- package/dist/cjs/cli/commands/db.js.map +1 -0
- package/dist/cjs/cli/commands/debug.d.ts +2 -0
- package/dist/cjs/cli/commands/debug.d.ts.map +1 -0
- package/dist/cjs/cli/commands/debug.js +241 -0
- package/dist/cjs/cli/commands/debug.js.map +1 -0
- package/dist/cjs/cli/commands/doctor.d.ts +5 -0
- package/dist/cjs/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cjs/cli/commands/doctor.js +117 -0
- package/dist/cjs/cli/commands/doctor.js.map +1 -0
- package/dist/cjs/cli/commands/index.d.ts +10 -0
- package/dist/cjs/cli/commands/index.d.ts.map +1 -0
- package/dist/cjs/cli/commands/index.js +30 -0
- package/dist/cjs/cli/commands/index.js.map +1 -0
- package/dist/cjs/cli/commands/init.d.ts +2 -0
- package/dist/cjs/cli/commands/init.d.ts.map +1 -0
- package/dist/cjs/cli/commands/init.js +199 -0
- package/dist/cjs/cli/commands/init.js.map +1 -0
- package/dist/cjs/cli/commands/link.d.ts +5 -0
- package/dist/cjs/cli/commands/link.d.ts.map +1 -0
- package/dist/cjs/cli/commands/link.js +44 -0
- package/dist/cjs/cli/commands/link.js.map +1 -0
- package/dist/cjs/cli/commands/logs.d.ts +17 -0
- package/dist/cjs/cli/commands/logs.d.ts.map +1 -0
- package/dist/cjs/cli/commands/logs.js +314 -0
- package/dist/cjs/cli/commands/logs.js.map +1 -0
- package/dist/cjs/cli/commands/project-show.d.ts +2 -0
- package/dist/cjs/cli/commands/project-show.d.ts.map +1 -0
- package/dist/cjs/cli/commands/project-show.js +105 -0
- package/dist/cjs/cli/commands/project-show.js.map +1 -0
- package/dist/cjs/cli/commands/project.d.ts +3 -0
- package/dist/cjs/cli/commands/project.d.ts.map +1 -0
- package/dist/cjs/cli/commands/project.js +64 -0
- package/dist/cjs/cli/commands/project.js.map +1 -0
- package/dist/cjs/cli/commands/service.d.ts +123 -0
- package/dist/cjs/cli/commands/service.d.ts.map +1 -0
- package/dist/cjs/cli/commands/service.js +554 -0
- package/dist/cjs/cli/commands/service.js.map +1 -0
- package/dist/cjs/cli/commands/start.d.ts +6 -0
- package/dist/cjs/cli/commands/start.d.ts.map +1 -0
- package/dist/cjs/cli/commands/start.js +308 -0
- package/dist/cjs/cli/commands/start.js.map +1 -0
- package/dist/cjs/cli/commands/status.d.ts +2 -0
- package/dist/cjs/cli/commands/status.d.ts.map +1 -0
- package/dist/cjs/cli/commands/status.js +225 -0
- package/dist/cjs/cli/commands/status.js.map +1 -0
- package/dist/cjs/cli/commands/stop.d.ts +6 -0
- package/dist/cjs/cli/commands/stop.d.ts.map +1 -0
- package/dist/cjs/cli/commands/stop.js +99 -0
- package/dist/cjs/cli/commands/stop.js.map +1 -0
- package/dist/cjs/cli/daemon/error-tracker.d.ts +119 -0
- package/dist/cjs/cli/daemon/error-tracker.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/error-tracker.js +500 -0
- package/dist/cjs/cli/daemon/error-tracker.js.map +1 -0
- package/dist/cjs/cli/daemon/fault-shutdown.d.ts +144 -0
- package/dist/cjs/cli/daemon/fault-shutdown.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/fault-shutdown.js +312 -0
- package/dist/cjs/cli/daemon/fault-shutdown.js.map +1 -0
- package/dist/cjs/cli/daemon/index.d.ts +12 -0
- package/dist/cjs/cli/daemon/index.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/index.js +23 -0
- package/dist/cjs/cli/daemon/index.js.map +1 -0
- package/dist/cjs/cli/daemon/pid-file.d.ts +13 -0
- package/dist/cjs/cli/daemon/pid-file.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/pid-file.js +90 -0
- package/dist/cjs/cli/daemon/pid-file.js.map +1 -0
- package/dist/cjs/cli/daemon/readiness.d.ts +30 -0
- package/dist/cjs/cli/daemon/readiness.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/readiness.js +74 -0
- package/dist/cjs/cli/daemon/readiness.js.map +1 -0
- package/dist/cjs/cli/daemon/runtime.d.ts +366 -0
- package/dist/cjs/cli/daemon/runtime.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/runtime.js +1343 -0
- package/dist/cjs/cli/daemon/runtime.js.map +1 -0
- package/dist/cjs/cli/daemon/shutdown.d.ts +7 -0
- package/dist/cjs/cli/daemon/shutdown.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/shutdown.js +66 -0
- package/dist/cjs/cli/daemon/shutdown.js.map +1 -0
- package/dist/cjs/cli/daemon/signal-handlers.d.ts +3 -0
- package/dist/cjs/cli/daemon/signal-handlers.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/signal-handlers.js +27 -0
- package/dist/cjs/cli/daemon/signal-handlers.js.map +1 -0
- package/dist/cjs/cli/daemon/state.d.ts +157 -0
- package/dist/cjs/cli/daemon/state.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/state.js +397 -0
- package/dist/cjs/cli/daemon/state.js.map +1 -0
- package/dist/cjs/cli/daemon/status-file.d.ts +139 -0
- package/dist/cjs/cli/daemon/status-file.d.ts.map +1 -0
- package/dist/cjs/cli/daemon/status-file.js +88 -0
- package/dist/cjs/cli/daemon/status-file.js.map +1 -0
- package/dist/cjs/cli/doctor/checks.d.ts +133 -0
- package/dist/cjs/cli/doctor/checks.d.ts.map +1 -0
- package/dist/cjs/cli/doctor/checks.js +677 -0
- package/dist/cjs/cli/doctor/checks.js.map +1 -0
- package/dist/cjs/cli/doctor/fixes.d.ts +9 -0
- package/dist/cjs/cli/doctor/fixes.d.ts.map +1 -0
- package/dist/cjs/cli/doctor/fixes.js +199 -0
- package/dist/cjs/cli/doctor/fixes.js.map +1 -0
- package/dist/cjs/cli/doctor/index.d.ts +7 -0
- package/dist/cjs/cli/doctor/index.d.ts.map +1 -0
- package/dist/cjs/cli/doctor/index.js +27 -0
- package/dist/cjs/cli/doctor/index.js.map +1 -0
- package/dist/cjs/cli/index.d.ts +3 -0
- package/dist/cjs/cli/index.d.ts.map +1 -0
- package/dist/cjs/cli/index.js +336 -0
- package/dist/cjs/cli/index.js.map +1 -0
- package/dist/cjs/cli/interactive.d.ts +8 -0
- package/dist/cjs/cli/interactive.d.ts.map +1 -0
- package/dist/cjs/cli/interactive.js +670 -0
- package/dist/cjs/cli/interactive.js.map +1 -0
- package/dist/cjs/cli/logs/format.d.ts +13 -0
- package/dist/cjs/cli/logs/format.d.ts.map +1 -0
- package/dist/cjs/cli/logs/format.js +178 -0
- package/dist/cjs/cli/logs/format.js.map +1 -0
- package/dist/cjs/cli/logs/index.d.ts +3 -0
- package/dist/cjs/cli/logs/index.d.ts.map +1 -0
- package/dist/cjs/cli/logs/index.js +13 -0
- package/dist/cjs/cli/logs/index.js.map +1 -0
- package/dist/cjs/cli/logs/viewer.d.ts +41 -0
- package/dist/cjs/cli/logs/viewer.d.ts.map +1 -0
- package/dist/cjs/cli/logs/viewer.js +417 -0
- package/dist/cjs/cli/logs/viewer.js.map +1 -0
- package/dist/cjs/cli/ops/operation-logger.d.ts +63 -0
- package/dist/cjs/cli/ops/operation-logger.d.ts.map +1 -0
- package/dist/cjs/cli/ops/operation-logger.js +183 -0
- package/dist/cjs/cli/ops/operation-logger.js.map +1 -0
- package/dist/cjs/cli/palette.d.ts +11 -0
- package/dist/cjs/cli/palette.d.ts.map +1 -0
- package/dist/cjs/cli/palette.js +243 -0
- package/dist/cjs/cli/palette.js.map +1 -0
- package/dist/cjs/cli/prompt.d.ts +186 -0
- package/dist/cjs/cli/prompt.d.ts.map +1 -0
- package/dist/cjs/cli/prompt.js +541 -0
- package/dist/cjs/cli/prompt.js.map +1 -0
- package/dist/cjs/cli/ui/box.d.ts +21 -0
- package/dist/cjs/cli/ui/box.d.ts.map +1 -0
- package/dist/cjs/cli/ui/box.js +72 -0
- package/dist/cjs/cli/ui/box.js.map +1 -0
- package/dist/cjs/cli/ui/clipboard.d.ts +6 -0
- package/dist/cjs/cli/ui/clipboard.d.ts.map +1 -0
- package/dist/cjs/cli/ui/clipboard.js +78 -0
- package/dist/cjs/cli/ui/clipboard.js.map +1 -0
- package/dist/cjs/cli/ui/colors.d.ts +57 -0
- package/dist/cjs/cli/ui/colors.d.ts.map +1 -0
- package/dist/cjs/cli/ui/colors.js +151 -0
- package/dist/cjs/cli/ui/colors.js.map +1 -0
- package/dist/cjs/cli/ui/index.d.ts +9 -0
- package/dist/cjs/cli/ui/index.d.ts.map +1 -0
- package/dist/cjs/cli/ui/index.js +55 -0
- package/dist/cjs/cli/ui/index.js.map +1 -0
- package/dist/cjs/cli/ui/spinner.d.ts +12 -0
- package/dist/cjs/cli/ui/spinner.d.ts.map +1 -0
- package/dist/cjs/cli/ui/spinner.js +82 -0
- package/dist/cjs/cli/ui/spinner.js.map +1 -0
- package/dist/cjs/cli/ui/symbols.d.ts +47 -0
- package/dist/cjs/cli/ui/symbols.d.ts.map +1 -0
- package/dist/cjs/cli/ui/symbols.js +112 -0
- package/dist/cjs/cli/ui/symbols.js.map +1 -0
- package/dist/cjs/cli/ui/table.d.ts +23 -0
- package/dist/cjs/cli/ui/table.d.ts.map +1 -0
- package/dist/cjs/cli/ui/table.js +160 -0
- package/dist/cjs/cli/ui/table.js.map +1 -0
- package/dist/cjs/cli/ui/terminal.d.ts +7 -0
- package/dist/cjs/cli/ui/terminal.d.ts.map +1 -0
- package/dist/cjs/cli/ui/terminal.js +40 -0
- package/dist/cjs/cli/ui/terminal.js.map +1 -0
- package/dist/cjs/config/atomic-write.d.ts +69 -0
- package/dist/cjs/config/atomic-write.d.ts.map +1 -0
- package/dist/cjs/config/atomic-write.js +289 -0
- package/dist/cjs/config/atomic-write.js.map +1 -0
- package/dist/cjs/config/db-config.d.ts +134 -0
- package/dist/cjs/config/db-config.d.ts.map +1 -0
- package/dist/cjs/config/db-config.js +594 -0
- package/dist/cjs/config/db-config.js.map +1 -0
- package/dist/cjs/config/machine-config.d.ts +85 -0
- package/dist/cjs/config/machine-config.d.ts.map +1 -0
- package/dist/cjs/config/machine-config.js +232 -0
- package/dist/cjs/config/machine-config.js.map +1 -0
- package/dist/cjs/config/paths.d.ts +64 -0
- package/dist/cjs/config/paths.d.ts.map +1 -0
- package/dist/cjs/config/paths.js +155 -0
- package/dist/cjs/config/paths.js.map +1 -0
- package/dist/cjs/config/schema.d.ts +72 -0
- package/dist/cjs/config/schema.d.ts.map +1 -0
- package/dist/cjs/config/schema.js +197 -0
- package/dist/cjs/config/schema.js.map +1 -0
- package/dist/cjs/config/token.d.ts +63 -0
- package/dist/cjs/config/token.d.ts.map +1 -0
- package/dist/cjs/config/token.js +146 -0
- package/dist/cjs/config/token.js.map +1 -0
- package/dist/cjs/execution/canceller.d.ts +41 -0
- package/dist/cjs/execution/canceller.d.ts.map +1 -0
- package/dist/cjs/execution/canceller.js +209 -0
- package/dist/cjs/execution/canceller.js.map +1 -0
- package/dist/cjs/execution/database-lookup.d.ts +56 -0
- package/dist/cjs/execution/database-lookup.d.ts.map +1 -0
- package/dist/cjs/execution/database-lookup.js +43 -0
- package/dist/cjs/execution/database-lookup.js.map +1 -0
- package/dist/cjs/execution/dispatcher.d.ts +181 -0
- package/dist/cjs/execution/dispatcher.d.ts.map +1 -0
- package/dist/cjs/execution/dispatcher.js +1296 -0
- package/dist/cjs/execution/dispatcher.js.map +1 -0
- package/dist/cjs/execution/function-effects.d.ts +209 -0
- package/dist/cjs/execution/function-effects.d.ts.map +1 -0
- package/dist/cjs/execution/function-effects.js +596 -0
- package/dist/cjs/execution/function-effects.js.map +1 -0
- package/dist/cjs/execution/introspection.d.ts +76 -0
- package/dist/cjs/execution/introspection.d.ts.map +1 -0
- package/dist/cjs/execution/introspection.js +448 -0
- package/dist/cjs/execution/introspection.js.map +1 -0
- package/dist/cjs/execution/migration-runner.d.ts +128 -0
- package/dist/cjs/execution/migration-runner.d.ts.map +1 -0
- package/dist/cjs/execution/migration-runner.js +798 -0
- package/dist/cjs/execution/migration-runner.js.map +1 -0
- package/dist/cjs/execution/non-tx-detector.d.ts +23 -0
- package/dist/cjs/execution/non-tx-detector.d.ts.map +1 -0
- package/dist/cjs/execution/non-tx-detector.js +218 -0
- package/dist/cjs/execution/non-tx-detector.js.map +1 -0
- package/dist/cjs/execution/pool.d.ts +229 -0
- package/dist/cjs/execution/pool.d.ts.map +1 -0
- package/dist/cjs/execution/pool.js +738 -0
- package/dist/cjs/execution/pool.js.map +1 -0
- package/dist/cjs/execution/query-runner.d.ts +88 -0
- package/dist/cjs/execution/query-runner.d.ts.map +1 -0
- package/dist/cjs/execution/query-runner.js +751 -0
- package/dist/cjs/execution/query-runner.js.map +1 -0
- package/dist/cjs/execution/rate-limiter.d.ts +120 -0
- package/dist/cjs/execution/rate-limiter.d.ts.map +1 -0
- package/dist/cjs/execution/rate-limiter.js +273 -0
- package/dist/cjs/execution/rate-limiter.js.map +1 -0
- package/dist/cjs/execution/search-path.d.ts +161 -0
- package/dist/cjs/execution/search-path.d.ts.map +1 -0
- package/dist/cjs/execution/search-path.js +279 -0
- package/dist/cjs/execution/search-path.js.map +1 -0
- package/dist/cjs/execution/sql-parser.d.ts +195 -0
- package/dist/cjs/execution/sql-parser.d.ts.map +1 -0
- package/dist/cjs/execution/sql-parser.js +704 -0
- package/dist/cjs/execution/sql-parser.js.map +1 -0
- package/dist/cjs/execution/statement-classifier.d.ts +103 -0
- package/dist/cjs/execution/statement-classifier.d.ts.map +1 -0
- package/dist/cjs/execution/statement-classifier.js +535 -0
- package/dist/cjs/execution/statement-classifier.js.map +1 -0
- package/dist/cjs/execution/types.d.ts +189 -0
- package/dist/cjs/execution/types.d.ts.map +1 -0
- package/dist/cjs/execution/types.js +28 -0
- package/dist/cjs/execution/types.js.map +1 -0
- package/dist/cjs/index.d.ts +34 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +98 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/permissions/auto-upgrade.d.ts +40 -0
- package/dist/cjs/permissions/auto-upgrade.d.ts.map +1 -0
- package/dist/cjs/permissions/auto-upgrade.js +168 -0
- package/dist/cjs/permissions/auto-upgrade.js.map +1 -0
- package/dist/cjs/permissions/checker.d.ts +53 -0
- package/dist/cjs/permissions/checker.d.ts.map +1 -0
- package/dist/cjs/permissions/checker.js +326 -0
- package/dist/cjs/permissions/checker.js.map +1 -0
- package/dist/cjs/permissions/manual-approval.d.ts +213 -0
- package/dist/cjs/permissions/manual-approval.d.ts.map +1 -0
- package/dist/cjs/permissions/manual-approval.js +541 -0
- package/dist/cjs/permissions/manual-approval.js.map +1 -0
- package/dist/cjs/permissions/plan-registry.d.ts +274 -0
- package/dist/cjs/permissions/plan-registry.d.ts.map +1 -0
- package/dist/cjs/permissions/plan-registry.js +454 -0
- package/dist/cjs/permissions/plan-registry.js.map +1 -0
- package/dist/cjs/permissions/role-policy.d.ts +217 -0
- package/dist/cjs/permissions/role-policy.d.ts.map +1 -0
- package/dist/cjs/permissions/role-policy.js +584 -0
- package/dist/cjs/permissions/role-policy.js.map +1 -0
- package/dist/cjs/permissions/types.d.ts +126 -0
- package/dist/cjs/permissions/types.d.ts.map +1 -0
- package/dist/cjs/permissions/types.js +3 -0
- package/dist/cjs/permissions/types.js.map +1 -0
- package/dist/cjs/protocol/constants.d.ts +72 -0
- package/dist/cjs/protocol/constants.d.ts.map +1 -0
- package/dist/cjs/protocol/constants.js +107 -0
- package/dist/cjs/protocol/constants.js.map +1 -0
- package/dist/cjs/protocol/envelope.d.ts +165 -0
- package/dist/cjs/protocol/envelope.d.ts.map +1 -0
- package/dist/cjs/protocol/envelope.js +309 -0
- package/dist/cjs/protocol/envelope.js.map +1 -0
- package/dist/cjs/protocol/errors.d.ts +33 -0
- package/dist/cjs/protocol/errors.d.ts.map +1 -0
- package/dist/cjs/protocol/errors.js +391 -0
- package/dist/cjs/protocol/errors.js.map +1 -0
- package/dist/cjs/protocol/messages.d.ts +327 -0
- package/dist/cjs/protocol/messages.d.ts.map +1 -0
- package/dist/cjs/protocol/messages.js +3 -0
- package/dist/cjs/protocol/messages.js.map +1 -0
- package/dist/cjs/protocol/serialize.d.ts +26 -0
- package/dist/cjs/protocol/serialize.d.ts.map +1 -0
- package/dist/cjs/protocol/serialize.js +71 -0
- package/dist/cjs/protocol/serialize.js.map +1 -0
- package/dist/cjs/protocol/validate.d.ts +135 -0
- package/dist/cjs/protocol/validate.d.ts.map +1 -0
- package/dist/cjs/protocol/validate.js +852 -0
- package/dist/cjs/protocol/validate.js.map +1 -0
- package/dist/esm/audit/chain.d.ts +365 -0
- package/dist/esm/audit/chain.d.ts.map +1 -0
- package/dist/esm/audit/chain.js +895 -0
- package/dist/esm/audit/chain.js.map +1 -0
- package/dist/esm/audit/cloud-client.d.ts +142 -0
- package/dist/esm/audit/cloud-client.d.ts.map +1 -0
- package/dist/esm/audit/cloud-client.js +326 -0
- package/dist/esm/audit/cloud-client.js.map +1 -0
- package/dist/esm/audit/cloud-writer.d.ts +57 -0
- package/dist/esm/audit/cloud-writer.d.ts.map +1 -0
- package/dist/esm/audit/cloud-writer.js +91 -0
- package/dist/esm/audit/cloud-writer.js.map +1 -0
- package/dist/esm/audit/context.d.ts +51 -0
- package/dist/esm/audit/context.d.ts.map +1 -0
- package/dist/esm/audit/context.js +69 -0
- package/dist/esm/audit/context.js.map +1 -0
- package/dist/esm/audit/files.d.ts +111 -0
- package/dist/esm/audit/files.d.ts.map +1 -0
- package/dist/esm/audit/files.js +361 -0
- package/dist/esm/audit/files.js.map +1 -0
- package/dist/esm/audit/index.d.ts +9 -0
- package/dist/esm/audit/index.d.ts.map +1 -0
- package/dist/esm/audit/index.js +8 -0
- package/dist/esm/audit/index.js.map +1 -0
- package/dist/esm/audit/local-writer.d.ts +255 -0
- package/dist/esm/audit/local-writer.d.ts.map +1 -0
- package/dist/esm/audit/local-writer.js +785 -0
- package/dist/esm/audit/local-writer.js.map +1 -0
- package/dist/esm/audit/redact.d.ts +151 -0
- package/dist/esm/audit/redact.d.ts.map +1 -0
- package/dist/esm/audit/redact.js +506 -0
- package/dist/esm/audit/redact.js.map +1 -0
- package/dist/esm/audit/sanitize.d.ts +78 -0
- package/dist/esm/audit/sanitize.d.ts.map +1 -0
- package/dist/esm/audit/sanitize.js +307 -0
- package/dist/esm/audit/sanitize.js.map +1 -0
- package/dist/esm/audit/sink.d.ts +278 -0
- package/dist/esm/audit/sink.d.ts.map +1 -0
- package/dist/esm/audit/sink.js +782 -0
- package/dist/esm/audit/sink.js.map +1 -0
- package/dist/esm/audit/types.d.ts +226 -0
- package/dist/esm/audit/types.d.ts.map +1 -0
- package/dist/esm/audit/types.js +2 -0
- package/dist/esm/audit/types.js.map +1 -0
- package/dist/esm/audit/verify-cache.d.ts +127 -0
- package/dist/esm/audit/verify-cache.d.ts.map +1 -0
- package/dist/esm/audit/verify-cache.js +628 -0
- package/dist/esm/audit/verify-cache.js.map +1 -0
- package/dist/esm/channels/agent-session.d.ts +228 -0
- package/dist/esm/channels/agent-session.d.ts.map +1 -0
- package/dist/esm/channels/agent-session.js +566 -0
- package/dist/esm/channels/agent-session.js.map +1 -0
- package/dist/esm/channels/data-channel.d.ts +181 -0
- package/dist/esm/channels/data-channel.d.ts.map +1 -0
- package/dist/esm/channels/data-channel.js +567 -0
- package/dist/esm/channels/data-channel.js.map +1 -0
- package/dist/esm/channels/reconnect.d.ts +142 -0
- package/dist/esm/channels/reconnect.d.ts.map +1 -0
- package/dist/esm/channels/reconnect.js +234 -0
- package/dist/esm/channels/reconnect.js.map +1 -0
- package/dist/esm/channels/types.d.ts +112 -0
- package/dist/esm/channels/types.d.ts.map +1 -0
- package/dist/esm/channels/types.js +2 -0
- package/dist/esm/channels/types.js.map +1 -0
- package/dist/esm/channels/wake-channel.d.ts +232 -0
- package/dist/esm/channels/wake-channel.d.ts.map +1 -0
- package/dist/esm/channels/wake-channel.js +715 -0
- package/dist/esm/channels/wake-channel.js.map +1 -0
- package/dist/esm/cli/banner.d.ts +2 -0
- package/dist/esm/cli/banner.d.ts.map +1 -0
- package/dist/esm/cli/banner.js +114 -0
- package/dist/esm/cli/banner.js.map +1 -0
- package/dist/esm/cli/commands/agent.d.ts +30 -0
- package/dist/esm/cli/commands/agent.d.ts.map +1 -0
- package/dist/esm/cli/commands/agent.js +204 -0
- package/dist/esm/cli/commands/agent.js.map +1 -0
- package/dist/esm/cli/commands/audit-verify.d.ts +19 -0
- package/dist/esm/cli/commands/audit-verify.d.ts.map +1 -0
- package/dist/esm/cli/commands/audit-verify.js +345 -0
- package/dist/esm/cli/commands/audit-verify.js.map +1 -0
- package/dist/esm/cli/commands/clean.d.ts +23 -0
- package/dist/esm/cli/commands/clean.d.ts.map +1 -0
- package/dist/esm/cli/commands/clean.js +235 -0
- package/dist/esm/cli/commands/clean.js.map +1 -0
- package/dist/esm/cli/commands/config-show.d.ts +2 -0
- package/dist/esm/cli/commands/config-show.d.ts.map +1 -0
- package/dist/esm/cli/commands/config-show.js +2 -0
- package/dist/esm/cli/commands/config-show.js.map +1 -0
- package/dist/esm/cli/commands/config.d.ts +6 -0
- package/dist/esm/cli/commands/config.d.ts.map +1 -0
- package/dist/esm/cli/commands/config.js +259 -0
- package/dist/esm/cli/commands/config.js.map +1 -0
- package/dist/esm/cli/commands/db-add.d.ts +16 -0
- package/dist/esm/cli/commands/db-add.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-add.js +576 -0
- package/dist/esm/cli/commands/db-add.js.map +1 -0
- package/dist/esm/cli/commands/db-edit.d.ts +2 -0
- package/dist/esm/cli/commands/db-edit.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-edit.js +352 -0
- package/dist/esm/cli/commands/db-edit.js.map +1 -0
- package/dist/esm/cli/commands/db-logs.d.ts +3 -0
- package/dist/esm/cli/commands/db-logs.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-logs.js +64 -0
- package/dist/esm/cli/commands/db-logs.js.map +1 -0
- package/dist/esm/cli/commands/db-ls.d.ts +2 -0
- package/dist/esm/cli/commands/db-ls.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-ls.js +115 -0
- package/dist/esm/cli/commands/db-ls.js.map +1 -0
- package/dist/esm/cli/commands/db-query.d.ts +121 -0
- package/dist/esm/cli/commands/db-query.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-query.js +754 -0
- package/dist/esm/cli/commands/db-query.js.map +1 -0
- package/dist/esm/cli/commands/db-remove.d.ts +2 -0
- package/dist/esm/cli/commands/db-remove.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-remove.js +48 -0
- package/dist/esm/cli/commands/db-remove.js.map +1 -0
- package/dist/esm/cli/commands/db-show.d.ts +2 -0
- package/dist/esm/cli/commands/db-show.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-show.js +131 -0
- package/dist/esm/cli/commands/db-show.js.map +1 -0
- package/dist/esm/cli/commands/db-test.d.ts +3 -0
- package/dist/esm/cli/commands/db-test.d.ts.map +1 -0
- package/dist/esm/cli/commands/db-test.js +307 -0
- package/dist/esm/cli/commands/db-test.js.map +1 -0
- package/dist/esm/cli/commands/db.d.ts +11 -0
- package/dist/esm/cli/commands/db.d.ts.map +1 -0
- package/dist/esm/cli/commands/db.js +76 -0
- package/dist/esm/cli/commands/db.js.map +1 -0
- package/dist/esm/cli/commands/debug.d.ts +2 -0
- package/dist/esm/cli/commands/debug.d.ts.map +1 -0
- package/dist/esm/cli/commands/debug.js +205 -0
- package/dist/esm/cli/commands/debug.js.map +1 -0
- package/dist/esm/cli/commands/doctor.d.ts +5 -0
- package/dist/esm/cli/commands/doctor.d.ts.map +1 -0
- package/dist/esm/cli/commands/doctor.js +114 -0
- package/dist/esm/cli/commands/doctor.js.map +1 -0
- package/dist/esm/cli/commands/index.d.ts +10 -0
- package/dist/esm/cli/commands/index.d.ts.map +1 -0
- package/dist/esm/cli/commands/index.js +10 -0
- package/dist/esm/cli/commands/index.js.map +1 -0
- package/dist/esm/cli/commands/init.d.ts +2 -0
- package/dist/esm/cli/commands/init.d.ts.map +1 -0
- package/dist/esm/cli/commands/init.js +163 -0
- package/dist/esm/cli/commands/init.js.map +1 -0
- package/dist/esm/cli/commands/link.d.ts +5 -0
- package/dist/esm/cli/commands/link.d.ts.map +1 -0
- package/dist/esm/cli/commands/link.js +41 -0
- package/dist/esm/cli/commands/link.js.map +1 -0
- package/dist/esm/cli/commands/logs.d.ts +17 -0
- package/dist/esm/cli/commands/logs.d.ts.map +1 -0
- package/dist/esm/cli/commands/logs.js +278 -0
- package/dist/esm/cli/commands/logs.js.map +1 -0
- package/dist/esm/cli/commands/project-show.d.ts +2 -0
- package/dist/esm/cli/commands/project-show.d.ts.map +1 -0
- package/dist/esm/cli/commands/project-show.js +69 -0
- package/dist/esm/cli/commands/project-show.js.map +1 -0
- package/dist/esm/cli/commands/project.d.ts +3 -0
- package/dist/esm/cli/commands/project.d.ts.map +1 -0
- package/dist/esm/cli/commands/project.js +60 -0
- package/dist/esm/cli/commands/project.js.map +1 -0
- package/dist/esm/cli/commands/service.d.ts +123 -0
- package/dist/esm/cli/commands/service.d.ts.map +1 -0
- package/dist/esm/cli/commands/service.js +505 -0
- package/dist/esm/cli/commands/service.js.map +1 -0
- package/dist/esm/cli/commands/start.d.ts +6 -0
- package/dist/esm/cli/commands/start.d.ts.map +1 -0
- package/dist/esm/cli/commands/start.js +272 -0
- package/dist/esm/cli/commands/start.js.map +1 -0
- package/dist/esm/cli/commands/status.d.ts +2 -0
- package/dist/esm/cli/commands/status.d.ts.map +1 -0
- package/dist/esm/cli/commands/status.js +222 -0
- package/dist/esm/cli/commands/status.js.map +1 -0
- package/dist/esm/cli/commands/stop.d.ts +6 -0
- package/dist/esm/cli/commands/stop.d.ts.map +1 -0
- package/dist/esm/cli/commands/stop.js +96 -0
- package/dist/esm/cli/commands/stop.js.map +1 -0
- package/dist/esm/cli/daemon/error-tracker.d.ts +119 -0
- package/dist/esm/cli/daemon/error-tracker.d.ts.map +1 -0
- package/dist/esm/cli/daemon/error-tracker.js +451 -0
- package/dist/esm/cli/daemon/error-tracker.js.map +1 -0
- package/dist/esm/cli/daemon/fault-shutdown.d.ts +144 -0
- package/dist/esm/cli/daemon/fault-shutdown.d.ts.map +1 -0
- package/dist/esm/cli/daemon/fault-shutdown.js +273 -0
- package/dist/esm/cli/daemon/fault-shutdown.js.map +1 -0
- package/dist/esm/cli/daemon/index.d.ts +12 -0
- package/dist/esm/cli/daemon/index.d.ts.map +1 -0
- package/dist/esm/cli/daemon/index.js +7 -0
- package/dist/esm/cli/daemon/index.js.map +1 -0
- package/dist/esm/cli/daemon/pid-file.d.ts +13 -0
- package/dist/esm/cli/daemon/pid-file.d.ts.map +1 -0
- package/dist/esm/cli/daemon/pid-file.js +51 -0
- package/dist/esm/cli/daemon/pid-file.js.map +1 -0
- package/dist/esm/cli/daemon/readiness.d.ts +30 -0
- package/dist/esm/cli/daemon/readiness.d.ts.map +1 -0
- package/dist/esm/cli/daemon/readiness.js +70 -0
- package/dist/esm/cli/daemon/readiness.js.map +1 -0
- package/dist/esm/cli/daemon/runtime.d.ts +366 -0
- package/dist/esm/cli/daemon/runtime.d.ts.map +1 -0
- package/dist/esm/cli/daemon/runtime.js +1284 -0
- package/dist/esm/cli/daemon/runtime.js.map +1 -0
- package/dist/esm/cli/daemon/shutdown.d.ts +7 -0
- package/dist/esm/cli/daemon/shutdown.d.ts.map +1 -0
- package/dist/esm/cli/daemon/shutdown.js +63 -0
- package/dist/esm/cli/daemon/shutdown.js.map +1 -0
- package/dist/esm/cli/daemon/signal-handlers.d.ts +3 -0
- package/dist/esm/cli/daemon/signal-handlers.d.ts.map +1 -0
- package/dist/esm/cli/daemon/signal-handlers.js +24 -0
- package/dist/esm/cli/daemon/signal-handlers.js.map +1 -0
- package/dist/esm/cli/daemon/state.d.ts +157 -0
- package/dist/esm/cli/daemon/state.d.ts.map +1 -0
- package/dist/esm/cli/daemon/state.js +352 -0
- package/dist/esm/cli/daemon/state.js.map +1 -0
- package/dist/esm/cli/daemon/status-file.d.ts +139 -0
- package/dist/esm/cli/daemon/status-file.d.ts.map +1 -0
- package/dist/esm/cli/daemon/status-file.js +50 -0
- package/dist/esm/cli/daemon/status-file.js.map +1 -0
- package/dist/esm/cli/doctor/checks.d.ts +133 -0
- package/dist/esm/cli/doctor/checks.d.ts.map +1 -0
- package/dist/esm/cli/doctor/checks.js +624 -0
- package/dist/esm/cli/doctor/checks.js.map +1 -0
- package/dist/esm/cli/doctor/fixes.d.ts +9 -0
- package/dist/esm/cli/doctor/fixes.d.ts.map +1 -0
- package/dist/esm/cli/doctor/fixes.js +163 -0
- package/dist/esm/cli/doctor/fixes.js.map +1 -0
- package/dist/esm/cli/doctor/index.d.ts +7 -0
- package/dist/esm/cli/doctor/index.d.ts.map +1 -0
- package/dist/esm/cli/doctor/index.js +5 -0
- package/dist/esm/cli/doctor/index.js.map +1 -0
- package/dist/esm/cli/index.d.ts +3 -0
- package/dist/esm/cli/index.d.ts.map +1 -0
- package/dist/esm/cli/index.js +333 -0
- package/dist/esm/cli/index.js.map +1 -0
- package/dist/esm/cli/interactive.d.ts +8 -0
- package/dist/esm/cli/interactive.d.ts.map +1 -0
- package/dist/esm/cli/interactive.js +665 -0
- package/dist/esm/cli/interactive.js.map +1 -0
- package/dist/esm/cli/logs/format.d.ts +13 -0
- package/dist/esm/cli/logs/format.d.ts.map +1 -0
- package/dist/esm/cli/logs/format.js +169 -0
- package/dist/esm/cli/logs/format.js.map +1 -0
- package/dist/esm/cli/logs/index.d.ts +3 -0
- package/dist/esm/cli/logs/index.d.ts.map +1 -0
- package/dist/esm/cli/logs/index.js +3 -0
- package/dist/esm/cli/logs/index.js.map +1 -0
- package/dist/esm/cli/logs/viewer.d.ts +41 -0
- package/dist/esm/cli/logs/viewer.d.ts.map +1 -0
- package/dist/esm/cli/logs/viewer.js +412 -0
- package/dist/esm/cli/logs/viewer.js.map +1 -0
- package/dist/esm/cli/ops/operation-logger.d.ts +63 -0
- package/dist/esm/cli/ops/operation-logger.d.ts.map +1 -0
- package/dist/esm/cli/ops/operation-logger.js +142 -0
- package/dist/esm/cli/ops/operation-logger.js.map +1 -0
- package/dist/esm/cli/palette.d.ts +11 -0
- package/dist/esm/cli/palette.d.ts.map +1 -0
- package/dist/esm/cli/palette.js +240 -0
- package/dist/esm/cli/palette.js.map +1 -0
- package/dist/esm/cli/prompt.d.ts +186 -0
- package/dist/esm/cli/prompt.d.ts.map +1 -0
- package/dist/esm/cli/prompt.js +483 -0
- package/dist/esm/cli/prompt.js.map +1 -0
- package/dist/esm/cli/ui/box.d.ts +21 -0
- package/dist/esm/cli/ui/box.d.ts.map +1 -0
- package/dist/esm/cli/ui/box.js +60 -0
- package/dist/esm/cli/ui/box.js.map +1 -0
- package/dist/esm/cli/ui/clipboard.d.ts +6 -0
- package/dist/esm/cli/ui/clipboard.d.ts.map +1 -0
- package/dist/esm/cli/ui/clipboard.js +42 -0
- package/dist/esm/cli/ui/clipboard.js.map +1 -0
- package/dist/esm/cli/ui/colors.d.ts +57 -0
- package/dist/esm/cli/ui/colors.d.ts.map +1 -0
- package/dist/esm/cli/ui/colors.js +126 -0
- package/dist/esm/cli/ui/colors.js.map +1 -0
- package/dist/esm/cli/ui/index.d.ts +9 -0
- package/dist/esm/cli/ui/index.d.ts.map +1 -0
- package/dist/esm/cli/ui/index.js +7 -0
- package/dist/esm/cli/ui/index.js.map +1 -0
- package/dist/esm/cli/ui/spinner.d.ts +12 -0
- package/dist/esm/cli/ui/spinner.d.ts.map +1 -0
- package/dist/esm/cli/ui/spinner.js +78 -0
- package/dist/esm/cli/ui/spinner.js.map +1 -0
- package/dist/esm/cli/ui/symbols.d.ts +47 -0
- package/dist/esm/cli/ui/symbols.d.ts.map +1 -0
- package/dist/esm/cli/ui/symbols.js +109 -0
- package/dist/esm/cli/ui/symbols.js.map +1 -0
- package/dist/esm/cli/ui/table.d.ts +23 -0
- package/dist/esm/cli/ui/table.d.ts.map +1 -0
- package/dist/esm/cli/ui/table.js +156 -0
- package/dist/esm/cli/ui/table.js.map +1 -0
- package/dist/esm/cli/ui/terminal.d.ts +7 -0
- package/dist/esm/cli/ui/terminal.d.ts.map +1 -0
- package/dist/esm/cli/ui/terminal.js +32 -0
- package/dist/esm/cli/ui/terminal.js.map +1 -0
- package/dist/esm/config/atomic-write.d.ts +69 -0
- package/dist/esm/config/atomic-write.d.ts.map +1 -0
- package/dist/esm/config/atomic-write.js +246 -0
- package/dist/esm/config/atomic-write.js.map +1 -0
- package/dist/esm/config/db-config.d.ts +134 -0
- package/dist/esm/config/db-config.d.ts.map +1 -0
- package/dist/esm/config/db-config.js +542 -0
- package/dist/esm/config/db-config.js.map +1 -0
- package/dist/esm/config/machine-config.d.ts +85 -0
- package/dist/esm/config/machine-config.d.ts.map +1 -0
- package/dist/esm/config/machine-config.js +190 -0
- package/dist/esm/config/machine-config.js.map +1 -0
- package/dist/esm/config/paths.d.ts +64 -0
- package/dist/esm/config/paths.d.ts.map +1 -0
- package/dist/esm/config/paths.js +108 -0
- package/dist/esm/config/paths.js.map +1 -0
- package/dist/esm/config/schema.d.ts +72 -0
- package/dist/esm/config/schema.d.ts.map +1 -0
- package/dist/esm/config/schema.js +180 -0
- package/dist/esm/config/schema.js.map +1 -0
- package/dist/esm/config/token.d.ts +63 -0
- package/dist/esm/config/token.d.ts.map +1 -0
- package/dist/esm/config/token.js +104 -0
- package/dist/esm/config/token.js.map +1 -0
- package/dist/esm/execution/canceller.d.ts +41 -0
- package/dist/esm/execution/canceller.d.ts.map +1 -0
- package/dist/esm/execution/canceller.js +205 -0
- package/dist/esm/execution/canceller.js.map +1 -0
- package/dist/esm/execution/database-lookup.d.ts +56 -0
- package/dist/esm/execution/database-lookup.d.ts.map +1 -0
- package/dist/esm/execution/database-lookup.js +38 -0
- package/dist/esm/execution/database-lookup.js.map +1 -0
- package/dist/esm/execution/dispatcher.d.ts +181 -0
- package/dist/esm/execution/dispatcher.d.ts.map +1 -0
- package/dist/esm/execution/dispatcher.js +1258 -0
- package/dist/esm/execution/dispatcher.js.map +1 -0
- package/dist/esm/execution/function-effects.d.ts +209 -0
- package/dist/esm/execution/function-effects.d.ts.map +1 -0
- package/dist/esm/execution/function-effects.js +586 -0
- package/dist/esm/execution/function-effects.js.map +1 -0
- package/dist/esm/execution/introspection.d.ts +76 -0
- package/dist/esm/execution/introspection.d.ts.map +1 -0
- package/dist/esm/execution/introspection.js +442 -0
- package/dist/esm/execution/introspection.js.map +1 -0
- package/dist/esm/execution/migration-runner.d.ts +128 -0
- package/dist/esm/execution/migration-runner.d.ts.map +1 -0
- package/dist/esm/execution/migration-runner.js +754 -0
- package/dist/esm/execution/migration-runner.js.map +1 -0
- package/dist/esm/execution/non-tx-detector.d.ts +23 -0
- package/dist/esm/execution/non-tx-detector.d.ts.map +1 -0
- package/dist/esm/execution/non-tx-detector.js +215 -0
- package/dist/esm/execution/non-tx-detector.js.map +1 -0
- package/dist/esm/execution/pool.d.ts +229 -0
- package/dist/esm/execution/pool.d.ts.map +1 -0
- package/dist/esm/execution/pool.js +685 -0
- package/dist/esm/execution/pool.js.map +1 -0
- package/dist/esm/execution/query-runner.d.ts +88 -0
- package/dist/esm/execution/query-runner.d.ts.map +1 -0
- package/dist/esm/execution/query-runner.js +743 -0
- package/dist/esm/execution/query-runner.js.map +1 -0
- package/dist/esm/execution/rate-limiter.d.ts +120 -0
- package/dist/esm/execution/rate-limiter.d.ts.map +1 -0
- package/dist/esm/execution/rate-limiter.js +269 -0
- package/dist/esm/execution/rate-limiter.js.map +1 -0
- package/dist/esm/execution/search-path.d.ts +161 -0
- package/dist/esm/execution/search-path.d.ts.map +1 -0
- package/dist/esm/execution/search-path.js +270 -0
- package/dist/esm/execution/search-path.js.map +1 -0
- package/dist/esm/execution/sql-parser.d.ts +195 -0
- package/dist/esm/execution/sql-parser.d.ts.map +1 -0
- package/dist/esm/execution/sql-parser.js +683 -0
- package/dist/esm/execution/sql-parser.js.map +1 -0
- package/dist/esm/execution/statement-classifier.d.ts +103 -0
- package/dist/esm/execution/statement-classifier.d.ts.map +1 -0
- package/dist/esm/execution/statement-classifier.js +526 -0
- package/dist/esm/execution/statement-classifier.js.map +1 -0
- package/dist/esm/execution/types.d.ts +189 -0
- package/dist/esm/execution/types.d.ts.map +1 -0
- package/dist/esm/execution/types.js +22 -0
- package/dist/esm/execution/types.js.map +1 -0
- package/dist/esm/index.d.ts +34 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/permissions/auto-upgrade.d.ts +40 -0
- package/dist/esm/permissions/auto-upgrade.d.ts.map +1 -0
- package/dist/esm/permissions/auto-upgrade.js +164 -0
- package/dist/esm/permissions/auto-upgrade.js.map +1 -0
- package/dist/esm/permissions/checker.d.ts +53 -0
- package/dist/esm/permissions/checker.d.ts.map +1 -0
- package/dist/esm/permissions/checker.js +322 -0
- package/dist/esm/permissions/checker.js.map +1 -0
- package/dist/esm/permissions/manual-approval.d.ts +213 -0
- package/dist/esm/permissions/manual-approval.d.ts.map +1 -0
- package/dist/esm/permissions/manual-approval.js +503 -0
- package/dist/esm/permissions/manual-approval.js.map +1 -0
- package/dist/esm/permissions/plan-registry.d.ts +274 -0
- package/dist/esm/permissions/plan-registry.d.ts.map +1 -0
- package/dist/esm/permissions/plan-registry.js +450 -0
- package/dist/esm/permissions/plan-registry.js.map +1 -0
- package/dist/esm/permissions/role-policy.d.ts +217 -0
- package/dist/esm/permissions/role-policy.d.ts.map +1 -0
- package/dist/esm/permissions/role-policy.js +570 -0
- package/dist/esm/permissions/role-policy.js.map +1 -0
- package/dist/esm/permissions/types.d.ts +126 -0
- package/dist/esm/permissions/types.d.ts.map +1 -0
- package/dist/esm/permissions/types.js +2 -0
- package/dist/esm/permissions/types.js.map +1 -0
- package/dist/esm/protocol/constants.d.ts +72 -0
- package/dist/esm/protocol/constants.d.ts.map +1 -0
- package/dist/esm/protocol/constants.js +104 -0
- package/dist/esm/protocol/constants.js.map +1 -0
- package/dist/esm/protocol/envelope.d.ts +165 -0
- package/dist/esm/protocol/envelope.d.ts.map +1 -0
- package/dist/esm/protocol/envelope.js +263 -0
- package/dist/esm/protocol/envelope.js.map +1 -0
- package/dist/esm/protocol/errors.d.ts +33 -0
- package/dist/esm/protocol/errors.d.ts.map +1 -0
- package/dist/esm/protocol/errors.js +384 -0
- package/dist/esm/protocol/errors.js.map +1 -0
- package/dist/esm/protocol/messages.d.ts +327 -0
- package/dist/esm/protocol/messages.d.ts.map +1 -0
- package/dist/esm/protocol/messages.js +2 -0
- package/dist/esm/protocol/messages.js.map +1 -0
- package/dist/esm/protocol/serialize.d.ts +26 -0
- package/dist/esm/protocol/serialize.d.ts.map +1 -0
- package/dist/esm/protocol/serialize.js +63 -0
- package/dist/esm/protocol/serialize.js.map +1 -0
- package/dist/esm/protocol/validate.d.ts +135 -0
- package/dist/esm/protocol/validate.d.ts.map +1 -0
- package/dist/esm/protocol/validate.js +830 -0
- package/dist/esm/protocol/validate.js.map +1 -0
- package/dist/types/audit/chain.d.ts +365 -0
- package/dist/types/audit/chain.d.ts.map +1 -0
- package/dist/types/audit/cloud-client.d.ts +142 -0
- package/dist/types/audit/cloud-client.d.ts.map +1 -0
- package/dist/types/audit/cloud-writer.d.ts +57 -0
- package/dist/types/audit/cloud-writer.d.ts.map +1 -0
- package/dist/types/audit/context.d.ts +51 -0
- package/dist/types/audit/context.d.ts.map +1 -0
- package/dist/types/audit/files.d.ts +111 -0
- package/dist/types/audit/files.d.ts.map +1 -0
- package/dist/types/audit/index.d.ts +9 -0
- package/dist/types/audit/index.d.ts.map +1 -0
- package/dist/types/audit/local-writer.d.ts +255 -0
- package/dist/types/audit/local-writer.d.ts.map +1 -0
- package/dist/types/audit/redact.d.ts +151 -0
- package/dist/types/audit/redact.d.ts.map +1 -0
- package/dist/types/audit/sanitize.d.ts +78 -0
- package/dist/types/audit/sanitize.d.ts.map +1 -0
- package/dist/types/audit/sink.d.ts +278 -0
- package/dist/types/audit/sink.d.ts.map +1 -0
- package/dist/types/audit/types.d.ts +226 -0
- package/dist/types/audit/types.d.ts.map +1 -0
- package/dist/types/audit/verify-cache.d.ts +127 -0
- package/dist/types/audit/verify-cache.d.ts.map +1 -0
- package/dist/types/channels/agent-session.d.ts +228 -0
- package/dist/types/channels/agent-session.d.ts.map +1 -0
- package/dist/types/channels/data-channel.d.ts +181 -0
- package/dist/types/channels/data-channel.d.ts.map +1 -0
- package/dist/types/channels/reconnect.d.ts +142 -0
- package/dist/types/channels/reconnect.d.ts.map +1 -0
- package/dist/types/channels/types.d.ts +112 -0
- package/dist/types/channels/types.d.ts.map +1 -0
- package/dist/types/channels/wake-channel.d.ts +232 -0
- package/dist/types/channels/wake-channel.d.ts.map +1 -0
- package/dist/types/cli/banner.d.ts +2 -0
- package/dist/types/cli/banner.d.ts.map +1 -0
- package/dist/types/cli/commands/agent.d.ts +30 -0
- package/dist/types/cli/commands/agent.d.ts.map +1 -0
- package/dist/types/cli/commands/audit-verify.d.ts +19 -0
- package/dist/types/cli/commands/audit-verify.d.ts.map +1 -0
- package/dist/types/cli/commands/clean.d.ts +23 -0
- package/dist/types/cli/commands/clean.d.ts.map +1 -0
- package/dist/types/cli/commands/config-show.d.ts +2 -0
- package/dist/types/cli/commands/config-show.d.ts.map +1 -0
- package/dist/types/cli/commands/config.d.ts +6 -0
- package/dist/types/cli/commands/config.d.ts.map +1 -0
- package/dist/types/cli/commands/db-add.d.ts +16 -0
- package/dist/types/cli/commands/db-add.d.ts.map +1 -0
- package/dist/types/cli/commands/db-edit.d.ts +2 -0
- package/dist/types/cli/commands/db-edit.d.ts.map +1 -0
- package/dist/types/cli/commands/db-logs.d.ts +3 -0
- package/dist/types/cli/commands/db-logs.d.ts.map +1 -0
- package/dist/types/cli/commands/db-ls.d.ts +2 -0
- package/dist/types/cli/commands/db-ls.d.ts.map +1 -0
- package/dist/types/cli/commands/db-query.d.ts +121 -0
- package/dist/types/cli/commands/db-query.d.ts.map +1 -0
- package/dist/types/cli/commands/db-remove.d.ts +2 -0
- package/dist/types/cli/commands/db-remove.d.ts.map +1 -0
- package/dist/types/cli/commands/db-show.d.ts +2 -0
- package/dist/types/cli/commands/db-show.d.ts.map +1 -0
- package/dist/types/cli/commands/db-test.d.ts +3 -0
- package/dist/types/cli/commands/db-test.d.ts.map +1 -0
- package/dist/types/cli/commands/db.d.ts +11 -0
- package/dist/types/cli/commands/db.d.ts.map +1 -0
- package/dist/types/cli/commands/debug.d.ts +2 -0
- package/dist/types/cli/commands/debug.d.ts.map +1 -0
- package/dist/types/cli/commands/doctor.d.ts +5 -0
- package/dist/types/cli/commands/doctor.d.ts.map +1 -0
- package/dist/types/cli/commands/index.d.ts +10 -0
- package/dist/types/cli/commands/index.d.ts.map +1 -0
- package/dist/types/cli/commands/init.d.ts +2 -0
- package/dist/types/cli/commands/init.d.ts.map +1 -0
- package/dist/types/cli/commands/link.d.ts +5 -0
- package/dist/types/cli/commands/link.d.ts.map +1 -0
- package/dist/types/cli/commands/logs.d.ts +17 -0
- package/dist/types/cli/commands/logs.d.ts.map +1 -0
- package/dist/types/cli/commands/project-show.d.ts +2 -0
- package/dist/types/cli/commands/project-show.d.ts.map +1 -0
- package/dist/types/cli/commands/project.d.ts +3 -0
- package/dist/types/cli/commands/project.d.ts.map +1 -0
- package/dist/types/cli/commands/service.d.ts +123 -0
- package/dist/types/cli/commands/service.d.ts.map +1 -0
- package/dist/types/cli/commands/start.d.ts +6 -0
- package/dist/types/cli/commands/start.d.ts.map +1 -0
- package/dist/types/cli/commands/status.d.ts +2 -0
- package/dist/types/cli/commands/status.d.ts.map +1 -0
- package/dist/types/cli/commands/stop.d.ts +6 -0
- package/dist/types/cli/commands/stop.d.ts.map +1 -0
- package/dist/types/cli/daemon/error-tracker.d.ts +119 -0
- package/dist/types/cli/daemon/error-tracker.d.ts.map +1 -0
- package/dist/types/cli/daemon/fault-shutdown.d.ts +144 -0
- package/dist/types/cli/daemon/fault-shutdown.d.ts.map +1 -0
- package/dist/types/cli/daemon/index.d.ts +12 -0
- package/dist/types/cli/daemon/index.d.ts.map +1 -0
- package/dist/types/cli/daemon/pid-file.d.ts +13 -0
- package/dist/types/cli/daemon/pid-file.d.ts.map +1 -0
- package/dist/types/cli/daemon/readiness.d.ts +30 -0
- package/dist/types/cli/daemon/readiness.d.ts.map +1 -0
- package/dist/types/cli/daemon/runtime.d.ts +366 -0
- package/dist/types/cli/daemon/runtime.d.ts.map +1 -0
- package/dist/types/cli/daemon/shutdown.d.ts +7 -0
- package/dist/types/cli/daemon/shutdown.d.ts.map +1 -0
- package/dist/types/cli/daemon/signal-handlers.d.ts +3 -0
- package/dist/types/cli/daemon/signal-handlers.d.ts.map +1 -0
- package/dist/types/cli/daemon/state.d.ts +157 -0
- package/dist/types/cli/daemon/state.d.ts.map +1 -0
- package/dist/types/cli/daemon/status-file.d.ts +139 -0
- package/dist/types/cli/daemon/status-file.d.ts.map +1 -0
- package/dist/types/cli/doctor/checks.d.ts +133 -0
- package/dist/types/cli/doctor/checks.d.ts.map +1 -0
- package/dist/types/cli/doctor/fixes.d.ts +9 -0
- package/dist/types/cli/doctor/fixes.d.ts.map +1 -0
- package/dist/types/cli/doctor/index.d.ts +7 -0
- package/dist/types/cli/doctor/index.d.ts.map +1 -0
- package/dist/types/cli/index.d.ts +3 -0
- package/dist/types/cli/index.d.ts.map +1 -0
- package/dist/types/cli/interactive.d.ts +8 -0
- package/dist/types/cli/interactive.d.ts.map +1 -0
- package/dist/types/cli/logs/format.d.ts +13 -0
- package/dist/types/cli/logs/format.d.ts.map +1 -0
- package/dist/types/cli/logs/index.d.ts +3 -0
- package/dist/types/cli/logs/index.d.ts.map +1 -0
- package/dist/types/cli/logs/viewer.d.ts +41 -0
- package/dist/types/cli/logs/viewer.d.ts.map +1 -0
- package/dist/types/cli/ops/operation-logger.d.ts +63 -0
- package/dist/types/cli/ops/operation-logger.d.ts.map +1 -0
- package/dist/types/cli/palette.d.ts +11 -0
- package/dist/types/cli/palette.d.ts.map +1 -0
- package/dist/types/cli/prompt.d.ts +186 -0
- package/dist/types/cli/prompt.d.ts.map +1 -0
- package/dist/types/cli/ui/box.d.ts +21 -0
- package/dist/types/cli/ui/box.d.ts.map +1 -0
- package/dist/types/cli/ui/clipboard.d.ts +6 -0
- package/dist/types/cli/ui/clipboard.d.ts.map +1 -0
- package/dist/types/cli/ui/colors.d.ts +57 -0
- package/dist/types/cli/ui/colors.d.ts.map +1 -0
- package/dist/types/cli/ui/index.d.ts +9 -0
- package/dist/types/cli/ui/index.d.ts.map +1 -0
- package/dist/types/cli/ui/spinner.d.ts +12 -0
- package/dist/types/cli/ui/spinner.d.ts.map +1 -0
- package/dist/types/cli/ui/symbols.d.ts +47 -0
- package/dist/types/cli/ui/symbols.d.ts.map +1 -0
- package/dist/types/cli/ui/table.d.ts +23 -0
- package/dist/types/cli/ui/table.d.ts.map +1 -0
- package/dist/types/cli/ui/terminal.d.ts +7 -0
- package/dist/types/cli/ui/terminal.d.ts.map +1 -0
- package/dist/types/config/atomic-write.d.ts +69 -0
- package/dist/types/config/atomic-write.d.ts.map +1 -0
- package/dist/types/config/db-config.d.ts +134 -0
- package/dist/types/config/db-config.d.ts.map +1 -0
- package/dist/types/config/machine-config.d.ts +85 -0
- package/dist/types/config/machine-config.d.ts.map +1 -0
- package/dist/types/config/paths.d.ts +64 -0
- package/dist/types/config/paths.d.ts.map +1 -0
- package/dist/types/config/schema.d.ts +72 -0
- package/dist/types/config/schema.d.ts.map +1 -0
- package/dist/types/config/token.d.ts +63 -0
- package/dist/types/config/token.d.ts.map +1 -0
- package/dist/types/execution/canceller.d.ts +41 -0
- package/dist/types/execution/canceller.d.ts.map +1 -0
- package/dist/types/execution/database-lookup.d.ts +56 -0
- package/dist/types/execution/database-lookup.d.ts.map +1 -0
- package/dist/types/execution/dispatcher.d.ts +181 -0
- package/dist/types/execution/dispatcher.d.ts.map +1 -0
- package/dist/types/execution/function-effects.d.ts +209 -0
- package/dist/types/execution/function-effects.d.ts.map +1 -0
- package/dist/types/execution/introspection.d.ts +76 -0
- package/dist/types/execution/introspection.d.ts.map +1 -0
- package/dist/types/execution/migration-runner.d.ts +128 -0
- package/dist/types/execution/migration-runner.d.ts.map +1 -0
- package/dist/types/execution/non-tx-detector.d.ts +23 -0
- package/dist/types/execution/non-tx-detector.d.ts.map +1 -0
- package/dist/types/execution/pool.d.ts +229 -0
- package/dist/types/execution/pool.d.ts.map +1 -0
- package/dist/types/execution/query-runner.d.ts +88 -0
- package/dist/types/execution/query-runner.d.ts.map +1 -0
- package/dist/types/execution/rate-limiter.d.ts +120 -0
- package/dist/types/execution/rate-limiter.d.ts.map +1 -0
- package/dist/types/execution/search-path.d.ts +161 -0
- package/dist/types/execution/search-path.d.ts.map +1 -0
- package/dist/types/execution/sql-parser.d.ts +195 -0
- package/dist/types/execution/sql-parser.d.ts.map +1 -0
- package/dist/types/execution/statement-classifier.d.ts +103 -0
- package/dist/types/execution/statement-classifier.d.ts.map +1 -0
- package/dist/types/execution/types.d.ts +189 -0
- package/dist/types/execution/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +34 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/permissions/auto-upgrade.d.ts +40 -0
- package/dist/types/permissions/auto-upgrade.d.ts.map +1 -0
- package/dist/types/permissions/checker.d.ts +53 -0
- package/dist/types/permissions/checker.d.ts.map +1 -0
- package/dist/types/permissions/manual-approval.d.ts +213 -0
- package/dist/types/permissions/manual-approval.d.ts.map +1 -0
- package/dist/types/permissions/plan-registry.d.ts +274 -0
- package/dist/types/permissions/plan-registry.d.ts.map +1 -0
- package/dist/types/permissions/role-policy.d.ts +217 -0
- package/dist/types/permissions/role-policy.d.ts.map +1 -0
- package/dist/types/permissions/types.d.ts +126 -0
- package/dist/types/permissions/types.d.ts.map +1 -0
- package/dist/types/protocol/constants.d.ts +72 -0
- package/dist/types/protocol/constants.d.ts.map +1 -0
- package/dist/types/protocol/envelope.d.ts +165 -0
- package/dist/types/protocol/envelope.d.ts.map +1 -0
- package/dist/types/protocol/errors.d.ts +33 -0
- package/dist/types/protocol/errors.d.ts.map +1 -0
- package/dist/types/protocol/messages.d.ts +327 -0
- package/dist/types/protocol/messages.d.ts.map +1 -0
- package/dist/types/protocol/serialize.d.ts +26 -0
- package/dist/types/protocol/serialize.d.ts.map +1 -0
- package/dist/types/protocol/validate.d.ts +135 -0
- package/dist/types/protocol/validate.d.ts.map +1 -0
- package/package.json +116 -4
- package/scripts/generate-systemd-service.mjs +117 -0
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MigrationRunner = exports.MIGRATION_LOCK_TIMEOUT_MS = exports.MAX_MIGRATION_DEADLINE_MS = exports.MAX_MIGRATION_STATEMENT_TIMEOUT_MS = exports.MigrationTimeoutError = exports.MigrationPartiallyAppliedError = exports.MigrationPlanUnsafeError = exports.MigrationStrategyConflictError = exports.MigrationInProgressError = void 0;
|
|
37
|
+
exports.resolveMigrationBudget = resolveMigrationBudget;
|
|
38
|
+
exports.advisoryLockKey = advisoryLockKey;
|
|
39
|
+
const crypto = __importStar(require("crypto"));
|
|
40
|
+
const pool_1 = require("./pool");
|
|
41
|
+
const machine_config_1 = require("../config/machine-config");
|
|
42
|
+
const types_1 = require("./types");
|
|
43
|
+
const non_tx_detector_1 = require("./non-tx-detector");
|
|
44
|
+
const statement_classifier_1 = require("./statement-classifier");
|
|
45
|
+
const redact_1 = require("../audit/redact");
|
|
46
|
+
const sanitize_1 = require("../audit/sanitize");
|
|
47
|
+
const constants_1 = require("../protocol/constants");
|
|
48
|
+
class MigrationInProgressError extends Error {
|
|
49
|
+
/** Error catalog code. Not a SQLSTATE: `safePgCode` requires exactly 5. */
|
|
50
|
+
code = 'migration_in_progress';
|
|
51
|
+
constructor(message) {
|
|
52
|
+
super(message);
|
|
53
|
+
this.name = 'MigrationInProgressError';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.MigrationInProgressError = MigrationInProgressError;
|
|
57
|
+
class MigrationStrategyConflictError extends Error {
|
|
58
|
+
code = 'migration_strategy_conflict';
|
|
59
|
+
constructor(message) {
|
|
60
|
+
super(message);
|
|
61
|
+
this.name = 'MigrationStrategyConflictError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.MigrationStrategyConflictError = MigrationStrategyConflictError;
|
|
65
|
+
/**
|
|
66
|
+
* The plan could not be verified: something in it does not parse, contains
|
|
67
|
+
* more than one statement, or is a statement form the agent cannot prove runs
|
|
68
|
+
* inside a transaction block. The run is refused rather than guessed at.
|
|
69
|
+
*/
|
|
70
|
+
class MigrationPlanUnsafeError extends Error {
|
|
71
|
+
code = 'migration_plan_unsafe';
|
|
72
|
+
constructor(message) {
|
|
73
|
+
super(message);
|
|
74
|
+
this.name = 'MigrationPlanUnsafeError';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.MigrationPlanUnsafeError = MigrationPlanUnsafeError;
|
|
78
|
+
/**
|
|
79
|
+
* The migration stopped partway with statements already committed.
|
|
80
|
+
*
|
|
81
|
+
* `MigrationRunner.run` never *resolves* with `status: 'partial'`: a caller
|
|
82
|
+
* that only inspects a returned value can therefore never mistake a
|
|
83
|
+
* half-applied schema for a success. The per-statement detail is on
|
|
84
|
+
* {@link MigrationPartiallyAppliedError.result} for a caller that wants to
|
|
85
|
+
* report it.
|
|
86
|
+
*/
|
|
87
|
+
class MigrationPartiallyAppliedError extends Error {
|
|
88
|
+
code = 'migration_partial';
|
|
89
|
+
result;
|
|
90
|
+
pg_error_code;
|
|
91
|
+
constructor(message, result) {
|
|
92
|
+
super(message);
|
|
93
|
+
this.name = 'MigrationPartiallyAppliedError';
|
|
94
|
+
this.result = result;
|
|
95
|
+
const failed = result.statements.find((s) => s.status === 'failed');
|
|
96
|
+
this.pg_error_code = failed?.pg_error_code;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.MigrationPartiallyAppliedError = MigrationPartiallyAppliedError;
|
|
100
|
+
/** The run exceeded its overall deadline and was abandoned. */
|
|
101
|
+
class MigrationTimeoutError extends Error {
|
|
102
|
+
code = 'migration_timeout';
|
|
103
|
+
constructor(message) {
|
|
104
|
+
super(message);
|
|
105
|
+
this.name = 'MigrationTimeoutError';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.MigrationTimeoutError = MigrationTimeoutError;
|
|
109
|
+
/**
|
|
110
|
+
* Absolute ceiling on one migration statement, in milliseconds. A caller
|
|
111
|
+
* cannot raise it, and it can never exceed the agent-wide statement ceiling in
|
|
112
|
+
* `pool.ts` — nothing is allowed to turn `statement_timeout` off.
|
|
113
|
+
*/
|
|
114
|
+
exports.MAX_MIGRATION_STATEMENT_TIMEOUT_MS = Math.min(constants_1.DEFAULTS.MIGRATION_TIMEOUT_MS, pool_1.MAX_STATEMENT_TIMEOUT_MS);
|
|
115
|
+
/** Absolute ceiling on the whole migration run, in milliseconds. */
|
|
116
|
+
exports.MAX_MIGRATION_DEADLINE_MS = constants_1.DEFAULTS.MIGRATION_TIMEOUT_MS;
|
|
117
|
+
/** How long a migration statement may wait for a lock before it is cancelled. */
|
|
118
|
+
exports.MIGRATION_LOCK_TIMEOUT_MS = pool_1.LOCK_TIMEOUT_MS;
|
|
119
|
+
/** PostgreSQL's SQLSTATE for a statement cancelled by a timeout or a cancel request. */
|
|
120
|
+
const PG_QUERY_CANCELED = '57014';
|
|
121
|
+
/**
|
|
122
|
+
* Internal marker: the run was torn down by a cancellation or by the overall
|
|
123
|
+
* deadline. It never leaves this module — callers see {@link
|
|
124
|
+
* MigrationTimeoutError} or {@link MigrationPartiallyAppliedError}.
|
|
125
|
+
*/
|
|
126
|
+
class RunInterrupted extends Error {
|
|
127
|
+
/** Which edge tore the run down. */
|
|
128
|
+
reason;
|
|
129
|
+
constructor(reason) {
|
|
130
|
+
super(`migration run interrupted: ${reason}`);
|
|
131
|
+
this.name = 'RunInterrupted';
|
|
132
|
+
this.reason = reason;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The exact integer that reaches `SET statement_timeout = …`.
|
|
137
|
+
*
|
|
138
|
+
* The value is interpolated into SQL, so it is re-validated where it is used
|
|
139
|
+
* instead of trusted from the caller: only a finite, positive, safe integer
|
|
140
|
+
* survives, and anything else becomes the server-owned ceiling. Nothing a remote
|
|
141
|
+
* caller can put in `timeout_ms` reaches the statement text verbatim, and a
|
|
142
|
+
* clamped value can never be `0` — which PostgreSQL reads as "no timeout".
|
|
143
|
+
*/
|
|
144
|
+
function safeTimeoutMs(value, ceilingMs) {
|
|
145
|
+
if (!Number.isFinite(value) || !Number.isSafeInteger(value) || value <= 0) {
|
|
146
|
+
return ceilingMs;
|
|
147
|
+
}
|
|
148
|
+
return Math.min(value, ceilingMs);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Turn a caller-supplied `timeout_ms` into the three server-side budgets.
|
|
152
|
+
*
|
|
153
|
+
* The number is never trusted: it is floored to an integer, and clamped to
|
|
154
|
+
* {@link MAX_MIGRATION_STATEMENT_TIMEOUT_MS} / {@link MAX_MIGRATION_DEADLINE_MS}.
|
|
155
|
+
* `0`, a negative number, `NaN` and `Infinity` all mean "use the server
|
|
156
|
+
* default" — never "no timeout", which is how a remote caller would otherwise
|
|
157
|
+
* be able to remove the ceiling by asking for zero.
|
|
158
|
+
*/
|
|
159
|
+
function resolveMigrationBudget(requestedTimeoutMs) {
|
|
160
|
+
const requested = typeof requestedTimeoutMs === 'number' &&
|
|
161
|
+
Number.isFinite(requestedTimeoutMs) &&
|
|
162
|
+
requestedTimeoutMs > 0
|
|
163
|
+
? Math.floor(requestedTimeoutMs)
|
|
164
|
+
: undefined;
|
|
165
|
+
const statementTimeoutMs = requested === undefined
|
|
166
|
+
? exports.MAX_MIGRATION_STATEMENT_TIMEOUT_MS
|
|
167
|
+
: Math.min(requested, exports.MAX_MIGRATION_STATEMENT_TIMEOUT_MS);
|
|
168
|
+
const deadlineMs = requested === undefined
|
|
169
|
+
? exports.MAX_MIGRATION_DEADLINE_MS
|
|
170
|
+
: Math.min(requested, exports.MAX_MIGRATION_DEADLINE_MS);
|
|
171
|
+
return {
|
|
172
|
+
statementTimeoutMs,
|
|
173
|
+
deadlineMs,
|
|
174
|
+
lockTimeoutMs: Math.min(exports.MIGRATION_LOCK_TIMEOUT_MS, statementTimeoutMs),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Refuse a plan whose entries are not exactly one statement each.
|
|
179
|
+
*
|
|
180
|
+
* node-postgres takes the simple query protocol whenever `values` is falsy, and
|
|
181
|
+
* that protocol executes *every* semicolon-separated statement in one round
|
|
182
|
+
* trip. `SELECT 1; DROP TABLE users` is therefore two commands to PostgreSQL and
|
|
183
|
+
* one string to everything above it — the C-01 mechanism, reachable through the
|
|
184
|
+
* migration path.
|
|
185
|
+
*
|
|
186
|
+
* The verdict comes from the PostgreSQL parse tree, so a `;` inside a string
|
|
187
|
+
* literal, a dollar-quoted body, a quoted identifier or a comment cannot trip
|
|
188
|
+
* it, a single trailing terminator is not a second statement, and a real second
|
|
189
|
+
* statement always is. Anything that does not parse exactly once is refused,
|
|
190
|
+
* which also covers a plan written for a PostgreSQL version this agent cannot
|
|
191
|
+
* parse: an unverifiable entry is never executed.
|
|
192
|
+
*/
|
|
193
|
+
async function assertOneStatementPerEntry(statements) {
|
|
194
|
+
const offenders = [];
|
|
195
|
+
for (let i = 0; i < statements.length; i++) {
|
|
196
|
+
try {
|
|
197
|
+
await (0, statement_classifier_1.assertSingleReadStatement)(statements[i]);
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
offenders.push(i);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (offenders.length === 0)
|
|
204
|
+
return;
|
|
205
|
+
throw new MigrationPlanUnsafeError(`Migration plan contains entries that are not exactly one statement ` +
|
|
206
|
+
`(index ${offenders.map((i) => i + 1).join(', ')}). Refusing the plan: an entry that ` +
|
|
207
|
+
'hides a second command behind a semicolon would be executed as two commands, and ' +
|
|
208
|
+
'one the agent could not parse cannot be verified.');
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Read the `locked` column of a `pg_try_advisory_*_lock` result.
|
|
212
|
+
*
|
|
213
|
+
* Only an explicit `true` counts as taken: a missing or non-boolean answer fails
|
|
214
|
+
* closed, because a run that proceeded while believing it held the lock would
|
|
215
|
+
* have no mutual exclusion at all.
|
|
216
|
+
*/
|
|
217
|
+
function lockTaken(res) {
|
|
218
|
+
return res.rows[0]?.locked === true;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Advisory lock key for SW migrations.
|
|
222
|
+
*
|
|
223
|
+
* Keyed with HMAC-SHA256 over a per-installation secret. The previous version
|
|
224
|
+
* hashed the project name with a bare MD5, so anybody who could guess (or was
|
|
225
|
+
* told) a project name could compute the lock key, take the lock from another
|
|
226
|
+
* session, and deny migrations for that project indefinitely. A keyed MAC is
|
|
227
|
+
* not derivable by a third party with database access, because the secret never
|
|
228
|
+
* reaches the database.
|
|
229
|
+
*/
|
|
230
|
+
function advisoryLockKey(projectName, secret) {
|
|
231
|
+
const mac = crypto
|
|
232
|
+
.createHmac('sha256', secret)
|
|
233
|
+
.update(`schema-weaver:migration-lock:v1:${projectName}`)
|
|
234
|
+
.digest();
|
|
235
|
+
const key1 = mac.readInt32BE(0);
|
|
236
|
+
let key2 = mac.readInt32BE(4);
|
|
237
|
+
if (key1 === key2) {
|
|
238
|
+
key2 = key1 === 0x7fffffff ? key1 - 1 : key1 + 1;
|
|
239
|
+
}
|
|
240
|
+
return { key1, key2 };
|
|
241
|
+
}
|
|
242
|
+
class MigrationRunner {
|
|
243
|
+
poolManager;
|
|
244
|
+
injectedLockSecret;
|
|
245
|
+
resolvedLockSecret = null;
|
|
246
|
+
constructor(opts) {
|
|
247
|
+
this.poolManager = opts.poolManager;
|
|
248
|
+
this.injectedLockSecret = opts.lockSecret;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The installation secret the lock key is keyed with.
|
|
252
|
+
*
|
|
253
|
+
* An explicit option wins (tests, embedders). Otherwise the agent token from
|
|
254
|
+
* the machine config is used: it is per-installation, secret, and stable
|
|
255
|
+
* across processes, which is exactly what mutual exclusion between two agents
|
|
256
|
+
* needs. If the machine config cannot be read the fallback is a random
|
|
257
|
+
* per-process secret — still unguessable from outside, so the lock key cannot
|
|
258
|
+
* be pre-taken by anyone with database access.
|
|
259
|
+
*/
|
|
260
|
+
lockSecret() {
|
|
261
|
+
if (this.injectedLockSecret && this.injectedLockSecret.length > 0) {
|
|
262
|
+
return this.injectedLockSecret;
|
|
263
|
+
}
|
|
264
|
+
if (this.resolvedLockSecret !== null)
|
|
265
|
+
return this.resolvedLockSecret;
|
|
266
|
+
try {
|
|
267
|
+
this.resolvedLockSecret = (0, machine_config_1.loadMachineConfig)().agent_token;
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
this.resolvedLockSecret = crypto.randomBytes(32).toString('hex');
|
|
271
|
+
}
|
|
272
|
+
return this.resolvedLockSecret;
|
|
273
|
+
}
|
|
274
|
+
async run(payload, ctx) {
|
|
275
|
+
const startTime = Date.now();
|
|
276
|
+
// Step 1: Validate
|
|
277
|
+
if (payload.statements.length === 0) {
|
|
278
|
+
if (payload.dry_run) {
|
|
279
|
+
return {
|
|
280
|
+
plan_id: payload.plan_id,
|
|
281
|
+
status: 'dry_run_ok',
|
|
282
|
+
statements: [],
|
|
283
|
+
total_ms: Date.now() - startTime,
|
|
284
|
+
rolled_back_indices: [],
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
throw new Error('Migration run payload contains no statements');
|
|
288
|
+
}
|
|
289
|
+
if (payload.statements.length > constants_1.LIMITS.MAX_STATEMENT_COUNT_PER_MIGRATION) {
|
|
290
|
+
throw new Error(`Migration statement count exceeds maximum limit (${constants_1.LIMITS.MAX_STATEMENT_COUNT_PER_MIGRATION})`);
|
|
291
|
+
}
|
|
292
|
+
for (const stmt of payload.statements) {
|
|
293
|
+
if (!stmt.trim()) {
|
|
294
|
+
throw new Error('Migration payload contains an empty statement');
|
|
295
|
+
}
|
|
296
|
+
if (Buffer.byteLength(stmt, 'utf8') > constants_1.LIMITS.MAX_STATEMENT_LENGTH) {
|
|
297
|
+
throw new Error(`Statement length exceeds maximum allowed limit (${constants_1.LIMITS.MAX_STATEMENT_LENGTH})`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// Step 2: Verify the plan before a connection or a lock is taken. Two
|
|
301
|
+
// independent checks, both driven by the PostgreSQL parse tree and both
|
|
302
|
+
// failing closed: every entry must be EXACTLY ONE statement, and every
|
|
303
|
+
// entry must be one whose transactionality the agent can prove.
|
|
304
|
+
await assertOneStatementPerEntry(payload.statements);
|
|
305
|
+
const nonTxCheck = await (0, non_tx_detector_1.detectNonTransactional)(payload.statements);
|
|
306
|
+
if (nonTxCheck.unparseable_indices.length > 0) {
|
|
307
|
+
throw new MigrationPlanUnsafeError(`Migration plan contains statements that PostgreSQL cannot parse ` +
|
|
308
|
+
`(index ${nonTxCheck.unparseable_indices.map((i) => i + 1).join(', ')}). ` +
|
|
309
|
+
'Refusing to run an unverified plan.');
|
|
310
|
+
}
|
|
311
|
+
if (nonTxCheck.ambiguous_indices.length > 0) {
|
|
312
|
+
throw new MigrationPlanUnsafeError(`Migration plan contains statements that cannot be verified as transactional ` +
|
|
313
|
+
`(index ${nonTxCheck.ambiguous_indices.map((i) => i + 1).join(', ')}): ` +
|
|
314
|
+
`${nonTxCheck.summary}. Refusing to run an unverified plan.`);
|
|
315
|
+
}
|
|
316
|
+
const strategy = payload.strategy;
|
|
317
|
+
// Step 3: Dry run (parse only, no execution, no connection)
|
|
318
|
+
if (payload.dry_run) {
|
|
319
|
+
const statementResults = [];
|
|
320
|
+
const conflictIndices = new Set(strategy === 'single_tx' ? nonTxCheck.non_tx_indices : []);
|
|
321
|
+
let allPassed = true;
|
|
322
|
+
for (let i = 0; i < payload.statements.length; i++) {
|
|
323
|
+
const stmt = payload.statements[i];
|
|
324
|
+
const stmtStart = Date.now();
|
|
325
|
+
if (conflictIndices.has(i)) {
|
|
326
|
+
allPassed = false;
|
|
327
|
+
statementResults.push({
|
|
328
|
+
index: i,
|
|
329
|
+
status: 'failed',
|
|
330
|
+
ms: Date.now() - stmtStart,
|
|
331
|
+
rows_affected: 0,
|
|
332
|
+
error: `${nonTxCheck.summary} — strategy='single_tx' cannot run this plan`,
|
|
333
|
+
});
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
try {
|
|
337
|
+
// Parse-only validation. The previous implementation executed
|
|
338
|
+
// transactional DDL inside BEGIN/ROLLBACK against the production
|
|
339
|
+
// database during a "dry run"; anything the classifier wrongly
|
|
340
|
+
// called transactional really ran.
|
|
341
|
+
await (0, statement_classifier_1.assertSingleReadStatement)(stmt);
|
|
342
|
+
statementResults.push({
|
|
343
|
+
index: i,
|
|
344
|
+
status: 'success',
|
|
345
|
+
ms: Date.now() - stmtStart,
|
|
346
|
+
rows_affected: 0,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
catch (err) {
|
|
350
|
+
allPassed = false;
|
|
351
|
+
statementResults.push({
|
|
352
|
+
index: i,
|
|
353
|
+
status: 'failed',
|
|
354
|
+
ms: Date.now() - stmtStart,
|
|
355
|
+
rows_affected: 0,
|
|
356
|
+
error: err instanceof Error ? err.message : String(err),
|
|
357
|
+
pg_error_code: err && typeof err === 'object' && 'code' in err
|
|
358
|
+
? String(err.code)
|
|
359
|
+
: undefined,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return {
|
|
364
|
+
plan_id: payload.plan_id,
|
|
365
|
+
status: allPassed ? 'dry_run_ok' : 'dry_run_failed',
|
|
366
|
+
statements: statementResults,
|
|
367
|
+
total_ms: Date.now() - startTime,
|
|
368
|
+
rolled_back_indices: [],
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
// Previously the runner silently rewrote a caller-requested single_tx
|
|
372
|
+
// migration into per_statement, which turns an all-or-nothing migration
|
|
373
|
+
// into a sequence of individually-committed statements. A partial
|
|
374
|
+
// migration leaves the schema half-applied and was reported as a success.
|
|
375
|
+
// Now the conflict is an explicit error the caller must resolve. A dry run
|
|
376
|
+
// reports it in the result instead of throwing, because that is what the
|
|
377
|
+
// caller asked dry runs for.
|
|
378
|
+
if (nonTxCheck.has_non_transactional && strategy === 'single_tx') {
|
|
379
|
+
throw new MigrationStrategyConflictError(`Migration requested single_tx but contains statements that cannot run inside a ` +
|
|
380
|
+
`transaction (${nonTxCheck.summary}). Re-submit with strategy='per_statement' ` +
|
|
381
|
+
'if partial application is acceptable.');
|
|
382
|
+
}
|
|
383
|
+
// Step 4: Budgets. Every statement runs under a server-controlled
|
|
384
|
+
// statement_timeout and lock_timeout, and the run's own wall-clock deadline
|
|
385
|
+
// is raced against each in-flight statement below, so the run cannot outlive
|
|
386
|
+
// its deadline even if a single statement is slow. `timeout_ms` from the
|
|
387
|
+
// caller is honoured but never trusted: `resolveMigrationBudget` clamps it.
|
|
388
|
+
const budget = resolveMigrationBudget(payload.timeout_ms);
|
|
389
|
+
// Step 5: Acquire a connection and take the advisory lock
|
|
390
|
+
const { client, release, pid } = await this.poolManager.acquire(ctx.dbEntry);
|
|
391
|
+
// A migration always leaves state that `release()` cannot undo: an open
|
|
392
|
+
// transaction, session-level GUCs, a session-scoped advisory lock. Declaring
|
|
393
|
+
// the session dirty HERE, before the first statement that can change it,
|
|
394
|
+
// means the pool destroys the connection on every exit path — including an
|
|
395
|
+
// exception thrown between BEGIN and the `finally` below — instead of
|
|
396
|
+
// handing a half-used session to the next request. The cost is one
|
|
397
|
+
// reconnect per migration.
|
|
398
|
+
(0, pool_1.markSessionDirty)(client);
|
|
399
|
+
// The overall deadline starts once the backend is in hand: connection
|
|
400
|
+
// setup is already bounded by the pool's connectionTimeoutMillis, and the
|
|
401
|
+
// lock is taken with pg_try_advisory_* so it never blocks either.
|
|
402
|
+
const deadlineAt = Date.now() + budget.deadlineMs;
|
|
403
|
+
/**
|
|
404
|
+
* Why the run was torn down early, if it was. `null` while it is healthy.
|
|
405
|
+
* First cause wins: a deadline that expires while a cancellation is already
|
|
406
|
+
* unwinding the run must not overwrite the reason its caller is waiting on.
|
|
407
|
+
*/
|
|
408
|
+
let interruption = null;
|
|
409
|
+
let rejectInterrupt = () => undefined;
|
|
410
|
+
/**
|
|
411
|
+
* Rejects the instant the run is torn down. Every in-flight statement is
|
|
412
|
+
* raced against it, which is what makes the deadline a bound on the run's
|
|
413
|
+
* wall clock and not merely a check between statements: without the race a
|
|
414
|
+
* single statement that outlives the budget is still waited out in full,
|
|
415
|
+
* holding the advisory lock the whole time.
|
|
416
|
+
*/
|
|
417
|
+
const interrupted = new Promise((_resolve, reject) => {
|
|
418
|
+
rejectInterrupt = reject;
|
|
419
|
+
});
|
|
420
|
+
// A run is usually torn down between statements, when nothing is racing
|
|
421
|
+
// this promise, and a rejection nobody awaits is an unhandled rejection at
|
|
422
|
+
// process level. Marking it handled here does not stop `Promise.race` from
|
|
423
|
+
// seeing it later.
|
|
424
|
+
void interrupted.catch(() => undefined);
|
|
425
|
+
const interrupt = (cause) => {
|
|
426
|
+
if (interruption !== null)
|
|
427
|
+
return;
|
|
428
|
+
interruption = cause;
|
|
429
|
+
rejectInterrupt(new RunInterrupted(cause));
|
|
430
|
+
};
|
|
431
|
+
const deadlineTimer = setTimeout(() => {
|
|
432
|
+
interrupt('deadline');
|
|
433
|
+
}, budget.deadlineMs);
|
|
434
|
+
const abortController = new AbortController();
|
|
435
|
+
const inFlightReq = {
|
|
436
|
+
request_id: ctx.request_id,
|
|
437
|
+
db_alias: ctx.dbEntry.db_alias,
|
|
438
|
+
pid,
|
|
439
|
+
started_at: Date.now(),
|
|
440
|
+
abort: abortController,
|
|
441
|
+
is_streaming: false,
|
|
442
|
+
};
|
|
443
|
+
// The listener is attached BEFORE the request is registered, and a signal
|
|
444
|
+
// that is already aborted is honoured immediately. An `abort` event that
|
|
445
|
+
// fired before `addEventListener` never fires again, so a canceller that
|
|
446
|
+
// aborts during registration (or a caller that hands in an aborted signal)
|
|
447
|
+
// would otherwise be ignored and the run would execute in full and take the
|
|
448
|
+
// advisory lock for a request nobody is waiting for.
|
|
449
|
+
const onAbort = () => {
|
|
450
|
+
// Abort whichever controller the canceller can reach: `registerInFlight`
|
|
451
|
+
// hands it `inFlightRequest.abort`, and the dispatcher substitutes its own
|
|
452
|
+
// controller there. Leaving that one unaborted would report
|
|
453
|
+
// `local_abort: false` for a cancellation the runner did act on.
|
|
454
|
+
if (!abortController.signal.aborted)
|
|
455
|
+
abortController.abort();
|
|
456
|
+
if (!inFlightReq.abort.signal.aborted)
|
|
457
|
+
inFlightReq.abort.abort();
|
|
458
|
+
interrupt('aborted');
|
|
459
|
+
};
|
|
460
|
+
if (ctx.abortSignal) {
|
|
461
|
+
ctx.abortSignal.addEventListener('abort', onAbort);
|
|
462
|
+
}
|
|
463
|
+
if (ctx.abortSignal?.aborted) {
|
|
464
|
+
onAbort();
|
|
465
|
+
}
|
|
466
|
+
// The canceller can only ever fire `InFlightRequest.abort`. It is observed
|
|
467
|
+
// here as well, so a caller that keeps this runner's own controller instead
|
|
468
|
+
// of substituting its own still stops the run instead of letting a
|
|
469
|
+
// cancelled migration carry on to its commit.
|
|
470
|
+
abortController.signal.addEventListener('abort', onAbort);
|
|
471
|
+
if (ctx.registerInFlight) {
|
|
472
|
+
ctx.registerInFlight(inFlightReq);
|
|
473
|
+
}
|
|
474
|
+
// `registerInFlight` can abort synchronously — the canceller, or a harness
|
|
475
|
+
// standing in for it — and `signal.aborted` is the only trace that leaves,
|
|
476
|
+
// so the state of both controllers is re-read after registration rather than
|
|
477
|
+
// trusted to have produced an event.
|
|
478
|
+
if (inFlightReq.abort.signal.aborted || ctx.abortSignal?.aborted === true) {
|
|
479
|
+
interrupt('aborted');
|
|
480
|
+
}
|
|
481
|
+
const { key1, key2 } = advisoryLockKey(ctx.project, this.lockSecret());
|
|
482
|
+
const statementResults = [];
|
|
483
|
+
const rolledBackIndices = [];
|
|
484
|
+
let migrationStatus = 'committed';
|
|
485
|
+
const outcome = () => migrationStatus;
|
|
486
|
+
let transactionOpen = false;
|
|
487
|
+
let sessionLockHeld = false;
|
|
488
|
+
let abandonedForDeadline = false;
|
|
489
|
+
/**
|
|
490
|
+
* A statement was still running on the backend when the run was torn down,
|
|
491
|
+
* so the session may have state nobody can see. It is destroyed rather than
|
|
492
|
+
* recycled, and the explicit unlock is skipped because it would be queued
|
|
493
|
+
* behind the very statement that overran.
|
|
494
|
+
*/
|
|
495
|
+
let statementAbandonedInFlight = false;
|
|
496
|
+
let appliedStatementTimeout = null;
|
|
497
|
+
/**
|
|
498
|
+
* Topology that must not appear in anything this run puts on the wire.
|
|
499
|
+
* Every error PostgreSQL raises quotes the row, the literal or the value it
|
|
500
|
+
* choked on (`invalid input syntax for type integer: "alice@corp.com"`), and
|
|
501
|
+
* a connection failure names the host, port, user and database.
|
|
502
|
+
*/
|
|
503
|
+
const topology = {
|
|
504
|
+
host: ctx.dbEntry.host,
|
|
505
|
+
port: ctx.dbEntry.port,
|
|
506
|
+
user: ctx.dbEntry.user,
|
|
507
|
+
database: ctx.dbEntry.database,
|
|
508
|
+
project: ctx.project,
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Progress event for one statement.
|
|
512
|
+
*
|
|
513
|
+
* The preview is redacted and the error text is scrubbed, because both leave
|
|
514
|
+
* the process: a `migration_progress` event is a WebSocket frame bound for the
|
|
515
|
+
* cloud and the browser. The verbatim message is still recorded on
|
|
516
|
+
* {@link StatementResult.error} for the local audit log.
|
|
517
|
+
*/
|
|
518
|
+
const emitProgress = (index, stmt, status, extra) => {
|
|
519
|
+
if (!ctx.onProgress)
|
|
520
|
+
return;
|
|
521
|
+
void ctx.onProgress({
|
|
522
|
+
v: 1,
|
|
523
|
+
id: crypto.randomUUID(),
|
|
524
|
+
type: 'event',
|
|
525
|
+
project: ctx.project,
|
|
526
|
+
user: ctx.user,
|
|
527
|
+
db_alias: ctx.db_alias,
|
|
528
|
+
ts: Date.now(),
|
|
529
|
+
payload: {
|
|
530
|
+
kind: 'migration_progress',
|
|
531
|
+
data: {
|
|
532
|
+
plan_id: payload.plan_id,
|
|
533
|
+
statement_index: index,
|
|
534
|
+
statement_sql_preview: (0, redact_1.previewStatement)(stmt),
|
|
535
|
+
status,
|
|
536
|
+
...(extra?.ms !== undefined ? { ms: extra.ms } : {}),
|
|
537
|
+
...(extra?.error !== undefined
|
|
538
|
+
? { error: (0, sanitize_1.sanitizeErrorText)(extra.error, { topology }) }
|
|
539
|
+
: {}),
|
|
540
|
+
},
|
|
541
|
+
},
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Apply the timeouts for the next statement. Inside `single_tx` this is
|
|
546
|
+
* `SET LOCAL`, which PostgreSQL reverts at COMMIT/ROLLBACK; in
|
|
547
|
+
* `per_statement` each statement is its own implicit transaction, so the
|
|
548
|
+
* session form is the only one that takes effect — `SET LOCAL` outside a
|
|
549
|
+
* transaction block is a silent no-op (H-07), which is how migrations used
|
|
550
|
+
* to run with no timeout at all.
|
|
551
|
+
*
|
|
552
|
+
* The value is exactly the clamped budget, NOT the wall clock still left in
|
|
553
|
+
* the run. Capping it by the remaining budget made the number PostgreSQL was
|
|
554
|
+
* asked to enforce drift down by however long the run had already spent
|
|
555
|
+
* taking its lock, so a caller that asked for 60000 got 59999 and every
|
|
556
|
+
* statement of a long run got a different timeout than the one that was
|
|
557
|
+
* requested and audited. The overall deadline is enforced by the runner
|
|
558
|
+
* itself (`interrupted` above), which is what bounds the run — not by
|
|
559
|
+
* shaving the server-side timeout.
|
|
560
|
+
*
|
|
561
|
+
* Both values are re-validated by {@link safeTimeoutMs} and the `LOCAL`
|
|
562
|
+
* prefix is one of two literals, so this text cannot carry SQL. It still
|
|
563
|
+
* goes over the extended protocol like every other statement, so no code
|
|
564
|
+
* path in this file can silently acquire the simple protocol.
|
|
565
|
+
*/
|
|
566
|
+
const applyBudget = async () => {
|
|
567
|
+
const statementTimeoutMs = safeTimeoutMs(budget.statementTimeoutMs, exports.MAX_MIGRATION_STATEMENT_TIMEOUT_MS);
|
|
568
|
+
const lockTimeoutMs = safeTimeoutMs(budget.lockTimeoutMs, exports.MIGRATION_LOCK_TIMEOUT_MS);
|
|
569
|
+
const local = transactionOpen ? 'LOCAL ' : '';
|
|
570
|
+
if (appliedStatementTimeout !== statementTimeoutMs) {
|
|
571
|
+
await (0, types_1.runExtended)(client, `SET ${local}statement_timeout = ${statementTimeoutMs}`);
|
|
572
|
+
await (0, types_1.runExtended)(client, `SET ${local}lock_timeout = ${lockTimeoutMs}`);
|
|
573
|
+
appliedStatementTimeout = statementTimeoutMs;
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
const markRolledBack = (upToIndex) => {
|
|
577
|
+
for (let j = 0; j < upToIndex; j++) {
|
|
578
|
+
rolledBackIndices.push(j);
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
const endTransaction = async () => {
|
|
582
|
+
if (!transactionOpen)
|
|
583
|
+
return;
|
|
584
|
+
try {
|
|
585
|
+
await (0, types_1.runExtended)(client, 'ROLLBACK');
|
|
586
|
+
}
|
|
587
|
+
catch {
|
|
588
|
+
// The transaction state is unknown. `markSessionDirty` above means this
|
|
589
|
+
// connection is destroyed rather than recycled, which is the only way
|
|
590
|
+
// the next request is guaranteed not to inherit it.
|
|
591
|
+
}
|
|
592
|
+
transactionOpen = false;
|
|
593
|
+
};
|
|
594
|
+
const abandonRun = async (index, timedOut) => {
|
|
595
|
+
if (timedOut)
|
|
596
|
+
abandonedForDeadline = true;
|
|
597
|
+
if (strategy === 'single_tx') {
|
|
598
|
+
migrationStatus = 'rolled_back';
|
|
599
|
+
await endTransaction();
|
|
600
|
+
markRolledBack(index);
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
migrationStatus = 'partial';
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
try {
|
|
607
|
+
if (strategy === 'single_tx') {
|
|
608
|
+
await (0, types_1.runExtended)(client, 'BEGIN');
|
|
609
|
+
transactionOpen = true;
|
|
610
|
+
// Transaction-scoped lock: PostgreSQL releases it at COMMIT/ROLLBACK,
|
|
611
|
+
// including when the connection dies mid-migration, so it cannot leak
|
|
612
|
+
// onto a pooled session.
|
|
613
|
+
const lockRes = await (0, types_1.runExtended)(client, 'SELECT pg_try_advisory_xact_lock($1, $2) AS locked', [key1, key2]);
|
|
614
|
+
if (!lockTaken(lockRes)) {
|
|
615
|
+
await endTransaction();
|
|
616
|
+
throw new MigrationInProgressError('Database migration is currently in progress for this project.');
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
// No wrapping transaction in per_statement mode, so the lock is
|
|
621
|
+
// session-scoped and the `finally` below is the only thing that
|
|
622
|
+
// releases it. That is why the client is destroyed, never recycled.
|
|
623
|
+
const lockRes = await (0, types_1.runExtended)(client, 'SELECT pg_try_advisory_lock($1, $2) AS locked', [
|
|
624
|
+
key1,
|
|
625
|
+
key2,
|
|
626
|
+
]);
|
|
627
|
+
if (!lockTaken(lockRes)) {
|
|
628
|
+
throw new MigrationInProgressError('Database migration is currently in progress for this project.');
|
|
629
|
+
}
|
|
630
|
+
sessionLockHeld = true;
|
|
631
|
+
}
|
|
632
|
+
// Step 6: Execute loop
|
|
633
|
+
for (let i = 0; i < payload.statements.length; i++) {
|
|
634
|
+
const stmt = payload.statements[i];
|
|
635
|
+
// Cooperative checkpoint. A cancellation or an expired deadline stops the
|
|
636
|
+
// run here, before the next statement is ever sent.
|
|
637
|
+
if (interruption !== null) {
|
|
638
|
+
await abandonRun(i, interruption === 'deadline');
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
if (deadlineAt - Date.now() <= 0) {
|
|
642
|
+
interrupt('deadline');
|
|
643
|
+
await abandonRun(i, true);
|
|
644
|
+
break;
|
|
645
|
+
}
|
|
646
|
+
await applyBudget();
|
|
647
|
+
const stmtStart = Date.now();
|
|
648
|
+
emitProgress(i, stmt, 'running');
|
|
649
|
+
try {
|
|
650
|
+
// Extended query protocol: node-postgres only takes the simple
|
|
651
|
+
// protocol (which executes every semicolon-separated command in one
|
|
652
|
+
// round trip) when `values` is falsy, so this pins the statement
|
|
653
|
+
// count to the one the plan declared. PostgreSQL answers a second
|
|
654
|
+
// command in the same Parse with `42601`.
|
|
655
|
+
//
|
|
656
|
+
// Raced against `interrupted`, so a run that is cancelled or runs out
|
|
657
|
+
// of deadline stops waiting on a statement the backend may still be
|
|
658
|
+
// executing. The abandoned query is left to the server-side
|
|
659
|
+
// `statement_timeout` above and to the cancellation the canceller
|
|
660
|
+
// issues with `pg_cancel_backend`, both of which surface as `57014`.
|
|
661
|
+
const runRes = await Promise.race([(0, types_1.runExtended)(client, stmt), interrupted]);
|
|
662
|
+
const duration = Date.now() - stmtStart;
|
|
663
|
+
statementResults.push({
|
|
664
|
+
index: i,
|
|
665
|
+
status: 'success',
|
|
666
|
+
ms: duration,
|
|
667
|
+
rows_affected: runRes.rowCount || 0,
|
|
668
|
+
});
|
|
669
|
+
emitProgress(i, stmt, 'success', { ms: duration });
|
|
670
|
+
}
|
|
671
|
+
catch (err) {
|
|
672
|
+
const duration = Date.now() - stmtStart;
|
|
673
|
+
const wasInterrupted = err instanceof RunInterrupted;
|
|
674
|
+
const message = wasInterrupted
|
|
675
|
+
? err.reason === 'deadline'
|
|
676
|
+
? `Migration exceeded its overall deadline of ${budget.deadlineMs}ms ` +
|
|
677
|
+
`while statement ${i + 1} was still running; the run was abandoned.`
|
|
678
|
+
: `Migration was cancelled by the caller while statement ${i + 1} was still running.`
|
|
679
|
+
: err instanceof Error
|
|
680
|
+
? err.message
|
|
681
|
+
: String(err);
|
|
682
|
+
statementResults.push({
|
|
683
|
+
index: i,
|
|
684
|
+
status: 'failed',
|
|
685
|
+
ms: duration,
|
|
686
|
+
rows_affected: 0,
|
|
687
|
+
error: message,
|
|
688
|
+
// A statement torn down locally has the same SQLSTATE PostgreSQL
|
|
689
|
+
// would have produced: `57014`, query_canceled.
|
|
690
|
+
pg_error_code: wasInterrupted
|
|
691
|
+
? PG_QUERY_CANCELED
|
|
692
|
+
: err && typeof err === 'object' && 'code' in err
|
|
693
|
+
? String(err.code)
|
|
694
|
+
: undefined,
|
|
695
|
+
});
|
|
696
|
+
emitProgress(i, stmt, 'failed', { ms: duration, error: message });
|
|
697
|
+
if (wasInterrupted) {
|
|
698
|
+
// The backend may still be running that statement, so nothing about
|
|
699
|
+
// this session can be proven: the next request must not inherit it.
|
|
700
|
+
// `markSessionDirty` destroys the connection, and terminating the
|
|
701
|
+
// backend is what actually stops the statement and releases the
|
|
702
|
+
// advisory lock.
|
|
703
|
+
statementAbandonedInFlight = true;
|
|
704
|
+
}
|
|
705
|
+
await abandonRun(i, wasInterrupted && err.reason === 'deadline');
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
if (transactionOpen) {
|
|
710
|
+
// An interrupted run is never committed. In `single_tx` that is the whole
|
|
711
|
+
// difference between a migration that applied and one that did not, so
|
|
712
|
+
// the COMMIT is gated on the run still being healthy — not only on the
|
|
713
|
+
// statements having all succeeded.
|
|
714
|
+
if (interruption === null && outcome() === 'committed') {
|
|
715
|
+
await (0, types_1.runExtended)(client, 'COMMIT');
|
|
716
|
+
transactionOpen = false;
|
|
717
|
+
}
|
|
718
|
+
else {
|
|
719
|
+
if (interruption !== null && strategy === 'single_tx') {
|
|
720
|
+
// The deadline or a cancellation landed after the last statement
|
|
721
|
+
// succeeded. Rolling back is the only outcome that matches what the
|
|
722
|
+
// database did, so the status must not stay `committed`.
|
|
723
|
+
migrationStatus = 'rolled_back';
|
|
724
|
+
}
|
|
725
|
+
await endTransaction();
|
|
726
|
+
markRolledBack(payload.statements.length);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
const result = {
|
|
730
|
+
plan_id: payload.plan_id,
|
|
731
|
+
status: outcome(),
|
|
732
|
+
statements: statementResults,
|
|
733
|
+
total_ms: Date.now() - startTime,
|
|
734
|
+
rolled_back_indices: rolledBackIndices,
|
|
735
|
+
};
|
|
736
|
+
if (outcome() === 'partial') {
|
|
737
|
+
// Name the cause, because "partial" alone does not tell a caller whether
|
|
738
|
+
// it should retry the plan or ask for a bigger budget — and do not claim
|
|
739
|
+
// work is committed when the run was abandoned before any of it landed.
|
|
740
|
+
const appliedCount = result.statements.filter((s) => s.status === 'success').length;
|
|
741
|
+
const cause = interruption === 'deadline'
|
|
742
|
+
? `Migration exceeded its overall deadline of ${budget.deadlineMs}ms and was abandoned`
|
|
743
|
+
: interruption === 'aborted'
|
|
744
|
+
? 'Migration was cancelled by the caller and was abandoned'
|
|
745
|
+
: 'Migration stopped partway';
|
|
746
|
+
const consequence = appliedCount === 0
|
|
747
|
+
? 'Nothing was committed, but the run did not complete.'
|
|
748
|
+
: `${appliedCount} earlier statement(s) are already committed and were not rolled ` +
|
|
749
|
+
'back. Verify the applied schema before retrying.';
|
|
750
|
+
throw new MigrationPartiallyAppliedError(`${cause}: ${consequence}`, result);
|
|
751
|
+
}
|
|
752
|
+
if (abandonedForDeadline) {
|
|
753
|
+
throw new MigrationTimeoutError(`Migration exceeded its overall deadline of ${budget.deadlineMs}ms and was abandoned. ` +
|
|
754
|
+
'Every statement was rolled back.');
|
|
755
|
+
}
|
|
756
|
+
return result;
|
|
757
|
+
}
|
|
758
|
+
catch (err) {
|
|
759
|
+
await endTransaction();
|
|
760
|
+
throw err;
|
|
761
|
+
}
|
|
762
|
+
finally {
|
|
763
|
+
clearTimeout(deadlineTimer);
|
|
764
|
+
// Release the advisory lock on every exit path. Without this a single
|
|
765
|
+
// failed migration left the lock held on a pooled connection, blocking
|
|
766
|
+
// every later migration for this project until the pool recycled it.
|
|
767
|
+
// `markSessionDirty` above already guarantees the connection is destroyed
|
|
768
|
+
// either way, so a failed unlock needs no separate handling here.
|
|
769
|
+
if (sessionLockHeld) {
|
|
770
|
+
// A statement abandoned in flight may still be executing on the backend,
|
|
771
|
+
// and node-postgres queues everything behind an in-flight query — this
|
|
772
|
+
// unlock included — so sending it would wait out the statement the
|
|
773
|
+
// deadline just gave up on. It is not needed either way: PostgreSQL
|
|
774
|
+
// releases a session-scoped advisory lock when the backend goes away,
|
|
775
|
+
// and the connection is destroyed on this path.
|
|
776
|
+
if (!statementAbandonedInFlight) {
|
|
777
|
+
try {
|
|
778
|
+
await (0, types_1.runExtended)(client, 'SELECT pg_advisory_unlock($1, $2)', [key1, key2]);
|
|
779
|
+
}
|
|
780
|
+
catch {
|
|
781
|
+
// The lock may survive on a backend that is about to be destroyed.
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
sessionLockHeld = false;
|
|
785
|
+
}
|
|
786
|
+
if (ctx.abortSignal) {
|
|
787
|
+
ctx.abortSignal.removeEventListener('abort', onAbort);
|
|
788
|
+
}
|
|
789
|
+
abortController.signal.removeEventListener('abort', onAbort);
|
|
790
|
+
if (ctx.unregisterInFlight) {
|
|
791
|
+
ctx.unregisterInFlight(ctx.request_id);
|
|
792
|
+
}
|
|
793
|
+
release();
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
exports.MigrationRunner = MigrationRunner;
|
|
798
|
+
//# sourceMappingURL=migration-runner.js.map
|