sandforge 1.80.0 → 1.82.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 (266) hide show
  1. package/README.md +48 -0
  2. package/bin/sandforge-pipeline.mjs +12 -0
  3. package/bin/sandforge-users.mjs +12 -0
  4. package/lib/{chunk-J525F5KI.mjs → chunk-27Z76O2O.mjs} +1 -1
  5. package/lib/chunk-2JZGCCPG.mjs +9 -0
  6. package/lib/{chunk-ELFXJHU7.mjs → chunk-2UU42PTD.mjs} +1 -1
  7. package/lib/{chunk-N652NMZ4.mjs → chunk-32EUNQT6.mjs} +52 -52
  8. package/lib/chunk-3C2ZZIFN.mjs +7 -0
  9. package/lib/chunk-3CX7GPCR.mjs +7 -0
  10. package/lib/chunk-3HEMJTAP.mjs +925 -0
  11. package/lib/{chunk-BY2HJFFG.mjs → chunk-3HROD5RE.mjs} +1 -1
  12. package/lib/{chunk-OHWNPXWW.mjs → chunk-3MGMNK3Q.mjs} +1 -1
  13. package/lib/{chunk-PZPJKATS.mjs → chunk-3SKLBRPL.mjs} +8 -8
  14. package/lib/chunk-3XG25GTF.mjs +7 -0
  15. package/lib/chunk-42BFLWHR.mjs +7 -0
  16. package/lib/chunk-466F37VD.mjs +7 -0
  17. package/lib/chunk-47UHTN3Q.mjs +7 -0
  18. package/lib/chunk-4JKR4PTZ.mjs +8 -0
  19. package/lib/{chunk-COFG7Q6R.mjs → chunk-52EXDVPN.mjs} +1 -1
  20. package/lib/{chunk-SAR5622P.mjs → chunk-54HYHHVL.mjs} +1 -1
  21. package/lib/{chunk-RSWDYIHY.mjs → chunk-5GBO4KD5.mjs} +1 -1
  22. package/lib/chunk-5K2I2DMP.mjs +11 -0
  23. package/lib/{chunk-AV5SWEHP.mjs → chunk-6FARZYMJ.mjs} +1 -1
  24. package/lib/{chunk-BV6VTP3J.mjs → chunk-6GQUZ4IP.mjs} +1 -1
  25. package/lib/chunk-6KP6WETK.mjs +9 -0
  26. package/lib/{chunk-MJVTDA5Q.mjs → chunk-6VSZNZHH.mjs} +1 -1
  27. package/lib/{chunk-XUWL6ZPC.mjs → chunk-7CVDVBEE.mjs} +1 -1
  28. package/lib/{chunk-UCD54V2M.mjs → chunk-7EYQYZJP.mjs} +1 -1
  29. package/lib/{chunk-5K5VLULK.mjs → chunk-7LKI7OAS.mjs} +1 -1
  30. package/lib/chunk-7PY3VQP3.mjs +7 -0
  31. package/lib/chunk-7SDZR6SR.mjs +7 -0
  32. package/lib/chunk-7WSLT5VX.mjs +8 -0
  33. package/lib/chunk-A32ISQ6M.mjs +28 -0
  34. package/lib/{chunk-M3ROUWDX.mjs → chunk-A65ADTCR.mjs} +1 -1
  35. package/lib/chunk-A7JJWOLT.mjs +7 -0
  36. package/lib/chunk-AUS6NFLZ.mjs +8 -0
  37. package/lib/chunk-BMTNTBBM.mjs +7 -0
  38. package/lib/{chunk-SOU4FRYN.mjs → chunk-BN33LVPQ.mjs} +1 -1
  39. package/lib/chunk-BNKT3R3F.mjs +7 -0
  40. package/lib/{chunk-K2FBZIXY.mjs → chunk-BWWQXU2B.mjs} +1 -1
  41. package/lib/{chunk-IC2C2GOF.mjs → chunk-BXZ73A5M.mjs} +1 -1
  42. package/lib/{chunk-WA7EYLAQ.mjs → chunk-C2N2TNEU.mjs} +1 -1
  43. package/lib/{chunk-BKDV4ENO.mjs → chunk-C3LNYAVJ.mjs} +1 -1
  44. package/lib/{chunk-XLXIPIEW.mjs → chunk-CBL42DUU.mjs} +1 -1
  45. package/lib/chunk-CCEH7L53.mjs +7 -0
  46. package/lib/chunk-CELEBWEZ.mjs +7 -0
  47. package/lib/chunk-CV47FDQW.mjs +7 -0
  48. package/lib/{chunk-2UZPIMUC.mjs → chunk-CZLJZQCS.mjs} +1 -1
  49. package/lib/chunk-DBBPDSFN.mjs +7 -0
  50. package/lib/chunk-DIL62SUN.mjs +7 -0
  51. package/lib/chunk-DIS254AN.mjs +7 -0
  52. package/lib/{chunk-BTWDMNN3.mjs → chunk-DJCGURW7.mjs} +1 -1
  53. package/lib/{chunk-F6GUDTOB.mjs → chunk-DT3T7FRD.mjs} +1 -1
  54. package/lib/{chunk-IGYH7GMA.mjs → chunk-DWMRIWV5.mjs} +1 -1
  55. package/lib/{chunk-YRQGKDHM.mjs → chunk-EEFUE2ES.mjs} +1 -1
  56. package/lib/{chunk-FGRG7ANU.mjs → chunk-EOFO3PHS.mjs} +1 -1
  57. package/lib/{chunk-KBJ5VERV.mjs → chunk-FA4ZKDCU.mjs} +1 -1
  58. package/lib/{chunk-WU3GLFZO.mjs → chunk-FKK5YBGZ.mjs} +1 -1
  59. package/lib/chunk-FOIWWK7G.mjs +156 -0
  60. package/lib/chunk-FZF23M6R.mjs +7 -0
  61. package/lib/chunk-G2JR3F63.mjs +7 -0
  62. package/lib/{chunk-JEERQRLW.mjs → chunk-GBGHJTPC.mjs} +1 -1
  63. package/lib/{chunk-3RZQZHEB.mjs → chunk-GCGHHN4K.mjs} +1 -1
  64. package/lib/{chunk-RPI7LRTW.mjs → chunk-GGNUACTY.mjs} +1 -1
  65. package/lib/{chunk-EMNC6YI4.mjs → chunk-GGUOIDWP.mjs} +1 -1
  66. package/lib/chunk-GHPR5UVV.mjs +7 -0
  67. package/lib/{chunk-X5JYBPXP.mjs → chunk-GJ6SZVHT.mjs} +1 -1
  68. package/lib/{chunk-W622GUAW.mjs → chunk-H4JUYUSL.mjs} +1 -1
  69. package/lib/{chunk-XAMBCQPU.mjs → chunk-H4OBZIX3.mjs} +1 -1
  70. package/lib/{chunk-WIO4XO4F.mjs → chunk-HFSBDM7B.mjs} +1 -1
  71. package/lib/{chunk-L77FJZEP.mjs → chunk-HFUDCNU5.mjs} +1 -1
  72. package/lib/chunk-HIHCYMSL.mjs +7 -0
  73. package/lib/chunk-HKUWHVI7.mjs +9 -0
  74. package/lib/chunk-HQQVANWQ.mjs +20 -0
  75. package/lib/chunk-ICIYL45C.mjs +7 -0
  76. package/lib/chunk-IRZJU2PG.mjs +22 -0
  77. package/lib/chunk-ISSP2FZ5.mjs +7 -0
  78. package/lib/chunk-IVZJSDJD.mjs +7 -0
  79. package/lib/chunk-J24TIGSI.mjs +10 -0
  80. package/lib/{chunk-UNJA4J37.mjs → chunk-JESRFE2Z.mjs} +4 -4
  81. package/lib/chunk-JFNLKHY6.mjs +8 -0
  82. package/lib/chunk-JH27IKCO.mjs +9 -0
  83. package/lib/chunk-JJITOWZK.mjs +7 -0
  84. package/lib/{chunk-E5AHXLS6.mjs → chunk-JKT5YAQ2.mjs} +1 -1
  85. package/lib/{chunk-IWDREM66.mjs → chunk-JLZRZL5E.mjs} +1 -1
  86. package/lib/{chunk-FPKYYFM7.mjs → chunk-JPEVIXNH.mjs} +1 -1
  87. package/lib/chunk-JQZTMFO7.mjs +7 -0
  88. package/lib/chunk-KIMQQ6JQ.mjs +7 -0
  89. package/lib/{chunk-MILU7WFN.mjs → chunk-KJYEQHYP.mjs} +1 -1
  90. package/lib/chunk-KKOA62S4.mjs +474 -0
  91. package/lib/chunk-KP5G6FUC.mjs +7 -0
  92. package/lib/{chunk-JWTSEDIQ.mjs → chunk-L4INJ5TZ.mjs} +1 -1
  93. package/lib/{chunk-OLSGVAIL.mjs → chunk-LAUOSXMN.mjs} +53 -53
  94. package/lib/{chunk-MTMH6H2A.mjs → chunk-LCDPCUXS.mjs} +1 -1
  95. package/lib/{chunk-KDGMAGQR.mjs → chunk-LHU6CPGE.mjs} +1 -1
  96. package/lib/{chunk-YAZO75G2.mjs → chunk-LNXBCE7E.mjs} +1 -1
  97. package/lib/chunk-LXDSRP2W.mjs +7 -0
  98. package/lib/{chunk-2YIV2OB2.mjs → chunk-MIDBQ7SD.mjs} +1 -1
  99. package/lib/{chunk-TTKXMDBN.mjs → chunk-MKTXJCXN.mjs} +4 -4
  100. package/lib/chunk-MUEQRIK7.mjs +9 -0
  101. package/lib/{chunk-IOIWJ3DJ.mjs → chunk-NLB3RGIY.mjs} +1 -1
  102. package/lib/{chunk-O2HDYYUV.mjs → chunk-NWOI25WY.mjs} +1 -1
  103. package/lib/chunk-O2PUGRNW.mjs +10 -0
  104. package/lib/chunk-O4BROUGM.mjs +7 -0
  105. package/lib/chunk-OETEC3P7.mjs +7 -0
  106. package/lib/{chunk-GCOB7K5N.mjs → chunk-OHEOJISY.mjs} +1 -1
  107. package/lib/chunk-P55MKIZX.mjs +37 -0
  108. package/lib/chunk-P63WJMXQ.mjs +7 -0
  109. package/lib/chunk-PBE44M2Y.mjs +7 -0
  110. package/lib/{chunk-TYYOBZMU.mjs → chunk-PC247GKX.mjs} +1 -1
  111. package/lib/chunk-PE435FVH.mjs +15 -0
  112. package/lib/chunk-PPGDAUEQ.mjs +7 -0
  113. package/lib/{chunk-SE4QEZUG.mjs → chunk-PPHVWUFY.mjs} +1 -1
  114. package/lib/{chunk-CU2INBND.mjs → chunk-PR74GYVI.mjs} +1 -1
  115. package/lib/chunk-PWVDNN2C.mjs +7 -0
  116. package/lib/{chunk-6XYKJSGX.mjs → chunk-PYRZFUVU.mjs} +1 -1
  117. package/lib/{chunk-TLH7AD35.mjs → chunk-PZBZ7MNC.mjs} +1 -1
  118. package/lib/{chunk-DYFALGRT.mjs → chunk-Q3DY7TO2.mjs} +1 -1
  119. package/lib/{chunk-BGUEWRK2.mjs → chunk-Q6SXNKV2.mjs} +1 -1
  120. package/lib/chunk-QAPVKPEC.mjs +7 -0
  121. package/lib/{chunk-DBFJB2B6.mjs → chunk-QIRO4HTE.mjs} +1 -1
  122. package/lib/{chunk-TSLJUSLW.mjs → chunk-RCYEBY42.mjs} +1 -1
  123. package/lib/chunk-RLWB7F26.mjs +7 -0
  124. package/lib/{chunk-FXXLX4O6.mjs → chunk-RTWYLOCA.mjs} +1 -1
  125. package/lib/chunk-RYRMUPMY.mjs +7 -0
  126. package/lib/chunk-SAMWHL22.mjs +13 -0
  127. package/lib/{chunk-IZQZ6ZUF.mjs → chunk-SFGZFB4F.mjs} +1 -1
  128. package/lib/{chunk-FKG7Q3WH.mjs → chunk-SNEOKYV7.mjs} +1 -1
  129. package/lib/{chunk-3TJON4F3.mjs → chunk-STRMWSIQ.mjs} +1 -1
  130. package/lib/chunk-SZGGFST2.mjs +272 -0
  131. package/lib/{chunk-SOGQW4IG.mjs → chunk-T7WREYA5.mjs} +1 -1
  132. package/lib/{chunk-NTFIRZP6.mjs → chunk-TCBAE65A.mjs} +1 -1
  133. package/lib/{chunk-KYEDBS54.mjs → chunk-TEIBWMJM.mjs} +1 -1
  134. package/lib/{chunk-YKKRIEH4.mjs → chunk-TMA34QMA.mjs} +1 -1
  135. package/lib/chunk-TQ2TQHTT.mjs +9 -0
  136. package/lib/{chunk-HEKAZJRH.mjs → chunk-TWV4A5RK.mjs} +1 -1
  137. package/lib/{chunk-CEX3NEZL.mjs → chunk-UHFLKP26.mjs} +1 -1
  138. package/lib/chunk-UV74P4H2.mjs +7 -0
  139. package/lib/{chunk-WR4Q363I.mjs → chunk-V3R45ZWT.mjs} +1 -1
  140. package/lib/{chunk-GSKCGQIP.mjs → chunk-VPDEJGPS.mjs} +1 -1
  141. package/lib/{chunk-HLWMJF6Y.mjs → chunk-VQJMP3DC.mjs} +1 -1
  142. package/lib/chunk-VV3B6IC3.mjs +7 -0
  143. package/lib/{chunk-PJ5I73CK.mjs → chunk-VYOYXTCU.mjs} +1 -1
  144. package/lib/{chunk-NZC67CGR.mjs → chunk-VZT4E2OJ.mjs} +1 -1
  145. package/lib/{chunk-AEKONPF4.mjs → chunk-VZVICK7Q.mjs} +1 -1
  146. package/lib/{chunk-WR2GIKWE.mjs → chunk-WB2RIVO3.mjs} +1 -1
  147. package/lib/chunk-WEMLDUQA.mjs +7 -0
  148. package/lib/{chunk-MYW5QNGI.mjs → chunk-WOOUISSO.mjs} +1 -1
  149. package/lib/{chunk-G35N4P7D.mjs → chunk-WSUKC2U3.mjs} +1 -1
  150. package/lib/{chunk-ZVAED4QV.mjs → chunk-WT3SCUHS.mjs} +1 -1
  151. package/lib/{chunk-7EANH5PY.mjs → chunk-WZQEK4WT.mjs} +1 -1
  152. package/lib/{chunk-DBB3EMIN.mjs → chunk-XFU3HRUV.mjs} +1 -1
  153. package/lib/chunk-XK5W7BVE.mjs +7 -0
  154. package/lib/{chunk-2GTBABKU.mjs → chunk-XO5FBOQF.mjs} +1 -1
  155. package/lib/{chunk-CHYDMRSV.mjs → chunk-XSKPYGMT.mjs} +1 -1
  156. package/lib/chunk-XU25YA46.mjs +9 -0
  157. package/lib/chunk-XZISAZA6.mjs +7 -0
  158. package/lib/chunk-Y4TDVDP2.mjs +13 -0
  159. package/lib/chunk-YAIIRFKJ.mjs +8 -0
  160. package/lib/{chunk-LKQ5RKIV.mjs → chunk-YAJQS3OL.mjs} +1 -1
  161. package/lib/{chunk-74Q6DORA.mjs → chunk-YGJF55VJ.mjs} +1 -1
  162. package/lib/chunk-YH4DYI6D.mjs +7 -0
  163. package/lib/chunk-YMDFF657.mjs +10 -0
  164. package/lib/{chunk-2BA2XKAY.mjs → chunk-YT22LMF7.mjs} +1 -1
  165. package/lib/{chunk-IG2MTQRP.mjs → chunk-Z42PHCVZ.mjs} +1 -1
  166. package/lib/{chunk-2NBYT7GR.mjs → chunk-ZHIZY3ZC.mjs} +1 -1
  167. package/lib/chunk-ZQO5PDX5.mjs +48 -0
  168. package/lib/chunk-ZRUDYB7O.mjs +7 -0
  169. package/lib/{chunk-BXU6WFMH.mjs → chunk-ZUBBEP75.mjs} +1 -1
  170. package/lib/chunk-ZUOPC4W2.mjs +7 -0
  171. package/lib/{chunk-GGD7ON3M.mjs → chunk-ZUTUYBNW.mjs} +1 -1
  172. package/lib/{chunk-MHMH6MTP.mjs → chunk-ZXFL2MSN.mjs} +1 -1
  173. package/lib/sandforge-autopilot.mjs +11 -11
  174. package/lib/sandforge-backup.mjs +63 -32
  175. package/lib/sandforge-checkpoint.mjs +1 -348
  176. package/lib/sandforge-cleanup.mjs +1 -1
  177. package/lib/sandforge-clone.mjs +1 -1
  178. package/lib/sandforge-compare.mjs +1 -1
  179. package/lib/sandforge-dataops.mjs +1 -1
  180. package/lib/sandforge-empty.mjs +11 -11
  181. package/lib/sandforge-env.mjs +186 -140
  182. package/lib/sandforge-frozen.mjs +1 -266
  183. package/lib/sandforge-mcp.mjs +33 -14
  184. package/lib/sandforge-monitor.mjs +1 -1
  185. package/lib/sandforge-pipeline.mjs +88 -0
  186. package/lib/sandforge-seed.mjs +1 -1
  187. package/lib/sandforge-sync.mjs +1 -1
  188. package/lib/sandforge-users.mjs +157 -0
  189. package/lib/sandforge.mjs +1 -22
  190. package/lib/sf/sandforge/autopilot.mjs +20 -0
  191. package/lib/sf/sandforge/backup.mjs +20 -0
  192. package/lib/sf/sandforge/checkpoint.mjs +20 -0
  193. package/lib/sf/sandforge/cleanup.mjs +20 -0
  194. package/lib/sf/sandforge/clone.mjs +20 -0
  195. package/lib/sf/sandforge/compare.mjs +20 -0
  196. package/lib/sf/sandforge/dataops.mjs +20 -0
  197. package/lib/sf/sandforge/empty.mjs +20 -0
  198. package/lib/sf/sandforge/env.mjs +20 -0
  199. package/lib/sf/sandforge/frozen.mjs +20 -0
  200. package/lib/sf/sandforge/hardis-commands.mjs +20 -0
  201. package/lib/sf/sandforge/index.mjs +20 -0
  202. package/lib/sf/sandforge/mcp.mjs +20 -0
  203. package/lib/sf/sandforge/monitor.mjs +20 -0
  204. package/lib/sf/sandforge/pipeline.mjs +20 -0
  205. package/lib/sf/sandforge/seed.mjs +20 -0
  206. package/lib/sf/sandforge/sync.mjs +20 -0
  207. package/lib/sf/sandforge/users.mjs +20 -0
  208. package/lib/sfHelpHook.mjs +7 -0
  209. package/lib/sfPlugin.mjs +11 -0
  210. package/oclif.manifest.json +1 -0
  211. package/package.json +18 -3
  212. package/lib/chunk-2CNCDM56.mjs +0 -7
  213. package/lib/chunk-3F6Q5E7I.mjs +0 -14
  214. package/lib/chunk-4VS2V6WU.mjs +0 -25
  215. package/lib/chunk-5P4PHJRL.mjs +0 -9
  216. package/lib/chunk-5TC3QB4U.mjs +0 -10
  217. package/lib/chunk-7ABODJ4G.mjs +0 -7
  218. package/lib/chunk-7EGQP6S4.mjs +0 -7
  219. package/lib/chunk-7FFGJWHN.mjs +0 -7
  220. package/lib/chunk-7YDNUBO5.mjs +0 -7
  221. package/lib/chunk-A527W53V.mjs +0 -7
  222. package/lib/chunk-ADOAS63R.mjs +0 -7
  223. package/lib/chunk-B5QQJ4SI.mjs +0 -7
  224. package/lib/chunk-CION3VMZ.mjs +0 -7
  225. package/lib/chunk-CSBS5U5I.mjs +0 -7
  226. package/lib/chunk-DB7RBE5D.mjs +0 -7
  227. package/lib/chunk-E5ZB3LU5.mjs +0 -7
  228. package/lib/chunk-EFR2Y7E4.mjs +0 -7
  229. package/lib/chunk-EHQ3FX6X.mjs +0 -7
  230. package/lib/chunk-EQNW3UC2.mjs +0 -7
  231. package/lib/chunk-F43REJDZ.mjs +0 -10
  232. package/lib/chunk-GSG7WZHM.mjs +0 -7
  233. package/lib/chunk-HOJYWTP7.mjs +0 -20
  234. package/lib/chunk-HS4YRX4J.mjs +0 -7
  235. package/lib/chunk-I7O6C2B5.mjs +0 -8
  236. package/lib/chunk-IFETCRWE.mjs +0 -10
  237. package/lib/chunk-IQXHJEYB.mjs +0 -7
  238. package/lib/chunk-JPUR2CFX.mjs +0 -10
  239. package/lib/chunk-K327QKMD.mjs +0 -7
  240. package/lib/chunk-KRCA6IPH.mjs +0 -8
  241. package/lib/chunk-LPBMBW3O.mjs +0 -13
  242. package/lib/chunk-LWW4U276.mjs +0 -7
  243. package/lib/chunk-MFG4MUIO.mjs +0 -9
  244. package/lib/chunk-MJU2PGZQ.mjs +0 -15
  245. package/lib/chunk-OAZRPP4I.mjs +0 -7
  246. package/lib/chunk-OO6CLPEH.mjs +0 -7
  247. package/lib/chunk-OPXCV2KL.mjs +0 -7
  248. package/lib/chunk-P33PSCXK.mjs +0 -7
  249. package/lib/chunk-Q3DM32KF.mjs +0 -11
  250. package/lib/chunk-QR3WELJQ.mjs +0 -7
  251. package/lib/chunk-QWT2C74M.mjs +0 -7
  252. package/lib/chunk-R3X3LV64.mjs +0 -14
  253. package/lib/chunk-RMBPOTD7.mjs +0 -7
  254. package/lib/chunk-SIHORWVK.mjs +0 -7
  255. package/lib/chunk-T62WNR54.mjs +0 -7
  256. package/lib/chunk-TTFDUKUS.mjs +0 -47
  257. package/lib/chunk-VE6XKGGD.mjs +0 -7
  258. package/lib/chunk-VGW4MXXZ.mjs +0 -7
  259. package/lib/chunk-VS7ZXUII.mjs +0 -824
  260. package/lib/chunk-VXQLDM4R.mjs +0 -7
  261. package/lib/chunk-VYXMVJL5.mjs +0 -7
  262. package/lib/chunk-W7U5E5ZL.mjs +0 -9
  263. package/lib/chunk-WXAQ7FK3.mjs +0 -115
  264. package/lib/chunk-YS4G22C2.mjs +0 -7
  265. package/lib/chunk-ZM6OJGIG.mjs +0 -7
  266. package/lib/chunk-ZUTYVST5.mjs +0 -7
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a as F}from"./chunk-3RZQZHEB.mjs";import{a as N,b as D}from"./chunk-5P4PHJRL.mjs";import{a as A,b as W,c as B}from"./chunk-RSWDYIHY.mjs";import{O as L}from"./chunk-VS7ZXUII.mjs";import"./chunk-SOU4FRYN.mjs";import"./chunk-E5AHXLS6.mjs";import"./chunk-OO6CLPEH.mjs";import"./chunk-YS4G22C2.mjs";import{a as k}from"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import{a as x}from"./chunk-SCKUIE3R.mjs";import{c as v}from"./chunk-AV5SWEHP.mjs";import{a as _,c as P,d as U,e as z,f as M}from"./chunk-I7O6C2B5.mjs";import{a as J}from"./chunk-YRQGKDHM.mjs";import{m as R}from"./chunk-MJU2PGZQ.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-LWW4U276.mjs";import"./chunk-MJVTDA5Q.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-WR2GIKWE.mjs";import"./chunk-2CNCDM56.mjs";import"./chunk-SIHORWVK.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-B5QQJ4SI.mjs";import"./chunk-NZC67CGR.mjs";import"./chunk-BOGNK4LV.mjs";import{y as T}from"./chunk-4VS2V6WU.mjs";import"./chunk-KYEDBS54.mjs";import"./chunk-6XYKJSGX.mjs";import"./chunk-K2FBZIXY.mjs";import"./chunk-F43REJDZ.mjs";import"./chunk-JPUR2CFX.mjs";import"./chunk-LPBMBW3O.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-DBFJB2B6.mjs";import"./chunk-IFETCRWE.mjs";import{h as C}from"./chunk-PZPJKATS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-DYFALGRT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-7FFGJWHN.mjs";import"./chunk-G35N4P7D.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-SAR5622P.mjs";import{b as S}from"./chunk-KDGMAGQR.mjs";import"./chunk-MFG4MUIO.mjs";import"./chunk-EQNW3UC2.mjs";import"./chunk-GSKCGQIP.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-TYYOBZMU.mjs";import"./chunk-HS4YRX4J.mjs";import"./chunk-ZUTYVST5.mjs";import"./chunk-CU2INBND.mjs";import"./chunk-YKKRIEH4.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-VYXMVJL5.mjs";import"./chunk-AEKONPF4.mjs";import"./chunk-JWTSEDIQ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-CION3VMZ.mjs";import"./chunk-WIO4XO4F.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-GCOB7K5N.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-L77FJZEP.mjs";import"./chunk-A527W53V.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-GGD7ON3M.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-CA5NAXSU.mjs";import{a as I,d as O,e as y,g as E}from"./chunk-MTMH6H2A.mjs";import{Yb as j}from"./chunk-TTFDUKUS.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-NTOVCTRS.mjs";import{join as H}from"node:path";var Q=`sandforge backup \u2014 take and restore DataOps snapshots, without the editor.
7
+ import{a as ae}from"./chunk-GCGHHN4K.mjs";import{a as N,b as ne,c as ie}from"./chunk-5GBO4KD5.mjs";import"./chunk-3HEMJTAP.mjs";import"./chunk-BN33LVPQ.mjs";import"./chunk-JKT5YAQ2.mjs";import"./chunk-QAPVKPEC.mjs";import{a as H}from"./chunk-BNKT3R3F.mjs";import{a as v}from"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import{a as I}from"./chunk-SCKUIE3R.mjs";import{c as _}from"./chunk-6FARZYMJ.mjs";import{a as de}from"./chunk-EEFUE2ES.mjs";import{m as M,p as J}from"./chunk-PE435FVH.mjs";import"./chunk-PWVDNN2C.mjs";import"./chunk-6VSZNZHH.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import{a as K,c as V,d as X,e as C,f as Y,g as R,h as q,i as ee,j as te,k as se,l as oe,m as re}from"./chunk-MUEQRIK7.mjs";import{Fc as B,Oc as W}from"./chunk-ISSP2FZ5.mjs";import{h as F,i as G}from"./chunk-XU25YA46.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-IVZJSDJD.mjs";import"./chunk-VZT4E2OJ.mjs";import"./chunk-BOGNK4LV.mjs";import{m as Q}from"./chunk-P55MKIZX.mjs";import"./chunk-PYRZFUVU.mjs";import"./chunk-O2PUGRNW.mjs";import"./chunk-7SDZR6SR.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-YAIIRFKJ.mjs";import"./chunk-Q3DY7TO2.mjs";import"./chunk-3XG25GTF.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-WSUKC2U3.mjs";import"./chunk-QIRO4HTE.mjs";import{h as U}from"./chunk-3SKLBRPL.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-JH27IKCO.mjs";import"./chunk-SAMWHL22.mjs";import"./chunk-6KP6WETK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-J24TIGSI.mjs";import"./chunk-HKUWHVI7.mjs";import"./chunk-VPDEJGPS.mjs";import"./chunk-5LFSFYFJ.mjs";import{b as E}from"./chunk-LHU6CPGE.mjs";import"./chunk-PBE44M2Y.mjs";import"./chunk-ZUOPC4W2.mjs";import"./chunk-JQZTMFO7.mjs";import"./chunk-JFNLKHY6.mjs";import"./chunk-VZVICK7Q.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-7PY3VQP3.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-HFUDCNU5.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-XZISAZA6.mjs";import{b as T,e as L,f as O,h as Z}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-L4INJ5TZ.mjs";import"./chunk-KIMQQ6JQ.mjs";import{e as z,g as P}from"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ZUTUYBNW.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-PR74GYVI.mjs";import"./chunk-TMA34QMA.mjs";import"./chunk-TUACWKIH.mjs";import{Jc as D,x as S}from"./chunk-ZQO5PDX5.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{join as ue}from"node:path";var ge=`sandforge backup \u2014 take and restore DataOps snapshots, without the editor.
8
8
 
9
9
  Usage:
10
10
  npx sandforge backup --org <alias> [options]
@@ -19,23 +19,47 @@ One of:
19
19
  --list name the snapshots kept in the store, each with the
20
20
  org it was taken of, then stop: the org's with --org
21
21
  (those taken under its alias, and the others of the
22
- same Organization Id), every org's without it. It
23
- reads the store alone and contacts no org
24
- --restore <id> upsert a snapshot back into the org by record Id
22
+ same Organization Id), every org's without it; a set
23
+ of slices in one line, whatever its slices, with when
24
+ the retention removes it. It reads the store alone and
25
+ contacts no org
26
+ --restore <id> upsert a snapshot back into the org by record Id: a
27
+ snapshot's id, or a set of slices', every slice not
28
+ put back yet, in their order; stopped part way, the
29
+ same line puts back the rest
30
+ --delete <id> delete a snapshot, or a set of slices with every slice
31
+ and the key it holds, from the store; repeat for more.
32
+ A slice is deleted with its set. It contacts no org
25
33
 
26
34
  Options:
35
+ --where <Object>:<clause>
36
+ with --object: snapshot only the records of that object
37
+ the SOQL condition selects, written without WHERE, as
38
+ --where "Contact:CreatedDate >= 2025-01-01T00:00:00Z";
39
+ read up to its first colon, the object's name. One per
40
+ object; the snapshot holds the records under it, not
41
+ the object, and says so
42
+ --slices with --object: back each object up in slices of
43
+ --max-records records, consecutive by Id, each a
44
+ snapshot of its own, listed and restored as one set:
45
+ an object past what one snapshot holds is backed up
46
+ whole
27
47
  --store <dir> where snapshots live, a folder of your own
28
48
  (default: ~/.sandforge/backups, under the folder
29
49
  SANDFORGE_JOURNAL_DIR names when it is set)
30
50
  --max-records <n> most records of each object a snapshot reads, as
31
- sandforge.backup.maxRecordsPerObject sets it
32
- (default: 50000; 100 to 1000000)
51
+ sandforge.backup.maxRecordsPerObject sets it; with
52
+ --slices, the records of a slice (default: 50000; 100
53
+ to 1000000)
54
+ --slice <k[,k]> with --restore of a set of slices: only these slices, by
55
+ their number, put back again if they were already
33
56
  --rewrite-all with --restore: write every row of the snapshot back,
34
57
  the ones the org already holds as the snapshot does
35
- included
58
+ included; of a set, every slice, those put back
59
+ already too
36
60
  --include-changed with --restore of the snapshot a Sync run kept: put
37
61
  back the records changed or deleted since the run too
38
- ${B("written back")} --max-age-days <n> the retention, as sandforge.backup.maxAgeDays sets it:
62
+ ${ie("written back")} --max-age-days <n> the retention, as sandforge.backup.maxAgeDays sets it:
39
63
  snapshots taken more than <n> days ago are removed as
40
64
  the command starts, each named on stderr \u2014 the one a
41
65
  Sync run kept of what it wrote over too, which removing
@@ -68,36 +92,43 @@ the emails that sends against what the org has left today, and whether the
68
92
  org delivers them.
69
93
 
70
94
  A snapshot says its id, which --restore takes, and what it holds short of the
71
- org: an object stopped at --max-records, or never reached.
95
+ org: an object stopped at --max-records, or never reached. A set of slices
96
+ says its id and its slices; a slice the org would not read whole, even read in
97
+ smaller parts, stops it there, and the set is listed as partial.
72
98
 
73
99
  Exit codes: 0 the run finished: the snapshot holds every record of its objects,
74
- or the restore put back every value; 1 it could not start, or the snapshot or
100
+ or the restore put back every value, or the snapshots were deleted; 1 it could
101
+ not start, or the snapshot or
75
102
  the restore failed or was refused \u2014 what the org runs as it writes, without
76
103
  --accept-automation (AUTOMATION_NOT_ACCEPTED), emails it delivers, without
77
104
  --accept-emails (EMAILS_NOT_ACCEPTED), more emails than it has left today
78
105
  (EMAILS_EXCEEDED), or a mute refused among the reasons; 2 a bad command line, or a question with no
79
106
  terminal to answer it (give --yes); 3 the snapshot holds part of an object's
80
- records, or the restore left values as they are (rows the org refused, a
107
+ records \u2014 a set of slices stopped short among them \u2014, or the restore left
108
+ values as they are (rows the org refused, a
81
109
  snapshot that holds part of the records, or records of a Sync run's snapshot
82
110
  changed since the run, held back without --include-changed).
83
- `,X=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,Z={switches:["--list","--rewrite-all","--include-changed","--yes","--json",...A],values:["--org","--object","--restore","--store","--max-records","--max-age-days"]};function K(t){let e=t.slice(2);(e.includes("--help")||e.includes("-h"))&&(process.stdout.write(Q),process.exit(0)),I(e,Z);let o=(l,g)=>{let a=e.indexOf(l);return a>=0&&a+1<e.length?e[a+1]:g},i=l=>{let g=[];for(let a=0;a<e.length;a++)e[a]===l&&a+1<e.length&&g.push(e[a+1]);return g},n=o("--org"),r=e.includes("--list");!n&&!r&&(process.stderr.write(`Missing --org. Run with --help.
84
- `),process.exit(2));let c=i("--object"),f=o("--restore"),h=[c.length>0,r,f!==void 0].filter(Boolean).length;h===0&&(process.stderr.write(`Nothing to do: give --object, --list or --restore.
85
- `),process.exit(2)),h>1&&(process.stderr.write(`Give one of --object, --list or --restore.
86
- `),process.exit(2));for(let l of c)X.test(l)||(process.stderr.write(`Not an SObject API name: "${l}"
87
- `),process.exit(2));let p=o("--max-records");p!==void 0&&!/^[1-9]\d*$/.test(p)&&(process.stderr.write(`Not a number of records: "${p}"
88
- `),process.exit(2));let b=e.includes("--rewrite-all");b&&f===void 0&&(process.stderr.write(`--rewrite-all goes with --restore.
89
- `),process.exit(2));let w=e.includes("--include-changed");w&&f===void 0&&(process.stderr.write(`--include-changed goes with --restore.
90
- `),process.exit(2));let s=U(o("--max-age-days")),d=W(e),u=A.filter(l=>e.includes(l));u.length>0&&f===void 0&&(process.stderr.write(`${u.join(", ")} go${u.length===1?"es":""} with --restore.
91
- `),process.exit(2));let m={objects:c,restoreId:f,storeDir:o("--store",_())??"",...p!==void 0?{maxRecords:Number(p)}:{},rewriteAll:b,includeChanged:w,...s!==void 0?{maxAgeDays:s}:{},yes:e.includes("--yes"),json:e.includes("--json"),accord:d};return n?r?{...m,list:!0,org:n}:{...m,list:!1,org:n}:{...m,list:!0}}async function V(t=process.argv){let e=K(t),o=s=>{process[e.json?"stderr":"stdout"].write(`${s}
92
- `)},i=P(e.storeDir);if(i!==void 0){process.stderr.write(`${i}
93
- `),process.exitCode=1;return}o(`store: ${e.storeDir}`);let n=T(H(e.storeDir,"snapshots.json"));if(e.list){let s=n.getKeysByPrefix("backup:").map(u=>n.get(u)),d=e.org!==void 0?q(s,e.org):s;if(e.json){process.stdout.write(`${JSON.stringify(oe(d),null,2)}
94
- `);return}d.length===0&&o(e.org!==void 0?`No snapshot of ${e.org} in this store.`:"No snapshot in this store.");for(let u of d.map(ee))o(u);return}let r=await S(e.org),c=await new J().validateConnection(r.accessToken,r.instanceUrl),f={alias:r.alias,orgType:j({isSandbox:c.isSandbox,edition:c.orgType}),metadata:{apiVersion:"66.0",edition:c.orgType}},h=[],p=new R({log:s=>o(` ${s}`),broker:{postToWebview:s=>{h.push(s);let d=String(s.type??"");(d.endsWith(":error")||d.includes("failed"))&&(o(` ! ${JSON.stringify(s.payload??s)}`),process.exitCode=1)}},orgManager:{getOrg:()=>f},orgRegistry:{getCredentials:async()=>({accessToken:r.accessToken,instanceUrl:r.instanceUrl})},configStore:n,services:{getSandforgeSetting:z(e)},infraServices:{productionGuard:F(o,e.org),confirmRestoreIntoReplacedOrg:s=>e.yes?(process.stderr.write(`${te(s)}
95
- `),Promise.resolve(!1)):k(`${s.alias} answered as org ${s.backedUpFrom} when this snapshot was taken and answers as org ${s.now} now. Write its saved values into the org it is now?`)},nextId:()=>`cli-${Date.now()}-${Math.random().toString(36).slice(2,8)}`});p.setExpiryListener(s=>process.stderr.write(`${M(s)}
96
- `)),p.setBackupRecordStore(new D(N(e.storeDir))),await p.swept(),p.setSyncRuns(C(L()));let b=s=>h.find(d=>d.correlationId===s);if(e.restoreId){let s=n.get(`backup:${e.restoreId}`);s||(process.stderr.write(`No snapshot "${e.restoreId}" in ${e.storeDir}. "${x("backup")} --list --org ${e.org} --store ${e.storeDir}" names those it keeps; a snapshot taken with another --store, or with SANDFORGE_JOURNAL_DIR set otherwise, is restored with that --store. Nothing was written.
97
- `),process.exit(1));let d=`cli-restore-automation-${Date.now()}`;await p.handle({id:d,type:"dataops:automation",payload:{orgId:e.org,act:"restore",objects:(s.objects??[]).map(a=>({objectApiName:a.objectApiName,records:a.recordCount??0})),...e.accord}});let u=b(d);if(u?.type!=="dataops:automation:response"){process.exitCode=1,e.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-backup",posted:h},null,2)}
98
- `);return}let m=u.payload;for(let a of m.lines)o(a);if(m.refusals.length>0){for(let a of m.refusals)process.stderr.write(`${v(a)}
99
- `);process.exitCode=1,e.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-backup",posted:h},null,2)}
100
- `);return}if(!e.yes&&!await k(`Upsert snapshot ${e.restoreId} back into ${e.org}? Records with these Ids will have their fields overwritten.`)){o("Nothing written.");return}o(`restoring ${e.restoreId} into ${e.org}${e.rewriteAll?", every row written back":""}\u2026`),await p.handle({id:`cli-restore-${Date.now()}`,type:"dataops:rollback",payload:{orgId:e.org,operationId:e.restoreId,...e.rewriteAll?{rewriteAll:!0}:{},...e.includeChanged?{includeChanged:!0}:{},...e.accord}});let l=h.find(a=>a.type==="dataops:rollback:response"),g=l?.payload??{};typeof g.message=="string"&&o(g.message),l&&y(O(g))}else{o(`snapshot ${e.org}: ${e.objects.join(", ")}`),await p.handle({id:`cli-backup-${Date.now()}`,type:"backup:execute",payload:{orgId:e.org,objects:e.objects}});let s=h.find(d=>d.type==="dataops:backup:response");if(s){let d=re(s.payload??{});o(d.line),y(d.exitCode)}}if(e.json){process.stdout.write(`${JSON.stringify({tool:"sandforge-backup",posted:h},null,2)}
101
- `);return}let w=h[h.length-1];w&&o(`
102
- last message: ${String(w.type)}`)}function Y(t,e){return t!==void 0&&e!==void 0&&t.length>=15&&t.slice(0,15)===e.slice(0,15)}function q(t,e){let o=t.flatMap(i=>i.orgId===e&&i.organizationId!==void 0?[i.organizationId]:[]);return t.filter(i=>i.orgId===e||o.some(n=>Y(n,i.organizationId)))}function ee(t){let e=t.objects.map(o=>`${o.objectApiName}:${o.recordCount}`+(o.stoppedAt!==void 0?`/${o.orgCount??"?"}(${o.stoppedAt})`:""));return`${t.operationId} ${t.timestamp} ${t.orgId??"?"} ${t.totalRecords} record(s)${t.status==="failed"?" failed part-way":""} ${e.join(" ")}`}function te(t){return`${t.alias} answered as org ${t.backedUpFrom} when this snapshot was taken, and answers as org ${t.now} now: a sandbox refreshed since, or another org. --yes does not answer whether to write the snapshot's values into the org it is now, and counts as no: nothing is written. Run the restore again without --yes, in a terminal, to answer it.`}function oe(t){return{tool:"sandforge-backup",snapshots:t.map(e=>({operationId:e.operationId,timestamp:e.timestamp,...e.orgId!==void 0?{orgId:e.orgId}:{},...e.organizationId!==void 0?{organizationId:e.organizationId}:{},totalRecords:e.totalRecords,...e.status!==void 0?{status:e.status}:{},objects:e.objects}))}}function re(t){let e=String(t.operationId??"?"),o=(t.objects??[]).filter(r=>r.truncated===!0),i=`snapshot ${e}: ${String(t.totalRecords??0)} record(s)`;if(t.partial!==!0&&o.length===0)return{line:`${i} (--restore ${e} puts them back)`,exitCode:0};let n=o.map(r=>`${r.objectApiName} ${r.recordCount} of ${r.orgCount??"?"}`+(r.stoppedAt!==void 0?` (${r.stoppedAt})`:""));return{line:`${i} (partial: ${n.join(", ")||"an object holds fewer records than the org"})`+se(o),exitCode:3}}var $=1e6;function se(t){let e=t.filter(r=>r.stoppedAt==="cap"&&r.orgCount!==void 0),o=e.filter(r=>(r.orgCount??0)<=$),i=e.filter(r=>(r.orgCount??0)>$),n=[];if(o.length>0){let r=Math.max(...o.map(c=>c.orgCount??0));n.push(`--max-records ${r} takes ${o.map(c=>c.objectApiName).join(", ")} whole`)}if(i.length>0){let r=i.map(c=>c.objectApiName).join(", ");n.push(`No snapshot holds more than ${$} records of one object: ${r} ${i.length===1?"is":"are"} not whole, and a restore puts back only what it holds; Data Export, in Setup, or a Bulk API query keeps a copy of it`)}return t.some(r=>r.stoppedAt==="not_reached"||r.stoppedAt==="failure")&&n.push("Run it again for an object not reached"),n.length>0?`. ${n.join(". ")}`:""}process.argv[1]?.includes("sandforge-backup")&&(E(),V().then(()=>process.exit(process.exitCode??0)).catch(t=>{process.stderr.write(`${t instanceof Error?t.message:String(t)}
103
- `),process.exit(1)}));export{V as main,K as parseArgs,te as replacedOrgYesWords,oe as snapshotListing,re as snapshotTaken};
111
+ `,pe=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,fe={switches:["--list","--slices","--rewrite-all","--include-changed","--yes","--json",...N],values:["--org","--object","--where","--restore","--slice","--delete","--store","--max-records","--max-age-days"]};function b(o){process.stderr.write(`${o}
112
+ `),process.exit(2)}function we(o,e){let s={};for(let r of o){let n=r.indexOf(":"),t=n>0?r.slice(0,n).trim():"",i=n>0?r.slice(n+1).trim():"";(!pe.test(t)||i==="")&&b(`Not a filter --where can take: "${r}". Give the object, a colon and the condition, as --where "Contact:CreatedDate >= 2025-01-01T00:00:00Z".`);let l=e.find(m=>m.toLowerCase()===t.toLowerCase());l===void 0&&b(`--where names ${t}, which the line does not back up: give it with --object ${t}.`),s[l]!==void 0&&b(`Give one --where per object: ${l} is given two.`),z(i)||b(`Not a filter --where can take: "${i}". ${P}`),s[l]=i}return s}function me(o){let e=o.slice(2);(e.includes("--help")||e.includes("-h"))&&(process.stdout.write(ge),process.exit(0)),T(e,fe);let s=(g,A)=>{let w=e.indexOf(g);return w>=0&&w+1<e.length?e[w+1]:A},r=g=>{let A=[];for(let w=0;w<e.length;w++)e[w]===g&&w+1<e.length&&A.push(e[w+1]);return A},n=s("--org"),t=e.includes("--list");!n&&!t&&(process.stderr.write(`Missing --org. Run with --help.
113
+ `),process.exit(2));let i=r("--object"),l=s("--restore"),m=r("--delete"),y=[i.length>0,t,l!==void 0,m.length>0].filter(Boolean).length;y===0&&(process.stderr.write(`Nothing to do: give --object, --list, --restore or --delete.
114
+ `),process.exit(2)),y>1&&(process.stderr.write(`Give one of --object, --list, --restore or --delete.
115
+ `),process.exit(2));for(let g of i)pe.test(g)||(process.stderr.write(`Not an SObject API name: "${g}"
116
+ `),process.exit(2));for(let g of m)/^[A-Za-z0-9_-]{1,200}$/.test(g)||b(`Not a snapshot's id: "${g}"`);let k=C(e,"--where"),$=e.includes("--slices");(k.length>0||$)&&i.length===0&&b(`${k.length>0?"--where":"--slices"} goes with --object: it says how the objects a snapshot reads are read.`);let c=we(k,i),d=C(e,"--slice");d.length>0&&l===void 0&&b("--slice goes with --restore: it names the slices of a set to put back. A backup in slices is --slices.");let h=s("--max-records");h!==void 0&&!/^[1-9]\d*$/.test(h)&&(process.stderr.write(`Not a number of records: "${h}"
117
+ `),process.exit(2));let p=e.includes("--rewrite-all");p&&l===void 0&&(process.stderr.write(`--rewrite-all goes with --restore.
118
+ `),process.exit(2));let u=e.includes("--include-changed");u&&l===void 0&&(process.stderr.write(`--include-changed goes with --restore.
119
+ `),process.exit(2));let a=X(s("--max-age-days")),f=ne(e),j=N.filter(g=>e.includes(g));j.length>0&&l===void 0&&(process.stderr.write(`${j.join(", ")} go${j.length===1?"es":""} with --restore.
120
+ `),process.exit(2));let x={objects:i,...Object.keys(c).length>0?{wheres:c}:{},slices:$,restoreId:l,...d.length>0?{restoreSlices:Y(d)}:{},...m.length>0?{deleteIds:m}:{},storeDir:s("--store",K())??"",...h!==void 0?{maxRecords:Number(h)}:{},rewriteAll:p,includeChanged:u,...a!==void 0?{maxAgeDays:a}:{},yes:e.includes("--yes"),json:e.includes("--json"),accord:f};return n?t?{...x,list:!0,org:n}:{...x,list:!1,org:n}:{...x,list:!0}}async function be(o=process.argv){let e=me(o),s=c=>{process[e.json?"stderr":"stdout"].write(`${c}
121
+ `)},r=V(e.storeDir);if(r!==void 0){process.stderr.write(`${r}
122
+ `),process.exitCode=1;return}s(`store: ${e.storeDir}`);let n=Q(ue(e.storeDir,"snapshots.json"));if(e.list){let c=n.getKeysByPrefix("backup:").filter(a=>!a.slice(7).includes(":")).map(a=>n.get(a)).filter(a=>a.origin!=="slice"),d=e.org!==void 0?le(c,e.org):c,h=se(n),p=e.org!==void 0?le(h,e.org):h,u=B({getSandforgeSetting:R(e)});if(e.json){process.stdout.write(`${JSON.stringify(Ae(d,p,u),null,2)}
123
+ `);return}d.length===0&&p.length===0&&s(e.org!==void 0?`No snapshot of ${e.org} in this store.`:"No snapshot in this store.");for(let a of d.map(ke))s(a);p.length>0&&s("sets of slices, each restored and deleted whole:");for(let a of p)s(` ${re(a,u)}`);return}let t=[];if(e.deleteIds){let c=await ce(e,n,s,t),d=`cli-delete-${Date.now()}`;await c.handle({id:d,type:"backup:delete",payload:{orgId:e.org,operationIds:e.deleteIds}});let h=t.find(a=>a.correlationId===d);if(e.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-backup",posted:t},null,2)}
124
+ `),h?.type!=="backup:delete:result"){process.exitCode=1;return}let p=(h.payload?.deleted??[]).filter(a=>e.deleteIds?.includes(a));for(let a of p)s(`deleted ${a}`);let u=e.deleteIds.filter(a=>!p.includes(a));u.length>0&&(process.stderr.write(`No snapshot or set ${u.join(", ")} of ${e.org} in ${e.storeDir}: nothing deleted for ${u.length===1?"it":"them"}. "${I("backup")} --list --org ${e.org} --store ${e.storeDir}" names those it keeps.
125
+ `),process.exitCode=1);return}let i=await E(e.org),l=await new de().validateConnection(i.accessToken,i.instanceUrl),m={alias:i.alias,orgType:D({isSandbox:l.isSandbox,edition:l.orgType}),metadata:{apiVersion:"66.0",edition:l.orgType}},y=await ce(e,n,s,t,{typed:m,session:i}),k=c=>t.find(d=>d.correlationId===c);if(e.restoreId){let c=ee(n,e.restoreId,{...e.restoreSlices?{slices:e.restoreSlices}:{},rewriteAll:e.rewriteAll});c||(process.stderr.write(`No snapshot "${e.restoreId}" in ${e.storeDir}. "${I("backup")} --list --org ${e.org} --store ${e.storeDir}" names those it keeps; a snapshot taken with another --store, or with SANDFORGE_JOURNAL_DIR set otherwise, is restored with that --store. Nothing was written.
126
+ `),process.exit(1));let d=`cli-restore-automation-${Date.now()}`;await y.handle({id:d,type:"dataops:automation",payload:{orgId:e.org,act:"restore",objects:c.objects,...e.accord}});let h=k(d);if(h?.type!=="dataops:automation:response"){process.exitCode=1,e.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-backup",posted:t},null,2)}
127
+ `);return}let p=h.payload;for(let f of p.lines)s(f);if(p.refusals.length>0){for(let f of p.refusals)process.stderr.write(`${_(f)}
128
+ `);process.exitCode=1,e.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-backup",posted:t},null,2)}
129
+ `);return}if(!e.yes&&!await v(`Upsert ${c.words} back into ${e.org}? ${c.totalRecords} record(s) with these Ids will have their fields overwritten.`)){s("Nothing written.");return}s(`restoring ${e.restoreId} into ${e.org}${e.rewriteAll?", every row written back":""}\u2026`),await y.handle({id:`cli-restore-${Date.now()}`,type:"dataops:rollback",payload:{orgId:e.org,operationId:e.restoreId,...e.rewriteAll?{rewriteAll:!0}:{},...e.includeChanged?{includeChanged:!0}:{},...e.restoreSlices?{slices:e.restoreSlices}:{},...e.accord}});let u=t.find(f=>f.type==="dataops:rollback:response"),a=u?.payload??{};typeof a.message=="string"&&s(a.message);for(let f of te(a))s(f);u&&O(L(a))}else{s(`snapshot ${e.org}: ${e.objects.map(d=>`${d}${e.wheres?.[d]!==void 0?` (where ${e.wheres[d]})`:""}`).join(", ")}${e.slices?", in slices":""}`),await y.handle({id:`cli-backup-${Date.now()}`,type:"backup:execute",payload:{orgId:e.org,objects:e.objects,...e.wheres?{wheres:e.wheres}:{},...e.slices?{slices:!0}:{}}});let c=t.find(d=>d.type==="dataops:backup:response");if(c){let d=Se(c.payload??{});s(d.line),O(d.exitCode)}}if(e.json){process.stdout.write(`${JSON.stringify({tool:"sandforge-backup",posted:t},null,2)}
130
+ `);return}let $=t[t.length-1];$&&s(`
131
+ last message: ${String($.type)}`)}async function ce(o,e,s,r,n){let t=new J({log:i=>s(` ${i}`),broker:{postToWebview:i=>{r.push(i);let l=String(i.type??"");(l.endsWith(":error")||l.includes("failed"))&&(s(` ! ${JSON.stringify(i.payload??i)}`),process.exitCode=1)}},orgManager:{getOrg:()=>n?.typed},orgRegistry:{getCredentials:async()=>{if(!n)throw new Error("This command reaches no org.");return{accessToken:n.session.accessToken,instanceUrl:n.session.instanceUrl}}},configStore:e,services:{getSandforgeSetting:R(o)},infraServices:{productionGuard:ae(s,o.org??""),confirmRestoreIntoReplacedOrg:i=>o.yes?(process.stderr.write(`${$e(i)}
132
+ `),Promise.resolve(!1)):v(`${i.alias} answered as org ${i.backedUpFrom} when this snapshot was taken and answers as org ${i.now} now. Write its saved values into the org it is now?`)},nextId:()=>`cli-${Date.now()}-${Math.random().toString(36).slice(2,8)}`});return t.setExpiryListener(i=>process.stderr.write(`${q(i)}
133
+ `)),t.setRunKeyStore(M(o.storeDir)),t.setBackupRecordStore(new G(F(o.storeDir))),await t.swept(),t.setSyncRuns(U(H())),t}function ye(o,e){return o!==void 0&&e!==void 0&&o.length>=15&&o.slice(0,15)===e.slice(0,15)}function le(o,e){let s=o.flatMap(r=>r.orgId===e&&r.organizationId!==void 0?[r.organizationId]:[]);return o.filter(r=>r.orgId===e||s.some(n=>ye(n,r.organizationId)))}function ke(o){let e=o.objects.map(s=>`${s.objectApiName}:${s.recordCount}`+(s.stoppedAt!==void 0?`/${s.orgCount??"?"}(${s.stoppedAt})`:"")+(s.where!==void 0?`(where ${s.where})`:""));return`${o.operationId} ${o.timestamp} ${o.orgId??"?"} ${o.totalRecords} record(s)${o.status==="failed"?" failed part-way":""} ${e.join(" ")}`}function $e(o){return`${o.alias} answered as org ${o.backedUpFrom} when this snapshot was taken, and answers as org ${o.now} now: a sandbox refreshed since, or another org. --yes does not answer whether to write the snapshot's values into the org it is now, and counts as no: nothing is written. Run the restore again without --yes, in a terminal, to answer it.`}function Ae(o,e=[],s=0){return{tool:"sandforge-backup",...e.length>0?{sets:e.map(r=>{let n=oe(r,s);return{...W(r),...r.organizationId!==void 0?{organizationId:r.organizationId}:{},...n!==void 0?{expiresOn:n}:{}}})}:{},snapshots:o.map(r=>({operationId:r.operationId,timestamp:r.timestamp,...r.orgId!==void 0?{orgId:r.orgId}:{},...r.organizationId!==void 0?{organizationId:r.organizationId}:{},totalRecords:r.totalRecords,...r.status!==void 0?{status:r.status}:{},objects:r.objects}))}}function Se(o){let e=String(o.operationId??"?"),s=(o.objects??[]).filter(t=>t.truncated===!0);if(o.slices!==void 0)return je(o.slices,s);let r=`snapshot ${e}: ${String(o.totalRecords??0)} record(s)`;if(o.partial!==!0&&s.length===0)return{line:`${r} (--restore ${e} puts them back)`,exitCode:0};let n=s.map(t=>`${t.objectApiName} ${t.recordCount} of ${t.orgCount??"?"}`+(t.stoppedAt!==void 0?` (${t.stoppedAt})`:""));return{line:`${r} (partial: ${n.join(", ")||"an object holds fewer records than the org"})`+xe(s),exitCode:3}}function je(o,e){let s=o.objects.flatMap(t=>t.slices),r=s.reduce((t,i)=>t+i.rows,0),n=`set ${o.setId}: ${r} record(s) in ${s.length} slice(s) of up to ${o.size}`+(s.length>0?` (--restore ${o.setId} puts them back)`:"");return o.state==="done"&&e.length===0?{line:n,exitCode:0}:{line:`${n}, partial: ${e.map(t=>t.objectApiName).join(", ")||"an object"} not read to its end, its reason above. The same line takes a new set of every record`,exitCode:3}}function xe(o){let e=o.filter(t=>t.stoppedAt==="cap"&&t.orgCount!==void 0),s=e.filter(t=>(t.orgCount??0)<=S),r=e.filter(t=>(t.orgCount??0)>S),n=[];if(s.length>0){let t=Math.max(...s.map(i=>i.orgCount??0));n.push(`--max-records ${t} takes ${s.map(i=>i.objectApiName).join(", ")} whole, or --slices takes it in slices of --max-records records, listed and restored as one set`)}if(r.length>0){let t=r.map(i=>i.objectApiName).join(", ");n.push(`No snapshot holds more than ${S} records of one object: ${t} ${r.length===1?"is":"are"} not whole, and a restore puts back only what it holds. --slices takes it whole, in slices of --max-records records, each a snapshot of its own, listed and restored as one set`)}return o.some(t=>t.stoppedAt==="not_reached"||t.stoppedAt==="failure")&&n.push("Run it again for an object not reached"),n.length>0?`. ${n.join(". ")}`:""}process.argv[1]?.includes("sandforge-backup")&&(Z(),be().then(()=>process.exit(process.exitCode??0)).catch(o=>{process.stderr.write(`${o instanceof Error?o.message:String(o)}
134
+ `),process.exit(1)}));export{be as main,me as parseArgs,$e as replacedOrgYesWords,Ae as snapshotListing,Se as snapshotTaken,we as wheresOf};