sandforge 1.83.0 → 1.84.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/README.md +1 -1
  2. package/lib/chunk-23SEDORH.mjs +11 -0
  3. package/lib/{chunk-I5C4O3VA.mjs → chunk-24RFOFYT.mjs} +1 -1
  4. package/lib/chunk-26POJDIT.mjs +7 -0
  5. package/lib/{chunk-WJAZ5LHL.mjs → chunk-2AZQHBEF.mjs} +1 -1
  6. package/lib/{chunk-IHGYJZZ2.mjs → chunk-2HVOZUM4.mjs} +1 -1
  7. package/lib/{chunk-3V4YH5KO.mjs → chunk-2JDAOWUW.mjs} +1 -1
  8. package/lib/{chunk-BNKT3R3F.mjs → chunk-2METQHGG.mjs} +1 -1
  9. package/lib/chunk-2WFIVO4F.mjs +13 -0
  10. package/lib/chunk-2YHZBUZE.mjs +7 -0
  11. package/lib/{chunk-7DPHZWA4.mjs → chunk-326AJTIU.mjs} +14 -14
  12. package/lib/{chunk-UIR77ZJD.mjs → chunk-36JOHEJL.mjs} +1 -1
  13. package/lib/chunk-3PVRGTVK.mjs +7 -0
  14. package/lib/{chunk-2WMKJVD2.mjs → chunk-3Q353S2R.mjs} +1 -1
  15. package/lib/chunk-3TZSBHEY.mjs +7 -0
  16. package/lib/{chunk-T36DZJPH.mjs → chunk-43TOMFV4.mjs} +1 -1
  17. package/lib/{chunk-XAMMIPZ4.mjs → chunk-4CVUUVGJ.mjs} +1 -1
  18. package/lib/{chunk-6YC2ELCU.mjs → chunk-4EOHEDFP.mjs} +1 -1
  19. package/lib/{chunk-ZB5E7NHU.mjs → chunk-4JE4BYXK.mjs} +1 -1
  20. package/lib/{chunk-JREKJO3D.mjs → chunk-54WZUS7J.mjs} +1 -1
  21. package/lib/{chunk-CGZGL6VT.mjs → chunk-5CRLRHOJ.mjs} +1 -1
  22. package/lib/{chunk-UOHZW2L4.mjs → chunk-5IZTFMJM.mjs} +1 -1
  23. package/lib/{chunk-6VOQFISN.mjs → chunk-5M5FQ7RP.mjs} +1 -1
  24. package/lib/{chunk-U4YFYSF3.mjs → chunk-5SMWFNE7.mjs} +1 -1
  25. package/lib/{chunk-HQZUQXDC.mjs → chunk-5XTUSN72.mjs} +1 -1
  26. package/lib/chunk-6I6TWNV5.mjs +7 -0
  27. package/lib/{chunk-QLRWU3MB.mjs → chunk-6JWWSDM6.mjs} +1 -1
  28. package/lib/chunk-6O222PW6.mjs +7 -0
  29. package/lib/{chunk-J3TIHLWG.mjs → chunk-6PD6K7LP.mjs} +1 -1
  30. package/lib/{chunk-ISAUCWYK.mjs → chunk-6QE6R6RL.mjs} +1 -1
  31. package/lib/{chunk-2KTGDYUH.mjs → chunk-6WX5ZU7Q.mjs} +1 -1
  32. package/lib/{chunk-XAUQXYPW.mjs → chunk-6YL7BNYD.mjs} +1 -1
  33. package/lib/chunk-6ZLKIT3H.mjs +7 -0
  34. package/lib/{chunk-XKFHTBAB.mjs → chunk-7QYHEHMA.mjs} +1 -1
  35. package/lib/chunk-7SQSWVAU.mjs +9 -0
  36. package/lib/{chunk-NNV7IGM7.mjs → chunk-7UVKIWKV.mjs} +1 -1
  37. package/lib/{chunk-RZKJQOOC.mjs → chunk-7WATA4SB.mjs} +1 -1
  38. package/lib/{chunk-DMT5SCO3.mjs → chunk-7YNM6KFZ.mjs} +1 -1
  39. package/lib/{chunk-TMIESDE5.mjs → chunk-A3MYSOOC.mjs} +1 -1
  40. package/lib/chunk-AL4C3GFT.mjs +7 -0
  41. package/lib/chunk-B3FBHVNN.mjs +21 -0
  42. package/lib/{chunk-CDWZGQAJ.mjs → chunk-B63POIPQ.mjs} +1 -1
  43. package/lib/{chunk-YEVB7LVK.mjs → chunk-BAWCOKRW.mjs} +1 -1
  44. package/lib/{chunk-FVLFO2S6.mjs → chunk-BBRWFKS5.mjs} +1 -1
  45. package/lib/chunk-BEA27DLS.mjs +7 -0
  46. package/lib/chunk-BRY3PLIZ.mjs +7 -0
  47. package/lib/chunk-CBH3TOWK.mjs +341 -0
  48. package/lib/{chunk-7V2UYZ6S.mjs → chunk-CPQIZGG5.mjs} +1 -1
  49. package/lib/chunk-CVHNXJH3.mjs +7 -0
  50. package/lib/{chunk-ZOSESZ22.mjs → chunk-D4GF4FAB.mjs} +1 -1
  51. package/lib/chunk-DGDRQRCW.mjs +7 -0
  52. package/lib/{chunk-2N73W63D.mjs → chunk-DPMRIMUC.mjs} +1 -1
  53. package/lib/chunk-DUN2EPRC.mjs +7 -0
  54. package/lib/chunk-E3A3LOCY.mjs +7 -0
  55. package/lib/{chunk-KWAVSZ2B.mjs → chunk-EAC5QCE3.mjs} +1 -1
  56. package/lib/{chunk-JUOQUG7U.mjs → chunk-EC72TIEG.mjs} +1 -1
  57. package/lib/chunk-EPFCERGL.mjs +7 -0
  58. package/lib/{chunk-6KOUYHEY.mjs → chunk-ETDCBLGU.mjs} +1 -1
  59. package/lib/{chunk-2R6GFNKF.mjs → chunk-F3AQW6IU.mjs} +1 -1
  60. package/lib/{chunk-AHUGG3WU.mjs → chunk-FITPY3L4.mjs} +1 -1
  61. package/lib/chunk-FNJ4SGWO.mjs +7 -0
  62. package/lib/{chunk-EOQON3E5.mjs → chunk-FP7CYB2F.mjs} +1 -1
  63. package/lib/{chunk-262TP6UU.mjs → chunk-GKY2JMHY.mjs} +1 -1
  64. package/lib/{chunk-JBWJ6UEZ.mjs → chunk-GMIGWR6U.mjs} +1 -1
  65. package/lib/{chunk-OS5GE52G.mjs → chunk-GNRSF65U.mjs} +1 -1
  66. package/lib/chunk-GOOVPVWX.mjs +7 -0
  67. package/lib/{chunk-DB5RVDC5.mjs → chunk-GWZRR3MM.mjs} +1 -1
  68. package/lib/{chunk-SX6QWYCQ.mjs → chunk-H2BHESDA.mjs} +2 -2
  69. package/lib/chunk-H4CGM6YO.mjs +7 -0
  70. package/lib/{chunk-NFEBX75O.mjs → chunk-HCGXK7G7.mjs} +1 -1
  71. package/lib/{chunk-4X5D3MSV.mjs → chunk-HIDW7FNV.mjs} +1 -1
  72. package/lib/chunk-HSBXRQTI.mjs +7 -0
  73. package/lib/chunk-HUZPBE47.mjs +7 -0
  74. package/lib/{chunk-F5SBGJWW.mjs → chunk-HV7VPEXP.mjs} +1 -1
  75. package/lib/chunk-I6E6T6YY.mjs +7 -0
  76. package/lib/chunk-IUM4NFKI.mjs +10 -0
  77. package/lib/chunk-IVFVNNGB.mjs +37 -0
  78. package/lib/{chunk-L4MSL4U7.mjs → chunk-IZGCEOYO.mjs} +1 -1
  79. package/lib/{chunk-E3RQ575Y.mjs → chunk-J3DND3BC.mjs} +1 -1
  80. package/lib/{chunk-MJD6CPZZ.mjs → chunk-JAEDM4SI.mjs} +1 -1
  81. package/lib/chunk-JCFBFF4Y.mjs +7 -0
  82. package/lib/{chunk-U2CTKIPE.mjs → chunk-JE6SCT6R.mjs} +1 -1
  83. package/lib/{chunk-XJICAOAQ.mjs → chunk-JGZPD4IM.mjs} +1 -1
  84. package/lib/{chunk-XCJUNX63.mjs → chunk-JKJ74BX5.mjs} +1 -1
  85. package/lib/{chunk-WAYQLQAD.mjs → chunk-JLSIWO4Z.mjs} +1 -1
  86. package/lib/{chunk-D7XUNWWU.mjs → chunk-JSAJS3MY.mjs} +1 -1
  87. package/lib/chunk-JTJK2D36.mjs +7 -0
  88. package/lib/{chunk-OTJH6AEA.mjs → chunk-KAZS5Z6W.mjs} +1 -1
  89. package/lib/chunk-KB4ZHM4Q.mjs +10 -0
  90. package/lib/{chunk-N2HYG3BL.mjs → chunk-KGU4SVIT.mjs} +1 -1
  91. package/lib/{chunk-FKCIGJOI.mjs → chunk-KJWFYBMU.mjs} +2 -2
  92. package/lib/{chunk-KXUOHACP.mjs → chunk-KZTZDC7H.mjs} +1 -1
  93. package/lib/{chunk-S4PRKKGC.mjs → chunk-L2E5WBGD.mjs} +1 -1
  94. package/lib/{chunk-X2XZQ434.mjs → chunk-L53JWJ3S.mjs} +1 -1
  95. package/lib/{chunk-CQAFVEKP.mjs → chunk-LA4KIATH.mjs} +6 -6
  96. package/lib/chunk-LC3NDW4N.mjs +7 -0
  97. package/lib/{chunk-4V3QO7HF.mjs → chunk-LKTNQEBS.mjs} +1 -1
  98. package/lib/chunk-M2ABR4JM.mjs +7 -0
  99. package/lib/{chunk-3CM7LAPE.mjs → chunk-M4BLK6HJ.mjs} +1 -1
  100. package/lib/{chunk-Z3MGN42K.mjs → chunk-M6K34KGF.mjs} +1 -1
  101. package/lib/{chunk-TUPZY2QJ.mjs → chunk-MDMPJEV3.mjs} +1 -1
  102. package/lib/{chunk-BVZ5H3N4.mjs → chunk-MJZU3U5O.mjs} +68 -63
  103. package/lib/{chunk-OUU47Y7A.mjs → chunk-MSIEU5MR.mjs} +1 -1
  104. package/lib/{chunk-QQDZQCO2.mjs → chunk-N4WPCWJO.mjs} +1 -1
  105. package/lib/{chunk-MTM4KG3T.mjs → chunk-NCZKWSC7.mjs} +1 -1
  106. package/lib/{chunk-Y7YUNRKK.mjs → chunk-NED4MBIM.mjs} +1 -1
  107. package/lib/{chunk-QKJXIY6L.mjs → chunk-NOBQTEQD.mjs} +1 -1
  108. package/lib/{chunk-WBELLGNE.mjs → chunk-NSQWI7ZY.mjs} +1 -1
  109. package/lib/{chunk-BPHTA6KP.mjs → chunk-O677VOGO.mjs} +1 -1
  110. package/lib/chunk-OFTT7J2M.mjs +7 -0
  111. package/lib/{chunk-JH4ZTVQN.mjs → chunk-OLCVHL7I.mjs} +1 -1
  112. package/lib/chunk-OM5NORJG.mjs +7 -0
  113. package/lib/{chunk-QP3JLFIO.mjs → chunk-OMNMLKDT.mjs} +1 -1
  114. package/lib/{chunk-WABXKL4N.mjs → chunk-OPMO6I45.mjs} +1 -1
  115. package/lib/{chunk-7ZBDACVG.mjs → chunk-OUZQPYT3.mjs} +1 -1
  116. package/lib/chunk-OVNMB6Q2.mjs +7 -0
  117. package/lib/{chunk-DKDKCGXV.mjs → chunk-PAXNWTYK.mjs} +1 -1
  118. package/lib/{chunk-GLN4PI5P.mjs → chunk-PBY2O6OF.mjs} +1 -1
  119. package/lib/chunk-PEDQPM2P.mjs +926 -0
  120. package/lib/chunk-PH7SP4YK.mjs +21 -0
  121. package/lib/{chunk-BT43WSOS.mjs → chunk-PMN4PAC3.mjs} +1 -1
  122. package/lib/chunk-PMWAFDUB.mjs +48 -0
  123. package/lib/chunk-PPLVFX6N.mjs +7 -0
  124. package/lib/{chunk-L3I6DAHX.mjs → chunk-PR3XCSPO.mjs} +1 -1
  125. package/lib/{chunk-WZN36ACK.mjs → chunk-PR42EZSR.mjs} +1 -1
  126. package/lib/{chunk-NDFFIJL5.mjs → chunk-PWRJRL5U.mjs} +1 -1
  127. package/lib/{chunk-NS6ONPWL.mjs → chunk-Q7GIJBCD.mjs} +1 -1
  128. package/lib/chunk-Q7TLC3I2.mjs +7 -0
  129. package/lib/{chunk-ALBY5SOH.mjs → chunk-QAFPQ3YB.mjs} +1 -1
  130. package/lib/{chunk-KKS2KFBT.mjs → chunk-QKEKG2LD.mjs} +1 -1
  131. package/lib/{chunk-OOIDCHBQ.mjs → chunk-QO53K5W2.mjs} +2 -2
  132. package/lib/{chunk-HVX2AFYW.mjs → chunk-QTG6LUZT.mjs} +1 -1
  133. package/lib/{chunk-K7G3W7XH.mjs → chunk-RE7RYF3B.mjs} +1 -1
  134. package/lib/{chunk-JIPT5FUD.mjs → chunk-RGBGUCJA.mjs} +1 -1
  135. package/lib/{chunk-GT5ZKU6V.mjs → chunk-RGUQOSBU.mjs} +1 -1
  136. package/lib/{chunk-VXZ5PTOM.mjs → chunk-RHNTHGNU.mjs} +1 -1
  137. package/lib/chunk-RKTFFCNS.mjs +7 -0
  138. package/lib/chunk-RMFU4BAL.mjs +28 -0
  139. package/lib/{chunk-DNQKVCUV.mjs → chunk-ROV3QXEF.mjs} +11 -11
  140. package/lib/chunk-RT47RKLY.mjs +7 -0
  141. package/lib/{chunk-ISOSTAJR.mjs → chunk-S42RBRH2.mjs} +1 -1
  142. package/lib/{chunk-27BBEGUD.mjs → chunk-SI267LYR.mjs} +1 -1
  143. package/lib/chunk-T3G6VZNS.mjs +7 -0
  144. package/lib/chunk-TNT27RBG.mjs +7 -0
  145. package/lib/chunk-UBIKR5VO.mjs +7 -0
  146. package/lib/chunk-UI3JQVRU.mjs +8 -0
  147. package/lib/{chunk-RVCPQVKM.mjs → chunk-UIOMAX56.mjs} +1 -1
  148. package/lib/chunk-UX3BVH2Y.mjs +7 -0
  149. package/lib/{chunk-L4RJX7DG.mjs → chunk-VCUXCK36.mjs} +1 -1
  150. package/lib/chunk-VINGECAJ.mjs +10 -0
  151. package/lib/chunk-VOXJHJIE.mjs +7 -0
  152. package/lib/chunk-W6PN6TJG.mjs +7 -0
  153. package/lib/{chunk-D6JT4PAB.mjs → chunk-WAPSSYMT.mjs} +1 -1
  154. package/lib/{chunk-7BQMBXKX.mjs → chunk-WUUKFE2U.mjs} +1 -1
  155. package/lib/chunk-WWTCWWZI.mjs +7 -0
  156. package/lib/chunk-WXDLQT2O.mjs +10 -0
  157. package/lib/{chunk-TCEXCHXR.mjs → chunk-WY5V5PR3.mjs} +1 -1
  158. package/lib/chunk-X4BXESMQ.mjs +7 -0
  159. package/lib/chunk-XBQGZGWR.mjs +7 -0
  160. package/lib/{chunk-AXFD2OH6.mjs → chunk-XGGOUNPP.mjs} +1 -1
  161. package/lib/chunk-XKWW3GKF.mjs +7 -0
  162. package/lib/{chunk-PDRXM5WN.mjs → chunk-Y2DRK37K.mjs} +1 -1
  163. package/lib/{chunk-ZXOUWHYE.mjs → chunk-YA6ATMTB.mjs} +1 -1
  164. package/lib/{chunk-54HYHHVL.mjs → chunk-YDXMTWAT.mjs} +1 -1
  165. package/lib/chunk-YHR4WQPR.mjs +7 -0
  166. package/lib/{chunk-LWES2KZE.mjs → chunk-YTLUYSMF.mjs} +1 -1
  167. package/lib/{chunk-2K5BYZQM.mjs → chunk-YWEQQL3C.mjs} +1 -1
  168. package/lib/{chunk-C6RKM4BB.mjs → chunk-Z4LKKOFY.mjs} +1 -1
  169. package/lib/chunk-ZBAWJUG2.mjs +7 -0
  170. package/lib/{chunk-446GBKAC.mjs → chunk-ZJW6YOMV.mjs} +1 -1
  171. package/lib/chunk-ZQQXSCVI.mjs +7 -0
  172. package/lib/{chunk-L6CLN664.mjs → chunk-ZQWIVYVM.mjs} +1 -1
  173. package/lib/{chunk-CXKZ6TYV.mjs → chunk-ZV7ZFQQC.mjs} +1 -1
  174. package/lib/sandforge-autopilot.mjs +25 -25
  175. package/lib/sandforge-backup.mjs +1 -1
  176. package/lib/sandforge-checkpoint.mjs +1 -1
  177. package/lib/sandforge-cleanup.mjs +1 -1
  178. package/lib/sandforge-clone.mjs +1 -1
  179. package/lib/sandforge-compare.mjs +52 -21
  180. package/lib/sandforge-dataops.mjs +1 -1
  181. package/lib/sandforge-empty.mjs +1 -1
  182. package/lib/sandforge-env.mjs +95 -95
  183. package/lib/sandforge-frozen.mjs +1 -1
  184. package/lib/sandforge-mcp.mjs +12 -12
  185. package/lib/sandforge-monitor.mjs +1 -1
  186. package/lib/sandforge-pipeline.mjs +1 -1
  187. package/lib/sandforge-seed.mjs +1 -1
  188. package/lib/sandforge-sync.mjs +1 -1
  189. package/lib/sandforge-users.mjs +1 -1
  190. package/lib/sandforge.mjs +1 -1
  191. package/lib/sf/sandforge/compare.mjs +2 -2
  192. package/lib/sfPlugin.mjs +1 -1
  193. package/oclif.manifest.json +1 -1
  194. package/package.json +1 -1
  195. package/lib/chunk-2ADSD5WK.mjs +0 -7
  196. package/lib/chunk-2GSMHGIV.mjs +0 -7
  197. package/lib/chunk-36Y225OM.mjs +0 -7
  198. package/lib/chunk-3OVTKRS4.mjs +0 -7
  199. package/lib/chunk-4GCYGQXD.mjs +0 -7
  200. package/lib/chunk-4JKR4PTZ.mjs +0 -8
  201. package/lib/chunk-5OGNK3JP.mjs +0 -37
  202. package/lib/chunk-6QSHWIZI.mjs +0 -48
  203. package/lib/chunk-77IVKH7R.mjs +0 -7
  204. package/lib/chunk-77MZRBWX.mjs +0 -7
  205. package/lib/chunk-7WSQ65WG.mjs +0 -9
  206. package/lib/chunk-A32ISQ6M.mjs +0 -28
  207. package/lib/chunk-AG24QMSY.mjs +0 -7
  208. package/lib/chunk-BH76USTQ.mjs +0 -11
  209. package/lib/chunk-BZ24IAP5.mjs +0 -7
  210. package/lib/chunk-CN5HGFG4.mjs +0 -7
  211. package/lib/chunk-CTPLYUXA.mjs +0 -7
  212. package/lib/chunk-DIGUC7S4.mjs +0 -341
  213. package/lib/chunk-DSR2MSBH.mjs +0 -7
  214. package/lib/chunk-ETNQHIDI.mjs +0 -9
  215. package/lib/chunk-FBXH4VRQ.mjs +0 -7
  216. package/lib/chunk-FYWNSMOZ.mjs +0 -10
  217. package/lib/chunk-GEEWPTV5.mjs +0 -7
  218. package/lib/chunk-GTRU5AV5.mjs +0 -7
  219. package/lib/chunk-I3ZO76LL.mjs +0 -21
  220. package/lib/chunk-ISA2NYJV.mjs +0 -7
  221. package/lib/chunk-IXIY6Q4M.mjs +0 -7
  222. package/lib/chunk-JAV6F6OA.mjs +0 -7
  223. package/lib/chunk-JYUMD357.mjs +0 -7
  224. package/lib/chunk-L47JCNP3.mjs +0 -7
  225. package/lib/chunk-LI2XNV7F.mjs +0 -7
  226. package/lib/chunk-LP2D3JJP.mjs +0 -7
  227. package/lib/chunk-LYOGCIYD.mjs +0 -925
  228. package/lib/chunk-N5UIE4IR.mjs +0 -7
  229. package/lib/chunk-O7GCCRPW.mjs +0 -7
  230. package/lib/chunk-OO24ZYYJ.mjs +0 -7
  231. package/lib/chunk-OS6HFJ7L.mjs +0 -7
  232. package/lib/chunk-P6WRYJN3.mjs +0 -7
  233. package/lib/chunk-PGRY365W.mjs +0 -7
  234. package/lib/chunk-PPGDAUEQ.mjs +0 -7
  235. package/lib/chunk-Q4PPI3KG.mjs +0 -7
  236. package/lib/chunk-QFTF2PGS.mjs +0 -21
  237. package/lib/chunk-QO4MPHZD.mjs +0 -7
  238. package/lib/chunk-QXB6U3ZP.mjs +0 -7
  239. package/lib/chunk-R3OM3X4L.mjs +0 -8
  240. package/lib/chunk-R7GKMAT4.mjs +0 -7
  241. package/lib/chunk-SCKUIE3R.mjs +0 -7
  242. package/lib/chunk-SU65Z2BA.mjs +0 -7
  243. package/lib/chunk-T7DDS4UQ.mjs +0 -7
  244. package/lib/chunk-TQJ5NPRC.mjs +0 -7
  245. package/lib/chunk-VZLJZEV2.mjs +0 -7
  246. package/lib/chunk-W3BQGMTR.mjs +0 -7
  247. package/lib/chunk-WXU6ZJIV.mjs +0 -7
  248. package/lib/chunk-X4HZD5U2.mjs +0 -7
  249. package/lib/chunk-X6XNTOGO.mjs +0 -7
  250. package/lib/chunk-XMQ5R6TC.mjs +0 -10
  251. package/lib/chunk-XPXEQKLR.mjs +0 -7
  252. package/lib/chunk-YBZIDW6W.mjs +0 -7
  253. package/lib/chunk-ZCOSME6P.mjs +0 -7
  254. package/lib/chunk-ZTHC42X6.mjs +0 -7
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{b as j,q as O}from"./chunk-QFTF2PGS.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-7V2UYZ6S.mjs";import"./chunk-BPHTA6KP.mjs";import"./chunk-U2CTKIPE.mjs";import"./chunk-ZRUDYB7O.mjs";import"./chunk-I3ZO76LL.mjs";import"./chunk-2K5BYZQM.mjs";import"./chunk-CQAFVEKP.mjs";import"./chunk-PDRXM5WN.mjs";import"./chunk-JBWJ6UEZ.mjs";import"./chunk-NDFFIJL5.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-L4MSL4U7.mjs";import"./chunk-I5C4O3VA.mjs";import"./chunk-RVCPQVKM.mjs";import"./chunk-CTPLYUXA.mjs";import"./chunk-D7XUNWWU.mjs";import"./chunk-AHUGG3WU.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-OO24ZYYJ.mjs";import"./chunk-ALBY5SOH.mjs";import"./chunk-6YC2ELCU.mjs";import"./chunk-XCJUNX63.mjs";import"./chunk-WZN36ACK.mjs";import"./chunk-GEEWPTV5.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-WAYQLQAD.mjs";import"./chunk-FKCIGJOI.mjs";import"./chunk-C6RKM4BB.mjs";import"./chunk-IHGYJZZ2.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import{b as S,c as x}from"./chunk-HVX2AFYW.mjs";import"./chunk-AXFD2OH6.mjs";import"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-O7GCCRPW.mjs";import"./chunk-4X5D3MSV.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import{b as w,f as b,h as y}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var v=`sandforge monitor \u2014 read an org the way the Monitor page does, without the editor.
7
+ import{b as j,q as O}from"./chunk-PH7SP4YK.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-CPQIZGG5.mjs";import"./chunk-O677VOGO.mjs";import"./chunk-JE6SCT6R.mjs";import"./chunk-ZRUDYB7O.mjs";import"./chunk-B3FBHVNN.mjs";import"./chunk-YWEQQL3C.mjs";import"./chunk-LA4KIATH.mjs";import"./chunk-Y2DRK37K.mjs";import"./chunk-GMIGWR6U.mjs";import"./chunk-PWRJRL5U.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-IZGCEOYO.mjs";import"./chunk-24RFOFYT.mjs";import"./chunk-UIOMAX56.mjs";import"./chunk-3PVRGTVK.mjs";import"./chunk-JSAJS3MY.mjs";import"./chunk-FITPY3L4.mjs";import"./chunk-BBRWFKS5.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-6I6TWNV5.mjs";import"./chunk-QAFPQ3YB.mjs";import"./chunk-4EOHEDFP.mjs";import"./chunk-JKJ74BX5.mjs";import"./chunk-PR42EZSR.mjs";import"./chunk-UX3BVH2Y.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-JLSIWO4Z.mjs";import"./chunk-KJWFYBMU.mjs";import"./chunk-Z4LKKOFY.mjs";import"./chunk-2HVOZUM4.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import{b as S,c as x}from"./chunk-QTG6LUZT.mjs";import"./chunk-XGGOUNPP.mjs";import"./chunk-L53JWJ3S.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-OFTT7J2M.mjs";import"./chunk-HIDW7FNV.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-IVFVNNGB.mjs";import"./chunk-6JWWSDM6.mjs";import"./chunk-VINGECAJ.mjs";import"./chunk-H4CGM6YO.mjs";import"./chunk-IUM4NFKI.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-5XTUSN72.mjs";import"./chunk-Q7GIJBCD.mjs";import"./chunk-YHR4WQPR.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-26POJDIT.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-PMN4PAC3.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-H2BHESDA.mjs";import"./chunk-FP7CYB2F.mjs";import"./chunk-NED4MBIM.mjs";import"./chunk-UI3JQVRU.mjs";import"./chunk-KGU4SVIT.mjs";import"./chunk-JAEDM4SI.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-OUZQPYT3.mjs";import"./chunk-MSIEU5MR.mjs";import"./chunk-LC3NDW4N.mjs";import"./chunk-KB4ZHM4Q.mjs";import"./chunk-23SEDORH.mjs";import"./chunk-W6PN6TJG.mjs";import"./chunk-3Q353S2R.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-RHNTHGNU.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-D4GF4FAB.mjs";import"./chunk-CVHNXJH3.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-YA6ATMTB.mjs";import{b as w,f as b,h as y}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-M6K34KGF.mjs";import"./chunk-TNT27RBG.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-S42RBRH2.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-WUUKFE2U.mjs";import"./chunk-EAC5QCE3.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-PMWAFDUB.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var v=`sandforge monitor \u2014 read an org the way the Monitor page does, without the editor.
8
8
 
9
9
  Usage:
10
10
  npx sandforge monitor --org <alias> [options]
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{p as De}from"./chunk-DNQKVCUV.mjs";import"./chunk-2ADSD5WK.mjs";import"./chunk-3OVTKRS4.mjs";import"./chunk-BH76USTQ.mjs";import"./chunk-XKFHTBAB.mjs";import"./chunk-FYWNSMOZ.mjs";import"./chunk-WBELLGNE.mjs";import"./chunk-OS5GE52G.mjs";import"./chunk-W3BQGMTR.mjs";import"./chunk-7DPHZWA4.mjs";import"./chunk-DIGUC7S4.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-J3TIHLWG.mjs";import"./chunk-4V3QO7HF.mjs";import"./chunk-ETNQHIDI.mjs";import{a as W,c as Oe,g as Ie,h as Y,i as Te,j as be,k as q,l as Ee,m as Ne,n as xe,o as Ae,p as _e,q as Ce}from"./chunk-QFTF2PGS.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-7V2UYZ6S.mjs";import"./chunk-BPHTA6KP.mjs";import"./chunk-U2CTKIPE.mjs";import"./chunk-ZRUDYB7O.mjs";import"./chunk-I3ZO76LL.mjs";import"./chunk-2K5BYZQM.mjs";import"./chunk-CQAFVEKP.mjs";import"./chunk-PDRXM5WN.mjs";import"./chunk-JBWJ6UEZ.mjs";import"./chunk-NDFFIJL5.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-L4MSL4U7.mjs";import"./chunk-I5C4O3VA.mjs";import"./chunk-RVCPQVKM.mjs";import"./chunk-CTPLYUXA.mjs";import"./chunk-D7XUNWWU.mjs";import"./chunk-AHUGG3WU.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import{h as Pe}from"./chunk-OO24ZYYJ.mjs";import"./chunk-ALBY5SOH.mjs";import"./chunk-6YC2ELCU.mjs";import"./chunk-XCJUNX63.mjs";import"./chunk-WZN36ACK.mjs";import"./chunk-GEEWPTV5.mjs";import"./chunk-GMY5427L.mjs";import{a as Fe}from"./chunk-TW3N6W5Z.mjs";import"./chunk-LYOGCIYD.mjs";import"./chunk-P6WRYJN3.mjs";import{d as ve}from"./chunk-77MZRBWX.mjs";import"./chunk-X4HZD5U2.mjs";import{a as he}from"./chunk-BNKT3R3F.mjs";import{a as we,b as ke}from"./chunk-QROPNEGY.mjs";import{b as K,e as de}from"./chunk-BZ24IAP5.mjs";import{a as N}from"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-WAYQLQAD.mjs";import{e as ce}from"./chunk-FKCIGJOI.mjs";import"./chunk-C6RKM4BB.mjs";import"./chunk-IHGYJZZ2.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import{a as Re,c as Se}from"./chunk-HVX2AFYW.mjs";import"./chunk-AXFD2OH6.mjs";import{h as ge,i as me}from"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-O7GCCRPW.mjs";import"./chunk-4X5D3MSV.mjs";import"./chunk-BOGNK4LV.mjs";import{m as ye}from"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import{l as fe}from"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import{d as le}from"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import{h as pe,m as ue}from"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import{a as oe,c as ae,f as T,h as $e}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import{Ge as ie,Ie as re,Ke as se,Xc as te}from"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{copyFileSync as fn,existsSync as Je,mkdtempSync as gn,readFileSync as Xe,rmSync as mn,rmdirSync as hn}from"node:fs";import{tmpdir as yn}from"node:os";import{join as j,resolve as wn}from"node:path";import{randomUUID as kn}from"node:crypto";import{mkdirSync as sn}from"node:fs";import{join as on}from"node:path";var an=/^\[(WARN|ERR)\]|^\[INFO\] (?:The run lock|the confirmation)/;function je(e,t){return t==="production"?`${e??"the org"} is taken for a production org, and a pipeline from the command line writes to none`:void 0}function J(e){let t=e.journalDir??he(),n=e.backupDir??Re(),s=Se(n);if(s!==void 0)throw new Error(s);sn(e.storeDir,{recursive:!0,mode:448});let i=new Fe,r,o=Ce({storeDir:e.storeDir,log:a=>{an.test(a.trim())&&e.log(a.trim())},waitMs:0,typeScratchOrgs:!0,...e.onPost?{onPost:e.onPost}:{},services:{getSandforgeSetting:e.setting,showNotification:e.notify,...e.askApproval?{askApproval:e.askApproval}:{}},compose:a=>{let d=u=>a.orgManager.getOrg(u)?.alias,c=new fe({orgNameOf:d,requestConfirmation:(u,y)=>{let w=je(void 0,y);return w===void 0?Promise.resolve(!0):(e.log(`refused: ${w} (${u})`),Promise.resolve(!1))},declinesWithoutAsking:u=>je(void 0,u)});a.handlers.setInfraServices({productionGuard:c,backgroundRegistry:i,piiDetector:new le,checkpointFiles:{sandforgeVersion:e.sandforgeVersion,pickExportFile:()=>Promise.reject(new Error("sandforge checkpoint export saves a checkpoint to a file.")),pickImportFile:()=>Promise.reject(new Error("sandforge checkpoint import reads a checkpoint file."))}}),a.handlers.setBackgroundRegistry(i),a.handlers.setBackupRecordStore(new me(ge(n))),a.handlers.setSyncRunCreations(pe(t)),a.handlers.setSeedRunCreations(ve(t)),r={configStore:a.configStore,orgRegistry:a.orgRegistry}}});if(r===void 0)throw new Error("The host composed no handlers.");return{host:o,configStore:r.configStore,orgRegistry:r.orgRegistry,backupDir:n,dispose:()=>i.dispose()}}function X(e){switch(te(e.orgType,e.metadata?.edition)){case"Sandbox":return"sandbox";case"Scratch":return"scratch";case"Developer":return"developer";default:return"production"}}function Me(e,t){return e.length>=15&&t.length>=15&&e.slice(0,15)===t.slice(0,15)}var Le=new Set(["scratch","developer"]),ze={sandbox:"a sandbox",scratch:"a scratch org",developer:"a Developer Edition org",production:"a production org"};function dn(e,t){return e!==t?`another org, of another kind: ${ze[t]} here, ${ze[e]} in the file`:e==="sandbox"?"a sandbox refreshed since is another org, holding production\u2019s data again":"another org than the one the pipeline was exported for"}function Ge(e,t,n,s,i,r=e){return Me(n.organizationId,s.organizationId)?{ok:!0}:i!==void 0&&Me(i,s.organizationId)?{ok:!0,note:`${t} answers as org ${s.organizationId}, not the ${n.organizationId} the file names: taken, as --accept-org ${r}=${i} says.`}:Le.has(n.kind)&&Le.has(s.kind)?{ok:!0,note:`${t} answers as org ${s.organizationId}, not the ${n.organizationId} the file names: a ${s.kind==="scratch"?"scratch org":"Developer Edition org"} is made again under its alias, and is not pinned to its Id.`}:{ok:!1,code:"ORG_MOVED",message:`${t} answers as org ${s.organizationId}, and the file names ${n.organizationId}: ${dn(n.kind,s.kind)}. Nothing was run.`,wayOut:`check that ${t} is the org the pipeline is for, then run again with --accept-org ${t}=${s.organizationId}; or export the pipeline again from the Automation page.`}}function Be(e,t,n,s){if(!n.staging)return{org:t};let i=X(t);if(i!=="sandbox")return{org:t,note:`${s} is marked Staging in the file, and is a ${i} org here: the mark is read of a sandbox alone, and not set.`};let r={...t,staging:!0};return e.updateOrgMetadata(r),{org:r}}function L(e){return JSON.parse(JSON.stringify(e))}function He(e,t){let n=L(e.pipeline),s=L(e.syncConfigs);for(let i of se(e)){let r=t(i.key);if(r!==void 0){if(i.stepId!==void 0){let o=n.steps.find(a=>a.id===i.stepId);o&&(o.config[i.field]=r)}else if(i.syncConfigId!==void 0){let o=s[i.syncConfigId];o&&(o[i.field]=r)}}}return{pipeline:{...n,variables:n.variables.map(i=>i.required&&i.defaultValue===void 0?{...i,required:!1}:i),version:1,triggers:[],createdAt:e.exportedAt,updatedAt:e.exportedAt},syncConfigs:Object.values(s)}}var pn="prebuilt-",un="tpl-";function Ve(e,t,n){let s=new Pe(e);for(let o of n.syncConfigs)s.save(o);let i=new Oe(e);for(let o of Object.values(t.seedTemplates))o.id.startsWith(pn)||i.save(L(o));let r=new ce(e);for(let o of Object.values(t.maskingTemplates))o.id.startsWith(un)||r.save(L(o))}var Ue="backup:";function Ke(e,t,n,s=()=>{}){let i=e.getKeysByPrefix(Ue).filter(o=>!n.has(o));if(i.length===0)return 0;let r=ye(on(t,"snapshots.json"));for(let o of i)r.set(o,cn(e.get(o),s),"backups");return i.length}function cn(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return e;let n=e;if(typeof n.orgId!="string")return e;let s=t(n.orgId);return s===void 0?e:{...n,orgId:s,organizationId:typeof n.organizationId=="string"?n.organizationId:n.orgId}}function We(e){return new Set(e.getKeysByPrefix(Ue))}var vn=`sandforge pipeline \u2014 run an Automation pipeline exported from VS Code, without the editor.
7
+ import{p as De}from"./chunk-ROV3QXEF.mjs";import"./chunk-HUZPBE47.mjs";import"./chunk-2YHZBUZE.mjs";import"./chunk-2WFIVO4F.mjs";import"./chunk-7QYHEHMA.mjs";import"./chunk-WXDLQT2O.mjs";import"./chunk-NSQWI7ZY.mjs";import"./chunk-GNRSF65U.mjs";import"./chunk-3TZSBHEY.mjs";import"./chunk-326AJTIU.mjs";import"./chunk-CBH3TOWK.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-6PD6K7LP.mjs";import{a as W,c as Oe,g as Ie,h as Y,i as Te,j as be,k as q,l as Ee,m as Ne,n as xe,o as Ae,p as _e,q as Ce}from"./chunk-PH7SP4YK.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-CPQIZGG5.mjs";import"./chunk-O677VOGO.mjs";import"./chunk-JE6SCT6R.mjs";import"./chunk-ZRUDYB7O.mjs";import"./chunk-B3FBHVNN.mjs";import"./chunk-YWEQQL3C.mjs";import"./chunk-LA4KIATH.mjs";import"./chunk-Y2DRK37K.mjs";import"./chunk-GMIGWR6U.mjs";import"./chunk-PWRJRL5U.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-IZGCEOYO.mjs";import"./chunk-24RFOFYT.mjs";import"./chunk-UIOMAX56.mjs";import"./chunk-3PVRGTVK.mjs";import"./chunk-JSAJS3MY.mjs";import"./chunk-FITPY3L4.mjs";import"./chunk-BBRWFKS5.mjs";import"./chunk-FQGHL7GR.mjs";import{h as Pe}from"./chunk-6I6TWNV5.mjs";import"./chunk-QAFPQ3YB.mjs";import"./chunk-4EOHEDFP.mjs";import"./chunk-JKJ74BX5.mjs";import"./chunk-PR42EZSR.mjs";import"./chunk-UX3BVH2Y.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-LKTNQEBS.mjs";import"./chunk-7SQSWVAU.mjs";import{a as Fe}from"./chunk-TW3N6W5Z.mjs";import"./chunk-PEDQPM2P.mjs";import"./chunk-X4BXESMQ.mjs";import{d as ve}from"./chunk-EPFCERGL.mjs";import"./chunk-OM5NORJG.mjs";import{a as he}from"./chunk-2METQHGG.mjs";import{b as K,e as de}from"./chunk-RKTFFCNS.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-JLSIWO4Z.mjs";import{e as ce}from"./chunk-KJWFYBMU.mjs";import"./chunk-Z4LKKOFY.mjs";import"./chunk-2HVOZUM4.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import{a as Re,c as Se}from"./chunk-QTG6LUZT.mjs";import"./chunk-XGGOUNPP.mjs";import{h as ge,i as me}from"./chunk-L53JWJ3S.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-OFTT7J2M.mjs";import"./chunk-HIDW7FNV.mjs";import"./chunk-BOGNK4LV.mjs";import{a as we,b as ke}from"./chunk-QROPNEGY.mjs";import{n as ye}from"./chunk-IVFVNNGB.mjs";import"./chunk-6JWWSDM6.mjs";import{m as fe}from"./chunk-VINGECAJ.mjs";import"./chunk-H4CGM6YO.mjs";import"./chunk-IUM4NFKI.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import{d as le}from"./chunk-T63U4OZJ.mjs";import"./chunk-5XTUSN72.mjs";import"./chunk-Q7GIJBCD.mjs";import"./chunk-YHR4WQPR.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-26POJDIT.mjs";import"./chunk-QIRO4HTE.mjs";import{h as pe,m as ue}from"./chunk-PMN4PAC3.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-H2BHESDA.mjs";import"./chunk-FP7CYB2F.mjs";import"./chunk-NED4MBIM.mjs";import"./chunk-UI3JQVRU.mjs";import"./chunk-KGU4SVIT.mjs";import{a as N}from"./chunk-AL4C3GFT.mjs";import"./chunk-JAEDM4SI.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-OUZQPYT3.mjs";import"./chunk-MSIEU5MR.mjs";import"./chunk-LC3NDW4N.mjs";import"./chunk-KB4ZHM4Q.mjs";import"./chunk-23SEDORH.mjs";import"./chunk-W6PN6TJG.mjs";import"./chunk-3Q353S2R.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-RHNTHGNU.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-D4GF4FAB.mjs";import"./chunk-CVHNXJH3.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-YA6ATMTB.mjs";import{a as oe,c as ae,f as T,h as $e}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-M6K34KGF.mjs";import"./chunk-TNT27RBG.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-S42RBRH2.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-WUUKFE2U.mjs";import"./chunk-EAC5QCE3.mjs";import"./chunk-TUACWKIH.mjs";import{Ge as ie,Ie as re,Ke as se,Xc as te}from"./chunk-PMWAFDUB.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{copyFileSync as fn,existsSync as Je,mkdtempSync as gn,readFileSync as Xe,rmSync as mn,rmdirSync as hn}from"node:fs";import{tmpdir as yn}from"node:os";import{join as j,resolve as wn}from"node:path";import{randomUUID as kn}from"node:crypto";import{mkdirSync as sn}from"node:fs";import{join as on}from"node:path";var an=/^\[(WARN|ERR)\]|^\[INFO\] (?:The run lock|the confirmation)/;function je(e,t){return t==="production"?`${e??"the org"} is taken for a production org, and a pipeline from the command line writes to none`:void 0}function J(e){let t=e.journalDir??he(),n=e.backupDir??Re(),s=Se(n);if(s!==void 0)throw new Error(s);sn(e.storeDir,{recursive:!0,mode:448});let i=new Fe,r,o=Ce({storeDir:e.storeDir,log:a=>{an.test(a.trim())&&e.log(a.trim())},waitMs:0,typeScratchOrgs:!0,...e.onPost?{onPost:e.onPost}:{},services:{getSandforgeSetting:e.setting,showNotification:e.notify,...e.askApproval?{askApproval:e.askApproval}:{}},compose:a=>{let d=u=>a.orgManager.getOrg(u)?.alias,c=new fe({orgNameOf:d,requestConfirmation:(u,y)=>{let w=je(void 0,y);return w===void 0?Promise.resolve(!0):(e.log(`refused: ${w} (${u})`),Promise.resolve(!1))},declinesWithoutAsking:u=>je(void 0,u)});a.handlers.setInfraServices({productionGuard:c,backgroundRegistry:i,piiDetector:new le,checkpointFiles:{sandforgeVersion:e.sandforgeVersion,pickExportFile:()=>Promise.reject(new Error("sandforge checkpoint export saves a checkpoint to a file.")),pickImportFile:()=>Promise.reject(new Error("sandforge checkpoint import reads a checkpoint file."))}}),a.handlers.setBackgroundRegistry(i),a.handlers.setBackupRecordStore(new me(ge(n))),a.handlers.setSyncRunCreations(pe(t)),a.handlers.setSeedRunCreations(ve(t)),r={configStore:a.configStore,orgRegistry:a.orgRegistry}}});if(r===void 0)throw new Error("The host composed no handlers.");return{host:o,configStore:r.configStore,orgRegistry:r.orgRegistry,backupDir:n,dispose:()=>i.dispose()}}function X(e){switch(te(e.orgType,e.metadata?.edition)){case"Sandbox":return"sandbox";case"Scratch":return"scratch";case"Developer":return"developer";default:return"production"}}function Me(e,t){return e.length>=15&&t.length>=15&&e.slice(0,15)===t.slice(0,15)}var Le=new Set(["scratch","developer"]),ze={sandbox:"a sandbox",scratch:"a scratch org",developer:"a Developer Edition org",production:"a production org"};function dn(e,t){return e!==t?`another org, of another kind: ${ze[t]} here, ${ze[e]} in the file`:e==="sandbox"?"a sandbox refreshed since is another org, holding production\u2019s data again":"another org than the one the pipeline was exported for"}function Ge(e,t,n,s,i,r=e){return Me(n.organizationId,s.organizationId)?{ok:!0}:i!==void 0&&Me(i,s.organizationId)?{ok:!0,note:`${t} answers as org ${s.organizationId}, not the ${n.organizationId} the file names: taken, as --accept-org ${r}=${i} says.`}:Le.has(n.kind)&&Le.has(s.kind)?{ok:!0,note:`${t} answers as org ${s.organizationId}, not the ${n.organizationId} the file names: a ${s.kind==="scratch"?"scratch org":"Developer Edition org"} is made again under its alias, and is not pinned to its Id.`}:{ok:!1,code:"ORG_MOVED",message:`${t} answers as org ${s.organizationId}, and the file names ${n.organizationId}: ${dn(n.kind,s.kind)}. Nothing was run.`,wayOut:`check that ${t} is the org the pipeline is for, then run again with --accept-org ${t}=${s.organizationId}; or export the pipeline again from the Automation page.`}}function Be(e,t,n,s){if(!n.staging)return{org:t};let i=X(t);if(i!=="sandbox")return{org:t,note:`${s} is marked Staging in the file, and is a ${i} org here: the mark is read of a sandbox alone, and not set.`};let r={...t,staging:!0};return e.updateOrgMetadata(r),{org:r}}function L(e){return JSON.parse(JSON.stringify(e))}function He(e,t){let n=L(e.pipeline),s=L(e.syncConfigs);for(let i of se(e)){let r=t(i.key);if(r!==void 0){if(i.stepId!==void 0){let o=n.steps.find(a=>a.id===i.stepId);o&&(o.config[i.field]=r)}else if(i.syncConfigId!==void 0){let o=s[i.syncConfigId];o&&(o[i.field]=r)}}}return{pipeline:{...n,variables:n.variables.map(i=>i.required&&i.defaultValue===void 0?{...i,required:!1}:i),version:1,triggers:[],createdAt:e.exportedAt,updatedAt:e.exportedAt},syncConfigs:Object.values(s)}}var pn="prebuilt-",un="tpl-";function Ve(e,t,n){let s=new Pe(e);for(let o of n.syncConfigs)s.save(o);let i=new Oe(e);for(let o of Object.values(t.seedTemplates))o.id.startsWith(pn)||i.save(L(o));let r=new ce(e);for(let o of Object.values(t.maskingTemplates))o.id.startsWith(un)||r.save(L(o))}var Ue="backup:";function Ke(e,t,n,s=()=>{}){let i=e.getKeysByPrefix(Ue).filter(o=>!n.has(o));if(i.length===0)return 0;let r=ye(on(t,"snapshots.json"));for(let o of i)r.set(o,cn(e.get(o),s),"backups");return i.length}function cn(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return e;let n=e;if(typeof n.orgId!="string")return e;let s=t(n.orgId);return s===void 0?e:{...n,orgId:s,organizationId:typeof n.organizationId=="string"?n.organizationId:n.orgId}}function We(e){return new Set(e.getKeysByPrefix(Ue))}var vn=`sandforge pipeline \u2014 run an Automation pipeline exported from VS Code, without the editor.
8
8
 
9
9
  Usage:
10
10
  npx sandforge pipeline plan --file <file> [options]
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{A,B,C,D,E,F,G,H,I,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-BVZ5H3N4.mjs";import"./chunk-KKS2KFBT.mjs";import"./chunk-KXUOHACP.mjs";import"./chunk-JH4ZTVQN.mjs";import"./chunk-2N73W63D.mjs";import"./chunk-27BBEGUD.mjs";import"./chunk-XAUQXYPW.mjs";import"./chunk-NNV7IGM7.mjs";import"./chunk-446GBKAC.mjs";import"./chunk-K7G3W7XH.mjs";import"./chunk-JREKJO3D.mjs";import"./chunk-H4OBZIX3.mjs";import"./chunk-OTJH6AEA.mjs";import"./chunk-GLN4PI5P.mjs";import"./chunk-DKDKCGXV.mjs";import"./chunk-DIGUC7S4.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-J3TIHLWG.mjs";import"./chunk-ETNQHIDI.mjs";import"./chunk-D7XUNWWU.mjs";import"./chunk-AHUGG3WU.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-OO24ZYYJ.mjs";import"./chunk-ALBY5SOH.mjs";import"./chunk-6YC2ELCU.mjs";import"./chunk-XCJUNX63.mjs";import"./chunk-WZN36ACK.mjs";import"./chunk-GEEWPTV5.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-LYOGCIYD.mjs";import"./chunk-P6WRYJN3.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-X4HZD5U2.mjs";import"./chunk-BNKT3R3F.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-HVX2AFYW.mjs";import"./chunk-AXFD2OH6.mjs";import"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as ENV_RUN_ID_RE,G as PREVIEW_UNREAD,l as accountKindOfRecordTypes,v as apiRequestsJson,p as describeDistribution,u as dryRunGatesJson,x as fitJson,c as fitOfArgs,y as main,d as parseArgs,C as parseRemoveArgs,m as personAccountLine,k as personRecordTypeNames,i as prebuiltTemplate,D as readRunSummary,f as readTemplateFile,o as recordTypeChoiceLine,n as recordTypeRule,A as refusalLines,H as removalPreviewJson,I as removalPreviewLines,F as removeMain,j as rulesFromDescribe,g as runIdRefusal,E as runOfSummary,z as scenarioKeptLines,t as seedAutomationCheck,w as seedFitLines,B as seedInterruptedLine,q as seedOrchestrator,r as seedWritePathOf,b as seededRandom,s as storageLine,e as templateDisplayName,h as templateRecordTypesRefusal};
7
+ import{A,B,C,D,E,F,G,H,I,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-MJZU3U5O.mjs";import"./chunk-QKEKG2LD.mjs";import"./chunk-KZTZDC7H.mjs";import"./chunk-OLCVHL7I.mjs";import"./chunk-DPMRIMUC.mjs";import"./chunk-SI267LYR.mjs";import"./chunk-6YL7BNYD.mjs";import"./chunk-7UVKIWKV.mjs";import"./chunk-ZJW6YOMV.mjs";import"./chunk-RE7RYF3B.mjs";import"./chunk-54WZUS7J.mjs";import"./chunk-H4OBZIX3.mjs";import"./chunk-KAZS5Z6W.mjs";import"./chunk-PBY2O6OF.mjs";import"./chunk-PAXNWTYK.mjs";import"./chunk-CBH3TOWK.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-6PD6K7LP.mjs";import"./chunk-JSAJS3MY.mjs";import"./chunk-FITPY3L4.mjs";import"./chunk-BBRWFKS5.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-6I6TWNV5.mjs";import"./chunk-QAFPQ3YB.mjs";import"./chunk-4EOHEDFP.mjs";import"./chunk-JKJ74BX5.mjs";import"./chunk-PR42EZSR.mjs";import"./chunk-UX3BVH2Y.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-7SQSWVAU.mjs";import"./chunk-PEDQPM2P.mjs";import"./chunk-X4BXESMQ.mjs";import"./chunk-EPFCERGL.mjs";import"./chunk-OM5NORJG.mjs";import"./chunk-2METQHGG.mjs";import"./chunk-RKTFFCNS.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-QTG6LUZT.mjs";import"./chunk-XGGOUNPP.mjs";import"./chunk-L53JWJ3S.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-IVFVNNGB.mjs";import"./chunk-6JWWSDM6.mjs";import"./chunk-VINGECAJ.mjs";import"./chunk-H4CGM6YO.mjs";import"./chunk-IUM4NFKI.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-5XTUSN72.mjs";import"./chunk-Q7GIJBCD.mjs";import"./chunk-YHR4WQPR.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-26POJDIT.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-PMN4PAC3.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-H2BHESDA.mjs";import"./chunk-FP7CYB2F.mjs";import"./chunk-NED4MBIM.mjs";import"./chunk-UI3JQVRU.mjs";import"./chunk-KGU4SVIT.mjs";import"./chunk-AL4C3GFT.mjs";import"./chunk-JAEDM4SI.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-OUZQPYT3.mjs";import"./chunk-MSIEU5MR.mjs";import"./chunk-LC3NDW4N.mjs";import"./chunk-KB4ZHM4Q.mjs";import"./chunk-23SEDORH.mjs";import"./chunk-W6PN6TJG.mjs";import"./chunk-3Q353S2R.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-RHNTHGNU.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-D4GF4FAB.mjs";import"./chunk-CVHNXJH3.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-YA6ATMTB.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-M6K34KGF.mjs";import"./chunk-TNT27RBG.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-S42RBRH2.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-WUUKFE2U.mjs";import"./chunk-EAC5QCE3.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-PMWAFDUB.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as ENV_RUN_ID_RE,G as PREVIEW_UNREAD,l as accountKindOfRecordTypes,v as apiRequestsJson,p as describeDistribution,u as dryRunGatesJson,x as fitJson,c as fitOfArgs,y as main,d as parseArgs,C as parseRemoveArgs,m as personAccountLine,k as personRecordTypeNames,i as prebuiltTemplate,D as readRunSummary,f as readTemplateFile,o as recordTypeChoiceLine,n as recordTypeRule,A as refusalLines,H as removalPreviewJson,I as removalPreviewLines,F as removeMain,j as rulesFromDescribe,g as runIdRefusal,E as runOfSummary,z as scenarioKeptLines,t as seedAutomationCheck,w as seedFitLines,B as seedInterruptedLine,q as seedOrchestrator,r as seedWritePathOf,b as seededRandom,s as storageLine,e as templateDisplayName,h as templateRecordTypesRefusal};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-DIGUC7S4.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-J3TIHLWG.mjs";import"./chunk-ETNQHIDI.mjs";import"./chunk-OO24ZYYJ.mjs";import"./chunk-ALBY5SOH.mjs";import"./chunk-6YC2ELCU.mjs";import"./chunk-XCJUNX63.mjs";import"./chunk-WZN36ACK.mjs";import"./chunk-GEEWPTV5.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-LYOGCIYD.mjs";import"./chunk-P6WRYJN3.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-X4HZD5U2.mjs";import"./chunk-BNKT3R3F.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-HVX2AFYW.mjs";import"./chunk-AXFD2OH6.mjs";import"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var export_jsforce=a.default;export{D as LINE_RUN,r as alreadyLinkedWords,C as bothRecorders,c as buildConfig,h as buildQueryFn,g as cliAllowsDeletes,k as cliCountFn,f as cliFileDeps,l as cliPersonAccountsFn,m as cliSourceIdsFn,N as configurationToldLines,x as contactPointLines,A as deltaLine,w as encryptedLeftOutLine,n as inTheCommandsWords,P as jobLines,export_jsforce as jsforce,E as main,B as memoryCreations,u as objectCountsLine,y as objectCurrencyLines,t as objectErrorLines,z as objectPriceLines,v as objectWrittenLines,b as parseArgs,F as parseRemoveArgs,i as readCutLines,G as readRunSummary,d as readSavedConfig,q as recordTypeGivenOfObjectsLines,J as removalRefusal,K as removalSummaryLines,H as removalsPathOf,Q as removeMain,L as restoredLines,O as runFileOf,I as runOfSummary,e as savedConfigStore,s as simulationLines,j as statusWithReadCuts,o as syncApiRequestsJson,M as undeletedLines,p as writeCheckLines};
7
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-CBH3TOWK.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-6PD6K7LP.mjs";import"./chunk-6I6TWNV5.mjs";import"./chunk-QAFPQ3YB.mjs";import"./chunk-4EOHEDFP.mjs";import"./chunk-JKJ74BX5.mjs";import"./chunk-PR42EZSR.mjs";import"./chunk-UX3BVH2Y.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-7SQSWVAU.mjs";import"./chunk-PEDQPM2P.mjs";import"./chunk-X4BXESMQ.mjs";import"./chunk-EPFCERGL.mjs";import"./chunk-OM5NORJG.mjs";import"./chunk-2METQHGG.mjs";import"./chunk-RKTFFCNS.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-QTG6LUZT.mjs";import"./chunk-XGGOUNPP.mjs";import"./chunk-L53JWJ3S.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-IVFVNNGB.mjs";import"./chunk-6JWWSDM6.mjs";import"./chunk-VINGECAJ.mjs";import"./chunk-H4CGM6YO.mjs";import"./chunk-IUM4NFKI.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-5XTUSN72.mjs";import"./chunk-Q7GIJBCD.mjs";import"./chunk-YHR4WQPR.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-26POJDIT.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-PMN4PAC3.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-H2BHESDA.mjs";import"./chunk-FP7CYB2F.mjs";import"./chunk-NED4MBIM.mjs";import"./chunk-UI3JQVRU.mjs";import"./chunk-KGU4SVIT.mjs";import"./chunk-AL4C3GFT.mjs";import"./chunk-JAEDM4SI.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-OUZQPYT3.mjs";import"./chunk-MSIEU5MR.mjs";import"./chunk-LC3NDW4N.mjs";import"./chunk-KB4ZHM4Q.mjs";import"./chunk-23SEDORH.mjs";import"./chunk-W6PN6TJG.mjs";import"./chunk-3Q353S2R.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-RHNTHGNU.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-D4GF4FAB.mjs";import"./chunk-CVHNXJH3.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-YA6ATMTB.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-M6K34KGF.mjs";import"./chunk-TNT27RBG.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-S42RBRH2.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-WUUKFE2U.mjs";import"./chunk-EAC5QCE3.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-PMWAFDUB.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var export_jsforce=a.default;export{D as LINE_RUN,r as alreadyLinkedWords,C as bothRecorders,c as buildConfig,h as buildQueryFn,g as cliAllowsDeletes,k as cliCountFn,f as cliFileDeps,l as cliPersonAccountsFn,m as cliSourceIdsFn,N as configurationToldLines,x as contactPointLines,A as deltaLine,w as encryptedLeftOutLine,n as inTheCommandsWords,Q as jobLines,export_jsforce as jsforce,E as main,B as memoryCreations,u as objectCountsLine,y as objectCurrencyLines,t as objectErrorLines,z as objectPriceLines,v as objectWrittenLines,b as parseArgs,F as parseRemoveArgs,i as readCutLines,G as readRunSummary,d as readSavedConfig,q as recordTypeGivenOfObjectsLines,J as removalRefusal,K as removalSummaryLines,H as removalsPathOf,R as removeMain,L as restoredLines,O as runFileOf,I as runOfSummary,P as runUserOfRunFile,e as savedConfigStore,s as simulationLines,j as statusWithReadCuts,o as syncApiRequestsJson,M as undeletedLines,p as writeCheckLines};
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a as we,d as ye}from"./chunk-CXKZ6TYV.mjs";import{b as Re,d as be,e as $e,f as Ie,g as Ae,i as Ee,j as H,l as ke,n as Oe,o as Ne}from"./chunk-TMIESDE5.mjs";import{b as _e}from"./chunk-L4RJX7DG.mjs";import{a as x,b as q,c as Se,e as G,g as m,h as Ue,j as ve}from"./chunk-TCEXCHXR.mjs";import{a as le}from"./chunk-ETNQHIDI.mjs";import"./chunk-UV74P4H2.mjs";import{a as W}from"./chunk-QROPNEGY.mjs";import{b as pe,e as fe}from"./chunk-BZ24IAP5.mjs";import{a as ee,b as L}from"./chunk-SCKUIE3R.mjs";import{c as P,d as he}from"./chunk-6FARZYMJ.mjs";import"./chunk-N2HYG3BL.mjs";import{b as ue,c as ce}from"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import{oc as ge}from"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import{a as ie,c as de,f as E,h as me}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import{b as z}from"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import{ib as se,jb as re,kb as ne,lb as te,nb as oe,ob as ae}from"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{readFileSync as Ke}from"node:fs";function Be(e,s,r){let{before:n}=e.applied,{after:a}=e,o=s.standing,u=m(e.applied.userId)===m(r.connected.userId),l=`${r.connected.username} is the user connected: SandForge would lock itself out; connect as another to put it back`,c={leave:e.accesses.filter(d=>d.what==="group"&&s.present.has(m(d.id))),unassign:e.accesses.filter(d=>d.what!=="group"&&s.present.has(m(d.id))),kept:[]};if(a.isFrozen!==n.isFrozen&&o.isFrozen===a.isFrozen){let d={what:"frozen",from:a.isFrozen,to:n.isFrozen};u&&n.isFrozen?c.kept.push({change:d,why:l}):s.loginId===void 0?c.kept.push({change:d,why:"the org keeps no login of this user (UserLogin) to write"}):c.isFrozen={to:n.isFrozen,loginId:s.loginId,change:d}}if(a.isActive!==n.isActive&&o.isActive===a.isActive){let d={what:"active",from:a.isActive,to:n.isActive};u&&!n.isActive?c.kept.push({change:d,why:l}):c.isActive={to:n.isActive,change:d}}if(m(a.profileId)!==m(n.profileId)&&m(o.profileId)!==m(n.profileId)){let d=$=>s.profileNames.get(m($))??$,f={what:"profile",from:d(o.profileId),to:d(n.profileId)},h=m(o.profileId)!==m(a.profileId);u?c.kept.push({change:f,why:l}):h&&!r.includeChanged?c.kept.push({change:f,why:`its profile was changed since the run, to ${d(o.profileId)}: --include-changed puts ${d(n.profileId)} back`}):c.profileId={to:n.profileId,change:f}}return c}function Ce(e){return e.what==="group"?{what:"group",name:e.name,type:e.type??"Regular",to:"removed"}:{what:e.what,name:e.name,to:"removed"}}function V(e,s,r,n){return{org:e.organization,run:e.run,status:"failure",users:[],apiRequests:n,refusals:[{code:s,message:r}]}}async function Pe(e){let{org:s,store:r,run:n}=e,a=e.now??(()=>new Date),o=s.requests(),u=()=>s.requests()-o,l=await s.identity(),c=await r.read(l.organizationId,n);if(!c)return V(e,"USERS_RUN_NOT_FOUND",`run ${n}: this machine keeps no run of that number for this org, whose Organization Id is ${l.organizationId}: a sandbox refreshed since answers another, and its runs went with the copy they set up`,u());let d=(await r.list(l.organizationId)).find(t=>t.replaces===n);if(d)return V(e,"USERS_RUN_REPLACED",`run ${n} was replaced by run ${d.run}, which holds what it set up: remove run ${d.run}`,u());let f=await Ue(s);if(f!==!0){let t=ve(l.username,f);return V(e,t.code,t.message,u())}let h=c.users,$=h.map(t=>t.applied.userId),R=new Map;for(let t of x($,200))for(let i of await s.query(`SELECT Id, IsActive, ProfileId FROM User WHERE Id IN ${q(t)}`))R.set(m(String(i.Id)),{isActive:i.IsActive===!0,isFrozen:!1,profileId:String(i.ProfileId)});let w=new Map,I=h.filter(t=>t.after.isFrozen!==t.applied.before.isFrozen);for(let t of x(I.map(i=>i.applied.userId),200))for(let i of await s.query(`SELECT Id, UserId, IsFrozen FROM UserLogin WHERE UserId IN ${q(t)}`)){let p=m(String(i.UserId));w.set(p,String(i.Id));let U=R.get(p);U&&(U.isFrozen=i.IsFrozen===!0)}let T=new Set,O=t=>h.flatMap(i=>i.accesses.filter(p=>t==="memberships"==(p.what==="group")).map(p=>p.id));for(let[t,i]of[["PermissionSetAssignment",O("assignments")],["GroupMember",O("memberships")]])for(let p of x(i,200))for(let U of await s.query(`SELECT Id FROM ${t} WHERE Id IN ${q(p)}`))T.add(m(String(U.Id)));let N=h.flatMap(t=>m(t.after.profileId)!==m(t.applied.before.profileId)?[t.applied.before.profileId,t.after.profileId,R.get(m(t.applied.userId))?.profileId??""]:[]).filter(t=>t!==""),_=new Map;for(let t of x([...new Set(N)],200))for(let i of await s.query(`SELECT Id, Name FROM Profile WHERE Id IN ${q(t)}`))_.set(m(String(i.Id)),String(i.Name));let g=h.map(t=>t.applied.username),A=h.flatMap(t=>{let i=R.get(m(t.applied.userId));if(!i)return[];let p=w.get(m(t.applied.userId));return[{user:t,undo:Be(t,{standing:i,...p?{loginId:p}:{},profileNames:_,present:T},{includeChanged:e.includeChanged===!0,connected:l}),undone:[],refused:[]}]}),J=(t,i,p)=>{let U=p?.code??"NO_ANSWER";t.refused.push({change:i,code:U,why:`the org refused it: ${U} ${Se(p?.message??"the org answered nothing for it",g)}`})},K=async(t,i)=>{let p=A.flatMap(y=>i(y).map(b=>({one:y,access:b})));if(p.length===0)return;let U=await s.destroy(t,p.map(({access:y})=>y.id));p.forEach(({one:y,access:b},M)=>{let C=U[M];C?.success===!0?y.undone.push(Ce(b)):C?.errors.some(Xe=>Xe.code==="ENTITY_IS_DELETED")||J(y,Ce(b),C?.errors[0])})},j=async(t,i)=>{let p=A.flatMap(y=>{let b=i(y);return b?[{one:y,...b}]:[]});if(p.length===0)return;let U=await s.update(t,p.map(({row:y})=>y));p.forEach(({one:y,change:b},M)=>{let C=U[M];C?.success===!0?y.undone.push(b):J(y,b,C?.errors[0])})},He=[()=>K("GroupMember",t=>t.undo.leave),()=>K("PermissionSetAssignment",t=>t.undo.unassign),()=>j("UserLogin",t=>t.undo.isFrozen?{row:{Id:t.undo.isFrozen.loginId,IsFrozen:t.undo.isFrozen.to},change:t.undo.isFrozen.change}:void 0),async()=>{for(let t of[!1,!0])await j("User",i=>i.undo.isActive?.to===t?{row:{Id:i.user.applied.userId,IsActive:t},change:i.undo.isActive.change}:void 0)},()=>j("User",t=>t.undo.profileId?{row:{Id:t.user.applied.userId,ProfileId:t.undo.profileId.to},change:t.undo.profileId.change}:void 0)],Q=!1;for(let t of He)if(await t(),e.signal?.aborted){Q=!0;break}let D=A.map(t=>{let i=[...t.undo.kept,...t.refused.map(({change:p,why:U})=>({change:p,why:U}))];return{username:t.user.applied.username,userId:t.user.applied.userId,undone:t.undone,...i.length>0?{kept:i}:{}}}),Y=D.reduce((t,i)=>t+(i.kept?.length??0),0),Z=Q?"cancelled":Y>0?"partial":"success",Ve={...c,removals:[...c.removals??[],{at:a().toISOString(),status:Z,undone:D.reduce((t,i)=>t+i.undone.length,0),kept:Y,codes:[...new Set(A.flatMap(t=>t.refused.map(i=>i.code)))].slice(0,50)}]};return await r.write(Ve),{org:e.organization,run:n,status:Z,users:D,apiRequests:u()}}var X="sandforge-users",Qe="USERS_RUN_NOT_FOUND",Ye="USERS_RUN_REPLACED",Ze=`sandforge users \u2014 set up the users of a sandbox handed back to its testers, a scratch org
7
+ import{a as we,d as ye}from"./chunk-ZV7ZFQQC.mjs";import{b as Re,d as be,e as $e,f as Ie,g as Ae,i as Ee,j as H,l as ke,n as Oe,o as Ne}from"./chunk-A3MYSOOC.mjs";import{b as _e}from"./chunk-VCUXCK36.mjs";import{a as x,b as q,c as Se,e as G,g as m,h as Ue,j as ve}from"./chunk-WY5V5PR3.mjs";import"./chunk-UV74P4H2.mjs";import{b as le}from"./chunk-7SQSWVAU.mjs";import{b as pe,e as fe}from"./chunk-RKTFFCNS.mjs";import{c as P,d as he}from"./chunk-6FARZYMJ.mjs";import{a as W}from"./chunk-QROPNEGY.mjs";import"./chunk-KGU4SVIT.mjs";import{a as ee,b as L}from"./chunk-AL4C3GFT.mjs";import{b as ue,c as ce}from"./chunk-OUZQPYT3.mjs";import"./chunk-MSIEU5MR.mjs";import"./chunk-LC3NDW4N.mjs";import{Ec as ge}from"./chunk-KB4ZHM4Q.mjs";import"./chunk-23SEDORH.mjs";import"./chunk-W6PN6TJG.mjs";import"./chunk-3Q353S2R.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-RHNTHGNU.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-D4GF4FAB.mjs";import"./chunk-CVHNXJH3.mjs";import"./chunk-MS4FJDFD.mjs";import{a as ie,c as de,f as E,h as me}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-M6K34KGF.mjs";import"./chunk-TNT27RBG.mjs";import"./chunk-TZE3Y7IQ.mjs";import{b as z}from"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-S42RBRH2.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import{ib as se,jb as re,kb as ne,lb as te,nb as oe,ob as ae}from"./chunk-PMWAFDUB.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{readFileSync as Ke}from"node:fs";function Be(e,s,r){let{before:n}=e.applied,{after:a}=e,o=s.standing,u=m(e.applied.userId)===m(r.connected.userId),l=`${r.connected.username} is the user connected: SandForge would lock itself out; connect as another to put it back`,c={leave:e.accesses.filter(d=>d.what==="group"&&s.present.has(m(d.id))),unassign:e.accesses.filter(d=>d.what!=="group"&&s.present.has(m(d.id))),kept:[]};if(a.isFrozen!==n.isFrozen&&o.isFrozen===a.isFrozen){let d={what:"frozen",from:a.isFrozen,to:n.isFrozen};u&&n.isFrozen?c.kept.push({change:d,why:l}):s.loginId===void 0?c.kept.push({change:d,why:"the org keeps no login of this user (UserLogin) to write"}):c.isFrozen={to:n.isFrozen,loginId:s.loginId,change:d}}if(a.isActive!==n.isActive&&o.isActive===a.isActive){let d={what:"active",from:a.isActive,to:n.isActive};u&&!n.isActive?c.kept.push({change:d,why:l}):c.isActive={to:n.isActive,change:d}}if(m(a.profileId)!==m(n.profileId)&&m(o.profileId)!==m(n.profileId)){let d=$=>s.profileNames.get(m($))??$,f={what:"profile",from:d(o.profileId),to:d(n.profileId)},h=m(o.profileId)!==m(a.profileId);u?c.kept.push({change:f,why:l}):h&&!r.includeChanged?c.kept.push({change:f,why:`its profile was changed since the run, to ${d(o.profileId)}: --include-changed puts ${d(n.profileId)} back`}):c.profileId={to:n.profileId,change:f}}return c}function Ce(e){return e.what==="group"?{what:"group",name:e.name,type:e.type??"Regular",to:"removed"}:{what:e.what,name:e.name,to:"removed"}}function V(e,s,r,n){return{org:e.organization,run:e.run,status:"failure",users:[],apiRequests:n,refusals:[{code:s,message:r}]}}async function Pe(e){let{org:s,store:r,run:n}=e,a=e.now??(()=>new Date),o=s.requests(),u=()=>s.requests()-o,l=await s.identity(),c=await r.read(l.organizationId,n);if(!c)return V(e,"USERS_RUN_NOT_FOUND",`run ${n}: this machine keeps no run of that number for this org, whose Organization Id is ${l.organizationId}: a sandbox refreshed since answers another, and its runs went with the copy they set up`,u());let d=(await r.list(l.organizationId)).find(t=>t.replaces===n);if(d)return V(e,"USERS_RUN_REPLACED",`run ${n} was replaced by run ${d.run}, which holds what it set up: remove run ${d.run}`,u());let f=await Ue(s);if(f!==!0){let t=ve(l.username,f);return V(e,t.code,t.message,u())}let h=c.users,$=h.map(t=>t.applied.userId),R=new Map;for(let t of x($,200))for(let i of await s.query(`SELECT Id, IsActive, ProfileId FROM User WHERE Id IN ${q(t)}`))R.set(m(String(i.Id)),{isActive:i.IsActive===!0,isFrozen:!1,profileId:String(i.ProfileId)});let w=new Map,I=h.filter(t=>t.after.isFrozen!==t.applied.before.isFrozen);for(let t of x(I.map(i=>i.applied.userId),200))for(let i of await s.query(`SELECT Id, UserId, IsFrozen FROM UserLogin WHERE UserId IN ${q(t)}`)){let p=m(String(i.UserId));w.set(p,String(i.Id));let U=R.get(p);U&&(U.isFrozen=i.IsFrozen===!0)}let T=new Set,O=t=>h.flatMap(i=>i.accesses.filter(p=>t==="memberships"==(p.what==="group")).map(p=>p.id));for(let[t,i]of[["PermissionSetAssignment",O("assignments")],["GroupMember",O("memberships")]])for(let p of x(i,200))for(let U of await s.query(`SELECT Id FROM ${t} WHERE Id IN ${q(p)}`))T.add(m(String(U.Id)));let N=h.flatMap(t=>m(t.after.profileId)!==m(t.applied.before.profileId)?[t.applied.before.profileId,t.after.profileId,R.get(m(t.applied.userId))?.profileId??""]:[]).filter(t=>t!==""),_=new Map;for(let t of x([...new Set(N)],200))for(let i of await s.query(`SELECT Id, Name FROM Profile WHERE Id IN ${q(t)}`))_.set(m(String(i.Id)),String(i.Name));let g=h.map(t=>t.applied.username),A=h.flatMap(t=>{let i=R.get(m(t.applied.userId));if(!i)return[];let p=w.get(m(t.applied.userId));return[{user:t,undo:Be(t,{standing:i,...p?{loginId:p}:{},profileNames:_,present:T},{includeChanged:e.includeChanged===!0,connected:l}),undone:[],refused:[]}]}),J=(t,i,p)=>{let U=p?.code??"NO_ANSWER";t.refused.push({change:i,code:U,why:`the org refused it: ${U} ${Se(p?.message??"the org answered nothing for it",g)}`})},K=async(t,i)=>{let p=A.flatMap(y=>i(y).map(b=>({one:y,access:b})));if(p.length===0)return;let U=await s.destroy(t,p.map(({access:y})=>y.id));p.forEach(({one:y,access:b},M)=>{let C=U[M];C?.success===!0?y.undone.push(Ce(b)):C?.errors.some(Xe=>Xe.code==="ENTITY_IS_DELETED")||J(y,Ce(b),C?.errors[0])})},j=async(t,i)=>{let p=A.flatMap(y=>{let b=i(y);return b?[{one:y,...b}]:[]});if(p.length===0)return;let U=await s.update(t,p.map(({row:y})=>y));p.forEach(({one:y,change:b},M)=>{let C=U[M];C?.success===!0?y.undone.push(b):J(y,b,C?.errors[0])})},He=[()=>K("GroupMember",t=>t.undo.leave),()=>K("PermissionSetAssignment",t=>t.undo.unassign),()=>j("UserLogin",t=>t.undo.isFrozen?{row:{Id:t.undo.isFrozen.loginId,IsFrozen:t.undo.isFrozen.to},change:t.undo.isFrozen.change}:void 0),async()=>{for(let t of[!1,!0])await j("User",i=>i.undo.isActive?.to===t?{row:{Id:i.user.applied.userId,IsActive:t},change:i.undo.isActive.change}:void 0)},()=>j("User",t=>t.undo.profileId?{row:{Id:t.user.applied.userId,ProfileId:t.undo.profileId.to},change:t.undo.profileId.change}:void 0)],Q=!1;for(let t of He)if(await t(),e.signal?.aborted){Q=!0;break}let D=A.map(t=>{let i=[...t.undo.kept,...t.refused.map(({change:p,why:U})=>({change:p,why:U}))];return{username:t.user.applied.username,userId:t.user.applied.userId,undone:t.undone,...i.length>0?{kept:i}:{}}}),Y=D.reduce((t,i)=>t+(i.kept?.length??0),0),Z=Q?"cancelled":Y>0?"partial":"success",Ve={...c,removals:[...c.removals??[],{at:a().toISOString(),status:Z,undone:D.reduce((t,i)=>t+i.undone.length,0),kept:Y,codes:[...new Set(A.flatMap(t=>t.refused.map(i=>i.code)))].slice(0,50)}]};return await r.write(Ve),{org:e.organization,run:n,status:Z,users:D,apiRequests:u()}}var X="sandforge-users",Qe="USERS_RUN_NOT_FOUND",Ye="USERS_RUN_REPLACED",Ze=`sandforge users \u2014 set up the users of a sandbox handed back to its testers, a scratch org
8
8
  or a Developer Edition org: an address the copy put under .invalid asked back, a user activated,
9
9
  frozen or unfrozen, a profile, permission sets, permission set groups, groups and queues given;
10
10
  and take a run back.
package/lib/sandforge.mjs CHANGED
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d,e,f}from"./chunk-A32ISQ6M.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-NTOVCTRS.mjs";export{a as TOOLS,b as dispatchOf,c as helpText,f as main,d as toolFile,e as versionOf};
7
+ import{a,b,c,d,e,f}from"./chunk-RMFU4BAL.mjs";import"./chunk-AL4C3GFT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as TOOLS,b as dispatchOf,c as helpText,f as main,d as toolFile,e as versionOf};
@@ -1,6 +1,6 @@
1
1
  export default class SandforgeCommand {
2
- static summary = "compare two orgs the way the Compare page does";
3
- static description = "sandforge compare — compare two orgs the way the Compare page does, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge compare --help.";
2
+ static summary = "compare two orgs the way the Compare page does, and deploy what differs";
3
+ static description = "sandforge compare — compare two orgs the way the Compare page does, without the editor, and deploy what differs as its Deploy tab does.\n\nThe whole help, its options and its exit codes: sf sandforge compare --help.";
4
4
  static hidden = false;
5
5
  static strict = false;
6
6
  static flags = {};
package/lib/sfPlugin.mjs CHANGED
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{f as i}from"./chunk-A32ISQ6M.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-NTOVCTRS.mjs";import{extname as l,join as m}from"node:path";function c(e=__dirname,s=__filename){return m(e,`sandforge${l(s)}`)}async function p(e,s,o=i,t=__dirname,a=__filename){await o([process.execPath,c(t,a),...e===""?[]:[e],...s])}var r="https://github.com/StephaneBerthoz/sandforge/blob/master",d=[{id:"sandforge",label:"SandForge",description:"Test data between Salesforce orgs: what SandForge holds on this machine, read without reaching an org; every other command runs in a terminal, sf sandforge <command>.",vscodeIcon:"database",sldsIcon:"utility:database",commands:[{id:"sandforge-help",label:"Commands and their help",command:"sf sandforge --help",tooltip:"SandForge's commands; sf sandforge <command> --help gives a command's options and exit codes",helpUrl:`${r}/packages/cli/README.md`,vscodeIcon:"question",sldsIcon:"utility:help"},{id:"sandforge-templates",label:"Seed templates",command:"sf sandforge seed --list-templates",tooltip:"Name the built-in templates Seed fills an org from; reaches no org",helpUrl:`${r}/docs/modules/seed.md`,vscodeIcon:"list-unordered",sldsIcon:"utility:list"},{id:"sandforge-yaml-validate",label:"Validate sandforge.yaml",command:"sf sandforge env validate",tooltip:"Check this folder's sandforge.yaml offline: its schema, each resource, their order, the variables it names; reaches no org",helpUrl:`${r}/docs/environments.md`,vscodeIcon:"check",sldsIcon:"utility:check"},{id:"sandforge-yaml-state",label:"Environments on this machine",command:"sf sandforge env state",tooltip:"List the sandforge.yaml environments this machine keeps; reaches no org",helpUrl:`${r}/docs/environments.md`,vscodeIcon:"list-tree",sldsIcon:"utility:database"}]}],g={out:e=>{process.stdout.write(e)},err:e=>{process.stderr.write(e)}};function u(e,s=g){let o=e.find(n=>n!=="--json");if(o!==void 0)return s.err(`"${o}" is not a flag sandforge:hardis-commands reads: --json, or nothing. Nothing was run.
7
+ import{f as i}from"./chunk-RMFU4BAL.mjs";import"./chunk-AL4C3GFT.mjs";import"./chunk-NTOVCTRS.mjs";import{extname as l,join as m}from"node:path";function c(e=__dirname,s=__filename){return m(e,`sandforge${l(s)}`)}async function p(e,s,o=i,t=__dirname,a=__filename){await o([process.execPath,c(t,a),...e===""?[]:[e],...s])}var r="https://github.com/StephaneBerthoz/sandforge/blob/master",d=[{id:"sandforge",label:"SandForge",description:"Test data between Salesforce orgs: what SandForge holds on this machine, read without reaching an org; every other command runs in a terminal, sf sandforge <command>.",vscodeIcon:"database",sldsIcon:"utility:database",commands:[{id:"sandforge-help",label:"Commands and their help",command:"sf sandforge --help",tooltip:"SandForge's commands; sf sandforge <command> --help gives a command's options and exit codes",helpUrl:`${r}/packages/cli/README.md`,vscodeIcon:"question",sldsIcon:"utility:help"},{id:"sandforge-templates",label:"Seed templates",command:"sf sandforge seed --list-templates",tooltip:"Name the built-in templates Seed fills an org from; reaches no org",helpUrl:`${r}/docs/modules/seed.md`,vscodeIcon:"list-unordered",sldsIcon:"utility:list"},{id:"sandforge-yaml-validate",label:"Validate sandforge.yaml",command:"sf sandforge env validate",tooltip:"Check this folder's sandforge.yaml offline: its schema, each resource, their order, the variables it names; reaches no org",helpUrl:`${r}/docs/environments.md`,vscodeIcon:"check",sldsIcon:"utility:check"},{id:"sandforge-yaml-state",label:"Environments on this machine",command:"sf sandforge env state",tooltip:"List the sandforge.yaml environments this machine keeps; reaches no org",helpUrl:`${r}/docs/environments.md`,vscodeIcon:"list-tree",sldsIcon:"utility:database"}]}],g={out:e=>{process.stdout.write(e)},err:e=>{process.stderr.write(e)}};function u(e,s=g){let o=e.find(n=>n!=="--json");if(o!==void 0)return s.err(`"${o}" is not a flag sandforge:hardis-commands reads: --json, or nothing. Nothing was run.
8
8
  `),2;if(e.includes("--json"))return s.out(`${JSON.stringify({status:0,result:{customCommands:d}})}
9
9
  `),0;let t=d.flatMap(n=>n.commands),a=Math.max(...t.map(n=>n.label.length));return s.out(`The entries SandForge adds to the menus of the sfdx-hardis VS Code extension, each reaching no org:
10
10
  `+t.map(n=>` ${n.label.padEnd(a)} ${n.command}
@@ -1 +1 @@
1
- {"commands":{"sandforge":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge takes","name":"argv"}},"description":"sandforge — SandForge's command lines, without the editor: Seed, Forge's clone, Sync, Checkpoints, DataOps, Frozen Dataset, the emptying of a sandbox, the users of a sandbox, sandforge.yaml environments, Automation pipelines, and the MCP server.\n\nIts commands: sf sandforge --help. The whole help of one, its options and its exit codes: sf sandforge <command> --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"SandForge's command lines: seed, clone, sync, checkpoints, masking, Frozen Datasets, sandforge.yaml, pipelines, MCP","isESM":true,"relativePath":["lib","sf","sandforge","index.mjs"]},"sandforge:autopilot":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge autopilot takes","name":"argv"}},"description":"sandforge autopilot — run an Autopilot copy between two orgs, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge autopilot --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:autopilot","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"run an Autopilot copy between two orgs","isESM":true,"relativePath":["lib","sf","sandforge","autopilot.mjs"]},"sandforge:backup":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge backup takes","name":"argv"}},"description":"sandforge backup — take and restore DataOps snapshots, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge backup --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:backup","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"take and restore DataOps snapshots","isESM":true,"relativePath":["lib","sf","sandforge","backup.mjs"]},"sandforge:checkpoint":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge checkpoint takes","name":"argv"}},"description":"sandforge checkpoint — take a checkpoint of an org's data, and rewind the org to it, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge checkpoint --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:checkpoint","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"take a checkpoint of an org's data, and rewind the org to it","isESM":true,"relativePath":["lib","sf","sandforge","checkpoint.mjs"]},"sandforge:cleanup":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge cleanup takes","name":"argv"}},"description":"sandforge cleanup — Bulk delete records you created on a sandbox in the --since window, whether or not a clone wrote them. Preview with --dry-run and narrow with --objects before deleting.\n\nThe whole help, its options and its exit codes: sf sandforge cleanup --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:cleanup","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"Bulk delete records you created on a sandbox in a time window","isESM":true,"relativePath":["lib","sf","sandforge","cleanup.mjs"]},"sandforge:clone":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge clone takes","name":"argv"}},"description":"sandforge clone — Forge a clone of one record, or of whole tables, from a source org to a target sandbox, or remove what a run of it created.\n\nThe whole help, its options and its exit codes: sf sandforge clone --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:clone","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"clone a record, or whole tables, from one org to a sandbox, or remove a run","isESM":true,"relativePath":["lib","sf","sandforge","clone.mjs"]},"sandforge:compare":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge compare takes","name":"argv"}},"description":"sandforge compare — compare two orgs the way the Compare page does, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge compare --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:compare","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"compare two orgs the way the Compare page does","isESM":true,"relativePath":["lib","sf","sandforge","compare.mjs"]},"sandforge:dataops":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge dataops takes","name":"argv"}},"description":"sandforge dataops — mask an org's records, and put them back, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge dataops --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:dataops","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"mask an org's records, and put them back","isESM":true,"relativePath":["lib","sf","sandforge","dataops.mjs"]},"sandforge:empty":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge empty takes","name":"argv"}},"description":"sandforge empty — empty objects of a sandbox, or the whole of it, without the editor: a dry run first, then the deletes, to the recycle bin with an undo, or for good.\n\nThe whole help, its options and its exit codes: sf sandforge empty --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:empty","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"empty objects of a sandbox, or the whole of it","isESM":true,"relativePath":["lib","sf","sandforge","empty.mjs"]},"sandforge:env":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge env takes","name":"argv"}},"description":"sandforge env — apply a sandforge.yaml to an org: the data an environment needs, declared in your repository, created, kept and taken back, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge env --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:env","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"apply a sandforge.yaml to an org, and take it back","isESM":true,"relativePath":["lib","sf","sandforge","env.mjs"]},"sandforge:frozen":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge frozen takes","name":"argv"}},"description":"sandforge frozen — build and replay a Frozen Dataset, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge frozen --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:frozen","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"build and replay a Frozen Dataset","isESM":true,"relativePath":["lib","sf","sandforge","frozen.mjs"]},"sandforge:mcp":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge mcp takes","name":"argv"}},"description":"sandforge mcp — Seed, Forge's clone of a record, of the records a query chooses or of the whole org, the removal of a run, the emptying of objects or of a whole org, Checkpoints and their replay into another org, the environments of a sandforge.yaml and the plan of an Automation pipeline, as tools for an AI agent, over the Model Context Protocol on stdio.\n\nThe whole help, its options and its exit codes: sf sandforge mcp --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:mcp","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"the MCP server: these scripts as tools for an AI agent, on stdio","isESM":true,"relativePath":["lib","sf","sandforge","mcp.mjs"]},"sandforge:monitor":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge monitor takes","name":"argv"}},"description":"sandforge monitor — read an org the way the Monitor page does, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge monitor --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:monitor","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"read an org the way the Monitor page does","isESM":true,"relativePath":["lib","sf","sandforge","monitor.mjs"]},"sandforge:pipeline":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge pipeline takes","name":"argv"}},"description":"sandforge pipeline — run an Automation pipeline exported from VS Code, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge pipeline --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:pipeline","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"plan and run an Automation pipeline exported from VS Code","isESM":true,"relativePath":["lib","sf","sandforge","pipeline.mjs"]},"sandforge:seed":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge seed takes","name":"argv"}},"description":"sandforge seed — fill an org from a seed template, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge seed --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:seed","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"fill an org from a seed template","isESM":true,"relativePath":["lib","sf","sandforge","seed.mjs"]},"sandforge:sync":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge sync takes","name":"argv"}},"description":"sandforge sync — run a Sync between two orgs, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge sync --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:sync","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"run a Sync between two orgs","isESM":true,"relativePath":["lib","sf","sandforge","sync.mjs"]},"sandforge:users":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge users takes","name":"argv"}},"description":"sandforge users — set up the users of a sandbox handed back to its testers, a scratch org or a Developer Edition org: an address the copy put under .invalid asked back, a user activated, frozen or unfrozen, a profile, permission sets, permission set groups, groups and queues given; and take a run back.\n\nThe whole help, its options and its exit codes: sf sandforge users --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:users","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"set up the users of a sandbox after its refresh, and take them back","isESM":true,"relativePath":["lib","sf","sandforge","users.mjs"]},"sandforge:hardis-commands":{"aliases":[],"args":{"argv":{"description":"nothing, or --json for the document the extension reads","name":"argv"}},"description":"The entries SandForge adds to the menus of the sfdx-hardis VS Code extension, each reaching no org. With --json, the document the extension reads, alone on stdout.","flags":{},"hasDynamicHelp":false,"hidden":true,"hiddenAliases":[],"id":"sandforge:hardis-commands","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"the menus of SandForge in the sfdx-hardis VS Code extension","isESM":true,"relativePath":["lib","sf","sandforge","hardis-commands.mjs"]}},"version":"1.83.0"}
1
+ {"commands":{"sandforge":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge takes","name":"argv"}},"description":"sandforge — SandForge's command lines, without the editor: Seed, Forge's clone, Sync, Checkpoints, DataOps, Frozen Dataset, the emptying of a sandbox, the users of a sandbox, sandforge.yaml environments, Automation pipelines, and the MCP server.\n\nIts commands: sf sandforge --help. The whole help of one, its options and its exit codes: sf sandforge <command> --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"SandForge's command lines: seed, clone, sync, checkpoints, masking, Frozen Datasets, sandforge.yaml, pipelines, MCP","isESM":true,"relativePath":["lib","sf","sandforge","index.mjs"]},"sandforge:autopilot":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge autopilot takes","name":"argv"}},"description":"sandforge autopilot — run an Autopilot copy between two orgs, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge autopilot --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:autopilot","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"run an Autopilot copy between two orgs","isESM":true,"relativePath":["lib","sf","sandforge","autopilot.mjs"]},"sandforge:backup":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge backup takes","name":"argv"}},"description":"sandforge backup — take and restore DataOps snapshots, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge backup --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:backup","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"take and restore DataOps snapshots","isESM":true,"relativePath":["lib","sf","sandforge","backup.mjs"]},"sandforge:checkpoint":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge checkpoint takes","name":"argv"}},"description":"sandforge checkpoint — take a checkpoint of an org's data, and rewind the org to it, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge checkpoint --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:checkpoint","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"take a checkpoint of an org's data, and rewind the org to it","isESM":true,"relativePath":["lib","sf","sandforge","checkpoint.mjs"]},"sandforge:cleanup":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge cleanup takes","name":"argv"}},"description":"sandforge cleanup — Bulk delete records you created on a sandbox in the --since window, whether or not a clone wrote them. Preview with --dry-run and narrow with --objects before deleting.\n\nThe whole help, its options and its exit codes: sf sandforge cleanup --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:cleanup","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"Bulk delete records you created on a sandbox in a time window","isESM":true,"relativePath":["lib","sf","sandforge","cleanup.mjs"]},"sandforge:clone":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge clone takes","name":"argv"}},"description":"sandforge clone — Forge a clone of one record, or of whole tables, from a source org to a target sandbox, or remove what a run of it created.\n\nThe whole help, its options and its exit codes: sf sandforge clone --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:clone","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"clone a record, or whole tables, from one org to a sandbox, or remove a run","isESM":true,"relativePath":["lib","sf","sandforge","clone.mjs"]},"sandforge:compare":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge compare takes","name":"argv"}},"description":"sandforge compare — compare two orgs the way the Compare page does, without the editor, and deploy what differs as its Deploy tab does.\n\nThe whole help, its options and its exit codes: sf sandforge compare --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:compare","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"compare two orgs the way the Compare page does, and deploy what differs","isESM":true,"relativePath":["lib","sf","sandforge","compare.mjs"]},"sandforge:dataops":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge dataops takes","name":"argv"}},"description":"sandforge dataops — mask an org's records, and put them back, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge dataops --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:dataops","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"mask an org's records, and put them back","isESM":true,"relativePath":["lib","sf","sandforge","dataops.mjs"]},"sandforge:empty":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge empty takes","name":"argv"}},"description":"sandforge empty — empty objects of a sandbox, or the whole of it, without the editor: a dry run first, then the deletes, to the recycle bin with an undo, or for good.\n\nThe whole help, its options and its exit codes: sf sandforge empty --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:empty","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"empty objects of a sandbox, or the whole of it","isESM":true,"relativePath":["lib","sf","sandforge","empty.mjs"]},"sandforge:env":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge env takes","name":"argv"}},"description":"sandforge env — apply a sandforge.yaml to an org: the data an environment needs, declared in your repository, created, kept and taken back, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge env --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:env","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"apply a sandforge.yaml to an org, and take it back","isESM":true,"relativePath":["lib","sf","sandforge","env.mjs"]},"sandforge:frozen":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge frozen takes","name":"argv"}},"description":"sandforge frozen — build and replay a Frozen Dataset, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge frozen --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:frozen","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"build and replay a Frozen Dataset","isESM":true,"relativePath":["lib","sf","sandforge","frozen.mjs"]},"sandforge:mcp":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge mcp takes","name":"argv"}},"description":"sandforge mcp — Seed, Forge's clone of a record, of the records a query chooses or of the whole org, the removal of a run, the emptying of objects or of a whole org, Checkpoints and their replay into another org, the environments of a sandforge.yaml and the plan of an Automation pipeline, as tools for an AI agent, over the Model Context Protocol on stdio.\n\nThe whole help, its options and its exit codes: sf sandforge mcp --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:mcp","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"the MCP server: these scripts as tools for an AI agent, on stdio","isESM":true,"relativePath":["lib","sf","sandforge","mcp.mjs"]},"sandforge:monitor":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge monitor takes","name":"argv"}},"description":"sandforge monitor — read an org the way the Monitor page does, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge monitor --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:monitor","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"read an org the way the Monitor page does","isESM":true,"relativePath":["lib","sf","sandforge","monitor.mjs"]},"sandforge:pipeline":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge pipeline takes","name":"argv"}},"description":"sandforge pipeline — run an Automation pipeline exported from VS Code, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge pipeline --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:pipeline","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"plan and run an Automation pipeline exported from VS Code","isESM":true,"relativePath":["lib","sf","sandforge","pipeline.mjs"]},"sandforge:seed":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge seed takes","name":"argv"}},"description":"sandforge seed — fill an org from a seed template, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge seed --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:seed","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"fill an org from a seed template","isESM":true,"relativePath":["lib","sf","sandforge","seed.mjs"]},"sandforge:sync":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge sync takes","name":"argv"}},"description":"sandforge sync — run a Sync between two orgs, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge sync --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:sync","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"run a Sync between two orgs","isESM":true,"relativePath":["lib","sf","sandforge","sync.mjs"]},"sandforge:users":{"aliases":[],"args":{"argv":{"description":"the words npx sandforge users takes","name":"argv"}},"description":"sandforge users — set up the users of a sandbox handed back to its testers, a scratch org or a Developer Edition org: an address the copy put under .invalid asked back, a user activated, frozen or unfrozen, a profile, permission sets, permission set groups, groups and queues given; and take a run back.\n\nThe whole help, its options and its exit codes: sf sandforge users --help.","flags":{},"hasDynamicHelp":false,"hidden":false,"hiddenAliases":[],"id":"sandforge:users","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"set up the users of a sandbox after its refresh, and take them back","isESM":true,"relativePath":["lib","sf","sandforge","users.mjs"]},"sandforge:hardis-commands":{"aliases":[],"args":{"argv":{"description":"nothing, or --json for the document the extension reads","name":"argv"}},"description":"The entries SandForge adds to the menus of the sfdx-hardis VS Code extension, each reaching no org. With --json, the document the extension reads, alone on stdout.","flags":{},"hasDynamicHelp":false,"hidden":true,"hiddenAliases":[],"id":"sandforge:hardis-commands","pluginAlias":"sandforge","pluginName":"sandforge","pluginType":"core","strict":false,"summary":"the menus of SandForge in the sfdx-hardis VS Code extension","isESM":true,"relativePath":["lib","sf","sandforge","hardis-commands.mjs"]}},"version":"1.84.1"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandforge",
3
- "version": "1.83.0",
3
+ "version": "1.84.1",
4
4
  "description": "SandForge's command lines, without the editor: seed, clone and sync Salesforce orgs, checkpoints and rewinds, masking, Frozen Datasets, sandforge.yaml environments, and an MCP server for AI agents.",
5
5
  "keywords": [
6
6
  "salesforce",
@@ -1,7 +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{k as be}from"./chunk-BH76USTQ.mjs";import{a as ge,c as B,d as we}from"./chunk-XKFHTBAB.mjs";import{b as fe,e as pe,i as me,j as D,l as S}from"./chunk-FYWNSMOZ.mjs";import{b as ue}from"./chunk-BPHTA6KP.mjs";import{g as P,j as te,l as T,m as ie,p as ne}from"./chunk-4X5D3MSV.mjs";import{A as ce,B as le,v as se,x as ae,z as de}from"./chunk-XMQ5R6TC.mjs";import{j as oe}from"./chunk-EOQON3E5.mjs";import{A as re,x as I}from"./chunk-N2HYG3BL.mjs";import{d as ee}from"./chunk-7WSQ65WG.mjs";import{e as X}from"./chunk-MJD6CPZZ.mjs";import{c as Z}from"./chunk-WXU6ZJIV.mjs";import{g as V,h as Y,i as q,q as Q}from"./chunk-Z3MGN42K.mjs";import{b as K}from"./chunk-CA5NAXSU.mjs";import{Yd as J}from"./chunk-6QSHWIZI.mjs";var ve="No record would be read or written.";function je(t,e){return{code:"RUN_WRITING",message:`${e.operation==="take"?`A checkpoint of ${t} is being taken`:e.operation==="rewind"?`A rewind is writing to ${t}`:e.operation==="undo"?`An undo is writing to ${t}`:e.operation==="empty"?`An emptying of its objects is writing to ${t}`:`SandForge is deleting checkpoints of ${t}`} (process ${e.pid} on ${e.host}): rewind once it has ended. ${ve}`}}function Ae(t){return{query:e=>t.query(e),queryMore:e=>t.queryMore(e)}}function Ee(t){let e=t.objects.find(r=>r.objectApiName===V);if(e===void 0)return 0;let n=e.toBringBack;return n.inBin+n.withParent+n.deletedWhileTaken}function Pe(t,e){return{objectsRead:[...t],objects:[],unread:["flows","triggers","processes","workflowRules"].map(n=>({part:n,reason:e})),conditionsNotRead:0,conditionsBound:0,requests:0}}function Te(t,e){let n=new Map,r;return{bodies:n,global:()=>r,describeGlobal:()=>r??=t.describeGlobal(),reader:{lane:()=>e.lane(),tooling:i=>e.tooling(i),calls:()=>e.calls(),describe:async(i,a)=>{let d=await e.describe(i,a);return"body"in d&&n.set(i,d.body),d}}}}async function Je(t,e){let{org:n,signal:r}=t,{checkpoint:i,orgName:a}=e,d,p=await ue(Ae(n),{act:"preview",orgName:a,registered:e.registered,username:e.username,organizationId:i.org.organizationId,customSettings:Q(i)},{userId:async()=>d=await n.userId()});if(!p.allowed)return{previewed:!1,refusal:p.refusal};let m=await de(n,a),g=Te(n,oe(n,r)),ke=await fe({grants:p.grants,...d!==void 0?{userId:d}:{},username:e.username,checkpoint:i,reader:g.reader}),h=await n.serverTime(),R=re("pv",(t.now??(()=>new Date))()),c=await pe({checkpoint:i,folder:e.folder,reader:g.reader,describeGlobal:g.describeGlobal,previewId:R,readAt:h,queryAllFiles:p.queryAllFiles,access:ke,...r?{signal:r}:{}}),O=m.fileStorage;c.files!==void 0&&O!==void 0&&(c.files.storage.remaining=O.remaining*1048576);let w=e.objects!==void 0?new Set(e.objects):void 0,l=me(c,w),b=ge(l),F=w===void 0&&i.scope.mode==="picked"&&c.objects.some(o=>o.outside.length>0),ye=F&&e.acceptOutside===!1,y;if(w!==void 0||ye){y=await S({checkpoint:i,previewDir:I(e.folder,R),readAt:h,...w!==void 0?{objects:w}:{},acceptOutside:e.acceptOutside===!0,heldRows:D(i,e.folder),...r?{signal:r}:{}});for(let{objectApiName:o}of y.acts)b.includes(o)||b.push(o)}let s;if(b.length>0&&t.readAutomation)try{s=await t.readAutomation(b)}catch(o){s=Pe(b,K(o))}let C,k=0,G=y?B(c,y):l,v=we(G),u=s&&e.muteAutomation===!0?ee(s,J(v)):void 0,j=s&&u&&u.plan.assign.length>0&&t.mute?await be(t.mute,s,v):void 0,he=j&&"refusal"in j?j.refusal:void 0;if(s){let o=await ne({act:"rewind",orgName:a,automation:s,steps:v,...u?{plan:u.plan}:{},accepted:!1,mayMute:u===void 0,read:()=>Z(n)});C=o.gate.deliverability,k=o.ofRun.read?.requests??0}let M=g.global(),N=M?new Set((await X({describeGlobal:()=>M})).keys()):void 0,W=new Set(i.objects.map(({objectApiName:o})=>o.toLowerCase()));if(i.files!==void 0)for(let o of[Y,q])W.add(o.toLowerCase());let _=new Map;for(let[o,Oe]of g.bodies)_.set(o,se(Oe,{inCheckpoint:W,...N?{worked:N}:{}}));let L=ae({objects:i.objects,diff:l,automationRequests:s?.requests??0,...k>0?{deliverabilityRequests:k}:{},relationships:_,...e.reusesPreview===!0?{reusesPreview:!0}:{}}),Re={...L,apiRequestsLeft:m.remaining},$=P(G.objects),f=u?.automation??s,A=f?T($,f,m.emails):[],x=f?te($,f):void 0,U=F&&e.acceptOutside===void 0&&f?T(P(B(c,await S({checkpoint:i,previewDir:I(e.folder,R),readAt:h,acceptOutside:!1,heldRows:D(i,e.folder),...r?{signal:r}:{}})).objects),f,m.emails):void 0,E=t.store.heldBy(i.org.organizationId),z=E===void 0?await t.runWriting?.(p.org.id):void 0,H=E!==void 0?je(a,E):z!==void 0?{code:"RUN_WRITING",message:z}:he??ce("rewind",{run:L.apiRequests-k,deliverability:k},m,a)??ie("rewind",A,a)??(l.files!==void 0?le("rewind",{files:Ee(l),bytes:l.files.storage.bringBack},O?.remaining,a):void 0);return{previewed:!0,diff:c,...s?{automation:s}:{},...A.length>0?{emails:A}:{},...U?{emailsKeepingOutside:U}:{},...x!==void 0?{emailsUncounted:x}:{},...C?{deliverability:C}:{},estimate:Re,...H?{refusal:H}:{}}}export{Je as a};
@@ -1,7 +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{a as O,f as dt,h as C}from"./chunk-TZE3Y7IQ.mjs";import{Oc as at}from"./chunk-6QSHWIZI.mjs";var It="AccountContactRelation",D="EmailMessage",z="Task",tt="TaskRelation",B="EventRelation",j=200,en={ProductSellingModel:["SellingModelType","PricingTerm","PricingTermUnit"]},rn={objectApiName:"FeedItem",field:"Type",value:"CreateRecordEvent",parent:"ParentId"},X={FeedItem:[{field:"Type",value:"TrackedChange",noun:"tracked change"}],[tt]:[{field:"IsWhat",value:!0,noun:"what relation",from:"the task's WhatId"}],[B]:[{field:"IsWhat",value:!0,noun:"what relation",from:"the event's WhatId"}],EmailMessageRelation:[{noun:"email relation",from:"the email's addresses"}]};function Et(t,n){return X[t]?.find(e=>e.field===void 0||e.value!==void 0&&String(n[e.field])===String(e.value))}var ut=class{constructor(n=Et){this.rowsOf=n}rowsOf;reasons=new Map;byObject=new Map;leaveOut(n,e,r,o=[]){let i=this.reasons.get(e);if(i)return i;let s=this.reasonFor(n,r,o);if(!s)return;this.reasons.set(e,s);let d=this.byObject.get(n)??new Map,u=`${s.rows.field}=${s.rows.value}|${s.through??""}`,l=d.get(u)??{why:s,ids:new Set};return l.ids.add(e),d.set(u,l),this.byObject.set(n,d),s}keep(n,e,r=[]){return e.filter(o=>!this.leaveOut(n,String(o.Id),o,r))}has(n){return this.reasons.has(n)}counts(n){return(n===void 0?[...this.byObject]:[[n,this.byObject.get(n)]]).flatMap(([r,o])=>[...o?.values()??[]].map(({why:i,ids:s})=>({objectApiName:r,why:i,count:s.size})))}reasonFor(n,e,r){let o=this.rowsOf(n,e);if(o)return{rows:o};for(let i of r){let s=e[i],d=typeof s=="string"?this.reasons.get(s):void 0;if(d)return{rows:d.rows,through:i}}}};function on(t,n){if(n.through)return`${t} left out: ${n.through} names a ${n.rows.noun}, which the platform writes itself`;let e=n.rows.from?`, from ${n.rows.from}`:"";return`${t} ${n.rows.noun}${t===1?"":"s"} left out: the platform writes them itself${e}`}function sn(t,n){let e=`${t} record${t===1?"":"s"}`;return n.through?`${n.through} \u2192 ${n.rows.noun} (${e})`:n.rows.field===void 0?`every ${n.rows.noun} (${e})`:`${n.rows.field}=${String(n.rows.value)} (${e})`}function an(t){return t.through?`Not written: ${t.through} may not be left empty, and the ${t.rows.noun} it names is one the platform writes itself, which no copy sends.`:t.rows.from?`Not written: the platform writes each ${t.rows.noun} itself, from ${t.rows.from}.`:`Not written: the platform writes each ${t.rows.noun} itself, and refuses one a copy sends.`}function ct({field:t,value:n},e){if(t===void 0)return e==="="?"Id != null":"Id = null";let r=typeof n=="boolean"?String(n):`'${O(n??"")}'`;return`${C(t)} ${e} ${r}`}function dn(t,n,e){let r=s=>s.map(d=>ct(d,"=")).join(" OR "),o=(X[t]??[]).map(s=>ct(s,"!=")),i=n.flatMap(s=>s.referenceTo.flatMap(d=>{let u=X[d];if(d===t||!e.has(d)||!u||u.length===0)return[];let l=e.get(d),I=l?`(${dt(l)}) AND (${r(u)})`:`(${r(u)})`;return[`${C(s.name)} NOT IN (SELECT Id FROM ${C(d)} WHERE ${I})`]}));return[...o,...i]}var $t={[tt]:new Set(["Contact","Lead"]),[B]:new Set(["Contact","Lead","User","Calendar"])};function un(t,n,e){let r=$t[t];if(!r)return n;let o=n.IsWhat;return o!==""&&o!==null&&o!==void 0||e===void 0||r.has(e)?n:{...n,IsWhat:!0}}var Ct="500";function Pt(t){return t.startsWith(Ct)?"Case":void 0}function ht(t,n=Pt){let e=t.ParentId;if(typeof e=="string"&&e!=="")return!0;let r=t.RelatedToId;return typeof r=="string"&&r!==""&&n(r)==="Case"}function cn(t,n){return t===D&&!ht(n)?["ActivityId"]:[]}function fn(t){return!t.has(D)||!t.has(z)?[]:[{sourceObject:D,targetObject:z,relationshipName:`${D}Before${z}`,type:"lookup",required:!0}]}function ln(t,n){let e=t.ActivityId;return typeof e=="string"&&e!==""&&ht(t,n)}var S=200;async function gn(t,n){let e=new Map;for(let r=0;r<n.length;r+=S){let o=n.slice(r,r+S).map(s=>`'${O(s)}'`).join(", "),i=await t(`SELECT Id, ActivityId FROM ${D} WHERE Id IN (${o})`);for(let s of i){let d=s.ActivityId;typeof s.Id=="string"&&typeof d=="string"&&d!==""&&e.set(s.Id,d)}}return e}var L="Account",H="Contact",Q="PersonContactId",mt="IsPersonAccount";function kt(t){let n=t[mt];return n===!0||n==="true"||n===1}function pn(t,n){return kt(t)?n?"personAsBusiness":"person":"business"}function yn(t,n){return t==="person"?n==="person":n!=="person"}function Rn(t,n){return!t.has(L)||!t.has(H)?[]:n.get(L)?.some(r=>r.name===Q)===!0||n.get(H)?.some(r=>r.name===mt)===!0?[{sourceObject:L,targetObject:H,relationshipName:`${L}Before${H}`,type:"lookup",required:!0}]:[]}function Mt(t){let n=t.map(e=>`'${O(e)}'`).join(", ");return`SELECT Id, ${Q} FROM ${L} WHERE Id IN (${n})`}var At=new RegExp(`^SELECT Id, ${Q} FROM ${L} WHERE Id IN \\((.*)\\)$`);function wn(t){let n=At.exec(t);if(n)return[...n[1].matchAll(/'([^']*)'/g)].map(([,e])=>e)}async function In(t,n){let e=new Map;for(let r=0;r<n.length;r+=S){let o=await t(Mt(n.slice(r,r+S)));for(let i of o){let s=i[Q];typeof i.Id=="string"&&typeof s=="string"&&s!==""&&e.set(i.Id,s)}}return e}var v="OpportunityTeamMember",M="OpportunitySplit",Nt="Opportunity",Z="OpportunitySplitType",$="SplitTypeId",nt={[v]:"UserId",[M]:"SplitOwnerId"};function hn(t){return nt[t]!==void 0}function mn(t){return t==="Task"?"their email":t==="Contact"?"their person account":t===It?"their contact":t===Ot?"their opportunity, for its contact":"their opportunity, for its owner"}var Ot="OpportunityContactRole",Y="ContactId",ft=t=>t.IsPrimary===!0||t.IsPrimary==="true";function Lt(t,n){let e=new Map;return t.forEach((r,o)=>{let i=w(r,"OpportunityId"),s=w(r,Y);if(i===void 0||s===void 0)return;let d=n(i);if(d===void 0||y(d)!==y(s))return;let u=y(i),l=e.get(u);(l===void 0||!ft(t[l])&&ft(r))&&e.set(u,o)}),[...e.values()].sort((r,o)=>r-o)}var lt=["CreatedDate","CreatedById","Opportunity.CreatedDate","Opportunity.CreatedById"];function xt(t,n=[]){let e=["Id","OpportunityId",Y],r=[...e,...lt];return`SELECT ${[...e,...lt,...n.filter(i=>!r.includes(i)).map(C)].join(", ")} FROM ${Ot} WHERE OpportunityId IN ${et(t)} ORDER BY CreatedDate, Id`}var bt=/^SELECT Id, OpportunityId, ContactId, CreatedDate, CreatedById, Opportunity\.CreatedDate, Opportunity\.CreatedById((?:, \w+)*) FROM OpportunityContactRole WHERE OpportunityId IN (\(.*\)) ORDER BY CreatedDate, Id$/;function On(t){let n=bt.exec(t);if(!n)return;let[,e,r]=n;return{fields:e.split(", ").filter(o=>o!==""),opportunities:rt(r)}}async function _t(t,n,e=[]){let r=[];for(let o=0;o<n.length;o+=S)r.push(...await t(xt(n.slice(o,o+S),e)));return r}var Ft=1,gt=t=>typeof t=="string"&&t!==""?Math.floor(Date.parse(t)/1e3):Number.NaN;function Wt(t){let n=t.Opportunity;if(typeof n!="object"||n===null)return!1;let e=n,r=w(t,"CreatedById"),o=w(e,"CreatedById"),i=gt(t.CreatedDate),s=gt(e.CreatedDate);return r!==void 0&&o!==void 0&&y(r)===y(o)&&!Number.isNaN(i)&&!Number.isNaN(s)&&i-s>=0&&i-s<=Ft}function Dt(t,n){let e=new Map;for(let i of n){let s=w(i,"Id"),d=w(i,"OpportunityId"),u=w(i,Y);if(!s||!d||!u||!Wt(i))continue;let l=`${y(d)}:${y(u)}`;e.set(l,[...e.get(l)??[],i])}let r=new Map,o=[];for(let[i,{opportunity:s,contact:d}]of t){let u=e.get(`${y(s)}:${y(d)}`)??[];u.length>1?o.push(i):u.length===1&&r.set(i,u[0])}return{found:r,alike:o}}function Tn(t,n="read"){return`${t} contact role(s) not linked to the one the platform wrote with their opportunity, so written as ${n}: the target holds more than one role of their contact under it made with it, within a second, by the same user, and nothing tells which the platform wrote. The opportunity holds the role of its contact more than once.`}var vt="the user the run writes as";function Sn(t,n){let e={CreatedDate:n,CreatedById:vt};return{...t,...e,Opportunity:{...e}}}async function En(t,n,e,r=[]){let o=Lt(n,e);if(o.length===0)return{found:new Map,alike:[]};let i=new Map(o.map(d=>[d,{opportunity:String(n[d].OpportunityId),contact:String(n[d][Y])}])),s=await _t(t,[...new Set([...i.values()].map(({opportunity:d})=>d))],r);return Dt(i,s)}function $n(t){return!t.has(v)||!t.has(M)?[]:[{sourceObject:v,targetObject:M,relationshipName:`${v}Before${M}`,type:"lookup",required:!0}]}var Ut={[v]:{TeamMemberRole:"Opportunity Owner",OpportunityAccessLevel:"All"},[M]:{}},pt=t=>!/__c$/i.test(t),qt=new Set(["SplitPercentage","SplitAmount","CurrencyIsoCode"]),U=`SELECT Id, OwnerId FROM ${Nt} WHERE Id IN `,Kt=`SELECT Id, DeveloperName, IsTotalValidated FROM ${Z} WHERE IsActive = true`,et=t=>`(${t.map(n=>`'${O(n)}'`).join(", ")})`,rt=t=>[...t.matchAll(/'([^']*)'/g)].map(([,n])=>n);function Cn(t){return`${U}${et(t)}`}function Pn(t){if(!t.startsWith(U))return;let n=t.slice(U.length);return/^\(.*\)$/.test(n)?rt(n):void 0}function Tt(t,n){let e=nt[t];return`SELECT ${["Id","OpportunityId",...t===M?[e,$]:[e],...n].join(", ")} FROM ${t} WHERE OpportunityId IN `}function kn(t,n,e){return`${Tt(t,n)}${et(e)}`}var Ht=/^SELECT Id, OpportunityId, (?:UserId|SplitOwnerId, SplitTypeId)((?:, \w+)*) FROM (OpportunityTeamMember|OpportunitySplit) WHERE OpportunityId IN (\(.*\))$/;function Mn(t){let n=Ht.exec(t);if(!n)return;let[,e,r,o]=n;return{objectApiName:r,fields:e.split(", ").filter(i=>i!==""),opportunities:rt(o)}}var y=t=>t.slice(0,15);async function W(t,n,e){let r=[];for(let o=0;o<e.length;o+=S){let i=e.slice(o,o+S).map(s=>`'${O(s)}'`).join(", ");r.push(...await t(`${n}(${i})`))}return r}function J(t,n){let e=new Map;for(let r of t){let o=r[n];typeof r.Id=="string"&&typeof o=="string"&&o!==""&&e.set(y(r.Id),o)}return e}var w=(t,n)=>{let e=t[n];return typeof e=="string"&&e!==""?e:void 0};async function An(t,n,e){let r={lookups:new Map,linked:new Map,held:new Map,defaulted:new Set},o=nt[t];if(o===void 0)return r;let i=t===M,s=n.filter(a=>{let f=w(a,"OpportunityId");return f!==void 0&&e.targetIdOf(f)!==void 0});if(s.length===0)return r;let d=[...new Set(s.map(a=>String(a.OpportunityId)))],u=J(await W(e.source,U,d),"OwnerId"),l=a=>e.targetIdOf(String(a.OpportunityId)),I=[...new Set(s.map(l))],{simulated:T}=e,x=T?void 0:J(await W(e.target,U,I),"OwnerId"),b=a=>{let f=u.get(y(String(a.OpportunityId)));return f===void 0?{}:{source:f,target:T?T.ownerOf(f):x?.get(y(l(a)))}},_=a=>{let f=w(a,o),R=b(a).source;return f!==void 0&&R!==void 0&&y(f)===y(R)},A=[...new Set(s.flatMap(a=>{let f=w(a,o);return f===void 0||_(a)||e.mappedUser(f)!==void 0?[]:[f]}))],q=A.length>0?new Set((await W(e.target,"SELECT Id FROM User WHERE IsActive = true AND Id IN ",A)).flatMap(a=>typeof a.Id=="string"?[y(a.Id)]:[])):new Set,K=i?J(await W(e.source,`SELECT Id, DeveloperName FROM ${Z} WHERE Id IN `,[...new Set(s.flatMap(a=>w(a,$)??[]))]),"DeveloperName"):new Map,F=new Map;if(i)for(let a of await e.target(Kt))typeof a.Id=="string"&&typeof a.DeveloperName=="string"&&F.set(a.DeveloperName,{id:a.Id,total:a.IsTotalValidated===!0||a.IsTotalValidated==="true"});let c=(e.written??[]).filter(a=>a!=="Id"&&a!=="OpportunityId"&&a!==o&&a!==$&&!qt.has(a)),g=(a,f)=>{let R=a[f];return!(R==null||R===""||R===!1)},p=(a,f,R=c)=>R.filter(P=>g(a,P)&&String(a[P])!==String(f[P]??"")),m=new Map,h=(a,f,R)=>[a,f,R??""].map(y).join("|");if(!T)for(let a of await W(e.target,Tt(t,c),I)){let f=w(a,"OpportunityId"),R=w(a,o);typeof a.Id!="string"||f===void 0||R===void 0||m.set(h(f,R,i?w(a,$):void 0),a)}for(let a of s){let f=w(a,o);if(f===void 0)continue;let R=_(a),P=b(a).target,N=R?P:e.mappedUser(f)??(q.has(y(f))?f:void 0),ot=!R&&N===void 0&&e.defaultUser!==void 0;if(ot&&(N=e.defaultUser),N===void 0){r.held.set(a,{field:o,parentObject:"User",why:R?`${o} names the owner of its opportunity, whose owner in the target could not be read.`:`${o} names a user the target has no counterpart of: a team member and a split go in for the opportunity's owner, which is the owner of its copy in the target, for a user an owner mapping gives, or for a user of the same id the target holds active.`});continue}let G={[o]:N},it=!1;if(i){let E=w(a,$);if(E!==void 0){let k=K.get(y(E)),V=k===void 0?void 0:F.get(k);if(V===void 0){r.held.set(a,{field:$,parentObject:Z,why:`${$} names ${k===void 0?"a split type":`the split type ${k}`}, which the target holds no active one of by that name: sent without it, the split would go in as one of the Revenue type.`});continue}G[$]=V.id,it=V.total}}let St=l(a),st=P!==void 0&&y(N)===y(P);if(T){if(st&&(!i||it)){let E=c.filter(k=>!pt(k)&&g(a,k));r.linked.set(a,{id:T.idFor(),owners:!0,notKept:p(a,Ut[t]??{},c.filter(pt)),...E.length>0?{unread:E}:{}});continue}}else{let E=m.get(h(St,N,G[$]));if(E!==void 0){r.linked.set(a,{id:String(E.Id),owners:st,notKept:p(a,E)});continue}}r.lookups.set(a,G),ot&&r.defaulted.add(a)}return r}var jt={[tt]:"TaskId",[B]:"EventId"};async function Nn(t,n,e){let r=new Map,o=jt[n];if(o===void 0)return r;let i=[...new Set(e.map(d=>d[o]).filter(d=>typeof d=="string"&&d!==""))];if(i.length===0)return r;let s=new Map;for(let d=0;d<i.length;d+=S){let u=i.slice(d,d+S).map(I=>`'${O(I)}'`).join(", "),l=await t(`SELECT Id, ${o}, RelationId FROM ${n} WHERE ${o} IN (${u})`);for(let I of l)typeof I.Id=="string"&&s.set(`${String(I[o])}|${String(I.RelationId)}`,I.Id)}return e.forEach((d,u)=>{let l=s.get(`${String(d[o])}|${String(d.RelationId)}`);l&&r.set(u,l)}),r}var Bt={[B]:["IsInvitee"]},yt={IsInvitee:["Status","Response","RespondedDate"]},Rt="the run was cancelled before it was updated";async function Ln(t,n,e,r,o=()=>!1){return Qt(await Yt(t,n,e,r,o))}function Qt(t){if(!(t===void 0||t.size===0))return[...t].map(([n,e])=>`${e} linked without ${n}`).join(", ")}function xn(t,n){if(n.size===0)return t;let e=new Map(t??[]);for(let[r,o]of n)e.set(r,(e.get(r)??0)+o);return e}async function Yt(t,n,e,r,o=()=>!1){let i=Bt[t]??[],s=new Set(i.flatMap(c=>[c,...yt[c]??[]]).filter(c=>!e(c))),d=new Map,u=(c,g)=>{let p=`${c}: ${g}`;d.set(p,(d.get(p)??0)+1)},l=[];for(let[c,g]of n){let p={},m={};for(let h of i.filter(a=>String(c[a])==="true")){if(s.has(h)){u(h,"the target does not let it be updated");continue}p[h]=!0;for(let a of yt[h]??[]){let f=c[a];f==null||f===""||(s.has(a)?u(a,"the target does not let it be updated"):m[a]=f)}}Object.keys(p).length>0&&l.push({Id:g,flagsGiven:p,answer:m})}let I=!1,T=async c=>{let g=new Map;if(c.length===0)return g;if(o()){for(let h of c)g.set(h.Id,Rt);return g}if(I)return g;let p=await r(c);I=p.length<c.length;let m=o();return c.forEach((h,a)=>{let f=p[a];f?.success||g.set(h.Id,f===void 0&&m?Rt:`the target refused the update, ${f?.errors[0]??"without saying why"}`)}),g},x=(c,g)=>{for(let p of c){let m=g.get(p.Id);if(m!==void 0)for(let h of Object.keys(p).filter(a=>a!=="Id"))u(h,m)}},b=l.map(({Id:c,flagsGiven:g,answer:p})=>({Id:c,...g,...p})),_=await T(b),A=I||o()?[]:l.filter(({Id:c,answer:g})=>_.has(c)&&Object.keys(g).length>0);x(b.filter(c=>!A.some(({Id:g})=>g===c.Id)),_);let q=A.map(({Id:c,flagsGiven:g})=>({Id:c,...g})),K=await T(q);x(q,K);let F=A.filter(({Id:c})=>!K.has(c));for(let c of new Set(F.flatMap(({answer:g})=>Object.keys(g)))){let g=F.filter(({answer:p})=>c in p).map(({Id:p,answer:m})=>({Id:p,[c]:m[c]}));x(g,await T(g))}return d}var bn={Order:"OrderStatus",Contract:"ContractStatus"},_n=new Set(["Contract"]);function Gt(t){return t==null||t===""?"null":typeof t=="number"||typeof t=="boolean"?String(t):`'${O(String(t))}'`}async function Fn(t,n){let e=new Map,r=[...new Set(n.map(i=>i.ContactId).filter(i=>typeof i=="string"&&i!==""))];if(r.length===0)return e;let o=new Map;for(let i=0;i<r.length;i+=j){let s=r.slice(i,i+j).map(u=>`'${O(u)}'`).join(", "),d=await t(`SELECT Id, AccountId, ContactId FROM ${It} WHERE IsDirect = true AND ContactId IN (${s})`);for(let u of d)typeof u.Id=="string"&&o.set(`${String(u.AccountId)}|${String(u.ContactId)}`,u.Id)}return n.forEach((i,s)=>{let d=o.get(`${String(i.AccountId)}|${String(i.ContactId)}`);d&&e.set(s,d)}),e}async function Wn(t,n){let e=new Set;for(let r=0;r<n.length;r+=j){let o=n.slice(r,r+j).map(s=>`'${O(s)}'`).join(", "),i=await t(`SELECT Id FROM PricebookEntry WHERE Id IN (${o}) AND Pricebook2.IsStandard = true`);for(let s of i)typeof s.Id=="string"&&e.add(s.Id)}return e}var wt=200;async function Dn(t,n){let e=new Map,r=[...new Set(n.map(i=>i.Product2Id).filter(i=>typeof i=="string"&&i!==""))];if(r.length===0)return e;let o=new Map;for(let i=0;i<r.length;i+=wt){let s=r.slice(i,i+wt).map(u=>`'${O(u)}'`).join(", "),d=await t(`SELECT Id, Product2Id, ProductSellingModelId FROM ${at} WHERE Product2Id IN (${s})`);for(let u of d)typeof u.Id=="string"&&o.set(`${String(u.Product2Id)}|${String(u.ProductSellingModelId)}`,u.Id)}return n.forEach((i,s)=>{let d=o.get(`${String(i.Product2Id)}|${String(i.ProductSellingModelId)}`);d&&e.set(s,d)}),e}async function vn(t,n,e,r){let o=new Map;for(let i of r){let s=JSON.stringify(e.map(l=>i[l]??null));if(o.has(s))continue;let d=e.map(l=>`${C(l)} = ${Gt(i[l])}`).join(" AND "),u=await t(`SELECT Id FROM ${C(n)} WHERE ${d} LIMIT 2`);o.set(s,u.length===1&&typeof u[0].Id=="string"?u[0].Id:void 0)}return r.map(i=>o.get(JSON.stringify(e.map(s=>i[s]??null))))}async function Un(t,n){let e;try{e=await t(`SELECT ApiName, StatusCode FROM ${C(n)}`)}catch{return}return{categoryOf:new Map(e.map(r=>[String(r.ApiName),String(r.StatusCode)])),draft:e.filter(r=>r.StatusCode==="Draft").map(r=>String(r.ApiName)).sort()[0]}}function qn(t,n){if(typeof t!="string"||t===""||!n.draft)return;let e=n.categoryOf.get(t);if(!(e===void 0||e==="Draft"))return n.draft}export{It as a,D as b,z as c,en as d,rn as e,ut as f,on as g,sn as h,an as i,dn as j,un as k,ht as l,cn as m,fn as n,ln as o,gn as p,L as q,H as r,Q as s,kt as t,pn as u,yn as v,Rn as w,Mt as x,wn as y,In as z,v as A,M as B,nt as C,hn as D,mn as E,Ot as F,Y as G,ft as H,Lt as I,xt as J,On as K,_t as L,Dt as M,Tn as N,Sn as O,En as P,$n as Q,Ut as R,Kt as S,Cn as T,Pn as U,kn as V,Mn as W,An as X,jt as Y,Nn as Z,Bt as _,Ln as $,Qt as aa,xn as ba,Yt as ca,bn as da,_n as ea,Fn as fa,Wn as ga,Dn as ha,vn as ia,Un as ja,qn as ka};
@@ -1,7 +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{a,b}from"./chunk-BPHTA6KP.mjs";import"./chunk-U2CTKIPE.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as grantsByObject,b as guardCheckpoint};
@@ -1,7 +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{a as je,b as Ne,c as Pe,d as Fe,k as We,l as xe,o as Le,q as _e}from"./chunk-BH76USTQ.mjs";import{e as Me}from"./chunk-XKFHTBAB.mjs";import{b as De,f as Te}from"./chunk-FYWNSMOZ.mjs";import{m as Be}from"./chunk-WBELLGNE.mjs";import{b as ve}from"./chunk-BPHTA6KP.mjs";import{i as he,j as we,k as ke,l as ye,m as be,p as Re,q as Ae}from"./chunk-4X5D3MSV.mjs";import{A as Ie,B as $e,y as Se,z as Ue}from"./chunk-XMQ5R6TC.mjs";import{B as ge}from"./chunk-IXIY6Q4M.mjs";import{a as le,b as fe}from"./chunk-54HYHHVL.mjs";import{i as Oe,j as Ce}from"./chunk-EOQON3E5.mjs";import{b as pe}from"./chunk-7WSQ65WG.mjs";import{b as ue,d as ce}from"./chunk-MJD6CPZZ.mjs";import{c as me}from"./chunk-WXU6ZJIV.mjs";import{$b as Ee}from"./chunk-R3OM3X4L.mjs";import{g as L,h as _,q as de}from"./chunk-Z3MGN42K.mjs";import{b as x}from"./chunk-CA5NAXSU.mjs";import{Nd as se,Vd as W}from"./chunk-6QSHWIZI.mjs";var C=class extends Error{constructor(){super("The undo was stopped before it wrote anything to the org."),this.name="UndoStopped"}},z="No record was written.",Je="accept that it runs to undo the rewind all the same";function ze(e){return e.slice(0,15)}function Ke(e){return{query:n=>e.query(n),queryMore:n=>e.queryMore(n)}}function Ye(e,n,t){if(e.kind==="org")return;let a=e.userKey;if(n.users.some(i=>i.slice(0,15)!==a))return{code:"PERMISSIONS",message:`This rewind was made as another user than ${t}: what it deleted is that user's deletion in the recycle bin, which Salesforce brings back only for a user with View All Data and Modify All Data. Undo it as the user it was made as, or as a user with View All Data and Modify All Data. ${z}`};let r=n.objects.flatMap(i=>{let l=e.notHeld.get(i);return l===void 0?[]:[`${i}: ${l}`]});if(r.length!==0)return{code:"PERMISSIONS",message:`Undo takes back what the rewind did to objects ${t} no longer holds whole (${r.join("; ")}), and does not stop part way: an undo left part way could not be offered again. Undo it once the user has View All and Modify All on them again, or as a user with View All Data and Modify All Data. ${z}`}}function Qe(e,n){return{undone:!1,refusal:{code:e,message:n}}}function Xe(e,n){return{code:"RUN_WRITING",message:`${n.operation==="take"?`A checkpoint of ${e} is being taken`:n.operation==="rewind"?`A rewind is writing to ${e}`:n.operation==="undo"?`An undo is writing to ${e}`:`SandForge is deleting checkpoints of ${e}`} (process ${n.pid} on ${n.host}): undo the rewind once it has ended. No record was read or written.`}}function Ze(e,n,t,a){let r=W(n,t),i=[...new Set(r.map(b=>b.objectApiName))],l=(t.setToDraft??[]).length>0?", sets an order back to Draft":"",h=r.length>0?`${Me(r)} flow(s), trigger(s) or rule(s) of ${i.join(", ")} run as the undo brings records back, gives them their values back${l} or sends them back to the recycle bin`:"what runs as the undo writes could not all be read, so automation may run";return{code:"AUTOMATION",message:`${e}: ${h}. ${ke("undo",a)}Undo refused; ${Je}. ${z}`}}async function et(e,n){let t=0,a=0;for await(let r of n.bringBack.pages(L)){t+=r.length;for(let i of ce(r,ue)){let l=await e.queryDeleted(`SELECT Id, ContentSize FROM ${L} WHERE Id IN (${i}) AND IsDeleted = true`);for(let h of l.records)typeof h.ContentSize=="number"&&(a+=h.ContentSize)}}return{files:t,bytes:a}}function tt(e,n){return e.status==="cancelled"||e.status==="failure"?e.status:n.some(t=>t.reason==="changedDuringRewind")?"unstable":e.status}function nt(e,n){return e.map(t=>{let a=Object.keys(t.by).filter(i=>!n.has(ze(i)));if(a.length===0)return{objectApiName:t.objectApiName,reason:"automation",count:t.count,ids:[...t.ids]};let r=a.length===1&&a[0]!=="unknown"?a[0]:void 0;return{objectApiName:t.objectApiName,reason:"changedDuringRewind",...r!==void 0?{by:r}:{},count:t.count,ids:[...t.ids]}})}async function Ot(e,n){let{checkpoint:t,folder:a,orgName:r,rewindId:i}=n,l=e.signal,h=()=>l?.aborted===!0,b=(U,k)=>e.onProgress?.({percentage:U,step:k}),c=_e(e.org,e.undelete),T,S=await ve(Ke(c.org),{act:"undo",orgName:r,registered:n.registered,username:n.username,organizationId:t.org.organizationId,customSettings:de(t)},{userId:async()=>T=await c.org.userId()});if(!S.allowed)return{undone:!1,refusal:S.refusal};let R=e.store.lock(t.org.organizationId,"undo",t.checkpointId);if("busy"in R)return{undone:!1,refusal:Xe(r,R.busy)};try{let U=await e.runWriting?.(S.org.id);if(U!==void 0)return Qe("RUN_WRITING",U);let k=await Ue(c.org,r);if(h())throw new C;b(5,"Reading what the rewind did");let g=await Ne(a,i,t.objects),G=Pe(g),M=g.goesWithParent.objects,Ge=g.remade.keys.size>0?"Sending back to the recycle bin what the rewind brought back, and deleting again what it made again":"Sending back to the recycle bin what the rewind brought back",A=o=>o.filter(u=>u.count>0).map(u=>u.objectApiName),j=g.links,q=o=>o>0?[_]:[],N=g.remade.objects.filter(({objectApiName:o,count:u})=>u>0&&ge([o]).length>0),m={bringBack:A(g.bringBack.objects),giveBack:[...A(g.giveBack.objects),...q(j?.share.count??0)],...N.length>0?{setToDraft:A(N)}:{},delete:[...new Set([...A(M),...A(g.remove.objects),...q(j?.remove.count??0)])],...(j?.reinsert.count??0)>0?{recreate:[_]}:{}},H;try{H=await et(c.org,g)}finally{await g.dispose()}let V=$e("undo",H,k.fileStorage?.remaining,r);if(V)return{undone:!1,refusal:V};let w=[...new Set([...m.bringBack??[],...m.giveBack??[],...m.setToDraft??[],...m.delete??[],...m.recreate??[]])],P;try{P=await De({grants:S.grants,...T!==void 0?{userId:T}:{},username:n.username,checkpoint:t,reader:Ce(c.org,l)})}catch(o){throw o instanceof Oe||h()?new C:o}if(P.kind==="perObject"){let o=await je(a,i),u=Ye(P,{users:o.passes.map(f=>f.userId),objects:w},n.username);if(u)return{undone:!1,refusal:u}}let d;if(w.length>0&&e.readAutomation){try{d=await e.readAutomation(w)}catch(o){d=Le(w,x(o))}c.add(d.requests)}let I=d,y=w.length>0?await We(e.mute,d,m):{},$="refusal"in y?y:void 0,J="refusal"in y?void 0:y.mute;y.automation&&(d=y.automation);let v=$?$.plan:J?.plan,K=n.acceptEmails===!0,p=w.length>0&&I?await Re({act:"undo",orgName:r,automation:I,steps:m,...v?{plan:v}:{},accepted:K,mayMute:e.mute===void 0&&n.canMute===!0,read:()=>me(c.org)}):void 0,Y=he(G,M,N),Q=d?we(Y,d):void 0,O=$?[$.refusal]:[];d&&!n.acceptAutomation&&(W(d,m).length>0||se(d.unread)||Q!==void 0)&&O.push(Ze(r,d,m,Q));let X=Se({objects:t.objects,rewound:G,along:M,automationRequests:0}),Z=Ee(p?.ofRun),ee=Ie("undo",{run:c.used()-(Z.deliverability??0)+X.apiRequests,...Z},k,r);w.length>0&&ee&&O.push(ee);let te=d?be("undo",ye(Y,d,k.emails),r):void 0;w.length>0&&te&&O.push(te),p?.refusal&&O.push(p.refusal);let[ne,...oe]=O;if(ne)return{undone:!1,refusal:ne,...oe.length>0?{alsoRefused:oe}:{}};if(h())throw new C;let qe=await c.org.userId(),He=new Set(Te(t.takenBy,qe).map(ze));b(20,"Bringing back what the rewind deleted and giving back what it wrote over");let B,E;try{E=await xe(J,`undo ${t.checkpointId} ${i}`,o=>{let u=o&&v&&I&&p?Ae({act:"undo",orgName:r,automation:I,steps:m,plan:v,held:o.outcome,planned:p.ofRun.senders,...p.ofRun.read?{reading:p.ofRun.read.reading}:{},accepted:K}):void 0;return u?Promise.resolve({relit:u}):Fe({folder:a,rewindId:i,lock:R.lock,objects:t.objects,org:c.org,undelete:c.undelete,splitting:le(fe(k.remaining,c.used()+X.apiRequests)),...l?{signal:l}:{},...e.onUndeletable?{onUndeletable:e.onUndeletable}:{},onProgress:(f,ae,Ve)=>b(20+Math.round(70*f/Math.max(ae,1)),`${Ge}: ${Ve} ${f} / ${ae}`)})},o=>{B=o})}catch(o){if(!pe(o))throw o;return{undone:!1,refusal:{code:"MUTE",message:`${o.message} No record was written.`}}}if("relit"in E)return{undone:!1,refusal:E.relit};let s=E,re=nt(s.residual,He),D=tt(s,re),F=[...s.notes];if(D!=="cancelled"&&D!=="failure"){let o=(e.now??(()=>new Date))().toISOString();try{await e.store.update(t.checkpointId,f=>f.lastRewind?.rewindId===i?{...f,lastRewind:{...f.lastRewind,undoneAt:o}}:f)}catch(f){F.push(`The checkpoint could not be told the rewind was undone (${x(f)}): its list may still offer to undo it.`)}let u=await Be({folder:a,lock:R.lock,checkpoint:t,rewindId:i,status:D,undoneAt:o});u!==void 0&&F.push(u)}let ie=c.used();return{undone:!0,result:{checkpointId:t.checkpointId,rewindId:i,status:D,deleted:s.deleted,...s.remade?{remade:s.remade}:{},...s.carriedAlone?{carriedAlone:s.carriedAlone}:{},...s.wentAlong?{wentAlong:s.wentAlong}:{},restored:s.restored,undeleted:s.undeleted,...s.files?{files:s.files}:{},residual:re,passes:1,apiRequests:{used:ie,leftToday:Math.max(0,k.remaining-ie)},finishedAt:s.finishedAt,...B?{mutedAutomation:B}:{}},notes:F,...p?.gate.audit!==void 0?{deliverability:p.gate.audit}:{}}}finally{R.lock.release()}}export{C as a,Je as b,Ot as c};
@@ -1,7 +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{a as d}from"./chunk-PPGDAUEQ.mjs";import{a as c}from"./chunk-SU65Z2BA.mjs";import{Wc as a,Yc as u}from"./chunk-6QSHWIZI.mjs";async function I(t){let e=(await t.query("SELECT Id, IsSandbox FROM Organization LIMIT 1")).records[0];if(typeof e?.Id!="string")throw new Error("The org gave no Organization record: whether it is a sandbox cannot be told.");if(e.IsSandbox===!0)return{id:e.Id,sandbox:!0};try{let r=(await t.query("SELECT OrganizationType FROM Organization LIMIT 1")).records[0]?.OrganizationType;return typeof r=="string"&&r!==""?{id:e.Id,sandbox:!1,edition:r}:{id:e.Id,sandbox:!1}}catch{return{id:e.Id,sandbox:!1}}}function h(t){let n=a({isSandbox:t.sandbox,edition:t.edition});return u(n,t.edition)==="production"}function p(t){let{errorCode:n,statusCode:e}=typeof t=="object"&&t!==null?t:{},o=t instanceof Error?t.message:String(t);return e===403||typeof n=="string"&&/^INSUFFICIENT_ACCESS/.test(n)||/\bINSUFFICIENT_ACCESS/.test(o)||(n==="INVALID_TYPE"||/\bINVALID_TYPE\b/.test(o))&&/\bOrganization\b/.test(o)}function l(t){if(d(t))return"auth";if(c(t))return"network";if(p(t))return"organizationRefused"}function O(t,n,e){let o=n instanceof Error?n.message:String(n);switch(e){case"auth":return`${t} refused the session SandForge holds for it (${o}): reconnect it \u2014 Reconnect on the Organizations page, or "sf org login web --alias ${t}" for a command line \u2014 then try again.`;case"network":return`${t} did not answer (${o}): try again once it answers.`;case"organizationRefused":return`${t} would not show its Organization record (${o}): reading it takes the View Setup and Configuration permission, which the user SandForge connects as lacks: give it to them, or connect as a user who has it.`}}var g=/\/services\/Soap\//,f=/\/services\/data\/v\d+\.\d+\/jobs\/(?:ingest|query)(?:[/?]|$)/,y=/^\/jobs\/(?:ingest|query)(?:[/?]|$)/;function b(t){let n=typeof t=="string"?t:t?.url??"";return f.test(n)||y.test(n)}function S(t){let n=0;if(typeof t.request!="function")return()=>n;let e=t._transport,o=t.request.bind(t);if(t.request=(...r)=>((e===void 0||!b(r[0]))&&n++,o(...r)),e!==void 0){let r=e.httpRequest.bind(e);e.httpRequest=(...i)=>{let s=i[0].url;return(g.test(s)||f.test(s))&&n++,r(...i)}}return()=>n}export{I as a,h as b,p as c,l as d,O as e,S as f};
@@ -1,8 +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{closeSync as D,fstatSync as J,openSync as W,readSync as $,writeSync as G}from"node:fs";function at(a){let e=W(a,"a+"),t=J(e).size;return{size:()=>t,append:n=>{let i=Buffer.from(n,"utf8"),r=0;for(;r<i.length;)r+=G(e,i,r);t+=i.length},read:(n,i)=>{let r=Buffer.alloc(i),s=0;for(;s<i;){let o=$(e,r,s,i-s,n+s);if(o===0)break;s+=o}return r.subarray(0,s)},close:()=>D(e)}}function j(a,e){return e===void 0?a:`${a}/${e}`}var E=/^[A-Za-z][A-Za-z0-9]*$/,T=/^[0-9a-f]{64}$/,K=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function M(a){if(typeof a!="object"||a===null)return;let{objectApiName:e,ids:t,sha256:n,readAt:i,query:r}=a;if(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_]{0,79}$/.test(e)||!Array.isArray(t)||!t.every(o=>typeof o=="string"&&K.test(o))||typeof n!="string"||!T.test(n)||typeof i!="string"||!Number.isFinite(Date.parse(i)))return;let s;if(typeof r=="object"&&r!==null){let{where:o,orderBy:c,limit:u}=r;s={...typeof o=="string"?{where:o}:{},...typeof c=="string"?{orderBy:c}:{},...typeof u=="number"&&Number.isInteger(u)?{limit:u}:{}}}return{objectApiName:e,ids:t,sha256:n,readAt:i,...s?{query:s}:{}}}var y=1,k=2,v=3,S=4,H={created:y,existing:k,updated:v},P={[y]:"created",[k]:"existing",[v]:"updated"},_={[y]:"c",[k]:"e",[v]:"u",[S]:"i"},N={c:y,e:k,u:v,i:S},Y="x",Z="a",q="j",z="d",R="n",O="t",U="found",V="found-owed";function dt(a,e,t,n){return JSON.stringify([z,a,e,t,n])}function ct(a){if(!a.startsWith(`["${z}"`))return;let e;try{e=JSON.parse(a)}catch{return}if(!Array.isArray(e))return;let[,,,t,n]=e;if(!(typeof t!="string"||!Number.isFinite(Date.parse(t)))&&!(typeof n!="string"||!Number.isFinite(Date.parse(n))))return{orgAt:t,at:n}}function Q(a,e=!1){return JSON.stringify([e?"w":"o",a.objectApiName,a.newId,a.sourceId??"",a.fieldName,a.sourceRefId,a.insertOnly?1:0])}var X=1024*1024,tt=1024*1024,et=2e4,nt=2e4,it=.6,rt=3;function l(a){let e=2166136261;for(let t=0;t<a.length;t++)e^=a.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function p(a){let e=2538058380;for(let t=0;t<a.length;t++)e=Math.imul(e^a.charCodeAt(t),1540483477),e^=e>>>15;return e>>>0}var x=class{constructor(e){this.keyAt=e}keyAt;capacity=1024;used=0;h1=new Uint32Array(this.capacity);h2=new Uint32Array(this.capacity);at=new Float64Array(this.capacity);len=new Uint16Array(this.capacity);code=new Uint8Array(this.capacity);get size(){return this.used}get slots(){return this.capacity}find(e,t,n,i){let r=this.capacity-1,s=n&r;for(;;){let o=this.at[s];if(o===0)return~s;if(this.h1[s]===t&&this.h2[s]===n&&(i===o-1||this.keyAt(o-1,this.len[s])===e))return s;s=s+1&r}}offsetOf(e){return this.at[e]-1}lengthOf(e){return this.len[e]}codeOf(e){return this.code[e]}put(e,t,n,i,r,s){let o=e;e<0&&(this.used+1>this.capacity*it?(this.grow(),o=this.freeSlotFor(n)):o=~e,this.used++,this.h1[o]=t,this.h2[o]=n),this.at[o]=i+1,this.len[o]=r,this.code[o]=s}freeSlotFor(e){let t=this.capacity-1,n=e&t;for(;this.at[n]!==0;)n=n+1&t;return n}grow(){let{h1:e,h2:t,at:n,len:i,code:r}=this;this.capacity*=2,this.h1=new Uint32Array(this.capacity),this.h2=new Uint32Array(this.capacity),this.at=new Float64Array(this.capacity),this.len=new Uint16Array(this.capacity),this.code=new Uint8Array(this.capacity);for(let s=0;s<n.length;s++){if(n[s]===0)continue;let o=this.freeSlotFor(t[s]);this.h1[o]=e[s],this.h2[o]=t[s],this.at[o]=n[s],this.len[o]=i[s],this.code[o]=r[s]}}};function F(a){return a?a[0]==="p"&&a.length>=3?B(String(a[1]),String(a[2])):a[0]==="g"&&a.length>=3?C(String(a[2])):a[0]===O&&a.length>=2?I(String(a[1])):"":""}function I(a){return`t\0${a}`}function B(a,e){return`p\0${a}\0${e}`}function C(a){return`g\0${a}`}function*st(a){let e=a.size(),t=0,n=Buffer.alloc(0),i=0;for(;t<e;){let r=a.read(t,Math.min(tt,e-t));if(r.length===0)break;t+=r.length;let s=n.length>0?Buffer.concat([n,r]):r,o=0;for(;;){let c=s.indexOf(10,o);if(c<0)break;c>o&&(yield{offset:i+o,length:c-o,text:s.toString("utf8",o,c)}),o=c+1}n=s.subarray(o),i+=o}}var L=class a{constructor(e){this.file=e;this.index=new x((t,n)=>this.idOfLine(t,n)),this.marks=new x((t,n)=>F(m(this.lineAt(t,n)))),this.createdTargets=new x((t,n)=>{let i=m(this.lineAt(t,n));return i?A(String(i[2]??"")):""})}file;index;cache=new Map;pending=[];pendingBytes=0;flushQueued=!1;partStart=Number.POSITIVE_INFINITY;parts=0;mappedCount=0;counts=new Map;earlierByObject=new Map;earlierPastCheckpoint=new Map;checkpointsByObject=new Map;owedCount=0;statuses=new Map;given=new Map;marks;createdTargets;createdUnattributedKeys=new Set;readsHeld=[];withTheirRecordMarked=0;callsSent=0;foundAfterStop=new Set;foundOwingUntold=new Set;plan;rootsNamed;static open(e){let t=new a(e);return t.readWhatIsThere(),t}get partCount(){return this.parts}get resumes(){return this.checkpointsByObject.size>0||this.earlierByObject.size>0||this.owedCount>0}get earlierMapped(){return this.partStart===Number.POSITIVE_INFINITY?this.mappedCount:this.mappedBeforePart}mappedBeforePart=0;beginPart(e){this.flush(),this.mappedBeforePart=this.mappedCount,this.withTheirRecordMarked=0,this.partStart=this.file.size(),this.write({part:{n:this.parts,startedAt:e.toISOString()}}),this.parts++,this.flush()}nameSamplePlan(e){if(!T.test(e.sha256))throw new Error("Not the SHA-256 of a plan.");this.write({sample:{dir:e.dir,sha256:e.sha256}}),this.plan={dir:e.dir,sha256:e.sha256},this.flush()}get samplePlan(){return this.plan?{...this.plan}:void 0}nameRoots(e){let t=M(e);if(!t)throw new Error("Not the roots of a clone from records.");this.write({roots:t}),this.rootsNamed=t,this.flush()}get roots(){return this.rootsNamed?{...this.rootsNamed,ids:[...this.rootsNamed.ids]}:void 0}setMapping(e,t,n,i){let r=H[e],s=l(t),o=p(t),c=this.cache.get(t),u=this.index.find(t,s,o,c?.at),g=u>=0&&this.index.codeOf(u)!==S;g&&this.uncount(t,u,c);let d=JSON.stringify([_[r],t,n,i??""]),f=this.write(d);if(this.index.put(u,s,o,f,Buffer.byteLength(d),r),r===y&&this.indexCreated(n,f,Buffer.byteLength(d)),g||this.mappedCount++,i){let h=this.countsOf(i);r===y?h.created++:r===k?h.linked++:h.updated++}this.remember(t,{at:f,code:r,targetId:n,objectApiName:i??""})}uncount(e,t,n){let i=this.index.offsetOf(t);if(i<this.partStart)return;let r=this.index.codeOf(t),s=n?.at===i?n:this.recordAt(e,t),o=s?.objectApiName?this.counts.get(s.objectApiName):void 0;o&&(r===y?o.created--:r===k?o.linked--:o.updated--)}countsOf(e){let t=this.counts.get(e);return t||(t={created:0,linked:0,updated:0},this.counts.set(e,t)),t}mapping(e){let t=this.lookUp(e);if(!(!t||t.code===S))return{kind:P[t.code],sourceId:e,targetId:t.targetId,...t.objectApiName?{objectApiName:t.objectApiName}:{},earlier:t.at<this.partStart}}createdTarget(e){let t=A(e);if(this.createdUnattributedKeys.has(t))return!0;if(this.createdTargets.size===0)return!1;let n=this.createdTargets.find(t,l(t),p(t));if(n<0)return!1;let i=this.createdTargets.offsetOf(n),r=m(this.lineAt(i,this.createdTargets.lengthOf(n)));if(!r)return!1;let s=String(r[1]),o=this.index.find(s,l(s),p(s));return o>=0&&this.index.offsetOf(o)===i&&this.index.codeOf(o)===y}indexCreated(e,t,n){let i=A(e);if(!i)return;let r=l(i),s=p(i);this.createdTargets.put(this.createdTargets.find(i,r,s),r,s,t,n,y)}targetOf(e){let t=this.lookUp(e);return t&&t.code!==S?t.targetId:void 0}get mappedSize(){return this.mappedCount}countsByObject(){let e=[];for(let[t,{created:n,linked:i,updated:r}]of this.counts)n+i+r!==0&&e.push(r>0?{objectApiName:t,created:n,linked:i,updated:r}:{objectApiName:t,created:n,linked:i});return e}linkedToCreatedCount(){let e=0;for(let d of this.counts.values())e+=d.linked;if(e===0)return 0;let t=this.partStart===Number.POSITIVE_INFINITY?0:this.partStart,n=(d,f)=>{let h=m(this.lineAt(d,f));return h?String(h[2]).slice(0,15):""},i=(d,f)=>{if(d.offset<t)return;let h=N[String(f[0])];if(h===void 0||h===S||!f[3])return;let b=String(f[1]),w=this.index.find(b,l(b),p(b),d.offset);return w>=0&&this.index.offsetOf(w)===d.offset?h:void 0},r=(d,f,h)=>{let b=l(f),w=p(f);d.put(d.find(f,b,w),b,w,h.offset,h.length,0)},s=(d,f)=>d.size>0&&d.find(f,l(f),p(f))>=0,o=new x(n);for(let d of this.lines()){if(!d.text.startsWith('["'))continue;let f=m(d.text);!f||i(d,f)!==k||this.markedWithTheirRecord(String(f[1]))||r(o,String(f[2]).slice(0,15),d)}if(o.size===0)return 0;let c=new x(n),u=new Set;for(let d of this.lines()){if(!d.text.startsWith('["')||d.offset<t)continue;let f=m(d.text);if(!f)continue;if(f[0]===R&&Array.isArray(f[2])){for(let b of f[2]){let w=String(b).slice(0,15);s(o,w)&&u.add(w)}continue}if(i(d,f)!==y)continue;let h=String(f[2]).slice(0,15);s(o,h)&&r(c,h,d)}if(c.size===0&&u.size===0)return 0;let g=0;for(let d of this.lines()){if(!d.text.startsWith('["'))continue;let f=m(d.text);if(!f||i(d,f)!==k||this.markedWithTheirRecord(String(f[1])))continue;let h=String(f[2]).slice(0,15);(s(c,h)||u.has(h))&&g++}return g}earlierRecordsOf(e,t=!1){return(t?this.earlierPastCheckpoint:this.earlierByObject).get(e)??0}*mappings(){for(let e of this.lines()){if(!e.text.startsWith('["'))continue;let t=m(e.text);if(!t)continue;let n=N[String(t[0])];if(n===void 0||n===S)continue;let i=String(t[1]),r=this.index.find(i,l(i),p(i),e.offset);if(r<0||this.index.offsetOf(r)!==e.offset)continue;let s=String(t[3]??"");yield{kind:P[n],sourceId:i,targetId:String(t[2]),...s?{objectApiName:s}:{},earlier:e.offset<this.partStart}}}noteRead(e){this.readsHeld.push(e),this.readsHeld.length>=nt&&this.settleReads()}settleReads(){let e=this.readsHeld;this.readsHeld=[];for(let t of e){let n=l(t),i=p(t),r=this.index.find(t,n,i,this.cache.get(t)?.at);if(r>=0)continue;let s=JSON.stringify([_[S],t]),o=this.write(s);this.index.put(r,n,i,o,Buffer.byteLength(s),S)}}wasRead(e){return this.readsHeld.includes(e)?!0:this.index.find(e,l(e),p(e),this.cache.get(e)?.at)>=0}checkpoint(e,t,n){if(n!==void 0&&!E.test(n))throw new Error(`Not the name of a pass: ${JSON.stringify(n.slice(0,40))}`);this.settleReads(),this.write({at:{object:e,...n!==void 0?{pass:n}:{},...t}}),this.checkpointsByObject.set(j(e,n),{...t}),this.flush()}checkpoints(){return new Map(this.checkpointsByObject)}owe(e,t=!1){this.owedCount++,this.write(Q(e,t))}get owed(){return this.owedCount}*owedPages(e){let t=[];for(let n of this.lines()){if(!n.text.startsWith('["o"')&&!n.text.startsWith('["w"'))continue;let i=m(n.text);if(!i||i.length<7)continue;let[r,s,o,c,u,g,d]=i;t.push({update:{objectApiName:String(s),newId:String(o),sourceId:c?String(c):void 0,fieldName:String(u),sourceRefId:String(g),...d===1?{insertOnly:!0}:{}},toRowWrittenBefore:r==="w"}),t.length>=e&&(yield t,t=[])}t.length>0&&(yield t)}patched(e,t){this.mark(JSON.stringify(["p",e,t]),B(e,t))}wasPatched(e,t){return this.hasMark(B(e,t))}mark(e,t){let n=l(t),i=p(t),r=this.marks.find(t,n,i),s=this.write(e);this.marks.put(r,n,i,s,Buffer.byteLength(e),0)}hasMark(e){return this.marks.size>0&&this.marks.find(e,l(e),p(e))>=0}owedLeftByEarlierParts(){let e=new Set;for(let n of this.lines()){if(n.offset>=this.partStart)break;if(!n.text.startsWith('["p"'))continue;let i=m(n.text);i&&i.length>=3&&e.add(`${String(i[1])}\0${String(i[2])}`)}let t=[];for(let n of this.lines()){if(n.offset>=this.partStart)break;if(!n.text.startsWith('["o"'))continue;let i=m(n.text);if(!i||i.length<7)continue;let[,r,s,o,c,u,g]=i;e.has(`${String(s)}\0${String(c)}`)||t.push({objectApiName:String(r),newId:String(s),sourceId:o?String(o):void 0,fieldName:String(c),sourceRefId:String(u),...g===1?{insertOnly:!0}:{}})}return t}oweStatus(e,t,n){this.write(JSON.stringify(["s",e,t,n])),this.tallyStatus({objectApiName:e,id:t,status:n})}tallyStatus(e){let t=this.statuses.get(e.objectApiName);t||(t={count:0,samples:[]},this.statuses.set(e.objectApiName,t)),t.count++,t.samples.length<rt&&t.samples.push(e)}gaveStatus(e,t){this.statusGiven(t)||(this.mark(JSON.stringify(["g",e,t]),C(t)),this.given.set(e,(this.given.get(e)??0)+1))}statusGiven(e){return this.hasMark(C(e))}statusesOwed(){let e=new Map;for(let[t,n]of this.statuses){let i=n.count-(this.given.get(t)??0);i<=0||e.set(t,{count:i,samples:n.samples.filter(({id:r})=>!this.statusGiven(r))})}return e}*statusLines(){for(let e of this.lines()){if(!e.text.startsWith('["s"'))continue;let t=m(e.text);!t||t.length<4||(yield{objectApiName:String(t[1]),id:String(t[2]),status:String(t[3])})}}withTheirRecord(e){let t=I(e),n=l(t),i=p(t),r=this.marks.find(t,n,i),s=this.partStart===Number.POSITIVE_INFINITY?0:this.partStart;if(r>=0&&this.marks.offsetOf(r)>=s)return;let o=JSON.stringify([O,e]),c=this.write(o);this.marks.put(r,n,i,c,Buffer.byteLength(o),0),this.withTheirRecordMarked++}get withTheirRecordCount(){return this.withTheirRecordMarked}markedWithTheirRecord(e){if(this.withTheirRecordMarked===0)return!1;let t=I(e),n=this.marks.find(t,l(t),p(t)),i=this.partStart===Number.POSITIVE_INFINITY?0:this.partStart;return n>=0&&this.marks.offsetOf(n)>=i}*withTheirRecordIds(){if(this.withTheirRecordMarked!==0)for(let e of this.lines()){if(e.offset<this.partStart||!e.text.startsWith(`["${O}"`))continue;let t=m(e.text);t&&t.length>=2&&(yield String(t[1]))}}sent(e,t,n,i=new Date,r){this.callsSent++;let s=`${Math.max(0,this.parts-1)}.${this.callsSent}`;return this.write(JSON.stringify([Y,s,e,i.toISOString(),t,n.map(({sourceId:o,fingerprint:c,externalKey:u,jobKey:g})=>r!==void 0&&u!==void 0?[o,c,u]:g!==void 0?[o,c,"",g]:[o,c]),n.flatMap(({owes:o},c)=>(o??[]).map(({field:u,sourceRefId:g,insertOnly:d})=>[c,u,g,d?1:0])),...r!==void 0?[r]:[]])),this.flush(),s}answered(e){this.write(JSON.stringify([Z,e]))}jobOpened(e,t){this.write(JSON.stringify([q,e,t])),this.flush()}createdUnattributed(e,t){if(t.length!==0){this.write(JSON.stringify([R,e,[...t]]));for(let n of t)this.createdUnattributedKeys.add(A(n))}}wasFoundAfterStop(e){return this.foundAfterStop.has(e)}owesUntold(e){return this.foundOwingUntold.has(e)}flush(){if(this.pending.length===0)return;let e=this.pending.join("");this.pending=[],this.pendingBytes=0,this.file.append(e)}close(){this.settleReads(),this.flush(),this.file.close()}write(e){let t=typeof e=="string"?e:JSON.stringify(e),n=this.file.size()+this.pendingBytes,i=`${t}
8
- `;return this.pending.push(i),this.pendingBytes+=Buffer.byteLength(i),this.pendingBytes>=X?this.flush():this.flushQueued||(this.flushQueued=!0,queueMicrotask(()=>{this.flushQueued=!1,this.flush()})),n}lineAt(e,t){return e+t>this.file.size()&&this.flush(),this.file.read(e,t).toString("utf8")}idOfLine(e,t){let n=m(this.lineAt(e,t));return n?String(n[1]):""}lookUp(e){let t=this.cache.get(e);if(t)return this.cache.delete(e),this.cache.set(e,t),t;let n=this.index.find(e,l(e),p(e));if(n<0)return;let i=this.recordAt(e,n);return i&&this.remember(e,i),i}recordAt(e,t){let n=this.index.offsetOf(t),i=m(this.lineAt(n,this.index.lengthOf(t)));if(!(!i||String(i[1])!==e))return{at:n,code:this.index.codeOf(t),targetId:String(i[2]??""),objectApiName:String(i[3]??"")}}remember(e,t){if(this.cache.delete(e),this.cache.set(e,t),this.cache.size>et){let n=this.cache.keys().next().value;n!==void 0&&this.cache.delete(n)}}*lines(){this.flush(),yield*st(this.file)}readWhatIsThere(){for(let e of this.lines()){if(e.text.startsWith('["')){let n=m(e.text);n&&this.readRegistration(e,n);continue}let t;try{t=JSON.parse(e.text)}catch{continue}if(!(typeof t!="object"||t===null)){if("part"in t)this.parts++;else if("sample"in t){let n=t.sample;if(typeof n!="object"||n===null)continue;let{dir:i,sha256:r}=n;if(typeof i!="string"||i===""||typeof r!="string"||!T.test(r))continue;this.plan={dir:i,sha256:r}}else if("roots"in t){let n=M(t.roots);n&&(this.rootsNamed=n)}else if("at"in t){let n=t.at;if(typeof n!="object"||n===null)continue;let{object:i,pass:r,lastId:s,read:o,done:c}=n;if(typeof i!="string"||typeof s!="string"||typeof o!="number"||r!==void 0&&(typeof r!="string"||!E.test(r)))continue;this.checkpointsByObject.set(j(i,r),{lastId:s,read:o,...c===!0?{done:c}:{}}),r===void 0&&this.earlierPastCheckpoint.delete(i)}}}}readRegistration(e,t){let n=String(t[0]);if(n==="o"||n==="w"){this.owedCount++;return}if(n==="s"){t.length>=4&&this.tallyStatus({objectApiName:String(t[1]),id:String(t[2]),status:String(t[3])});return}if(n==="p"||n==="g"||n===O){let d=F(t);if(!d)return;let f=l(d),h=p(d),b=this.marks.find(d,f,h);if(n==="g"&&b<0){let w=String(t[1]);this.given.set(w,(this.given.get(w)??0)+1)}this.marks.put(b,f,h,e.offset,e.length,0);return}if(n===R){if(Array.isArray(t[2]))for(let d of t[2])this.createdUnattributedKeys.add(A(String(d)));return}let i=N[n];if(i===void 0)return;let r=String(t[1]);i===y&&(t[4]===U||t[4]===V)&&(this.foundAfterStop.add(r),t[4]===U&&this.foundOwingUntold.add(r));let s=l(r),o=p(r),c=this.index.find(r,s,o),u=c>=0&&this.index.codeOf(c)!==S;if(i===S&&c>=0||(this.index.put(c,s,o,e.offset,e.length,i),i===S))return;i===y&&this.indexCreated(String(t[2]??""),e.offset,e.length),u||this.mappedCount++;let g=String(t[3]??"");g&&(this.earlierByObject.set(g,(this.earlierByObject.get(g)??0)+1),this.earlierPastCheckpoint.set(g,(this.earlierPastCheckpoint.get(g)??0)+1))}};function A(a){return a.slice(0,15)}function m(a){try{let e=JSON.parse(a);return Array.isArray(e)?e:void 0}catch{return}}export{at as a,j as b,M as c,Y as d,Z as e,q as f,z as g,R as h,O as i,U as j,V as k,dt as l,ct as m,Q as n,l as o,p,x as q,st as r,L as s};