@prisma/orm-target-postgres 8.0.0-rc.1-dev.3 → 8.0.0-rc.1-dev.4
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/{adapter-Ddgpoq1S-D-Ftx9Ls.mjs → adapter-Ddgpoq1S-C7ylX0yv.mjs} +3 -3
- package/dist/{adapter-Ddgpoq1S-D-Ftx9Ls.mjs.map → adapter-Ddgpoq1S-C7ylX0yv.mjs.map} +1 -1
- package/dist/adapter.mjs +4 -4
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__column-types.mjs +1 -1
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__runtime.mjs +4 -4
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{aggregates-ftUgi-eC.mjs → aggregates-BmF5h9ht.mjs} +6 -2
- package/dist/aggregates-BmF5h9ht.mjs.map +1 -0
- package/dist/{authoring-03FwIL2k-kPjZAp3s.mjs → authoring-bh6W1Fe5-D__Gfc6K.mjs} +27 -11
- package/dist/authoring-bh6W1Fe5-D__Gfc6K.mjs.map +1 -0
- package/dist/{codec-ids-CsOU3xDv-mPI0INiF.d.mts → codec-ids-Bqu_IwO0-DKOdPizQ.d.mts} +5 -3
- package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts.map +1 -0
- package/dist/{codec-ids-tX7Svtz--BuOfRaVU.mjs → codec-ids-C5Rkltkw-DMf87l9s.mjs} +5 -3
- package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs.map +1 -0
- package/dist/codec-ids-DJ6j6pZc.d.mts +1 -0
- package/dist/{codec-types-mWhnDEAf-CAQzGFnF.d.mts → codec-types-BRU4F-7t-BaJbKF_i.d.mts} +5 -3
- package/dist/codec-types-BRU4F-7t-BaJbKF_i.d.mts.map +1 -0
- package/dist/codec-types-bX63JRLf.d.mts +2 -0
- package/dist/{codecs-rujsdlZR.mjs → codecs-BbkV3FUQ.mjs} +2 -2
- package/dist/codecs-BbkV3FUQ.mjs.map +1 -0
- package/dist/{codecs-Cvqvb9pV-Cdc51FKY.d.mts → codecs-D8tLswBi-_nbo-Z8x.d.mts} +53 -4
- package/dist/codecs-D8tLswBi-_nbo-Z8x.d.mts.map +1 -0
- package/dist/{codecs-CBl0nD44-CjInu_aV.mjs → codecs-DNf0Tmab-Bsdj1npb.mjs} +164 -12
- package/dist/codecs-DNf0Tmab-Bsdj1npb.mjs.map +1 -0
- package/dist/{codecs-DBn-uIv-.d.mts → codecs-DmCKO7dg.d.mts} +2 -2
- package/dist/codecs-DmCKO7dg.d.mts.map +1 -0
- package/dist/{column-types-CwAyCgp2.mjs → column-types-Bh92dNjD.mjs} +2 -2
- package/dist/{column-types-CwAyCgp2.mjs.map → column-types-Bh92dNjD.mjs.map} +1 -1
- package/dist/{contract-free-BZUS18FU.mjs → contract-free-DOV_X620.mjs} +4 -4
- package/dist/{contract-free-BZUS18FU.mjs.map → contract-free-DOV_X620.mjs.map} +1 -1
- package/dist/{control-8ofLM59h.mjs → control-D54Q3kbK.mjs} +6 -6
- package/dist/{control-8ofLM59h.mjs.map → control-D54Q3kbK.mjs.map} +1 -1
- package/dist/{control-adapter-D4fT5c42-nSea-5cg.mjs → control-adapter-D4fT5c42-CosMjFPJ.mjs} +5 -5
- package/dist/{control-adapter-D4fT5c42-nSea-5cg.mjs.map → control-adapter-D4fT5c42-CosMjFPJ.mjs.map} +1 -1
- package/dist/{control-policy-wC4BmQy8-Db4igfEn.mjs → control-policy-ClKhTn_0-BOS85yPy.mjs} +6 -6
- package/dist/{control-policy-wC4BmQy8-Db4igfEn.mjs.map → control-policy-ClKhTn_0-BOS85yPy.mjs.map} +1 -1
- package/dist/{ddl-BdP4q3KY-Duef4uHw.mjs → ddl-DfzxUAlg-DvJZAdQx.mjs} +4 -4
- package/dist/{ddl-BdP4q3KY-Duef4uHw.mjs.map → ddl-DfzxUAlg-DvJZAdQx.mjs.map} +1 -1
- package/dist/{descriptor-meta--MCrvIgj-DFsLFDj1.mjs → descriptor-meta--MCrvIgj-CwlRmzIb.mjs} +5 -5
- package/dist/{descriptor-meta--MCrvIgj-DFsLFDj1.mjs.map → descriptor-meta--MCrvIgj-CwlRmzIb.mjs.map} +1 -1
- package/dist/{descriptor-meta-B2fGOCSX-DTh_flIG.mjs → descriptor-meta-Bm8_p6kK-CjDa5ovb.mjs} +5 -5
- package/dist/{descriptor-meta-B2fGOCSX-DTh_flIG.mjs.map → descriptor-meta-Bm8_p6kK-CjDa5ovb.mjs.map} +1 -1
- package/dist/{diff-database-schema-wl9GusaU-BjDyKMS6.mjs → diff-database-schema-KDyPPk3N-Dd3tP56q.mjs} +5 -5
- package/dist/{diff-database-schema-wl9GusaU-BjDyKMS6.mjs.map → diff-database-schema-KDyPPk3N-Dd3tP56q.mjs.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{op-factory-call-rf1FJg8l-C6KLaBY1.mjs → op-factory-call-B3DVhHrC-DO122NQy.mjs} +5 -5
- package/dist/{op-factory-call-rf1FJg8l-C6KLaBY1.mjs.map → op-factory-call-B3DVhHrC-DO122NQy.mjs.map} +1 -1
- package/dist/{pack-j8ePkv1A.d.mts → pack-BYwIb0CN.d.mts} +17 -3
- package/dist/pack-BYwIb0CN.d.mts.map +1 -0
- package/dist/{planner-CqFym7lA-BKHIkh3V.mjs → planner-DJety89h-CNM5hBvV.mjs} +8 -8
- package/dist/{planner-CqFym7lA-BKHIkh3V.mjs.map → planner-DJety89h-CNM5hBvV.mjs.map} +1 -1
- package/dist/{planner-ddl-builders-CbfICQfm-CGjwaNy7.mjs → planner-ddl-builders-DJrx9cJg-Ct2ly5Em.mjs} +3 -3
- package/dist/{planner-ddl-builders-CbfICQfm-CGjwaNy7.mjs.map → planner-ddl-builders-DJrx9cJg-Ct2ly5Em.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-Ci6O7OL5-5k5_6lcD.mjs → planner-produced-postgres-migration-DLP-Hw6M-BUXxSd_i.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-Ci6O7OL5-5k5_6lcD.mjs.map → planner-produced-postgres-migration-DLP-Hw6M-BUXxSd_i.mjs.map} +1 -1
- package/dist/{planner-sql-checks-DRc_78n8-C9nHOrvU.mjs → planner-sql-checks-DKialyGJ-BlU4hEEw.mjs} +3 -3
- package/dist/{planner-sql-checks-DRc_78n8-C9nHOrvU.mjs.map → planner-sql-checks-DKialyGJ-BlU4hEEw.mjs.map} +1 -1
- package/dist/{postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs → postgres-contract-view-B_0-lbVi-C4lFy3bt.mjs} +5 -5
- package/dist/{postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs.map → postgres-contract-view-B_0-lbVi-C4lFy3bt.mjs.map} +1 -1
- package/dist/{postgres-migration-DJqjEDIS-CP437pha.mjs → postgres-migration-Cp9IRLdW-BEL9GAjb.mjs} +5 -5
- package/dist/{postgres-migration-DJqjEDIS-CP437pha.mjs.map → postgres-migration-Cp9IRLdW-BEL9GAjb.mjs.map} +1 -1
- package/dist/{postgres-schema-KSzLDONj-CsXGoY8b.mjs → postgres-schema-CFOxDfUX-DTZtjh5X.mjs} +3 -3
- package/dist/{postgres-schema-KSzLDONj-CsXGoY8b.mjs.map → postgres-schema-CFOxDfUX-DTZtjh5X.mjs.map} +1 -1
- package/dist/{resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs → resolve-ddl-schema-BIy8VDVK-Cb6hoVTS.mjs} +3 -3
- package/dist/{resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs.map → resolve-ddl-schema-BIy8VDVK-Cb6hoVTS.mjs.map} +1 -1
- package/dist/{sql-renderer-CZE98PJj-Bx5D-Txz.mjs → sql-renderer-CZE98PJj-E5yVGXmL.mjs} +2 -2
- package/dist/{sql-renderer-CZE98PJj-Bx5D-Txz.mjs.map → sql-renderer-CZE98PJj-E5yVGXmL.mjs.map} +1 -1
- package/dist/target.d.mts +8 -8
- package/dist/target.mjs +19 -19
- package/dist/target__aggregates.mjs +1 -1
- package/dist/target__codec-ids.d.mts +3 -3
- package/dist/target__codec-ids.mjs +2 -2
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +3 -3
- package/dist/target__codecs.mjs +3 -3
- package/dist/target__contract-free.mjs +3 -3
- package/dist/target__control.mjs +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner-sql-checks.mjs +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__runtime.mjs +1 -1
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__schema-ir-annotations.mjs +1 -1
- package/dist/target__types.mjs +1 -1
- package/package.json +9 -9
- package/dist/aggregates-ftUgi-eC.mjs.map +0 -1
- package/dist/authoring-03FwIL2k-kPjZAp3s.mjs.map +0 -1
- package/dist/codec-ids-CsOU3xDv-mPI0INiF.d.mts.map +0 -1
- package/dist/codec-ids-fgafMLR7.d.mts +0 -1
- package/dist/codec-ids-tX7Svtz--BuOfRaVU.mjs.map +0 -1
- package/dist/codec-types-BHwY9Ff-.d.mts +0 -2
- package/dist/codec-types-mWhnDEAf-CAQzGFnF.d.mts.map +0 -1
- package/dist/codecs-CBl0nD44-CjInu_aV.mjs.map +0 -1
- package/dist/codecs-Cvqvb9pV-Cdc51FKY.d.mts.map +0 -1
- package/dist/codecs-DBn-uIv-.d.mts.map +0 -1
- package/dist/codecs-rujsdlZR.mjs.map +0 -1
- package/dist/pack-j8ePkv1A.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-migration-DJqjEDIS-CP437pha.mjs","names":["#endView","#startView"],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-migration-DJqjEDIS.mjs"],"sourcesContent":["import { t as errorPostgresMigrationStackMissing } from \"./errors-kYxOQjdD.mjs\";\nimport { _ as PostgresRlsPolicy } from \"./postgres-schema-KSzLDONj.mjs\";\nimport { A as RenamePostgresRlsPolicyCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, I as installExtension, M as SetNotNullCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as SetDefaultCall, k as RenameIndexCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, p as CreatePostgresRlsPolicyCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from \"./op-factory-call-rf1FJg8l.mjs\";\nimport { t as PostgresContractView } from \"./postgres-contract-view-FdLX7dV9.mjs\";\nimport { t as dataTransform } from \"./data-transform-ChZzy2dP.mjs\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/postgres-migration.ts\n/**\n* Target-owned base class for Postgres migrations.\n*\n* Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n* abstract `targetId` to the Postgres target-id string literal, so both\n* user-authored migrations and renderer-generated scaffolds (the output of\n* `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n* redeclaring target-local identity.\n*\n* Mirrors `MongoMigration` in `@internal/family-mongo`: the renderer\n* emits `extends Migration` against a facade re-export of this class\n* from `@internal/postgres/migration`, keeping the authoring surface\n* target-scoped rather than family-scoped.\n*\n* The constructor materializes a single Postgres `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n* instance method forwards to the free `dataTransform` factory with that\n* stored adapter, so user migrations can write `this.dataTransform(...)`\n* without threading the adapter through every call.\n*\n* Every method requires an explicit `schema`. Postgres migrations name their\n* schema deliberately — there is no default and no `search_path`-relative\n* option. A migration that left the schema unspecified would resolve against\n* whatever `search_path` the connection happened to carry, and that ambiguity\n* is an antipattern in a migration. (The unbound/unspecified namespace concept\n* remains for SQLite, which has no schemas, and for Mongo's connection `db`.)\n*/\nvar PostgresMigration = class extends Migration {\n\ttargetId = \"postgres\";\n\t/**\n\t* Materialized Postgres control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t#endView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? stack.adapter.create(stack) : void 0;\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorPostgresMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed, schema-qualified Postgres view over this migration's end-state\n\t* contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n\t* if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed Postgres view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\t/**\n\t* Instance-method wrapper around the free `dataTransform` factory that\n\t* supplies the stored control adapter. Authors call this from inside\n\t* `get operations()`; the adapter argument is hidden from the call site.\n\t*/\n\tdataTransform(contract, name, options) {\n\t\treturn dataTransform(contract, name, options, this.controlAdapterFor(\"dataTransform\"));\n\t}\n\t/**\n\t* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.schema, options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\t/**\n\t* Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateSchema(options) {\n\t\treturn new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor(\"createSchema\"));\n\t}\n\t/**\n\t* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n\t* native enum. Builds a typed DDL node and lowers it through the stored\n\t* control adapter (members render in declaration order). Throws if no adapter\n\t* is present.\n\t*/\n\tcreateNativeEnumType(options) {\n\t\treturn new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(this.controlAdapterFor(\"createNativeEnumType\"));\n\t}\n\t/**\n\t* Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n\t* through the stored control adapter. Throws if no adapter is present.\n\t*/\n\tdropNativeEnumType(options) {\n\t\treturn new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(this.controlAdapterFor(\"dropNativeEnumType\"));\n\t}\n\t/**\n\t* Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n\t* member to a managed native enum, lowered through the stored control\n\t* adapter. Throws if no adapter is present. Every appended value is its\n\t* own operation — call this once per value to append more than one.\n\t*/\n\taddNativeEnumValue(options) {\n\t\treturn new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(this.controlAdapterFor(\"addNativeEnumValue\"));\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"addColumn\"));\n\t}\n\taddPrimaryKey(options) {\n\t\treturn new AddPrimaryKeyCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addPrimaryKey\"));\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addUnique\"));\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(this.controlAdapterFor(\"addForeignKey\"));\n\t}\n\taddCheckConstraint(options) {\n\t\treturn new AddCheckConstraintCall(options.schema, options.table, options.constraint, options.expression).toOp(this.controlAdapterFor(\"addCheckConstraint\"));\n\t}\n\tdropCheckConstraint(options) {\n\t\treturn new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(this.controlAdapterFor(\"dropCheckConstraint\"));\n\t}\n\tdropConstraint(options) {\n\t\treturn new DropConstraintCall(options.schema, options.table, options.constraint, options.kind ?? \"unique\").toOp(this.controlAdapterFor(\"dropConstraint\"));\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.schema, options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\talterColumnType(options) {\n\t\treturn new AlterColumnTypeCall(options.schema, options.table, options.column, options.options).toOp(this.controlAdapterFor(\"alterColumnType\"));\n\t}\n\tsetNotNull(options) {\n\t\treturn new SetNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"setNotNull\"));\n\t}\n\tdropNotNull(options) {\n\t\treturn new DropNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropNotNull\"));\n\t}\n\tsetDefault(options) {\n\t\treturn new SetDefaultCall(options.schema, options.table, options.column, options.defaultSql, options.operationClass).toOp(this.controlAdapterFor(\"setDefault\"));\n\t}\n\tdropDefault(options) {\n\t\treturn new DropDefaultCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropDefault\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.schema, options.table, options.index, options.columns !== void 0 ? { columns: options.columns } : { expression: options.expression }, options.extras).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\trenameIndex(options) {\n\t\treturn new RenameIndexCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameIndex\"));\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.schema, options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\tinstallExtension(options) {\n\t\treturn installExtension(options, this.controlAdapterFor(\"installExtension\"));\n\t}\n\tenableRowLevelSecurity(options) {\n\t\treturn new EnableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"enableRowLevelSecurity\"));\n\t}\n\tdisableRowLevelSecurity(options) {\n\t\treturn new DisableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"disableRowLevelSecurity\"));\n\t}\n\tcreateRlsPolicy(options) {\n\t\treturn new CreatePostgresRlsPolicyCall(options.schema, options.table, new PostgresRlsPolicy({\n\t\t\t...options.policy,\n\t\t\tusing: options.policy.using,\n\t\t\twithCheck: options.policy.withCheck\n\t\t})).toOp(this.controlAdapterFor(\"createRlsPolicy\"));\n\t}\n\tdropRlsPolicy(options) {\n\t\treturn new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(this.controlAdapterFor(\"dropRlsPolicy\"));\n\t}\n\trenameRlsPolicy(options) {\n\t\treturn new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameRlsPolicy\"));\n\t}\n};\n//#endregion\nexport { PostgresMigration as t };\n\n//# sourceMappingURL=postgres-migration-DJqjEDIS.mjs.map"],"mappings":";;;;;;;;;;;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,CAAC,CAAC,KAAK,KAAK,kBAAkB,aAAa,CAAC;CAC/H;CACA,UAAU,SAAS;EAClB,OAAO,IAAI,cAAc,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,KAAK,kBAAkB,WAAW,CAAC;CAChH;CACA,iBAAiB,SAAS;EACzB,OAAO,iBAAiB,SAAS,KAAK,kBAAkB,kBAAkB,CAAC;CAC5E;CACA,uBAAuB,SAAS;EAC/B,OAAO,IAAI,2BAA2B,QAAQ,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,KAAK,kBAAkB,wBAAwB,CAAC;CAC3H;CACA,wBAAwB,SAAS;EAChC,OAAO,IAAI,4BAA4B,QAAQ,QAAQ,QAAQ,KAAK,CAAC,CAAC,KAAK,KAAK,kBAAkB,yBAAyB,CAAC;CAC7H;CACA,gBAAgB,SAAS;EACxB,OAAO,IAAI,4BAA4B,QAAQ,QAAQ,QAAQ,OAAO,IAAI,kBAAkB;GAC3F,GAAG,QAAQ;GACX,OAAO,QAAQ,OAAO;GACtB,WAAW,QAAQ,OAAO;EAC3B,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,kBAAkB,iBAAiB,CAAC;CACnD;CACA,cAAc,SAAS;EACtB,OAAO,IAAI,0BAA0B,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,KAAK,kBAAkB,eAAe,CAAC;CACjI;CACA,gBAAgB,SAAS;EACxB,OAAO,IAAI,4BAA4B,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM,QAAQ,EAAE,CAAC,CAAC,KAAK,KAAK,kBAAkB,iBAAiB,CAAC;CAC/I;AACD"}
|
|
1
|
+
{"version":3,"file":"postgres-migration-Cp9IRLdW-BEL9GAjb.mjs","names":["#endView","#startView"],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-migration-Cp9IRLdW.mjs"],"sourcesContent":["import { t as errorPostgresMigrationStackMissing } from \"./errors-kYxOQjdD.mjs\";\nimport { _ as PostgresRlsPolicy } from \"./postgres-schema-CFOxDfUX.mjs\";\nimport { A as RenamePostgresRlsPolicyCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, I as installExtension, M as SetNotNullCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as SetDefaultCall, k as RenameIndexCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, p as CreatePostgresRlsPolicyCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from \"./op-factory-call-B3DVhHrC.mjs\";\nimport { t as PostgresContractView } from \"./postgres-contract-view-B_0-lbVi.mjs\";\nimport { t as dataTransform } from \"./data-transform-ChZzy2dP.mjs\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/postgres-migration.ts\n/**\n* Target-owned base class for Postgres migrations.\n*\n* Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n* abstract `targetId` to the Postgres target-id string literal, so both\n* user-authored migrations and renderer-generated scaffolds (the output of\n* `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n* redeclaring target-local identity.\n*\n* Mirrors `MongoMigration` in `@internal/family-mongo`: the renderer\n* emits `extends Migration` against a facade re-export of this class\n* from `@internal/postgres/migration`, keeping the authoring surface\n* target-scoped rather than family-scoped.\n*\n* The constructor materializes a single Postgres `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n* instance method forwards to the free `dataTransform` factory with that\n* stored adapter, so user migrations can write `this.dataTransform(...)`\n* without threading the adapter through every call.\n*\n* Every method requires an explicit `schema`. Postgres migrations name their\n* schema deliberately — there is no default and no `search_path`-relative\n* option. A migration that left the schema unspecified would resolve against\n* whatever `search_path` the connection happened to carry, and that ambiguity\n* is an antipattern in a migration. (The unbound/unspecified namespace concept\n* remains for SQLite, which has no schemas, and for Mongo's connection `db`.)\n*/\nvar PostgresMigration = class extends Migration {\n\ttargetId = \"postgres\";\n\t/**\n\t* Materialized Postgres control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t#endView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? stack.adapter.create(stack) : void 0;\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorPostgresMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed, schema-qualified Postgres view over this migration's end-state\n\t* contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n\t* if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed Postgres view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\t/**\n\t* Instance-method wrapper around the free `dataTransform` factory that\n\t* supplies the stored control adapter. Authors call this from inside\n\t* `get operations()`; the adapter argument is hidden from the call site.\n\t*/\n\tdataTransform(contract, name, options) {\n\t\treturn dataTransform(contract, name, options, this.controlAdapterFor(\"dataTransform\"));\n\t}\n\t/**\n\t* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.schema, options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\t/**\n\t* Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateSchema(options) {\n\t\treturn new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor(\"createSchema\"));\n\t}\n\t/**\n\t* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n\t* native enum. Builds a typed DDL node and lowers it through the stored\n\t* control adapter (members render in declaration order). Throws if no adapter\n\t* is present.\n\t*/\n\tcreateNativeEnumType(options) {\n\t\treturn new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(this.controlAdapterFor(\"createNativeEnumType\"));\n\t}\n\t/**\n\t* Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n\t* through the stored control adapter. Throws if no adapter is present.\n\t*/\n\tdropNativeEnumType(options) {\n\t\treturn new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(this.controlAdapterFor(\"dropNativeEnumType\"));\n\t}\n\t/**\n\t* Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n\t* member to a managed native enum, lowered through the stored control\n\t* adapter. Throws if no adapter is present. Every appended value is its\n\t* own operation — call this once per value to append more than one.\n\t*/\n\taddNativeEnumValue(options) {\n\t\treturn new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(this.controlAdapterFor(\"addNativeEnumValue\"));\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"addColumn\"));\n\t}\n\taddPrimaryKey(options) {\n\t\treturn new AddPrimaryKeyCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addPrimaryKey\"));\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addUnique\"));\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(this.controlAdapterFor(\"addForeignKey\"));\n\t}\n\taddCheckConstraint(options) {\n\t\treturn new AddCheckConstraintCall(options.schema, options.table, options.constraint, options.expression).toOp(this.controlAdapterFor(\"addCheckConstraint\"));\n\t}\n\tdropCheckConstraint(options) {\n\t\treturn new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(this.controlAdapterFor(\"dropCheckConstraint\"));\n\t}\n\tdropConstraint(options) {\n\t\treturn new DropConstraintCall(options.schema, options.table, options.constraint, options.kind ?? \"unique\").toOp(this.controlAdapterFor(\"dropConstraint\"));\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.schema, options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\talterColumnType(options) {\n\t\treturn new AlterColumnTypeCall(options.schema, options.table, options.column, options.options).toOp(this.controlAdapterFor(\"alterColumnType\"));\n\t}\n\tsetNotNull(options) {\n\t\treturn new SetNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"setNotNull\"));\n\t}\n\tdropNotNull(options) {\n\t\treturn new DropNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropNotNull\"));\n\t}\n\tsetDefault(options) {\n\t\treturn new SetDefaultCall(options.schema, options.table, options.column, options.defaultSql, options.operationClass).toOp(this.controlAdapterFor(\"setDefault\"));\n\t}\n\tdropDefault(options) {\n\t\treturn new DropDefaultCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropDefault\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.schema, options.table, options.index, options.columns !== void 0 ? { columns: options.columns } : { expression: options.expression }, options.extras).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\trenameIndex(options) {\n\t\treturn new RenameIndexCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameIndex\"));\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.schema, options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\tinstallExtension(options) {\n\t\treturn installExtension(options, this.controlAdapterFor(\"installExtension\"));\n\t}\n\tenableRowLevelSecurity(options) {\n\t\treturn new EnableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"enableRowLevelSecurity\"));\n\t}\n\tdisableRowLevelSecurity(options) {\n\t\treturn new DisableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"disableRowLevelSecurity\"));\n\t}\n\tcreateRlsPolicy(options) {\n\t\treturn new CreatePostgresRlsPolicyCall(options.schema, options.table, new PostgresRlsPolicy({\n\t\t\t...options.policy,\n\t\t\tusing: options.policy.using,\n\t\t\twithCheck: options.policy.withCheck\n\t\t})).toOp(this.controlAdapterFor(\"createRlsPolicy\"));\n\t}\n\tdropRlsPolicy(options) {\n\t\treturn new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(this.controlAdapterFor(\"dropRlsPolicy\"));\n\t}\n\trenameRlsPolicy(options) {\n\t\treturn new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameRlsPolicy\"));\n\t}\n};\n//#endregion\nexport { PostgresMigration as t };\n\n//# sourceMappingURL=postgres-migration-Cp9IRLdW.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAI,oBAAoB,cAAc,UAAU;CAC/C,WAAW;;;;;;;CAOX;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
|
|
3
3
|
import { t as escapeLiteral } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
|
|
4
4
|
import { TableSource } from "@prisma/orm-family-sql/relational-core/ast";
|
|
@@ -11,7 +11,7 @@ import { nameOf, parseNaming } from "@prisma/orm-family-sql/schema-ir/naming";
|
|
|
11
11
|
import { invariant } from "@prisma/orm-framework/utils/assertions";
|
|
12
12
|
import { composeSqlEntityKinds } from "@prisma/orm-family-sql/contract/entity-kinds";
|
|
13
13
|
import { cfExpr } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
14
|
-
//#region ../../../3-targets/3-targets/postgres/dist/postgres-schema-
|
|
14
|
+
//#region ../../../3-targets/3-targets/postgres/dist/postgres-schema-CFOxDfUX.mjs
|
|
15
15
|
/**
|
|
16
16
|
* Postgres contract-IR marker for `@@rls` on a model: the table named here is
|
|
17
17
|
* RLS-controlled (`ENABLE ROW LEVEL SECURITY` is driven by this marker, never
|
|
@@ -418,4 +418,4 @@ function postgresCreateNamespace(input) {
|
|
|
418
418
|
//#endregion
|
|
419
419
|
export { roleEntityKind as _, PostgresRlsPolicySchema as a, PostgresSchema as c, isPostgresSchema as d, nativeEnumEntityKind as f, rlsEnablementEntityKind as g, postgresCreateNamespace as h, PostgresRlsPolicy as i, PostgresTableSource as l, policyInputFromSerialized as m, PostgresRlsEnablement as n, PostgresRole as o, policyEntityKind as p, PostgresRlsEnablementSchema as r, PostgresRoleSchema as s, PostgresNativeEnumSchema as t, PostgresUnboundSchema as u };
|
|
420
420
|
|
|
421
|
-
//# sourceMappingURL=postgres-schema-
|
|
421
|
+
//# sourceMappingURL=postgres-schema-CFOxDfUX-DTZtjh5X.mjs.map
|
package/dist/{postgres-schema-KSzLDONj-CsXGoY8b.mjs.map → postgres-schema-CFOxDfUX-DTZtjh5X.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-schema-KSzLDONj-CsXGoY8b.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-schema-KSzLDONj.mjs"],"sourcesContent":["import { b as PG_TEXT_CODEC_ID } from \"./codec-ids-tX7Svtz-.mjs\";\nimport { t as PostgresNativeEnum } from \"./postgres-native-enum-CdP3b_-R.mjs\";\nimport { t as escapeLiteral } from \"./sql-utils-BnBlQxyh.mjs\";\nimport { TableSource } from \"@internal/sql-relational-core/ast\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { type } from \"arktype\";\nimport { SqlNamespaceBase, SqlNode } from \"@internal/sql-contract/types\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { nameOf, parseNaming } from \"@internal/sql-schema-ir/naming\";\nimport { invariant } from \"@internal/utils/assertions\";\nimport { composeSqlEntityKinds } from \"@internal/sql-contract/entity-kinds\";\nimport { cfExpr } from \"@internal/sql-relational-core/contract-free\";\n//#region src/core/postgres-rls-enablement.ts\n/**\n* Postgres contract-IR marker for `@@rls` on a model: the table named here is\n* RLS-controlled (`ENABLE ROW LEVEL SECURITY` is driven by this marker, never\n* by the policy set).\n*\n* This is an authored, serialized Contract-IR entity — it is registered as an\n* entity kind, extends `SqlNode`, and is stored in `contract.json` under\n* `entries.rls[tableName]`. Target-only concept — no SQL-family abstract.\n* Frozen at construction via `freezeNode(this)`. The `kind: 'rls'`\n* discriminant is enumerable so it survives JSON serialization; the literal\n* matches the entries key (one-string rule).\n*/\nvar PostgresRlsEnablement = class extends SqlNode {\n\tkind = \"rls\";\n\ttableName;\n\tnamespaceId;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.tableName = input.tableName;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/core/postgres-rls-policy.ts\n/**\n* Postgres contract-IR class for a row-level security policy (`CREATE POLICY … ON …`).\n*\n* This is an authored, serialized Contract-IR entity — it is registered as an entity\n* kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n* the schema-diff tree uses `PostgresPolicySchemaNode` for that role.\n*\n* Target-only concept — no SQL-family abstract. Extends `SqlNode` directly.\n* Frozen at construction via `freezeNode(this)`. The `kind: 'policy'`\n* discriminant is enumerable (overrides SqlNode's non-enumerable `'sql'`) so it\n* survives JSON serialization and enables dispatch. The literal matches the\n* entries key (one-string rule: node.kind === entries key === entity kind).\n*/\nvar PostgresRlsPolicy = class extends SqlNode {\n\tkind = \"policy\";\n\tname;\n\ttableName;\n\tnamespaceId;\n\toperation;\n\troles;\n\tpermissive;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = nameOf(input.naming);\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tthis.tableName = input.tableName;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tthis.operation = input.operation;\n\t\tthis.roles = Object.freeze([...input.roles]);\n\t\tif (input.using !== void 0) this.using = input.using;\n\t\tif (input.withCheck !== void 0) this.withCheck = input.withCheck;\n\t\tthis.permissive = input.permissive;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/core/postgres-role.ts\n/**\n* Roles are referenced by the contract but never owned — the framework\n* issues no `CREATE`/`DROP ROLE`, so a role's effective governance is always\n* `external`: a missing declared role fails verify, an extra live role is\n* tolerated, and the planner emits zero role DDL. `external` is the only\n* value a role's control can ever carry.\n*/\nconst ROLE_DEFAULT_CONTROL_POLICY = \"external\";\n/**\n* Postgres contract-IR class for a database role (`CREATE ROLE …`).\n*\n* This is an authored, serialized Contract-IR entity — it is registered as an entity\n* kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n* the schema-diff tree uses `PostgresRoleSchemaNode` for that role.\n*\n* Roles are cluster-scoped, so their namespace coordinate is always\n* `UNBOUND_NAMESPACE_ID`. Target-only concept — no SQL-family abstract.\n* Extends `SqlNode` directly, frozen at construction via `freezeNode(this)`.\n* The `kind: 'role'` discriminant is enumerable so it survives JSON.\n* Matches the entries key (one-string rule).\n*\n* `control` always carries a value (never omitted): it defaults to\n* {@link ROLE_DEFAULT_CONTROL_POLICY} in the constructor, so both a\n* freshly-authored role and one hydrated from an older `contract.json`\n* lacking the field resolve the same way — the control-policy resolver\n* reads it directly off the entity instead of special-casing role issues.\n*/\nvar PostgresRole = class extends SqlNode {\n\tkind = \"role\";\n\tname;\n\tnamespaceId;\n\tcontrol;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tthis.control = input.control ?? \"external\";\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/core/postgres-validators.ts\nconst PostgresRoleSchema = type({\n\tkind: \"'role'\",\n\tname: \"string\",\n\tnamespaceId: \"string\",\n\t\"control?\": \"'external'\"\n});\nconst PostgresRlsPolicySchema = type({\n\tkind: \"'policy'\",\n\tname: \"string\",\n\t\"prefix?\": \"string\",\n\ttableName: \"string\",\n\tnamespaceId: \"string\",\n\toperation: \"'select' | 'insert' | 'update' | 'delete' | 'all'\",\n\troles: type.string.array().readonly(),\n\t\"using?\": \"string\",\n\t\"withCheck?\": \"string\",\n\tpermissive: \"boolean\"\n});\nconst PostgresRlsEnablementSchema = type({\n\tkind: \"'rls'\",\n\ttableName: \"string\",\n\tnamespaceId: \"string\"\n});\nconst PostgresNativeEnumSchema = type({\n\tkind: \"'postgres-enum'\",\n\ttypeName: \"string\",\n\tmembers: type.string.array().readonly(),\n\t\"control?\": \"'managed' | 'tolerated' | 'external' | 'observed'\"\n});\n//#endregion\n//#region src/core/ast/table-source.ts\nvar PostgresTableSource = class extends TableSource {\n\tschema;\n\tconstructor(options) {\n\t\tsuper(options.name, options.alias);\n\t\tthis.schema = options.schema;\n\t\tthis.freeze();\n\t}\n\trewrite(rewriter) {\n\t\treturn rewriter.tableSource ? rewriter.tableSource(this) : this;\n\t}\n};\n//#endregion\n//#region src/core/serialized-rls-policy.ts\n/**\n* Hydrates one stored policy into constructor input. The name and the prefix\n* are separate fields in the file and can disagree there, so the pair is\n* checked on the way in.\n*/\nfunction policyInputFromSerialized(flat) {\n\treturn {\n\t\tnaming: parseNaming(flat.name, flat.prefix),\n\t\ttableName: flat.tableName,\n\t\tnamespaceId: flat.namespaceId,\n\t\toperation: flat.operation,\n\t\troles: flat.roles,\n\t\tusing: flat.using,\n\t\twithCheck: flat.withCheck,\n\t\tpermissive: flat.permissive\n\t};\n}\n//#endregion\n//#region src/core/entity-kinds.ts\nconst policyEntityKind = {\n\tkind: \"policy\",\n\tschema: PostgresRlsPolicySchema,\n\tconstruct: (input) => new PostgresRlsPolicy(policyInputFromSerialized(input))\n};\nconst roleEntityKind = {\n\tkind: \"role\",\n\tschema: PostgresRoleSchema,\n\tconstruct: (input) => new PostgresRole(input)\n};\nconst rlsEnablementEntityKind = {\n\tkind: \"rls\",\n\tschema: PostgresRlsEnablementSchema,\n\tconstruct: (input) => new PostgresRlsEnablement(input)\n};\nconst nativeEnumEntityKind = {\n\tkind: \"native_enum\",\n\tschema: PostgresNativeEnumSchema,\n\tconstruct: (input) => new PostgresNativeEnum(input)\n};\n//#endregion\n//#region src/core/postgres-schema.ts\n/**\n* Postgres target `Namespace` concretion — a Postgres schema (`CREATE\n* SCHEMA …`). Each Postgres `SqlStorage` carries a\n* `namespaces: Record<NamespaceId, PostgresSchema>` map populated by\n* the Postgres PSL interpreter from `namespace { … }` AST buckets.\n*\n* `entries` holds entity-kind maps (`table`, `valueSet`). Qualifier\n* emission is the rendering seam: DDL / SQL emission asks the namespace\n* for its qualifier (`\"<schema>\"`) or for a qualified table name\n* (`\"<schema>\".\"<table>\"`) and consumes the result polymorphically.\n* The unbound singleton below overrides these methods to elide the\n* prefix entirely — call sites stay polymorphic and never branch on\n* `id === UNBOUND_NAMESPACE_ID`.\n*/\nvar PostgresSchema = class extends SqlNamespaceBase {\n\t/**\n\t* Stable singleton reference for the late-bound slot. Materialised\n\t* lazily below the singleton subclass declaration so the static\n\t* initialiser sees the subclass before assigning. Consumers always\n\t* reach for `PostgresSchema.unbound` (or `PostgresUnboundSchema.instance`\n\t* — same identity).\n\t*/\n\tstatic unbound;\n\tid;\n\tentries;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.id = input.id;\n\t\tconst dispatched = hydrateNamespaceEntities(input.entries, composeSqlEntityKinds([\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind\n\t\t]), \"carry\");\n\t\tconst nativeEnumSlot = dispatched[\"native_enum\"];\n\t\tif (nativeEnumSlot !== void 0) {\n\t\t\tconst rekeyed = {};\n\t\t\tfor (const [handle, entity] of Object.entries(nativeEnumSlot)) {\n\t\t\t\tconst physicalName = PostgresNativeEnum.is(entity) ? entity.typeName : handle;\n\t\t\t\tinvariant(!Object.hasOwn(rekeyed, physicalName), `PostgresSchema \"${input.id}\": two native_enum entities resolve to the same physical type name \"${physicalName}\". Give them distinct @@map type names.`);\n\t\t\t\trekeyed[physicalName] = entity;\n\t\t\t}\n\t\t\tdispatched[\"native_enum\"] = Object.freeze(rekeyed);\n\t\t}\n\t\tconst valueSetRaw = dispatched[\"valueSet\"];\n\t\tconst entriesInput = { ...valueSetRaw !== void 0 && Object.keys(valueSetRaw).length === 0 ? {\n\t\t\t...dispatched,\n\t\t\tvalueSet: void 0\n\t\t} : dispatched };\n\t\tthis.entries = Object.freeze(blindCast(entriesInput));\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"schema\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n\tget table() {\n\t\treturn this.entries.table ?? Object.freeze({});\n\t}\n\tget valueSet() {\n\t\treturn this.entries.valueSet;\n\t}\n\tget policy() {\n\t\treturn this.entries.policy ?? Object.freeze({});\n\t}\n\tget role() {\n\t\treturn this.entries.role ?? Object.freeze({});\n\t}\n\tget rls() {\n\t\treturn this.entries.rls ?? Object.freeze({});\n\t}\n\t/**\n\t* The bare schema qualifier as it would appear in a rendered SQL\n\t* fragment (already quoted). The unbound-schema singleton overrides\n\t* this to return `''`.\n\t*/\n\tqualifier() {\n\t\treturn `\"${this.id}\"`;\n\t}\n\t/**\n\t* Qualify a table name with the schema prefix\n\t* (`\"<schema>\".\"<table>\"`). The unbound-schema singleton overrides\n\t* this to emit just `\"<table>\"` so the resolved DDL is unqualified\n\t* and `search_path` decides where the object lands at runtime.\n\t*/\n\tqualifyTable(tableName) {\n\t\treturn `\"${this.id}\".\"${tableName}\"`;\n\t}\n\t/**\n\t* Render a SQL string-literal containing the qualified-name form\n\t* suitable for `to_regclass(...)` arguments (e.g. `'\"public\".\"user\"'`).\n\t* The unbound singleton overrides this to elide the schema prefix\n\t* (`'\"user\"'`) so `search_path` resolves the object at runtime.\n\t*/\n\tregclassLiteral(name) {\n\t\treturn `'${escapeLiteral(this.qualifyTable(name))}'`;\n\t}\n\t/**\n\t* Render a SQL expression that evaluates to this namespace's schema\n\t* name at runtime, ready to drop into a `WHERE table_schema = …` /\n\t* `WHERE n.nspname = …` clause. Named schemas emit a quoted SQL\n\t* literal (`'public'`); the unbound singleton overrides this to emit\n\t* `current_schema()` so catalog queries match whichever schema the\n\t* connection's `search_path` resolved at runtime.\n\t*/\n\tschemaSqlExpression() {\n\t\treturn `'${escapeLiteral(this.id)}'`;\n\t}\n\t/**\n\t* Typed-AST counterpart of {@link schemaSqlExpression}: the expression a\n\t* builder-built catalog check compares `n.nspname` / `table_schema`\n\t* against. Named schemas bind the schema name as a text parameter; the\n\t* unbound singleton overrides this to the opaque `current_schema()`\n\t* expression so the live connection's `search_path` decides at runtime.\n\t*/\n\tschemaFilterExpression() {\n\t\treturn cfExpr.param(this.id, PG_TEXT_CODEC_ID);\n\t}\n\t/**\n\t* Typed-AST counterpart of {@link qualifyTable}: the FROM source a\n\t* builder-built check uses to address a user table in this namespace.\n\t* Named schemas qualify (`\"schema\".\"table\"`); the unbound singleton\n\t* overrides this to leave the table unqualified so `search_path`\n\t* resolves it at runtime.\n\t*/\n\ttableSource(tableName, alias) {\n\t\treturn new PostgresTableSource({\n\t\t\tname: tableName,\n\t\t\tschema: this.id,\n\t\t\t...ifDefined(\"alias\", alias)\n\t\t});\n\t}\n\t/**\n\t* The bare schema name a DDL planner should target when emitting\n\t* statements that need to identify this namespace in the live\n\t* database (e.g. `CREATE TABLE \"<ddlSchemaName>\".\"<table>\" …`,\n\t* catalog filters, planner conflict lookups). Named schemas resolve\n\t* to their own id. The `PostgresUnboundSchema` singleton inherits\n\t* this and returns `UNBOUND_NAMESPACE_ID` — callers that dispatch\n\t* through `qualifyTableName` route through the polymorphic\n\t* `PostgresUnboundSchema` overrides and produce unqualified\n\t* (search-path-resolved) output automatically.\n\t*/\n\tddlSchemaName(_storage) {\n\t\treturn this.id;\n\t}\n};\n/**\n* Singleton subclass for the reserved sentinel namespace id\n* (`UNBOUND_NAMESPACE_ID`) — the late-bound Postgres slot whose binding\n* the connection's `search_path` resolves at runtime. Overrides\n* qualifier emission to elide the schema prefix; call sites that consume\n* `qualifier()` / `qualifyTable()` get unqualified output without\n* branching on the namespace id.\n*\n* This is the target-side materialization of \"the framework provides\n* affordances; targets implement specifics\": the framework names the\n* sentinel; Postgres decides what late-bound means here (the table\n* name, naked — the schema is supplied by the live connection's\n* `search_path`).\n*\n* `ddlSchemaName` is inherited from `PostgresSchema` and returns\n* `UNBOUND_NAMESPACE_ID`. Downstream helpers such as `qualifyTableName`\n* route through the polymorphic factory and produce unqualified output\n* automatically.\n*/\nvar PostgresUnboundSchema = class PostgresUnboundSchema extends PostgresSchema {\n\tstatic instance = new PostgresUnboundSchema();\n\tconstructor(input) {\n\t\tsuper(input ?? {\n\t\t\tid: UNBOUND_NAMESPACE_ID,\n\t\t\tentries: { table: {} }\n\t\t});\n\t}\n\tqualifier() {\n\t\treturn \"\";\n\t}\n\tqualifyTable(tableName) {\n\t\treturn `\"${tableName}\"`;\n\t}\n\tschemaSqlExpression() {\n\t\treturn \"current_schema()\";\n\t}\n\tschemaFilterExpression() {\n\t\treturn cfExpr.raw(\"current_schema()\", {\n\t\t\tcodecId: PG_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t});\n\t}\n\ttableSource(tableName, alias) {\n\t\treturn new PostgresTableSource({\n\t\t\tname: tableName,\n\t\t\t...ifDefined(\"alias\", alias)\n\t\t});\n\t}\n};\nPostgresSchema.unbound = PostgresUnboundSchema.instance;\n/**\n* Narrow an arbitrary namespace (or `undefined`) to `PostgresSchema`\n* so callers can dispatch to the polymorphic emission methods without\n* branching at the call site. Uses the structural `kind` discriminator\n* (`'schema'`) rather than `instanceof` so the check survives realm /\n* bundle / hot-reload boundaries — matching the rest of the IR's\n* narrowing convention. `PostgresUnboundSchema` passes through because\n* it inherits the same `kind: 'schema'` from `PostgresSchema`.\n*/\nfunction isPostgresSchema(ns) {\n\treturn ns?.kind === \"schema\";\n}\n/**\n* Target-supplied `Namespace` factory the Postgres target plumbs\n* through `defineContract({ createNamespace })` and the SQL PSL\n* interpreter. Returns the unbound singleton for the framework\n* sentinel and a fresh `PostgresSchema` for any other coordinate.\n*\n* The factory has no per-call state — every named id deterministically\n* maps to a distinct schema instance — so callers can pass it through\n* by reference and trust the resulting `SqlStorage.namespaces` map to\n* be value-stable for a given input set. Native-enum column type names are\n* schema-qualified earlier, at column construction, via the target's\n* `authoring.qualifyColumnType` hook (`postgresQualifyColumnType`), so this\n* factory just materialises the namespace from already-qualified entries.\n*/\nfunction postgresCreateNamespace(input) {\n\tconst schemaInput = {\n\t\tid: input.id,\n\t\tentries: {\n\t\t\t...input.entries,\n\t\t\ttable: input.entries[\"table\"] ?? {}\n\t\t}\n\t};\n\tif (input.id === UNBOUND_NAMESPACE_ID) return new PostgresUnboundSchema(schemaInput);\n\treturn new PostgresSchema(schemaInput);\n}\n//#endregion\nexport { PostgresRlsPolicy as _, nativeEnumEntityKind as a, roleEntityKind as c, PostgresNativeEnumSchema as d, PostgresRlsEnablementSchema as f, ROLE_DEFAULT_CONTROL_POLICY as g, PostgresRole as h, postgresCreateNamespace as i, policyInputFromSerialized as l, PostgresRoleSchema as m, PostgresUnboundSchema as n, policyEntityKind as o, PostgresRlsPolicySchema as p, isPostgresSchema as r, rlsEnablementEntityKind as s, PostgresSchema as t, PostgresTableSource as u, PostgresRlsEnablement as v };\n\n//# sourceMappingURL=postgres-schema-KSzLDONj.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAI,wBAAwB,cAAc,QAAQ;CACjD,OAAO;CACP;CACA;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,YAAY,MAAM;EACvB,KAAK,cAAc,MAAM;EACzB,WAAW,IAAI;CAChB;AACD;;;;;;;;;;;;;;AAgBA,IAAI,oBAAoB,cAAc,QAAQ;CAC7C,OAAO;CACP;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,OAAO,OAAO,MAAM,MAAM;EAC/B,IAAI,MAAM,OAAO,SAAS,QAAQ,KAAK,SAAS,MAAM,OAAO;EAC7D,KAAK,YAAY,MAAM;EACvB,KAAK,cAAc,MAAM;EACzB,KAAK,YAAY,MAAM;EACvB,KAAK,QAAQ,OAAO,OAAO,CAAC,GAAG,MAAM,KAAK,CAAC;EAC3C,IAAI,MAAM,UAAU,KAAK,GAAG,KAAK,QAAQ,MAAM;EAC/C,IAAI,MAAM,cAAc,KAAK,GAAG,KAAK,YAAY,MAAM;EACvD,KAAK,aAAa,MAAM;EACxB,WAAW,IAAI;CAChB;AACD;;;;;;;;;;;;;;;;;;;;AA8BA,IAAI,eAAe,cAAc,QAAQ;CACxC,OAAO;CACP;CACA;CACA;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,OAAO,MAAM;EAClB,KAAK,cAAc,MAAM;EACzB,KAAK,UAAU,MAAM,WAAW;EAChC,WAAW,IAAI;CAChB;AACD;AAGA,MAAM,qBAAqB,KAAK;CAC/B,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wB,OAAO;CACvC,MAAM,cAAc;EACnB,IAAI,MAAM;EACV,SAAS;GACR,GAAG,MAAM;GACT,OAAO,MAAM,QAAQ,YAAY,CAAC;EACnC;CACD;CACA,IAAI,MAAM,OAAO,sBAAsB,OAAO,IAAI,sBAAsB,WAAW;CACnF,OAAO,IAAI,eAAe,WAAW;AACtC"}
|
|
1
|
+
{"version":3,"file":"postgres-schema-CFOxDfUX-DTZtjh5X.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-schema-CFOxDfUX.mjs"],"sourcesContent":["import { x as PG_TEXT_CODEC_ID } from \"./codec-ids-C5Rkltkw.mjs\";\nimport { t as PostgresNativeEnum } from \"./postgres-native-enum-CdP3b_-R.mjs\";\nimport { t as escapeLiteral } from \"./sql-utils-BnBlQxyh.mjs\";\nimport { TableSource } from \"@internal/sql-relational-core/ast\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { type } from \"arktype\";\nimport { SqlNamespaceBase, SqlNode } from \"@internal/sql-contract/types\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { nameOf, parseNaming } from \"@internal/sql-schema-ir/naming\";\nimport { invariant } from \"@internal/utils/assertions\";\nimport { composeSqlEntityKinds } from \"@internal/sql-contract/entity-kinds\";\nimport { cfExpr } from \"@internal/sql-relational-core/contract-free\";\n//#region src/core/postgres-rls-enablement.ts\n/**\n* Postgres contract-IR marker for `@@rls` on a model: the table named here is\n* RLS-controlled (`ENABLE ROW LEVEL SECURITY` is driven by this marker, never\n* by the policy set).\n*\n* This is an authored, serialized Contract-IR entity — it is registered as an\n* entity kind, extends `SqlNode`, and is stored in `contract.json` under\n* `entries.rls[tableName]`. Target-only concept — no SQL-family abstract.\n* Frozen at construction via `freezeNode(this)`. The `kind: 'rls'`\n* discriminant is enumerable so it survives JSON serialization; the literal\n* matches the entries key (one-string rule).\n*/\nvar PostgresRlsEnablement = class extends SqlNode {\n\tkind = \"rls\";\n\ttableName;\n\tnamespaceId;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.tableName = input.tableName;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/core/postgres-rls-policy.ts\n/**\n* Postgres contract-IR class for a row-level security policy (`CREATE POLICY … ON …`).\n*\n* This is an authored, serialized Contract-IR entity — it is registered as an entity\n* kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n* the schema-diff tree uses `PostgresPolicySchemaNode` for that role.\n*\n* Target-only concept — no SQL-family abstract. Extends `SqlNode` directly.\n* Frozen at construction via `freezeNode(this)`. The `kind: 'policy'`\n* discriminant is enumerable (overrides SqlNode's non-enumerable `'sql'`) so it\n* survives JSON serialization and enables dispatch. The literal matches the\n* entries key (one-string rule: node.kind === entries key === entity kind).\n*/\nvar PostgresRlsPolicy = class extends SqlNode {\n\tkind = \"policy\";\n\tname;\n\ttableName;\n\tnamespaceId;\n\toperation;\n\troles;\n\tpermissive;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = nameOf(input.naming);\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tthis.tableName = input.tableName;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tthis.operation = input.operation;\n\t\tthis.roles = Object.freeze([...input.roles]);\n\t\tif (input.using !== void 0) this.using = input.using;\n\t\tif (input.withCheck !== void 0) this.withCheck = input.withCheck;\n\t\tthis.permissive = input.permissive;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/core/postgres-role.ts\n/**\n* Roles are referenced by the contract but never owned — the framework\n* issues no `CREATE`/`DROP ROLE`, so a role's effective governance is always\n* `external`: a missing declared role fails verify, an extra live role is\n* tolerated, and the planner emits zero role DDL. `external` is the only\n* value a role's control can ever carry.\n*/\nconst ROLE_DEFAULT_CONTROL_POLICY = \"external\";\n/**\n* Postgres contract-IR class for a database role (`CREATE ROLE …`).\n*\n* This is an authored, serialized Contract-IR entity — it is registered as an entity\n* kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n* the schema-diff tree uses `PostgresRoleSchemaNode` for that role.\n*\n* Roles are cluster-scoped, so their namespace coordinate is always\n* `UNBOUND_NAMESPACE_ID`. Target-only concept — no SQL-family abstract.\n* Extends `SqlNode` directly, frozen at construction via `freezeNode(this)`.\n* The `kind: 'role'` discriminant is enumerable so it survives JSON.\n* Matches the entries key (one-string rule).\n*\n* `control` always carries a value (never omitted): it defaults to\n* {@link ROLE_DEFAULT_CONTROL_POLICY} in the constructor, so both a\n* freshly-authored role and one hydrated from an older `contract.json`\n* lacking the field resolve the same way — the control-policy resolver\n* reads it directly off the entity instead of special-casing role issues.\n*/\nvar PostgresRole = class extends SqlNode {\n\tkind = \"role\";\n\tname;\n\tnamespaceId;\n\tcontrol;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tthis.control = input.control ?? \"external\";\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/core/postgres-validators.ts\nconst PostgresRoleSchema = type({\n\tkind: \"'role'\",\n\tname: \"string\",\n\tnamespaceId: \"string\",\n\t\"control?\": \"'external'\"\n});\nconst PostgresRlsPolicySchema = type({\n\tkind: \"'policy'\",\n\tname: \"string\",\n\t\"prefix?\": \"string\",\n\ttableName: \"string\",\n\tnamespaceId: \"string\",\n\toperation: \"'select' | 'insert' | 'update' | 'delete' | 'all'\",\n\troles: type.string.array().readonly(),\n\t\"using?\": \"string\",\n\t\"withCheck?\": \"string\",\n\tpermissive: \"boolean\"\n});\nconst PostgresRlsEnablementSchema = type({\n\tkind: \"'rls'\",\n\ttableName: \"string\",\n\tnamespaceId: \"string\"\n});\nconst PostgresNativeEnumSchema = type({\n\tkind: \"'postgres-enum'\",\n\ttypeName: \"string\",\n\tmembers: type.string.array().readonly(),\n\t\"control?\": \"'managed' | 'tolerated' | 'external' | 'observed'\"\n});\n//#endregion\n//#region src/core/ast/table-source.ts\nvar PostgresTableSource = class extends TableSource {\n\tschema;\n\tconstructor(options) {\n\t\tsuper(options.name, options.alias);\n\t\tthis.schema = options.schema;\n\t\tthis.freeze();\n\t}\n\trewrite(rewriter) {\n\t\treturn rewriter.tableSource ? rewriter.tableSource(this) : this;\n\t}\n};\n//#endregion\n//#region src/core/serialized-rls-policy.ts\n/**\n* Hydrates one stored policy into constructor input. The name and the prefix\n* are separate fields in the file and can disagree there, so the pair is\n* checked on the way in.\n*/\nfunction policyInputFromSerialized(flat) {\n\treturn {\n\t\tnaming: parseNaming(flat.name, flat.prefix),\n\t\ttableName: flat.tableName,\n\t\tnamespaceId: flat.namespaceId,\n\t\toperation: flat.operation,\n\t\troles: flat.roles,\n\t\tusing: flat.using,\n\t\twithCheck: flat.withCheck,\n\t\tpermissive: flat.permissive\n\t};\n}\n//#endregion\n//#region src/core/entity-kinds.ts\nconst policyEntityKind = {\n\tkind: \"policy\",\n\tschema: PostgresRlsPolicySchema,\n\tconstruct: (input) => new PostgresRlsPolicy(policyInputFromSerialized(input))\n};\nconst roleEntityKind = {\n\tkind: \"role\",\n\tschema: PostgresRoleSchema,\n\tconstruct: (input) => new PostgresRole(input)\n};\nconst rlsEnablementEntityKind = {\n\tkind: \"rls\",\n\tschema: PostgresRlsEnablementSchema,\n\tconstruct: (input) => new PostgresRlsEnablement(input)\n};\nconst nativeEnumEntityKind = {\n\tkind: \"native_enum\",\n\tschema: PostgresNativeEnumSchema,\n\tconstruct: (input) => new PostgresNativeEnum(input)\n};\n//#endregion\n//#region src/core/postgres-schema.ts\n/**\n* Postgres target `Namespace` concretion — a Postgres schema (`CREATE\n* SCHEMA …`). Each Postgres `SqlStorage` carries a\n* `namespaces: Record<NamespaceId, PostgresSchema>` map populated by\n* the Postgres PSL interpreter from `namespace { … }` AST buckets.\n*\n* `entries` holds entity-kind maps (`table`, `valueSet`). Qualifier\n* emission is the rendering seam: DDL / SQL emission asks the namespace\n* for its qualifier (`\"<schema>\"`) or for a qualified table name\n* (`\"<schema>\".\"<table>\"`) and consumes the result polymorphically.\n* The unbound singleton below overrides these methods to elide the\n* prefix entirely — call sites stay polymorphic and never branch on\n* `id === UNBOUND_NAMESPACE_ID`.\n*/\nvar PostgresSchema = class extends SqlNamespaceBase {\n\t/**\n\t* Stable singleton reference for the late-bound slot. Materialised\n\t* lazily below the singleton subclass declaration so the static\n\t* initialiser sees the subclass before assigning. Consumers always\n\t* reach for `PostgresSchema.unbound` (or `PostgresUnboundSchema.instance`\n\t* — same identity).\n\t*/\n\tstatic unbound;\n\tid;\n\tentries;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.id = input.id;\n\t\tconst dispatched = hydrateNamespaceEntities(input.entries, composeSqlEntityKinds([\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind\n\t\t]), \"carry\");\n\t\tconst nativeEnumSlot = dispatched[\"native_enum\"];\n\t\tif (nativeEnumSlot !== void 0) {\n\t\t\tconst rekeyed = {};\n\t\t\tfor (const [handle, entity] of Object.entries(nativeEnumSlot)) {\n\t\t\t\tconst physicalName = PostgresNativeEnum.is(entity) ? entity.typeName : handle;\n\t\t\t\tinvariant(!Object.hasOwn(rekeyed, physicalName), `PostgresSchema \"${input.id}\": two native_enum entities resolve to the same physical type name \"${physicalName}\". Give them distinct @@map type names.`);\n\t\t\t\trekeyed[physicalName] = entity;\n\t\t\t}\n\t\t\tdispatched[\"native_enum\"] = Object.freeze(rekeyed);\n\t\t}\n\t\tconst valueSetRaw = dispatched[\"valueSet\"];\n\t\tconst entriesInput = { ...valueSetRaw !== void 0 && Object.keys(valueSetRaw).length === 0 ? {\n\t\t\t...dispatched,\n\t\t\tvalueSet: void 0\n\t\t} : dispatched };\n\t\tthis.entries = Object.freeze(blindCast(entriesInput));\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"schema\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n\tget table() {\n\t\treturn this.entries.table ?? Object.freeze({});\n\t}\n\tget valueSet() {\n\t\treturn this.entries.valueSet;\n\t}\n\tget policy() {\n\t\treturn this.entries.policy ?? Object.freeze({});\n\t}\n\tget role() {\n\t\treturn this.entries.role ?? Object.freeze({});\n\t}\n\tget rls() {\n\t\treturn this.entries.rls ?? Object.freeze({});\n\t}\n\t/**\n\t* The bare schema qualifier as it would appear in a rendered SQL\n\t* fragment (already quoted). The unbound-schema singleton overrides\n\t* this to return `''`.\n\t*/\n\tqualifier() {\n\t\treturn `\"${this.id}\"`;\n\t}\n\t/**\n\t* Qualify a table name with the schema prefix\n\t* (`\"<schema>\".\"<table>\"`). The unbound-schema singleton overrides\n\t* this to emit just `\"<table>\"` so the resolved DDL is unqualified\n\t* and `search_path` decides where the object lands at runtime.\n\t*/\n\tqualifyTable(tableName) {\n\t\treturn `\"${this.id}\".\"${tableName}\"`;\n\t}\n\t/**\n\t* Render a SQL string-literal containing the qualified-name form\n\t* suitable for `to_regclass(...)` arguments (e.g. `'\"public\".\"user\"'`).\n\t* The unbound singleton overrides this to elide the schema prefix\n\t* (`'\"user\"'`) so `search_path` resolves the object at runtime.\n\t*/\n\tregclassLiteral(name) {\n\t\treturn `'${escapeLiteral(this.qualifyTable(name))}'`;\n\t}\n\t/**\n\t* Render a SQL expression that evaluates to this namespace's schema\n\t* name at runtime, ready to drop into a `WHERE table_schema = …` /\n\t* `WHERE n.nspname = …` clause. Named schemas emit a quoted SQL\n\t* literal (`'public'`); the unbound singleton overrides this to emit\n\t* `current_schema()` so catalog queries match whichever schema the\n\t* connection's `search_path` resolved at runtime.\n\t*/\n\tschemaSqlExpression() {\n\t\treturn `'${escapeLiteral(this.id)}'`;\n\t}\n\t/**\n\t* Typed-AST counterpart of {@link schemaSqlExpression}: the expression a\n\t* builder-built catalog check compares `n.nspname` / `table_schema`\n\t* against. Named schemas bind the schema name as a text parameter; the\n\t* unbound singleton overrides this to the opaque `current_schema()`\n\t* expression so the live connection's `search_path` decides at runtime.\n\t*/\n\tschemaFilterExpression() {\n\t\treturn cfExpr.param(this.id, PG_TEXT_CODEC_ID);\n\t}\n\t/**\n\t* Typed-AST counterpart of {@link qualifyTable}: the FROM source a\n\t* builder-built check uses to address a user table in this namespace.\n\t* Named schemas qualify (`\"schema\".\"table\"`); the unbound singleton\n\t* overrides this to leave the table unqualified so `search_path`\n\t* resolves it at runtime.\n\t*/\n\ttableSource(tableName, alias) {\n\t\treturn new PostgresTableSource({\n\t\t\tname: tableName,\n\t\t\tschema: this.id,\n\t\t\t...ifDefined(\"alias\", alias)\n\t\t});\n\t}\n\t/**\n\t* The bare schema name a DDL planner should target when emitting\n\t* statements that need to identify this namespace in the live\n\t* database (e.g. `CREATE TABLE \"<ddlSchemaName>\".\"<table>\" …`,\n\t* catalog filters, planner conflict lookups). Named schemas resolve\n\t* to their own id. The `PostgresUnboundSchema` singleton inherits\n\t* this and returns `UNBOUND_NAMESPACE_ID` — callers that dispatch\n\t* through `qualifyTableName` route through the polymorphic\n\t* `PostgresUnboundSchema` overrides and produce unqualified\n\t* (search-path-resolved) output automatically.\n\t*/\n\tddlSchemaName(_storage) {\n\t\treturn this.id;\n\t}\n};\n/**\n* Singleton subclass for the reserved sentinel namespace id\n* (`UNBOUND_NAMESPACE_ID`) — the late-bound Postgres slot whose binding\n* the connection's `search_path` resolves at runtime. Overrides\n* qualifier emission to elide the schema prefix; call sites that consume\n* `qualifier()` / `qualifyTable()` get unqualified output without\n* branching on the namespace id.\n*\n* This is the target-side materialization of \"the framework provides\n* affordances; targets implement specifics\": the framework names the\n* sentinel; Postgres decides what late-bound means here (the table\n* name, naked — the schema is supplied by the live connection's\n* `search_path`).\n*\n* `ddlSchemaName` is inherited from `PostgresSchema` and returns\n* `UNBOUND_NAMESPACE_ID`. Downstream helpers such as `qualifyTableName`\n* route through the polymorphic factory and produce unqualified output\n* automatically.\n*/\nvar PostgresUnboundSchema = class PostgresUnboundSchema extends PostgresSchema {\n\tstatic instance = new PostgresUnboundSchema();\n\tconstructor(input) {\n\t\tsuper(input ?? {\n\t\t\tid: UNBOUND_NAMESPACE_ID,\n\t\t\tentries: { table: {} }\n\t\t});\n\t}\n\tqualifier() {\n\t\treturn \"\";\n\t}\n\tqualifyTable(tableName) {\n\t\treturn `\"${tableName}\"`;\n\t}\n\tschemaSqlExpression() {\n\t\treturn \"current_schema()\";\n\t}\n\tschemaFilterExpression() {\n\t\treturn cfExpr.raw(\"current_schema()\", {\n\t\t\tcodecId: PG_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t});\n\t}\n\ttableSource(tableName, alias) {\n\t\treturn new PostgresTableSource({\n\t\t\tname: tableName,\n\t\t\t...ifDefined(\"alias\", alias)\n\t\t});\n\t}\n};\nPostgresSchema.unbound = PostgresUnboundSchema.instance;\n/**\n* Narrow an arbitrary namespace (or `undefined`) to `PostgresSchema`\n* so callers can dispatch to the polymorphic emission methods without\n* branching at the call site. Uses the structural `kind` discriminator\n* (`'schema'`) rather than `instanceof` so the check survives realm /\n* bundle / hot-reload boundaries — matching the rest of the IR's\n* narrowing convention. `PostgresUnboundSchema` passes through because\n* it inherits the same `kind: 'schema'` from `PostgresSchema`.\n*/\nfunction isPostgresSchema(ns) {\n\treturn ns?.kind === \"schema\";\n}\n/**\n* Target-supplied `Namespace` factory the Postgres target plumbs\n* through `defineContract({ createNamespace })` and the SQL PSL\n* interpreter. Returns the unbound singleton for the framework\n* sentinel and a fresh `PostgresSchema` for any other coordinate.\n*\n* The factory has no per-call state — every named id deterministically\n* maps to a distinct schema instance — so callers can pass it through\n* by reference and trust the resulting `SqlStorage.namespaces` map to\n* be value-stable for a given input set. Native-enum column type names are\n* schema-qualified earlier, at column construction, via the target's\n* `authoring.qualifyColumnType` hook (`postgresQualifyColumnType`), so this\n* factory just materialises the namespace from already-qualified entries.\n*/\nfunction postgresCreateNamespace(input) {\n\tconst schemaInput = {\n\t\tid: input.id,\n\t\tentries: {\n\t\t\t...input.entries,\n\t\t\ttable: input.entries[\"table\"] ?? {}\n\t\t}\n\t};\n\tif (input.id === UNBOUND_NAMESPACE_ID) return new PostgresUnboundSchema(schemaInput);\n\treturn new PostgresSchema(schemaInput);\n}\n//#endregion\nexport { PostgresRlsPolicy as _, nativeEnumEntityKind as a, roleEntityKind as c, PostgresNativeEnumSchema as d, PostgresRlsEnablementSchema as f, ROLE_DEFAULT_CONTROL_POLICY as g, PostgresRole as h, postgresCreateNamespace as i, policyInputFromSerialized as l, PostgresRoleSchema as m, PostgresUnboundSchema as n, policyEntityKind as o, PostgresRlsPolicySchema as p, isPostgresSchema as r, rlsEnablementEntityKind as s, PostgresSchema as t, PostgresTableSource as u, PostgresRlsEnablement as v };\n\n//# sourceMappingURL=postgres-schema-CFOxDfUX.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAI,wBAAwB,cAAc,QAAQ;CACjD,OAAO;CACP;CACA;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,YAAY,MAAM;EACvB,KAAK,cAAc,MAAM;EACzB,WAAW,IAAI;CAChB;AACD;;;;;;;;;;;;;;AAgBA,IAAI,oBAAoB,cAAc,QAAQ;CAC7C,OAAO;CACP;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,OAAO,OAAO,MAAM,MAAM;EAC/B,IAAI,MAAM,OAAO,SAAS,QAAQ,KAAK,SAAS,MAAM,OAAO;EAC7D,KAAK,YAAY,MAAM;EACvB,KAAK,cAAc,MAAM;EACzB,KAAK,YAAY,MAAM;EACvB,KAAK,QAAQ,OAAO,OAAO,CAAC,GAAG,MAAM,KAAK,CAAC;EAC3C,IAAI,MAAM,UAAU,KAAK,GAAG,KAAK,QAAQ,MAAM;EAC/C,IAAI,MAAM,cAAc,KAAK,GAAG,KAAK,YAAY,MAAM;E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AAO,IAAI,oBAAoB;GACrC,SAAS;GACT,UAAU;EACX,CAAC;CACF;CACA,YAAY,WAAW,OAAO;EAC7B,OAAO,IAAI,oBAAoB;GAC9B,MAAM;GACN,GAAG,UAAU,SAAS,KAAK;EAC5B,CAAC;CACF;AACD;AACA,eAAe,UAAU,sBAAsB;;;;;;;;;;AAU/C,SAAS,iBAAiB,IAAI;CAC7B,OAAO,IAAI,SAAS;AACrB;;;;;;;;;;;;;;;AAeA,SAAS,wBAAwB,OAAO;CACvC,MAAM,cAAc;EACnB,IAAI,MAAM;EACV,SAAS;GACR,GAAG,MAAM;GACT,OAAO,MAAM,QAAQ,YAAY,CAAC;EACnC;CACD;CACA,IAAI,MAAM,OAAO,sBAAsB,OAAO,IAAI,sBAAsB,WAAW;CACnF,OAAO,IAAI,eAAe,WAAW;AACtC"}
|
package/dist/{resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs → resolve-ddl-schema-BIy8VDVK-Cb6hoVTS.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
|
|
2
|
-
import { d as isPostgresSchema } from "./postgres-schema-
|
|
2
|
+
import { d as isPostgresSchema } from "./postgres-schema-CFOxDfUX-DTZtjh5X.mjs";
|
|
3
3
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
4
|
-
//#region ../../../3-targets/3-targets/postgres/dist/resolve-ddl-schema-
|
|
4
|
+
//#region ../../../3-targets/3-targets/postgres/dist/resolve-ddl-schema-BIy8VDVK.mjs
|
|
5
5
|
/**
|
|
6
6
|
* Given the contract's storage and a namespace id, returns the live Postgres
|
|
7
7
|
* DDL schema name that namespace maps to. A named Postgres namespace dispatches
|
|
@@ -19,4 +19,4 @@ function resolveDdlSchemaForNamespaceStorage(storage, namespaceId) {
|
|
|
19
19
|
//#endregion
|
|
20
20
|
export { resolveDdlSchemaForNamespaceStorage as t };
|
|
21
21
|
|
|
22
|
-
//# sourceMappingURL=resolve-ddl-schema-
|
|
22
|
+
//# sourceMappingURL=resolve-ddl-schema-BIy8VDVK-Cb6hoVTS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-ddl-schema-
|
|
1
|
+
{"version":3,"file":"resolve-ddl-schema-BIy8VDVK-Cb6hoVTS.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/resolve-ddl-schema-BIy8VDVK.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-CFOxDfUX.mjs\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\n//#region src/core/migrations/resolve-ddl-schema.ts\n/**\n* Given the contract's storage and a namespace id, returns the live Postgres\n* DDL schema name that namespace maps to. A named Postgres namespace dispatches\n* to its `ddlSchemaName(storage)`; the unbound sentinel resolves to\n* `DEFAULT_NAMESPACE_ID` (the search-path default for offline planning); a\n* bare object payload (used by some tests) falls back to the namespace id\n* itself.\n*/\nfunction resolveDdlSchemaForNamespaceStorage(storage, namespaceId) {\n\tif (namespaceId === UNBOUND_NAMESPACE_ID) return DEFAULT_NAMESPACE_ID;\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (namespace && isPostgresSchema(namespace)) return namespace.ddlSchemaName(storage);\n\treturn namespaceId;\n}\n//#endregion\nexport { resolveDdlSchemaForNamespaceStorage as t };\n\n//# sourceMappingURL=resolve-ddl-schema-BIy8VDVK.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,oCAAoC,SAAS,aAAa;CAClE,IAAI,gBAAgB,sBAAsB,OAAO;CACjD,MAAM,YAAY,QAAQ,WAAW;CACrC,IAAI,aAAa,iBAAiB,SAAS,GAAG,OAAO,UAAU,cAAc,OAAO;CACpF,OAAO;AACR"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isPgEnumParams } from "./codecs-
|
|
1
|
+
import { n as isPgEnumParams } from "./codecs-DNf0Tmab-Bsdj1npb.mjs";
|
|
2
2
|
import { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
|
|
3
3
|
import { LiteralExpr, collectOrderedParamRefs } from "@prisma/orm-family-sql/relational-core/ast";
|
|
4
4
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
@@ -576,4 +576,4 @@ function renderRawExpr(node, contract, pim) {
|
|
|
576
576
|
//#endregion
|
|
577
577
|
export { renderLoweredSql as n, adapterError as t };
|
|
578
578
|
|
|
579
|
-
//# sourceMappingURL=sql-renderer-CZE98PJj-
|
|
579
|
+
//# sourceMappingURL=sql-renderer-CZE98PJj-E5yVGXmL.mjs.map
|
package/dist/{sql-renderer-CZE98PJj-Bx5D-Txz.mjs.map → sql-renderer-CZE98PJj-E5yVGXmL.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-renderer-CZE98PJj-Bx5D-Txz.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/sql-renderer-CZE98PJj.mjs"],"sourcesContent":["import { LiteralExpr, collectOrderedParamRefs } from \"@internal/sql-relational-core/ast\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { isPgEnumParams } from \"@internal/target-postgres/codecs\";\nimport { escapeLiteral, quoteIdentifier, quoteQualifiedName } from \"@internal/target-postgres/sql-utils\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\nimport { runtimeError } from \"@internal/framework-components/runtime\";\n//#region src/core/adapter-errors.ts\nfunction adapterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/core/sql-renderer.ts\n/**\n* Postgres native types whose unknown-OID parameter inference is reliable in arbitrary expression positions. Parameters bound to a descriptor whose `nativeTypeFor` result falls in this set are emitted as plain `$N`; everything else (including `json`, `jsonb`, extension types like `vector`, and unknown user types) is emitted as `$N::<nativeType>` so the planner picks an unambiguous overload.\n*\n* `json` / `jsonb` are intentionally excluded despite being Postgres builtins: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).\n*\n* Spellings match the target descriptors' `nativeTypeFor` results, not the `udt_name` abbreviations that ADR 205 used as illustrative shorthand. The registry-based cast policy compares against these strings directly.\n*/\nconst POSTGRES_INFERRABLE_NATIVE_TYPES = /* @__PURE__ */ new Set([\n\t\"integer\",\n\t\"smallint\",\n\t\"bigint\",\n\t\"real\",\n\t\"double precision\",\n\t\"numeric\",\n\t\"boolean\",\n\t\"text\",\n\t\"character\",\n\t\"character varying\",\n\t\"timestamp\",\n\t\"timestamp without time zone\",\n\t\"timestamp with time zone\",\n\t\"time\",\n\t\"timetz\",\n\t\"interval\",\n\t\"bit\",\n\t\"bit varying\"\n]);\nfunction renderTypedParam(index, codecId, codecDescriptorRegistry, many, typeParams) {\n\tif (codecId === void 0) return `$${index}`;\n\tconst descriptor = codecDescriptorRegistry.descriptorFor(codecId);\n\tif (descriptor === void 0) throw adapterError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `Postgres lowering: ParamRef carries codecId \"${codecId}\" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \\`extensions: [pgvectorRuntime]\\`), or use the codec directly from \\`@internal/target-postgres/codecs\\` if it's a builtin.`, { meta: { codecId } });\n\tconst ref = {\n\t\tcodecId,\n\t\t...ifDefined(\"many\", many),\n\t\t...ifDefined(\"typeParams\", typeParams)\n\t};\n\tconst nativeType = descriptor.nativeTypeFor(ref);\n\tconst arraySuffix = many ? \"[]\" : \"\";\n\tif (isPgEnumParams(typeParams)) return `$${index}::${quoteQualifiedName(nativeType)}${arraySuffix}`;\n\tif (!POSTGRES_INFERRABLE_NATIVE_TYPES.has(nativeType) || many) return `$${index}::${nativeType}${arraySuffix}`;\n\treturn `$${index}`;\n}\nfunction unreachableKind(value) {\n\tconst candidate = value;\n\tif (typeof candidate === \"object\" && candidate !== null && \"kind\" in candidate && typeof candidate.kind === \"string\") return candidate.kind;\n\treturn \"unknown\";\n}\n/**\n* Render a SQL query AST to a Postgres-flavored `{ sql, params }` payload.\n*\n* Shared between the runtime (`PostgresAdapterImpl.lower`) and control (`PostgresControlAdapter.lower`) entrypoints so emit-time and run-time paths produce byte-identical output for the same AST.\n*/\nfunction renderLoweredSql(ast, contract, codecDescriptorRegistry) {\n\tconst orderedRefs = collectOrderedParamRefs(ast);\n\tconst indexMap = /* @__PURE__ */ new Map();\n\tconst params = orderedRefs.map((ref, i) => {\n\t\tindexMap.set(ref, i + 1);\n\t\treturn ref.kind === \"prepared-param-ref\" ? {\n\t\t\tkind: \"bind\",\n\t\t\tname: ref.name\n\t\t} : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: ref.value\n\t\t};\n\t});\n\tconst pim = {\n\t\tindexMap,\n\t\tcodecDescriptorRegistry\n\t};\n\tconst node = ast;\n\tlet sql;\n\tswitch (node.kind) {\n\t\tcase \"select\":\n\t\t\tsql = renderSelect(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"insert\":\n\t\t\tsql = renderInsert(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"update\":\n\t\t\tsql = renderUpdate(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"delete\":\n\t\t\tsql = renderDelete(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"raw-sql\":\n\t\t\tsql = renderRawSql(node, contract, pim);\n\t\t\tbreak;\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported AST node kind: ${unreachableKind(node)}`);\n\t}\n\treturn Object.freeze({\n\t\tsql,\n\t\tparams: Object.freeze(params)\n\t});\n}\nfunction renderLimitOffset(keyword, value, contract, pim) {\n\tif (value === void 0) return \"\";\n\tif (typeof value === \"number\") return `${keyword} ${value}`;\n\treturn `${keyword} ${renderExpr(value, contract, pim)}`;\n}\nfunction renderSelect(ast, contract, pim) {\n\tconst sourcesByRef = collectTableSources(ast);\n\treturn [\n\t\t`SELECT ${renderDistinctPrefix(ast.distinct, ast.distinctOn, sourcesByRef, contract, pim)}${renderProjection(ast.projection, contract, pim)}`,\n\t\tast.from !== void 0 ? `FROM ${renderSource(ast.from, contract, pim)}` : \"\",\n\t\tast.joins?.length ? ast.joins.map((join) => renderJoin(join, contract, pim)).join(\" \") : \"\",\n\t\tast.where ? `WHERE ${renderWhere(ast.where, contract, pim)}` : \"\",\n\t\tast.groupBy?.length ? `GROUP BY ${ast.groupBy.map((expr) => renderExpr(expr, contract, pim)).join(\", \")}` : \"\",\n\t\tast.having ? `HAVING ${renderWhere(ast.having, contract, pim)}` : \"\",\n\t\tast.orderBy?.length ? `ORDER BY ${ast.orderBy.map((order) => {\n\t\t\treturn `${renderOrderByExpr(order.expr, sourcesByRef, contract, pim)} ${order.dir.toUpperCase()}`;\n\t\t}).join(\", \")}` : \"\",\n\t\trenderLimitOffset(\"LIMIT\", ast.limit, contract, pim),\n\t\trenderLimitOffset(\"OFFSET\", ast.offset, contract, pim)\n\t].filter((part) => part.length > 0).join(\" \").trim();\n}\n/**\n* Map a SELECT's table references (the FROM source and any JOIN sources) to their storage coordinate, keyed by the name a `ColumnRef.table` would carry (the alias when present, otherwise the table name). Derived-table sources are skipped — their columns are projected through a sub-select, not a base storage column, so the enum hook does not apply.\n*/\nfunction collectTableSources(ast) {\n\tconst sources = /* @__PURE__ */ new Map();\n\tconst add = (source) => {\n\t\tif (source.kind !== \"table-source\") return;\n\t\tconst ref = source.alias ?? source.name;\n\t\tsources.set(ref, {\n\t\t\tname: source.name,\n\t\t\tnamespaceId: source.namespaceId\n\t\t});\n\t};\n\tif (ast.from !== void 0) add(ast.from);\n\tfor (const join of ast.joins ?? []) add(join.source);\n\treturn sources;\n}\n/**\n* Ordered, codec-encoded values of the value-set a storage column restricts to, or `undefined` when the referenced column carries no value-set (the common, non-enum case). Resolves the column's storage coordinate from the SELECT's table sources, then the column's `valueSet` ref to the value-set's `values`.\n*/\nfunction allStrings(values) {\n\treturn values.every((value) => typeof value === \"string\");\n}\nfunction resolveEnumOrderValues(ref, sourcesByRef, contract) {\n\tconst source = sourcesByRef.get(ref.table);\n\tif (source === void 0 || source.namespaceId === void 0) return;\n\tconst sourceNs = contract.storage.namespaces[source.namespaceId];\n\tconst valueSet = (sourceNs !== void 0 ? sourceNs.entries.table?.[source.name]?.columns[ref.column] : void 0)?.valueSet;\n\tif (valueSet === void 0) return;\n\tconst valueSetNs = contract.storage.namespaces[valueSet.namespaceId];\n\treturn valueSetNs !== void 0 ? valueSetNs.entries.valueSet?.[valueSet.entityName]?.values : void 0;\n}\n/**\n* Ordered values for an unqualified ORDER BY column (an `identifier-ref`, the shape the sql-builder emits for `.orderBy('col')`). Scans every FROM/JOIN source for a column of that name. Resolves only when exactly one source has a column of that name and it carries a value-set; if more than one source has such a column the bare identifier is ambiguous (regardless of which are enum-backed), so it falls through to the plain column rendering.\n*/\nfunction resolveEnumOrderValuesForIdentifier(name, sourcesByRef, contract) {\n\tlet matchedColumns = 0;\n\tlet resolved;\n\tfor (const source of sourcesByRef.values()) {\n\t\tif (source.namespaceId === void 0) continue;\n\t\tconst identNs = contract.storage.namespaces[source.namespaceId];\n\t\tconst column = identNs !== void 0 ? identNs.entries.table?.[source.name]?.columns[name] : void 0;\n\t\tif (column === void 0) continue;\n\t\tmatchedColumns += 1;\n\t\tif (matchedColumns > 1) return;\n\t\tconst valueSet = column.valueSet;\n\t\tif (valueSet === void 0) return;\n\t\tconst valueSetNs = contract.storage.namespaces[valueSet.namespaceId];\n\t\tresolved = valueSetNs !== void 0 ? valueSetNs.entries.valueSet?.[valueSet.entityName]?.values : void 0;\n\t}\n\treturn resolved;\n}\n/**\n* Render an ORDER BY expression. A column reference onto an enum-restricted column sorts by declaration order via `array_position(ARRAY[…]::text[], <col>)` over the value-set's ordered values (NULLs return `NULL` from `array_position`, sorting per the clause's default NULL handling). Both qualified `column-ref`s and the unqualified `identifier-ref`s the sql-builder emits for `.orderBy('col')` are intercepted. Every other expression renders unchanged.\n*/\nfunction renderOrderByExpr(expr, sourcesByRef, contract, pim) {\n\tif (expr.kind === \"column-ref\") {\n\t\tconst orderValues = resolveEnumOrderValues(expr, sourcesByRef, contract);\n\t\tif (orderValues !== void 0 && allStrings(orderValues)) return `array_position(ARRAY[${orderValues.map((value) => `'${escapeLiteral(value)}'`).join(\", \")}]::text[], ${renderColumn(expr)})`;\n\t}\n\tif (expr.kind === \"identifier-ref\") {\n\t\tconst orderValues = resolveEnumOrderValuesForIdentifier(expr.name, sourcesByRef, contract);\n\t\tif (orderValues !== void 0 && allStrings(orderValues)) return `array_position(ARRAY[${orderValues.map((value) => `'${escapeLiteral(value)}'`).join(\", \")}]::text[], ${quoteIdentifier(expr.name)})`;\n\t}\n\treturn renderExpr(expr, contract, pim);\n}\nfunction renderProjection(projection, contract, pim) {\n\treturn projection.map((item) => {\n\t\tconst alias = quoteIdentifier(item.alias);\n\t\tif (item.expr.kind === \"literal\") return `${renderLiteral(item.expr)} AS ${alias}`;\n\t\treturn `${renderExpr(item.expr, contract, pim)} AS ${alias}`;\n\t}).join(\", \");\n}\nfunction renderReturning(items, contract, pim) {\n\treturn items.map((item) => {\n\t\tif (item.expr.kind === \"column-ref\") {\n\t\t\tconst rendered = renderColumn(item.expr);\n\t\t\treturn item.expr.column === item.alias ? rendered : `${rendered} AS ${quoteIdentifier(item.alias)}`;\n\t\t}\n\t\tif (item.expr.kind === \"literal\") return `${renderLiteral(item.expr)} AS ${quoteIdentifier(item.alias)}`;\n\t\treturn `${renderExpr(item.expr, contract, pim)} AS ${quoteIdentifier(item.alias)}`;\n\t}).join(\", \");\n}\nfunction renderDistinctPrefix(distinct, distinctOn, sourcesByRef, contract, pim) {\n\tif (distinctOn && distinctOn.length > 0) return `DISTINCT ON (${distinctOn.map((expr) => renderOrderByExpr(expr, sourcesByRef, contract, pim)).join(\", \")}) `;\n\tif (distinct) return \"DISTINCT \";\n\treturn \"\";\n}\nfunction hasExplicitSchema(table) {\n\treturn \"schema\" in table && typeof table.schema === \"string\";\n}\nfunction qualifyTableFromNamespaceCoordinate(table, contract) {\n\tif (hasExplicitSchema(table)) return `${quoteIdentifier(table.schema)}.${quoteIdentifier(table.name)}`;\n\tif (table.namespaceId === void 0) return quoteIdentifier(table.name);\n\tconst namespace = contract.storage.namespaces[table.namespaceId];\n\tif (namespace === void 0) throw adapterError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which is not present as a Postgres schema on the contract`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: \"not-present\"\n\t} });\n\tconst qualifyTable = namespace.qualifyTable;\n\tif (qualifyTable === void 0) throw adapterError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which is not materialised as a Postgres schema on the contract`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: \"not-materialised\"\n\t} });\n\treturn qualifyTable.call(namespace, table.name);\n}\nfunction renderTableSource(source, contract) {\n\tconst qualified = qualifyTableFromNamespaceCoordinate(source, contract);\n\tif (!source.alias) return qualified;\n\treturn `${qualified} AS ${quoteIdentifier(source.alias)}`;\n}\nfunction renderSource(source, contract, pim) {\n\tconst node = source;\n\tswitch (node.kind) {\n\t\tcase \"table-source\": return renderTableSource(node, contract);\n\t\tcase \"derived-table-source\": return `(${renderSelect(node.query, contract, pim)}) AS ${quoteIdentifier(node.alias)}`;\n\t\tcase \"function-source\": {\n\t\t\tconst args = node.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \");\n\t\t\treturn `${`${node.fn}(${args})`}${node.ordinality ? \" WITH ORDINALITY\" : \"\"}${node.alias === void 0 ? \"\" : ` AS ${quoteIdentifier(node.alias)}`}${node.columnAliases === void 0 ? \"\" : `(${node.columnAliases.map((column) => quoteIdentifier(column)).join(\", \")})`}`;\n\t\t}\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported source node kind: ${unreachableKind(node)}`);\n\t}\n}\nfunction assertScalarSubquery(query) {\n\tif (query.projection.length !== 1) throw adapterError(\"RUNTIME.AST_INVALID\", \"Subquery expressions must project exactly one column\", { meta: { node: \"subquery-expr\" } });\n}\nfunction renderSubqueryExpr(expr, contract, pim) {\n\tassertScalarSubquery(expr.query);\n\treturn `(${renderSelect(expr.query, contract, pim)})`;\n}\nfunction renderWhere(expr, contract, pim) {\n\treturn renderExpr(expr, contract, pim);\n}\nfunction renderNullCheck(expr, contract, pim) {\n\tconst rendered = renderExpr(expr.expr, contract, pim);\n\tconst renderedExpr = isAtomicExpressionKind(expr.expr.kind) ? rendered : `(${rendered})`;\n\treturn expr.isNull ? `${renderedExpr} IS NULL` : `${renderedExpr} IS NOT NULL`;\n}\n/**\n* Atomic expression kinds whose rendered SQL is already self-delimited (a column reference, parameter, literal, function call, aggregate, etc.) and therefore does not need surrounding parentheses when used as the left operand of a postfix predicate like `IS NULL` or `IS NOT NULL`, or as either operand of a binary infix operator.\n*\n* Anything not in this set is treated as composite (binary, AND/OR/NOT, EXISTS, nested IS NULL, subqueries, operation templates) and gets wrapped to preserve grouping.\n*/\nfunction isAtomicExpressionKind(kind) {\n\tswitch (kind) {\n\t\tcase \"column-ref\":\n\t\tcase \"identifier-ref\":\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\tcase \"literal\":\n\t\tcase \"aggregate\":\n\t\tcase \"window-func\":\n\t\tcase \"function-call\":\n\t\tcase \"cast\":\n\t\tcase \"case\":\n\t\tcase \"json-object\":\n\t\tcase \"json-array-agg\":\n\t\tcase \"list\": return true;\n\t\tcase \"subquery\":\n\t\tcase \"operation\":\n\t\tcase \"binary\":\n\t\tcase \"and\":\n\t\tcase \"or\":\n\t\tcase \"exists\":\n\t\tcase \"null-check\":\n\t\tcase \"not\":\n\t\tcase \"raw-expr\": return false;\n\t}\n}\nfunction renderBinary(expr, contract, pim) {\n\tif (expr.right.kind === \"list\" && expr.right.values.length === 0) {\n\t\tif (expr.op === \"in\") return \"FALSE\";\n\t\tif (expr.op === \"notIn\") return \"TRUE\";\n\t}\n\tconst leftExpr = expr.left;\n\tconst left = renderExpr(leftExpr, contract, pim);\n\tconst leftRendered = leftExpr.kind === \"operation\" || leftExpr.kind === \"subquery\" ? `(${left})` : left;\n\tconst rightNode = expr.right;\n\tlet right;\n\tswitch (rightNode.kind) {\n\t\tcase \"list\":\n\t\t\tright = renderListLiteral(rightNode, contract, pim);\n\t\t\tbreak;\n\t\tcase \"literal\":\n\t\t\tright = renderLiteral(rightNode);\n\t\t\tbreak;\n\t\tcase \"column-ref\":\n\t\t\tright = renderColumn(rightNode);\n\t\t\tbreak;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\t\tright = renderParamRef(rightNode, pim);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tright = renderExpr(rightNode, contract, pim);\n\t\t\tbreak;\n\t}\n\treturn `${leftRendered} ${{\n\t\teq: \"=\",\n\t\tneq: \"!=\",\n\t\tgt: \">\",\n\t\tlt: \"<\",\n\t\tgte: \">=\",\n\t\tlte: \"<=\",\n\t\tlike: \"LIKE\",\n\t\tin: \"IN\",\n\t\tnotIn: \"NOT IN\"\n\t}[expr.op]} ${right}`;\n}\nfunction renderListLiteral(expr, contract, pim) {\n\tif (expr.values.length === 0) return \"(NULL)\";\n\treturn `(${expr.values.map((v) => {\n\t\tif (v.kind === \"param-ref\" || v.kind === \"prepared-param-ref\") return renderParamRef(v, pim);\n\t\tif (v.kind === \"literal\") return renderLiteral(v);\n\t\treturn renderExpr(v, contract, pim);\n\t}).join(\", \")})`;\n}\nfunction renderColumn(ref) {\n\tif (ref.table === \"excluded\") return `excluded.${quoteIdentifier(ref.column)}`;\n\treturn `${quoteIdentifier(ref.table)}.${quoteIdentifier(ref.column)}`;\n}\nfunction renderAggregateExpr(expr, contract, pim) {\n\tconst fn = expr.fn.toUpperCase();\n\tif (!expr.expr) return `${fn}(*)`;\n\treturn `${fn}(${renderExpr(expr.expr, contract, pim)})`;\n}\nfunction renderWindowFuncExpr(expr, contract, pim) {\n\treturn `${expr.fn.toUpperCase()}(${expr.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \")}) OVER (${[expr.partitionBy && expr.partitionBy.length > 0 ? `PARTITION BY ${expr.partitionBy.map((e) => renderExpr(e, contract, pim)).join(\", \")}` : \"\", expr.orderBy && expr.orderBy.length > 0 ? `ORDER BY ${renderOrderByItems(expr.orderBy, contract, pim)}` : \"\"].filter((part) => part.length > 0).join(\" \")})`;\n}\nfunction renderFunctionCallExpr(expr, contract, pim) {\n\tconst args = expr.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \");\n\treturn `${expr.fn}(${args})`;\n}\nfunction renderCastExpr(expr, contract, pim) {\n\treturn `CAST(${renderExpr(expr.expr, contract, pim)} AS ${expr.targetType})`;\n}\nfunction renderCaseExpr(expr, contract, pim) {\n\treturn `CASE ${expr.branches.map((branch) => `WHEN ${renderExpr(branch.condition, contract, pim)} THEN ${renderExpr(branch.value, contract, pim)}`).join(\" \")}${expr.elseExpr === void 0 ? \"\" : ` ELSE ${renderExpr(expr.elseExpr, contract, pim)}`} END`;\n}\nfunction renderJsonValueProjection(projection, contract, pim) {\n\treturn projection.accept({\n\t\tcodec: ({ value, codec }) => renderExpr(projectJsonThroughCodec(value, codec, pim), contract, pim),\n\t\tnative: ({ value }) => renderExpr(value, contract, pim),\n\t\tdocument: ({ value }) => renderExpr(value, contract, pim)\n\t});\n}\nfunction projectJsonThroughCodec(value, codec, pim) {\n\tconst descriptor = pim.codecDescriptorRegistry.descriptorFor(codec.codecId);\n\tif (descriptor === void 0) throw adapterError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `Postgres lowering: a JSON projection carries codecId \"${codec.codecId}\" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \\`extensions: [pgvectorRuntime]\\`), or use the codec directly from \\`@internal/target-postgres/codecs\\` if it's a builtin.`, { meta: { codecId: codec.codecId } });\n\treturn descriptor.projectJson(value, codec);\n}\nfunction renderJsonObjectExpr(expr, contract, pim) {\n\treturn `json_build_object(${expr.entries.flatMap((entry) => {\n\t\treturn [`'${escapeLiteral(entry.key)}'`, renderJsonValueProjection(entry.value, contract, pim)];\n\t}).join(\", \")})`;\n}\nfunction renderOrderByItems(items, contract, pim) {\n\treturn items.map((item) => `${renderExpr(item.expr, contract, pim)} ${item.dir.toUpperCase()}`).join(\", \");\n}\nfunction renderJsonArrayAggExpr(expr, contract, pim) {\n\tconst aggregateOrderBy = expr.orderBy && expr.orderBy.length > 0 ? ` ORDER BY ${renderOrderByItems(expr.orderBy, contract, pim)}` : \"\";\n\tconst aggregated = `json_agg(${renderJsonValueProjection(expr.expr, contract, pim)}${aggregateOrderBy})`;\n\tif (expr.onEmpty === \"emptyArray\") return `coalesce(${aggregated}, json_build_array())`;\n\treturn aggregated;\n}\nfunction renderExpr(expr, contract, pim) {\n\tconst node = expr;\n\tswitch (node.kind) {\n\t\tcase \"column-ref\": return renderColumn(node);\n\t\tcase \"identifier-ref\": return quoteIdentifier(node.name);\n\t\tcase \"operation\": return renderOperation(node, contract, pim);\n\t\tcase \"subquery\": return renderSubqueryExpr(node, contract, pim);\n\t\tcase \"aggregate\": return renderAggregateExpr(node, contract, pim);\n\t\tcase \"window-func\": return renderWindowFuncExpr(node, contract, pim);\n\t\tcase \"function-call\": return renderFunctionCallExpr(node, contract, pim);\n\t\tcase \"cast\": return renderCastExpr(node, contract, pim);\n\t\tcase \"case\": return renderCaseExpr(node, contract, pim);\n\t\tcase \"json-object\": return renderJsonObjectExpr(node, contract, pim);\n\t\tcase \"json-array-agg\": return renderJsonArrayAggExpr(node, contract, pim);\n\t\tcase \"binary\": return renderBinary(node, contract, pim);\n\t\tcase \"and\":\n\t\t\tif (node.exprs.length === 0) return \"TRUE\";\n\t\t\treturn `(${node.exprs.map((part) => renderExpr(part, contract, pim)).join(\" AND \")})`;\n\t\tcase \"or\":\n\t\t\tif (node.exprs.length === 0) return \"FALSE\";\n\t\t\treturn `(${node.exprs.map((part) => renderExpr(part, contract, pim)).join(\" OR \")})`;\n\t\tcase \"exists\": return `${node.notExists ? \"NOT \" : \"\"}EXISTS (${renderSelect(node.subquery, contract, pim)})`;\n\t\tcase \"null-check\": return renderNullCheck(node, contract, pim);\n\t\tcase \"not\": return `NOT (${renderExpr(node.expr, contract, pim)})`;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParamRef(node, pim);\n\t\tcase \"literal\": return renderLiteral(node);\n\t\tcase \"list\": return renderListLiteral(node, contract, pim);\n\t\tcase \"raw-expr\": return renderRawExpr(node, contract, pim);\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported expression node kind: ${unreachableKind(node)}`);\n\t}\n}\nfunction renderParamRef(ref, pim) {\n\tconst index = pim.indexMap.get(ref);\n\tif (index === void 0) throw new InternalError(\"ParamRef not found in index map\");\n\tif (ref.kind === \"prepared-param-ref\") return renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);\n\tif (ref.codec === void 0) throw runtimeError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", \"Postgres renderer: ParamRef reached lowering without a bound CodecRef. Every column-bound ParamRef must carry a codec under the AST-bound codec contract. This usually indicates a builder path that constructed a ParamRef without threading the column codec.\", {\n\t\tparamIndex: index,\n\t\t...ifDefined(\"name\", ref.name)\n\t});\n\treturn renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);\n}\nfunction renderLiteral(expr) {\n\tif (typeof expr.value === \"string\") return `'${escapeLiteral(expr.value)}'`;\n\tif (typeof expr.value === \"number\" || typeof expr.value === \"boolean\") return String(expr.value);\n\tif (typeof expr.value === \"bigint\") return String(expr.value);\n\tif (expr.value === null) return \"NULL\";\n\tif (expr.value === void 0) return \"NULL\";\n\tif (expr.value instanceof Date) return `'${escapeLiteral(expr.value.toISOString())}'`;\n\tif (Array.isArray(expr.value)) return `ARRAY[${expr.value.map((v) => renderLiteral(new LiteralExpr(v))).join(\", \")}]`;\n\tconst json = JSON.stringify(expr.value);\n\tif (json === void 0) return \"NULL\";\n\treturn `'${escapeLiteral(json)}'`;\n}\nfunction renderOperation(expr, contract, pim) {\n\tconst self = renderExpr(expr.self, contract, pim);\n\tconst args = expr.args.map((arg) => {\n\t\treturn renderExpr(arg, contract, pim);\n\t});\n\treturn expr.lowering.template.replace(/\\{\\{self\\}\\}|\\{\\{arg(\\d+)\\}\\}/g, (token, argIndex) => {\n\t\tif (token === \"{{self}}\") return self;\n\t\tconst arg = args[Number(argIndex)];\n\t\tif (arg === void 0) throw adapterError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Operation lowering template for \"${expr.method}\" referenced missing argument {{arg${argIndex}}}; template has ${args.length} arg(s)`, { meta: { method: expr.method } });\n\t\treturn arg;\n\t});\n}\nfunction renderJoin(join, contract, pim) {\n\treturn `${join.joinType.toUpperCase()} JOIN ${join.lateral ? \"LATERAL \" : \"\"}${renderSource(join.source, contract, pim)} ON ${renderJoinOn(join.on, contract, pim)}`;\n}\nfunction renderJoinOn(on, contract, pim) {\n\tif (on.kind === \"eq-col-join-on\") return `${renderColumn(on.left)} = ${renderColumn(on.right)}`;\n\treturn renderWhere(on, contract, pim);\n}\nfunction getInsertColumnOrder(rows, contract, tableRef) {\n\tconst tableName = tableRef.name;\n\tconst orderedColumns = [];\n\tconst seenColumns = /* @__PURE__ */ new Set();\n\tfor (const row of rows) for (const column of Object.keys(row)) {\n\t\tif (seenColumns.has(column)) continue;\n\t\tseenColumns.add(column);\n\t\torderedColumns.push(column);\n\t}\n\tif (orderedColumns.length > 0) return orderedColumns;\n\tlet table;\n\tif (tableRef.namespaceId !== void 0) {\n\t\tconst ns = contract.storage.namespaces[tableRef.namespaceId];\n\t\ttable = ns !== void 0 ? ns.entries.table?.[tableName] : void 0;\n\t}\n\tif (table === void 0) for (const ns of Object.values(contract.storage.namespaces)) {\n\t\tconst found = ns.entries.table?.[tableName];\n\t\tif (found !== void 0) {\n\t\t\ttable = found;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!table) throw adapterError(\"RUNTIME.AST_INVALID\", `INSERT target table not found in contract storage: ${tableName}`, { meta: {\n\t\tnode: \"insert\",\n\t\ttable: tableName\n\t} });\n\treturn Object.keys(table.columns);\n}\nfunction renderInsertValue(value, contract, pim) {\n\tif (!value || value.kind === \"default-value\") return \"DEFAULT\";\n\tswitch (value.kind) {\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParamRef(value, pim);\n\t\tcase \"column-ref\": return renderColumn(value);\n\t\tcase \"raw-expr\": return renderExpr(value, contract, pim);\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(value, `Unsupported value node in INSERT: ${unreachableKind(value)}`);\n\t}\n}\nfunction renderInsert(ast, contract, pim) {\n\tconst table = qualifyTableFromNamespaceCoordinate(ast.table, contract);\n\tconst rows = ast.rows;\n\tif (rows.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT requires at least one row\", { meta: { node: \"insert\" } });\n\tconst hasExplicitValues = rows.some((row) => Object.keys(row).length > 0);\n\treturn `${(() => {\n\t\tif (!hasExplicitValues) {\n\t\t\tif (rows.length === 1) return `INSERT INTO ${table} DEFAULT VALUES`;\n\t\t\tconst defaultColumns = getInsertColumnOrder(rows, contract, ast.table);\n\t\t\tif (defaultColumns.length === 0) return `INSERT INTO ${table} VALUES ${rows.map(() => \"()\").join(\", \")}`;\n\t\t\tconst quotedColumns = defaultColumns.map((column) => quoteIdentifier(column));\n\t\t\tconst defaultRow = `(${defaultColumns.map(() => \"DEFAULT\").join(\", \")})`;\n\t\t\treturn `INSERT INTO ${table} (${quotedColumns.join(\", \")}) VALUES ${rows.map(() => defaultRow).join(\", \")}`;\n\t\t}\n\t\tconst columnOrder = getInsertColumnOrder(rows, contract, ast.table);\n\t\tconst columns = columnOrder.map((column) => quoteIdentifier(column));\n\t\tconst values = rows.map((row) => {\n\t\t\treturn `(${columnOrder.map((column) => renderInsertValue(row[column], contract, pim)).join(\", \")})`;\n\t\t}).join(\", \");\n\t\treturn `INSERT INTO ${table} (${columns.join(\", \")}) VALUES ${values}`;\n\t})()}${ast.onConflict ? (() => {\n\t\tconst conflictColumns = ast.onConflict.columns.map((col) => quoteIdentifier(col.column));\n\t\tif (conflictColumns.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT onConflict requires at least one conflict column\", { meta: { node: \"insert-on-conflict\" } });\n\t\tconst action = ast.onConflict.action;\n\t\tswitch (action.kind) {\n\t\t\tcase \"do-nothing\": return ` ON CONFLICT (${conflictColumns.join(\", \")}) DO NOTHING`;\n\t\t\tcase \"do-update-set\": {\n\t\t\t\tconst updateEntries = Object.entries(action.set);\n\t\t\t\tif (updateEntries.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT onConflict do-update-set requires at least one assignment\", { meta: { node: \"insert-on-conflict\" } });\n\t\t\t\tconst updates = updateEntries.map(([colName, value]) => {\n\t\t\t\t\treturn `${quoteIdentifier(colName)} = ${renderExpr(value, contract, pim)}`;\n\t\t\t\t});\n\t\t\t\treturn ` ON CONFLICT (${conflictColumns.join(\", \")}) DO UPDATE SET ${updates.join(\", \")}`;\n\t\t\t}\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: assertNever(action, `Unsupported onConflict action: ${unreachableKind(action)}`);\n\t\t}\n\t})() : \"\"}${ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\"}`;\n}\nfunction renderUpdate(ast, contract, pim) {\n\tconst table = qualifyTableFromNamespaceCoordinate(ast.table, contract);\n\tconst setEntries = Object.entries(ast.set);\n\tif (setEntries.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"UPDATE requires at least one SET assignment\", { meta: { node: \"update\" } });\n\tconst setClauses = setEntries.map(([col, val]) => {\n\t\treturn `${quoteIdentifier(col)} = ${renderExpr(val, contract, pim)}`;\n\t});\n\tconst whereClause = ast.where ? ` WHERE ${renderWhere(ast.where, contract, pim)}` : \"\";\n\tconst returningClause = ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\";\n\treturn `UPDATE ${table} SET ${setClauses.join(\", \")}${whereClause}${returningClause}`;\n}\nfunction renderDelete(ast, contract, pim) {\n\treturn `DELETE FROM ${qualifyTableFromNamespaceCoordinate(ast.table, contract)}${ast.where ? ` WHERE ${renderWhere(ast.where, contract, pim)}` : \"\"}${ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\"}`;\n}\nfunction renderRawSql(ast, contract, pim) {\n\tconst out = [];\n\tfor (let i = 0; i < ast.fragments.length; i++) {\n\t\tout.push(ast.fragments[i] ?? \"\");\n\t\tif (i < ast.args.length) {\n\t\t\tconst arg = ast.args[i];\n\t\t\tif (arg !== void 0) out.push(renderExpr(arg, contract, pim));\n\t\t}\n\t}\n\treturn out.join(\"\");\n}\nfunction renderRawExpr(node, contract, pim) {\n\treturn node.parts.map((part) => typeof part === \"string\" ? part : renderExpr(part, contract, pim)).join(\"\");\n}\n//#endregion\nexport { adapterError as n, renderLoweredSql as t };\n\n//# sourceMappingURL=sql-renderer-CZE98PJj.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;;;AAUA,MAAM,mDAAmD,IAAI,IAAI;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,iBAAiB,OAAO,SAAS,yBAAyB,MAAM,YAAY;CACpF,IAAI,YAAY,KAAK,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S,WAAW,OAAO,WAAW,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AAC3G"}
|
|
1
|
+
{"version":3,"file":"sql-renderer-CZE98PJj-E5yVGXmL.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/sql-renderer-CZE98PJj.mjs"],"sourcesContent":["import { LiteralExpr, collectOrderedParamRefs } from \"@internal/sql-relational-core/ast\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { isPgEnumParams } from \"@internal/target-postgres/codecs\";\nimport { escapeLiteral, quoteIdentifier, quoteQualifiedName } from \"@internal/target-postgres/sql-utils\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\nimport { runtimeError } from \"@internal/framework-components/runtime\";\n//#region src/core/adapter-errors.ts\nfunction adapterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/core/sql-renderer.ts\n/**\n* Postgres native types whose unknown-OID parameter inference is reliable in arbitrary expression positions. Parameters bound to a descriptor whose `nativeTypeFor` result falls in this set are emitted as plain `$N`; everything else (including `json`, `jsonb`, extension types like `vector`, and unknown user types) is emitted as `$N::<nativeType>` so the planner picks an unambiguous overload.\n*\n* `json` / `jsonb` are intentionally excluded despite being Postgres builtins: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).\n*\n* Spellings match the target descriptors' `nativeTypeFor` results, not the `udt_name` abbreviations that ADR 205 used as illustrative shorthand. The registry-based cast policy compares against these strings directly.\n*/\nconst POSTGRES_INFERRABLE_NATIVE_TYPES = /* @__PURE__ */ new Set([\n\t\"integer\",\n\t\"smallint\",\n\t\"bigint\",\n\t\"real\",\n\t\"double precision\",\n\t\"numeric\",\n\t\"boolean\",\n\t\"text\",\n\t\"character\",\n\t\"character varying\",\n\t\"timestamp\",\n\t\"timestamp without time zone\",\n\t\"timestamp with time zone\",\n\t\"time\",\n\t\"timetz\",\n\t\"interval\",\n\t\"bit\",\n\t\"bit varying\"\n]);\nfunction renderTypedParam(index, codecId, codecDescriptorRegistry, many, typeParams) {\n\tif (codecId === void 0) return `$${index}`;\n\tconst descriptor = codecDescriptorRegistry.descriptorFor(codecId);\n\tif (descriptor === void 0) throw adapterError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `Postgres lowering: ParamRef carries codecId \"${codecId}\" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \\`extensions: [pgvectorRuntime]\\`), or use the codec directly from \\`@internal/target-postgres/codecs\\` if it's a builtin.`, { meta: { codecId } });\n\tconst ref = {\n\t\tcodecId,\n\t\t...ifDefined(\"many\", many),\n\t\t...ifDefined(\"typeParams\", typeParams)\n\t};\n\tconst nativeType = descriptor.nativeTypeFor(ref);\n\tconst arraySuffix = many ? \"[]\" : \"\";\n\tif (isPgEnumParams(typeParams)) return `$${index}::${quoteQualifiedName(nativeType)}${arraySuffix}`;\n\tif (!POSTGRES_INFERRABLE_NATIVE_TYPES.has(nativeType) || many) return `$${index}::${nativeType}${arraySuffix}`;\n\treturn `$${index}`;\n}\nfunction unreachableKind(value) {\n\tconst candidate = value;\n\tif (typeof candidate === \"object\" && candidate !== null && \"kind\" in candidate && typeof candidate.kind === \"string\") return candidate.kind;\n\treturn \"unknown\";\n}\n/**\n* Render a SQL query AST to a Postgres-flavored `{ sql, params }` payload.\n*\n* Shared between the runtime (`PostgresAdapterImpl.lower`) and control (`PostgresControlAdapter.lower`) entrypoints so emit-time and run-time paths produce byte-identical output for the same AST.\n*/\nfunction renderLoweredSql(ast, contract, codecDescriptorRegistry) {\n\tconst orderedRefs = collectOrderedParamRefs(ast);\n\tconst indexMap = /* @__PURE__ */ new Map();\n\tconst params = orderedRefs.map((ref, i) => {\n\t\tindexMap.set(ref, i + 1);\n\t\treturn ref.kind === \"prepared-param-ref\" ? {\n\t\t\tkind: \"bind\",\n\t\t\tname: ref.name\n\t\t} : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: ref.value\n\t\t};\n\t});\n\tconst pim = {\n\t\tindexMap,\n\t\tcodecDescriptorRegistry\n\t};\n\tconst node = ast;\n\tlet sql;\n\tswitch (node.kind) {\n\t\tcase \"select\":\n\t\t\tsql = renderSelect(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"insert\":\n\t\t\tsql = renderInsert(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"update\":\n\t\t\tsql = renderUpdate(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"delete\":\n\t\t\tsql = renderDelete(node, contract, pim);\n\t\t\tbreak;\n\t\tcase \"raw-sql\":\n\t\t\tsql = renderRawSql(node, contract, pim);\n\t\t\tbreak;\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported AST node kind: ${unreachableKind(node)}`);\n\t}\n\treturn Object.freeze({\n\t\tsql,\n\t\tparams: Object.freeze(params)\n\t});\n}\nfunction renderLimitOffset(keyword, value, contract, pim) {\n\tif (value === void 0) return \"\";\n\tif (typeof value === \"number\") return `${keyword} ${value}`;\n\treturn `${keyword} ${renderExpr(value, contract, pim)}`;\n}\nfunction renderSelect(ast, contract, pim) {\n\tconst sourcesByRef = collectTableSources(ast);\n\treturn [\n\t\t`SELECT ${renderDistinctPrefix(ast.distinct, ast.distinctOn, sourcesByRef, contract, pim)}${renderProjection(ast.projection, contract, pim)}`,\n\t\tast.from !== void 0 ? `FROM ${renderSource(ast.from, contract, pim)}` : \"\",\n\t\tast.joins?.length ? ast.joins.map((join) => renderJoin(join, contract, pim)).join(\" \") : \"\",\n\t\tast.where ? `WHERE ${renderWhere(ast.where, contract, pim)}` : \"\",\n\t\tast.groupBy?.length ? `GROUP BY ${ast.groupBy.map((expr) => renderExpr(expr, contract, pim)).join(\", \")}` : \"\",\n\t\tast.having ? `HAVING ${renderWhere(ast.having, contract, pim)}` : \"\",\n\t\tast.orderBy?.length ? `ORDER BY ${ast.orderBy.map((order) => {\n\t\t\treturn `${renderOrderByExpr(order.expr, sourcesByRef, contract, pim)} ${order.dir.toUpperCase()}`;\n\t\t}).join(\", \")}` : \"\",\n\t\trenderLimitOffset(\"LIMIT\", ast.limit, contract, pim),\n\t\trenderLimitOffset(\"OFFSET\", ast.offset, contract, pim)\n\t].filter((part) => part.length > 0).join(\" \").trim();\n}\n/**\n* Map a SELECT's table references (the FROM source and any JOIN sources) to their storage coordinate, keyed by the name a `ColumnRef.table` would carry (the alias when present, otherwise the table name). Derived-table sources are skipped — their columns are projected through a sub-select, not a base storage column, so the enum hook does not apply.\n*/\nfunction collectTableSources(ast) {\n\tconst sources = /* @__PURE__ */ new Map();\n\tconst add = (source) => {\n\t\tif (source.kind !== \"table-source\") return;\n\t\tconst ref = source.alias ?? source.name;\n\t\tsources.set(ref, {\n\t\t\tname: source.name,\n\t\t\tnamespaceId: source.namespaceId\n\t\t});\n\t};\n\tif (ast.from !== void 0) add(ast.from);\n\tfor (const join of ast.joins ?? []) add(join.source);\n\treturn sources;\n}\n/**\n* Ordered, codec-encoded values of the value-set a storage column restricts to, or `undefined` when the referenced column carries no value-set (the common, non-enum case). Resolves the column's storage coordinate from the SELECT's table sources, then the column's `valueSet` ref to the value-set's `values`.\n*/\nfunction allStrings(values) {\n\treturn values.every((value) => typeof value === \"string\");\n}\nfunction resolveEnumOrderValues(ref, sourcesByRef, contract) {\n\tconst source = sourcesByRef.get(ref.table);\n\tif (source === void 0 || source.namespaceId === void 0) return;\n\tconst sourceNs = contract.storage.namespaces[source.namespaceId];\n\tconst valueSet = (sourceNs !== void 0 ? sourceNs.entries.table?.[source.name]?.columns[ref.column] : void 0)?.valueSet;\n\tif (valueSet === void 0) return;\n\tconst valueSetNs = contract.storage.namespaces[valueSet.namespaceId];\n\treturn valueSetNs !== void 0 ? valueSetNs.entries.valueSet?.[valueSet.entityName]?.values : void 0;\n}\n/**\n* Ordered values for an unqualified ORDER BY column (an `identifier-ref`, the shape the sql-builder emits for `.orderBy('col')`). Scans every FROM/JOIN source for a column of that name. Resolves only when exactly one source has a column of that name and it carries a value-set; if more than one source has such a column the bare identifier is ambiguous (regardless of which are enum-backed), so it falls through to the plain column rendering.\n*/\nfunction resolveEnumOrderValuesForIdentifier(name, sourcesByRef, contract) {\n\tlet matchedColumns = 0;\n\tlet resolved;\n\tfor (const source of sourcesByRef.values()) {\n\t\tif (source.namespaceId === void 0) continue;\n\t\tconst identNs = contract.storage.namespaces[source.namespaceId];\n\t\tconst column = identNs !== void 0 ? identNs.entries.table?.[source.name]?.columns[name] : void 0;\n\t\tif (column === void 0) continue;\n\t\tmatchedColumns += 1;\n\t\tif (matchedColumns > 1) return;\n\t\tconst valueSet = column.valueSet;\n\t\tif (valueSet === void 0) return;\n\t\tconst valueSetNs = contract.storage.namespaces[valueSet.namespaceId];\n\t\tresolved = valueSetNs !== void 0 ? valueSetNs.entries.valueSet?.[valueSet.entityName]?.values : void 0;\n\t}\n\treturn resolved;\n}\n/**\n* Render an ORDER BY expression. A column reference onto an enum-restricted column sorts by declaration order via `array_position(ARRAY[…]::text[], <col>)` over the value-set's ordered values (NULLs return `NULL` from `array_position`, sorting per the clause's default NULL handling). Both qualified `column-ref`s and the unqualified `identifier-ref`s the sql-builder emits for `.orderBy('col')` are intercepted. Every other expression renders unchanged.\n*/\nfunction renderOrderByExpr(expr, sourcesByRef, contract, pim) {\n\tif (expr.kind === \"column-ref\") {\n\t\tconst orderValues = resolveEnumOrderValues(expr, sourcesByRef, contract);\n\t\tif (orderValues !== void 0 && allStrings(orderValues)) return `array_position(ARRAY[${orderValues.map((value) => `'${escapeLiteral(value)}'`).join(\", \")}]::text[], ${renderColumn(expr)})`;\n\t}\n\tif (expr.kind === \"identifier-ref\") {\n\t\tconst orderValues = resolveEnumOrderValuesForIdentifier(expr.name, sourcesByRef, contract);\n\t\tif (orderValues !== void 0 && allStrings(orderValues)) return `array_position(ARRAY[${orderValues.map((value) => `'${escapeLiteral(value)}'`).join(\", \")}]::text[], ${quoteIdentifier(expr.name)})`;\n\t}\n\treturn renderExpr(expr, contract, pim);\n}\nfunction renderProjection(projection, contract, pim) {\n\treturn projection.map((item) => {\n\t\tconst alias = quoteIdentifier(item.alias);\n\t\tif (item.expr.kind === \"literal\") return `${renderLiteral(item.expr)} AS ${alias}`;\n\t\treturn `${renderExpr(item.expr, contract, pim)} AS ${alias}`;\n\t}).join(\", \");\n}\nfunction renderReturning(items, contract, pim) {\n\treturn items.map((item) => {\n\t\tif (item.expr.kind === \"column-ref\") {\n\t\t\tconst rendered = renderColumn(item.expr);\n\t\t\treturn item.expr.column === item.alias ? rendered : `${rendered} AS ${quoteIdentifier(item.alias)}`;\n\t\t}\n\t\tif (item.expr.kind === \"literal\") return `${renderLiteral(item.expr)} AS ${quoteIdentifier(item.alias)}`;\n\t\treturn `${renderExpr(item.expr, contract, pim)} AS ${quoteIdentifier(item.alias)}`;\n\t}).join(\", \");\n}\nfunction renderDistinctPrefix(distinct, distinctOn, sourcesByRef, contract, pim) {\n\tif (distinctOn && distinctOn.length > 0) return `DISTINCT ON (${distinctOn.map((expr) => renderOrderByExpr(expr, sourcesByRef, contract, pim)).join(\", \")}) `;\n\tif (distinct) return \"DISTINCT \";\n\treturn \"\";\n}\nfunction hasExplicitSchema(table) {\n\treturn \"schema\" in table && typeof table.schema === \"string\";\n}\nfunction qualifyTableFromNamespaceCoordinate(table, contract) {\n\tif (hasExplicitSchema(table)) return `${quoteIdentifier(table.schema)}.${quoteIdentifier(table.name)}`;\n\tif (table.namespaceId === void 0) return quoteIdentifier(table.name);\n\tconst namespace = contract.storage.namespaces[table.namespaceId];\n\tif (namespace === void 0) throw adapterError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which is not present as a Postgres schema on the contract`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: \"not-present\"\n\t} });\n\tconst qualifyTable = namespace.qualifyTable;\n\tif (qualifyTable === void 0) throw adapterError(\"RUNTIME.NAMESPACE_UNKNOWN\", `Table \"${table.name}\" references namespace \"${table.namespaceId}\" which is not materialised as a Postgres schema on the contract`, { meta: {\n\t\ttable: table.name,\n\t\tnamespaceId: table.namespaceId,\n\t\treason: \"not-materialised\"\n\t} });\n\treturn qualifyTable.call(namespace, table.name);\n}\nfunction renderTableSource(source, contract) {\n\tconst qualified = qualifyTableFromNamespaceCoordinate(source, contract);\n\tif (!source.alias) return qualified;\n\treturn `${qualified} AS ${quoteIdentifier(source.alias)}`;\n}\nfunction renderSource(source, contract, pim) {\n\tconst node = source;\n\tswitch (node.kind) {\n\t\tcase \"table-source\": return renderTableSource(node, contract);\n\t\tcase \"derived-table-source\": return `(${renderSelect(node.query, contract, pim)}) AS ${quoteIdentifier(node.alias)}`;\n\t\tcase \"function-source\": {\n\t\t\tconst args = node.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \");\n\t\t\treturn `${`${node.fn}(${args})`}${node.ordinality ? \" WITH ORDINALITY\" : \"\"}${node.alias === void 0 ? \"\" : ` AS ${quoteIdentifier(node.alias)}`}${node.columnAliases === void 0 ? \"\" : `(${node.columnAliases.map((column) => quoteIdentifier(column)).join(\", \")})`}`;\n\t\t}\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported source node kind: ${unreachableKind(node)}`);\n\t}\n}\nfunction assertScalarSubquery(query) {\n\tif (query.projection.length !== 1) throw adapterError(\"RUNTIME.AST_INVALID\", \"Subquery expressions must project exactly one column\", { meta: { node: \"subquery-expr\" } });\n}\nfunction renderSubqueryExpr(expr, contract, pim) {\n\tassertScalarSubquery(expr.query);\n\treturn `(${renderSelect(expr.query, contract, pim)})`;\n}\nfunction renderWhere(expr, contract, pim) {\n\treturn renderExpr(expr, contract, pim);\n}\nfunction renderNullCheck(expr, contract, pim) {\n\tconst rendered = renderExpr(expr.expr, contract, pim);\n\tconst renderedExpr = isAtomicExpressionKind(expr.expr.kind) ? rendered : `(${rendered})`;\n\treturn expr.isNull ? `${renderedExpr} IS NULL` : `${renderedExpr} IS NOT NULL`;\n}\n/**\n* Atomic expression kinds whose rendered SQL is already self-delimited (a column reference, parameter, literal, function call, aggregate, etc.) and therefore does not need surrounding parentheses when used as the left operand of a postfix predicate like `IS NULL` or `IS NOT NULL`, or as either operand of a binary infix operator.\n*\n* Anything not in this set is treated as composite (binary, AND/OR/NOT, EXISTS, nested IS NULL, subqueries, operation templates) and gets wrapped to preserve grouping.\n*/\nfunction isAtomicExpressionKind(kind) {\n\tswitch (kind) {\n\t\tcase \"column-ref\":\n\t\tcase \"identifier-ref\":\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\tcase \"literal\":\n\t\tcase \"aggregate\":\n\t\tcase \"window-func\":\n\t\tcase \"function-call\":\n\t\tcase \"cast\":\n\t\tcase \"case\":\n\t\tcase \"json-object\":\n\t\tcase \"json-array-agg\":\n\t\tcase \"list\": return true;\n\t\tcase \"subquery\":\n\t\tcase \"operation\":\n\t\tcase \"binary\":\n\t\tcase \"and\":\n\t\tcase \"or\":\n\t\tcase \"exists\":\n\t\tcase \"null-check\":\n\t\tcase \"not\":\n\t\tcase \"raw-expr\": return false;\n\t}\n}\nfunction renderBinary(expr, contract, pim) {\n\tif (expr.right.kind === \"list\" && expr.right.values.length === 0) {\n\t\tif (expr.op === \"in\") return \"FALSE\";\n\t\tif (expr.op === \"notIn\") return \"TRUE\";\n\t}\n\tconst leftExpr = expr.left;\n\tconst left = renderExpr(leftExpr, contract, pim);\n\tconst leftRendered = leftExpr.kind === \"operation\" || leftExpr.kind === \"subquery\" ? `(${left})` : left;\n\tconst rightNode = expr.right;\n\tlet right;\n\tswitch (rightNode.kind) {\n\t\tcase \"list\":\n\t\t\tright = renderListLiteral(rightNode, contract, pim);\n\t\t\tbreak;\n\t\tcase \"literal\":\n\t\t\tright = renderLiteral(rightNode);\n\t\t\tbreak;\n\t\tcase \"column-ref\":\n\t\t\tright = renderColumn(rightNode);\n\t\t\tbreak;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\":\n\t\t\tright = renderParamRef(rightNode, pim);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tright = renderExpr(rightNode, contract, pim);\n\t\t\tbreak;\n\t}\n\treturn `${leftRendered} ${{\n\t\teq: \"=\",\n\t\tneq: \"!=\",\n\t\tgt: \">\",\n\t\tlt: \"<\",\n\t\tgte: \">=\",\n\t\tlte: \"<=\",\n\t\tlike: \"LIKE\",\n\t\tin: \"IN\",\n\t\tnotIn: \"NOT IN\"\n\t}[expr.op]} ${right}`;\n}\nfunction renderListLiteral(expr, contract, pim) {\n\tif (expr.values.length === 0) return \"(NULL)\";\n\treturn `(${expr.values.map((v) => {\n\t\tif (v.kind === \"param-ref\" || v.kind === \"prepared-param-ref\") return renderParamRef(v, pim);\n\t\tif (v.kind === \"literal\") return renderLiteral(v);\n\t\treturn renderExpr(v, contract, pim);\n\t}).join(\", \")})`;\n}\nfunction renderColumn(ref) {\n\tif (ref.table === \"excluded\") return `excluded.${quoteIdentifier(ref.column)}`;\n\treturn `${quoteIdentifier(ref.table)}.${quoteIdentifier(ref.column)}`;\n}\nfunction renderAggregateExpr(expr, contract, pim) {\n\tconst fn = expr.fn.toUpperCase();\n\tif (!expr.expr) return `${fn}(*)`;\n\treturn `${fn}(${renderExpr(expr.expr, contract, pim)})`;\n}\nfunction renderWindowFuncExpr(expr, contract, pim) {\n\treturn `${expr.fn.toUpperCase()}(${expr.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \")}) OVER (${[expr.partitionBy && expr.partitionBy.length > 0 ? `PARTITION BY ${expr.partitionBy.map((e) => renderExpr(e, contract, pim)).join(\", \")}` : \"\", expr.orderBy && expr.orderBy.length > 0 ? `ORDER BY ${renderOrderByItems(expr.orderBy, contract, pim)}` : \"\"].filter((part) => part.length > 0).join(\" \")})`;\n}\nfunction renderFunctionCallExpr(expr, contract, pim) {\n\tconst args = expr.args.map((arg) => renderExpr(arg, contract, pim)).join(\", \");\n\treturn `${expr.fn}(${args})`;\n}\nfunction renderCastExpr(expr, contract, pim) {\n\treturn `CAST(${renderExpr(expr.expr, contract, pim)} AS ${expr.targetType})`;\n}\nfunction renderCaseExpr(expr, contract, pim) {\n\treturn `CASE ${expr.branches.map((branch) => `WHEN ${renderExpr(branch.condition, contract, pim)} THEN ${renderExpr(branch.value, contract, pim)}`).join(\" \")}${expr.elseExpr === void 0 ? \"\" : ` ELSE ${renderExpr(expr.elseExpr, contract, pim)}`} END`;\n}\nfunction renderJsonValueProjection(projection, contract, pim) {\n\treturn projection.accept({\n\t\tcodec: ({ value, codec }) => renderExpr(projectJsonThroughCodec(value, codec, pim), contract, pim),\n\t\tnative: ({ value }) => renderExpr(value, contract, pim),\n\t\tdocument: ({ value }) => renderExpr(value, contract, pim)\n\t});\n}\nfunction projectJsonThroughCodec(value, codec, pim) {\n\tconst descriptor = pim.codecDescriptorRegistry.descriptorFor(codec.codecId);\n\tif (descriptor === void 0) throw adapterError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", `Postgres lowering: a JSON projection carries codecId \"${codec.codecId}\" but the validated PostgreSQL codec registry has no entry for it. This usually indicates a missing extension pack in the runtime stack — register the pack that contributes this codec (e.g. \\`extensions: [pgvectorRuntime]\\`), or use the codec directly from \\`@internal/target-postgres/codecs\\` if it's a builtin.`, { meta: { codecId: codec.codecId } });\n\treturn descriptor.projectJson(value, codec);\n}\nfunction renderJsonObjectExpr(expr, contract, pim) {\n\treturn `json_build_object(${expr.entries.flatMap((entry) => {\n\t\treturn [`'${escapeLiteral(entry.key)}'`, renderJsonValueProjection(entry.value, contract, pim)];\n\t}).join(\", \")})`;\n}\nfunction renderOrderByItems(items, contract, pim) {\n\treturn items.map((item) => `${renderExpr(item.expr, contract, pim)} ${item.dir.toUpperCase()}`).join(\", \");\n}\nfunction renderJsonArrayAggExpr(expr, contract, pim) {\n\tconst aggregateOrderBy = expr.orderBy && expr.orderBy.length > 0 ? ` ORDER BY ${renderOrderByItems(expr.orderBy, contract, pim)}` : \"\";\n\tconst aggregated = `json_agg(${renderJsonValueProjection(expr.expr, contract, pim)}${aggregateOrderBy})`;\n\tif (expr.onEmpty === \"emptyArray\") return `coalesce(${aggregated}, json_build_array())`;\n\treturn aggregated;\n}\nfunction renderExpr(expr, contract, pim) {\n\tconst node = expr;\n\tswitch (node.kind) {\n\t\tcase \"column-ref\": return renderColumn(node);\n\t\tcase \"identifier-ref\": return quoteIdentifier(node.name);\n\t\tcase \"operation\": return renderOperation(node, contract, pim);\n\t\tcase \"subquery\": return renderSubqueryExpr(node, contract, pim);\n\t\tcase \"aggregate\": return renderAggregateExpr(node, contract, pim);\n\t\tcase \"window-func\": return renderWindowFuncExpr(node, contract, pim);\n\t\tcase \"function-call\": return renderFunctionCallExpr(node, contract, pim);\n\t\tcase \"cast\": return renderCastExpr(node, contract, pim);\n\t\tcase \"case\": return renderCaseExpr(node, contract, pim);\n\t\tcase \"json-object\": return renderJsonObjectExpr(node, contract, pim);\n\t\tcase \"json-array-agg\": return renderJsonArrayAggExpr(node, contract, pim);\n\t\tcase \"binary\": return renderBinary(node, contract, pim);\n\t\tcase \"and\":\n\t\t\tif (node.exprs.length === 0) return \"TRUE\";\n\t\t\treturn `(${node.exprs.map((part) => renderExpr(part, contract, pim)).join(\" AND \")})`;\n\t\tcase \"or\":\n\t\t\tif (node.exprs.length === 0) return \"FALSE\";\n\t\t\treturn `(${node.exprs.map((part) => renderExpr(part, contract, pim)).join(\" OR \")})`;\n\t\tcase \"exists\": return `${node.notExists ? \"NOT \" : \"\"}EXISTS (${renderSelect(node.subquery, contract, pim)})`;\n\t\tcase \"null-check\": return renderNullCheck(node, contract, pim);\n\t\tcase \"not\": return `NOT (${renderExpr(node.expr, contract, pim)})`;\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParamRef(node, pim);\n\t\tcase \"literal\": return renderLiteral(node);\n\t\tcase \"list\": return renderListLiteral(node, contract, pim);\n\t\tcase \"raw-expr\": return renderRawExpr(node, contract, pim);\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(node, `Unsupported expression node kind: ${unreachableKind(node)}`);\n\t}\n}\nfunction renderParamRef(ref, pim) {\n\tconst index = pim.indexMap.get(ref);\n\tif (index === void 0) throw new InternalError(\"ParamRef not found in index map\");\n\tif (ref.kind === \"prepared-param-ref\") return renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);\n\tif (ref.codec === void 0) throw runtimeError(\"RUNTIME.PARAM_REF_MISSING_CODEC\", \"Postgres renderer: ParamRef reached lowering without a bound CodecRef. Every column-bound ParamRef must carry a codec under the AST-bound codec contract. This usually indicates a builder path that constructed a ParamRef without threading the column codec.\", {\n\t\tparamIndex: index,\n\t\t...ifDefined(\"name\", ref.name)\n\t});\n\treturn renderTypedParam(index, ref.codec.codecId, pim.codecDescriptorRegistry, ref.codec.many, ref.codec.typeParams);\n}\nfunction renderLiteral(expr) {\n\tif (typeof expr.value === \"string\") return `'${escapeLiteral(expr.value)}'`;\n\tif (typeof expr.value === \"number\" || typeof expr.value === \"boolean\") return String(expr.value);\n\tif (typeof expr.value === \"bigint\") return String(expr.value);\n\tif (expr.value === null) return \"NULL\";\n\tif (expr.value === void 0) return \"NULL\";\n\tif (expr.value instanceof Date) return `'${escapeLiteral(expr.value.toISOString())}'`;\n\tif (Array.isArray(expr.value)) return `ARRAY[${expr.value.map((v) => renderLiteral(new LiteralExpr(v))).join(\", \")}]`;\n\tconst json = JSON.stringify(expr.value);\n\tif (json === void 0) return \"NULL\";\n\treturn `'${escapeLiteral(json)}'`;\n}\nfunction renderOperation(expr, contract, pim) {\n\tconst self = renderExpr(expr.self, contract, pim);\n\tconst args = expr.args.map((arg) => {\n\t\treturn renderExpr(arg, contract, pim);\n\t});\n\treturn expr.lowering.template.replace(/\\{\\{self\\}\\}|\\{\\{arg(\\d+)\\}\\}/g, (token, argIndex) => {\n\t\tif (token === \"{{self}}\") return self;\n\t\tconst arg = args[Number(argIndex)];\n\t\tif (arg === void 0) throw adapterError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Operation lowering template for \"${expr.method}\" referenced missing argument {{arg${argIndex}}}; template has ${args.length} arg(s)`, { meta: { method: expr.method } });\n\t\treturn arg;\n\t});\n}\nfunction renderJoin(join, contract, pim) {\n\treturn `${join.joinType.toUpperCase()} JOIN ${join.lateral ? \"LATERAL \" : \"\"}${renderSource(join.source, contract, pim)} ON ${renderJoinOn(join.on, contract, pim)}`;\n}\nfunction renderJoinOn(on, contract, pim) {\n\tif (on.kind === \"eq-col-join-on\") return `${renderColumn(on.left)} = ${renderColumn(on.right)}`;\n\treturn renderWhere(on, contract, pim);\n}\nfunction getInsertColumnOrder(rows, contract, tableRef) {\n\tconst tableName = tableRef.name;\n\tconst orderedColumns = [];\n\tconst seenColumns = /* @__PURE__ */ new Set();\n\tfor (const row of rows) for (const column of Object.keys(row)) {\n\t\tif (seenColumns.has(column)) continue;\n\t\tseenColumns.add(column);\n\t\torderedColumns.push(column);\n\t}\n\tif (orderedColumns.length > 0) return orderedColumns;\n\tlet table;\n\tif (tableRef.namespaceId !== void 0) {\n\t\tconst ns = contract.storage.namespaces[tableRef.namespaceId];\n\t\ttable = ns !== void 0 ? ns.entries.table?.[tableName] : void 0;\n\t}\n\tif (table === void 0) for (const ns of Object.values(contract.storage.namespaces)) {\n\t\tconst found = ns.entries.table?.[tableName];\n\t\tif (found !== void 0) {\n\t\t\ttable = found;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!table) throw adapterError(\"RUNTIME.AST_INVALID\", `INSERT target table not found in contract storage: ${tableName}`, { meta: {\n\t\tnode: \"insert\",\n\t\ttable: tableName\n\t} });\n\treturn Object.keys(table.columns);\n}\nfunction renderInsertValue(value, contract, pim) {\n\tif (!value || value.kind === \"default-value\") return \"DEFAULT\";\n\tswitch (value.kind) {\n\t\tcase \"param-ref\":\n\t\tcase \"prepared-param-ref\": return renderParamRef(value, pim);\n\t\tcase \"column-ref\": return renderColumn(value);\n\t\tcase \"raw-expr\": return renderExpr(value, contract, pim);\n\t\t// v8 ignore next 4\n\t\tdefault: assertNever(value, `Unsupported value node in INSERT: ${unreachableKind(value)}`);\n\t}\n}\nfunction renderInsert(ast, contract, pim) {\n\tconst table = qualifyTableFromNamespaceCoordinate(ast.table, contract);\n\tconst rows = ast.rows;\n\tif (rows.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT requires at least one row\", { meta: { node: \"insert\" } });\n\tconst hasExplicitValues = rows.some((row) => Object.keys(row).length > 0);\n\treturn `${(() => {\n\t\tif (!hasExplicitValues) {\n\t\t\tif (rows.length === 1) return `INSERT INTO ${table} DEFAULT VALUES`;\n\t\t\tconst defaultColumns = getInsertColumnOrder(rows, contract, ast.table);\n\t\t\tif (defaultColumns.length === 0) return `INSERT INTO ${table} VALUES ${rows.map(() => \"()\").join(\", \")}`;\n\t\t\tconst quotedColumns = defaultColumns.map((column) => quoteIdentifier(column));\n\t\t\tconst defaultRow = `(${defaultColumns.map(() => \"DEFAULT\").join(\", \")})`;\n\t\t\treturn `INSERT INTO ${table} (${quotedColumns.join(\", \")}) VALUES ${rows.map(() => defaultRow).join(\", \")}`;\n\t\t}\n\t\tconst columnOrder = getInsertColumnOrder(rows, contract, ast.table);\n\t\tconst columns = columnOrder.map((column) => quoteIdentifier(column));\n\t\tconst values = rows.map((row) => {\n\t\t\treturn `(${columnOrder.map((column) => renderInsertValue(row[column], contract, pim)).join(\", \")})`;\n\t\t}).join(\", \");\n\t\treturn `INSERT INTO ${table} (${columns.join(\", \")}) VALUES ${values}`;\n\t})()}${ast.onConflict ? (() => {\n\t\tconst conflictColumns = ast.onConflict.columns.map((col) => quoteIdentifier(col.column));\n\t\tif (conflictColumns.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT onConflict requires at least one conflict column\", { meta: { node: \"insert-on-conflict\" } });\n\t\tconst action = ast.onConflict.action;\n\t\tswitch (action.kind) {\n\t\t\tcase \"do-nothing\": return ` ON CONFLICT (${conflictColumns.join(\", \")}) DO NOTHING`;\n\t\t\tcase \"do-update-set\": {\n\t\t\t\tconst updateEntries = Object.entries(action.set);\n\t\t\t\tif (updateEntries.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"INSERT onConflict do-update-set requires at least one assignment\", { meta: { node: \"insert-on-conflict\" } });\n\t\t\t\tconst updates = updateEntries.map(([colName, value]) => {\n\t\t\t\t\treturn `${quoteIdentifier(colName)} = ${renderExpr(value, contract, pim)}`;\n\t\t\t\t});\n\t\t\t\treturn ` ON CONFLICT (${conflictColumns.join(\", \")}) DO UPDATE SET ${updates.join(\", \")}`;\n\t\t\t}\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: assertNever(action, `Unsupported onConflict action: ${unreachableKind(action)}`);\n\t\t}\n\t})() : \"\"}${ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\"}`;\n}\nfunction renderUpdate(ast, contract, pim) {\n\tconst table = qualifyTableFromNamespaceCoordinate(ast.table, contract);\n\tconst setEntries = Object.entries(ast.set);\n\tif (setEntries.length === 0) throw adapterError(\"RUNTIME.AST_INVALID\", \"UPDATE requires at least one SET assignment\", { meta: { node: \"update\" } });\n\tconst setClauses = setEntries.map(([col, val]) => {\n\t\treturn `${quoteIdentifier(col)} = ${renderExpr(val, contract, pim)}`;\n\t});\n\tconst whereClause = ast.where ? ` WHERE ${renderWhere(ast.where, contract, pim)}` : \"\";\n\tconst returningClause = ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\";\n\treturn `UPDATE ${table} SET ${setClauses.join(\", \")}${whereClause}${returningClause}`;\n}\nfunction renderDelete(ast, contract, pim) {\n\treturn `DELETE FROM ${qualifyTableFromNamespaceCoordinate(ast.table, contract)}${ast.where ? ` WHERE ${renderWhere(ast.where, contract, pim)}` : \"\"}${ast.returning?.length ? ` RETURNING ${renderReturning(ast.returning, contract, pim)}` : \"\"}`;\n}\nfunction renderRawSql(ast, contract, pim) {\n\tconst out = [];\n\tfor (let i = 0; i < ast.fragments.length; i++) {\n\t\tout.push(ast.fragments[i] ?? \"\");\n\t\tif (i < ast.args.length) {\n\t\t\tconst arg = ast.args[i];\n\t\t\tif (arg !== void 0) out.push(renderExpr(arg, contract, pim));\n\t\t}\n\t}\n\treturn out.join(\"\");\n}\nfunction renderRawExpr(node, contract, pim) {\n\treturn node.parts.map((part) => typeof part === \"string\" ? part : renderExpr(part, contract, pim)).join(\"\");\n}\n//#endregion\nexport { adapterError as n, renderLoweredSql as t };\n\n//# sourceMappingURL=sql-renderer-CZE98PJj.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;;;AAUA,MAAM,mDAAmD,IAAI,IAAI;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,iBAAiB,OAAO,SAAS,yBAAyB,MAAM,YAAY;CACpF,IAAI,YAAY,KAAK,GAAG,OAAO,IAAI;CACnC,MAAM,aAAa,wBAAwB,cAAc,OAAO;CAChE,IAAI,eAAe,KAAK,GAAG,MAAM,aAAa,mCAAmC,gDAAgD,QAAQ,2TAA2T,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;CACzd,MAAM,MAAM;EACX;EACA,GAAG,UAAU,QAAQ,IAAI;EACzB,GAAG,UAAU,cAAc,UAAU;CACtC;CACA,MAAM,aAAa,WAAW,cAAc,GAAG;CAC/C,MAAM,cAAc,OAAO,OAAO;CAClC,IAAI,eAAe,UAAU,GAAG,OAAO,IAAI,MAAM,IAAI,mBAAmB,UAAU,IAAI;CACtF,IAAI,CAAC,iCAAiC,IAAI,UAAU,KAAK,MAAM,OAAO,IAAI,MAAM,IAAI,aAAa;CACjG,OAAO,IAAI;AACZ;AACA,SAAS,gBAAgB,OAAO;CAC/B,MAAM,YAAY;CAClB,IAAI,OA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,IAAI,cAAc;AACrE;AACA,SAAS,aAAa,KAAK,UAAU,KAAK;CACzC,OAAO,eAAe,oCAAoC,IAAI,OAAO,QAAQ,IAAI,IAAI,QAAQ,UAAU,YAAY,IAAI,OAAO,UAAU,GAAG,MAAM,KAAK,IAAI,WAAW,SAAS,cAAc,gBAAgB,IAAI,WAAW,UAAU,GAAG,MAAM;AAC/O;AACA,SAAS,aAAa,KAAK,UAAU,KAAK;CACzC,MAAM,MAAM,CAAC;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,UAAU,QAAQ,KAAK;EAC9C,IAAI,KAAK,IAAI,UAAU,MAAM,EAAE;EAC/B,IAAI,IAAI,IAAI,KAAK,QAAQ;GACxB,MAAM,MAAM,IAAI,KAAK;GACrB,IAAI,QAAQ,KAAK,GAAG,IAAI,KAAK,WAAW,KAAK,UAAU,GAAG,CAAC;EAC5D;CACD;CACA,OAAO,IAAI,KAAK,EAAE;AACnB;AACA,SAAS,cAAc,MAAM,UAAU,KAAK;CAC3C,OAAO,KAAK,MAAM,KAAK,SAAS,OAAO,SAAS,WAAW,OAAO,WAAW,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AAC3G"}
|
package/dist/target.d.mts
CHANGED
|
@@ -15,12 +15,12 @@ import { n as postgresResolveDefault, t as parsePostgresDefault } from "./defaul
|
|
|
15
15
|
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-DqJlOTeX.mjs";
|
|
16
16
|
import { a as validateEnumValueLength, i as quoteQualifiedName, n as qualifyName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-DW6fkczF.mjs";
|
|
17
17
|
import { t as postgresAggregateDescriptors } from "./aggregates-CgqNfj2O.mjs";
|
|
18
|
-
import { A as
|
|
19
|
-
import "./codec-ids-
|
|
20
|
-
import { $ as
|
|
21
|
-
import { a as JsonValue$1, c as Timestamp, d as VarBit, f as Varchar, i as Interval, l as Timestamptz, n as Char, o as Numeric, r as CodecTypes, s as Time, t as Bit, u as Timetz } from "./codec-types-
|
|
22
|
-
import "./codec-types-
|
|
23
|
-
import { n as postgresCodecRegistry, t as postgresCodecDescriptorRegistry } from "./codecs-
|
|
18
|
+
import { A as SQL_CHAR_CODEC_ID, C as PG_TIMESTAMP_CODEC_ID, D as PG_UUID_CODEC_ID, E as PG_UNBOUNDED_INT_CODEC_ID, F as SQL_VARCHAR_CODEC_ID, M as SQL_INT_CODEC_ID, N as SQL_TEXT_CODEC_ID, O as PG_VARBIT_CODEC_ID, P as SQL_TIMESTAMP_CODEC_ID, S as PG_TIMESTAMPTZ_CODEC_ID, T as PG_TIME_CODEC_ID, _ as PG_JSONB_CODEC_ID, a as PG_DATE_CODEC_ID, b as PG_TEXT_ARRAY_CODEC_ID, c as PG_FLOAT8_CODEC_ID, d as PG_INT2_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_INT_CODEC_ID, h as PG_INTERVAL_CODEC_ID, i as PG_CHAR_CODEC_ID, j as SQL_FLOAT_CODEC_ID, k as PG_VARCHAR_CODEC_ID, l as PG_FLOAT_CODEC_ID, m as PG_INT8_NUMBER_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_ENUM_CODEC_ID, p as PG_INT8_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT4_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INET_CODEC_ID, v as PG_JSON_CODEC_ID, w as PG_TIMETZ_CODEC_ID, x as PG_TEXT_CODEC_ID, y as PG_NUMERIC_CODEC_ID } from "./codec-ids-Bqu_IwO0-DKOdPizQ.mjs";
|
|
19
|
+
import "./codec-ids-DJ6j6pZc.mjs";
|
|
20
|
+
import { $ as pgTimestampColumn, A as PgVarbitDescriptor, B as pgFloatColumn, C as PgTextDescriptor, D as PgTimetzDescriptor, E as PgTimestamptzDescriptor, F as pgCharColumn, G as pgInt8NumberColumn, H as pgInt2Column, I as pgDateColumn, J as pgJsonColumn, K as pgIntColumn, L as pgEnumDescriptor, M as isPgEnumParams, N as pgBitColumn, O as PgUnboundedIntDescriptor, P as pgBoolColumn, Q as pgTimeColumn, R as pgFloat4Column, S as PgNumericDescriptor, T as PgTimestampDescriptor, U as pgInt4Column, V as pgInetColumn, W as pgInt8Column, X as pgNumericColumn, Y as pgJsonbColumn, Z as pgTextColumn, _ as PgIntDescriptor, a as PgDateDescriptor, at as pgVarcharColumn, b as PgJsonDescriptor, c as PgEnumParams, d as PgFloatDescriptor, et as pgTimestamptzColumn, f as PgInetDescriptor, g as PgInt8NumberDescriptor, h as PgInt8Descriptor, i as PgCharDescriptor, it as pgVarbitColumn, j as PgVarcharDescriptor, k as PgUuidDescriptor, l as PgFloat4Descriptor, m as PgInt4Descriptor, n as PgBoolDescriptor, nt as pgUnboundedIntColumn, o as PgEnumCodec, p as PgInt2Descriptor, q as pgIntervalColumn, rt as pgUuidColumn, s as PgEnumDescriptor, t as PgBitDescriptor, tt as pgTimetzColumn, u as PgFloat8Descriptor, v as PgInterval, w as PgTimeDescriptor, x as PgJsonbDescriptor, y as PgIntervalDescriptor, z as pgFloat8Column } from "./codecs-D8tLswBi-_nbo-Z8x.mjs";
|
|
21
|
+
import { a as JsonValue$1, c as Timestamp, d as VarBit, f as Varchar, i as Interval, l as Timestamptz, n as Char, o as Numeric, r as CodecTypes, s as Time, t as Bit, u as Timetz } from "./codec-types-BRU4F-7t-BaJbKF_i.mjs";
|
|
22
|
+
import "./codec-types-bX63JRLf.mjs";
|
|
23
|
+
import { n as postgresCodecRegistry, t as postgresCodecDescriptorRegistry } from "./codecs-DmCKO7dg.mjs";
|
|
24
24
|
import { A as rlsPolicyExistsAst, C as indexExistsAst, D as noNullValuesAst, E as jsonb, F as textArray, I as timestamptz, L as toRegclass, M as tableIsEmptyAst, N as tablePrimaryKeyAst, O as pgTable, P as text, S as extensionExistsAst, T as int8, _ as columnTypeAst, a as IndexExistsCheckBuilder, b as createTable, c as TableExistsCheckBuilder, d as alterTable, f as buildControlTableBootstrapQueries, g as columnNullabilityAst, h as columnExistsAst, i as ExtensionExistsCheckBuilder, j as tableExistsAst, k as rlsEnabledAst, l as TablePrimaryKeyCheckBuilder, m as columnDefaultAst, n as ColumnExistsCheckBuilder, o as RlsEnabledCheckBuilder, p as buildSignMarkerBootstrapQueries, r as ConstraintExistsCheckBuilder, s as RlsPolicyExistsCheckBuilder, t as ColumnDefaultCheckBuilder, u as addColumnAction, v as constraintExistsAst, w as int4, x as dropDefaultAction, y as createSchema } from "./contract-free-DzpGxLfb.mjs";
|
|
25
25
|
import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrRO-_xPQVPF0.mjs";
|
|
26
26
|
import { t as postgresRenderDefault } from "./control-2F195jJk.mjs";
|
|
@@ -34,7 +34,7 @@ import { t as PostgresContractView } from "./postgres-contract-view-2OP5JnXl-D2f
|
|
|
34
34
|
import { t as PostgresMigration } from "./postgres-migration-DPK9WNF5-DHAXtwys.mjs";
|
|
35
35
|
import { a as fn, c as placeholder, d as unique, i as createExtension, l as primaryKey, n as checkExpression, o as foreignKey, r as col, s as lit, t as MigrationCLI, u as rawSql } from "./migration-DyZpdeyj.mjs";
|
|
36
36
|
import "./op-factory-call-ClseZgmP.mjs";
|
|
37
|
-
import "./pack-
|
|
37
|
+
import "./pack-BYwIb0CN.mjs";
|
|
38
38
|
import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-Cs252KpU-BvXMZvzX.mjs";
|
|
39
39
|
import { n as createPostgresMigrationPlanner, t as contractToPostgresDatabaseSchemaNode } from "./planner-BMBEF8Kc.mjs";
|
|
40
40
|
import { n as buildColumnTypeSql, r as renderDefaultLiteral, t as buildColumnDefaultSql } from "./planner-ddl-builders-ijp60-JO.mjs";
|
|
@@ -46,4 +46,4 @@ import { t as renderOps } from "./render-ops-DPwhZt2W.mjs";
|
|
|
46
46
|
import { t as renderCallsToTypeScript } from "./render-typescript-6sCFvMBh.mjs";
|
|
47
47
|
import { n as PostgresRuntimeTargetInstance, t as PostgresContractSerializer } from "./runtime-_TfO66h5.mjs";
|
|
48
48
|
import { t as resolveDdlSchemaForNamespaceStorage } from "./schema-ir-annotations-DuuYh0gl.mjs";
|
|
49
|
-
export { type AdaptedPostgresCodecDescriptor, AddCheckConstraintCall, AddColumnAction, AddColumnCall, AddForeignKeyCall, AddNativeEnumValueCall, AddNotNullColumnWithTempDefaultCall, AddPrimaryKeyCall, AddUniqueCall, AlterColumnTypeCall, type AlterTableActionVisitor, type AnyAlterTableAction, type AnyPostgresCodecDescriptor, type AnyPostgresDdlNode, Bit, Char, CodecTypes, type ColumnDefaultCheckBuilder, type ColumnExistsCheckBuilder, type ConstraintExistsCheckBuilder, type ContentHashParts, CreateExtensionCall, CreateIndexCall, CreateNativeEnumTypeCall, CreatePostgresRlsPolicyCall, CreateSchemaCall, CreateTableCall, DataTransformCall, type DataTransformClosure, type DataTransformOptions, type DdlIndexElements, DisableRowLevelSecurityCall, DropCheckConstraintCall, DropColumnCall, DropConstraintCall, DropDefaultAction, DropDefaultCall, DropIndexCall, DropNativeEnumTypeCall, DropNotNullCall, DropPostgresRlsPolicyCall, DropTableCall, EnableRowLevelSecurityCall, type ExtensionExistsCheckBuilder, type IndexExistsCheckBuilder, Interval, type JsonValue$1 as JsonValue, PostgresMigration as Migration, MigrationCLI, Numeric, PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_DATE_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, POLICY_OPERATION_PREDICATES, type PgBitDescriptor, type PgBoolDescriptor, type PgCharDescriptor, type PgDateDescriptor, type PgEnumCodec, type PgEnumDescriptor, type PgEnumParams, type PgFloat4Descriptor, type PgFloat8Descriptor, type PgFloatDescriptor, type PgInetDescriptor, type PgInt2Descriptor, type PgInt4Descriptor, type PgInt8Descriptor, type PgIntDescriptor, type PgInterval, type PgIntervalDescriptor, type PgJsonDescriptor, type PgJsonbDescriptor, type PgNumericDescriptor, type PgTextDescriptor, type PgTimeDescriptor, type PgTimestampDescriptor, type PgTimestamptzDescriptor, type PgTimetzDescriptor, type PgUuidDescriptor, type PgVarbitDescriptor, type PgVarcharDescriptor, PostgresAlterIndexRename, PostgresAlterPolicyRename, PostgresAlterTable, type PostgresCheckExpressionCandidate, type PostgresCheckExpressionInput, type PostgresCheckKind, PostgresCodecDescriptor, type PostgresCodecDescriptorRegistry, type PostgresCodecOptions, type PostgresColumnDefault, type PostgresContract, PostgresContractSerializer, PostgresContractView, PostgresCreateIndex, PostgresCreatePolicy, PostgresCreateSchema, PostgresCreateTable, PostgresCreateType, PostgresDatabaseSchemaNode, type PostgresDatabaseSchemaNodeInput, PostgresDdlNode, type PostgresDdlVisitor, PostgresDisableRowLevelSecurity, PostgresDropIndex, PostgresDropPolicy, PostgresDropType, PostgresNamespaceSchemaNode, type PostgresNamespaceSchemaNodeInput, PostgresNativeEnum, type PostgresNativeEnumInput, PostgresNativeEnumSchemaNode, type PostgresNativeEnumSchemaNodeInput, type PostgresPlanTargetDetails, PostgresPolicySchemaNode, type PostgresPolicySchemaNodeInput, PostgresRlsEnablement, type PostgresRlsEnablementInput, PostgresRlsPolicy, type PostgresRlsPolicyInput, PostgresRole, type PostgresRoleInput, PostgresRoleSchemaNode, type PostgresRoleSchemaNodeInput, PostgresRuntimeTargetInstance, PostgresSchema, PostgresSchemaNodeKind, PostgresTableSchemaNode, type PostgresTableSchemaNodeInput, PostgresTableSource, PostgresUnboundSchema, RawSqlCall, RenameIndexCall, RenamePostgresRlsPolicyCall, type RenderedRlsPolicyLiteral, type RlsEnabledCheckBuilder, type RlsPolicyExistsCheckBuilder, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, type SerializedRlsPolicy, SetDefaultCall, SetNotNullCall, type TableExistsCheckBuilder, type TablePrimaryKeyCheckBuilder, Time, Timestamp, Timestamptz, Timetz, TypeScriptRenderablePostgresMigration, VarBit, Varchar, addColumnAction, alterTable, buildBuiltinIdentityValue, buildColumnDefaultSql, buildColumnTypeSql, buildControlTableBootstrapQueries, buildExpectedFormatType, buildPostgresCodecDescriptorRegistry, buildPostgresPlanDiff, buildSchemaLookupMap, buildSignMarkerBootstrapQueries, checkExpression, coalesceSubtreeIssues, col, columnDefaultAst, columnExistsAst, columnNullabilityAst, columnTypeAst, computeContentHash, constraintExistsAst, contractToPostgresDatabaseSchemaNode, createExtension, createPostgresMigrationPlanner, createSchema, createTable, dataTransform, definePostgresCodecs, dropDefaultAction, errorPostgresMigrationStackMissing, escapeLiteral, extensionExistsAst, fn, foreignKey, hasForeignKey, hasIndex, hasUniqueConstraint, indexExistsAst, int4, int8, isPgEnumParams, isPostgresCodecDescriptor, isPostgresSchema, jsonb, lit, noNullValuesAst, normalizeSchemaNativeType, parsePostgresDefault, pgBitColumn, pgBoolColumn, pgCharColumn, pgDateColumn, pgEnumDescriptor, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInetColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTable, pgTextColumn, pgTimeColumn, pgTimestampColumn, pgTimestamptzColumn, pgTimetzColumn, pgUuidColumn, pgVarbitColumn, pgVarcharColumn, placeholder, planIssues, policyInputFromSerialized, postgresAggregateDescriptors, postgresCodec, postgresCodecDescriptorRegistry, postgresCodecRegistry, postgresCreateNamespace, postgresError, postgresRenderCheckExpressions, postgresRenderDefault, postgresResolveDefault, primaryKey, qualifyName, qualifyTableName, quoteIdentifier, quoteQualifiedName, rawSql, renderCallsToTypeScript, renderDefaultLiteral, renderOps, resolveDdlSchemaForNamespaceStorage, resolveIdentityValue, rlsEnabledAst, rlsPolicyExistsAst, tableExistsAst, tableIsEmptyAst, tablePrimaryKeyAst, text, textArray, timestamptz, toRegclass, unique, validateEnumValueLength };
|
|
49
|
+
export { type AdaptedPostgresCodecDescriptor, AddCheckConstraintCall, AddColumnAction, AddColumnCall, AddForeignKeyCall, AddNativeEnumValueCall, AddNotNullColumnWithTempDefaultCall, AddPrimaryKeyCall, AddUniqueCall, AlterColumnTypeCall, type AlterTableActionVisitor, type AnyAlterTableAction, type AnyPostgresCodecDescriptor, type AnyPostgresDdlNode, Bit, Char, CodecTypes, type ColumnDefaultCheckBuilder, type ColumnExistsCheckBuilder, type ConstraintExistsCheckBuilder, type ContentHashParts, CreateExtensionCall, CreateIndexCall, CreateNativeEnumTypeCall, CreatePostgresRlsPolicyCall, CreateSchemaCall, CreateTableCall, DataTransformCall, type DataTransformClosure, type DataTransformOptions, type DdlIndexElements, DisableRowLevelSecurityCall, DropCheckConstraintCall, DropColumnCall, DropConstraintCall, DropDefaultAction, DropDefaultCall, DropIndexCall, DropNativeEnumTypeCall, DropNotNullCall, DropPostgresRlsPolicyCall, DropTableCall, EnableRowLevelSecurityCall, type ExtensionExistsCheckBuilder, type IndexExistsCheckBuilder, Interval, type JsonValue$1 as JsonValue, PostgresMigration as Migration, MigrationCLI, Numeric, PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_DATE_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INT8_NUMBER_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UNBOUNDED_INT_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, POLICY_OPERATION_PREDICATES, type PgBitDescriptor, type PgBoolDescriptor, type PgCharDescriptor, type PgDateDescriptor, type PgEnumCodec, type PgEnumDescriptor, type PgEnumParams, type PgFloat4Descriptor, type PgFloat8Descriptor, type PgFloatDescriptor, type PgInetDescriptor, type PgInt2Descriptor, type PgInt4Descriptor, type PgInt8Descriptor, type PgInt8NumberDescriptor, type PgIntDescriptor, type PgInterval, type PgIntervalDescriptor, type PgJsonDescriptor, type PgJsonbDescriptor, type PgNumericDescriptor, type PgTextDescriptor, type PgTimeDescriptor, type PgTimestampDescriptor, type PgTimestamptzDescriptor, type PgTimetzDescriptor, type PgUnboundedIntDescriptor, type PgUuidDescriptor, type PgVarbitDescriptor, type PgVarcharDescriptor, PostgresAlterIndexRename, PostgresAlterPolicyRename, PostgresAlterTable, type PostgresCheckExpressionCandidate, type PostgresCheckExpressionInput, type PostgresCheckKind, PostgresCodecDescriptor, type PostgresCodecDescriptorRegistry, type PostgresCodecOptions, type PostgresColumnDefault, type PostgresContract, PostgresContractSerializer, PostgresContractView, PostgresCreateIndex, PostgresCreatePolicy, PostgresCreateSchema, PostgresCreateTable, PostgresCreateType, PostgresDatabaseSchemaNode, type PostgresDatabaseSchemaNodeInput, PostgresDdlNode, type PostgresDdlVisitor, PostgresDisableRowLevelSecurity, PostgresDropIndex, PostgresDropPolicy, PostgresDropType, PostgresNamespaceSchemaNode, type PostgresNamespaceSchemaNodeInput, PostgresNativeEnum, type PostgresNativeEnumInput, PostgresNativeEnumSchemaNode, type PostgresNativeEnumSchemaNodeInput, type PostgresPlanTargetDetails, PostgresPolicySchemaNode, type PostgresPolicySchemaNodeInput, PostgresRlsEnablement, type PostgresRlsEnablementInput, PostgresRlsPolicy, type PostgresRlsPolicyInput, PostgresRole, type PostgresRoleInput, PostgresRoleSchemaNode, type PostgresRoleSchemaNodeInput, PostgresRuntimeTargetInstance, PostgresSchema, PostgresSchemaNodeKind, PostgresTableSchemaNode, type PostgresTableSchemaNodeInput, PostgresTableSource, PostgresUnboundSchema, RawSqlCall, RenameIndexCall, RenamePostgresRlsPolicyCall, type RenderedRlsPolicyLiteral, type RlsEnabledCheckBuilder, type RlsPolicyExistsCheckBuilder, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, type SerializedRlsPolicy, SetDefaultCall, SetNotNullCall, type TableExistsCheckBuilder, type TablePrimaryKeyCheckBuilder, Time, Timestamp, Timestamptz, Timetz, TypeScriptRenderablePostgresMigration, VarBit, Varchar, addColumnAction, alterTable, buildBuiltinIdentityValue, buildColumnDefaultSql, buildColumnTypeSql, buildControlTableBootstrapQueries, buildExpectedFormatType, buildPostgresCodecDescriptorRegistry, buildPostgresPlanDiff, buildSchemaLookupMap, buildSignMarkerBootstrapQueries, checkExpression, coalesceSubtreeIssues, col, columnDefaultAst, columnExistsAst, columnNullabilityAst, columnTypeAst, computeContentHash, constraintExistsAst, contractToPostgresDatabaseSchemaNode, createExtension, createPostgresMigrationPlanner, createSchema, createTable, dataTransform, definePostgresCodecs, dropDefaultAction, errorPostgresMigrationStackMissing, escapeLiteral, extensionExistsAst, fn, foreignKey, hasForeignKey, hasIndex, hasUniqueConstraint, indexExistsAst, int4, int8, isPgEnumParams, isPostgresCodecDescriptor, isPostgresSchema, jsonb, lit, noNullValuesAst, normalizeSchemaNativeType, parsePostgresDefault, pgBitColumn, pgBoolColumn, pgCharColumn, pgDateColumn, pgEnumDescriptor, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInetColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgInt8NumberColumn, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTable, pgTextColumn, pgTimeColumn, pgTimestampColumn, pgTimestamptzColumn, pgTimetzColumn, pgUnboundedIntColumn, pgUuidColumn, pgVarbitColumn, pgVarcharColumn, placeholder, planIssues, policyInputFromSerialized, postgresAggregateDescriptors, postgresCodec, postgresCodecDescriptorRegistry, postgresCodecRegistry, postgresCreateNamespace, postgresError, postgresRenderCheckExpressions, postgresRenderDefault, postgresResolveDefault, primaryKey, qualifyName, qualifyTableName, quoteIdentifier, quoteQualifiedName, rawSql, renderCallsToTypeScript, renderDefaultLiteral, renderOps, resolveDdlSchemaForNamespaceStorage, resolveIdentityValue, rlsEnabledAst, rlsPolicyExistsAst, tableExistsAst, tableIsEmptyAst, tablePrimaryKeyAst, text, textArray, timestamptz, toRegclass, unique, validateEnumValueLength };
|