@prisma/orm-family-sql 8.0.0-rc.14-dev.29 → 8.0.0-rc.14-dev.31

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 (235) hide show
  1. package/dist/{aggregate-descriptor-registry-CJF2KxUb.mjs → aggregate-descriptor-registry-B3RG0Zom.mjs} +2 -2
  2. package/dist/{aggregate-descriptor-registry-CJF2KxUb.mjs.map → aggregate-descriptor-registry-B3RG0Zom.mjs.map} +1 -1
  3. package/dist/{ast-dPjHeaNs.d.mts → ast-BUbHXpzG.d.mts} +7 -105
  4. package/dist/ast-BUbHXpzG.d.mts.map +1 -0
  5. package/dist/ast-CQZn-6Wd.mjs +310 -0
  6. package/dist/ast-CQZn-6Wd.mjs.map +1 -0
  7. package/dist/{authoring-entity-types-CZ-vdwYS-BfyaoH53.d.mts → authoring-entity-types-CZ-vdwYS-C25VGQVB.d.mts} +2 -2
  8. package/dist/{authoring-entity-types-CZ-vdwYS-BfyaoH53.d.mts.map → authoring-entity-types-CZ-vdwYS-C25VGQVB.d.mts.map} +1 -1
  9. package/dist/{authoring-type-constructors-DIyheCzv-BSrAEZsD.mjs → authoring-type-constructors-dihiQslc-hldmqa1r.mjs} +22 -28
  10. package/dist/authoring-type-constructors-dihiQslc-hldmqa1r.mjs.map +1 -0
  11. package/dist/builder.d.mts +2 -2
  12. package/dist/builder__runtime.d.mts +6 -6
  13. package/dist/builder__runtime.mjs +3 -3
  14. package/dist/builder__types.d.mts +2 -2
  15. package/dist/{codec-descriptor-registry-u6_e6WfA.mjs → codec-descriptor-registry-BW0REwkz.mjs} +2 -11
  16. package/dist/{codec-descriptor-registry-u6_e6WfA.mjs.map → codec-descriptor-registry-BW0REwkz.mjs.map} +1 -1
  17. package/dist/{config-types-DNRmpGNL.mjs → config-types-ump1oN82.mjs} +8 -4
  18. package/dist/config-types-ump1oN82.mjs.map +1 -0
  19. package/dist/{contract-builder-Br5TlHMh.d.mts → contract-builder-BXxFihYc.d.mts} +16 -11
  20. package/dist/contract-builder-BXxFihYc.d.mts.map +1 -0
  21. package/dist/{contract-builder-C3MYW38z.mjs → contract-builder-CQvwPGAW.mjs} +29 -24
  22. package/dist/contract-builder-CQvwPGAW.mjs.map +1 -0
  23. package/dist/contract-emitter.d.mts +1 -1
  24. package/dist/contract-emitter.mjs +1 -1
  25. package/dist/contract-prisma7__provider.d.mts +2 -1
  26. package/dist/contract-prisma7__provider.d.mts.map +1 -1
  27. package/dist/contract-prisma7__provider.mjs +16 -9
  28. package/dist/contract-prisma7__provider.mjs.map +1 -1
  29. package/dist/contract-psl.d.mts +4 -4
  30. package/dist/contract-psl.d.mts.map +1 -1
  31. package/dist/contract-psl.mjs +1 -1
  32. package/dist/contract-psl__attribute-specs.d.mts +2 -2
  33. package/dist/contract-psl__attribute-specs.mjs +1 -1
  34. package/dist/contract-psl__provider.mjs +2 -2
  35. package/dist/contract-psl__provider.mjs.map +1 -1
  36. package/dist/contract-ts.d.mts +1 -1
  37. package/dist/contract-ts.mjs +3 -3
  38. package/dist/contract-ts__config-types.mjs +1 -1
  39. package/dist/contract-ts__contract-builder.d.mts +1 -1
  40. package/dist/contract-ts__contract-builder.mjs +2 -2
  41. package/dist/contract.d.mts +5 -3
  42. package/dist/contract.mjs +11 -8
  43. package/dist/contract__data-type-support.d.mts +2 -0
  44. package/dist/contract__data-type-support.mjs +2 -0
  45. package/dist/contract__data-type.d.mts +2 -0
  46. package/dist/contract__data-type.mjs +3 -0
  47. package/dist/contract__entity-kinds.mjs +1 -1
  48. package/dist/contract__factories.mjs +1 -1
  49. package/dist/contract__sql-expression.d.mts +1 -1
  50. package/dist/contract__sql-expression.mjs +1 -1
  51. package/dist/contract__types.mjs +3 -3
  52. package/dist/contract__validators.d.mts +1 -1
  53. package/dist/contract__validators.mjs +2 -2
  54. package/dist/{control-BYOcSVih.mjs → control-BYT1Lgtm.mjs} +76 -117
  55. package/dist/control-BYT1Lgtm.mjs.map +1 -0
  56. package/dist/{control-DL9y6GfG.d.mts → control-Bpk8PtSL.d.mts} +40 -128
  57. package/dist/control-Bpk8PtSL.d.mts.map +1 -0
  58. package/dist/{control-adapter-WoXvPNj4-D64oWh9I.d.mts → control-adapter-BVN98SzR-C-H_T7s-.d.mts} +8 -20
  59. package/dist/control-adapter-BVN98SzR-C-H_T7s-.d.mts.map +1 -0
  60. package/dist/control-adapter-DSGwSagr.d.mts +1 -0
  61. package/dist/data-type-CAPmGXg9.mjs +297 -0
  62. package/dist/data-type-CAPmGXg9.mjs.map +1 -0
  63. package/dist/data-type-CpqSDmR_.d.mts +113 -0
  64. package/dist/data-type-CpqSDmR_.d.mts.map +1 -0
  65. package/dist/data-type-support-B_Dr1cxB.d.mts +92 -0
  66. package/dist/data-type-support-B_Dr1cxB.d.mts.map +1 -0
  67. package/dist/{ast-5hifzBHC.mjs → data-type-support-rpD1jyZd.mjs} +6 -329
  68. package/dist/data-type-support-rpD1jyZd.mjs.map +1 -0
  69. package/dist/{db-DLjWu9-f-BjAFEKe9.d.mts → db-DLjWu9-f-T8QbxDGY.d.mts} +6 -6
  70. package/dist/{db-DLjWu9-f-BjAFEKe9.d.mts.map → db-DLjWu9-f-T8QbxDGY.d.mts.map} +1 -1
  71. package/dist/{ddl-types-B48YmQSt-DLCUHORB.d.mts → ddl-types-BUqZdoZK-vyWnW2PW.d.mts} +3 -3
  72. package/dist/{ddl-types-B48YmQSt-DLCUHORB.d.mts.map → ddl-types-BUqZdoZK-vyWnW2PW.d.mts.map} +1 -1
  73. package/dist/{derived-checks-C_y1rk6O-DwCaGICl.mjs → derived-checks-CILnJKoa-D42YRW01.mjs} +48 -25
  74. package/dist/derived-checks-CILnJKoa-D42YRW01.mjs.map +1 -0
  75. package/dist/diff-B16bL_IR.mjs.map +1 -1
  76. package/dist/{diff-CJI5hKWL.d.mts → diff-BsHizC0z.d.mts} +6 -6
  77. package/dist/{diff-CJI5hKWL.d.mts.map → diff-BsHizC0z.d.mts.map} +1 -1
  78. package/dist/{dist-BdePIXOu.mjs → dist-C_HYPisk.mjs} +3 -3
  79. package/dist/{dist-BdePIXOu.mjs.map → dist-C_HYPisk.mjs.map} +1 -1
  80. package/dist/{entity-kinds-ChX-owgJ-DqGkW6Dq.mjs → entity-kinds-BNQFeECV-BOJmOArY.mjs} +4 -4
  81. package/dist/{entity-kinds-ChX-owgJ-DqGkW6Dq.mjs.map → entity-kinds-BNQFeECV-BOJmOArY.mjs.map} +1 -1
  82. package/dist/{expression-n9sdM2RA.d.mts → expression-Bf_MkeQS.d.mts} +3 -3
  83. package/dist/{expression-n9sdM2RA.d.mts.map → expression-Bf_MkeQS.d.mts.map} +1 -1
  84. package/dist/{expression-vAEOvq7J.mjs → expression-Bv8X6-Qg.mjs} +2 -2
  85. package/dist/{expression-vAEOvq7J.mjs.map → expression-Bv8X6-Qg.mjs.map} +1 -1
  86. package/dist/{factories-BnzIZxE1.mjs → factories-D6haP7by.mjs} +2 -2
  87. package/dist/{factories-BnzIZxE1.mjs.map → factories-D6haP7by.mjs.map} +1 -1
  88. package/dist/family.d.mts +13 -13
  89. package/dist/family.mjs +7 -7
  90. package/dist/family__control-adapter.d.mts +2 -2
  91. package/dist/family__control.d.mts +5 -5
  92. package/dist/family__control.mjs +4 -4
  93. package/dist/family__diff.d.mts +3 -3
  94. package/dist/family__diff.mjs +1 -1
  95. package/dist/family__ir.mjs +1 -1
  96. package/dist/family__migration.d.mts +1 -1
  97. package/dist/family__pack.d.mts +1 -1
  98. package/dist/family__pack.mjs +2 -2
  99. package/dist/family__pack.mjs.map +1 -1
  100. package/dist/family__psl-build.d.mts +2 -2
  101. package/dist/family__psl-build.mjs +1 -1
  102. package/dist/family__psl-infer.d.mts +1 -1
  103. package/dist/family__verify.mjs +1 -1
  104. package/dist/{index-BoQtw7lz.d.mts → index-D2ho4por.d.mts} +9 -9
  105. package/dist/{index-BoQtw7lz.d.mts.map → index-D2ho4por.d.mts.map} +1 -1
  106. package/dist/index-type-validation-COH4d78M.mjs.map +1 -1
  107. package/dist/{interpreter-C8cP92FD-BfjuQvb1.mjs → interpreter-CDflex9x-Bx84tcl5.mjs} +33 -29
  108. package/dist/interpreter-CDflex9x-Bx84tcl5.mjs.map +1 -0
  109. package/dist/{middleware-CuGBptK0-xrXqWhc7.d.mts → middleware-BtMX6nSF-DUnzMyGl.d.mts} +3 -3
  110. package/dist/{middleware-CuGBptK0-xrXqWhc7.d.mts.map → middleware-BtMX6nSF-DUnzMyGl.d.mts.map} +1 -1
  111. package/dist/middleware-pBMsszaq.d.mts +1 -0
  112. package/dist/{migration-CSEh4QPu.d.mts → migration-oet2BBxc.d.mts} +2 -2
  113. package/dist/{migration-CSEh4QPu.d.mts.map → migration-oet2BBxc.d.mts.map} +1 -1
  114. package/dist/numeral-text-Cqu87pVe-DJCqBaSC.mjs +20 -0
  115. package/dist/numeral-text-Cqu87pVe-DJCqBaSC.mjs.map +1 -0
  116. package/dist/orm-client.d.mts +101 -58
  117. package/dist/orm-client.d.mts.map +1 -1
  118. package/dist/orm-client.mjs +32 -368
  119. package/dist/orm-client.mjs.map +1 -1
  120. package/dist/{pack-C3mqZevM.d.mts → pack-C-JTs3HQ.d.mts} +2 -16
  121. package/dist/pack-C-JTs3HQ.d.mts.map +1 -0
  122. package/dist/plan-BbkBYyGR.d.mts +2 -0
  123. package/dist/{plan-B7g2kDfQ-Dth0BeTe.d.mts → plan-BlQITcbP-DvbDlHXA.d.mts} +3 -3
  124. package/dist/plan-BlQITcbP-DvbDlHXA.d.mts.map +1 -0
  125. package/dist/{prepared-statement-Cv54gpY_-DbHPSN5Q.d.mts → prepared-statement-Cv54gpY_-dg9Qr8sK.d.mts} +14 -14
  126. package/dist/{prepared-statement-Cv54gpY_-DbHPSN5Q.d.mts.map → prepared-statement-Cv54gpY_-dg9Qr8sK.d.mts.map} +1 -1
  127. package/dist/{psl-build-zkIJwkdq.mjs → psl-build-B6nw6MAM.mjs} +18 -17
  128. package/dist/psl-build-B6nw6MAM.mjs.map +1 -0
  129. package/dist/{psl-build-BnM1ZTyK.d.mts → psl-build-BrW7lQMO.d.mts} +2 -2
  130. package/dist/psl-build-BrW7lQMO.d.mts.map +1 -0
  131. package/dist/{psl-column-resolution-sNpXQygQ-BBo4tqwO.d.mts → psl-column-resolution-BegCa1-t-BJJ9WB1c.d.mts} +4 -5
  132. package/dist/psl-column-resolution-BegCa1-t-BJJ9WB1c.d.mts.map +1 -0
  133. package/dist/{psl-field-resolution-_o74AUE4-C-vTNklI.mjs → psl-field-resolution-CKMm6Gx0-CdzpWIV5.mjs} +69 -17
  134. package/dist/psl-field-resolution-CKMm6Gx0-CdzpWIV5.mjs.map +1 -0
  135. package/dist/{psl-infer-BwbmOInx.d.mts → psl-infer-DzH2Khty.d.mts} +4 -4
  136. package/dist/{psl-infer-BwbmOInx.d.mts.map → psl-infer-DzH2Khty.d.mts.map} +1 -1
  137. package/dist/query-lane-context-CLtywrTY.d.mts +1 -0
  138. package/dist/{query-lane-context-BSmWfohZ-Jn0AbOQt.d.mts → query-lane-context-OSV9X636-CcPv1TZj.d.mts} +6 -10
  139. package/dist/query-lane-context-OSV9X636-CcPv1TZj.d.mts.map +1 -0
  140. package/dist/relational-core.d.mts +12 -12
  141. package/dist/relational-core.mjs +4 -4
  142. package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
  143. package/dist/relational-core__aggregate-descriptor-registry.mjs +1 -1
  144. package/dist/relational-core__ast.d.mts +4 -4
  145. package/dist/relational-core__ast.mjs +3 -3
  146. package/dist/relational-core__codec-descriptor-registry.d.mts +2 -2
  147. package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
  148. package/dist/relational-core__contract-free.d.mts +4 -2
  149. package/dist/relational-core__contract-free.d.mts.map +1 -1
  150. package/dist/relational-core__contract-free.mjs +10 -4
  151. package/dist/relational-core__contract-free.mjs.map +1 -1
  152. package/dist/relational-core__expression.d.mts +1 -1
  153. package/dist/relational-core__expression.mjs +1 -1
  154. package/dist/relational-core__middleware.d.mts +2 -2
  155. package/dist/relational-core__plan.d.mts +3 -3
  156. package/dist/relational-core__query-lane-context.d.mts +2 -2
  157. package/dist/relational-core__types.d.mts +2 -2
  158. package/dist/runtime.d.mts +4 -4
  159. package/dist/runtime.mjs +6 -6
  160. package/dist/runtime__internal__prepared-query.d.mts +1 -1
  161. package/dist/{schema-differ-DpG_gnur-CUh9eZM-.d.mts → schema-differ-DpG_gnur-if2KDxZC.d.mts} +3 -3
  162. package/dist/{schema-differ-DpG_gnur-CUh9eZM-.d.mts.map → schema-differ-DpG_gnur-if2KDxZC.d.mts.map} +1 -1
  163. package/dist/schema-ir.d.mts +2 -2
  164. package/dist/schema-ir.mjs +1 -1
  165. package/dist/schema-ir__types.d.mts +3 -3
  166. package/dist/schema-ir__types.mjs +1 -1
  167. package/dist/{schema-verify-Xmpe1PGb-Bcd_2avJ.mjs → schema-verify-lPfqY_aE-CZCO8my1.mjs} +32 -6
  168. package/dist/schema-verify-lPfqY_aE-CZCO8my1.mjs.map +1 -0
  169. package/dist/{serialized-index-B5X7s-oX-CVs8-5Rw.mjs → serialized-index-BeGqqsrC-PymnV1h-.mjs} +3 -3
  170. package/dist/{serialized-index-B5X7s-oX-CVs8-5Rw.mjs.map → serialized-index-BeGqqsrC-PymnV1h-.mjs.map} +1 -1
  171. package/dist/{sql-contract-serializer-C90xg7_q-C_Okh4NM.mjs → sql-contract-serializer-C90xg7_q-4UVEMTWO.mjs} +5 -5
  172. package/dist/{sql-contract-serializer-C90xg7_q-C_Okh4NM.mjs.map → sql-contract-serializer-C90xg7_q-4UVEMTWO.mjs.map} +1 -1
  173. package/dist/{sql-execution-plan-Db0j752I-dJ-JGxbD.d.mts → sql-execution-plan-CV6K4o9N-DAIvJbkb.d.mts} +3 -3
  174. package/dist/sql-execution-plan-CV6K4o9N-DAIvJbkb.d.mts.map +1 -0
  175. package/dist/{sql-expression-BXx0Ilj-.mjs → sql-expression-D7GsLgDM.mjs} +2 -2
  176. package/dist/{sql-expression-BXx0Ilj-.mjs.map → sql-expression-D7GsLgDM.mjs.map} +1 -1
  177. package/dist/{sql-expression-D_hbJOgM.d.mts → sql-expression-DE_MTt3T.d.mts} +2 -2
  178. package/dist/{sql-expression-D_hbJOgM.d.mts.map → sql-expression-DE_MTt3T.d.mts.map} +1 -1
  179. package/dist/{storage-table-ADhJ4Imk-CwcQVFXC.mjs → storage-table-BwwDKQkD-BN9cZrGX.mjs} +2 -2
  180. package/dist/{storage-table-ADhJ4Imk-CwcQVFXC.mjs.map → storage-table-BwwDKQkD-BN9cZrGX.mjs.map} +1 -1
  181. package/dist/{type-map-DpfnXzun-DZaSuJXh.d.mts → type-map-DmIbL4o--BfPMblbZ.d.mts} +4 -4
  182. package/dist/type-map-DmIbL4o--BfPMblbZ.d.mts.map +1 -0
  183. package/dist/{types-BPi4d3WI-D8PIEqBU.mjs → types-BLnsGaJf-m-qTW3ox.mjs} +3 -3
  184. package/dist/{types-BPi4d3WI-D8PIEqBU.mjs.map → types-BLnsGaJf-m-qTW3ox.mjs.map} +1 -1
  185. package/dist/{types-ByKpjyVh-CtYwWrbL.d.mts → types-CcGO_LSh-BKHiJvvA.d.mts} +8 -26
  186. package/dist/types-CcGO_LSh-BKHiJvvA.d.mts.map +1 -0
  187. package/dist/{types-Z-l6gAVD.mjs → types-Cn4JEguu.mjs} +2 -2
  188. package/dist/{types-Z-l6gAVD.mjs.map → types-Cn4JEguu.mjs.map} +1 -1
  189. package/dist/{types-DAoMCSPl-D2ajBTpK.mjs → types-CyPuXMTn-pumFirZ6.mjs} +4 -7
  190. package/dist/types-CyPuXMTn-pumFirZ6.mjs.map +1 -0
  191. package/dist/types-DZA5xxDT.d.mts +1 -0
  192. package/dist/{types-BzpC_V7p-DyBYmK1f.d.mts → types-Da1Y_OI7-BPyFwdFU.d.mts} +4 -43
  193. package/dist/types-Da1Y_OI7-BPyFwdFU.d.mts.map +1 -0
  194. package/dist/{types-BGHABElw-C5dqoVCg.d.mts → types-DpwLgzPO-Cb9nQ-Wt.d.mts} +6 -6
  195. package/dist/{types-BGHABElw-C5dqoVCg.d.mts.map → types-DpwLgzPO-Cb9nQ-Wt.d.mts.map} +1 -1
  196. package/dist/{types-Yui2yFf6-DYiGm9ET.d.mts → types-Dskga3R1-BtXuRmbf.d.mts} +3 -3
  197. package/dist/{types-Yui2yFf6-DYiGm9ET.d.mts.map → types-Dskga3R1-BtXuRmbf.d.mts.map} +1 -1
  198. package/dist/types-QvcS13Qc.d.mts +1 -0
  199. package/dist/{validators-D1wQns12.d.mts → validators-B-4g3vwP.d.mts} +2 -2
  200. package/dist/{validators-D1wQns12.d.mts.map → validators-B-4g3vwP.d.mts.map} +1 -1
  201. package/dist/{validators-Cx6UXIBf.mjs → validators-IGdAEEIM.mjs} +4 -4
  202. package/dist/{validators-Cx6UXIBf.mjs.map → validators-IGdAEEIM.mjs.map} +1 -1
  203. package/dist/{verify-BVk5bjdH-BXgGLM2U.mjs → verify-BVk5bjdH-dq5M4iIh.mjs} +2 -2
  204. package/dist/{verify-BVk5bjdH-BXgGLM2U.mjs.map → verify-BVk5bjdH-dq5M4iIh.mjs.map} +1 -1
  205. package/package.json +20 -18
  206. package/dist/ast-5hifzBHC.mjs.map +0 -1
  207. package/dist/ast-dPjHeaNs.d.mts.map +0 -1
  208. package/dist/authoring-type-constructors-DIyheCzv-BSrAEZsD.mjs.map +0 -1
  209. package/dist/config-types-DNRmpGNL.mjs.map +0 -1
  210. package/dist/contract-builder-Br5TlHMh.d.mts.map +0 -1
  211. package/dist/contract-builder-C3MYW38z.mjs.map +0 -1
  212. package/dist/control-BYOcSVih.mjs.map +0 -1
  213. package/dist/control-DL9y6GfG.d.mts.map +0 -1
  214. package/dist/control-adapter-C1hjk3Ic.d.mts +0 -1
  215. package/dist/control-adapter-WoXvPNj4-D64oWh9I.d.mts.map +0 -1
  216. package/dist/derived-checks-C_y1rk6O-DwCaGICl.mjs.map +0 -1
  217. package/dist/interpreter-C8cP92FD-BfjuQvb1.mjs.map +0 -1
  218. package/dist/middleware-CN4vQuOi.d.mts +0 -1
  219. package/dist/pack-C3mqZevM.d.mts.map +0 -1
  220. package/dist/plan-B7g2kDfQ-Dth0BeTe.d.mts.map +0 -1
  221. package/dist/plan-CrKSowWJ.d.mts +0 -2
  222. package/dist/psl-build-BnM1ZTyK.d.mts.map +0 -1
  223. package/dist/psl-build-zkIJwkdq.mjs.map +0 -1
  224. package/dist/psl-column-resolution-sNpXQygQ-BBo4tqwO.d.mts.map +0 -1
  225. package/dist/psl-field-resolution-_o74AUE4-C-vTNklI.mjs.map +0 -1
  226. package/dist/query-lane-context-BSmWfohZ-Jn0AbOQt.d.mts.map +0 -1
  227. package/dist/query-lane-context-DWdmmnrN.d.mts +0 -1
  228. package/dist/schema-verify-Xmpe1PGb-Bcd_2avJ.mjs.map +0 -1
  229. package/dist/sql-execution-plan-Db0j752I-dJ-JGxbD.d.mts.map +0 -1
  230. package/dist/type-map-DpfnXzun-DZaSuJXh.d.mts.map +0 -1
  231. package/dist/types-ByKpjyVh-CtYwWrbL.d.mts.map +0 -1
  232. package/dist/types-BzpC_V7p-DyBYmK1f.d.mts.map +0 -1
  233. package/dist/types-CQBRYgDW.d.mts +0 -1
  234. package/dist/types-DAoMCSPl-D2ajBTpK.mjs.map +0 -1
  235. package/dist/types-DdTdsdMn.d.mts +0 -1
@@ -1,16 +1,16 @@
1
1
  import { t as resolveStorageTable } from "./resolve-storage-table-DZsfnzeW.mjs";
2
2
  import { i as isUniqueConstraintViolation } from "./dist-x6jvtkKM.mjs";
3
- import { C as LiteralExpr, D as OrExpr, F as SubqueryExpr, G as isWhereExpr, I as TableSource, L as UpdateAst, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as isOrderByNulls, V as isAggregateFn, _ as InsertAst, b as JsonArrayAggExpr, c as DeleteAst, f as EqColJoinOn, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst } from "./types-BPi4d3WI-D8PIEqBU.mjs";
3
+ import { C as LiteralExpr, D as OrExpr, F as SubqueryExpr, G as isWhereExpr, I as TableSource, L as UpdateAst, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as isOrderByNulls, V as isAggregateFn, _ as InsertAst, b as JsonArrayAggExpr, c as DeleteAst, f as EqColJoinOn, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst } from "./types-BLnsGaJf-m-qTW3ox.mjs";
4
4
  import { t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
5
- import { n as JsonDocumentProjection, r as NativeJsonValueProjection, t as CodecJsonValueProjection } from "./ast-5hifzBHC.mjs";
6
- import { i as isExpression, o as toExpr } from "./expression-vAEOvq7J.mjs";
7
- import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-u6_e6WfA.mjs";
5
+ import { n as JsonDocumentProjection, r as NativeJsonValueProjection, t as CodecJsonValueProjection } from "./ast-CQZn-6Wd.mjs";
6
+ import { i as isExpression, o as toExpr } from "./expression-Bv8X6-Qg.mjs";
7
+ import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-BW0REwkz.mjs";
8
8
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
9
+ import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
10
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
9
11
  import { InternalError, isInternalError } from "@prisma/orm-framework/utils/internal-error";
10
12
  import { domainModelsAtDefaultNamespace } from "@prisma/orm-framework/contract/types";
11
- import { ifDefined } from "@prisma/orm-framework/utils/defined";
12
13
  import { AsyncIterableResult, createMetaBuilder, isRuntimeError, runtimeError } from "@prisma/orm-framework/components/runtime";
13
- import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
14
14
  import { assertDefined, invariant } from "@prisma/orm-framework/utils/assertions";
15
15
  //#region ../../../3-extensions/sql-orm-client/dist/index.mjs
16
16
  const operationNamesByRegistry = /* @__PURE__ */ new WeakMap();
@@ -3896,7 +3896,7 @@ function splitCreateArguments(optionsOrConfigure, configure) {
3896
3896
  function isMtiVariantInfo(variant) {
3897
3897
  return variant?.strategy === "mti";
3898
3898
  }
3899
- var CollectionImpl = class CollectionImpl {
3899
+ var CollectionBase = class CollectionBase {
3900
3900
  /** @internal */
3901
3901
  ctx;
3902
3902
  /** @internal */
@@ -3932,7 +3932,7 @@ var CollectionImpl = class CollectionImpl {
3932
3932
  * because their names are the registry's, not the class declaration's.
3933
3933
  *
3934
3934
  * A name the collection already carries is skipped, and which member holds
3935
- * it decides what the skip means. A `CollectionImpl` member is rejected at
3935
+ * it decides what the skip means. A `CollectionBase` member is rejected at
3936
3936
  * ORM composition with `ORM.AGGREGATE_OPERATION_RESERVED`, since
3937
3937
  * {@link reservedCollectionMemberNames} scans this class. A member declared
3938
3938
  * by a custom collection class registered through `orm({ collections })`
@@ -3972,27 +3972,14 @@ var CollectionImpl = class CollectionImpl {
3972
3972
  namespaceId: this.namespaceId
3973
3973
  });
3974
3974
  if (!filter) return blindCast(this);
3975
- return this.#clone({ filters: [...this.state.filters, filter] });
3975
+ return this.#cloneSelf({ filters: [...this.state.filters, filter] });
3976
3976
  }
3977
3977
  /**
3978
- * Narrow a polymorphic model to a specific variant. The returned
3979
- * collection has the variant's row shape and a discriminator filter
3980
- * is automatically applied. Chaining `.variant(...)` again replaces
3981
- * the previous variant filter.
3982
- *
3983
- * ```typescript
3984
- * // Read only admin users (STI):
3985
- * const admins = await db.orm.User.variant('Admin').all();
3986
- *
3987
- * // Iterate the rows:
3988
- * for await (const admin of db.orm.User.variant('Admin').all()) {
3989
- * console.log(admin.role);
3990
- * }
3991
- *
3992
- * // Insert under a variant — discriminator is injected automatically:
3993
- * await db.orm.User.variant('Admin').create({ name: 'Ada', role: 'super' });
3994
- * ```
3978
+ * Call `fn` with this collection and return its result.
3995
3979
  */
3980
+ apply(fn) {
3981
+ return fn(this);
3982
+ }
3996
3983
  variant(variantName) {
3997
3984
  const model = modelOf(this.contract, this.namespaceId, this.modelName);
3998
3985
  const discriminator = model?.discriminator;
@@ -4052,46 +4039,15 @@ var CollectionImpl = class CollectionImpl {
4052
4039
  };
4053
4040
  return this.#cloneWithRow({ includes: [...this.state.includes, includeExpr] });
4054
4041
  }
4055
- /**
4056
- * Project the row down to a subset of scalar fields. Previously
4057
- * included relations are preserved on the resulting row shape; only
4058
- * scalar columns are narrowed.
4059
- *
4060
- * ```typescript
4061
- * const summaries = await db.orm.User.select('id', 'email').all();
4062
- * // typeof summaries[number] === { id: ...; email: ... }
4063
- *
4064
- * for await (const row of db.orm.User.select('id', 'email').all()) {
4065
- * console.log(row.id, row.email);
4066
- * }
4067
- * ```
4068
- */
4069
4042
  select(...fields) {
4070
4043
  const selectedFields = mapFieldsToColumns(this.contract, this.namespaceId, this.modelName, fields);
4071
4044
  return this.#cloneWithRow({ selectedFields });
4072
4045
  }
4073
- /**
4074
- * Append an `ORDER BY` clause. Pass a single selector callback or an
4075
- * array of callbacks; each receives a typed model accessor whose
4076
- * columns expose `.asc()` and `.desc()`. Multiple calls append to the
4077
- * existing list (left-to-right ordering preserved).
4078
- *
4079
- * Calling `orderBy(...)` unlocks `cursor(...)` and `distinctOn(...)`,
4080
- * which both require a defined sort order.
4081
- *
4082
- * ```typescript
4083
- * const newest = await db.orm.User.orderBy((u) => u.createdAt.desc()).all();
4084
- *
4085
- * const byName = await db.orm.User
4086
- * .orderBy([(u) => u.lastName.asc(), (u) => u.firstName.asc()])
4087
- * .all();
4088
- * ```
4089
- */
4090
4046
  orderBy(selection) {
4091
4047
  const accessor = createModelAccessor(this.ctx.context, this.namespaceId, this.modelName, this.state.variantName);
4092
4048
  const nextOrders = (Array.isArray(selection) ? selection : [selection]).map((selector) => selector(accessor));
4093
4049
  const existing = this.state.orderBy ?? [];
4094
- return this.#clone({ orderBy: [...existing, ...nextOrders] });
4050
+ return this.#cloneSelf({ orderBy: [...existing, ...nextOrders] });
4095
4051
  }
4096
4052
  /**
4097
4053
  * Switch to grouped-aggregate mode. Returns a `GroupedCollection`
@@ -4161,136 +4117,39 @@ var CollectionImpl = class CollectionImpl {
4161
4117
  }
4162
4118
  return createIncludeCombine(branches);
4163
4119
  }
4164
- /**
4165
- * Resume pagination from a known cursor position. Requires a prior
4166
- * `orderBy(...)` so the cursor has a stable basis; provide a value
4167
- * for every column referenced by the active `orderBy(...)` so each
4168
- * ordered axis has a defined boundary.
4169
- *
4170
- * ```typescript
4171
- * const page1 = await db.orm.Post
4172
- * .orderBy((p) => p.createdAt.desc())
4173
- * .limit(20)
4174
- * .all();
4175
- *
4176
- * const last = page1[page1.length - 1]!;
4177
- * const page2 = await db.orm.Post
4178
- * .orderBy((p) => p.createdAt.desc())
4179
- * .cursor({ createdAt: last.createdAt })
4180
- * .limit(20)
4181
- * .all();
4182
- * ```
4183
- */
4184
4120
  cursor(cursorValues) {
4185
4121
  assertCursorCompatibleOrder(this.state.orderBy);
4186
4122
  const mappedCursor = mapCursorValuesToColumns(this.contract, this.namespaceId, this.modelName, cursorValues);
4187
- if (Object.keys(mappedCursor).length === 0) return blindCast(this);
4188
- return this.#clone({ cursor: mappedCursor });
4123
+ if (Object.keys(mappedCursor).length === 0) return this;
4124
+ return this.#cloneSelf({ cursor: mappedCursor });
4189
4125
  }
4190
- /**
4191
- * Emit `SELECT DISTINCT` keyed on the given fields. Replaces any
4192
- * previous `distinct(...)` / `distinctOn(...)` selection.
4193
- *
4194
- * ```typescript
4195
- * const groups = await db.orm.User.distinct('country', 'role').all();
4196
- * ```
4197
- */
4198
4126
  distinct(...fields) {
4199
4127
  const distinctFields = mapFieldsToColumns(this.contract, this.namespaceId, this.modelName, fields);
4200
- return this.#clone({
4128
+ return this.#cloneSelf({
4201
4129
  distinct: distinctFields,
4202
4130
  distinctOn: void 0
4203
4131
  });
4204
4132
  }
4205
- /**
4206
- * Emit `SELECT DISTINCT ON (fields)` — keep the first row per
4207
- * distinct key according to the current `orderBy(...)`. Requires a
4208
- * prior `orderBy(...)`; replaces any previous `distinct(...)` /
4209
- * `distinctOn(...)` selection.
4210
- *
4211
- * Requires the `postgres.distinctOn` capability.
4212
- *
4213
- * ```typescript
4214
- * // Latest post per user:
4215
- * const latestPerUser = await db.orm.Post
4216
- * .orderBy([(p) => p.userId.asc(), (p) => p.createdAt.desc()])
4217
- * .distinctOn('userId')
4218
- * .all();
4219
- * ```
4220
- */
4221
4133
  distinctOn(...fields) {
4222
4134
  assertDistinctOnCapability(this.contract, "distinctOn");
4223
4135
  assertDistinctOnCompatibleOrder(this.state.orderBy, fields.length);
4224
4136
  const distinctOnFields = mapFieldsToColumns(this.contract, this.namespaceId, this.modelName, fields);
4225
- return this.#clone({
4137
+ return this.#cloneSelf({
4226
4138
  distinct: void 0,
4227
4139
  distinctOn: distinctOnFields
4228
4140
  });
4229
4141
  }
4230
- /**
4231
- * Apply `LIMIT n`. Replaces any previous limit set on this collection.
4232
- *
4233
- * ```typescript
4234
- * const firstTen = await db.orm.User.orderBy((u) => u.id.asc()).limit(10).all();
4235
- * ```
4236
- */
4237
4142
  limit(n) {
4238
- return this.#clone({ limit: typeof n === "number" ? n : toExpr(n) });
4143
+ return this.#cloneSelf({ limit: typeof n === "number" ? n : toExpr(n) });
4239
4144
  }
4240
- /**
4241
- * Apply `OFFSET n`. Replaces any previous offset set on this collection.
4242
- *
4243
- * ```typescript
4244
- * const page2 = await db.orm.User
4245
- * .orderBy((u) => u.id.asc())
4246
- * .offset(10)
4247
- * .limit(10)
4248
- * .all();
4249
- * ```
4250
- */
4251
4145
  offset(n) {
4252
- return this.#clone({ offset: typeof n === "number" ? n : toExpr(n) });
4146
+ return this.#cloneSelf({ offset: typeof n === "number" ? n : toExpr(n) });
4253
4147
  }
4254
- /**
4255
- * Read terminal: execute the query and stream every matching row.
4256
- *
4257
- * The returned `AsyncIterableResult<Row>` is BOTH a thenable that
4258
- * resolves to `Row[]` (so `await` collects all rows into an array)
4259
- * AND an async iterable (so `for await` streams rows as they
4260
- * arrive, without buffering the whole result set in memory). Pick
4261
- * whichever fits the caller. A single result can only be consumed
4262
- * once.
4263
- *
4264
- * Queries without `include(...)` stream rows as the driver yields them (drivers that cannot
4265
- * expose a cursor buffer internally first). Queries with `include(...)` read the whole parent
4266
- * result set into memory before yielding the first row.
4267
- *
4268
- * ```typescript
4269
- * // Thenable — collect to an array:
4270
- * const users = await db.orm.User.all();
4271
- * for (const user of users) console.log(user.id);
4272
- *
4273
- * // Async iterable — stream rows as they arrive:
4274
- * for await (const user of db.orm.User.all()) {
4275
- * console.log(user.id);
4276
- * }
4277
- * ```
4278
- *
4279
- * Accepts an optional `configure` callback that receives a
4280
- * `MetaBuilder<'read'>` so the caller can attach typed user
4281
- * annotations to the executed plan. `meta.annotate(...)` enforces
4282
- * applicability at the type level and at runtime; annotations are
4283
- * merged into `plan.meta.annotations` at compile time.
4284
- *
4285
- * ```typescript
4286
- * await db.orm.User.all((meta) => meta.annotate(cacheAnnotation({ key: 'users' })));
4287
- * ```
4288
- */
4289
4148
  all(configure) {
4290
4149
  return this.#withAnnotationsFromMeta(configure, "all").#dispatch();
4291
4150
  }
4292
4151
  get prepared() {
4293
- return {
4152
+ return blindCast({
4294
4153
  aggregate: (fn, configure) => this.#describeAggregate(fn, configure),
4295
4154
  all: (configure) => {
4296
4155
  return describeCollectionRows(this.#withAnnotationsFromMeta(configure, "all").#descriptionOptions());
@@ -4298,7 +4157,7 @@ var CollectionImpl = class CollectionImpl {
4298
4157
  first: (filter, configure) => {
4299
4158
  return describeCollectionFirst(this.#forFirst(filter, configure).#descriptionOptions());
4300
4159
  }
4301
- };
4160
+ });
4302
4161
  }
4303
4162
  #descriptionOptions() {
4304
4163
  return {
@@ -4405,41 +4264,6 @@ var CollectionImpl = class CollectionImpl {
4405
4264
  model: this.modelName
4406
4265
  } });
4407
4266
  }
4408
- /**
4409
- * Write terminal: insert many rows and stream the inserted rows.
4410
- *
4411
- * The returned `AsyncIterableResult<Row>` is BOTH a thenable that
4412
- * resolves to `Row[]` AND an async iterable that streams inserted
4413
- * rows as they arrive. Use whichever shape fits the caller — but
4414
- * only consume it once. Streaming is the default; some
4415
- * driver/plan combinations may still buffer internally before
4416
- * yielding.
4417
- *
4418
- * ```typescript
4419
- * // Thenable — collect all inserted rows into an array:
4420
- * const created = await db.orm.User.createAll([
4421
- * { email: 'a@example.com' },
4422
- * { email: 'b@example.com' },
4423
- * ]);
4424
- *
4425
- * // Async iterable — stream inserted rows as they arrive:
4426
- * for await (const row of db.orm.User.createAll(seedUsers)) {
4427
- * console.log('inserted', row.id);
4428
- * }
4429
- *
4430
- * // Let the database skip rows that collide with a unique
4431
- * // constraint; only the rows it inserted come back:
4432
- * const inserted = await db.orm.User.createAll(seedUsers, {
4433
- * onConflict: 'skip',
4434
- * conflictOn: ['email'],
4435
- * });
4436
- * ```
4437
- *
4438
- * Accepts an optional `configure` callback that receives a
4439
- * `MetaBuilder<'write'>` for attaching typed annotations to the
4440
- * compiled insert plan. It may be passed in second position when
4441
- * there are no options.
4442
- */
4443
4267
  createAll(data, optionsOrConfigure, configure) {
4444
4268
  const { options, configureCallback } = splitCreateArguments(optionsOrConfigure, configure);
4445
4269
  const conflictSkip = this.#resolveConflictSkip(options, "createAll()");
@@ -4662,38 +4486,6 @@ var CollectionImpl = class CollectionImpl {
4662
4486
  const compiled = mergeAnnotations(compileInsertCount(this.contract, this.namespaceId, this.tableName, mappedRows, conflictSkip), annotationsMap);
4663
4487
  return (await this.ctx.runtime.execute(compiled)).affectedRows;
4664
4488
  }
4665
- /**
4666
- * Write terminal: insert a row, or update the existing row on
4667
- * conflict. Returns the resulting row (the inserted one or the
4668
- * updated/existing one).
4669
- *
4670
- * `conflictOn` selects which unique constraint drives the conflict
4671
- * resolution — omit to use the model's primary key.
4672
- *
4673
- * ```typescript
4674
- * // Insert-or-update on email uniqueness:
4675
- * await db.orm.User.upsert({
4676
- * create: { email: 'alice@example.com', name: 'Alice' },
4677
- * update: { name: 'Alice (updated)' },
4678
- * conflictOn: { email: 'alice@example.com' },
4679
- * });
4680
- *
4681
- * // Conditional create — `update: {}` keeps the existing row
4682
- * // unchanged. `conflictOn` must reference the constraint that
4683
- * // makes the row "already exist"; omit only when the conflict is
4684
- * // on the primary key. On conflict,
4685
- * // `ON CONFLICT DO NOTHING RETURNING ...` may return zero rows,
4686
- * // so a follow-up reload is issued to fetch and return the
4687
- * // existing row.
4688
- * await db.orm.User.upsert({
4689
- * create: { email: 'alice@example.com', name: 'Alice' },
4690
- * update: {},
4691
- * conflictOn: { email: 'alice@example.com' },
4692
- * });
4693
- * ```
4694
- *
4695
- * Not supported on MTI variants.
4696
- */
4697
4489
  async upsert(input, configure) {
4698
4490
  assertReturningCapability(this.contract, "upsert()");
4699
4491
  this.#assertNotMtiVariant("upsert()");
@@ -4736,44 +4528,6 @@ var CollectionImpl = class CollectionImpl {
4736
4528
  model: this.modelName
4737
4529
  } });
4738
4530
  }
4739
- /**
4740
- * Write terminal: update a single matching row — the first one the
4741
- * filter matches — and return it (or `null` when no row matched).
4742
- * Requires a prior `.where(...)` — calling `update(...)` on an
4743
- * unfiltered collection is a type error.
4744
- *
4745
- * Related rows can be created, linked, or unlinked through relation callbacks on any relation:
4746
- * to-one (1:1, N:1), to-many (1:N), and many-to-many (N:M, written through the junction table).
4747
- * The callback receives a mutator exposing `create(...)`, `connect(...)`, and `disconnect(...)`.
4748
- * A to-one `disconnect()` clears the foreign key; a to-many `disconnect()` with no criteria
4749
- * unlinks every related row; an N:M `disconnect()` requires criteria. N:M `create`/`connect` are
4750
- * unavailable when the junction has required columns the relation API cannot populate. Nested
4751
- * updates against existing related rows are not supported through this API.
4752
- *
4753
- * ```typescript
4754
- * // Update one row by id:
4755
- * const updated = await db.orm.User
4756
- * .where({ id: 1 })
4757
- * .update({ name: 'Alice Renamed' });
4758
- *
4759
- * // Update + relink — runs as a graph of internal mutations:
4760
- * await db.orm.User
4761
- * .where({ id: 1 })
4762
- * .update({
4763
- * name: 'Alice',
4764
- * posts: (posts) => posts.connect([{ id: 5 }]),
4765
- * });
4766
- * ```
4767
- *
4768
- * Accepts an optional `configure` callback that receives a
4769
- * `MetaBuilder<'write'>` for attaching typed annotations.
4770
- *
4771
- * Note: when the input contains nested-mutation callbacks, the
4772
- * operation is executed as a graph of internal queries via
4773
- * `withMutationScope`. In that path the `configure` callback still runs, so `meta.annotate`
4774
- * validation applies, but the recorded annotations are discarded: neither the nested
4775
- * statements nor the read-back query carry them.
4776
- */
4777
4531
  async update(data, configure) {
4778
4532
  assertReturningCapability(this.contract, "update()");
4779
4533
  const annotationsMap = this.#collectAnnotationsFromMeta(configure, "write", "update");
@@ -4797,31 +4551,6 @@ var CollectionImpl = class CollectionImpl {
4797
4551
  return (await scoped.#clone({ filters: [identityWhere] }).#updateAllWithAnnotations(blindCast(data), annotationsMap))[0] ?? null;
4798
4552
  });
4799
4553
  }
4800
- /**
4801
- * Write terminal: update every matching row and stream the updated
4802
- * rows. Requires a prior `.where(...)` filter.
4803
- *
4804
- * The returned `AsyncIterableResult<Row>` is BOTH a thenable that
4805
- * resolves to `Row[]` AND an async iterable that streams updated
4806
- * rows as they arrive. Use whichever fits; a result can only be
4807
- * consumed once. Streaming is the default; some driver/plan
4808
- * combinations may still buffer internally before yielding.
4809
- *
4810
- * ```typescript
4811
- * // Thenable — collect updated rows into an array:
4812
- * const updated = await db.orm.Post
4813
- * .where({ published: false })
4814
- * .updateAll({ published: true });
4815
- *
4816
- * // Async iterable — stream updated rows as they arrive:
4817
- * for await (const row of db.orm.Post.where({ draft: true }).updateAll({ draft: false })) {
4818
- * console.log('published', row.id);
4819
- * }
4820
- * ```
4821
- *
4822
- * Accepts an optional `configure` callback that receives a
4823
- * `MetaBuilder<'write'>` for attaching typed annotations.
4824
- */
4825
4554
  updateAll(data, configure) {
4826
4555
  return this.#updateAllWithAnnotations(data, this.#collectAnnotationsFromMeta(configure, "write", "updateAll"));
4827
4556
  }
@@ -4849,20 +4578,6 @@ var CollectionImpl = class CollectionImpl {
4849
4578
  mapRow: (mapped) => blindCast(mapped)
4850
4579
  });
4851
4580
  }
4852
- /**
4853
- * Write terminal: update every matching row without returning them,
4854
- * resolving to the count of rows that were updated. Requires a prior
4855
- * `.where(...)` filter.
4856
- *
4857
- * Prefer `updateAll(...)` when you need the updated rows; prefer
4858
- * this when you only need the affected-row count.
4859
- *
4860
- * ```typescript
4861
- * const count = await db.orm.Post
4862
- * .where({ published: false })
4863
- * .updateAndCount({ published: true });
4864
- * ```
4865
- */
4866
4581
  async updateAndCount(data, configure) {
4867
4582
  const mappedData = mapModelDataToStorageRow(this.contract, this.namespaceId, this.modelName, data);
4868
4583
  if (Object.keys(mappedData).length === 0) return 0;
@@ -4871,20 +4586,6 @@ var CollectionImpl = class CollectionImpl {
4871
4586
  const compiled = mergeAnnotations(compileUpdateCount(this.contract, this.namespaceId, this.tableName, mappedData, this.state.filters, this.state.variantName, this.modelName), annotationsMap);
4872
4587
  return (await this.ctx.runtime.execute(compiled)).affectedRows;
4873
4588
  }
4874
- /**
4875
- * Write terminal: delete a single matching row — the first one the
4876
- * filter matches — and return it (or `null` when no row matched).
4877
- * Requires a prior `.where(...)` — calling `delete()` on an
4878
- * unfiltered collection is a type error.
4879
- *
4880
- * ```typescript
4881
- * const deleted = await db.orm.User.where({ id: 1 }).delete();
4882
- * if (deleted) console.log('deleted', deleted.email);
4883
- * ```
4884
- *
4885
- * Accepts an optional `configure` callback that receives a
4886
- * `MetaBuilder<'write'>` for attaching typed annotations.
4887
- */
4888
4589
  async delete(configure) {
4889
4590
  assertReturningCapability(this.contract, "delete()");
4890
4591
  const annotationsMap = this.#collectAnnotationsFromMeta(configure, "write", "delete");
@@ -4895,31 +4596,8 @@ var CollectionImpl = class CollectionImpl {
4895
4596
  return (await scoped.#clone({ filters: [identityWhere] }).#executeDeleteReturning(annotationsMap).toArray())[0] ?? null;
4896
4597
  });
4897
4598
  }
4898
- /**
4899
- * Write terminal: delete every matching row and stream the deleted
4900
- * rows. Requires a prior `.where(...)` filter.
4901
- *
4902
- * The returned `AsyncIterableResult<Row>` is BOTH a thenable that
4903
- * resolves to `Row[]` AND an async iterable that streams deleted
4904
- * rows as they arrive. Use whichever fits; a result can only be
4905
- * consumed once. Streaming is the default; some driver/plan
4906
- * combinations may still buffer internally before yielding.
4907
- *
4908
- * ```typescript
4909
- * // Thenable — collect the deleted rows into an array:
4910
- * const deleted = await db.orm.Post.where({ archived: true }).deleteAll();
4911
- *
4912
- * // Async iterable — stream deleted rows as they arrive:
4913
- * for await (const row of db.orm.Post.where({ archived: true }).deleteAll()) {
4914
- * console.log('removed', row.id);
4915
- * }
4916
- * ```
4917
- *
4918
- * Accepts an optional `configure` callback that receives a
4919
- * `MetaBuilder<'write'>` for attaching typed annotations.
4920
- */
4921
4599
  deleteAll(configure) {
4922
- return blindCast(this).#deleteAllWithAnnotations(this.#collectAnnotationsFromMeta(configure, "write", "deleteAll"));
4600
+ return this.#deleteAllWithAnnotations(this.#collectAnnotationsFromMeta(configure, "write", "deleteAll"));
4923
4601
  }
4924
4602
  #deleteAllWithAnnotations(annotationsMap) {
4925
4603
  assertReturningCapability(this.contract, "deleteAll()");
@@ -4976,18 +4654,6 @@ var CollectionImpl = class CollectionImpl {
4976
4654
  };
4977
4655
  return new AsyncIterableResult(generator());
4978
4656
  }
4979
- /**
4980
- * Write terminal: delete every matching row without returning them,
4981
- * resolving to the count of rows that were deleted. Requires a prior
4982
- * `.where(...)` filter.
4983
- *
4984
- * Prefer `deleteAll(...)` when you need the deleted rows; prefer
4985
- * this when you only need the affected-row count.
4986
- *
4987
- * ```typescript
4988
- * const removed = await db.orm.Post.where({ archived: true }).deleteAndCount();
4989
- * ```
4990
- */
4991
4657
  async deleteAndCount(configure) {
4992
4658
  const annotationsMap = this.#collectAnnotationsFromMeta(configure, "write", "deleteAndCount");
4993
4659
  const compiled = mergeAnnotations(compileDeleteCount(this.contract, this.namespaceId, this.tableName, this.state.filters, this.state.variantName, this.modelName), annotationsMap);
@@ -5087,6 +4753,12 @@ var CollectionImpl = class CollectionImpl {
5087
4753
  ...overrides
5088
4754
  });
5089
4755
  }
4756
+ #cloneSelf(overrides) {
4757
+ return blindCast(this.#createSelf({
4758
+ ...this.state,
4759
+ ...overrides
4760
+ }));
4761
+ }
5090
4762
  #withRuntime(runtime) {
5091
4763
  return blindCast(new (blindCast(this.constructor))({
5092
4764
  ...this.ctx,
@@ -5115,7 +4787,7 @@ var CollectionImpl = class CollectionImpl {
5115
4787
  }));
5116
4788
  }
5117
4789
  #createCollection(modelName, options) {
5118
- return blindCast(new ((this.registry.get(modelName)) ?? (blindCast(CollectionImpl)))(this.ctx, modelName, {
4790
+ return blindCast(new ((this.registry.get(modelName)) ?? (blindCast(CollectionBase)))(this.ctx, modelName, {
5119
4791
  tableName: options.tableName,
5120
4792
  namespaceId: options.namespaceId,
5121
4793
  state: options.state,
@@ -5190,17 +4862,9 @@ const collectionInstanceMemberNames = [
5190
4862
  * so ORM composition rejects any operation this set contains.
5191
4863
  */
5192
4864
  function reservedCollectionMemberNames() {
5193
- return /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(CollectionImpl.prototype), ...collectionInstanceMemberNames]);
4865
+ return /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(CollectionBase.prototype), ...collectionInstanceMemberNames]);
5194
4866
  }
5195
- const Collection = blindCast(CollectionImpl);
5196
- /**
5197
- * The class behind {@link Collection}, for package-internal prototype-chain
5198
- * checks (`instanceof`) and default construction. The public constructor
5199
- * surface carries a single construct signature returning the intersection,
5200
- * which heritage clauses require; the raw class keeps the `Function` shape
5201
- * those checks need.
5202
- */
5203
- const CollectionBase = CollectionImpl;
4867
+ const Collection = blindCast(CollectionBase);
5204
4868
  /**
5205
4869
  * Reject a contributed aggregate operation whose name a collection member
5206
4870
  * already owns. Aggregate operations surface as reducer methods on the