sandforge 1.81.0 → 1.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -0
- package/bin/sandforge-users.mjs +12 -0
- package/lib/{chunk-J6G23RUI.mjs → chunk-262TP6UU.mjs} +1 -1
- package/lib/{chunk-NWVVCZUK.mjs → chunk-27BBEGUD.mjs} +1 -1
- package/lib/{chunk-Y5ZCPY36.mjs → chunk-2ADSD5WK.mjs} +1 -1
- package/lib/{chunk-55LQD3Y3.mjs → chunk-2GSMHGIV.mjs} +1 -1
- package/lib/chunk-2K5BYZQM.mjs +8 -0
- package/lib/{chunk-GK7VEYFM.mjs → chunk-2KTGDYUH.mjs} +1 -1
- package/lib/{chunk-T3PLRQ2T.mjs → chunk-2N73W63D.mjs} +1 -1
- package/lib/{chunk-7PK5QDQI.mjs → chunk-2R6GFNKF.mjs} +1 -1
- package/lib/{chunk-2OIRJEYE.mjs → chunk-2WMKJVD2.mjs} +1 -1
- package/lib/{chunk-D62KWDDT.mjs → chunk-36Y225OM.mjs} +1 -1
- package/lib/{chunk-HYOOJVR6.mjs → chunk-3CM7LAPE.mjs} +1 -1
- package/lib/{chunk-OIIL4NVI.mjs → chunk-3OVTKRS4.mjs} +1 -1
- package/lib/{chunk-UT27HXE7.mjs → chunk-3V4YH5KO.mjs} +1 -1
- package/lib/{chunk-OZNLOV4U.mjs → chunk-446GBKAC.mjs} +1 -1
- package/lib/{chunk-SQGP46QS.mjs → chunk-4GCYGQXD.mjs} +1 -1
- package/lib/{chunk-2NAIUKVL.mjs → chunk-4V3QO7HF.mjs} +1 -1
- package/lib/{chunk-GWRKS3AL.mjs → chunk-4X5D3MSV.mjs} +1 -1
- package/lib/{chunk-KGYXLSQ5.mjs → chunk-5OGNK3JP.mjs} +1 -1
- package/lib/{chunk-D7P7DTWL.mjs → chunk-6KOUYHEY.mjs} +1 -1
- package/lib/chunk-6QSHWIZI.mjs +48 -0
- package/lib/chunk-6VOQFISN.mjs +7 -0
- package/lib/{chunk-742SSN7I.mjs → chunk-6YC2ELCU.mjs} +1 -1
- package/lib/chunk-77IVKH7R.mjs +7 -0
- package/lib/{chunk-KNIRA333.mjs → chunk-77MZRBWX.mjs} +1 -1
- package/lib/{chunk-ZUA5BNAO.mjs → chunk-7BQMBXKX.mjs} +1 -1
- package/lib/{chunk-OQQHNYR7.mjs → chunk-7DPHZWA4.mjs} +2 -2
- package/lib/chunk-7V2UYZ6S.mjs +7 -0
- package/lib/chunk-7WSQ65WG.mjs +9 -0
- package/lib/{chunk-HVC5CYIB.mjs → chunk-7ZBDACVG.mjs} +1 -1
- package/lib/chunk-A32ISQ6M.mjs +28 -0
- package/lib/{chunk-XC2QKQT5.mjs → chunk-AG24QMSY.mjs} +1 -1
- package/lib/{chunk-K77NR3UK.mjs → chunk-AHUGG3WU.mjs} +1 -1
- package/lib/{chunk-K55LH4ZQ.mjs → chunk-ALBY5SOH.mjs} +1 -1
- package/lib/chunk-AXFD2OH6.mjs +7 -0
- package/lib/{chunk-YCSFP6ER.mjs → chunk-BH76USTQ.mjs} +1 -1
- package/lib/chunk-BNKT3R3F.mjs +7 -0
- package/lib/{chunk-YIGFYZQY.mjs → chunk-BPHTA6KP.mjs} +1 -1
- package/lib/{chunk-MNITSYI2.mjs → chunk-BT43WSOS.mjs} +1 -1
- package/lib/{chunk-ZWZXQTAK.mjs → chunk-BVZ5H3N4.mjs} +14 -14
- package/lib/{chunk-43K2C6H2.mjs → chunk-C6RKM4BB.mjs} +1 -1
- package/lib/{chunk-C4YGSK6W.mjs → chunk-CDWZGQAJ.mjs} +1 -1
- package/lib/chunk-CGZGL6VT.mjs +7 -0
- package/lib/{chunk-KE2PGD6C.mjs → chunk-CN5HGFG4.mjs} +1 -1
- package/lib/chunk-CQAFVEKP.mjs +13 -0
- package/lib/{chunk-XIZ5LMQM.mjs → chunk-CTPLYUXA.mjs} +1 -1
- package/lib/chunk-CXKZ6TYV.mjs +9 -0
- package/lib/{chunk-DHIW4IO5.mjs → chunk-D6JT4PAB.mjs} +1 -1
- package/lib/{chunk-AELFEK3G.mjs → chunk-D7XUNWWU.mjs} +1 -1
- package/lib/{chunk-GR3NGDVM.mjs → chunk-DB5RVDC5.mjs} +1 -1
- package/lib/{chunk-MO3N5XVV.mjs → chunk-DIGUC7S4.mjs} +2 -2
- package/lib/{chunk-2OZG6GRW.mjs → chunk-DKDKCGXV.mjs} +1 -1
- package/lib/chunk-DMT5SCO3.mjs +7 -0
- package/lib/chunk-DNQKVCUV.mjs +475 -0
- package/lib/{chunk-MAHZMPMZ.mjs → chunk-DSR2MSBH.mjs} +1 -1
- package/lib/{chunk-O6ADMP36.mjs → chunk-E3RQ575Y.mjs} +1 -1
- package/lib/{chunk-ETT5GP4P.mjs → chunk-EOQON3E5.mjs} +1 -1
- package/lib/{chunk-TKQQVB2D.mjs → chunk-ETNQHIDI.mjs} +1 -1
- package/lib/chunk-F5SBGJWW.mjs +7 -0
- package/lib/chunk-FBXH4VRQ.mjs +7 -0
- package/lib/chunk-FKCIGJOI.mjs +15 -0
- package/lib/{chunk-OVOLG3AL.mjs → chunk-FVLFO2S6.mjs} +1 -1
- package/lib/{chunk-YOGMP72T.mjs → chunk-FYWNSMOZ.mjs} +1 -1
- package/lib/{chunk-DHGPDSXS.mjs → chunk-GEEWPTV5.mjs} +1 -1
- package/lib/{chunk-FSDO4DJA.mjs → chunk-GLN4PI5P.mjs} +1 -1
- package/lib/{chunk-PYUEHBA6.mjs → chunk-GT5ZKU6V.mjs} +1 -1
- package/lib/chunk-GTRU5AV5.mjs +7 -0
- package/lib/chunk-H33DVU3D.mjs +7 -0
- package/lib/{chunk-5WGA5CZB.mjs → chunk-H4OBZIX3.mjs} +1 -1
- package/lib/{chunk-4L7FBOJS.mjs → chunk-HQZUQXDC.mjs} +1 -1
- package/lib/{chunk-VSU74RQ3.mjs → chunk-HVX2AFYW.mjs} +1 -1
- package/lib/chunk-I3ZO76LL.mjs +21 -0
- package/lib/{chunk-V4RKM4QZ.mjs → chunk-I5C4O3VA.mjs} +1 -1
- package/lib/{chunk-FSZTXLNW.mjs → chunk-IHGYJZZ2.mjs} +1 -1
- package/lib/chunk-ISA2NYJV.mjs +7 -0
- package/lib/{chunk-2IB7I3IQ.mjs → chunk-ISAUCWYK.mjs} +1 -1
- package/lib/{chunk-3B5H24ZG.mjs → chunk-ISOSTAJR.mjs} +1 -1
- package/lib/chunk-IXIY6Q4M.mjs +7 -0
- package/lib/{chunk-TPHXRHOA.mjs → chunk-J3TIHLWG.mjs} +1 -1
- package/lib/{chunk-TQM2XJ27.mjs → chunk-JAV6F6OA.mjs} +1 -1
- package/lib/chunk-JBWJ6UEZ.mjs +7 -0
- package/lib/{chunk-WM5JI4JI.mjs → chunk-JH4ZTVQN.mjs} +1 -1
- package/lib/{chunk-BZFIOZS3.mjs → chunk-JIPT5FUD.mjs} +1 -1
- package/lib/{chunk-6FMLW7PH.mjs → chunk-JPEVIXNH.mjs} +1 -1
- package/lib/{chunk-67CC7RAE.mjs → chunk-JREKJO3D.mjs} +1 -1
- package/lib/{chunk-3AOKLIVE.mjs → chunk-JUOQUG7U.mjs} +1 -1
- package/lib/chunk-JYUMD357.mjs +7 -0
- package/lib/{chunk-56MPPWLA.mjs → chunk-K7G3W7XH.mjs} +1 -1
- package/lib/{chunk-OU5W7SCB.mjs → chunk-KKS2KFBT.mjs} +1 -1
- package/lib/{chunk-RKALOKAU.mjs → chunk-KWAVSZ2B.mjs} +1 -1
- package/lib/{chunk-WI4HYWV6.mjs → chunk-KXUOHACP.mjs} +1 -1
- package/lib/{chunk-GTIXJCGS.mjs → chunk-L3I6DAHX.mjs} +1 -1
- package/lib/{chunk-FLNLG43R.mjs → chunk-L47JCNP3.mjs} +1 -1
- package/lib/{chunk-5344TZBT.mjs → chunk-L4MSL4U7.mjs} +1 -1
- package/lib/chunk-L4RJX7DG.mjs +7 -0
- package/lib/chunk-L6CLN664.mjs +7 -0
- package/lib/chunk-LI2XNV7F.mjs +7 -0
- package/lib/chunk-LP2D3JJP.mjs +7 -0
- package/lib/{chunk-EH5YUA5W.mjs → chunk-LWES2KZE.mjs} +1 -1
- package/lib/{chunk-YJEXE6HZ.mjs → chunk-LYOGCIYD.mjs} +2 -2
- package/lib/{chunk-BNO5GIJ6.mjs → chunk-MJD6CPZZ.mjs} +1 -1
- package/lib/{chunk-33ZX3A56.mjs → chunk-MTM4KG3T.mjs} +1 -1
- package/lib/{chunk-E2YJVSX6.mjs → chunk-N2HYG3BL.mjs} +1 -1
- package/lib/chunk-N5UIE4IR.mjs +7 -0
- package/lib/{chunk-R6TF26V4.mjs → chunk-NDFFIJL5.mjs} +1 -1
- package/lib/{chunk-FDGFUEK3.mjs → chunk-NFEBX75O.mjs} +1 -1
- package/lib/{chunk-QXLZINZB.mjs → chunk-NNV7IGM7.mjs} +1 -1
- package/lib/{chunk-OXKZ4Y3B.mjs → chunk-NS6ONPWL.mjs} +1 -1
- package/lib/{chunk-OEHVAJAB.mjs → chunk-O7GCCRPW.mjs} +1 -1
- package/lib/chunk-OO24ZYYJ.mjs +7 -0
- package/lib/chunk-OOIDCHBQ.mjs +9 -0
- package/lib/{chunk-MWLFFVQV.mjs → chunk-OS5GE52G.mjs} +1 -1
- package/lib/chunk-OS6HFJ7L.mjs +7 -0
- package/lib/{chunk-HYBH5PFM.mjs → chunk-OTJH6AEA.mjs} +1 -1
- package/lib/chunk-OUU47Y7A.mjs +7 -0
- package/lib/{chunk-FTA5LOVX.mjs → chunk-P6WRYJN3.mjs} +1 -1
- package/lib/{chunk-DXOXLUZA.mjs → chunk-PDRXM5WN.mjs} +1 -1
- package/lib/chunk-PGRY365W.mjs +7 -0
- package/lib/chunk-Q4PPI3KG.mjs +7 -0
- package/lib/chunk-QFTF2PGS.mjs +21 -0
- package/lib/chunk-QKJXIY6L.mjs +7 -0
- package/lib/{chunk-DMBR24CK.mjs → chunk-QLRWU3MB.mjs} +1 -1
- package/lib/chunk-QO4MPHZD.mjs +7 -0
- package/lib/chunk-QP3JLFIO.mjs +7 -0
- package/lib/{chunk-UCHAZ4ZU.mjs → chunk-QQDZQCO2.mjs} +1 -1
- package/lib/chunk-QROPNEGY.mjs +14 -0
- package/lib/{chunk-6NADW3OI.mjs → chunk-QXB6U3ZP.mjs} +1 -1
- package/lib/chunk-R3OM3X4L.mjs +8 -0
- package/lib/chunk-R7GKMAT4.mjs +7 -0
- package/lib/{chunk-JU2XEKEO.mjs → chunk-RVCPQVKM.mjs} +1 -1
- package/lib/{chunk-WEZLXE34.mjs → chunk-RZKJQOOC.mjs} +1 -1
- package/lib/chunk-S4PRKKGC.mjs +8 -0
- package/lib/{chunk-NJ3EOEHS.mjs → chunk-SX6QWYCQ.mjs} +1 -1
- package/lib/{chunk-ONMBSACW.mjs → chunk-T36DZJPH.mjs} +1 -1
- package/lib/{chunk-AJPSGVMD.mjs → chunk-T7DDS4UQ.mjs} +1 -1
- package/lib/chunk-TCEXCHXR.mjs +7 -0
- package/lib/chunk-TMIESDE5.mjs +7 -0
- package/lib/chunk-TQJ5NPRC.mjs +7 -0
- package/lib/chunk-TUPZY2QJ.mjs +7 -0
- package/lib/{chunk-2Z54GB6X.mjs → chunk-U2CTKIPE.mjs} +1 -1
- package/lib/{chunk-DQR5NDMI.mjs → chunk-U4YFYSF3.mjs} +1 -1
- package/lib/{chunk-EOSEMFPU.mjs → chunk-UIR77ZJD.mjs} +1 -1
- package/lib/{chunk-UUSLTW5V.mjs → chunk-UOHZW2L4.mjs} +1 -1
- package/lib/chunk-UV74P4H2.mjs +7 -0
- package/lib/{chunk-CULAOP3U.mjs → chunk-VXZ5PTOM.mjs} +1 -1
- package/lib/{chunk-IBURU7T7.mjs → chunk-VZLJZEV2.mjs} +1 -1
- package/lib/chunk-W3BQGMTR.mjs +7 -0
- package/lib/{chunk-WWTXRWNZ.mjs → chunk-WABXKL4N.mjs} +1 -1
- package/lib/{chunk-E2OBAWSH.mjs → chunk-WAYQLQAD.mjs} +1 -1
- package/lib/{chunk-6CDIIFNX.mjs → chunk-WBELLGNE.mjs} +1 -1
- package/lib/{chunk-LO527YLT.mjs → chunk-WJAZ5LHL.mjs} +1 -1
- package/lib/{chunk-6IGEASOF.mjs → chunk-WXU6ZJIV.mjs} +1 -1
- package/lib/{chunk-YHIOS2PU.mjs → chunk-WZN36ACK.mjs} +1 -1
- package/lib/{chunk-AITNZWLB.mjs → chunk-X2XZQ434.mjs} +1 -1
- package/lib/chunk-X4HZD5U2.mjs +7 -0
- package/lib/chunk-X6XNTOGO.mjs +7 -0
- package/lib/{chunk-5VQNKDFU.mjs → chunk-XAMMIPZ4.mjs} +1 -1
- package/lib/{chunk-MHW6DV6T.mjs → chunk-XAUQXYPW.mjs} +1 -1
- package/lib/{chunk-5UT2ZBGF.mjs → chunk-XCJUNX63.mjs} +1 -1
- package/lib/chunk-XJICAOAQ.mjs +7 -0
- package/lib/{chunk-GYKNCYES.mjs → chunk-XKFHTBAB.mjs} +1 -1
- package/lib/{chunk-6SEDOIO3.mjs → chunk-XMQ5R6TC.mjs} +1 -1
- package/lib/chunk-XPXEQKLR.mjs +7 -0
- package/lib/{chunk-SW2NUKQL.mjs → chunk-Y7YUNRKK.mjs} +1 -1
- package/lib/{chunk-UIUPPEFB.mjs → chunk-YBZIDW6W.mjs} +1 -1
- package/lib/{chunk-X2ZVSQ54.mjs → chunk-YEVB7LVK.mjs} +1 -1
- package/lib/{chunk-EAFLDSQ2.mjs → chunk-Z3MGN42K.mjs} +1 -1
- package/lib/{chunk-MKNAZPOT.mjs → chunk-ZB5E7NHU.mjs} +1 -1
- package/lib/chunk-ZCOSME6P.mjs +7 -0
- package/lib/{chunk-KRNFVAGC.mjs → chunk-ZOSESZ22.mjs} +1 -1
- package/lib/chunk-ZTHC42X6.mjs +7 -0
- package/lib/{chunk-XEB6HZ34.mjs → chunk-ZXOUWHYE.mjs} +1 -1
- package/lib/sandforge-autopilot.mjs +1 -1
- package/lib/sandforge-backup.mjs +1 -1
- package/lib/sandforge-checkpoint.mjs +1 -1
- package/lib/sandforge-cleanup.mjs +1 -1
- package/lib/sandforge-clone.mjs +1 -1
- package/lib/sandforge-compare.mjs +1 -1
- package/lib/sandforge-dataops.mjs +1 -1
- package/lib/sandforge-empty.mjs +4 -4
- package/lib/sandforge-env.mjs +184 -139
- package/lib/sandforge-frozen.mjs +1 -1
- package/lib/sandforge-mcp.mjs +14 -14
- package/lib/sandforge-monitor.mjs +1 -1
- package/lib/sandforge-pipeline.mjs +1 -1
- package/lib/sandforge-seed.mjs +1 -1
- package/lib/sandforge-sync.mjs +1 -1
- package/lib/sandforge-users.mjs +155 -0
- package/lib/sandforge.mjs +1 -22
- package/lib/sf/sandforge/autopilot.mjs +20 -0
- package/lib/sf/sandforge/backup.mjs +20 -0
- package/lib/sf/sandforge/checkpoint.mjs +20 -0
- package/lib/sf/sandforge/cleanup.mjs +20 -0
- package/lib/sf/sandforge/clone.mjs +20 -0
- package/lib/sf/sandforge/compare.mjs +20 -0
- package/lib/sf/sandforge/dataops.mjs +20 -0
- package/lib/sf/sandforge/empty.mjs +20 -0
- package/lib/sf/sandforge/env.mjs +20 -0
- package/lib/sf/sandforge/frozen.mjs +20 -0
- package/lib/sf/sandforge/hardis-commands.mjs +20 -0
- package/lib/sf/sandforge/index.mjs +20 -0
- package/lib/sf/sandforge/mcp.mjs +20 -0
- package/lib/sf/sandforge/monitor.mjs +20 -0
- package/lib/sf/sandforge/pipeline.mjs +20 -0
- package/lib/sf/sandforge/seed.mjs +20 -0
- package/lib/sf/sandforge/sync.mjs +20 -0
- package/lib/sf/sandforge/users.mjs +20 -0
- package/lib/sfHelpHook.mjs +7 -0
- package/lib/sfPlugin.mjs +11 -0
- package/oclif.manifest.json +1 -0
- package/package.json +17 -3
- package/lib/chunk-2ZMGVBLW.mjs +0 -7
- package/lib/chunk-5C5XEVZN.mjs +0 -11
- package/lib/chunk-5CKWGZX4.mjs +0 -9
- package/lib/chunk-5ZKCLBTN.mjs +0 -474
- package/lib/chunk-7DALDJMO.mjs +0 -7
- package/lib/chunk-CAFUNR6D.mjs +0 -7
- package/lib/chunk-DPYTG6DM.mjs +0 -48
- package/lib/chunk-G4VXPS3A.mjs +0 -7
- package/lib/chunk-GF247DA7.mjs +0 -7
- package/lib/chunk-IKGHRYCN.mjs +0 -7
- package/lib/chunk-IM2XA6JI.mjs +0 -7
- package/lib/chunk-K5HV4YRO.mjs +0 -7
- package/lib/chunk-KOQV4WXC.mjs +0 -8
- package/lib/chunk-N6HHNR6J.mjs +0 -7
- package/lib/chunk-N7J6NJQ6.mjs +0 -7
- package/lib/chunk-NWPQF5XR.mjs +0 -7
- package/lib/chunk-O7DAFE6M.mjs +0 -14
- package/lib/chunk-OMZJ37JI.mjs +0 -15
- package/lib/chunk-R2BJWO5N.mjs +0 -20
- package/lib/chunk-T26C576X.mjs +0 -9
- package/lib/chunk-T5VAULLQ.mjs +0 -7
- package/lib/chunk-V2QO6KOE.mjs +0 -19
- package/lib/chunk-V473C7LY.mjs +0 -7
- package/lib/chunk-W2AAGIZF.mjs +0 -7
- package/lib/chunk-WD47PGUS.mjs +0 -10
- package/lib/chunk-XC54KKKC.mjs +0 -7
- package/lib/chunk-XGKSSCW7.mjs +0 -7
- package/lib/chunk-ZWCRWF7E.mjs +0 -7
|
@@ -4,6 +4,6 @@ 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{c as B}from"./chunk-BOGNK4LV.mjs";import{d as k,e as A,f as b}from"./chunk-
|
|
7
|
+
import{c as B}from"./chunk-BOGNK4LV.mjs";import{d as k,e as A,f as b}from"./chunk-WXU6ZJIV.mjs";import{Lb as D,Mb as P,Nb as O,Sb as S,Zb as v,bc as x,ec as L}from"./chunk-R3OM3X4L.mjs";import{da as w}from"./chunk-2GSMHGIV.mjs";import{Qd as R,Rd as g,Yd as f,ee as p}from"./chunk-6QSHWIZI.mjs";var C=["undelete","insert","update","delete"],M={SingleEmail:{one:"single email",more:"single emails"},DailyWorkflowEmails:{one:"workflow email",more:"workflow emails"}};function U(e,t){let n=M[t];return`${e} ${e===1?n.one:n.more}`}var I={rewind:{what:"This rewind",then:"rewind again"},undo:{what:"This undo",then:"undo the rewind again"}};function _(e){return e.toGiveBack.records+e.toBringBack.inBin+e.toBringBack.withParent}var N="Order";function T(e){return e.toDelete.createdSince+e.toDelete.broughtBackSince+e.toDelete.comesBackWithParent+(e.toBringBack.carriers??0)}function $(e){return e.objectApiName===N?T(e):0}function W(e){return e.deleted+e.withParentDeleted+e.nextPassDeleted}function F(e){return e.objectApiName===N?W(e):0}function G(e){return w[e.objectApiName]!==void 0?e.toRecreate??0:0}function j(e){return w[e.objectApiName]!==void 0?e.recreated:0}function K(e){return e.flatMap(t=>h(t.objectApiName,{undelete:t.toBringBack.inBin+t.toBringBack.withParent+t.toBringBack.deletedWhileTaken+(t.toBringBack.carriers??0),insert:t.toRecreate??0,update:_(t)+G(t)+$(t),delete:T(t)}))}function Z(e){return e.flatMap(t=>h(t.objectApiName,{undelete:t.broughtBack+t.backWithParent+(t.carriers??0),insert:t.recreated,update:t.givenBackFirst+t.givenBackAfter+t.givenBackNextPass+j(t)+F(t),delete:W(t)}))}function ee(e,t=[],n=[]){let i=a=>{let o=new Map;for(let{objectApiName:m,count:d}of a)o.set(m,(o.get(m)??0)+d);return o},c=i(t),s=i(n);return[...new Set([...e.map(a=>a.objectApiName),...c.keys(),...s.keys()])].flatMap(a=>{let o=e.find(m=>m.objectApiName===a);return h(a,{undelete:o?.deleted??0,insert:0,update:(o?.givenBack??0)+(s.get(a)??0),delete:(o?.broughtBack??0)+(c.get(a)??0)})})}function h(e,t){return C.filter(n=>t[n]>0).map(n=>({objectApiName:e,write:n,records:t[n]}))}function te(e,t){let n=new Set(e.filter(i=>i.records>0).map(i=>`${i.objectApiName}
|
|
8
8
|
${i.write}`));return S(t,(i,c)=>n.has(`${i}
|
|
9
9
|
${c}`),"the org's")}function ne(e,t){return t===void 0?"":`The emails it sends as the ${e} writes were not counted against its daily limits, as what sends them was not read (${t}). `}function y(e){return typeof e.unread=="string"}function ie(e,t,n){let i=!y(n)&&D(n),c=!y(n)&&P(n),s=new Map;for(let r of C){let a=R(t,r);if(a.length===0)continue;let o=O(a,i,c),m=new Set(a.filter(d=>d.limit==="DailyWorkflowEmails").map(d=>d.objectApiName));for(let{objectApiName:d,records:E}of e.filter(l=>l.write===r))for(let l of o.filter(u=>u.objectApiName===d)){let u=s.get(l.limit)??{limit:l.limit,emails:0,objects:[],verdict:"fits"};u.emails+=E*l.perRecord,u.objects.push({objectApiName:d,write:r,records:E,perRecord:l.perRecord,sentBy:[...l.sentBy]}),i&&l.limit==="SingleEmail"&&m.has(d)&&(u.alertsCounted=!0),s.set(l.limit,u)}}return[...s.values()].map(r=>{if(y(n))return{...r,verdict:"unread",unread:n.unread};let a=n[r.limit];return a?{...r,verdict:r.emails>a.remaining?"exceeds":"fits",remaining:a.remaining,max:a.max}:{...r,verdict:"unread",unread:`the org's limits list no ${r.limit}`}})}function re(e,t,n){let i=t.filter(r=>r.verdict==="exceeds");if(i.length===0)return;let c=i.map(r=>`about ${U(r.emails,r.limit)}`+(r.alertsCounted?" (its email alerts among them, as a Developer Edition counts them)":"")+`, ${r.remaining??0} of ${r.max??0} left today`).join("; "),s=I[e];return{code:"EMAILS",message:`${s.what} would make ${n} send ${c}: past them, each record whose flow fails in the save is refused (CANNOT_EXECUTE_FLOW_TRIGGER), and the org's own emails stop for the rest of the day. Turn off what sends them, or assign the user a bypass that keeps it quiet, then ${s.then}. No record was written.`}}function ae(e){let t=f(e.steps),n=g(p(e.automation,e.plan,t),{writes:t}),i=v(e.automation.unread);return{senders:n,...i!==void 0?{sendersUnread:i}:{}}}function q(e){let t=e.mayMute&&e.plan===void 0&&e.senders.length>0?A(e.automation,{writes:f(e.steps)}):[],n=x({senders:e.senders,...e.sendersUnread!==void 0?{sendersUnread:e.sendersUnread}:{},...e.reading!==void 0?{reading:e.reading}:{},accepted:e.accepted,target:e.orgName,run:e.act,muteQuiets:t,keepsAddresses:!0});return n.stop?{gate:n,refusal:{code:"EMAILS_DELIVERED",message:n.stop.message}}:{gate:n}}async function se(e){let t=f(e.steps),n=await k({running:p(e.automation,e.plan,t),writes:t,read:e.read});return{ofRun:n,...q({...e,senders:n.senders,...n.sendersUnread!==void 0?{sendersUnread:n.sendersUnread}:{},...n.read!==void 0?{reading:n.read.reading}:{}})}}function oe(e){let t=f(e.steps),n=g(p(e.automation,b(e.plan,e.held),t),{writes:t}),i=L({planned:e.planned,held:n,...e.reading!==void 0?{reading:e.reading}:{},accepted:e.accepted,target:e.orgName,run:e.act});return i?{code:"EMAILS_DELIVERED",message:i.message}:void 0}var Q=", or run it again once the lease can assign them",V="--mute-automation keeps quiet";function de(e,t,n){if(e.code!=="EMAILS_DELIVERED")return e;let i=t==="undo"?"Tick the box for these emails in the undo's confirmation to undo all the same":e.message.includes(Q)?"Untick Mute automation to be asked about them and rewind all the same":`Tick "Let ${n} send these emails" in the preview to rewind all the same`;return{...e,message:B(e.message,t,i).replace(V,"Mute automation keeps quiet")}}export{U as a,_ as b,$ as c,F as d,G as e,j as f,K as g,Z as h,ee as i,te as j,ne as k,ie as l,re as m,ae as n,q as o,se as p,oe as q,de as r};
|
|
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{
|
|
7
|
+
import{C as ts,r as Jo}from"./chunk-XMQ5R6TC.mjs";import{A as wn,G as ce,H as No,I as St,Q as Eo,e as yt,l as So,u as Ao,v as ko,w as Io,z as hn}from"./chunk-IXIY6Q4M.mjs";import{e as ps,h as ms}from"./chunk-TEIBWMJM.mjs";import{a as Fo,b as Po}from"./chunk-T63U4OZJ.mjs";import{a as et,d as Xo,i as es,o as Ne}from"./chunk-HQZUQXDC.mjs";import{a as vo}from"./chunk-YYZL7UGV.mjs";import{a as ho,l as Ro}from"./chunk-54HYHHVL.mjs";import{d as To}from"./chunk-QIRO4HTE.mjs";import{b as jo}from"./chunk-QSRAEUGZ.mjs";import{d as gs}from"./chunk-SX6QWYCQ.mjs";import{t as Oe}from"./chunk-EOQON3E5.mjs";import{a as Mo,c as Lo,d as At,e as je,f as _o,g as Do,h as kt,i as Bo,j as $o,k as Wo,l as qo,m as zo,n as Uo,o as se,p as ie,q as It,r as we,s as Vo}from"./chunk-4JKR4PTZ.mjs";import{d as yn,z as Go}from"./chunk-N2HYG3BL.mjs";import{a as mo,b as Me,c as go,d as X,h as pe}from"./chunk-MJD6CPZZ.mjs";import{a as po}from"./chunk-5LFSFYFJ.mjs";import{D as Zo,E as Sn,F as Qo,Ja as Ee,Ka as ns,La as ye,Wa as Te,Za as rs,_a as os,ic as ds,jc as cs,oc as ls,pc as us,qc as fs,rc as me,tb as ss,xb as is,yb as as}from"./chunk-R3OM3X4L.mjs";import{f as to}from"./chunk-77IVKH7R.mjs";import{b as Ot}from"./chunk-VV3B6IC3.mjs";import{f as Et}from"./chunk-VXZ5PTOM.mjs";import{a as no,b as ro,c as fn,e as oo,f as so,g as io,i as pn,j as ao}from"./chunk-INIT2UKJ.mjs";import{a as bo,c as gn,j as Oo}from"./chunk-ZOSESZ22.mjs";import{f as uo,g as fo}from"./chunk-ZXOUWHYE.mjs";import{a as q,b as le,c as jt,d as bn,e as Ho,f as Nt,g as Ko,h as Rn,i as Yo}from"./chunk-TQ2TQHTT.mjs";import{g as lo}from"./chunk-OHEOJISY.mjs";import{a as Co,b as xo}from"./chunk-PC247GKX.mjs";import{c as co}from"./chunk-EADHKH3A.mjs";import{b as Xr,r as eo}from"./chunk-Z3MGN42K.mjs";import{A as Wr,B as ln,C as qr,F as zr,G as un,J as Ur,K as Vr,O as Gr,R as Jr,S as Hr,T as Kr,U as Yr,V as Zr,W as Qr,e as cn,q as de,r as oe,s as xe,x as Br,y as $r}from"./chunk-2GSMHGIV.mjs";import{a as Ce,h as J}from"./chunk-TZE3Y7IQ.mjs";import{a as wt,b as H}from"./chunk-CA5NAXSU.mjs";import{a as bt,c as mn,f as wo,i as Rt,k as yo}from"./chunk-ISOSTAJR.mjs";import{Aa as Tr,Ac as Qe,Ba as Fr,Bc as pt,Ca as Pr,Ec as Xe,Fc as dn,Gc as mt,Gd as _r,Hd as Dr,Lc as ve,Mc as gt,O as Ze,Pc as ht,T as sn,Ya as vr,_ as an,fd as Se,sc as Cr,ua as Re,ud as Lr,va as Er,yc as xr,zc as Mr}from"./chunk-6QSHWIZI.mjs";import{b as W,e as te,f as Ke,i as Ie,k as Z,l as V,m as rn,r as Nr,s as on,u as Pe,v as Ye}from"./chunk-WZQEK4WT.mjs";var Le=.5;function xu(n){return`Salesforce can take several minutes to count a load in what ${n} says it has left: a run started sooner after another may read room it no longer has`}function ws(n){if("unread"in n.storage)return n.withinMB===void 0?{unread:n.storage.unread}:hs(n,Math.floor(Math.max(0,n.withinMB)*1048576),{share:Ee,roundingMB:Le,withinMB:n.withinMB,limitedBy:"within"});let{remainingMB:e,maxMB:t}=n.storage,r=Ee*Math.max(0,e-Le)*1048576,o=n.withinMB!==void 0?Math.max(0,n.withinMB)*1048576:1/0,s=o<r?"within":"storage",i={remainingMB:e,maxMB:t,share:Ee,roundingMB:Le,...n.withinMB!==void 0?{withinMB:n.withinMB}:{},limitedBy:s},a=Math.floor(Math.min(r,o));return hs(n,a,i)}function ys(n,e){return e.bytesLimit==="within"&&e.storageBytes!==void 0&&n>e.storageBytes?"storage":e.bytesLimit}function hs(n,e,t){if(!n.api)return{bytes:e,terms:t};if("unread"in n.api)return{bytes:e,terms:t,requestsUnread:n.api.unread};let r=Object.values(n.otherRequests??{}).reduce((s,i)=>s+Math.max(0,i??0),0),o=Math.max(0,Math.floor(n.api.remaining-Te*n.api.max-r));return{bytes:e,terms:t,runRequests:o}}var wa=/__e$/i,ya=/Share$/;function Mu(n,e){let t=new Map,r=new Map,o=(i,a)=>{let d=`${i}
|
|
8
8
|
${a}`,c=t.get(d);return c||(c={objectApiName:i,act:a,bytes:0,creates:[]},t.set(d,c)),c},s=i=>{r.set(`${i.objectApiName}
|
|
9
9
|
${i.kind}
|
|
10
10
|
${i.name}`,i)};for(let i of n.firing){let a=i.write;if(!(a!=="insert"&&a!=="update")&&e(i.objectApiName,a)){if(i.kind==="trigger"||!i.flow){s({objectApiName:i.objectApiName,kind:"trigger",name:i.name});continue}if(i.flow.condition!=="read"){s({objectApiName:i.objectApiName,kind:"notRead",name:i.name});continue}for(let d of i.flow.creates??[]){if(wa.test(d))continue;if(ya.test(d)){s({objectApiName:i.objectApiName,kind:"share",name:d});continue}let c=o(i.objectApiName,a);c.bytes+=ye(d,{rows:1}),c.creates.push({objectApiName:d,by:i.name})}}}return{perRecord:[...t.values()].filter(i=>i.bytes>0),notCounted:[...r.values()]}}function Lu(n,e){return n.perRecord.reduce((t,r)=>t+r.bytes*Math.max(0,e(r.objectApiName,r.act)),0)}function _u(n,e,t){return{budgetMB:Math.max(0,n.bytes-e)/1048576,...n.terms,automationMB:e/1048576,...t.notCounted.length>0?{notCounted:t.notCounted.map(r=>({...r}))}:{}}}function bs(n,e){if(!e(1))return 0;if(e(n))return n;let t=1,r=n;for(;r-t>1;){let o=Math.floor((t+r)/2);e(o)?t=o:r=o}return t}function Du(n,e){let t=Math.max(0,Math.floor(n)),r=Math.min(t,Math.max(0,Math.floor(e))),o=[];if(r===0)return o;for(let s=0;s<t;s++)Math.floor((s+1)*r/t)>Math.floor(s*r/t)&&o.push(s);return o}import{existsSync as ba,readFileSync as Ra,writeFileSync as Sa}from"node:fs";function qu(n){let e={getData:()=>ba(n)?JSON.parse(Ra(n,"utf8")):{},setData:r=>Sa(n,JSON.stringify(r,null,2),{encoding:"utf8",mode:384})},t=new ts(e);return t.initialize(),t}var On="User",Oa="005",Ss=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function Aa(n,e,t=Xr){let r=n.referenceTo??[];return n.name==="RecordTypeId"||r.length===0?!1:r.every(o=>t(o))?!0:r.length===1&&e?.(r[0])===!0}var Rs=1e5;async function Ju(n){let{known:e,ownerMappings:t={},mapped:r,refused:o,inactive:s}=n,i=n.lookups.filter(m=>Aa(m,n.outsideTheRun,n.neverCopied)),a=new Map,d=new Set;for(let m of i)for(let h of n.rows){let w=h[m.name];if(typeof w!="string"||!Ss.test(w)||m.name==="OwnerId"&&t[w]!==void 0||r?.(w)===!0||(d.add(w),e.has(w)))continue;let y=m.referenceTo??[];if(!y.some(R=>o?.has(R)===!0))for(let R of y)a.set(R,(a.get(R)??new Set).add(w))}let c=new Set,f=new Set,u=new Set;for(let[m,h]of a){let w=s!==void 0&&m===On,y=w?"Id, IsActive":"Id";for(let R of X([...h]))try{let O=await n.query(`SELECT ${y} FROM ${J(m)} WHERE Id IN (${R})`);for(let g of O){let b=g.Id;typeof b=="string"&&(c.add(b),c.add(b.slice(0,15)),w&&g.IsActive===!1&&(u.add(b),u.add(b.slice(0,15))))}}catch{for(let O of h)f.add(O);o?.add(m);break}}let p=new Map;for(let m of a.values())for(let h of m)c.has(h)||c.has(h.slice(0,15))?p.set(h,!0):!f.has(h)&&!p.has(h)&&p.set(h,!1);for(let[m,h]of p){if(e.size>=Rs)break;e.set(m,h)}if(s&&u.size>0){let m=[...a.get(On)??[]].filter(h=>u.has(h)||u.has(h.slice(0,15)));for(let h of[...u,...m]){if(s.size>=Rs)break;s.add(h)}}let l=new Set;for(let m of d)(p.get(m)??e.get(m))===!1&&l.add(m);return l}function Hu(n,e,t={}){let r=new Set;if(e.size===0)return r;for(let o of n){let s=o.OwnerId;typeof s!="string"||!s||t[s]===void 0&&e.has(s)&&r.add(s)}return r}var ka="SELECT PermissionsUpdateWithInactiveOwner FROM UserPermissionAccess";async function Ia(n){try{let[e]=await n(ka);return e?.PermissionsUpdateWithInactiveOwner===!0}catch{return!1}}function Ku(n){let e;return()=>(e??=Ia(n),e)}async function Os(n,e){let t=new Map;for(let[i,a]of Object.entries(n)){if(!Ss.test(a))continue;let d=a.slice(0,15),c=t.get(d)??{user:a,sources:[]};c.sources.push(i),t.set(d,c)}let r=[],o=[],s=[...t.values()];for(let i=0;i<s.length;i+=Me){let a=s.slice(i,i+Me),[d]=X(a.map(({user:u})=>u)),c;try{c=await e(`SELECT Id, Name, IsActive FROM ${On} WHERE Id IN (${d})`)}catch{continue}let f=new Set;for(let u of c){let p=u.Id;if(typeof p!="string"||(f.add(p.slice(0,15)),u.IsActive!==!1))continue;let l=t.get(p.slice(0,15));if(!l)continue;let m=u.Name;r.push({user:l.user,...typeof m=="string"&&m!==""?{name:m}:{},sources:l.sources})}for(let{user:u,sources:p}of a)u.startsWith(Oa)&&!f.has(u.slice(0,15))&&o.push({user:u,sources:p})}return{inactive:r,unknown:o}}var Tt=10,An="Nothing was read or written.",Xu="Nothing was written.";function As(n,e=An){let t=n.slice(0,Tt).map(({user:o,name:s,sources:i})=>`${s!==void 0?`${s} (${o})`:o}, given the records of `+i.join(", ")).join("; "),r=n.length-Tt;return`Owners given to users the target holds inactive: ${t}${r>0?`; and ${r} more`:""}. The target refuses a record owned by an inactive user, and the run will not give it to the user it writes as instead of the one chosen. Give those records to an active user under Owners (Review \u2192 Controls, or --owner-map on the command line), or reactivate the user in the target. `+e}function ja(n,e=An){let t=n.slice(0,Tt).map(({user:o,sources:s})=>`${o}, given the records of ${s.join(", ")}`).join("; "),r=n.length-Tt;return`Owners given to users the target does not hold: ${t}${r>0?`; and ${r} more`:""}. The target refuses a record owned by a user it does not hold (INVALID_CROSS_REFERENCE_KEY), and the run will not give it to the user it writes as instead of the one chosen. Give those records to a user of the target under Owners (Review \u2192 Controls, or --owner-map on the command line). `+e}async function ef(n,e,t=An){let{inactive:r,unknown:o}=await Os(n,e);if(o.length>0){let s=ja(o,t);return new me(fs,r.length>0?`${s.slice(0,-t.length)}${As(r,t)}`:s)}return r.length>0?new me(us,As(r,t)):void 0}import{createHash as Na}from"node:crypto";var js={ContentVersion:"VersionData",Attachment:"Body"},Ea=3,ks=class extends Error{constructor(t,r,o){super(t);this.code=r;this.storage=o;this.name="ForgeFilesRefusedError"}code;storage};function Y(n,e){let t=n[e];return typeof t=="string"&&t!==""?t:void 0}function Is(n,e){let t=n[e];return typeof t=="number"&&Number.isFinite(t)?t:0}function kn(n,e,t){return{objectApiName:n,stage:"query",failedCount:0,attemptedCount:0,samples:[{recordSummary:e,messages:[H(t)]}]}}async function cf(n){let{scope:e,sourceOrgId:t,maxFileBytes:r,queryRecords:o}=n,s=new Map;for(let u of e.values())for(let p of u)s.has(p)||s.set(p,s.size);let i={files:[],leftOut:[],errors:[]},a=[...s.keys()];if(a.length===0)return i;let d=u=>s.get(u)??Number.MAX_SAFE_INTEGER,c=new Map;try{for(let u of X(a)){let p=await o(t,`SELECT ContentDocumentId, LinkedEntityId, ShareType, Visibility FROM ContentDocumentLink WHERE LinkedEntityId IN (${u})`);for(let l of p){let m=Y(l,"ContentDocumentId"),h=Y(l,"LinkedEntityId");if(!m||!h||!s.has(h))continue;let w=c.get(m)??[];w.some(y=>y.id===h)||w.push({id:h,shareType:Y(l,"ShareType"),visibility:Y(l,"Visibility")}),c.set(m,w)}}}catch(u){i.errors.push(kn("ContentDocument","(links of the records in scope)",u))}let f=[];try{for(let u of X([...c.keys()])){let p=await o(t,`SELECT Id, ContentDocumentId, Title, PathOnClient, ContentSize, ContentLocation, SharingPrivacy FROM ContentVersion WHERE ContentDocumentId IN (${u}) AND IsLatest = true`);for(let l of p){let m=Y(l,"ContentDocumentId"),h=Y(l,"Id"),w=m?c.get(m):void 0;if(!m||!h||!w)continue;let y=Y(l,"Title")??m;f.push({external:(Y(l,"ContentLocation")??"S")!=="S",file:{objectApiName:"ContentDocument",sourceId:m,body:{objectApiName:"ContentVersion",id:h},name:y,bytes:Is(l,"ContentSize"),hosts:[...w].sort((R,O)=>d(R.id)-d(O.id)),fields:{Title:y,PathOnClient:Y(l,"PathOnClient")??y,...Y(l,"SharingPrivacy")==="P"?{SharingPrivacy:"P"}:{}}}})}}}catch(u){i.errors.push(kn("ContentDocument","(latest versions of the files)",u))}try{for(let u of X(a)){let p=await o(t,`SELECT Id, ParentId, Name, ContentType, BodyLength, IsPrivate FROM Attachment WHERE ParentId IN (${u})`);for(let l of p){let m=Y(l,"Id"),h=Y(l,"ParentId");if(!m||!h||!s.has(h))continue;let w=Y(l,"Name")??m;f.push({external:!1,file:{objectApiName:"Attachment",sourceId:m,body:{objectApiName:"Attachment",id:m},name:w,bytes:Is(l,"BodyLength"),hosts:[{id:h}],fields:{Name:w,...Y(l,"ContentType")?{ContentType:Y(l,"ContentType")}:{},IsPrivate:l.IsPrivate===!0}}})}}}catch(u){i.errors.push(kn("Attachment","(attachments of the records in scope)",u))}f.sort((u,p)=>d(u.file.hosts[0].id)-d(p.file.hosts[0].id));for(let{file:u,external:p}of f){let l=p?"external":u.bytes>r?"too-large":void 0;l?i.leftOut.push({objectApiName:u.objectApiName,sourceId:u.sourceId,name:u.name,bytes:u.bytes,reason:l}):i.files.push(u)}return i}function lf(n){return n.errors.length===0?null:`The files of the records to clone could not all be looked up in the source (${[...new Set(n.errors.flatMap(t=>t.samples.flatMap(r=>r.messages)))].join("; ")}). Run it again, or leave the files out.`}async function uf(n){let{files:e,targetOrgId:t,copiedBefore:r,queryRecords:o}=n,s={files:[],errors:[]},i=new Map;for(let l of e){let m=r(l.sourceId);m&&i.set(l.sourceId,m)}if(i.size===0)return{...s,files:[...e]};let a=new Map,d,c=new Map;for(let[l,m]of i)m.objectApiName==="ContentVersion"&&c.set(m.targetId,l),m.objectApiName==="ContentDocument"&&a.set(l,m.targetId);try{for(let l of X([...c.keys()])){let m=await o(t,`SELECT Id, ContentDocumentId FROM ContentVersion WHERE Id IN (${l})`);for(let h of m){let w=Y(h,"Id"),y=Y(h,"ContentDocumentId"),R=w?c.get(w):void 0;R&&y&&a.set(R,y)}}}catch(l){d=H(l)}let f=new Map,u;try{for(let l of X([...new Set(a.values())])){let m=await o(t,`SELECT ContentDocumentId, LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId IN (${l})`);for(let h of m){let w=Y(h,"ContentDocumentId"),y=Y(h,"LinkedEntityId");w&&y&&f.set(w,[...f.get(w)??[],y])}}}catch(l){u=H(l)}let p=(l,m)=>{s.errors.push({objectApiName:"ContentDocument",stage:"query",failedCount:0,attemptedCount:0,samples:[{recordSummary:`${l.name} (${Se(l.bytes)})`,messages:[m]}]})};for(let l of e){let m=i.get(l.sourceId);if(!m){s.files.push(l);continue}if(l.body.objectApiName==="Attachment")continue;let h=a.get(l.sourceId);if(!h){p(l,`Copied as ContentVersion ${m.targetId} by the run this one takes up, and its document still cannot be read back`+(d?` (${d})`:"")+": the file is not copied again, nor linked to the records it lacks.");continue}if(u){p(l,`Copied by the run this one takes up; its links could not be read (${u}): it is not linked to the records it lacks.`);continue}s.files.push({...l,into:{documentId:h,linked:f.get(h)??[],unchanged:!0}})}return s}function ff(n){return{objectApiName:"__files__",stage:"scope",failedCount:0,attemptedCount:0,samples:[{recordSummary:"(files)",messages:[n]}]}}function pf(n){return n.reduce((e,t)=>e+t.bytes,0)}function mf(n,e){return n<=e?null:`The files to copy take ${Se(n)} and the target has ${Se(Math.max(0,e))} of file storage left. Lower the largest file copied, or leave the files out.`}async function gf(n,e){let t=await n.remainingFileStorageMB(e);if(!Number.isFinite(t))throw new Error("The target did not say how much file storage it has left.");return t*1048576}function hf(n,e,t){let r=[];for(let o of n.files){let s=r.find(i=>i.objectApiName===o.objectApiName);s||(s={objectApiName:o.objectApiName,planned:0,plannedBytes:0,copied:0,failed:0},r.push(s)),s.planned++,s.plannedBytes+=o.bytes}return{maxFileBytes:e,objects:r,links:0,leftOut:[...n.leftOut],...t===void 0?{}:{remainingStorageBytes:t}}}function In(n,e){let t=n==="Attachment"?"attachment":"file";return e===1?t:`${t}s`}function wf(n){return`[dry-run] ${n.objectApiName}: ${n.planned} ${In(n.objectApiName,n.planned)} would be copied (${Se(n.plannedBytes)})`}function Ta(n,e,t){return n.body.objectApiName==="Attachment"?{Name:n.fields.Name??n.name,BodyLength:n.bytes,ParentId:t}:{Title:n.fields.Title??n.name,Checksum:Na("md5").update(Buffer.from(e,"base64")).digest("hex"),ContentSize:n.bytes}}function Fa(n){let e={};for(let[t,r]of Object.entries(n))t!=="SharingPrivacy"&&(e[t]=r);return e}async function yf(n){let{files:e,sourceOrgId:t,targetOrgId:r,remapper:o,deps:s,report:i,errors:a,onProgress:d,onCopied:c}=n,f=0,u=g=>{let b=i.objects.find(A=>A.objectApiName===g);return b||(b={objectApiName:g,planned:0,plannedBytes:0,copied:0,failed:0},i.objects.push(b)),b},p=(g,b)=>a.find(A=>A.objectApiName===g&&A.stage===b),l=new Map,m=(g,b,A=1)=>{let N=`${g}/${b}`;l.set(N,(l.get(N)??0)+A);let x=p(g,b);x&&(x.attemptedCount+=A)},h=(g,b,A,N,x=!1)=>{let v=p(g,b);v||(v={objectApiName:g,stage:b,failedCount:0,attemptedCount:l.get(`${g}/${b}`)??0,samples:[]},a.push(v)),x||(v.failedCount++,f++),v.samples.length<Ea&&v.samples.push({recordSummary:A,messages:[N]})},w=(g,b,A)=>{h(g.objectApiName,b,`${g.name} (${Se(g.bytes)})`,A),u(g.objectApiName).failed++},y=async(g,b,A)=>{let N=A.flatMap(v=>{let P=o.get(v.id);return P?[{ContentDocumentId:b,LinkedEntityId:P,ShareType:v.shareType??"V",Visibility:v.visibility??"AllUsers"}]:[]});if(N.length===0)return[];let x=[];m("ContentDocumentLink","insert",N.length);try{let v=await s.insertRecords(r,"ContentDocumentLink",N);N.forEach((P,k)=>{let j=v[k];if(j?.success){i.links++,x.push(P.LinkedEntityId);return}h("ContentDocumentLink","insert",g.name,j?.errors.join("; ")||"The target gave no reason.")})}catch(v){for(let P=0;P<N.length;P++)h("ContentDocumentLink","insert",g.name,H(v))}return x},R=e.filter(g=>!(g.body.objectApiName==="ContentVersion"&&g.into?.unchanged)).length,O=0;for(let g of e){await n.waitIfPaused();let b=g.hosts.filter(I=>o.isCreated(I.id)),A=g.body.objectApiName==="ContentVersion"?g.into:void 0,N=A?b.filter(I=>{let C=o.get(I.id);return C!==void 0&&!A.linked.includes(C)}):[];if(A?.unchanged){let I=await y(g,A.documentId,N);I.length>0&&c?.(g,{targetId:A.documentId,linked:I,asVersion:!1});continue}let x=O++,v=b.length>0?o.get(b[0].id):void 0;if(!v&&!A){i.leftOut.push({objectApiName:g.objectApiName,sourceId:g.sourceId,name:g.name,bytes:g.bytes,reason:"record-not-created"});continue}d({objectName:g.objectApiName,status:"running",progress:Math.round(x/R*100),message:`Copying ${In(g.objectApiName,1)} ${x+1} of ${R} (${Se(g.bytes)})`});let P;m(g.objectApiName,"query");try{P=await s.readFileBody(t,g.body.objectApiName,g.body.id)}catch(I){w(g,"query",H(I));continue}let k=Buffer.byteLength(P,"base64");if(k!==g.bytes){w(g,"query",`Read ${k} bytes of the ${g.bytes} the source reports: the file was not written.`);continue}let j=A?{...Fa(g.fields),VersionData:P,ContentDocumentId:A.documentId}:g.body.objectApiName==="ContentVersion"?{...g.fields,VersionData:P,FirstPublishLocationId:v}:{...g.fields,Body:P,ParentId:v},M;m(g.objectApiName,"insert");let D=n.calls?.sending(g.body.objectApiName,[{sourceId:g.sourceId,payload:Ta(g,P,v)}]),E=()=>{D!==void 0&&n.calls?.answered(D)};try{M=await s.insertFile(r,g.body.objectApiName,j)}catch(I){vo(I)!=="may-have-written"&&E(),w(g,"insert",H(I));continue}if(!M.success||!M.id){E(),w(g,"insert",M.errors.join("; ")||"The target gave no reason.");continue}if(u(g.objectApiName).copied++,g.body.objectApiName==="Attachment"){o.add(g.sourceId,M.id,"Attachment"),E(),o.persist?.(),c?.(g,{targetId:M.id,linked:v?[v]:[],asVersion:!1});continue}if(A){o.add(g.sourceId,A.documentId,"ContentDocument"),E(),o.persist?.();let I=await y(g,A.documentId,N);c?.(g,{targetId:A.documentId,linked:I,asVersion:!0});continue}o.add(g.sourceId,M.id,"ContentVersion"),E(),o.persist?.();let F;try{let I=await s.queryRecords(r,`SELECT ContentDocumentId FROM ContentVersion WHERE Id = '${Ce(M.id)}'`);F=I[0]?Y(I[0],"ContentDocumentId"):void 0}catch{F=void 0}if(!F){h("ContentDocument","query",`${g.name} (${Se(g.bytes)})`,`Copied as ContentVersion ${M.id}, but its document could not be read back: the run keeps the version, which a removal of the run takes with its document, and links it to no other record.`,!0);continue}o.add(g.sourceId,F,"ContentDocument"),o.persist?.();let S=await y(g,F,b.slice(1));c?.(g,{targetId:F,linked:v?[v,...S]:S,asVersion:!1})}for(let g of i.objects)d({objectName:g.objectApiName,status:g.failed>0&&g.copied===0?"error":"done",progress:100,message:`Copied ${g.copied} ${In(g.objectApiName,g.copied)} of ${g.planned}`+(g.failed>0?`, ${g.failed} failed`:"")});return f}function If(n,e,t={},r){if(!n)return;let o={};for(let s of e.nodes)es(s)&&(o[s.objectApiName]=[...s.anonymizeFields]);return{fields:o,methods:{...t},...r?{personalFieldsOf:r}:{}}}var Pa=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,va=/@example\.com$/i,jn="@example.invalid",Ca=64,xa=new Set(["fake","mask","preserve_format","shuffle"]);function Ma(n,e,t){return typeof n!="string"||n===""?n:Pa.test(n)?e.email(n.replace(va,jn),t):`${n.replace(/[^A-Za-z0-9._-]/g,"_").slice(0,Ca).replace(/^[._]+|[._]+$/g,"")||"anonymized"}${jn}`}var Ns=class{smartAnonymizer;contactPoints;constructor(e,t){this.smartAnonymizer=new To(e),this.contactPoints=new ms(t)}categorizeField(e,t){let r=t.toLowerCase();if(r==="email")return"email";if(r==="phone")return"phone";let o=Po(e,t);if(o)return o;let s=e.toLowerCase();return s.includes("email")?"email":s.includes("phone")||s.includes("fax")||s.includes("mobile")?"phone":s.includes("firstname")||s.includes("lastname")||s==="name"||Fo(e)?"name":s.includes("street")||s.includes("address")||s.includes("city")||s.includes("state")||s.includes("postalcode")||s.includes("zip")||s.includes("country")?"address":s.includes("ssn")||s.includes("national_id")||s.includes("passport")||s.includes("driver")||s.includes("license")?"ssn_id":s.includes("credit")||s.includes("card")||s.includes("cvv")||s.includes("iban")||s.includes("routing")||s.includes("bank")?"financial":"other"}getDefaultMethod(e){return{email:"fake",phone:"mask",name:"fake",address:"fake",ssn_id:"redact",financial:"hash",other:"nullify"}[e]}getDefaults(){return{email:"fake",phone:"mask",name:"fake",address:"fake",ssn_id:"redact",financial:"hash",other:"nullify"}}anonymize(e){if(e.fields.length===0)return e.records;let t={...this.getDefaults(),...e.methods},r=e.records.map((a,d)=>({...a,Id:e.sourceIds[d]??""})),o=this.anonymizeRecords(r,e.fields,t,e.objectApiName),s=e.fields.filter(a=>this.categorizeField(a.name,a.type)==="email"),i=xa.has(t.phone)?e.fields.filter(a=>this.categorizeField(a.name,a.type)==="phone"):[];return o.map((a,d)=>{let c=e.records[d],f={...a};for(let u of s)f[u.name]=this.undeliverable(f[u.name],u);for(let u of i)f[u.name]=this.fictionalNumber(c[u.name],f[u.name],u);return"Id"in c?f.Id=c.Id:delete f.Id,f})}undeliverable(e,t){let r=t.length!==void 0&&t.length>0?t.length:void 0;return t.type.toLowerCase()==="email"?Ma(e,this.contactPoints,r??ps):typeof e!="string"?e:this.contactPoints.addressesIn(e.replace(/@example\.com(?![\w.-])/gi,jn),r)}fictionalNumber(e,t,r){if(typeof e!="string")return t;if(!/\d/.test(e))return e;let o=r.length!==void 0&&r.length>0?r.length:void 0;return this.contactPoints.phone(e,o)}anonymizeRecords(e,t,r,o){let s=t.map(a=>{let d=this.categorizeField(a.name,a.type);return{objectApiName:o,fieldApiName:a.name,method:r[d],piiCategory:"PII",aiConfidence:1,userOverridden:!1}}),i=e.map(a=>({...a}));return this.smartAnonymizer.anonymize(i,s,o)}};var Es=new WeakMap;function Nf(n,e){typeof n=="object"&&n!==null&&Es.set(n,e)}function Ef(n){return typeof n=="object"&&n!==null?Es.get(n):void 0}var Nn=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,Ts=/^[A-Za-z][A-Za-z0-9_]*$/;function tt(n){if(!n.startsWith('["'))return;let e;try{e=JSON.parse(n)}catch{return}if(!Array.isArray(e))return;let[t,r,o,s]=e;if(!(t!=="c"&&t!=="e"&&t!=="u")&&!(typeof r!="string"||!Nn.test(r))&&!(typeof o!="string"||!Nn.test(o)))return{tag:t,sourceId:r,targetId:o,object:typeof s=="string"&&Ts.test(s)?s:""}}function _e(n){if(!n.startsWith(`["${kt}"`))return;let e;try{e=JSON.parse(n)}catch{return}if(!Array.isArray(e))return;let[,t,r]=e;if(!(typeof t!="string"||!Ts.test(t)||!Array.isArray(r)))return{object:t,ids:r.filter(o=>typeof o=="string"&&Nn.test(o))}}function nt(n){return n.slice(0,15)}var rt=class{offsets=new Float64Array(64);lengths=new Uint16Array(64);size=0;push(e,t){if(this.size===this.offsets.length){let r=new Float64Array(this.size*2);r.set(this.offsets),this.offsets=r;let o=new Uint16Array(this.size*2);o.set(this.lengths),this.lengths=o}this.offsets[this.size]=e,this.lengths[this.size]=t,this.size++}offsetAt(e){return this.offsets[e]}lengthAt(e){return this.lengths[e]}},be=class{capacity=1024;used=0;h1=new Uint32Array(this.capacity);h2=new Uint32Array(this.capacity);taken=new Uint8Array(this.capacity);add(e){let t=se(e),r=ie(e);if(this.slotOf(t,r)>=0)return;this.used+1>this.capacity*.6&&this.grow();let o=this.freeSlotFor(r);this.h1[o]=t,this.h2[o]=r,this.taken[o]=1,this.used++}has(e){return this.slotOf(se(e),ie(e))>=0}get size(){return this.used}slotOf(e,t){let r=this.capacity-1;for(let o=t&r;;o=o+1&r){if(this.taken[o]===0)return-1;if(this.h1[o]===e&&this.h2[o]===t)return o}}freeSlotFor(e){let t=this.capacity-1,r=e&t;for(;this.taken[r]!==0;)r=r+1&t;return r}grow(){let{h1:e,h2:t,taken:r}=this;this.capacity*=2,this.h1=new Uint32Array(this.capacity),this.h2=new Uint32Array(this.capacity),this.taken=new Uint8Array(this.capacity);for(let o=0;o<r.length;o++){if(r[o]===0)continue;let s=this.freeSlotFor(t[o]);this.h1[s]=e[o],this.h2[s]=t[o],this.taken[s]=1}}},La=2e3,ot=class n{constructor(e,t,r,o,s){this.file=e;this.all=t;this.mine=r;this.firstInPart=o;this.unattributed=s}file;all;mine;firstInPart;unattributed;static read(e,t){let r=(f,u)=>tt(e.read(f,u).toString("utf8"))?.sourceId??"",o=new It(r),s=new It(r),i=new rt,a=new rt,d=!1,c=-1;for(let f of we(e)){if(!d){if(!f.text.startsWith('{"run":'))return;d=!0;continue}if(f.text.startsWith('{"part":')){c++;continue}if(f.text.startsWith('{"object":'))return;if(c===t&&_e(f.text)){a.push(f.offset,f.length);continue}let u=tt(f.text);if(!u)continue;let p=se(u.sourceId),l=ie(u.sourceId);if(o.put(o.find(u.sourceId,p,l),p,l,f.offset,f.length,0),c!==t)continue;let m=s.find(u.sourceId,p,l);m<0&&i.push(f.offset,f.length);let h=u.tag==="c"&&u.object!=="";s.put(m,p,l,f.offset,f.length,h?1:0)}return d?new n(e,o,s,i,a):void 0}mappingAt(e,t){return tt(this.file.read(e,t).toString("utf8"))}wordsOn(e){let t=se(e),r=ie(e),o=this.all.find(e,t,r),s=this.mine.find(e,t,r);return{latest:o>=0?{offset:this.all.offsetOf(o),length:this.all.lengthOf(o)}:void 0,createdByThePart:s>=0&&this.mine.codeOf(s)===1,inThePart:s>=0?{offset:this.mine.offsetOf(s),length:this.mine.lengthOf(s)}:void 0}}createdByObject(){let e=new Map;for(let t=0;t<this.firstInPart.size;t++){let r=this.mappingAt(this.firstInPart.offsetAt(t),this.firstInPart.lengthAt(t));if(!r)continue;let o=this.wordsOn(r.sourceId);if(!o.createdByThePart||!o.latest||!o.inThePart)continue;let s=this.mappingAt(o.inThePart.offset,o.inThePart.length);if(!s)continue;let i=e.get(s.object)??new rt;i.push(o.latest.offset,o.latest.length),e.set(s.object,i)}return e}runRecords(e,t=La){let{file:r}=this,o=(h,w)=>tt(r.read(h,w).toString("utf8")),s=(h,w)=>{let y=o(h,w);return y?nt(y.targetId):""},i=new It(s),a=this.createdByObject(),d=[];for(let h of[...a.keys()].reverse()){let w=a.get(h);if(!w)continue;let y=0;for(let R=w.size-1;R>=0;R--){let O=w.offsetAt(R),g=o(O,w.lengthAt(R));if(!g||g.object==="")continue;let b=nt(g.targetId),A=se(b),N=ie(b),x=i.find(b,A,N);x>=0||(i.put(x,A,N,O,w.lengthAt(R),0),(!e||e.has(b))&&y++)}y>0&&d.push({objectApiName:h,count:y})}let c=(h,w)=>{let y=i.find(h,se(h),ie(h),w);return y>=0&&(w===void 0||i.offsetOf(y)===w)&&(!e||e.has(h))},f=h=>_e(r.read(this.unattributed.offsetAt(h),this.unattributed.lengthAt(h)).toString("utf8")),u=new be,p=this.unattributed.size,l=new Map;for(let h=0;h<p;h++){let w=f(h);if(w)for(let y of w.ids){let R=nt(y);u.has(R)||i.find(R,se(R),ie(R))>=0||(u.add(R),(!e||e.has(R))&&l.set(w.object,(l.get(w.object)??0)+1))}}for(let[h,w]of l){let y=d.find(R=>R.objectApiName===h);y?y.count+=w:d.unshift({objectApiName:h,count:w})}let m=h=>u.size>0&&u.has(h)&&(!e||e.has(h));return{objects:d,pages:async function*(h){let w=a.get(h),y=[];if(w)for(let R=w.size-1;R>=0;R--){let O=w.offsetAt(R),g=o(O,w.lengthAt(R));if(!g||g.object==="")continue;let b=nt(g.targetId);c(b,O)&&(y.push(g.targetId),y.length>=t&&(yield y,y=[]))}if(l.has(h)){let R=new be;for(let O=0;O<p;O++){let g=f(O);if(g?.object===h)for(let b of g.ids){let A=nt(b);R.has(A)||!m(A)||i.find(A,se(A),ie(A))>=0||(R.add(A),y.push(b),y.length>=t&&(yield y,y=[]))}}}y.length>0&&(yield y)},has:h=>c(h)||m(h)}}*idMapRows(){let e=new Map;for(let[r,o]of this.createdByObject())for(let s=0;s<o.size;s++){let i=this.mappingAt(o.offsetAt(s),o.lengthAt(s));i&&e.set(i.sourceId.slice(0,3),r)}let t=new Uint8Array(Math.ceil(this.all.slots/8));for(let r of we(this.file)){let o=tt(r.text);if(!o)continue;let s=this.all.find(o.sourceId,se(o.sourceId),ie(o.sourceId));if(s<0||(t[s>>3]&1<<(s&7))!==0)continue;t[s>>3]|=1<<(s&7);let i=this.wordsOn(o.sourceId);if(!i.latest)continue;let a=this.mappingAt(i.latest.offset,i.latest.length);if(!a||a.object==="")continue;yield{objectApiName:(i.createdByThePart&&i.inThePart?this.mappingAt(i.inThePart.offset,i.inThePart.length):void 0)?.object??e.get(a.sourceId.slice(0,3)),sourceId:a.sourceId,targetId:a.targetId,outcome:i.createdByThePart?"created":"linked to existing"}}}};var Ae=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,st=/^[A-Za-z][A-Za-z0-9_]*$/,_a=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/,Da=255,Ba=40,$a=2*6e4,Wa=10*6e4;function $f(n){let[e]=n;return e?Object.keys(e).filter(t=>t!=="Id"&&st.test(t)).filter(t=>n.every(r=>qa(r[t]))).sort().slice(0,Ba):[]}function qa(n){return typeof n=="string"?n.trim()!==""&&n.length<=Da:typeof n=="number"?Number.isFinite(n):typeof n=="boolean"}function za(n){if(typeof n=="boolean")return n?"true":"false";if(typeof n=="number")return Number.isFinite(n)?String(n):"";if(typeof n!="string")return"";let e=n.trim();if(Ae.test(e))return e.slice(0,15);if(_a.test(e)){let r=Date.parse(e);if(Number.isFinite(r))return new Date(r).toISOString()}if(e!==""&&Number.isFinite(Number(e)))return String(Number(e));let t=e.replace(/\s+/g," ").toLowerCase();return t.includes(";")?t.split(";").map(r=>r.trim()).sort().join(";"):t}function Tn(n,e){return Fn(e.map(t=>`${t}${za(n[t])}`).join(""))}function Fn(n){return se(n).toString(36).padStart(7,"0")+ie(n).toString(36).padStart(7,"0")}function Wf(n){let e=bo("insert",n);return e.rows.map(t=>Fn(gn(e.columns.map((r,o)=>[r,t[o]??""]))))}var Ua=/^sf__/;function Fs(n){let e=[];for(let[t,r]of Object.entries(n))Ua.test(t)||e.push([t,typeof r=="string"?r:r==null?"":String(r)]);return Fn(gn(e))}function vs(n,e){return Tn(n,[e])}function Va(n,e){if(!Array.isArray(n))return!1;for(let t of n){if(!Array.isArray(t)||t.length<4)return!1;let[r,o,s,i]=t;if(typeof r!="number"||!Number.isInteger(r)||!e[r]||typeof o!="string"||!st.test(o)||typeof s!="string"||!Ae.test(s))return!1;e[r].owes.push({field:o,sourceRefId:s,...i===1?{insertOnly:!0}:{}})}return!0}function En(n){if(!n.startsWith(`["${At}"`))return;let e;try{e=JSON.parse(n)}catch{return}if(!Array.isArray(e)||e.length<6)return;let[,t,r,o,s,i,a,d]=e;if(typeof t!="string"||typeof r!="string"||!st.test(r)||typeof o!="string")return;let c=Date.parse(o);if(!Number.isFinite(c)||!Array.isArray(s)||!Array.isArray(i)||!s.every(p=>typeof p=="string"&&st.test(p))||d!==void 0&&(typeof d!="string"||!st.test(d)))return;let f=[];for(let p of i){if(!Array.isArray(p)||p.length<2)return;let[l,m,h,w]=p;if(typeof l!="string"||!Ae.test(l)||typeof m!="string"||h!==void 0&&typeof h!="string"||w!==void 0&&typeof w!="string")return;f.push({sourceId:l,fingerprint:m,owes:[],...typeof h=="string"&&h!==""?{externalKey:h}:{},...typeof w=="string"&&w!==""?{jobKey:w}:{}})}let u=a!==void 0;if(!(u&&!Va(a,f)))return{callId:t,objectApiName:r,at:c,fields:s,rows:f,owesKept:u,...typeof d=="string"?{upsertField:d}:{}}}function Cs(n){if(n.startsWith(`["${je}"`))try{let e=JSON.parse(n);return Array.isArray(e)&&typeof e[1]=="string"?e[1]:void 0}catch{return}}function Ga(n){if(n.startsWith(`["${Do}"`))try{let e=JSON.parse(n);return Array.isArray(e)&&typeof e[1]=="string"?e[1]:void 0}catch{return}}function Ja(n){if(n.startsWith(`["${_o}"`))try{let e=JSON.parse(n);if(!Array.isArray(e))return;let[,t,r]=e;return typeof t!="string"||typeof r!="string"||r===""?void 0:{callId:t,jobId:r}}catch{return}}function Ha(n){if(!(!n.startsWith('["c"')&&!n.startsWith('["e"')&&!n.startsWith('["u"')))try{let e=JSON.parse(n);if(!Array.isArray(e))return;let[,t,r,o]=e;return typeof t!="string"||typeof r!="string"||!Ae.test(t)||!Ae.test(r)?void 0:{sourceId:t,targetId:r,object:typeof o=="string"?o:""}}catch{return}}function Ka(n){let e=/"(?:startedAt|at)":"([^"]{10,40})"/.exec(n);return e?Date.parse(e[1]):Number.NaN}function qf(n){return{queryPages:e=>co({query:async t=>n.query(t),queryMore:async t=>n.queryMore(t)},e),userId:async()=>(await n.identity()).user_id,serverTime:async()=>(await n.soap.getServerTimestamp()).timestamp,readJob:e=>Ro(So(n),e)}}function Ya(){return{calls:0,found:[],notFound:[],uncertain:[],unread:[]}}function K(n,e,t=1){if(t<=0)return;let r=n.find(o=>o.objectApiName===e);r?r.rows+=t:n.push({objectApiName:e,rows:t})}function Ps(n){return new Date(n).toISOString().replace(/\.\d{3}Z$/,"Z")}function Pn(n,e,t){return[JSON.stringify(["c",e.sourceId,t,n.objectApiName,n.owesKept?Wo:$o]),...e.owes.map(({field:r,sourceRefId:o,insertOnly:s})=>Uo({objectApiName:n.objectApiName,newId:t,sourceId:e.sourceId,fieldName:r,sourceRefId:o,...s?{insertOnly:s}:{}}))]}function Za(n,e,t,r){let{call:o,rows:s,read:i}=n,{objectApiName:a}=o,d=JSON.stringify([je,o.callId]);if(i.state==="never-closed")return K(r.notFound,a,s.length),{lines:[d],taken:[]};if(i.state==="running")return K(r.uncertain,a,s.length),(r.underway??=[]).push({objectApiName:a,jobId:n.jobId,rows:s.length,...i.info?{state:i.info.state}:{},...i.info?.numberRecordsProcessed!==void 0?{processed:i.info.numberRecordsProcessed}:{},...i.openUntil?{openUntil:i.openUntil}:{},...i.graceLeftMs!==void 0?{graceLeftMs:i.graceLeftMs}:{}}),{lines:[],taken:[]};if(i.state==="unread")return r.unread.push({objectApiName:a,reason:i.reason}),K(r.uncertain,a,s.length),{lines:[],taken:[]};let c=o.upsertField===void 0&&s.every(u=>u.jobKey!==void 0)?Qa(o,s,i.results,e,t,r):Xa(o,s,i.results,e,t,r),f=Date.parse(i.info.systemModstamp??"");return!n.endKept&&c.taken.length>0&&Number.isFinite(f)&&c.lines.unshift(qo(o.callId,n.jobId,new Date(f).toISOString(),new Date(f-n.ahead).toISOString())),c}function Qa(n,e,t,r,o,s){let{objectApiName:i}=n,a=new Map,d=new Set;for(let O of t.successfulResults??[]){let g=O.sf__Id,b=Fs(O);if(typeof g!="string"||!Ae.test(g)){d.add(b);continue}let A=g.slice(0,15);r.has(A)&&!o.has(A)||a.set(b,[...a.get(b)??[],g])}let c=new Set,f=t.unprocessedRecords;for(let O of[...t.failedResults??[],...Array.isArray(f)?f:[]])c.add(Fs(O));let u=new Map;for(let O of e){let g=O.jobKey??"";u.set(g,[...u.get(g)??[],O])}let p=[],l=[],m=[],h=0,w=!1,y=0;for(let[O,g]of u){let b=a.get(O)??[];a.delete(O);let A=d.delete(O);if(g.length===1&&b.length===1&&!A){p.push(...Pn(n,g[0],b[0])),l.push(b[0]),K(s.found,i);continue}if(b.length>0||A){K(s.uncertain,i,g.length),g.length>1&&K(s.untold??=[],i,g.length),A||(y+=g.length),m.push(...b),w=!0;continue}if(g.length>1||c.has(O)){K(s.notFound,i,g.length);continue}h+=g.length}let R=d.size>0;for(let O of a.values())m.push(...O),O.length>0&&(R=!0);return h>0&&(K(R?s.uncertain:s.notFound,i,h),R&&(w=!0,d.size===0&&(y+=h))),y>0&&K(s.ofEndedJobs??=[],i,y),p.push(...xs(n,m,o,w,s)),{lines:p,taken:[...l,...m]}}function xs(n,e,t,r,o){e.length>0&&K(o.unattributed??=[],n.objectApiName,e.length);let s=e.filter(i=>!t.has(i.slice(0,15)));return[...s.length>0?[JSON.stringify([kt,n.objectApiName,s])]:[],...r?[]:[JSON.stringify([je,n.callId])]]}function Xa(n,e,t,r,o,s){let{objectApiName:i}=n,a=n.upsertField,d=new Map;for(let w of t.successfulResults??[]){let y=w.sf__Id;if(typeof y!="string"||!Ae.test(y))continue;let R=y.slice(0,15);if(r.has(R)&&!o.has(R)||a!==void 0&&String(w.sf__Created).toLowerCase()!=="true")continue;let O=a!==void 0?vs(w,a):Tn(w,n.fields);d.set(O,[...d.get(O)??[],y])}let c=new Map;for(let w of e){let y=a!==void 0?w.externalKey??"":w.fingerprint;c.set(y,[...c.get(y)??[],w])}let f=[],u=[],p=[],l=0,m=!1;for(let[w,y]of c){let R=w===""?[]:d.get(w)??[];if(d.delete(w),R.length===0){l+=y.length;continue}if(y.length===1&&R.length===1){f.push(...Pn(n,y[0],R[0])),u.push(R[0]),K(s.found,i);continue}K(s.uncertain,i,y.length),K(s.ofEndedJobs??=[],i,y.length),y.length>1&&K(s.untold??=[],i,y.length),p.push(...R),m=!0}let h=!1;for(let w of d.values())p.push(...w),w.length>0&&(h=!0);return l>0&&(K(h?s.uncertain:s.notFound,i,l),h&&(m=!0,K(s.ofEndedJobs??=[],i,l))),f.push(...xs(n,p,o,m,s)),{lines:f,taken:[...u,...p]}}function Ms(n){let e=new Set;for(let t of we(n)){let r=Cs(t.text);if(r!==void 0)e.delete(r);else{let o=t.text.startsWith(`["${At}"`)?En(t.text):void 0;o&&e.add(o.callId)}}return e.size}async function Ls(n,e,t=()=>new Date){let r=Ya(),o=new Map,s=new Map,i=new Set,a=Number.NEGATIVE_INFINITY;for(let g of we(n)){let b=Cs(g.text);if(b!==void 0){o.delete(b);continue}let A=Ja(g.text);if(A){s.set(A.callId,A.jobId);continue}let N=Ga(g.text);if(N!==void 0){i.add(N);continue}if(g.text.startsWith(`["${At}"`)){let x=En(g.text);x&&(o.set(x.callId,{offset:g.offset,length:g.length}),a=Math.max(a,x.at));continue}if(g.text.startsWith("{")){let x=Ka(g.text);Number.isFinite(x)&&(a=Math.max(a,x))}}if(o.size===0)return r;let d=[];for(let{offset:g,length:b}of o.values()){let A=En(n.read(g,b).toString("utf8"));A&&d.push(A)}r.calls=d.length;let c=new Set(d.map(g=>g.objectApiName)),f=new Set(d.flatMap(g=>g.rows.map(b=>b.sourceId)));r.lookedFor=f;let u=new Set,p=new be,l=new be;for(let g of we(n)){let b=_e(g.text);if(b){if(c.has(b.object))for(let N of b.ids)p.add(N.slice(0,15)),l.add(N.slice(0,15));continue}let A=Ha(g.text);A&&(f.has(A.sourceId)&&u.add(A.sourceId),(A.object===""||c.has(A.object))&&p.add(A.targetId.slice(0,15)))}let m=0;if(e.serverTime)try{let g=t().getTime(),b=Date.parse(await e.serverTime());Number.isFinite(b)&&(m=b-(g+t().getTime())/2)}catch{}let h,w,y=[],R=e.readJob?.bind(e),O=new Set;if(R)for(let g of d){let b=s.get(g.callId);if(b===void 0)continue;O.add(g.callId);let A=g.rows.filter(x=>!u.has(x.sourceId));if(A.length===0){y.push(JSON.stringify([je,g.callId]));continue}let N=Za({call:g,rows:A,jobId:b,read:await R(b),ahead:m,endKept:i.has(g.callId)},p,l,r);y.push(...N.lines);for(let x of N.taken)p.add(x.slice(0,15))}for(let g of c){let b=d.filter(S=>S.objectApiName===g&&!O.has(S.callId));if(b.length===0)continue;let A=b.map(S=>({call:S,rows:S.rows.filter(I=>!u.has(I.sourceId))})),N=A.reduce((S,{rows:I})=>S+I.length,0);if(N===0){for(let{call:S}of A)y.push(JSON.stringify([je,S.callId]));continue}let x=new Map;for(let S of b)x.set(S.fields.join(","),S.fields);let v=[...new Set(b.flatMap(S=>S.upsertField?[S.upsertField]:[]))],P=[...new Set([...b.flatMap(S=>S.fields),...v])].sort(),k;try{if(h===void 0&&w===void 0)try{h=await e.userId()}catch(L){w=H(L)}if(h===void 0)throw new Error(`the user the run writes as is not known: ${w}`);let S=Math.min(...b.map(L=>L.at))+m-$a,I=a+m+Wa,C=P.includes("CreatedDate")?"SystemModstamp":"CreatedDate",B=P.includes("CreatedById")?"":`CreatedById = '${h}' AND `,T=`SELECT ${["Id",...P.filter(L=>L!=="Id")].join(", ")} FROM ${J(g)} WHERE ${B}${C} >= ${Ps(S)} AND ${C} <= ${Ps(I)} ORDER BY Id`;k=[];for await(let L of e.queryPages(T))for(let _ of L){let $=_.Id;if(typeof $!="string"||!Ae.test($)||p.has($.slice(0,15)))continue;let U=new Map;for(let[fe,ft]of x)U.set(fe,Tn(_,ft));let Q=new Map;for(let fe of v)Q.set(fe,vs(_,fe));k.push({id:$,fingerprints:U,externalKeys:Q,taken:!1})}}catch(S){r.unread.push({objectApiName:g,reason:H(S)}),K(r.uncertain,g,N);continue}k.sort((S,I)=>S.id<I.id?-1:S.id>I.id?1:0);let j=new Map;for(let S of x.keys()){let I=new Map;for(let C of k){let B=C.fingerprints.get(S)??"",T=I.get(B)??[];T.push(C),I.set(B,T)}j.set(S,I)}let M=(S,I,C)=>{C.taken=!0,y.push(...Pn(S,I,C.id)),K(r.found,g)},D=new Set;for(let{call:S,rows:I}of A){let C=S.upsertField;if(C===void 0)continue;let B=new Map;for(let L of k){let _=L.externalKeys.get(C);L.taken||_===void 0||B.set(_,[...B.get(_)??[],L])}let T=new Map;for(let L of I){let _=L.externalKey??"";T.set(_,[...T.get(_)??[],L])}for(let[L,_]of T){let $=L===""?[]:B.get(L)??[];if(L===""||_.length>1||$.length>1){K(r.uncertain,g,_.length),D.add(S.callId);continue}$.length===1?M(S,_[0],$[0]):K(r.notFound,g)}}let E=[];for(let{call:S,rows:I}of A){if(S.upsertField!==void 0)continue;let C=S.fields.join(","),B=new Map;for(let T of I){let L=B.get(T.fingerprint)??[];L.push(T),B.set(T.fingerprint,L)}for(let[T,L]of B){let _=(j.get(C)?.get(T)??[]).filter($=>!$.taken);if(_.length>L.length){for(let $ of L)E.push({callId:S.callId,sourceId:$.sourceId});D.add(S.callId);continue}_.forEach(($,U)=>M(S,L[U],$));for(let $ of L.slice(_.length))E.push({callId:S.callId,sourceId:$.sourceId})}}let F=k.some(S=>!S.taken);for(let S of E)F||D.has(S.callId)?(K(r.uncertain,g),D.add(S.callId)):K(r.notFound,g);for(let{call:S}of A)D.has(S.callId)||y.push(JSON.stringify([je,S.callId]))}return y.length>0&&n.append(`${y.join(`
|
|
@@ -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}from"./chunk-
|
|
7
|
+
import{a,b,c,d}from"./chunk-AHUGG3WU.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as ARTICLE_VERSION_OBJECT,b as articleBodyFields,c as articleBodyOptions,d as seedKnowledge};
|