@prisma/orm-family-sql 8.0.0-rc.2-dev.2 → 8.0.0-rc.20

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 (564) hide show
  1. package/README.md +2 -6
  2. package/dist/{aggregate-descriptor-registry-C7hel5O7.mjs → aggregate-descriptor-registry-ZrKjxwQe.mjs} +5 -5
  3. package/dist/aggregate-descriptor-registry-ZrKjxwQe.mjs.map +1 -0
  4. package/dist/ast-D0miQ1B6.mjs +372 -0
  5. package/dist/ast-D0miQ1B6.mjs.map +1 -0
  6. package/dist/ast-YEMe_B8z.d.mts +292 -0
  7. package/dist/ast-YEMe_B8z.d.mts.map +1 -0
  8. package/dist/attribute-specs-DA_RwQFB.d.mts +114 -0
  9. package/dist/attribute-specs-DA_RwQFB.d.mts.map +1 -0
  10. package/dist/{authored-check-naming-Hf9990DV.mjs → authored-check-naming-BHGJhjqn.mjs} +5 -5
  11. package/dist/authored-check-naming-BHGJhjqn.mjs.map +1 -0
  12. package/dist/{authored-check-naming-BWBe-PVE.d.mts → authored-check-naming-D-o196ry.d.mts} +3 -3
  13. package/dist/authored-check-naming-D-o196ry.d.mts.map +1 -0
  14. package/dist/authoring-entity-types-CgKIgWq5-pEdfjam5.d.mts +9 -0
  15. package/dist/authoring-entity-types-CgKIgWq5-pEdfjam5.d.mts.map +1 -0
  16. package/dist/builder.d.mts +4 -3
  17. package/dist/builder__runtime.d.mts +29 -31
  18. package/dist/builder__runtime.d.mts.map +1 -1
  19. package/dist/builder__runtime.mjs +261 -191
  20. package/dist/builder__runtime.mjs.map +1 -1
  21. package/dist/builder__types.d.mts +6 -3
  22. package/dist/{canonicalization-hooks-dmXkOR4a.mjs → canonicalization-hooks-Ce1v_TDl.mjs} +2 -2
  23. package/dist/canonicalization-hooks-Ce1v_TDl.mjs.map +1 -0
  24. package/dist/{canonicalization-hooks-CYnW_sGn.d.mts → canonicalization-hooks-DyapQ0my.d.mts} +2 -2
  25. package/dist/canonicalization-hooks-DyapQ0my.d.mts.map +1 -0
  26. package/dist/{check-constraint-B7qGu6rc-HvQjjX82.d.mts → check-constraint-B7qGu6rc-Bk2ezWXu.d.mts} +4 -4
  27. package/dist/check-constraint-B7qGu6rc-Bk2ezWXu.d.mts.map +1 -0
  28. package/dist/{codec-descriptor-registry-N0dhtKaH.mjs → codec-descriptor-registry-CiiFzMtb.mjs} +13 -40
  29. package/dist/codec-descriptor-registry-CiiFzMtb.mjs.map +1 -0
  30. package/dist/collection-methods-BB8YH69u.d.mts +1 -0
  31. package/dist/collection-methods-D2UnCS0S-DOy2qHYS.d.mts +77 -0
  32. package/dist/collection-methods-D2UnCS0S-DOy2qHYS.d.mts.map +1 -0
  33. package/dist/{config-types-D9fdKG3g.d.mts → config-types-C-1mIiJO.d.mts} +5 -5
  34. package/dist/config-types-C-1mIiJO.d.mts.map +1 -0
  35. package/dist/{config-types-gAm54C_v.mjs → config-types-DkEeq_qq.mjs} +10 -6
  36. package/dist/config-types-DkEeq_qq.mjs.map +1 -0
  37. package/dist/{contract-builder-D4a5dT7j.mjs → contract-builder-50lF0kz1.mjs} +431 -226
  38. package/dist/contract-builder-50lF0kz1.mjs.map +1 -0
  39. package/dist/contract-builder-C_Zi57iD.d.mts +1967 -0
  40. package/dist/contract-builder-C_Zi57iD.d.mts.map +1 -0
  41. package/dist/contract-emitter.d.mts +4 -7
  42. package/dist/contract-emitter.d.mts.map +1 -1
  43. package/dist/contract-emitter.mjs +1 -1
  44. package/dist/{contract-errors-BCN6RVI5-5IHBF_lg.mjs → contract-errors-BCN6RVI5-DoH6b_KZ.mjs} +2 -2
  45. package/dist/contract-errors-BCN6RVI5-DoH6b_KZ.mjs.map +1 -0
  46. package/dist/contract-prisma7__provider.d.mts +97 -0
  47. package/dist/contract-prisma7__provider.d.mts.map +1 -0
  48. package/dist/contract-prisma7__provider.mjs +2011 -0
  49. package/dist/contract-prisma7__provider.mjs.map +1 -0
  50. package/dist/contract-psl.d.mts +18 -29
  51. package/dist/contract-psl.d.mts.map +1 -1
  52. package/dist/contract-psl.mjs +1 -1
  53. package/dist/contract-psl__attribute-specs.d.mts +2 -0
  54. package/dist/contract-psl__attribute-specs.mjs +2 -0
  55. package/dist/contract-psl__default-table-name.d.mts +7 -0
  56. package/dist/contract-psl__default-table-name.d.mts.map +1 -0
  57. package/dist/contract-psl__default-table-name.mjs +2 -0
  58. package/dist/contract-psl__diagnostics.d.mts +12 -0
  59. package/dist/contract-psl__diagnostics.d.mts.map +1 -0
  60. package/dist/contract-psl__diagnostics.mjs +2 -0
  61. package/dist/contract-psl__map-names.d.mts +16 -0
  62. package/dist/contract-psl__map-names.d.mts.map +1 -0
  63. package/dist/contract-psl__map-names.mjs +21 -0
  64. package/dist/contract-psl__map-names.mjs.map +1 -0
  65. package/dist/contract-psl__provider.d.mts +3 -3
  66. package/dist/contract-psl__provider.d.mts.map +1 -1
  67. package/dist/contract-psl__provider.mjs +95 -46
  68. package/dist/contract-psl__provider.mjs.map +1 -1
  69. package/dist/contract-ts.d.mts +5 -5
  70. package/dist/contract-ts.mjs +5 -4
  71. package/dist/contract-ts__config-types.d.mts +1 -1
  72. package/dist/contract-ts__config-types.mjs +1 -1
  73. package/dist/contract-ts__contract-builder.d.mts +4 -4
  74. package/dist/contract-ts__contract-builder.mjs +4 -3
  75. package/dist/{contract-view-BMR5IWk4.mjs → contract-view-DqpzeYeE.mjs} +2 -2
  76. package/dist/contract-view-DqpzeYeE.mjs.map +1 -0
  77. package/dist/{contract-view-CPHxoAEX.d.mts → contract-view-DuB35or0.d.mts} +3 -3
  78. package/dist/contract-view-DuB35or0.d.mts.map +1 -0
  79. package/dist/contract.d.mts +30 -28
  80. package/dist/contract.mjs +23 -18
  81. package/dist/contract__authored-check-naming.d.mts +1 -1
  82. package/dist/contract__authored-check-naming.mjs +1 -1
  83. package/dist/contract__canonicalization-hooks.d.mts +1 -1
  84. package/dist/contract__canonicalization-hooks.mjs +1 -1
  85. package/dist/contract__contract-view.d.mts +1 -1
  86. package/dist/contract__contract-view.mjs +1 -1
  87. package/dist/contract__data-type-support.d.mts +2 -0
  88. package/dist/contract__data-type-support.mjs +2 -0
  89. package/dist/contract__data-type.d.mts +2 -0
  90. package/dist/contract__data-type.mjs +3 -0
  91. package/dist/contract__entity-handle-lowering-hook.d.mts +2 -2
  92. package/dist/contract__entity-handle-lowering-hook.mjs +2 -2
  93. package/dist/contract__entity-kinds.d.mts +1 -1
  94. package/dist/contract__entity-kinds.mjs +1 -1
  95. package/dist/contract__factories.d.mts +1 -1
  96. package/dist/contract__factories.mjs +1 -1
  97. package/dist/contract__foreign-key-materialization.d.mts +2 -2
  98. package/dist/contract__foreign-key-materialization.mjs +3 -2
  99. package/dist/contract__index-naming.d.mts +2 -2
  100. package/dist/contract__index-naming.mjs +2 -2
  101. package/dist/contract__index-type-validation.d.mts +2 -2
  102. package/dist/contract__index-type-validation.mjs +1 -1
  103. package/dist/contract__index-types.d.mts +3 -3
  104. package/dist/contract__index-types.mjs +2 -2
  105. package/dist/contract__referential-action-sql.d.mts +1 -1
  106. package/dist/contract__referential-action-sql.mjs +1 -1
  107. package/dist/contract__resolve-storage-table.d.mts +1 -1
  108. package/dist/contract__resolve-storage-table.mjs +1 -1
  109. package/dist/contract__sql-expression.d.mts +2 -0
  110. package/dist/contract__sql-expression.mjs +2 -0
  111. package/dist/contract__types.d.mts +12 -12
  112. package/dist/contract__types.mjs +4 -4
  113. package/dist/contract__validators.d.mts +2 -2
  114. package/dist/contract__validators.mjs +3 -3
  115. package/dist/contract__value-set-derivation-hook.d.mts +1 -1
  116. package/dist/contract__value-set-derivation-hook.mjs +1 -1
  117. package/dist/control-BK50zF6c.mjs +2721 -0
  118. package/dist/control-BK50zF6c.mjs.map +1 -0
  119. package/dist/control-ChAUdOOu.d.mts +1416 -0
  120. package/dist/control-ChAUdOOu.d.mts.map +1 -0
  121. package/dist/{control-adapter-C99J7aEF-B7eQd7vD.d.mts → control-adapter-Bn0uhplA-BzP2uPqJ.d.mts} +27 -44
  122. package/dist/control-adapter-Bn0uhplA-BzP2uPqJ.d.mts.map +1 -0
  123. package/dist/control-adapter-NZ2kKc4x.d.mts +13 -0
  124. package/dist/control-adapter-NZ2kKc4x.d.mts.map +1 -0
  125. package/dist/control-adapter-SlQkTEwT.mjs +16 -0
  126. package/dist/control-adapter-SlQkTEwT.mjs.map +1 -0
  127. package/dist/data-type-BFSpaotu.mjs +52 -0
  128. package/dist/data-type-BFSpaotu.mjs.map +1 -0
  129. package/dist/data-type-DJIvKQHf.d.mts +158 -0
  130. package/dist/data-type-DJIvKQHf.d.mts.map +1 -0
  131. package/dist/data-type-support-BhSoPUFj.mjs +9 -0
  132. package/dist/data-type-support-BhSoPUFj.mjs.map +1 -0
  133. package/dist/data-type-support-CXpA0ex-.d.mts +7 -0
  134. package/dist/data-type-support-CXpA0ex-.d.mts.map +1 -0
  135. package/dist/{db-D18PrXKW-DvTv4JFn.d.mts → db-D1d75IvM-D4mRDC6w.d.mts} +123 -128
  136. package/dist/db-D1d75IvM-D4mRDC6w.d.mts.map +1 -0
  137. package/dist/{ddl-types-CXx4vPz6-BsgrnSUY.d.mts → ddl-types-By5mT2_S-CdaaFvsX.d.mts} +24 -29
  138. package/dist/ddl-types-By5mT2_S-CdaaFvsX.d.mts.map +1 -0
  139. package/dist/default-mapping-CAOONlKQ-4m07nb-O.d.mts +39 -0
  140. package/dist/default-mapping-CAOONlKQ-4m07nb-O.d.mts.map +1 -0
  141. package/dist/default-table-name-BfFY8qYR-CWZFDX6v.mjs +9 -0
  142. package/dist/default-table-name-BfFY8qYR-CWZFDX6v.mjs.map +1 -0
  143. package/dist/derived-checks-D5HVRvqN-BJx1gwPA.mjs +1508 -0
  144. package/dist/derived-checks-D5HVRvqN-BJx1gwPA.mjs.map +1 -0
  145. package/dist/{derived-checks-DPdD01O0-DGqOFjs6.d.mts → derived-checks-DpPkO6Dt-9U9UJZOo.d.mts} +4 -4
  146. package/dist/derived-checks-DpPkO6Dt-9U9UJZOo.d.mts.map +1 -0
  147. package/dist/diagnostics-RHJxoiIk.mjs +23 -0
  148. package/dist/diagnostics-RHJxoiIk.mjs.map +1 -0
  149. package/dist/{diff-DbTNVm2f.d.mts → diff-1qHOLoUB.d.mts} +23 -10
  150. package/dist/diff-1qHOLoUB.d.mts.map +1 -0
  151. package/dist/diff-C1rFOhek.mjs +21 -0
  152. package/dist/diff-C1rFOhek.mjs.map +1 -0
  153. package/dist/{dist-ZK6oeI5e.mjs → dist-C8Y-PPuE.mjs} +36 -212
  154. package/dist/dist-C8Y-PPuE.mjs.map +1 -0
  155. package/dist/{dist-C_q1_QR9.mjs → dist-CHz1hF8M.mjs} +2 -2
  156. package/dist/dist-CHz1hF8M.mjs.map +1 -0
  157. package/dist/{dist-x6jvtkKM.mjs → dist-CMDXybwm.mjs} +2 -2
  158. package/dist/dist-CMDXybwm.mjs.map +1 -0
  159. package/dist/{driver-types-BQtRkOJ0-Bv2RPSfr.d.mts → driver-types-DRsYeq3j-BimeCnUk.d.mts} +11 -2
  160. package/dist/driver-types-DRsYeq3j-BimeCnUk.d.mts.map +1 -0
  161. package/dist/entity-handle-lowering-hook-BJZSlVVF.mjs +16 -0
  162. package/dist/entity-handle-lowering-hook-BJZSlVVF.mjs.map +1 -0
  163. package/dist/{entity-handle-lowering-hook-CIvRKBfa.d.mts → entity-handle-lowering-hook-BuvLtgFi.d.mts} +8 -11
  164. package/dist/entity-handle-lowering-hook-BuvLtgFi.d.mts.map +1 -0
  165. package/dist/{entity-kinds-B5cUFU22.d.mts → entity-kinds-BPG2xCZV.d.mts} +7 -7
  166. package/dist/entity-kinds-BPG2xCZV.d.mts.map +1 -0
  167. package/dist/{entity-kinds-D7vwoN_T-CCBwFJy0.mjs → entity-kinds-JR5SAm5h-DOH6VUtL.mjs} +31 -28
  168. package/dist/entity-kinds-JR5SAm5h-DOH6VUtL.mjs.map +1 -0
  169. package/dist/{errors-B5g0xWro-mWH2C07F.mjs → errors-B5g0xWro-C8plbqga.mjs} +2 -2
  170. package/dist/errors-B5g0xWro-C8plbqga.mjs.map +1 -0
  171. package/dist/errors.d.mts +1 -1
  172. package/dist/errors.d.mts.map +1 -1
  173. package/dist/errors.mjs +1 -1
  174. package/dist/exports-C3wGYtID-D65DEUTC.mjs +2389 -0
  175. package/dist/exports-C3wGYtID-D65DEUTC.mjs.map +1 -0
  176. package/dist/{expression-FJK6Ar-d.d.mts → expression-6ld_ZQL6-fOuazzzm.d.mts} +37 -16
  177. package/dist/expression-6ld_ZQL6-fOuazzzm.d.mts.map +1 -0
  178. package/dist/expression-CieaNuRM-B1uVqxwd.d.mts +22 -0
  179. package/dist/expression-CieaNuRM-B1uVqxwd.d.mts.map +1 -0
  180. package/dist/expression-D8HstQiB.d.mts +2 -0
  181. package/dist/{expression-CX5mTA-z.mjs → expression-impl-B-XNINxr-BhN2sysZ.mjs} +41 -18
  182. package/dist/expression-impl-B-XNINxr-BhN2sysZ.mjs.map +1 -0
  183. package/dist/{factories-SVor5xIT.mjs → factories-Crobuxwn.mjs} +27 -20
  184. package/dist/factories-Crobuxwn.mjs.map +1 -0
  185. package/dist/{factories-P3qBQhO-.d.mts → factories-DbNP9qfs.d.mts} +16 -10
  186. package/dist/factories-DbNP9qfs.d.mts.map +1 -0
  187. package/dist/family.d.mts +17 -13
  188. package/dist/family.mjs +17 -12
  189. package/dist/family__control-adapter.d.mts +3 -3
  190. package/dist/family__control-adapter.mjs +2 -1
  191. package/dist/family__control.d.mts +5 -4
  192. package/dist/family__control.mjs +4 -4
  193. package/dist/family__diff.d.mts +2 -3
  194. package/dist/family__diff.mjs +2 -2
  195. package/dist/family__ir.d.mts +1 -1
  196. package/dist/family__ir.mjs +2 -2
  197. package/dist/family__migration.d.mts +1 -1
  198. package/dist/family__migration.mjs +1 -1
  199. package/dist/family__pack.d.mts +2 -249
  200. package/dist/family__pack.mjs +3 -18
  201. package/dist/family__psl-build.d.mts +3 -0
  202. package/dist/family__psl-build.mjs +3 -0
  203. package/dist/family__psl-infer.d.mts +2 -2
  204. package/dist/family__psl-infer.mjs +2 -2
  205. package/dist/family__runtime.d.mts +2 -2
  206. package/dist/family__runtime.mjs +2 -2
  207. package/dist/family__verify.d.mts +1 -1
  208. package/dist/family__verify.mjs +1 -1
  209. package/dist/foreign-key-materialization-48P2V8on.d.mts +98 -0
  210. package/dist/foreign-key-materialization-48P2V8on.d.mts.map +1 -0
  211. package/dist/foreign-key-materialization-BM59w_Xg.mjs +287 -0
  212. package/dist/foreign-key-materialization-BM59w_Xg.mjs.map +1 -0
  213. package/dist/{foreign-key-C-iTPuRT-C9ip8zFx.d.mts → foreign-key-qkDFfG8t-TaK_GYWR.d.mts} +21 -5
  214. package/dist/foreign-key-qkDFfG8t-TaK_GYWR.d.mts.map +1 -0
  215. package/dist/functions-CsOoN7I3.mjs +88 -0
  216. package/dist/functions-CsOoN7I3.mjs.map +1 -0
  217. package/dist/functions-EW-RrRn3.d.mts +73 -0
  218. package/dist/functions-EW-RrRn3.d.mts.map +1 -0
  219. package/dist/generator-functions-D_qdqBV--Bq296cED.mjs +544 -0
  220. package/dist/generator-functions-D_qdqBV--Bq296cED.mjs.map +1 -0
  221. package/dist/index-7nHHQsAj.d.mts +606 -0
  222. package/dist/index-7nHHQsAj.d.mts.map +1 -0
  223. package/dist/{index-C5I8D-MB.d.mts → index-Nqc3OHR_.d.mts} +4 -5
  224. package/dist/index-Nqc3OHR_.d.mts.map +1 -0
  225. package/dist/index-equivalence-DswCiq5l-CGsyPP9B.mjs +109 -0
  226. package/dist/index-equivalence-DswCiq5l-CGsyPP9B.mjs.map +1 -0
  227. package/dist/{index-naming-DREt6js7-CRH27yUv.mjs → index-naming-BOcJT1B3-mG8Fd6KN.mjs} +35 -9
  228. package/dist/index-naming-BOcJT1B3-mG8Fd6KN.mjs.map +1 -0
  229. package/dist/{index-naming-Ct65z5Xk.d.mts → index-naming-Cs6wwia3.d.mts} +15 -5
  230. package/dist/index-naming-Cs6wwia3.d.mts.map +1 -0
  231. package/dist/index-reference-4wsdeB7v-DCwswK-q.d.mts +67 -0
  232. package/dist/index-reference-4wsdeB7v-DCwswK-q.d.mts.map +1 -0
  233. package/dist/index-reference-BQSrkRfT.mjs +55 -0
  234. package/dist/index-reference-BQSrkRfT.mjs.map +1 -0
  235. package/dist/index-reference-D8ewQRJr.d.mts +1 -0
  236. package/dist/index-type-validation-DJEMmmw0.mjs +42 -0
  237. package/dist/index-type-validation-DJEMmmw0.mjs.map +1 -0
  238. package/dist/index-type-validation-fGGwAHWc.d.mts +16 -0
  239. package/dist/index-type-validation-fGGwAHWc.d.mts.map +1 -0
  240. package/dist/index-types-H1O43iYT-BD0VwPqV.d.mts +66 -0
  241. package/dist/index-types-H1O43iYT-BD0VwPqV.d.mts.map +1 -0
  242. package/dist/index-types-pC_5vADQ-BOOBi14R.mjs +95 -0
  243. package/dist/index-types-pC_5vADQ-BOOBi14R.mjs.map +1 -0
  244. package/dist/index-types-snhtt_Fo.d.mts +1 -0
  245. package/dist/interpreter-D5qk4B---CG0C7kdx.mjs +2280 -0
  246. package/dist/interpreter-D5qk4B---CG0C7kdx.mjs.map +1 -0
  247. package/dist/{ir-Bghjt-FG.d.mts → ir-BvptQsFW.d.mts} +11 -5
  248. package/dist/ir-BvptQsFW.d.mts.map +1 -0
  249. package/dist/{ir-I-xciGUH.mjs → ir-DzsUDO8e.mjs} +2 -2
  250. package/dist/ir-DzsUDO8e.mjs.map +1 -0
  251. package/dist/{middleware-AhTz1BOW-th-Suxuf.d.mts → middleware-DHkW6pRr-DM6hd9iZ.d.mts} +5 -5
  252. package/dist/middleware-DHkW6pRr-DM6hd9iZ.d.mts.map +1 -0
  253. package/dist/middleware-gqy3l13N.d.mts +1 -0
  254. package/dist/{middleware-CMr4CHNz-DHIUdxlm.mjs → middleware-yBAfiVWn-DZO0vCRQ.mjs} +3 -3
  255. package/dist/middleware-yBAfiVWn-DZO0vCRQ.mjs.map +1 -0
  256. package/dist/{migration-CK4oePIo.mjs → migration-BJQjkqFz.mjs} +4 -4
  257. package/dist/migration-BJQjkqFz.mjs.map +1 -0
  258. package/dist/{migration-CjDRZNep.d.mts → migration-Cxmpzaz0.d.mts} +6 -6
  259. package/dist/migration-Cxmpzaz0.d.mts.map +1 -0
  260. package/dist/{naming-CV9j2pXl-KARaDReS.d.mts → naming-BcD36g9T-Mfe_xGGL.d.mts} +9 -14
  261. package/dist/naming-BcD36g9T-Mfe_xGGL.d.mts.map +1 -0
  262. package/dist/{naming-DKr4TJd7-Cszhq9RV.mjs → naming-bM5qm5PY-jOg3JFMb.mjs} +20 -31
  263. package/dist/naming-bM5qm5PY-jOg3JFMb.mjs.map +1 -0
  264. package/dist/{ddl-types-BGdnAbXo-DKPHPUGx.mjs → opaque-sql-Dset3kln-CtsPDTXn.mjs} +24 -11
  265. package/dist/opaque-sql-Dset3kln-CtsPDTXn.mjs.map +1 -0
  266. package/dist/operations.d.mts +1 -1
  267. package/dist/operations.mjs +1 -1
  268. package/dist/orm-client.d.mts +817 -267
  269. package/dist/orm-client.d.mts.map +1 -1
  270. package/dist/orm-client.mjs +4719 -2942
  271. package/dist/orm-client.mjs.map +1 -1
  272. package/dist/pack-DA8HZ2mo.d.mts +535 -0
  273. package/dist/pack-DA8HZ2mo.d.mts.map +1 -0
  274. package/dist/pack-gSvGQWqs.mjs +80 -0
  275. package/dist/pack-gSvGQWqs.mjs.map +1 -0
  276. package/dist/{plan-CDxduYaN-pLIyyJaB.d.mts → plan-Cr4azjnG-CuL8FqXC.d.mts} +12 -8
  277. package/dist/plan-Cr4azjnG-CuL8FqXC.d.mts.map +1 -0
  278. package/dist/{plan-Dh0LbYIv-Crx5-ThG.mjs → plan-Dh0LbYIv-ubBSdUgl.mjs} +2 -2
  279. package/dist/plan-Dh0LbYIv-ubBSdUgl.mjs.map +1 -0
  280. package/dist/plan-Di6Gs2JD.d.mts +2 -0
  281. package/dist/psl-attribute-parsing-BCsFWsSp-BJ-wGlY6.mjs +42 -0
  282. package/dist/psl-attribute-parsing-BCsFWsSp-BJ-wGlY6.mjs.map +1 -0
  283. package/dist/psl-build-DFBG6vhz.mjs +426 -0
  284. package/dist/psl-build-DFBG6vhz.mjs.map +1 -0
  285. package/dist/psl-build-RelubU2E.d.mts +112 -0
  286. package/dist/psl-build-RelubU2E.d.mts.map +1 -0
  287. package/dist/psl-column-resolution-ChZqioOc-BREg4J7d.d.mts +24 -0
  288. package/dist/psl-column-resolution-ChZqioOc-BREg4J7d.d.mts.map +1 -0
  289. package/dist/psl-field-resolution-C5KQ7kzP-B0NwuRWV.mjs +1960 -0
  290. package/dist/psl-field-resolution-C5KQ7kzP-B0NwuRWV.mjs.map +1 -0
  291. package/dist/psl-infer--g4i84Go.mjs +201 -0
  292. package/dist/psl-infer--g4i84Go.mjs.map +1 -0
  293. package/dist/psl-infer-DzoxPZGd.d.mts +80 -0
  294. package/dist/psl-infer-DzoxPZGd.d.mts.map +1 -0
  295. package/dist/psl-names-C3cwe0rg-D1CTmC3a.mjs +66 -0
  296. package/dist/psl-names-C3cwe0rg-D1CTmC3a.mjs.map +1 -0
  297. package/dist/{query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts → query-lane-context-BCEoKy0_-CzmyavC9.d.mts} +20 -49
  298. package/dist/query-lane-context-BCEoKy0_-CzmyavC9.d.mts.map +1 -0
  299. package/dist/query-lane-context-VqH0mS9B.d.mts +1 -0
  300. package/dist/{referential-action-sql-DJ9ps6-S.d.mts → referential-action-sql-B2vKoUK6.d.mts} +3 -3
  301. package/dist/referential-action-sql-B2vKoUK6.d.mts.map +1 -0
  302. package/dist/{referential-action-sql-DSqkrySN.mjs → referential-action-sql-BLzCtTi8.mjs} +2 -2
  303. package/dist/referential-action-sql-BLzCtTi8.mjs.map +1 -0
  304. package/dist/relational-core.d.mts +14 -13
  305. package/dist/relational-core.mjs +8 -8
  306. package/dist/relational-core__aggregate-descriptor-registry.d.mts +2 -2
  307. package/dist/relational-core__aggregate-descriptor-registry.d.mts.map +1 -1
  308. package/dist/relational-core__aggregate-descriptor-registry.mjs +1 -1
  309. package/dist/relational-core__ast.d.mts +5 -5
  310. package/dist/relational-core__ast.mjs +5 -5
  311. package/dist/relational-core__codec-descriptor-registry.d.mts +7 -8
  312. package/dist/relational-core__codec-descriptor-registry.d.mts.map +1 -1
  313. package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
  314. package/dist/relational-core__collection-methods.d.mts +3 -0
  315. package/dist/relational-core__contract-free.d.mts +18 -8
  316. package/dist/relational-core__contract-free.d.mts.map +1 -1
  317. package/dist/relational-core__contract-free.mjs +26 -10
  318. package/dist/relational-core__contract-free.mjs.map +1 -1
  319. package/dist/relational-core__expression.d.mts +4 -2
  320. package/dist/relational-core__expression.mjs +2 -2
  321. package/dist/relational-core__functions.d.mts +2 -0
  322. package/dist/relational-core__functions.mjs +2 -0
  323. package/dist/relational-core__index-reference.d.mts +3 -0
  324. package/dist/relational-core__index-reference.mjs +2 -0
  325. package/dist/relational-core__middleware.d.mts +2 -2
  326. package/dist/relational-core__middleware.mjs +1 -1
  327. package/dist/relational-core__plan.d.mts +4 -4
  328. package/dist/relational-core__plan.mjs +1 -1
  329. package/dist/relational-core__query-lane-context.d.mts +3 -3
  330. package/dist/relational-core__types.d.mts +2 -2
  331. package/dist/{resolve-storage-table-DZsfnzeW.mjs → resolve-storage-table-BHLQsOza.mjs} +3 -3
  332. package/dist/resolve-storage-table-BHLQsOza.mjs.map +1 -0
  333. package/dist/{resolve-storage-table-Nyrgk4h8.d.mts → resolve-storage-table-DCqtmnSU.d.mts} +4 -4
  334. package/dist/resolve-storage-table-DCqtmnSU.d.mts.map +1 -0
  335. package/dist/{runtime-tIHpGCcG.mjs → runtime-6tH1yOxK.mjs} +6 -6
  336. package/dist/runtime-6tH1yOxK.mjs.map +1 -0
  337. package/dist/{runtime-DpKF2Yu2.d.mts → runtime-CF6rAlE5.d.mts} +7 -8
  338. package/dist/runtime-CF6rAlE5.d.mts.map +1 -0
  339. package/dist/runtime.d.mts +5 -5
  340. package/dist/runtime.mjs +2 -1799
  341. package/dist/runtime__internal__prepared-query.d.mts +2 -2
  342. package/dist/runtime__internal__prepared-query.mjs +2 -2
  343. package/dist/{schema-differ-DpG_gnur-DFAtGezx.d.mts → schema-differ-DmP74bB8-tqHKiJ88.d.mts} +6 -6
  344. package/dist/schema-differ-DmP74bB8-tqHKiJ88.d.mts.map +1 -0
  345. package/dist/schema-ir.d.mts +2 -2
  346. package/dist/schema-ir.mjs +2 -2
  347. package/dist/schema-ir__naming.d.mts +1 -1
  348. package/dist/schema-ir__naming.mjs +1 -1
  349. package/dist/schema-ir__types.d.mts +3 -3
  350. package/dist/schema-ir__types.mjs +2 -2
  351. package/dist/{schema-verify-C_PEdlAr-Dxxjm6EM.mjs → schema-verify-C3wbdviw-DMjIubOr.mjs} +50 -8
  352. package/dist/schema-verify-C3wbdviw-DMjIubOr.mjs.map +1 -0
  353. package/dist/{serialized-index-CrgG8ct1-DG3JpHc7.d.mts → serialized-index-CrgG8ct1-DKVJ7TDX.d.mts} +4 -4
  354. package/dist/serialized-index-CrgG8ct1-DKVJ7TDX.d.mts.map +1 -0
  355. package/dist/{serialized-index-nBTwanKy-_ddEK4tk.mjs → serialized-index-DjCCnXB1-DMA7BtO2.mjs} +4 -4
  356. package/dist/serialized-index-DjCCnXB1-DMA7BtO2.mjs.map +1 -0
  357. package/dist/{sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs → sql-contract-serializer-sMY3prTx-D2BfrNxs.mjs} +41 -16
  358. package/dist/sql-contract-serializer-sMY3prTx-D2BfrNxs.mjs.map +1 -0
  359. package/dist/sql-data-type-D7M-YTTY-D2vRqDxn.mjs +400 -0
  360. package/dist/sql-data-type-D7M-YTTY-D2vRqDxn.mjs.map +1 -0
  361. package/dist/{sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts → sql-execution-plan-3uxYjHyu-DLknM-Pj.d.mts} +3 -3
  362. package/dist/sql-execution-plan-3uxYjHyu-DLknM-Pj.d.mts.map +1 -0
  363. package/dist/sql-expression-B4BrhGPi.d.mts +62 -0
  364. package/dist/sql-expression-B4BrhGPi.d.mts.map +1 -0
  365. package/dist/sql-expression-CKgKznXS.mjs +137 -0
  366. package/dist/sql-expression-CKgKznXS.mjs.map +1 -0
  367. package/dist/{sql-index-ByAAE7K8-DKj2V86p.d.mts → sql-index-ByAAE7K8-Dqtn_vUL.d.mts} +4 -4
  368. package/dist/sql-index-ByAAE7K8-Dqtn_vUL.d.mts.map +1 -0
  369. package/dist/{sql-node-kEz6YFZo-v2F7delx.d.mts → sql-node-kEz6YFZo-1ogT6Cxt.d.mts} +2 -2
  370. package/dist/sql-node-kEz6YFZo-1ogT6Cxt.d.mts.map +1 -0
  371. package/dist/{sql-storage-8LqxeLAY-DH4DdUXx.d.mts → sql-storage-DeCAh5Hi-CEM-m8cs.d.mts} +19 -22
  372. package/dist/sql-storage-DeCAh5Hi-CEM-m8cs.d.mts.map +1 -0
  373. package/dist/{storage-table-DSeWszOL-CI-cItEK.d.mts → storage-table-Bf1ZjnxO-pUj6pyP0.d.mts} +17 -24
  374. package/dist/storage-table-Bf1ZjnxO-pUj6pyP0.d.mts.map +1 -0
  375. package/dist/{storage-table-ZzbR-xzQ-BRoTQE_2.mjs → storage-table-DDvN83mw-DkbBFmK9.mjs} +12 -9
  376. package/dist/storage-table-DDvN83mw-DkbBFmK9.mjs.map +1 -0
  377. package/dist/{storage-value-set-BGlj5Uus-CvZD--GG.d.mts → storage-value-set-BGlj5Uus-ny2k-0PA.d.mts} +3 -3
  378. package/dist/storage-value-set-BGlj5Uus-ny2k-0PA.d.mts.map +1 -0
  379. package/dist/transaction-state-BfXhs7D7-DhmbySW9.mjs +45 -0
  380. package/dist/transaction-state-BfXhs7D7-DhmbySW9.mjs.map +1 -0
  381. package/dist/transaction-state-DR3nKTmH-D29jmVE-.d.mts +115 -0
  382. package/dist/transaction-state-DR3nKTmH-D29jmVE-.d.mts.map +1 -0
  383. package/dist/types-B9wSEUsV.d.mts +1 -0
  384. package/dist/{types-CUsJrvEl.mjs → types-CTdSkl0s.mjs} +13 -6
  385. package/dist/types-CTdSkl0s.mjs.map +1 -0
  386. package/dist/types-CkAd8SWm.d.mts +57 -0
  387. package/dist/types-CkAd8SWm.d.mts.map +1 -0
  388. package/dist/{types-IqZMLrFC-DcH8v_u3.d.mts → types-Cq6ImLAB-RlU4jJAX.d.mts} +27 -41
  389. package/dist/types-Cq6ImLAB-RlU4jJAX.d.mts.map +1 -0
  390. package/dist/{types-YStFFkKs-D9UAmnON.d.mts → types-CuCxAQat-Dz8P4xyt.d.mts} +141 -86
  391. package/dist/types-CuCxAQat-Dz8P4xyt.d.mts.map +1 -0
  392. package/dist/types-DfKvtJwS-CrpWTGBJ.d.mts +273 -0
  393. package/dist/types-DfKvtJwS-CrpWTGBJ.d.mts.map +1 -0
  394. package/dist/{types-4YenawkP-CwaaZSid.mjs → types-DoyiTsjg-2YMhMJDA.mjs} +181 -80
  395. package/dist/types-DoyiTsjg-2YMhMJDA.mjs.map +1 -0
  396. package/dist/{types-v3qxLLxo-DCeKv7yY.d.mts → types-DriMIMNQ-BkbsW7w3.d.mts} +68 -34
  397. package/dist/types-DriMIMNQ-BkbsW7w3.d.mts.map +1 -0
  398. package/dist/{types-Dt4e_jC--COeP8xzN.mjs → types-NTQsD2MS-xcLtvKO9.mjs} +83 -17
  399. package/dist/types-NTQsD2MS-xcLtvKO9.mjs.map +1 -0
  400. package/dist/{types-CyxGtOOh-BggSa6Fe.d.mts → types-TXO7x1BA-CYYIY8NI.d.mts} +14 -14
  401. package/dist/types-TXO7x1BA-CYYIY8NI.d.mts.map +1 -0
  402. package/dist/types-ljUNyiWe.d.mts +1 -0
  403. package/dist/{unique-constraint-M5TlQnJQ-BiIHJ85k.d.mts → unique-constraint-M5TlQnJQ-qX-maNUV.d.mts} +3 -3
  404. package/dist/unique-constraint-M5TlQnJQ-qX-maNUV.d.mts.map +1 -0
  405. package/dist/{util-DQQgv2j1-D6INZaRG.mjs → util-BBgcP3gI-CpL-0VuC.mjs} +12 -3
  406. package/dist/util-BBgcP3gI-CpL-0VuC.mjs.map +1 -0
  407. package/dist/{validators-CrWD6bSP.mjs → validators-BwA7ttZM.mjs} +0 -0
  408. package/dist/validators-BwA7ttZM.mjs.map +1 -0
  409. package/dist/{validators-Belo8QqM.d.mts → validators-FJs8HvFr.d.mts} +54 -16
  410. package/dist/validators-FJs8HvFr.d.mts.map +1 -0
  411. package/dist/{value-set-derivation-hook-BhgGVtw0.d.mts → value-set-derivation-hook-3E437jPU.d.mts} +3 -3
  412. package/dist/value-set-derivation-hook-3E437jPU.d.mts.map +1 -0
  413. package/dist/{value-set-derivation-hook-Di9JZ0X7.mjs → value-set-derivation-hook-HVaxhALD.mjs} +2 -2
  414. package/dist/value-set-derivation-hook-HVaxhALD.mjs.map +1 -0
  415. package/dist/{verify-u0UTdZgD-DSAaz9rW.mjs → verify-BVk5bjdH-DhKm6hB3.mjs} +8 -7
  416. package/dist/verify-BVk5bjdH-DhKm6hB3.mjs.map +1 -0
  417. package/dist/{verify-zDRnw0Rn.d.mts → verify-DHXbuZPB.d.mts} +2 -2
  418. package/dist/verify-DHXbuZPB.d.mts.map +1 -0
  419. package/package.json +33 -22
  420. package/dist/aggregate-descriptor-registry-C7hel5O7.mjs.map +0 -1
  421. package/dist/ast-HFcfQZr-.d.mts +0 -206
  422. package/dist/ast-HFcfQZr-.d.mts.map +0 -1
  423. package/dist/ast-Lbl4VwqP.mjs +0 -325
  424. package/dist/ast-Lbl4VwqP.mjs.map +0 -1
  425. package/dist/authored-check-naming-BWBe-PVE.d.mts.map +0 -1
  426. package/dist/authored-check-naming-Hf9990DV.mjs.map +0 -1
  427. package/dist/authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs +0 -316
  428. package/dist/authoring-type-constructors-Blqoa2Ua-DqvNCOb2.mjs.map +0 -1
  429. package/dist/canonicalization-hooks-CYnW_sGn.d.mts.map +0 -1
  430. package/dist/canonicalization-hooks-dmXkOR4a.mjs.map +0 -1
  431. package/dist/check-constraint-B7qGu6rc-HvQjjX82.d.mts.map +0 -1
  432. package/dist/codec-descriptor-registry-N0dhtKaH.mjs.map +0 -1
  433. package/dist/config-types-D9fdKG3g.d.mts.map +0 -1
  434. package/dist/config-types-gAm54C_v.mjs.map +0 -1
  435. package/dist/contract-builder-CG_tGDbB.d.mts +0 -1360
  436. package/dist/contract-builder-CG_tGDbB.d.mts.map +0 -1
  437. package/dist/contract-builder-D4a5dT7j.mjs.map +0 -1
  438. package/dist/contract-errors-BCN6RVI5-5IHBF_lg.mjs.map +0 -1
  439. package/dist/contract-view-BMR5IWk4.mjs.map +0 -1
  440. package/dist/contract-view-CPHxoAEX.d.mts.map +0 -1
  441. package/dist/contract__pack-types.d.mts +0 -2
  442. package/dist/control-D3cB5YQp.mjs +0 -1267
  443. package/dist/control-D3cB5YQp.mjs.map +0 -1
  444. package/dist/control-DTLJ1WtZ.d.mts +0 -945
  445. package/dist/control-DTLJ1WtZ.d.mts.map +0 -1
  446. package/dist/control-adapter-C99J7aEF-B7eQd7vD.d.mts.map +0 -1
  447. package/dist/control-adapter-MZJQiwcE.d.mts +0 -1
  448. package/dist/db-D18PrXKW-DvTv4JFn.d.mts.map +0 -1
  449. package/dist/ddl-types-BGdnAbXo-DKPHPUGx.mjs.map +0 -1
  450. package/dist/ddl-types-CXx4vPz6-BsgrnSUY.d.mts.map +0 -1
  451. package/dist/derived-checks-DFMRmiAu-DGfB8aS4.mjs +0 -1057
  452. package/dist/derived-checks-DFMRmiAu-DGfB8aS4.mjs.map +0 -1
  453. package/dist/derived-checks-DPdD01O0-DGqOFjs6.d.mts.map +0 -1
  454. package/dist/diff-B16bL_IR.mjs +0 -13
  455. package/dist/diff-B16bL_IR.mjs.map +0 -1
  456. package/dist/diff-DbTNVm2f.d.mts.map +0 -1
  457. package/dist/dist-C_q1_QR9.mjs.map +0 -1
  458. package/dist/dist-ZK6oeI5e.mjs.map +0 -1
  459. package/dist/dist-x6jvtkKM.mjs.map +0 -1
  460. package/dist/driver-types-BQtRkOJ0-Bv2RPSfr.d.mts.map +0 -1
  461. package/dist/entity-handle-lowering-hook-CIvRKBfa.d.mts.map +0 -1
  462. package/dist/entity-handle-lowering-hook-DwLIKNiS.mjs +0 -11
  463. package/dist/entity-handle-lowering-hook-DwLIKNiS.mjs.map +0 -1
  464. package/dist/entity-kinds-B5cUFU22.d.mts.map +0 -1
  465. package/dist/entity-kinds-D7vwoN_T-CCBwFJy0.mjs.map +0 -1
  466. package/dist/errors-B5g0xWro-mWH2C07F.mjs.map +0 -1
  467. package/dist/expression-CX5mTA-z.mjs.map +0 -1
  468. package/dist/expression-FJK6Ar-d.d.mts.map +0 -1
  469. package/dist/factories-P3qBQhO-.d.mts.map +0 -1
  470. package/dist/factories-SVor5xIT.mjs.map +0 -1
  471. package/dist/family__pack.d.mts.map +0 -1
  472. package/dist/family__pack.mjs.map +0 -1
  473. package/dist/foreign-key-C-iTPuRT-C9ip8zFx.d.mts.map +0 -1
  474. package/dist/foreign-key-materialization-CkvOzJWy.d.mts +0 -65
  475. package/dist/foreign-key-materialization-CkvOzJWy.d.mts.map +0 -1
  476. package/dist/foreign-key-materialization-Cu7-7LHl.mjs +0 -73
  477. package/dist/foreign-key-materialization-Cu7-7LHl.mjs.map +0 -1
  478. package/dist/index-C-vQOMY_.d.mts +0 -84
  479. package/dist/index-C-vQOMY_.d.mts.map +0 -1
  480. package/dist/index-C5I8D-MB.d.mts.map +0 -1
  481. package/dist/index-naming-Ct65z5Xk.d.mts.map +0 -1
  482. package/dist/index-naming-DREt6js7-CRH27yUv.mjs.map +0 -1
  483. package/dist/index-type-validation-COH4d78M.mjs +0 -17
  484. package/dist/index-type-validation-COH4d78M.mjs.map +0 -1
  485. package/dist/index-type-validation-CZ5L2lli.d.mts +0 -10
  486. package/dist/index-type-validation-CZ5L2lli.d.mts.map +0 -1
  487. package/dist/index-types-CNhHgKHi.d.mts +0 -1
  488. package/dist/index-types-DJQ_xwaE.mjs +0 -40
  489. package/dist/index-types-DJQ_xwaE.mjs.map +0 -1
  490. package/dist/index-types-DPVhsW0v-D-BikM4h.d.mts +0 -31
  491. package/dist/index-types-DPVhsW0v-D-BikM4h.d.mts.map +0 -1
  492. package/dist/interpreter-DyiUUAWh-DYdjIpiE.mjs +0 -3680
  493. package/dist/interpreter-DyiUUAWh-DYdjIpiE.mjs.map +0 -1
  494. package/dist/ir-Bghjt-FG.d.mts.map +0 -1
  495. package/dist/ir-I-xciGUH.mjs.map +0 -1
  496. package/dist/lane-query-builder.d.mts +0 -236
  497. package/dist/lane-query-builder.d.mts.map +0 -1
  498. package/dist/lane-query-builder.mjs +0 -67
  499. package/dist/lane-query-builder.mjs.map +0 -1
  500. package/dist/middleware--TtoxUiW.d.mts +0 -1
  501. package/dist/middleware-AhTz1BOW-th-Suxuf.d.mts.map +0 -1
  502. package/dist/middleware-CMr4CHNz-DHIUdxlm.mjs.map +0 -1
  503. package/dist/migration-CK4oePIo.mjs.map +0 -1
  504. package/dist/migration-CjDRZNep.d.mts.map +0 -1
  505. package/dist/naming-CV9j2pXl-KARaDReS.d.mts.map +0 -1
  506. package/dist/naming-DKr4TJd7-Cszhq9RV.mjs.map +0 -1
  507. package/dist/pack-types-BcLTpwbv.d.mts +0 -14
  508. package/dist/pack-types-BcLTpwbv.d.mts.map +0 -1
  509. package/dist/plan-BHLdb0Z7.d.mts +0 -2
  510. package/dist/plan-CDxduYaN-pLIyyJaB.d.mts.map +0 -1
  511. package/dist/plan-Dh0LbYIv-Crx5-ThG.mjs.map +0 -1
  512. package/dist/prepared-query-BJr50wPm-ChoqfJbX.mjs +0 -22
  513. package/dist/prepared-query-BJr50wPm-ChoqfJbX.mjs.map +0 -1
  514. package/dist/prepared-statement-9QpkE6JG-C430V3MO.d.mts +0 -529
  515. package/dist/prepared-statement-9QpkE6JG-C430V3MO.d.mts.map +0 -1
  516. package/dist/psl-infer-CCAD6FWA.d.mts +0 -119
  517. package/dist/psl-infer-CCAD6FWA.d.mts.map +0 -1
  518. package/dist/psl-infer-Dk5kgKre.mjs +0 -362
  519. package/dist/psl-infer-Dk5kgKre.mjs.map +0 -1
  520. package/dist/query-lane-context-Qa-eddrE-kuZ8Z86-.d.mts.map +0 -1
  521. package/dist/query-lane-context-XMvk7fmY.d.mts +0 -1
  522. package/dist/referential-action-sql-DJ9ps6-S.d.mts.map +0 -1
  523. package/dist/referential-action-sql-DSqkrySN.mjs.map +0 -1
  524. package/dist/resolve-storage-table-DZsfnzeW.mjs.map +0 -1
  525. package/dist/resolve-storage-table-Nyrgk4h8.d.mts.map +0 -1
  526. package/dist/runtime-DpKF2Yu2.d.mts.map +0 -1
  527. package/dist/runtime-tIHpGCcG.mjs.map +0 -1
  528. package/dist/runtime.mjs.map +0 -1
  529. package/dist/schema-differ-DpG_gnur-DFAtGezx.d.mts.map +0 -1
  530. package/dist/schema-verify-C_PEdlAr-Dxxjm6EM.mjs.map +0 -1
  531. package/dist/serialized-index-CrgG8ct1-DG3JpHc7.d.mts.map +0 -1
  532. package/dist/serialized-index-nBTwanKy-_ddEK4tk.mjs.map +0 -1
  533. package/dist/sql-contract-serializer-2oBWuxTe-DKZTf2n8.mjs.map +0 -1
  534. package/dist/sql-execution-plan--jKyLpe5-CMGhgO0M.d.mts.map +0 -1
  535. package/dist/sql-index-ByAAE7K8-DKj2V86p.d.mts.map +0 -1
  536. package/dist/sql-node-kEz6YFZo-v2F7delx.d.mts.map +0 -1
  537. package/dist/sql-storage-8LqxeLAY-DH4DdUXx.d.mts.map +0 -1
  538. package/dist/storage-table-DSeWszOL-CI-cItEK.d.mts.map +0 -1
  539. package/dist/storage-table-ZzbR-xzQ-BRoTQE_2.mjs.map +0 -1
  540. package/dist/storage-value-set-BGlj5Uus-CvZD--GG.d.mts.map +0 -1
  541. package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs +0 -173
  542. package/dist/timestamp-now-generator-DRXygu32-DN9Qb1uI.mjs.map +0 -1
  543. package/dist/types-4YenawkP-CwaaZSid.mjs.map +0 -1
  544. package/dist/types-B0msOnBM.d.mts +0 -1
  545. package/dist/types-BDUG29Df-LE85dIXP.d.mts +0 -161
  546. package/dist/types-BDUG29Df-LE85dIXP.d.mts.map +0 -1
  547. package/dist/types-CUsJrvEl.mjs.map +0 -1
  548. package/dist/types-CyxGtOOh-BggSa6Fe.d.mts.map +0 -1
  549. package/dist/types-Dt4e_jC--COeP8xzN.mjs.map +0 -1
  550. package/dist/types-Dwcw0F8X.d.mts +0 -1
  551. package/dist/types-IqZMLrFC-DcH8v_u3.d.mts.map +0 -1
  552. package/dist/types-UcHa2cTe.d.mts +0 -17
  553. package/dist/types-UcHa2cTe.d.mts.map +0 -1
  554. package/dist/types-YStFFkKs-D9UAmnON.d.mts.map +0 -1
  555. package/dist/types-v3qxLLxo-DCeKv7yY.d.mts.map +0 -1
  556. package/dist/unique-constraint-M5TlQnJQ-BiIHJ85k.d.mts.map +0 -1
  557. package/dist/util-DQQgv2j1-D6INZaRG.mjs.map +0 -1
  558. package/dist/validators-Belo8QqM.d.mts.map +0 -1
  559. package/dist/validators-CrWD6bSP.mjs.map +0 -1
  560. package/dist/value-set-derivation-hook-BhgGVtw0.d.mts.map +0 -1
  561. package/dist/value-set-derivation-hook-Di9JZ0X7.mjs.map +0 -1
  562. package/dist/verify-u0UTdZgD-DSAaz9rW.mjs.map +0 -1
  563. package/dist/verify-zDRnw0Rn.d.mts.map +0 -1
  564. /package/dist/{contract__pack-types.mjs → relational-core__collection-methods.mjs} +0 -0
@@ -1,49 +1,105 @@
1
- import { t as providesEntityHandleLowering } from "./entity-handle-lowering-hook-DwLIKNiS.mjs";
2
- import { u as toStorageTypeInstance } from "./types-CUsJrvEl.mjs";
3
- import { n as buildSqlContractFromDefinition, r as contractError } from "./derived-checks-DFMRmiAu-DGfB8aS4.mjs";
4
- import { assertNoCrossRegistryCollisions, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringTypeConstructorDescriptor, mergeAuthoringNamespaces, validateAuthoringHelperArguments } from "@prisma/orm-framework/components/authoring";
5
- import { InternalError } from "@prisma/orm-framework/utils/internal-error";
6
- import { isColumnDefault } from "@prisma/orm-framework/contract/types";
1
+ import { d as sqlColumnLength } from "./sql-data-type-D7M-YTTY-D2vRqDxn.mjs";
2
+ import { t as providesEntityHandleLowering } from "./entity-handle-lowering-hook-BJZSlVVF.mjs";
3
+ import { a as isSqlExpression, c as requireSqlExpression, r as SqlExpression, s as readSqlExpression } from "./sql-expression-CKgKznXS.mjs";
4
+ import { t as CODEC_INSTANCE_KIND } from "./types-CTdSkl0s.mjs";
5
+ import { n as checkSqlDefaultText, o as reservedSqlDefaultText } from "./validators-BwA7ttZM.mjs";
6
+ import { a as refuseTypesKey, n as buildSqlContractFromDefinition, r as contractError, s as toOneNullabilityContradictionMessage } from "./derived-checks-D5HVRvqN-BJx1gwPA.mjs";
7
+ import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
7
8
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
9
+ import { assembleDataTypeSupport, assertNoCrossRegistryCollisions, assertTypeAliasesValid, describeAdmittedForms, instantiateAuthoringFieldPreset, instantiateAuthoringTypeAlias, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringTypeAliasDescriptor, isAuthoringTypeConstructorDescriptor, readWrittenValueAs, validateAuthoringHelperArguments, validateAuthoringTypeParams } from "@prisma/orm-framework/components/authoring";
10
+ import { dataTypeId, numeralText } from "@prisma/orm-framework/components/codec";
8
11
  import { blindCast } from "@prisma/orm-framework/utils/casts";
9
- import { bindEnumType, createEntityHelpersFromNamespace, enumType, isEnumTypeHandle, member } from "@prisma/orm-framework/contract-authoring";
10
- //#region ../../../2-sql/2-authoring/contract-ts/dist/contract-builder.mjs
12
+ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
13
+ import { isColumnDefault } from "@prisma/orm-framework/contract/types";
14
+ import { assembleGeneratorFunctions, createGeneratorHelpers } from "@prisma/orm-framework/components/components";
15
+ import { assertSafeAuthoringHelperKey, bindEnumType, composePackAuthoringNamespace, createEntityHelpersFromNamespace, createFieldHelpersFromNamespace, enumType, isEnumTypeHandle, member, resolveToOneRelationNullable } from "@prisma/orm-framework/contract-authoring";
16
+ import { UNBOUND_PSL_NAMESPACE_NAME } from "@prisma/orm-framework/components/psl-ast";
17
+ //#region ../../../2-sql-family/2-authoring/contract-ts/dist/contract-builder.mjs
18
+ /** The written value a TypeScript argument stands for: a number, string or boolean as written in PSL, and a `sql` value as a `sql` literal of its text. */
19
+ function writtenValueOf(value) {
20
+ if (typeof value === "number") return {
21
+ kind: "number",
22
+ text: numeralText(value)
23
+ };
24
+ if (typeof value === "string") return {
25
+ kind: "string",
26
+ text: value
27
+ };
28
+ if (typeof value === "boolean") return {
29
+ kind: "boolean",
30
+ value
31
+ };
32
+ const expression = readSqlExpression(value);
33
+ return expression === void 0 ? void 0 : {
34
+ kind: "tag",
35
+ tag: "sql",
36
+ text: expression.text
37
+ };
38
+ }
39
+ function readValueArgument(label, value, dataType, dataTypes) {
40
+ const refuse = (message) => {
41
+ throw contractError("CONTRACT.ARGUMENT_INVALID", `${label}: ${message}`, { meta: { dataType } });
42
+ };
43
+ const written = writtenValueOf(value);
44
+ if (written === void 0) return refuse(`Expected ${describeAdmittedForms(dataTypes, dataType)}`);
45
+ const read = readWrittenValueAs(dataTypes, dataType, written);
46
+ return read.ok ? read.value.value : refuse(read.failure.message);
47
+ }
48
+ /**
49
+ * The arguments of a type constructor or field preset call as the constructor receives them: each `value` argument read as a value of its data type, through the same read and cast as a PSL argument, so both give the same parameters. ADR 129, ADR 254.
50
+ */
51
+ function readValueArguments(helperPath, descriptors, args, dataTypes) {
52
+ return args.map((value, index) => {
53
+ const descriptor = descriptors?.[index];
54
+ if (descriptor?.kind !== "value" || value === void 0) return value;
55
+ return readValueArgument(descriptor.name === void 0 ? `Argument #${index + 1} of ${helperPath}` : `Argument "${descriptor.name}" of ${helperPath}`, value, dataTypeId(descriptor.dataType), dataTypes);
56
+ });
57
+ }
11
58
  function isNamedConstraintOptionsLike(value) {
12
59
  if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
13
60
  if (Object.keys(value).some((key) => key !== "name")) return false;
14
61
  const name = value.name;
15
62
  return name === void 0 || typeof name === "string";
16
63
  }
17
- const blockedSegments = /* @__PURE__ */ new Set([
18
- "__proto__",
19
- "constructor",
20
- "prototype"
21
- ]);
22
- function assertSafeHelperKey(key, path) {
23
- if (blockedSegments.has(key)) throw contractError("CONTRACT.PACK_CONTRIBUTION_INVALID", `Invalid authoring helper "${[...path, key].join(".")}". Helper path segments must not use "${key}".`, { meta: {
24
- helperPath: [...path, key].join("."),
25
- segment: key
26
- } });
27
- }
28
- function createTypeHelpersFromNamespace(namespace, path = []) {
64
+ function createTypeHelpersFromNamespace(namespace, lookups, path = []) {
29
65
  const helpers = {};
30
66
  for (const [key, value] of Object.entries(namespace)) {
31
- assertSafeHelperKey(key, path);
67
+ assertSafeAuthoringHelperKey(key, path);
32
68
  const currentPath = [...path, key];
33
69
  if (isAuthoringTypeConstructorDescriptor(value)) {
70
+ const helperPath = currentPath.join(".");
71
+ helpers[key] = (...written) => {
72
+ validateAuthoringHelperArguments(helperPath, value.args, written);
73
+ const args = readValueArguments(helperPath, value.args, written, lookups.dataTypes);
74
+ const output = instantiateAuthoringTypeConstructor(value, args);
75
+ validateAuthoringTypeParams(helperPath, value.output, output.typeParams, lookups.codecLookup.descriptorFor(output.codecId)?.paramsSchema);
76
+ return {
77
+ kind: CODEC_INSTANCE_KIND,
78
+ codecId: output.codecId,
79
+ typeParams: output.typeParams ?? {}
80
+ };
81
+ };
82
+ continue;
83
+ }
84
+ if (isAuthoringTypeAliasDescriptor(value)) {
34
85
  const helperPath = currentPath.join(".");
35
86
  helpers[key] = (...args) => {
36
- validateAuthoringHelperArguments(helperPath, value.args, args);
37
- const triple = instantiateAuthoringTypeConstructor(value, args);
38
- return toStorageTypeInstance({
39
- codecId: triple.codecId,
40
- nativeType: triple.nativeType,
41
- typeParams: triple.typeParams ?? {}
42
- });
87
+ validateAuthoringHelperArguments(helperPath, [], args);
88
+ const { type, onCreate, onUpdate } = instantiateAuthoringTypeAlias(value);
89
+ const generatorCalls = {
90
+ ...ifDefined("onCreate", onCreate),
91
+ ...ifDefined("onUpdate", onUpdate)
92
+ };
93
+ return {
94
+ kind: CODEC_INSTANCE_KIND,
95
+ codecId: type.codecId,
96
+ typeParams: type.typeParams ?? {},
97
+ ...Object.keys(generatorCalls).length === 0 ? {} : { generatorCalls }
98
+ };
43
99
  };
44
100
  continue;
45
101
  }
46
- helpers[key] = createTypeHelpersFromNamespace(value, currentPath);
102
+ helpers[key] = createTypeHelpersFromNamespace(value, lookups, currentPath);
47
103
  }
48
104
  return helpers;
49
105
  }
@@ -65,35 +121,60 @@ function createFieldPresetHelper(options) {
65
121
  args = rawArgs.slice(0, -1);
66
122
  }
67
123
  validateAuthoringHelperArguments(options.helperPath, options.descriptor.args, args);
124
+ const values = readValueArguments(options.helperPath, options.descriptor.args, args, options.dataTypes);
125
+ const output = options.descriptor.output;
126
+ validateAuthoringTypeParams(options.helperPath, output, instantiateAuthoringFieldPreset(options.descriptor, values).descriptor.typeParams, options.codecLookup.descriptorFor(output.codecId)?.paramsSchema);
68
127
  return options.build({
69
- args,
128
+ args: values,
70
129
  ...namedConstraintOptions ? { namedConstraintOptions } : {}
71
130
  });
72
131
  };
73
132
  }
74
- function createFieldHelpersFromNamespace(namespace, createLeafHelper, path = []) {
75
- const helpers = {};
76
- for (const [key, value] of Object.entries(namespace)) {
77
- assertSafeHelperKey(key, path);
78
- const currentPath = [...path, key];
79
- if (isAuthoringFieldPresetDescriptor(value)) {
80
- helpers[key] = createLeafHelper({
81
- helperPath: currentPath.join("."),
82
- descriptor: value
83
- });
84
- continue;
133
+ function withGeneratorCall(state, phase, call) {
134
+ if (state.generatorCalls?.[phase] !== void 0 || state.executionDefaults?.[phase] !== void 0) throw contractError("CONTRACT.DEFAULT_INVALID", `.${phase}() is called on a field that already generates a value ${phase === "onCreate" ? "on create" : "on update"}. Set each phase once, and do not combine .${phase}() with a field preset, type alias or alias constant that sets it.`, { meta: {
135
+ reason: "generator-phase-set-twice",
136
+ phase
137
+ } });
138
+ return {
139
+ ...state,
140
+ generatorCalls: {
141
+ ...state.generatorCalls,
142
+ [phase]: call
85
143
  }
86
- helpers[key] = createFieldHelpersFromNamespace(value, createLeafHelper, currentPath);
87
- }
88
- return helpers;
144
+ };
145
+ }
146
+ function withColumnDefault(state, columnDefault) {
147
+ if (state.default !== void 0) throw contractError("CONTRACT.DEFAULT_INVALID", ".default() is called on a field that already has a default. Set the default once, and do not combine .default() with a field preset or alias constant that sets one.", { meta: { reason: "default-set-twice" } });
148
+ return {
149
+ ...state,
150
+ default: columnDefault
151
+ };
89
152
  }
90
153
  function toColumnDefault(value) {
154
+ const expression = readSqlExpression(value);
155
+ if (expression !== void 0) return sqlExpressionDefault(expression);
91
156
  if (isColumnDefault(value)) return value;
92
157
  return {
93
158
  kind: "literal",
94
159
  value
95
160
  };
96
161
  }
162
+ function sqlExpressionDefault(value) {
163
+ const reserved = reservedSqlDefaultText(value.text);
164
+ if (reserved !== void 0) throw contractError("CONTRACT.DEFAULT_INVALID", `Write .default(${reserved}()) instead of sql\`${reserved}()\`; ${reserved}() is a Prisma default function, not raw SQL.`, { meta: {
165
+ reason: "reserved-function",
166
+ expression: value.text
167
+ } });
168
+ const unsafe = checkSqlDefaultText(value.text);
169
+ if (unsafe !== void 0) throw contractError("CONTRACT.DEFAULT_INVALID", unsafe, { meta: {
170
+ reason: "unsafe-sql",
171
+ expression: value.text
172
+ } });
173
+ return {
174
+ kind: "function",
175
+ expression: value.text
176
+ };
177
+ }
97
178
  var ScalarFieldBuilder = class ScalarFieldBuilder {
98
179
  state;
99
180
  constructor(state) {
@@ -120,40 +201,31 @@ var ScalarFieldBuilder = class ScalarFieldBuilder {
120
201
  columnName: name
121
202
  }));
122
203
  }
123
- many() {
204
+ many(options) {
124
205
  return new ScalarFieldBuilder(blindCast({
125
206
  ...this.state,
126
- many: true
127
- }));
128
- }
129
- /**
130
- * Declines enforcement of generated CHECK constraints on this column.
131
- * With no arguments, waives every kind the column's shape derives;
132
- * with arguments, waives exactly the named kinds. Declared types are
133
- * unchanged — runtime values may diverge from them once enforcement
134
- * is waived.
135
- */
136
- noCheck(...kinds) {
137
- if (this.state.noCheck !== void 0) throw contractError("CONTRACT.CHECK_OPTOUT_INVALID", "noCheck() was already called on this field; declare every waived kind in a single call.", { meta: { reason: "duplicate-noCheck-call" } });
138
- return blindCast(new ScalarFieldBuilder({
139
- ...this.state,
140
- noCheck: kinds
207
+ many: { elementNullable: options?.elementsNullable === true }
141
208
  }));
142
209
  }
143
210
  default(value) {
144
- return new ScalarFieldBuilder({
145
- ...this.state,
146
- default: toColumnDefault(value)
147
- });
211
+ return blindCast(new ScalarFieldBuilder(withColumnDefault(this.state, toColumnDefault(value))));
212
+ }
213
+ /** Generates the field's value in the client when a row is created without one, with a call from `gen`, such as `gen.uuid()`. */
214
+ onCreate(call) {
215
+ return blindCast(new ScalarFieldBuilder(withGeneratorCall(this.state, "onCreate", call)));
148
216
  }
217
+ /** Generates the field's value in the client every time a row is updated, with a call from `gen`, such as `gen.now()`. */
218
+ onUpdate(call) {
219
+ return blindCast(new ScalarFieldBuilder(withGeneratorCall(this.state, "onUpdate", call)));
220
+ }
221
+ /**
222
+ * @deprecated Write `.default(now())` or `.default(autoincrement())`, or `` .default(sql`...`) `` for any other SQL. Removed in 8.0.0.
223
+ */
149
224
  defaultSql(expression) {
150
- return new ScalarFieldBuilder({
151
- ...this.state,
152
- default: {
153
- kind: "function",
154
- expression
155
- }
156
- });
225
+ return blindCast(new ScalarFieldBuilder(withColumnDefault(this.state, {
226
+ kind: "function",
227
+ expression
228
+ })));
157
229
  }
158
230
  id(options) {
159
231
  return new ScalarFieldBuilder(blindCast({
@@ -190,54 +262,59 @@ var EnumScalarFieldBuilder = class EnumScalarFieldBuilder extends ScalarFieldBui
190
262
  this.#handle = handle;
191
263
  }
192
264
  default(value) {
193
- return blindCast(new EnumScalarFieldBuilder({
194
- ...this.build(),
195
- default: {
196
- kind: "literal",
197
- value
198
- }
199
- }, this.#handle));
265
+ return blindCast(new EnumScalarFieldBuilder(withColumnDefault(this.build(), {
266
+ kind: "literal",
267
+ value
268
+ }), this.#handle));
200
269
  }
201
270
  defaultSql(_expression) {
202
271
  throw contractError("CONTRACT.DEFAULT_INVALID", "defaultSql is not available on an enum field; use .default(members.X) instead", { meta: { reason: "defaultSql-on-enum-field" } });
203
272
  }
204
273
  };
205
- function columnField(descriptor) {
206
- return new ScalarFieldBuilder({
274
+ function isTypeAliasColumnType(descriptor) {
275
+ return "generatorCalls" in descriptor;
276
+ }
277
+ const columnField = (descriptor) => {
278
+ if (!isTypeAliasColumnType(descriptor)) return new ScalarFieldBuilder({
207
279
  kind: "scalar",
208
280
  descriptor,
209
- nullable: false
281
+ nullable: false,
282
+ many: false
210
283
  });
211
- }
284
+ const { generatorCalls, ...columnType } = descriptor;
285
+ return new ScalarFieldBuilder({
286
+ kind: "scalar",
287
+ descriptor: blindCast(columnType),
288
+ nullable: false,
289
+ many: false,
290
+ ...ifDefined("generatorCalls", generatorCalls)
291
+ });
292
+ };
212
293
  function generatedField(spec) {
213
294
  return new ScalarFieldBuilder({
214
295
  kind: "scalar",
215
- descriptor: {
296
+ descriptor: blindCast({
216
297
  ...spec.type,
217
298
  ...spec.typeParams ? { typeParams: spec.typeParams } : {}
218
- },
299
+ }),
219
300
  nullable: false,
301
+ many: false,
220
302
  executionDefaults: { onCreate: spec.generated }
221
303
  });
222
304
  }
223
- function namedTypeField(typeRef) {
224
- if (isEnumTypeHandle(typeRef)) return new EnumScalarFieldBuilder(blindCast({
225
- kind: "scalar",
226
- typeRef,
227
- nullable: false
228
- }), typeRef);
229
- return new ScalarFieldBuilder({
230
- kind: "scalar",
231
- typeRef,
232
- nullable: false
233
- });
234
- }
305
+ const namedTypeField = (handle) => new EnumScalarFieldBuilder(blindCast({
306
+ kind: "scalar",
307
+ enumHandle: handle,
308
+ nullable: false,
309
+ many: false
310
+ }), handle);
235
311
  function buildFieldPreset(descriptor, args, namedConstraintOptions) {
236
312
  const preset = instantiateAuthoringFieldPreset(descriptor, args);
237
313
  return new ScalarFieldBuilder({
238
314
  kind: "scalar",
239
315
  descriptor: preset.descriptor,
240
316
  nullable: preset.nullable,
317
+ many: false,
241
318
  ...ifDefined("default", preset.default),
242
319
  ...ifDefined("executionDefaults", preset.executionDefaults),
243
320
  ...preset.id ? { id: namedConstraintOptions?.name ? { name: namedConstraintOptions.name } : {} } : {},
@@ -468,7 +545,7 @@ var ContractModelBuilder = class ContractModelBuilder {
468
545
  }, this.attributesFactory, this.sqlFactory, this.spaceId, this.tableName);
469
546
  }
470
547
  attributes(specOrFactory) {
471
- return new ContractModelBuilder(this.stageOne, specOrFactory, this.sqlFactory, this.spaceId, this.tableName);
548
+ return blindCast(new ContractModelBuilder(this.stageOne, specOrFactory, this.sqlFactory, this.spaceId, this.tableName));
472
549
  }
473
550
  sql(specOrFactory) {
474
551
  const nextTableName = typeof specOrFactory !== "function" ? specOrFactory.table : this.tableName;
@@ -564,6 +641,7 @@ function belongsTo(toModel, options) {
564
641
  toModel: normalizeRelationModelSource(toModel),
565
642
  from: options.from,
566
643
  to: options.to,
644
+ ...ifDefined("optional", options.optional),
567
645
  ...crossSpaceCoordinate !== void 0 ? crossSpaceCoordinate : {}
568
646
  });
569
647
  }
@@ -636,42 +714,18 @@ function applyNaming(name, strategy) {
636
714
  }
637
715
  return result;
638
716
  }
639
- function extractTypeNamespace(pack) {
640
- return pack.authoring?.type ?? {};
641
- }
642
- function extractFieldNamespace(pack) {
643
- return pack.authoring?.field ?? {};
644
- }
645
- function extractEntitiesNamespace(pack) {
646
- return pack.authoring?.entityTypes ?? {};
647
- }
648
717
  function composeTypeNamespace(components) {
649
- const merged = {};
650
- for (const component of components) {
651
- const ns = extractTypeNamespace(component);
652
- if (Object.keys(ns).length > 0) mergeAuthoringNamespaces(merged, ns, [], "typeConstructor", "type");
653
- }
654
- return merged;
718
+ return composePackAuthoringNamespace(components, "type");
655
719
  }
656
720
  function composeFieldNamespace(components) {
657
- const merged = {};
658
- for (const component of components) {
659
- const ns = extractFieldNamespace(component);
660
- if (Object.keys(ns).length > 0) mergeAuthoringNamespaces(merged, ns, [], "fieldPreset", "field");
661
- }
662
- return merged;
721
+ return composePackAuthoringNamespace(components, "field");
663
722
  }
664
723
  function composeEntityNamespace(components) {
665
- const merged = {};
666
- for (const component of components) {
667
- const ns = extractEntitiesNamespace(component);
668
- if (Object.keys(ns).length > 0) mergeAuthoringNamespaces(merged, ns, [], "entity", "entity");
669
- }
670
- return merged;
724
+ return composePackAuthoringNamespace(components, "entityTypes");
671
725
  }
672
726
  /**
673
727
  * Reserved top-level keys on the composed helpers surface — the
674
- * built-in `model` / `rel` helpers, the `field` / `type` namespace
728
+ * built-in `model` / `rel` helpers, the `field` / `type` / `gen` namespace
675
729
  * objects. Pack-contributed entity types are flattened to the same
676
730
  * top-level shape (e.g. `helpers.enum({...})`), so a pack cannot
677
731
  * contribute an entity type whose name collides with one of these
@@ -682,7 +736,8 @@ const RESERVED_HELPER_KEYS = [
682
736
  "field",
683
737
  "model",
684
738
  "rel",
685
- "type"
739
+ "type",
740
+ "gen"
686
741
  ];
687
742
  function assertNoBuiltInEntityCollisions(namespace) {
688
743
  const collisions = Object.keys(namespace).filter((name) => RESERVED_HELPER_KEYS.includes(name));
@@ -691,10 +746,12 @@ function assertNoBuiltInEntityCollisions(namespace) {
691
746
  reservedKeys: RESERVED_HELPER_KEYS
692
747
  } });
693
748
  }
694
- function createComposedFieldHelpers(fieldNamespace) {
749
+ function createComposedFieldHelpers(fieldNamespace, lookups) {
695
750
  const helperNamespace = createFieldHelpersFromNamespace(fieldNamespace, ({ helperPath, descriptor }) => createFieldPresetHelper({
696
751
  helperPath,
697
752
  descriptor,
753
+ codecLookup: lookups.codecLookup,
754
+ dataTypes: lookups.dataTypes,
698
755
  build: ({ args, namedConstraintOptions }) => buildFieldPreset(descriptor, args, namedConstraintOptions)
699
756
  }));
700
757
  const coreFieldHelpers = {
@@ -721,16 +778,28 @@ function createComposedAuthoringHelpers(options) {
721
778
  const entityNamespace = composeEntityNamespace(components);
722
779
  assertNoCrossRegistryCollisions(typeNamespace, fieldNamespace, entityNamespace);
723
780
  assertNoBuiltInEntityCollisions(entityNamespace);
724
- return {
781
+ const { support } = assembleDataTypeSupport(components, (codecId) => options.codecLookup.descriptorFor(codecId)?.dataType);
782
+ const helperLookups = {
783
+ codecLookup: options.codecLookup,
784
+ dataTypes: support
785
+ };
786
+ return blindCast({
725
787
  ...createEntityHelpersFromNamespace(entityNamespace, { ctx: {
726
788
  family: options.family.familyId,
727
- target: options.target.targetId
789
+ target: options.target.targetId,
790
+ codecLookup: options.codecLookup,
791
+ dataTypes: support
728
792
  } }),
729
- field: createComposedFieldHelpers(fieldNamespace),
793
+ field: createComposedFieldHelpers(fieldNamespace, helperLookups),
730
794
  model,
731
795
  rel,
732
- type: createTypeHelpersFromNamespace(typeNamespace)
733
- };
796
+ type: createTypeHelpersFromNamespace(typeNamespace, helperLookups),
797
+ gen: createGeneratorHelpers([
798
+ options.family,
799
+ options.target,
800
+ ...extensionValues
801
+ ])
802
+ });
734
803
  }
735
804
  function hasNamedModelToken(models, modelName) {
736
805
  return models[modelName]?.stageOne.modelName === modelName;
@@ -769,25 +838,12 @@ function flushWarnings(warnings) {
769
838
  for (const message of warnings) process.emitWarning(message, { code: "PN_CONTRACT_TYPED_FALLBACK_AVAILABLE" });
770
839
  return;
771
840
  }
772
- process.emitWarning(`${warnings.length} contract references use string fallbacks where typed alternatives are available. Use named model tokens and typed storage type refs for autocomplete and type safety.
841
+ process.emitWarning(`${warnings.length} contract references use string fallbacks where typed alternatives are available. Use named model tokens for autocomplete and type safety.
773
842
  ` + warnings.map((w) => ` - ${w}`).join("\n"), { code: "PN_CONTRACT_TYPED_FALLBACK_AVAILABLE" });
774
843
  }
775
844
  function formatFallbackWarning(location, current, suggested) {
776
845
  return `Contract ${location} uses ${current}. Use ${suggested} when the named model token is available in the same contract to keep typed relation targets and model refs.`;
777
846
  }
778
- function emitTypedNamedTypeFallbackWarnings(models, storageTypes) {
779
- const warnings = [];
780
- const warnedFields = /* @__PURE__ */ new Set();
781
- for (const [modelName, modelDefinition] of Object.entries(models)) for (const [fieldName, fieldBuilder] of Object.entries(modelDefinition.stageOne.fields)) {
782
- const fieldState = fieldBuilder.build();
783
- if (typeof fieldState.typeRef !== "string" || !(fieldState.typeRef in storageTypes)) continue;
784
- const warningKey = `${modelName}.${fieldName}`;
785
- if (warnedFields.has(warningKey)) continue;
786
- warnedFields.add(warningKey);
787
- warnings.push(`Contract field "${modelName}.${fieldName}" uses field.namedType('${fieldState.typeRef}'). Use field.namedType(types.${fieldState.typeRef}) when the storage type is declared in the same contract to keep autocomplete and typed local refs.`);
788
- }
789
- flushWarnings(warnings);
790
- }
791
847
  function emitTypedCrossModelFallbackWarnings(collection) {
792
848
  const warnings = [];
793
849
  const warnedKeys = /* @__PURE__ */ new Set();
@@ -825,36 +881,14 @@ function emitTypedCrossModelFallbackWarnings(collection) {
825
881
  }
826
882
  flushWarnings(warnings);
827
883
  }
828
- function buildStorageTypeReverseLookup(storageTypes) {
829
- const lookup = /* @__PURE__ */ new Map();
830
- for (const [key, instance] of Object.entries(storageTypes)) lookup.set(instance, key);
831
- return lookup;
832
- }
833
- function resolveFieldDescriptor(modelName, fieldName, fieldState, storageTypes, storageTypeReverseLookup) {
834
- if ("descriptor" in fieldState && fieldState.descriptor) return fieldState.descriptor;
835
- if ("typeRef" in fieldState && fieldState.typeRef) {
836
- if (isEnumTypeHandle(fieldState.typeRef)) return {
837
- codecId: fieldState.typeRef.codecId,
838
- nativeType: fieldState.typeRef.nativeType
839
- };
840
- const typeRef = typeof fieldState.typeRef === "string" ? fieldState.typeRef : storageTypeReverseLookup.get(fieldState.typeRef);
841
- if (!typeRef) throw contractError("CONTRACT.TYPE_UNKNOWN", `Field "${modelName}.${fieldName}" references a storage type instance that is not present in definition.types`, { meta: {
842
- modelName,
843
- fieldName,
844
- reason: "instance-not-in-definition-types"
845
- } });
846
- const referencedType = storageTypes[typeRef];
847
- if (!referencedType) throw contractError("CONTRACT.TYPE_UNKNOWN", `Field "${modelName}.${fieldName}" references unknown storage type "${typeRef}"`, { meta: {
848
- modelName,
849
- fieldName,
850
- typeRef
851
- } });
852
- return {
853
- codecId: referencedType.codecId,
854
- nativeType: referencedType.nativeType,
855
- typeRef
856
- };
857
- }
884
+ /** A column stores no `typeParams` when it has none, as PSL writes it (ADR 246). */
885
+ function withoutEmptyTypeParams(descriptor) {
886
+ const { typeParams, ...rest } = descriptor;
887
+ return typeParams === void 0 || Object.keys(typeParams).length > 0 ? descriptor : rest;
888
+ }
889
+ function resolveFieldDescriptor(modelName, fieldName, fieldState) {
890
+ if ("descriptor" in fieldState && fieldState.descriptor) return withoutEmptyTypeParams(fieldState.descriptor);
891
+ if ("enumHandle" in fieldState && isEnumTypeHandle(fieldState.enumHandle)) return { codecId: fieldState.enumHandle.codecId };
858
892
  throw contractError("CONTRACT.TYPE_UNKNOWN", `Field "${modelName}.${fieldName}" does not resolve to a storage descriptor`, { meta: {
859
893
  modelName,
860
894
  fieldName,
@@ -1005,6 +1039,19 @@ function resolveRelationAnchorFields(spec) {
1005
1039
  reason: "missing-anchor-id"
1006
1040
  } });
1007
1041
  }
1042
+ function belongsToNullable(relationName, declaredNullable, spec, fieldNames) {
1043
+ const { nullable, contradiction } = resolveToOneRelationNullable({
1044
+ declaredNullable,
1045
+ localFieldNullability: fieldNames.map((fieldName) => spec.fieldBuilders[fieldName]?.build().nullable === true),
1046
+ ownsReference: true
1047
+ });
1048
+ if (contradiction !== void 0) throw contractError("CONTRACT.RELATION_INVALID", toOneNullabilityContradictionMessage(`Relation "${spec.modelName}.${relationName}"`, contradiction), { meta: {
1049
+ modelName: spec.modelName,
1050
+ relationName,
1051
+ reason: "to-one-nullability-mismatch"
1052
+ } });
1053
+ return nullable;
1054
+ }
1008
1055
  function lowerBelongsToRelation(relationName, relation, currentSpec, allSpecs, extensions) {
1009
1056
  const targetModelName = resolveRelationModelName(relation.toModel);
1010
1057
  const fromFields = normalizeRelationFieldNames(relation.from);
@@ -1019,19 +1066,19 @@ function lowerBelongsToRelation(relationName, relation, currentSpec, allSpecs, e
1019
1066
  });
1020
1067
  if (relation.spaceId !== void 0) {
1021
1068
  assertKnownExtensionPack(extensions, relation.spaceId, `Relation "${currentSpec.modelName}.${relationName}"`);
1022
- const targetTable = relation.tableName ?? targetModelName.toLowerCase();
1023
1069
  const parentColumns = mapFieldNamesToColumnNames(currentSpec.modelName, fromFields, currentSpec.fieldToColumn);
1024
1070
  return {
1025
1071
  fieldName: relationName,
1026
1072
  toModel: targetModelName,
1027
- toTable: targetTable,
1073
+ toTable: relation.tableName,
1028
1074
  cardinality: "N:1",
1075
+ nullable: belongsToNullable(relationName, relation.optional, currentSpec, fromFields),
1029
1076
  spaceId: relation.spaceId,
1030
1077
  ...relation.namespaceId !== void 0 ? { namespaceId: relation.namespaceId } : {},
1031
1078
  on: {
1032
1079
  parentTable: currentSpec.tableName,
1033
1080
  parentColumns,
1034
- childTable: targetTable,
1081
+ childTable: relation.tableName,
1035
1082
  childColumns: toFields
1036
1083
  }
1037
1084
  };
@@ -1047,6 +1094,7 @@ function lowerBelongsToRelation(relationName, relation, currentSpec, allSpecs, e
1047
1094
  toModel: targetModelName,
1048
1095
  toTable: targetSpec.tableName,
1049
1096
  cardinality: "N:1",
1097
+ nullable: belongsToNullable(relationName, relation.optional, currentSpec, fromFields),
1050
1098
  on: {
1051
1099
  parentTable: currentSpec.tableName,
1052
1100
  parentColumns: mapFieldNamesToColumnNames(currentSpec.modelName, fromFields, currentSpec.fieldToColumn),
@@ -1077,7 +1125,10 @@ function lowerHasOwnershipRelation(relationName, relation, currentSpec, allSpecs
1077
1125
  fieldName: relationName,
1078
1126
  toModel: targetModelName,
1079
1127
  toTable: targetSpec.tableName,
1080
- cardinality: relation.kind === "hasMany" ? "1:N" : "1:1",
1128
+ ...relation.kind === "hasMany" ? { cardinality: "1:N" } : {
1129
+ cardinality: "1:1",
1130
+ nullable: true
1131
+ },
1081
1132
  on: {
1082
1133
  parentTable: currentSpec.tableName,
1083
1134
  parentColumns: mapFieldNamesToColumnNames(currentSpec.modelName, parentFields, currentSpec.fieldToColumn),
@@ -1150,11 +1201,16 @@ function lowerLocalForeignKeyNode(spec, targetSpec, foreignKey) {
1150
1201
  };
1151
1202
  }
1152
1203
  function lowerCrossSpaceForeignKeyNode(spec, foreignKey) {
1204
+ if (foreignKey.targetTableName === void 0) throw contractError("CONTRACT.FOREIGN_KEY_INVALID", `Foreign key on "${spec.modelName}" references model "${foreignKey.targetModel}" in contract space "${foreignKey.targetSpaceId}" but the target table name is unknown: the handle's .sql() stage is a factory function, so its table cannot be read statically. Declare the target model's .sql() stage with a static object carrying \`table\`.`, { meta: {
1205
+ sourceModel: spec.modelName,
1206
+ targetModel: foreignKey.targetModel,
1207
+ spaceId: foreignKey.targetSpaceId
1208
+ } });
1153
1209
  return {
1154
1210
  columns: mapFieldNamesToColumnNames(spec.modelName, foreignKey.fields, spec.fieldToColumn),
1155
1211
  references: {
1156
1212
  model: foreignKey.targetModel,
1157
- table: foreignKey.targetTableName ?? foreignKey.targetModel.toLowerCase(),
1213
+ table: foreignKey.targetTableName,
1158
1214
  columns: foreignKey.targetFields,
1159
1215
  ...foreignKey.targetNamespaceId !== void 0 ? { namespaceId: foreignKey.targetNamespaceId } : {},
1160
1216
  spaceId: foreignKey.targetSpaceId
@@ -1206,23 +1262,133 @@ function resolveForeignKeyNodes(spec, allSpecs, extensions) {
1206
1262
  });
1207
1263
  return [...relationForeignKeys, ...sqlForeignKeys];
1208
1264
  }
1209
- function resolveModelNode(spec, allSpecs, storageTypes, storageTypeReverseLookup, extensions) {
1265
+ /**
1266
+ * Resolves a deferred index expression's field refs the way the field-tuple form
1267
+ * resolves its columns, and pairs each with the codec the column stores through
1268
+ * so a renderer can refuse a column it cannot express.
1269
+ */
1270
+ function resolveDeferredColumns(spec, fieldNames, fieldCodecIds) {
1271
+ const columnNames = mapFieldNamesToColumnNames(spec.modelName, fieldNames, spec.fieldToColumn);
1272
+ return fieldNames.map((fieldName, position) => {
1273
+ const name = columnNames[position];
1274
+ const codecId = fieldCodecIds[fieldName];
1275
+ if (name === void 0 || codecId === void 0) throw new InternalError(`Deferred index expression on "${spec.modelName}" resolved no column for field "${fieldName}"`);
1276
+ return {
1277
+ name,
1278
+ codecId
1279
+ };
1280
+ });
1281
+ }
1282
+ /**
1283
+ * The text of an index expression. A string has no `render`, and `'render' in` a string throws a
1284
+ * `TypeError`, so the `sql` value is recognized first and anything else is refused last.
1285
+ */
1286
+ function indexExpressionText(spec, expression, fieldCodecIds, owner) {
1287
+ const sqlExpression = readSqlExpression(expression);
1288
+ if (sqlExpression !== void 0) return sqlExpression.text;
1289
+ if (typeof expression === "object" && expression !== null && "render" in expression) return renderedSqlText(expression.render(resolveDeferredColumns(spec, expression.fields.map((ref) => ref.fieldName), fieldCodecIds)), `${owner} expression`);
1290
+ return requireSqlExpression(expression, `${owner} expression`).text;
1291
+ }
1292
+ function renderedSqlText(rendered, what) {
1293
+ try {
1294
+ return new SqlExpression(rendered).text;
1295
+ } catch (cause) {
1296
+ if (!isStructuredError(cause) || cause.code !== "CONTRACT.SQL_EXPRESSION_INVALID") throw cause;
1297
+ throw contractError("CONTRACT.SQL_EXPRESSION_INVALID", `${what}: ${cause.message}`, {
1298
+ meta: {
1299
+ what,
1300
+ ...cause.meta
1301
+ },
1302
+ cause
1303
+ });
1304
+ }
1305
+ }
1306
+ function constraintOwner(kind, modelName, constraint) {
1307
+ const name = constraint.name ?? constraint.map;
1308
+ return name === void 0 ? `${kind} on "${modelName}"` : `${kind} "${name}"`;
1309
+ }
1310
+ /** The fields an index covers, in order: its own, or those of its deferred expression. */
1311
+ function coveredFieldNames(index) {
1312
+ if (index.fields !== void 0) return index.fields;
1313
+ const { expression } = index;
1314
+ if (expression === void 0 || isSqlExpression(expression) || typeof expression !== "object") return [];
1315
+ return expression.fields.map((ref) => ref.fieldName);
1316
+ }
1317
+ /**
1318
+ * The generators a field's `.onCreate(...)` and `.onUpdate(...)` calls resolve to for its column, merged over the phases a field preset or `field.generated(...)` sets.
1319
+ */
1320
+ function resolveGeneratorCalls(input) {
1321
+ const { modelName, fieldName, fieldState, descriptor, generatorFunctions } = input;
1322
+ const calls = fieldState.generatorCalls;
1323
+ if (calls === void 0) return fieldState.executionDefaults;
1324
+ const typeParams = descriptor.typeParams;
1325
+ const column = {
1326
+ codecId: descriptor.codecId,
1327
+ typeParams,
1328
+ length: input.columnLength(descriptor.codecId, typeParams)
1329
+ };
1330
+ const phases = { ...fieldState.executionDefaults };
1331
+ for (const phase of ["onCreate", "onUpdate"]) {
1332
+ const call = calls[phase];
1333
+ if (call === void 0) continue;
1334
+ if (fieldState.many !== false) throw contractError("CONTRACT.DEFAULT_INVALID", `Field "${modelName}.${fieldName}" is a list and cannot use .${phase}(${call.name}()). Lists have no per-element generated values; remove .${phase}(...).`, { meta: {
1335
+ modelName,
1336
+ fieldName,
1337
+ codecId: column.codecId,
1338
+ function: call.name,
1339
+ reason: "generator-on-list"
1340
+ } });
1341
+ const resolution = generatorFunctions.resolve(call, column);
1342
+ if (resolution.ok) {
1343
+ phases[phase] = resolution.generator;
1344
+ continue;
1345
+ }
1346
+ const meta = {
1347
+ modelName,
1348
+ fieldName,
1349
+ codecId: column.codecId,
1350
+ function: call.name
1351
+ };
1352
+ if (resolution.reason === "unknown-function") throw contractError("CONTRACT.DEFAULT_INVALID", `Field "${modelName}.${fieldName}": no pack in the contract declares the generator function "${call.name}".`, { meta: {
1353
+ ...meta,
1354
+ reason: "generator-unknown"
1355
+ } });
1356
+ const applying = generatorFunctions.functionsFor(column.codecId).map(({ name }) => `${name}()`);
1357
+ throw contractError("CONTRACT.DEFAULT_INVALID", resolution.reason === "refused" ? `Field "${modelName}.${fieldName}": ${resolution.message}` : `Field "${modelName}.${fieldName}": ${call.name}() does not apply to codec "${column.codecId}". ${applying.length === 0 ? "No generator function applies to this codec." : `Functions that apply: ${applying.join(", ")}.`}`, { meta: {
1358
+ ...meta,
1359
+ reason: "generator-not-applicable"
1360
+ } });
1361
+ }
1362
+ return phases;
1363
+ }
1364
+ function resolveModelNode(spec, allSpecs, generatorFunctions, columnLength, extensions) {
1210
1365
  const fields = [];
1366
+ /** Filled by the field loop below, read by a deferred index expression. */
1367
+ const fieldCodecIds = {};
1211
1368
  for (const [fieldName, fieldBuilder] of Object.entries(spec.fieldBuilders)) {
1212
1369
  const fieldState = fieldBuilder.build();
1213
- const descriptor = resolveFieldDescriptor(spec.modelName, fieldName, fieldState, storageTypes, storageTypeReverseLookup);
1370
+ const descriptor = resolveFieldDescriptor(spec.modelName, fieldName, fieldState);
1214
1371
  const columnName = spec.fieldToColumn[fieldName];
1215
1372
  if (!columnName) throw new InternalError(`Column name resolution failed for "${spec.modelName}.${fieldName}"`);
1216
- const enumHandle = "typeRef" in fieldState && isEnumTypeHandle(fieldState.typeRef) ? fieldState.typeRef : void 0;
1373
+ fieldCodecIds[fieldName] = descriptor.codecId;
1374
+ const enumHandle = "enumHandle" in fieldState && isEnumTypeHandle(fieldState.enumHandle) ? fieldState.enumHandle : void 0;
1375
+ const executionDefaults = resolveGeneratorCalls({
1376
+ modelName: spec.modelName,
1377
+ fieldName,
1378
+ fieldState,
1379
+ descriptor,
1380
+ generatorFunctions,
1381
+ columnLength
1382
+ });
1217
1383
  fields.push({
1218
1384
  fieldName,
1219
1385
  columnName,
1220
1386
  descriptor,
1221
1387
  nullable: fieldState.nullable,
1222
- ...fieldState.many === true ? { many: true } : {},
1223
- ...fieldState.noCheck !== void 0 ? { noCheck: fieldState.noCheck } : {},
1388
+ many: fieldState.many !== false,
1389
+ ...fieldState.many !== false ? { elementNullable: fieldState.many.elementNullable } : {},
1224
1390
  ...fieldState.default ? { default: fieldState.default } : {},
1225
- ...fieldState.executionDefaults ? { executionDefaults: fieldState.executionDefaults } : {},
1391
+ ...ifDefined("executionDefaults", executionDefaults),
1226
1392
  ...enumHandle !== void 0 ? { enumTypeHandle: enumHandle } : {}
1227
1393
  });
1228
1394
  }
@@ -1232,12 +1398,14 @@ function resolveModelNode(spec, allSpecs, storageTypes, storageTypeReverseLookup
1232
1398
  ...unique.name ? { name: unique.name } : {}
1233
1399
  }));
1234
1400
  const indexes = (spec.sqlSpec?.indexes ?? []).map((index) => {
1401
+ const options = typeof index.options === "function" ? index.options(resolveDeferredColumns(spec, coveredFieldNames(index), fieldCodecIds)) : index.options;
1235
1402
  const method = blindCast({
1236
1403
  type: index.type,
1237
- options: index.options
1404
+ options
1238
1405
  });
1406
+ const owner = constraintOwner("Index", spec.modelName, index);
1239
1407
  const carried = {
1240
- where: index.where,
1408
+ where: index.where === void 0 ? void 0 : requireSqlExpression(index.where, `${owner} where`).text,
1241
1409
  unique: index.unique,
1242
1410
  name: index.name,
1243
1411
  map: index.map,
@@ -1245,14 +1413,14 @@ function resolveModelNode(spec, allSpecs, storageTypes, storageTypeReverseLookup
1245
1413
  };
1246
1414
  return index.expression !== void 0 ? {
1247
1415
  ...carried,
1248
- expression: index.expression
1416
+ expression: indexExpressionText(spec, index.expression, fieldCodecIds, owner)
1249
1417
  } : {
1250
1418
  ...carried,
1251
1419
  columns: mapFieldNamesToColumnNames(spec.modelName, index.fields ?? [], spec.fieldToColumn)
1252
1420
  };
1253
1421
  });
1254
1422
  const checks = (spec.sqlSpec?.checks ?? []).map((authoredCheck) => ({
1255
- expression: authoredCheck.expression,
1423
+ expression: requireSqlExpression(authoredCheck.expression, `${constraintOwner("Check", spec.modelName, authoredCheck)} expression`).text,
1256
1424
  name: authoredCheck.name,
1257
1425
  map: authoredCheck.map
1258
1426
  }));
@@ -1275,10 +1443,16 @@ function resolveModelNode(spec, allSpecs, storageTypes, storageTypeReverseLookup
1275
1443
  ...ifDefined("control", spec.sqlSpec?.control)
1276
1444
  };
1277
1445
  }
1446
+ function columnLengthOf(definition) {
1447
+ const { codecLookup, dataTypeLookup } = definition;
1448
+ return (codecId, typeParams) => {
1449
+ const dataTypeId = codecLookup.descriptorFor(codecId)?.dataType;
1450
+ return sqlColumnLength(dataTypeId === void 0 ? void 0 : dataTypeLookup.get(dataTypeId), typeParams);
1451
+ };
1452
+ }
1278
1453
  function collectRuntimeModelSpecs(definition) {
1279
- const storageTypes = { ...definition.types ?? {} };
1454
+ const databaseTypes = { ...definition.databaseTypes };
1280
1455
  const models = { ...definition.models ?? {} };
1281
- emitTypedNamedTypeFallbackWarnings(models, storageTypes);
1282
1456
  const modelSpecs = /* @__PURE__ */ new Map();
1283
1457
  const tableOwners = /* @__PURE__ */ new Map();
1284
1458
  for (const [modelName, modelDefinition] of Object.entries(models)) {
@@ -1333,15 +1507,14 @@ function collectRuntimeModelSpecs(definition) {
1333
1507
  });
1334
1508
  }
1335
1509
  return {
1336
- storageTypes,
1510
+ databaseTypes,
1337
1511
  models,
1338
1512
  modelSpecs
1339
1513
  };
1340
1514
  }
1341
- function lowerModels(collection, extensions) {
1515
+ function lowerModels(collection, generatorFunctions, columnLength, extensions) {
1342
1516
  emitTypedCrossModelFallbackWarnings(collection);
1343
- const storageTypeReverseLookup = buildStorageTypeReverseLookup(collection.storageTypes);
1344
- return Array.from(collection.modelSpecs.values()).map((spec) => resolveModelNode(spec, collection.modelSpecs, collection.storageTypes, storageTypeReverseLookup, extensions));
1517
+ return Array.from(collection.modelSpecs.values()).map((spec) => resolveModelNode(spec, collection.modelSpecs, generatorFunctions, columnLength, extensions));
1345
1518
  }
1346
1519
  /**
1347
1520
  * Kind-agnostic walk over the author-declared `entities` handle list:
@@ -1461,16 +1634,30 @@ function lowerPackEntityHandles(definition, modelSpecs) {
1461
1634
  return pack;
1462
1635
  }
1463
1636
  function buildContractDefinition(definition) {
1637
+ refuseTypesKey(definition, "buildContractDefinition");
1464
1638
  const collection = collectRuntimeModelSpecs(definition);
1465
- const models = lowerModels(collection, definition.extensions);
1639
+ const packs = [
1640
+ definition.family,
1641
+ definition.target,
1642
+ ...Object.values(definition.extensions ?? {})
1643
+ ];
1644
+ const generatorFunctions = assembleGeneratorFunctions(packs);
1645
+ const columnLength = columnLengthOf(definition);
1646
+ assertTypeAliasesValid(composePackAuthoringNamespace(packs, "type"), {
1647
+ generatorFunctions,
1648
+ paramsSchemaOf: (codecId) => definition.codecLookup.descriptorFor(codecId)?.paramsSchema,
1649
+ fieldLength: ({ codecId, typeParams }) => columnLength(codecId, typeParams)
1650
+ });
1651
+ const models = lowerModels(collection, generatorFunctions, columnLength, definition.extensions);
1466
1652
  const attachedEntities = lowerPackEntityHandles(definition, collection.modelSpecs);
1467
1653
  return {
1468
1654
  target: definition.target,
1469
1655
  ...ifDefined("defaultControlPolicy", definition.defaultControlPolicy),
1470
1656
  ...definition.extensions ? { extensions: definition.extensions } : {},
1657
+ ...ifDefined("capabilities", definition.adapter?.capabilities),
1471
1658
  ...definition.storageHash ? { storageHash: definition.storageHash } : {},
1472
1659
  ...definition.foreignKeyDefaults ? { foreignKeyDefaults: definition.foreignKeyDefaults } : {},
1473
- ...Object.keys(collection.storageTypes).length > 0 ? { storageTypes: collection.storageTypes } : {},
1660
+ ...Object.keys(collection.databaseTypes).length > 0 ? { databaseTypes: collection.databaseTypes } : {},
1474
1661
  ...definition.namespaces ? { namespaces: definition.namespaces } : {},
1475
1662
  warnings: void 0,
1476
1663
  createNamespace: definition.createNamespace,
@@ -1491,6 +1678,9 @@ function validateTargetPackRef(family, target) {
1491
1678
  contractFamilyId: family.familyId
1492
1679
  } });
1493
1680
  }
1681
+ function targetNameOf(target) {
1682
+ return target.displayName ?? target.targetId;
1683
+ }
1494
1684
  /**
1495
1685
  * Per-target reserved namespace names enforced by `defineContract` for
1496
1686
  * SQL family contracts. Two categories:
@@ -1499,16 +1689,16 @@ function validateTargetPackRef(family, target) {
1499
1689
  * every SQL target. The double-underscore decoration marks them as
1500
1690
  * framework-reserved coordinates; user code must not declare them
1501
1691
  * explicitly.
1502
- * 2. **Target-specific PSL keywords** — Postgres reserves the bare
1503
- * `unbound` identifier for the late-binding opt-in
1504
- * (`namespace unbound { … }`) so the TS surface must reject it from
1505
- * `defineContract({ namespaces })` lists. SQLite has no schema
1506
- * concept and rejects every non-empty namespaces list outright;
1507
- * callers should declare `namespaces: []` or omit the field.
1692
+ * 2. **The PSL keyword `unbound`** — the name PSL writes for the
1693
+ * late-binding opt-in (`namespace unbound { … }`), so the TS surface
1694
+ * rejects it from `defineContract({ namespaces })` lists on every
1695
+ * target that accepts namespaces. A target whose `supportsNamespaces` is false rejects every
1696
+ * non-empty namespaces list outright; callers should declare
1697
+ * `namespaces: []` or omit the field.
1508
1698
  */
1509
1699
  function validateNamespaceDeclarations(target, namespaces) {
1510
1700
  if (!namespaces) return;
1511
- if (target.targetId === "sqlite" && namespaces.length > 0) throw contractError("CONTRACT.NAMESPACE_UNSUPPORTED", `defineContract: SQLite contracts cannot declare namespaces (SQLite has no schema concept; emitted DDL is always unqualified). Received namespaces: [${namespaces.map((name) => `"${name}"`).join(", ")}].`, { meta: {
1701
+ if (target.supportsNamespaces === false && namespaces.length > 0) throw contractError("CONTRACT.NAMESPACE_UNSUPPORTED", `defineContract: ${targetNameOf(target)} contracts cannot declare namespaces. Received namespaces: [${namespaces.map((name) => `"${name}"`).join(", ")}].`, { meta: {
1512
1702
  namespaces,
1513
1703
  targetId: target.targetId
1514
1704
  } });
@@ -1526,9 +1716,10 @@ function validateNamespaceDeclarations(target, namespaces) {
1526
1716
  namespace,
1527
1717
  reason: "reserved-ir-sentinel"
1528
1718
  } });
1529
- if (target.targetId === "postgres" && namespace === "unbound") throw contractError("CONTRACT.NAMESPACE_INVALID", `defineContract: namespace name "unbound" is reserved by Postgres for the late-binding opt-in (use \`namespace unbound { … }\` in PSL instead of declaring it as a regular schema).`, { meta: {
1719
+ if (namespace === UNBOUND_PSL_NAMESPACE_NAME) throw contractError("CONTRACT.NAMESPACE_INVALID", `defineContract: namespace name "${namespace}" is reserved by ${targetNameOf(target)} for the late-binding opt-in (use \`namespace ${namespace} { … }\` in PSL instead of declaring it as a regular schema).`, { meta: {
1530
1720
  namespace,
1531
- reason: "reserved-by-postgres"
1721
+ reason: "reserved-psl-keyword",
1722
+ targetId: target.targetId
1532
1723
  } });
1533
1724
  if (seen.has(namespace)) throw contractError("CONTRACT.NAME_DUPLICATE", `defineContract: namespaces list contains duplicate entry "${namespace}".`, { meta: {
1534
1725
  kind: "namespace",
@@ -1545,25 +1736,21 @@ function validateNamespaceDeclarations(target, namespaces) {
1545
1736
  *
1546
1737
  * - `__unbound__` / `__unspecified__` — reserved IR sentinels on
1547
1738
  * every SQL target.
1548
- * - `unbound` on Postgres — reserved for the PSL
1549
- * `namespace unbound { … }` opt-in.
1739
+ * - The PSL keyword `unbound` — reserved for the PSL late-binding
1740
+ * opt-in, which the TS builder has no surface for.
1550
1741
  *
1551
- * Additionally enforces that each per-model `namespace` either
1552
- * references an entry in the contract's declared `namespaces` list or
1553
- * names the Postgres late-binding keyword (`unbound`) — the latter is
1554
- * not a "declared namespace" but is a legal opt-in only via PSL today,
1555
- * so the TS surface also rejects it on the per-model side and points
1556
- * authors at the PSL `namespace unbound { … }` block.
1742
+ * Additionally enforces that each per-model `namespace` references an
1743
+ * entry in the contract's declared `namespaces` list.
1557
1744
  *
1558
- * The SQLite per-model `namespace` field is rejected outright (SQLite
1559
- * has no schema concept).
1745
+ * A target whose `supportsNamespaces` is false rejects the per-model
1746
+ * `namespace` field outright.
1560
1747
  */
1561
1748
  function validatePerModelNamespaces(target, namespaces, models) {
1562
1749
  const declaredNamespaces = new Set(namespaces ?? []);
1563
1750
  for (const [modelKey, modelBuilder] of Object.entries(models)) {
1564
1751
  const perModelNamespace = modelBuilder.stageOne.namespace;
1565
1752
  if (perModelNamespace === void 0) continue;
1566
- if (target.targetId === "sqlite") throw contractError("CONTRACT.NAMESPACE_UNSUPPORTED", `defineContract: model "${modelKey}" sets \`namespace: "${perModelNamespace}"\` but the target is SQLite (SQLite has no schema concept; remove the per-model \`namespace\` field).`, { meta: {
1753
+ if (target.supportsNamespaces === false) throw contractError("CONTRACT.NAMESPACE_UNSUPPORTED", `defineContract: model "${modelKey}" sets \`namespace: "${perModelNamespace}"\` but the target is ${targetNameOf(target)}, which does not support namespaces (remove the per-model \`namespace\` field).`, { meta: {
1567
1754
  modelKey,
1568
1755
  namespace: perModelNamespace,
1569
1756
  targetId: target.targetId
@@ -1573,10 +1760,11 @@ function validatePerModelNamespaces(target, namespaces, models) {
1573
1760
  namespace: perModelNamespace,
1574
1761
  reason: "reserved-ir-sentinel"
1575
1762
  } });
1576
- if (target.targetId === "postgres" && perModelNamespace === "unbound") throw contractError("CONTRACT.NAMESPACE_INVALID", `defineContract: model "${modelKey}" sets \`namespace: "unbound"\` but that name is reserved by Postgres for the late-binding opt-in (use \`namespace unbound { … }\` in PSL instead — there is no equivalent surface in the TS builder today).`, { meta: {
1763
+ if (perModelNamespace === UNBOUND_PSL_NAMESPACE_NAME) throw contractError("CONTRACT.NAMESPACE_INVALID", `defineContract: model "${modelKey}" sets \`namespace: "${perModelNamespace}"\` but that name is reserved by ${targetNameOf(target)} for the late-binding opt-in (use \`namespace ${perModelNamespace} { … }\` in PSL instead — there is no equivalent surface in the TS builder today).`, { meta: {
1577
1764
  modelKey,
1578
1765
  namespace: perModelNamespace,
1579
- reason: "reserved-by-postgres"
1766
+ reason: "reserved-psl-keyword",
1767
+ targetId: target.targetId
1580
1768
  } });
1581
1769
  if (!declaredNamespaces.has(perModelNamespace)) throw contractError("CONTRACT.NAMESPACE_UNKNOWN", `defineContract: model "${modelKey}" references namespace "${perModelNamespace}" but that name does not appear in the contract's declared \`namespaces\` list.${declaredNamespaces.size > 0 ? ` Declared namespaces: [${[...declaredNamespaces].map((name) => `"${name}"`).join(", ")}].` : " The contract does not declare any namespaces; add `namespaces: [\"…\"]` to `defineContract` first."}`, { meta: {
1582
1770
  modelKey,
@@ -1609,10 +1797,11 @@ function buildContractFromDsl(definition) {
1609
1797
  validateExtensionPackRefs(definition.target, definition.extensions);
1610
1798
  validateNamespaceDeclarations(definition.target, definition.namespaces);
1611
1799
  validatePerModelNamespaces(definition.target, definition.namespaces, definition.models ?? {});
1612
- return blindCast(buildSqlContractFromDefinition(buildContractDefinition(definition), definition.codecLookup));
1800
+ return blindCast(buildSqlContractFromDefinition(buildContractDefinition(definition), definition.codecLookup, definition.dataTypeLookup));
1613
1801
  }
1614
1802
  /** Implementation. */
1615
1803
  function buildBoundContract(family, target, definition, factory) {
1804
+ refuseTypesKey(definition, "defineContract");
1616
1805
  const full = {
1617
1806
  ...definition,
1618
1807
  family,
@@ -1622,8 +1811,10 @@ function buildBoundContract(family, target, definition, factory) {
1622
1811
  const built = factory(createComposedAuthoringHelpers({
1623
1812
  family,
1624
1813
  target,
1625
- extensions: definition.extensions
1814
+ extensions: definition.extensions,
1815
+ codecLookup: definition.codecLookup
1626
1816
  }));
1817
+ refuseTypesKey(built, "defineContract");
1627
1818
  const mergedEnums = {
1628
1819
  ...definition.enums ?? {},
1629
1820
  ...built.enums
@@ -1631,7 +1822,7 @@ function buildBoundContract(family, target, definition, factory) {
1631
1822
  const mergedEntities = [...definition.entities ?? [], ...built.entities ?? []];
1632
1823
  return buildContractFromDsl({
1633
1824
  ...full,
1634
- ...ifDefined("types", built.types),
1825
+ ...ifDefined("databaseTypes", built.databaseTypes),
1635
1826
  ...ifDefined("models", built.models),
1636
1827
  ...ifDefined("enums", Object.keys(mergedEnums).length > 0 ? mergedEnums : void 0),
1637
1828
  ...ifDefined("entities", mergedEntities.length > 0 ? mergedEntities : void 0)
@@ -1644,7 +1835,21 @@ function defineContract(definition, factory) {
1644
1835
  if (factory !== void 0) return buildBoundContract(definition.family, definition.target, definition, factory);
1645
1836
  return buildBoundContract(definition.family, definition.target, definition);
1646
1837
  }
1838
+ /** The database's current time, the same default PSL writes as `@default(now())`. */
1839
+ function now() {
1840
+ return {
1841
+ kind: "function",
1842
+ expression: "now()"
1843
+ };
1844
+ }
1845
+ /** A database-assigned sequence value, the same default PSL writes as `@default(autoincrement())`. */
1846
+ function autoincrement() {
1847
+ return {
1848
+ kind: "function",
1849
+ expression: "autoincrement()"
1850
+ };
1851
+ }
1647
1852
  //#endregion
1648
- export { defineContract as a, field as c, rel as d, check as i, member as l, buildBoundContract as n, enumType as o, buildContractDefinition as r, extensionModel as s, bindEnumType as t, model as u };
1853
+ export { check as a, enumType as c, member as d, model as f, buildContractDefinition as i, extensionModel as l, rel as m, bindEnumType as n, createComposedAuthoringHelpers as o, now as p, buildBoundContract as r, defineContract as s, autoincrement as t, field as u };
1649
1854
 
1650
- //# sourceMappingURL=contract-builder-D4a5dT7j.mjs.map
1855
+ //# sourceMappingURL=contract-builder-50lF0kz1.mjs.map