@intentius/chant-lexicon-sql 0.0.0-stage → 0.112.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/README.md +39 -2
- package/dist/clickhouse/apply/apply.d.ts +82 -0
- package/dist/clickhouse/apply/apply.d.ts.map +1 -0
- package/dist/clickhouse/apply/mutations.d.ts +46 -0
- package/dist/clickhouse/apply/mutations.d.ts.map +1 -0
- package/dist/clickhouse/apply/statements.d.ts +99 -0
- package/dist/clickhouse/apply/statements.d.ts.map +1 -0
- package/dist/clickhouse/catalog-types.d.ts +76 -0
- package/dist/clickhouse/catalog-types.d.ts.map +1 -0
- package/dist/clickhouse/container.d.ts +63 -0
- package/dist/clickhouse/container.d.ts.map +1 -0
- package/dist/clickhouse/engine-syntax.d.ts +43 -0
- package/dist/clickhouse/engine-syntax.d.ts.map +1 -0
- package/dist/clickhouse/entities.d.ts +183 -0
- package/dist/clickhouse/entities.d.ts.map +1 -0
- package/dist/clickhouse/http.d.ts +40 -0
- package/dist/clickhouse/http.d.ts.map +1 -0
- package/dist/clickhouse/import/generator.d.ts +16 -0
- package/dist/clickhouse/import/generator.d.ts.map +1 -0
- package/dist/clickhouse/import/ir.d.ts +52 -0
- package/dist/clickhouse/import/ir.d.ts.map +1 -0
- package/dist/clickhouse/import/live-export.d.ts +28 -0
- package/dist/clickhouse/import/live-export.d.ts.map +1 -0
- package/dist/clickhouse/import/parser.d.ts +10 -0
- package/dist/clickhouse/import/parser.d.ts.map +1 -0
- package/dist/clickhouse/live/bind.d.ts +56 -0
- package/dist/clickhouse/live/bind.d.ts.map +1 -0
- package/dist/clickhouse/live/catalog.d.ts +39 -0
- package/dist/clickhouse/live/catalog.d.ts.map +1 -0
- package/dist/clickhouse/live/describe-resources.d.ts +34 -0
- package/dist/clickhouse/live/describe-resources.d.ts.map +1 -0
- package/dist/clickhouse/overlays/codecs.d.ts +28 -0
- package/dist/clickhouse/overlays/codecs.d.ts.map +1 -0
- package/dist/clickhouse/overlays/engines.d.ts +20 -0
- package/dist/clickhouse/overlays/engines.d.ts.map +1 -0
- package/dist/clickhouse/overlays/kinds.d.ts +38 -0
- package/dist/clickhouse/overlays/kinds.d.ts.map +1 -0
- package/dist/clickhouse/overlays/projections.d.ts +27 -0
- package/dist/clickhouse/overlays/projections.d.ts.map +1 -0
- package/dist/clickhouse/overlays/skip-indexes.d.ts +10 -0
- package/dist/clickhouse/overlays/skip-indexes.d.ts.map +1 -0
- package/dist/clickhouse/overlays/ttl.d.ts +35 -0
- package/dist/clickhouse/overlays/ttl.d.ts.map +1 -0
- package/dist/clickhouse/overlays/types.d.ts +21 -0
- package/dist/clickhouse/overlays/types.d.ts.map +1 -0
- package/dist/clickhouse/ownership.d.ts +71 -0
- package/dist/clickhouse/ownership.d.ts.map +1 -0
- package/dist/clickhouse/parser.d.ts +130 -0
- package/dist/clickhouse/parser.d.ts.map +1 -0
- package/dist/clickhouse/plan/commands.d.ts +26 -0
- package/dist/clickhouse/plan/commands.d.ts.map +1 -0
- package/dist/clickhouse/plan/deep.d.ts +32 -0
- package/dist/clickhouse/plan/deep.d.ts.map +1 -0
- package/dist/clickhouse/plan/diff.d.ts +37 -0
- package/dist/clickhouse/plan/diff.d.ts.map +1 -0
- package/dist/clickhouse/plan/disruption.d.ts +17 -0
- package/dist/clickhouse/plan/disruption.d.ts.map +1 -0
- package/dist/clickhouse/plan/normalize.d.ts +97 -0
- package/dist/clickhouse/plan/normalize.d.ts.map +1 -0
- package/dist/clickhouse/plan/rebuild-handoff.d.ts +38 -0
- package/dist/clickhouse/plan/rebuild-handoff.d.ts.map +1 -0
- package/dist/clickhouse/plan/report.d.ts +6 -0
- package/dist/clickhouse/plan/report.d.ts.map +1 -0
- package/dist/clickhouse/plan/rules.d.ts +60 -0
- package/dist/clickhouse/plan/rules.d.ts.map +1 -0
- package/dist/clickhouse/plan/schema.d.ts +23 -0
- package/dist/clickhouse/plan/schema.d.ts.map +1 -0
- package/dist/clickhouse/plan/server-format.d.ts +12 -0
- package/dist/clickhouse/plan/server-format.d.ts.map +1 -0
- package/dist/clickhouse/rebuild/backfill.d.ts +70 -0
- package/dist/clickhouse/rebuild/backfill.d.ts.map +1 -0
- package/dist/clickhouse/rebuild/observe.d.ts +157 -0
- package/dist/clickhouse/rebuild/observe.d.ts.map +1 -0
- package/dist/clickhouse/rebuild/op.d.ts +108 -0
- package/dist/clickhouse/rebuild/op.d.ts.map +1 -0
- package/dist/clickhouse/rebuild/partitions.d.ts +24 -0
- package/dist/clickhouse/rebuild/partitions.d.ts.map +1 -0
- package/dist/clickhouse/rebuild/receipts.d.ts +76 -0
- package/dist/clickhouse/rebuild/receipts.d.ts.map +1 -0
- package/dist/clickhouse/rebuild/replicas.d.ts +78 -0
- package/dist/clickhouse/rebuild/replicas.d.ts.map +1 -0
- package/dist/clickhouse/rebuild/steps.d.ts +151 -0
- package/dist/clickhouse/rebuild/steps.d.ts.map +1 -0
- package/dist/clickhouse/rebuild/verify.d.ts +51 -0
- package/dist/clickhouse/rebuild/verify.d.ts.map +1 -0
- package/dist/clickhouse/testing/fake-server.d.ts +27 -0
- package/dist/clickhouse/testing/fake-server.d.ts.map +1 -0
- package/dist/clickhouse/testing/roundtrip-schema.d.ts +3 -0
- package/dist/clickhouse/testing/roundtrip-schema.d.ts.map +1 -0
- package/dist/clickhouse/testing/writable-server.d.ts +35 -0
- package/dist/clickhouse/testing/writable-server.d.ts.map +1 -0
- package/dist/clickhouse/tokens.d.ts +15 -0
- package/dist/clickhouse/tokens.d.ts.map +1 -0
- package/dist/clickhouse.d.ts +24 -0
- package/dist/clickhouse.d.ts.map +1 -0
- package/dist/codegen/classifier-page.d.ts +6 -0
- package/dist/codegen/classifier-page.d.ts.map +1 -0
- package/dist/codegen/clickhouse-module.d.ts +23 -0
- package/dist/codegen/clickhouse-module.d.ts.map +1 -0
- package/dist/codegen/docs-cli.d.ts +3 -0
- package/dist/codegen/docs-cli.d.ts.map +1 -0
- package/dist/codegen/docs.d.ts +8 -0
- package/dist/codegen/docs.d.ts.map +1 -0
- package/dist/codegen/generate-cli.d.ts +3 -0
- package/dist/codegen/generate-cli.d.ts.map +1 -0
- package/dist/codegen/generate.d.ts +40 -0
- package/dist/codegen/generate.d.ts.map +1 -0
- package/dist/codegen/package.d.ts +7 -0
- package/dist/codegen/package.d.ts.map +1 -0
- package/dist/codegen/postgres-classifier-page.d.ts +7 -0
- package/dist/codegen/postgres-classifier-page.d.ts.map +1 -0
- package/dist/codegen/postgres-module.d.ts +30 -0
- package/dist/codegen/postgres-module.d.ts.map +1 -0
- package/dist/codegen/registry.d.ts +12 -0
- package/dist/codegen/registry.d.ts.map +1 -0
- package/dist/composites/audit-log-table.d.ts +31 -0
- package/dist/composites/audit-log-table.d.ts.map +1 -0
- package/dist/composites/catalog.d.ts +3 -0
- package/dist/composites/catalog.d.ts.map +1 -0
- package/dist/composites/cdc-mirror.d.ts +32 -0
- package/dist/composites/cdc-mirror.d.ts.map +1 -0
- package/dist/composites/clickhouse.d.ts +7 -0
- package/dist/composites/clickhouse.d.ts.map +1 -0
- package/dist/composites/events-table.d.ts +32 -0
- package/dist/composites/events-table.d.ts.map +1 -0
- package/dist/composites/index.d.ts +9 -0
- package/dist/composites/index.d.ts.map +1 -0
- package/dist/composites/join-table.d.ts +41 -0
- package/dist/composites/join-table.d.ts.map +1 -0
- package/dist/composites/postgres.d.ts +7 -0
- package/dist/composites/postgres.d.ts.map +1 -0
- package/dist/composites/refreshed-view.d.ts +32 -0
- package/dist/composites/refreshed-view.d.ts.map +1 -0
- package/dist/composites/replacing-table.d.ts +34 -0
- package/dist/composites/replacing-table.d.ts.map +1 -0
- package/dist/composites/rollup-view.d.ts +39 -0
- package/dist/composites/rollup-view.d.ts.map +1 -0
- package/dist/composites/sharded-table.d.ts +35 -0
- package/dist/composites/sharded-table.d.ts.map +1 -0
- package/dist/composites/soft-delete-table.d.ts +40 -0
- package/dist/composites/soft-delete-table.d.ts.map +1 -0
- package/dist/composites/tenant-table.d.ts +34 -0
- package/dist/composites/tenant-table.d.ts.map +1 -0
- package/dist/config.d.ts +213 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/core/apply.d.ts +89 -0
- package/dist/core/apply.d.ts.map +1 -0
- package/dist/core/classifier.d.ts +88 -0
- package/dist/core/classifier.d.ts.map +1 -0
- package/dist/core/container.d.ts +45 -0
- package/dist/core/container.d.ts.map +1 -0
- package/dist/core/cursor.d.ts +67 -0
- package/dist/core/cursor.d.ts.map +1 -0
- package/dist/core/diff.d.ts +49 -0
- package/dist/core/diff.d.ts.map +1 -0
- package/dist/core/entity.d.ts +41 -0
- package/dist/core/entity.d.ts.map +1 -0
- package/dist/core/find-templates.d.ts +69 -0
- package/dist/core/find-templates.d.ts.map +1 -0
- package/dist/core/handoff.d.ts +36 -0
- package/dist/core/handoff.d.ts.map +1 -0
- package/dist/core/index.d.ts +61 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/interpolation.d.ts +88 -0
- package/dist/core/interpolation.d.ts.map +1 -0
- package/dist/core/normalize.d.ts +18 -0
- package/dist/core/normalize.d.ts.map +1 -0
- package/dist/core/ownership.d.ts +60 -0
- package/dist/core/ownership.d.ts.map +1 -0
- package/dist/core/receipts.d.ts +28 -0
- package/dist/core/receipts.d.ts.map +1 -0
- package/dist/core/references.d.ts +37 -0
- package/dist/core/references.d.ts.map +1 -0
- package/dist/core/template.d.ts +41 -0
- package/dist/core/template.d.ts.map +1 -0
- package/dist/core/testing/http-stub.d.ts +17 -0
- package/dist/core/testing/http-stub.d.ts.map +1 -0
- package/dist/core/tokens.d.ts +102 -0
- package/dist/core/tokens.d.ts.map +1 -0
- package/dist/coverage.d.ts +25 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/detect.d.ts +15 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/dialects.d.ts +20 -0
- package/dist/dialects.d.ts.map +1 -0
- package/dist/generated/clickhouse-types.d.ts +4380 -0
- package/dist/generated/clickhouse-types.d.ts.map +1 -0
- package/dist/generated/clickhouse.d.ts +11 -0
- package/dist/generated/clickhouse.d.ts.map +1 -0
- package/dist/generated/postgres-types.d.ts +1579 -0
- package/dist/generated/postgres-types.d.ts.map +1 -0
- package/dist/generated/postgres.d.ts +9 -0
- package/dist/generated/postgres.d.ts.map +1 -0
- package/dist/import-generator.d.ts +8 -0
- package/dist/import-generator.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/init-templates.d.ts +20 -0
- package/dist/init-templates.d.ts.map +1 -0
- package/dist/integrity.json +61 -0
- package/dist/lint/audit-catalog.d.ts +10 -0
- package/dist/lint/audit-catalog.d.ts.map +1 -0
- package/dist/lint/audit-lineage.d.ts +25 -0
- package/dist/lint/audit-lineage.d.ts.map +1 -0
- package/dist/lint/post-synth/audit-entries.d.ts +8 -0
- package/dist/lint/post-synth/audit-entries.d.ts.map +1 -0
- package/dist/lint/post-synth/clickhouse-helpers.d.ts +85 -0
- package/dist/lint/post-synth/clickhouse-helpers.d.ts.map +1 -0
- package/dist/lint/post-synth/index.d.ts +3 -0
- package/dist/lint/post-synth/index.d.ts.map +1 -0
- package/dist/lint/post-synth/postgres-audit-entries.d.ts +9 -0
- package/dist/lint/post-synth/postgres-audit-entries.d.ts.map +1 -0
- package/dist/lint/post-synth/postgres-helpers.d.ts +89 -0
- package/dist/lint/post-synth/postgres-helpers.d.ts.map +1 -0
- package/dist/lint/post-synth/sql-helpers.d.ts +27 -0
- package/dist/lint/post-synth/sql-helpers.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch101.d.ts +12 -0
- package/dist/lint/post-synth/sqlch101.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch102.d.ts +9 -0
- package/dist/lint/post-synth/sqlch102.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch103.d.ts +10 -0
- package/dist/lint/post-synth/sqlch103.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch104.d.ts +9 -0
- package/dist/lint/post-synth/sqlch104.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch105.d.ts +10 -0
- package/dist/lint/post-synth/sqlch105.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch106.d.ts +11 -0
- package/dist/lint/post-synth/sqlch106.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch107.d.ts +10 -0
- package/dist/lint/post-synth/sqlch107.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch108.d.ts +11 -0
- package/dist/lint/post-synth/sqlch108.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch109.d.ts +10 -0
- package/dist/lint/post-synth/sqlch109.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch110.d.ts +12 -0
- package/dist/lint/post-synth/sqlch110.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch111.d.ts +11 -0
- package/dist/lint/post-synth/sqlch111.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch112.d.ts +12 -0
- package/dist/lint/post-synth/sqlch112.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch113.d.ts +9 -0
- package/dist/lint/post-synth/sqlch113.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch114.d.ts +8 -0
- package/dist/lint/post-synth/sqlch114.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch115.d.ts +13 -0
- package/dist/lint/post-synth/sqlch115.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch116.d.ts +10 -0
- package/dist/lint/post-synth/sqlch116.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch117.d.ts +9 -0
- package/dist/lint/post-synth/sqlch117.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch118.d.ts +10 -0
- package/dist/lint/post-synth/sqlch118.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch119.d.ts +11 -0
- package/dist/lint/post-synth/sqlch119.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch120.d.ts +10 -0
- package/dist/lint/post-synth/sqlch120.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg101.d.ts +12 -0
- package/dist/lint/post-synth/sqlpg101.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg102.d.ts +11 -0
- package/dist/lint/post-synth/sqlpg102.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg103.d.ts +11 -0
- package/dist/lint/post-synth/sqlpg103.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg104.d.ts +10 -0
- package/dist/lint/post-synth/sqlpg104.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg105.d.ts +10 -0
- package/dist/lint/post-synth/sqlpg105.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg106.d.ts +9 -0
- package/dist/lint/post-synth/sqlpg106.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg107.d.ts +10 -0
- package/dist/lint/post-synth/sqlpg107.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg108.d.ts +11 -0
- package/dist/lint/post-synth/sqlpg108.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg109.d.ts +11 -0
- package/dist/lint/post-synth/sqlpg109.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg110.d.ts +12 -0
- package/dist/lint/post-synth/sqlpg110.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg111.d.ts +10 -0
- package/dist/lint/post-synth/sqlpg111.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg112.d.ts +10 -0
- package/dist/lint/post-synth/sqlpg112.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg113.d.ts +11 -0
- package/dist/lint/post-synth/sqlpg113.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg114.d.ts +13 -0
- package/dist/lint/post-synth/sqlpg114.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg115.d.ts +13 -0
- package/dist/lint/post-synth/sqlpg115.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg116.d.ts +11 -0
- package/dist/lint/post-synth/sqlpg116.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg117.d.ts +12 -0
- package/dist/lint/post-synth/sqlpg117.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlpg118.d.ts +12 -0
- package/dist/lint/post-synth/sqlpg118.d.ts.map +1 -0
- package/dist/lint/rules/index.d.ts +12 -0
- package/dist/lint/rules/index.d.ts.map +1 -0
- package/dist/lint/rules/postgres-templates.d.ts +18 -0
- package/dist/lint/rules/postgres-templates.d.ts.map +1 -0
- package/dist/lint/rules/sqlch001.d.ts +12 -0
- package/dist/lint/rules/sqlch001.d.ts.map +1 -0
- package/dist/lint/rules/sqlch002.d.ts +11 -0
- package/dist/lint/rules/sqlch002.d.ts.map +1 -0
- package/dist/lint/rules/sqlch003.d.ts +12 -0
- package/dist/lint/rules/sqlch003.d.ts.map +1 -0
- package/dist/lint/rules/sqlpg001.d.ts +16 -0
- package/dist/lint/rules/sqlpg001.d.ts.map +1 -0
- package/dist/lint/rules/sqlpg002.d.ts +12 -0
- package/dist/lint/rules/sqlpg002.d.ts.map +1 -0
- package/dist/lint/rules/sqlpg003.d.ts +16 -0
- package/dist/lint/rules/sqlpg003.d.ts.map +1 -0
- package/dist/lint/rules/sqlpg004.d.ts +21 -0
- package/dist/lint/rules/sqlpg004.d.ts.map +1 -0
- package/dist/lint/rules/templates.d.ts +23 -0
- package/dist/lint/rules/templates.d.ts.map +1 -0
- package/dist/live-dialect.d.ts +25 -0
- package/dist/live-dialect.d.ts.map +1 -0
- package/dist/lsp/catalog.d.ts +22 -0
- package/dist/lsp/catalog.d.ts.map +1 -0
- package/dist/lsp/completions.d.ts +13 -0
- package/dist/lsp/completions.d.ts.map +1 -0
- package/dist/lsp/hover.d.ts +12 -0
- package/dist/lsp/hover.d.ts.map +1 -0
- package/dist/lsp/postgres-catalog.d.ts +85 -0
- package/dist/lsp/postgres-catalog.d.ts.map +1 -0
- package/dist/lsp/postgres-template.d.ts +35 -0
- package/dist/lsp/postgres-template.d.ts.map +1 -0
- package/dist/lsp/postgres.d.ts +20 -0
- package/dist/lsp/postgres.d.ts.map +1 -0
- package/dist/lsp/refs.d.ts +8 -0
- package/dist/lsp/refs.d.ts.map +1 -0
- package/dist/lsp/registry.d.ts +4 -0
- package/dist/lsp/registry.d.ts.map +1 -0
- package/dist/lsp/template.d.ts +34 -0
- package/dist/lsp/template.d.ts.map +1 -0
- package/dist/manifest.json +8 -0
- package/dist/mcp/index.d.ts +13 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/postgres.d.ts +32 -0
- package/dist/mcp/postgres.d.ts.map +1 -0
- package/dist/meta.json +67 -0
- package/dist/okf/index.md +67 -0
- package/dist/okf/rules/SQLCH001.md +11 -0
- package/dist/okf/rules/SQLCH002.md +11 -0
- package/dist/okf/rules/SQLCH003.md +11 -0
- package/dist/okf/rules/SQLCH101.md +15 -0
- package/dist/okf/rules/SQLCH102.md +11 -0
- package/dist/okf/rules/SQLCH103.md +11 -0
- package/dist/okf/rules/SQLCH104.md +11 -0
- package/dist/okf/rules/SQLCH105.md +11 -0
- package/dist/okf/rules/SQLCH106.md +11 -0
- package/dist/okf/rules/SQLCH107.md +11 -0
- package/dist/okf/rules/SQLCH108.md +15 -0
- package/dist/okf/rules/SQLCH109.md +11 -0
- package/dist/okf/rules/SQLCH110.md +11 -0
- package/dist/okf/rules/SQLCH111.md +11 -0
- package/dist/okf/rules/SQLCH112.md +11 -0
- package/dist/okf/rules/SQLCH113.md +11 -0
- package/dist/okf/rules/SQLCH114.md +11 -0
- package/dist/okf/rules/SQLCH115.md +11 -0
- package/dist/okf/rules/SQLCH116.md +11 -0
- package/dist/okf/rules/SQLCH117.md +15 -0
- package/dist/okf/rules/SQLCH118.md +15 -0
- package/dist/okf/rules/SQLCH119.md +15 -0
- package/dist/okf/rules/SQLCH120.md +15 -0
- package/dist/okf/rules/SQLPG001.md +11 -0
- package/dist/okf/rules/SQLPG002.md +11 -0
- package/dist/okf/rules/SQLPG003.md +11 -0
- package/dist/okf/rules/SQLPG004.md +11 -0
- package/dist/okf/rules/SQLPG101.md +11 -0
- package/dist/okf/rules/SQLPG102.md +11 -0
- package/dist/okf/rules/SQLPG103.md +11 -0
- package/dist/okf/rules/SQLPG104.md +11 -0
- package/dist/okf/rules/SQLPG105.md +11 -0
- package/dist/okf/rules/SQLPG106.md +11 -0
- package/dist/okf/rules/SQLPG107.md +11 -0
- package/dist/okf/rules/SQLPG108.md +11 -0
- package/dist/okf/rules/SQLPG109.md +11 -0
- package/dist/okf/rules/SQLPG110.md +11 -0
- package/dist/okf/rules/SQLPG111.md +11 -0
- package/dist/okf/rules/SQLPG112.md +11 -0
- package/dist/okf/rules/SQLPG113.md +24 -0
- package/dist/okf/rules/SQLPG114.md +11 -0
- package/dist/okf/rules/SQLPG115.md +11 -0
- package/dist/okf/rules/SQLPG116.md +15 -0
- package/dist/okf/rules/SQLPG117.md +11 -0
- package/dist/okf/rules/SQLPG118.md +11 -0
- package/dist/okf/types/Database.md +15 -0
- package/dist/okf/types/MaterializedView.md +14 -0
- package/dist/okf/types/PostgresDomain.md +13 -0
- package/dist/okf/types/PostgresEnum.md +13 -0
- package/dist/okf/types/PostgresExtension.md +13 -0
- package/dist/okf/types/PostgresIndex.md +9 -0
- package/dist/okf/types/PostgresMaterializedView.md +13 -0
- package/dist/okf/types/PostgresSchema.md +13 -0
- package/dist/okf/types/PostgresSequence.md +13 -0
- package/dist/okf/types/PostgresTable.md +13 -0
- package/dist/okf/types/PostgresView.md +13 -0
- package/dist/okf/types/Table.md +15 -0
- package/dist/okf/types/View.md +13 -0
- package/dist/op/activities/clickhouse-apply.d.ts +56 -0
- package/dist/op/activities/clickhouse-apply.d.ts.map +1 -0
- package/dist/op/activities/clickhouse-emulator.d.ts +26 -0
- package/dist/op/activities/clickhouse-emulator.d.ts.map +1 -0
- package/dist/op/activities/clickhouse-rebuild.d.ts +43 -0
- package/dist/op/activities/clickhouse-rebuild.d.ts.map +1 -0
- package/dist/op/activities/index.d.ts +19 -0
- package/dist/op/activities/index.d.ts.map +1 -0
- package/dist/op/activities/postgres-apply.d.ts +69 -0
- package/dist/op/activities/postgres-apply.d.ts.map +1 -0
- package/dist/op/activities/postgres-emulator.d.ts +33 -0
- package/dist/op/activities/postgres-emulator.d.ts.map +1 -0
- package/dist/op/activities/postgres-migration.d.ts +48 -0
- package/dist/op/activities/postgres-migration.d.ts.map +1 -0
- package/dist/op/activity-contracts.d.ts +464 -0
- package/dist/op/activity-contracts.d.ts.map +1 -0
- package/dist/package-cli.d.ts +3 -0
- package/dist/package-cli.d.ts.map +1 -0
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/postgres/apply/apply.d.ts +163 -0
- package/dist/postgres/apply/apply.d.ts.map +1 -0
- package/dist/postgres/apply/statements.d.ts +138 -0
- package/dist/postgres/apply/statements.d.ts.map +1 -0
- package/dist/postgres/catalog-types.d.ts +50 -0
- package/dist/postgres/catalog-types.d.ts.map +1 -0
- package/dist/postgres/container.d.ts +23 -0
- package/dist/postgres/container.d.ts.map +1 -0
- package/dist/postgres/entities.d.ts +322 -0
- package/dist/postgres/entities.d.ts.map +1 -0
- package/dist/postgres/entity-types.d.ts +17 -0
- package/dist/postgres/entity-types.d.ts.map +1 -0
- package/dist/postgres/import/generator.d.ts +28 -0
- package/dist/postgres/import/generator.d.ts.map +1 -0
- package/dist/postgres/import/ir.d.ts +24 -0
- package/dist/postgres/import/ir.d.ts.map +1 -0
- package/dist/postgres/import/live-export.d.ts +26 -0
- package/dist/postgres/import/live-export.d.ts.map +1 -0
- package/dist/postgres/keywords.d.ts +22 -0
- package/dist/postgres/keywords.d.ts.map +1 -0
- package/dist/postgres/live/bind.d.ts +76 -0
- package/dist/postgres/live/bind.d.ts.map +1 -0
- package/dist/postgres/live/catalog.d.ts +98 -0
- package/dist/postgres/live/catalog.d.ts.map +1 -0
- package/dist/postgres/live/client.d.ts +32 -0
- package/dist/postgres/live/client.d.ts.map +1 -0
- package/dist/postgres/live/describe-resources.d.ts +41 -0
- package/dist/postgres/live/describe-resources.d.ts.map +1 -0
- package/dist/postgres/migrate/backfill.d.ts +103 -0
- package/dist/postgres/migrate/backfill.d.ts.map +1 -0
- package/dist/postgres/migrate/batches.d.ts +90 -0
- package/dist/postgres/migrate/batches.d.ts.map +1 -0
- package/dist/postgres/migrate/carry.d.ts +196 -0
- package/dist/postgres/migrate/carry.d.ts.map +1 -0
- package/dist/postgres/migrate/handoff.d.ts +46 -0
- package/dist/postgres/migrate/handoff.d.ts.map +1 -0
- package/dist/postgres/migrate/names.d.ts +55 -0
- package/dist/postgres/migrate/names.d.ts.map +1 -0
- package/dist/postgres/migrate/observe.d.ts +139 -0
- package/dist/postgres/migrate/observe.d.ts.map +1 -0
- package/dist/postgres/migrate/op.d.ts +128 -0
- package/dist/postgres/migrate/op.d.ts.map +1 -0
- package/dist/postgres/migrate/receipts.d.ts +63 -0
- package/dist/postgres/migrate/receipts.d.ts.map +1 -0
- package/dist/postgres/migrate/replication.d.ts +80 -0
- package/dist/postgres/migrate/replication.d.ts.map +1 -0
- package/dist/postgres/migrate/steps.d.ts +225 -0
- package/dist/postgres/migrate/steps.d.ts.map +1 -0
- package/dist/postgres/overlays/columns.d.ts +6 -0
- package/dist/postgres/overlays/columns.d.ts.map +1 -0
- package/dist/postgres/overlays/constraints.d.ts +8 -0
- package/dist/postgres/overlays/constraints.d.ts.map +1 -0
- package/dist/postgres/overlays/indexes.d.ts +8 -0
- package/dist/postgres/overlays/indexes.d.ts.map +1 -0
- package/dist/postgres/overlays/kinds.d.ts +48 -0
- package/dist/postgres/overlays/kinds.d.ts.map +1 -0
- package/dist/postgres/overlays/partitioning.d.ts +5 -0
- package/dist/postgres/overlays/partitioning.d.ts.map +1 -0
- package/dist/postgres/overlays/relations.d.ts +6 -0
- package/dist/postgres/overlays/relations.d.ts.map +1 -0
- package/dist/postgres/overlays/storage.d.ts +28 -0
- package/dist/postgres/overlays/storage.d.ts.map +1 -0
- package/dist/postgres/overlays/type-ddl.d.ts +7 -0
- package/dist/postgres/overlays/type-ddl.d.ts.map +1 -0
- package/dist/postgres/overlays/types.d.ts +24 -0
- package/dist/postgres/overlays/types.d.ts.map +1 -0
- package/dist/postgres/parser.d.ts +216 -0
- package/dist/postgres/parser.d.ts.map +1 -0
- package/dist/postgres/plan/commands.d.ts +61 -0
- package/dist/postgres/plan/commands.d.ts.map +1 -0
- package/dist/postgres/plan/deep.d.ts +33 -0
- package/dist/postgres/plan/deep.d.ts.map +1 -0
- package/dist/postgres/plan/diff.d.ts +45 -0
- package/dist/postgres/plan/diff.d.ts.map +1 -0
- package/dist/postgres/plan/disruption.d.ts +14 -0
- package/dist/postgres/plan/disruption.d.ts.map +1 -0
- package/dist/postgres/plan/normalize.d.ts +108 -0
- package/dist/postgres/plan/normalize.d.ts.map +1 -0
- package/dist/postgres/plan/report.d.ts +6 -0
- package/dist/postgres/plan/report.d.ts.map +1 -0
- package/dist/postgres/plan/rules.d.ts +84 -0
- package/dist/postgres/plan/rules.d.ts.map +1 -0
- package/dist/postgres/plan/schema.d.ts +50 -0
- package/dist/postgres/plan/schema.d.ts.map +1 -0
- package/dist/postgres/plan/server-normalize.d.ts +26 -0
- package/dist/postgres/plan/server-normalize.d.ts.map +1 -0
- package/dist/postgres/providers/aurora.d.ts +12 -0
- package/dist/postgres/providers/aurora.d.ts.map +1 -0
- package/dist/postgres/providers/azure.d.ts +14 -0
- package/dist/postgres/providers/azure.d.ts.map +1 -0
- package/dist/postgres/providers/cloud-sql.d.ts +11 -0
- package/dist/postgres/providers/cloud-sql.d.ts.map +1 -0
- package/dist/postgres/providers/index.d.ts +35 -0
- package/dist/postgres/providers/index.d.ts.map +1 -0
- package/dist/postgres/providers/neon.d.ts +13 -0
- package/dist/postgres/providers/neon.d.ts.map +1 -0
- package/dist/postgres/providers/rds.d.ts +10 -0
- package/dist/postgres/providers/rds.d.ts.map +1 -0
- package/dist/postgres/providers/supabase.d.ts +12 -0
- package/dist/postgres/providers/supabase.d.ts.map +1 -0
- package/dist/postgres/providers/types.d.ts +59 -0
- package/dist/postgres/providers/types.d.ts.map +1 -0
- package/dist/postgres/testing/fake-client.d.ts +38 -0
- package/dist/postgres/testing/fake-client.d.ts.map +1 -0
- package/dist/postgres/testing/migration.d.ts +25 -0
- package/dist/postgres/testing/migration.d.ts.map +1 -0
- package/dist/postgres/testing/roundtrip-schema.d.ts +11 -0
- package/dist/postgres/testing/roundtrip-schema.d.ts.map +1 -0
- package/dist/postgres/testing/server.d.ts +17 -0
- package/dist/postgres/testing/server.d.ts.map +1 -0
- package/dist/postgres/testing/writable-server.d.ts +45 -0
- package/dist/postgres/testing/writable-server.d.ts.map +1 -0
- package/dist/postgres/tokens.d.ts +26 -0
- package/dist/postgres/tokens.d.ts.map +1 -0
- package/dist/postgres.d.ts +13 -0
- package/dist/postgres.d.ts.map +1 -0
- package/dist/rules/audit-entries.ts +29 -0
- package/dist/rules/clickhouse-helpers.ts +206 -0
- package/dist/rules/postgres-audit-entries.ts +29 -0
- package/dist/rules/postgres-helpers.ts +126 -0
- package/dist/rules/postgres-templates.ts +36 -0
- package/dist/rules/sql-helpers.ts +53 -0
- package/dist/rules/sqlch001.ts +53 -0
- package/dist/rules/sqlch002.ts +115 -0
- package/dist/rules/sqlch003.ts +68 -0
- package/dist/rules/sqlch101.ts +35 -0
- package/dist/rules/sqlch102.ts +23 -0
- package/dist/rules/sqlch103.ts +45 -0
- package/dist/rules/sqlch104.ts +42 -0
- package/dist/rules/sqlch105.ts +35 -0
- package/dist/rules/sqlch106.ts +27 -0
- package/dist/rules/sqlch107.ts +35 -0
- package/dist/rules/sqlch108.ts +27 -0
- package/dist/rules/sqlch109.ts +21 -0
- package/dist/rules/sqlch110.ts +29 -0
- package/dist/rules/sqlch111.ts +40 -0
- package/dist/rules/sqlch112.ts +30 -0
- package/dist/rules/sqlch113.ts +20 -0
- package/dist/rules/sqlch114.ts +26 -0
- package/dist/rules/sqlch115.ts +31 -0
- package/dist/rules/sqlch116.ts +22 -0
- package/dist/rules/sqlch117.ts +25 -0
- package/dist/rules/sqlch118.ts +26 -0
- package/dist/rules/sqlch119.ts +31 -0
- package/dist/rules/sqlch120.ts +21 -0
- package/dist/rules/sqlpg001.ts +88 -0
- package/dist/rules/sqlpg002.ts +68 -0
- package/dist/rules/sqlpg003.ts +59 -0
- package/dist/rules/sqlpg004.ts +73 -0
- package/dist/rules/sqlpg101.ts +24 -0
- package/dist/rules/sqlpg102.ts +30 -0
- package/dist/rules/sqlpg103.ts +23 -0
- package/dist/rules/sqlpg104.ts +23 -0
- package/dist/rules/sqlpg105.ts +22 -0
- package/dist/rules/sqlpg106.ts +22 -0
- package/dist/rules/sqlpg107.ts +22 -0
- package/dist/rules/sqlpg108.ts +27 -0
- package/dist/rules/sqlpg109.ts +37 -0
- package/dist/rules/sqlpg110.ts +33 -0
- package/dist/rules/sqlpg111.ts +23 -0
- package/dist/rules/sqlpg112.ts +25 -0
- package/dist/rules/sqlpg113.ts +28 -0
- package/dist/rules/sqlpg114.ts +37 -0
- package/dist/rules/sqlpg115.ts +38 -0
- package/dist/rules/sqlpg116.ts +25 -0
- package/dist/rules/sqlpg117.ts +24 -0
- package/dist/rules/sqlpg118.ts +22 -0
- package/dist/rules/templates.ts +35 -0
- package/dist/serializer.d.ts +37 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/skill-defs.d.ts +3 -0
- package/dist/skill-defs.d.ts.map +1 -0
- package/dist/spec/catalog.d.ts +125 -0
- package/dist/spec/catalog.d.ts.map +1 -0
- package/dist/spec/fetch.d.ts +43 -0
- package/dist/spec/fetch.d.ts.map +1 -0
- package/dist/spec/pin.d.ts +39 -0
- package/dist/spec/pin.d.ts.map +1 -0
- package/dist/spec/postgres-catalog.d.ts +108 -0
- package/dist/spec/postgres-catalog.d.ts.map +1 -0
- package/dist/spec/postgres-fetch.d.ts +46 -0
- package/dist/spec/postgres-fetch.d.ts.map +1 -0
- package/dist/spec/postgres-pin.d.ts +67 -0
- package/dist/spec/postgres-pin.d.ts.map +1 -0
- package/dist/types/index.d.ts +4386 -0
- package/dist/validate-cli.d.ts +3 -0
- package/dist/validate-cli.d.ts.map +1 -0
- package/dist/validate.d.ts +15 -0
- package/dist/validate.d.ts.map +1 -0
- package/package.json +74 -4
- package/src/clickhouse/apply/apply.ts +288 -0
- package/src/clickhouse/apply/mutations.ts +90 -0
- package/src/clickhouse/apply/statements.ts +393 -0
- package/src/clickhouse/catalog-types.ts +84 -0
- package/src/clickhouse/container.ts +176 -0
- package/src/clickhouse/engine-syntax.test.ts +53 -0
- package/src/clickhouse/engine-syntax.ts +173 -0
- package/src/clickhouse/entities.test.ts +188 -0
- package/src/clickhouse/entities.ts +425 -0
- package/src/clickhouse/http.ts +76 -0
- package/src/clickhouse/import/generator.ts +153 -0
- package/src/clickhouse/import/import.test.ts +157 -0
- package/src/clickhouse/import/ir.ts +171 -0
- package/src/clickhouse/import/live-export.ts +53 -0
- package/src/clickhouse/import/parser.ts +27 -0
- package/src/clickhouse/import/roundtrip.test.ts +90 -0
- package/src/clickhouse/live/bind.ts +126 -0
- package/src/clickhouse/live/catalog.ts +96 -0
- package/src/clickhouse/live/describe-resources.ts +98 -0
- package/src/clickhouse/live/live.test.ts +143 -0
- package/src/clickhouse/live/roundtrip.e2e.test.ts +93 -0
- package/src/clickhouse/overlays/codecs.ts +68 -0
- package/src/clickhouse/overlays/engines.ts +108 -0
- package/src/clickhouse/overlays/kinds.ts +38 -0
- package/src/clickhouse/overlays/projections.ts +36 -0
- package/src/clickhouse/overlays/skip-indexes.ts +44 -0
- package/src/clickhouse/overlays/ttl.ts +55 -0
- package/src/clickhouse/overlays/types.ts +58 -0
- package/src/clickhouse/ownership.test.ts +20 -0
- package/src/clickhouse/ownership.ts +103 -0
- package/src/clickhouse/parser.test.ts +166 -0
- package/src/clickhouse/parser.ts +459 -0
- package/src/clickhouse/plan/commands.ts +101 -0
- package/src/clickhouse/plan/deep.ts +124 -0
- package/src/clickhouse/plan/diff.ts +203 -0
- package/src/clickhouse/plan/disruption.ts +61 -0
- package/src/clickhouse/plan/normalize.ts +352 -0
- package/src/clickhouse/plan/plan-wiring.test.ts +77 -0
- package/src/clickhouse/plan/plan.e2e.test.ts +77 -0
- package/src/clickhouse/plan/plan.test.ts +201 -0
- package/src/clickhouse/plan/rebuild-handoff.ts +59 -0
- package/src/clickhouse/plan/report.ts +19 -0
- package/src/clickhouse/plan/rules.ts +241 -0
- package/src/clickhouse/plan/schema.ts +56 -0
- package/src/clickhouse/plan/server-format.ts +39 -0
- package/src/clickhouse/rebuild/backfill.ts +186 -0
- package/src/clickhouse/rebuild/observe.ts +380 -0
- package/src/clickhouse/rebuild/op.ts +206 -0
- package/src/clickhouse/rebuild/partitions.ts +62 -0
- package/src/clickhouse/rebuild/rebuild-replicated.e2e.test.ts +513 -0
- package/src/clickhouse/rebuild/rebuild.e2e.test.ts +351 -0
- package/src/clickhouse/rebuild/rebuild.test.ts +190 -0
- package/src/clickhouse/rebuild/receipts.ts +143 -0
- package/src/clickhouse/rebuild/replicas.test.ts +70 -0
- package/src/clickhouse/rebuild/replicas.ts +148 -0
- package/src/clickhouse/rebuild/steps.ts +382 -0
- package/src/clickhouse/rebuild/verify.ts +124 -0
- package/src/clickhouse/testdata/NOTICE +5 -0
- package/src/clickhouse/testdata/clickhouse-tests-corpus.json +302 -0
- package/src/clickhouse/testing/fake-server.ts +65 -0
- package/src/clickhouse/testing/roundtrip-schema.ts +25 -0
- package/src/clickhouse/testing/writable-server.ts +141 -0
- package/src/clickhouse/tokens.ts +28 -0
- package/src/clickhouse.ts +63 -0
- package/src/codegen/classifier-page.test.ts +16 -0
- package/src/codegen/classifier-page.ts +76 -0
- package/src/codegen/clickhouse-module.test.ts +63 -0
- package/src/codegen/clickhouse-module.ts +269 -0
- package/src/codegen/docs-cli.ts +4 -0
- package/src/codegen/docs.ts +225 -0
- package/src/codegen/generate-cli.ts +13 -0
- package/src/codegen/generate.ts +126 -0
- package/src/codegen/package.ts +36 -0
- package/src/codegen/postgres-classifier-page.ts +81 -0
- package/src/codegen/postgres-module.test.ts +77 -0
- package/src/codegen/postgres-module.ts +434 -0
- package/src/codegen/registry.ts +36 -0
- package/src/composites/audit-log-table.ts +54 -0
- package/src/composites/catalog.test.ts +61 -0
- package/src/composites/catalog.ts +529 -0
- package/src/composites/cdc-mirror.ts +54 -0
- package/src/composites/clickhouse.ts +7 -0
- package/src/composites/composites.test.ts +758 -0
- package/src/composites/events-table.ts +49 -0
- package/src/composites/index.ts +9 -0
- package/src/composites/join-table.ts +57 -0
- package/src/composites/postgres.ts +7 -0
- package/src/composites/refreshed-view.ts +46 -0
- package/src/composites/replacing-table.ts +49 -0
- package/src/composites/rollup-view.ts +55 -0
- package/src/composites/sharded-table.ts +49 -0
- package/src/composites/soft-delete-table.ts +61 -0
- package/src/composites/tenant-table.ts +50 -0
- package/src/config.ts +157 -0
- package/src/core/apply.ts +153 -0
- package/src/core/classifier.ts +186 -0
- package/src/core/container.ts +93 -0
- package/src/core/core.test.ts +254 -0
- package/src/core/cursor.ts +189 -0
- package/src/core/diff.ts +72 -0
- package/src/core/entity.ts +85 -0
- package/src/core/find-templates.ts +158 -0
- package/src/core/handoff.ts +44 -0
- package/src/core/index.ts +61 -0
- package/src/core/interpolation.ts +225 -0
- package/src/core/normalize.ts +39 -0
- package/src/core/ownership.test.ts +36 -0
- package/src/core/ownership.ts +133 -0
- package/src/core/receipts.ts +29 -0
- package/src/core/references.ts +74 -0
- package/src/core/template.ts +83 -0
- package/src/core/testing/http-stub.ts +33 -0
- package/src/core/tokens.ts +252 -0
- package/src/coverage.ts +64 -0
- package/src/detect.ts +32 -0
- package/src/dialects.ts +21 -0
- package/src/generated/clickhouse-types.ts +4386 -0
- package/src/generated/clickhouse.ts +2476 -0
- package/src/generated/index.d.ts +4386 -0
- package/src/generated/lexicon-sql.json +67 -0
- package/src/generated/postgres-types.ts +1190 -0
- package/src/generated/postgres.ts +1039 -0
- package/src/import-generator.ts +18 -0
- package/src/index.ts +21 -0
- package/src/init-templates.test.ts +108 -0
- package/src/init-templates.ts +327 -0
- package/src/lint/audit-catalog.ts +73 -0
- package/src/lint/audit-lineage.ts +47 -0
- package/src/lint/post-synth/audit-entries.ts +29 -0
- package/src/lint/post-synth/clickhouse-checks.test.ts +278 -0
- package/src/lint/post-synth/clickhouse-helpers.ts +206 -0
- package/src/lint/post-synth/index.ts +81 -0
- package/src/lint/post-synth/post-synth.test.ts +33 -0
- package/src/lint/post-synth/postgres-audit-entries.ts +29 -0
- package/src/lint/post-synth/postgres-checks.test.ts +257 -0
- package/src/lint/post-synth/postgres-helpers.ts +126 -0
- package/src/lint/post-synth/sql-helpers.ts +53 -0
- package/src/lint/post-synth/sqlch101.ts +35 -0
- package/src/lint/post-synth/sqlch102.ts +23 -0
- package/src/lint/post-synth/sqlch103.ts +45 -0
- package/src/lint/post-synth/sqlch104.ts +42 -0
- package/src/lint/post-synth/sqlch105.ts +35 -0
- package/src/lint/post-synth/sqlch106.ts +27 -0
- package/src/lint/post-synth/sqlch107.ts +35 -0
- package/src/lint/post-synth/sqlch108.ts +27 -0
- package/src/lint/post-synth/sqlch109.ts +21 -0
- package/src/lint/post-synth/sqlch110.ts +29 -0
- package/src/lint/post-synth/sqlch111.ts +40 -0
- package/src/lint/post-synth/sqlch112.ts +30 -0
- package/src/lint/post-synth/sqlch113.ts +20 -0
- package/src/lint/post-synth/sqlch114.ts +26 -0
- package/src/lint/post-synth/sqlch115.ts +31 -0
- package/src/lint/post-synth/sqlch116.ts +22 -0
- package/src/lint/post-synth/sqlch117.ts +25 -0
- package/src/lint/post-synth/sqlch118.ts +26 -0
- package/src/lint/post-synth/sqlch119.ts +31 -0
- package/src/lint/post-synth/sqlch120.ts +21 -0
- package/src/lint/post-synth/sqlpg101.ts +24 -0
- package/src/lint/post-synth/sqlpg102.ts +30 -0
- package/src/lint/post-synth/sqlpg103.ts +23 -0
- package/src/lint/post-synth/sqlpg104.ts +23 -0
- package/src/lint/post-synth/sqlpg105.ts +22 -0
- package/src/lint/post-synth/sqlpg106.ts +22 -0
- package/src/lint/post-synth/sqlpg107.ts +22 -0
- package/src/lint/post-synth/sqlpg108.ts +27 -0
- package/src/lint/post-synth/sqlpg109.ts +37 -0
- package/src/lint/post-synth/sqlpg110.ts +33 -0
- package/src/lint/post-synth/sqlpg111.ts +23 -0
- package/src/lint/post-synth/sqlpg112.ts +25 -0
- package/src/lint/post-synth/sqlpg113.ts +28 -0
- package/src/lint/post-synth/sqlpg114.ts +37 -0
- package/src/lint/post-synth/sqlpg115.ts +38 -0
- package/src/lint/post-synth/sqlpg116.ts +25 -0
- package/src/lint/post-synth/sqlpg117.ts +24 -0
- package/src/lint/post-synth/sqlpg118.ts +22 -0
- package/src/lint/rules/index.ts +13 -0
- package/src/lint/rules/postgres-templates.ts +36 -0
- package/src/lint/rules/rules.test.ts +228 -0
- package/src/lint/rules/sqlch001.ts +53 -0
- package/src/lint/rules/sqlch002.ts +115 -0
- package/src/lint/rules/sqlch003.ts +68 -0
- package/src/lint/rules/sqlpg001.ts +88 -0
- package/src/lint/rules/sqlpg002.ts +68 -0
- package/src/lint/rules/sqlpg003.ts +59 -0
- package/src/lint/rules/sqlpg004.ts +73 -0
- package/src/lint/rules/templates.ts +35 -0
- package/src/live-dialect.ts +37 -0
- package/src/lsp/catalog.ts +60 -0
- package/src/lsp/completions.test.ts +111 -0
- package/src/lsp/completions.ts +128 -0
- package/src/lsp/diagnostics.test.ts +26 -0
- package/src/lsp/hover.test.ts +90 -0
- package/src/lsp/hover.ts +113 -0
- package/src/lsp/postgres-catalog.ts +234 -0
- package/src/lsp/postgres-template.ts +161 -0
- package/src/lsp/postgres.test.ts +150 -0
- package/src/lsp/postgres.ts +270 -0
- package/src/lsp/refs.ts +53 -0
- package/src/lsp/registry.ts +19 -0
- package/src/lsp/template.ts +166 -0
- package/src/mcp/index.ts +304 -0
- package/src/mcp/mcp.test.ts +184 -0
- package/src/mcp/postgres.ts +125 -0
- package/src/op/activities/clickhouse-apply.e2e.test.ts +150 -0
- package/src/op/activities/clickhouse-apply.test.ts +265 -0
- package/src/op/activities/clickhouse-apply.ts +113 -0
- package/src/op/activities/clickhouse-emulator.test.ts +23 -0
- package/src/op/activities/clickhouse-emulator.ts +37 -0
- package/src/op/activities/clickhouse-rebuild.ts +136 -0
- package/src/op/activities/index.ts +50 -0
- package/src/op/activities/postgres-apply.e2e.test.ts +184 -0
- package/src/op/activities/postgres-apply.test.ts +304 -0
- package/src/op/activities/postgres-apply.ts +170 -0
- package/src/op/activities/postgres-emulator.test.ts +26 -0
- package/src/op/activities/postgres-emulator.ts +44 -0
- package/src/op/activities/postgres-migration.ts +182 -0
- package/src/op/activity-contracts.ts +210 -0
- package/src/package-cli.ts +17 -0
- package/src/plugin.test.ts +74 -0
- package/src/plugin.ts +242 -0
- package/src/postgres/apply/apply.ts +582 -0
- package/src/postgres/apply/statements.test.ts +155 -0
- package/src/postgres/apply/statements.ts +603 -0
- package/src/postgres/catalog-types.ts +59 -0
- package/src/postgres/container.ts +72 -0
- package/src/postgres/entities.test.ts +170 -0
- package/src/postgres/entities.ts +1016 -0
- package/src/postgres/entity-types.ts +18 -0
- package/src/postgres/import/generator.ts +176 -0
- package/src/postgres/import/import.test.ts +71 -0
- package/src/postgres/import/ir.ts +67 -0
- package/src/postgres/import/live-export.ts +53 -0
- package/src/postgres/import/live-warnings.test.ts +45 -0
- package/src/postgres/keywords.ts +40 -0
- package/src/postgres/live/bind.ts +146 -0
- package/src/postgres/live/catalog.ts +581 -0
- package/src/postgres/live/client.ts +84 -0
- package/src/postgres/live/describe-resources.ts +111 -0
- package/src/postgres/live/live.test.ts +198 -0
- package/src/postgres/live/roundtrip.e2e.test.ts +111 -0
- package/src/postgres/migrate/backfill.ts +233 -0
- package/src/postgres/migrate/batches.e2e.test.ts +163 -0
- package/src/postgres/migrate/batches.test.ts +36 -0
- package/src/postgres/migrate/batches.ts +159 -0
- package/src/postgres/migrate/carry.e2e.test.ts +335 -0
- package/src/postgres/migrate/carry.test.ts +103 -0
- package/src/postgres/migrate/carry.ts +653 -0
- package/src/postgres/migrate/handoff.ts +73 -0
- package/src/postgres/migrate/kinds.e2e.test.ts +204 -0
- package/src/postgres/migrate/migrate.e2e.test.ts +362 -0
- package/src/postgres/migrate/migrate.test.ts +322 -0
- package/src/postgres/migrate/names.ts +93 -0
- package/src/postgres/migrate/observe.ts +521 -0
- package/src/postgres/migrate/op.ts +242 -0
- package/src/postgres/migrate/receipts.ts +135 -0
- package/src/postgres/migrate/replication.ts +151 -0
- package/src/postgres/migrate/steps.ts +657 -0
- package/src/postgres/overlays/columns.ts +34 -0
- package/src/postgres/overlays/constraints.ts +56 -0
- package/src/postgres/overlays/indexes.ts +27 -0
- package/src/postgres/overlays/kinds.ts +53 -0
- package/src/postgres/overlays/partitioning.ts +26 -0
- package/src/postgres/overlays/relations.ts +29 -0
- package/src/postgres/overlays/storage.ts +75 -0
- package/src/postgres/overlays/type-ddl.ts +38 -0
- package/src/postgres/overlays/types.ts +56 -0
- package/src/postgres/parser.test.ts +214 -0
- package/src/postgres/parser.ts +1062 -0
- package/src/postgres/plan/commands.ts +124 -0
- package/src/postgres/plan/deep.ts +177 -0
- package/src/postgres/plan/diff.ts +323 -0
- package/src/postgres/plan/disruption.ts +52 -0
- package/src/postgres/plan/normalize.test.ts +148 -0
- package/src/postgres/plan/normalize.ts +542 -0
- package/src/postgres/plan/plan.e2e.test.ts +117 -0
- package/src/postgres/plan/plan.test.ts +244 -0
- package/src/postgres/plan/report.ts +24 -0
- package/src/postgres/plan/rules.ts +276 -0
- package/src/postgres/plan/schema.ts +114 -0
- package/src/postgres/plan/server-normalize.ts +123 -0
- package/src/postgres/providers/aurora.ts +45 -0
- package/src/postgres/providers/azure.ts +54 -0
- package/src/postgres/providers/cloud-sql.ts +42 -0
- package/src/postgres/providers/index.ts +90 -0
- package/src/postgres/providers/neon.ts +45 -0
- package/src/postgres/providers/providers.test.ts +136 -0
- package/src/postgres/providers/rds.ts +48 -0
- package/src/postgres/providers/supabase.ts +46 -0
- package/src/postgres/providers/types.ts +70 -0
- package/src/postgres/testdata/NOTICE +31 -0
- package/src/postgres/testdata/postgres-regress-corpus.json +460 -0
- package/src/postgres/testing/fake-client.ts +42 -0
- package/src/postgres/testing/migration.ts +52 -0
- package/src/postgres/testing/roundtrip-schema.ts +46 -0
- package/src/postgres/testing/server.ts +58 -0
- package/src/postgres/testing/writable-server.ts +188 -0
- package/src/postgres/tokens.ts +46 -0
- package/src/postgres.ts +75 -0
- package/src/serializer.test.ts +128 -0
- package/src/serializer.ts +148 -0
- package/src/skill-defs.test.ts +81 -0
- package/src/skill-defs.ts +102 -0
- package/src/skills/chant-sql-plan.md +123 -0
- package/src/skills/chant-sql-postgres-migration.md +126 -0
- package/src/skills/chant-sql-postgres-plan.md +194 -0
- package/src/skills/chant-sql-postgres.md +165 -0
- package/src/skills/chant-sql-rebuild.md +68 -0
- package/src/skills/chant-sql.md +123 -0
- package/src/spec/catalog.e2e.test.ts +29 -0
- package/src/spec/catalog.test.ts +56 -0
- package/src/spec/catalog.ts +311 -0
- package/src/spec/clickhouse-catalog.snapshot.json +5246 -0
- package/src/spec/fetch.test.ts +77 -0
- package/src/spec/fetch.ts +112 -0
- package/src/spec/pin.ts +47 -0
- package/src/spec/postgres-catalog-14.snapshot.json +3494 -0
- package/src/spec/postgres-catalog-15.snapshot.json +3529 -0
- package/src/spec/postgres-catalog-16.snapshot.json +3597 -0
- package/src/spec/postgres-catalog-17.snapshot.json +3656 -0
- package/src/spec/postgres-catalog-18.snapshot.json +3747 -0
- package/src/spec/postgres-catalog.test.ts +43 -0
- package/src/spec/postgres-catalog.ts +301 -0
- package/src/spec/postgres-fetch.test.ts +75 -0
- package/src/spec/postgres-fetch.ts +112 -0
- package/src/spec/postgres-pin.test.ts +64 -0
- package/src/spec/postgres-pin.ts +101 -0
- package/src/typecheck.test.ts +104 -0
- package/src/validate-cli.ts +6 -0
- package/src/validate.ts +149 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The statements that make one classified Postgres change (#3280): the
|
|
3
|
+
* declared `CREATE` with chant's marker set by `COMMENT ON`, the `ALTER` for
|
|
4
|
+
* each change the classifier (`../plan/rules.ts`) does not refuse, and the
|
|
5
|
+
* `DROP` a prune issues.
|
|
6
|
+
*
|
|
7
|
+
* Each function takes a declared object, what the server holds for it, and
|
|
8
|
+
* the changes the diff reported, and returns statements; nothing is sent. The
|
|
9
|
+
* applier (`./apply.ts`) groups them into transactions and sends them, and
|
|
10
|
+
* the expand-and-contract migration Op (#3281) builds its expand and contract
|
|
11
|
+
* steps from the same pieces.
|
|
12
|
+
*
|
|
13
|
+
* The SQL is the declaration's own text wherever there is some: a column's
|
|
14
|
+
* type and default, a constraint's expression, an index's `CREATE`, a view's
|
|
15
|
+
* `CREATE`. The canonical forms the diff compared are for comparing; what the
|
|
16
|
+
* server is sent is what the author wrote.
|
|
17
|
+
*
|
|
18
|
+
* Every step carries the class of the change it makes, which picks its
|
|
19
|
+
* transaction and its statement timeout, and whether it may run inside a
|
|
20
|
+
* transaction block at all (`CREATE INDEX CONCURRENTLY` may not).
|
|
21
|
+
*/
|
|
22
|
+
import type { OwnershipMarker } from "@intentius/chant/ownership";
|
|
23
|
+
import { type Token } from "../tokens.js";
|
|
24
|
+
import { type PostgresEntityType } from "../entity-types.js";
|
|
25
|
+
import type { PgChange } from "../plan/diff.js";
|
|
26
|
+
import { type PgChangeClass, type PgClassifierRuleId } from "../plan/rules.js";
|
|
27
|
+
import { type CanonicalConstraint, type CanonicalKind } from "../plan/normalize.js";
|
|
28
|
+
import type { PgDiffObject } from "../plan/schema.js";
|
|
29
|
+
import type { CheckDef, ColumnDef, ExclusionDef, ForeignKeyDef, KeyDef, SequenceProps } from "../entities.js";
|
|
30
|
+
/** One object as a build declares it, in the shape the applier works with. */
|
|
31
|
+
export interface DeclaredPgObject {
|
|
32
|
+
/** The export name: the object's identity in chant. */
|
|
33
|
+
exportName: string;
|
|
34
|
+
type: PostgresEntityType;
|
|
35
|
+
/** Its name on the server, as an apply result names it: `app.users`, or a schema's or extension's own name. */
|
|
36
|
+
name: string;
|
|
37
|
+
/** The diff's key against a server: the namespace and the qualified name (`relation app.users`). */
|
|
38
|
+
key: string;
|
|
39
|
+
/** The statements as the build wrote them: the CREATE, then any COMMENT ON. */
|
|
40
|
+
ddl: string;
|
|
41
|
+
/** The props the tag parses out of `ddl`. */
|
|
42
|
+
props: Record<string, unknown>;
|
|
43
|
+
/** The canonical form the diff compares. */
|
|
44
|
+
canonical: PgDiffObject;
|
|
45
|
+
/** The export names it references. */
|
|
46
|
+
dependsOn: string[];
|
|
47
|
+
}
|
|
48
|
+
/** One statement to send. */
|
|
49
|
+
export interface PgStep {
|
|
50
|
+
sql: string;
|
|
51
|
+
/** The class of the change it makes; it picks the transaction and the statement timeout. */
|
|
52
|
+
class: PgChangeClass;
|
|
53
|
+
/** False for a statement that refuses a transaction block or is kept out of one (`CONCURRENTLY`, `ALTER TYPE ... ADD VALUE`). */
|
|
54
|
+
transactional: boolean;
|
|
55
|
+
/** The rule of the change it makes, when it makes one. */
|
|
56
|
+
rule?: PgClassifierRuleId;
|
|
57
|
+
/** An index this statement builds CONCURRENTLY: a failed build leaves it INVALID, and the applier drops it again. */
|
|
58
|
+
buildsIndex?: string;
|
|
59
|
+
}
|
|
60
|
+
/** What {@link alterSteps} could not make in place: changes with no statement, each with why. */
|
|
61
|
+
export interface UnsupportedChange {
|
|
62
|
+
change: PgChange;
|
|
63
|
+
why: string;
|
|
64
|
+
}
|
|
65
|
+
/** A string literal: `'` doubled (standard_conforming_strings is on). */
|
|
66
|
+
export declare const pgString: (value: string) => string;
|
|
67
|
+
/** `schema.name`, each part quoted where Postgres needs it. */
|
|
68
|
+
export declare const pgQualified: (schema: string | undefined, name: string) => string;
|
|
69
|
+
/** An object's name in a statement. A schema and an extension have no schema. */
|
|
70
|
+
export declare const objectIdent: (o: {
|
|
71
|
+
kind: CanonicalKind;
|
|
72
|
+
schema?: string;
|
|
73
|
+
name: string;
|
|
74
|
+
}) => string;
|
|
75
|
+
/** The words a statement names the object's kind with. */
|
|
76
|
+
export declare const KIND_WORDS: Readonly<Record<CanonicalKind, string>>;
|
|
77
|
+
/** The canonical kind of an entity type. */
|
|
78
|
+
export declare const kindOfType: (type: string) => CanonicalKind;
|
|
79
|
+
interface Statement {
|
|
80
|
+
text: string;
|
|
81
|
+
tokens: Token[];
|
|
82
|
+
}
|
|
83
|
+
/** The statements of a template's DDL, split at top-level semicolons, comments kept with the statement they precede. */
|
|
84
|
+
export declare function splitStatements(ddl: string): Statement[];
|
|
85
|
+
/** The declared comment with chant's trailer: what the object's own `COMMENT ON` sets. */
|
|
86
|
+
export declare function commentStatement(obj: Pick<DeclaredPgObject, "canonical">, marker: OwnershipMarker | undefined, base?: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* The declared statements that create the object, its own `COMMENT ON`
|
|
89
|
+
* replaced by one carrying chant's marker, so no object is left unmarked.
|
|
90
|
+
* `base` is the comment kept under the trailer when nothing is declared (an
|
|
91
|
+
* extension's own comment, from its control file). `orReplace` turns
|
|
92
|
+
* `CREATE VIEW` into `CREATE OR REPLACE VIEW`.
|
|
93
|
+
*/
|
|
94
|
+
export declare function createSteps(obj: Pick<DeclaredPgObject, "ddl" | "canonical" | "props">, marker: OwnershipMarker | undefined, opts?: {
|
|
95
|
+
base?: string;
|
|
96
|
+
orReplace?: boolean;
|
|
97
|
+
cls?: PgChangeClass;
|
|
98
|
+
rule?: PgClassifierRuleId;
|
|
99
|
+
}): PgStep[];
|
|
100
|
+
/** The `DROP` for an object a prune removes. Never `CASCADE`: what something else still uses is kept. */
|
|
101
|
+
export declare function dropStatement(kind: CanonicalKind, schema: string | undefined, name: string): PgStep;
|
|
102
|
+
/** A column's definition for `ADD COLUMN`: its type, storage, collation, generation, default and NOT NULL; its constraints are added on their own. */
|
|
103
|
+
export declare function columnDefinition(c: ColumnDef): string;
|
|
104
|
+
/** A constraint as a table constraint (`ADD CONSTRAINT ...`), whether it was declared on a column or the table. */
|
|
105
|
+
export declare function constraintSql(kind: CanonicalConstraint["kind"], def: KeyDef | CheckDef | ForeignKeyDef | ExclusionDef): string;
|
|
106
|
+
/** `ALTER SEQUENCE`'s options for what is declared, every option left out set back to its default. */
|
|
107
|
+
export declare function sequenceOptionsSql(p: SequenceProps): string;
|
|
108
|
+
/** Changes a plan refuses to make in place: expand and contract, by the migration Op (#3281). */
|
|
109
|
+
export declare const isRefused: (c: PgChange) => boolean;
|
|
110
|
+
/** Changes that destroy data, which only an apply allowed to delete makes. */
|
|
111
|
+
export declare const isDestructive: (c: PgChange) => boolean;
|
|
112
|
+
/** Changes that replace the object: drop it and create it again from its declaration. */
|
|
113
|
+
export declare const isRecreate: (c: PgChange) => boolean;
|
|
114
|
+
/**
|
|
115
|
+
* The statements for an object that exists on the server, change by change.
|
|
116
|
+
* `live` is the server's definition, matched to the declaration (a renamed
|
|
117
|
+
* index by its `-- previously:` name). What has no statement in place is
|
|
118
|
+
* returned in `unsupported`, so the applier can refuse the object rather
|
|
119
|
+
* than make half of it.
|
|
120
|
+
*/
|
|
121
|
+
export declare function alterSteps(obj: DeclaredPgObject, live: PgDiffObject, changes: readonly PgChange[], opts: {
|
|
122
|
+
marker?: OwnershipMarker;
|
|
123
|
+
major: number;
|
|
124
|
+
}): {
|
|
125
|
+
steps: PgStep[];
|
|
126
|
+
unsupported: UnsupportedChange[];
|
|
127
|
+
};
|
|
128
|
+
/** Whether a change class reads or rewrites rows, so its statement runs in a transaction of its own with the scan timeout. */
|
|
129
|
+
export declare const scansRows: (cls: PgChangeClass) => boolean;
|
|
130
|
+
/**
|
|
131
|
+
* The detail of a refused object: each change, the rule and restriction
|
|
132
|
+
* behind it, and the Op that makes it. `declared` is the object as declared,
|
|
133
|
+
* which names the table a column rename or type change is handed to
|
|
134
|
+
* `PostgresMigrationOp` for (`../migrate/handoff.ts`).
|
|
135
|
+
*/
|
|
136
|
+
export declare function refusalDetail(changes: readonly PgChange[], name: string, declared?: Pick<PgDiffObject, "kind" | "schema" | "name">): string;
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=statements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../../../src/postgres/apply/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAA0B,KAAK,KAAK,EAAE,MAAM,WAAW,CAAC;AAG/D,OAAO,EAAyB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAoC,KAAK,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAe,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAc,MAAM,aAAa,CAAC;AAEpI,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;IACzB,+GAA+G;IAC/G,IAAI,EAAE,MAAM,CAAC;IACb,oGAAoG;IACpG,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,4CAA4C;IAC5C,SAAS,EAAE,YAAY,CAAC;IACxB,sCAAsC;IACtC,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,6BAA6B;AAC7B,MAAM,WAAW,MAAM;IACr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AAK,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,iBAAiB,EAAE,CAAA;CAAE,CA+JvD;AAED,8HAA8H;AAC9H,eAAO,MAAM,SAAS,GAAI,KAAK,aAAa,KAAG,OAA4E,CAAC;AAE5H;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC,GAAG,MAAM,CAa3I"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes of the generated Postgres tables (`src/generated/postgres.ts`).
|
|
3
|
+
* The data is generated; these types are not, so the generated module stays
|
|
4
|
+
* data and a reader of it has one place to look for what a field means.
|
|
5
|
+
*
|
|
6
|
+
* The generated types are the union of every supported major's catalog. A
|
|
7
|
+
* name that is not in all of them carries a {@link VersionRange}, in the
|
|
8
|
+
* generated `VERSION_RANGES` table and as `@since` / `@until` on the member's
|
|
9
|
+
* JSDoc. `since` is the first major with the name and is absent when that is
|
|
10
|
+
* the oldest supported major; `until` is the last major with it and is absent
|
|
11
|
+
* when that is the newest.
|
|
12
|
+
*/
|
|
13
|
+
import type { ArgumentKind, ClauseArgument } from "./overlays/kinds.js";
|
|
14
|
+
import type { StorageParameterType } from "./overlays/storage.js";
|
|
15
|
+
export type { ArgumentKind, ClauseArgument, StorageParameterType };
|
|
16
|
+
export interface VersionRange {
|
|
17
|
+
/** The first supported major that has this name. Absent: the oldest. */
|
|
18
|
+
readonly since?: number;
|
|
19
|
+
/** The last supported major that has this name. Absent: the newest. */
|
|
20
|
+
readonly until?: number;
|
|
21
|
+
}
|
|
22
|
+
/** True when `range` (or no range) covers `major`. */
|
|
23
|
+
export declare function availableAt(range: VersionRange | undefined, major: number): boolean;
|
|
24
|
+
export interface SettingSpec {
|
|
25
|
+
/** `bool`, `integer`, `real`, `string` or `enum`, as `pg_settings.vartype` says (the newest major that has the setting). */
|
|
26
|
+
type: string;
|
|
27
|
+
/** When a value can be changed: `postmaster`, `sighup`, `superuser`, `user`... */
|
|
28
|
+
context: string;
|
|
29
|
+
category: string;
|
|
30
|
+
unit?: string;
|
|
31
|
+
default?: string;
|
|
32
|
+
min?: string;
|
|
33
|
+
max?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface StorageParameterSpec {
|
|
36
|
+
type: StorageParameterType;
|
|
37
|
+
/** The relation kinds that accept it: `table`, `toast`, `view`, `materialized view`, `index:btree`... */
|
|
38
|
+
targets: readonly string[];
|
|
39
|
+
}
|
|
40
|
+
export interface ColumnTypeSpec {
|
|
41
|
+
/** The `pg_type` name (`int4`), when it differs from the SQL name. */
|
|
42
|
+
catalogName?: string;
|
|
43
|
+
/** `typcategory`: `N` numeric, `S` string, `D` date and time... */
|
|
44
|
+
category: string;
|
|
45
|
+
/** Spellings that stand for this type (`int`, `int4`). */
|
|
46
|
+
aliases: readonly string[];
|
|
47
|
+
/** The type's parameters, from the overlay; none when it takes none. */
|
|
48
|
+
parameters: readonly ClauseArgument[];
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=catalog-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-types.d.ts","sourceRoot":"","sources":["../../src/postgres/catalog-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnF;AAED,MAAM,WAAW,WAAW;IAC1B,4HAA4H;IAC5H,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,yGAAyG;IACzG,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,wEAAwE;IACxE,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;CACvC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A throwaway `postgres` server in a container, for catalog generation and the
|
|
3
|
+
* live tests: started under a unique name with no published port, queried with
|
|
4
|
+
* `docker exec psql`, and always removed.
|
|
5
|
+
*
|
|
6
|
+
* The official image restarts the server once after `initdb`, so the ready
|
|
7
|
+
* line appears twice in its log; the server is ready on the second.
|
|
8
|
+
*/
|
|
9
|
+
export { dockerAvailable } from "../core/container.js";
|
|
10
|
+
export interface ScratchPostgres {
|
|
11
|
+
/** The container's name, for a log line. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Run a SQL script with psql as `postgres` (`-qAt`, stop at the first error) and return its stdout. */
|
|
14
|
+
psql(sql: string): Promise<string>;
|
|
15
|
+
/** Remove the container. Safe to call twice. */
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/** Start `image` and wait until the server accepts connections. Pulls the image when it is absent. */
|
|
19
|
+
export declare function startScratchPostgres(image: string, options?: {
|
|
20
|
+
namePrefix?: string;
|
|
21
|
+
readyTimeoutMs?: number;
|
|
22
|
+
}): Promise<ScratchPostgres>;
|
|
23
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/postgres/container.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,wGAAwG;IACxG,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,gDAAgD;IAChD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAkBD,sGAAsG;AACtG,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7D,OAAO,CAAC,eAAe,CAAC,CAyB1B"}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Postgres entities: `schema`, `table`, `index`, `view`, `sequence`,
|
|
3
|
+
* `type`, `domain` and `extension` tagged templates that parse their DDL at
|
|
4
|
+
* fold time into one Declarable each (chant #3278, #3279).
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { schema, table, index } from "@intentius/chant-lexicon-sql/postgres";
|
|
8
|
+
*
|
|
9
|
+
* export const app = schema`CREATE SCHEMA app`;
|
|
10
|
+
* export const users = table`
|
|
11
|
+
* CREATE TABLE ${app}.users (
|
|
12
|
+
* id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
13
|
+
* email text NOT NULL UNIQUE
|
|
14
|
+
* );
|
|
15
|
+
* COMMENT ON TABLE ${app}.users IS 'One row per account'`;
|
|
16
|
+
* export const usersEmail = index`CREATE INDEX users_email_idx ON ${users} (lower(${users.columns.email}))`;
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* The export name is the object's identity in chant; the name in the SQL is
|
|
20
|
+
* its name in the database. An unquoted name folds to lower case, as Postgres
|
|
21
|
+
* folds it, so `CREATE TABLE Users` is `users` and `.columns` is keyed by the
|
|
22
|
+
* folded name.
|
|
23
|
+
*
|
|
24
|
+
* What an interpolation means is decided by its value, as for ClickHouse
|
|
25
|
+
* (#3235):
|
|
26
|
+
*
|
|
27
|
+
* - a Postgres entity is a reference to that object and renders as its
|
|
28
|
+
* schema-qualified name; a schema renders as its name, so `${app}.users`
|
|
29
|
+
* reads `app.users`;
|
|
30
|
+
* - `entity.columns.<name>` is a reference to one column, and renders as the
|
|
31
|
+
* column's name (write `u.${users.columns.id}` in a join);
|
|
32
|
+
* - a sequence inside `nextval(...)`, `currval(...)` or `setval(...)`, and any
|
|
33
|
+
* object followed by `::regclass`, renders as a `regclass` literal:
|
|
34
|
+
* `DEFAULT nextval(${ticketSeq})` reads `nextval('app.ticket_seq'::regclass)`,
|
|
35
|
+
* which is also how the catalog prints it, and the table depends on the
|
|
36
|
+
* sequence;
|
|
37
|
+
* - a string is SQL text, spliced into the statement before it is parsed;
|
|
38
|
+
* - a number or bigint is a numeric literal, a boolean `true`/`false`, `null`
|
|
39
|
+
* is `NULL`;
|
|
40
|
+
* - `literal(value)` is a quoted string literal (`'` doubled; a backslash is an
|
|
41
|
+
* ordinary character, since standard_conforming_strings is on).
|
|
42
|
+
*
|
|
43
|
+
* Postgres has no inline comment clause, so a template may follow its CREATE
|
|
44
|
+
* with `COMMENT ON` statements for the same object, its columns and its
|
|
45
|
+
* constraints. They fold into the entity's `comment`, each column's and each
|
|
46
|
+
* constraint's, and stay in the DDL.
|
|
47
|
+
*/
|
|
48
|
+
import type { AttrRef } from "@intentius/chant/attrref";
|
|
49
|
+
import { type StatementNode } from "./parser.js";
|
|
50
|
+
import { type TemplateDialect } from "../core/interpolation.js";
|
|
51
|
+
import { SqlObject } from "../core/entity.js";
|
|
52
|
+
import type { LineageEdge } from "../core/references.js";
|
|
53
|
+
import { SqlLiteral } from "../core/template.js";
|
|
54
|
+
export { SQL_LEXICON } from "../core/entity.js";
|
|
55
|
+
export type { LineageEdge } from "../core/references.js";
|
|
56
|
+
export { SqlLiteral, SqlTemplateError } from "../core/template.js";
|
|
57
|
+
export { quoteIdent } from "./keywords.js";
|
|
58
|
+
export { POSTGRES_ENTITY_TYPES, type PostgresEntityType } from "./entity-types.js";
|
|
59
|
+
import { type PostgresEntityType } from "./entity-types.js";
|
|
60
|
+
/** A column as declared. Expressions are the source text with interpolations rendered. */
|
|
61
|
+
export interface ColumnDef {
|
|
62
|
+
name: string;
|
|
63
|
+
/** Absent on a typed table (`OF type`) or a partition, whose columns take their type elsewhere. */
|
|
64
|
+
type?: string;
|
|
65
|
+
/** `NOT NULL` (true) or `NULL` (false), when written. */
|
|
66
|
+
notNull?: boolean;
|
|
67
|
+
/** The name given to the column's NOT NULL constraint. */
|
|
68
|
+
notNullName?: string;
|
|
69
|
+
default?: string;
|
|
70
|
+
/** `GENERATED ALWAYS AS (expr) STORED | VIRTUAL`, or `GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [(options)]`. */
|
|
71
|
+
generated?: {
|
|
72
|
+
kind: "stored" | "virtual" | "identity";
|
|
73
|
+
expr?: string;
|
|
74
|
+
always: boolean;
|
|
75
|
+
options?: string;
|
|
76
|
+
};
|
|
77
|
+
collate?: string;
|
|
78
|
+
compression?: string;
|
|
79
|
+
storage?: string;
|
|
80
|
+
comment?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Deferral attributes, on the constraints that take them. */
|
|
83
|
+
interface Deferral {
|
|
84
|
+
deferrable?: boolean;
|
|
85
|
+
initiallyDeferred?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface KeyDef extends Deferral {
|
|
88
|
+
name?: string;
|
|
89
|
+
columns: string[];
|
|
90
|
+
nullsNotDistinct?: boolean;
|
|
91
|
+
include?: string;
|
|
92
|
+
with?: string;
|
|
93
|
+
comment?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface CheckDef {
|
|
96
|
+
name?: string;
|
|
97
|
+
expr: string;
|
|
98
|
+
noInherit?: boolean;
|
|
99
|
+
notValid?: boolean;
|
|
100
|
+
notEnforced?: boolean;
|
|
101
|
+
comment?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface ForeignKeyDef extends Deferral {
|
|
104
|
+
name?: string;
|
|
105
|
+
columns: string[];
|
|
106
|
+
/** The referenced table: the entity when it is interpolated, else its name as written. */
|
|
107
|
+
references: PostgresObject | string;
|
|
108
|
+
/** The referenced table's SQL name, schema-qualified as written. */
|
|
109
|
+
refTable: string;
|
|
110
|
+
/** The referenced columns; empty means the referenced table's primary key. */
|
|
111
|
+
refColumns: string[];
|
|
112
|
+
match?: string;
|
|
113
|
+
onDelete?: string;
|
|
114
|
+
onUpdate?: string;
|
|
115
|
+
notValid?: boolean;
|
|
116
|
+
notEnforced?: boolean;
|
|
117
|
+
comment?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface ExclusionDef extends Deferral {
|
|
120
|
+
name?: string;
|
|
121
|
+
using?: string;
|
|
122
|
+
/** The element list, `col WITH op, ...`, as written. */
|
|
123
|
+
elements: string;
|
|
124
|
+
where?: string;
|
|
125
|
+
include?: string;
|
|
126
|
+
with?: string;
|
|
127
|
+
comment?: string;
|
|
128
|
+
}
|
|
129
|
+
interface CommonProps {
|
|
130
|
+
/** The object's name in the database, folded as Postgres folds it. */
|
|
131
|
+
name: string;
|
|
132
|
+
/** The schema the DDL qualifies it with. */
|
|
133
|
+
schema?: string;
|
|
134
|
+
comment?: string;
|
|
135
|
+
/** The statements as they will be sent: the author's text, interpolations rendered. */
|
|
136
|
+
ddl: string;
|
|
137
|
+
/** The template's raw parts, as written, for a source round trip. */
|
|
138
|
+
source: {
|
|
139
|
+
strings: string[];
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export interface SchemaProps extends Omit<CommonProps, "schema"> {
|
|
143
|
+
ifNotExists?: boolean;
|
|
144
|
+
authorization?: string;
|
|
145
|
+
}
|
|
146
|
+
export interface TableProps extends CommonProps {
|
|
147
|
+
persistence?: "temporary" | "unlogged";
|
|
148
|
+
ifNotExists?: boolean;
|
|
149
|
+
/** `PARTITION OF parent`: the entity when interpolated, else its name. */
|
|
150
|
+
partitionOf?: PostgresObject | string;
|
|
151
|
+
partitionBound?: string;
|
|
152
|
+
/** `OF type`: the entity when interpolated, else its name. */
|
|
153
|
+
ofType?: PostgresObject | string;
|
|
154
|
+
columns: ColumnDef[];
|
|
155
|
+
primaryKey?: KeyDef;
|
|
156
|
+
uniques: KeyDef[];
|
|
157
|
+
checks: CheckDef[];
|
|
158
|
+
foreignKeys: ForeignKeyDef[];
|
|
159
|
+
exclusions: ExclusionDef[];
|
|
160
|
+
/** `LIKE source [options]` clauses, as written. */
|
|
161
|
+
like: string[];
|
|
162
|
+
inherits: Array<PostgresObject | string>;
|
|
163
|
+
partitionBy?: string;
|
|
164
|
+
using?: string;
|
|
165
|
+
/** Storage parameters, as written: `(fillfactor = 70)`. */
|
|
166
|
+
with?: string;
|
|
167
|
+
onCommit?: string;
|
|
168
|
+
tablespace?: string;
|
|
169
|
+
}
|
|
170
|
+
export interface IndexProps extends CommonProps {
|
|
171
|
+
/** The indexed table: the entity when interpolated, else its name. */
|
|
172
|
+
table: PostgresObject | string;
|
|
173
|
+
/** The indexed table's SQL name. */
|
|
174
|
+
tableName: string;
|
|
175
|
+
unique?: boolean;
|
|
176
|
+
/** `CREATE INDEX CONCURRENTLY`: the classifier and the applier read it, since it refuses a transaction block. */
|
|
177
|
+
concurrently?: boolean;
|
|
178
|
+
ifNotExists?: boolean;
|
|
179
|
+
only?: boolean;
|
|
180
|
+
/** The access method (`btree`, `gin`, ...), when written. */
|
|
181
|
+
method?: string;
|
|
182
|
+
elements: Array<{
|
|
183
|
+
expr: string;
|
|
184
|
+
column?: string;
|
|
185
|
+
}>;
|
|
186
|
+
include?: string;
|
|
187
|
+
nullsNotDistinct?: boolean;
|
|
188
|
+
with?: string;
|
|
189
|
+
tablespace?: string;
|
|
190
|
+
where?: string;
|
|
191
|
+
}
|
|
192
|
+
export interface ViewProps extends CommonProps {
|
|
193
|
+
orReplace?: boolean;
|
|
194
|
+
recursive?: boolean;
|
|
195
|
+
temporary?: boolean;
|
|
196
|
+
ifNotExists?: boolean;
|
|
197
|
+
/** The declared column list; empty when the view names its outputs in its query. */
|
|
198
|
+
columns: string[];
|
|
199
|
+
with?: string;
|
|
200
|
+
using?: string;
|
|
201
|
+
tablespace?: string;
|
|
202
|
+
query: string;
|
|
203
|
+
checkOption?: string;
|
|
204
|
+
/** `WITH DATA` (true) or `WITH NO DATA` (false), for a materialized view. */
|
|
205
|
+
withData?: boolean;
|
|
206
|
+
/** The objects the query reads, as references. */
|
|
207
|
+
reads: PostgresObject[];
|
|
208
|
+
/** Per output column of the top-level select list, the columns it reads. */
|
|
209
|
+
lineage: LineageEdge[];
|
|
210
|
+
/** `COMMENT ON COLUMN` for the view's outputs. */
|
|
211
|
+
columnComments?: Record<string, string>;
|
|
212
|
+
}
|
|
213
|
+
export interface SequenceProps extends CommonProps {
|
|
214
|
+
persistence?: "temporary" | "unlogged";
|
|
215
|
+
ifNotExists?: boolean;
|
|
216
|
+
/** `AS type`: the sequence's data type. */
|
|
217
|
+
dataType?: string;
|
|
218
|
+
increment?: string;
|
|
219
|
+
/** A value, or `null` for `NO MINVALUE`. */
|
|
220
|
+
minValue?: string | null;
|
|
221
|
+
maxValue?: string | null;
|
|
222
|
+
start?: string;
|
|
223
|
+
cache?: string;
|
|
224
|
+
/** `CYCLE` (true) or `NO CYCLE` (false), when written. */
|
|
225
|
+
cycle?: boolean;
|
|
226
|
+
/** `OWNED BY table.column`, or `NONE`. */
|
|
227
|
+
ownedBy?: string;
|
|
228
|
+
}
|
|
229
|
+
export interface EnumProps extends CommonProps {
|
|
230
|
+
labels: string[];
|
|
231
|
+
}
|
|
232
|
+
export interface DomainProps extends CommonProps {
|
|
233
|
+
/** The underlying data type. */
|
|
234
|
+
dataType: string;
|
|
235
|
+
collate?: string;
|
|
236
|
+
default?: string;
|
|
237
|
+
notNull?: boolean;
|
|
238
|
+
checks: CheckDef[];
|
|
239
|
+
}
|
|
240
|
+
export interface ExtensionProps extends Omit<CommonProps, "schema"> {
|
|
241
|
+
/** `WITH SCHEMA`: the schema the extension's objects are created in. */
|
|
242
|
+
schema?: string;
|
|
243
|
+
version?: string;
|
|
244
|
+
cascade?: boolean;
|
|
245
|
+
ifNotExists?: boolean;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* A string as a quoted Postgres string literal: `'` doubled, a backslash left
|
|
249
|
+
* as written (standard_conforming_strings is on). An interpolated plain string
|
|
250
|
+
* is SQL text; wrap it in `literal()` when it is a value.
|
|
251
|
+
*/
|
|
252
|
+
export declare function literal(value: string | number | boolean | null): SqlLiteral;
|
|
253
|
+
/** The members a Postgres entity has besides its props (the shared core's {@link SqlObject}). */
|
|
254
|
+
export declare abstract class PostgresObject extends SqlObject {
|
|
255
|
+
readonly entityType: PostgresEntityType;
|
|
256
|
+
/** The name the object is referred to by in SQL: `name`, or `schema.name`, quoted where Postgres needs it. */
|
|
257
|
+
readonly sqlName: string;
|
|
258
|
+
}
|
|
259
|
+
export interface PostgresSchema extends PostgresObject {
|
|
260
|
+
readonly entityType: "Postgres::Schema";
|
|
261
|
+
readonly props: SchemaProps;
|
|
262
|
+
}
|
|
263
|
+
/** A table or a view: something with columns that SQL can reference. */
|
|
264
|
+
export interface PostgresRelation extends PostgresObject {
|
|
265
|
+
/** One reference per column, by its folded name: `${users.columns.email}`. */
|
|
266
|
+
readonly columns: Readonly<Record<string, AttrRef>>;
|
|
267
|
+
}
|
|
268
|
+
export interface PostgresTable extends PostgresRelation {
|
|
269
|
+
readonly entityType: "Postgres::Table";
|
|
270
|
+
readonly props: TableProps;
|
|
271
|
+
}
|
|
272
|
+
export interface PostgresView extends PostgresRelation {
|
|
273
|
+
readonly entityType: "Postgres::View" | "Postgres::MaterializedView";
|
|
274
|
+
readonly props: ViewProps;
|
|
275
|
+
}
|
|
276
|
+
export interface PostgresIndex extends PostgresObject {
|
|
277
|
+
readonly entityType: "Postgres::Index";
|
|
278
|
+
readonly props: IndexProps;
|
|
279
|
+
}
|
|
280
|
+
export interface PostgresSequence extends PostgresObject {
|
|
281
|
+
readonly entityType: "Postgres::Sequence";
|
|
282
|
+
readonly props: SequenceProps;
|
|
283
|
+
}
|
|
284
|
+
export interface PostgresEnum extends PostgresObject {
|
|
285
|
+
readonly entityType: "Postgres::Enum";
|
|
286
|
+
readonly props: EnumProps;
|
|
287
|
+
}
|
|
288
|
+
export interface PostgresDomain extends PostgresObject {
|
|
289
|
+
readonly entityType: "Postgres::Domain";
|
|
290
|
+
readonly props: DomainProps;
|
|
291
|
+
}
|
|
292
|
+
export interface PostgresExtension extends PostgresObject {
|
|
293
|
+
readonly entityType: "Postgres::Extension";
|
|
294
|
+
readonly props: ExtensionProps;
|
|
295
|
+
}
|
|
296
|
+
export declare function isPostgresObject(value: unknown): value is PostgresObject;
|
|
297
|
+
/** A column reference: an AttrRef whose parent is a Postgres table or view. */
|
|
298
|
+
export declare function isColumnRef(value: unknown): value is AttrRef;
|
|
299
|
+
/** Postgres as the shared template machinery reads it (`../core/interpolation.ts`). */
|
|
300
|
+
export declare const POSTGRES_TEMPLATES: TemplateDialect;
|
|
301
|
+
export type PostgresTag = "schema" | "table" | "index" | "view" | "sequence" | "type" | "domain" | "extension";
|
|
302
|
+
/** What each statement kind is called in a message. */
|
|
303
|
+
export declare const STATEMENT_NAMES: Record<StatementNode["statement"], string>;
|
|
304
|
+
/** A string constant's value: `'...'`, `E'...'`, `$tag$...$tag$`. */
|
|
305
|
+
export declare function stringValue(s: string | undefined): string | undefined;
|
|
306
|
+
/** `` schema`CREATE SCHEMA ...` ``: one Postgres schema, parsed at build time. */
|
|
307
|
+
export declare function schema(strings: TemplateStringsArray, ...values: unknown[]): PostgresSchema;
|
|
308
|
+
/** `` table`CREATE TABLE ...` ``: one Postgres table with its columns and constraints, parsed at build time. */
|
|
309
|
+
export declare function table(strings: TemplateStringsArray, ...values: unknown[]): PostgresTable;
|
|
310
|
+
/** `` index`CREATE [UNIQUE] INDEX [CONCURRENTLY] name ON ...` ``: one named index. */
|
|
311
|
+
export declare function index(strings: TemplateStringsArray, ...values: unknown[]): PostgresIndex;
|
|
312
|
+
/** `` view`CREATE [MATERIALIZED] VIEW ...` ``: one view or materialized view, with what it reads and its column lineage. */
|
|
313
|
+
export declare function view(strings: TemplateStringsArray, ...values: unknown[]): PostgresView;
|
|
314
|
+
/** `` sequence`CREATE SEQUENCE ...` ``: one sequence. Reference it as `nextval(${seq})`. */
|
|
315
|
+
export declare function sequence(strings: TemplateStringsArray, ...values: unknown[]): PostgresSequence;
|
|
316
|
+
/** `` type`CREATE TYPE name AS ENUM (...)` ``: one enum type. */
|
|
317
|
+
export declare function type(strings: TemplateStringsArray, ...values: unknown[]): PostgresEnum;
|
|
318
|
+
/** `` domain`CREATE DOMAIN ...` ``: one domain. */
|
|
319
|
+
export declare function domain(strings: TemplateStringsArray, ...values: unknown[]): PostgresDomain;
|
|
320
|
+
/** `` extension`CREATE EXTENSION ...` ``: one extension. */
|
|
321
|
+
export declare function extension(strings: TemplateStringsArray, ...values: unknown[]): PostgresExtension;
|
|
322
|
+
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRo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AgB,KAAK,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAExF;AAED,sFAAsF;AACtF,wBAAgB,KAAK,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAExF;AAED,4HAA4H;AAC5H,wBAAgB,IAAI,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAEtF;AAED,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAE9F;AAED,iEAAiE;AACjE,wBAAgB,IAAI,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAEtF;AAED,mDAAmD;AACnD,wBAAgB,MAAM,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAE1F;AAED,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAEhG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Postgres entity types, apart from the tags so generation can name them
|
|
3
|
+
* before the generated tables the tags read exist.
|
|
4
|
+
*/
|
|
5
|
+
export declare const POSTGRES_ENTITY_TYPES: {
|
|
6
|
+
readonly schema: "Postgres::Schema";
|
|
7
|
+
readonly table: "Postgres::Table";
|
|
8
|
+
readonly index: "Postgres::Index";
|
|
9
|
+
readonly view: "Postgres::View";
|
|
10
|
+
readonly materializedView: "Postgres::MaterializedView";
|
|
11
|
+
readonly sequence: "Postgres::Sequence";
|
|
12
|
+
readonly enum: "Postgres::Enum";
|
|
13
|
+
readonly domain: "Postgres::Domain";
|
|
14
|
+
readonly extension: "Postgres::Extension";
|
|
15
|
+
};
|
|
16
|
+
export type PostgresEntityType = (typeof POSTGRES_ENTITY_TYPES)[keyof typeof POSTGRES_ENTITY_TYPES];
|
|
17
|
+
//# sourceMappingURL=entity-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-types.d.ts","sourceRoot":"","sources":["../../src/postgres/entity-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;CAUxB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The import IR as TypeScript: one `schema.ts` holding every imported object
|
|
3
|
+
* as a `schema`, `table`, `index`, `view`, `sequence`, `type`, `domain` or
|
|
4
|
+
* `extension` declaration, in dependency order, with the references between
|
|
5
|
+
* them interpolated, so the build orders them as the server did:
|
|
6
|
+
*
|
|
7
|
+
* - a qualified name of another imported object becomes `${export}`
|
|
8
|
+
* (`REFERENCES app.users(id)` is `REFERENCES ${users}(id)`, a type
|
|
9
|
+
* `app.order_status` is `${orderStatus}`);
|
|
10
|
+
* - a sequence named in a `regclass` literal becomes the reference
|
|
11
|
+
* (`nextval('app.invoice_seq'::regclass)` is `nextval(${invoiceSeq})`);
|
|
12
|
+
* - the schema part of the object's own name, wherever the name appears,
|
|
13
|
+
* becomes the schema's export (`CREATE TABLE ${appSchema}.users`);
|
|
14
|
+
* - an extension's `WITH SCHEMA` names the schema's export.
|
|
15
|
+
*
|
|
16
|
+
* Columns stay text, as they do for ClickHouse (#3236): which relation a bare
|
|
17
|
+
* column belongs to is the server's to resolve. One file, because the
|
|
18
|
+
* references cross schemas freely.
|
|
19
|
+
*/
|
|
20
|
+
import type { GeneratedFile, TypeScriptGenerator } from "@intentius/chant/import/generator";
|
|
21
|
+
import type { TemplateIR } from "@intentius/chant/import/parser";
|
|
22
|
+
export declare class PostgresGenerator implements TypeScriptGenerator {
|
|
23
|
+
private readonly header?;
|
|
24
|
+
readonly ownsLayout = true;
|
|
25
|
+
constructor(header?: string | undefined);
|
|
26
|
+
generate(ir: TemplateIR): GeneratedFile[];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/postgres/import/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAwGjE,qBAAa,iBAAkB,YAAW,mBAAmB;IAG/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAFpC,QAAQ,CAAC,UAAU,QAAQ;gBAEE,MAAM,CAAC,EAAE,MAAM,YAAA;IAE5C,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,aAAa,EAAE;CA6C1C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Postgres objects into the import IR: one resource per object, the
|
|
3
|
+
* statements that create it as the server prints them (`../live/catalog.ts`),
|
|
4
|
+
* and an export name.
|
|
5
|
+
*/
|
|
6
|
+
import type { TemplateIR } from "@intentius/chant/import/parser";
|
|
7
|
+
import { type PostgresEntityType } from "../entity-types.js";
|
|
8
|
+
export interface ImportedPgObject {
|
|
9
|
+
type: PostgresEntityType;
|
|
10
|
+
schema?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
/** The CREATE, then any COMMENT ON statements, separated by `;`. */
|
|
13
|
+
ddl: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Export names: an object's name in camel case, prefixed with its schema when
|
|
17
|
+
* two schemas hold the same name; a schema's name with `Schema` after it and
|
|
18
|
+
* an extension's with `Extension`, so `app` the schema and `app` a table do
|
|
19
|
+
* not collide.
|
|
20
|
+
*/
|
|
21
|
+
export declare function exportNames(objects: readonly ImportedPgObject[]): string[];
|
|
22
|
+
/** The IR for a set of objects. */
|
|
23
|
+
export declare function objectsToIR(objects: readonly ImportedPgObject[], warnings?: string[]): TemplateIR;
|
|
24
|
+
//# sourceMappingURL=ir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../../../src/postgres/import/ir.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAyB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;CACb;AAeD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,EAAE,CAmB1E;AAED,mCAAmC;AACnC,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EAAE,QAAQ,GAAE,MAAM,EAAO,GAAG,UAAU,CAQrG"}
|