@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,269 @@
|
|
|
1
|
+
import { t as PostgresRlsPolicy } from "./postgres-rls-policy-CnDxf3z9-C3LIHAIG.mjs";
|
|
2
|
+
import { t as PostgresTableSource } from "./table-source-ikHOZmhD-DriY1Lcr.mjs";
|
|
3
|
+
import { SqlNamespaceBase, SqlNamespaceEntries, SqlNamespaceInput, SqlNode, SqlStorage, StorageTable, StorageValueSet } from "@prisma/orm-family-sql/contract/types";
|
|
4
|
+
import { CfExpr } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
5
|
+
import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
6
|
+
//#region ../../../3-targets/3-targets/postgres/dist/postgres-schema-Xsjt3RKO.d.mts
|
|
7
|
+
//#region src/core/postgres-native-enum.d.ts
|
|
8
|
+
interface PostgresNativeEnumInput<Members extends readonly string[] = readonly string[]> {
|
|
9
|
+
/** The Postgres type name (`CREATE TYPE <typeName> AS ENUM (…)`). */
|
|
10
|
+
readonly typeName: string;
|
|
11
|
+
/** Member values in declaration order — this is the Postgres enum sort order. */
|
|
12
|
+
readonly members: Members;
|
|
13
|
+
readonly control?: ControlPolicy;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Postgres contract-IR class for a native enum type (`CREATE TYPE … AS ENUM (…)`).
|
|
17
|
+
*
|
|
18
|
+
* This is an authored, serialized Contract-IR entity — it is registered as an entity
|
|
19
|
+
* kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;
|
|
20
|
+
* the schema-diff tree will use `PostgresNativeEnumSchemaNode` when the managed phase
|
|
21
|
+
* builds it.
|
|
22
|
+
*
|
|
23
|
+
* A member is a value, not a name→value pair — matching `CREATE TYPE … AS ENUM
|
|
24
|
+
* ('a', 'b')`, which has no separate member name.
|
|
25
|
+
*
|
|
26
|
+
* Target-only concept — no SQL-family abstract. Extends `SqlNode` directly,
|
|
27
|
+
* frozen at construction via `freezeNode(this)`. The `kind: 'postgres-enum'`
|
|
28
|
+
* discriminant is enumerable so it survives JSON. Lives at
|
|
29
|
+
* `storage.namespaces[ns].entries.native_enum[HandleName]`; the entries key
|
|
30
|
+
* (`native_enum`) is the entity-kind descriptor's `kind`, decoupled from this
|
|
31
|
+
* node's own `kind` literal — the same shape as `table`/`StorageTable` and
|
|
32
|
+
* `valueSet`/`StorageValueSet`.
|
|
33
|
+
*/
|
|
34
|
+
declare class PostgresNativeEnum<Members extends readonly string[] = readonly string[]> extends SqlNode {
|
|
35
|
+
static is(node: unknown): node is PostgresNativeEnum;
|
|
36
|
+
readonly kind: "postgres-enum";
|
|
37
|
+
readonly typeName: string;
|
|
38
|
+
readonly members: Members;
|
|
39
|
+
readonly control?: ControlPolicy;
|
|
40
|
+
constructor(input: PostgresNativeEnumInput<Members>);
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/core/postgres-rls-enablement.d.ts
|
|
44
|
+
interface PostgresRlsEnablementInput {
|
|
45
|
+
/** Name of the table this marker declares RLS-controlled. */
|
|
46
|
+
readonly tableName: string;
|
|
47
|
+
/** Namespace coordinate (schema name). Markers are schema-scoped like policies. */
|
|
48
|
+
readonly namespaceId: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Postgres contract-IR marker for `@@rls` on a model: the table named here is
|
|
52
|
+
* RLS-controlled (`ENABLE ROW LEVEL SECURITY` is driven by this marker, never
|
|
53
|
+
* by the policy set).
|
|
54
|
+
*
|
|
55
|
+
* This is an authored, serialized Contract-IR entity — it is registered as an
|
|
56
|
+
* entity kind, extends `SqlNode`, and is stored in `contract.json` under
|
|
57
|
+
* `entries.rls[tableName]`. Target-only concept — no SQL-family abstract.
|
|
58
|
+
* Frozen at construction via `freezeNode(this)`. The `kind: 'rls'`
|
|
59
|
+
* discriminant is enumerable so it survives JSON serialization; the literal
|
|
60
|
+
* matches the entries key (one-string rule).
|
|
61
|
+
*/
|
|
62
|
+
declare class PostgresRlsEnablement extends SqlNode {
|
|
63
|
+
readonly kind: "rls";
|
|
64
|
+
readonly tableName: string;
|
|
65
|
+
readonly namespaceId: string;
|
|
66
|
+
constructor(input: PostgresRlsEnablementInput);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/core/postgres-role.d.ts
|
|
70
|
+
interface PostgresRoleInput {
|
|
71
|
+
readonly name: string;
|
|
72
|
+
/**
|
|
73
|
+
* Namespace coordinate. Roles are cluster-scoped; pass `UNBOUND_NAMESPACE_ID`
|
|
74
|
+
* from `@internal/framework-components/ir`.
|
|
75
|
+
*/
|
|
76
|
+
readonly namespaceId: string;
|
|
77
|
+
/**
|
|
78
|
+
* Defaults to {@link ROLE_DEFAULT_CONTROL_POLICY} when omitted. Roles are
|
|
79
|
+
* referenced but never owned, so `'external'` is the only allowed value.
|
|
80
|
+
*/
|
|
81
|
+
readonly control?: 'external';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Postgres contract-IR class for a database role (`CREATE ROLE …`).
|
|
85
|
+
*
|
|
86
|
+
* This is an authored, serialized Contract-IR entity — it is registered as an entity
|
|
87
|
+
* kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;
|
|
88
|
+
* the schema-diff tree uses `PostgresRoleSchemaNode` for that role.
|
|
89
|
+
*
|
|
90
|
+
* Roles are cluster-scoped, so their namespace coordinate is always
|
|
91
|
+
* `UNBOUND_NAMESPACE_ID`. Target-only concept — no SQL-family abstract.
|
|
92
|
+
* Extends `SqlNode` directly, frozen at construction via `freezeNode(this)`.
|
|
93
|
+
* The `kind: 'role'` discriminant is enumerable so it survives JSON.
|
|
94
|
+
* Matches the entries key (one-string rule).
|
|
95
|
+
*
|
|
96
|
+
* `control` always carries a value (never omitted): it defaults to
|
|
97
|
+
* {@link ROLE_DEFAULT_CONTROL_POLICY} in the constructor, so both a
|
|
98
|
+
* freshly-authored role and one hydrated from an older `contract.json`
|
|
99
|
+
* lacking the field resolve the same way — the control-policy resolver
|
|
100
|
+
* reads it directly off the entity instead of special-casing role issues.
|
|
101
|
+
*/
|
|
102
|
+
declare class PostgresRole extends SqlNode {
|
|
103
|
+
readonly kind: "role";
|
|
104
|
+
readonly name: string;
|
|
105
|
+
readonly namespaceId: string;
|
|
106
|
+
readonly control: 'external';
|
|
107
|
+
constructor(input: PostgresRoleInput);
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/core/postgres-schema.d.ts
|
|
111
|
+
type PostgresContract = Contract<SqlStorage> & {
|
|
112
|
+
readonly target: 'postgres';
|
|
113
|
+
};
|
|
114
|
+
type PostgresNamespaceEntries = SqlNamespaceEntries & {
|
|
115
|
+
readonly policy?: Readonly<Record<string, PostgresRlsPolicy>>;
|
|
116
|
+
readonly role?: Readonly<Record<string, PostgresRole>>;
|
|
117
|
+
readonly rls?: Readonly<Record<string, PostgresRlsEnablement>>;
|
|
118
|
+
readonly native_enum?: Readonly<Record<string, PostgresNativeEnum>>;
|
|
119
|
+
};
|
|
120
|
+
interface PostgresSchemaInput {
|
|
121
|
+
readonly id: string;
|
|
122
|
+
readonly entries: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Postgres target `Namespace` concretion — a Postgres schema (`CREATE
|
|
126
|
+
* SCHEMA …`). Each Postgres `SqlStorage` carries a
|
|
127
|
+
* `namespaces: Record<NamespaceId, PostgresSchema>` map populated by
|
|
128
|
+
* the Postgres PSL interpreter from `namespace { … }` AST buckets.
|
|
129
|
+
*
|
|
130
|
+
* `entries` holds entity-kind maps (`table`, `valueSet`). Qualifier
|
|
131
|
+
* emission is the rendering seam: DDL / SQL emission asks the namespace
|
|
132
|
+
* for its qualifier (`"<schema>"`) or for a qualified table name
|
|
133
|
+
* (`"<schema>"."<table>"`) and consumes the result polymorphically.
|
|
134
|
+
* The unbound singleton below overrides these methods to elide the
|
|
135
|
+
* prefix entirely — call sites stay polymorphic and never branch on
|
|
136
|
+
* `id === UNBOUND_NAMESPACE_ID`.
|
|
137
|
+
*/
|
|
138
|
+
declare class PostgresSchema extends SqlNamespaceBase {
|
|
139
|
+
/**
|
|
140
|
+
* Stable singleton reference for the late-bound slot. Materialised
|
|
141
|
+
* lazily below the singleton subclass declaration so the static
|
|
142
|
+
* initialiser sees the subclass before assigning. Consumers always
|
|
143
|
+
* reach for `PostgresSchema.unbound` (or `PostgresUnboundSchema.instance`
|
|
144
|
+
* — same identity).
|
|
145
|
+
*/
|
|
146
|
+
static unbound: PostgresUnboundSchema;
|
|
147
|
+
readonly kind: 'schema';
|
|
148
|
+
readonly id: string;
|
|
149
|
+
readonly entries: PostgresNamespaceEntries;
|
|
150
|
+
constructor(input: PostgresSchemaInput);
|
|
151
|
+
get table(): Readonly<Record<string, StorageTable>>;
|
|
152
|
+
get valueSet(): Readonly<Record<string, StorageValueSet>> | undefined;
|
|
153
|
+
get policy(): Readonly<Record<string, PostgresRlsPolicy>>;
|
|
154
|
+
get role(): Readonly<Record<string, PostgresRole>>;
|
|
155
|
+
get rls(): Readonly<Record<string, PostgresRlsEnablement>>;
|
|
156
|
+
/**
|
|
157
|
+
* The bare schema qualifier as it would appear in a rendered SQL
|
|
158
|
+
* fragment (already quoted). The unbound-schema singleton overrides
|
|
159
|
+
* this to return `''`.
|
|
160
|
+
*/
|
|
161
|
+
qualifier(): string;
|
|
162
|
+
/**
|
|
163
|
+
* Qualify a table name with the schema prefix
|
|
164
|
+
* (`"<schema>"."<table>"`). The unbound-schema singleton overrides
|
|
165
|
+
* this to emit just `"<table>"` so the resolved DDL is unqualified
|
|
166
|
+
* and `search_path` decides where the object lands at runtime.
|
|
167
|
+
*/
|
|
168
|
+
qualifyTable(tableName: string): string;
|
|
169
|
+
/**
|
|
170
|
+
* Render a SQL string-literal containing the qualified-name form
|
|
171
|
+
* suitable for `to_regclass(...)` arguments (e.g. `'"public"."user"'`).
|
|
172
|
+
* The unbound singleton overrides this to elide the schema prefix
|
|
173
|
+
* (`'"user"'`) so `search_path` resolves the object at runtime.
|
|
174
|
+
*/
|
|
175
|
+
regclassLiteral(name: string): string;
|
|
176
|
+
/**
|
|
177
|
+
* Render a SQL expression that evaluates to this namespace's schema
|
|
178
|
+
* name at runtime, ready to drop into a `WHERE table_schema = …` /
|
|
179
|
+
* `WHERE n.nspname = …` clause. Named schemas emit a quoted SQL
|
|
180
|
+
* literal (`'public'`); the unbound singleton overrides this to emit
|
|
181
|
+
* `current_schema()` so catalog queries match whichever schema the
|
|
182
|
+
* connection's `search_path` resolved at runtime.
|
|
183
|
+
*/
|
|
184
|
+
schemaSqlExpression(): string;
|
|
185
|
+
/**
|
|
186
|
+
* Typed-AST counterpart of {@link schemaSqlExpression}: the expression a
|
|
187
|
+
* builder-built catalog check compares `n.nspname` / `table_schema`
|
|
188
|
+
* against. Named schemas bind the schema name as a text parameter; the
|
|
189
|
+
* unbound singleton overrides this to the opaque `current_schema()`
|
|
190
|
+
* expression so the live connection's `search_path` decides at runtime.
|
|
191
|
+
*/
|
|
192
|
+
schemaFilterExpression(): CfExpr;
|
|
193
|
+
/**
|
|
194
|
+
* Typed-AST counterpart of {@link qualifyTable}: the FROM source a
|
|
195
|
+
* builder-built check uses to address a user table in this namespace.
|
|
196
|
+
* Named schemas qualify (`"schema"."table"`); the unbound singleton
|
|
197
|
+
* overrides this to leave the table unqualified so `search_path`
|
|
198
|
+
* resolves it at runtime.
|
|
199
|
+
*/
|
|
200
|
+
tableSource(tableName: string, alias?: string): PostgresTableSource;
|
|
201
|
+
/**
|
|
202
|
+
* The bare schema name a DDL planner should target when emitting
|
|
203
|
+
* statements that need to identify this namespace in the live
|
|
204
|
+
* database (e.g. `CREATE TABLE "<ddlSchemaName>"."<table>" …`,
|
|
205
|
+
* catalog filters, planner conflict lookups). Named schemas resolve
|
|
206
|
+
* to their own id. The `PostgresUnboundSchema` singleton inherits
|
|
207
|
+
* this and returns `UNBOUND_NAMESPACE_ID` — callers that dispatch
|
|
208
|
+
* through `qualifyTableName` route through the polymorphic
|
|
209
|
+
* `PostgresUnboundSchema` overrides and produce unqualified
|
|
210
|
+
* (search-path-resolved) output automatically.
|
|
211
|
+
*/
|
|
212
|
+
ddlSchemaName(_storage: SqlStorage): string;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Singleton subclass for the reserved sentinel namespace id
|
|
216
|
+
* (`UNBOUND_NAMESPACE_ID`) — the late-bound Postgres slot whose binding
|
|
217
|
+
* the connection's `search_path` resolves at runtime. Overrides
|
|
218
|
+
* qualifier emission to elide the schema prefix; call sites that consume
|
|
219
|
+
* `qualifier()` / `qualifyTable()` get unqualified output without
|
|
220
|
+
* branching on the namespace id.
|
|
221
|
+
*
|
|
222
|
+
* This is the target-side materialization of "the framework provides
|
|
223
|
+
* affordances; targets implement specifics": the framework names the
|
|
224
|
+
* sentinel; Postgres decides what late-bound means here (the table
|
|
225
|
+
* name, naked — the schema is supplied by the live connection's
|
|
226
|
+
* `search_path`).
|
|
227
|
+
*
|
|
228
|
+
* `ddlSchemaName` is inherited from `PostgresSchema` and returns
|
|
229
|
+
* `UNBOUND_NAMESPACE_ID`. Downstream helpers such as `qualifyTableName`
|
|
230
|
+
* route through the polymorphic factory and produce unqualified output
|
|
231
|
+
* automatically.
|
|
232
|
+
*/
|
|
233
|
+
declare class PostgresUnboundSchema extends PostgresSchema {
|
|
234
|
+
static readonly instance: PostgresUnboundSchema;
|
|
235
|
+
constructor(input?: PostgresSchemaInput);
|
|
236
|
+
qualifier(): string;
|
|
237
|
+
qualifyTable(tableName: string): string;
|
|
238
|
+
schemaSqlExpression(): string;
|
|
239
|
+
schemaFilterExpression(): CfExpr;
|
|
240
|
+
tableSource(tableName: string, alias?: string): PostgresTableSource;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Narrow an arbitrary namespace (or `undefined`) to `PostgresSchema`
|
|
244
|
+
* so callers can dispatch to the polymorphic emission methods without
|
|
245
|
+
* branching at the call site. Uses the structural `kind` discriminator
|
|
246
|
+
* (`'schema'`) rather than `instanceof` so the check survives realm /
|
|
247
|
+
* bundle / hot-reload boundaries — matching the rest of the IR's
|
|
248
|
+
* narrowing convention. `PostgresUnboundSchema` passes through because
|
|
249
|
+
* it inherits the same `kind: 'schema'` from `PostgresSchema`.
|
|
250
|
+
*/
|
|
251
|
+
declare function isPostgresSchema(ns: unknown): ns is PostgresSchema;
|
|
252
|
+
/**
|
|
253
|
+
* Target-supplied `Namespace` factory the Postgres target plumbs
|
|
254
|
+
* through `defineContract({ createNamespace })` and the SQL PSL
|
|
255
|
+
* interpreter. Returns the unbound singleton for the framework
|
|
256
|
+
* sentinel and a fresh `PostgresSchema` for any other coordinate.
|
|
257
|
+
*
|
|
258
|
+
* The factory has no per-call state — every named id deterministically
|
|
259
|
+
* maps to a distinct schema instance — so callers can pass it through
|
|
260
|
+
* by reference and trust the resulting `SqlStorage.namespaces` map to
|
|
261
|
+
* be value-stable for a given input set. Native-enum column type names are
|
|
262
|
+
* schema-qualified earlier, at column construction, via the target's
|
|
263
|
+
* `authoring.qualifyColumnType` hook (`postgresQualifyColumnType`), so this
|
|
264
|
+
* factory just materialises the namespace from already-qualified entries.
|
|
265
|
+
*/
|
|
266
|
+
declare function postgresCreateNamespace(input: SqlNamespaceInput): PostgresSchema;
|
|
267
|
+
//#endregion
|
|
268
|
+
export { PostgresRlsEnablementInput as a, PostgresSchema as c, postgresCreateNamespace as d, PostgresRlsEnablement as i, PostgresUnboundSchema as l, PostgresNativeEnum as n, PostgresRole as o, PostgresNativeEnumInput as r, PostgresRoleInput as s, PostgresContract as t, isPostgresSchema as u };
|
|
269
|
+
//# sourceMappingURL=postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-schema-Xsjt3RKO.d.mts"],"mappings":";;;;;;;UAMU,wBAAwB;;WAEvB;;WAEA,SAAS;WACT,UAAU;;;;;;;;;;;;;;;;;;;;;cAqBP,mBAAmB,+DAA+D;SACvF,GAAG,gBAAgB,QAAQ;WACzB;WACA;WACA,SAAS;WACT,UAAU;EACnB,YAAY,OAAO,wBAAwB;;;;UAInC;;WAEC;;WAEA;;;;;;;;;;;;;;cAcG,8BAA8B;WACjC;WACA;WACA;EACT,YAAY,OAAO;;;;UAIX;WACC;;;;;WAKA;;;;;WAKA;;;;;;;;;;;;;;;;;;;;;cAqBG,qBAAqB;WACxB;WACA;WACA;WACA;EACT,YAAY,OAAO;;;;KAIhB,mBAAmB,SAAS;WACtB;;KAEN,2BAA2B;WACrB,SAAS,SAAS,eAAe;WACjC,OAAO,SAAS,eAAe;WAC/B,MAAM,SAAS,eAAe;WAC9B,cAAc,SAAS,eAAe;;UAEvC;WACC;WACA,SAAS,SAAS,eAAe,SAAS;;;;;;;;;;;;;;;;cAgBvC,uBAAuB;;;;;;;;SAQ5B,SAAS;WACP;WACA;WACA,SAAS;EAClB,YAAY,OAAO;MACf,SAAS,SAAS,eAAe;MACjC,YAAY,SAAS,eAAe;MACpC,UAAU,SAAS,eAAe;MAClC,QAAQ,SAAS,eAAe;MAChC,OAAO,SAAS,eAAe;;;;;;EAMnC;;;;;;;EAOA,aAAa;;;;;;;EAOb,gBAAgB;;;;;;;;;EAShB;;;;;;;;EAQA,0BAA0B;;;;;;;;EAQ1B,YAAY,mBAAmB,iBAAiB;;;;;;;;;;;;EAYhD,cAAc,UAAU;;;;;;;;;;;;;;;;;;;;;cAqBZ,8BAA8B;kBAC1B,UAAU;EAC1B,YAAY,QAAQ;EACpB;EACA,aAAa;EACb;EACA,0BAA0B;EAC1B,YAAY,mBAAmB,iBAAiB;;;;;;;;;;;iBAWjC,iBAAiB,cAAc,MAAM;;;;;;;;;;;;;;;iBAerC,wBAAwB,OAAO,oBAAoB"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
2
|
+
import { freezeNode } from "@prisma/orm-framework/components/ir";
|
|
3
|
+
import { PrimaryKey, SqlCheckConstraintIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIRNode, SqlUniqueIR, assertNode, relationalNodeEntityKind, relationalNodeGranularity } from "@prisma/orm-family-sql/schema-ir/types";
|
|
4
|
+
//#region ../../../3-targets/3-targets/postgres/dist/postgres-table-schema-node-BBkitBQh.mjs
|
|
5
|
+
/**
|
|
6
|
+
* The `nodeKind` discriminant for each Postgres schema-diff node. Each node
|
|
7
|
+
* carries a unique value; the static `is`/`assert` guards compare against these
|
|
8
|
+
* identifiers rather than spelling the string inline or using `instanceof`. The
|
|
9
|
+
* field is an enumerable own property carried on every node instance.
|
|
10
|
+
*/
|
|
11
|
+
const PostgresSchemaNodeKind = {
|
|
12
|
+
database: "postgres-database",
|
|
13
|
+
namespace: "postgres-namespace",
|
|
14
|
+
table: "postgres-table",
|
|
15
|
+
policy: "postgres-policy",
|
|
16
|
+
role: "postgres-role",
|
|
17
|
+
nativeEnum: "postgres-native-enum"
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The one real map from a Postgres-specific `nodeKind` to the
|
|
21
|
+
* framework-neutral {@link DiffSubjectGranularity} its diff issues carry —
|
|
22
|
+
* resolution is by `nodeKind` equality against this map, never a
|
|
23
|
+
* `nodeKind`-suffix string match and never anything stamped on the node.
|
|
24
|
+
*/
|
|
25
|
+
const POSTGRES_NODE_GRANULARITY = {
|
|
26
|
+
[PostgresSchemaNodeKind.database]: "structural",
|
|
27
|
+
[PostgresSchemaNodeKind.namespace]: "namespace",
|
|
28
|
+
[PostgresSchemaNodeKind.table]: "entity",
|
|
29
|
+
[PostgresSchemaNodeKind.policy]: "structural",
|
|
30
|
+
[PostgresSchemaNodeKind.role]: "structural",
|
|
31
|
+
[PostgresSchemaNodeKind.nativeEnum]: "entity"
|
|
32
|
+
};
|
|
33
|
+
function isPostgresSchemaNodeKind(nodeKind) {
|
|
34
|
+
return Object.hasOwn(POSTGRES_NODE_GRANULARITY, nodeKind);
|
|
35
|
+
}
|
|
36
|
+
/** Looks up the subject granularity for a Postgres-specific `nodeKind`. */
|
|
37
|
+
function postgresNodeGranularity(nodeKind) {
|
|
38
|
+
return POSTGRES_NODE_GRANULARITY[nodeKind];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The subject granularity for any node kind that appears in a Postgres diff
|
|
42
|
+
* tree — the tree mixes Postgres-specific kinds (database/namespace/table/
|
|
43
|
+
* policy/role) with the relational leaf kinds (columns, constraints, indexes,
|
|
44
|
+
* …), so this dispatches to whichever family/target map owns the kind. Called
|
|
45
|
+
* on demand by consumers (the family verdict, the framework aggregate's
|
|
46
|
+
* unclaimed-elements sweep, via the {@link
|
|
47
|
+
* import('@internal/framework-components/control').SchemaSubjectClassifierCapable}
|
|
48
|
+
* capability) — never stamped onto the issue or the node.
|
|
49
|
+
*/
|
|
50
|
+
function postgresDiffSubjectGranularity(nodeKind) {
|
|
51
|
+
return isPostgresSchemaNodeKind(nodeKind) ? postgresNodeGranularity(nodeKind) : relationalNodeGranularity(nodeKind);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The map from a Postgres-specific `nodeKind` to its storage `entityKind` — the
|
|
55
|
+
* same vocabulary the contract storage's `entries` dictionary keys use. The
|
|
56
|
+
* whole-table and native-enum kinds each have an entity of their own;
|
|
57
|
+
* database/namespace/policy/role nodes map to nothing here (a namespace is
|
|
58
|
+
* addressed by id, not by an `entries` kind; policies and roles are
|
|
59
|
+
* structural, never a sibling space's unclaimed entity).
|
|
60
|
+
*
|
|
61
|
+
* The native enum keys under its PHYSICAL type name in `entries.native_enum`
|
|
62
|
+
* (ADR 221), so its diff node's `typeName` addresses the entity on the generic
|
|
63
|
+
* coordinate directly — no by-type-name walk needed. This lets the framework's
|
|
64
|
+
* unclaimed-elements sweep classify enum ownership the same coordinate way it
|
|
65
|
+
* classifies tables.
|
|
66
|
+
*/
|
|
67
|
+
const POSTGRES_NODE_ENTITY_KIND = {
|
|
68
|
+
[PostgresSchemaNodeKind.table]: "table",
|
|
69
|
+
[PostgresSchemaNodeKind.nativeEnum]: "native_enum"
|
|
70
|
+
};
|
|
71
|
+
/** Looks up the storage entityKind for a Postgres-specific `nodeKind`. */
|
|
72
|
+
function postgresNodeEntityKind(nodeKind) {
|
|
73
|
+
return POSTGRES_NODE_ENTITY_KIND[nodeKind];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The storage `entityKind` for any node kind that appears in a Postgres diff
|
|
77
|
+
* tree — sibling of {@link postgresDiffSubjectGranularity}, dispatching the
|
|
78
|
+
* same way to whichever family/target map owns the kind. Called on demand by
|
|
79
|
+
* the framework aggregate's unclaimed-elements sweep via the {@link
|
|
80
|
+
* import('@internal/framework-components/control').SchemaSubjectClassifierCapable}
|
|
81
|
+
* capability — never stamped onto the issue or the node.
|
|
82
|
+
*/
|
|
83
|
+
function postgresDiffSubjectEntityKind(nodeKind) {
|
|
84
|
+
return isPostgresSchemaNodeKind(nodeKind) ? postgresNodeEntityKind(nodeKind) : relationalNodeEntityKind(nodeKind);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Schema-diff leaf node for a native Postgres enum type.
|
|
88
|
+
*
|
|
89
|
+
* This is a derived, transient node walked by the differ — it is NEVER
|
|
90
|
+
* serialized. Both sides derive it on the namespace node: the expected side
|
|
91
|
+
* from the contract's hydrated `entries.native_enum` entities, the actual
|
|
92
|
+
* side from the adapter's introspected `nativeEnums`.
|
|
93
|
+
*
|
|
94
|
+
* Enum types are schema-scoped, so identity is (namespace, type name): the
|
|
95
|
+
* namespace coordinate comes from tree position (the differ pairs enum nodes
|
|
96
|
+
* only inside an already-paired namespace) and `id` carries the type name,
|
|
97
|
+
* prefixed with the entries-kind vocabulary (`native_enum:<typeName>`) so it
|
|
98
|
+
* cannot collide with a sibling table of the same name — the same
|
|
99
|
+
* sibling-prefix convention relational column nodes use (`column:<name>`).
|
|
100
|
+
*
|
|
101
|
+
* `isEqualTo` compares members POSITIONALLY — `['a','b'] ≠ ['b','a']` —
|
|
102
|
+
* because Postgres enum sort order is semantic. `control` is contract
|
|
103
|
+
* metadata, not database state, and does not participate in equality.
|
|
104
|
+
*/
|
|
105
|
+
var PostgresNativeEnumSchemaNode = class PostgresNativeEnumSchemaNode extends SqlSchemaIRNode {
|
|
106
|
+
nodeKind = PostgresSchemaNodeKind.nativeEnum;
|
|
107
|
+
typeName;
|
|
108
|
+
namespaceId;
|
|
109
|
+
members;
|
|
110
|
+
constructor(input) {
|
|
111
|
+
super();
|
|
112
|
+
this.typeName = input.typeName;
|
|
113
|
+
this.namespaceId = input.namespaceId;
|
|
114
|
+
this.members = Object.freeze([...input.members]);
|
|
115
|
+
if (input.control !== void 0) this.control = input.control;
|
|
116
|
+
freezeNode(this);
|
|
117
|
+
}
|
|
118
|
+
get id() {
|
|
119
|
+
return `native_enum:${this.typeName}`;
|
|
120
|
+
}
|
|
121
|
+
children() {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
isEqualTo(other) {
|
|
125
|
+
const node = blindCast(other);
|
|
126
|
+
PostgresNativeEnumSchemaNode.assert(node);
|
|
127
|
+
return this.typeName === node.typeName && this.members.length === node.members.length && this.members.every((member, index) => member === node.members[index]);
|
|
128
|
+
}
|
|
129
|
+
static is(node) {
|
|
130
|
+
return node.nodeKind === PostgresSchemaNodeKind.nativeEnum;
|
|
131
|
+
}
|
|
132
|
+
static assert(node) {
|
|
133
|
+
assertNode(node, "PostgresNativeEnumSchemaNode", PostgresNativeEnumSchemaNode.is);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Postgres-specific table schema-diff node. Carries all `SqlTableIR` fields
|
|
138
|
+
* plus `policies`, and implements `DiffableNode` so the table instance is
|
|
139
|
+
* directly the diff-tree node — no separate wrapper needed.
|
|
140
|
+
*
|
|
141
|
+
* Extends `SqlSchemaIRNode` directly rather than `SqlTableIR` because
|
|
142
|
+
* `SqlTableIR` calls `freezeNode` in its own constructor, which prevents
|
|
143
|
+
* subclass field initialisation.
|
|
144
|
+
*
|
|
145
|
+
* `id` is the table name. `isEqualTo` compares id + `rlsEnabled` — the
|
|
146
|
+
* table's one own diffable attribute; all other structural drift is
|
|
147
|
+
* expressed by its children. `children()` returns every column, the primary
|
|
148
|
+
* key (when present), every foreign key, unique, index, and check constraint,
|
|
149
|
+
* plus the policy nodes — one flat list, so a drifted column and a drifted
|
|
150
|
+
* policy are both reported by the same walk. Order is deterministic (object
|
|
151
|
+
* key order for columns, array order for the rest) so two structurally equal
|
|
152
|
+
* tables always produce the same child list.
|
|
153
|
+
*/
|
|
154
|
+
var PostgresTableSchemaNode = class PostgresTableSchemaNode extends SqlSchemaIRNode {
|
|
155
|
+
nodeKind = PostgresSchemaNodeKind.table;
|
|
156
|
+
name;
|
|
157
|
+
columns;
|
|
158
|
+
foreignKeys;
|
|
159
|
+
uniques;
|
|
160
|
+
indexes;
|
|
161
|
+
policies;
|
|
162
|
+
rlsEnabled;
|
|
163
|
+
constructor(input) {
|
|
164
|
+
super();
|
|
165
|
+
this.name = input.name;
|
|
166
|
+
this.rlsEnabled = input.rlsEnabled;
|
|
167
|
+
this.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([key, col]) => [key, col instanceof SqlColumnIR ? col : new SqlColumnIR(col)])));
|
|
168
|
+
this.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof SqlForeignKeyIR ? fk : new SqlForeignKeyIR(fk)));
|
|
169
|
+
this.uniques = Object.freeze(input.uniques.map((u) => u instanceof SqlUniqueIR ? u : new SqlUniqueIR(u)));
|
|
170
|
+
this.indexes = Object.freeze(input.indexes.map((i) => i instanceof SqlIndexIR ? i : new SqlIndexIR(i)));
|
|
171
|
+
if (input.primaryKey !== void 0) this.primaryKey = input.primaryKey instanceof PrimaryKey ? input.primaryKey : new PrimaryKey(input.primaryKey);
|
|
172
|
+
if (input.annotations !== void 0) this.annotations = input.annotations;
|
|
173
|
+
if (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map((c) => c instanceof SqlCheckConstraintIR ? c : new SqlCheckConstraintIR(c)));
|
|
174
|
+
this.policies = Object.freeze([...input.policies ?? []]);
|
|
175
|
+
freezeNode(this);
|
|
176
|
+
}
|
|
177
|
+
get id() {
|
|
178
|
+
return this.name;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Equal iff the ids (names) match AND `rlsEnabled` matches — the table's
|
|
182
|
+
* one own attribute in the diff; all other structural drift is expressed
|
|
183
|
+
* by children. A paired `not-equal` therefore always means enablement
|
|
184
|
+
* drift, which the planner maps to ENABLE/DISABLE ROW LEVEL SECURITY.
|
|
185
|
+
*/
|
|
186
|
+
isEqualTo(other) {
|
|
187
|
+
const node = blindCast(other);
|
|
188
|
+
PostgresTableSchemaNode.assert(node);
|
|
189
|
+
return this.id === node.id && this.rlsEnabled === node.rlsEnabled;
|
|
190
|
+
}
|
|
191
|
+
children() {
|
|
192
|
+
return [
|
|
193
|
+
...Object.values(this.columns),
|
|
194
|
+
...this.primaryKey ? [this.primaryKey] : [],
|
|
195
|
+
...this.foreignKeys,
|
|
196
|
+
...this.uniques,
|
|
197
|
+
...this.indexes,
|
|
198
|
+
...this.checks ?? [],
|
|
199
|
+
...this.policies
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
static is(node) {
|
|
203
|
+
return node.nodeKind === PostgresSchemaNodeKind.table;
|
|
204
|
+
}
|
|
205
|
+
static assert(node) {
|
|
206
|
+
assertNode(node, "PostgresTableSchemaNode", PostgresTableSchemaNode.is);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
//#endregion
|
|
210
|
+
export { postgresDiffSubjectGranularity as a, postgresDiffSubjectEntityKind as i, PostgresSchemaNodeKind as n, postgresNodeEntityKind as o, PostgresTableSchemaNode as r, PostgresNativeEnumSchemaNode as t };
|
|
211
|
+
|
|
212
|
+
//# sourceMappingURL=postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-table-schema-node-BBkitBQh.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { freezeNode } from \"@internal/framework-components/ir\";\nimport { PrimaryKey, SqlCheckConstraintIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIRNode, SqlUniqueIR, assertNode, relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\n//#region src/core/schema-ir/schema-node-kinds.ts\n/**\n* The `nodeKind` discriminant for each Postgres schema-diff node. Each node\n* carries a unique value; the static `is`/`assert` guards compare against these\n* identifiers rather than spelling the string inline or using `instanceof`. The\n* field is an enumerable own property carried on every node instance.\n*/\nconst PostgresSchemaNodeKind = {\n\tdatabase: \"postgres-database\",\n\tnamespace: \"postgres-namespace\",\n\ttable: \"postgres-table\",\n\tpolicy: \"postgres-policy\",\n\trole: \"postgres-role\",\n\tnativeEnum: \"postgres-native-enum\"\n};\n/**\n* The one real map from a Postgres-specific `nodeKind` to the\n* framework-neutral {@link DiffSubjectGranularity} its diff issues carry —\n* resolution is by `nodeKind` equality against this map, never a\n* `nodeKind`-suffix string match and never anything stamped on the node.\n*/\nconst POSTGRES_NODE_GRANULARITY = {\n\t[PostgresSchemaNodeKind.database]: \"structural\",\n\t[PostgresSchemaNodeKind.namespace]: \"namespace\",\n\t[PostgresSchemaNodeKind.table]: \"entity\",\n\t[PostgresSchemaNodeKind.policy]: \"structural\",\n\t[PostgresSchemaNodeKind.role]: \"structural\",\n\t[PostgresSchemaNodeKind.nativeEnum]: \"entity\"\n};\nfunction isPostgresSchemaNodeKind(nodeKind) {\n\treturn Object.hasOwn(POSTGRES_NODE_GRANULARITY, nodeKind);\n}\n/** Looks up the subject granularity for a Postgres-specific `nodeKind`. */\nfunction postgresNodeGranularity(nodeKind) {\n\treturn POSTGRES_NODE_GRANULARITY[nodeKind];\n}\n/**\n* The subject granularity for any node kind that appears in a Postgres diff\n* tree — the tree mixes Postgres-specific kinds (database/namespace/table/\n* policy/role) with the relational leaf kinds (columns, constraints, indexes,\n* …), so this dispatches to whichever family/target map owns the kind. Called\n* on demand by consumers (the family verdict, the framework aggregate's\n* unclaimed-elements sweep, via the {@link\n* import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n* capability) — never stamped onto the issue or the node.\n*/\nfunction postgresDiffSubjectGranularity(nodeKind) {\n\treturn isPostgresSchemaNodeKind(nodeKind) ? postgresNodeGranularity(nodeKind) : relationalNodeGranularity(nodeKind);\n}\n/**\n* The map from a Postgres-specific `nodeKind` to its storage `entityKind` — the\n* same vocabulary the contract storage's `entries` dictionary keys use. The\n* whole-table and native-enum kinds each have an entity of their own;\n* database/namespace/policy/role nodes map to nothing here (a namespace is\n* addressed by id, not by an `entries` kind; policies and roles are\n* structural, never a sibling space's unclaimed entity).\n*\n* The native enum keys under its PHYSICAL type name in `entries.native_enum`\n* (ADR 221), so its diff node's `typeName` addresses the entity on the generic\n* coordinate directly — no by-type-name walk needed. This lets the framework's\n* unclaimed-elements sweep classify enum ownership the same coordinate way it\n* classifies tables.\n*/\nconst POSTGRES_NODE_ENTITY_KIND = {\n\t[PostgresSchemaNodeKind.table]: \"table\",\n\t[PostgresSchemaNodeKind.nativeEnum]: \"native_enum\"\n};\n/** Looks up the storage entityKind for a Postgres-specific `nodeKind`. */\nfunction postgresNodeEntityKind(nodeKind) {\n\treturn POSTGRES_NODE_ENTITY_KIND[nodeKind];\n}\n/**\n* The storage `entityKind` for any node kind that appears in a Postgres diff\n* tree — sibling of {@link postgresDiffSubjectGranularity}, dispatching the\n* same way to whichever family/target map owns the kind. Called on demand by\n* the framework aggregate's unclaimed-elements sweep via the {@link\n* import('@internal/framework-components/control').SchemaSubjectClassifierCapable}\n* capability — never stamped onto the issue or the node.\n*/\nfunction postgresDiffSubjectEntityKind(nodeKind) {\n\treturn isPostgresSchemaNodeKind(nodeKind) ? postgresNodeEntityKind(nodeKind) : relationalNodeEntityKind(nodeKind);\n}\n//#endregion\n//#region src/core/schema-ir/postgres-native-enum-schema-node.ts\n/**\n* Schema-diff leaf node for a native Postgres enum type.\n*\n* This is a derived, transient node walked by the differ — it is NEVER\n* serialized. Both sides derive it on the namespace node: the expected side\n* from the contract's hydrated `entries.native_enum` entities, the actual\n* side from the adapter's introspected `nativeEnums`.\n*\n* Enum types are schema-scoped, so identity is (namespace, type name): the\n* namespace coordinate comes from tree position (the differ pairs enum nodes\n* only inside an already-paired namespace) and `id` carries the type name,\n* prefixed with the entries-kind vocabulary (`native_enum:<typeName>`) so it\n* cannot collide with a sibling table of the same name — the same\n* sibling-prefix convention relational column nodes use (`column:<name>`).\n*\n* `isEqualTo` compares members POSITIONALLY — `['a','b'] ≠ ['b','a']` —\n* because Postgres enum sort order is semantic. `control` is contract\n* metadata, not database state, and does not participate in equality.\n*/\nvar PostgresNativeEnumSchemaNode = class PostgresNativeEnumSchemaNode extends SqlSchemaIRNode {\n\tnodeKind = PostgresSchemaNodeKind.nativeEnum;\n\ttypeName;\n\tnamespaceId;\n\tmembers;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.typeName = input.typeName;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tthis.members = Object.freeze([...input.members]);\n\t\tif (input.control !== void 0) this.control = input.control;\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn `native_enum:${this.typeName}`;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tPostgresNativeEnumSchemaNode.assert(node);\n\t\treturn this.typeName === node.typeName && this.members.length === node.members.length && this.members.every((member, index) => member === node.members[index]);\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === PostgresSchemaNodeKind.nativeEnum;\n\t}\n\tstatic assert(node) {\n\t\tassertNode(node, \"PostgresNativeEnumSchemaNode\", PostgresNativeEnumSchemaNode.is);\n\t}\n};\n//#endregion\n//#region src/core/schema-ir/postgres-table-schema-node.ts\n/**\n* Postgres-specific table schema-diff node. Carries all `SqlTableIR` fields\n* plus `policies`, and implements `DiffableNode` so the table instance is\n* directly the diff-tree node — no separate wrapper needed.\n*\n* Extends `SqlSchemaIRNode` directly rather than `SqlTableIR` because\n* `SqlTableIR` calls `freezeNode` in its own constructor, which prevents\n* subclass field initialisation.\n*\n* `id` is the table name. `isEqualTo` compares id + `rlsEnabled` — the\n* table's one own diffable attribute; all other structural drift is\n* expressed by its children. `children()` returns every column, the primary\n* key (when present), every foreign key, unique, index, and check constraint,\n* plus the policy nodes — one flat list, so a drifted column and a drifted\n* policy are both reported by the same walk. Order is deterministic (object\n* key order for columns, array order for the rest) so two structurally equal\n* tables always produce the same child list.\n*/\nvar PostgresTableSchemaNode = class PostgresTableSchemaNode extends SqlSchemaIRNode {\n\tnodeKind = PostgresSchemaNodeKind.table;\n\tname;\n\tcolumns;\n\tforeignKeys;\n\tuniques;\n\tindexes;\n\tpolicies;\n\trlsEnabled;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.rlsEnabled = input.rlsEnabled;\n\t\tthis.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([key, col]) => [key, col instanceof SqlColumnIR ? col : new SqlColumnIR(col)])));\n\t\tthis.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof SqlForeignKeyIR ? fk : new SqlForeignKeyIR(fk)));\n\t\tthis.uniques = Object.freeze(input.uniques.map((u) => u instanceof SqlUniqueIR ? u : new SqlUniqueIR(u)));\n\t\tthis.indexes = Object.freeze(input.indexes.map((i) => i instanceof SqlIndexIR ? i : new SqlIndexIR(i)));\n\t\tif (input.primaryKey !== void 0) this.primaryKey = input.primaryKey instanceof PrimaryKey ? input.primaryKey : new PrimaryKey(input.primaryKey);\n\t\tif (input.annotations !== void 0) this.annotations = input.annotations;\n\t\tif (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map((c) => c instanceof SqlCheckConstraintIR ? c : new SqlCheckConstraintIR(c)));\n\t\tthis.policies = Object.freeze([...input.policies ?? []]);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn this.name;\n\t}\n\t/**\n\t* Equal iff the ids (names) match AND `rlsEnabled` matches — the table's\n\t* one own attribute in the diff; all other structural drift is expressed\n\t* by children. A paired `not-equal` therefore always means enablement\n\t* drift, which the planner maps to ENABLE/DISABLE ROW LEVEL SECURITY.\n\t*/\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tPostgresTableSchemaNode.assert(node);\n\t\treturn this.id === node.id && this.rlsEnabled === node.rlsEnabled;\n\t}\n\tchildren() {\n\t\treturn [\n\t\t\t...Object.values(this.columns),\n\t\t\t...this.primaryKey ? [this.primaryKey] : [],\n\t\t\t...this.foreignKeys,\n\t\t\t...this.uniques,\n\t\t\t...this.indexes,\n\t\t\t...this.checks ?? [],\n\t\t\t...this.policies\n\t\t];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === PostgresSchemaNodeKind.table;\n\t}\n\tstatic assert(node) {\n\t\tassertNode(node, \"PostgresTableSchemaNode\", PostgresTableSchemaNode.is);\n\t}\n};\n//#endregion\nexport { postgresDiffSubjectGranularity as a, postgresDiffSubjectEntityKind as i, PostgresNativeEnumSchemaNode as n, postgresNodeEntityKind as o, PostgresSchemaNodeKind as r, PostgresTableSchemaNode as t };\n\n//# sourceMappingURL=postgres-table-schema-node-BBkitBQh.mjs.map"],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrRO-_xPQVPF0.mjs";
|
|
2
|
+
import { OpFactoryCall } from "@prisma/orm-framework/components/control";
|
|
3
|
+
import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
4
|
+
import { ExecuteRequestLowerer } from "@prisma/orm-family-sql/family/control-adapter";
|
|
5
|
+
//#region ../../../3-targets/3-targets/postgres/dist/render-ops.d.mts
|
|
6
|
+
//#region src/core/migrations/render-ops.d.ts
|
|
7
|
+
type Op = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;
|
|
8
|
+
declare function renderOps(calls: readonly OpFactoryCall[], lowerer?: ExecuteRequestLowerer): (Op | Promise<Op>)[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { renderOps as t };
|
|
11
|
+
//# sourceMappingURL=render-ops-DPwhZt2W.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-ops-DPwhZt2W.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/render-ops.d.mts"],"mappings":";;;;;;KAKK,KAAK,0BAA0B;iBACnB,UAAU,gBAAgB,iBAAiB,UAAU,yBAAyB,KAAK,QAAQ"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { n as postgresError } from "./errors-kYxOQjdD-D4T3rbVp.mjs";
|
|
2
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
|
+
import { isThenable } from "@prisma/orm-framework/utils/promise";
|
|
4
|
+
//#region ../../../3-targets/3-targets/postgres/dist/render-ops-DxzTxSsv.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Asserts an op materialised by an `OpFactoryCall` targets postgres. The
|
|
7
|
+
* extension surface lets any contributor emit calls, so this is the
|
|
8
|
+
* integration boundary where a stray non-postgres op would otherwise
|
|
9
|
+
* silently flow through to postgres-shaped renderers — exactly the
|
|
10
|
+
* place to fail loudly with op metadata (`id` + `target.id`).
|
|
11
|
+
*/
|
|
12
|
+
function assertPostgresOp(op, callFactoryName) {
|
|
13
|
+
const targetId = blindCast(op).target?.id;
|
|
14
|
+
if (targetId !== "postgres") throw postgresError("MIGRATION.TARGET_MISMATCH", `renderOps: expected postgres op but got target.id="${String(targetId)}" for op.id="${op.id}" (factoryName="${callFactoryName}"). An OpFactoryCall produced an op for a different target on the postgres planner path; check the call's target binding.`, { meta: {
|
|
15
|
+
opId: op.id,
|
|
16
|
+
targetId: String(targetId),
|
|
17
|
+
factoryName: callFactoryName
|
|
18
|
+
} });
|
|
19
|
+
}
|
|
20
|
+
function renderOps(calls, lowerer) {
|
|
21
|
+
return calls.map((c) => {
|
|
22
|
+
const opOrPromise = blindCast(c).toOp(lowerer);
|
|
23
|
+
if (isThenable(opOrPromise)) return opOrPromise.then((op) => {
|
|
24
|
+
assertPostgresOp(op, c.factoryName);
|
|
25
|
+
return op;
|
|
26
|
+
});
|
|
27
|
+
assertPostgresOp(opOrPromise, c.factoryName);
|
|
28
|
+
return opOrPromise;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { renderOps as t };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=render-ops-DxzTxSsv-Bz85uUHk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-ops-DxzTxSsv-Bz85uUHk.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/render-ops-DxzTxSsv.mjs"],"sourcesContent":["import { n as postgresError } from \"./errors-kYxOQjdD.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { isThenable } from \"@internal/utils/promise\";\n//#region src/core/migrations/render-ops.ts\n/**\n* Asserts an op materialised by an `OpFactoryCall` targets postgres. The\n* extension surface lets any contributor emit calls, so this is the\n* integration boundary where a stray non-postgres op would otherwise\n* silently flow through to postgres-shaped renderers — exactly the\n* place to fail loudly with op metadata (`id` + `target.id`).\n*/\nfunction assertPostgresOp(op, callFactoryName) {\n\tconst targetId = blindCast(op).target?.id;\n\tif (targetId !== \"postgres\") throw postgresError(\"MIGRATION.TARGET_MISMATCH\", `renderOps: expected postgres op but got target.id=\"${String(targetId)}\" for op.id=\"${op.id}\" (factoryName=\"${callFactoryName}\"). An OpFactoryCall produced an op for a different target on the postgres planner path; check the call's target binding.`, { meta: {\n\t\topId: op.id,\n\t\ttargetId: String(targetId),\n\t\tfactoryName: callFactoryName\n\t} });\n}\nfunction renderOps(calls, lowerer) {\n\treturn calls.map((c) => {\n\t\tconst opOrPromise = blindCast(c).toOp(lowerer);\n\t\tif (isThenable(opOrPromise)) return opOrPromise.then((op) => {\n\t\t\tassertPostgresOp(op, c.factoryName);\n\t\t\treturn op;\n\t\t});\n\t\tassertPostgresOp(opOrPromise, c.factoryName);\n\t\treturn opOrPromise;\n\t});\n}\n//#endregion\nexport { renderOps as t };\n\n//# sourceMappingURL=render-ops-DxzTxSsv.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,iBAAiB,IAAI,iBAAiB;CAC9C,MAAM,WAAW,UAAU,EAAE,CAAC,CAAC,QAAQ;CACvC,IAAI,aAAa,YAAY,MAAM,cAAc,6BAA6B,sDAAsD,OAAO,QAAQ,EAAE,eAAe,GAAG,GAAG,kBAAkB,gBAAgB,4HAA4H,EAAE,MAAM;EAC/U,MAAM,GAAG;EACT,UAAU,OAAO,QAAQ;EACzB,aAAa;CACd,EAAE,CAAC;AACJ;AACA,SAAS,UAAU,OAAO,SAAS;CAClC,OAAO,MAAM,KAAK,MAAM;EACvB,MAAM,cAAc,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO;EAC7C,IAAI,WAAW,WAAW,GAAG,OAAO,YAAY,MAAM,OAAO;GAC5D,iBAAiB,IAAI,EAAE,WAAW;GAClC,OAAO;EACR,CAAC;EACD,iBAAiB,aAAa,EAAE,WAAW;EAC3C,OAAO;CACR,CAAC;AACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OpFactoryCall } from "@prisma/orm-framework/components/control";
|
|
2
|
+
import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/dist/render-typescript.d.mts
|
|
4
|
+
//#region src/core/migrations/render-typescript.d.ts
|
|
5
|
+
interface RenderMigrationMeta {
|
|
6
|
+
readonly from: string | null;
|
|
7
|
+
readonly to: string;
|
|
8
|
+
/** POSIX-relative path from the migration package dir to `migrations/snapshots`, e.g. '../../snapshots'. */
|
|
9
|
+
readonly snapshotsImportPath: string;
|
|
10
|
+
/**
|
|
11
|
+
* Rewrites the package names the scaffold imports from, for the import root
|
|
12
|
+
* the consuming application installed. Applied once to the assembled
|
|
13
|
+
* requirement list rather than at each `OpFactoryCall`, so a new operation
|
|
14
|
+
* cannot forget it. Defaults to leaving specifiers as authored.
|
|
15
|
+
*/
|
|
16
|
+
readonly resolveImportSpecifier?: ImportSpecifierResolver;
|
|
17
|
+
}
|
|
18
|
+
declare function renderCallsToTypeScript(calls: ReadonlyArray<OpFactoryCall>, meta: RenderMigrationMeta): string;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { renderCallsToTypeScript as t };
|
|
21
|
+
//# sourceMappingURL=render-typescript-6sCFvMBh.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-typescript-6sCFvMBh.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/render-typescript.d.mts"],"mappings":";;;;UAGU;WACC;WACA;;WAEA;;;;;;;WAOA,yBAAyB;;iBAEnB,wBAAwB,OAAO,cAAc,gBAAgB,MAAM"}
|