@prisma/orm-target-sqlite 8.0.0-rc.9-dev.12 → 8.0.1-dev.1

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 (309) hide show
  1. package/README.md +5 -1
  2. package/dist/adapter-CLQMz42P.d.mts +205 -0
  3. package/dist/adapter-CLQMz42P.d.mts.map +1 -0
  4. package/dist/{adapter-jwxys1MM-CmUELyBs.mjs → adapter-CxzIV2_z-DKbo2Ebu.mjs} +347 -137
  5. package/dist/adapter-CxzIV2_z-DKbo2Ebu.mjs.map +1 -0
  6. package/dist/{adapter-DEYUC-KO-DO_abhIq.d.mts → adapter-xFPDhkod-Bfb8AQQJ.d.mts} +12 -9
  7. package/dist/adapter-xFPDhkod-Bfb8AQQJ.d.mts.map +1 -0
  8. package/dist/adapter.d.mts +14 -15
  9. package/dist/adapter.mjs +7 -6
  10. package/dist/adapter__adapter.d.mts +4 -4
  11. package/dist/adapter__adapter.mjs +3 -2
  12. package/dist/adapter__codec-types.d.mts +3 -3
  13. package/dist/adapter__column-types.d.mts +2 -2
  14. package/dist/adapter__column-types.mjs +2 -2
  15. package/dist/adapter__control.d.mts +5 -5
  16. package/dist/adapter__control.mjs +12 -247
  17. package/dist/adapter__control.mjs.map +1 -1
  18. package/dist/adapter__runtime.d.mts +1 -1
  19. package/dist/adapter__runtime.mjs +30 -16
  20. package/dist/adapter__runtime.mjs.map +1 -1
  21. package/dist/adapter__sql-renderer.d.mts +2 -2
  22. package/dist/adapter__sql-renderer.mjs +1 -1
  23. package/dist/adapter__types.d.mts +3 -2
  24. package/dist/aggregates-CA7Idm1d.d.mts +164 -0
  25. package/dist/aggregates-CA7Idm1d.d.mts.map +1 -0
  26. package/dist/{aggregates-DWyPO7t6.mjs → aggregates-hLiHPHBG.mjs} +44 -26
  27. package/dist/aggregates-hLiHPHBG.mjs.map +1 -0
  28. package/dist/codec-descriptor-3oN7rtrW-Cc_u7U5-.d.mts +1 -0
  29. package/dist/codec-descriptor-C16gQAdS.d.mts +2 -0
  30. package/dist/{codec-descriptor-B9ru99aI-DTkdKFU5.mjs → codec-descriptor-DRmF-crq-BALI5Jtz.mjs} +11 -15
  31. package/dist/codec-descriptor-DRmF-crq-BALI5Jtz.mjs.map +1 -0
  32. package/dist/codec-descriptor-DuW-d9ef-BBRBN0Ri.d.mts +45 -0
  33. package/dist/codec-descriptor-DuW-d9ef-BBRBN0Ri.d.mts.map +1 -0
  34. package/dist/codec-ids-CH8Nqk89-LNT9hksu.d.mts +23 -0
  35. package/dist/codec-ids-CH8Nqk89-LNT9hksu.d.mts.map +1 -0
  36. package/dist/codec-ids-CTshXpbg-tcdbf_VC.mjs +23 -0
  37. package/dist/codec-ids-CTshXpbg-tcdbf_VC.mjs.map +1 -0
  38. package/dist/codec-ids-Do7Ml2pg.d.mts +1 -0
  39. package/dist/codec-types-CBLOfyrr.d.mts +2 -0
  40. package/dist/codec-types-CcuzuROC.d.mts +1 -0
  41. package/dist/codec-types-Ci-h2uxN-41PNpdNL.d.mts +35 -0
  42. package/dist/codec-types-Ci-h2uxN-41PNpdNL.d.mts.map +1 -0
  43. package/dist/codecs-BO3frExA.mjs +49 -0
  44. package/dist/codecs-BO3frExA.mjs.map +1 -0
  45. package/dist/codecs-DBQsDiM--Cy-r45H3.d.mts +378 -0
  46. package/dist/codecs-DBQsDiM--Cy-r45H3.d.mts.map +1 -0
  47. package/dist/codecs-Dou3fR1K.d.mts +1 -0
  48. package/dist/codecs-izq9l1NG-Bb2RnXsx.mjs +1081 -0
  49. package/dist/codecs-izq9l1NG-Bb2RnXsx.mjs.map +1 -0
  50. package/dist/column-types-D3MMpY3X.d.mts +42 -0
  51. package/dist/column-types-D3MMpY3X.d.mts.map +1 -0
  52. package/dist/column-types-D_PjRS6w.mjs +24 -0
  53. package/dist/column-types-D_PjRS6w.mjs.map +1 -0
  54. package/dist/contract-contributions-DEePsuJb-CXE-f6pP.mjs +28 -0
  55. package/dist/contract-contributions-DEePsuJb-CXE-f6pP.mjs.map +1 -0
  56. package/dist/{contract-free-D5cZrgNl.mjs → contract-free-B5S1OSEd.mjs} +8 -7
  57. package/dist/contract-free-B5S1OSEd.mjs.map +1 -0
  58. package/dist/{contract-free-CCLAXZV2.d.mts → contract-free-IqKgq8Pk.d.mts} +6 -6
  59. package/dist/contract-free-IqKgq8Pk.d.mts.map +1 -0
  60. package/dist/{control-D9vMRRgU.d.mts → control-C2TjacST.d.mts} +3 -3
  61. package/dist/control-C2TjacST.d.mts.map +1 -0
  62. package/dist/control-CtCvtwJx.d.mts +408 -0
  63. package/dist/control-CtCvtwJx.d.mts.map +1 -0
  64. package/dist/{control-CLirKz11.d.mts → control-DfWteXy-.d.mts} +31 -45
  65. package/dist/control-DfWteXy-.d.mts.map +1 -0
  66. package/dist/control-V3kPfMTR.mjs +61 -0
  67. package/dist/control-V3kPfMTR.mjs.map +1 -0
  68. package/dist/{control-tables-Dua-YcJL.d.mts → control-tables-DKXLHvMU.d.mts} +2 -2
  69. package/dist/control-tables-DKXLHvMU.d.mts.map +1 -0
  70. package/dist/{control-tables-D_o8dKRB-BXi43noL.mjs → control-tables-D_o8dKRB-n_QqsXcm.mjs} +2 -2
  71. package/dist/control-tables-D_o8dKRB-n_QqsXcm.mjs.map +1 -0
  72. package/dist/data-type-entries-DaT4D2GV-DE0V_N6k.mjs +120 -0
  73. package/dist/data-type-entries-DaT4D2GV-DE0V_N6k.mjs.map +1 -0
  74. package/dist/data-types-C1nzwKt7.d.mts +68 -0
  75. package/dist/data-types-C1nzwKt7.d.mts.map +1 -0
  76. package/dist/data-types-Djvapurb-BR-Y4NWN.mjs +239 -0
  77. package/dist/data-types-Djvapurb-BR-Y4NWN.mjs.map +1 -0
  78. package/dist/date-time-now-generators-DUb3x91B-D0keGG59.mjs +64 -0
  79. package/dist/date-time-now-generators-DUb3x91B-D0keGG59.mjs.map +1 -0
  80. package/dist/datetime-text-DPjoF6HJ-se0mLEbc.mjs +32 -0
  81. package/dist/datetime-text-DPjoF6HJ-se0mLEbc.mjs.map +1 -0
  82. package/dist/ddl-31OBcTco.d.mts +1 -0
  83. package/dist/{ddl-CXduXyOT-nlDP6DGx.mjs → ddl-CgkyurGo-B2o4mSIT.mjs} +45 -8
  84. package/dist/ddl-CgkyurGo-B2o4mSIT.mjs.map +1 -0
  85. package/dist/default-normalizer-BANdMVGr-BiUHyBX1.mjs +124 -0
  86. package/dist/default-normalizer-BANdMVGr-BiUHyBX1.mjs.map +1 -0
  87. package/dist/default-normalizer-CtNsZNRZ.d.mts +25 -0
  88. package/dist/default-normalizer-CtNsZNRZ.d.mts.map +1 -0
  89. package/dist/descriptor-meta-CafFMPhN-x3YQXDSX.mjs +26 -0
  90. package/dist/descriptor-meta-CafFMPhN-x3YQXDSX.mjs.map +1 -0
  91. package/dist/descriptor-meta-CkiPlqDS-n3hDP01X.mjs +137 -0
  92. package/dist/descriptor-meta-CkiPlqDS-n3hDP01X.mjs.map +1 -0
  93. package/dist/descriptor-meta-DEr1ALec-DvT6glGq.mjs +385 -0
  94. package/dist/descriptor-meta-DEr1ALec-DvT6glGq.mjs.map +1 -0
  95. package/dist/driver.d.mts +2 -2
  96. package/dist/driver.mjs +1 -1
  97. package/dist/driver__control.d.mts +1 -1
  98. package/dist/driver__control.mjs +1 -1
  99. package/dist/driver__runtime.d.mts +1 -1
  100. package/dist/driver__runtime.mjs +58 -20
  101. package/dist/driver__runtime.mjs.map +1 -1
  102. package/dist/errors-DxbvEzQp-CeTjoGtL.mjs +146 -0
  103. package/dist/errors-DxbvEzQp-CeTjoGtL.mjs.map +1 -0
  104. package/dist/{migration-DOKPHtxn.mjs → migration-BYRMZiPU.mjs} +6 -5
  105. package/dist/migration-BYRMZiPU.mjs.map +1 -0
  106. package/dist/{migration-uylRe5MP.d.mts → migration-Dekon_QC.d.mts} +6 -5
  107. package/dist/migration-Dekon_QC.d.mts.map +1 -0
  108. package/dist/{nodes-D8EC1yCx-rpfpuJ4T.d.mts → nodes-D8EC1yCx-BS-fKla6.d.mts} +2 -2
  109. package/dist/nodes-D8EC1yCx-BS-fKla6.d.mts.map +1 -0
  110. package/dist/{nodes-DUZSdX86-BBEEaxXY.mjs → nodes-DUZSdX86-DWyLY3OW.mjs} +2 -2
  111. package/dist/nodes-DUZSdX86-DWyLY3OW.mjs.map +1 -0
  112. package/dist/op-factory-call-DjbjegGT-DsQBI5Ll.mjs +2044 -0
  113. package/dist/op-factory-call-DjbjegGT-DsQBI5Ll.mjs.map +1 -0
  114. package/dist/op-factory-call-gQ5ddSys.d.mts +327 -0
  115. package/dist/op-factory-call-gQ5ddSys.d.mts.map +1 -0
  116. package/dist/pack-CHESErO8.d.mts +1477 -0
  117. package/dist/pack-CHESErO8.d.mts.map +1 -0
  118. package/dist/{planner-Bxdi7jZF.d.mts → planner-Bu5XBkHm.d.mts} +21 -10
  119. package/dist/planner-Bu5XBkHm.d.mts.map +1 -0
  120. package/dist/planner-C1OMkqV5-BAv-WPw6.mjs +497 -0
  121. package/dist/planner-C1OMkqV5-BAv-WPw6.mjs.map +1 -0
  122. package/dist/{planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts → planner-produced-sqlite-migration-CMjzJW5V-dVv0SjJm.d.mts} +5 -6
  123. package/dist/planner-produced-sqlite-migration-CMjzJW5V-dVv0SjJm.d.mts.map +1 -0
  124. package/dist/{planner-produced-sqlite-migration-C9uVDKrJ-CWbxSANn.mjs → planner-produced-sqlite-migration-CrbMD1ch-O7Mh_aKY.mjs} +13 -23
  125. package/dist/planner-produced-sqlite-migration-CrbMD1ch-O7Mh_aKY.mjs.map +1 -0
  126. package/dist/planner-produced-sqlite-migration-DtytlAAY.d.mts +1 -0
  127. package/dist/{planner-target-details-xR6UfIcz-CMahymzq.d.mts → planner-target-details-B-qtfkmj-DIGpv7YQ.d.mts} +2 -3
  128. package/dist/planner-target-details-B-qtfkmj-DIGpv7YQ.d.mts.map +1 -0
  129. package/dist/{planner-target-details-CIQ789Gc-C5U4yVY9.mjs → planner-target-details-Daaeo8s9-BGAN4JVc.mjs} +2 -4
  130. package/dist/planner-target-details-Daaeo8s9-BGAN4JVc.mjs.map +1 -0
  131. package/dist/render-ops-CQ-Kf4P0-DDUU4OFY.mjs +34 -0
  132. package/dist/render-ops-CQ-Kf4P0-DDUU4OFY.mjs.map +1 -0
  133. package/dist/{render-ops-B10yqmdG.d.mts → render-ops-Wlf_Pawh.d.mts} +3 -3
  134. package/dist/render-ops-Wlf_Pawh.d.mts.map +1 -0
  135. package/dist/require-temporal-CHWqSDF3-ElFTiAh6.mjs +16 -0
  136. package/dist/require-temporal-CHWqSDF3-ElFTiAh6.mjs.map +1 -0
  137. package/dist/{runtime-B1coahKC.d.mts → runtime-BvMPuBrJ.d.mts} +3 -3
  138. package/dist/runtime-BvMPuBrJ.d.mts.map +1 -0
  139. package/dist/runtime-C43fN_cJ.mjs +32 -0
  140. package/dist/runtime-C43fN_cJ.mjs.map +1 -0
  141. package/dist/{runtime-C5J9fusd.d.mts → runtime-CVBk_GlD.d.mts} +4 -4
  142. package/dist/runtime-CVBk_GlD.d.mts.map +1 -0
  143. package/dist/runtime-DqzT70C4.d.mts +67 -0
  144. package/dist/runtime-DqzT70C4.d.mts.map +1 -0
  145. package/dist/sql-renderer-DlZKtvVf.d.mts +1 -0
  146. package/dist/{sql-utils-0SJZOd7Q.d.mts → sql-utils-BqHka8P6.d.mts} +2 -2
  147. package/dist/sql-utils-BqHka8P6.d.mts.map +1 -0
  148. package/dist/{sql-utils-C2O4zVkP-Dz3Hb85I.mjs → sql-utils-CHBxMmv--Dl7wl7n3.mjs} +31 -4
  149. package/dist/sql-utils-CHBxMmv--Dl7wl7n3.mjs.map +1 -0
  150. package/dist/{sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts → sqlite-contract-view-BDw8T5Cp-BfFajhe4.d.mts} +5 -4
  151. package/dist/sqlite-contract-view-BDw8T5Cp-BfFajhe4.d.mts.map +1 -0
  152. package/dist/sqlite-contract-view-c-qO_pKt-DOCoqwrD.mjs +51 -0
  153. package/dist/sqlite-contract-view-c-qO_pKt-DOCoqwrD.mjs.map +1 -0
  154. package/dist/sqlite-migration-C_9TPlLD-DtKN8bi9.d.mts +227 -0
  155. package/dist/sqlite-migration-C_9TPlLD-DtKN8bi9.d.mts.map +1 -0
  156. package/dist/sqlite-migration-Cmzykasm--GxBXXny.mjs +1363 -0
  157. package/dist/sqlite-migration-Cmzykasm--GxBXXny.mjs.map +1 -0
  158. package/dist/{sqlite-contract-view-BYR10usg-BteDAUZr.mjs → sqlite-unbound-database-CfLXSiVo-Dy5VBXGz.mjs} +6 -47
  159. package/dist/sqlite-unbound-database-CfLXSiVo-Dy5VBXGz.mjs.map +1 -0
  160. package/dist/{shared-BYAX0FaQ--VvRXVRC.d.mts → tables-BY3u6rl_-Coqqy4JK.d.mts} +46 -10
  161. package/dist/tables-BY3u6rl_-Coqqy4JK.d.mts.map +1 -0
  162. package/dist/target.d.mts +30 -29
  163. package/dist/target.mjs +27 -20
  164. package/dist/target__aggregates.d.mts +1 -1
  165. package/dist/target__aggregates.mjs +1 -1
  166. package/dist/target__codec-descriptor.d.mts +2 -2
  167. package/dist/target__codec-descriptor.mjs +1 -1
  168. package/dist/target__codec-ids.d.mts +3 -3
  169. package/dist/target__codec-ids.mjs +2 -2
  170. package/dist/target__codec-types.d.mts +3 -3
  171. package/dist/target__codecs.d.mts +3 -3
  172. package/dist/target__codecs.mjs +4 -2
  173. package/dist/target__contract-free.d.mts +1 -1
  174. package/dist/target__contract-free.mjs +2 -2
  175. package/dist/target__control-tables.d.mts +1 -1
  176. package/dist/target__control-tables.mjs +1 -1
  177. package/dist/target__control.d.mts +3 -3
  178. package/dist/target__control.mjs +332 -114
  179. package/dist/target__control.mjs.map +1 -1
  180. package/dist/target__data-types.d.mts +2 -0
  181. package/dist/target__data-types.mjs +3 -0
  182. package/dist/target__ddl.d.mts +2 -2
  183. package/dist/target__ddl.mjs +1 -1
  184. package/dist/target__default-normalizer.d.mts +2 -2
  185. package/dist/target__default-normalizer.mjs +2 -2
  186. package/dist/target__migration.d.mts +3 -3
  187. package/dist/target__migration.mjs +3 -3
  188. package/dist/target__op-factory-call.d.mts +2 -2
  189. package/dist/target__op-factory-call.mjs +2 -2
  190. package/dist/target__pack.d.mts +1 -1
  191. package/dist/target__pack.mjs +1 -1
  192. package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
  193. package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
  194. package/dist/target__planner-target-details.d.mts +1 -1
  195. package/dist/target__planner-target-details.mjs +1 -1
  196. package/dist/target__planner.d.mts +1 -1
  197. package/dist/target__planner.mjs +1 -1
  198. package/dist/target__render-ops.d.mts +1 -1
  199. package/dist/target__render-ops.mjs +1 -1
  200. package/dist/target__runtime.d.mts +3 -3
  201. package/dist/target__runtime.mjs +4 -17
  202. package/dist/target__sql-utils.d.mts +1 -1
  203. package/dist/target__sql-utils.mjs +1 -1
  204. package/dist/target__types.d.mts +2 -0
  205. package/dist/target__types.mjs +2 -0
  206. package/dist/{control--wMueaTg.d.mts → types-COqCbSev.d.mts} +3 -8
  207. package/dist/types-COqCbSev.d.mts.map +1 -0
  208. package/dist/types-CexPOm8x.d.mts +2 -0
  209. package/dist/{types-C5FSREvo-CwUlKK34.d.mts → types-RJMd2PlL-BTGAJrBQ.d.mts} +5 -7
  210. package/dist/types-RJMd2PlL-BTGAJrBQ.d.mts.map +1 -0
  211. package/package.json +23 -14
  212. package/dist/adapter-D7zw14p5.d.mts +0 -2
  213. package/dist/adapter-DEYUC-KO-DO_abhIq.d.mts.map +0 -1
  214. package/dist/adapter-jwxys1MM-CmUELyBs.mjs.map +0 -1
  215. package/dist/aggregates-BGuKJwfI.d.mts +0 -10
  216. package/dist/aggregates-BGuKJwfI.d.mts.map +0 -1
  217. package/dist/aggregates-DWyPO7t6.mjs.map +0 -1
  218. package/dist/codec-descriptor-B9ru99aI-DTkdKFU5.mjs.map +0 -1
  219. package/dist/codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts +0 -31
  220. package/dist/codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts.map +0 -1
  221. package/dist/codec-descriptor-rFuZ9DzY-CKRIRxah.d.mts +0 -1
  222. package/dist/codec-descriptor-vwfD3BMy.d.mts +0 -2
  223. package/dist/codec-ids-7WqtUuda.d.mts +0 -1
  224. package/dist/codec-ids-CzeDyMWW-BZAcI50I.d.mts +0 -14
  225. package/dist/codec-ids-CzeDyMWW-BZAcI50I.d.mts.map +0 -1
  226. package/dist/codec-ids-KMliSCRp-BhTbmbGr.mjs +0 -14
  227. package/dist/codec-ids-KMliSCRp-BhTbmbGr.mjs.map +0 -1
  228. package/dist/codec-types-B-TDcvQc.d.mts +0 -1
  229. package/dist/codec-types-CS0bD1kX.d.mts +0 -2
  230. package/dist/codec-types-D7uWRvQ1-DPnvquS8.d.mts +0 -25
  231. package/dist/codec-types-D7uWRvQ1-DPnvquS8.d.mts.map +0 -1
  232. package/dist/codecs-BDdR6FbY.mjs +0 -504
  233. package/dist/codecs-BDdR6FbY.mjs.map +0 -1
  234. package/dist/codecs-BQWqLgCl-CdB8t7HI.d.mts +0 -193
  235. package/dist/codecs-BQWqLgCl-CdB8t7HI.d.mts.map +0 -1
  236. package/dist/codecs-BTv6fRXv.d.mts +0 -1
  237. package/dist/column-types-NVxgsjFA.mjs +0 -34
  238. package/dist/column-types-NVxgsjFA.mjs.map +0 -1
  239. package/dist/column-types-iWGuW-0W.d.mts +0 -33
  240. package/dist/column-types-iWGuW-0W.d.mts.map +0 -1
  241. package/dist/contract-free-CCLAXZV2.d.mts.map +0 -1
  242. package/dist/contract-free-D5cZrgNl.mjs.map +0 -1
  243. package/dist/control--wMueaTg.d.mts.map +0 -1
  244. package/dist/control-B16T9OoX.mjs +0 -51
  245. package/dist/control-B16T9OoX.mjs.map +0 -1
  246. package/dist/control-CLirKz11.d.mts.map +0 -1
  247. package/dist/control-D9vMRRgU.d.mts.map +0 -1
  248. package/dist/control-tables-D_o8dKRB-BXi43noL.mjs.map +0 -1
  249. package/dist/control-tables-Dua-YcJL.d.mts.map +0 -1
  250. package/dist/ddl-CXduXyOT-nlDP6DGx.mjs.map +0 -1
  251. package/dist/ddl-CfSqNT0M.d.mts +0 -1
  252. package/dist/default-normalizer-B9V7TY5u.d.mts +0 -7
  253. package/dist/default-normalizer-B9V7TY5u.d.mts.map +0 -1
  254. package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs +0 -69
  255. package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs.map +0 -1
  256. package/dist/descriptor-meta-C0sCVHMY-1P-YUnEW.mjs +0 -34
  257. package/dist/descriptor-meta-C0sCVHMY-1P-YUnEW.mjs.map +0 -1
  258. package/dist/descriptor-meta-DjKgG4z5-D_0obUB8.mjs +0 -34
  259. package/dist/descriptor-meta-DjKgG4z5-D_0obUB8.mjs.map +0 -1
  260. package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs +0 -13
  261. package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs.map +0 -1
  262. package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs +0 -70
  263. package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs.map +0 -1
  264. package/dist/errors-DnR-sMHS-KkMLIP2U.mjs +0 -38
  265. package/dist/errors-DnR-sMHS-KkMLIP2U.mjs.map +0 -1
  266. package/dist/migration-DOKPHtxn.mjs.map +0 -1
  267. package/dist/migration-uylRe5MP.d.mts.map +0 -1
  268. package/dist/native-type-normalizer-CO2wKGL6.d.mts +0 -12
  269. package/dist/native-type-normalizer-CO2wKGL6.d.mts.map +0 -1
  270. package/dist/native-type-normalizer-GpQMEyN5.mjs +0 -14
  271. package/dist/native-type-normalizer-GpQMEyN5.mjs.map +0 -1
  272. package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts.map +0 -1
  273. package/dist/nodes-DUZSdX86-BBEEaxXY.mjs.map +0 -1
  274. package/dist/op-factory-call-DoHN7Q7L.d.mts +0 -161
  275. package/dist/op-factory-call-DoHN7Q7L.d.mts.map +0 -1
  276. package/dist/op-factory-call-gc26GqyA-Db5Fasef.mjs +0 -829
  277. package/dist/op-factory-call-gc26GqyA-Db5Fasef.mjs.map +0 -1
  278. package/dist/pack-Cn0GAuEa.d.mts +0 -103
  279. package/dist/pack-Cn0GAuEa.d.mts.map +0 -1
  280. package/dist/planner-Bxdi7jZF.d.mts.map +0 -1
  281. package/dist/planner-Cqjr2usR-4wg3FB78.mjs +0 -824
  282. package/dist/planner-Cqjr2usR-4wg3FB78.mjs.map +0 -1
  283. package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts.map +0 -1
  284. package/dist/planner-produced-sqlite-migration-C9uVDKrJ-CWbxSANn.mjs.map +0 -1
  285. package/dist/planner-produced-sqlite-migration-uySoqJO-.d.mts +0 -1
  286. package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs.map +0 -1
  287. package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts.map +0 -1
  288. package/dist/render-ops-B10yqmdG.d.mts.map +0 -1
  289. package/dist/render-ops-KxAmAz6d-W2xyvA5y.mjs +0 -27
  290. package/dist/render-ops-KxAmAz6d-W2xyvA5y.mjs.map +0 -1
  291. package/dist/runtime-B1coahKC.d.mts.map +0 -1
  292. package/dist/runtime-B99c4n56.d.mts +0 -28
  293. package/dist/runtime-B99c4n56.d.mts.map +0 -1
  294. package/dist/runtime-C5J9fusd.d.mts.map +0 -1
  295. package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts.map +0 -1
  296. package/dist/sql-renderer-KX6hn_tg.d.mts +0 -1
  297. package/dist/sql-utils-0SJZOd7Q.d.mts.map +0 -1
  298. package/dist/sql-utils-C2O4zVkP-Dz3Hb85I.mjs.map +0 -1
  299. package/dist/sqlite-contract-view-BYR10usg-BteDAUZr.mjs.map +0 -1
  300. package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts.map +0 -1
  301. package/dist/sqlite-migration-CjMkH4Id-c6dM9w61.mjs +0 -94
  302. package/dist/sqlite-migration-CjMkH4Id-c6dM9w61.mjs.map +0 -1
  303. package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts +0 -105
  304. package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts.map +0 -1
  305. package/dist/target__native-type-normalizer.d.mts +0 -2
  306. package/dist/target__native-type-normalizer.mjs +0 -2
  307. package/dist/target__runtime.mjs.map +0 -1
  308. package/dist/types-B7e2QVEx.d.mts +0 -1
  309. package/dist/types-C5FSREvo-CwUlKK34.d.mts.map +0 -1
@@ -1,11 +1,11 @@
1
- import { c as SQLITE_TEXT_CODEC_ID } from "./codec-ids-KMliSCRp-BhTbmbGr.mjs";
2
- import { t as SqliteCreateTable } from "./nodes-DUZSdX86-BBEEaxXY.mjs";
1
+ import { h as SQLITE_TEXT_CODEC_ID } from "./codec-ids-CTshXpbg-tcdbf_VC.mjs";
2
+ import { t as SqliteCreateTable } from "./nodes-DUZSdX86-DWyLY3OW.mjs";
3
3
  import { FunctionSource } from "@prisma/orm-family-sql/relational-core/ast";
4
4
  import { cfExpr, cfTable, exprSelect } from "@prisma/orm-family-sql/relational-core/contract-free";
5
- //#region ../../../3-targets/3-targets/sqlite/dist/ddl-CXduXyOT.mjs
5
+ //#region ../../../3-targets/sqlite/1-target/dist/ddl-CgkyurGo.mjs
6
6
  /**
7
7
  * Typed builder for the migration planner's column-existence checks. Produces
8
- * `SELECT COUNT(*) {=|>} 0 AS "result" FROM pragma_table_info(?) WHERE "name" = ?`
8
+ * `SELECT COUNT(*) {=|>} 0 AS "result" FROM pragma_table_info(?1) WHERE "name" = ?2`
9
9
  * ASTs with the table and column names bound as text parameters — never
10
10
  * inlined into the SQL.
11
11
  */
@@ -18,8 +18,27 @@ function columnExistsAst(table, column) {
18
18
  };
19
19
  }
20
20
  /**
21
+ * Typed builder for the check that no column of the table has a name SQLite takes for `column`.
22
+ * Produces `SELECT COUNT(*) = 0 AS "result" FROM pragma_table_info(?1) WHERE "name" COLLATE NOCASE
23
+ * = ?2`: SQLite compares column names without regard to the case of ASCII letters, as `NOCASE`
24
+ * does.
25
+ */
26
+ function columnNameTakenAst(table, column) {
27
+ const source = FunctionSource.of("pragma_table_info", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);
28
+ const where = cfExpr.fn({
29
+ method: "collateNocase",
30
+ template: "{{self}} COLLATE NOCASE",
31
+ self: cfExpr.identifierRef("name"),
32
+ returns: {
33
+ codecId: SQLITE_TEXT_CODEC_ID,
34
+ nullable: false
35
+ }
36
+ }).eqParam(column, SQLITE_TEXT_CODEC_ID);
37
+ return { nameFree: () => exprSelect().from(source).project("result", cfExpr.countStar().eqLit(0)).where(where).build() };
38
+ }
39
+ /**
21
40
  * Typed builder for table-existence checks over `sqlite_master`.
22
- * Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
41
+ * Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ?1 AND "name" = ?2`
23
42
  * with the table name and the literal `'table'` bound as text parameters.
24
43
  */
25
44
  function tableExistsAst(tableName) {
@@ -31,8 +50,26 @@ function tableExistsAst(tableName) {
31
50
  };
32
51
  }
33
52
  /**
53
+ * Typed builder for the check that no table, index or view has a name SQLite takes for `name`.
54
+ * Produces `SELECT COUNT(*) = 0 AS "result" FROM "sqlite_master" WHERE "name" COLLATE NOCASE = ?1`:
55
+ * tables, indexes and views share one set of names, which SQLite compares without regard to the
56
+ * case of ASCII letters.
57
+ */
58
+ function tableNameTakenAst(tableName) {
59
+ const where = cfExpr.fn({
60
+ method: "collateNocase",
61
+ template: "{{self}} COLLATE NOCASE",
62
+ self: cfExpr.identifierRef("name"),
63
+ returns: {
64
+ codecId: SQLITE_TEXT_CODEC_ID,
65
+ nullable: false
66
+ }
67
+ }).eqParam(tableName, SQLITE_TEXT_CODEC_ID);
68
+ return { nameFree: () => exprSelect().from(cfTable("sqlite_master")).project("result", cfExpr.countStar().eqLit(0)).where(where).build() };
69
+ }
70
+ /**
34
71
  * Typed builder for index-existence checks over `sqlite_master`.
35
- * Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
72
+ * Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ?1 AND "name" = ?2`
36
73
  * with the index name and the literal `'index'` bound as text parameters.
37
74
  */
38
75
  function indexExistsAst(indexName) {
@@ -61,6 +98,6 @@ function createTable(options) {
61
98
  return new SqliteCreateTable(options);
62
99
  }
63
100
  //#endregion
64
- export { tableExistsAst as i, createTable as n, indexExistsAst as r, columnExistsAst as t };
101
+ export { tableExistsAst as a, indexExistsAst as i, columnNameTakenAst as n, tableNameTakenAst as o, createTable as r, columnExistsAst as t };
65
102
 
66
- //# sourceMappingURL=ddl-CXduXyOT-nlDP6DGx.mjs.map
103
+ //# sourceMappingURL=ddl-CgkyurGo-B2o4mSIT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ddl-CgkyurGo-B2o4mSIT.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/ddl-CgkyurGo.mjs"],"sourcesContent":["import { h as SQLITE_TEXT_CODEC_ID } from \"./codec-ids-CTshXpbg.mjs\";\nimport { t as SqliteCreateTable } from \"./nodes-DUZSdX86.mjs\";\nimport { FunctionSource } from \"@internal/sql-relational-core/ast\";\nimport { cfExpr, cfTable, exprSelect } from \"@internal/sql-relational-core/contract-free\";\n//#region src/contract-free/checks.ts\n/**\n* Typed builder for the migration planner's column-existence checks. Produces\n* `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM pragma_table_info(?1) WHERE \"name\" = ?2`\n* ASTs with the table and column names bound as text parameters — never\n* inlined into the SQL.\n*/\nfunction columnExistsAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.identifierRef(\"name\").eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn {\n\t\tcolumnAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tcolumnPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for the check that no column of the table has a name SQLite takes for `column`.\n* Produces `SELECT COUNT(*) = 0 AS \"result\" FROM pragma_table_info(?1) WHERE \"name\" COLLATE NOCASE\n* = ?2`: SQLite compares column names without regard to the case of ASCII letters, as `NOCASE`\n* does.\n*/\nfunction columnNameTakenAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.fn({\n\t\tmethod: \"collateNocase\",\n\t\ttemplate: \"{{self}} COLLATE NOCASE\",\n\t\tself: cfExpr.identifierRef(\"name\"),\n\t\treturns: {\n\t\t\tcodecId: SQLITE_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t}\n\t}).eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn { nameFree: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build() };\n}\n/**\n* Typed builder for table-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ?1 AND \"name\" = ?2`\n* with the table name and the literal `'table'` bound as text parameters.\n*/\nfunction tableExistsAst(tableName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"table\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(tableName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\ttableAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\ttablePresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for the check that no table, index or view has a name SQLite takes for `name`.\n* Produces `SELECT COUNT(*) = 0 AS \"result\" FROM \"sqlite_master\" WHERE \"name\" COLLATE NOCASE = ?1`:\n* tables, indexes and views share one set of names, which SQLite compares without regard to the\n* case of ASCII letters.\n*/\nfunction tableNameTakenAst(tableName) {\n\tconst where = cfExpr.fn({\n\t\tmethod: \"collateNocase\",\n\t\ttemplate: \"{{self}} COLLATE NOCASE\",\n\t\tself: cfExpr.identifierRef(\"name\"),\n\t\treturns: {\n\t\t\tcodecId: SQLITE_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t}\n\t}).eqParam(tableName, SQLITE_TEXT_CODEC_ID);\n\treturn { nameFree: () => exprSelect().from(cfTable(\"sqlite_master\")).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build() };\n}\n/**\n* Typed builder for index-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ?1 AND \"name\" = ?2`\n* with the index name and the literal `'index'` bound as text parameters.\n*/\nfunction indexExistsAst(indexName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"index\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(indexName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\tindexAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tindexPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n//#endregion\n//#region src/contract-free/ddl.ts\n/**\n* Build a SQLite `CREATE TABLE` query node.\n*\n* Pass `constraints` for table-level composite primary keys, foreign keys, and\n* unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},\n* and {@link UniqueConstraint} classes from `@internal/sql-relational-core/ast`.\n*\n* Precondition: identifiers (`table`, column names/types) are emitted to SQL\n* verbatim — they are not quoted or escaped, so callers must pass pre-trusted\n* values (e.g. fixed control-plane identifiers). String-literal default values,\n* by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.\n* Identifier quoting for untrusted identifiers is added when the migration\n* planner adopts this lowering path.\n*/\nfunction createTable(options) {\n\treturn new SqliteCreateTable(options);\n}\n//#endregion\nexport { tableExistsAst as a, indexExistsAst as i, columnExistsAst as n, tableNameTakenAst as o, columnNameTakenAst as r, createTable as t };\n\n//# sourceMappingURL=ddl-CgkyurGo.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,gBAAgB,OAAO,QAAQ;CACvC,MAAM,SAAS,eAAe,GAAG,qBAAqB,CAAC,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,CAAC;CACrG,MAAM,QAAQ,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,QAAQ,oBAAoB;CAC/E,OAAO;EACN,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAChH,qBAAqB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAClH;AACD;;;;;;;AAOA,SAAS,mBAAmB,OAAO,QAAQ;CAC1C,MAAM,SAAS,eAAe,GAAG,qBAAqB,CAAC,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,CAAC;CACrG,MAAM,QAAQ,OAAO,GAAG;EACvB,QAAQ;EACR,UAAU;EACV,MAAM,OAAO,cAAc,MAAM;EACjC,SAAS;GACR,SAAS;GACT,UAAU;EACX;CACD,CAAC,CAAC,CAAC,QAAQ,QAAQ,oBA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,cAAc,MAAM,CAAC,CAAC,QAAQ,SAAS,oBAAoB,GAAG,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,WAAW,oBAAoB,CAAC,CAAC;CACvK,OAAO;EACN,mBAAmB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAC/G,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CACjH;AACD;;;;;;;;;;;;;;;AAiBA,SAAS,YAAY,SAAS;CAC7B,OAAO,IAAI,kBAAkB,OAAO;AACrC"}
@@ -0,0 +1,124 @@
1
+ import { a as SQLITE_TIME_TEXT_FORMAT, i as SQLITE_TIME_NOW_EXPRESSION, n as SQLITE_DATE_NOW_EXPRESSION, o as sqliteNowExpressionFor, t as SQLITE_DATETIME_TEXT_FORMAT } from "./datetime-text-DPjoF6HJ-se0mLEbc.mjs";
2
+ //#region ../../../3-targets/sqlite/1-target/dist/default-normalizer-BANdMVGr.mjs
3
+ const NULL_PATTERN = /^NULL$/i;
4
+ const INTEGER_PATTERN = /^[+-]?\d+$/;
5
+ const REAL_PATTERN = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
6
+ const STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'$/;
7
+ const STRFTIME_NOW_PATTERN = /^strftime\s*\(\s*(['"])([^'"]*)\1\s*,\s*(['"])now\3\s*\)$/i;
8
+ const DATE_NOW_PATTERN = /^date\s*\(\s*(['"])now\1\s*\)$/i;
9
+ /** The name of the current instant, as a contract writes it. */
10
+ const INSTANT_NOW = "now()";
11
+ /**
12
+ * The name of the current value `expression` writes: `now()` for the current instant, in any of the forms SQLite writes it, and the expression a `now()` default is written as for the current date and for the current time of day, since those hold different text. `undefined` for any other expression.
13
+ */
14
+ function currentValueNamed(expression) {
15
+ const lower = expression.toLowerCase();
16
+ if (lower === "current_timestamp" || lower === "datetime('now')" || lower === "datetime(\"now\")") return INSTANT_NOW;
17
+ if (lower === "current_date" || DATE_NOW_PATTERN.test(expression)) return SQLITE_DATE_NOW_EXPRESSION;
18
+ switch (expression.match(STRFTIME_NOW_PATTERN)?.[2]) {
19
+ case SQLITE_DATETIME_TEXT_FORMAT: return INSTANT_NOW;
20
+ case SQLITE_TIME_TEXT_FORMAT: return SQLITE_TIME_NOW_EXPRESSION;
21
+ default: return;
22
+ }
23
+ }
24
+ /**
25
+ * Strips a single matched wrapping pair of outer parens from `s`. Conservative:
26
+ * only strips when the leading `(` is matched by the trailing `)` (so
27
+ * `(a) + (b)` is returned unchanged). Mirrors SQLite's own
28
+ * `pragma_table_info.dflt_value` normalization for expression defaults, and
29
+ * is shared with the recreate-table postcheck builder so both sides agree
30
+ * on the text.
31
+ */
32
+ function stripOuterParens(s) {
33
+ if (!s.startsWith("(") || !s.endsWith(")")) return s;
34
+ let depth = 0;
35
+ for (let i = 0; i < s.length; i++) if (s[i] === "(") depth += 1;
36
+ else if (s[i] === ")") {
37
+ depth -= 1;
38
+ if (depth === 0 && i < s.length - 1) return s;
39
+ }
40
+ return s.slice(1, -1);
41
+ }
42
+ /** The type affinity SQLite gives a column of `declaredType`, by its rules in order. */
43
+ function affinityOf(declaredType) {
44
+ const upper = declaredType.toUpperCase();
45
+ if (upper.includes("INT")) return "integer";
46
+ if (upper.includes("CHAR") || upper.includes("CLOB") || upper.includes("TEXT")) return "text";
47
+ if (upper.includes("BLOB") || upper.trim() === "") return "blob";
48
+ if (upper.includes("REAL") || upper.includes("FLOA") || upper.includes("DOUB")) return "real";
49
+ return "numeric";
50
+ }
51
+ /** A numeral as the driver returns it: a number, or digit text for an integer no double holds exactly. */
52
+ function numberBody(numeral) {
53
+ if (INTEGER_PATTERN.test(numeral)) {
54
+ const integer = BigInt(numeral);
55
+ return Number.isSafeInteger(Number(integer)) ? Number(integer) : integer.toString();
56
+ }
57
+ return Number(numeral);
58
+ }
59
+ /** What the column stores for a literal written as `text` (quoted) or as a numeral, by its affinity. */
60
+ function bodyFor(literal, quoted, affinity) {
61
+ const numeral = INTEGER_PATTERN.test(literal) || REAL_PATTERN.test(literal);
62
+ if (affinity === "text") return literal;
63
+ if (affinity === "blob") return quoted || !numeral ? literal : numberBody(literal);
64
+ return numeral ? numberBody(literal) : literal;
65
+ }
66
+ /** A blob literal: `X'` or `x'`, an even number of hexadecimal digits, `'`. */
67
+ const BLOB_LITERAL_PATTERN = /^[xX]'((?:[0-9a-fA-F]{2})*)'$/;
68
+ /**
69
+ * Reads a column's reported default. `CURRENT_TIMESTAMP`, `datetime('now')` and the expression a `now()` default is written as for an instant are `now()`; `date('now')` and `CURRENT_DATE`, which writes the same text, are read as `date('now')`, and the expression for the current time of day keeps its own name, so a default that writes a date is never read as one that writes an instant. `CURRENT_TIME` writes no fraction of a second, which is not the text `sqlite/time` stores, so it is kept as reported. A quoted string, a numeral or a blob literal (`X'6869'`, read as its bytes) is a literal; any other expression is a function default, kept as reported.
70
+ */
71
+ function readSqliteDefault(rawDefault, declaredType) {
72
+ let trimmed = rawDefault.trim();
73
+ while (true) {
74
+ const stripped = stripOuterParens(trimmed).trim();
75
+ if (stripped === trimmed) break;
76
+ trimmed = stripped;
77
+ }
78
+ const currentValue = currentValueNamed(trimmed);
79
+ if (currentValue !== void 0) return {
80
+ kind: "function",
81
+ expression: currentValue
82
+ };
83
+ if (NULL_PATTERN.test(trimmed)) return { kind: "null" };
84
+ const affinity = affinityOf(declaredType);
85
+ const quoted = STRING_LITERAL_PATTERN.exec(trimmed)?.[1];
86
+ if (quoted !== void 0) return {
87
+ kind: "literal",
88
+ literal: {
89
+ kind: "value",
90
+ body: bodyFor(quoted.replace(/''/g, "'"), true, affinity)
91
+ }
92
+ };
93
+ const blobHex = BLOB_LITERAL_PATTERN.exec(trimmed)?.[1];
94
+ if (blobHex !== void 0) return {
95
+ kind: "literal",
96
+ literal: {
97
+ kind: "value",
98
+ body: new Uint8Array(Buffer.from(blobHex, "hex"))
99
+ }
100
+ };
101
+ if (INTEGER_PATTERN.test(trimmed) || REAL_PATTERN.test(trimmed)) return {
102
+ kind: "literal",
103
+ literal: {
104
+ kind: "value",
105
+ body: bodyFor(trimmed, false, affinity)
106
+ }
107
+ };
108
+ return {
109
+ kind: "function",
110
+ expression: trimmed
111
+ };
112
+ }
113
+ /**
114
+ * Names a contract's expression default the way {@link readSqliteDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `datetime('now')` compare equal. A `now()` default is named as the expression the column's data type writes it as, so a `now()` on a date column and one on a date and time column differ, as their stored text does. A literal default, and an expression that writes a literal, pass through unchanged; introspection reads the latter's literal with the column's codec, and the diff compares the values.
115
+ */
116
+ function sqliteResolveDefault(def, column) {
117
+ if (def.kind !== "function") return def;
118
+ const read = readSqliteDefault(def.expression === INSTANT_NOW ? sqliteNowExpressionFor(column.dataTypeId) ?? def.expression : def.expression, column.typeText);
119
+ return read.kind === "function" ? read : def;
120
+ }
121
+ //#endregion
122
+ export { sqliteResolveDefault as n, stripOuterParens as r, readSqliteDefault as t };
123
+
124
+ //# sourceMappingURL=default-normalizer-BANdMVGr-BiUHyBX1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-normalizer-BANdMVGr-BiUHyBX1.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/default-normalizer-BANdMVGr.mjs"],"sourcesContent":["import { a as SQLITE_TIME_TEXT_FORMAT, i as SQLITE_TIME_NOW_EXPRESSION, n as SQLITE_DATE_NOW_EXPRESSION, o as sqliteNowExpressionFor, t as SQLITE_DATETIME_TEXT_FORMAT } from \"./datetime-text-DPjoF6HJ.mjs\";\n//#region src/core/default-normalizer.ts\nconst NULL_PATTERN = /^NULL$/i;\nconst INTEGER_PATTERN = /^[+-]?\\d+$/;\nconst REAL_PATTERN = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'$/;\nconst STRFTIME_NOW_PATTERN = /^strftime\\s*\\(\\s*(['\"])([^'\"]*)\\1\\s*,\\s*(['\"])now\\3\\s*\\)$/i;\nconst DATE_NOW_PATTERN = /^date\\s*\\(\\s*(['\"])now\\1\\s*\\)$/i;\n/** The name of the current instant, as a contract writes it. */\nconst INSTANT_NOW = \"now()\";\n/**\n* The name of the current value `expression` writes: `now()` for the current instant, in any of the forms SQLite writes it, and the expression a `now()` default is written as for the current date and for the current time of day, since those hold different text. `undefined` for any other expression.\n*/\nfunction currentValueNamed(expression) {\n\tconst lower = expression.toLowerCase();\n\tif (lower === \"current_timestamp\" || lower === \"datetime('now')\" || lower === \"datetime(\\\"now\\\")\") return INSTANT_NOW;\n\tif (lower === \"current_date\" || DATE_NOW_PATTERN.test(expression)) return SQLITE_DATE_NOW_EXPRESSION;\n\tswitch (expression.match(STRFTIME_NOW_PATTERN)?.[2]) {\n\t\tcase SQLITE_DATETIME_TEXT_FORMAT: return INSTANT_NOW;\n\t\tcase SQLITE_TIME_TEXT_FORMAT: return SQLITE_TIME_NOW_EXPRESSION;\n\t\tdefault: return;\n\t}\n}\n/**\n* Strips a single matched wrapping pair of outer parens from `s`. Conservative:\n* only strips when the leading `(` is matched by the trailing `)` (so\n* `(a) + (b)` is returned unchanged). Mirrors SQLite's own\n* `pragma_table_info.dflt_value` normalization for expression defaults, and\n* is shared with the recreate-table postcheck builder so both sides agree\n* on the text.\n*/\nfunction stripOuterParens(s) {\n\tif (!s.startsWith(\"(\") || !s.endsWith(\")\")) return s;\n\tlet depth = 0;\n\tfor (let i = 0; i < s.length; i++) if (s[i] === \"(\") depth += 1;\n\telse if (s[i] === \")\") {\n\t\tdepth -= 1;\n\t\tif (depth === 0 && i < s.length - 1) return s;\n\t}\n\treturn s.slice(1, -1);\n}\n/** The type affinity SQLite gives a column of `declaredType`, by its rules in order. */\nfunction affinityOf(declaredType) {\n\tconst upper = declaredType.toUpperCase();\n\tif (upper.includes(\"INT\")) return \"integer\";\n\tif (upper.includes(\"CHAR\") || upper.includes(\"CLOB\") || upper.includes(\"TEXT\")) return \"text\";\n\tif (upper.includes(\"BLOB\") || upper.trim() === \"\") return \"blob\";\n\tif (upper.includes(\"REAL\") || upper.includes(\"FLOA\") || upper.includes(\"DOUB\")) return \"real\";\n\treturn \"numeric\";\n}\n/** A numeral as the driver returns it: a number, or digit text for an integer no double holds exactly. */\nfunction numberBody(numeral) {\n\tif (INTEGER_PATTERN.test(numeral)) {\n\t\tconst integer = BigInt(numeral);\n\t\treturn Number.isSafeInteger(Number(integer)) ? Number(integer) : integer.toString();\n\t}\n\treturn Number(numeral);\n}\n/** What the column stores for a literal written as `text` (quoted) or as a numeral, by its affinity. */\nfunction bodyFor(literal, quoted, affinity) {\n\tconst numeral = INTEGER_PATTERN.test(literal) || REAL_PATTERN.test(literal);\n\tif (affinity === \"text\") return literal;\n\tif (affinity === \"blob\") return quoted || !numeral ? literal : numberBody(literal);\n\treturn numeral ? numberBody(literal) : literal;\n}\n/** A blob literal: `X'` or `x'`, an even number of hexadecimal digits, `'`. */\nconst BLOB_LITERAL_PATTERN = /^[xX]'((?:[0-9a-fA-F]{2})*)'$/;\n/**\n* Reads a column's reported default. `CURRENT_TIMESTAMP`, `datetime('now')` and the expression a `now()` default is written as for an instant are `now()`; `date('now')` and `CURRENT_DATE`, which writes the same text, are read as `date('now')`, and the expression for the current time of day keeps its own name, so a default that writes a date is never read as one that writes an instant. `CURRENT_TIME` writes no fraction of a second, which is not the text `sqlite/time` stores, so it is kept as reported. A quoted string, a numeral or a blob literal (`X'6869'`, read as its bytes) is a literal; any other expression is a function default, kept as reported.\n*/\nfunction readSqliteDefault(rawDefault, declaredType) {\n\tlet trimmed = rawDefault.trim();\n\twhile (true) {\n\t\tconst stripped = stripOuterParens(trimmed).trim();\n\t\tif (stripped === trimmed) break;\n\t\ttrimmed = stripped;\n\t}\n\tconst currentValue = currentValueNamed(trimmed);\n\tif (currentValue !== void 0) return {\n\t\tkind: \"function\",\n\t\texpression: currentValue\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return { kind: \"null\" };\n\tconst affinity = affinityOf(declaredType);\n\tconst quoted = STRING_LITERAL_PATTERN.exec(trimmed)?.[1];\n\tif (quoted !== void 0) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: bodyFor(quoted.replace(/''/g, \"'\"), true, affinity)\n\t\t}\n\t};\n\tconst blobHex = BLOB_LITERAL_PATTERN.exec(trimmed)?.[1];\n\tif (blobHex !== void 0) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: new Uint8Array(Buffer.from(blobHex, \"hex\"))\n\t\t}\n\t};\n\tif (INTEGER_PATTERN.test(trimmed) || REAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: bodyFor(trimmed, false, affinity)\n\t\t}\n\t};\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n}\n/**\n* Names a contract's expression default the way {@link readSqliteDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `datetime('now')` compare equal. A `now()` default is named as the expression the column's data type writes it as, so a `now()` on a date column and one on a date and time column differ, as their stored text does. A literal default, and an expression that writes a literal, pass through unchanged; introspection reads the latter's literal with the column's codec, and the diff compares the values.\n*/\nfunction sqliteResolveDefault(def, column) {\n\tif (def.kind !== \"function\") return def;\n\tconst read = readSqliteDefault(def.expression === INSTANT_NOW ? sqliteNowExpressionFor(column.dataTypeId) ?? def.expression : def.expression, column.typeText);\n\treturn read.kind === \"function\" ? read : def;\n}\n//#endregion\nexport { sqliteResolveDefault as n, stripOuterParens as r, readSqliteDefault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AAI,gBAAgB,KAAK,OAAO,KAAK,aAAa,KAAK,OAAO,GAAG,OAAO;EACvE,MAAM;EACN,SAAS;GACR,MAAM;GACN,MAAM,QAAQ,SAAS,OAAO,QAAQ;EACvC;CACD;CACA,OAAO;EACN,MAAM;EACN,YAAY;CACb;AACD;;;;AAIA,SAAS,qBAAqB,KAAK,QAAQ;CAC1C,IAAI,IAAI,SAAS,YAAY,OAAO;CACpC,MAAM,OAAO,kBAAkB,IAAI,eAAe,cAAc,uBAAuB,OAAO,UAAU,KAAK,IAAI,aAAa,IAAI,YAAY,OAAO,QAAQ;CAC7J,OAAO,KAAK,SAAS,aAAa,OAAO;AAC1C"}
@@ -0,0 +1,25 @@
1
+ import { DefaultResolverColumn, ReportedLiteralDefault } from "@prisma/orm-family-sql/family/control";
2
+ import { ColumnDefault } from "@prisma/orm-framework/contract/types";
3
+ //#region ../../../3-targets/sqlite/1-target/dist/default-normalizer.d.mts
4
+ //#region src/core/default-normalizer.d.ts
5
+ /** What a column's reported default is: a function, SQL NULL, or a literal the column's codec reads. */
6
+ type SqliteReportedDefault = {
7
+ readonly kind: 'function';
8
+ readonly expression: string;
9
+ } | {
10
+ readonly kind: 'null';
11
+ } | {
12
+ readonly kind: 'literal';
13
+ readonly literal: ReportedLiteralDefault;
14
+ };
15
+ /**
16
+ * Reads a column's reported default. `CURRENT_TIMESTAMP`, `datetime('now')` and the expression a `now()` default is written as for an instant are `now()`; `date('now')` and `CURRENT_DATE`, which writes the same text, are read as `date('now')`, and the expression for the current time of day keeps its own name, so a default that writes a date is never read as one that writes an instant. `CURRENT_TIME` writes no fraction of a second, which is not the text `sqlite/time` stores, so it is kept as reported. A quoted string, a numeral or a blob literal (`X'6869'`, read as its bytes) is a literal; any other expression is a function default, kept as reported.
17
+ */
18
+ declare function readSqliteDefault(rawDefault: string, declaredType: string): SqliteReportedDefault;
19
+ /**
20
+ * Names a contract's expression default the way {@link readSqliteDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `datetime('now')` compare equal. A `now()` default is named as the expression the column's data type writes it as, so a `now()` on a date column and one on a date and time column differ, as their stored text does. A literal default, and an expression that writes a literal, pass through unchanged; introspection reads the latter's literal with the column's codec, and the diff compares the values.
21
+ */
22
+ declare function sqliteResolveDefault(def: ColumnDefault, column: DefaultResolverColumn): ColumnDefault;
23
+ //#endregion
24
+ export { readSqliteDefault as n, sqliteResolveDefault as r, SqliteReportedDefault as t };
25
+ //# sourceMappingURL=default-normalizer-CtNsZNRZ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-normalizer-CtNsZNRZ.d.mts","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/default-normalizer.d.mts"],"mappings":";;;;;KAIK;WACM;WACA;;WAEA;;WAEA;WACA,SAAS;;;;;iBAKH,kBAAkB,oBAAoB,uBAAuB;;;;iBAI7D,qBAAqB,KAAK,eAAe,QAAQ,wBAAwB"}
@@ -0,0 +1,26 @@
1
+ import { a as sqliteCodecRegistry } from "./codecs-BO3frExA.mjs";
2
+ import { n as sqliteAdapterContractContributions } from "./contract-contributions-DEePsuJb-CXE-f6pP.mjs";
3
+ //#region ../../../3-targets/sqlite/2-adapter/dist/descriptor-meta-CafFMPhN.mjs
4
+ const sqliteAdapterDescriptorMeta = {
5
+ kind: "adapter",
6
+ familyId: "sql",
7
+ targetId: "sqlite",
8
+ id: "sqlite",
9
+ version: "0.0.1",
10
+ capabilities: sqliteAdapterContractContributions.capabilities,
11
+ types: {
12
+ aggregateDescriptors: sqliteAdapterContractContributions.types.aggregateDescriptors,
13
+ codecTypes: {
14
+ codecDescriptors: Array.from(sqliteCodecRegistry.values()),
15
+ import: {
16
+ package: `@prisma/orm-target-sqlite/adapter/codec-types`,
17
+ named: "CodecTypes",
18
+ alias: "SqliteTypes"
19
+ }
20
+ }
21
+ }
22
+ };
23
+ //#endregion
24
+ export { sqliteAdapterDescriptorMeta as t };
25
+
26
+ //# sourceMappingURL=descriptor-meta-CafFMPhN-x3YQXDSX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-CafFMPhN-x3YQXDSX.mjs","names":[],"sources":["../../../../3-targets/sqlite/2-adapter/dist/descriptor-meta-CafFMPhN.mjs"],"sourcesContent":["import { t as sqliteAdapterContractContributions } from \"./contract-contributions-DEePsuJb.mjs\";\nimport { sqliteCodecRegistry } from \"@internal/target-sqlite/codecs\";\n//#region src/core/module-base.ts\nconst moduleBase = typeof __PRISMA_PUBLISHED_MODULE_BASE__ADAPTER_SQLITE === \"string\" ? __PRISMA_PUBLISHED_MODULE_BASE__ADAPTER_SQLITE : \"@internal/adapter-sqlite\";\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst sqliteAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: sqliteAdapterContractContributions.capabilities,\n\ttypes: {\n\t\taggregateDescriptors: sqliteAdapterContractContributions.types.aggregateDescriptors,\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(sqliteCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: `${moduleBase}/codec-types`,\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"SqliteTypes\"\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\nexport { sqliteAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-CafFMPhN.mjs.map"],"mappings":";;;AAMA,MAAM,8BAA8B;CACnC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,mCAAmC;CACjD,OAAO;EACN,sBAAsB,mCAAmC,MAAM;EAC/D,YAAY;GACX,kBAAkB,MAAM,KAAK,oBAAoB,OAAO,CAAC;GACzD,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;EACD;CACD;AACD"}
@@ -0,0 +1,137 @@
1
+ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
2
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
3
+ import { SqlConnectionError, SqlQueryError } from "@prisma/orm-family-sql/errors";
4
+ //#region ../../../3-targets/sqlite/3-driver/dist/descriptor-meta-CkiPlqDS.mjs
5
+ const closedByDriver = /* @__PURE__ */ new WeakSet();
6
+ /** Closes a database the driver opened and records that the driver closed it. */
7
+ function closeDatabase(db) {
8
+ db.close();
9
+ closedByDriver.add(db);
10
+ }
11
+ /** Whether the driver itself closed this database. */
12
+ function wasClosedByDriver(db) {
13
+ return closedByDriver.has(db);
14
+ }
15
+ const MIN_SAFE_INTEGER = BigInt(Number.MIN_SAFE_INTEGER);
16
+ const MAX_SAFE_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);
17
+ /**
18
+ * Prepares a statement that reads every integer as a `bigint`, so a stored integer of any 64-bit size is read exactly, and `changes` and `lastInsertRowid` are exact too.
19
+ */
20
+ function prepareExact(db, sql) {
21
+ const statement = db.prepare(sql);
22
+ statement.setReadBigInts(true);
23
+ return statement;
24
+ }
25
+ /**
26
+ * A row as the application reads it: an integer within the safe integer range is a `number`, and one outside it stays the exact `bigint` for its codec to read or refuse.
27
+ */
28
+ function safeIntegersAsNumbers(row) {
29
+ for (const key in row) {
30
+ const value = row[key];
31
+ if (typeof value === "bigint" && value >= MIN_SAFE_INTEGER && value <= MAX_SAFE_INTEGER) row[key] = Number(value);
32
+ }
33
+ return row;
34
+ }
35
+ const SQLITE_CONSTRAINT_BASE = 19;
36
+ const SQLITE_CONSTRAINT_UNIQUE = 2067;
37
+ const SQLITE_CONSTRAINT_PRIMARYKEY = 1555;
38
+ const SQLITE_CONSTRAINT_FOREIGNKEY = 787;
39
+ const SQLITE_CONSTRAINT_NOTNULL = 1299;
40
+ const SQLITE_CONSTRAINT_CHECK = 275;
41
+ const SQLITE_BUSY = 5;
42
+ const SQLITE_LOCKED = 6;
43
+ const SQLITE_CANTOPEN = 14;
44
+ const SQLITE_NOTADB = 26;
45
+ const INVALID_STATE_CODE = "ERR_INVALID_STATE";
46
+ const GENERAL_ERROR_SQLSTATE = "HY000";
47
+ function isConstraintError(errcode) {
48
+ return (errcode & 255) === SQLITE_CONSTRAINT_BASE;
49
+ }
50
+ function isBusyOrLocked(errcode) {
51
+ const base = errcode & 255;
52
+ return base === SQLITE_BUSY || base === SQLITE_LOCKED;
53
+ }
54
+ function isOpenFailure(errcode) {
55
+ const base = errcode & 255;
56
+ return base === SQLITE_CANTOPEN || base === SQLITE_NOTADB;
57
+ }
58
+ function isSqliteError(error) {
59
+ if (!(error instanceof Error)) return false;
60
+ return error.code === "ERR_SQLITE_ERROR";
61
+ }
62
+ /**
63
+ * The one place the driver reads SQLite's message: SQLite reports which constraint failed only
64
+ * in the text, as in "UNIQUE constraint failed: table.column".
65
+ */
66
+ function constraintNameFromMessage(message) {
67
+ return /constraint failed: (.+)/.exec(message)?.[1];
68
+ }
69
+ function mapErrCodeToSqlState(errcode) {
70
+ switch (errcode) {
71
+ case SQLITE_CONSTRAINT_UNIQUE:
72
+ case SQLITE_CONSTRAINT_PRIMARYKEY: return "23505";
73
+ case SQLITE_CONSTRAINT_FOREIGNKEY: return "23503";
74
+ case SQLITE_CONSTRAINT_NOTNULL: return "23502";
75
+ case SQLITE_CONSTRAINT_CHECK: return "23514";
76
+ default:
77
+ if (isConstraintError(errcode)) return "23000";
78
+ return GENERAL_ERROR_SQLSTATE;
79
+ }
80
+ }
81
+ /**
82
+ * Normalizes a node:sqlite error. `databaseClosedByDriver` says whether the driver closed the
83
+ * database the failing call used; only then is a wrong-state error a closed-database connection error.
84
+ */
85
+ function normalizeSqliteError(error, databaseClosedByDriver) {
86
+ if (!(error instanceof Error)) return new Error(String(error));
87
+ if (isSqliteError(error)) {
88
+ const errcode = error.errcode ?? 0;
89
+ if (isBusyOrLocked(errcode)) return new SqlConnectionError(error.message, {
90
+ cause: error,
91
+ transient: true
92
+ });
93
+ if (isOpenFailure(errcode)) return new SqlConnectionError(error.message, {
94
+ cause: error,
95
+ transient: false
96
+ });
97
+ const sqlState = mapErrCodeToSqlState(errcode);
98
+ const constraint = constraintNameFromMessage(error.message);
99
+ return new SqlQueryError(error.message, {
100
+ cause: error,
101
+ sqlState,
102
+ ...constraint !== void 0 ? { constraint } : {}
103
+ });
104
+ }
105
+ if ("code" in error && error.code === INVALID_STATE_CODE) return databaseClosedByDriver ? new SqlConnectionError(error.message, {
106
+ cause: error,
107
+ transient: false
108
+ }) : new SqlQueryError(error.message, {
109
+ cause: error,
110
+ sqlState: GENERAL_ERROR_SQLSTATE
111
+ });
112
+ return error;
113
+ }
114
+ /**
115
+ * The parameters to bind to a SQLite statement. SQLite cannot store NaN and binds it as NULL. The float codecs refuse NaN when they encode, naming the codec; this refuses a NaN no codec encoded, such as a raw SQL parameter, with the same code and `meta.received`, and `meta.paramIndex` in place of `meta.codecId`.
116
+ */
117
+ function sqliteParams(params) {
118
+ const values = params ?? [];
119
+ const nanIndex = values.findIndex((value) => Number.isNaN(value));
120
+ if (nanIndex !== -1) throw structuredError("RUNTIME.ENCODE_FAILED", `Parameter ${nanIndex + 1} is NaN, which SQLite cannot store: it would bind it as NULL. Pass null to store no value.`, { meta: {
121
+ paramIndex: nanIndex,
122
+ received: "NaN"
123
+ } });
124
+ return blindCast(values);
125
+ }
126
+ const sqliteDriverDescriptorMeta = {
127
+ kind: "driver",
128
+ familyId: "sql",
129
+ targetId: "sqlite",
130
+ id: "sqlite",
131
+ version: "0.0.1",
132
+ capabilities: {}
133
+ };
134
+ //#endregion
135
+ export { sqliteDriverDescriptorMeta as a, safeIntegersAsNumbers as i, normalizeSqliteError as n, sqliteParams as o, prepareExact as r, wasClosedByDriver as s, closeDatabase as t };
136
+
137
+ //# sourceMappingURL=descriptor-meta-CkiPlqDS-n3hDP01X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-CkiPlqDS-n3hDP01X.mjs","names":[],"sources":["../../../../3-targets/sqlite/3-driver/dist/descriptor-meta-CkiPlqDS.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { SqlConnectionError, SqlQueryError } from \"@internal/sql-errors\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/database-state.ts\nconst closedByDriver = /* @__PURE__ */ new WeakSet();\n/** Closes a database the driver opened and records that the driver closed it. */\nfunction closeDatabase(db) {\n\tdb.close();\n\tclosedByDriver.add(db);\n}\n/** Whether the driver itself closed this database. */\nfunction wasClosedByDriver(db) {\n\treturn closedByDriver.has(db);\n}\n//#endregion\n//#region src/exact-integers.ts\nconst MIN_SAFE_INTEGER = BigInt(Number.MIN_SAFE_INTEGER);\nconst MAX_SAFE_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);\n/**\n* Prepares a statement that reads every integer as a `bigint`, so a stored integer of any 64-bit size is read exactly, and `changes` and `lastInsertRowid` are exact too.\n*/\nfunction prepareExact(db, sql) {\n\tconst statement = db.prepare(sql);\n\tstatement.setReadBigInts(true);\n\treturn statement;\n}\n/**\n* A row as the application reads it: an integer within the safe integer range is a `number`, and one outside it stays the exact `bigint` for its codec to read or refuse.\n*/\nfunction safeIntegersAsNumbers(row) {\n\tfor (const key in row) {\n\t\tconst value = row[key];\n\t\tif (typeof value === \"bigint\" && value >= MIN_SAFE_INTEGER && value <= MAX_SAFE_INTEGER) row[key] = Number(value);\n\t}\n\treturn row;\n}\n//#endregion\n//#region src/normalize-error.ts\nconst SQLITE_CONSTRAINT_BASE = 19;\nconst SQLITE_CONSTRAINT_UNIQUE = 2067;\nconst SQLITE_CONSTRAINT_PRIMARYKEY = 1555;\nconst SQLITE_CONSTRAINT_FOREIGNKEY = 787;\nconst SQLITE_CONSTRAINT_NOTNULL = 1299;\nconst SQLITE_CONSTRAINT_CHECK = 275;\nconst SQLITE_BUSY = 5;\nconst SQLITE_LOCKED = 6;\nconst SQLITE_CANTOPEN = 14;\nconst SQLITE_NOTADB = 26;\nconst INVALID_STATE_CODE = \"ERR_INVALID_STATE\";\nconst GENERAL_ERROR_SQLSTATE = \"HY000\";\nfunction isConstraintError(errcode) {\n\treturn (errcode & 255) === SQLITE_CONSTRAINT_BASE;\n}\nfunction isBusyOrLocked(errcode) {\n\tconst base = errcode & 255;\n\treturn base === SQLITE_BUSY || base === SQLITE_LOCKED;\n}\nfunction isOpenFailure(errcode) {\n\tconst base = errcode & 255;\n\treturn base === SQLITE_CANTOPEN || base === SQLITE_NOTADB;\n}\nfunction isSqliteError(error) {\n\tif (!(error instanceof Error)) return false;\n\treturn error.code === \"ERR_SQLITE_ERROR\";\n}\n/**\n* The one place the driver reads SQLite's message: SQLite reports which constraint failed only\n* in the text, as in \"UNIQUE constraint failed: table.column\".\n*/\nfunction constraintNameFromMessage(message) {\n\treturn /constraint failed: (.+)/.exec(message)?.[1];\n}\nfunction mapErrCodeToSqlState(errcode) {\n\tswitch (errcode) {\n\t\tcase SQLITE_CONSTRAINT_UNIQUE:\n\t\tcase SQLITE_CONSTRAINT_PRIMARYKEY: return \"23505\";\n\t\tcase SQLITE_CONSTRAINT_FOREIGNKEY: return \"23503\";\n\t\tcase SQLITE_CONSTRAINT_NOTNULL: return \"23502\";\n\t\tcase SQLITE_CONSTRAINT_CHECK: return \"23514\";\n\t\tdefault:\n\t\t\tif (isConstraintError(errcode)) return \"23000\";\n\t\t\treturn GENERAL_ERROR_SQLSTATE;\n\t}\n}\n/**\n* Normalizes a node:sqlite error. `databaseClosedByDriver` says whether the driver closed the\n* database the failing call used; only then is a wrong-state error a closed-database connection error.\n*/\nfunction normalizeSqliteError(error, databaseClosedByDriver) {\n\tif (!(error instanceof Error)) return new Error(String(error));\n\tif (isSqliteError(error)) {\n\t\tconst errcode = error.errcode ?? 0;\n\t\tif (isBusyOrLocked(errcode)) return new SqlConnectionError(error.message, {\n\t\t\tcause: error,\n\t\t\ttransient: true\n\t\t});\n\t\tif (isOpenFailure(errcode)) return new SqlConnectionError(error.message, {\n\t\t\tcause: error,\n\t\t\ttransient: false\n\t\t});\n\t\tconst sqlState = mapErrCodeToSqlState(errcode);\n\t\tconst constraint = constraintNameFromMessage(error.message);\n\t\treturn new SqlQueryError(error.message, {\n\t\t\tcause: error,\n\t\t\tsqlState,\n\t\t\t...constraint !== void 0 ? { constraint } : {}\n\t\t});\n\t}\n\tif (\"code\" in error && error.code === INVALID_STATE_CODE) return databaseClosedByDriver ? new SqlConnectionError(error.message, {\n\t\tcause: error,\n\t\ttransient: false\n\t}) : new SqlQueryError(error.message, {\n\t\tcause: error,\n\t\tsqlState: GENERAL_ERROR_SQLSTATE\n\t});\n\treturn error;\n}\n//#endregion\n//#region src/sqlite-params.ts\n/**\n* The parameters to bind to a SQLite statement. SQLite cannot store NaN and binds it as NULL. The float codecs refuse NaN when they encode, naming the codec; this refuses a NaN no codec encoded, such as a raw SQL parameter, with the same code and `meta.received`, and `meta.paramIndex` in place of `meta.codecId`.\n*/\nfunction sqliteParams(params) {\n\tconst values = params ?? [];\n\tconst nanIndex = values.findIndex((value) => Number.isNaN(value));\n\tif (nanIndex !== -1) throw structuredError(\"RUNTIME.ENCODE_FAILED\", `Parameter ${nanIndex + 1} is NaN, which SQLite cannot store: it would bind it as NULL. Pass null to store no value.`, { meta: {\n\t\tparamIndex: nanIndex,\n\t\treceived: \"NaN\"\n\t} });\n\treturn blindCast(values);\n}\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst sqliteDriverDescriptorMeta = {\n\tkind: \"driver\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: {}\n};\n//#endregion\nexport { safeIntegersAsNumbers as a, prepareExact as i, sqliteParams as n, closeDatabase as o, normalizeSqliteError as r, wasClosedByDriver as s, sqliteDriverDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-CkiPlqDS.mjs.map"],"mappings":";;;;AAIA,MAAM,iCAAiC,IAAI,QAAQ;;AAEnD,SAAS,cAAc,IAAI;CAC1B,GAAG,MAAM;CACT,eAAe,IAAI,EAA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