@prisma/orm-target-postgres 0.16.0-dev.36
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/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/adapter-CWvVo0PV.d.mts +22 -0
- package/dist/adapter-CWvVo0PV.d.mts.map +1 -0
- package/dist/adapter-DhqcO3YO-jzwDVcCv.mjs +70 -0
- package/dist/adapter-DhqcO3YO-jzwDVcCv.mjs.map +1 -0
- package/dist/adapter.d.mts +12 -0
- package/dist/adapter.mjs +7 -0
- package/dist/adapter__adapter.d.mts +2 -0
- package/dist/adapter__adapter.mjs +2 -0
- package/dist/adapter__column-types.d.mts +2 -0
- package/dist/adapter__column-types.mjs +2 -0
- package/dist/adapter__control.d.mts +5 -0
- package/dist/adapter__control.mjs +441 -0
- package/dist/adapter__control.mjs.map +1 -0
- package/dist/adapter__operation-types.d.mts +2 -0
- package/dist/adapter__operation-types.mjs +1 -0
- package/dist/adapter__runtime.d.mts +2 -0
- package/dist/adapter__runtime.mjs +38 -0
- package/dist/adapter__runtime.mjs.map +1 -0
- package/dist/adapter__types.d.mts +4 -0
- package/dist/adapter__types.mjs +1 -0
- package/dist/authoring-03FwIL2k-kPjZAp3s.mjs +757 -0
- package/dist/authoring-03FwIL2k-kPjZAp3s.mjs.map +1 -0
- package/dist/canonicalize-CQlxSR4D-MnrT5gtW.d.mts +34 -0
- package/dist/canonicalize-CQlxSR4D-MnrT5gtW.d.mts.map +1 -0
- package/dist/canonicalize-CrN3u_xM-D4MrOqcB.mjs +59 -0
- package/dist/canonicalize-CrN3u_xM-D4MrOqcB.mjs.map +1 -0
- package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts +37 -0
- package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts.map +1 -0
- package/dist/codec-descriptor-Bg-_412t.d.mts +1 -0
- package/dist/codec-descriptor-CB6x0xEu-C-Zn2IEz.mjs +135 -0
- package/dist/codec-descriptor-CB6x0xEu-C-Zn2IEz.mjs.map +1 -0
- package/dist/codec-ids-CsOU3xDv-mPI0INiF.d.mts +33 -0
- package/dist/codec-ids-CsOU3xDv-mPI0INiF.d.mts.map +1 -0
- package/dist/codec-ids-fgafMLR7.d.mts +1 -0
- package/dist/codec-ids-tX7Svtz--BuOfRaVU.mjs +33 -0
- package/dist/codec-ids-tX7Svtz--BuOfRaVU.mjs.map +1 -0
- package/dist/codec-types-BHwY9Ff-.d.mts +2 -0
- package/dist/codec-types-mWhnDEAf-CAQzGFnF.d.mts +82 -0
- package/dist/codec-types-mWhnDEAf-CAQzGFnF.d.mts.map +1 -0
- package/dist/codecs-CBl0nD44-CaWPc1bd.mjs +1486 -0
- package/dist/codecs-CBl0nD44-CaWPc1bd.mjs.map +1 -0
- package/dist/codecs-CHIVTNZs.mjs +15 -0
- package/dist/codecs-CHIVTNZs.mjs.map +1 -0
- package/dist/codecs-Cvqvb9pV-Cdc51FKY.d.mts +589 -0
- package/dist/codecs-Cvqvb9pV-Cdc51FKY.d.mts.map +1 -0
- package/dist/codecs-DBn-uIv-.d.mts +15 -0
- package/dist/codecs-DBn-uIv-.d.mts.map +1 -0
- package/dist/column-types-BH-MU6uU.d.mts +108 -0
- package/dist/column-types-BH-MU6uU.d.mts.map +1 -0
- package/dist/column-types-CwAyCgp2.mjs +126 -0
- package/dist/column-types-CwAyCgp2.mjs.map +1 -0
- package/dist/contract-free-BZUS18FU.mjs +118 -0
- package/dist/contract-free-BZUS18FU.mjs.map +1 -0
- package/dist/contract-free-DzpGxLfb.d.mts +258 -0
- package/dist/contract-free-DzpGxLfb.d.mts.map +1 -0
- package/dist/control-2F195jJk.d.mts +11 -0
- package/dist/control-2F195jJk.d.mts.map +1 -0
- package/dist/control-6WFTtLAM.mjs +60 -0
- package/dist/control-6WFTtLAM.mjs.map +1 -0
- package/dist/control-B-FTbEnE.d.mts +22 -0
- package/dist/control-B-FTbEnE.d.mts.map +1 -0
- package/dist/control-D85zv_aY.d.mts +199 -0
- package/dist/control-D85zv_aY.d.mts.map +1 -0
- package/dist/control-DRMWptiJ.mjs +1355 -0
- package/dist/control-DRMWptiJ.mjs.map +1 -0
- package/dist/control-adapter-B9t0g7Pf-HrCxlM65.mjs +1901 -0
- package/dist/control-adapter-B9t0g7Pf-HrCxlM65.mjs.map +1 -0
- package/dist/control-policy-Cl3RRSPg-CT3QGpR3.mjs +1257 -0
- package/dist/control-policy-Cl3RRSPg-CT3QGpR3.mjs.map +1 -0
- package/dist/data-transform-BSM7TQpE.d.mts +1 -0
- package/dist/data-transform-ChZzy2dP-CxVCat_8.mjs +53 -0
- package/dist/data-transform-ChZzy2dP-CxVCat_8.mjs.map +1 -0
- package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts +38 -0
- package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts.map +1 -0
- package/dist/ddl-B4Rh8ntj.d.mts +1 -0
- package/dist/ddl-BdP4q3KY-Duef4uHw.mjs +395 -0
- package/dist/ddl-BdP4q3KY-Duef4uHw.mjs.map +1 -0
- package/dist/default-normalizer-B36TOul4.d.mts +31 -0
- package/dist/default-normalizer-B36TOul4.d.mts.map +1 -0
- package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs +253 -0
- package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs.map +1 -0
- package/dist/descriptor-meta-2IlVC6_d-DnV00Qd_.mjs +351 -0
- package/dist/descriptor-meta-2IlVC6_d-DnV00Qd_.mjs.map +1 -0
- package/dist/descriptor-meta-DnHabAS3-C53XXPQw.mjs +28 -0
- package/dist/descriptor-meta-DnHabAS3-C53XXPQw.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs +13 -0
- package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs.map +1 -0
- package/dist/diff-database-schema-BfRs2vrG-D2o4KII0.mjs +390 -0
- package/dist/diff-database-schema-BfRs2vrG-D2o4KII0.mjs.map +1 -0
- package/dist/diff-database-schema-DsoNznGC.d.mts +38 -0
- package/dist/diff-database-schema-DsoNznGC.d.mts.map +1 -0
- package/dist/driver.d.mts +3 -0
- package/dist/driver.mjs +2 -0
- package/dist/driver__control.d.mts +2 -0
- package/dist/driver__control.mjs +2 -0
- package/dist/driver__runtime.d.mts +2 -0
- package/dist/driver__runtime.mjs +597 -0
- package/dist/driver__runtime.mjs.map +1 -0
- package/dist/errors-DCcVX4j1.d.mts +32 -0
- package/dist/errors-DCcVX4j1.d.mts.map +1 -0
- package/dist/errors-kYxOQjdD-D4T3rbVp.mjs +39 -0
- package/dist/errors-kYxOQjdD-D4T3rbVp.mjs.map +1 -0
- package/dist/issue-planner-jkY6p-Ca.d.mts +105 -0
- package/dist/issue-planner-jkY6p-Ca.d.mts.map +1 -0
- package/dist/migration-CBSAPE8S.d.mts +25 -0
- package/dist/migration-CBSAPE8S.d.mts.map +1 -0
- package/dist/migration-PTHAY9Cv.mjs +21 -0
- package/dist/migration-PTHAY9Cv.mjs.map +1 -0
- package/dist/namespace-ids-xtp_ZY86-Cpp8PTxD.mjs +7 -0
- package/dist/namespace-ids-xtp_ZY86-Cpp8PTxD.mjs.map +1 -0
- package/dist/native-type-normalizer-DqJlOTeX.d.mts +19 -0
- package/dist/native-type-normalizer-DqJlOTeX.d.mts.map +1 -0
- package/dist/native-type-normalizer-yvd3tqv-.mjs +38 -0
- package/dist/native-type-normalizer-yvd3tqv-.mjs.map +1 -0
- package/dist/nodes-BU-V-aZA-RqwPH68u.d.mts +235 -0
- package/dist/nodes-BU-V-aZA-RqwPH68u.d.mts.map +1 -0
- package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs +255 -0
- package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs.map +1 -0
- package/dist/normalize-error-CNjgVO71-CLlZ3CuJ.mjs +121 -0
- package/dist/normalize-error-CNjgVO71-CLlZ3CuJ.mjs.map +1 -0
- package/dist/op-factory-call-DifL68KT-Bo6pxs-R.mjs +2009 -0
- package/dist/op-factory-call-DifL68KT-Bo6pxs-R.mjs.map +1 -0
- package/dist/op-factory-call-FEA5mnWH.d.mts +1 -0
- package/dist/op-factory-call-jd4cgfjA-CyNT4YVn.d.mts +521 -0
- package/dist/op-factory-call-jd4cgfjA-CyNT4YVn.d.mts.map +1 -0
- package/dist/operation-types-BfRocNI8.d.mts +22 -0
- package/dist/operation-types-BfRocNI8.d.mts.map +1 -0
- package/dist/pack-DFM4tmob.d.mts +610 -0
- package/dist/pack-DFM4tmob.d.mts.map +1 -0
- package/dist/planner-Bmje9ii8-B99fEsNM.mjs +588 -0
- package/dist/planner-Bmje9ii8-B99fEsNM.mjs.map +1 -0
- package/dist/planner-DL4Bh5Nk.d.mts +163 -0
- package/dist/planner-DL4Bh5Nk.d.mts.map +1 -0
- package/dist/planner-ddl-builders-CbfICQfm-CxYiLrhX.mjs +102 -0
- package/dist/planner-ddl-builders-CbfICQfm-CxYiLrhX.mjs.map +1 -0
- package/dist/planner-ddl-builders-ijp60-JO.d.mts +19 -0
- package/dist/planner-ddl-builders-ijp60-JO.d.mts.map +1 -0
- package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs +90 -0
- package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs.map +1 -0
- package/dist/planner-identity-values-TfEhnoWa.d.mts +25 -0
- package/dist/planner-identity-values-TfEhnoWa.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts +25 -0
- package/dist/planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration-C3GPZWeC.d.mts +1 -0
- package/dist/planner-produced-postgres-migration-Cicg2sXg-Ck9iDxGI.mjs +47 -0
- package/dist/planner-produced-postgres-migration-Cicg2sXg-Ck9iDxGI.mjs.map +1 -0
- package/dist/planner-schema-lookup-C4DHAddq.d.mts +21 -0
- package/dist/planner-schema-lookup-C4DHAddq.d.mts.map +1 -0
- package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs +57 -0
- package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs.map +1 -0
- package/dist/planner-sql-checks-CFgbRTJw.d.mts +20 -0
- package/dist/planner-sql-checks-CFgbRTJw.d.mts.map +1 -0
- package/dist/planner-sql-checks-DRc_78n8-C9nHOrvU.mjs +152 -0
- package/dist/planner-sql-checks-DRc_78n8-C9nHOrvU.mjs.map +1 -0
- package/dist/planner-target-details-HkP4RrRO-_xPQVPF0.d.mts +12 -0
- package/dist/planner-target-details-HkP4RrRO-_xPQVPF0.d.mts.map +1 -0
- package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs +15 -0
- package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map +1 -0
- package/dist/postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts +36 -0
- package/dist/postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts.map +1 -0
- package/dist/postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs +144 -0
- package/dist/postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs.map +1 -0
- package/dist/postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts +285 -0
- package/dist/postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts.map +1 -0
- package/dist/postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts +260 -0
- package/dist/postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts.map +1 -0
- package/dist/postgres-migration-CJshdIZn-DYYjgdD0.mjs +201 -0
- package/dist/postgres-migration-CJshdIZn-DYYjgdD0.mjs.map +1 -0
- package/dist/postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs +45 -0
- package/dist/postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs.map +1 -0
- package/dist/postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts +61 -0
- package/dist/postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts.map +1 -0
- package/dist/postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs +204 -0
- package/dist/postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs.map +1 -0
- package/dist/postgres-schema-KSzLDONj-CsXGoY8b.mjs +421 -0
- package/dist/postgres-schema-KSzLDONj-CsXGoY8b.mjs.map +1 -0
- package/dist/postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts +269 -0
- package/dist/postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts.map +1 -0
- package/dist/postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs +212 -0
- package/dist/postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs.map +1 -0
- package/dist/render-ops-DPwhZt2W.d.mts +11 -0
- package/dist/render-ops-DPwhZt2W.d.mts.map +1 -0
- package/dist/render-ops-DxzTxSsv-Bz85uUHk.mjs +34 -0
- package/dist/render-ops-DxzTxSsv-Bz85uUHk.mjs.map +1 -0
- package/dist/render-typescript-6sCFvMBh.d.mts +21 -0
- package/dist/render-typescript-6sCFvMBh.d.mts.map +1 -0
- package/dist/render-typescript-Cw3lFO28-Cx0lXWmv.mjs +117 -0
- package/dist/render-typescript-Cw3lFO28-Cx0lXWmv.mjs.map +1 -0
- package/dist/resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs +22 -0
- package/dist/resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs.map +1 -0
- package/dist/runtime-BbSRVwdd.d.mts +12 -0
- package/dist/runtime-BbSRVwdd.d.mts.map +1 -0
- package/dist/runtime-CDewySU9.d.mts +55 -0
- package/dist/runtime-CDewySU9.d.mts.map +1 -0
- package/dist/runtime-_TfO66h5.d.mts +32 -0
- package/dist/runtime-_TfO66h5.d.mts.map +1 -0
- package/dist/schema-ir-annotations-DuuYh0gl.d.mts +15 -0
- package/dist/schema-ir-annotations-DuuYh0gl.d.mts.map +1 -0
- package/dist/schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts +30 -0
- package/dist/schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts.map +1 -0
- package/dist/sql-utils-BnBlQxyh-DaX9Nb7Z.mjs +90 -0
- package/dist/sql-utils-BnBlQxyh-DaX9Nb7Z.mjs.map +1 -0
- package/dist/sql-utils-DW6fkczF.d.mts +62 -0
- package/dist/sql-utils-DW6fkczF.d.mts.map +1 -0
- package/dist/table-source-ikHOZmhD-DriY1Lcr.d.mts +15 -0
- package/dist/table-source-ikHOZmhD-DriY1Lcr.d.mts.map +1 -0
- package/dist/target.d.mts +47 -0
- package/dist/target.mjs +34 -0
- package/dist/target__codec-descriptor.d.mts +3 -0
- package/dist/target__codec-descriptor.mjs +2 -0
- package/dist/target__codec-ids.d.mts +3 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codec-types.d.mts +4 -0
- package/dist/target__codec-types.mjs +1 -0
- package/dist/target__codecs.d.mts +3 -0
- package/dist/target__codecs.mjs +3 -0
- package/dist/target__contract-free.d.mts +3 -0
- package/dist/target__contract-free.mjs +4 -0
- package/dist/target__control.d.mts +2 -0
- package/dist/target__control.mjs +2 -0
- package/dist/target__data-transform.d.mts +3 -0
- package/dist/target__data-transform.mjs +2 -0
- package/dist/target__ddl.d.mts +4 -0
- package/dist/target__ddl.mjs +2 -0
- package/dist/target__default-normalizer.d.mts +2 -0
- package/dist/target__default-normalizer.mjs +2 -0
- package/dist/target__diff-database-schema.d.mts +2 -0
- package/dist/target__diff-database-schema.mjs +2 -0
- package/dist/target__errors.d.mts +2 -0
- package/dist/target__errors.mjs +2 -0
- package/dist/target__issue-planner.d.mts +2 -0
- package/dist/target__issue-planner.mjs +2 -0
- package/dist/target__migration.d.mts +4 -0
- package/dist/target__migration.mjs +5 -0
- package/dist/target__native-type-normalizer.d.mts +2 -0
- package/dist/target__native-type-normalizer.mjs +2 -0
- package/dist/target__op-factory-call.d.mts +3 -0
- package/dist/target__op-factory-call.mjs +2 -0
- package/dist/target__pack.d.mts +2 -0
- package/dist/target__pack.mjs +2 -0
- package/dist/target__planner-ddl-builders.d.mts +2 -0
- package/dist/target__planner-ddl-builders.mjs +2 -0
- package/dist/target__planner-identity-values.d.mts +2 -0
- package/dist/target__planner-identity-values.mjs +2 -0
- package/dist/target__planner-produced-postgres-migration.d.mts +3 -0
- package/dist/target__planner-produced-postgres-migration.mjs +2 -0
- package/dist/target__planner-schema-lookup.d.mts +2 -0
- package/dist/target__planner-schema-lookup.mjs +2 -0
- package/dist/target__planner-sql-checks.d.mts +2 -0
- package/dist/target__planner-sql-checks.mjs +2 -0
- package/dist/target__planner-target-details.d.mts +2 -0
- package/dist/target__planner-target-details.mjs +1 -0
- package/dist/target__planner.d.mts +2 -0
- package/dist/target__planner.mjs +3 -0
- package/dist/target__render-ops.d.mts +2 -0
- package/dist/target__render-ops.mjs +2 -0
- package/dist/target__render-typescript.d.mts +2 -0
- package/dist/target__render-typescript.mjs +2 -0
- package/dist/target__rls-canonicalize.d.mts +2 -0
- package/dist/target__rls-canonicalize.mjs +2 -0
- package/dist/target__runtime.d.mts +3 -0
- package/dist/target__runtime.mjs +23 -0
- package/dist/target__runtime.mjs.map +1 -0
- package/dist/target__schema-ir-annotations.d.mts +2 -0
- package/dist/target__schema-ir-annotations.mjs +2 -0
- package/dist/target__sql-utils.d.mts +2 -0
- package/dist/target__sql-utils.mjs +2 -0
- package/dist/target__types.d.mts +7 -0
- package/dist/target__types.mjs +5 -0
- package/dist/types-CkryN1AS-6MNZLjLY.d.mts +27 -0
- package/dist/types-CkryN1AS-6MNZLjLY.d.mts.map +1 -0
- package/dist/types-Cp_Jf2tk.d.mts +1 -0
- package/dist/types-ue6jkJyF-BQJzjx1P.d.mts +10 -0
- package/dist/types-ue6jkJyF-BQJzjx1P.d.mts.map +1 -0
- package/dist/types-xa86TkcV.d.mts +32 -0
- package/dist/types-xa86TkcV.d.mts.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-produced-postgres-migration-Cicg2sXg-Ck9iDxGI.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-Cicg2sXg.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-CJshdIZn.mjs\";\nimport { t as renderOps } from \"./render-ops-DxzTxSsv.mjs\";\nimport { t as renderCallsToTypeScript } from \"./render-typescript-Cw3lFO28.mjs\";\n//#region src/core/migrations/planner-produced-postgres-migration.ts\nvar TypeScriptRenderablePostgresMigration = class extends PostgresMigration {\n\t#calls;\n\t#meta;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, lowerer) {\n\t\tsuper();\n\t\tthis.#calls = calls;\n\t\tthis.#meta = meta;\n\t\tthis.#spaceId = spaceId;\n\t\tthis.#snapshotsImportPath = snapshotsImportPath;\n\t\tthis.#lowerer = lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from the planner options so the runner keys the marker row by\n\t* the right space when executing the plan.\n\t*/\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\nexport { TypeScriptRenderablePostgresMigration as t };\n\n//# sourceMappingURL=planner-produced-postgres-migration-Cicg2sXg.mjs.map"],"mappings":";;;;AAIA,IAAI,wCAAwC,cAAc,kBAAkB;CAC3E;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO,MAAM,SAAS,qBAAqB,SAAS;EAC/D,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,uBAAuB;EAC5B,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKL,QAAQ,KAAKI,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKJ;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKC;CACb;CACA,iBAAiB,wBAAwB;EACxC,OAAO,wBAAwB,KAAKF,QAAQ;GAC3C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,qBAAqB,KAAKE;GAC1B;EACD,CAAC;CACF;AACD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ForeignKey } from "@prisma/orm-family-sql/contract/types";
|
|
2
|
+
import { SqlSchemaIR } from "@prisma/orm-family-sql/schema-ir/types";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/dist/planner-schema-lookup.d.mts
|
|
4
|
+
//#region src/core/migrations/planner-schema-lookup.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Pre-computed lookup sets for a schema table's constraints.
|
|
7
|
+
* Converts O(n*m) linear scans to O(1) Set lookups per constraint check.
|
|
8
|
+
*/
|
|
9
|
+
interface SchemaTableLookup {
|
|
10
|
+
readonly uniqueKeys: Set<string>;
|
|
11
|
+
readonly indexKeys: Set<string>;
|
|
12
|
+
readonly uniqueIndexKeys: Set<string>;
|
|
13
|
+
readonly fkKeys: Set<string>;
|
|
14
|
+
}
|
|
15
|
+
declare function buildSchemaLookupMap(schema: SqlSchemaIR): ReadonlyMap<string, SchemaTableLookup>;
|
|
16
|
+
declare function hasUniqueConstraint(lookup: SchemaTableLookup, columns: readonly string[]): boolean;
|
|
17
|
+
declare function hasIndex(lookup: SchemaTableLookup, columns: readonly string[]): boolean;
|
|
18
|
+
declare function hasForeignKey(lookup: SchemaTableLookup, fk: ForeignKey): boolean;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { hasUniqueConstraint as i, hasForeignKey as n, hasIndex as r, buildSchemaLookupMap as t };
|
|
21
|
+
//# sourceMappingURL=planner-schema-lookup-C4DHAddq.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-schema-lookup-C4DHAddq.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-schema-lookup.d.mts"],"mappings":";;;;;;;;UAOU;WACC,YAAY;WACZ,WAAW;WACX,iBAAiB;WACjB,QAAQ;;iBAEF,qBAAqB,QAAQ,cAAc,oBAAoB;iBAC/D,oBAAoB,QAAQ,mBAAmB;iBAC/C,SAAS,QAAQ,mBAAmB;iBACpC,cAAc,QAAQ,mBAAmB,IAAI"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
2
|
+
//#region ../../../3-targets/3-targets/postgres/dist/planner-schema-lookup-kMIVP2y-.mjs
|
|
3
|
+
function buildSchemaLookupMap(schema) {
|
|
4
|
+
const map = /* @__PURE__ */ new Map();
|
|
5
|
+
for (const [tableName, table] of Object.entries(schema.tables)) map.set(tableName, buildSchemaTableLookup(table));
|
|
6
|
+
return map;
|
|
7
|
+
}
|
|
8
|
+
function buildSchemaTableLookup(table) {
|
|
9
|
+
const uniqueKeys = new Set(table.uniques.map((u) => u.columns.join(",")));
|
|
10
|
+
const indexKeys = new Set(table.indexes.map((i) => (i.columns ?? []).join(",")));
|
|
11
|
+
const uniqueIndexKeys = new Set(table.indexes.filter((i) => i.unique).map((i) => (i.columns ?? []).join(",")));
|
|
12
|
+
const fkKeys = /* @__PURE__ */ new Set();
|
|
13
|
+
for (const fk of table.foreignKeys) {
|
|
14
|
+
fkKeys.add(JSON.stringify([
|
|
15
|
+
fk.columns,
|
|
16
|
+
fk.referencedTable,
|
|
17
|
+
fk.referencedColumns
|
|
18
|
+
]));
|
|
19
|
+
if (fk.referencedSchema !== void 0) fkKeys.add(JSON.stringify([
|
|
20
|
+
fk.columns,
|
|
21
|
+
fk.referencedSchema,
|
|
22
|
+
fk.referencedTable,
|
|
23
|
+
fk.referencedColumns
|
|
24
|
+
]));
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
uniqueKeys,
|
|
28
|
+
indexKeys,
|
|
29
|
+
uniqueIndexKeys,
|
|
30
|
+
fkKeys
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function hasUniqueConstraint(lookup, columns) {
|
|
34
|
+
const key = columns.join(",");
|
|
35
|
+
return lookup.uniqueKeys.has(key) || lookup.uniqueIndexKeys.has(key);
|
|
36
|
+
}
|
|
37
|
+
function hasIndex(lookup, columns) {
|
|
38
|
+
const key = columns.join(",");
|
|
39
|
+
return lookup.indexKeys.has(key) || lookup.uniqueKeys.has(key);
|
|
40
|
+
}
|
|
41
|
+
function hasForeignKey(lookup, fk) {
|
|
42
|
+
if (fk.target.namespaceId === UNBOUND_NAMESPACE_ID) return lookup.fkKeys.has(JSON.stringify([
|
|
43
|
+
fk.source.columns,
|
|
44
|
+
fk.target.tableName,
|
|
45
|
+
fk.target.columns
|
|
46
|
+
]));
|
|
47
|
+
return lookup.fkKeys.has(JSON.stringify([
|
|
48
|
+
fk.source.columns,
|
|
49
|
+
fk.target.namespaceId,
|
|
50
|
+
fk.target.tableName,
|
|
51
|
+
fk.target.columns
|
|
52
|
+
]));
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { hasUniqueConstraint as i, hasForeignKey as n, hasIndex as r, buildSchemaLookupMap as t };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-schema-lookup-kMIVP2y-.mjs"],"sourcesContent":["import { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\n//#region src/core/migrations/planner-schema-lookup.ts\nfunction buildSchemaLookupMap(schema) {\n\tconst map = /* @__PURE__ */ new Map();\n\tfor (const [tableName, table] of Object.entries(schema.tables)) map.set(tableName, buildSchemaTableLookup(table));\n\treturn map;\n}\nfunction buildSchemaTableLookup(table) {\n\tconst uniqueKeys = new Set(table.uniques.map((u) => u.columns.join(\",\")));\n\tconst indexKeys = new Set(table.indexes.map((i) => (i.columns ?? []).join(\",\")));\n\tconst uniqueIndexKeys = new Set(table.indexes.filter((i) => i.unique).map((i) => (i.columns ?? []).join(\",\")));\n\tconst fkKeys = /* @__PURE__ */ new Set();\n\tfor (const fk of table.foreignKeys) {\n\t\tfkKeys.add(JSON.stringify([\n\t\t\tfk.columns,\n\t\t\tfk.referencedTable,\n\t\t\tfk.referencedColumns\n\t\t]));\n\t\tif (fk.referencedSchema !== void 0) fkKeys.add(JSON.stringify([\n\t\t\tfk.columns,\n\t\t\tfk.referencedSchema,\n\t\t\tfk.referencedTable,\n\t\t\tfk.referencedColumns\n\t\t]));\n\t}\n\treturn {\n\t\tuniqueKeys,\n\t\tindexKeys,\n\t\tuniqueIndexKeys,\n\t\tfkKeys\n\t};\n}\nfunction hasUniqueConstraint(lookup, columns) {\n\tconst key = columns.join(\",\");\n\treturn lookup.uniqueKeys.has(key) || lookup.uniqueIndexKeys.has(key);\n}\nfunction hasIndex(lookup, columns) {\n\tconst key = columns.join(\",\");\n\treturn lookup.indexKeys.has(key) || lookup.uniqueKeys.has(key);\n}\nfunction hasForeignKey(lookup, fk) {\n\tif (fk.target.namespaceId === UNBOUND_NAMESPACE_ID) return lookup.fkKeys.has(JSON.stringify([\n\t\tfk.source.columns,\n\t\tfk.target.tableName,\n\t\tfk.target.columns\n\t]));\n\treturn lookup.fkKeys.has(JSON.stringify([\n\t\tfk.source.columns,\n\t\tfk.target.namespaceId,\n\t\tfk.target.tableName,\n\t\tfk.target.columns\n\t]));\n}\n//#endregion\nexport { hasUniqueConstraint as i, hasForeignKey as n, hasIndex as r, buildSchemaLookupMap as t };\n\n//# sourceMappingURL=planner-schema-lookup-kMIVP2y-.mjs.map"],"mappings":";;AAEA,SAAS,qBAAqB,QAAQ;CACrC,MAAM,sBAAsB,IAAI,IAAI;CACpC,KAAK,MAAM,CAAC,WAAW,UAAU,OAAO,QAAQ,OAAO,MAAM,GAAG,IAAI,IAAI,WAAW,uBAAuB,KAAK,CAAC;CAChH,OAAO;AACR;AACA,SAAS,uBAAuB,OAAO;CACtC,MAAM,aAAa,IAAI,IAAI,MAAM,QAAQ,KAAK,MAAM,EAAE,QAAQ,KAAK,GAAG,CAAC,CAAC;CACxE,MAAM,YAAY,IAAI,IAAI,MAAM,QAAQ,KAAK,OAAO,EAAE,WAAW,CAAC,EAAA,CAAG,KAAK,GAAG,CAAC,CAAC;CAC/E,MAAM,kBAAkB,IAAI,IAAI,MAAM,QAAQ,QAAQ,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,OAAO,EAAE,WAAW,CAAC,EAAA,CAAG,KAAK,GAAG,CAAC,CAAC;CAC7G,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,MAAM,MAAM,aAAa;EACnC,OAAO,IAAI,KAAK,UAAU;GACzB,GAAG;GACH,GAAG;GACH,GAAG;EACJ,CAAC,CAAC;EACF,IAAI,GAAG,qBAAqB,KAAK,GAAG,OAAO,IAAI,KAAK,UAAU;GAC7D,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;EACJ,CAAC,CAAC;CACH;CACA,OAAO;EACN;EACA;EACA;EACA;CACD;AACD;AACA,SAAS,oBAAoB,QAAQ,SAAS;CAC7C,MAAM,MAAM,QAAQ,KAAK,GAAG;CAC5B,OAAO,OAAO,WAAW,IAAI,GAAG,KAAK,OAAO,gBAAgB,IAAI,GAAG;AACpE;AACA,SAAS,SAAS,QAAQ,SAAS;CAClC,MAAM,MAAM,QAAQ,KAAK,GAAG;CAC5B,OAAO,OAAO,UAAU,IAAI,GAAG,KAAK,OAAO,WAAW,IAAI,GAAG;AAC9D;AACA,SAAS,cAAc,QAAQ,IAAI;CAClC,IAAI,GAAG,OAAO,gBAAgB,sBAAsB,OAAO,OAAO,OAAO,IAAI,KAAK,UAAU;EAC3F,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;CACX,CAAC,CAAC;CACF,OAAO,OAAO,OAAO,IAAI,KAAK,UAAU;EACvC,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;CACX,CAAC,CAAC;AACH"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StorageColumn, StorageTypeInstance } from "@prisma/orm-family-sql/contract/types";
|
|
2
|
+
import { CodecControlHooks } from "@prisma/orm-family-sql/family/control";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks.d.mts
|
|
4
|
+
//#region src/core/migrations/planner-sql-checks.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* String-keyed entry points the migration ops use to render
|
|
7
|
+
* schema-qualified DDL and catalog checks. The `schema` argument is
|
|
8
|
+
* interpreted as a namespace coordinate: the framework `__unbound__`
|
|
9
|
+
* sentinel resolves to the late-bound `PostgresUnboundSchema` singleton
|
|
10
|
+
* (which elides the qualifier so `search_path` decides at runtime); any
|
|
11
|
+
* other id materialises a `PostgresSchema(id)` whose qualifier is the
|
|
12
|
+
* named schema. Helpers route through these `Namespace` concretions so
|
|
13
|
+
* the unbound branch lives in the polymorphic override, not the call
|
|
14
|
+
* site.
|
|
15
|
+
*/
|
|
16
|
+
declare function qualifyTableName(schema: string, table: string): string;
|
|
17
|
+
declare function buildExpectedFormatType(column: StorageColumn, codecHooks: ReadonlyMap<string, CodecControlHooks>, storageTypes?: Record<string, StorageTypeInstance>): string;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { qualifyTableName as n, buildExpectedFormatType as t };
|
|
20
|
+
//# sourceMappingURL=planner-sql-checks-CFgbRTJw.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-sql-checks-CFgbRTJw.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-sql-checks.d.mts"],"mappings":";;;;;;;;;;;;;;;iBAciB,iBAAiB,gBAAgB;iBACjC,wBAAwB,QAAQ,eAAe,YAAY,oBAAoB,oBAAoB,eAAe,eAAe"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { r as quoteIdentifier } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
|
|
2
|
+
import { h as postgresCreateNamespace } from "./postgres-schema-KSzLDONj-CsXGoY8b.mjs";
|
|
3
|
+
import { t as resolveColumnTypeMetadata } from "./planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs";
|
|
4
|
+
//#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks-DRc_78n8.mjs
|
|
5
|
+
/**
|
|
6
|
+
* String-keyed entry points the migration ops use to render
|
|
7
|
+
* schema-qualified DDL and catalog checks. The `schema` argument is
|
|
8
|
+
* interpreted as a namespace coordinate: the framework `__unbound__`
|
|
9
|
+
* sentinel resolves to the late-bound `PostgresUnboundSchema` singleton
|
|
10
|
+
* (which elides the qualifier so `search_path` decides at runtime); any
|
|
11
|
+
* other id materialises a `PostgresSchema(id)` whose qualifier is the
|
|
12
|
+
* named schema. Helpers route through these `Namespace` concretions so
|
|
13
|
+
* the unbound branch lives in the polymorphic override, not the call
|
|
14
|
+
* site.
|
|
15
|
+
*/
|
|
16
|
+
function qualifyTableName(schema, table) {
|
|
17
|
+
return postgresCreateNamespace({
|
|
18
|
+
id: schema,
|
|
19
|
+
entries: { table: {} }
|
|
20
|
+
}).qualifyTable(table);
|
|
21
|
+
}
|
|
22
|
+
const FORMAT_TYPE_DISPLAY = /* @__PURE__ */ new Map([
|
|
23
|
+
["int2", "smallint"],
|
|
24
|
+
["int4", "integer"],
|
|
25
|
+
["int8", "bigint"],
|
|
26
|
+
["float4", "real"],
|
|
27
|
+
["float8", "double precision"],
|
|
28
|
+
["bool", "boolean"],
|
|
29
|
+
["timestamp", "timestamp without time zone"],
|
|
30
|
+
["timestamptz", "timestamp with time zone"],
|
|
31
|
+
["time", "time without time zone"],
|
|
32
|
+
["timetz", "time with time zone"]
|
|
33
|
+
]);
|
|
34
|
+
const UNQUOTED_POSTGRES_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/;
|
|
35
|
+
const POSTGRES_RESERVED_IDENTIFIER_WORDS = /* @__PURE__ */ new Set([
|
|
36
|
+
"all",
|
|
37
|
+
"analyse",
|
|
38
|
+
"analyze",
|
|
39
|
+
"and",
|
|
40
|
+
"any",
|
|
41
|
+
"array",
|
|
42
|
+
"as",
|
|
43
|
+
"asc",
|
|
44
|
+
"asymmetric",
|
|
45
|
+
"authorization",
|
|
46
|
+
"between",
|
|
47
|
+
"binary",
|
|
48
|
+
"both",
|
|
49
|
+
"case",
|
|
50
|
+
"cast",
|
|
51
|
+
"check",
|
|
52
|
+
"collate",
|
|
53
|
+
"column",
|
|
54
|
+
"constraint",
|
|
55
|
+
"create",
|
|
56
|
+
"current_catalog",
|
|
57
|
+
"current_date",
|
|
58
|
+
"current_role",
|
|
59
|
+
"current_time",
|
|
60
|
+
"current_timestamp",
|
|
61
|
+
"current_user",
|
|
62
|
+
"default",
|
|
63
|
+
"deferrable",
|
|
64
|
+
"desc",
|
|
65
|
+
"distinct",
|
|
66
|
+
"do",
|
|
67
|
+
"else",
|
|
68
|
+
"end",
|
|
69
|
+
"except",
|
|
70
|
+
"false",
|
|
71
|
+
"fetch",
|
|
72
|
+
"for",
|
|
73
|
+
"foreign",
|
|
74
|
+
"freeze",
|
|
75
|
+
"from",
|
|
76
|
+
"full",
|
|
77
|
+
"grant",
|
|
78
|
+
"group",
|
|
79
|
+
"having",
|
|
80
|
+
"ilike",
|
|
81
|
+
"in",
|
|
82
|
+
"initially",
|
|
83
|
+
"inner",
|
|
84
|
+
"intersect",
|
|
85
|
+
"into",
|
|
86
|
+
"is",
|
|
87
|
+
"isnull",
|
|
88
|
+
"join",
|
|
89
|
+
"lateral",
|
|
90
|
+
"leading",
|
|
91
|
+
"left",
|
|
92
|
+
"like",
|
|
93
|
+
"limit",
|
|
94
|
+
"localtime",
|
|
95
|
+
"localtimestamp",
|
|
96
|
+
"natural",
|
|
97
|
+
"not",
|
|
98
|
+
"notnull",
|
|
99
|
+
"null",
|
|
100
|
+
"offset",
|
|
101
|
+
"on",
|
|
102
|
+
"only",
|
|
103
|
+
"or",
|
|
104
|
+
"order",
|
|
105
|
+
"outer",
|
|
106
|
+
"overlaps",
|
|
107
|
+
"placing",
|
|
108
|
+
"primary",
|
|
109
|
+
"references",
|
|
110
|
+
"right",
|
|
111
|
+
"select",
|
|
112
|
+
"session_user",
|
|
113
|
+
"similar",
|
|
114
|
+
"some",
|
|
115
|
+
"symmetric",
|
|
116
|
+
"table",
|
|
117
|
+
"then",
|
|
118
|
+
"to",
|
|
119
|
+
"trailing",
|
|
120
|
+
"true",
|
|
121
|
+
"union",
|
|
122
|
+
"unique",
|
|
123
|
+
"user",
|
|
124
|
+
"using",
|
|
125
|
+
"variadic",
|
|
126
|
+
"verbose",
|
|
127
|
+
"when",
|
|
128
|
+
"where",
|
|
129
|
+
"window",
|
|
130
|
+
"with"
|
|
131
|
+
]);
|
|
132
|
+
function formatUserDefinedTypeName(identifier) {
|
|
133
|
+
if (UNQUOTED_POSTGRES_IDENTIFIER_PATTERN.test(identifier) && !POSTGRES_RESERVED_IDENTIFIER_WORDS.has(identifier)) return identifier;
|
|
134
|
+
return quoteIdentifier(identifier);
|
|
135
|
+
}
|
|
136
|
+
function buildExpectedFormatType(column, codecHooks, storageTypes = {}) {
|
|
137
|
+
const resolved = resolveColumnTypeMetadata(column, storageTypes);
|
|
138
|
+
if (resolved.typeParams && resolved.codecId) {
|
|
139
|
+
const hooks = codecHooks.get(resolved.codecId);
|
|
140
|
+
if (hooks?.expandNativeType) return hooks.expandNativeType({
|
|
141
|
+
nativeType: resolved.nativeType,
|
|
142
|
+
codecId: resolved.codecId,
|
|
143
|
+
typeParams: resolved.typeParams
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (column.typeRef) return formatUserDefinedTypeName(resolved.nativeType);
|
|
147
|
+
return FORMAT_TYPE_DISPLAY.get(resolved.nativeType) ?? resolved.nativeType;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
export { qualifyTableName as n, buildExpectedFormatType as t };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=planner-sql-checks-DRc_78n8-C9nHOrvU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-sql-checks-DRc_78n8-C9nHOrvU.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-sql-checks-DRc_78n8.mjs"],"sourcesContent":["import { i as postgresCreateNamespace } from \"./postgres-schema-KSzLDONj.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-BnBlQxyh.mjs\";\nimport { t as resolveColumnTypeMetadata } from \"./planner-type-resolution-Bt2f_q-F.mjs\";\n//#region src/core/migrations/planner-sql-checks.ts\n/**\n* String-keyed entry points the migration ops use to render\n* schema-qualified DDL and catalog checks. The `schema` argument is\n* interpreted as a namespace coordinate: the framework `__unbound__`\n* sentinel resolves to the late-bound `PostgresUnboundSchema` singleton\n* (which elides the qualifier so `search_path` decides at runtime); any\n* other id materialises a `PostgresSchema(id)` whose qualifier is the\n* named schema. Helpers route through these `Namespace` concretions so\n* the unbound branch lives in the polymorphic override, not the call\n* site.\n*/\nfunction qualifyTableName(schema, table) {\n\treturn postgresCreateNamespace({\n\t\tid: schema,\n\t\tentries: { table: {} }\n\t}).qualifyTable(table);\n}\nconst FORMAT_TYPE_DISPLAY = /* @__PURE__ */ new Map([\n\t[\"int2\", \"smallint\"],\n\t[\"int4\", \"integer\"],\n\t[\"int8\", \"bigint\"],\n\t[\"float4\", \"real\"],\n\t[\"float8\", \"double precision\"],\n\t[\"bool\", \"boolean\"],\n\t[\"timestamp\", \"timestamp without time zone\"],\n\t[\"timestamptz\", \"timestamp with time zone\"],\n\t[\"time\", \"time without time zone\"],\n\t[\"timetz\", \"time with time zone\"]\n]);\nconst UNQUOTED_POSTGRES_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/;\nconst POSTGRES_RESERVED_IDENTIFIER_WORDS = /* @__PURE__ */ new Set([\n\t\"all\",\n\t\"analyse\",\n\t\"analyze\",\n\t\"and\",\n\t\"any\",\n\t\"array\",\n\t\"as\",\n\t\"asc\",\n\t\"asymmetric\",\n\t\"authorization\",\n\t\"between\",\n\t\"binary\",\n\t\"both\",\n\t\"case\",\n\t\"cast\",\n\t\"check\",\n\t\"collate\",\n\t\"column\",\n\t\"constraint\",\n\t\"create\",\n\t\"current_catalog\",\n\t\"current_date\",\n\t\"current_role\",\n\t\"current_time\",\n\t\"current_timestamp\",\n\t\"current_user\",\n\t\"default\",\n\t\"deferrable\",\n\t\"desc\",\n\t\"distinct\",\n\t\"do\",\n\t\"else\",\n\t\"end\",\n\t\"except\",\n\t\"false\",\n\t\"fetch\",\n\t\"for\",\n\t\"foreign\",\n\t\"freeze\",\n\t\"from\",\n\t\"full\",\n\t\"grant\",\n\t\"group\",\n\t\"having\",\n\t\"ilike\",\n\t\"in\",\n\t\"initially\",\n\t\"inner\",\n\t\"intersect\",\n\t\"into\",\n\t\"is\",\n\t\"isnull\",\n\t\"join\",\n\t\"lateral\",\n\t\"leading\",\n\t\"left\",\n\t\"like\",\n\t\"limit\",\n\t\"localtime\",\n\t\"localtimestamp\",\n\t\"natural\",\n\t\"not\",\n\t\"notnull\",\n\t\"null\",\n\t\"offset\",\n\t\"on\",\n\t\"only\",\n\t\"or\",\n\t\"order\",\n\t\"outer\",\n\t\"overlaps\",\n\t\"placing\",\n\t\"primary\",\n\t\"references\",\n\t\"right\",\n\t\"select\",\n\t\"session_user\",\n\t\"similar\",\n\t\"some\",\n\t\"symmetric\",\n\t\"table\",\n\t\"then\",\n\t\"to\",\n\t\"trailing\",\n\t\"true\",\n\t\"union\",\n\t\"unique\",\n\t\"user\",\n\t\"using\",\n\t\"variadic\",\n\t\"verbose\",\n\t\"when\",\n\t\"where\",\n\t\"window\",\n\t\"with\"\n]);\nfunction formatUserDefinedTypeName(identifier) {\n\tif (UNQUOTED_POSTGRES_IDENTIFIER_PATTERN.test(identifier) && !POSTGRES_RESERVED_IDENTIFIER_WORDS.has(identifier)) return identifier;\n\treturn quoteIdentifier(identifier);\n}\nfunction buildExpectedFormatType(column, codecHooks, storageTypes = {}) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tif (resolved.typeParams && resolved.codecId) {\n\t\tconst hooks = codecHooks.get(resolved.codecId);\n\t\tif (hooks?.expandNativeType) return hooks.expandNativeType({\n\t\t\tnativeType: resolved.nativeType,\n\t\t\tcodecId: resolved.codecId,\n\t\t\ttypeParams: resolved.typeParams\n\t\t});\n\t}\n\tif (column.typeRef) return formatUserDefinedTypeName(resolved.nativeType);\n\treturn FORMAT_TYPE_DISPLAY.get(resolved.nativeType) ?? resolved.nativeType;\n}\n//#endregion\nexport { qualifyTableName as n, buildExpectedFormatType as t };\n\n//# sourceMappingURL=planner-sql-checks-DRc_78n8.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,OAAO,wBAAwB;EAC9B,IAAI;EACJ,SAAS,EAAE,OAAO,CAAC,EAAE;CACtB,CAAC,CAAC,CAAC,aAAa,KAAK;AACtB;AACA,MAAM,sCAAsC,IAAI,IAAI;CACnD,CAAC,QAAQ,UAAU;CACnB,CAAC,QAAQ,SAAS;CAClB,CAAC,QAAQ,QAAQ;CACjB,CAAC,UAAU,MAAM;CACjB,CAAC,UAAU,kBAAkB;CAC7B,CAAC,QAAQ,SAAS;CAClB,CAAC,aAAa,6BAA6B;CAC3C,CAAC,eAAe,0BAA0B;CAC1C,CAAC,QAAQ,wBAAwB;CACjC,CAAC,UAAU,qBAAqB;AACjC,CAAC;AACD,MAAM,uCAAuC;AAC7C,MAAM,qDAAqD,IAAI,IAAI;CAClE;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;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;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;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,0BAA0B,YAAY;CAC9C,IAAI,qCAAqC,KAAK,UAAU,KAAK,CAAC,mCAAmC,IAAI,UAAU,GAAG,OAAO;CACzH,OAAO,gBAAgB,UAAU;AAClC;AACA,SAAS,wBAAwB,QAAQ,YAAY,eAAe,CAAC,GAAG;CACvE,MAAM,WAAW,0BAA0B,QAAQ,YAAY;CAC/D,IAAI,SAAS,cAAc,SAAS,SAAS;EAC5C,MAAM,QAAQ,WAAW,IAAI,SAAS,OAAO;EAC7C,IAAI,OAAO,kBAAkB,OAAO,MAAM,iBAAiB;GAC1D,YAAY,SAAS;GACrB,SAAS,SAAS;GAClB,YAAY,SAAS;EACtB,CAAC;CACF;CACA,IAAI,OAAO,SAAS,OAAO,0BAA0B,SAAS,UAAU;CACxE,OAAO,oBAAoB,IAAI,SAAS,UAAU,KAAK,SAAS;AACjE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/postgres/dist/planner-target-details-HkP4RrRO.d.mts
|
|
2
|
+
//#region src/core/migrations/planner-target-details.d.ts
|
|
3
|
+
type OperationClass = 'dependency' | 'type' | 'table' | 'column' | 'primaryKey' | 'unique' | 'index' | 'foreignKey' | 'checkConstraint' | 'rlsPolicy' | 'rowLevelSecurity';
|
|
4
|
+
interface PostgresPlanTargetDetails {
|
|
5
|
+
readonly schema: string;
|
|
6
|
+
readonly objectType: OperationClass;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly table?: string;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { PostgresPlanTargetDetails as t };
|
|
12
|
+
//# sourceMappingURL=planner-target-details-HkP4RrRO-_xPQVPF0.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-target-details-HkP4RrRO-_xPQVPF0.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-target-details-HkP4RrRO.d.mts"],"mappings":";;KACK;UACK;WACC;WACA,YAAY;WACZ;WACA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/postgres/dist/planner-type-resolution-Bt2f_q-F.mjs
|
|
2
|
+
function resolveColumnTypeMetadata(column, storageTypes) {
|
|
3
|
+
if (!column.typeRef) return column;
|
|
4
|
+
const referencedType = storageTypes[column.typeRef];
|
|
5
|
+
if (!referencedType) return column;
|
|
6
|
+
return {
|
|
7
|
+
codecId: referencedType.codecId,
|
|
8
|
+
nativeType: referencedType.nativeType,
|
|
9
|
+
typeParams: referencedType.typeParams
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { resolveColumnTypeMetadata as t };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-type-resolution-Bt2f_q-F.mjs"],"sourcesContent":["//#region src/core/migrations/planner-type-resolution.ts\nfunction resolveColumnTypeMetadata(column, storageTypes) {\n\tif (!column.typeRef) return column;\n\tconst referencedType = storageTypes[column.typeRef];\n\tif (!referencedType) return column;\n\treturn {\n\t\tcodecId: referencedType.codecId,\n\t\tnativeType: referencedType.nativeType,\n\t\ttypeParams: referencedType.typeParams\n\t};\n}\n//#endregion\nexport { resolveColumnTypeMetadata as t };\n\n//# sourceMappingURL=planner-type-resolution-Bt2f_q-F.mjs.map"],"mappings":";AACA,SAAS,0BAA0B,QAAQ,cAAc;CACxD,IAAI,CAAC,OAAO,SAAS,OAAO;CAC5B,MAAM,iBAAiB,aAAa,OAAO;CAC3C,IAAI,CAAC,gBAAgB,OAAO;CAC5B,OAAO;EACN,SAAS,eAAe;EACxB,YAAY,eAAe;EAC3B,YAAY,eAAe;CAC5B;AACD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
2
|
+
import { SqlSchemaQualifiedView } from "@prisma/orm-family-sql/contract/contract-view";
|
|
3
|
+
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
4
|
+
//#region ../../../3-targets/3-targets/postgres/dist/postgres-contract-view-2OP5JnXl.d.mts
|
|
5
|
+
//#region src/core/postgres-contract-view.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A schema-qualified Postgres contract view: the deserialized contract
|
|
8
|
+
* intersected with a single `namespace` member holding every schema by id. It is
|
|
9
|
+
* substitutable for `Contract` (carries `storage`, `domain`, …) and reaches each
|
|
10
|
+
* schema's entities through `view.namespace.<schema>`:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const view = PostgresContractView.fromJson<Contract>(contractJson);
|
|
14
|
+
* view.namespace.public.table.users // typed table leaf in the public schema
|
|
15
|
+
* view.namespace.auth.table.users // the auth schema's own users table
|
|
16
|
+
* view.namespace.public.entries.policy.X // pack-contributed kind (RLS / #771 path)
|
|
17
|
+
* view.namespace.__unbound__.table.X // default schema, keyed by its raw id
|
|
18
|
+
* view.storage // the full contract is still present
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* This mirrors the runtime `db.enums.<ns>` keying exactly (the default schema
|
|
22
|
+
* keeps its literal `__unbound__` id). Schema names are NOT promoted to the
|
|
23
|
+
* contract root, so there is no collision with contract envelope fields — a
|
|
24
|
+
* schema named `storage` is `view.namespace.storage`, while `view.storage`
|
|
25
|
+
* stays the contract's `storage`.
|
|
26
|
+
*/
|
|
27
|
+
type PostgresContractView<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> = SqlSchemaQualifiedView<TContract>;
|
|
28
|
+
declare const PostgresContractView: {
|
|
29
|
+
/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */
|
|
30
|
+
from<TContract extends Contract<SqlStorage>>(contract: TContract): PostgresContractView<TContract>;
|
|
31
|
+
/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */
|
|
32
|
+
fromJson<TContract extends Contract<SqlStorage> = Contract<SqlStorage<string>>>(json: unknown): PostgresContractView<TContract>;
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { PostgresContractView as t };
|
|
36
|
+
//# sourceMappingURL=postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-contract-view-2OP5JnXl.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;KAyBK,qBAAqB,kBAAkB,SAAS,cAAc,SAAS,eAAe,uBAAuB;cACpG;;EAEZ,KAAK,kBAAkB,SAAS,aAAa,UAAU,YAAY,qBAAqB;;EAExF,SAAS,kBAAkB,SAAS,cAAc,SAAS,qBAAqB,gBAAgB,qBAAqB"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { b as PG_TEXT_CODEC_ID, h as PG_INT_CODEC_ID } from "./codec-ids-tX7Svtz--BuOfRaVU.mjs";
|
|
2
|
+
import { _ as roleEntityKind, c as PostgresSchema, f as nativeEnumEntityKind, g as rlsEnablementEntityKind, p as policyEntityKind } from "./postgres-schema-KSzLDONj-CsXGoY8b.mjs";
|
|
3
|
+
import { t as postgresAuthoringEntityTypes } from "./authoring-03FwIL2k-kPjZAp3s.mjs";
|
|
4
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
5
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
6
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
7
|
+
import { buildSqlSchemaQualifiedView } from "@prisma/orm-family-sql/contract/contract-view";
|
|
8
|
+
import { createPreserveEmptyPredicate } from "@prisma/orm-framework/contract/hashing-utils";
|
|
9
|
+
import { SqlContractSerializerBase } from "@prisma/orm-family-sql/family/ir";
|
|
10
|
+
import { isAuthoringEntityTypeDescriptor } from "@prisma/orm-framework/components/authoring";
|
|
11
|
+
import { sqlContractCanonicalizationHooks } from "@prisma/orm-family-sql/contract/canonicalization-hooks";
|
|
12
|
+
//#region ../../../3-targets/3-targets/postgres/dist/postgres-contract-view-FdLX7dV9.mjs
|
|
13
|
+
const POSTGRES_AUTHORING_CTX = {
|
|
14
|
+
family: "sql",
|
|
15
|
+
target: "postgres",
|
|
16
|
+
enumInferenceCodecs: {
|
|
17
|
+
text: PG_TEXT_CODEC_ID,
|
|
18
|
+
int: PG_INT_CODEC_ID
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function isAuthoringEntityTypeFactoryOutput(output) {
|
|
22
|
+
return typeof output === "object" && output !== null && "factory" in output && typeof output.factory === "function";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Walks a pack's entity-type namespace tree and emits hydration factories
|
|
26
|
+
* keyed by the descriptor's `discriminator`. Used for `storage.types`
|
|
27
|
+
* (codec-triple hydration). Namespace entries hydration dispatches by
|
|
28
|
+
* entries key, not discriminator — handled by `hydrateNamespaceEntities`.
|
|
29
|
+
*/
|
|
30
|
+
function collectStorageTypesHydrators(namespace) {
|
|
31
|
+
const registry = /* @__PURE__ */ new Map();
|
|
32
|
+
const walk = (node) => {
|
|
33
|
+
for (const value of Object.values(node)) {
|
|
34
|
+
if (isAuthoringEntityTypeDescriptor(value)) {
|
|
35
|
+
if (isAuthoringEntityTypeFactoryOutput(value.output)) {
|
|
36
|
+
const { factory } = value.output;
|
|
37
|
+
registry.set(value.discriminator, (raw) => factory(raw, POSTGRES_AUTHORING_CTX));
|
|
38
|
+
}
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (typeof value === "object" && value !== null) walk(value);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
walk(namespace);
|
|
45
|
+
return registry;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The canonicalization walk drops a field whose value equals its type's
|
|
49
|
+
* default, which for a required field of an entity kind means the emitted
|
|
50
|
+
* contract fails that kind's own schema on the next read (a RESTRICTIVE
|
|
51
|
+
* policy's `permissive: false` is the live case). The set of fields that must
|
|
52
|
+
* survive is therefore the required keys of the registered entity kinds —
|
|
53
|
+
* read off the schemas rather than listed by hand, so a kind that gains a
|
|
54
|
+
* required field is covered the day it gains one.
|
|
55
|
+
*/
|
|
56
|
+
function requiredEntityFieldsSurviveDefaults(kinds) {
|
|
57
|
+
return createPreserveEmptyPredicate(kinds.flatMap((kind) => requiredKeysOf(kind.schema).map((key) => [
|
|
58
|
+
"storage",
|
|
59
|
+
"namespaces",
|
|
60
|
+
"*",
|
|
61
|
+
"entries",
|
|
62
|
+
kind.kind,
|
|
63
|
+
"*",
|
|
64
|
+
key
|
|
65
|
+
])));
|
|
66
|
+
}
|
|
67
|
+
function isSchemaPropList(value) {
|
|
68
|
+
return Array.isArray(value) && value.every((prop) => prop !== null && (typeof prop === "object" || typeof prop === "function") && "kind" in prop && "key" in prop);
|
|
69
|
+
}
|
|
70
|
+
function requiredKeysOf(schema) {
|
|
71
|
+
const props = "props" in schema ? schema.props : void 0;
|
|
72
|
+
if (!isSchemaPropList(props)) throw new InternalError("entity-kind schema does not expose arktype object props; the required-field preserve set cannot be derived");
|
|
73
|
+
return props.flatMap((prop) => prop.kind === "required" && typeof prop.key === "string" ? [prop.key] : []);
|
|
74
|
+
}
|
|
75
|
+
var PostgresContractSerializer = class extends SqlContractSerializerBase {
|
|
76
|
+
shouldPreserveEmpty;
|
|
77
|
+
constructor(extraPackEntityKinds = []) {
|
|
78
|
+
const storageTypesHydrators = collectStorageTypesHydrators(postgresAuthoringEntityTypes);
|
|
79
|
+
const entityKinds = [
|
|
80
|
+
policyEntityKind,
|
|
81
|
+
roleEntityKind,
|
|
82
|
+
rlsEnablementEntityKind,
|
|
83
|
+
nativeEnumEntityKind,
|
|
84
|
+
...extraPackEntityKinds
|
|
85
|
+
];
|
|
86
|
+
super(storageTypesHydrators, entityKinds);
|
|
87
|
+
const preserveRequired = requiredEntityFieldsSurviveDefaults(entityKinds);
|
|
88
|
+
this.shouldPreserveEmpty = (path) => preserveRequired(path) || sqlContractCanonicalizationHooks.shouldPreserveEmpty(path);
|
|
89
|
+
}
|
|
90
|
+
hydrateSqlNamespaceEntry(nsId, raw) {
|
|
91
|
+
const { id, entries } = blindCast(super.hydrateSqlNamespaceEntry(nsId, raw));
|
|
92
|
+
const allSlotsEmpty = Object.values(entries).every((slot) => slot === void 0 || Object.keys(slot).length === 0);
|
|
93
|
+
if (id === UNBOUND_NAMESPACE_ID && allSlotsEmpty) return PostgresSchema.unbound;
|
|
94
|
+
const valueSetSlot = entries["valueSet"];
|
|
95
|
+
const hasValueSets = valueSetSlot !== void 0 && Object.keys(valueSetSlot).length > 0;
|
|
96
|
+
return new PostgresSchema({
|
|
97
|
+
id,
|
|
98
|
+
entries: {
|
|
99
|
+
...entries,
|
|
100
|
+
table: entries["table"] ?? {},
|
|
101
|
+
...hasValueSets ? { valueSet: valueSetSlot } : {}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
serializeContract(contract) {
|
|
106
|
+
const { storage, ...rest } = contract;
|
|
107
|
+
const namespacesJson = {};
|
|
108
|
+
for (const [nsId, ns] of Object.entries(storage.namespaces)) {
|
|
109
|
+
const isUnboundSlot = ns.id === UNBOUND_NAMESPACE_ID;
|
|
110
|
+
namespacesJson[nsId] = {
|
|
111
|
+
id: ns.id,
|
|
112
|
+
kind: isUnboundSlot ? "postgres-unbound-schema" : "postgres-schema",
|
|
113
|
+
entries: this.serializeNamespaceEntries(ns.entries)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const storageOut = {
|
|
117
|
+
storageHash: String(storage.storageHash),
|
|
118
|
+
namespaces: namespacesJson
|
|
119
|
+
};
|
|
120
|
+
if (storage.types !== void 0) {
|
|
121
|
+
const typesOut = {};
|
|
122
|
+
for (const [name, entry] of Object.entries(storage.types)) typesOut[name] = this.serializeJsonObject(entry);
|
|
123
|
+
storageOut["types"] = typesOut;
|
|
124
|
+
}
|
|
125
|
+
return blindCast({
|
|
126
|
+
...rest,
|
|
127
|
+
storage: storageOut
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const PostgresContractView = {
|
|
132
|
+
/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */
|
|
133
|
+
from(contract) {
|
|
134
|
+
return buildSqlSchemaQualifiedView(contract);
|
|
135
|
+
},
|
|
136
|
+
/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */
|
|
137
|
+
fromJson(json) {
|
|
138
|
+
return buildSqlSchemaQualifiedView(new PostgresContractSerializer().deserializeContract(json));
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
export { PostgresContractView as n, PostgresContractSerializer as t };
|
|
143
|
+
|
|
144
|
+
//# sourceMappingURL=postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-contract-view-FdLX7dV9.mjs"],"sourcesContent":["import { b as PG_TEXT_CODEC_ID, h as PG_INT_CODEC_ID } from \"./codec-ids-tX7Svtz-.mjs\";\nimport { a as nativeEnumEntityKind, c as roleEntityKind, o as policyEntityKind, s as rlsEnablementEntityKind, t as PostgresSchema } from \"./postgres-schema-KSzLDONj.mjs\";\nimport { t as postgresAuthoringEntityTypes } from \"./authoring-03FwIL2k.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { buildSqlSchemaQualifiedView } from \"@internal/sql-contract/contract-view\";\nimport { createPreserveEmptyPredicate } from \"@internal/contract/hashing-utils\";\nimport { SqlContractSerializerBase } from \"@internal/family-sql/ir\";\nimport { isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\n//#region src/core/postgres-contract-serializer.ts\nconst POSTGRES_AUTHORING_CTX = {\n\tfamily: \"sql\",\n\ttarget: \"postgres\",\n\tenumInferenceCodecs: {\n\t\ttext: PG_TEXT_CODEC_ID,\n\t\tint: PG_INT_CODEC_ID\n\t}\n};\nfunction isAuthoringEntityTypeFactoryOutput(output) {\n\treturn typeof output === \"object\" && output !== null && \"factory\" in output && typeof output.factory === \"function\";\n}\n/**\n* Walks a pack's entity-type namespace tree and emits hydration factories\n* keyed by the descriptor's `discriminator`. Used for `storage.types`\n* (codec-triple hydration). Namespace entries hydration dispatches by\n* entries key, not discriminator — handled by `hydrateNamespaceEntities`.\n*/\nfunction collectStorageTypesHydrators(namespace) {\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst walk = (node) => {\n\t\tfor (const value of Object.values(node)) {\n\t\t\tif (isAuthoringEntityTypeDescriptor(value)) {\n\t\t\t\tif (isAuthoringEntityTypeFactoryOutput(value.output)) {\n\t\t\t\t\tconst { factory } = value.output;\n\t\t\t\t\tregistry.set(value.discriminator, (raw) => factory(raw, POSTGRES_AUTHORING_CTX));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof value === \"object\" && value !== null) walk(value);\n\t\t}\n\t};\n\twalk(namespace);\n\treturn registry;\n}\n/**\n* The canonicalization walk drops a field whose value equals its type's\n* default, which for a required field of an entity kind means the emitted\n* contract fails that kind's own schema on the next read (a RESTRICTIVE\n* policy's `permissive: false` is the live case). The set of fields that must\n* survive is therefore the required keys of the registered entity kinds —\n* read off the schemas rather than listed by hand, so a kind that gains a\n* required field is covered the day it gains one.\n*/\nfunction requiredEntityFieldsSurviveDefaults(kinds) {\n\treturn createPreserveEmptyPredicate(kinds.flatMap((kind) => requiredKeysOf(kind.schema).map((key) => [\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\tkind.kind,\n\t\t\"*\",\n\t\tkey\n\t])));\n}\nfunction isSchemaPropList(value) {\n\treturn Array.isArray(value) && value.every((prop) => prop !== null && (typeof prop === \"object\" || typeof prop === \"function\") && \"kind\" in prop && \"key\" in prop);\n}\nfunction requiredKeysOf(schema) {\n\tconst props = \"props\" in schema ? schema.props : void 0;\n\tif (!isSchemaPropList(props)) throw new InternalError(\"entity-kind schema does not expose arktype object props; the required-field preserve set cannot be derived\");\n\treturn props.flatMap((prop) => prop.kind === \"required\" && typeof prop.key === \"string\" ? [prop.key] : []);\n}\nvar PostgresContractSerializer = class extends SqlContractSerializerBase {\n\tshouldPreserveEmpty;\n\tconstructor(extraPackEntityKinds = []) {\n\t\tconst storageTypesHydrators = collectStorageTypesHydrators(postgresAuthoringEntityTypes);\n\t\tconst entityKinds = [\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind,\n\t\t\t...extraPackEntityKinds\n\t\t];\n\t\tsuper(storageTypesHydrators, entityKinds);\n\t\tconst preserveRequired = requiredEntityFieldsSurviveDefaults(entityKinds);\n\t\tthis.shouldPreserveEmpty = (path) => preserveRequired(path) || sqlContractCanonicalizationHooks.shouldPreserveEmpty(path);\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst { id, entries } = blindCast(super.hydrateSqlNamespaceEntry(nsId, raw));\n\t\tconst allSlotsEmpty = Object.values(entries).every((slot) => slot === void 0 || Object.keys(slot).length === 0);\n\t\tif (id === UNBOUND_NAMESPACE_ID && allSlotsEmpty) return PostgresSchema.unbound;\n\t\tconst valueSetSlot = entries[\"valueSet\"];\n\t\tconst hasValueSets = valueSetSlot !== void 0 && Object.keys(valueSetSlot).length > 0;\n\t\treturn new PostgresSchema({\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\t...entries,\n\t\t\t\ttable: entries[\"table\"] ?? {},\n\t\t\t\t...hasValueSets ? { valueSet: valueSetSlot } : {}\n\t\t\t}\n\t\t});\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst isUnboundSlot = ns.id === UNBOUND_NAMESPACE_ID;\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: isUnboundSlot ? \"postgres-unbound-schema\" : \"postgres-schema\",\n\t\t\t\tentries: this.serializeNamespaceEntries(ns.entries)\n\t\t\t};\n\t\t}\n\t\tconst storageOut = {\n\t\t\tstorageHash: String(storage.storageHash),\n\t\t\tnamespaces: namespacesJson\n\t\t};\n\t\tif (storage.types !== void 0) {\n\t\t\tconst typesOut = {};\n\t\t\tfor (const [name, entry] of Object.entries(storage.types)) typesOut[name] = this.serializeJsonObject(entry);\n\t\t\tstorageOut[\"types\"] = typesOut;\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: storageOut\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/postgres-contract-view.ts\nconst PostgresContractView = {\n\t/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */\n\tfrom(contract) {\n\t\treturn buildSqlSchemaQualifiedView(contract);\n\t},\n\t/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */\n\tfromJson(json) {\n\t\treturn buildSqlSchemaQualifiedView(new PostgresContractSerializer().deserializeContract(json));\n\t}\n};\n//#endregion\nexport { PostgresContractSerializer as n, PostgresContractView as t };\n\n//# sourceMappingURL=postgres-contract-view-FdLX7dV9.mjs.map"],"mappings":"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"}
|