sandforge 1.84.1 → 1.86.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 (277) hide show
  1. package/README.md +1 -1
  2. package/lib/{chunk-S42RBRH2.mjs → chunk-22L43JMK.mjs} +1 -1
  3. package/lib/{chunk-Y2DRK37K.mjs → chunk-2LSGWTWX.mjs} +1 -1
  4. package/lib/{chunk-24RFOFYT.mjs → chunk-2YJJTQNC.mjs} +1 -1
  5. package/lib/chunk-34SMB5PA.mjs +10 -0
  6. package/lib/chunk-35B73566.mjs +7 -0
  7. package/lib/{chunk-3TZSBHEY.mjs → chunk-35IJ4WEU.mjs} +1 -1
  8. package/lib/chunk-3EHPAFKV.mjs +7 -0
  9. package/lib/{chunk-6YL7BNYD.mjs → chunk-3HAVVEXF.mjs} +1 -1
  10. package/lib/{chunk-6JWWSDM6.mjs → chunk-3I6FXFCN.mjs} +1 -1
  11. package/lib/{chunk-WUUKFE2U.mjs → chunk-3KJCSYXY.mjs} +1 -1
  12. package/lib/{chunk-2HVOZUM4.mjs → chunk-3L6DVNCR.mjs} +1 -1
  13. package/lib/chunk-3LRFPGYZ.mjs +7 -0
  14. package/lib/{chunk-GWZRR3MM.mjs → chunk-3MVWGL5A.mjs} +1 -1
  15. package/lib/{chunk-KGU4SVIT.mjs → chunk-4CSBZZAL.mjs} +1 -1
  16. package/lib/{chunk-JE6SCT6R.mjs → chunk-4NSXPONF.mjs} +1 -1
  17. package/lib/{chunk-UIOMAX56.mjs → chunk-4VLP6RHC.mjs} +1 -1
  18. package/lib/{chunk-YA6ATMTB.mjs → chunk-4XROG5CT.mjs} +1 -1
  19. package/lib/chunk-54V4FVEY.mjs +7 -0
  20. package/lib/chunk-55OJJT2Q.mjs +7 -0
  21. package/lib/{chunk-6QE6R6RL.mjs → chunk-5EHHQ5UX.mjs} +1 -1
  22. package/lib/{chunk-FITPY3L4.mjs → chunk-5JMQXHJ2.mjs} +1 -1
  23. package/lib/{chunk-W6PN6TJG.mjs → chunk-65AMXOQU.mjs} +1 -1
  24. package/lib/{chunk-3Q353S2R.mjs → chunk-6HHSAPIM.mjs} +1 -1
  25. package/lib/chunk-6KVBCFVS.mjs +7 -0
  26. package/lib/chunk-6NG7C2U3.mjs +476 -0
  27. package/lib/chunk-6ROL3KBM.mjs +7 -0
  28. package/lib/{chunk-2JDAOWUW.mjs → chunk-72AWCN7U.mjs} +1 -1
  29. package/lib/{chunk-JLSIWO4Z.mjs → chunk-7KHA5UIQ.mjs} +1 -1
  30. package/lib/chunk-7O6EFNQS.mjs +10 -0
  31. package/lib/{chunk-WWTCWWZI.mjs → chunk-A2CH2QGX.mjs} +1 -1
  32. package/lib/chunk-A2TXLAC3.mjs +276 -0
  33. package/lib/chunk-ALWVNR34.mjs +7 -0
  34. package/lib/{chunk-D4GF4FAB.mjs → chunk-ATBQIE2V.mjs} +1 -1
  35. package/lib/{chunk-NED4MBIM.mjs → chunk-ATQML7ZK.mjs} +1 -1
  36. package/lib/chunk-AVY742BJ.mjs +7 -0
  37. package/lib/{chunk-YWEQQL3C.mjs → chunk-AXTB2HJS.mjs} +1 -1
  38. package/lib/chunk-BBZUGKBZ.mjs +10 -0
  39. package/lib/chunk-BIDXK7KA.mjs +7 -0
  40. package/lib/{chunk-O677VOGO.mjs → chunk-BLMJ4WVI.mjs} +1 -1
  41. package/lib/{chunk-RE7RYF3B.mjs → chunk-BNHJCJJM.mjs} +1 -1
  42. package/lib/{chunk-5M5FQ7RP.mjs → chunk-BNPQEQXC.mjs} +1 -1
  43. package/lib/chunk-C5AUNG6T.mjs +37 -0
  44. package/lib/{chunk-ETDCBLGU.mjs → chunk-C5EQ7GFC.mjs} +1 -1
  45. package/lib/{chunk-MJZU3U5O.mjs → chunk-C7CKDZMC.mjs} +61 -61
  46. package/lib/{chunk-HCGXK7G7.mjs → chunk-CB4U22NR.mjs} +1 -1
  47. package/lib/chunk-CJAWKLAL.mjs +7 -0
  48. package/lib/chunk-CL75DEMQ.mjs +9 -0
  49. package/lib/{chunk-VCUXCK36.mjs → chunk-CLUNF4FK.mjs} +1 -1
  50. package/lib/chunk-CSMGP53U.mjs +7 -0
  51. package/lib/{chunk-7YNM6KFZ.mjs → chunk-CT324C7I.mjs} +1 -1
  52. package/lib/{chunk-7UVKIWKV.mjs → chunk-CZXDJXQP.mjs} +1 -1
  53. package/lib/{chunk-43TOMFV4.mjs → chunk-D2X6U3MS.mjs} +1 -1
  54. package/lib/{chunk-M6K34KGF.mjs → chunk-DAUX63UB.mjs} +1 -1
  55. package/lib/chunk-DB7JNALQ.mjs +10 -0
  56. package/lib/chunk-DDNCJVZ2.mjs +17 -0
  57. package/lib/{chunk-FP7CYB2F.mjs → chunk-DLSU66MY.mjs} +1 -1
  58. package/lib/{chunk-JKJ74BX5.mjs → chunk-DO6PSHQZ.mjs} +1 -1
  59. package/lib/{chunk-MDMPJEV3.mjs → chunk-DUBECLZV.mjs} +1 -1
  60. package/lib/{chunk-KZTZDC7H.mjs → chunk-DYHF6DNT.mjs} +1 -1
  61. package/lib/chunk-E5FSPXYH.mjs +930 -0
  62. package/lib/{chunk-Q7GIJBCD.mjs → chunk-EGL3I3IX.mjs} +1 -1
  63. package/lib/chunk-EIYMQPMG.mjs +7 -0
  64. package/lib/{chunk-RHNTHGNU.mjs → chunk-EUIALBMX.mjs} +1 -1
  65. package/lib/{chunk-NCZKWSC7.mjs → chunk-FI3R5ZOQ.mjs} +1 -1
  66. package/lib/{chunk-PAXNWTYK.mjs → chunk-FM4QCTO7.mjs} +1 -1
  67. package/lib/{chunk-HV7VPEXP.mjs → chunk-FRSIEASH.mjs} +1 -1
  68. package/lib/{chunk-QAFPQ3YB.mjs → chunk-FV6MOSHD.mjs} +1 -1
  69. package/lib/chunk-FYG47CNA.mjs +7 -0
  70. package/lib/chunk-GB6W4Q56.mjs +7 -0
  71. package/lib/chunk-GEV2DCMK.mjs +7 -0
  72. package/lib/{chunk-NSQWI7ZY.mjs → chunk-GFB2DNCB.mjs} +1 -1
  73. package/lib/chunk-GFGMGFSH.mjs +7 -0
  74. package/lib/{chunk-RGUQOSBU.mjs → chunk-GIFQXB2Q.mjs} +1 -1
  75. package/lib/{chunk-JAEDM4SI.mjs → chunk-GP5J3DGS.mjs} +1 -1
  76. package/lib/chunk-GQZEX7LH.mjs +231 -0
  77. package/lib/{chunk-JSAJS3MY.mjs → chunk-GYDTM62J.mjs} +1 -1
  78. package/lib/{chunk-OPMO6I45.mjs → chunk-GYFIXUJG.mjs} +1 -1
  79. package/lib/chunk-GZW2GNFK.mjs +7 -0
  80. package/lib/chunk-H6BHWAX7.mjs +8 -0
  81. package/lib/{chunk-EAC5QCE3.mjs → chunk-HDDJ3CVN.mjs} +1 -1
  82. package/lib/{chunk-5SMWFNE7.mjs → chunk-HDWB4ZOG.mjs} +1 -1
  83. package/lib/chunk-HGVPBJR6.mjs +7 -0
  84. package/lib/{chunk-BBRWFKS5.mjs → chunk-HLROVOR6.mjs} +1 -1
  85. package/lib/{chunk-LKTNQEBS.mjs → chunk-HUOR4M2L.mjs} +1 -1
  86. package/lib/chunk-HZCS6EED.mjs +8 -0
  87. package/lib/{chunk-36JOHEJL.mjs → chunk-HZUI56KZ.mjs} +1 -1
  88. package/lib/chunk-IAB5H7WN.mjs +7 -0
  89. package/lib/{chunk-X4BXESMQ.mjs → chunk-IQ5UKRHU.mjs} +1 -1
  90. package/lib/{chunk-54WZUS7J.mjs → chunk-IRQ4WANV.mjs} +1 -1
  91. package/lib/{chunk-5IZTFMJM.mjs → chunk-IT3DGX37.mjs} +1 -1
  92. package/lib/chunk-J347SPU6.mjs +49 -0
  93. package/lib/{chunk-QO53K5W2.mjs → chunk-JANBNTR5.mjs} +1 -1
  94. package/lib/chunk-JFXQZPRY.mjs +9 -0
  95. package/lib/{chunk-KAZS5Z6W.mjs → chunk-JRLYWVF4.mjs} +1 -1
  96. package/lib/{chunk-GKY2JMHY.mjs → chunk-JSNMUTY6.mjs} +1 -1
  97. package/lib/chunk-JTNJKSAA.mjs +7 -0
  98. package/lib/{chunk-7WATA4SB.mjs → chunk-JV2LAKWQ.mjs} +1 -1
  99. package/lib/{chunk-WAPSSYMT.mjs → chunk-JV7K2ZHK.mjs} +1 -1
  100. package/lib/{chunk-ZBAWJUG2.mjs → chunk-K4TQ7YHX.mjs} +1 -1
  101. package/lib/chunk-K5PUMHZU.mjs +7 -0
  102. package/lib/chunk-KH4KLCYG.mjs +7 -0
  103. package/lib/{chunk-OLCVHL7I.mjs → chunk-KQVLZVOP.mjs} +1 -1
  104. package/lib/chunk-KWUS7UAV.mjs +19 -0
  105. package/lib/{chunk-JGZPD4IM.mjs → chunk-L6G73FXM.mjs} +1 -1
  106. package/lib/{chunk-BAWCOKRW.mjs → chunk-LG466Q5H.mjs} +1 -1
  107. package/lib/{chunk-GMIGWR6U.mjs → chunk-LHNAR6FC.mjs} +1 -1
  108. package/lib/chunk-LT4GHEI2.mjs +7 -0
  109. package/lib/{chunk-EC72TIEG.mjs → chunk-MR262Y3B.mjs} +1 -1
  110. package/lib/{chunk-LA4KIATH.mjs → chunk-NCCHOV2N.mjs} +1 -1
  111. package/lib/chunk-NICRSGLS.mjs +7 -0
  112. package/lib/chunk-NV5QA2HY.mjs +7 -0
  113. package/lib/{chunk-PR3XCSPO.mjs → chunk-O3GIN5TU.mjs} +1 -1
  114. package/lib/chunk-O6FHK6NQ.mjs +13 -0
  115. package/lib/{chunk-M4BLK6HJ.mjs → chunk-O7YIEFG7.mjs} +1 -1
  116. package/lib/chunk-OCUVAA5E.mjs +7 -0
  117. package/lib/chunk-OLCS7JCT.mjs +14 -0
  118. package/lib/chunk-ON7Y63FK.mjs +9 -0
  119. package/lib/{chunk-N4WPCWJO.mjs → chunk-OO2WY3UB.mjs} +1 -1
  120. package/lib/{chunk-MSIEU5MR.mjs → chunk-OT2NHL2V.mjs} +1 -1
  121. package/lib/{chunk-6WX5ZU7Q.mjs → chunk-P2M5ZXWU.mjs} +1 -1
  122. package/lib/{chunk-GNRSF65U.mjs → chunk-P4YOHLZ4.mjs} +1 -1
  123. package/lib/chunk-PBHDPTT6.mjs +343 -0
  124. package/lib/chunk-PE7CHD2W.mjs +7 -0
  125. package/lib/{chunk-PBY2O6OF.mjs → chunk-PIQ2I67B.mjs} +1 -1
  126. package/lib/chunk-PKYDNZJK.mjs +7 -0
  127. package/lib/chunk-PVZ72OOQ.mjs +7 -0
  128. package/lib/chunk-QACFTHJM.mjs +8 -0
  129. package/lib/{chunk-J3DND3BC.mjs → chunk-QGVL5EW3.mjs} +1 -1
  130. package/lib/chunk-QHE2RUWX.mjs +7 -0
  131. package/lib/{chunk-QKEKG2LD.mjs → chunk-RCW5BZNW.mjs} +1 -1
  132. package/lib/{chunk-4JE4BYXK.mjs → chunk-RJ6HHG7J.mjs} +1 -1
  133. package/lib/{chunk-ZQWIVYVM.mjs → chunk-RPTEEI4R.mjs} +1 -1
  134. package/lib/chunk-RQW5S67A.mjs +7 -0
  135. package/lib/chunk-RTCMYMED.mjs +7 -0
  136. package/lib/chunk-RWVX7XSD.mjs +7 -0
  137. package/lib/{chunk-WY5V5PR3.mjs → chunk-RZOINFNL.mjs} +1 -1
  138. package/lib/chunk-SOOTWGMQ.mjs +7 -0
  139. package/lib/chunk-STQ2JMIZ.mjs +7 -0
  140. package/lib/{chunk-6PD6K7LP.mjs → chunk-SUIPDW5O.mjs} +1 -1
  141. package/lib/{chunk-TNT27RBG.mjs → chunk-SZOJ7BEJ.mjs} +1 -1
  142. package/lib/{chunk-4EOHEDFP.mjs → chunk-T542Z54E.mjs} +1 -1
  143. package/lib/chunk-TAN2CIRI.mjs +21 -0
  144. package/lib/{chunk-A3MYSOOC.mjs → chunk-TCNBINOG.mjs} +1 -1
  145. package/lib/chunk-TFDF3DBN.mjs +7 -0
  146. package/lib/chunk-TICZXC53.mjs +9 -0
  147. package/lib/chunk-TLX45X5U.mjs +7 -0
  148. package/lib/{chunk-QTG6LUZT.mjs → chunk-TMIV3IWH.mjs} +1 -1
  149. package/lib/chunk-TQ6HEJ73.mjs +11 -0
  150. package/lib/chunk-TTU5EQZ6.mjs +7 -0
  151. package/lib/chunk-TYUYPFDJ.mjs +7 -0
  152. package/lib/chunk-TZXYVMZC.mjs +7 -0
  153. package/lib/chunk-UCUFLFNK.mjs +7 -0
  154. package/lib/chunk-UK3QLBHW.mjs +7 -0
  155. package/lib/{chunk-IZGCEOYO.mjs → chunk-UM2B4GR7.mjs} +1 -1
  156. package/lib/chunk-UZFTTNOP.mjs +7 -0
  157. package/lib/chunk-V3AXSKSU.mjs +7 -0
  158. package/lib/chunk-VA6EEI6X.mjs +21 -0
  159. package/lib/{chunk-OFTT7J2M.mjs → chunk-VFKG2G37.mjs} +1 -1
  160. package/lib/chunk-VJNEW5MQ.mjs +7 -0
  161. package/lib/{chunk-L53JWJ3S.mjs → chunk-VKREON6Q.mjs} +1 -1
  162. package/lib/{chunk-NOBQTEQD.mjs → chunk-VNNDYPBL.mjs} +1 -1
  163. package/lib/{chunk-ZJW6YOMV.mjs → chunk-VRBETPHY.mjs} +1 -1
  164. package/lib/{chunk-EPFCERGL.mjs → chunk-VT6P3X6R.mjs} +1 -1
  165. package/lib/{chunk-ZV7ZFQQC.mjs → chunk-VUTQY76O.mjs} +1 -1
  166. package/lib/chunk-WF5S4FW5.mjs +7 -0
  167. package/lib/{chunk-Z4LKKOFY.mjs → chunk-WJGK6VGU.mjs} +1 -1
  168. package/lib/{chunk-5CRLRHOJ.mjs → chunk-WJHMB3SL.mjs} +1 -1
  169. package/lib/{chunk-OUZQPYT3.mjs → chunk-WQCXOZEJ.mjs} +1 -1
  170. package/lib/{chunk-L2E5WBGD.mjs → chunk-WVVFR4E3.mjs} +1 -1
  171. package/lib/{chunk-PWRJRL5U.mjs → chunk-XBYXT74L.mjs} +1 -1
  172. package/lib/chunk-XJE3LJHP.mjs +7 -0
  173. package/lib/{chunk-CPQIZGG5.mjs → chunk-XV4CVZYD.mjs} +1 -1
  174. package/lib/chunk-Y37ED7AS.mjs +7 -0
  175. package/lib/{chunk-YTLUYSMF.mjs → chunk-YGBNZYT4.mjs} +1 -1
  176. package/lib/{chunk-4CVUUVGJ.mjs → chunk-YGTOX7IL.mjs} +1 -1
  177. package/lib/{chunk-OMNMLKDT.mjs → chunk-YJ27WHKR.mjs} +1 -1
  178. package/lib/chunk-YRULC27A.mjs +7 -0
  179. package/lib/{chunk-RMFU4BAL.mjs → chunk-YSVAHT4Q.mjs} +4 -4
  180. package/lib/chunk-YTOTMJTY.mjs +15 -0
  181. package/lib/{chunk-B63POIPQ.mjs → chunk-YZKZC62O.mjs} +1 -1
  182. package/lib/{chunk-DPMRIMUC.mjs → chunk-YZQN7BRB.mjs} +1 -1
  183. package/lib/{chunk-7SQSWVAU.mjs → chunk-Z5IUK2QO.mjs} +1 -1
  184. package/lib/{chunk-M2ABR4JM.mjs → chunk-ZEGSMW5A.mjs} +1 -1
  185. package/lib/{chunk-PR42EZSR.mjs → chunk-ZIKLQZBG.mjs} +1 -1
  186. package/lib/chunk-ZVU7MD2S.mjs +7 -0
  187. package/lib/sandforge-autopilot.mjs +33 -27
  188. package/lib/sandforge-backup.mjs +19 -19
  189. package/lib/sandforge-checkpoint.mjs +1 -1
  190. package/lib/sandforge-cleanup.mjs +1 -1
  191. package/lib/sandforge-clone.mjs +1 -1
  192. package/lib/sandforge-compare.mjs +32 -14
  193. package/lib/sandforge-dataops.mjs +1 -1
  194. package/lib/sandforge-empty.mjs +11 -13
  195. package/lib/sandforge-env.mjs +105 -105
  196. package/lib/sandforge-frozen.mjs +1 -1
  197. package/lib/sandforge-mcp.mjs +2 -2
  198. package/lib/sandforge-monitor.mjs +1 -1
  199. package/lib/sandforge-pipeline.mjs +13 -13
  200. package/lib/sandforge-seed.mjs +1 -1
  201. package/lib/sandforge-sync.mjs +1 -1
  202. package/lib/sandforge-users.mjs +13 -15
  203. package/lib/sandforge.mjs +1 -1
  204. package/lib/sf/sandforge/dataops.mjs +2 -2
  205. package/lib/sfPlugin.mjs +1 -1
  206. package/oclif.manifest.json +1 -1
  207. package/package.json +1 -1
  208. package/lib/chunk-23SEDORH.mjs +0 -11
  209. package/lib/chunk-26POJDIT.mjs +0 -7
  210. package/lib/chunk-2AZQHBEF.mjs +0 -7
  211. package/lib/chunk-2METQHGG.mjs +0 -7
  212. package/lib/chunk-2WFIVO4F.mjs +0 -13
  213. package/lib/chunk-2YHZBUZE.mjs +0 -7
  214. package/lib/chunk-326AJTIU.mjs +0 -272
  215. package/lib/chunk-3PVRGTVK.mjs +0 -7
  216. package/lib/chunk-5XTUSN72.mjs +0 -8
  217. package/lib/chunk-6I6TWNV5.mjs +0 -7
  218. package/lib/chunk-6O222PW6.mjs +0 -7
  219. package/lib/chunk-6ZLKIT3H.mjs +0 -7
  220. package/lib/chunk-7QYHEHMA.mjs +0 -9
  221. package/lib/chunk-B3FBHVNN.mjs +0 -21
  222. package/lib/chunk-BEA27DLS.mjs +0 -7
  223. package/lib/chunk-BRY3PLIZ.mjs +0 -7
  224. package/lib/chunk-CBH3TOWK.mjs +0 -341
  225. package/lib/chunk-CVHNXJH3.mjs +0 -7
  226. package/lib/chunk-DGDRQRCW.mjs +0 -7
  227. package/lib/chunk-DUN2EPRC.mjs +0 -7
  228. package/lib/chunk-E3A3LOCY.mjs +0 -7
  229. package/lib/chunk-F2424IKX.mjs +0 -7
  230. package/lib/chunk-F3AQW6IU.mjs +0 -7
  231. package/lib/chunk-FNJ4SGWO.mjs +0 -7
  232. package/lib/chunk-GOOVPVWX.mjs +0 -7
  233. package/lib/chunk-H2BHESDA.mjs +0 -9
  234. package/lib/chunk-H4CGM6YO.mjs +0 -7
  235. package/lib/chunk-HIDW7FNV.mjs +0 -9
  236. package/lib/chunk-HSBXRQTI.mjs +0 -7
  237. package/lib/chunk-HUZPBE47.mjs +0 -7
  238. package/lib/chunk-I6E6T6YY.mjs +0 -7
  239. package/lib/chunk-IUM4NFKI.mjs +0 -10
  240. package/lib/chunk-IVFVNNGB.mjs +0 -37
  241. package/lib/chunk-JCFBFF4Y.mjs +0 -7
  242. package/lib/chunk-JTJK2D36.mjs +0 -7
  243. package/lib/chunk-KB4ZHM4Q.mjs +0 -10
  244. package/lib/chunk-KJWFYBMU.mjs +0 -15
  245. package/lib/chunk-LC3NDW4N.mjs +0 -7
  246. package/lib/chunk-OM5NORJG.mjs +0 -7
  247. package/lib/chunk-OVNMB6Q2.mjs +0 -7
  248. package/lib/chunk-PEDQPM2P.mjs +0 -926
  249. package/lib/chunk-PH7SP4YK.mjs +0 -21
  250. package/lib/chunk-PMN4PAC3.mjs +0 -19
  251. package/lib/chunk-PMWAFDUB.mjs +0 -48
  252. package/lib/chunk-PPLVFX6N.mjs +0 -7
  253. package/lib/chunk-PZBZ7MNC.mjs +0 -7
  254. package/lib/chunk-QROPNEGY.mjs +0 -14
  255. package/lib/chunk-RGBGUCJA.mjs +0 -156
  256. package/lib/chunk-RKTFFCNS.mjs +0 -7
  257. package/lib/chunk-ROV3QXEF.mjs +0 -475
  258. package/lib/chunk-RT47RKLY.mjs +0 -7
  259. package/lib/chunk-SI267LYR.mjs +0 -8
  260. package/lib/chunk-SRPWW4A2.mjs +0 -10
  261. package/lib/chunk-T3G6VZNS.mjs +0 -7
  262. package/lib/chunk-T63U4OZJ.mjs +0 -7
  263. package/lib/chunk-TEIBWMJM.mjs +0 -7
  264. package/lib/chunk-TW3N6W5Z.mjs +0 -7
  265. package/lib/chunk-UBIKR5VO.mjs +0 -7
  266. package/lib/chunk-UI3JQVRU.mjs +0 -8
  267. package/lib/chunk-UX3BVH2Y.mjs +0 -7
  268. package/lib/chunk-VINGECAJ.mjs +0 -10
  269. package/lib/chunk-VOXJHJIE.mjs +0 -7
  270. package/lib/chunk-WB2RIVO3.mjs +0 -7
  271. package/lib/chunk-WXDLQT2O.mjs +0 -10
  272. package/lib/chunk-XBQGZGWR.mjs +0 -7
  273. package/lib/chunk-XGGOUNPP.mjs +0 -7
  274. package/lib/chunk-XKWW3GKF.mjs +0 -7
  275. package/lib/chunk-YHR4WQPR.mjs +0 -7
  276. package/lib/chunk-ZQQXSCVI.mjs +0 -7
  277. package/lib/chunk-ZRUDYB7O.mjs +0 -7
@@ -1,475 +0,0 @@
1
- import { createRequire as __sandforgeRequire } from 'node:module';
2
- import { fileURLToPath as __sandforgePath } from 'node:url';
3
- import { dirname as __sandforgeDirname } from 'node:path';
4
- const require = __sandforgeRequire(import.meta.url);
5
- const __filename = __sandforgePath(import.meta.url);
6
- const __dirname = __sandforgeDirname(__filename);
7
- import{b as mt}from"./chunk-2YHZBUZE.mjs";import{d as ft,s as pt}from"./chunk-2WFIVO4F.mjs";import{a as ct,b as Y,c as ht,d as X,f as lt,i as ut,k as we}from"./chunk-7QYHEHMA.mjs";import{f as dt}from"./chunk-WXDLQT2O.mjs";import{a as fe,b as F,c as nt,f as ot}from"./chunk-GNRSF65U.mjs";import{a as kt,b as bt,d as ge,e as yt,f as ke,h as $t,i as vt,j as At,k as be}from"./chunk-3TZSBHEY.mjs";import{q as wt}from"./chunk-PH7SP4YK.mjs";import{e as ae}from"./chunk-IZGCEOYO.mjs";import{a as gt}from"./chunk-TW3N6W5Z.mjs";import{d as me}from"./chunk-PEDQPM2P.mjs";import{b as ie,e as Ge}from"./chunk-RKTFFCNS.mjs";import{c as V}from"./chunk-6FARZYMJ.mjs";import{hb as Ve}from"./chunk-XGGOUNPP.mjs";import{a as Xe,n as Ze,o as Qe}from"./chunk-HIDW7FNV.mjs";import{a as st,b as pe,c as at}from"./chunk-QROPNEGY.mjs";import{B as Ke,G as K}from"./chunk-H4CGM6YO.mjs";import{I as et,L as tt,e as H,i as ue}from"./chunk-KGU4SVIT.mjs";import{a as oe,c as Be}from"./chunk-AL4C3GFT.mjs";import{a as He}from"./chunk-OUZQPYT3.mjs";import{r as We}from"./chunk-MSIEU5MR.mjs";import{m as Ye,s as se,wc as it}from"./chunk-KB4ZHM4Q.mjs";import{b as qe,f as B,h as rt}from"./chunk-LCDPCUXS.mjs";import{k as Je}from"./chunk-M6K34KGF.mjs";import{da as ze}from"./chunk-TNT27RBG.mjs";import{A as he,Ra as Fe,Va as _e,Vd as le,Yd as Me,ed as Ue}from"./chunk-PMWAFDUB.mjs";import{mkdtempSync as wn,readFileSync as gn,rmSync as kn}from"node:fs";import{tmpdir as bn}from"node:os";import{join as Et,resolve as ye}from"node:path";var yn=`sandforge checkpoint \u2014 take a checkpoint of an org's data, and rewind the org to it, without the editor.
8
-
9
- Usage:
10
- npx sandforge checkpoint <command> --org <alias> [options]
11
-
12
- Commands:
13
- take read the org's records and keep them as a checkpoint on this machine
14
- list name the checkpoints kept, newest first, with what a rewind and an undo can still reach
15
- preview say what a rewind would delete, give back and bring back, who last changed it, and what
16
- it and an undo cannot take back; writes nothing
17
- rewind return the org to a checkpoint: bring back from the recycle bin the records deleted
18
- since, give the records changed since their values back, delete the records created
19
- since, and put the files attached to its records back as they were \u2014 whoever made the
20
- changes; keep what it changes so it can be undone; then read the org again
21
- undo take back the org's last rewind: bring back what it deleted, give back what it wrote
22
- over, send back to the bin what it brought back; what anyone changed since the rewind
23
- stays, and is said
24
- delete delete a checkpoint from this machine; the org is not touched
25
- export write a checkpoint to a .sfcheckpoint file, encrypted, for a teammate who rewinds the
26
- same org from another machine; the org is not contacted
27
- import keep a .sfcheckpoint file a teammate exported as a checkpoint of the org on this
28
- machine, once the org answers that it is the file's, and its user sees all data
29
- replay set a checkpoint's records up again in another org, with new Ids \u2014 the sandbox its
30
- org became once refreshed, another sandbox, a scratch org \u2014, its own org never
31
- reached: its dry run first, then a question; nothing the other org holds is changed
32
- or deleted, and --remove takes it back
33
- replays name the replays kept on this machine, and what each left in its org; no org is
34
- contacted
35
-
36
- Required:
37
- --org <alias> sf CLI alias of the org (list: every org of the store without it;
38
- replay names --target instead)
39
-
40
- take:
41
- --name <text> what it is called (default: the date and time)
42
- --object <ApiName> an object to keep; repeat for more (default: every object people
43
- work in, empty ones included, setup and log objects left out)
44
- --exclude-object <ApiName> leave an object out; repeat for more
45
- --custom-setting <ApiName|all> keep a custom setting, or all of them, which a checkpoint leaves
46
- out unless named: a rewind sets their rows back, an integration's
47
- endpoint or an admin's switch among them; repeat for more; needs
48
- Customize Application
49
- --ignore-field <Object.Field> do not compare a field, nor write it back (one your automation sets
50
- on every save); repeat for more
51
- --max-total <n> refuse, before reading, more than <n> records (default: ${fe},
52
- ${F} at most)
53
- --keep-days <n> when it expires (default: ${H}; 0 keeps it until deleted)
54
- --estimate say the records, API requests, time and disk it would take, then stop
55
- preview, rewind, undo, delete, export:
56
- --checkpoint <id|name|latest> which one (default: latest, for undo the one the last rewind went
57
- back to; rewind and undo with --yes need it named, by id or name)
58
- preview, rewind:
59
- --object <ApiName> limit the rewind to an object of the checkpoint; repeat for more
60
- (default: every object). It writes the others only to delete again
61
- the records made since that come back with a record it brings
62
- back, and never adds what the objects named depend on: what it
63
- leaves of them for that is said, with the --object to add
64
- preview:
65
- --fail-on-change exit 3 when the org differs from the checkpoint
66
- rewind:
67
- --dry-run the preview, then stop
68
- --accept-automation rewind even when the org runs flows, Apex triggers, processes or
69
- workflow rules as records are updated, deleted or brought back;
70
- without it such a rewind writes nothing, exit 1
71
- --accept-emails rewind even when the org delivers every email its automation
72
- sends (Setup > Deliverability: All email), or would not say
73
- whether it does, and what still runs as it writes sends some:
74
- they go to the addresses the records and the alerts name, and to
75
- the records' owners. Without it such a rewind writes nothing,
76
- exit 1. --accept-automation never stands for it. Read with one
77
- line of anonymous Apex that sends nothing, only when something
78
- that still runs sends an email; what Apex triggers send is not
79
- read
80
- --mute-automation mute the org's automation for the rewind through its own bypass:
81
- assign the user it writes as, for the rewind alone, the permission
82
- sets holding the custom permissions its flows, processes and
83
- workflow rules test to stay quiet, and take them back as it ends;
84
- what no bypass keeps quiet still runs, and still needs
85
- --accept-automation. Refused on a production org and for a user
86
- who cannot assign permission sets, exit 1; with --dry-run, says
87
- what would be muted, or why it would be refused, and assigns
88
- nothing
89
- --accept-no-undo rewind even when undo could not bring back some records it deletes
90
- (objects Salesforce undeletes only with their parent, such as
91
- OpportunityLineItem); without it such a rewind writes nothing, exit 1
92
- --accept-recreate make again, with new Ids, the records deleted since that the
93
- recycle bin no longer gives back: what outside Salesforce names
94
- their old Ids no longer finds them; without it a rewind that
95
- counts such records writes nothing, exit 1, and one Salesforce
96
- answers is no longer in the bin as it brings it back is left,
97
- named
98
- --accept-outside (a checkpoint of picked objects) also delete the records outside it
99
- created under records it deletes, and the files it deletes that are
100
- attached outside it too; without it those parents stay, and those
101
- files are only removed from its records
102
- --accept-unseen (a user without View All Data and Modify All Data) delete records
103
- whose delete takes along records of objects the user is not
104
- proven to see whole \u2014 tasks and events always: the preview names
105
- those objects, and no count holds what goes with them; without it
106
- such a rewind writes nothing, exit 1
107
- --max-records <n> refuse, before it writes, a rewind that would delete, give back,
108
- bring back and make again more than <n> records together, exit 1:
109
- with --yes in a cron job or a CI step, what stands in for reading
110
- the preview
111
- --refuse-when-active refuse, before it writes, a rewind of an org where anyone but the
112
- user it writes as and the org's Automated Process changed records
113
- of the checkpoint's objects in the hour before it read the org,
114
- whose work it would take back, exit 1; the refusal says how many
115
- people. Where people sign in as the user SandForge connects as,
116
- their changes are that user's, and are not told apart
117
- --ignore-field <Object.Field> stop comparing a field from now on; kept in the checkpoint
118
- --yes do not ask before writing; without it and with no terminal \u2014 a CI
119
- step \u2014 it stops at its question, exit 2, having written nothing
120
- undo:
121
- --accept-automation as for rewind
122
- --accept-emails as for rewind
123
- --mute-automation as for rewind
124
- --yes as for rewind
125
- delete:
126
- --all every checkpoint of the org
127
- --yes do not ask
128
- export:
129
- --out <file> the file to write; refused when one is there already
130
- --key-env <VAR> encrypt under the key this environment variable holds, one an
131
- export showed (a CI step's secret); without it a new key is
132
- drawn and shown once, on stderr
133
- import:
134
- --file <file> the .sfcheckpoint file
135
- --key-env <VAR> read the key from this environment variable; without it the key
136
- is asked on the terminal, not echoed, and with no terminal it
137
- stops, exit 2, having imported nothing
138
- --keep-days <n> when it expires on this machine (default: ${H}; 0 keeps it until
139
- deleted)
140
- replay:
141
- --checkpoint <id|name|latest> which one: by its id, wherever it is kept (list names it); by its
142
- name, or latest, with --from
143
- --from <alias|username|00D\u2026> the org it was taken of, as list names it; refreshed or expired
144
- since, it is not reached
145
- --file <file> a .sfcheckpoint file a teammate sent, in place of --checkpoint:
146
- replayed without its org, the key standing for the teammate's
147
- consent; its checkpoint is kept on this machine apart from those
148
- it rewinds. A file of a Partial Copy, a Full or a Staging sandbox
149
- is refused unmasked before its key is read
150
- --key-env <VAR> with --file: the environment variable that holds its key; without
151
- it the key is asked on the terminal, not echoed, and with no
152
- terminal it stops, exit 2
153
- --keep-days <n> with --file: when its checkpoint expires here (default: ${H}; 0 keeps
154
- it until deleted)
155
- --target <alias> the org the records go into: a sandbox, a scratch org or a
156
- Developer Edition org; never a production org nor the
157
- checkpoint's own org, which rewind brings back. The Staging mark
158
- the editor gives a sandbox is not seen here
159
- --dry-run say what it would create, link, leave and refuse, and write
160
- nothing
161
- --objects <A,B> replay these objects alone (default: every object it holds);
162
- separate with commas, or repeat
163
- --exclude-object <ApiName> leave an object out; repeat for more
164
- --owners same|me same (default): a record keeps its owner where the other org has
165
- that user active \u2014 by its Id, or by its username without a
166
- sandbox's suffix \u2014, and goes to the user who replays otherwise;
167
- me: every record to the user who replays
168
- --owner-map <file.json> {"<user Id there>": "<user Id here>"}: who owns the records of
169
- each user of the checkpoint's org, an active user of the other org
170
- --link <Object=Field[,Field]> link to the records of an object the other org holds with the
171
- same values of these fields, rather than create them; repeat
172
- --custom-settings set up the custom settings the checkpoint holds too; a row the
173
- other org has already is kept, never written over
174
- --mask mask personal data, as Forge's anonymization does; required of a
175
- checkpoint of a Partial Copy, a Full or a Staging sandbox, told by
176
- its data storage and its mark; the free text it does not read is
177
- named
178
- --no-real-data declare that a sandbox's checkpoint taken before SandForge 1.81,
179
- which does not say which sandbox, holds no real data: replayed
180
- unmasked, the declaration kept in the audit trail
181
- --keep-contact-points keep emails and phone numbers as they are (default: made
182
- unreachable, addresses in .invalid and numbers that ring nobody)
183
- --replay-config <file.json> the load's part of a Frozen project's configuration: required field
184
- defaults, lookup placeholders, picklist rules, identity keys, \u2026
185
- --again replay over what the replays before created there, which goes
186
- first; what they linked stays
187
- --max-records <n> the most records it may create (default: the count of the dry run
188
- it reads first)
189
- --mute-automation mute what the other org runs as the replay writes, or as --remove
190
- deletes, through its own bypass, for that run alone, as a Frozen
191
- load does; what no bypass keeps quiet still needs
192
- --accept-automation
193
- --accept-automation write, or delete, although the other org runs flows, Apex
194
- triggers, processes or workflow rules as it does: named first,
195
- and without it such a replay writes nothing, exit 1
196
- --accept-emails write although the other org delivers the emails what still runs
197
- sends, or would not say: without it such a replay writes nothing,
198
- exit 1
199
- --checkpoint-first take a checkpoint of what the replay writes in the other org
200
- before its first write: a rewind to it takes the replay back, and
201
- the work of anyone else on those objects since
202
- --checkpoint-keep-days <n> the days that checkpoint is kept on this machine (default: 7)
203
- --checkpoint-exclude-object <ApiName>
204
- leave an object out of that checkpoint; repeat for more
205
- --yes do not ask before it writes, nor before --remove deletes; without
206
- it and with no terminal, it stops at its question, exit 2
207
- --verify verify the last replay into the other org: what it created there,
208
- counted against what it said it created
209
- --remove delete from the other org what the replays created there, children
210
- first, the checkpoint kept or not; --preview says what it would
211
- delete; --sweep takes too what the other org's automation made for
212
- them, and --sweep-list lists it and deletes nothing;
213
- --include-changed takes too what was changed since
214
- --sweep-late with --sweep: take too what it lists as made late; with
215
- --sweep-list, say what it would take
216
- --sweep-untied with --sweep: take too what it lists as tied to nothing of the
217
- replay, refused when another run of this machine wrote to the
218
- other org meanwhile; with --sweep-list, say what it would take
219
- replays:
220
- --target <alias|00D\u2026> the replays into this org alone
221
- Options:
222
- --store <dir> where checkpoints live (default: ~/.sandforge/checkpoints, or
223
- checkpoints/ in the folder SANDFORGE_JOURNAL_DIR names); the
224
- replays of its checkpoints are kept in it too, in .replays
225
- --json the answer alone on stdout, every other line on stderr
226
- --help this text
227
-
228
- A production org is refused before anything is read or written, exit 1. No flag lifts it.
229
- With View All Data and Modify All Data, the user the alias connects as sees every record and
230
- rewinds whoever changed it; import needs both. Without them, take holds only the objects the
231
- user has View All and Modify All on, or, for an object with no permissions of its own, on every
232
- record it hangs from \u2014 never tasks and events, products and price books, files or custom
233
- settings \u2014 and preview, rewind and undo read those permissions again: an object no longer held
234
- is not read, and is left as it is; what another user deleted since stays in the recycle bin,
235
- named; undo takes back the user's own rewind alone. A checkpoint that keeps custom settings
236
- needs Customize Application too: View All Custom Settings reads them, never writes them.
237
- A checkpoint holds the records' values as the org held them, personal data among them,
238
- unencrypted, in files only you can read (on Windows: in your user profile). Expired checkpoints
239
- are deleted as any command starts, each named.
240
- list and delete read this machine alone and never contact the org. An org's checkpoints are the
241
- ones taken under its alias or username, and the others kept of the same Organization Id.
242
- export never writes a checkpoint unencrypted: AES-256-GCM, under a key of 52 letters and digits
243
- shown once and kept nowhere. Anyone who has the file and its key reads every record it holds:
244
- send the key another way than the file, and only to people who already see all data in the org.
245
- The file does not expire: delete it once it has served. It carries neither the journals of
246
- rewinds nor their undo, which stay on this machine.
247
- import reads the file's header, then asks the org: another org, a production org, a user without
248
- View All Data and Modify All Data, a file a newer SandForge made, are each refused before the key
249
- is asked. A wrong key, or a file changed since it was exported, is refused before anything is
250
- kept. A checkpoint kept already the same is left as it is, exit 0; another of its id is refused.
251
- The lock against two rewinds at once is per machine: agree on who rewinds the org.
252
- replay never reaches the checkpoint's own org. It reads the other org, then creates copies of
253
- the checkpoint's records there, parents first, with new Ids, and changes or deletes nothing that
254
- org holds. A checkpoint keeps no file's content: files, attachments and documents are never
255
- replayed, each named. Owners, record types, currencies, person accounts and the standard price
256
- book are read from the other org, and every record that does not go across as it was is said,
257
- with why: a checkpoint taken before SandForge 1.81 keeps no record types, users or price book,
258
- and its records get the other org's. Its created and modified dates and users are the replay's.
259
- A replay runs its dry run first, asks, then creates no more than that dry run counted. What it
260
- wrote is kept on this machine apart from the checkpoint (replays/ beside checkpoints/, or .replays
261
- in the folder --store names), and --remove takes it back once the checkpoint is deleted. A
262
- checkpoint of a Partial Copy, a Full or a Staging sandbox replays masked only, but into that
263
- sandbox refreshed; delete names the replays a checkpoint leaves in place.
264
- rewind shows its preview and asks you to type the org's alias exactly as --org gives it before it
265
- writes, then rewinds from that preview as it read the org: a record someone changes after it read
266
- is left as they made it, and said. undo says what it takes back and asks the same before it
267
- writes. A take, a rewind or an undo of the org under way on this machine, in the editor or in
268
- another command line, refuses a rewind and an undo; other runs writing to the org are not seen
269
- here, and what one of them changes after the preview read the org is left and said the same way.
270
- Ctrl-C stops a take between two reads, and nothing of it is kept; a second Ctrl-C ends it at once,
271
- and leaves a checkpoint listed as never taken, which delete removes. Ctrl-C stops a rewind or an
272
- undo before its next call to the org, and leaves its journal: rewind again takes up from what still
273
- differs, and undo still returns the org to how it was before the rewind. A rewind stopped before
274
- it sent anything leaves none, and the undo of the rewind before it stays offered.
275
-
276
- A record deleted since that the recycle bin no longer gives back is made again from the
277
- checkpoint, with a new Id, once --accept-recreate says so: the lookups the checkpoint holds that
278
- named it name the new Id, and undo deletes it again. Salesforce still lists a record emptied from
279
- the bin as deleted, for minutes to hours, and says the bin no longer holds it only as the rewind
280
- asks it back: such a record, with what was to come back with it, is made again then, or left
281
- and named without --accept-recreate.
282
- A record the checkpoint does not hold that took records of it along when it was deleted since is
283
- brought back for a moment with them, then deleted again with what came back with it.
284
- A custom setting is kept only when --custom-setting names it. A rewind brings a row of one back
285
- only once no other row holds its owner (a hierarchy: the org's default, a profile, a user) or
286
- its name (a list): it deletes the row made since first, then brings the row back with its Id.
287
- A checkpoint holds the files attached to its records, Salesforce Files and classic attachments:
288
- which records each is attached to, its latest version and its size, never its content. A rewind
289
- deletes the files attached to them since, brings back those deleted since with their links,
290
- removes the links added since and puts back those removed since, under new Ids; a file
291
- attached to no record of the checkpoint, a user's own or a library's, is left and counted.
292
- Bringing files back from the recycle bin takes file storage again: a rewind or an undo that would
293
- take more than the org has left is refused before it writes. Without Query All Files, other
294
- users' files that no record of the checkpoint is attached to are not seen.
295
- What a rewind cannot undo: a file deleted since and no longer in the recycle bin, whose body the
296
- checkpoint does not hold, a file given a new version since, which keeps it, a lead converted
297
- since, a contract activated since, a record deleted with a parent created since that Salesforce
298
- does not undelete on its own, or with its parent of an object the checkpoint does not hold
299
- (preview counts them); without View All Data and Modify All Data, a record another user deleted
300
- since, and a record of an object held through what it hangs from that the recycle bin does not
301
- show the user (preview counts them too); a field added since, deleted since, or hidden since from
302
- the user by field-level security, which the preview tells apart and names in an object something
303
- changed in since \u2014 in an object nothing changed in, which a rewind writes nothing to, the fields
304
- are not checked, and the preview counts those objects; the values the org computes or keeps
305
- itself (formulas, roll-ups, auto-numbers, created and modified dates); what left the org
306
- (emails, callouts, outbound messages, platform events); metadata; the files of a checkpoint taken
307
- before SandForge 1.70, which holds none. A record the org refuses to put back, or to make again,
308
- is named by rewind, with its words.
309
-
310
- JSON (--json), one value on stdout:
311
- list [{id, name, org, organizationId, takenAt, records, bytes, expiresAt,
312
- expiresSoon, binReachSince, lastRewind?, valid, why?, refreshedAt?,
313
- replayWith?}]
314
- (name, org, takenAt, records and bytes are null for a damaged checkpoint;
315
- expiresAt is null for one kept until deleted; replayWith, of one that no
316
- longer rewinds its org, the dry run of its replay)
317
- take {checkpoint, requests?, estimate}: the checkpoint as kept (its
318
- checkpoint.json; files?, {documents, links, anchored, readByIds?}, for one
319
- that holds files); requests, {total, byPhase}, the API requests the take sent
320
- the org, SOAP calls among them; estimate, what it said before reading a record
321
- take --estimate {mode, objects, leftOut, estimate, refusal?, files?, customSettings?}:
322
- estimate.requestsByPhase splits the requests over a take's phases as
323
- requests.byPhase does: guard, scope, start, counts, bin, snapshot, stability;
324
- files, {held, queryAllFiles, addedToPicked}; customSettings, every custom
325
- setting of the org, kept or not, [{objectApiName, label, kind?, records?}],
326
- kind hierarchy or list, and objects[].customSetting for one kept; {mode,
327
- refusal} for a take refused before its scope is read (a production org, a
328
- user without the permissions)
329
- preview {checkpoint: {id, name, takenAt, org}, toDelete, toGiveBack, toBringBack,
330
- toRecreate, carriers, differs, diff, estimate, automation?, emails?,
331
- emailsUncounted?, deliverability?, refusal?}: carriers, the records
332
- brought back for a moment and deleted again, in none of the other numbers;
333
- diff, estimate
334
- and automation as the extension answers them; refusal, the first a rewind
335
- given no flag would meet now, of those its lines name with what lifts
336
- each, as rewind --dry-run lists them: the extension's own (the org's lock,
337
- a run writing, the day's API requests or emails, file storage), then an
338
- acceptance it needs (NO_UNDO, RECREATE, UNSEEN, AUTOMATION,
339
- EMAILS_DELIVERED, in that order); emails, one per daily limit its writes send
340
- against: {limit, emails, verdict, remaining?, max?, alertsCounted?,
341
- objects: [{objectApiName, write, records, perRecord, sentBy}]};
342
- emailsUncounted, what sends emails as it writes that could not be read \u2014 a
343
- flow whose definition was refused, a package's, which no user reads \u2014 its
344
- emails not counted, which --accept-automation covers; deliverability,
345
- when something that still runs may send an email: {reading: {level: all
346
- or withheld} or {unread}, senders: [{objectApiName, kind, name, why}]},
347
- which --accept-emails answers for all and unread;
348
- diff.objects[].schemaDrift, of an object whose fields changed since:
349
- {removed, added, changed, hidden?, uncertain?: {fields, reason?}}, removed
350
- the custom fields deleted since, hidden those field-level security hides
351
- from the user, uncertain those the org would not say which of;
352
- diff.described, {first, later}, the objects it described again, asked
353
- whether their fields changed since the take: first those something moved
354
- in, later those nothing moved in that hold fewer records than the
355
- checkpoint; diff.fieldsNotChecked, the objects nothing changed in whose
356
- fields it did not describe: a rewind writes nothing there, and a field
357
- deleted or hidden since in one of them is not known; diff.files,
358
- for a checkpoint that holds files: {unlink, relink, updateLinks,
359
- outsideAdded, outsideDeleted, storage: {bringBack, remaining?, undo},
360
- blindSpot?}, the links to remove, put back and give their sharing back, the
361
- files left, and file storage in bytes; diff.access, {kind, requests?}, org
362
- for a user with View All Data and Modify All Data, perObject for one read
363
- object by object, with the API requests that read; diff.unseen, read
364
- object by object: [{objectApiName, children, records}], of the records to
365
- delete of an object, the objects whose records their delete takes along
366
- out of the user's sight; with --object, objects, the objects named, and
367
- selection, {objects, acts: [{objectApiName, picked, toDelete, toGiveBack,
368
- toBringBack, toRecreate}], left: [{objectApiName, reason, count}], needs:
369
- [{objectApiName, records}], undoCannot}, what a rewind of them alone would
370
- do and leave \u2014 reason needsUnpickedParent, heldByUnpicked,
371
- outsideNotAccepted, holdsLeft or keyTaken \u2014 and the objects to add; the
372
- numbers, differs and estimate are then the rewind's of those objects,
373
- diff the whole diff; of a checkpoint of picked objects whose records
374
- outside it were made since under records a rewind would delete, kept:
375
- [{objectApiName, reason, count}], what a rewind without --accept-outside
376
- keeps for them \u2014 reason outsideNotAccepted or holdsLeft \u2014, the numbers
377
- then those of what it writes, differs the whole diff's (preview previews
378
- that rewind)
379
- rewind --dry-run as preview, with wouldBeRefused: ["refused (CODE): message"] and
380
- wouldBeRefusedCodes: ["CODE"], one for each refusal a rewind with these
381
- flags would meet, in order; asked to mute, emails and deliverability are
382
- of what still runs, with mutedAutomation and mutePlan
383
- rewind {checkpoint: {id, name, takenAt, org}, rewindId, status, deleted, givenBack,
384
- broughtBack, recreated (each {planned, done, left}), cannotUndo: [{object,
385
- reason, count}], carriers?: [{object, count}], draftsLeft?: [{object,
386
- count, ids}], undo?: {until, cannot: [{object, count, reason?}]}, verify:
387
- {differences, stable, passes, notCompared}, residual: [{object, reason,
388
- by?, count, message?}], unread: [{object, reason}], objects: [{object,
389
- deleted, givenBack, broughtBack, refused}], apiRequests: {used,
390
- leftToday}, result}:
391
- status success, partial, unstable, failure or cancelled; result as the
392
- extension answers it; undo.cannot's reason deletedBeforeParent: deleted
393
- before a record they point at, which the rewind deleted next; carriers, of
394
- what it brought back and deleted, the records brought back for a moment;
395
- draftsLeft, of a rewind stopped part way, the orders and contracts it made
396
- again as drafts and had not given their status back yet, by their new Ids;
397
- files?: {unlinked, relinked, linksUpdated, linksRefused}, the links between
398
- files and records it wrote, when it wrote one; with --object, limitedTo,
399
- the objects named, and notRewound, {objects, records}, the objects not
400
- named that still differ and their records that do, which the status
401
- does not count
402
- undo as rewind, without recreated, cannotUndo, carriers, draftsLeft and undo,
403
- with carriedAlone?: [{object, count}], the records sent back to the
404
- recycle bin on their own that had gone there with a record the rewind
405
- brought back for a moment
406
- delete {deleted: [id], kept: [id], replaysInPlace?}: replaysInPlace, as replays
407
- lists them, those of the checkpoints deleted that left records in their org
408
- replay {command, action, dryRun, checkpoint: {id, name, organizationId, takenAt,
409
- tier, annex}, target: {alias, organizationId}, choices?, file?, plan?,
410
- replay?: {records, owners, recordTypes, notReplayed, filesLeft,
411
- lookupsEmptied, refused, fieldsNotInTarget, customSettings?, currencies,
412
- standardPricebook?, masked, contactPoints, archivedActivities?,
413
- degraded, auditDates, storage?, requests}, result?, removal?, objects?,
414
- status?, verdict?, mapping?, refusals?, refusalCodes?, refused?,
415
- mutedAutomation?, mutePlan?, checkpointFirst?, removeWith, ended?, exit}:
416
- plan, result and removal as a Frozen load and its removal answer them;
417
- objects, status, verdict and refusals as a Frozen step gives them
418
- replays [{checkpointId, checkpointName?, sourceOrganizationId, takenAt?, target:
419
- {organizationId, name?}, choices?, replayedAt?, inPlace, inPlaceByObject,
420
- removed?, removeWith}]
421
- export {checkpoint: {id, name, takenAt, org}, file, bytes, sha256, records, objects,
422
- keyShown}: keyShown, whether a new key was drawn and shown on stderr; never
423
- the key itself
424
- import {outcome, checkpoint: {id, name, takenAt, org}, records, objects, expiresAt,
425
- warnings}: outcome imported, or alreadyKept for the same checkpoint kept here
426
- already
427
- refused or failed {refusal: {code, message}}; a rewind or an undo refused before it wrote
428
- for more than one reason adds wouldBeRefused and wouldBeRefusedCodes, as
429
- rewind --dry-run gives them: every refusal, the first among them, each other
430
- also on a line of its own, refused (CODE): message
431
- A bad command line (exit 2) prints nothing on stdout.
432
-
433
- replay ends as a Frozen load ends: 0 its dry run said, or the replay done and verified; 1 refused
434
- before it wrote (REPLAY_SAME_ORG, REPLAY_REAL_DATA, REPLAY_COPY_UNKNOWN, REPLAY_TOO_MANY,
435
- REPLAY_NOTHING, a target refused, what it runs or sends unanswered) or failed; 2 a bad line or a
436
- question with no terminal; 3 done with records refused or left, or its verification PARTIAL.
437
- Exit codes: 0 done (take: every record of its objects is kept; rewind and undo: read again, the
438
- org matches among the objects and fields compared \u2014 with --object, among the objects named,
439
- whatever still differs in the others; preview, rewind --dry-run and list answered;
440
- delete: every checkpoint named is deleted; export: the file is written; import: the checkpoint is
441
- kept, or was already); 1 refused before it read or wrote (a production org,
442
- missing permissions, automation without --accept-automation, emails the org delivers or would not
443
- say it withholds without --accept-emails (refusal code EMAILS_DELIVERED), deletions undo could not
444
- bring back without --accept-no-undo, records to make again with new Ids without --accept-recreate,
445
- deletions taking along records the user is not proven to see without --accept-unseen, more than
446
- --max-total records, more records to rewind than --max-records, people working in the org in the
447
- hour before with --refuse-when-active, more API requests or emails than the org
448
- has left today, files to bring back taking more file storage than it has left, a checkpoint of
449
- the org before a refresh or of an expired scratch org, a SandForge run writing to it; an import
450
- of another org's file, with the wrong key, of a file changed since its export), or nothing
451
- done; 2 a bad command line, a --checkpoint name several checkpoints
452
- have, an --object the checkpoint does not hold,
453
- rewind or undo with --yes and no checkpoint named, or a question with no terminal (give
454
- --yes; import's key: --key-env); 3 partial (rewind and undo: records still differ, each said
455
- with why; with
456
- --fail-on-change, the org differs: records to delete, give back, bring back or make again,
457
- links between files and records to remove, put back or give their sharing back, records the
458
- rewind cannot take back or the checkpoint does not hold although they are dated before it, files
459
- added or deleted since that no record of it is attached to, a field it compares deleted or
460
- hidden since in an object something moved in, an object that could not be read; delete: some
461
- were kept, each said with why); 4 unstable (someone else changed
462
- records during the rewind or the undo: left as they made them); 130, 143, 129 Ctrl-C, SIGTERM or
463
- SIGHUP stopped it \u2014 run rewind again: it takes up from what still differs, and undo still reaches
464
- the state before it.
465
- `,$n=["take","list","preview","rewind","undo","delete","export","import","replay","replays"],vn=e=>$n.includes(e),x={switches:["--json"],values:["--org","--store"]},An={take:{words:1,switches:[...x.switches,"--estimate"],values:[...x.values,"--name","--object","--exclude-object","--custom-setting","--ignore-field","--max-total","--keep-days"]},list:{words:1,...x},preview:{words:1,switches:[...x.switches,"--fail-on-change"],values:[...x.values,"--checkpoint","--object"]},rewind:{words:1,switches:[...x.switches,"--dry-run","--accept-automation","--accept-emails","--mute-automation","--accept-no-undo","--accept-recreate","--accept-outside","--accept-unseen","--refuse-when-active","--yes"],values:[...x.values,"--checkpoint","--ignore-field","--object","--max-records"]},undo:{words:1,switches:[...x.switches,"--accept-automation","--accept-emails","--mute-automation","--yes"],values:[...x.values,"--checkpoint"]},delete:{words:1,switches:[...x.switches,"--all","--yes"],values:[...x.values,"--checkpoint"]},export:{words:1,switches:x.switches,values:[...x.values,"--checkpoint","--out","--key-env"]},import:{words:1,switches:x.switches,values:[...x.values,"--file","--key-env","--keep-days"]},replay:{words:1,switches:["--json","--dry-run","--verify","--remove","--preview","--sweep","--sweep-list","--sweep-late","--sweep-untied","--include-changed","--custom-settings","--mask","--keep-contact-points","--no-real-data","--again","--mute-automation","--accept-automation","--accept-emails","--yes",...me.switches],values:["--store","--checkpoint","--from","--file","--key-env","--keep-days","--target","--objects","--exclude-object","--owners","--owner-map","--link","--replay-config","--max-records",...me.values]},replays:{words:1,switches:["--json"],values:["--store","--target"]}},jn={name:"--name",objects:"--object",excluded:"--exclude-object",customSettings:"--custom-setting",ignoredFields:"--ignore-field",maxTotal:"--max-total",keepDays:"--keep-days"},Rn=/^[A-Za-z][A-Za-z0-9_]{0,79}$/;function S(e){process.stderr.write(`${e}
466
- `),process.exit(2)}function Cn(e){let n=e.toISOString();return`${n.slice(0,10)} ${n.slice(11,16)} UTC`}function Sn(e,n=new Date){let t=e.slice(2);(t.includes("--help")||t.includes("-h"))&&(process.stdout.write(yn),process.exit(0));let o=t[0];if(o===void 0||o.startsWith("-"))return S("Name the command first: take, list, preview, rewind, undo, delete, export, import, replay or replays. Run with --help.");if(!vn(o))return S(`"${o}" is not a command of sandforge checkpoint: take, list, preview, rewind, undo, delete, export, import, replay or replays. Nothing was run. Run with --help.`);qe(t,An[o]);let i=w=>{let c=[];for(let l=1;l<t.length;l++){if(t[l]!==w)continue;let k=t[l+1];if(k===void 0||k.startsWith("--"))return S(`${w} wants a value.`);c.push(k),l++}return c},s=w=>{let c=i(w);return c.length>1&&S(`${w} is given ${c.length} times: give it once.`),c[0]},d=w=>{let c=s(w);if(c!==void 0)return/^\d{1,15}$/.test(c)||S(`${w} takes a whole number, not "${c}".`),Number(c)},a=s("--store"),r={storeRoot:a!==void 0?ye(a):ue(),...a!==void 0?{storeNamed:!0}:{},json:t.includes("--json")},p=s("--org"),m=()=>p??S(`${o} needs --org. Run with --help.`),g=w=>{t.includes("--yes")&&(w===void 0&&S(`${o} --yes needs --checkpoint <id|name>: one that does not ask is told which checkpoint it acts on. Nothing was run.`),w==="latest"&&S(`${o} --yes needs the checkpoint named by its id or its name, not latest: a checkpoint taken since would be the one it acts on. Nothing was run.`))},v=()=>{let w=i("--object"),c=w.find(l=>!Rn.test(l));return c!==void 0&&S(`--object takes an object's API name, not "${c}".`),w.filter((l,k)=>w.findIndex(y=>y.toLowerCase()===l.toLowerCase())===k)};switch(o){case"list":return{...r,command:o,...p!==void 0?{org:p}:{}};case"replay":return{...r,command:o,replay:kt(t,S)};case"replays":return{...r,command:o,...bt(t,S)};case"take":{let w=m(),c=i("--object"),l=i("--exclude-object"),k=i("--custom-setting"),y=k.includes("all")?"all":k,h=i("--ignore-field"),f=d("--max-total"),j={name:s("--name")??Cn(n),mode:c.length>0?"picked":"everything",...c.length>0?{objects:c}:{},...l.length>0?{excluded:l}:{},...y.length>0?{customSettings:y}:{},...h.length>0?{ignoredFields:h}:{},...f!==void 0?{maxTotal:f}:{},keepDays:d("--keep-days")??H},C=Ve.safeParse({...j,orgId:"command-line"});if(!C.success){let O=C.error.issues[0],W=String(O?.path[0]??"");return S(`${jn[W]??W}: ${O?.message??"not read"}. Nothing was run.`)}return{...r,command:o,org:w,take:{...j,name:C.data.name},estimate:t.includes("--estimate")}}case"preview":return{...r,command:o,org:m(),checkpoint:s("--checkpoint")??"latest",failOnChange:t.includes("--fail-on-change"),objects:v()};case"rewind":{let w=m(),c=s("--checkpoint");g(c);let l=i("--ignore-field"),k=_e.safeParse(l);if(!k.success)return S(`--ignore-field: ${k.error.issues[0]?.message??"not read"}. Nothing was run.`);let y=d("--max-records");return y===0&&S('--max-records takes a whole number of 1 or more, not "0". Nothing was run.'),{...r,command:o,org:w,checkpoint:c??"latest",objects:v(),dryRun:t.includes("--dry-run"),acceptAutomation:t.includes("--accept-automation"),acceptEmails:t.includes("--accept-emails"),muteAutomation:t.includes("--mute-automation"),acceptNoUndo:t.includes("--accept-no-undo"),acceptRecreate:t.includes("--accept-recreate"),acceptOutside:t.includes("--accept-outside"),acceptUnseen:t.includes("--accept-unseen"),...y!==void 0?{maxRecords:y}:{},refuseWhenActive:t.includes("--refuse-when-active"),ignoreFields:l,yes:t.includes("--yes")}}case"undo":{let w=m(),c=s("--checkpoint");return g(c),{...r,command:o,org:w,...c!==void 0?{checkpoint:c}:{},acceptAutomation:t.includes("--accept-automation"),acceptEmails:t.includes("--accept-emails"),muteAutomation:t.includes("--mute-automation"),yes:t.includes("--yes")}}case"delete":{let w=m(),c=s("--checkpoint"),l=t.includes("--all");return l&&c!==void 0&&S("Give --checkpoint or --all, not both."),{...r,command:o,org:w,...l?{}:{checkpoint:c??"latest"},all:l,yes:t.includes("--yes")}}case"export":{let w=m(),c=s("--out")??S("export needs --out <file>. Run with --help."),l=jt(s("--key-env"));return{...r,command:o,org:w,checkpoint:s("--checkpoint")??"latest",out:ye(c),...l!==void 0?{keyEnv:l}:{}}}case"import":{let w=m(),c=s("--file")??S("import needs --file <file>. Run with --help."),l=jt(s("--key-env"));return{...r,command:o,org:w,file:ye(c),...l!==void 0?{keyEnv:l}:{},keepDays:d("--keep-days")??H}}}}function jt(e){if(e!==void 0)return!/^[A-Za-z_][A-Za-z0-9_]{0,127}$/.test(e)||ae(e)!==void 0?S("--key-env takes the name of an environment variable that holds the key, never the key: a key on the command line stays in the shell\u2019s history and the list of processes. Nothing was run."):e}function Nt(e,n){return e!==void 0&&n!==void 0&&e.length>=15&&e.slice(0,15)===n.slice(0,15)}function _(e,n,t){let o=t!==void 0?[t]:[];for(let i of e){let s=i.checkpoint?.org;s!==void 0&&(s.alias===n||s.username.toLowerCase()===n.toLowerCase())&&o.push(i.organizationId)}return e.filter(i=>o.some(s=>Nt(s,i.organizationId)))}var It="One kept in another folder is read with --store <folder>, or with SANDFORGE_JOURNAL_DIR set as when it was taken \u2014 in a CI job, a folder its cache restores; one taken on another machine comes here by export there, then import here.";function re(e){return`"${oe("checkpoint")} list --org ${e}" names those it holds. ${It}`}function G(e,n,t,o){if(Fe.safeParse(t).success){let s=e.find(d=>d.checkpointId===t);return s?{entry:s}:{none:`No checkpoint ${t} is kept in the folder read. ${re(o)}`}}if(t==="latest"){let s=n[0];return s?{entry:s}:{none:`No checkpoint of ${o} is kept in the folder read. ${re(o)}`}}let i=n.filter(s=>s.checkpoint?.name===t);return i.length===1?{entry:i[0]}:i.length===0?{none:`No checkpoint of ${o} named '${t}' is kept in the folder read. `+re(o)}:{ambiguous:`${i.length} checkpoints of ${o} are named '${t}': give the id of the one you mean with --checkpoint (${i.map(s=>s.checkpointId).join(", ")}).`}}function Ce(e){if(e.valid)return;let n=e.checkpoint?`'${e.checkpoint.name}'`:e.checkpointId;switch(e.why){case"damaged":return{code:"DAMAGED",message:`The file of checkpoint ${e.checkpointId} cannot be read: it can only be deleted.`};case"taking":return{code:"TAKING",message:`The checkpoint ${n} is being taken, or its take never ended: it can be previewed once taken, or deleted.`};case"failed":return{code:"FAILED",message:`The take of checkpoint ${n} failed: it can only be deleted.`};case"refreshed":return{code:"OTHER_ORG",message:`This sandbox was refreshed${e.refreshedAt?` on ${e.refreshedAt.slice(0,10)}`:""}: it is another org now, and the checkpoint ${n} is of the org before it. It no longer rewinds. ${Rt(e)}`};case"scratchExpired":return{code:"SCRATCH_EXPIRED",message:`The scratch org of checkpoint ${n} has expired: its checkpoints no longer rewind it. ${Rt(e)}`};default:return{code:"INVALID",message:`The checkpoint ${n} cannot be previewed.`}}}function Se(e){let n=e.checkpoint?.org,t=e.why==="refreshed"&&n!==void 0?n.alias??n.username:"<alias>";return`${ke(e.checkpointId,t)} --dry-run`}function Rt(e){return`${he.replace(/\.$/,"")}: ${Se(e)}`}function Dt(e){return!e.valid&&(e.why==="refreshed"||e.why==="scratchExpired")}var u=e=>e.toLocaleString("en-US");function E(e){let n=new Date(Date.parse(e)).toISOString();return`${n.slice(0,10)} ${n.slice(11,16)} UTC`}function $e(e){let n=new Date(Date.parse(e)).toISOString();return`${n.slice(0,10)} ${n.slice(11,19)} UTC`}var U=e=>`${it(e/(1024*1024))} MB`;function $(e,n=8){if(e.length===0)return"\u2014";let t=e.slice(0,n).join(", ");return e.length>n?`${t} \u2026 (+${e.length-n})`:t}function Q(e){return e.objects.reduce((n,t)=>n+t.records,0)}function Oe(e){return e===null?"kept until you delete it":`kept until ${E(e)}`}function z(e){return e.org.alias??e.org.username}var On=/^Left out(?::\s*|\s+(?=as asked\b))/;function Pt(e,n){let t=[...n,...e.flatMap(({code:s,records:d})=>s==="pastTheLimit"&&d!==void 0?[d]:[])],o=t.filter(s=>s<=F).reduce((s,d)=>s+d,0),i=new Map;for(let{objectApiName:s,reason:d,code:a,records:r}of e){let p=d;if(a==="pastTheLimit"&&r!==void 0&&r<=F){let m=ot(t,r);p=m>F?`${d} With it, every object no larger is kept, more than ${F} records in all, past any --max-total: --exclude-object <ApiName> leaves some out.`:`${d} --max-total ${m}${m===o?" or more":""} holds it.`}i.set(p,[...i.get(p)??[],s])}return[...i].map(([s,d])=>` left out: ${$(d)} \u2014 ${s.replace(On,"")}`)}var xn={fls:"hidden from the user SandForge connects as by field-level security: Rewind won\u2019t put them back",encrypted:"encrypted, and the user SandForge connects as can\u2019t view encrypted data: Rewind won\u2019t touch them",base64:"the content of files and other binary values, which a checkpoint doesn\u2019t hold",compound:"compound fields, kept through the fields they are made of"};function Lt(e){let n=new Map;for(let t of e)for(let{field:o,reason:i}of t.leftOutFields)n.set(i,[...n.get(i)??[],`${t.objectApiName}.${o}`]);return[...n].map(([t,o])=>` fields left out (${o.length}): ${$(o)} \u2014 ${xn[t]??t}`)}function Tt(e){let n=e.filter(t=>!t.undeletable).map(t=>t.objectApiName);return n.length===0?[]:[` deleted ${$(n)} records come back from the recycle bin only with their parent`]}function Bt(e){return` about ${u(e.seconds)} s \xB7 about ${u(e.apiRequests)} API requests of the ${u(e.apiRequestsLeft)} left today`+(e.bytes>0?` \xB7 about ${U(e.bytes)} on this machine`:"")}var Ct={damaged:"its file cannot be read: it can only be deleted",taking:"being taken, or its take never ended: it can only be deleted unless it ends",failed:"its take failed: it can only be deleted",refreshed:"of the org before its refresh: it no longer rewinds, and replays into another org",scratchExpired:"its scratch org has expired: it no longer rewinds, and replays into another org"};function En(e,n,t){if(e.length===0&&t!==void 0){let i=t.kept===0?"":`, which keeps ${t.kept===1?"1 of another org":`${t.kept} of other orgs`}: "${oe("checkpoint")} list" names ${t.kept===1?"it":"them"}`;return[`No checkpoint of ${t.org} is kept in ${n}${i}. ${It}`]}if(e.length===0)return[`No checkpoint is kept in ${n}.`];let o=[];for(let i of e){let s=i.checkpoint;if(!s){o.push(`${i.checkpointId} ${Ct.damaged}`);continue}if(o.push(`${i.checkpointId} '${s.name}' ${z(s)} taken ${E(s.takenAt)} ${u(Q(s))} records in ${s.objects.length} objects ${U(s.bytes)} `+Oe(s.expiresAt)),!i.valid){let d=i.why==="refreshed"&&i.refreshedAt?`refreshed on ${i.refreshedAt.slice(0,10)}: `:"";o.push(` ${d}${Ct[i.why??""]??"it cannot be previewed"}`),Dt(i)&&(o.push(` replay it: ${Se(i)}`),s.expiresAt!==null&&o.push(` deleted from this machine on ${E(s.expiresAt)}: to replay it after, Keep it in the editor, or export it and replay the file`))}i.scratchExpiresSoon&&s.org.scratchExpiresAt!==void 0&&o.push(` its scratch org expires on ${s.org.scratchExpiresAt.slice(0,10)}: its checkpoints then no longer rewind it, whatever --keep-days said, and still replay into another org`),i.expiresSoon&&s.expiresAt!==null&&o.push(` expires on ${E(s.expiresAt)}: take a new one, or keep this one in the editor`),i.binReachSince&&o.push(` records deleted before ${i.binReachSince.slice(0,10)} can't come back with their Id (recycle bin), sooner if the bin fills: a rewind makes them again, with new Ids`),i.undo&&o.push(` rewound: the rewind can be undone until ${E(i.undo.until)}`)}return o}function Nn(e){let n=e.checkpoint;return{id:e.checkpointId,name:n?.name??null,org:n?z(n):null,organizationId:e.organizationId,takenAt:n?.takenAt??null,records:n?Q(n):null,bytes:n?.bytes??null,expiresAt:n?n.expiresAt:null,expiresSoon:e.expiresSoon===!0,scratchExpiresSoon:e.scratchExpiresSoon===!0,binReachSince:e.binReachSince??null,...n?.lastRewind?{lastRewind:{...n.lastRewind,undoable:e.undo!==void 0}}:{},valid:e.valid,...e.why!==void 0?{why:e.why}:{},...e.refreshedAt!==void 0?{refreshedAt:e.refreshedAt}:{},...Dt(e)?{replayWith:Se(e)}:{}}}function Ft(e){return e.refusal!==void 0&&e.objects.length===0&&e.leftOut.length===0}function In(e){return Ft(e)?{mode:e.mode,refusal:e.refusal}:{...e}}function ve(e){if(e.code!=="TOO_MANY_RECORDS")return e;let n="pick fewer objects (--exclude-object <ApiName> leaves one out)",t=`(${u(fe)} unless given)`,o=e.holdingLimit,i=o===void 0?`${n}, or raise the limit with --max-total <n> ${t}`:o>F?`${n}: no --max-total holds them all, ${u(F)} at most`:`${n}, or raise the limit with --max-total ${o} ${t}`;return{...e,message:e.message.replace(/: pick fewer objects\./,`: ${i}.`)}}function Dn(e,n){if(Ft(n))return[`refused: ${n.refusal.message}`];let t=n.objects.filter(i=>i.records>0).length,o=new Map;for(let{namespace:i}of n.objects)i!==void 0&&o.set(i,(o.get(i)??0)+1);return[`a checkpoint of ${e} would keep ${n.objects.length} objects (${t} hold records; ${n.objects.length-t} are empty \u2014 what is created there later is caught too), about ${u(n.estimate.records)} records`,...[...o].map(([i,s])=>` includes ${s} objects of the ${i} package`),Bt(n.estimate),...Pt(n.leftOut,n.objects.map(i=>i.records)),...Lt(n.objects),...Tt(n.objects),...n.files?Ln(n.files):[],...Pn(n),...n.refusal?[`refused: ${ve(n.refusal).message}`]:[]]}function _t(e){let n=e.records===void 0?void 0:`${u(e.records)} ${e.records===1?"row":"rows"}`,t=[e.kind,n].filter(o=>o!==void 0);return t.length>0?`${e.objectApiName} (${t.join(", ")})`:e.objectApiName}function Ut(e){return _t({objectApiName:e.objectApiName,...e.customSetting!==void 0?{kind:e.customSetting}:{},records:e.records})}function Pn(e){let n=e.objects.filter(i=>i.customSetting!==void 0),t=new Set(n.map(i=>i.objectApiName)),o=(e.customSettings??[]).filter(i=>!t.has(i.objectApiName));return[...n.length>0?[` custom settings kept: ${$(n.map(Ut))} \u2014 a rewind sets their rows back as the checkpoint holds them, whoever changed them since`]:[],...o.length>0?[` custom settings not kept: ${$(o.map(_t))} \u2014 --custom-setting <ApiName|all> keeps them`]:[]]}function Ln(e){return e.held?[" files: it keeps which files are attached to its records (Salesforce Files, classic attachments) and each file's latest version, not its content; a rewind deletes the files attached to them since and brings back those deleted since. A file attached to no record it holds, a user's own or a library's, is left as it is",...Mt(e.addedToPicked),...e.queryAllFiles?[]:[xe]]:[" files: not kept \u2014 a rewind leaves the files attached since as they are"]}function Mt(e){return e.length>0?[` added to the objects picked: ${e.join(", ")} \u2014 without them a rewind would leave the files attached since as they are`]:[]}var xe=" the user the alias connects as doesn't have Query All Files: other users' files that no record of the checkpoint is attached to (in a library the user is not a member of, say) are not seen, nor counted among the files left; files attached to its records are seen";function Tn(e,n,t=[]){let o=e.movedWhileTaken,i=o.changed+o.deleted+o.created;return[`taken '${e.name}' (${e.checkpointId}) of ${z(e)}: ${u(Q(e))} records in ${e.objects.length} objects, ${U(e.bytes)} on this machine, ${Oe(e.expiresAt)}`,` of ${$e(e.readFrom)}, read until ${$e(e.takenAt)} on the org's clock`,...i>0?[` ${u(i)} records changed while it was taken (${o.changed} changed, ${o.deleted} deleted, ${o.created} created): it holds them as they were read, and a rewind treats them as changed since. Take checkpoints when nobody works in the org.`]:[],...Pt(e.scope.leftOut,e.objects.map(s=>s.records)),...Lt(e.objects),...e.ignoredFields.length>0?[` not compared, nor written back (you chose): ${e.ignoredFields.join(", ")}`]:[],...Tt(e.objects),...Bn(e.objects),...e.files?Fn(e,e.files,t):[],` it holds the records' values unencrypted, in files only you can read: ${n}`]}function Bn(e){let n=e.filter(t=>t.customSetting!==void 0);return n.length===0?[]:[` custom settings kept: ${$(n.map(Ut))} \u2014 a rewind sets their rows back as the checkpoint holds them`]}function Fn(e,n,t){let o=n.readByIds??[],i=new Set(t.map(a=>a.toLowerCase())),s=new Set(e.objects.map(({objectApiName:a})=>a.toLowerCase())),d=e.scope.mode==="picked"?Je.filter(a=>s.has(a.toLowerCase())&&!i.has(a.toLowerCase())):[];return[` files: ${u(n.anchored)} attached to its records by ${u(n.links)} link(s): a rewind takes back what is attached to them since`,...Mt(d),...o.length>0?[` the links of ${$(o)} were read by lists of record Ids: ${z(e)} refused one query, or answered too late`]:[],...e.takenBy.queryAllFiles===!1?[xe]:[]]}function _n(e,n){let t=Object.entries(e.byPhase).map(([i,s])=>{let d=n?.requestsByPhase?.[i];return d===void 0||d===s?`${i} ${s}`:`${i} ${s} (${d})`}),o=n?`, about ${u(n.apiRequests)} estimated`:"";return` sent ${u(e.total)} API requests to the org${o}: ${t.join(", ")}`}var St=e=>e.toDelete.createdSince+e.toDelete.broughtBackSince+e.toDelete.comesBackWithParent,J=e=>e.toBringBack.inBin+e.toBringBack.withParent+e.toBringBack.deletedWhileTaken,Ae=e=>e.cannotUndo.reduce((n,t)=>n+t.count,0),Z=e=>e.toRecreate??0,de=e=>e.toBringBack.carriers??0;function Wt(e){let n=e.files;return n===void 0?0:n.unlink+n.relink+n.updateLinks}function Un(e){let n=e.files;return n===void 0?0:n.outsideAdded+n.outsideDeleted}function Mn(e){let n=e.schemaDrift;return n===void 0?0:n.removed.length+(n.hidden?.length??0)+(n.uncertain?.fields.length??0)}function Ee(e){let n=Y(e);return n.toDelete+n.toGiveBack+n.toBringBack+n.toRecreate>0||Wt(e)+Un(e)>0||e.objects.some(t=>Ae(t)>0||t.unexplained>0||Mn(t)>0)||e.unread.length>0}var Wn={goneForGood:"deleted since and no longer in the recycle bin, and not made again \u2014 a file, whose body the checkpoint does not hold, or a record deleted while it was taken: they can\u2019t come back",convertedLead:"leads converted since: Salesforce can\u2019t unconvert a lead",activatedContract:"contracts activated since: Salesforce won\u2019t set them back to Draft",deletedWithCreatedParent:"deleted with a parent created since that Salesforce does not undelete on its own: they come back with that parent only",deletedWithParentOutside:"deleted with their parent, a record of an object the checkpoint does not hold: they come back with that parent only, which a checkpoint that holds its object brings back",newFileVersion:"files given a new version since: Salesforce deletes no version and won\u2019t make an older one the latest again, so they keep their new content; the content each had is still in its version history, and their titles are given back",deletedByOther:"deleted since by another user: only View All Data and Modify All Data restore those; they stay in the recycle bin, never made again",outOfReach:"out of reach: without View All Data and Modify All Data, nothing shows what others deleted of an object held through the records it hangs from; they may be in the recycle bin out of sight, and are never made again"},qn=[{reason:"onlyWithParent",preview:"Salesforce undeletes them only with their parent, and their parent stays",result:"Salesforce undeletes them only with their parent"},{reason:"deletedBeforeParent",preview:"deleted before a record they point at, which the rewind deletes next: Salesforce cannot bring them back after that",result:"deleted before a record they point at, which the rewind deleted next: Salesforce cannot bring them back after that"}];function qt(e){return qn.flatMap(n=>{let t=e.filter(o=>(o.reason??"onlyWithParent")===n.reason);return t.length>0?[{words:n,of:t}]:[]})}function Hn(e,n){let{automation:t,deliverability:o}=n;if(!t||!o)return[];let i=X(n.diff),{line:s}=Qe({act:"rewind",orgName:e,automation:t,steps:i,accepted:!0,mayMute:!1,...Ze({automation:t,steps:i}),reading:o.reading}).gate;return s!==void 0?[` ${s}`]:[]}function Gn(e,n){return n.map(t=>{let o=[...new Set(t.objects.flatMap(s=>s.sentBy))],i=` emails: ${e}'s automation sends about ${Xe(t.emails,t.limit)} as the rewind writes (${$(o,4)})`+(t.alertsCounted?`, its email alerts among them: ${e} counts them against its single emails, as a Developer Edition does`:"");return t.verdict==="unread"?`${i}; what it has left today could not be read (${t.unread??""})`:t.verdict==="fits"?`${i}; ${t.remaining??0} of ${t.max??0} left today`:`${i}, more than the ${t.remaining??0} of ${t.max??0} left today: a rewind is refused`})}function zn(e,n){if(!e||n.length===0)return"";let t=le(e,{giveBack:n}).map(o=>`${o.objectApiName}: '${o.name}'`);return t.length>0?`, on which runs ${$(t,4)}`:""}function Jn(e,n,t=[]){let o=e.objects.filter(a=>ze[a.objectApiName]!==void 0),i=o.filter(a=>Z(a)>0),s=o.filter(a=>J(a)>0&&!t.includes(a.objectApiName)),d=[];return i.length>0&&d.push(` made as drafts first: ${$(i.map(a=>`${a.objectApiName} ${u(Z(a))}`))} \u2014 Salesforce refuses an order or a contract made past Draft, and an order takes its products only as a draft: one past Draft at the checkpoint is made at the org's Draft status, the records under it next, then given its status back, an update`+zn(n,i.map(a=>a.objectApiName))),s.length>0&&d.push(` if Salesforce answers that an order or a contract to bring back is no longer in the recycle bin, --accept-recreate makes it again as a draft, then gives it its status back, an update: ${$(s.map(a=>`${a.objectApiName} ${u(J(a))}`))}`),d}function Vn(e,n,t=!1){if(!n)return{objects:[],fired:[]};let o=X(e),i=[],s=new Set;for(let d of e.objects){if(J(d)===0)continue;let a=lt(n,o,[d.objectApiName],t);if(!(a.fired.length===0&&!a.blind)){i.push(d.objectApiName);for(let r of a.fired)s.add(`${r.objectApiName}: '${r.name}'`)}}return{objects:i,fired:[...s]}}function Kn(e,n,t){let o=le(n,t),i=[];for(let d of n.objects){let a=o.filter(g=>g.objectApiName===d.objectApiName),r=[...new Set(a.filter(g=>g.kind!=="trigger").map(g=>`'${g.name}'`))],p=[...new Set(a.filter(g=>g.kind==="trigger").map(g=>g.name))],m=[...r.length>0?[`${r.length} flow(s) or rule(s): ${$(r,4)}`]:[],...p.length>0?[`${p.length} Apex trigger(s): ${$(p,4)}`]:[]];m.length>0&&i.push(` ${d.objectApiName}: ${m.join("; ")}`)}return[...i.length>0?[` what ${e} runs as a rewind writes (updates, deletes, records brought back):`]:[],...i,...n.unread.map(d=>` not read of its automation: ${d.part} \u2014 ${d.reason}`)]}function Ht(e,n,t,o="the user SandForge connects as",i=!1){let{diff:s}=t,d=Y(s),a=[`Rewind ${e} to '${n.name}' (${E(n.takenAt)}), read at ${$e(s.readAt)}:`,` ${u(d.toDelete)} to delete \xB7 ${u(d.toGiveBack)} to give back \xB7 ${u(d.toBringBack)} to bring back`+(d.toRecreate>0?` \xB7 ${u(d.toRecreate)} to make again`:"")];!Ee(s)&&!s.objects.some(h=>h.outside.length>0)&&a.push(` ${e} is as it was at '${n.name}' among the objects and fields it holds: nothing to rewind.`);let r=s.objects.filter(h=>St(h)+h.toGiveBack.records+J(h)+Z(h)+Ae(h)>0);if(r.length>0){let h=Math.max(6,...r.map(f=>f.objectApiName.length));a.push(` ${"Object".padEnd(h)} ${"Delete".padStart(8)} ${"Give back".padStart(9)} ${"Bring back".padStart(10)} ${"Can't undo".padStart(10)}`);for(let f of r)a.push(` ${f.objectApiName.padEnd(h)} ${u(St(f)).padStart(8)} ${u(f.toGiveBack.records).padStart(9)} ${u(J(f)).padStart(10)} ${u(Ae(f)).padStart(10)}`)}let p=new Map;for(let h of s.objects)for(let[f,j]of Object.entries(h.lastChangedBy))p.set(f,(p.get(f)??0)+j);p.size>0&&a.push(` last changed by: ${[...p].sort((h,f)=>f[1]-h[1]).map(([h,f])=>`${s.userNames[h]??h} ${u(f)}`).join(" \xB7 ")}`),s.activeLastHour.length>0&&a.push(` people working in ${e} in the last hour: ${s.activeLastHour.map(h=>s.userNames[h]??h).join(", ")}`);let m=s.objects.filter(h=>h.touched>0);m.length>0&&a.push(` touched since but holding their checkpoint values: ${$(m.map(h=>`${h.objectApiName} ${u(h.touched)}`))}`);let g=s.objects.filter(h=>de(h)>0);g.length>0&&a.push(` brought back for a moment: ${$(g.map(h=>`${h.objectApiName} ${u(de(h))}`))} \u2014 records the checkpoint does not hold that took records of it along when deleted since: Salesforce gives those back with them only, so they come back, then go back to the recycle bin with what came back with them; what the org runs on them runs twice`);let v=new Map;for(let h of s.objects)for(let f of h.cannotUndo)f.count!==0&&v.set(f.reason,[...v.get(f.reason)??[],`${h.objectApiName} ${u(f.count)}`]);for(let[h,f]of v)a.push(` can't be taken back: ${$(f)} \u2014 ${Wn[h]??h}`);let w=s.objects.filter(h=>Z(h)>0);w.length>0&&a.push(` to make again, with new Ids: ${$(w.map(h=>`${h.objectApiName} ${u(Z(h))}`))} \u2014 deleted since and no longer in the recycle bin: made again from the checkpoint, the lookups it holds that named them naming the new Ids; anything outside Salesforce that names their old Ids no longer finds them`);let c=d.toBringBack>0?Vn(s,t.automation,i):void 0;if(c){let h=c.fired.length>0?`making them again runs ${$(c.fired,4)}`:"what runs as they are made again could not all be read";a.push(" if Salesforce answers that a record to bring back is no longer in the recycle bin \u2014 it still lists one emptied from it as deleted \u2014, --accept-recreate makes it again with a new Id, with what was to come back with it; without it, the rewind leaves them and names them"+(c.objects.length>0?`; ${$(c.objects)} records it leaves all the same, with what was to come back with them, and names them: ${h}, which this rewind does not ask about \u2014 a rewind after it counts them to make again, and asks`:""))}a.push(...Jn(s,t.automation,c?.objects));let l=s.objects.filter(h=>h.unexplained>0);l.length>0&&a.push(` left as they are: ${$(l.map(h=>`${h.objectApiName} ${u(h.unexplained)}`))} \u2014 records the checkpoint doesn't hold although they're dated before it (a load with back-dated creation dates?); a rewind deletes nothing it cannot prove was created since`);for(let{words:h,of:f}of qt(s.undoCannot))a.push(` undo couldn't bring back: ${$(f.map(j=>`${j.objectApiName} ${u(j.count)}`))} \u2014 ${h.preview}`);for(let{objectApiName:h,children:f,records:j}of s.unseen??[])a.push(` also deleted with them, out of sight: deleting ${u(j)} ${h} also deletes what ${o} can't see under them in ${$(f)}; Rewind can't count those, and deletes them only with --accept-unseen`);for(let h of s.objects)for(let f of h.outside)a.push(h.objectApiName===Gt&&f.objectApiName===Yn?` also attached outside the checkpoint: ${u(f.parents)} file(s) it deletes, by ${u(f.count)} link(s) to a library, a group or a record of another object \u2014 deleting them removes them from there as well`:f.objectApiName===K?` also deleted with them, outside the checkpoint: ${u(f.count)} ${K} in which ${e}'s duplicate rules reported ${u(f.parents)} ${h.objectApiName} since the checkpoint \u2014 an undo brings ${f.count===1?"it back without its":"them back without their"} items, which Salesforce does not return`:` also deleted with them, outside the checkpoint: ${u(f.count)} ${f.objectApiName} created under ${u(f.parents)} ${h.objectApiName}`);a.push(...Xn(e,s));let k=s.objects.flatMap(h=>{let f=h.schemaDrift,j=new Set([...f?.removed??[],...f?.hidden??[],...f?.uncertain?.fields??[]]);return h.notCompared.filter(C=>!j.has(C)).map(C=>`${h.objectApiName}.${C}`)});k.length>0&&a.push(` not compared (you chose): ${$(k)}`);for(let h of s.objects){let f=h.schemaDrift;if(!f)continue;let j=C=>C.map(O=>`${h.objectApiName}.${O}`);f.removed.length>0&&a.push(` fields deleted since: ${$(j(f.removed))} \u2014 restore them from Deleted Fields, then rewind`),(f.hidden??[]).length>0&&a.push(` fields hidden from ${o} by field-level security since: ${$(j(f.hidden??[]))} \u2014 rewind does not put them back; give ${o} read and edit access to them, then rewind again`),f.uncertain!==void 0&&f.uncertain.fields.length>0&&a.push(` fields gone from what ${e} shows ${o}: ${$(j(f.uncertain.fields))} \u2014 deleted since (restore them from Deleted Fields within 15 days), or hidden by field-level security (give ${o} read and edit access); rewind does not put them back`+(f.uncertain.reason!==void 0?` (which, ${e} would not say: ${f.uncertain.reason})`:"")),f.added.length>0&&a.push(` fields added since, their values left alone: ${$(j(f.added))}`),f.changed.length>0&&a.push(` fields changed since, tried one by one: ${$(j(f.changed))}`)}let y=s.fieldsNotChecked??0;y>0&&a.push(` fields not checked for changes in ${u(y)} objects nothing changed in: a rewind writes nothing there`);for(let h of s.unread)a.push(` could not be read: ${h.objectApiName} \u2014 ${h.reason} (never taken for unchanged)`);return t.automation&&a.push(...Kn(e,t.automation,X(s))),t.emails&&a.push(...Gn(e,t.emails)),t.emailsUncounted!==void 0&&a.push(` emails: not counted, ${t.emailsUncounted} could not be read \u2014 what they send as the rewind writes is not known; --accept-automation covers it`),a.push(...Hn(e,t)),a.push(Bt(t.estimate)),t.refusal&&a.push(` a rewind now would be refused (${t.refusal.code}): ${t.refusal.message}`),a}var Gt="ContentDocument",Yn="ContentDocumentLink";function Xn(e,n){let t=n.files;if(t===void 0)return[];let o=[];t.unlink>0&&o.push(` links to remove: ${u(t.unlink)} added since between a file and a record that both stay \u2014 the file stays, no longer attached to that record`),t.relink>0&&o.push(` links to put back: ${u(t.relink)} removed since between a file and a record that both stay, each under a new Id: Salesforce keeps no removed link in the recycle bin`),t.updateLinks>0&&o.push(` links to give their sharing back: ${u(t.updateLinks)} \u2014 who sees the file from the record, and with what access; a link to an account keeps its access, which Salesforce doesn't let change`),t.outsideAdded>0&&o.push(` kept: ${u(t.outsideAdded)} file(s) added since, as no record of this checkpoint links to them (a user's own, a library's)`),t.outsideDeleted>0&&o.push(` left in the recycle bin: ${u(t.outsideDeleted)} file(s) deleted since, as no record of this checkpoint linked to them`);let i=n.objects.find(a=>a.objectApiName===Gt),s=i===void 0?0:J(i),{storage:d}=t;return s>0&&d.bringBack>0&&o.push(` file storage: bringing back ${u(s)} file(s) takes ${U(d.bringBack)} again; `+(d.remaining===void 0?`${e} did not say how much it has left`:`${e} has ${U(d.remaining)} left`)),d.undo>0&&o.push(` undo would bring back the files this rewind deletes: ${U(d.undo)} of file storage again`),t.blindSpot&&o.push(xe),o}function zt(e,n,t,o,i){let s=o?.diff??i?.diff??t.diff;return{checkpoint:{id:n.checkpointId,name:n.name,takenAt:n.takenAt,org:e},...o?{objects:[...o.plan.objects]}:{},...Y(s),carriers:s.objects.reduce((d,a)=>d+de(a),0),differs:Ee(o?.diff??t.diff),...o?{selection:o.plan}:{},...i?{kept:i.plan.left}:{},diff:t.diff,estimate:t.estimate,...t.automation?{automation:t.automation}:{},...t.emails?{emails:t.emails}:{},...t.emailsUncounted!==void 0?{emailsUncounted:t.emailsUncounted}:{},...t.deliverability?{deliverability:t.deliverability}:{},...t.refusal?{refusal:t.refusal}:{}}}function Zn(e,n){return n&&Ee(e)?3:0}var Jt={needsUnpickedParent:"they come back only with a parent this rewind leaves deleted, or look up a record it leaves deleted, which Salesforce refuses: those lookups are left, the rest written",heldByUnpicked:"records of an object not named made since hang from them and hold some of their values in place: given back but for those",outsideNotAccepted:"records of an object not named made since hang from them, which their deletion would take along: kept, unless --accept-outside",holdsLeft:"records this rewind leaves as they are hang from them, which their deletion would take along: kept",keyTaken:"rows of a custom setting whose owner or name a row made since holds: brought back once it is gone"};function Vt(e){let n=[` limited to ${e.objects.join(", ")}: the other objects are left as they are, and what still differs in them is counted apart`],t=e.acts.filter(o=>!o.picked&&o.toDelete>0);t.length>0&&n.push(` also deletes again ${$(t.map(o=>`${o.objectApiName} ${u(o.toDelete)}`))} \u2014 made since, they come back with a record it brings back: leaving them would make a state that never existed`);for(let o of e.left)n.push(` left: ${u(o.count)} ${o.objectApiName} record(s) \u2014 ${Jt[o.reason]}`);return e.needs.length>0&&n.push(` to rewind those too, add ${e.needs.map(o=>`--object ${o.objectApiName} (${u(o.records)} record(s) need it)`).join(", ")}`),e.acts.some(o=>o.picked&&o.toDelete>0)&&n.push(" a record of an object not named that looks up a record it deletes has that lookup emptied by Salesforce, and is dated that second"),n}function Kt(e,n,t){return!t&&e.scope.mode==="picked"&&n.objects.some(o=>o.outside.length>0)}function Yt(e){return e.left.map(n=>` kept: ${u(n.count)} ${n.objectApiName} record(s) \u2014 `+(n.reason==="outsideNotAccepted"?"records outside the checkpoint made since hang from them, which their deletion would take along: kept, unless --accept-outside":Jt[n.reason]))}async function Xt(e,n,t,o){if(!Kt(n,t,o))return;let i=n.objects.map(({objectApiName:s})=>s);return Ne(e,t,i,!1)}function Zt(e,n){let t=new Map(e.objects.map(({objectApiName:i})=>[i.toLowerCase(),i])),o=n.filter(i=>!t.has(i.toLowerCase()));if(o.length>0)throw new b({code:"NOT_HELD",message:`--object: '${e.name}' holds no ${o.join(", ")}. It holds ${$(e.objects.map(i=>i.objectApiName))}. Nothing was run.`},2);return n.flatMap(i=>t.get(i.toLowerCase())??[])}async function Ne(e,n,t,o){let i=await e.request({type:"checkpoint:plan-selection",payload:{checkpointId:n.checkpointId,previewId:n.previewId,objects:[...t],acceptOutside:o},timeoutMs:ce});if(i.outcome!=="answered")throw new b(P(i,"The plan of the objects named"));let s=D(i).plan;return{plan:s,diff:ht(n,s)}}var ee={limit:e=>`--max-records ${e}`,mutes:!0,lift:{acceptAutomation:"give --accept-automation to rewind all the same",acceptEmails:"add --accept-emails to rewind all the same",acceptNoUndo:"give --accept-no-undo to rewind all the same",acceptRecreate:"give --accept-recreate to rewind all the same",acceptUnseen:"give --accept-unseen to rewind all the same",maxRecords:"read its preview (--dry-run), then give a --max-records that holds it",refuseWhenActive:"rewind once they are done, or without --refuse-when-active"}};function Qn(e){return e.code==="AUTOMATION"?{...e,message:e.message.replace(pt,ee.lift.acceptAutomation)}:e}function eo(e){return e.code==="AUTOMATION"?{...e,message:e.message.replace(mt,"give --accept-automation to undo the rewind all the same")}:e}function ii(e,n,t,o="the user SandForge connects as"){return ut(e,n,t,ee.lift,o,ee.mutes)}var to={acceptAutomation:!1,acceptNoUndo:!1,acceptRecreate:!1};function Qt(e,n){return[...e?[e]:[],...n.filter(t=>t.code!==e?.code)]}function no(e,n,t,o){let i=o!==void 0&&o.length>0?`${o.join(", ")} of ${e}`:e,s=Y(t),d=s.toRecreate>0?`, and makes ${u(s.toRecreate)} record(s) the recycle bin no longer holds again, with new Ids`:"",a=t.objects.reduce((g,v)=>g+de(v),0),r=a>0?`, with ${u(a)} record(s) brought back for a moment that had taken records of the checkpoint along, then deleted again`:"",p=Wt(t),m=p>0?`, and puts ${u(p)} link(s) between files and records back as they were`:"";return`Rewind ${i} to '${n.name}': it deletes the ${u(s.toDelete)} record(s) created since ${E(n.takenAt)}, gives ${u(s.toGiveBack)} record(s) their values from then back, and brings back ${u(s.toBringBack)} record(s) from the recycle bin${r}${d}${m} \u2014 whoever made these changes. What it changes is kept, so it can be undone. Type ${e} to rewind it:`}var R=(e,n)=>e.reduce((t,o)=>t+n(o),0);function Ie(e){let n=R(e.deleted,a=>a.deleted),t=R(e.deleted,a=>a.planned),o=R(e.restored,a=>a.restored+(a.restoredWithout??0)),i=R(e.restored,a=>a.planned),s=R(e.undeleted,a=>a.undeleted+a.alreadyBack),d=R(e.undeleted,a=>a.planned);return{deleted:{planned:t,done:n,left:Math.max(0,t-n-R(e.deleted,a=>a.alreadyGone))},givenBack:{planned:i,done:o,left:Math.max(0,i-o-R(e.restored,a=>a.alreadyGone))},broughtBack:{planned:d,done:s,left:Math.max(0,d-s)}}}function en(e){let n=e.recreated??[],t=R(n,i=>i.planned),o=R(n,i=>i.created);return{planned:t,done:o,left:Math.max(0,t-o)}}function oo(e){return(e.remade??[]).reduce((n,t)=>{let o=R(e.deleted.filter(i=>i.objectApiName===t.objectApiName),i=>i.deleted);return n+Math.min(o,t.count)},0)}function tn(e,n){return e===void 0?"another user":n[e]??e}function io(e,n,t){switch(n.reason){case"automation":return e==="rewind"?"kept by your automation, which sets them again on save: rewind --ignore-field <Object.Field> stops comparing such a field":"set again on save by your automation, since the undo gave them back their values";case"changedDuringRewind":return`changed during the ${e} by ${tn(n.by,t)}: left as they made them`;case"changedSincePreview":return"changed since the preview: rewind again to take them";case"refused":return`refused: ${n.message??"the org gave no reason"}`;case"notInBin":return"no longer in the recycle bin \u2014 emptied from it, or kept there for good \u2014: Salesforce still lists them as deleted but will not bring them back; --accept-recreate makes them again with new Ids";case"goneForGood":return"deleted since and no longer in the recycle bin, and not made again (a file, whose body the checkpoint does not hold, or a record deleted while it was taken): they can't come back";case"kept":return n.message??"kept as they are";case"notBack":return"brought back without their items, gone for good"+(n.message!==void 0?` (${n.message})`:"")+": Salesforce brings a deleted duplicate record set back without its items"}}function nn(e,n){return`Stopped before it wrote anything: ${e} is as it was before this rewind. Rewind again to rewind it to '${n}'.`}function so(e,n,t,o={},i){let s=R(t.residual,c=>c.count),d=t.residual.filter(c=>c.reason==="changedDuringRewind"),a={success:`${e} is back at '${n.name}': read again, nothing differs among the objects and fields it holds.`,partial:`${e} is back at '${n.name}' but for ${u(s)} record(s) that still differ, each said with why:`,unstable:`Someone kept writing to ${e} during the rewind: ${[...new Set(d.map(c=>tn(c.by,o)))].join(", ")} changed ${u(R(d,c=>c.count))} record(s), left as they made them. Rewind again once they have stopped.`,failure:`Nothing of the rewind of ${e} to '${n.name}' went through: what still differs is said with why:`,cancelled:t.undo===void 0?nn(e,n.name):`Stopped part way: ${e} is between '${n.name}' and now. Rewind again to finish: it takes up from what still differs, and undo still returns ${e} to how it was before the rewind.`},r=t.scope;r!==void 0&&t.status==="success"&&(a.success=`${r.objects.join(", ")} of ${e} ${r.objects.length>1?"are":"is"} back at '${n.name}': read again, nothing differs among them.`);let p=Ie(t),m=R(t.undeleted,c=>c.alreadyBack),g=[a[t.status]];if(r!==void 0){let{objects:c,records:l}=r.notRewound;g.push(l>0?` not rewound: ${u(l)} record(s) of ${$(c)} still differ, left as they are \u2014 the rewind was limited to the objects named; add them with --object`:" the objects not named match the checkpoint too")}if(p.deleted.done>0){let c=R(t.wentAlong??[],l=>l.count);g.push(` deleted ${u(p.deleted.done)} record(s) added since the checkpoint \u2014 created, or brought back from the recycle bin they were in when it was taken \u2014`+(c>0?`, ${u(c)} of them with the record they hang from`:"")+" (in the recycle bin for up to 15 days)")}p.givenBack.done>0&&g.push(` gave ${u(p.givenBack.done)} record(s) back their checkpoint values`),p.broughtBack.done>0&&g.push(` brought back ${u(p.broughtBack.done-m)} record(s) deleted since the checkpoint, with their original Ids`+(m>0?`, and ${u(m)} that came back with them`:""));let v=t.status==="failure"?[]:t.carriers??[];if(v.length>0){let c=$(v.map(l=>`${l.objectApiName} ${u(l.count)}`));g.push(t.status==="cancelled"?` of them, brought back for a moment: ${c} \u2014 records the checkpoint does not hold that had taken records of it along; stopped before it was through, those it had not deleted again yet are still in the org: rewind again deletes them, with what came back with them`:` of them, brought back for a moment and deleted again: ${c} \u2014 records the checkpoint does not hold that had taken records of it along, back in the recycle bin with what came back with them`)}let w=en(t);w.done>0&&g.push(` made again ${u(w.done)} record(s) the recycle bin no longer held, with new Ids`);for(let c of t.draftsLeft??[])g.push(` left as drafts: ${c.objectApiName} ${u(c.count)} (${$(c.ids,3)}) \u2014 made again as drafts, the rewind stopped before it gave them back the status the checkpoint holds: rewind again gives it back to them, an update`);if(g.push(...sn("rewind",e,t)),g.push(...an("rewind",t,o)),t.undo){g.push(` undo it until ${E(t.undo.until)}, sooner if the recycle bin fills: ${oe("checkpoint")} undo --org ${e} --checkpoint ${n.checkpointId}`+(i!==void 0?` --store ${Be(i)}`:""));for(let{words:c,of:l}of qt(t.undo.cannot))g.push(` undo couldn't bring back: ${$(l.map(k=>`${k.objectApiName} ${u(k.count)}`))} \u2014 ${c.result}`)}for(let c of t.removedJournals??[])g.push(` removed the journal of rewind ${c.rewindId} of '${c.name}': undo reaches the last rewind of the org alone`);return g.push(rn(t)),g}function on(e){return`Stopped before it wrote anything: ${e} is as the rewind left it, and the rewind can still be undone.`}function ao(e,n,t){let o=R(t.restored,c=>c.keptChanged)+R(t.deleted,c=>c.keptChanged),i=R([...t.deleted,...t.restored,...t.undeleted],c=>c.refused),s=R(t.residual,c=>c.count)+i,d=`${e} is back as it was before its rewind to '${n.name}'`,a={success:`${d}.`,partial:o>0&&s===0?`${d}, except ${u(o)} record(s) changed since the rewind, left as they are now.`:`${d}, except ${u(s+o)} record(s), each said with why:`,unstable:`Someone changed records of ${e} during the undo: left as they made them, each said below.`,failure:`Nothing of the undo of ${e}'s rewind went through: its reasons are said below.`,cancelled:Ue(t)?on(e):`Stopped part way: ${e} is between the rewind and how it was before it. Undo again to finish: it takes up what this one left.`},r=Ie(t),p=[a[t.status]],m=oo(t),g=R(t.wentAlong??[],c=>c.count),v=r.deleted.done-m-g;v>0&&p.push(` sent back to the recycle bin ${u(v)} record(s) the rewind brought back`+(g>0?", with what came back with them":"")),m>0&&p.push(` deleted again ${u(m)} record(s) the rewind made again, with what went with them`);let w=t.carriedAlone??[];if(w.length>0&&p.push(` of them, back in the recycle bin on their own: ${$(w.map(c=>`${c.objectApiName} ${u(c.count)}`))} \u2014 they had gone there with a record the rewind brought back for a moment, which stays there; they come back alone, under the parent the checkpoint gave them`),r.broughtBack.done>0){let c=R(t.cameBackAlong??[],l=>l.count);p.push(` brought back ${u(r.broughtBack.done)} record(s) the rewind deleted`+(c>0?`, ${u(c)} of them with the record they hang from`:""))}return r.givenBack.done>0&&p.push(` gave ${u(r.givenBack.done)} record(s) back the values they had before the rewind`),o>0&&p.push(` kept ${u(o)} record(s) changed since the rewind: undo leaves them as they are now`),p.push(...sn("undo",e,t)),p.push(...an("undo",t,{})),p.push(rn(t)),p}function sn(e,n,t){let o=t.files;if(o===void 0)return[];let i=e==="rewind"?{unlinked:"removed {n} link(s) added since between files and records: the files stay",relinked:"put back {n} link(s) removed since between files and records, under new Ids",linksUpdated:"gave {n} link(s) between files and records their sharing back"}:{unlinked:"removed again {n} link(s) between files and records the rewind put back",relinked:"put back {n} link(s) between files and records the rewind removed, under new Ids",linksUpdated:"gave {n} link(s) between files and records back the sharing they had before the rewind"},s=["unlinked","relinked","linksUpdated"].filter(d=>o[d]>0).map(d=>` ${i[d].replace("{n}",u(o[d]))}`);return o.linksRefused>0&&s.push(` ${n} refused to write ${u(o.linksRefused)} link(s) between files and records`),s}function an(e,n,t){let o=n.residual.map(i=>` ${i.objectApiName} ${u(i.count)} \u2014 ${io(e,i,t)}`);if(e==="rewind")for(let i of n.deleted){if(i.objectApiName!==K)continue;let s=i.refused+i.keptChanged+i.keptDependents;s!==0&&o.push(` left: ${u(s)} ${K} its preview named among what goes along`+(i.reasons.length>0?` \u2014 ${i.reasons.join("; ")}`:""))}if(e==="undo")for(let i of[...n.deleted,...n.restored,...n.undeleted])i.refused!==0&&o.push(` ${i.objectApiName} ${u(i.refused)} \u2014 refused: ${i.reasons[0]??"the org gave no reason"}`);for(let i of n.unread??[])o.push(` could not be read again: ${i.objectApiName} \u2014 ${i.reason} (never taken for unchanged)`);return o}function rn(e){return` sent ${u(e.apiRequests.used)} API requests to the org; ${u(e.apiRequests.leftToday)} left today`}function dn(e,n,t,o,i){let s=new Map,d=r=>{let p=s.get(r);return p||(p={object:r,deleted:0,givenBack:0,broughtBack:0,refused:0},s.set(r,p)),p};for(let r of o.deleted)d(r.objectApiName).deleted+=r.deleted,d(r.objectApiName).refused+=r.refused;for(let r of o.restored)d(r.objectApiName).givenBack+=r.restored+(r.restoredWithout??0),d(r.objectApiName).refused+=r.refused;for(let r of o.undeleted)d(r.objectApiName).broughtBack+=r.undeleted+r.alreadyBack,d(r.objectApiName).refused+=r.refused;for(let r of o.recreated??[])d(r.objectApiName).refused+=r.refused;let a=(o.unread??[]).map(r=>({object:r.objectApiName,reason:r.reason}));return{checkpoint:{id:t.checkpointId,name:t.name,takenAt:t.takenAt,org:n},rewindId:o.rewindId,status:o.status,...o.scope?{limitedTo:[...o.scope.objects],notRewound:{...o.scope.notRewound}}:{},...Ie(o),...e==="rewind"?{recreated:en(o),cannotUndo:(i?.objects??[]).flatMap(r=>r.cannotUndo.filter(p=>p.count>0).map(p=>({object:r.objectApiName,reason:p.reason,count:p.count})))}:{},...e==="rewind"&&(o.carriers??[]).length>0?{carriers:(o.carriers??[]).map(r=>({object:r.objectApiName,count:r.count}))}:{},...e==="rewind"&&(o.draftsLeft??[]).length>0?{draftsLeft:(o.draftsLeft??[]).map(r=>({object:r.objectApiName,count:r.count,ids:[...r.ids]}))}:{},...e==="undo"&&(o.carriedAlone??[]).length>0?{carriedAlone:(o.carriedAlone??[]).map(r=>({object:r.objectApiName,count:r.count}))}:{},...o.files?{files:{...o.files}}:{},...o.undo?{undo:{until:o.undo.until,cannot:o.undo.cannot.map(r=>({object:r.objectApiName,count:r.count,...r.reason!==void 0?{reason:r.reason}:{}}))}}:{},verify:{differences:R(o.residual,r=>r.count)+a.length,stable:o.status!=="unstable",passes:o.passes,notCompared:[...t.ignoredFields]},residual:o.residual.map(r=>({object:r.objectApiName,reason:r.reason,...r.by!==void 0?{by:r.by}:{},count:r.count,...r.message!==void 0?{message:r.message}:{}})),unread:a,objects:[...s.values()],apiRequests:o.apiRequests,result:o}}function cn(e,n){switch(e){case"success":return 0;case"partial":return 3;case"unstable":return 4;case"failure":return 1;case"cancelled":return n!==void 0?ie(n):1}}var ro=10*6e4,co=720*6e4,hn=60*6e4,ce=5*6e4,Ot=200,b=class extends Error{constructor(t,o=1,i=[]){super(t.message);this.refusal=t;this.code=o;this.also=i;this.name="Stop"}refusal;code;also};function ho(e){let n=[e.refusal,...e.also];return{refusal:e.refusal,...e.also.length>0?{wouldBeRefused:n.map(t=>V(t)),wouldBeRefusedCodes:n.map(t=>t.code)}:{}}}function D(e){return e.message?.payload??{}}function P(e,n){let t=D(e);if(e.outcome==="unanswered")return{code:"UNANSWERED",message:`${n}: no answer came in time.`};let o=typeof t.message=="string"?t.message:JSON.stringify(t),i=typeof t.code=="string"?t.code:e.outcome.toUpperCase(),{holdingLimit:s}=t;return{code:i,message:o,...typeof s=="number"?{holdingLimit:s}:{}}}function lo(e){let n=D(e).alsoRefused;return e.outcome!=="failed"||!Array.isArray(n)?[]:n.flatMap(t=>{let{code:o,message:i}=t??{};return typeof o=="string"&&typeof i=="string"?[{code:o,message:i}]:[]})}async function uo(e=process.argv,n={}){let t=Sn(e),o=c=>{process[t.json?"stderr":"stdout"].write(`${c}
467
- `)},i=c=>{t.json&&process.stdout.write(`${JSON.stringify(c,null,2)}
468
- `)},s=tt({root:t.storeRoot,...n.locksDir!==void 0?{locksDir:n.locksDir}:{}});if("refusal"in s){let c=`The checkpoints cannot be kept in ${s.refusal.path}: `+et(s.refusal,t.storeRoot,"--store <folder>");process.stderr.write(`${c}
469
- `),i({refusal:{code:"STORE_REFUSED",message:c}}),B(1);return}let d=s.store,a=wn(Et(bn(),"sandforge-checkpoint-")),r=new gt,p=!1,m,g=()=>Promise.resolve(),v,w;try{let c=(n.createHost??wt)({storeDir:a,log:h=>{p&&h.startsWith("[INFO] ")?o(h.slice(7)):h.startsWith("[WARN] ")&&o(`warning: ${h.slice(7)}`)},compose:h=>{h.handlers.setCheckpointStore(d),h.handlers.rewindCheckpointsFromPreviewsAnswered(),h.handlers.setInfraServices({backgroundRegistry:r}),g=()=>h.handlers.sweepCheckpoints(),v=h.handlers,w=h},onPost:h=>{if(h.type!=="operation:progress")return;let f=h.payload?.currentStep;typeof f!="string"||f===m||(m=f,o(` ${f}`))}});p=!0;try{await g()}finally{p=!1}let l=async()=>{let h=await c.request({type:"checkpoint:list",timeoutMs:ce});if(h.outcome!=="answered")throw new b(P(h,"The list of checkpoints"));return D(h).checkpoints??[]},k=async h=>{try{return await c.connect(h)}catch(f){throw new b({code:"NOT_CONNECTED",message:f instanceof He?f.message:`${h} could not be reached: ${f instanceof Error?f.message:String(f)}`})}},y=async h=>{if(w===void 0)throw new Error("The host composed no handlers.");return nt(await We(h.id,w.orgRegistry,w.orgManager)).userId()};switch(t.command){case"list":{let h=await l(),f=t.org!==void 0?_(h,t.org):h,j=t.org!==void 0?{org:t.org,kept:h.length}:void 0;for(let C of En(f,d.root,j))o(C);i(f.map(Nn));return}case"take":await go(t,c,await k(t.org),d,r,o,i);return;case"preview":{let h=await l(),f=te(G(h,_(h,t.org),t.checkpoint,t.org)),j=Ce(f);if(j)throw new b(j);let C=f.checkpoint,O=t.objects.length>0?Zt(C,t.objects):void 0,W=await k(t.org);De(W,f,C,t.org,"preview");let q=await c.request({type:"checkpoint:preview",payload:{checkpointId:f.checkpointId,...O?{objects:O}:{},acceptOutside:!1},timeoutMs:hn});if(q.outcome!=="answered")throw new b(P(q,"The preview"));let N=D(q),L=O?await Ne(c,N.diff,O,!1):void 0,I=O?void 0:await Xt(c,C,N.diff,!1),ne=L??I,A=ne?{...N,diff:ne.diff}:N,Le=Qt(N.refusal,await we({orgName:t.org,preview:A,bounds:{refuseWhenActive:!1},accepted:to,writers:()=>Promise.resolve([]),words:ee,user:W.username})),[Te]=Le;for(let T of Ht(t.org,C,A,W.username))o(T);for(let T of L?Vt(L.plan):[])o(T);for(let T of I?Yt(I.plan):[])o(T);for(let T of Le.slice(N.refusal?1:0))o(` a rewind now would be refused (${T.code}): ${T.message}`);i(zt(t.org,C,{...N,...Te?{refusal:Te}:{}},L,I)),B(Zn(L?.diff??N.diff,t.failOnChange));return}case"rewind":case"undo":{let h={host:c,registry:r,store:d,listAll:l,connect:k,userIdOf:y,say:o,answerJson:i};t.command==="rewind"?await bo(t,h):await vo(t,h);return}case"delete":await ko(t,c,l,o,i);return;case"export":await po(t,{transfers:xt(v),listAll:l,say:o,answerJson:i});return;case"import":await mo(t,{transfers:xt(v),connect:k,say:o,answerJson:i});return;case"replay":await $t(t.replay,{storeRoot:t.storeRoot,storeNamed:t.storeNamed===!0,store:d,...n.locksDir!==void 0?{locksDir:n.locksDir}:{},listAll:l,checkpointsOf:_,resolve:G,say:o,json:t.json});return;case"replays":await At(t.target,{storeRoot:t.storeRoot,storeNamed:t.storeNamed===!0,say:o,answerJson:i});return}}catch(c){let l=c instanceof b?c:c instanceof ge?new b(c.refusal,c.code):new b({code:"FAILED",message:c instanceof Error?c.message:String(c)});process.stderr.write(`${c instanceof ge?V(c.refusal):l.message}
470
- `);for(let k of l.also)process.stderr.write(`${V(k)}
471
- `);l.code!==2&&i(ho(l)),B(l.code)}finally{r.dispose(),kn(a,{recursive:!0,force:!0})}}function xt(e){if(e===void 0)throw new Error("The host composed no handlers.");return e}function fo(){try{let e=JSON.parse(gn(Et(__dirname,"..","package.json"),"utf8"));return typeof e.version=="string"?e.version:"0.0.0"}catch{return"0.0.0"}}function ln(e){let n=process.env[e];if(n===void 0||n.trim()==="")throw new b({code:"NO_KEY",message:`${e} is not set: it holds no key. Nothing was run.`},2);let t=ae(n);if(t===void 0)throw new b({code:"NO_KEY",message:`${e} holds no key SandForge reads: 52 letters and digits, in groups of four as an export shows one. Nothing was run.`},2);return t}function un(e,n){return{id:e.checkpointId,name:e.name,takenAt:e.takenAt,org:n}}async function po(e,n){let{say:t,answerJson:o}=n,i=e.keyEnv!==void 0?ln(e.keyEnv):void 0,s=await n.listAll(),d=te(G(s,_(s,e.org),e.checkpoint,e.org)),a=await n.transfers.exportCheckpoint({checkpointId:d.checkpointId,out:e.out,...i!==void 0?{key:i}:{},sandforgeVersion:fo()});if(!a.exported)throw new b(a.refusal);let{checkpoint:r,header:p}=a;t(`exported '${r.name}' (${r.checkpointId}) of ${e.org}, taken ${E(r.takenAt)}: ${u(p.records)} record(s) of ${u(p.objects)} object(s), ${U(a.bytes)}, to ${e.out}`),t(` sha256 ${a.sha256}`),a.key!==void 0&&process.stderr.write(` key, shown this once and kept nowhere: ${a.key}
472
- `),t(` Anyone who has this file and its key can read the ${u(p.records)} records it holds of ${e.org}, personal data among them. Send the key another way than the file, and only to people who already see all data in ${e.org}.`),t(" The file does not expire: delete it once it has served."),o({checkpoint:un(r,e.org),file:e.out,bytes:a.bytes,sha256:a.sha256,records:p.records,objects:p.objects,keyShown:a.key!==void 0})}async function mo(e,n){let{say:t,answerJson:o}=n,i=e.keyEnv!==void 0?ln(e.keyEnv):void 0,s=await n.connect(e.org),d=await n.transfers.readCheckpointImport({orgId:s.id,file:e.file});if(d.header!==void 0){let{header:m}=d;t(`the file holds checkpoint ${m.checkpointId}, taken ${E(m.takenAt)}: ${u(m.records)} record(s) of ${u(m.objects)} object(s), ${U(m.bytes)}, exported by SandForge ${m.sandforgeVersion}`)}if(!d.allowed)throw new b(d.refusal.code==="OTHER_ORG"?{...d.refusal,message:`${d.refusal.message} Its replay into ${e.org}: ${yt(e.file,e.org)} --dry-run`}:d.refusal);let a=i??await wo(),r=await n.transfers.importCheckpoint({orgId:s.id,file:e.file,key:a,keepDays:e.keepDays});if(!r.imported)throw new b(r.refusal);let{checkpoint:p}=r;t(r.outcome==="imported"?`imported '${p.name}' (${p.checkpointId}) of ${e.org}: ${u(Q(p))} record(s) of ${u(p.objects.length)} object(s), ${Oe(p.expiresAt)}`:`'${p.name}' (${p.checkpointId}) is kept on this machine already, the same: left as it is`);for(let m of r.warnings)t(` ${m}`);o({outcome:r.outcome,checkpoint:un(p,e.org),records:Q(p),objects:p.objects.length,expiresAt:p.expiresAt,warnings:r.warnings})}async function wo(){let e=await at("Key of the file (not shown as you type it):","give --key-env VAR, the name of an environment variable that holds the key");if(e===void 0||e.trim()==="")throw new b({code:"DECLINED",message:"No key was typed. Nothing was imported."});let n=ae(e);if(n===void 0)throw new b({code:"IMPORT_KEY",message:"That is not a key SandForge draws: 52 letters and digits, in groups of four as the export showed it. Nothing was imported."});return n}function te(e){if("entry"in e)return e.entry;throw"ambiguous"in e?new b({code:"AMBIGUOUS",message:e.ambiguous},2):new b({code:"NOT_FOUND",message:e.none})}async function go(e,n,t,o,i,s,d){let{take:a}=e;if(e.estimate){let l={orgId:t.id,mode:a.mode,...a.objects?{objects:a.objects}:{},...a.excluded?{excluded:a.excluded}:{},...a.customSettings?{customSettings:a.customSettings}:{},...a.maxTotal!==void 0?{maxTotal:a.maxTotal}:{}},k=await n.request({type:"checkpoint:scope",payload:l,timeoutMs:ro});if(k.outcome!=="answered")throw new b(P(k,"The estimate"));let y=D(k),h={mode:y.mode,objects:y.objects,leftOut:y.leftOut,estimate:y.estimate,...y.refusal?{refusal:ve(y.refusal)}:{},...y.files?{files:y.files}:{},...y.customSettings?{customSettings:y.customSettings}:{}};for(let f of Dn(e.org,h))s(f);d(In(h)),B(h.refusal?1:0);return}s(`taking a checkpoint of ${e.org}: it reads every record of its objects (Ctrl-C stops it, and nothing of it is kept)`);let{answer:r,stoppedBy:p}=await Pe(i,"the take stops after the read under way, and keeps nothing",()=>n.request({type:"checkpoint:take",payload:{orgId:t.id,...a},timeoutMs:co}));if(r.outcome!=="answered"){let l=ve(P(r,"The take"));throw p!==void 0&&l.code==="CANCELLED"?new b(l,ie(p)):new b(l)}let m=D(r),g=m.checkpoint,v=m.requests,w=m.estimate,c=o.folderOf(g.org.organizationId,g.checkpointId).dir;for(let l of Tn(g,c,a.objects??[]))s(l);v&&s(_n(v,w)),d({checkpoint:g,...v?{requests:v}:{},...w?{estimate:w}:{}})}async function ko(e,n,t,o,i){let s=await t(),d=_(s,e.org),a=e.checkpoint===void 0?d:[te(G(s,d,e.checkpoint,e.org))];if(a.length===0)throw new b({code:"NOT_FOUND",message:`No checkpoint of ${e.org} is kept in the folder read. ${re(e.org)} Nothing was deleted.`});let r=l=>l.checkpoint?`'${l.checkpoint.name}' (${l.checkpointId})`:l.checkpointId;if(!e.yes){let l=a.filter(f=>f.undo!==void 0),k=a.length===1?`Delete ${r(a[0])}${a[0].checkpoint?`, taken ${E(a[0].checkpoint.takenAt)},`:""} from this machine? ${e.org} can no longer be rewound to it`:`Delete the ${a.length} checkpoints of ${e.org} from this machine (${$(a.map(r),4)})? ${e.org} can no longer be rewound to them`,y=(await be(a,{storeRoot:e.storeRoot,storeNamed:e.storeNamed===!0})).entries,h=`${k}${l.length>0?", and its last rewind can no longer be undone":""}. The org is not touched`+(y.length>0?`, nor the ${y.length===1?"org it was":"orgs they were"} replayed into (${$(y.map(f=>f.target.name??f.target.organizationId),4)}), each replay still taken back with --remove`:"")+".";if(!await st(h))throw new b({code:"DECLINED",message:"Nothing was deleted."})}let p=a.map(l=>l.checkpointId);for(let l=0;l<p.length;l+=Ot){let k=await n.request({type:"checkpoint:delete",payload:{checkpointIds:p.slice(l,l+Ot)},timeoutMs:ce});if(k.outcome!=="answered"){let y=P(k,"The delete");if(l===0)throw new b(y);o(`refused: ${y.message}`);break}}let m=new Set((await t()).map(l=>l.checkpointId)),g=a.filter(l=>!m.has(l.checkpointId)),v=a.filter(l=>m.has(l.checkpointId));for(let l of g)o(`deleted ${r(l)}`);for(let l of v)o(`kept ${r(l)}: a take, a rewind or an undo of its org is running; delete it once it has ended`);let w=await be(g,{storeRoot:e.storeRoot,storeNamed:e.storeNamed===!0});for(let l of w.lines)o(l);let c=e.storeNamed?e.storeRoot:void 0;i({deleted:g.map(l=>l.checkpointId),kept:v.map(l=>l.checkpointId),...w.entries.length>0?{replaysInPlace:w.entries.map(l=>vt(l,c))}:{}}),v.length>0&&B(g.length>0?3:1)}function De(e,n,t,o,i){if(Nt(e.orgId,n.organizationId))return;let s=_([n],o).length>0,d=i==="preview"?"preview it":i==="rewind"?"rewind to it":"undo it";throw new b({code:"OTHER_ORG",message:s?`${o} answers as another org than the one '${t.name}' was taken of: a sandbox refreshed since is another org, and this checkpoint no longer rewinds it. ${he.replace(/\.$/,"")}: ${ke(n.checkpointId,o)} --dry-run. No record was read.`:`'${t.name}' is a checkpoint of ${z(t)}, not of ${o}: ${d} with --org ${z(t)}. No record was read.`})}async function Pe(e,n,t){let o,i=e.onEvent((d,a,r)=>{o!==void 0&&a==="started"&&r.module==="checkpoint"&&e.abort(d)}),s=Ge(d=>{o=d,process.stderr.write(`
473
- interrupted: ${n} (Ctrl-C again ends it at once)
474
- `);for(let a of e.getRunning())a.module==="checkpoint"&&e.abort(a.operationId)});try{let d=await t();return o!==void 0?{answer:d,stoppedBy:o}:{answer:d}}finally{s(),i()}}var fn=720*6e4;function pn(e,n,t=o=>o){let{answer:o,stoppedBy:i}=e;if(o.outcome!=="answered"){let s=t(P(o,n));throw i!==void 0&&s.code==="CANCELLED"?new b(s,ie(i)):new b(s,1,lo(o).map(t))}return D(o).result}async function bo(e,n){let{host:t,say:o,answerJson:i}=n,s=await n.listAll(),d=te(G(s,_(s,e.org),e.checkpoint,e.org)),a=Ce(d);if(a)throw new b(a);let r=d.checkpoint,p=e.ignoreFields.filter(A=>!r.ignoredFields.includes(A));if(p.length>0){let A=await t.request({type:"checkpoint:ignore-fields",payload:{checkpointId:d.checkpointId,fields:[...r.ignoredFields,...p]},timeoutMs:ce});if(A.outcome!=="answered")throw new b(P(A,"The fields not to compare"));r=D(A).checkpoint,o(`not compared from now on, nor written back: ${p.join(", ")} (kept in '${r.name}')`)}let m=e.objects.length>0?Zt(r,e.objects):void 0,g=await n.connect(e.org);De(g,d,r,e.org,"rewind");let v=await t.request({type:"checkpoint:preview",payload:{checkpointId:d.checkpointId,...m?{objects:m}:{},...e.muteAutomation?{muteAutomation:!0}:{},acceptOutside:e.acceptOutside},timeoutMs:hn});if(v.outcome!=="answered")throw new b(P(v,"The preview"));let w=D(v),c=m?await Ne(t,w.diff,m,e.acceptOutside):void 0,l=m?void 0:await Xt(t,r,w.diff,e.acceptOutside),k=c??l,y=k?{...w,diff:k.diff}:w,h=e.muteAutomation&&y.automation?Ye(y.automation,Me(X(y.diff))):void 0,f=h?{...y,automation:h.automation}:y;for(let A of Ht(e.org,r,f,g.username,e.acceptAutomation))o(A);for(let A of c?Vt(c.plan):[])o(A);for(let A of l?Yt(l.plan):[])o(A);for(let A of h?se(h.planned,e.org):[])o(` ${A}`);let j=ct(f.diff).length>0,C=await we({orgName:e.org,preview:f,bounds:{...e.maxRecords!==void 0?{maxRecords:e.maxRecords}:{},refuseWhenActive:e.refuseWhenActive},accepted:e,writers:async()=>dt(r.takenBy,await n.userIdOf(g)),words:ee,user:g.username}),O=Qt(f.refusal,C);if(Kt(r,f.diff,e.acceptOutside)&&o(" without --accept-outside, the records they hang from stay, and so do they: each is said once the rewind is through"),e.dryRun){for(let A of O.slice(f.refusal?1:0))o(` a rewind now would be refused (${A.code}): ${A.message}`);i({...zt(e.org,r,w,c,l),...h?{mutedAutomation:h.planned,mutePlan:h.plan}:{},...O.length>0?{wouldBeRefused:O.map(A=>V(A)),wouldBeRefusedCodes:O.map(A=>A.code)}:{}});return}let[q,...N]=O;if(q)throw new b(q,1,N);if(j&&!e.yes&&await pe(no(e.org,r,f.diff,m))!==e.org)throw new b({code:"DECLINED",message:"Nothing was written."});let L=await Pe(n.registry,"the rewind stops before its next call to the org, and leaves its journal: rewind again takes up from what still differs",()=>t.request({type:"checkpoint:rewind",payload:{checkpointId:d.checkpointId,previewId:f.diff.previewId,...m?{objects:m}:{},acceptAutomation:e.acceptAutomation,...e.acceptEmails?{acceptEmails:!0}:{},...e.muteAutomation?{muteAutomation:!0}:{},acceptNoUndo:e.acceptNoUndo,acceptRecreate:e.acceptRecreate,acceptOutside:e.acceptOutside,acceptUnseen:e.acceptUnseen},timeoutMs:fn})),I=pn(L,"The rewind",A=>A.code==="CANCELLED"?{...A,message:nn(e.org,r.name)}:Qn(A)),ne=e.storeRoot!==ue()?e.storeRoot:void 0;for(let A of so(e.org,r,I,f.diff.userNames,ne))o(A);for(let A of I.mutedAutomation?se(I.mutedAutomation,e.org):[])o(A);i(dn("rewind",e.org,r,I,f.diff)),B(cn(I.status,L.stoppedBy))}function yo(e,n,t,o,i){return`undo the rewind ${t} of ${e} to '${n.name}' (open until ${E(o)}, sooner if the recycle bin fills)`+(i?`: it brings back ${u(i.bringBack)} record(s) the rewind deleted`+((i.bringBackAlong??0)>0?`, with the ${u(i.bringBackAlong??0)} that went with them`:"")+`, gives ${u(i.giveBack)} record(s) back the values they had before it, and sends ${u(i.remove-i.remade)} record(s) it brought back to the recycle bin`+(i.along>0?", with what came back with them":"")+(i.remade>0?`, deleting again the ${u(i.remade)} record(s) it made again`:"")+(i.drafted>0?` \u2014 of them, ${u(i.drafted)} order(s) set back to Draft first if past it, the one way Salesforce deletes one: an update, which what runs on an order's update fires on`:"")+"; what anyone changed since the rewind stays":"")}async function $o(e,n,t,o){try{let i=e.folderOf(n.organizationId,n.checkpointId),s=await ft(i,o,t.objects);try{return{bringBack:s.bringBack.count,bringBackAlong:s.comesWithParent.count,giveBack:s.giveBack.count,remove:s.remove.spool.count,along:s.goesWithParent.count,remade:s.remade.keys.size,drafted:s.remade.objects.filter(({objectApiName:d})=>Ke([d]).length>0).reduce((d,{count:a})=>d+a,0)}}finally{await s.dispose()}}catch{return}}async function vo(e,n){let{host:t,say:o,answerJson:i}=n,s=await n.listAll(),d=_(s,e.org),a=e.checkpoint===void 0?d.find(k=>k.undo!==void 0):te(G(s,d,e.checkpoint,e.org));if(!a)throw new b({code:"NOT_FOUND",message:`No rewind of ${e.org} can be undone from this machine: Undo is offered for the last rewind of an org, for 15 days after it, until it is undone. Nothing was written.`});let r=Ce(a);if(r)throw new b(r);let p=a.checkpoint;if(!a.undo)throw new b({code:"UNDO_CLOSED",message:`'${p.name}' has no rewind that can be undone: Undo is offered for the last rewind of an org only, for 15 days after it, until it is undone. Nothing was written.`});let{rewindId:m,until:g}=a.undo,v=await $o(n.store,a,p,m);o(yo(e.org,p,m,g,v));let w=await n.connect(e.org);if(De(w,a,p,e.org,"undo"),!e.yes&&await pe(`Type ${e.org} to undo its rewind:`)!==e.org)throw new b({code:"DECLINED",message:"Nothing was written."});let c=await Pe(n.registry,"the undo stops before its next call to the org: undo again takes up what it left",()=>t.request({type:"checkpoint:undo",payload:{checkpointId:a.checkpointId,rewindId:m,acceptAutomation:e.acceptAutomation,...e.acceptEmails?{acceptEmails:!0}:{},...e.muteAutomation?{muteAutomation:!0}:{}},timeoutMs:fn})),l=pn(c,"The undo",k=>k.code==="CANCELLED"?{...k,message:on(e.org)}:eo(k));for(let k of ao(e.org,p,l))o(k);for(let k of l.mutedAutomation?se(l.mutedAutomation,e.org):[])o(k);i(dn("undo",e.org,p,l)),B(cn(l.status,c.stoppedBy))}process.argv[1]?.includes("sandforge-checkpoint")&&(rt(),uo().then(()=>process.exit(process.exitCode??0)).catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
475
- `),process.exit(1)}));export{Cn as a,Sn as b,_ as c,G as d,Ce as e,Se as f,En as g,Nn as h,In as i,ve as j,Dn as k,Tn as l,_n as m,Wt as n,Ee as o,Ht as p,zt as q,Zn as r,Vt as s,Kt as t,Yt as u,Zt as v,ii as w,no as x,so as y,ao as z,dn as A,cn as B,uo as C,yo as D};