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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{b as i,c as ye,d as cr,e as c,f as y,h as dr,i as ee,j as lr,k as l,l as g,m as u,n as ot,o as v,p as C,s as w,t as Ae,u as h,v as S,z as de}from"./chunk-WZQEK4WT.mjs";var V={maxPerParent:1e3,maxExistingParents:2e3,minRatio:.01},Lt={maxKeyLength:255,maxTextLength:131072};function pr(e){return Math.round(e*100)}function Lf(e,t,n=Math.random){let o=Math.max(0,Math.floor(t));switch(e.mode){case"perParent":return Array.from({length:o},()=>e.count);case"range":{let a=e.max-e.min+1;return Array.from({length:o},()=>e.min+Math.min(a-1,Math.floor(n()*a)))}case"ratio":{let a=pr(e.ratio);return Array.from({length:o},(s,d)=>Math.floor((d+1)*a/100)-Math.floor(d*a/100))}}}function Df(e,t){let n=Math.max(0,Math.floor(t));switch(e.mode){case"perParent":return n*e.count;case"range":return n*e.max;case"ratio":return Math.floor(n*pr(e.ratio)/100)}}function Aa(e,t){return t?.find(n=>n.childObject===e)}function Mf(e,t){let n=Aa(e.objectApiName,t),o=new Set;for(let a of e.fieldRules){if(a.ruleType!=="reference"||n&&a.fieldApiName===n.lookupField)continue;let s=a.config.referenceObject;typeof s=="string"&&s&&o.add(s)}return n?.parents.kind==="generated"&&o.add(n.parentObject),[...o]}var ke={REST_API_BATCH_SIZE:200,COMPOSITE_BATCH_SIZE:25,COMPOSITE_MAX_SUBREQUESTS:25,BULK_API_MAX_RECORDS:15e7,BULK_API_MAX_CONCURRENT_JOBS:100,BULK_API_MAX_BATCH_SIZE_BYTES:10485760,DAILY_API_CALLS_ENTERPRISE:1e5,SOQL_MAX_LENGTH:1e5,SOQL_MAX_RECORDS:5e4,SOQL_MAX_IN_VALUES:4e3,MAX_FIELDS_PER_OBJECT:800,MAX_RELATIONSHIP_DEPTH:5,SOQL_MAX_OFFSET:2e3,AVG_RECORD_SIZE_KB:2,COMPOSITE_GRAPH_MAX_NODES:500,DEFAULT_API_VERSION:"62.0"},$f=`v${ke.DEFAULT_API_VERSION}`,Bf="the org does not tell this user its data storage";var Hf={rest:ke.REST_API_BATCH_SIZE,bulk:1e4,composite:ke.COMPOSITE_BATCH_SIZE,auto:ke.REST_API_BATCH_SIZE};var Kf={autoActivateThreshold:1e4,maxWorkers:4,grappeSize:5e3,strategy:"by_volume",checkpointing:!0,isolationLevel:"per_grappe",backPressure:{enabled:!0,maxQueueDepth:3,highWaterMark:80,lowWaterMark:60,strategy:"pause",monitoringInterval:5e3}};var Vf={dataQuery:2e3,monitorJobs:50,permissionSets:100,anomalyScan:500,singleRecord:1},qf="Salesforce CLI (sf) not found on PATH.",Zf="https://developer.salesforce.com/tools/salesforcecli",Yf=10*6e4,Xf=2e3,Qf=50,Jf=5e4,eg=500,Ie=1e6,ur=1e6,tg=2e3,ng={default:7,min:0,max:3650},rg="A checkpoint returns the org it was taken of to a moment; replayed in another org, it sets its records up there again, with new Ids, without its own org.",og=1e5;var Dt=g({staticValue:v([i(),c(),y()]).optional(),fakerMethod:i().optional(),fakerLocale:i().optional(),sequenceStart:c().int().optional(),sequenceStep:c().int().optional(),sequencePrefix:i().optional(),formula:i().optional(),referenceObject:i().optional(),picklistValues:l(i()).optional(),regexPattern:i().optional(),csvColumn:i().optional(),minValue:c().optional(),maxValue:c().optional(),minLength:c().int().nonnegative().optional(),maxLength:c().int().positive().optional(),aiPrompt:i().optional()}),Mt=g({fieldApiName:i().min(1),fieldType:i().min(1).optional(),ruleType:h(["static","random","sequence","formula","reference","picklist_random","ai_generate","faker","regex","from_csv"]),config:Dt}),mr=i().min(1).max(Lt.maxKeyLength),Ra=g({key:mr,values:w(i().min(1),v([i().max(Lt.maxTextLength),c(),y(),dr()])),parentKey:mr.optional()}),za=l(Ra).min(1).max(Ie).superRefine((e,t)=>{let n=new Set;for(let[o,a]of e.entries())n.has(a.key)&&t.addIssue({code:"custom",path:[o,"key"],message:`The key "${a.key}" names more than one row: each row is named once`}),n.add(a.key)}),_a=g({objectApiName:i().min(1),recordCount:c().int().positive().max(Ie),recordTypeId:i().optional(),fieldRules:l(Mt),excludedFields:l(i()),insertOrder:c().int().nonnegative(),batchSize:c().int().positive().max(1e4).default(200),optional:y().optional(),rows:za.optional()}),Oa=i().regex(/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,"A record id is 15 or 18 letters and digits"),Ta=C("kind",[g({kind:S("generated")}),g({kind:S("existing"),where:i().max(2e3).optional(),limit:c().int().positive().max(V.maxExistingParents)}),g({kind:S("records"),ids:l(Oa).min(1).max(V.maxExistingParents).refine(e=>new Set(e.map(t=>t.slice(0,15))).size===e.length,{message:"Each parent record is given once"})})]),wa=C("mode",[g({mode:S("perParent"),count:c().int().positive().max(V.maxPerParent)}),g({mode:S("range"),min:c().int().nonnegative().max(V.maxPerParent),max:c().int().positive().max(V.maxPerParent)}),g({mode:S("ratio"),ratio:c().min(V.minRatio).max(V.maxPerParent)}),g({mode:S("byKey")})]).refine(e=>e.mode!=="range"||e.min<=e.max,{message:"A range of children per parent cannot start above its end",path:["min"]}),ka=g({childObject:i().min(1),lookupField:i().min(1),parentObject:i().min(1),parents:Ta,distribution:wa}),cg=g({name:i().min(1).max(255),description:i().default(""),strategy:h(["ai","faker","template","csv_import","clone"]),objects:l(_a).min(1),relations:l(ka).max(100).optional(),aiPersona:i().optional(),tags:l(i()).default([])});function Ia(e,t){let n=e.objects,o=e.relations??[],a=(s,d)=>t.addIssue({code:"custom",path:s,message:d});for(let[s,d]of n.entries()){let p=d.rows;if(!p)continue;let m=d.objectApiName;d.recordCount!==p.length&&a(["objects",s,"recordCount"],`${m} gives ${p.length} row(s) and asks for ${d.recordCount} record(s): an object with rows writes one record per row`);let f=o.find(O=>O.childObject===m),x=f?.distribution.mode==="byKey"?f:void 0,b=x&&n.find(O=>O.objectApiName===x.parentObject),E=new Set((b?b.rows??[]:[]).map(O=>O.key));for(let[O,k]of p.entries()){let T=["objects",s,"rows",O,"parentKey"];x?k.parentKey===void 0?a(T,`${m} row "${k.key}" names no ${x.parentObject} row: a relation by key places every row under the one it names`):b&&b.rows&&!E.has(k.parentKey)&&a(T,`${m} row "${k.key}" is placed under ${x.parentObject} "${k.parentKey}", which no ${x.parentObject} row is`):k.parentKey!==void 0&&a(T,`${m} row "${k.key}" names a parent row, and no relation places ${m} by key`)}}for(let[s,d]of o.entries()){if(d.distribution.mode!=="byKey")continue;let p=["relations",s,"distribution"],m=`The relation on ${d.childObject} places by key`,f=n.find(b=>b.objectApiName===d.childObject),x=n.find(b=>b.objectApiName===d.parentObject);d.parents.kind!=="generated"?a(p,`${m}, which only the ${d.parentObject} rows this run writes have`):x&&!x.rows&&a(p,`${m}, and ${d.parentObject} has no rows to name`),f&&!f.rows&&a(p,`${m}, and ${d.childObject} has no rows to place`)}}function dg(e){let t=[];return Ia(e,{addIssue:n=>t.push(n)}),t}var va="base64";function Ca(e){return e.type===va}function Na(e,t){return!e||t?null:"This run anonymizes its records, and the content of a file cannot be anonymized: files are copied only once you accept that they are copied as they are. Nothing was read or written."}function Ut(e,t,n,o,a){return[e,t,n??"",o??"",a??""].join("|")}function fe(e){let t=e.split("|");if(t.length<5||t[0]===""||t[1]==="")return null;let[n,o,a,s,...d]=t,p=d.join("|");return{kind:n,objectApiName:o,...a!==""?{field:a}:{},...s!==""?{recordType:s}:{},...p!==""?{value:p}:{}}}var at=/^[A-Za-z][A-Za-z0-9]*__(.+)$/,Pa=new Set(["record_type_unmapped"]);function $t(e){return typeof e=="string"?e:e.id}function gr(e){if(typeof e=="string")return[];let t=e.detail?.sameDeveloperName;return Array.isArray(t)?t:[]}function ja(e,t,n){let o=new Set(e??[]),a=$t(t);if(o.has(a))return a;let s=hr(t,n);return s!==void 0&&o.has(s)?s:void 0}function fr(e){let t=fe(e);if(t===null)return;let n=t.kind,o=at.exec(t.recordType??"")?.[1];if(o!==void 0)return Ut(n,t.objectApiName,t.field,o,t.value);let a=Pa.has(n)?at.exec(t.value??"")?.[1]:void 0;if(a!==void 0)return Ut(n,t.objectApiName,t.field,t.recordType,a)}function hr(e,t){let n=$t(e),o=fr(n);if(!(o===void 0||gr(e).length>0)){for(let a of t)if(a!==n&&(a===o||fr(a)===o))return;return o}}function Fa(e,t,n){let o=e.find(s=>s.gapId===$t(t));if(o)return o;let a=hr(t,n);return a===void 0?void 0:e.find(s=>s.gapId===a)}function La(e,t,n){let o=Da(t,n);return e.find(a=>a.recordType===t.recordType)??(o!==void 0?e.find(a=>a.recordType===o):void 0)??e.find(a=>a.recordType===void 0)}function Da(e,t){let n=fe(e.id),o=at.exec(n?.recordType??"")?.[1];if(!(n===null||o===void 0||gr(e).length>0)){for(let a of t){let s=fe(a);if(s===null||s.recordType===n.recordType||s.objectApiName!==n.objectApiName||s.field!==n.field||s.value!==n.value)continue;let d=s.recordType??"";if(d===o||at.exec(d)?.[1]===o)return}return o}}var it={info:0,warning:1,blocking:2};function Ma(...e){let t=new Map;for(let n of e.flat()){let o=t.get(n.id);if(!o){t.set(n.id,{...n,decisions:[...n.decisions]});continue}let a=it[n.severity]>it[o.severity];t.set(n.id,{...o,...a?{severity:n.severity,source:n.source}:{},rows:Math.max(o.rows,n.rows),detail:{...n.detail,...o.detail},decisions:[...new Set([...o.decisions,...n.decisions])]})}return[...t.values()].sort((n,o)=>it[o.severity]-it[n.severity]||n.objectApiName.localeCompare(o.objectApiName)||n.id.localeCompare(o.id))}function Ua(e){return`${e.permission}=${e.permissionSets.map(t=>t.name).join(",")}`}function $a(e){let t=e.detail?.assign;return Array.isArray(t)?t.flatMap(n=>{let o=n.indexOf("=");if(o<=0)return[];let[a,...s]=n.slice(o+1).split(",").filter(d=>d!=="").map(d=>({name:d}));return[{permission:n.slice(0,o),...a?{permissionSet:a}:{},others:s}]}):[]}function Ba(e,t){if(!(e.kind==="validation_rule"||e.kind==="rehearsal_refusal"&&e.detail?.statusCode==="FIELD_CUSTOM_VALIDATION_EXCEPTION")||!t)return;let o=e.detail?.rule;if(typeof o=="string")return t.find(a=>a.kind==="validationRule"&&a.name===o&&a.objectApiName.toLowerCase()===e.objectApiName.toLowerCase())}var Ga=5e4,Wa=1e6,Ha=200,re=2e3,Ka=5e4,Bt=["PRODUCTION_TARGET","AUTOMATION_DECLINED","READ_DECLINED","WRITE_DECLINED","STORAGE_EXCEEDED","CONFIRMATION_UNAVAILABLE","CHECKPOINT_REFUSED","API_BUDGET_EXCEEDED","READ_BOUND_EXCEEDED","FILES_UNREAD","FILE_STORAGE_UNREAD","FILE_STORAGE_EXCEEDED","SAMPLE_STORAGE_UNREAD","SAMPLE_CANNOT_FIT","SAMPLE_TOO_LARGE","SAMPLE_PLAN_MISMATCH","SAMPLE_PLAN_GONE","SAMPLE_DRAW_INVALID","SAMPLE_DRAW_EMPTY","ROOTS_QUERY_REFUSED","NO_ROOTS","ROOTS_EXCEEDED","ROOTS_PLAN_MISMATCH","ROOTS_PLAN_GONE"],Va=new Set(["SAMPLE_STORAGE_UNREAD","SAMPLE_CANNOT_FIT","SAMPLE_TOO_LARGE","SAMPLE_PLAN_MISMATCH","SAMPLE_PLAN_GONE","SAMPLE_DRAW_INVALID","SAMPLE_DRAW_EMPTY","STORAGE_EXCEEDED"]),qa=new Set(["ROOTS_QUERY_REFUSED","NO_ROOTS","ROOTS_EXCEEDED","ROOTS_PLAN_MISMATCH","ROOTS_PLAN_GONE"]),Za=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,Ya=20,Xa=g({code:h(Bt),storage:g({estimateMB:c().nonnegative(),remainingMB:c(),kind:h(["data","files"]).optional()}).optional(),ceiling:c().int().positive().optional(),reason:i().regex(/^[A-Z][A-Z_]{0,39}$/).optional(),api:g({kind:h(["requests","bulkBatches"]),org:h(["source","target"]),estimate:c().int().nonnegative(),remaining:c().int(),drawing:g({share:c().positive().max(1),draw:h(["uniform","recent","oldest"]),restricted:y().optional()}).optional(),reading:g({bound:c().int().positive()}).optional()}).optional(),readBound:g({bound:c().int().positive(),objects:l(g({objectApiName:i().min(1).max(255),rows:c().int().nonnegative()})).min(1).max(200),of:S("roots").optional()}).optional(),roots:g({objectApiName:i().regex(Za),cap:c().int().min(1).max(re).optional(),total:c().int().nonnegative().optional(),fits:c().int().min(1).max(re).optional(),ordered:S(!0).optional(),plan:h(["gone","otherOrg","otherQuery","changed"]).optional()}).optional(),sample:g({needMB:c().nonnegative().optional(),budgetMB:c().nonnegative().optional(),heaviest:l(i().min(1).max(255)).max(Ya).optional(),limitedBy:h(["storage","within","maxTotal","targetRequests","bulkBatches","sourceRequests","heavyRoots","whole","draw"]).optional(),rows:c().int().nonnegative().optional(),most:c().int().nonnegative().optional(),plan:h(["gone","changed","otherOrg","otherSetup","otherSha"]).optional(),fittedMB:c().nonnegative().optional(),holdsMB:c().nonnegative().optional(),requests:c().int().nonnegative().optional()}).optional()});function Qa(e){return Bt.includes(e)}function Ja(e){let t=Xa.safeParse(e);if(!t.success)return null;let{code:n,storage:o,ceiling:a,reason:s,api:d,readBound:p,sample:m,roots:f}=t.data;return{code:n,...o?{storage:{estimateMB:o.estimateMB,remainingMB:o.remainingMB,...o.kind!==void 0?{kind:o.kind}:{}}}:{},...a!==void 0?{ceiling:a}:{},...s!==void 0&&n==="CHECKPOINT_REFUSED"?{reason:s}:{},...d&&n==="API_BUDGET_EXCEEDED"?{api:d}:{},...p&&n==="READ_BOUND_EXCEEDED"?{readBound:p}:{},...m&&Va.has(n)?{sample:m}:{},...f&&(qa.has(n)||n==="STORAGE_EXCEEDED")?{roots:f}:{}}}var yr=["GROUP BY","HAVING","OFFSET","FOR","WITH","USING SCOPE","UPDATE","aggregate"],es=[["WHERE","WHERE",null],["USING SCOPE","USING",["SCOPE"]],["WITH","WITH",null],["GROUP BY","GROUP",["BY"]],["HAVING","HAVING",null],["ORDER BY","ORDER",["BY"]],["LIMIT","LIMIT",null],["OFFSET","OFFSET",null],["FOR","FOR",["VIEW","REFERENCE","UPDATE"]],["UPDATE","UPDATE",["TRACKING","VIEWSTAT"]]],ts=new Set(["WHERE","USING","WITH","GROUP","ORDER","LIMIT","OFFSET","FOR","UPDATE"]),ns=new Set(["COUNT","COUNT_DISTINCT","SUM","AVG","MIN","MAX"]),rs=/^([A-Za-z]\w*)((?:\.[A-Za-z]\w*)+)\s+(?:AS\s+)?([A-Za-z]\w*)$/i;function os(e){let t=[],n=0,o=0;for(;o<e.length;){let a=e[o]??"";if(a==="'"){for(o++;o<e.length&&e[o]!=="'";)o+=e[o]==="\\"?2:1;o++}else if(a==="(")n++,o++;else if(a===")")n=Math.max(0,n-1),o++;else if(/\w/.test(a)){let s=o;for(;o<e.length&&/\w/.test(e[o]??"");)o++;n===0&&t.push({word:e.slice(s,o),start:s,end:o})}else o++}return t}function is(e){let t=os(e),n=T=>t[T]?.word.toUpperCase(),o=t.findIndex(T=>T.word.toUpperCase()==="FROM"),a=t[o+1];if(o<0||a===void 0)return null;let s=T=>{let R=n(T+1),j=es.find(([,U,me])=>n(T)===U&&(me===null||R!==void 0&&me.includes(R)));if(j)return[j[0],j[2]===null?1:2]},d=[];for(let T=o+2;T<t.length;T++){let R=s(T);R&&(R[0]==="WHERE"&&d.some(j=>j.name==="WHERE")||(d.push({name:R[0],at:T,words:R[1]}),T+=R[1]-1))}let p=d.map((T,R)=>({name:T.name,at:T.at,bodyFrom:T.at+T.words,bodyTo:d[R+1]?.at??t.length})),m=p[0]?.at??t.length,f=n(o+2)==="AS"?o+3:o+2,x=n(f),b=f<m&&x!==void 0&&!ts.has(x)?x:null,E=new Map;b&&E.set(b,"");let O=!1,k=t[m]?.start??e.length;for(let T of e.slice(a.end,k).split(",").slice(1)){let R=rs.exec(T.trim()),j=R?E.get((R[1]??"").toUpperCase()):void 0;if(!R||j===void 0){O=!0;continue}let U=(R[2]??"").slice(1);E.set((R[3]??"").toUpperCase(),j?`${j}.${U}`:U)}return{soql:e,words:t,fromAt:o,objectApiName:a.word,clauses:p,aliasPaths:E,unresolvedAlias:O}}function Gt(e,t){let n=e.clauses.find(f=>f.name===t);if(!n)return null;let{soql:o,words:a,aliasPaths:s}=e,d=a[n.bodyFrom-1]?.end??o.length,p=a[n.bodyTo]?.start??o.length,m=o.slice(d,p);if(s.size>0)for(let f=n.bodyTo-1;f>=n.bodyFrom;f--){let x=a[f];if(x===void 0)continue;let b=s.get(x.word.toUpperCase());b!==void 0&&o[x.end]==="."&&o.slice(0,x.start).trimEnd().slice(-1)!=="."&&(m=m.slice(0,x.start-d)+(b?`${b}.`:"")+m.slice(x.end+1-d))}return m=m.trim(),m.length>0?m:null}function br(e){let t=is(e);if(!t)return null;let{words:n,fromAt:o,clauses:a}=t,s=[];n.slice(0,o).some(E=>ns.has(E.word.toUpperCase())&&/^\s*\(/.test(t.soql.slice(E.end)))&&s.push("aggregate");for(let E of a){let O=yr.find(k=>k===E.name);O!==void 0&&!s.includes(O)&&s.push(O)}let p=Gt(t,"WHERE"),m=Gt(t,"ORDER BY"),f=a.some(E=>E.name==="LIMIT")?Gt(t,"LIMIT"):null,x=a.some(E=>E.name==="LIMIT")?f!==null&&/^\d{1,9}$/.test(f)?Number(f):Number.NaN:null,b=p!==null||m!==null;return{objectApiName:t.objectApiName,where:p,orderBy:m,limit:x,refused:s,...t.unresolvedAlias&&b?{unresolvedAlias:!0}:{}}}var as=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,ve=i().min(1).max(512).refine(e=>!/--|\/\*|\*\/|;\s*$/.test(e),{message:"SOQL filter must not contain comment markers (--, /*, */) or trailing semicolon"}),Wt=200,ss="CreatedDate DESC, Id DESC",cs=/^[A-Za-z][A-Za-z0-9_]{0,79}(?:\.[A-Za-z][A-Za-z0-9_]{0,79}){0,4}(?:\s+(?:ASC|DESC))?(?:\s+NULLS\s+(?:FIRST|LAST))?$/i,st=i().min(1).max(Wt).refine(e=>e.split(",").every(t=>cs.test(t.trim())),{message:"An ORDER BY takes field paths, each with ASC or DESC and NULLS FIRST or LAST, separated by commas"});function Ht(e){let t=br(e);if(!t)return{kind:"noObject"};if(!as.test(t.objectApiName))return{kind:"object",objectApiName:t.objectApiName};let[n]=t.refused;if(n!==void 0)return{kind:"refused",clause:n};if(t.unresolvedAlias)return{kind:"alias"};if(t.where!==null&&!ve.safeParse(t.where).success)return{kind:"where"};if(t.orderBy!==null&&!st.safeParse(t.orderBy).success)return{kind:"orderBy"};if(t.limit!==null&&!(Number.isInteger(t.limit)&&t.limit>=1&&t.limit<=re))return{kind:"limit"}}function Kt(e){switch(e.kind){case"noObject":return"The query names no object after FROM: write it as SELECT Id FROM <Object> WHERE \u2026";case"object":return`"${e.objectApiName}" after FROM is not an object\u2019s API name: name the object as the org does, as Account or Region__c`;case"refused":return e.clause==="aggregate"?"The query counts, sums or groups its rows (COUNT(), SUM(), MAX()\u2026), and returns no record to clone: select the records themselves, as SELECT Id FROM <Object> WHERE \u2026":`The query\u2019s ${e.clause} changes the records it returns, and the clone would read others than it shows: take it out, and choose the records by WHERE, ORDER BY and LIMIT`;case"alias":return"The query names a relationship by an alias that does not lead back to its object (FROM Contact c, x.Account a): write each path from the object, as Account.Name";case"where":return"The query\u2019s WHERE is past 512 characters, or holds a comment marker (--, /*, */) or ends with ;: shorten it, or take them out";case"orderBy":return`The query\u2019s ORDER BY takes field paths, each with ASC or DESC and NULLS FIRST or LAST, separated by commas, ${Wt} characters at most: as ORDER BY CreatedDate DESC, Id`;case"limit":return`The query\u2019s LIMIT is a whole number from 1 to ${re.toLocaleString("en-US")}: past it, copy a sample of the whole org with a filter on its roots`}}function ds(e){return e?e.inputMode==="record"?typeof e.recordId=="string":e.inputMode==="soql"&&e.queryScope==="records"&&typeof e.soqlQuery=="string":!1}var ls=h(["pending","queued","extracting","anonymizing","loading","completed","failed","skipped"]),ps=h(["lookup","master_detail","hierarchical","polymorphic"]),Ne=h(["fake","mask","hash","nullify","redact","shuffle","truncate","preserve_format","age_band","generalize"]),xr=h(["PII","PHI","PCI","SENSITIVE","NONE"]),Sr=h(["gdpr","ccpa","hipaa","pci_dss","custom","none"]),us=h(["field_name","regex","content_sampling","ai"]),ms=g({objectApiName:i().min(1),fieldApiName:i().min(1),fieldLabel:i().min(1),fieldType:i().min(1),piiCategory:xr,detectionMethod:us,confidence:c().min(0).max(1),suggestedMethod:Ne}),fs=g({objectApiName:i().min(1),fieldApiName:i().min(1),method:Ne,piiCategory:xr,aiConfidence:c().min(0).max(1),userOverridden:y(),fieldType:i().min(1).optional()}),hg=g({sourceRecordId:i().min(1),firstName:i(),lastName:i(),email:i(),phone:i(),address:i(),city:i(),postalCode:i(),company:i()}),Ce=g({statusCode:i().min(1),fields:l(i()),count:c().int().positive(),message:i()}),gs=g({objectApiName:i().min(1),recordCount:c().int().nonnegative(),estimatedApiCalls:c().int().nonnegative(),piiFields:l(ms),anonymizationRules:l(fs),status:ls,progress:c().min(0).max(100),insertOrder:c().int().nonnegative(),level:c().int().nonnegative(),successCount:c().int().nonnegative(),failureCount:c().int().nonnegative(),errors:l(i()),elapsedMs:c().nonnegative(),apiCallsUsed:c().int().nonnegative(),linkedCount:c().int().nonnegative().optional(),refusals:l(Ce).optional(),statusesApplied:c().int().nonnegative().optional(),statusRefusals:l(Ce).optional(),lookupsFilled:c().int().nonnegative().optional(),lookupRefusals:l(Ce).optional(),leftToThePlatform:c().int().nonnegative().optional()}),hs=g({from:i().min(1),to:i().min(1),fieldApiName:i().min(1),relationshipType:ps,required:y()}),ys=h(["two_pass","upsert_external_id","nullable_lookup"]),Er=g({objects:l(i().min(1)).min(2),strategy:ys,description:i().min(1)}),bs=g({totalObjects:c().int().nonnegative(),totalRelationships:c().int().nonnegative(),cycleCount:c().int().nonnegative(),maxDepth:c().int().nonnegative(),totalRecords:c().int().nonnegative(),totalEstimatedApiCalls:c().int().nonnegative()}),yg=g({nodes:l(gs),edges:l(hs),cycles:l(Er),stats:bs}),xs=g({order:c().int().nonnegative(),objects:l(i().min(1)),dependsOn:l(c().int().nonnegative())}),Ss=g({totalPiiFields:c().int().nonnegative(),totalFieldsToAnonymize:c().int().nonnegative(),methodBreakdown:Ae(Ne,c().int().nonnegative()),objectsWithPii:l(i().min(1)),notCovered:l(g({objectApiName:i().min(1),missing:l(h(["name","email","phone"]))})).optional()}),Es=g({maxDepth:c().int().positive(),maxObjects:c().int().positive(),selected:l(i().min(1)),parents:l(g({objectApiName:i().min(1),records:c().int().nonnegative()})),leftEmpty:l(g({objectApiName:i().min(1),fieldApiName:i().min(1),target:i().min(1),reason:h(["depth","objects","standard"]),required:S(!0).optional()})),standardNeeded:l(g({objectApiName:i().min(1),neededBy:i().min(1)})),followedByDefault:l(g({objectApiName:i().min(1),referencedBy:l(i().min(1)).min(1)})).optional(),currencies:g({notInTarget:l(i().min(1)).min(1),writtenIn:i().min(1),objects:l(i().min(1))}).optional(),cutShort:l(g({objectApiName:i().min(1),copied:c().int().nonnegative(),total:c().int().nonnegative().optional()})).optional()}),bg=g({waves:l(xs),totalRecords:c().int().nonnegative(),estimatedDurationSec:c().nonnegative(),estimatedApiCalls:c().int().nonnegative(),complianceFramework:Sr,anonymizationSummary:Ss,cycleResolutions:l(Er),scope:Es.optional()}),xg=g({sourceOrgId:i().min(1),targetOrgId:i().min(1),selectedObjects:l(i().min(1)),complianceFramework:Sr,maxRecordsPerObject:c().int().nonnegative(),objectFilters:w(i(),i()),includeStandardObjects:y(),grappeThreshold:c().int().positive(),maxDepth:c().int().positive().optional(),maxObjects:c().int().positive().optional()}),ct=g({timestamp:i().min(1)}),As=ct.extend({type:h(["scan-started","scan-completed","plan-generated","execution-started","wave-completed","execution-completed","execution-failed","paused","resumed"])}),Rs=ct.extend({type:S("node-progress"),objectApiName:i().min(1),progress:c().min(0).max(100),recordsProcessed:c().int().nonnegative(),recordsTotal:c().int().nonnegative(),apiCallsUsed:c().int().nonnegative()}),zs=ct.extend({type:S("node-completed"),objectApiName:i().min(1),successCount:c().int().nonnegative(),failureCount:c().int().nonnegative(),linkedCount:c().int().nonnegative().optional(),refusals:l(Ce).optional(),elapsedMs:c().nonnegative(),apiCallsUsed:c().int().nonnegative()}),_s=ct.extend({type:S("node-failed"),objectApiName:i().min(1),errors:l(i()),partialSuccessCount:c().int().nonnegative(),failureCount:c().int().nonnegative().optional(),linkedCount:c().int().nonnegative().optional(),refusals:l(Ce).optional()}),Sg=C("type",[As,Rs,zs,_s]);var Ar=h(["record","soql","template","ai","org"]),Os=h(["direct","full","custom"]),Yt=h(["direct","full","custom","all"]),Ts=h(["idle","scanning","running","done","error","skipped","stopped"]),Og=h(["auto","graph","table"]),ws=h(["master-detail","lookup"]),ks=h(["rest","bulk","auto"]),Is=h(["email","phone","name","address","ssn_id","financial","other"]),vs=h(["two_pass","upsert_external_id","nullable_lookup","unbreakable"]),Vt=/^[a-zA-Z0-9]{15,18}$/,q=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,dt=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,qt=/^[A-Za-z][A-Za-z0-9_]{0,96}$/,Cs=h(["uniform","recent","oldest"]),Ns=h(["records","tables"]),Xt=36500,Ps=20,Pe=50,js=/^(?:[A-Za-z][A-Za-z0-9_]{0,79}\.)?[A-Za-z][A-Za-z0-9_]{0,79}$/,Fs=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/;function lt(e){if(!Fs.test(e))return!1;let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e.replace("Z",".000Z")}function pt(e,t){if(lt(e))return e;if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return;let n=`${e}T00:00:00Z`;return lt(n)?t?`${new Date(Date.parse(n)+1440*60*1e3).toISOString().slice(0,19)}Z`:n:void 0}var Ls=u({field:h(["CreatedDate","LastModifiedDate"]),from:i().refine(lt,{message:"A bound is an instant in UTC, as 2025-07-01T00:00:00Z"}).optional(),to:i().refine(lt,{message:"A bound is an instant in UTC, as 2025-07-01T00:00:00Z"}).optional(),lastDays:c().int().min(1).max(Xt).optional()}).superRefine((e,t)=>{let n=e.from!==void 0||e.to!==void 0;!n&&e.lastDays===void 0&&t.addIssue({code:"custom",path:[],message:"A window gives from, to or both, or lastDays"}),n&&e.lastDays!==void 0&&t.addIssue({code:"custom",path:["lastDays"],message:"lastDays counts back from when the sample is drawn, and takes no from or to: give one or the other"}),e.from!==void 0&&e.to!==void 0&&e.from>=e.to&&t.addIssue({code:"custom",path:["to"],message:"A window\u2019s from is before its to"})}),Qt=l(i().regex(js,"A stratum is a field, as RecordTypeId, or an object and its field, as Account.RecordTypeId")).max(Ps).superRefine((e,t)=>{let n=new Set;e.forEach((o,a)=>{let s=o.indexOf("."),d=s<0?"":o.slice(0,s).toLowerCase();n.has(d)&&t.addIssue({code:"custom",path:[a],message:s<0?`${o}: the roots are stratified by one field of every object at most`:`${o}: the roots of ${o.slice(0,s)} are stratified by one field at most`}),n.add(d)})}),Ds=h(["all","required"]),Tg={seed:1,draw:"uniform",parents:"all",children:100,floor:1},Ms=u({withinMB:c().positive().max(1e6).optional(),maxTotal:c().int().min(1).optional(),seed:c().int().min(0).optional(),draw:Cs.optional(),parents:Ds.optional(),children:v([S("all"),c().int().min(1).max(1e6)]).optional(),whole:l(i().regex(q,"Invalid SObject API name")).max(500).optional(),floor:c().int().min(0).max(1e4).optional(),plan:i().min(1).max(4096).optional(),window:Ls.optional(),rootWhere:w(i().regex(q,"Invalid SObject API name"),ve).refine(e=>Object.keys(e).length<=Pe,{message:`The roots of ${Pe} objects at most are filtered`}).optional(),strata:Qt.optional()}),Rr="A sample is drawn from a clone of the whole org alone (inputMode 'org', depth 'all'): sample must be left out",Jt=g({inputMode:Ar,recordId:i().regex(Vt,"Invalid Salesforce record ID").optional(),soqlQuery:i().min(1).max(2e4).optional(),queryScope:Ns.optional(),maxRoots:c().int().min(1).max(re).optional(),templateId:i().min(1).max(200).optional(),aiPrompt:i().min(1).max(4e3).optional(),depth:Yt,customDepth:c().int().positive().max(10).optional(),maxNodes:c().int().min(10).max(500).optional(),sourceOrgId:i().min(1).max(128),targetOrgId:i().min(1).max(128),anonymizePII:y(),skipEmpty:y(),batchSize:v([S("auto"),c().int().positive().max(1e4)]),expandOrphanParents:y().optional(),keepContactPoints:y().optional(),applyAssignmentRules:y().optional(),maxRecordsPerObject:c().int().positive().max(1e6).optional(),fieldExclusions:w(i().regex(q,"Invalid SObject API name"),l(i().regex(/^[A-Za-z][A-Za-z0-9_]{0,79}$/).max(80)).max(200)).optional(),ownerMappings:w(i().regex(Vt,"Invalid Salesforce record ID"),i().regex(Vt,"Invalid Salesforce record ID")).refine(e=>Object.keys(e).length<=200,{message:"Too many owner mappings (max 200)"}).optional(),objectSoqlFilters:w(i().regex(q,"Invalid SObject API name"),ve).refine(e=>Object.keys(e).length<=50,{message:"Too many SOQL filters (max 50)"}).optional(),fieldMappings:w(i().regex(q,"Invalid SObject API name"),w(i().regex(/^[A-Za-z][A-Za-z0-9_]{0,79}$/,"Invalid source field name"),i().regex(/^[A-Za-z][A-Za-z0-9_]{0,79}$/,"Invalid target field name")).refine(e=>Object.keys(e).length<=200,{message:"Too many field mappings (max 200 per object)"})).refine(e=>Object.keys(e).length<=50,{message:"Too many objects with field mappings (max 50)"}).optional(),dryRun:y().optional(),picklistValueMappings:l(g({object:i().regex(q,"Invalid SObject API name"),field:i().regex(dt,"Invalid field name"),recordType:i().regex(qt).optional(),from:i().min(1).max(255),to:i().min(1).max(255).nullable()})).max(500).optional(),recordTypeMappings:l(g({object:i().regex(q,"Invalid SObject API name"),from:i().regex(qt),to:i().regex(qt).nullable()})).max(200).optional(),defaultValues:l(g({object:i().regex(q,"Invalid SObject API name"),field:i().regex(dt,"Invalid field name"),value:v([i().max(1e3),c(),y()])})).max(200).optional(),truncateFields:l(g({object:i().regex(q,"Invalid SObject API name"),field:i().regex(dt,"Invalid field name")})).max(200).optional(),excludedObjects:l(i().regex(q,"Invalid SObject API name")).max(500).optional(),ignoredGaps:l(i().min(1).max(600)).max(1e3).optional(),skippedRows:l(g({object:i().regex(q,"Invalid SObject API name"),gapId:i().min(1).max(600)}).refine(e=>fe(e.gapId)?.objectApiName===e.object,{message:"The gap id must name the object",path:["gapId"]})).max(500).optional(),sample:Ms.optional()}),Us=Jt.extend({inputMode:Ar.exclude(["org"]),depth:Os,sample:lr({error:Rr}).optional()});function $s(e){let t=e.inputMode==="org",n=e.depth==="all";if(!t&&!n)return e.sample===void 0?void 0:Rr;if(!n)return"A clone of the whole org (inputMode 'org') takes the depth 'all' and no other";if(!t)return`The depth 'all' clones the whole org and goes with inputMode 'org' only, not '${e.inputMode}'`;let o=["recordId","soqlQuery","templateId","aiPrompt","customDepth"].filter(x=>e[x]!==void 0);if(o.length>0)return`A clone of the whole org starts from no record, query, template or AI draft and walks no depth: ${o.join(", ")} must be left out`;let a=new Set(e.excludedObjects??[]),s=(e.sample?.whole??[]).filter(x=>a.has(x));if(s.length>0)return`The sample copies whole an object the run leaves out: ${s.join(", ")}. Take each out of one list or the other`;let d=Object.keys(e.sample?.rootWhere??{}),p=new Set(e.sample?.whole??[]),m=d.filter(x=>p.has(x));if(m.length>0)return`The sample filters the roots of an object it copies whole, every record of which comes: ${m.join(", ")}. Take each out of whole, or filter the object itself (objectSoqlFilters), which leaves records out of the copy`;let f=d.filter(x=>a.has(x));if(f.length!==0)return`The sample filters the roots of an object the run leaves out: ${f.join(", ")}. Take each out of one list or the other`}function Bs(e){if(e.queryScope!==void 0&&e.inputMode!=="soql")return{field:"queryScope",message:`queryScope says what a query clones, and goes with inputMode 'soql' alone, not '${e.inputMode}'`};if(e.maxRoots!==void 0&&e.queryScope!=="records")return{field:"maxRoots",message:"maxRoots bounds the records a query chooses to clone, and goes with queryScope 'records' alone"};if(e.queryScope==="records"&&e.soqlQuery!==void 0){let t=Ht(e.soqlQuery);if(t!==void 0)return{field:"soqlQuery",message:Kt(t)}}}function wg(e,t){if(!(e.sample===void 0||t===void 0))return"A sample of the whole org copies no files yet: copy every record to take them, or leave the files out"}var kg=Jt.superRefine((e,t)=>{let n=Bs(e);if(n!==void 0&&t.addIssue({code:"custom",message:n.message,path:[n.field]}),e.inputMode==="org"||e.depth==="all"||e.sample!==void 0){let a=$s(e);a!==void 0&&t.addIssue({code:"custom",message:a,path:["inputMode"]});return}e.inputMode==="record"&&e.recordId!==void 0||e.inputMode==="soql"&&e.soqlQuery!==void 0||e.inputMode==="template"&&e.templateId!==void 0||e.inputMode==="ai"&&e.aiPrompt!==void 0||t.addIssue({code:"custom",message:"inputMode requires the matching field (record\u2192recordId, soql\u2192soqlQuery, template\u2192templateId, ai\u2192aiPrompt, org\u2192none, with the depth all)",path:["inputMode"]})}),Gs=g({objectApiName:i().regex(q,"Invalid SObject API name"),label:i().max(255).optional(),recordCount:c().int().nonnegative(),recordCountUnknown:y().optional(),recordCountApproximate:y().optional(),fieldCount:c().int().nonnegative(),status:Ts,progress:c().min(0).max(100),included:y(),leftOutByUser:y().optional(),piiFields:l(i().max(80)).max(500),anonymizeFields:l(i().max(80)).max(500),level:c().int().nonnegative().max(20),successCount:c().int().nonnegative(),failureCount:c().int().nonnegative(),errors:l(i().max(2e3)).max(50),createableFieldCount:c().int().nonnegative(),estimatedSizeMB:c().nonnegative(),estimatedApiCalls:c().int().nonnegative(),batchStrategy:ks}),Ws=g({sourceObject:i().regex(q,"Invalid SObject API name"),targetObject:i().regex(q,"Invalid SObject API name"),relationshipName:i().min(1).max(80),type:ws,required:y().optional(),settable:y().optional(),insertOnly:y().optional()}),Hs=h(["missingInTarget","notQueryable","empty","unreadable","notWritable","createOnly","setup","platformCreated","metadata","chatter","history","sharing","changeEvent","unsupportedKind","customSetting","files","excludedByUser","notDescribed"]),Ks=g({objectApiName:i().regex(q,"Invalid SObject API name"),reason:Hs,detail:i().max(2e3).optional()}),Vs=5e4,qs=g({nodes:l(Gs).max(2e3),edges:l(Ws).max(2e4),totalRecords:c().int().nonnegative(),estimatedSizeMB:c().nonnegative(),estimatedDurationSeconds:c().nonnegative(),truncated:y().optional(),leftOut:l(Ks).max(Vs).optional(),withoutEdges:S(!0).optional()}),en=Ae(Is,Ne),Ig=g({maxFileSizeMB:c().int().min(1).max(35),acceptedAsIs:y()}),Zs=g({presetId:i().min(1).max(100).optional(),rules:en,fields:l(g({objectApiName:i().regex(q,"Invalid SObject API name"),fieldNames:l(i().regex(dt,"Invalid field name")).max(500)})).max(2e3).optional()}),vg=g({id:i().min(1),name:i().min(1),description:i(),config:Us.omit({sourceOrgId:!0,targetOrgId:!0}),targetOrgId:i().min(1).max(128).optional(),anonymization:Zs.optional(),files:g({maxFileSizeMB:c().int().min(1).max(35)}).optional(),objectCount:c().int().nonnegative(),recordCount:c().int().nonnegative(),createdAt:i().min(1),lastUsedAt:i().min(1)}),Ys=g({order:c().int().nonnegative(),objectApiNames:l(i()),totalRecords:c().int().nonnegative(),estimatedDurationSeconds:c().nonnegative(),estimatedApiCalls:c().int().nonnegative()}),Xs=g({objects:l(i()),strategy:vs,description:i()}),Qs=g({waves:l(Ys),totalRecords:c().int().nonnegative(),totalApiCalls:c().int().nonnegative(),estimatedDurationSeconds:c().nonnegative(),cycleResolutions:l(Xs)}),Cg=g({forgeId:i(),config:Jt,graph:qs,plan:Qs,currentWaveIndex:c().int().nonnegative(),currentObjectIndex:c().int().nonnegative(),currentBatchIndex:c().int().nonnegative(),remapperState:w(i(),i()),completedObjects:l(i()),timestamp:i()});var Js=g({describeGlobal:c().min(5e3).max(12e4).default(3e4),describe:c().min(5e3).max(6e4).default(15e3),crudBatch:c().min(1e4).max(3e5).default(6e4),bulkJob:c().min(6e4).max(6e5).default(3e5)}).prefault({}),ec=g({maxRetries:c().int().min(0).max(10).default(3),initialDelay:c().min(100).max(3e4).default(1e3),maxDelay:c().min(1e3).max(12e4).default(3e4),backoffMultiplier:c().min(1).max(5).default(2)}).prefault({}),tc=g({threshold:c().int().min(1).max(1e4).default(200),pollIntervalMs:c().min(1e3).max(3e4).default(5e3),maxConcurrentJobs:c().int().min(1).max(100).default(5)}).prefault({}),nc=g({timeouts:Js,retry:ec,bulk:tc}),Pg=nc.parse({});var Re=["firstName","lastName","company","email","caseSubject"],rc=["firstName","lastName","company","email"],F={maxKeyLength:40,topics:{min:3,max:8},caseTemplates:{min:1,max:4},utterances:{min:1,max:5},outOfScope:{min:2,max:5},facts:{min:3,max:5},resolutionSteps:{min:1,max:4},maxCustomers:50,maxHistoryPerCustomer:3,text:{name:80,label:80,industry:40,businessContext:1e3,articleTitle:255,articleSummary:1e3,articleBody:8e3,fact:300,caseSubject:200,caseDescription:4e3,comment:2e3,utterance:1e3}},Fg={seed:1,historyPerCustomer:2,caseStatus:{open:"New",closed:"Closed"}},oc=/\{([A-Za-z][A-Za-z0-9_]*)\}/g;function ic(e){return[...new Set([...e.matchAll(oc)].map(t=>t[1]))]}function ac(e){return Re.includes(e)}function $(e,t=[]){return i().max(e).regex(/\S/,"A text of the pack says something: it is empty or blank").superRefine((n,o)=>{for(let a of ic(n))if(!t.includes(a))if(t.length===0){if(!ac(a))continue;o.addIssue({code:"custom",message:`{${a}} is not filled in this text, and would be written as it stands`})}else o.addIssue({code:"custom",message:`{${a}} is not a placeholder of this text, which can name `+t.map(s=>`{${s}}`).join(", ")})})}var je=i().min(2).max(F.maxKeyLength).regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,"A key is lower-case letters and digits in words joined by single hyphens, starting with a letter");function ut(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function sc(e,t){return ut(e).includes(ut(t))}var{text:B}=F,mt=u({title:$(B.articleTitle),summary:$(B.articleSummary),body:$(B.articleBody),facts:l($(B.fact)).min(F.facts.min).max(F.facts.max)}).superRefine((e,t)=>{for(let[n,o]of e.facts.entries())sc(e.body,o)||t.addIssue({code:"custom",path:["facts",n],message:`The fact "${o}" is not stated by the article's body word for word: an agent answering from the article can only cite what its body says`})}),cc=u({title:$(B.articleTitle),summary:$(B.articleSummary),body:$(B.articleBody),resembles:je}),dc=u({subject:$(B.caseSubject,rc),description:$(B.caseDescription,Re),priority:h(["High","Medium","Low"]),origin:h(["Phone","Email","Web"]),followUp:$(B.comment,Re),resolution:l($(B.comment,Re)).min(F.resolutionSteps.min).max(F.resolutionSteps.max)}),lc=u({text:$(B.utterance,Re),expectedOutcome:$(B.utterance,Re)}),pc=u({text:$(B.utterance),expectedOutcome:$(B.utterance)}),Fe=u({key:je,label:$(B.label),article:mt,caseTemplates:l(dc).min(F.caseTemplates.min).max(F.caseTemplates.max),utterances:l(lc).min(F.utterances.min).max(F.utterances.max)}),uc=u({count:c().int().min(1).max(F.maxCustomers),industry:$(B.industry)});function mc(e,t){let n=(d,p)=>t.addIssue({code:"custom",path:d,message:p}),o=e.topics.map(d=>d.key);for(let[d,p]of o.entries())o.indexOf(p)!==d&&n(["topics",d,"key"],`The topic "${p}" is named twice: each topic is named once`);o.includes(e.decoy.resembles)||n(["decoy","resembles"],`The decoy resembles the topic "${e.decoy.resembles}", which the pack does not have: its topics are ${o.map(d=>`"${d}"`).join(", ")}`);let a=new Map,s=[...e.topics.map((d,p)=>({title:d.article.title,path:["topics",p,"article","title"],of:`the article of "${d.key}"`})),{title:e.decoy.title,path:["decoy","title"],of:"the decoy"}];for(let{title:d,path:p,of:m}of s){let f=a.get(ut(d));f!==void 0?n(p,`"${d}" is the title of ${f} too: each article has a title of its own`):a.set(ut(d),m)}e.customers.count<e.topics.length&&n(["customers","count"],`${e.customers.count} customer(s) for ${e.topics.length} topics: each topic's utterances are said about a customer's open case on it, so a pack has a customer a topic`)}var _r=u({version:S(1),id:je,name:$(B.name),language:i().regex(/^[a-z]{2}(?:_[A-Z]{2})?$/,"A language as Salesforce writes one: en_US, fr, pt_BR"),businessContext:$(B.businessContext),customers:uc,topics:l(Fe).min(F.topics.min).max(F.topics.max),decoy:cc,outOfScope:l(pc).min(F.outOfScope.min).max(F.outOfScope.max)}).superRefine(mc),fc=i().max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/,"A field API name: letters, digits and underscores"),gc=["Title","UrlName","Language","IsVisibleInPkb","IsVisibleInCsp","IsVisibleInPrm"],zr=i().min(1).max(255),Lg=u({seed:c().int().min(0).max(2**32-1).optional(),customers:c().int().min(1).max(F.maxCustomers).optional(),historyPerCustomer:c().int().min(0).max(F.maxHistoryPerCustomer).optional(),caseStatus:u({open:zr,closed:zr}).refine(e=>e.open!==e.closed,{message:"An open case and a closed one are written with two statuses",path:["closed"]}).optional(),articleBodyField:fc.refine(e=>!gc.includes(e),{message:"The article is written with this field already: its body goes to a field of its own, or to Summary"}).optional(),articleBodyLength:c().int().min(1).max(131072).optional(),articleBodyHtml:y().optional()});var hc=/```(?:json)?([\s\S]*?)```/;function Ug(e,t){let n=e.safeParse(yc(t));if(!n.success)throw new Error("The AI reply is JSON, but not in the expected format.");return n.data}function yc(e){let t=e.trim(),n=hc.exec(t),o=n?n[1].trim():t;try{return JSON.parse(o)}catch{throw new Error("The AI reply is not valid JSON.")}}function ze(e){return l(ee()).transform(t=>t.flatMap(n=>{let o=e.safeParse(n);return o.success?[o.data]:[]}))}var ft=w(i(),ee()),bc=g({name:i(),type:i(),config:ft.catch({}),description:i().catch("")}),$g=g({name:i().optional().catch(void 0),description:i().optional().catch(void 0),steps:ze(bc).catch([]),schedule:i().optional().catch(void 0),triggers:ze(i()).optional().catch(void 0)}),Bg=g({soql:i().catch(""),explanation:i().catch(""),confidence:c().catch(0),alternatives:ze(i()).optional().catch(void 0)}),Gg=g({name:i().catch("Custom Persona"),description:i().catch(""),industry:i().catch("General"),locale:i().catch("en-US"),dataPatterns:ft.catch({})}),xc=g({title:i().catch("Unknown"),description:i().catch(""),probability:c().catch(.5),action:i().optional().catch(void 0)}),Wg=g({explanation:i().catch("Unable to determine root cause."),suggestions:ze(xc).catch([]),autoFixable:y().catch(!1),autoFixAction:i().optional().catch(void 0),confidence:c().catch(.5),relatedDocs:ze(i()).catch([])}),Hg=v([ze(ft),ft.transform(e=>[e]),ee().transform(()=>[])]),Kg={text:8e3,picklistValues:1e3,picklistValue:255,agentTopics:100,agentActions:100,agentName:255,agentLabel:255,agentDescription:4e3},Or=Fe.pick({key:!0,label:!0,utterances:!0});function Tr(e,t){let n=(a,s)=>t.addIssue({code:"custom",path:a,message:s}),o=e.topics.map(a=>a.key);for(let[a,s]of o.entries())o.indexOf(s)!==a&&n(["topics",a,"key"],`The topic "${s}" is named twice: each topic is named once`);o.includes(e.decoy.resembles)||n(["decoy","resembles"],`The decoy resembles the topic "${e.decoy.resembles}", which the plan does not have: its topics are ${o.map(a=>`"${a}"`).join(", ")}`),e.customers.count<e.topics.length&&n(["customers","count"],`${e.customers.count} customer(s) for ${e.topics.length} topics: each topic's utterances are said about a customer's open case on it, so a pack has a customer a topic`)}var X=_r.shape,Vg=u({id:X.id,name:X.name,businessContext:X.businessContext,customers:X.customers,topics:l(Or).min(F.topics.min).max(F.topics.max),decoy:X.decoy,outOfScope:X.outOfScope}).superRefine(Tr),qg=u({article:mt,caseTemplates:Fe.shape.caseTemplates});var Sc=Or.extend({article:mt.optional(),caseTemplates:Fe.shape.caseTemplates.optional()}),Zg=u({version:X.version,id:X.id,name:X.name,language:X.language,businessContext:X.businessContext,customers:X.customers,topics:l(Sc).min(F.topics.min).max(F.topics.max),decoy:X.decoy,outOfScope:X.outOfScope}).superRefine(Tr);function rn(e){return i().regex(new RegExp(`^${e}-\\d{8}-\\d{6}-[a-z0-9]{4}$`),`Expected an id shaped ${e}-YYYYMMDD-HHMMSS-xxxx`)}var Z=rn("ck"),Xg=rn("pv"),on=rn("rw"),L=i().regex(/^00D[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,"Not an Organization Id"),Le=i().regex(/^005[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,"Not a User Id"),Y=i().regex(/^[A-Za-z][A-Za-z0-9_]*$/,"Not a Salesforce API name").max(80),Ec=i().regex(/^[A-Za-z][A-Za-z0-9_]*\.[A-Za-z][A-Za-z0-9_]*$/,"Expected an Object.Field name").max(161),De=l(Ec).max(1e3).refine(e=>new Set(e).size===e.length,"A field is listed twice"),gt=i().trim().min(1).max(120).refine(e=>!new RegExp("\\p{Cc}","u").test(e),"A checkpoint name is one line of text"),Q=de.datetime({offset:!0}),N=c().int().nonnegative(),Ac=i().regex(/^[0-9a-f]{64}$/,"Expected a sha256, hex"),an=i().regex(/^\d{1,4}\.\d{1,4}\.\d{1,6}(?:-[0-9A-Za-z.-]{1,40})?$/,"Not a SandForge version"),kr=h(["sandbox","scratch","developer"]),ht=h(["everything","picked"]),Rc=h(["query","scanAllLive"]),zc=h(["fls","encrypted","base64","compound"]),Ir=h(["excludedByUser","notFound","chatter","history","sharing","changeEvent","unsupportedKind","customSetting","notCustomSetting","files","heldWithFiles","setup","platformCreated","metadata","notWritable","notDescribed","noSystemModstamp","noRecycleBin","unreadable","pastTheLimit","noViewAll","noModifyAll","activities","catalog","filesNotProven","settingNotProven","parentNotSeen"]),Qg={code:h(["createdByAutomation","files","attachments","heldUnasked",...Ir.options]).optional(),detail:i().max(500).optional(),records:c().int().nonnegative().optional(),limit:c().int().nonnegative().optional(),creators:l(g({kind:h(["flow","process","workflowRule","trigger"]),name:i().max(500),objectApiName:i().max(255),write:h(["insert","update","delete","undelete"])})).max(10).optional(),moreCreators:c().int().nonnegative().optional()},_c=h(["taking","ready","failed"]),Oc=h(["hierarchy","list"]),Tc=h(["org","object","parent"]),wc=g({objectApiName:Y,records:N,inBin:N,readOrder:N,readMode:Rc,undeletable:y(),cascadeParents:l(Y).max(1e3),restrictParents:l(Y).max(1e3).optional(),fingerprint:i().regex(/^[0-9a-f]{64}$/,"Expected a sha256, hex"),fields:l(Y).max(5e3),leftOutFields:l(g({field:Y,reason:zc})).max(5e3),customSetting:Oc.optional(),access:Tc.optional()}),kc=g({documents:N,links:N,anchored:N,readByIds:l(Y).min(1).max(1e4).optional()}).refine(e=>e.anchored<=e.documents,{path:["anchored"],message:"More files anchored than held"}),Ic=g({module:h(["forge","sync","seed","autopilot","frozen","empty","replay"]),operationId:i().min(1).max(200),tool:h(["panel","cli"])});function tn(e,t){return i().regex(new RegExp(`^${e}[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$`),`Not ${t}`)}var vr=h(["recordTypes","users","queues","standardPricebook"]),nn=i().regex(/^[A-Za-z][A-Za-z0-9_]*$/,"Not a developer name").max(80),Jg=g({version:S(1),organizationId:L,recordTypes:l(g({id:tn("012","a record type Id"),sobjectType:Y,developerName:nn,namespacePrefix:nn.max(15).optional(),name:i().min(1).max(255),isActive:y(),isPersonType:y().optional()})).max(1e5),users:l(g({id:Le,username:i().min(1).max(255),name:i().max(255),isActive:y(),userType:i().min(1).max(80)})).max(1e6),queues:l(g({id:tn("00G","a queue Id"),developerName:nn,name:i().max(255),sobjectTypes:l(Y).max(1e4)})).max(1e5),standardPricebookId:tn("01s","a price book Id").optional(),unread:l(g({part:vr,reason:i().min(1).max(500)})).max(4)}),vc=g({recordTypes:N,users:N,queues:N,standardPricebook:y(),unread:l(vr).min(1).max(4).optional()}),eh=g({version:S(1),checkpointId:Z,name:gt,org:g({organizationId:L,alias:i().min(1).max(255).optional(),username:i().min(1).max(255),instanceUrl:cr(),isSandbox:y(),organizationType:i().min(1).max(120),tier:kr,scratchExpiresAt:v([de.date(),Q]).optional(),dataStorageMaxMB:N.optional(),staging:S(!0).optional()}),takenBy:g({userId:Le,automatedProcessUserId:Le.optional(),viewAllData:y(),modifyAllData:y(),queryAllFiles:y().optional()}),readFrom:Q,takenAt:Q,scope:g({mode:ht,leftOut:l(g({objectApiName:Y,code:Ir.optional(),reason:i().min(1).max(500),detail:i().max(500).optional(),records:N.optional(),limit:N.optional()})).max(1e4)}),objects:l(wc).max(1e4).refine(e=>new Set(e.map(t=>t.objectApiName)).size===e.length,"An object is in the checkpoint twice"),ignoredFields:De,snapshotId:i().min(1).max(200),movedWhileTaken:g({changed:N,deleted:N,created:N}),bytes:N,expiresAt:Q.nullable(),status:_c,takenOn:g({host:i().min(1).max(255),pid:N}),lastRewind:g({rewindId:on,endedAt:Q.optional(),undoUntil:Q.optional(),undoneAt:Q.optional()}).optional(),files:kc.optional(),importedFrom:g({at:Q,sandforgeVersion:an,sha256:Ac}).optional(),beforeRun:Ic.optional(),replayAnnex:vc.optional()}).refine(e=>Date.parse(e.readFrom)<=Date.parse(e.takenAt),{path:["takenAt"],message:"A checkpoint ends after it begins"}).refine(({takenBy:e,objects:t})=>e.viewAllData&&e.modifyAllData||t.every(n=>n.access==="object"||n.access==="parent"),{path:["objects"],message:"A checkpoint taken without View All Data and Modify All Data says, of each object, how its user held it whole"}),th=g({format:S("sandforge-checkpoint"),formatVersion:c().int().positive().max(1e6),checkpointFormat:c().int().positive().max(1e6),sandforgeVersion:an}).loose(),nh=g({format:S("sandforge-checkpoint"),formatVersion:v([S(1),S(2)]),checkpointFormat:S(1),sandforgeVersion:an,organizationId:L,orgTier:kr,dataStorageMaxMB:N.optional(),staging:S(!0).optional(),checkpointId:Z,takenAt:Q,records:N,objects:N,files:N,bytes:N,cipher:S("aes-256-gcm"),kdf:S("hkdf-sha256"),salt:i().regex(/^[0-9a-f]{64}$/,"Expected 32 bytes, hex"),noncePrefix:i().regex(/^[0-9a-f]{16}$/,"Expected 8 bytes, hex"),keyCheck:i().regex(/^[0-9a-f]{32}$/,"Expected 16 bytes, hex"),chunkBytes:c().int().min(4096).max(16*1024*1024)}),rh=u({owners:h(["same","me"]),ownerMap:w(Le,Le).refine(e=>Object.keys(e).length<=1e4,"Too many users mapped").optional(),customSettings:y(),mask:y(),contactPoints:h(["neutralized","kept"]),objects:l(Y).max(1e4),excluded:l(Y).max(1e4),link:l(u({objectApiName:Y,fields:l(Y).min(1).max(10)})).max(100).refine(e=>new Set(e.map(t=>t.objectApiName)).size===e.length,"An object is linked twice"),noRealData:S(!0).optional()}),Cc=h(["success","partial","failure","unstable","cancelled"]),Nc=g({deleted:N,restored:N,undeleted:N,recreated:N}),wr=366*864e5,Pc=g({kind:S("rewind"),rewindId:on,checkpointId:Z,checkpointName:gt,organizationId:L,mode:ht,objects:l(Y).max(1e4),limitedTo:l(Y).min(1).max(1e4).optional(),readFrom:Q,takenAt:Q,startedAt:Q,endedAt:Q,orgAheadMs:c().int().min(-wr).max(wr).optional(),status:Cc,totals:Nc}),jc=g({kind:S("undo"),rewindId:on,checkpointId:Z,organizationId:L,status:h(["success","partial","unstable"]),undoneAt:Q}),oh=C("kind",[Pc,jc]);var te=200,yt=50,bt=20,xt=50,oe=i().regex(/^[^\s@]+@[^\s@]+\.[^\s@]+$/,{error:e=>`${String(e.input)} is not a username: a username is shaped like an email address, as jane.qa@acme.com, or the sandbox\u2019s jane.qa@acme.com.uat`}).max(80,{error:e=>`${String(e.input)} is not a username: Salesforce holds 80 characters at most`});function Fc(e){return e.toLowerCase()}var pn=i().regex(/^005[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,{error:"Not a User Id"}),Lc=i().regex(/^00e[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,{error:"Not a Profile Id"}),Dc=i().regex(/^0Pa[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,{error:"Not a PermissionSetAssignment Id"}),Mc=i().regex(/^011[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,{error:"Not a GroupMember Id"});function St(e){return i().regex(/^[A-Za-z][A-Za-z0-9_]*$/,{error:e}).max(80)}var Nr=St("A permission set is named by its API name, as QA_Tools (Setup > Permission Sets > API Name)"),Pr=St("A permission set group is named by its API name, as Support_Bundle"),jr=St("A group or a queue is named by its API name (DeveloperName), as QA_Team"),dn=i().min(1).max(255).refine(e=>e.trim()===e&&!new RegExp("\\p{Cc}","u").test(e),{error:"A profile is named as Setup > Profiles names it, exactly: one line, no space at its ends"}),Uc=h(["restore","keep"],{error:"email is restore, which takes off the .invalid the copy added, or keep, the address as it is"}),le=c().int().nonnegative();function sn(e,t,n,o){return l(e).max(t,{error:n}).superRefine((a,s)=>{let d=new Set;a.forEach((p,m)=>{let f=p.toLowerCase();d.has(f)&&s.addIssue({code:"custom",path:[m],message:`${p} is listed twice: name ${o} once`}),d.add(f)})})}var $e={email:Uc.optional(),active:y().optional(),frozen:y().optional(),profile:dn.optional(),permissionSets:sn(Nr,yt,`A user is given ${yt} permission sets at most in one entry`,"a permission set").optional(),permissionSetGroups:sn(Pr,bt,`A user is given ${bt} permission set groups at most in one entry`,"a permission set group").optional(),groups:sn(jr,xt,`A user joins ${xt} groups and queues at most in one entry`,"a group").optional()},un=e=>l(e).min(1,{error:"A users resource lists one user at least: username, then what to set up"}).max(te,{error:t=>`${Array.isArray(t.input)?t.input.length:"more than "+te} users: a users resource holds ${te} at most: split it in two`});function mn(e){let t=new Map,n=[];for(let o of e)o.users.forEach((a,s)=>{let d=Fc(a.username),p=t.get(d);if(p!==void 0){n.push({path:[...o.path,s,"username"],message:`${a.username} is listed twice (also ${p}): one entry per user`});return}t.set(d,`${o.at}[${s}]`)});return n}function ln(e,t){let n=Object.keys(t).join(", ");return u(t,{error:o=>{if(o.code!=="unrecognized_keys")return;let a=o.keys.map(d=>`"${d}"`).join(", "),s=o.keys.length===1?"is not a key":"are not keys";return`${a} ${s} of ${e}, which takes ${n}`}})}var $c=ln("a user",{username:oe,...$e}),Et=ln("the config",{defaults:ln("the defaults",$e).optional(),users:un($c)}).superRefine((e,t)=>{for(let{path:n,message:o}of mn([{at:"users",path:["users"],users:e.users}]))t.addIssue({code:"custom",path:n,message:o})});function sh(e){let t=e.defaults??{};return e.users.map(n=>({...t,...n}))}var cn=h(["added","removed"]),Me=C("what",[u({what:S("email"),to:S("awaiting")}),u({what:S("active"),from:y(),to:y()}),u({what:S("frozen"),from:y(),to:y()}),u({what:S("profile"),from:dn,to:dn}),u({what:S("permissionSet"),name:Nr,to:cn}),u({what:S("permissionSetGroup"),name:Pr,to:cn}),u({what:S("group"),name:jr,type:h(["Regular","Queue"]),to:cn})]),At=h(["invalid","awaiting","restored","kept"]),Ue=4+2*(yt+bt+xt),Bc=["flow","trigger","process","workflowRule"],Gc=["flows","triggers","processes","workflowRules"],Wc=200,Hc=u({kind:h(Bc),name:i().min(1).max(255),objectApiName:St("An object is named by its API name, as User"),when:h(["before","after","beforeAndAfter"])}),Kc=u({fired:l(Hc).max(Wc),unread:l(h(Gc)).min(1).max(4).optional(),notDeduced:S(!0).optional()}),fn=u({code:i().regex(/^[A-Z][A-Z_]{1,40}$/),message:i().min(1).max(4e3),username:oe.optional(),automation:Kc.optional()}),gn=u({organizationId:L,kind:h(["scratch","developer","sandbox"]),alias:i().min(1).max(255).optional(),username:i().min(1).max(255)}),hn=u({username:oe,given:oe.optional(),userId:pn.optional(),address:At.optional(),changes:l(Me).max(Ue),emailsToPeople:le.optional()}),Vc=u({name:i().min(1).max(255),total:le,used:le,toUse:le}),ch=u({org:gn,users:l(hn).max(te),licenses:l(Vc).max(100).optional(),emailsToPeople:le,apiRequests:le,refusals:l(fn).max(te+20).optional()}),Cr=u({permissionSetAssignments:l(Dc).max(yt+bt),groupMembers:l(Mc).max(xt)}),qc=u({username:oe,userId:pn,before:u({isActive:y(),isFrozen:y(),profileId:Lc}),done:l(Me).max(Ue),created:Cr,found:Cr.optional(),address:At.optional(),refused:l(u({change:Me,code:i().min(1).max(64),message:i().min(1).max(4e3)})).max(Ue).optional()}).superRefine((e,t)=>{let n=new Set([...e.found?.permissionSetAssignments??[],...e.found?.groupMembers??[]]);for(let o of[...e.created.permissionSetAssignments,...e.created.groupMembers])n.has(o)&&t.addIssue({code:"custom",path:["created"],message:`${o} is both created and found there before: an id is one or the other`})}),Fr=h(["success","partial","failure","cancelled"]),dh=u({org:gn,run:c().int().positive().max(999999),status:Fr,users:l(qc).max(te),emailsToPeople:le,apiRequests:le,refusals:l(fn).max(te+20).optional()}),Zc=u({username:oe,userId:pn,undone:l(Me).max(Ue),kept:l(u({change:Me,why:i().min(1).max(2e3)})).max(Ue).optional()}),lh=u({org:gn,run:c().int().positive().max(999999),status:Fr,users:l(Zc).max(te),apiRequests:le,refusals:l(fn).max(te+20).optional()});var yn=["fake","mask","hash","nullify","shuffle","preserve_format","constant","truncate"];function Yc(e){return yn.includes(e)}var Lr=/^[A-Za-z][A-Za-z0-9_]*\.[A-Za-z][A-Za-z0-9_]*$/,Xc=80,bn=200,ae=255,Qc={fake:[],mask:["maskKeepLast"],hash:[],nullify:[],shuffle:[],preserve_format:[],constant:["constantValue"],truncate:["truncateLength","truncateKeep"]};function Dr(e,t){if(Object.entries(t??{}).filter(([,o])=>o!==void 0).map(([o])=>o).some(o=>!Qc[e].includes(o)))return"settingNotTaken";if(e==="constant"){let o=t?.constantValue;if(o===void 0||o.trim()===""||o.length>ae)return"constantValueMissing"}if(e==="mask"&&t?.maskKeepLast!==void 0){let o=t.maskKeepLast;if(!Number.isInteger(o)||o<0||o>ae)return"maskKeepLastInvalid"}if(e==="truncate"){let o=t?.truncateLength;if(o===void 0||!Number.isInteger(o)||o<1||o>ae)return"truncateLengthMissing"}}var Jc={constantValueMissing:`A Constant rule needs the value it writes, 1 to ${ae} characters`,truncateLengthMissing:`A Truncate rule needs how many characters it keeps, 1 to ${ae}`,maskKeepLastInvalid:`A Mask rule keeps a whole number of characters at the end, 0 to ${ae}`,settingNotTaken:"The rule carries a setting its method does not take"},Be=g({fieldPattern:i().max(170).regex(Lr,"Expected Object.Field"),ruleType:h(yn),config:u({constantValue:i().max(ae).optional(),maskKeepLast:c().int().min(0).max(ae).optional(),truncateLength:c().int().min(1).max(ae).optional(),truncateKeep:h(["first","last"]).optional()}).optional()}).superRefine((e,t)=>{let n=Dr(e.ruleType,e.config);n!==void 0&&t.addIssue({code:"custom",path:["config"],message:Jc[n]})});var ed=[{name:"password",words:["password"]},{name:"passwd",words:["passwd"]},{name:"secret",words:["secret"]},{name:"token",words:["token"]},{name:"accessToken",words:["access","token"]},{name:"refreshToken",words:["refresh","token"]},{name:"sfdxAuthUrl",words:["sfdx","auth","url"]},{name:"authUrl",words:["auth","url"]},{name:"privateKey",words:["private","key"]},{name:"clientSecret",words:["client","secret"]},{name:"salt",words:["salt"]},{name:"apiKey",words:["api","key"]}];function td(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 Mr(e,t){return e===t||e===`${t}s`}function Sn(e){let t=td(e);for(let n of ed){let o=n.words.join("");if(t.some(s=>Mr(s,o)))return n.name;let a=n.words.length-1;for(let s=0;s+a<t.length;s+=1)if(n.words.every((p,m)=>m===a?Mr(t[s+m]??"",p):t[s+m]===p))return n.name}}var I=i().regex(/^[a-z][a-z0-9-]{0,62}$/,{error:"A name is lower-case letters, digits and dashes, starting with a letter, 63 characters at most"}),xn=I.refine(e=>Sn(e)===void 0,{error:e=>`"${String(e.input)}" is shaped like a secret (${Sn(String(e.input))}): the file holds no secret, so name it otherwise`}),G=i().regex(/^[A-Za-z][A-Za-z0-9_]*$/,{error:"Not a Salesforce API name"}).max(80),Hr=i().regex(/^[A-Za-z][A-Za-z0-9_]*\.[A-Za-z][A-Za-z0-9_]*$/,{error:"A lookup is named with its object, as Contact.AccountId"}).max(161),Rn=i().regex(/^[0-9a-f]{64}$/,{error:"Expected a sha256, hex"}),J=de.datetime({offset:!0}),A=c().int().nonnegative();function z(e,t,n={}){let o=Object.keys(t).join(", ");return u(t,{error:a=>{if(a.code==="unrecognized_keys"){let s=a.keys.map(m=>`"${m}"`).join(", "),d=a.keys.length===1?"is not a key":"are not keys",p=a.keys.map(m=>n[m]).find(m=>m!==void 0);return`${s} ${d} of ${e}, which takes ${o}${p===void 0?"":`: ${p}`}`}if(a.code==="invalid_type")return a.input===void 0?`${e} is missing`:`${e} is a mapping of keys, not ${Array.isArray(a.input)?"a list":`a ${typeof a.input}`}`}})}var zn=z("a variable",{env:i().regex(/^[A-Z_][A-Z0-9_]{0,127}$/,{error:"A variable is named in upper-case letters, digits and underscores, as SF_UAT_ALIAS"})}),Ah=["orgs.<role>.alias","resources.<frozen>.dataset.path","resources.<replay>.checkpoint.file"];function Rh(e){return e.length===3&&e[0]==="orgs"&&e[2]==="alias"?!0:e.length!==4||e[0]!=="resources"?!1:e[2]==="dataset"&&e[3]==="path"||e[2]==="checkpoint"&&e[3]==="file"}var nd=v([i().regex(/^[^-\s][^\s]{0,199}$/,{error:'An alias holds no space and does not start with "-"'}),zn],{error:"An alias is a word of the sf CLI, or { env: NAME } naming the variable that holds it"}),ge=h(["scratch","developer","sandbox"]),Kr=/^[a-z0-9-]+--[a-z0-9]+$/;function rd(e){let t=e.split(".")[0]?.toLowerCase()??"";if(e.includes(".")){let n=t.includes("--")?t:`${t}--uat`;return`${e} is a host: give the sandbox's My Domain alone, the part before .sandbox.my.salesforce.com, as ${n}`}return/^[a-z0-9-]+$/.test(e)&&!e.includes("--")?`${e} is production's My Domain: a sandbox's is ${e}--<its name>, as ${e}--uat`:"A sandbox's My Domain is lower-case letters, digits and dashes, then -- and the sandbox's name, as acme--uat"}var od=z("a My Domain",{myDomain:i().max(80).regex(Kr,{error:e=>rd(String(e.input))})}),Ur=v([i().regex(/^00D[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,{error:e=>{let t=String(e.input),n=Kr.test(t)?t:"acme--uat";return`${t} is no Organization Id: list an org by its Id (00D\u2026, 15 or 18 characters), or a sandbox by its My Domain, as { myDomain: ${n} }`}}),od],{error:"An org is listed by its Organization Id (00D\u2026), or a sandbox by its My Domain, as { myDomain: acme--uat }"}),id=z("targets",{kinds:l(ge).min(1).max(3).default(["scratch","developer"]),sandboxes:l(Ur).max(50).default([]),protect:l(Ur).max(50).default([])}).superRefine((e,t)=>{new Set(e.kinds).size!==e.kinds.length&&t.addIssue({code:"custom",path:["kinds"],message:"A kind of org is listed twice"}),e.sandboxes.length>0&&!e.kinds.includes("sandbox")&&t.addIssue({code:"custom",path:["sandboxes"],message:"targets.sandboxes lists sandboxes and targets.kinds does not allow sandbox: add sandbox to the kinds, or empty the list"})}),ad=z("an org role",{alias:nd}),Vr=1e6,sd=z("checkpoint",{before:y().optional(),after:v([S(!1),I]).optional(),ignoreFields:De.optional(),maxTotal:c().int().positive().max(Vr).optional(),excludeObjects:l(G).min(1).max(500).optional()}).superRefine((e,t)=>{let n=new Set;(e.excludeObjects??[]).forEach((o,a)=>{n.has(o)&&t.addIssue({code:"custom",path:["excludeObjects",a],message:`${o} is listed twice: an object is left out once`}),n.add(o)})}),cd=100,dd=z("a field rule",{...Mt.shape,config:z("a field rule\u2019s config",{...Dt.shape,referenceField:i().optional()})}),ld=z("an object of a seed resource",{object:G,count:c().int().positive().max(Ie),fields:l(dd).max(500).optional(),recordTypes:l(G).min(1).max(20).optional(),batchSize:c().int().positive().max(1e4).optional()}),pd=i().regex(/^[a-z][a-z0-9-]{0,62}(?:\.[A-Za-z][A-Za-z0-9_]*)?$/,{error:"from names a resource of the file, or a resource and the object of its records, as accounts or accounts.Account"}).max(144),ud=z("a relation\u2019s parents",{object:G.optional(),existing:z("existing parents",{where:i().min(1).max(2e3).optional(),limit:c().int().positive().max(V.maxExistingParents)}).optional(),from:pd.optional(),limit:c().int().positive().max(V.maxExistingParents).optional()}).superRefine((e,t)=>{let[,n]=e.from?.split(".")??[];e.object===void 0&&n===void 0&&t.addIssue({code:"custom",path:["object"],message:"A relation\u2019s parents name their object: object: Account, or from: <resource>.Account"}),e.object!==void 0&&n!==void 0&&n!==e.object&&t.addIssue({code:"custom",path:["from"],message:`from names ${n} records and object names ${e.object}: keep one of them`}),e.from!==void 0&&e.existing!==void 0&&t.addIssue({code:"custom",path:["existing"],message:"The parents are the records another resource created (from) or records the org holds (existing), not both: keep one"}),e.limit!==void 0&&e.from===void 0&&t.addIssue({code:"custom",path:["limit"],message:"limit goes with from: existing parents take their own, under existing"})}),md=C("mode",[z("a distribution",{mode:S("perParent"),count:c().int().positive().max(V.maxPerParent)}),z("a distribution",{mode:S("range"),min:c().int().nonnegative().max(V.maxPerParent),max:c().int().positive().max(V.maxPerParent)}),z("a distribution",{mode:S("ratio"),ratio:c().min(V.minRatio).max(V.maxPerParent)})],{error:"A distribution\u2019s mode is perParent, range or ratio"}).refine(e=>e.mode!=="range"||e.min<=e.max,{path:["min"],error:"A range of children per parent cannot start above its end"}),fd=z("a relation",{lookup:Hr,parents:ud,distribution:md}),_e={dependsOn:l(I).max(50).optional(),accept:z("accept",{automation:y().optional()}).optional()},gd=1e6,qr=c().positive().max(gd),hd=v([S("share"),z("fit",{withinMB:qr})],{error:"fit is share, or { withinMB: <MB> }"}),yd=z("a seed resource",{kind:S("seed"),..._e,template:i().min(1).max(200).optional(),objects:l(ld).min(1).max(cd).optional(),relations:l(fd).max(100).optional(),locale:i().regex(/^[a-z]{2,3}(?:_[A-Za-z0-9]{2,4}){0,2}$/,{error:"A locale is written as fr_FR"}).optional(),seed:c().int().min(0).max(2**32-1).optional(),fit:hd.optional()}).superRefine((e,t)=>{e.template===void 0&&e.objects===void 0&&t.addIssue({code:"custom",path:[],message:"A seed resource names a built-in template (template) or the objects it writes (objects): give one"}),e.template!==void 0&&e.objects!==void 0&&t.addIssue({code:"custom",path:["objects"],message:"A seed resource names a built-in template or its objects, not both: keep one"}),e.template!==void 0&&e.relations!==void 0&&t.addIssue({code:"custom",path:["relations"],message:"Relations go with objects: a built-in template brings its own"});let n=new Set;(e.objects??[]).forEach((o,a)=>{n.has(o.object)&&t.addIssue({code:"custom",path:["objects",a,"object"],message:`${o.object} is listed twice: an object is listed once, with its count`}),n.add(o.object)})}),Zr=i().regex(/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,{error:"A record id is 15 or 18 letters and digits"}),Ge=i().trim().min(1,{error:"A condition is not empty"}).max(512,{error:"A condition is 512 characters at most, as the clone takes one"}).refine(e=>!/--|\/\*|\*\/|;\s*$/.test(e)&&!e.startsWith("-"),{error:"A condition holds no comment marker (--, /*, */), ends with no ; and does not start with -"}),Yr=i().min(1).max(500).refine(e=>!/^(?:[\\/]|[A-Za-z]:)/.test(e)&&!e.split(/[\\/]/).some(t=>t===".."),{error:"A path is written from the folder of the file, never absolute and never up with .."}),$r=i().refine(e=>pt(e,!1)!==void 0,{error:"A bound is a date, as 2025-06-30, or an instant in UTC, as 2025-06-30T12:00:00Z"}),bd=z("window",{field:h(["created","modified"]),from:$r.optional(),to:$r.optional(),lastDays:c().int().min(1).max(Xt).optional()}).superRefine((e,t)=>{let n=e.from!==void 0||e.to!==void 0;!n&&e.lastDays===void 0&&t.addIssue({code:"custom",path:[],message:"A window gives from, to or both, or lastDays: the last days the roots were made in"}),n&&e.lastDays!==void 0&&t.addIssue({code:"custom",path:["lastDays"],message:"lastDays counts back from each draw, and takes no from or to: give one or the other"});let o=e.from===void 0?void 0:pt(e.from,!1),a=e.to===void 0?void 0:pt(e.to,!0);o!==void 0&&a!==void 0&&o>=a&&t.addIssue({code:"custom",path:["to"],message:"A window\u2019s from is before its to"})}),xd=v([S("share"),z("fit",{withinMB:qr.optional(),seed:c().int().min(0).max(Number.MAX_SAFE_INTEGER).optional(),draw:h(["uniform","recent","oldest"]).optional(),window:bd.optional(),where:w(G,Ge).refine(e=>Object.keys(e).length<=Pe,{error:`The roots of ${Pe} objects at most are filtered`}).optional(),strata:Qt.optional()})],{error:"fit is share, or a mapping of withinMB, seed, draw (uniform, recent or oldest), window ({ field: created or modified, from, to } or { field, lastDays }), where and strata"}),Sd=z("a record",{id:Zr.optional(),object:G.optional(),where:Ge.optional()}).superRefine((e,t)=>{let n=e.id!==void 0,o=e.object!==void 0||e.where!==void 0;n===o?t.addIssue({code:"custom",path:[],message:"A record is named by its id, or by its object and a where its source answers with exactly one row: give one of them"}):o&&(e.object===void 0||e.where===void 0)&&t.addIssue({code:"custom",path:[e.object===void 0?"object":"where"],message:"A record named by a query gives its object and its where both"})}),Ed=z("records",{object:G,where:Ge.optional(),orderBy:st.refine(e=>!e.startsWith("-"),{error:"An ORDER BY does not start with -"}).optional(),limit:c({error:e=>e.input===void 0?`records gives limit, the most records it clones, 1 to ${re}: each plan reads them again, and must read the same`:void 0}).int().min(1).max(re)}),Ad=z("a table",{object:G,where:Ge.optional()}),Rd=z("a template",{file:Yr,id:i().min(1).max(200)}),zd=z("anonymize",{presetId:i().min(1).max(100).optional(),rules:en,fields:l(z("the personal fields of an object",{objectApiName:G,fieldNames:l(G).max(500)})).max(2e3).optional()}),_d=50,Od=z("accept",{automation:y().optional(),realData:y().optional()}),Td=z("a forge resource",{kind:S("forge"),..._e,accept:Od.optional(),source:I,record:Sd.optional(),records:Ed.optional(),tables:l(Ad).min(1).max(_d).optional(),template:Rd.optional(),depth:Yt.optional(),fit:xd.optional(),customDepth:c().int().positive().max(10).optional(),maxNodes:c().int().min(10).max(500).optional(),anonymize:zd.optional(),keepContactPoints:y().optional(),maxTotal:c().int().positive().max(1e6).optional()}).superRefine((e,t)=>{if(e.depth==="all"){let a=[["record","it starts from no record"],["records","it starts from no query; a sample of it filters its roots with fit: { where }"],["tables","it starts from no table"],["template","a template holds the choices of a walk from its record or query; sandforge clone --depth all takes them from --config"],["customDepth","it walks no depth"],["maxNodes","it takes every object it can"]];for(let[d,p]of a)e[d]!==void 0&&t.addIssue({code:"custom",path:[d],message:`depth: all clones the whole org, and does not go with ${d}: ${p}`});let s=e.anonymize;s!==void 0&&(Object.keys(s.rules).length>0||s.fields!==void 0||s.presetId!==void 0)&&t.addIssue({code:"custom",path:["anonymize"],message:"depth: all anonymizes every personal field by its category\u2019s default method, the clone of the whole org taking no other: give anonymize: { rules: {} }"});return}e.fit!==void 0&&t.addIssue({code:"custom",path:["fit"],message:"fit goes with depth: all: it copies a sample of the whole org that fits the target. A clone of a record or of tables writes what it reaches"}),["record","records","tables"].filter(a=>e[a]!==void 0).length!==1&&t.addIssue({code:"custom",path:[],message:"A forge resource clones one record (record), the records a query chooses (records), whole tables (tables) or the whole org (depth: all): give one of them"});let o=new Set;(e.tables??[]).forEach((a,s)=>{o.has(a.object)&&t.addIssue({code:"custom",path:["tables",s,"object"],message:`${a.object} is listed twice: a table is listed once, with its condition`}),o.add(a.object)}),e.customDepth!==void 0&&(e.depth??"custom")!=="custom"&&t.addIssue({code:"custom",path:["customDepth"],message:`customDepth goes with depth: custom, not depth: ${e.depth??""}`})});function Xr(e){return i().min(1).max(4096).refine(t=>/^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(t),{error:e})}var wd=Xr("A dataset is named by its path from the root, as /data/claims, or by { env: NAME }: it lives outside the repository"),kd=i().regex(/^\d+\.\d+\.\d+$/,{error:"A dataset\u2019s version is the one its manifest says, as 1.4.0"}),Id=i().regex(/^sha256:[0-9a-f]{64}$/,{error:"A dataset\u2019s digest is sha256: and 64 hexadecimal digits, as sandforge frozen gives it"}),vd=z("a frozen resource",{kind:S("frozen"),..._e,config:Yr,dataset:z("a dataset",{path:v([wd,zn],{error:"A dataset is named by its path from the root, or by { env: NAME }"}),version:kd,digest:Id})}),Cd=z("a masking rule",{fieldPattern:Be.shape.fieldPattern,ruleType:Be.shape.ruleType,config:z("a masking rule\u2019s config",Be.shape.config.unwrap().shape).optional()}),Nd=z("a rule set",{rules:l(Cd).min(1,{error:"A rule set holds one rule at least"}).max(bn)}),Pd=100,jd=1e9,Fd=z("a template that ships",{template:i().regex(/^tpl-[a-z0-9-]{1,60}$/,{error:"A template that ships is named by its id, as tpl-gdpr-standard"})}),Ld=z("a mask resource",{kind:S("mask"),..._e,rules:v([I,Fd],{error:"rules names a set of the file\u2019s masking, as rules: gdpr-contacts, or a template that ships, as rules: { template: tpl-gdpr-standard }"}),object:G.optional(),where:Ge.optional(),slices:y().optional(),maxRecords:c().int({error:"maxRecords is a whole number of records"}).min(Pd).max(ur).optional(),maxRequests:c().int({error:"maxRequests is a whole number of requests"}).positive().max(jd).optional()}).superRefine((e,t)=>{e.where!==void 0&&e.object===void 0&&t.addIssue({code:"custom",path:["where"],message:"where filters the records of one object: give it with object"}),e.maxRequests!==void 0&&e.slices!==!0&&t.addIssue({code:"custom",path:["maxRequests"],message:"maxRequests bounds a masking in slices: give it with slices: true"})}),Qr="SandForge resets no password; once its owner has confirmed the address asked back, they ask Salesforce for one with Forgot your password?",Dd=z("a user of a users resource",{username:oe,...$e},{login:Qr}),Md=z("a users resource",{kind:S("users"),accept:_e.accept,defaults:z("the defaults of a users resource",$e,{login:Qr}).optional(),users:un(Dd)},{dependsOn:"a users resource is applied first, before every other, and depends on none"}),Ud=i().regex(/^ck-\d{8}-\d{6}-[a-z0-9]{4}$/,{error:e=>`${String(e.input)} is no checkpoint id (ck-YYYYMMDD-HHMMSS-xxxx, as sandforge checkpoint list gives it): a checkpoint is named so with name: ${String(e.input)}`}),$d=gt.refine(e=>!e.startsWith("-"),{error:"A checkpoint name does not start with -, which a command line reads as a flag"}),Bd=v([Xr("A checkpoint file is named by its path from the root, as /runner/work/uat.sfcheckpoint, or by { env: NAME }: it holds records, and lives outside the repository"),zn],{error:"A checkpoint file is named by its path from the root, or by { env: NAME }"}),Gd=/^[A-Z2-7]{52}$/,Wd=i({error:e=>e.input!==null&&typeof e.input=="object"?"keyEnv is the name of the variable that holds the key, as keyEnv: UAT_CHECKPOINT_KEY, not { env: \u2026 }":void 0}).regex(/^[A-Z_][A-Z0-9_]{0,127}$/,{error:"A variable is named in upper-case letters, digits and underscores, as UAT_CHECKPOINT_KEY"}).refine(e=>!Gd.test(e),{error:"this is shaped like the key itself: keyEnv names the variable that holds it, and the file holds no secret"}),Hd=z("a checkpoint",{id:Ud.optional(),name:$d.optional(),file:Bd.optional(),keyEnv:Wd.optional()}).superRefine((e,t)=>{let n=e.file!==void 0||e.keyEnv!==void 0;if([e.id!==void 0,e.name!==void 0,n].filter(Boolean).length!==1){t.addIssue({code:"custom",path:[],message:"give id, name, or file with keyEnv: one of them"});return}e.file!==void 0&&e.keyEnv===void 0&&t.addIssue({code:"custom",path:["keyEnv"],message:"a checkpoint file is read with the key the variable keyEnv names: give keyEnv, as keyEnv: UAT_CHECKPOINT_KEY"}),e.keyEnv!==void 0&&e.file===void 0&&t.addIssue({code:"custom",path:["keyEnv"],message:"keyEnv goes with file, the checkpoint file it opens"})});function Br(){return l(G).min(1).max(500).superRefine((e,t)=>{let n=new Set;e.forEach((o,a)=>{let s=o.toLowerCase();n.has(s)&&t.addIssue({code:"custom",path:[a],message:`${o} is listed twice: an object is listed once`}),n.add(s)})})}var Kd=z("a replay resource",{kind:S("replay"),..._e,checkpoint:Hd,from:I.optional(),objects:Br().optional(),excludeObjects:Br().optional(),owners:h(["same","me"],{error:"owners is same, each record keeping its owner where that user is active, or me, the user connected"}).optional(),customSettings:y().optional(),mask:y().optional(),keepContactPoints:y().optional(),maxRecords:c().int().positive().max(Vr).optional()}).superRefine((e,t)=>{e.from!==void 0&&e.checkpoint.name===void 0&&t.addIssue({code:"custom",path:["from"],message:"from goes with checkpoint: { name }: it names the org role the checkpoint of that name was taken of"})}),Vd=[],Gr="seed, forge, frozen, mask, users and replay resources",qd=C("kind",[yd,Td,vd,Ld,Md,Kd],{error:e=>{let t=e.input;if(t===null||typeof t!="object"||Array.isArray(t))return"A resource is a mapping of keys, starting with its kind: kind: seed";let n=t.kind;return n===void 0?"A resource says its kind: kind: seed":typeof n=="string"&&Vd.includes(n)?`Resources of kind ${n} come with a later SandForge: this one applies ${Gr}`:`"${String(n)}" is not a kind of resource: this SandForge applies ${Gr}`}}),Jr=/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$/,he=i().max(253).regex(Jr,{error:"Not a host name"}),Rt=50;function Wr(e,t,n,o){if(e.length>Rt){t.addIssue({code:"custom",path:[],message:o});return}let a=new Set;e.forEach((s,d)=>{let p=s.toLowerCase();a.has(p)&&t.addIssue({code:"custom",path:[d],message:`${s} is listed twice: ${n} is listed once`}),a.add(p)})}var Zd=i().max(253).regex(Jr,{error:e=>{let t=String(e.input),n=/^[a-z][a-z0-9+.-]*:\/\/([^/?#:@\s]+)/i.exec(t)?.[1]??"erp.acme.com";return`${t} is no host name: write the host alone, without https:// nor a path, as `+n.toLowerCase()}}),Yd=i().max(161).regex(/^[A-Za-z][A-Za-z0-9_]*__(?:mdt|c)\.[A-Za-z][A-Za-z0-9_]*__c$/,{error:e=>`${String(e.input)} is no field of a Custom Metadata Type (__mdt) or a Custom Setting named with it: write Object.Field, as Integration_Setting__mdt.Endpoint__c`}),_n=z("endpoints",{productionHosts:l(Zd).superRefine((e,t)=>Wr(e,t,"a host",`${Rt} hosts at most: SandForge deduces production\u2019s own from the sandbox`)).optional(),fields:l(Yd).superRefine((e,t)=>Wr(e,t,"a field",`${Rt} fields at most: the audit reads each object they are of, a request each`)).optional()}),Xd=z("audits",{schedules:y().optional(),endpoints:v([y(),_n],{error:"endpoints is true, or a mapping of productionHosts and fields"}).optional(),handoff:y().optional()}),pe=100,En=20,zh=z("the file",{version:S(1,{error:e=>e.input===void 0?"The file names no version: write version: 1 at its top":typeof e.input=="number"&&e.input>1?`This file is written for a later SandForge (version ${e.input}): this one reads version 1`:"The version of the file is 1"}),name:I,description:i().max(2e3).optional(),targets:id.prefault({}),orgs:w(xn,ad).default({}),checkpoint:sd.optional(),masking:w(xn,Nd).default({}),resources:w(xn,qd,{error:e=>e.input===void 0?"The file names no resources: write resources:":void 0}),audits:Xd.optional()}).superRefine((e,t)=>{Object.keys(e.resources).length>pe&&t.addIssue({code:"custom",path:["resources"],message:`A file holds ${pe} resources at most: split it into two environments`}),Object.keys(e.orgs).length>En&&t.addIssue({code:"custom",path:["orgs"],message:`A file names ${En} org roles at most`});let n=Object.keys(e.orgs);for(let[p,m]of Object.entries(e.resources)){let f=m.kind==="forge"?{key:"source",role:m.source}:m.kind==="replay"&&m.from!==void 0?{key:"from",role:m.from}:void 0;f===void 0||n.includes(f.role)||t.addIssue({code:"custom",path:["resources",p,f.key],message:`"${f.role}" is no org role of the file: declare it under orgs, as orgs: { ${f.role}: { alias: { env: \u2026 } } }`+(n.length>0?` (its roles are ${n.join(", ")})`:"")})}let o=Object.entries(e.resources).filter(([,p])=>p.kind==="users"),a=new Set(o.map(([p])=>p));for(let[p,m]of Object.entries(e.resources))if(m.kind!=="users"){for(let f of m.dependsOn??[])a.has(f)&&t.addIssue({code:"custom",path:["resources",p,"dependsOn"],message:`${f} is a users resource, applied first whatever the file says: take it out of dependsOn`});m.kind==="seed"&&(m.relations??[]).forEach((f,x)=>{let b=f.parents.from?.split(".")[0];b===void 0||!a.has(b)||t.addIssue({code:"custom",path:["resources",p,"relations",x,"parents","from"],message:`${b} is a users resource: it creates no record to draw parents from`})})}for(let{path:p,message:m}of mn(o.map(([f,x])=>({at:`resources.${f}.users`,path:["resources",f,"users"],users:x.kind==="users"?x.users:[]}))))t.addIssue({code:"custom",path:p,message:m});let s=Object.keys(e.masking);for(let[p,m]of Object.entries(e.resources))m.kind!=="mask"||typeof m.rules!="string"||s.includes(m.rules)||t.addIssue({code:"custom",path:["resources",p,"rules"],message:`"${m.rules}" is no rule set of the file: declare it under masking, as masking: { ${m.rules}: { rules: [ \u2026 ] } }`+(s.length>0?` (its sets are ${s.join(", ")})`:"")});let d=Object.entries(e.resources).filter(([,p])=>p.kind==="mask");e.checkpoint?.before===!0&&d.length>0&&t.addIssue({code:"custom",path:["checkpoint","before"],message:`A checkpoint before the first write holds, in clear, the values the mask resources (${d.map(([p])=>p).join(", ")}) write over, and destroy --rewind would put them back into the org: a file with a mask resource takes none. Take checkpoint.before out`})}),Qd=64;function eo(e,t){let n=new Set,o=(a,s)=>{if(a===null||typeof a!="object"||n.has(a)||s.length>Qd)return;if(n.add(a),Array.isArray(a)){a.forEach((p,m)=>o(p,[...s,m]));return}let d=a;t(d,s);for(let[p,m]of Object.entries(d))o(m,[...s,p])};o(e,[])}function _h(e){let t=[];return eo(e,(n,o)=>{for(let a of Object.keys(n)){let s=Sn(a);s!==void 0&&t.push({path:[...o,a],key:a,secret:s})}}),t}function Oh(e){let t=[];return eo(e,(n,o)=>{let a=Object.keys(n);a.length===1&&a[0]==="env"&&t.push({path:o,name:n.env})}),t}var We=h(["seed","forge","frozen","mask","users","replay"]),to=h(["sandforge-seed","sandforge-clone","sandforge-frozen","sandforge-dataops","sandforge-users","sandforge-checkpoint"]),He=h(["applying","applied","partial","failed","destroying","destroyed"]),no=i().regex(/^runs\/[a-z][a-z0-9-]{0,62}\/[1-9][0-9]{0,5}\.summary\.json$/,{error:"Expected runs/<resource>/<n>.summary.json"}),Jd=i().regex(/^frozen\/[a-z][a-z0-9-]{0,62}$/,{error:"Expected frozen/<resource>"}),el=u({objectApiName:G,created:A,refused:A,masked:A.optional()}),tl=u({n:c().int().positive().max(999999),script:to,runId:i().min(1).max(200).optional(),summary:no.optional(),sas:Jd.optional(),snapshotId:i().min(1).max(200).optional(),seed:c().int().min(0).max(2**32-1).optional(),startedAt:J,endedAt:J.optional(),exitCode:c().int().min(0).max(255).optional(),objects:l(el).max(1e3),takenBack:S(!0).optional()}),Th="0".repeat(64),nl=u({kind:We,fingerprint:Rn,dependsOn:l(I).max(50),status:He,runs:l(tl).max(1e3),recovered:S(!0).optional()}).refine(e=>e.runs.every((t,n)=>n===0||t.n>(e.runs[n-1]?.n??0)),{path:["runs"],error:"Runs are kept in the order they ran"}),wh=u({version:S(1),env:I,lineage:ye(),serial:A,sandforgeVersion:i().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,{error:"Expected a version, as 1.68.0"}),updatedAt:J,org:u({organizationId:L,kind:ge,username:i().min(1).max(255),alias:i().min(1).max(255).optional(),host:he.optional()}),file:u({digest:Rn}),checkpoints:u({before:Z.optional(),after:Z.optional()}).optional(),resources:w(I,nl)}),ro=h(["create","keep","replace","delete","drifted","blocked"]),oo=h(["SingleEmail","DailyWorkflowEmails"]),rl=u({object:G,wouldCreate:A.optional(),atMost:S(!0).optional(),present:A.optional(),gone:A.optional(),changed:A.optional()}),ol=u({apiRequests:A.optional(),storageBytes:A.optional(),emails:l(u({limit:oo,emails:A})).optional(),emailsToPeople:A.optional()}),il=u({lookup:Hr,from:I,object:G,parents:A.optional()}),On=l(i().min(1).max(64)).min(1).max(50),al=u({resource:I,kind:We,action:ro,why:i().min(1).max(4e3),objects:l(rl).max(1e3),draws:l(il).max(100).optional(),gates:ol.optional(),refusal:i().min(1).max(2e3).optional(),refusalCodes:On.optional(),notes:l(i().min(1).max(2e3)).max(20).optional(),users:l(hn).max(te).optional()}),io=h(["before","after"]),sl=u({code:i().min(1).max(64),message:i().min(1).max(4e3)}),cl=u({step:io,name:i().min(1).max(255),estimate:u({records:A,apiRequests:A,seconds:c().nonnegative(),bytes:A}).optional(),refusal:sl.optional(),unread:i().min(1).max(4e3).optional()}),dl=u({checkpoint:Z,differs:y(),toDelete:A.optional(),toGiveBack:A.optional(),toBringBack:A.optional(),unread:i().min(1).max(4e3).optional()}),ll=u({apiRequests:u({estimate:A,leftToday:c().int().optional(),partial:y(),notCounted:l(i().min(1).max(2e3)).max(pe*2).optional(),unread:i().min(1).max(2e3).optional()}),storage:u({bytes:A,left:c().int().optional(),unread:i().min(1).max(2e3).optional()}),emails:l(u({limit:oo,emails:A,left:c().int().optional()})),emailsToPeople:u({count:A,accepted:y()}).optional()}),pl=u({organizationId:L,serial:A,updatedAt:J,setAside:i().min(1).max(4096)}),ao=u({env:I,org:u({organizationId:L,kind:ge,alias:i().min(1).max(255).optional(),host:he.optional()}),state:u({found:y(),serial:A.optional(),refreshed:pl.optional()}),actions:l(al).max(pe*2),totals:u({create:A,keep:A,replace:A,delete:A,drifted:A,blocked:A}),gates:ll,checkpoints:l(cl).max(2).optional(),drift:dl.optional(),refusal:i().min(1).max(2e3).optional(),refusalCodes:On.optional(),quick:S(!0).optional(),warnings:l(i().min(1).max(2e3)).max(50).optional()}),ul=h(["run","remove"]),ml=u({object:G,created:A,refused:A,deleted:A,kept:A,masked:A.optional(),reason:i().min(1).max(2e3).optional()}),fl=u({resource:I,action:ro,phase:ul,run:c().int().positive().max(999999),script:to,exitCode:c().int().min(0).max(255),status:He,summary:no.optional(),objects:l(ml).max(1e3),answer:ee().optional(),refusal:i().min(1).max(4e3).optional()}),so=u({step:h(["before","after","delete"]),checkpoint:Z.optional(),exitCode:c().int().min(0).max(255),refusal:i().min(1).max(4e3).optional(),answer:ee().optional()}),Tn=i().min(1).max(2e3),gl=i().max(2048).regex(/^[a-z][a-z0-9+.-]*:\/\/[^\s/?#@]+(?:\/[^\s?#]*)?$/,{error:"A URL is named by its scheme, its host and its path alone: no query, no credentials"}),hl=u({read:h(["open","closed"]).optional(),unread:Tn.optional()}),yl=u({status:h(["gone","frozen","inactive","new"]),name:i().min(1).max(255),type:i().min(1).max(80),cronExpression:i().min(1).max(255).optional(),owner:i().min(1).max(255).optional(),nextFireTime:J.optional()}),bl=u({now:A,against:u({savedAt:J,organizationId:L,refreshed:y()}).optional(),jobs:l(yl).max(1e4),kept:A,saved:i().min(1).max(4096).optional(),unread:Tn.optional()}),xl=u({source:h(["namedCredential","remoteSite","field"]),name:i().min(1).max(400),url:gl,host:he,why:h(["listed","myDomain","lightning","site","login"])}),Sl=u({productionHosts:l(he).max(Rt+10),found:l(xl).max(1e4),notDeduced:i().min(1).max(2e3).optional(),unread:Tn.optional()}),El=u({org:u({organizationId:L,kind:ge,alias:i().min(1).max(255).optional(),host:he.optional()}),at:J,apiRequests:A,deliverability:hl.optional(),schedules:bl.optional(),endpoints:Sl.optional(),findings:A}),kh=u({plan:ao,steps:l(fl).max(pe*4),checkpoints:l(so).max(10).optional(),skipped:l(u({resource:I,why:i().min(1).max(2e3)})).max(pe*2).optional(),status:h(["success","partial","failure","cancelled"]),refusal:i().min(1).max(4e3).optional(),refusalCodes:On.optional(),state:u({serial:A}),audits:El.optional(),handoff:u({path:i().min(1).max(4096)}).optional()}),Al=v([u({offered:S(!0),until:J,line:i().min(1).max(2e3)}),u({offered:S(!1),why:i().min(1).max(2e3)})]),Ih=u({env:I,org:u({organizationId:L,kind:ge,alias:i().min(1).max(255).optional()}),verb:h(["reset","destroy"]),checkpoint:u({step:io,id:Z,name:i().min(1).max(255).optional(),takenAt:J.optional()}),preview:u({toDelete:A,toGiveBack:A,toBringBack:A,lastChangedBy:w(i().min(1).max(255),A)}).optional(),exitCode:c().int().min(0).max(255),status:h(["success","partial","unstable","failure","cancelled"]),answer:ee().optional(),undo:Al,refusal:i().min(1).max(8e3).optional(),deleted:l(so).max(10).optional(),state:u({serial:A})}),An=u({path:i().max(1e3),resource:I.optional(),message:i().min(1).max(4e3)}),vh=u({refusal:u({code:i().regex(/^[A-Z][A-Z_]{1,40}$/),message:i().min(1).max(8e3),issues:l(An).max(500).optional()})}),Ch=u({file:i().min(1).max(4096),valid:y(),env:I.optional(),resources:l(u({name:I,kind:We,dependsOn:l(I).max(50),source:I.optional(),objects:l(u({object:G,count:A.optional()})).max(1e3)})).max(pe).optional(),variables:l(u({name:i().min(1).max(128),role:I.optional(),resource:I.optional(),set:y()})).max(En+pe).optional(),issues:l(An).max(500),warnings:l(An).max(500)}),Rl=u({env:I,organizationId:L,alias:i().min(1).max(255).optional(),kind:ge.optional(),serial:A.optional(),resources:w(I,He).optional(),updatedAt:J.optional(),expiresAt:J.optional(),damaged:i().min(1).max(4e3).optional()}),Nh=u({journalDir:i().min(1).max(4096),states:l(Rl).max(1e4),expired:l(u({env:I,organizationId:L,alias:i().min(1).max(255).optional(),expiresAt:J})).max(1e4)}),zl=u({kind:We,status:He,runs:l(c().int().positive().max(999999)).max(1e3),takenBack:l(c().int().positive().max(999999)).max(1e3),inFile:y()}),Ph=u({env:I,org:u({organizationId:L,kind:ge,alias:i().min(1).max(255).optional()}),state:u({serial:A,lineage:ye()}),setAside:i().min(1).max(4096).optional(),resources:w(I,zl),checkpoints:u({before:Z.optional(),after:Z.optional()}),notLinked:l(i().min(1).max(2e3)).max(20)}),_l=c().int().min(0).max(2**32-1),Ol=u({replace:l(I).max(pe),replaceDrifted:y(),acceptAutomation:y(),acceptEmails:y().optional(),acceptNoState:y(),acceptUserEmails:y().optional()}),jh=u({savedPlan:S(1),sandforgeVersion:i().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,{error:"Expected a version, as 1.69.0"}),madeAt:J,file:u({digest:Rn}),state:v([u({found:S(!1)}),u({found:S(!0),serial:A,lineage:ye()})]),line:Ol,seeds:w(I,_l),plan:ao}),Tl=u({kind:We,status:He,run:c().int().positive().max(999999).optional(),records:w(G,l(Zr).max(1e6)),masked:w(G,A).optional(),snapshotId:i().min(1).max(200).optional(),users:l(u({username:oe,userId:i().regex(/^005[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,{error:"Not a User Id"})})).max(te).optional(),why:i().min(1).max(4e3).optional()}),Fh=u({env:I,org:u({organizationId:L,kind:ge,alias:i().min(1).max(255).optional(),host:he.optional()}),state:u({serial:A,updatedAt:J}),resources:w(I,Tl)});var Ke=["refresh","users","masking","replay","frozen","testersCheckpoint","deliverability","scheduledJobs","endpoints","handoff"],$h=Ke.length,uo=["users","masking","replay","frozen","testersCheckpoint","deliverability","scheduledJobs","endpoints","handoff"],co=["deliverability","endpoints"],wn=["beforeRefreshCheckpoint","jobsInventory","testersList","automation"],wl=["todo","done","skipped","notApplicable","refused"],mo={refreshDetected:"done",ranAfterRefresh:"done",markedDone:"done",ready:"done",toDo:"todo",skipped:"skipped",noRefreshDetected:"notApplicable",nothingCopied:"notApplicable",noCheckpointBefore:"notApplicable",noManifest:"notApplicable",noInventoryBefore:"notApplicable",noUserToBringBack:"notApplicable",stagingSandbox:"refused"},kl=Object.keys(mo);function Il(e){let t=e.filter(n=>n.status!=="notApplicable");return{done:t.filter(n=>n.status==="done"||n.status==="skipped").length,total:t.length}}var ue=i().min(1).max(128),ie=de.datetime({offset:!0}),Oe=c().int().nonnegative(),fo=h(kl),vl=i().regex(/^[A-Za-z][A-Za-z0-9_]*$/,{error:"Not an object API name"}).max(80),Cl=200,Nl=i().regex(/^005[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,{error:"Not a User Id"}),Pl=h(["success","partial","failure","cancelled"]),jl=u({id:h(Ke),status:h(wl),reason:fo,at:ie.optional()}),Fl=u({id:h(wn),status:h(["todo","done"]),reason:fo,at:ie.optional()});function lo(e,t,n){e.forEach((o,a)=>{let s=mo[o.reason];s!==o.status&&n.addIssue({code:"custom",path:[t,a,"reason"],message:`${o.reason} explains a step ${s}, not one ${o.status}`})})}function po(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}var Bh=u({orgId:ue,alias:i().min(1).max(255),tier:h(["development","staging","scratch"]),sandboxType:h(["Developer","DeveloperPro","Partial","Full"]).optional(),myDomainHost:he.optional(),organizationId:L.optional(),refresh:u({detectedAt:ie,evidence:h(["connection","monitor","production"]),previousOrganizationId:L.optional(),organizationId:L.optional(),previousInstanceName:i().min(1).max(40).optional(),instanceName:i().min(1).max(40).optional(),reportedBy:i().min(1).max(255).optional(),cachesForgotten:y()}).optional(),checkpointBefore:u({checkpointId:Z,name:i().min(1).max(255),takenAt:ie}).optional(),frozenManifest:u({frozenAt:ie,sourceAlias:i().min(1).max(255).optional(),objects:Oe,records:Oe}).optional(),inventoryBefore:u({savedAt:ie,organizationId:L,jobs:Oe}).optional(),maskObjects:u({objects:l(vl).min(1).max(Cl),from:h(["org","machine"])}).optional(),handoffNote:u({writtenAt:ie}).optional(),finishedAt:ie.optional(),lastUsersRun:u({run:c().int().positive().max(999999),at:ie,status:Pl}).optional(),steps:l(jl),beforeNextRefresh:l(Fl),done:Oe,total:Oe}).superRefine((e,t)=>{po(e.steps.map(o=>o.id),Ke)||t.addIssue({code:"custom",path:["steps"],message:`the steps are ${Ke.join(", ")}, in that order`}),po(e.beforeNextRefresh.map(o=>o.id),wn)||t.addIssue({code:"custom",path:["beforeNextRefresh"],message:`what to keep is ${wn.join(", ")}, in that order`}),lo(e.steps,"steps",t),lo(e.beforeNextRefresh,"beforeNextRefresh",t);let n=Il(e.steps);(n.done!==e.done||n.total!==e.total)&&t.addIssue({code:"custom",path:["done"],message:`${e.done} of ${e.total} counted, where the steps say ${n.done} of ${n.total}`})});function Gh(e,t){return`recovery:${e}:${t}`}function go(e,t){if(!(t!=="done"||co.includes(e)))return`${e} is deduced from what ran: only ${co.join(" and ")} are marked done by hand`}var Wh=u({steps:Ae(h(uo),h(["skipped","done"])).default({}),finishedAt:ie.optional()}).superRefine((e,t)=>{for(let[n,o]of Object.entries(e.steps)){let a=go(n,o);a&&t.addIssue({code:"custom",path:["steps",n],message:a})}}),Hh=u({orgId:ue}),Kh=u({orgId:ue,config:Et,replaces:c().int().positive().max(999999).optional(),acceptUserEmails:y(),acceptEmails:y(),acceptAutomation:y()}),Vh=u({orgId:ue,config:Et}),qh=u({orgId:ue,asked:u({deliverability:y(),schedules:y(),endpoints:v([S(!1),_n.required()])}),save:y()}),Zh=C("what",[u({orgId:ue,what:S("step"),step:h(uo),mark:h(["skipped","done","cleared"])}).superRefine((e,t)=>{let n=go(e.step,e.mark);n&&t.addIssue({code:"custom",path:["mark"],message:n})}),u({orgId:ue,what:S("finish")}),u({orgId:ue,what:S("resume")})]),Ll=5e3,Dl=u({username:oe,userId:Nl.optional(),name:i().min(1).max(255).optional(),address:At.exclude(["kept"]),active:y(),frozen:y(),profile:i().min(1).max(255).optional()}),Yh=u({orgId:ue,users:l(Dl).max(Ll),total:Oe.optional(),saved:u({config:Et,savedAt:ie}).optional()}),Ml=["INVALID_PAYLOAD","ORG_NOT_FOUND","NOT_CONNECTED","NOT_A_DEVELOPMENT_ORG","ORG_CHANGED","NOTE_NOT_FOUND","CANCELLED","FAILED"],Xh=u({code:h(Ml),message:i().min(1).max(4e3),retryable:y(),step:h(Ke).optional()});var Ul=["testing-center","agentforce-studio"];var zt=i().min(1).max(255).regex(/^[^\s\p{Cc}]+$/u,"An API name has no space and no control character"),$l=10,ey=u({agent:zt,runner:h(Ul),topics:l(u({packTopic:je,agentTopic:zt,actions:l(zt).max($l)})).min(1).max(F.topics.max),guardTopic:zt.nullable()}).superRefine((e,t)=>{let n=new Set;e.topics.forEach((o,a)=>{n.has(o.packTopic)&&t.addIssue({code:"custom",path:["topics",a,"packTopic"],message:`The topic "${o.packTopic}" of the scenario is matched twice`}),n.add(o.packTopic);let s=new Set;o.actions.forEach((d,p)=>{s.has(d)&&t.addIssue({code:"custom",path:["topics",a,"actions",p],message:`The action "${d}" is expected twice of the topic "${o.packTopic}"`}),s.add(d)})})}),Bl=["completeness","coherence","conciseness","output_latency_milliseconds"],ho=u({name:i().min(1),value:i()}),yo=v([u({role:S("user"),message:i(),index:c().int().min(0).optional()}),u({role:S("agent"),message:i(),topic:i(),index:c().int().min(0).optional()})]),Gl=u({label:i(),name:i(),parameters:l(v([u({name:S("operator"),value:i(),isReference:S(!1)}),u({name:S("actual"),value:i(),isReference:S(!0)}),u({name:S("expected"),value:i(),isReference:y()})]))}),Wl=u({utterance:i().min(1),expectedTopic:i().min(1).optional(),expectedActions:l(i().min(1)).optional(),expectedOutcome:i().min(1).optional(),metrics:l(h(Bl)).optional(),contextVariables:l(ho).optional(),conversationHistory:l(yo).optional(),customEvaluations:l(Gl).optional()}),Hl=u({name:i().min(1),description:i().optional(),subjectType:S("AGENT"),subjectName:i().min(1),subjectVersion:i().optional(),testCases:l(Wl).min(1)}),bo={topic_sequence_match:{needsExpected:!0},action_sequence_match:{needsExpected:!0},agent_handoff_match:{needsExpected:!0},bot_response_rating:{needsExpected:!0},response_match:{needsExpected:!0},coherence:{needsExpected:!1},conciseness:{needsExpected:!1},factuality:{needsExpected:!1},completeness:{needsExpected:!1},task_resolution:{needsExpected:!1},output_latency_milliseconds:{needsExpected:!1}};function Kl(e){return Object.prototype.hasOwnProperty.call(bo,e)}var Vl=u({utterance:i().min(1),contextVariables:l(ho).optional(),conversationHistory:l(yo).optional()}),ql=u({inputs:l(Vl).min(1),scorers:l(u({name:i().min(1),expected:i().optional()})).min(1)}).superRefine((e,t)=>{e.scorers.forEach((a,s)=>{Kl(a.name)&&bo[a.name].needsExpected&&(a.expected===void 0||a.expected==="")&&t.addIssue({code:"custom",path:["scorers",s,"expected"],message:`The scorer ${a.name} needs the value it scores against`})});let n=e.scorers.some(a=>a.name==="task_resolution"),o=e.inputs.some(a=>(a.conversationHistory?.length??0)>0);n&&!o&&t.addIssue({code:"custom",path:["scorers"],message:"The scorer task_resolution needs a conversation history on an input"})}),Zl=u({name:i().min(1),description:i().optional(),subjectType:S("AGENT"),subjectName:i().min(1),subjectVersion:i().optional(),testCases:l(ql).min(1)});function Yl(e){return Hl.parse({name:e.name,...e.description!==void 0?{description:e.description}:{},subjectType:"AGENT",subjectName:e.subjectName,testCases:e.testCases.map(t=>({utterance:t.utterance,...t.expectedTopic!==void 0?{expectedTopic:t.expectedTopic}:{},expectedActions:[...t.expectedActions],expectedOutcome:t.expectedOutcome,...t.contextVariables.length>0?{contextVariables:t.contextVariables.map(n=>({...n}))}:{}}))})}function Xl(e){return e.length===1?e[0]:`[${e.map(t=>`'${t}'`).join(",")}]`}function Ql(e){return Zl.parse({name:e.name,...e.description!==void 0?{description:e.description}:{},subjectType:"AGENT",subjectName:e.subjectName,testCases:e.testCases.map(t=>({inputs:[{utterance:t.utterance,...t.contextVariables.length>0?{contextVariables:t.contextVariables.map(n=>({...n}))}:{}}],scorers:[...t.expectedTopic!==void 0?[{name:"topic_sequence_match",expected:t.expectedTopic}]:[],...t.expectedActions.length>0?[{name:"action_sequence_match",expected:Xl(t.expectedActions)}]:[],{name:"bot_response_rating",expected:t.expectedOutcome}]}))})}function ty(e,t){return t==="agentforce-studio"?Ql(e):Yl(e)}var Jl=new Set(["string","textarea","encryptedstring"]);function ry(e){return Jl.has(e.toLowerCase())}function Ve(e,t){return{fieldApiName:e,ruleType:"static",config:{staticValue:t}}}function _(e,t){return{fieldApiName:e,ruleType:"faker",config:{fakerMethod:t}}}function ep(e,t,n){return{fieldApiName:e,ruleType:"sequence",config:{sequencePrefix:t,sequenceStart:n,sequenceStep:1}}}function qe(e,t){return{fieldApiName:e,ruleType:"reference",config:{referenceObject:t}}}function M(e,t){return{fieldApiName:e,ruleType:"picklist_random",config:{picklistValues:t}}}function be(e,t,n){return{fieldApiName:e,ruleType:"random",config:{minValue:t,maxValue:n}}}function P(e,t,n,o,a=200){return{objectApiName:e,recordCount:n,fieldRules:o,excludedFields:[],insertOrder:t,batchSize:a}}function K(e,t,n,o){return{childObject:e,lookupField:t,parentObject:n,parents:{kind:"generated"},distribution:o}}var xo=["Technology","Finance","Healthcare","Manufacturing","Retail","Energy","Education","Consulting","Telecommunications","Transportation"],tp=["Prospect","Customer - Direct","Customer - Channel","Channel Partner / Reseller","Technology Partner"],kn=["Web","Phone Inquiry","Partner Referral","Purchased List","Other"],np=["Prospecting","Qualification","Needs Analysis","Value Proposition","Proposal/Price Quote","Negotiation/Review","Closed Won","Closed Lost"],_t=[_("Name","company.name"),M("Industry",xo),M("Type",tp),M("Rating",["Hot","Warm","Cold"]),_("Phone","phone.number"),_("Website","internet.url"),_("BillingStreet","location.streetAddress"),_("BillingCity","location.city"),_("BillingState","location.state"),_("BillingPostalCode","location.zipCode"),_("BillingCountry","location.country"),be("NumberOfEmployees",10,5e4),be("AnnualRevenue",1e5,5e7)],Ot=[_("FirstName","person.firstName"),_("LastName","person.lastName"),_("Email","internet.email"),_("Phone","phone.number"),_("Title","person.jobTitle"),M("LeadSource",kn),_("MailingStreet","location.streetAddress"),_("MailingCity","location.city"),_("MailingState","location.state"),_("MailingPostalCode","location.zipCode"),_("MailingCountry","location.country")];function In(e){return[_("Name","company.catchPhrase"),M("StageName",np),_("CloseDate","date.soon"),M("Type",["New Customer","Existing Customer - Upgrade"]),M("LeadSource",kn),...e?[be("Amount",5e3,5e5)]:[]]}var So=[_("Name","commerce.productName"),ep("ProductCode","PROD-",1001),Ve("IsActive",!0),_("Description","commerce.productDescription")],Eo=[qe("Pricebook2Id","Pricebook2"),be("UnitPrice",20,2e3),Ve("IsActive",!0)],Ao=[qe("PricebookEntryId","PricebookEntry"),be("Quantity",1,10),be("UnitPrice",20,2e3)],Ro=[_("Subject","caseSubject"),M("Status",["New","Working","Escalated","Closed"]),M("Priority",["High","Medium","Low"]),M("Origin",["Phone","Email","Web"])],rp={id:"prebuilt-crm-starter",name:"seed.templates.crmStarter.name",description:"seed.templates.crmStarter.description",version:1,strategy:"faker",tags:["prebuilt","sales","service"],createdAt:"2026-10-20T00:00:00.000Z",updatedAt:"2026-10-20T00:00:00.000Z",objects:[P("Account",0,25,_t),P("Contact",1,75,Ot),P("Product2",2,10,So),P("PricebookEntry",3,10,Eo),P("Opportunity",4,50,[...In(!1),qe("Pricebook2Id","Pricebook2")]),P("OpportunityLineItem",5,75,Ao),P("Case",6,50,Ro)],relations:[K("Contact","AccountId","Account",{mode:"perParent",count:3}),K("PricebookEntry","Product2Id","Product2",{mode:"perParent",count:1}),K("Opportunity","AccountId","Account",{mode:"perParent",count:2}),K("OpportunityLineItem","OpportunityId","Opportunity",{mode:"ratio",ratio:1.5}),K("Case","ContactId","Contact",{mode:"ratio",ratio:.67})]},op={id:"prebuilt-leads-activities-starter",name:"seed.templates.leadsActivitiesStarter.name",description:"seed.templates.leadsActivitiesStarter.description",version:1,strategy:"faker",tags:["prebuilt","marketing","activities"],createdAt:"2026-10-20T00:00:00.000Z",updatedAt:"2026-10-20T00:00:00.000Z",objects:[P("Lead",0,40,[_("FirstName","person.firstName"),_("LastName","person.lastName"),_("Company","company.name"),_("Title","person.jobTitle"),_("Email","internet.email"),_("Phone","phone.number"),M("Status",["Open - Not Contacted","Working - Contacted","Closed - Not Converted"]),M("LeadSource",kn),M("Industry",xo),M("Rating",["Hot","Warm","Cold"]),_("Street","location.streetAddress"),_("City","location.city"),_("State","location.state"),_("PostalCode","location.zipCode"),_("Country","location.country")]),P("Campaign",1,3,[_("Name","company.catchPhrase"),M("Type",["Webinar","Email","Conference","Trade Show"]),M("Status",["Planned","In Progress","Completed"]),Ve("IsActive",!0),_("StartDate","date.past"),_("EndDate","date.soon")]),P("CampaignMember",2,40,[qe("CampaignId","Campaign"),M("Status",["Sent","Responded"])]),P("Task",3,20,[M("Subject",["Call","Email","Send Quote"]),M("Status",["Not Started","In Progress","Completed"]),M("Priority",["High","Normal","Low"]),_("ActivityDate","date.soon")]),P("Event",4,10,[M("Subject",["Meeting","Call"]),_("StartDateTime","futureDateTime"),be("DurationInMinutes",30,90)])],relations:[K("CampaignMember","LeadId","Lead",{mode:"perParent",count:1}),K("Task","WhoId","Lead",{mode:"ratio",ratio:.5}),K("Event","WhoId","Lead",{mode:"ratio",ratio:.25})]},ip={id:"prebuilt-minimal-demo",name:"seed.templates.minimalDemo.name",description:"seed.templates.minimalDemo.description",version:1,strategy:"faker",tags:["prebuilt","demo"],createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:00:00.000Z",objects:[P("Account",0,50,_t),P("Contact",1,100,Ot),P("Opportunity",2,200,In(!0))],relations:[K("Contact","AccountId","Account",{mode:"perParent",count:2}),K("Opportunity","AccountId","Account",{mode:"perParent",count:4})]},ap={id:"prebuilt-service-cloud-starter",name:"seed.templates.serviceCloudStarter.name",description:"seed.templates.serviceCloudStarter.description",version:1,strategy:"faker",tags:["prebuilt","service"],createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:00:00.000Z",objects:[P("Account",0,200,_t),P("Contact",1,500,Ot),P("Case",2,1e3,Ro),P("CaseComment",3,2e3,[_("CommentBody","caseComment"),Ve("IsPublished",!1)]),{...P("Knowledge__kav",4,100,[_("Title","caseSubject"),_("UrlName","string.uuid"),Ve("Language","en_US")]),optional:!0}],relations:[K("Contact","AccountId","Account",{mode:"ratio",ratio:2.5}),K("Case","ContactId","Contact",{mode:"perParent",count:2}),K("CaseComment","ParentId","Case",{mode:"perParent",count:2})]},sp={id:"prebuilt-sales-cloud-starter",name:"seed.templates.salesCloudStarter.name",description:"seed.templates.salesCloudStarter.description",version:1,strategy:"faker",tags:["prebuilt","sales"],createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:00:00.000Z",objects:[P("Product2",0,50,So),P("PricebookEntry",1,50,Eo),P("Account",2,500,_t),P("Contact",3,1e3,Ot),P("Opportunity",4,2e3,[...In(!1),qe("Pricebook2Id","Pricebook2")]),P("OpportunityLineItem",5,4e3,Ao)],relations:[K("PricebookEntry","Product2Id","Product2",{mode:"perParent",count:1}),K("Contact","AccountId","Account",{mode:"perParent",count:2}),K("Opportunity","AccountId","Account",{mode:"perParent",count:4}),K("OpportunityLineItem","OpportunityId","Opportunity",{mode:"perParent",count:2})]},iy=[rp,op,ip,ap,sp];var cp={version:1,id:"retail-orders",name:"Retail orders",language:"en_US",businessContext:"An online store that sells office and shop supplies to small businesses: paper, ink, packaging, furniture and small electronics, delivered by carrier. Customers order on the website and write to support by email, by phone or through the web form.",customers:{count:10,industry:"Retail"},topics:[{key:"damaged-parcel",label:"Damaged parcel",article:{title:"What to do when a parcel arrives damaged",summary:"Report the damage within 7 days of delivery with photos. Support offers a replacement or a refund, and the carrier collects the damaged goods free of charge.",body:["If a parcel arrives damaged, report it within 7 days of delivery from the order page or by replying to the delivery confirmation. Include photos of the outer box, the packing and the damaged items, and keep the original packaging until the case is closed.","Once the photos are received, support offers a replacement or a full refund of the damaged items, whichever the customer prefers. A replacement ships within 2 working days. A refund goes back to the original payment method within 5 working days.","The carrier collects the damaged goods free of charge. Support books the collection when the replacement or the refund is agreed: the customer does not pay for a return label.","Damage reported after 7 days is handled as a warranty claim when the item is covered by a warranty."].join(`
|
|
8
|
+
|
|
9
|
+
`),facts:["within 7 days of delivery","photos of the outer box, the packing and the damaged items","A replacement ships within 2 working days","The carrier collects the damaged goods free of charge"]},caseTemplates:[{subject:"Order arrived with a crushed box and broken items",description:"Hello, this is {firstName} from {company}. Our order arrived this morning with the box crushed on one side, and two of the six desk lamps inside are broken.",priority:"Medium",origin:"Email",followUp:"Hi again, I sent the photos of the box and the lamps yesterday. Can you confirm whether you will send replacements?",resolution:["Photos received: the outer box is crushed and two lamps are broken. Offered a replacement or a refund of the two lamps; the customer chose a replacement.","Replacement of the two desk lamps shipped. Carrier collection of the broken lamps booked free of charge. Case closed."]},{subject:"Toner cartridges leaking on arrival",description:"Hi, {firstName} at {company} here. The box of toner cartridges we received is stained and three cartridges are leaking. We cannot use them.",priority:"High",origin:"Web",followUp:"Any news? We are running out of toner and need the replacement cartridges this week.",resolution:["Asked for photos of the box, the packing and the cartridges. Photos received the same day: three cartridges leaking.","The customer preferred a refund. Refund of the three cartridges issued to the original payment method; carrier collection booked free of charge. Case closed."]}],utterances:[{text:"Hi, my email is {email}. The parcel I received is damaged, what should I do?",expectedOutcome:'The agent finds the open case "{caseSubject}" from the email address, asks for photos of the outer box, the packing and the damaged items, and says a replacement or a refund is offered.'},{text:"Our order arrived broken. Do we have to pay to send the damaged items back?",expectedOutcome:"The agent says the carrier collects the damaged goods free of charge, so no return label is needed."},{text:"I only noticed the damage today and the parcel came three days ago. Is it too late?",expectedOutcome:"The agent says damage is reported within 7 days of delivery, so it is not too late, and explains how to report it with photos."}]},{key:"refund",label:"Refund",article:{title:"Refunds: how and when you are paid back",summary:"Unused items can be returned within 30 days of delivery with a free return label. The refund is issued to the original payment method once the items are checked.",body:["Unused items can be returned for a refund within 30 days of delivery. Start the return from the order page: a free return label is emailed to the address of the account.","Once the returned items reach the warehouse, they are checked within 2 working days. The refund is issued to the original payment method, and the bank usually shows it within 5 working days after that.","Delivery charges are refunded when the whole order is returned, or when the return is due to our mistake. Customised items, such as printed stationery, cannot be refunded unless they arrived damaged or faulty.","A refund for a damaged parcel needs no return: see the article on damaged parcels."].join(`
|
|
10
|
+
|
|
11
|
+
`),facts:["within 30 days of delivery","a free return label","refund is issued to the original payment method","Customised items, such as printed stationery, cannot be refunded"]},caseTemplates:[{subject:"Refund not received for returned chairs",description:"Hello, {firstName} from {company}. We returned two office chairs two weeks ago and have not seen the refund yet.",priority:"Medium",origin:"Email",followUp:"Still no refund on our bank statement. Could you check where it is?",resolution:["The warehouse confirmed the two chairs arrived and passed the check.","Refund issued to the original payment method; told the customer the bank shows it within 5 working days. Case closed."]},{subject:"Return of an unopened paper order",description:"Hi, this is {firstName} at {company}. We ordered too much printer paper. Can we return the unopened boxes for a refund?",priority:"Low",origin:"Web",followUp:"We have not received the return label yet. Where should we look for it?",resolution:["Order delivered ten days ago, within 30 days: return accepted. Free return label emailed to the address of the account.","Boxes received unopened. Refund issued to the original payment method. Case closed."]}],utterances:[{text:"This is {email}. When will I get my refund?",expectedOutcome:'The agent finds the open case "{caseSubject}" and explains that returned items are checked within 2 working days and the refund is issued to the original payment method.'},{text:"Can I get a refund on business cards printed with our logo?",expectedOutcome:"The agent explains that customised items such as printed stationery cannot be refunded unless they arrived damaged or faulty."},{text:"Do I have to pay for the return shipping?",expectedOutcome:"The agent says a free return label is emailed when the return is started from the order page."}]},{key:"late-delivery",label:"Late delivery",article:{title:"Late deliveries and tracking",summary:"Most orders are delivered within 3 working days. Support opens an inquiry with the carrier when the tracking stops, and a parcel late by 10 working days is treated as lost.",body:["Orders placed before 2 pm on a working day leave our warehouse the same day, and most are delivered within 3 working days. The tracking link is in the dispatch email and on the order page.","If the tracking has not changed for 2 working days, the parcel may be held at the carrier's depot. Support opens an inquiry with the carrier, which answers within 48 hours.","A parcel not delivered within 10 working days of dispatch is treated as lost: support sends a replacement at no cost or refunds the order, as the customer prefers.","Express delivery charges are refunded when an express parcel arrives late."].join(`
|
|
12
|
+
|
|
13
|
+
`),facts:["Orders placed before 2 pm on a working day leave our warehouse the same day","opens an inquiry with the carrier","not delivered within 10 working days of dispatch is treated as lost","Express delivery charges are refunded when an express parcel arrives late"]},caseTemplates:[{subject:"Order still not delivered after a week",description:"Hello, {firstName} here from {company}. Our order was dispatched a week ago and the tracking has not moved for four days.",priority:"High",origin:"Phone",followUp:"The tracking still says in transit. Has the carrier answered your inquiry?",resolution:["Tracking unchanged for four working days. Opened an inquiry with the carrier.","The carrier found the parcel at its depot and delivered it the next day. Case closed."]},{subject:"Express delivery arrived two days late",description:"Hi, {firstName} at {company}. We paid for express delivery and the parcel arrived two days late. We would like the express charge back.",priority:"Low",origin:"Email",followUp:"Could you confirm when the express charge will be refunded?",resolution:["Tracking confirms the express parcel arrived two days after the promised date.","Express delivery charge refunded to the original payment method. Case closed."]}],utterances:[{text:"Hi, I am writing from {email}. Where is my order? It should have arrived by now.",expectedOutcome:'The agent finds the open case "{caseSubject}", gives the tracking details and explains that support opens an inquiry with the carrier when the tracking has not changed for 2 working days.'},{text:"My parcel has been stuck for two weeks. Is it lost?",expectedOutcome:"The agent explains that a parcel not delivered within 10 working days of dispatch is treated as lost, and offers a replacement at no cost or a refund."}]},{key:"address-change",label:"Change of delivery address",article:{title:"Changing the delivery address of an order",summary:"The address can be changed on the order page until dispatch. After dispatch, support can have the carrier redirect the parcel within the same country, at no cost.",body:["The delivery address of an order can be changed from the order page until the order is dispatched, usually the same working day for orders placed before 2 pm.","Once the order is dispatched, we can no longer change its address. Support can ask the carrier to redirect the parcel to another address in the same country: a redirection takes 1 extra working day and costs nothing.","A parcel cannot be redirected to a parcel locker or abroad. To make a new address the default for future orders, change it under Account settings, Addresses."].join(`
|
|
14
|
+
|
|
15
|
+
`),facts:["changed from the order page until the order is dispatched","redirect the parcel to another address in the same country","a redirection takes 1 extra working day and costs nothing","cannot be redirected to a parcel locker or abroad"]},caseTemplates:[{subject:"Change the delivery address after an office move",description:"Hello, {firstName} from {company}. We have just moved offices and our last order is going to the old address. Can you change it?",priority:"Medium",origin:"Phone",followUp:"The order shows as dispatched. Were you able to ask the carrier to redirect it?",resolution:["Order already dispatched. Asked the carrier to redirect the parcel to the new office address.","The carrier confirmed the redirection and delivered one working day later. Reminded the customer to change the default address under Account settings. Case closed."]},{subject:"Deliver the order to a parcel locker instead",description:"Hi, this is {firstName} at {company}. Nobody will be at the office this week. Could the parcel go to a parcel locker near us?",priority:"Low",origin:"Web",followUp:"Is there another option if the locker is not possible?",resolution:["Explained that a parcel cannot be redirected to a parcel locker. Offered a redirection to another address in the same country.","The customer chose the address of a neighbouring shop; redirection booked at no cost. Case closed."]}],utterances:[{text:"Hello, this is {email}. I need my order delivered to a different address.",expectedOutcome:'The agent finds the open case "{caseSubject}", checks whether the order has been dispatched and explains that a dispatched parcel can be redirected to another address in the same country at no cost.'},{text:"Can you send my parcel to my holiday address in another country instead?",expectedOutcome:"The agent explains that a parcel cannot be redirected abroad."}]},{key:"warranty",label:"Warranty",article:{title:"Warranty on furniture and electronics",summary:"Furniture and small electronics carry a 2-year warranty from delivery; consumables do not. A faulty item is repaired or replaced free of charge.",body:["Office furniture and small electronics sold by us carry a 2-year warranty from the date of delivery. Consumables such as paper, ink and toner are not covered.","To make a claim, open a case with the order number, the serial number of the item when it has one, and a description or a video of the fault.","Support first suggests checks that often solve the problem. If the item is still faulty, it is repaired or replaced free of charge; when neither is possible, the price of the item is refunded.","The warranty does not cover damage from misuse, accidents or wear, such as scratched surfaces."].join(`
|
|
16
|
+
|
|
17
|
+
`),facts:["a 2-year warranty from the date of delivery","Consumables such as paper, ink and toner are not covered","the serial number of the item","repaired or replaced free of charge","does not cover damage from misuse, accidents or wear"]},caseTemplates:[{subject:"Shredder stopped working after eight months",description:"Hello, {firstName} from {company}. Our paper shredder stopped working after eight months. It turns on but the blades do not move.",priority:"Medium",origin:"Email",followUp:"We tried the reset you suggested and it still does not work. What happens next?",resolution:["Within the 2-year warranty. Asked for the serial number and suggested clearing the blades and resetting the motor.","Still faulty after the checks. Replacement shredder sent free of charge; the carrier collected the faulty one. Case closed."]},{subject:"Desk chair keeps sinking",description:"Hi, {firstName} at {company} here. One of the desk chairs we bought last year keeps sinking when we sit on it.",priority:"Low",origin:"Phone",followUp:"Do you need anything else from us to repair the chair?",resolution:["Delivered fourteen months ago, within the 2-year warranty. Asked for the order number and a short video of the fault.","Replacement gas lift shipped free of charge with fitting instructions. The customer confirmed the chair works. Case closed."]}],utterances:[{text:"Hi, my address is {email}. Something I bought from you is faulty. Is it under warranty?",expectedOutcome:'The agent finds the open case "{caseSubject}", explains the 2-year warranty from the date of delivery and asks for the order number, the serial number and a description of the fault.'},{text:"Our ink cartridges dried out. Can we claim them under the warranty?",expectedOutcome:"The agent explains that consumables such as paper, ink and toner are not covered by the warranty."}]}],decoy:{title:"Returns of items sold by marketplace sellers",summary:"Items sold by marketplace sellers are returned under the policy of their seller, which may differ from ours.",body:['Some items on our website are sold and shipped by marketplace sellers: their page says "Sold by" with the name of the seller.',"These items are returned under the return policy of the seller, which may give 14 days instead of 30 and may charge for the return shipping.","Start the return from the order page: the request goes to the seller, who answers within 2 working days. If the seller does not answer, our support steps in."].join(`
|
|
18
|
+
|
|
19
|
+
`),resembles:"refund"},outOfScope:[{text:"Can you recommend a good restaurant near your warehouse?",expectedOutcome:"The agent says it cannot help with that and offers help with orders, deliveries, refunds and warranties."},{text:"What do you think the stock market will do this week?",expectedOutcome:"The agent declines to give a financial opinion and steers back to the customer's orders."}]},dp={version:1,id:"broadband-support",name:"Broadband support",language:"en_US",businessContext:"A broadband provider for small offices: fibre and copper lines, a router supplied with every plan, and plans billed monthly. Customers write to support about outages, speed, bills, their router and changes of plan.",customers:{count:10,industry:"Consulting"},topics:[{key:"outage",label:"Service outage",article:{title:"When the internet connection is down",summary:"Check the service status page, then restart the router. Support runs a remote line test and credits each full day without service.",body:["First check the service status page in your account, which lists outages by postcode. If an outage is listed, the estimated time of repair is shown there and updated every hour: there is no need to open a case.","If no outage is listed, restart the router by unplugging it for 30 seconds, and check that the light marked Internet turns green within 5 minutes. A red light means the line is not reaching the router.","If the connection is still down, support runs a remote line test, which takes about 10 minutes, and books an engineer visit when the fault is on the line.","When a fault lasts more than 24 hours, a credit for each full day without service is added to the next bill automatically."].join(`
|
|
20
|
+
|
|
21
|
+
`),facts:["service status page","unplugging it for 30 seconds","a remote line test","a credit for each full day without service is added to the next bill"]},caseTemplates:[{subject:"No internet in the office since this morning",description:"Hello, this is {firstName} from {company}. We have had no internet since 8 this morning, and the Internet light on the router is red.",priority:"High",origin:"Phone",followUp:"Still no connection after the restart. When can an engineer come?",resolution:["No outage listed for the postcode. Router restarted with the customer; the Internet light stayed red. The remote line test found a fault on the line.","Engineer visit booked for the next morning; line repaired. Credit for one full day without service added to the next bill. Case closed."]},{subject:"Connection drops several times a day",description:"Hi, {firstName} at {company} here. Our connection drops for a few minutes several times a day, which cuts our video calls.",priority:"Medium",origin:"Email",followUp:"It dropped three more times yesterday. Did the line test show anything?",resolution:["The remote line test showed the line losing sync several times a day. Asked the customer to plug the router into the main wall socket without an extension cable.","No drops in the three days after removing the extension cable. Case closed."]}],utterances:[{text:"Hi, this is {email}. Our internet is down, can you help?",expectedOutcome:'The agent finds the open case "{caseSubject}", checks the service status page for an outage and, if none is listed, guides the customer to restart the router by unplugging it for 30 seconds.'},{text:"We were offline for two whole days last week. Do we get anything back?",expectedOutcome:"The agent explains that when a fault lasts more than 24 hours, a credit for each full day without service is added to the next bill."}]},{key:"slow-speed",label:"Slow speed",article:{title:"Slower speeds than expected",summary:"Measure by cable, three times a day, against the minimum guaranteed speed of the plan. A line that cannot reach it can leave its contract without a fee.",body:["Each plan has a minimum guaranteed speed, shown in the welcome email and on the plan page of your account. Speeds measured over Wi-Fi are often lower than the speed of the line, so measure with a computer connected to the router by cable.","Run the speed test in your account three times at different times of day. If all three results are below the minimum guaranteed speed, open a case with the results.","Support then checks the line remotely. If the line cannot reach the minimum guaranteed speed within 30 days, the customer can move to a cheaper plan that matches the speed, or leave the contract without an early termination fee."].join(`
|
|
22
|
+
|
|
23
|
+
`),facts:["minimum guaranteed speed","connected to the router by cable","three times at different times of day","leave the contract without an early termination fee"]},caseTemplates:[{subject:"Download speed far below our plan",description:"Hello, {firstName} from {company}. We pay for 500 Mbps and the speed test shows about 60 Mbps.",priority:"Medium",origin:"Web",followUp:"We ran the test three times by cable as you asked: 58, 61 and 64 Mbps. What now?",resolution:["Asked the customer to run the speed test three times at different times of day, with a computer connected by cable.","All three results below the minimum guaranteed speed. Line fault fixed remotely; the speed is back to 480 Mbps. Case closed."]},{subject:"Wi-Fi slow in the meeting room",description:"Hi, this is {firstName} at {company}. The Wi-Fi in our meeting room is very slow, while the desks near the router are fine.",priority:"Low",origin:"Email",followUp:"Is there a way to improve the Wi-Fi without moving the router?",resolution:["The speed test by cable at the router matched the plan: the line is fine, and the Wi-Fi does not reach the meeting room.","Suggested a Wi-Fi extender; the customer confirmed the meeting room now gets a good signal. Case closed."]}],utterances:[{text:"Hello, it is {email}. Our internet is much slower than what we pay for.",expectedOutcome:'The agent finds the open case "{caseSubject}" and asks the customer to run the speed test three times at different times of day, with a computer connected to the router by cable.'},{text:"If you can never give us the speed we pay for, can we cancel without a fee?",expectedOutcome:"The agent explains that when the line cannot reach the minimum guaranteed speed within 30 days, the customer can leave the contract without an early termination fee."}]},{key:"billing-dispute",label:"Bill dispute",article:{title:"Questions about your bill",summary:"Bills are issued on the 1st of each month. A dispute opened before the direct debit date puts the disputed amount on hold during the review.",body:["Bills are issued on the 1st of each month and paid by direct debit 14 days later. The first bill after a change of plan covers part of two months, so it is often higher than usual.","If a bill looks wrong, open a dispute before the direct debit date. The disputed amount is put on hold and is not collected while support reviews it; the rest of the bill is collected as usual.","A review takes up to 10 working days. When the charge was wrong, the amount is refunded or credited to the next bill, as the customer prefers.","One-off charges, such as an engineer visit for a fault on your own equipment, are listed on the bill with the date of the visit."].join(`
|
|
24
|
+
|
|
25
|
+
`),facts:["issued on the 1st of each month","open a dispute before the direct debit date","The disputed amount is put on hold","A review takes up to 10 working days"]},caseTemplates:[{subject:"Bill twice the usual amount",description:"Hello, {firstName} from {company}. This month the bill is twice what we normally pay, and we have not changed anything.",priority:"High",origin:"Email",followUp:"The direct debit is due next week. Will the disputed part still be taken?",resolution:["Dispute opened before the direct debit date; the disputed amount is on hold.","The review found a monthly charge billed twice. Amount credited to the next bill. Case closed."]},{subject:"Charge for an engineer visit we did not ask for",description:"Hi, {firstName} at {company} here. Our bill shows a charge for an engineer visit, and we never booked one.",priority:"Medium",origin:"Phone",followUp:"Could you tell us the date of this visit and who booked it?",resolution:["The bill shows the date of the visit, which had been booked against this account by mistake.","Charge removed and refunded. Case closed."]}],utterances:[{text:"This is {email}. Our latest bill is wrong, what can we do?",expectedOutcome:'The agent finds the open case "{caseSubject}" and explains that a dispute opened before the direct debit date puts the disputed amount on hold while support reviews it.'},{text:"How long does it take to sort out a billing dispute?",expectedOutcome:"The agent says a review takes up to 10 working days."}]},{key:"router",label:"Router",article:{title:"Your router: setup, reset and replacement",summary:"The Wi-Fi details are on the card at the back of the router. A factory reset brings them back, and a faulty router is replaced free of charge.",body:["Every plan comes with a router, which stays our property. The Wi-Fi name and password are printed on the card at the back of the router.","A factory reset puts back the original Wi-Fi name and password: hold the reset button for 15 seconds with a pin while the router is on. Any settings you changed, such as port forwarding, are lost.","A faulty router is replaced free of charge, delivered within 2 working days. Return the old one in the same box with the prepaid label: a router not returned within 30 days is charged at its replacement price."].join(`
|
|
26
|
+
|
|
27
|
+
`),facts:["printed on the card at the back of the router","hold the reset button for 15 seconds","replaced free of charge, delivered within 2 working days","not returned within 30 days is charged"]},caseTemplates:[{subject:"Router keeps restarting on its own",description:"Hello, this is {firstName} from {company}. Our router restarts by itself every hour or so, even after a factory reset.",priority:"Medium",origin:"Web",followUp:"Has the replacement router been sent? We have no tracking number yet.",resolution:["The factory reset did not help, and remote diagnostics show the router overheating. Replacement router ordered free of charge.","Replacement delivered in 2 working days; the old router returned with the prepaid label. Case closed."]},{subject:"Wi-Fi password lost after changing it",description:"Hi, {firstName} at {company}. We changed the Wi-Fi password and nobody wrote it down. How do we get back in?",priority:"Low",origin:"Phone",followUp:"We did the reset, but the password on the card does not work either.",resolution:["Guided the customer through a factory reset, holding the reset button for 15 seconds with a pin.","The router is back to the Wi-Fi name and password printed on the card at the back. The customer is connected. Case closed."]}],utterances:[{text:"Hi, it is {email}. Our router seems to be broken.",expectedOutcome:'The agent finds the open case "{caseSubject}" and explains that a faulty router is replaced free of charge, delivered within 2 working days.'},{text:"Where do I find the Wi-Fi password?",expectedOutcome:"The agent says the Wi-Fi name and password are printed on the card at the back of the router."}]},{key:"plan-change",label:"Change of plan",article:{title:"Changing your plan",summary:"A faster plan can be taken at any time and is active within 24 hours. A cheaper one is possible after the first 12 months of the contract.",body:["You can move to a faster plan at any time, and the new speed is active within 24 hours, without a new contract period.","Moving to a slower or cheaper plan is possible once the first 12 months of the contract have passed, and takes effect on the next billing date.","The first bill after a change covers part of two months, each at its own price. Leaving before the end of the contract costs an early termination fee equal to the remaining monthly charges, unless the line cannot reach its minimum guaranteed speed."].join(`
|
|
28
|
+
|
|
29
|
+
`),facts:["move to a faster plan at any time","active within 24 hours","once the first 12 months of the contract have passed","an early termination fee equal to the remaining monthly charges"]},caseTemplates:[{subject:"Upgrade to the fastest plan",description:"Hello, {firstName} from {company}. We have hired more people and want the faster plan as soon as possible.",priority:"Low",origin:"Web",followUp:"We placed the upgrade yesterday but the speed is the same. When will it change?",resolution:["Upgrade placed; explained that it is active within 24 hours and starts no new contract period.","The speed test the next day confirmed the new plan. Case closed."]},{subject:"Move to a cheaper plan",description:"Hi, {firstName} at {company} here. There are fewer of us in the office now and we would like a cheaper plan.",priority:"Medium",origin:"Email",followUp:"Can you confirm from which bill the cheaper plan applies?",resolution:["The contract started fifteen months ago, past its first 12 months: the move is allowed.","Cheaper plan booked from the next billing date. Case closed."]}],utterances:[{text:"Hi, this is {email}. We want to change our plan.",expectedOutcome:'The agent finds the open case "{caseSubject}" and explains that a faster plan is active within 24 hours, while a cheaper plan is possible once the first 12 months of the contract have passed.'},{text:"What does it cost to leave our contract early?",expectedOutcome:"The agent explains that the early termination fee equals the remaining monthly charges, unless the line cannot reach its minimum guaranteed speed."}]}],decoy:{title:"Planned maintenance windows",summary:"Planned maintenance is announced a week ahead and done at night. It is not a fault, and gives no credit.",body:["Planned maintenance is announced at least 7 days ahead, by email and on the service status page.","The work is done between midnight and 6 am, and the connection may drop for up to 30 minutes during that window.","Planned maintenance is not a fault: no credit is added to the bill for it, and no case needs to be opened."].join(`
|
|
30
|
+
|
|
31
|
+
`),resembles:"outage"},outOfScope:[{text:"Can you help me choose a new laptop for the office?",expectedOutcome:"The agent says it cannot advise on computers and offers help with the connection, bills, the router or the plan."},{text:"Who is going to win the football match tonight?",expectedOutcome:"The agent declines and steers back to the customer's broadband service."}]},lp={version:1,id:"saas-support",name:"SaaS support",language:"en_US",businessContext:"A project management application sold to companies as a subscription billed per user. Administrators manage single sign-on and users, and everyone can export data and use the API. Customers write to support about sign-in, passwords, invoices, exports and API errors.",customers:{count:10,industry:"Technology"},topics:[{key:"sso",label:"Single sign-on",article:{title:"Setting up and fixing single sign-on",summary:"Single sign-on uses SAML 2.0 on the Business and Enterprise plans. Most errors come from an entity ID that does not match, or a certificate that expired.",body:["Single sign-on uses SAML 2.0 and is available on the Business and Enterprise plans. An administrator sets it up under Admin, Security, Single sign-on, by uploading the metadata file of the identity provider.","The most common error, Invalid audience, means the entity ID configured in the identity provider does not match the one shown on the Single sign-on page: copy it again exactly.","While single sign-on is being set up, keep the test mode on: only administrators sign in through the identity provider, and everyone else keeps their password. Turning on enforcement signs out every user who is not an administrator.","If the certificate of the identity provider expires, nobody can sign in through it: upload the new certificate before the old one expires."].join(`
|
|
32
|
+
|
|
33
|
+
`),facts:["available on the Business and Enterprise plans","the entity ID configured in the identity provider does not match","keep the test mode on","upload the new certificate before the old one expires"]},caseTemplates:[{subject:"Invalid audience error when signing in with single sign-on",description:"Hello, {firstName} from {company}. We are setting up single sign-on, and every test sign-in fails with Invalid audience.",priority:"High",origin:"Email",followUp:"We copied the entity ID again and still see the error. Could you check?",resolution:["The entity ID in the identity provider ended with a slash that the Single sign-on page does not have.","The customer removed the slash and the test sign-in works. Advised to keep the test mode on until every user has been checked. Case closed."]},{subject:"Nobody can sign in since this morning",description:"Hi, this is {firstName} at {company}. Since this morning none of our users can sign in through single sign-on.",priority:"High",origin:"Phone",followUp:"Our administrator can sign in with a password. What should we change?",resolution:["The sign-in logs show that the certificate of the identity provider expired overnight.","The administrator uploaded the new certificate and users can sign in again. Case closed."]}],utterances:[{text:"Hi, I am {email}. Our single sign-on setup fails with an Invalid audience error.",expectedOutcome:'The agent finds the open case "{caseSubject}" and explains that the entity ID configured in the identity provider must match the one shown on the Single sign-on page.'},{text:"We are on the Starter plan. Can we use single sign-on?",expectedOutcome:"The agent explains that single sign-on is available on the Business and Enterprise plans only."}]},{key:"password",label:"Password reset",article:{title:"Resetting a password",summary:"A reset link is valid for 60 minutes. Five failed sign-ins lock the account for 15 minutes, and with single sign-on the identity provider manages passwords.",body:["Use Forgot password on the sign-in page: a reset link is emailed to the address of the account and stays valid for 60 minutes. Only the latest link works.","After 5 failed sign-in attempts, the account is locked for 15 minutes, then unlocks by itself. An administrator can unlock it sooner from Admin, Users.","When single sign-on is enforced, passwords are managed by the identity provider and Forgot password does not apply: ask the IT team of your company.","If the reset email does not arrive, check the spam folder, then ask an administrator to confirm the address of the account."].join(`
|
|
34
|
+
|
|
35
|
+
`),facts:["stays valid for 60 minutes","After 5 failed sign-in attempts, the account is locked for 15 minutes","An administrator can unlock it sooner","passwords are managed by the identity provider"]},caseTemplates:[{subject:"Password reset email never arrives",description:"Hello, {firstName} from {company}. I asked for a password reset three times and no email has arrived.",priority:"Medium",origin:"Web",followUp:"Nothing in the spam folder either. Could you check the address of my account?",resolution:["The address of the account had a typing mistake, which the administrator of the customer corrected under Admin, Users.","A new reset link arrived and was used within 60 minutes. Case closed."]},{subject:"Account locked after failed sign-ins",description:"Hi, {firstName} at {company}. I mistyped my password a few times and now my account is locked.",priority:"Low",origin:"Email",followUp:"It is still locked. Can someone unlock it now? I have a deadline.",resolution:["Explained that the account is locked for 15 minutes after 5 failed attempts.","The administrator of the customer unlocked it from Admin, Users. Case closed."]}],utterances:[{text:"This is {email}. I cannot reset my password, the link does not work.",expectedOutcome:'The agent finds the open case "{caseSubject}" and explains that a reset link stays valid for 60 minutes and only the latest one works.'},{text:"My account is locked. How long do I have to wait?",expectedOutcome:"The agent explains that after 5 failed sign-in attempts the account is locked for 15 minutes, and that an administrator can unlock it sooner."}]},{key:"invoice",label:"Invoice",article:{title:"Invoices and billing",summary:"Invoices are under Admin, Billing, for billing administrators. Users are billed pro rata from the day they are added and until the end of the period when removed.",body:["Invoices are issued on the first day of each billing period and are available under Admin, Billing, Invoices, as PDF files. Only billing administrators can see them.","Each user active during the period is billed. Users added during the period are billed pro rata from the day they were added; users removed are billed until the end of the period.","To change the company name, address or tax number on future invoices, change them under Admin, Billing, Details. An invoice already issued can be reissued with the new details on request, within 90 days of its date."].join(`
|
|
36
|
+
|
|
37
|
+
`),facts:["Only billing administrators can see them","billed pro rata from the day they were added","users removed are billed until the end of the period","reissued with the new details on request, within 90 days"]},caseTemplates:[{subject:"Invoice shows more users than we have",description:"Hello, {firstName} from {company}. Our latest invoice bills 48 users, and we only have 40 today.",priority:"Medium",origin:"Email",followUp:"We removed 8 users last month. Why are they still on the invoice?",resolution:["The 8 users were removed during the billing period: explained that they are billed until the end of the period.","Next invoice checked with the customer: 40 users. Case closed."]},{subject:"New tax number needed on our last invoice",description:"Hi, this is {firstName} at {company}. Our tax number changed. Can our last invoice show the new one?",priority:"Low",origin:"Web",followUp:"Has the reissued invoice been sent? Our accountant needs it this week.",resolution:["Invoice dated twenty days ago, within 90 days: reissue accepted. Asked the customer to change the tax number under Admin, Billing, Details.","Invoice reissued with the new tax number. Case closed."]}],utterances:[{text:"Hi, it is {email}. Our invoice looks wrong.",expectedOutcome:'The agent finds the open case "{caseSubject}" and explains how users are billed: pro rata from the day they were added, and until the end of the period when removed.'},{text:"Where can I download our invoices?",expectedOutcome:"The agent says invoices are under Admin, Billing, Invoices, and that only billing administrators can see them."}]},{key:"data-export",label:"Data export",article:{title:"Exporting your data",summary:"An administrator exports everything as a ZIP file of CSV files, once every 24 hours. The download link is valid for 7 days.",body:["Administrators can export all the data of their company under Admin, Data, Export. The export is a ZIP file of CSV files, one per type of record, with the attachments in a separate folder.","An export is prepared in the background, and a download link is emailed when it is ready, within 2 hours for most companies. The link stays valid for 7 days.","One full export can be started every 24 hours. A single project can be exported to CSV at any time from its own menu, by anyone who can see the project.","When a subscription ends, data stays available for export for 30 days, then it is deleted."].join(`
|
|
38
|
+
|
|
39
|
+
`),facts:["a ZIP file of CSV files","The link stays valid for 7 days","One full export can be started every 24 hours","data stays available for export for 30 days"]},caseTemplates:[{subject:"Export download link has expired",description:"Hello, {firstName} from {company}. The link in the export email says it has expired, and we need the export for an audit.",priority:"Medium",origin:"Email",followUp:"We tried to start a new export, but it says we have to wait. When can we retry?",resolution:["The link was nine days old, and links stay valid for 7 days. A new export had been started earlier the same day.","New export started the next day; the link arrived within the hour. Case closed."]},{subject:"Export is missing the attachments",description:"Hi, {firstName} at {company} here. Our export has the CSV files, but we cannot find any of the attachments.",priority:"Low",origin:"Web",followUp:"We looked again and still cannot see the attachments in the ZIP. Where are they?",resolution:["The attachments are in a separate folder of the ZIP file, and the tool of the customer showed only the top folder.","The customer found the attachments after extracting the whole ZIP. Case closed."]}],utterances:[{text:"Hello, this is {email}. I need a full export of our data.",expectedOutcome:'The agent finds the open case "{caseSubject}" and explains that an administrator starts the export under Admin, Data, Export, and that the download link is emailed and stays valid for 7 days.'},{text:"We are cancelling our subscription. How long can we still get our data?",expectedOutcome:"The agent explains that data stays available for export for 30 days after the subscription ends, then it is deleted."}]},{key:"api-error",label:"API error",article:{title:"Common API errors",summary:"Error 401 is a token problem, 429 the limit of 100 requests a minute, 500 an error on our side. A token is shown only once.",body:["API requests are authenticated with a token created under Settings, API tokens. A token is shown only once, when it is created: a lost token cannot be recovered and must be replaced.","Error 401 means the token is missing, wrong or revoked. Error 403 means the token is valid, but its user cannot see the record or the project.","Error 429 means the rate limit was reached: each token can make 100 requests per minute. Wait for the number of seconds given in the Retry-After header before sending again.","Error 500 is an error on our side. It is logged automatically, and retrying after a short wait usually works. Include the request ID of the response when you open a case."].join(`
|
|
40
|
+
|
|
41
|
+
`),facts:["A token is shown only once","Error 401 means the token is missing, wrong or revoked","100 requests per minute","the Retry-After header","Include the request ID"]},caseTemplates:[{subject:"API returns error 429 during our nightly sync",description:"Hello, {firstName} from {company}. Our nightly sync started failing with error 429 after we added more projects.",priority:"High",origin:"Email",followUp:"We added a pause between requests but still see some 429 errors. What limit should we stay under?",resolution:["The logs show the sync sending about 300 requests per minute with one token, above the limit of 100 requests per minute.","The customer now waits as long as the Retry-After header says, and the nightly sync completes. Case closed."]},{subject:"API token stopped working with error 401",description:"Hi, this is {firstName} at {company}. Our integration gets error 401 since yesterday, with no change on our side.",priority:"Medium",origin:"Web",followUp:"Can we see the old token again, so that we do not have to change every server?",resolution:["The token had been revoked by an administrator during a security review.","Explained that a token is shown only once; the customer created a new token and updated the integration. Case closed."]}],utterances:[{text:"Hi, I am {email}. Our API calls keep failing with error 429.",expectedOutcome:'The agent finds the open case "{caseSubject}", explains the limit of 100 requests per minute for each token, and says to wait for the number of seconds given in the Retry-After header.'},{text:"I lost our API token. Can you send it to me again?",expectedOutcome:"The agent explains that a token is shown only once and cannot be recovered, so a new one is created under Settings, API tokens."}]}],decoy:{title:"Two-factor authentication",summary:"Two-factor authentication adds a code from an authenticator app to a password sign-in. It does not apply to single sign-on.",body:["Two-factor authentication adds a code from an authenticator app to the password at sign-in. Each user turns it on under Profile, Security, and an administrator can require it for everyone under Admin, Security, Two-factor.","A user who loses their phone signs in with one of the 10 backup codes shown when they turned it on.","Two-factor authentication applies to password sign-ins only: users who sign in through single sign-on follow the rules of their identity provider."].join(`
|
|
42
|
+
|
|
43
|
+
`),resembles:"sso"},outOfScope:[{text:"Can you write the code for our company website?",expectedOutcome:"The agent says it cannot build websites and offers help with sign-in, invoices, data exports or the API."},{text:"What will the weather be like tomorrow?",expectedOutcome:"The agent declines and steers back to the customer's account."}]},sy=[cp,dp,lp];var pp=["name","firstName","lastName","jobTitle","email","username","nickname","phone","address","streetAddress","city","state","zipCode","country","company","catchPhrase","productName","productDescription","date","pastDate","futureDate","futureDateTime","birthdate","number","integer","float","boolean","lorem","sentence","paragraph","caseSubject","caseComment","uuid","url","iban","bic"],zo={"company.name":"company","company.catchPhrase":"catchPhrase","person.firstName":"firstName","person.lastName":"lastName","person.fullName":"name","person.jobTitle":"jobTitle","name.firstName":"firstName","name.lastName":"lastName","internet.email":"email","internet.userName":"username","internet.username":"username","internet.url":"url","phone.number":"phone","location.city":"city","location.country":"country","location.state":"state","location.zipCode":"zipCode","location.streetAddress":"streetAddress","lorem.sentence":"sentence","lorem.paragraph":"paragraph","string.uuid":"uuid","date.past":"pastDate","date.future":"futureDate","date.soon":"futureDate","date.birthdate":"birthdate","commerce.productName":"productName","commerce.productDescription":"productDescription","finance.iban":"iban","finance.bic":"bic"},up=new Set(pp);function dy(e){return up.has(e)?e:Object.prototype.hasOwnProperty.call(zo,e)?zo[e]:void 0}var _o={email:"email",phone:"phone",url:"url",date:"pastDate",datetime:"pastDate",int:"integer",double:"integer",currency:"integer",percent:"integer"};function Ze(e){return new RegExp(`^(billing|mailing|shipping|other)?${e}$|_${e}$`,"i")}var mp=[{pattern:/^user_?name$/i,method:"username"},{pattern:/^community_?nickname$/i,method:"nickname"},{pattern:/first_?name$/i,method:"firstName"},{pattern:/last_?name$/i,method:"lastName"},{pattern:/middle_?name$/i,method:"firstName"},{pattern:/(contact|person|assistant|supplied)_?name$/i,method:"name"},{pattern:/(company|account)_?name$|company$/i,method:"company"},{pattern:Ze("street"),method:"streetAddress"},{pattern:Ze("city"),method:"city"},{pattern:Ze("state"),method:"state"},{pattern:Ze("postal_?code"),method:"zipCode"},{pattern:/zip_?code$/i,method:"zipCode"},{pattern:Ze("country"),method:"country"}],Cn=new Set(["string","textarea"]),fp=new Set(["contact","lead","user","individual"]),gp=/^Person[A-Z]|__pc$/;function hp(e,t,n){let o=Oo(e,t,n);return o||(Cn.has(e.toLowerCase())?"sentence":void 0)}function Oo(e,t,n){let o=e.toLowerCase(),a=t.replace(/__p?c$/i,""),s=gp.test(t)||n!==void 0&&fp.has(n.toLowerCase());if(Cn.has(o)){let d=mp.find(({pattern:p})=>p.test(a))?.method;return d||(s&&/^title$/i.test(a)?"jobTitle":n?.toLowerCase()==="case"&&/^subject$/i.test(a)?"caseSubject":/name$/i.test(a)?s?"name":"company":void 0)}if(o==="date"){if(/birth_?date$/i.test(a))return"birthdate";if(/close_?date$/i.test(a))return"futureDate"}return Object.prototype.hasOwnProperty.call(_o,o)?_o[o]:void 0}function py(e){return e.type==="int"?e.digits??0:Math.max(0,(e.precision??0)-(e.scale??0))}var vn=1e3,yp=/(latitude|longitude)(__s)?$/i;function uy(e){if(e.referenceTo.length>0)return{ruleType:"reference",config:{referenceObject:e.referenceTo[0]}};if(e.type==="picklist")return e.picklistValues.length>0?{ruleType:"picklist_random",config:{picklistValues:[...e.picklistValues]}}:{ruleType:"static",config:{}};if(e.type==="double"&&yp.test(e.fieldApiName))return{ruleType:"static",config:{}};if(e.required===!1&&Cn.has(e.type.toLowerCase())&&!Oo(e.type,e.fieldApiName,e.objectApiName))return{ruleType:"static",config:e.length>0?{maxLength:e.length}:{}};let t=hp(e.type,e.fieldApiName,e.objectApiName),n=e.integerDigits??0,o=Math.min(n>0?10**n-1:vn,e.type==="percent"?100:vn);return t==="integer"&&o<vn?{ruleType:"faker",config:{fakerMethod:t,maxValue:o}}:t?{ruleType:"faker",config:e.length>0?{fakerMethod:t,maxLength:e.length}:{fakerMethod:t}}:e.type==="boolean"?{ruleType:"static",config:{staticValue:!1}}:{ruleType:"static",config:{}}}var fy=["NoTestRun","RunSpecifiedTests","RunLocalTests"];var gy={retrieve:5,deploy:30},hy=/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)?$/,yy=["CustomObject","CustomField","RecordType","ApexClass","ApexTrigger","LightningComponentBundle","Flow","WorkflowRule","ValidationRule","Layout","CustomLabel","CustomMetadata","StaticResource","EmailTemplate","Report","Dashboard"];var Nn=Object.freeze({"Sforce-Duplicate-Rule-Header":"allowSave=true"});var To="DUPLICATES_DETECTED";function bp(e){return e.includes(To)}var wo="DUPLICATE_VALUE";function xp(e){return e.includes(wo)}var ko="Sforce-Auto-Assign";function Io(e){return{...Nn,[ko]:e.applyAssignmentRules?"TRUE":"FALSE"}}function Sp(){return Io({applyAssignmentRules:!1})}var vo=new Set(["user","userrole","profile","permissionset","permissionsetassignment","recordtype","group","groupmember","queue"]),Co=new Set(["attachment","contentversion","document"]);function No(e){return vo.has(e.toLowerCase())}function Po(e){return Co.has(e.toLowerCase())}function Ep(e){return No(e)||Po(e)}var Ap=[...vo,...Co].sort();var Pn=Object.freeze({OpportunityLineItem:Object.freeze(["PricebookEntryId"]),OrderItem:Object.freeze(["PricebookEntryId"]),QuoteLineItem:Object.freeze(["PricebookEntryId"])});function jo(e,t){return Object.prototype.hasOwnProperty.call(Pn,e)?Pn[e].indexOf(t)!==-1:!1}function Rp(e,t,n){return n===!1||jo(e,t)}function zp(e){return e.createable!==!1||e.updateable!==!1}function _p(e){return e.createable!==!1&&e.updateable===!1}var Op={Order:{object:"OrderItem",lookup:"OrderId"}},jn={Order:[{object:"OrderItem",lookup:"OrderId"},{object:"OrderAction",lookup:"OrderId"}],Contract:[{object:"ContractItemPrice",lookup:"ContractId"}]};var Fo="PricebookEntry",Fn="Pricebook2",Dn="Pricebook2Id",Tp="SELECT Id FROM Pricebook2 WHERE IsStandard = true LIMIT 1";function wp(e){return e===Fo}function kp(e,t){return e.ruleType==="reference"&&e.config.referenceObject===Fn&&!t.has(Fn)}function Ip(e,t){if(!t)return{standard:[],custom:[...e]};let n=[],o=[];for(let a of e)a[Dn]===t?n.push(a):o.push(a);return{standard:n,custom:o}}var Lo="Product2Id",Do="ProductSellingModelId",vp="ProductSellingModel",Cp="ProductSellingModelOption",Ln="CurrencyIsoCode";function Np(e,t={}){return Mo(e,t).kept}function Mo(e,t={}){let n=t.oneCurrency,o=m=>(m.IsActive===!0?2:0)+(n?.code!==void 0&&m[Ln]===n.code?1:0),a=new Map,s=[],d=new Map;for(let m of e){let f=m[Dn],x=m[Lo];if(typeof f!="string"||typeof x!="string"){s.push(m);continue}let b=t.sellingModel?`|${String(m[Do]??"")}`:"",E=n?"":`|${String(m[Ln]??"")}`,O=`${f}|${x}${b}${E}`,k=a.get(O);if(k===void 0){a.set(O,s.length),n&&d.set(s.length,[m]),s.push(m);continue}d.get(k)?.push(m),o(m)>o(s[k])&&(s[k]=m)}let p=[];for(let[m,f]of d){let x=s[m];for(let b of f)b!==x&&p.push({left:b,kept:x})}return{kept:s,standsFor:p}}function Pp(e){return/^[A-Za-z][A-Za-z0-9_]*(__[a-zA-Z][a-zA-Z0-9]*)?$/.test(e)}function Oy(e){if(!e||!Pp(e))throw new Error(`Invalid Salesforce object API name: "${e}"`);return e}function Bo(e){return typeof e=="string"&&e.trim().toLowerCase()==="developer edition"}function wy(e){return e.isScratch===!0?"Scratch":e.isSandbox===!0?"Sandbox":Bo(e.edition)?"Developer":"Production"}var Uo={Production:"production",Sandbox:"development",Scratch:"scratch",Developer:"development"};function Go(e){return Object.prototype.hasOwnProperty.call(Uo,e)?Uo[e]:"production"}function Wo(e,t){return Go(e)==="production"&&Bo(t)?"Developer":e}function jp(e,t){return Go(Wo(e,t))}function Fp(e){let t=Wo(e?.orgType??"",e?.metadata?.edition);return e?.staging===!0&&t==="Sandbox"?"staging":jp(e?.orgType??"",e?.metadata?.edition)}function ky(e){return Fp(e)!=="production"}var Lp="#e74c3c",$o="#4a9eff";function Iy(e){switch(e){case"Sandbox":return{safetyTier:"medium",color:$o};case"Scratch":case"Developer":return{safetyTier:"low",color:$o};default:return{safetyTier:"critical",color:Lp}}}function vy(e,t){let n=e.metadata?.expirationDate;if(!(e.orgType!=="Scratch"||typeof n!="string"))return/^\d{4}-\d{2}-\d{2}$/.test(n)&&n<t?n:void 0}var Dp=/^[^\s@]+@[^\s@][^\s@.]*\.[^\s@]+$/;function Ye(e,t){let n=e?.trim();return!n||Dp.test(n)?!1:t===void 0||n.toLowerCase()!==t.trim().toLowerCase()}function Ny(e,t=""){if(!e)return t;if(Ye(e.alias,e.username))return e.alias.trim();let n=e.organizationName?.trim();if(n&&Ye(n,e.username))return n;let o=(e.orgId??e.organizationId)?.trim();return o||t}function jy(e){let t=e.files;return e.deleted.every(n=>n.deleted===0)&&e.restored.every(n=>n.restored+(n.restoredWithout??0)===0)&&e.undeleted.every(n=>n.undeleted===0)&&(e.recreated??[]).every(n=>n.created===0)&&(t===void 0||t.unlinked+t.relinked+t.linksUpdated===0)}function Mp(e){if(!Number.isFinite(e)||e<0||e===0)return"0ms";let t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),o=Math.floor(e%6e4/1e3);return t>0?n>0?`${t}h ${n}min`:`${t}h`:n>0?o>0?`${n}min ${o}s`:`${n}min`:o>0?`${o}s`:`${Math.round(e)}ms`}var Ho=["B","KB","MB","GB","TB"];function Ly(e){if(!Number.isFinite(e)||e<0||e===0)return"0 B";let t=Math.min(Math.floor(Math.log(e)/Math.log(1024)),Ho.length-1),n=e/Math.pow(1024,t);return`${t===0?n:parseFloat(n.toFixed(1))} ${Ho[t]}`}function Dy(e){return Mp(e*1e3)}var Ko="Account",Up=new Set(["FirstName","LastName","MiddleName","Suffix","Salutation"]);function $p(e){return Up.has(e)||e.endsWith("__pc")||e.startsWith("Person")&&!e.includes("__")}function Uy(e,t,n){return e!==Ko?!1:n==="person"?t==="Name":$p(t)}function $y(e,t){if(e===Ko){if(t==="Name")return"business";if(t==="LastName")return"person"}}var Bp="TRANSFORM_RULE_NO_FIELD",Vo={uppercase:"Uppercase",lowercase:"Lowercase",trim:"Trim",truncate:"Truncate",prefix:"Prefix",suffix:"Suffix",replace:"Replace",regex_replace:"Regex replace",map_value:"Map value",default_value:"Default value",format_date:"Format date",format_number:"Format number",custom_formula:"Custom formula"};function Gp(e){return typeof e.field=="string"&&e.field.trim()!==""}function Wp(e){let t=[];for(let n of e)for(let o of n.transformRules??[]){if(Gp(o))continue;t.some(s=>s.objectApiName===n.objectApiName&&s.type===o.type)||t.push({objectApiName:n.objectApiName,type:o.type})}return t}function qo(e){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Hp(e){let t=qo(e.map(n=>`${Vo[n.type]} on ${n.objectApiName}`));return e.length===1?`The rule ${t} names no field: open the configuration and pick its field. Without one it would change every field of every record, record types and lookups among them.`:`The rules ${t} name no field: open the configuration and pick their fields. Without one each would change every field of every record, record types and lookups among them.`}var Kp="TRANSFORM_RULE_BAD_PATTERN";function Vp(e){try{new RegExp(e,"g");return}catch(t){return(t instanceof Error?t.message:String(t)).replace(/^Invalid regular expression: \/.*\/[a-z]*: /s,"")}}function qp(e){let t=[],n=(o,a,s)=>{let d=a.config?.regex;if(a.type!=="regex_replace"||!d)return;let p=Vp(d);p!==void 0&&t.push({objectApiName:o,...s?{field:s}:{},pattern:d,reason:p})};for(let o of e){for(let a of o.transformRules??[])n(o.objectApiName,a,a.field?.trim());for(let a of o.fieldMappings??[])for(let s of a.transformRules??[])n(o.objectApiName,s,a.targetField)}return t}function Zp(e){let t=qo(e.map(n=>`${Vo.regex_replace} on ${n.objectApiName}${n.field?`.${n.field}`:""}, "${n.pattern}" (${n.reason})`));return e.length===1?`The rule ${t} has a pattern that is no regular expression: open the configuration and correct it, or remove the rule. Run, it would stop the run at that object before any of its records is written.`:`The rules ${t} have patterns that are no regular expressions: open the configuration and correct them, or remove the rules. Run, each would stop the run at its object before any of its records is written.`}var Tt=/System\.LimitException|Too many (?:SOQL queries|SOSL queries|DML statements|DML rows|query rows|future calls|queueable jobs added)|Apex CPU time limit exceeded|Apex heap size too large/i,wt=/Maximum (?:trigger|stack) depth/i,Yp=["Too many SOQL queries","Too many SOSL queries","Too many DML statements","Too many DML rows","Too many query rows","Too many future calls","Too many queueable jobs added","Apex CPU time limit exceeded","Apex heap size too large"],Xp="System.LimitException";function Zo(e){return e.replace(/\s+/g," ")}function Yo(e){let t=e.map(Zo);if(!t.some(n=>wt.test(n))){for(let n of t){let o=n.toLowerCase(),a=Yp.find(s=>o.includes(s.toLowerCase()));if(a!==void 0)return a}return t.some(n=>Tt.test(n))?Xp:void 0}}var Qp=/(?<![\w.])([A-Za-z]\w*(?:\.\w+)?): execution of (Before|After)(Insert|Update|Delete|Undelete)/,Jp=/^(?:[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+:\s*)?(?![A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+:)([A-Za-z]\w*(?:\.\w+)?): System\.LimitException/,eu=/Trigger\.(\w+(?:\.\w+)?): line \d+/;function Xo(e){let t=Zo(e).trim(),n=Qp.exec(t);if(n)return{automation:n[1],event:`${n[2]} ${n[3]}`.toLowerCase()};let o=Jp.exec(t);if(o)return{automation:o[1]};let a=eu.exec(t);return a?{automation:a[1]}:void 0}function tu(e){let t=Yo(e);if(t!==void 0){for(let n of e){let o=Xo(n);if(o)return{limit:t,...o}}return{limit:t}}}var nu=/^([A-Z][A-Z0-9_]*):([\s\S]*):([A-Za-z0-9_]+(?: [A-Za-z0-9_]+)*)? ?--$/,ru=/^([A-Z][A-Z0-9_]*):\s*([\s\S]*)$/,ou=/\[([A-Za-z0-9_]+(?:,\s*[A-Za-z0-9_]+)*)\]\s*$/,iu=/; (?=[A-Z][A-Z0-9_]*: )/;function Qo(e){let t=e.trim(),n=nu.exec(t);if(n)return{code:n[1],message:n[2],fields:n[3]===void 0?[]:n[3].split(" ")};let o=t.split(iu)[0],a=ru.exec(o);if(!a)return{code:null,message:t,fields:[]};let s=a[2],d=ou.exec(s);return{code:a[1],message:d?s.slice(0,d.index).trimEnd():s,fields:d?d[1].split(",").map(p=>p.trim()):[]}}function au(e){let t=new Map;for(let n of e){let o=Qo(n),a=o.code===null?`text:${o.message}`:`code:${o.code}:${[...o.fields].sort().join(",")}`,s=t.get(a);s?s.count++:t.set(a,{code:o.code,fields:o.fields,count:1,example:n})}return[...t.values()].sort((n,o)=>o.count-n.count)}var su=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,cu=/^[A-Za-z][A-Za-z0-9_]*$/;function Xe(e){return e.slice(0,15)}function Jo(e){let t=e.idRemapTable??{};return n=>{let o=Object.prototype.hasOwnProperty.call(t,n)?t[n]:void 0;return typeof o=="string"&&su.test(o)?o:void 0}}function Qe(e){let t=Jo(e),n=new Set(Array.isArray(e.idRemapExisting)?e.idRemapExisting:[]),o=Array.isArray(e.idRemapCreated)?e.idRemapCreated:[],a=new Set,s=[];for(let{objectApiName:d,sourceIds:p}of[...o].reverse()){if(!cu.test(d)||!Array.isArray(p))continue;let m=[];for(let f of[...p].reverse()){if(n.has(f))continue;let x=t(f);if(!x)continue;let b=Xe(x);a.has(b)||(a.add(b),m.push(x))}m.length>0&&s.push({objectApiName:d,ids:m})}return s}function ei(e){let t=Array.isArray(e.idRemapExisting)?e.idRemapExisting:[],n=new Set(Array.isArray(e.idRemapWithTheirRecord)?e.idRemapWithTheirRecord:[]),o=new Set(Qe(e).flatMap(({ids:s})=>s.map(d=>Xe(d)))),a=Jo(e);return t.filter(s=>{if(n.has(s))return!1;let d=a(s);return d===void 0||!o.has(Xe(d))})}function Je(e){return e!==void 0&&e.kept+e.refused+(e.notReached??0)+(e.notVisible??0)===0}function ti(e){return Je(e.undo)?[]:ni(Qe(e),e.removalLeft)}function ni(e,t){if(!Array.isArray(t))return e;let n=new Set(t.filter(o=>typeof o=="string").map(Xe));return e.flatMap(({objectApiName:o,ids:a})=>{let s=a.filter(d=>n.has(Xe(d)));return s.length>0?[{objectApiName:o,ids:s}]:[]})}function du(e){if(!e.targetOrgId||!Array.isArray(e.idRemapCreated))return;let t=e.remapInJournal&&e.journalId!==void 0&&e.journalPart!==void 0?{journalId:e.journalId,part:e.journalPart,left:oi(e)}:void 0;if(e.remapInJournal&&(!t||t.left.length===0))return;let n=t?[]:Qe(e);if(!t&&n.length===0)return;let o=(e.mayHaveBeenWritten??[]).reduce((a,{sourceIds:s})=>a+s.length,0);return{forgeId:e.forgeId,targetOrgId:e.targetOrgId,timestamp:e.timestamp,duration:e.duration,status:e.status,...e.cancelled?{cancelled:!0}:{},...e.writtenBetween?{writtenBetween:{...e.writtenBetween}}:{},...e.retryOf!==void 0?{retryOf:e.retryOf}:{},objects:n,...t?{inJournal:t}:{},linked:ii(e),...o>0?{mayHaveBeenWritten:o}:{},...e.undo?{undo:{...e.undo}}:{},...e.removalStamps?{removalStamps:{...e.removalStamps}}:{},...e.removalSpans?{removalSpans:[...e.removalSpans]}:{},...Array.isArray(e.removalLeft)?{removalLeft:[...e.removalLeft]}:{},...e.sweep?{sweep:{...e.sweep}}:{}}}function ri(e){return Je(e.undo)?[]:ni(e.objects.map(({objectApiName:t,ids:n})=>({objectApiName:t,ids:[...n]})),e.removalLeft)}function oi(e){return Je(e.undo)?[]:e.remapInJournal?e.journalGone?[]:Array.isArray(e.removalLeftByObject)?e.removalLeftByObject.filter(({count:t})=>t>0).map(t=>({...t})):[...e.idRemapByObject??[]].reverse().filter(({created:t})=>t>0).map(({objectApiName:t,created:n})=>({objectApiName:t,count:n})):ti(e).map(({objectApiName:t,ids:n})=>({objectApiName:t,count:n.length}))}function lu(e){return e.remapInJournal?e.journalGone?[]:[...e.idRemapByObject??[]].reverse().filter(({created:t})=>t>0).map(({objectApiName:t,created:n})=>({objectApiName:t,count:n})):Qe(e).map(({objectApiName:t,ids:n})=>({objectApiName:t,count:n.length}))}function pu(e){return Je(e.undo)?[]:e.inJournal?e.journalGone?[]:e.inJournal.left.filter(({count:t})=>t>0).map(t=>({...t})):ri(e).map(({objectApiName:t,ids:n})=>({objectApiName:t,count:n.length}))}function ii(e){return e.remapInJournal?Math.max(0,(e.linkedExistingCount??0)-(e.withTheirRecordCount??0)-(e.linkedToCreatedCount??0)):ei(e).length}function uu(e){return!e.included&&e.leftOutByUser!==!0&&e.recordCountUnknown!==!0&&e.recordCount===0&&e.status!=="error"&&e.errors.length===0}function mu(e){return!e.included&&e.leftOutByUser===!0&&e.errors.length===0}function fu(e,t){let n=new Set(t.map(a=>a.objectApiName)),o=[...(e.readByObject??[]).map(a=>a.objectApiName),...e.failedReads??[],...(e.idRemapByObject??[]).map(a=>a.objectApiName),...(e.idRemapCreated??[]).map(a=>a.objectApiName)];return[...new Set(o)].filter(a=>!n.has(a))}function xe(e,t){let n=e.detail?.[t];return typeof n=="string"&&n!==""?n:void 0}function gu(e,t){let n=e.detail?.[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ai(e){return xe(e,"developerName")??xe(e,"rule")??e.value??fe(e.id)?.value??""}function hu(e){let t=e?.indexOf("__")??-1;return e!==void 0&&t>0&&t<e.length-2?e.slice(0,t):void 0}function yu(e,t){let n=`Setup > Object Manager > ${e.objectApiName}`,o=`${n} > Fields & Relationships > ${e.field??""}`,a=`"${e.value??""}"`,s=`Setup > Users > the profile or a permission set of the user SandForge writes as > Object Settings > ${e.objectApiName}`;switch(e.change){case"add_picklist_value":return t?`${o} > Values: add or activate ${a}, then select it for record type ${t}`:`${o} > Values: add or activate ${a}`;case"select_picklist_value":return`${n} > Record Types > ${t??""} > ${e.field??""} > Edit: add ${a} to the selected values`;case"allow_dependent_value":return`${n} > Fields & Relationships > ${e.controllingField??""} > Field Dependencies > Edit: include ${a} of ${e.field??""} under the controlling values it comes with`;case"make_field_optional":return`${o} > Edit: untick Required, or give it a default value`;case"lengthen_field":return e.length!==void 0?`${o} > Edit: set its length to ${e.length} characters or more`:`${o} > Edit: make it longer`;case"widen_number":return`${o} > Edit: give it more digits before the decimal point`;case"create_record_type":return`${n} > Record Types > New: ${e.value??""}`;case"install_package":return`Install or upgrade the package with namespace ${e.namespace??""} in the target: record type ${e.value??""} comes with it, and Setup cannot create it`;case"open_record_type":return`${s} > Edit: make record type ${t??""} available`;case"activate_currency":return`Setup > Company Settings > Manage Currencies: activate ${e.value??""}`;case"loosen_lookup_filter":return`${o} > Edit: make its lookup filter optional, or let it take the records the clone names`;case"deactivate_validation_rule":return`${n} > Validation Rules > ${e.value??""} > Edit: untick Active, or give the user SandForge writes as the custom permission that bypasses it`;case"deactivate_duplicate_rule":return`Setup > Duplicate Rules > ${e.value??""}: deactivate it, or set it to Allow on create`;case"grant_create":return`${s} > Edit: tick Create`;case"grant_edit":return`Setup > Users > the profile or a permission set of the user SandForge writes as > Object Settings > ${e.value??""} > Edit: tick Read and Edit`;case"enable_feature":return`Turn on in the target the feature ${e.objectApiName} comes with, or assign the user SandForge writes as the permission set licence that includes it; then ${s} > Edit: tick Create`}}function bu(e,t){let n=e.detail?.[t];return Array.isArray(n)?n.filter(o=>typeof o=="string"&&o!==""):[]}function xu(e){let t={gapId:e.id,objectApiName:e.objectApiName,rows:e.rows};switch(e.kind){case"object_through_parent":return bu(e,"editOn").map(n=>({...t,value:n,change:"grant_edit"}));case"object_feature_off":return[{...t,change:"enable_feature"}];default:{let n=Su(e);return n?[n]:[]}}}function Su(e){let t={gapId:e.id,objectApiName:e.objectApiName,...e.field!==void 0?{field:e.field}:{},rows:e.rows},n=e.value!==void 0?{value:e.value}:{};switch(e.kind){case"picklist_value_refused":{let o=xe(e,"controllingField");return xe(e,"reason")==="controlling-value"&&o?{...t,...n,change:"allow_dependent_value",controllingField:o}:{...t,...n,change:xe(e,"reason")==="record-type"&&e.recordType!==void 0?"select_picklist_value":"add_picklist_value"}}case"dependent_value_invalid":{let o=xe(e,"controllingField");return{...t,...n,change:"allow_dependent_value",...o?{controllingField:o}:{}}}case"required_field_missing":return xe(e,"reason")==="excluded"?void 0:{...t,change:"make_field_optional"};case"value_too_long":{let o=gu(e,"longest");return{...t,change:"lengthen_field",...o!==void 0?{length:o}:{}}}case"number_out_of_range":return{...t,change:"widen_number"};case"record_type_unmapped":{let o=hu(e.value);return o!==void 0?{...t,...n,namespace:o,change:"install_package"}:{...t,...n,change:"create_record_type"}}case"record_type_unavailable":return{...t,change:"open_record_type"};case"currency_inactive":return{...t,...n,change:"activate_currency"};case"lookup_filter":return{...t,change:"loosen_lookup_filter"};case"validation_rule":return{...t,value:ai(e),change:"deactivate_validation_rule"};case"duplicate_rule":return{...t,value:ai(e),change:"deactivate_duplicate_rule"};case"object_not_createable":return{...t,change:"grant_create"};default:return}}function Eu(e){let t=new Map;for(let n of e){if(n.severity==="info")continue;let o=xu(n);if(o.length===0)continue;let a=n.recordType,s=`${n.objectApiName}|${a??""}`,d=t.get(s)??{objectApiName:n.objectApiName,...a!==void 0?{recordType:a}:{},changes:[]};for(let p of o)d.changes.push({...p,setup:yu(p,a)});t.set(s,d)}return[...t.values()].sort((n,o)=>n.objectApiName.localeCompare(o.objectApiName)||(n.recordType??"").localeCompare(o.recordType??"")).map(n=>({...n,changes:n.changes.sort((o,a)=>(o.field??"").localeCompare(a.field??"")||(o.value??"").localeCompare(a.value??"")||o.change.localeCompare(a.change))}))}var Au={create:["insert"],update:["update"],createAndUpdate:["insert","update"],delete:["delete"]},Ru={insert:["beforeInsert","afterInsert"],update:["beforeUpdate","afterUpdate"],delete:["beforeDelete","afterDelete"],undelete:[void 0,"afterUndelete"]},si=["insert","update","delete"],zu=[...si,"undelete"];function _u(e){return e.permissions.some(t=>t.bypass&&t.held===!0)}function et(e,t){let n=m=>(m??[]).filter(f=>Au[f.startsOn].includes(t)),o=m=>f=>({kind:m,name:f.label,when:f.timing==="afterSave"?"after":"before",flow:f,..._u(f)?{keptQuiet:!0}:{}}),a=n(e.flows),[s,d]=Ru[t],p=e.triggers.flatMap(m=>{let f=s!==void 0&&m.events.includes(s),x=m.events.includes(d);if(!f&&!x)return[];let b=f&&x?"beforeAndAfter":f?"before":"after";return[{kind:"trigger",name:m.name,when:b}]});return[...a.filter(m=>m.timing!=="afterSave").map(o("flow")),...p,...n(e.workflowRules).map(o("workflowRule")),...n(e.processes).map(o("process")),...a.filter(m=>m.timing==="afterSave").map(o("flow"))]}function It(e,t){return et(e,t)}function ci(e){return si.map(t=>({write:t,fired:et(e,t)})).filter(t=>t.fired.length>0)}function di(e){return e.objects.flatMap(t=>[...t.flows,...t.processes??[],...t.workflowRules??[]])}function Ou(e){let t=di(e).flatMap(n=>n.permissions.filter(o=>o.bypass).map(({name:o})=>o));return[...new Set(t)].sort((n,o)=>n.localeCompare(o))}function Tu(e){let t=di(e).flatMap(n=>n.permissions.filter(o=>o.bypass&&o.held===!0).map(({name:o})=>o));return[...new Set(t)].sort((n,o)=>n.localeCompare(o))}var wu=new Set(["conditions","definitions","userPermissions"]);function ku(e){return e.some(({part:t})=>!wu.has(t))}function kt(e,t,n=()=>!0){return e.objects.filter(o=>n(o.objectApiName)).flatMap(o=>et(o,t).filter(a=>a.keptQuiet!==!0).map(a=>({objectApiName:o.objectApiName,write:t,kind:a.kind,name:a.name,when:a.when})))}function Iu(e){return li(e,"insert")}function li(e,t){return e.objects.flatMap(n=>{let o=et(n,t).filter(s=>s.keptQuiet!==!0),a=new Map;for(let s of o)for(let d of s.flow?.messages??[]){if(d.kind!=="email"||!d.limit)continue;let p=a.get(d.limit)??{objectApiName:n.objectApiName,limit:d.limit,perRecord:0,sentBy:[]};p.perRecord++,p.sentBy.includes(s.name)||p.sentBy.push(s.name),a.set(d.limit,p)}return[...a.values()]})}function vu(e,t={}){let n=t.writes??(()=>!0),o=[],a=new Set,s=d=>{let p=`${d.objectApiName}\0${d.kind}\0${d.name}`;a.has(p)||(a.add(p),o.push(d))};for(let d of e.automation.objects){for(let m of e.firing){if(m.objectApiName!==d.objectApiName)continue;let{flow:f}=m;if(m.kind==="trigger"||f===void 0)continue;let x=(f.messages??[]).some(E=>E.kind==="email"),b=f.condition!=="read"&&f.timing!=="beforeSave";!x&&!b||s({objectApiName:m.objectApiName,kind:m.kind,name:m.name,why:x?"email":"notRead"})}let p=n(d.objectApiName,"insert")||n(d.objectApiName,"update");if(!(t.applyAssignmentRules!==!0||!p))for(let m of d.assignmentRules??[])s({objectApiName:d.objectApiName,kind:"assignmentRule",name:m.name,why:"assignment"})}return o}function Un(e,t){let n=e.objects.flatMap(o=>zu.filter(a=>t(o.objectApiName,a)).flatMap(a=>et(o,a)).flatMap(a=>(a.flow?.permissions??[]).filter(s=>s.bypass).map(s=>s.name)));return[...new Set(n)].sort((o,a)=>o.localeCompare(a))}function Cu(e,t){let n=new Set(t);return[...kt(e,"update",o=>n.has(o)),...kt(e,"delete")]}function Nu(e,t){let n=new Set(t);return Un(e,(o,a)=>a==="delete"||a==="update"&&n.has(o))}var $n=[["bringBack","undelete"],["recreate","insert"],["giveBack","update"],["setToDraft","update"],["delete","delete"]];function Pu(e,t){return $n.flatMap(([n,o])=>{let a=new Set(t[n]??[]);return kt(e,o,s=>a.has(s)).map(s=>({...s,step:n}))})}function ju(e,t){return t.length===0?e:{...e,delete:[...new Set([...e.delete??[],...t])]}}function Fu(e,t){if(e.refusal!==void 0)return[];let n=t.sweepUntied===!0&&e.untied?.refusal===void 0;return e.found.filter(({classes:o})=>o!==void 0&&(o.made+o.madeOver>0||t.sweepLate===!0&&o.late>0||n&&o.untied>0)).map(o=>o.objectApiName)}function Lu(e){return(t,n)=>$n.some(([o,a])=>a===n&&(e[o]??[]).includes(t))}function Du(e,t){return Un(e,(n,o)=>$n.some(([a,s])=>s===o&&(t[a]??[]).includes(n)))}function Bn(e,t){let n=e.bypassGrants??[];return t.flatMap(o=>{let a=n.find(p=>p.permission.toLowerCase()===o.toLowerCase());if(!a)return[];let[s,...d]=a.permissionSets;return[{permission:a.permission,...s?{permissionSet:s}:{},others:d}]})}function Mn(e){return/^[\w.@+:-]+$/.test(e)?e:`"${e.replace(/["\\$`]/g,"\\$&")}"`}function Mu(e,t,n){return`sf org assign permset --name ${Mn(e)} --target-org ${Mn(t)} --on-behalf-of ${Mn(n)}`}function Uu(e,t=new Set){let n=new Map(e.objects.map(o=>[o.objectApiName,o]));return e.objectsRead.filter(o=>!t.has(o)).flatMap(o=>{let a=n.get(o),d=(a?ci(a).find(p=>p.write==="delete")?.fired??[]:[]).filter(p=>p.keptQuiet!==!0).map(p=>({objectApiName:o,kind:p.kind!=="trigger"?"flow":p.name.includes(".")?"packageTrigger":"trigger",name:p.name}));return Object.prototype.hasOwnProperty.call(jn,o)?[...d,{objectApiName:o,kind:"lock"}]:d})}var Wn=["insert","update","delete","undelete"];function Gn(e){return`${e.objectApiName}
|
|
44
|
+
${e.kind}
|
|
45
|
+
${e.name}`}function $u(e){return e.kind==="trigger"?e.name.includes("."):(e.flow?.apiName??"").indexOf("__")>0}function Bu(e){return(e?.permissions??[]).filter(t=>t.bypass&&t.held!==!0).map(({name:t})=>t)}function Gu(e,t=()=>!0){let n=new Set,o=[],a=[],s=[],d=f=>{let x=f.toLowerCase(),b=s.find(R=>R.permissions.some(j=>j.toLowerCase()===x));if(b)return b;let[E]=Bn(e,[f]);if(!E?.permissionSet)return;let O=[E.permissionSet,...E.others].map(R=>R.name),k=s.find(R=>O.includes(R.permissionSet));if(k)return k.permissions.push(E.permission),k;let T={permissionSet:E.permissionSet.name,label:E.permissionSet.label,permissions:[E.permission]};return s.push(T),T};for(let f of e.objects)for(let x of Wn)if(t(f.objectApiName,x))for(let b of It(f,x)){if(b.keptQuiet===!0)continue;let E={objectApiName:f.objectApiName,kind:b.kind,name:b.name},O=Gn(E);if(n.has(O))continue;n.add(O);let k=b.kind==="trigger"?[]:Bu(b.flow),T=k.find(j=>d(j)!==void 0);if(T!==void 0){o.push({...E,permission:T});continue}let R=$u(b)?"managedPackage":k.length>0?"noPermissionSet":b.flow!==void 0&&b.flow.condition!=="read"?"notRead":"noBypass";a.push({...E,why:R})}for(let f of s)f.permissions.sort((x,b)=>x.localeCompare(b));let{alsoLifts:p,liftsUnread:m}=Hu(e,s,o,t);return{assign:s,silenced:o,stillRuns:a,...p.length>0?{alsoLifts:p}:{},...m.length>0?{liftsUnread:m}:{}}}function Wu(e,t){return e.bypassGrants?.flatMap(n=>n.permissionSets).find(n=>n.name===t)}function Hu(e,t,n,o){let a=[],s=[];if(t.length===0)return{alsoLifts:a,liftsUnread:s};let d=[];for(let{permissionSet:b}of t){let E=Wu(e,b);if(E?.customPermissions===void 0){s.push({part:"grants",permissionSet:b,...E?.customPermissionsUnread?{reason:E.customPermissionsUnread}:{}});continue}d.push({permissionSet:b,permissions:new Set(E.customPermissions.map(O=>O.toLowerCase()))})}if(d.length===0)return{alsoLifts:a,liftsUnread:s};let p=b=>d.find(E=>E.permissions.has(b.toLowerCase()))?.permissionSet,m=b=>Wn.some(E=>o(b,E)),f=new Set(n.map(Gn));for(let b of e.objects){if(!m(b.objectApiName))continue;let E=[["flow",b.flows],["process",b.processes??[]],["workflowRule",b.workflowRules??[]]];for(let[O,k]of E)for(let T of k){let R={objectApiName:b.objectApiName,kind:O,name:T.label};if(f.has(Gn(R))||T.permissions.some(U=>U.bypass&&U.held===!0))continue;let j=T.permissions.find(U=>U.bypass&&U.held!==!0&&p(U.name)!==void 0);j&&a.push({...R,permission:j.name,permissionSet:p(j.name)})}}if(e.validationRuleBypasses===void 0)return s.push({part:"validationRules",...e.validationRulesUnread?{reason:e.validationRulesUnread}:{}}),{alsoLifts:a,liftsUnread:s};for(let b of e.validationRuleBypasses){if(!m(b.objectApiName))continue;let E=b.permissions.find(O=>p(O)!==void 0);E!==void 0&&a.push({objectApiName:b.objectApiName,kind:"validationRule",name:b.name,permission:E,permissionSet:p(E)})}let x=e.validationRulesNotRead??0;return x>0&&s.push({part:"validationRules",rules:x}),{alsoLifts:a,liftsUnread:s}}function pi(e){let t=e.assign.flatMap(n=>n.permissions);return[...new Set(t)].sort((n,o)=>n.localeCompare(o))}function ui(e,t){if(t.length===0)return e;let n=new Set(t.map(s=>s.toLowerCase())),o=s=>s.permissions.some(d=>d.bypass&&n.has(d.name.toLowerCase()))?{...s,permissions:s.permissions.map(d=>d.bypass&&n.has(d.name.toLowerCase())?{...d,held:!0}:d)}:s,a=e.bypassGrants?.filter(s=>!n.has(s.permission.toLowerCase()));return{...e,objects:e.objects.map(s=>({...s,flows:s.flows.map(o),...s.processes?{processes:s.processes.map(o)}:{},...s.workflowRules?{workflowRules:s.workflowRules.map(o)}:{}})),...a!==void 0?{bypassGrants:a}:{}}}function Ku(e,t,n=()=>!0){let o=t?ui(e,pi(t)):e,a=[];for(let s of o.objects)for(let d of Wn)if(n(s.objectApiName,d))for(let p of It(s,d))p.keptQuiet!==!0&&a.push({objectApiName:s.objectApiName,kind:p.kind,name:p.name,write:d,...p.flow?{flow:p.flow}:{}});return{automation:o,firing:a}}function Vu(e){return{state:e.state,assigned:[...e.assigned],held:[...e.held],silenced:e.silenced.length,stillRan:e.stillRan.length,...e.alsoLifted!==void 0?{alsoLifted:e.alsoLifted.length}:{},...e.released!==void 0?{released:e.released}:{}}}var qu={flow:"flow",trigger:"Apex trigger",process:"process",workflowRule:"workflow rule"},Zu={noBypass:"no bypass in its condition",managedPackage:"installed by a managed package",notRead:"its condition was not read",noPermissionSet:"no permission set holds its bypass"};function Yu(e){return`${e.objectApiName}: ${qu[e.kind]} "${e.name}"`}function Xu(e){return Zu[e]}var Qu={validationRule:"validation rule",flow:"flow",process:"process",workflowRule:"workflow rule"};function Ju(e){return`${Qu[e.kind]} "${e.name}" on ${e.objectApiName} (${e.permission}, in ${e.permissionSet})`}function em(e){let t=e.reason?` (${e.reason})`:"";return e.part==="grants"?`what ${e.permissionSet??"a permission set"} grants could not be read${t}: what else it lifts is not known`:e.rules!==void 0?`${e.rules} validation rule formula(s) not read: whether the sets lift those rules is not known`:`the validation rules of the objects written could not be read${t}: whether the sets lift any is not known`}var tm=new Set(["eq","neq","gt","gte","lt","lte","contains","not_contains","matches","is_empty","is_not_empty"]),nm=new Set(["gt","gte","lt","lte"]),rm=new Set(["is_empty","is_not_empty"]);function Ct(e){return e==null||e===""}function Kn(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string"||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0}function om(e){if(typeof e=="boolean")return e;if(typeof e!="string")return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}function vt(e){return Ct(e)?"":String(e)}function im(e){try{return new RegExp(e),!0}catch{return!1}}function mi(e,t){return typeof t=="number"?Kn(e)===t:typeof t=="boolean"?om(e)===t:vt(e)===String(t)}function am(e,t){let n=Number(e.value),o=Kn(t);if(o===void 0)throw new Error(Ct(t)?`"${e.field}" has no value to compare with ${n}`:`"${e.field}" is ${JSON.stringify(t)}, not a number to compare with ${n}`);return e.operator==="gt"?o>n:e.operator==="gte"?o>=n:e.operator==="lt"?o<n:o<=n}function fi(e){if(!e||typeof e.field!="string"||e.field.trim()==="")return"names no field to test";let{field:t,operator:n,value:o}=e;if(!tm.has(n))return`uses an unknown operator: ${String(n)}`;if(!rm.has(n)){if(typeof o!="string"&&typeof o!="number"&&typeof o!="boolean")return`compares "${t}" with no value`;if(nm.has(n)&&Kn(o)===void 0)return`compares "${t}" with ${JSON.stringify(o)}, which is not a number`;if(n==="matches"&&!im(String(o)))return`matches "${t}" against ${JSON.stringify(o)}, which is not a valid pattern`}}function sm(e,t){let n=fi(e);if(n!==void 0)throw new Error(`the condition ${n}`);let o=Object.hasOwn(t,e.field)?t[e.field]:void 0,a=e.value;switch(e.operator){case"eq":return mi(o,a);case"neq":return!mi(o,a);case"gt":case"gte":case"lt":case"lte":return am(e,o);case"contains":return vt(o).includes(String(a));case"not_contains":return!vt(o).includes(String(a));case"matches":return new RegExp(String(a)).test(vt(o));case"is_empty":return Ct(o);case"is_not_empty":return!Ct(o)}}var gi="previousStepStatus",hi="compareDifferenceCount",Hn={apiLimits:"apiUsagePercent",storage:"storageUsagePercent",recentErrors:"recentErrorCount",failedJobs:"failedJobCount"};function cm(e){let t=e.config?.checks;return Array.isArray(t)?t:[]}function dm(e,t,n){let{field:o}=e;if(n.has(o))return;if(o===gi)return t.length>0?void 0:"noEarlierStep";if(o===hi)return t.some(s=>s.type==="compare")?void 0:"noCompare";let a=Object.keys(Hn).find(s=>Hn[s]===o);if(a!==void 0)return t.some(s=>s.type==="precheck"&&cm(s).includes(a))?void 0:"noPrecheck"}var lm=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),pm=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function se(e,t){return e>>>t|e<<32-t}function Nt(e){let t=new TextEncoder().encode(e),n=new Uint8Array(Math.ceil((t.length+9)/64)*64);n.set(t),n[t.length]=128;let o=new DataView(n.buffer),a=t.length*8;o.setUint32(n.length-8,Math.floor(a/4294967296)),o.setUint32(n.length-4,a>>>0);let s=Uint32Array.from(pm),d=new Uint32Array(64);for(let p=0;p<n.length;p+=64){for(let R=0;R<16;R++)d[R]=o.getUint32(p+R*4);for(let R=16;R<64;R++){let j=d[R-15],U=d[R-2],me=se(j,7)^se(j,18)^j>>>3,D=se(U,17)^se(U,19)^U>>>10;d[R]=d[R-16]+me+d[R-7]+D}let[m,f,x,b,E,O,k,T]=s;for(let R=0;R<64;R++){let j=se(E,6)^se(E,11)^se(E,25),U=E&O^~E&k,me=T+j+U+lm[R]+d[R]>>>0,D=se(m,2)^se(m,13)^se(m,22),ne=m&f^m&x^f&x,Ee=D+ne>>>0;T=k,k=O,O=E,E=b+me>>>0,b=x,x=f,f=m,m=me+Ee>>>0}s[0]+=m,s[1]+=f,s[2]+=x,s[3]+=b,s[4]+=E,s[5]+=O,s[6]+=k,s[7]+=T}return Array.from(s,p=>p.toString(16).padStart(8,"0")).join("")}var bi=["seed","sync","backup","restore","anonymize","delete","checkpoint","rewind","compare","precheck","notification","approval","delay","condition"],xi=["script","loop","parallel"];function um(e){return typeof e=="string"&&bi.includes(e)}function mm(e){return typeof e=="string"&&xi.includes(e)}var Si=60,Ei=1440,Ai=500;function Ri(e){let t=e?.timeoutMinutes;return t===void 0?Si:typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=Ei?t:void 0}function fm(e){if(Ri(e)===void 0)return"timeout";let t=e?.message;if(t!==void 0)return typeof t=="string"&&t.trim().length<=Ai?void 0:"message"}var Pt=i().max(128).refine(e=>e.trim()!=="","Name the org"),zi=i().max(200).refine(e=>e.trim()!=="","Name the template"),_i=i().regex(/^[A-Za-z][A-Za-z0-9_]*$/,"Not a Salesforce API name").max(80),gm=1e3,Vn=l(_i).min(1).max(gm).refine(e=>new Set(e).size===e.length,"An object is named twice"),Oi=30,Ti=3650,qn="{date}",hm=20,yi=120,ym=i().refine(e=>e.trim()!=="","Name the checkpoint, or leave the name out").refine(e=>!new RegExp("\\p{Cc}","u").test(e),"A checkpoint name is one line of text").refine(e=>e.split(qn).join("x".repeat(hm)).trim().length<=yi,`A checkpoint name is at most ${yi} characters once ${qn} is replaced`),bm=g({orgId:Pt,mode:ht,objects:Vn.optional(),excluded:Vn.optional(),name:ym.optional(),keepDays:c().int().min(0).max(Ti).default(Oi),maxTotal:c().int().min(1).optional(),ignoredFields:De.optional()}).refine(e=>e.mode==="picked"?e.objects!==void 0:e.objects===void 0,{path:["objects"],message:'Name the objects with "picked", and none with "everything"'}),xm=i().refine(e=>e.trim().toLowerCase()!=="latest","A Rewind step names its checkpoint by its id, never latest").pipe(Z),Sm=g({orgId:Pt,checkpointId:xm,objects:Vn.optional(),acceptAutomation:y().default(!1),acceptEmails:y().default(!1),muteAutomation:y().default(!1),acceptNoUndo:y().default(!1),acceptRecreate:y().default(!1),acceptOutside:y().default(!1),acceptUnseen:y().default(!1),maxRecords:c().int().min(1),refuseWhenActive:y().default(!0)}),Em=g({orgId:Pt,templateId:zi}),Am=2e3,Rm=g({orgId:Pt,templateId:zi,object:_i.optional(),where:i().max(Am).optional(),acceptAutomation:y().default(!1),acceptEmails:y().default(!1),muteAutomation:y().default(!1)}).refine(e=>e.where===void 0||e.where.trim()===""||e.object!==void 0,{path:["where"],message:"A condition filters the rows of one object: name the object"}),zm="sandforge-rewind-grant/2";function _m(e){let t={binding:zm,orgId:e.orgId,checkpointId:e.checkpointId,objects:e.objects===void 0?null:[...e.objects].sort(),acceptAutomation:e.acceptAutomation,acceptEmails:e.acceptEmails,...e.muteAutomation?{muteAutomation:!0}:{},acceptNoUndo:e.acceptNoUndo,acceptRecreate:e.acceptRecreate,acceptOutside:e.acceptOutside,acceptUnseen:e.acceptUnseen,maxRecords:e.maxRecords,refuseWhenActive:e.refuseWhenActive};return`sha256:${Nt(JSON.stringify(t))}`}var Se=1,vi=".sandforge-pipeline.json",Om=80,Qn={"pipeline.timeout":{type:"number",minimum:3e4,maximum:36e5},"sync.maxRecordsPerObject":{type:"integer",minimum:1,maximum:5e4},"sync.defaultBatchSize":{type:"number",minimum:1,maximum:1e4},"seed.defaultBatchSize":{type:"number",minimum:1,maximum:1e4},"backup.maxRecordsPerObject":{type:"integer",minimum:100,maximum:1e6},"backup.maxCount":{type:"number",minimum:1,maximum:100},"backup.maxAgeDays":{type:"integer",minimum:0,maximum:3650},"safety.auditLogging":{type:"boolean"},"safety.confirmAboveRecords":{type:"number",minimum:0},"grappe.enabled":{type:"boolean"},"grappe.autoActivateThreshold":{type:"number",minimum:1},"grappe.grappeSize":{type:"number",minimum:1}};var Zn={backup:["orgId"],compare:["sourceOrgId","targetOrgId"],precheck:["orgId"],seed:["orgId"],anonymize:["orgId"],checkpoint:["orgId"],rewind:["orgId"]},Tm=["sourceOrgId","targetOrgId"],wi="configId",wm=/^SandForge (\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/,km=/^00D[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,Im=/^[^\s=]+$/,vm=/^[A-Z][A-Z0-9_]{0,63}$/,Cm=/^sha256:[0-9a-f]{64}$/,ki={sandbox:"a sandbox",scratch:"a scratch org",developer:"a Developer Edition org",production:"a production org"};function Nm(e){return`${e.map(n=>`"${n}"`).join(", ")} ${e.length===1?"is":"are"} not part of a version-${Se} pipeline file: remove it, or run the file with the release that exported it.`}function tt(e){return u(e,{error:t=>t.code==="unrecognized_keys"?Nm(t.keys):void 0})}function ce(e){let t=Qn[e],n=t.type==="integer"?c().int():c();return t.minimum!==void 0&&(n=n.min(t.minimum)),t.maximum!==void 0&&(n=n.max(t.maximum)),n.optional()}var Pm=u({"pipeline.timeout":ce("pipeline.timeout"),"sync.maxRecordsPerObject":ce("sync.maxRecordsPerObject"),"sync.defaultBatchSize":ce("sync.defaultBatchSize"),"seed.defaultBatchSize":ce("seed.defaultBatchSize"),"backup.maxRecordsPerObject":ce("backup.maxRecordsPerObject"),"backup.maxCount":ce("backup.maxCount"),"backup.maxAgeDays":ce("backup.maxAgeDays"),"safety.auditLogging":y().optional(),"safety.confirmAboveRecords":ce("safety.confirmAboveRecords"),"grappe.enabled":y().optional(),"grappe.autoActivateThreshold":ce("grappe.autoActivateThreshold"),"grappe.grappeSize":ce("grappe.grappeSize")},{error:e=>e.code==="unrecognized_keys"?`${e.keys.map(t=>`"${t}"`).join(", ")} ${e.keys.length===1?"is not a setting":"are not settings"} a pipeline file takes. It takes ${Object.keys(Qn).join(", ")}.`:void 0}),jm=ot({id:i().min(1,"A step needs an id: the routes between steps name it.").max(200),name:i().min(1,"A step needs a name: --approve and every refusal name it.").max(200),type:i().min(1).max(80),config:w(i(),ee()).default({})}),Fm=g({name:i().min(1).max(200),type:h(["string","number","boolean","secret"]),defaultValue:i().max(2e3).optional(),required:y().default(!1),description:i().max(2e3).default("")}),Lm=tt({id:i().min(1).max(200),name:i().min(1).max(200),description:i().max(5e3).default(""),steps:l(jm).max(200),variables:l(Fm).max(200).default([]),tags:l(i().max(100)).max(50).default([])}),Dm=tt({cron:i().trim().min(1).max(200),timezone:i().trim().min(1).max(100)}),Mm=tt({alias:i().trim().min(1).max(255).optional(),organizationId:i().regex(km,"Not an Organization Id: 00D and 12 or 15 letters and digits."),kind:h(["sandbox","scratch","developer","production"]),staging:y().default(!1),name:i().trim().min(1).max(255).optional()}),Um=i().min(1).max(200).regex(Im,`An org's key is what --org <key>=<alias> names: neither a space nor "=".`),Ii=ot({id:i().min(1).max(200)}),$m=ot({id:i().min(1).max(200),sourceOrgId:i().optional(),targetOrgId:i().optional()}),Bm=tt({code:i().regex(vm,"A note code is written in capitals: APPROVAL_NEEDS_PERSON."),text:i().min(1).max(2e3),step:i().max(200).optional(),org:i().max(200).optional()}),Ci=tt({sandforgePipeline:S(Se,{error:`The version of a pipeline file this release reads is ${Se}.`}),exportedAt:de.datetime({offset:!0,error:"Not a date and time (ISO 8601)."}),exportedBy:i().min(1).max(100),digest:i().regex(Cm,"Not a digest: sha256: and 64 hex digits."),pipeline:Lm,schedule:Dm.nullable().default(null),orgs:w(Um,Mm),syncConfigs:w(i().min(1).max(200),$m).default({}),seedTemplates:w(i().min(1).max(200),Ii).default({}),maskingTemplates:w(i().min(1).max(200),Ii).default({}),settings:Pm.default({}),notes:l(Bm).max(500).default([])});function H(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function jt(e){return typeof e=="string"&&e.trim()!==""?e:void 0}function Te(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ni(e){let t=H(e),n=[],o=H(t?.pipeline)?.steps;(Array.isArray(o)?o:[]).forEach((a,s)=>{let d=H(a),p=d?.type,m=jt(d?.id);if(typeof p!="string"||m===void 0||!Te(Zn,p))return;let f=Zn[p]??[],x=H(d?.config);for(let b of f){let E=jt(x?.[b]);E!==void 0&&n.push({key:E,field:b,stepId:m,at:["pipeline","steps",s,"config",b],who:`Step "${String(d?.name??m)}"`})}});for(let[a,s]of Object.entries(H(t?.syncConfigs)??{})){let d=H(s);for(let p of Tm){let m=jt(d?.[p]);m!==void 0&&n.push({key:m,field:p,syncConfigId:a,at:["syncConfigs",a,p],who:`Sync configuration "${a}"`})}}return n}function Pi(e){let t=[],n=H(e),o=H(n?.pipeline),a=o?.variables;(Array.isArray(a)?a:[]).forEach((f,x)=>{let b=H(f),E=typeof b?.name=="string"?b.name:"";E.includes("=")&&t.push({at:["pipeline","variables",x,"name"],message:`Variable "${E}" has "=" in its name, which --var <name>=<value> cannot give.`}),b?.type==="secret"&&b.defaultValue!==void 0&&t.push({at:["pipeline","variables",x,"defaultValue"],message:`Variable "${E}" is a secret: a pipeline file never holds its value. Remove "defaultValue", and give it as the run starts with --var-env ${E}=<environment variable>.`})});let s=H(n?.orgs)??{},d=H(n?.syncConfigs)??{},p=o?.steps;(Array.isArray(p)?p:[]).forEach((f,x)=>{let b=H(f);if(b?.type!=="sync")return;let E=jt(H(b.config)?.[wi]);E===void 0||Te(d,E)||t.push({at:["pipeline","steps",x,"config",wi],message:`Sync step "${String(b.name??"")}" runs the configuration "${E}", which "syncConfigs" does not hold: export the pipeline again.`})});let m=Ni(e);for(let f of m.filter(x=>x.stepId!==void 0))Te(s,f.key)||t.push({at:f.at,message:`${f.who} names the org "${f.key}" (${f.field}), which "orgs" does not hold: export the pipeline again.`});for(let[f,x]of Object.entries(s)){let b=H(x);if(!b)continue;typeof b.alias=="string"&&!Ye(b.alias,void 0)&&t.push({at:["orgs",f,"alias"],message:`The alias of org "${f}" is shaped as a username, which a pipeline file never holds. Give the org an alias of its own with the Salesforce CLI, remove "alias" here, and run with --org ${f}=<alias>.`}),typeof b.name=="string"&&!Ye(b.name,void 0)&&t.push({at:["orgs",f,"name"],message:`The name of org "${f}" is shaped as a username, which a pipeline file never holds: remove it.`});let E=b.kind;if(b.staging===!0&&typeof E=="string"&&E!=="sandbox"){let O=Te(ki,E)?ki[E]:E;t.push({at:["orgs",f,"staging"],message:`Org "${f}" is ${O}: the Staging mark is read of a sandbox alone, and a run would not ask what it asks of a Staging sandbox. Remove "staging".`})}}for(let f of["syncConfigs","seedTemplates","maskingTemplates"])for(let[x,b]of Object.entries(H(n?.[f])??{})){let E=H(b)?.id;typeof E!="string"||E===x||t.push({at:[f,x,"id"],message:`"${x}" holds the one whose id is "${E}": the steps name each by its own id.`})}for(let f of m.filter(x=>x.syncConfigId!==void 0))Te(s,f.key)||t.push({at:f.at,message:`${f.who} names the org "${f.key}" (${f.field}), which "orgs" does not hold: export the pipeline again.`});return t}function Gm(e){let t=e.code==="invalid_key"&&e.issues.length>0?e.issues.map(n=>n.message).join("; "):e.message;return{path:e.path.map(String).join("."),message:t}}function ji(e){let t=Ci.safeParse(e),n=[...t.success?[]:t.error.issues.map(Gm),...Pi(e).map(({at:o,message:a})=>({path:o.join("."),message:a}))];return!t.success||n.length>0?{ok:!1,issues:n}:{ok:!0,file:t.data}}var Wm=Ci.superRefine((e,t)=>{for(let n of Pi(e))t.addIssue({code:"custom",path:n.at,message:n.message})});function Yn(e){if(Array.isArray(e))return`[${e.map(o=>o===void 0?"null":Yn(o)).join(",")}]`;let t=H(e);return t?`{${Object.keys(t).filter(o=>t[o]!==void 0).sort().map(o=>`${JSON.stringify(o)}:${Yn(t[o])}`).join(",")}}`:JSON.stringify(e)??"null"}function Jn(e){return`sha256:${Nt(Yn({sandforgePipeline:e.sandforgePipeline,pipeline:e.pipeline,schedule:e.schedule,orgs:e.orgs,syncConfigs:e.syncConfigs,seedTemplates:e.seedTemplates,maskingTemplates:e.maskingTemplates,settings:e.settings}))}`}function er(e){return wm.exec(e)?.[1]}var Fi="Export the pipeline from the Automation page (Export\u2026) to get a pipeline file.",Hm=`This is not a SandForge pipeline file: it has no "sandforgePipeline" version. ${Fi}`;function Xn(e,t,n={}){return{ok:!1,refusal:{code:e,message:t,issues:[],...n}}}function Li(e){let t=H(e);if(!t||!Te(t,"sandforgePipeline"))return Xn("PIPELINE_FILE_NOT_A_PIPELINE",Hm);let n=t.sandforgePipeline;if(typeof n=="number"&&Number.isInteger(n)&&n>Se){let a=t.exportedBy,s=typeof a=="string"?er(a):void 0,d=s?`SandForge ${s}`:"a later release of SandForge";return Xn("PIPELINE_FILE_NEWER",`This pipeline file is in version ${n} of the format, written by ${d}; this release reads version ${Se}. Run it with ${s?`SandForge ${s}`:"the release that exported it"} or a later one.`,{fileVersion:n,...s?{exporterVersion:s}:{}})}let o=ji(e);if(!o.ok){let a=o.issues.length;return{ok:!1,refusal:{code:"PIPELINE_FILE_INVALID",message:`This pipeline file does not read: ${a} ${a===1?"issue":"issues"}. Fix the file, or export the pipeline again.`,issues:o.issues,...typeof n=="number"?{fileVersion:n}:{}}}}return{ok:!0,file:o.file,digestMatches:Jn(o.file)===o.file.digest}}function Km(e){let t;try{t=JSON.parse(e)}catch(n){let o=n instanceof Error?n.message:"",a=/line (\d+) column (\d+)/.exec(o),s=a?` at line ${a[1]}, column ${a[2]}`:"";return Xn("PIPELINE_FILE_NOT_JSON",`This file is not JSON${s}. ${Fi}`)}return Li(t)}function Vm(e){let t=`SandForge ${e.sandforgeVersion}`,n={sandforgePipeline:Se,exportedAt:e.exportedAt,exportedBy:t,digest:`sha256:${"0".repeat(64)}`,pipeline:e.pipeline,schedule:e.schedule,orgs:e.orgs,syncConfigs:e.syncConfigs,seedTemplates:e.seedTemplates,maskingTemplates:e.maskingTemplates,settings:e.settings,notes:e.notes},o=ji(n),a=er(t)===void 0?[{path:"exportedBy",message:`"${e.sandforgeVersion}" is no release of SandForge.`}]:[];if(!o.ok)return{ok:!1,issues:[...a,...o.issues]};if(a.length>0)return{ok:!1,issues:a};let s={...o.file,digest:Jn(o.file)};return{ok:!0,file:s,text:`${JSON.stringify(s,null,2)}
|
|
46
|
+
`}}function qm(e){return Ni(e).map(({key:t,field:n,stepId:o,syncConfigId:a})=>({key:t,field:n,...o!==void 0?{stepId:o}:{},...a!==void 0?{syncConfigId:a}:{}}))}function Zm(e){let t=e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,Om).replace(/^-+|-+$/g,"");return`${t===""?"pipeline":t}${vi}`}var cb={runOpen:"SLICE_RUN_OPEN",deleteAlone:"SLICE_DELETE_ALONE",tooMany:"SLICES_EXCEEDED",diskShort:"SLICE_DISK_SHORT",keyLost:"SLICE_KEY_LOST",readTooHeavy:"SLICE_READ_TOO_HEAVY",nothingToAbandon:"NOTHING_TO_ABANDON",needsStore:"SLICES_NEED_STORE"};var lb=["Account","Contact","Opportunity","Case","Lead"];function Ym(e){return e===1}var Xm={id:i().min(1),timestamp:c().finite(),correlationId:i().min(1).optional()};function r(e){return g({...Xm,type:S(e),payload:ee().optional()}).loose()}var Di=[r("org:list"),r("org:list:response"),r("org:connect"),r("org:connect:cancel"),r("org:device-code"),r("org:disconnect"),r("org:select"),r("org:update"),r("org:open-in-browser"),r("org:open-in-browser:response"),r("org:cli-status"),r("org:cli-status:response"),r("org:statusChanged"),r("org:selected"),r("org:error")],mb=C("type",Di),Mi=[r("seed:execute"),r("seed:describe-global"),r("seed:describe-object"),r("seed:execute:response"),r("seed:describe-global:response"),r("seed:describe-object:response"),r("seed:error"),r("seed:removal:info"),r("seed:removal:info:response"),r("seed:removal:list"),r("seed:removal:list:response"),r("seed:remove"),r("seed:remove:response"),r("seed:remove:error"),r("seed:remove:sweep"),r("seed:remove:sweep:response"),r("seed:remove:sweep:error"),r("seed:open-record"),r("seed:open-record:response"),r("seed:open-record:error"),r("seed:automation"),r("seed:automation:response"),r("seed:automation:error"),r("seed:template:save"),r("seed:template:load"),r("seed:template:list"),r("seed:template:delete"),r("seed:template:save:response"),r("seed:template:load:response"),r("seed:template:list:response"),r("seed:template:delete:response"),r("seed:csv:execute"),r("seed:csv:execute:response"),r("seed:csv:validate"),r("seed:csv:validate:response"),r("seed:csv:error"),r("seed:clone:execute"),r("seed:clone:execute:response"),r("seed:clone:preview"),r("seed:clone:preview:response"),r("seed:clone:describe-source"),r("seed:clone:describe-source:response"),r("seed:clone:error"),r("seed:list-personas"),r("seed:list-personas:response"),r("seed:create-persona"),r("seed:create-persona:response"),r("seed:scenario:packs"),r("seed:scenario:packs:response"),r("seed:scenario:prepare"),r("seed:scenario:prepare:response"),r("seed:scenario:execute"),r("seed:scenario:agents"),r("seed:scenario:agents:response"),r("seed:scenario:save"),r("seed:scenario:save:response"),r("seed:scenario:test-file"),r("seed:scenario:test-file:response")],fb=C("type",Mi),Ui=[r("sync:execute"),r("sync:describe-global"),r("sync:describe-fields"),r("sync:execute:response"),r("sync:simulate"),r("sync:simulate:response"),r("sync:write-order"),r("sync:write-order:response"),r("sync:pause"),r("sync:pause:response"),r("sync:resume"),r("sync:resume:response"),r("sync:describe-global:response"),r("sync:describe-fields:response"),r("sync:error"),r("sync:config:save"),r("sync:config:load"),r("sync:config:list"),r("sync:config:delete"),r("sync:config:reset-delta"),r("sync:config:save:response"),r("sync:config:load:response"),r("sync:config:list:response"),r("sync:config:delete:response"),r("sync:config:reset-delta:response"),r("sync:history:list"),r("sync:history:list:response"),r("sync:history:detail"),r("sync:history:detail:response"),r("sync:history:rerun"),r("sync:history:export"),r("sync:history:export:response"),r("sync:history:error"),r("sync:removal:info"),r("sync:removal:info:response"),r("sync:earlier-copies"),r("sync:earlier-copies:response"),r("sync:removal:list"),r("sync:removal:list:response"),r("sync:remove"),r("sync:remove:response"),r("sync:remove:error"),r("sync:remove:sweep"),r("sync:remove:sweep:response"),r("sync:remove:sweep:error"),r("sync:remove:automation"),r("sync:remove:automation:response"),r("sync:remove:automation:error"),r("sync:schedule:list"),r("sync:schedule:list:response"),r("sync:schedule:upsert"),r("sync:schedule:upsert:response"),r("sync:schedule:toggle"),r("sync:schedule:toggle:response"),r("sync:schedule:delete"),r("sync:schedule:delete:response"),r("sync:schedule:error")],gb=C("type",Ui),$i=[r("monitor:refresh"),r("monitor:data"),r("monitor:error"),r("monitor:open-apex-jobs"),r("monitor:open-apex-jobs:response"),r("monitor:live-operations"),r("monitor:live-operations:response"),r("monitor:live-operations:changed"),r("monitor:storage"),r("monitor:storage:response"),r("monitor:deployments"),r("monitor:deployments:response"),r("monitor:api-usage"),r("monitor:api-usage:response"),r("monitor:error-logs"),r("monitor:error-logs:response"),r("monitor:sessions"),r("monitor:sessions:response"),r("monitor:apex-insights"),r("monitor:apex-insights:response"),r("monitor:sandbox-refresh"),r("monitor:sandbox-refresh:response"),r("monitor:alerts"),r("monitor:alerts:result"),r("monitor:alert:acknowledge"),r("monitor:alert:acknowledge:response"),r("monitor:alert:dismiss"),r("monitor:alert:dismiss:response")],hb=C("type",$i),Bi=[r("compare:execute"),r("compare:execute:response"),r("compare:permissions"),r("compare:snapshots"),r("compare:drift"),r("compare:permissions:response"),r("compare:snapshots:response"),r("compare:drift:response"),r("compare:validate-deployment"),r("compare:validate-deployment:response"),r("compare:deploy"),r("compare:deploy:response"),r("compare:error")],yb=C("type",Bi),Gi=[r("backup:execute"),r("backup:list"),r("backup:list:result"),r("backup:objects"),r("backup:objects:response"),r("backup:export"),r("backup:export:result"),r("backup:delete"),r("backup:delete:result"),r("dataops:rollback"),r("dataops:anonymize"),r("dataops:backup:response"),r("dataops:rollback:response"),r("dataops:anonymize:response"),r("dataops:pii-inventory"),r("dataops:pii-inventory:response"),r("dataops:dsr:search"),r("dataops:dsr:search:response"),r("dataops:dsr:export"),r("dataops:dsr:export:response"),r("dataops:dsr:erase"),r("dataops:dsr:erase:response"),r("dataops:dsr:log"),r("dataops:dsr:log:response"),r("dataops:cleanup:scan"),r("dataops:cleanup:scan:response"),r("dataops:cleanup:export"),r("dataops:cleanup:export:response"),r("dataops:cleanup:delete"),r("dataops:cleanup:delete:response"),r("dataops:empty:scope"),r("dataops:empty:scope:response"),r("dataops:empty:preview"),r("dataops:empty:preview:response"),r("dataops:empty:run"),r("dataops:empty:run:response"),r("dataops:empty:cancel"),r("dataops:empty:cancel:response"),r("dataops:empty:undo"),r("dataops:empty:undo:response"),r("dataops:error"),r("dataops:anonymization-templates"),r("dataops:anonymization-templates:response"),r("dataops:anonymization-template:save"),r("dataops:anonymization-template:save:response"),r("dataops:anonymization-template:delete"),r("dataops:anonymization-template:delete:response"),r("dataops:anonymize:coverage"),r("dataops:anonymize:coverage:response"),r("dataops:anonymize:preview"),r("dataops:anonymize:preview:response"),r("dataops:automation"),r("dataops:automation:response"),r("precheck:pii-scan"),r("precheck:pii-scan:response"),r("governance:policies:list"),r("governance:policies:result"),r("governance:policy:save"),r("governance:policy:delete"),r("governance:evaluate"),r("governance:templates"),r("governance:policy:save:response"),r("governance:policy:delete:response"),r("governance:evaluate:response"),r("governance:templates:response"),r("governance:error")],bb=C("type",Gi),Wi=[r("pipeline:execute"),r("pipeline:run:response"),r("pipeline:step"),r("pipeline:error"),r("pipeline:templates"),r("pipeline:templates:response"),r("pipeline:list"),r("pipeline:list:response"),r("pipeline:history"),r("pipeline:history:response"),r("pipeline:save"),r("pipeline:save:response"),r("pipeline:delete"),r("pipeline:delete:response"),r("pipeline:approval"),r("pipeline:sync-configs"),r("pipeline:sync-configs:response"),r("pipeline:seed-templates"),r("pipeline:seed-templates:response"),r("pipeline:masking-templates"),r("pipeline:masking-templates:response"),r("pipeline:rewind-steps"),r("pipeline:rewind-steps:response"),r("pipeline:rewind-grant"),r("pipeline:rewind-grant:response"),r("pipeline:rewind-revoke"),r("pipeline:rewind-revoke:response"),r("pipeline:export"),r("pipeline:export:response"),r("marketplace:list"),r("marketplace:list:response"),r("marketplace:install"),r("marketplace:install:response"),r("migration:pick-file"),r("migration:pick-file:response"),r("migration:import-sfdmu"),r("migration:import-sfdmu:response"),r("migration:save-sync-config"),r("migration:save-sync-config:response"),r("migration:error"),r("autopilot:list-objects"),r("autopilot:objects-listed"),r("autopilot:count-objects"),r("autopilot:objects-counted"),r("autopilot:scan-schema"),r("autopilot:schema-result"),r("autopilot:generate-plan"),r("autopilot:plan-ready"),r("autopilot:fit-plan"),r("autopilot:fit-undo"),r("autopilot:execute"),r("autopilot:node-progress"),r("autopilot:pause"),r("autopilot:resume"),r("autopilot:skip-node"),r("autopilot:completed"),r("autopilot:compliance-report"),r("autopilot:error"),r("forge:preview"),r("forge:discover"),r("forge:execute"),r("forge:pause"),r("forge:resume"),r("forge:abort"),r("forge:templates:list"),r("forge:templates:save"),r("forge:templates:delete"),r("forge:history:list"),r("forge:undo"),r("forge:resume-run"),r("forge:open-record"),r("forge:verify:request"),r("forge:export-ids:request"),r("forge:plan:request"),r("forge:compliance:request"),r("forge:metadata-diff:request"),r("forge:rehearse:request"),r("forge:automation:request"),r("forge:undo-automation:request"),r("forge:undo-sweep:request"),r("forge:gaps:request"),r("forge:users:request"),r("forge:target-records:request"),r("forge:sample-budget:request"),r("forge:previewRoots"),r("forge:preview:response"),r("forge:preview:error"),r("forge:discover:response"),r("forge:discover:progress"),r("forge:discover:error"),r("forge:abort:error"),r("forge:execute:response"),r("forge:progress"),r("forge:execute:error"),r("forge:templates:list:response"),r("forge:templates:save:response"),r("forge:templates:save:error"),r("forge:templates:delete:response"),r("forge:templates:delete:error"),r("forge:history:list:response"),r("forge:undo:response"),r("forge:undo:error"),r("forge:open-record:response"),r("forge:open-record:error"),r("forge:verify:response"),r("forge:verify:error"),r("forge:export-ids:response"),r("forge:export-ids:error"),r("forge:plan:response"),r("forge:plan:error"),r("forge:compliance:response"),r("forge:compliance:error"),r("forge:metadata-diff:response"),r("forge:metadata-diff:error"),r("forge:rehearse:progress"),r("forge:rehearse:response"),r("forge:rehearse:error"),r("forge:automation:response"),r("forge:automation:error"),r("forge:undo-automation:response"),r("forge:undo-automation:error"),r("forge:undo-sweep:response"),r("forge:undo-sweep:error"),r("forge:gaps:response"),r("forge:gaps:error"),r("forge:users:response"),r("forge:users:error"),r("forge:target-records:response"),r("forge:target-records:error"),r("forge:sample-budget:response"),r("forge:sample-budget:error"),r("forge:previewRoots:response"),r("forge:previewRoots:error"),r("forge:sampling:progress")],xb=C("type",Wi),Hi=[r("operation:started"),r("operation:progress"),r("operation:completed"),r("operation:failed"),r("execution:retry-status"),r("execution:abort"),r("execution:abort:response"),r("execution:error"),r("grappe:started"),r("grappe:partitionProgress"),r("grappe:completed")],Sb=C("type",Hi),Ki=[r("ai:chat"),r("ai:chat:response"),r("ai:chat:cancel"),r("ai:conversation:create"),r("ai:conversation:created"),r("ai:conversation:load"),r("ai:conversation:loaded"),r("ai:conversation:delete"),r("ai:conversation:deleted"),r("ai:conversation:delete-all"),r("ai:conversation:deleted-all"),r("ai:conversation:list"),r("ai:conversation:list:response"),r("ai:status"),r("ai:status:response"),r("ai:save-key"),r("ai:save-key:response"),r("ai:settings"),r("ai:settings:response"),r("ai:remove-key"),r("ai:remove-key:response"),r("ai:error"),r("ai:tool:cancel"),r("ai:forge-plan"),r("ai:forge-plan:response"),r("ai:anomaly-scan"),r("ai:anomaly-scan:response"),r("ai:generate-pipeline"),r("ai:generate-pipeline:response"),r("ai:scenario-draft"),r("ai:scenario-draft:response"),r("ai:provider:status"),r("ai:budget:state")],Eb=C("type",Ki),Vi=[r("settings:get"),r("settings:update"),r("settings:response"),r("settings:error"),r("config:error"),r("easter-egg:show"),r("onboarding:show"),r("telemetry:status"),r("telemetry:status:response"),r("telemetry:toggle"),r("telemetry:toggle:response"),r("whats-new:show"),r("notification"),r("state:sync"),r("i18n:locale"),r("i18n:locale:response"),r("config:export"),r("config:export:response"),r("config:import"),r("config:import:response"),r("config:categories"),r("config:categories:response"),r("config:validate"),r("config:validate:response"),r("reports:list"),r("reports:list:response"),r("reports:audit"),r("reports:audit:response"),r("reports:lineage"),r("reports:lineage:response"),r("reports:error"),r("file:save"),r("file:save:response"),r("bridge:error"),r("bridge:protocol-mismatch"),r("bridge:reload-banner"),r("panel:visibility"),r("panel:route"),r("panel:reload"),r("navigation:intent"),r("workbench:reload"),r("workbench:open-setting"),r("workbench:open-log"),r("error:boundary")],Ab=C("type",Vi),qi=[r("realtime:start"),r("realtime:stop"),r("realtime:status"),r("realtime:status:response"),r("realtime:metrics"),r("realtime:metrics:response"),r("realtime:objects"),r("realtime:objects:response"),r("realtime:error"),r("realtime:resolve-conflict"),r("realtime:started"),r("realtime:stopped"),r("realtime:event"),r("realtime:events-batch"),r("realtime:conflict"),r("realtime:conflict-resolved")],Rb=C("type",qi),Zi=[r("smart-action:analyze"),r("smart-action:analyze:response"),r("smart-action:error"),r("quicksync:suggest-objects"),r("quicksync:detect-relationships"),r("quicksync:preview"),r("quicksync:execute"),r("quicksync:suggest-objects:response"),r("quicksync:detect-relationships:response"),r("quicksync:preview:response"),r("quicksync:execute:response"),r("quicksync:error")],zb=C("type",Zi),Yi=[r("frozen:config:get"),r("frozen:config:get:response"),r("frozen:config:save"),r("frozen:config:save:response"),r("frozen:select"),r("frozen:select:response"),r("frozen:select:progress"),r("frozen:extract"),r("frozen:extract:response"),r("frozen:control:result"),r("frozen:manifest:get"),r("frozen:manifest:get:response"),r("frozen:load"),r("frozen:load:response"),r("frozen:load:progress"),r("frozen:load:preview"),r("frozen:load:preview:response"),r("frozen:verify"),r("frozen:verify:result"),r("frozen:remove"),r("frozen:remove:response"),r("frozen:remove:sweep"),r("frozen:remove:sweep:response"),r("frozen:remove:automation"),r("frozen:remove:automation:response"),r("frozen:remove:preview"),r("frozen:remove:preview:response"),r("frozen:status"),r("frozen:status:response"),r("frozen:rules:clear"),r("frozen:rules:clear:response"),r("frozen:rules:create"),r("frozen:rules:create:response"),r("frozen:config:save:error"),r("frozen:select:error"),r("frozen:extract:error"),r("frozen:load:error"),r("frozen:load:preview:error"),r("frozen:verify:error"),r("frozen:remove:error"),r("frozen:remove:sweep:error"),r("frozen:remove:automation:error"),r("frozen:remove:preview:error"),r("frozen:rules:clear:error"),r("frozen:rules:create:error")],_b=C("type",Yi),Xi=[r("checkpoint:list"),r("checkpoint:list:response"),r("checkpoint:scope"),r("checkpoint:scope:response"),r("checkpoint:take"),r("checkpoint:take:response"),r("checkpoint:preview"),r("checkpoint:preview:response"),r("checkpoint:rewind"),r("checkpoint:rewind:response"),r("checkpoint:undo"),r("checkpoint:undo:response"),r("checkpoint:delete"),r("checkpoint:delete:response"),r("checkpoint:keep"),r("checkpoint:keep:response"),r("checkpoint:rename"),r("checkpoint:rename:response"),r("checkpoint:ignore-fields"),r("checkpoint:ignore-fields:response"),r("checkpoint:rewinds"),r("checkpoint:rewinds:response"),r("checkpoint:plan-selection"),r("checkpoint:plan-selection:response"),r("checkpoint:export"),r("checkpoint:export:response"),r("checkpoint:import-read"),r("checkpoint:import-read:response"),r("checkpoint:import"),r("checkpoint:import:response"),r("checkpoint:error")],Ob=C("type",Xi),Qi=[r("recovery:status"),r("recovery:status:response"),r("recovery:users:list"),r("recovery:users:list:response"),r("recovery:users:plan"),r("recovery:users:plan:response"),r("recovery:users:apply"),r("recovery:users:apply:response"),r("recovery:users:progress"),r("recovery:users:cancel"),r("recovery:users:config:save"),r("recovery:users:config:save:response"),r("recovery:users:config:export"),r("recovery:users:config:export:response"),r("recovery:users:config:import"),r("recovery:users:config:import:response"),r("recovery:audit"),r("recovery:audit:response"),r("recovery:handoff"),r("recovery:handoff:response"),r("recovery:handoff:open"),r("recovery:handoff:open:response"),r("recovery:ack"),r("recovery:ack:response"),r("recovery:error")],Tb=C("type",Qi),Qm=C("type",[...Di,...Mi,...Ui,...$i,...Bi,...Gi,...Wi,...Hi,...Ki,...Vi,...qi,...Zi,...Yi,...Xi,...Qi]),wb=g({protocolVersion:c().int().positive(),correlationId:i().min(1).optional(),payload:Qm});var tr=["source_wins","target_wins","newest_wins","merge"];var ef=g({maxFileSizeMB:c().int().min(1).max(35),maxRunMB:c().int().min(1).max(2e3)}),tf=g({length:c().int().positive().optional(),prefix:i().optional(),suffix:i().optional(),search:i().optional(),replace:i().optional(),regex:i().optional(),valueMap:w(i(),i()).optional(),defaultValue:i().optional(),dateFormat:i().optional(),numberFormat:i().optional(),formula:i().optional()}),Ji=u({type:h(["uppercase","lowercase","trim","truncate","prefix","suffix","replace","regex_replace","map_value","default_value","format_date","format_number","custom_formula"]),field:i().regex(/^[A-Za-z][A-Za-z0-9_]*$/,"Invalid field API name").max(80).optional(),config:tf}),nf=g({sourceField:i().min(1),targetField:i().min(1),type:h(["direct","rename","transform","constant","formula","exclude","add_on"]),transformRules:l(Ji).optional()}),rf=g({objectApiName:i().min(1),externalIdField:i().optional(),operation:h(["insert","update","upsert","delete"]),query:i().optional(),fieldMappings:l(nf),transformRules:l(Ji),excludedFields:l(i()),addOnFields:l(g({fieldApiName:i().min(1),value:v([i(),c(),y()]),overwriteExisting:y()})).default([]),batchSize:c().int().positive().default(200),orderBy:i().optional(),where:i().optional(),insertOrder:c().int().nonnegative().default(0)}),of=h(tr),Cb=g({name:i().min(1),description:i().default(""),sourceOrgId:ye(),targetOrgId:ye(),direction:h(["source_to_target","target_to_source","bidirectional"]),mode:h(["full","incremental","delta","cdc"]),objects:l(rf).min(1),conflictStrategy:of,enableRollback:y().default(!1),propagateDeletes:y().optional(),files:ef.optional(),keepContactPoints:y().optional()});var Pb=g({sourceOrgId:i().min(1,"sourceOrgId is required"),targetOrgId:i().min(1,"targetOrgId is required"),selectedObjects:l(i().min(1)).min(1,"At least one object must be selected"),parentObjects:l(i().min(1)).default([])});var af={UNABLE_TO_LOCK_ROW:{retryable:!0,delay:2e3,strategy:"exponential"},REQUEST_RUNNING_TOO_LONG:{retryable:!0,delay:5e3,strategy:"exponential"},SERVER_UNAVAILABLE:{retryable:!0,delay:1e4,strategy:"exponential"},INVALID_SESSION_ID:{retryable:!0,delay:0,strategy:"reauth_then_retry"},REQUEST_LIMIT_EXCEEDED:{retryable:!0,delay:6e4,strategy:"fixed_delay"},LIMIT_EXCEEDED:{retryable:!0,delay:3e4,strategy:"reduce_batch"},INVALID_FIELD:{retryable:!1,category:"schema"},REQUIRED_FIELD_MISSING:{retryable:!1,category:"data"},DUPLICATE_VALUE:{retryable:!1,category:"data",suggestUpsert:!0},FIELD_CUSTOM_VALIDATION_EXCEPTION:{retryable:!1,category:"validation"},CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:{retryable:!1,category:"trigger"},STRING_TOO_LONG:{retryable:!1,category:"data",suggestTruncate:!0},INVALID_CROSS_REFERENCE_KEY:{retryable:!1,category:"reference"},ENTITY_IS_DELETED:{retryable:!1,category:"reference"},STORAGE_LIMIT_EXCEEDED:{retryable:!1,category:"limit",blockAll:!0},INVALID_TYPE:{retryable:!1,category:"schema"},MALFORMED_ID:{retryable:!1,category:"data"},INVALID_OPERATION:{retryable:!1,category:"schema"},INSUFFICIENT_ACCESS_OR_READONLY:{retryable:!1,category:"permission"},INVALID_FIELD_FOR_INSERT_UPDATE:{retryable:!1,category:"schema"}};function Fb(e){return af[e]??{retryable:!1,category:"unknown"}}var Db="anthropic",sf={MODEL:"claude-sonnet-5",MAX_TOKENS:8192};function Mb(e){let t=typeof e=="string"?e.trim():"";return t!==""?t:sf.MODEL}var $b=["DailyApiRequests","DataStorageMB","FileStorageMB","DailyBulkApiBatches","DailyBulkV2QueryJobs","DailyAsyncApexExecutions"],Bb=["Sampling","Pending","Processing","Suspended","Stopped","Pending Activation","Activating","Discarding","Completed","Deleting","Locking","Locked"],cf=["Sampling","Pending","Processing","Suspended","Pending Activation","Activating"];function Gb(e){return cf.includes(e)}var df="pipeline:trigger:";function lf(e){return e.replace(/\D/g,"")}function Kb(e){let t=lf(e);return t.length>=6&&t.length<=20&&e.length<=40}function Vb(e){return e.length<=254&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function qb(e){let t=e.trim(),n=[...e].some(o=>o.charCodeAt(0)<32);return t.length>0&&t.length<=121&&!n}var nr=Object.freeze([Object.freeze({objectApiName:"OpportunityLineItem",fields:Object.freeze(["UnitPrice","TotalPrice"])}),Object.freeze({objectApiName:"QuoteLineItem",fields:Object.freeze(["UnitPrice","TotalPrice"])})]);function pf(e,t){let n=[];for(let o of nr){if(o.objectApiName!==e)continue;let a=o.fields.filter(s=>t[s]!==void 0&&t[s]!==null);a.length<2||n.push(...a.slice(1))}return n}function uf(e,t,n){for(let o of nr){if(o.objectApiName!==e)continue;let a=o.fields.filter(t);if(a.length>0&&!a.some(n))return a[0]}}var ra="https://github.com/StephaneBerthoz/sandforge/blob/master/docs/forge-quickstart.md",oa="https://help.salesforce.com/s/search-result?language=en_US";function ia(e){return`${oa}#q=${encodeURIComponent(e)}`}var mf=new Set(["DUPLICATE_VALUE","INVALID_CROSS_REFERENCE_KEY","REQUIRED_FIELD_MISSING","INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST","FIELD_CUSTOM_VALIDATION_EXCEPTION","CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY","FIELD_INTEGRITY_EXCEPTION","FIELD_FILTER_VALIDATION_EXCEPTION","DUPLICATES_DETECTED","INACTIVE_OWNER_OR_USER","ENTITY_IS_DELETED","UNABLE_TO_LOCK_ROW","REQUEST_LIMIT_EXCEEDED","INVALID_SESSION_ID","INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY","NUMBER_OUTSIDE_VALID_RANGE","MALFORMED_ID","CANNOT_EXECUTE_FLOW_TRIGGER"]);function aa(e){return`error-${e.toLowerCase().replace(/_/g,"-")}`}var ea={STANDARD_PRICE_NOT_DEFINED:{severity:"warning",keys:["errors.standardPriceMissing.explanation","errors.standardPriceMissing.action"],forge:["errors.standardPriceMissing.forge.explanation","errors.standardPriceMissing.forge.action"],seedAction:"errors.standardPriceMissing.seed.action"},DUPLICATE_VALUE:{severity:"warning",keys:["errors.duplicateValue.explanation","errors.duplicateValue.action"],forge:["errors.duplicateValue.forge.explanation","errors.duplicateValue.forge.action"],seedAction:"errors.duplicateValue.seed.action"},INVALID_CROSS_REFERENCE_KEY:{severity:"info",keys:["errors.invalidCrossReferenceKey.explanation","errors.invalidCrossReferenceKey.action"],forge:["errors.invalidCrossReferenceKey.forge.explanation","errors.invalidCrossReferenceKey.forge.action"]},RECORD_TYPE_UNAVAILABLE:{severity:"error",own:!0,keys:["errors.recordTypeHeldBack.explanation","errors.recordTypeHeldBack.action"],forge:["errors.recordTypeHeldBack.forge.explanation","errors.recordTypeHeldBack.forge.action"]},REQUIRED_FIELD_MISSING:{severity:"error",keys:["errors.requiredFieldMissing.explanation","errors.requiredFieldMissing.action"],forge:["errors.requiredFieldMissing.forge.explanation","errors.requiredFieldMissing.forge.action"],seedAction:"errors.requiredFieldMissing.seed.action"},INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST:{severity:"warning",keys:["errors.invalidPicklist.explanation","errors.invalidPicklist.action"],forge:["errors.invalidPicklist.forge.explanation","errors.invalidPicklist.forge.action"],seedAction:"errors.invalidPicklist.seed.action"},FIELD_CUSTOM_VALIDATION_EXCEPTION:{severity:"warning",keys:["errors.fieldCustomValidation.explanation","errors.fieldCustomValidation.action"],forge:["errors.fieldCustomValidation.forge.explanation","errors.fieldCustomValidation.forge.action"],seedAction:"errors.fieldCustomValidation.seed.action"},INVALID_FIELD_FOR_INSERT_UPDATE:{severity:"error",keys:["errors.invalidFieldForInsert.explanation","errors.invalidFieldForInsert.action"]},FIELD_INTEGRITY_EXCEPTION:{severity:"error",keys:["errors.fieldIntegrity.explanation","errors.fieldIntegrity.action"]},CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:{severity:"error",keys:["errors.automationRefused.explanation","errors.automationRefused.action"],forge:["errors.automationRefused.forge.explanation","errors.automationRefused.forge.action"]},INSUFFICIENT_ACCESS_OR_READONLY:{severity:"error",keys:["errors.insufficientAccess.explanation","errors.insufficientAccess.action"]},INSUFFICIENT_ACCESS:{severity:"error",keys:["errors.insufficientAccess.explanation","errors.insufficientAccess.action"]},STORAGE_LIMIT_EXCEEDED:{severity:"error",keys:["errors.storageLimit.explanation","errors.storageLimit.action"],seedAction:"errors.storageLimit.seed.action"},INVALID_TYPE:{severity:"error",keys:["errors.invalidType.explanation","errors.invalidType.action"],forge:["errors.invalidType.forge.explanation","errors.invalidType.forge.action"]},NOT_FOUND:{severity:"warning",keys:["errors.notFound.explanation","errors.notFound.action"],forge:["errors.notFound.forge.explanation","errors.notFound.forge.action"]},STRING_TOO_LONG:{severity:"warning",keys:["errors.stringTooLong.explanation","errors.stringTooLong.action"],forge:["errors.stringTooLong.forge.explanation","errors.stringTooLong.forge.action"]},FIELD_FILTER_VALIDATION_EXCEPTION:{severity:"warning",keys:["errors.lookupFilter.explanation","errors.lookupFilter.action"],forge:["errors.lookupFilter.forge.explanation","errors.lookupFilter.forge.action"]},DUPLICATES_DETECTED:{severity:"warning",keys:["errors.duplicateRule.explanation","errors.duplicateRule.action"],forge:["errors.duplicateRule.forge.explanation","errors.duplicateRule.forge.action"],seedAction:"errors.duplicateRule.seed.action"},INACTIVE_OWNER_OR_USER:{severity:"error",keys:["errors.inactiveUser.explanation","errors.inactiveUser.action"],forge:["errors.inactiveUser.forge.explanation","errors.inactiveUser.forge.action"]},ENTITY_IS_DELETED:{severity:"warning",keys:["errors.entityDeleted.explanation","errors.entityDeleted.action"],forge:["errors.entityDeleted.forge.explanation","errors.entityDeleted.forge.action"]},UNABLE_TO_LOCK_ROW:{severity:"warning",keys:["errors.rowLocked.explanation","errors.rowLocked.action"],forge:["errors.rowLocked.forge.explanation","errors.rowLocked.forge.action"]},REQUEST_LIMIT_EXCEEDED:{severity:"error",keys:["errors.requestLimit.explanation","errors.requestLimit.action"],forge:["errors.requestLimit.forge.explanation","errors.requestLimit.forge.action"]},ERROR_HTTP_414:{severity:"error",keys:["errors.uriTooLong.explanation","errors.uriTooLong.action"]},ERROR_HTTP_431:{severity:"error",keys:["errors.uriTooLong.explanation","errors.uriTooLong.action"]},INVALID_SESSION_ID:{severity:"error",keys:["errors.sessionExpired.explanation","errors.sessionExpired.action"]},INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY:{severity:"error",keys:["errors.crossReferenceAccess.explanation","errors.crossReferenceAccess.action"],forge:["errors.crossReferenceAccess.forge.explanation","errors.crossReferenceAccess.forge.action"]},NUMBER_OUTSIDE_VALID_RANGE:{severity:"warning",keys:["errors.numberOutOfRange.explanation","errors.numberOutOfRange.action"],forge:["errors.numberOutOfRange.forge.explanation","errors.numberOutOfRange.forge.action"]},MALFORMED_ID:{severity:"error",keys:["errors.malformedId.explanation","errors.malformedId.action"],forge:["errors.malformedId.forge.explanation","errors.malformedId.forge.action"]},CANNOT_EXECUTE_FLOW_TRIGGER:{severity:"error",keys:["errors.flowFailed.explanation","errors.flowFailed.action"],forge:["errors.flowFailed.forge.explanation","errors.flowFailed.forge.action"],seedAction:"errors.flowFailed.seed.action"},DELETE_FAILED:{severity:"error",keys:["errors.deleteFailed.explanation","errors.deleteFailed.action"]},INVALID_EMAIL_ADDRESS:{severity:"warning",keys:["errors.invalidEmail.explanation","errors.invalidEmail.action"]},SERVER_UNAVAILABLE:{severity:"warning",keys:["errors.serverUnavailable.explanation","errors.serverUnavailable.action"]},REQUEST_RUNNING_TOO_LONG:{severity:"warning",keys:["errors.requestTooLong.explanation","errors.requestTooLong.action"]},QUERY_TIMEOUT:{severity:"error",keys:["errors.queryTimeout.explanation","errors.queryTimeout.action"]},OPERATION_TOO_LARGE:{severity:"error",keys:["errors.operationTooLarge.explanation","errors.operationTooLarge.action"]},ALL_OR_NONE_OPERATION_ROLLED_BACK:{severity:"warning",keys:["errors.allOrNoneRolledBack.explanation","errors.allOrNoneRolledBack.action"]},INVALID_FIELD:{severity:"error",keys:["errors.invalidField.explanation","errors.invalidField.action"]},LIMIT_EXCEEDED:{severity:"error",keys:["errors.limitExceeded.explanation","errors.limitExceeded.action"]},CIRCULAR_DEPENDENCY:{severity:"error",keys:["errors.circularDependency.explanation","errors.circularDependency.action"]},ENTITY_IS_LOCKED:{severity:"warning",keys:["errors.entityLocked.explanation","errors.entityLocked.action"]},API_DISABLED_FOR_ORG:{severity:"error",keys:["errors.apiDisabledForOrg.explanation","errors.apiDisabledForOrg.action"]},API_CURRENTLY_DISABLED:{severity:"error",keys:["errors.apiDisabledForUser.explanation","errors.apiDisabledForUser.action"]},CANNOT_UPDATE_CONVERTED_LEAD:{severity:"warning",keys:["errors.convertedLead.explanation","errors.convertedLead.action"]},LICENSE_LIMIT_EXCEEDED:{severity:"error",keys:["errors.licenseLimit.explanation","errors.licenseLimit.action"]},DUPLICATE_USERNAME:{severity:"error",keys:["errors.duplicateUsername.explanation","errors.duplicateUsername.action"]},INVALID_OPERATION:{severity:"error",keys:["errors.invalidOperation.explanation","errors.invalidOperation.action"]},TRANSFER_REQUIRES_READ:{severity:"error",keys:["errors.transferRequiresRead.explanation","errors.transferRequiresRead.action"]},CRUD_FLS_DENIED:{severity:"error",own:!0,keys:["errors.permissionDenied.explanation","errors.permissionDenied.action"]},PARENT_REFUSED:{severity:"warning",own:!0,keys:["errors.parentRefused.explanation","errors.parentRefused.action"]},PARENT_NOT_WRITTEN:{severity:"warning",own:!0,keys:["errors.parentNotWritten.explanation","errors.parentNotWritten.action"]},CUT_WITH_PARENT:{severity:"warning",own:!0,keys:["errors.cutWithParent.explanation","errors.cutWithParent.action"]},PERSON_ACCOUNT_NOT_WRITTEN:{severity:"warning",own:!0,keys:["errors.personAccountNotWritten.explanation","errors.personAccountNotWritten.action"]},PERSON_CONTACT_NOT_LOOKED_UP:{severity:"warning",own:!0,keys:["errors.personContactNotLookedUp.explanation","errors.personContactNotLookedUp.action"]},ORG_AUTH_EXPIRED:{severity:"error",own:!0,wordsTheMessage:!0,keys:["errors.orgAuthExpired.explanation","errors.orgAuthExpired.action"]},SCRATCH_ORG_EXPIRED:{severity:"error",own:!0,keys:["errors.scratchOrgExpired.explanation","errors.scratchOrgExpired.action"]},ORG_TEMPORARILY_UNREACHABLE:{severity:"warning",own:!0,wordsTheMessage:!0,keys:["errors.orgTemporarilyUnreachable.explanation","errors.orgTemporarilyUnreachable.action"]},NO_CLI_ORGS:{severity:"info",own:!0,wordsTheMessage:!0,keys:["errors.noCliOrgs.explanation","errors.noCliOrgs.action"]},SYNC_STORAGE_EXCEEDED:{severity:"error",own:!0,wordsTheMessage:!0,keys:["errors.syncStorageExceeded.explanation","errors.syncStorageExceeded.action"]},SYNC_EMAILS_EXCEEDED:{severity:"error",own:!0,wordsTheMessage:!0,keys:["errors.syncEmailsExceeded.explanation","errors.syncEmailsExceeded.action"]},API_BUDGET_EXCEEDED:{severity:"error",own:!0,keys:["errors.apiBudgetExceeded.explanation","errors.apiBudgetExceeded.action"]},SYNC_TARGET_UNWRITABLE:{severity:"error",own:!0,keys:["errors.syncTargetUnwritable.explanation","errors.syncTargetUnwritable.action"]},SYNC_WRITE_DECLINED:{severity:"info",own:!0,wordsTheMessage:!0,keys:["errors.syncWriteDeclined.explanation","errors.syncWriteDeclined.action"]},SYNC_CONFIRMATION_UNAVAILABLE:{severity:"warning",own:!0,wordsTheMessage:!0,keys:["errors.syncConfirmationUnavailable.explanation","errors.syncConfirmationUnavailable.action"]},SYNC_EARLIER_UNREAD:{severity:"error",own:!0,wordsTheMessage:!0,keys:["errors.syncEarlierUnread.explanation","errors.syncEarlierUnread.action"]},CHECKPOINT_REFUSED:{severity:"error",own:!0,wordsTheMessage:!0,keys:["errors.checkpointRefused.explanation","errors.checkpointRefused.action"]},SEED_CONFIRMATION_UNAVAILABLE:{severity:"warning",own:!0,wordsTheMessage:!0,keys:["errors.seedConfirmationUnavailable.explanation","errors.seedConfirmationUnavailable.action"]},EMAILS_NOT_ACCEPTED:{severity:"error",own:!0,wordsTheMessage:!0,keys:["errors.emailsNotAccepted.explanation","errors.emailsNotAccepted.action"]},EMAILS_DELIVERED:{severity:"error",own:!0,keys:["errors.emailsDelivered.explanation","errors.emailsDelivered.action"]}},ff=new RegExp(String.raw`^(?![\s\S]*${wt.source})[\s\S]*(?:${Tt.source})`,"i"),gf={severity:"error",keys:["errors.governorLimit.explanation","errors.governorLimit.action"],forge:["errors.governorLimit.forge.explanation","errors.governorLimit.forge.action"]},hf=[...["CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY","DELETE_FAILED","CANNOT_EXECUTE_FLOW_TRIGGER"].map(e=>({code:e,match:ff,says:e,entry:gf})),{code:"INVALID_CROSS_REFERENCE_KEY",match:/ecord ?[Tt]ype/,says:"RECORD_TYPE_UNAVAILABLE",entry:{severity:"warning",keys:["errors.recordTypeUnavailable.explanation","errors.recordTypeUnavailable.action"],forge:["errors.recordTypeUnavailable.forge.explanation","errors.recordTypeUnavailable.forge.action"]}},{code:"PARENT_REFUSED",match:/keeps its \S+ empty/,says:"PARENT_REFUSED",entry:{severity:"warning",own:!0,keys:["errors.parentRefused.keptEmpty.explanation","errors.parentRefused.keptEmpty.action"]}},{code:"PARENT_NOT_WRITTEN",match:/keeps its \S+ empty/,says:"PARENT_NOT_WRITTEN",entry:{severity:"warning",own:!0,keys:["errors.parentNotWritten.keptEmpty.explanation","errors.parentNotWritten.keptEmpty.action"]}},{code:"PARENT_NOT_WRITTEN",match:/was skipped in this run/,says:"PARENT_NOT_WRITTEN",entry:{severity:"warning",own:!0,keys:["errors.parentNotWritten.skipped.explanation","errors.parentNotWritten.skipped.action"]}},{code:"PARENT_NOT_WRITTEN",match:/write of \S+ failed/,says:"PARENT_NOT_WRITTEN",entry:{severity:"warning",own:!0,keys:["errors.parentNotWritten.failed.explanation","errors.parentNotWritten.failed.action"]}},{code:"CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY",match:/entity type cannot be inserted/i,says:"CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY",entry:{severity:"info",keys:["errors.cannotInsertEntity.explanation","errors.cannotInsertEntity.action"],forge:["errors.cannotInsertEntity.forge.explanation","errors.cannotInsertEntity.forge.action"]}}],yf=[{match:/Cycle FK '([^']+)'.*?source ([0-9A-Za-z]+)/,build:e=>({code:"CYCLE_FK_UNRESOLVED",explanationKey:"errors.cycleFkUnresolved.explanation",actionKey:"errors.cycleFkUnresolved.action",vars:{fieldName:e[1],sourceRefId:e[2]},severity:"warning"})},{match:/Cycle FK '([^']+)' could not be resolved/,build:e=>({code:"CYCLE_FK_UNRESOLVED",explanationKey:"errors.cycleFkUnresolved.explanation",actionKey:"errors.cycleFkUnresolved.action",vars:{fieldName:e[1],sourceRefId:""},severity:"warning"})},{match:/no parent in cache and not the root/,build:()=>({code:"OUT_OF_SCOPE",explanationKey:"errors.outOfScope.explanation",actionKey:"errors.outOfScope.action",severity:"info"})},{match:/^Written with the lookup empty: the (?:\w+ )?record it points at is not in the clone/,build:()=>({code:"LOOKUP_OUTSIDE_THE_CLONE",explanationKey:"errors.lookupOutsideClone.explanation",actionKey:"errors.lookupOutsideClone.action",severity:"info"})},{match:/^Object is not in the target org, or the user the run writes as cannot see it/,build:()=>({code:"NOT_IN_TARGET_ORG",explanationKey:"errors.notInTarget.explanation",actionKey:"errors.notInTarget.action",severity:"error"})},{match:/^Object is not createable on target org/,build:()=>({code:"NOT_CREATEABLE_ON_TARGET",explanationKey:"errors.notCreateable.explanation",actionKey:"errors.notCreateable.action",severity:"warning"})},{match:/^Object is not updateable on target org/,build:()=>({code:"NOT_UPDATEABLE_ON_TARGET",explanationKey:"errors.notUpdateable.explanation",actionKey:"errors.notUpdateable.action",severity:"warning"})}],ta={GUARD_BLOCKED:{keys:["errors.guardBlocked.explanation","errors.guardBlocked.action"],severity:"error"},GUARD_DECLINED:{keys:["errors.guardDeclined.explanation","errors.guardDeclined.action"],severity:"info"},NOT_INITIALIZED:{keys:["errors.notInitialized.explanation","errors.notInitialized.action"],severity:"error"},FORGE_RUNNING:{keys:["errors.forgeRunning.explanation","errors.forgeRunning.action"],severity:"warning"},DUPLICATE:{keys:["errors.duplicateRun.explanation","errors.duplicateRun.action"],severity:"warning"},RETRY_UNAVAILABLE:{keys:["errors.retryUnavailable.explanation","errors.retryUnavailable.action"],severity:"warning"},RESUME_UNAVAILABLE:{keys:["errors.resumeUnavailable.explanation","errors.resumeUnavailable.action"],severity:"warning"},RESUME_TARGET_CHANGED:{keys:["errors.resumeTargetChanged.explanation","errors.resumeTargetChanged.action"],severity:"warning"},RESUME_CHANGED:{keys:["errors.resumeChanged.explanation","errors.resumeChanged.action"],severity:"warning"},RESUME_TARGET_UNREAD:{keys:["errors.resumeTargetUnread.explanation","errors.resumeTargetUnread.action"],severity:"warning"},JOURNAL_UNAVAILABLE:{keys:["errors.journalUnavailable.explanation","errors.journalUnavailable.action"],severity:"error"},RUN_NOT_IN_HISTORY:{keys:["errors.runNotInHistory.explanation","errors.runNotInHistory.action"],severity:"warning"},REMOVAL_RUNNING:{keys:["errors.removalRunning.explanation","errors.removalRunning.action"],severity:"info"},VERIFY_RUNNING:{keys:["errors.verifyRunning.explanation","errors.verifyRunning.action"],severity:"info"},JOURNAL_GONE:{keys:["errors.journalGone.explanation","errors.journalGone.action"],severity:"warning"},NOT_RECORDED:{keys:["errors.notRecorded.explanation","errors.journalGone.action"],severity:"warning"},IN_FLIGHT_UNREAD:{keys:["errors.inFlightUnread.explanation","errors.inFlightUnread.action"],severity:"warning"},ORG_NOT_FOUND:{keys:["errors.runOrgUnregistered.explanation","errors.runOrgUnregistered.action"],severity:"warning"},FILES_NOT_ACCEPTED:{keys:["errors.filesNotAccepted.explanation","errors.filesNotAccepted.action"],severity:"warning"},OWNER_MAP_INACTIVE:{keys:["errors.ownerMapInactive.explanation","errors.ownerMapInactive.action"],severity:"warning"},OWNER_MAP_UNKNOWN:{keys:["errors.ownerMapUnknown.explanation","errors.ownerMapUnknown.action"],severity:"warning"},WHOLE_ORG_DIRECT:{keys:["errors.wholeOrgDirect.explanation","errors.wholeOrgDirect.action"],severity:"warning"},WHOLE_ORG_REHEARSAL:{keys:["errors.wholeOrgRehearsal.explanation","errors.wholeOrgRehearsal.action"],severity:"warning"},GRAPH_WITHOUT_EDGES:{keys:["errors.graphWithoutEdges.explanation","errors.graphWithoutEdges.action"],severity:"warning"},NOTHING_TO_CLONE:{keys:["errors.nothingToClone.explanation","errors.nothingToClone.action"],severity:"warning"},ABORTED_BEFORE_START:{keys:["errors.abortedBeforeStart.explanation","errors.abortedBeforeStart.action"],severity:"info"}},sa=new Set(["UNKNOWN","UNKNOWN_ERROR"]),ca="[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+",bf=new RegExp(`^(${ca}):\\s*(.*?)(?:\\.|[\\r\\n]|$)`),xf=new RegExp(`: (${ca}):\\s*(.*?)(?:\\.|[\\r\\n]|$)`);function da(e){return Object.prototype.hasOwnProperty.call(ea,e)?ea[e]:void 0}function Sf(e){return da(e)!==void 0}function na(e,t,n){let o=n==="forge"&&t.forge!==void 0,[a,s]=o&&t.forge?t.forge:n==="seed"&&t.seedAction?[t.keys[0],t.seedAction]:t.keys;return{code:e,explanationKey:a,actionKey:s,severity:t.severity,...la(e,t,n)}}function la(e,t,n){return n==="forge"&&mf.has(e)?{docUrl:`${ra}#${aa(e)}`,docKind:"guide"}:t?.own||sa.has(e)?{}:{docUrl:ia(e),docKind:"search"}}function rr(e,t,n){let o=hf.find(s=>s.code===e&&s.match.test(t));if(o)return na(o.says,o.entry,n);let a=da(e);return a?na(e,a,n):null}function Ef(e,t={}){let{code:n,module:o}=t,a=e.trim();if(n){if(o==="forge"&&Object.prototype.hasOwnProperty.call(ta,n)){let m=ta[n],[f,x]=m.keys;return{code:n,explanationKey:f,actionKey:x,severity:m.severity}}let p=rr(n,a,o);if(p)return p}if(!a)return null;for(let p of yf){let m=a.match(p.match);if(m)return p.build(m)}let s=bf.exec(a);if(s){let[,p]=s,m=rr(p,a,o);return m||(sa.has(p)?null:{code:p,severity:"error",...la(p,void 0,o)})}let d=xf.exec(a);return d?rr(d[1],a,o):null}function or(e){let t=e===void 0?"":String(e);return`"${(/^[=+\-@\t\r]/.test(t)?`'${t}`:t).replace(/"/g,'""')}"`}function Af(e){let t=new Map,n=new Map;for(let{objectApiName:s,sourceIds:d}of e.idRemapCreated??[])for(let p of d)t.set(p,s),n.set(p.slice(0,3),s);let o=new Set(e.idRemapExisting??[]),a=new Set(e.idRemapWithTheirRecord??[]);return Object.entries(e.idRemapTable??{}).map(([s,d])=>{let p=a.has(s)?"written with its record":o.has(s)?"linked to existing":t.has(s)?"created":"mapped";return{objectApiName:t.get(s)??n.get(s.slice(0,3)),sourceId:s,targetId:d,outcome:p}})}var Rf=["Object","Source Id","Target Id","Outcome"];function pa(e){return e.map(t=>[t.objectApiName,t.sourceId,t.targetId,t.outcome].map(or).join(",")).join(`
|
|
47
|
+
`)}function zf(e){let t=Rf.map(or).join(",");return e.length>0?`${t}
|
|
48
|
+
${pa(e)}`:t}function _f(e){return e==="development"||e==="scratch"?"allowed":e==="staging"?"needsApproval":"refused"}var fa={name:"minute",min:0,max:59},ga={name:"hour",min:0,max:23},ha={name:"day of the month",min:1,max:31},ya={name:"month",min:1,max:12,names:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],namesFrom:1},we={name:"day of the week",min:0,max:7,names:["SUN","MON","TUE","WED","THU","FRI","SAT"],namesFrom:0},Of=/^(?:\d+|(?:\*|\d+-\d+)(?:\/\d+)?)$/;function ua(e,t){if(/^\d+$/.test(e))return Number(e);let n=t.names?.indexOf(e.toUpperCase())??-1;return n>=0?n+(t.namesFrom??0):void 0}function Tf(e,t){let n=(s,d="")=>({refused:"unreadable",reason:`"${s}" is not a value of the ${t.name} field, which runs ${t.min}-${t.max}${d}.`});if(e==="*"||e==="?"){let s=t===we?6:t.max,d=[];for(let p=t.min;p<=s;p++)d.push(p);return{values:d,star:!0,portable:e==="*"}}let o=new Set,a=!0;for(let s of e.split(",")){let d=/^(\*|[A-Za-z0-9]+(?:-[A-Za-z0-9]+)?)(?:\/(\d+))?$/.exec(s);if(!d)return n(s,"; the schedulers a launcher uses do not read L, W, # or H");let[,p,m]=d,f=m===void 0?1:Number(m);if(f<1)return n(s);let x,b;if(p==="*")x=t.min,b=t.max;else{let[E,O]=p.split("-");x=ua(E,t),b=O!==void 0?ua(O,t):m!==void 0?t.max:x}if(x===void 0||b===void 0)return n(s,"; the schedulers a launcher uses do not read L, W, # or H");if(x<t.min||b>t.max||x>b)return n(s);(!Of.test(s)||t===we&&b===7)&&(a=!1);for(let E=x;E<=b;E+=f)o.add(t===we&&E===7?0:E)}return{values:[...o].sort((s,d)=>s-d),star:!1,portable:a}}function ba(e){let t=e.trim().split(/\s+/);if(t.length===6){let m=t[0];if(!/^0+$/.test(m))return{refused:"seconds",reason:`It starts at second "${m}" of a minute; cron, Task Scheduler and GitHub Actions start a run on a whole minute. Set its seconds to 0.`};t=t.slice(1)}if(t.length!==5)return{refused:"unreadable",reason:`A cron expression has five fields, or six with the seconds first; this one has ${t.length}.`};let n=[];for(let[m,f]of[fa,ga,ha,ya,we].entries()){let x=Tf(t[m],f);if("refused"in x)return x;n.push(x)}let[o,a,s,d,p]=n;return!s.star&&!p.star?{refused:"eitherDay",reason:`It names both days of the month (${t[2]}) and days of the week (${t[4]}): SandForge runs it on either, and other schedulers read such a line their own way. Keep one of the two, and set the other to *.`}:{minute:o,hour:a,dayOfMonth:s,month:d,dayOfWeek:p,texts:t}}function wf(e){let t=ba(e);return"refused"in t?t:{minutes:t.minute.values,hours:t.hour.values,daysOfMonth:t.dayOfMonth.star?"*":t.dayOfMonth.values,months:t.month.star?"*":t.month.values,daysOfWeek:t.dayOfWeek.star?"*":t.dayOfWeek.values}}var ma=new Map;function xa(e){let t=ma.get(e);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),ma.set(e,t)),t}function ir(e){try{return xa(e).resolvedOptions().timeZone}catch{return}}function rt(e,t){let n=xa(e).formatToParts(new Date(t)),o=s=>Number(n.find(d=>d.type===s)?.value),a=Date.UTC(o("year"),o("month")-1,o("day"),o("hour"),o("minute"),o("second"));return Math.round((a-Math.floor(t/1e3)*1e3)/6e4)}function kf(e,t,n){let o=p=>rt(t,p)-rt(e,p),a=[],s=n,d=o(n);for(let p=n+216e5;p<=n+317088e5;p+=216e5){let m=o(p);if(m!==d){let f=Math.floor(s/6e4),x=Math.ceil(p/6e4);for(;x-f>1;){let b=Math.floor((f+x)/2);o(b*6e4)===d?f=b:x=b}a.push({at:x*6e4,offsetMinutes:m}),d=m}s=p}return a}function If(e,t){let n=t===we?6:t.max;if(e.length===n-t.min+1)return"*";let o=[];for(let a=0;a<e.length;){let s=a;for(;s+1<e.length&&e[s+1]===e[s]+1;)s++;if(s-a>=2)o.push(`${e[a]}-${e[s]}`);else for(let d=a;d<=s;d++)o.push(String(e[d]));a=s+1}return o.join(",")}function nt(e,t,n,o){return n.length===e.values.length&&n.every((s,d)=>s===e.values[d])&&e.portable?t:If(n,o)}function vf(e,t,n,o){for(let D of[t,n])if(ir(D)===void 0)return{refused:"unknownTimezone",reason:`SandForge does not know the time zone "${D}".`};let a=ba(e);if("refused"in a)return a;let s=ir(t)===ir(n),d=s?0:rt(n,o)-rt(t,o),p=s?[]:kf(t,n,o),m=[];for(let D of a.hour.values)for(let ne of a.minute.values){let Ee=D*60+ne+d,ar=Math.floor(Ee/1440),sr=Ee-ar*1440;m.push({minute:sr%60,hour:Math.floor(sr/60),days:ar})}let f=a.dayOfMonth.star&&a.month.star&&a.dayOfWeek.values.length===7,x=a.dayOfWeek.values,b=new Set(m.map(D=>D.days));if(!f){if(b.size>1)return{refused:"notExact",reason:`At the times it names, the clock of ${n} is on two days, and a line there cannot follow the days it runs on: no single line runs at the same moments. Choose times that stay on one day in ${n}, or run it every day.`};let[D]=b;if(D!==0&&(!a.dayOfMonth.star||!a.month.star))return{refused:"notExact",reason:`At the times it names, the clock of ${n} is on another day, and its day of the month or its month would move across a month's end: no single line runs at the same moments. Choose times that stay on the same day in ${n}.`};D!==0&&!a.dayOfWeek.star&&(x=[...new Set(x.map(ne=>((ne+D)%7+7)%7))].sort((ne,Ee)=>ne-Ee))}let E=[...new Set(m.map(D=>D.minute))].sort((D,ne)=>D-ne),O=[...new Set(m.map(D=>D.hour))].sort((D,ne)=>D-ne);if(E.length*O.length!==m.length)return{refused:"notExact",reason:`In ${n}, its minutes no longer go with each of its hours (the zones are ${d} minutes apart): no single line runs at the same moments. Name one minute, or one hour.`};let[k,T,R,j,U]=a.texts;return{cron:[nt(a.minute,k,E,fa),nt(a.hour,T,O,ga),a.dayOfMonth.star?"*":nt(a.dayOfMonth,R,a.dayOfMonth.values,ha),a.month.star?"*":nt(a.month,j,a.month.values,ya),a.dayOfWeek.star?"*":nt(a.dayOfWeek,U,x,we)].join(" "),timezone:n,offsetMinutes:d,offsetChanges:p}}function Ft(e){return e.trim().toLowerCase()}function Sa(e,t,n){let o=Ft(t);return e.some(a=>a.id!==n&&Ft(a.name)===o)}function Cf(e,t,n){let o=e.find(a=>a.id===t);return o!==void 0&&Ft(o.name)===Ft(n)?!1:Sa(e,n,t)}var Nf=new Set(["login.salesforce.com","test.salesforce.com"]),Pf=[".my.salesforce.com",".force.com",".cloudforce.com"],jf=/^[a-z0-9-]+$/;function Ea(e){return e.split(".").every(t=>jf.test(t))?Nf.has(e)?!0:Pf.some(t=>e.endsWith(t)):!1}function Ff(e){let t;try{t=new URL(e)}catch{return{ok:!1,reason:"invalid"}}return t.protocol!=="https:"?{ok:!1,reason:"not-https"}:t.username!==""||t.password!==""||t.port!==""||t.pathname!=="/"||t.search!==""||t.hash!==""?{ok:!1,reason:"not-origin"}:Ea(t.hostname)?{ok:!0,origin:`https://${t.hostname}`}:{ok:!1,reason:"not-salesforce"}}export{cb as a,lb as b,Ym as c,wb as d,V as e,Lt as f,Lf as g,Df as h,Aa as i,Mf as j,ke as k,$f as l,Bf as m,Kf as n,Vf as o,qf as p,Zf as q,Yf as r,Xf as s,Qf as t,Jf as u,eg as v,Ie as w,ur as x,tg as y,ng as z,rg as A,og as B,_a as C,ka as D,cg as E,Ia as F,dg as G,Ca as H,Na as I,tr as J,rf as K,Cb as L,Ne as M,Sr as N,Ut as O,fe as P,ja as Q,Fa as R,La as S,Ma as T,Ua as U,$a as V,Ba as W,Ga as X,Wa as Y,Ha as Z,re as _,Ka as $,Qa as aa,Ja as ba,br as ca,ve as da,Wt as ea,ss as fa,st as ga,Ht as ha,Kt as ia,ds as ja,Os as ka,Og as la,Cs as ma,Xt as na,Ps as oa,Pe as pa,js as qa,pt as ra,Qt as sa,Ds as ta,Tg as ua,Jt as va,$s as wa,wg as xa,kg as ya,Vs as za,qs as Aa,en as Ba,Ig as Ca,vg as Da,Pg as Ea,Pb as Fa,F as Ga,Fg as Ha,je as Ia,sc as Ja,_r as Ka,Lg as La,Ug as Ma,Gg as Na,Hg as Oa,Kg as Pa,Zg as Qa,Z as Ra,Xg as Sa,on as Ta,L as Ua,De as Va,gt as Wa,ht as Xa,Qg as Ya,Ic as Za,Jg as _a,eh as $a,th as ab,nh as bb,rh as cb,oh as db,Yc as eb,Xc as fb,bn as gb,Be as hb,te as ib,yt as jb,bt as kb,xt as lb,Fc as mb,Et as nb,sh as ob,Gc as pb,Wc as qb,ch as rb,qc as sb,dh as tb,lh as ub,I as vb,Ah as wb,Rh as xb,Vr as yb,he as zb,zh as Ab,_h as Bb,Oh as Cb,Th as Db,wh as Eb,El as Fb,jh as Gb,$h as Hb,Il as Ib,Cl as Jb,Gh as Kb,Wh as Lb,Hh as Mb,Kh as Nb,Vh as Ob,qh as Pb,Zh as Qb,Ul as Rb,ey as Sb,ty as Tb,ry as Ub,af as Vb,Fb as Wb,Db as Xb,sf as Yb,Mb as Zb,$b as _b,Bb as $b,Gb as ac,iy as bc,sy as cc,pp as dc,dy as ec,py as fc,uy as gc,fy as hc,gy as ic,hy as jc,yy as kc,df as lc,lf as mc,Kb as nc,Vb as oc,qb as pc,To as qc,bp as rc,wo as sc,xp as tc,Io as uc,Sp as vc,Po as wc,Ep as xc,jo as yc,Rp as zc,zp as Ac,_p as Bc,Op as Cc,jn as Dc,Fo as Ec,Fn as Fc,Dn as Gc,Tp as Hc,wp as Ic,kp as Jc,Ip as Kc,Lo as Lc,Do as Mc,vp as Nc,Cp as Oc,Ln as Pc,Np as Qc,Mo as Rc,pf as Sc,uf as Tc,Oy as Uc,Bo as Vc,wy as Wc,Wo as Xc,jp as Yc,Fp as Zc,ky as _c,Lp as $c,Iy as ad,vy as bd,Ye as cd,Ny as dd,jy as ed,Ly as fd,Dy as gd,$p as hd,Uy as id,$y as jd,Bp as kd,Wp as ld,Hp as md,Kp as nd,qp as od,Zp as pd,tu as qd,Sf as rd,Ef as sd,au as td,Qe as ud,ei as vd,Je as wd,ti as xd,du as yd,ri as zd,oi as Ad,lu as Bd,pu as Cd,Af as Dd,pa as Ed,zf as Fd,uu as Gd,mu as Hd,fu as Id,Eu as Jd,ci as Kd,Ou as Ld,Tu as Md,ku as Nd,kt as Od,Iu as Pd,li as Qd,vu as Rd,Un as Sd,Cu as Td,Nu as Ud,Pu as Vd,ju as Wd,Fu as Xd,Lu as Yd,Du as Zd,Bn as _d,Mu as $d,Uu as ae,Gu as be,pi as ce,ui as de,Ku as ee,Vu as fe,Yu as ge,Xu as he,Ju as ie,em as je,fi as ke,sm as le,gi as me,hi as ne,Hn as oe,dm as pe,um as qe,mm as re,Si as se,Ei as te,Ai as ue,Ri as ve,fm as we,Oi as xe,qn as ye,bm as ze,Sm as Ae,Em as Be,Rm as Ce,_m as De,_f as Ee,vi as Fe,Qn as Ge,Zn as He,Km as Ie,Vm as Je,qm as Ke,Zm as Le,wf as Me,vf as Ne,Sa as Oe,Cf as Pe,Ea as Qe,Ff as Re};
|