@prisma/orm-target-sqlite 8.0.0-rc.9-dev.13 → 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
@@ -0,0 +1,1081 @@
1
+ import { _ as SQLITE_TIME_TEMPORAL_CODEC_ID, a as SQLITE_DATETIME_CODEC_ID, c as SQLITE_DATE_STRING_CODEC_ID, d as SQLITE_DURATION_STRING_CODEC_ID, f as SQLITE_INTEGER_CODEC_ID, g as SQLITE_TIME_STRING_CODEC_ID, h as SQLITE_TEXT_CODEC_ID, i as SQLITE_BOOLEAN_CODEC_ID, l as SQLITE_DATE_TEMPORAL_CODEC_ID, m as SQLITE_REAL_CODEC_ID, n as SQLITE_BIGINT_NUMBER_CODEC_ID, o as SQLITE_DATETIME_STRING_CODEC_ID, p as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_DATETIME_TEMPORAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQLITE_DECIMAL_CODEC_ID } from "./codec-ids-CTshXpbg-tcdbf_VC.mjs";
2
+ import { a as sqliteCodec, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from "./codec-descriptor-DRmF-crq-BALI5Jtz.mjs";
3
+ import { C as sqliteTimeText, S as sqliteTime, _ as sqliteInteger, b as sqliteText, c as sqliteDate, f as sqliteDatetimeTextAtMilliseconds, g as sqliteDurationText, h as sqliteDuration, i as sqliteCharacter, l as sqliteDateText, o as sqliteCharacterVarying, p as sqliteDecimal, r as sqliteBoolean, t as sqliteBlob, u as sqliteDatetime, v as sqliteJson, y as sqliteReal } from "./data-types-Djvapurb-BR-Y4NWN.mjs";
4
+ import { a as errorTemporalNonIsoCalendar, c as errorTemporalWrongType, l as sqliteError, n as errorDateTimeUnreadable, r as errorDateTimeUnwritable, t as errorColumnUnreadable } from "./errors-DxbvEzQp-CeTjoGtL.mjs";
5
+ import { t as requireTemporal } from "./require-temporal-CHWqSDF3-ElFTiAh6.mjs";
6
+ import { BinaryExpr, CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlRawCodec, SqlVarcharCodec, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlRawDescriptor, sqlVarcharDescriptor } from "@prisma/orm-family-sql/relational-core/ast";
7
+ import { CodecImpl, SAFE_INTEGER_BIGINT_RANGE, column, decimalTextBigintLiteral, decimalTextNumberLiteral, floatNumberLiteral, floatToJson, readJsonFloat, readJsonIntegerText, refuseJsonValue, renderTsLiteral } from "@prisma/orm-framework/components/codec";
8
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
9
+ import { sqlRawDataType } from "@prisma/orm-family-sql/contract/data-type";
10
+ import { hasDigitsBelowAMillisecond, isValidDate } from "@prisma/orm-framework/type-implementations/date";
11
+ import { isDecimalText, printedDecimalText } from "@prisma/orm-framework/type-implementations/decimal";
12
+ import { booleanFromInteger, integerFromBoolean } from "@prisma/orm-framework/type-implementations/boolean";
13
+ import { describeValue, temporalFromText, temporalToText } from "@prisma/orm-framework/type-implementations/temporal-text";
14
+ //#region ../../../3-targets/sqlite/1-target/dist/codecs-izq9l1NG.mjs
15
+ /**
16
+ * Projects a blob as a one-element array of its hexadecimal text, and any other value as `otherwise` projects it.
17
+ *
18
+ * SQLite's JSON functions reject a BLOB argument outright, so the encoding has to replace the native conversion rather than post-process it. `hex()` emits uppercase and never wraps. The array is what tells a blob from text: outside a STRICT table a column of any type may hold a blob, and a BLOB column may hold text, which passes through as a row carries it. A codec that reads no bytes receives the array and refuses it, as it refuses the bytes a row carries.
19
+ */
20
+ const hexJsonProjectionOr = (expression, otherwise) => CaseExpr.of([{
21
+ condition: BinaryExpr.eq(FunctionCallExpr.of("typeof", [expression]), LiteralExpr.of("blob")),
22
+ value: FunctionCallExpr.of("json_array", [FunctionCallExpr.of("hex", [expression])])
23
+ }], otherwise);
24
+ /** Projects a blob as the one-element array of its hexadecimal text, and any other value unchanged. */
25
+ const hexJsonProjection = (expression) => hexJsonProjectionOr(expression, expression);
26
+ function describeReceived$1(value) {
27
+ return typeof value === "string" ? JSON.stringify(value) : String(value);
28
+ }
29
+ function requireBoolean(value) {
30
+ if (typeof value === "boolean") return value;
31
+ throw sqliteError("RUNTIME.ENCODE_FAILED", `${SQLITE_BOOLEAN_CODEC_ID} value must be a boolean, got ${describeReceived$1(value)}`, { meta: {
32
+ codecId: SQLITE_BOOLEAN_CODEC_ID,
33
+ received: String(value)
34
+ } });
35
+ }
36
+ /** A stored value that is neither 0 nor 1, named by its column where the read knows it. */
37
+ function errorBooleanUnreadable(wire, ctx) {
38
+ throw errorColumnUnreadable({
39
+ codecId: SQLITE_BOOLEAN_CODEC_ID,
40
+ received: wire,
41
+ column: ctx.column,
42
+ notA: "0 or 1",
43
+ reads: "0 as false and 1 as true"
44
+ });
45
+ }
46
+ var SqliteBooleanCodec = class extends CodecImpl {
47
+ async toWire(value, _ctx) {
48
+ return integerFromBoolean(requireBoolean(value));
49
+ }
50
+ async fromWire(wire, ctx) {
51
+ return booleanFromInteger(wire) ?? errorBooleanUnreadable(wire, ctx);
52
+ }
53
+ fromDataTypeValue(value) {
54
+ return value.value;
55
+ }
56
+ toDataTypeValue(input) {
57
+ return this.dataTypeValueOf(requireBoolean(input));
58
+ }
59
+ };
60
+ var SqliteBooleanDescriptor = class extends SqliteCodecDescriptor {
61
+ jsonProjection(expression) {
62
+ return hexJsonProjection(expression);
63
+ }
64
+ dataType = sqliteBoolean.id;
65
+ codecId = SQLITE_BOOLEAN_CODEC_ID;
66
+ jsonType = "boolean";
67
+ traits = ["equality", "boolean"];
68
+ paramsSchema = void 0;
69
+ renderValueLiteral(value) {
70
+ return renderTsLiteral(value);
71
+ }
72
+ factory() {
73
+ return () => new SqliteBooleanCodec(this, sqliteBoolean);
74
+ }
75
+ };
76
+ const sqliteBooleanDescriptor = new SqliteBooleanDescriptor();
77
+ const sqliteBooleanColumn = () => column(sqliteBooleanDescriptor.factory(), sqliteBooleanDescriptor.codecId, void 0);
78
+ const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
79
+ const DATE_TIME_WITHOUT_OFFSET = /^(\d{4}-\d{2}-\d{2})[Tt ](\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)$/;
80
+ /** A date alone as its midnight in UTC, and a date and time without an offset as UTC. */
81
+ function asUtcWhenUnmarked(text) {
82
+ if (DATE_ONLY.test(text)) return `${text}T00:00:00Z`;
83
+ const unmarked = DATE_TIME_WITHOUT_OFFSET.exec(text);
84
+ return unmarked === null ? text : `${unmarked[1]}T${unmarked[2]}Z`;
85
+ }
86
+ /**
87
+ * The instant SQLite holds for a row, in milliseconds since 1970, read as `Date` reads it, with text without a UTC offset read as UTC, as SQLite's own date and time functions read it, never in the machine's time zone. A number is milliseconds since 1970, as the Prisma ORM query engine wrote a `DateTime`. Digits below a millisecond are cut, as `Date` cuts them.
88
+ */
89
+ function sqliteInstantMilliseconds(codecId, value) {
90
+ const milliseconds = typeof value === "bigint" ? NaN : new Date(typeof value === "number" ? value : asUtcWhenUnmarked(value)).getTime();
91
+ if (Number.isNaN(milliseconds)) throw sqliteError("RUNTIME.DECODE_FAILED", `${codecId} wire value must be a date and time as text, or a number of milliseconds since 1970: ${String(value)}`, { meta: {
92
+ codecId,
93
+ received: String(value)
94
+ } });
95
+ return milliseconds;
96
+ }
97
+ function messageOf(cause) {
98
+ return cause instanceof Error ? cause.message : String(cause);
99
+ }
100
+ /** The text a write stores for `value`, in the form `stored` writes; a value `stored` refuses is refused as `RUNTIME.ENCODE_FAILED`. */
101
+ function storedTextForWrite(codecId, value, stored) {
102
+ if (typeof value !== "string") throw errorDateTimeUnwritable({
103
+ codecId,
104
+ received: describeValue(value),
105
+ detail: "It writes ISO 8601 text."
106
+ });
107
+ try {
108
+ return stored(value);
109
+ } catch (cause) {
110
+ throw errorDateTimeUnwritable({
111
+ codecId,
112
+ received: JSON.stringify(value),
113
+ detail: messageOf(cause),
114
+ cause
115
+ });
116
+ }
117
+ }
118
+ /** The stored form of the text SQLite returned for a row, as `stored` reads it; text `stored` refuses is refused as `RUNTIME.DECODE_FAILED`. */
119
+ function storedTextFromWire(codecId, wire, stored) {
120
+ if (typeof wire !== "string") throw errorDateTimeUnreadable({
121
+ codecId,
122
+ value: String(wire),
123
+ detail: `SQLite returned ${describeValue(wire)}, not text.`
124
+ });
125
+ try {
126
+ return stored(wire);
127
+ } catch (cause) {
128
+ throw errorDateTimeUnreadable({
129
+ codecId,
130
+ value: wire,
131
+ detail: messageOf(cause),
132
+ cause
133
+ });
134
+ }
135
+ }
136
+ /** The Temporal value that stored text names, read with `parse`. */
137
+ function temporalFromStoredText(identity, text, parse) {
138
+ const read = temporalFromText(requireTemporal({
139
+ codecId: identity.codecId,
140
+ operation: "decode"
141
+ }), text, parse);
142
+ if (read.kind === "unreadable") throw errorDateTimeUnreadable({
143
+ codecId: identity.codecId,
144
+ value: text,
145
+ detail: `${identity.temporalTag} cannot hold it: ${read.detail}. Use ${identity.stringType} to read the column as text.`,
146
+ cause: read.cause
147
+ });
148
+ return read.value;
149
+ }
150
+ /** The text a write stores for a Temporal value, in the form `stored` writes. A value of another kind, in a calendar other than ISO 8601, or with digits below a millisecond is refused. */
151
+ function storedTextOfTemporal(identity, value, stored) {
152
+ const encoded = temporalToText(value, identity.temporalTag);
153
+ switch (encoded.kind) {
154
+ case "wrong-type": throw errorTemporalWrongType(identity.codecId, identity.temporalTag, identity.stringType, encoded.received);
155
+ case "non-iso-calendar": throw errorTemporalNonIsoCalendar(identity.codecId, encoded.calendarId);
156
+ case "text":
157
+ if (hasDigitsBelowAMillisecond(encoded.text)) throw errorDateTimeUnwritable({
158
+ codecId: identity.codecId,
159
+ received: `the ${identity.temporalTag} ${encoded.text}`,
160
+ detail: "It has digits below a millisecond, and the column holds milliseconds. Round it first, as in value.round({ smallestUnit: 'millisecond', roundingMode: 'trunc' })."
161
+ });
162
+ return storedTextForWrite(identity.codecId, encoded.text, stored);
163
+ }
164
+ }
165
+ const DATETIME_TEMPORAL = {
166
+ codecId: SQLITE_DATETIME_TEMPORAL_CODEC_ID,
167
+ temporalTag: "Temporal.Instant",
168
+ stringType: "DatetimeString"
169
+ };
170
+ const DATE_TEMPORAL = {
171
+ codecId: SQLITE_DATE_TEMPORAL_CODEC_ID,
172
+ temporalTag: "Temporal.PlainDate",
173
+ stringType: "DateString"
174
+ };
175
+ const TIME_TEMPORAL = {
176
+ codecId: SQLITE_TIME_TEMPORAL_CODEC_ID,
177
+ temporalTag: "Temporal.PlainTime",
178
+ stringType: "TimeString"
179
+ };
180
+ /** A row's text is what the codec reads, so its JSON is the stored text as it is. */
181
+ const storedTextJsonProjection = (expression) => expression;
182
+ const sqliteDatetimeTemporalEncode = (value) => storedTextOfTemporal(DATETIME_TEMPORAL, value, sqliteDatetimeTextAtMilliseconds);
183
+ const sqliteDateTemporalEncode = (value) => storedTextOfTemporal(DATE_TEMPORAL, value, sqliteDateText);
184
+ const sqliteTimeTemporalEncode = (value) => storedTextOfTemporal(TIME_TEMPORAL, value, sqliteTimeText);
185
+ /** An instant read as `Temporal.Instant`, from any text or number `sqlite/datetime@1` reads, at millisecond precision. */
186
+ var SqliteDatetimeTemporalCodec = class extends CodecImpl {
187
+ async toWire(value, _ctx) {
188
+ return sqliteDatetimeTemporalEncode(value);
189
+ }
190
+ async fromWire(wire, _ctx) {
191
+ const milliseconds = sqliteInstantMilliseconds(this.id, wire);
192
+ return requireTemporal({
193
+ codecId: this.id,
194
+ operation: "decode"
195
+ }).Instant.fromEpochMilliseconds(milliseconds);
196
+ }
197
+ fromDataTypeValue(value) {
198
+ return temporalFromStoredText(DATETIME_TEMPORAL, value.value, (temporal, text) => temporal.Instant.from(text));
199
+ }
200
+ toDataTypeValue(input) {
201
+ return this.dataTypeValueOf(sqliteDatetimeTemporalEncode(input));
202
+ }
203
+ };
204
+ var SqliteDatetimeTemporalDescriptor = class extends SqliteCodecDescriptor {
205
+ jsonProjection(expression) {
206
+ return storedTextJsonProjection(expression);
207
+ }
208
+ dataType = sqliteDatetime.id;
209
+ codecId = SQLITE_DATETIME_TEMPORAL_CODEC_ID;
210
+ traits = ["equality", "order"];
211
+ paramsSchema = void 0;
212
+ factory() {
213
+ return () => new SqliteDatetimeTemporalCodec(this, sqliteDatetime);
214
+ }
215
+ };
216
+ const sqliteDatetimeTemporalDescriptor = new SqliteDatetimeTemporalDescriptor();
217
+ const sqliteDatetimeTemporalColumn = () => column(sqliteDatetimeTemporalDescriptor.factory(), sqliteDatetimeTemporalDescriptor.codecId, void 0);
218
+ /** An instant read as the text `sqlite/datetime` stores, `2024-01-01T00:00:00.000Z`, from any text or number `sqlite/datetime@1` reads. A write converts ISO 8601 text with any UTC offset to that form. */
219
+ var SqliteDatetimeStringCodec = class extends CodecImpl {
220
+ async toWire(value, _ctx) {
221
+ return storedTextForWrite(this.id, value, sqliteDatetimeTextAtMilliseconds);
222
+ }
223
+ async fromWire(wire, _ctx) {
224
+ return new Date(sqliteInstantMilliseconds(this.id, wire)).toISOString();
225
+ }
226
+ fromDataTypeValue(value) {
227
+ return value.value;
228
+ }
229
+ toDataTypeValue(input) {
230
+ return this.storedDataTypeValueOf(input);
231
+ }
232
+ };
233
+ var SqliteDatetimeStringDescriptor = class extends SqliteCodecDescriptor {
234
+ jsonProjection(expression) {
235
+ return storedTextJsonProjection(expression);
236
+ }
237
+ dataType = sqliteDatetime.id;
238
+ codecId = SQLITE_DATETIME_STRING_CODEC_ID;
239
+ traits = ["equality", "order"];
240
+ paramsSchema = void 0;
241
+ renderValueLiteral(value) {
242
+ return renderTsLiteral(value);
243
+ }
244
+ factory() {
245
+ return () => new SqliteDatetimeStringCodec(this, sqliteDatetime);
246
+ }
247
+ };
248
+ const sqliteDatetimeStringDescriptor = new SqliteDatetimeStringDescriptor();
249
+ const sqliteDatetimeStringColumn = () => column(sqliteDatetimeStringDescriptor.factory(), sqliteDatetimeStringDescriptor.codecId, void 0);
250
+ /** A calendar date read as the text `sqlite/date` stores, `2024-02-29`. */
251
+ var SqliteDateStringCodec = class extends CodecImpl {
252
+ async toWire(value, _ctx) {
253
+ return storedTextForWrite(this.id, value, sqliteDateText);
254
+ }
255
+ async fromWire(wire, _ctx) {
256
+ return storedTextFromWire(this.id, wire, sqliteDateText);
257
+ }
258
+ fromDataTypeValue(value) {
259
+ return value.value;
260
+ }
261
+ toDataTypeValue(input) {
262
+ return this.storedDataTypeValueOf(input);
263
+ }
264
+ };
265
+ var SqliteDateStringDescriptor = class extends SqliteCodecDescriptor {
266
+ jsonProjection(expression) {
267
+ return storedTextJsonProjection(expression);
268
+ }
269
+ dataType = sqliteDate.id;
270
+ codecId = SQLITE_DATE_STRING_CODEC_ID;
271
+ traits = ["equality", "order"];
272
+ paramsSchema = void 0;
273
+ renderValueLiteral(value) {
274
+ return renderTsLiteral(value);
275
+ }
276
+ factory() {
277
+ return () => new SqliteDateStringCodec(this, sqliteDate);
278
+ }
279
+ };
280
+ const sqliteDateStringDescriptor = new SqliteDateStringDescriptor();
281
+ const sqliteDateStringColumn = () => column(sqliteDateStringDescriptor.factory(), sqliteDateStringDescriptor.codecId, void 0);
282
+ /** A calendar date read as `Temporal.PlainDate`. */
283
+ var SqliteDateTemporalCodec = class extends CodecImpl {
284
+ async toWire(value, _ctx) {
285
+ return sqliteDateTemporalEncode(value);
286
+ }
287
+ async fromWire(wire, _ctx) {
288
+ return temporalFromStoredText(DATE_TEMPORAL, storedTextFromWire(this.id, wire, sqliteDateText), (temporal, text) => temporal.PlainDate.from(text));
289
+ }
290
+ fromDataTypeValue(value) {
291
+ return temporalFromStoredText(DATE_TEMPORAL, value.value, (temporal, text) => temporal.PlainDate.from(text));
292
+ }
293
+ toDataTypeValue(input) {
294
+ return this.dataTypeValueOf(sqliteDateTemporalEncode(input));
295
+ }
296
+ };
297
+ var SqliteDateTemporalDescriptor = class extends SqliteCodecDescriptor {
298
+ jsonProjection(expression) {
299
+ return storedTextJsonProjection(expression);
300
+ }
301
+ dataType = sqliteDate.id;
302
+ codecId = SQLITE_DATE_TEMPORAL_CODEC_ID;
303
+ traits = ["equality", "order"];
304
+ paramsSchema = void 0;
305
+ factory() {
306
+ return () => new SqliteDateTemporalCodec(this, sqliteDate);
307
+ }
308
+ };
309
+ const sqliteDateTemporalDescriptor = new SqliteDateTemporalDescriptor();
310
+ const sqliteDateTemporalColumn = () => column(sqliteDateTemporalDescriptor.factory(), sqliteDateTemporalDescriptor.codecId, void 0);
311
+ /** A time of day read as the text `sqlite/time` stores, `09:30:00.000`. A write pads text with fewer fraction digits to three. */
312
+ var SqliteTimeStringCodec = class extends CodecImpl {
313
+ async toWire(value, _ctx) {
314
+ return storedTextForWrite(this.id, value, sqliteTimeText);
315
+ }
316
+ async fromWire(wire, _ctx) {
317
+ return storedTextFromWire(this.id, wire, sqliteTimeText);
318
+ }
319
+ fromDataTypeValue(value) {
320
+ return value.value;
321
+ }
322
+ toDataTypeValue(input) {
323
+ return this.storedDataTypeValueOf(input);
324
+ }
325
+ };
326
+ var SqliteTimeStringDescriptor = class extends SqliteCodecDescriptor {
327
+ jsonProjection(expression) {
328
+ return storedTextJsonProjection(expression);
329
+ }
330
+ dataType = sqliteTime.id;
331
+ codecId = SQLITE_TIME_STRING_CODEC_ID;
332
+ traits = ["equality", "order"];
333
+ paramsSchema = void 0;
334
+ renderValueLiteral(value) {
335
+ return renderTsLiteral(value);
336
+ }
337
+ factory() {
338
+ return () => new SqliteTimeStringCodec(this, sqliteTime);
339
+ }
340
+ };
341
+ const sqliteTimeStringDescriptor = new SqliteTimeStringDescriptor();
342
+ const sqliteTimeStringColumn = () => column(sqliteTimeStringDescriptor.factory(), sqliteTimeStringDescriptor.codecId, void 0);
343
+ /** A time of day read as `Temporal.PlainTime`. */
344
+ var SqliteTimeTemporalCodec = class extends CodecImpl {
345
+ async toWire(value, _ctx) {
346
+ return sqliteTimeTemporalEncode(value);
347
+ }
348
+ async fromWire(wire, _ctx) {
349
+ return temporalFromStoredText(TIME_TEMPORAL, storedTextFromWire(this.id, wire, sqliteTimeText), (temporal, text) => temporal.PlainTime.from(text));
350
+ }
351
+ fromDataTypeValue(value) {
352
+ return temporalFromStoredText(TIME_TEMPORAL, value.value, (temporal, text) => temporal.PlainTime.from(text));
353
+ }
354
+ toDataTypeValue(input) {
355
+ return this.dataTypeValueOf(sqliteTimeTemporalEncode(input));
356
+ }
357
+ };
358
+ var SqliteTimeTemporalDescriptor = class extends SqliteCodecDescriptor {
359
+ jsonProjection(expression) {
360
+ return storedTextJsonProjection(expression);
361
+ }
362
+ dataType = sqliteTime.id;
363
+ codecId = SQLITE_TIME_TEMPORAL_CODEC_ID;
364
+ traits = ["equality", "order"];
365
+ paramsSchema = void 0;
366
+ factory() {
367
+ return () => new SqliteTimeTemporalCodec(this, sqliteTime);
368
+ }
369
+ };
370
+ const sqliteTimeTemporalDescriptor = new SqliteTimeTemporalDescriptor();
371
+ const sqliteTimeTemporalColumn = () => column(sqliteTimeTemporalDescriptor.factory(), sqliteTimeTemporalDescriptor.codecId, void 0);
372
+ /** A length of time read as the ISO 8601 duration it was written as, `PT1H30M`. Its text does not sort in the order of the durations, so it offers no order. */
373
+ var SqliteDurationStringCodec = class extends CodecImpl {
374
+ async toWire(value, _ctx) {
375
+ return storedTextForWrite(this.id, value, sqliteDurationText);
376
+ }
377
+ async fromWire(wire, _ctx) {
378
+ return storedTextFromWire(this.id, wire, sqliteDurationText);
379
+ }
380
+ fromDataTypeValue(value) {
381
+ return value.value;
382
+ }
383
+ toDataTypeValue(input) {
384
+ return this.storedDataTypeValueOf(input);
385
+ }
386
+ };
387
+ var SqliteDurationStringDescriptor = class extends SqliteCodecDescriptor {
388
+ jsonProjection(expression) {
389
+ return storedTextJsonProjection(expression);
390
+ }
391
+ dataType = sqliteDuration.id;
392
+ codecId = SQLITE_DURATION_STRING_CODEC_ID;
393
+ traits = ["equality"];
394
+ paramsSchema = void 0;
395
+ renderValueLiteral(value) {
396
+ return renderTsLiteral(value);
397
+ }
398
+ factory() {
399
+ return () => new SqliteDurationStringCodec(this, sqliteDuration);
400
+ }
401
+ };
402
+ const sqliteDurationStringDescriptor = new SqliteDurationStringDescriptor();
403
+ const sqliteDurationStringColumn = () => column(sqliteDurationStringDescriptor.factory(), sqliteDurationStringDescriptor.codecId, void 0);
404
+ const EXPECTED = "decimal text, such as \"12.50\"";
405
+ function describeReceived(value) {
406
+ return typeof value === "string" ? JSON.stringify(value) : String(value);
407
+ }
408
+ /** The decimal text the codec writes for an application value: the value without leading zeros or a minus sign on zero. */
409
+ function storedDecimalText(value) {
410
+ if (typeof value === "string" && isDecimalText(value)) return printedDecimalText(value);
411
+ throw sqliteError("RUNTIME.ENCODE_FAILED", `${SQLITE_DECIMAL_CODEC_ID} value must be ${EXPECTED}, got ${describeReceived(value)}`, { meta: {
412
+ codecId: SQLITE_DECIMAL_CODEC_ID,
413
+ received: String(value)
414
+ } });
415
+ }
416
+ /** A stored value the codec cannot read, such as the empty text an earlier fill wrote into a new column, named by its column where the read knows it. */
417
+ function errorDecimalUnreadable(wire, ctx) {
418
+ throw errorColumnUnreadable({
419
+ codecId: SQLITE_DECIMAL_CODEC_ID,
420
+ received: wire,
421
+ column: ctx.column,
422
+ notA: "decimal text",
423
+ reads: EXPECTED
424
+ });
425
+ }
426
+ var SqliteDecimalCodec = class extends CodecImpl {
427
+ async toWire(value, _ctx) {
428
+ return storedDecimalText(value);
429
+ }
430
+ async fromWire(wire, ctx) {
431
+ if (typeof wire === "string" && isDecimalText(wire)) return wire;
432
+ return errorDecimalUnreadable(wire, ctx);
433
+ }
434
+ fromDataTypeValue(value) {
435
+ return value.value;
436
+ }
437
+ toDataTypeValue(input) {
438
+ return this.dataTypeValueOf(storedDecimalText(input));
439
+ }
440
+ };
441
+ var SqliteDecimalDescriptor = class extends SqliteCodecDescriptor {
442
+ jsonProjection(expression) {
443
+ return hexJsonProjection(expression);
444
+ }
445
+ dataType = sqliteDecimal.id;
446
+ codecId = SQLITE_DECIMAL_CODEC_ID;
447
+ jsonType = "string";
448
+ traits = ["equality"];
449
+ paramsSchema = void 0;
450
+ renderValueLiteral(value) {
451
+ return renderTsLiteral(value);
452
+ }
453
+ factory() {
454
+ return () => new SqliteDecimalCodec(this, sqliteDecimal);
455
+ }
456
+ };
457
+ const sqliteDecimalDescriptor = new SqliteDecimalDescriptor();
458
+ const sqliteDecimalColumn = () => column(sqliteDecimalDescriptor.factory(), sqliteDecimalDescriptor.codecId, void 0);
459
+ /**
460
+ * Projects the expression unchanged, for codecs whose canonical JSON is what
461
+ * SQLite's own JSON conversion already produces.
462
+ *
463
+ * Identity here is a claim about the target's behaviour, not an absence of one:
464
+ * the codec's conformance cases are what test it, including at the boundaries
465
+ * of the representation where a native conversion would be most likely to
466
+ * diverge.
467
+ */
468
+ const identityJsonProjection = (expression) => expression;
469
+ /**
470
+ * Projects an integer as decimal text, a blob as the array of its hex text, and any other value as SQLite writes it in JSON, so a codec reads and refuses through an include what it reads and refuses in a row.
471
+ *
472
+ * The cast is part of the projected expression, so it applies before the JSON constructor sees the value: handed an INTEGER directly, the constructor emits a JSON number, and SQLite's 64-bit range does not survive being read back as a double. Casting the constructor's result would be too late. A blob cast to text would read as the digits its bytes spell, and a REAL cast to text would read as text.
473
+ */
474
+ const integerJsonProjection = (expression) => CaseExpr.of([{
475
+ condition: BinaryExpr.eq(FunctionCallExpr.of("typeof", [expression]), LiteralExpr.of("integer")),
476
+ value: CastExpr.as(expression, "TEXT")
477
+ }], hexJsonProjection(expression));
478
+ /**
479
+ * Projects a REAL as SQLite writes it in JSON, except an infinity, which SQLite writes as `9.0e+999` and which becomes the text `Infinity` or `-Infinity` that the codec stores. The test is equality with an infinity, so text or a blob that a REAL column holds outside a STRICT table passes through unchanged.
480
+ */
481
+ const floatJsonProjection = (expression) => hexJsonProjectionOr(expression, infinityAsTextJsonProjection(expression));
482
+ const infinityAsTextJsonProjection = (expression) => CaseExpr.of([{
483
+ condition: BinaryExpr.eq(expression, LiteralExpr.of(Number.POSITIVE_INFINITY)),
484
+ value: LiteralExpr.of("Infinity")
485
+ }, {
486
+ condition: BinaryExpr.eq(expression, LiteralExpr.of(Number.NEGATIVE_INFINITY)),
487
+ value: LiteralExpr.of("-Infinity")
488
+ }], expression);
489
+ const JSON_RETAG_FN = "json";
490
+ /**
491
+ * Re-applies SQLite's JSON subtype to a document-valued expression.
492
+ *
493
+ * SQLite carries "this text is JSON" as a subtype on the value rather than in
494
+ * its type, and the subtype does not survive a derived table: a document that
495
+ * `json_object` produced arrives one level out as plain text, so the enclosing
496
+ * constructor embeds it as a *string containing JSON* rather than as a
497
+ * document. `json()` re-applies the subtype, which is what makes the value nest
498
+ * as a document again.
499
+ *
500
+ * The loss happens at the first derived-table boundary and does not compound, so
501
+ * a retag is needed where the document is consumed rather than at every level it
502
+ * passes through.
503
+ *
504
+ * Applying this twice is a no-op — SQLite's `json()` is idempotent, and the
505
+ * wrapper collapses rather than nesting so the rendered SQL says so too. It is
506
+ * safe on any valid JSON text, including scalars, and on NULL; it raises
507
+ * `malformed JSON` on text that is not JSON, which is the correct failure for a
508
+ * value that was never a document.
509
+ */
510
+ const jsonDocumentRetag = (expression) => isJsonRetag(expression) ? expression : FunctionCallExpr.of(JSON_RETAG_FN, [expression]);
511
+ /** Whether an expression is already a retag, so applying one again would only nest. */
512
+ const isJsonRetag = (expression) => expression instanceof FunctionCallExpr && expression.fn === JSON_RETAG_FN && expression.args.length === 1;
513
+ const DECIMAL_INTEGER = /^-?\d+$/;
514
+ /** Renders the document a `sqlite/json` value's JSON text holds, when it is a string, number or boolean, and nothing for text that is not JSON. */
515
+ function jsonTextLiteral(value) {
516
+ if (typeof value !== "string") return void 0;
517
+ try {
518
+ return renderTsLiteral(JSON.parse(value));
519
+ } catch {
520
+ return;
521
+ }
522
+ }
523
+ /**
524
+ * SQLite stores an infinity but not NaN, which it turns into NULL, so a float codec on SQLite refuses NaN wherever it writes a value: to a parameter, and to the contract.
525
+ */
526
+ function refuseNaN(codecId, value) {
527
+ if (Number.isNaN(value)) throw sqliteError("RUNTIME.ENCODE_FAILED", `${codecId} value must be a number other than NaN, which SQLite cannot store`, { meta: {
528
+ codecId,
529
+ received: "NaN"
530
+ } });
531
+ return value;
532
+ }
533
+ /** Reads a float's JSON form, which on SQLite has no NaN. */
534
+ function readJsonFloatWithoutNaN(codecId, json) {
535
+ const value = readJsonFloat(codecId, json);
536
+ if (Number.isNaN(value)) return refuseJsonValue(codecId, "a finite number or the text Infinity or -Infinity; SQLite cannot store NaN", json);
537
+ return value;
538
+ }
539
+ /** `sql/float@1` as SQLite stores it: without NaN. */
540
+ var SqliteFloatCodec = class extends SqlFloatCodec {
541
+ async toWire(value, ctx) {
542
+ return super.toWire(refuseNaN(this.id, value), ctx);
543
+ }
544
+ async fromWire(wire, ctx) {
545
+ return floatWire(this.id, wire, ctx);
546
+ }
547
+ fromDataTypeValue(value) {
548
+ return readJsonFloatWithoutNaN(this.id, value.value);
549
+ }
550
+ toDataTypeValue(input) {
551
+ return super.toDataTypeValue(refuseNaN(this.id, input));
552
+ }
553
+ };
554
+ /**
555
+ * Requires an application value to be of the JS type the codec reads.
556
+ *
557
+ * A range check reads a value of the wrong type as a value out of range, and
558
+ * reports a number plainly inside the range as outside it — so the type is
559
+ * established first and answered for on its own terms, naming what a caller
560
+ * has to change.
561
+ */
562
+ const requireJsType = (codecId, expected, value) => {
563
+ if (typeof value === expected) return;
564
+ throw sqliteError("RUNTIME.ENCODE_FAILED", `${codecId} value must be a ${expected}, got ${typeof value} ${String(value)}`, { meta: {
565
+ codecId,
566
+ received: typeof value
567
+ } });
568
+ };
569
+ /**
570
+ * Writes an application value as the decimal text `sqlite/bigint@1` carries as
571
+ * its canonical JSON.
572
+ *
573
+ * A schema-written literal default (`BigInt @default(0)`) arrives here as a
574
+ * `number`, since a number literal is the only integer a schema language
575
+ * writes, and one that is a safe integer names its value exactly. Past that
576
+ * range the literal was rounded before any of this ran, so the value written is
577
+ * not the value meant — which this refuses rather than minting an exact-looking
578
+ * value from it. A non-integral number is refused on the same terms.
579
+ */
580
+ const bigintEncodeJson = (codecId, value) => {
581
+ if (typeof value !== "number") return encodableInt64(codecId, value).toString();
582
+ if (!Number.isSafeInteger(value)) throw sqliteError("RUNTIME.ENCODE_FAILED", `${codecId} number literal must be an integer within the safe integer range, got ${String(value)}`, { meta: {
583
+ codecId,
584
+ received: String(value)
585
+ } });
586
+ return BigInt(value).toString();
587
+ };
588
+ const INT64_RANGE$1 = {
589
+ min: -(2n ** 63n),
590
+ max: 2n ** 63n - 1n
591
+ };
592
+ /** The application value `sqlite/bigint@1` writes: a `bigint` within the signed 64-bit range an SQLite INTEGER holds. */
593
+ const encodableInt64 = (codecId, value) => {
594
+ requireJsType(codecId, "bigint", value);
595
+ if (value < INT64_RANGE$1.min || value > INT64_RANGE$1.max) throw sqliteError("RUNTIME.ENCODE_FAILED", `${codecId} value must be an integer from ${INT64_RANGE$1.min} to ${INT64_RANGE$1.max}, which SQLite stores, got ${value}`, { meta: {
596
+ codecId,
597
+ received: value.toString()
598
+ } });
599
+ return value;
600
+ };
601
+ /**
602
+ * The application value a number-flavoured integer codec writes: the JS type it reads, an integer within ±(2^53 − 1), the range a `number` holds exactly. The guard throws rather than rounding: past the boundary a `number` silently loses digits, which is the failure mode these codecs exist to refuse.
603
+ */
604
+ const encodableSafeInteger = (codecId, value) => {
605
+ requireJsType(codecId, "number", value);
606
+ if (!Number.isSafeInteger(value)) throw sqliteError("RUNTIME.ENCODE_FAILED", `${codecId} value must be an integer within the safe integer range, got ${String(value)}`, { meta: {
607
+ codecId,
608
+ received: String(value)
609
+ } });
610
+ return Object.is(value, -0) ? 0 : value;
611
+ };
612
+ /** `sqlite/integer`'s stored form, read into a `number`: digit text within the safe integer range. */
613
+ const safeIntegerFromDigitText = (codecId, json) => Number(readJsonIntegerText(codecId, json, SAFE_INTEGER_BIGINT_RANGE));
614
+ /** A `number` written as `sqlite/integer`'s stored form. */
615
+ const digitTextOfSafeInteger = (codecId, value) => String(encodableSafeInteger(codecId, value));
616
+ function errorIntegerUnreadable(codecId, received, ctx) {
617
+ throw errorColumnUnreadable({
618
+ codecId,
619
+ received,
620
+ column: ctx.column,
621
+ notA: "an integer within the safe integer range",
622
+ reads: `integers from ${SAFE_INTEGER_BIGINT_RANGE.min} to ${SAFE_INTEGER_BIGINT_RANGE.max}`
623
+ });
624
+ }
625
+ /** A stored value `sqlite/bigint@1` cannot read, named by its column where the read knows it. */
626
+ function errorBigintUnreadable(received, ctx) {
627
+ throw errorColumnUnreadable({
628
+ codecId: SQLITE_BIGINT_CODEC_ID,
629
+ received,
630
+ column: ctx.column,
631
+ notA: "stored as a 64-bit integer",
632
+ reads: `integers from ${INT64_RANGE$1.min} to ${INT64_RANGE$1.max}`
633
+ });
634
+ }
635
+ /** An integer the driver reads exactly, or the decimal text an include carries, read into a safe-range `number`. A blob, which a row carries as bytes and an include as the array of their hex text, is refused. */
636
+ function safeIntegerFromExact(codecId, wire, ctx) {
637
+ const value = typeof wire === "bigint" ? wire : typeof wire === "string" && DECIMAL_INTEGER.test(wire) ? BigInt(wire) : void 0;
638
+ if (value === void 0 || value < SAFE_INTEGER_BIGINT_RANGE.min || value > SAFE_INTEGER_BIGINT_RANGE.max) return errorIntegerUnreadable(codecId, wire, ctx);
639
+ return Number(value);
640
+ }
641
+ /** Reads an INTEGER's wire value into a `number` within the safe integer range. A stored REAL, such as 1.5, is refused too. */
642
+ function safeIntegerWire(codecId, wire, ctx) {
643
+ if (typeof wire !== "number") return safeIntegerFromExact(codecId, wire, ctx);
644
+ if (Number.isSafeInteger(wire)) return Object.is(wire, -0) ? 0 : wire;
645
+ return errorIntegerUnreadable(codecId, wire, ctx);
646
+ }
647
+ /**
648
+ * Reads a REAL's wire value: the number the driver returns for a row, an integer outside the safe range as the nearest float, or the text `Infinity` or `-Infinity` an include carries, because JSON has no infinity. Anything else, such as other text or a blob, is refused naming its column.
649
+ */
650
+ function floatWire(codecId, wire, ctx) {
651
+ if (typeof wire === "number") return wire;
652
+ if (typeof wire === "bigint") return Number(wire);
653
+ if (wire === "Infinity") return Number.POSITIVE_INFINITY;
654
+ if (wire === "-Infinity") return Number.NEGATIVE_INFINITY;
655
+ throw errorColumnUnreadable({
656
+ codecId,
657
+ received: wire,
658
+ column: ctx.column,
659
+ notA: "a number",
660
+ reads: "a number, or the text Infinity or -Infinity"
661
+ });
662
+ }
663
+ /** The hex text SQLite's `hex()` writes: two uppercase digits for each byte. */
664
+ const BLOB_HEX_TEXT = /^(?:[0-9A-F]{2})*$/;
665
+ /**
666
+ * Projects a `sql/char@1` value without trailing spaces, as its `decode` reads it on a flat read, so an include reads the same value. SQLite does not pad the value; the rule is the family codec's.
667
+ */
668
+ const unpaddedCharJsonProjection = (expression) => FunctionCallExpr.of("rtrim", [expression, LiteralExpr.of(" ")]);
669
+ const sqliteSqlCharDescriptor = sqliteCodec(sqlCharDescriptor, {
670
+ dataType: sqliteCharacter,
671
+ renderValueLiteral: renderTsLiteral,
672
+ jsonProjection: unpaddedCharJsonProjection,
673
+ factory: (descriptor, dataType, params) => () => new SqlCharCodec(descriptor, dataType, params)
674
+ });
675
+ const sqliteSqlVarcharDescriptor = sqliteCodec(sqlVarcharDescriptor, {
676
+ dataType: sqliteCharacterVarying,
677
+ renderValueLiteral: renderTsLiteral,
678
+ jsonProjection: identityJsonProjection,
679
+ factory: (descriptor, dataType, params) => () => new SqlVarcharCodec(descriptor, dataType, params)
680
+ });
681
+ /**
682
+ * `sql/raw@1` as SQLite reads it: a value keeps the shape the driver returns for its storage class. An include carries a BLOB as the array of its hex text that the projection writes, because SQLite's JSON functions refuse a blob; a column value never reaches the JSON constructor as an array, so the array is a BLOB.
683
+ */
684
+ var SqliteSqlRawCodec = class extends SqlRawCodec {
685
+ async fromWire(wire, _ctx) {
686
+ if (!Array.isArray(wire)) return wire;
687
+ const [hex] = wire.length === 1 ? wire : [];
688
+ if (typeof hex !== "string" || !BLOB_HEX_TEXT.test(hex)) throw sqliteError("RUNTIME.DECODE_FAILED", `${this.id} wire value in an include must be the array of a BLOB's hex text`, { meta: {
689
+ codecId: this.id,
690
+ received: String(wire)
691
+ } });
692
+ return new Uint8Array(Buffer.from(hex, "hex"));
693
+ }
694
+ };
695
+ const sqliteSqlRawDescriptor = sqliteCodec(sqlRawDescriptor, {
696
+ dataType: sqlRawDataType,
697
+ jsonProjection: hexJsonProjection,
698
+ factory: (descriptor, dataType, params) => () => new SqliteSqlRawCodec(descriptor, dataType, params)
699
+ });
700
+ /** `sql/int@1` as SQLite stores it: its stored form is `sqlite/integer`'s digit text. */
701
+ var SqliteSqlIntCodec = class extends SqlIntCodec {
702
+ async fromWire(wire, ctx) {
703
+ return safeIntegerWire(this.id, wire, ctx);
704
+ }
705
+ fromDataTypeValue(value) {
706
+ return safeIntegerFromDigitText(this.id, value.value);
707
+ }
708
+ toDataTypeValue(input) {
709
+ return this.dataTypeValueOf(digitTextOfSafeInteger(this.id, input));
710
+ }
711
+ };
712
+ const sqliteSqlIntDescriptor = sqliteCodec(sqlIntDescriptor, {
713
+ dataType: sqliteInteger,
714
+ renderValueLiteral: decimalTextNumberLiteral,
715
+ jsonProjection: integerJsonProjection,
716
+ factory: (descriptor, dataType) => () => new SqliteSqlIntCodec(descriptor, dataType)
717
+ });
718
+ const sqliteSqlFloatDescriptor = sqliteCodec(sqlFloatDescriptor, {
719
+ dataType: sqliteReal,
720
+ renderValueLiteral: floatNumberLiteral,
721
+ jsonProjection: floatJsonProjection,
722
+ factory: (descriptor, dataType) => () => new SqliteFloatCodec(descriptor, dataType)
723
+ });
724
+ var SqliteTextCodec = class extends CodecImpl {
725
+ async toWire(value, _ctx) {
726
+ return value;
727
+ }
728
+ async fromWire(wire, _ctx) {
729
+ return wire;
730
+ }
731
+ fromDataTypeValue(value) {
732
+ return value.value;
733
+ }
734
+ toDataTypeValue(input) {
735
+ return this.dataTypeValueOf(input);
736
+ }
737
+ };
738
+ var SqliteTextDescriptor = class extends SqliteCodecDescriptor {
739
+ jsonProjection(expression) {
740
+ return expression;
741
+ }
742
+ dataType = sqliteText.id;
743
+ codecId = SQLITE_TEXT_CODEC_ID;
744
+ jsonType = "string";
745
+ traits = [
746
+ "equality",
747
+ "order",
748
+ "textual"
749
+ ];
750
+ paramsSchema = void 0;
751
+ renderValueLiteral(value) {
752
+ return renderTsLiteral(value);
753
+ }
754
+ factory() {
755
+ return () => new SqliteTextCodec(this, sqliteText);
756
+ }
757
+ };
758
+ const sqliteTextDescriptor = new SqliteTextDescriptor();
759
+ const sqliteTextColumn = () => column(sqliteTextDescriptor.factory(), sqliteTextDescriptor.codecId, void 0);
760
+ var SqliteIntegerCodec = class extends CodecImpl {
761
+ async toWire(value, _ctx) {
762
+ return encodableSafeInteger(SQLITE_INTEGER_CODEC_ID, value);
763
+ }
764
+ async fromWire(wire, ctx) {
765
+ return safeIntegerWire(SQLITE_INTEGER_CODEC_ID, wire, ctx);
766
+ }
767
+ fromDataTypeValue(value) {
768
+ return safeIntegerFromDigitText(SQLITE_INTEGER_CODEC_ID, value.value);
769
+ }
770
+ toDataTypeValue(input) {
771
+ return this.dataTypeValueOf(digitTextOfSafeInteger(SQLITE_INTEGER_CODEC_ID, input));
772
+ }
773
+ };
774
+ var SqliteIntegerDescriptor = class extends SqliteCodecDescriptor {
775
+ jsonProjection(expression) {
776
+ return integerJsonProjection(expression);
777
+ }
778
+ dataType = sqliteInteger.id;
779
+ codecId = SQLITE_INTEGER_CODEC_ID;
780
+ jsonType = "number";
781
+ traits = [
782
+ "equality",
783
+ "order",
784
+ "numeric"
785
+ ];
786
+ paramsSchema = void 0;
787
+ renderValueLiteral(value) {
788
+ return decimalTextNumberLiteral(value);
789
+ }
790
+ factory() {
791
+ return () => new SqliteIntegerCodec(this, sqliteInteger);
792
+ }
793
+ };
794
+ const sqliteIntegerDescriptor = new SqliteIntegerDescriptor();
795
+ const sqliteIntegerColumn = () => column(sqliteIntegerDescriptor.factory(), sqliteIntegerDescriptor.codecId, void 0);
796
+ var SqliteRealCodec = class extends CodecImpl {
797
+ async toWire(value, _ctx) {
798
+ return refuseNaN(SQLITE_REAL_CODEC_ID, value);
799
+ }
800
+ async fromWire(wire, ctx) {
801
+ return floatWire(SQLITE_REAL_CODEC_ID, wire, ctx);
802
+ }
803
+ fromDataTypeValue(value) {
804
+ return readJsonFloatWithoutNaN(SQLITE_REAL_CODEC_ID, value.value);
805
+ }
806
+ toDataTypeValue(input) {
807
+ return this.dataTypeValueOf(floatToJson(refuseNaN(SQLITE_REAL_CODEC_ID, input)));
808
+ }
809
+ };
810
+ var SqliteRealDescriptor = class extends SqliteCodecDescriptor {
811
+ jsonProjection(expression) {
812
+ return floatJsonProjection(expression);
813
+ }
814
+ dataType = sqliteReal.id;
815
+ codecId = SQLITE_REAL_CODEC_ID;
816
+ jsonType = "number";
817
+ traits = [
818
+ "equality",
819
+ "order",
820
+ "numeric"
821
+ ];
822
+ paramsSchema = void 0;
823
+ renderValueLiteral(value) {
824
+ return floatNumberLiteral(value);
825
+ }
826
+ factory() {
827
+ return () => new SqliteRealCodec(this, sqliteReal);
828
+ }
829
+ };
830
+ const sqliteRealDescriptor = new SqliteRealDescriptor();
831
+ const sqliteRealColumn = () => column(sqliteRealDescriptor.factory(), sqliteRealDescriptor.codecId, void 0);
832
+ var SqliteBlobCodec = class extends CodecImpl {
833
+ async toWire(value, _ctx) {
834
+ return value;
835
+ }
836
+ /** A row carries the blob's bytes; an include carries the array of their hex text that its projection writes, because SQLite's JSON functions refuse a blob. Anything else a BLOB column holds is refused. */
837
+ async fromWire(wire, ctx) {
838
+ if (wire instanceof Uint8Array) return wire;
839
+ const [hex] = Array.isArray(wire) && wire.length === 1 ? wire : [];
840
+ if (typeof hex !== "string" || !BLOB_HEX_TEXT.test(hex)) throw errorColumnUnreadable({
841
+ codecId: SQLITE_BLOB_CODEC_ID,
842
+ received: wire,
843
+ column: ctx.column,
844
+ notA: "a blob",
845
+ reads: "a blob's bytes"
846
+ });
847
+ return new Uint8Array(Buffer.from(hex, "hex"));
848
+ }
849
+ fromDataTypeValue(value) {
850
+ return new Uint8Array(Buffer.from(value.value, "hex"));
851
+ }
852
+ toDataTypeValue(input) {
853
+ return this.dataTypeValueOf(Buffer.from(input).toString("hex").toUpperCase());
854
+ }
855
+ };
856
+ var SqliteBlobDescriptor = class extends SqliteCodecDescriptor {
857
+ jsonProjection(expression) {
858
+ return hexJsonProjection(expression);
859
+ }
860
+ dataType = sqliteBlob.id;
861
+ codecId = SQLITE_BLOB_CODEC_ID;
862
+ jsonType = "object";
863
+ traits = ["equality"];
864
+ paramsSchema = void 0;
865
+ factory() {
866
+ return () => new SqliteBlobCodec(this, sqliteBlob);
867
+ }
868
+ };
869
+ const sqliteBlobDescriptor = new SqliteBlobDescriptor();
870
+ const sqliteBlobColumn = () => column(sqliteBlobDescriptor.factory(), sqliteBlobDescriptor.codecId, void 0);
871
+ /**
872
+ * Reads what SQLite holds for an instant as `Date` reads it, with text without a UTC offset read as UTC, as SQLite's own date and time functions read it, never in the machine's time zone. A number is milliseconds since 1970, as the Prisma ORM query engine wrote a `DateTime`. Digits below a millisecond are cut, as `Date` cuts them.
873
+ */
874
+ function decodeSqliteDatetime(value) {
875
+ return new Date(sqliteInstantMilliseconds(SQLITE_DATETIME_CODEC_ID, value));
876
+ }
877
+ /** The text SQLite holds for an instant: what the codec writes for every row, and for a default. An Invalid Date is refused, naming the codec. */
878
+ function encodeSqliteDatetime(value) {
879
+ if (!isValidDate(value)) throw errorDateTimeUnwritable({
880
+ codecId: SQLITE_DATETIME_CODEC_ID,
881
+ received: "an Invalid Date",
882
+ detail: "Pass a Date that holds an instant."
883
+ });
884
+ return value.toISOString();
885
+ }
886
+ var SqliteDatetimeCodec = class extends CodecImpl {
887
+ async toWire(value, _ctx) {
888
+ return encodeSqliteDatetime(value);
889
+ }
890
+ async fromWire(wire, _ctx) {
891
+ return decodeSqliteDatetime(wire);
892
+ }
893
+ fromDataTypeValue(value) {
894
+ return new Date(value.value);
895
+ }
896
+ toDataTypeValue(input) {
897
+ return this.dataTypeValueOf(encodeSqliteDatetime(input));
898
+ }
899
+ };
900
+ var SqliteDatetimeDescriptor = class extends SqliteCodecDescriptor {
901
+ jsonProjection(expression) {
902
+ return expression;
903
+ }
904
+ dataType = sqliteDatetime.id;
905
+ codecId = SQLITE_DATETIME_CODEC_ID;
906
+ jsonType = "string";
907
+ traits = ["equality", "order"];
908
+ paramsSchema = void 0;
909
+ factory() {
910
+ return () => new SqliteDatetimeCodec(this, sqliteDatetime);
911
+ }
912
+ };
913
+ const sqliteDatetimeDescriptor = new SqliteDatetimeDescriptor();
914
+ const sqliteDatetimeColumn = () => column(sqliteDatetimeDescriptor.factory(), sqliteDatetimeDescriptor.codecId, void 0);
915
+ /** A stored value `sqlite/json@1` cannot read, named by its column where the read knows it. */
916
+ function errorJsonUnreadable(received, ctx) {
917
+ throw errorColumnUnreadable({
918
+ codecId: SQLITE_JSON_CODEC_ID,
919
+ received,
920
+ column: ctx.column,
921
+ notA: "JSON text",
922
+ reads: "JSON text as the document it holds"
923
+ });
924
+ }
925
+ var SqliteJsonCodec = class extends CodecImpl {
926
+ async toWire(value, _ctx) {
927
+ return JSON.stringify(value);
928
+ }
929
+ async fromWire(wire, ctx) {
930
+ if (wire instanceof Uint8Array || Array.isArray(wire)) return errorJsonUnreadable(wire, ctx);
931
+ if (typeof wire !== "string") return wire;
932
+ try {
933
+ return blindCast(JSON.parse(wire));
934
+ } catch {
935
+ return errorJsonUnreadable(wire, ctx);
936
+ }
937
+ }
938
+ fromDataTypeValue(value) {
939
+ return blindCast(JSON.parse(value.value));
940
+ }
941
+ toDataTypeValue(input) {
942
+ return this.dataTypeValueOf(JSON.stringify(input));
943
+ }
944
+ };
945
+ /**
946
+ * The column stores the document's JSON text and the stored form is that text, so the stored text is projected as it is: a string the enclosing JSON constructor embeds as a string. A blob is projected as the array of its hex text, which the codec refuses, because SQLite's JSON functions refuse a blob.
947
+ */
948
+ var SqliteJsonDescriptor = class extends SqliteCodecDescriptor {
949
+ jsonProjection(expression) {
950
+ return hexJsonProjection(expression);
951
+ }
952
+ dataType = sqliteJson.id;
953
+ codecId = SQLITE_JSON_CODEC_ID;
954
+ jsonType = "any";
955
+ traits = ["equality"];
956
+ paramsSchema = void 0;
957
+ renderValueLiteral(value) {
958
+ return jsonTextLiteral(value);
959
+ }
960
+ factory() {
961
+ return () => new SqliteJsonCodec(this, sqliteJson);
962
+ }
963
+ };
964
+ const sqliteJsonDescriptor = new SqliteJsonDescriptor();
965
+ const sqliteJsonColumn = () => column(sqliteJsonDescriptor.factory(), sqliteJsonDescriptor.codecId, void 0);
966
+ var SqliteBigintCodec = class extends CodecImpl {
967
+ async toWire(value, _ctx) {
968
+ return encodableInt64(SQLITE_BIGINT_CODEC_ID, value);
969
+ }
970
+ /**
971
+ * The driver reads an integer outside the safe range as an exact `bigint` and one inside it as a `number`; an include and a wide aggregate carry decimal text. Anything else, such as a stored REAL, text or a blob, is refused naming its column.
972
+ */
973
+ async fromWire(wire, ctx) {
974
+ if (typeof wire === "bigint") return wire;
975
+ if (typeof wire === "number" && Number.isSafeInteger(wire)) return BigInt(wire);
976
+ if (typeof wire === "string" && DECIMAL_INTEGER.test(wire)) return BigInt(wire);
977
+ return errorBigintUnreadable(wire, ctx);
978
+ }
979
+ fromDataTypeValue(value) {
980
+ return BigInt(value.value);
981
+ }
982
+ toDataTypeValue(input) {
983
+ return this.dataTypeValueOf(bigintEncodeJson(SQLITE_BIGINT_CODEC_ID, input));
984
+ }
985
+ };
986
+ var SqliteBigintDescriptor = class extends SqliteCodecDescriptor {
987
+ jsonProjection(expression) {
988
+ return integerJsonProjection(expression);
989
+ }
990
+ dataType = sqliteInteger.id;
991
+ codecId = SQLITE_BIGINT_CODEC_ID;
992
+ jsonType = "number";
993
+ traits = [
994
+ "equality",
995
+ "order",
996
+ "numeric"
997
+ ];
998
+ paramsSchema = void 0;
999
+ renderValueLiteral(value) {
1000
+ return decimalTextBigintLiteral(value);
1001
+ }
1002
+ factory() {
1003
+ return () => new SqliteBigintCodec(this, sqliteInteger);
1004
+ }
1005
+ };
1006
+ const sqliteBigintDescriptor = new SqliteBigintDescriptor();
1007
+ const sqliteBigintColumn = () => column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, void 0);
1008
+ /**
1009
+ * A SQLite INTEGER decoded as a JS `number`, for columns whose values stay
1010
+ * within the safe integer range ±(2^53 − 1). Both directions guard rather than
1011
+ * round: decode (wire and JSON) and encode throw a structured error on
1012
+ * out-of-range or non-integral input. The canonical JSON is the decimal text
1013
+ * `sqlite/integer` carries, which every codec of that data type shares.
1014
+ */
1015
+ var SqliteBigintNumberCodec = class extends CodecImpl {
1016
+ async toWire(value, _ctx) {
1017
+ return encodableSafeInteger(SQLITE_BIGINT_NUMBER_CODEC_ID, value);
1018
+ }
1019
+ /**
1020
+ * The driver hands an INTEGER over as a `number`, or as a `bigint` outside the safe range; a bigint (or decimal text) is range-checked exactly before any conversion to `number`, so an out-of-range value throws rather than rounds. A blob is refused.
1021
+ */
1022
+ async fromWire(wire, ctx) {
1023
+ return safeIntegerWire(SQLITE_BIGINT_NUMBER_CODEC_ID, wire, ctx);
1024
+ }
1025
+ fromDataTypeValue(value) {
1026
+ return safeIntegerFromDigitText(SQLITE_BIGINT_NUMBER_CODEC_ID, value.value);
1027
+ }
1028
+ toDataTypeValue(input) {
1029
+ return this.dataTypeValueOf(digitTextOfSafeInteger(SQLITE_BIGINT_NUMBER_CODEC_ID, input));
1030
+ }
1031
+ };
1032
+ var SqliteBigintNumberDescriptor = class extends SqliteCodecDescriptor {
1033
+ jsonProjection(expression) {
1034
+ return integerJsonProjection(expression);
1035
+ }
1036
+ dataType = sqliteInteger.id;
1037
+ codecId = SQLITE_BIGINT_NUMBER_CODEC_ID;
1038
+ jsonType = "number";
1039
+ traits = [
1040
+ "equality",
1041
+ "order",
1042
+ "numeric"
1043
+ ];
1044
+ paramsSchema = void 0;
1045
+ renderValueLiteral(value) {
1046
+ return decimalTextNumberLiteral(value);
1047
+ }
1048
+ factory() {
1049
+ return () => new SqliteBigintNumberCodec(this, sqliteInteger);
1050
+ }
1051
+ };
1052
+ const sqliteBigintNumberDescriptor = new SqliteBigintNumberDescriptor();
1053
+ const sqliteBigintNumberColumn = () => column(sqliteBigintNumberDescriptor.factory(), sqliteBigintNumberDescriptor.codecId, void 0);
1054
+ const codecDescriptors = defineSqliteCodecs([
1055
+ sqliteSqlCharDescriptor,
1056
+ sqliteSqlVarcharDescriptor,
1057
+ sqliteSqlIntDescriptor,
1058
+ sqliteSqlFloatDescriptor,
1059
+ sqliteSqlRawDescriptor,
1060
+ sqliteTextDescriptor,
1061
+ sqliteIntegerDescriptor,
1062
+ sqliteRealDescriptor,
1063
+ sqliteBlobDescriptor,
1064
+ sqliteDatetimeDescriptor,
1065
+ sqliteDatetimeTemporalDescriptor,
1066
+ sqliteDatetimeStringDescriptor,
1067
+ sqliteDateStringDescriptor,
1068
+ sqliteDateTemporalDescriptor,
1069
+ sqliteTimeStringDescriptor,
1070
+ sqliteTimeTemporalDescriptor,
1071
+ sqliteDurationStringDescriptor,
1072
+ sqliteJsonDescriptor,
1073
+ sqliteBigintDescriptor,
1074
+ sqliteBigintNumberDescriptor,
1075
+ sqliteDecimalDescriptor,
1076
+ sqliteBooleanDescriptor
1077
+ ]);
1078
+ //#endregion
1079
+ export { sqliteRealColumn as _, sqliteBigintNumberColumn as a, sqliteTimeTemporalColumn as b, sqliteDateStringColumn as c, sqliteDatetimeStringColumn as d, sqliteDatetimeTemporalColumn as f, sqliteJsonColumn as g, sqliteIntegerColumn as h, sqliteBigintColumn as i, sqliteDateTemporalColumn as l, sqliteDurationStringColumn as m, encodeSqliteDatetime as n, sqliteBlobColumn as o, sqliteDecimalColumn as p, jsonDocumentRetag as r, sqliteBooleanColumn as s, codecDescriptors as t, sqliteDatetimeColumn as u, sqliteTextColumn as v, sqliteTimeStringColumn as y };
1080
+
1081
+ //# sourceMappingURL=codecs-izq9l1NG-Bb2RnXsx.mjs.map