@prisma/orm-target-postgres 8.0.0-rc.14-dev.5 → 8.0.0-rc.14-dev.7
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-Bz6wSV__-Dp93eiiH.mjs → adapter-Bb_FFDea-O-uPaHCy.mjs} +5 -5
- package/dist/{adapter-Bz6wSV__-Dp93eiiH.mjs.map → adapter-Bb_FFDea-O-uPaHCy.mjs.map} +1 -1
- package/dist/{adapter-DP_SQYED.d.mts → adapter-WLK_P3mT.d.mts} +3 -3
- package/dist/{adapter-DP_SQYED.d.mts.map → adapter-WLK_P3mT.d.mts.map} +1 -1
- package/dist/adapter.d.mts +8 -8
- package/dist/adapter.mjs +6 -6
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.d.mts +3 -3
- package/dist/adapter__control.mjs +8 -369
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +4 -5
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.d.mts +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/adapter__types.d.mts +3 -3
- package/dist/{authoring-BmQxOggr-CK871YR4.mjs → authoring-DKN1ccEX-DgmJWx1r.mjs} +4 -4
- package/dist/{authoring-BmQxOggr-CK871YR4.mjs.map → authoring-DKN1ccEX-DgmJWx1r.mjs.map} +1 -1
- package/dist/{codec-descriptor-BfoHQP3R-CMRVT-F6.mjs → codec-descriptor-B61d-k4C-BdWVU6Fu.mjs} +4 -3
- package/dist/codec-descriptor-B61d-k4C-BdWVU6Fu.mjs.map +1 -0
- package/dist/codec-descriptor-D8_e5hpo.d.mts +1 -0
- package/dist/{codec-descriptor-DUUGoeyI-WGLGXEoI.d.mts → codec-descriptor-HYqjI24K-CTO3gTEs.d.mts} +11 -5
- package/dist/codec-descriptor-HYqjI24K-CTO3gTEs.d.mts.map +1 -0
- package/dist/{data-types-Cl18KnNY-5I34Vd6Z.mjs → codec-helpers-D83-1eDB-nqAEMr7N.mjs} +39 -216
- package/dist/codec-helpers-D83-1eDB-nqAEMr7N.mjs.map +1 -0
- package/dist/{codec-type-map-Cp91lhQd-D6zQ14YE.d.mts → codec-type-map-DMKy_xZb-DymgX4w7.d.mts} +4 -4
- package/dist/{codec-type-map-Cp91lhQd-D6zQ14YE.d.mts.map → codec-type-map-DMKy_xZb-DymgX4w7.d.mts.map} +1 -1
- package/dist/{codec-types-BQNq7Y1u-CGfS7PuD.d.mts → codec-types-B4-xhn7m-RQS461us.d.mts} +4 -4
- package/dist/{codec-types-BQNq7Y1u-CGfS7PuD.d.mts.map → codec-types-B4-xhn7m-RQS461us.d.mts.map} +1 -1
- package/dist/codec-types-Ci1nfCYh.d.mts +2 -0
- package/dist/{codecs-DQGmsnk3-H6nVRPCC.mjs → codecs-BHNqtI1J-BSS9sL3H.mjs} +263 -69
- package/dist/codecs-BHNqtI1J-BSS9sL3H.mjs.map +1 -0
- package/dist/{codecs-BKV97Xsa.d.mts → codecs-Ba3gUr67.d.mts} +11 -5
- package/dist/{codecs-BKV97Xsa.d.mts.map → codecs-Ba3gUr67.d.mts.map} +1 -1
- package/dist/{codecs-BZ87E3MY-Bub4t0ma.d.mts → codecs-Bkmbmo_r-Ct7hFY0S.d.mts} +31 -10
- package/dist/{codecs-BZ87E3MY-Bub4t0ma.d.mts.map → codecs-Bkmbmo_r-Ct7hFY0S.d.mts.map} +1 -1
- package/dist/{codecs-C4DVdgQG.mjs → codecs-Cytq8Ymj.mjs} +12 -4
- package/dist/codecs-Cytq8Ymj.mjs.map +1 -0
- package/dist/control-CUzQZfhu.d.mts +399 -0
- package/dist/control-CUzQZfhu.d.mts.map +1 -0
- package/dist/{control-w3p4NYNx.mjs → control-CYQReJto.mjs} +441 -72
- package/dist/control-CYQReJto.mjs.map +1 -0
- package/dist/{control-DxJWBVjs.d.mts → control-DoIm71dz.d.mts} +5 -4
- package/dist/control-DoIm71dz.d.mts.map +1 -0
- package/dist/{control-adapter-Buuq3v1c-DtBZerak.mjs → control-adapter-C6kz--Q4-3C9-f7Uv.mjs} +78 -95
- package/dist/control-adapter-C6kz--Q4-3C9-f7Uv.mjs.map +1 -0
- package/dist/{control-policy-BYo5QPof-BLT07t1y.mjs → control-policy-voGArjr--BeHlQRg0.mjs} +19 -17
- package/dist/control-policy-voGArjr--BeHlQRg0.mjs.map +1 -0
- package/dist/{data-type-entries-CvkBtAG--D-5Wtm9_.mjs → data-type-entries-BDSHvsdE-Bbe1cdbR.mjs} +3 -3
- package/dist/{data-type-entries-CvkBtAG--D-5Wtm9_.mjs.map → data-type-entries-BDSHvsdE-Bbe1cdbR.mjs.map} +1 -1
- package/dist/data-types-BqeC7aZP-CwvA08pH.mjs +200 -0
- package/dist/data-types-BqeC7aZP-CwvA08pH.mjs.map +1 -0
- package/dist/{default-normalizer-Bp3IhMR9-D0uYVRLZ.mjs → default-normalizer-Cb7nWBUa-DXchlOUk.mjs} +82 -19
- package/dist/default-normalizer-Cb7nWBUa-DXchlOUk.mjs.map +1 -0
- package/dist/{descriptor-meta-F1wsOtt2-D014LIGM.mjs → descriptor-meta-BEigA5Gj-By_dcUjB.mjs} +9 -7
- package/dist/descriptor-meta-BEigA5Gj-By_dcUjB.mjs.map +1 -0
- package/dist/{descriptor-meta-BOx9pvBv-C4TEXck8.mjs → descriptor-meta-DF0hODA0-DnO80XvH.mjs} +4 -4
- package/dist/{descriptor-meta-BOx9pvBv-C4TEXck8.mjs.map → descriptor-meta-DF0hODA0-DnO80XvH.mjs.map} +1 -1
- package/dist/{diff-database-schema-BP4uAPZZ-8ljuCPav.mjs → diff-database-schema-MYPfxeRf-DdgnOIIl.mjs} +17 -7
- package/dist/diff-database-schema-MYPfxeRf-DdgnOIIl.mjs.map +1 -0
- package/dist/{full-text-jDpkANi7.d.mts → full-text-Cth_mXe_.d.mts} +2 -2
- package/dist/{full-text-jDpkANi7.d.mts.map → full-text-Cth_mXe_.d.mts.map} +1 -1
- package/dist/{full-text-index-expression-PZszha7L-CW7i1TUY.mjs → full-text-index-expression-BM_vGygX-BOuja7X4.mjs} +3 -3
- package/dist/{full-text-index-expression-PZszha7L-CW7i1TUY.mjs.map → full-text-index-expression-BM_vGygX-BOuja7X4.mjs.map} +1 -1
- package/dist/{full-text-parsers-Dp_ANr31-DVxYUNS-.d.mts → full-text-parsers-CLZpb096-BN1xyHeO.d.mts} +3 -3
- package/dist/{full-text-parsers-Dp_ANr31-DVxYUNS-.d.mts.map → full-text-parsers-CLZpb096-BN1xyHeO.d.mts.map} +1 -1
- package/dist/{infer-psl-contract-MVBnqkl3-Bffp5RpV.mjs → infer-psl-contract-D7XJnfJv-Cd_Mf0UH.mjs} +78 -82
- package/dist/infer-psl-contract-D7XJnfJv-Cd_Mf0UH.mjs.map +1 -0
- package/dist/{issue-planner-D9rRu2pB.d.mts → issue-planner-C4iR-Ik-.d.mts} +2 -2
- package/dist/{issue-planner-D9rRu2pB.d.mts.map → issue-planner-C4iR-Ik-.d.mts.map} +1 -1
- package/dist/{migration-Du89zGmx.d.mts → migration-BTiY0PPC.d.mts} +3 -3
- package/dist/{migration-Du89zGmx.d.mts.map → migration-BTiY0PPC.d.mts.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/native-type-normalizer-BFo5tSyh.d.mts +37 -0
- package/dist/native-type-normalizer-BFo5tSyh.d.mts.map +1 -0
- package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs +102 -0
- package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs.map +1 -0
- package/dist/op-factory-call-Bi1XxJEv.d.mts +1 -0
- package/dist/{op-factory-call-t4k8mlRJ-BgtGXlIC.d.mts → op-factory-call-VLJFI-b_-Du23HNYc.d.mts} +5 -5
- package/dist/op-factory-call-VLJFI-b_-Du23HNYc.d.mts.map +1 -0
- package/dist/{op-factory-call-BBkvFvKK-7MkUHWJq.mjs → op-factory-call-y5YADY2E-CnhkIujC.mjs} +39 -26
- package/dist/op-factory-call-y5YADY2E-CnhkIujC.mjs.map +1 -0
- package/dist/{operation-types-DZyRBrnm.d.mts → operation-types-Cj4S6KNP.d.mts} +2 -2
- package/dist/{operation-types-DZyRBrnm.d.mts.map → operation-types-Cj4S6KNP.d.mts.map} +1 -1
- package/dist/{pack-B8SM_MTs.d.mts → pack-DO2bXv9P.d.mts} +3 -3
- package/dist/{pack-B8SM_MTs.d.mts.map → pack-DO2bXv9P.d.mts.map} +1 -1
- package/dist/{planner-Brs7-1mt-BFtbE0Tl.mjs → planner-DMVaXRSK-DCAGfALs.mjs} +6 -6
- package/dist/{planner-Brs7-1mt-BFtbE0Tl.mjs.map → planner-DMVaXRSK-DCAGfALs.mjs.map} +1 -1
- package/dist/{planner-o0_69Y9q.d.mts → planner-SLaWpf7q.d.mts} +2 -2
- package/dist/{planner-o0_69Y9q.d.mts.map → planner-SLaWpf7q.d.mts.map} +1 -1
- package/dist/{planner-ddl-builders-BQ_1YXut.d.mts → planner-ddl-builders-DYLyFXrj.d.mts} +2 -5
- package/dist/planner-ddl-builders-DYLyFXrj.d.mts.map +1 -0
- package/dist/{planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs → planner-ddl-builders-iE35pyxA-g7b_clbn.mjs} +6 -27
- package/dist/planner-ddl-builders-iE35pyxA-g7b_clbn.mjs.map +1 -0
- package/dist/planner-produced-postgres-migration-Bi_Otmtx.d.mts +1 -0
- package/dist/{planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs → planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs.map → planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-Xd83anY_-vp2DJ5fk.d.mts → planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.d.mts.map +1 -0
- package/dist/{planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs → planner-sql-checks-ZMXeCK6W-D1VMBywZ.mjs} +55 -15
- package/dist/planner-sql-checks-ZMXeCK6W-D1VMBywZ.mjs.map +1 -0
- package/dist/{postgres-contract-view-DxcRT-qe-LQBHHgaS.mjs → postgres-contract-view-BBMpf_qi-8V4vTm9U.mjs} +3 -3
- package/dist/{postgres-contract-view-DxcRT-qe-LQBHHgaS.mjs.map → postgres-contract-view-BBMpf_qi-8V4vTm9U.mjs.map} +1 -1
- package/dist/{postgres-migration-B7ihBnbW-DOmrgtms.d.mts → postgres-migration-B03W06rR-DTB0R3cj.d.mts} +4 -5
- package/dist/{postgres-migration-B7ihBnbW-DOmrgtms.d.mts.map → postgres-migration-B03W06rR-DTB0R3cj.d.mts.map} +1 -1
- package/dist/{postgres-migration-qwigEUIO-BWxjALsx.mjs → postgres-migration-UzDaU7Or-Dvc0Cdv5.mjs} +22 -5
- package/dist/postgres-migration-UzDaU7Or-Dvc0Cdv5.mjs.map +1 -0
- package/dist/{prisma7-binding-BRYHcWsx.mjs → prisma7-binding-D_Q6ou4j.mjs} +7 -6
- package/dist/prisma7-binding-D_Q6ou4j.mjs.map +1 -0
- package/dist/{prisma7-binding-1CMtcbOk.d.mts → prisma7-binding-c5vWJV6k.d.mts} +3 -3
- package/dist/{prisma7-binding-1CMtcbOk.d.mts.map → prisma7-binding-c5vWJV6k.d.mts.map} +1 -1
- package/dist/{runtime-aN2tMH8u.d.mts → runtime-Bm1hGqOh.d.mts} +2 -2
- package/dist/{runtime-aN2tMH8u.d.mts.map → runtime-Bm1hGqOh.d.mts.map} +1 -1
- package/dist/{sql-renderer-DmJ5aZwd.d.mts → sql-renderer-CfXWPuXU.d.mts} +4 -4
- package/dist/{sql-renderer-DmJ5aZwd.d.mts.map → sql-renderer-CfXWPuXU.d.mts.map} +1 -1
- package/dist/{sql-renderer-CgUgFbU4-CRUChEAY.mjs → sql-renderer-CgUgFbU4-DqTf31OD.mjs} +2 -2
- package/dist/{sql-renderer-CgUgFbU4-CRUChEAY.mjs.map → sql-renderer-CgUgFbU4-DqTf31OD.mjs.map} +1 -1
- package/dist/target.d.mts +23 -23
- package/dist/target.mjs +21 -22
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +3 -3
- package/dist/target__codecs.mjs +3 -4
- package/dist/target__control.d.mts +2 -2
- package/dist/target__control.mjs +3 -3
- package/dist/target__data-types.mjs +2 -2
- package/dist/target__default-normalizer.mjs +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__full-text.d.mts +2 -2
- package/dist/target__issue-planner.d.mts +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__native-type-normalizer.d.mts +2 -2
- package/dist/target__native-type-normalizer.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__operation-types.d.mts +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.d.mts +2 -2
- package/dist/target__planner-ddl-builders.mjs +2 -2
- package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner-sql-checks.mjs +1 -1
- package/dist/target__planner.d.mts +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 +2 -2
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__sql-utils.mjs +1 -1
- package/dist/{types-BPubHbiE-mnhvO20x.d.mts → types-BPubHbiE-SaR3Cngi.d.mts} +3 -3
- package/dist/{types-BPubHbiE-mnhvO20x.d.mts.map → types-BPubHbiE-SaR3Cngi.d.mts.map} +1 -1
- package/dist/types-DvEixgWS.d.mts +2 -0
- package/package.json +9 -9
- package/dist/codec-descriptor-BfoHQP3R-CMRVT-F6.mjs.map +0 -1
- package/dist/codec-descriptor-Cf1qfOwo.d.mts +0 -1
- package/dist/codec-descriptor-DUUGoeyI-WGLGXEoI.d.mts.map +0 -1
- package/dist/codec-types-BXbWuRzS.d.mts +0 -2
- package/dist/codecs-C4DVdgQG.mjs.map +0 -1
- package/dist/codecs-DQGmsnk3-H6nVRPCC.mjs.map +0 -1
- package/dist/control-CDRHOvkm.d.mts +0 -12
- package/dist/control-CDRHOvkm.d.mts.map +0 -1
- package/dist/control-DxJWBVjs.d.mts.map +0 -1
- package/dist/control-adapter-Buuq3v1c-DtBZerak.mjs.map +0 -1
- package/dist/control-policy-BYo5QPof-BLT07t1y.mjs.map +0 -1
- package/dist/control-w3p4NYNx.mjs.map +0 -1
- package/dist/data-types-Cl18KnNY-5I34Vd6Z.mjs.map +0 -1
- package/dist/default-normalizer-Bp3IhMR9-D0uYVRLZ.mjs.map +0 -1
- package/dist/descriptor-meta-F1wsOtt2-D014LIGM.mjs.map +0 -1
- package/dist/diff-database-schema-BP4uAPZZ-8ljuCPav.mjs.map +0 -1
- package/dist/infer-psl-contract-MVBnqkl3-Bffp5RpV.mjs.map +0 -1
- package/dist/native-type-normalizer-DqJlOTeX.d.mts +0 -19
- package/dist/native-type-normalizer-DqJlOTeX.d.mts.map +0 -1
- package/dist/native-type-normalizer-yvd3tqv-.mjs +0 -38
- package/dist/native-type-normalizer-yvd3tqv-.mjs.map +0 -1
- package/dist/op-factory-call-7Dtfo3GK.d.mts +0 -1
- package/dist/op-factory-call-BBkvFvKK-7MkUHWJq.mjs.map +0 -1
- package/dist/op-factory-call-t4k8mlRJ-BgtGXlIC.d.mts.map +0 -1
- package/dist/planner-ddl-builders-BQ_1YXut.d.mts.map +0 -1
- package/dist/planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-B0pwyA94.d.mts +0 -1
- package/dist/planner-produced-postgres-migration-Xd83anY_-vp2DJ5fk.d.mts.map +0 -1
- package/dist/planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs.map +0 -1
- package/dist/postgres-migration-qwigEUIO-BWxjALsx.mjs.map +0 -1
- package/dist/prisma7-binding-BRYHcWsx.mjs.map +0 -1
- package/dist/registry-ld2ZUt1j-CH85fY3r.mjs +0 -15
- package/dist/registry-ld2ZUt1j-CH85fY3r.mjs.map +0 -1
- package/dist/types-CS-qi6YZ.d.mts +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"control-w3p4NYNx.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/control.mjs"],"sourcesContent":["import { C as PG_TIMESTAMPTZ_DATE_CODEC_ID, D as PG_TIMESTAMP_TEMPORAL_CODEC_ID, E as PG_TIMESTAMP_STRING_CODEC_ID, S as PG_TEXT_CODEC_ID, T as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, s as PG_ENUM_CODEC_ID, w as PG_TIMESTAMPTZ_STRING_CODEC_ID } from \"./codec-ids-Cb0yO-IS.mjs\";\nimport { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { i as isPostgresCodecDescriptor } from \"./codec-descriptor-BfoHQP3R.mjs\";\nimport { M as setFallbackTemporal } from \"./codecs-DQGmsnk3.mjs\";\nimport { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { t as PostgresNativeEnum } from \"./postgres-native-enum-CdP3b_-R.mjs\";\nimport { n as parsePostgresListText, t as decodePostgresListText } from \"./list-decoder-DXee1orj.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-Bp3IhMR9.mjs\";\nimport { c as postgresNowGeneratorIdFor, d as plainDateTimeNowControlDescriptor, f as INSTANT_NOW_GENERATOR_ID, l as PLAIN_DATE_TIME_NOW_GENERATOR_ID, m as instantNowControlDescriptor, t as POLICY_BLOCK_KEYWORDS } from \"./authoring-BmQxOggr.mjs\";\nimport { _ as PostgresRlsPolicy, h as PostgresRole, v as PostgresRlsEnablement } from \"./postgres-schema-yugFGBdS.mjs\";\nimport { n as computeContentHash } from \"./canonicalize-CrN3u_xM.mjs\";\nimport { t as postgresRenderCheckExpressions } from \"./check-expressions-DLCs-SXx.mjs\";\nimport { t as postgresTargetDescriptorMeta } from \"./descriptor-meta-BOx9pvBv.mjs\";\nimport { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { n as diffPostgresSchema, r as contractToPostgresDatabaseSchemaNode } from \"./diff-database-schema-BP4uAPZZ.mjs\";\nimport { r as renderDefaultLiteral } from \"./planner-ddl-builders-GTcVPpwb.mjs\";\nimport { n as PostgresContractSerializer } from \"./postgres-contract-view-DxcRT-qe.mjs\";\nimport { t as createPostgresMigrationPlanner } from \"./planner-Brs7-1mt.mjs\";\nimport { a as buildIndexAttribute, c as SYNTHETIC_SPAN, d as namedArg, f as parseDefaultAttributeString, i as buildCheckAttribute, l as buildAttribute, m as createPostgresTypeMap, n as inferPostgresPslContract, o as buildModelConstraintAttribute, p as positionalArg, s as buildNativeEnumBlock, u as buildMapAttribute } from \"./infer-psl-contract-MVBnqkl3.mjs\";\nimport { escapePslString } from \"@internal/sql-relational-core/ast\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { StorageColumn } from \"@internal/sql-contract/types\";\nimport { buildDataTypeResolver, buildNativeTypeExpander, runnerFailure, runnerSuccess } from \"@internal/family-sql/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { Temporal } from \"temporal-polyfill/full/implementation\";\nimport { findAuthoringTypeConstructorCall } from \"@internal/framework-components/authoring\";\nimport { NAME_THE_PSL_SOURCE_LOSES, isPslIdentifier } from \"@internal/psl-parser\";\nimport { composeCheckWirePrefix, computeCheckContentHash, computeIndexContentHash, formatWireName } from \"@internal/sql-schema-ir/naming\";\nimport { assertDefined, invariant } from \"@internal/utils/assertions\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\nimport { SqlQueryError } from \"@internal/sql-errors\";\nimport { UNBOUND_PSL_NAMESPACE_NAME, UNSPECIFIED_PSL_NAMESPACE_ID, makePslNamespace, makePslNamespaceEntries } from \"@internal/framework-components/psl-ast\";\nimport { mapDefault } from \"@internal/family-sql/psl-build\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { pslFieldMapName, pslModelMapName } from \"@internal/sql-contract-psl/map-names\";\n//#region src/core/migrations/runner.ts\nconst LOCK_DOMAIN = \"prisma_8.contract.marker\";\n/**\n* Deep clones and freezes a record object to prevent mutation.\n* Recursively clones nested objects and arrays to ensure complete isolation.\n*/\nfunction cloneAndFreezeRecord(value) {\n\tconst cloned = {};\n\tfor (const [key, val] of Object.entries(value)) if (val === null || val === void 0) cloned[key] = val;\n\telse if (Array.isArray(val)) cloned[key] = Object.freeze([...val]);\n\telse if (typeof val === \"object\") cloned[key] = cloneAndFreezeRecord(blindCast(val));\n\telse cloned[key] = val;\n\treturn blindCast(Object.freeze(cloned));\n}\nfunction createPostgresMigrationRunner(family) {\n\treturn new PostgresMigrationRunner(family);\n}\nvar PostgresMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Body of the migration runner without transaction management. The\n\t* caller ({@link PostgresMigrationRunner.execute}) owns the\n\t* `BEGIN`/`COMMIT`/`ROLLBACK` lifecycle.\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst schema = options.schemaName ?? Object.keys(options.destinationContract.storage.namespaces).find((id) => id !== UNBOUND_NAMESPACE_ID) ?? UNBOUND_NAMESPACE_ID;\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw postgresError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst lockKey = `${LOCK_DOMAIN}:${schema}:${space}`;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tawait this.acquireLock(driver, lockKey);\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet applyValue;\n\t\tif (skipOperations) applyValue = {\n\t\t\toperationsExecuted: 0,\n\t\t\texecutedOperations: []\n\t\t};\n\t\telse {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\tapplyValue = applyResult.value;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = this.family.verifySchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tschema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants ?? [];\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && applyValue.operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, applyValue.executedOperations, planOps.length);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted: applyValue.operationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tawait this.beginTransaction(driver);\n\t\tlet committed = false;\n\t\ttry {\n\t\t\tconst perSpaceResults = [];\n\t\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t\t...spaceOptions,\n\t\t\t\t\tdriver,\n\t\t\t\t\tspace\n\t\t\t\t});\n\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t...result.failure,\n\t\t\t\t\tfailingSpace: space\n\t\t\t\t});\n\t\t\t\tperSpaceResults.push({\n\t\t\t\t\tspace,\n\t\t\t\t\tvalue: result.value\n\t\t\t\t});\n\t\t\t}\n\t\t\tawait this.commitTransaction(driver);\n\t\t\tcommitted = true;\n\t\t\treturn ok({ perSpaceResults });\n\t\t} finally {\n\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t}\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createPostcheckPreSatisfiedSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation);\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\");\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst lowererContext = { contract };\n\t\tconst [schemaQuery, ...tableQueries] = this.family.bootstrapControlTableQueries();\n\t\tif (schemaQuery === void 0) throw new InternalError(\"Postgres control-table bootstrap must include CREATE SCHEMA\");\n\t\tawait this.executeStatement(driver, await this.family.lowerAst(schemaQuery, lowererContext));\n\t\tconst legacyDetection = await this.detectLegacyMarkerShape(driver);\n\t\tif (!legacyDetection.ok) return legacyDetection;\n\t\tfor (const query of tableQueries) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync detectLegacyMarkerShape(driver) {\n\t\tconst result = await driver.query(`select column_name\n from information_schema.columns\n where table_schema = 'prisma_contract'\n and table_name = 'marker'`);\n\t\tif (result.rows.length === 0) return okVoid();\n\t\tconst columns = new Set(result.rows.map((row) => row.column_name));\n\t\tif (columns.has(\"space\")) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.LEGACY_MARKER_SHAPE\", \"Legacy marker-table shape detected on prisma_contract.marker (no `space` column). Prisma 8 is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop `prisma_contract.marker` and re-run `dbInit` to reinitialise from a clean baseline.\", { meta: {\n\t\t\ttable: \"prisma_contract.marker\",\n\t\t\tcolumns: [...columns].sort()\n\t\t} });\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tstepDescription: step.description\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync runExecuteSteps(driver, steps, operation) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tif (SqlQueryError.is(error)) return runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: error.message,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql,\n\t\t\t\t\tsqlState: error.sqlState,\n\t\t\t\t\tconstraint: error.constraint,\n\t\t\t\t\ttable: error.table,\n\t\t\t\t\tcolumn: error.column,\n\t\t\t\t\tdetail: error.detail\n\t\t\t\t}\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t\treturn okVoid();\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"t\" || lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"f\" || lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreatePostcheckPreSatisfiedSkipRecord(operation) {\n\t\tconst clonedMeta = operation.meta ? cloneAndFreezeRecord(operation.meta) : void 0;\n\t\tconst runnerMeta = Object.freeze({\n\t\t\tskipped: true,\n\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t});\n\t\tconst mergedMeta = Object.freeze({\n\t\t\t...clonedMeta ?? {},\n\t\t\trunner: runnerMeta\n\t\t});\n\t\tconst frozenPostcheck = Object.freeze([...operation.postcheck]);\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: frozenPostcheck,\n\t\t\t...ifDefined(\"meta\", operation.meta || mergedMeta ? mergedMeta : void 0)\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) return runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\tspace,\n\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations, planOpsLength) {\n\t\tconst space = options.plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== planOpsLength) throw new InternalError(`Ledger write: plan.operations length (${planOpsLength}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps,\n\t\t\t\t\t...ifDefined(\"destinationContractJson\", edge.destinationContractJson)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync acquireLock(driver, key) {\n\t\tawait driver.query(\"select pg_advisory_xact_lock(hashtext($1))\", [key]);\n\t}\n\tasync beginTransaction(driver) {\n\t\tawait driver.query(\"BEGIN\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/postgres-schema-verifier.ts\n/**\n* Postgres target `SchemaVerifier` concretion. Plugs into the\n* SQL-shared verification surface; production verification today still\n* routes through the family verify verdict (`verifySqlSchemaByDiff` over\n* `diffPostgresSchema`), which carries options (codec hooks,\n* normalizers, framework components) that the framework-level\n* `SchemaVerifyOptions` shape does not yet surface.\n*\n* The hooks return the empty list pending the call-site migration that\n* routes the existing verifier behaviour through the SPI — at that\n* point `verifyCommonSqlSchema` will likely lift onto the family base\n* (mirroring `verifyCommonMongoSchema`) and `verifyTargetExtensions`\n* will house Postgres-only kinds (functions, RLS policies in a future\n* project).\n*/\nvar PostgresSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/psl-print/contract-model-index.ts\n/** The name a contract namespace is written under in PSL. */\nfunction pslNamespaceName(namespaceId) {\n\treturn namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_PSL_NAMESPACE_NAME : namespaceId;\n}\nfunction modelCoordinate(namespaceId, modelName) {\n\treturn JSON.stringify([namespaceId, modelName]);\n}\n/**\n* Every domain model of the contract, in declaration order, with its storage table. Contract\n* validation has checked that each model's table exists, in the namespace of the model.\n*/\nfunction indexContractModels(contract) {\n\tconst entries = [];\n\tfor (const [namespaceId, domainNamespace] of Object.entries(contract.domain.namespaces)) for (const [name, model] of Object.entries(domainNamespace.models)) {\n\t\tconst storage = blindCast(model.storage);\n\t\tconst table = contract.storage.namespaces[storage.namespaceId]?.entries.table?.[storage.table];\n\t\tassertDefined(table, `model \"${namespaceId}.${name}\" is stored in table \"${storage.namespaceId}\".\"${storage.table}\", which the storage does not declare`);\n\t\tconst fields = Object.entries(storage.fields);\n\t\tentries.push({\n\t\t\tnamespaceId: storage.namespaceId,\n\t\t\tname,\n\t\t\ttableName: storage.table,\n\t\t\tstorage,\n\t\t\tmodel,\n\t\t\ttable,\n\t\t\tfieldNamesByColumn: new Map(fields.map(([fieldName, field]) => [field.column, fieldName])),\n\t\t\townColumns: new Set(fields.map(([, field]) => field.column))\n\t\t});\n\t}\n\treturn entries;\n}\n/** Models keyed by their `(namespace, model)` coordinate. */\nfunction modelsByCoordinate(entries) {\n\treturn new Map(entries.map((entry) => [modelCoordinate(entry.namespaceId, entry.name), entry]));\n}\n/** A cross reference's coordinate; one into another contract space never matches a model of this contract. */\nfunction crossReferenceCoordinate(reference) {\n\treturn reference.space === void 0 ? modelCoordinate(reference.namespace, reference.model) : JSON.stringify([\n\t\treference.space,\n\t\treference.namespace,\n\t\treference.model\n\t]);\n}\n/** The base a variant model extends, with the discriminator value it is stored under. */\nfunction variantInfo(entry, byCoordinate) {\n\tif (entry.model.base === void 0) return void 0;\n\tconst base = byCoordinate.get(crossReferenceCoordinate(entry.model.base));\n\tconst value = base?.model.variants?.[entry.name]?.value;\n\tassertDefined(base, `model \"${entry.namespaceId}.${entry.name}\" extends a base the contract does not declare`);\n\tassertDefined(value, `model \"${entry.namespaceId}.${entry.name}\" extends base \"${base.name}\", which does not list it as a variant`);\n\treturn {\n\t\tbase,\n\t\tvalue,\n\t\tsingleTable: base.namespaceId === entry.namespaceId && base.tableName === entry.tableName\n\t};\n}\n/** The columns the PSL source adds to a multi-table variant's table: its base's primary key. */\nfunction variantLinkColumns(entry, variant) {\n\tif (variant === void 0 || variant.singleTable) return [];\n\treturn (variant.base.table.primaryKey?.columns ?? []).filter((column) => !entry.ownColumns.has(column));\n}\n/**\n* The foreign key the PSL source synthesizes from a multi-table variant to its base: unnamed, over\n* the base's primary key columns, cascading on delete.\n*/\nfunction isVariantLinkForeignKey(fk, variant) {\n\tif (variant === void 0 || variant.singleTable) return false;\n\tconst baseKey = canonicalizeJson(variant.base.table.primaryKey?.columns ?? []);\n\treturn fk.target.namespaceId === variant.base.namespaceId && fk.target.tableName === variant.base.tableName && fk.target.spaceId === void 0 && canonicalizeJson(fk.source.columns) === baseKey && canonicalizeJson(fk.target.columns) === baseKey && fk.name === void 0 && fk.onDelete === \"cascade\" && fk.onUpdate === void 0;\n}\n//#endregion\n//#region src/core/psl-print/refusals.ts\nconst KEEP_SOURCE = \"Keep authoring this contract in its current source.\";\nfunction unsupported(message, why, fix, meta) {\n\treturn postgresError(\"CONTRACT.PRINT_UNSUPPORTED\", `contract print: ${message}`, {\n\t\twhy,\n\t\tfix,\n\t\tmeta\n\t});\n}\nfunction sameJson(left, right) {\n\treturn canonicalizeJson(left) === canonicalizeJson(right);\n}\nfunction sameValues$1(left, right) {\n\treturn left.length === right.length && left.every((value, index) => value === right[index]);\n}\nfunction refuseColumnWithoutPslType(column, coordinate) {\n\tthrow unsupported(`column ${coordinate} has native type \"${column.nativeType}\" with codec \"${column.codecId}\", and no PSL type in the configured stack produces that pair.`, \"A column is written as a PSL type that reads back with its codec and native type, and none of the types the target, adapter and extensions contribute does.\", \"Add the extension that contributes this type to the config, or keep authoring this contract in its current source.\", {\n\t\tcoordinate,\n\t\tnativeType: column.nativeType,\n\t\tcodecId: column.codecId\n\t});\n}\n/**\n* Refuses a string type argument the PSL source would read back differently: it reads a string\n* argument between its quotes as written, with no escapes.\n*/\nfunction refuseUnwritableTypeArgument(value, coordinate) {\n\tif (escapePslString(value) === value) return;\n\tthrow unsupported(`column ${coordinate} takes the type argument ${JSON.stringify(value)}, which a PSL type argument cannot carry.`, \"The PSL source reads a string type argument as written between its quotes, with no escapes, so a quote, backslash or line break in it would read back differently.\", KEEP_SOURCE, {\n\t\tcoordinate,\n\t\targument: value\n\t});\n}\nfunction refuseDefaultOutsideEnum(input) {\n\tthrow unsupported(`column ${input.coordinate} defaults to ${JSON.stringify(input.value)}, which is not a member of enum ${input.pslTypeName}.`, \"A default on a domain enum column is written as the member name, and no member carries this value.\", \"Give the column a default that is one of the enum members, or drop it.\", {\n\t\tcoordinate: input.coordinate,\n\t\tpslTypeName: input.pslTypeName\n\t});\n}\nfunction refuseUnwritableLiteralDefault(input) {\n\tthrow unsupported(`column ${input.coordinate} has a default that cannot be written in Prisma 8 PSL: no data type the ${input.pslTypeName} type takes writes ${input.written}.`, \"Writing the value in any other form would parse, but the PSL source would read it back as a different value.\", \"Replace the default with a database expression default, or drop the default before printing.\", {\n\t\tcoordinate: input.coordinate,\n\t\tpslTypeName: input.pslTypeName\n\t});\n}\nfunction refuseNowGeneratorPairedWithAnother(phases) {\n\tthrow unsupported(`column ${phases.coordinate} takes the wall-clock-now generator in one phase and \"${phases.other}\" in the other, which cannot be written in Prisma 8 PSL.`, \"The temporal preset a now generator is authored through writes each phase as `now`, so the other generator would be dropped from the written file.\", KEEP_SOURCE, {\n\t\tcoordinate: phases.coordinate,\n\t\tonCreate: phases.onCreate,\n\t\tonUpdate: phases.onUpdate\n\t});\n}\nfunction refuseGeneratorOnUpdate(phases) {\n\tthrow unsupported(`column ${phases.coordinate} generates a value on update (\"${phases.onUpdate}\"), which cannot be written in Prisma 8 PSL.`, \"`@default(…)` writes a generator for create only; a generator on update is written only through a temporal preset, which takes the wall-clock-now generator.\", KEEP_SOURCE, {\n\t\tcoordinate: phases.coordinate,\n\t\tonCreate: phases.onCreate,\n\t\tonUpdate: phases.onUpdate\n\t});\n}\nfunction refuseGeneratorWithoutPslFunction(phases) {\n\tthrow unsupported(`column ${phases.coordinate} is generated by \"${phases.onCreate}\", and the printer knows no PSL default function that produces it.`, \"The printer writes each generator as the PSL default function of the Postgres adapter that produces it, and no such function produces this generator.\", KEEP_SOURCE, {\n\t\tcoordinate: phases.coordinate,\n\t\tonCreate: phases.onCreate,\n\t\tonUpdate: phases.onUpdate\n\t});\n}\nfunction refuseGeneratorWithDatabaseDefault(input) {\n\tthrow unsupported(`column ${input.coordinate} has both a generated value (\"${input.onCreate}\") and a database default, which cannot be written in Prisma 8 PSL.`, \"`@default(…)` writes either the generator or the database default, so the other would be lost.\", \"Drop one of the two, or keep authoring this contract in its current source.\", {\n\t\tcoordinate: input.coordinate,\n\t\tonCreate: input.onCreate\n\t});\n}\n/** Refuses a generated value the printer did not write with the field of its column. */\nfunction refuseUnwrittenExecutionDefaults(contract, written) {\n\tfor (const entry of contract.execution?.mutations.defaults ?? []) {\n\t\tif (written.has(entry)) continue;\n\t\tconst coordinate = `\"${entry.ref.namespace}\".\"${entry.ref.entry}\".\"${entry.ref.field}\"`;\n\t\tthrow unsupported(`a generated value names column ${coordinate}, which no field is stored in, so it cannot be written in Prisma 8 PSL.`, \"PSL writes a generated value on the field stored in its column.\", KEEP_SOURCE, { coordinate });\n\t}\n}\n/**\n* The value-set references the PSL source gives a field typed by a domain enum and its column: the\n* column names the enum's value set, and a field that is not a list names the enum, both in the\n* default namespace. A field with no domain enum has neither.\n*/\nfunction derivedValueSetRefs(enumName, list) {\n\tif (enumName === void 0) return {\n\t\tfield: void 0,\n\t\tcolumn: void 0\n\t};\n\tconst common = {\n\t\tnamespaceId: DEFAULT_NAMESPACE_ID,\n\t\tentityName: enumName\n\t};\n\treturn {\n\t\tfield: list ? void 0 : {\n\t\t\tplane: \"domain\",\n\t\t\tentityKind: \"enum\",\n\t\t\t...common\n\t\t},\n\t\tcolumn: {\n\t\t\tplane: \"storage\",\n\t\t\tentityKind: \"valueSet\",\n\t\t\t...common\n\t\t}\n\t};\n}\n/**\n* Refuses a field whose column the PSL source would not derive from it: PSL writes the field once,\n* and the PSL source derives the column's nullability, list marker, codec and type parameters from\n* what is written.\n*/\nfunction refuseFieldColumnMismatch(input) {\n\tconst { field, column, coordinate } = input;\n\tconst fix = \"Make the field and its column agree, or keep authoring this contract in its current source.\";\n\tif (input.singleTableVariant && !column.nullable) throw unsupported(`column ${coordinate} of single-table variant \"${input.modelName}\" is not nullable, which cannot be written in Prisma 8 PSL.`, \"The PSL source makes every column of a single-table variant nullable, because the base's other rows leave it empty.\", fix, { coordinate });\n\tif (!input.singleTableVariant && field.nullable !== column.nullable) throw unsupported(`field ${coordinate} is ${field.nullable ? \"optional\" : \"required\"} but its column is ${column.nullable ? \"nullable\" : \"not nullable\"}, which cannot be written in Prisma 8 PSL.`, \"PSL writes `?` once, and the PSL source derives the column from the field.\", fix, { coordinate });\n\tif ((field.type.kind === \"scalar\" && field.many === true) !== (column.many === true)) throw unsupported(`field ${coordinate} is ${field.many === true ? \"a list\" : \"not a list\"} but its column is ${column.many === true ? \"a list\" : \"not a list\"}, which cannot be written in Prisma 8 PSL.`, \"PSL writes `[]` once: the PSL source stores a list of scalars in a list column, and a list of value objects in one JSON column.\", fix, { coordinate });\n\tif (field.type.kind === \"scalar\" && (field.type.codecId !== column.codecId || !sameJson(field.type.typeParams, column.typeParams))) throw unsupported(`field ${coordinate} has a different codec or type parameters from its column, which cannot be written in Prisma 8 PSL.`, \"The PSL source derives a scalar field's codec and type parameters from its column.\", fix, { coordinate });\n\tif (field.type.kind !== \"scalar\" || column.codecId === \"pg/enum@1\") return;\n\tconst enumName = column.valueSet?.entityName;\n\tconst derived = derivedValueSetRefs(enumName, field.many === true);\n\tif (!sameJson(field.valueSet, derived.field) || !sameJson(column.valueSet, derived.column) || enumName !== void 0 && !input.domainEnumNames.has(enumName)) throw unsupported(`field ${coordinate} and its column do not name the enum of the default namespace and its value set that the PSL source derives for a field typed by an enum, which cannot be written in Prisma 8 PSL.`, \"PSL types the field by the enum name, and the PSL source then points the column at the value set of that enum in the default namespace, and a field that is not a list at the enum.\", fix, { coordinate });\n}\n/**\n* Refuses a field PSL has no form for: one whose type is a union of types, or one that is a\n* dictionary. Runs for model fields and value-object fields alike.\n*/\nfunction refuseUnwritableFieldShape(field, coordinate) {\n\tif (field.type.kind === \"union\") throw unsupported(`field ${coordinate} has a ${field.type.kind} type, which cannot be written in Prisma 8 PSL.`, \"A PSL field names one scalar, enum, or value-object type; a union of types has no PSL form.\", \"Give the field a single type, or keep authoring this contract in its current source.\", {\n\t\tcoordinate,\n\t\tkind: field.type.kind\n\t});\n\tif (field.dict !== true) return;\n\tthrow unsupported(`field ${coordinate} is a dictionary, which cannot be written in Prisma 8 PSL.`, \"PSL writes a field as one value or a list; it has no form for a keyed dictionary.\", KEEP_SOURCE, { coordinate });\n}\n/**\n* Refuses a value-object field with type parameters or a value set: the PSL source keeps only the\n* codec of a value-object field's type, so either would be lost.\n*/\nfunction refuseValueObjectFieldPartsTheSourceDrops(field, coordinate) {\n\tif (Object.keys(field.type.typeParams ?? {}).length === 0 && field.valueSet === void 0) return;\n\tthrow unsupported(`value-object field ${coordinate} carries type parameters or a value set, which cannot be written in Prisma 8 PSL.`, \"The PSL source keeps only the codec of a value-object field's type, so its type parameters and value set would be lost.\", KEEP_SOURCE, { coordinate });\n}\nfunction refuseValueObjectFieldCodecWithoutNativeType(codecId, coordinate) {\n\tthrow unsupported(`field ${coordinate} uses codec \"${codecId}\", which no Postgres codec in the configured stack names a native type for.`, \"A value-object field has no storage column, so its PSL type is derived from the native type its codec names.\", KEEP_SOURCE, {\n\t\tcoordinate,\n\t\tcodecId\n\t});\n}\nfunction refuseValueObjectFieldCodecNeedingTypeParameters(codecId, coordinate) {\n\tthrow unsupported(`field ${coordinate} uses codec \"${codecId}\", which names a native type only from type parameters, and the PSL source keeps none on a value-object field.`, \"The PSL source keeps only the codec of a value-object field's type, so a codec that needs type parameters cannot be written there.\", KEEP_SOURCE, {\n\t\tcoordinate,\n\t\tcodecId\n\t});\n}\n/** Refuses a model field its storage does not store in a column. */\nfunction refuseFieldsWithoutColumn(entry) {\n\tconst storedFieldNames = new Set(Object.keys(entry.storage.fields));\n\tfor (const fieldName of Object.keys(entry.model.fields)) {\n\t\tif (storedFieldNames.has(fieldName)) continue;\n\t\tthrow unsupported(`field \"${entry.namespaceId}.${entry.name}.${fieldName}\" is stored in no column, so it cannot be written in Prisma 8 PSL.`, \"PSL declares a scalar or value-object field together with the column it is stored in.\", \"The contract source produced a field without storage. Fix the field if the source is a TypeScript contract; otherwise report the bug to the source that produced it.\", {\n\t\t\tnamespaceId: entry.namespaceId,\n\t\t\tmodelName: entry.name,\n\t\t\tfield: fieldName\n\t\t});\n\t}\n}\n/** Refuses a column a model stores under a field name the model does not declare. */\nfunction refuseStorageOfUndeclaredField(input) {\n\tconst { entry, fieldName } = input;\n\tthrow unsupported(`model \"${entry.namespaceId}.${entry.name}\" stores \"${fieldName}\" in column ${input.coordinate}, but the model has no field of that name, so it cannot be written in Prisma 8 PSL.`, \"PSL declares a field together with the column it is stored in.\", \"Declare the field on the model, or keep authoring this contract in its current source.\", {\n\t\tnamespaceId: entry.namespaceId,\n\t\tmodelName: entry.name,\n\t\tfield: fieldName\n\t});\n}\n/**\n* Refuses a column typed by a named type when the contract declares no such type, or when the\n* column's native type or codec is not the named type's. PSL writes the column as the name of the\n* type, and the PSL source copies both from the named type.\n*/\nfunction refuseColumnDifferingFromNamedType(input) {\n\tconst { column, typeRef, namedType, coordinate } = input;\n\tif (namedType?.nativeType === column.nativeType && namedType.codecId === column.codecId) return;\n\tthrow unsupported(namedType === void 0 ? `column ${coordinate} is typed by the named type \"${typeRef}\", which the contract does not declare, so it cannot be written in Prisma 8 PSL.` : `column ${coordinate} is typed by the named type \"${typeRef}\" but has a different native type or codec from it, which cannot be written in Prisma 8 PSL.`, \"PSL writes such a column as the name of its named type, and the PSL source gives the column the native type and codec of that named type.\", \"Make the column and its named type agree, or keep authoring this contract in its current source.\", {\n\t\tcoordinate,\n\t\ttypeRef\n\t});\n}\nfunction refuseColumnControl(column, coordinate) {\n\tif (column.control === void 0) return;\n\tthrow unsupported(`column ${coordinate} carries its own control policy \"${column.control}\", which cannot be written in Prisma 8 PSL.`, \"PSL declares a control policy per model with `@@control`; a field has no control attribute.\", \"Move the policy to the model, or keep authoring this contract in its current source.\", {\n\t\tcoordinate,\n\t\tcontrol: column.control\n\t});\n}\n/** Refuses a storage table no model is stored in, and a column no field or variant link stores. */\nfunction refuseUnmodelledTablesAndColumns(contract, models, variants) {\n\tconst tableKey = (namespaceId, tableName) => JSON.stringify([namespaceId, tableName]);\n\tconst coveredColumns = /* @__PURE__ */ new Map();\n\tfor (const entry of models) {\n\t\tconst key = tableKey(entry.namespaceId, entry.tableName);\n\t\tconst columns = coveredColumns.get(key) ?? /* @__PURE__ */ new Set();\n\t\tfor (const column of entry.ownColumns) columns.add(column);\n\t\tfor (const column of variantLinkColumns(entry, variants.get(entry))) columns.add(column);\n\t\tcoveredColumns.set(key, columns);\n\t}\n\tfor (const [namespaceId, namespace] of Object.entries(contract.storage.namespaces)) for (const [tableName, table] of Object.entries(namespace.entries.table ?? {})) {\n\t\tconst covered = coveredColumns.get(tableKey(namespaceId, tableName));\n\t\tif (covered === void 0) throw unsupported(`table \"${namespaceId}\".\"${tableName}\" has no model stored in it, so it cannot be written in Prisma 8 PSL.`, \"PSL declares a table through the model stored in it.\", \"Declare a model for the table, or keep authoring this contract in its current source.\", {\n\t\t\tnamespaceId,\n\t\t\ttable: tableName\n\t\t});\n\t\tfor (const column of Object.keys(table.columns)) {\n\t\t\tif (covered.has(column)) continue;\n\t\t\tthrow unsupported(`column \"${namespaceId}\".\"${tableName}\".\"${column}\" is not stored by any field, so it cannot be written in Prisma 8 PSL.`, \"PSL declares a column through the field stored in it; the only columns the PSL source adds are the primary key columns that link a multi-table variant to its base.\", \"Add a field for the column, or keep authoring this contract in its current source.\", {\n\t\t\t\tnamespaceId,\n\t\t\t\ttable: tableName,\n\t\t\t\tcolumn\n\t\t\t});\n\t\t}\n\t}\n}\nfunction refuseModelOwner(entry) {\n\tif (entry.model.owner === void 0) return;\n\tthrow unsupported(`model \"${entry.namespaceId}.${entry.name}\" is owned by \"${entry.model.owner}\", which cannot be written in Prisma 8 PSL.`, \"`owner` names the model this model is embedded in, and SQL PSL has no syntax for an owned model.\", KEEP_SOURCE, {\n\t\tnamespaceId: entry.namespaceId,\n\t\tmodelName: entry.name,\n\t\towner: entry.model.owner\n\t});\n}\n/**\n* Refuses a multi-table variant whose link to its base differs from the one the PSL source derives:\n* the base's primary key columns copied into the variant's table as its unnamed primary key, and\n* the link foreign key.\n*/\nfunction refuseUnderivedVariantLink(entry, variant) {\n\tconst baseKey = variant.base.table.primaryKey?.columns ?? [];\n\tconst derivedKey = baseKey.length === 0 ? void 0 : { columns: baseKey };\n\tconst linkColumnsMatch = variantLinkColumns(entry, variant).every((column) => {\n\t\tconst base = variant.base.table.columns[column];\n\t\tconst expected = base === void 0 ? void 0 : new StorageColumn({\n\t\t\tnativeType: base.nativeType,\n\t\t\tcodecId: base.codecId,\n\t\t\tnullable: false,\n\t\t\t...ifDefined(\"typeParams\", base.typeParams),\n\t\t\t...ifDefined(\"typeRef\", base.typeRef)\n\t\t});\n\t\treturn sameJson(entry.table.columns[column], expected);\n\t});\n\tconst linkForeignKeys = entry.table.foreignKeys.filter((fk) => isVariantLinkForeignKey(fk, variant));\n\tif (linkColumnsMatch && sameJson(entry.table.primaryKey, derivedKey) && linkForeignKeys.length === (baseKey.length === 0 ? 0 : 1)) return;\n\tthrow unsupported(`multi-table variant \"${entry.namespaceId}.${entry.name}\" is linked to its base \"${variant.base.name}\" differently from the link the PSL source derives, so it cannot be written in Prisma 8 PSL.`, \"The PSL source links a multi-table variant to its base itself: it copies the base's primary key columns into the variant's table as its unnamed primary key, and adds an unnamed foreign key over them to the base that cascades on delete.\", KEEP_SOURCE, {\n\t\tnamespaceId: entry.namespaceId,\n\t\tmodelName: entry.name\n\t});\n}\n/**\n* The PSL source groups relations by bare model name, so two models with the same name in\n* different namespaces would get each other's relations.\n*/\nfunction refuseDuplicateModelNames(models) {\n\tconst namespacesByName = /* @__PURE__ */ new Map();\n\tfor (const entry of models) {\n\t\tconst namespaces = namespacesByName.get(entry.name) ?? [];\n\t\tnamespaces.push(entry.namespaceId);\n\t\tnamespacesByName.set(entry.name, namespaces);\n\t}\n\tfor (const [name, namespaces] of namespacesByName) {\n\t\tif (namespaces.length <= 1) continue;\n\t\tthrow unsupported(`model \"${name}\" is declared in more than one namespace (${namespaces.join(\", \")}), which Prisma 8 PSL cannot carry: the PSL source groups relations by bare model name.`, \"The PSL source groups relations by bare model name, so when the file is read back the two models would get each other's relations.\", \"Rename one of the models, then print again.\", {\n\t\t\tmodelName: name,\n\t\t\tnamespaces\n\t\t});\n\t}\n}\n/**\n* A PSL `enum` block is declared at the top level and lands in the default namespace, so only the\n* default namespace's domain enums have a PSL form.\n*/\nfunction refuseEnumsOutsideDefaultNamespace(contract) {\n\tfor (const [namespaceId, domainNamespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst names = Object.keys(domainNamespace.enum ?? {});\n\t\tif (namespaceId === \"public\" || names.length === 0) continue;\n\t\tthrow unsupported(`namespace \"${namespaceId}\" declares the enum${names.length === 1 ? \"\" : \"s\"} ${names.join(\", \")}, which cannot be written in Prisma 8 PSL: an enum block is declared at the top level and belongs to the default namespace.`, \"The PSL source refuses an enum block inside a namespace block, so an enum outside the default namespace has no PSL form.\", \"Move the enum to the default namespace, or keep authoring this contract in its current source.\", {\n\t\t\tnamespaceId,\n\t\t\tnames\n\t\t});\n\t}\n}\n/** The PSL source reads every `type` block into the default namespace. */\nfunction refuseValueObjectsOutsideDefaultNamespace(contract, namespaceId) {\n\tconst names = Object.keys(contract.domain.namespaces[namespaceId]?.valueObjects ?? {});\n\tif (namespaceId === \"public\" || names.length === 0) return;\n\tthrow unsupported(`namespace \"${namespaceId}\" declares the value object${names.length === 1 ? \"\" : \"s\"} ${names.join(\", \")}, which cannot be written in Prisma 8 PSL: the PSL source reads every value object into the default namespace.`, \"A `type` block written in any namespace reads back into the default namespace, so the value object would move.\", \"Move the value object to the default namespace, or keep authoring this contract in its current source.\", {\n\t\tnamespaceId,\n\t\tnames\n\t});\n}\n/**\n* Refuses a check or index whose name is neither its prefix followed by the hash of its content,\n* which `name:` derives, nor free of a prefix, which `map:` needs.\n*/\nfunction refuseUnwritableObjectName(input) {\n\tconst { kind, entry, name, prefix } = input;\n\tthrow unsupported(`${kind} \"${name}\" on \"${entry.namespaceId}\".\"${entry.tableName}\" has the prefix \"${prefix}\", but its name is not that prefix followed by the hash of its ${kind === \"check\" ? \"expression\" : \"content\"}, so it cannot be written in Prisma 8 PSL.`, `\\`name:\\` makes the PSL source derive the name from the prefix and that hash, and \\`map:\\` writes an exact name with no prefix, so neither reads back as this ${kind}.`, KEEP_SOURCE, {\n\t\tnamespaceId: entry.namespaceId,\n\t\ttable: entry.tableName,\n\t\tname,\n\t\tprefix\n\t});\n}\n/**\n* Refuses a table whose checks differ from the derived ones where they overlap: a derived check the\n* table lacks, or a check with a derived check's name but not its prefix and expression. The PSL\n* source adds the derived checks itself, so they are never written.\n*/\nfunction refuseUnderivedChecks(entry, derived) {\n\tconst checks = new Map((entry.table.checks ?? []).map((check) => [check.name, check]));\n\tfor (const [name, expected] of derived) {\n\t\tconst check = checks.get(name);\n\t\tif (check?.prefix === expected.prefix && check.expression === expected.expression) continue;\n\t\tthrow unsupported(`table \"${entry.namespaceId}\".\"${entry.tableName}\" ${check === void 0 ? \"lacks\" : \"changes\"} the check \"${name}\" the PSL source derives, so it cannot be written in Prisma 8 PSL.`, \"The PSL source derives a membership check for each column of a managed table typed by an enum, and an element-not-null check for each list column, unless the column waives it with `@noCheck`.\", KEEP_SOURCE, {\n\t\t\tnamespaceId: entry.namespaceId,\n\t\t\ttable: entry.tableName,\n\t\t\tname\n\t\t});\n\t}\n}\n/**\n* Refuses index options PSL cannot write: `options:` takes string values under identifier keys,\n* and requires a `type`.\n*/\nfunction refuseUnwritableIndexOptions(entry, index) {\n\tconst meta = {\n\t\tnamespaceId: entry.namespaceId,\n\t\ttable: entry.tableName,\n\t\tindex: index.name\n\t};\n\tif (index.options !== void 0 && index.type === void 0) throw unsupported(`index \"${index.name}\" on \"${entry.namespaceId}\".\"${entry.tableName}\" has options but no type, which cannot be written in Prisma 8 PSL.`, \"The PSL source reads `options:` on an index only together with `type:`.\", \"Give the index a type, or keep authoring this contract in its current source.\", meta);\n\tfor (const [key, value] of Object.entries(index.options ?? {})) {\n\t\trefuseUnwritableName(\"index option\", key);\n\t\tif (typeof value === \"string\") continue;\n\t\tthrow unsupported(`index \"${index.name}\" on \"${entry.namespaceId}\".\"${entry.tableName}\" has option \"${key}\" whose value is not a string, which cannot be written in Prisma 8 PSL.`, \"The PSL `options:` argument takes string values only, and reads every value back as a string.\", \"Write the option value as a string, or keep authoring this contract in its current source.\", {\n\t\t\t...meta,\n\t\t\tkey\n\t\t});\n\t}\n}\nfunction refuseToOneRelationWithoutForeignKey(modelName, fieldName) {\n\tthrow unsupported(`relation \"${modelName}.${fieldName}\" has no foreign key in storage, which Prisma 8 PSL cannot express.`, \"A to-one relation is authored as `@relation(fields:…, references:…)`, which always lowers to a foreign key.\", \"Declare a foreign key for the relation, or keep authoring this contract in its current source.\", {\n\t\tmodel: modelName,\n\t\tfield: fieldName\n\t});\n}\n/**\n* A foreign key no relation travels has no PSL form: the PSL source derives every foreign key from\n* a `@relation`, so this one would be lost.\n*/\nfunction refuseUntravelledForeignKeys(entry, variant, travelled) {\n\tfor (const fk of entry.table.foreignKeys) {\n\t\tif (travelled.has(fk) || isVariantLinkForeignKey(fk, variant)) continue;\n\t\tif (variant?.singleTable === true && !fk.source.columns.every((c) => entry.ownColumns.has(c))) continue;\n\t\tthrow unsupported(`table \"${entry.namespaceId}\".\"${entry.tableName}\" has a foreign key on (${fk.source.columns.join(\", \")}) that no relation of model \"${entry.name}\" travels, which cannot be written in Prisma 8 PSL.`, \"The PSL source derives every foreign key from a `@relation` field; a foreign key without one has no PSL form.\", \"Declare a relation over the foreign key, or keep authoring this contract in its current source.\", {\n\t\t\tnamespaceId: entry.namespaceId,\n\t\t\ttable: entry.tableName,\n\t\t\tcolumns: fk.source.columns\n\t\t});\n\t}\n}\nfunction refuseRelationToOtherContractSpace(input) {\n\tif (input.space === void 0) return;\n\tthrow unsupported(`relation \"${input.modelName}.${input.fieldName}\" targets model \"${input.targetModel}\" in contract space \"${input.space}\", which contract print cannot write yet.`, \"The printer writes relations between models of this contract only.\", KEEP_SOURCE, {\n\t\tmodel: input.modelName,\n\t\tfield: input.fieldName,\n\t\tspace: input.space\n\t});\n}\nfunction refuseManyToManyWithoutJunctionRelation(modelName, fieldName) {\n\tthrow unsupported(`many-to-many relation \"${modelName}.${fieldName}\" goes through a table whose model has no relation back to \"${modelName}\", so it cannot be written in Prisma 8 PSL.`, \"PSL writes a many-to-many list field through the relations of the junction model, one to each side.\", \"Declare a model for the junction table with a relation to each side, or keep authoring this contract in its current source.\", {\n\t\tmodel: modelName,\n\t\tfield: fieldName\n\t});\n}\nfunction refuseBackRelationWithoutOwningRelation(input) {\n\tthrow unsupported(`relation \"${input.modelName}.${input.fieldName}\" has no foreign key of its own, and model \"${input.targetModel}\" has no relation back to \"${input.modelName}\" over the same columns, so it cannot be written in Prisma 8 PSL.`, \"The PSL source reads a relation field without `fields:` and `references:` only as the other side of a relation field that has them.\", `Declare the relation on \"${input.targetModel}\" that holds the foreign key, or keep authoring this contract in its current source.`, {\n\t\tmodel: input.modelName,\n\t\tfield: input.fieldName\n\t});\n}\nfunction refuseRelationWithoutJoin(modelName, fieldName) {\n\tthrow unsupported(`relation \"${modelName}.${fieldName}\" names no fields to join on, which cannot be written in Prisma 8 PSL.`, \"The PSL source reads every relation as a join between fields of the two models; a relation with no `on` part has no PSL form.\", KEEP_SOURCE, {\n\t\tmodel: modelName,\n\t\tfield: fieldName\n\t});\n}\n/**\n* Refuses a namespace whose value sets differ from the ones the PSL source derives from the enum\n* and `native_enum` blocks the printer writes for it.\n*/\nfunction refuseUnderivedValueSets(input) {\n\tconst { namespaceId } = input;\n\tfor (const [name, values] of input.actual) {\n\t\tconst derived = input.derived.get(name);\n\t\tif (derived !== void 0 && sameValues$1(derived, values)) continue;\n\t\tthrow unsupported(`value set \"${name}\" in namespace \"${namespaceId}\" is not the value set of an enum or native enum of that name holding exactly its values, so it cannot be written in Prisma 8 PSL.`, \"The PSL source derives each value set from an `enum` or `native_enum` block, named after the block and holding its members.\", KEEP_SOURCE, {\n\t\t\tnamespaceId,\n\t\t\tname\n\t\t});\n\t}\n\tfor (const name of input.derived.keys()) {\n\t\tif (input.actual.has(name)) continue;\n\t\tthrow unsupported(`enum \"${name}\" in namespace \"${namespaceId}\" has no value set holding its members, which cannot be written in Prisma 8 PSL.`, \"The PSL source derives a value set from every enum, so the file would read back with a value set this contract does not have.\", KEEP_SOURCE, {\n\t\t\tnamespaceId,\n\t\t\tname\n\t\t});\n\t}\n}\nfunction refuseEnumAndNativeEnumSharingName(namespaceId, name) {\n\tthrow unsupported(`enum \"${name}\" and a native enum written under the same name both derive the value set \"${name}\" in namespace \"${namespaceId}\", which cannot be written in Prisma 8 PSL.`, \"The PSL source refuses one name declared both as an enum and as a native enum.\", KEEP_SOURCE, {\n\t\tnamespaceId,\n\t\tname\n\t});\n}\nfunction refuseNativeEnumWithoutValueSet(namespaceId, nativeEnum) {\n\tthrow unsupported(`native enum \"${nativeEnum.typeName}\" in namespace \"${namespaceId}\" has no value set holding its members, which cannot be written in Prisma 8 PSL.`, \"The PSL source derives a value set from every `native_enum` block, named after the block and holding its members, so the file would read back with a value set this contract does not have.\", KEEP_SOURCE, {\n\t\tnamespaceId,\n\t\ttypeName: nativeEnum.typeName\n\t});\n}\nfunction refuseNativeEnumControl(namespaceId, nativeEnum) {\n\tif (nativeEnum.control === void 0) return;\n\tthrow unsupported(`native enum \"${nativeEnum.typeName}\" in namespace \"${namespaceId}\" carries its own control policy \"${nativeEnum.control}\", which cannot be written in Prisma 8 PSL.`, \"A `native_enum` block has no control attribute.\", \"Drop the policy from the enum, or keep authoring this contract in its current source.\", {\n\t\tnamespaceId,\n\t\ttypeName: nativeEnum.typeName,\n\t\tcontrol: nativeEnum.control\n\t});\n}\n/**\n* Refuses a storage or domain namespace the PSL source would not create again: one holding nothing\n* the printer writes. The PSL source creates the default namespace in both planes, a storage\n* namespace for every namespace block it writes into, and a domain namespace for each namespace\n* with models.\n*/\nfunction refuseUnwrittenNamespaces(input) {\n\tconst { contract } = input;\n\tconst storageNamespaces = /* @__PURE__ */ new Set([DEFAULT_NAMESPACE_ID, ...input.writtenStorageNamespaces]);\n\tconst defaultDomain = contract.domain.namespaces[DEFAULT_NAMESPACE_ID];\n\tconst domainNamespaces = new Set(input.models.map((entry) => entry.namespaceId));\n\tif (domainNamespaces.size === 0 || Object.keys(defaultDomain?.valueObjects ?? {}).length > 0 || Object.keys(defaultDomain?.enum ?? {}).length > 0) domainNamespaces.add(DEFAULT_NAMESPACE_ID);\n\tconst planes = [{\n\t\tplane: \"storage\",\n\t\texpected: storageNamespaces,\n\t\tactual: Object.keys(contract.storage.namespaces)\n\t}, {\n\t\tplane: \"domain\",\n\t\texpected: domainNamespaces,\n\t\tactual: Object.keys(contract.domain.namespaces)\n\t}];\n\tfor (const { plane, expected, actual } of planes) {\n\t\tfor (const namespaceId of actual) {\n\t\t\tif (expected.has(namespaceId)) continue;\n\t\t\tthrow unsupported(`${plane} namespace \"${namespaceId}\" holds nothing Prisma 8 PSL writes, so it would not read back.`, \"The PSL source creates a namespace only for what is written in it.\", \"Remove the empty namespace, or keep authoring this contract in its current source.\", {\n\t\t\t\tplane,\n\t\t\t\tnamespaceId\n\t\t\t});\n\t\t}\n\t\tfor (const namespaceId of expected) {\n\t\t\tif (actual.includes(namespaceId)) continue;\n\t\t\tthrow unsupported(`the contract has no ${plane} namespace \"${namespaceId}\", which the PSL source would create.`, \"The PSL source always creates the default namespace, and a namespace for everything it writes.\", KEEP_SOURCE, {\n\t\t\t\tplane,\n\t\t\t\tnamespaceId\n\t\t\t});\n\t\t}\n\t}\n}\n/**\n* Refuses a namespace named `unbound` that is not the late-binding namespace: PSL writes the\n* late-binding namespace as `namespace unbound`, so a block of that name reads back as it.\n*/\nfunction refuseNamespaceNamedUnbound(namespaceId) {\n\tif (namespaceId !== UNBOUND_PSL_NAMESPACE_NAME) return;\n\tthrow unsupported(`namespace \"${namespaceId}\" cannot be written in Prisma 8 PSL, because \\`namespace ${UNBOUND_PSL_NAMESPACE_NAME}\\` is how PSL writes the late-binding namespace.`, `The PSL source reads \\`namespace ${UNBOUND_PSL_NAMESPACE_NAME}\\` as the late-binding namespace \"${UNBOUND_NAMESPACE_ID}\", so everything in this namespace would move there.`, \"Rename the namespace, or keep authoring this contract in its current source.\", { namespaceId });\n}\n/** Refuses top-level `meta` entries: the PSL source reads back an empty `meta`. */\nfunction refuseContractMeta(contract) {\n\tconst keys = Object.keys(contract.meta);\n\tif (keys.length === 0) return;\n\tthrow unsupported(`the contract carries meta entries (${keys.join(\", \")}), which cannot be written in Prisma 8 PSL.`, \"The PSL source writes no top-level meta, so the file would read back with an empty meta.\", KEEP_SOURCE, { keys });\n}\n/**\n* Refuses roots that differ from the ones the PSL source derives: one per model that is not a\n* variant, keyed by its table name, or by `<namespace>.<table>` when two such models share a table\n* name.\n*/\nfunction refuseUnderivedRoots(contract, models, variants) {\n\tconst tableEntries = models.filter((entry) => variants.get(entry)?.singleTable !== true);\n\tconst tableNameCounts = /* @__PURE__ */ new Map();\n\tfor (const entry of tableEntries) tableNameCounts.set(entry.tableName, (tableNameCounts.get(entry.tableName) ?? 0) + 1);\n\tconst derived = /* @__PURE__ */ new Map();\n\tfor (const entry of tableEntries) {\n\t\tif (variants.get(entry) !== void 0) continue;\n\t\tconst key = (tableNameCounts.get(entry.tableName) ?? 0) > 1 ? `${entry.namespaceId}.${entry.tableName}` : entry.tableName;\n\t\tderived.set(key, entry);\n\t}\n\tconst refuse = (root) => unsupported(`root \"${root}\" is not a root the PSL source derives, so the contract's roots cannot be written in Prisma 8 PSL.`, \"The PSL source derives one root per model that is not a variant, keyed by its table name.\", KEEP_SOURCE, { root });\n\tfor (const [root, reference] of Object.entries(contract.roots)) {\n\t\tconst entry = derived.get(root);\n\t\tif (entry === void 0 || reference.space !== void 0 || reference.namespace !== entry.namespaceId || reference.model !== entry.name) throw refuse(root);\n\t}\n\tfor (const root of derived.keys()) if (!Object.hasOwn(contract.roots, root)) throw refuse(root);\n}\nfunction refuseRlsWithoutModel(namespaceId, tableName) {\n\tthrow unsupported(`table \"${namespaceId}\".\"${tableName}\" has row-level security enabled but no model, so it cannot be written in Prisma 8 PSL.`, \"Row-level security is written as `@@rls` on the model stored in the table.\", \"Declare a model for the table, or keep authoring this contract in its current source.\", {\n\t\tnamespaceId,\n\t\ttable: tableName\n\t});\n}\nfunction unwritablePolicy(policy, why, fix) {\n\treturn unsupported(`policy \"${policy.name}\" on \"${policy.namespaceId}\".\"${policy.tableName}\" cannot be written in Prisma 8 PSL.`, why, fix, {\n\t\tnamespaceId: policy.namespaceId,\n\t\ttable: policy.tableName,\n\t\tname: policy.name\n\t});\n}\nfunction refusePolicyWithoutModel(policy) {\n\tthrow unwritablePolicy(policy, \"A policy block names its table through the model stored there, and no model is stored in this table.\", \"Declare a model for the table, or keep authoring this contract in its current source.\");\n}\nfunction refusePolicyWithoutRls(policy) {\n\tthrow unwritablePolicy(policy, \"The PSL source reads a policy only on a model that declares `@@rls`, and this table does not have row-level security enabled.\", \"Enable row-level security on the table, or keep authoring this contract in its current source.\");\n}\nfunction refusePolicyNameNotDerived(policy) {\n\tthrow unwritablePolicy(policy, \"The PSL source names a wire-named policy by its block name and the hash of its content, and this name is not that.\", KEEP_SOURCE);\n}\n/** Refuses a role outside the unbound namespace: the PSL source reads a `role` block only there. */\nfunction refuseRoleOutsideUnbound(namespaceId, name) {\n\tif (namespaceId === UNBOUND_NAMESPACE_ID) return;\n\tthrow unsupported(`role \"${name}\" is declared in namespace \"${namespaceId}\", and Prisma 8 PSL declares a role only in the unbound namespace.`, \"The PSL source reads a `role` block only inside `namespace unbound`, because roles belong to the whole database.\", \"Declare the role in the unbound namespace, or keep authoring this contract in its current source.\", {\n\t\tnamespaceId,\n\t\tname\n\t});\n}\nconst FILED_UNDER = {\n\trls: \"The PSL source files the row-level security setting written as `@@rls` under the name of the table.\",\n\trole: \"The PSL source files a role under the name its block is written with.\"\n};\n/** Refuses a row-level security setting or role filed under a key the PSL source would not use. */\nfunction refuseEntryFiledUnderAnotherName(input) {\n\tif (input.name === input.readsBackAs) return;\n\tthrow unsupported(`namespace \"${input.namespaceId}\" has a \"${input.kind}\" entry \"${input.name}\" that would read back as \"${input.readsBackAs}\", so it cannot be written in Prisma 8 PSL.`, FILED_UNDER[input.kind], KEEP_SOURCE, {\n\t\tnamespaceId: input.namespaceId,\n\t\tkind: input.kind,\n\t\tname: input.name\n\t});\n}\n/** Refuses an entry that records a namespace other than the one it is stored in. */\nfunction refuseEntryInOtherNamespace(input) {\n\tif (input.recordedNamespaceId === input.namespaceId) return;\n\tthrow unsupported(`the \"${input.kind}\" entry \"${input.name}\" is stored in namespace \"${input.namespaceId}\" but records namespace \"${input.recordedNamespaceId}\", so it cannot be written in Prisma 8 PSL.`, \"The PSL source records the namespace a block is written in, so the entry would read back with the namespace it is stored in.\", \"The contract source produced an entry that disagrees with its namespace. Fix the entry if the source is a TypeScript contract; otherwise report the bug to the source that produced it.\", {\n\t\tnamespaceId: input.namespaceId,\n\t\tkind: input.kind,\n\t\tname: input.name\n\t});\n}\nfunction refuseNameThePslSourceLoses(kind, name) {\n\tif (name !== NAME_THE_PSL_SOURCE_LOSES) return;\n\tthrow unsupported(`${kind} \"${name}\" cannot be written in Prisma 8 PSL, because the PSL source loses this name when it reads it.`, \"The PSL source keeps names as keys of plain objects, where this name sets the prototype instead of adding a key.\", \"Rename it, or keep authoring this contract in its current source.\", {\n\t\tkind,\n\t\tname\n\t});\n}\n/**\n* Refuses a table or column named `__proto__`, which the printer would write inside `@@map` or\n* `@map` and the PSL source loses when it reads it.\n*/\nfunction refuseUnwritableMappedName(kind, name) {\n\trefuseNameThePslSourceLoses(kind, name);\n}\n/**\n* Refuses a name the printer writes where PSL reads an identifier: a namespace, model, field, value\n* object, enum, enum member, native enum, named type, policy, role or index option key.\n*/\nfunction refuseUnwritableName(kind, name) {\n\trefuseNameThePslSourceLoses(kind, name);\n\tif (isPslIdentifier(name)) return;\n\tthrow unsupported(`${kind} \"${name}\" is not a PSL identifier, so it cannot be written in Prisma 8 PSL.`, \"PSL writes this name as an identifier: a letter or underscore, then letters, ASCII digits, underscores or hyphens, other than the number words `NaN` and `Infinity`.\", \"Rename it to an identifier, or keep authoring this contract in its current source.\", {\n\t\tkind,\n\t\tname\n\t});\n}\n/** The storage entry kinds the printer writes; any other kind is refused, whichever component defines it. */\nconst PRINTED_ENTRY_KINDS = /* @__PURE__ */ new Set([\n\t\"table\",\n\t\"valueSet\",\n\t\"native_enum\",\n\t\"rls\",\n\t\"policy\",\n\t\"role\"\n]);\nfunction refuseUnprintedEntryKinds(namespaceId, entries) {\n\tfor (const [kind, entities] of Object.entries(entries)) {\n\t\tif (PRINTED_ENTRY_KINDS.has(kind)) continue;\n\t\tconst names = Object.keys(entities ?? {});\n\t\tif (names.length === 0) continue;\n\t\tthrow unsupported(`namespace \"${namespaceId}\" declares ${names.length} \"${kind}\" ${names.length === 1 ? \"entity\" : \"entities\"} (${names.join(\", \")}), which the Postgres printer cannot write.`, \"The printer writes tables, value sets, native enums, row-level security settings, policies and roles, and no other entity kind.\", KEEP_SOURCE, {\n\t\t\tnamespaceId,\n\t\t\tkind,\n\t\t\tnames\n\t\t});\n\t}\n}\n//#endregion\n//#region src/core/psl-print/column-types.ts\n/**\n* The type arguments a native type takes, in the order the PSL type\n* constructor declares them.\n*/\nconst TYPE_PARAM_ORDER = [\n\t\"length\",\n\t\"precision\",\n\t\"scale\"\n];\n/**\n* Re-composes the parenthesised native type the type map resolves\n* (`numeric(10,2)`) from a column's bare native type and its type parameters.\n*/\nfunction nativeTypeText(column) {\n\tconst args = TYPE_PARAM_ORDER.map((key) => column.typeParams?.[key]).filter((value) => typeof value === \"number\");\n\treturn args.length === 0 ? column.nativeType : `${column.nativeType}(${args.join(\", \")})`;\n}\n/** A type argument as PSL writes it: a number as written, a string between quotes. */\nfunction typeArgumentText(value, coordinate) {\n\tif (typeof value !== \"string\") return String(value);\n\trefuseUnwritableTypeArgument(value, coordinate);\n\treturn `\"${value}\"`;\n}\nfunction typeCall(path, args) {\n\tconst name = path.join(\".\");\n\tif (args.length === 0) return { typeName: name };\n\treturn {\n\t\ttypeName: name,\n\t\ttypeConstructor: {\n\t\t\tkind: \"typeConstructor\",\n\t\t\tpath,\n\t\t\targs: args.map(positionalArg),\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t}\n\t};\n}\n/**\n* The call to the type constructor the type map `contract infer` uses names for the column's native\n* type, when the stack's constructor of that name produces exactly the column's codec, native type\n* and type parameters.\n*/\nfunction typeMapCall(column, typeMap, authoringTypes) {\n\tconst resolution = typeMap.resolve(nativeTypeText(column));\n\tif (\"unsupported\" in resolution) return void 0;\n\tconst { name } = resolution.pslType;\n\tconst descriptor = authoringTypes[name];\n\treturn descriptor === void 0 ? void 0 : findAuthoringTypeConstructorCall({ [name]: descriptor }, column);\n}\n/**\n* The PSL type position for a storage column: a call to a type constructor the configured stack\n* contributes that produces exactly the column's codec, native type and type parameters. The\n* constructor the type map `contract infer` uses names for the native type comes first; otherwise\n* the first one in the stack that produces them, such as `TimestamptzString(3)` for a `timestamptz`\n* column carried as text, or `pgvector.Vector(3)`. An enum-typed column takes the\n* `pg.enum(<Block>)` constructor, named after the value set the column points at; a column typed by\n* a domain enum takes that enum's name. A column no PSL type reads back is refused.\n*/\nfunction buildColumnType(input) {\n\tconst { column, typeMap, authoringTypes, enumBlockNames, coordinate } = input;\n\tconst enumBlockName = column.valueSet?.entityName ?? enumBlockNames.get(column.nativeType);\n\tif (column.codecId === \"pg/enum@1\" && enumBlockName !== void 0) return {\n\t\ttypeName: enumBlockName,\n\t\ttypeConstructor: {\n\t\t\tkind: \"typeConstructor\",\n\t\t\tpath: [\"pg\", \"enum\"],\n\t\t\targs: [positionalArg(enumBlockName)],\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t}\n\t};\n\tconst domainEnumName = column.valueSet?.entityName;\n\tif (domainEnumName !== void 0) return { typeName: domainEnumName };\n\tconst call = typeMapCall(column, typeMap, authoringTypes) ?? findAuthoringTypeConstructorCall(authoringTypes, column);\n\tif (call !== void 0) return typeCall(call.path, call.args.map((value) => typeArgumentText(value, coordinate)));\n\trefuseColumnWithoutPslType(column, coordinate);\n}\n//#endregion\n//#region src/core/psl-print/domain-types.ts\n/**\n* The native type the stack's codec names for a value-object field. The field has no column of its\n* own, and no type parameters, which the PSL source would not keep.\n*/\nfunction nativeTypeOfValueObjectField(field, coordinate, context) {\n\tconst { codecId } = field.type;\n\tconst descriptor = context.codecLookup.descriptorFor?.(codecId);\n\tif (!isPostgresCodecDescriptor(descriptor)) refuseValueObjectFieldCodecWithoutNativeType(codecId, coordinate);\n\ttry {\n\t\treturn descriptor.nativeTypeFor({ codecId });\n\t} catch {\n\t\trefuseValueObjectFieldCodecNeedingTypeParameters(codecId, coordinate);\n\t}\n}\n/** The PSL type position of a domain field: a value object by name, or a scalar as a column would print. */\nfunction buildDomainFieldType(input) {\n\tconst { field, coordinate } = input;\n\trefuseUnwritableFieldShape(field, coordinate);\n\tconst { type } = field;\n\tif (type.kind === \"valueObject\") return { typeName: type.name };\n\trefuseValueObjectFieldPartsTheSourceDrops({\n\t\t...field,\n\t\ttype\n\t}, coordinate);\n\treturn buildColumnType({\n\t\tcolumn: new StorageColumn({\n\t\t\tnativeType: nativeTypeOfValueObjectField({\n\t\t\t\t...field,\n\t\t\t\ttype\n\t\t\t}, coordinate, input.context),\n\t\t\tcodecId: type.codecId,\n\t\t\tnullable: field.nullable,\n\t\t\t...ifDefined(\"many\", field.many)\n\t\t}),\n\t\ttypeMap: input.typeMap,\n\t\tauthoringTypes: input.context.authoringContributions.type,\n\t\tenumBlockNames: input.enumBlockNames,\n\t\tcoordinate\n\t});\n}\n/** The `type` blocks of one namespace, one per value object the domain declares there. */\nfunction buildCompositeTypes(input) {\n\trefuseValueObjectsOutsideDefaultNamespace(input.contract, input.namespaceId);\n\tconst valueObjects = input.contract.domain.namespaces[input.namespaceId]?.valueObjects ?? {};\n\treturn Object.entries(valueObjects).map(([name, valueObject]) => {\n\t\trefuseUnwritableName(\"value object\", name);\n\t\treturn {\n\t\t\tkind: \"compositeType\",\n\t\t\tname,\n\t\t\tfields: Object.entries(valueObject.fields).map(([fieldName, field]) => {\n\t\t\t\trefuseUnwritableName(\"field\", fieldName);\n\t\t\t\tconst { typeName, typeConstructor } = buildDomainFieldType({\n\t\t\t\t\tfield,\n\t\t\t\t\tcoordinate: `\"${input.namespaceId}\".${name}.${fieldName}`,\n\t\t\t\t\ttypeMap: input.typeMap,\n\t\t\t\t\tcontext: input.context,\n\t\t\t\t\tenumBlockNames: input.enumBlockNames\n\t\t\t\t});\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"field\",\n\t\t\t\t\tname: fieldName,\n\t\t\t\t\ttypeName,\n\t\t\t\t\t...ifDefined(\"typeConstructor\", typeConstructor),\n\t\t\t\t\toptional: field.nullable,\n\t\t\t\t\tlist: field.many === true,\n\t\t\t\t\tattributes: [],\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t};\n\t\t\t}),\n\t\t\tattributes: [],\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t};\n\t});\n}\n/** The document's `types { … }` block, one declaration per named storage type. */\nfunction buildTypesBlock(contract, typeMap, context) {\n\tconst declarations = [];\n\tfor (const [name, instance] of Object.entries(contract.storage.types ?? {})) {\n\t\trefuseUnwritableName(\"named type\", name);\n\t\tconst { typeName, typeConstructor } = buildColumnType({\n\t\t\tcolumn: new StorageColumn({\n\t\t\t\tnativeType: instance.nativeType,\n\t\t\t\tcodecId: instance.codecId,\n\t\t\t\tnullable: false,\n\t\t\t\t...ifDefined(\"typeParams\", instance.typeParams)\n\t\t\t}),\n\t\t\ttypeMap,\n\t\t\tauthoringTypes: context.authoringContributions.type,\n\t\t\tenumBlockNames: /* @__PURE__ */ new Map(),\n\t\t\tcoordinate: `types.${name}`\n\t\t});\n\t\tdeclarations.push({\n\t\t\tkind: \"namedType\",\n\t\t\tname,\n\t\t\t...typeConstructor === void 0 ? { baseType: typeName } : { typeConstructor },\n\t\t\tattributes: [],\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t});\n\t}\n\treturn declarations.length === 0 ? void 0 : {\n\t\tkind: \"types\",\n\t\tdeclarations,\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\n//#endregion\n//#region src/core/psl-print/enum-blocks.ts\n/**\n* One `enum <name> { … }` block per domain enum, each member written as\n* `Name = <value>` under `@@type`. The PSL source reads a member value as JSON,\n* so the value is written as JSON text.\n*/\nfunction buildDomainEnumBlocks(enums) {\n\treturn Object.entries(enums).map(([name, domainEnum]) => {\n\t\trefuseUnwritableName(\"enum\", name);\n\t\treturn {\n\t\t\tkind: \"enum\",\n\t\t\tkeyword: \"enum\",\n\t\t\tname,\n\t\t\tparameters: Object.fromEntries(domainEnum.members.map((member) => {\n\t\t\t\trefuseUnwritableName(\"enum member\", member.name);\n\t\t\t\treturn [member.name, {\n\t\t\t\t\texpression: JSON.stringify(member.value),\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t}];\n\t\t\t})),\n\t\t\tblockAttributes: [{\n\t\t\t\tname: \"type\",\n\t\t\t\targs: [{\n\t\t\t\t\tkind: \"positional\",\n\t\t\t\t\tvalue: `\"${escapePslString(domainEnum.codecId)}\"`,\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t}],\n\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t}],\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t};\n\t});\n}\nfunction sameValues(left, right) {\n\treturn left.length === right.length && left.every((value, index) => value === right[index]);\n}\n/**\n* Builds one `native_enum` block per enum type a namespace declares.\n*\n* A contract keys a native enum by its type name and keys the value set it\n* derives by the name the schema gave the enum, and the PSL source derives\n* that value set from the block, named after the block. So the block is named\n* after the enum's value set: the value set a column typed by the enum names;\n* else, for an enum no column refers to, the unclaimed value set with the\n* enum's own name that holds exactly its members, or else the first unclaimed\n* one that does. An enum with no such value set is refused. `@@map` carries\n* the type name whenever it differs from the block name.\n*/\nfunction buildNativeEnumBlocksForNamespace(input) {\n\tconst valueSetNamesByTypeName = /* @__PURE__ */ new Map();\n\tfor (const column of input.columns) {\n\t\tconst valueSetName = column.valueSet?.entityName;\n\t\tif (valueSetName === void 0) continue;\n\t\tvalueSetNamesByTypeName.set(column.nativeType, valueSetName);\n\t}\n\tconst claimed = new Set(valueSetNamesByTypeName.values());\n\tconst unreferenced = [];\n\tconst nameByEntry = /* @__PURE__ */ new Map();\n\tfor (const [entryName, nativeEnum] of input.nativeEnums) {\n\t\trefuseNativeEnumControl(input.namespaceId, nativeEnum);\n\t\tconst { typeName } = nativeEnum;\n\t\tconst fromColumn = valueSetNamesByTypeName.get(typeName) ?? valueSetNamesByTypeName.get(`${input.namespaceId}.${typeName}`);\n\t\tif (fromColumn === void 0) {\n\t\t\tunreferenced.push({\n\t\t\t\tentryName,\n\t\t\t\tnativeEnum\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tnameByEntry.set(entryName, fromColumn);\n\t}\n\tfor (const { entryName, nativeEnum } of unreferenced) {\n\t\tconst candidates = [...input.valueSets].filter(([name, values]) => !claimed.has(name) && sameValues(values, nativeEnum.members)).map(([name]) => name);\n\t\tconst chosen = candidates.find((name) => name === entryName) ?? candidates[0];\n\t\tif (chosen === void 0) refuseNativeEnumWithoutValueSet(input.namespaceId, nativeEnum);\n\t\tclaimed.add(chosen);\n\t\tnameByEntry.set(entryName, chosen);\n\t}\n\tconst blocks = [];\n\tconst blockNamesByTypeName = /* @__PURE__ */ new Map();\n\tconst derivedValueSets = /* @__PURE__ */ new Map();\n\tfor (const [entryName, nativeEnum] of input.nativeEnums) {\n\t\tconst { typeName } = nativeEnum;\n\t\tconst blockName = nameByEntry.get(entryName) ?? typeName;\n\t\trefuseUnwritableName(\"native enum\", blockName);\n\t\tblocks.push(buildNativeEnumBlock(blockName, typeName, nativeEnum.members));\n\t\tblockNamesByTypeName.set(typeName, blockName);\n\t\tblockNamesByTypeName.set(`${input.namespaceId}.${typeName}`, blockName);\n\t\tderivedValueSets.set(blockName, nativeEnum.members);\n\t}\n\treturn {\n\t\tblocks,\n\t\tblockNamesByTypeName,\n\t\tderivedValueSets\n\t};\n}\n//#endregion\n//#region src/core/psl-print/model-attributes.ts\n/**\n* The checks the PSL source derives itself for a table, keyed by name, so\n* they are not also written as `@@check`. A table that is not managed derives\n* none. A managed one derives a membership check for each column typed by a\n* domain enum and an element-not-null check for each list column, less the\n* kinds a column waives with `@noCheck`.\n*/\nfunction derivedChecks(input) {\n\tconst checks = /* @__PURE__ */ new Map();\n\tif (!input.managed) return checks;\n\tfor (const [columnName, column] of Object.entries(input.table.columns)) {\n\t\tconst enumValues = column.codecId === \"pg/enum@1\" || column.valueSet === void 0 ? void 0 : input.domainEnumValues.get(column.valueSet.entityName);\n\t\tconst memberValues = enumValues?.filter((value) => typeof value === \"string\" || typeof value === \"number\");\n\t\tconst waived = new Set(column.noCheck ?? []);\n\t\tfor (const candidate of postgresRenderCheckExpressions({\n\t\t\ttableName: input.tableName,\n\t\t\tcolumnName,\n\t\t\tmany: column.many === true,\n\t\t\tmemberValues: memberValues?.length === enumValues?.length ? memberValues : void 0\n\t\t})) {\n\t\t\tif (waived.has(candidate.kind)) continue;\n\t\t\tconst prefix = composeCheckWirePrefix(input.tableName, columnName, candidate.kind);\n\t\t\tchecks.set(formatWireName(prefix, computeCheckContentHash(candidate.expression)), {\n\t\t\t\tprefix,\n\t\t\t\texpression: candidate.expression\n\t\t\t});\n\t\t}\n\t}\n\treturn checks;\n}\n/**\n* Whether a table object belongs to this model when several models share the\n* table: a single-table variant owns what lies within its own columns, and the\n* base owns the rest.\n*/\nfunction ownsTableObject(entry, variant, singleTableVariants, columns) {\n\tif (variant?.singleTable === true) return columns?.every((column) => entry.ownColumns.has(column)) === true;\n\treturn !singleTableVariants.some((other) => columns?.every((column) => other.ownColumns.has(column)) === true);\n}\n/**\n* How a check or index is named in PSL: `name:` with its prefix when the name\n* is that prefix and the hash of its content, which the PSL source derives\n* again; `map:` when it has no prefix. A prefix whose name is anything else is\n* refused, because neither form reads back as it.\n*/\nfunction attributeNaming(input) {\n\tconst { kind, entry, name, prefix } = input;\n\tif (prefix === void 0) return { kind: \"exact\" };\n\tif (formatWireName(prefix, input.contentHash()) === name) return {\n\t\tkind: \"wire\",\n\t\tprefix\n\t};\n\trefuseUnwritableObjectName({\n\t\tkind,\n\t\tentry,\n\t\tname,\n\t\tprefix\n\t});\n}\n/**\n* The `@@` attributes of one model: its polymorphism, its keys, checks and indexes, its control\n* policy, `@@rls` and `@@map`. A table object several models share goes on the model that owns it.\n*/\nfunction buildModelAttributes(input) {\n\tconst { entry, variant, singleTableVariants, derivedChecksByName } = input;\n\tconst attributes = [];\n\tconst fieldNameOf = (column) => entry.fieldNamesByColumn.get(column) ?? column;\n\tconst owns = (columns) => ownsTableObject(entry, variant, singleTableVariants, columns);\n\tif (entry.model.discriminator !== void 0) attributes.push(buildAttribute(\"model\", \"discriminator\", [positionalArg(entry.model.discriminator.field)]));\n\tif (variant !== void 0) attributes.push(buildAttribute(\"model\", \"base\", [positionalArg(variant.base.name), positionalArg(`\"${escapePslString(variant.value)}\"`)]));\n\tconst primaryKeyColumns = variant === void 0 ? entry.table.primaryKey?.columns ?? [] : [];\n\tif (primaryKeyColumns.length > 1) attributes.push(buildModelConstraintAttribute(\"id\", primaryKeyColumns.map(fieldNameOf), entry.table.primaryKey?.name));\n\tfor (const unique of entry.table.uniques) {\n\t\tif (!owns(unique.columns)) continue;\n\t\tattributes.push(buildModelConstraintAttribute(\"unique\", unique.columns.map(fieldNameOf), unique.name));\n\t}\n\tfor (const check of entry.table.checks ?? []) {\n\t\tif (derivedChecksByName.has(check.name) || !owns(void 0)) continue;\n\t\tattributes.push(buildCheckAttribute(check, attributeNaming({\n\t\t\tkind: \"check\",\n\t\t\tentry,\n\t\t\tname: check.name,\n\t\t\tprefix: check.prefix,\n\t\t\tcontentHash: () => computeCheckContentHash(check.expression)\n\t\t})));\n\t}\n\tfor (const index of entry.table.indexes) {\n\t\tif (!owns(index.columns)) continue;\n\t\trefuseUnwritableIndexOptions(entry, index);\n\t\tattributes.push(buildIndexAttribute(index, index.columns?.map(fieldNameOf), attributeNaming({\n\t\t\tkind: \"index\",\n\t\t\tentry,\n\t\t\tname: index.name,\n\t\t\tprefix: index.prefix,\n\t\t\tcontentHash: () => computeIndexContentHash(index)\n\t\t})));\n\t}\n\tif (entry.table.control !== void 0 && variant?.singleTable !== true) attributes.push(buildAttribute(\"model\", \"control\", [positionalArg(entry.table.control)]));\n\tif (input.rlsEnabled && variant?.singleTable !== true) attributes.push(buildAttribute(\"model\", \"rls\", []));\n\tconst mapName = pslModelMapName(entry.name, entry.tableName);\n\tif (mapName !== void 0 && variant?.singleTable !== true) attributes.push(buildMapAttribute(\"model\", mapName));\n\treturn attributes;\n}\n//#endregion\n//#region src/core/psl-print/relation-fields.ts\nconst PSL_REFERENTIAL_ACTIONS = {\n\tnoAction: \"NoAction\",\n\trestrict: \"Restrict\",\n\tcascade: \"Cascade\",\n\tsetNull: \"SetNull\",\n\tsetDefault: \"SetDefault\"\n};\nfunction isReferenceRelation(relation) {\n\treturn \"on\" in relation && relation.on !== void 0;\n}\nfunction collectRelations(models) {\n\tconst entries = [];\n\tfor (const owner of models) for (const [fieldName, relation] of Object.entries(owner.model.relations)) {\n\t\tif (!isReferenceRelation(relation)) refuseRelationWithoutJoin(owner.name, fieldName);\n\t\tentries.push({\n\t\t\towner,\n\t\t\tfieldName,\n\t\t\trelation,\n\t\t\ttargetCoordinate: crossReferenceCoordinate(relation.to)\n\t\t});\n\t}\n\treturn entries;\n}\n/** A relation whose local fields carry the foreign key — the side `@relation(fields:…)` goes on. */\nfunction isOwningRelation(entry) {\n\treturn entry.relation.cardinality === \"N:1\";\n}\nfunction relationKey(entry) {\n\treturn JSON.stringify([\n\t\tentry.owner.namespaceId,\n\t\tentry.owner.name,\n\t\tentry.fieldName\n\t]);\n}\n/** The relation name a pair is pinned with when the model pair carries more than one relation. */\nfunction relationName(entry) {\n\treturn `${entry.owner.name}_${entry.fieldName}`;\n}\nfunction columnsIn(model, fieldNames) {\n\treturn fieldNames.map((fieldName) => model.storage.fields[fieldName]?.column ?? fieldName);\n}\nfunction columnsOf(entry, fieldNames) {\n\treturn columnsIn(entry.owner, fieldNames);\n}\nfunction sameColumns(a, b) {\n\treturn a.length === b.length && a.every((value, index) => value === b[index]);\n}\n/** The foreign key that backs an owning relation. */\nfunction foreignKeyFor(entry, target) {\n\tconst localColumns = columnsOf(entry, entry.relation.on.localFields);\n\tconst targetColumns = columnsIn(target, entry.relation.on.targetFields);\n\treturn entry.owner.table.foreignKeys.find((fk) => fk.target.spaceId === void 0 && fk.target.tableName === target.tableName && fk.target.namespaceId === target.namespaceId && sameColumns(fk.source.columns, localColumns) && sameColumns(fk.target.columns, targetColumns));\n}\n/**\n* The owning relation on `target` that pairs with a back-relation `entry`: the\n* one pointing back at `entry`'s model over the same columns. The\n* back-relation's target fields name fields of the target model, so they are\n* resolved to columns through the candidate's own model, not through the\n* back-relation's.\n*/\nfunction owningPartner(entry, relationsByModel) {\n\tconst ownerCoordinate = modelCoordinate(entry.owner.namespaceId, entry.owner.name);\n\treturn relationsByModel.get(entry.targetCoordinate)?.find((candidate) => isOwningRelation(candidate) && candidate.targetCoordinate === ownerCoordinate && sameColumns(columnsOf(candidate, candidate.relation.on.localFields), columnsIn(candidate.owner, entry.relation.on.targetFields)));\n}\n/**\n* The junction-side relation that points back at the parent of a many-to-many\n* relation — the one whose columns are the junction's parent columns.\n*/\nfunction junctionParentRelation(entry, relationsByModel) {\n\tconst through = entry.relation.through;\n\tif (through === void 0) return void 0;\n\tconst ownerCoordinate = modelCoordinate(entry.owner.namespaceId, entry.owner.name);\n\tfor (const [, relations] of relationsByModel) for (const candidate of relations) {\n\t\tif (candidate.owner.tableName !== through.table || candidate.owner.namespaceId !== through.namespaceId || candidate.targetCoordinate !== ownerCoordinate || !isOwningRelation(candidate)) continue;\n\t\tif (sameColumns(columnsOf(candidate, candidate.relation.on.localFields), through.parentColumns)) return candidate;\n\t}\n}\n/** The PSL field one relation is written as. */\nfunction buildRelationField(input) {\n\tconst { entry, target, name } = input;\n\tconst { relation } = entry;\n\tconst typeNamespaceId = target.namespaceId === entry.owner.namespaceId ? void 0 : pslNamespaceName(target.namespaceId);\n\tconst args = [];\n\tif (name !== void 0) args.push(namedArg(\"name\", `\"${escapePslString(name)}\"`));\n\tif (relation.cardinality === \"N:1\" && input.ownerIsSingleTableVariant) {\n\t\targs.push(namedArg(\"fields\", `[${relation.on.localFields.join(\", \")}]`));\n\t\targs.push(namedArg(\"references\", `[${relation.on.targetFields.join(\", \")}]`));\n\t} else if (relation.cardinality === \"N:1\") {\n\t\tconst foreignKey = foreignKeyFor(entry, target);\n\t\tif (foreignKey === void 0) refuseToOneRelationWithoutForeignKey(entry.owner.name, entry.fieldName);\n\t\targs.push(namedArg(\"fields\", `[${relation.on.localFields.join(\", \")}]`));\n\t\targs.push(namedArg(\"references\", `[${relation.on.targetFields.join(\", \")}]`));\n\t\tif (foreignKey.onDelete !== void 0) args.push(namedArg(\"onDelete\", PSL_REFERENTIAL_ACTIONS[foreignKey.onDelete]));\n\t\tif (foreignKey.onUpdate !== void 0) args.push(namedArg(\"onUpdate\", PSL_REFERENTIAL_ACTIONS[foreignKey.onUpdate]));\n\t\tif (foreignKey.name !== void 0) args.push(namedArg(\"map\", `\"${escapePslString(foreignKey.name)}\"`));\n\t\targs.push(namedArg(\"index\", \"false\"));\n\t}\n\tconst list = relation.cardinality === \"1:N\" || relation.cardinality === \"N:M\";\n\tconst optional = !list && (relation.cardinality === \"1:1\" || relation.cardinality === \"N:1\") && relation.nullable === true;\n\treturn {\n\t\tkind: \"field\",\n\t\tname: entry.fieldName,\n\t\ttypeName: target.name,\n\t\t...ifDefined(\"typeNamespaceId\", typeNamespaceId),\n\t\toptional,\n\t\tlist,\n\t\tattributes: args.length > 0 ? [buildAttribute(\"field\", \"relation\", args)] : [],\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\n/** The relations of each model, keyed by the model's coordinate. */\nfunction relationsByModel(relations) {\n\tconst byModel = /* @__PURE__ */ new Map();\n\tfor (const entry of relations) {\n\t\tconst key = modelCoordinate(entry.owner.namespaceId, entry.owner.name);\n\t\tconst bucket = byModel.get(key) ?? [];\n\t\tbucket.push(entry);\n\t\tbyModel.set(key, bucket);\n\t}\n\treturn byModel;\n}\n/**\n* The relation names to pin. A pair needs one when either of its models\n* carries more than one relation to the other; a many-to-many list field\n* additionally pins the junction-side relation it travels through, so that\n* relation is named too.\n*/\nfunction resolvePinnedRelations(relations, relationsByModel) {\n\tconst pairCounts = /* @__PURE__ */ new Map();\n\tfor (const entry of relations) {\n\t\tconst key = JSON.stringify([modelCoordinate(entry.owner.namespaceId, entry.owner.name), entry.targetCoordinate]);\n\t\tpairCounts.set(key, (pairCounts.get(key) ?? 0) + 1);\n\t}\n\tconst ambiguous = (entry) => {\n\t\tconst ownerCoordinate = modelCoordinate(entry.owner.namespaceId, entry.owner.name);\n\t\tconst forward = pairCounts.get(JSON.stringify([ownerCoordinate, entry.targetCoordinate])) ?? 0;\n\t\tconst backward = pairCounts.get(JSON.stringify([entry.targetCoordinate, ownerCoordinate])) ?? 0;\n\t\treturn forward > 1 || backward > 1;\n\t};\n\tconst pinned = /* @__PURE__ */ new Set();\n\tfor (const entry of relations) {\n\t\tif (!ambiguous(entry)) continue;\n\t\tconst owning = isOwningRelation(entry) ? entry : entry.relation.cardinality === \"N:M\" ? junctionParentRelation(entry, relationsByModel) : owningPartner(entry, relationsByModel);\n\t\tif (owning !== void 0) pinned.add(relationKey(owning));\n\t}\n\treturn pinned;\n}\n/**\n* Relation fields in the order their foreign keys appear in storage, so the\n* `foreignKeys` the PSL source derives come back in the same order. A relation\n* that owns no foreign key keeps its place at the end.\n*/\nfunction orderedByForeignKey(entry, relations) {\n\tconst positions = /* @__PURE__ */ new Map();\n\tfor (const relation of relations) {\n\t\tconst target = relation.relation.on.localFields.map((fieldName) => relation.owner.storage.fields[fieldName]?.column ?? fieldName);\n\t\tconst position = entry.table.foreignKeys.findIndex((fk) => fk.source.columns.length === target.length && fk.source.columns.every((column, index) => column === target[index]));\n\t\tpositions.set(relation, isOwningRelation(relation) && position >= 0 ? position : relations.length);\n\t}\n\treturn [...relations].sort((a, b) => (positions.get(a) ?? 0) - (positions.get(b) ?? 0));\n}\n/**\n* The relation fields of one model, in the order of its foreign keys. Each foreign key an owning\n* relation travels is added to `travelledForeignKeys`.\n*/\nfunction buildRelationFields(input) {\n\tconst fields = [];\n\tfor (const modelRelation of orderedByForeignKey(input.entry, input.relations)) {\n\t\trefuseUnwritableName(\"field\", modelRelation.fieldName);\n\t\tconst target = relationTarget(modelRelation, input.modelsByCoordinate);\n\t\tconst junctionRelation = modelRelation.relation.cardinality === \"N:M\" ? junctionParentRelation(modelRelation, input.relationsByModel) : void 0;\n\t\tif (modelRelation.relation.cardinality === \"N:M\" && junctionRelation === void 0) refuseManyToManyWithoutJunctionRelation(modelRelation.owner.name, modelRelation.fieldName);\n\t\tconst owning = isOwningRelation(modelRelation) ? modelRelation : modelRelation.relation.cardinality === \"N:M\" ? junctionRelation : owningPartner(modelRelation, input.relationsByModel);\n\t\tif (owning === void 0) refuseBackRelationWithoutOwningRelation({\n\t\t\tmodelName: modelRelation.owner.name,\n\t\t\tfieldName: modelRelation.fieldName,\n\t\t\ttargetModel: target.name\n\t\t});\n\t\tconst name = input.pinned.has(relationKey(owning)) ? relationName(owning) : void 0;\n\t\tif (isOwningRelation(modelRelation)) {\n\t\t\tconst foreignKey = foreignKeyFor(modelRelation, target);\n\t\t\tif (foreignKey !== void 0) input.travelledForeignKeys.add(foreignKey);\n\t\t}\n\t\tfields.push(buildRelationField({\n\t\t\tentry: modelRelation,\n\t\t\ttarget,\n\t\t\tname,\n\t\t\townerIsSingleTableVariant: input.variant?.singleTable === true\n\t\t}));\n\t}\n\treturn fields;\n}\n/**\n* The model a relation points at. A relation into another contract space is\n* refused: the printer does not write one yet.\n*/\nfunction relationTarget(entry, modelsByCoordinate) {\n\tconst { to } = entry.relation;\n\trefuseRelationToOtherContractSpace({\n\t\tmodelName: entry.owner.name,\n\t\tfieldName: entry.fieldName,\n\t\ttargetModel: to.model,\n\t\tspace: to.space\n\t});\n\tconst target = modelsByCoordinate.get(entry.targetCoordinate);\n\tassertDefined(target, `relation \"${entry.owner.name}.${entry.fieldName}\" targets model \"${to.namespace}.${to.model}\", which the contract does not declare`);\n\treturn target;\n}\n//#endregion\n//#region src/core/psl-print/row-level-security.ts\n/**\n* The storage tables of one namespace that have row-level security enabled,\n* each written as `@@rls` on its model. The PSL source files each one under\n* its table name, in the namespace of its model.\n*/\nfunction rlsEnabledTables(namespaceId, entries) {\n\tconst tables = /* @__PURE__ */ new Set();\n\tfor (const [name, entity] of Object.entries(entries ?? {})) {\n\t\tinvariant(entity instanceof PostgresRlsEnablement, `\"rls\" entry \"${name}\" in namespace \"${namespaceId}\" is not a row-level security setting`);\n\t\trefuseEntryInOtherNamespace({\n\t\t\tnamespaceId,\n\t\t\tkind: \"rls\",\n\t\t\tname,\n\t\t\trecordedNamespaceId: entity.namespaceId\n\t\t});\n\t\trefuseEntryFiledUnderAnotherName({\n\t\t\tnamespaceId,\n\t\t\tkind: \"rls\",\n\t\t\tname,\n\t\t\treadsBackAs: entity.tableName\n\t\t});\n\t\ttables.add(entity.tableName);\n\t}\n\treturn tables;\n}\n/**\n* One `role <name> {}` block per role. The PSL source reads a role block only\n* inside `namespace unbound`, and files it under its name.\n*/\nfunction buildRoleBlocks(namespaceId, entries) {\n\treturn Object.entries(entries ?? {}).map(([name, entity]) => {\n\t\tinvariant(entity instanceof PostgresRole, `\"role\" entry \"${name}\" in namespace \"${namespaceId}\" is not a role`);\n\t\trefuseRoleOutsideUnbound(namespaceId, name);\n\t\trefuseEntryInOtherNamespace({\n\t\t\tnamespaceId,\n\t\t\tkind: \"role\",\n\t\t\tname,\n\t\t\trecordedNamespaceId: entity.namespaceId\n\t\t});\n\t\trefuseEntryFiledUnderAnotherName({\n\t\t\tnamespaceId,\n\t\t\tkind: \"role\",\n\t\t\tname,\n\t\t\treadsBackAs: entity.name\n\t\t});\n\t\trefuseUnwritableName(\"role\", entity.name);\n\t\treturn {\n\t\t\tkind: \"role\",\n\t\t\tkeyword: \"role\",\n\t\t\tname: entity.name,\n\t\t\tparameters: {},\n\t\t\tblockAttributes: [],\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t};\n\t});\n}\n/**\n* Whether the PSL source, reading a policy block named `head`, derives this\n* policy's name: the block name with the hash of the policy's content for a\n* wire-named policy, or the `@@map` name for an exact one.\n*/\nfunction policyNameReadsBack(head, policy) {\n\tif (policy.prefix === void 0) return true;\n\tconst hash = computeContentHash({\n\t\t...policy.using === void 0 ? {} : { using: policy.using },\n\t\t...policy.withCheck === void 0 ? {} : { withCheck: policy.withCheck },\n\t\troles: policy.roles,\n\t\toperation: policy.operation,\n\t\tpermissive: policy.permissive\n\t});\n\treturn policy.prefix === head && policy.name === formatWireName(head, hash);\n}\n/**\n* One `policy_<operation>` block per policy, named by its entry key, which is\n* the block head it was authored under. A policy with an exact name also\n* prints `@@map` with that name.\n*/\nfunction buildPolicyBlocks(input) {\n\treturn Object.entries(input.entries ?? {}).map(([head, policy]) => {\n\t\tinvariant(policy instanceof PostgresRlsPolicy, `\"policy\" entry \"${head}\" in namespace \"${input.namespaceId}\" is not a policy`);\n\t\trefuseUnwritableName(\"policy\", head);\n\t\trefuseEntryInOtherNamespace({\n\t\t\tnamespaceId: input.namespaceId,\n\t\t\tkind: \"policy\",\n\t\t\tname: head,\n\t\t\trecordedNamespaceId: policy.namespaceId\n\t\t});\n\t\tconst modelName = input.modelNameForTable(policy.tableName);\n\t\tif (modelName === void 0) refusePolicyWithoutModel(policy);\n\t\tif (!input.rlsTables.has(policy.tableName)) refusePolicyWithoutRls(policy);\n\t\tif (!policyNameReadsBack(head, policy)) refusePolicyNameNotDerived(policy);\n\t\tfor (const role of policy.roles) refuseUnwritableName(\"role\", role);\n\t\treturn {\n\t\t\tkind: \"policy\",\n\t\t\tkeyword: POLICY_BLOCK_KEYWORDS[policy.operation],\n\t\t\tname: head,\n\t\t\tparameters: {\n\t\t\t\ttarget: {\n\t\t\t\t\texpression: modelName,\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t},\n\t\t\t\troles: {\n\t\t\t\t\texpression: `[${policy.roles.join(\", \")}]`,\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t},\n\t\t\t\t...policy.using !== void 0 ? { using: {\n\t\t\t\t\texpression: JSON.stringify(policy.using),\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t} } : {},\n\t\t\t\t...policy.withCheck !== void 0 ? { withCheck: {\n\t\t\t\t\texpression: JSON.stringify(policy.withCheck),\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t} } : {},\n\t\t\t\t...policy.permissive ? {} : { permissive: {\n\t\t\t\t\texpression: \"false\",\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t} }\n\t\t\t},\n\t\t\tblockAttributes: policy.prefix === void 0 ? [{\n\t\t\t\tname: \"map\",\n\t\t\t\targs: [{\n\t\t\t\t\tkind: \"positional\",\n\t\t\t\t\tvalue: `\"${escapePslString(policy.name)}\"`,\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t}],\n\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t}] : [],\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t};\n\t});\n}\n//#endregion\n//#region src/core/psl-print/column-defaults.ts\n/**\n* The `@default(…)` attribute for a storage column, or `undefined` when the column carries no\n* default.\n*\n* A literal prints as the PSL literal the data type of the column's codec reads back, through the\n* stack's data types, with the mapping `contract infer` uses. An enum column's default is a member\n* name, which reads as text; a domain enum's literal prints as the member name that carries it.\n* `now()` and `autoincrement()` print by name; every other function default prints as a `sql`\n* tagged literal.\n*\n* A literal is refused when the column's codec has no data type in the stack, or when no PSL\n* literal of that data type reads back as the stored value.\n*/\nfunction buildColumnDefault(input) {\n\tconst columnDefault = input.column.default;\n\tif (columnDefault === void 0) return;\n\tconst coordinate = `\"${input.namespaceId}\".\"${input.tableName}\".\"${input.columnName}\"`;\n\tif (input.domainEnum !== void 0 && columnDefault.kind === \"literal\") {\n\t\tconst memberName = input.domainEnum.members.find((member) => member.value === columnDefault.value)?.name;\n\t\tif (memberName === void 0) refuseDefaultOutsideEnum({\n\t\t\tcoordinate,\n\t\t\tvalue: columnDefault.value,\n\t\t\tpslTypeName: input.pslTypeName\n\t\t});\n\t\treturn buildAttribute(\"field\", \"default\", [positionalArg(memberName)]);\n\t}\n\tconst { context } = input;\n\tconst result = mapDefault(columnDefault, {\n\t\tdataTypeEntries: context.authoringContributions.dataTypes,\n\t\tdataTypes: context.dataTypeLookup,\n\t\tcolumnDataType: context.codecLookup.descriptorFor?.(input.isEnum ? PG_TEXT_CODEC_ID : input.column.codecId)?.dataType,\n\t\tlist: input.column.many === true\n\t});\n\tif (result === void 0) refuseUnwritableLiteralDefault({\n\t\tcoordinate,\n\t\twritten: columnDefault.kind === \"literal\" ? JSON.stringify(columnDefault.value) : columnDefault.expression,\n\t\tpslTypeName: input.pslTypeName\n\t});\n\treturn parseDefaultAttributeString(result.attribute);\n}\n//#endregion\n//#region src/core/psl-print/generated-values.ts\n/**\n* The `temporal.*` field preset each codec with a \"now\" generator is authored through. The target\n* contributes the presets; `test/integration/test/psl-print/generated-values-roundtrip.integration.test.ts` writes and\n* reads back every one the stack contributes, so this table cannot drift from them.\n*/\nconst TEMPORAL_PRESET_NAMES = /* @__PURE__ */ new Map([\n\t[PG_TIMESTAMP_TEMPORAL_CODEC_ID, \"timestamp\"],\n\t[PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, \"timestamptz\"],\n\t[PG_TIMESTAMP_STRING_CODEC_ID, \"timestampString\"],\n\t[PG_TIMESTAMPTZ_STRING_CODEC_ID, \"timestamptzString\"],\n\t[PG_TIMESTAMPTZ_DATE_CODEC_ID, \"timestamptzJsDate\"]\n]);\nconst GENERATOR_CALLS = /* @__PURE__ */ new Map([\n\t[\"uuidv4\", () => \"uuid()\"],\n\t[\"uuidv7\", () => \"uuid(7)\"],\n\t[\"cuid2\", () => \"cuid(2)\"],\n\t[\"ulid\", () => \"ulid()\"],\n\t[\"nanoid\", (params) => typeof params?.[\"size\"] === \"number\" ? `nanoid(${params[\"size\"]})` : \"nanoid()\"]\n]);\n/**\n* How one column's execution generators are written in PSL: an id generator as a `@default(<fn>())`\n* attribute, and a wall-clock-now generator as the `temporal.*` preset the column's codec is\n* authored through.\n*/\nfunction buildExecutionDefault(input) {\n\tconst { executionDefault, codecId, coordinate } = input;\n\tconst onCreateId = executionDefault.onCreate?.id;\n\tconst onUpdateId = executionDefault.onUpdate?.id;\n\tconst nowGeneratorId = postgresNowGeneratorIdFor(codecId);\n\tconst presetName = TEMPORAL_PRESET_NAMES.get(codecId);\n\tif (nowGeneratorId !== void 0 && presetName !== void 0) {\n\t\tconst onCreate = onCreateId === nowGeneratorId;\n\t\tconst onUpdate = onUpdateId === nowGeneratorId;\n\t\tif (onCreate || onUpdate) {\n\t\t\tif (onCreateId !== void 0 && !onCreate || onUpdateId !== void 0 && !onUpdate) refuseNowGeneratorPairedWithAnother({\n\t\t\t\tcoordinate,\n\t\t\t\tonCreate: onCreateId,\n\t\t\t\tonUpdate: onUpdateId,\n\t\t\t\tother: onCreate ? onUpdateId : onCreateId\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tkind: \"temporal\",\n\t\t\t\tphases: {\n\t\t\t\t\tpresetName,\n\t\t\t\t\tonCreate,\n\t\t\t\t\tonUpdate\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\tconst phases = {\n\t\tcoordinate,\n\t\tonCreate: onCreateId,\n\t\tonUpdate: onUpdateId\n\t};\n\tif (onUpdateId !== void 0) refuseGeneratorOnUpdate(phases);\n\tconst call = onCreateId === void 0 ? void 0 : GENERATOR_CALLS.get(onCreateId);\n\tif (call === void 0) refuseGeneratorWithoutPslFunction(phases);\n\treturn {\n\t\tkind: \"attribute\",\n\t\tattribute: buildAttribute(\"field\", \"default\", [positionalArg(call(executionDefault.onCreate?.params))])\n\t};\n}\n/** The `temporal.<preset>(precision?, onCreate: now, onUpdate: now)` argument list. */\nfunction temporalPresetArguments(input) {\n\tconst args = [];\n\tif (typeof input.precision === \"number\") args.push(positionalArg(String(input.precision)));\n\tif (input.phases.onCreate) args.push(namedArg(\"onCreate\", \"now\"));\n\tif (input.phases.onUpdate) args.push(namedArg(\"onUpdate\", \"now\"));\n\treturn args;\n}\n//#endregion\n//#region src/core/psl-print/scalar-fields.ts\n/** The generated values of the contract, keyed by the column they fill. */\nfunction executionDefaultsByColumn(contract) {\n\tconst byColumn = /* @__PURE__ */ new Map();\n\tfor (const entry of contract.execution?.mutations.defaults ?? []) byColumn.set(JSON.stringify([\n\t\tentry.ref.namespace,\n\t\tentry.ref.entry,\n\t\tentry.ref.field\n\t]), entry);\n\treturn byColumn;\n}\nfunction scalarFieldAttributes(input) {\n\tconst attributes = [];\n\tif (input.isSingleColumnId) attributes.push(buildAttribute(\"field\", \"id\", input.primaryKeyName === void 0 ? [] : [namedArg(\"map\", `\"${escapePslString(input.primaryKeyName)}\"`)]));\n\tconst columnDefault = input.generatedDefault ?? buildColumnDefault({\n\t\tcolumn: input.column,\n\t\tpslTypeName: input.pslTypeName,\n\t\tisEnum: input.isEnum,\n\t\tdomainEnum: input.domainEnum,\n\t\tnamespaceId: input.namespaceId,\n\t\ttableName: input.tableName,\n\t\tcolumnName: input.columnName,\n\t\tcontext: input.context\n\t});\n\tif (columnDefault !== void 0) attributes.push(columnDefault);\n\tfor (const kind of input.column.noCheck ?? []) attributes.push(buildAttribute(\"field\", \"noCheck\", [positionalArg(kind)]));\n\tconst mapName = pslFieldMapName(input.fieldName, input.columnName);\n\tif (mapName !== void 0) attributes.push(buildMapAttribute(\"field\", mapName));\n\treturn attributes;\n}\n/**\n* The scalar and value-object fields of one model, one per column its storage names. Each generated\n* value written with a field is added to `writtenExecutionDefaults`.\n*/\nfunction buildScalarFields(input) {\n\tconst { entry, variant, enums, domainEnums, typeMap, context, executionDefaults } = input;\n\tconst primaryKeyColumns = variant === void 0 ? entry.table.primaryKey?.columns ?? [] : [];\n\tconst fields = [];\n\trefuseFieldsWithoutColumn(entry);\n\tfor (const [fieldName, fieldStorage] of Object.entries(entry.storage.fields)) {\n\t\tconst columnName = fieldStorage.column;\n\t\tconst coordinate = `\"${entry.namespaceId}\".\"${entry.tableName}\".\"${columnName}\"`;\n\t\tconst column = entry.table.columns[columnName];\n\t\tconst field = entry.model.fields[fieldName];\n\t\tassertDefined(column, `column ${coordinate} is not declared by its table`);\n\t\tif (field === void 0) refuseStorageOfUndeclaredField({\n\t\t\tentry,\n\t\t\tfieldName,\n\t\t\tcoordinate\n\t\t});\n\t\trefuseUnwritableName(\"field\", fieldName);\n\t\trefuseUnwritableMappedName(\"column\", columnName);\n\t\trefuseUnwritableFieldShape(field, coordinate);\n\t\trefuseColumnControl(column, coordinate);\n\t\trefuseFieldColumnMismatch({\n\t\t\tfield,\n\t\t\tcolumn,\n\t\t\tcoordinate,\n\t\t\tmodelName: entry.name,\n\t\t\tsingleTableVariant: variant?.singleTable === true,\n\t\t\tdomainEnumNames: input.defaultDomainEnumNames\n\t\t});\n\t\tif (column.typeRef !== void 0) refuseColumnDifferingFromNamedType({\n\t\t\tcolumn,\n\t\t\ttypeRef: column.typeRef,\n\t\t\tnamedType: input.namedTypes[column.typeRef],\n\t\t\tcoordinate\n\t\t});\n\t\tconst columnType = column.typeRef !== void 0 ? { typeName: column.typeRef } : field.type.kind === \"valueObject\" ? buildDomainFieldType({\n\t\t\tfield,\n\t\t\tcoordinate,\n\t\t\ttypeMap,\n\t\t\tcontext,\n\t\t\tenumBlockNames: enums.blockNamesByTypeName\n\t\t}) : buildColumnType({\n\t\t\tcolumn,\n\t\t\ttypeMap,\n\t\t\tauthoringTypes: context.authoringContributions.type,\n\t\t\tenumBlockNames: enums.blockNamesByTypeName,\n\t\t\tcoordinate\n\t\t});\n\t\tlet { typeName, typeConstructor } = columnType;\n\t\tconst execution = executionDefaults.get(JSON.stringify([\n\t\t\tentry.namespaceId,\n\t\t\tentry.tableName,\n\t\t\tcolumnName\n\t\t]));\n\t\tlet generatedDefault;\n\t\tif (execution !== void 0) {\n\t\t\tinput.writtenExecutionDefaults.add(execution);\n\t\t\tconst built = buildExecutionDefault({\n\t\t\t\texecutionDefault: execution,\n\t\t\t\tcodecId: column.codecId,\n\t\t\t\tcoordinate\n\t\t\t});\n\t\t\tif (built.kind === \"temporal\") {\n\t\t\t\ttypeName = `temporal.${built.phases.presetName}`;\n\t\t\t\ttypeConstructor = {\n\t\t\t\t\tkind: \"typeConstructor\",\n\t\t\t\t\tpath: [\"temporal\", built.phases.presetName],\n\t\t\t\t\targs: temporalPresetArguments({\n\t\t\t\t\t\tphases: built.phases,\n\t\t\t\t\t\tprecision: column.typeParams?.[\"precision\"]\n\t\t\t\t\t}),\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t};\n\t\t\t} else if (column.default !== void 0) refuseGeneratorWithDatabaseDefault({\n\t\t\t\tcoordinate,\n\t\t\t\tonCreate: execution.onCreate?.id\n\t\t\t});\n\t\t\telse generatedDefault = built.attribute;\n\t\t}\n\t\tfields.push({\n\t\t\tkind: \"field\",\n\t\t\tname: fieldName,\n\t\t\ttypeName,\n\t\t\t...ifDefined(\"typeConstructor\", typeConstructor),\n\t\t\toptional: field.nullable,\n\t\t\tlist: field.many === true,\n\t\t\tattributes: scalarFieldAttributes({\n\t\t\t\tcolumn,\n\t\t\t\tfieldName,\n\t\t\t\tnamespaceId: entry.namespaceId,\n\t\t\t\ttableName: entry.tableName,\n\t\t\t\tcolumnName,\n\t\t\t\tisSingleColumnId: primaryKeyColumns.length === 1 && primaryKeyColumns[0] === columnName,\n\t\t\t\tprimaryKeyName: entry.table.primaryKey?.name,\n\t\t\t\tpslTypeName: columnType.typeName,\n\t\t\t\tisEnum: column.codecId === PG_ENUM_CODEC_ID,\n\t\t\t\tdomainEnum: column.codecId === \"pg/enum@1\" || column.valueSet === void 0 ? void 0 : domainEnums[column.valueSet.entityName],\n\t\t\t\tgeneratedDefault,\n\t\t\t\tcontext\n\t\t\t}),\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t});\n\t}\n\treturn fields;\n}\n//#endregion\n//#region src/core/psl-print/psl-contract.ts\n/** The native enums of one namespace, keyed as the contract keys them. */\nfunction nativeEnumsOf(namespaceId, entries) {\n\tconst nativeEnums = /* @__PURE__ */ new Map();\n\tfor (const [name, entity] of Object.entries(entries[\"native_enum\"] ?? {})) {\n\t\tinvariant(PostgresNativeEnum.is(entity), `\"native_enum\" entry \"${name}\" in namespace \"${namespaceId}\" is not a native enum`);\n\t\tnativeEnums.set(name, entity);\n\t}\n\treturn nativeEnums;\n}\n/** The value sets the PSL source derives for a namespace from the enum blocks written for it. */\nfunction derivedValueSetsOf(namespaceId, enums, defaultDomainEnums) {\n\tconst derived = new Map(enums.derivedValueSets);\n\tif (namespaceId !== \"public\") return derived;\n\tfor (const [name, domainEnum] of Object.entries(defaultDomainEnums)) {\n\t\tif (derived.has(name)) refuseEnumAndNativeEnumSharingName(namespaceId, name);\n\t\tderived.set(name, domainEnum.members.map((member) => member.value));\n\t}\n\treturn derived;\n}\n/** One model of a namespace, with its fields and attributes. */\nfunction buildModel(all, entry, enums, rlsTables) {\n\tconst { models, variants, relationsByModel, byCoordinate } = all;\n\trefuseUnwritableName(\"model\", entry.name);\n\trefuseModelOwner(entry);\n\tconst variant = variants.get(entry);\n\tif (variant !== void 0 && !variant.singleTable) refuseUnderivedVariantLink(entry, variant);\n\tconst singleTableVariants = models.filter((other) => other !== entry && variants.get(other)?.singleTable === true && variants.get(other)?.base === entry);\n\tconst travelledForeignKeys = /* @__PURE__ */ new Set();\n\tconst fields = [...buildScalarFields({\n\t\tentry,\n\t\tvariant,\n\t\tenums,\n\t\tdomainEnums: all.contract.domain.namespaces[entry.namespaceId]?.enum ?? {},\n\t\ttypeMap: all.typeMap,\n\t\tcontext: all.context,\n\t\texecutionDefaults: all.executionDefaults,\n\t\twrittenExecutionDefaults: all.writtenExecutionDefaults,\n\t\tdefaultDomainEnumNames: new Set(Object.keys(all.defaultDomainEnums)),\n\t\tnamedTypes: all.contract.storage.types ?? {}\n\t}), ...buildRelationFields({\n\t\tentry,\n\t\tvariant,\n\t\trelations: relationsByModel.get(modelCoordinate(entry.namespaceId, entry.name)) ?? [],\n\t\trelationsByModel,\n\t\tmodelsByCoordinate: byCoordinate,\n\t\tpinned: all.pinned,\n\t\ttravelledForeignKeys\n\t})];\n\tif (variant?.singleTable !== true) for (const other of singleTableVariants) for (const relation of relationsByModel.get(modelCoordinate(entry.namespaceId, other.name)) ?? []) {\n\t\tconst target = byCoordinate.get(relation.targetCoordinate);\n\t\tconst fk = target === void 0 ? void 0 : foreignKeyFor(relation, target);\n\t\tif (fk !== void 0) travelledForeignKeys.add(fk);\n\t}\n\trefuseUntravelledForeignKeys(entry, variant, travelledForeignKeys);\n\tconst checks = derivedChecks({\n\t\ttable: entry.table,\n\t\ttableName: entry.tableName,\n\t\tmanaged: effectiveControlPolicy(entry.table.control, all.contract.defaultControlPolicy) === \"managed\",\n\t\tdomainEnumValues: all.domainEnumValues\n\t});\n\tif (variant?.singleTable !== true) refuseUnderivedChecks(entry, checks);\n\treturn {\n\t\tkind: \"model\",\n\t\tname: entry.name,\n\t\tfields,\n\t\tattributes: buildModelAttributes({\n\t\t\tentry,\n\t\t\tvariant,\n\t\t\tsingleTableVariants,\n\t\t\tderivedChecksByName: checks,\n\t\t\trlsEnabled: rlsTables.has(entry.tableName)\n\t\t}),\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\n/**\n* The namespace block of one storage namespace: its models, value objects, enum blocks, roles and\n* policies. `undefined` when the namespace holds none of them.\n*/\nfunction buildNamespace(all, namespaceId, namespace) {\n\tconst { contract, models, variants } = all;\n\trefuseUnprintedEntryKinds(namespaceId, namespace.entries);\n\tconst valueSets = new Map(Object.entries(namespace.entries.valueSet ?? {}).map(([name, valueSet]) => [name, valueSet.values]));\n\tconst enums = buildNativeEnumBlocksForNamespace({\n\t\tnamespaceId,\n\t\tnativeEnums: nativeEnumsOf(namespaceId, namespace.entries),\n\t\tvalueSets,\n\t\tcolumns: models.filter((entry) => entry.namespaceId === namespaceId).flatMap((entry) => Object.values(entry.table.columns))\n\t});\n\trefuseUnderivedValueSets({\n\t\tnamespaceId,\n\t\tactual: valueSets,\n\t\tderived: derivedValueSetsOf(namespaceId, enums, all.defaultDomainEnums)\n\t});\n\tconst rlsTables = rlsEnabledTables(namespaceId, namespace.entries[\"rls\"]);\n\tconst namespaceModels = models.filter((entry) => entry.namespaceId === namespaceId).map((entry) => buildModel(all, entry, enums, rlsTables));\n\tconst compositeTypes = buildCompositeTypes({\n\t\tcontract,\n\t\tnamespaceId,\n\t\ttypeMap: all.typeMap,\n\t\tcontext: all.context,\n\t\tenumBlockNames: enums.blockNamesByTypeName\n\t});\n\tconst modelNameForTable = (tableName) => models.find((entry) => entry.namespaceId === namespaceId && entry.tableName === tableName && variants.get(entry)?.singleTable !== true)?.name;\n\tfor (const tableName of rlsTables) if (modelNameForTable(tableName) === void 0) refuseRlsWithoutModel(namespaceId, tableName);\n\tconst blocks = [\n\t\t...enums.blocks,\n\t\t...buildRoleBlocks(namespaceId, namespace.entries[\"role\"]),\n\t\t...buildPolicyBlocks({\n\t\t\tnamespaceId,\n\t\t\tentries: namespace.entries[\"policy\"],\n\t\t\tmodelNameForTable,\n\t\t\trlsTables\n\t\t})\n\t];\n\tif (namespaceModels.length === 0 && blocks.length === 0 && compositeTypes.length === 0) return;\n\trefuseNamespaceNamedUnbound(namespaceId);\n\tconst name = pslNamespaceName(namespaceId);\n\trefuseUnwritableName(\"namespace\", name);\n\treturn makePslNamespace({\n\t\tkind: \"namespace\",\n\t\tname,\n\t\tentries: makePslNamespaceEntries(namespaceModels, compositeTypes, blocks),\n\t\tspan: SYNTHETIC_SPAN\n\t});\n}\nfunction refuseUnwritableTableNames(contract) {\n\tfor (const domainNamespace of Object.values(contract.domain.namespaces)) for (const model of Object.values(domainNamespace.models)) refuseUnwritableMappedName(\"table\", blindCast(model.storage).table);\n}\n/**\n* Builds the Prisma 8 PSL document a Postgres contract was, or would have been, authored as: every\n* model with its columns, keys, indexes and relations, every value object, every named type and\n* every native enum, in the namespace block that carries it.\n*\n* Read back by the PSL contract source with the same stack, the document yields the contract it was\n* built from. Anything the language cannot carry is refused by name. `contract` must be one the\n* Postgres contract serializer accepted: its structure is asserted, not checked again.\n*/\nfunction buildPostgresPslContract(contract, context) {\n\trefuseUnwritableTableNames(contract);\n\tconst models = indexContractModels(contract);\n\trefuseDuplicateModelNames(models);\n\tconst byCoordinate = modelsByCoordinate(models);\n\tconst relations = collectRelations(models);\n\tconst byModel = relationsByModel(relations);\n\tconst defaultDomainEnums = contract.domain.namespaces[\"public\"]?.enum ?? {};\n\tconst all = {\n\t\tcontract,\n\t\tcontext,\n\t\ttypeMap: createPostgresTypeMap(),\n\t\tmodels,\n\t\tbyCoordinate,\n\t\tvariants: new Map(models.map((entry) => [entry, variantInfo(entry, byCoordinate)])),\n\t\trelationsByModel: byModel,\n\t\tpinned: resolvePinnedRelations(relations, byModel),\n\t\texecutionDefaults: executionDefaultsByColumn(contract),\n\t\twrittenExecutionDefaults: /* @__PURE__ */ new Set(),\n\t\tdefaultDomainEnums,\n\t\tdomainEnumValues: new Map(Object.entries(defaultDomainEnums).map(([name, domainEnum]) => [name, domainEnum.members.map((member) => member.value)]))\n\t};\n\tconst namespaces = [];\n\trefuseEnumsOutsideDefaultNamespace(contract);\n\tconst topLevelEnums = buildDomainEnumBlocks(defaultDomainEnums);\n\tif (topLevelEnums.length > 0) namespaces.push(makePslNamespace({\n\t\tkind: \"namespace\",\n\t\tname: UNSPECIFIED_PSL_NAMESPACE_ID,\n\t\tentries: makePslNamespaceEntries([], [], topLevelEnums),\n\t\tspan: SYNTHETIC_SPAN\n\t}));\n\tconst writtenStorageNamespaces = /* @__PURE__ */ new Set();\n\tfor (const [namespaceId, namespace] of Object.entries(contract.storage.namespaces)) {\n\t\tconst built = buildNamespace(all, namespaceId, namespace);\n\t\tif (built === void 0) continue;\n\t\twrittenStorageNamespaces.add(namespaceId);\n\t\tnamespaces.push(built);\n\t}\n\trefuseUnmodelledTablesAndColumns(contract, models, all.variants);\n\trefuseUnwrittenNamespaces({\n\t\tcontract,\n\t\tmodels,\n\t\twrittenStorageNamespaces\n\t});\n\trefuseUnwrittenExecutionDefaults(contract, all.writtenExecutionDefaults);\n\trefuseContractMeta(contract);\n\trefuseUnderivedRoots(contract, models, all.variants);\n\treturn {\n\t\tkind: \"document\",\n\t\tsourceId: \"<contract>\",\n\t\tnamespaces,\n\t\t...ifDefined(\"types\", buildTypesBlock(contract, all.typeMap, context)),\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\n//#endregion\n//#region src/exports/control.ts\nfunction postgresRenderDefault(def, column) {\n\tif (def.kind === \"function\") return def.expression;\n\treturn renderDefaultLiteral(def.value, column);\n}\nfunction createPostgresTargetDescriptor() {\n\tsetFallbackTemporal(Temporal);\n\treturn {\n\t\t...postgresTargetDescriptorMeta,\n\t\tcontractSerializer: new PostgresContractSerializer(),\n\t\tschemaVerifier: new PostgresSchemaVerifier(),\n\t\tinferPslContract(schema, describedContracts) {\n\t\t\tPostgresDatabaseSchemaNode.assert(schema);\n\t\t\treturn inferPostgresPslContract(schema, describedContracts);\n\t\t},\n\t\tbuildPslContract(contract, context) {\n\t\t\treturn buildPostgresPslContract(contract, context);\n\t\t},\n\t\tdiffSchema(input) {\n\t\t\treturn diffPostgresSchema(input);\n\t\t},\n\t\tclassifySubjectGranularity: postgresDiffSubjectGranularity,\n\t\tclassifyEntityKind: postgresDiffSubjectEntityKind,\n\t\tmigrations: {\n\t\t\tcreatePlanner(adapter) {\n\t\t\t\treturn createPostgresMigrationPlanner(adapter);\n\t\t\t},\n\t\t\tcreateRunner(family) {\n\t\t\t\treturn blindCast(createPostgresMigrationRunner(family));\n\t\t\t},\n\t\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\t\tconst expander = buildNativeTypeExpander(frameworkComponents);\n\t\t\t\treturn contractToPostgresDatabaseSchemaNode(blindCast(contract), {\n\t\t\t\t\tannotationNamespace: \"pg\",\n\t\t\t\t\t...ifDefined(\"expandNativeType\", expander),\n\t\t\t\t\trenderDefault: postgresRenderDefault,\n\t\t\t\t\tresolveDefault: postgresResolveDefault,\n\t\t\t\t\t...ifDefined(\"dataTypeOf\", buildDataTypeResolver(frameworkComponents))\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcreate() {\n\t\t\treturn {\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\"\n\t\t\t};\n\t\t},\n\t\t/**\n\t\t* Direct method for SQL-specific usage.\n\t\t* @deprecated Use migrations.createPlanner() for CLI compatibility.\n\t\t*/\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createPostgresMigrationPlanner(adapter);\n\t\t},\n\t\t/**\n\t\t* Direct method for SQL-specific usage.\n\t\t* @deprecated Use migrations.createRunner() for CLI compatibility.\n\t\t*/\n\t\tcreateRunner(family) {\n\t\t\treturn createPostgresMigrationRunner(family);\n\t\t}\n\t};\n}\nconst postgresTargetDescriptor = createPostgresTargetDescriptor();\n//#endregion\nexport { INSTANT_NOW_GENERATOR_ID, PLAIN_DATE_TIME_NOW_GENERATOR_ID, decodePostgresListText, postgresTargetDescriptor as default, instantNowControlDescriptor, parsePostgresListText, plainDateTimeNowControlDescriptor, postgresRenderDefault };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,cAAc;;;;;AAKpB,SAAS,qBAAqB,OAAO;CACpC,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,KAAK,GAAG,IAAI,QAAQ,QAAQ,QA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],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { canonicalDateTime, isNonFiniteText, numeralText } from \"@internal/sql-relational-core/ast\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { dataType } from \"@internal/framework-components/codec\";\nimport { type } from \"arktype\";\n//#region src/core/codec-helpers.ts\nconst precisionParamsSchema = type({ \"precision?\": \"number.integer >= 0 & number.integer <= 6\" });\nfunction renderLength(typeName, typeParams) {\n\tconst length = typeParams.length;\n\tif (length === void 0) return;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length)) throw postgresError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"length\" in typeParams for ${typeName}, got ${String(length)}`, { meta: {\n\t\tnativeType: typeName,\n\t\tparam: \"length\",\n\t\treceived: String(length)\n\t} });\n\treturn `${typeName}<${length}>`;\n}\nfunction renderPrecision(typeName, typeParams) {\n\tconst precision = typeParams.precision;\n\tif (precision === void 0) return typeName;\n\tif (typeof precision !== \"number\" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw postgresError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"precision\" in typeParams for ${typeName}, got ${String(precision)}`, { meta: {\n\t\tnativeType: typeName,\n\t\tparam: \"precision\",\n\t\treceived: String(precision)\n\t} });\n\treturn `${typeName}<${precision}>`;\n}\n/**\n* A `numeric` value as its canonical decimal text. A number is written out without an exponent,\n* because `numeric` text has no exponent syntax and `encodeJson` refuses one.\n*/\nconst pgNumericDecode = (wire) => {\n\tif (typeof wire === \"number\") return numeralText(wire);\n\treturn wire;\n};\nconst DECIMAL_INTEGER = /^-?\\d+$/;\n/**\n* Requires an application value to be of the JS type the codec reads.\n*\n* A range check reads a value of the wrong type as a value out of range, and\n* reports a number plainly inside the range as outside it — so the type is\n* established first and answered for on its own terms, naming what a caller\n* has to change.\n*/\nconst requireJsType = (codecId, expected, value) => {\n\tif (typeof value === expected) return;\n\tthrow postgresError(\"RUNTIME.ENCODE_FAILED\", `${codecId} value must be a ${expected}, got ${typeof value} ${String(value)}`, { meta: {\n\t\tcodecId,\n\t\treceived: typeof value\n\t} });\n};\n/** Writes a `bigint` application value as the decimal text the wire form of the exact integer codecs carries. */\nconst pgBigintEncode = (codecId, value) => {\n\trequireJsType(codecId, \"bigint\", value);\n\treturn value.toString();\n};\n/**\n* Writes an application value as the decimal text these codecs carry as their\n* canonical JSON.\n*\n* A schema-written literal default (`BigInt @default(0)`) arrives here as a\n* `number`, since a number literal is the only integer a schema language\n* writes, and one that is a safe integer names its value exactly. Past that\n* range the literal was rounded before any of this ran, so the value written is\n* not the value meant — which this refuses rather than minting an exact-looking\n* total from it. A non-integral number is refused on the same terms.\n*/\nconst pgBigintEncodeJson = (codecId, value) => {\n\tif (typeof value !== \"number\") return pgBigintEncode(codecId, value);\n\tif (!Number.isSafeInteger(value)) throw postgresError(\"RUNTIME.ENCODE_FAILED\", `${codecId} number literal must be an integer within the safe integer range, got ${String(value)}`, { meta: {\n\t\tcodecId,\n\t\treceived: String(value)\n\t} });\n\treturn BigInt(value).toString();\n};\n/**\n* Reads a wire or JSON value as a `bigint`, rejecting anything `BigInt()` would\n* misread. A number-typed wire value must also be a safe integer: past\n* ±(2^53 − 1) the driver's `number` has already rounded, so stringifying it\n* would mint a spuriously-exact `bigint` that need not equal the stored value.\n*/\nconst decimalIntegerDecode = (codecId, wire) => {\n\tif (typeof wire === \"bigint\") return wire;\n\tconst text = String(wire);\n\tif (!DECIMAL_INTEGER.test(text)) throw postgresError(\"RUNTIME.DECODE_FAILED\", `${codecId} value must be a decimal integer`, { meta: {\n\t\tcodecId,\n\t\treceived: text\n\t} });\n\tif (typeof wire === \"number\" && !Number.isSafeInteger(wire)) throw postgresError(\"RUNTIME.DECODE_FAILED\", `${codecId} wire number must be an integer within the safe integer range, got ${text}`, { meta: {\n\t\tcodecId,\n\t\treceived: text\n\t} });\n\treturn BigInt(text);\n};\n/** Reads an `int8` wire or JSON value as a `bigint`, rejecting anything `BigInt()` would misread. */\nconst pgInt8Decode = (wire) => decimalIntegerDecode(\"pg/int8@1\", wire);\n/**\n* Reads an unconstrained-`numeric` wire or JSON value as a `bigint`, rejecting\n* non-integral values — including `NaN` and the infinities, which are `numeric`\n* values but not integers.\n*/\nconst pgUnboundedIntDecode = (wire) => decimalIntegerDecode(\"pg/unboundedint@1\", wire);\n/**\n* Neither JSON nor a SQL number literal has a form for `NaN` or the infinities; PostgreSQL reads\n* and writes them as the text `NaN`, `Infinity`, `-Infinity`, so the float codecs carry them as\n* that text on the wire and in JSON.\n*/\nconst pgFloatEncode = (value) => Number.isFinite(value) ? value : String(value);\nconst pgFloatEncodeJson = (value) => pgFloatEncode(value);\nconst pgFloatDecodeJson = (codecId, json) => {\n\tif (typeof json === \"number\") return json;\n\tif (typeof json === \"string\" && isNonFiniteText(json)) return Number(json);\n\tthrow postgresError(\"RUNTIME.DECODE_FAILED\", `${codecId} database JSON value must be a number or the text NaN, Infinity or -Infinity`, { meta: {\n\t\tcodecId,\n\t\treceived: typeof json\n\t} });\n};\nconst MIN_SAFE_INTEGER_BIGINT = BigInt(Number.MIN_SAFE_INTEGER);\nconst MAX_SAFE_INTEGER_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);\n/**\n* Requires an integer within ±(2^53 − 1), the range a JS `number` holds\n* exactly. The guard throws rather than rounding: past the boundary a `number`\n* silently loses digits, which is the failure mode this codec exists to refuse.\n*/\nconst pgInt8NumberGuard = (code, value) => {\n\tif (!Number.isSafeInteger(value)) throw postgresError(code, `pg/int8number@1 value must be an integer within the safe integer range, got ${String(value)}`, { meta: {\n\t\tcodecId: \"pg/int8number@1\",\n\t\treceived: String(value)\n\t} });\n\treturn value;\n};\nconst pgInt8NumberEncode = (value) => {\n\trequireJsType(\"pg/int8number@1\", \"number\", value);\n\treturn String(pgInt8NumberGuard(\"RUNTIME.ENCODE_FAILED\", value));\n};\nconst pgInt8NumberEncodeJson = (value) => pgInt8NumberEncode(value);\n/**\n* Reads an `int8` wire value as a `number`, throwing outside ±(2^53 − 1) and on\n* non-integral input. Decimal text goes through `BigInt` before the range check\n* so an out-of-range value is compared exactly rather than after rounding.\n*/\nconst pgInt8NumberDecode = (wire) => {\n\tif (typeof wire === \"number\") return pgInt8NumberGuard(\"RUNTIME.DECODE_FAILED\", wire);\n\tconst value = decimalIntegerDecode(\"pg/int8number@1\", wire);\n\tif (value < MIN_SAFE_INTEGER_BIGINT || value > MAX_SAFE_INTEGER_BIGINT) throw postgresError(\"RUNTIME.DECODE_FAILED\", `pg/int8number@1 value must be an integer within the safe integer range, got ${value}`, { meta: {\n\t\tcodecId: \"pg/int8number@1\",\n\t\treceived: value.toString()\n\t} });\n\treturn Number(value);\n};\nconst pgInt8NumberDecodeJson = (json) => {\n\tif (typeof json !== \"string\") throw postgresError(\"RUNTIME.DECODE_FAILED\", \"pg/int8number@1 database JSON value must be decimal text\", { meta: {\n\t\tcodecId: \"pg/int8number@1\",\n\t\treceived: typeof json\n\t} });\n\treturn pgInt8NumberDecode(json);\n};\n/**\n* Renders a decimal-text default as a `bigint` literal, for the codecs whose\n* canonical JSON is decimal text while the application type is `bigint`\n* (`pg/int8@1`, `pg/unboundedint@1`) — a plain string literal would not\n* typecheck against the emitted column type.\n*/\nconst decimalTextBigintLiteral = (value) => typeof value === \"string\" && DECIMAL_INTEGER.test(value) ? `${value}n` : void 0;\n/** Renders the decimal text of `pg/int8number@1`, whose application type is `number`, as a number literal. */\nconst decimalTextNumberLiteral = (value) => typeof value === \"string\" && DECIMAL_INTEGER.test(value) ? value : void 0;\nconst pgNumericRenderOutputType = (typeParams) => {\n\tconst precision = typeParams.precision;\n\tif (precision === void 0) return void 0;\n\tif (typeof precision !== \"number\" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw postgresError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"precision\" in typeParams for Numeric, got ${String(precision)}`, { meta: {\n\t\tnativeType: \"Numeric\",\n\t\tparam: \"precision\",\n\t\treceived: String(precision)\n\t} });\n\tconst scale = typeParams.scale;\n\tif (scale === void 0) return `Numeric<${precision}>`;\n\tif (typeof scale !== \"number\" || !Number.isFinite(scale) || !Number.isInteger(scale)) throw postgresError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"scale\" in typeParams for Numeric, got ${String(scale)}`, { meta: {\n\t\tnativeType: \"Numeric\",\n\t\tparam: \"scale\",\n\t\treceived: String(scale)\n\t} });\n\treturn `Numeric<${precision}, ${scale}>`;\n};\nconst ISO_DURATION = /^P(?!$)(-?\\d+Y)?(-?\\d+M)?(-?\\d+D)?(?:T(?!$)(-?\\d+H)?(-?\\d+M)?(-?\\d+(?:\\.\\d+)?S)?)?$/;\nconst MICROS_PER_SECOND = 1000000n;\n/**\n* Converts a fractional-seconds digit string to microseconds, rounding rather\n* than truncating past the sixth digit.\n*\n* PostgreSQL rounds: `INTERVAL '1.1234567 seconds'` is `1.123457`, and\n* `'1.9999999 seconds'` carries into `2`. Truncating here made the parsed value\n* disagree with the database for any input past microsecond resolution.\n*\n* Ties round toward positive infinity, matching `Math.round` on the sibling path\n* that reads the driver's component object — so the two agree. PostgreSQL's own\n* tie behaviour is unobservable, because it parses the literal into a double\n* first and an exact half never survives that.\n*/\nconst microsFromFraction = (fraction, negative) => {\n\tif (fraction === \"\") return 0n;\n\tconst kept = BigInt(fraction.slice(0, 6).padEnd(6, \"0\"));\n\tconst rest = fraction.slice(6).replace(/0+$/, \"\");\n\tif (rest === \"\") return kept;\n\tconst half = rest[0] === \"5\" && rest.length === 1;\n\treturn rest > \"5\" || half && !negative ? kept + 1n : kept;\n};\nconst intervalFieldsOf = (text) => {\n\tconst match = ISO_DURATION.exec(text);\n\tif (match === null) throw postgresError(\"RUNTIME.DECODE_FAILED\", `pg/interval@1 value must be an ISO-8601 duration, got ${text}`, { meta: {\n\t\tcodecId: \"pg/interval@1\",\n\t\treceived: text\n\t} });\n\tconst [, years, months, days, hours, minutes, seconds] = match;\n\tconst wholeNumber = (part) => part === void 0 ? 0 : Number(part.slice(0, -1));\n\tconst secondsLiteral = seconds === void 0 ? \"0\" : seconds.slice(0, -1);\n\tconst negative = secondsLiteral.startsWith(\"-\");\n\tconst [whole = \"0\", fraction = \"\"] = secondsLiteral.replace(\"-\", \"\").split(\".\");\n\tconst magnitude = BigInt(whole) * MICROS_PER_SECOND + microsFromFraction(fraction, negative);\n\treturn {\n\t\tmonths: wholeNumber(years) * 12 + wholeNumber(months),\n\t\tdays: wholeNumber(days),\n\t\tmicros: BigInt(wholeNumber(hours)) * 3600n * MICROS_PER_SECOND + BigInt(wholeNumber(minutes)) * 60n * MICROS_PER_SECOND + (negative ? -magnitude : magnitude)\n\t};\n};\nconst secondsText = (micros) => {\n\tconst sign = micros < 0n ? \"-\" : \"\";\n\tconst magnitude = micros < 0n ? -micros : micros;\n\tconst whole = magnitude / MICROS_PER_SECOND % 60n;\n\tconst fraction = magnitude % MICROS_PER_SECOND;\n\treturn `${sign}${whole}${fraction === 0n ? \"\" : `.${fraction.toString().padStart(6, \"0\").replace(/0+$/, \"\")}`}`;\n};\n/**\n* Renders {@link PgInterval} the way PostgreSQL spells an interval under\n* `IntervalStyle = 'iso_8601'`: zero components omitted, `T` present only when a\n* time component is, each component carrying its own sign, and an all-zero\n* interval written `PT0S`.\n*/\nconst formatIsoDuration = ({ months, days, micros }) => {\n\tconst years = Math.trunc(months / 12);\n\tconst restMonths = months % 12;\n\tconst sign = micros < 0n ? \"-\" : \"\";\n\tconst magnitude = micros < 0n ? -micros : micros;\n\tconst hours = magnitude / (3600n * MICROS_PER_SECOND);\n\tconst minutes = magnitude / (60n * MICROS_PER_SECOND) % 60n;\n\tconst hasSeconds = magnitude % (60n * MICROS_PER_SECOND) !== 0n;\n\tconst parts = [\n\t\tyears === 0 ? \"\" : `${years}Y`,\n\t\trestMonths === 0 ? \"\" : `${restMonths}M`,\n\t\tdays === 0 ? \"\" : `${days}D`\n\t];\n\tconst time = [\n\t\thours === 0n ? \"\" : `${sign}${hours}H`,\n\t\tminutes === 0n ? \"\" : `${sign}${minutes}M`,\n\t\thasSeconds ? `${secondsText(micros)}S` : \"\"\n\t].join(\"\");\n\tconst rendered = `P${parts.join(\"\")}${time === \"\" ? \"\" : `T${time}`}`;\n\treturn rendered === \"P\" ? \"PT0S\" : rendered;\n};\n/**\n* An interval as PostgreSQL prints it under `IntervalStyle = 'postgres'`: `1 year 2 mons 3 days\n* 04:05:06.5`, `-1 years -2 mons +3 days -04:00:00`, `00:00:00`.\n*/\nconst POSTGRES_INTERVAL = /^(?:([+-]?\\d+) years? ?)?(?:([+-]?\\d+) mons? ?)?(?:([+-]?\\d+) days? ?)?(?:([+-])?(\\d+):(\\d{2}):(\\d{2})(?:\\.(\\d+))?)?$/;\nfunction postgresIntervalFields(text) {\n\tconst match = POSTGRES_INTERVAL.exec(text);\n\tif (match === null || text === \"\" || text.endsWith(\" \")) return void 0;\n\tconst [, years = \"0\", months = \"0\", days = \"0\", sign, hours = \"0\", minutes = \"0\", seconds = \"0\"] = match;\n\tconst fraction = match[8] ?? \"\";\n\tconst magnitude = (BigInt(hours) * 3600n + BigInt(minutes) * 60n + BigInt(seconds)) * MICROS_PER_SECOND + BigInt(fraction.padEnd(6, \"0\") || \"0\");\n\treturn {\n\t\tmonths: Number(years) * 12 + Number(months),\n\t\tdays: Number(days),\n\t\tmicros: sign === \"-\" ? -magnitude : magnitude\n\t};\n}\nfunction intervalRefused(message) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", message, {\n\t\twhy: \"pg/interval stores one canonical form for each interval (ADR 254), and reads ISO 8601 durations and the text PostgreSQL prints.\",\n\t\tfix: \"Write an ISO 8601 duration, as the message shows.\"\n\t});\n}\n/**\n* The canonical form of `pg/interval` (ADR 254), from an ISO 8601 duration or the text PostgreSQL\n* prints under `IntervalStyle = 'postgres'`.\n*/\nfunction pgIntervalCanonical(text) {\n\tconst fractionDigits = /\\.(\\d+)/.exec(text)?.[1]?.length ?? 0;\n\tif (fractionDigits > 6) intervalRefused(`\"${text}\" has ${fractionDigits} digits after the decimal point, but pg/interval holds microseconds, so at most 6. Round it, as in \"PT1.123456S\".`);\n\tif (ISO_DURATION.test(text)) return formatIsoDuration(intervalFieldsOf(text));\n\tconst fields = postgresIntervalFields(text);\n\tif (fields === void 0) intervalRefused(`pg/interval cannot read \"${text}\". Write an ISO 8601 duration, as in \"P1Y2M3DT4H5M6S\".`);\n\treturn formatIsoDuration(fields);\n}\n/** Renders the application value as its canonical ISO-8601 duration. */\nconst pgIntervalToIso = (value) => formatIsoDuration(value);\nconst pgIntervalEncodeJson = (value) => formatIsoDuration(value);\nconst pgIntervalDecodeJson = (json) => {\n\tif (typeof json !== \"string\") throw postgresError(\"RUNTIME.DECODE_FAILED\", \"pg/interval@1 database JSON value must be an ISO-8601 duration string\", { meta: {\n\t\tcodecId: \"pg/interval@1\",\n\t\treceived: typeof json\n\t} });\n\treturn intervalFieldsOf(json);\n};\n/**\n* Reads the driver's wire value into the application value. `pg` parses an\n* interval into a component object, which is the same three fields under other\n* names; a text wire value is an ISO-8601 duration, because that is what the\n* codec writes.\n*/\nconst pgIntervalDecode = (wire) => {\n\tif (typeof wire === \"string\") return intervalFieldsOf(wire);\n\tconst part = (name) => {\n\t\tconst raw = wire[name];\n\t\treturn typeof raw === \"number\" ? raw : 0;\n\t};\n\tconst seconds = part(\"seconds\") + part(\"milliseconds\") / 1e3;\n\treturn {\n\t\tmonths: part(\"years\") * 12 + part(\"months\"),\n\t\tdays: part(\"days\"),\n\t\tmicros: BigInt(part(\"hours\")) * 3600n * MICROS_PER_SECOND + BigInt(part(\"minutes\")) * 60n * MICROS_PER_SECOND + BigInt(Math.round(seconds * 1e6))\n\t};\n};\nconst BASE64_TEXT = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\nconst pgByteaEncodeJson = (value) => Buffer.from(value).toString(\"base64\");\nconst pgByteaDecodeJson = (value) => {\n\tif (typeof value !== \"string\" || !BASE64_TEXT.test(value)) throw postgresError(\"RUNTIME.DECODE_FAILED\", \"pg/bytea@1 database JSON value must be a base64 string\", { meta: { codecId: \"pg/bytea@1\" } });\n\treturn new Uint8Array(Buffer.from(value, \"base64\"));\n};\nconst BYTEA_TEXT = /^\\\\x(?:[0-9A-Fa-f]{2})*$/;\n/**\n* Scalar pg bytea values arrive as Uint8Array/Buffer; target-parsed bytea list elements arrive as PostgreSQL hex text.\n*/\nconst pgByteaDecodeWire = (wire) => {\n\tif (wire instanceof Uint8Array) return wire.constructor === Uint8Array ? wire : new Uint8Array(wire.buffer, wire.byteOffset, wire.byteLength);\n\tif (!BYTEA_TEXT.test(wire)) throw postgresError(\"RUNTIME.DECODE_FAILED\", \"pg/bytea@1 wire value must be a bytea hex string or Uint8Array\", { meta: {\n\t\tcodecId: \"pg/bytea@1\",\n\t\treceived: wire\n\t} });\n\treturn new Uint8Array(Buffer.from(wire.slice(2), \"hex\"));\n};\nconst parseJsonWire = JSON.parse;\nconst pgJsonEncode = (value) => JSON.stringify(value);\nconst pgJsonDecode = (wire) => typeof wire === \"string\" ? parseJsonWire(wire) : wire;\nconst pgJsonbEncode = (value) => JSON.stringify(value);\nconst pgJsonbDecode = (wire) => typeof wire === \"string\" ? parseJsonWire(wire) : wire;\n//#endregion\n//#region src/core/data-types.ts\n/** A cast between two types that store the same shape: the value is already the form this type stores. */\nconst unchanged = (value) => value;\nfunction wrongShape(value, expected) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `Expected ${expected}, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A cast reads the canonical form of the type it takes values of.\",\n\t\tfix: \"Hand the cast a value in the shape its source type stores.\"\n\t});\n}\n/** A whole number as the digit text `int8` and `numeric` store. */\nconst asNumeralText = (value) => typeof value === \"number\" ? numeralText(value) : wrongShape(value, \"a number\");\n/**\n* A number as the floating-point types store it: a JSON number, or one of the three words, which\n* those types keep as text. A magnitude past what a double holds is refused rather than rounded to\n* a word: the database refuses it too, and storing `Infinity` would make a written number\n* indistinguishable from a written `Infinity`.\n*/\nconst asFloat = (value) => {\n\tif (typeof value === \"number\") return value;\n\tif (typeof value !== \"string\") return wrongShape(value, \"a number or numeral text\");\n\tif (isNonFiniteText(value)) return value;\n\tconst converted = Number(value);\n\tif (Number.isFinite(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${value} is out of range: no double holds a number that large.`, {\n\t\twhy: \"The floating-point types store a double, which holds magnitudes up to about 1.8e308.\",\n\t\tfix: \"Use a number a double holds, or a numeric column.\"\n\t});\n};\nconst pgText = dataType(\"pg/text\", {});\nconst pgTextArray = dataType(\"pg/text-array\", {});\nconst pgEnum = dataType(\"pg/enum\", {});\nconst pgInt2 = dataType(\"pg/int2\", {});\nconst pgBool = dataType(\"pg/bool\", {});\nconst pgJson = dataType(\"pg/json\", {});\nconst pgTsquery = dataType(\"pg/tsquery\", {});\nconst pgInt4 = dataType(\"pg/int4\", { casts: { [pgInt2.id]: unchanged } });\nconst pgInt8 = dataType(\"pg/int8\", { casts: {\n\t[pgInt2.id]: asNumeralText,\n\t[pgInt4.id]: asNumeralText\n} });\nconst pgNumeric = dataType(\"pg/numeric\", { casts: {\n\t[pgInt2.id]: asNumeralText,\n\t[pgInt4.id]: asNumeralText,\n\t[pgInt8.id]: unchanged\n} });\n/** `float4` stores a single-precision float, so a magnitude past about 3.4e38 does not fit. */\nconst asFloat4 = (value) => {\n\tconst converted = asFloat(value);\n\tif (typeof converted !== \"number\" || Number.isFinite(Math.fround(converted))) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${converted} is out of range: no float4 holds a number that large.`, {\n\t\twhy: \"float4 stores a single-precision float, which holds magnitudes up to about 3.4e38.\",\n\t\tfix: \"Use a number float4 holds, or a float8 or numeric column.\"\n\t});\n};\nconst floatCastsOf = (cast) => ({\n\t[pgInt2.id]: cast,\n\t[pgInt4.id]: cast,\n\t[pgInt8.id]: cast,\n\t[pgNumeric.id]: cast\n});\nconst pgFloat4 = dataType(\"pg/float4\", { casts: floatCastsOf(asFloat4) });\nconst pgFloat8 = dataType(\"pg/float8\", { casts: floatCastsOf(asFloat) });\nconst pgJsonb = dataType(\"pg/jsonb\", { casts: { [pgJson.id]: unchanged } });\nconst fromText = { [pgText.id]: unchanged };\nconst pgChar = dataType(\"pg/char\", { casts: fromText });\nconst pgVarchar = dataType(\"pg/varchar\", { casts: fromText });\nconst pgUuid = dataType(\"pg/uuid\", { casts: fromText });\nconst pgInet = dataType(\"pg/inet\", { casts: fromText });\nconst pgBit = dataType(\"pg/bit\", { casts: fromText });\nconst pgVarbit = dataType(\"pg/varbit\", { casts: fromText });\nconst pgBytea = dataType(\"pg/bytea\", { casts: fromText });\nconst POSTGRES_YEAR = /^(\\d{4,6})(-.*?)( BC)?$/;\n/**\n* Text PostgreSQL prints, in ISO 8601. A year with a ` BC` suffix becomes the ISO year, one higher\n* than its negative, so 1 BC is 0000 and 44 BC is -000043. A year of five or six digits becomes a\n* signed six-digit year. 0 BC does not exist, so it stays as written and the reader refuses it.\n*/\nfunction isoFromPostgresText(text) {\n\tconst match = POSTGRES_YEAR.exec(text);\n\tif (match === null) return text;\n\tconst [, digits = \"\", rest = \"\", bc] = match;\n\tconst year = Number(digits);\n\tif (bc !== void 0) {\n\t\tif (year === 0) return text;\n\t\tconst astronomical = 1 - year;\n\t\treturn astronomical === 0 ? `0000${rest}` : `-${String(-astronomical).padStart(6, \"0\")}${rest}`;\n\t}\n\treturn digits.length > 4 ? `+${String(year).padStart(6, \"0\")}${rest}` : text;\n}\nconst INFINITIES = /* @__PURE__ */ new Set([\"infinity\", \"-infinity\"]);\n/**\n* The canonical form of a date or time type (ADR 254), from ISO 8601 or the text PostgreSQL prints.\n* `infinity` and `-infinity` are values of the types that hold them.\n*/\nfunction postgresDateTime(options, holdsInfinity) {\n\treturn (text) => holdsInfinity && INFINITIES.has(text) ? text : canonicalDateTime(isoFromPostgresText(text), options, text);\n}\n/**\n* Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24\n* BC, and the `Temporal` and `Date` codecs end at +275760-09-13.\n*/\nconst pgDateCanonical = postgresDateTime({\n\tshape: \"date\",\n\tdataTypeId: \"pg/date\",\n\trange: {\n\t\tearliest: \"-004713-11-24\",\n\t\tlatest: \"+275760-09-13\"\n\t}\n}, true);\nconst pgTimeCanonical = postgresDateTime({\n\tshape: \"time\",\n\tdataTypeId: \"pg/time\"\n}, false);\nconst pgTimetzCanonical = postgresDateTime({\n\tshape: \"timeWithOffset\",\n\tdataTypeId: \"pg/timetz\",\n\tmaxOffsetHours: 15\n}, false);\nconst pgTimestampCanonical = postgresDateTime({\n\tshape: \"dateTime\",\n\tdataTypeId: \"pg/timestamp\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00\",\n\t\tlatest: \"+275760-09-13T23:59:59.999999\"\n\t}\n}, true);\nconst pgTimestamptzCanonical = postgresDateTime({\n\tshape: \"instant\",\n\tdataTypeId: \"pg/timestamptz\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00Z\",\n\t\tlatest: \"+275760-09-13T00:00:00Z\"\n\t}\n}, true);\n/** The canonical-form function of a type whose values are written as text. */\nconst canonicalFromText = (canonical) => (value) => typeof value === \"string\" ? canonical(value) : wrongShape(value, \"text\");\n/** A date or time type: its canonical form, and a cast from text that gives it. */\nfunction dateTimeType(id, canonical) {\n\tconst toCanonicalForm = canonicalFromText(canonical);\n\treturn dataType(id, {\n\t\ttoCanonicalForm,\n\t\tcasts: { [pgText.id]: toCanonicalForm }\n\t});\n}\nconst pgTimetz = dateTimeType(\"pg/timetz\", pgTimetzCanonical);\nconst pgInterval = dateTimeType(\"pg/interval\", pgIntervalCanonical);\nconst pgDate = dateTimeType(\"pg/date\", pgDateCanonical);\nconst pgTime = dateTimeType(\"pg/time\", pgTimeCanonical);\nconst pgTimestamp = dateTimeType(\"pg/timestamp\", pgTimestampCanonical);\nconst pgTimestamptz = dateTimeType(\"pg/timestamptz\", pgTimestamptzCanonical);\n/** Every data type this target registers. */\nconst postgresDataTypes = [\n\tpgText,\n\tpgTextArray,\n\tpgEnum,\n\tpgInt2,\n\tpgBool,\n\tpgJson,\n\tpgTsquery,\n\tpgInt4,\n\tpgInt8,\n\tpgNumeric,\n\tpgFloat4,\n\tpgFloat8,\n\tpgJsonb,\n\tpgChar,\n\tpgVarchar,\n\tpgUuid,\n\tpgInet,\n\tpgBit,\n\tpgVarbit,\n\tpgTimetz,\n\tpgInterval,\n\tpgBytea,\n\tpgDate,\n\tpgTime,\n\tpgTimestamp,\n\tpgTimestamptz\n];\n//#endregion\nexport { pgJsonEncode as $, pgVarbit as A, pgFloatDecodeJson as B, pgTimestampCanonical as C, pgTimetzCanonical as D, pgTimetz as E, pgBigintEncode as F, pgInt8NumberDecodeJson as G, pgFloatEncodeJson as H, pgBigintEncodeJson as I, pgIntervalDecode as J, pgInt8NumberEncode as K, pgByteaDecodeJson as L, postgresDataTypes as M, decimalTextBigintLiteral as N, pgTsquery as O, decimalTextNumberLiteral as P, pgJsonDecode as Q, pgByteaDecodeWire as R, pgTimestamp as S, pgTimestamptzCanonical as T, pgInt8Decode as U, pgFloatEncode as V, pgInt8NumberDecode as W, pgIntervalEncodeJson as X, pgIntervalDecodeJson as Y, pgIntervalToIso as Z, pgNumeric as _, pgDate as a, precisionParamsSchema as at, pgTime as b, pgFloat4 as c, pgInt2 as d, pgJsonbDecode as et, pgInt4 as f, pgJsonb as g, pgJson as h, pgChar as i, pgUnboundedIntDecode as it, pgVarchar as j, pgUuid as k, pgFloat8 as l, pgInterval as m, pgBool as n, pgNumericDecode as nt, pgDateCanonical as o, renderLength as ot, pgInt8 as p, pgInt8NumberEncodeJson as q, pgBytea as r, pgNumericRenderOutputType as rt, pgEnum as s, renderPrecision as st, pgBit as t, pgJsonbEncode as tt, pgInet as u, pgText as v, pgTimestamptz as w, pgTimeCanonical as x, pgTextArray as y, pgByteaEncodeJson as z };\n\n//# s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G,IAAI;AACP,MAAM,yBAAyB,iBAAiB;CAC/C,OAAO;CACP,YAAY;CACZ,OAAO;EACN,UAAU;EACV,QAAQ;CACT;AACD,GAAG,IAAI;;AAEP,MAAM,qBAAqB,eAAe,UAAU,OAAO,UAAU,WAAW,UAAU,KAAK,IAAI,WAAW,OAAO,MAAM;;AAE3H,SAAS,aAAa,IAAI,WAAW;CACpC,MAAM,kBAAkB,kBAAkB,SAAS;CACnD,OAAO,SAAS,IAAI;EACnB;EACA,OAAO,GAAG,OAAO,KAAK,gBAAgB;CACvC,CAAC;AACF;AACA,MAAM,WAAW,aAAa,aAAa,iBAAiB;AAC5D,MAAM,aAAa,aAAa,eAAe,mBAAmB;AAClE,MAAM,SAAS,aAAa,WAAW,eAAe;AACtD,MAAM,SAAS,aAAa,WAAW,eAAe;AACtD,MAAM,cAAc,aAAa,gBAAgB,oBAAoB;AACrE,MAAM,gBAAgB,aAAa,kBAAkB,sBAAsB;;AAE3E,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-normalizer-Bp3IhMR9-D0uYVRLZ.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/default-normalizer-Bp3IhMR9.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\n//#region src/core/default-normalizer.ts\n/**\n* Pre-compiled regex patterns for performance.\n* These are compiled once at module load time rather than on each function call.\n*/\nconst NEXTVAL_PATTERN = /^nextval\\s*\\(/i;\nconst NOW_FUNCTION_PATTERN = /^(now\\s*\\(\\s*\\)|CURRENT_TIMESTAMP)$/i;\nconst CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\\s*\\(\\s*\\)$/i;\nconst TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\\s+(?:with|without)\\s+time\\s+zone)?$/i;\nconst TEXT_CAST_SUFFIX = /::text$/i;\nconst NOW_LITERAL_PATTERN = /^'now'$/i;\nconst UUID_PATTERN = /^gen_random_uuid\\s*\\(\\s*\\)$/i;\nconst UUID_OSSP_PATTERN = /^uuid_generate_v4\\s*\\(\\s*\\)$/i;\nconst NULL_PATTERN = /^NULL(?:::.+)?$/i;\nconst TRUE_PATTERN = /^true$/i;\nconst FALSE_PATTERN = /^false$/i;\n/**\n* A decimal numeral with an optional sign and an optional exponent. Postgres prints a `real` or\n* `double precision` default in exponent notation once its magnitude is large or small enough:\n* `'1e+20'::real`, `'1e-320'::double precision`.\n*/\nconst NUMERAL = String.raw`[+-]?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?`;\nconst NUMERIC_PATTERN = new RegExp(`^${NUMERAL}$`);\n/**\n* A cast target type: a builtin of one or more words, where any word may carry a modifier\n* (`timestamp(3) without time zone`, `numeric(65,30)`), or a quoted identifier (`\"AuditAction\"`);\n* either may be qualified by a possibly quoted schema (`audit.\"AuditAction\"`, `\"my schema\".t`).\n*/\nconst TYPE_NAME = String.raw`(?:(?:\"(?:[^\"]|\"\")+\"|\\w+)\\.)?(?:\"(?:[^\"]|\"\")+\"|\\w+(?:\\(\\d+(?:,\\s*\\d+)?\\))?(?:\\s+\\w+(?:\\(\\d+(?:,\\s*\\d+)?\\))?)*)`;\nconst QUOTED_LITERAL_PATTERN = new RegExp(`^'((?:[^']|'')*)'(?:::(${TYPE_NAME}))?$`);\nconst NUMBER_LITERAL_PATTERN = new RegExp(`^(${NUMERAL})(?:::(${TYPE_NAME}))?$`);\nconst PARENTHESISED_CAST_PATTERN = new RegExp(String.raw`^\\((.+)\\)::(${TYPE_NAME})$`, \"s\");\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst INTEGER_TYPE_PATTERN = /^(?:smallint|integer|bigint|int2|int4|int8)$/i;\nconst NUMBER_TYPE_PATTERN = /^(?:smallint|integer|bigint|int2|int4|int8|real|double precision|float4|float8|numeric|decimal)(?:\\(\\d+(?:,\\s*\\d+)?\\))?$/i;\nconst DECIMAL_TEXT_TYPE_PATTERN = /^(?:bigint|int8|numeric|decimal)(?:\\(\\d+(?:,\\s*\\d+)?\\))?$/i;\n/**\n* Matches a Postgres array literal default of the form `'{...}'::elemtype[]`.\n* The literal body is captured in group 1; the cast (including `[]`) is optional.\n* Examples: `'{}'::text[]`, `'{1,2}'::integer[]`, `'{}'`\n*/\nconst ARRAY_LITERAL_PATTERN = /^'(\\{.*\\})'(?:::.+\\[\\])?$/;\n/** `box` is the one core type whose array elements are delimited by `;`, not `,`. */\nconst SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN = /^box$/i;\n/**\n* Matches the constructor spelling Postgres reports for a default written as\n* `ARRAY[...]`: `ARRAY['a'::text, 'b'::text]`, `ARRAY[1, 2]`, `ARRAY[]::text[]`.\n* The element list is captured in group 1; the outer cast is optional.\n*/\nconst ARRAY_CONSTRUCTOR_PATTERN = new RegExp(String.raw`^ARRAY\\[(.*?)\\](?:::${TYPE_NAME}\\[\\])?$`, \"is\");\nconst OUTER_ARRAY_CAST_PATTERN = new RegExp(String.raw`^\\((.+)\\)::${TYPE_NAME}\\[\\]$`, \"s\");\n/**\n* Returns the canonical expression for a timestamp default function, or undefined\n* if the expression is not a recognized timestamp default.\n*\n* Keeps now()/CURRENT_TIMESTAMP and clock_timestamp() distinct:\n* - now(), CURRENT_TIMESTAMP, ('now'::text)::timestamp... → 'now()'\n* - clock_timestamp(), clock_timestamp()::timestamptz → 'clock_timestamp()'\n*\n* These are semantically different in Postgres: now() returns the transaction\n* start time (constant within a transaction), while clock_timestamp() returns\n* the actual wall-clock time (can differ across rows in a single INSERT).\n*/\nfunction canonicalizeTimestampDefault(expr) {\n\tif (NOW_FUNCTION_PATTERN.test(expr)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(expr)) return \"clock_timestamp()\";\n\tif (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;\n\tlet inner = expr.replace(TIMESTAMP_CAST_SUFFIX, \"\").trim();\n\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1).trim();\n\tif (NOW_FUNCTION_PATTERN.test(inner)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(inner)) return \"clock_timestamp()\";\n\tinner = inner.replace(TEXT_CAST_SUFFIX, \"\").trim();\n\tif (NOW_LITERAL_PATTERN.test(inner)) return \"now()\";\n}\n/**\n* A numeral cast to a number type. A cast to an integer type rounds a fraction, so that numeral is\n* not the value.\n*/\nfunction castNumber(numeral, castType) {\n\tif (castType === void 0) return {\n\t\tkind: \"number\",\n\t\tnumeral\n\t};\n\tif (!NUMBER_TYPE_PATTERN.test(castType)) return void 0;\n\tif (INTEGER_TYPE_PATTERN.test(castType) && !INTEGER_PATTERN.test(numeral)) return void 0;\n\treturn {\n\t\tkind: \"number\",\n\t\tnumeral\n\t};\n}\n/**\n* Reads a literal by its cast type: `'-1'::integer` and `(1)::bigint` are numbers, `'a'::text` is a\n* string. A parenthesised cast is read only from number to number: `('now'::text)::date` is\n* evaluated on insert. Anything else, such as an operator or a function call, is not a literal.\n*/\nfunction readLiteralToken(expression) {\n\tconst quoted = QUOTED_LITERAL_PATTERN.exec(expression);\n\tif (quoted?.[1] !== void 0) {\n\t\tconst text = quoted[1].replace(/''/g, \"'\");\n\t\tconst castType = quoted[2];\n\t\treturn castType !== void 0 && NUMBER_TYPE_PATTERN.test(castType) && NUMERIC_PATTERN.test(text) ? castNumber(text, castType) : {\n\t\t\tkind: \"string\",\n\t\t\ttext\n\t\t};\n\t}\n\tconst number = NUMBER_LITERAL_PATTERN.exec(expression);\n\tif (number?.[1] !== void 0) return castNumber(number[1], number[2]);\n\tconst parenthesised = PARENTHESISED_CAST_PATTERN.exec(expression);\n\tif (parenthesised?.[1] === void 0 || parenthesised[2] === void 0) return void 0;\n\tconst inner = readLiteralToken(parenthesised[1].trim());\n\treturn inner?.kind === \"number\" ? castNumber(inner.numeral, parenthesised[2]) : void 0;\n}\n/**\n* `int8` and `numeric` defaults are decimal text, the JSON form of their codecs, so no digit is\n* lost to a JavaScript number. A column that is not a number type stores the numeral as text.\n*/\nfunction numberValue(numeral, nativeType) {\n\tif (nativeType !== void 0 && DECIMAL_TEXT_TYPE_PATTERN.test(nativeType)) return numeral;\n\tif (nativeType !== void 0 && !NUMBER_TYPE_PATTERN.test(nativeType)) return numeral;\n\tconst parsed = Number(numeral);\n\treturn Number.isFinite(parsed) ? parsed : void 0;\n}\n/**\n* Splits a Postgres array literal body (without the enclosing braces) into its\n* element tokens, honouring quoting. A comma only separates elements when it is\n* outside double quotes; inside a quoted element a doubled quote (`\"\"`) or a\n* backslash-escaped quote (`\\\"`) is a literal quote, and a backslash escapes the\n* next character. Returns undefined if the body is malformed (e.g. an unbalanced\n* quote), nests an array, which puts a brace outside quotes, or escapes a character outside\n* quotes with a backslash, which Postgres never prints.\n*/\nfunction splitArrayElements(inner) {\n\tconst tokens = [];\n\tlet current = \"\";\n\tlet inQuotes = false;\n\tlet quoted = false;\n\tfor (let i = 0; i < inner.length; i++) {\n\t\tconst char = inner[i];\n\t\tif (inQuotes) {\n\t\t\tif (char === \"\\\\\") {\n\t\t\t\tconst next = inner[i + 1];\n\t\t\t\tif (next === void 0) return void 0;\n\t\t\t\tcurrent += next;\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"\\\"\") {\n\t\t\t\tif (inner[i + 1] === \"\\\"\") {\n\t\t\t\t\tcurrent += \"\\\"\";\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tinQuotes = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\") {\n\t\t\tinQuotes = true;\n\t\t\tquoted = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"{\" || char === \"}\" || char === \"\\\\\") return void 0;\n\t\tif (char === \",\") {\n\t\t\ttokens.push({\n\t\t\t\tvalue: current,\n\t\t\t\tquoted\n\t\t\t});\n\t\t\tcurrent = \"\";\n\t\t\tquoted = false;\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\tif (inQuotes) return void 0;\n\ttokens.push({\n\t\tvalue: current,\n\t\tquoted\n\t});\n\treturn tokens;\n}\nconst BOOLEAN_TYPE_PATTERN = /^(?:bool|boolean)$/i;\nconst BOOLEAN_TRUE_TOKEN_PATTERN = /^(?:t|true)$/i;\nconst BOOLEAN_FALSE_TOKEN_PATTERN = /^(?:f|false)$/i;\n/**\n* Reads an unquoted, non-NULL array element by the column's element type. Only text Postgres itself\n* would print is read; anything else keeps the raw expression.\n*/\nfunction unquotedElementValue(token, elementType) {\n\tif (token === \"\") return void 0;\n\tif (BOOLEAN_TYPE_PATTERN.test(elementType)) {\n\t\tif (BOOLEAN_TRUE_TOKEN_PATTERN.test(token)) return true;\n\t\tif (BOOLEAN_FALSE_TOKEN_PATTERN.test(token)) return false;\n\t\treturn;\n\t}\n\tif (NUMBER_TYPE_PATTERN.test(elementType)) return NUMERIC_PATTERN.test(token) ? numberValue(token, elementType) : void 0;\n\tif (isJsonElementType(elementType)) {\n\t\tif (token === \"true\") return true;\n\t\tif (token === \"false\") return false;\n\t\treturn NUMERIC_PATTERN.test(token) ? textElementValue(token, elementType) : void 0;\n\t}\n\treturn token;\n}\n/**\n* Parses a Postgres array literal body (`{...}`) into a JS array of primitives.\n* Returns undefined if the body cannot be reliably parsed.\n*\n* Handles:\n* - `{}` → `[]`\n* - `{elem1,elem2,...}` → `[elem1, elem2, ...]`, each unquoted element read by the element type\n* - quoted elements that contain commas, doubled/escaped quotes, and the literal\n* strings `NULL`/`true`/`false` (a quoted token is always a string)\n*/\nfunction parseArrayLiteralBody(body, elementType) {\n\tconst inner = body.slice(1, -1).trim();\n\tif (inner === \"\") return [];\n\tconst tokens = splitArrayElements(inner);\n\tif (tokens === void 0) return void 0;\n\tconst result = [];\n\tfor (const token of tokens) {\n\t\tif (token.quoted) {\n\t\t\tresult.push(textElementValue(token.value, elementType));\n\t\t\tcontinue;\n\t\t}\n\t\tconst el = token.value.trim();\n\t\tif (el.toUpperCase() === \"NULL\") {\n\t\t\tif (isJsonElementType(elementType)) return void 0;\n\t\t\tresult.push(null);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = unquotedElementValue(el, elementType);\n\t\tif (value === void 0) return void 0;\n\t\tresult.push(value);\n\t}\n\treturn result;\n}\n/**\n* Splits an `ARRAY[...]` element list on the commas outside quotes and parentheses, so\n* `numeric(65,30)` and `'a,b'` stay inside one element. A doubled quote inside an element is a\n* literal quote, so it never closes one.\n*/\nfunction splitConstructorElements(body) {\n\tconst elements = [];\n\tlet current = \"\";\n\tlet quote;\n\tlet depth = 0;\n\tfor (const char of body) {\n\t\tif (quote !== void 0) {\n\t\t\tif (char === quote) quote = void 0;\n\t\t} else if (char === \"'\" || char === \"\\\"\") quote = char;\n\t\telse if (char === \"(\") depth++;\n\t\telse if (char === \")\") depth--;\n\t\telse if (char === \",\" && depth === 0) {\n\t\t\telements.push(current);\n\t\t\tcurrent = \"\";\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\telements.push(current);\n\treturn elements.map((element) => element.trim());\n}\n/**\n* Reads one `ARRAY[...]` element: NULL, a boolean, or a literal read by its cast type. Anything\n* else, such as a function call, means the constructor is not a literal and the caller keeps the\n* raw expression.\n*/\nfunction parseConstructorElement(element, elementType) {\n\tif (NULL_PATTERN.test(element)) return isJsonElementType(elementType) ? void 0 : null;\n\tif (TRUE_PATTERN.test(element)) return true;\n\tif (FALSE_PATTERN.test(element)) return false;\n\tconst token = readLiteralToken(element);\n\tif (token === void 0) return void 0;\n\treturn token.kind === \"number\" ? numberValue(token.numeral, elementType) : textElementValue(token.text, elementType);\n}\nfunction isJsonElementType(elementType) {\n\treturn elementType === \"json\" || elementType === \"jsonb\";\n}\n/** A `json`/`jsonb` element's text is a JSON document, as it is on a scalar column of the same type. */\nfunction textElementValue(text, elementType) {\n\tif (!isJsonElementType(elementType)) return text;\n\ttry {\n\t\treturn blindCast(JSON.parse(text));\n\t} catch {\n\t\treturn text;\n\t}\n}\nfunction parseArrayConstructor(body, elementType) {\n\tif (body.trim() === \"\") return [];\n\tconst values = [];\n\tfor (const element of splitConstructorElements(body)) {\n\t\tconst value = parseConstructorElement(element, elementType);\n\t\tif (value === void 0) return void 0;\n\t\tvalues.push(value);\n\t}\n\treturn values;\n}\nfunction unwrapOuterArrayCasts(expression) {\n\tconst match = OUTER_ARRAY_CAST_PATTERN.exec(expression);\n\treturn match?.[1] === void 0 ? expression : unwrapOuterArrayCasts(match[1].trim());\n}\n/**\n* Parses a raw Postgres column default expression into a normalized ColumnDefault.\n* This enables semantic comparison between contract defaults and introspected schema defaults.\n*\n* Used by the migration diff layer to normalize raw database defaults during comparison,\n* keeping the introspection layer focused on faithful data capture.\n*\n* @param rawDefault - Raw default expression from information_schema.columns.column_default\n* @param nativeType - Native column type, used for type-aware parsing (array, int8, numeric, JSON)\n* @returns Normalized ColumnDefault or undefined if the expression cannot be parsed\n*/\nfunction parsePostgresDefault(rawDefault, nativeType) {\n\tconst trimmed = rawDefault.trim();\n\tconst normalizedType = nativeType?.toLowerCase();\n\tif (NEXTVAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"autoincrement()\"\n\t};\n\tif (normalizedType?.endsWith(\"[]\")) {\n\t\tconst elementType = normalizedType.slice(0, -2);\n\t\tconst arrayMatch = trimmed.match(ARRAY_LITERAL_PATTERN);\n\t\tif (arrayMatch?.[1] !== void 0 && !SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN.test(elementType)) {\n\t\t\tconst parsed = parseArrayLiteralBody(arrayMatch[1].replace(/''/g, \"'\"), elementType);\n\t\t\tif (parsed !== void 0) return {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue: parsed\n\t\t\t};\n\t\t}\n\t\tconst constructorMatch = unwrapOuterArrayCasts(trimmed).match(ARRAY_CONSTRUCTOR_PATTERN);\n\t\tif (constructorMatch?.[1] !== void 0) {\n\t\t\tconst parsed = parseArrayConstructor(constructorMatch[1], elementType);\n\t\t\tif (parsed !== void 0) return {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue: parsed\n\t\t\t};\n\t\t}\n\t}\n\tconst canonicalTimestamp = canonicalizeTimestampDefault(trimmed);\n\tif (canonicalTimestamp) return {\n\t\tkind: \"function\",\n\t\texpression: canonicalTimestamp\n\t};\n\tif (UUID_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (UUID_OSSP_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: null\n\t};\n\tif (TRUE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: true\n\t};\n\tif (FALSE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: false\n\t};\n\tconst token = readLiteralToken(trimmed);\n\tif (token === void 0) return {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n\tif (token.kind === \"number\") {\n\t\tconst value = numberValue(token.numeral, normalizedType);\n\t\treturn value === void 0 ? void 0 : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue\n\t\t};\n\t}\n\tif (normalizedType === \"json\" || normalizedType === \"jsonb\") try {\n\t\treturn {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: JSON.parse(token.text)\n\t\t};\n\t} catch {}\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue: token.text\n\t};\n}\n/**\n* Normalizes a contract-declared default through {@link parsePostgresDefault}\n* — the same parser introspection uses — so a function-shaped default the\n* parser recognizes as a literal (e.g. sql`'{}'::jsonb`)\n* resolves to the same `resolvedDefault` shape a live introspected column\n* would produce. Compensates once, at `SchemaIR` construction of the\n* expected (contract-derived) side (`contractToSchemaIR`'s `resolveDefault`\n* hook), instead of at every site that later compares the two sides. A\n* literal default, or a function form the parser doesn't recognize, passes\n* through unchanged; `nextval(...)` normalizes to `autoincrement()` on both\n* sides, matching a `serial`/identity column's introspected counterpart.\n*/\nfunction postgresResolveDefault(def, resolvedNativeType) {\n\tif (def.kind !== \"function\") return def;\n\treturn parsePostgresDefault(def.expression, resolvedNativeType) ?? def;\n}\n//#endregion\nexport { postgresResolveDefault as n, parsePostgresDefault as t };\n\n//# sourceMappingURL=default-normalizer-Bp3IhMR9.mjs.map"],"mappings":";;;;;;AAMA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAC5B,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,gBAAgB;;;;;;AAMtB,MAAM,UAAU,OAAO,GAAG;AAC1B,MAAM,kBAAkB,IAAI,OAAO,IAAI,QAAQ,EAAE;;;;;;AAMjD,MAAM,YAAY,OAAO,GAAG;AAC5B,MAAM,yBAAyB,IAAI,OAAO,0BAA0B,UAAU,KAAK;AACnF,MAAM,yBAAyB,IAAI,OAAO,KAAK,QAAQ,SAAS,UAAU,KAAK;AAC/E,MAAM,6BAA6B,IAAI,OAAO,OAAO,GAAG,eAAe,UAAU,KAAK,GAAG;AACzF,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,4BAA4B;;;;;;AAMlC,MAAM,wBAAwB;;AAE9B,MAAM,2CAA2C;;;;;;AAMjD,MAAM,4BAA4B,IAAI,OAAO,OAAO,GAAG,uBAAuB,UAAU,UAAU,IAAI;AACtG,MAAM,2BAA2B,IAAI,OAAO,OAAO,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