@prisma/orm-target-postgres 8.0.0-rc.1-dev.2 → 8.0.0-rc.1-dev.3
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-BwjBEeND-B7-Hx3r9.mjs → adapter-Ddgpoq1S-D-Ftx9Ls.mjs} +3 -3
- package/dist/{adapter-BwjBEeND-B7-Hx3r9.mjs.map → adapter-Ddgpoq1S-D-Ftx9Ls.mjs.map} +1 -1
- package/dist/adapter.mjs +2 -2
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.mjs +1 -1
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.mjs +2 -2
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/check-expressions-DwM1V1Ky-D9m3Uf8w.d.mts +52 -0
- package/dist/check-expressions-DwM1V1Ky-D9m3Uf8w.d.mts.map +1 -0
- package/dist/check-expressions-drXwak3W-DqFpQtdc.mjs +41 -0
- package/dist/check-expressions-drXwak3W-DqFpQtdc.mjs.map +1 -0
- package/dist/{control-BzDnaGim.mjs → control-8ofLM59h.mjs} +4 -4
- package/dist/{control-BzDnaGim.mjs.map → control-8ofLM59h.mjs.map} +1 -1
- package/dist/{control-adapter-CipVam9p-B-E2SF8_.mjs → control-adapter-D4fT5c42-nSea-5cg.mjs} +10 -81
- package/dist/control-adapter-D4fT5c42-nSea-5cg.mjs.map +1 -0
- package/dist/{control-policy-Cl3RRSPg-BUi6pcI-.mjs → control-policy-wC4BmQy8-Db4igfEn.mjs} +18 -139
- package/dist/control-policy-wC4BmQy8-Db4igfEn.mjs.map +1 -0
- package/dist/{descriptor-meta-DnHabAS3-BiTguA3K.mjs → descriptor-meta-B2fGOCSX-DTh_flIG.mjs} +4 -2
- package/dist/descriptor-meta-B2fGOCSX-DTh_flIG.mjs.map +1 -0
- package/dist/{diff-database-schema-BfRs2vrG-DInOv5LW.mjs → diff-database-schema-wl9GusaU-BjDyKMS6.mjs} +3 -3
- package/dist/{diff-database-schema-BfRs2vrG-DInOv5LW.mjs.map → diff-database-schema-wl9GusaU-BjDyKMS6.mjs.map} +1 -1
- package/dist/{issue-planner-jkY6p-Ca.d.mts → issue-planner-aw7grdXe.d.mts} +2 -2
- package/dist/{issue-planner-jkY6p-Ca.d.mts.map → issue-planner-aw7grdXe.d.mts.map} +1 -1
- package/dist/{migration-CBSAPE8S.d.mts → migration-DyZpdeyj.d.mts} +3 -3
- package/dist/{migration-CBSAPE8S.d.mts.map → migration-DyZpdeyj.d.mts.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/op-factory-call-ClseZgmP.d.mts +1 -0
- package/dist/{op-factory-call-jd4cgfjA-CyNT4YVn.d.mts → op-factory-call-DJEyoQmT-DSMQffKu.d.mts} +5 -5
- package/dist/{op-factory-call-jd4cgfjA-CyNT4YVn.d.mts.map → op-factory-call-DJEyoQmT-DSMQffKu.d.mts.map} +1 -1
- package/dist/{op-factory-call-DifL68KT-CNFEDNsf.mjs → op-factory-call-rf1FJg8l-C6KLaBY1.mjs} +12 -14
- package/dist/op-factory-call-rf1FJg8l-C6KLaBY1.mjs.map +1 -0
- package/dist/{pack-DFM4tmob.d.mts → pack-j8ePkv1A.d.mts} +3 -1
- package/dist/pack-j8ePkv1A.d.mts.map +1 -0
- package/dist/{planner-DL4Bh5Nk.d.mts → planner-BMBEF8Kc.d.mts} +2 -2
- package/dist/{planner-DL4Bh5Nk.d.mts.map → planner-BMBEF8Kc.d.mts.map} +1 -1
- package/dist/{planner-Bmje9ii8-DdjXZxyD.mjs → planner-CqFym7lA-BKHIkh3V.mjs} +6 -6
- package/dist/{planner-Bmje9ii8-DdjXZxyD.mjs.map → planner-CqFym7lA-BKHIkh3V.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-Cicg2sXg-CZI7mdz9.mjs → planner-produced-postgres-migration-Ci6O7OL5-5k5_6lcD.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-Cicg2sXg-CZI7mdz9.mjs.map → planner-produced-postgres-migration-Ci6O7OL5-5k5_6lcD.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts → planner-produced-postgres-migration-Cs252KpU-BvXMZvzX.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-Cs252KpU-BvXMZvzX.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration-Cua5YEYV.d.mts +1 -0
- package/dist/{postgres-migration-CJshdIZn-CT6Cxd4x.mjs → postgres-migration-DJqjEDIS-CP437pha.mjs} +4 -4
- package/dist/{postgres-migration-CJshdIZn-CT6Cxd4x.mjs.map → postgres-migration-DJqjEDIS-CP437pha.mjs.map} +1 -1
- package/dist/{postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts → postgres-migration-DPK9WNF5-DHAXtwys.d.mts} +4 -5
- package/dist/postgres-migration-DPK9WNF5-DHAXtwys.d.mts.map +1 -0
- package/dist/target.d.mts +11 -10
- package/dist/target.mjs +9 -8
- package/dist/target__control.mjs +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__issue-planner.d.mts +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +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-produced-postgres-migration.d.mts +2 -2
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__types.d.mts +2 -1
- package/dist/target__types.mjs +2 -1
- package/dist/types-xa86TkcV.d.mts.map +1 -1
- package/package.json +9 -9
- package/dist/control-adapter-CipVam9p-B-E2SF8_.mjs.map +0 -1
- package/dist/control-policy-Cl3RRSPg-BUi6pcI-.mjs.map +0 -1
- package/dist/descriptor-meta-DnHabAS3-BiTguA3K.mjs.map +0 -1
- package/dist/op-factory-call-DifL68KT-CNFEDNsf.mjs.map +0 -1
- package/dist/op-factory-call-FEA5mnWH.d.mts +0 -1
- package/dist/pack-DFM4tmob.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-C3GPZWeC.d.mts +0 -1
- package/dist/postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as renderLoweredSql, t as adapterError } from "./sql-renderer-CZE98PJj-Bx5D-Txz.mjs";
|
|
2
|
-
import { i as createPostgresCodecRegistryWithBuiltins, t as PostgresControlAdapter } from "./control-adapter-
|
|
2
|
+
import { i as createPostgresCodecRegistryWithBuiltins, t as PostgresControlAdapter } from "./control-adapter-D4fT5c42-nSea-5cg.mjs";
|
|
3
3
|
import { isDdlNode } from "@prisma/orm-family-sql/relational-core/ast";
|
|
4
4
|
import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
|
|
5
|
-
//#region ../../../3-targets/6-adapters/postgres/dist/adapter-
|
|
5
|
+
//#region ../../../3-targets/6-adapters/postgres/dist/adapter-Ddgpoq1S.mjs
|
|
6
6
|
const defaultCapabilities = Object.freeze({
|
|
7
7
|
postgres: {
|
|
8
8
|
orderBy: true,
|
|
@@ -73,4 +73,4 @@ function createPostgresAdapterWithCodecRegistry(codecRegistry) {
|
|
|
73
73
|
//#endregion
|
|
74
74
|
export { createPostgresAdapterWithCodecRegistry as n, postgresRawCodecInferer as r, createPostgresAdapter as t };
|
|
75
75
|
|
|
76
|
-
//# sourceMappingURL=adapter-
|
|
76
|
+
//# sourceMappingURL=adapter-Ddgpoq1S-D-Ftx9Ls.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-
|
|
1
|
+
{"version":3,"file":"adapter-Ddgpoq1S-D-Ftx9Ls.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/adapter-Ddgpoq1S.mjs"],"sourcesContent":["import { n as adapterError, t as renderLoweredSql } from \"./sql-renderer-CZE98PJj.mjs\";\nimport { i as createPostgresCodecRegistryWithBuiltins, t as PostgresControlAdapter } from \"./control-adapter-D4fT5c42.mjs\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { isDdlNode } from \"@internal/sql-relational-core/ast\";\n//#region src/core/adapter.ts\nconst defaultCapabilities = Object.freeze({\n\tpostgres: {\n\t\torderBy: true,\n\t\tlimit: true,\n\t\tlateral: true,\n\t\tjsonAgg: true,\n\t\treturning: true,\n\t\tdistinctOn: true\n\t},\n\tsql: {\n\t\tenums: true,\n\t\treturning: true,\n\t\tdefaultInInsert: true,\n\t\tlateral: true,\n\t\tscalarList: true\n\t}\n});\nvar PostgresAdapterImpl = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"postgres\";\n\tprofile;\n\tcodecRegistry;\n\tconstructor(codecRegistry, profileId) {\n\t\tthis.codecRegistry = codecRegistry;\n\t\tconst controlAdapter = new PostgresControlAdapter(codecRegistry);\n\t\tthis.profile = Object.freeze({\n\t\t\tid: profileId ?? \"postgres/default@1\",\n\t\t\ttarget: \"postgres\",\n\t\t\tcapabilities: defaultCapabilities,\n\t\t\treadMarker: (queryable) => controlAdapter.readMarkerDiscriminated({\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tquery: async (sql, params) => {\n\t\t\t\t\tconst rows = [];\n\t\t\t\t\tfor await (const row of queryable.query({\n\t\t\t\t\t\tsql,\n\t\t\t\t\t\t...params === void 0 ? {} : { params }\n\t\t\t\t\t})) rows.push(row);\n\t\t\t\t\treturn { rows };\n\t\t\t\t},\n\t\t\t\tclose: async () => {}\n\t\t\t}, APP_SPACE_ID)\n\t\t});\n\t}\n\tlower(ast, context) {\n\t\tif (isDdlNode(ast)) throw adapterError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() does not lower DDL on the runtime adapter — DDL lowering is a control-plane concern handled by the control adapter.\", { meta: { surface: \"runtime-adapter\" } });\n\t\treturn renderLoweredSql(ast, context.contract, this.codecRegistry);\n\t}\n};\n/** Codec-id lookup for bare-literal interpolations used by `fns.raw` on a postgres client. Contributed as the descriptor's static `rawCodecInferer` slot. */\nconst postgresRawCodecInferer = { inferCodec(value) {\n\tswitch (typeof value) {\n\t\tcase \"number\": return Number.isSafeInteger(value) && value % 1 === 0 ? \"pg/int4\" : \"pg/float8\";\n\t\tcase \"bigint\": return \"pg/int8\";\n\t\tcase \"string\": return \"pg/text\";\n\t\tcase \"boolean\": return \"pg/bool\";\n\t\tcase \"object\": if (value instanceof Uint8Array) return \"pg/bytea\";\n\t}\n\tthrow adapterError(\"RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION\", \"unsupported JS value type for raw-SQL interpolation: wrap this value in `param(...)` with an explicit codec\", { meta: { valueType: typeof value } });\n} };\nfunction createPostgresAdapter(options) {\n\tconst codecRegistry = createPostgresCodecRegistryWithBuiltins(options?.codecDescriptors);\n\treturn Object.freeze(new PostgresAdapterImpl(codecRegistry, options?.profileId));\n}\nfunction createPostgresAdapterWithCodecRegistry(codecRegistry) {\n\treturn Object.freeze(new PostgresAdapterImpl(codecRegistry));\n}\n//#endregion\nexport { createPostgresAdapterWithCodecRegistry as n, postgresRawCodecInferer as r, createPostgresAdapter as t };\n\n//# sourceMappingURL=adapter-Ddgpoq1S.mjs.map"],"mappings":";;;;;AAKA,MAAM,sBAAsB,OAAO,OAAO;CACzC,UAAU;EACT,SAAS;EACT,OAAO;EACP,SAAS;EACT,SAAS;EACT,WAAW;EACX,YAAY;CACb;CACA,KAAK;EACJ,OAAO;EACP,WAAW;EACX,iBAAiB;EACjB,SAAS;EACT,YAAY;CACb;AACD,CAAC;AACD,IAAI,sBAAsB,MAAM;CAC/B,WAAW;CACX,WAAW;CACX;CACA;CACA,YAAY,eAAe,WAAW;EACrC,KAAK,gBAA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GED
|
@@ -2,7 +2,7 @@ import { n as qualifyName, r as quoteIdentifier, t as escapeLiteral } from "./sq
|
|
|
2
2
|
import { t as parsePostgresDefault } from "./default-normalizer-Ba5ZebHM-isV86rjy.mjs";
|
|
3
3
|
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-yvd3tqv-.mjs";
|
|
4
4
|
import { n as renderLoweredSql } from "./sql-renderer-CZE98PJj-Bx5D-Txz.mjs";
|
|
5
|
-
import { i as createPostgresCodecRegistryWithBuiltins, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-
|
|
6
|
-
import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-
|
|
5
|
+
import { i as createPostgresCodecRegistryWithBuiltins, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-D4fT5c42-nSea-5cg.mjs";
|
|
6
|
+
import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-Ddgpoq1S-D-Ftx9Ls.mjs";
|
|
7
7
|
import { _ as timestamptzColumn, a as float4Column, b as varcharColumn, c as int4Column, d as jsonColumn, f as jsonbColumn, g as timestampColumn, h as timeColumn, i as charColumn, l as int8Column, m as textColumn, n as boolColumn, o as float8Column, p as numericColumn, r as byteaColumn, s as int2Column, t as bitColumn, u as intervalColumn, v as timetzColumn, y as varbitColumn } from "./column-types-CwAyCgp2.mjs";
|
|
8
8
|
export { PostgresControlAdapter, bitColumn, boolColumn, byteaColumn, charColumn, createPostgresAdapter, createPostgresBuiltinCodecLookup, createPostgresCodecRegistryWithBuiltins, escapeLiteral, float4Column, float8Column, int2Column, int4Column, int8Column, intervalColumn, jsonColumn, jsonbColumn, normalizeSchemaNativeType, numericColumn, parsePostgresDefault, postgresRawCodecInferer, qualifyName, quoteIdentifier, renderLoweredSql, textColumn, timeColumn, timestampColumn, timestamptzColumn, timetzColumn, varbitColumn, varcharColumn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-
|
|
1
|
+
import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-Ddgpoq1S-D-Ftx9Ls.mjs";
|
|
2
2
|
export { createPostgresAdapter, postgresRawCodecInferer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as qualifyName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
|
|
2
2
|
import { t as parsePostgresDefault } from "./default-normalizer-Ba5ZebHM-isV86rjy.mjs";
|
|
3
3
|
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-yvd3tqv-.mjs";
|
|
4
|
-
import { i as createPostgresCodecRegistryWithBuiltins, n as assemblePostgresCodecRegistry, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-
|
|
4
|
+
import { i as createPostgresCodecRegistryWithBuiltins, n as assemblePostgresCodecRegistry, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-D4fT5c42-nSea-5cg.mjs";
|
|
5
5
|
import { t as postgresAdapterDescriptorMeta } from "./descriptor-meta--MCrvIgj-DFsLFDj1.mjs";
|
|
6
6
|
import { timestampNowControlDescriptor } from "@prisma/orm-family-sql/family/control";
|
|
7
7
|
import { int, num, oneOf, optional, str } from "@prisma/orm-framework/psl-parser";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter__control.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/control.mjs"],"sourcesContent":["import { i as createPostgresCodecRegistryWithBuiltins, n as assemblePostgresCodecRegistry, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from \"./control-adapter-CipVam9p.mjs\";\nimport { t as postgresAdapterDescriptorMeta } from \"./descriptor-meta--MCrvIgj.mjs\";\nimport { parsePostgresDefault } from \"@internal/target-postgres/default-normalizer\";\nimport { normalizeSchemaNativeType } from \"@internal/target-postgres/native-type-normalizer\";\nimport { escapeLiteral, qualifyName, quoteIdentifier } from \"@internal/target-postgres/sql-utils\";\nimport { timestampNowControlDescriptor } from \"@internal/family-sql/control\";\nimport { builtinGeneratorRegistryMetadata } from \"@internal/ids\";\nimport { int, num, oneOf, optional, str } from \"@internal/psl-parser\";\n//#region src/core/control-mutation-defaults.ts\nfunction invalidArgumentDiagnostic(input) {\n\treturn {\n\t\tok: false,\n\t\tdiagnostic: {\n\t\t\tcode: \"PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT\",\n\t\t\tmessage: input.message,\n\t\t\tsourceId: input.context.sourceId,\n\t\t\tspan: input.span\n\t\t}\n\t};\n}\nfunction executionGenerator(id, params) {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"execution\",\n\t\t\tgenerated: {\n\t\t\t\tkind: \"generator\",\n\t\t\t\tid,\n\t\t\t\t...params ? { params } : {}\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerAutoincrement() {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: \"autoincrement()\"\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerNow() {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: \"now()\"\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerUlid() {\n\treturn executionGenerator(\"ulid\");\n}\nfunction lowerUuid(input) {\n\treturn input.call.args[\"version\"] === 7 ? executionGenerator(\"uuidv7\") : executionGenerator(\"uuidv4\");\n}\nfunction lowerCuid() {\n\treturn executionGenerator(\"cuid2\");\n}\nfunction lowerNanoid(input) {\n\tconst size = input.call.args[\"size\"];\n\treturn typeof size === \"number\" ? executionGenerator(\"nanoid\", { size }) : executionGenerator(\"nanoid\");\n}\nfunction lowerDbgenerated(input) {\n\tconst expression = input.call.args[\"expression\"];\n\tif (typeof expression !== \"string\" || expression.trim().length === 0) return invalidArgumentDiagnostic({\n\t\tcontext: input.context,\n\t\tspan: input.call.span,\n\t\tmessage: \"Default function \\\"dbgenerated\\\" argument cannot be empty.\"\n\t});\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression\n\t\t\t}\n\t\t}\n\t};\n}\nconst nowSig = {};\nconst autoincrementSig = {};\nconst ulidSig = {};\nconst uuidSig = { positional: [{\n\tkey: \"version\",\n\ttype: optional(oneOf(num(4), num(7)))\n}] };\nconst cuidSig = { positional: [{\n\tkey: \"version\",\n\ttype: num(2)\n}] };\nconst nanoidSig = { positional: [{\n\tkey: \"size\",\n\ttype: optional(int({\n\t\tmin: 2,\n\t\tmax: 255\n\t}))\n}] };\nconst dbgeneratedSig = { positional: [{\n\tkey: \"expression\",\n\ttype: str()\n}] };\nconst postgresDefaultFunctionRegistryEntries = [\n\t[\"autoincrement\", {\n\t\tsignature: autoincrementSig,\n\t\tlower: lowerAutoincrement,\n\t\tusageSignatures: [\"autoincrement()\"]\n\t}],\n\t[\"now\", {\n\t\tsignature: nowSig,\n\t\tlower: lowerNow,\n\t\tusageSignatures: [\"now()\"]\n\t}],\n\t[\"uuid\", {\n\t\tsignature: uuidSig,\n\t\tlower: lowerUuid,\n\t\tusageSignatures: [\n\t\t\t\"uuid()\",\n\t\t\t\"uuid(4)\",\n\t\t\t\"uuid(7)\"\n\t\t]\n\t}],\n\t[\"cuid\", {\n\t\tsignature: cuidSig,\n\t\tlower: lowerCuid,\n\t\tusageSignatures: [\"cuid(2)\"]\n\t}],\n\t[\"ulid\", {\n\t\tsignature: ulidSig,\n\t\tlower: lowerUlid,\n\t\tusageSignatures: [\"ulid()\"]\n\t}],\n\t[\"nanoid\", {\n\t\tsignature: nanoidSig,\n\t\tlower: lowerNanoid,\n\t\tusageSignatures: [\"nanoid()\", \"nanoid(<2-255>)\"]\n\t}],\n\t[\"dbgenerated\", {\n\t\tsignature: dbgeneratedSig,\n\t\tlower: lowerDbgenerated,\n\t\tusageSignatures: [\"dbgenerated(\\\"...\\\")\"]\n\t}]\n];\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel, with explicit `nativeType` values pinned to the codec manifests\n* (`codecLookup.targetTypesFor(codecId)[0]`).\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*/\nconst postgresScalarAuthoringTypes = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/text@1\",\n\t\t\tnativeType: \"text\"\n\t\t}\n\t},\n\tBoolean: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/bool@1\",\n\t\t\tnativeType: \"bool\"\n\t\t}\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int4@1\",\n\t\t\tnativeType: \"int4\"\n\t\t}\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int8@1\",\n\t\t\tnativeType: \"int8\"\n\t\t}\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/float8@1\",\n\t\t\tnativeType: \"float8\"\n\t\t}\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\tnativeType: \"numeric\"\n\t\t}\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz@1\",\n\t\t\tnativeType: \"timestamptz\"\n\t\t}\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/json@1\",\n\t\t\tnativeType: \"json\"\n\t\t}\n\t},\n\tJsonb: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/jsonb@1\",\n\t\t\tnativeType: \"jsonb\"\n\t\t}\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/bytea@1\",\n\t\t\tnativeType: \"bytea\"\n\t\t}\n\t}\n};\nconst postgresNativeAuthoringTypes = {\n\tVarChar: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"length\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/varchar@1\",\n\t\t\tnativeType: \"character varying\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tChar: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"length\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/char@1\",\n\t\t\tnativeType: \"character\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tNumeric: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}, {\n\t\t\tkind: \"number\",\n\t\t\tname: \"scale\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\tnativeType: \"numeric\",\n\t\t\ttypeParams: {\n\t\t\t\tprecision: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0\n\t\t\t\t},\n\t\t\t\tscale: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tTimestamp: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamp@1\",\n\t\t\tnativeType: \"timestamp\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestamptz: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz@1\",\n\t\t\tnativeType: \"timestamptz\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTime: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/time@1\",\n\t\t\tnativeType: \"time\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimetz: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timetz@1\",\n\t\t\tnativeType: \"timetz\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tUuid: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/uuid@1\",\n\t\t\tnativeType: \"uuid\"\n\t\t}\n\t},\n\tInet: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/inet@1\",\n\t\t\tnativeType: \"inet\"\n\t\t}\n\t},\n\tSmallInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int2@1\",\n\t\t\tnativeType: \"int2\"\n\t\t}\n\t},\n\tReal: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/float4@1\",\n\t\t\tnativeType: \"float4\"\n\t\t}\n\t},\n\tDate: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/date@1\",\n\t\t\tnativeType: \"date\"\n\t\t}\n\t}\n};\nconst postgresAuthoringTypes = {\n\t...postgresScalarAuthoringTypes,\n\t...postgresNativeAuthoringTypes\n};\nfunction createPostgresDefaultFunctionRegistry() {\n\treturn new Map(postgresDefaultFunctionRegistryEntries);\n}\nfunction createPostgresMutationDefaultGeneratorDescriptors() {\n\treturn [...builtinGeneratorRegistryMetadata.map(({ id, applicableCodecIds }) => ({\n\t\tid,\n\t\tapplicableCodecIds\n\t})), timestampNowControlDescriptor()];\n}\n//#endregion\n//#region src/exports/control.ts\nconst postgresAdapterDescriptor = {\n\t...postgresAdapterDescriptorMeta,\n\tauthoring: {\n\t\ttype: postgresAuthoringTypes,\n\t\tvalueObjectStorageType: \"Jsonb\"\n\t},\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: createPostgresDefaultFunctionRegistry(),\n\t\tgeneratorDescriptors: createPostgresMutationDefaultGeneratorDescriptors()\n\t},\n\tcreate(stack) {\n\t\treturn new PostgresControlAdapter(assemblePostgresCodecRegistry([\n\t\t\tstack.target,\n\t\t\t...stack.adapter === void 0 ? [] : [stack.adapter],\n\t\t\t...stack.extensions\n\t\t]));\n\t}\n};\n//#endregion\nexport { PostgresControlAdapter, createPostgresBuiltinCodecLookup, createPostgresCodecRegistryWithBuiltins, postgresAdapterDescriptor as default, escapeLiteral, normalizeSchemaNativeType, parsePostgresDefault, qualifyName, quoteIdentifier };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,0BAA0B,OAAO;CACzC,OAAO;EACN,IAAI;EACJ,YAAY;GACX,MAAM;GACN,SAAS,MAAM;GACf,UAAU,MAAM,QAAQ;GACxB,MAAM,MAAM;EACb;CACD;AACD;AACA,SAAS,mBAAmB,IAAI,QAAQ;CACvC,OAAO;EACN,IAAI;EACJ,OAAO;GACN,MAAM;GACN,WAAW;IACV,MAAM;IACN;IACA,GAAG,SAAS,EAAE,OAAO,IAAI,CAAC;GAC3B;EACD;CACD;AACD;AACA,SAAS,qBAAqB;CAC7B,OAAO;EACN,IAAI;EACJ,OAAO;GACN,MAAM;GACN,cAAc;IACb,MAAM;IACN,YAAY;GACb;EACD;CACD;AACD;AACA,SAAS,WAAW;CACnB,OAAO;EACN,IAAI;EACJ,OAAO;GACN,MAAM;GACN,cAAc;IACb,MAAM;IACN,YAAY;GACb;EACD;CACD;AACD;AACA,SAAS,YAAY;CACpB,OAAO,mBAAmB,MAAM;AACjC;AACA,SAAS,UAAU,OAAO;CACzB,OAAO,MAAM,KAAK,KAAK,eAAe,IAAI,mBAAmB,QAAQ,IAAI,mBAAmB,QAAQ;AACrG;AACA,SAAS,YAAY;CACpB,OAAO,mBAAmB,OAAO;AAClC;AACA,SAAS,YAAY,OAAO;CAC3B,MAAM,OAAO,MAAM,KAAK,KAAK;CAC7B,OAAO,OAAO,SAAS,WAAW,mBAAmB,UAAU,EAAE,KAAK,CAAC,IAAI,mBAAmB,QAAQ;AACvG;AACA,SAAS,iBAAiB,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MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,UAAU;EACT,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,MAAM;EACL,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,MAAM;EACL,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;AACD;AACA,MAAM,yBAAyB;CAC9B,GAAG;CACH,GAAG;AACJ;AACA,SAAS,wCAAwC;CAChD,OAAO,IAAI,IAAI,sCAAsC;AACtD;AACA,SAAS,oDAAoD;CAC5D,OAAO,CAAC,GAAG,iCAAiC,KAAK,EAAE,IAAI,0BAA0B;EAChF;EACA;CACD,EAAE,GAAG,8BAA8B,CAAC;AACrC;AAGA,MAAM,4BAA4B;CACjC,GAAG;CACH,WAAW;EACV,MAAM;EACN,wBAAwB;CACzB;CACA,yBAAyB;EACxB,yBAAyB,sCAAsC;EAC/D,sBAAsB,kDAAkD;CACzE;CACA,OAAO,OAAO;EACb,OAAO,IAAI,uBAAuB,8BAA8B;GAC/D,MAAM;GACN,GAAG,MAAM,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,OAAO;GACjD,GAAG,MAAM;EACV,CAAC,CAAC;CACH;AACD"}
|
|
1
|
+
{"version":3,"file":"adapter__control.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/control.mjs"],"sourcesContent":["import { i as createPostgresCodecRegistryWithBuiltins, n as assemblePostgresCodecRegistry, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from \"./control-adapter-D4fT5c42.mjs\";\nimport { t as postgresAdapterDescriptorMeta } from \"./descriptor-meta--MCrvIgj.mjs\";\nimport { parsePostgresDefault } from \"@internal/target-postgres/default-normalizer\";\nimport { normalizeSchemaNativeType } from \"@internal/target-postgres/native-type-normalizer\";\nimport { escapeLiteral, qualifyName, quoteIdentifier } from \"@internal/target-postgres/sql-utils\";\nimport { timestampNowControlDescriptor } from \"@internal/family-sql/control\";\nimport { builtinGeneratorRegistryMetadata } from \"@internal/ids\";\nimport { int, num, oneOf, optional, str } from \"@internal/psl-parser\";\n//#region src/core/control-mutation-defaults.ts\nfunction invalidArgumentDiagnostic(input) {\n\treturn {\n\t\tok: false,\n\t\tdiagnostic: {\n\t\t\tcode: \"PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT\",\n\t\t\tmessage: input.message,\n\t\t\tsourceId: input.context.sourceId,\n\t\t\tspan: input.span\n\t\t}\n\t};\n}\nfunction executionGenerator(id, params) {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"execution\",\n\t\t\tgenerated: {\n\t\t\t\tkind: \"generator\",\n\t\t\t\tid,\n\t\t\t\t...params ? { params } : {}\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerAutoincrement() {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: \"autoincrement()\"\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerNow() {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: \"now()\"\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerUlid() {\n\treturn executionGenerator(\"ulid\");\n}\nfunction lowerUuid(input) {\n\treturn input.call.args[\"version\"] === 7 ? executionGenerator(\"uuidv7\") : executionGenerator(\"uuidv4\");\n}\nfunction lowerCuid() {\n\treturn executionGenerator(\"cuid2\");\n}\nfunction lowerNanoid(input) {\n\tconst size = input.call.args[\"size\"];\n\treturn typeof size === \"number\" ? executionGenerator(\"nanoid\", { size }) : executionGenerator(\"nanoid\");\n}\nfunction lowerDbgenerated(input) {\n\tconst expression = input.call.args[\"expression\"];\n\tif (typeof expression !== \"string\" || expression.trim().length === 0) return invalidArgumentDiagnostic({\n\t\tcontext: input.context,\n\t\tspan: input.call.span,\n\t\tmessage: \"Default function \\\"dbgenerated\\\" argument cannot be empty.\"\n\t});\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression\n\t\t\t}\n\t\t}\n\t};\n}\nconst nowSig = {};\nconst autoincrementSig = {};\nconst ulidSig = {};\nconst uuidSig = { positional: [{\n\tkey: \"version\",\n\ttype: optional(oneOf(num(4), num(7)))\n}] };\nconst cuidSig = { positional: [{\n\tkey: \"version\",\n\ttype: num(2)\n}] };\nconst nanoidSig = { positional: [{\n\tkey: \"size\",\n\ttype: optional(int({\n\t\tmin: 2,\n\t\tmax: 255\n\t}))\n}] };\nconst dbgeneratedSig = { positional: [{\n\tkey: \"expression\",\n\ttype: str()\n}] };\nconst postgresDefaultFunctionRegistryEntries = [\n\t[\"autoincrement\", {\n\t\tsignature: autoincrementSig,\n\t\tlower: lowerAutoincrement,\n\t\tusageSignatures: [\"autoincrement()\"]\n\t}],\n\t[\"now\", {\n\t\tsignature: nowSig,\n\t\tlower: lowerNow,\n\t\tusageSignatures: [\"now()\"]\n\t}],\n\t[\"uuid\", {\n\t\tsignature: uuidSig,\n\t\tlower: lowerUuid,\n\t\tusageSignatures: [\n\t\t\t\"uuid()\",\n\t\t\t\"uuid(4)\",\n\t\t\t\"uuid(7)\"\n\t\t]\n\t}],\n\t[\"cuid\", {\n\t\tsignature: cuidSig,\n\t\tlower: lowerCuid,\n\t\tusageSignatures: [\"cuid(2)\"]\n\t}],\n\t[\"ulid\", {\n\t\tsignature: ulidSig,\n\t\tlower: lowerUlid,\n\t\tusageSignatures: [\"ulid()\"]\n\t}],\n\t[\"nanoid\", {\n\t\tsignature: nanoidSig,\n\t\tlower: lowerNanoid,\n\t\tusageSignatures: [\"nanoid()\", \"nanoid(<2-255>)\"]\n\t}],\n\t[\"dbgenerated\", {\n\t\tsignature: dbgeneratedSig,\n\t\tlower: lowerDbgenerated,\n\t\tusageSignatures: [\"dbgenerated(\\\"...\\\")\"]\n\t}]\n];\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel, with explicit `nativeType` values pinned to the codec manifests\n* (`codecLookup.targetTypesFor(codecId)[0]`).\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*/\nconst postgresScalarAuthoringTypes = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/text@1\",\n\t\t\tnativeType: \"text\"\n\t\t}\n\t},\n\tBoolean: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/bool@1\",\n\t\t\tnativeType: \"bool\"\n\t\t}\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int4@1\",\n\t\t\tnativeType: \"int4\"\n\t\t}\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int8@1\",\n\t\t\tnativeType: \"int8\"\n\t\t}\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/float8@1\",\n\t\t\tnativeType: \"float8\"\n\t\t}\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\tnativeType: \"numeric\"\n\t\t}\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz@1\",\n\t\t\tnativeType: \"timestamptz\"\n\t\t}\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/json@1\",\n\t\t\tnativeType: \"json\"\n\t\t}\n\t},\n\tJsonb: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/jsonb@1\",\n\t\t\tnativeType: \"jsonb\"\n\t\t}\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/bytea@1\",\n\t\t\tnativeType: \"bytea\"\n\t\t}\n\t}\n};\nconst postgresNativeAuthoringTypes = {\n\tVarChar: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"length\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/varchar@1\",\n\t\t\tnativeType: \"character varying\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tChar: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"length\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/char@1\",\n\t\t\tnativeType: \"character\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tNumeric: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}, {\n\t\t\tkind: \"number\",\n\t\t\tname: \"scale\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\tnativeType: \"numeric\",\n\t\t\ttypeParams: {\n\t\t\t\tprecision: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0\n\t\t\t\t},\n\t\t\t\tscale: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tTimestamp: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamp@1\",\n\t\t\tnativeType: \"timestamp\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestamptz: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz@1\",\n\t\t\tnativeType: \"timestamptz\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTime: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/time@1\",\n\t\t\tnativeType: \"time\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimetz: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timetz@1\",\n\t\t\tnativeType: \"timetz\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tUuid: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/uuid@1\",\n\t\t\tnativeType: \"uuid\"\n\t\t}\n\t},\n\tInet: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/inet@1\",\n\t\t\tnativeType: \"inet\"\n\t\t}\n\t},\n\tSmallInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int2@1\",\n\t\t\tnativeType: \"int2\"\n\t\t}\n\t},\n\tReal: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/float4@1\",\n\t\t\tnativeType: \"float4\"\n\t\t}\n\t},\n\tDate: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/date@1\",\n\t\t\tnativeType: \"date\"\n\t\t}\n\t}\n};\nconst postgresAuthoringTypes = {\n\t...postgresScalarAuthoringTypes,\n\t...postgresNativeAuthoringTypes\n};\nfunction createPostgresDefaultFunctionRegistry() {\n\treturn new Map(postgresDefaultFunctionRegistryEntries);\n}\nfunction createPostgresMutationDefaultGeneratorDescriptors() {\n\treturn [...builtinGeneratorRegistryMetadata.map(({ id, applicableCodecIds }) => ({\n\t\tid,\n\t\tapplicableCodecIds\n\t})), timestampNowControlDescriptor()];\n}\n//#endregion\n//#region src/exports/control.ts\nconst postgresAdapterDescriptor = {\n\t...postgresAdapterDescriptorMeta,\n\tauthoring: {\n\t\ttype: postgresAuthoringTypes,\n\t\tvalueObjectStorageType: \"Jsonb\"\n\t},\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: createPostgresDefaultFunctionRegistry(),\n\t\tgeneratorDescriptors: createPostgresMutationDefaultGeneratorDescriptors()\n\t},\n\tcreate(stack) {\n\t\treturn new PostgresControlAdapter(assemblePostgresCodecRegistry([\n\t\t\tstack.target,\n\t\t\t...stack.adapter === void 0 ? [] : [stack.adapter],\n\t\t\t...stack.extensions\n\t\t]));\n\t}\n};\n//#endregion\nexport { PostgresControlAdapter, createPostgresBuiltinCodecLookup, createPostgresCodecRegistryWithBuiltins, postgresAdapterDescriptor as default, escapeLiteral, normalizeSchemaNativeType, parsePostgresDefault, qualifyName, quoteIdentifier };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,0BAA0B,OAAO;CACzC,OAAO;EACN,IAAI;EACJ,YAAY;GACX,MAAM;GACN,SAAS,MAAM;GACf,UAAU,MAAM,QAAQ;GACxB,MAAM,MAAM;EACb;CACD;AACD;AACA,SAAS,mBAAmB,IAAI,QAAQ;CACvC,OAAO;EACN,IAAI;EACJ,OAAO;GACN,MAAM;GACN,WAAW;IACV,MAAM;IACN;IACA,GAAG,SAAS,EAAE,OAAO,IAAI,CAAC;GAC3B;EACD;CACD;AACD;AACA,SAAS,qBAAqB;CAC7B,OAAO;EACN,IAAI;EACJ,OAAO;GACN,MAAM;GACN,cAAc;IACb,MAAM;IACN,YAAY;GACb;EACD;CACD;AACD;AACA,SAAS,WAAW;CACnB,OAAO;EACN,IAAI;EACJ,OAAO;GACN,MAAM;GACN,cAAc;IACb,MAAM;IACN,YAAY;GACb;EACD;CACD;AACD;AACA,SAAS,YAAY;CACpB,OAAO,mBAAmB,MAAM;AACjC;AACA,SAAS,UAAU,OAAO;CACzB,OAAO,MAAM,KAAK,KAAK,eAAe,IAAI,mBAAmB,QAAQ,IAAI,mBAAmB,QAAQ;AACrG;AACA,SAAS,YAAY;CACpB,OAAO,mBAAmB,OAAO;AAClC;AACA,SAAS,YAAY,OAAO;CAC3B,MAAM,OAAO,MAAM,KAAK,KAAK;CAC7B,OAAO,OAAO,SAAS,WAAW,mBAAmB,UAAU,EAAE,KAAK,CAAC,IAAI,mBAAmB,QAAQ;AACvG;AACA,SAAS,iBAAiB,OAAO;CAChC,MAAM,aAAa,MAAM,KAAK,KAAK;CACnC,IAAI,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UAAU;EACT,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,MAAM;EACL,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,MAAM;EACL,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;AACD;AACA,MAAM,yBAAyB;CAC9B,GAAG;CACH,GAAG;AACJ;AACA,SAAS,wCAAwC;CAChD,OAAO,IAAI,IAAI,sCAAsC;AACtD;AACA,SAAS,oDAAoD;CAC5D,OAAO,CAAC,GAAG,iCAAiC,KAAK,EAAE,IAAI,0BAA0B;EAChF;EACA;CACD,EAAE,GAAG,8BAA8B,CAAC;AACrC;AAGA,MAAM,4BAA4B;CACjC,GAAG;CACH,WAAW;EACV,MAAM;EACN,wBAAwB;CACzB;CACA,yBAAyB;EACxB,yBAAyB,sCAAsC;EAC/D,sBAAsB,kDAAkD;CACzE;CACA,OAAO,OAAO;EACb,OAAO,IAAI,uBAAuB,8BAA8B;GAC/D,MAAM;GACN,GAAG,MAAM,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,OAAO;GACjD,GAAG,MAAM;EACV,CAAC,CAAC;CACH;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as postgresCodecRegistry } from "./codecs-rujsdlZR.mjs";
|
|
2
|
-
import { n as assemblePostgresCodecRegistry } from "./control-adapter-
|
|
3
|
-
import { n as createPostgresAdapterWithCodecRegistry, r as postgresRawCodecInferer } from "./adapter-
|
|
2
|
+
import { n as assemblePostgresCodecRegistry } from "./control-adapter-D4fT5c42-nSea-5cg.mjs";
|
|
3
|
+
import { n as createPostgresAdapterWithCodecRegistry, r as postgresRawCodecInferer } from "./adapter-Ddgpoq1S-D-Ftx9Ls.mjs";
|
|
4
4
|
import { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from "./descriptor-meta--MCrvIgj-DFsLFDj1.mjs";
|
|
5
5
|
import { builtinGeneratorIds } from "@prisma/orm-framework/ids";
|
|
6
6
|
import { timestampNowRuntimeGenerator } from "@prisma/orm-family-sql/family/runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter__runtime.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/runtime.mjs"],"sourcesContent":["import { n as assemblePostgresCodecRegistry } from \"./control-adapter-
|
|
1
|
+
{"version":3,"file":"adapter__runtime.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/runtime.mjs"],"sourcesContent":["import { n as assemblePostgresCodecRegistry } from \"./control-adapter-D4fT5c42.mjs\";\nimport { n as createPostgresAdapterWithCodecRegistry, r as postgresRawCodecInferer } from \"./adapter-Ddgpoq1S.mjs\";\nimport { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from \"./descriptor-meta--MCrvIgj.mjs\";\nimport { postgresCodecRegistry } from \"@internal/target-postgres/codecs\";\nimport { builtinGeneratorIds } from \"@internal/ids\";\nimport { timestampNowRuntimeGenerator } from \"@internal/family-sql/runtime\";\nimport { generateId } from \"@internal/ids/runtime\";\n//#region src/exports/runtime.ts\nfunction createPostgresMutationDefaultGenerators() {\n\treturn [...builtinGeneratorIds.map((id) => ({\n\t\tid,\n\t\tgenerate: (params) => {\n\t\t\treturn generateId(params ? {\n\t\t\t\tid,\n\t\t\t\tparams\n\t\t\t} : { id });\n\t\t},\n\t\tstability: \"field\"\n\t})), timestampNowRuntimeGenerator()];\n}\nconst postgresRuntimeAdapterDescriptor = {\n\t...postgresAdapterDescriptorMeta,\n\tcodecs: () => Array.from(postgresCodecRegistry.values()),\n\tqueryOperations: () => postgresQueryOperations(),\n\tmutationDefaultGenerators: createPostgresMutationDefaultGenerators,\n\trawCodecInferer: postgresRawCodecInferer,\n\tcreate(stack) {\n\t\treturn createPostgresAdapterWithCodecRegistry(assemblePostgresCodecRegistry([\n\t\t\tstack.target,\n\t\t\tstack.adapter,\n\t\t\t...stack.extensions\n\t\t]));\n\t}\n};\n//#endregion\nexport { postgresRuntimeAdapterDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,0CAA0C;CAClD,OAAO,CAAC,GAAG,oBAAoB,KAAK,QAAQ;EAC3C;EACA,WAAW,WAAW;GACrB,OAAO,WAAW,SAAS;IAC1B;IACA;GACD,IAAI,EAAE,GAAG,CAAC;EACX;EACA,WAAW;CACZ,EAAE,GAAG,6BAA6B,CAAC;AACpC;AACA,MAAM,mCAAmC;CACxC,GAAG;CACH,cAAc,MAAM,KAAK,sBAAsB,OAAO,CAAC;CACvD,uBAAuB,wBAAwB;CAC/C,2BAA2B;CAC3B,iBAAiB;CACjB,OAAO,OAAO;EACb,OAAO,uCAAuC,8BAA8B;GAC3E,MAAM;GACN,MAAM;GACN,GAAG,MAAM;EACV,CAAC,CAAC;CACH;AACD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/postgres/dist/check-expressions-DwM1V1Ky.d.mts
|
|
2
|
+
//#region src/core/check-expressions.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* What a rendered check enforces. The contract builder turns this into the
|
|
5
|
+
* wire-name prefix's trailing segment, so the kind stays readable in the
|
|
6
|
+
* physical constraint name.
|
|
7
|
+
*/
|
|
8
|
+
type PostgresCheckKind = 'membership' | 'elementNotNull';
|
|
9
|
+
/**
|
|
10
|
+
* One column's shape, as the contract builder knows it. `memberValues` is
|
|
11
|
+
* present only for a domain enum authored through an `enumType()` handle —
|
|
12
|
+
* a column bound to a native enum type carries its enforcement in the type
|
|
13
|
+
* itself and arrives here with `memberValues` undefined.
|
|
14
|
+
*/
|
|
15
|
+
interface PostgresCheckExpressionInput {
|
|
16
|
+
readonly tableName: string;
|
|
17
|
+
readonly columnName: string;
|
|
18
|
+
readonly many: boolean;
|
|
19
|
+
readonly memberValues: readonly string[] | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A check the target wants written. The target contributes only what it
|
|
23
|
+
* uniquely knows — which predicate, spelled how — while the family owns the
|
|
24
|
+
* naming: it composes the prefix from the table, the column, and the kind,
|
|
25
|
+
* caps it, and appends the content hash. Nothing here is a name.
|
|
26
|
+
*/
|
|
27
|
+
interface PostgresCheckExpressionCandidate {
|
|
28
|
+
readonly kind: PostgresCheckKind;
|
|
29
|
+
/** The column this predicate constrains; the family names the check after it. */
|
|
30
|
+
readonly columnName: string;
|
|
31
|
+
/** Opaque SQL: the predicate body, without the surrounding `CHECK (…)`. */
|
|
32
|
+
readonly expression: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Renders the checks a Postgres column needs, as opaque predicate text.
|
|
36
|
+
*
|
|
37
|
+
* A text-backed domain enum has no type-level enforcement, so membership is a
|
|
38
|
+
* predicate: `IN` for a scalar, and `<@` containment for an array — an array
|
|
39
|
+
* column cannot use `IN` at all (`operator does not exist: text[] = text`),
|
|
40
|
+
* and containment additionally rejects NULL elements. Every list column also
|
|
41
|
+
* gets an element-non-null check, which no Postgres column type can express.
|
|
42
|
+
*
|
|
43
|
+
* The array side casts the COLUMN to `text[]` rather than assuming its element
|
|
44
|
+
* type already is: `<@` needs both operands in one type, so a `varchar[]` or
|
|
45
|
+
* `char[]` column meeting a bare `text[]` literal raises the same
|
|
46
|
+
* `operator does not exist` this project exists to eliminate. The scalar `IN`
|
|
47
|
+
* form needs no cast — `varchar = text` resolves on its own.
|
|
48
|
+
*/
|
|
49
|
+
declare function postgresRenderCheckExpressions(input: PostgresCheckExpressionInput): readonly PostgresCheckExpressionCandidate[];
|
|
50
|
+
//#endregion
|
|
51
|
+
export { postgresRenderCheckExpressions as i, PostgresCheckExpressionInput as n, PostgresCheckKind as r, PostgresCheckExpressionCandidate as t };
|
|
52
|
+
//# sourceMappingURL=check-expressions-DwM1V1Ky-D9m3Uf8w.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-expressions-DwM1V1Ky-D9m3Uf8w.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/check-expressions-DwM1V1Ky.d.mts"],"mappings":";;;;;;;KAMK;;;;;;;UAOK;WACC;WACA;WACA;WACA;;;;;;;;UAQD;WACC,MAAM;;WAEN;;WAEA;;;;;;;;;;;;;;;;;iBAiBM,+BAA+B,OAAO,wCAAwC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
|
|
2
|
+
import { invariant } from "@prisma/orm-framework/utils/assertions";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/dist/check-expressions-drXwak3W.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Renders the checks a Postgres column needs, as opaque predicate text.
|
|
6
|
+
*
|
|
7
|
+
* A text-backed domain enum has no type-level enforcement, so membership is a
|
|
8
|
+
* predicate: `IN` for a scalar, and `<@` containment for an array — an array
|
|
9
|
+
* column cannot use `IN` at all (`operator does not exist: text[] = text`),
|
|
10
|
+
* and containment additionally rejects NULL elements. Every list column also
|
|
11
|
+
* gets an element-non-null check, which no Postgres column type can express.
|
|
12
|
+
*
|
|
13
|
+
* The array side casts the COLUMN to `text[]` rather than assuming its element
|
|
14
|
+
* type already is: `<@` needs both operands in one type, so a `varchar[]` or
|
|
15
|
+
* `char[]` column meeting a bare `text[]` literal raises the same
|
|
16
|
+
* `operator does not exist` this project exists to eliminate. The scalar `IN`
|
|
17
|
+
* form needs no cast — `varchar = text` resolves on its own.
|
|
18
|
+
*/
|
|
19
|
+
function postgresRenderCheckExpressions(input) {
|
|
20
|
+
const candidates = [];
|
|
21
|
+
const column = quoteIdentifier(input.columnName);
|
|
22
|
+
if (input.memberValues !== void 0) {
|
|
23
|
+
invariant(input.memberValues.length > 0, `check for "${input.tableName}"."${input.columnName}": empty member set; both authoring surfaces reject a member-less enum before rendering`);
|
|
24
|
+
const members = input.memberValues.map((value) => `'${escapeLiteral(value)}'`).join(", ");
|
|
25
|
+
candidates.push({
|
|
26
|
+
kind: "membership",
|
|
27
|
+
columnName: input.columnName,
|
|
28
|
+
expression: input.many ? `${column}::text[] <@ ARRAY[${members}]::text[]` : `${column} IN (${members})`
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (input.many) candidates.push({
|
|
32
|
+
kind: "elementNotNull",
|
|
33
|
+
columnName: input.columnName,
|
|
34
|
+
expression: `array_position(${column}, NULL) IS NULL`
|
|
35
|
+
});
|
|
36
|
+
return candidates;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { postgresRenderCheckExpressions as t };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=check-expressions-drXwak3W-DqFpQtdc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-expressions-drXwak3W-DqFpQtdc.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/check-expressions-drXwak3W.mjs"],"sourcesContent":["import { r as quoteIdentifier, t as escapeLiteral } from \"./sql-utils-BnBlQxyh.mjs\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/core/check-expressions.ts\n/**\n* Renders the checks a Postgres column needs, as opaque predicate text.\n*\n* A text-backed domain enum has no type-level enforcement, so membership is a\n* predicate: `IN` for a scalar, and `<@` containment for an array — an array\n* column cannot use `IN` at all (`operator does not exist: text[] = text`),\n* and containment additionally rejects NULL elements. Every list column also\n* gets an element-non-null check, which no Postgres column type can express.\n*\n* The array side casts the COLUMN to `text[]` rather than assuming its element\n* type already is: `<@` needs both operands in one type, so a `varchar[]` or\n* `char[]` column meeting a bare `text[]` literal raises the same\n* `operator does not exist` this project exists to eliminate. The scalar `IN`\n* form needs no cast — `varchar = text` resolves on its own.\n*/\nfunction postgresRenderCheckExpressions(input) {\n\tconst candidates = [];\n\tconst column = quoteIdentifier(input.columnName);\n\tif (input.memberValues !== void 0) {\n\t\tinvariant(input.memberValues.length > 0, `check for \"${input.tableName}\".\"${input.columnName}\": empty member set; both authoring surfaces reject a member-less enum before rendering`);\n\t\tconst members = input.memberValues.map((value) => `'${escapeLiteral(value)}'`).join(\", \");\n\t\tcandidates.push({\n\t\t\tkind: \"membership\",\n\t\t\tcolumnName: input.columnName,\n\t\t\texpression: input.many ? `${column}::text[] <@ ARRAY[${members}]::text[]` : `${column} IN (${members})`\n\t\t});\n\t}\n\tif (input.many) candidates.push({\n\t\tkind: \"elementNotNull\",\n\t\tcolumnName: input.columnName,\n\t\texpression: `array_position(${column}, NULL) IS NULL`\n\t});\n\treturn candidates;\n}\n//#endregion\nexport { postgresRenderCheckExpressions as t };\n\n//# sourceMappingURL=check-expressions-drXwak3W.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAS,+BAA+B,OAAO;CAC9C,MAAM,aAAa,CAAC;CACpB,MAAM,SAAS,gBAAgB,MAAM,UAAU;CAC/C,IAAI,MAAM,iBAAiB,KAAK,GAAG;EAClC,UAAU,MAAM,aAAa,SAAS,GAAG,cAAc,MAAM,UAAU,KAAK,MAAM,WAAW,wFAAwF;EACrL,MAAM,UAAU,MAAM,aAAa,KAAK,UAAU,IAAI,cAAc,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI;EACxF,WAAW,KAAK;GACf,MAAM;GACN,YAAY,MAAM;GAClB,YAAY,MAAM,OAAO,GAAG,OAAO,oBAAoB,QAAQ,aAAa,GAAG,OAAO,OAAO,QAAQ;EACtG,CAAC;CACF;CACA,IAAI,MAAM,MAAM,WAAW,KAAK;EAC/B,MAAM;EACN,YAAY,MAAM;EAClB,YAAY,kBAAkB,OAAO;CACtC,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as postgresError } from "./errors-kYxOQjdD-D4T3rbVp.mjs";
|
|
2
2
|
import { n as postgresResolveDefault } from "./default-normalizer-Ba5ZebHM-isV86rjy.mjs";
|
|
3
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
3
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-B2fGOCSX-DTh_flIG.mjs";
|
|
4
4
|
import { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
|
|
5
5
|
import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
|
|
6
6
|
import { r as renderDefaultLiteral } from "./planner-ddl-builders-CbfICQfm-CGjwaNy7.mjs";
|
|
7
|
-
import { n as contractToPostgresDatabaseSchemaNode, r as diffPostgresSchema } from "./diff-database-schema-
|
|
7
|
+
import { n as contractToPostgresDatabaseSchemaNode, r as diffPostgresSchema } from "./diff-database-schema-wl9GusaU-BjDyKMS6.mjs";
|
|
8
8
|
import { t as PostgresContractSerializer } from "./postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs";
|
|
9
|
-
import { t as createPostgresMigrationPlanner } from "./planner-
|
|
9
|
+
import { t as createPostgresMigrationPlanner } from "./planner-CqFym7lA-BKHIkh3V.mjs";
|
|
10
10
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
11
11
|
import { UNBOUND_NAMESPACE_ID, coordinateKey, elementCoordinates } from "@prisma/orm-framework/components/ir";
|
|
12
12
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
@@ -1352,4 +1352,4 @@ const postgresTargetDescriptor = {
|
|
|
1352
1352
|
//#endregion
|
|
1353
1353
|
export { postgresTargetDescriptor as n, postgresRenderDefault as t };
|
|
1354
1354
|
|
|
1355
|
-
//# sourceMappingURL=control-
|
|
1355
|
+
//# sourceMappingURL=control-8ofLM59h.mjs.map
|