@prisma/orm-toolchain 0.16.0-dev.36

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 (321) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +28 -0
  3. package/dist/aggregate-B4mhR4Sk.mjs +1012 -0
  4. package/dist/aggregate-B4mhR4Sk.mjs.map +1 -0
  5. package/dist/aggregate-BflrjWPO.d.mts +803 -0
  6. package/dist/aggregate-BflrjWPO.d.mts.map +1 -0
  7. package/dist/bin__prisma-next.mjs +800 -0
  8. package/dist/bin__prisma-next.mjs.map +1 -0
  9. package/dist/cli-telemetry.d.mts +367 -0
  10. package/dist/cli-telemetry.d.mts.map +1 -0
  11. package/dist/cli-telemetry.mjs +48 -0
  12. package/dist/cli-telemetry.mjs.map +1 -0
  13. package/dist/cli-telemetry__sender.d.mts +1 -0
  14. package/dist/cli-telemetry__sender.mjs +1 -0
  15. package/dist/cli.d.mts +31 -0
  16. package/dist/cli.d.mts.map +1 -0
  17. package/dist/cli.mjs +180 -0
  18. package/dist/cli.mjs.map +1 -0
  19. package/dist/cli__commands__contract-emit.d.mts +2 -0
  20. package/dist/cli__commands__contract-emit.mjs +2 -0
  21. package/dist/cli__commands__contract-infer.d.mts +7 -0
  22. package/dist/cli__commands__contract-infer.d.mts.map +1 -0
  23. package/dist/cli__commands__contract-infer.mjs +2 -0
  24. package/dist/cli__commands__db-init.d.mts +7 -0
  25. package/dist/cli__commands__db-init.d.mts.map +1 -0
  26. package/dist/cli__commands__db-init.mjs +2 -0
  27. package/dist/cli__commands__db-schema.d.mts +7 -0
  28. package/dist/cli__commands__db-schema.d.mts.map +1 -0
  29. package/dist/cli__commands__db-schema.mjs +2 -0
  30. package/dist/cli__commands__db-sign.d.mts +7 -0
  31. package/dist/cli__commands__db-sign.d.mts.map +1 -0
  32. package/dist/cli__commands__db-sign.mjs +2 -0
  33. package/dist/cli__commands__db-update.d.mts +7 -0
  34. package/dist/cli__commands__db-update.d.mts.map +1 -0
  35. package/dist/cli__commands__db-update.mjs +2 -0
  36. package/dist/cli__commands__db-verify.d.mts +7 -0
  37. package/dist/cli__commands__db-verify.d.mts.map +1 -0
  38. package/dist/cli__commands__db-verify.mjs +2 -0
  39. package/dist/cli__commands__migrate.d.mts +66 -0
  40. package/dist/cli__commands__migrate.d.mts.map +1 -0
  41. package/dist/cli__commands__migrate.mjs +2 -0
  42. package/dist/cli__commands__migration-check.d.mts +64 -0
  43. package/dist/cli__commands__migration-check.d.mts.map +1 -0
  44. package/dist/cli__commands__migration-check.mjs +3 -0
  45. package/dist/cli__commands__migration-graph.d.mts +36 -0
  46. package/dist/cli__commands__migration-graph.d.mts.map +1 -0
  47. package/dist/cli__commands__migration-graph.mjs +2 -0
  48. package/dist/cli__commands__migration-list.d.mts +79 -0
  49. package/dist/cli__commands__migration-list.d.mts.map +1 -0
  50. package/dist/cli__commands__migration-list.mjs +2 -0
  51. package/dist/cli__commands__migration-log.d.mts +20 -0
  52. package/dist/cli__commands__migration-log.d.mts.map +1 -0
  53. package/dist/cli__commands__migration-log.mjs +2 -0
  54. package/dist/cli__commands__migration-new.d.mts +7 -0
  55. package/dist/cli__commands__migration-new.d.mts.map +1 -0
  56. package/dist/cli__commands__migration-new.mjs +2 -0
  57. package/dist/cli__commands__migration-plan.d.mts +79 -0
  58. package/dist/cli__commands__migration-plan.d.mts.map +1 -0
  59. package/dist/cli__commands__migration-plan.mjs +2 -0
  60. package/dist/cli__commands__migration-show.d.mts +27 -0
  61. package/dist/cli__commands__migration-show.d.mts.map +1 -0
  62. package/dist/cli__commands__migration-show.mjs +2 -0
  63. package/dist/cli__commands__migration-status.d.mts +55 -0
  64. package/dist/cli__commands__migration-status.d.mts.map +1 -0
  65. package/dist/cli__commands__migration-status.mjs +3 -0
  66. package/dist/cli__commands__ref.d.mts +34 -0
  67. package/dist/cli__commands__ref.d.mts.map +1 -0
  68. package/dist/cli__commands__ref.mjs +2 -0
  69. package/dist/cli__commands__telemetry.d.mts +7 -0
  70. package/dist/cli__commands__telemetry.d.mts.map +1 -0
  71. package/dist/cli__commands__telemetry.mjs +2 -0
  72. package/dist/cli__config-types.d.mts +2 -0
  73. package/dist/cli__config-types.mjs +2 -0
  74. package/dist/cli__control-api.d.mts +141 -0
  75. package/dist/cli__control-api.d.mts.map +1 -0
  76. package/dist/cli__control-api.mjs +4 -0
  77. package/dist/cli__init-output.d.mts +37 -0
  78. package/dist/cli__init-output.d.mts.map +1 -0
  79. package/dist/cli__init-output.mjs +2 -0
  80. package/dist/cli__migration-cli.d.mts +79 -0
  81. package/dist/cli__migration-cli.d.mts.map +1 -0
  82. package/dist/cli__migration-cli.mjs +407 -0
  83. package/dist/cli__migration-cli.mjs.map +1 -0
  84. package/dist/client-75qrAPqf-DZAVUxFa.mjs +1606 -0
  85. package/dist/client-75qrAPqf-DZAVUxFa.mjs.map +1 -0
  86. package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs +1671 -0
  87. package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +1 -0
  88. package/dist/config-loader.d.mts +18 -0
  89. package/dist/config-loader.d.mts.map +1 -0
  90. package/dist/config-loader.mjs +2 -0
  91. package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs +10 -0
  92. package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs.map +1 -0
  93. package/dist/constants-Dkcn8Qu4.d.mts +10 -0
  94. package/dist/constants-Dkcn8Qu4.d.mts.map +1 -0
  95. package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +36 -0
  96. package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +1 -0
  97. package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs +148 -0
  98. package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs.map +1 -0
  99. package/dist/contract-emit-B65_UiFn.d.mts +7 -0
  100. package/dist/contract-emit-B65_UiFn.d.mts.map +1 -0
  101. package/dist/contract-emit-B6odMoem-CK3diBPk.mjs +359 -0
  102. package/dist/contract-emit-B6odMoem-CK3diBPk.mjs.map +1 -0
  103. package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs +56 -0
  104. package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map +1 -0
  105. package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs +73 -0
  106. package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs.map +1 -0
  107. package/dist/contract-snapshot-store-CbqynbtE.d.mts +28 -0
  108. package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +1 -0
  109. package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs +118 -0
  110. package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map +1 -0
  111. package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs +302 -0
  112. package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +1 -0
  113. package/dist/db-init-Vbkb_TKZ.mjs +153 -0
  114. package/dist/db-init-Vbkb_TKZ.mjs.map +1 -0
  115. package/dist/db-schema-ClQCu3xY.mjs +47 -0
  116. package/dist/db-schema-ClQCu3xY.mjs.map +1 -0
  117. package/dist/db-sign-jjXDgQ1u.mjs +175 -0
  118. package/dist/db-sign-jjXDgQ1u.mjs.map +1 -0
  119. package/dist/db-update-BQlrqtDD.mjs +183 -0
  120. package/dist/db-update-BQlrqtDD.mjs.map +1 -0
  121. package/dist/db-verify-CKPsRFrj-3udprZQD.mjs +396 -0
  122. package/dist/db-verify-CKPsRFrj-3udprZQD.mjs.map +1 -0
  123. package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs +334 -0
  124. package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs.map +1 -0
  125. package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +63 -0
  126. package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +1 -0
  127. package/dist/emitter.d.mts +75 -0
  128. package/dist/emitter.d.mts.map +1 -0
  129. package/dist/emitter.mjs +3 -0
  130. package/dist/emitter__domain-type-generation.d.mts +2 -0
  131. package/dist/emitter__domain-type-generation.mjs +2 -0
  132. package/dist/emitter__type-expression-safety.d.mts +6 -0
  133. package/dist/emitter__type-expression-safety.d.mts.map +1 -0
  134. package/dist/emitter__type-expression-safety.mjs +2 -0
  135. package/dist/errors--qsXZUtL.d.mts +72 -0
  136. package/dist/errors--qsXZUtL.d.mts.map +1 -0
  137. package/dist/errors-IpZm1Skp-BH495dRd.mjs +378 -0
  138. package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +1 -0
  139. package/dist/exports-BN0vFTxG.mjs +276 -0
  140. package/dist/exports-BN0vFTxG.mjs.map +1 -0
  141. package/dist/exports-B_xhKZmC.mjs +1436 -0
  142. package/dist/exports-B_xhKZmC.mjs.map +1 -0
  143. package/dist/exports-D3-NwrMA-CadaBGQ3.mjs +154 -0
  144. package/dist/exports-D3-NwrMA-CadaBGQ3.mjs.map +1 -0
  145. package/dist/exports-Dl2aGAk7.mjs +119 -0
  146. package/dist/exports-Dl2aGAk7.mjs.map +1 -0
  147. package/dist/format-ByDm2goZ-DKLyhNHo.mjs +101 -0
  148. package/dist/format-ByDm2goZ-DKLyhNHo.mjs.map +1 -0
  149. package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs +58 -0
  150. package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs.map +1 -0
  151. package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts +35 -0
  152. package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts.map +1 -0
  153. package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts +28 -0
  154. package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts.map +1 -0
  155. package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs +14 -0
  156. package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map +1 -0
  157. package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs +64 -0
  158. package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +1 -0
  159. package/dist/hash-XZYYKJ-i.d.mts +53 -0
  160. package/dist/hash-XZYYKJ-i.d.mts.map +1 -0
  161. package/dist/import-roots-B6CtsWXb.d.mts +119 -0
  162. package/dist/import-roots-B6CtsWXb.d.mts.map +1 -0
  163. package/dist/import-roots-NDOIEDVj.mjs +217 -0
  164. package/dist/import-roots-NDOIEDVj.mjs.map +1 -0
  165. package/dist/init-DHctXAI9-DSlaaYXN.mjs +2186 -0
  166. package/dist/init-DHctXAI9-DSlaaYXN.mjs.map +1 -0
  167. package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs +91 -0
  168. package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map +1 -0
  169. package/dist/invariants-B5wLrgQS.d.mts +39 -0
  170. package/dist/invariants-B5wLrgQS.d.mts.map +1 -0
  171. package/dist/invariants-lXzy6txi-DAoP4nTE.mjs +57 -0
  172. package/dist/invariants-lXzy6txi-DAoP4nTE.mjs.map +1 -0
  173. package/dist/io-C8TdyBKt-DloEBi70.mjs +313 -0
  174. package/dist/io-C8TdyBKt-DloEBi70.mjs.map +1 -0
  175. package/dist/io-DYfeLJxR.d.mts +1 -0
  176. package/dist/io-sr4CO9_t-C3eV_kn-.d.mts +125 -0
  177. package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +1 -0
  178. package/dist/ledger-origin-BGRN77Oy.d.mts +6 -0
  179. package/dist/ledger-origin-BGRN77Oy.d.mts.map +1 -0
  180. package/dist/ledger-origin-D7PN4Fon.mjs +9 -0
  181. package/dist/ledger-origin-D7PN4Fon.mjs.map +1 -0
  182. package/dist/metadata-2nbOAGsV-uYNeq2Cp.d.mts +2 -0
  183. package/dist/metadata-BtscDay2.d.mts +1 -0
  184. package/dist/migrate-Cb_iv264.mjs +500 -0
  185. package/dist/migrate-Cb_iv264.mjs.map +1 -0
  186. package/dist/migration-B2ljMJim.d.mts +155 -0
  187. package/dist/migration-B2ljMJim.d.mts.map +1 -0
  188. package/dist/migration-BuUmO7It.mjs +209 -0
  189. package/dist/migration-BuUmO7It.mjs.map +1 -0
  190. package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs +597 -0
  191. package/dist/migration-check-CcG-fB8r-CDs5C9vt.mjs.map +1 -0
  192. package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs +103 -0
  193. package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs.map +1 -0
  194. package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs +500 -0
  195. package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs.map +1 -0
  196. package/dist/migration-graph-DkoCC0Qy.mjs +185 -0
  197. package/dist/migration-graph-DkoCC0Qy.mjs.map +1 -0
  198. package/dist/migration-graph-Dqndu0i5.d.mts +9 -0
  199. package/dist/migration-graph-Dqndu0i5.d.mts.map +1 -0
  200. package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs +1945 -0
  201. package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs.map +1 -0
  202. package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts +124 -0
  203. package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +1 -0
  204. package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs +228 -0
  205. package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs.map +1 -0
  206. package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs +220 -0
  207. package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs.map +1 -0
  208. package/dist/migration-new-BurCjyaQ.mjs +168 -0
  209. package/dist/migration-new-BurCjyaQ.mjs.map +1 -0
  210. package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs +38 -0
  211. package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +1 -0
  212. package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs +759 -0
  213. package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs.map +1 -0
  214. package/dist/migration-show-Bx5I5aW9.mjs +171 -0
  215. package/dist/migration-show-Bx5I5aW9.mjs.map +1 -0
  216. package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs +444 -0
  217. package/dist/migration-status-CFlzlRmu-DewBN8Ys.mjs.map +1 -0
  218. package/dist/migration-tools.d.mts +23 -0
  219. package/dist/migration-tools.mjs +17 -0
  220. package/dist/migration-tools__aggregate.d.mts +2 -0
  221. package/dist/migration-tools__aggregate.mjs +2 -0
  222. package/dist/migration-tools__constants.d.mts +2 -0
  223. package/dist/migration-tools__constants.mjs +2 -0
  224. package/dist/migration-tools__contract-snapshot-store.d.mts +2 -0
  225. package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
  226. package/dist/migration-tools__errors.d.mts +2 -0
  227. package/dist/migration-tools__errors.mjs +2 -0
  228. package/dist/migration-tools__graph.d.mts +2 -0
  229. package/dist/migration-tools__graph.mjs +1 -0
  230. package/dist/migration-tools__hash.d.mts +2 -0
  231. package/dist/migration-tools__hash.mjs +2 -0
  232. package/dist/migration-tools__invariants.d.mts +2 -0
  233. package/dist/migration-tools__invariants.mjs +2 -0
  234. package/dist/migration-tools__io.d.mts +3 -0
  235. package/dist/migration-tools__io.mjs +2 -0
  236. package/dist/migration-tools__ledger-origin.d.mts +2 -0
  237. package/dist/migration-tools__ledger-origin.mjs +2 -0
  238. package/dist/migration-tools__metadata.d.mts +3 -0
  239. package/dist/migration-tools__metadata.mjs +1 -0
  240. package/dist/migration-tools__migration-graph.d.mts +3 -0
  241. package/dist/migration-tools__migration-graph.mjs +3 -0
  242. package/dist/migration-tools__migration-ts.d.mts +2 -0
  243. package/dist/migration-tools__migration-ts.mjs +2 -0
  244. package/dist/migration-tools__migration.d.mts +2 -0
  245. package/dist/migration-tools__migration.mjs +2 -0
  246. package/dist/migration-tools__package.d.mts +3 -0
  247. package/dist/migration-tools__package.mjs +1 -0
  248. package/dist/migration-tools__ref-resolution.d.mts +2 -0
  249. package/dist/migration-tools__ref-resolution.mjs +2 -0
  250. package/dist/migration-tools__refs.d.mts +2 -0
  251. package/dist/migration-tools__refs.mjs +2 -0
  252. package/dist/migration-tools__spaces.d.mts +3 -0
  253. package/dist/migration-tools__spaces.mjs +3 -0
  254. package/dist/migration-ts-CNaAtK8C.d.mts +38 -0
  255. package/dist/migration-ts-CNaAtK8C.d.mts.map +1 -0
  256. package/dist/migration-ts-FyF55c4M.mjs +67 -0
  257. package/dist/migration-ts-FyF55c4M.mjs.map +1 -0
  258. package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +13 -0
  259. package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +1 -0
  260. package/dist/output-DWNYqZGc-D2sRgLAm.mjs +109 -0
  261. package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +1 -0
  262. package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts +21 -0
  263. package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts.map +1 -0
  264. package/dist/package-N9PPdFV_.d.mts +3 -0
  265. package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs +43 -0
  266. package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs.map +1 -0
  267. package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs +99 -0
  268. package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +1 -0
  269. package/dist/publish-surface.d.mts +3 -0
  270. package/dist/publish-surface.mjs +3 -0
  271. package/dist/publish-surface__import-roots.d.mts +2 -0
  272. package/dist/publish-surface__import-roots.mjs +2 -0
  273. package/dist/publish-surface__shells.d.mts +2 -0
  274. package/dist/publish-surface__shells.mjs +2 -0
  275. package/dist/quick-reference-mongo.md +114 -0
  276. package/dist/quick-reference-postgres.md +93 -0
  277. package/dist/readme-mongo.md +35 -0
  278. package/dist/readme-postgres.md +34 -0
  279. package/dist/ref-B6cTthTi.mjs +171 -0
  280. package/dist/ref-B6cTthTi.mjs.map +1 -0
  281. package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs +57 -0
  282. package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs.map +1 -0
  283. package/dist/ref-resolution-BjJBWPjX.mjs +250 -0
  284. package/dist/ref-resolution-BjJBWPjX.mjs.map +1 -0
  285. package/dist/ref-resolution-COGOSL57.d.mts +127 -0
  286. package/dist/ref-resolution-COGOSL57.d.mts.map +1 -0
  287. package/dist/refs-BDbB9BRB-D6Za3Q49.mjs +241 -0
  288. package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +1 -0
  289. package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts +43 -0
  290. package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts.map +1 -0
  291. package/dist/schemas-CeGMYFYX-h3OcU__O.d.mts +192 -0
  292. package/dist/schemas-CeGMYFYX-h3OcU__O.d.mts.map +1 -0
  293. package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs +112 -0
  294. package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs.map +1 -0
  295. package/dist/shells-BenrJHp2.mjs +602 -0
  296. package/dist/shells-BenrJHp2.mjs.map +1 -0
  297. package/dist/shells-COHV_Ozf.d.mts +135 -0
  298. package/dist/shells-COHV_Ozf.d.mts.map +1 -0
  299. package/dist/spaces-C27bA-xc.mjs +267 -0
  300. package/dist/spaces-C27bA-xc.mjs.map +1 -0
  301. package/dist/spaces-DxFj5y8l.d.mts +415 -0
  302. package/dist/spaces-DxFj5y8l.d.mts.map +1 -0
  303. package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs +120 -0
  304. package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs.map +1 -0
  305. package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts +133 -0
  306. package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts.map +1 -0
  307. package/dist/type-expression-safety-CgHTWypx.mjs +8 -0
  308. package/dist/type-expression-safety-CgHTWypx.mjs.map +1 -0
  309. package/dist/types-DZWEs4si-D8UlyJI0.d.mts +893 -0
  310. package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +1 -0
  311. package/dist/verify-DnVNjc5C-BGdsblBK.mjs +283 -0
  312. package/dist/verify-DnVNjc5C-BGdsblBK.mjs.map +1 -0
  313. package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs +252 -0
  314. package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map +1 -0
  315. package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts +136 -0
  316. package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts.map +1 -0
  317. package/dist/vite-plugin-contract-emit.d.mts +54 -0
  318. package/dist/vite-plugin-contract-emit.d.mts.map +1 -0
  319. package/dist/vite-plugin-contract-emit.mjs +303 -0
  320. package/dist/vite-plugin-contract-emit.mjs.map +1 -0
  321. package/package.json +127 -0
@@ -0,0 +1,800 @@
1
+ #!/usr/bin/env node
2
+ import { J as installShutdownHandlers, P as formatCommandHelp, U as formatRootHelp, Y as isCI$1, ct as setCommandExamples, et as parseGlobalFlags, r as addGlobalOptions, s as deriveCanPrompt, st as setCommandDescriptions, tt as parseGlobalFlagsOrExit } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
3
+ import { i as createScaffoldSpecifierResolver } from "./import-roots-NDOIEDVj.mjs";
4
+ import { t as createContractEmitCommand } from "./contract-emit-0hSjbuxp-BBOKldTZ.mjs";
5
+ import { t as createFormatCommand } from "./format-ByDm2goZ-DKLyhNHo.mjs";
6
+ import { t as createDbInitCommand } from "./db-init-Vbkb_TKZ.mjs";
7
+ import { t as createDbUpdateCommand } from "./db-update-BQlrqtDD.mjs";
8
+ import { t as createDbSchemaCommand } from "./db-schema-ClQCu3xY.mjs";
9
+ import { t as createDbSignCommand } from "./db-sign-jjXDgQ1u.mjs";
10
+ import { t as createDbVerifyCommand } from "./db-verify-CKPsRFrj-3udprZQD.mjs";
11
+ import { t as createContractInferCommand } from "./contract-infer-BnkqpftN-DVM2eKJ3.mjs";
12
+ import { t as createMigrationNewCommand } from "./migration-new-BurCjyaQ.mjs";
13
+ import { t as createMigrationPlanCommand } from "./migration-plan-q_L84PN1-BWE0LTH6.mjs";
14
+ import { t as createMigrationShowCommand } from "./migration-show-Bx5I5aW9.mjs";
15
+ import { t as createMigrationListCommand } from "./migration-list-BFBeo1_X-c0kqYokL.mjs";
16
+ import { r as createMigrationStatusCommand } from "./migration-status-CFlzlRmu-DewBN8Ys.mjs";
17
+ import { t as createMigrationLogCommand } from "./migration-log-CS5IWcNq-BQ-32Low.mjs";
18
+ import { t as createMigrationGraphCommand } from "./migration-graph-DkoCC0Qy.mjs";
19
+ import { t as createMigrationCheckCommand } from "./migration-check-CcG-fB8r-CDs5C9vt.mjs";
20
+ import { t as createMigrateCommand } from "./migrate-Cb_iv264.mjs";
21
+ import { t as createRefCommand } from "./ref-B6cTthTi.mjs";
22
+ import { a as resolveGating, i as readUserConfig, r as ensureInstallationId, s as runTelemetry, u as userConfigPath } from "./exports-BN0vFTxG.mjs";
23
+ import { t as createTelemetryCommand } from "./telemetry-CmbCa3Ld-CmE5zcIG.mjs";
24
+ import { DEFAULT_CONTRACT_SOURCE_DIR } from "@prisma/orm-framework/config/config-types";
25
+ import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
26
+ import { Command } from "commander";
27
+ import { fileURLToPath } from "node:url";
28
+ import { distance } from "closest-match";
29
+ //#region ../../../1-framework/3-tooling/cli/dist/cli.mjs
30
+ var version = "0.16.0-dev.36";
31
+ /**
32
+ * The resolver a scaffold for `target` is written against.
33
+ *
34
+ * A scaffold is always on the facade root: `init` writes an application around
35
+ * one database package, and the workspace names are not published, so a project
36
+ * scaffolded against them could not install (ADR 242). Both the files `init`
37
+ * writes and the dependency it adds go through this, so they cannot disagree.
38
+ */
39
+ function scaffoldSpecifierResolverFor(target) {
40
+ return createScaffoldSpecifierResolver({
41
+ mode: "facade",
42
+ facade: target === "postgres" ? "@prisma/orm-postgres" : "@prisma/orm-mongo"
43
+ });
44
+ }
45
+ /**
46
+ * The package name a scaffolded project depends on and imports from, for the
47
+ * import root it is being scaffolded against.
48
+ *
49
+ * Every specifier the scaffold writes derives from this one, and `init` builds
50
+ * a single resolver and hands it to both the file templates and the dependency
51
+ * it installs — so the two cannot disagree. The one caller that deliberately
52
+ * does not thread a resolver is the re-init cleanup in `inputs.ts`, which
53
+ * inspects a manifest an earlier run wrote rather than writing one.
54
+ *
55
+ * Resolvers for scaffolding should come from `createScaffoldSpecifierResolver`
56
+ * in the publish-surface package, which rejects the roots a facade-shaped
57
+ * scaffold cannot express. (Named without its scope on purpose: JSDoc survives
58
+ * into the published bundle, where an internal package name would trip the
59
+ * shell tarball checks.)
60
+ */
61
+ function targetPackageName(target, resolveImportSpecifier = keepInternalSpecifiers) {
62
+ return resolveImportSpecifier(target === "postgres" ? "@internal/postgres" : "@internal/mongo");
63
+ }
64
+ /** One entrypoint of the scaffolded project's target package. */
65
+ function targetEntrypoint(target, subpath, resolveImportSpecifier = keepInternalSpecifiers) {
66
+ return resolveImportSpecifier(`${target === "postgres" ? "@internal/postgres" : "@internal/mongo"}/${subpath}`);
67
+ }
68
+ function targetLabel(target) {
69
+ return target === "postgres" ? "PostgreSQL" : "MongoDB";
70
+ }
71
+ function defaultSchemaPath(authoring) {
72
+ if (authoring === "typescript") return `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.ts`;
73
+ return `${DEFAULT_CONTRACT_SOURCE_DIR}/contract.prisma`;
74
+ }
75
+ function starterSchema(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {
76
+ if (authoring === "typescript") {
77
+ const builder = targetEntrypoint(target, "contract-builder", resolveImportSpecifier);
78
+ return target === "mongo" ? starterSchemaTsMongo(builder) : starterSchemaTsPostgres(builder);
79
+ }
80
+ return target === "mongo" ? starterSchemaPslMongo() : starterSchemaPslPostgres();
81
+ }
82
+ /**
83
+ * Renders a short authoring-appropriate schema sample (FR5.1) for embedding
84
+ * in `prisma-next.md`. Returns a complete fenced markdown code block.
85
+ *
86
+ * The sample intentionally shows just one model: it's illustrative, not
87
+ * a substitute for the full scaffolded contract file. The TS samples use
88
+ * the same outer shape as `starterSchemaTs*` (FR5.3) so a user reading
89
+ * the doc and the file side-by-side sees the same structure.
90
+ */
91
+ function schemaSample(target, authoring, resolveImportSpecifier = keepInternalSpecifiers) {
92
+ if (authoring === "typescript") {
93
+ const builder = targetEntrypoint(target, "contract-builder", resolveImportSpecifier);
94
+ return target === "mongo" ? schemaSampleTsMongo(builder) : schemaSampleTsPostgres(builder);
95
+ }
96
+ return target === "mongo" ? schemaSamplePslMongo() : schemaSamplePslPostgres();
97
+ }
98
+ function schemaSamplePslPostgres() {
99
+ return `\`\`\`prisma
100
+ model User {
101
+ id Int @id @default(autoincrement())
102
+ email String @unique
103
+ username String?
104
+ name String?
105
+ }
106
+ \`\`\``;
107
+ }
108
+ function schemaSamplePslMongo() {
109
+ return `\`\`\`prisma
110
+ model User {
111
+ id ObjectId @id @map("_id")
112
+ email String @unique
113
+ username String?
114
+ name String?
115
+ @@map("users")
116
+ }
117
+ \`\`\``;
118
+ }
119
+ function schemaSampleTsPostgres(builder) {
120
+ return `\`\`\`typescript
121
+ import { defineContract } from '${builder}';
122
+
123
+ export const contract = defineContract(
124
+ {},
125
+ ({ field, model }) => ({
126
+ models: {
127
+ User: model('User', {
128
+ fields: {
129
+ id: field.id.uuidv7String(),
130
+ email: field.text().unique(),
131
+ username: field.text().optional(),
132
+ name: field.text().optional(),
133
+ },
134
+ }),
135
+ },
136
+ }),
137
+ );
138
+ \`\`\``;
139
+ }
140
+ function schemaSampleTsMongo(builder) {
141
+ return `\`\`\`typescript
142
+ import { defineContract } from '${builder}';
143
+
144
+ export const contract = defineContract(
145
+ {},
146
+ ({ field, model }) => ({
147
+ models: {
148
+ User: model('User', {
149
+ collection: 'users',
150
+ fields: {
151
+ _id: field.objectId(),
152
+ email: field.string(),
153
+ username: field.string().optional(),
154
+ name: field.string().optional(),
155
+ },
156
+ }),
157
+ },
158
+ }),
159
+ );
160
+ \`\`\``;
161
+ }
162
+ function starterSchemaPslPostgres() {
163
+ return `// use prisma-next
164
+
165
+ model User {
166
+ id Int @id @default(autoincrement())
167
+ email String @unique
168
+ username String?
169
+ name String?
170
+ posts Post[]
171
+ createdAt DateTime @default(now())
172
+ updatedAt temporal.updatedAt()
173
+ }
174
+
175
+ model Post {
176
+ id Int @id @default(autoincrement())
177
+ title String
178
+ content String?
179
+ author User @relation(fields: [authorId], references: [id])
180
+ authorId Int
181
+ createdAt DateTime @default(now())
182
+ updatedAt temporal.updatedAt()
183
+ }
184
+ `;
185
+ }
186
+ function starterSchemaPslMongo() {
187
+ return `// use prisma-next
188
+
189
+ model User {
190
+ id ObjectId @id @map("_id")
191
+ email String @unique
192
+ username String?
193
+ name String?
194
+ posts Post[]
195
+ @@map("users")
196
+ }
197
+
198
+ model Post {
199
+ id ObjectId @id @map("_id")
200
+ title String
201
+ content String?
202
+ author User @relation(fields: [authorId], references: [id])
203
+ authorId ObjectId
204
+ @@map("posts")
205
+ }
206
+ `;
207
+ }
208
+ function starterSchemaTsPostgres(builder) {
209
+ return `import { defineContract } from '${builder}';
210
+
211
+ export const contract = defineContract(
212
+ {},
213
+ ({ field, model, rel }) => ({
214
+ models: {
215
+ User: model('User', {
216
+ fields: {
217
+ id: field.id.uuidv7String(),
218
+ email: field.text().unique(),
219
+ username: field.text().optional(),
220
+ name: field.text().optional(),
221
+ createdAt: field.temporal.createdAt(),
222
+ updatedAt: field.temporal.updatedAt(),
223
+ },
224
+ relations: {
225
+ posts: rel.hasMany('Post', { by: 'authorId' }),
226
+ },
227
+ }),
228
+
229
+ Post: model('Post', {
230
+ fields: {
231
+ id: field.id.uuidv7String(),
232
+ title: field.text(),
233
+ content: field.text().optional(),
234
+ authorId: field.uuidString(),
235
+ createdAt: field.temporal.createdAt(),
236
+ updatedAt: field.temporal.updatedAt(),
237
+ },
238
+ relations: {
239
+ author: rel.belongsTo('User', { from: 'authorId', to: 'id' }),
240
+ },
241
+ }),
242
+ },
243
+ }),
244
+ );
245
+ `;
246
+ }
247
+ function starterSchemaTsMongo(builder) {
248
+ return `import { defineContract } from '${builder}';
249
+
250
+ export const contract = defineContract(
251
+ {},
252
+ ({ field, model, rel }) => ({
253
+ models: {
254
+ User: model('User', {
255
+ collection: 'users',
256
+ fields: {
257
+ _id: field.objectId(),
258
+ email: field.string(),
259
+ username: field.string().optional(),
260
+ name: field.string().optional(),
261
+ },
262
+ relations: {
263
+ posts: rel.hasMany('Post', { from: '_id', to: 'authorId' }),
264
+ },
265
+ }),
266
+
267
+ Post: model('Post', {
268
+ collection: 'posts',
269
+ fields: {
270
+ _id: field.objectId(),
271
+ title: field.string(),
272
+ content: field.string().optional(),
273
+ authorId: field.objectId(),
274
+ },
275
+ relations: {
276
+ author: rel.belongsTo('User', { from: 'authorId', to: '_id' }),
277
+ },
278
+ }),
279
+ },
280
+ }),
281
+ );
282
+ `;
283
+ }
284
+ function configFile(target, contractPath, resolveImportSpecifier = keepInternalSpecifiers) {
285
+ return `import 'dotenv/config';
286
+ import { defineConfig } from '${targetEntrypoint(target, "config", resolveImportSpecifier)}';
287
+
288
+ export default defineConfig({
289
+ contract: ${JSON.stringify(contractPath)},
290
+ db: {
291
+ connection: process.env['DATABASE_URL']!,
292
+ },
293
+ });
294
+ `;
295
+ }
296
+ function dbFile(target, resolveImportSpecifier = keepInternalSpecifiers) {
297
+ const runtime = targetEntrypoint(target, "runtime", resolveImportSpecifier);
298
+ if (target === "postgres") return `import postgres from '${runtime}';
299
+ import type { Contract } from './contract.d';
300
+ import contractJson from './contract.json' with { type: 'json' };
301
+
302
+ export const db = postgres<Contract>({
303
+ contractJson,
304
+ url: process.env['DATABASE_URL']!,
305
+ });
306
+ `;
307
+ return `import mongo from '${runtime}';
308
+ import type { Contract } from './contract.d';
309
+ import contractJson from './contract.json' with { type: 'json' };
310
+
311
+ export const db = mongo<Contract>({
312
+ contractJson,
313
+ url: process.env['DATABASE_URL']!,
314
+ });
315
+ `;
316
+ }
317
+ function createInitCommand() {
318
+ const command = new Command("init");
319
+ setCommandDescriptions(command, "Initialize a new Prisma Next project", `Scaffolds config, schema, and runtime files, installs dependencies,
320
+ and emits the contract. Gets you from zero to typed queries in one step.
321
+
322
+ Run interactively for a guided experience, or supply --target / --authoring
323
+ and --yes for a fully scriptable run (CI, AI coding agents, automation).
324
+
325
+ Exit codes (see CLI Style Guide § Exit Codes):
326
+ 0 OK Init succeeded.\n 1 INTERNAL_ERROR Unexpected bug in prisma-next (please report).\n 2 PRECONDITION Bad flags / missing prerequisite (e.g. no package.json).\n 3 USER_ABORTED User cancelled an interactive prompt.\n 4 INSTALL_FAILED Dependency installation failed (init-specific).\n 5 EMIT_FAILED \`contract emit\` failed after install (init-specific).\n 6 SKILL_INSTALL_FAILED Agent-skill install failed (re-run with --no-skill to skip).`);
327
+ setCommandExamples(command, [
328
+ "prisma-next init",
329
+ "prisma-next init --yes --target postgres --authoring psl",
330
+ "prisma-next init --yes --target mongodb --authoring typescript --json",
331
+ "prisma-next init --yes --force --target postgres --authoring psl # overwrite an existing scaffold",
332
+ "prisma-next init --no-install # skip pnpm/npm install + emit",
333
+ "prisma-next init --no-skill # skip the skills install (air-gapped / restricted env)"
334
+ ]);
335
+ return addGlobalOptions(command).option("--target <db>", "Database target: postgres or mongodb").option("--authoring <style>", "Schema authoring style: psl or typescript").option("--schema-path <path>", `Where to write the starter schema (default: ${defaultSchemaPath("psl")})`).option("--force", "Overwrite an existing scaffold without prompting").option("--write-env", "Write a .env file from .env.example (gitignored; default: only .env.example)").option("--probe-db", "Connect to DATABASE_URL once and check the server version against the target minimum (opt-in; off by default)").option("--strict-probe", "Treat a failed --probe-db as fatal (no-op without --probe-db; init is offline-by-default)").option("--no-install", "Skip dependency installation and contract emission").option("--no-skill", "Skip Prisma Next skills install (air-gapped CI, restricted registries, etc.)").action(async (options) => {
336
+ const { runInit } = await import("./init-DHctXAI9-DSlaaYXN.mjs");
337
+ const flags = parseGlobalFlagsOrExit(options);
338
+ const canPrompt = deriveCanPrompt({
339
+ flagsInteractive: flags.interactive,
340
+ optionInteractive: options.interactive,
341
+ stdinIsTTY: Boolean(process.stdin.isTTY)
342
+ });
343
+ const exitCode = await runInit(process.cwd(), {
344
+ options,
345
+ flags,
346
+ canPrompt
347
+ });
348
+ process.exit(exitCode);
349
+ });
350
+ }
351
+ function createLspCommand() {
352
+ const command = new Command("lsp");
353
+ setCommandDescriptions(command, "Start the Prisma Next language server", "Launches a Language Server Protocol server that publishes PSL parse diagnostics\nand handles whole-document PSL formatting for the schema inputs declared in\nyour config (contract.source.inputs). Formatting uses the Prisma Next PSL\nformatter and the formatter block from the project config.\nCommunicates over stdio; intended to be spawned by an\neditor, not run interactively. The server keeps running until the editor client\ndisconnects.");
354
+ setCommandExamples(command, ["prisma-next lsp --stdio"]);
355
+ addGlobalOptions(command).option("--stdio", "Communicate with the editor over stdio (the default and only transport)").action(async () => {
356
+ const { startServer } = await import("./exports-B_xhKZmC.mjs");
357
+ startServer();
358
+ });
359
+ return command;
360
+ }
361
+ /**
362
+ * Suggests similar command names for a mistyped input.
363
+ *
364
+ * Uses Levenshtein distance to find close matches. Only suggests commands
365
+ * within a reasonable distance threshold (40% of the input length, minimum 2).
366
+ * Returns up to 3 suggestions in case of ties.
367
+ *
368
+ * @returns Array of suggested command names (empty if nothing is close enough).
369
+ */
370
+ function suggestCommands(input, candidates) {
371
+ if (candidates.length === 0) return [];
372
+ const maxDistance = Math.max(2, Math.ceil(input.length * .4));
373
+ const scored = candidates.map((name) => ({
374
+ name,
375
+ dist: distance(input, name)
376
+ })).filter((entry) => entry.dist <= maxDistance).sort((a, b) => a.dist - b.dist);
377
+ if (scored.length === 0) return [];
378
+ const bestDist = scored[0].dist;
379
+ return scored.filter((entry) => entry.dist === bestDist).slice(0, 3).map((entry) => entry.name);
380
+ }
381
+ /**
382
+ * Resolve the commander command path from a leaf `Command`, walking up
383
+ * the parent chain. Result is rooted at the program name and ends at
384
+ * the leaf — `['prisma-next', 'migration', 'new']` for
385
+ * `prisma-next migration new …`.
386
+ */
387
+ function commandPathFor(actionCommand) {
388
+ const path = [];
389
+ let cursor = actionCommand;
390
+ while (cursor !== null) {
391
+ path.unshift(cursor.name());
392
+ cursor = cursor.parent;
393
+ }
394
+ return path;
395
+ }
396
+ function commanderOptionSnapshots(actionCommand) {
397
+ return actionCommand.options.map((option) => {
398
+ const attributeName = option.attributeName();
399
+ return {
400
+ attributeName,
401
+ longName: option.long ?? null,
402
+ source: actionCommand.getOptionValueSource(attributeName) ?? null
403
+ };
404
+ });
405
+ }
406
+ /**
407
+ * Project commander's leaf `Command` into the wire-shape snapshot the
408
+ * telemetry sanitiser consumes. Pure projection — no env, no I/O.
409
+ */
410
+ function commanderSnapshotForTelemetry(actionCommand) {
411
+ return {
412
+ commandPath: commandPathFor(actionCommand),
413
+ positionalArgs: actionCommand.args,
414
+ options: commanderOptionSnapshots(actionCommand)
415
+ };
416
+ }
417
+ function resolveTelemetryGate() {
418
+ if (isCI$1()) return {
419
+ enabled: false,
420
+ outcome: {
421
+ spawned: false,
422
+ reason: "ci"
423
+ }
424
+ };
425
+ const userConfig = readUserConfig();
426
+ if (!resolveGating({
427
+ env: process.env,
428
+ config: userConfig
429
+ }).enabled) return {
430
+ enabled: false,
431
+ outcome: {
432
+ spawned: false,
433
+ reason: "gated-off"
434
+ }
435
+ };
436
+ return {
437
+ enabled: true,
438
+ userConfig
439
+ };
440
+ }
441
+ /**
442
+ * Path to the compiled sender script inside `@internal/cli-telemetry`'s
443
+ * `dist/`. Resolved off this module's `import.meta.url` via the package
444
+ * specifier `@internal/cli-telemetry/sender`, so the consumer pays
445
+ * no attention to internal package layout.
446
+ */
447
+ function senderPath() {
448
+ return fileURLToPath(new URL(import.meta.resolve("@internal/cli-telemetry/sender")));
449
+ }
450
+ function fireTelemetry(actionCommand, userConfig) {
451
+ return runTelemetry({
452
+ command: commanderSnapshotForTelemetry(actionCommand),
453
+ version,
454
+ projectRoot: process.cwd(),
455
+ senderPath: senderPath(),
456
+ isCI: isCI$1(),
457
+ env: process.env,
458
+ userConfig
459
+ });
460
+ }
461
+ /**
462
+ * preAction-stage entry point. Synchronous by construction: resolve
463
+ * env/CI/user-consent gates (cheap, all in-memory and a single tiny
464
+ * user-config read), then — only when enabled — `fork()` the detached
465
+ * sender script. The forked child loads `prisma-next.config.*` via
466
+ * c12 on its own (see `loadProjectConfig` in cli-telemetry); the
467
+ * parent does no project-config I/O on the command's hot path.
468
+ *
469
+ * Privacy invariant: gate resolution always happens before any project
470
+ * config touches disk. The child loading user TS code is acceptable
471
+ * only because it's gated behind the same resolved-enabled signal.
472
+ */
473
+ /**
474
+ * Builds the one-time first-run disclosure. The resolved absolute path to
475
+ * the user-level config file is substituted in so the user can see exactly
476
+ * which file to edit (it must not be confused with `prisma-next.config.ts`).
477
+ * `prisma-next telemetry disable` is named as the primary, friendliest
478
+ * opt-out, alongside the env vars and the config edit.
479
+ */
480
+ function firstRunNotice(configPath) {
481
+ return [
482
+ "Prisma Next collects anonymous CLI usage data, enabled by default.",
483
+ "What's collected and why: https://prisma-next.dev/docs/cli/telemetry.",
484
+ "Opt out: run \"prisma-next telemetry disable\", set DO_NOT_TRACK=1 or",
485
+ `PRISMA_NEXT_DISABLE_TELEMETRY=1, or set "enableTelemetry": false in ${configPath}.`
486
+ ].join(" ");
487
+ }
488
+ /**
489
+ * Best-effort first-run disclosure + installationId mint. Runs only on the
490
+ * gating-enabled path. Prints the notice to stderr (never stdout) and mints
491
+ * a persistent id without touching `enableTelemetry`, so the opt-out default
492
+ * stays intact and no unasked-for consent is recorded.
493
+ *
494
+ * Every step is wrapped so an un-writable config dir (or any other failure)
495
+ * never throws and never blocks the command. Returns the minted (or
496
+ * pre-existing) id so the caller can forward it to `runTelemetry` without a
497
+ * redundant disk read. On mint failure it returns `undefined`: the notice may
498
+ * reprint next run, and `runTelemetry` no-ops on the missing id.
499
+ */
500
+ function discloseAndMintOnFirstRun() {
501
+ try {
502
+ process.stderr.write(`${firstRunNotice(userConfigPath())}\n`);
503
+ } catch {}
504
+ try {
505
+ return ensureInstallationId();
506
+ } catch {}
507
+ }
508
+ /**
509
+ * True when the run is the `telemetry` command (or one of its
510
+ * subcommands). The usage-telemetry preAction fire is exempted for it:
511
+ * it would be absurd for `telemetry disable` to send a usage event before
512
+ * disabling, or for `telemetry status` to mint an id + send while merely
513
+ * reporting state. This is the only command-specific exemption.
514
+ *
515
+ * The check is rooted at the program: the path must be
516
+ * `['prisma-next', 'telemetry', …]`, so it matches the top-level
517
+ * `telemetry` command and its subcommands without matching a hypothetical
518
+ * nested `… telemetry` elsewhere.
519
+ */
520
+ function isTelemetryCommand(actionCommand) {
521
+ return commandPathFor(actionCommand)[1] === "telemetry";
522
+ }
523
+ function fireTelemetryFromPreAction(actionCommand) {
524
+ if (isTelemetryCommand(actionCommand)) return {
525
+ spawned: false,
526
+ reason: "gated-off"
527
+ };
528
+ const gate = resolveTelemetryGate();
529
+ if (!gate.enabled) return gate.outcome;
530
+ const storedId = gate.userConfig.installationId;
531
+ if (typeof storedId !== "string" || storedId.length === 0) {
532
+ const installationId = discloseAndMintOnFirstRun();
533
+ return fireTelemetry(actionCommand, installationId === void 0 ? gate.userConfig : {
534
+ ...gate.userConfig,
535
+ installationId
536
+ });
537
+ }
538
+ return fireTelemetry(actionCommand, gate.userConfig);
539
+ }
540
+ installShutdownHandlers();
541
+ /**
542
+ * Lookup table mapping removed subcommands to their replacement verbs.
543
+ * Keyed by `<parent>:<subcommand>` (e.g. `migration:apply`).
544
+ * The handler consults this before falling back to the fuzzy suggest engine.
545
+ */
546
+ const removedVerbRedirects = {
547
+ "migration:apply": "Use `prisma-next migrate --to <contract>` instead.",
548
+ "migration:ref": "Use `prisma-next ref set|list|delete` instead."
549
+ };
550
+ /**
551
+ * Removed flags on specific subcommands. Keyed by `<parent>:<sub>:<flag>`.
552
+ * Checked during the pre-parse argv scan before commander sees the flags.
553
+ */
554
+ const removedFlagRedirects = {
555
+ "migration:status:graph": "Use `prisma-next migration graph` to view the migration graph.",
556
+ "migration:status:all": "Use `prisma-next migration log --db <url>` to view the full execution history.",
557
+ "migration:status:limit": "Use `prisma-next migration log --db <url>` to view the full execution history.",
558
+ "migration:status:ref": "Use `--to <contract>` instead of `--ref`."
559
+ };
560
+ /**
561
+ * Formats the "Did you mean ...?" hint for an unknown command.
562
+ */
563
+ function formatSuggestion(input, candidates) {
564
+ const suggestions = suggestCommands(input, candidates.map((c) => c));
565
+ if (suggestions.length === 0) return "";
566
+ if (suggestions.length === 1) return `\nDid you mean ${suggestions[0]}?\n`;
567
+ return `\nDid you mean one of these?\n${suggestions.map((s) => ` ${s}`).join("\n")}\n`;
568
+ }
569
+ const program = new Command();
570
+ program.name("prisma-next").description("Prisma Next CLI").version(version);
571
+ program.hook("preAction", (_thisCommand, actionCommand) => {
572
+ try {
573
+ fireTelemetryFromPreAction(actionCommand);
574
+ } catch {}
575
+ });
576
+ const versionOption = program.options.find((opt) => opt.flags.includes("--version"));
577
+ if (versionOption) versionOption.description = "Output the version number";
578
+ program.configureOutput({
579
+ writeErr: () => {},
580
+ writeOut: (str) => {
581
+ process.stdout.write(str);
582
+ }
583
+ });
584
+ const rootHelpFormatter = (cmd) => {
585
+ return formatRootHelp({
586
+ program: cmd,
587
+ flags: parseGlobalFlags({})
588
+ });
589
+ };
590
+ program.configureHelp({
591
+ formatHelp: rootHelpFormatter,
592
+ subcommandDescription: () => ""
593
+ });
594
+ program.exitOverride((err) => {
595
+ if (err) {
596
+ const errorCode = err.code;
597
+ const errorMessage = String(err.message ?? "");
598
+ const errorName = err.name ?? "";
599
+ if (errorCode === "commander.unknownCommand" || errorCode === "commander.unknownArgument" || errorName === "CommanderError" && (errorMessage.includes("unknown command") || errorMessage.includes("unknown argument"))) {
600
+ const flags = parseGlobalFlags({});
601
+ const match = errorMessage.match(/unknown command ['"]([^'"]+)['"]/);
602
+ const commandName = match ? match[1] : process.argv[3] || process.argv[2] || "unknown";
603
+ const firstArg = process.argv[2];
604
+ const parentCommand = firstArg ? program.commands.find((cmd) => cmd.name() === firstArg) : void 0;
605
+ if (parentCommand && commandName !== firstArg) {
606
+ const subNames = parentCommand.commands.map((c) => c.name());
607
+ process.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, subNames)}\n`);
608
+ const helpText = formatCommandHelp({
609
+ command: parentCommand,
610
+ flags
611
+ });
612
+ process.stderr.write(`${helpText}\n`);
613
+ } else {
614
+ const topNames = program.commands.map((c) => c.name());
615
+ process.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, topNames)}\n`);
616
+ const helpText = formatRootHelp({
617
+ program,
618
+ flags
619
+ });
620
+ process.stderr.write(`${helpText}\n`);
621
+ }
622
+ process.exit(2);
623
+ return;
624
+ }
625
+ if (errorCode === "commander.help" || errorCode === "commander.helpDisplayed" || errorCode === "outputHelp" || errorMessage === "(outputHelp)" || errorMessage.includes("outputHelp") || errorName === "CommanderError" && errorMessage.includes("outputHelp")) {
626
+ process.exit(0);
627
+ return;
628
+ }
629
+ if (errorCode === "commander.missingArgument" || errorCode === "commander.missingMandatoryOptionValue" || errorName === "CommanderError" && (errorMessage.includes("missing") || errorMessage.includes("required"))) {
630
+ process.exit(2);
631
+ return;
632
+ }
633
+ process.stderr.write(`Unhandled error: ${err.message}\n`);
634
+ if (err.stack) process.stderr.write(`${err.stack}\n`);
635
+ process.exit(1);
636
+ }
637
+ process.exit(0);
638
+ });
639
+ const contractCommand = new Command("contract");
640
+ setCommandDescriptions(contractCommand, "Contract management commands", "Define and emit your application data contract. The contract describes your schema as a\ndeclarative data structure that can be signed and verified against your database.");
641
+ contractCommand.configureHelp({
642
+ formatHelp: (cmd) => {
643
+ return formatCommandHelp({
644
+ command: cmd,
645
+ flags: parseGlobalFlags({})
646
+ });
647
+ },
648
+ subcommandDescription: () => ""
649
+ });
650
+ const contractEmitCommand = createContractEmitCommand();
651
+ contractCommand.addCommand(contractEmitCommand);
652
+ const contractInferCommand = createContractInferCommand();
653
+ contractCommand.addCommand(contractInferCommand);
654
+ const dbCommand = new Command("db");
655
+ setCommandDescriptions(dbCommand, "Database management commands", "Verify and sign your database with your contract. Ensure your database schema matches\nyour contract, and sign it to record the contract hash for future verification.");
656
+ dbCommand.configureHelp({
657
+ formatHelp: (cmd) => {
658
+ return formatCommandHelp({
659
+ command: cmd,
660
+ flags: parseGlobalFlags({})
661
+ });
662
+ },
663
+ subcommandDescription: () => ""
664
+ });
665
+ const dbVerifyCommand = createDbVerifyCommand();
666
+ dbCommand.addCommand(dbVerifyCommand);
667
+ const dbInitCommand = createDbInitCommand();
668
+ dbCommand.addCommand(dbInitCommand);
669
+ const dbUpdateCommand = createDbUpdateCommand();
670
+ dbCommand.addCommand(dbUpdateCommand);
671
+ const dbSchemaCommand = createDbSchemaCommand();
672
+ dbCommand.addCommand(dbSchemaCommand);
673
+ const dbSignCommand = createDbSignCommand();
674
+ dbCommand.addCommand(dbSignCommand);
675
+ const migrationCommand = new Command("migration");
676
+ setCommandDescriptions(migrationCommand, "On-disk migration management commands", "Plan, apply, and scaffold on-disk migration packages. Migrations are\ncontract-to-contract edges stored as versioned directories under migrations/.");
677
+ migrationCommand.configureHelp({
678
+ formatHelp: (cmd) => {
679
+ return formatCommandHelp({
680
+ command: cmd,
681
+ flags: parseGlobalFlags({})
682
+ });
683
+ },
684
+ subcommandDescription: () => ""
685
+ });
686
+ const migrationPlanCommand = createMigrationPlanCommand();
687
+ migrationCommand.addCommand(migrationPlanCommand);
688
+ const migrationNewCommand = createMigrationNewCommand();
689
+ migrationCommand.addCommand(migrationNewCommand);
690
+ const migrationShowCommand = createMigrationShowCommand();
691
+ migrationCommand.addCommand(migrationShowCommand);
692
+ const migrationStatusCommand = createMigrationStatusCommand();
693
+ migrationCommand.addCommand(migrationStatusCommand);
694
+ const migrationLogCommand = createMigrationLogCommand();
695
+ migrationCommand.addCommand(migrationLogCommand);
696
+ const migrationListCommand = createMigrationListCommand();
697
+ migrationCommand.addCommand(migrationListCommand);
698
+ const migrationGraphCommand = createMigrationGraphCommand();
699
+ migrationCommand.addCommand(migrationGraphCommand);
700
+ const migrationCheckCommand = createMigrationCheckCommand();
701
+ migrationCommand.addCommand(migrationCheckCommand);
702
+ const migrateCommand = createMigrateCommand();
703
+ const refCommand = createRefCommand();
704
+ const telemetryCommand = createTelemetryCommand();
705
+ const initCommand = createInitCommand();
706
+ const formatCommand = createFormatCommand();
707
+ const lspCommand = createLspCommand();
708
+ program.addCommand(initCommand);
709
+ program.addCommand(migrateCommand);
710
+ program.addCommand(formatCommand);
711
+ program.addCommand(lspCommand);
712
+ program.addCommand(contractCommand);
713
+ program.addCommand(dbCommand);
714
+ program.addCommand(migrationCommand);
715
+ program.addCommand(refCommand);
716
+ program.addCommand(telemetryCommand);
717
+ const TELEMETRY_CRASH_TEST_SLEEP_MS = 200;
718
+ if (process.env["PRISMA_NEXT_ENABLE_TEST_COMMANDS"] === "1") {
719
+ const telemetryCrashTestCommand = new Command("__telemetry-crash-test").description("Internal: deliberately throw for the telemetry e2e suite.").action(async () => {
720
+ await new Promise((settle) => setTimeout(settle, TELEMETRY_CRASH_TEST_SLEEP_MS));
721
+ throw new Error("__telemetry-crash-test: intentional crash for e2e coverage");
722
+ });
723
+ telemetryCrashTestCommand.configureHelp({ visibleCommands: () => [] });
724
+ program.addCommand(telemetryCrashTestCommand, { hidden: true });
725
+ }
726
+ const helpCommand = new Command("help").description("Show usage instructions").configureHelp({ formatHelp: (cmd) => {
727
+ return formatCommandHelp({
728
+ command: cmd,
729
+ flags: parseGlobalFlags({})
730
+ });
731
+ } }).action(() => {
732
+ const flags = parseGlobalFlags({});
733
+ const helpText = formatRootHelp({
734
+ program,
735
+ flags
736
+ });
737
+ process.stdout.write(`${helpText}\n`);
738
+ process.exit(0);
739
+ });
740
+ program.addCommand(helpCommand);
741
+ program.action(() => {
742
+ const flags = parseGlobalFlags({});
743
+ const helpText = formatRootHelp({
744
+ program,
745
+ flags
746
+ });
747
+ process.stderr.write(`${helpText}\n`);
748
+ process.exit(0);
749
+ });
750
+ const args = process.argv.slice(2);
751
+ if (args.length > 0) {
752
+ const commandName = args[0];
753
+ if (commandName === "--version" || commandName === "-V") {
754
+ process.stdout.write(`${program.version()}\n`);
755
+ process.exit(0);
756
+ }
757
+ if (!(commandName === "--help" || commandName === "-h")) {
758
+ const command = program.commands.find((cmd) => cmd.name() === commandName);
759
+ if (!command) {
760
+ const flags = parseGlobalFlags({});
761
+ const topNames = program.commands.map((c) => c.name());
762
+ process.stderr.write(`Unknown command: ${commandName}${formatSuggestion(commandName, topNames)}\n`);
763
+ const helpText = formatRootHelp({
764
+ program,
765
+ flags
766
+ });
767
+ process.stderr.write(`${helpText}\n`);
768
+ process.exit(2);
769
+ } else if (command.commands.length > 0 && args.length >= 2) {
770
+ const subcommandName = args[1];
771
+ const redirect = removedVerbRedirects[`${commandName}:${subcommandName}`];
772
+ if (redirect) {
773
+ process.stderr.write(`Unknown command: ${subcommandName}\n${redirect}\n`);
774
+ process.exit(2);
775
+ }
776
+ for (let i = 2; i < args.length; i++) {
777
+ const arg = args[i];
778
+ if (!arg.startsWith("--")) continue;
779
+ const flagRedirect = removedFlagRedirects[`${commandName}:${subcommandName}:${arg.slice(2)}`];
780
+ if (flagRedirect) {
781
+ process.stderr.write(`Unknown option: ${arg}\n${flagRedirect}\n`);
782
+ process.exit(2);
783
+ }
784
+ }
785
+ }
786
+ if (command.commands.length > 0 && args.length === 1) {
787
+ const helpText = formatCommandHelp({
788
+ command,
789
+ flags: parseGlobalFlags({})
790
+ });
791
+ process.stderr.write(`${helpText}\n`);
792
+ process.exit(0);
793
+ }
794
+ }
795
+ }
796
+ program.parse();
797
+ //#endregion
798
+ export { schemaSample as a, targetLabel as c, scaffoldSpecifierResolverFor as i, targetPackageName as l, dbFile as n, starterSchema as o, defaultSchemaPath as r, targetEntrypoint as s, configFile as t, version as u };
799
+
800
+ //# sourceMappingURL=bin__prisma-next.mjs.map