sandforge 1.80.0 → 1.81.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/bin/sandforge-pipeline.mjs +12 -0
- package/lib/{chunk-EMNC6YI4.mjs → chunk-2IB7I3IQ.mjs} +1 -1
- package/lib/{chunk-3RZQZHEB.mjs → chunk-2NAIUKVL.mjs} +1 -1
- package/lib/{chunk-AEKONPF4.mjs → chunk-2OIRJEYE.mjs} +1 -1
- package/lib/{chunk-BV6VTP3J.mjs → chunk-2OZG6GRW.mjs} +1 -1
- package/lib/{chunk-JEERQRLW.mjs → chunk-2Z54GB6X.mjs} +1 -1
- package/lib/chunk-2ZMGVBLW.mjs +7 -0
- package/lib/{chunk-FKG7Q3WH.mjs → chunk-33ZX3A56.mjs} +1 -1
- package/lib/{chunk-HLWMJF6Y.mjs → chunk-3AOKLIVE.mjs} +1 -1
- package/lib/{chunk-GGD7ON3M.mjs → chunk-3B5H24ZG.mjs} +1 -1
- package/lib/chunk-43K2C6H2.mjs +7 -0
- package/lib/chunk-4JKR4PTZ.mjs +8 -0
- package/lib/chunk-4L7FBOJS.mjs +8 -0
- package/lib/chunk-5344TZBT.mjs +11 -0
- package/lib/{chunk-SAR5622P.mjs → chunk-54HYHHVL.mjs} +1 -1
- package/lib/chunk-55LQD3Y3.mjs +7 -0
- package/lib/chunk-56MPPWLA.mjs +7 -0
- package/lib/chunk-5C5XEVZN.mjs +11 -0
- package/lib/chunk-5CKWGZX4.mjs +9 -0
- package/lib/{chunk-RSWDYIHY.mjs → chunk-5GBO4KD5.mjs} +1 -1
- package/lib/{chunk-BKDV4ENO.mjs → chunk-5UT2ZBGF.mjs} +1 -1
- package/lib/chunk-5VQNKDFU.mjs +7 -0
- package/lib/{chunk-XAMBCQPU.mjs → chunk-5WGA5CZB.mjs} +1 -1
- package/lib/chunk-5ZKCLBTN.mjs +474 -0
- package/lib/{chunk-UCD54V2M.mjs → chunk-67CC7RAE.mjs} +1 -1
- package/lib/{chunk-TSLJUSLW.mjs → chunk-6CDIIFNX.mjs} +1 -1
- package/lib/{chunk-AV5SWEHP.mjs → chunk-6FARZYMJ.mjs} +1 -1
- package/lib/{chunk-FPKYYFM7.mjs → chunk-6FMLW7PH.mjs} +1 -1
- package/lib/chunk-6IGEASOF.mjs +7 -0
- package/lib/{chunk-XUWL6ZPC.mjs → chunk-6NADW3OI.mjs} +1 -1
- package/lib/chunk-6SEDOIO3.mjs +10 -0
- package/lib/{chunk-PJ5I73CK.mjs → chunk-742SSN7I.mjs} +1 -1
- package/lib/chunk-7DALDJMO.mjs +7 -0
- package/lib/chunk-7PK5QDQI.mjs +7 -0
- package/lib/chunk-AELFEK3G.mjs +7 -0
- package/lib/chunk-AITNZWLB.mjs +9 -0
- package/lib/{chunk-2UZPIMUC.mjs → chunk-AJPSGVMD.mjs} +1 -1
- package/lib/{chunk-GSKCGQIP.mjs → chunk-BNO5GIJ6.mjs} +1 -1
- package/lib/{chunk-K2FBZIXY.mjs → chunk-BWWQXU2B.mjs} +1 -1
- package/lib/{chunk-IC2C2GOF.mjs → chunk-BXZ73A5M.mjs} +1 -1
- package/lib/chunk-BZFIOZS3.mjs +156 -0
- package/lib/{chunk-J525F5KI.mjs → chunk-C4YGSK6W.mjs} +1 -1
- package/lib/chunk-CAFUNR6D.mjs +7 -0
- package/lib/chunk-CULAOP3U.mjs +7 -0
- package/lib/chunk-D62KWDDT.mjs +7 -0
- package/lib/{chunk-OHWNPXWW.mjs → chunk-D7P7DTWL.mjs} +1 -1
- package/lib/{chunk-COFG7Q6R.mjs → chunk-DHGPDSXS.mjs} +1 -1
- package/lib/{chunk-WU3GLFZO.mjs → chunk-DHIW4IO5.mjs} +1 -1
- package/lib/{chunk-6XYKJSGX.mjs → chunk-DMBR24CK.mjs} +1 -1
- package/lib/chunk-DPYTG6DM.mjs +48 -0
- package/lib/{chunk-BY2HJFFG.mjs → chunk-DQR5NDMI.mjs} +1 -1
- package/lib/chunk-DXOXLUZA.mjs +7 -0
- package/lib/{chunk-YRQGKDHM.mjs → chunk-E2OBAWSH.mjs} +1 -1
- package/lib/chunk-E2YJVSX6.mjs +10 -0
- package/lib/{chunk-JWTSEDIQ.mjs → chunk-EAFLDSQ2.mjs} +1 -1
- package/lib/{chunk-MILU7WFN.mjs → chunk-EH5YUA5W.mjs} +1 -1
- package/lib/{chunk-BGUEWRK2.mjs → chunk-EOSEMFPU.mjs} +1 -1
- package/lib/chunk-ETT5GP4P.mjs +13 -0
- package/lib/{chunk-MYW5QNGI.mjs → chunk-FDGFUEK3.mjs} +1 -1
- package/lib/{chunk-NTFIRZP6.mjs → chunk-FLNLG43R.mjs} +1 -1
- package/lib/{chunk-CHYDMRSV.mjs → chunk-FSDO4DJA.mjs} +1 -1
- package/lib/{chunk-MJVTDA5Q.mjs → chunk-FSZTXLNW.mjs} +1 -1
- package/lib/{chunk-SOU4FRYN.mjs → chunk-FTA5LOVX.mjs} +1 -1
- package/lib/chunk-G4VXPS3A.mjs +7 -0
- package/lib/chunk-GF247DA7.mjs +7 -0
- package/lib/{chunk-BTWDMNN3.mjs → chunk-GK7VEYFM.mjs} +1 -1
- package/lib/{chunk-SE4QEZUG.mjs → chunk-GR3NGDVM.mjs} +1 -1
- package/lib/{chunk-3TJON4F3.mjs → chunk-GTIXJCGS.mjs} +1 -1
- package/lib/{chunk-NZC67CGR.mjs → chunk-GWRKS3AL.mjs} +1 -1
- package/lib/{chunk-XLXIPIEW.mjs → chunk-GYKNCYES.mjs} +1 -1
- package/lib/{chunk-WIO4XO4F.mjs → chunk-HFSBDM7B.mjs} +1 -1
- package/lib/{chunk-KDGMAGQR.mjs → chunk-HVC5CYIB.mjs} +1 -1
- package/lib/{chunk-WR4Q363I.mjs → chunk-HYBH5PFM.mjs} +1 -1
- package/lib/chunk-HYOOJVR6.mjs +7 -0
- package/lib/{chunk-5K5VLULK.mjs → chunk-IBURU7T7.mjs} +1 -1
- package/lib/chunk-ICIYL45C.mjs +7 -0
- package/lib/{chunk-QR3WELJQ.mjs → chunk-IKGHRYCN.mjs} +1 -1
- package/lib/chunk-IM2XA6JI.mjs +7 -0
- package/lib/{chunk-IWDREM66.mjs → chunk-J6G23RUI.mjs} +1 -1
- package/lib/{chunk-2BA2XKAY.mjs → chunk-JU2XEKEO.mjs} +1 -1
- package/lib/{chunk-MHMH6MTP.mjs → chunk-K55LH4ZQ.mjs} +1 -1
- package/lib/chunk-K5HV4YRO.mjs +7 -0
- package/lib/{chunk-M3ROUWDX.mjs → chunk-K77NR3UK.mjs} +1 -1
- package/lib/chunk-KE2PGD6C.mjs +7 -0
- package/lib/chunk-KGYXLSQ5.mjs +37 -0
- package/lib/{chunk-E5AHXLS6.mjs → chunk-KNIRA333.mjs} +1 -1
- package/lib/chunk-KOQV4WXC.mjs +8 -0
- package/lib/{chunk-L77FJZEP.mjs → chunk-KRNFVAGC.mjs} +1 -1
- package/lib/{chunk-MTMH6H2A.mjs → chunk-LCDPCUXS.mjs} +1 -1
- package/lib/{chunk-YAZO75G2.mjs → chunk-LNXBCE7E.mjs} +1 -1
- package/lib/{chunk-IZQZ6ZUF.mjs → chunk-LO527YLT.mjs} +1 -1
- package/lib/chunk-MAHZMPMZ.mjs +7 -0
- package/lib/{chunk-F6GUDTOB.mjs → chunk-MHW6DV6T.mjs} +1 -1
- package/lib/{chunk-2YIV2OB2.mjs → chunk-MIDBQ7SD.mjs} +1 -1
- package/lib/{chunk-FGRG7ANU.mjs → chunk-MKNAZPOT.mjs} +1 -1
- package/lib/{chunk-PZPJKATS.mjs → chunk-MNITSYI2.mjs} +8 -8
- package/lib/{chunk-OLSGVAIL.mjs → chunk-MO3N5XVV.mjs} +53 -53
- package/lib/chunk-MWLFFVQV.mjs +8 -0
- package/lib/chunk-N6HHNR6J.mjs +7 -0
- package/lib/chunk-N7J6NJQ6.mjs +7 -0
- package/lib/chunk-NJ3EOEHS.mjs +9 -0
- package/lib/chunk-NWPQF5XR.mjs +7 -0
- package/lib/{chunk-IG2MTQRP.mjs → chunk-NWVVCZUK.mjs} +1 -1
- package/lib/{chunk-2NBYT7GR.mjs → chunk-O6ADMP36.mjs} +1 -1
- package/lib/chunk-O7DAFE6M.mjs +14 -0
- package/lib/chunk-OEHVAJAB.mjs +7 -0
- package/lib/chunk-OETEC3P7.mjs +7 -0
- package/lib/{chunk-GCOB7K5N.mjs → chunk-OHEOJISY.mjs} +1 -1
- package/lib/chunk-OIIL4NVI.mjs +7 -0
- package/lib/chunk-OMZJ37JI.mjs +15 -0
- package/lib/{chunk-CEX3NEZL.mjs → chunk-ONMBSACW.mjs} +1 -1
- package/lib/chunk-OQQHNYR7.mjs +272 -0
- package/lib/{chunk-SOGQW4IG.mjs → chunk-OU5W7SCB.mjs} +1 -1
- package/lib/{chunk-O2HDYYUV.mjs → chunk-OVOLG3AL.mjs} +1 -1
- package/lib/{chunk-DYFALGRT.mjs → chunk-OXKZ4Y3B.mjs} +1 -1
- package/lib/{chunk-2GTBABKU.mjs → chunk-OZNLOV4U.mjs} +1 -1
- package/lib/{chunk-TYYOBZMU.mjs → chunk-PC247GKX.mjs} +1 -1
- package/lib/chunk-PPGDAUEQ.mjs +7 -0
- package/lib/{chunk-IGYH7GMA.mjs → chunk-PYUEHBA6.mjs} +1 -1
- package/lib/{chunk-TLH7AD35.mjs → chunk-PZBZ7MNC.mjs} +1 -1
- package/lib/{chunk-DBFJB2B6.mjs → chunk-QIRO4HTE.mjs} +1 -1
- package/lib/{chunk-BXU6WFMH.mjs → chunk-QXLZINZB.mjs} +1 -1
- package/lib/chunk-R2BJWO5N.mjs +20 -0
- package/lib/chunk-R6TF26V4.mjs +10 -0
- package/lib/{chunk-YKKRIEH4.mjs → chunk-RKALOKAU.mjs} +1 -1
- package/lib/chunk-SQGP46QS.mjs +7 -0
- package/lib/chunk-SW2NUKQL.mjs +9 -0
- package/lib/{chunk-MFG4MUIO.mjs → chunk-T26C576X.mjs} +1 -1
- package/lib/{chunk-LKQ5RKIV.mjs → chunk-T3PLRQ2T.mjs} +1 -1
- package/lib/chunk-T5VAULLQ.mjs +7 -0
- package/lib/{chunk-KYEDBS54.mjs → chunk-TEIBWMJM.mjs} +1 -1
- package/lib/chunk-TKQQVB2D.mjs +9 -0
- package/lib/{chunk-ELFXJHU7.mjs → chunk-TPHXRHOA.mjs} +1 -1
- package/lib/chunk-TQ2TQHTT.mjs +9 -0
- package/lib/{chunk-RPI7LRTW.mjs → chunk-TQM2XJ27.mjs} +1 -1
- package/lib/{chunk-IOIWJ3DJ.mjs → chunk-UCHAZ4ZU.mjs} +1 -1
- package/lib/{chunk-G35N4P7D.mjs → chunk-UIUPPEFB.mjs} +1 -1
- package/lib/{chunk-DBB3EMIN.mjs → chunk-UT27HXE7.mjs} +1 -1
- package/lib/{chunk-KBJ5VERV.mjs → chunk-UUSLTW5V.mjs} +1 -1
- package/lib/chunk-V2QO6KOE.mjs +19 -0
- package/lib/chunk-V473C7LY.mjs +7 -0
- package/lib/chunk-V4RKM4QZ.mjs +8 -0
- package/lib/chunk-VSU74RQ3.mjs +9 -0
- package/lib/chunk-VV3B6IC3.mjs +7 -0
- package/lib/chunk-W2AAGIZF.mjs +7 -0
- package/lib/{chunk-WR2GIKWE.mjs → chunk-WB2RIVO3.mjs} +1 -1
- package/lib/chunk-WD47PGUS.mjs +10 -0
- package/lib/{chunk-HEKAZJRH.mjs → chunk-WEZLXE34.mjs} +1 -1
- package/lib/{chunk-W622GUAW.mjs → chunk-WI4HYWV6.mjs} +1 -1
- package/lib/{chunk-WA7EYLAQ.mjs → chunk-WM5JI4JI.mjs} +1 -1
- package/lib/chunk-WWTXRWNZ.mjs +7 -0
- package/lib/{chunk-7EANH5PY.mjs → chunk-WZQEK4WT.mjs} +1 -1
- package/lib/{chunk-FXXLX4O6.mjs → chunk-X2ZVSQ54.mjs} +1 -1
- package/lib/{chunk-ZVAED4QV.mjs → chunk-XC2QKQT5.mjs} +1 -1
- package/lib/chunk-XC54KKKC.mjs +7 -0
- package/lib/chunk-XEB6HZ34.mjs +7 -0
- package/lib/chunk-XGKSSCW7.mjs +7 -0
- package/lib/chunk-XIZ5LMQM.mjs +7 -0
- package/lib/{chunk-74Q6DORA.mjs → chunk-Y5ZCPY36.mjs} +1 -1
- package/lib/{chunk-UNJA4J37.mjs → chunk-YCSFP6ER.mjs} +4 -4
- package/lib/{chunk-X5JYBPXP.mjs → chunk-YHIOS2PU.mjs} +1 -1
- package/lib/chunk-YIGFYZQY.mjs +7 -0
- package/lib/chunk-YJEXE6HZ.mjs +925 -0
- package/lib/{chunk-TTKXMDBN.mjs → chunk-YOGMP72T.mjs} +4 -4
- package/lib/chunk-ZRUDYB7O.mjs +7 -0
- package/lib/{chunk-CU2INBND.mjs → chunk-ZUA5BNAO.mjs} +1 -1
- package/lib/chunk-ZWCRWF7E.mjs +7 -0
- package/lib/{chunk-N652NMZ4.mjs → chunk-ZWZXQTAK.mjs} +52 -52
- package/lib/sandforge-autopilot.mjs +11 -11
- package/lib/sandforge-backup.mjs +63 -32
- package/lib/sandforge-checkpoint.mjs +1 -348
- package/lib/sandforge-cleanup.mjs +1 -1
- package/lib/sandforge-clone.mjs +1 -1
- package/lib/sandforge-compare.mjs +1 -1
- package/lib/sandforge-dataops.mjs +1 -1
- package/lib/sandforge-empty.mjs +11 -11
- package/lib/sandforge-env.mjs +104 -104
- package/lib/sandforge-frozen.mjs +1 -266
- package/lib/sandforge-mcp.mjs +33 -14
- package/lib/sandforge-monitor.mjs +1 -1
- package/lib/sandforge-pipeline.mjs +88 -0
- package/lib/sandforge-seed.mjs +1 -1
- package/lib/sandforge-sync.mjs +1 -1
- package/lib/sandforge.mjs +6 -6
- package/package.json +2 -1
- package/lib/chunk-2CNCDM56.mjs +0 -7
- package/lib/chunk-3F6Q5E7I.mjs +0 -14
- package/lib/chunk-4VS2V6WU.mjs +0 -25
- package/lib/chunk-5P4PHJRL.mjs +0 -9
- package/lib/chunk-5TC3QB4U.mjs +0 -10
- package/lib/chunk-7ABODJ4G.mjs +0 -7
- package/lib/chunk-7EGQP6S4.mjs +0 -7
- package/lib/chunk-7FFGJWHN.mjs +0 -7
- package/lib/chunk-7YDNUBO5.mjs +0 -7
- package/lib/chunk-A527W53V.mjs +0 -7
- package/lib/chunk-ADOAS63R.mjs +0 -7
- package/lib/chunk-B5QQJ4SI.mjs +0 -7
- package/lib/chunk-CION3VMZ.mjs +0 -7
- package/lib/chunk-CSBS5U5I.mjs +0 -7
- package/lib/chunk-DB7RBE5D.mjs +0 -7
- package/lib/chunk-E5ZB3LU5.mjs +0 -7
- package/lib/chunk-EFR2Y7E4.mjs +0 -7
- package/lib/chunk-EHQ3FX6X.mjs +0 -7
- package/lib/chunk-EQNW3UC2.mjs +0 -7
- package/lib/chunk-F43REJDZ.mjs +0 -10
- package/lib/chunk-GSG7WZHM.mjs +0 -7
- package/lib/chunk-HOJYWTP7.mjs +0 -20
- package/lib/chunk-HS4YRX4J.mjs +0 -7
- package/lib/chunk-I7O6C2B5.mjs +0 -8
- package/lib/chunk-IFETCRWE.mjs +0 -10
- package/lib/chunk-IQXHJEYB.mjs +0 -7
- package/lib/chunk-JPUR2CFX.mjs +0 -10
- package/lib/chunk-K327QKMD.mjs +0 -7
- package/lib/chunk-KRCA6IPH.mjs +0 -8
- package/lib/chunk-LPBMBW3O.mjs +0 -13
- package/lib/chunk-LWW4U276.mjs +0 -7
- package/lib/chunk-MJU2PGZQ.mjs +0 -15
- package/lib/chunk-OAZRPP4I.mjs +0 -7
- package/lib/chunk-OO6CLPEH.mjs +0 -7
- package/lib/chunk-OPXCV2KL.mjs +0 -7
- package/lib/chunk-P33PSCXK.mjs +0 -7
- package/lib/chunk-Q3DM32KF.mjs +0 -11
- package/lib/chunk-QROPNEGY.mjs +0 -14
- package/lib/chunk-QWT2C74M.mjs +0 -7
- package/lib/chunk-R3X3LV64.mjs +0 -14
- package/lib/chunk-RMBPOTD7.mjs +0 -7
- package/lib/chunk-SIHORWVK.mjs +0 -7
- package/lib/chunk-T62WNR54.mjs +0 -7
- package/lib/chunk-TTFDUKUS.mjs +0 -47
- package/lib/chunk-VE6XKGGD.mjs +0 -7
- package/lib/chunk-VGW4MXXZ.mjs +0 -7
- package/lib/chunk-VS7ZXUII.mjs +0 -824
- package/lib/chunk-VXQLDM4R.mjs +0 -7
- package/lib/chunk-VYXMVJL5.mjs +0 -7
- package/lib/chunk-W7U5E5ZL.mjs +0 -9
- package/lib/chunk-WXAQ7FK3.mjs +0 -115
- package/lib/chunk-YS4G22C2.mjs +0 -7
- package/lib/chunk-ZM6OJGIG.mjs +0 -7
- package/lib/chunk-ZUTYVST5.mjs +0 -7
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{p as De}from"./chunk-5ZKCLBTN.mjs";import"./chunk-Y5ZCPY36.mjs";import"./chunk-OIIL4NVI.mjs";import"./chunk-YCSFP6ER.mjs";import"./chunk-GYKNCYES.mjs";import"./chunk-YOGMP72T.mjs";import"./chunk-6CDIIFNX.mjs";import"./chunk-MWLFFVQV.mjs";import"./chunk-OQQHNYR7.mjs";import"./chunk-MO3N5XVV.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-TPHXRHOA.mjs";import"./chunk-2NAIUKVL.mjs";import"./chunk-TKQQVB2D.mjs";import{a as W,c as Oe,g as Ie,h as Y,i as Te,j as be,k as q,l as Ee,m as Ne,n as xe,o as Ae,p as _e,q as Ce}from"./chunk-R2BJWO5N.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-ZRUDYB7O.mjs";import"./chunk-YIGFYZQY.mjs";import"./chunk-2Z54GB6X.mjs";import"./chunk-V2QO6KOE.mjs";import"./chunk-5CKWGZX4.mjs";import"./chunk-R6TF26V4.mjs";import"./chunk-WD47PGUS.mjs";import"./chunk-5C5XEVZN.mjs";import"./chunk-DXOXLUZA.mjs";import"./chunk-5344TZBT.mjs";import"./chunk-V4RKM4QZ.mjs";import"./chunk-JU2XEKEO.mjs";import"./chunk-XIZ5LMQM.mjs";import"./chunk-AELFEK3G.mjs";import"./chunk-K77NR3UK.mjs";import"./chunk-OVOLG3AL.mjs";import"./chunk-FQGHL7GR.mjs";import{h as Pe}from"./chunk-IM2XA6JI.mjs";import"./chunk-K55LH4ZQ.mjs";import"./chunk-5UT2ZBGF.mjs";import"./chunk-YHIOS2PU.mjs";import"./chunk-DHGPDSXS.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-742SSN7I.mjs";import{a as Fe}from"./chunk-TW3N6W5Z.mjs";import"./chunk-YJEXE6HZ.mjs";import"./chunk-FTA5LOVX.mjs";import{d as ve}from"./chunk-KNIRA333.mjs";import"./chunk-7DALDJMO.mjs";import{a as he,l as we,m as ke}from"./chunk-O7DAFE6M.mjs";import{b as K,e as de}from"./chunk-BZ24IAP5.mjs";import{a as N}from"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-E2OBAWSH.mjs";import{e as ce}from"./chunk-OMZJ37JI.mjs";import"./chunk-43K2C6H2.mjs";import"./chunk-FSZTXLNW.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import{a as Re,c as Se}from"./chunk-VSU74RQ3.mjs";import"./chunk-CAFUNR6D.mjs";import{h as ge,i as me}from"./chunk-AITNZWLB.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-OEHVAJAB.mjs";import"./chunk-GWRKS3AL.mjs";import"./chunk-BOGNK4LV.mjs";import{m as ye}from"./chunk-KGYXLSQ5.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-DMBR24CK.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-4L7FBOJS.mjs";import"./chunk-OXKZ4Y3B.mjs";import"./chunk-MAHZMPMZ.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-UIUPPEFB.mjs";import{l as fe}from"./chunk-6SEDOIO3.mjs";import"./chunk-ZWCRWF7E.mjs";import{d as le}from"./chunk-T63U4OZJ.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-QIRO4HTE.mjs";import{h as pe,m as ue}from"./chunk-MNITSYI2.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-NJ3EOEHS.mjs";import"./chunk-ETT5GP4P.mjs";import"./chunk-SW2NUKQL.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-E2YJVSX6.mjs";import"./chunk-HVC5CYIB.mjs";import"./chunk-T26C576X.mjs";import"./chunk-BNO5GIJ6.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-SQGP46QS.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-6IGEASOF.mjs";import"./chunk-KOQV4WXC.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-CULAOP3U.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-KRNFVAGC.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-2OIRJEYE.mjs";import{a as oe,c as ae,f as T,h as $e}from"./chunk-LCDPCUXS.mjs";import"./chunk-XEB6HZ34.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-ZUA5BNAO.mjs";import"./chunk-RKALOKAU.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-55LQD3Y3.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-3B5H24ZG.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-EAFLDSQ2.mjs";import"./chunk-CA5NAXSU.mjs";import{he as ie,je as re,le as se,yc as te}from"./chunk-DPYTG6DM.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{copyFileSync as fn,existsSync as Je,mkdtempSync as gn,readFileSync as Xe,rmSync as mn,rmdirSync as hn}from"node:fs";import{tmpdir as yn}from"node:os";import{join as j,resolve as wn}from"node:path";import{randomUUID as kn}from"node:crypto";import{mkdirSync as sn}from"node:fs";import{join as on}from"node:path";var an=/^\[(WARN|ERR)\]|^\[INFO\] (?:The run lock|the confirmation)/;function je(e,t){return t==="production"?`${e??"the org"} is taken for a production org, and a pipeline from the command line writes to none`:void 0}function J(e){let t=e.journalDir??he(),n=e.backupDir??Re(),s=Se(n);if(s!==void 0)throw new Error(s);sn(e.storeDir,{recursive:!0,mode:448});let i=new Fe,r,o=Ce({storeDir:e.storeDir,log:a=>{an.test(a.trim())&&e.log(a.trim())},waitMs:0,typeScratchOrgs:!0,...e.onPost?{onPost:e.onPost}:{},services:{getSandforgeSetting:e.setting,showNotification:e.notify,...e.askApproval?{askApproval:e.askApproval}:{}},compose:a=>{let d=u=>a.orgManager.getOrg(u)?.alias,c=new fe({orgNameOf:d,requestConfirmation:(u,y)=>{let w=je(void 0,y);return w===void 0?Promise.resolve(!0):(e.log(`refused: ${w} (${u})`),Promise.resolve(!1))},declinesWithoutAsking:u=>je(void 0,u)});a.handlers.setInfraServices({productionGuard:c,backgroundRegistry:i,piiDetector:new le,checkpointFiles:{sandforgeVersion:e.sandforgeVersion,pickExportFile:()=>Promise.reject(new Error("sandforge checkpoint export saves a checkpoint to a file.")),pickImportFile:()=>Promise.reject(new Error("sandforge checkpoint import reads a checkpoint file."))}}),a.handlers.setBackgroundRegistry(i),a.handlers.setBackupRecordStore(new me(ge(n))),a.handlers.setSyncRunCreations(pe(t)),a.handlers.setSeedRunCreations(ve(t)),r={configStore:a.configStore,orgRegistry:a.orgRegistry}}});if(r===void 0)throw new Error("The host composed no handlers.");return{host:o,configStore:r.configStore,orgRegistry:r.orgRegistry,backupDir:n,dispose:()=>i.dispose()}}function X(e){switch(te(e.orgType,e.metadata?.edition)){case"Sandbox":return"sandbox";case"Scratch":return"scratch";case"Developer":return"developer";default:return"production"}}function Me(e,t){return e.length>=15&&t.length>=15&&e.slice(0,15)===t.slice(0,15)}var Le=new Set(["scratch","developer"]),ze={sandbox:"a sandbox",scratch:"a scratch org",developer:"a Developer Edition org",production:"a production org"};function dn(e,t){return e!==t?`another org, of another kind: ${ze[t]} here, ${ze[e]} in the file`:e==="sandbox"?"a sandbox refreshed since is another org, holding production\u2019s data again":"another org than the one the pipeline was exported for"}function Ge(e,t,n,s,i,r=e){return Me(n.organizationId,s.organizationId)?{ok:!0}:i!==void 0&&Me(i,s.organizationId)?{ok:!0,note:`${t} answers as org ${s.organizationId}, not the ${n.organizationId} the file names: taken, as --accept-org ${r}=${i} says.`}:Le.has(n.kind)&&Le.has(s.kind)?{ok:!0,note:`${t} answers as org ${s.organizationId}, not the ${n.organizationId} the file names: a ${s.kind==="scratch"?"scratch org":"Developer Edition org"} is made again under its alias, and is not pinned to its Id.`}:{ok:!1,code:"ORG_MOVED",message:`${t} answers as org ${s.organizationId}, and the file names ${n.organizationId}: ${dn(n.kind,s.kind)}. Nothing was run.`,wayOut:`check that ${t} is the org the pipeline is for, then run again with --accept-org ${t}=${s.organizationId}; or export the pipeline again from the Automation page.`}}function Be(e,t,n,s){if(!n.staging)return{org:t};let i=X(t);if(i!=="sandbox")return{org:t,note:`${s} is marked Staging in the file, and is a ${i} org here: the mark is read of a sandbox alone, and not set.`};let r={...t,staging:!0};return e.updateOrgMetadata(r),{org:r}}function L(e){return JSON.parse(JSON.stringify(e))}function He(e,t){let n=L(e.pipeline),s=L(e.syncConfigs);for(let i of se(e)){let r=t(i.key);if(r!==void 0){if(i.stepId!==void 0){let o=n.steps.find(a=>a.id===i.stepId);o&&(o.config[i.field]=r)}else if(i.syncConfigId!==void 0){let o=s[i.syncConfigId];o&&(o[i.field]=r)}}}return{pipeline:{...n,variables:n.variables.map(i=>i.required&&i.defaultValue===void 0?{...i,required:!1}:i),version:1,triggers:[],createdAt:e.exportedAt,updatedAt:e.exportedAt},syncConfigs:Object.values(s)}}var pn="prebuilt-",un="tpl-";function Ve(e,t,n){let s=new Pe(e);for(let o of n.syncConfigs)s.save(o);let i=new Oe(e);for(let o of Object.values(t.seedTemplates))o.id.startsWith(pn)||i.save(L(o));let r=new ce(e);for(let o of Object.values(t.maskingTemplates))o.id.startsWith(un)||r.save(L(o))}var Ue="backup:";function Ke(e,t,n,s=()=>{}){let i=e.getKeysByPrefix(Ue).filter(o=>!n.has(o));if(i.length===0)return 0;let r=ye(on(t,"snapshots.json"));for(let o of i)r.set(o,cn(e.get(o),s),"backups");return i.length}function cn(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return e;let n=e;if(typeof n.orgId!="string")return e;let s=t(n.orgId);return s===void 0?e:{...n,orgId:s,organizationId:typeof n.organizationId=="string"?n.organizationId:n.orgId}}function We(e){return new Set(e.getKeysByPrefix(Ue))}var vn=`sandforge pipeline \u2014 run an Automation pipeline exported from VS Code, without the editor.
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
npx sandforge pipeline plan --file <file> [options]
|
|
11
|
+
npx sandforge pipeline run --file <file> [options]
|
|
12
|
+
npx sandforge pipeline confirm --file <file> [--org <key>=<alias>]\u2026 [--store <dir>]
|
|
13
|
+
npx sandforge pipeline history --file <file> [--json]
|
|
14
|
+
|
|
15
|
+
Commands:
|
|
16
|
+
plan connect each org, type it, and say what a run would do and refuse; writes nothing
|
|
17
|
+
run run the pipeline as the Automation page runs it; with --dry-run, the steps that
|
|
18
|
+
write say what they would do, and the steps that read run
|
|
19
|
+
confirm confirm its Rewind steps at the terminal, as the page's confirmation does: the
|
|
20
|
+
alias of each Rewind step's org is typed, and the confirmation kept in the store
|
|
21
|
+
history the runs of the pipeline the command line made on this machine, newest first
|
|
22
|
+
|
|
23
|
+
The file is the one the Automation page's Export\u2026 writes (<name>.sandforge-pipeline.json).
|
|
24
|
+
|
|
25
|
+
Options (plan, run):
|
|
26
|
+
--file <file> the pipeline file
|
|
27
|
+
--org <key>=<alias> the sf alias an org of the file is reached by here, by its key in
|
|
28
|
+
the file's "orgs"; repeat for more (default: the alias the file names)
|
|
29
|
+
--accept-org <alias>=<id> take the org an alias reaches for the file's though its Organization
|
|
30
|
+
Id differs \u2014 a sandbox refreshed since \u2014 once you checked it is the
|
|
31
|
+
one: the org by its alias, or by its key in the file's "orgs", and
|
|
32
|
+
the Id it answers with; repeat for more
|
|
33
|
+
--var <name>=<value> a variable of the pipeline; repeat for more
|
|
34
|
+
--var-env <name>=<VAR> a variable read from an environment variable: a secret, which the
|
|
35
|
+
file never holds; repeat for more
|
|
36
|
+
--approve <step> answer the Approval step of that name ahead, yes, for a run with no
|
|
37
|
+
one at a terminal; repeat for more. Never one that stands before a
|
|
38
|
+
write to a sandbox marked Staging: a person answers it at a terminal
|
|
39
|
+
--confirm-rewind <alias> confirm the Rewind steps of the org of that alias, as typing it on
|
|
40
|
+
the page does; repeat for more
|
|
41
|
+
--store <dir> where the run keeps its state between runs: the Sync watermarks a
|
|
42
|
+
delta Sync reads on from, the Rewind confirmations, the audit
|
|
43
|
+
(default: the pipeline's folder under the folder
|
|
44
|
+
SANDFORGE_JOURNAL_DIR names, ~/.sandforge by default). A CI job
|
|
45
|
+
caches it between its runs
|
|
46
|
+
--json the plan, or the run, as JSON on stdout; every other line on stderr
|
|
47
|
+
--help this text
|
|
48
|
+
|
|
49
|
+
Options (run):
|
|
50
|
+
--dry-run the steps that write say what they would do: a Sync simulates, an
|
|
51
|
+
Anonymize previews, a Rewind previews, a Checkpoint estimates, a
|
|
52
|
+
Seed meets its gates \u2014 the data storage and the API requests its
|
|
53
|
+
org has left \u2014 and says what it would seed; Compare and Pre-check
|
|
54
|
+
run, and the Conditions read what they found; no Delay waits, no
|
|
55
|
+
Approval is asked; nothing is kept in the history, the audit or
|
|
56
|
+
the store
|
|
57
|
+
--timeout <ms> the run's time budget, sandforge.pipeline.timeout, from 30000 to
|
|
58
|
+
3600000 (default: the file's, or 300000); an Approval's wait, a
|
|
59
|
+
Delay and the steps that write have their own
|
|
60
|
+
--triggered-by <how> manual | schedule: what the history says started it (default: manual)
|
|
61
|
+
--fail-on-partial exit 3 when the run ended with warnings: a step past which it went on
|
|
62
|
+
|
|
63
|
+
Nothing is written to any org by plan, nor by run --dry-run. A run takes the pipeline's lock
|
|
64
|
+
on this machine, which a run in VS Code takes too: one run of a pipeline at a time. Each org
|
|
65
|
+
is named by its sf CLI alias: the Salesforce CLI (sf) must be installed and logged in to it.
|
|
66
|
+
|
|
67
|
+
Exit codes:
|
|
68
|
+
0 the plan refuses nothing; the run completed (with warnings, unless --fail-on-partial)
|
|
69
|
+
1 the run failed, or could not start
|
|
70
|
+
2 a bad command line, a file that does not read, or a run refused before its first step,
|
|
71
|
+
every cause said with what lifts it: nothing ran
|
|
72
|
+
3 --fail-on-partial, and the run completed with warnings
|
|
73
|
+
129, 130, 143 a SIGHUP, a Ctrl-C or a SIGTERM stopped it: the step under way is stopped, and
|
|
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.
|
|
76
|
+
`),T(E);return}let i={line:u=>process[s.json?"stderr":"stdout"].write(`${u}
|
|
77
|
+
`),json:u=>{s.json&&process.stdout.write(`${JSON.stringify(u,null,2)}
|
|
78
|
+
`)}},r=t.pipelinesRoot??Ie(n),o=Hn(s.file);if(!o.ok){let u=Sn(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"){Yn(a,r,i);return}let d=t.isTTY??process.stdin.isTTY===!0,c=s.store??Mn(r,a.pipeline.id);if(s.verb==="confirm"){await qn(a,s,c,{...t,isTTY:d,version:t.version??Ye()},i);return}await Un(a,o.digestMatches,s,c,r,{isTTY:d,terminal:t.terminal,version:t.version??Ye()},i)}async function Un(e,t,n,s,i,r,o){let a=n.verb==="run",d=Qe(e,n.orgs),c=On(e,n.vars),u=Tn(e,n,d.orgs),y={orgs:d.orgs,values:c.values,refusals:[...d.refusals,...c.refusals,...u],notes:[]},w,h=Y(i,e.pipeline.id),$=Je(h);if(a){let g=Te(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:q(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(Ee(g.tookOver))}else{let g=be(i,e.pipeline.id);g!==void 0&&y.notes.push(q(g,e.pipeline.name))}let P=new AbortController,v,m,p,k=de(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:ee})}),R=a&&!n.dryRun?s:Gn(s),O=[],S=new Set,D=new Map(e.pipeline.steps.map((g,x)=>[g.id,x]));try{try{p=J({storeDir:R,log:l=>o.line(` ${l}`),setting:Ze(e,n.timeoutMs),notify:l=>o.line(` notification: ${l}`),sandforgeVersion:r.version,askApproval:Bn(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),Wn(l,e,D,o)}})}catch(l){process.stderr.write(`${l instanceof Error?l.message:String(l)}
|
|
81
|
+
`),T(1);return}let g=await en(p,e,n,r,y);if(g.digestMatches=t,v!==void 0){T(K(v));return}for(let l of zn(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:qe(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 nn=We(p.configStore);m=`cli-${kn()}`,o.line(n.dryRun?"Dry run: the steps that write say what they would do.":"Run:");let M=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:Pn});if(M.outcome!=="answered"){let l=A(M),f=l.code==="PIPELINE_RUNNING",_=F(M,"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(M),V=l=>g.orgs.find(f=>f.org?.id===l)?.alias,tn=l=>{let f=e.syncConfigs[l]?.targetOrgId;return g.orgs.find(_=>_.key===f)?.alias},rn=Cn(b.stepResults,V,s,tn);for(let[l,f]of b.stepResults.entries()){let _=rn[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 U=Dn(b,n.failOnPartial,v);o.line(`${n.dryRun?"Dry run":"Run"} ${b.status}${b.error?`: ${b.error}`:""} (exit ${U}).`);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 ne=O.filter(l=>l.takeBack!==void 0).reverse();if(ne.length>0){o.line("To take this run back, in this order:");for(let l of ne)o.line(` ${l.takeBack}`)}if(!n.dryRun){let l=Ke(p.configStore,p.backupDir,nn,V);l>0&&o.line(` ${l} snapshot${l===1?"":"s"} listed in ${p.backupDir}, where sandforge dataops restores from.`);for(let f of Fn(b.stepResults,V))o.line(` ${f}`);try{Ae(i,e.pipeline.id,jn(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:qe(g.orgs),steps:O,approvals:b.stepResults.filter(l=>l.approval!==void 0).map(l=>({step:l.stepName,...l.approval})),notes:g.notes,exit:U}),T(U)}finally{k(),w?.release(),p?.dispose(),R!==s&&mn(R,{recursive:!0,force:!0}),n.dryRun&&!$&&Kn(h)}}function Kn(e){try{hn(e)}catch{}}function Wn(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 Yn(e,t,n){let s=[],i=xe(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 (${Ne(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 qn(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=Qe(e,t.orgs);if(o.refusals.length>0){for(let d of o.refusals)process.stderr.write(`${d.message} ${Z(d.wayOut??"")}
|
|
85
|
+
`);T(E);return}let a;try{a=J({storeDir:n,log:d=>i.line(` ${d}`),setting:Ze(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 en(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} ${Z(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:H});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:ee}),p=(A(m).checkpoints??[]).find(S=>S.checkpointId===P)?.checkpoint;for(let S of De($.alias,{name:p?.name??P,takenAt:p?.takenAt??""},A(v),$.org.username))i.line(` ${S}`);let k=await ke(`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:H}),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")&&($e(),Vn().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,Qe as aliasesOf,En as checkRefusals,xn as confirmLineOf,Mn as defaultStoreOf,Sn as fileRefusals,jn as historyEntryOf,Vn as main,Fn as maskedSnapshotLines,Tn as namedStepRefusals,Rn as parseArgs,zn as planLines,Dn as runExit,Ze as settingOf,_n as takeBackOf,Cn as takeBacksOf,Nn as unconfirmedRewind,On 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-ZWZXQTAK.mjs";import"./chunk-WI4HYWV6.mjs";import"./chunk-WM5JI4JI.mjs";import"./chunk-56MPPWLA.mjs";import"./chunk-67CC7RAE.mjs";import"./chunk-OU5W7SCB.mjs";import"./chunk-T3PLRQ2T.mjs";import"./chunk-5WGA5CZB.mjs";import"./chunk-NWVVCZUK.mjs";import"./chunk-HYBH5PFM.mjs";import"./chunk-FSDO4DJA.mjs";import"./chunk-MHW6DV6T.mjs";import"./chunk-QXLZINZB.mjs";import"./chunk-OZNLOV4U.mjs";import"./chunk-2OZG6GRW.mjs";import"./chunk-MO3N5XVV.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-TPHXRHOA.mjs";import"./chunk-TKQQVB2D.mjs";import"./chunk-AELFEK3G.mjs";import"./chunk-K77NR3UK.mjs";import"./chunk-OVOLG3AL.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-IM2XA6JI.mjs";import"./chunk-K55LH4ZQ.mjs";import"./chunk-5UT2ZBGF.mjs";import"./chunk-YHIOS2PU.mjs";import"./chunk-DHGPDSXS.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-742SSN7I.mjs";import"./chunk-YJEXE6HZ.mjs";import"./chunk-FTA5LOVX.mjs";import"./chunk-KNIRA333.mjs";import"./chunk-7DALDJMO.mjs";import"./chunk-O7DAFE6M.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-VSU74RQ3.mjs";import"./chunk-CAFUNR6D.mjs";import"./chunk-AITNZWLB.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-KGYXLSQ5.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-DMBR24CK.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-4L7FBOJS.mjs";import"./chunk-OXKZ4Y3B.mjs";import"./chunk-MAHZMPMZ.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-UIUPPEFB.mjs";import"./chunk-6SEDOIO3.mjs";import"./chunk-ZWCRWF7E.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-MNITSYI2.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-NJ3EOEHS.mjs";import"./chunk-ETT5GP4P.mjs";import"./chunk-SW2NUKQL.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-E2YJVSX6.mjs";import"./chunk-HVC5CYIB.mjs";import"./chunk-T26C576X.mjs";import"./chunk-BNO5GIJ6.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-SQGP46QS.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-6IGEASOF.mjs";import"./chunk-KOQV4WXC.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-CULAOP3U.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-KRNFVAGC.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-2OIRJEYE.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-XEB6HZ34.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-ZUA5BNAO.mjs";import"./chunk-RKALOKAU.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-55LQD3Y3.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-3B5H24ZG.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-EAFLDSQ2.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-DPYTG6DM.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,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,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-MO3N5XVV.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-TPHXRHOA.mjs";import"./chunk-TKQQVB2D.mjs";import"./chunk-IM2XA6JI.mjs";import"./chunk-K55LH4ZQ.mjs";import"./chunk-5UT2ZBGF.mjs";import"./chunk-YHIOS2PU.mjs";import"./chunk-DHGPDSXS.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-742SSN7I.mjs";import"./chunk-YJEXE6HZ.mjs";import"./chunk-FTA5LOVX.mjs";import"./chunk-KNIRA333.mjs";import"./chunk-7DALDJMO.mjs";import"./chunk-O7DAFE6M.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-VSU74RQ3.mjs";import"./chunk-CAFUNR6D.mjs";import"./chunk-AITNZWLB.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-KGYXLSQ5.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-DMBR24CK.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-4L7FBOJS.mjs";import"./chunk-OXKZ4Y3B.mjs";import"./chunk-MAHZMPMZ.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-UIUPPEFB.mjs";import"./chunk-6SEDOIO3.mjs";import"./chunk-ZWCRWF7E.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-MNITSYI2.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-NJ3EOEHS.mjs";import"./chunk-ETT5GP4P.mjs";import"./chunk-SW2NUKQL.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-E2YJVSX6.mjs";import"./chunk-HVC5CYIB.mjs";import"./chunk-T26C576X.mjs";import"./chunk-BNO5GIJ6.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-SQGP46QS.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-6IGEASOF.mjs";import"./chunk-KOQV4WXC.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-CULAOP3U.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-KRNFVAGC.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-2OIRJEYE.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-XEB6HZ34.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-ZUA5BNAO.mjs";import"./chunk-RKALOKAU.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-55LQD3Y3.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-3B5H24ZG.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-EAFLDSQ2.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-DPYTG6DM.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var export_jsforce=a.default;export{D as LINE_RUN,r as alreadyLinkedWords,C as bothRecorders,c as buildConfig,h as buildQueryFn,g as cliAllowsDeletes,k as cliCountFn,f as cliFileDeps,l as cliPersonAccountsFn,m as cliSourceIdsFn,N as configurationToldLines,x as contactPointLines,A as deltaLine,w as encryptedLeftOutLine,n as inTheCommandsWords,P as jobLines,export_jsforce as jsforce,E as main,B as memoryCreations,u as objectCountsLine,y as objectCurrencyLines,t as objectErrorLines,z as objectPriceLines,v as objectWrittenLines,b as parseArgs,F as parseRemoveArgs,i as readCutLines,G as readRunSummary,d as readSavedConfig,q as recordTypeGivenOfObjectsLines,J as removalRefusal,K as removalSummaryLines,H as removalsPathOf,Q as removeMain,L as restoredLines,O as runFileOf,I as runOfSummary,e as savedConfigStore,s as simulationLines,j as statusWithReadCuts,o as syncApiRequestsJson,M as undeletedLines,p as writeCheckLines};
|
package/lib/sandforge.mjs
CHANGED
|
@@ -4,9 +4,9 @@ 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 s}from"./chunk-SCKUIE3R.mjs";import"./chunk-NTOVCTRS.mjs";import{readFileSync as d}from"node:fs";import{extname as
|
|
8
|
-
Checkpoints, DataOps, Frozen Dataset, the emptying of a sandbox, sandforge.yaml environments,
|
|
9
|
-
the MCP server.
|
|
7
|
+
import{a as s}from"./chunk-SCKUIE3R.mjs";import"./chunk-NTOVCTRS.mjs";import{readFileSync as d}from"node:fs";import{extname as p,join as i}from"node:path";import{pathToFileURL as c}from"node:url";var r={autopilot:"run an Autopilot copy between two orgs",backup:"take and restore DataOps snapshots",checkpoint:"take a checkpoint of an org's data, and rewind the org to it",cleanup:"Bulk delete records you created on a sandbox in a time window",clone:"clone a record, or whole tables, from one org to a sandbox, or remove a run",compare:"compare two orgs the way the Compare page does",dataops:"mask an org's records, and put them back",empty:"empty objects of a sandbox, or the whole of it",env:"apply a sandforge.yaml to an org, and take it back",frozen:"build and replay a Frozen Dataset",mcp:"the MCP server: these scripts as tools for an AI agent, on stdio",monitor:"read an org the way the Monitor page does",pipeline:"plan and run an Automation pipeline exported from VS Code",seed:"fill an org from a seed template",sync:"run a Sync between two orgs"},a=o=>Object.prototype.hasOwnProperty.call(r,o);function m(o){let[e,...n]=o;if(e===void 0)return{kind:"refused",reason:"Name the command to run."};if(e==="--help"||e==="-h"||e==="help")return{kind:"help"};if(e==="--version"||e==="-v")return{kind:"version"};if(a(e))return{kind:"run",tool:e,args:n};let t=e.replace(/^sandforge-/,"");return t!==e&&a(t)?{kind:"refused",reason:`"${e}" is named ${t} here: ${s(t)} \u2026.`}:{kind:"refused",reason:e.startsWith("-")?`"${e}" is not a flag sandforge reads: name a command first.`:`"${e}" is not a command of sandforge.`}}function l(){let o=Math.max(...Object.keys(r).map(n=>n.length));return`sandforge \u2014 SandForge's command lines, without the editor: Seed, Forge's clone, Sync,
|
|
8
|
+
Checkpoints, DataOps, Frozen Dataset, the emptying of a sandbox, sandforge.yaml environments,
|
|
9
|
+
Automation pipelines, and the MCP server.
|
|
10
10
|
|
|
11
11
|
Usage:
|
|
12
12
|
sandforge <command> [options]
|
|
@@ -22,7 +22,7 @@ to it. In Claude Code:
|
|
|
22
22
|
|
|
23
23
|
--version the version of SandForge these scripts belong to
|
|
24
24
|
--help this text
|
|
25
|
-
`}function f(o,e=__dirname,n=__filename){return i(e,`sandforge-${o}${
|
|
25
|
+
`}function f(o,e=__dirname,n=__filename){return i(e,`sandforge-${o}${p(n)}`)}function g(o=__dirname){let e=JSON.parse(d(i(o,"..","package.json"),"utf8"));return typeof e.version=="string"?e.version:"0.0.0"}var u=o=>import(c(o).href);async function h(o=process.argv,e=u){let n=m(o.slice(2));switch(n.kind){case"help":process.stdout.write(l());return;case"version":process.stdout.write(`${g()}
|
|
26
26
|
`);return;case"refused":process.stderr.write(`${n.reason} Nothing was run. The commands: ${Object.keys(r).join(", ")}. Run with --help.
|
|
27
|
-
`),process.exitCode=2;return;case"run":{let t=f(n.tool);process.argv=[o[0]??process.execPath,t,...n.args],await e(t);return}}}/(?:^|[\\/])sandforge\.[cm]?[jt]s$/.test(process.argv[1]??"")&&
|
|
28
|
-
`),process.exit(1)});export{r as TOOLS,m as dispatchOf,l as helpText,
|
|
27
|
+
`),process.exitCode=2;return;case"run":{let t=f(n.tool);process.argv=[o[0]??process.execPath,t,...n.args],await e(t);return}}}/(?:^|[\\/])sandforge\.[cm]?[jt]s$/.test(process.argv[1]??"")&&h().catch(o=>{process.stderr.write(`${o instanceof Error?o.message:String(o)}
|
|
28
|
+
`),process.exit(1)});export{r as TOOLS,m as dispatchOf,l as helpText,h as main,f as toolFile,g as versionOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sandforge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.81.0",
|
|
4
4
|
"description": "SandForge's command lines, without the editor: seed, clone and sync Salesforce orgs, checkpoints and rewinds, masking, Frozen Datasets, sandforge.yaml environments, and an MCP server for AI agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salesforce",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"sandforge-frozen": "bin/sandforge-frozen.mjs",
|
|
41
41
|
"sandforge-mcp": "bin/sandforge-mcp.mjs",
|
|
42
42
|
"sandforge-monitor": "bin/sandforge-monitor.mjs",
|
|
43
|
+
"sandforge-pipeline": "bin/sandforge-pipeline.mjs",
|
|
43
44
|
"sandforge-seed": "bin/sandforge-seed.mjs",
|
|
44
45
|
"sandforge-sync": "bin/sandforge-sync.mjs"
|
|
45
46
|
},
|
package/lib/chunk-2CNCDM56.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
-
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
-
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
-
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
-
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{b as ne,c as ae,d as Bo,e as $o,f as me}from"./chunk-SIHORWVK.mjs";import{a as Mo,e as Uo}from"./chunk-F43REJDZ.mjs";import{J as te,P as _e,a as Do}from"./chunk-JPUR2CFX.mjs";import{f as Ne,o as pe,r as De,t as Lo,v as Fe}from"./chunk-PZPJKATS.mjs";import{c as To}from"./chunk-MFG4MUIO.mjs";import{E as Fo}from"./chunk-EQNW3UC2.mjs";import{b as le,d as de}from"./chunk-GSKCGQIP.mjs";import{c as No}from"./chunk-JWTSEDIQ.mjs";import{c as _o,e as Ce,g as Te,h as ce}from"./chunk-TZE3Y7IQ.mjs";import{a as Co,b as X}from"./chunk-CA5NAXSU.mjs";import{A as oo,B as to,C as no,G as ao,H as ro,Ha as go,I as io,Ia as bo,J as so,Ja as yo,K as co,Va as fo,ec as ko,ga as lo,ha as po,kb as ho,m as Xe,ma as oe,mb as zo,na as Oe,nb as So,nc as Oo,oc as Ro,pc as wo,qb as xo,r as Pe,ra as F,rb as Io,rc as vo,s as Ve,sa as mo,sb as jo,sc as Ee,t as Je,ta as M,u as Qe,ua as Re,ud as Ao,v as ee,va as uo,vd as Eo,x as ke,xa as we,ya as ve,z as eo,za as Ae,zb as Po}from"./chunk-TTFDUKUS.mjs";import{b as n,c as Ie,e as b,f as r,g as Ke,i as D,k as c,l as o,o as se,p as je,s as I,u as A,v as w,w as Ye,x as Ze,y as G}from"./chunk-7EANH5PY.mjs";function _n(e,t,a){return async l=>{let d=l.map(y=>`${y.objectApiName} (${y.records})`).join(", ");e.log(`[WARN] ${a}: the user may not delete ${d} in the target: those records stay`);let p=e.infraServices?.confirmRemovalLeavingUndeletable;if(!p)return!0;let m=e.orgManager.getOrg(t);return p({org:ko(m,t),objects:l})}}var Go={code:"NOT_INITIALIZED",message:"Production Guard is not initialized \u2014 infrastructure services missing"};function Nn(){return Object.assign(new Error(Go.message),{code:Go.code})}var Me={blocked:"GUARD_BLOCKED",declined:"GUARD_DECLINED"};function Dn(e){return Object.assign(new Error(`Operation blocked by Production Guard: ${e}`),{code:Me.blocked})}function Fn(e){return e instanceof Error&&e.code===Me.blocked?Me.blocked:void 0}function Pt(e){return e.robustness??lo}function Mn(e){return e.bulkManager??new Do(Pt(e).bulk.maxConcurrentJobs)}var kt={"sync:schedule":"sync:schedule:","sync:pipeline":"sync:pipeline:","seed:pipeline":"seed:pipeline:","offline-replay":"offline-replay-"};function Un(e,t,a){return{id:`${kt[e]}${t}`,type:a,timestamp:Date.now()}}function Ln(e,t,a,l){return{id:e.nextId(),type:a,timestamp:Date.now(),correlationId:t.id,payload:l}}function Bn(e,t,a,l,d={}){let p=t==="error"?null:d.autoDismissMs===void 0?5e3:d.autoDismissMs,m={id:e.nextId(),type:"notification",timestamp:Date.now(),payload:{level:t,title:a,message:l,...p===null?{}:{autoDismissMs:p},...d.actions?{actions:d.actions}:{},...d.code?{code:d.code}:{}}};e.broker.postToWebview(m),e.log(`[TX] notification: ${a}`)}function $n(e,t,a,l){let d={id:e.nextId(),type:"operation:started",timestamp:Date.now(),payload:{operationId:t,module:a,description:l}};e.broker.postToWebview(d)}function Gn(e,t,a,l,d,p){let m={id:e.nextId(),type:"operation:progress",timestamp:Date.now(),payload:{operationId:t,percentage:a,processedRecords:l,totalRecords:d,currentStep:p}};e.broker.postToWebview(m)}function Wn(e,t,a){let l={id:e.nextId(),type:"operation:completed",timestamp:Date.now(),payload:{operationId:t,result:a}};e.broker.postToWebview(l)}var Ot=Symbol("sandforge.uncorrelated");function Wo(e,t,a,l,d,p={}){let m=X(d),y=d instanceof To?d:void 0,j=Ot in l,E=p.code??y?.code??"UNKNOWN";j||vt(e.broker,m,E),e.log(`[ERR] ${t}: ${m}${j?` (uncorrelated: ${String(l.reason)})`:""}`);let O={id:e.nextId(),type:a,timestamp:Date.now(),...j?{}:{correlationId:l.id},payload:{message:m,code:E,retryable:p.retryable??!1,...y?{orgId:y.orgId}:{},...p.extraPayload}};e.broker.postToWebview(O),e.log(`[TX] ${a}: ${m}`)}function qn(e,t){let a={id:e.nextId(),type:t.type,timestamp:Date.now(),payload:t.payload};e.broker.postToWebview(a)}function Hn(e){let t=e?.getSandforgeSetting;if(!(!t||!t("grappe.enabled",!1)))return{enabled:!0,autoActivateThreshold:t("grappe.autoActivateThreshold",1e4),maxWorkers:Xe.maxWorkers,grappeSize:t("grappe.grappeSize",5e3),strategy:"round_robin",backPressure:{enabled:!1,maxQueueDepth:3,highWaterMark:80,lowWaterMark:60,strategy:"pause",monitoringInterval:5e3},checkpointing:!0,isolationLevel:"per_grappe"}}function Kn(e){let t=new Set(e.map(l=>l.batchSize)),[a]=t;return{...e.length>0?{objectName:e.map(l=>l.objectApiName).join(", ")}:{},...t.size===1&&a!==void 0?{batchSize:a}:{}}}function Yn(e,t,a,l,d={}){let p={id:e.nextId(),type:"operation:failed",timestamp:Date.now(),payload:{operationId:t,error:a,retryable:l,...d.extraPayload}};e.broker.postToWebview(p),d.authored!==!0&&Et(e,a,d.context)}var Rt=[/^Operation cancelled by user\b/,/^Operation blocked by Production Guard: /,/^Production Guard is not initialized\b/,/^Duplicate operation: /,/^A backup or rollback operation is already running for org /,/^Object describe not available for '/,/^CRUD_FLS_DENIED: /,/^CRUD\/FLS check failed for /,/^No backup found for operation /,/^Backup \S+ was taken from org /,/^Restore not run: /,/^Pipeline failed$/,/^Pipeline did not start: /,/^Pipeline ran out of time: /,/^Org not found: /,/^No credentials for org /,/^Invalid username format: /];function wt(e){return Rt.some(t=>t.test(e))}var qo=1e4,Ue=new WeakMap;function vt(e,t,a){let l=Ee(t,{code:a});if(!l?.actionKey)return;let d=Ue.get(e)??new Map,p=Date.now();for(let[m,y]of d)p-y>qo&&d.delete(m);d.set(l.code,p),Ue.set(e,d)}function At(e,t){let a=Ue.get(e)?.get(t);return a!==void 0&&Date.now()-a<=qo}function Et(e,t,a={}){if(!(e.broker.panelCount>0)||wt(t))return;let d=Co(t,vo)??"UNKNOWN",p=Ee(t,{code:d});if(p?.actionKey){if(At(e.broker,p.code))return;e.broker.showFixSuggestion({source:"catalogue",code:p.code,actionKey:p.actionKey});return}let m=e.errorResolver;m&&m.resolveError({errorCode:d,message:t},a).then(y=>{e.broker.showFixSuggestion({source:"model",text:Ct(y)})}).catch(y=>{e.log?.(`[ERR] operation:failed resolution: ${X(y)}`)})}function Ct(e){return e.suggestions[0]?.description||e.explanation}import{isAbsolute as Ft}from"node:path";var i=n().min(1).max(128),s=n().regex(/^[A-Za-z][A-Za-z0-9_]*$/,"Invalid Salesforce API name").max(80),Vo=c(s).max(300),u=n().min(1).max(200),re=n().max(2e3).refine(Ce,{message:Te}),Mt=n().refine(_o,{message:"ORDER BY clause must list only field names with optional ASC/DESC and NULLS FIRST/LAST (no LIMIT, OFFSET, FOR UPDATE or subquery)."}),f=100,Jo=1e4,B=o({keepDays:b().int().min(ke.min).max(ke.max).optional(),excluded:c(s).max(f).refine(e=>new Set(e).size===e.length,"An object is left out twice").optional()}).strict(),be={sweepLate:r().optional(),sweepUntied:r().optional()};function Ut(e){return No(e)}function Lt(e,t='turn on "Copy the files of these records"'){return Po(e)?`Sync copies files with the records they hang on, not as an object of their own: "${e}" keeps its content in a file body. Remove it from this configuration and ${t} instead; the sync was not started.`:`Sync does not copy "${e}": no copy writes it \u2014 users and their access, metadata, a record's history, feed or sharing rows, and the records the platform keeps for itself are not data a copy carries. Remove it from this configuration; the sync was not started.`}var Bt=A(ao,{error:e=>e.input==="manual"?"Manual conflict review is not available for a sync run: no run shows its conflicts to anyone before it writes. Pick source wins, target wins, newest wins or merge \u2014 target wins keeps every value the target holds where the two orgs differ. The sync was not started.":`Conflict strategy "${String(e.input)}" is not one a sync run acts on: pick source wins, target wins, newest wins or merge. The sync was not started.`}),$t=ro.extend({objectApiName:s.refine(e=>!Ut(e),{error:e=>Lt(String(e.input))}),externalIdField:Ze(e=>typeof e=="string"&&e.trim()===""?void 0:e,s.optional()),where:re.optional(),orderBy:Mt.optional(),batchSize:b().int().positive().max(Jo).optional()}).strip().refine(e=>e.operation!=="upsert"||(e.externalIdField??"Id").toLowerCase()!=="id",{path:["externalIdField"],error:e=>`An upsert of "${String(e.input.objectApiName)}" needs an External ID field: matching on Id cannot work, because the id belongs to the source org and the target has never issued it. Name an External ID field both orgs share, or set the operation to insert. The sync was not started.`}).superRefine((e,t)=>{let a=Ro([e]);a.length!==0&&t.addIssue({code:G.custom,message:`${wo(a)} The sync was not started.`,params:{unreadablePatterns:a}})});function Ho(e){return Ke({error:()=>`Sync does not run Apex: remove "${e}" from this configuration. The sync was not started so the script cannot be skipped without you knowing.`}).optional()}var Be=io.extend({id:u.optional(),sourceOrgId:i,targetOrgId:i,objects:c($t).min(1).max(f),conflictStrategy:Bt,createdAt:n().max(40).optional(),updatedAt:n().max(40).optional(),preScript:Ho("preScript"),postScript:Ho("postScript"),dryRun:w(!1,{error:()=>'A sync configuration cannot ask for a dry run: remove "dryRun" from it. A run of it writes to the target org; to see what it would write, simulate it from the Sync page. The run was not started, so it cannot write while you believed it was only reporting.'}).optional()}).strip().superRefine((e,t)=>{e.direction==="target_to_source"&&t.addIssue({code:G.custom,path:["direction"],message:'Sync writes source to target only: direction "target_to_source" is not supported. Swap the source and target orgs to copy the other way. The sync was not started, so it cannot write into the org you meant to read from.'}),e.mode!=="full"&&e.mode!=="delta"&&t.addIssue({code:G.custom,path:["mode"],message:`Sync runs a full or a delta sync only: mode "${e.mode}" is not implemented. Set mode to "full" or "delta". The sync was not started, so it cannot replay the whole object set while you believed it was reading changes only.`}),e.mode==="delta"&&e.objects.forEach((a,l)=>{a.operation==="upsert"||a.operation==="update"||t.addIssue({code:G.custom,path:["objects",l,"operation"],message:`A delta sync writes ${a.objectApiName} again for every record it reads twice, and ${a.operation} would ${a.operation==="insert"?"create a second copy":"delete a record already gone"}. Write it by upsert on an External ID, or by update, or run the configuration in full. The sync was not started.`})}),e.propagateDeletes===!0&&(e.mode!=="delta"?t.addIssue({code:G.custom,path:["propagateDeletes"],message:'Deletions are carried by a delta sync only, which knows since when to look for them: set mode to "delta", or turn deletions off. The sync was not started.'}):e.objects.forEach((a,l)=>{if(a.operation!=="upsert"&&a.operation!=="update")return;let d=Fo(a);"refused"in d&&t.addIssue({code:G.custom,path:["objects",l],message:`${d.refused} Turn deletions off, or carry a source field onto the key. The sync was not started.`})}))}),ra=o({suggestedName:n().min(1).max(255).refine(e=>!e.includes("/")&&!e.includes("\\"),"suggestedName must not contain a path"),content:n().max(32*1024*1024),extensions:c(n().regex(/^[A-Za-z0-9]+$/)).max(8).optional()}),ia=o({config:Be,muteAutomation:r().optional(),checkpointFirst:B.optional()}),sa=o({config:Be,checkpointFirst:B.optional()}),ca=o({operationId:u}),la=o({config:Be}),da=o({id:u}),pa=o({orgId:i,targetOrgId:i.optional()}),ma=o({sourceOrgId:i,targetOrgId:i,objectApiName:s}),Qo=A(["source_wins","target_wins","newest_wins","manual","merge"]),Gt=je("kind",[o({kind:w("id")}),o({kind:w("externalId"),field:s}),o({kind:w("syncConfig"),configId:u})]),ua=o({sourceOrgId:i,targetOrgId:i,watchedObjects:c(s).min(1).max(f),apply:c(o({objectApiName:s,match:Gt,applyDeletes:r()})).max(f),conflictStrategy:Qo,flushIntervalMs:b().int().min(50).max(6e4),maxBatchSize:b().int().min(1).max(200),keepContactPoints:r().optional()}).refine(e=>e.apply.every(t=>e.watchedObjects.includes(t.objectApiName)),{message:"Every applied object must be watched.",path:["apply"]}),ga=o({sessionId:n().max(200)}),ba=o({sourceOrgId:i,targetOrgId:i}),ya=o({conflictId:n().min(1).max(500),eventReplayId:b().optional(),resolution:Qo,fieldResolutions:I(n(),o({value:D(),source:A(["source","target","manual"])})).optional()}),fa=o({entryId:u}),ha=o({runId:u}),za=o({realtime:w(!0).optional()}).optional(),Sa=o({sourceOrgId:i,targetOrgId:i,objects:c(s).max(f),configId:u.optional()}),xa=o({runId:u,includeChanged:r().optional(),sweep:r().optional(),again:r().optional(),muteAutomation:r().optional(),...be}),Ia=o({runId:u}),ja=o({runId:u,again:r().optional(),sweptObjects:Vo.optional()}),Pa=o({runId:u}),ka=o({runId:u,includeChanged:r().optional(),sweep:r().optional(),again:r().optional(),muteAutomation:r().optional(),...be}),Oa=o({runId:u}),Ra=o({format:A(["csv","json"]),entryIds:c(u).max(500).optional()}),Wt=o({id:u,name:n().min(1).max(200),configId:u,cron:n().min(1).max(100),timezone:n().min(1).max(100),enabled:r(),maxRetries:b().int().min(0).max(10),notifyOnComplete:r(),notifyOnFailure:r(),createdAt:n().max(40),updatedAt:n().max(40),version:b().int().positive()}).strip(),wa=o({schedule:Wt}),va=o({scheduleId:u,enabled:r()}),Aa=o({scheduleId:u}),qt=eo.extend({objectApiName:s,recordCount:b().int().positive().max(ee),batchSize:b().int().positive().max(Jo).optional()}).loose(),Ht=oo.extend({childObject:s,lookupField:s,parentObject:s}).superRefine((e,t)=>{e.parents.kind==="existing"&&e.parents.where!==void 0&&!Ce(e.parents.where)&&t.addIssue({code:G.custom,path:["parents","where"],message:Te})}),Kt=to.extend({objects:c(qt).min(1).max(f),relations:c(Ht).max(f).optional()}).loose().superRefine(no),Ea=o({orgId:i,template:Kt,muteAutomation:r().optional(),checkpointFirst:B.optional(),fit:o({share:b().gt(0).max(1),withinMB:b().positive().max(1e6).optional(),before:b().int().positive().max(ee*f)}).strict().optional(),locale:n().regex(/^[a-z]{2,3}(?:_[A-Za-z0-9]{2,4}){0,2}$/).optional(),dryRun:r().optional()}),Ca=o({orgId:i}),Ta=o({orgId:i,objects:c(s).min(1).max(f),publishes:r().optional()}).strict(),_a=o({orgId:i,objectApiName:s}),Na=o({id:u}),Da=o({template:I(n(),D())}),Fa=o({description:n().max(1e4)}),Ma=o({}).strict(),Ua=o({orgId:i,pack:oe,seed:Oe.shape.seed,articleBodyField:s.optional()}).strict(),La=o({orgId:i,pack:oe,options:Oe,locale:n().regex(/^[a-z]{2,3}(?:_[A-Za-z0-9]{2,4}){0,2}$/).optional(),muteAutomation:r().optional(),checkpointFirst:B.optional()}).strict(),Ba=o({orgId:i}).strict(),$a=o({pack:oe,overwrite:r().optional()}).strict(),Ga=o({runId:u,choice:fo,overwrite:r().optional()}).strict(),Yt=131072,Zt=o({objectApiName:s,whereClause:re.optional()}).loose(),Wa=o({sourceOrgId:i}),qa=o({sourceOrgId:i,targetOrgId:i,objects:c(Zt).min(1).max(f),upsert:r().optional(),externalIdField:s.optional(),previewId:u.optional(),keepContactPoints:r().optional(),checkpointFirst:B.optional()}).refine(e=>!e.upsert||e.externalIdField!==void 0,{message:"externalIdField is required when upsert is true",path:["externalIdField"]}),Xt=o({csvHeader:n().min(1).max(500),sfFieldApiName:n().max(80),sfFieldType:n().max(40),sfFieldLength:b().int().positive().nullable()}).loose(),Ha=o({orgId:i,objectApiName:s,records:c(I(n(),n().max(Yt))).min(1).max(Je),columnMappings:c(Xt).min(1).max(Qe),externalIdField:s.optional(),checkpointFirst:B.optional()}),Ka=o({orgId:i,objects:c(s).min(1).max(f)}),Ya=o({orgId:i}),Za=o({orgId:i,templateId:n().min(1).max(200).optional()}),Xa=o({orgId:i,operationId:n().min(1).max(200)}),Va=o({orgId:i,operationIds:c(n().min(1).max(200)).min(1).max(1e3).optional()}),W={acceptAutomation:r().optional(),acceptEmails:r().optional(),muteAutomation:r().optional()},Y={fromPage:w(!0).optional()},Ja=o({orgId:i,operationId:u,rewriteAll:r().optional(),includeChanged:r().optional(),...W,...Y}),Qa=o({orgId:i,act:A(["masking","restore","cleanup"]),objects:c(o({objectApiName:s,records:b().int().min(0)})).max(f),erasure:r().optional(),...W,...Y}),$e={objects:c(s).min(1).max(f).optional(),where:re.optional()},Ge=e=>e.where===void 0||e.where.trim()===""||e.objects?.length===1,We={message:"A WHERE clause filters the rows of one object: name exactly one in objects",path:["where"]},er=o({orgId:i,templateId:u,...$e,resumeFrom:u.optional(),snapshot:r().optional(),...W,...Y}).refine(Ge,We).refine(e=>!(e.snapshot===!0&&e.resumeFrom!==void 0),{message:"A resume takes no snapshot: the run it resumes has written over some of its rows",path:["snapshot"]}),or=o({orgId:i,templateId:u,...$e}).refine(Ge,We),tr=o({orgId:i,templateId:u,...$e}).refine(Ge,We),nr=o({name:n().trim().min(1).max(go),rules:c(yo).min(1).max(bo).refine(e=>new Set(e.map(t=>t.fieldPattern.toLowerCase())).size===e.length,"A field has two rules")}),ar=o({templateId:u}),rr=o({orgId:i,objectNames:c(s).min(1).max(f)}),ir=o({orgId:i,objects:c(o({objectApiName:s,duplicateKey:s.optional()})).min(1).max(10).refine(e=>new Set(e.map(t=>t.objectApiName.toLowerCase())).size===e.length,{message:"Each object may be named once per scan"}),staleDays:b().int().min(1).max(3650)}),et=c(s).min(1).max(10).refine(e=>new Set(e.map(t=>t.toLowerCase())).size===e.length,{message:"Each object may be named once per request"}),sr=o({orgId:i,objects:et}),cr=o({orgId:i,objects:et,requestId:Ie().optional(),email:n().trim().refine(Io,"Not an email address").optional(),name:n().refine(jo,"Not a name").optional(),phone:n().refine(xo,"Not a phone number").optional()}).refine(e=>e.email!==void 0||e.name!==void 0||e.phone!==void 0,{message:"A search needs an email address, a name or a phone number"}),Vt=o({orgId:i,requestId:Ie()}),ye=n().regex(/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,"Not a record Id"),lr=o({runId:u,recordId:ye}).strict(),dr=Vt.extend({mode:A(["anonymize","delete"]),records:c(o({objectApiName:s,ids:c(ye).min(1).max(200)})).min(1).max(10).refine(e=>new Set(e.map(t=>t.objectApiName.toLowerCase())).size===e.length,{message:"Each object may be named once per request"}),dryRun:r(),...W}),Jt=je("kind",[o({kind:w("stale"),days:b().int().min(1).max(3650)}),o({kind:w("orphans"),fieldApiName:s}),o({kind:w("duplicates"),keyField:s})]),ot=o({orgId:i,objectApiName:s,recommendation:Jt}),pr=ot.extend({after:o({skip:b().int().nonnegative().max(1e8),id:ye.optional(),modified:n().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:?\d{2})$/).optional()}).strict().optional()}),mr=ot.extend({dryRun:r(),...W,...Y}),Le=2e3,tt={mode:A(["objects","org"]),objects:c(s).min(1).max(Le).optional(),excluded:c(s).max(Le).optional(),customSettings:r().optional(),files:r().optional(),managedPackages:r().optional(),unrestorable:r().optional()},Qt=o(tt).strict().refine(e=>e.mode==="objects"==(e.objects!==void 0),{message:"The objects picked are named in objects mode, and only there"}),ur=o({orgId:i,...tt,objects:c(s).max(Le).optional()}).strict().refine(e=>e.mode==="objects"==(e.objects!==void 0),{message:"The objects picked are named in objects mode, and only there"}),gr=o({orgId:i,request:Qt,deleteMode:A(["recycle","hard"]),checkpointFirst:r().optional(),acceptNoUndo:r().optional(),acceptPeopleActive:r().optional(),...W,...Y}),br=o({orgId:i,previewId:u.optional(),resumeRunId:n().regex(/^em-\d{8}-\d{6}-[a-z0-9]{4}$/).optional(),acceptNoUndo:r().optional(),acceptPeopleActive:r().optional(),checkpointFirst:r().optional(),...W,...Y}).refine(e=>e.previewId===void 0!=(e.resumeRunId===void 0),{message:"An emptying acts on a preview, or takes up a run: one of them"}),yr=o({operationId:u}),fr=o({orgId:i,runId:n().regex(/^em-\d{8}-\d{6}-[a-z0-9]{4}$/),...W,...Y}),hr=o({orgId:i}),zr=o({orgId:i}).strict(),Sr=o({alertId:u}),nt=o({sourceOrgId:i,targetOrgId:i}),xr=nt.extend({types:c(n().min(1).max(80)).min(1).max(50),includeManaged:r().optional()}),en=o({componentType:A(So),fullName:n().min(1).max(400).regex(/^[^\u0000-\u001f\u007f]+$/,"A component name holds no control character")}),Ir=nt.extend({components:c(en).min(1).max(500).refine(e=>new Set(e.map(t=>`${t.componentType}:${t.fullName}`)).size===e.length,{message:"Each component may be named once per deployment"}),testLevel:A(ho),runTests:c(n().max(255).regex(zo,"Not an Apex class name")).max(100).optional()}).refine(e=>e.sourceOrgId!==e.targetOrgId,{message:"The source and the target are the same org",path:["targetOrgId"]}).refine(e=>e.testLevel!=="RunSpecifiedTests"||(e.runTests?.length??0)>0,{message:"RunSpecifiedTests names at least one test class",path:["runTests"]}),jr=o({validationId:n().regex(/^0Af[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,"Not a deployment id"),targetOrgId:i}).strict(),on=n().regex(/^\d+\.\d+\.\d+$/,"Invalid semver"),ge=n().regex(/^[A-Za-z][A-Za-z0-9_]*\.[A-Za-z][A-Za-z0-9_]*$/,"Expected an Object.field key").max(170),tn=o({name:n().min(1).max(80),label:n().min(1).max(200),filterField:s,valuesSoql:n().min(1).max(4e3)}),nn=o({name:n().min(1).max(80),label:n().min(1).max(200),whereFragment:re}),Ko=se([o({action:w("clear")}),o({action:w("replace"),value:n().max(255)})]),an=o({rootObject:s,axes:c(tn).max(20),edgeCases:c(nn).max(50),budgetMaxRecords:b().int().positive().max(1e5).optional(),candidatesPerCombination:b().int().positive().max(20).optional(),expectedObjects:c(s).max(100).optional(),maxNodes:b().int().min(10).max(500).optional(),excludedObjects:c(s).max(200).optional(),excludedFields:I(s,c(s).max(500)).optional(),sasDir:n().min(1).max(500).optional(),datasetDir:n().min(1).max(500).optional(),rulesFilePath:n().min(1).max(500).optional(),datasetVersion:on.optional(),protectedOrgIds:c(i).max(50).optional(),identityKeys:I(s,c(s).min(1).max(10)).optional(),undeletableObjects:I(s,s).optional(),requiredLookupPlaceholders:I(ge,o({name:n().min(1).max(200),recordTypeDeveloperName:n().min(1).max(97).optional(),targetObjectApiName:s.optional()})).optional(),requiredFieldDefaults:I(ge,D()).optional(),picklistRules:I(ge,Ko).optional(),defaultPicklistRule:Ko.optional(),duplicateErrorPatterns:c(n().min(1).max(200)).max(50).optional(),mockDetection:o({metadataTypeApiName:s,isMockedFieldApiName:s}).optional(),mandatoryLookups:I(s,c(s).min(1).max(50)).optional(),presenceKeys:I(s,s).optional()}),Pr=o({config:an}),kr=o({sourceOrgId:i}),Or=o({fields:c(ge).min(1).max(2e3)}),Rr=o({sourceOrgId:i,author:n().min(1).max(120).optional()}),wr=o({targetOrgId:i,pilot:r().optional(),reload:r().optional(),writeEncrypted:r().optional(),maxRecords:b().int().positive().max(1e6).optional(),muteAutomation:r().optional(),checkpointFirst:B.optional(),sweep:r().optional(),...be,includeChanged:r().optional(),acceptEmails:r().optional(),acceptAutomation:r().optional(),goneFirst:c(ye).max(1e6).optional()}),vr=o({targetOrgId:i}),Ar=o({targetOrgId:i,loadedAt:n().min(1).max(64),includeChanged:r().optional(),sweep:r().optional(),...be,muteAutomation:r().optional()}),Er=o({targetOrgId:i,loadedAt:n().min(1).max(64),reload:r().optional()}),Cr=o({targetOrgId:i,loadedAt:n().min(1).max(64),sweptObjects:Vo.optional(),reload:r().optional()}),Tr=o({targetOrgId:i,loadedAt:n().min(1).max(64),includeChanged:r().optional()}),at=1e3,rt=3650,rn=200,K=c(s).min(1).max(at).refine(e=>new Set(e).size===e.length,"An object is named twice");function it(e){return e.mode==="picked"?e.objects!==void 0:e.objects===void 0}var st=se([w("all"),c(s.refine(e=>e.toLowerCase().endsWith("__c"),"A custom setting's API name ends in __c")).min(1).max(at).refine(e=>new Set(e.map(t=>t.toLowerCase())).size===e.length,"A custom setting is named twice")]),ct={path:["objects"],message:'Name the objects with "picked", and none with "everything"'},_r=o({orgId:i.optional()}).optional(),sn=1e6,lt=b().int().min(1).max(sn),Nr=o({orgId:i,mode:Ae,objects:K.optional(),excluded:K.optional(),customSettings:st.optional(),maxTotal:lt.optional()}).refine(it,ct),Dr=o({orgId:i,name:ve,mode:Ae,objects:K.optional(),excluded:K.optional(),customSettings:st.optional(),maxTotal:lt.optional(),keepDays:b().int().min(0).max(rt),ignoredFields:we.optional()}).refine(it,ct),Fr=o({checkpointId:M,objects:K.optional(),muteAutomation:r().optional(),acceptOutside:r().optional()}),Mr=o({checkpointId:M,previewId:Re,objects:K.optional(),acceptAutomation:r(),muteAutomation:r().optional(),acceptEmails:r().optional(),acceptNoUndo:r(),acceptRecreate:r(),acceptOutside:r(),acceptUnseen:r(),fromPage:w(!0).optional()}),Ur=o({checkpointId:M,previewId:Re,objects:K,acceptOutside:r()}),Lr=o({checkpointId:M}),cn=200,Br=o({token:u,orgId:i,key:n().min(1).max(cn),keepDays:b().int().min(0).max(rt)}),$r=o({checkpointId:M,rewindId:uo,acceptAutomation:r(),muteAutomation:r().optional(),acceptEmails:r().optional(),fromPage:w(!0).optional()}),Gr=o({checkpointIds:c(M).min(1).max(rn).refine(e=>new Set(e).size===e.length,"A checkpoint is named twice")}),Wr=o({checkpointId:M,keep:r()}),qr=o({checkpointId:M,name:ve}),Hr=o({checkpointId:M,fields:we}),ln=500,Kr=o({orgIds:c(i).min(1).max(ln).refine(e=>new Set(e).size===e.length,"An org is named twice").optional()}).strict().optional(),Yr=o({sourceOrgId:i,targetOrgId:i,includeStandardObjects:r()}),Zr=o({sourceOrgId:i,objectApiNames:c(s).min(1).max(Ve)}),Xr=o({sourceOrgId:i,targetOrgId:i,selectedObjects:c(s).max(f),includeStandardObjects:r(),maxDepth:b().int().min(1).max(10).optional(),maxObjects:b().int().min(1).max(500).optional()}),Vr=o({complianceFramework:co,objectFilters:I(n(),re).optional(),overrides:c(o({objectApiName:s,fieldApiName:s,method:se([so,w("skip")])})).max(500).optional()}),Jr=o({grappeThreshold:b().int().nonnegative(),keepContactPoints:r().optional(),muteAutomation:r().optional(),checkpointFirst:B.optional()}),Qr=o({mode:o({share:w(!0).optional(),caps:I(s,b().int().min(1).max(ee)).refine(e=>Object.keys(e).length<=f,"Too many caps").optional(),all:b().int().min(1).max(ee).optional(),withinMB:b().positive().max(1e6).optional()}).strict().refine(e=>e.share===!0||e.caps!==void 0||e.all!==void 0,"Fit by share, by caps, or both"),muteAutomation:r().optional(),checkpointFirst:B.optional()}),ei=o({objectApiName:s}),oi=o({orgId:i.optional(),sourceOrgId:i.optional(),alreadySelected:c(s).max(f).optional()}).loose(),ti=o({orgId:i.optional(),sourceOrgId:i.optional(),objectApiName:s.optional(),alreadySelected:c(s).max(f).optional(),selectedObjects:c(s).max(f).optional(),availableObjects:c(s).max(500).optional()}).loose(),ni=o({sourceOrgId:i,targetOrgId:i.optional(),selectedObjects:c(s).min(1).max(f),parentObjects:c(s).max(f).optional()}).loose(),dn=po.extend({sourceOrgId:i,targetOrgId:i,selectedObjects:c(s).min(1).max(f),parentObjects:c(s).max(f).default([])}).loose(),ai=o({config:dn.optional(),sourceOrgId:i.optional(),targetOrgId:i.optional(),selectedObjects:c(s).min(1).max(f).optional(),parentObjects:c(s).max(f).optional()}).loose(),pn=n().min(1).max(5e4),ri=o({conversationId:u,message:n().max(5e4)}),ii=o({title:n().min(1).max(300)}),si=o({conversationId:u}),ci=o({apiKey:n().min(1).max(500),errorResolution:r().optional()}),li=o({enabled:r().optional(),errorResolution:r().optional()}),di=o({orgId:i,objectName:s,sampleSize:b().int().positive().max(1e4).optional()}),pi=o({orgId:i,prompt:n().trim().min(1).max(2e3).optional(),soql:n().trim().min(1).max(2e4).optional()}).refine(e=>e.prompt===void 0!=(e.soql===void 0),{message:"Send a prompt to draft from or a query to check, not both and not neither"}),mi=o({description:pn,orgIds:c(i).max(50).optional()}),ui=o({requestId:u}),ue=c(n().min(1).max(F.picklistValue)).max(F.picklistValues),Yo={label:n().max(F.agentLabel).optional(),description:n().max(F.agentDescription).optional()},gi=o({text:n().trim().min(1).max(F.text),language:oe.shape.language,casePicklists:o({Status:ue.optional(),Origin:ue.optional(),Priority:ue.optional(),Type:ue.optional()}).optional(),agent:o({topics:c(o({name:n().min(1).max(F.agentName),...Yo,actions:c(o({name:n().min(1).max(F.agentName),...Yo})).max(F.agentActions)})).max(F.agentTopics)}).optional(),draft:mo.optional(),maskOnly:r().optional()}),bi=o({filePath:n().min(1).max(2e3)}),yi=o({name:n().max(200),config:I(n(),D())}),fi=o({operationId:u.optional(),executionId:u.optional(),objectName:n().min(1).max(200).optional()}).loose(),hi=o({policyId:u}),zi=o({policy:I(n(),D())}),Si=o({policyId:u,orgId:i}),xi=o({module:n().min(1).max(50).optional(),orgId:i.optional(),offset:b().int().min(0).max(Pe).optional(),limit:b().int().min(1).max(Pe).optional()}).optional(),Ii=o({operationId:u.optional()}).optional(),mn=A(["syncMappings","forgePlans","pipelines","anonymizationTemplates"]),ji=o({categories:c(mn).min(1).max(50)}),Pi=o({json:n().min(1).max(5e6),overwrite:r()}),ki=o({json:n().min(1).max(5e6)}),Oi=o({orgId:n().max(128),authMethod:n().min(1).max(50),alias:n().max(100).optional(),loginUrl:n().max(500).optional(),username:n().max(300).optional(),password:n().max(500).optional(),securityToken:n().max(100).optional(),clientId:n().max(256).optional(),jwtKeyFile:n().max(4096).optional()}).loose(),dt=n().trim().max(100).regex(/^[\w.-]*$/,"an alias is letters, digits, dots, dashes and underscores").optional(),un=n().trim().min(1,"the username is required").max(80).regex(/^[\w.@+-]+$/,"a username is written like an email address"),pt=n().trim().min(1,"the consumer key is required").max(256).regex(/^[A-Za-z0-9._-]+={0,2}$/,"a consumer key is letters, digits, dots, dashes and underscores"),gn=n().trim().min(1,"the private key file is required").max(4096).regex(/^[^\u0000-\u001f\u007f]+$/,"the private key file path holds a control character").refine(e=>Ft(e),"give the private key file as an absolute path"),Ri=o({alias:dt,loginUrl:n().max(500).optional(),username:un,clientId:pt,jwtKeyFile:gn}).loose(),wi=o({alias:dt,loginUrl:n().max(500).optional(),clientId:pt}).loose(),vi=o({requestId:u}),Ai=o({orgId:i}),Ei=o({orgId:i}),Ci=o({orgId:i}).strict(),Ti=o({orgId:i,alias:n().trim().min(1).max(100),color:n().regex(/^#[0-9A-Fa-f]{6}$/),tags:c(n().trim().min(1).max(50)).max(20),staging:r().optional()}),_i=o({key:n().min(1).max(200),value:D()}),Ni=o({enabled:r()}),Di=o({lng:A(["en","fr","de","es","ja","pt-BR"])}),Fi=o({targetOrgId:i,sourceOrgId:i.optional()}),Mi=o({moduleId:n().min(1).max(64),route:n().min(1).max(64),overlay:r()}),Ui=o({moduleId:n().min(1).max(64)}),bn=80,yn=Ye(e=>Ao(e)||Eo(e)||typeof e=="string"&&e.trim()!==""&&e.length<=bn,{message:"Not a pipeline step type"}),fn=o({pipeline:o({name:n().min(1).max(200),steps:c(o({type:yn,config:I(n(),D()).default({})}).loose()).max(200),variables:c(I(n(),D())).max(200).default([]),triggers:c(I(n(),D())).max(50).default([])}).loose(),variables:I(n(),n().max(2e3)).optional()}),Li=fn.shape.pipeline.extend({id:n().min(1).max(200)}),Bi=o({id:n().max(200),config:I(n(),D())}),$i=o({id:u}),Gi=o({operationId:u,stepId:u,decision:A(["approved","rejected"])}),hn=255,mt={pipelineId:u,stepId:u},Wi=o({pipelineId:u}),qi=o({...mt,typed:n().min(1).max(hn)}),Hi=o(mt),Ki=o({category:n().max(100).optional(),query:n().max(500).optional()}).loose().optional(),Yi=o({templateId:u});function zn(e){return e.issues.slice(0,3).map(t=>`${t.path.join(".")||"(root)"}: ${t.message}`).join("; ")}function Sn(e){let t=e.issues.map(a=>a.code==="custom"?a.params?.unreadablePatterns:void 0);return t.every(a=>a!==void 0)?t.flat():void 0}function Zi(e,t,a,l){let d=e.safeParse(t.payload);if(!d.success){let p=zn(d.error),m=Sn(d.error);return Wo(l,t.type,a,t,new Error(`Invalid payload \u2014 ${p}`),m?{code:Oo,extraPayload:{rules:m}}:{code:"INVALID_PAYLOAD"}),null}return d.data}var xn=5;function fe(e){return e.slice(0,15)}function In(e){let t=e.errors?.[0];if(t===void 0)return"The org gave no reason.";if(typeof t=="string")return t;let a=t.statusCode??"",l=t.message??"";return a&&l?`${a}: ${l}`:a||l||"The org gave no reason."}function ut(e){let t=new Set;for(let a of e){let l=a.Id;typeof l=="string"&&t.add(fe(l))}return t}async function gt(e){let t=[],a=[],l={},d=!1,p=!1,m=e.stampsFor,y=ne(e.org),j=e.org.serverTime?.bind(e.org),E=m&&j?Date.now()+await ae({serverTime:j})-te:Number.NaN;for(let{objectApiName:O,ids:v}of e.plan){let x={objectApiName:O,planned:v.length,undeleted:0,alreadyBack:0,goneForGood:0,refused:0,reasons:[]};t.push(x);let h=_=>{x.reasons.length<xn&&!x.reasons.includes(_)&&x.reasons.push(_)},R=ce(O);for(let _=0;_<v.length;_+=le){let C=v.slice(_,_+le);if(p||e.signal?.aborted){p=!0,x.notReached=(x.notReached??0)+C.length,a.push(...C);continue}let[V]=de(C,le),q,J;try{q=ut((await e.org.queryDeleted(`SELECT Id FROM ${R} WHERE Id IN (${V}) AND IsDeleted = true`)).records),J=ut((await e.org.query(`SELECT Id FROM ${R} WHERE Id IN (${V})`)).records)}catch(P){x.refused+=C.length,h(`The recycle bin could not be read: ${X(P)}`),a.push(...C);continue}let z=C.filter(P=>q.has(fe(P)));for(let P of C)q.has(fe(P))||(J.has(fe(P))?x.alreadyBack++:x.goneForGood++);if(z.length===0)continue;let U;try{d=!0;let P=await e.undelete(z),T=Array.isArray(P)?P:[P];U=z.map((H,Q)=>T[Q]??{success:!1})}catch(P){let T=X(P);U=z.map(()=>({success:!1,errors:[T]}))}let Z=[];U.forEach((P,T)=>{if(P.success===!0){x.undeleted++,m?.(z[T])&&Z.push(z[T]);return}x.refused++,h(In(P)),a.push(z[T])}),Z.length>0&&Number.isFinite(E)&&Object.assign(l,await me(e.org,R,Z,E,y))}}return{objects:t,left:a,wrote:d,cancelled:p,stamps:l}}function bt(e){return e.refused+e.goneForGood+(e.notReached??0)}async function jn(e,t,a,l){let d=new Map(Object.entries(l).map(([m,y])=>[m.slice(0,15),Date.parse(y)])),p=new Set;for(let{objectApiName:m,ids:y}of t){let j=ce(m);for(let E of de(y)){let O;try{O=(await e.query(`SELECT Id, LastModifiedDate FROM ${j} WHERE Id IN (${E})`)).records}catch{continue}for(let v of O){if(typeof v.Id!="string")continue;let x=v.Id.slice(0,15),h=Date.parse(String(v.LastModifiedDate??""));(h<=a||h<=(d.get(x)??Number.NaN))&&p.add(x)}}}return p}function yt(e){let t=Date.parse(e.startedAt),a=Date.parse(e.lastWrittenAt??e.end?.at??"");return Number.isFinite(a)?{runRecordedAt:new Date(a),...Number.isFinite(t)?{runDurationMs:Math.max(0,a-t)}:{}}:{}}function Pn(e){return e.filter(t=>t.deleted+t.alreadyGone>0).map(t=>t.objectApiName)}async function ds(e){let{run:t,includeChanged:a}=e,l=e.again===!0,d=pe(t,l),p=d.reduce((g,S)=>g+S.ids.length,0),m=De(t),y=m.reduce((g,S)=>g+S.ids.length,0),j=Lo(t),E=j.reduce((g,S)=>g+S.ids.length,0),O=[],v=e.backups,x=e.undelete;j.length>0&&!x&&O.push(`The ${E} record(s) the run deleted could not be brought back from the recycle bin here: the next removal offers them again.`),m.length>0&&!v&&O.push(`The values from before the run of ${y} record(s) it wrote over could not be read here: they were not put back, and the next removal offers them again.`);let h,R,_={},C=(e.earlierRuns??[]).map(g=>({runId:g.runId,keys:new Set([...pe(g),...De(g)].flatMap(({ids:S})=>S.map(L=>L.slice(0,15))))})),V=g=>C.some(({keys:S})=>S.has(g.slice(0,15))),q=e.sweep,J=m.length>0&&v||j.length>0&&x||q?async g=>{if(j.length>0&&x){let N=m.length>0&&v?await jn(e.org,m,await Bo(e.org,he(t)),t.removal?.removalStamps??{}):void 0,$=N?Date.now()+await ae(e.org)-te:0;if(R=await gt({org:e.org,plan:j,undelete:x,...C.length>0?{stampsFor:V}:{},...e.signal?{signal:e.signal}:{}}),N&&R.wrote){let k=ne(e.org);for(let{objectApiName:xe,ids:xt}of m){let It=xt.filter(jt=>N.has(jt.slice(0,15)));Object.assign(_,await me(e.org,xe,It,$,k))}}if(R.cancelled||e.signal?.aborted)return R.wrote}if(m.length>0&&v){let N={...t.removal?.removalStamps,..._};h=await $o({org:e.org,plan:m,backups:v,...he(t)!==void 0?{lastWriteAt:he(t)}:{},includeChanged:a,...Object.keys(N).length>0?{stamps:N}:{},...t.unkept?{unkept:t.unkept}:{},...C.length>0?{stampsFor:V}:{},...e.signal?{signal:e.signal}:{}})}let S=(R?.wrote??!1)||(h?.wrote??!1);if(h?.cancelled||e.signal?.aborted)return S;let L=q?await q(g):!1;return S||L}:void 0,z=await _e(e.org,d,{...yt(t),...t.removal?.removalStamps?{removalStamps:t.removal.removalStamps}:{},...t.removal?.removalSpans?{removalSpans:t.removal.removalSpans}:{},includeChanged:a,...J?{sweep:J}:{},...e.afterRemoval?{afterRemoval:e.afterRemoval}:{},...e.automationMade?{automationMade:e.automationMade}:{},...e.runUserId?{runUserId:e.runUserId}:{},...e.onUndeletable?{onUndeletable:e.onUndeletable}:{},...e.beforeFirstWrite?{beforeFirstWrite:e.beforeFirstWrite}:{},signal:e.signal,onProgress:e.onProgress}),U=new Date().toISOString();if(z.stoppedForUndeletable)return{result:{runId:t.runId,status:"cancelled",includeChanged:a,objects:[],finishedAt:U},planned:p,plannedBack:y,plannedUndelete:E,notes:[],stoppedForUndeletable:!0};let Z=l?void 0:t.removal?.undo?.removedAt,P={runId:t.runId,status:Rn(wn(Mo(z.objects,z.cancelled),z.objects,h),z.objects,h,R),includeChanged:a,objects:z.objects,finishedAt:U,...Z?{leftBy:Z}:{},...h&&h.objects.length>0?{restored:h.objects}:{},...R&&R.objects.length>0?{undeleted:R.objects}:{}},T=Uo(P,p,t.removal?.undo,l),H=new Set(z.gone),Q=H.size>0||l&&T?d.flatMap(({ids:g})=>g.filter(S=>!H.has(S))):void 0,qe={..._,...z.stamps},He=Object.keys(qe).length>0,ht=h?.objects.some(g=>g.restored+(g.restoredWithout??0)>0)===!0,zt=R!==void 0&&!R.cancelled;if(T||He||z.span||Q||h||R)try{await e.store.updateRemoval(t.runId,g=>({...g,...T?{undo:T}:{},...He?{removalStamps:{...g.removalStamps,...qe}}:{},...z.span?{removalSpans:[...g.removalSpans??[],z.span]}:{},...Q?{removalLeft:Q}:{},...h?{restoreLeft:h.left}:{},...ht?{restoredAt:U}:{},...R?{undeleteLeft:R.left}:{},...zt?{undeletedAt:U}:{}}))}catch(g){O.push(`What this removal did could not be kept (${g instanceof Error?g.message:String(g)}): the next removal of the run may set out to take records already gone.`)}let St=Object.keys(h?.stamps??{}).length>0?await kn(e.org,t,e.earlierRuns??[]):new Map,ze=[];for(let{runId:g,keys:S}of C){let L=St.get(g),N=Object.fromEntries(Object.entries({...R?.stamps,...h?.stamps}).filter(([k])=>S.has(k.slice(0,15))&&!L?.has(k.slice(0,15)))),$=Object.keys(N).length;if($!==0)try{await e.store.updateRemoval(g,k=>({...k,removalStamps:{...k.removalStamps,...N},...z.span?{removalSpans:[...k.removalSpans??[],z.span]}:{}})),ze.push({runId:g,records:$})}catch(k){O.push(`What this removal gave back of ${$} record(s) the run ${g} wrote too could not be kept on it (${k instanceof Error?k.message:String(k)}): its removal reads them as changed since it.`)}}let ie=e.configs;if(ie&&H.size>0&&ie.isSaved(t.configId)){let g={sourceOrgId:t.sourceOrgId,targetOrgId:Fe(t)};try{let S=d.filter(k=>Ne.includes(k.objectApiName)).flatMap(({ids:k})=>k.filter(xe=>H.has(xe))),L=ie.forgetFiles(t.configId,g,S),N=Pn(z.objects).filter(k=>!Ne.includes(k)),$=ie.markRemoved(t.configId,g,[...new Set([...N,...L.map(k=>k.objectApiName)])],U);P={...P,...$.length>0?{readWhole:$}:{},...L.length>0?{filesForgotten:L.length}:{}}}catch(S){O.push(`The configuration could not be told what this removal took (${S instanceof Error?S.message:String(S)}): run it full next time.`)}}let Se;if(e.links&&H.size>0)try{Se=await e.links.forget(t.configId,{sourceOrgId:t.sourceOrgId,targetOrgId:Fe(t)},[...H])}catch(g){O.push(`Which records of the target this removal took could not be forgotten (${g instanceof Error?g.message:String(g)}): a later run of the configuration may point a lookup at one of them.`)}return{result:P,planned:p,plannedBack:y,plannedUndelete:E,notes:O,...Se?{linksForgotten:Se}:{},...ze.length>0?{earlierStamped:ze}:{}}}async function ps(e){let{run:t}=e,a=pe(t);return{outcome:await _e(e.org,a,{...yt(t),...t.removal?.removalStamps?{removalStamps:t.removal.removalStamps}:{},...t.removal?.removalSpans?{removalSpans:t.removal.removalSpans}:{},includeChanged:e.includeChanged,...e.runUserId?{runUserId:e.runUserId}:{},previewOnly:!0,...e.signal?{signal:e.signal}:{}}),planned:a.reduce((d,p)=>d+p.ids.length,0)}}async function kn(e,t,a){let l=new Map,d=Object.entries(t.heldBefore??{});if(d.length===0||a.length===0)return l;let p=await ne(e)(),m=await ae(e);for(let y of a){let j=Date.parse(he(y)??""),E=Number.isFinite(j)?j+m+te:Number.NEGATIVE_INFINITY,O=new Set;for(let[v,{at:x,by:h}]of d)Date.parse(x)>E&&(p!==void 0&&h!==void 0&&h.slice(0,15)===p||O.add(v));O.size>0&&l.set(y.runId,O)}return l}function he(e){return e.lastWriteAt??e.lastWrittenAt??e.end?.at}function On(e){return e.keptChanged+e.refused+e.notKept+(e.notReached??0)+(e.restoredWithout??0)}function Rn(e,t,a,l){if(!l||e==="cancelled")return e;if(l.cancelled)return"cancelled";let d=l.objects.some(m=>bt(m)>0);if(e==="success"&&!d)return"success";let p=t.some(m=>m.deleted>0)||(a?.objects??[]).some(m=>m.restored>0)||l.objects.some(m=>m.undeleted>0);return e==="partial"||p?"partial":"failure"}function wn(e,t,a){if(!a||e==="cancelled")return e;if(a.cancelled)return"cancelled";let l=a.objects.some(p=>On(p)>0);return e==="success"&&!l?"success":t.some(p=>p.deleted>0)||a.objects.some(p=>p.restored+(p.restoredWithout??0)>0)?"partial":"failure"}function us(e){let t=e?.getSandforgeSetting?.("backup.maxAgeDays",30);return typeof t=="number"&&Number.isFinite(t)&&t>0?t:0}function gs(e,t,a){let l=[],d=0,p=Number.POSITIVE_INFINITY;for(let m of e){let y=t(m.backup);if(!y){d+=m.ids.length;continue}l.push(m);let j=Date.parse(y.timestamp??"");a>0&&Number.isFinite(j)&&(p=Math.min(p,j+a*864e5))}return{kept:l,notKept:d,...Number.isFinite(p)?{keptUntil:new Date(p).toISOString()}:{}}}async function ys(e,t){let a=e.check(t);if(!a.allowed)return{check:a,decision:"refused"};if(!await e.confirmIfNeeded(a,t.orgTier))return{check:a,decision:"declined"};let d=a.requiresConfirmation&&e.canAskForConfirmation===!0;return{check:a,decision:d?"confirmed":"allowed"}}var ft={allowed:0,confirmed:1,declined:2,refused:3};function fs(e,t){return e===void 0||ft[t]>ft[e]?t:e}export{_n as a,Go as b,Nn as c,Me as d,Dn as e,Fn as f,Pt as g,Mn as h,Un as i,Ln as j,Bn as k,$n as l,Gn as m,Wn as n,Wo as o,qn as p,Hn as q,Kn as r,Yn as s,i as t,s as u,Vo as v,B as w,Ut as x,Lt as y,Be as z,ra as A,ia as B,sa as C,ca as D,la as E,da as F,pa as G,ma as H,ua as I,ga as J,ba as K,ya as L,fa as M,ha as N,za as O,Sa as P,xa as Q,Ia as R,ja as S,Pa as T,ka as U,Oa as V,Ra as W,wa as X,va as Y,Aa as Z,Kt as _,Ea as $,Ca as aa,Ta as ba,_a as ca,Na as da,Da as ea,Fa as fa,Ma as ga,Ua as ha,La as ia,Ba as ja,$a as ka,Ga as la,Wa as ma,qa as na,Ha as oa,Ka as pa,Ya as qa,Za as ra,Xa as sa,Va as ta,Ja as ua,Qa as va,er as wa,or as xa,tr as ya,nr as za,ar as Aa,rr as Ba,ir as Ca,sr as Da,cr as Ea,Vt as Fa,lr as Ga,dr as Ha,pr as Ia,mr as Ja,ur as Ka,gr as La,br as Ma,yr as Na,fr as Oa,hr as Pa,zr as Qa,Sr as Ra,nt as Sa,xr as Ta,Ir as Ua,jr as Va,an as Wa,Pr as Xa,kr as Ya,Or as Za,Rr as _a,wr as $a,vr as ab,Ar as bb,Er as cb,Cr as db,Tr as eb,_r as fb,Nr as gb,Dr as hb,Fr as ib,Mr as jb,Ur as kb,Lr as lb,Br as mb,$r as nb,Gr as ob,Wr as pb,qr as qb,Hr as rb,Kr as sb,Yr as tb,Zr as ub,Xr as vb,Vr as wb,Jr as xb,Qr as yb,ei as zb,oi as Ab,ti as Bb,ni as Cb,ai as Db,ri as Eb,ii as Fb,si as Gb,ci as Hb,li as Ib,di as Jb,pi as Kb,mi as Lb,ui as Mb,gi as Nb,bi as Ob,yi as Pb,fi as Qb,hi as Rb,zi as Sb,Si as Tb,xi as Ub,Ii as Vb,ji as Wb,Pi as Xb,ki as Yb,Oi as Zb,Ri as _b,wi as $b,vi as ac,Ai as bc,Ei as cc,Ci as dc,Ti as ec,_i as fc,Ni as gc,Di as hc,Fi as ic,fn as jc,Li as kc,Bi as lc,$i as mc,Gi as nc,Wi as oc,qi as pc,Hi as qc,Ki as rc,Yi as sc,zn as tc,Zi as uc,gt as vc,ds as wc,ps as xc,he as yc,Rn as zc,wn as Ac,ys as Bc,fs as Cc,us as Dc,gs as Ec};
|