@prisma/orm-family-sql 8.0.0-rc.18-dev.16 → 8.0.0-rc.18-dev.17

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.
Files changed (278) hide show
  1. package/dist/{aggregate-descriptor-registry-DrJ1vHEo.mjs → aggregate-descriptor-registry-Dd7Uj7DJ.mjs} +3 -3
  2. package/dist/{aggregate-descriptor-registry-DrJ1vHEo.mjs.map → aggregate-descriptor-registry-Dd7Uj7DJ.mjs.map} +1 -1
  3. package/dist/{ast-BDwGvnKK.mjs → ast-CBO3PEJF.mjs} +73 -47
  4. package/dist/ast-CBO3PEJF.mjs.map +1 -0
  5. package/dist/{ast-BoM9T1b2.d.mts → ast-Dzsat0Zb.d.mts} +27 -26
  6. package/dist/ast-Dzsat0Zb.d.mts.map +1 -0
  7. package/dist/{attribute-specs-D7EhHD08.d.mts → attribute-specs-2I2xuKEa.d.mts} +4 -3
  8. package/dist/attribute-specs-2I2xuKEa.d.mts.map +1 -0
  9. package/dist/{authored-check-naming-CO3GA46Y.mjs → authored-check-naming-CIX7Bbyh.mjs} +3 -3
  10. package/dist/{authored-check-naming-CO3GA46Y.mjs.map → authored-check-naming-CIX7Bbyh.mjs.map} +1 -1
  11. package/dist/{authoring-entity-types-CZ-vdwYS-Cl5erH9X.d.mts → authoring-entity-types-CZ-vdwYS-BpyuSxbj.d.mts} +2 -2
  12. package/dist/{authoring-entity-types-CZ-vdwYS-Cl5erH9X.d.mts.map → authoring-entity-types-CZ-vdwYS-BpyuSxbj.d.mts.map} +1 -1
  13. package/dist/{authoring-type-constructors-0Iv2zdwS-yMnSyGBK.mjs → authoring-type-constructors-0Iv2zdwS-MFIpJ4fA.mjs} +2 -2
  14. package/dist/{authoring-type-constructors-0Iv2zdwS-yMnSyGBK.mjs.map → authoring-type-constructors-0Iv2zdwS-MFIpJ4fA.mjs.map} +1 -1
  15. package/dist/builder.d.mts +3 -3
  16. package/dist/builder__runtime.d.mts +7 -7
  17. package/dist/builder__runtime.mjs +2 -2
  18. package/dist/builder__types.d.mts +5 -5
  19. package/dist/{codec-descriptor-registry-Bg9OjQf_.mjs → codec-descriptor-registry-4kw8FPpo.mjs} +2 -2
  20. package/dist/{codec-descriptor-registry-Bg9OjQf_.mjs.map → codec-descriptor-registry-4kw8FPpo.mjs.map} +1 -1
  21. package/dist/{collection-methods-BnR4UjcW-C_55W2m0.d.mts → collection-methods-B-tM7OPZ-v8HK9Txa.d.mts} +3 -3
  22. package/dist/{collection-methods-BnR4UjcW-C_55W2m0.d.mts.map → collection-methods-B-tM7OPZ-v8HK9Txa.d.mts.map} +1 -1
  23. package/dist/collection-methods-DQAFcGEB.d.mts +1 -0
  24. package/dist/{config-types-ni1nb_HA.mjs → config-types-ComQZUlA.mjs} +2 -2
  25. package/dist/{config-types-ni1nb_HA.mjs.map → config-types-ComQZUlA.mjs.map} +1 -1
  26. package/dist/{contract-builder-CH0AIjsv.d.mts → contract-builder-De_fyZGT.d.mts} +6 -6
  27. package/dist/{contract-builder-CH0AIjsv.d.mts.map → contract-builder-De_fyZGT.d.mts.map} +1 -1
  28. package/dist/{contract-builder-CiYVj56_.mjs → contract-builder-fQ3gkIR5.mjs} +5 -5
  29. package/dist/{contract-builder-CiYVj56_.mjs.map → contract-builder-fQ3gkIR5.mjs.map} +1 -1
  30. package/dist/contract-emitter.mjs +1 -1
  31. package/dist/contract-prisma7__provider.d.mts +12 -6
  32. package/dist/contract-prisma7__provider.d.mts.map +1 -1
  33. package/dist/contract-prisma7__provider.mjs +48 -43
  34. package/dist/contract-prisma7__provider.mjs.map +1 -1
  35. package/dist/contract-psl.d.mts +2 -2
  36. package/dist/contract-psl.d.mts.map +1 -1
  37. package/dist/contract-psl.mjs +1 -1
  38. package/dist/contract-psl__attribute-specs.d.mts +1 -1
  39. package/dist/contract-psl__attribute-specs.mjs +1 -1
  40. package/dist/contract-psl__provider.mjs +2 -2
  41. package/dist/contract-psl__provider.mjs.map +1 -1
  42. package/dist/contract-ts.d.mts +2 -2
  43. package/dist/contract-ts.mjs +4 -4
  44. package/dist/contract-ts__config-types.mjs +1 -1
  45. package/dist/contract-ts__contract-builder.d.mts +2 -2
  46. package/dist/contract-ts__contract-builder.mjs +3 -3
  47. package/dist/contract.d.mts +6 -6
  48. package/dist/contract.mjs +15 -15
  49. package/dist/contract__authored-check-naming.mjs +1 -1
  50. package/dist/contract__data-type-support.d.mts +2 -2
  51. package/dist/contract__data-type-support.mjs +2 -2
  52. package/dist/contract__data-type.d.mts +2 -2
  53. package/dist/contract__data-type.mjs +3 -3
  54. package/dist/contract__entity-kinds.mjs +1 -1
  55. package/dist/contract__factories.mjs +1 -1
  56. package/dist/contract__foreign-key-materialization.d.mts +1 -1
  57. package/dist/contract__foreign-key-materialization.mjs +2 -2
  58. package/dist/contract__index-naming.mjs +1 -1
  59. package/dist/contract__sql-expression.d.mts +2 -2
  60. package/dist/contract__sql-expression.mjs +2 -2
  61. package/dist/contract__types.mjs +3 -3
  62. package/dist/contract__validators.d.mts +1 -1
  63. package/dist/contract__validators.mjs +2 -2
  64. package/dist/{control-DXqMl_gd.mjs → control-ClahTAD-.mjs} +246 -40
  65. package/dist/control-ClahTAD-.mjs.map +1 -0
  66. package/dist/{control-adapter-CkFfBVei-DGf1LihO.d.mts → control-adapter-BCopdpsT-DIHCWbq_.d.mts} +9 -26
  67. package/dist/control-adapter-BCopdpsT-DIHCWbq_.d.mts.map +1 -0
  68. package/dist/control-adapter-BsSf5pqM.d.mts +1 -0
  69. package/dist/{control-CPg4LwJV.d.mts → control-mpACqp72.d.mts} +72 -39
  70. package/dist/control-mpACqp72.d.mts.map +1 -0
  71. package/dist/{data-type-CYsho6Yd.d.mts → data-type-B8N33s-_.d.mts} +14 -7
  72. package/dist/data-type-B8N33s-_.d.mts.map +1 -0
  73. package/dist/{numeral-text-Cqu87pVe-DJCqBaSC.mjs → data-type-DKk8Unnz.mjs} +2 -2
  74. package/dist/data-type-DKk8Unnz.mjs.map +1 -0
  75. package/dist/{data-type-support-CfhpAKLX.mjs → data-type-support-C5-XxxeB.mjs} +11 -24
  76. package/dist/data-type-support-C5-XxxeB.mjs.map +1 -0
  77. package/dist/{data-type-support-4TcZuD7d.d.mts → data-type-support-CBcYhSkD.d.mts} +12 -16
  78. package/dist/data-type-support-CBcYhSkD.d.mts.map +1 -0
  79. package/dist/{db-BmrN9nRS-CzyybGKR.d.mts → db-BmrN9nRS-xynLbnAy.d.mts} +10 -10
  80. package/dist/{db-BmrN9nRS-CzyybGKR.d.mts.map → db-BmrN9nRS-xynLbnAy.d.mts.map} +1 -1
  81. package/dist/{ddl-types-DtKZjNtN-DWQeO79o.d.mts → ddl-types-CoP6yAw9-BDp3W_5g.d.mts} +4 -4
  82. package/dist/{ddl-types-DtKZjNtN-DWQeO79o.d.mts.map → ddl-types-CoP6yAw9-BDp3W_5g.d.mts.map} +1 -1
  83. package/dist/{default-mapping-B8_APB1M-CWcTmSQW.d.mts → default-mapping-CEISdj2g-DF1LzGBR.d.mts} +7 -5
  84. package/dist/default-mapping-CEISdj2g-DF1LzGBR.d.mts.map +1 -0
  85. package/dist/{derived-checks-Cgx_VgS3-CmFqNFgU.mjs → derived-checks-CrvMQTJF-DlxFFtNM.mjs} +18 -18
  86. package/dist/derived-checks-CrvMQTJF-DlxFFtNM.mjs.map +1 -0
  87. package/dist/{diff-CVVGktZG.d.mts → diff-Bd9ILpZL.d.mts} +20 -7
  88. package/dist/diff-Bd9ILpZL.d.mts.map +1 -0
  89. package/dist/diff-DZ82XaGR.mjs +21 -0
  90. package/dist/diff-DZ82XaGR.mjs.map +1 -0
  91. package/dist/{dist-Cg2lL1hR.mjs → dist-DAHIT4AS.mjs} +2 -2
  92. package/dist/{dist-Cg2lL1hR.mjs.map → dist-DAHIT4AS.mjs.map} +1 -1
  93. package/dist/{entity-kinds-CQ_jwgYv-HA5t2SE0.mjs → entity-kinds-CQ_jwgYv-DoOBWwvX.mjs} +3 -3
  94. package/dist/{entity-kinds-CQ_jwgYv-HA5t2SE0.mjs.map → entity-kinds-CQ_jwgYv-DoOBWwvX.mjs.map} +1 -1
  95. package/dist/{expression-Ck1wys3N-Cdc7eUQS.d.mts → expression-BzrfOiPC-3NqR8UzK.d.mts} +4 -4
  96. package/dist/{expression-Ck1wys3N-Cdc7eUQS.d.mts.map → expression-BzrfOiPC-3NqR8UzK.d.mts.map} +1 -1
  97. package/dist/expression-CeerCjQG.d.mts +2 -0
  98. package/dist/{expression-CNBCbbzU-DOXKUxQs.d.mts → expression-sOY1120I-DOykEQlw.d.mts} +4 -4
  99. package/dist/expression-sOY1120I-DOykEQlw.d.mts.map +1 -0
  100. package/dist/{factories-vDQ3S5gW.mjs → factories-DkD3nMYt.mjs} +3 -3
  101. package/dist/{factories-vDQ3S5gW.mjs.map → factories-DkD3nMYt.mjs.map} +1 -1
  102. package/dist/family.d.mts +14 -14
  103. package/dist/family.mjs +8 -8
  104. package/dist/family__control-adapter.d.mts +2 -2
  105. package/dist/family__control.d.mts +5 -5
  106. package/dist/family__control.mjs +4 -4
  107. package/dist/family__diff.d.mts +1 -2
  108. package/dist/family__diff.mjs +2 -2
  109. package/dist/family__ir.d.mts +1 -1
  110. package/dist/family__ir.mjs +1 -1
  111. package/dist/family__migration.d.mts +1 -1
  112. package/dist/family__pack.d.mts +1 -1
  113. package/dist/family__pack.mjs +2 -2
  114. package/dist/family__psl-build.d.mts +2 -2
  115. package/dist/family__psl-build.mjs +1 -1
  116. package/dist/family__psl-infer.d.mts +1 -1
  117. package/dist/family__psl-infer.mjs +1 -1
  118. package/dist/{foreign-key-materialization-DJ6uhBba.d.mts → foreign-key-materialization-DCaDnUs-.d.mts} +3 -3
  119. package/dist/{foreign-key-materialization-DJ6uhBba.d.mts.map → foreign-key-materialization-DCaDnUs-.d.mts.map} +1 -1
  120. package/dist/{foreign-key-materialization-DibQ9Hjg.mjs → foreign-key-materialization-DfNPQL9G.mjs} +4 -4
  121. package/dist/{foreign-key-materialization-DibQ9Hjg.mjs.map → foreign-key-materialization-DfNPQL9G.mjs.map} +1 -1
  122. package/dist/{functions-DSwXxsTg.d.mts → functions-Cp8soSAv.d.mts} +3 -3
  123. package/dist/{functions-DSwXxsTg.d.mts.map → functions-Cp8soSAv.d.mts.map} +1 -1
  124. package/dist/{index-C8jUgdUh.d.mts → index-DWNoqFzr.d.mts} +17 -17
  125. package/dist/{index-C8jUgdUh.d.mts.map → index-DWNoqFzr.d.mts.map} +1 -1
  126. package/dist/{index-equivalence-DswCiq5l-DlC2yTK1.mjs → index-equivalence-DswCiq5l-BsphajRC.mjs} +2 -2
  127. package/dist/{index-equivalence-DswCiq5l-DlC2yTK1.mjs.map → index-equivalence-DswCiq5l-BsphajRC.mjs.map} +1 -1
  128. package/dist/{index-naming-BOcJT1B3-CeEoP8t3.mjs → index-naming-BOcJT1B3-18gQUduD.mjs} +2 -2
  129. package/dist/{index-naming-BOcJT1B3-CeEoP8t3.mjs.map → index-naming-BOcJT1B3-18gQUduD.mjs.map} +1 -1
  130. package/dist/index-reference-CWppFpUV.d.mts +1 -0
  131. package/dist/{index-reference-DJX-CNsb-D5uoBnH_.d.mts → index-reference-DJaQLZA3-DxmYkkX-.d.mts} +3 -3
  132. package/dist/{index-reference-DJX-CNsb-D5uoBnH_.d.mts.map → index-reference-DJaQLZA3-DxmYkkX-.d.mts.map} +1 -1
  133. package/dist/{interpreter-CvmBTYyI-DNl-jr2E.mjs → interpreter-CFj2aTEP-BHL3TOqk.mjs} +13 -11
  134. package/dist/interpreter-CFj2aTEP-BHL3TOqk.mjs.map +1 -0
  135. package/dist/{ir-D0Vpm5O9.d.mts → ir-DgNo535E.d.mts} +4 -2
  136. package/dist/ir-DgNo535E.d.mts.map +1 -0
  137. package/dist/ir-I-xciGUH.mjs.map +1 -1
  138. package/dist/middleware-IqWk9Eff.d.mts +1 -0
  139. package/dist/{middleware-YsFLC19Y-5mJZCBWq.d.mts → middleware-oCT0RWkt-AFlRNCOD.d.mts} +3 -3
  140. package/dist/{middleware-YsFLC19Y-5mJZCBWq.d.mts.map → middleware-oCT0RWkt-AFlRNCOD.d.mts.map} +1 -1
  141. package/dist/{migration-ESRa6312.d.mts → migration-lg_VgP_F.d.mts} +2 -2
  142. package/dist/{migration-ESRa6312.d.mts.map → migration-lg_VgP_F.d.mts.map} +1 -1
  143. package/dist/{naming-CT8tRisJ-DLHKo0Hm.mjs → naming-bM5qm5PY-DdginUhA.mjs} +2 -2
  144. package/dist/{naming-CT8tRisJ-DLHKo0Hm.mjs.map → naming-bM5qm5PY-DdginUhA.mjs.map} +1 -1
  145. package/dist/{opaque-sql-BWxbqe5a-GGKfyakq.mjs → opaque-sql-Dset3kln-BzzXoO94.mjs} +3 -3
  146. package/dist/opaque-sql-Dset3kln-BzzXoO94.mjs.map +1 -0
  147. package/dist/orm-client.d.mts +17 -17
  148. package/dist/orm-client.mjs +59 -46
  149. package/dist/orm-client.mjs.map +1 -1
  150. package/dist/{pack-BtGENS4_.d.mts → pack-CyjyMUN0.d.mts} +3 -3
  151. package/dist/{pack-BtGENS4_.d.mts.map → pack-CyjyMUN0.d.mts.map} +1 -1
  152. package/dist/plan-BZpZafiQ.d.mts +2 -0
  153. package/dist/{plan-cGEaSXHv-yuz43WrR.d.mts → plan-Cbed2eDu-BZM3geSm.d.mts} +3 -3
  154. package/dist/plan-Cbed2eDu-BZM3geSm.d.mts.map +1 -0
  155. package/dist/{psl-build-PXVtl8gM.d.mts → psl-build-BHQfP1_C.d.mts} +5 -5
  156. package/dist/{psl-build-PXVtl8gM.d.mts.map → psl-build-BHQfP1_C.d.mts.map} +1 -1
  157. package/dist/{psl-build-8bx9WTUt.mjs → psl-build-BsJ6eChh.mjs} +118 -84
  158. package/dist/psl-build-BsJ6eChh.mjs.map +1 -0
  159. package/dist/{psl-column-resolution-BCkhNzOK-Bbrs_WzK.d.mts → psl-column-resolution-BCkhNzOK-mW_8C9vr.d.mts} +2 -2
  160. package/dist/{psl-column-resolution-BCkhNzOK-Bbrs_WzK.d.mts.map → psl-column-resolution-BCkhNzOK-mW_8C9vr.d.mts.map} +1 -1
  161. package/dist/{psl-field-resolution-SPNDr-jr-CH_gs3Oy.mjs → psl-field-resolution-o9sXqIlE-BJnlxQ4z.mjs} +76 -66
  162. package/dist/psl-field-resolution-o9sXqIlE-BJnlxQ4z.mjs.map +1 -0
  163. package/dist/{psl-infer-g040TwAr.d.mts → psl-infer-B6iemK9i.d.mts} +4 -4
  164. package/dist/{psl-infer-g040TwAr.d.mts.map → psl-infer-B6iemK9i.d.mts.map} +1 -1
  165. package/dist/{psl-infer-CG0_wra6.mjs → psl-infer-HPi_YMeE.mjs} +2 -2
  166. package/dist/{psl-infer-CG0_wra6.mjs.map → psl-infer-HPi_YMeE.mjs.map} +1 -1
  167. package/dist/{query-lane-context-C42-u9L1-BSJoP83K.d.mts → query-lane-context-BLOPW1rQ-Bn3ugl9a.d.mts} +5 -5
  168. package/dist/{query-lane-context-C42-u9L1-BSJoP83K.d.mts.map → query-lane-context-BLOPW1rQ-Bn3ugl9a.d.mts.map} +1 -1
  169. package/dist/query-lane-context-Dpep1Fzy.d.mts +1 -0
  170. package/dist/relational-core.d.mts +12 -12
  171. package/dist/relational-core.mjs +2 -2
  172. package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
  173. package/dist/relational-core__aggregate-descriptor-registry.mjs +1 -1
  174. package/dist/relational-core__ast.d.mts +3 -3
  175. package/dist/relational-core__ast.mjs +2 -2
  176. package/dist/relational-core__codec-descriptor-registry.d.mts +2 -2
  177. package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
  178. package/dist/relational-core__collection-methods.d.mts +2 -2
  179. package/dist/relational-core__contract-free.d.mts +3 -3
  180. package/dist/relational-core__contract-free.mjs +2 -2
  181. package/dist/relational-core__contract-free.mjs.map +1 -1
  182. package/dist/relational-core__expression.d.mts +3 -3
  183. package/dist/relational-core__functions.d.mts +1 -1
  184. package/dist/relational-core__index-reference.d.mts +2 -2
  185. package/dist/relational-core__middleware.d.mts +2 -2
  186. package/dist/relational-core__plan.d.mts +3 -3
  187. package/dist/relational-core__query-lane-context.d.mts +2 -2
  188. package/dist/relational-core__types.d.mts +2 -2
  189. package/dist/runtime.d.mts +4 -4
  190. package/dist/runtime.mjs +7 -7
  191. package/dist/runtime.mjs.map +1 -1
  192. package/dist/runtime__internal__prepared-query.d.mts +1 -1
  193. package/dist/{schema-differ-CqWOkoW9-uVU2SdFf.d.mts → schema-differ-DmP74bB8-BGA6fzOv.d.mts} +4 -4
  194. package/dist/{schema-differ-CqWOkoW9-uVU2SdFf.d.mts.map → schema-differ-DmP74bB8-BGA6fzOv.d.mts.map} +1 -1
  195. package/dist/schema-ir.d.mts +2 -2
  196. package/dist/schema-ir.mjs +2 -2
  197. package/dist/schema-ir__naming.mjs +1 -1
  198. package/dist/schema-ir__types.d.mts +3 -3
  199. package/dist/schema-ir__types.mjs +2 -2
  200. package/dist/{schema-verify-DIfHSB4I-wt28gB9e.mjs → schema-verify-BwRdzbHb-B9vFrm3T.mjs} +22 -6
  201. package/dist/schema-verify-BwRdzbHb-B9vFrm3T.mjs.map +1 -0
  202. package/dist/{serialized-index-52COq1yV-D8zJP-Xl.mjs → serialized-index-52COq1yV-CUJ2F65u.mjs} +3 -3
  203. package/dist/{serialized-index-52COq1yV-D8zJP-Xl.mjs.map → serialized-index-52COq1yV-CUJ2F65u.mjs.map} +1 -1
  204. package/dist/{sql-contract-serializer-DDaAVCQr-Ba3XOCG6.mjs → sql-contract-serializer-sMY3prTx-C8IEwSsf.mjs} +12 -7
  205. package/dist/sql-contract-serializer-sMY3prTx-C8IEwSsf.mjs.map +1 -0
  206. package/dist/{data-type-DU0mtme5.mjs → sql-data-type-Dabuwxet-BljsNjBu.mjs} +32 -13
  207. package/dist/sql-data-type-Dabuwxet-BljsNjBu.mjs.map +1 -0
  208. package/dist/{sql-execution-plan-C7XauPPu-BgBp89vP.d.mts → sql-execution-plan-Dam5yMZg-Bc_eneSz.d.mts} +3 -3
  209. package/dist/sql-execution-plan-Dam5yMZg-Bc_eneSz.d.mts.map +1 -0
  210. package/dist/{sql-expression-BWrjmY6M.d.mts → sql-expression-BAtH-2UU.d.mts} +6 -6
  211. package/dist/sql-expression-BAtH-2UU.d.mts.map +1 -0
  212. package/dist/{sql-expression-DSRILiU2.mjs → sql-expression-BJCuy-WI.mjs} +15 -9
  213. package/dist/sql-expression-BJCuy-WI.mjs.map +1 -0
  214. package/dist/{storage-table-DN36E2yE-Bm5eKeGw.mjs → storage-table-DN36E2yE-0ncS821l.mjs} +2 -2
  215. package/dist/{storage-table-DN36E2yE-Bm5eKeGw.mjs.map → storage-table-DN36E2yE-0ncS821l.mjs.map} +1 -1
  216. package/dist/{transaction-state-DR3nKTmH-D5eFB250.d.mts → transaction-state-DR3nKTmH-n_12DsnU.d.mts} +9 -9
  217. package/dist/{transaction-state-DR3nKTmH-D5eFB250.d.mts.map → transaction-state-DR3nKTmH-n_12DsnU.d.mts.map} +1 -1
  218. package/dist/types-BLyhYk6B.d.mts +1 -0
  219. package/dist/{types-DvhckjSz-Cm0Oodhr.mjs → types-CaVn_xxe-D9WdU3Iy.mjs} +81 -157
  220. package/dist/types-CaVn_xxe-D9WdU3Iy.mjs.map +1 -0
  221. package/dist/{types-Cl4MLNrS-BXDsTb9U.d.mts → types-Cv5t6_Ly-CcBWTpfM.d.mts} +6 -6
  222. package/dist/{types-Cl4MLNrS-BXDsTb9U.d.mts.map → types-Cv5t6_Ly-CcBWTpfM.d.mts.map} +1 -1
  223. package/dist/{types-Sh5HuaZE-BwZNUDEi.d.mts → types-DVaVM20q-B-QcMIOa.d.mts} +9 -20
  224. package/dist/types-DVaVM20q-B-QcMIOa.d.mts.map +1 -0
  225. package/dist/{types-CzxOObSY-Cq3t_HCe.d.mts → types-DaYtBAYT-B22gkh5z.d.mts} +5 -5
  226. package/dist/{types-CzxOObSY-Cq3t_HCe.d.mts.map → types-DaYtBAYT-B22gkh5z.d.mts.map} +1 -1
  227. package/dist/{types-GS3fwvoX.mjs → types-M_FeBD9w.mjs} +2 -2
  228. package/dist/{types-GS3fwvoX.mjs.map → types-M_FeBD9w.mjs.map} +1 -1
  229. package/dist/types-_7TbRpPw.d.mts +1 -0
  230. package/dist/{types-C-z8HyiZ-1Nhw0pHj.d.mts → types-c1iIhJep-DdMj6TNl.d.mts} +49 -51
  231. package/dist/types-c1iIhJep-DdMj6TNl.d.mts.map +1 -0
  232. package/dist/{validators-DlpO67uZ.mjs → validators-Bvfk0aN7.mjs} +14 -11
  233. package/dist/validators-Bvfk0aN7.mjs.map +1 -0
  234. package/dist/{validators-R-Wsy5Rr.d.mts → validators-CTZ-hU2l.d.mts} +4 -1
  235. package/dist/validators-CTZ-hU2l.d.mts.map +1 -0
  236. package/package.json +18 -18
  237. package/dist/ast-BDwGvnKK.mjs.map +0 -1
  238. package/dist/ast-BoM9T1b2.d.mts.map +0 -1
  239. package/dist/attribute-specs-D7EhHD08.d.mts.map +0 -1
  240. package/dist/collection-methods-CyUXbXVw.d.mts +0 -1
  241. package/dist/control-CPg4LwJV.d.mts.map +0 -1
  242. package/dist/control-DXqMl_gd.mjs.map +0 -1
  243. package/dist/control-adapter-CkFfBVei-DGf1LihO.d.mts.map +0 -1
  244. package/dist/control-adapter-DDjgBMy3.d.mts +0 -1
  245. package/dist/data-type-CYsho6Yd.d.mts.map +0 -1
  246. package/dist/data-type-DU0mtme5.mjs.map +0 -1
  247. package/dist/data-type-support-4TcZuD7d.d.mts.map +0 -1
  248. package/dist/data-type-support-CfhpAKLX.mjs.map +0 -1
  249. package/dist/default-mapping-B8_APB1M-CWcTmSQW.d.mts.map +0 -1
  250. package/dist/derived-checks-Cgx_VgS3-CmFqNFgU.mjs.map +0 -1
  251. package/dist/diff-B16bL_IR.mjs +0 -13
  252. package/dist/diff-B16bL_IR.mjs.map +0 -1
  253. package/dist/diff-CVVGktZG.d.mts.map +0 -1
  254. package/dist/expression-CNBCbbzU-DOXKUxQs.d.mts.map +0 -1
  255. package/dist/expression-DUYovBa6.d.mts +0 -2
  256. package/dist/index-reference-DGQdSRjQ.d.mts +0 -1
  257. package/dist/interpreter-CvmBTYyI-DNl-jr2E.mjs.map +0 -1
  258. package/dist/ir-D0Vpm5O9.d.mts.map +0 -1
  259. package/dist/middleware-Bp-R5o9E.d.mts +0 -1
  260. package/dist/numeral-text-Cqu87pVe-DJCqBaSC.mjs.map +0 -1
  261. package/dist/opaque-sql-BWxbqe5a-GGKfyakq.mjs.map +0 -1
  262. package/dist/plan-DdpaNNu1.d.mts +0 -2
  263. package/dist/plan-cGEaSXHv-yuz43WrR.d.mts.map +0 -1
  264. package/dist/psl-build-8bx9WTUt.mjs.map +0 -1
  265. package/dist/psl-field-resolution-SPNDr-jr-CH_gs3Oy.mjs.map +0 -1
  266. package/dist/query-lane-context-C4xq68Mr.d.mts +0 -1
  267. package/dist/schema-verify-DIfHSB4I-wt28gB9e.mjs.map +0 -1
  268. package/dist/sql-contract-serializer-DDaAVCQr-Ba3XOCG6.mjs.map +0 -1
  269. package/dist/sql-execution-plan-C7XauPPu-BgBp89vP.d.mts.map +0 -1
  270. package/dist/sql-expression-BWrjmY6M.d.mts.map +0 -1
  271. package/dist/sql-expression-DSRILiU2.mjs.map +0 -1
  272. package/dist/types-BSBsW0qR.d.mts +0 -1
  273. package/dist/types-C-z8HyiZ-1Nhw0pHj.d.mts.map +0 -1
  274. package/dist/types-CJK7FBdw.d.mts +0 -1
  275. package/dist/types-DvhckjSz-Cm0Oodhr.mjs.map +0 -1
  276. package/dist/types-Sh5HuaZE-BwZNUDEi.d.mts.map +0 -1
  277. package/dist/validators-DlpO67uZ.mjs.map +0 -1
  278. package/dist/validators-R-Wsy5Rr.d.mts.map +0 -1
@@ -1,27 +1,27 @@
1
- import { u as namingOf } from "./naming-CT8tRisJ-DLHKo0Hm.mjs";
1
+ import { u as namingOf } from "./naming-bM5qm5PY-DdginUhA.mjs";
2
2
  import { t as sqlContractCanonicalizationHooks } from "./canonicalization-hooks-dmXkOR4a.mjs";
3
- import { a as renderSqlTypeName, d as unquotedSqlBaseName, t as dataTypeParams, u as sqlDataTypeOfCodec } from "./data-type-DU0mtme5.mjs";
4
- import { c as StorageTable } from "./storage-table-DN36E2yE-Bm5eKeGw.mjs";
5
- import { c as SqlSchemaIR, n as RelationalSchemaNodeKind, u as SqlTableIR } from "./types-DvhckjSz-Cm0Oodhr.mjs";
6
- import { p as sqlExpressionRegistration } from "./sql-expression-DSRILiU2.mjs";
7
- import { u as isStorageTypeInstance } from "./types-GS3fwvoX.mjs";
8
- import { g as valueObjectStorageTypeMissingMessage } from "./validators-DlpO67uZ.mjs";
9
- import { a as describeUnsupportedSqlAttribute, v as sqlAttributeSpecs } from "./psl-field-resolution-SPNDr-jr-CH_gs3Oy.mjs";
3
+ import { d as sqlStorageTypeId, h as validateSqlTypeParams, i as renderSqlTypeName, l as sqlDataTypeOfCodec, n as isSqlDataType, p as unquotedSqlBaseName, u as sqlStorageType } from "./sql-data-type-Dabuwxet-BljsNjBu.mjs";
4
+ import { c as StorageTable } from "./storage-table-DN36E2yE-0ncS821l.mjs";
5
+ import { c as SqlSchemaIR, n as RelationalSchemaNodeKind, u as SqlTableIR } from "./types-CaVn_xxe-D9WdU3Iy.mjs";
6
+ import { f as sqlExpressionRegistration } from "./sql-expression-BJCuy-WI.mjs";
7
+ import { d as resolvedTypeParams, u as isStorageTypeInstance } from "./types-M_FeBD9w.mjs";
8
+ import { g as valueObjectStorageTypeMissingMessage } from "./validators-Bvfk0aN7.mjs";
9
+ import { a as describeUnsupportedSqlAttribute, v as sqlAttributeSpecs } from "./psl-field-resolution-o9sXqIlE-BJnlxQ4z.mjs";
10
10
  import { t as describeUnresolvedSqlType } from "./diagnostics-C8YevjSU.mjs";
11
- import { t as sqlEmission } from "./dist-Cg2lL1hR.mjs";
12
- import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringTypes, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringFieldPresets } from "./authoring-type-constructors-0Iv2zdwS-yMnSyGBK.mjs";
13
- import { c as verifySqlSchemaByDiff, n as classifyDiffSubjectGranularity, o as enforceSqlDataTypeInvariants, t as classifyDiffEntityKind } from "./schema-verify-DIfHSB4I-wt28gB9e.mjs";
11
+ import { t as sqlEmission } from "./dist-DAHIT4AS.mjs";
12
+ import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringTypes, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringFieldPresets } from "./authoring-type-constructors-0Iv2zdwS-MFIpJ4fA.mjs";
13
+ import { c as verifySqlSchemaByDiff, n as classifyDiffSubjectGranularity, o as enforceSqlDataTypeInvariants, t as classifyDiffEntityKind } from "./schema-verify-BwRdzbHb-B9vFrm3T.mjs";
14
14
  import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
15
- import { t as SqlContractSerializer } from "./sql-contract-serializer-DDaAVCQr-Ba3XOCG6.mjs";
15
+ import { t as SqlContractSerializer } from "./sql-contract-serializer-sMY3prTx-C8IEwSsf.mjs";
16
16
  import { t as collectSupportedCodecTypeIds } from "./verify-BVk5bjdH-dq5M4iIh.mjs";
17
17
  import { isStructuredError, structuredError } from "@prisma/orm-framework/utils/structured-error";
18
18
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
19
19
  import { TEMPORAL_ON_CREATE_ARG, TEMPORAL_ON_UPDATE_ARG, TIMESTAMP_NOW_GENERATOR_ID, collectScalarTypeConstructors, temporalAuthoringPresets, temporalPhaseTemplate, tsTaggedTemplateSource } from "@prisma/orm-framework/components/authoring";
20
20
  import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
21
21
  import { UNBOUND_NAMESPACE_ID, isPlainRecord } from "@prisma/orm-framework/components/ir";
22
- import { assembleDataTypes, canonicalFormOf } from "@prisma/orm-framework/components/codec";
22
+ import { assembleDataTypes, codecForRef, dataTypeParams } from "@prisma/orm-framework/components/codec";
23
23
  import { blindCast } from "@prisma/orm-framework/utils/casts";
24
- import { InternalError } from "@prisma/orm-framework/utils/internal-error";
24
+ import { InternalError, isInternalError } from "@prisma/orm-framework/utils/internal-error";
25
25
  import { type } from "arktype";
26
26
  import { asNamespaceId, effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
27
27
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
@@ -52,6 +52,75 @@ function dataTypeProblems(storage, codecLookup) {
52
52
  return [`${path}: codec ${codecId} represents ${represented}, not ${dataType}`];
53
53
  });
54
54
  }
55
+ /** Whether `type` refuses `params`. The check of the column's parameters reports that, so its default is not read under them. */
56
+ function refusesParams(type, params) {
57
+ if (!isSqlDataType(type)) return false;
58
+ try {
59
+ validateSqlTypeParams(type, params);
60
+ return false;
61
+ } catch (error) {
62
+ if (isStructuredError(error) && error.code === "CONTRACT.TYPE_PARAMS_INVALID") return true;
63
+ throw error;
64
+ }
65
+ }
66
+ /** Names the namespace, unless the contract has only the unbound one, as a SQLite contract does. */
67
+ function columnPlace(refused) {
68
+ return refused.namespaceId === UNBOUND_NAMESPACE_ID ? `Table "${refused.table}", column "${refused.column}"` : `Namespace "${refused.namespaceId}", table "${refused.table}", column "${refused.column}"`;
69
+ }
70
+ function notAValue(refused) {
71
+ return {
72
+ refused,
73
+ text: `${columnPlace(refused)}: the default ${JSON.stringify(refused.value)}${refused.elementIndex === void 0 ? "" : ` at element ${refused.elementIndex + 1}`} is not a value of ${refused.dataType}: ${refused.message}`
74
+ };
75
+ }
76
+ function notAList(refused) {
77
+ return {
78
+ refused,
79
+ text: `${columnPlace(refused)}: the default ${JSON.stringify(refused.value)} is not a list, and the column holds a list of ${refused.dataType}`
80
+ };
81
+ }
82
+ /** Each literal default the column's type does not hold, under the column's parameters, element by element on a list column. A `null` is SQL NULL, which every column takes. */
83
+ function refusedDefaults(storage, dataTypes) {
84
+ return tablesOf(storage).flatMap(({ namespaceId, tableName, table }) => Object.entries(table.columns).flatMap(([columnName, column]) => {
85
+ const columnDefault = column.default;
86
+ if (columnDefault?.kind !== "literal") return [];
87
+ const type = dataTypes.get(column.dataType);
88
+ if (type === void 0) return [];
89
+ const params = dataTypeParams(type, resolvedTypeParams(column, storage.types));
90
+ if (refusesParams(type, params)) return [];
91
+ const place = {
92
+ namespaceId,
93
+ table: tableName,
94
+ column: columnName,
95
+ dataType: type.id
96
+ };
97
+ const isList = column.many !== void 0 && column.many !== false;
98
+ if (isList && columnDefault.value !== null && !Array.isArray(columnDefault.value)) return [notAList({
99
+ ...place,
100
+ value: columnDefault.value,
101
+ message: "The column holds a list, and the default is not one.",
102
+ reason: "type-refused-default"
103
+ })];
104
+ const listed = isList && Array.isArray(columnDefault.value);
105
+ const values = isList && Array.isArray(columnDefault.value) ? columnDefault.value : [columnDefault.value];
106
+ for (const [index, value] of values.entries()) {
107
+ if (value === null) continue;
108
+ try {
109
+ type.fromContract(value, params);
110
+ } catch (error) {
111
+ if (isInternalError(error)) throw error;
112
+ return [notAValue({
113
+ ...place,
114
+ value,
115
+ ...listed ? { elementIndex: index } : {},
116
+ message: error instanceof Error ? error.message : String(error),
117
+ reason: "type-refused-default"
118
+ })];
119
+ }
120
+ }
121
+ return [];
122
+ }));
123
+ }
55
124
  function valueObjectProblems(contract, authoring) {
56
125
  const storageTypeName = authoring.valueObjectStorageType;
57
126
  const expectedCodecId = storageTypeName === void 0 ? void 0 : collectScalarTypeConstructors(authoring.type).get(storageTypeName)?.codecId;
@@ -73,11 +142,16 @@ function valueObjectProblems(contract, authoring) {
73
142
  }));
74
143
  }
75
144
  /**
76
- * Checks a deserialized contract against the stack that loads it: each column's codec represents the data type the column names, and each value-object column uses the codec of the stack's value-object storage type.
145
+ * Checks a deserialized contract against the stack that loads it: each column's codec represents the data type the column names, each value-object column uses the codec of the stack's value-object storage type, and each literal default is a value of its column's type under the column's parameters.
77
146
  */
78
147
  function assertContractMatchesStack(contract, stack) {
79
- const problems = [...dataTypeProblems(contract.storage, stack.codecLookup), ...valueObjectProblems(contract, stack.authoringContributions)];
80
- if (problems.length > 0) throw new ContractValidationError(problems.join("; "), "storage");
148
+ const defaults = refusedDefaults(contract.storage, stack.dataTypes.lookup);
149
+ const problems = [
150
+ ...dataTypeProblems(contract.storage, stack.codecLookup),
151
+ ...valueObjectProblems(contract, stack.authoringContributions),
152
+ ...defaults.map(({ text }) => text)
153
+ ];
154
+ if (problems.length > 0) throw new ContractValidationError(problems.join("; "), "storage", defaults.length > 0 ? { refusedDefaults: defaults.map(({ refused }) => refused) } : void 0);
81
155
  }
82
156
  function isStorageDetails(details) {
83
157
  if (typeof details !== "object" || details === null) return false;
@@ -542,7 +616,7 @@ function createSqlFamilyInstance(stack) {
542
616
  async introspect(options) {
543
617
  return getControlAdapter().introspect(options.driver, options.contract);
544
618
  },
545
- inferPslContract(schemaIR) {
619
+ async inferPslContract(schemaIR) {
546
620
  if (!targetInferPslContract) throw sqlFamilyError("CONTRACT.INFER_UNSUPPORTED", `Target "${target.targetId}" does not support contract infer (no inferPslContract on its descriptor).`, {
547
621
  why: "The target descriptor does not provide the inferPslContract hook, so a PSL contract cannot be inferred from the database schema.",
548
622
  fix: "Use a target package that supports contract infer, or author the contract instead of inferring it.",
@@ -694,37 +768,67 @@ var SqlFamilyDescriptor = class {
694
768
  return createSqlFamilyInstance(stack);
695
769
  }
696
770
  };
697
- function convertColumn(name, column, storageTypes, types, renderDefault, resolveDefault) {
771
+ function convertColumn(name, column, storageTypes, types, hooks) {
698
772
  const resolved = resolveColumnTypeMetadata(column, storageTypes);
699
773
  const dataType = sqlDataTypeOfCodec(resolved.codecId, types);
700
- const codec = types.codecLookup.descriptorFor(resolved.codecId);
701
- const baseTypeName = unquotedSqlBaseName(dataType, dataTypeParams(dataType, resolved.typeParams));
702
- const baseNativeType = schemaTypeText(dataType, resolved.typeParams);
774
+ const storage = sqlStorageType(dataType, types.dataTypeLookup);
775
+ const baseTypeName = unquotedSqlBaseName(storage, dataTypeParams(storage, resolved.typeParams));
776
+ const baseNativeType = schemaTypeText(storage, resolved.typeParams);
703
777
  const nativeType = baseNativeType;
704
778
  const many = column.many !== void 0 && column.many !== false;
705
779
  const resolvedNativeType = many ? `${baseNativeType}[]` : baseNativeType;
706
780
  const rawColumnDefault = column.default ?? void 0;
707
- const resolvedColumnDefault = rawColumnDefault !== void 0 && resolveDefault ? resolveDefault(rawColumnDefault, resolvedNativeType) : rawColumnDefault;
781
+ const resolvedColumnDefault = rawColumnDefault !== void 0 && hooks.resolveDefault ? hooks.resolveDefault(rawColumnDefault, resolvedNativeType) : rawColumnDefault;
708
782
  return {
709
783
  name,
710
784
  nativeType,
711
785
  nullable: column.nullable,
712
786
  ...ifDefined("many", many ? true : void 0),
713
- ...ifDefined("default", column.default != null && renderDefault ? renderDefault(column.default, column, {
714
- dataType: dataType.id,
715
- baseTypeName
716
- }) : void 0),
717
787
  resolvedNativeType,
718
788
  ...ifDefined("resolvedDefault", resolvedColumnDefault),
719
789
  ...ifDefined("authoredDefault", rawColumnDefault),
720
790
  codecRef: buildColumnCodecRef(resolved, many ? true : void 0),
721
791
  codecBaseNativeType: baseTypeName,
722
792
  dataType,
723
- ...ifDefined("toCanonicalForm", codec && canonicalFormOf(codec, types.dataTypeLookup))
793
+ ...ifDefined("defaultValue", rawColumnDefault?.kind === "literal" && rawColumnDefault.value instanceof Date ? dateDefaultValue(rawColumnDefault.value, codecForRef(types.codecLookup, buildColumnCodecRef(resolved, void 0))) : contractDefaultValue(rawColumnDefault, dataType, dataTypeParams(dataType, resolved.typeParams), many))
724
794
  };
725
795
  }
726
796
  /**
727
- * The column's type as the database reports it: the written name with its normal-form parameters (`character(1)` for a bare `character`), or for a
797
+ * A `Date` default, which an in-memory contract can hold, as the value of the column's type the column's codec reads it as. `undefined` when the codec refuses it or no codec is registered, and the default then compares unequal to any other.
798
+ */
799
+ function dateDefaultValue(value, codec) {
800
+ if (codec === void 0) return void 0;
801
+ try {
802
+ return codec.toDataTypeValue(value);
803
+ } catch (error) {
804
+ if (isInternalError(error)) throw error;
805
+ return;
806
+ }
807
+ }
808
+ /**
809
+ * A literal default as a value of the column's type, read from the JSON the contract stores, element by element for a list column. A `null` is a value of a type that stores one, such as a JSON type, and SQL NULL otherwise, as DDL writes it. Loading a contract refuses a value its type does not hold, so a refusal here only means no value, and the comparison falls back to the stored JSON.
810
+ */
811
+ function contractDefaultValue(columnDefault, type, params, many) {
812
+ if (columnDefault?.kind !== "literal" || columnDefault.value instanceof Date) return void 0;
813
+ const stored = columnDefault.value;
814
+ const read = (json) => {
815
+ try {
816
+ return type.fromContract(json, params);
817
+ } catch (error) {
818
+ if (isStructuredError(error) && json === null) return null;
819
+ throw error;
820
+ }
821
+ };
822
+ try {
823
+ if (many && Array.isArray(stored)) return stored.map(read);
824
+ return read(stored) ?? void 0;
825
+ } catch (error) {
826
+ if (isStructuredError(error)) return void 0;
827
+ throw error;
828
+ }
829
+ }
830
+ /**
831
+ * The column's type as the database reports it, from the type it is stored as: the written name with its normal-form parameters (`character(1)` for a bare `character`), or for a
728
832
  * type that claims a kind (an enum), its type name as stored.
729
833
  */
730
834
  function schemaTypeText(type, typeParams) {
@@ -874,9 +978,9 @@ function withColumnInErrors(table, column, build) {
874
978
  });
875
979
  }
876
980
  }
877
- function convertTable(name, table, storageTypes, types, renderDefault, resolveDefault, storage) {
981
+ function convertTable(name, table, storageTypes, types, hooks, storage) {
878
982
  const columns = {};
879
- for (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = withColumnInErrors(name, colName, () => convertColumn(colName, colDef, storageTypes, types, renderDefault, resolveDefault));
983
+ for (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = withColumnInErrors(name, colName, () => convertColumn(colName, colDef, storageTypes, types, hooks));
880
984
  const checks = table.checks && table.checks.length > 0 ? table.checks.map((c) => convertCheck(c, name, Object.keys(table.columns))) : void 0;
881
985
  return new SqlTableIR({
882
986
  name,
@@ -958,7 +1062,7 @@ function contractNamespaceToSchemaIR(storage, namespaceId, options) {
958
1062
  const tables = {};
959
1063
  for (const [tableName, tableDefRaw] of Object.entries(namespace.entries.table ?? {})) {
960
1064
  StorageTable.assert(tableDefRaw, `namespaces.${namespaceId}.entries.table.${tableName}`);
961
- tables[tableName] = convertTable(tableName, tableDefRaw, storageTypes, options, options.renderDefault, options.resolveDefault, storage);
1065
+ tables[tableName] = convertTable(tableName, tableDefRaw, storageTypes, options, options, storage);
962
1066
  }
963
1067
  return new SqlSchemaIR({ tables });
964
1068
  }
@@ -993,7 +1097,7 @@ function contractToSchemaIR(contract, options) {
993
1097
  fix: "Rename one of the tables so every table name is unique across namespaces.",
994
1098
  meta: { table: tableName }
995
1099
  });
996
- tables[tableName] = convertTable(tableName, tableDef, storageTypes, options, options.renderDefault, options.resolveDefault, storage);
1100
+ tables[tableName] = convertTable(tableName, tableDef, storageTypes, options, options, storage);
997
1101
  }
998
1102
  return new SqlSchemaIR({ tables });
999
1103
  }
@@ -1176,7 +1280,7 @@ function planFieldEventCalls(options) {
1176
1280
  if (priorField === void 0 && newField !== void 0) added.push(entry);
1177
1281
  else if (priorField !== void 0 && newField === void 0) dropped.push(entry);
1178
1282
  else if (priorField !== void 0 && newField !== void 0) {
1179
- if (isAlteration(priorField, newField)) altered.push(entry);
1283
+ if (isAlteration(priorField, newField, options.dataTypes)) altered.push(entry);
1180
1284
  }
1181
1285
  }
1182
1286
  }
@@ -1252,13 +1356,13 @@ function buildContext(event, entry) {
1252
1356
  * For non-`codecId` diffs, returns `true` iff any other column property
1253
1357
  * differs.
1254
1358
  */
1255
- function isAlteration(prior, current) {
1359
+ function isAlteration(prior, current, dataTypes) {
1256
1360
  if (prior.codecId !== current.codecId) return false;
1257
- return !sameStorageColumn(prior, current);
1361
+ return !sameStorageColumn(prior, current, dataTypes);
1258
1362
  }
1259
- function sameStorageColumn(a, b) {
1363
+ function sameStorageColumn(a, b, dataTypes) {
1260
1364
  if (a === b) return true;
1261
- if (a.dataType !== b.dataType) return false;
1365
+ if (sqlStorageTypeId(a.dataType, dataTypes) !== sqlStorageTypeId(b.dataType, dataTypes)) return false;
1262
1366
  if (a.nullable !== b.nullable) return false;
1263
1367
  if (a.typeRef !== b.typeRef) return false;
1264
1368
  if (!sameJson(a.typeParams, b.typeParams)) return false;
@@ -2378,6 +2482,108 @@ function unconvertedFieldOf(step, contract) {
2378
2482
  const converted = convertedColumnOf(step);
2379
2483
  return converted === void 0 ? void 0 : fieldOfColumn(contract, converted.table, converted.column);
2380
2484
  }
2485
+ /** Reads a reported literal default with the column's codec. `raw` is the reported text, which a refusal quotes. */
2486
+ async function readReportedDefault(codec, literal, raw) {
2487
+ const unreadable = (error, element) => {
2488
+ if (isInternalError(error)) throw error;
2489
+ const reason = error instanceof Error ? error.message : String(error);
2490
+ return { defaultUnreadable: `The column codec ${codec.id} cannot read ${element}the default the database reports, ${raw}: ${reason}` };
2491
+ };
2492
+ if (literal.kind === "value") try {
2493
+ const value = await readBody(codec, literal.body);
2494
+ return {
2495
+ resolvedDefault: {
2496
+ kind: "literal",
2497
+ value: codec.dataType.toContract(value)
2498
+ },
2499
+ defaultValue: value
2500
+ };
2501
+ } catch (error) {
2502
+ return unreadable(error, "");
2503
+ }
2504
+ const values = [];
2505
+ for (const [index, body] of literal.elements.entries()) try {
2506
+ values.push(body === null ? null : await readBody(codec, body));
2507
+ } catch (error) {
2508
+ return unreadable(error, `element ${index + 1} of `);
2509
+ }
2510
+ return {
2511
+ resolvedDefault: {
2512
+ kind: "literal",
2513
+ value: values.map((value) => value === null ? null : codec.dataType.toContract(value))
2514
+ },
2515
+ defaultValue: values
2516
+ };
2517
+ }
2518
+ /**
2519
+ * Reads a reported literal default with the column's codec, and, when the contract's default is an expression that writes a literal, that literal too, so the diff compares the two as values.
2520
+ */
2521
+ async function readColumnDefault(codec, reported, written) {
2522
+ const read = await readReportedDefault(codec, reported.literal, reported.raw);
2523
+ if (written === void 0 || !("defaultValue" in read)) return read;
2524
+ const writtenRead = await readReportedDefault(codec, written.literal, written.expression);
2525
+ return "defaultValue" in writtenRead ? {
2526
+ ...read,
2527
+ defaultExpressionValue: writtenRead.defaultValue
2528
+ } : read;
2529
+ }
2530
+ async function readBody(codec, body) {
2531
+ return codec.toDataTypeValue(await codec.fromWire(body, {}));
2532
+ }
2533
+ function isLoose(value) {
2534
+ return typeof value === "object" && value !== null;
2535
+ }
2536
+ function child(value, key) {
2537
+ if (!isLoose(value)) return void 0;
2538
+ const found = value[key];
2539
+ return isLoose(found) ? found : void 0;
2540
+ }
2541
+ /**
2542
+ * The columns `contract` declares. `contract` is a contract, or the namespaces of several contract spaces merged with each space's contract under `contracts`, as multi-space introspection receives them; a table's named types are then those of the space that declares it.
2543
+ */
2544
+ function contractColumns(contract) {
2545
+ const contracts = isLoose(contract) && Array.isArray(contract["contracts"]) ? contract["contracts"] : [contract];
2546
+ return { columnOf(namespaceIds, table, column) {
2547
+ for (const space of contracts) {
2548
+ const storage = child(space, "storage");
2549
+ const namespaces = child(storage, "namespaces");
2550
+ if (namespaces === void 0) continue;
2551
+ for (const id of namespaceIds ?? Object.keys(namespaces)) {
2552
+ const found = child(child(child(child(child(child(namespaces, id), "entries"), "table"), table), "columns"), column);
2553
+ const codecId = found?.["codecId"];
2554
+ if (found === void 0 || typeof codecId !== "string") continue;
2555
+ const columnDefault = child(found, "default");
2556
+ const expression = columnDefault?.["expression"];
2557
+ return {
2558
+ codecRef: columnCodecRef(codecId, found, child(storage, "types")),
2559
+ defaultExpression: columnDefault?.["kind"] === "function" && typeof expression === "string" ? expression : void 0
2560
+ };
2561
+ }
2562
+ }
2563
+ } };
2564
+ }
2565
+ function columnCodecRef(codecId, column, namedTypes) {
2566
+ const typeRef = column["typeRef"];
2567
+ const typeParams = column["typeParams"];
2568
+ const params = resolvedTypeParams({
2569
+ typeParams: isLoose(typeParams) ? typeParams : void 0,
2570
+ typeRef: typeof typeRef === "string" ? typeRef : void 0
2571
+ }, namedTypesOf(namedTypes));
2572
+ const many = column["many"];
2573
+ return {
2574
+ codecId,
2575
+ ...ifDefined("typeParams", params === void 0 ? void 0 : blindCast(params)),
2576
+ ...ifDefined("many", many !== void 0 && many !== false ? true : void 0)
2577
+ };
2578
+ }
2579
+ function namedTypesOf(namedTypes) {
2580
+ const result = {};
2581
+ for (const [name, entry] of Object.entries(namedTypes ?? {})) {
2582
+ const typeParams = child(entry, "typeParams");
2583
+ result[name] = typeParams === void 0 ? {} : { typeParams };
2584
+ }
2585
+ return result;
2586
+ }
2381
2587
  function temporalStringAuthoringPresets(input) {
2382
2588
  const presets = temporalAuthoringPresets(input);
2383
2589
  return {
@@ -2425,6 +2631,6 @@ function temporalCodecPresetWithPrecision(input) {
2425
2631
  }
2426
2632
  var control_default = new SqlFamilyDescriptor();
2427
2633
  //#endregion
2428
- export { plannerFailure as A, runnerSuccess as B, isUnfilledSlot as C, planFieldEventCalls as D, partitionIssuesByControlPolicy as E, resolveColumnRenameAgainst as F, subjectsOfCalls as G, sqlOfSlot as H, resolveTableRenameAgainst as I, unconvertedFieldOf as J, temporalCodecPresetWithPrecision as K, rowsWithoutValueFailure as L, requiredColumnMeta as M, requiredColumnOf as N, planFieldEventOperations as O, requiredColumnsOfMigration as P, rowsWithoutValueSummary as R, fieldStatementColumns as S, partitionCallsByControlPolicy as T, sqlTypeLookupsOf as U, slotSource as V, storageNameOfOperation as W, unmatchedColumnRename as X, unknownCallNames as Y, unmatchedTableRename as Z, detectDestructiveChanges as _, assembleAuthoringContributions as a, fieldOfColumn as b, columnTakesTemporaryValue as c, controlPolicyForCall as d, control_default as f, createSqlTextSources as g, createMigrationPlan as h, appliedStatementsInOrder as i, plannerSuccess as j, planStatements as k, contractNamespaceToSchemaIR as l, convertedColumnOf as m, INIT_ADDITIVE_POLICY as n, backfillOfDefaultedField as o, convertedColumnMeta as p, temporalStringAuthoringPresets as q, TABLE_NAME_CASE_CHANGED_CODE as r, checkSqlExpressionText as s, COLUMN_RENAME_UNMATCHED_CODE as t, contractToSchemaIR as u, detectTableNameCaseChanges as v, modelRenameStorageEffect as w, fieldRenameStorageEffect as x, fieldEventStorage as y, runnerFailure as z };
2634
+ export { unmatchedColumnRename as $, planStatements as A, rowsWithoutValueFailure as B, fieldStatementColumns as C, partitionIssuesByControlPolicy as D, partitionCallsByControlPolicy as E, requiredColumnMeta as F, sqlOfSlot as G, runnerFailure as H, requiredColumnOf as I, subjectsOfCalls as J, sqlTypeLookupsOf as K, requiredColumnsOfMigration as L, plannerSuccess as M, readColumnDefault as N, planFieldEventCalls as O, readReportedDefault as P, unknownCallNames as Q, resolveColumnRenameAgainst as R, fieldRenameStorageEffect as S, modelRenameStorageEffect as T, runnerSuccess as U, rowsWithoutValueSummary as V, slotSource as W, temporalStringAuthoringPresets as X, temporalCodecPresetWithPrecision as Y, unconvertedFieldOf as Z, createSqlTextSources as _, assembleAuthoringContributions as a, fieldEventStorage as b, columnTakesTemporaryValue as c, contractToSchemaIR as d, unmatchedTableRename as et, controlPolicyForCall as f, createMigrationPlan as g, convertedColumnOf as h, appliedStatementsInOrder as i, plannerFailure as j, planFieldEventOperations as k, contractColumns as l, convertedColumnMeta as m, INIT_ADDITIVE_POLICY as n, backfillOfDefaultedField as o, control_default as p, storageNameOfOperation as q, TABLE_NAME_CASE_CHANGED_CODE as r, checkSqlExpressionText as s, COLUMN_RENAME_UNMATCHED_CODE as t, contractNamespaceToSchemaIR as u, detectDestructiveChanges as v, isUnfilledSlot as w, fieldOfColumn as x, detectTableNameCaseChanges as y, resolveTableRenameAgainst as z };
2429
2635
 
2430
- //# sourceMappingURL=control-DXqMl_gd.mjs.map
2636
+ //# sourceMappingURL=control-ClahTAD-.mjs.map