@runa-ai/runa-cli 0.5.71 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-BXUJKYHC.js +1730 -0
- package/dist/cache-H63JKFYH.js +112 -0
- package/dist/check-6AB5NGWK.js +207 -0
- package/dist/chunk-22CS6EMA.js +31 -0
- package/dist/chunk-3FDQW524.js +544 -0
- package/dist/chunk-5NKWR4FF.js +254 -0
- package/dist/chunk-6AALH2ED.js +121 -0
- package/dist/chunk-6Y3LAUGL.js +35 -0
- package/dist/chunk-7QV7U6NI.js +62 -0
- package/dist/chunk-AAIE4F2U.js +140 -0
- package/dist/chunk-CCKG5R4Y.js +59 -0
- package/dist/chunk-CE3DEYFT.js +480 -0
- package/dist/chunk-DRSUEMAK.js +123 -0
- package/dist/chunk-GOGRLQNP.js +12 -0
- package/dist/chunk-HD74F6W2.js +460 -0
- package/dist/chunk-HKUWEGUX.js +36 -0
- package/dist/chunk-HPYJPB5Y.js +408 -0
- package/dist/chunk-IBVVGH6X.js +33 -0
- package/dist/chunk-II7VYQEM.js +179 -0
- package/dist/chunk-JMJP4A47.js +204 -0
- package/dist/chunk-JQXOVCOP.js +574 -0
- package/dist/chunk-JT5SUTWE.js +9 -0
- package/dist/chunk-KWX3JHCY.js +85 -0
- package/dist/chunk-M47WJJVS.js +71 -0
- package/dist/chunk-MNPMZERI.js +194 -0
- package/dist/chunk-MXRWBNIY.js +74 -0
- package/dist/chunk-NPSRD26F.js +149 -0
- package/dist/chunk-P7U52PBY.js +1149 -0
- package/dist/chunk-QDF7QXBL.js +67 -0
- package/dist/chunk-RRGQCUKT.js +48 -0
- package/dist/chunk-RZLYEO4U.js +219 -0
- package/dist/chunk-TYIAD6SB.js +74 -0
- package/dist/chunk-UU55OH7P.js +42 -0
- package/dist/chunk-UWWSAPDR.js +31 -0
- package/dist/chunk-VM3IWOT5.js +458 -0
- package/dist/chunk-VRXHCR5K.js +42 -0
- package/dist/chunk-XJBQINSA.js +351 -0
- package/dist/chunk-ZZOXM6Q4.js +8 -0
- package/dist/ci-V3PIG2GI.js +8322 -0
- package/dist/cli/index.d.ts +7 -1
- package/dist/cli/requested-command.d.ts +8 -0
- package/dist/cli-GFRZCJQR.js +661 -0
- package/dist/commands/build/actors/db-sync.d.ts +2 -0
- package/dist/commands/build/actors/static-checks.d.ts +7 -6
- package/dist/commands/build/contract.d.ts +30 -30
- package/dist/commands/build/machine-dry-run.d.ts +3 -0
- package/dist/commands/build/machine-e2e-meta.d.ts +120 -0
- package/dist/commands/build/machine.d.ts +22 -22
- package/dist/commands/build/types.d.ts +2 -4
- package/dist/commands/ci/machine/contract.d.ts +26 -26
- package/dist/commands/ci/machine/formatters/sections/final-comment.d.ts +1 -5
- package/dist/commands/ci/machine/formatters/sections/format-helpers.d.ts +5 -0
- package/dist/commands/ci/machine/formatters/sections/index.d.ts +2 -2
- package/dist/commands/ci/machine/machine-execution-helpers.d.ts +40 -0
- package/dist/commands/ci/machine/machine-state-helpers.d.ts +14 -0
- package/dist/commands/ci/machine/machine.d.ts +12 -12
- package/dist/commands/ci/machine/types.d.ts +0 -5
- package/dist/commands/ci/utils/ci-summary.d.ts +15 -15
- package/dist/commands/ci/utils/execa-helpers.d.ts +1 -0
- package/dist/commands/db/apply/actors/idempotent-actors.d.ts +34 -0
- package/dist/commands/db/apply/actors/lock-actors.d.ts +16 -0
- package/dist/commands/db/apply/actors/pg-schema-diff-actors.d.ts +31 -0
- package/dist/commands/db/apply/actors/seed-actors.d.ts +11 -0
- package/dist/commands/db/apply/actors/shared.d.ts +9 -0
- package/dist/commands/db/apply/actors.d.ts +16 -65
- package/dist/commands/db/apply/contract.d.ts +8 -1
- package/dist/commands/db/apply/helpers/data-compatibility-checker.d.ts +3 -4
- package/dist/commands/db/apply/helpers/data-integrity-verifier.d.ts +37 -0
- package/dist/commands/db/apply/helpers/fresh-db-handler.d.ts +34 -0
- package/dist/commands/db/apply/helpers/hazard-handler.d.ts +60 -0
- package/dist/commands/db/apply/helpers/idempotent-object-registry.d.ts +96 -0
- package/dist/commands/db/apply/helpers/idempotent-transaction.d.ts +20 -0
- package/dist/commands/db/apply/helpers/index.d.ts +7 -1
- package/dist/commands/db/apply/helpers/partition-validator.d.ts +2 -15
- package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts +18 -162
- package/dist/commands/db/apply/helpers/pg-schema-diff-patterns.d.ts +55 -0
- package/dist/commands/db/apply/helpers/pg-schema-diff-version.d.ts +50 -0
- package/dist/commands/db/apply/helpers/plan-validator.d.ts +30 -10
- package/dist/commands/db/apply/helpers/rbac-password-manager.d.ts +34 -0
- package/dist/commands/db/apply/helpers/retry-logic.d.ts +16 -2
- package/dist/commands/db/apply/helpers/shadow-db-manager.d.ts +1 -1
- package/dist/commands/db/apply/helpers/sql-utils.d.ts +26 -0
- package/dist/commands/db/apply/machine.d.ts +52 -1
- package/dist/commands/db/commands/db-apply.d.ts +18 -0
- package/dist/commands/db/commands/db-sync/boundary-classifier.d.ts +21 -0
- package/dist/commands/db/commands/db-sync/plan-hazard-analyzer.d.ts +13 -0
- package/dist/commands/db/commands/db-sync/risk-reporter.d.ts +19 -0
- package/dist/commands/db/commands/db-sync/sql-parser.d.ts +25 -0
- package/dist/commands/db/commands/db-sync/types.d.ts +47 -0
- package/dist/commands/db/commands/db-sync.d.ts +14 -0
- package/dist/commands/db/sync/contract.d.ts +6 -2
- package/dist/commands/db/sync/machine.d.ts +2 -1
- package/dist/commands/db/types.d.ts +2 -0
- package/dist/commands/db/utils/boundary-policy/rule-compiler.d.ts +11 -0
- package/dist/commands/db/utils/boundary-policy/types.d.ts +105 -0
- package/dist/commands/db/utils/boundary-policy/validation.d.ts +20 -0
- package/dist/commands/db/utils/boundary-policy-runtime.d.ts +28 -0
- package/dist/commands/db/utils/boundary-policy.d.ts +5 -0
- package/dist/commands/db/utils/idempotent-risk-context.d.ts +29 -0
- package/dist/commands/db/utils/preflight-check.d.ts +14 -0
- package/dist/commands/db/utils/preflight-checks/domain-naming-checks.d.ts +106 -0
- package/dist/commands/db/utils/preflight-checks/orphan-checks.d.ts +36 -0
- package/dist/commands/db/utils/preflight-checks/schema-risk-checks.d.ts +22 -0
- package/dist/commands/db/utils/preflight-checks/supabase-checks.d.ts +55 -0
- package/dist/commands/db/utils/risk-detector-loader.d.ts +8 -0
- package/dist/commands/db/utils/schema-precheck-budget.d.ts +17 -0
- package/dist/commands/db/utils/sql-boundary-parser.d.ts +12 -0
- package/dist/commands/db/utils/sql-file-collector.d.ts +8 -0
- package/dist/commands/db/utils/sql-filename-parser.d.ts +20 -0
- package/dist/commands/db/utils/sql-table-extractor-ast.d.ts +19 -0
- package/dist/commands/db/utils/sql-table-extractor-regex.d.ts +50 -0
- package/dist/commands/db/utils/sql-table-extractor-rls.d.ts +13 -0
- package/dist/commands/db/utils/sql-table-extractor.d.ts +79 -1
- package/dist/commands/db/utils/table-registry-introspection.d.ts +68 -0
- package/dist/commands/db/utils/table-registry.d.ts +3 -38
- package/dist/commands/dev/actors/app-lifecycle.d.ts +18 -0
- package/dist/commands/dev/actors/index.d.ts +7 -2
- package/dist/commands/dev/actors/process-check.d.ts +12 -0
- package/dist/commands/dev/actors/shared.d.ts +15 -0
- package/dist/commands/dev/contract.d.ts +2 -2
- package/dist/commands/dev/machine.d.ts +7 -31
- package/dist/commands/env/commands/env-pull/auth.d.ts +13 -0
- package/dist/commands/env/commands/env-pull/dotenv-files.d.ts +14 -0
- package/dist/commands/env/commands/env-pull/security.d.ts +12 -0
- package/dist/commands/env/commands/env-pull/service.d.ts +8 -0
- package/dist/commands/env/commands/env-pull/shared.d.ts +79 -0
- package/dist/commands/env/commands/setup/types.d.ts +1 -1
- package/dist/commands/env/constants/local-supabase.d.ts +2 -0
- package/dist/commands/template-check/contract.d.ts +6 -6
- package/dist/commands/template-check/machine.d.ts +2 -2
- package/dist/commands/template-check/types.d.ts +0 -4
- package/dist/commands/template-check/utils/diff-analyzer.d.ts +0 -4
- package/dist/config/env.d.ts +4 -4
- package/dist/config-loader-GT3HAQ7U.js +7 -0
- package/dist/db-HR7CREX2.js +15913 -0
- package/dist/dev-A7RW6XQV.js +873 -0
- package/dist/env-B47Z4747.js +2624 -0
- package/dist/env-HMMRSYCI.js +7 -0
- package/dist/env-files-K2C7O7L5.js +8 -0
- package/dist/error-handler-4EYSDOSE.js +460 -0
- package/dist/hotfix-CULKKMGS.js +1477 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +48 -42912
- package/dist/init-ELK5QCWR.js +632 -0
- package/dist/inject-test-attrs-Y5UD5P7Q.js +36 -0
- package/dist/internal/machines/snapshot-helpers.d.ts +6 -0
- package/dist/lib/sql-comment-utils.d.ts +25 -0
- package/dist/license-OB7GVJQ2.js +468 -0
- package/dist/link-C43JRZWY.js +60 -0
- package/dist/manifest-2NOQ2IMK.js +32 -0
- package/dist/prepare-32DOVHTE.js +250 -0
- package/dist/risk-detector-BXUY2WKS.js +6 -0
- package/dist/risk-detector-core-O7I7SPR7.js +166 -0
- package/dist/risk-detector-plpgsql-SGMVKYJP.js +1856 -0
- package/dist/sdk-XK6HQU7S.js +348 -0
- package/dist/services-7VK5KZTO.js +177 -0
- package/dist/session-SFW5QSXZ.js +142 -0
- package/dist/signal-handler-DO3OANW5.js +6 -0
- package/dist/status-IJ4ZWHMX.js +95 -0
- package/dist/telemetry-FN7V727Y.js +94 -0
- package/dist/template-check-PNG5NQ5H.js +1933 -0
- package/dist/test-QYXE5UVW.js +626 -0
- package/dist/test-gen-QPWOIEHU.js +89 -0
- package/dist/ui-RJAMCWUI.js +331 -0
- package/dist/upgrade-3SLWVNAC.js +625 -0
- package/dist/utils/config-loader.d.ts +0 -3
- package/dist/validate-SM4PXPS7.js +55 -0
- package/dist/validators/risk-detector-content-risks.d.ts +13 -0
- package/dist/validators/risk-detector-core.d.ts +25 -0
- package/dist/validators/risk-detector-patterns.d.ts +15 -0
- package/dist/validators/risk-detector-plpgsql-expression-resolver.d.ts +22 -0
- package/dist/validators/risk-detector-plpgsql-parser.d.ts +5 -0
- package/dist/validators/risk-detector-plpgsql-tokenizer.d.ts +18 -0
- package/dist/validators/risk-detector-plpgsql.d.ts +9 -0
- package/dist/validators/risk-detector-text-utils.d.ts +6 -0
- package/dist/validators/risk-detector-types.d.ts +16 -0
- package/dist/validators/risk-detector.d.ts +7 -26
- package/dist/vuln-check-TYQNEFS7.js +122 -0
- package/dist/vuln-checker-2QXGN5YT.js +2950 -0
- package/dist/watch-UCDVOQAH.js +911 -0
- package/dist/workflow-ZB5Q2PFY.js +898 -0
- package/package.json +4 -1
- package/dist/cli/contract-mode.d.ts.map +0 -1
- package/dist/cli/contract-output.d.ts.map +0 -1
- package/dist/cli/early-flags.d.ts.map +0 -1
- package/dist/cli/error-handler.d.ts.map +0 -1
- package/dist/cli/exec.d.ts.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/json-output.d.ts.map +0 -1
- package/dist/cli/non-interactive.d.ts.map +0 -1
- package/dist/cli/output-format.d.ts.map +0 -1
- package/dist/cli/signal-handler.d.ts.map +0 -1
- package/dist/commands/build/actors/build.d.ts.map +0 -1
- package/dist/commands/build/actors/clean.d.ts.map +0 -1
- package/dist/commands/build/actors/db-sync.d.ts.map +0 -1
- package/dist/commands/build/actors/index.d.ts.map +0 -1
- package/dist/commands/build/actors/manifest.d.ts.map +0 -1
- package/dist/commands/build/actors/setup.d.ts.map +0 -1
- package/dist/commands/build/actors/static-checks.d.ts.map +0 -1
- package/dist/commands/build/actors/validate.d.ts.map +0 -1
- package/dist/commands/build/commands/build.d.ts.map +0 -1
- package/dist/commands/build/contract.d.ts.map +0 -1
- package/dist/commands/build/guards.d.ts.map +0 -1
- package/dist/commands/build/index.d.ts.map +0 -1
- package/dist/commands/build/machine.d.ts.map +0 -1
- package/dist/commands/build/types.d.ts.map +0 -1
- package/dist/commands/cache.d.ts.map +0 -1
- package/dist/commands/check/commands/check.d.ts.map +0 -1
- package/dist/commands/check/index.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-checks.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-layer-content.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-pr-capabilities.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-apply.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-db-operations.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-github.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-types.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-utils.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-workflow.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-resolvers.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-static.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-supabase-local.d.ts.map +0 -1
- package/dist/commands/ci/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/app-build.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/app-start.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/build-and-playwright.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/playwright-install.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/static-checks.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/apply-seeds.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/pgtap-install.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/production-preview.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/pull-production.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/reset.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/schema-stats.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/setup-roles.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/sync-schema.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/finalize/github.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/finalize/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/finalize/summary.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/setup/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/setup/local.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/setup/pr-common.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/setup/pr-local.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/test/capabilities.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/test/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/test/run-layers.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/ci-local.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/ci-pr.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/machine-runner.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/runtime-env.d.ts.map +0 -1
- package/dist/commands/ci/machine/contract.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/github-comment-types.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/github-comment.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/final-comment.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/format-helpers.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/progress-comment.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/summary.d.ts.map +0 -1
- package/dist/commands/ci/machine/guards.d.ts.map +0 -1
- package/dist/commands/ci/machine/helpers.d.ts.map +0 -1
- package/dist/commands/ci/machine/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/machine.d.ts.map +0 -1
- package/dist/commands/ci/machine/types.d.ts.map +0 -1
- package/dist/commands/ci/utils/ai-report.d.ts.map +0 -1
- package/dist/commands/ci/utils/app-process.d.ts.map +0 -1
- package/dist/commands/ci/utils/app-runtime.d.ts.map +0 -1
- package/dist/commands/ci/utils/ci-config.d.ts.map +0 -1
- package/dist/commands/ci/utils/ci-env-schema.d.ts.map +0 -1
- package/dist/commands/ci/utils/ci-logging.d.ts.map +0 -1
- package/dist/commands/ci/utils/ci-summary.d.ts.map +0 -1
- package/dist/commands/ci/utils/config-readers.d.ts.map +0 -1
- package/dist/commands/ci/utils/db-url-utils.d.ts.map +0 -1
- package/dist/commands/ci/utils/e2e-auth-setup.d.ts.map +0 -1
- package/dist/commands/ci/utils/env-security.d.ts.map +0 -1
- package/dist/commands/ci/utils/execa-helpers.d.ts.map +0 -1
- package/dist/commands/ci/utils/exit-code-computation.d.ts.map +0 -1
- package/dist/commands/ci/utils/github-api.d.ts.map +0 -1
- package/dist/commands/ci/utils/github.d.ts.map +0 -1
- package/dist/commands/ci/utils/index.d.ts.map +0 -1
- package/dist/commands/ci/utils/pgtap-installer.d.ts.map +0 -1
- package/dist/commands/ci/utils/rls-verification.d.ts.map +0 -1
- package/dist/commands/ci/utils/schema-operations.d.ts.map +0 -1
- package/dist/commands/ci/utils/seed-operations.d.ts.map +0 -1
- package/dist/commands/ci/utils/test-parallel.d.ts.map +0 -1
- package/dist/commands/ci/utils/timestamp-invariants.d.ts.map +0 -1
- package/dist/commands/ci/utils/workflow-idempotency.d.ts.map +0 -1
- package/dist/commands/db/apply/actors.d.ts.map +0 -1
- package/dist/commands/db/apply/contract.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/advisory-lock.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/data-compatibility-checker.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/index.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/partition-acl-cleaner.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/partition-prefilter.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/partition-validator.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/plan-validator.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/retry-logic.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/shadow-db-manager.d.ts.map +0 -1
- package/dist/commands/db/apply/index.d.ts.map +0 -1
- package/dist/commands/db/apply/machine.d.ts.map +0 -1
- package/dist/commands/db/commands/db-apply.d.ts.map +0 -1
- package/dist/commands/db/commands/db-audit.d.ts.map +0 -1
- package/dist/commands/db/commands/db-backup.d.ts.map +0 -1
- package/dist/commands/db/commands/db-cleanup.d.ts.map +0 -1
- package/dist/commands/db/commands/db-derive-role-passwords.d.ts.map +0 -1
- package/dist/commands/db/commands/db-derive-urls.d.ts.map +0 -1
- package/dist/commands/db/commands/db-diagram.d.ts.map +0 -1
- package/dist/commands/db/commands/db-drizzle.d.ts.map +0 -1
- package/dist/commands/db/commands/db-extension.d.ts.map +0 -1
- package/dist/commands/db/commands/db-generate-password.d.ts.map +0 -1
- package/dist/commands/db/commands/db-lifecycle.d.ts.map +0 -1
- package/dist/commands/db/commands/db-rollback.d.ts.map +0 -1
- package/dist/commands/db/commands/db-schema.d.ts.map +0 -1
- package/dist/commands/db/commands/db-seed-metadata.d.ts.map +0 -1
- package/dist/commands/db/commands/db-seed-verify.d.ts.map +0 -1
- package/dist/commands/db/commands/db-seed.d.ts.map +0 -1
- package/dist/commands/db/commands/db-snapshot.d.ts.map +0 -1
- package/dist/commands/db/commands/db-stack.d.ts.map +0 -1
- package/dist/commands/db/commands/db-stats.d.ts.map +0 -1
- package/dist/commands/db/commands/db-sync.d.ts.map +0 -1
- package/dist/commands/db/commands/db-test.d.ts.map +0 -1
- package/dist/commands/db/constants.d.ts.map +0 -1
- package/dist/commands/db/extension-registry.d.ts.map +0 -1
- package/dist/commands/db/index.d.ts.map +0 -1
- package/dist/commands/db/preflight/actors.d.ts.map +0 -1
- package/dist/commands/db/preflight/contract.d.ts.map +0 -1
- package/dist/commands/db/preflight/index.d.ts.map +0 -1
- package/dist/commands/db/sync/actors.d.ts.map +0 -1
- package/dist/commands/db/sync/contract.d.ts.map +0 -1
- package/dist/commands/db/sync/index.d.ts.map +0 -1
- package/dist/commands/db/sync/machine.d.ts.map +0 -1
- package/dist/commands/db/types.d.ts.map +0 -1
- package/dist/commands/db/utils/db-target.d.ts.map +0 -1
- package/dist/commands/db/utils/db-url-builder.d.ts.map +0 -1
- package/dist/commands/db/utils/error-handlers.d.ts.map +0 -1
- package/dist/commands/db/utils/import-impact-analyzer.d.ts.map +0 -1
- package/dist/commands/db/utils/preflight-check.d.ts.map +0 -1
- package/dist/commands/db/utils/psql.d.ts.map +0 -1
- package/dist/commands/db/utils/schema-detector.d.ts.map +0 -1
- package/dist/commands/db/utils/schema-sync.d.ts.map +0 -1
- package/dist/commands/db/utils/script-runner.d.ts.map +0 -1
- package/dist/commands/db/utils/seed-manager.d.ts.map +0 -1
- package/dist/commands/db/utils/semantic-mapper.d.ts.map +0 -1
- package/dist/commands/db/utils/sql-table-extractor.d.ts.map +0 -1
- package/dist/commands/db/utils/stack-detector.d.ts.map +0 -1
- package/dist/commands/db/utils/table-registry.d.ts.map +0 -1
- package/dist/commands/db/utils/table-source-classifier.d.ts.map +0 -1
- package/dist/commands/dev/actors/index.d.ts.map +0 -1
- package/dist/commands/dev/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev/contract.d.ts.map +0 -1
- package/dist/commands/dev/guards.d.ts.map +0 -1
- package/dist/commands/dev/helpers/stale-process-detector.d.ts.map +0 -1
- package/dist/commands/dev/machine.d.ts.map +0 -1
- package/dist/commands/dev/types.d.ts.map +0 -1
- package/dist/commands/env/commands/env-check.d.ts.map +0 -1
- package/dist/commands/env/commands/env-encrypt.d.ts.map +0 -1
- package/dist/commands/env/commands/env-pull.d.ts.map +0 -1
- package/dist/commands/env/commands/env-setup.d.ts.map +0 -1
- package/dist/commands/env/commands/env-sync.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/action.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/auth.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/file-export.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/github-api.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/helpers.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/index.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/parsers.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/prompts.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/supabase-api.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/types.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/vercel-api.d.ts.map +0 -1
- package/dist/commands/env/constants/local-supabase.d.ts.map +0 -1
- package/dist/commands/env/index.d.ts.map +0 -1
- package/dist/commands/hotfix/actors.d.ts.map +0 -1
- package/dist/commands/hotfix/commands/hotfix-complete.d.ts.map +0 -1
- package/dist/commands/hotfix/commands/hotfix-create.d.ts.map +0 -1
- package/dist/commands/hotfix/commands/hotfix-deploy.d.ts.map +0 -1
- package/dist/commands/hotfix/commands/hotfix-status.d.ts.map +0 -1
- package/dist/commands/hotfix/contract.d.ts.map +0 -1
- package/dist/commands/hotfix/index.d.ts.map +0 -1
- package/dist/commands/hotfix/machine.d.ts.map +0 -1
- package/dist/commands/hotfix/metadata.d.ts.map +0 -1
- package/dist/commands/hotfix/utils/hotfix-machine-helper.d.ts.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/action.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/commands/inject-test-attrs.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/contract.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/detection-diagnostics.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/formatter.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/index.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/manifest-generator.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/processor-utils.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/processor.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/types.d.ts.map +0 -1
- package/dist/commands/link.d.ts.map +0 -1
- package/dist/commands/manifest/index.d.ts.map +0 -1
- package/dist/commands/prepare/commands/prepare.d.ts.map +0 -1
- package/dist/commands/prepare/index.d.ts.map +0 -1
- package/dist/commands/sdk/commands/publish.d.ts.map +0 -1
- package/dist/commands/sdk/index.d.ts.map +0 -1
- package/dist/commands/services/index.d.ts.map +0 -1
- package/dist/commands/session/index.d.ts.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/telemetry.d.ts.map +0 -1
- package/dist/commands/template-check/actors/compare.d.ts.map +0 -1
- package/dist/commands/template-check/actors/discover.d.ts.map +0 -1
- package/dist/commands/template-check/actors/index.d.ts.map +0 -1
- package/dist/commands/template-check/actors/report.d.ts.map +0 -1
- package/dist/commands/template-check/commands/template-check.d.ts.map +0 -1
- package/dist/commands/template-check/config.d.ts.map +0 -1
- package/dist/commands/template-check/contract.d.ts.map +0 -1
- package/dist/commands/template-check/index.d.ts.map +0 -1
- package/dist/commands/template-check/machine.d.ts.map +0 -1
- package/dist/commands/template-check/types.d.ts.map +0 -1
- package/dist/commands/template-check/utils/diff-analyzer.d.ts.map +0 -1
- package/dist/commands/template-check/utils/normalizer.d.ts.map +0 -1
- package/dist/commands/template-check/utils/path-mapping.d.ts.map +0 -1
- package/dist/commands/test/commands/test-db.d.ts.map +0 -1
- package/dist/commands/test/commands/test-e2e.d.ts.map +0 -1
- package/dist/commands/test/commands/test-fast.d.ts.map +0 -1
- package/dist/commands/test/commands/test-integration.d.ts.map +0 -1
- package/dist/commands/test/commands/test-layer.d.ts.map +0 -1
- package/dist/commands/test/commands/test-owasp-generate.d.ts.map +0 -1
- package/dist/commands/test/commands/test-service.d.ts.map +0 -1
- package/dist/commands/test/commands/test-static.d.ts.map +0 -1
- package/dist/commands/test/commands/test.d.ts.map +0 -1
- package/dist/commands/test/index.d.ts.map +0 -1
- package/dist/commands/test-gen.d.ts.map +0 -1
- package/dist/commands/ui.d.ts.map +0 -1
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/vuln-check.d.ts.map +0 -1
- package/dist/commands/watch.d.ts.map +0 -1
- package/dist/commands/workflow/commands/deploy-production.d.ts.map +0 -1
- package/dist/commands/workflow/commands/final-status.d.ts.map +0 -1
- package/dist/commands/workflow/commands/log.d.ts.map +0 -1
- package/dist/commands/workflow/commands/notify.d.ts.map +0 -1
- package/dist/commands/workflow/commands/paths.d.ts.map +0 -1
- package/dist/commands/workflow/commands/sync.d.ts.map +0 -1
- package/dist/commands/workflow/commands/validate.d.ts.map +0 -1
- package/dist/commands/workflow/commands/verify-credentials.d.ts.map +0 -1
- package/dist/commands/workflow/index.d.ts.map +0 -1
- package/dist/commands/workflow/types.d.ts.map +0 -1
- package/dist/config/env-files.d.ts.map +0 -1
- package/dist/config/env.d.ts.map +0 -1
- package/dist/constants/versions.d.ts.map +0 -1
- package/dist/contracts/envelope.d.ts.map +0 -1
- package/dist/errors/catalog.d.ts.map +0 -1
- package/dist/errors/exit-codes.d.ts.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/incremental/affected-tests.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/internal/machines/index.d.ts.map +0 -1
- package/dist/internal/machines/machine-runner.d.ts.map +0 -1
- package/dist/internal/machines/snapshot-helpers.d.ts.map +0 -1
- package/dist/internal/machines/types.d.ts.map +0 -1
- package/dist/internal/vuln-checker/analyzers/dependency-analyzer.d.ts.map +0 -1
- package/dist/internal/vuln-checker/analyzers/rls-analyzer.d.ts.map +0 -1
- package/dist/internal/vuln-checker/analyzers/secret-analyzer.d.ts.map +0 -1
- package/dist/internal/vuln-checker/analyzers/typescript-analyzer.d.ts.map +0 -1
- package/dist/internal/vuln-checker/config/loader.d.ts.map +0 -1
- package/dist/internal/vuln-checker/constants.d.ts.map +0 -1
- package/dist/internal/vuln-checker/ignore/matcher.d.ts.map +0 -1
- package/dist/internal/vuln-checker/index.d.ts.map +0 -1
- package/dist/internal/vuln-checker/reporters/console-reporter.d.ts.map +0 -1
- package/dist/internal/vuln-checker/reporters/json-reporter.d.ts.map +0 -1
- package/dist/internal/vuln-checker/reporters/markdown-reporter.d.ts.map +0 -1
- package/dist/internal/vuln-checker/reporters/sarif-reporter.d.ts.map +0 -1
- package/dist/internal/vuln-checker/security/path-validation.d.ts.map +0 -1
- package/dist/internal/vuln-checker/types.d.ts.map +0 -1
- package/dist/notifiers/desktop-notifier.d.ts.map +0 -1
- package/dist/ui/components/db-panel.d.ts.map +0 -1
- package/dist/ui/components/status-bar.d.ts.map +0 -1
- package/dist/ui/components/test-panel.d.ts.map +0 -1
- package/dist/ui/dashboard.d.ts.map +0 -1
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/utils/config-loader.d.ts.map +0 -1
- package/dist/utils/config-updater.d.ts.map +0 -1
- package/dist/utils/diagnostics.d.ts.map +0 -1
- package/dist/utils/dotenvx.d.ts.map +0 -1
- package/dist/utils/env-local-bridge.d.ts.map +0 -1
- package/dist/utils/execution-plan.d.ts.map +0 -1
- package/dist/utils/github-output-security.d.ts.map +0 -1
- package/dist/utils/help-system.d.ts.map +0 -1
- package/dist/utils/license/admin-auth.d.ts.map +0 -1
- package/dist/utils/license/allowlist-checker.d.ts.map +0 -1
- package/dist/utils/license/ci-detector.d.ts.map +0 -1
- package/dist/utils/license/index.d.ts.map +0 -1
- package/dist/utils/license/owner-resolver.d.ts.map +0 -1
- package/dist/utils/license/types.d.ts.map +0 -1
- package/dist/utils/license/validate-owner.d.ts.map +0 -1
- package/dist/utils/path-security.d.ts.map +0 -1
- package/dist/utils/port-allocator.d.ts.map +0 -1
- package/dist/utils/secure-exec.d.ts.map +0 -1
- package/dist/utils/template-fetcher.d.ts.map +0 -1
- package/dist/utils/type-guards.d.ts.map +0 -1
- package/dist/utils/vercel-project.d.ts.map +0 -1
- package/dist/utils/workspace-detector.d.ts.map +0 -1
- package/dist/validators/risk-detector.d.ts.map +0 -1
- package/dist/validators/schema-validator.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/watchers/schema-watcher.d.ts.map +0 -1
- package/dist/watchers/test-watcher.d.ts.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI HINT: Hazard Handler for pg-schema-diff
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Parse, display, and handle hazards from pg-schema-diff plan output.
|
|
5
|
+
* Separates hazard logic from binary verification and plan execution.
|
|
6
|
+
*
|
|
7
|
+
* Hazard Types:
|
|
8
|
+
* - DELETES_DATA: Data loss risk (blocks production without --allow-data-loss)
|
|
9
|
+
* - AUTHZ_UPDATE: RLS policy changes (blocks production without --confirm-authz-update)
|
|
10
|
+
* - ACQUIRES_ACCESS_EXCLUSIVE_LOCK: Table lock during migration
|
|
11
|
+
* - HAS_UNTRACKABLE_DEPENDENCIES: Cross-schema dependencies
|
|
12
|
+
* - INDEX_BUILD / INDEX_DROPPED: Index operations
|
|
13
|
+
*/
|
|
14
|
+
import type { DbApplyInput } from '../contract.js';
|
|
15
|
+
import { type ParsedHazard } from './idempotent-object-registry.js';
|
|
16
|
+
/**
|
|
17
|
+
* Parse hazards from pg-schema-diff output with context.
|
|
18
|
+
* Enhanced to extract the SQL statement that caused each hazard.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseHazardsWithContext(planOutput: string): ParsedHazard[];
|
|
21
|
+
/**
|
|
22
|
+
* Display hazards with context and return flags.
|
|
23
|
+
*/
|
|
24
|
+
export declare function displayHazardsWithContext(hazards: ParsedHazard[], verbose: boolean): {
|
|
25
|
+
hasDeletesData: boolean;
|
|
26
|
+
hasAuthzUpdate: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Handle production data protection for DELETES_DATA hazard.
|
|
30
|
+
*/
|
|
31
|
+
export declare function handleProductionDataProtection(allowDataLoss: boolean): void;
|
|
32
|
+
/**
|
|
33
|
+
* Handle production RLS policy protection for AUTHZ_UPDATE hazard.
|
|
34
|
+
*/
|
|
35
|
+
export declare function handleProductionAuthzProtection(confirmAuthzUpdate: boolean): void;
|
|
36
|
+
/**
|
|
37
|
+
* Build list of allowed hazards based on environment and flags.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildAllowedHazards(input: DbApplyInput): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Handle hazards with enhanced context display.
|
|
42
|
+
*
|
|
43
|
+
* This function filters out false positive AUTHZ_UPDATE hazards for roles
|
|
44
|
+
* defined in idempotent/*.sql (e.g., drizzle_app, drizzle_service).
|
|
45
|
+
*/
|
|
46
|
+
export declare function handleHazardsWithContext(planOutput: string, input: DbApplyInput, schemasDir?: string): {
|
|
47
|
+
hazards: string[];
|
|
48
|
+
hasDeletesData: boolean;
|
|
49
|
+
hasAuthzUpdate: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Display check mode results.
|
|
53
|
+
*/
|
|
54
|
+
export declare function displayCheckModeResults(planOutput: string, filterInfo?: {
|
|
55
|
+
filteredPlanSql: string;
|
|
56
|
+
removedStatements: {
|
|
57
|
+
sql: string;
|
|
58
|
+
}[];
|
|
59
|
+
}): void;
|
|
60
|
+
//# sourceMappingURL=hazard-handler.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI HINT: Idempotent Object Registry
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Detect and register all objects defined in idempotent/*.sql files.
|
|
5
|
+
* These objects are invisible to pg-schema-diff's shadow DB, so pg-schema-diff
|
|
6
|
+
* generates DROP statements for them. This registry is used to filter those out.
|
|
7
|
+
*
|
|
8
|
+
* Objects tracked:
|
|
9
|
+
* - Roles (CREATE ROLE) — for AUTHZ_UPDATE false positive filtering
|
|
10
|
+
* - Tables (CREATE TABLE) — for DROP TABLE protection
|
|
11
|
+
* - Functions, Triggers, Views, Types, Sequences — for DROP protection
|
|
12
|
+
*
|
|
13
|
+
* Security: All identifier extraction uses regex on comment-stripped SQL.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the idempotent directory from a schemasDir path.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveIdempotentDir(schemasDir?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Read and strip comments from all idempotent SQL files.
|
|
21
|
+
* Returns per-file results with filename and comment-stripped content.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readIdempotentSqlFiles(idempotentDir: string): Array<{
|
|
24
|
+
file: string;
|
|
25
|
+
content: string;
|
|
26
|
+
}> | null;
|
|
27
|
+
/**
|
|
28
|
+
* Extract role names from idempotent SQL files.
|
|
29
|
+
* These roles are managed outside pg-schema-diff and should not trigger AUTHZ_UPDATE.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getIdempotentRoles(schemasDir?: string): string[];
|
|
32
|
+
/**
|
|
33
|
+
* Reset the cached idempotent roles.
|
|
34
|
+
* Useful for testing or when schema files change.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resetIdempotentRolesCache(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Extract table names from idempotent SQL files.
|
|
39
|
+
* These tables are managed outside pg-schema-diff and must not be dropped.
|
|
40
|
+
*
|
|
41
|
+
* Also merges tables from `excludeFromOrphanDetection` config.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getIdempotentProtectedTables(schemasDir?: string, configExclusions?: string[]): string[];
|
|
44
|
+
export interface IdempotentProtectedObjects {
|
|
45
|
+
tables: string[];
|
|
46
|
+
functions: string[];
|
|
47
|
+
triggers: string[];
|
|
48
|
+
views: string[];
|
|
49
|
+
types: string[];
|
|
50
|
+
sequences: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Extract all protected object names from idempotent/*.sql files.
|
|
54
|
+
*
|
|
55
|
+
* Scans for:
|
|
56
|
+
* - CREATE [OR REPLACE] FUNCTION schema.name(...)
|
|
57
|
+
* - CREATE TRIGGER name ON schema.table
|
|
58
|
+
* - CREATE [OR REPLACE] [MATERIALIZED] VIEW schema.name
|
|
59
|
+
* - CREATE TYPE schema.name
|
|
60
|
+
* - CREATE SEQUENCE schema.name
|
|
61
|
+
*/
|
|
62
|
+
export declare function getIdempotentProtectedObjects(schemasDir?: string, configExclusions?: string[]): IdempotentProtectedObjects;
|
|
63
|
+
/**
|
|
64
|
+
* Parsed hazard with context information.
|
|
65
|
+
* Defined here to avoid circular dependency (used by both registry and handler).
|
|
66
|
+
*/
|
|
67
|
+
export interface ParsedHazard {
|
|
68
|
+
type: string;
|
|
69
|
+
message: string;
|
|
70
|
+
fullMatch: string;
|
|
71
|
+
/** SQL statement that caused this hazard (if extractable) */
|
|
72
|
+
causingSql?: string;
|
|
73
|
+
/** Line number in the plan output */
|
|
74
|
+
lineNumber?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Check if an AUTHZ_UPDATE hazard is a false positive.
|
|
78
|
+
*
|
|
79
|
+
* False positives occur when the hazard's causingSql is a GRANT/REVOKE statement
|
|
80
|
+
* targeting a role defined in idempotent/*.sql. These are expected to be re-applied
|
|
81
|
+
* by the 2nd-pass idempotent execution.
|
|
82
|
+
*
|
|
83
|
+
* IMPORTANT: Only GRANT/REVOKE statements are considered FP. If causingSql is a
|
|
84
|
+
* schema change (ALTER TABLE, CREATE TABLE, etc.) that triggers an AUTHZ_UPDATE,
|
|
85
|
+
* it is a genuine hazard and should NOT be filtered.
|
|
86
|
+
*/
|
|
87
|
+
export declare function isIdempotentRoleHazard(hazard: ParsedHazard, schemasDir?: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Filter out false positive hazards.
|
|
90
|
+
* Returns hazards that are NOT false positives (i.e., real issues).
|
|
91
|
+
*/
|
|
92
|
+
export declare function filterFalsePositiveHazards(hazards: ParsedHazard[], schemasDir?: string): {
|
|
93
|
+
filtered: ParsedHazard[];
|
|
94
|
+
falsePositives: ParsedHazard[];
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=idempotent-object-registry.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a SQL file contains statements that cannot run inside a transaction block.
|
|
3
|
+
*/
|
|
4
|
+
export declare function hasTransactionIncompatibleStatements(filePath: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Check if SQL content contains transaction-incompatible statements.
|
|
7
|
+
* Exported separately for testing without file I/O.
|
|
8
|
+
*/
|
|
9
|
+
export declare function hasTransactionIncompatibleContent(sql: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Determine the transaction strategy for a SQL file.
|
|
12
|
+
*
|
|
13
|
+
* @returns 'wrap' if file can be wrapped in BEGIN/COMMIT, 'skip' otherwise
|
|
14
|
+
*/
|
|
15
|
+
export declare function getTransactionStrategy(filePath: string): 'wrap' | 'skip';
|
|
16
|
+
/**
|
|
17
|
+
* Wrap SQL content in a transaction block (BEGIN/COMMIT).
|
|
18
|
+
*/
|
|
19
|
+
export declare function wrapInTransaction(sql: string): string;
|
|
20
|
+
//# sourceMappingURL=idempotent-transaction.d.ts.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { acquireAdvisoryLock, MIGRATION_LOCK_ID, releaseAdvisoryLock, } from './advisory-lock.js';
|
|
7
7
|
export type { FilterResult, PlanHazard, PlanStatement, ValidatedPlan } from './plan-validator.js';
|
|
8
|
-
export { filterIdempotentProtectedStatements, isDropStatementForProtectedObject, parsePlanOutput, validatePlanForExecution, } from './plan-validator.js';
|
|
8
|
+
export { ALLOWED_DDL_PREFIXES, BLOCKED_SQL_PATTERNS, filterIdempotentProtectedStatements, isDropStatementForProtectedObject, parsePlanOutput, validatePlanForExecution, validateStatementTypes, } from './plan-validator.js';
|
|
9
9
|
export type { IdempotentProtectedObjects, ParsedHazard, PartitionPrivilegeDetection, PgSchemaDiffPlanOptions, } from './pg-schema-diff-helpers.js';
|
|
10
10
|
export type { ShadowDbConfig, ShadowDbResult } from './shadow-db-manager.js';
|
|
11
11
|
export { buildAllowedHazards, detectDropTableStatements, detectPartitionPrivilegeError, displayCheckModeResults, displayHazardsWithContext, executePgSchemaDiffPlan, filterFalsePositiveHazards, formatPartitionPrivilegeHint, getIdempotentProtectedObjects, getIdempotentProtectedTables, getIdempotentRoles, handleHazardsWithContext, handleProductionAuthzProtection, handleProductionDataProtection, isIdempotentRoleHazard, parseHazardsWithContext, PG_SCHEMA_DIFF_APPLY_TIMEOUT_MS, resetIdempotentRolesCache, verifyDatabaseConnection, verifyPgSchemaDiffBinary, } from './pg-schema-diff-helpers.js';
|
|
@@ -20,4 +20,10 @@ export type { DetectedPartitionStub, PrefilterResult } from './partition-prefilt
|
|
|
20
20
|
export { prefilterPartitionStubs } from './partition-prefilter.js';
|
|
21
21
|
export type { ExpectedPartition, PartitionDrift } from './partition-validator.js';
|
|
22
22
|
export { blankDollarQuotedBodies, detectPartitionDrift, formatPartitionWarnings, parseExpectedPartitions, queryActualPartitions, } from './partition-validator.js';
|
|
23
|
+
export { isValidIdentifier, maskDbCredentials, qualifiedTable, quoteIdent } from './sql-utils.js';
|
|
24
|
+
export type { PgSchemaDiffResult } from './fresh-db-handler.js';
|
|
25
|
+
export { handleFreshDbCase, hasAppTables } from './fresh-db-handler.js';
|
|
26
|
+
export { checkPasswordSecurity, parseDbCredentials, setRolePasswords, } from './rbac-password-manager.js';
|
|
27
|
+
export { backupIdempotentTables, getTableRowEstimates, verifyDataIntegrity, } from './data-integrity-verifier.js';
|
|
28
|
+
export { getTransactionStrategy, hasTransactionIncompatibleContent, hasTransactionIncompatibleStatements, wrapInTransaction, } from './idempotent-transaction.js';
|
|
23
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { blankDollarQuotedBodies, stripSqlComments } from '../../../../lib/sql-comment-utils.js';
|
|
2
|
+
export { blankDollarQuotedBodies, stripSqlComments };
|
|
1
3
|
export interface ExpectedPartition {
|
|
2
4
|
/** Qualified child table name (e.g., "events.location_events_2026_01") */
|
|
3
5
|
child: string;
|
|
@@ -10,12 +12,6 @@ export interface PartitionDrift {
|
|
|
10
12
|
/** Partitions expected in SQL but missing from the database */
|
|
11
13
|
missing: ExpectedPartition[];
|
|
12
14
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Strip SQL comments while preserving quoted text.
|
|
15
|
-
* Handles: -- line comments, nested block comments, single/double/dollar-quoted strings,
|
|
16
|
-
* and PostgreSQL E-string literals (E'...' with backslash escapes).
|
|
17
|
-
*/
|
|
18
|
-
export declare function stripSqlComments(content: string): string;
|
|
19
15
|
/**
|
|
20
16
|
* Qualified name pattern: optional schema prefix + table name.
|
|
21
17
|
* Matches: schema.table, "schema"."table", or bare table (no schema).
|
|
@@ -43,15 +39,6 @@ export declare const PARTITION_OF_REGEX: RegExp;
|
|
|
43
39
|
* Returns "schema.table" when schema is present, or just "table" when absent.
|
|
44
40
|
*/
|
|
45
41
|
export declare function extractQualifiedName(quotedSchema: string | undefined, unquotedSchema: string | undefined, quotedTable: string | undefined, unquotedTable: string | undefined): string;
|
|
46
|
-
/**
|
|
47
|
-
* Replace content inside dollar-quoted strings with spaces.
|
|
48
|
-
* This prevents false-positive PARTITION OF matches inside PL/pgSQL function bodies.
|
|
49
|
-
*
|
|
50
|
-
* Input is already comment-stripped (from stripSqlComments), so we only need to
|
|
51
|
-
* handle dollar-quoted strings — single/double quotes are already handled by the
|
|
52
|
-
* regex (they can't span the CREATE TABLE ... PARTITION OF ... ; pattern).
|
|
53
|
-
*/
|
|
54
|
-
export declare function blankDollarQuotedBodies(content: string): string;
|
|
55
42
|
/**
|
|
56
43
|
* Parse all expected partitions from idempotent SQL directory.
|
|
57
44
|
*
|
|
@@ -1,163 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AI HINT: pg-schema-diff Helper Functions
|
|
3
3
|
*
|
|
4
|
-
* Purpose:
|
|
5
|
-
*
|
|
4
|
+
* Purpose: Binary verification, plan execution, and error detection for pg-schema-diff.
|
|
5
|
+
* This file was refactored from a 1,015-line monolith into 3 focused modules:
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
7
|
+
* - idempotent-object-registry.ts: Idempotent object detection & DROP protection
|
|
8
|
+
* - hazard-handler.ts: Hazard parsing, display, and production protection
|
|
9
|
+
* - pg-schema-diff-helpers.ts (this file): Binary verification, plan execution, error detection
|
|
10
|
+
*
|
|
11
|
+
* Re-exports are provided for backward compatibility.
|
|
11
12
|
*
|
|
12
13
|
* Security:
|
|
13
14
|
* - All psql calls use parsePostgresUrl + buildPsqlArgs to prevent SQL injection
|
|
14
15
|
* - Passwords are passed via PGPASSWORD env var, not command line
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* These roles are managed outside pg-schema-diff and should not trigger AUTHZ_UPDATE.
|
|
20
|
-
*/
|
|
21
|
-
export declare function getIdempotentRoles(schemasDir?: string): string[];
|
|
22
|
-
/**
|
|
23
|
-
* Check if an AUTHZ_UPDATE hazard is a false positive.
|
|
24
|
-
*
|
|
25
|
-
* False positives occur when:
|
|
26
|
-
* - The hazard type is AUTHZ_UPDATE
|
|
27
|
-
* - The causing SQL references a role defined in idempotent/*.sql
|
|
28
|
-
* - Example: "REVOKE ... FROM drizzle_app" when drizzle_app is in 15_rbac_roles.sql
|
|
29
|
-
*/
|
|
30
|
-
export declare function isIdempotentRoleHazard(hazard: ParsedHazard, schemasDir?: string): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Filter out false positive hazards.
|
|
33
|
-
* Returns hazards that are NOT false positives (i.e., real issues).
|
|
34
|
-
*/
|
|
35
|
-
export declare function filterFalsePositiveHazards(hazards: ParsedHazard[], schemasDir?: string): {
|
|
36
|
-
filtered: ParsedHazard[];
|
|
37
|
-
falsePositives: ParsedHazard[];
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Reset the cached idempotent roles.
|
|
41
|
-
* Useful for testing or when schema files change.
|
|
42
|
-
*/
|
|
43
|
-
export declare function resetIdempotentRolesCache(): void;
|
|
44
|
-
/**
|
|
45
|
-
* AI HINT: Idempotent Table Extraction
|
|
46
|
-
*
|
|
47
|
-
* Purpose: Extract table names defined in idempotent/*.sql files
|
|
48
|
-
* Use case: Filter out DROP TABLE statements for these tables from pg-schema-diff plan
|
|
49
|
-
*
|
|
50
|
-
* Pattern: Parse SQL for CREATE TABLE statements
|
|
51
|
-
* Example: CREATE TABLE location_data.location_events → ['location_data.location_events']
|
|
52
|
-
*
|
|
53
|
-
* Incident context: pg-schema-diff drops tables not in declarative/*.sql because its
|
|
54
|
-
* shadow DB doesn't contain idempotent-managed tables. This function identifies those
|
|
55
|
-
* tables so their DROP statements can be filtered from the plan output.
|
|
56
|
-
*/
|
|
57
|
-
/**
|
|
58
|
-
* Extract table names from idempotent SQL files.
|
|
59
|
-
* These tables are managed outside pg-schema-diff and must not be dropped.
|
|
60
|
-
*
|
|
61
|
-
* Also merges tables from `excludeFromOrphanDetection` config.
|
|
62
|
-
*/
|
|
63
|
-
export declare function getIdempotentProtectedTables(schemasDir?: string, configExclusions?: string[]): string[];
|
|
17
|
+
export type { IdempotentProtectedObjects, ParsedHazard, } from './idempotent-object-registry.js';
|
|
18
|
+
export { filterFalsePositiveHazards, getIdempotentProtectedObjects, getIdempotentProtectedTables, getIdempotentRoles, isIdempotentRoleHazard, resetIdempotentRolesCache, } from './idempotent-object-registry.js';
|
|
19
|
+
export { buildAllowedHazards, displayCheckModeResults, displayHazardsWithContext, handleHazardsWithContext, handleProductionAuthzProtection, handleProductionDataProtection, parseHazardsWithContext, } from './hazard-handler.js';
|
|
64
20
|
/**
|
|
65
21
|
* Verify pg-schema-diff binary is available.
|
|
66
22
|
*/
|
|
67
|
-
export
|
|
68
|
-
|
|
69
|
-
* Verify database connection.
|
|
70
|
-
*/
|
|
71
|
-
export declare function verifyDatabaseConnection(dbUrl: string): void;
|
|
72
|
-
/**
|
|
73
|
-
* Parsed hazard with context information.
|
|
74
|
-
*/
|
|
75
|
-
export interface ParsedHazard {
|
|
76
|
-
type: string;
|
|
77
|
-
message: string;
|
|
78
|
-
fullMatch: string;
|
|
79
|
-
/** SQL statement that caused this hazard (if extractable) */
|
|
80
|
-
causingSql?: string;
|
|
81
|
-
/** Line number in the plan output */
|
|
82
|
-
lineNumber?: number;
|
|
23
|
+
export interface VerifyPgSchemaDiffBinaryOptions {
|
|
24
|
+
strictVersion?: boolean;
|
|
83
25
|
}
|
|
84
26
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*/
|
|
88
|
-
export declare function parseHazardsWithContext(planOutput: string): ParsedHazard[];
|
|
89
|
-
/**
|
|
90
|
-
* Display hazards with context and return flags.
|
|
91
|
-
*/
|
|
92
|
-
export declare function displayHazardsWithContext(hazards: ParsedHazard[], verbose: boolean): {
|
|
93
|
-
hasDeletesData: boolean;
|
|
94
|
-
hasAuthzUpdate: boolean;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Handle production data protection for DELETES_DATA hazard.
|
|
98
|
-
*/
|
|
99
|
-
export declare function handleProductionDataProtection(allowDataLoss: boolean): void;
|
|
100
|
-
/**
|
|
101
|
-
* Handle production RLS policy protection for AUTHZ_UPDATE hazard.
|
|
102
|
-
* RLS policy changes can silently affect security if not explicitly approved.
|
|
103
|
-
*/
|
|
104
|
-
export declare function handleProductionAuthzProtection(confirmAuthzUpdate: boolean): void;
|
|
105
|
-
/**
|
|
106
|
-
* AI HINT: Idempotent Object Extraction
|
|
107
|
-
*
|
|
108
|
-
* Purpose: Extract all object names defined in idempotent/*.sql files
|
|
109
|
-
* Use case: Filter DROP FUNCTION/TRIGGER/VIEW/TYPE/SEQUENCE from pg-schema-diff plan
|
|
110
|
-
*
|
|
111
|
-
* Pattern: Parse SQL for CREATE statements (after stripping comments)
|
|
112
|
-
* Objects created in idempotent/*.sql are invisible to pg-schema-diff's shadow DB,
|
|
113
|
-
* so pg-schema-diff generates DROP statements for them. We must filter these out.
|
|
114
|
-
*/
|
|
115
|
-
export interface IdempotentProtectedObjects {
|
|
116
|
-
tables: string[];
|
|
117
|
-
functions: string[];
|
|
118
|
-
triggers: string[];
|
|
119
|
-
views: string[];
|
|
120
|
-
types: string[];
|
|
121
|
-
sequences: string[];
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Extract all protected object names from idempotent/*.sql files.
|
|
125
|
-
*
|
|
126
|
-
* Scans for:
|
|
127
|
-
* - CREATE [OR REPLACE] FUNCTION schema.name(...)
|
|
128
|
-
* - CREATE TRIGGER name ON schema.table
|
|
129
|
-
* - CREATE [OR REPLACE] [MATERIALIZED] VIEW schema.name
|
|
130
|
-
* - CREATE TYPE schema.name
|
|
131
|
-
* - CREATE SEQUENCE schema.name
|
|
132
|
-
*
|
|
133
|
-
* Uses stripSqlComments to avoid matching inside comments.
|
|
134
|
-
*/
|
|
135
|
-
export declare function getIdempotentProtectedObjects(schemasDir?: string, configExclusions?: string[]): IdempotentProtectedObjects;
|
|
136
|
-
/**
|
|
137
|
-
* Display check mode results.
|
|
138
|
-
*/
|
|
139
|
-
export declare function displayCheckModeResults(planOutput: string, filterInfo?: {
|
|
140
|
-
filteredPlanSql: string;
|
|
141
|
-
removedStatements: {
|
|
142
|
-
sql: string;
|
|
143
|
-
}[];
|
|
144
|
-
}): void;
|
|
145
|
-
/**
|
|
146
|
-
* Build list of allowed hazards based on environment and flags.
|
|
27
|
+
* Verify pg-schema-diff binary is available.
|
|
28
|
+
* strictVersion=true blocks unsupported/undetectable versions.
|
|
147
29
|
*/
|
|
148
|
-
export declare function
|
|
30
|
+
export declare function verifyPgSchemaDiffBinary(options?: VerifyPgSchemaDiffBinaryOptions): void;
|
|
149
31
|
/**
|
|
150
|
-
*
|
|
151
|
-
* Use this for detailed hazard reporting with SQL context.
|
|
152
|
-
*
|
|
153
|
-
* This function filters out false positive AUTHZ_UPDATE hazards for roles
|
|
154
|
-
* defined in idempotent/*.sql (e.g., drizzle_app, drizzle_service).
|
|
32
|
+
* Verify database connection with retry for transient startup errors.
|
|
155
33
|
*/
|
|
156
|
-
export declare function
|
|
157
|
-
hazards: string[];
|
|
158
|
-
hasDeletesData: boolean;
|
|
159
|
-
hasAuthzUpdate: boolean;
|
|
160
|
-
};
|
|
34
|
+
export declare function verifyDatabaseConnection(dbUrl: string): Promise<void>;
|
|
161
35
|
export interface MissingExtensionDetection {
|
|
162
36
|
detected: boolean;
|
|
163
37
|
missingTypes: string[];
|
|
@@ -178,7 +52,6 @@ export interface PartitionPrivilegeDetection {
|
|
|
178
52
|
}
|
|
179
53
|
/**
|
|
180
54
|
* Detect "privileges on partitions: not implemented" errors in pg-schema-diff output.
|
|
181
|
-
* pg-schema-diff v1.0.5 hard-rejects partition privilege diffs in sql_generator.go.
|
|
182
55
|
*/
|
|
183
56
|
export declare function detectPartitionPrivilegeError(errorOutput: string): PartitionPrivilegeDetection;
|
|
184
57
|
/**
|
|
@@ -187,23 +60,12 @@ export declare function detectPartitionPrivilegeError(errorOutput: string): Part
|
|
|
187
60
|
export declare function formatPartitionPrivilegeHint(detection: PartitionPrivilegeDetection): string;
|
|
188
61
|
/**
|
|
189
62
|
* Detect DROP TABLE statements in plan output.
|
|
190
|
-
* Returns list of "schema.table" names that would be dropped.
|
|
191
|
-
* Used for pre-apply warnings (separate from idempotent protection).
|
|
192
63
|
*/
|
|
193
64
|
export declare function detectDropTableStatements(planOutput: string): string[];
|
|
194
|
-
/**
|
|
195
|
-
* Options for pg-schema-diff plan execution.
|
|
196
|
-
*/
|
|
197
65
|
export interface PgSchemaDiffPlanOptions {
|
|
198
66
|
/**
|
|
199
67
|
* Shadow DB DSN for extension type resolution.
|
|
200
|
-
*
|
|
201
|
-
* When specified, pg-schema-diff uses this database for parsing
|
|
202
|
-
* extension-defined types (PostGIS geometry, pgvector vector, etc.).
|
|
203
|
-
*
|
|
204
|
-
* This is passed as --temp-db-dsn to pg-schema-diff.
|
|
205
|
-
*
|
|
206
|
-
* @see https://github.com/stripe/pg-schema-diff/pull/194
|
|
68
|
+
* Passed as --temp-db-dsn to pg-schema-diff.
|
|
207
69
|
*/
|
|
208
70
|
tempDbDsn?: string;
|
|
209
71
|
}
|
|
@@ -211,12 +73,6 @@ export interface PgSchemaDiffPlanOptions {
|
|
|
211
73
|
export declare const PG_SCHEMA_DIFF_APPLY_TIMEOUT_MS = 600000;
|
|
212
74
|
/**
|
|
213
75
|
* Execute pg-schema-diff plan and handle errors.
|
|
214
|
-
*
|
|
215
|
-
* @param dbUrl - Source database URL (--from-dsn)
|
|
216
|
-
* @param schemasDir - Directory containing declarative SQL schemas (--to-dir)
|
|
217
|
-
* @param includeSchemas - Schemas to include in diff
|
|
218
|
-
* @param verbose - Enable verbose logging
|
|
219
|
-
* @param options - Additional options (tempDbDsn for extension support)
|
|
220
76
|
*/
|
|
221
77
|
export declare function executePgSchemaDiffPlan(dbUrl: string, schemasDir: string, includeSchemas: string[], verbose: boolean, options?: PgSchemaDiffPlanOptions): {
|
|
222
78
|
planOutput: string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI HINT: pg-schema-diff Version-Sensitive Patterns
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Centralize all regex patterns that depend on pg-schema-diff output format.
|
|
5
|
+
* When pg-schema-diff changes its output format, update ONLY this file.
|
|
6
|
+
*
|
|
7
|
+
* VERSION SENSITIVE: Tested against pg-schema-diff v0.9.x – v0.11.x
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Regex to detect statement index markers in plan output.
|
|
11
|
+
* VERSION SENSITIVE: pg-schema-diff v0.9.x uses "-- Statement Idx. N"
|
|
12
|
+
* Future versions may use different formats.
|
|
13
|
+
*/
|
|
14
|
+
export declare const STATEMENT_IDX_REGEX: RegExp;
|
|
15
|
+
/**
|
|
16
|
+
* Test if a line is a statement index marker.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isStatementMarker(line: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Regex to parse hazard comments from plan output.
|
|
21
|
+
* VERSION SENSITIVE: pg-schema-diff v0.9.x uses "-- Hazard TYPE: message"
|
|
22
|
+
*/
|
|
23
|
+
export declare const HAZARD_REGEX: RegExp;
|
|
24
|
+
/**
|
|
25
|
+
* Parse a hazard comment line. Returns null if not a hazard.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseHazardLine(line: string): {
|
|
28
|
+
type: string;
|
|
29
|
+
message: string;
|
|
30
|
+
} | null;
|
|
31
|
+
/**
|
|
32
|
+
* Map of type names to their required PostgreSQL extensions.
|
|
33
|
+
* VERSION SENSITIVE: pg-schema-diff reports these as type errors in shadow DB.
|
|
34
|
+
*/
|
|
35
|
+
export declare const EXTENSION_TYPE_MAP: Record<string, string>;
|
|
36
|
+
/**
|
|
37
|
+
* Detect if a pg-schema-diff error is caused by a missing extension type.
|
|
38
|
+
* Returns the extension name if detected, null otherwise.
|
|
39
|
+
*/
|
|
40
|
+
export declare function detectExtensionTypeError(stderr: string): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Regex to detect the pg-schema-diff partition privilege error.
|
|
43
|
+
* VERSION SENSITIVE: pg-schema-diff v1.0.5 uses this exact message.
|
|
44
|
+
*/
|
|
45
|
+
export declare const PARTITION_PRIVILEGE_ERROR_REGEX: RegExp;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a pg-schema-diff error is the known partition privilege limitation.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isPartitionPrivilegeError(stderr: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Check if stderr contains hazard-like content that wasn't parsed by the
|
|
52
|
+
* standard hazard regex. Used as a fallback warning mechanism.
|
|
53
|
+
*/
|
|
54
|
+
export declare function hasUnparsedHazardHints(stderr: string): boolean;
|
|
55
|
+
//# sourceMappingURL=pg-schema-diff-patterns.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI HINT: pg-schema-diff Version Detection & Compatibility
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Detect installed pg-schema-diff version and enforce compatibility.
|
|
5
|
+
* In strict mode (production), incompatible/undetectable versions are blocked.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Known compatible pg-schema-diff version range.
|
|
9
|
+
* Update this when testing against new pg-schema-diff releases.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SUPPORTED_PG_SCHEMA_DIFF_VERSIONS: {
|
|
12
|
+
minMajor: number;
|
|
13
|
+
minMinor: number;
|
|
14
|
+
maxMajor: number;
|
|
15
|
+
maxMinor: number;
|
|
16
|
+
};
|
|
17
|
+
export interface PgSchemaDiffVersion {
|
|
18
|
+
raw: string;
|
|
19
|
+
major: number;
|
|
20
|
+
minor: number;
|
|
21
|
+
patch: number;
|
|
22
|
+
}
|
|
23
|
+
export interface VerifyPgSchemaDiffVersionOptions {
|
|
24
|
+
strict?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse a version string into components.
|
|
28
|
+
* Supports formats:
|
|
29
|
+
* - "v0.9.0", "0.10.1" (legacy --version output)
|
|
30
|
+
* - "version=v1.0.5" (v1.x+ `version` subcommand output)
|
|
31
|
+
* - "pg-schema-diff version v0.9.3" (verbose output)
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseVersion(raw: string): PgSchemaDiffVersion | null;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a version is within the supported range.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isVersionSupported(version: PgSchemaDiffVersion): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Detect the installed pg-schema-diff version by running the binary.
|
|
40
|
+
* Tries `version` subcommand first (v1.x+), falls back to `--version` (v0.x).
|
|
41
|
+
* Returns null if the binary is not found or version cannot be parsed.
|
|
42
|
+
*/
|
|
43
|
+
export declare function detectPgSchemaDiffVersion(binaryPath: string): PgSchemaDiffVersion | null;
|
|
44
|
+
/**
|
|
45
|
+
* Verify pg-schema-diff version compatibility.
|
|
46
|
+
* strict=true: throw on unknown/incompatible version (fail-closed).
|
|
47
|
+
* strict=false: warn only (best effort).
|
|
48
|
+
*/
|
|
49
|
+
export declare function verifyPgSchemaDiffVersion(binaryPath: string, options?: VerifyPgSchemaDiffVersionOptions): void;
|
|
50
|
+
//# sourceMappingURL=pg-schema-diff-version.d.ts.map
|
|
@@ -36,6 +36,10 @@ export declare const ValidatedPlanSchema: z.ZodObject<{
|
|
|
36
36
|
}, z.core.$strip>>;
|
|
37
37
|
totalStatements: z.ZodNumber;
|
|
38
38
|
rawSql: z.ZodString;
|
|
39
|
+
parseConfidence: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
high: "high";
|
|
41
|
+
low: "low";
|
|
42
|
+
}>>;
|
|
39
43
|
}, z.core.$strip>;
|
|
40
44
|
export type PlanHazard = z.infer<typeof PlanHazardSchema>;
|
|
41
45
|
export type PlanStatement = z.infer<typeof PlanStatementSchema>;
|
|
@@ -54,16 +58,6 @@ export interface FilterResult {
|
|
|
54
58
|
filteredPlan: ValidatedPlan;
|
|
55
59
|
removedStatements: PlanStatement[];
|
|
56
60
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Check if a DROP statement targets a protected (idempotent-managed) table or index.
|
|
59
|
-
*
|
|
60
|
-
* Matching rules:
|
|
61
|
-
* - DROP TABLE [IF EXISTS] schema.table → exact match or glob match
|
|
62
|
-
* - DROP INDEX [IF EXISTS] schema.idx_* → index in same schema as protected table
|
|
63
|
-
*
|
|
64
|
-
* Glob support: patterns with `*` (e.g., `location_data.location_events_*`)
|
|
65
|
-
* are converted to regex for matching partition child tables.
|
|
66
|
-
*/
|
|
67
61
|
declare function isDropStatementForProtected(sql: string, protectedTables: string[]): boolean;
|
|
68
62
|
/**
|
|
69
63
|
* Check if a DROP FUNCTION/TRIGGER/VIEW/TYPE/SEQUENCE targets a protected object.
|
|
@@ -95,6 +89,32 @@ export declare function filterIdempotentProtectedStatements(plan: ValidatedPlan,
|
|
|
95
89
|
export { isDropStatementForProtected as _isDropStatementForProtected };
|
|
96
90
|
export { extractProtectedSchemas as _extractProtectedSchemas };
|
|
97
91
|
export { isDropSchemaForProtected as _isDropSchemaForProtected };
|
|
92
|
+
/**
|
|
93
|
+
* Allowed DDL statement prefixes. Only these statement types are permitted
|
|
94
|
+
* in pg-schema-diff plan output. Checked against the normalized first keyword(s)
|
|
95
|
+
* of each statement's SQL.
|
|
96
|
+
*/
|
|
97
|
+
export declare const ALLOWED_DDL_PREFIXES: readonly ["CREATE TABLE", "ALTER TABLE", "DROP TABLE", "CREATE INDEX", "CREATE UNIQUE INDEX", "DROP INDEX", "CREATE SCHEMA", "ALTER SCHEMA", "DROP SCHEMA", "CREATE FUNCTION", "CREATE OR REPLACE FUNCTION", "ALTER FUNCTION", "DROP FUNCTION", "CREATE TRIGGER", "ALTER TRIGGER", "DROP TRIGGER", "CREATE VIEW", "CREATE OR REPLACE VIEW", "CREATE MATERIALIZED VIEW", "ALTER VIEW", "DROP VIEW", "DROP MATERIALIZED VIEW", "CREATE TYPE", "ALTER TYPE", "DROP TYPE", "CREATE SEQUENCE", "ALTER SEQUENCE", "DROP SEQUENCE", "CREATE POLICY", "ALTER POLICY", "DROP POLICY", "CREATE ROLE", "ALTER ROLE", "DROP ROLE", "CREATE EXTENSION", "ALTER EXTENSION", "DROP EXTENSION", "GRANT", "REVOKE", "SET", "COMMENT ON"];
|
|
98
|
+
/**
|
|
99
|
+
* Explicitly blocked SQL patterns. These are DML or dangerous statements
|
|
100
|
+
* that should never appear as the leading keyword of a plan statement.
|
|
101
|
+
*
|
|
102
|
+
* Note: SELECT/INSERT inside CREATE FUNCTION bodies are safe because
|
|
103
|
+
* the leading keyword is CREATE FUNCTION, not SELECT/INSERT.
|
|
104
|
+
*/
|
|
105
|
+
export declare const BLOCKED_SQL_PATTERNS: ReadonlyArray<{
|
|
106
|
+
pattern: RegExp;
|
|
107
|
+
label: string;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Validate that all statements in the plan use allowed DDL types.
|
|
111
|
+
*
|
|
112
|
+
* Defense-in-depth: blocks DML (INSERT/UPDATE/DELETE) and dangerous SQL
|
|
113
|
+
* (DO $$, COPY, EXECUTE) that should never appear in a schema migration plan.
|
|
114
|
+
*
|
|
115
|
+
* @throws Error if any statement uses a blocked or unrecognized SQL type
|
|
116
|
+
*/
|
|
117
|
+
export declare function validateStatementTypes(plan: ValidatedPlan): void;
|
|
98
118
|
/**
|
|
99
119
|
* Validate that all hazards in the plan are in the allowed list.
|
|
100
120
|
*
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI HINT: RBAC Role Password Manager
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Set passwords for RBAC roles (drizzle_app, drizzle_service) by
|
|
5
|
+
* extracting credentials from DATABASE_URL and DATABASE_URL_SERVICE.
|
|
6
|
+
*
|
|
7
|
+
* 3-Role Architecture:
|
|
8
|
+
* - postgres: DDL (schema migrations via db sync/apply)
|
|
9
|
+
* - drizzle_app: DML + RLS enforced (user API requests)
|
|
10
|
+
* - drizzle_service: DML + RLS bypassed (webhooks, background jobs)
|
|
11
|
+
*
|
|
12
|
+
* Security:
|
|
13
|
+
* - Role names validated against alphanumeric pattern
|
|
14
|
+
* - Passwords passed via psql command (not in logs)
|
|
15
|
+
* - Same-password warning detects RBAC bypass risk
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Parse database URL credentials safely.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseDbCredentials(url: string): {
|
|
21
|
+
username: string;
|
|
22
|
+
password: string;
|
|
23
|
+
} | null;
|
|
24
|
+
/**
|
|
25
|
+
* Check if drizzle_app and postgres roles use the same password.
|
|
26
|
+
* Logs a warning if they do (security risk).
|
|
27
|
+
*/
|
|
28
|
+
export declare function checkPasswordSecurity(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Set passwords for RBAC roles by extracting from DATABASE_URL and DATABASE_URL_SERVICE.
|
|
31
|
+
* Returns the number of role passwords that were successfully set.
|
|
32
|
+
*/
|
|
33
|
+
export declare function setRolePasswords(dbUrl: string, verbose: boolean): number;
|
|
34
|
+
//# sourceMappingURL=rbac-password-manager.d.ts.map
|