viborm 1.14.1 → 1.15.0

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 (274) hide show
  1. package/dist/{adapter-namespace-DaRiTIIf.mjs → adapter-namespace-DD-BQ2Wk.mjs} +2 -2
  2. package/dist/{adapter-namespace-DaRiTIIf.mjs.map → adapter-namespace-DD-BQ2Wk.mjs.map} +1 -1
  3. package/dist/adapters.d.mts +15 -3
  4. package/dist/adapters.mjs +1 -1
  5. package/dist/{args-764KdWMr.mjs → args-BvA37zBZ.mjs} +2 -2
  6. package/dist/{args-764KdWMr.mjs.map → args-BvA37zBZ.mjs.map} +1 -1
  7. package/dist/{batch-refs-C-gx7A4-.mjs → batch-refs-BmEpMmjI.mjs} +2 -2
  8. package/dist/{batch-refs-C-gx7A4-.mjs.map → batch-refs-BmEpMmjI.mjs.map} +1 -1
  9. package/dist/bun-sql.d.mts +1 -1
  10. package/dist/bun-sql.mjs +1 -1
  11. package/dist/bun-sqlite.d.mts +1 -1
  12. package/dist/bun-sqlite.mjs +1 -1
  13. package/dist/cache/cloudflare-kv.d.mts +1 -1
  14. package/dist/cache/cloudflare-kv.mjs +1 -1
  15. package/dist/cache/memory.d.mts +1 -1
  16. package/dist/cache/memory.mjs +1 -1
  17. package/dist/cache.d.mts +2 -2
  18. package/dist/cache.mjs +1 -1
  19. package/dist/{call-Cz8XUmrl.mjs → call-BWFI7-vU.mjs} +2 -2
  20. package/dist/{call-Cz8XUmrl.mjs.map → call-BWFI7-vU.mjs.map} +1 -1
  21. package/dist/cli.mjs +2 -2
  22. package/dist/cli.mjs.map +1 -1
  23. package/dist/client-CVCC-D1j.mjs +2 -0
  24. package/dist/client-CVCC-D1j.mjs.map +1 -0
  25. package/dist/{client-D1shn5AL.d.mts → client-DZ39sYy2.d.mts} +2 -2
  26. package/dist/{client-DzXpmSNi.mjs → client-DtPTegtA.mjs} +3 -3
  27. package/dist/client-DtPTegtA.mjs.map +1 -0
  28. package/dist/client.d.mts +3 -3
  29. package/dist/client.mjs +1 -1
  30. package/dist/config.d.mts +1 -1
  31. package/dist/config.mjs +1 -1
  32. package/dist/{confine-DqFBTUw6.mjs → confine-BGGv2du0.mjs} +2 -2
  33. package/dist/{confine-DqFBTUw6.mjs.map → confine-BGGv2du0.mjs.map} +1 -1
  34. package/dist/{coordination-6qZHx_kl.mjs → coordination-BY6Np3xV.mjs} +2 -2
  35. package/dist/{coordination-6qZHx_kl.mjs.map → coordination-BY6Np3xV.mjs.map} +1 -1
  36. package/dist/d1.d.mts +1 -1
  37. package/dist/d1.mjs +1 -1
  38. package/dist/{database-adapter-BD_htd5h.d.mts → database-adapter-D62c-uC6.d.mts} +605 -474
  39. package/dist/{datetime-physical-codec-Dj-APo9f.mjs → datetime-physical-codec-BS2T81sD.mjs} +2 -2
  40. package/dist/{datetime-physical-codec-Dj-APo9f.mjs.map → datetime-physical-codec-BS2T81sD.mjs.map} +1 -1
  41. package/dist/{defaults-DwOHWI_M.mjs → defaults-CrtGVdEC.mjs} +2 -2
  42. package/dist/{defaults-DwOHWI_M.mjs.map → defaults-CrtGVdEC.mjs.map} +1 -1
  43. package/dist/{document-rMfLKZP5.d.mts → document-o5Bd5ZoJ.d.mts} +1 -1
  44. package/dist/{driver-CH9qAuft.d.mts → driver-0cdCF_KD.d.mts} +1 -1
  45. package/dist/{driver-BGVcgnIX.mjs → driver-D1grnHEr.mjs} +2 -2
  46. package/dist/{driver-BGVcgnIX.mjs.map → driver-D1grnHEr.mjs.map} +1 -1
  47. package/dist/{driver-BIXhOH2_.mjs → driver-Df88hu4U.mjs} +2 -2
  48. package/dist/{driver-BIXhOH2_.mjs.map → driver-Df88hu4U.mjs.map} +1 -1
  49. package/dist/driver.d.mts +1 -1
  50. package/dist/driver.mjs +1 -1
  51. package/dist/durable-object.d.mts +1 -1
  52. package/dist/durable-object.mjs +1 -1
  53. package/dist/error-mapping-DIRlrmDK.mjs +2 -0
  54. package/dist/error-mapping-DIRlrmDK.mjs.map +1 -0
  55. package/dist/every-BHEmfLOW.mjs +2 -0
  56. package/dist/{every-KV5yuSVT.mjs.map → every-BHEmfLOW.mjs.map} +1 -1
  57. package/dist/execution-context-VMQm-9CH.mjs +2 -0
  58. package/dist/execution-context-VMQm-9CH.mjs.map +1 -0
  59. package/dist/{exports-nYDS0SZ7.d.mts → exports-Bzvtum3F.d.mts} +1 -1
  60. package/dist/geo-area-codec-BDvW7IH-.mjs +2 -0
  61. package/dist/{geo-area-codec-mHrM3b9A.mjs.map → geo-area-codec-BDvW7IH-.mjs.map} +1 -1
  62. package/dist/{hydration-A3zffFWP.mjs → hydration-D7U8HACL.mjs} +2 -2
  63. package/dist/{hydration-A3zffFWP.mjs.map → hydration-D7U8HACL.mjs.map} +1 -1
  64. package/dist/{identifier-conversion-DHYPTgzr.mjs → identifier-conversion-Ci_iaJ0b.mjs} +2 -2
  65. package/dist/{identifier-conversion-DHYPTgzr.mjs.map → identifier-conversion-Ci_iaJ0b.mjs.map} +1 -1
  66. package/dist/identifiers-BTCfD5ic.mjs +2 -0
  67. package/dist/identifiers-BTCfD5ic.mjs.map +1 -0
  68. package/dist/index.d.mts +2 -2
  69. package/dist/index.mjs +1 -1
  70. package/dist/instrumentation.d.mts +1 -1
  71. package/dist/instrumentation.mjs +1 -1
  72. package/dist/{introspect-DD_5FEl0.mjs → introspect-C4T5gt9O.mjs} +2 -2
  73. package/dist/{introspect-DD_5FEl0.mjs.map → introspect-C4T5gt9O.mjs.map} +1 -1
  74. package/dist/{json-DgMc8-GU.mjs → json-CHdgejCt.mjs} +2 -2
  75. package/dist/{json-DgMc8-GU.mjs.map → json-CHdgejCt.mjs.map} +1 -1
  76. package/dist/judge-words-DpwxOfre.mjs +2 -0
  77. package/dist/judge-words-DpwxOfre.mjs.map +1 -0
  78. package/dist/{key-hxFFCKed.mjs → key-B3xgpu0M.mjs} +2 -2
  79. package/dist/{key-hxFFCKed.mjs.map → key-B3xgpu0M.mjs.map} +1 -1
  80. package/dist/{keys-BQxM4c_a.mjs → keys-1Z6WKrnE.mjs} +1 -1
  81. package/dist/{keys-BQxM4c_a.mjs.map → keys-1Z6WKrnE.mjs.map} +1 -1
  82. package/dist/{libsql-DuGR904j.mjs → libsql-DJRsCDT_.mjs} +2 -2
  83. package/dist/{libsql-DuGR904j.mjs.map → libsql-DJRsCDT_.mjs.map} +1 -1
  84. package/dist/libsql.d.mts +1 -1
  85. package/dist/libsql.mjs +1 -1
  86. package/dist/{memory-G4cSuc6A.mjs → memory-gjKMy3Ql.mjs} +2 -2
  87. package/dist/{memory-G4cSuc6A.mjs.map → memory-gjKMy3Ql.mjs.map} +1 -1
  88. package/dist/methods-part-DoTrY6b9.mjs +2 -0
  89. package/dist/methods-part-DoTrY6b9.mjs.map +1 -0
  90. package/dist/migrations/mysql.d.mts +4 -4
  91. package/dist/migrations/mysql.mjs +1 -1
  92. package/dist/migrations/postgres.d.mts +4 -4
  93. package/dist/migrations/postgres.mjs +1 -1
  94. package/dist/migrations/snowflake.d.mts +4 -4
  95. package/dist/migrations/snowflake.mjs +1 -1
  96. package/dist/migrations/sqlite.d.mts +4 -4
  97. package/dist/migrations/sqlite.mjs +1 -1
  98. package/dist/migrations/storage/durable-object.mjs +1 -1
  99. package/dist/migrations/storage/r2.mjs +1 -1
  100. package/dist/migrations/surrealdb.d.mts +4 -4
  101. package/dist/migrations/surrealdb.mjs +1 -1
  102. package/dist/migrations/tenant.d.mts +2 -2
  103. package/dist/migrations/tenant.mjs +1 -1
  104. package/dist/migrations.d.mts +4 -4
  105. package/dist/migrations.mjs +1 -1
  106. package/dist/{mysql-BNXWfTOo.mjs → mysql-BH0Z3PlH.mjs} +2 -2
  107. package/dist/{mysql-BNXWfTOo.mjs.map → mysql-BH0Z3PlH.mjs.map} +1 -1
  108. package/dist/mysql-adapter-B06Ve3ds.mjs +2 -0
  109. package/dist/mysql-adapter-B06Ve3ds.mjs.map +1 -0
  110. package/dist/mysql2.d.mts +1 -1
  111. package/dist/mysql2.mjs +1 -1
  112. package/dist/named-statements-Bdz2GD5R.d.mts +13 -0
  113. package/dist/named-statements-CMj1QEyw.mjs +2 -0
  114. package/dist/named-statements-CMj1QEyw.mjs.map +1 -0
  115. package/dist/{native-types-DgjMUikz.mjs → native-types-DspZ0Z5E.mjs} +2 -2
  116. package/dist/{native-types-DgjMUikz.mjs.map → native-types-DspZ0Z5E.mjs.map} +1 -1
  117. package/dist/neon-http.d.mts +1 -1
  118. package/dist/neon-http.mjs +1 -1
  119. package/dist/{object-store-0zc3XYcO.d.mts → object-store-D5x-Yf7w.d.mts} +3 -3
  120. package/dist/{object-store-DS0F0yZX.mjs → object-store-WIE0DGGG.mjs} +1 -1
  121. package/dist/{object-store-DS0F0yZX.mjs.map → object-store-WIE0DGGG.mjs.map} +1 -1
  122. package/dist/{on-ylYaKuRu.mjs → on-DvrfHGje.mjs} +2 -2
  123. package/dist/{on-ylYaKuRu.mjs.map → on-DvrfHGje.mjs.map} +1 -1
  124. package/dist/on.d.mts +1 -1
  125. package/dist/on.mjs +1 -1
  126. package/dist/ordering/keys.mjs +1 -1
  127. package/dist/ordering.d.mts +1 -1
  128. package/dist/ordering.mjs +1 -1
  129. package/dist/pending-operation-Dq4rv-Ml.mjs +2 -0
  130. package/dist/pending-operation-Dq4rv-Ml.mjs.map +1 -0
  131. package/dist/permissions.d.mts +1 -1
  132. package/dist/permissions.mjs +1 -1
  133. package/dist/pg.d.mts +27 -1
  134. package/dist/pg.mjs +1 -1
  135. package/dist/pg.mjs.map +1 -1
  136. package/dist/pglite.d.mts +1 -1
  137. package/dist/pglite.mjs +1 -1
  138. package/dist/{physical-CeE2nYmI.mjs → physical-wboFLAg9.mjs} +2 -2
  139. package/dist/{physical-CeE2nYmI.mjs.map → physical-wboFLAg9.mjs.map} +1 -1
  140. package/dist/planetscale.d.mts +1 -1
  141. package/dist/planetscale.mjs +1 -1
  142. package/dist/{planner-uYQS0hif.d.mts → planner-Ckoxeruk.d.mts} +1 -1
  143. package/dist/{postgres-CDdh5dSP.mjs → postgres-DQ_pO0hi.mjs} +2 -2
  144. package/dist/{postgres-CDdh5dSP.mjs.map → postgres-DQ_pO0hi.mjs.map} +1 -1
  145. package/dist/{postgres-adapter-axapXX8d.mjs → postgres-adapter-Byp7Zpop.mjs} +2 -2
  146. package/dist/{postgres-adapter-axapXX8d.mjs.map → postgres-adapter-Byp7Zpop.mjs.map} +1 -1
  147. package/dist/postgres-adapter-Ia4u0-Ht.mjs +2 -0
  148. package/dist/postgres-adapter-Ia4u0-Ht.mjs.map +1 -0
  149. package/dist/postgres-result-CiS5OWp1.mjs +2 -0
  150. package/dist/postgres-result-CiS5OWp1.mjs.map +1 -0
  151. package/dist/postgres.d.mts +17 -1
  152. package/dist/postgres.mjs +1 -1
  153. package/dist/postgres.mjs.map +1 -1
  154. package/dist/{provider-limits-Ccsb8PTb.mjs → provider-limits-CCOa4d1E.mjs} +2 -2
  155. package/dist/{provider-limits-Ccsb8PTb.mjs.map → provider-limits-CCOa4d1E.mjs.map} +1 -1
  156. package/dist/{provider-parameter-snapshot-BikrgKqI.mjs → provider-parameter-snapshot-C0ehKSAA.mjs} +2 -2
  157. package/dist/{provider-parameter-snapshot-BikrgKqI.mjs.map → provider-parameter-snapshot-C0ehKSAA.mjs.map} +1 -1
  158. package/dist/query-Cdy8E2jM.mjs +2 -0
  159. package/dist/query-Cdy8E2jM.mjs.map +1 -0
  160. package/dist/{query-inspection-BoG-yAln.mjs → query-inspection-C-T2ttRx.mjs} +2 -2
  161. package/dist/{query-inspection-BoG-yAln.mjs.map → query-inspection-C-T2ttRx.mjs.map} +1 -1
  162. package/dist/{raw-Dyq6Y6UX.mjs → raw-uaVIxHcE.mjs} +2 -2
  163. package/dist/{raw-Dyq6Y6UX.mjs.map → raw-uaVIxHcE.mjs.map} +1 -1
  164. package/dist/{relation-bound-ku_cMdye.mjs → relation-bound-BaU-LuuI.mjs} +1 -1
  165. package/dist/{relation-bound-ku_cMdye.mjs.map → relation-bound-BaU-LuuI.mjs.map} +1 -1
  166. package/dist/{rule-words-ZIGm7cDm.mjs → rule-words-C4lXzgW2.mjs} +2 -2
  167. package/dist/{rule-words-ZIGm7cDm.mjs.map → rule-words-C4lXzgW2.mjs.map} +1 -1
  168. package/dist/scalar-B9WizsvR.mjs +4 -0
  169. package/dist/scalar-B9WizsvR.mjs.map +1 -0
  170. package/dist/schema/introspect.d.mts +2 -2
  171. package/dist/schema/introspect.mjs +1 -1
  172. package/dist/schema/json.d.mts +2 -2
  173. package/dist/schema/json.mjs +1 -1
  174. package/dist/{schema-BYA-_bpk.mjs → schema-MB-pPNTO.mjs} +2 -2
  175. package/dist/schema-MB-pPNTO.mjs.map +1 -0
  176. package/dist/{schema-CFIaebgi.mjs → schema-TthAXPVP.mjs} +2 -2
  177. package/dist/{schema-CFIaebgi.mjs.map → schema-TthAXPVP.mjs.map} +1 -1
  178. package/dist/schema-introspection-wMVZowIF.mjs +6 -0
  179. package/dist/schema-introspection-wMVZowIF.mjs.map +1 -0
  180. package/dist/schema.d.mts +1 -1
  181. package/dist/schema.mjs +1 -1
  182. package/dist/select-assembly-SuVxJjps.mjs +2 -0
  183. package/dist/select-assembly-SuVxJjps.mjs.map +1 -0
  184. package/dist/{serializer-rBq3v1xr.mjs → serializer-B2kk7NAR.mjs} +5 -5
  185. package/dist/{serializer-rBq3v1xr.mjs.map → serializer-B2kk7NAR.mjs.map} +1 -1
  186. package/dist/{settled-BjyuA76m.mjs → settled-Dkk5w1vE.mjs} +2 -2
  187. package/dist/{settled-BjyuA76m.mjs.map → settled-Dkk5w1vE.mjs.map} +1 -1
  188. package/dist/{snowflake-UOCC820W.mjs → snowflake-6sBLJi34.mjs} +2 -2
  189. package/dist/{snowflake-UOCC820W.mjs.map → snowflake-6sBLJi34.mjs.map} +1 -1
  190. package/dist/snowflake.d.mts +2 -2
  191. package/dist/snowflake.mjs +1 -1
  192. package/dist/snowflake.mjs.map +1 -1
  193. package/dist/soft-delete.d.mts +1 -1
  194. package/dist/soft-delete.mjs +1 -1
  195. package/dist/{spans-XDUFeTzC.mjs → spans-BE-EjlZK.mjs} +1 -1
  196. package/dist/{spans-XDUFeTzC.mjs.map → spans-BE-EjlZK.mjs.map} +1 -1
  197. package/dist/sql-BGjAsoBE.mjs +2 -0
  198. package/dist/sql-BGjAsoBE.mjs.map +1 -0
  199. package/dist/{sql-Dl6nykFV.mjs → sql-CFxGrk3K.mjs} +2 -2
  200. package/dist/{sql-Dl6nykFV.mjs.map → sql-CFxGrk3K.mjs.map} +1 -1
  201. package/dist/{sql-BVZ8QefY.d.mts → sql-CXtSIPzy.d.mts} +11 -5
  202. package/dist/sql.d.mts +1 -1
  203. package/dist/sql.mjs +1 -1
  204. package/dist/{sqlite-adapter-Ad0d-m2t.mjs → sqlite-adapter-fIbNDvwO.mjs} +2 -2
  205. package/dist/{sqlite-adapter-Ad0d-m2t.mjs.map → sqlite-adapter-fIbNDvwO.mjs.map} +1 -1
  206. package/dist/{sqlite-utils-BRvbmlQ1.mjs → sqlite-utils-DcQct689.mjs} +2 -2
  207. package/dist/{sqlite-utils-BRvbmlQ1.mjs.map → sqlite-utils-DcQct689.mjs.map} +1 -1
  208. package/dist/sqlite3.d.mts +1 -1
  209. package/dist/sqlite3.mjs +1 -1
  210. package/dist/{standard-sql-qLcQyCtK.mjs → standard-sql-Bsf5nrla.mjs} +3 -3
  211. package/dist/standard-sql-Bsf5nrla.mjs.map +1 -0
  212. package/dist/surrealdb.d.mts +2 -2
  213. package/dist/surrealdb.mjs +1 -1
  214. package/dist/surrealdb.mjs.map +1 -1
  215. package/dist/{surrealql-DpipDgMB.mjs → surrealql-DY7sgVnJ.mjs} +2 -2
  216. package/dist/surrealql-DY7sgVnJ.mjs.map +1 -0
  217. package/dist/{to-many-BybuKQM1.mjs → to-many-DiP6cOSQ.mjs} +2 -2
  218. package/dist/{to-many-BybuKQM1.mjs.map → to-many-DiP6cOSQ.mjs.map} +1 -1
  219. package/dist/{unit-BhHbZyuJ.mjs → unit-CSaAB0su.mjs} +2 -2
  220. package/dist/{unit-BhHbZyuJ.mjs.map → unit-CSaAB0su.mjs.map} +1 -1
  221. package/dist/{unit-words-CT0yeqfZ.mjs → unit-words-BGMVZ1MX.mjs} +2 -2
  222. package/dist/{unit-words-CT0yeqfZ.mjs.map → unit-words-BGMVZ1MX.mjs.map} +1 -1
  223. package/dist/{utils-CpAojrCj.mjs → utils-BLlgSQIo.mjs} +2 -2
  224. package/dist/{utils-CpAojrCj.mjs.map → utils-BLlgSQIo.mjs.map} +1 -1
  225. package/dist/validation-D0LG854o.mjs +2 -0
  226. package/dist/validation-D0LG854o.mjs.map +1 -0
  227. package/dist/validation.d.mts +1 -1
  228. package/dist/validation.mjs +1 -1
  229. package/dist/{validator-CZLW7aR3.mjs → validator-CDYlO9HV.mjs} +2 -2
  230. package/dist/{validator-CZLW7aR3.mjs.map → validator-CDYlO9HV.mjs.map} +1 -1
  231. package/dist/{values-B4aj1i1f.mjs → values-Byqn5wAh.mjs} +2 -2
  232. package/dist/{values-B4aj1i1f.mjs.map → values-Byqn5wAh.mjs.map} +1 -1
  233. package/dist/version-B_ZLWzLW.mjs +2 -0
  234. package/dist/{version-DRfmNoR1.mjs.map → version-B_ZLWzLW.mjs.map} +1 -1
  235. package/package.json +35 -35
  236. package/dist/client-DRpX3-vw.mjs +0 -2
  237. package/dist/client-DRpX3-vw.mjs.map +0 -1
  238. package/dist/client-DzXpmSNi.mjs.map +0 -1
  239. package/dist/error-mapping-B1-IWkCQ.mjs +0 -2
  240. package/dist/error-mapping-B1-IWkCQ.mjs.map +0 -1
  241. package/dist/every-KV5yuSVT.mjs +0 -2
  242. package/dist/execution-context-BXpcbyPe.mjs +0 -2
  243. package/dist/execution-context-BXpcbyPe.mjs.map +0 -1
  244. package/dist/geo-area-codec-mHrM3b9A.mjs +0 -2
  245. package/dist/identifiers-s00pGES8.mjs +0 -2
  246. package/dist/identifiers-s00pGES8.mjs.map +0 -1
  247. package/dist/judge-words-CzUyXtJ6.mjs +0 -2
  248. package/dist/judge-words-CzUyXtJ6.mjs.map +0 -1
  249. package/dist/methods-part-ZY0f2AV_.mjs +0 -2
  250. package/dist/methods-part-ZY0f2AV_.mjs.map +0 -1
  251. package/dist/mysql-adapter-C69j1sKh.mjs +0 -2
  252. package/dist/mysql-adapter-C69j1sKh.mjs.map +0 -1
  253. package/dist/pending-operation-C_eOFOBE.mjs +0 -2
  254. package/dist/pending-operation-C_eOFOBE.mjs.map +0 -1
  255. package/dist/postgres-adapter-Dlr3ZWd7.mjs +0 -2
  256. package/dist/postgres-adapter-Dlr3ZWd7.mjs.map +0 -1
  257. package/dist/postgres-result-DF6DmW3r.mjs +0 -2
  258. package/dist/postgres-result-DF6DmW3r.mjs.map +0 -1
  259. package/dist/query-BZVHfA0s.mjs +0 -2
  260. package/dist/query-BZVHfA0s.mjs.map +0 -1
  261. package/dist/scalar-BHCh7aUz.mjs +0 -4
  262. package/dist/scalar-BHCh7aUz.mjs.map +0 -1
  263. package/dist/schema-BYA-_bpk.mjs.map +0 -1
  264. package/dist/schema-introspection-D0f8cti4.mjs +0 -6
  265. package/dist/schema-introspection-D0f8cti4.mjs.map +0 -1
  266. package/dist/select-assembly-DVI7d3tf.mjs +0 -2
  267. package/dist/select-assembly-DVI7d3tf.mjs.map +0 -1
  268. package/dist/sql-3o4DOKm9.mjs +0 -2
  269. package/dist/sql-3o4DOKm9.mjs.map +0 -1
  270. package/dist/standard-sql-qLcQyCtK.mjs.map +0 -1
  271. package/dist/surrealql-DpipDgMB.mjs.map +0 -1
  272. package/dist/validation-CYaJ8ndO.mjs +0 -2
  273. package/dist/validation-CYaJ8ndO.mjs.map +0 -1
  274. package/dist/version-DRfmNoR1.mjs +0 -2
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli/commands/check.ts","../src/cli/commands/migrate.ts","../src/cli/commands/pull.ts","../src/cli/commands/push.ts","../src/cli/index.ts"],"sourcesContent":["/**\n * Schema check CLI.\n *\n * Runs every check a client runs when it is created (identifiers, model\n * identity, relation resolution, selector names), plus the advisory rules,\n * against the schema of the configured client. Run it in a build or CI step to\n * create clients with `skipSchemaValidation: true` at runtime.\n */\n\nimport { Command } from \"commander\";\nimport {\n auditStorage,\n type StorageColumnAudit,\n} from \"../../migrations/sqlite-storage-audit\";\nimport { hydrateSchemaNames } from \"../../schema/hydration\";\nimport type { SchemaValidationIssue } from \"../../schema/validation/types\";\nimport { validateSchema } from \"../../schema/validation/validator\";\nimport { runCli } from \"../utils\";\n\ninterface CheckCliOptions {\n readonly config?: string;\n readonly json?: boolean;\n readonly db?: boolean;\n}\n\nconst needsRepair = (audit: StorageColumnAudit): boolean =>\n audit.type === \"decimal\" ? !audit.checked : audit.noncanonical !== 0;\n\nconst describeAudit = (audit: StorageColumnAudit): string => {\n const column = `[storage] \"${audit.table}\".\"${audit.column}\"`;\n if ((audit.type === \"decimal\" ? audit.declared : audit.noncanonical) === null)\n return `${column}: the column is missing; typed queries that use it fail.\\n Create it through viborm push or migrate.`;\n if (audit.type === \"decimal\")\n return `${column}: declared ${audit.declared}, not the checked scaled-integer decimal storage VibORM writes; typed reads, filters and writes are not checked against it.\\n Adopt the table through viborm push, migrate or baseline: https://viborm.dev/docs/migration/drivers/sqlite#adopting-decimal-columns-from-another-tool`;\n const kind = audit.type === \"time\" ? \"Time\" : \"DateTime\";\n const repair = audit.list\n ? \"Rewrite each row through the typed client (`update`), which stores canonical members\"\n : `Repair with sqliteCanonical${kind}Expression from viborm/migrations`;\n return `${column}: ${audit.noncanonical} row(s) of noncanonical ${kind} text compare and sort wrongly.\\n ${repair}: https://viborm.dev/docs/migration/drivers/sqlite#repairing-foreign-timestamp-and-time-text`;\n};\n\n// The repair hint, when the issue has one, goes on its own indented line.\nconst describe = (issue: SchemaValidationIssue): string =>\n [`[${issue.code}] ${issue.message}`, issue.repair]\n .filter(Boolean)\n .join(\"\\n \");\n\nasync function runCheck(options: CheckCliOptions): Promise<void> {\n const load = { config: options.config, skipValidation: true };\n await runCli(load, options.json, async (config) => {\n const { models } = config;\n // The identifier and identity checks hydration runs, whatever the\n // configured client skipped.\n hydrateSchemaNames(models);\n const result = validateSchema(models);\n const storage = options.db\n ? await auditStorage({ $driver: config.driver, $schema: models })\n : undefined;\n const dirty = storage?.filter(needsRepair) ?? [];\n if (options.json) {\n process.stdout.write(\n `${JSON.stringify(storage ? { ...result, storage } : result, null, 2)}\\n`\n );\n } else {\n for (const issue of result.errors)\n process.stderr.write(`error ${describe(issue)}\\n`);\n for (const issue of result.warnings)\n process.stderr.write(`warning ${describe(issue)}\\n`);\n for (const audit of dirty)\n process.stderr.write(`error ${describeAudit(audit)}\\n`);\n process.stdout.write(\n result.valid\n ? `Schema valid (${Object.keys(models).length} models).\\n`\n : `Schema invalid: ${result.errors.length} error(s).\\n`\n );\n if (storage)\n process.stdout.write(\n `Storage audited: ${storage.length} column(s), ${dirty.length} need repair.\\n`\n );\n }\n if (!result.valid || dirty.length > 0) process.exitCode = 1;\n });\n}\n\nexport function createCheckCommand(): Command {\n return new Command(\"check\")\n .description(\n \"Validate the schema, so clients can be created with skipSchemaValidation\"\n )\n .option(\"--config <path>\", \"Path to viborm.config.ts\")\n .option(\"--json\", \"Print machine-readable JSON\")\n .option(\n \"--db\",\n \"Also audit SQLite storage: DateTime/Time text and decimal columns\"\n )\n .action(runCheck);\n}\n\nexport const checkCommand = createCheckCommand();\n","/**\n * Migration CLI. Composition root is createMigrationClient + loadConfig.\n */\n\nimport { writeFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { confirm, isCancel } from \"@clack/prompts\";\nimport { Command, InvalidArgumentError } from \"commander\";\nimport {\n createMigrationClient,\n type WritableMigrations,\n} from \"../../migrations/client\";\nimport { loadMigrationGraph } from \"../../migrations/graph\";\nimport { isSha256 } from \"../../migrations/identity\";\nimport { renderMigrationReview } from \"../../migrations/public-view\";\nimport { formatOperation } from \"../../migrations/push/format\";\nimport type { MigrationStorageWriter } from \"../../migrations/storage/contract\";\nimport { createFsStorageWriter } from \"../../migrations/storage/fs-estate\";\nimport type { ResolveCallback } from \"../../migrations/types\";\nimport type {\n ManualMigrationInput,\n StateSelector,\n} from \"../../migrations/v1-types\";\nimport { type LoadedConfig, loadCliModule, printJson, runCli } from \"../utils\";\n\nconst STATE_ID_PREFIX = /^[0-9a-f]{8,63}$/;\n\nfunction positiveInteger(value: string): number {\n const parsed = Number(value);\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new InvalidArgumentError(\"must be a positive safe integer\");\n }\n return parsed;\n}\n\nfunction selector(value: string | undefined): StateSelector | undefined {\n if (!value) return undefined;\n if (isSha256(value)) return { id: value };\n if (STATE_ID_PREFIX.test(value)) return { prefix: value };\n return { name: value };\n}\n\n/** `--accept-data-loss`: every destructive change approved, nothing else decided. */\nconst approveDestructive: ResolveCallback = (change) =>\n change.type === \"destructive\" ? change.proceed() : undefined;\n\n/** One prompt per destructive change, as `viborm push` asks for its plan. */\nconst confirmDestructive: ResolveCallback = async (change) => {\n if (change.type !== \"destructive\") return;\n const approved = await confirm({\n message: `${change.description} — approve?`,\n initialValue: false,\n });\n return !isCancel(approved) && approved ? change.proceed() : change.reject();\n};\n\n/**\n * The resolver `migrate generate` publishes under, and `migrate down` rolls\n * back under: the config's own, else\n * `--accept-data-loss`, else a prompt on an interactive terminal. With none,\n * generate refuses a destructive change with `V11017`.\n */\nfunction generateResolver(\n config: LoadedConfig,\n opts: { acceptDataLoss?: boolean; dryRun?: boolean; json?: boolean }\n): ResolveCallback | undefined {\n if (config.migrations?.resolve) return config.migrations.resolve;\n if (opts.acceptDataLoss) return approveDestructive;\n if (opts.dryRun || opts.json || !process.stdin.isTTY) return;\n return confirmDestructive;\n}\n\n/** Each subcommand reads the parent's `--config` and its own `--dir`. */\nasync function withMigrations(\n migrate: Command,\n options: { dir?: string; json?: boolean },\n run: (\n migrations: WritableMigrations,\n config: LoadedConfig,\n storage: MigrationStorageWriter\n ) => Promise<void>\n): Promise<void> {\n await runCli(\n { config: migrate.opts<{ config?: string }>().config },\n options.json,\n async (config) => {\n const directory = resolve(\n options.dir ?? config.migrations?.dir ?? \"./migrations\"\n );\n const storage =\n config.migrations?.storage ?? createFsStorageWriter(directory);\n const migrations = createMigrationClient(config.client, {\n storage,\n ...(config.migrations?.tables === undefined\n ? {}\n : { tables: config.migrations.tables }),\n });\n await run(migrations, config, storage);\n }\n );\n}\n\nexport function createMigrateCommand(): Command {\n const migrate = new Command(\"migrate\")\n .description(\"Manage the authenticated migration estate\")\n .option(\"--config <path>\", \"Path to viborm.config.ts\");\n\n migrate\n .command(\"generate\")\n .description(\"Publish a new estate state from the current schema\")\n .option(\"-n, --name <name>\", \"Human-readable state label\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\n \"--from <stateId>\",\n \"Parent state id, or empty for the virtual root\"\n )\n .option(\"--custom <path>\", \"Compile a TypeScript manual migration author\")\n .option(\n \"--review <path>\",\n \"Write labelled forward/check/rollback review SQL\"\n )\n .option(\"--dry-run\", \"Preview without publishing\")\n .option(\n \"--low-lock\",\n \"PostgreSQL: publish index builds and foreign keys on existing tables as recoverable steps\"\n )\n .option(\n \"--accept-data-loss\",\n \"Approve destructive changes (drops, type changes) for this generate\"\n )\n .option(\n \"--adopt <table...>\",\n \"Adopt existing listed tables without DDL; apply proves each equals its declaration\"\n )\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n adopt?: string[];\n name?: string;\n dir?: string;\n from?: string;\n dryRun?: boolean;\n lowLock?: boolean;\n acceptDataLoss?: boolean;\n custom?: string;\n review?: string;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations, config) => {\n const from =\n opts.from === undefined\n ? undefined\n : opts.from === \"\" || opts.from === \"empty\"\n ? null\n : isSha256(opts.from)\n ? opts.from\n : (await migrations.show(selector(opts.from)!)).stateId;\n let manualMigration: ManualMigrationInput | undefined;\n if (opts.custom) {\n type Author =\n | ManualMigrationInput\n | ((\n parents: readonly (string | null)[]\n ) => ManualMigrationInput | Promise<ManualMigrationInput>);\n const module = await loadCliModule<{\n default?: Author;\n migration?: Author;\n }>(resolve(opts.custom));\n const author =\n (Object.hasOwn(module, \"default\") ? module.default : undefined) ??\n module.migration;\n if (!author)\n throw new Error(\n \"A custom migration module must export a default migration or author function\"\n );\n const graph = await migrations.graph();\n const parents = Object.freeze(\n from === undefined\n ? graph.leaves.length === 0\n ? [null]\n : [...graph.leaves]\n : [from]\n );\n manualMigration =\n typeof author === \"function\" ? await author(parents) : author;\n }\n const approve = generateResolver(config, opts);\n const result = await migrations.generate({\n name: opts.name,\n from,\n dryRun: opts.dryRun,\n ...(opts.lowLock ? { lowLock: true } : {}),\n ...(opts.adopt ? { adopt: opts.adopt } : {}),\n ...(approve ? { resolve: approve } : {}),\n ...(manualMigration ? { manualMigration } : {}),\n });\n if (opts.json) printJson(result, true);\n else {\n process.stdout.write(\n `${result.outcome}: ${result.name ?? \"No schema changes\"}${result.stateId ? ` (${result.stateId})` : \"\"}\\n`\n );\n for (const parent of result.operationsByParent ?? []) {\n process.stdout.write(\n `Parent ${parent.fromState ?? \"empty\"}:\\n${parent.operations.map(formatOperation).join(\"\\n\")}\\n`\n );\n }\n for (const warning of result.warnings ?? [])\n process.stderr.write(`warning: ${warning}\\n`);\n if (result.reviewSql || result.sql)\n process.stdout.write(`${result.reviewSql || result.sql}\\n`);\n }\n if (opts.review && result.reviewSql)\n await writeFile(resolve(opts.review), result.reviewSql, \"utf8\");\n });\n }\n );\n\n migrate\n .command(\"check\")\n .description(\"Validate estate artifacts without touching the database\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n const result = await migrations.check();\n printJson(result, Boolean(opts.json));\n if (!result.ok) process.exitCode = 1;\n });\n });\n\n migrate\n .command(\"list\")\n .description(\"List estate states\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(await migrations.list(), Boolean(opts.json));\n });\n });\n\n migrate\n .command(\"show\")\n .description(\"Show one estate state\")\n .argument(\"<state>\", \"State id, unambiguous prefix, or name\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--sql\", \"Print labelled forward/check/rollback review SQL\")\n .option(\"--review <path>\", \"Write review SQL to this file\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (\n state: string,\n opts: { dir?: string; sql?: boolean; review?: string; json?: boolean }\n ) => {\n await withMigrations(\n migrate,\n opts,\n async (migrations, _config, storage) => {\n const details = await migrations.show(selector(state)!);\n if (!(opts.sql || opts.review)) {\n printJson(details, Boolean(opts.json));\n return;\n }\n const graph = await loadMigrationGraph(storage);\n const manifest = graph.states.get(details.stateId);\n const blob = manifest && graph.sql.get(manifest.sqlHash);\n if (!(manifest && blob))\n throw new Error(\"The authenticated state SQL is unavailable\");\n const reviewSql = renderMigrationReview(\n manifest.parents,\n manifest.destinationChecks,\n blob\n );\n if (opts.json) printJson({ ...details, reviewSql }, true);\n else {\n printJson(details, false);\n process.stdout.write(reviewSql);\n }\n if (opts.review)\n await writeFile(resolve(opts.review), reviewSql, \"utf8\");\n }\n );\n }\n );\n\n migrate\n .command(\"graph\")\n .description(\"Print estate roots and leaves\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(await migrations.graph(), Boolean(opts.json));\n });\n });\n\n migrate\n .command(\"status\")\n .description(\"Show marker, pending path, and unfinished attempts\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(await migrations.status(), Boolean(opts.json));\n });\n });\n\n migrate\n .command(\"verify\")\n .description(\"Lock and compare the live schema to the marker\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n const result = await migrations.verify();\n printJson(result, Boolean(opts.json));\n if (!result.ok) process.exitCode = 1;\n });\n });\n\n migrate\n .command(\"log\")\n .description(\"Print the append-only ledger\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--limit <n>\", \"Maximum events\", positiveInteger)\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; limit?: number; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n const events = await migrations.log();\n printJson(\n opts.limit ? events.slice(-opts.limit) : events,\n Boolean(opts.json)\n );\n });\n });\n\n migrate\n .command(\"apply\")\n .description(\"Apply estate states to the target\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--to <selector>\", \"Target state id, prefix, or name\")\n .option(\"--via <stateId...>\", \"Force a path through these states\")\n .option(\"--dry-run\", \"Plan without executing\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n dir?: string;\n to?: string;\n via?: string[];\n dryRun?: boolean;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(\n await migrations.apply({\n to: selector(opts.to),\n via: opts.via,\n dryRun: opts.dryRun,\n }),\n Boolean(opts.json)\n );\n });\n }\n );\n\n migrate\n .command(\"down\")\n .description(\"Roll back along the recorded arrival path\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--to <selector>\", \"Roll back to this state\")\n .option(\"--steps <n>\", \"Number of states to roll back\", positiveInteger)\n .option(\n \"--accept-data-loss\",\n \"Approve destructive changes the rollback makes to populated tables\"\n )\n .option(\n \"--expect-revision <n>\",\n \"Refuse unless the marker is at this revision\",\n positiveInteger\n )\n .option(\"--dry-run\", \"Plan without executing\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n dir?: string;\n to?: string;\n steps?: number;\n acceptDataLoss?: boolean;\n expectRevision?: number;\n dryRun?: boolean;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations, config) => {\n if (opts.to !== undefined && opts.steps !== undefined)\n throw new Error(\"down accepts --to or --steps, not both\");\n const approve = generateResolver(config, opts);\n const common = {\n dryRun: opts.dryRun,\n ...(approve ? { resolve: approve } : {}),\n ...(opts.expectRevision === undefined\n ? {}\n : { expectRevision: opts.expectRevision }),\n };\n const result = await migrations.down(\n opts.to\n ? { to: selector(opts.to)!, ...common }\n : { steps: opts.steps, ...common }\n );\n if (!result.preview || opts.json) {\n printJson(result, Boolean(opts.json));\n } else {\n for (const edge of result.edges) process.stdout.write(edge.sql);\n if (result.refusal) {\n process.stderr.write(\n `down would refuse: ${result.refusal.code}: ${result.refusal.message}\\n`\n );\n }\n }\n // The preview fails where `down` would fail.\n if (result.preview && result.refusal) process.exitCode = 1;\n });\n }\n );\n\n migrate\n .command(\"baseline\")\n .description(\"Adopt an existing database as a known estate state\")\n .requiredOption(\"--to <selector>\", \"Existing estate state to adopt\")\n .option(\"--via <stateId...>\", \"Force the recorded root path\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n to: string;\n via?: string[];\n dir?: string;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(\n await migrations.baseline({\n to: selector(opts.to)!,\n via: opts.via,\n }),\n Boolean(opts.json)\n );\n });\n }\n );\n\n migrate\n .command(\"reanchor\")\n .description(\n \"After a restore left the history older than the database, move the marker to the state the live schema matches\"\n )\n .option(\"--to <selector>\", \"Adopt this state as the new baseline\")\n .option(\"--via <stateId...>\", \"Force the recorded root path\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n to?: string;\n via?: string[];\n dir?: string;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(\n await migrations.reanchor({\n to: selector(opts.to),\n via: opts.via,\n }),\n Boolean(opts.json)\n );\n });\n }\n );\n\n migrate\n .command(\"resolve\")\n .description(\"Resolve an unfinished attempt after live proof\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--complete\", \"Mark complete when destination proof holds\")\n .option(\"--rolled-back\", \"Mark rolled back when origin proof holds\")\n .option(\"--retry\", \"Retry from the first proven incomplete step\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n dir?: string;\n complete?: boolean;\n rolledBack?: boolean;\n retry?: boolean;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n if (\n [opts.complete, opts.rolledBack, opts.retry].filter(Boolean)\n .length !== 1\n )\n throw new Error(\n \"resolve requires exactly one of --complete, --rolled-back, or --retry\"\n );\n const outcome = opts.complete\n ? \"complete\"\n : opts.rolledBack\n ? \"rolled-back\"\n : \"retry\";\n printJson(await migrations.resolve({ outcome }), Boolean(opts.json));\n });\n }\n );\n\n migrate\n .command(\"reset\")\n .description(\n \"Clear managed objects and replay from empty to a selected state\"\n )\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--to <selector>\", \"Target state after rebuild\")\n .option(\"--via <stateId...>\", \"Force a rebuild path\")\n .option(\"--confirm\", \"Confirm destructive reset (not required for dry-run)\")\n .option(\"--dry-run\", \"Plan without executing\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n dir?: string;\n to?: string;\n via?: string[];\n confirm?: boolean;\n dryRun?: boolean;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n if (!(opts.dryRun || opts.confirm))\n throw new Error(\n \"Reset requires --confirm; inspect --dry-run first\"\n );\n printJson(\n await migrations.reset({\n to: selector(opts.to),\n via: opts.via,\n dryRun: opts.dryRun,\n }),\n Boolean(opts.json)\n );\n });\n }\n );\n\n return migrate;\n}\n\nexport const migrateCommand = createMigrateCommand();\n","/**\n * `viborm pull --json`: an existing database → a schema document.\n *\n * The connection string is `--url`, else `DATABASE_URL` (read from `.env` like\n * every command). The document goes to `--out`, else to stdout, in canonical\n * form; what it does not carry, and where a push of it would change the\n * database, goes to stderr, so stdout stays a document a pipe can parse.\n *\n * `--json` is the only output today. A TypeScript schema will be written from\n * the same document, so the flag names the format rather than defaulting it.\n *\n * `--light` writes a light document (`introspectSchema({ light: true })`): what\n * a client needs, without indexes, which every migration path refuses.\n */\n\nimport { existsSync, writeFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { loadEnvFile } from \"node:process\";\nimport { Command } from \"commander\";\nimport { introspectSchema } from \"../../migrations/introspect\";\nimport type {\n IntrospectionWarning,\n SkippedObject,\n} from \"../../migrations/introspect/types\";\nimport { failCli } from \"../utils\";\n\ninterface PullCliOptions {\n readonly url?: string;\n readonly json?: boolean;\n readonly out?: string;\n readonly tables?: readonly string[];\n readonly light?: boolean;\n}\n\nfunction located(item: {\n table?: string | undefined;\n name?: string | undefined;\n}) {\n return [item.table, item.name].filter(Boolean).join(\".\");\n}\n\n/** The report a human reads beside the document. */\nexport function formatPullReport(\n skipped: readonly SkippedObject[],\n warnings: readonly IntrospectionWarning[]\n): string {\n const lines: string[] = [];\n if (skipped.length > 0) {\n lines.push(`Not in the document (${skipped.length}):`);\n for (const item of skipped)\n lines.push(` - ${item.kind} ${located(item)}: ${item.reason}`);\n }\n if (warnings.length > 0) {\n lines.push(`Warnings (${warnings.length}):`);\n for (const warning of warnings)\n lines.push(\n ` - [${warning.kind}] ${located(warning)}: ${warning.message}`\n );\n }\n return lines.length === 0\n ? \"The document states the whole database; a push of it plans nothing.\\n\"\n : `${lines.join(\"\\n\")}\\n`;\n}\n\nasync function runPull(options: PullCliOptions): Promise<void> {\n try {\n if (!options.json)\n throw new Error(\n \"viborm pull writes a JSON schema document: pass --json. A TypeScript schema is not generated yet.\"\n );\n const envPath = resolve(process.cwd(), \".env\");\n if (existsSync(envPath)) loadEnvFile(envPath);\n const url = options.url ?? process.env.DATABASE_URL;\n if (!url)\n throw new Error(\n \"viborm pull needs a connection string: pass --url or set DATABASE_URL.\"\n );\n const result = await introspectSchema({\n url,\n ...(options.tables === undefined ? {} : { tables: options.tables }),\n ...(options.light ? { light: true } : {}),\n });\n const text = `${JSON.stringify(result.document, null, 2)}\\n`;\n if (options.out === undefined) process.stdout.write(text);\n else writeFileSync(resolve(process.cwd(), options.out), text);\n process.stderr.write(formatPullReport(result.skipped, result.warnings));\n } catch (error) {\n failCli(error, options.json === true);\n }\n}\n\nexport function createPullCommand(): Command {\n return new Command(\"pull\")\n .description(\n \"Read an existing database into a schema document (viborm/schema/json)\"\n )\n .option(\"--json\", \"Write the JSON schema document\")\n .option(\n \"--url <url>\",\n \"Connection string (postgres://, mysql://, file:, libsql://); defaults to DATABASE_URL\"\n )\n .option(\"--out <path>\", \"Write the document to this file instead of stdout\")\n .option(\n \"--light\",\n \"Only what a client needs (no indexes); migrations refuse the document\"\n )\n .option(\n \"--tables <names...>\",\n \"Only these tables (exact physical names, space- or comma-separated)\",\n (value: string, previous: string[] | undefined) => [\n ...(previous ?? []),\n ...value\n .split(\",\")\n .map((name) => name.trim())\n .filter(Boolean),\n ]\n )\n .action(runPull);\n}\n\nexport const pullCommand = createPullCommand();\n","/**\n * History-free, authenticated schema push CLI.\n *\n * The preview is inert. Effectful execution receives only the consent emitted\n * by that preview; no generic force authorization reaches the apply call.\n */\n\nimport { cancel, confirm, isCancel, note, outro } from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { createMigrationClient } from \"../../migrations/client\";\nimport type { PushPreview } from \"../../migrations/push-v1\";\nimport { printJson, runCli } from \"../utils\";\n\ninterface PushCliOptions {\n readonly config?: string;\n readonly dryRun?: boolean;\n readonly forceReset?: boolean;\n readonly yes?: boolean;\n readonly acceptDataLoss?: boolean;\n readonly json?: boolean;\n}\n\nfunction printPlan(preview: PushPreview): void {\n const operations =\n preview.operations.length === 0\n ? [\"No schema changes.\"]\n : preview.operations.map(\n (operation) =>\n `[${operation.risk}] ${operation.label} (${operation.id})`\n );\n const statements = preview.statements.map(\n (statement, index) =>\n `${index + 1}. ${statement.sql}${\n statement.parameters.length === 0\n ? \"\"\n : `\\n parameters: ${JSON.stringify(statement.parameters)}`\n }`\n );\n const lines = [\n `Target: ${JSON.stringify(preview.target)}`,\n `Plan: ${preview.planHash}`,\n ...operations,\n ...(statements.length === 0 ? [] : [\"\", \"SQL:\", ...statements]),\n ];\n note(lines.join(\"\\n\"), \"Push plan\");\n}\n\nasync function runPush(options: PushCliOptions): Promise<void> {\n await runCli({ config: options.config }, options.json, async (config) => {\n const migrations =\n config.migrations?.tables === undefined\n ? createMigrationClient(config.client)\n : createMigrationClient(config.client, {\n tables: config.migrations.tables,\n });\n // `force` is confined to the inert planning arm. The authenticated apply\n // arm below receives only the consent bound to this exact preview.\n const preview = await migrations.push({\n dryRun: true,\n ...(options.forceReset === true ? { forceReset: true } : {}),\n ...(config.migrations?.resolve\n ? { resolve: config.migrations.resolve }\n : {}),\n });\n\n if (\n !options.json &&\n config.driver?.dialect === \"sqlite\" &&\n [\"sqlite3\", \"bun-sqlite\", \"bun-sql\"].includes(config.driver.driverName)\n ) {\n const databases = await config.driver._executeRaw<{\n name: string;\n file: string;\n }>(\"PRAGMA database_list\");\n if (\n databases.rows.some(\n (database) => database.name === \"main\" && database.file === \"\"\n )\n )\n process.stderr.write(\n \"warning: SQLite reports an in-memory main database. Use a persistent target for durable schema changes.\\n\"\n );\n }\n\n if (options.dryRun) {\n if (options.json) printJson(preview, true);\n else printPlan(preview);\n return;\n }\n\n if (!options.json) printPlan(preview);\n\n if (\n preview.destructive &&\n !options.acceptDataLoss &&\n (options.yes || options.json || !process.stdin.isTTY)\n ) {\n throw new Error(\n \"Destructive push requires --accept-data-loss; --yes does not authorize data loss. Inspect --dry-run first.\"\n );\n }\n if (\n preview.outcome !== \"noop\" &&\n !options.yes &&\n !options.acceptDataLoss &&\n !options.json &&\n process.stdin.isTTY\n ) {\n const accepted = await confirm({\n message: preview.destructive\n ? \"Apply this destructive push plan?\"\n : \"Apply this push plan?\",\n initialValue: !preview.destructive,\n });\n if (isCancel(accepted) || !accepted) {\n cancel(\"Push cancelled.\");\n return;\n }\n }\n\n const result = await migrations.push({ consent: preview.consent });\n if (options.json) printJson(result, true);\n else\n outro(\n result.outcome === \"noop\" ? \"Schema is up to date.\" : \"Push applied.\"\n );\n });\n}\n\nexport function createPushCommand(): Command {\n return new Command(\"push\")\n .description(\"Synchronize the schema directly without migration history\")\n .option(\"--config <path>\", \"Path to viborm.config.ts\")\n .option(\"--dry-run\", \"Preview without changing the database\")\n .option(\"--force-reset\", \"Plan a rebuild from an empty database\")\n .option(\"-y, --yes\", \"Skip prompts for non-destructive plans\")\n .option(\n \"--accept-data-loss\",\n \"Explicitly accept the previewed destructive plan\"\n )\n .option(\"--json\", \"Print machine-readable JSON\")\n .action(runPush);\n}\n\nexport const pushCommand = createPushCommand();\n","#!/usr/bin/env node\n/**\n * VibORM CLI\n *\n * Command-line interface for VibORM database operations.\n */\n\nimport { Command } from \"commander\";\nimport { registerEveryMigrationDriver } from \"../migrations/dialects/every\";\nimport { VIBORM_VERSION } from \"../version\";\nimport { checkCommand } from \"./commands/check\";\nimport { migrateCommand } from \"./commands/migrate\";\nimport { pullCommand } from \"./commands/pull\";\nimport { pushCommand } from \"./commands/push\";\n\nregisterEveryMigrationDriver();\n\nconst program = new Command();\n\nprogram\n .name(\"viborm\")\n .description(\"VibORM - Type-safe ORM for PostgreSQL, MySQL and SQLite\")\n .version(VIBORM_VERSION);\n\n// Register commands\nprogram.addCommand(checkCommand);\nprogram.addCommand(pushCommand);\nprogram.addCommand(migrateCommand);\nprogram.addCommand(pullCommand);\n\n// Parse arguments\ntry {\n await program.parseAsync();\n} catch (error: unknown) {\n process.stderr.write(\n `${error instanceof Error ? error.message : \"CLI failed\"}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rate.ts","../src/cli/commands/pull.ts","../src/cli/commands/push.ts","../src/cli/index.ts"],"sourcesContent":["/**\n * Schema check CLI.\n *\n * Runs every check a client runs when it is created (identifiers, model\n * identity, relation resolution, selector names), plus the advisory rules,\n * against the schema of the configured client. Run it in a build or CI step to\n * create clients with `skipSchemaValidation: true` at runtime.\n */\n\nimport { Command } from \"commander\";\nimport {\n auditStorage,\n type StorageColumnAudit,\n} from \"../../migrations/sqlite-storage-audit\";\nimport { hydrateSchemaNames } from \"../../schema/hydration\";\nimport type { SchemaValidationIssue } from \"../../schema/validation/types\";\nimport { validateSchema } from \"../../schema/validation/validator\";\nimport { runCli } from \"../utils\";\n\ninterface CheckCliOptions {\n readonly config?: string;\n readonly json?: boolean;\n readonly db?: boolean;\n}\n\nconst needsRepair = (audit: StorageColumnAudit): boolean =>\n audit.type === \"decimal\" ? !audit.checked : audit.noncanonical !== 0;\n\nconst describeAudit = (audit: StorageColumnAudit): string => {\n const column = `[storage] \"${audit.table}\".\"${audit.column}\"`;\n if ((audit.type === \"decimal\" ? audit.declared : audit.noncanonical) === null)\n return `${column}: the column is missing; typed queries that use it fail.\\n Create it through viborm push or migrate.`;\n if (audit.type === \"decimal\")\n return `${column}: declared ${audit.declared}, not the checked scaled-integer decimal storage VibORM writes; typed reads, filters and writes are not checked against it.\\n Adopt the table through viborm push, migrate or baseline: https://viborm.dev/docs/migration/drivers/sqlite#adopting-decimal-columns-from-another-tool`;\n const kind = audit.type === \"time\" ? \"Time\" : \"DateTime\";\n const repair = audit.list\n ? \"Rewrite each row through the typed client (`update`), which stores canonical members\"\n : `Repair with sqliteCanonical${kind}Expression from viborm/migrations`;\n return `${column}: ${audit.noncanonical} row(s) of noncanonical ${kind} text compare and sort wrongly.\\n ${repair}: https://viborm.dev/docs/migration/drivers/sqlite#repairing-foreign-timestamp-and-time-text`;\n};\n\n// The repair hint, when the issue has one, goes on its own indented line.\nconst describe = (issue: SchemaValidationIssue): string =>\n [`[${issue.code}] ${issue.message}`, issue.repair]\n .filter(Boolean)\n .join(\"\\n \");\n\nasync function runCheck(options: CheckCliOptions): Promise<void> {\n const load = { config: options.config, skipValidation: true };\n await runCli(load, options.json, async (config) => {\n const { models } = config;\n // The identifier and identity checks hydration runs, whatever the\n // configured client skipped.\n hydrateSchemaNames(models);\n const result = validateSchema(models);\n const storage = options.db\n ? await auditStorage({ $driver: config.driver, $schema: models })\n : undefined;\n const dirty = storage?.filter(needsRepair) ?? [];\n if (options.json) {\n process.stdout.write(\n `${JSON.stringify(storage ? { ...result, storage } : result, null, 2)}\\n`\n );\n } else {\n for (const issue of result.errors)\n process.stderr.write(`error ${describe(issue)}\\n`);\n for (const issue of result.warnings)\n process.stderr.write(`warning ${describe(issue)}\\n`);\n for (const audit of dirty)\n process.stderr.write(`error ${describeAudit(audit)}\\n`);\n process.stdout.write(\n result.valid\n ? `Schema valid (${Object.keys(models).length} models).\\n`\n : `Schema invalid: ${result.errors.length} error(s).\\n`\n );\n if (storage)\n process.stdout.write(\n `Storage audited: ${storage.length} column(s), ${dirty.length} need repair.\\n`\n );\n }\n if (!result.valid || dirty.length > 0) process.exitCode = 1;\n });\n}\n\nexport function createCheckCommand(): Command {\n return new Command(\"check\")\n .description(\n \"Validate the schema, so clients can be created with skipSchemaValidation\"\n )\n .option(\"--config <path>\", \"Path to viborm.config.ts\")\n .option(\"--json\", \"Print machine-readable JSON\")\n .option(\n \"--db\",\n \"Also audit SQLite storage: DateTime/Time text and decimal columns\"\n )\n .action(runCheck);\n}\n\nexport const checkCommand = createCheckCommand();\n","/**\n * Migration CLI. Composition root is createMigrationClient + loadConfig.\n */\n\nimport { writeFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { confirm, isCancel } from \"@clack/prompts\";\nimport { Command, InvalidArgumentError } from \"commander\";\nimport {\n createMigrationClient,\n type WritableMigrations,\n} from \"../../migrations/client\";\nimport { loadMigrationGraph } from \"../../migrations/graph\";\nimport { isSha256 } from \"../../migrations/identity\";\nimport { renderMigrationReview } from \"../../migrations/public-view\";\nimport { formatOperation } from \"../../migrations/push/format\";\nimport type { MigrationStorageWriter } from \"../../migrations/storage/contract\";\nimport { createFsStorageWriter } from \"../../migrations/storage/fs-estate\";\nimport type { ResolveCallback } from \"../../migrations/types\";\nimport type {\n ManualMigrationInput,\n StateSelector,\n} from \"../../migrations/v1-types\";\nimport { type LoadedConfig, loadCliModule, printJson, runCli } from \"../utils\";\n\nconst STATE_ID_PREFIX = /^[0-9a-f]{8,63}$/;\n\nfunction positiveInteger(value: string): number {\n const parsed = Number(value);\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new InvalidArgumentError(\"must be a positive safe integer\");\n }\n return parsed;\n}\n\nfunction selector(value: string | undefined): StateSelector | undefined {\n if (!value) return undefined;\n if (isSha256(value)) return { id: value };\n if (STATE_ID_PREFIX.test(value)) return { prefix: value };\n return { name: value };\n}\n\n/** `--accept-data-loss`: every destructive change approved, nothing else decided. */\nconst approveDestructive: ResolveCallback = (change) =>\n change.type === \"destructive\" ? change.proceed() : undefined;\n\n/** One prompt per destructive change, as `viborm push` asks for its plan. */\nconst confirmDestructive: ResolveCallback = async (change) => {\n if (change.type !== \"destructive\") return;\n const approved = await confirm({\n message: `${change.description} — approve?`,\n initialValue: false,\n });\n return !isCancel(approved) && approved ? change.proceed() : change.reject();\n};\n\n/**\n * The resolver `migrate generate` publishes under, and `migrate down` rolls\n * back under: the config's own, else\n * `--accept-data-loss`, else a prompt on an interactive terminal. With none,\n * generate refuses a destructive change with `V11017`.\n */\nfunction generateResolver(\n config: LoadedConfig,\n opts: { acceptDataLoss?: boolean; dryRun?: boolean; json?: boolean }\n): ResolveCallback | undefined {\n if (config.migrations?.resolve) return config.migrations.resolve;\n if (opts.acceptDataLoss) return approveDestructive;\n if (opts.dryRun || opts.json || !process.stdin.isTTY) return;\n return confirmDestructive;\n}\n\n/** Each subcommand reads the parent's `--config` and its own `--dir`. */\nasync function withMigrations(\n migrate: Command,\n options: { dir?: string; json?: boolean },\n run: (\n migrations: WritableMigrations,\n config: LoadedConfig,\n storage: MigrationStorageWriter\n ) => Promise<void>\n): Promise<void> {\n await runCli(\n { config: migrate.opts<{ config?: string }>().config },\n options.json,\n async (config) => {\n const directory = resolve(\n options.dir ?? config.migrations?.dir ?? \"./migrations\"\n );\n const storage =\n config.migrations?.storage ?? createFsStorageWriter(directory);\n const migrations = createMigrationClient(config.client, {\n storage,\n ...(config.migrations?.tables === undefined\n ? {}\n : { tables: config.migrations.tables }),\n });\n await run(migrations, config, storage);\n }\n );\n}\n\nexport function createMigrateCommand(): Command {\n const migrate = new Command(\"migrate\")\n .description(\"Manage the authenticated migration estate\")\n .option(\"--config <path>\", \"Path to viborm.config.ts\");\n\n migrate\n .command(\"generate\")\n .description(\"Publish a new estate state from the current schema\")\n .option(\"-n, --name <name>\", \"Human-readable state label\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\n \"--from <stateId>\",\n \"Parent state id, or empty for the virtual root\"\n )\n .option(\"--custom <path>\", \"Compile a TypeScript manual migration author\")\n .option(\n \"--review <path>\",\n \"Write labelled forward/check/rollback review SQL\"\n )\n .option(\"--dry-run\", \"Preview without publishing\")\n .option(\n \"--low-lock\",\n \"PostgreSQL: publish index builds and foreign keys on existing tables as recoverable steps\"\n )\n .option(\n \"--accept-data-loss\",\n \"Approve destructive changes (drops, type changes) for this generate\"\n )\n .option(\n \"--adopt <table...>\",\n \"Adopt existing listed tables without DDL; apply proves each equals its declaration\"\n )\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n adopt?: string[];\n name?: string;\n dir?: string;\n from?: string;\n dryRun?: boolean;\n lowLock?: boolean;\n acceptDataLoss?: boolean;\n custom?: string;\n review?: string;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations, config) => {\n const from =\n opts.from === undefined\n ? undefined\n : opts.from === \"\" || opts.from === \"empty\"\n ? null\n : isSha256(opts.from)\n ? opts.from\n : (await migrations.show(selector(opts.from)!)).stateId;\n let manualMigration: ManualMigrationInput | undefined;\n if (opts.custom) {\n type Author =\n | ManualMigrationInput\n | ((\n parents: readonly (string | null)[]\n ) => ManualMigrationInput | Promise<ManualMigrationInput>);\n const module = await loadCliModule<{\n default?: Author;\n migration?: Author;\n }>(resolve(opts.custom));\n const author =\n (Object.hasOwn(module, \"default\") ? module.default : undefined) ??\n module.migration;\n if (!author)\n throw new Error(\n \"A custom migration module must export a default migration or author function\"\n );\n const graph = await migrations.graph();\n const parents = Object.freeze(\n from === undefined\n ? graph.leaves.length === 0\n ? [null]\n : [...graph.leaves]\n : [from]\n );\n manualMigration =\n typeof author === \"function\" ? await author(parents) : author;\n }\n const approve = generateResolver(config, opts);\n const result = await migrations.generate({\n name: opts.name,\n from,\n dryRun: opts.dryRun,\n ...(opts.lowLock ? { lowLock: true } : {}),\n ...(opts.adopt ? { adopt: opts.adopt } : {}),\n ...(approve ? { resolve: approve } : {}),\n ...(manualMigration ? { manualMigration } : {}),\n });\n if (opts.json) printJson(result, true);\n else {\n process.stdout.write(\n `${result.outcome}: ${result.name ?? \"No schema changes\"}${result.stateId ? ` (${result.stateId})` : \"\"}\\n`\n );\n for (const parent of result.operationsByParent ?? []) {\n process.stdout.write(\n `Parent ${parent.fromState ?? \"empty\"}:\\n${parent.operations.map(formatOperation).join(\"\\n\")}\\n`\n );\n }\n for (const warning of result.warnings ?? [])\n process.stderr.write(`warning: ${warning}\\n`);\n if (result.reviewSql || result.sql)\n process.stdout.write(`${result.reviewSql || result.sql}\\n`);\n }\n if (opts.review && result.reviewSql)\n await writeFile(resolve(opts.review), result.reviewSql, \"utf8\");\n });\n }\n );\n\n migrate\n .command(\"check\")\n .description(\"Validate estate artifacts without touching the database\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n const result = await migrations.check();\n printJson(result, Boolean(opts.json));\n if (!result.ok) process.exitCode = 1;\n });\n });\n\n migrate\n .command(\"list\")\n .description(\"List estate states\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(await migrations.list(), Boolean(opts.json));\n });\n });\n\n migrate\n .command(\"show\")\n .description(\"Show one estate state\")\n .argument(\"<state>\", \"State id, unambiguous prefix, or name\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--sql\", \"Print labelled forward/check/rollback review SQL\")\n .option(\"--review <path>\", \"Write review SQL to this file\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (\n state: string,\n opts: { dir?: string; sql?: boolean; review?: string; json?: boolean }\n ) => {\n await withMigrations(\n migrate,\n opts,\n async (migrations, _config, storage) => {\n const details = await migrations.show(selector(state)!);\n if (!(opts.sql || opts.review)) {\n printJson(details, Boolean(opts.json));\n return;\n }\n const graph = await loadMigrationGraph(storage);\n const manifest = graph.states.get(details.stateId);\n const blob = manifest && graph.sql.get(manifest.sqlHash);\n if (!(manifest && blob))\n throw new Error(\"The authenticated state SQL is unavailable\");\n const reviewSql = renderMigrationReview(\n manifest.parents,\n manifest.destinationChecks,\n blob\n );\n if (opts.json) printJson({ ...details, reviewSql }, true);\n else {\n printJson(details, false);\n process.stdout.write(reviewSql);\n }\n if (opts.review)\n await writeFile(resolve(opts.review), reviewSql, \"utf8\");\n }\n );\n }\n );\n\n migrate\n .command(\"graph\")\n .description(\"Print estate roots and leaves\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(await migrations.graph(), Boolean(opts.json));\n });\n });\n\n migrate\n .command(\"status\")\n .description(\"Show marker, pending path, and unfinished attempts\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(await migrations.status(), Boolean(opts.json));\n });\n });\n\n migrate\n .command(\"verify\")\n .description(\"Lock and compare the live schema to the marker\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n const result = await migrations.verify();\n printJson(result, Boolean(opts.json));\n if (!result.ok) process.exitCode = 1;\n });\n });\n\n migrate\n .command(\"log\")\n .description(\"Print the append-only ledger\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--limit <n>\", \"Maximum events\", positiveInteger)\n .option(\"--json\", \"Print machine-readable output\")\n .action(async (opts: { dir?: string; limit?: number; json?: boolean }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n const events = await migrations.log();\n printJson(\n opts.limit ? events.slice(-opts.limit) : events,\n Boolean(opts.json)\n );\n });\n });\n\n migrate\n .command(\"apply\")\n .description(\"Apply estate states to the target\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--to <selector>\", \"Target state id, prefix, or name\")\n .option(\"--via <stateId...>\", \"Force a path through these states\")\n .option(\"--dry-run\", \"Plan without executing\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n dir?: string;\n to?: string;\n via?: string[];\n dryRun?: boolean;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(\n await migrations.apply({\n to: selector(opts.to),\n via: opts.via,\n dryRun: opts.dryRun,\n }),\n Boolean(opts.json)\n );\n });\n }\n );\n\n migrate\n .command(\"down\")\n .description(\"Roll back along the recorded arrival path\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--to <selector>\", \"Roll back to this state\")\n .option(\"--steps <n>\", \"Number of states to roll back\", positiveInteger)\n .option(\n \"--accept-data-loss\",\n \"Approve destructive changes the rollback makes to populated tables\"\n )\n .option(\n \"--expect-revision <n>\",\n \"Refuse unless the marker is at this revision\",\n positiveInteger\n )\n .option(\"--dry-run\", \"Plan without executing\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n dir?: string;\n to?: string;\n steps?: number;\n acceptDataLoss?: boolean;\n expectRevision?: number;\n dryRun?: boolean;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations, config) => {\n if (opts.to !== undefined && opts.steps !== undefined)\n throw new Error(\"down accepts --to or --steps, not both\");\n const approve = generateResolver(config, opts);\n const common = {\n dryRun: opts.dryRun,\n ...(approve ? { resolve: approve } : {}),\n ...(opts.expectRevision === undefined\n ? {}\n : { expectRevision: opts.expectRevision }),\n };\n const result = await migrations.down(\n opts.to\n ? { to: selector(opts.to)!, ...common }\n : { steps: opts.steps, ...common }\n );\n if (!result.preview || opts.json) {\n printJson(result, Boolean(opts.json));\n } else {\n for (const edge of result.edges) process.stdout.write(edge.sql);\n if (result.refusal) {\n process.stderr.write(\n `down would refuse: ${result.refusal.code}: ${result.refusal.message}\\n`\n );\n }\n }\n // The preview fails where `down` would fail.\n if (result.preview && result.refusal) process.exitCode = 1;\n });\n }\n );\n\n migrate\n .command(\"baseline\")\n .description(\"Adopt an existing database as a known estate state\")\n .requiredOption(\"--to <selector>\", \"Existing estate state to adopt\")\n .option(\"--via <stateId...>\", \"Force the recorded root path\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n to: string;\n via?: string[];\n dir?: string;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(\n await migrations.baseline({\n to: selector(opts.to)!,\n via: opts.via,\n }),\n Boolean(opts.json)\n );\n });\n }\n );\n\n migrate\n .command(\"reanchor\")\n .description(\n \"After a restore left the history older than the database, move the marker to the state the live schema matches\"\n )\n .option(\"--to <selector>\", \"Adopt this state as the new baseline\")\n .option(\"--via <stateId...>\", \"Force the recorded root path\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n to?: string;\n via?: string[];\n dir?: string;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n printJson(\n await migrations.reanchor({\n to: selector(opts.to),\n via: opts.via,\n }),\n Boolean(opts.json)\n );\n });\n }\n );\n\n migrate\n .command(\"resolve\")\n .description(\"Resolve an unfinished attempt after live proof\")\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--complete\", \"Mark complete when destination proof holds\")\n .option(\"--rolled-back\", \"Mark rolled back when origin proof holds\")\n .option(\"--retry\", \"Retry from the first proven incomplete step\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n dir?: string;\n complete?: boolean;\n rolledBack?: boolean;\n retry?: boolean;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n if (\n [opts.complete, opts.rolledBack, opts.retry].filter(Boolean)\n .length !== 1\n )\n throw new Error(\n \"resolve requires exactly one of --complete, --rolled-back, or --retry\"\n );\n const outcome = opts.complete\n ? \"complete\"\n : opts.rolledBack\n ? \"rolled-back\"\n : \"retry\";\n printJson(await migrations.resolve({ outcome }), Boolean(opts.json));\n });\n }\n );\n\n migrate\n .command(\"reset\")\n .description(\n \"Clear managed objects and replay from empty to a selected state\"\n )\n .option(\"-d, --dir <dir>\", \"Estate directory\")\n .option(\"--to <selector>\", \"Target state after rebuild\")\n .option(\"--via <stateId...>\", \"Force a rebuild path\")\n .option(\"--confirm\", \"Confirm destructive reset (not required for dry-run)\")\n .option(\"--dry-run\", \"Plan without executing\")\n .option(\"--json\", \"Print machine-readable output\")\n .action(\n async (opts: {\n dir?: string;\n to?: string;\n via?: string[];\n confirm?: boolean;\n dryRun?: boolean;\n json?: boolean;\n }) => {\n await withMigrations(migrate, opts, async (migrations) => {\n if (!(opts.dryRun || opts.confirm))\n throw new Error(\n \"Reset requires --confirm; inspect --dry-run first\"\n );\n printJson(\n await migrations.reset({\n to: selector(opts.to),\n via: opts.via,\n dryRun: opts.dryRun,\n }),\n Boolean(opts.json)\n );\n });\n }\n );\n\n return migrate;\n}\n\nexport const migrateCommand = createMigrateCommand();\n","/**\n * `viborm pull --json`: an existing database → a schema document.\n *\n * The connection string is `--url`, else `DATABASE_URL` (read from `.env` like\n * every command). The document goes to `--out`, else to stdout, in canonical\n * form; what it does not carry, and where a push of it would change the\n * database, goes to stderr, so stdout stays a document a pipe can parse.\n *\n * `--json` is the only output today. A TypeScript schema will be written from\n * the same document, so the flag names the format rather than defaulting it.\n *\n * `--light` writes a light document (`introspectSchema({ light: true })`): what\n * a client needs, without indexes, which every migration path refuses.\n */\n\nimport { existsSync, writeFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { loadEnvFile } from \"node:process\";\nimport { Command } from \"commander\";\nimport { introspectSchema } from \"../../migrations/introspect\";\nimport type {\n IntrospectionWarning,\n SkippedObject,\n} from \"../../migrations/introspect/types\";\nimport { failCli } from \"../utils\";\n\ninterface PullCliOptions {\n readonly url?: string;\n readonly json?: boolean;\n readonly out?: string;\n readonly tables?: readonly string[];\n readonly light?: boolean;\n}\n\nfunction located(item: {\n table?: string | undefined;\n name?: string | undefined;\n}) {\n return [item.table, item.name].filter(Boolean).join(\".\");\n}\n\n/** The report a human reads beside the document. */\nexport function formatPullReport(\n skipped: readonly SkippedObject[],\n warnings: readonly IntrospectionWarning[]\n): string {\n const lines: string[] = [];\n if (skipped.length > 0) {\n lines.push(`Not in the document (${skipped.length}):`);\n for (const item of skipped)\n lines.push(` - ${item.kind} ${located(item)}: ${item.reason}`);\n }\n if (warnings.length > 0) {\n lines.push(`Warnings (${warnings.length}):`);\n for (const warning of warnings)\n lines.push(\n ` - [${warning.kind}] ${located(warning)}: ${warning.message}`\n );\n }\n return lines.length === 0\n ? \"The document states the whole database; a push of it plans nothing.\\n\"\n : `${lines.join(\"\\n\")}\\n`;\n}\n\nasync function runPull(options: PullCliOptions): Promise<void> {\n try {\n if (!options.json)\n throw new Error(\n \"viborm pull writes a JSON schema document: pass --json. A TypeScript schema is not generated yet.\"\n );\n const envPath = resolve(process.cwd(), \".env\");\n if (existsSync(envPath)) loadEnvFile(envPath);\n const url = options.url ?? process.env.DATABASE_URL;\n if (!url)\n throw new Error(\n \"viborm pull needs a connection string: pass --url or set DATABASE_URL.\"\n );\n const result = await introspectSchema({\n url,\n ...(options.tables === undefined ? {} : { tables: options.tables }),\n ...(options.light ? { light: true } : {}),\n });\n const text = `${JSON.stringify(result.document, null, 2)}\\n`;\n if (options.out === undefined) process.stdout.write(text);\n else writeFileSync(resolve(process.cwd(), options.out), text);\n process.stderr.write(formatPullReport(result.skipped, result.warnings));\n } catch (error) {\n failCli(error, options.json === true);\n }\n}\n\nexport function createPullCommand(): Command {\n return new Command(\"pull\")\n .description(\n \"Read an existing database into a schema document (viborm/schema/json)\"\n )\n .option(\"--json\", \"Write the JSON schema document\")\n .option(\n \"--url <url>\",\n \"Connection string (postgres://, mysql://, file:, libsql://); defaults to DATABASE_URL\"\n )\n .option(\"--out <path>\", \"Write the document to this file instead of stdout\")\n .option(\n \"--light\",\n \"Only what a client needs (no indexes); migrations refuse the document\"\n )\n .option(\n \"--tables <names...>\",\n \"Only these tables (exact physical names, space- or comma-separated)\",\n (value: string, previous: string[] | undefined) => [\n ...(previous ?? []),\n ...value\n .split(\",\")\n .map((name) => name.trim())\n .filter(Boolean),\n ]\n )\n .action(runPull);\n}\n\nexport const pullCommand = createPullCommand();\n","/**\n * History-free, authenticated schema push CLI.\n *\n * The preview is inert. Effectful execution receives only the consent emitted\n * by that preview; no generic force authorization reaches the apply call.\n */\n\nimport { cancel, confirm, isCancel, note, outro } from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { createMigrationClient } from \"../../migrations/client\";\nimport type { PushPreview } from \"../../migrations/push-v1\";\nimport { printJson, runCli } from \"../utils\";\n\ninterface PushCliOptions {\n readonly config?: string;\n readonly dryRun?: boolean;\n readonly forceReset?: boolean;\n readonly yes?: boolean;\n readonly acceptDataLoss?: boolean;\n readonly json?: boolean;\n}\n\nfunction printPlan(preview: PushPreview): void {\n const operations =\n preview.operations.length === 0\n ? [\"No schema changes.\"]\n : preview.operations.map(\n (operation) =>\n `[${operation.risk}] ${operation.label} (${operation.id})`\n );\n const statements = preview.statements.map(\n (statement, index) =>\n `${index + 1}. ${statement.sql}${\n statement.parameters.length === 0\n ? \"\"\n : `\\n parameters: ${JSON.stringify(statement.parameters)}`\n }`\n );\n const lines = [\n `Target: ${JSON.stringify(preview.target)}`,\n `Plan: ${preview.planHash}`,\n ...operations,\n ...(statements.length === 0 ? [] : [\"\", \"SQL:\", ...statements]),\n ];\n note(lines.join(\"\\n\"), \"Push plan\");\n}\n\nasync function runPush(options: PushCliOptions): Promise<void> {\n await runCli({ config: options.config }, options.json, async (config) => {\n const migrations =\n config.migrations?.tables === undefined\n ? createMigrationClient(config.client)\n : createMigrationClient(config.client, {\n tables: config.migrations.tables,\n });\n // `force` is confined to the inert planning arm. The authenticated apply\n // arm below receives only the consent bound to this exact preview.\n const preview = await migrations.push({\n dryRun: true,\n ...(options.forceReset === true ? { forceReset: true } : {}),\n ...(config.migrations?.resolve\n ? { resolve: config.migrations.resolve }\n : {}),\n });\n\n if (\n !options.json &&\n config.driver?.dialect === \"sqlite\" &&\n [\"sqlite3\", \"bun-sqlite\", \"bun-sql\"].includes(config.driver.driverName)\n ) {\n const databases = await config.driver._executeRaw<{\n name: string;\n file: string;\n }>(\"PRAGMA database_list\");\n if (\n databases.rows.some(\n (database) => database.name === \"main\" && database.file === \"\"\n )\n )\n process.stderr.write(\n \"warning: SQLite reports an in-memory main database. Use a persistent target for durable schema changes.\\n\"\n );\n }\n\n if (options.dryRun) {\n if (options.json) printJson(preview, true);\n else printPlan(preview);\n return;\n }\n\n if (!options.json) printPlan(preview);\n\n if (\n preview.destructive &&\n !options.acceptDataLoss &&\n (options.yes || options.json || !process.stdin.isTTY)\n ) {\n throw new Error(\n \"Destructive push requires --accept-data-loss; --yes does not authorize data loss. Inspect --dry-run first.\"\n );\n }\n if (\n preview.outcome !== \"noop\" &&\n !options.yes &&\n !options.acceptDataLoss &&\n !options.json &&\n process.stdin.isTTY\n ) {\n const accepted = await confirm({\n message: preview.destructive\n ? \"Apply this destructive push plan?\"\n : \"Apply this push plan?\",\n initialValue: !preview.destructive,\n });\n if (isCancel(accepted) || !accepted) {\n cancel(\"Push cancelled.\");\n return;\n }\n }\n\n const result = await migrations.push({ consent: preview.consent });\n if (options.json) printJson(result, true);\n else\n outro(\n result.outcome === \"noop\" ? \"Schema is up to date.\" : \"Push applied.\"\n );\n });\n}\n\nexport function createPushCommand(): Command {\n return new Command(\"push\")\n .description(\"Synchronize the schema directly without migration history\")\n .option(\"--config <path>\", \"Path to viborm.config.ts\")\n .option(\"--dry-run\", \"Preview without changing the database\")\n .option(\"--force-reset\", \"Plan a rebuild from an empty database\")\n .option(\"-y, --yes\", \"Skip prompts for non-destructive plans\")\n .option(\n \"--accept-data-loss\",\n \"Explicitly accept the previewed destructive plan\"\n )\n .option(\"--json\", \"Print machine-readable JSON\")\n .action(runPush);\n}\n\nexport const pushCommand = createPushCommand();\n","#!/usr/bin/env node\n/**\n * VibORM CLI\n *\n * Command-line interface for VibORM database operations.\n */\n\nimport { Command } from \"commander\";\nimport { registerEveryMigrationDriver } from \"../migrations/dialects/every\";\nimport { VIBORM_VERSION } from \"../version\";\nimport { checkCommand } from \"./commands/check\";\nimport { migrateCommand } from \"./commands/migrate\";\nimport { pullCommand } from \"./commands/pull\";\nimport { pushCommand } from \"./commands/push\";\n\nregisterEveryMigrationDriver();\n\nconst program = new Command();\n\nprogram\n .name(\"viborm\")\n .description(\"VibORM - Type-safe ORM for PostgreSQL, MySQL and SQLite\")\n .version(VIBORM_VERSION);\n\n// Register commands\nprogram.addCommand(checkCommand);\nprogram.addCommand(pushCommand);\nprogram.addCommand(migrateCommand);\nprogram.addCommand(pullCommand);\n\n// Parse arguments\ntry {\n await program.parseAsync();\n} catch (error: unknown) {\n process.stderr.write(\n `${error instanceof Error ? error.message : \"CLI failed\"}\\n`\n );\n process.exitCode = 1;\n}\n\n// The command settled and its client was closed (`runCli`): the process ends\n// here, whatever a driver left open. A socket a server never finishes closing\n// (SurrealDB Cloud does not answer a WebSocket's closing handshake) otherwise\n// kept `push` alive for good after it had printed its outcome. What is still\n// buffered (a pipe is written asynchronously outside Linux) goes out first.\nfor (const stream of [process.stdout, process.stderr])\n if (stream.writableLength > 0)\n await new Promise<void>((resolve) => stream.write(\"\", () => resolve()));\nprocess.exit();\n"],"mappings":";4yBAyBA,MAAM,YAAe,GACnB,EAAM,OAAS,UAAY,CAAC,EAAM,QAAU,EAAM,eAAiB,EAE/D,cAAiB,GAAsC,CAC3D,IAAM,EAAS,cAAc,EAAM,MAAM,KAAK,EAAM,OAAO,GAC3D,IAAK,EAAM,OAAS,UAAY,EAAM,SAAW,EAAM,gBAAkB,KACvE,MAAO,GAAG,EAAO,yGACnB,GAAI,EAAM,OAAS,UACjB,MAAO,GAAG,EAAO,aAAa,EAAM,SAAS,wRAC/C,IAAM,EAAO,EAAM,OAAS,OAAS,OAAS,WACxC,EAAS,EAAM,KACjB,uFACA,8BAA8B,EAAK,mCACvC,MAAO,GAAG,EAAO,IAAI,EAAM,aAAa,0BAA0B,EAAK,uCAAuC,EAAO,+FAIjH,SAAY,GAChB,CAAC,IAAI,EAAM,KAAK,IAAI,EAAM,UAAW,EAAM,OAAO,CAC/C,OAAO,QAAQ,CACf,KAAK;MAAS,CAEnB,eAAe,SAAS,EAAyC,CAE/D,MAAM,EADO,CAAE,OAAQ,EAAQ,OAAQ,eAAgB,GAAM,CAC1C,EAAQ,KAAM,KAAO,IAAW,CACjD,GAAM,CAAE,UAAW,EAGnB,EAAmB,EAAO,CAC1B,IAAM,EAAS,EAAe,EAAO,CAC/B,EAAU,EAAQ,GACpB,MAAM,EAAa,CAAE,QAAS,EAAO,OAAQ,QAAS,EAA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