sandforge 1.85.0 → 1.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/{chunk-THYQOG24.mjs → chunk-22L43JMK.mjs} +1 -1
- package/lib/{chunk-U4S27YRP.mjs → chunk-2LSGWTWX.mjs} +1 -1
- package/lib/{chunk-MRN72UEO.mjs → chunk-2YJJTQNC.mjs} +1 -1
- package/lib/chunk-34SMB5PA.mjs +10 -0
- package/lib/chunk-35B73566.mjs +7 -0
- package/lib/{chunk-YZKE6D3K.mjs → chunk-35IJ4WEU.mjs} +1 -1
- package/lib/chunk-3EHPAFKV.mjs +7 -0
- package/lib/{chunk-3OKDWZ32.mjs → chunk-3HAVVEXF.mjs} +1 -1
- package/lib/{chunk-32ZB5ICW.mjs → chunk-3I6FXFCN.mjs} +1 -1
- package/lib/{chunk-JFVY66BS.mjs → chunk-3KJCSYXY.mjs} +1 -1
- package/lib/{chunk-ULEYGOZU.mjs → chunk-3L6DVNCR.mjs} +1 -1
- package/lib/chunk-3LRFPGYZ.mjs +7 -0
- package/lib/{chunk-GHUA6OQQ.mjs → chunk-3MVWGL5A.mjs} +1 -1
- package/lib/{chunk-SF52ZSIV.mjs → chunk-4CSBZZAL.mjs} +1 -1
- package/lib/{chunk-FBYFCKPG.mjs → chunk-4NSXPONF.mjs} +1 -1
- package/lib/{chunk-A3QNSALB.mjs → chunk-4VLP6RHC.mjs} +1 -1
- package/lib/{chunk-TWYNQ2OO.mjs → chunk-4XROG5CT.mjs} +1 -1
- package/lib/chunk-54V4FVEY.mjs +7 -0
- package/lib/chunk-55OJJT2Q.mjs +7 -0
- package/lib/{chunk-JRI6A24G.mjs → chunk-5EHHQ5UX.mjs} +1 -1
- package/lib/{chunk-VPGX5Z5D.mjs → chunk-5JMQXHJ2.mjs} +1 -1
- package/lib/{chunk-CI2O7WBH.mjs → chunk-65AMXOQU.mjs} +1 -1
- package/lib/{chunk-5T3LFDJ5.mjs → chunk-6HHSAPIM.mjs} +1 -1
- package/lib/chunk-6KVBCFVS.mjs +7 -0
- package/lib/chunk-6NG7C2U3.mjs +476 -0
- package/lib/{chunk-F2424IKX.mjs → chunk-6ROL3KBM.mjs} +1 -1
- package/lib/{chunk-7ZYCRIHE.mjs → chunk-72AWCN7U.mjs} +1 -1
- package/lib/{chunk-MQLTEXB7.mjs → chunk-7KHA5UIQ.mjs} +1 -1
- package/lib/chunk-7O6EFNQS.mjs +10 -0
- package/lib/{chunk-73SLYGWD.mjs → chunk-A2CH2QGX.mjs} +1 -1
- package/lib/chunk-A2TXLAC3.mjs +276 -0
- package/lib/chunk-ALWVNR34.mjs +7 -0
- package/lib/{chunk-JBOGAUGH.mjs → chunk-ATBQIE2V.mjs} +1 -1
- package/lib/{chunk-C2MHMI7U.mjs → chunk-ATQML7ZK.mjs} +1 -1
- package/lib/chunk-AVY742BJ.mjs +7 -0
- package/lib/{chunk-VLAU5QQT.mjs → chunk-AXTB2HJS.mjs} +1 -1
- package/lib/chunk-BBZUGKBZ.mjs +10 -0
- package/lib/chunk-BIDXK7KA.mjs +7 -0
- package/lib/{chunk-KYLHS74X.mjs → chunk-BLMJ4WVI.mjs} +1 -1
- package/lib/{chunk-A7YP27GQ.mjs → chunk-BNHJCJJM.mjs} +1 -1
- package/lib/{chunk-ZDMSTL2L.mjs → chunk-BNPQEQXC.mjs} +1 -1
- package/lib/chunk-C5AUNG6T.mjs +37 -0
- package/lib/{chunk-LY6EPMIP.mjs → chunk-C5EQ7GFC.mjs} +1 -1
- package/lib/{chunk-LOO42EW5.mjs → chunk-C7CKDZMC.mjs} +62 -62
- package/lib/{chunk-ZP3WJGS3.mjs → chunk-CB4U22NR.mjs} +1 -1
- package/lib/chunk-CJAWKLAL.mjs +7 -0
- package/lib/chunk-CL75DEMQ.mjs +9 -0
- package/lib/{chunk-7L6FE5PP.mjs → chunk-CLUNF4FK.mjs} +1 -1
- package/lib/chunk-CSMGP53U.mjs +7 -0
- package/lib/{chunk-S6BMJSLD.mjs → chunk-CT324C7I.mjs} +1 -1
- package/lib/{chunk-YXOPKGDX.mjs → chunk-CZXDJXQP.mjs} +1 -1
- package/lib/{chunk-PGG4ULEW.mjs → chunk-D2X6U3MS.mjs} +1 -1
- package/lib/{chunk-FG4Y4ZVL.mjs → chunk-DAUX63UB.mjs} +1 -1
- package/lib/chunk-DB7JNALQ.mjs +10 -0
- package/lib/chunk-DDNCJVZ2.mjs +17 -0
- package/lib/{chunk-YGE4AUXG.mjs → chunk-DLSU66MY.mjs} +1 -1
- package/lib/{chunk-DCJBP3LE.mjs → chunk-DO6PSHQZ.mjs} +1 -1
- package/lib/{chunk-ROTDZKOE.mjs → chunk-DUBECLZV.mjs} +1 -1
- package/lib/{chunk-SES5HPBZ.mjs → chunk-DYHF6DNT.mjs} +1 -1
- package/lib/chunk-E5FSPXYH.mjs +930 -0
- package/lib/{chunk-QAXKUEJT.mjs → chunk-EGL3I3IX.mjs} +1 -1
- package/lib/chunk-EIYMQPMG.mjs +7 -0
- package/lib/{chunk-AX3YF7SC.mjs → chunk-EUIALBMX.mjs} +1 -1
- package/lib/{chunk-57QRXYAZ.mjs → chunk-FI3R5ZOQ.mjs} +1 -1
- package/lib/{chunk-FCZDWGQI.mjs → chunk-FM4QCTO7.mjs} +1 -1
- package/lib/{chunk-74HZ274R.mjs → chunk-FRSIEASH.mjs} +1 -1
- package/lib/{chunk-G6IYOZEH.mjs → chunk-FV6MOSHD.mjs} +1 -1
- package/lib/chunk-FYG47CNA.mjs +7 -0
- package/lib/chunk-GB6W4Q56.mjs +7 -0
- package/lib/chunk-GEV2DCMK.mjs +7 -0
- package/lib/{chunk-NZJXEULY.mjs → chunk-GFB2DNCB.mjs} +1 -1
- package/lib/chunk-GFGMGFSH.mjs +7 -0
- package/lib/{chunk-EFHDE7W4.mjs → chunk-GIFQXB2Q.mjs} +1 -1
- package/lib/{chunk-P6A22FMQ.mjs → chunk-GP5J3DGS.mjs} +1 -1
- package/lib/chunk-GQZEX7LH.mjs +231 -0
- package/lib/{chunk-BRN42U26.mjs → chunk-GYDTM62J.mjs} +1 -1
- package/lib/{chunk-GNCEHAJY.mjs → chunk-GYFIXUJG.mjs} +1 -1
- package/lib/chunk-GZW2GNFK.mjs +7 -0
- package/lib/chunk-H6BHWAX7.mjs +8 -0
- package/lib/{chunk-GUYEXPJ4.mjs → chunk-HDDJ3CVN.mjs} +1 -1
- package/lib/{chunk-3GATEVHC.mjs → chunk-HDWB4ZOG.mjs} +1 -1
- package/lib/chunk-HGVPBJR6.mjs +7 -0
- package/lib/{chunk-55VBV2WK.mjs → chunk-HLROVOR6.mjs} +1 -1
- package/lib/{chunk-HV3TDLFR.mjs → chunk-HUOR4M2L.mjs} +1 -1
- package/lib/chunk-HZCS6EED.mjs +8 -0
- package/lib/{chunk-WZX6VCIT.mjs → chunk-HZUI56KZ.mjs} +1 -1
- package/lib/chunk-IAB5H7WN.mjs +7 -0
- package/lib/{chunk-RY7WUJXH.mjs → chunk-IQ5UKRHU.mjs} +1 -1
- package/lib/{chunk-OUWR5M5G.mjs → chunk-IRQ4WANV.mjs} +1 -1
- package/lib/{chunk-F44EHXLI.mjs → chunk-IT3DGX37.mjs} +1 -1
- package/lib/chunk-J347SPU6.mjs +49 -0
- package/lib/{chunk-IZ2M2RGO.mjs → chunk-JANBNTR5.mjs} +1 -1
- package/lib/chunk-JFXQZPRY.mjs +9 -0
- package/lib/{chunk-VKA5OZBJ.mjs → chunk-JRLYWVF4.mjs} +1 -1
- package/lib/{chunk-FM5ESRH6.mjs → chunk-JSNMUTY6.mjs} +1 -1
- package/lib/chunk-JTNJKSAA.mjs +7 -0
- package/lib/{chunk-4D6OHSX3.mjs → chunk-JV2LAKWQ.mjs} +1 -1
- package/lib/{chunk-BY42YL4D.mjs → chunk-JV7K2ZHK.mjs} +1 -1
- package/lib/{chunk-A6IJUOLB.mjs → chunk-K4TQ7YHX.mjs} +1 -1
- package/lib/chunk-K5PUMHZU.mjs +7 -0
- package/lib/chunk-KH4KLCYG.mjs +7 -0
- package/lib/{chunk-FZF6FB65.mjs → chunk-KQVLZVOP.mjs} +1 -1
- package/lib/chunk-KWUS7UAV.mjs +19 -0
- package/lib/{chunk-2UUSF32M.mjs → chunk-L6G73FXM.mjs} +1 -1
- package/lib/{chunk-LUNGNCM3.mjs → chunk-LG466Q5H.mjs} +1 -1
- package/lib/{chunk-YTBM3TSW.mjs → chunk-LHNAR6FC.mjs} +1 -1
- package/lib/chunk-LT4GHEI2.mjs +7 -0
- package/lib/{chunk-P3OYE2FS.mjs → chunk-MR262Y3B.mjs} +1 -1
- package/lib/{chunk-TSTCHIBU.mjs → chunk-NCCHOV2N.mjs} +1 -1
- package/lib/chunk-NICRSGLS.mjs +7 -0
- package/lib/chunk-NV5QA2HY.mjs +7 -0
- package/lib/{chunk-6HAKOS6W.mjs → chunk-O3GIN5TU.mjs} +1 -1
- package/lib/chunk-O6FHK6NQ.mjs +13 -0
- package/lib/{chunk-OXIIKAUZ.mjs → chunk-O7YIEFG7.mjs} +1 -1
- package/lib/chunk-OCUVAA5E.mjs +7 -0
- package/lib/chunk-OLCS7JCT.mjs +14 -0
- package/lib/chunk-ON7Y63FK.mjs +9 -0
- package/lib/{chunk-K2WOT75I.mjs → chunk-OO2WY3UB.mjs} +1 -1
- package/lib/{chunk-3EOIAC2M.mjs → chunk-OT2NHL2V.mjs} +1 -1
- package/lib/{chunk-BK5SRDAD.mjs → chunk-P2M5ZXWU.mjs} +1 -1
- package/lib/{chunk-DCZYWMSA.mjs → chunk-P4YOHLZ4.mjs} +1 -1
- package/lib/chunk-PBHDPTT6.mjs +343 -0
- package/lib/chunk-PE7CHD2W.mjs +7 -0
- package/lib/{chunk-LU7M5URW.mjs → chunk-PIQ2I67B.mjs} +1 -1
- package/lib/chunk-PKYDNZJK.mjs +7 -0
- package/lib/chunk-PVZ72OOQ.mjs +7 -0
- package/lib/chunk-QACFTHJM.mjs +8 -0
- package/lib/{chunk-LNAZHI3J.mjs → chunk-QGVL5EW3.mjs} +1 -1
- package/lib/chunk-QHE2RUWX.mjs +7 -0
- package/lib/{chunk-4RNP65FV.mjs → chunk-RCW5BZNW.mjs} +1 -1
- package/lib/{chunk-OTKXTBTX.mjs → chunk-RJ6HHG7J.mjs} +1 -1
- package/lib/{chunk-IVDBVWKK.mjs → chunk-RPTEEI4R.mjs} +1 -1
- package/lib/chunk-RQW5S67A.mjs +7 -0
- package/lib/chunk-RTCMYMED.mjs +7 -0
- package/lib/chunk-RWVX7XSD.mjs +7 -0
- package/lib/{chunk-2UUS4IGB.mjs → chunk-RZOINFNL.mjs} +1 -1
- package/lib/chunk-SOOTWGMQ.mjs +7 -0
- package/lib/chunk-STQ2JMIZ.mjs +7 -0
- package/lib/{chunk-RC25QQVF.mjs → chunk-SUIPDW5O.mjs} +1 -1
- package/lib/{chunk-Z354SAEF.mjs → chunk-SZOJ7BEJ.mjs} +1 -1
- package/lib/{chunk-45375WT5.mjs → chunk-T542Z54E.mjs} +1 -1
- package/lib/chunk-TAN2CIRI.mjs +21 -0
- package/lib/{chunk-BGJBYDRW.mjs → chunk-TCNBINOG.mjs} +1 -1
- package/lib/chunk-TFDF3DBN.mjs +7 -0
- package/lib/{chunk-B5A4JHNN.mjs → chunk-TICZXC53.mjs} +1 -1
- package/lib/chunk-TLX45X5U.mjs +7 -0
- package/lib/{chunk-W6SLQZKQ.mjs → chunk-TMIV3IWH.mjs} +1 -1
- package/lib/chunk-TQ6HEJ73.mjs +11 -0
- package/lib/chunk-TTU5EQZ6.mjs +7 -0
- package/lib/chunk-TYUYPFDJ.mjs +7 -0
- package/lib/chunk-TZXYVMZC.mjs +7 -0
- package/lib/{chunk-4N425UJC.mjs → chunk-UCUFLFNK.mjs} +1 -1
- package/lib/chunk-UK3QLBHW.mjs +7 -0
- package/lib/{chunk-SKGAERV4.mjs → chunk-UM2B4GR7.mjs} +1 -1
- package/lib/chunk-UZFTTNOP.mjs +7 -0
- package/lib/chunk-V3AXSKSU.mjs +7 -0
- package/lib/chunk-VA6EEI6X.mjs +21 -0
- package/lib/{chunk-LSEM2BZH.mjs → chunk-VFKG2G37.mjs} +1 -1
- package/lib/chunk-VJNEW5MQ.mjs +7 -0
- package/lib/{chunk-EYFP3NA6.mjs → chunk-VKREON6Q.mjs} +1 -1
- package/lib/{chunk-TIVI2KGB.mjs → chunk-VNNDYPBL.mjs} +1 -1
- package/lib/{chunk-J3FJ3BWE.mjs → chunk-VRBETPHY.mjs} +1 -1
- package/lib/{chunk-UX4AOSMU.mjs → chunk-VT6P3X6R.mjs} +1 -1
- package/lib/{chunk-CUOWQMGW.mjs → chunk-VUTQY76O.mjs} +1 -1
- package/lib/chunk-WF5S4FW5.mjs +7 -0
- package/lib/{chunk-JHJDDQDE.mjs → chunk-WJGK6VGU.mjs} +1 -1
- package/lib/{chunk-IZREPWYQ.mjs → chunk-WJHMB3SL.mjs} +1 -1
- package/lib/{chunk-XZRON54U.mjs → chunk-WQCXOZEJ.mjs} +1 -1
- package/lib/{chunk-N2MXYD67.mjs → chunk-WVVFR4E3.mjs} +1 -1
- package/lib/{chunk-GG5I52UT.mjs → chunk-XBYXT74L.mjs} +1 -1
- package/lib/chunk-XJE3LJHP.mjs +7 -0
- package/lib/{chunk-3QCUSZIZ.mjs → chunk-XV4CVZYD.mjs} +1 -1
- package/lib/chunk-Y37ED7AS.mjs +7 -0
- package/lib/{chunk-MN3XBJPE.mjs → chunk-YGBNZYT4.mjs} +1 -1
- package/lib/{chunk-SBDF4AE5.mjs → chunk-YGTOX7IL.mjs} +1 -1
- package/lib/{chunk-SQM32AOQ.mjs → chunk-YJ27WHKR.mjs} +1 -1
- package/lib/chunk-YRULC27A.mjs +7 -0
- package/lib/{chunk-RMFU4BAL.mjs → chunk-YSVAHT4Q.mjs} +4 -4
- package/lib/chunk-YTOTMJTY.mjs +15 -0
- package/lib/{chunk-SU24AE3H.mjs → chunk-YZKZC62O.mjs} +1 -1
- package/lib/{chunk-LJNRN7MY.mjs → chunk-YZQN7BRB.mjs} +1 -1
- package/lib/{chunk-NMF55UBQ.mjs → chunk-Z5IUK2QO.mjs} +1 -1
- package/lib/{chunk-6ZWY36LK.mjs → chunk-ZEGSMW5A.mjs} +1 -1
- package/lib/{chunk-YV7JYHJP.mjs → chunk-ZIKLQZBG.mjs} +1 -1
- package/lib/chunk-ZVU7MD2S.mjs +7 -0
- package/lib/sandforge-autopilot.mjs +33 -27
- package/lib/sandforge-backup.mjs +19 -19
- package/lib/sandforge-checkpoint.mjs +1 -1
- package/lib/sandforge-cleanup.mjs +1 -1
- package/lib/sandforge-clone.mjs +1 -1
- package/lib/sandforge-compare.mjs +29 -16
- package/lib/sandforge-dataops.mjs +1 -1
- package/lib/sandforge-empty.mjs +11 -13
- package/lib/sandforge-env.mjs +105 -105
- package/lib/sandforge-frozen.mjs +1 -1
- package/lib/sandforge-mcp.mjs +2 -2
- package/lib/sandforge-monitor.mjs +1 -1
- package/lib/sandforge-pipeline.mjs +13 -13
- package/lib/sandforge-seed.mjs +1 -1
- package/lib/sandforge-sync.mjs +1 -1
- package/lib/sandforge-users.mjs +13 -15
- package/lib/sandforge.mjs +1 -1
- package/lib/sf/sandforge/dataops.mjs +2 -2
- package/lib/sfPlugin.mjs +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/lib/chunk-26EGXYZ4.mjs +0 -21
- package/lib/chunk-2JRVBXJL.mjs +0 -7
- package/lib/chunk-2METQHGG.mjs +0 -7
- package/lib/chunk-3XU7CEJQ.mjs +0 -7
- package/lib/chunk-4BQPAVMP.mjs +0 -14
- package/lib/chunk-4KMKOE77.mjs +0 -156
- package/lib/chunk-4RPA7Z52.mjs +0 -7
- package/lib/chunk-5C7LQXYS.mjs +0 -7
- package/lib/chunk-5EESNYE3.mjs +0 -8
- package/lib/chunk-6ZW6BLV5.mjs +0 -7
- package/lib/chunk-AAOMUI7S.mjs +0 -15
- package/lib/chunk-AIUAEBHR.mjs +0 -7
- package/lib/chunk-BD724WOH.mjs +0 -7
- package/lib/chunk-CRPLDXJU.mjs +0 -48
- package/lib/chunk-CSSOLHE3.mjs +0 -7
- package/lib/chunk-D63HEQ3B.mjs +0 -7
- package/lib/chunk-DN7YBILC.mjs +0 -21
- package/lib/chunk-DNE7JI3A.mjs +0 -11
- package/lib/chunk-EFHM2U4D.mjs +0 -7
- package/lib/chunk-EINEGS6E.mjs +0 -7
- package/lib/chunk-EM5EFMHA.mjs +0 -272
- package/lib/chunk-FH5UR35W.mjs +0 -7
- package/lib/chunk-FN7TOBJR.mjs +0 -7
- package/lib/chunk-HGJFATSI.mjs +0 -10
- package/lib/chunk-HOEE3PE5.mjs +0 -7
- package/lib/chunk-HV63UGL5.mjs +0 -7
- package/lib/chunk-JKFCGYJE.mjs +0 -7
- package/lib/chunk-KATBU46O.mjs +0 -7
- package/lib/chunk-LD34JNCC.mjs +0 -7
- package/lib/chunk-LPN4WYTP.mjs +0 -478
- package/lib/chunk-MAOUFJ47.mjs +0 -7
- package/lib/chunk-MB2DG66I.mjs +0 -13
- package/lib/chunk-NCASRA7L.mjs +0 -9
- package/lib/chunk-NEKNAILD.mjs +0 -7
- package/lib/chunk-NN2IO4WE.mjs +0 -7
- package/lib/chunk-O3ZQSWDN.mjs +0 -10
- package/lib/chunk-OFQOKSEW.mjs +0 -7
- package/lib/chunk-PP7PJXRJ.mjs +0 -341
- package/lib/chunk-PT2E2HFD.mjs +0 -7
- package/lib/chunk-PZBZ7MNC.mjs +0 -7
- package/lib/chunk-QBYK5XIT.mjs +0 -8
- package/lib/chunk-RFD6NPWJ.mjs +0 -8
- package/lib/chunk-RIIJJRGF.mjs +0 -7
- package/lib/chunk-RKTFFCNS.mjs +0 -7
- package/lib/chunk-RM5G4IP6.mjs +0 -19
- package/lib/chunk-RTPNK7OB.mjs +0 -7
- package/lib/chunk-RZXEO5IE.mjs +0 -7
- package/lib/chunk-SAHGDSZQ.mjs +0 -37
- package/lib/chunk-SRPWW4A2.mjs +0 -10
- package/lib/chunk-SVNSAHG3.mjs +0 -7
- package/lib/chunk-T63U4OZJ.mjs +0 -7
- package/lib/chunk-TE2W76II.mjs +0 -10
- package/lib/chunk-TEIBWMJM.mjs +0 -7
- package/lib/chunk-TFGJDZFE.mjs +0 -7
- package/lib/chunk-TG52WNGV.mjs +0 -10
- package/lib/chunk-TQONVFI3.mjs +0 -7
- package/lib/chunk-TW3N6W5Z.mjs +0 -7
- package/lib/chunk-UZMLPKW6.mjs +0 -7
- package/lib/chunk-WB2RIVO3.mjs +0 -7
- package/lib/chunk-WQO7RXEB.mjs +0 -926
- package/lib/chunk-X3MBY2RX.mjs +0 -7
- package/lib/chunk-XMJRXXUN.mjs +0 -7
- package/lib/chunk-YNMU5I7P.mjs +0 -7
- package/lib/chunk-YSQJKIO6.mjs +0 -7
- package/lib/chunk-YVVPJRZC.mjs +0 -7
- package/lib/chunk-ZLQHBI6V.mjs +0 -9
- package/lib/chunk-ZRUDYB7O.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-
|
|
7
|
+
import{b as j,q as O}from"./chunk-VA6EEI6X.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-XV4CVZYD.mjs";import"./chunk-BLMJ4WVI.mjs";import"./chunk-4NSXPONF.mjs";import"./chunk-TAN2CIRI.mjs";import"./chunk-AXTB2HJS.mjs";import"./chunk-NCCHOV2N.mjs";import"./chunk-2LSGWTWX.mjs";import"./chunk-LHNAR6FC.mjs";import"./chunk-XBYXT74L.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-UM2B4GR7.mjs";import"./chunk-2YJJTQNC.mjs";import"./chunk-4VLP6RHC.mjs";import"./chunk-YRULC27A.mjs";import"./chunk-GYDTM62J.mjs";import"./chunk-5JMQXHJ2.mjs";import"./chunk-HLROVOR6.mjs";import"./chunk-WF5S4FW5.mjs";import"./chunk-FV6MOSHD.mjs";import"./chunk-T542Z54E.mjs";import"./chunk-DO6PSHQZ.mjs";import"./chunk-ZIKLQZBG.mjs";import"./chunk-FYG47CNA.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-ON7Y63FK.mjs";import"./chunk-7KHA5UIQ.mjs";import"./chunk-YTOTMJTY.mjs";import"./chunk-WJGK6VGU.mjs";import"./chunk-3L6DVNCR.mjs";import"./chunk-54V4FVEY.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-TZXYVMZC.mjs";import{b as S,c as x}from"./chunk-TMIV3IWH.mjs";import"./chunk-CJAWKLAL.mjs";import"./chunk-PE7CHD2W.mjs";import"./chunk-VKREON6Q.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-VFKG2G37.mjs";import"./chunk-CL75DEMQ.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-C5AUNG6T.mjs";import"./chunk-3I6FXFCN.mjs";import"./chunk-7O6EFNQS.mjs";import"./chunk-3LRFPGYZ.mjs";import"./chunk-34SMB5PA.mjs";import"./chunk-GB6W4Q56.mjs";import"./chunk-AVY742BJ.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-KWUS7UAV.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-HZCS6EED.mjs";import"./chunk-NV5QA2HY.mjs";import"./chunk-EGL3I3IX.mjs";import"./chunk-CSMGP53U.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-35B73566.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-PVZ72OOQ.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-TYUYPFDJ.mjs";import"./chunk-TICZXC53.mjs";import"./chunk-DLSU66MY.mjs";import"./chunk-ATQML7ZK.mjs";import"./chunk-H6BHWAX7.mjs";import"./chunk-4CSBZZAL.mjs";import"./chunk-GP5J3DGS.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-WQCXOZEJ.mjs";import"./chunk-OT2NHL2V.mjs";import"./chunk-ZVU7MD2S.mjs";import"./chunk-OLCS7JCT.mjs";import"./chunk-TQ6HEJ73.mjs";import"./chunk-65AMXOQU.mjs";import"./chunk-6HHSAPIM.mjs";import"./chunk-K5PUMHZU.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-EUIALBMX.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ATBQIE2V.mjs";import"./chunk-UCUFLFNK.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-4XROG5CT.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-DAUX63UB.mjs";import"./chunk-SZOJ7BEJ.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-22L43JMK.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-3KJCSYXY.mjs";import"./chunk-HDDJ3CVN.mjs";import"./chunk-J347SPU6.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
|
|
7
|
+
import{p as je}from"./chunk-6NG7C2U3.mjs";import"./chunk-RWVX7XSD.mjs";import"./chunk-SOOTWGMQ.mjs";import"./chunk-O6FHK6NQ.mjs";import"./chunk-GFB2DNCB.mjs";import"./chunk-JFXQZPRY.mjs";import"./chunk-BBZUGKBZ.mjs";import"./chunk-P4YOHLZ4.mjs";import"./chunk-35IJ4WEU.mjs";import"./chunk-A2TXLAC3.mjs";import"./chunk-PBHDPTT6.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-SUIPDW5O.mjs";import{a as Y,c as Ie,g as Te,h as q,i as be,j as Ee,k as J,l as Ne,m as xe,n as Ae,o as _e,p as Ce,q as Fe}from"./chunk-VA6EEI6X.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-XV4CVZYD.mjs";import"./chunk-BLMJ4WVI.mjs";import"./chunk-4NSXPONF.mjs";import"./chunk-TAN2CIRI.mjs";import"./chunk-AXTB2HJS.mjs";import"./chunk-NCCHOV2N.mjs";import"./chunk-2LSGWTWX.mjs";import"./chunk-LHNAR6FC.mjs";import"./chunk-XBYXT74L.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-UM2B4GR7.mjs";import"./chunk-2YJJTQNC.mjs";import"./chunk-4VLP6RHC.mjs";import"./chunk-YRULC27A.mjs";import"./chunk-GYDTM62J.mjs";import"./chunk-5JMQXHJ2.mjs";import"./chunk-HLROVOR6.mjs";import{h as Re}from"./chunk-WF5S4FW5.mjs";import"./chunk-FV6MOSHD.mjs";import"./chunk-T542Z54E.mjs";import"./chunk-DO6PSHQZ.mjs";import"./chunk-ZIKLQZBG.mjs";import"./chunk-FYG47CNA.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-HUOR4M2L.mjs";import"./chunk-Z5IUK2QO.mjs";import{a as De}from"./chunk-TLX45X5U.mjs";import"./chunk-E5FSPXYH.mjs";import"./chunk-IQ5UKRHU.mjs";import{d as $e}from"./chunk-VT6P3X6R.mjs";import"./chunk-ALWVNR34.mjs";import{a as ke}from"./chunk-QHE2RUWX.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-ON7Y63FK.mjs";import"./chunk-7KHA5UIQ.mjs";import{u as me}from"./chunk-YTOTMJTY.mjs";import"./chunk-WJGK6VGU.mjs";import"./chunk-3L6DVNCR.mjs";import"./chunk-54V4FVEY.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-TZXYVMZC.mjs";import{a as Se,c as Oe}from"./chunk-TMIV3IWH.mjs";import"./chunk-CJAWKLAL.mjs";import"./chunk-PE7CHD2W.mjs";import{h as ye,i as we}from"./chunk-VKREON6Q.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-VFKG2G37.mjs";import"./chunk-CL75DEMQ.mjs";import"./chunk-BOGNK4LV.mjs";import{b as pe,c as ue,f as W,k as ce}from"./chunk-DDNCJVZ2.mjs";import{n as ve}from"./chunk-C5AUNG6T.mjs";import"./chunk-3I6FXFCN.mjs";import{q as he}from"./chunk-7O6EFNQS.mjs";import"./chunk-3LRFPGYZ.mjs";import"./chunk-34SMB5PA.mjs";import"./chunk-GB6W4Q56.mjs";import"./chunk-AVY742BJ.mjs";import"./chunk-BWWQXU2B.mjs";import{h as fe,m as ge}from"./chunk-KWUS7UAV.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-HZCS6EED.mjs";import"./chunk-NV5QA2HY.mjs";import"./chunk-EGL3I3IX.mjs";import"./chunk-CSMGP53U.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-35B73566.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-PVZ72OOQ.mjs";import"./chunk-QIRO4HTE.mjs";import{g as le}from"./chunk-TYUYPFDJ.mjs";import"./chunk-TICZXC53.mjs";import"./chunk-DLSU66MY.mjs";import"./chunk-ATQML7ZK.mjs";import"./chunk-H6BHWAX7.mjs";import"./chunk-4CSBZZAL.mjs";import{a as N,c as j}from"./chunk-AL4C3GFT.mjs";import"./chunk-GP5J3DGS.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-WQCXOZEJ.mjs";import"./chunk-OT2NHL2V.mjs";import"./chunk-ZVU7MD2S.mjs";import"./chunk-OLCS7JCT.mjs";import"./chunk-TQ6HEJ73.mjs";import"./chunk-65AMXOQU.mjs";import"./chunk-6HHSAPIM.mjs";import"./chunk-K5PUMHZU.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-EUIALBMX.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ATBQIE2V.mjs";import"./chunk-UCUFLFNK.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-4XROG5CT.mjs";import{a as ae,c as de,f as T,h as Pe}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-DAUX63UB.mjs";import"./chunk-SZOJ7BEJ.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-22L43JMK.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-3KJCSYXY.mjs";import"./chunk-HDDJ3CVN.mjs";import{Ve as re,Xe as se,Ze as oe,cd as ie}from"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{copyFileSync as gn,existsSync as Xe,mkdtempSync as mn,readFileSync as Qe,rmSync as hn,rmdirSync as yn}from"node:fs";import{tmpdir as wn}from"node:os";import{join as M,resolve as kn}from"node:path";import{randomUUID as vn}from"node:crypto";import{mkdirSync as on}from"node:fs";import{join as an}from"node:path";var dn=/^\[(WARN|ERR)\]|^\[INFO\] (?:The run lock|the confirmation)/;function Me(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 X(e){let t=e.journalDir??ke(),n=e.backupDir??Se(),s=Oe(n);if(s!==void 0)throw new Error(s);on(e.storeDir,{recursive:!0,mode:448});let i=new De,r,o=Fe({storeDir:e.storeDir,log:a=>{dn.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 he({orgNameOf:d,requestConfirmation:(u,y)=>{let w=Me(void 0,y);return w===void 0?Promise.resolve(!0):(e.log(`refused: ${w} (${u})`),Promise.resolve(!1))},declinesWithoutAsking:u=>Me(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 we(ye(n))),a.handlers.setSyncRunCreations(fe(t)),a.handlers.setSeedRunCreations($e(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 Q(e){switch(ie(e.orgType,e.metadata?.edition)){case"Sandbox":return"sandbox";case"Scratch":return"scratch";case"Developer":return"developer";default:return"production"}}function Le(e,t){return e.length>=15&&t.length>=15&&e.slice(0,15)===t.slice(0,15)}var ze=new Set(["scratch","developer"]),Ge={sandbox:"a sandbox",scratch:"a scratch org",developer:"a Developer Edition org",production:"a production org"};function pn(e,t){return e!==t?`another org, of another kind: ${Ge[t]} here, ${Ge[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 Be(e,t,n,s,i,r=e){return Le(n.organizationId,s.organizationId)?{ok:!0}:i!==void 0&&Le(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.`}:ze.has(n.kind)&&ze.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}: ${pn(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 He(e,t,n,s){if(!n.staging)return{org:t};let i=Q(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 z(e){return JSON.parse(JSON.stringify(e))}function Ve(e,t){let n=z(e.pipeline),s=z(e.syncConfigs);for(let i of oe(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 un="prebuilt-",cn="tpl-";function Ue(e,t,n){let s=new Re(e);for(let o of n.syncConfigs)s.save(o);let i=new Ie(e);for(let o of Object.values(t.seedTemplates))o.id.startsWith(un)||i.save(z(o));let r=new me(e);for(let o of Object.values(t.maskingTemplates))o.id.startsWith(cn)||r.save(z(o))}var Ke="backup:";function We(e,t,n,s=()=>{}){let i=e.getKeysByPrefix(Ke).filter(o=>!n.has(o));if(i.length===0)return 0;let r=ve(an(t,"snapshots.json"));for(let o of i)r.set(o,ln(e.get(o),s),"backups");return i.length}function ln(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 Ye(e){return new Set(e.getKeysByPrefix(Ke))}var $n=`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]
|
|
@@ -72,17 +72,17 @@ Exit codes:
|
|
|
72
72
|
3 --fail-on-partial, and the run completed with warnings
|
|
73
73
|
129, 130, 143 a SIGHUP, a Ctrl-C or a SIGTERM stopped it: the step under way is stopped, and
|
|
74
74
|
the run ends cancelled
|
|
75
|
-
`,Q=["plan","run","confirm","history"],$n={plan:{words:1,switches:["--json"],values:["--file","--org","--accept-org","--var","--var-env","--approve","--confirm-rewind","--store"]},run:{words:1,switches:["--json","--dry-run","--fail-on-partial"],values:["--file","--org","--accept-org","--var","--var-env","--approve","--confirm-rewind","--store","--timeout","--triggered-by"]},confirm:{words:1,switches:[],values:["--file","--org","--accept-org","--store"]},history:{words:1,switches:["--json"],values:["--file"]}},E=2,z=ie["pipeline.timeout"],Pn=2147483647,ee=6e4,H=5*6e4,I=class extends Error{};function G(e,t){let n=t.indexOf("=");if(n<=0||n===t.length-1)throw new I(`${e} takes <key>=<value>, got "${t}". Nothing was run.`);return[t.slice(0,n),t.slice(n+1)]}function Rn(e,t=process.env){let n=e.slice(2),s=n[0];if(s===void 0||s.startsWith("-"))throw new I(`Name the command: ${Q.join(", ")}. Nothing was run.`);if(!Q.includes(s))throw new I(`"${s}" is not a command of sandforge pipeline: ${Q.join(", ")}. Nothing was run.`);let i=$n[s],r=oe(n,i);if(r!==void 0)throw new I(r);let o=v=>{let m=[];for(let p=1;p<n.length;p++)n[p]===v&&p+1<n.length?m.push(n[++p]):i.values.includes(n[p])&&p++;return m},a=v=>{let m=o(v);if(m.length>1)throw new I(`${v} is given ${m.length} times. Nothing was run.`);return m[0]},d=a("--file");if(d===void 0)throw new I("--file names the pipeline file. Nothing was run.");let c=new Map;for(let v of o("--org")){let[m,p]=G("--org",v);if(!ae.test(p))throw new I(`--org ${m}=${p}: "${p}" is not an sf alias. Nothing was run.`);if(c.has(m))throw new I(`--org names ${m} twice. Nothing was run.`);c.set(m,p)}let u=new Map;for(let v of o("--accept-org")){let[m,p]=G("--accept-org",v);if(!/^00D[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/.test(p))throw new I(`--accept-org ${m}=${p}: "${p}" is no Organization Id (00D\u2026). Nothing was run.`);u.set(m,p)}let y=new Map;for(let v of o("--var")){let[m,p]=G("--var",v);if(y.has(m))throw new I(`${m} is given twice. Nothing was run.`);y.set(m,{value:p})}for(let v of o("--var-env")){let[m,p]=G("--var-env",v);if(y.has(m))throw new I(`${m} is given twice. Nothing was run.`);let k=t[p];y.set(m,{env:p,...k!==void 0&&k!==""?{value:k}:{}})}let w,h=a("--timeout");if(h!==void 0&&(w=Number(h),!Number.isInteger(w)||w<(z.minimum??0)||w>(z.maximum??1/0)))throw new I(`--timeout takes milliseconds from ${z.minimum} to ${z.maximum}, got "${h}". Nothing was run.`);let $=a("--triggered-by")??"manual";if($!=="manual"&&$!=="schedule")throw new I(`--triggered-by takes manual or schedule, got "${$}". Nothing was run.`);let P=a("--store");return{verb:s,file:d,orgs:c,accepted:u,vars:y,approve:o("--approve"),confirmRewind:o("--confirm-rewind"),...P!==void 0?{store:wn(P)}:{},json:n.includes("--json"),dryRun:n.includes("--dry-run"),...w!==void 0?{timeoutMs:w}:{},triggeredBy:$,failOnPartial:n.includes("--fail-on-partial")}}function Ye(){try{let e=JSON.parse(Xe(j(__dirname,"..","package.json"),"utf8"));return typeof e.version=="string"?e.version:"0.0.0"}catch{return"0.0.0"}}function Sn(e,t,n){return e.code==="PIPELINE_FILE_NEWER"&&e.exporterVersion!==void 0?[{code:e.code,message:e.message,wayOut:`npx -y sandforge@${e.exporterVersion} pipeline ${t} --file ${n}`}]:e.issues.length===0?[{code:e.code,message:e.message}]:[{code:e.code,message:e.message},...e.issues.map(s=>({code:e.code,message:`${s.path}: ${s.message}`}))]}function Qe(e,t){let n=[],s=[];for(let i of t.keys())Object.prototype.hasOwnProperty.call(e.orgs,i)||s.push({code:"ORG_UNKNOWN_KEY",org:i,message:`--org names "${i}", and the file has no org of that key.`,wayOut:`name one of ${Object.keys(e.orgs).join(", ")||"none"}.`});for(let[i,r]of Object.entries(e.orgs)){let o=t.get(i)??r.alias;if(o===void 0){s.push({code:"ORG_NO_ALIAS",org:i,message:`The org "${r.name??i}" (${r.organizationId}) has no alias in the file.`,wayOut:`give the sf alias it is reached by here: --org ${i}=<alias> (sf alias set <alias>=<username> names one).`});continue}n.push({key:i,alias:o,file:r})}return{orgs:n,refusals:s}}function On(e,t){let n={},s=[],i=new Map(e.pipeline.variables.map(r=>[r.name,r]));for(let[r,o]of t)i.has(r)?o.value!==void 0?n[r]=o.value:o.env!==void 0&&s.push({code:"VARIABLE_MISSING",message:`Variable "${r}" is to be read from ${o.env}, which is not set, or empty.`,wayOut:`set ${o.env} in the environment the run starts in.`}):s.push({code:"VARIABLE_UNKNOWN",message:`The pipeline declares no variable "${r}".`,wayOut:`name one of ${[...i.keys()].join(", ")||"none"}, or leave it out.`});for(let r of e.pipeline.variables)Object.prototype.hasOwnProperty.call(n,r.name)||t.has(r.name)||(r.defaultValue!==void 0?n[r.name]=r.defaultValue:r.required&&s.push({code:"VARIABLE_MISSING",message:`Variable "${r.name}" is required, and the file gives it no value${r.type==="secret"?": a secret never travels in it":""}.`,wayOut:r.type==="secret"?`--var-env ${r.name}=<environment variable that holds it>`:`--var ${r.name}=<value>, or --var-env ${r.name}=<environment variable>`}));return{values:n,refusals:s}}function In(e,t){return e.pipeline.steps.filter(n=>n.type===t).map(n=>n.name)}function Tn(e,t,n){let s=[],i=In(e,"approval");for(let o of t.approve)i.includes(o)||s.push({code:"APPROVE_UNKNOWN_STEP",message:`--approve "${o}" names no Approval step of the pipeline.`,wayOut:i.length>0?`name one of ${i.map(a=>`"${a}"`).join(", ")}.`:"leave it out: the pipeline has no Approval step."});let r=new Set(e.pipeline.steps.filter(o=>o.type==="rewind").map(o=>n.find(a=>a.key===o.config.orgId)?.alias).filter(o=>o!==void 0));for(let o of t.confirmRewind)r.has(o)||s.push({code:"CONFIRM_UNKNOWN_ORG",message:`--confirm-rewind ${o} names no org a Rewind step of the pipeline rewinds.`,wayOut:r.size>0?`name ${[...r].join(", ")}.`:"leave it out: the pipeline has no Rewind step."});return s}function bn(e,t){let n=e.pipeline.steps.find(s=>s.id===t);if(!n)return[];if(n.type==="sync"){let s=e.syncConfigs[String(n.config.configId??"")]?.targetOrgId;return typeof s=="string"?[s]:[]}if(["seed","anonymize","rewind","restore","delete"].includes(n.type)){let s=n.config.orgId;return typeof s=="string"?[s]:[]}return[]}function En(e,t,n,s){let i=[],r=new Set,o=d=>n.find(c=>c.key===d)?.kind,a=d=>n.find(c=>c.key===d)?.alias??d;for(let d of t.steps){let c=bn(e,d.stepId).find(y=>o(y)==="production");if(c!==void 0){let y=`Step "${d.name}" writes to ${a(c)}, a production org: a pipeline from the command line never writes to a production org, whatever an Approval answers.`;i.push({code:"PRODUCTION_TARGET",step:d.name,org:c,message:y,wayOut:`point the step at a sandbox, a scratch org or a Developer Edition org, and export again; or map ${c} to one with --org.`}),r.add(d.refusal??y);continue}let u=Nn(e,d,n,s.confirmLine);if(u!==void 0){i.push(u),r.add(d.refusal??u.message);continue}if(d.fate==="refused"&&d.refusal!==void 0){i.push({code:"STEP_REFUSED",step:d.name,message:d.refusal}),r.add(d.refusal);continue}d.type==="approval"&&i.push(...An(d,s))}for(let d of t.problems)r.has(d)||[...r].some(c=>d.includes(c))||i.push({code:"PIPELINE_REFUSED",message:d});return i}function Nn(e,t,n,s=`${N("pipeline")} confirm --file <file>`){if(t.type!=="rewind"||t.fate!=="refused"||t.refusal===void 0)return;let i=t.refusal===W(t.name,"changed");if(!i&&t.refusal!==W(t.name,"never"))return;let r=e.pipeline.steps.find(a=>a.id===t.stepId)?.config.orgId,o=n.find(a=>a.key===r)?.alias??"<alias>";return{code:"REWIND_NOT_CONFIRMED",step:t.name,message:`Rewind step "${t.name}" has `+(i?"not been confirmed since it was changed":"never been confirmed on this machine")+`: it rewinds ${o} only once ${o}'s alias is confirmed for it.`,wayOut:`run it with --confirm-rewind ${o}; or confirm it once, at a terminal, with ${s}, typing ${o}: the runs of that store then rewind it without the flag.`}}function xn(e){let t=[...e.orgs].map(([s,i])=>` --org ${s}=${i}`).join(""),n=[...e.accepted].map(([s,i])=>` --accept-org ${s}=${i}`).join("");return`${N("pipeline")} confirm --file ${e.file}${t}${n}`+(e.store!==void 0?` --store ${e.store}`:"")}function An(e,t){let n=`Approval step "${e.name}"`,s=t.approve.includes(e.name);return e.notes.includes("STAGING_NEEDS_PERSON")?s?[{code:"STAGING_NEEDS_PERSON",step:e.name,message:`${n} stands before a write to a sandbox marked Staging: only a person at a terminal answers it, never --approve.`,wayOut:`leave --approve "${e.name}" out and run it in a terminal; or take the Staging mark off the sandbox on the Organizations page, and export again.`}]:t.isTTY?[]:[{code:"STAGING_NEEDS_PERSON",step:e.name,message:`${n} stands before a write to a sandbox marked Staging, and this run has no terminal: only a person at a terminal answers it.`,wayOut:"run it in a terminal; or take the Staging mark off the sandbox on the Organizations page, and export again."}]:!s&&!t.isTTY?[{code:"APPROVAL_NO_TERMINAL",step:e.name,message:`${n} has no one to ask: this run has no terminal.`,wayOut:`run it in a terminal, or add --approve "${e.name}".`}]:[]}function Ze(e,t){return(n,s)=>{if(n==="pipeline.timeout"&&t!==void 0)return t;let i=e.settings;if(Object.prototype.hasOwnProperty.call(i,n))return i[n];let r=_e;return Object.prototype.hasOwnProperty.call(r,n)?r[n]:s}}function _n(e,t,n,s){let i=e.output??{};if(i.dryRun===!0)return;let r=a=>typeof a=="string"&&a!==""?a:void 0,o=r(i.orgId)!==void 0?t(String(i.orgId)):void 0;switch(e.stepType){case"seed":{let a=r(i.runId);return a===void 0||o===void 0||Number(i.totalRecordsCreated??0)===0?void 0:`${N("seed")} --remove ${a} --target ${o}`}case"sync":{let a=r(i.operationId),d=s(String(i.configId??""));return a===void 0||d===void 0||Number(i.totalSuccess??0)===0?void 0:`${N("sync")} --remove ${ue(a)} --target ${d} --store ${n}`}case"anonymize":{let a=i.snapshot??{},d=r(a.operationId);return d===void 0||o===void 0?void 0:`${N("dataops")} anonymize --org ${o} --restore ${d}`}case"rewind":{let a=r(i.checkpointId);return a===void 0||o===void 0||i.undoUntil===void 0?void 0:`${N("checkpoint")} undo --org ${o} --checkpoint ${a}`}case"checkpoint":{let a=r(i.checkpointId);return a===void 0||o===void 0?void 0:`${N("checkpoint")} delete --org ${o} --checkpoint ${a}`}default:return}}function Cn(e,t,n,s){let i=e.map(a=>_n(a,t,n,s)),r=a=>{let d=a.output?.orgId;return typeof d=="string"?t(d):void 0},o=(a,d)=>{let c=a.output?.objects;return new Set((Array.isArray(c)?c:[]).filter(u=>Number(u[d]??0)>0).map(u=>String(u.objectApiName)))};return i.map((a,d)=>{let c=e[d];if(a===void 0||c===void 0)return a;let u,y;if(c.stepType==="seed")u=r(c),y=o(c,"recordsCreated");else if(c.stepType==="sync")u=s(String(c.output?.configId??"")),y=o(c,"success");else return a;return e.some((h,$)=>$<=d||i[$]===void 0||r(h)!==u?!1:h.stepType==="rewind"?Number(h.output?.deleted??0)>0:h.stepType!=="anonymize"?!1:[...o(h,"processed")].some(P=>y.has(P)))?`${a} --include-changed`:a})}function Fn(e,t){return e.flatMap(n=>{if(n.stepType!=="anonymize"||n.output?.dryRun===!0)return[];let s=n.output?.snapshot??{},i=n.output?.orgId,r=typeof i=="string"?t(i):void 0;return typeof s.operationId!="string"||r===void 0?[]:[`The snapshot of "${n.stepName}" keeps the values it masked in clear on this machine: once they are back, or no longer wanted, ${N("backup")} --delete ${s.operationId} --org ${r} deletes it.`]})}function Dn(e,t,n){switch(e.status){case"completed":return 0;case"completed_with_warnings":return t?3:0;case"cancelled":return n!==void 0?K(n):1;default:return 1}}function jn(e,t=e.triggeredBy){return{runId:e.id,pipelineId:e.pipelineId,pipelineName:e.pipelineName,status:e.status,triggeredBy:t,startTime:e.startTime,duration:e.duration??0,stepCount:e.stepResults.filter(n=>n.status!=="skipped").length,errorCount:e.stepResults.filter(n=>n.status==="failed").length,steps:e.stepResults.map(n=>({stepName:n.stepName,stepType:n.stepType,status:n.status,...n.duration!==void 0?{duration:n.duration}:{},...n.summary!==void 0?{summary:n.summary}:{},...n.error!==void 0?{error:n.error}:{},...n.approval!==void 0?{approval:n.approval}:{}})),ranFrom:"commandLine"}}function Mn(e,t){return j(Y(e,t),"store")}function A(e){return e.message?.payload??{}}function F(e,t){if(e.outcome==="unanswered")return`${t} was not answered in time.`;let n=A(e);return`${t} failed: ${String(n.message??n.error??e.outcome)}`}var Ln=new Set(["ORG_NO_ALIAS","ORG_UNKNOWN_KEY","ORG_NOT_CONNECTED"]);async function en(e,t,n,s,i){let{host:r,orgRegistry:o,configStore:a}=e,d=[...i.refusals],c=[...i.notes],u=[];for(let p of i.orgs){let k;try{k=await r.connect(p.alias)}catch(g){d.push({code:"ORG_NOT_CONNECTED",org:p.key,message:`${p.alias} could not be reached: ${g instanceof Error?g.message:String(g)}`,wayOut:`"sf org display --target-org ${p.alias}" says what sf holds for it; sign in to it under that alias.`}),u.push(p);continue}let R=X(k),O=[p.key,p.alias].find(g=>n.accepted.has(g)),S=Ge(p.key,p.alias,p.file,{organizationId:k.orgId??k.id,kind:R},O!==void 0?n.accepted.get(O):void 0,O);S.ok?S.note!==void 0&&c.push(S.note):d.push({code:S.code,org:p.key,message:S.message,wayOut:S.wayOut});let D=Be(o,k,p.file,p.alias);D.note!==void 0&&c.push(D.note),u.push({...p,org:D.org,kind:R})}if(d.some(p=>Ln.has(p.code)))return c.push("The steps are checked once every org of the file is reached."),{file:t,digestMatches:!0,orgs:u,values:i.values,refusals:d,notes:c};let w=He(t,p=>u.find(k=>k.key===p)?.org?.id);Ve(a,t,w);let h=await r.request({type:"pipeline:save",payload:{id:w.pipeline.id,config:w.pipeline},timeoutMs:ee});if(h.outcome!=="answered")return d.push({code:"PIPELINE_REFUSED",message:F(h,"Saving the pipeline in the store")}),{file:t,digestMatches:!0,orgs:u,values:i.values,refusals:d,notes:c};for(let p of n.confirmRewind)for(let k of t.pipeline.steps){if(k.type!=="rewind"||u.find(S=>S.key===k.config.orgId)?.alias!==p)continue;let R=await r.request({type:"pipeline:rewind-grant",payload:{pipelineId:w.pipeline.id,stepId:k.id,typed:p},timeoutMs:H}),O=A(R);(R.outcome!=="answered"||O.granted!==!0)&&d.push({code:"REWIND_NOT_CONFIRMED",step:k.name,message:R.outcome!=="answered"?F(R,`The confirmation of Rewind step "${k.name}"`):`Rewind step "${k.name}" was not confirmed for ${p}: ${String(O.code??"refused")}${O.why?` (${String(O.why)})`:""}.`,wayOut:"take the checkpoint it names on this machine, or import it (sandforge checkpoint import)."})}let $=await r.request({type:"pipeline:export",payload:{pipelineId:w.pipeline.id},timeoutMs:H}),P=A($);if($.outcome!=="answered"||P.exported!==!0)return d.push({code:"PIPELINE_REFUSED",message:$.outcome!=="answered"?F($,"The check of the pipeline"):`The check of the pipeline did not run: ${P.exported===!1?P.message:""}`}),{file:t,digestMatches:!0,orgs:u,values:i.values,refusals:d,notes:c};let v=En(t,P,u,{approve:n.approve,isTTY:s.isTTY,confirmLine:xn(n)});d.push(...v);let m={...P,steps:P.steps.map(p=>{let k=v.find(R=>R.code==="REWIND_NOT_CONFIRMED"&&R.step===p.name);return k!==void 0?{...p,refusal:k.message}:p})};return{file:t,digestMatches:!0,orgs:u,values:i.values,check:m,refusals:d,notes:c}}function zn(e){let{file:t}=e,n=[`Pipeline "${t.pipeline.name}" (${t.pipeline.steps.length} ${t.pipeline.steps.length===1?"step":"steps"}), exported from ${t.exportedBy} on ${t.exportedAt.slice(0,10)}.`];e.digestMatches||n.push(" The file was edited since it was exported: its digest no longer matches what it holds.");let s=new Map((e.check?.orgs??[]).map(r=>[r.alias??"",r])),i=e.orgs.map(r=>{let o=r.kind??r.file.kind,a={sandbox:"sandbox",scratch:"scratch org",developer:"Developer Edition org",production:"production org"}[o],d=r.org?.orgId??r.file.organizationId,c=s.get(r.alias),u=c===void 0?"":c.writtenBy.length>0?` (written: ${c.writtenBy.join(", ")})`:" (read)";return`${r.alias} ${a}${r.org?.staging===!0?" marked Staging":""} ${d}${u}`});i.length>0&&n.push(`Orgs: ${i.join("; ")}`);for(let[r,o]of(e.check?.steps??[]).entries()){let a=o.fate==="refused"?"refused":o.fate==="asks"?"asks":"runs";n.push(` ${r+1} ${o.type} "${o.name}": ${a}`)}for(let r of e.notes)n.push(` ${r}`);if(e.refusals.length>0){n.push(`Refused before the first step, nothing run (exit ${E}):`);for(let r of e.refusals)n.push(` - ${r.message}${r.wayOut?` ${Z(r.wayOut)}`:""}`)}return n}function Z(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qe(e){return e.map(t=>({key:t.key,alias:t.alias,organizationId:t.org?.orgId??t.file.organizationId,kind:t.kind??t.file.kind,staging:t.org?.staging===!0}))}function Gn(e){let t=gn(j(yn(),"sandforge-pipeline-plan-")),n=j(e,"configStore.json");return Je(n)&&fn(n,j(t,"configStore.json")),t}function Bn(e,t,n,s){return async i=>e.includes(i.stepName)?{decision:"approve",via:"commandLine"}:t?{decision:await we(`Approval step "${i.stepName}"${i.pipelineName?` of pipeline "${i.pipelineName}"`:""}${i.message?`: ${i.message}`:""} \u2014 approve? (it waits until ${i.expiresAt})`,n,s)?"approve":"reject",via:"terminal"}:void 0}function Hn(e){let t;try{t=Xe(e,"utf8")}catch(n){return{ok:!1,refusal:{code:"PIPELINE_FILE_NOT_JSON",message:`${e} could not be read: ${n instanceof Error?n.message:String(n)}`,issues:[]}}}return re(t)}async function Vn(e=process.argv,t={}){let n=t.env??process.env;if(e.slice(2).includes("--help")||e.slice(2).includes("-h")){process.stdout.write(vn);return}let s;try{s=Rn(e,n)}catch(u){if(!(u instanceof I))throw u;process.stderr.write(`${u.message} Run with --help.
|
|
75
|
+
`,Z=["plan","run","confirm","history"],Pn={plan:{words:1,switches:["--json"],values:["--file","--org","--accept-org","--var","--var-env","--approve","--confirm-rewind","--store"]},run:{words:1,switches:["--json","--dry-run","--fail-on-partial"],values:["--file","--org","--accept-org","--var","--var-env","--approve","--confirm-rewind","--store","--timeout","--triggered-by"]},confirm:{words:1,switches:[],values:["--file","--org","--accept-org","--store"]},history:{words:1,switches:["--json"],values:["--file"]}},E=2,G=re["pipeline.timeout"],Rn=2147483647,ne=6e4,V=5*6e4,I=class extends Error{};function B(e,t){let n=t.indexOf("=");if(n<=0||n===t.length-1)throw new I(`${e} takes <key>=<value>, got "${t}". Nothing was run.`);return[t.slice(0,n),t.slice(n+1)]}function Sn(e,t=process.env){let n=e.slice(2),s=n[0];if(s===void 0||s.startsWith("-"))throw new I(`Name the command: ${Z.join(", ")}. Nothing was run.`);if(!Z.includes(s))throw new I(`"${s}" is not a command of sandforge pipeline: ${Z.join(", ")}. Nothing was run.`);let i=Pn[s],r=ae(n,i);if(r!==void 0)throw new I(r);let o=v=>{let m=[];for(let p=1;p<n.length;p++)n[p]===v&&p+1<n.length?m.push(n[++p]):i.values.includes(n[p])&&p++;return m},a=v=>{let m=o(v);if(m.length>1)throw new I(`${v} is given ${m.length} times. Nothing was run.`);return m[0]},d=a("--file");if(d===void 0)throw new I("--file names the pipeline file. Nothing was run.");let c=new Map;for(let v of o("--org")){let[m,p]=B("--org",v);if(!de.test(p))throw new I(`--org ${m}=${p}: "${p}" is not an sf alias. Nothing was run.`);if(c.has(m))throw new I(`--org names ${m} twice. Nothing was run.`);c.set(m,p)}let u=new Map;for(let v of o("--accept-org")){let[m,p]=B("--accept-org",v);if(!/^00D[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/.test(p))throw new I(`--accept-org ${m}=${p}: "${p}" is no Organization Id (00D\u2026). Nothing was run.`);u.set(m,p)}let y=new Map;for(let v of o("--var")){let[m,p]=B("--var",v);if(y.has(m))throw new I(`${m} is given twice. Nothing was run.`);y.set(m,{value:p})}for(let v of o("--var-env")){let[m,p]=B("--var-env",v);if(y.has(m))throw new I(`${m} is given twice. Nothing was run.`);let k=t[p];y.set(m,{env:p,...k!==void 0&&k!==""?{value:k}:{}})}let w,h=a("--timeout");if(h!==void 0&&(w=Number(h),!Number.isInteger(w)||w<(G.minimum??0)||w>(G.maximum??1/0)))throw new I(`--timeout takes milliseconds from ${G.minimum} to ${G.maximum}, got "${h}". Nothing was run.`);let $=a("--triggered-by")??"manual";if($!=="manual"&&$!=="schedule")throw new I(`--triggered-by takes manual or schedule, got "${$}". Nothing was run.`);let P=a("--store");return{verb:s,file:d,orgs:c,accepted:u,vars:y,approve:o("--approve"),confirmRewind:o("--confirm-rewind"),...P!==void 0?{store:kn(P)}:{},json:n.includes("--json"),dryRun:n.includes("--dry-run"),...w!==void 0?{timeoutMs:w}:{},triggeredBy:$,failOnPartial:n.includes("--fail-on-partial")}}function qe(){try{let e=JSON.parse(Qe(M(__dirname,"..","package.json"),"utf8"));return typeof e.version=="string"?e.version:"0.0.0"}catch{return"0.0.0"}}function On(e,t,n){return e.code==="PIPELINE_FILE_NEWER"&&e.exporterVersion!==void 0?[{code:e.code,message:e.message,wayOut:`npx -y sandforge@${e.exporterVersion} pipeline ${t} --file ${j(n)}`}]:e.issues.length===0?[{code:e.code,message:e.message}]:[{code:e.code,message:e.message},...e.issues.map(s=>({code:e.code,message:`${s.path}: ${s.message}`}))]}function Ze(e,t){let n=[],s=[];for(let i of t.keys())Object.prototype.hasOwnProperty.call(e.orgs,i)||s.push({code:"ORG_UNKNOWN_KEY",org:i,message:`--org names "${i}", and the file has no org of that key.`,wayOut:`name one of ${Object.keys(e.orgs).join(", ")||"none"}.`});for(let[i,r]of Object.entries(e.orgs)){let o=t.get(i)??r.alias;if(o===void 0){s.push({code:"ORG_NO_ALIAS",org:i,message:`The org "${r.name??i}" (${r.organizationId}) has no alias in the file.`,wayOut:`give the sf alias it is reached by here: --org ${i}=<alias> (sf alias set <alias>=<username> names one).`});continue}n.push({key:i,alias:o,file:r})}return{orgs:n,refusals:s}}function In(e,t){let n={},s=[],i=new Map(e.pipeline.variables.map(r=>[r.name,r]));for(let[r,o]of t)i.has(r)?o.value!==void 0?n[r]=o.value:o.env!==void 0&&s.push({code:"VARIABLE_MISSING",message:`Variable "${r}" is to be read from ${o.env}, which is not set, or empty.`,wayOut:`set ${o.env} in the environment the run starts in.`}):s.push({code:"VARIABLE_UNKNOWN",message:`The pipeline declares no variable "${r}".`,wayOut:`name one of ${[...i.keys()].join(", ")||"none"}, or leave it out.`});for(let r of e.pipeline.variables)Object.prototype.hasOwnProperty.call(n,r.name)||t.has(r.name)||(r.defaultValue!==void 0?n[r.name]=r.defaultValue:r.required&&s.push({code:"VARIABLE_MISSING",message:`Variable "${r.name}" is required, and the file gives it no value${r.type==="secret"?": a secret never travels in it":""}.`,wayOut:r.type==="secret"?`--var-env ${r.name}=<environment variable that holds it>`:`--var ${r.name}=<value>, or --var-env ${r.name}=<environment variable>`}));return{values:n,refusals:s}}function Tn(e,t){return e.pipeline.steps.filter(n=>n.type===t).map(n=>n.name)}function bn(e,t,n){let s=[],i=Tn(e,"approval");for(let o of t.approve)i.includes(o)||s.push({code:"APPROVE_UNKNOWN_STEP",message:`--approve "${o}" names no Approval step of the pipeline.`,wayOut:i.length>0?`name one of ${i.map(a=>`"${a}"`).join(", ")}.`:"leave it out: the pipeline has no Approval step."});let r=new Set(e.pipeline.steps.filter(o=>o.type==="rewind").map(o=>n.find(a=>a.key===o.config.orgId)?.alias).filter(o=>o!==void 0));for(let o of t.confirmRewind)r.has(o)||s.push({code:"CONFIRM_UNKNOWN_ORG",message:`--confirm-rewind ${o} names no org a Rewind step of the pipeline rewinds.`,wayOut:r.size>0?`name ${[...r].join(", ")}.`:"leave it out: the pipeline has no Rewind step."});return s}function En(e,t){let n=e.pipeline.steps.find(s=>s.id===t);if(!n)return[];if(n.type==="sync"){let s=e.syncConfigs[String(n.config.configId??"")]?.targetOrgId;return typeof s=="string"?[s]:[]}if(["seed","anonymize","rewind","restore","delete"].includes(n.type)){let s=n.config.orgId;return typeof s=="string"?[s]:[]}return[]}function Nn(e,t,n,s){let i=[],r=new Set,o=d=>n.find(c=>c.key===d)?.kind,a=d=>n.find(c=>c.key===d)?.alias??d;for(let d of t.steps){let c=En(e,d.stepId).find(y=>o(y)==="production");if(c!==void 0){let y=`Step "${d.name}" writes to ${a(c)}, a production org: a pipeline from the command line never writes to a production org, whatever an Approval answers.`;i.push({code:"PRODUCTION_TARGET",step:d.name,org:c,message:y,wayOut:`point the step at a sandbox, a scratch org or a Developer Edition org, and export again; or map ${c} to one with --org.`}),r.add(d.refusal??y);continue}let u=xn(e,d,n,s.confirmLine);if(u!==void 0){i.push(u),r.add(d.refusal??u.message);continue}if(d.fate==="refused"&&d.refusal!==void 0){i.push({code:"STEP_REFUSED",step:d.name,message:d.refusal}),r.add(d.refusal);continue}d.type==="approval"&&i.push(..._n(d,s))}for(let d of t.problems)r.has(d)||[...r].some(c=>d.includes(c))||i.push({code:"PIPELINE_REFUSED",message:d});return i}function xn(e,t,n,s=`${N("pipeline")} confirm --file <file>`){if(t.type!=="rewind"||t.fate!=="refused"||t.refusal===void 0)return;let i=t.refusal===Y(t.name,"changed");if(!i&&t.refusal!==Y(t.name,"never"))return;let r=e.pipeline.steps.find(a=>a.id===t.stepId)?.config.orgId,o=n.find(a=>a.key===r)?.alias??"<alias>";return{code:"REWIND_NOT_CONFIRMED",step:t.name,message:`Rewind step "${t.name}" has `+(i?"not been confirmed since it was changed":"never been confirmed on this machine")+`: it rewinds ${o} only once ${o}'s alias is confirmed for it.`,wayOut:`run it with --confirm-rewind ${o}; or confirm it once, at a terminal, with ${s}, typing ${o}: the runs of that store then rewind it without the flag.`}}function An(e){let t=[...e.orgs].map(([s,i])=>` --org ${s}=${i}`).join(""),n=[...e.accepted].map(([s,i])=>` --accept-org ${s}=${i}`).join("");return`${N("pipeline")} confirm --file ${j(e.file)}${t}${n}`+(e.store!==void 0?` --store ${j(e.store)}`:"")}function _n(e,t){let n=`Approval step "${e.name}"`,s=t.approve.includes(e.name);return e.notes.includes("STAGING_NEEDS_PERSON")?s?[{code:"STAGING_NEEDS_PERSON",step:e.name,message:`${n} stands before a write to a sandbox marked Staging: only a person at a terminal answers it, never --approve.`,wayOut:`leave --approve "${e.name}" out and run it in a terminal; or take the Staging mark off the sandbox on the Organizations page, and export again.`}]:t.isTTY?[]:[{code:"STAGING_NEEDS_PERSON",step:e.name,message:`${n} stands before a write to a sandbox marked Staging, and this run has no terminal: only a person at a terminal answers it.`,wayOut:"run it in a terminal; or take the Staging mark off the sandbox on the Organizations page, and export again."}]:!s&&!t.isTTY?[{code:"APPROVAL_NO_TERMINAL",step:e.name,message:`${n} has no one to ask: this run has no terminal.`,wayOut:`run it in a terminal, or add --approve "${e.name}".`}]:[]}function en(e,t){return(n,s)=>{if(n==="pipeline.timeout"&&t!==void 0)return t;let i=e.settings;if(Object.prototype.hasOwnProperty.call(i,n))return i[n];let r=Ce;return Object.prototype.hasOwnProperty.call(r,n)?r[n]:s}}function Cn(e,t,n,s){let i=e.output??{};if(i.dryRun===!0)return;let r=a=>typeof a=="string"&&a!==""?a:void 0,o=r(i.orgId)!==void 0?t(String(i.orgId)):void 0;switch(e.stepType){case"seed":{let a=r(i.runId);return a===void 0||o===void 0||Number(i.totalRecordsCreated??0)===0?void 0:`${N("seed")} --remove ${a} --target ${o}`}case"sync":{let a=r(i.operationId),d=s(String(i.configId??""));return a===void 0||d===void 0||Number(i.totalSuccess??0)===0?void 0:`${N("sync")} --remove ${ge(a)} --target ${d} --store ${j(n)}`}case"anonymize":{let a=i.snapshot??{},d=r(a.operationId);return d===void 0||o===void 0?void 0:`${N("dataops")} anonymize --org ${o} --restore ${d}`}case"rewind":{let a=r(i.checkpointId);return a===void 0||o===void 0||i.undoUntil===void 0?void 0:`${N("checkpoint")} undo --org ${o} --checkpoint ${a}`}case"checkpoint":{let a=r(i.checkpointId);return a===void 0||o===void 0?void 0:`${N("checkpoint")} delete --org ${o} --checkpoint ${a}`}default:return}}function Fn(e,t,n,s){let i=e.map(a=>Cn(a,t,n,s)),r=a=>{let d=a.output?.orgId;return typeof d=="string"?t(d):void 0},o=(a,d)=>{let c=a.output?.objects;return new Set((Array.isArray(c)?c:[]).filter(u=>Number(u[d]??0)>0).map(u=>String(u.objectApiName)))};return i.map((a,d)=>{let c=e[d];if(a===void 0||c===void 0)return a;let u,y;if(c.stepType==="seed")u=r(c),y=o(c,"recordsCreated");else if(c.stepType==="sync")u=s(String(c.output?.configId??"")),y=o(c,"success");else return a;return e.some((h,$)=>$<=d||i[$]===void 0||r(h)!==u?!1:h.stepType==="rewind"?Number(h.output?.deleted??0)>0:h.stepType!=="anonymize"?!1:[...o(h,"processed")].some(P=>y.has(P)))?`${a} --include-changed`:a})}function Dn(e,t){return e.flatMap(n=>{if(n.stepType!=="anonymize"||n.output?.dryRun===!0)return[];let s=n.output?.snapshot??{},i=n.output?.orgId,r=typeof i=="string"?t(i):void 0;return typeof s.operationId!="string"||r===void 0?[]:[`The snapshot of "${n.stepName}" keeps the values it masked in clear on this machine: once they are back, or no longer wanted, ${N("backup")} --delete ${s.operationId} --org ${r} deletes it.`]})}function jn(e,t,n){switch(e.status){case"completed":return 0;case"completed_with_warnings":return t?3:0;case"cancelled":return n!==void 0?W(n):1;default:return 1}}function Mn(e,t=e.triggeredBy){return{runId:e.id,pipelineId:e.pipelineId,pipelineName:e.pipelineName,status:e.status,triggeredBy:t,startTime:e.startTime,duration:e.duration??0,stepCount:e.stepResults.filter(n=>n.status!=="skipped").length,errorCount:e.stepResults.filter(n=>n.status==="failed").length,steps:e.stepResults.map(n=>({stepName:n.stepName,stepType:n.stepType,status:n.status,...n.duration!==void 0?{duration:n.duration}:{},...n.summary!==void 0?{summary:n.summary}:{},...n.error!==void 0?{error:n.error}:{},...n.approval!==void 0?{approval:n.approval}:{}})),ranFrom:"commandLine"}}function Ln(e,t){return M(q(e,t),"store")}function A(e){return e.message?.payload??{}}function F(e,t){if(e.outcome==="unanswered")return`${t} was not answered in time.`;let n=A(e);return`${t} failed: ${String(n.message??n.error??e.outcome)}`}var zn=new Set(["ORG_NO_ALIAS","ORG_UNKNOWN_KEY","ORG_NOT_CONNECTED"]);async function nn(e,t,n,s,i){let{host:r,orgRegistry:o,configStore:a}=e,d=[...i.refusals],c=[...i.notes],u=[];for(let p of i.orgs){let k;try{k=await r.connect(p.alias)}catch(g){d.push({code:"ORG_NOT_CONNECTED",org:p.key,message:`${p.alias} could not be reached: ${g instanceof Error?g.message:String(g)}`,wayOut:`"sf org display --target-org ${p.alias}" says what sf holds for it; sign in to it under that alias.`}),u.push(p);continue}let R=Q(k),O=[p.key,p.alias].find(g=>n.accepted.has(g)),S=Be(p.key,p.alias,p.file,{organizationId:k.orgId??k.id,kind:R},O!==void 0?n.accepted.get(O):void 0,O);S.ok?S.note!==void 0&&c.push(S.note):d.push({code:S.code,org:p.key,message:S.message,wayOut:S.wayOut});let D=He(o,k,p.file,p.alias);D.note!==void 0&&c.push(D.note),u.push({...p,org:D.org,kind:R})}if(d.some(p=>zn.has(p.code)))return c.push("The steps are checked once every org of the file is reached."),{file:t,digestMatches:!0,orgs:u,values:i.values,refusals:d,notes:c};let w=Ve(t,p=>u.find(k=>k.key===p)?.org?.id);Ue(a,t,w);let h=await r.request({type:"pipeline:save",payload:{id:w.pipeline.id,config:w.pipeline},timeoutMs:ne});if(h.outcome!=="answered")return d.push({code:"PIPELINE_REFUSED",message:F(h,"Saving the pipeline in the store")}),{file:t,digestMatches:!0,orgs:u,values:i.values,refusals:d,notes:c};for(let p of n.confirmRewind)for(let k of t.pipeline.steps){if(k.type!=="rewind"||u.find(S=>S.key===k.config.orgId)?.alias!==p)continue;let R=await r.request({type:"pipeline:rewind-grant",payload:{pipelineId:w.pipeline.id,stepId:k.id,typed:p},timeoutMs:V}),O=A(R);(R.outcome!=="answered"||O.granted!==!0)&&d.push({code:"REWIND_NOT_CONFIRMED",step:k.name,message:R.outcome!=="answered"?F(R,`The confirmation of Rewind step "${k.name}"`):`Rewind step "${k.name}" was not confirmed for ${p}: ${String(O.code??"refused")}${O.why?` (${String(O.why)})`:""}.`,wayOut:"take the checkpoint it names on this machine, or import it (sandforge checkpoint import)."})}let $=await r.request({type:"pipeline:export",payload:{pipelineId:w.pipeline.id},timeoutMs:V}),P=A($);if($.outcome!=="answered"||P.exported!==!0)return d.push({code:"PIPELINE_REFUSED",message:$.outcome!=="answered"?F($,"The check of the pipeline"):`The check of the pipeline did not run: ${P.exported===!1?P.message:""}`}),{file:t,digestMatches:!0,orgs:u,values:i.values,refusals:d,notes:c};let v=Nn(t,P,u,{approve:n.approve,isTTY:s.isTTY,confirmLine:An(n)});d.push(...v);let m={...P,steps:P.steps.map(p=>{let k=v.find(R=>R.code==="REWIND_NOT_CONFIRMED"&&R.step===p.name);return k!==void 0?{...p,refusal:k.message}:p})};return{file:t,digestMatches:!0,orgs:u,values:i.values,check:m,refusals:d,notes:c}}function Gn(e){let{file:t}=e,n=[`Pipeline "${t.pipeline.name}" (${t.pipeline.steps.length} ${t.pipeline.steps.length===1?"step":"steps"}), exported from ${t.exportedBy} on ${t.exportedAt.slice(0,10)}.`];e.digestMatches||n.push(" The file was edited since it was exported: its digest no longer matches what it holds.");let s=new Map((e.check?.orgs??[]).map(r=>[r.alias??"",r])),i=e.orgs.map(r=>{let o=r.kind??r.file.kind,a={sandbox:"sandbox",scratch:"scratch org",developer:"Developer Edition org",production:"production org"}[o],d=r.org?.orgId??r.file.organizationId,c=s.get(r.alias),u=c===void 0?"":c.writtenBy.length>0?` (written: ${c.writtenBy.join(", ")})`:" (read)";return`${r.alias} ${a}${r.org?.staging===!0?" marked Staging":""} ${d}${u}`});i.length>0&&n.push(`Orgs: ${i.join("; ")}`);for(let[r,o]of(e.check?.steps??[]).entries()){let a=o.fate==="refused"?"refused":o.fate==="asks"?"asks":"runs";n.push(` ${r+1} ${o.type} "${o.name}": ${a}`)}for(let r of e.notes)n.push(` ${r}`);if(e.refusals.length>0){n.push(`Refused before the first step, nothing run (exit ${E}):`);for(let r of e.refusals)n.push(` - ${r.message}${r.wayOut?` ${ee(r.wayOut)}`:""}`)}return n}function ee(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Je(e){return e.map(t=>({key:t.key,alias:t.alias,organizationId:t.org?.orgId??t.file.organizationId,kind:t.kind??t.file.kind,staging:t.org?.staging===!0}))}function Bn(e){let t=mn(M(wn(),"sandforge-pipeline-plan-")),n=M(e,"configStore.json");return Xe(n)&&gn(n,M(t,"configStore.json")),t}function Hn(e,t,n,s){return async i=>e.includes(i.stepName)?{decision:"approve",via:"commandLine"}:t?{decision:await pe(`Approval step "${i.stepName}"${i.pipelineName?` of pipeline "${i.pipelineName}"`:""}${i.message?`: ${i.message}`:""} \u2014 approve? (it waits until ${i.expiresAt})`,n,s)?"approve":"reject",via:"terminal"}:void 0}function Vn(e){let t;try{t=Qe(e,"utf8")}catch(n){return{ok:!1,refusal:{code:"PIPELINE_FILE_NOT_JSON",message:`${e} could not be read: ${n instanceof Error?n.message:String(n)}`,issues:[]}}}return se(t)}async function Un(e=process.argv,t={}){let n=t.env??process.env;if(e.slice(2).includes("--help")||e.slice(2).includes("-h")){process.stdout.write($n);return}let s;try{s=Sn(e,n)}catch(u){if(!(u instanceof I))throw u;process.stderr.write(`${u.message} Run with --help.
|
|
76
76
|
`),T(E);return}let i={line:u=>process[s.json?"stderr":"stdout"].write(`${u}
|
|
77
77
|
`),json:u=>{s.json&&process.stdout.write(`${JSON.stringify(u,null,2)}
|
|
78
|
-
`)}},r=t.pipelinesRoot??
|
|
79
|
-
`);i.json({tool:"sandforge-pipeline",refusals:u,exit:E}),T(E);return}let{file:a}=o;if(s.verb==="history"){
|
|
80
|
-
`),o.json({tool:"sandforge-pipeline",refusals:[x],exit:E}),T(E);return}w=g.lock,g.tookOver&&y.notes.push(
|
|
81
|
-
`),T(1);return}let g=await
|
|
82
|
-
`),o.json({tool:"sandforge-pipeline",pipeline:x,dryRun:n.dryRun,refusals:[{code:String(l.code??"RUN_FAILED"),message:_}],exit:f?E:1}),T(f?E:1);return}let b=A(
|
|
83
|
-
`);n.line(`Pipeline "${e.pipeline.name}": ${i.length} ${i.length===1?"run":"runs"} from the command line on this machine (${
|
|
84
|
-
`),T(E);return}let o=
|
|
85
|
-
`);T(E);return}let a;try{a=
|
|
86
|
-
`),T(1);return}try{let d=new Set(r.map(h=>String(h.config.orgId??""))),c={orgs:o.orgs.filter(h=>d.has(h.key)),values:{},refusals:[],notes:[]},u=await
|
|
87
|
-
`);T(E);return}let w=0;for(let h of r){let $=u.orgs.find(S=>S.key===h.config.orgId);if($?.org===void 0)continue;let P=String(h.config.checkpointId??"");i.line(`Rewind step "${h.name}" rewinds ${$.alias} to checkpoint ${P}.`);let v=await a.host.request({type:"checkpoint:preview",payload:{checkpointId:P},timeoutMs:
|
|
88
|
-
`),process.exit(1)}));export{E as REFUSED_EXIT,
|
|
78
|
+
`)}},r=t.pipelinesRoot??Te(n),o=Vn(s.file);if(!o.ok){let u=On(o.refusal,s.verb,s.file);for(let y of u)process.stderr.write(`${y.message}${y.wayOut?` Run it with: ${y.wayOut}`:""}
|
|
79
|
+
`);i.json({tool:"sandforge-pipeline",refusals:u,exit:E}),T(E);return}let{file:a}=o;if(s.verb==="history"){qn(a,r,i);return}let d=t.isTTY??process.stdin.isTTY===!0,c=s.store??Ln(r,a.pipeline.id);if(s.verb==="confirm"){await Jn(a,s,c,{...t,isTTY:d,version:t.version??qe()},i);return}await Kn(a,o.digestMatches,s,c,r,{isTTY:d,terminal:t.terminal,version:t.version??qe()},i)}async function Kn(e,t,n,s,i,r,o){let a=n.verb==="run",d=Ze(e,n.orgs),c=In(e,n.vars),u=bn(e,n,d.orgs),y={orgs:d.orgs,values:c.values,refusals:[...d.refusals,...c.refusals,...u],notes:[]},w,h=q(i,e.pipeline.id),$=Xe(h);if(a){let g=be(i,e.pipeline.id,{pipelineName:e.pipeline.name,ranFrom:"commandLine",triggeredBy:n.triggeredBy,...n.dryRun?{dryRun:!0}:{}});if("busy"in g){let x={code:"PIPELINE_RUNNING",message:J(g.busy,e.pipeline.name)};process.stderr.write(`${x.message}
|
|
80
|
+
`),o.json({tool:"sandforge-pipeline",refusals:[x],exit:E}),T(E);return}w=g.lock,g.tookOver&&y.notes.push(Ne(g.tookOver))}else{let g=Ee(i,e.pipeline.id);g!==void 0&&y.notes.push(J(g,e.pipeline.name))}let P=new AbortController,v,m,p,k=ce(g=>{v=g,P.abort(),o.line(`Stopping (${g}): the step under way is stopped, and the run ends cancelled.`),m!==void 0&&p!==void 0&&p.host.request({type:"execution:abort",payload:{operationId:m},timeoutMs:ne})}),R=a&&!n.dryRun?s:Bn(s),O=[],S=new Set,D=new Map(e.pipeline.steps.map((g,x)=>[g.id,x]));try{try{p=X({storeDir:R,log:l=>o.line(` ${l}`),setting:en(e,n.timeoutMs),notify:l=>o.line(` notification: ${l}`),sandforgeVersion:r.version,askApproval:Hn(n.approve,r.isTTY,r.terminal,P.signal),onPost:l=>{if(l.type!=="pipeline:step")return;let f=l.payload??{};f.status!=="running"&&f.stepId!==void 0&&S.add(f.stepId),Yn(l,e,D,o)}})}catch(l){process.stderr.write(`${l instanceof Error?l.message:String(l)}
|
|
81
|
+
`),T(1);return}let g=await nn(p,e,n,r,y);if(g.digestMatches=t,v!==void 0){T(W(v));return}for(let l of Gn(g))o.line(l);let x={id:e.pipeline.id,name:e.pipeline.name,file:n.file,digest:e.digest,digestMatches:t};if(g.refusals.length>0||!a){let l=g.refusals.length>0?E:0;o.json({tool:"sandforge-pipeline",pipeline:x,plan:!a,...a?{dryRun:n.dryRun}:{},orgs:Je(g.orgs),steps:(g.check?.steps??[]).map(f=>({name:f.name,type:f.type,fate:f.fate,...f.refusal!==void 0?{refusal:f.refusal}:{}})),refusals:g.refusals,notes:g.notes,exit:l}),T(l);return}w?.release(),w=void 0;let tn=Ye(p.configStore);m=`cli-${vn()}`,o.line(n.dryRun?"Dry run: the steps that write say what they would do.":"Run:");let L=await p.host.request({id:m,type:"pipeline:execute",responseType:"pipeline:run:response",payload:{pipeline:{...p.configStore.get(`pipeline:saved:${e.pipeline.id}`)??{}},variables:g.values,...n.dryRun?{dryRun:!0}:{}},timeoutMs:Rn});if(L.outcome!=="answered"){let l=A(L),f=l.code==="PIPELINE_RUNNING",_=F(L,"The run");process.stderr.write(`${_}
|
|
82
|
+
`),o.json({tool:"sandforge-pipeline",pipeline:x,dryRun:n.dryRun,refusals:[{code:String(l.code??"RUN_FAILED"),message:_}],exit:f?E:1}),T(f?E:1);return}let b=A(L),U=l=>g.orgs.find(f=>f.org?.id===l)?.alias,rn=l=>{let f=e.syncConfigs[l]?.targetOrgId;return g.orgs.find(_=>_.key===f)?.alias},sn=Fn(b.stepResults,U,s,rn);for(let[l,f]of b.stepResults.entries()){let _=sn[l];O.push({name:f.stepName,type:f.stepType,status:f.status,...f.summary!==void 0?{summary:f.summary}:{},...f.error!==void 0?{error:f.error}:{},...f.output!==void 0?{output:f.output}:{},..._!==void 0?{takeBack:_}:{}})}let K=jn(b,n.failOnPartial,v);o.line(`${n.dryRun?"Dry run":"Run"} ${b.status}${b.error?`: ${b.error}`:""} (exit ${K}).`);for(let[l,f]of O.entries())S.has(b.stepResults[l]?.stepId??"")||o.line(` ${f.type} "${f.name}": ${f.status}${f.summary?` \u2014 ${f.summary}`:""}${f.error?` \u2014 ${f.error}`:""}`);let te=O.filter(l=>l.takeBack!==void 0).reverse();if(te.length>0){o.line("To take this run back, in this order:");for(let l of te)o.line(` ${l.takeBack}`)}if(!n.dryRun){let l=We(p.configStore,p.backupDir,tn,U);l>0&&o.line(` ${l} snapshot${l===1?"":"s"} listed in ${p.backupDir}, where sandforge dataops restores from.`);for(let f of Dn(b.stepResults,U))o.line(` ${f}`);try{_e(i,e.pipeline.id,Mn(b,n.triggeredBy))}catch(f){o.line(` warning: the run was not kept in the history: ${f instanceof Error?f.message:String(f)}`)}}o.json({tool:"sandforge-pipeline",pipeline:x,dryRun:n.dryRun,status:b.status,startedAt:b.startTime,endedAt:b.endTime,triggeredBy:n.triggeredBy,orgs:Je(g.orgs),steps:O,approvals:b.stepResults.filter(l=>l.approval!==void 0).map(l=>({step:l.stepName,...l.approval})),notes:g.notes,exit:K}),T(K)}finally{k(),w?.release(),p?.dispose(),R!==s&&hn(R,{recursive:!0,force:!0}),n.dryRun&&!$&&Wn(h)}}function Wn(e){try{yn(e)}catch{}}function Yn(e,t,n,s){let i=e.payload??{},r=n.get(i.stepId??"");if(r===void 0)return;let o=t.pipeline.steps[r];if(o===void 0)return;let a=` ${r+1} ${o.type} "${o.name}"`;if(i.status==="running"){s.line(i.approval?`${a}: waits for its answer until ${i.approval.expiresAt??"?"}`:`${a}: running`);return}s.line(`${a}: ${i.status??"?"}${i.summary?` \u2014 ${i.summary}`:""}${i.error?` \u2014 ${i.error}`:""}`)}function qn(e,t,n){let s=[],i=Ae(t,r=>s.push(r)).read().filter(r=>r.pipelineId===e.pipeline.id);for(let r of s)process.stderr.write(`${r}
|
|
83
|
+
`);n.line(`Pipeline "${e.pipeline.name}": ${i.length} ${i.length===1?"run":"runs"} from the command line on this machine (${xe(t,e.pipeline.id)}).`);for(let r of i)n.line(` ${r.startTime} ${r.status} ${r.triggeredBy} ${r.stepCount} ${r.stepCount===1?"step":"steps"}${r.errorCount>0?`, ${r.errorCount} failed`:""}`);n.json({tool:"sandforge-pipeline",pipeline:{id:e.pipeline.id,name:e.pipeline.name},runs:i})}async function Jn(e,t,n,s,i){let r=e.pipeline.steps.filter(d=>d.type==="rewind");if(r.length===0){i.line(`Pipeline "${e.pipeline.name}" has no Rewind step: nothing to confirm.`);return}if(!s.isTTY){process.stderr.write(`confirm asks for each Rewind step's alias to be typed at a terminal: there is none. Give --confirm-rewind <alias> to run instead. Nothing was confirmed.
|
|
84
|
+
`),T(E);return}let o=Ze(e,t.orgs);if(o.refusals.length>0){for(let d of o.refusals)process.stderr.write(`${d.message} ${ee(d.wayOut??"")}
|
|
85
|
+
`);T(E);return}let a;try{a=X({storeDir:n,log:d=>i.line(` ${d}`),setting:en(e,void 0),notify:()=>{},sandforgeVersion:s.version})}catch(d){process.stderr.write(`${d instanceof Error?d.message:String(d)}
|
|
86
|
+
`),T(1);return}try{let d=new Set(r.map(h=>String(h.config.orgId??""))),c={orgs:o.orgs.filter(h=>d.has(h.key)),values:{},refusals:[],notes:[]},u=await nn(a,e,{...t,approve:[],confirmRewind:[]},{isTTY:!0},c),y=u.refusals.filter(h=>["ORG_NOT_CONNECTED","ORG_MOVED"].includes(h.code));if(y.length>0){for(let h of y)process.stderr.write(`${h.message} ${ee(h.wayOut??"")}
|
|
87
|
+
`);T(E);return}let w=0;for(let h of r){let $=u.orgs.find(S=>S.key===h.config.orgId);if($?.org===void 0)continue;let P=String(h.config.checkpointId??"");i.line(`Rewind step "${h.name}" rewinds ${$.alias} to checkpoint ${P}.`);let v=await a.host.request({type:"checkpoint:preview",payload:{checkpointId:P},timeoutMs:V});if(v.outcome!=="answered"){i.line(` ${F(v,"Its preview")} It is not confirmed.`),w+=1;continue}let m=await a.host.request({type:"checkpoint:list",timeoutMs:ne}),p=(A(m).checkpoints??[]).find(S=>S.checkpointId===P)?.checkpoint;for(let S of je($.alias,{name:p?.name??P,takenAt:p?.takenAt??""},A(v),$.org.username))i.line(` ${S}`);let k=await ue(`Type ${$.alias} to confirm this step's rewind:`,s.terminal);if(k!==$.alias){i.line(" Not confirmed: what was typed is not the alias."),w+=1;continue}let R=await a.host.request({type:"pipeline:rewind-grant",payload:{pipelineId:e.pipeline.id,stepId:h.id,typed:k},timeoutMs:V}),O=A(R);R.outcome==="answered"&&O.granted===!0?i.line(` Confirmed, kept in ${n}: the runs of this store rewind it without --confirm-rewind.`):(i.line(` Not confirmed: ${R.outcome==="answered"?String(O.code):F(R,"The confirmation")}.`),w+=1)}T(w>0?1:0)}finally{a.dispose()}}process.argv[1]?.includes("sandforge-pipeline")&&(Pe(),Un().then(()=>process.exit(process.exitCode??0)).catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
88
|
+
`),process.exit(1)}));export{E as REFUSED_EXIT,Ze as aliasesOf,Nn as checkRefusals,An as confirmLineOf,Ln as defaultStoreOf,On as fileRefusals,Mn as historyEntryOf,Un as main,Dn as maskedSnapshotLines,bn as namedStepRefusals,Sn as parseArgs,Gn as planLines,jn as runExit,en as settingOf,Cn as takeBackOf,Fn as takeBacksOf,xn as unconfirmedRewind,In as variablesOf};
|
package/lib/sandforge-seed.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,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-
|
|
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-C7CKDZMC.mjs";import"./chunk-RCW5BZNW.mjs";import"./chunk-DYHF6DNT.mjs";import"./chunk-KQVLZVOP.mjs";import"./chunk-YZQN7BRB.mjs";import"./chunk-QACFTHJM.mjs";import"./chunk-3HAVVEXF.mjs";import"./chunk-CZXDJXQP.mjs";import"./chunk-VRBETPHY.mjs";import"./chunk-BNHJCJJM.mjs";import"./chunk-IRQ4WANV.mjs";import"./chunk-H4OBZIX3.mjs";import"./chunk-JRLYWVF4.mjs";import"./chunk-PIQ2I67B.mjs";import"./chunk-FM4QCTO7.mjs";import"./chunk-PBHDPTT6.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-SUIPDW5O.mjs";import"./chunk-GYDTM62J.mjs";import"./chunk-5JMQXHJ2.mjs";import"./chunk-HLROVOR6.mjs";import"./chunk-WF5S4FW5.mjs";import"./chunk-FV6MOSHD.mjs";import"./chunk-T542Z54E.mjs";import"./chunk-DO6PSHQZ.mjs";import"./chunk-ZIKLQZBG.mjs";import"./chunk-FYG47CNA.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-Z5IUK2QO.mjs";import"./chunk-E5FSPXYH.mjs";import"./chunk-IQ5UKRHU.mjs";import"./chunk-VT6P3X6R.mjs";import"./chunk-ALWVNR34.mjs";import"./chunk-QHE2RUWX.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-TMIV3IWH.mjs";import"./chunk-CJAWKLAL.mjs";import"./chunk-PE7CHD2W.mjs";import"./chunk-VKREON6Q.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-DDNCJVZ2.mjs";import"./chunk-C5AUNG6T.mjs";import"./chunk-3I6FXFCN.mjs";import"./chunk-7O6EFNQS.mjs";import"./chunk-3LRFPGYZ.mjs";import"./chunk-34SMB5PA.mjs";import"./chunk-GB6W4Q56.mjs";import"./chunk-AVY742BJ.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-KWUS7UAV.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-HZCS6EED.mjs";import"./chunk-NV5QA2HY.mjs";import"./chunk-EGL3I3IX.mjs";import"./chunk-CSMGP53U.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-35B73566.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-PVZ72OOQ.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-TYUYPFDJ.mjs";import"./chunk-TICZXC53.mjs";import"./chunk-DLSU66MY.mjs";import"./chunk-ATQML7ZK.mjs";import"./chunk-H6BHWAX7.mjs";import"./chunk-4CSBZZAL.mjs";import"./chunk-AL4C3GFT.mjs";import"./chunk-GP5J3DGS.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-WQCXOZEJ.mjs";import"./chunk-OT2NHL2V.mjs";import"./chunk-ZVU7MD2S.mjs";import"./chunk-OLCS7JCT.mjs";import"./chunk-TQ6HEJ73.mjs";import"./chunk-65AMXOQU.mjs";import"./chunk-6HHSAPIM.mjs";import"./chunk-K5PUMHZU.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-EUIALBMX.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ATBQIE2V.mjs";import"./chunk-UCUFLFNK.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-4XROG5CT.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-DAUX63UB.mjs";import"./chunk-SZOJ7BEJ.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-22L43JMK.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-3KJCSYXY.mjs";import"./chunk-HDDJ3CVN.mjs";import"./chunk-J347SPU6.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};
|
package/lib/sandforge-sync.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,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-
|
|
7
|
+
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,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-PBHDPTT6.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-SUIPDW5O.mjs";import"./chunk-WF5S4FW5.mjs";import"./chunk-FV6MOSHD.mjs";import"./chunk-T542Z54E.mjs";import"./chunk-DO6PSHQZ.mjs";import"./chunk-ZIKLQZBG.mjs";import"./chunk-FYG47CNA.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-Z5IUK2QO.mjs";import"./chunk-E5FSPXYH.mjs";import"./chunk-IQ5UKRHU.mjs";import"./chunk-VT6P3X6R.mjs";import"./chunk-ALWVNR34.mjs";import"./chunk-QHE2RUWX.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-TMIV3IWH.mjs";import"./chunk-CJAWKLAL.mjs";import"./chunk-PE7CHD2W.mjs";import"./chunk-VKREON6Q.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-DDNCJVZ2.mjs";import"./chunk-C5AUNG6T.mjs";import"./chunk-3I6FXFCN.mjs";import"./chunk-7O6EFNQS.mjs";import"./chunk-3LRFPGYZ.mjs";import"./chunk-34SMB5PA.mjs";import"./chunk-GB6W4Q56.mjs";import"./chunk-AVY742BJ.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-KWUS7UAV.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-HZCS6EED.mjs";import"./chunk-NV5QA2HY.mjs";import"./chunk-EGL3I3IX.mjs";import"./chunk-CSMGP53U.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-35B73566.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-PVZ72OOQ.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-TYUYPFDJ.mjs";import"./chunk-TICZXC53.mjs";import"./chunk-DLSU66MY.mjs";import"./chunk-ATQML7ZK.mjs";import"./chunk-H6BHWAX7.mjs";import"./chunk-4CSBZZAL.mjs";import"./chunk-AL4C3GFT.mjs";import"./chunk-GP5J3DGS.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-WQCXOZEJ.mjs";import"./chunk-OT2NHL2V.mjs";import"./chunk-ZVU7MD2S.mjs";import"./chunk-OLCS7JCT.mjs";import"./chunk-TQ6HEJ73.mjs";import"./chunk-65AMXOQU.mjs";import"./chunk-6HHSAPIM.mjs";import"./chunk-K5PUMHZU.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-EUIALBMX.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ATBQIE2V.mjs";import"./chunk-UCUFLFNK.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-4XROG5CT.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-DAUX63UB.mjs";import"./chunk-SZOJ7BEJ.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-22L43JMK.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-3KJCSYXY.mjs";import"./chunk-HDDJ3CVN.mjs";import"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var export_jsforce=a.default;export{F as LINE_RUN,t as alreadyLinkedWords,d as anonymizedCopyArgs,E as bothRecorders,e as buildConfig,j as buildQueryFn,i as cliAllowsDeletes,m as cliCountFn,h as cliFileDeps,n as cliPersonAccountsFn,o as cliSourceIdsFn,P as configurationToldLines,z as contactPointLines,c as copiedAsHeldLine,C as deltaLine,y as encryptedLeftOutLine,p as inTheCommandsWords,S as jobLines,export_jsforce as jsforce,G as main,D as memoryCreations,w as objectCountsLine,A as objectCurrencyLines,v as objectErrorLines,B as objectPriceLines,x as objectWrittenLines,b as parseArgs,H as parseRemoveArgs,k as readCutLines,I as readRunSummary,f as readSavedConfig,s as recordTypeGivenOfObjectsLines,L as removalRefusal,M as removalSummaryLines,J as removalsPathOf,T as removeMain,N as restoredLines,Q as runFileOf,K as runOfSummary,R as runUserOfRunFile,g as savedConfigStore,u as simulationLines,l as statusWithReadCuts,q as syncApiRequestsJson,O as undeletedLines,r as writeCheckLines};
|
package/lib/sandforge-users.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{a as
|
|
7
|
+
import{a as ye,d as Se}from"./chunk-VUTQY76O.mjs";import{b as be,d as $e,e as Ie,f as Ae,g as Ee,i as ke,j as H,l as Oe,n as Ne,o as _e}from"./chunk-TCNBINOG.mjs";import{b as Ce}from"./chunk-CLUNF4FK.mjs";import{a as x,b as q,c as Ue,e as G,g as m,h as ve,j as Re}from"./chunk-RZOINFNL.mjs";import"./chunk-UV74P4H2.mjs";import{b as le}from"./chunk-Z5IUK2QO.mjs";import{c as P,d as ge}from"./chunk-6FARZYMJ.mjs";import{b as W,f as pe,h as fe,k as he}from"./chunk-DDNCJVZ2.mjs";import"./chunk-4CSBZZAL.mjs";import{a as ee,b as L}from"./chunk-AL4C3GFT.mjs";import{b as ue,c as ce}from"./chunk-WQCXOZEJ.mjs";import"./chunk-OT2NHL2V.mjs";import"./chunk-ZVU7MD2S.mjs";import{Kc as me}from"./chunk-OLCS7JCT.mjs";import"./chunk-TQ6HEJ73.mjs";import"./chunk-65AMXOQU.mjs";import"./chunk-6HHSAPIM.mjs";import"./chunk-K5PUMHZU.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-EUIALBMX.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ATBQIE2V.mjs";import"./chunk-UCUFLFNK.mjs";import"./chunk-MS4FJDFD.mjs";import{a as ie,c as de,f as E,h as we}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-DAUX63UB.mjs";import"./chunk-SZOJ7BEJ.mjs";import"./chunk-TZE3Y7IQ.mjs";import{b as z}from"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-22L43JMK.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import{lb as se,mb as re,nb as ne,ob as te,qb as oe,rb as ae}from"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{readFileSync as Qe}from"node:fs";function Je(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 Pe(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 Te(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 ve(s);if(f!==!0){let t=Re(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:Je(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} ${Ue(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(Pe(b)):C?.errors.some(Be=>Be.code==="ENTITY_IS_DELETED")||J(y,Pe(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])})},Ve=[()=>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 Ve)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",Xe={...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(Xe),{org:e.organization,run:n,status:Z,users:D,apiRequests:u()}}var X="sandforge-users",Ye="USERS_RUN_NOT_FOUND",Ze="USERS_RUN_REPLACED",es=`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.
|
|
@@ -135,21 +135,19 @@ Exit codes:
|
|
|
135
135
|
code and words, the others set up; or a removal kept something, said why
|
|
136
136
|
130 Ctrl-C (143 SIGTERM, 129 SIGHUP): the run ends after the step under
|
|
137
137
|
way, its file saying what it holds, for remove to take back
|
|
138
|
-
`,
|
|
139
|
-
`),process.exit(2)}function
|
|
140
|
-
`),process.exit(1)}let r=ce(s),n=await
|
|
141
|
-
`),process.exit(1)),n.kind==="production"&&(process.stderr.write(`${
|
|
138
|
+
`,ss=["plan","apply","remove"],ze={words:1,switches:["--dry-run","--yes","--json","--accept-user-emails","--accept-emails","--accept-automation","--include-changed"],values:["--org","--config","--run","--replaces"]},xe=["--org","--config","--replaces","--accept-user-emails","--accept-emails","--accept-automation","--json"],qe={plan:xe,apply:[...xe,"--dry-run","--yes"],remove:["--org","--run","--include-changed","--accept-automation","--yes","--json"]};function S(e){process.stderr.write(`${e} Nothing was run. Run with --help.
|
|
139
|
+
`),process.exit(2)}function Fe(e,s){return/^[1-9]\d{0,5}$/.test(s)||S(`${e} takes a run's number, as apply named it: "${s}" is not one.`),Number(s)}function rs(e){let[s]=e;s===void 0&&S("Name the verb: plan, apply or remove."),ss.includes(s)||S(s.startsWith("-")?`"${s}" comes before the verb: name plan, apply or remove first.`:`"${s}" is not a verb of ${L(X)}: plan, apply or remove.`);let r=s,n=ie(e,ze);n!==void 0&&S(n.replace(/ Nothing was run\.$/,""));let a=new Map,o=new Set;for(let f=1;f<e.length;f++){let h=e[f];ze.values.includes(h)?(a.has(h)&&S(`${h} is given twice.`),a.set(h,e[f+1]),f++):o.add(h)}for(let f of[...a.keys(),...o])qe[r].includes(f)||S(`${f} is not read by ${r}: it reads ${qe[r].join(", ")}.`);let u=a.get("--org");u===void 0&&S(`${r} needs --org <alias>.`),de.test(u)||S(`--org takes an sf alias or a username: "${u}" is neither (letters, digits, _ . @ + and -, not first . @ + or -).`);let l=a.get("--config");r!=="remove"&&l===void 0&&S(`${r} needs --config <file.json>.`);let c=a.get("--run");r==="remove"&&c===void 0&&S("remove needs --run <n>.");let d=a.get("--replaces");return r==="apply"&&o.has("--dry-run")&&o.has("--yes")&&S("--dry-run writes nothing and --yes writes: give one of them."),{verb:r,org:u,...l!==void 0?{config:l}:{},...c!==void 0?{run:Fe("--run",c)}:{},...d!==void 0?{replaces:Fe("--replaces",d)}:{},dryRun:o.has("--dry-run"),yes:o.has("--yes"),json:o.has("--json"),acceptUserEmails:o.has("--accept-user-emails"),acceptEmails:o.has("--accept-emails"),acceptAutomation:o.has("--accept-automation"),includeChanged:o.has("--include-changed")}}function ns(e){let s;try{s=Qe(e,"utf8")}catch(a){S(`--config ${e} could not be read (${z(a)}).`)}let r;try{r=JSON.parse(s)}catch(a){S(`--config ${e} is not JSON (${z(a)}).`)}let n=oe.safeParse(r);if(!n.success){let a=n.error.issues.map(o=>{let u=o.path.map((l,c)=>typeof l=="number"?`[${l}]`:`${c===0?"":"."}${String(l)}`).join("");return u===""?o.message:`${u}: ${o.message}`});S(`--config ${e}: ${a.join("; ")}.`)}return ae(n.data)}var ts={scratch:"scratch org",developer:"Developer Edition org",sandbox:"sandbox"};function F(e){let s=r=>r==="added"?"added":"taken back";switch(e.what){case"email":return"address asked back";case"active":return e.to?"activated":"deactivated";case"frozen":return e.to?"frozen":"unfrozen";case"profile":return`profile ${e.to} in place of ${e.from}`;case"permissionSet":return`permission set ${e.name} ${s(e.to)}`;case"permissionSetGroup":return`permission set group ${e.name} ${s(e.to)}`;case"group":return`${e.type==="Queue"?"queue":"group"} ${e.name} ${s(e.to)}`}}var os=`address awaiting its owner's confirmation \u2014 Salesforce sent the link to it; until it is clicked (${G} h), the address stays .invalid`;function B(e){return`${e.alias??e.organizationId} (${ts[e.kind]}, ${e.organizationId})`}function as(e){return e.map(s=>ge(s,"a run now"))}function is(e,s){let r=s.edition?`IsSandbox false, edition ${s.edition}`:"IsSandbox false, and no edition";return`${e} is a production org (its Organization record says ${r}): ${L(X)} sets up the users of a sandbox, a scratch org or a Developer Edition org, and reads nothing of a production org. Nothing was read or written.`}async function je(e){let s;try{s=await ue(e)}catch(a){process.stderr.write(`${z(a)}
|
|
140
|
+
`),process.exit(1)}let r=ce(s),n=await be(r,{alias:e,scratch:s.scratch===!0});return n.kind==="untyped"&&(process.stderr.write(`${le(e,n.err,{tool:L(X),action:"write",readOnly:"plan"})}
|
|
141
|
+
`),process.exit(1)),n.kind==="production"&&(process.stderr.write(`${is(e,n.typed)}
|
|
142
142
|
`),process.exit(1)),n.kind==="otherSession"&&(process.stderr.write(`The session sf gave for ${e} is of ${n.sessionOrganizationId}, and its Organization record says ${n.typed.id}: nothing was read or written. Sign in to ${e} again with sf.
|
|
143
|
-
`),process.exit(1)),{conn:r,org:n.org,organization:n.organization,typingRequests:n.typingRequests}}function
|
|
144
|
-
`),process.exit(1)}}function
|
|
143
|
+
`),process.exit(1)),{conn:r,org:n.org,organization:n.organization,typingRequests:n.typingRequests}}function De(){try{return new Se({root:ye()})}catch(e){process.stderr.write(`${z(e)} Nothing was read or written.
|
|
144
|
+
`),process.exit(1)}}function Me(e,s,r){if(e.kind==="none")return["automation: none read: this run writes no user and no login"];if(e.kind==="unread")return[`automation: what ${s} runs as ${r} could not be read (${e.reason})`];let n=Ee(e),a=me(e.automation);return n.length===0&&a.length===0?[`automation: ${s} runs nothing as ${r}`]:[...n.length>0?[`automation: ${s} runs as ${r}:`]:[],...n.map(o=>` ${$e(o)}`),...a.map(({part:o,reason:u})=>` ${Ie(o)} of ${s} could not be read: ${u}`)]}function ds(e,s){let{reading:r}=e;return"unread"in r?`deliverability: not read (${r.unread})`:r.level==="all"?`deliverability: All email \u2014 what runs in ${s} emails the addresses its records hold`:"deliverability: closed \u2014 System email only or No access: what runs there emails nobody. Which of the two, no API says."}function We(e){return s=>(e?process.stderr:process.stdout).write(`${s}
|
|
145
145
|
`)}function k(e){process.stdout.write(`${JSON.stringify(e,null,2)}
|
|
146
|
-
`)}function
|
|
147
|
-
|
|
148
|
-
`),e.abort()});return{signal:e.signal,stopped:()=>s,release:r}}async function fs(e,s){let r=Me(e.json),n=await Le(e.org),{conn:a,org:o,organization:u}=n,l=je(),c=g=>n.typingRequests+o.requests()+g,d;if(e.replaces!==void 0){let g=await us(l,u.organizationId,e.replaces);if("refusal"in g){let A=ds(u,g.refusal,c(0));r(`plan of the users of ${B(u)}`),process.stderr.write(`${P(g.refusal)}
|
|
149
|
-
`),e.json&&k(A),E(1);return}d=g.record}let f=await Oe({conn:a,org:o,orgName:e.org,users:s,...d?{previous:d}:{},acceptUserEmails:e.acceptUserEmails,acceptEmails:e.acceptEmails,acceptAutomation:e.acceptAutomation}),{deliverability:h,automation:$}=f,R=c(f.outsideRequests),w=Ne(f,u,R),I=w.refusals??[];for(let g of cs(w,{...h?{deliverability:h}:{},automation:$,sent:R},e))r(g);if(e.verb==="plan"||e.dryRun){e.dryRun&&r("a dry run: nothing was written"),e.json&&k(w),E(I.length>0?1:0);return}if(I.length>0){for(let g of I)process.stderr.write(`${P(g)}
|
|
146
|
+
`)}function us(e,s,r){return{org:e,users:[],emailsToPeople:0,apiRequests:r,refusals:[s]}}async function cs(e,s,r){let n=await e.read(s,r);if(!n)return{refusal:{code:Ye,message:`--replaces ${r}: this machine keeps no run of that number for this org, whose Organization Id is ${s}: a sandbox refreshed since answers another, and its runs went with the copy they set up. Plan without --replaces to set the users up anew`}};let a=(await e.list(s)).find(o=>o.replaces===r);return a?{refusal:{code:Ze,message:`run ${r} was replaced by run ${a.run}, which holds what it set up: --replaces ${a.run}`}}:{record:n}}function ls(e,s,r){let n=r.org,a=[`plan of the users of ${B(e.org)}`];for(let o of e.users){let u=o.given!==void 0?`${o.username} (${o.given} in the config)`:o.username,l;o.userId===void 0?l="no single user has this username (below)":o.changes.length>0?l=o.changes.map(F).join(", "):o.address==="awaiting"?l="its address asked back by an earlier run, awaiting its owner's click":l="as the config says already: nothing to do",a.push(` ${u}: ${l}`)}return e.licenses!==void 0&&a.push(`licenses: ${e.licenses.map(o=>`${o.name} ${o.used} of ${o.total} used, ${o.toUse} more`).join("; ")}`),e.emailsToPeople>0&&a.push(`emails to people: ${e.emailsToPeople}, the confirmation of each address asked back, a system email, which leaves under System email only too`+(r.acceptUserEmails?"; accepted (--accept-user-emails)":"")),s.deliverability!==void 0&&a.push(ds(s.deliverability,n)),a.push(...Me(s.automation,n,"users are written")),a.push(`API requests: ${s.sent} sent by this plan; an apply sends about ${e.apiRequests}`),a.push(...as(e.refusals??[])),a}function ps(e,s){let r=[`run ${e.run} of the users of ${B(e.org)}: ${e.status}`];for(let n of e.users){let a=n.done.filter(o=>o.what!=="email");a.length>0&&r.push(` ${n.username}: ${a.map(F).join(", ")}`),n.address==="awaiting"&&n.done.some(o=>o.what==="email")&&r.push(` ${n.username}: ${os}`),n.address==="restored"&&n.done.some(o=>o.what==="email")&&r.push(` ${n.username}: address restored`);for(let o of n.refused??[])r.push(` ${n.username}: refused ${F(o.change)}: ${o.code} ${o.message}`);n.done.length===0&&(n.refused??[]).length===0&&r.push(` ${n.username}: nothing to do`)}return r.push(`taken back by: ${ee("users")} remove --org ${s} --run ${e.run} --yes`),r.push(`API requests: ${e.apiRequests}`),r}function fs(e,s){let r=[`removal of run ${e.run} of the users of ${s}: ${e.status}`];for(let n of e.users){r.push(` ${n.username}: ${n.undone.length>0?n.undone.map(F).join(", "):"nothing put back"}`);for(let a of n.kept??[])r.push(` ${n.username}: kept ${F(a.change)}: ${a.why}`)}for(let n of e.refusals??[])r.push(P(n));return r.push(`API requests: ${e.apiRequests}`),r}function Ge(e,s){return e==="cancelled"?pe(s??"SIGINT"):e==="partial"?3:e==="failure"?1:0}function He(){let e=new AbortController,s,r=he(n=>{s=n,fe("the run ends after the step under way, its file saying what it holds",n),e.abort()});return{signal:e.signal,stopped:()=>s,release:r}}async function hs(e,s){let r=We(e.json),n=await je(e.org),{conn:a,org:o,organization:u}=n,l=De(),c=g=>n.typingRequests+o.requests()+g,d;if(e.replaces!==void 0){let g=await cs(l,u.organizationId,e.replaces);if("refusal"in g){let A=us(u,g.refusal,c(0));r(`plan of the users of ${B(u)}`),process.stderr.write(`${P(g.refusal)}
|
|
147
|
+
`),e.json&&k(A),E(1);return}d=g.record}let f=await Ne({conn:a,org:o,orgName:e.org,users:s,...d?{previous:d}:{},acceptUserEmails:e.acceptUserEmails,acceptEmails:e.acceptEmails,acceptAutomation:e.acceptAutomation}),{deliverability:h,automation:$}=f,R=c(f.outsideRequests),w=_e(f,u,R),I=w.refusals??[];for(let g of ls(w,{...h?{deliverability:h}:{},automation:$,sent:R},e))r(g);if(e.verb==="plan"||e.dryRun){e.dryRun&&r("a dry run: nothing was written"),e.json&&k(w),E(I.length>0?1:0);return}if(I.length>0){for(let g of I)process.stderr.write(`${P(g)}
|
|
150
148
|
`);process.stderr.write(`Nothing was written.
|
|
151
|
-
`),e.json&&k(w),E(1);return}let T=w.users.filter(g=>g.changes.length>0).length;if(!e.yes){let g=`Set up ${T} user${T===1?"":"s"} of ${e.org} as above`+(w.emailsToPeople>0?`, Salesforce emailing ${w.emailsToPeople} ${w.emailsToPeople===1?"person":"people"}?`:"?");if(!await W(g)){r("Nothing was written.");return}}let O=
|
|
149
|
+
`),e.json&&k(w),E(1);return}let T=w.users.filter(g=>g.changes.length>0).length;if(!e.yes){let g=`Set up ${T} user${T===1?"":"s"} of ${e.org} as above`+(w.emailsToPeople>0?`, Salesforce emailing ${w.emailsToPeople} ${w.emailsToPeople===1?"person":"people"}?`:"?");if(!await W(g)){r("Nothing was written.");return}}let O=He(),N;try{N=await Ce({org:o,organization:u,users:s,store:l,signal:O.signal,...f.options})}finally{O.release()}if(N.kind==="refused"){let g=N.plan;for(let A of g.refusals??[])process.stderr.write(`${P(A)}
|
|
152
150
|
`);process.stderr.write(`The org changed since the plan read it. Nothing was written.
|
|
153
|
-
`),e.json&&k(g),E(1);return}let _={...N.answer,apiRequests:c(f.outsideRequests)};for(let g of
|
|
154
|
-
`),e.json&&k(I),E(1);return}if(!e.yes&&!await W(`Take back run ${r} of the users of ${e.org}?`)){s("Nothing was written.");return}}let h=
|
|
155
|
-
`),process.exit(1)}));export{
|
|
151
|
+
`),e.json&&k(g),E(1);return}let _={...N.answer,apiRequests:c(f.outsideRequests)};for(let g of ps(_,e.org))r(g);e.json&&k(_),E(Ge(_.status,O.stopped()))}async function gs(e){let s=We(e.json),r=e.run??0,n=await je(e.org),{conn:a,org:o,organization:u}=n,l=De(),c={kind:"none"},d=await l.read(u.organizationId,r),f=d!==void 0&&(await l.list(u.organizationId)).some(w=>w.replaces===r);if(d!==void 0&&!f){c=await Ae(a,e.org,Oe(d));let w=ke(c,e.org,"users are put back",e.acceptAutomation);if(c.kind!=="none")for(let I of Me(c,e.org,"users are put back"))s(I);if(w!==void 0){let I={org:u,run:r,status:"failure",users:[],apiRequests:n.typingRequests+o.requests()+H(c),refusals:[w]};process.stderr.write(`${P(w)}
|
|
152
|
+
`),e.json&&k(I),E(1);return}if(!e.yes&&!await W(`Take back run ${r} of the users of ${e.org}?`)){s("Nothing was written.");return}}let h=He(),$;try{$=await Te({org:o,organization:u,store:l,run:r,includeChanged:e.includeChanged,signal:h.signal})}finally{h.release()}let R={...$,apiRequests:n.typingRequests+o.requests()+H(c)};for(let w of fs(R,e.org))s(w);e.json&&k(R),E(Ge(R.status,h.stopped()))}async function ms(e=process.argv){let s=e.slice(2);if(s.includes("--help")||s.includes("-h")){process.stdout.write(es);return}let r=rs(s);if(r.verb==="remove"){await gs(r);return}await hs(r,ns(r.config??""))}/sandforge-users\.[cm]?[jt]s$/.test(process.argv[1]??"")&&(we(),ms().then(()=>process.exit(process.exitCode??0)).catch(e=>{process.stderr.write(`${e instanceof Error?e.stack??e.message:String(e)}
|
|
153
|
+
`),process.exit(1)}));export{es as HELP,ze as USERS_FLAGS,Ye as USERS_RUN_NOT_FOUND,Ze as USERS_RUN_REPLACED,F as changeWords,ms as main,rs as parseArgs,ns as readConfig,is as usersProductionRefusal};
|
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-
|
|
7
|
+
import{a,b,c,d,e,f}from"./chunk-YSVAHT4Q.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 = "mask an org's records
|
|
3
|
-
static description = "sandforge dataops — mask an org's records
|
|
2
|
+
static summary = "mask an org's records and put them back, verify a masking, list templates";
|
|
3
|
+
static description = "sandforge dataops — mask an org's records and put them back, verify a masking, list templates, without the editor.\n\nThe whole help, its options and its exit codes: sf sandforge dataops --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-
|
|
7
|
+
import{f as i}from"./chunk-YSVAHT4Q.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}
|