@prisma/orm-target-postgres 8.0.0-rc.16-dev.5 → 8.0.0-rc.16-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-BB0VVFW2.d.mts → adapter-BXHPMNAg.d.mts} +3 -3
- package/dist/{adapter-BB0VVFW2.d.mts.map → adapter-BXHPMNAg.d.mts.map} +1 -1
- package/dist/{adapter-RtS8vD8U-m4U_WTpQ.mjs → adapter-RtS8vD8U-CkJSaICZ.mjs} +5 -5
- package/dist/{adapter-RtS8vD8U-m4U_WTpQ.mjs.map → adapter-RtS8vD8U-CkJSaICZ.mjs.map} +1 -1
- package/dist/adapter.d.mts +7 -7
- package/dist/adapter.mjs +5 -5
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__control.d.mts +2 -2
- package/dist/adapter__control.mjs +6 -6
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +4 -4
- package/dist/adapter__sql-renderer.d.mts +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/adapter__types.d.mts +3 -3
- package/dist/{authoring-vHbPLrW4-BsHR7gUE.mjs → authoring-_2G2lsLt-VmVbrMPn.mjs} +5 -5
- package/dist/{authoring-vHbPLrW4-BsHR7gUE.mjs.map → authoring-_2G2lsLt-VmVbrMPn.mjs.map} +1 -1
- package/dist/{check-expressions-Dlt334zg-CV5Vkh3G.mjs → check-expressions-BaFrBceq-ChgvazEN.mjs} +14 -12
- package/dist/check-expressions-BaFrBceq-ChgvazEN.mjs.map +1 -0
- package/dist/{check-expressions-CBIgoKhV-D7oTR8lp.d.mts → check-expressions-CtTzM58x-CsWFEeul.d.mts} +6 -5
- package/dist/check-expressions-CtTzM58x-CsWFEeul.d.mts.map +1 -0
- package/dist/{codec-descriptor-CZAGhM_O-DK9auM7J.mjs → codec-descriptor-C5Ec_6Mw-CpacG1CL.mjs} +3 -2
- package/dist/codec-descriptor-C5Ec_6Mw-CpacG1CL.mjs.map +1 -0
- package/dist/{codec-helpers-D015Pvwa-DR7WMloQ.mjs → codec-helpers-D0ah5Wb8-wdJJZ_8s.mjs} +244 -3
- package/dist/codec-helpers-D0ah5Wb8-wdJJZ_8s.mjs.map +1 -0
- package/dist/{codec-registry-nSGjxm-H-BeUu5zV2.mjs → codec-registry-CKBDkxX7-Kw84Or3s.mjs} +5 -5
- package/dist/{codec-registry-nSGjxm-H-BeUu5zV2.mjs.map → codec-registry-CKBDkxX7-Kw84Or3s.mjs.map} +1 -1
- package/dist/{codec-type-map-DftCqvHU-BYkGKRZI.d.mts → codec-type-map-DueQFJ3a-DKLtMn3R.d.mts} +3 -3
- package/dist/{codec-type-map-DftCqvHU-BYkGKRZI.d.mts.map → codec-type-map-DueQFJ3a-DKLtMn3R.d.mts.map} +1 -1
- package/dist/codec-types-CY3pawL3.d.mts +2 -0
- package/dist/{codec-types-CHtW4cn_-ryYZXjOb.d.mts → codec-types-CYsrudBM-DcYPKpS1.d.mts} +4 -4
- package/dist/{codec-types-CHtW4cn_-ryYZXjOb.d.mts.map → codec-types-CYsrudBM-DcYPKpS1.d.mts.map} +1 -1
- package/dist/{codecs-DelwJv6h-CFbyTJIJ.mjs → codecs-BK3J4C0n-B8EnUXZf.mjs} +49 -37
- package/dist/codecs-BK3J4C0n-B8EnUXZf.mjs.map +1 -0
- package/dist/{codecs-Djhvng3f.d.mts → codecs-ChjCJY5k.d.mts} +2 -2
- package/dist/{codecs-Djhvng3f.d.mts.map → codecs-ChjCJY5k.d.mts.map} +1 -1
- package/dist/{codecs-CvG9lv7r-9RlHwf9Y.d.mts → codecs-y1gOMMt--DKWhYGN5.d.mts} +8 -2
- package/dist/codecs-y1gOMMt--DKWhYGN5.d.mts.map +1 -0
- package/dist/{contract-free-DaK6wmmo.mjs → contract-free-BMKFjlIG.mjs} +3 -3
- package/dist/{contract-free-DaK6wmmo.mjs.map → contract-free-BMKFjlIG.mjs.map} +1 -1
- package/dist/{control-CHqdVXHC.d.mts → control-D2JNE1Tz.d.mts} +3 -3
- package/dist/{control-CHqdVXHC.d.mts.map → control-D2JNE1Tz.d.mts.map} +1 -1
- package/dist/{control-YKrabf1Q.mjs → control-Ltn8Dzpi.mjs} +11 -11
- package/dist/{control-YKrabf1Q.mjs.map → control-Ltn8Dzpi.mjs.map} +1 -1
- package/dist/{control-adapter-Co30P4lH-B5euUoQ4.mjs → control-adapter-Co30P4lH-CpxXk5cz.mjs} +6 -6
- package/dist/{control-adapter-Co30P4lH-B5euUoQ4.mjs.map → control-adapter-Co30P4lH-CpxXk5cz.mjs.map} +1 -1
- package/dist/{control-policy-bwcdB78Y-DgRaWAzu.mjs → control-policy-DMOu5nnt-DslefUx9.mjs} +11 -10
- package/dist/control-policy-DMOu5nnt-DslefUx9.mjs.map +1 -0
- package/dist/{data-type-entries-DgKLUrqt-TKDikzti.mjs → data-type-entries-DoR61yeO-BB2cY7rI.mjs} +3 -3
- package/dist/{data-type-entries-DgKLUrqt-TKDikzti.mjs.map → data-type-entries-DoR61yeO-BB2cY7rI.mjs.map} +1 -1
- package/dist/{data-types-E1wms1_i.d.mts → data-types-BDkZIUMI.d.mts} +4 -2
- package/dist/{data-types-E1wms1_i.d.mts.map → data-types-BDkZIUMI.d.mts.map} +1 -1
- package/dist/{data-types-k3Ebk3kj-DWk3nh_k.mjs → data-types-DRkmmE9S-C5Q9oH4Q.mjs} +13 -4
- package/dist/data-types-DRkmmE9S-C5Q9oH4Q.mjs.map +1 -0
- package/dist/{ddl-C_vTj7b5-vyGLBKLo.mjs → ddl-D5hYRCTf-DRSajCVT.mjs} +3 -3
- package/dist/{ddl-C_vTj7b5-vyGLBKLo.mjs.map → ddl-D5hYRCTf-DRSajCVT.mjs.map} +1 -1
- package/dist/{default-normalizer-CrMBHF0W-BaUR4Ec8.mjs → default-normalizer-Bf_Fhv4v-CugGfLAe.mjs} +12 -7
- package/dist/default-normalizer-Bf_Fhv4v-CugGfLAe.mjs.map +1 -0
- package/dist/{descriptor-meta-ARufwwWW-DMQsPNAl.mjs → descriptor-meta-ARufwwWW-ChZm5Hg5.mjs} +3 -3
- package/dist/{descriptor-meta-ARufwwWW-DMQsPNAl.mjs.map → descriptor-meta-ARufwwWW-ChZm5Hg5.mjs.map} +1 -1
- package/dist/{descriptor-meta-BgOMP4hF-CfUJsgjc.mjs → descriptor-meta-WHc6Kv-m-BLzsaP0M.mjs} +8 -8
- package/dist/{descriptor-meta-BgOMP4hF-CfUJsgjc.mjs.map → descriptor-meta-WHc6Kv-m-BLzsaP0M.mjs.map} +1 -1
- package/dist/{descriptor-meta-runtime-CG2S236D-CUkzqeCr.mjs → descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs} +3 -3
- package/dist/{descriptor-meta-runtime-CG2S236D-CUkzqeCr.mjs.map → descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs.map} +1 -1
- package/dist/{diff-database-schema-zc7d2uxC-BVe8D7vG.mjs → diff-database-schema-DgAMDjHF-YATlptWC.mjs} +6 -6
- package/dist/{diff-database-schema-zc7d2uxC-BVe8D7vG.mjs.map → diff-database-schema-DgAMDjHF-YATlptWC.mjs.map} +1 -1
- package/dist/{full-text-D5pW25-Y.d.mts → full-text-CCqTEQ9y.d.mts} +2 -2
- package/dist/{full-text-D5pW25-Y.d.mts.map → full-text-CCqTEQ9y.d.mts.map} +1 -1
- package/dist/{full-text-index-expression-BpUM2Td6-2Q7y7DnO.mjs → full-text-index-expression-Bfp_xWhy-DtbLdkzv.mjs} +3 -3
- package/dist/{full-text-index-expression-BpUM2Td6-2Q7y7DnO.mjs.map → full-text-index-expression-Bfp_xWhy-DtbLdkzv.mjs.map} +1 -1
- package/dist/{full-text-parsers-BhjgmAe5-CyF7dp_b.d.mts → full-text-parsers-DrS_1B-x-BcAnBoQP.d.mts} +3 -3
- package/dist/{full-text-parsers-BhjgmAe5-CyF7dp_b.d.mts.map → full-text-parsers-DrS_1B-x-BcAnBoQP.d.mts.map} +1 -1
- package/dist/{infer-psl-contract-B5yExD61-Cmye68li.mjs → infer-psl-contract-D-3st5lU-DKQhhsut.mjs} +7 -7
- package/dist/{infer-psl-contract-B5yExD61-Cmye68li.mjs.map → infer-psl-contract-D-3st5lU-DKQhhsut.mjs.map} +1 -1
- package/dist/{issue-planner-pmBrIrEN.d.mts → issue-planner-DWRClmiP.d.mts} +2 -2
- package/dist/{issue-planner-pmBrIrEN.d.mts.map → issue-planner-DWRClmiP.d.mts.map} +1 -1
- package/dist/{migration-D189kh3f.d.mts → migration--J8vKZ8z.d.mts} +3 -3
- package/dist/{migration-D189kh3f.d.mts.map → migration--J8vKZ8z.d.mts.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{op-factory-call-CqKUB1XP-CsEGx4Jd.d.mts → op-factory-call-BFnGNPJD-5vgAjFpd.d.mts} +44 -14
- package/dist/op-factory-call-BFnGNPJD-5vgAjFpd.d.mts.map +1 -0
- package/dist/{op-factory-call-DdXVWQlV-DzfLhTkh.mjs → op-factory-call-BbTtrII--CbCFZfSd.mjs} +124 -28
- package/dist/op-factory-call-BbTtrII--CbCFZfSd.mjs.map +1 -0
- package/dist/op-factory-call-CsuauFRs.d.mts +1 -0
- package/dist/{operation-types-Be5rdu14.d.mts → operation-types-CjJY7prP.d.mts} +2 -2
- package/dist/{operation-types-Be5rdu14.d.mts.map → operation-types-CjJY7prP.d.mts.map} +1 -1
- package/dist/{pack-DHV9zslZ.d.mts → pack-Bq9yq-OS.d.mts} +4 -4
- package/dist/{pack-DHV9zslZ.d.mts.map → pack-Bq9yq-OS.d.mts.map} +1 -1
- package/dist/{planner-CvUO8Zpn.d.mts → planner-B9c5vxQo.d.mts} +15 -8
- package/dist/planner-B9c5vxQo.d.mts.map +1 -0
- package/dist/{planner-ZmK0aNuY-Cak-8zwa.mjs → planner-_mo_t-l3-DPAQVG1x.mjs} +117 -23
- package/dist/planner-_mo_t-l3-DPAQVG1x.mjs.map +1 -0
- package/dist/{planner-ddl-builders-DRProi99-D0K5ZiD0.mjs → planner-ddl-builders-Y0_96xpe-BzugdEDO.mjs} +3 -3
- package/dist/{planner-ddl-builders-DRProi99-D0K5ZiD0.mjs.map → planner-ddl-builders-Y0_96xpe-BzugdEDO.mjs.map} +1 -1
- package/dist/{planner-identity-values-C1eV916m-D0p3EfYc.mjs → planner-identity-values-CRS2cQ6v-DakZeIQj.mjs} +3 -3
- package/dist/{planner-identity-values-C1eV916m-D0p3EfYc.mjs.map → planner-identity-values-CRS2cQ6v-DakZeIQj.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs → planner-produced-postgres-migration-BdWg8TP2-QE9uzt2K.mjs} +4 -4
- package/dist/{planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs.map → planner-produced-postgres-migration-BdWg8TP2-QE9uzt2K.mjs.map} +1 -1
- package/dist/planner-produced-postgres-migration-BqcWgPjb.d.mts +1 -0
- package/dist/{planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.d.mts → planner-produced-postgres-migration-Bw145mJT-qpLKF3Vf.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-Bw145mJT-qpLKF3Vf.d.mts.map +1 -0
- package/dist/{planner-sql-checks-rqOH8naU-B6xOE5lC.mjs → planner-sql-checks-DCGV2qdu-eaeFLtn8.mjs} +3 -3
- package/dist/{planner-sql-checks-rqOH8naU-B6xOE5lC.mjs.map → planner-sql-checks-DCGV2qdu-eaeFLtn8.mjs.map} +1 -1
- package/dist/{postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs → postgres-contract-view-CL-YTH_3-Diah6i2a.mjs} +6 -6
- package/dist/{postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs.map → postgres-contract-view-CL-YTH_3-Diah6i2a.mjs.map} +1 -1
- package/dist/{postgres-migration-e8UybR1y-C_m4i1jp.d.mts → postgres-migration-DVY2ALDJ-DTWECas_.d.mts} +36 -4
- package/dist/postgres-migration-DVY2ALDJ-DTWECas_.d.mts.map +1 -0
- package/dist/postgres-migration-DmczQSHT-DsWlow8L.mjs +1075 -0
- package/dist/postgres-migration-DmczQSHT-DsWlow8L.mjs.map +1 -0
- package/dist/{postgres-schema-AlEVkXXS-ZfXWYddl.mjs → postgres-schema-COkaqci7-C6JpiSha.mjs} +6 -6
- package/dist/postgres-schema-COkaqci7-C6JpiSha.mjs.map +1 -0
- package/dist/{prisma7-binding-GebhdAGS.mjs → prisma7-binding-CAzQh1rQ.mjs} +7 -7
- package/dist/{prisma7-binding-GebhdAGS.mjs.map → prisma7-binding-CAzQh1rQ.mjs.map} +1 -1
- package/dist/{prisma7-binding-FvF1AZxQ.d.mts → prisma7-binding-Dm34z6Fq.d.mts} +4 -4
- package/dist/{prisma7-binding-FvF1AZxQ.d.mts.map → prisma7-binding-Dm34z6Fq.d.mts.map} +1 -1
- package/dist/{render-ops-D2vJApKB-B281fzmn.mjs → render-ops-DaCy6StH-BgzbTE_9.mjs} +16 -9
- package/dist/render-ops-DaCy6StH-BgzbTE_9.mjs.map +1 -0
- package/dist/{resolve-ddl-schema-BthOWVjF-DuZ9iUh-.mjs → resolve-ddl-schema-DD69Bwve-e-BpAfFa.mjs} +3 -3
- package/dist/{resolve-ddl-schema-BthOWVjF-DuZ9iUh-.mjs.map → resolve-ddl-schema-DD69Bwve-e-BpAfFa.mjs.map} +1 -1
- package/dist/{runtime-aejvKbMy.d.mts → runtime-CNTEAZIz.d.mts} +2 -2
- package/dist/{runtime-aejvKbMy.d.mts.map → runtime-CNTEAZIz.d.mts.map} +1 -1
- package/dist/{sql-renderer-DT4IEOVi-CE0YIu9V.mjs → sql-renderer-DT4IEOVi-CBE8uTub.mjs} +2 -2
- package/dist/{sql-renderer-DT4IEOVi-CE0YIu9V.mjs.map → sql-renderer-DT4IEOVi-CBE8uTub.mjs.map} +1 -1
- package/dist/{sql-renderer-B1ZLRgUw.d.mts → sql-renderer-hQ3HTY-B.d.mts} +2 -2
- package/dist/{sql-renderer-B1ZLRgUw.d.mts.map → sql-renderer-hQ3HTY-B.d.mts.map} +1 -1
- package/dist/target.d.mts +21 -21
- package/dist/target.mjs +27 -27
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +2 -2
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__contract-free.mjs +3 -3
- package/dist/target__control.mjs +3 -3
- package/dist/target__data-types.d.mts +1 -1
- package/dist/target__data-types.mjs +2 -2
- package/dist/target__default-normalizer.mjs +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__full-text.d.mts +2 -2
- package/dist/target__issue-planner.d.mts +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +3 -3
- package/dist/target__op-factory-call.mjs +2 -2
- package/dist/target__operation-types.d.mts +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- package/dist/target__planner-identity-values.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner-sql-checks.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__prisma7-binding.d.mts +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.mjs +3 -3
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__schema-ir-annotations.mjs +1 -1
- package/dist/target__sql-utils.mjs +1 -1
- package/dist/target__types.d.mts +2 -2
- package/dist/target__types.mjs +2 -2
- package/dist/{types-D799eppJ.d.mts → types-BP1e5MBV.d.mts} +2 -2
- package/dist/{types-D799eppJ.d.mts.map → types-BP1e5MBV.d.mts.map} +1 -1
- package/dist/{types-D6lgKhE5-Cu48rrw9.d.mts → types-D6lgKhE5-DYkeCAjr.d.mts} +2 -2
- package/dist/{types-D6lgKhE5-Cu48rrw9.d.mts.map → types-D6lgKhE5-DYkeCAjr.d.mts.map} +1 -1
- package/dist/types-Dnrjripb.d.mts +2 -0
- package/package.json +9 -9
- package/dist/check-expressions-CBIgoKhV-D7oTR8lp.d.mts.map +0 -1
- package/dist/check-expressions-Dlt334zg-CV5Vkh3G.mjs.map +0 -1
- package/dist/codec-descriptor-CZAGhM_O-DK9auM7J.mjs.map +0 -1
- package/dist/codec-helpers-D015Pvwa-DR7WMloQ.mjs.map +0 -1
- package/dist/codec-types-DQUtpepT.d.mts +0 -2
- package/dist/codecs-CvG9lv7r-9RlHwf9Y.d.mts.map +0 -1
- package/dist/codecs-DelwJv6h-CFbyTJIJ.mjs.map +0 -1
- package/dist/control-policy-bwcdB78Y-DgRaWAzu.mjs.map +0 -1
- package/dist/data-types-k3Ebk3kj-DWk3nh_k.mjs.map +0 -1
- package/dist/default-normalizer-CrMBHF0W-BaUR4Ec8.mjs.map +0 -1
- package/dist/op-factory-call-CqKUB1XP-CsEGx4Jd.d.mts.map +0 -1
- package/dist/op-factory-call-D5UJ7cDi.d.mts +0 -1
- package/dist/op-factory-call-DdXVWQlV-DzfLhTkh.mjs.map +0 -1
- package/dist/planner-CvUO8Zpn.d.mts.map +0 -1
- package/dist/planner-ZmK0aNuY-Cak-8zwa.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-BI_aepPp.d.mts +0 -1
- package/dist/planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.d.mts.map +0 -1
- package/dist/postgres-migration-UVh2xeV0-DW8V_8aj.mjs +0 -596
- package/dist/postgres-migration-UVh2xeV0-DW8V_8aj.mjs.map +0 -1
- package/dist/postgres-migration-e8UybR1y-C_m4i1jp.d.mts.map +0 -1
- package/dist/postgres-schema-AlEVkXXS-ZfXWYddl.mjs.map +0 -1
- package/dist/render-ops-D2vJApKB-B281fzmn.mjs.map +0 -1
- package/dist/types-CdJszzhP.d.mts +0 -2
package/dist/{default-normalizer-CrMBHF0W-BaUR4Ec8.mjs → default-normalizer-Bf_Fhv4v-CugGfLAe.mjs}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as canonicalUuid, r as canonicalInet } from "./codec-helpers-D0ah5Wb8-wdJJZ_8s.mjs";
|
|
2
2
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
|
-
|
|
3
|
+
import { canonicalNumeralText } from "@prisma/orm-family-sql/contract/data-type-support";
|
|
4
|
+
//#region ../../../3-targets/3-targets/postgres/dist/default-normalizer-Bf_Fhv4v.mjs
|
|
4
5
|
/**
|
|
5
6
|
* Pre-compiled regex patterns for performance.
|
|
6
7
|
* These are compiled once at module load time rather than on each function call.
|
|
@@ -122,7 +123,7 @@ function readLiteralToken(expression) {
|
|
|
122
123
|
* lost to a JavaScript number. A column that is not a number type stores the numeral as text.
|
|
123
124
|
*/
|
|
124
125
|
function numberValue(numeral, nativeType) {
|
|
125
|
-
if (nativeType !== void 0 && DECIMAL_TEXT_TYPE_PATTERN.test(nativeType)) return numeral;
|
|
126
|
+
if (nativeType !== void 0 && DECIMAL_TEXT_TYPE_PATTERN.test(nativeType)) return storedText(numeral, nativeType);
|
|
126
127
|
if (nativeType !== void 0 && !NUMBER_TYPE_PATTERN.test(nativeType)) return numeral;
|
|
127
128
|
const parsed = Number(numeral);
|
|
128
129
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
@@ -217,12 +218,16 @@ function byteaInputBase64(text) {
|
|
|
217
218
|
return Buffer.concat(chunks).toString("base64");
|
|
218
219
|
}
|
|
219
220
|
/**
|
|
220
|
-
* A text default as the column stores it: a uuid
|
|
221
|
-
* reads, and a bytea as the base64 of its bytes.
|
|
221
|
+
* A text default as the column stores it: a uuid, an IP address or the numeral of an int8 or numeric
|
|
222
|
+
* in the form PostgreSQL writes, which its codec reads, and a bytea as the base64 of its bytes.
|
|
223
|
+
* `undefined` for bytea text PostgreSQL refuses.
|
|
222
224
|
*/
|
|
223
225
|
function storedText(text, nativeType) {
|
|
224
226
|
if (nativeType === "bytea") return byteaInputBase64(text);
|
|
225
|
-
|
|
227
|
+
if (nativeType === "uuid") return canonicalUuid(text) ?? text;
|
|
228
|
+
if (nativeType === "inet") return canonicalInet(text) ?? text;
|
|
229
|
+
if (nativeType !== void 0 && DECIMAL_TEXT_TYPE_PATTERN.test(nativeType)) return canonicalNumeralText(text);
|
|
230
|
+
return text;
|
|
226
231
|
}
|
|
227
232
|
/**
|
|
228
233
|
* Reads an unquoted, non-NULL array element by the column's element type. Only text Postgres itself
|
|
@@ -502,4 +507,4 @@ function postgresResolveDefault(def, resolvedNativeType) {
|
|
|
502
507
|
//#endregion
|
|
503
508
|
export { postgresResolveDefault as n, parsePostgresDefault as t };
|
|
504
509
|
|
|
505
|
-
//# sourceMappingURL=default-normalizer-
|
|
510
|
+
//# sourceMappingURL=default-normalizer-Bf_Fhv4v-CugGfLAe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-normalizer-Bf_Fhv4v-CugGfLAe.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/default-normalizer-Bf_Fhv4v.mjs"],"sourcesContent":["import { F as canonicalInet, r as canonicalUuid } from \"./codec-helpers-D0ah5Wb8.mjs\";\nimport { canonicalNumeralText } from \"@internal/sql-contract/data-type-support\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/core/default-normalizer.ts\n/**\n* Pre-compiled regex patterns for performance.\n* These are compiled once at module load time rather than on each function call.\n*/\nconst NEXTVAL_PATTERN = /^nextval\\s*\\(/i;\nconst NOW_FUNCTION_PATTERN = /^(now\\s*\\(\\s*\\)|CURRENT_TIMESTAMP)$/i;\nconst CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\\s*\\(\\s*\\)$/i;\nconst TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\\s+(?:with|without)\\s+time\\s+zone)?$/i;\nconst TEXT_CAST_SUFFIX = /::text$/i;\nconst NOW_LITERAL_PATTERN = /^'now'$/i;\nconst UUID_PATTERN = /^gen_random_uuid\\s*\\(\\s*\\)$/i;\nconst UUID_OSSP_PATTERN = /^uuid_generate_v4\\s*\\(\\s*\\)$/i;\nconst NULL_PATTERN = /^NULL(?:::.+)?$/i;\nconst TRUE_PATTERN = /^true$/i;\nconst FALSE_PATTERN = /^false$/i;\n/**\n* A decimal numeral with an optional sign and an optional exponent. Postgres prints a `real` or\n* `double precision` default in exponent notation once its magnitude is large or small enough:\n* `'1e+20'::real`, `'1e-320'::double precision`.\n*/\nconst NUMERAL = String.raw`[+-]?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?`;\nconst NUMERIC_PATTERN = new RegExp(`^${NUMERAL}$`);\n/**\n* A type modifier: `(3)`, `(65,30)`, or a numeric type's negative scale, `(5,-2)`, which PostgreSQL\n* 15 and later accept.\n*/\nconst TYPE_MODIFIER = String.raw`\\(\\d+(?:,\\s*-?\\d+)?\\)`;\n/**\n* A cast target type: a builtin of one or more words, where any word may carry a modifier\n* (`timestamp(3) without time zone`, `numeric(65,30)`), or a quoted identifier (`\"AuditAction\"`);\n* either may be qualified by a possibly quoted schema (`audit.\"AuditAction\"`, `\"my schema\".t`).\n*/\nconst TYPE_NAME = String.raw`(?:(?:\"(?:[^\"]|\"\")+\"|\\w+)\\.)?(?:\"(?:[^\"]|\"\")+\"|\\w+(?:${TYPE_MODIFIER})?(?:\\s+\\w+(?:${TYPE_MODIFIER})?)*)`;\nconst QUOTED_LITERAL_PATTERN = new RegExp(`^'((?:[^']|'')*)'(?:::(${TYPE_NAME}))?$`);\nconst NUMBER_LITERAL_PATTERN = new RegExp(`^(${NUMERAL})(?:::(${TYPE_NAME}))?$`);\nconst PARENTHESISED_CAST_PATTERN = new RegExp(String.raw`^\\((.+)\\)::(${TYPE_NAME})$`, \"s\");\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst INTEGER_TYPE_PATTERN = /^(?:smallint|integer|bigint|int2|int4|int8)$/i;\nconst NUMBER_TYPE_PATTERN = new RegExp(`^(?:smallint|integer|bigint|int2|int4|int8|real|double precision|float4|float8|numeric|decimal)(?:${TYPE_MODIFIER})?$`, \"i\");\nconst DECIMAL_TEXT_TYPE_PATTERN = new RegExp(`^(?:bigint|int8|numeric|decimal)(?:${TYPE_MODIFIER})?$`, \"i\");\n/**\n* Matches a Postgres array literal default of the form `'{...}'::elemtype[]`.\n* The literal body is captured in group 1; the cast (including `[]`) is optional.\n* Examples: `'{}'::text[]`, `'{1,2}'::integer[]`, `'{}'`\n*/\nconst ARRAY_LITERAL_PATTERN = /^'(\\{.*\\})'(?:::.+\\[\\])?$/;\n/** `box` is the one core type whose array elements are delimited by `;`, not `,`. */\nconst SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN = /^box$/i;\n/**\n* Matches the constructor spelling Postgres reports for a default written as\n* `ARRAY[...]`: `ARRAY['a'::text, 'b'::text]`, `ARRAY[1, 2]`, `ARRAY[]::text[]`.\n* The element list is captured in group 1; the outer cast is optional.\n*/\nconst ARRAY_CONSTRUCTOR_PATTERN = new RegExp(String.raw`^ARRAY\\[(.*?)\\](?:::${TYPE_NAME}\\[\\])?$`, \"is\");\nconst OUTER_ARRAY_CAST_PATTERN = new RegExp(String.raw`^\\((.+)\\)::${TYPE_NAME}\\[\\]$`, \"s\");\n/**\n* Returns the canonical expression for a timestamp default function, or undefined\n* if the expression is not a recognized timestamp default.\n*\n* Keeps now()/CURRENT_TIMESTAMP and clock_timestamp() distinct:\n* - now(), CURRENT_TIMESTAMP, ('now'::text)::timestamp... → 'now()'\n* - clock_timestamp(), clock_timestamp()::timestamptz → 'clock_timestamp()'\n*\n* These are semantically different in Postgres: now() returns the transaction\n* start time (constant within a transaction), while clock_timestamp() returns\n* the actual wall-clock time (can differ across rows in a single INSERT).\n*/\nfunction canonicalizeTimestampDefault(expr) {\n\tif (NOW_FUNCTION_PATTERN.test(expr)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(expr)) return \"clock_timestamp()\";\n\tif (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;\n\tlet inner = expr.replace(TIMESTAMP_CAST_SUFFIX, \"\").trim();\n\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1).trim();\n\tif (NOW_FUNCTION_PATTERN.test(inner)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(inner)) return \"clock_timestamp()\";\n\tinner = inner.replace(TEXT_CAST_SUFFIX, \"\").trim();\n\tif (NOW_LITERAL_PATTERN.test(inner)) return \"now()\";\n}\n/**\n* A numeral cast to a number type. A cast to an integer type rounds a fraction, so that numeral is\n* not the value.\n*/\nfunction castNumber(numeral, castType) {\n\tif (castType === void 0) return {\n\t\tkind: \"number\",\n\t\tnumeral\n\t};\n\tif (!NUMBER_TYPE_PATTERN.test(castType)) return void 0;\n\tif (INTEGER_TYPE_PATTERN.test(castType) && !INTEGER_PATTERN.test(numeral)) return void 0;\n\treturn {\n\t\tkind: \"number\",\n\t\tnumeral\n\t};\n}\n/**\n* Reads a literal by its cast type: `'-1'::integer` and `(1)::bigint` are numbers, `'a'::text` is a\n* string. A parenthesised cast is read only from number to number: `('now'::text)::date` is\n* evaluated on insert. Anything else, such as an operator or a function call, is not a literal.\n*/\nfunction readLiteralToken(expression) {\n\tconst quoted = QUOTED_LITERAL_PATTERN.exec(expression);\n\tif (quoted?.[1] !== void 0) {\n\t\tconst text = quoted[1].replace(/''/g, \"'\");\n\t\tconst castType = quoted[2];\n\t\treturn castType !== void 0 && NUMBER_TYPE_PATTERN.test(castType) && NUMERIC_PATTERN.test(text) ? castNumber(text, castType) : {\n\t\t\tkind: \"string\",\n\t\t\ttext\n\t\t};\n\t}\n\tconst number = NUMBER_LITERAL_PATTERN.exec(expression);\n\tif (number?.[1] !== void 0) return castNumber(number[1], number[2]);\n\tconst parenthesised = PARENTHESISED_CAST_PATTERN.exec(expression);\n\tif (parenthesised?.[1] === void 0 || parenthesised[2] === void 0) return void 0;\n\tconst inner = readLiteralToken(parenthesised[1].trim());\n\treturn inner?.kind === \"number\" ? castNumber(inner.numeral, parenthesised[2]) : void 0;\n}\n/**\n* `int8` and `numeric` defaults are decimal text, the JSON form of their codecs, so no digit is\n* lost to a JavaScript number. A column that is not a number type stores the numeral as text.\n*/\nfunction numberValue(numeral, nativeType) {\n\tif (nativeType !== void 0 && DECIMAL_TEXT_TYPE_PATTERN.test(nativeType)) return storedText(numeral, nativeType);\n\tif (nativeType !== void 0 && !NUMBER_TYPE_PATTERN.test(nativeType)) return numeral;\n\tconst parsed = Number(numeral);\n\treturn Number.isFinite(parsed) ? parsed : void 0;\n}\n/**\n* Splits a Postgres array literal body (without the enclosing braces) into its\n* element tokens, honouring quoting. A comma only separates elements when it is\n* outside double quotes; inside a quoted element a doubled quote (`\"\"`) or a\n* backslash-escaped quote (`\\\"`) is a literal quote, and a backslash escapes the\n* next character. Returns undefined if the body is malformed (e.g. an unbalanced\n* quote), nests an array, which puts a brace outside quotes, or escapes a character outside\n* quotes with a backslash, which Postgres never prints.\n*/\nfunction splitArrayElements(inner) {\n\tconst tokens = [];\n\tlet current = \"\";\n\tlet inQuotes = false;\n\tlet quoted = false;\n\tfor (let i = 0; i < inner.length; i++) {\n\t\tconst char = inner[i];\n\t\tif (inQuotes) {\n\t\t\tif (char === \"\\\\\") {\n\t\t\t\tconst next = inner[i + 1];\n\t\t\t\tif (next === void 0) return void 0;\n\t\t\t\tcurrent += next;\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"\\\"\") {\n\t\t\t\tif (inner[i + 1] === \"\\\"\") {\n\t\t\t\t\tcurrent += \"\\\"\";\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tinQuotes = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\") {\n\t\t\tinQuotes = true;\n\t\t\tquoted = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"{\" || char === \"}\" || char === \"\\\\\") return void 0;\n\t\tif (char === \",\") {\n\t\t\ttokens.push({\n\t\t\t\tvalue: current,\n\t\t\t\tquoted\n\t\t\t});\n\t\t\tcurrent = \"\";\n\t\t\tquoted = false;\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\tif (inQuotes) return void 0;\n\ttokens.push({\n\t\tvalue: current,\n\t\tquoted\n\t});\n\treturn tokens;\n}\nconst BOOLEAN_TYPE_PATTERN = /^(?:bool|boolean)$/i;\nconst BOOLEAN_TRUE_TOKEN_PATTERN = /^(?:t|true)$/i;\nconst BOOLEAN_FALSE_TOKEN_PATTERN = /^(?:f|false)$/i;\nconst BYTEA_HEX_INPUT = /^\\\\x((?:[ \\t\\n\\r]*[0-9A-Fa-f]{2})*)[ \\t\\n\\r]*$/;\nconst BYTEA_ESCAPE_TOKEN = /\\\\\\\\|\\\\[0-3][0-7]{2}|[^\\\\]+|\\\\/g;\nfunction byteaEscapeTokenBytes(token) {\n\tif (token === \"\\\\\\\\\") return Buffer.from(\"\\\\\");\n\tif (token === \"\\\\\") return void 0;\n\tif (token.startsWith(\"\\\\\")) return Buffer.from([Number.parseInt(token.slice(1), 8)]);\n\treturn Buffer.from(token, \"utf8\");\n}\n/**\n* The bytes of `bytea` input text, as the base64 the codec stores, or `undefined` for text\n* PostgreSQL refuses. Text starting `\\x` is hex, two digits for each byte. Any other text is the\n* escape format: `\\\\` is a backslash, `\\` and three octal digits is that byte, and any other\n* character is its UTF-8 bytes.\n*/\nfunction byteaInputBase64(text) {\n\tconst hex = BYTEA_HEX_INPUT.exec(text)?.[1];\n\tif (hex !== void 0) return Buffer.from(hex.replace(/\\s/g, \"\"), \"hex\").toString(\"base64\");\n\tif (text.startsWith(\"\\\\x\")) return void 0;\n\tconst chunks = [];\n\tfor (const [token] of text.matchAll(BYTEA_ESCAPE_TOKEN)) {\n\t\tconst bytes = byteaEscapeTokenBytes(token);\n\t\tif (bytes === void 0) return void 0;\n\t\tchunks.push(bytes);\n\t}\n\treturn Buffer.concat(chunks).toString(\"base64\");\n}\n/**\n* A text default as the column stores it: a uuid, an IP address or the numeral of an int8 or numeric\n* in the form PostgreSQL writes, which its codec reads, and a bytea as the base64 of its bytes.\n* `undefined` for bytea text PostgreSQL refuses.\n*/\nfunction storedText(text, nativeType) {\n\tif (nativeType === \"bytea\") return byteaInputBase64(text);\n\tif (nativeType === \"uuid\") return canonicalUuid(text) ?? text;\n\tif (nativeType === \"inet\") return canonicalInet(text) ?? text;\n\tif (nativeType !== void 0 && DECIMAL_TEXT_TYPE_PATTERN.test(nativeType)) return canonicalNumeralText(text);\n\treturn text;\n}\n/**\n* Reads an unquoted, non-NULL array element by the column's element type. Only text Postgres itself\n* would print is read; anything else keeps the raw expression.\n*/\nfunction unquotedElementValue(token, elementType) {\n\tif (token === \"\") return void 0;\n\tif (BOOLEAN_TYPE_PATTERN.test(elementType)) {\n\t\tif (BOOLEAN_TRUE_TOKEN_PATTERN.test(token)) return true;\n\t\tif (BOOLEAN_FALSE_TOKEN_PATTERN.test(token)) return false;\n\t\treturn;\n\t}\n\tif (NUMBER_TYPE_PATTERN.test(elementType)) return NUMERIC_PATTERN.test(token) ? numberValue(token, elementType) : void 0;\n\tif (isJsonElementType(elementType)) {\n\t\tconst document = readJsonDocument(token);\n\t\treturn document.kind === \"json\" ? document.value : void 0;\n\t}\n\treturn storedText(token, elementType);\n}\n/**\n* Parses a Postgres array literal body (`{...}`) into a JS array of primitives.\n* Returns undefined if the body cannot be reliably parsed.\n*\n* Handles:\n* - `{}` → `[]`\n* - `{elem1,elem2,...}` → `[elem1, elem2, ...]`, each unquoted element read by the element type\n* - quoted elements that contain commas, doubled/escaped quotes, and the literal\n* strings `NULL`/`true`/`false` (a quoted token is always a string)\n*/\nfunction parseArrayLiteralBody(body, elementType) {\n\tconst inner = body.slice(1, -1).trim();\n\tif (inner === \"\") return [];\n\tconst tokens = splitArrayElements(inner);\n\tif (tokens === void 0) return void 0;\n\tconst result = [];\n\tfor (const token of tokens) {\n\t\tif (token.quoted) {\n\t\t\tconst value = textElementValue(token.value, elementType);\n\t\t\tif (value === void 0) return void 0;\n\t\t\tresult.push(value);\n\t\t\tcontinue;\n\t\t}\n\t\tconst el = token.value.trim();\n\t\tif (el.toUpperCase() === \"NULL\") {\n\t\t\tif (isJsonElementType(elementType)) return void 0;\n\t\t\tresult.push(null);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = unquotedElementValue(el, elementType);\n\t\tif (value === void 0) return void 0;\n\t\tresult.push(value);\n\t}\n\treturn result;\n}\n/**\n* Splits an `ARRAY[...]` element list on the commas outside quotes and parentheses, so\n* `numeric(65,30)` and `'a,b'` stay inside one element. A doubled quote inside an element is a\n* literal quote, so it never closes one.\n*/\nfunction splitConstructorElements(body) {\n\tconst elements = [];\n\tlet current = \"\";\n\tlet quote;\n\tlet depth = 0;\n\tfor (const char of body) {\n\t\tif (quote !== void 0) {\n\t\t\tif (char === quote) quote = void 0;\n\t\t} else if (char === \"'\" || char === \"\\\"\") quote = char;\n\t\telse if (char === \"(\") depth++;\n\t\telse if (char === \")\") depth--;\n\t\telse if (char === \",\" && depth === 0) {\n\t\t\telements.push(current);\n\t\t\tcurrent = \"\";\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\telements.push(current);\n\treturn elements.map((element) => element.trim());\n}\n/**\n* Reads one `ARRAY[...]` element: NULL, a boolean, or a literal read by its cast type. Anything\n* else, such as a function call, means the constructor is not a literal and the caller keeps the\n* raw expression.\n*/\nfunction parseConstructorElement(element, elementType) {\n\tif (NULL_PATTERN.test(element)) return isJsonElementType(elementType) ? void 0 : null;\n\tif (TRUE_PATTERN.test(element)) return true;\n\tif (FALSE_PATTERN.test(element)) return false;\n\tconst token = readLiteralToken(element);\n\tif (token === void 0) return void 0;\n\treturn token.kind === \"number\" ? numberValue(token.numeral, elementType) : textElementValue(token.text, elementType);\n}\nfunction isJsonElementType(elementType) {\n\treturn elementType === \"json\" || elementType === \"jsonb\";\n}\n/**\n* A `json`/`jsonb` element's text is a JSON document, as it is on a scalar column of the same type.\n* Undefined keeps the raw expression: the document holds a number a JavaScript number would change.\n*/\nfunction textElementValue(text, elementType) {\n\tif (!isJsonElementType(elementType)) return storedText(text, elementType);\n\tconst document = readJsonDocument(text);\n\tif (document.kind === \"inexact\") return void 0;\n\treturn document.kind === \"json\" ? document.value : text;\n}\n/**\n* Parses JSON text. Postgres keeps every digit of a json number, so a document holding a number that\n* would not print back as the same value once read into a JavaScript number, such as\n* `12345678901234567890` or `1e400`, is `inexact`. `1.0` prints back as `1`, the same value.\n*/\nfunction readJsonDocument(text) {\n\tlet exact = true;\n\tconst reviver = (_key, value, context) => {\n\t\tif (typeof value === \"number\" && !keepsJsonNumber(value, context?.source)) exact = false;\n\t\treturn value;\n\t};\n\tlet value;\n\ttry {\n\t\tvalue = blindCast(JSON.parse(text, reviver));\n\t} catch {\n\t\treturn { kind: \"invalid\" };\n\t}\n\treturn exact ? {\n\t\tkind: \"json\",\n\t\tvalue\n\t} : { kind: \"inexact\" };\n}\nfunction keepsJsonNumber(value, source) {\n\tif (!Number.isFinite(value) || source === void 0) return false;\n\tconst written = decimalValue(source);\n\treturn written !== void 0 && written === decimalValue(String(value));\n}\nconst DECIMAL_PARTS_PATTERN = /^(-?)(\\d+)(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/;\n/** A numeral's value as `<sign><digits>e<exponent>`, with no leading or trailing zero digits. */\nfunction decimalValue(numeral) {\n\tconst parts = DECIMAL_PARTS_PATTERN.exec(numeral);\n\tif (parts === null) return void 0;\n\tconst [, sign = \"\", whole = \"\", fraction = \"\", exponent = \"0\"] = parts;\n\tconst digits = `${whole}${fraction}`.replace(/^0+/, \"\");\n\tif (digits === \"\") return \"0\";\n\tconst significant = digits.replace(/0+$/, \"\");\n\treturn `${sign}${significant}e${Number(exponent) - fraction.length + digits.length - significant.length}`;\n}\nfunction parseArrayConstructor(body, elementType) {\n\tif (body.trim() === \"\") return [];\n\tconst values = [];\n\tfor (const element of splitConstructorElements(body)) {\n\t\tconst value = parseConstructorElement(element, elementType);\n\t\tif (value === void 0) return void 0;\n\t\tvalues.push(value);\n\t}\n\treturn values;\n}\nfunction unwrapOuterArrayCasts(expression) {\n\tconst match = OUTER_ARRAY_CAST_PATTERN.exec(expression);\n\treturn match?.[1] === void 0 ? expression : unwrapOuterArrayCasts(match[1].trim());\n}\n/**\n* Parses a raw Postgres column default expression into a normalized ColumnDefault.\n* This enables semantic comparison between contract defaults and introspected schema defaults.\n*\n* Used by the migration diff layer to normalize raw database defaults during comparison,\n* keeping the introspection layer focused on faithful data capture.\n*\n* @param rawDefault - Raw default expression from information_schema.columns.column_default\n* @param nativeType - Native column type, used for type-aware parsing (array, int8, numeric, JSON)\n* @returns Normalized ColumnDefault or undefined if the expression cannot be parsed\n*/\nfunction parsePostgresDefault(rawDefault, nativeType) {\n\tconst trimmed = rawDefault.trim();\n\tconst normalizedType = nativeType?.toLowerCase();\n\tif (NEXTVAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"autoincrement()\"\n\t};\n\tif (normalizedType?.endsWith(\"[]\")) {\n\t\tconst elementType = normalizedType.slice(0, -2);\n\t\tconst arrayMatch = trimmed.match(ARRAY_LITERAL_PATTERN);\n\t\tif (arrayMatch?.[1] !== void 0 && !SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN.test(elementType)) {\n\t\t\tconst parsed = parseArrayLiteralBody(arrayMatch[1].replace(/''/g, \"'\"), elementType);\n\t\t\tif (parsed !== void 0) return {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue: parsed\n\t\t\t};\n\t\t}\n\t\tconst constructorMatch = unwrapOuterArrayCasts(trimmed).match(ARRAY_CONSTRUCTOR_PATTERN);\n\t\tif (constructorMatch?.[1] !== void 0) {\n\t\t\tconst parsed = parseArrayConstructor(constructorMatch[1], elementType);\n\t\t\tif (parsed !== void 0) return {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue: parsed\n\t\t\t};\n\t\t}\n\t\tif (NULL_PATTERN.test(trimmed)) return {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: null\n\t\t};\n\t\treturn {\n\t\t\tkind: \"function\",\n\t\t\texpression: trimmed\n\t\t};\n\t}\n\tconst canonicalTimestamp = canonicalizeTimestampDefault(trimmed);\n\tif (canonicalTimestamp) return {\n\t\tkind: \"function\",\n\t\texpression: canonicalTimestamp\n\t};\n\tif (UUID_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (UUID_OSSP_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: null\n\t};\n\tif (TRUE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: true\n\t};\n\tif (FALSE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: false\n\t};\n\tconst token = readLiteralToken(trimmed);\n\tif (token === void 0) return {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n\tif (token.kind === \"number\") {\n\t\tconst value = numberValue(token.numeral, normalizedType);\n\t\treturn value === void 0 ? void 0 : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue\n\t\t};\n\t}\n\tif (normalizedType !== void 0 && isJsonElementType(normalizedType)) {\n\t\tconst document = readJsonDocument(token.text);\n\t\tif (document.kind === \"inexact\") return {\n\t\t\tkind: \"function\",\n\t\t\texpression: trimmed\n\t\t};\n\t\tif (document.kind === \"json\") return {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: document.value\n\t\t};\n\t}\n\tconst text = storedText(token.text, normalizedType);\n\treturn text === void 0 ? {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t} : {\n\t\tkind: \"literal\",\n\t\tvalue: text\n\t};\n}\n/**\n* Normalizes a contract-declared default through {@link parsePostgresDefault}\n* — the same parser introspection uses — so a function-shaped default the\n* parser recognizes as a literal (e.g. sql`'{}'::jsonb`)\n* resolves to the same `resolvedDefault` shape a live introspected column\n* would produce. Compensates once, at `SchemaIR` construction of the\n* expected (contract-derived) side (`contractToSchemaIR`'s `resolveDefault`\n* hook), instead of at every site that later compares the two sides. A\n* literal default, or a function form the parser doesn't recognize, passes\n* through unchanged; `nextval(...)` normalizes to `autoincrement()` on both\n* sides, matching a `serial`/identity column's introspected counterpart.\n*/\nfunction postgresResolveDefault(def, resolvedNativeType) {\n\tif (def.kind !== \"function\") return def;\n\treturn parsePostgresDefault(def.expression, resolvedNativeType) ?? def;\n}\n//#endregion\nexport { postgresResolveDefault as n, parsePostgresDefault as t };\n\n//# sourceMappingURL=default-normalizer-Bf_Fhv4v.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAC5B,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,gBAAgB;;;;;;AAMtB,MAAM,UAAU,OAAO,GAAG;AAC1B,MAAM,kBAAkB,IAAI,OAAO,IAAI,QAAQ,EAAE;;;;;AAKjD,MAAM,gBAAgB,OAAO,GAAG;;;;;;AAMhC,MAAM,YAAY,OAAO,GAAG,wDAAwD,cAAc,gBAAgB,cAAc;AAChI,MAAM,yBAAyB,IAAI,OAAO,0BAA0B,UAAU,KAAK;AACnF,MAAM,yBAAyB,IAAI,OAAO,KAAK,QAAQ,SAAS,UAAU,KAAK;AAC/E,MAAM,6BAA6B,IAAI,OAAO,OAAO,GAAG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meta-ARufwwWW-DMQsPNAl.mjs → descriptor-meta-ARufwwWW-ChZm5Hg5.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as postgresAggregateDescriptors } from "./aggregates-B6ZQFHFE.mjs";
|
|
2
|
-
import { o as postgresCodecRegistry } from "./codec-registry-
|
|
3
|
-
import { n as postgresAdapterCapabilities } from "./control-adapter-Co30P4lH-
|
|
2
|
+
import { o as postgresCodecRegistry } from "./codec-registry-CKBDkxX7-Kw84Or3s.mjs";
|
|
3
|
+
import { n as postgresAdapterCapabilities } from "./control-adapter-Co30P4lH-CpxXk5cz.mjs";
|
|
4
4
|
//#region ../../../3-targets/6-adapters/postgres/dist/descriptor-meta-ARufwwWW.mjs
|
|
5
5
|
/** Creates a type import spec for codec types */
|
|
6
6
|
const codecTypeImport = (named) => ({
|
|
@@ -50,4 +50,4 @@ const postgresAdapterDescriptorMeta = {
|
|
|
50
50
|
//#endregion
|
|
51
51
|
export { postgresAdapterDescriptorMeta as t };
|
|
52
52
|
|
|
53
|
-
//# sourceMappingURL=descriptor-meta-ARufwwWW-
|
|
53
|
+
//# sourceMappingURL=descriptor-meta-ARufwwWW-ChZm5Hg5.mjs.map
|
package/dist/{descriptor-meta-ARufwwWW-DMQsPNAl.mjs.map → descriptor-meta-ARufwwWW-ChZm5Hg5.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-ARufwwWW-
|
|
1
|
+
{"version":3,"file":"descriptor-meta-ARufwwWW-ChZm5Hg5.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/descriptor-meta-ARufwwWW.mjs"],"sourcesContent":["import { n as postgresAdapterCapabilities } from \"./control-adapter-Co30P4lH.mjs\";\nimport { postgresCodecRegistry } from \"@internal/target-postgres/codecs\";\nimport { postgresAggregateDescriptors } from \"@internal/target-postgres/aggregates\";\n//#region src/core/descriptor-meta.ts\n/** Creates a type import spec for codec types */\nconst codecTypeImport = (named) => ({\n\tpackage: \"@internal/target-postgres/codec-types\",\n\tnamed,\n\talias: named\n});\nconst postgresAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tid: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: postgresAdapterCapabilities,\n\ttypes: {\n\t\taggregateDescriptors: postgresAggregateDescriptors,\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(postgresCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"PgTypes\"\n\t\t\t},\n\t\t\ttypeImports: [\n\t\t\t\t{\n\t\t\t\t\tpackage: \"@internal/target-postgres/codec-types\",\n\t\t\t\t\tnamed: \"JsonValue\",\n\t\t\t\t\talias: \"JsonValue\"\n\t\t\t\t},\n\t\t\t\tcodecTypeImport(\"Char\"),\n\t\t\t\tcodecTypeImport(\"Varchar\"),\n\t\t\t\tcodecTypeImport(\"Numeric\"),\n\t\t\t\tcodecTypeImport(\"Bit\"),\n\t\t\t\tcodecTypeImport(\"VarBit\"),\n\t\t\t\tcodecTypeImport(\"Timestamp\"),\n\t\t\t\tcodecTypeImport(\"Timestamptz\"),\n\t\t\t\tcodecTypeImport(\"Time\"),\n\t\t\t\tcodecTypeImport(\"Timetz\"),\n\t\t\t\tcodecTypeImport(\"Interval\"),\n\t\t\t\tcodecTypeImport(\"TimestampString\"),\n\t\t\t\tcodecTypeImport(\"TimestamptzString\"),\n\t\t\t\tcodecTypeImport(\"TimeString\")\n\t\t\t]\n\t\t}\n\t}\n};\n//#endregion\nexport { postgresAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-ARufwwWW.mjs.map"],"mappings":";;;;;AAKA,MAAM,mBAAmB,WAAW;CACnC,SAAS;CACT;CACA,OAAO;AACR;AACA,MAAM,gCAAgC;CACrC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc;CACd,OAAO;EACN,sBAAsB;EACtB,YAAY;GACX,kBAAkB,MAAM,KAAK,sBAAsB,OAAO,CAAC;GAC3D,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;GACA,aAAa;IACZ;KACC,SAAS;KACT,OAAO;KACP,OAAO;IACR;IACA,gBAAgB,MAAM;IACtB,gBAAgB,SAAS;IACzB,gBAAgB,SAAS;IACzB,gBAAgB,KAAK;IACrB,gBAAgB,QAAQ;IACxB,gBAAgB,WAAW;IAC3B,gBAAgB,aAAa;IAC7B,gBAAgB,MAAM;IACtB,gBAAgB,QAAQ;IACxB,gBAAgB,UAAU;IAC1B,gBAAgB,iBAAiB;IACjC,gBAAgB,mBAAmB;IACnC,gBAAgB,YAAY;GAC7B;EACD;CACD;AACD"}
|
package/dist/{descriptor-meta-BgOMP4hF-CfUJsgjc.mjs → descriptor-meta-WHc6Kv-m-BLzsaP0M.mjs}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
|
|
2
|
-
import { A as postgresQualifyColumnType } from "./codecs-
|
|
3
|
-
import { h as postgresCreateNamespace } from "./postgres-schema-
|
|
4
|
-
import { c as postgresAuthoringEntityTypes, d as postgresAuthoringPslBlockDescriptors, f as postgresAuthoringTypes, l as postgresAuthoringFieldPresets, p as postgresLowerEntityHandles, u as postgresAuthoringModelAttributes } from "./authoring-
|
|
5
|
-
import { t as postgresRenderCheckExpressions } from "./check-expressions-
|
|
6
|
-
import { t as postgresDataTypeEntries } from "./data-type-entries-
|
|
7
|
-
import { t as postgresTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-
|
|
2
|
+
import { A as postgresQualifyColumnType } from "./codecs-BK3J4C0n-B8EnUXZf.mjs";
|
|
3
|
+
import { h as postgresCreateNamespace } from "./postgres-schema-COkaqci7-C6JpiSha.mjs";
|
|
4
|
+
import { c as postgresAuthoringEntityTypes, d as postgresAuthoringPslBlockDescriptors, f as postgresAuthoringTypes, l as postgresAuthoringFieldPresets, p as postgresLowerEntityHandles, u as postgresAuthoringModelAttributes } from "./authoring-_2G2lsLt-VmVbrMPn.mjs";
|
|
5
|
+
import { t as postgresRenderCheckExpressions } from "./check-expressions-BaFrBceq-ChgvazEN.mjs";
|
|
6
|
+
import { t as postgresDataTypeEntries } from "./data-type-entries-DoR61yeO-BB2cY7rI.mjs";
|
|
7
|
+
import { t as postgresTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs";
|
|
8
8
|
import { type } from "arktype";
|
|
9
9
|
import { defineIndexTypes } from "@prisma/orm-family-sql/contract/index-types";
|
|
10
|
-
//#region ../../../3-targets/3-targets/postgres/dist/descriptor-meta-
|
|
10
|
+
//#region ../../../3-targets/3-targets/postgres/dist/descriptor-meta-WHc6Kv-m.mjs
|
|
11
11
|
const postgresIndexTypes = defineIndexTypes().add("btree", { options: type("object") }).add("hash", { options: type("object") }).add("gin", { options: type("object") }).add("gist", { options: type("object") }).add("spgist", { options: type("object") }).add("brin", { options: type("object") });
|
|
12
12
|
const postgresTargetDescriptorMeta = {
|
|
13
13
|
...postgresTargetDescriptorMetaRuntime,
|
|
@@ -35,4 +35,4 @@ const postgresTargetDescriptorMeta = {
|
|
|
35
35
|
//#endregion
|
|
36
36
|
export { postgresTargetDescriptorMeta as t };
|
|
37
37
|
|
|
38
|
-
//# sourceMappingURL=descriptor-meta-
|
|
38
|
+
//# sourceMappingURL=descriptor-meta-WHc6Kv-m-BLzsaP0M.mjs.map
|
package/dist/{descriptor-meta-BgOMP4hF-CfUJsgjc.mjs.map → descriptor-meta-WHc6Kv-m-BLzsaP0M.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-
|
|
1
|
+
{"version":3,"file":"descriptor-meta-WHc6Kv-m-BLzsaP0M.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/descriptor-meta-WHc6Kv-m.mjs"],"sourcesContent":["import { t as postgresDataTypeEntries } from \"./data-type-entries-DoR61yeO.mjs\";\nimport { E as postgresQualifyColumnType } from \"./codecs-BK3J4C0n.mjs\";\nimport { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { a as postgresAuthoringPslBlockDescriptors, i as postgresAuthoringModelAttributes, n as postgresAuthoringEntityTypes, o as postgresAuthoringTypes, r as postgresAuthoringFieldPresets, s as postgresLowerEntityHandles } from \"./authoring-_2G2lsLt.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-COkaqci7.mjs\";\nimport { t as postgresRenderCheckExpressions } from \"./check-expressions-BaFrBceq.mjs\";\nimport { t as postgresTargetDescriptorMetaRuntime } from \"./descriptor-meta-runtime-iArZEoCE.mjs\";\nimport { type } from \"arktype\";\nimport { defineIndexTypes } from \"@internal/sql-contract/index-types\";\n//#region src/core/index-types.ts\nconst postgresIndexTypes = defineIndexTypes().add(\"btree\", { options: type(\"object\") }).add(\"hash\", { options: type(\"object\") }).add(\"gin\", { options: type(\"object\") }).add(\"gist\", { options: type(\"object\") }).add(\"spgist\", { options: type(\"object\") }).add(\"brin\", { options: type(\"object\") });\nconst postgresTargetDescriptorMeta = {\n\t...postgresTargetDescriptorMetaRuntime,\n\tdefaultNamespaceId: DEFAULT_NAMESPACE_ID,\n\tsupportsNamespaces: true,\n\tindexTypes: postgresIndexTypes,\n\tauthoring: {\n\t\ttype: postgresAuthoringTypes,\n\t\tfield: postgresAuthoringFieldPresets,\n\t\tdataTypes: postgresDataTypeEntries(),\n\t\tentityTypes: postgresAuthoringEntityTypes,\n\t\tpslBlockDescriptors: postgresAuthoringPslBlockDescriptors,\n\t\tmodelAttributes: postgresAuthoringModelAttributes,\n\t\tcreateNamespace: postgresCreateNamespace,\n\t\tqualifyColumnType: postgresQualifyColumnType,\n\t\trenderCheckExpressions: postgresRenderCheckExpressions,\n\t\tlowerEntityHandles: postgresLowerEntityHandles\n\t},\n\ttypes: { queryOperationTypes: { import: {\n\t\tpackage: \"@internal/target-postgres/operation-types\",\n\t\tnamed: \"QueryOperationTypes\",\n\t\talias: \"PgTargetQueryOps\"\n\t} } }\n};\n//#endregion\nexport { postgresTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-WHc6Kv-m.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,qBAAqB,iBAAiB,CAAC,CAAC,IAAI,SAAS,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC;AACpS,MAAM,+BAA+B;CACpC,GAAG;CACH,oBAAoB;CACpB,oBAAoB;CACpB,YAAY;CACZ,WAAW;EACV,MAAM;EACN,OAAO;EACP,WAAW,wBAAwB;EACnC,aAAa;EACb,qBAAqB;EACrB,iBAAiB;EACjB,iBAAiB;EACjB,mBAAmB;EACnB,wBAAwB;EACxB,oBAAoB;CACrB;CACA,OAAO,EAAE,qBAAqB,EAAE,QAAQ;EACvC,SAAS;EACT,OAAO;EACP,OAAO;CACR,EAAE,EAAE;AACL"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as postgresDataTypes } from "./data-types-
|
|
2
|
-
//#region ../../../3-targets/3-targets/postgres/dist/descriptor-meta-runtime-
|
|
1
|
+
import { R as postgresDataTypes } from "./data-types-DRkmmE9S-C5Q9oH4Q.mjs";
|
|
2
|
+
//#region ../../../3-targets/3-targets/postgres/dist/descriptor-meta-runtime-iArZEoCE.mjs
|
|
3
3
|
const postgresTargetDescriptorMetaRuntime = {
|
|
4
4
|
kind: "target",
|
|
5
5
|
familyId: "sql",
|
|
@@ -12,4 +12,4 @@ const postgresTargetDescriptorMetaRuntime = {
|
|
|
12
12
|
//#endregion
|
|
13
13
|
export { postgresTargetDescriptorMetaRuntime as t };
|
|
14
14
|
|
|
15
|
-
//# sourceMappingURL=descriptor-meta-runtime-
|
|
15
|
+
//# sourceMappingURL=descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-runtime-
|
|
1
|
+
{"version":3,"file":"descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/descriptor-meta-runtime-iArZEoCE.mjs"],"sourcesContent":["import { R as postgresDataTypes } from \"./data-types-DRkmmE9S.mjs\";\nconst postgresTargetDescriptorMetaRuntime = {\n\tkind: \"target\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tid: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: {},\n\tdataTypes: postgresDataTypes\n};\n//#endregion\nexport { postgresTargetDescriptorMetaRuntime as t };\n\n//# sourceMappingURL=descriptor-meta-runtime-iArZEoCE.mjs.map"],"mappings":";;AACA,MAAM,sCAAsC;CAC3C,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;CACf,WAAW;AACZ"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
|
|
2
|
-
import { d as isPostgresSchema } from "./postgres-schema-
|
|
2
|
+
import { d as isPostgresSchema } from "./postgres-schema-COkaqci7-C6JpiSha.mjs";
|
|
3
3
|
import { a as postgresDiffSubjectGranularity, n as PostgresSchemaNodeKind, r as PostgresTableSchemaNode, t as PostgresNativeEnumSchemaNode } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
|
|
4
4
|
import { i as PostgresRoleSchemaNode, n as PostgresNamespaceSchemaNode, r as PostgresPolicySchemaNode, t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
|
|
5
|
-
import { n as postgresResolveDefault } from "./default-normalizer-
|
|
6
|
-
import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-
|
|
7
|
-
import { d as resolvePostgresNodeIssueControlPolicySubject } from "./control-policy-
|
|
5
|
+
import { n as postgresResolveDefault } from "./default-normalizer-Bf_Fhv4v-CugGfLAe.mjs";
|
|
6
|
+
import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-DD69Bwve-e-BpAfFa.mjs";
|
|
7
|
+
import { d as resolvePostgresNodeIssueControlPolicySubject } from "./control-policy-DMOu5nnt-DslefUx9.mjs";
|
|
8
8
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
9
9
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
10
10
|
import { diffSchemas, issueOutcome } from "@prisma/orm-framework/components/control";
|
|
@@ -13,7 +13,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
|
13
13
|
import { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from "@prisma/orm-family-sql/family/control";
|
|
14
14
|
import { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from "@prisma/orm-family-sql/schema-ir/types";
|
|
15
15
|
import { classifyDiffSubjectGranularity } from "@prisma/orm-family-sql/family/diff";
|
|
16
|
-
//#region ../../../3-targets/3-targets/postgres/dist/diff-database-schema-
|
|
16
|
+
//#region ../../../3-targets/3-targets/postgres/dist/diff-database-schema-DgAMDjHF.mjs
|
|
17
17
|
/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */
|
|
18
18
|
function databaseStep() {
|
|
19
19
|
return {
|
|
@@ -391,4 +391,4 @@ function buildPostgresPlanDiff(input) {
|
|
|
391
391
|
//#endregion
|
|
392
392
|
export { contractToPostgresDatabaseSchemaNode as n, diffPostgresSchema as r, buildPostgresPlanDiff as t };
|
|
393
393
|
|
|
394
|
-
//# sourceMappingURL=diff-database-schema-
|
|
394
|
+
//# sourceMappingURL=diff-database-schema-DgAMDjHF-YATlptWC.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-database-schema-zc7d2uxC-BVe8D7vG.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/diff-database-schema-zc7d2uxC.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-AlEVkXXS.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-CrMBHF0W.mjs\";\nimport { a as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-BthOWVjF.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-bwcdB78Y.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { diffPostgresSchema as n, contractToPostgresDatabaseSchemaNode as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-zc7d2uxC.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;EACA;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;CACD;AACD;AACA,SAAS,cAAc,MAAM;CAC5B,OAAO,CAAC,aAAa,GAAG;EACvB,UAAU,uBAAuB;EACjC,IAAI;CACL,CAAC;AACF;;;;;;;AAOA,SAAS,gBAAgB,aAAa,WAAW,SAAS;CACzD,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,eAAe,aAAa,SAAS,GAAG;EAC1E,UAAU,yBAAyB;EACnC,IAAI,UAAU;CACf,CAAC,CAAC;AACH;AACA,SAAS,aAAa,QAAQ,aAAa;CAC1C,OAAO,IAAI,yBAAyB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CACV;CACA,IAAI,CAAC,QAAQ,OAAO;CACpB,OAAO,IAAI,2BAA2B;EACrC;EACA,OAAO,CAAC,GAAG,OAAO,KAAK;EACvB,iBAAiB,CAAC,GAAG,OAAO,eAAe;EAC3C,WAAW,OAAO;CACnB,CAAC;AACF;;;;;;;;;;;;;AAaA,SAAS,sBAAsB,OAAO;CACrC,MAAM,mBAAmB,UAAU,MAAM,QAAQ;CACjD,2BAA2B,OAAO,MAAM,YAAY;CACpD,MAAM,SAAS,MAAM;CACrB,MAAM,QAAQ,iBAAiB,MAAM,mBAAmB;CACxD,MAAM,eAAe,qCAAqC,kBAAkB;EAC3E,qBAAqB;EACrB,gBAAgB,MAAM;EACtB,aAAa,MAAM;EACnB,gBAAgB;CACjB,CAAC;CACD,MAAM,WAAW,yBAAyB,YAAY;CACtD,MAAM,eAAe,oBAAoB,UAAU,MAAM;CACzD,MAAM,kBAAkB,iBAAiB,QAAQ;CACjD,MAAM,kBAAkB,iBAAiB,YAAY;CACrD,OAAO;EACN;EACA,QAAQ;EACR,QAAQ,UAAU,YAAY,UAAU,YAAY,CAAC,CAAC,CAAC,QAAQ,UAAU;GACxE,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;GACnD,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,MAAM,cAAc,+BAA+B,OAAO,8BAA8B;GACxF,MAAM,mBAAmB,MAAM,KAAK;GACpC,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,QAAQ,gBAAgB,eAAe,kBAAkB,gBAAA,CAAiB,IAAI,gBAAgB;EAC/F,CAAC;CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"diff-database-schema-DgAMDjHF-YATlptWC.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/diff-database-schema-DgAMDjHF.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-COkaqci7.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-Bf_Fhv4v.mjs\";\nimport { a as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-DD69Bwve.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-DMOu5nnt.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { diffPostgresSchema as n, contractToPostgresDatabaseSchemaNode as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-DgAMDjHF.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;EACA;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;CACD;AACD;AACA,SAAS,cAAc,MAAM;CAC5B,OAAO,CAAC,aAAa,GAAG;EACvB,UAAU,uBAAuB;EACjC,IAAI;CACL,CAAC;AACF;;;;;;;AAOA,SAAS,gBAAgB,aAAa,WAAW,SAAS;CACzD,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,eAAe,aAAa,SAAS,GAAG;EAC1E,UAAU,yBAAyB;EACnC,IAAI,UAAU;CACf,CAAC,CAAC;AACH;AACA,SAAS,aAAa,QAAQ,aAAa;CAC1C,OAAO,IAAI,yBAAyB;EACnC,QAAQ,SAAS,OAAO,MAAM,OAAO,MAAM;EAC3C,WAAW,OAAO;EAClB;EACA,WAAW,OAAO;EAClB,OAAO,CAAC,GAAG,OAAO,KAAK;EACvB,OAAO,OAAO;EACd,WAAW,OAAO;EAClB,YAAY,OAAO;EACnB,WAAW,CAAC,eAAe,aAAa,OAAO,SAAS,GAAG,GAAG,OAAO,MAAM,IAAI,aAAa,CAAC;CAC9F,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,qCAAqC,UAAU,SAAS;CAChE,IAAI,aAAa,MAAM,OAAO,IAAI,2BAA2B;EAC5D,YAAY,CAAC;EACb,OAAO,CAAC;EACR,iBAAiB,CAAC;EAClB,WAAW;CACZ,CAAC;CACD,MAAM,aAAa,CAAC;CACpB,MAAM,QAAQ,CAAC;CACf,MAAM,eAAe,CA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B,UAAU,MAAM;CACzD,MAAM,kBAAkB,iBAAiB,QAAQ;CACjD,MAAM,kBAAkB,iBAAiB,YAAY;CACrD,OAAO;EACN;EACA,QAAQ;EACR,QAAQ,UAAU,YAAY,UAAU,YAAY,CAAC,CAAC,CAAC,QAAQ,UAAU;GACxE,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;GACnD,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,MAAM,cAAc,+BAA+B,OAAO,8BAA8B;GACxF,MAAM,mBAAmB,MAAM,KAAK;GACpC,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,QAAQ,gBAAgB,eAAe,kBAAkB,gBAAA,CAAiB,IAAI,gBAAgB;EAC/F,CAAC;CACF;AACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as TsqueryExpression, r as TsqueryParserOptions } from "./full-text-parsers-
|
|
1
|
+
import { n as TsqueryExpression, r as TsqueryParserOptions } from "./full-text-parsers-DrS_1B-x-BcAnBoQP.mjs";
|
|
2
2
|
//#region ../../../3-targets/3-targets/postgres/dist/full-text.d.mts
|
|
3
3
|
//#region src/core/tsquery-tag.d.ts
|
|
4
4
|
type TsqueryTag = (strings: TemplateStringsArray, ...values: string[]) => TsqueryExpression;
|
|
@@ -22,4 +22,4 @@ declare function tsquery(options: TsqueryParserOptions): TsqueryTag;
|
|
|
22
22
|
declare function tsquery(strings: TemplateStringsArray, ...values: string[]): TsqueryExpression;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { tsquery as n, TsqueryTag as t };
|
|
25
|
-
//# sourceMappingURL=full-text-
|
|
25
|
+
//# sourceMappingURL=full-text-CCqTEQ9y.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full-text-
|
|
1
|
+
{"version":3,"file":"full-text-CCqTEQ9y.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/full-text.d.mts"],"mappings":";;;KAEK,cAAc,SAAS,yBAAyB,qBAAqB;;;;;;;;;;;;;;;;;iBAiBzD,QAAQ,SAAS,uBAAuB;iBACxC,QAAQ,SAAS,yBAAyB,mBAAmB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as quoteIdentifier } from "./sql-utils-CVsvXiX4-C7xD0Bgv.mjs";
|
|
2
|
-
import { r as codecDescriptors } from "./codecs-
|
|
3
|
-
//#region ../../../3-targets/3-targets/postgres/dist/full-text-index-expression-
|
|
2
|
+
import { r as codecDescriptors } from "./codecs-BK3J4C0n-B8EnUXZf.mjs";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/dist/full-text-index-expression-Bfp_xWhy.mjs
|
|
4
4
|
/**
|
|
5
5
|
* The index expression that covers `fullTextMatches`, `fullTextRank` and
|
|
6
6
|
* `fullTextHeadline` on a column. Postgres uses an expression index only when the
|
|
@@ -27,4 +27,4 @@ function isFullTextIndexableCodec(codecId) {
|
|
|
27
27
|
//#endregion
|
|
28
28
|
export { renderFullTextIndexExpression as n, isFullTextIndexableCodec as t };
|
|
29
29
|
|
|
30
|
-
//# sourceMappingURL=full-text-index-expression-
|
|
30
|
+
//# sourceMappingURL=full-text-index-expression-Bfp_xWhy-DtbLdkzv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full-text-index-expression-
|
|
1
|
+
{"version":3,"file":"full-text-index-expression-Bfp_xWhy-DtbLdkzv.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/full-text-index-expression-Bfp_xWhy.mjs"],"sourcesContent":["import { r as quoteIdentifier } from \"./sql-utils-CVsvXiX4.mjs\";\nimport { t as codecDescriptors } from \"./codecs-BK3J4C0n.mjs\";\n//#region src/core/full-text-index-expression.ts\n/**\n* The index expression that covers `fullTextMatches`, `fullTextRank` and\n* `fullTextHeadline` on a column. Postgres uses an expression index only when the\n* indexed expression is the same `to_tsvector` over the same configuration literal and\n* the same column as the query, so both the `@@fullTextIndex` attribute and the\n* TypeScript helper render it here rather than each spelling it out.\n*/\nfunction renderFullTextIndexExpression(language, columnName) {\n\treturn `to_tsvector('${language}', ${quoteIdentifier(columnName)})`;\n}\n/** Widens a descriptor's trait tuple, so membership is a plain string test. */\nfunction traitsOf(descriptor) {\n\treturn descriptor.traits;\n}\nconst TEXTUAL_CODEC_IDS = new Set(codecDescriptors.filter((descriptor) => traitsOf(descriptor).includes(\"textual\")).map((descriptor) => descriptor.codecId));\n/**\n* Whether a column stored through this codec can be indexed for full-text search.\n* Read from the codec descriptors themselves, so both authoring surfaces accept\n* exactly the columns the `textual` operations dispatch on.\n*/\nfunction isFullTextIndexableCodec(codecId) {\n\treturn TEXTUAL_CODEC_IDS.has(codecId);\n}\n//#endregion\nexport { renderFullTextIndexExpression as n, isFullTextIndexableCodec as t };\n\n//# sourceMappingURL=full-text-index-expression-Bfp_xWhy.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,8BAA8B,UAAU,YAAY;CAC5D,OAAO,gBAAgB,SAAS,KAAK,gBAAgB,UAAU,EAAE;AAClE;;AAEA,SAAS,SAAS,YAAY;CAC7B,OAAO,WAAW;AACnB;AACA,MAAM,oBAAoB,IAAI,IAAI,iBAAiB,QAAQ,eAAe,SAAS,UAAU,CAAC,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,KAAK,eAAe,WAAW,OAAO,CAAC;;;;;;AAM3J,SAAS,yBAAyB,SAAS;CAC1C,OAAO,kBAAkB,IAAI,OAAO;AACrC"}
|
package/dist/{full-text-parsers-BhjgmAe5-CyF7dp_b.d.mts → full-text-parsers-DrS_1B-x-BcAnBoQP.d.mts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as PG_TSQUERY_CODEC_ID } from "./codec-ids-jWpRZjZo-BKIzyx-J.mjs";
|
|
2
2
|
import { n as FullTextSearchLanguage } from "./text-search-languages-BzhBMCtK-D26JB2w3.mjs";
|
|
3
|
-
import { t as ExtractedCodecTypes } from "./codec-type-map-
|
|
3
|
+
import { t as ExtractedCodecTypes } from "./codec-type-map-DueQFJ3a-DKLtMn3R.mjs";
|
|
4
4
|
import { Expression, TraitExpression } from "@prisma/orm-family-sql/relational-core/expression";
|
|
5
|
-
//#region ../../../3-targets/3-targets/postgres/dist/full-text-parsers-
|
|
5
|
+
//#region ../../../3-targets/3-targets/postgres/dist/full-text-parsers-DrS_1B-x.d.mts
|
|
6
6
|
//#region src/core/full-text-parsers.d.ts
|
|
7
7
|
interface TsqueryParserOptions {
|
|
8
8
|
/** Text-search configuration the parser normalizes the words with. Defaults to `english`. */
|
|
@@ -31,4 +31,4 @@ declare const plaintoTsquery: (text: TextArgument, options?: TsqueryParserOption
|
|
|
31
31
|
declare const phrasetoTsquery: (text: TextArgument, options?: TsqueryParserOptions) => TsqueryExpression;
|
|
32
32
|
//#endregion
|
|
33
33
|
export { plaintoTsquery as a, phrasetoTsquery as i, TsqueryExpression as n, toTsquery as o, TsqueryParserOptions as r, websearchToTsquery as s, TextArgument as t };
|
|
34
|
-
//# sourceMappingURL=full-text-parsers-
|
|
34
|
+
//# sourceMappingURL=full-text-parsers-DrS_1B-x-BcAnBoQP.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full-text-parsers-
|
|
1
|
+
{"version":3,"file":"full-text-parsers-DrS_1B-x-BcAnBoQP.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/full-text-parsers-DrS_1B-x.d.mts"],"mappings":";;;;;;UAKU;;WAEC,WAAW;;KAEjB,oBAAoB;EACvB,gBAAgB;EAChB;;;;;;KAMG,eAAe,6CAA6C;;cAEnD,qBAAqB,MAAM,cAAc,UAAU,yBAAyB;;;;;;cAM5E,YAAY,MAAM,cAAc,UAAU,yBAAyB;;cAEnE,iBAAiB,MAAM,cAAc,UAAU,yBAAyB;;cAExE,kBAAkB,MAAM,cAAc,UAAU,yBAAyB"}
|
package/dist/{infer-psl-contract-B5yExD61-Cmye68li.mjs → infer-psl-contract-D-3st5lU-DKQhhsut.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { S as PG_TEXT_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
|
|
2
2
|
import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
|
|
3
|
-
import { t as createPostgresBuiltinDataTypeLookup } from "./data-types-
|
|
4
|
-
import { r as POLICY_BLOCK_KEYWORDS } from "./authoring-
|
|
5
|
-
import { t as postgresRenderCheckExpressions } from "./check-expressions-
|
|
6
|
-
import { t as postgresDataTypeEntries } from "./data-type-entries-
|
|
7
|
-
import { t as parsePostgresDefault } from "./default-normalizer-
|
|
3
|
+
import { t as createPostgresBuiltinDataTypeLookup } from "./data-types-DRkmmE9S-C5Q9oH4Q.mjs";
|
|
4
|
+
import { r as POLICY_BLOCK_KEYWORDS } from "./authoring-_2G2lsLt-VmVbrMPn.mjs";
|
|
5
|
+
import { t as postgresRenderCheckExpressions } from "./check-expressions-BaFrBceq-ChgvazEN.mjs";
|
|
6
|
+
import { t as postgresDataTypeEntries } from "./data-type-entries-DoR61yeO-BB2cY7rI.mjs";
|
|
7
|
+
import { t as parsePostgresDefault } from "./default-normalizer-Bf_Fhv4v-CugGfLAe.mjs";
|
|
8
8
|
import { canonicalFormOf, codecForRef } from "@prisma/orm-framework/components/codec";
|
|
9
9
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
10
10
|
import { escapePslString } from "@prisma/orm-family-sql/contract/data-type-support";
|
|
@@ -21,7 +21,7 @@ import { UNSPECIFIED_PSL_NAMESPACE_ID, makePslNamespace, makePslNamespaceEntries
|
|
|
21
21
|
import { parsePslPositionalArgs } from "@prisma/orm-framework/psl-parser/interpret";
|
|
22
22
|
import { mapDefault, toEnumMemberName } from "@prisma/orm-family-sql/family/psl-build";
|
|
23
23
|
import { isColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
24
|
-
//#region ../../../3-targets/3-targets/postgres/dist/infer-psl-contract-
|
|
24
|
+
//#region ../../../3-targets/3-targets/postgres/dist/infer-psl-contract-D-3st5lU.mjs
|
|
25
25
|
/** A contract written for an existing database reads every date and time column as PostgreSQL's text. */
|
|
26
26
|
const EXISTING_COLUMN_DATE_TIME_TYPES = {
|
|
27
27
|
timestamp: "TimestampString",
|
|
@@ -1079,4 +1079,4 @@ function buildPslDocumentAst(schemaIR, options, foreignKeyExtras, namespaceName,
|
|
|
1079
1079
|
//#endregion
|
|
1080
1080
|
export { buildIndexAttribute as a, buildNativeEnumBlock as c, createPostgresTypeMap as d, inferPostgresPslContract as f, positionalArg as g, parseDefaultAttributeString as h, buildCheckAttribute as i, buildPslDocumentAst as l, noColumnDefaults as m, SYNTHETIC_SPAN as n, buildMapAttribute as o, namedArg as p, buildAttribute as r, buildModelConstraintAttribute as s, EXISTING_COLUMN_DATE_TIME_TYPES as t, createPostgresDefaultMapping as u };
|
|
1081
1081
|
|
|
1082
|
-
//# sourceMappingURL=infer-psl-contract-
|
|
1082
|
+
//# sourceMappingURL=infer-psl-contract-D-3st5lU-DKQhhsut.mjs.map
|