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
package/lib/chunk-KOQV4WXC.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
-
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
-
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
-
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
-
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{d as kn,h as Fn,m as Pn}from"./chunk-CULAOP3U.mjs";import{a as Bn,b as $n}from"./chunk-HF6LAK3G.mjs";import{j as wn,k as Rn,l as Sn,m as An,n as En}from"./chunk-KRNFVAGC.mjs";import{b as gn}from"./chunk-SU65Z2BA.mjs";import{p as it,q as vn}from"./chunk-2OIRJEYE.mjs";import{a as Tn,b as On}from"./chunk-TQ2TQHTT.mjs";import{d as st}from"./chunk-HFSBDM7B.mjs";import{c as yn,g as Ee,h as ot,j as bn}from"./chunk-OHEOJISY.mjs";import{a as hn}from"./chunk-EADHKH3A.mjs";import{E as te,_ as pn,b as ee,da as mn,q as Se,r as Ae,t as rt}from"./chunk-55LQD3Y3.mjs";import{h as nt}from"./chunk-TZE3Y7IQ.mjs";import{b as P}from"./chunk-CA5NAXSU.mjs";import{$ as Kt,Bd as we,Cd as Re,Gc as Ze,P as zt,X as Qt,Z as Ht,_ as pe,aa as Yt,ba as Xt,ca as Jt,da as Zt,dc as rn,fa as me,fc as on,ga as en,gc as sn,ha as tn,ia as nn,ld as he,m as qt,md as un,nd as ye,oc as an,od as ln,pc as dn,pd as et,qd as cn,s as Vt,td as fn,ud as tt,wd as be}from"./chunk-DPYTG6DM.mjs";import{b as H,e as x,i as fe,k as ge,l as $,s as Je}from"./chunk-WZQEK4WT.mjs";var Ao=/^[A-Za-z][A-Za-z0-9_]{0,79}$/;function Nn(e,t){return typeof e=="object"&&e!==null?e[t]:void 0}function xn(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t):[]}function Cn(e){return typeof e=="string"&&Ao.test(e)?e:void 0}function Mn(e){let t=new Map;for(let r of xn(Nn(e,"variables"))){let o=r.name,i=Cn(r.objectType);typeof o=="string"&&i&&t.set(o.toLowerCase(),i)}let n=[];for(let r of xn(Nn(e,"recordCreates"))){let o=r.inputReference,i=Cn(r.object)??(typeof o=="string"?t.get(o.toLowerCase()):void 0);i&&!n.some(s=>s.toLowerCase()===i.toLowerCase())&&n.push(i)}return n}var In={AccountPartner:["Role"],CampaignMember:["Status"],Case:["Status"],Contract:["Status"],Lead:["Status"],Opportunity:["StageName"],OpportunityPartner:["Role"],Order:["Status"],Partner:["Role"],ServiceAppointment:["Status"],Solution:["Status"],Task:["Priority","Status"],WorkOrder:["Status"],WorkOrderLineItem:["Status"]};function nd(e,t){let n=new Map,r=t!==void 0&&Object.prototype.hasOwnProperty.call(In,t)?In[t]:[];for(let o of e){let i=o.type==="multipicklist";if(o.type!=="picklist"&&!i&&!o.picklistValues?.length)continue;let s=(o.type==="combobox"||o.restrictedPicklist===!1)&&!r.includes(o.name);n.set(o.name,{multi:i,restricted:o.restrictedPicklist===!0,required:o.nillable===!1&&o.defaultedOnCreate!==!0,...o.controllerName?{controllerName:o.controllerName}:{},...s?{anyValue:s}:{}})}return n}var Eo=new Set;function To(e,t){let n=new Set(e),r=[],o=new Set,i=(s,a)=>{if(o.has(s))return;let d=t.get(s)?.controllerName;d&&n.has(d)&&a<e.length&&i(d,a+1),!o.has(s)&&(o.add(s),r.push(s))};for(let s of e)i(s,0);return r}function Oo(e){return typeof e=="boolean"?String(e):typeof e=="string"&&e!==""?e:void 0}function ko(e,t){let n=new Map;for(let r of e){let o=t(r),i=n.get(o)??[];i.includes(r)||i.push(r),n.set(o,i)}return[...n]}function Fo(e,t,n,r,o,i,s){let a=new Set(o.values),d=a,l,u=r.controllerName?Oo(e[r.controllerName]):void 0,f=u===void 0?void 0:o.allowedByControllingValue?.get(u);f&&(d=new Set(o.values.filter(R=>f.has(R))),l=r.controllerName);let g=n.filter(R=>!d.has(R));if(g.length===0)return[];let p=R=>s&&!s.has(R)?"not-in-target":a.has(R)?"controlling-value":"record-type",m,b,w=n.filter(R=>d.has(R));return r.multi&&w.length>0?e[t]=w.join(";"):(o.defaultValue!==null&&d.has(o.defaultValue)?(m=o.defaultValue,b="default"):r.required&&(m=o.values.find(R=>d.has(R)),b=m===void 0?void 0:"first"),m===void 0?delete e[t]:e[t]=m),ko(g,p).map(([R,O])=>({field:t,reason:R,values:O,recordType:i,...R==="controlling-value"&&l?{controllingField:l}:{},...m!==void 0&&b?{replacedBy:m,replacement:b}:{}}))}function rd(e,t,n,r,o=Eo){let i=[];for(let s of To(Object.keys(e),n)){let a=e[s];if(typeof a!="string"||o.has(s))continue;let d=n.get(s),l=t?.get(s),u=d?.restricted?r?.picklists.get(s):void 0;if(!l&&!u)continue;if(a===""){delete e[s];continue}let f=d?.multi?a.split(";"):[a];if(d&&u&&r){i.push(...Fo(e,s,f,d,u,r.recordType,l));continue}if(!l||d?.anyValue)continue;let g=f.filter(m=>!l.has(m));if(g.length===0)continue;let p=f.filter(m=>l.has(m));d?.multi&&p.length>0?e[s]=p.join(";"):delete e[s],i.push({field:s,reason:"not-in-target",values:[...new Set(g)]})}return i}var Po="012000000000000AAA",Te="Master",Dn="";function od(e,t){return e?.get(typeof t=="string"?t:Dn)}async function Bo(e,t,n){try{return{picklists:await e(t,n)}}catch(r){return{error:P(r)}}}var jn=class{constructor(t){this.read=t}read;reads=new Map;said=new Set;async forRows(t){let n=new Map,r=[],{read:o}=this;if(!o)return{byRecordType:n,notes:r};if(t.withoutRecordTypes){let l=[...t.fields].filter(([f,g])=>g.restricted&&g.controllerName&&t.written(f)).map(([f])=>f),u=new Set(l.filter(f=>t.rows.some(g=>typeof g[f]=="string"&&g[f]!=="")));if(u.size>0){let f={targetId:Po,developerName:Te},g=await this.readFor(o,t.objectApiName,f.targetId);this.keep(n,r,t.objectApiName,Dn,u,f,g)}return{byRecordType:n,notes:r}}if(!t.recordTypeMappings||!t.written("RecordTypeId"))return{byRecordType:n,notes:r};let i=[...t.fields].filter(([l,u])=>u.restricted&&t.written(l)).map(([l])=>l);if(i.length===0)return{byRecordType:n,notes:r};let s=new Map(t.recordTypeMappings.map(l=>[l.sourceId,l])),a=new Map;for(let l of t.rows){let u=l.RecordTypeId;if(!(typeof u!="string"||!s.has(u)))for(let f of i){let g=l[f];if(typeof g!="string"||g==="")continue;let p=a.get(u)??new Set;p.add(f),a.set(u,p)}}let d=await Promise.all([...a].map(async([l,u])=>{let f=s.get(l);return{sourceId:l,fields:u,target:f,answer:await this.readFor(o,t.objectApiName,f.targetId)}}));for(let{sourceId:l,fields:u,target:f,answer:g}of d)this.keep(n,r,t.objectApiName,l,u,f,g);return{byRecordType:n,notes:r}}readFor(t,n,r){let o=`${n}|${r}`,i=this.reads.get(o);return i||(i=Bo(t,n,r),this.reads.set(o,i)),i}keep(t,n,r,o,i,s,a){let d=`${r}|${s.targetId}`;if("error"in a){this.said.has(d)||(this.said.add(d),n.push({recordType:s.developerName,error:a.error}));return}t.set(o,{recordType:s.developerName,picklists:a.picklists});let l=[...i].filter(u=>!a.picklists.has(u)&&!this.said.has(`${d}|${u}`));if(l.length!==0){for(let u of l)this.said.add(`${d}|${u}`);n.push({recordType:s.developerName,leftOut:l})}}};function sd(e){return e.error!==void 0?{recordSummary:`(picklist values of record type ${e.recordType} could not be read \u2014 checked against each field's values)`,messages:[e.error]}:{recordSummary:`(picklist values of record type ${e.recordType} not given for ${(e.leftOut??[]).join(", ")} \u2014 checked against each field's values)`,messages:[`The target's answer for record type ${e.recordType} leaves out ${(e.leftOut??[]).join(", ")}.`]}}var _n=class{entries=new Map;get size(){return this.entries.size}add(t,n){for(let r of n){let o=[t,r.field,r.reason,r.recordType??"",r.controllingField??"",r.replacement??"",r.replacedBy??""].join("\0"),i=this.entries.get(o);if(i){i.entry.rows++;for(let s of r.values)i.values.add(s);continue}this.entries.set(o,{entry:{objectApiName:t,field:r.field,reason:r.reason,values:[],rows:1,...r.recordType!==void 0?{recordType:r.recordType}:{},...r.controllingField!==void 0?{controllingField:r.controllingField}:{},...r.replacedBy!==void 0?{replacedBy:r.replacedBy}:{},...r.replacement!==void 0?{replacement:r.replacement}:{}},values:new Set(r.values)})}}list(){return[...this.entries.values()].map(({entry:t,values:n})=>({...t,values:[...n].sort()}))}};function $o(e){let t=`${e.rows} row${e.rows===1?"":"s"}`,n=e.values.map(i=>`"${i}"`).join(", "),r=e.reason==="not-in-target"?"not a value of the field in the target":e.reason==="record-type"?`not allowed for record type ${e.recordType??""}`:`not allowed with the value of ${e.controllingField??"its controlling field"}`,o=e.replacedBy===void 0?"left out":e.replacement==="first"?`replaced by "${e.replacedBy}", the first value record type ${e.recordType??""} allows: the field is required and has no default there`:`replaced by "${e.replacedBy}", the default of record type ${e.recordType??""}`;return`${e.field} on ${t}: ${n} ${r}, ${o}`}function id(e){return e.length===0?"":`, picklist values not written as read: ${e.map($o).join("; ")}`}function fd(e){let t={...e.picklistValueMappings?.length?{picklistValueMappings:e.picklistValueMappings}:{},...e.recordTypeMappings?.length?{recordTypeMappings:e.recordTypeMappings}:{},...e.defaultValues?.length?{defaultValues:e.defaultValues}:{},...e.truncateFields?.length?{truncateFields:e.truncateFields}:{},...e.ignoredGaps?.length?{ignoredGaps:e.ignoredGaps}:{},...e.skippedRows?.length?{skippedRows:e.skippedRows}:{}};return Object.keys(t).length>0?t:void 0}var vo=new Set(["picklist_value_refused","picklist_value_absent","currency_inactive"]);function Un(e){let t=zt(e.gapId);return t?t.objectApiName!==e.object?{ignored:`the gap is of ${t.objectApiName}, not of ${e.object}`}:t.field===void 0||t.value===void 0?{ignored:"the gap names no field and value whose rows to hold back"}:vo.has(t.kind)?{held:{field:t.field,...t.recordType!==void 0?{recordType:t.recordType}:{},value:t.value}}:{ignored:`a ${t.kind} gap does not offer it: its rows are not exactly those holding its value`}:{ignored:"not the id of a gap"}}function gd(e){let t=Un(e);return"ignored"in t?t.ignored:void 0}function Ln(e,t,n){if(e===void 0)return!0;let r=t??Te;if(e===r)return!0;let o=Ee(e),i=Ee(r);if(o.namespacePrefix!==void 0||i.namespacePrefix===void 0||i.developerName!==e)return!1;if(n===void 0)return!0;let s=ot(e,n,a=>a);return"found"in s&&s.found.namespacePrefix===i.namespacePrefix}function No(e){return e==null||e===""}var Wn=class{entries=new Map;get size(){return this.entries.size}add(t,n=1){let r=[t.kind,t.objectApiName,t.field??"",t.recordType??"",t.from??"",t.to??""].join("\0"),o=this.entries.get(r);if(o){o.rows+=n;return}this.entries.set(r,{...t,rows:n})}list(){return[...this.entries.values()].map(t=>({...t}))}},Oe=class{picklists=new Map;defaults=new Map;truncated=new Map;skipped=new Map;ignoredGaps;constructor(t){for(let n of t?.picklistValueMappings??[]){let r=this.picklists.get(n.object)??[];r.push(n),this.picklists.set(n.object,r)}for(let n of t?.defaultValues??[]){let r=this.defaults.get(n.object)??[];r.push(n),this.defaults.set(n.object,r)}for(let{object:n,field:r}of t?.truncateFields??[]){let o=this.truncated.get(n)??new Set;o.add(r),this.truncated.set(n,o)}this.ignoredGaps=new Set(t?.ignoredGaps??[]);for(let n of t?.skippedRows??[]){let r=Un(n);if(!("held"in r))continue;let o=this.skipped.get(n.object)??[];o.push(r.held),this.skipped.set(n.object,o)}}skipsRowsOf(t){return this.skipped.has(t)}namesARecordTypeBare(t){return[...(this.picklists.get(t)??[]).map(r=>r.recordType),...(this.skipped.get(t)??[]).map(r=>r.recordType)].some(r=>r!==void 0&&r!==Te&&Ee(r).namespacePrefix===void 0)}holdsBack(t,n,r,o,i){for(let s of this.skipped.get(t)??[]){if(!Ln(s.recordType,r,i))continue;let a=n(s.field);if(!(typeof a!="string"||!a.split(";").includes(s.value)))return o.add({kind:"skip_rows",objectApiName:t,field:s.field,...s.recordType!==void 0?{recordType:s.recordType}:{},from:s.value}),!0}return!1}changesRowsOf(t){return this.picklists.has(t)||this.defaults.has(t)}defaultOf(t,n){let r=this.defaults.get(t)?.find(o=>o.field===n);return r===void 0?void 0:String(r.value)}applyToRow(t,n,r,o,i){for(let s of this.picklists.get(t)??[]){if(!Ln(s.recordType,r,i))continue;let a=n[s.field];if(typeof a!="string"||a==="")continue;let d=a.split(";");if(!d.includes(s.from))continue;let l=d.flatMap(u=>u!==s.from?[u]:s.to===null?[]:[s.to]);l.length===0?delete n[s.field]:n[s.field]=[...new Set(l)].join(";"),o.add({kind:s.to===null?"leave_empty":"map_value",objectApiName:t,field:s.field,...s.recordType!==void 0?{recordType:s.recordType}:{},from:s.from,...s.to!==null?{to:s.to}:{}})}for(let{field:s,value:a}of this.defaults.get(t)??[])No(n[s])&&(n[s]=a,o.add({kind:"set_default",objectApiName:t,field:s,to:String(a)}))}truncate(t,n,r,o){for(let i of this.truncated.get(t)??[]){let s=n[i],a=r.get(i);typeof s!="string"||a===void 0||a<=0||s.length<=a||(n[i]=s.slice(0,a),o.add({kind:"truncate",objectApiName:t,field:i}))}}truncatedFieldsOf(t){return this.truncated.get(t)??new Set}};function pd(e,t){let n=new Map(t.map(s=>[s.objectApiName,s])),r=[],o=new Map,i=[];for(let s of e){let a=n.get(s.object),d=Gn(s.object,s.from,a?.source??[],"the source");if("reason"in d){i.push({decision:s,reason:d.reason});continue}if(s.to===null){o.set(d.type.recordTypeId,s);continue}let l=Gn(s.object,s.to,a?.target??[],"the target");if("reason"in l){i.push({decision:s,reason:l.reason});continue}o.set(d.type.recordTypeId,s),r.push({sourceId:d.type.recordTypeId,targetId:l.type.recordTypeId,developerName:l.type.developerName})}return{mappings:r,bySource:o,unresolved:i}}function Gn(e,t,n,r){let o=ot(t,n.filter(i=>!i.master),st);if("found"in o)return{type:o.found};if("ambiguous"in o){let i=o.ambiguous.map(st),s=i.find(a=>a.namespacePrefix);return{reason:bn(e,t,r,i)+(s?"; a package's is named with its namespace: "+yn(s.namespacePrefix,s.developerName):"")}}return{reason:`${r} has no ${e} record type named ${t}`}}function md(e,t){return t.bySource.size===0?e?[...e]:void 0:[...(e??[]).filter(n=>!t.bySource.has(n.sourceId)),...t.mappings]}import{createHash as Bi}from"node:crypto";import{createHash as Io}from"node:crypto";var qn="lineage:runs",xo="lineage";function Vn(e){let t=e.objects.filter(s=>s.records>0);if(t.length===0)return null;let n="source",r="target",o=[{id:n,type:"source",label:e.source.label,origin:e.source.origin,...e.source.orgId?{orgId:e.source.orgId}:{}}],i=[];for(let s of t){let a=`object:${s.objectApiName}`;o.push({id:a,type:"object",label:s.objectApiName,objectApiName:s.objectApiName,recordCount:s.records}),i.push({sourceId:n,targetId:a}),i.push({sourceId:a,targetId:r,recordCount:s.records})}return o.push({id:r,type:"destination",label:e.target.label,orgId:e.target.orgId,origin:"org"}),{nodes:o,edges:i,operationId:e.operationId,generatedAt:e.generatedAt,module:e.module,action:e.action}}var ke=class{constructor(t,n=100){this.configStore=t;this.limit=n}configStore;limit;save(t){let n=this.read().filter(r=>r.operationId!==t.operationId);n.push(t),this.configStore.set(qn,n.slice(-this.limit),xo)}get(t){let n=this.read();return t===void 0?n[n.length-1]??null:n.find(r=>r.operationId===t)??null}runs(){return this.read().reverse().map(t=>({operationId:t.operationId,generatedAt:t.generatedAt,...t.module?{module:t.module}:{},...t.action?{action:t.action}:{},...Co(t)}))}read(){let t=this.configStore.get(qn);return Array.isArray(t)?t.filter(Mo):[]}};function Co(e){let t=e.nodes.find(n=>n.type==="destination");return t?{targetLabel:t.label}:{}}function Mo(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.operationId=="string"&&typeof t.generatedAt=="string"&&Array.isArray(t.nodes)&&Array.isArray(t.edges)}var jo=100,zn="audit:trail",_o="audit",at=class{constructor(t,n=Vt){this.configStore=t;this.limit=n}configStore;limit;append(t){let n=this.read();n.push(t),this.configStore.set(zn,n.slice(-this.limit),_o)}list(t={}){let n=this.read().reverse(),r=n.filter(s=>(t.module===void 0||s.module===t.module)&&(t.orgId===void 0||s.orgId===t.orgId)),o=t.offset??0,i=t.limit??jo;return{entries:r.slice(o,o+i),total:r.length,offset:o,facets:Do(n)}}read(){let t=this.configStore.get(zn);return Array.isArray(t)?t.filter(Lo):[]}};function Do(e){let t=new Set,n=new Map;for(let r of e)t.add(r.module),r.orgId!==void 0&&!n.has(r.orgId)&&n.set(r.orgId,r.orgAlias);return{modules:[...t].sort(),orgs:[...n].map(([r,o])=>o?{orgId:r,orgAlias:o}:{orgId:r})}}function Lo(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.id=="string"&&typeof t.action=="string"&&typeof t.module=="string"&&typeof t.timestamp=="string"}var Ad="ABORTED_BEFORE_START";function Wo(e){let t=e?.trim().toLowerCase();if(t)return`sha256:${Io("sha256").update(t).digest("hex").slice(0,12)}`}function Ed(e,t,n=new Date){try{let r=e.services?.getSandforgeSetting?.("safety.auditLogging",!0)!==!1;if(!r&&t.outcome==="stopped"&&t.code===void 0)return;let o=n.toISOString(),i=e.orgManager.getOrg(t.orgId),s=i?Ze(i):void 0,a=Wo(i?.username),d=t.source?.origin==="org"?t.source.orgId:void 0,l=d!==void 0?e.orgManager.getOrg(d):void 0,u=l?Ze(l):void 0,f=t.objects??[];if(new at(e.configStore).append({id:crypto.randomUUID(),action:t.action,module:t.module,orgId:t.orgId,...s?{orgAlias:s}:{},...d!==void 0?{sourceOrgId:d}:{},...u?{sourceOrgAlias:u}:{},operationId:t.operationId,outcome:t.outcome,...r&&t.guard?{guard:t.guard}:{},objects:[...f],...t.leftBy?{leftBy:t.leftBy}:{},...a?{userId:a}:{},...t.context?{context:t.context}:{},...t.verdict?{verdict:t.verdict}:{},...t.muted?{muted:t.muted}:{},...t.checkpointId?{checkpointId:t.checkpointId}:{},...t.beforeRun?{beforeRun:{...t.beforeRun}}:{},...t.fit?{fit:{...t.fit}}:{},details:{...t.details,...t.code?{code:t.code}:{}},timestamp:o}),!t.source)return;let g=Vn({operationId:t.operationId,module:t.module,action:t.action,source:t.source.origin==="org"?{origin:"org",orgId:t.source.orgId,label:u??t.source.orgId}:{origin:t.source.origin,label:t.source.label??""},target:{label:s??t.orgId,orgId:t.orgId},objects:Go(f,t.carried),generatedAt:o});g&&new ke(e.configStore).save(g)}catch(r){e.log(`[WARN] audit trail: run ${t.operationId} was not recorded \u2014 ${P(r)}`)}}function Go(e,t){return t?Object.entries(t).map(([n,r])=>({objectApiName:n,records:r})):e.map(n=>({objectApiName:n.objectApiName,records:n.created+n.updated+(n.upserted??0)}))}function Qn(e){return{objectApiName:e,created:0,updated:0,deleted:0,failed:0}}var Uo="__pass2__";function Hn(e){let t=e.errors??[],n=t.some(i=>i.skipped===!0),r=t.some(i=>i.objectApiName===Uo&&i.failedCount>0);return e.failedCount===0&&e.failedReads.length===0&&!n&&!r?"success":e.successCount+e.updatedCount+e.linkedCount+(e.wouldInsertCount??0)>0?"partial":"failure"}function Od(e,t,n){return{forgeId:`forge-${Date.now()}`,status:n.status,graph:t,duration:Date.now()-n.startedAt,timestamp:new Date().toISOString(),idRemapCount:e.remapCount,idRemapTable:e.remapTable,idRemapExisting:e.existingSourceIds,...e.withTheirRecordSourceIds?{idRemapWithTheirRecord:e.withTheirRecordSourceIds}:{},...e.withTheirRecordCount!==void 0&&e.withTheirRecordCount>0?{withTheirRecordCount:e.withTheirRecordCount}:{},...e.linkedToCreatedCount!==void 0&&e.linkedToCreatedCount>0?{linkedToCreatedCount:e.linkedToCreatedCount}:{},createdCount:e.successCount,...e.updatedCount>0?{updatedCount:e.updatedCount}:{},linkedExistingCount:e.linkedCount,existingRecords:e.existingRecords,idRemapByObject:e.remapByObject,idRemapCreated:e.createdByObject,readByObject:e.readByObject,failedReads:e.failedReads,errors:e.errors,truncatedObjects:e.truncatedObjects,...e.cappedObjects?{cappedObjects:e.cappedObjects}:{},...e.fieldExclusionsUnmatched?{fieldExclusionsUnmatched:e.fieldExclusionsUnmatched}:{},...e.orphanParentsCapped?{orphanParentsCapped:e.orphanParentsCapped}:{},...e.files?{files:e.files}:{},...e.fileContentFieldsLeftOut?{fileContentFieldsLeftOut:e.fileContentFieldsLeftOut}:{},...e.encryptedFieldsLeftOut?{encryptedFieldsLeftOut:e.encryptedFieldsLeftOut}:{},...e.picklistValuesChanged?{picklistValuesChanged:e.picklistValuesChanged}:{},...e.currenciesReplaced?{currenciesReplaced:e.currenciesReplaced}:{},...e.recordTypesGiven?{recordTypesGiven:e.recordTypesGiven}:{},...e.writtenWithoutFields?{writtenWithoutFields:e.writtenWithoutFields}:{},...e.lookupsLeftEmptyByFilter?{lookupsLeftEmptyByFilter:e.lookupsLeftEmptyByFilter}:{},...e.contactPoints?{contactPoints:e.contactPoints}:{},...e.writtenBetween?{writtenBetween:e.writtenBetween}:{},...e.apiCalls!==void 0?{apiCalls:e.apiCalls}:{},...e.dryRun?{dryRun:!0,wouldInsertCount:e.wouldInsertCount}:{},...e.gaps?{gaps:e.gaps}:{},...e.decisionsApplied?{decisionsApplied:e.decisionsApplied}:{},...e.mayHaveBeenWritten?{mayHaveBeenWritten:e.mayHaveBeenWritten}:{},...e.remapInJournal?{remapInJournal:!0}:{},...e.sample?{sample:e.sample}:{},...e.roots?{roots:e.roots}:{},...e.reads?{reads:e.reads}:{}}}var Kn="RUN_CANCELLED";function Bd(e){return{idRemapByObject:e.remapByObject,errors:e.errors,notSentByObject:e.notSentByObject,writtenWithoutFields:e.writtenWithoutFields,mayHaveBeenWritten:e.mayHaveBeenWritten}}function $d(e){let t=new Map,n=r=>{let o=t.get(r)??Qn(r);return t.set(r,o),o};for(let r of e.idRemapByObject??[]){let o=n(r.objectApiName);o.created+=r.created,o.updated+=r.updated??0}for(let r of e.errors??[]){if(r.objectApiName.startsWith("__")||r.referenceData===!0||r.stage==="scope"&&r.failedCount===0&&r.skipped!==!0)continue;let o=n(r.objectApiName);o.failed+=r.failedCount,r.skipped===!0&&(o.skipped=r.failedCount>0?"counted":"uncounted")}for(let r of e.notSentByObject??[]){let o=n(r.objectApiName);o.notSent=(o.notSent??0)+r.notSent}for(let r of e.writtenWithoutFields??[]){let o=n(r.objectApiName);o.writtenWithoutFields=(o.writtenWithoutFields??0)+r.rows}for(let{objectApiName:r,sourceIds:o}of e.mayHaveBeenWritten??[]){let i=n(r);i.mayHaveBeenWritten=(i.mayHaveBeenWritten??0)+o.length}return[...t.values()]}function vd(e,t){return t.some(r=>r.created+r.updated>0)?"cancelled":(e?Hn(e):"success")==="success"?"stopped":"cancelled"}function Nd(e){return e?{details:{contactPoints:e.neutralized?"neutralized":"kept",contactPointFields:e.fields.length,contactPointValues:e.values}}:{}}function xd(e){return Object.fromEntries((e.idRemapByObject??[]).map(t=>[t.objectApiName,t.created+t.linked+(t.updated??0)]))}var qd=2e3,Vd=1e4,Vo=Qt;function zd(e,t,n=Vo){let r=t!==void 0&&t>0?Math.floor(t):void 0;return r!==void 0&&r<=n?[]:e.nodes.filter(o=>o.included&&o.recordCountUnknown!==!0).map(o=>({objectApiName:o.objectApiName,rows:r===void 0?o.recordCount:Math.min(o.recordCount,r)})).filter(o=>o.rows>n).sort((o,i)=>i.rows-o.rows)}var ir=.8,se=1024,Pe=2*se,ar=4*se,zo=8*se,Qo=1*se,Ho=4*se,Ko=255,Yo=/__kav$/i,Xo=new Map([ee,Se,Ae,"Campaign","CampaignMember"].map(e=>[e.toLowerCase(),e]));function Be(e){return Xo.get(e.toLowerCase())??e}function Yn(e,t=0){let n=0;for(let r of Object.values(e))typeof r=="string"&&r.length>t&&(n+=Buffer.byteLength(r,"utf8"));return n}function ut(e,t){let n=Be(e);return n===ee?Yn(t):n===Se?rt(t)?ar:Pe:n===Ae&&rt(t)?0:n==="Campaign"?zo:n==="CampaignMember"?Qo:Yo.test(e)?Ho+Yn(t,Ko):Pe}function Jo(e,t){let n=Math.min(t.personAccounts??0,t.rows),r=t.rows-n,o=Be(e);return o===Se?r*Pe+n*ar:o===Ae?r*Pe:r*ut(e,{})}function Zo(e){let t=e.map(({objectApiName:m,rows:b,counted:w,mayAdd:R=0,mayBeByThePlatform:O})=>{let T={rows:R,storageBytes:R*ut(m,{}),...R>0?{mayAdd:R}:{},...O&&O.rows>0?{mayBeByThePlatform:O}:{}};return w?{objectApiName:m,...T,rows:w.rows+T.rows,storageBytes:Jo(m,w)+T.storageBytes}:{objectApiName:m,...T,rows:b.length+T.rows,storageBytes:b.reduce((M,E)=>M+ut(m,E),0)+T.storageBytes}}).filter(({rows:m})=>m>0).sort((m,b)=>b.rows-m.rows||m.objectApiName.localeCompare(b.objectApiName)),n=e.reduce((m,b)=>m+(b.leftOut?.writtenBefore??0),0),r=e.filter(m=>(m.leftOut?.heldBack??0)>0).map(({objectApiName:m,leftOut:b})=>({objectApiName:m,rows:b?.heldBack??0})),o=e.filter(m=>(m.leftOut?.byThePlatform??0)>0).map(({objectApiName:m,leftOut:b})=>({objectApiName:m,rows:b?.byThePlatform??0})),i=e.flatMap(({objectApiName:m,leftOut:b})=>b?.linkedByValue&&b.linkedByValue.rows>0?[{objectApiName:m,...b.linkedByValue}]:[]),s=m=>e.filter(b=>(b.leftOut?.[m]??0)>0).map(({objectApiName:b,leftOut:w})=>({objectApiName:b,rows:w?.[m]??0})),a=s("recordTypeNotInTarget"),d=s("withoutParent"),l=s("noParentInSource"),u=s("outsideFilter"),f=s("linkedToTarget"),g=s("currencyReplaced"),p=e.flatMap(({objectApiName:m,leftEmpty:b=[]})=>b.filter(({rows:w})=>w>0).map(({field:w,rows:R})=>({objectApiName:m,field:w,rows:R})));return{objects:t,...p.length>0?{leftEmpty:p}:{},totalRows:t.reduce((m,b)=>m+b.rows,0),storageBytes:t.reduce((m,b)=>m+b.storageBytes,0),...n>0||r.length>0||a.length>0||o.length>0||i.length>0||d.length>0||l.length>0||u.length>0||f.length>0||g.length>0?{leftOut:{writtenBefore:n,heldBack:r,...a.length>0?{recordTypeNotInTarget:a}:{},...o.length>0?{byThePlatform:o}:{},...i.length>0?{linkedByValue:i}:{},...d.length>0?{withoutParent:d}:{},...l.length>0?{noParentInSource:l}:{},...u.length>0?{outsideFilter:u}:{},...f.length>0?{linkedToTarget:f}:{},...g.length>0?{currencyReplaced:g}:{}}}:{}}}function Qd(e){return JSON.stringify([e.sourceOrgId,e.targetOrgId,e.inputMode,e.recordId??null,e.soqlQuery??null,e.templateId??null,e.aiPrompt??null,...e.queryScope==="records"?["records"]:[]])}var es=16,Xn=class{kept=new Map;note(t,n,r=Date.now()){this.kept.delete(t),this.kept.set(t,{at:r,total:n.totalRows,objects:n.objects.map(({objectApiName:o,rows:i})=>({objectApiName:o,rows:i}))});for(let o of this.kept.keys()){if(this.kept.size<=es)break;this.kept.delete(o)}}of(t){return this.kept.get(t)}},ts=500;function ns(e,t){return e>2*t||e-t>ts}function Hd(e,t,n=Date.now()){return{minutesBefore:Math.max(1,Math.ceil((n-e.at)/6e4)),total:e.total,objects:e.objects.map(({objectApiName:r,rows:o})=>({objectApiName:r,rows:o})),...ns(t,e.total)?{farAbove:!0}:{}}}function Kd(e){let t=e.objects.reduce((n,r)=>n+(r.mayAdd??0),0);return t>0?{pricesForLines:t}:{}}function Yd(e){let t=e.objects.find(n=>n.mayBeByThePlatform)?.mayBeByThePlatform;return!t||t.rows<=0?{}:{rolesMayBeByThePlatform:{rows:t.rows,...t.before===!0?{before:!0}:{}}}}var Fe=$({Max:x(),Remaining:x()}).loose(),rs=$({DataStorageMB:Fe,DailyApiRequests:Fe.optional(),DailyBulkApiBatches:Fe.optional(),FileStorageMB:Fe.optional()}).loose(),os=$({DailyApiRequests:$({Max:x(),Remaining:x()}).loose()}).loose(),ss="the org does not tell this user its daily API requests";function dr(e,t,n){if(e!==null&&typeof e=="object"&&!(t in e))throw new Error(n)}async function is(e){let t=await e.request({method:"GET",url:"/limits"});dr(t,"DataStorageMB",qt);let n=rs.parse(t);return{maxMB:n.DataStorageMB.Max,remainingMB:n.DataStorageMB.Remaining,...n.DailyApiRequests?{dailyApiRequests:{max:n.DailyApiRequests.Max,remaining:n.DailyApiRequests.Remaining}}:{},...n.DailyBulkApiBatches?{dailyBulkApiBatches:{max:n.DailyBulkApiBatches.Max,remaining:n.DailyBulkApiBatches.Remaining}}:{},...n.FileStorageMB?{fileStorage:{maxMB:n.FileStorageMB.Max,remainingMB:n.FileStorageMB.Remaining}}:{}}}async function Jn(e){let t=await e.request({method:"GET",url:"/limits"});dr(t,"DailyApiRequests",ss);let n=os.parse(t);return{max:n.DailyApiRequests.Max,remaining:n.DailyApiRequests.Remaining}}var lt=200,ur=2e3,as=.1;function ds(e){return e.reduce((t,{rows:n,bulk:r,readRows:o,perCall:i})=>{let s=Math.min(lt,Math.max(1,i??lt)),a=n<=0?0:r?En(n):Math.ceil(n/s),d=o&&o>0?Math.ceil(o/ur):0;return t+a+d},0)}var pt=["checkpoint","mute","readBack","deliverability","fit"],us={checkpoint:"for the checkpoint taken first",mute:"to assign and take back the permission sets that mute the target's automation",readBack:"to read back the record types the target gave",deliverability:"to read whether the target delivers its emails",fit:"to fit the run to the storage"};function ls(e){return pt.reduce((t,n)=>t+Math.max(0,e[n]??0),e.run)}function cs(e){return pt.some(t=>(e[t]??0)>0)?{...e}:void 0}function dt(e,t){let n=typeof e=="number"?void 0:cs(e),r=typeof e=="number"?e:ls(e),o=n?{parts:n}:{};if(!t)return{verdict:"unread",estimate:r,unread:"the limits the org answered list no DailyApiRequests",...o};if("unread"in t)return{verdict:"unread",estimate:r,unread:t.unread,...o};let{max:i,remaining:s}=t;return{verdict:r>s?"exceeds":s-r<as*i?"near":"fits",estimate:r,max:i,remaining:s,...o}}function fs(e){if(!e)return"";let t=pt.filter(n=>(e[n]??0)>0).map((n,r)=>`${e[n]}${r===0?" of them":""} ${us[n]}`);return t.length>0?` (${t.join(", ")})`:""}var ne="API_BUDGET_EXCEEDED";function gs(e,t,n){if(e.verdict==="exceeds")return`The run takes about ${e.estimate} API requests${fs(e.parts)}, and ${t} has ${e.remaining} of its ${e.max} daily requests left: it would stop part way through, its records refused with REQUEST_LIMIT_EXCEEDED. Run it once the org has requests to spare \u2014 the limit is counted over the last 24 hours \u2014 or write fewer records. `+(n?`${n} `:"")+"Nothing was written."}function ps(e){return e.verdict==="near"?{apiRequests:{estimate:e.estimate,remaining:e.remaining,max:e.max,...e.parts?{parts:{...e.parts}}:{}}}:{}}var $e="CHECKPOINT_REFUSED";function ms(e){return e?{checkpoint:e.estimate.apiRequests}:{}}function hs(e){let t=e?.refusal;if(t!==void 0)return{code:$e,message:it(t),refusal:t}}var ys="The run was stopped while it took the checkpoint first: nothing of it was kept, and nothing was written.";async function Xd(e){let t;try{t=await e()}catch(n){return{stop:{code:$e,message:vn(n)}}}return t.taken?{checkpoint:t.checkpoint}:"stopped"in t?{stop:{code:Kn,message:ys}}:{stop:{code:$e,message:it(t.refusal),refusal:t.refusal}}}var Zn=1e4,bs=1e4,ws=.01;function Rs(e,t,n){return t<2e3||Bn.has(e)||(n??$n).has(e)}function ve(e,t,n){if(t<=0)return{jobs:[],rest:0};if(Rs(e,t,n.restOnly))return{jobs:[],rest:t};let r=[];for(let o=t;o>0;o-=Zn){let i=Math.min(o,Zn);if(i<2e3)return{jobs:r,rest:i};r.push(i)}return{jobs:r,rest:0}}function Ss(e){return Rn({stateReads:An(e,wn,"save")})}function As(e,t,n){let{jobs:r,rest:o}=ve(e,t,n);return r.reduce((i,s)=>i+Ss(s),0)+Math.ceil(o/lt)}var Es=4,Ts=3;function Os(e){let t=new Set(e.updatedAfterInsert??[]),n=new Map((e.plan.leftOut?.linkedByValue??[]).map(({objectApiName:d,rows:l})=>[d,l])),r=[...e.plan.objects.map(({objectApiName:d,rows:l})=>({objectApiName:d,rows:l+(n.get(d)??0)})),...[...n].filter(([d])=>!e.plan.objects.some(l=>l.objectApiName===d)).map(([d,l])=>({objectApiName:d,rows:l}))],o=e.plan.objects.filter(({objectApiName:d})=>t.has(d)).map(({objectApiName:d,rows:l})=>({objectApiName:d,rows:l})),{bulk:i}=e,s=e.files!==void 0&&e.files>0?e.files:0,a=i?Es*r.filter(({rows:d})=>d>0).length:0;return{run:(i?[...r,...o].reduce((d,{objectApiName:l,rows:u})=>d+As(l,u,i),0):ds([...r,...o]))+s+a+Math.max(0,e.sentBefore??0),...ms(e.checkpoint),...e.mute!==void 0&&e.mute>0?{mute:e.mute}:{},...e.readBack!==void 0&&e.readBack>0?{readBack:e.readBack}:{},...e.deliverability!==void 0&&e.deliverability>0?{deliverability:e.deliverability}:{}}}var ks=200;function Fs(e){let t={...e.measures.restOnly?{restOnly:e.measures.restOnly}:{}},n=new Set(e.updatedAfterInsert??[]),r=e.plan.objects.map(({objectApiName:a,rows:d})=>({objectApiName:a,rows:d,writes:ve(a,d,t),updates:n.has(a)?ve(a,d,t):void 0})),o=r.flatMap(({writes:a,updates:d})=>d?[a,d]:[a]),i=e.measures.files,s=i&&"count"in i&&i.count>0?i.count:0;return{objects:r.map(({objectApiName:a,rows:d,writes:l})=>({objectApiName:a,rows:d,jobs:l.jobs.length})),sourceRequests:(e.measures.sourceReads??r.reduce((a,{rows:d})=>a+Math.ceil(Math.max(0,d)/ur),0)+s+Math.ceil(s/ks))+Ts*r.filter(({rows:a})=>a>0).length+(e.sourceSentBefore===void 0?Math.max(0,e.measures.heldReads??0):Math.max(0,e.sourceSentBefore)),bulkBatches:o.reduce((a,{jobs:d})=>a+d.reduce((l,u)=>l+Math.ceil(u/bs),0),0),durationSeconds:o.reduce((a,{jobs:d,rest:l})=>a+d.reduce((u,f)=>u+Sn(f,"save"),0)+l*ws,0),restObjects:r.filter(({rows:a,writes:d})=>a>0&&d.jobs.length===0).map(({objectApiName:a})=>a)}}var Ps="the limits the org answered list no DailyBulkApiBatches";function Bs(e,t){if(e.verdict==="exceeds")return`The run writes through Bulk API jobs that take about ${e.estimate} of the daily Bulk API batches, and ${t} has ${e.remaining} of its ${e.max} left: its jobs would be refused part way through. Run it once the org has batches to spare \u2014 the limit is counted over the last 24 hours, and Bulk API 1.0 shares it \u2014 or leave objects out. Nothing was written.`}function $s(e,t){if(e.verdict==="exceeds")return`The run reads the source records in about ${e.estimate} API requests, and ${t} has ${e.remaining} of its ${e.max} daily requests left: the reads would stop part way through, and the org's own integrations with them. Run it once the org has requests to spare \u2014 the limit is counted over the last 24 hours \u2014 or leave objects out. Nothing was written.`}function vs(e,t){if(e.verdict==="exceeds")return`The files to copy take about ${L(e.estimateMB)} MB of file storage, and ${t} has ${e.remainingMB} MB left of ${e.maxMB} MB: leave out the objects whose files take it, turn the copy of files off on Review, or free file storage in ${t}. Nothing was written.`}function Ns(e,t){return`A clone of the whole org reads a few objects whole, and ${e.map(({objectApiName:r,rows:o})=>`${r} (${o} rows)`).join(", ")} ${e.length===1?"holds":"hold"} more than the ${t} rows of one object the sandforge.forge.maxRecordsPerObject setting lets a run hold at once: raise the setting or leave the object out on Review. Nothing was written.`}var xs=200;function Cs(e){if(!e||e.length===0)return;let t=Math.min(...e.map(r=>r.bound)),n=e.map(({objectApiName:r,rows:o})=>({objectApiName:r,rows:o}));return{code:"READ_BOUND_EXCEEDED",message:Ns(n,t),readBound:{bound:t,objects:n.slice(0,xs)}}}var lr="FILES_UNREAD",cr="FILE_STORAGE_UNREAD";function Ms(e,t,n){if(!e)return{};if("unmeasured"in e)return{files:{unmeasured:!0},stop:{code:lr,message:`The source would neither sum nor list its files, so what they take of the file storage ${n} has left is not known: turn the copy of files off on Review, or run it again once the source answers. Nothing was written.`}};if(e.count<=0)return{};let r=fr({storageBytes:e.bytes},"unread"in t?t:t.fileStorage??{unread:"the limits the org answered list no FileStorageMB"});if(r.verdict==="unread")return{files:{count:e.count,check:r},stop:{code:cr,message:`The file storage ${n} has left could not be read (${r.unread}), so the ${e.count} files to copy could not be checked against it: turn the copy of files off on Review, or run it again once the org answers. Nothing was written.`}};let o=vs(r,n);return{files:{count:e.count,check:r},...o!==void 0&&r.verdict==="exceeds"?{stop:{code:"STORAGE_EXCEEDED",message:o,storage:{estimateMB:Number(L(r.estimateMB)),remainingMB:r.remainingMB,kind:"files"}}}:{}}}function Is(e){let t=e.wholeOrg,n=t?.measures.files,r=dt(Os({...e,...t?{bulk:t.measures.restOnly?{restOnly:t.measures.restOnly}:{},...n&&"count"in n?{files:n.count}:{}}:{}}),e.budget),o=gs(r,e.target),i=[],s=hs(e.checkpoint);s&&i.push(s),o!==void 0&&i.push({code:ne,message:o,...t&&r.verdict==="exceeds"?{api:{kind:"requests",org:"target",estimate:r.estimate,remaining:r.remaining}}:{}});let a;if(t){let f=Fs({...e,measures:t.measures,...t.sourceSentBefore!==void 0?{sourceSentBefore:t.sourceSentBefore}:{}}),g=f.bulkBatches>0?dt(f.bulkBatches,t.bulkBatches??{unread:Ps}):void 0,p=g&&Bs(g,e.target);p!==void 0&&g?.verdict==="exceeds"&&i.push({code:ne,message:p,api:{kind:"bulkBatches",org:"target",estimate:g.estimate,remaining:g.remaining}});let m=dt(f.sourceRequests,t.sourceBudget),b=$s(m,t.source);b!==void 0&&m.verdict==="exceeds"&&i.push({code:ne,message:b,api:{kind:"requests",org:"source",estimate:m.estimate,remaining:m.remaining}}),a={source:m,...g?{bulkBatches:g}:{},cost:f}}let[d,...l]=i,u=l.filter(f=>f.code===ne);return{api:r,...d?{stop:d}:{},...t&&u.length>0?{alsoRefused:u}:{},...a?{wholeOrg:a}:{},asks:e.checkpoint!==void 0||t!==void 0,confirmation:{...ps(r),...e.checkpoint?{checkpoint:e.checkpoint}:{}}}}function fr(e,t,n=0){let r=Math.max(0,n),o=e.storageBytes+r,i=o/1048576,s=r>0?{automationMB:r/1048576}:{};if("unread"in t)return{verdict:"unread",estimateMB:i,unread:t.unread,...s};let{maxMB:a,remainingMB:d}=t;return{verdict:o>d*1048576?"exceeds":o>ir*d*1048576?"near":"fits",estimateMB:i,maxMB:a,remainingMB:d,...s}}function js(e,t){if(!t||t.length===0)return 0;let n=new Map;for(let{objectApiName:r,bytes:o}of t)n.set(r,(n.get(r)??0)+Math.max(0,o));return e.objects.reduce((r,{objectApiName:o,rows:i})=>r+i*(n.get(o)??0),0)}function xe(e){return`about ${L(e.estimateMB)} MB of data storage`+(e.automationMB!==void 0&&e.automationMB>0?`, about ${L(e.automationMB)} MB of it for what the target's automation creates under them`:"")}function _s(e,t){let n=Zo(e),r=t.emailTextBytes,o=e.some(s=>Be(s.objectApiName)===ee&&s.counted);if(r===void 0||!Number.isFinite(r)||!o)return n;let i=n.objects.map(s=>Be(s.objectApiName)===ee?{...s,storageBytes:s.storageBytes+Math.max(0,r)}:s);return{...n,objects:i,storageBytes:i.reduce((s,a)=>s+a.storageBytes,0)}}function Ds(e,t,n){return e.flatMap(({objectApiName:r,included:o,piiFields:i,anonymizeFields:s})=>{if(!o||!t.has(r))return[];let a=new Set(n?s:[]),d=i.filter(l=>!a.has(l));return d.length>0?[{objectApiName:r,fields:d}]:[]})}function Ls(e){let t=e.leftOut??[],n=new Set(t.map(({objectApiName:i})=>i)),r=[...t,...e.nodes.filter(i=>i.leftOutByUser===!0&&!n.has(i.objectApiName)).map(({objectApiName:i})=>({objectApiName:i,reason:"excludedByUser"}))],o=new Map;for(let{reason:i}of r)o.set(i,(o.get(i)??0)+1);return{objects:r,counts:[...o].map(([i,s])=>({reason:i,count:s})).sort((i,s)=>s.count-i.count||i.reason.localeCompare(s.reason))}}var Ws=2;async function Jd(e){let t=w=>({unread:P(w)}),n=_s(e.objects,e.measures),r=await is(e.target.limits).catch(t),o="unread"in r?await Jn(e.target.limits).catch(t):r.dailyApiRequests,i=await Jn(e.source.limits).catch(t),s=fr(n,r,js(n,e.automation)),a=Si(s,e.target.org),d=e.sample?Qs({sample:e.sample,storage:r,target:e.target.org}):void 0,l=Ms(e.measures.files,r,e.target.org),u=e.sentBefore?.(),f=Is({plan:n,...e.updatedAfterInsert?{updatedAfterInsert:e.updatedAfterInsert}:{},...e.readBack!==void 0?{readBack:e.readBack}:{},...e.checkpoint?{checkpoint:e.checkpoint}:{},...e.mute!==void 0?{mute:e.mute}:{},deliverability:e.deliverability??Ws,...u?{sentBefore:u.target}:{},budget:o,target:e.target.org,wholeOrg:{measures:e.measures,bulkBatches:"unread"in r?r:r.dailyBulkApiBatches,sourceBudget:i,source:e.source.org,...u?.source!==void 0?{sourceSentBefore:u.source}:{}}}),g=[Cs(e.measures.readWholeOver),d,d===void 0&&a!==void 0&&s.verdict==="exceeds"?{code:"STORAGE_EXCEEDED",message:`${a} Nothing was written.`,storage:{estimateMB:Number(L(s.estimateMB)),remainingMB:s.remainingMB}}:void 0,l.stop,f.stop,...f.alsoRefused??[]].filter(w=>w!==void 0),p=e.measures.restOnly?{restOnly:e.measures.restOnly}:{},m=new Set(n.objects.map(({objectApiName:w})=>w)),{wholeOrg:b}=f;return{wouldInsert:n.objects.map(({objectApiName:w,rows:R})=>{let{jobs:O,rest:T}=ve(w,R,p);return{objectApiName:w,rows:R,jobs:O.length,byRest:T}}),totalRows:n.totalRows,targetRequests:f.api,sourceRequests:b.source,...b.bulkBatches?{bulkBatches:b.bulkBatches}:{},storage:s,...l.files?{files:l.files}:{},durationSeconds:b.cost.durationSeconds,leftOut:{...Ls(e.graph),...n.leftOut?{rows:n.leftOut}:{}},personalAsIs:Ds(e.graph.nodes,m,e.anonymizePII),wouldBeRefused:g,...e.measures.personAccountsAsBusiness?{personAccountsAsBusiness:e.measures.personAccountsAsBusiness}:{},...e.sample?{sample:e.sample}:{}}}var Gs="SAMPLE_STORAGE_UNREAD",gr="SAMPLE_CANNOT_FIT",Us="SAMPLE_TOO_LARGE",pr="SAMPLE_PLAN_MISMATCH",ct="SAMPLE_PLAN_GONE";function qs(e){let{storage:t,bounds:n,target:r}=e;if("unread"in t&&!(n.withinMB!==void 0||n.maxTotal!==void 0))return{code:Gs,message:`The data storage ${r} has left could not be read (${t.unread}), and a sample is fitted to it: there is nothing to hold it to. Give the most it may take (--fit-within <MB>) or the most records (--max-total <n>), or run it again once the org answers. Nothing was written.`}}function Vs(e,t){if(e.remainingMB===void 0||e.share===void 0)return;let n=Math.max(0,t.remainingMB-(e.roundingMB??0));return Math.floor(e.share*n*1048576)}function zs(e){let{sample:t,storage:n,target:r}=e,o=Vs(t.budget,n);if(o===void 0||t.storageBytes<=o)return;let i=Er(t.storageBytes/1048576,o/1048576),s=L(t.budget.bytes/1048576);return{code:"STORAGE_EXCEEDED",message:`The sample was fitted to ${s} MB of the data storage ${r} had left (${t.budget.remainingMB} MB), and ${r} now says ${n.remainingMB} MB left, which holds ${i.bound} MB of a sample: the sample takes about ${i.over} MB. Simulate again \u2014 run the dry run again \u2014 to draw a sample that fits: a run never cuts its sample short. Nothing was written.`,storage:{estimateMB:Number(i.over),remainingMB:n.remainingMB},sample:{fittedMB:Number(s),holdsMB:Number(i.bound)}}}function Qs(e){let{sample:t,storage:n,target:r}=e;return"unread"in n?qs({storage:n,bounds:t.budget,target:r}):zs({sample:t,storage:n,target:r})}var Hs=new Set(["gone","changed","otherOrg","otherSetup","otherSha"]),Ks={changed:"is no longer as its dry run wrote it: its ids changed since",otherOrg:"was drawn of another org than the source",otherSetup:"was drawn for another setup of the run \u2014 other flags, filters, objects or options of the sample",otherSha:"is not the plan its dry run printed"};function Ys(e,t){return t==="resume"?{code:ct,message:`The plan of the sample this run resumes ${e==="gone"?"is no longer on this machine":"is no longer as it was written"}: the records it was to write cannot be taken up after where it stopped (--resume). Remove what it wrote (--remove), or run the clone again without --resume to draw a new sample. Nothing was written.`,sample:{plan:e}}:e==="gone"?{code:ct,message:'No plan of a sample is at the path given to --fit-plan: give the folder its dry run printed ("sample plan: \u2026"), within a day of it, or leave --fit-plan out to draw a new sample. Nothing was written.',sample:{plan:e}}:{code:pr,message:`The plan given to --fit-plan ${Ks[e]}: run the dry run again with the flags of this run, and replay the plan it prints. Nothing was written.`,sample:{plan:e}}}var Xs=new Set([Us,gr,ct,pr]),Js=20;function Zd(e,t){if(e instanceof Error){if(e.name==="SampleRefusedError"){let{code:n,heaviest:r,sample:o}=e;if(typeof n!="string"||!Xs.has(n))return;let i=Array.isArray(r)?r.flatMap(d=>{let l=d?.objectApiName;return typeof l=="string"?[l]:[]}):[],s=Xt({code:n,sample:o})?.sample??{},a={...s,...n===gr&&s.heaviest===void 0&&i.length>0?{heaviest:i.slice(0,Js)}:{}};return V.of({code:n,message:e.message,...Object.keys(a).length>0?{sample:a}:{}})}if(e.name==="SamplePlanError"&&t!=="draw"){let{refusal:n}=e;return typeof n!="string"||!Hs.has(n)?void 0:V.of(Ys(n,t))}}}var Zs=$({SingleEmail:$({Max:x(),Remaining:x()}).loose().optional(),DailyWorkflowEmails:$({Max:x(),Remaining:x()}).loose().optional()}).loose();async function eu(e){let t=Zs.parse(await e.request({method:"GET",url:"/limits"})),n={};for(let r of["SingleEmail","DailyWorkflowEmails"]){let o=t[r];o&&(n[r]={max:o.Max,remaining:o.Remaining})}return n}var ei=15;function mr(e){let t=e.SingleEmail;return t!==void 0&&t.max<=ei}function ti(e){return mr(e)&&e.DailyWorkflowEmails!==void 0}function ni(e,t,n=!1){let r=e.map(a=>({...a,sentBy:[...a.sentBy]})),o=(a,d)=>{let l=r.find(u=>u.objectApiName===a.objectApiName&&u.limit===d);if(!l){let u={...a,limit:d,sentBy:[...a.sentBy]};return r.push(u),u}l.perRecord+=a.perRecord;for(let u of a.sentBy)l.sentBy.includes(u)||l.sentBy.push(u);return l},i=e.filter(a=>a.limit==="SingleEmail"),s=e.filter(a=>a.limit==="DailyWorkflowEmails");if(n)for(let a of i)o(a,"DailyWorkflowEmails");if(t)for(let a of s)o(a,"SingleEmail").alertsAmong=!0;return r}function hr(e){let t=new Map(e.objects.map(n=>[n.objectApiName,{rows:n.rows,byThePlatform:0}]));for(let{objectApiName:n,rows:r}of e.leftOut?.byThePlatform??[]){let o=t.get(n)??{rows:0,byThePlatform:0};t.set(n,{rows:o.rows+r,byThePlatform:o.byThePlatform+r})}return t}function mt(e){return new Set([...hr(e)].flatMap(([t,{rows:n}])=>n>0?[t]:[]))}function ri(e,t,n){let r=hr(e),o=new Map;for(let s of t){let{rows:a,byThePlatform:d}=r.get(s.objectApiName)??{rows:0,byThePlatform:0};if(a===0)continue;let l=o.get(s.limit)??{limit:s.limit,objects:[],emails:0,verdict:"fits"};l.objects.push({objectApiName:s.objectApiName,rows:a,perRecord:s.perRecord,sentBy:s.sentBy,...d>0?{byThePlatform:d}:{}}),l.emails+=a*s.perRecord,o.set(s.limit,l)}let i=Ne(n)?n.unread:void 0;return[...o.values()].map(s=>{if(i!==void 0||Ne(n))return{...s,verdict:"unread",unread:i};let a=n[s.limit];return a?{...s,verdict:s.emails>a.remaining?"exceeds":"fits",remaining:a.remaining,max:a.max}:{...s,verdict:"unread",unread:`the org's limits list no ${s.limit}`}})}function Ne(e){return typeof e.unread=="string"}function oi(e,t,n){let r=!Ne(n)&&mr(n),o=!Ne(n)&&ti(n),i=ri(e,ni(t,r,o),n);if(!r)return i;let s=mt(e);return t.some(d=>d.limit==="DailyWorkflowEmails"&&s.has(d.objectApiName))?i.map(d=>d.limit==="SingleEmail"?{...d,alertsCounted:!0}:d):i}async function tu(e){if(e.plan.totalRows===0||e.objects.length===0)return{checks:[]};let t;try{t=await e.readAutomation(e.objects)}catch(s){return{checks:[],unread:`the target's automation: ${P(s)}`}}let n=ii(t,si(e.plan)),r=n!==void 0?{unread:n}:{},o=cn(t);if(o.length===0)return{checks:[],...r};let i=await e.readLimits().catch(s=>({unread:P(s)}));return{checks:oi(e.plan,o,i),...r}}function si(e){let t=mt(e);return(n,r)=>r==="insert"&&t.has(n)}function ii(e,t,n="the target's"){let r=[yr(e.unread,n),ui(e,t)].filter(o=>o!==void 0).join("; ");return r!==""?r:void 0}var ai={flows:"flows",processes:"processes",workflowRules:"workflow rules"};function yr(e,t){let n=e.flatMap(({part:r,reason:o})=>{let i=ai[r];return i!==void 0?[`${t} ${i}: ${o}`]:[]});return n.length>0?n.join("; "):void 0}var K=10;function di(e){if(e.condition!=="unreadable")return;let t=e.apiName.indexOf("__");return t>0?e.apiName.slice(0,t):void 0}function ui(e,t){let n=e.objects.flatMap(o=>{let s=[...new Set(he(o).filter(d=>t(o.objectApiName,d.write)).flatMap(d=>d.fired).flatMap(({flow:d,keptQuiet:l})=>d!==void 0&&l!==!0&&d.condition!=="read"&&d.timing!=="beforeSave"?[d]:[]))].map(d=>{let l=di(d);return l!==void 0?`${d.label} (package ${l}, whose flows the org lets no one read)`:d.label});if(s.length===0)return[];let a=s.length>K?` and ${s.length-K} more`:"";return[{count:s.length,words:`${s.slice(0,K).join(", ")}${a} on ${o.objectApiName}`}]});return n.length===0?void 0:`the definition${n.reduce((o,{count:i})=>o+i,0)===1?"":"s"} of ${n.map(({words:o})=>o).join("; ")}`}function nu(e){return{limit:e.limit,emails:e.emails,remaining:e.remaining??0,max:e.max??0,objects:e.objects.map(({objectApiName:t,perRecord:n})=>({objectApiName:t,perRecord:n})),...e.alertsCounted?{alertsCounted:!0}:{}}}function ru(e){return{limit:e.limit,emails:e.emails,unread:e.unread??""}}var li={SingleEmail:{one:"single email",more:"single emails"},DailyWorkflowEmails:{one:"workflow email",more:"workflow emails"}};function br(e,t){let n=li[t];return`${e} ${e===1?n.one:n.more}`}function ci(e,t){return e.alertsCounted?`, its email alerts among them: ${t} counts them against its single emails, as a Developer Edition does`:""}function ou(e,t){let n=e.filter(o=>o.verdict==="exceeds");if(n.length===0)return;let r=n.map(o=>`about ${br(o.emails,o.limit)}`+(o.alertsCounted?" (its email alerts among them, as a Developer Edition counts them)":"")+`, ${o.remaining??0} of ${o.max??0} left today`).join("; ");return`The target's automation would make ${t} send ${r}: 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. Assign the user a bypass that keeps what sends quiet \u2014 muting the target's automation for the run (--mute-automation on the command line, the Mute box on a page) assigns, for the run alone, those the target's flows test \u2014 or write fewer records.`}function su(e,t){return e.map(n=>{let r=n.objects.map(i=>`${i.perRecord} per ${i.objectApiName}, by ${i.sentBy.join(", ")}`+(i.byThePlatform?`; ${i.byThePlatform} ${i.objectApiName} written by the platform with ${te(i.objectApiName)}, whose flows run all the same`:"")).join("; "),o=` emails: these records make ${t} send about ${br(n.emails,n.limit)} (${r})`+ci(n,t);return n.verdict==="unread"?`${o}; what it has left today could not be read (${n.unread??""})`:n.verdict==="fits"?`${o}; it has ${n.remaining??"?"} of ${n.max??"?"} left today`:`${o}, more than the ${n.remaining??"?"} of ${n.max??"?"} it has left today: past them the action fails, and a record whose flow fails in the save is refused (CANNOT_EXECUTE_FLOW_TRIGGER). A bypass that keeps the flow quiet, or a smaller run, avoids it`})}var wr="EMAILS_NOT_ACCEPTED";function iu(e,t={}){let n=[yr(e,"the target's"),...t.applyAssignmentRules===!0?e.filter(({part:r})=>r==="assignmentRules").map(({reason:r})=>`the target's assignment rules: ${r}`):[]].filter(r=>r!==void 0);return n.length>0?n.join("; "):void 0}function au(e){return"requests"in e&&typeof e.requests=="number"?Math.max(0,e.requests):sr}function du(e){let t=e?.read?.requests??0;return t>0?{deliverability:t}:{}}var Rr={clone:{run:"this clone",allTheSame:"to clone all the same"},sync:{run:"this sync",allTheSame:"to sync all the same"},seed:{run:"this seed",allTheSame:"to seed all the same"},autopilot:{run:"this Autopilot run",allTheSame:"to run it all the same"},rewind:{run:"this rewind",allTheSame:"to rewind all the same"},undo:{run:"this undo",allTheSame:"to undo all the same"},masking:{run:"this masking",allTheSame:"to mask all the same"},restore:{run:"this restore",allTheSame:"to restore all the same"},cleanup:{run:"this cleanup",allTheSame:"to delete all the same"},empty:{run:"this emptying",allTheSame:"to empty all the same"},load:{run:"this load",allTheSame:"to load all the same"}},fi={flow:"flow",process:"process",workflowRule:"workflow rule",assignmentRule:"assignment rule"},gi={email:"",notRead:" (its definition was not read)",assignment:" (applied: it can mail the owner it assigns)"};function Sr(e){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function re(e){let t=new Map;for(let n of e){let r=t.get(n.objectApiName)??[];r.push(`${fi[n.kind]} "${n.name}"${gi[n.why]}`),t.set(n.objectApiName,r)}return[...t].map(([n,r])=>{let o=r.length>K?[...r.slice(0,K),`${r.length-K} more`]:r;return`${Sr(o)} on ${n}`}).join("; ")}var er="read with one line of anonymous Apex that sends nothing";function Ar(e){return"level"in e&&e.level==="withheld"}function pi(e){return"unread"in e?`deliverability: not read (${e.unread}) \u2014 the run is refused without --accept-emails, as on All email`:e.level==="all"?`deliverability: All email \u2014 the emails of what still runs go out (${er})`:`deliverability: System email only or No access \u2014 none of the emails its flows, processes, workflow rules and Apex send goes out, and the org still counts them against its daily email limits (${er})`}function mi(e,t){let{run:n,allTheSame:r}=Rr[e.run],{target:o}=e,i=re(e.senders),s=e.sendersUnread,a=i!==""?`what still runs as ${n} writes its records sends some: ${i}`+(s!==void 0?`; what could not be read may send more (${s})`:""):`what runs as ${n} writes its records could not all be read (${s??""}), so it may send some`,d=[];"unread"in t?d.push(`Whether ${o} delivers the emails its automation sends could not be read (${t.unread}), and ${a}.`,`Nothing was written. Add --accept-emails ${r}, or check Setup > Deliverability: on System email only or No access, none of them goes out.`):d.push(`${o} delivers every email its automation sends (Setup > Deliverability: All email), and ${a}.`,e.keepsAddresses===!0?`They go to the addresses the records and the alerts name: those of the records ${n} writes, as they hold them, the records' owners, the records already in ${o}, and an address an alert names.`:`They go to the addresses the records and the alerts name: those ${n} writes are under .invalid, but not the records' owners, the records already in ${o}, nor an address an alert names.`,`Nothing was written. Add --accept-emails ${r}, set the org's deliverability to System email only, or turn off what sends them.`);let l=e.muteQuiets??[];if(l.length>0){let u=new Set(l.map(g=>`${g.objectApiName}\0${g.kind}\0${g.name}`)),f=e.senders.filter(g=>!u.has(`${g.objectApiName}\0${g.kind}\0${g.name}`));d.push(`--mute-automation keeps quiet ${re(l)}, which ${l.length===1?"tests":"test"} a bypass a permission set of ${o} holds`+(f.length>0?`; it cannot quiet ${re(f)}.`:"."))}return d.join(" ")}function uu(e){if(e.senders.length===0&&e.sendersUnread===void 0)return{verdict:"nothingSends",confirmation:{}};let t=e.reading??{unread:"the run did not read it"},n={reading:t,senders:[...e.senders],...e.sendersUnread!==void 0?{sendersUnread:e.sendersUnread}:{}},r=pi(t);return Ar(t)?{verdict:"withheld",deliverability:n,confirmation:{},line:r,audit:"withheld"}:{verdict:"asks",deliverability:n,confirmation:{deliverability:e.keepsAddresses===!0?{...n,keepsAddresses:!0}:n},...e.accepted?{}:{stop:{code:wr,message:mi(e,t)}},line:r,audit:"unread"in t?"unread":"all"}}function lu(e,t){let n=mt(t);return e.filter(r=>!n.has(r.objectApiName))}function cu(e){if(e.length===0)return;let t=[...new Set(e.map(n=>n.objectApiName))];return` emails: ${re(e)} send nothing: the run writes no ${Sr(t)} record. A real run is refused all the same, and names them: it asks before it reads which records it writes`}function fu(e){let t=d=>`${d.objectApiName}\0${d.kind}\0${d.name}`,n=new Set(e.planned.map(t)),r=e.held.filter(d=>!n.has(t(d)));if(r.length===0||e.accepted)return;let o=e.reading;if(o!==void 0&&Ar(o))return;let{run:i,allTheSame:s}=Rr[e.run],a=o===void 0?`whether ${e.target} delivers them was not read, as nothing that sends one was to run`:"unread"in o?`whether ${e.target} delivers them could not be read (${o.unread})`:`${e.target} delivers every one of them (All email)`;return{code:wr,relit:r,message:`The mute's lease does not hold every permission set it was to assign, and what they were to keep quiet still runs for ${i}: ${re(r)} may send emails, and ${a}. The run's question did not ask about them. Nothing was written. Add --accept-emails ${s}, or run it again once the lease can assign them.`}}function gu(e){return e.verdict==="unread"?{estimateMB:e.estimateMB,unread:e.unread}:{estimateMB:e.estimateMB,maxMB:e.maxMB,remainingMB:e.remainingMB,near:e.verdict==="near"}}function L(e){return ft(e,e<10?2:1)}function ft(e,t){if(e<=0)return"0";let n=10**t;return(Math.ceil(e*n-1e-9)/n).toString()}function Er(e,t){let n={over:e<10?2:1,bound:t<10?2:1};for(;;){let r={over:ft(e,n.over),bound:ft(t,n.bound)},o=Math.max(n.over,n.bound);if(Number(r.over)>Number(r.bound)||o>=6)return r;n={over:o+1,bound:o+1}}}function Tr(e){return e.map(({objectApiName:t,kind:n,name:r})=>({objectApiName:t,kind:n,name:r}))}function hi(e){return Tr(et(e,"insert"))}function yi(e,t){let n=new Set(t);return Tr(et(e,"update",r=>n.has(r)))}var Or=["lookups","statuses","invitees","retry","upsert"];function pu(e,t={}){let n=gt(e,t.leftOut),r=new Set(n),o=new Map,i=(u,f)=>{if(!r.has(u))return;let g=o.get(u)??new Set;g.add(f),o.set(u,g)},s=e.edges.filter(u=>Pn(u)&&r.has(u.sourceObject)&&r.has(u.targetObject)),a=new Map;for(let{sourceObject:u,targetObject:f}of s)u!==f&&a.set(u,[...a.get(u)??[],f]);let d=(u,f)=>{let g=new Set([u]),p=[u];for(let m=p.shift();m!==void 0;m=p.shift())for(let b of a.get(m)??[]){if(b===f)return!0;g.has(b)||(g.add(b),p.push(b))}return!1},l=s.filter(u=>u.required!==!0&&u.insertOnly!==!0);for(let{sourceObject:u,targetObject:f}of l)(u===f||d(f,u))&&i(f,"lookups");for(let u of Object.keys(mn))i(u,"statuses");for(let u of Object.keys(pn))i(u,"invitees");if(t.retry===!0)for(let{sourceObject:u,targetObject:f}of l)u!==f&&i(f,"retry");if(t.upsert===!0)for(let u of n)i(u,"upsert");return n.flatMap(u=>{let f=o.get(u);return f?[{objectApiName:u,steps:Or.filter(g=>f.has(g))}]:[]})}function bi(e){let t=new Set(e.flatMap(n=>n.steps));return Or.filter(n=>t.has(n))}function mu(e,t=[]){let n=new Set(t);return fn(e,(r,o)=>o==="insert"||o==="update"&&n.has(r))}function hu(e,t,n){let r=new Set(ye(e).map(s=>s.toLowerCase())),o=t.filter(s=>!r.has(s.toLowerCase())),i=we(e,o);return o.map(s=>{let a=i.find(l=>l.permission.toLowerCase()===s.toLowerCase()),d=a?.permissionSet?.name;return{permission:s,...d?{permissionSet:d}:{},others:a?.others.map(l=>l.name)??[],...a&&!d?{noneHolds:!0}:{},...d&&n?.alias&&n.username?{command:Re(d,n.alias,n.username)}:{}}})}function wi(e){return e==="flows"||e==="triggers"||e==="processes"||e==="workflowRules"||e==="automation"}function ie(e){return e.unread.flatMap(({part:t,reason:n})=>wi(t)?[{part:t,reason:n}]:[])}var yu="OWNER_MAP_INACTIVE",bu="OWNER_MAP_UNKNOWN",V=class e extends Error{code;storage;ceiling;reason;api;readBound;sample;roots;constructor(t,n,r,o,i,s){super(n),this.name="ForgeRunGateError",this.code=t,r&&(this.storage=r),o!==void 0&&(this.ceiling=o),i!==void 0&&(this.reason=i),s?.api&&(this.api=s.api),s?.readBound&&(this.readBound=s.readBound),s?.sample&&(this.sample=s.sample),s?.roots&&(this.roots=s.roots)}static of(t){return new e(t.code,t.message,t.storage,void 0,t.refusal?.code,{...t.api?{api:t.api}:{},...t.readBound?{readBound:t.readBound}:{},...t.sample?{sample:t.sample}:{},...t.roots?{roots:t.roots}:{}})}get stop(){if(Yt(this.code))return{code:this.code,...this.storage?{storage:this.storage}:{},...this.ceiling!==void 0?{ceiling:this.ceiling}:{},...this.reason!==void 0&&this.code===$e?{reason:this.reason}:{},...this.api&&this.code===ne?{api:this.api}:{},...this.readBound&&this.code==="READ_BOUND_EXCEEDED"?{readBound:this.readBound}:{},...this.sample?{sample:this.sample}:{},...this.roots&&(Ri.has(this.code)||this.code==="STORAGE_EXCEEDED")?{roots:this.roots}:{}}}},Ri=new Set(["ROOTS_QUERY_REFUSED","NO_ROOTS","ROOTS_EXCEEDED","ROOTS_PLAN_MISMATCH","ROOTS_PLAN_GONE"]);function wu(e){return e instanceof V||e instanceof Error&&e.name==="ForgeRunGateError"&&typeof e.code=="string"}var tr="FILE_STORAGE_EXCEEDED";function Ru(e){if(!(e instanceof Error)||e.name!=="ForgeFilesRefusedError")return;let{code:t,storage:n}=e;if(t===lr||t===cr)return new V(t,e.message);let r=n?.neededBytes,o=n?.remainingBytes;if(t!==tr||typeof r!="number"||typeof o!="number"||!Number.isFinite(r)||!Number.isFinite(o))return;let i=o/1048576;return new V(tr,e.message,{estimateMB:Number(Er(r/1048576,i).over),remainingMB:i,kind:"files"})}function Si(e,t){if(e.verdict==="exceeds")return`The records to write take ${xe(e)}, and ${t} has ${e.remainingMB} MB left of ${e.maxMB} MB: leave objects out, lower the records per object, or free data storage in ${t}.`}var nr=10;function Su(e,t,n){let r=[`write gate: ${e.totalRows} record(s) to write to ${n}, ${xe(t)}`];for(let i of e.objects.slice(0,nr))r.push(` ${i.objectApiName.padEnd(42)}${String(i.rows).padStart(8)}`);let o=e.objects.slice(nr);if(o.length>0){let i=o.reduce((s,a)=>s+a.rows,0);r.push(` and ${o.length} more object(s), ${i} record(s)`)}for(let{objectApiName:i,mayAdd:s}of e.objects)s!==void 0&&r.push(` counted in: up to ${s} ${i} record(s) the run may read as it writes them, a price in the currency of the record its lines belong to, the source's own beside the one read`);for(let{objectApiName:i,mayBeByThePlatform:s}of e.objects)s!==void 0&&r.push(` counted in: up to ${s.rows} ${i} record(s) the platform `+(s.before===!0?`may have written with ${te(i)}, in the run this one takes up`:`may write itself with ${te(i)}`)+", which the run then links to and does not send");r.push(...Ai(e.leftOut));for(let{objectApiName:i,field:s,rows:a}of e.leftEmpty??[])r.push(` written empty: ${i}.${s} on ${a} record(s), the record it names held back by the run, never written`);return t.verdict==="unread"?(r.push(` the data storage ${n} has left could not be read (${t.unread}): whether the records fit is not known`),r):(r.push(` data storage of ${n}: ${t.remainingMB} MB left of ${t.maxMB} MB`),t.verdict==="near"&&r.push(` that is more than ${Math.round(ir*100)} % of what ${n} has left: Salesforce counts storage a while after a load, so less may be left than it says`),r)}function Ai(e){if(!e)return[];let t=[];e.writtenBefore>0&&t.push(` not counted: ${e.writtenBefore} record(s) the run it retries or resumes wrote, which it links to and does not write again`);for(let{objectApiName:n,rows:r}of e.heldBack)t.push(` not counted: ${n}, ${r} record(s), held back for a record type closed to the user the run writes as`);for(let{objectApiName:n,rows:r}of e.recordTypeNotInTarget??[])t.push(` not counted: ${n}, ${r} record(s), held back for a record type the target has none of, which it would refuse`);for(let{objectApiName:n,rows:r}of e.withoutParent??[])t.push(` not counted: ${n}, ${r} record(s) held back with a record they cannot be written without, held back itself`);for(let{objectApiName:n,rows:r}of e.noParentInSource??[])t.push(` not counted: ${n}, ${r} record(s) left aside: a lookup they may not leave empty names a record the source does not hold, which no copy can write`);for(let{objectApiName:n,rows:r}of e.outsideFilter??[])t.push(` not counted: ${n}, ${r} record(s) left aside: a lookup they may not leave empty names a record outside its object's filter, which the run does not copy`);for(let{objectApiName:n,rows:r}of e.byThePlatform??[])t.push(` not counted: ${n}, ${r} record(s) written by the platform with ${te(n)}, which the run links to and does not send`);for(let{objectApiName:n,rows:r,fields:o}of e.linkedByValue??[])t.push(` not counted: ${n}, ${r} record(s) the target holds under the same ${o.join(", ")}, which the run links to and does not create`);for(let{objectApiName:n,rows:r}of e.linkedToTarget??[])t.push(` not counted: ${n}, ${r} record(s), the standard price book: linked to the target's own, never written`);for(let{objectApiName:n,rows:r}of e.currencyReplaced??[])t.push(` not counted: ${n}, ${r} record(s) in a currency the target lacks, replaced by the source's own price in the currency written, for the same product and price book`);return t}var Ei={flow:e=>`flow "${e}" runs before a record is deleted, and can refuse the delete`,trigger:e=>`Apex trigger ${e} runs on a delete, and can refuse it`,packageTrigger:e=>`Apex trigger ${e}, installed by a managed package, runs on a delete and can refuse it; no one in the org can change it`,lock:()=>"once activated, a record locks the records under it, which a removal then takes only with it, or once it is back in Draft"},Ti=["flows","triggers"];function Au(e,t,n=[],r="--remove"){let o=Ti.filter(s=>n.some(a=>a.part===s)),i=o.length===0?[]:[` ${o.map(s=>j[s]).join(" and ")} could not be read: whether one refuses the removal is not known`];if(e.length===0&&o.length===0)return[`reversibility: nothing found in ${t} that refuses a removal of this run's records (no flow before a delete, no Apex trigger on one, no record that locks past Draft)`];if(e.length===0){let s=[...o.includes("flows")?[]:["no flow before a delete"],...o.includes("triggers")?[]:["no Apex trigger on a delete"],"no record that locks past Draft"];return[`reversibility: nothing found in ${t} that refuses a removal of this run's records in what could be read (${s.join(", ")})`,...i]}return[`reversibility: a removal of this run's records (${r}) may be refused in ${t}:`,...e.map(({objectApiName:s,kind:a,name:d})=>` ${s}: ${Ei[a](d??"")}`),...i]}var j={flows:"the flows",triggers:"the Apex triggers",processes:"the Process Builder processes",workflowRules:"the workflow rules",automation:"the automation"};function W({kind:e,name:t}){return e==="flow"?`flow "${t}"`:e==="process"?`process "${t}"`:e==="workflowRule"?`workflow rule "${t}"`:`Apex trigger ${t}`}var Oi={lookups:"a lookup filled in once its record exists",statuses:"an order or a contract given back its status after it went in as a draft",invitees:"an event's invitee given its answer",retry:"a lookup the run it retries left empty filled in",upsert:"a record the target holds written over by --upsert"};function Y(e){return e.map(t=>`${t.objectApiName}: ${W(t)}`).join("; ")}function ht(e,t,n){return e.flatMap(r=>{if(r.command){let o=r.others.length>0?`; ${r.others.join(", ")} hold${r.others.length===1?"s":""} it too`:"";return[`${r.permissionSet} is the smallest permission set of ${t} that holds ${r.permission}${o}. Assigned to the user ${n} writes as, it keeps quiet what ${r.permission} excludes: ${r.command}`]}return r.noneHolds?[`No permission set of ${t} holds ${r.permission}: an admin creates one that includes it, and assigns it to the user ${n} writes as.`]:[]})}function yt(e,t,n){let r=[...new Set(e.flatMap(o=>o.permissionSet??[]))];return!n||r.length===0?[]:[`With --mute-automation, the ${t} assigns ${r.join(", ")} to the user it writes as for the ${t} alone, under a lease, and what ${r.length===1?"it keeps":"they keep"} quiet does not fire.`]}function Eu(e,t,n={}){let r=n.updated??[],o=hi(e),i=yi(e,r.map(l=>l.objectApiName)),s=ie(e);if(o.length===0&&i.length===0&&s.length===0)return;let a=[];if(o.length>0&&a.push(`${t} runs automation on the records this clone inserts: ${Y(o)}.`),i.length>0){let l=bi(r.filter(u=>i.some(f=>f.objectApiName===u.objectApiName))).map(u=>Oi[u]);a.push(`${t} runs automation as this clone updates records it inserted (${l.join("; ")}): ${Y(i)}.`)}let d=r.length>0?"inserts and updates":"inserts";for(let{part:l,reason:u}of s)a.push(`${j[l][0].toUpperCase()}${j[l].slice(1)} of ${t} could not be read (${u}), so what fires as the clone ${d} is not known.`);return a.push(...ht(n.assign??[],t,"the clone")),a.push(...yt(n.assign??[],"clone",n.mayMute===!0)),a.push(`Nothing was written. Add --accept-automation to clone all the same, or turn that automation off in ${t} first.`),a.join(" ")}function Tu(e,t,n={}){let r=tt(e,n.drafted??[]),o=ie(e);if(r.length===0&&o.length===0)return;let i=[],s=r.filter(d=>d.write==="update"),a=r.filter(d=>d.write==="delete");if(a.length>0){let d=a.map(l=>`${l.objectApiName}: ${W(l)} (${oe[l.when]})`);i.push(`${t} runs automation on the records this removal deletes: ${d.join("; ")}.`)}s.length>0&&i.push(`${t} runs automation as this removal sets activated records back to Draft, the only way the platform deletes them: ${Y(s)}.`);for(let{part:d,reason:l}of o)i.push(`${j[d][0].toUpperCase()}${j[d].slice(1)} of ${t} could not be read (${l}), so what fires as the removal deletes is not known.`);return i.push(...ht(n.assign??[],t,"the removal")),i.push(...yt(n.assign??[],"removal",n.mayMute===!0)),i.push(`Nothing was deleted. Add --accept-automation to remove all the same, or turn that automation off in ${t} first.`),i.join(" ")}var oe={before:"before delete",after:"after delete",beforeAndAfter:"before and after delete"};function Ou(e,t,n,r){let o=[`removal automation: what ${t} runs as the removal takes the records back`];for(let s of tt(e,r))o.push(s.write==="delete"?` ${s.objectApiName}: ${oe[s.when]}: ${W(s)}`:` ${s.objectApiName}: set back to Draft before its delete: ${W(s)}`);let i=ie(e);o.length===1&&i.length===0&&o.push(` nothing fires on the ${n} object(s) it deletes records of`);for(let{part:s,reason:a}of i)o.push(` ${j[s]} could not be read: ${a}`);return o}var ki={bringBack:"brought back from the recycle bin",recreate:"made again with a new Id",giveBack:"given back its values from before the run",setToDraft:"set back to Draft before its delete"};function ku(e,t,n,r="removal",o){let i=ie(e),s=(a,d)=>{let l=[Fi[d](t)];for(let u of be(e,a))l.push(u.step==="delete"?` ${u.objectApiName}: ${oe[u.when]}: ${W(u)}`:` ${u.objectApiName}: ${ki[u.step]}: ${W(u)}`);if(l.length===1&&i.length===0){let u=new Set(Object.values(a).flat()).size,f=Pi.has(d)?"deletes":"writes";l.push(` nothing fires on the ${u} object(s) it ${f} records of`)}return l};return[...s(n,r),...o?s(o,kr(r)):[],...i.map(({part:a,reason:d})=>` ${j[a]} could not be read: ${d}`)]}var Fi={removal:e=>`removal automation: what ${e} runs as the removal takes the run back`,reload:e=>`reload automation: what ${e} runs as the reload purges what earlier loads created`,reloadSweep:e=>`reload automation: what ${e} runs as the reload's sweep deletes what the target's automation made for the loads it replaces`,replayAgain:e=>`replay automation: what ${e} runs as the replay purges what earlier replays created`,replayAgainSweep:e=>`replay automation: what ${e} runs as the replay's sweep deletes what the target's automation made for the replays it replaces`};function Fu(e,t,n){let r=be(e,n.steps),o=n.sweep?be(e,n.sweep):[],i=ie(e);if(r.length===0&&o.length===0&&i.length===0)return;let s=l=>r.filter(u=>u.step===l),a=rr[n.subject??"removal"],d=[];if(s("bringBack").length>0&&d.push(`${t} runs automation as ${a.this} brings back from the recycle bin what the run deleted: ${Y(s("bringBack"))}.`),s("giveBack").length>0&&d.push(`${t} runs automation as ${a.this} gives the records the run wrote over their values from before it: ${Y(s("giveBack"))}.`),s("setToDraft").length>0&&d.push(`${t} runs automation as ${a.this} sets activated records back to Draft, the only way the platform deletes them: ${Y(s("setToDraft"))}.`),s("delete").length>0){let l=s("delete").map(u=>`${u.objectApiName}: ${W(u)} (${oe[u.when]})`);d.push(`${t} runs automation on the records ${a.this} deletes: ${l.join("; ")}.`)}if(o.length>0){let l=o.map(u=>`${u.objectApiName}: ${W(u)} (${oe[u.when]})`);d.push(`${t} runs automation on the records ${rr[kr(n.subject??"removal")].this} deletes: ${l.join("; ")}.`)}for(let{part:l,reason:u}of i)d.push(`${j[l][0].toUpperCase()}${j[l].slice(1)} of ${t} could not be read (${u}), so what fires as ${a.the} writes is not known.`);return d.push(...ht(n.assign??[],t,a.who)),d.push(...yt(n.assign??[],a.run,n.mayMute===!0)),d.push(`Nothing was written or deleted. Add --accept-automation to ${a.verb} all the same, or turn that automation off in ${t} first.`),d.join(" ")}var Pi=new Set(["reloadSweep","replayAgainSweep"]);function kr(e){return e==="replayAgain"||e==="replayAgainSweep"?"replayAgainSweep":"reloadSweep"}var rr={removal:{this:"this removal",the:"the removal",who:"the removal",run:"removal",verb:"remove"},reload:{this:"this reload's purge",the:"the reload's purge",who:"the reload",run:"reload",verb:"reload"},reloadSweep:{this:"this reload's sweep",the:"the reload's sweep",who:"the reload",run:"reload",verb:"reload"},replayAgain:{this:"this replay's purge",the:"the replay's purge",who:"the replay",run:"replay",verb:"replay again"},replayAgainSweep:{this:"this replay's sweep",the:"the replay's sweep",who:"the replay",run:"replay",verb:"replay again"}};var $i=2e3,vi=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function Pr(e,t){let n=e!==void 0&&Number.isFinite(e)?Math.floor(e):t;return Math.min(pe,Math.max(1,n))}function Cu(e){return e===void 0||!Number.isFinite(e)?$i:Math.max(1,Math.floor(e/10))}function Br(e){return e!==void 0&&Number.isFinite(e)&&e>=1?Math.floor(e):Kt}function Mu(e){let t=tn(e);if(t!==void 0)return{issue:t};let n=Jt(e);return n?{objectApiName:n.objectApiName,query:{...n.where!==null?{where:n.where}:{},...n.orderBy!==null?{orderBy:n.orderBy}:{},...n.limit!==null?{limit:n.limit}:{}}}:{issue:{kind:"noObject"}}}function Iu(e){if(e.where!==void 0&&!Zt.safeParse(e.where).success)return{kind:"where"};if(e.orderBy!==void 0&&!en.safeParse(e.orderBy).success)return{kind:"orderBy"};if(e.limit!==void 0&&!(Number.isInteger(e.limit)&&e.limit>=1&&e.limit<=pe))return{kind:"limit"}}function ju(e,t,n,r){let o=nt(e),i=[...t.where!==void 0?[`(${t.where})`]:[],...n!==void 0&&n!==""?[`(${n})`]:[]],s=i.length>0?` WHERE ${i.join(" AND ")}`:"",a=t.limit!==void 0&&t.limit<=r?t.limit:r+1;return`SELECT Id FROM ${o}${s} ORDER BY ${t.orderBy??"Id"} LIMIT ${a}`}function Ni(e,t,n){return!Number.isFinite(e)||e<1||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0?0:Math.max(0,Math.min(Math.floor(e)-1,Math.floor(n*e/t)))}function _u(e,t,n){let r=t.where!==void 0?` WHERE ${t.where}`:"";return`SELECT Id FROM ${nt(e)}${r} ORDER BY ${t.orderBy??me} LIMIT ${Math.max(1,Math.floor(n))}`}function Du(e,t,n){if(e.verdict!=="exceeds")return;let r=Ni(n.count,e.estimateMB,e.remainingMB),o=`the ${n.count} ${n.objectApiName} records the query chooses`,i=r>=1?`about ${r} of ${o} fit, each with what its clone copies: a LIMIT of ${r} in the query clones that many \u2014 after ORDER BY ${me}, the newest \u2014, or narrow its WHERE; or leave objects out, or free data storage in ${t}.`:`one of ${o} takes more than that by itself, with what its clone copies: leave objects out, clone less deep, or free data storage in ${t}.`;return{code:"STORAGE_EXCEEDED",message:`The records to write take ${xe(e)}, and ${t} has ${e.remainingMB} MB left of ${e.maxMB} MB: ${i} ${G}`,storage:{estimateMB:Number(L(e.estimateMB)),remainingMB:e.remainingMB},...X(n.objectApiName).roots?{roots:{objectApiName:n.objectApiName,...r>=1?{fits:r}:{}}}:{}}}function xi(e){let t=new Set,n=[];for(let r of e){let o=Tn(r);t.has(o)||(t.add(o),n.push(r))}return n.sort(On)}function Fr(e){return Bi("sha256").update(xi(e).join(`
|
|
8
|
-
`)).digest("hex")}function Lu(e){return vi.test(e)}function Ci(e,t){let n=r=>r===void 0?void 0:r.replace(/\s+/g," ").trim();return n(e?.where)===n(t?.where)&&n(e?.orderBy??"Id")===n(t?.orderBy??"Id")&&e?.limit===t?.limit}function Wu(e,t){if(e.sourceOrgId!==t.sourceOrgId)return"otherOrg";if(e.objectApiName.toLowerCase()!==t.objectApiName.toLowerCase()||t.query!==void 0&&!Ci(e.query,t.query)||t.ids!==void 0&&Fr(t.ids)!==e.sha256)return"otherQuery";if(Fr(e.ids)!==e.sha256)return"changed"}var G="Nothing was written.";function X(e,t={}){return e!==void 0&&/^[A-Za-z][A-Za-z0-9_]{0,79}$/.test(e)?{roots:{objectApiName:e,...t}}:{}}function Gu(e,t){return{code:"ROOTS_QUERY_REFUSED",message:`${nn(e)}. Nothing was read or written.`,...X(t)}}function Uu(e,t,n){let r=t?.where!==void 0?` WHERE ${t.where}`:"";return{code:"NO_ROOTS",message:t===void 0?`None of the ${e} records named is in the source org: there is nothing to clone. ${G}`:`The query chooses no ${e} record of the source org: there is nothing to clone. Count what it chooses there with sf data query -q "SELECT COUNT() FROM ${e}${r}", and check its WHERE. ${G}`,...X(e,{cap:n})}}function qu(e,t,n,r){let o=pe.toLocaleString("en-US"),i=n==="query"&&r?.orderBy!==void 0,s=`${i?"":`ORDER BY ${me} `}LIMIT ${t}`,a=n==="query"?`Give the query ${s}`+(r?.limit!==void 0?` in place of its LIMIT ${r.limit}`:"")+` to clone the first ${t} of its order, narrow its WHERE, or raise --max-roots (the sandforge.forge.maxRoots setting) up to ${o}; past that, copy a sample of the whole org with a filter on its roots.`:`Name ${t} at most, or raise --max-roots up to ${o}.`;return{code:"ROOTS_EXCEEDED",message:`The ${n==="query"?"query chooses":"records named are"} more than the ${t} ${e} records a run clones, and nothing holds ${n==="query"?"it":"them"} to that: refused before anything else was read, rather than cut at an order nobody chose. ${a} ${G}`,...X(e,{cap:t,...i?{ordered:!0}:{}})}}var Mi={otherOrg:"were read of another org than this run reads",otherQuery:"were chosen by another query, of another object, or are other records",changed:"are no longer the ids it was kept with"};function Vu(e,t){return{code:"ROOTS_PLAN_MISMATCH",message:`The records the dry run chose ${Mi[t]}: run the dry run again with this query, and give the run the plan it keeps. ${G}`,...X(e).roots?{roots:{objectApiName:e,plan:t}}:{}}}function zu(e){return{code:"ROOTS_PLAN_GONE",message:`The run this one resumes cloned the records a query chose, and its journal does not name them: reading the query again could choose others. Remove what it wrote, then run the clone again. ${G}`,...X(e).roots?{roots:{objectApiName:e,plan:"gone"}}:{}}}function Qu(e,t,n){let r=n[n.length-1],o=r?` (${r.objectApiName} came to ${r.rows.toLocaleString("en-US")} after ${n.length} object${n.length===1?"":"s"})`:"";return{code:"READ_BOUND_EXCEEDED",message:`The ${e} roots reach more than ${t.toLocaleString("en-US")} records${o}, and a clone from records holds all it reads before it writes. Take fewer records (a LIMIT), clone less deep (--depth direct), leave objects out, or raise --max-read-total. `+G,readBound:{bound:t,objects:n.slice(0,200).map(i=>({...i})),of:"roots"}}}function Hu(e){let{bound:t,sent:n,next:r,objectApiName:o,sourceRequestsLeft:i}=e,s=i===void 0?"the source would not say what it has left today":`a tenth of the ${i.toLocaleString("en-US")} it has left today`;return{code:"API_BUDGET_EXCEEDED",message:`Reading what the ${e.roots} roots reach would send the source more than ${t.toLocaleString("en-US")} requests (${s}): ${n} sent, ${r} more for ${o}. Take fewer records, clone less deep (--depth direct), or leave objects out. ${G}`,api:{kind:"requests",org:"source",estimate:n+r,remaining:i??t,reading:{bound:t}}}}var bt=class{constructor(t,n){this.given=t;this.store=n}given;store;has(t){return this.given.has(t)||this.store?.mapping(t)?.earlier===!0}retried(t){return this.given.has(t)}get(t){let n=this.given.get(t);if(n!==void 0)return n;let r=this.store?.mapping(t);return r?.earlier?r.targetId:void 0}get from(){return this.given.size===0&&(this.store?.earlierMapped??0)>0?"resume":"retry"}get size(){return this.given.size+(this.store?.earlierMapped??0)}keys(){return this.given.keys()}[Symbol.iterator](){return this.given.entries()}};function U(e){return e!==void 0&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0}function $r(e){let t=e?.roots,n=e?.rootObjectApiName??t?.objectApiName,r=!!(n&&(e?.rootRecordId||t));return{isScoped:r,dryRun:e?.dryRun??!1,referenceFallback:e?.referenceFallback??(r?"nullify":"keep"),rootRecordId:e?.rootRecordId,rootObjectApiName:n,...t&&n?{roots:{...t,objectApiName:n,cap:Pr(t.cap,Ht),readTotal:Br(t.readTotal)}}:{},recordTypeMappings:e?.recordTypeMappings,maxRecordsPerObject:e?.maxRecordsPerObject,referenceDataObjects:new Set(e?.referenceDataObjects??["BusinessHours","OperatingHours"]),expandOrphanParents:e?.expandOrphanParents??!1,maxOrphanParentExpansions:e?.maxOrphanParentExpansions??20,upsertMode:e?.upsertMode==="auto"?"auto":"off",writeApi:e?.writeApi==="auto"?"auto":"rest",fieldExclusions:e?.fieldExclusions??{},excludedObjects:new Set(e?.excludedObjects??[]),ownerMappings:e?.ownerMappings??{},objectSoqlFilters:e?.objectSoqlFilters,fieldMappings:e?.fieldMappings??{},anonymization:e?.anonymization,keepContactPoints:e?.keepContactPoints===!0,files:e?.files?{maxFileBytes:Math.min(e.files.maxFileBytes>0?e.files.maxFileBytes:10*1048576,35*1048576),acceptedAsIs:e.files.acceptedAsIs===!0}:void 0,writtenBefore:new bt(new Map(Object.entries(e?.writtenBefore??{})),e?.stream?.store),beforeWrite:e?.beforeWrite,stream:e?.stream?{pageSize:U(e.stream.pageSize),ceiling:U(e.stream.ceiling),resumeAfter:e.stream.resumeAfter?new Map(Object.entries(e.stream.resumeAfter)):e.stream.store?.checkpoints()??new Map,onPage:e.stream.onPage,...e.stream.store?{store:e.stream.store}:{},...e.stream.summaryBound!==void 0?{summaryBound:Math.max(0,Math.floor(e.stream.summaryBound))}:{},...U(e.stream.secondPassPageSize)!==void 0?{secondPassPageSize:U(e.stream.secondPassPageSize)}:{},...U(e.stream.writeWindow)!==void 0?{writeWindow:U(e.stream.writeWindow)}:{},...e.stream.everything===!0?{everything:!0}:{},...U(e.stream.wholeReadBound)!==void 0?{wholeReadBound:U(e.stream.wholeReadBound)}:{},...e.stream.sample&&e.stream.everything===!0?{sample:e.stream.sample}:{}}:void 0,decisions:new Oe(e?.decisions),recordTypeDecisions:new Map}}async function vr(e,t){let{records:n,pages:r}=await hn(e,t);return{records:n,requests:r}}var _i=25,Dr=15,Ie=5,je=25,Rt=60,St=20,sr=6+Rt+St+1+6+1+20,ae=4,Di="SELECT ApiName, Label, TriggerType, RecordTriggerType, TriggerObjectOrEvent.QualifiedApiName, ActiveVersionId, HasAsyncAfterCommitPath FROM FlowDefinitionView WHERE IsActive = true AND TriggerType IN ('RecordBeforeSave', 'RecordAfterSave', 'RecordBeforeDelete')",Li="SELECT Name, NamespacePrefix, TableEnumOrId, EntityDefinition.QualifiedApiName, UsageBeforeInsert, UsageAfterInsert, UsageBeforeUpdate, UsageAfterUpdate, UsageBeforeDelete, UsageAfterDelete, UsageAfterUndelete FROM ApexTrigger WHERE Status = 'Active'",Wi="SELECT ApiName, Label, TriggerObjectOrEvent.QualifiedApiName, ActiveVersionId FROM FlowDefinitionView WHERE IsActive = true AND ProcessType = 'Workflow'",Gi="SELECT Id, Name, NamespacePrefix, TableEnumOrId FROM WorkflowRule",Ui="SELECT Name, SobjectType FROM AssignmentRule WHERE Active = true",qi="SELECT DeveloperName, MasterLabel, SobjectType FROM DuplicateRule WHERE IsActive = true",Vi="SELECT DeveloperName, NamespacePrefix FROM UserSetupEntityAccess WHERE KeyPrefix = '0CP'";function Nr(e){return`SELECT Metadata FROM Flow WHERE Id = '${e}'`}function zi(e,t){if(t.length>Ie)throw new Error(`A Tooling composite holds ${Ie} queries, not ${t.length}`);return{allOrNone:!1,compositeRequest:t.map((n,r)=>({method:"GET",url:`${e}/tooling/query?q=${encodeURIComponent(n)}`,referenceId:`q${r}`}))}}function Qi(e,t){if(t.length>je)throw new Error(`A Tooling composite retrieves ${je} records, not ${t.length}`);return{allOrNone:!1,compositeRequest:t.map(({sobject:n,id:r},o)=>{if(!D.test(r))throw new Error(`Not a record id: ${r}`);return{method:"GET",url:`${e}/tooling/sobjects/${n}/${r}`,referenceId:`r${o}`}})}}var Me="PROCESSING_HALTED",Hi=$({compositeResponse:ge($({body:fe(),httpStatusCode:x(),referenceId:H()}).loose())}),Ki=$({records:ge(Je(H(),fe()))}).loose(),Yi=Je(H(),fe()),Xi=ge($({errorCode:H().optional(),message:H().optional()}).loose());function Lr(e,t,n,r,o){let i=Hi.safeParse(e);if(!i.success)throw new Error("The org answered the Tooling composite with no composite answer");let s=new Map(i.data.compositeResponse.map(a=>[a.referenceId,a]));return Array.from({length:t},(a,d)=>{let l=s.get(`${n}${d}`);if(!l)return{refused:`The org gave no answer to this ${r} of the composite`};if(l.httpStatusCode<400){let g=o(l.body);return g?{records:g}:{refused:`The org answered with status ${l.httpStatusCode} and no rows`}}let u=Xi.safeParse(l.body),f=u.success?u.data[0]:void 0;return{refused:f?[f.errorCode,f.message].filter(Boolean).join(": "):`status ${l.httpStatusCode}`,...f?.errorCode===Me?{halted:!0}:{}}})}function Ji(e,t){return Lr(e,t,"q","query",n=>{let r=Ki.safeParse(n);return r.success?r.data.records:void 0})}function Zi(e,t){return Lr(e,t,"r","retrieve",n=>{let r=Yi.safeParse(n);return r.success?[r.data]:void 0})}function ea(e){return async t=>Zi(await e.request({method:"POST",url:"/tooling/composite",body:JSON.stringify(Qi(`/services/data/v${e.version}`,t)),headers:{"Content-Type":"application/json"}}),t.length)}function al(e){return{query:async(t,n)=>{let r=await e(t);return vr({query:async o=>r.query(o),queryMore:async o=>r.queryMore(o)},n)},toolingQuery:async(t,n)=>{let r=await e(t);return vr({query:async o=>r.tooling.query(o),queryMore:async o=>r.tooling.queryMore(o)},n)},toolingQueries:async(t,n)=>{let r=await e(t),o=await r.request({method:"POST",url:"/tooling/composite",body:JSON.stringify(zi(`/services/data/v${r.version}`,n)),headers:{"Content-Type":"application/json"}});return Ji(o,n.length)},toolingRetrieves:async(t,n)=>ea(await e(t))(n)}}async function ta(e,t,n,r){let o=t.map(u=>({retrieving:r?u.queries.filter(f=>f.retrieve!==void 0):[],waiting:r?u.queries.filter(f=>f.retrieve===void 0):[...u.queries],left:u.requests})),i={retrieving:je,waiting:Ie},s=(u,f)=>{for(let g of o){let p=f.filter(m=>m.queue===g).map(m=>m.query);p.length>0&&g[u].unshift(...p)}},a=(u,f)=>{for(let g of o){let p=f.filter(m=>m.queue===g).map(m=>m.query);p.length===0&&g.retrieving.length===0||(g.reason??=u,g.waiting.unshift(...p,...g.retrieving.splice(0)))}},d=0,l=async()=>{for(;;){let u=o.find(E=>E.left>0&&(E.retrieving.length>0||E.waiting.length>0));if(!u)return;let f=u.retrieving.length>0?"retrieving":"waiting";u.left--,d++;let g=[];for(let E of o){if(E!==u&&E.left<=0)continue;let C=i[f]-g.length;if(C<=0)break;for(let B of E[f].splice(0,C))g.push({query:B,queue:E})}let p;try{p=r&&f==="retrieving"?await r(g.map(({query:E})=>E.retrieve)):await e(g.map(({query:E})=>E.soql))}catch(E){let C=P(E);if(f==="retrieving")a(C,g);else for(let{query:B}of g)B.refused(C);continue}let m=f==="retrieving"?"retrieve":"query",b=[],w=[],R=0,O,T;if(g.forEach((E,C)=>{let B=p[C]??{refused:`The org gave no answer to this ${m} of the composite`};"records"in B?(E.query.take(B.records),R++):B.halted?(b.push(E),O??=B.refused):f==="retrieving"?(w.push(E),T??=B.refused):E.query.refused(B.refused)}),f==="retrieving"&&R===0){a(T??O??Me,g);continue}if(w.length>0){for(let{queue:E}of w)E.reason??=T;s("waiting",w)}if(b.length===0)continue;let M=g.length-b.length;if(M===0){for(let{query:E}of b)E.refused(O??Me);continue}i[f]=Math.min(i[f],M);for(let{queue:E}of b)E.reason=O;s(f,b)}};await Promise.all(Array.from({length:Math.max(1,n)},l));for(let u of o)for(let f of[...u.retrieving,...u.waiting])f.refused(u.reason??Me);return d}function na(e){return`SELECT Metadata FROM WorkflowRule WHERE Id = '${e}'`}function ra(e){return`SELECT FlowVersionViewId, ApiName, ObjectType FROM FlowVariableView WHERE FlowVersionViewId IN (${e.map(n=>`'${n}'`).join(", ")})`}function oa(e){return`SELECT DurableId, QualifiedApiName FROM EntityDefinition WHERE QualifiedApiName IN (${e.map(n=>`'${n}'`).join(", ")})`}function sa(e){return`SELECT Id, DeveloperName, NamespacePrefix FROM CustomPermission WHERE DeveloperName IN (${e.map(n=>`'${n}'`).join(", ")})`}function ia(e){return`SELECT SetupEntityId, ParentId, Parent.Name, Parent.Label, Parent.NamespacePrefix FROM SetupEntityAccess WHERE SetupEntityType = 'CustomPermission' AND SetupEntityId IN (${e.map(n=>`'${n}'`).join(", ")}) AND Parent.IsOwnedByProfile = false AND Parent.PermissionSetGroupId = null`}function aa(e,t){let n=t.map(r=>`'${r}'`).join(", ");return`SELECT ParentId, COUNT(Id) n FROM ${e} WHERE ParentId IN (${n}) GROUP BY ParentId`}var D=/^[A-Za-z0-9]{15}([A-Za-z0-9]{3})?$/,At=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,da="myvariable_current",ua={RecordBeforeSave:"beforeSave",RecordAfterSave:"afterSave",RecordBeforeDelete:"beforeDelete"},la={Create:"create",Update:"update",CreateAndUpdate:"createAndUpdate",Delete:"delete"},Wr={onCreateOnly:"create",onAllChanges:"createAndUpdate",onCreateOrTriggeringUpdate:"createAndUpdate"},ca=[["UsageBeforeInsert","beforeInsert"],["UsageAfterInsert","afterInsert"],["UsageBeforeUpdate","beforeUpdate"],["UsageAfterUpdate","afterUpdate"],["UsageBeforeDelete","beforeDelete"],["UsageAfterDelete","afterDelete"],["UsageAfterUndelete","afterUndelete"]],fa={emailAlert:"email",emailSimple:"email",customNotificationAction:"notification",outboundMessage:"outbound"},ga={emailSimple:"SingleEmail",emailAlert:"DailyWorkflowEmails"},pa={Alert:"email",OutboundMessage:"outbound"},ma=new Set(["sms","mms","twilio","whatsapp","vonage","nexmo","messagebird","plivo","sinch"]);function Ot(e){if(typeof e!="object"||e===null)return;let t=e.QualifiedApiName;return typeof t=="string"&&t!==""?t:void 0}var h=e=>typeof e=="string"?e:"";function S(e,t){return typeof e=="object"&&e!==null?e[t]:void 0}function N(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t):[]}function kt(e,t,n,r){return{apiName:e,label:t||e,timing:n,startsOn:r,condition:"notRead",permissions:[],paths:[],messages:[],switches:[]}}function ha(e){let t=Ot(e.TriggerObjectOrEvent),n=ua[h(e.TriggerType)];if(!t||!n)return;let r=n==="beforeDelete"?"delete":la[h(e.RecordTriggerType)]??"createAndUpdate",o=h(e.ActiveVersionId),i=kt(h(e.ApiName),h(e.Label),n,r);return e.HasAsyncAfterCommitPath===!0&&(i.paths=[{kind:"async"}]),{objectApiName:t,id:D.test(o)?o:null,flow:i}}function ya(e){let t=h(e.ActiveVersionId);return{objectApiName:Ot(e.TriggerObjectOrEvent),id:D.test(t)?t:null,flow:kt(h(e.ApiName),h(e.Label),"afterSave","createAndUpdate")}}function ba(e){let t=Ot(e.EntityDefinition)??(h(e.TableEnumOrId)||void 0),n=h(e.Name);if(!t||!n)return;let r=h(e.NamespacePrefix);return{objectApiName:t,trigger:{name:r?`${r}.${n}`:n,events:ca.filter(([o])=>e[o]===!0).map(([,o])=>o)}}}function xr(e){return e.startsOn==="create"||e.startsOn==="createAndUpdate"?e.timing==="afterSave"?0:1:e.startsOn==="update"?2:3}function Gr(e){let t=new Set(Kr(JSON.stringify(e??null)).filter(o=>de(o)==="Permission").map(Et));if(t.size===0)return[];let n=S(e,"filterFormula"),r=new Set((typeof n=="string"?ue(n):[]).filter(o=>de(o.reference)==="Permission"&&o.value===void 0).map(o=>Et(o.reference)));return[...t].sort((o,i)=>o.localeCompare(i)).map(o=>({name:o,bypass:r.has(o)}))}function Ur(e){return typeof e!="string"?[]:Jr(ue(e)).filter(t=>de(t.reference)!=="Permission").map(t=>({...t,where:"start",bypass:!0}))}function wa(e){let t=S(e,"filterFormula");if(typeof t=="string"&&t.trim()!=="")return[...new Set(De(t).flatMap(r=>{let o=Aa(r);return o?[o]:[]}))];let n=N(S(e,"filters"));return n.length===0||!Ea(h(S(e,"filterLogic")),n.length)?[]:[...new Set(n.filter(r=>h(r.operator)==="IsNull"&&S(r.value,"booleanValue")===!1).map(r=>h(r.field)).filter(r=>Ra.test(r)))]}var Ra=/^[A-Za-z][A-Za-z0-9_]*$/,Sa=/^(?:\{!\s*)?\$Record\.([A-Za-z][A-Za-z0-9_]*)\s*\}?$/i;function Aa(e){let t=z(e,"NOT");if(t===void 0)return;let n=Pt(t),r=z(n,"ISBLANK")??z(n,"ISNULL");return r===void 0?void 0:Sa.exec(r.trim())?.[1]}function Ea(e,t){let n=e.trim().toLowerCase();if(n==="and"||t===1&&n!=="or")return!0;if(!/^\d+(\s+and\s+\d+)*$/.test(n))return!1;let r=new Set(n.split(/\s+and\s+/).map(Number));return Array.from({length:t},(o,i)=>i+1).every(o=>r.has(o))}var qr={permission:"Permission",setup:"Setup",user:"User",profile:"Profile",custommetadata:"CustomMetadata"},Vr=String.raw`[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*`,zr=new RegExp(String.raw`\$(?:Permission|Setup|User|Profile|CustomMetadata)\.${Vr}`,"gi"),J=String.raw`(?:\{!\s*)?(\$(?:Permission|Setup|User|Profile|CustomMetadata)\.${Vr})\s*\}?`,Ta=new RegExp(`^${J}$`,"i"),Oa=new RegExp(`^NOT\\s+${J}$`,"i"),Qr=new RegExp(`^(?:${J}\\s*(==?|<>|!=)\\s*(TRUE|FALSE)|(TRUE|FALSE)\\s*(==?|<>|!=)\\s*${J})$`,"i"),Cr=String.raw`("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')`,Hr=new RegExp(`^(?:${J}\\s*(==?|<>|!=)\\s*${Cr}|${Cr}\\s*(==?|<>|!=)\\s*${J})$`,"i");function q(e){let t=e.indexOf("."),n=qr[e.slice(1,t).toLowerCase()];return n?`$${n}${e.slice(t)}`:e}function de(e){return qr[e.slice(1,e.indexOf(".")).toLowerCase()]}function Et(e){return e.slice(e.indexOf(".")+1)}function Kr(e){return[...new Set([...e.matchAll(zr)].map(t=>q(t[0])))]}var ka=new RegExp(`^${zr.source}$`,"i");function Yr(e){return typeof e=="string"&&ka.test(e)}function _e(e,t){return e.toLowerCase()===t.toLowerCase()}function Xr(e){return e.slice(1,-1).replace(/\\(.)/g,"$1")}function Jr(e){let t=new Map;for(let n of e)t.set(`${n.reference.toLowerCase()}=${n.value??""}`,n);return[...t.values()]}function Mr(e,t){return e.some(n=>_e(n.reference,t.reference)&&n.value===t.value)}function ue(e){return De(e).flatMap(Fa)}function Ft(e){return Tt(e).flatMap(Pa)}function Fa(e){let t=Qr.exec(e);if(t){let[,o,i,s,a,d,l]=t,u=i??d,f=(s??a).toUpperCase();return(u.startsWith("=")?f==="FALSE":f==="TRUE")?[{reference:q(o??l)}]:[]}let n=Hr.exec(e);if(n){let[,o,i,s,a,d,l]=n;return(i??d).startsWith("=")?[]:[{reference:q(o??l),value:Xr(s??a)}]}let r=z(e,"NOT");if(r===void 0){let o=Oa.exec(e);return o?[{reference:q(o[1])}]:[]}return Ft(r)}function Pa(e){let t=Ta.exec(e);if(t)return[{reference:q(t[1])}];let n=Qr.exec(e);if(n){let[,i,s,a,d,l,u]=n,f=s??l,g=(a??d).toUpperCase();return(f.startsWith("=")?g==="TRUE":g==="FALSE")?[{reference:q(i??u)}]:[]}let r=Hr.exec(e);if(r){let[,i,s,a,d,l,u]=r;return(s??l).startsWith("=")?[{reference:q(i??u),value:Xr(a??d)}]:[]}let o=z(e,"NOT");return o===void 0?[]:ue(o)}function De(e){let t=Pt(e),n=z(t,"AND");if(n)return Le(n,",").flatMap(De);let r=Le(t,"&&");return r.length>1?r.flatMap(De):[t]}function Tt(e){let t=Pt(e),n=z(t,"OR");if(n)return Le(n,",").flatMap(Tt);let r=Le(t,"||");return r.length>1?r.flatMap(Tt):[t]}function z(e,t){let n=new RegExp(`^${t}\\s*\\(([\\s\\S]*)\\)$`,"i").exec(e);return n&&Zr(n[1])?n[1]:void 0}function Pt(e){let t=e.trim();for(;t.startsWith("(")&&t.endsWith(")")&&Zr(t.slice(1,-1));)t=t.slice(1,-1).trim();return t}function Zr(e){let t=0;for(let{char:n,quoted:r}of eo(e))if(!r){if(n==="(")t++;else if(n===")"&&--t<0)return!1}return t===0}function Le(e,t){let n=[],r=0,o=0;for(let{char:i,index:s,quoted:a}of eo(e))a||(i==="("?r++:i===")"?r--:r===0&&e.startsWith(t,s)&&(n.push(e.slice(o,s).trim()),o=s+t.length));return n.push(e.slice(o).trim()),n.filter(i=>i!=="")}function*eo(e){let t=null;for(let n=0;n<e.length;n++){let r=e[n];if(t){r==="\\"?n++:r===t&&(t=null),yield{char:r,index:n,quoted:!0};continue}if(r==='"'||r==="'"){t=r,yield{char:r,index:n,quoted:!0};continue}yield{char:r,index:n,quoted:!1}}}function Ba(e){let t=S(e,"start");if(typeof t=="object"&&t!==null){let n=h(S(S(t,"connector"),"targetReference"))||void 0,r=N(S(t,"scheduledPaths")).map(o=>h(S(S(o,"connector"),"targetReference"))||void 0);return{name:n,everyPath:r.every(o=>o===n)}}return{name:h(S(e,"startElementReference"))||void 0,everyPath:!0}}function $a(e,t){let n=e.leftValueReference,r=e.rightValue;if(Yr(n)){let i=q(n);if(typeof S(r,"booleanValue")=="boolean")return[{reference:i}];let s=S(r,"stringValue");return typeof s=="string"?[{reference:i,value:s}]:[]}let o=typeof n=="string"?t.get(n):void 0;return o===void 0?[]:[...Ft(o),...ue(o)]}function va(e,t){let n=e.leftValueReference,r=typeof n=="string"?t.get(n):void 0;return Kr([typeof n=="string"?n:"",h(S(e.rightValue,"elementReference")),r??""].join(" "))}function Na(e,t,n){let{leftValueReference:r,operator:o,rightValue:i}=e;if(o!=="EqualTo"&&o!=="NotEqualTo")return"unknown";let s=o==="EqualTo",a=S(i,"booleanValue");if(Yr(r)){if(!_e(r,t.reference))return"unknown";if(typeof a=="boolean"&&t.value===void 0)return a===s?"true":"false";let u=S(i,"stringValue");return typeof u=="string"&&t.value!==void 0?u===t.value===s?"true":"false":"unknown"}let d=typeof r=="string"?n.get(r):void 0;if(d===void 0||typeof a!="boolean")return"unknown";let l=a===s;return Mr(Ft(d),t)?l?"true":"false":Mr(ue(d),t)?l?"false":"true":"unknown"}function xa(e,t,n){let r=N(e.conditions);if(r.length===0)return"unknown";let o=r.map(s=>Na(s,t,n)),i=h(e.conditionLogic).toLowerCase()||"and";return i==="and"?o.includes("false")?"false":o.every(s=>s==="true")?"true":"unknown":i==="or"?o.includes("true")?"true":o.every(s=>s==="false")?"false":"unknown":"unknown"}function Ca(e,t,n){for(let r of N(e.rules)){let o=xa(r,t,n),i=!h(S(r.connector,"targetReference"));if(o!=="false"){if(o==="true")return i;if(!i)return!1}}return!h(S(e.defaultConnector,"targetReference"))}function to(e){let t=N(S(e,"decisions")),n=new Map(N(S(e,"formulas")).filter(f=>typeof f.expression=="string").map(f=>[h(f.name),h(f.expression)])),r=f=>N(f.rules).flatMap(g=>N(g.conditions)),o=[...new Set(t.flatMap(f=>r(f).flatMap(g=>va(g,n))))];if(o.length===0)return{permissions:[],switches:[]};let{name:i,everyPath:s}=Ba(e),a=s?t.find(f=>h(f.name)===i):void 0,d=a?Jr(r(a).flatMap(f=>$a(f,n))).filter(f=>Ca(a,f,n)):[],l=o.filter(f=>de(f)==="Permission").map(f=>({name:Et(f),bypass:d.some(g=>_e(g.reference,f)&&g.value===void 0),where:"decision"})).sort((f,g)=>f.name.localeCompare(g.name)),u=o.filter(f=>de(f)!=="Permission").flatMap(f=>{let g=d.filter(p=>_e(p.reference,f));return g.length>0?g.map(p=>({...p,where:"decision",bypass:!0})):[{reference:f,where:"decision",bypass:!1}]}).sort((f,g)=>f.reference.localeCompare(g.reference));return{permissions:l,switches:u}}function Ma(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).filter(t=>t!=="").map(t=>t.toLowerCase())}function Ia(...e){return e.some(t=>{let n=Ma(t);return n.some(r=>ma.has(r))||n.some((r,o)=>r==="text"&&/^messages?$/.test(n[o+1]??""))})}function no(e){return N(S(e,"actionCalls")).flatMap(t=>{let n=h(t.actionType),r=h(t.label)||h(t.name)||h(t.actionName),o=fa[n],i=ga[n];return o?[{kind:o,name:r,...i?{limit:i}:{}}]:n==="apex"&&Ia(h(t.actionName),h(t.name),r)?[{kind:"sms",name:r,guessed:!0}]:[]})}function ja(e){return N(S(S(e,"start"),"scheduledPaths")).map(t=>{let n=h(t.label)||h(t.name)||void 0;if(h(t.pathType)==="AsyncAfterCommit")return{kind:"async",label:n};let r=Number(t.offsetNumber),o=h(t.timeSource)==="RecordField"?h(t.recordField):"";return{kind:"scheduled",label:n,...Number.isFinite(r)?{offset:r}:{},...h(t.offsetUnit)?{unit:h(t.offsetUnit)}:{},...o?{field:o}:{}}})}function ro(e,t){let n=Mn(t);n.length>0&&(e.creates=n)}function _a(e,t){if(typeof t!="object"||t===null)return;let n=S(t,"start"),r=to(t);e.permissions=[...Gr(n),...r.permissions],e.switches=[...Ur(S(n,"filterFormula")),...r.switches];let o=wa(n);o.length>0&&(e.requiresFilled=o),e.paths=ja(t),e.messages=no(t),ro(e,t)}function Da(e,t){let n=new Map(N(S(t,"processMetadataValues")).map(o=>[h(o.name),h(S(o.value,"stringValue"))]));e.startsOn=Wr[n.get("TriggerType")??""]??"createAndUpdate";let r=to(t);return e.permissions=r.permissions,e.switches=r.switches,e.messages=no(t),ro(e,t),n.get("ObjectType")||void 0}function La(e,t){e.startsOn=Wr[h(S(t,"triggerType"))]??"createAndUpdate";let n=S(t,"formula");e.permissions=typeof n=="string"?Gr({filterFormula:n}):[],e.switches=Ur(n);let r=N(S(t,"workflowTimeTriggers"));return e.paths=r.map(o=>{let i=Number(o.timeLength);return{kind:"scheduled",...Number.isFinite(i)?{offset:i}:{},...h(o.workflowTimeTriggerUnit)?{unit:h(o.workflowTimeTriggerUnit)}:{},...h(o.offsetFromField)?{field:h(o.offsetFromField)}:{}}}),e.messages=[S(t,"actions"),...r.map(o=>o.actions)].flatMap(N).flatMap(o=>{let i=pa[h(o.type)];return i?[{kind:i,name:h(o.name),...i==="email"?{limit:"DailyWorkflowEmails"}:{}}]:[]}),S(t,"active")===!0}function oo(e,t){return(e?`${e}__${t}`:t).toLowerCase()}function wt(e,t){let n=gn(t);return n===void 0?{part:e,reason:P(t)}:{part:e,reason:`the org could not be reached (${n})`,unreachable:n}}async function Ce(e,t){let n=new Array(e.length),r=0,o=async()=>{for(;r<e.length;){let i=r++;n[i]=await e[i]()}};return await Promise.all(Array.from({length:Math.min(t,e.length)},o)),n}var Ir=[on,kn,an,dn,sn],jr=["ProductCategory","ProductCatalog"];function gt(e,t=new Set){let{referenceDataObjects:n}=$r(void 0),r=e.nodes.filter(u=>u.included&&!t.has(u.objectApiName)&&!n.has(u.objectApiName)).map(u=>u.objectApiName),o=new Set(r),i=new Set(e.nodes.map(u=>u.objectApiName)),s=Object.entries(rn).filter(([u,{object:f}])=>o.has(u)&&!i.has(f)&&!t.has(f)).map(([,{object:u}])=>u),a=Fn(e,t),d=u=>e.edges.some(f=>f.required===!0&&u.includes(f.sourceObject)&&a.has(f.sourceObject)&&o.has(f.targetObject)),l=s.length>0||d(Ir);return[...new Set([...r,...s,...l?Ir.filter(u=>a.has(u)):[],...d(jr)?jr.filter(u=>a.has(u)):[]])]}var _r=class{deps;constructor(t){this.deps=t}async readForGraph(t,n,r=new Set){return this.read(t,gt(n,r))}async read(t,n,r={}){let o=[],i=0,s=new Map(n.map(c=>[c.toLowerCase(),c])),a=c=>c===void 0?void 0:s.get(c.toLowerCase()),d=(c,y)=>async()=>{try{let A=await y();return i+=A.requests,A.records}catch(A){return i++,o.push(wt(c,A)),[]}},l=c=>()=>this.deps.query(t,c),u=c=>()=>this.deps.toolingQuery(t,c),f=async()=>[],g=n.some(c=>/^(case|lead)$/i.test(c)),[p,m,b,w,R,O]=await Ce([d("flows",l(Di)),d("triggers",u(Li)),d("processes",l(Wi)),d("workflowRules",u(Gi)),g?d("assignmentRules",l(Ui)):f,d("duplicateRules",l(qi))],ae),T=p.map(ha).filter(c=>c!==void 0).flatMap(c=>{let y=a(c.objectApiName);return y?[{...c,objectApiName:y}]:[]}),M=m.map(ba).filter(c=>c!==void 0).flatMap(c=>{let y=a(c.objectApiName),A=c.trigger.events.some(k=>k!=="afterUndelete"||r.undeletes===!0);return y&&A?[{...c,objectApiName:y}]:[]}),E=b.map(ya),C=E.filter(c=>c.objectApiName===void 0&&c.id!==null).map(c=>c.id),B=n.filter(c=>c.includes("__")&&At.test(c)),io=w.some(c=>/^01I/.test(h(c.TableEnumOrId))),[ao,uo]=await Ce([C.length>0?d("processes",l(ra(C))):f,io&&B.length>0?d("workflowRules",l(oa(B))):f],ae),lo=new Map(ao.filter(c=>h(c.ApiName).toLowerCase()===da).map(c=>[h(c.FlowVersionViewId),h(c.ObjectType)]));for(let c of E)c.objectApiName===void 0&&c.id!==null&&(c.objectApiName=lo.get(c.id)||void 0);let co=new Map(uo.map(c=>[h(c.DurableId),h(c.QualifiedApiName)])),We=w.flatMap(c=>{let y=h(c.TableEnumOrId),A=a(co.get(y)??y),k=h(c.Name),F=h(c.Id);if(!A||!k)return[];let I=h(c.NamespacePrefix),Q=I?`${I}.${k}`:k;return[{objectApiName:A,id:D.test(F)?F:null,flow:kt(Q,Q,"afterSave","createAndUpdate")}]}),Ge=E.filter(c=>c.objectApiName===void 0||a(c.objectApiName)!==void 0),fo=new Map(n.map((c,y)=>[c,y])),le=c=>fo.get(a(c.objectApiName)??"")??n.length,Ue=T.filter(c=>c.id!==null).sort((c,y)=>xr(c.flow)-xr(y.flow)||le(c)-le(y)||c.flow.label.localeCompare(y.flow.label)),Z=this.deps.toolingQueries,qe=Z?this.deps.toolingRetrieves:void 0,Bt=qe?je:Ie,$t=Z?Rt*Bt:_i,vt=Z?St*Bt:Dr,Ve=Ue.slice(0,$t),Nt=[...Ge.map(c=>({read:c,kind:"process"})),...We.map(c=>({read:c,kind:"rule"}))].filter(({read:c})=>c.id!==null).sort((c,y)=>le(c.read)-le(y.read)||(c.kind===y.kind?0:c.kind==="process"?-1:1)||c.read.flow.label.localeCompare(y.read.flow.label)),xt=Nt.slice(0,vt),ze,Qe,Ct=new Set,Mt=c=>c[0]?.Metadata,go=(c,y)=>{c.flow.condition="read",_a(c.flow,Mt(y))},po=(c,y)=>{c.flow.condition="unreadable",ze??=y},mo=({read:c,kind:y})=>y==="process"?Nr(c.id):na(c.id),ho=({read:c,kind:y},A)=>{let k=Mt(A);if(typeof k!="object"||k===null){c.flow.condition="unreadable";return}if(c.flow.condition="read",y==="process"){let F=Da(c.flow,k);c.objectApiName??=F}else La(c.flow,k)||Ct.add(c.flow)},yo=({read:c},y)=>{c.flow.condition="unreadable",Qe??=y},It=(c,y,A,k,F)=>c.map(I=>({soql:y(I),retrieve:A(I),take:Q=>k(I,Q),refused:Q=>F(I,Q)})),jt=It(Ve,c=>Nr(c.id),c=>({sobject:"Flow",id:c.id}),go,po),_t=It(xt,mo,({read:c,kind:y})=>({sobject:y==="process"?"Flow":"WorkflowRule",id:c.id}),ho,yo);Z?i+=await ta(c=>Z(t,c),[{queries:jt,requests:Rt},{queries:_t,requests:St}],ae,qe&&(c=>qe(t,c))):await Ce([...jt,..._t].map(c=>async()=>{try{let y=await this.deps.toolingQuery(t,c.soql);i+=y.requests,c.take(y.records)}catch(y){i++,c.refused(P(y))}}),ae),ze!==void 0&&o.push(wt("conditions",ze)),Qe!==void 0&&o.push(wt("definitions",Qe));for(let c of[...T,...Ge,...We])c.id===null&&(c.flow.condition="unreadable");let Dt=Ge.flatMap(c=>{let y=a(c.objectApiName);return y?[{...c,objectApiName:y}]:[]}),Lt=We.filter(c=>!Ct.has(c.flow)),He=[...T,...Dt,...Lt].flatMap(c=>c.flow.permissions),Wt;if(He.length>0){let[c]=await Ce([d("userPermissions",l(Vi))],ae);if(!o.some(y=>y.part==="userPermissions")){let y=new Set(c.map(A=>oo(h(A.NamespacePrefix),h(A.DeveloperName))));Wt=y;for(let A of He)A.held=y.has(A.name.toLowerCase())}}let Gt=[...new Set(He.filter(c=>c.bypass&&c.held!==!0).map(c=>c.name))],Ke=Gt.length>0?await Wa(Gt,c=>d("permissionSets",l(c))(),()=>o.some(c=>c.part==="permissionSets"),async c=>{try{let y=await this.deps.query(t,c);return i+=y.requests,y.records}catch(y){throw i++,y}}):void 0,ce={};if(Ke?.some(c=>c.permissionSets.length>0)){let{toolingQueries:c,toolingRetrieves:y}=this.deps;try{let{readValidationRuleBypasses:A}=await import("./chunk-N7J6NJQ6.mjs"),k=await A(F=>this.deps.toolingQuery(t,F),n,c&&(F=>c(t,F)),y&&(F=>y(t,F)));i+=k.requests,ce.validationRuleBypasses=k.rules.flatMap(F=>F.permissions.some(I=>Wt?.has(I.toLowerCase()))?[]:[F]),k.notRead>0&&(ce.validationRulesNotRead=k.notRead)}catch(A){i++,ce.validationRulesUnread=P(A)}}let bo=c=>R.filter(y=>h(y.SobjectType).toLowerCase()===c.toLowerCase()).map(y=>({name:h(y.Name)})).sort((y,A)=>y.name.localeCompare(A.name)),wo=c=>O.filter(y=>h(y.SobjectType).toLowerCase()===c.toLowerCase()).map(y=>({name:h(y.MasterLabel)||h(y.DeveloperName),developerName:h(y.DeveloperName)})).sort((y,A)=>y.name.localeCompare(A.name)),Ro=(c,y)=>c.label.localeCompare(y.label),Ye=(c,y)=>c.filter(A=>A.objectApiName===y).map(A=>A.flow).sort(Ro),Xe=new Map;for(let c of Ue.slice(Ve.length))Xe.set(c.objectApiName,(Xe.get(c.objectApiName)??0)+1);let Ut=n.flatMap(c=>{let y=Xe.get(c);return y?[{objectApiName:c,flows:y}]:[]}),So=n.map(c=>({objectApiName:c,flows:Ye(T,c),triggers:M.filter(y=>y.objectApiName===c).map(y=>y.trigger).sort((y,A)=>y.name.localeCompare(A.name)),processes:Ye(Dt,c),workflowRules:Ye(Lt,c),assignmentRules:bo(c),duplicateRules:wo(c)})).filter(c=>c.flows.length>0||c.triggers.length>0||c.processes.length>0||c.workflowRules.length>0||c.assignmentRules.length>0||c.duplicateRules.length>0);return{objectsRead:[...n],objects:So,unread:o,conditionsNotRead:Ue.length-Ve.length,conditionsBound:$t,...Ut.length>0?{conditionsNotReadOn:Ut}:{},definitionsNotRead:Nt.length-xt.length,definitionsBound:vt,...Ke?{bypassGrants:Ke}:{},...ce,requests:i}}};function _(e){return e.slice(0,15)}async function Wa(e,t,n,r){let o=e.flatMap(p=>{let m=p.indexOf("__"),b=m>0?p.slice(0,m):"",w=m>0?p.slice(m+2):p;return At.test(w)&&(!b||At.test(b))?[{name:p,developerName:w}]:[]});if(o.length===0)return;let i=await t(sa([...new Set(o.map(p=>p.developerName))]));if(n())return;let s=new Map;for(let p of i){let m=h(p.Id);D.test(m)&&s.set(oo(h(p.NamespacePrefix),h(p.DeveloperName)),m)}let a=o.flatMap(p=>{let m=s.get(p.name.toLowerCase());return m?[m]:[]}),d=a.length>0?await t(ia(a)):[];if(n())return;let l=[...new Set(d.map(p=>h(p.ParentId)).filter(p=>D.test(p)))],u=new Map;for(let p of["SetupEntityAccess","ObjectPermissions"]){if(l.length===0)break;let m=await t(aa(p,l));if(n())return;for(let b of m){let w=_(h(b.ParentId)),R=typeof b.n=="number"?b.n:Number(b.n);u.set(w,(u.get(w)??0)+(Number.isFinite(R)?R:0))}}let f=new Map;for(let p of i){let m=h(p.Id);D.test(m)&&f.set(_(m),so(h(p.NamespacePrefix),h(p.DeveloperName)))}let g=r&&l.length>0?await qa(l,f,r):void 0;return o.map(({name:p})=>{let m=s.get(p.toLowerCase()),b=new Map;for(let w of d){if(!m||_(h(w.SetupEntityId))!==_(m))continue;let R=_(h(w.ParentId)),O=w.Parent,T=h(S(O,"Name"));if(!T||b.has(R))continue;let M=h(S(O,"NamespacePrefix"));b.set(R,{name:M?`${M}__${T}`:T,label:h(S(O,"Label"))||T,grants:u.get(R)??0,...g===void 0?{}:"refused"in g?{customPermissionsUnread:g.refused}:{customPermissions:g.bySet.get(R)??[]}})}return{permission:p,permissionSets:[...b.values()].sort((w,R)=>w.grants-R.grants||w.name.localeCompare(R.name))}})}function so(e,t){return e?`${e}__${t}`:t}function Ga(e){return`SELECT ParentId, SetupEntityId FROM SetupEntityAccess WHERE SetupEntityType = 'CustomPermission' AND ParentId IN (${e.map(n=>`'${n}'`).join(", ")})`}function Ua(e){return`SELECT Id, DeveloperName, NamespacePrefix FROM CustomPermission WHERE Id IN (${e.map(n=>`'${n}'`).join(", ")})`}async function qa(e,t,n){try{let r=await n(Ga(e)),o=new Map(t),i=[...new Set(r.map(a=>h(a.SetupEntityId)).filter(a=>D.test(a)&&!o.has(_(a))))];if(i.length>0)for(let a of await n(Ua(i))){let d=h(a.Id);D.test(d)&&o.set(_(d),so(h(a.NamespacePrefix),h(a.DeveloperName)))}let s=new Map;for(let a of r){let d=_(h(a.ParentId)),l=o.get(_(h(a.SetupEntityId)));if(!l)continue;let u=s.get(d)??[];u.includes(l)||u.push(l),s.set(d,u)}for(let a of s.values())a.sort((d,l)=>d.localeCompare(l));return{bySet:s}}catch(r){return{refused:P(r)}}}var Va={insert:"on insert",update:"on update",delete:"on delete"},za={insert:{before:"before save",after:"after save",beforeAndAfter:"before and after save"},update:{before:"before save",after:"after save",beforeAndAfter:"before and after save"},delete:{before:"before delete",after:"after delete",beforeAndAfter:"before and after delete"}},Qa={flow:e=>`flow "${e}"`,trigger:e=>`Apex trigger ${e}`,process:e=>`process "${e}"`,workflowRule:e=>`workflow rule "${e}"`},Ha={flows:"the flows",triggers:"the Apex triggers",conditions:"the start conditions of some flows",processes:"the Process Builder processes",workflowRules:"the workflow rules",definitions:"the definitions of some processes or workflow rules",assignmentRules:"the assignment rules",duplicateRules:"the duplicate rules",userPermissions:"the custom permissions of the user the run writes as",permissionSets:"the permission sets that hold a bypass the user the run writes as does not"},Ka={email:"email",notification:"custom notification",outbound:"outbound message",sms:"text message"};function Ya(e){let t=e.guessed?" (guessed from the name of an Apex action)":"";return`${Ka[e.kind]} "${e.name}"${t}`}function Xa(e){let t=e.label?` "${e.label}"`:"";if(e.kind==="async")return`asynchronous path${t}`;if(e.offset===void 0||e.unit===void 0)return`scheduled path${t}`;let n=Math.abs(e.offset),r=n===1?e.unit.replace(/s$/,""):e.unit,o=e.offset<0?"before":"after";return`scheduled path${t} (${n} ${r} ${o} ${e.field??"the save"})`}function Ja(e){let t=e.value===void 0?"true":`'${e.value}'`;return e.where==="decision"?`its first decision ends it when ${e.reference} is ${t}`:`not when ${e.reference} is ${t}`}function Za(e,t){let n=e.flow,r=n?.permissions??[],o=n?.switches??[],i=n?.messages??[],s=n?.paths??[],a=p=>p.held===!0?" (held)":p.held===!1?" (not held)":"",d=r.filter(p=>p.bypass&&p.where!=="decision"),l=r.filter(p=>p.bypass&&p.where==="decision"),u=r.filter(p=>!p.bypass&&p.where!=="decision"),f=[...r.filter(p=>!p.bypass&&p.where==="decision").map(p=>p.name),...o.filter(p=>!p.bypass).map(p=>p.reference)],g=e.kind==="flow"?"start condition":"definition";return[za[t][e.when],...i.length>0?[`SENDS MESSAGES: ${i.map(Ya).join(", ")}`]:[],...s.length>0?[`then after commit: ${s.map(Xa).join(", ")}`]:[],...d.length>0?[`not for a user with ${d.map(p=>p.name+a(p)).join(", ")}`]:[],...l.length>0?[`its first decision ends it for a user with ${l.map(p=>p.name+a(p)).join(", ")}`]:[],...o.filter(p=>p.bypass).map(Ja),...e.keptQuiet?["quiet for this run"]:[],...u.length>0?[`its start condition names ${u.map(p=>p.name).join(", ")}`]:[],...f.length>0?[`its decisions test ${f.join(", ")}`]:[],...n?.condition==="notRead"?[`${g} not read`]:[],...n?.condition==="unreadable"?[`${g} unreadable`]:[]]}function dl(e,t,n={}){let r=[`target automation: what ${t} runs on the ${e.objectsRead.length} object(s) the run writes`];for(let s of e.objects){r.push(` ${s.objectApiName}`);for(let{write:l,fired:u}of he(s)){let f=u.map(g=>`${Qa[g.kind](g.name)} (${Za(g,l).join("; ")})`);r.push(` ${Va[l]}: ${f.join(", ")}`)}let a=n.mayApplyAssignmentRules!==!1;for(let l of s.assignmentRules??[])r.push(n.applyAssignmentRules?` assignment rule "${l.name}": applied${a?" (--apply-assignment-rules)":""}: it can give the records it routes another owner, and mail that owner`:` assignment rule "${l.name}": not applied: the run sends Sforce-Auto-Assign: FALSE and keeps the owner it sets${a?" (--apply-assignment-rules applies it)":""}`);let d=s.duplicateRules??[];d.length>0&&r.push(` duplicate rules: ${d.map(l=>`"${l.name}"`).join(", ")}: the run saves a record a rule only alerts on; a rule that blocks still refuses it`)}e.objects.length===0&&r.push(ln(e.unread)?" nothing found in what could be read":" no active flow, process, workflow rule, Apex trigger, assignment rule or duplicate rule runs on them");let o=ye(e),i=un(e).filter(s=>!o.includes(s));if(i.length>0){r.push(` bypass: assign ${i.join(", ")} to the user the run writes as, and the flows whose start condition excludes them stay quiet`+(n.mayMute!==!1?"; --mute-automation assigns them for the run alone, and takes them back as it ends":""));for(let{permission:s,permissionSet:a,others:d}of we(e,i)){if(!a){r.push(` ${s}: no permission set of ${t} holds it: an admin creates one that includes it`);continue}let l=d.length>0?`; also held by ${d.map(f=>f.name).join(", ")}`:"",u=n.username?`: ${Re(a.name,t,n.username)}`:"";r.push(` ${s}: held by permission set ${a.name}, the smallest${l}${u}`)}}if(o.length>0&&r.push(` bypass held: the user the run writes as holds ${o.join(", ")}, and what excludes them stays quiet for this run`),e.conditionsNotRead>0){let s=(e.conditionsNotReadOn??[]).map(({objectApiName:a,flows:d})=>`${a} (${d})`).join(", ");r.push(` ${e.conditionsNotRead} start condition(s) not read: the read takes ${e.conditionsBound} at most`+(s?`; left unread on ${s}`:""))}(e.definitionsNotRead??0)>0&&r.push(` ${e.definitionsNotRead} process or workflow rule definition(s) not read: the read takes ${e.definitionsBound??Dr} at most`);for(let{part:s,reason:a}of e.unread)r.push(` ${Ha[s]} could not be read: ${a}`);return r.push(` read in ${e.requests} request(s) to ${t}`),r}export{ke as a,at as b,Ad as c,Wo as d,Ed as e,Qn as f,Hn as g,Od as h,Kn as i,Bd as j,$d as k,vd as l,Nd as m,xd as n,nd as o,rd as p,od as q,jn as r,sd as s,_n as t,$o as u,id as v,fd as w,gd as x,Wn as y,pd as z,md as A,Pr as B,Cu as C,Mu as D,Iu as E,ju as F,Ni as G,_u as H,Du as I,xi as J,Fr as K,Lu as L,Wu as M,Gu as N,Uu as O,qu as P,Vu as Q,zu as R,Qu as S,Hu as T,$r as U,vr as V,_i as W,Dr as X,Ie as Y,je as Z,Rt as _,St as $,sr as aa,Di as ba,Li as ca,Wi as da,Gi as ea,Ui as fa,qi as ga,Vi as ha,Nr as ia,zi as ja,Qi as ka,Ji as la,Zi as ma,ea as na,al as oa,ta as pa,na as qa,ra,oa as sa,sa as ta,ia as ua,aa as va,Gr as wa,Ur as xa,wa as ya,to as za,no as Aa,ja as Ba,oo as Ca,wt as Da,Ce as Ea,gt as Fa,_r as Ga,Wa as Ha,Ga as Ia,Ua as Ja,dl as Ka,qd as La,Vd as Ma,Vo as Na,zd as Oa,ir as Pa,ut as Qa,Jo as Ra,Zo as Sa,Qd as Ta,Xn as Ua,ns as Va,Hd as Wa,Kd as Xa,Yd as Ya,ss as Za,is as _a,Jn as $a,as as ab,ds as bb,ls as cb,dt as db,ne as eb,gs as fb,ps as gb,$e as hb,ms as ib,hs as jb,ys as kb,Xd as lb,ve as mb,Es as nb,Ts as ob,Os as pb,Fs as qb,Ps as rb,Bs as sb,$s as tb,vs as ub,Ns as vb,Cs as wb,Ms as xb,Is as yb,fr as zb,js as Ab,xe as Bb,_s as Cb,Ds as Db,Ls as Eb,Ws as Fb,Jd as Gb,Gs as Hb,gr as Ib,Us as Jb,pr as Kb,ct as Lb,qs as Mb,Qs as Nb,Zd as Ob,eu as Pb,ei as Qb,mr as Rb,ti as Sb,ni as Tb,ri as Ub,oi as Vb,tu as Wb,si as Xb,ii as Yb,nu as Zb,ru as _b,br as $b,ou as ac,su as bc,wr as cc,iu as dc,au as ec,du as fc,pi as gc,uu as hc,lu as ic,cu as jc,fu as kc,gu as lc,L as mc,Er as nc,hi as oc,yi as pc,pu as qc,bi as rc,mu as sc,hu as tc,ie as uc,yu as vc,bu as wc,V as xc,wu as yc,Ru as zc,Si as Ac,Su as Bc,Ai as Cc,Au as Dc,ht as Ec,Eu as Fc,Tu as Gc,Ou as Hc,ku as Ic,Fu as Jc};
|
package/lib/chunk-N6HHNR6J.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{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-5344TZBT.mjs";import"./chunk-V4RKM4QZ.mjs";import"./chunk-JU2XEKEO.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-ETT5GP4P.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-E2YJVSX6.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-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{b as ARCHIVE_CHUNK_BYTES,a as ARCHIVE_EXTENSION,f as CheckpointExportError,d as archiveKeyText,h as exportCheckpointArchive,j as importCheckpointArchive,l as importReceivedArchive,c as newArchiveKey,e as parseArchiveKey,g as portableCheckpointOf,i as readArchiveHeader,k as receivedStoreRootOf};
|
package/lib/chunk-N7J6NJQ6.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{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}from"./chunk-7DALDJMO.mjs";import"./chunk-OXKZ4Y3B.mjs";import"./chunk-MAHZMPMZ.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-UIUPPEFB.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-KOQV4WXC.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-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{h as ACTIVE_DUPLICATE_RULES_SOQL,a as FORMULAS_BOUND,c as FORMULAS_IN_COMPOSITES_BOUND,b as FORMULA_REQUESTS_BOUND,o as TargetGapReader,i as bypassesOf,j as callsEstimateOf,f as fieldLabelsSoql,p as gapAnsweredBy,d as gapFieldOf,r as gapLines,q as gapsWithAnswers,l as readActiveValidationRules,m as readValidationRuleBypasses,k as toolingQueriesOver,n as toolingValidationRules,g as validationFormulaSoql,e as validationRulesSoql};
|
package/lib/chunk-NWPQF5XR.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{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}from"./chunk-GWRKS3AL.mjs";import"./chunk-BOGNK4LV.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-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{p as actDeliverability,o as actEmailsGate,n as actSendersOf,q as afterLeaseEmailsRefusal,l as checkpointEmails,j as checkpointEmailsUncounted,c as draftedByDiff,d as draftedByPlan,a as emailsOfLimit,m as emailsRefusal,k as emailsUncountedWords,r as pageEmailsRefusal,e as statusBackByDiff,f as statusBackByPlan,b as updatedByDiff,g as writtenByDiff,h as writtenByPlan,i as writtenByUndo};
|
package/lib/chunk-O7DAFE6M.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
-
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
-
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
-
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
-
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{a as x,b as A,c as b,d as L}from"./chunk-BZ24IAP5.mjs";import{homedir as B}from"node:os";import{join as O,resolve as I}from"node:path";var C="SANDFORGE_JOURNAL_DIR";function U(e=process.env){let n=e[C];return n!==void 0&&n.trim()!==""?I(n):O(B(),".sandforge")}import{spawn as Y}from"node:child_process";import{join as $}from"node:path";import{StringDecoder as M}from"node:string_decoder";function G(){return process.execArgv.filter(e=>!/^--inspect/.test(e))}function J(e){return $(__dirname,`${e}.mjs`)}var g="SANDFORGE_RELAYED_BY";function re(e={}){let n=(e.platform??process.platform)==="win32",s=e.scriptPath??J;return(t,d,c,o={})=>new Promise((f,p)=>{let u=o.relayedBy??e.relayedBy,a={...process.env,...u!==void 0?{[g]:u}:{},...n?{[L]:"ipc"}:{}},r=Y(process.execPath,[...G(),s(t),...d],{stdio:n?["ignore","pipe","pipe","ipc"]:["ignore","pipe","pipe"],env:a,detached:!n,windowsHide:!0}),E=[],R=[],y=o.onStderr!==void 0?new M("utf8"):void 0;r.stdout?.on("data",i=>E.push(i)),r.stderr?.on("data",i=>{R.push(i),process.stderr.write(i);let m=y?.write(i);m&&o.onStderr?.(m)});let l=()=>{if(!n||!r.connected){r.kill("SIGINT");return}r.send(b,i=>{i&&r.kill("SIGINT")})};c.aborted?l():c.addEventListener("abort",l,{once:!0}),r.on("error",i=>{c.removeEventListener("abort",l),p(i)}),r.on("close",(i,m)=>{c.removeEventListener("abort",l);let _=y?.end();_&&o.onStderr?.(_);let v=x.find(T=>T===m);f({code:i??(v!==void 0?A(v):1),stdout:Buffer.concat(E).toString("utf8"),stderr:Buffer.concat(R).toString("utf8")})})})}function S(){let e=process.env[g]?.trim();return e===void 0||e===""?void 0:e}function h(){return S()?.startsWith("sandforge env")===!0}function se(e,n){return h()?n:e}var j="sandforge mcp clone_org_plan",N="sandforge mcp clone_org",F=new Map([["sandforge env",["--sweep","--include-changed"]],["sandforge env, relayed by sandforge mcp",["--include-changed"]],["sandforge mcp",["--mute-automation","--leave-undeletable","--store","--include-changed","--preview"]],[j,["--max-total","--exclude-object","--exclude","--filter","--fit","--fit-within","--fit-seed","--fit-draw","--fit-parents","--fit-children","--fit-whole","--fit-floor","--anonymize","--accept-automation","--accept-emails","--mute-automation","--checkpoint-first"]],[N,[]]]);function de(){return h()||S()===N}function k(e){let n=S();return n===void 0||F.get(n)?.includes(e)===!0}function ae(e,n){return k(e)?e:n===void 0?`this script's own ${e}`:`this script's own ${n} with ${e}`}var w=()=>({input:process.stdin,output:process.stderr});function P(e,n,s){let{input:t,output:d}=n;return t.isTTY!==!0&&(d.write(`${e}
|
|
8
|
-
no terminal to answer: give --yes to go ahead without the question.
|
|
9
|
-
`),process.exit(2)),s?.aborted===!0?Promise.resolve(void 0):(d.write(`${e} `),new Promise(c=>{let o=a=>{t.off("data",f),t.off("end",p),s?.removeEventListener("abort",u),t.pause(),c(a)},f=a=>o(String(a).trim()),p=()=>o(void 0),u=()=>{d.write(`
|
|
10
|
-
`),o(void 0)};t.on("data",f),t.on("end",p),s?.addEventListener("abort",u,{once:!0}),t.resume()}))}async function fe(e,n=w(),s){let t=await P(`${e} [y/N]`,n,s);return t!==void 0&&/^y(es)?$/i.test(t)}async function ue(e,n=w()){return await P(e,n)??""}var H=new Set(["\r",`
|
|
11
|
-
`]),V=new Set(["\x7F","\b"]),W="",X="";function pe(e,n,s=w()){let{input:t,output:d}=s;return t.isTTY!==!0&&(d.write(`${e}
|
|
12
|
-
no terminal to type it on: ${n}.
|
|
13
|
-
`),process.exit(2)),d.write(`${e} `),t.setRawMode?.(!0),new Promise(c=>{let o="",f=a=>{t.off("data",p),t.off("end",u),t.setRawMode?.(!1),t.pause(),d.write(`
|
|
14
|
-
`),c(a)},p=a=>{for(let r of String(a)){if(H.has(r))return f(o);if(r===W||r===X&&o==="")return f(void 0);V.has(r)?o=o.slice(0,-1):r>=" "&&(o+=r)}},u=()=>f(void 0);t.on("data",p),t.on("end",u),t.resume()})}export{U as a,g as b,re as c,S as d,h as e,se as f,j as g,N as h,de as i,k as j,ae as k,fe as l,ue as m,pe as n};
|