@prisma/orm-family-sql 8.0.0-rc.1-dev.45 → 8.0.0-rc.10

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 (233) hide show
  1. package/README.md +2 -6
  2. package/dist/{aggregate-descriptor-registry-CTo0ry7h.mjs → aggregate-descriptor-registry-C7hel5O7.mjs} +2 -2
  3. package/dist/{aggregate-descriptor-registry-CTo0ry7h.mjs.map → aggregate-descriptor-registry-C7hel5O7.mjs.map} +1 -1
  4. package/dist/{ast-BJdOHZrL.mjs → ast-5tg0fGPQ.mjs} +3 -59
  5. package/dist/ast-5tg0fGPQ.mjs.map +1 -0
  6. package/dist/{ast-D8qqdDX_.d.mts → ast-DuLukI6f.d.mts} +4 -36
  7. package/dist/ast-DuLukI6f.d.mts.map +1 -0
  8. package/dist/{authored-check-naming-Hf9990DV.mjs → authored-check-naming-BEvfamnI.mjs} +2 -2
  9. package/dist/{authored-check-naming-Hf9990DV.mjs.map → authored-check-naming-BEvfamnI.mjs.map} +1 -1
  10. package/dist/{authoring-type-constructors-Blqoa2Ua-CvHn00xx.mjs → authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs} +10 -4
  11. package/dist/authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs.map +1 -0
  12. package/dist/builder.d.mts +3 -3
  13. package/dist/builder__runtime.d.mts +26 -9
  14. package/dist/builder__runtime.d.mts.map +1 -1
  15. package/dist/builder__runtime.mjs +32 -6
  16. package/dist/builder__runtime.mjs.map +1 -1
  17. package/dist/builder__types.d.mts +3 -3
  18. package/dist/{codec-descriptor-registry-N0dhtKaH.mjs → codec-descriptor-registry-ECZ4ohtG.mjs} +2 -2
  19. package/dist/{codec-descriptor-registry-N0dhtKaH.mjs.map → codec-descriptor-registry-ECZ4ohtG.mjs.map} +1 -1
  20. package/dist/{config-types-B6cQRwJw.mjs → config-types-BNJgLUUQ.mjs} +2 -2
  21. package/dist/{config-types-B6cQRwJw.mjs.map → config-types-BNJgLUUQ.mjs.map} +1 -1
  22. package/dist/{config-types-D9fdKG3g.d.mts → config-types-Bd3ud-mX.d.mts} +3 -3
  23. package/dist/{config-types-D9fdKG3g.d.mts.map → config-types-Bd3ud-mX.d.mts.map} +1 -1
  24. package/dist/{contract-builder-vdfvmuiO.mjs → contract-builder-BOmEsrRi.mjs} +24 -5
  25. package/dist/contract-builder-BOmEsrRi.mjs.map +1 -0
  26. package/dist/{contract-builder-CG_tGDbB.d.mts → contract-builder-De_sioHE.d.mts} +15 -3
  27. package/dist/contract-builder-De_sioHE.d.mts.map +1 -0
  28. package/dist/contract-emitter.mjs +1 -1
  29. package/dist/contract-psl.d.mts +1 -1
  30. package/dist/contract-psl.mjs +1 -1
  31. package/dist/contract-psl__attribute-specs.d.mts +77 -0
  32. package/dist/contract-psl__attribute-specs.d.mts.map +1 -0
  33. package/dist/contract-psl__attribute-specs.mjs +2 -0
  34. package/dist/contract-psl__provider.d.mts +1 -1
  35. package/dist/contract-psl__provider.mjs +3 -3
  36. package/dist/contract-psl__provider.mjs.map +1 -1
  37. package/dist/contract-ts.d.mts +3 -3
  38. package/dist/contract-ts.mjs +3 -3
  39. package/dist/contract-ts__config-types.d.mts +1 -1
  40. package/dist/contract-ts__config-types.mjs +1 -1
  41. package/dist/contract-ts__contract-builder.d.mts +2 -2
  42. package/dist/contract-ts__contract-builder.mjs +2 -2
  43. package/dist/contract.d.mts +4 -4
  44. package/dist/contract.mjs +6 -6
  45. package/dist/contract__authored-check-naming.mjs +1 -1
  46. package/dist/contract__foreign-key-materialization.d.mts +1 -1
  47. package/dist/contract__foreign-key-materialization.mjs +1 -1
  48. package/dist/contract__index-naming.mjs +1 -1
  49. package/dist/contract__types.d.mts +2 -2
  50. package/dist/contract__types.mjs +2 -2
  51. package/dist/contract__validators.d.mts +2 -2
  52. package/dist/contract__validators.mjs +2 -2
  53. package/dist/{control-DAkNosoF.mjs → control-BIIMOKMy.mjs} +11 -9
  54. package/dist/control-BIIMOKMy.mjs.map +1 -0
  55. package/dist/{control-adapter-C99J7aEF-Vx9xXYOy.d.mts → control-adapter-C99J7aEF-GODO43Ai.d.mts} +5 -5
  56. package/dist/{control-adapter-C99J7aEF-Vx9xXYOy.d.mts.map → control-adapter-C99J7aEF-GODO43Ai.d.mts.map} +1 -1
  57. package/dist/control-adapter-DzTFiMaG.d.mts +1 -0
  58. package/dist/{control-DssujEJW.d.mts → control-b-6t8eI_.d.mts} +138 -19
  59. package/dist/control-b-6t8eI_.d.mts.map +1 -0
  60. package/dist/{db-C5jmOFPM-Cd-fni61.d.mts → db-BhQdL6Za-DubRGJvv.d.mts} +161 -9
  61. package/dist/db-BhQdL6Za-DubRGJvv.d.mts.map +1 -0
  62. package/dist/{ddl-types-BtT82FGO-Du_-9SlZ.d.mts → ddl-types-CXx4vPz6-Dko-GTTj.d.mts} +4 -4
  63. package/dist/{ddl-types-BtT82FGO-Du_-9SlZ.d.mts.map → ddl-types-CXx4vPz6-Dko-GTTj.d.mts.map} +1 -1
  64. package/dist/{derived-checks-DFMRmiAu-8jmha26I.mjs → derived-checks-DGjY5t7S-B3txNm7X.mjs} +48 -15
  65. package/dist/derived-checks-DGjY5t7S-B3txNm7X.mjs.map +1 -0
  66. package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts → derived-checks-DPdD01O0-DNBs1ZDA.d.mts} +2 -2
  67. package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts.map → derived-checks-DPdD01O0-DNBs1ZDA.d.mts.map} +1 -1
  68. package/dist/{diff-pl1Xal4J.d.mts → diff-CN1ou7vM.d.mts} +5 -5
  69. package/dist/{diff-pl1Xal4J.d.mts.map → diff-CN1ou7vM.d.mts.map} +1 -1
  70. package/dist/{dist-ZK6oeI5e.mjs → dist-D5__KJs-.mjs} +2 -1
  71. package/dist/dist-D5__KJs-.mjs.map +1 -0
  72. package/dist/{expression-D30W-gkF.mjs → expression-B2Ox7zKM.mjs} +59 -16
  73. package/dist/expression-B2Ox7zKM.mjs.map +1 -0
  74. package/dist/{expression-Q_yaDQPb.d.mts → expression-mku9I7Ue.d.mts} +108 -8
  75. package/dist/expression-mku9I7Ue.d.mts.map +1 -0
  76. package/dist/family.d.mts +10 -10
  77. package/dist/family.mjs +8 -8
  78. package/dist/family__control-adapter.d.mts +2 -2
  79. package/dist/family__control.d.mts +4 -4
  80. package/dist/family__control.mjs +4 -4
  81. package/dist/family__diff.d.mts +2 -2
  82. package/dist/family__diff.mjs +1 -1
  83. package/dist/family__ir.d.mts +1 -1
  84. package/dist/family__ir.mjs +1 -1
  85. package/dist/family__migration.d.mts +1 -1
  86. package/dist/family__pack.d.mts +72 -0
  87. package/dist/family__pack.d.mts.map +1 -1
  88. package/dist/family__pack.mjs +4 -2
  89. package/dist/family__pack.mjs.map +1 -1
  90. package/dist/family__psl-infer.mjs +1 -1
  91. package/dist/family__runtime.d.mts +1 -1
  92. package/dist/family__runtime.mjs +1 -1
  93. package/dist/family__verify.mjs +1 -1
  94. package/dist/{foreign-key-materialization-DLOi1Ps0.mjs → foreign-key-materialization-0TrwfShD.mjs} +7 -6
  95. package/dist/foreign-key-materialization-0TrwfShD.mjs.map +1 -0
  96. package/dist/{foreign-key-materialization-DO9dvG7v.d.mts → foreign-key-materialization-CkvOzJWy.d.mts} +4 -4
  97. package/dist/{foreign-key-materialization-DO9dvG7v.d.mts.map → foreign-key-materialization-CkvOzJWy.d.mts.map} +1 -1
  98. package/dist/{index-C5I8D-MB.d.mts → index-CLAshwKN.d.mts} +2 -2
  99. package/dist/{index-C5I8D-MB.d.mts.map → index-CLAshwKN.d.mts.map} +1 -1
  100. package/dist/{index-DIHXLCbY.d.mts → index-DzBzeTAy.d.mts} +10 -10
  101. package/dist/{index-DIHXLCbY.d.mts.map → index-DzBzeTAy.d.mts.map} +1 -1
  102. package/dist/{index-naming-DREt6js7-CRH27yUv.mjs → index-naming-fQMLqyC4-4FzPVtCR.mjs} +4 -4
  103. package/dist/index-naming-fQMLqyC4-4FzPVtCR.mjs.map +1 -0
  104. package/dist/{interpreter-DaBA2fm--FFkq_gGd.mjs → interpreter-CZ_iVQV4-CJ6COgSE.mjs} +125 -304
  105. package/dist/interpreter-CZ_iVQV4-CJ6COgSE.mjs.map +1 -0
  106. package/dist/ir-I-xciGUH.mjs.map +1 -1
  107. package/dist/{ir-Bghjt-FG.d.mts → ir-R9GE8gsm.d.mts} +2 -2
  108. package/dist/{ir-Bghjt-FG.d.mts.map → ir-R9GE8gsm.d.mts.map} +1 -1
  109. package/dist/{middleware-BS7u8VFR-DyUcAFid.d.mts → middleware-AhTz1BOW-CtQWS4mb.d.mts} +3 -3
  110. package/dist/{middleware-BS7u8VFR-DyUcAFid.d.mts.map → middleware-AhTz1BOW-CtQWS4mb.d.mts.map} +1 -1
  111. package/dist/middleware-Cev-ZFyS.d.mts +1 -0
  112. package/dist/{migration-CGlaINey.d.mts → migration-Bhce5i_m.d.mts} +3 -3
  113. package/dist/{migration-CGlaINey.d.mts.map → migration-Bhce5i_m.d.mts.map} +1 -1
  114. package/dist/operations.d.mts +1 -1
  115. package/dist/orm-client.d.mts +131 -95
  116. package/dist/orm-client.d.mts.map +1 -1
  117. package/dist/orm-client.mjs +1022 -943
  118. package/dist/orm-client.mjs.map +1 -1
  119. package/dist/plan-C7VP7jOh.d.mts +2 -0
  120. package/dist/{plan-BC_trt1i-In5gOKCT.d.mts → plan-CDxduYaN-B2kMLIQQ.d.mts} +10 -9
  121. package/dist/plan-CDxduYaN-B2kMLIQQ.d.mts.map +1 -0
  122. package/dist/{plan-CkpcgUaM.mjs → plan-Dh0LbYIv-Crx5-ThG.mjs} +8 -7
  123. package/dist/plan-Dh0LbYIv-Crx5-ThG.mjs.map +1 -0
  124. package/dist/prepared-query-BJr50wPm-ChoqfJbX.mjs +22 -0
  125. package/dist/prepared-query-BJr50wPm-ChoqfJbX.mjs.map +1 -0
  126. package/dist/{prepared-statement-z9bBbTph-BlzhaRTY.d.mts → prepared-statement-9QpkE6JG-B9xqBu5T.d.mts} +85 -20
  127. package/dist/prepared-statement-9QpkE6JG-B9xqBu5T.d.mts.map +1 -0
  128. package/dist/{psl-infer-YhbKkybN.mjs → psl-infer-TBwKfKgU.mjs} +2 -2
  129. package/dist/{psl-infer-YhbKkybN.mjs.map → psl-infer-TBwKfKgU.mjs.map} +1 -1
  130. package/dist/query-lane-context-CGdMIEuv.d.mts +1 -0
  131. package/dist/{query-lane-context-gwWUcacE-DdWNrc8q.d.mts → query-lane-context-Qa-eddrE-BQV6J9nV.d.mts} +5 -5
  132. package/dist/{query-lane-context-gwWUcacE-DdWNrc8q.d.mts.map → query-lane-context-Qa-eddrE-BQV6J9nV.d.mts.map} +1 -1
  133. package/dist/relational-core.d.mts +12 -12
  134. package/dist/relational-core.mjs +5 -5
  135. package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
  136. package/dist/relational-core__aggregate-descriptor-registry.mjs +1 -1
  137. package/dist/relational-core__ast.d.mts +4 -4
  138. package/dist/relational-core__ast.mjs +3 -3
  139. package/dist/relational-core__codec-descriptor-registry.d.mts +3 -3
  140. package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
  141. package/dist/relational-core__contract-free.d.mts +3 -3
  142. package/dist/relational-core__contract-free.mjs +1 -1
  143. package/dist/relational-core__contract-free.mjs.map +1 -1
  144. package/dist/relational-core__expression.d.mts +2 -2
  145. package/dist/relational-core__expression.mjs +1 -1
  146. package/dist/relational-core__middleware.d.mts +2 -2
  147. package/dist/relational-core__plan.d.mts +3 -3
  148. package/dist/relational-core__plan.mjs +1 -1
  149. package/dist/relational-core__query-lane-context.d.mts +2 -2
  150. package/dist/relational-core__types.d.mts +3 -3
  151. package/dist/{runtime-cPrAp99G.d.mts → runtime-CzCx0TKe.d.mts} +3 -3
  152. package/dist/{runtime-cPrAp99G.d.mts.map → runtime-CzCx0TKe.d.mts.map} +1 -1
  153. package/dist/{runtime-tIHpGCcG.mjs → runtime-PknWErjr.mjs} +2 -2
  154. package/dist/{runtime-tIHpGCcG.mjs.map → runtime-PknWErjr.mjs.map} +1 -1
  155. package/dist/runtime.d.mts +5 -5
  156. package/dist/runtime.mjs +145 -18
  157. package/dist/runtime.mjs.map +1 -1
  158. package/dist/runtime__internal__prepared-query.d.mts +2 -2
  159. package/dist/runtime__internal__prepared-query.mjs +2 -2
  160. package/dist/{schema-differ-DpG_gnur-DFAtGezx.d.mts → schema-differ-DpG_gnur-BICVtTHY.d.mts} +2 -2
  161. package/dist/{schema-differ-DpG_gnur-DFAtGezx.d.mts.map → schema-differ-DpG_gnur-BICVtTHY.d.mts.map} +1 -1
  162. package/dist/schema-ir.mjs +1 -1
  163. package/dist/schema-ir__types.mjs +1 -1
  164. package/dist/{schema-verify-C_PEdlAr-Dxxjm6EM.mjs → schema-verify-C_PEdlAr-CmXrFuW1.mjs} +2 -2
  165. package/dist/{schema-verify-C_PEdlAr-Dxxjm6EM.mjs.map → schema-verify-C_PEdlAr-CmXrFuW1.mjs.map} +1 -1
  166. package/dist/sql-attribute-specs-CG0yitvD-CG-0eW98.mjs +275 -0
  167. package/dist/sql-attribute-specs-CG0yitvD-CG-0eW98.mjs.map +1 -0
  168. package/dist/{sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs → sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs} +24 -5
  169. package/dist/sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs.map +1 -0
  170. package/dist/{sql-execution-plan-D0ZTnszb-DnCRtfQO.d.mts → sql-execution-plan--jKyLpe5-Bcz9QM2s.d.mts} +5 -6
  171. package/dist/sql-execution-plan--jKyLpe5-Bcz9QM2s.d.mts.map +1 -0
  172. package/dist/{timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs → timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs} +27 -19
  173. package/dist/timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs.map +1 -0
  174. package/dist/{types-4YenawkP-CwaaZSid.mjs → types-BvupgHcG-c8QDupnu.mjs} +13 -6
  175. package/dist/types-BvupgHcG-c8QDupnu.mjs.map +1 -0
  176. package/dist/{types-UcHa2cTe.d.mts → types-C36_3E6_.d.mts} +3 -2
  177. package/dist/types-C36_3E6_.d.mts.map +1 -0
  178. package/dist/{types-C9FZXc9Q-C6LM1k-O.d.mts → types-CyxGtOOh-BJnoWm0f.d.mts} +10 -21
  179. package/dist/{types-C9FZXc9Q-C6LM1k-O.d.mts.map → types-CyxGtOOh-BJnoWm0f.d.mts.map} +1 -1
  180. package/dist/{types-CUsJrvEl.mjs → types-D0B65hip.mjs} +3 -2
  181. package/dist/types-D0B65hip.mjs.map +1 -0
  182. package/dist/{types-B7_v-z12-De5tf8LE.mjs → types-Dt4e_jC--COeP8xzN.mjs} +68 -28
  183. package/dist/{types-B7_v-z12-De5tf8LE.mjs.map → types-Dt4e_jC--COeP8xzN.mjs.map} +1 -1
  184. package/dist/types-DvsoMNLs.d.mts +1 -0
  185. package/dist/{types-IqZMLrFC-B0YziCVx.d.mts → types-IqZMLrFC-BIRftuU7.d.mts} +4 -4
  186. package/dist/{types-IqZMLrFC-B0YziCVx.d.mts.map → types-IqZMLrFC-BIRftuU7.d.mts.map} +1 -1
  187. package/dist/{types-DH6Sqzxu-DfzaLX0o.d.mts → types-v3qxLLxo-Clw_yBAh.d.mts} +44 -23
  188. package/dist/{types-DH6Sqzxu-DfzaLX0o.d.mts.map → types-v3qxLLxo-Clw_yBAh.d.mts.map} +1 -1
  189. package/dist/{validators-Belo8QqM.d.mts → validators-CbqMxQfW.d.mts} +23 -4
  190. package/dist/validators-CbqMxQfW.d.mts.map +1 -0
  191. package/dist/{validators-CrWD6bSP.mjs → validators-DD98VrpC.mjs} +0 -0
  192. package/dist/validators-DD98VrpC.mjs.map +1 -0
  193. package/dist/{verify-u0UTdZgD-DSAaz9rW.mjs → verify-ChiDeTk8-HEewdjrM.mjs} +3 -3
  194. package/dist/verify-ChiDeTk8-HEewdjrM.mjs.map +1 -0
  195. package/package.json +20 -21
  196. package/dist/ast-BJdOHZrL.mjs.map +0 -1
  197. package/dist/ast-D8qqdDX_.d.mts.map +0 -1
  198. package/dist/authoring-type-constructors-Blqoa2Ua-CvHn00xx.mjs.map +0 -1
  199. package/dist/contract-builder-CG_tGDbB.d.mts.map +0 -1
  200. package/dist/contract-builder-vdfvmuiO.mjs.map +0 -1
  201. package/dist/control-DAkNosoF.mjs.map +0 -1
  202. package/dist/control-DssujEJW.d.mts.map +0 -1
  203. package/dist/control-adapter-CLID4Q6Z.d.mts +0 -1
  204. package/dist/db-C5jmOFPM-Cd-fni61.d.mts.map +0 -1
  205. package/dist/derived-checks-DFMRmiAu-8jmha26I.mjs.map +0 -1
  206. package/dist/dist-ZK6oeI5e.mjs.map +0 -1
  207. package/dist/expression-D30W-gkF.mjs.map +0 -1
  208. package/dist/expression-Q_yaDQPb.d.mts.map +0 -1
  209. package/dist/foreign-key-materialization-DLOi1Ps0.mjs.map +0 -1
  210. package/dist/index-naming-DREt6js7-CRH27yUv.mjs.map +0 -1
  211. package/dist/interpreter-DaBA2fm--FFkq_gGd.mjs.map +0 -1
  212. package/dist/lane-query-builder.d.mts +0 -236
  213. package/dist/lane-query-builder.d.mts.map +0 -1
  214. package/dist/lane-query-builder.mjs +0 -67
  215. package/dist/lane-query-builder.mjs.map +0 -1
  216. package/dist/middleware-Cy_OqpBi.d.mts +0 -1
  217. package/dist/plan-BC_trt1i-In5gOKCT.d.mts.map +0 -1
  218. package/dist/plan-CkpcgUaM.mjs.map +0 -1
  219. package/dist/plan-DrOMooQt.d.mts +0 -2
  220. package/dist/prepared-query-BDLztUzY-CaDR0Rqc.mjs +0 -14
  221. package/dist/prepared-query-BDLztUzY-CaDR0Rqc.mjs.map +0 -1
  222. package/dist/prepared-statement-z9bBbTph-BlzhaRTY.d.mts.map +0 -1
  223. package/dist/query-lane-context-D62vkQhf.d.mts +0 -1
  224. package/dist/sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs.map +0 -1
  225. package/dist/sql-execution-plan-D0ZTnszb-DnCRtfQO.d.mts.map +0 -1
  226. package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map +0 -1
  227. package/dist/types-0c4HyrXd.d.mts +0 -1
  228. package/dist/types-4YenawkP-CwaaZSid.mjs.map +0 -1
  229. package/dist/types-CUsJrvEl.mjs.map +0 -1
  230. package/dist/types-UcHa2cTe.d.mts.map +0 -1
  231. package/dist/validators-Belo8QqM.d.mts.map +0 -1
  232. package/dist/validators-CrWD6bSP.mjs.map +0 -1
  233. package/dist/verify-u0UTdZgD-DSAaz9rW.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { l as isStorageTypeInstance } from "./types-CUsJrvEl.mjs";
1
+ import { u as isStorageTypeInstance } from "./types-D0B65hip.mjs";
2
2
  import { effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
3
3
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
@@ -217,4 +217,4 @@ function verifySqlSchemaByDiff(input) {
217
217
  //#endregion
218
218
  export { computeStorageTypeVerdict as a, computeSqlDiffVerdict as i, classifyDiffSubjectGranularity as n, extractCodecControlHooks as o, classifySqlDiffIssue as r, verifySqlSchemaByDiff as s, classifyDiffEntityKind as t };
219
219
 
220
- //# sourceMappingURL=schema-verify-C_PEdlAr-Dxxjm6EM.mjs.map
220
+ //# sourceMappingURL=schema-verify-C_PEdlAr-CmXrFuW1.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-verify-C_PEdlAr-Dxxjm6EM.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/schema-verify-C_PEdlAr.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { assertUniqueCodecOwner, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { isStorageTypeInstance } from \"@internal/sql-contract/types\";\n//#region src/core/assembly.ts\nfunction hasCodecControlHooks(descriptor) {\n\tif (typeof descriptor !== \"object\" || descriptor === null) return false;\n\tconst hooks = descriptor.types?.codecTypes?.controlPlaneHooks;\n\treturn hooks !== null && hooks !== void 0 && typeof hooks === \"object\";\n}\nfunction extractCodecControlHooks(descriptors) {\n\tconst hooks = /* @__PURE__ */ new Map();\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tif (typeof descriptor !== \"object\" || descriptor === null) continue;\n\t\tif (!hasCodecControlHooks(descriptor)) continue;\n\t\tconst controlPlaneHooks = descriptor.types.codecTypes.controlPlaneHooks;\n\t\tfor (const [codecId, hook] of Object.entries(controlPlaneHooks)) {\n\t\t\tassertUniqueCodecOwner({\n\t\t\t\tcodecId,\n\t\t\t\towners,\n\t\t\t\tdescriptorId: descriptor.id,\n\t\t\t\tentityLabel: \"control hooks\",\n\t\t\t\tentityOwnershipLabel: \"owner\"\n\t\t\t});\n\t\t\thooks.set(codecId, hook);\n\t\t\towners.set(codecId, descriptor.id);\n\t\t}\n\t}\n\treturn hooks;\n}\n//#endregion\n//#region src/core/diff/verifier-disposition.ts\n/**\n* Classifies a codec `verifyType` hook finding into the target-neutral\n* categories the framework grades. A storage type is a named type instance\n* (e.g. a native enum); the only shape divergence it can carry is a change\n* to its value set, so a paired mismatch always classifies as `valueDrift`.\n*/\nfunction classifyStorageTypeDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return \"extraAuxiliary\";\n\treturn \"valueDrift\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyStorageTypeDiffIssue(issue));\n}\n//#endregion\n//#region src/core/diff/schema-verify.ts\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/**\n* Resolves an issue's framework-neutral {@link DiffSubjectGranularity} on\n* demand, from the issue's node's `nodeKind` via the target-provided\n* `granularityOf` map. The node carries only its `nodeKind` identity, never a\n* classification, and nothing is stamped onto the issue — every consumer\n* (the family verdict below, the framework aggregate's unclaimed-elements\n* sweep via {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable})\n* calls this the same way, resolved by the family/target that owns the node\n* vocabulary. `undefined` for an issue with no node.\n*/\nfunction classifyDiffSubjectGranularity(issue, granularityOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : granularityOf(node.nodeKind);\n}\n/**\n* Resolves an issue's storage `entityKind` on demand, from the issue's\n* node's `nodeKind` via the target-provided `entityKindOf` map — the sibling\n* of {@link classifyDiffSubjectGranularity}, called the same way by the same\n* consumers (via\n* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}).\n* `undefined` for an issue with no node, or for a node kind with no storage\n* entity of its own.\n*/\nfunction classifyDiffEntityKind(issue, entityKindOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : entityKindOf(node.nodeKind);\n}\n/**\n* Re-keys the legacy `classifySqlVerifierIssueKind` category mapping on the\n* issue's {@link DiffSubjectGranularity} (resolved via `granularityOf`) + the\n* issue reason. The vocabulary maps one-to-one: an undeclared live entity or\n* namespace is `extraTopLevelObject`, an undeclared live field\n* `extraNestedElement`, undeclared auxiliaries (constraints, indexes,\n* defaults) and structural leaves (policies) `extraAuxiliary`; every paired\n* divergence is `declaredIncompatible`; anything the database lacks is\n* `declaredMissing`.\n* `granularityOf` is the target's classifier, so target and extension node\n* kinds classify without the family importing them.\n*/\nfunction classifySqlDiffIssue(issue, granularityOf) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\t\tif (granularity === \"entity\" || granularity === \"namespace\") return \"extraTopLevelObject\";\n\t\tif (granularity === \"field\") return \"extraNestedElement\";\n\t\treturn \"extraAuxiliary\";\n\t}\n\treturn \"declaredIncompatible\";\n}\n/**\n* Whether a `not-expected` issue is a strict-mode-only finding. The legacy\n* walk detected every relational extra (namespaces, entities, fields, and\n* their auxiliaries) only under `--strict`; the structural diff (roots, RLS\n* policies, roles) was never strict-gated — its extras fail in both modes.\n* Keyed on the issue's granularity, resolved via `granularityOf`.\n*/\nfunction isStrictOnlyExtra(issue, granularityOf) {\n\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\treturn granularity === \"namespace\" || granularity === \"entity\" || granularity === \"field\" || granularity === \"auxiliary\";\n}\n/**\n* Applies the two consumer filters to a diff issue list: strict gating\n* (relational `not-expected` findings drop in lenient mode) and\n* control-policy disposition (each surviving issue grades against its\n* subject table's effective policy; suppressed issues drop, `observed`\n* subjects warn). The verify verdict is `failures.length === 0`.\n*/\nfunction computeSqlDiffVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tfor (const issue of input.issues) {\n\t\tif (!input.strict && issueOutcome(issue) === \"not-expected\" && isStrictOnlyExtra(issue, input.granularityOf)) continue;\n\t\tconst disposition = dispositionForCategory(effectiveControlPolicy(input.resolveControlPolicy(issue), input.defaultControlPolicy), classifySqlDiffIssue(issue, input.granularityOf));\n\t\tif (disposition === \"suppress\") continue;\n\t\tif (disposition === \"warn\") {\n\t\t\twarnings.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tfailures.push(issue);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction computeStorageTypeVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst policy = effectiveControlPolicy(void 0, input.contract.defaultControlPolicy);\n\tfor (const pair of input.namespacePairs) {\n\t\tif (pair.actual === void 0) continue;\n\t\tfor (const [typeName, typeInstance] of Object.entries(input.contract.storage.types ?? {})) {\n\t\t\tif (!isStorageTypeInstance(typeInstance)) continue;\n\t\t\tconst hook = input.codecHooks.get(typeInstance.codecId);\n\t\t\tif (!hook?.verifyType) continue;\n\t\t\tconst typeIssues = hook.verifyType({\n\t\t\t\ttypeName,\n\t\t\t\ttypeInstance,\n\t\t\t\tschema: pair.actual\n\t\t\t});\n\t\t\tfor (const issue of typeIssues) {\n\t\t\t\tconst disposition = verifierDisposition(policy, issue);\n\t\t\t\tif (disposition === \"suppress\") continue;\n\t\t\t\tif (disposition === \"warn\") {\n\t\t\t\t\twarnings.push(issue);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfailures.push(issue);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\n/**\n* THE SQL schema verify: runs the target's full-tree node diff, grades it\n* through the family's post-diff filters (strict gating + control-policy\n* disposition) plus the codec `verifyType` hook findings, and wraps the\n* verdict in the issue-based result envelope. `ok` holds exactly when both\n* issue lists are empty — the lists carry the verdict's failures.\n*/\nfunction verifySqlSchemaByDiff(input) {\n\tconst startTime = Date.now();\n\tconst verdictDiff = input.diffSchema({\n\t\tcontract: input.contract,\n\t\tschema: input.schema,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst diffVerdict = computeSqlDiffVerdict({\n\t\tissues: verdictDiff.issues,\n\t\tresolveControlPolicy: verdictDiff.resolveControlPolicy,\n\t\tstrict: input.strict,\n\t\tdefaultControlPolicy: input.contract.defaultControlPolicy,\n\t\tgranularityOf: input.granularityOf\n\t});\n\tconst storageTypeVerdict = computeStorageTypeVerdict({\n\t\tcontract: input.contract,\n\t\tnamespacePairs: verdictDiff.namespacePairs,\n\t\tcodecHooks: extractCodecControlHooks(input.frameworkComponents)\n\t});\n\tconst failCount = diffVerdict.failures.length + storageTypeVerdict.failures.length;\n\tconst ok = failCount === 0;\n\tconst profileHash = \"profileHash\" in input.contract && typeof input.contract.profileHash === \"string\" ? input.contract.profileHash : void 0;\n\treturn {\n\t\tok,\n\t\t...ok ? {} : { code: \"CONTRACT.SCHEMA_VERIFICATION_FAILED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : `Database schema does not satisfy contract (${failCount} failure${failCount === 1 ? \"\" : \"s\"})`,\n\t\tcontract: {\n\t\t\tstorageHash: input.contract.storage.storageHash,\n\t\t\t...ifDefined(\"profileHash\", profileHash)\n\t\t},\n\t\ttarget: {\n\t\t\texpected: input.contract.target,\n\t\t\tactual: input.contract.target\n\t\t},\n\t\tschema: {\n\t\t\tissues: [...diffVerdict.failures, ...storageTypeVerdict.failures],\n\t\t\twarnings: { issues: [...diffVerdict.warnings, ...storageTypeVerdict.warnings] }\n\t\t},\n\t\tmeta: { strict: input.strict },\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\n//#endregion\nexport { computeStorageTypeVerdict as a, computeSqlDiffVerdict as i, classifyDiffSubjectGranularity as n, verifySqlSchemaByDiff as o, classifySqlDiffIssue as r, extractCodecControlHooks as s, classifyDiffEntityKind as t };\n\n//# sourceMappingURL=schema-verify-C_PEdlAr.mjs.map"],"mappings":";;;;;;AAMA,SAAS,qBAAqB,YAAY;CACzC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM,OAAO;CAClE,MAAM,QAAQ,WAAW,OAAO,YAAY;CAC5C,OAAO,UAAU,QAAQ,UAAU,KAAK,KAAK,OAAO,UAAU;AAC/D;AACA,SAAS,yBAAyB,aAAa;CAC9C,MAAM,wBAAwB,IAAI,IAAI;CACtC,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,cAAc,aAAa;EACrC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM;EAC3D,IAAI,CAAC,qBAAqB,UAAU,GAAG;EACvC,MAAM,oBAAoB,WAAW,MAAM,WAAW;EACtD,KAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,iBAAiB,GAAG;GAChE,uBAAuB;IACtB;IACA;IACA,cAAc,WAAW;IACzB,aAAa;IACb,sBAAsB;GACvB,CAAC;GACD,MAAM,IAAI,SAAS,IAAI;GACvB,OAAO,IAAI,SAAS,WAAW,EAAE;EAClC;CACD;CACA,OAAO;AACR;;;;;;;AASA,SAAS,6BAA6B,OAA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AAY;EAClC,QAAQ,MAAM;EACd,sBAAsB,MAAM,SAAS;EACrC,eAAe,MAAM;CACtB,CAAC;CACD,MAAM,qBAAqB,0BAA0B;EACpD,UAAU,MAAM;EAChB,gBAAgB,YAAY;EAC5B,YAAY,yBAAyB,MAAM,mBAAmB;CAC/D,CAAC;CACD,MAAM,YAAY,YAAY,SAAS,SAAS,mBAAmB,SAAS;CAC5E,MAAM,KAAK,cAAc;CACzB,MAAM,cAAc,iBAAiB,MAAM,YAAY,OAAO,MAAM,SAAS,gBAAgB,WAAW,MAAM,SAAS,cAAc,KAAK;CAC1I,OAAO;EACN;EACA,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,sCAAsC;EAC3D,SAAS,KAAK,uCAAuC,8CAA8C,UAAU,UAAU,cAAc,IAAI,KAAK,IAAI;EAClJ,UAAU;GACT,aAAa,MAAM,SAAS,QAAQ;GACpC,GAAG,UAAU,eAAe,WAAW;EACxC;EACA,QAAQ;GACP,UAAU,MAAM,SAAS;GACzB,QAAQ,MAAM,SAAS;EACxB;EACA,QAAQ;GACP,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ;GAChE,UAAU,EAAE,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ,EAAE;EAC/E;EACA,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C;AACD"}
1
+ {"version":3,"file":"schema-verify-C_PEdlAr-CmXrFuW1.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/schema-verify-C_PEdlAr.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { assertUniqueCodecOwner, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { isStorageTypeInstance } from \"@internal/sql-contract/types\";\n//#region src/core/assembly.ts\nfunction hasCodecControlHooks(descriptor) {\n\tif (typeof descriptor !== \"object\" || descriptor === null) return false;\n\tconst hooks = descriptor.types?.codecTypes?.controlPlaneHooks;\n\treturn hooks !== null && hooks !== void 0 && typeof hooks === \"object\";\n}\nfunction extractCodecControlHooks(descriptors) {\n\tconst hooks = /* @__PURE__ */ new Map();\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const descriptor of descriptors) {\n\t\tif (typeof descriptor !== \"object\" || descriptor === null) continue;\n\t\tif (!hasCodecControlHooks(descriptor)) continue;\n\t\tconst controlPlaneHooks = descriptor.types.codecTypes.controlPlaneHooks;\n\t\tfor (const [codecId, hook] of Object.entries(controlPlaneHooks)) {\n\t\t\tassertUniqueCodecOwner({\n\t\t\t\tcodecId,\n\t\t\t\towners,\n\t\t\t\tdescriptorId: descriptor.id,\n\t\t\t\tentityLabel: \"control hooks\",\n\t\t\t\tentityOwnershipLabel: \"owner\"\n\t\t\t});\n\t\t\thooks.set(codecId, hook);\n\t\t\towners.set(codecId, descriptor.id);\n\t\t}\n\t}\n\treturn hooks;\n}\n//#endregion\n//#region src/core/diff/verifier-disposition.ts\n/**\n* Classifies a codec `verifyType` hook finding into the target-neutral\n* categories the framework grades. A storage type is a named type instance\n* (e.g. a native enum); the only shape divergence it can carry is a change\n* to its value set, so a paired mismatch always classifies as `valueDrift`.\n*/\nfunction classifyStorageTypeDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return \"extraAuxiliary\";\n\treturn \"valueDrift\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyStorageTypeDiffIssue(issue));\n}\n//#endregion\n//#region src/core/diff/schema-verify.ts\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/**\n* Resolves an issue's framework-neutral {@link DiffSubjectGranularity} on\n* demand, from the issue's node's `nodeKind` via the target-provided\n* `granularityOf` map. The node carries only its `nodeKind` identity, never a\n* classification, and nothing is stamped onto the issue — every consumer\n* (the family verdict below, the framework aggregate's unclaimed-elements\n* sweep via {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable})\n* calls this the same way, resolved by the family/target that owns the node\n* vocabulary. `undefined` for an issue with no node.\n*/\nfunction classifyDiffSubjectGranularity(issue, granularityOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : granularityOf(node.nodeKind);\n}\n/**\n* Resolves an issue's storage `entityKind` on demand, from the issue's\n* node's `nodeKind` via the target-provided `entityKindOf` map — the sibling\n* of {@link classifyDiffSubjectGranularity}, called the same way by the same\n* consumers (via\n* {@link import('@internal/framework-components/control').SchemaSubjectClassifierCapable}).\n* `undefined` for an issue with no node, or for a node kind with no storage\n* entity of its own.\n*/\nfunction classifyDiffEntityKind(issue, entityKindOf) {\n\tconst node = issueNode(issue);\n\treturn node === void 0 ? void 0 : entityKindOf(node.nodeKind);\n}\n/**\n* Re-keys the legacy `classifySqlVerifierIssueKind` category mapping on the\n* issue's {@link DiffSubjectGranularity} (resolved via `granularityOf`) + the\n* issue reason. The vocabulary maps one-to-one: an undeclared live entity or\n* namespace is `extraTopLevelObject`, an undeclared live field\n* `extraNestedElement`, undeclared auxiliaries (constraints, indexes,\n* defaults) and structural leaves (policies) `extraAuxiliary`; every paired\n* divergence is `declaredIncompatible`; anything the database lacks is\n* `declaredMissing`.\n* `granularityOf` is the target's classifier, so target and extension node\n* kinds classify without the family importing them.\n*/\nfunction classifySqlDiffIssue(issue, granularityOf) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\t\tif (granularity === \"entity\" || granularity === \"namespace\") return \"extraTopLevelObject\";\n\t\tif (granularity === \"field\") return \"extraNestedElement\";\n\t\treturn \"extraAuxiliary\";\n\t}\n\treturn \"declaredIncompatible\";\n}\n/**\n* Whether a `not-expected` issue is a strict-mode-only finding. The legacy\n* walk detected every relational extra (namespaces, entities, fields, and\n* their auxiliaries) only under `--strict`; the structural diff (roots, RLS\n* policies, roles) was never strict-gated — its extras fail in both modes.\n* Keyed on the issue's granularity, resolved via `granularityOf`.\n*/\nfunction isStrictOnlyExtra(issue, granularityOf) {\n\tconst granularity = classifyDiffSubjectGranularity(issue, granularityOf);\n\treturn granularity === \"namespace\" || granularity === \"entity\" || granularity === \"field\" || granularity === \"auxiliary\";\n}\n/**\n* Applies the two consumer filters to a diff issue list: strict gating\n* (relational `not-expected` findings drop in lenient mode) and\n* control-policy disposition (each surviving issue grades against its\n* subject table's effective policy; suppressed issues drop, `observed`\n* subjects warn). The verify verdict is `failures.length === 0`.\n*/\nfunction computeSqlDiffVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tfor (const issue of input.issues) {\n\t\tif (!input.strict && issueOutcome(issue) === \"not-expected\" && isStrictOnlyExtra(issue, input.granularityOf)) continue;\n\t\tconst disposition = dispositionForCategory(effectiveControlPolicy(input.resolveControlPolicy(issue), input.defaultControlPolicy), classifySqlDiffIssue(issue, input.granularityOf));\n\t\tif (disposition === \"suppress\") continue;\n\t\tif (disposition === \"warn\") {\n\t\t\twarnings.push(issue);\n\t\t\tcontinue;\n\t\t}\n\t\tfailures.push(issue);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction computeStorageTypeVerdict(input) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst policy = effectiveControlPolicy(void 0, input.contract.defaultControlPolicy);\n\tfor (const pair of input.namespacePairs) {\n\t\tif (pair.actual === void 0) continue;\n\t\tfor (const [typeName, typeInstance] of Object.entries(input.contract.storage.types ?? {})) {\n\t\t\tif (!isStorageTypeInstance(typeInstance)) continue;\n\t\t\tconst hook = input.codecHooks.get(typeInstance.codecId);\n\t\t\tif (!hook?.verifyType) continue;\n\t\t\tconst typeIssues = hook.verifyType({\n\t\t\t\ttypeName,\n\t\t\t\ttypeInstance,\n\t\t\t\tschema: pair.actual\n\t\t\t});\n\t\t\tfor (const issue of typeIssues) {\n\t\t\t\tconst disposition = verifierDisposition(policy, issue);\n\t\t\t\tif (disposition === \"suppress\") continue;\n\t\t\t\tif (disposition === \"warn\") {\n\t\t\t\t\twarnings.push(issue);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfailures.push(issue);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\n/**\n* THE SQL schema verify: runs the target's full-tree node diff, grades it\n* through the family's post-diff filters (strict gating + control-policy\n* disposition) plus the codec `verifyType` hook findings, and wraps the\n* verdict in the issue-based result envelope. `ok` holds exactly when both\n* issue lists are empty — the lists carry the verdict's failures.\n*/\nfunction verifySqlSchemaByDiff(input) {\n\tconst startTime = Date.now();\n\tconst verdictDiff = input.diffSchema({\n\t\tcontract: input.contract,\n\t\tschema: input.schema,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst diffVerdict = computeSqlDiffVerdict({\n\t\tissues: verdictDiff.issues,\n\t\tresolveControlPolicy: verdictDiff.resolveControlPolicy,\n\t\tstrict: input.strict,\n\t\tdefaultControlPolicy: input.contract.defaultControlPolicy,\n\t\tgranularityOf: input.granularityOf\n\t});\n\tconst storageTypeVerdict = computeStorageTypeVerdict({\n\t\tcontract: input.contract,\n\t\tnamespacePairs: verdictDiff.namespacePairs,\n\t\tcodecHooks: extractCodecControlHooks(input.frameworkComponents)\n\t});\n\tconst failCount = diffVerdict.failures.length + storageTypeVerdict.failures.length;\n\tconst ok = failCount === 0;\n\tconst profileHash = \"profileHash\" in input.contract && typeof input.contract.profileHash === \"string\" ? input.contract.profileHash : void 0;\n\treturn {\n\t\tok,\n\t\t...ok ? {} : { code: \"CONTRACT.SCHEMA_VERIFICATION_FAILED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : `Database schema does not satisfy contract (${failCount} failure${failCount === 1 ? \"\" : \"s\"})`,\n\t\tcontract: {\n\t\t\tstorageHash: input.contract.storage.storageHash,\n\t\t\t...ifDefined(\"profileHash\", profileHash)\n\t\t},\n\t\ttarget: {\n\t\t\texpected: input.contract.target,\n\t\t\tactual: input.contract.target\n\t\t},\n\t\tschema: {\n\t\t\tissues: [...diffVerdict.failures, ...storageTypeVerdict.failures],\n\t\t\twarnings: { issues: [...diffVerdict.warnings, ...storageTypeVerdict.warnings] }\n\t\t},\n\t\tmeta: { strict: input.strict },\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\n//#endregion\nexport { computeStorageTypeVerdict as a, computeSqlDiffVerdict as i, classifyDiffSubjectGranularity as n, verifySqlSchemaByDiff as o, classifySqlDiffIssue as r, extractCodecControlHooks as s, classifyDiffEntityKind as t };\n\n//# sourceMappingURL=schema-verify-C_PEdlAr.mjs.map"],"mappings":";;;;;;AAMA,SAAS,qBAAqB,YAAY;CACzC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM,OAAO;CAClE,MAAM,QAAQ,WAAW,OAAO,YAAY;CAC5C,OAAO,UAAU,QAAQ,UAAU,KAAK,KAAK,OAAO,UAAU;AAC/D;AACA,SAAS,yBAAyB,aAAa;CAC9C,MAAM,wBAAwB,IAAI,IAAI;CACtC,MAAM,yBAAyB,IAAI,IAAI;CACvC,KAAK,MAAM,cAAc,aAAa;EACrC,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM;EAC3D,IAAI,CAAC,qBAAqB,UAAU,GAAG;EACvC,MAAM,oBAAoB,WAAW,MAAM,WAAW;EACtD,KAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,iBAAiB,GAAG;GAChE,uBAAuB;IACtB;IACA;IACA,cAAc,WAAW;IACzB,aAAa;IACb,sBAAsB;GACvB,CAAC;GACD,MAAM,IAAI,SAAS,IAAI;GACvB,OAAO,IAAI,SAAS,WAAW,EAAE;EAClC;CACD;CACA,OAAO;AACR;;;;;;;AASA,SAAS,6B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sBAAsB,YAAY;EAClC,QAAQ,MAAM;EACd,sBAAsB,MAAM,SAAS;EACrC,eAAe,MAAM;CACtB,CAAC;CACD,MAAM,qBAAqB,0BAA0B;EACpD,UAAU,MAAM;EAChB,gBAAgB,YAAY;EAC5B,YAAY,yBAAyB,MAAM,mBAAmB;CAC/D,CAAC;CACD,MAAM,YAAY,YAAY,SAAS,SAAS,mBAAmB,SAAS;CAC5E,MAAM,KAAK,cAAc;CACzB,MAAM,cAAc,iBAAiB,MAAM,YAAY,OAAO,MAAM,SAAS,gBAAgB,WAAW,MAAM,SAAS,cAAc,KAAK;CAC1I,OAAO;EACN;EACA,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,sCAAsC;EAC3D,SAAS,KAAK,uCAAuC,8CAA8C,UAAU,UAAU,cAAc,IAAI,KAAK,IAAI;EAClJ,UAAU;GACT,aAAa,MAAM,SAAS,QAAQ;GACpC,GAAG,UAAU,eAAe,WAAW;EACxC;EACA,QAAQ;GACP,UAAU,MAAM,SAAS;GACzB,QAAQ,MAAM,SAAS;EACxB;EACA,QAAQ;GACP,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ;GAChE,UAAU,EAAE,QAAQ,CAAC,GAAG,YAAY,UAAU,GAAG,mBAAmB,QAAQ,EAAE;EAC/E;EACA,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C;AACD"}
@@ -0,0 +1,275 @@
1
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
2
+ import { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, str } from "@prisma/orm-framework/psl-parser";
3
+ import { notOk } from "@prisma/orm-framework/utils/result";
4
+ //#region ../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-CG0yitvD.mjs
5
+ function findModelAttributeNode(model, name) {
6
+ for (const attribute of model.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;
7
+ }
8
+ function findFieldAttributeNode(field, name) {
9
+ for (const attribute of field.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;
10
+ }
11
+ function buildModelAttributeCtx(input) {
12
+ return {
13
+ sourceId: input.sourceId,
14
+ sourceFile: input.sourceFile,
15
+ selfModel: input.selfModel
16
+ };
17
+ }
18
+ function buildFieldAttributeCtx(input) {
19
+ return {
20
+ sourceId: input.sourceId,
21
+ sourceFile: input.sourceFile,
22
+ selfModel: input.selfModel,
23
+ resolveReferencedModel: input.resolveReferencedModel ?? (() => void 0),
24
+ field: input.field
25
+ };
26
+ }
27
+ function interpretModelAttribute(input) {
28
+ const result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({
29
+ selfModel: input.model,
30
+ sourceFile: input.sourceFile,
31
+ sourceId: input.sourceId
32
+ }));
33
+ if (!result.ok) {
34
+ for (const failure of result.failure) input.diagnostics.push(failure);
35
+ return;
36
+ }
37
+ return result.value;
38
+ }
39
+ function interpretFieldAttribute(input) {
40
+ const result = interpretAttribute(input.node, input.spec, buildFieldAttributeCtx({
41
+ selfModel: input.model,
42
+ field: input.field,
43
+ sourceFile: input.sourceFile,
44
+ sourceId: input.sourceId,
45
+ resolveReferencedModel: input.resolveReferencedModel
46
+ }));
47
+ if (!result.ok) {
48
+ for (const failure of result.failure) input.diagnostics.push(failure);
49
+ return;
50
+ }
51
+ return result.value;
52
+ }
53
+ const mapModelSpec = modelAttribute("map", { positional: [{
54
+ key: "name",
55
+ type: str()
56
+ }] });
57
+ const mapFieldSpec = fieldAttribute("map", { positional: [{
58
+ key: "name",
59
+ type: str()
60
+ }] });
61
+ function scalarDefaultArms(isList, registry) {
62
+ const literal = () => oneOf(str(), num(), bool());
63
+ const funcArms = [...registry.entries()].map(([name, entry]) => funcCall(name, blindCast(entry.signature)));
64
+ return isList ? [list(literal()), ...funcArms] : [
65
+ str(),
66
+ num(),
67
+ bool(),
68
+ ...funcArms
69
+ ];
70
+ }
71
+ function noEnumMember() {
72
+ return {
73
+ kind: "rejecting",
74
+ label: "enum member",
75
+ message: "Enum declares no members",
76
+ parse: (arg, ctx) => notOk([leafDiagnostic(ctx, arg, "Enum declares no members")])
77
+ };
78
+ }
79
+ function enumMemberNames(ctx) {
80
+ const block = (ctx.field.typeNamespaceId === void 0 ? ctx.symbols.topLevel : ctx.symbols.topLevel.namespaces[ctx.field.typeNamespaceId])?.blocks[ctx.field.typeName];
81
+ if (block === void 0 || block.keyword !== "enum") return void 0;
82
+ return Object.keys(block.block.parameters);
83
+ }
84
+ function enumDefaultArms(members) {
85
+ const [first, ...rest] = members;
86
+ if (first === void 0) return [noEnumMember()];
87
+ return [identifier(first), ...rest.map((name) => identifier(name))];
88
+ }
89
+ function defaultFieldSpec(ctx) {
90
+ const members = enumMemberNames(ctx);
91
+ return fieldAttribute("default", { positional: [{
92
+ key: "value",
93
+ type: oneOf(...members === void 0 ? scalarDefaultArms(ctx.field.list, ctx.controlMutationDefaults) : enumDefaultArms(members))
94
+ }] });
95
+ }
96
+ const idFieldSpec = fieldAttribute("id", { named: { map: optional(str()) } });
97
+ const uniqueFieldSpec = fieldAttribute("unique", { named: { map: optional(str()) } });
98
+ const noCheckKindArgument = () => oneOf(identifier("membership"), identifier("elementNotNull"));
99
+ /**
100
+ * `@noCheck` waives generated CHECK constraints on one column: bare for every
101
+ * kind the column's shape derives, or naming concrete kinds. Two optional
102
+ * positional slots cover the whole kind vocabulary; a third argument is
103
+ * necessarily a duplicate and fails as excess arity.
104
+ */
105
+ const noCheckFieldSpec = fieldAttribute("noCheck", {
106
+ positional: [{
107
+ key: "first",
108
+ type: optional(noCheckKindArgument())
109
+ }, {
110
+ key: "second",
111
+ type: optional(noCheckKindArgument())
112
+ }],
113
+ refine: (value, ctx, attributeNode) => {
114
+ if (value.first !== void 0 && value.first === value.second) return [leafDiagnostic(ctx, attributeNode, "`@noCheck` names the same kind twice")];
115
+ return [];
116
+ }
117
+ });
118
+ const idModelSpec = modelAttribute("id", {
119
+ positional: [{
120
+ key: "fields",
121
+ type: list(fieldRef(), {
122
+ allowEmpty: false,
123
+ unique: true
124
+ })
125
+ }],
126
+ named: { map: optional(str()) }
127
+ });
128
+ const uniqueModelSpec = modelAttribute("unique", {
129
+ positional: [{
130
+ key: "fields",
131
+ type: list(fieldRef(), {
132
+ allowEmpty: false,
133
+ unique: true
134
+ })
135
+ }],
136
+ named: { map: optional(str()) }
137
+ });
138
+ const PSL_INDEX_FIELDS_XOR_EXPRESSION = "PSL_INDEX_FIELDS_XOR_EXPRESSION";
139
+ const PSL_INDEX_EXPRESSION_REQUIRES_NAME = "PSL_INDEX_EXPRESSION_REQUIRES_NAME";
140
+ const PSL_INDEX_NAME_XOR_MAP = "PSL_INDEX_NAME_XOR_MAP";
141
+ const indexModelSpec = modelAttribute("index", {
142
+ positional: [{
143
+ key: "fields",
144
+ type: optional(list(fieldRef(), {
145
+ allowEmpty: false,
146
+ unique: true
147
+ }))
148
+ }],
149
+ named: {
150
+ expression: optional(str()),
151
+ where: optional(str()),
152
+ unique: optional(bool()),
153
+ name: optional(str()),
154
+ map: optional(str()),
155
+ type: optional(str()),
156
+ options: optional(record(str()))
157
+ },
158
+ refine: (value, ctx, attributeNode) => {
159
+ const diagnostics = [];
160
+ if (value.fields === void 0 === (value.expression === void 0)) diagnostics.push(leafDiagnostic(ctx, attributeNode, "`@@index` requires exactly one of a fields list or an `expression` argument", PSL_INDEX_FIELDS_XOR_EXPRESSION));
161
+ if (value.expression !== void 0 && value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, "`@@index` with an `expression` argument requires a `name` or `map` argument (a default name cannot be derived from an expression)", PSL_INDEX_EXPRESSION_REQUIRES_NAME));
162
+ if (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, "`@@index` takes at most one of `name` and `map`", PSL_INDEX_NAME_XOR_MAP));
163
+ if (value.options !== void 0 && value.type === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, "`@@index` options argument requires a type argument"));
164
+ return diagnostics;
165
+ }
166
+ });
167
+ const PSL_CHECK_REQUIRES_NAME_OR_MAP = "PSL_CHECK_REQUIRES_NAME_OR_MAP";
168
+ const PSL_CHECK_NAME_XOR_MAP = "PSL_CHECK_NAME_XOR_MAP";
169
+ const PSL_CHECK_EXPRESSION_EMPTY = "PSL_CHECK_EXPRESSION_EMPTY";
170
+ /**
171
+ * A single-table-inheritance variant (`@@base` with no own `@@map`) shares
172
+ * its base model's storage table and has no table of its own to declare a
173
+ * check on — raised from {@link interpretPslDocumentToSqlContract}, not from
174
+ * this spec's own `refine`, because the rule needs the model's `@@base`
175
+ * declaration, which a single attribute's `refine` cannot see.
176
+ */
177
+ const PSL_CHECK_ON_STI_VARIANT = "PSL_CHECK_ON_STI_VARIANT";
178
+ const checkModelSpec = modelAttribute("check", {
179
+ named: {
180
+ expression: str(),
181
+ name: optional(str()),
182
+ map: optional(str())
183
+ },
184
+ refine: (value, ctx, attributeNode) => {
185
+ const diagnostics = [];
186
+ if (value.expression.trim().length === 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, "`@@check` expression must not be empty — an empty predicate is not a constraint", PSL_CHECK_EXPRESSION_EMPTY));
187
+ if (value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, "`@@check` requires a `name` or `map` argument (a default name cannot be derived — a check has no column tuple to name itself after)", PSL_CHECK_REQUIRES_NAME_OR_MAP));
188
+ if (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, "`@@check` takes at most one of `name` and `map`", PSL_CHECK_NAME_XOR_MAP));
189
+ return diagnostics;
190
+ }
191
+ });
192
+ const controlModelSpec = modelAttribute("control", { positional: [{
193
+ key: "policy",
194
+ type: oneOf(identifier("managed"), identifier("tolerated"), identifier("external"), identifier("observed"))
195
+ }] });
196
+ const discriminatorModelSpec = modelAttribute("discriminator", { positional: [{
197
+ key: "field",
198
+ type: fieldRef()
199
+ }] });
200
+ const baseModelSpec = modelAttribute("base", { positional: [{
201
+ key: "base",
202
+ type: entityRef()
203
+ }, {
204
+ key: "value",
205
+ type: str()
206
+ }] });
207
+ function relationAttributeSpan(ctx) {
208
+ const node = findFieldAttributeNode(ctx.field, "relation");
209
+ if (node !== void 0) return nodePslSpan(node.syntax, ctx.sourceFile);
210
+ return ctx.field.span;
211
+ }
212
+ function relationInvariants(parsed, ctx) {
213
+ if (parsed.fields !== void 0 !== (parsed.references !== void 0)) return [{
214
+ code: "PSL_INVALID_ATTRIBUTE_SYNTAX",
215
+ message: `Relation field "${ctx.selfModel.name}.${ctx.field.name}" requires fields and references arguments`,
216
+ sourceId: ctx.sourceId,
217
+ span: relationAttributeSpan(ctx)
218
+ }];
219
+ return [];
220
+ }
221
+ const referentialActionArgument = () => oneOf(identifier("NoAction"), identifier("Restrict"), identifier("Cascade"), identifier("SetNull"), identifier("SetDefault"));
222
+ const relationFieldSpec = fieldAttribute("relation", {
223
+ positional: [{
224
+ key: "name",
225
+ type: optional(str())
226
+ }],
227
+ named: {
228
+ name: optional(str()),
229
+ fields: optional(list(fieldRef(), {
230
+ allowEmpty: false,
231
+ unique: true
232
+ })),
233
+ references: optional(list(referencedFieldRef(), {
234
+ allowEmpty: false,
235
+ unique: true
236
+ })),
237
+ map: optional(str()),
238
+ onDelete: optional(referentialActionArgument()),
239
+ onUpdate: optional(referentialActionArgument()),
240
+ index: optional(bool())
241
+ },
242
+ refine: relationInvariants
243
+ });
244
+ function fieldSpecContext(input) {
245
+ return {
246
+ symbols: input.symbols,
247
+ model: input.model,
248
+ field: input.field,
249
+ controlMutationDefaults: input.controlMutationDefaults
250
+ };
251
+ }
252
+ const sqlAttributeSpecs = {
253
+ model: {
254
+ map: () => mapModelSpec,
255
+ id: () => idModelSpec,
256
+ unique: () => uniqueModelSpec,
257
+ index: () => indexModelSpec,
258
+ check: () => checkModelSpec,
259
+ control: () => controlModelSpec,
260
+ discriminator: () => discriminatorModelSpec,
261
+ base: () => baseModelSpec
262
+ },
263
+ field: {
264
+ map: () => mapFieldSpec,
265
+ id: () => idFieldSpec,
266
+ unique: () => uniqueFieldSpec,
267
+ noCheck: () => noCheckFieldSpec,
268
+ relation: () => relationFieldSpec,
269
+ default: defaultFieldSpec
270
+ }
271
+ };
272
+ //#endregion
273
+ export { interpretFieldAttribute as a, findModelAttributeNode as i, fieldSpecContext as n, interpretModelAttribute as o, findFieldAttributeNode as r, sqlAttributeSpecs as s, PSL_CHECK_ON_STI_VARIANT as t };
274
+
275
+ //# sourceMappingURL=sql-attribute-specs-CG0yitvD-CG-0eW98.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-attribute-specs-CG0yitvD-CG-0eW98.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-CG0yitvD.mjs"],"sourcesContent":["import { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, str } from \"@internal/psl-parser\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { notOk } from \"@internal/utils/result\";\n//#region src/sql-attribute-specs.ts\nfunction findModelAttributeNode(model, name) {\n\tfor (const attribute of model.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction findFieldAttributeNode(field, name) {\n\tfor (const attribute of field.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction buildModelAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel\n\t};\n}\nfunction buildFieldAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel,\n\t\tresolveReferencedModel: input.resolveReferencedModel ?? (() => void 0),\n\t\tfield: input.field\n\t};\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({\n\t\tselfModel: input.model,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction interpretFieldAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildFieldAttributeCtx({\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId,\n\t\tresolveReferencedModel: input.resolveReferencedModel\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nconst mapModelSpec = modelAttribute(\"map\", { positional: [{\n\tkey: \"name\",\n\ttype: str()\n}] });\nconst mapFieldSpec = fieldAttribute(\"map\", { positional: [{\n\tkey: \"name\",\n\ttype: str()\n}] });\nfunction scalarDefaultArms(isList, registry) {\n\tconst literal = () => oneOf(str(), num(), bool());\n\tconst funcArms = [...registry.entries()].map(([name, entry]) => funcCall(name, blindCast(entry.signature)));\n\treturn isList ? [list(literal()), ...funcArms] : [\n\t\tstr(),\n\t\tnum(),\n\t\tbool(),\n\t\t...funcArms\n\t];\n}\nfunction noEnumMember() {\n\treturn {\n\t\tkind: \"rejecting\",\n\t\tlabel: \"enum member\",\n\t\tmessage: \"Enum declares no members\",\n\t\tparse: (arg, ctx) => notOk([leafDiagnostic(ctx, arg, \"Enum declares no members\")])\n\t};\n}\nfunction enumMemberNames(ctx) {\n\tconst block = (ctx.field.typeNamespaceId === void 0 ? ctx.symbols.topLevel : ctx.symbols.topLevel.namespaces[ctx.field.typeNamespaceId])?.blocks[ctx.field.typeName];\n\tif (block === void 0 || block.keyword !== \"enum\") return void 0;\n\treturn Object.keys(block.block.parameters);\n}\nfunction enumDefaultArms(members) {\n\tconst [first, ...rest] = members;\n\tif (first === void 0) return [noEnumMember()];\n\treturn [identifier(first), ...rest.map((name) => identifier(name))];\n}\nfunction defaultFieldSpec(ctx) {\n\tconst members = enumMemberNames(ctx);\n\treturn fieldAttribute(\"default\", { positional: [{\n\t\tkey: \"value\",\n\t\ttype: oneOf(...members === void 0 ? scalarDefaultArms(ctx.field.list, ctx.controlMutationDefaults) : enumDefaultArms(members))\n\t}] });\n}\nconst idFieldSpec = fieldAttribute(\"id\", { named: { map: optional(str()) } });\nconst uniqueFieldSpec = fieldAttribute(\"unique\", { named: { map: optional(str()) } });\nconst noCheckKindArgument = () => oneOf(identifier(\"membership\"), identifier(\"elementNotNull\"));\n/**\n* `@noCheck` waives generated CHECK constraints on one column: bare for every\n* kind the column's shape derives, or naming concrete kinds. Two optional\n* positional slots cover the whole kind vocabulary; a third argument is\n* necessarily a duplicate and fails as excess arity.\n*/\nconst noCheckFieldSpec = fieldAttribute(\"noCheck\", {\n\tpositional: [{\n\t\tkey: \"first\",\n\t\ttype: optional(noCheckKindArgument())\n\t}, {\n\t\tkey: \"second\",\n\t\ttype: optional(noCheckKindArgument())\n\t}],\n\trefine: (value, ctx, attributeNode) => {\n\t\tif (value.first !== void 0 && value.first === value.second) return [leafDiagnostic(ctx, attributeNode, \"`@noCheck` names the same kind twice\")];\n\t\treturn [];\n\t}\n});\nconst idModelSpec = modelAttribute(\"id\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})\n\t}],\n\tnamed: { map: optional(str()) }\n});\nconst uniqueModelSpec = modelAttribute(\"unique\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})\n\t}],\n\tnamed: { map: optional(str()) }\n});\nconst PSL_INDEX_FIELDS_XOR_EXPRESSION = \"PSL_INDEX_FIELDS_XOR_EXPRESSION\";\nconst PSL_INDEX_EXPRESSION_REQUIRES_NAME = \"PSL_INDEX_EXPRESSION_REQUIRES_NAME\";\nconst PSL_INDEX_NAME_XOR_MAP = \"PSL_INDEX_NAME_XOR_MAP\";\nconst indexModelSpec = modelAttribute(\"index\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: optional(list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t}))\n\t}],\n\tnamed: {\n\t\texpression: optional(str()),\n\t\twhere: optional(str()),\n\t\tunique: optional(bool()),\n\t\tname: optional(str()),\n\t\tmap: optional(str()),\n\t\ttype: optional(str()),\n\t\toptions: optional(record(str()))\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.fields === void 0 === (value.expression === void 0)) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` requires exactly one of a fields list or an `expression` argument\", PSL_INDEX_FIELDS_XOR_EXPRESSION));\n\t\tif (value.expression !== void 0 && value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` with an `expression` argument requires a `name` or `map` argument (a default name cannot be derived from an expression)\", PSL_INDEX_EXPRESSION_REQUIRES_NAME));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` takes at most one of `name` and `map`\", PSL_INDEX_NAME_XOR_MAP));\n\t\tif (value.options !== void 0 && value.type === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` options argument requires a type argument\"));\n\t\treturn diagnostics;\n\t}\n});\nconst PSL_CHECK_REQUIRES_NAME_OR_MAP = \"PSL_CHECK_REQUIRES_NAME_OR_MAP\";\nconst PSL_CHECK_NAME_XOR_MAP = \"PSL_CHECK_NAME_XOR_MAP\";\nconst PSL_CHECK_EXPRESSION_EMPTY = \"PSL_CHECK_EXPRESSION_EMPTY\";\n/**\n* A single-table-inheritance variant (`@@base` with no own `@@map`) shares\n* its base model's storage table and has no table of its own to declare a\n* check on — raised from {@link interpretPslDocumentToSqlContract}, not from\n* this spec's own `refine`, because the rule needs the model's `@@base`\n* declaration, which a single attribute's `refine` cannot see.\n*/\nconst PSL_CHECK_ON_STI_VARIANT = \"PSL_CHECK_ON_STI_VARIANT\";\nconst checkModelSpec = modelAttribute(\"check\", {\n\tnamed: {\n\t\texpression: str(),\n\t\tname: optional(str()),\n\t\tmap: optional(str())\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.expression.trim().length === 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` expression must not be empty — an empty predicate is not a constraint\", PSL_CHECK_EXPRESSION_EMPTY));\n\t\tif (value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` requires a `name` or `map` argument (a default name cannot be derived — a check has no column tuple to name itself after)\", PSL_CHECK_REQUIRES_NAME_OR_MAP));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` takes at most one of `name` and `map`\", PSL_CHECK_NAME_XOR_MAP));\n\t\treturn diagnostics;\n\t}\n});\nconst controlModelSpec = modelAttribute(\"control\", { positional: [{\n\tkey: \"policy\",\n\ttype: oneOf(identifier(\"managed\"), identifier(\"tolerated\"), identifier(\"external\"), identifier(\"observed\"))\n}] });\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", { positional: [{\n\tkey: \"field\",\n\ttype: fieldRef()\n}] });\nconst baseModelSpec = modelAttribute(\"base\", { positional: [{\n\tkey: \"base\",\n\ttype: entityRef()\n}, {\n\tkey: \"value\",\n\ttype: str()\n}] });\nfunction relationAttributeSpan(ctx) {\n\tconst node = findFieldAttributeNode(ctx.field, \"relation\");\n\tif (node !== void 0) return nodePslSpan(node.syntax, ctx.sourceFile);\n\treturn ctx.field.span;\n}\nfunction relationInvariants(parsed, ctx) {\n\tif (parsed.fields !== void 0 !== (parsed.references !== void 0)) return [{\n\t\tcode: \"PSL_INVALID_ATTRIBUTE_SYNTAX\",\n\t\tmessage: `Relation field \"${ctx.selfModel.name}.${ctx.field.name}\" requires fields and references arguments`,\n\t\tsourceId: ctx.sourceId,\n\t\tspan: relationAttributeSpan(ctx)\n\t}];\n\treturn [];\n}\nconst referentialActionArgument = () => oneOf(identifier(\"NoAction\"), identifier(\"Restrict\"), identifier(\"Cascade\"), identifier(\"SetNull\"), identifier(\"SetDefault\"));\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str())\n\t}],\n\tnamed: {\n\t\tname: optional(str()),\n\t\tfields: optional(list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})),\n\t\treferences: optional(list(referencedFieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})),\n\t\tmap: optional(str()),\n\t\tonDelete: optional(referentialActionArgument()),\n\t\tonUpdate: optional(referentialActionArgument()),\n\t\tindex: optional(bool())\n\t},\n\trefine: relationInvariants\n});\nfunction fieldSpecContext(input) {\n\treturn {\n\t\tsymbols: input.symbols,\n\t\tmodel: input.model,\n\t\tfield: input.field,\n\t\tcontrolMutationDefaults: input.controlMutationDefaults\n\t};\n}\nconst sqlAttributeSpecs = {\n\tmodel: {\n\t\tmap: () => mapModelSpec,\n\t\tid: () => idModelSpec,\n\t\tunique: () => uniqueModelSpec,\n\t\tindex: () => indexModelSpec,\n\t\tcheck: () => checkModelSpec,\n\t\tcontrol: () => controlModelSpec,\n\t\tdiscriminator: () => discriminatorModelSpec,\n\t\tbase: () => baseModelSpec\n\t},\n\tfield: {\n\t\tmap: () => mapFieldSpec,\n\t\tid: () => idFieldSpec,\n\t\tunique: () => uniqueFieldSpec,\n\t\tnoCheck: () => noCheckFieldSpec,\n\t\trelation: () => relationFieldSpec,\n\t\tdefault: defaultFieldSpec\n\t}\n};\n//#endregion\nexport { interpretFieldAttribute as a, findModelAttributeNode as i, fieldSpecContext as n, interpretModelAttribute as o, findFieldAttributeNode as r, sqlAttributeSpecs as s, PSL_CHECK_ON_STI_VARIANT as t };\n\n//# sourceMappingURL=sql-attribute-specs-CG0yitvD.mjs.map"],"mappings":";;;;AAIA,SAAS,uBAAuB,OAAO,MAAM;CAC5C,KAAK,MAAM,aAAa,MAAM,KAAK,WAAW,GAAG,IAAI,UAAU,KAAK,CAAC,EAAE,aAAa,IAAI,MAAM,MAAM,OAAO;AAC5G;AACA,SAAS,uBAAuB,OAAO,MAAM;CAC5C,KAAK,MAAM,aAAa,MAAM,KAAK,WAAW,GAAG,IAAI,UAAU,KAAK,CAAC,EAAE,aAAa,IAAI,MAAM,MAAM,OAAO;AAC5G;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,WAAW,MAAM;CAClB;AACD;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB,wBAAwB,MAAM,iCAAiC,KAAK;EACpE,OAAO,MAAM;CACd;AACD;AACA,SAAS,wBAAwB,OAAO;CACvC,MAAM,SAAS,mBAAmB,MAAM,MAAM,MAAM,MAAM,uBAAuB;EAChF,WAAW,MAAM;EACjB,YAAY,MAAM;EAClB,UAAU,MAAM;CACjB,CAAC,CAAC;CACF,IAAI,CAAC,OAAO,IAAI;EACf,KAAK,MAAM,WAAW,OAAO,SAAS,MAAM,YAAY,KAAK,OAAO;EACpE;CACD;CACA,OAAO,OAAO;AACf;AACA,SAAS,wBAAwB,OAAO;CACvC,MAAM,SAAS,mBAAmB,MAAM,MAAM,MAAM,MAAM,uBAAuB;EAChF,WAAW,MAAM;EACjB,OAAO,MAAM;EACb,YAAY,MAAM;EAClB,UAAU,MAAM;EAChB,wBAAwB,MAAM;CAC/B,CAAC,CAAC;CACF,IAAI,CAAC,OAAO,IAAI;EACf,KAAK,MAAM,WAAW,OAAO,SAAS,MAAM,YAA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B,GAAG;CAChC,CAAC;CACD,OAAO,CAAC;AACT;AACA,MAAM,kCAAkC,MAAM,WAAW,UAAU,GAAG,WAAW,UAAU,GAAG,WAAW,SAAS,GAAG,WAAW,SAAS,GAAG,WAAW,YAAY,CAAC;AACpK,MAAM,oBAAoB,eAAe,YAAY;CACpD,YAAY,CAAC;EACZ,KAAK;EACL,MAAM,SAAS,IAAI,CAAC;CACrB,CAAC;CACD,OAAO;EACN,MAAM,SAAS,IAAI,CAAC;EACpB,QAAQ,SAAS,KAAK,SAAS,GAAG;GACjC,YAAY;GACZ,QAAQ;EACT,CAAC,CAAC;EACF,YAAY,SAAS,KAAK,mBAAmB,GAAG;GAC/C,YAAY;GACZ,QAAQ;EACT,CAAC,CAAC;EACF,KAAK,SAAS,IAAI,CAAC;EACnB,UAAU,SAAS,0BAA0B,CAAC;EAC9C,UAAU,SAAS,0BAA0B,CAAC;EAC9C,OAAO,SAAS,KAAK,CAAC;CACvB;CACA,QAAQ;AACT,CAAC;AACD,SAAS,iBAAiB,OAAO;CAChC,OAAO;EACN,SAAS,MAAM;EACf,OAAO,MAAM;EACb,OAAO,MAAM;EACb,yBAAyB,MAAM;CAChC;AACD;AACA,MAAM,oBAAoB;CACzB,OAAO;EACN,WAAW;EACX,UAAU;EACV,cAAc;EACd,aAAa;EACb,aAAa;EACb,eAAe;EACf,qBAAqB;EACrB,YAAY;CACb;CACA,OAAO;EACN,WAAW;EACX,UAAU;EACV,cAAc;EACd,eAAe;EACf,gBAAgB;EAChB,SAAS;CACV;AACD"}
@@ -1,21 +1,40 @@
1
1
  import { t as sqlContractCanonicalizationHooks } from "./canonicalization-hooks-dmXkOR4a.mjs";
2
2
  import { f as composeSqlEntityKinds } from "./entity-kinds-D7vwoN_T-CCBwFJy0.mjs";
3
- import { a as SqlStorage, s as isMaterializedSqlNamespace } from "./types-CUsJrvEl.mjs";
4
- import { r as createSqlContractSchema, s as validateSqlContractFully } from "./validators-CrWD6bSP.mjs";
3
+ import { c as isMaterializedSqlNamespace, o as SqlStorage } from "./types-D0B65hip.mjs";
4
+ import { a as resolveSqlToOneRelationStorage, c as validateSqlContractFully, r as createSqlContractSchema } from "./validators-DD98VrpC.mjs";
5
5
  import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
6
6
  import { ContractValidationError } from "@prisma/orm-framework/contract/contract-validation-error";
7
7
  import { hydrateNamespaceEntities } from "@prisma/orm-framework/components/ir";
8
8
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
9
9
  import { type } from "arktype";
10
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
11
+ import { withDerivedToOneRelationNullability } from "@prisma/orm-framework/contract-authoring";
11
12
  import { isPlainRecord as isPlainRecord$1 } from "@prisma/orm-framework/contract/is-plain-record";
12
- //#region ../../../2-sql/9-family/dist/sql-contract-serializer-2oBWuxTe.mjs
13
+ //#region ../../../2-sql/9-family/dist/sql-contract-serializer-Bxu4a5oQ.mjs
13
14
  const NamespaceRawSchema = type({
14
15
  id: "string",
15
16
  "kind?": "string",
16
17
  entries: type({ "+": "ignore" })
17
18
  });
18
19
  /**
20
+ * A `contract.json` written before to-one relations recorded `nullable` (rc.9 and earlier)
21
+ * loads with the flag derived from storage: nullable when any local FK column is nullable or
22
+ * cannot be resolved.
23
+ */
24
+ function withSqlToOneRelationNullability(contract) {
25
+ const domain = withDerivedToOneRelationNullability(contract.domain, ({ model, relation }) => {
26
+ const { ownsForeignKey, columns } = resolveSqlToOneRelationStorage(contract, blindCast(model.storage), relation);
27
+ return {
28
+ ownsReference: ownsForeignKey,
29
+ localFieldNullability: columns.map((column) => column.nullable)
30
+ };
31
+ });
32
+ return {
33
+ ...contract,
34
+ domain
35
+ };
36
+ }
37
+ /**
19
38
  * SQL family `ContractSerializer` abstract base. Carries the SQL-shared
20
39
  * deserialization pipeline:
21
40
  *
@@ -49,7 +68,7 @@ var SqlContractSerializerBase = class {
49
68
  this.contractSchema = packEntityKinds.length > 0 ? createSqlContractSchema(this.entryKinds) : void 0;
50
69
  }
51
70
  deserializeContract(json) {
52
- const validated = this.parseSqlContractStructure(json);
71
+ const validated = withSqlToOneRelationNullability(this.parseSqlContractStructure(json));
53
72
  const hydrated = this.hydrateSqlStorage(validated);
54
73
  return this.constructTargetContract(hydrated);
55
74
  }
@@ -168,4 +187,4 @@ var SqlContractSerializer = class extends SqlContractSerializerBase {
168
187
  //#endregion
169
188
  export { SqlContractSerializerBase as n, SqlContractSerializer as t };
170
189
 
171
- //# sourceMappingURL=sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs.map
190
+ //# sourceMappingURL=sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-contract-serializer-Bxu4a5oQ-D0lKpb4a.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/sql-contract-serializer-Bxu4a5oQ.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { SqlStorage, isMaterializedSqlNamespace } from \"@internal/sql-contract/types\";\nimport { ContractValidationError } from \"@internal/contract/contract-validation-error\";\nimport { isPlainRecord as isPlainRecord$1 } from \"@internal/contract/is-plain-record\";\nimport { withDerivedToOneRelationNullability } from \"@internal/contract-authoring\";\nimport { composeSqlEntityKinds } from \"@internal/sql-contract/entity-kinds\";\nimport { createSqlContractSchema, resolveSqlToOneRelationStorage, validateSqlContractFully } from \"@internal/sql-contract/validators\";\nimport { type } from \"arktype\";\n//#region src/core/ir/sql-contract-serializer-base.ts\nconst NamespaceRawSchema = type({\n\tid: \"string\",\n\t\"kind?\": \"string\",\n\tentries: type({ \"+\": \"ignore\" })\n});\n/**\n* A `contract.json` written before to-one relations recorded `nullable` (rc.9 and earlier)\n* loads with the flag derived from storage: nullable when any local FK column is nullable or\n* cannot be resolved.\n*/\nfunction withSqlToOneRelationNullability(contract) {\n\tconst domain = withDerivedToOneRelationNullability(contract.domain, ({ model, relation }) => {\n\t\tconst { ownsForeignKey, columns } = resolveSqlToOneRelationStorage(contract, blindCast(model.storage), relation);\n\t\treturn {\n\t\t\townsReference: ownsForeignKey,\n\t\t\tlocalFieldNullability: columns.map((column) => column.nullable)\n\t\t};\n\t});\n\treturn {\n\t\t...contract,\n\t\tdomain\n\t};\n}\n/**\n* SQL family `ContractSerializer` abstract base. Carries the SQL-shared\n* deserialization pipeline:\n*\n* 1. `parseSqlContractStructure` validates the on-disk JSON envelope\n* against the SQL contract arktype schema (`validateSqlContractFully`)\n* and returns the validated flat-data shape.\n* 2. `hydrateSqlStorage` walks the validated `storage` subtree and\n* constructs the family-shared SQL Contract IR class hierarchy\n* (`SqlStorage` -> `StorageTable` -> `StorageColumn` / `PrimaryKey`\n* / …). The rest of the contract envelope is JSON-clean primitive\n* data and passes through unchanged.\n* 3. `constructTargetContract` is the target-specific extension hook;\n* defaults to identity. Targets that need to attach target-only\n* fields (e.g. target-specific derived storage fields) override it.\n*\n* Default `serializeContract` is identity over the contract — concrete\n* SQL targets ship JSON-clean class instances, so the contract value\n* can be stringified directly. The non-enumerable family-level `kind`\n* discriminator on `SqlNode` instances stays out of the persisted\n* envelope automatically. Targets that need to canonicalize on the way\n* out (key ordering, dropping computed-only fields) override\n* `serializeContract` directly.\n*/\nvar SqlContractSerializerBase = class {\n\tentityHydrationRegistry;\n\tcontractSchema;\n\tentryKinds;\n\tconstructor(entityHydrationRegistry = /* @__PURE__ */ new Map(), packEntityKinds = []) {\n\t\tthis.entityHydrationRegistry = entityHydrationRegistry;\n\t\tthis.entryKinds = composeSqlEntityKinds(packEntityKinds);\n\t\tthis.contractSchema = packEntityKinds.length > 0 ? createSqlContractSchema(this.entryKinds) : void 0;\n\t}\n\tdeserializeContract(json) {\n\t\tconst validated = withSqlToOneRelationNullability(this.parseSqlContractStructure(json));\n\t\tconst hydrated = this.hydrateSqlStorage(validated);\n\t\treturn this.constructTargetContract(hydrated);\n\t}\n\tserializeContract(contract) {\n\t\treturn contract;\n\t}\n\tshouldPreserveEmpty = sqlContractCanonicalizationHooks.shouldPreserveEmpty;\n\tsortStorage = sqlContractCanonicalizationHooks.sortStorage;\n\tparseSqlContractStructure(json) {\n\t\treturn validateSqlContractFully(json, this.contractSchema !== void 0 ? { contractSchema: this.contractSchema } : void 0);\n\t}\n\thydrateSqlStorage(validated) {\n\t\tconst types = validated.storage.types;\n\t\tconst hydratedTypes = types !== void 0 ? Object.fromEntries(Object.entries(types).map(([name, entry]) => [name, this.hydrateStorageTypeEntry(entry)])) : void 0;\n\t\tconst rawNamespaces = validated.storage.namespaces;\n\t\tif (rawNamespaces === void 0) throw new ContractValidationError(\"Contract storage.namespaces is required after structural validation\", \"structural\");\n\t\tconst hydratedNamespaces = this.hydrateSqlNamespaceMap(blindCast(rawNamespaces));\n\t\treturn {\n\t\t\t...validated,\n\t\t\tstorage: new SqlStorage({\n\t\t\t\tstorageHash: validated.storage.storageHash,\n\t\t\t\t...ifDefined(\"types\", hydratedTypes),\n\t\t\t\tnamespaces: blindCast(hydratedNamespaces)\n\t\t\t})\n\t\t};\n\t}\n\thydrateSqlNamespaceMap(namespaces) {\n\t\treturn Object.fromEntries(Object.entries(namespaces).map(([nsId, namespaceEntryRaw]) => {\n\t\t\tconst namespaceHydrated = this.hydrateSqlNamespaceEntry(nsId, namespaceEntryRaw);\n\t\t\tif (!isMaterializedSqlNamespace(namespaceHydrated)) throw sqlFamilyError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Target serializer bug: hydrateSqlNamespaceEntry for namespace \"${nsId}\" returned a non-NamespaceBase value. Override hydrateSqlNamespaceEntry to produce a target namespace concretion.`, {\n\t\t\t\twhy: \"The target contract serializer hydrated a namespace into a value that is not a materialized namespace concretion.\",\n\t\t\t\tfix: \"Fix the target package: its hydrateSqlNamespaceEntry override must return a target namespace concretion.\",\n\t\t\t\tmeta: { namespaceId: nsId }\n\t\t\t});\n\t\t\treturn [nsId, namespaceHydrated];\n\t\t}));\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst id = typeof raw[\"id\"] === \"string\" ? raw[\"id\"] : nsId;\n\t\tconst parsed = NamespaceRawSchema({\n\t\t\t...raw,\n\t\t\tid\n\t\t});\n\t\tif (parsed instanceof type.errors) throw new ContractValidationError(`Namespace hydration failed: ${parsed.map((p) => p.message).join(\"; \")}`, \"structural\");\n\t\tconst entriesRaw = parsed.entries;\n\t\tconst rawEntriesMap = isPlainRecord$1(entriesRaw) ? entriesRaw : {};\n\t\tconst entriesInput = {};\n\t\tfor (const [key, innerMap] of Object.entries(rawEntriesMap)) entriesInput[key] = isPlainRecord$1(innerMap) ? innerMap : Object.freeze({});\n\t\tconst entriesOutput = hydrateNamespaceEntities(entriesInput, this.entryKinds, \"fail\", id);\n\t\tif (!Object.hasOwn(entriesOutput, \"table\")) entriesOutput[\"table\"] = {};\n\t\treturn blindCast({\n\t\t\tid,\n\t\t\tentries: entriesOutput\n\t\t});\n\t}\n\thydrateStorageTypeEntry(entry) {\n\t\tif (typeof entry !== \"object\" || entry === null) return entry;\n\t\tconst kind = entry.kind;\n\t\tif (typeof kind !== \"string\") return entry;\n\t\tconst factory = this.entityHydrationRegistry.get(kind);\n\t\tif (factory === void 0) return entry;\n\t\treturn blindCast(factory(entry));\n\t}\n\tconstructTargetContract(hydrated) {\n\t\treturn hydrated;\n\t}\n\t/**\n\t* Serializes a namespace's `entries` dict by walking every enumerable\n\t* kind — no kind is named here, mirroring the generic hydrate walk in\n\t* `hydrateSqlNamespaceEntry` above. `table` is the SQL family's one\n\t* universal base kind (every namespace carries it), so it is always\n\t* emitted, even when empty; every other kind — target- or\n\t* pack-contributed — is emitted only when it holds at least one entry.\n\t* A kind carried non-enumerable on `entries` is excluded here for free,\n\t* since `Object.entries` honors enumerability.\n\t*/\n\tserializeNamespaceEntries(entries) {\n\t\tconst out = { table: this.serializeEntries(entries[\"table\"] ?? {}) };\n\t\tfor (const [kind, record] of Object.entries(entries)) {\n\t\t\tif (kind === \"table\" || record == null || Object.keys(record).length === 0) continue;\n\t\t\tout[kind] = this.serializeEntries(record);\n\t\t}\n\t\treturn out;\n\t}\n\tserializeEntries(entries) {\n\t\tconst out = {};\n\t\tfor (const [name, entry] of Object.entries(entries)) out[name] = this.serializeJsonObject(entry);\n\t\treturn out;\n\t}\n\tserializeJsonObject(value) {\n\t\treturn blindCast(this.serializeJsonValue(value));\n\t}\n\tserializeJsonValue(value) {\n\t\treturn blindCast(JSON.parse(JSON.stringify(value)));\n\t}\n};\n//#endregion\n//#region src/core/ir/sql-contract-serializer.ts\n/**\n* Default SQL family `ContractSerializer` concretion. Inherits the\n* full SQL-shared deserialization pipeline (structural validation +\n* IR-class hydration) without pack-registered `storage.types`\n* hydration factories — targets that emit polymorphic JSON outside the\n* codec-typed envelope wire a target-specific subclass with a populated\n* registry (see Postgres). Family-level call sites instantiate this\n* default directly when no target serializer is supplied.\n*\n* Because this serializer has no target concretion, deserialization of\n* contracts that include namespace entries from JSON will throw unless\n* the caller provides pre-hydrated `NamespaceBase` instances. Production\n* paths always supply a target-specific serializer.\n*/\nvar SqlContractSerializer = class extends SqlContractSerializerBase {\n\tconstructor() {\n\t\tsuper(/* @__PURE__ */ new Map());\n\t}\n};\n//#endregion\nexport { SqlContractSerializerBase as n, SqlContractSerializer as t };\n\n//# sourceMappingURL=sql-contract-serializer-Bxu4a5oQ.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,qBAAqB,KAAK;CAC/B,IAAI;CACJ,SAAS;CACT,SAAS,KAAK,EAAE,KAAK,SAAS,CAAC;AAChC,CAAC;;;;;;AAMD,SAAS,gCAAgC,UAAU;CAClD,MAAM,SAAS,oCAAoC,SAAS,SAAS,EAAE,OAAO,eAAe;EAC5F,MAAM,EAAE,gBAAgB,YAAY,+BAA+B,UAAU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MAAM,UAAU,KAAK,wBAAwB,IAAI,IAAI;EACrD,IAAI,YAAY,KAAK,GAAG,OAAO;EAC/B,OAAO,UAAU,QAAQ,KAAK,CAAC;CAChC;CACA,wBAAwB,UAAU;EACjC,OAAO;CACR;;;;;;;;;;;CAWA,0BAA0B,SAAS;EAClC,MAAM,MAAM,EAAE,OAAO,KAAK,iBAAiB,QAAQ,YAAY,CAAC,CAAC,EAAE;EACnE,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,OAAO,GAAG;GACrD,IAAI,SAAS,WAAW,UAAU,QAAQ,OAAO,KAAK,MAAM,CAAC,CAAC,WAAW,GAAG;GAC5E,IAAI,QAAQ,KAAK,iBAAiB,MAAM;EACzC;EACA,OAAO;CACR;CACA,iBAAiB,SAAS;EACzB,MAAM,MAAM,CAAC;EACb,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,OAAO,GAAG,IAAI,QAAQ,KAAK,oBAAoB,KAAK;EAC/F,OAAO;CACR;CACA,oBAAoB,OAAO;EAC1B,OAAO,UAAU,KAAK,mBAAmB,KAAK,CAAC;CAChD;CACA,mBAAmB,OAAO;EACzB,OAAO,UAAU,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC,CAAC;CACnD;AACD;;;;;;;;;;;;;;;AAiBA,IAAI,wBAAwB,cAAc,0BAA0B;CACnE,cAAc;EACb,sBAAsB,IAAI,IAAI,CAAC;CAChC;AACD"}
@@ -1,6 +1,6 @@
1
- import { m as AnyQueryAst } from "./types-DH6Sqzxu-DfzaLX0o.mjs";
1
+ import { m as AnyQueryAst } from "./types-v3qxLLxo-Clw_yBAh.mjs";
2
2
  import { ExecutionPlan } from "@prisma/orm-framework/components/runtime";
3
- //#region ../../../2-sql/4-lanes/relational-core/dist/sql-execution-plan-D0ZTnszb.d.mts
3
+ //#region ../../../2-sql/4-lanes/relational-core/dist/sql-execution-plan--jKyLpe5.d.mts
4
4
  //#region src/sql-execution-plan.d.ts
5
5
  /**
6
6
  * SQL-domain execution plan: a query lowered to the wire-level shape that a
@@ -18,9 +18,8 @@ import { ExecutionPlan } from "@prisma/orm-framework/components/runtime";
18
18
  * can be parameterized over it.
19
19
  *
20
20
  * Co-located with `SqlQueryPlan` (its pre-lowering counterpart) in the lanes
21
- * layer because lane-level utilities (`RawTemplateFactory`, `RawFactory`,
22
- * `SqlPlan`) compose against the executable shape and the lanes layer cannot
23
- * depend on the runtime layer.
21
+ * layer because lane-level utilities (`SqlPlan`) compose against the
22
+ * executable shape and the lanes layer cannot depend on the runtime layer.
24
23
  */
25
24
  interface SqlExecutionPlan<Row = unknown> extends ExecutionPlan<Row> {
26
25
  readonly sql: string;
@@ -29,4 +28,4 @@ interface SqlExecutionPlan<Row = unknown> extends ExecutionPlan<Row> {
29
28
  }
30
29
  //#endregion
31
30
  export { SqlExecutionPlan as t };
32
- //# sourceMappingURL=sql-execution-plan-D0ZTnszb-DnCRtfQO.d.mts.map
31
+ //# sourceMappingURL=sql-execution-plan--jKyLpe5-Bcz9QM2s.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-execution-plan--jKyLpe5-Bcz9QM2s.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/sql-execution-plan--jKyLpe5.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;UAsBU,iBAAiB,uBAAuB,cAAc;WACrD;WACA;WACA,KAAK"}
@@ -1,4 +1,4 @@
1
- //#region ../../../2-sql/9-family/dist/timestamp-now-generator-DRXygu32.mjs
1
+ //#region ../../../2-sql/9-family/dist/timestamp-now-generator-BZnBo7IC.mjs
2
2
  /**
3
3
  * Canonical id for the wall-clock-now mutation default generator.
4
4
  *
@@ -40,16 +40,17 @@ function timestampNowControlDescriptor() {
40
40
  /**
41
41
  * Builds the canonical `temporal.{createdAt,updatedAt}` field-preset pair
42
42
  * for a SQL target. `createdAt` lowers to a `now()` storage default;
43
- * `updatedAt` lowers to the `timestampNow` execution generator on both
44
- * `onCreate` and `onUpdate` (RD: "last modified time", non-null). Targets
45
- * supply the codec/native-type pair that matches their timestamp column;
46
- * everything else is shared so PSL `temporal.updatedAt()` and TS
43
+ * `updatedAt` lowers to an execution generator on both `onCreate` and
44
+ * `onUpdate` (RD: "last modified time", non-null). Targets supply the
45
+ * codec/native-type pair that matches their timestamp column; everything
46
+ * else is shared so PSL `temporal.updatedAt()` and TS
47
47
  * `field.temporal.updatedAt()` lower to byte-identical contracts across
48
48
  * targets by construction.
49
49
  */
50
50
  /* @__NO_SIDE_EFFECTS__ */
51
51
  function temporalAuthoringPresets(input) {
52
52
  const { codecId, nativeType } = input;
53
+ const generatorId = input.generatorId ?? "timestampNow";
53
54
  return {
54
55
  createdAt: {
55
56
  kind: "fieldPreset",
@@ -70,17 +71,24 @@ function temporalAuthoringPresets(input) {
70
71
  executionDefaults: {
71
72
  onCreate: {
72
73
  kind: "generator",
73
- id: TIMESTAMP_NOW_GENERATOR_ID
74
+ id: generatorId
74
75
  },
75
76
  onUpdate: {
76
77
  kind: "generator",
77
- id: TIMESTAMP_NOW_GENERATOR_ID
78
+ id: generatorId
78
79
  }
79
80
  }
80
81
  }
81
82
  }
82
83
  };
83
84
  }
85
+ function temporalStringAuthoringPresets(input) {
86
+ const presets = /* @__PURE__ */ temporalAuthoringPresets(input);
87
+ return {
88
+ createdAtString: presets.createdAt,
89
+ updatedAtString: presets.updatedAt
90
+ };
91
+ }
84
92
  const TEMPORAL_PRECISION_ARG = {
85
93
  name: "precision",
86
94
  kind: "number",
@@ -101,23 +109,22 @@ const TEMPORAL_ON_UPDATE_ARG = {
101
109
  optional: true
102
110
  };
103
111
  /**
104
- * Selects the `timestampNow` generator descriptor for the preset's `now`
105
- * token. The token is preset vocabulary; the generator id never appears in a
106
- * user's spelling (ADR 169 — `timestampNow` is preset-only).
112
+ * Selects a generator descriptor for the preset's `now` token. The token is preset vocabulary; the
113
+ * generator id never appears in a user's spelling (ADR 169 — these generators are preset-only).
107
114
  */
108
- function temporalPhaseTemplate(index) {
115
+ function temporalPhaseTemplate(index, generatorId) {
109
116
  return {
110
117
  kind: "select",
111
118
  index,
112
119
  cases: { now: {
113
120
  kind: "generator",
114
- id: TIMESTAMP_NOW_GENERATOR_ID
121
+ id: generatorId
115
122
  } }
116
123
  };
117
124
  }
118
125
  /**
119
126
  * Builds a `temporal.<codec>` field preset for a codec that takes a precision
120
- * parameter (`pg/timestamp@1`, `pg/timestamptz@1`). Arguments change field
127
+ * parameter (`pg/timestamp-temporal@1`, `pg/timestamptz-temporal@1`). Arguments change field
121
128
  * properties only — never the codec, which the caller fixes here.
122
129
  *
123
130
  * All three arguments are optional: omitting `precision` omits `typeParams`
@@ -126,6 +133,7 @@ function temporalPhaseTemplate(index) {
126
133
  */
127
134
  /* @__NO_SIDE_EFFECTS__ */
128
135
  function temporalCodecPresetWithPrecision(input) {
136
+ const generatorId = input.generatorId ?? "timestampNow";
129
137
  return {
130
138
  kind: "fieldPreset",
131
139
  args: [
@@ -141,8 +149,8 @@ function temporalCodecPresetWithPrecision(input) {
141
149
  index: 0
142
150
  } },
143
151
  executionDefaults: {
144
- onCreate: temporalPhaseTemplate(1),
145
- onUpdate: temporalPhaseTemplate(2)
152
+ onCreate: temporalPhaseTemplate(1, generatorId),
153
+ onUpdate: temporalPhaseTemplate(2, generatorId)
146
154
  }
147
155
  }
148
156
  };
@@ -161,13 +169,13 @@ function temporalCodecPreset(input) {
161
169
  codecId: input.codecId,
162
170
  nativeType: input.nativeType,
163
171
  executionDefaults: {
164
- onCreate: temporalPhaseTemplate(0),
165
- onUpdate: temporalPhaseTemplate(1)
172
+ onCreate: temporalPhaseTemplate(0, TIMESTAMP_NOW_GENERATOR_ID),
173
+ onUpdate: temporalPhaseTemplate(1, TIMESTAMP_NOW_GENERATOR_ID)
166
174
  }
167
175
  }
168
176
  };
169
177
  }
170
178
  //#endregion
171
- export { timestampNowControlDescriptor as a, temporalCodecPresetWithPrecision as i, temporalAuthoringPresets as n, temporalCodecPreset as r, TIMESTAMP_NOW_GENERATOR_ID as t };
179
+ export { temporalStringAuthoringPresets as a, temporalCodecPresetWithPrecision as i, temporalAuthoringPresets as n, timestampNowControlDescriptor as o, temporalCodecPreset as r, TIMESTAMP_NOW_GENERATOR_ID as t };
172
180
 
173
- //# sourceMappingURL=timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map
181
+ //# sourceMappingURL=timestamp-now-generator-BZnBo7IC-DbN5Apqe.mjs.map