@prisma/orm-target-postgres 8.0.0-rc.16-dev.4 → 8.0.0-rc.16-dev.5
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-RtS8vD8U-BvmL3EaF.mjs → adapter-RtS8vD8U-m4U_WTpQ.mjs} +5 -5
- package/dist/{adapter-RtS8vD8U-BvmL3EaF.mjs.map → adapter-RtS8vD8U-m4U_WTpQ.mjs.map} +1 -1
- package/dist/adapter.mjs +5 -5
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__control.mjs +6 -6
- package/dist/adapter__runtime.mjs +4 -4
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{authoring-CfPWv_-P-BHAGgGYI.mjs → authoring-vHbPLrW4-BsHR7gUE.mjs} +5 -5
- package/dist/{authoring-CfPWv_-P-BHAGgGYI.mjs.map → authoring-vHbPLrW4-BsHR7gUE.mjs.map} +1 -1
- package/dist/{check-expressions-BRuSxJ5d-CC5OFfR1.mjs → check-expressions-Dlt334zg-CV5Vkh3G.mjs} +3 -3
- package/dist/{check-expressions-BRuSxJ5d-CC5OFfR1.mjs.map → check-expressions-Dlt334zg-CV5Vkh3G.mjs.map} +1 -1
- package/dist/{codec-registry-CyhMngN6-BlKEiEni.mjs → codec-registry-nSGjxm-H-BeUu5zV2.mjs} +4 -4
- package/dist/{codec-registry-CyhMngN6-BlKEiEni.mjs.map → codec-registry-nSGjxm-H-BeUu5zV2.mjs.map} +1 -1
- package/dist/{codecs-hSJgX8qY-fZSDQFIE.mjs → codecs-DelwJv6h-CFbyTJIJ.mjs} +3 -3
- package/dist/{codecs-hSJgX8qY-fZSDQFIE.mjs.map → codecs-DelwJv6h-CFbyTJIJ.mjs.map} +1 -1
- package/dist/{contract-free-DlLLhKi4.d.mts → contract-free-DY8vDIxh.d.mts} +19 -2
- package/dist/contract-free-DY8vDIxh.d.mts.map +1 -0
- package/dist/{contract-free-DAGgx1J-.mjs → contract-free-DaK6wmmo.mjs} +3 -3
- package/dist/contract-free-DaK6wmmo.mjs.map +1 -0
- package/dist/{control-BVAy0J9w.mjs → control-YKrabf1Q.mjs} +11 -11
- package/dist/{control-BVAy0J9w.mjs.map → control-YKrabf1Q.mjs.map} +1 -1
- package/dist/{control-adapter-Co30P4lH-B8vk7fsI.mjs → control-adapter-Co30P4lH-B5euUoQ4.mjs} +6 -6
- package/dist/{control-adapter-Co30P4lH-B8vk7fsI.mjs.map → control-adapter-Co30P4lH-B5euUoQ4.mjs.map} +1 -1
- package/dist/{control-policy-C16wMazs-O_wlPuFC.mjs → control-policy-bwcdB78Y-DgRaWAzu.mjs} +16 -22
- package/dist/control-policy-bwcdB78Y-DgRaWAzu.mjs.map +1 -0
- package/dist/{data-type-entries-C2zpNOAQ-BJh8QNDa.mjs → data-type-entries-DgKLUrqt-TKDikzti.mjs} +3 -3
- package/dist/{data-type-entries-C2zpNOAQ-BJh8QNDa.mjs.map → data-type-entries-DgKLUrqt-TKDikzti.mjs.map} +1 -1
- package/dist/{data-types-BRBW3ouc-ZtyZE7nE.mjs → data-types-k3Ebk3kj-DWk3nh_k.mjs} +3 -3
- package/dist/{data-types-BRBW3ouc-ZtyZE7nE.mjs.map → data-types-k3Ebk3kj-DWk3nh_k.mjs.map} +1 -1
- package/dist/{ddl-BzsT_-qY-Cdzm0YIK.mjs → ddl-C_vTj7b5-vyGLBKLo.mjs} +50 -5
- package/dist/ddl-C_vTj7b5-vyGLBKLo.mjs.map +1 -0
- package/dist/default-constraint-names-CtcRXhV8-nz3ff6b8.mjs +18 -0
- package/dist/default-constraint-names-CtcRXhV8-nz3ff6b8.mjs.map +1 -0
- package/dist/{descriptor-meta-ARufwwWW-DUiQQsOX.mjs → descriptor-meta-ARufwwWW-DMQsPNAl.mjs} +3 -3
- package/dist/{descriptor-meta-ARufwwWW-DUiQQsOX.mjs.map → descriptor-meta-ARufwwWW-DMQsPNAl.mjs.map} +1 -1
- package/dist/{descriptor-meta-Dp8tWKKU-5RiFTCA_.mjs → descriptor-meta-BgOMP4hF-CfUJsgjc.mjs} +8 -8
- package/dist/{descriptor-meta-Dp8tWKKU-5RiFTCA_.mjs.map → descriptor-meta-BgOMP4hF-CfUJsgjc.mjs.map} +1 -1
- package/dist/{descriptor-meta-runtime-BycwK4wx-CuDo_Atu.mjs → descriptor-meta-runtime-CG2S236D-CUkzqeCr.mjs} +3 -3
- package/dist/{descriptor-meta-runtime-BycwK4wx-CuDo_Atu.mjs.map → descriptor-meta-runtime-CG2S236D-CUkzqeCr.mjs.map} +1 -1
- package/dist/{diff-database-schema-DRPIV4Ae-BSY-cBm0.mjs → diff-database-schema-zc7d2uxC-BVe8D7vG.mjs} +5 -5
- package/dist/{diff-database-schema-DRPIV4Ae-BSY-cBm0.mjs.map → diff-database-schema-zc7d2uxC-BVe8D7vG.mjs.map} +1 -1
- package/dist/{full-text-index-expression-2O1p7zJA--CcXJUdq.mjs → full-text-index-expression-BpUM2Td6-2Q7y7DnO.mjs} +4 -4
- package/dist/{full-text-index-expression-2O1p7zJA--CcXJUdq.mjs.map → full-text-index-expression-BpUM2Td6-2Q7y7DnO.mjs.map} +1 -1
- package/dist/{infer-psl-contract-shHWsRbe-C65aVFOB.mjs → infer-psl-contract-B5yExD61-Cmye68li.mjs} +6 -6
- package/dist/{infer-psl-contract-shHWsRbe-C65aVFOB.mjs.map → infer-psl-contract-B5yExD61-Cmye68li.mjs.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{op-factory-call-B-4nf1jC-DkRw5e1q.mjs → op-factory-call-DdXVWQlV-DzfLhTkh.mjs} +70 -18
- package/dist/op-factory-call-DdXVWQlV-DzfLhTkh.mjs.map +1 -0
- package/dist/{planner-B5wkfdZ_-bckhSgt5.mjs → planner-ZmK0aNuY-Cak-8zwa.mjs} +16 -12
- package/dist/planner-ZmK0aNuY-Cak-8zwa.mjs.map +1 -0
- package/dist/{planner-ddl-builders-ClaAKDuZ-DpDBj2cs.mjs → planner-ddl-builders-DRProi99-D0K5ZiD0.mjs} +44 -14
- package/dist/planner-ddl-builders-DRProi99-D0K5ZiD0.mjs.map +1 -0
- package/dist/{planner-identity-values-BZpK0CdX-BJo672Ml.mjs → planner-identity-values-C1eV916m-D0p3EfYc.mjs} +3 -3
- package/dist/{planner-identity-values-BZpK0CdX-BJo672Ml.mjs.map → planner-identity-values-C1eV916m-D0p3EfYc.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-B3dM0fTf-XkTUm5wR.mjs → planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-B3dM0fTf-XkTUm5wR.mjs.map → planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs.map} +1 -1
- package/dist/{planner-sql-checks-Bhp0Iq_X-DwwIxJHj.mjs → planner-sql-checks-rqOH8naU-B6xOE5lC.mjs} +4 -4
- package/dist/{planner-sql-checks-Bhp0Iq_X-DwwIxJHj.mjs.map → planner-sql-checks-rqOH8naU-B6xOE5lC.mjs.map} +1 -1
- package/dist/{postgres-contract-view-rT0ZLNqw-DThfALEV.mjs → postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs} +6 -6
- package/dist/{postgres-contract-view-rT0ZLNqw-DThfALEV.mjs.map → postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs.map} +1 -1
- package/dist/{postgres-migration-CmD95Eh_-DGLByWZD.mjs → postgres-migration-UVh2xeV0-DW8V_8aj.mjs} +84 -58
- package/dist/postgres-migration-UVh2xeV0-DW8V_8aj.mjs.map +1 -0
- package/dist/postgres-object-name-FPikIvOw-BNs44hTu.mjs +23 -0
- package/dist/postgres-object-name-FPikIvOw-BNs44hTu.mjs.map +1 -0
- package/dist/{postgres-schema-DXd0mebY-CExd_GcQ.mjs → postgres-schema-AlEVkXXS-ZfXWYddl.mjs} +3 -3
- package/dist/{postgres-schema-DXd0mebY-CExd_GcQ.mjs.map → postgres-schema-AlEVkXXS-ZfXWYddl.mjs.map} +1 -1
- package/dist/{prisma7-binding-DNckHEx8.d.mts → prisma7-binding-FvF1AZxQ.d.mts} +11 -1
- package/dist/prisma7-binding-FvF1AZxQ.d.mts.map +1 -0
- package/dist/{prisma7-binding-CArLf1qk.mjs → prisma7-binding-GebhdAGS.mjs} +11 -6
- package/dist/prisma7-binding-GebhdAGS.mjs.map +1 -0
- package/dist/{resolve-ddl-schema-CadTChyu-C7F31wpN.mjs → resolve-ddl-schema-BthOWVjF-DuZ9iUh-.mjs} +3 -3
- package/dist/{resolve-ddl-schema-CadTChyu-C7F31wpN.mjs.map → resolve-ddl-schema-BthOWVjF-DuZ9iUh-.mjs.map} +1 -1
- package/dist/{sql-renderer-DT4IEOVi-G0Q8NmyB.mjs → sql-renderer-DT4IEOVi-CE0YIu9V.mjs} +3 -3
- package/dist/{sql-renderer-DT4IEOVi-G0Q8NmyB.mjs.map → sql-renderer-DT4IEOVi-CE0YIu9V.mjs.map} +1 -1
- package/dist/{sql-utils-BMXJi06b-CAQOplfq.mjs → sql-utils-CVsvXiX4-C7xD0Bgv.mjs} +5 -9
- package/dist/sql-utils-CVsvXiX4-C7xD0Bgv.mjs.map +1 -0
- package/dist/target.d.mts +3 -3
- package/dist/target.mjs +25 -25
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__contract-free.d.mts +2 -2
- package/dist/target__contract-free.mjs +4 -4
- package/dist/target__control.mjs +3 -3
- package/dist/target__data-types.mjs +2 -2
- 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.mjs +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- package/dist/target__planner-identity-values.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__prisma7-binding.d.mts +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__runtime.mjs +3 -3
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__schema-ir-annotations.mjs +1 -1
- package/dist/target__sql-utils.mjs +2 -2
- package/dist/target__types.mjs +2 -2
- package/package.json +9 -9
- package/dist/contract-free-DAGgx1J-.mjs.map +0 -1
- package/dist/contract-free-DlLLhKi4.d.mts.map +0 -1
- package/dist/control-policy-C16wMazs-O_wlPuFC.mjs.map +0 -1
- package/dist/ddl-BzsT_-qY-Cdzm0YIK.mjs.map +0 -1
- package/dist/op-factory-call-B-4nf1jC-DkRw5e1q.mjs.map +0 -1
- package/dist/planner-B5wkfdZ_-bckhSgt5.mjs.map +0 -1
- package/dist/planner-ddl-builders-ClaAKDuZ-DpDBj2cs.mjs.map +0 -1
- package/dist/postgres-migration-CmD95Eh_-DGLByWZD.mjs.map +0 -1
- package/dist/prisma7-binding-CArLf1qk.mjs.map +0 -1
- package/dist/prisma7-binding-DNckHEx8.d.mts.map +0 -1
- package/dist/sql-utils-BMXJi06b-CAQOplfq.mjs.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { clipToUtf8Bytes, utf8ByteLength } from "@prisma/orm-framework/utils/text";
|
|
2
|
+
//#region ../../../3-targets/3-targets/postgres/dist/postgres-object-name-FPikIvOw.mjs
|
|
3
|
+
/** The name Postgres stores for an identifier it is given: the first 63 bytes, cut on a character boundary. */
|
|
4
|
+
function storedIdentifier(name) {
|
|
5
|
+
return clipToUtf8Bytes(name, 63);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The name Postgres gives an object it names itself, as its `makeObjectName` does: `{first}_{second}_{label}`, or `{first}_{label}` without a second name, with the longer of the two names trimmed by bytes, cut on a character boundary, until the name fits 63 bytes. A SERIAL column's sequence is `(table, column, 'seq')`; an unnamed primary key is `(table, undefined, 'pkey')`.
|
|
9
|
+
*/
|
|
10
|
+
function postgresObjectName(first, second, label) {
|
|
11
|
+
const separators = second === void 0 ? 1 : 2;
|
|
12
|
+
const available = 63 - utf8ByteLength(label) - separators;
|
|
13
|
+
let firstBytes = utf8ByteLength(first);
|
|
14
|
+
let secondBytes = second === void 0 ? 0 : utf8ByteLength(second);
|
|
15
|
+
while (firstBytes + secondBytes > available) if (firstBytes > secondBytes) firstBytes--;
|
|
16
|
+
else secondBytes--;
|
|
17
|
+
const head = clipToUtf8Bytes(first, firstBytes);
|
|
18
|
+
return second === void 0 ? `${head}_${label}` : `${head}_${clipToUtf8Bytes(second, secondBytes)}_${label}`;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { storedIdentifier as n, postgresObjectName as t };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=postgres-object-name-FPikIvOw-BNs44hTu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-object-name-FPikIvOw-BNs44hTu.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-object-name-FPikIvOw.mjs"],"sourcesContent":["import { clipToUtf8Bytes, utf8ByteLength } from \"@internal/utils/text\";\n/** The name Postgres stores for an identifier it is given: the first 63 bytes, cut on a character boundary. */\nfunction storedIdentifier(name) {\n\treturn clipToUtf8Bytes(name, 63);\n}\n/**\n* The name Postgres gives an object it names itself, as its `makeObjectName` does: `{first}_{second}_{label}`, or `{first}_{label}` without a second name, with the longer of the two names trimmed by bytes, cut on a character boundary, until the name fits 63 bytes. A SERIAL column's sequence is `(table, column, 'seq')`; an unnamed primary key is `(table, undefined, 'pkey')`.\n*/\nfunction postgresObjectName(first, second, label) {\n\tconst separators = second === void 0 ? 1 : 2;\n\tconst available = 63 - utf8ByteLength(label) - separators;\n\tlet firstBytes = utf8ByteLength(first);\n\tlet secondBytes = second === void 0 ? 0 : utf8ByteLength(second);\n\twhile (firstBytes + secondBytes > available) if (firstBytes > secondBytes) firstBytes--;\n\telse secondBytes--;\n\tconst head = clipToUtf8Bytes(first, firstBytes);\n\treturn second === void 0 ? `${head}_${label}` : `${head}_${clipToUtf8Bytes(second, secondBytes)}_${label}`;\n}\n//#endregion\nexport { storedIdentifier as n, postgresObjectName as t };\n\n//# sourceMappingURL=postgres-object-name-FPikIvOw.mjs.map"],"mappings":";;;AAEA,SAAS,iBAAiB,MAAM;CAC/B,OAAO,gBAAgB,MAAM,EAAE;AAChC;;;;AAIA,SAAS,mBAAmB,OAAO,QAAQ,OAAO;CACjD,MAAM,aAAa,WAAW,KAAK,IAAI,IAAI;CAC3C,MAAM,YAAY,KAAK,eAAe,KAAK,IAAI;CAC/C,IAAI,aAAa,eAAe,KAAK;CACrC,IAAI,cAAc,WAAW,KAAK,IAAI,IAAI,eAAe,MAAM;CAC/D,OAAO,aAAa,cAAc,WAAW,IAAI,aAAa,aAAa;MACtE;CACL,MAAM,OAAO,gBAAgB,OAAO,UAAU;CAC9C,OAAO,WAAW,KAAK,IAAI,GAAG,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,gBAAgB,QAAQ,WAAW,EAAE,GAAG;AACpG"}
|
package/dist/{postgres-schema-DXd0mebY-CExd_GcQ.mjs → postgres-schema-AlEVkXXS-ZfXWYddl.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as PG_TEXT_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
|
|
2
|
-
import { t as escapeLiteral } from "./sql-utils-
|
|
2
|
+
import { t as escapeLiteral } from "./sql-utils-CVsvXiX4-C7xD0Bgv.mjs";
|
|
3
3
|
import { t as PostgresNativeEnum } from "./postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs";
|
|
4
4
|
import { TableSource } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
5
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
@@ -11,7 +11,7 @@ import { invariant } from "@prisma/orm-framework/utils/assertions";
|
|
|
11
11
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
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-AlEVkXXS.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-AlEVkXXS-ZfXWYddl.mjs.map
|
package/dist/{postgres-schema-DXd0mebY-CExd_GcQ.mjs.map → postgres-schema-AlEVkXXS-ZfXWYddl.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-schema-DXd0mebY-CExd_GcQ.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-schema-DXd0mebY.mjs"],"sourcesContent":["import { S as PG_TEXT_CODEC_ID } from \"./codec-ids-Cb0yO-IS.mjs\";\nimport { t as escapeLiteral } from \"./sql-utils-BMXJi06b.mjs\";\nimport { t as PostgresNativeEnum } from \"./postgres-native-enum-CdP3b_-R.mjs\";\nimport { TableSource } from \"@internal/sql-relational-core/ast\";\nimport { type } from \"arktype\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { SqlNamespaceBase, SqlNode } from \"@internal/sql-contract/types\";\nimport { nameOf, parseNaming } from \"@internal/sql-schema-ir/naming\";\nimport { invariant } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\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 typeof ns === \"object\" && ns !== null && Reflect.get(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//# sourceMappingUR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OAAO,IAAI,eAAe,WAAW;AACtC"}
|
|
1
|
+
{"version":3,"file":"postgres-schema-AlEVkXXS-ZfXWYddl.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-schema-AlEVkXXS.mjs"],"sourcesContent":["import { S as PG_TEXT_CODEC_ID } from \"./codec-ids-Cb0yO-IS.mjs\";\nimport { t as escapeLiteral } from \"./sql-utils-CVsvXiX4.mjs\";\nimport { t as PostgresNativeEnum } from \"./postgres-native-enum-CdP3b_-R.mjs\";\nimport { TableSource } from \"@internal/sql-relational-core/ast\";\nimport { type } from \"arktype\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { SqlNamespaceBase, SqlNode } from \"@internal/sql-contract/types\";\nimport { nameOf, parseNaming } from \"@internal/sql-schema-ir/naming\";\nimport { invariant } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\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 typeof ns === \"object\" && ns !== null && Reflect.get(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-AlEVkXXS.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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;EAC5B,CAAC;CACF;AACD;AACA,eAAe,UAAU,sBAAsB;;;;;;;;;;AAU/C,SAAS,iBAAiB,IAAI;CAC7B,OAAO,OAAO,OAAO,YAAY,OAAO,QAAQ,QAAQ,IAAI,IAAI,MAAM,MAAM;AAC7E;;;;;;;;;;;;;;;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"}
|
|
@@ -6,6 +6,12 @@ import { n as FullTextSearchLanguage } from "./text-search-languages-BzhBMCtK-D2
|
|
|
6
6
|
import { r as CodecTypes } from "./codec-types-CHtW4cn_-ryYZXjOb.mjs";
|
|
7
7
|
import { a as policyUsingOnlySpec, c as roleSpec, i as policyBothPredicatesSpec, n as RoleExtensionBlock, o as policyWithCheckOnlySpec, r as nativeEnumSpec, s as postgresLowerEntityHandles, t as RlsPolicyExtensionBlock } from "./authoring-CLNoGwgA-DPDmJeBt.mjs";
|
|
8
8
|
//#region ../../../3-targets/3-targets/postgres/dist/prisma7-binding.d.mts
|
|
9
|
+
//#region src/core/migrations/default-constraint-names.d.ts
|
|
10
|
+
/** `{table}_pkey` cut as Postgres cuts the name of a primary key it names itself: `CREATE TABLE` writes an unnamed primary key. */
|
|
11
|
+
declare function defaultPrimaryKeyName(tableName: string): string;
|
|
12
|
+
/** `{table}_{columns}_fkey`, cut to the 63 bytes Postgres stores. */
|
|
13
|
+
declare function defaultForeignKeyName(tableName: string, columns: readonly string[]): string;
|
|
14
|
+
//#endregion
|
|
9
15
|
//#region src/core/now-generators.d.ts
|
|
10
16
|
declare function postgresNowGeneratorIdFor(codecId: string): string | undefined;
|
|
11
17
|
//#endregion
|
|
@@ -910,6 +916,10 @@ declare const prisma7PostgresBinding: {
|
|
|
910
916
|
};
|
|
911
917
|
/** `NAMEDATALEN - 1`. */
|
|
912
918
|
readonly identifierMaxBytes: 63;
|
|
919
|
+
readonly defaultConstraintNames: {
|
|
920
|
+
readonly primaryKey: typeof defaultPrimaryKeyName;
|
|
921
|
+
readonly foreignKey: typeof defaultForeignKeyName;
|
|
922
|
+
};
|
|
913
923
|
readonly junctionRelationFieldNames: typeof junctionRelationFieldNames;
|
|
914
924
|
readonly updatedAtGeneratorId: typeof postgresNowGeneratorIdFor;
|
|
915
925
|
readonly literalDefaultForm: ({ dataType, typeParams }: {
|
|
@@ -927,4 +937,4 @@ declare const prisma7PostgresBinding: {
|
|
|
927
937
|
};
|
|
928
938
|
//#endregion
|
|
929
939
|
export { prisma7PostgresBinding as t };
|
|
930
|
-
//# sourceMappingURL=prisma7-binding-
|
|
940
|
+
//# sourceMappingURL=prisma7-binding-FvF1AZxQ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma7-binding-FvF1AZxQ.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/prisma7-binding.d.mts"],"mappings":";;;;;;;;;;iBASiB,sBAAsB;;iBAEtB,sBAAsB,mBAAmB;;;iBAGzC,0BAA0B;;;;;;;;iBAQ1B,2BAA2B,gBAAgB;;;;;;;;;;;;cAY9C;WACH;aACE;aACA;aACA,yDAAyD,iBAAiB,uBAAuB;eAC/F;SACN;eACM;SACN;eACM;SACN;eACM;SACN;eACM;SACN;eACM;;aAEF;eACE;iBACE;mBACE;mBACA;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;qBACA;uBACE;uBACA;;qBAEF;uBACE;;;;;eAKR;iBACE;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;;iBAQd;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;;;mBAGJ;qBACE;qBACA;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;;;;;eAKR,WAAW,SAAS,kEAAkE;eACtF;iBACE;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;;mBAEO;qBACE,UAAU,OAAO,oBAAoB,wDAAwD,2BAA2B;;;iBAG5H;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;;mBAEO;qBACE,UAAU,OAAO,+BAA+B;;;iBAGpD;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;;mBAEO;YACP,UAAU,OAAO,yBAAyB,wDAAwD,2BAA2B;YAC7H,eAAe,QAAQ;cACrB;;;;iBAIG;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;;mBAEO;YACP,UAAU,sCAAsC,wBAAwB,yBAAyB,wDAAwD,2BAA2B;YACpL,iBAAiB,QAAQ;cACvB;cACA;;;;;eAKC;iBACE;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;;;eAGR;iBACE;mBACE;mBACA;mBACA,qCAAqC;mBACrC,QAAQ,SAAS,sBAAsB,wDAAwD;YACtG;YACA,QAAQ;;;iBAGH;mBACE;mBACA;mBACA,qCAAqC;mBACrC;mBACA,QAAQ;qBACN;qBACA,WAAW;qBACX;qBACA;qBACA;aACR,wDAAwD;YACzD;cACE;cACA;cACA;cACA;cACA;cACA;cACA;;;;;eAKC,wBAAwB;eACxB,0BAA0B;eAC1B,+BAA+B;eAC/B,2BAA2B;;aAE7B;eACE;iBACE;mBACE;mBACA;mBACA;;;;aAIN;aACA;aACA;aACA;aACA;aACA;aACA,mEAAmE;aACnE,eAAe;;aAEf,eAAe;;WAEjB,wBAAwB;WACxB;WACA;aACE;eACE;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;;aAGJ;eACE;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;;;WAIN;aACE;aACA;;WAEF;aACE;aACA;aACA;aACA;aACA;aACA;;;WAGF;WACA;aACE,mBAAmB;aACnB,mBAAmB;;WAErB,mCAAmC;WACnC,6BAA6B;WAC7B,uBAAuB,UAAU;aAC/B;aACA,aAAa,SAAS;;aAEtB;aACA;aACA;;aAEA;aACA,UAAU;aACV,OAAO"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, a as pgBytea, b as pgJsonb, c as pgDate, y as pgJson } from "./data-types-
|
|
2
|
-
import { h as postgresCreateNamespace } from "./postgres-schema-
|
|
3
|
-
import { m as postgresNowGeneratorIdFor } from "./authoring-
|
|
4
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, a as pgBytea, b as pgJsonb, c as pgDate, y as pgJson } from "./data-types-k3Ebk3kj-DWk3nh_k.mjs";
|
|
2
|
+
import { h as postgresCreateNamespace } from "./postgres-schema-AlEVkXXS-ZfXWYddl.mjs";
|
|
3
|
+
import { m as postgresNowGeneratorIdFor } from "./authoring-vHbPLrW4-BsHR7gUE.mjs";
|
|
4
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-BgOMP4hF-CfUJsgjc.mjs";
|
|
5
5
|
import { t as parsePostgresDefault } from "./default-normalizer-CrMBHF0W-BaUR4Ec8.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { n as defaultPrimaryKeyName, t as defaultForeignKeyName } from "./default-constraint-names-CtcRXhV8-nz3ff6b8.mjs";
|
|
7
|
+
import { d as createPostgresTypeMap, l as buildPslDocumentAst, m as noColumnDefaults, t as EXISTING_COLUMN_DATE_TIME_TYPES, u as createPostgresDefaultMapping } from "./infer-psl-contract-B5yExD61-Cmye68li.mjs";
|
|
7
8
|
import { dataTypeParams, renderSqlTypeName, sqlBaseName } from "@prisma/orm-family-sql/contract/data-type";
|
|
8
9
|
import { SqlSchemaIR, SqlTableIR } from "@prisma/orm-family-sql/schema-ir/types";
|
|
9
10
|
import { toModelName } from "@prisma/orm-family-sql/family/psl-infer";
|
|
@@ -308,6 +309,10 @@ const prisma7PostgresBinding = {
|
|
|
308
309
|
},
|
|
309
310
|
/** `NAMEDATALEN - 1`. */
|
|
310
311
|
identifierMaxBytes: 63,
|
|
312
|
+
defaultConstraintNames: {
|
|
313
|
+
primaryKey: defaultPrimaryKeyName,
|
|
314
|
+
foreignKey: defaultForeignKeyName
|
|
315
|
+
},
|
|
311
316
|
junctionRelationFieldNames,
|
|
312
317
|
updatedAtGeneratorId: postgresNowGeneratorIdFor,
|
|
313
318
|
literalDefaultForm: ({ dataType, typeParams }) => {
|
|
@@ -330,4 +335,4 @@ const prisma7PostgresBinding = {
|
|
|
330
335
|
//#endregion
|
|
331
336
|
export { prisma7PostgresBinding as t };
|
|
332
337
|
|
|
333
|
-
//# sourceMappingURL=prisma7-binding-
|
|
338
|
+
//# sourceMappingURL=prisma7-binding-GebhdAGS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma7-binding-GebhdAGS.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/prisma7-binding.mjs"],"sourcesContent":["import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, a as pgBytea, b as pgJsonb, c as pgDate, y as pgJson } from \"./data-types-k3Ebk3kj.mjs\";\nimport { c as postgresNowGeneratorIdFor } from \"./authoring-vHbPLrW4.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-AlEVkXXS.mjs\";\nimport { t as postgresTargetDescriptorMeta } from \"./descriptor-meta-BgOMP4hF.mjs\";\nimport { t as parsePostgresDefault } from \"./default-normalizer-CrMBHF0W.mjs\";\nimport { n as defaultPrimaryKeyName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { c as noColumnDefaults, g as EXISTING_COLUMN_DATE_TIME_TYPES, h as createPostgresTypeMap, r as createPostgresDefaultMapping, t as buildPslDocumentAst } from \"./infer-psl-contract-B5yExD61.mjs\";\nimport { dataTypeParams, renderSqlTypeName, sqlBaseName } from \"@internal/sql-contract/data-type\";\nimport { SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { toModelName } from \"@internal/family-sql/psl-infer\";\nimport { flatPslModels } from \"@internal/framework-components/psl-ast\";\n//#region src/core/prisma7-temporal-defaults.ts\nconst RFC_3339 = /^(\\d{4})-(\\d{2})-(\\d{2})[Tt ](\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?(?:[Zz]|([+-])(\\d{2}):(\\d{2}))$/;\nconst MICROS_PER_SECOND = 1e6;\nfunction pad(value, width = 2) {\n\treturn String(value).padStart(width, \"0\");\n}\n/**\n* The microseconds Postgres keeps for a fraction-of-a-second digit string. Every digit counts:\n* `.1234565` is an exact tie, and C's `rint` takes the even neighbour 123456, while `.1234565001`\n* is above the tie and rounds up to 123457.\n*/\nfunction fractionMicros(fraction) {\n\tconst micros = Number(`${fraction}000000`.slice(0, 6));\n\tconst beyondTie = fraction.slice(6).replace(/0+$/, \"\");\n\tif (beyondTie === \"\") return micros;\n\tif (beyondTie === \"5\") return micros % 2 === 0 ? micros : micros + 1;\n\treturn beyondTie > \"5\" ? micros + 1 : micros;\n}\nfunction fractionText(micros) {\n\treturn micros === 0 ? \"\" : `.${pad(micros, 6).replace(/0+$/, \"\")}`;\n}\nfunction offsetText(minutes) {\n\tconst magnitude = Math.abs(minutes);\n\tconst rest = magnitude % 60;\n\treturn `${minutes < 0 ? \"-\" : \"+\"}${pad(Math.floor(magnitude / 60))}${rest === 0 ? \"\" : `:${pad(rest)}`}`;\n}\n/**\n* The text of the column default Postgres stores for a Prisma 7 `DateTime`\n* default, which Prisma 7 writes as `'2024-01-02 03:04:05.123 +02:00'`:\n* `date` keeps the written date, `time` and `timestamp` the written wall-clock\n* time without the offset, and `timetz` the time with the written offset.\n* `timestamptz` is carried in its UTC form, the text a session in UTC prints\n* (`2024-01-02 01:04:05+00`, and `0001-12-31 23:30:00+00 BC` before year 1);\n* a session in another time zone prints the same instant differently.\n* Fractional seconds are rounded to microseconds; the column's own precision\n* does not change a stored default.\n*/\nfunction storedTemporalText(text, dataType) {\n\tconst match = RFC_3339.exec(text);\n\tif (match === null) return void 0;\n\tconst [, year = \"\", month = \"\", day = \"\", hour, minute, second, fraction = \"\", sign, offsetHours, offsetMinutes] = match;\n\tif (dataType === pgDate.id) return `${year}-${month}-${day}`;\n\tconst micros = fractionMicros(fraction);\n\tconst clockSeconds = Number(hour) * 3600 + Number(minute) * 60 + Number(second) + Math.floor(micros / MICROS_PER_SECOND);\n\tconst fractional = fractionText(micros % MICROS_PER_SECOND);\n\tconst offsetMinutesTotal = sign === void 0 ? 0 : (sign === \"-\" ? -1 : 1) * (Number(offsetHours) * 60 + Number(offsetMinutes));\n\tif (dataType === pgTime.id || dataType === pgTimetz.id) {\n\t\tconst clock = `${pad(Math.floor(clockSeconds / 3600))}:${pad(Math.floor(clockSeconds / 60) % 60)}:${pad(clockSeconds % 60)}${fractional}`;\n\t\treturn dataType === pgTime.id ? clock : `${clock}${offsetText(offsetMinutesTotal)}`;\n\t}\n\tconst midnight = /* @__PURE__ */ new Date(0);\n\tmidnight.setUTCFullYear(Number(year), Number(month) - 1, Number(day));\n\tconst utcShift = dataType === pgTimestamptz.id ? offsetMinutesTotal * 60 : 0;\n\tconst stamp = new Date(midnight.getTime() + (clockSeconds - utcShift) * 1e3);\n\tconst astronomicalYear = stamp.getUTCFullYear();\n\tconst wallClock = `${pad(astronomicalYear > 0 ? astronomicalYear : 1 - astronomicalYear, 4)}-${pad(stamp.getUTCMonth() + 1)}-${pad(stamp.getUTCDate())} ${pad(stamp.getUTCHours())}:${pad(stamp.getUTCMinutes())}:${pad(stamp.getUTCSeconds())}${fractional}`;\n\tconst era = astronomicalYear > 0 ? \"\" : \" BC\";\n\treturn dataType === pgTimestamptz.id ? `${wallClock}+00${era}` : `${wallClock}${era}`;\n}\n//#endregion\n//#region src/core/prisma7-type-map.ts\n/**\n* What Prisma 7.10.0 creates in Postgres for each Prisma 7 scalar and `@db.*`\n* native type, expressed as the Prisma 8 authoring type constructor that\n* produces the same column. Derived from the SQL recorded in\n* `test/integration/test/fixtures/prisma7-source/reference/migration.sql`.\n* `args` are the constructor's positional arguments. A `@db.*` attribute's own\n* arguments replace them; without any, the column gets `args`, so `@db.Char`\n* is `Char(1)`, the `character(1)` Postgres stores for Prisma 7's `CHAR`.\n*/\nconst prisma7PostgresTypeMap = {\n\tscalars: {\n\t\tString: {\n\t\t\tconstructorName: \"String\",\n\t\t\targs: []\n\t\t},\n\t\tBoolean: {\n\t\t\tconstructorName: \"Boolean\",\n\t\t\targs: []\n\t\t},\n\t\tInt: {\n\t\t\tconstructorName: \"Int\",\n\t\t\targs: []\n\t\t},\n\t\tBigInt: {\n\t\t\tconstructorName: \"BigInt\",\n\t\t\targs: []\n\t\t},\n\t\tFloat: {\n\t\t\tconstructorName: \"Float\",\n\t\t\targs: []\n\t\t},\n\t\tDecimal: {\n\t\t\tconstructorName: \"Numeric\",\n\t\t\targs: [\"65\", \"30\"]\n\t\t},\n\t\tDateTime: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamp,\n\t\t\targs: [\"3\"]\n\t\t},\n\t\tJson: {\n\t\t\tconstructorName: \"Jsonb\",\n\t\t\targs: []\n\t\t},\n\t\tBytes: {\n\t\t\tconstructorName: \"Bytes\",\n\t\t\targs: []\n\t\t}\n\t},\n\tnativeTypes: {\n\t\tText: {\n\t\t\tconstructorName: \"String\",\n\t\t\targs: []\n\t\t},\n\t\tVarChar: {\n\t\t\tconstructorName: \"VarChar\",\n\t\t\targs: []\n\t\t},\n\t\tChar: {\n\t\t\tconstructorName: \"Char\",\n\t\t\targs: [\"1\"]\n\t\t},\n\t\tUuid: {\n\t\t\tconstructorName: \"Uuid\",\n\t\t\targs: []\n\t\t},\n\t\tInet: {\n\t\t\tconstructorName: \"Inet\",\n\t\t\targs: []\n\t\t},\n\t\tBoolean: {\n\t\t\tconstructorName: \"Boolean\",\n\t\t\targs: []\n\t\t},\n\t\tInteger: {\n\t\t\tconstructorName: \"Int\",\n\t\t\targs: []\n\t\t},\n\t\tSmallInt: {\n\t\t\tconstructorName: \"SmallInt\",\n\t\t\targs: []\n\t\t},\n\t\tBigInt: {\n\t\t\tconstructorName: \"BigInt\",\n\t\t\targs: []\n\t\t},\n\t\tReal: {\n\t\t\tconstructorName: \"Real\",\n\t\t\targs: []\n\t\t},\n\t\tDoublePrecision: {\n\t\t\tconstructorName: \"Float\",\n\t\t\targs: []\n\t\t},\n\t\tDecimal: {\n\t\t\tconstructorName: \"Numeric\",\n\t\t\targs: []\n\t\t},\n\t\tTimestamp: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamp,\n\t\t\targs: []\n\t\t},\n\t\tTimestamptz: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamptz,\n\t\t\targs: []\n\t\t},\n\t\tDate: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.date,\n\t\t\targs: []\n\t\t},\n\t\tTime: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.time,\n\t\t\targs: []\n\t\t},\n\t\tTimetz: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timetz,\n\t\t\targs: []\n\t\t},\n\t\tJson: {\n\t\t\tconstructorName: \"Json\",\n\t\t\targs: []\n\t\t},\n\t\tJsonB: {\n\t\t\tconstructorName: \"Jsonb\",\n\t\t\targs: []\n\t\t},\n\t\tByteA: {\n\t\t\tconstructorName: \"Bytes\",\n\t\t\targs: []\n\t\t}\n\t}\n};\n//#endregion\n//#region src/core/psl-infer/junction-relation-field-names.ts\nconst EMPTY_FOREIGN_KEY_EXTRAS = {\n\textraRelationsByTable: /* @__PURE__ */ new Map(),\n\tcrossSpaceFieldNamesByTable: /* @__PURE__ */ new Map(),\n\tdanglingForeignKeysByTable: /* @__PURE__ */ new Map()\n};\nfunction idTable(name) {\n\treturn new SqlTableIR({\n\t\tname,\n\t\tcolumns: { id: {\n\t\t\tname: \"id\",\n\t\t\tnativeType: \"int4\",\n\t\t\tnullable: false\n\t\t} },\n\t\tforeignKeys: [],\n\t\tuniques: [],\n\t\tindexes: [],\n\t\tprimaryKey: { columns: [\"id\"] }\n\t});\n}\n/**\n* The relation field names `contract infer` prints for an implicit\n* many-to-many junction table whose columns `A` and `B` reference `tableA`\n* and `tableB`, found by running infer's PSL construction on that table.\n*/\nfunction junctionRelationFieldNames(tableA, tableB) {\n\tlet junctionName = \"_junction\";\n\twhile ([tableA, tableB].some((table) => toModelName(table).name === toModelName(junctionName).name)) junctionName = `${junctionName}x`;\n\tconst column = (name) => ({\n\t\tname,\n\t\tnativeType: \"int4\",\n\t\tnullable: false\n\t});\n\tconst foreignKey = (columnName, referencedTable) => ({\n\t\tcolumns: [columnName],\n\t\treferencedTable,\n\t\treferencedColumns: [\"id\"]\n\t});\n\tconst junction = new SqlTableIR({\n\t\tname: junctionName,\n\t\tcolumns: {\n\t\t\tA: column(\"A\"),\n\t\t\tB: column(\"B\")\n\t\t},\n\t\tforeignKeys: [foreignKey(\"A\", tableA), foreignKey(\"B\", tableB)],\n\t\tuniques: [],\n\t\tindexes: [],\n\t\tprimaryKey: { columns: [\"A\", \"B\"] }\n\t});\n\tconst document = buildPslDocumentAst(new SqlSchemaIR({ tables: {\n\t\t[tableA]: idTable(tableA),\n\t\t[tableB]: idTable(tableB),\n\t\t[junctionName]: junction\n\t} }), {\n\t\ttypeMap: createPostgresTypeMap(),\n\t\tdefaultMapping: createPostgresDefaultMapping(),\n\t\tparseRawDefault: parsePostgresDefault,\n\t\tcolumnDefaults: noColumnDefaults\n\t}, EMPTY_FOREIGN_KEY_EXTRAS);\n\tconst junctionModelName = toModelName(junctionName).name;\n\tconst fields = flatPslModels(document).find((model) => model.name === junctionModelName)?.fields;\n\tconst scalarFieldCount = Object.keys(junction.columns).length;\n\tconst [a = \"\", b = \"\"] = (fields ?? []).slice(scalarFieldCount).map((field) => field.name);\n\treturn [a, b];\n}\n//#endregion\n//#region src/core/prisma7-binding.ts\nconst TEMPORAL_TYPES = new Map([\n\tpgTimestamp,\n\tpgTimestamptz,\n\tpgDate,\n\tpgTime,\n\tpgTimetz\n].map((type) => [type.id, type]));\nconst BYTEA_LIST_TYPE = sqlBaseName(pgBytea, {}).toUpperCase();\nfunction sqlStringLiteral(value) {\n\treturn value === void 0 ? void 0 : `'${value.replace(/'/g, \"''\")}'`;\n}\nfunction base64ToHex(base64) {\n\tif (!/^[A-Za-z0-9+/]*={0,2}$/.test(base64) || base64.length % 4 !== 0) return void 0;\n\treturn `\\\\x${Buffer.from(base64, \"base64\").toString(\"hex\")}`;\n}\nfunction arrayLiteral(literals, typeName) {\n\treturn `ARRAY[${literals.join(\", \")}]::${typeName}[]`;\n}\n/**\n* What the Postgres target supplies to the Prisma 7 interpreter. A `Bytes` or\n* `DateTime` default is carried as the SQL literal of the default Postgres\n* stores (`'\\x68656c6c6f'`, `'2024-01-02 03:04:05'`), and a list default as an\n* `ARRAY[...]` of those literals cast to the column type, rather than as the\n* column codec's JSON form (base64, ISO 8601 text). Verify reads both forms as\n* the same value; the reader keeps the SQL literal because storing the value\n* instead changes the contract hash of every such schema (TML-3455).\n*/\nconst prisma7PostgresBinding = {\n\ttarget: postgresTargetDescriptorMeta,\n\tcreateNamespace: postgresCreateNamespace,\n\tproviders: [\"postgresql\", \"postgres\"],\n\ttypeMap: prisma7PostgresTypeMap,\n\tnativeEnum: {\n\t\tentityKind: \"native_enum\",\n\t\ttypeConstructor: [\"pg\", \"enum\"]\n\t},\n\tindexTypes: {\n\t\tBTree: \"btree\",\n\t\tHash: \"hash\",\n\t\tGin: \"gin\",\n\t\tGist: \"gist\",\n\t\tSpGist: \"spgist\",\n\t\tBrin: \"brin\"\n\t},\n\t/** `NAMEDATALEN - 1`. */\n\tidentifierMaxBytes: 63,\n\tdefaultConstraintNames: {\n\t\tprimaryKey: defaultPrimaryKeyName,\n\t\tforeignKey: defaultForeignKeyName\n\t},\n\tjunctionRelationFieldNames,\n\tupdatedAtGeneratorId: postgresNowGeneratorIdFor,\n\tliteralDefaultForm: ({ dataType, typeParams }) => {\n\t\tif (dataType === pgJson.id || dataType === pgJsonb.id) return { kind: \"json\" };\n\t\tif (dataType === pgBytea.id) return {\n\t\t\tkind: \"sqlExpression\",\n\t\t\tliteral: (text) => sqlStringLiteral(base64ToHex(text)),\n\t\t\tlist: (literals) => arrayLiteral(literals, BYTEA_LIST_TYPE)\n\t\t};\n\t\tconst type = TEMPORAL_TYPES.get(dataType);\n\t\tif (type === void 0) return void 0;\n\t\tconst typeName = renderSqlTypeName(type, dataTypeParams(type, typeParams)).toUpperCase();\n\t\treturn {\n\t\t\tkind: \"sqlExpression\",\n\t\t\tliteral: (text) => sqlStringLiteral(storedTemporalText(text, type.id)),\n\t\t\tlist: (literals) => arrayLiteral(literals, typeName)\n\t\t};\n\t}\n};\n//#endregion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KAAK;EACL,MAAM;EACN,QAAQ;EACR,MAAM;CACP;;CAEA,oBAAoB;CACpB,wBAAwB;EACvB,YAAY;EACZ,YAAY;CACb;CACA;CACA,sBAAsB;CACtB,qBAAqB,EAAE,UAAU,iBAAiB;EACjD,IAAI,aAAa,OAAO,MAAM,aAAa,QAAQ,IAAI,OAAO,EAAE,MAAM,OAAO;EAC7E,IAAI,aAAa,QAAQ,IAAI,OAAO;GACnC,MAAM;GACN,UAAU,SAAS,iBAAiB,YAAY,IAAI,CAAC;GACrD,OAAO,aAAa,aAAa,UAAU,eAAe;EAC3D;EACA,MAAM,OAAO,eAAe,IAAI,QAAQ;EACxC,IAAI,SAAS,KAAK,GAAG,OAAO,KAAK;EACjC,MAAM,WAAW,kBAAkB,MAAM,eAAe,MAAM,UAAU,CAAC,CAAC,CAAC,YAAY;EACvF,OAAO;GACN,MAAM;GACN,UAAU,SAAS,iBAAiB,mBAAmB,MAAM,KAAK,EAAE,CAAC;GACrE,OAAO,aAAa,aAAa,UAAU,QAAQ;EACpD;CACD;AACD"}
|
package/dist/{resolve-ddl-schema-CadTChyu-C7F31wpN.mjs → resolve-ddl-schema-BthOWVjF-DuZ9iUh-.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-AlEVkXXS-ZfXWYddl.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-BthOWVjF.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-BthOWVjF-DuZ9iUh-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-ddl-schema-
|
|
1
|
+
{"version":3,"file":"resolve-ddl-schema-BthOWVjF-DuZ9iUh-.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/resolve-ddl-schema-BthOWVjF.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-AlEVkXXS.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-BthOWVjF.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,5 +1,5 @@
|
|
|
1
|
-
import { r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-
|
|
2
|
-
import { A as pgTimestamptz, E as pgTime, I as pgVarbit, L as pgVarchar, M as pgTimetz, O as pgTimestamp, _ as pgInt8, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, n as pgBit, o as pgChar, p as pgFloat8, v as pgInterval, w as pgText, x as pgNumeric } from "./data-types-
|
|
1
|
+
import { r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-CVsvXiX4-C7xD0Bgv.mjs";
|
|
2
|
+
import { A as pgTimestamptz, E as pgTime, I as pgVarbit, L as pgVarchar, M as pgTimetz, O as pgTimestamp, _ as pgInt8, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, n as pgBit, o as pgChar, p as pgFloat8, v as pgInterval, w as pgText, x as pgNumeric } from "./data-types-k3Ebk3kj-DWk3nh_k.mjs";
|
|
3
3
|
import { LiteralExpr, collectOrderedParamRefs, lockOptionCapabilities, lockStrengthCapabilities, missingCapability } from "@prisma/orm-family-sql/relational-core/ast";
|
|
4
4
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
5
5
|
import { dataTypeParams, sqlBaseName, sqlDataTypeOfCodec } from "@prisma/orm-family-sql/contract/data-type";
|
|
@@ -554,4 +554,4 @@ function renderRawExpr(node, contract, pim) {
|
|
|
554
554
|
//#endregion
|
|
555
555
|
export { renderLoweredSql as n, adapterError as t };
|
|
556
556
|
|
|
557
|
-
//# sourceMappingURL=sql-renderer-DT4IEOVi-
|
|
557
|
+
//# sourceMappingURL=sql-renderer-DT4IEOVi-CE0YIu9V.mjs.map
|
package/dist/{sql-renderer-DT4IEOVi-G0Q8NmyB.mjs.map → sql-renderer-DT4IEOVi-CE0YIu9V.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-renderer-DT4IEOVi-G0Q8NmyB.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/sql-renderer-DT4IEOVi.mjs"],"sourcesContent":["import { LiteralExpr, collectOrderedParamRefs, lockOptionCapabilities, lockStrengthCapabilities, missingCapability } from \"@internal/sql-relational-core/ast\";\nimport { pgBit, pgBool, pgChar, pgFloat4, pgFloat8, pgInt2, pgInt4, pgInt8, pgInterval, pgNumeric, pgText, pgTime, pgTimestamp, pgTimestamptz, pgTimetz, pgVarbit, pgVarchar } from \"@internal/target-postgres/data-types\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { escapeLiteral, quoteIdentifier } from \"@internal/target-postgres/sql-utils\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { runtimeError } from \"@internal/framework-components/runtime\";\nimport { dataTypeParams, sqlBaseName, sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\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* Data types whose unknown-OID parameter inference is reliable in arbitrary expression positions. A parameter whose codec represents one of these is emitted as plain `$N`; everything else (including `pg/json`, `pg/jsonb`, extension types like `pgvector/vector`, and enums) is emitted as `$N::<base name>` so the planner picks an unambiguous overload.\n*\n* `pg/json` / `pg/jsonb` are intentionally excluded: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).\n*/\nconst POSTGRES_INFERRABLE_DATA_TYPES = /* @__PURE__ */ new Set([\n\tpgInt2.id,\n\tpgInt4.id,\n\tpgInt8.id,\n\tpgFloat4.id,\n\tpgFloat8.id,\n\tpgNumeric.id,\n\tpgBool.id,\n\tpgText.id,\n\tpgChar.id,\n\tpgVarchar.id,\n\tpgTimestamp.id,\n\tpgTimestamptz.id,\n\tpgTime.id,\n\tpgTimetz.id,\n\tpgInterval.id,\n\tpgBit.id,\n\tpgVarbit.id\n]);\n/**\n* A parameter's cast names its data type's base name, never its parameters: an explicit cast to\n* `varchar(n)` truncates and to `numeric(p,s)` rounds.\n*/\nfunction renderTypedParam(index, codecId, types, many, typeParams, forceCast = false) {\n\tif (codecId === void 0) return `$${index}`;\n\tif (types.codecDescriptorRegistry.descriptorFor(codecId) === 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 dataType = sqlDataTypeOfCodec(codecId, {\n\t\tcodecLookup: types.codecDescriptorRegistry,\n\t\tdataTypeLookup: types.dataTypeLookup\n\t});\n\tconst arraySuffix = many ? \"[]\" : \"\";\n\tif (forceCast || !POSTGRES_INFERRABLE_DATA_TYPES.has(dataType.id) || many) return `$${index}::${sqlBaseName(dataType, dataTypeParams(dataType, isPlainRecord(typeParams) ? typeParams : void 0))}${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, dataTypeLookup, capabilities) {\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\ttypes: {\n\t\t\tcodecDescriptorRegistry,\n\t\t\tdataTypeLookup\n\t\t},\n\t\tcapabilities\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-query\":\n\t\t\tsql = renderParts(node.parts, 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\treturn [\n\t\t`SELECT ${renderDistinctPrefix(ast.distinct, ast.distinctOn, 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 ${renderOrderByItems(ast.orderBy, contract, pim)}` : \"\",\n\t\trenderLimitOffset(\"LIMIT\", ast.limit, contract, pim),\n\t\trenderLimitOffset(\"OFFSET\", ast.offset, contract, pim),\n\t\t(ast.locking ?? []).map((clause) => renderLockingClause(clause, pim.capabilities)).join(\" \")\n\t].filter((part) => part.length > 0).join(\" \").trim();\n}\nfunction lockStrengthKeyword(strength) {\n\tswitch (strength) {\n\t\tcase \"forUpdate\": return \"FOR UPDATE\";\n\t\tcase \"forNoKeyUpdate\": return \"FOR NO KEY UPDATE\";\n\t\tcase \"forShare\": return \"FOR SHARE\";\n\t\tcase \"forKeyShare\": return \"FOR KEY SHARE\";\n\t\tdefault: return assertNever(strength, `Unsupported lock strength: ${String(strength)}`);\n\t}\n}\nfunction lockWaitPolicyKeyword(waitPolicy) {\n\tswitch (waitPolicy) {\n\t\tcase \"nowait\": return \"NOWAIT\";\n\t\tcase \"skipLocked\": return \"SKIP LOCKED\";\n\t\tdefault: return assertNever(waitPolicy, `Unsupported lock wait policy: ${String(waitPolicy)}`);\n\t}\n}\nfunction requireCapability(capabilities, requirement) {\n\tconst capability = missingCapability(capabilities, requirement);\n\tif (capability !== void 0) throw adapterError(\"RUNTIME.AST_UNSUPPORTED\", `Postgres adapter does not report capability ${capability}, which this locking clause needs`, { meta: {\n\t\ttarget: \"postgres\",\n\t\tfeature: \"locking-clause\",\n\t\tcapability\n\t} });\n}\nfunction renderLockingClause(clause, capabilities) {\n\trequireCapability(capabilities, lockStrengthCapabilities[clause.strength]);\n\tconst parts = [lockStrengthKeyword(clause.strength)];\n\tif (clause.of !== void 0) {\n\t\trequireCapability(capabilities, lockOptionCapabilities.of);\n\t\tparts.push(`OF ${clause.of.map((name) => quoteIdentifier(name)).join(\", \")}`);\n\t}\n\tif (clause.waitPolicy !== void 0) {\n\t\trequireCapability(capabilities, lockOptionCapabilities[clause.waitPolicy]);\n\t\tparts.push(lockWaitPolicyKeyword(clause.waitPolicy));\n\t}\n\treturn parts.join(\" \");\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\tif (item.expr.kind === \"prepared-param-ref\") return `${renderParamRef(item.expr, pim, true)} 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, contract, pim) {\n\tif (distinctOn && distinctOn.length > 0) return `DISTINCT ON (${distinctOn.map((expr) => renderExpr(expr, 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\tisNotDistinctFrom: \"IS NOT DISTINCT FROM\",\n\t\tisDistinctFrom: \"IS DISTINCT FROM\",\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.types.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)}${ORDER_DIRECTION_SQL[item.dir]}${renderNullsPlacement(item)}`).join(\", \");\n}\nconst ORDER_DIRECTION_SQL = {\n\tasc: \" ASC\",\n\tdesc: \" DESC\"\n};\nconst ORDER_NULLS_SQL = {\n\tfirst: \" NULLS FIRST\",\n\tlast: \" NULLS LAST\"\n};\nfunction renderNullsPlacement(item) {\n\treturn item.nulls === void 0 ? \"\" : ORDER_NULLS_SQL[item.nulls];\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, forceCast = false) {\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.types, ref.codec.many, ref.codec.typeParams, forceCast);\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.types, 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\tconst target = conflictColumns.length === 0 ? \"\" : ` (${conflictColumns.join(\", \")})`;\n\t\tconst action = ast.onConflict.action;\n\t\tswitch (action.kind) {\n\t\t\tcase \"do-nothing\": return ` ON CONFLICT${target} DO NOTHING`;\n\t\t\tcase \"do-update-set\": {\n\t\t\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\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\treturn ` ON CONFLICT${target} DO UPDATE SET ${updateEntries.map(([colName, value]) => {\n\t\t\t\t\treturn `${quoteIdentifier(colName)} = ${renderExpr(value, contract, pim)}`;\n\t\t\t\t}).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 renderParts(parts, contract, pim) {\n\treturn parts.map((part) => typeof part === \"string\" ? part : renderExpr(part, contract, pim)).join(\"\");\n}\nfunction renderRawExpr(node, contract, pim) {\n\treturn renderParts(node.parts, contract, pim);\n}\n//#endregion\nexport { adapterError as n, renderLoweredSql as t };\n\n//# sourceMappingURL=sql-renderer-DT4IEOVi.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;AAQA,MAAM,iDAAiD,IAAI,IAAI;CAC9D,OAAO;CACP,OAAO;CACP,OAAO;CACP,SAAS;CACT,SAAS;CACT,UAAU;CACV,OAAO;CACP,OAAO;CACP,OAAO;CACP,UAAU;CACV,YAAY;CACZ,cAAc;CACd,OAAO;CACP,SAAS;CACT,WAAW;CACX,MAAM;CACN,SAAS;AACV,CAAC;;;;;AAKD,SAAS,iBAAiB,OAAO,SAAS,OAAO,MAAM,YAAY,YAAY,OAAO;CACrF,IAAI,YAAY,KAAK,GAAG,OAAO,IAAI;CACnC,IAAI,MAAM,wBAAwB,cAAc,OAAO,MAAM,KAAK,GAAG,MAAM,aAAa,mCAAmC,gDAAgD,QAAQ,2TAA2T,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;CACngB,MAAM,WAA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AAC,CAAC,KAAK,EAAE;AACtG;AACA,SAAS,cAAc,MAAM,UAAU,KAAK;CAC3C,OAAO,YAAY,KAAK,OAAO,UAAU,GAAG;AAC7C"}
|
|
1
|
+
{"version":3,"file":"sql-renderer-DT4IEOVi-CE0YIu9V.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/sql-renderer-DT4IEOVi.mjs"],"sourcesContent":["import { LiteralExpr, collectOrderedParamRefs, lockOptionCapabilities, lockStrengthCapabilities, missingCapability } from \"@internal/sql-relational-core/ast\";\nimport { pgBit, pgBool, pgChar, pgFloat4, pgFloat8, pgInt2, pgInt4, pgInt8, pgInterval, pgNumeric, pgText, pgTime, pgTimestamp, pgTimestamptz, pgTimetz, pgVarbit, pgVarchar } from \"@internal/target-postgres/data-types\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { escapeLiteral, quoteIdentifier } from \"@internal/target-postgres/sql-utils\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { runtimeError } from \"@internal/framework-components/runtime\";\nimport { dataTypeParams, sqlBaseName, sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\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* Data types whose unknown-OID parameter inference is reliable in arbitrary expression positions. A parameter whose codec represents one of these is emitted as plain `$N`; everything else (including `pg/json`, `pg/jsonb`, extension types like `pgvector/vector`, and enums) is emitted as `$N::<base name>` so the planner picks an unambiguous overload.\n*\n* `pg/json` / `pg/jsonb` are intentionally excluded: their operator overloads make context inference unreliable in expression positions (e.g. `$1 -> 'key'` is ambiguous between the two).\n*/\nconst POSTGRES_INFERRABLE_DATA_TYPES = /* @__PURE__ */ new Set([\n\tpgInt2.id,\n\tpgInt4.id,\n\tpgInt8.id,\n\tpgFloat4.id,\n\tpgFloat8.id,\n\tpgNumeric.id,\n\tpgBool.id,\n\tpgText.id,\n\tpgChar.id,\n\tpgVarchar.id,\n\tpgTimestamp.id,\n\tpgTimestamptz.id,\n\tpgTime.id,\n\tpgTimetz.id,\n\tpgInterval.id,\n\tpgBit.id,\n\tpgVarbit.id\n]);\n/**\n* A parameter's cast names its data type's base name, never its parameters: an explicit cast to\n* `varchar(n)` truncates and to `numeric(p,s)` rounds.\n*/\nfunction renderTypedParam(index, codecId, types, many, typeParams, forceCast = false) {\n\tif (codecId === void 0) return `$${index}`;\n\tif (types.codecDescriptorRegistry.descriptorFor(codecId) === 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 dataType = sqlDataTypeOfCodec(codecId, {\n\t\tcodecLookup: types.codecDescriptorRegistry,\n\t\tdataTypeLookup: types.dataTypeLookup\n\t});\n\tconst arraySuffix = many ? \"[]\" : \"\";\n\tif (forceCast || !POSTGRES_INFERRABLE_DATA_TYPES.has(dataType.id) || many) return `$${index}::${sqlBaseName(dataType, dataTypeParams(dataType, isPlainRecord(typeParams) ? typeParams : void 0))}${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, dataTypeLookup, capabilities) {\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\ttypes: {\n\t\t\tcodecDescriptorRegistry,\n\t\t\tdataTypeLookup\n\t\t},\n\t\tcapabilities\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-query\":\n\t\t\tsql = renderParts(node.parts, 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\treturn [\n\t\t`SELECT ${renderDistinctPrefix(ast.distinct, ast.distinctOn, 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 ${renderOrderByItems(ast.orderBy, contract, pim)}` : \"\",\n\t\trenderLimitOffset(\"LIMIT\", ast.limit, contract, pim),\n\t\trenderLimitOffset(\"OFFSET\", ast.offset, contract, pim),\n\t\t(ast.locking ?? []).map((clause) => renderLockingClause(clause, pim.capabilities)).join(\" \")\n\t].filter((part) => part.length > 0).join(\" \").trim();\n}\nfunction lockStrengthKeyword(strength) {\n\tswitch (strength) {\n\t\tcase \"forUpdate\": return \"FOR UPDATE\";\n\t\tcase \"forNoKeyUpdate\": return \"FOR NO KEY UPDATE\";\n\t\tcase \"forShare\": return \"FOR SHARE\";\n\t\tcase \"forKeyShare\": return \"FOR KEY SHARE\";\n\t\tdefault: return assertNever(strength, `Unsupported lock strength: ${String(strength)}`);\n\t}\n}\nfunction lockWaitPolicyKeyword(waitPolicy) {\n\tswitch (waitPolicy) {\n\t\tcase \"nowait\": return \"NOWAIT\";\n\t\tcase \"skipLocked\": return \"SKIP LOCKED\";\n\t\tdefault: return assertNever(waitPolicy, `Unsupported lock wait policy: ${String(waitPolicy)}`);\n\t}\n}\nfunction requireCapability(capabilities, requirement) {\n\tconst capability = missingCapability(capabilities, requirement);\n\tif (capability !== void 0) throw adapterError(\"RUNTIME.AST_UNSUPPORTED\", `Postgres adapter does not report capability ${capability}, which this locking clause needs`, { meta: {\n\t\ttarget: \"postgres\",\n\t\tfeature: \"locking-clause\",\n\t\tcapability\n\t} });\n}\nfunction renderLockingClause(clause, capabilities) {\n\trequireCapability(capabilities, lockStrengthCapabilities[clause.strength]);\n\tconst parts = [lockStrengthKeyword(clause.strength)];\n\tif (clause.of !== void 0) {\n\t\trequireCapability(capabilities, lockOptionCapabilities.of);\n\t\tparts.push(`OF ${clause.of.map((name) => quoteIdentifier(name)).join(\", \")}`);\n\t}\n\tif (clause.waitPolicy !== void 0) {\n\t\trequireCapability(capabilities, lockOptionCapabilities[clause.waitPolicy]);\n\t\tparts.push(lockWaitPolicyKeyword(clause.waitPolicy));\n\t}\n\treturn parts.join(\" \");\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\tif (item.expr.kind === \"prepared-param-ref\") return `${renderParamRef(item.expr, pim, true)} 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, contract, pim) {\n\tif (distinctOn && distinctOn.length > 0) return `DISTINCT ON (${distinctOn.map((expr) => renderExpr(expr, 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\tisNotDistinctFrom: \"IS NOT DISTINCT FROM\",\n\t\tisDistinctFrom: \"IS DISTINCT FROM\",\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.types.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)}${ORDER_DIRECTION_SQL[item.dir]}${renderNullsPlacement(item)}`).join(\", \");\n}\nconst ORDER_DIRECTION_SQL = {\n\tasc: \" ASC\",\n\tdesc: \" DESC\"\n};\nconst ORDER_NULLS_SQL = {\n\tfirst: \" NULLS FIRST\",\n\tlast: \" NULLS LAST\"\n};\nfunction renderNullsPlacement(item) {\n\treturn item.nulls === void 0 ? \"\" : ORDER_NULLS_SQL[item.nulls];\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, forceCast = false) {\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.types, ref.codec.many, ref.codec.typeParams, forceCast);\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.types, 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\tconst target = conflictColumns.length === 0 ? \"\" : ` (${conflictColumns.join(\", \")})`;\n\t\tconst action = ast.onConflict.action;\n\t\tswitch (action.kind) {\n\t\t\tcase \"do-nothing\": return ` ON CONFLICT${target} DO NOTHING`;\n\t\t\tcase \"do-update-set\": {\n\t\t\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\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\treturn ` ON CONFLICT${target} DO UPDATE SET ${updateEntries.map(([colName, value]) => {\n\t\t\t\t\treturn `${quoteIdentifier(colName)} = ${renderExpr(value, contract, pim)}`;\n\t\t\t\t}).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 renderParts(parts, contract, pim) {\n\treturn parts.map((part) => typeof part === \"string\" ? part : renderExpr(part, contract, pim)).join(\"\");\n}\nfunction renderRawExpr(node, contract, pim) {\n\treturn renderParts(node.parts, contract, pim);\n}\n//#endregion\nexport { adapterError as n, renderLoweredSql as t };\n\n//# sourceMappingURL=sql-renderer-DT4IEOVi.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;AAQA,MAAM,iDAAiD,IAAI,IAAI;CAC9D,OAAO;CACP,OAAO;CACP,OAAO;CACP,SAAS;CACT,SAAS;CACT,UAAU;CACV,OAAO;CACP,OAAO;CACP,OAAO;CACP,UAAU;CACV,YAAY;CACZ,cAAc;CACd,OAAO;CACP,SAAS;CACT,WAAW;CACX,MAAM;CACN,SAAS;AACV,CAAC;;;;;AAKD,SAAS,iBAAiB,OAAO,SAAS,OAAO,MAAM,YAAY,YAAY,OAAO;CACrF,IAAI,YAAY,KAAK,GAAG,OAAO,IAAI;CACnC,IAAI,MAAM,wBAAwB,cAAc,OAAO,MAAM,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