sandforge 1.82.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/lib/{chunk-JLZRZL5E.mjs → chunk-262TP6UU.mjs} +1 -1
- package/lib/{chunk-Z42PHCVZ.mjs → chunk-27BBEGUD.mjs} +1 -1
- package/lib/{chunk-YGJF55VJ.mjs → chunk-2ADSD5WK.mjs} +1 -1
- package/lib/{chunk-KIMQQ6JQ.mjs → chunk-2GSMHGIV.mjs} +1 -1
- package/lib/chunk-2K5BYZQM.mjs +8 -0
- package/lib/{chunk-DJCGURW7.mjs → chunk-2KTGDYUH.mjs} +1 -1
- package/lib/{chunk-YAJQS3OL.mjs → chunk-2N73W63D.mjs} +1 -1
- package/lib/{chunk-LXDSRP2W.mjs → chunk-2R6GFNKF.mjs} +1 -1
- package/lib/{chunk-VZVICK7Q.mjs → chunk-2WMKJVD2.mjs} +1 -1
- package/lib/{chunk-CV47FDQW.mjs → chunk-36Y225OM.mjs} +1 -1
- package/lib/{chunk-3C2ZZIFN.mjs → chunk-3CM7LAPE.mjs} +1 -1
- package/lib/{chunk-HIHCYMSL.mjs → chunk-3OVTKRS4.mjs} +1 -1
- package/lib/{chunk-XFU3HRUV.mjs → chunk-3V4YH5KO.mjs} +1 -1
- package/lib/{chunk-XO5FBOQF.mjs → chunk-446GBKAC.mjs} +1 -1
- package/lib/{chunk-ZUOPC4W2.mjs → chunk-4GCYGQXD.mjs} +1 -1
- package/lib/{chunk-GCGHHN4K.mjs → chunk-4V3QO7HF.mjs} +1 -1
- package/lib/{chunk-VZT4E2OJ.mjs → chunk-4X5D3MSV.mjs} +1 -1
- package/lib/{chunk-P55MKIZX.mjs → chunk-5OGNK3JP.mjs} +1 -1
- package/lib/{chunk-3MGMNK3Q.mjs → chunk-6KOUYHEY.mjs} +1 -1
- package/lib/chunk-6QSHWIZI.mjs +48 -0
- package/lib/chunk-6VOQFISN.mjs +7 -0
- package/lib/{chunk-VYOYXTCU.mjs → chunk-6YC2ELCU.mjs} +1 -1
- package/lib/chunk-77IVKH7R.mjs +7 -0
- package/lib/{chunk-JKT5YAQ2.mjs → chunk-77MZRBWX.mjs} +1 -1
- package/lib/{chunk-PR74GYVI.mjs → chunk-7BQMBXKX.mjs} +1 -1
- package/lib/{chunk-SZGGFST2.mjs → chunk-7DPHZWA4.mjs} +1 -1
- package/lib/chunk-7V2UYZ6S.mjs +7 -0
- package/lib/{chunk-HKUWHVI7.mjs → chunk-7WSQ65WG.mjs} +1 -1
- package/lib/{chunk-LHU6CPGE.mjs → chunk-7ZBDACVG.mjs} +1 -1
- package/lib/{chunk-WT3SCUHS.mjs → chunk-AG24QMSY.mjs} +1 -1
- package/lib/{chunk-A65ADTCR.mjs → chunk-AHUGG3WU.mjs} +1 -1
- package/lib/{chunk-ZXFL2MSN.mjs → chunk-ALBY5SOH.mjs} +1 -1
- package/lib/chunk-AXFD2OH6.mjs +7 -0
- package/lib/{chunk-JESRFE2Z.mjs → chunk-BH76USTQ.mjs} +1 -1
- package/lib/{chunk-DBBPDSFN.mjs → chunk-BPHTA6KP.mjs} +1 -1
- package/lib/{chunk-3SKLBRPL.mjs → chunk-BT43WSOS.mjs} +1 -1
- package/lib/{chunk-32EUNQT6.mjs → chunk-BVZ5H3N4.mjs} +1 -1
- package/lib/{chunk-PWVDNN2C.mjs → chunk-C6RKM4BB.mjs} +1 -1
- package/lib/{chunk-27Z76O2O.mjs → chunk-CDWZGQAJ.mjs} +1 -1
- package/lib/chunk-CGZGL6VT.mjs +7 -0
- package/lib/{chunk-P63WJMXQ.mjs → chunk-CN5HGFG4.mjs} +1 -1
- package/lib/{chunk-Y4TDVDP2.mjs → chunk-CQAFVEKP.mjs} +1 -1
- package/lib/{chunk-G2JR3F63.mjs → chunk-CTPLYUXA.mjs} +1 -1
- package/lib/chunk-CXKZ6TYV.mjs +9 -0
- package/lib/{chunk-FKK5YBGZ.mjs → chunk-D6JT4PAB.mjs} +1 -1
- package/lib/{chunk-3CX7GPCR.mjs → chunk-D7XUNWWU.mjs} +1 -1
- package/lib/{chunk-PPHVWUFY.mjs → chunk-DB5RVDC5.mjs} +1 -1
- package/lib/{chunk-LAUOSXMN.mjs → chunk-DIGUC7S4.mjs} +1 -1
- package/lib/{chunk-6GQUZ4IP.mjs → chunk-DKDKCGXV.mjs} +1 -1
- package/lib/chunk-DMT5SCO3.mjs +7 -0
- package/lib/{chunk-KKOA62S4.mjs → chunk-DNQKVCUV.mjs} +4 -3
- package/lib/{chunk-3XG25GTF.mjs → chunk-DSR2MSBH.mjs} +1 -1
- package/lib/{chunk-ZHIZY3ZC.mjs → chunk-E3RQ575Y.mjs} +1 -1
- package/lib/{chunk-SAMWHL22.mjs → chunk-EOQON3E5.mjs} +1 -1
- package/lib/{chunk-2JZGCCPG.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-NWOI25WY.mjs → chunk-FVLFO2S6.mjs} +1 -1
- package/lib/{chunk-MKTXJCXN.mjs → chunk-FYWNSMOZ.mjs} +1 -1
- package/lib/{chunk-52EXDVPN.mjs → chunk-GEEWPTV5.mjs} +1 -1
- package/lib/{chunk-XSKPYGMT.mjs → chunk-GLN4PI5P.mjs} +1 -1
- package/lib/{chunk-DWMRIWV5.mjs → chunk-GT5ZKU6V.mjs} +1 -1
- package/lib/chunk-GTRU5AV5.mjs +7 -0
- package/lib/chunk-H33DVU3D.mjs +7 -0
- package/lib/{chunk-YAIIRFKJ.mjs → chunk-HQZUQXDC.mjs} +1 -1
- package/lib/{chunk-MUEQRIK7.mjs → chunk-HVX2AFYW.mjs} +1 -1
- package/lib/chunk-I3ZO76LL.mjs +21 -0
- package/lib/{chunk-7WSLT5VX.mjs → chunk-I5C4O3VA.mjs} +1 -1
- package/lib/{chunk-6VSZNZHH.mjs → chunk-IHGYJZZ2.mjs} +1 -1
- package/lib/{chunk-DIS254AN.mjs → chunk-ISA2NYJV.mjs} +1 -1
- package/lib/{chunk-GGUOIDWP.mjs → chunk-ISAUCWYK.mjs} +1 -1
- package/lib/{chunk-ZUTUYBNW.mjs → chunk-ISOSTAJR.mjs} +1 -1
- package/lib/chunk-IXIY6Q4M.mjs +7 -0
- package/lib/{chunk-2UU42PTD.mjs → chunk-J3TIHLWG.mjs} +1 -1
- package/lib/{chunk-GGNUACTY.mjs → chunk-JAV6F6OA.mjs} +1 -1
- package/lib/chunk-JBWJ6UEZ.mjs +7 -0
- package/lib/{chunk-C2N2TNEU.mjs → chunk-JH4ZTVQN.mjs} +1 -1
- package/lib/{chunk-FOIWWK7G.mjs → chunk-JIPT5FUD.mjs} +1 -1
- package/lib/{chunk-7EYQYZJP.mjs → chunk-JREKJO3D.mjs} +1 -1
- package/lib/{chunk-VQJMP3DC.mjs → chunk-JUOQUG7U.mjs} +1 -1
- package/lib/chunk-JYUMD357.mjs +7 -0
- package/lib/{chunk-KP5G6FUC.mjs → chunk-K7G3W7XH.mjs} +1 -1
- package/lib/{chunk-T7WREYA5.mjs → chunk-KKS2KFBT.mjs} +1 -1
- package/lib/{chunk-TMA34QMA.mjs → chunk-KWAVSZ2B.mjs} +1 -1
- package/lib/{chunk-H4JUYUSL.mjs → chunk-KXUOHACP.mjs} +1 -1
- package/lib/{chunk-STRMWSIQ.mjs → chunk-L3I6DAHX.mjs} +1 -1
- package/lib/{chunk-TCBAE65A.mjs → chunk-L47JCNP3.mjs} +1 -1
- package/lib/{chunk-5K2I2DMP.mjs → chunk-L4MSL4U7.mjs} +1 -1
- package/lib/chunk-L4RJX7DG.mjs +7 -0
- package/lib/{chunk-47UHTN3Q.mjs → chunk-L6CLN664.mjs} +1 -1
- package/lib/chunk-LI2XNV7F.mjs +7 -0
- package/lib/chunk-LP2D3JJP.mjs +7 -0
- package/lib/{chunk-KJYEQHYP.mjs → chunk-LWES2KZE.mjs} +1 -1
- package/lib/{chunk-3HEMJTAP.mjs → chunk-LYOGCIYD.mjs} +2 -2
- package/lib/{chunk-VPDEJGPS.mjs → chunk-MJD6CPZZ.mjs} +1 -1
- package/lib/{chunk-SNEOKYV7.mjs → chunk-MTM4KG3T.mjs} +1 -1
- package/lib/{chunk-J24TIGSI.mjs → chunk-N2HYG3BL.mjs} +1 -1
- package/lib/chunk-N5UIE4IR.mjs +7 -0
- package/lib/{chunk-YMDFF657.mjs → chunk-NDFFIJL5.mjs} +1 -1
- package/lib/{chunk-WOOUISSO.mjs → chunk-NFEBX75O.mjs} +1 -1
- package/lib/{chunk-ZUBBEP75.mjs → chunk-NNV7IGM7.mjs} +1 -1
- package/lib/{chunk-Q3DY7TO2.mjs → chunk-NS6ONPWL.mjs} +1 -1
- package/lib/{chunk-IVZJSDJD.mjs → chunk-O7GCCRPW.mjs} +1 -1
- package/lib/{chunk-A7JJWOLT.mjs → chunk-OO24ZYYJ.mjs} +1 -1
- package/lib/chunk-OOIDCHBQ.mjs +9 -0
- package/lib/{chunk-AUS6NFLZ.mjs → chunk-OS5GE52G.mjs} +1 -1
- package/lib/chunk-OS6HFJ7L.mjs +7 -0
- package/lib/{chunk-V3R45ZWT.mjs → chunk-OTJH6AEA.mjs} +1 -1
- package/lib/{chunk-PBE44M2Y.mjs → chunk-OUU47Y7A.mjs} +1 -1
- package/lib/{chunk-BN33LVPQ.mjs → chunk-P6WRYJN3.mjs} +1 -1
- package/lib/{chunk-JJITOWZK.mjs → chunk-PDRXM5WN.mjs} +1 -1
- package/lib/{chunk-RYRMUPMY.mjs → chunk-PGRY365W.mjs} +1 -1
- package/lib/chunk-Q4PPI3KG.mjs +7 -0
- package/lib/chunk-QFTF2PGS.mjs +21 -0
- package/lib/chunk-QKJXIY6L.mjs +7 -0
- package/lib/{chunk-PYRZFUVU.mjs → chunk-QLRWU3MB.mjs} +1 -1
- package/lib/chunk-QO4MPHZD.mjs +7 -0
- package/lib/chunk-QP3JLFIO.mjs +7 -0
- package/lib/{chunk-NLB3RGIY.mjs → chunk-QQDZQCO2.mjs} +1 -1
- package/lib/{chunk-7CVDVBEE.mjs → chunk-QXB6U3ZP.mjs} +1 -1
- package/lib/chunk-R3OM3X4L.mjs +8 -0
- package/lib/chunk-R7GKMAT4.mjs +7 -0
- package/lib/{chunk-YT22LMF7.mjs → chunk-RVCPQVKM.mjs} +1 -1
- package/lib/{chunk-TWV4A5RK.mjs → chunk-RZKJQOOC.mjs} +1 -1
- package/lib/chunk-S4PRKKGC.mjs +8 -0
- package/lib/{chunk-JH27IKCO.mjs → chunk-SX6QWYCQ.mjs} +1 -1
- package/lib/{chunk-UHFLKP26.mjs → chunk-T36DZJPH.mjs} +1 -1
- package/lib/{chunk-CZLJZQCS.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-GBGHJTPC.mjs → chunk-U2CTKIPE.mjs} +1 -1
- package/lib/{chunk-3HROD5RE.mjs → chunk-U4YFYSF3.mjs} +1 -1
- package/lib/{chunk-Q6SXNKV2.mjs → chunk-UIR77ZJD.mjs} +1 -1
- package/lib/{chunk-FA4ZKDCU.mjs → chunk-UOHZW2L4.mjs} +1 -1
- package/lib/{chunk-7PY3VQP3.mjs → chunk-VXZ5PTOM.mjs} +1 -1
- package/lib/{chunk-7LKI7OAS.mjs → chunk-VZLJZEV2.mjs} +1 -1
- package/lib/{chunk-YH4DYI6D.mjs → chunk-W3BQGMTR.mjs} +1 -1
- package/lib/{chunk-CELEBWEZ.mjs → chunk-WABXKL4N.mjs} +1 -1
- package/lib/{chunk-EEFUE2ES.mjs → chunk-WAYQLQAD.mjs} +1 -1
- package/lib/{chunk-RCYEBY42.mjs → chunk-WBELLGNE.mjs} +1 -1
- package/lib/{chunk-SFGZFB4F.mjs → chunk-WJAZ5LHL.mjs} +1 -1
- package/lib/{chunk-JQZTMFO7.mjs → chunk-WXU6ZJIV.mjs} +1 -1
- package/lib/{chunk-GJ6SZVHT.mjs → chunk-WZN36ACK.mjs} +1 -1
- package/lib/{chunk-XU25YA46.mjs → chunk-X2XZQ434.mjs} +1 -1
- package/lib/{chunk-QAPVKPEC.mjs → chunk-X4HZD5U2.mjs} +1 -1
- package/lib/chunk-X6XNTOGO.mjs +7 -0
- package/lib/{chunk-XK5W7BVE.mjs → chunk-XAMMIPZ4.mjs} +1 -1
- package/lib/{chunk-DT3T7FRD.mjs → chunk-XAUQXYPW.mjs} +1 -1
- package/lib/{chunk-C3LNYAVJ.mjs → chunk-XCJUNX63.mjs} +1 -1
- package/lib/chunk-XJICAOAQ.mjs +7 -0
- package/lib/{chunk-CBL42DUU.mjs → chunk-XKFHTBAB.mjs} +1 -1
- package/lib/{chunk-O2PUGRNW.mjs → chunk-XMQ5R6TC.mjs} +1 -1
- package/lib/chunk-XPXEQKLR.mjs +7 -0
- package/lib/{chunk-6KP6WETK.mjs → chunk-Y7YUNRKK.mjs} +1 -1
- package/lib/{chunk-WSUKC2U3.mjs → chunk-YBZIDW6W.mjs} +1 -1
- package/lib/{chunk-RTWYLOCA.mjs → chunk-YEVB7LVK.mjs} +1 -1
- package/lib/{chunk-L4INJ5TZ.mjs → chunk-Z3MGN42K.mjs} +1 -1
- package/lib/{chunk-EOFO3PHS.mjs → chunk-ZB5E7NHU.mjs} +1 -1
- package/lib/chunk-ZCOSME6P.mjs +7 -0
- package/lib/{chunk-HFUDCNU5.mjs → chunk-ZOSESZ22.mjs} +1 -1
- package/lib/chunk-ZTHC42X6.mjs +7 -0
- package/lib/{chunk-XZISAZA6.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 +98 -99
- package/lib/sandforge-frozen.mjs +1 -1
- package/lib/sandforge-mcp.mjs +2 -2
- package/lib/sandforge-monitor.mjs +1 -1
- package/lib/sandforge-pipeline.mjs +1 -1
- package/lib/sandforge-seed.mjs +1 -1
- package/lib/sandforge-sync.mjs +1 -1
- package/lib/sandforge-users.mjs +21 -23
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/lib/chunk-42BFLWHR.mjs +0 -7
- package/lib/chunk-466F37VD.mjs +0 -7
- package/lib/chunk-7SDZR6SR.mjs +0 -7
- package/lib/chunk-BMTNTBBM.mjs +0 -7
- package/lib/chunk-CCEH7L53.mjs +0 -7
- package/lib/chunk-DIL62SUN.mjs +0 -7
- package/lib/chunk-FZF23M6R.mjs +0 -7
- package/lib/chunk-GHPR5UVV.mjs +0 -7
- package/lib/chunk-HQQVANWQ.mjs +0 -20
- package/lib/chunk-IRZJU2PG.mjs +0 -22
- package/lib/chunk-ISSP2FZ5.mjs +0 -7
- package/lib/chunk-JFNLKHY6.mjs +0 -8
- package/lib/chunk-O4BROUGM.mjs +0 -7
- package/lib/chunk-PE435FVH.mjs +0 -15
- package/lib/chunk-RLWB7F26.mjs +0 -7
- package/lib/chunk-WEMLDUQA.mjs +0 -7
- package/lib/chunk-ZQO5PDX5.mjs +0 -48
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{d as Z}from"./chunk-HFSBDM7B.mjs";import{c as H,g as Y}from"./chunk-OHEOJISY.mjs";import{a as F}from"./chunk-EADHKH3A.mjs";import{g as W,t as Q}from"./chunk-KIMQQ6JQ.mjs";import{a as U,f as D,h as k}from"./chunk-TZE3Y7IQ.mjs";import{a as P}from"./chunk-ICIYL45C.mjs";import{d as J}from"./chunk-PR74GYVI.mjs";import{Hc as R,O as z,Q as B,T as V}from"./chunk-ZQO5PDX5.mjs";import{b as I,k as G,l as A,v as K,z as _}from"./chunk-WZQEK4WT.mjs";function Le(e){let n=new Set;for(let t of e)t.controllerName&&n.add(t.controllerName);return n}function X(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0}function je(e,n){let t=X(e.precision),r=typeof e.scale=="number"&&e.scale>=0?e.scale:void 0,o=X(e.digits),s=(e.picklistValues??[]).filter(d=>d!==null&&typeof d.value=="string"),i={};if(e.controllerName)for(let d of s)d.active===!1||typeof d.validFor!="string"||(i[d.value]=d.validFor);return{...t!==void 0?{precision:t}:{},...t!==void 0&&r!==void 0?{scale:r}:{},...o!==void 0?{digits:o}:{},...e.unique===!0?{unique:!0}:{},...e.unique===!0&&typeof e.caseSensitive=="boolean"?{caseSensitive:e.caseSensitive}:{},...e.calculated===!0?{calculated:!0}:{},...e.filteredLookupInfo?{filteredLookup:!0}:{},...Object.keys(i).length>0?{validFor:i}:{},...n.has(e.name)&&s.length>0?{controllingValues:s.map(d=>d.value)}:{}}}function Ce(e,n){return e.caseSensitive===!1?n.toLowerCase():n}function M(e,n){if(n<0)return!1;let r=Buffer.from(e,"base64")[n>>3];return r!==void 0&&(r&128>>n%8)!==0}var ie={picklist_value_refused:["map_value","leave_empty","skip_rows","exclude_object","ignore"],dependent_value_invalid:["map_value","leave_empty","exclude_object","ignore"],picklist_value_absent:["map_value","skip_rows","ignore"],required_field_missing:["set_default","exclude_object","ignore"],value_too_long:["truncate","exclude_object","ignore"],number_out_of_range:["exclude_object","ignore"],record_type_unmapped:["map_record_type","exclude_object","ignore"],record_type_unavailable:["map_record_type","exclude_object","ignore"],currency_inactive:["map_value","skip_rows","exclude_object","ignore"],unique_value_collision:["exclude_object","ignore"]};function w(e){return[...ie[e]??["ignore"]]}var se=100,ae=new Set(["longest","colliding"]),O=class{gaps=new Map;recordTypes=new Map;get size(){return this.gaps.size}knowRecordTypes(n,t,r){let o=de(r);o!==void 0&&this.recordTypes.set(n,{...this.recordTypes.get(n),[t]:o})}add(n){let t=z(n.kind,n.objectApiName,n.field,n.recordType,n.value),r=this.gaps.get(t);if(!r){this.gaps.set(t,{...n,id:t,source:"simulation",decisions:[...n.decisions]});return}r.rows+=n.rows,n.decisions.includes("skip_rows")||(r.decisions=r.decisions.filter(s=>s!=="skip_rows"));let o={...n.detail??{},...r.detail??{}};for(let s of ae){let i=r.detail?.[s],d=n.detail?.[s];typeof i=="number"&&typeof d=="number"&&(o[s]=Math.max(i,d))}r.detail=o}list(n){let t=[...this.gaps.keys()],r=[...this.gaps.values()].map(o=>this.withSameDeveloperName(o)).map(o=>B(n,o,t)!==void 0?{...o,detail:{...o.detail??{},ignored:!0}}:o);return V(r)}withSameDeveloperName(n){let t=n.kind==="record_type_unmapped";return le(n,this.recordTypes.get(n.objectApiName)?.[t?"source":"target"])}};function de(e){let n=e.filter(t=>!t.master);if(!n.some(t=>t.namespacePrefix===void 0))return n.map(Z)}function le(e,n){let t=e.kind==="record_type_unmapped"?e.value:e.recordType;if(t===void 0||n===void 0)return e;let r=Y(t);if(!r.namespacePrefix)return e;let o=n.filter(s=>s.developerName===r.developerName&&s.namespacePrefix!==r.namespacePrefix).map(s=>H(s.namespacePrefix,s.developerName));return o.length===0?e:{...e,detail:{...e.detail??{},sameDeveloperName:[...new Set(o)].sort()}}}function L(e){return[...new Set(e)].sort().slice(0,se)}function We(e,n,t){let r=[];for(let o of n){if(o.field===P)continue;let s=t(o);for(let i of o.values)r.push({kind:"picklist_value_refused",severity:"warning",objectApiName:e,field:o.field,...o.recordType!==void 0?{recordType:o.recordType}:{},value:i,rows:1,detail:{reason:o.reason,...s?{allowed:L(s)}:{},...o.controllingField?{controllingField:o.controllingField}:{},...o.replacedBy!==void 0?{replacement:o.replacedBy}:{}},decisions:w("picklist_value_refused").filter(d=>d!=="skip_rows"||o.reason!=="controlling-value"),defaultDecision:o.replacedBy!==void 0?"map_value":"leave_empty"})}return r}var ce=new Set(["string","textarea","email","phone","url","encryptedstring"]),ue=new Set(["double","currency","percent"]);function fe(e){return e==null||e===""}function ne(e){return e.createable&&e.nillable===!1&&e.defaultedOnCreate!==!0&&e.calculated!==!0&&e.type!=="boolean"}function pe(e,n,t){return e==="Account"&&n==="Name"&&Q(t)}function ge(e,n,t,r){return r.filter(o=>ne(o)&&fe(n[o.name])&&!pe(e,o.name,t))}function me(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string"||e.trim()==="")return;let n=Number(e);return Number.isFinite(n)?n:void 0}function ee(e){if(e.type==="int"&&e.digits!==void 0)return e.digits;if(e.precision!==void 0)return e.precision-(e.scale??0)}function ye(e,n){return e?e.type==="boolean"?n===!0||n==="true"?1:n===!1||n==="false"?0:-1:typeof n!="string"||n===""?-1:(e.controllingValues??[]).indexOf(n):-1}function te(e,n){let{objectApiName:t,rows:r,targetFields:o,picklistValuesByField:s,picklistFields:i}=e,d=new Map(o.map(u=>[u.name,u])),f=o.filter(ne),y=o.filter(u=>u.createable&&ce.has(u.type??"")&&(u.length??0)>0),g=o.filter(u=>u.createable&&(ue.has(u.type??"")||u.type==="int")&&ee(u)!==void 0),c=[...i].filter(([u,l])=>l.anyValue===!0&&s?.has(u)===!0),p=o.filter(u=>u.createable&&u.controllerName!==void 0&&u.validFor!==void 0);for(let{payload:u,source:l,typed:m}of r){for(let a of ge(t,u,l,f))n.add({kind:"required_field_missing",severity:"blocking",objectApiName:t,field:a.name,rows:1,...a.type?{detail:{type:a.type}}:{},decisions:w("required_field_missing")});for(let a of y){let h=u[a.name],b=a.length??0;typeof h!="string"||h.length<=b||n.add({kind:"value_too_long",severity:"blocking",objectApiName:t,field:a.name,rows:1,detail:{length:b,longest:h.length},decisions:w("value_too_long")})}for(let a of g){let h=me(u[a.name]),b=ee(a);h===void 0||b===void 0||Math.abs(Math.trunc(h))<10**b||n.add({kind:"number_out_of_range",severity:"blocking",objectApiName:t,field:a.name,rows:1,detail:{...a.precision!==void 0?{precision:a.precision}:{},...a.scale!==void 0?{scale:a.scale}:{},...a.type==="int"&&a.digits!==void 0?{digits:a.digits}:{}},decisions:w("number_out_of_range")})}for(let[a,h]of c){let b=u[a];if(typeof b!="string"||b==="")continue;let x=s?.get(a),v=h.multi?b.split(";"):[b];for(let E of new Set(v))x?.has(E)||n.add({kind:"picklist_value_absent",severity:"info",objectApiName:t,field:a,value:E,rows:1,decisions:w("picklist_value_absent")})}if(!m)for(let a of p){let h=u[a.name];if(typeof h!="string"||h==="")continue;let b=d.get(a.controllerName??""),x=ye(b,u[a.controllerName??""]),v=i.get(a.name)?.restricted===!0,E=i.get(a.name)?.multi?h.split(";"):[h];for(let q of new Set(E)){let $=a.validFor?.[q];$!==void 0&&(x>=0&&M($,x)||n.add({kind:"dependent_value_invalid",severity:v?"blocking":"warning",objectApiName:t,field:a.name,value:q,rows:1,detail:{controllingField:a.controllerName??"",allowed:L((b?.controllingValues??[]).filter((Me,oe)=>M($,oe)))},decisions:w("dependent_value_invalid")}))}}}}function Qe(e,n,t,r){return{kind:"currency_inactive",severity:"warning",objectApiName:e,field:P,value:n,rows:t,...r&&r.to.length>0?{detail:{replacement:r.to.join(", "),...r.converted.length>0?{amountsConverted:[...r.converted]}:{},...r.asRead?{amountsAsRead:!0}:{}}}:{},decisions:w("currency_inactive"),defaultDecision:"map_value"}}function He(e,n,t,r){return{kind:"unique_value_collision",severity:"warning",objectApiName:e,field:n,rows:t,detail:{colliding:r,linkedToTheRecordItNames:!0},decisions:w("unique_value_collision"),defaultDecision:"ignore"}}function Ye(e,n,t,r,o){return{kind:e,severity:"blocking",objectApiName:n,field:"RecordTypeId",...e==="record_type_unavailable"?{recordType:t}:{value:t},rows:r,detail:{mapTo:L(o)},decisions:w(e)}}var he=10;function re(e){switch(e.operation){case"insert":return null;case"upsert":return e.externalIdField??"Id";case"update":case"delete":return"Id"}}function S(e){if(e==null||typeof e!="string"&&typeof e!="number"&&typeof e!="boolean")return null;let n=String(e);return n===""?null:n.toLowerCase()}function T(e){return typeof e=="number"&&Number.isFinite(e)?String(e):typeof e=="boolean"?e?"true":"false":`'${U(String(e))}'`}var be=200,Se=4e3;function N(e){let n=[],t=[],r=0;for(let o of e){let s=T(o).length+2;t.length>0&&(t.length>=be||r+s>Se)&&(n.push(t),t=[],r=0),t.push(o),r+=s}return t.length>0&&n.push(t),n}function rn(e,n){return async(t,r,o,s)=>{let i=R(r.objectApiName),d=k(o),f=new Map;for(let y of N(s)){if(n?.aborted)throw new Error("The simulation was cancelled.");let{records:g}=await F(e,`SELECT ${d} FROM ${i} WHERE ${d} IN (${y.map(T).join(", ")})`);for(let c of g){let p=S(c[d]);p!==null&&f.set(p,(f.get(p)??0)+1)}}return f}}var we=new Set(["attributes","Id"]);function Re(e,n,t,r){return n?e.conflictFields.filter(o=>o!==t&&!we.has(o)&&o in n&&(r===null||r.has(o))):[]}var on=new Set(["noKey","notInTarget","ambiguous"]);function _e(e,n,t){let r=e.operation,o=re(e);if(o===null)return"insert";let s=S(n[o]);if(s===null)return r==="delete"?"notSent":"noKey";let i=t.get(s)??0;return r==="upsert"?i===0?o.toLowerCase()==="id"?"notInTarget":"insert":i===1?"update":"ambiguous":i===0?"notInTarget":r==="update"?"update":"delete"}var ke=1e4;function sn(e,n,t){let r=e>t?ke:Math.max(1,n);return{callOf:o=>Math.floor(o/r),job:e>t}}function an(e,n,t,r){let o=new Map;n.forEach((c,p)=>{if(c===null)return;let u=`${r.callOf(p)}\0${c}`,l=o.get(u);l?l.push(p):o.set(u,[p])});let s=new Set;for(let c of o.values())if(c.length>1)for(let p of c)s.add(p);let i=new Map,d=new Set,f=0;n.forEach((c,p)=>{if(c===null||s.has(p))return;let u=r.callOf(p);if(i.get(c)===void 0){t[p]==="insert"&&i.set(c,u);return}r.job?f++:t[p]==="insert"&&d.add(p)});let y=[],g=[];if(s.size>0){let c=`${s.size} record(s) carry the ${e} of another record of the same call: an upsert finds its record by its key, and the target refuses every record of a call whose key another carries (DUPLICATE_VALUE: Duplicate external id specified).`;y.push(c),g.push({code:"DUPLICATE_VALUE",rows:s.size,note:c})}return d.size>0&&y.push(`${d.size} record(s) carry the ${e} of a record sent in an earlier call: the upsert finds the record that one created and updates it with theirs.`),f>0&&y.push(`${f} record(s) carry the ${e} of a record in another batch of the Bulk API job: the platform may write the batches at once, so whether each updates the record the other created or creates one of its own cannot be told before the run.`),{refused:s,updated:d,notes:y,refusedFor:g}}function dn(e){let{objectConfig:n,records:t,inTarget:r}=e,o=n.operation,s=re(n),i={insert:0,update:0,delete:0,noKey:0,notInTarget:0,notSent:0,ambiguous:0},d=new Set;t.forEach((l,m)=>{let a=e.simulated?.[m]??_e(n,l,r);i[a]++,(a==="insert"||a==="update")&&d.add(m)});let f=e.leftOut.map(({why:l,count:m})=>W(m,l));i.noKey>0&&f.push(o==="upsert"?`${i.noKey} record(s) carry no value in ${s}: an upsert matches on it, and the target refuses a record without one.`:`${i.noKey} record(s) carry no Id: an update finds its record by Id, and the target refuses one without it.`),i.notInTarget>0&&f.push(`${i.notInTarget} record(s) carry an Id the target does not hold: ${o==="upsert"?"an upsert on the Id finds no record there and creates none":`${o==="update"?"an update":"a delete"} finds no record there`}, and the target refuses it. Two orgs share a record's Id only when it was copied with the org.`),i.ambiguous>0&&f.push(`${i.ambiguous} record(s) match more than one record of the target on ${s}: an upsert finds no single record to update, and the target refuses it.`),i.notSent>0&&f.push(`${i.notSent} record(s) carry no Id: a delete sends ids alone, so the run leaves them out.`);let y=new Map;e.unsettled.forEach((l,m)=>{let a=String(l[e.matchField]??"");a&&d.has(m)&&y.set(a,l)});let g=new Map,c=0;for(let l of e.conflicts){let m=Re(l,y.get(l.recordId),e.matchField,e.writable);if(m.length!==0){c++;for(let a of m)g.set(a,(g.get(a)??0)+1)}}let p=[...g].sort(([l,m],[a,h])=>h-m||l.localeCompare(a)).slice(0,he).map(([l])=>l),u=e.leftOut.reduce((l,{count:m})=>l+m,0);return{objectApiName:n.objectApiName,operation:o,read:e.read,insert:i.insert,update:i.update,delete:i.delete,skipped:u+i.notSent,refused:i.noKey+i.notInTarget+i.ambiguous,conflicts:c,conflictFields:p,notes:f}}var Fe={required_field_missing:"REQUIRED_FIELD_MISSING",value_too_long:"STRING_TOO_LONG",number_out_of_range:"NUMBER_OUTSIDE_VALID_RANGE"};function Ie(e){let n=e.field??"";switch(e.kind){case"required_field_missing":return`${e.rows} record(s) leave ${n} empty, which the target requires: it refuses them (REQUIRED_FIELD_MISSING).`;case"value_too_long":return`${e.rows} record(s) hold a ${n} longer than the ${String(e.detail?.length)} characters the target's field takes (the longest, ${String(e.detail?.longest)}): it refuses them (STRING_TOO_LONG).`;case"number_out_of_range":return`${e.rows} record(s) hold a ${n} larger than the target's field takes: it refuses them (NUMBER_OUTSIDE_VALID_RANGE).`;default:return}}function ln(e,n,t){let r=new Set,o=new O;n.forEach(({payload:i,source:d,creates:f},y)=>{let g=new O;te({objectApiName:e,rows:[{payload:i,source:d,typed:!0}],targetFields:t,picklistValuesByField:null,picklistFields:new Map},g);let c=g.list(new Set).filter(p=>p.severity==="blocking"&&(f||p.kind!=="required_field_missing"));if(c.length!==0){r.add(y);for(let p of c)o.add(p)}});let s=o.list(new Set).flatMap(i=>{let d=Ie(i),f=Fe[i.kind];return d&&f?[{code:f,rows:i.rows,note:d}]:[]});return{refused:r,notes:s.map(({note:i})=>i),refusedFor:s}}function cn(e,n){let t=new Set,r=new Set,o=[],s=[];for(let[i,d]of n){let f=new Set,y=0,g=0,c=0;if(e.forEach((u,l)=>{let m=S(u[i]);if(m===null)return;let a=d.get(m)??0;a===1?(y++,r.add(l)):a>1?(g++,t.add(l)):f.has(m)&&(c++,t.add(l)),f.add(m)}),y>0&&o.push(`LINKED_TO_EXISTING: ${y} record(s) hold a ${i} the target keeps unique, which a record of the target holds already: it refuses them as duplicates (DUPLICATE_VALUE) and names that record, which the run links them to \u2014 what it writes under them points at that record.`),g+c===0)continue;let p=`${g+c} record(s) hold a ${i} the target keeps unique, which `+[g>0?`several records of the target hold already (${g})`:"",c>0?`a record sent before them holds (${c})`:""].filter(Boolean).join(" or ")+": it refuses them (DUPLICATE_VALUE).";o.push(p),s.push({code:"DUPLICATE_VALUE",rows:g+c,note:p})}for(let i of t)r.delete(i);return{refused:t,linked:r,notes:o,refusedFor:s}}import{createHash as Oe}from"node:crypto";var Te=5*6e4,xe=500,Ee=A({sourceOrgId:I().min(1).max(200),targetOrgId:I().min(1).max(200),objectApiName:I().regex(/^[A-Za-z][A-Za-z0-9_]{0,79}$/),watermark:_.datetime(),fingerprint:I().regex(/^[0-9a-f]{64}$/),recordedAt:_.datetime(),filesSeen:_.datetime().optional(),removedAt:_.datetime().optional()}),Ne=A({version:K(1),entries:G(Ee).max(xe),resetAt:_.datetime().optional()});function Sn(e){if(e==null)return{kind:"none"};let n=Ne.safeParse(e);if(n.success)return{kind:"stored",state:n.data};let t=n.error.issues[0];return{kind:"unreadable",issue:`${t.path.join(".")||"state"}: ${t.message}`}}function j(e){return Array.isArray(e)?`[${e.map(j).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>t<r?-1:t>r?1:0).map(([t,r])=>`${JSON.stringify(t)}:${j(r)}`).join(",")}}`:JSON.stringify(e)}function C(e){let n=e?.trim();return n||null}function ve(e,n){let t={direction:e.direction,conflictStrategy:e.conflictStrategy,copiesFiles:e.files?!0:void 0,objectApiName:n.objectApiName,operation:n.operation,externalIdField:C(n.externalIdField),where:C(n.where),fieldMappings:n.fieldMappings??[],unmappedSentAsRead:(n.fieldMappings??[]).length>0?!0:void 0,transformRules:n.transformRules??[],excludedFields:n.excludedFields??[],addOnFields:n.addOnFields??[]};return Oe("sha256").update(j(t)).digest("hex")}function wn(e,n,t){let r=ve(e,n);if(t===null)return{read:"full",reason:"not_saved",fingerprint:r};if(t.kind==="unreadable")return{read:"full",reason:"unreadable",fingerprint:r};if(t.kind==="none")return{read:"full",reason:"first_run",fingerprint:r};let o=t.state.entries.find(s=>s.sourceOrgId===e.sourceOrgId&&s.targetOrgId===e.targetOrgId&&s.objectApiName===n.objectApiName);return o?o.fingerprint!==r?{read:"full",reason:"scope_changed",fingerprint:r}:o.removedAt!==void 0?{read:"full",reason:"removed",fingerprint:r}:{read:"delta",since:o.watermark,fingerprint:r,...o.filesSeen!==void 0?{filesSeen:o.filesSeen}:{}}:{read:"full",reason:t.state.resetAt?"reset":"first_run",fingerprint:r}}var $e=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/;function Rn(e,n=Te){let t=Date.parse(e);if(!Number.isFinite(t))throw new Error(`Not a watermark: "${e}".`);let r=Math.floor((t-n)/1e3)*1e3;return new Date(r).toISOString().replace(/\.\d{3}Z$/,"Z")}function _n(e){let n=Date.parse(e);if(!Number.isFinite(n))throw new Error(`Not a date: "${e}".`);return new Date(Math.floor(n/1e3)*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")}function Ae(e){if(!$e.test(e)||!Number.isFinite(Date.parse(e)))throw new Error(`Not a SOQL datetime: "${e}".`);return e}function kn(e,n){let t=e?.trim()?D(e):void 0;if(n===void 0)return t;let r=`SystemModstamp > ${Ae(n)}`;return t?`${r} AND (${t})`:r}function De(e){if(typeof e!="string"||e==="")return null;let n=Date.parse(e.replace(/([+-]\d{2})(\d{2})$/,"$1:$2"));return Number.isFinite(n)?new Date(n).toISOString():null}function Fn(e,n,t){let r={query:i=>e.query(i),queryMore:i=>e.queryMore(i)},o={query:i=>e.query(i,{scanAll:!0}),queryMore:i=>e.queryMore(i)},s=()=>{if(t?.aborted)throw new Error("The run was cancelled.")};return{async latestModstamp(i){let d=R(i),y=(await e.query(`SELECT SystemModstamp FROM ${d} ORDER BY SystemModstamp DESC LIMIT 1`)).records[0];if(!y)return null;let g=De(y.SystemModstamp);if(g===null)throw new Error(`${d} answered a SystemModstamp that is not a date.`);return g},async deletedRows(i,d,f){let y=R(i),g=new Set(["Id","SystemModstamp",...d.map(k)]),{records:c,truncated:p}=await F(o,`SELECT ${[...g].join(", ")} FROM ${y} WHERE IsDeleted = true AND (${D(f)})`);return{records:c,truncated:p}},async heldInSource(i,d,f){let y=R(i),g=k(d),c=new Set;for(let p of N(f)){s();let{records:u}=await F(r,`SELECT ${g} FROM ${y} WHERE ${g} IN (${p.map(T).join(", ")})`);for(let l of u){let m=S(l[g]);m!==null&&c.add(m)}}return c},async targetIdsByKey(i,d,f){let y=R(i),g=k(d),c=g==="Id"?"Id":`Id, ${g}`,p=new Map;for(let u of N(f)){s();let{records:l}=await F(n,`SELECT ${c} FROM ${y} WHERE ${g} IN (${u.map(T).join(", ")})`);for(let m of l){let a=S(m[g]);a===null||typeof m.Id!="string"||p.set(a,[...p.get(a)??[],m.Id])}}return p}}}var Pe=new Set(["direct","rename","transform"]);function In(e){let n=e.objectApiName;if(e.operation==="insert"||e.operation==="delete")return{refused:`${n} is written by ${e.operation}, which finds no record by a key: a deleted source record cannot be tied to a target record.`};if(e.operation==="update")return{sourceField:"Id",keyField:"Id"};let t=C(e.externalIdField)??"Id";if((e.addOnFields??[]).some(s=>s.fieldApiName===t))return{refused:`${n}: an add-on writes ${t}, the key the upsert matches on, so it ties no deleted source record to one target record.`};let r=e.fieldMappings??[],o=r.find(s=>s.targetField.toLowerCase()===t.toLowerCase());return!o&&!J(r,e.excludedFields??[]).has(t.toLowerCase())?{sourceField:t,keyField:t}:!o||!Pe.has(o.type)?{refused:`${n}: no source field is carried onto ${t}, the key the upsert matches on, so no deleted source record can be tied to a target record.`}:{sourceField:o.sourceField,keyField:t}}async function On(e,n,t,r,o){let s=n.objectApiName,{records:i,truncated:d}=await e.deletedRows(s,[t.sourceField],r),f={ids:[],read:i.length,stillInSource:0,ambiguous:0,noKey:0,truncated:d};if(i.length===0)return f;let y=[];for(let l of i){let m=l[t.sourceField],a=o(l);if(S(m)===null||S(a)===null){f.noKey++;continue}y.push({raw:m,key:a})}if(y.length===0)return f;let g=t.sourceField==="Id"?new Set:await e.heldInSource(s,t.sourceField,y.map(l=>l.raw)),c=y.filter(l=>g.has(S(l.raw))?(f.stillInSource++,!1):!0);if(c.length===0)return f;let p=await e.targetIdsByKey(s,t.keyField,c.map(l=>l.key)),u=new Set;for(let l of c){let m=p.get(S(l.key))??[];m.length>1?f.ambiguous++:m.length===1&&!u.has(m[0])&&(u.add(m[0]),f.ids.push(m[0]))}return f}function Tn(e,n){let t=[];return e.stillInSource>0&&t.push(`${e.stillInSource} record(s) deleted in the source share their ${n} with a record the source still holds: their target record was kept.`),e.ambiguous>0&&t.push(`${e.ambiguous} record(s) deleted in the source match more than one target record on ${n}: none of those target records was deleted.`),e.noKey>0&&t.push(`${e.noKey} record(s) deleted in the source carry no ${n}: no target record is tied to them.`),e.truncated&&t.push("The source's deleted records were read up to a bound: the rest are read by the next run, from the same watermark."),t}function xn(e,n,t,r,o=0){return{read:e.read,...e.read==="delta"?{since:e.since}:{reason:e.reason},changed:n,deletionsChecked:t!==void 0,deleted:t?.deleted??0,deleteFailed:t?.deleteFailed??0,...t?.error!==void 0?{deletionError:t.error}:{},...r!==void 0?{recorded:r}:{},...o>0?{lookupsOwed:o}:{}}}export{Le as a,je as b,Ce as c,ie as d,O as e,de as f,le as g,We as h,ge as i,te as j,Qe as k,He as l,Ye as m,re as n,S as o,rn as p,on as q,_e as r,sn as s,an as t,dn as u,ln as v,cn as w,Te as x,Sn as y,wn as z,Rn as A,_n as B,Ae as C,kn as D,De as E,Fn as F,In as G,On as H,Tn as I,xn as J};
|
|
7
|
+
import{d as Z}from"./chunk-HFSBDM7B.mjs";import{c as H,g as Y}from"./chunk-OHEOJISY.mjs";import{a as F}from"./chunk-EADHKH3A.mjs";import{g as W,t as Q}from"./chunk-2GSMHGIV.mjs";import{a as U,f as D,h as k}from"./chunk-TZE3Y7IQ.mjs";import{a as P}from"./chunk-ICIYL45C.mjs";import{d as J}from"./chunk-7BQMBXKX.mjs";import{O as z,Q as B,T as V,Uc as R}from"./chunk-6QSHWIZI.mjs";import{b as I,k as G,l as A,v as K,z as _}from"./chunk-WZQEK4WT.mjs";function Le(e){let n=new Set;for(let t of e)t.controllerName&&n.add(t.controllerName);return n}function X(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0}function je(e,n){let t=X(e.precision),r=typeof e.scale=="number"&&e.scale>=0?e.scale:void 0,o=X(e.digits),s=(e.picklistValues??[]).filter(d=>d!==null&&typeof d.value=="string"),i={};if(e.controllerName)for(let d of s)d.active===!1||typeof d.validFor!="string"||(i[d.value]=d.validFor);return{...t!==void 0?{precision:t}:{},...t!==void 0&&r!==void 0?{scale:r}:{},...o!==void 0?{digits:o}:{},...e.unique===!0?{unique:!0}:{},...e.unique===!0&&typeof e.caseSensitive=="boolean"?{caseSensitive:e.caseSensitive}:{},...e.calculated===!0?{calculated:!0}:{},...e.filteredLookupInfo?{filteredLookup:!0}:{},...Object.keys(i).length>0?{validFor:i}:{},...n.has(e.name)&&s.length>0?{controllingValues:s.map(d=>d.value)}:{}}}function Ce(e,n){return e.caseSensitive===!1?n.toLowerCase():n}function M(e,n){if(n<0)return!1;let r=Buffer.from(e,"base64")[n>>3];return r!==void 0&&(r&128>>n%8)!==0}var ie={picklist_value_refused:["map_value","leave_empty","skip_rows","exclude_object","ignore"],dependent_value_invalid:["map_value","leave_empty","exclude_object","ignore"],picklist_value_absent:["map_value","skip_rows","ignore"],required_field_missing:["set_default","exclude_object","ignore"],value_too_long:["truncate","exclude_object","ignore"],number_out_of_range:["exclude_object","ignore"],record_type_unmapped:["map_record_type","exclude_object","ignore"],record_type_unavailable:["map_record_type","exclude_object","ignore"],currency_inactive:["map_value","skip_rows","exclude_object","ignore"],unique_value_collision:["exclude_object","ignore"]};function w(e){return[...ie[e]??["ignore"]]}var se=100,ae=new Set(["longest","colliding"]),O=class{gaps=new Map;recordTypes=new Map;get size(){return this.gaps.size}knowRecordTypes(n,t,r){let o=de(r);o!==void 0&&this.recordTypes.set(n,{...this.recordTypes.get(n),[t]:o})}add(n){let t=z(n.kind,n.objectApiName,n.field,n.recordType,n.value),r=this.gaps.get(t);if(!r){this.gaps.set(t,{...n,id:t,source:"simulation",decisions:[...n.decisions]});return}r.rows+=n.rows,n.decisions.includes("skip_rows")||(r.decisions=r.decisions.filter(s=>s!=="skip_rows"));let o={...n.detail??{},...r.detail??{}};for(let s of ae){let i=r.detail?.[s],d=n.detail?.[s];typeof i=="number"&&typeof d=="number"&&(o[s]=Math.max(i,d))}r.detail=o}list(n){let t=[...this.gaps.keys()],r=[...this.gaps.values()].map(o=>this.withSameDeveloperName(o)).map(o=>B(n,o,t)!==void 0?{...o,detail:{...o.detail??{},ignored:!0}}:o);return V(r)}withSameDeveloperName(n){let t=n.kind==="record_type_unmapped";return le(n,this.recordTypes.get(n.objectApiName)?.[t?"source":"target"])}};function de(e){let n=e.filter(t=>!t.master);if(!n.some(t=>t.namespacePrefix===void 0))return n.map(Z)}function le(e,n){let t=e.kind==="record_type_unmapped"?e.value:e.recordType;if(t===void 0||n===void 0)return e;let r=Y(t);if(!r.namespacePrefix)return e;let o=n.filter(s=>s.developerName===r.developerName&&s.namespacePrefix!==r.namespacePrefix).map(s=>H(s.namespacePrefix,s.developerName));return o.length===0?e:{...e,detail:{...e.detail??{},sameDeveloperName:[...new Set(o)].sort()}}}function L(e){return[...new Set(e)].sort().slice(0,se)}function We(e,n,t){let r=[];for(let o of n){if(o.field===P)continue;let s=t(o);for(let i of o.values)r.push({kind:"picklist_value_refused",severity:"warning",objectApiName:e,field:o.field,...o.recordType!==void 0?{recordType:o.recordType}:{},value:i,rows:1,detail:{reason:o.reason,...s?{allowed:L(s)}:{},...o.controllingField?{controllingField:o.controllingField}:{},...o.replacedBy!==void 0?{replacement:o.replacedBy}:{}},decisions:w("picklist_value_refused").filter(d=>d!=="skip_rows"||o.reason!=="controlling-value"),defaultDecision:o.replacedBy!==void 0?"map_value":"leave_empty"})}return r}var ce=new Set(["string","textarea","email","phone","url","encryptedstring"]),ue=new Set(["double","currency","percent"]);function fe(e){return e==null||e===""}function ne(e){return e.createable&&e.nillable===!1&&e.defaultedOnCreate!==!0&&e.calculated!==!0&&e.type!=="boolean"}function pe(e,n,t){return e==="Account"&&n==="Name"&&Q(t)}function ge(e,n,t,r){return r.filter(o=>ne(o)&&fe(n[o.name])&&!pe(e,o.name,t))}function me(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string"||e.trim()==="")return;let n=Number(e);return Number.isFinite(n)?n:void 0}function ee(e){if(e.type==="int"&&e.digits!==void 0)return e.digits;if(e.precision!==void 0)return e.precision-(e.scale??0)}function ye(e,n){return e?e.type==="boolean"?n===!0||n==="true"?1:n===!1||n==="false"?0:-1:typeof n!="string"||n===""?-1:(e.controllingValues??[]).indexOf(n):-1}function te(e,n){let{objectApiName:t,rows:r,targetFields:o,picklistValuesByField:s,picklistFields:i}=e,d=new Map(o.map(u=>[u.name,u])),f=o.filter(ne),y=o.filter(u=>u.createable&&ce.has(u.type??"")&&(u.length??0)>0),g=o.filter(u=>u.createable&&(ue.has(u.type??"")||u.type==="int")&&ee(u)!==void 0),c=[...i].filter(([u,l])=>l.anyValue===!0&&s?.has(u)===!0),p=o.filter(u=>u.createable&&u.controllerName!==void 0&&u.validFor!==void 0);for(let{payload:u,source:l,typed:m}of r){for(let a of ge(t,u,l,f))n.add({kind:"required_field_missing",severity:"blocking",objectApiName:t,field:a.name,rows:1,...a.type?{detail:{type:a.type}}:{},decisions:w("required_field_missing")});for(let a of y){let h=u[a.name],b=a.length??0;typeof h!="string"||h.length<=b||n.add({kind:"value_too_long",severity:"blocking",objectApiName:t,field:a.name,rows:1,detail:{length:b,longest:h.length},decisions:w("value_too_long")})}for(let a of g){let h=me(u[a.name]),b=ee(a);h===void 0||b===void 0||Math.abs(Math.trunc(h))<10**b||n.add({kind:"number_out_of_range",severity:"blocking",objectApiName:t,field:a.name,rows:1,detail:{...a.precision!==void 0?{precision:a.precision}:{},...a.scale!==void 0?{scale:a.scale}:{},...a.type==="int"&&a.digits!==void 0?{digits:a.digits}:{}},decisions:w("number_out_of_range")})}for(let[a,h]of c){let b=u[a];if(typeof b!="string"||b==="")continue;let x=s?.get(a),v=h.multi?b.split(";"):[b];for(let E of new Set(v))x?.has(E)||n.add({kind:"picklist_value_absent",severity:"info",objectApiName:t,field:a,value:E,rows:1,decisions:w("picklist_value_absent")})}if(!m)for(let a of p){let h=u[a.name];if(typeof h!="string"||h==="")continue;let b=d.get(a.controllerName??""),x=ye(b,u[a.controllerName??""]),v=i.get(a.name)?.restricted===!0,E=i.get(a.name)?.multi?h.split(";"):[h];for(let q of new Set(E)){let $=a.validFor?.[q];$!==void 0&&(x>=0&&M($,x)||n.add({kind:"dependent_value_invalid",severity:v?"blocking":"warning",objectApiName:t,field:a.name,value:q,rows:1,detail:{controllingField:a.controllerName??"",allowed:L((b?.controllingValues??[]).filter((Me,oe)=>M($,oe)))},decisions:w("dependent_value_invalid")}))}}}}function Qe(e,n,t,r){return{kind:"currency_inactive",severity:"warning",objectApiName:e,field:P,value:n,rows:t,...r&&r.to.length>0?{detail:{replacement:r.to.join(", "),...r.converted.length>0?{amountsConverted:[...r.converted]}:{},...r.asRead?{amountsAsRead:!0}:{}}}:{},decisions:w("currency_inactive"),defaultDecision:"map_value"}}function He(e,n,t,r){return{kind:"unique_value_collision",severity:"warning",objectApiName:e,field:n,rows:t,detail:{colliding:r,linkedToTheRecordItNames:!0},decisions:w("unique_value_collision"),defaultDecision:"ignore"}}function Ye(e,n,t,r,o){return{kind:e,severity:"blocking",objectApiName:n,field:"RecordTypeId",...e==="record_type_unavailable"?{recordType:t}:{value:t},rows:r,detail:{mapTo:L(o)},decisions:w(e)}}var he=10;function re(e){switch(e.operation){case"insert":return null;case"upsert":return e.externalIdField??"Id";case"update":case"delete":return"Id"}}function S(e){if(e==null||typeof e!="string"&&typeof e!="number"&&typeof e!="boolean")return null;let n=String(e);return n===""?null:n.toLowerCase()}function T(e){return typeof e=="number"&&Number.isFinite(e)?String(e):typeof e=="boolean"?e?"true":"false":`'${U(String(e))}'`}var be=200,Se=4e3;function N(e){let n=[],t=[],r=0;for(let o of e){let s=T(o).length+2;t.length>0&&(t.length>=be||r+s>Se)&&(n.push(t),t=[],r=0),t.push(o),r+=s}return t.length>0&&n.push(t),n}function rn(e,n){return async(t,r,o,s)=>{let i=R(r.objectApiName),d=k(o),f=new Map;for(let y of N(s)){if(n?.aborted)throw new Error("The simulation was cancelled.");let{records:g}=await F(e,`SELECT ${d} FROM ${i} WHERE ${d} IN (${y.map(T).join(", ")})`);for(let c of g){let p=S(c[d]);p!==null&&f.set(p,(f.get(p)??0)+1)}}return f}}var we=new Set(["attributes","Id"]);function Re(e,n,t,r){return n?e.conflictFields.filter(o=>o!==t&&!we.has(o)&&o in n&&(r===null||r.has(o))):[]}var on=new Set(["noKey","notInTarget","ambiguous"]);function _e(e,n,t){let r=e.operation,o=re(e);if(o===null)return"insert";let s=S(n[o]);if(s===null)return r==="delete"?"notSent":"noKey";let i=t.get(s)??0;return r==="upsert"?i===0?o.toLowerCase()==="id"?"notInTarget":"insert":i===1?"update":"ambiguous":i===0?"notInTarget":r==="update"?"update":"delete"}var ke=1e4;function sn(e,n,t){let r=e>t?ke:Math.max(1,n);return{callOf:o=>Math.floor(o/r),job:e>t}}function an(e,n,t,r){let o=new Map;n.forEach((c,p)=>{if(c===null)return;let u=`${r.callOf(p)}\0${c}`,l=o.get(u);l?l.push(p):o.set(u,[p])});let s=new Set;for(let c of o.values())if(c.length>1)for(let p of c)s.add(p);let i=new Map,d=new Set,f=0;n.forEach((c,p)=>{if(c===null||s.has(p))return;let u=r.callOf(p);if(i.get(c)===void 0){t[p]==="insert"&&i.set(c,u);return}r.job?f++:t[p]==="insert"&&d.add(p)});let y=[],g=[];if(s.size>0){let c=`${s.size} record(s) carry the ${e} of another record of the same call: an upsert finds its record by its key, and the target refuses every record of a call whose key another carries (DUPLICATE_VALUE: Duplicate external id specified).`;y.push(c),g.push({code:"DUPLICATE_VALUE",rows:s.size,note:c})}return d.size>0&&y.push(`${d.size} record(s) carry the ${e} of a record sent in an earlier call: the upsert finds the record that one created and updates it with theirs.`),f>0&&y.push(`${f} record(s) carry the ${e} of a record in another batch of the Bulk API job: the platform may write the batches at once, so whether each updates the record the other created or creates one of its own cannot be told before the run.`),{refused:s,updated:d,notes:y,refusedFor:g}}function dn(e){let{objectConfig:n,records:t,inTarget:r}=e,o=n.operation,s=re(n),i={insert:0,update:0,delete:0,noKey:0,notInTarget:0,notSent:0,ambiguous:0},d=new Set;t.forEach((l,m)=>{let a=e.simulated?.[m]??_e(n,l,r);i[a]++,(a==="insert"||a==="update")&&d.add(m)});let f=e.leftOut.map(({why:l,count:m})=>W(m,l));i.noKey>0&&f.push(o==="upsert"?`${i.noKey} record(s) carry no value in ${s}: an upsert matches on it, and the target refuses a record without one.`:`${i.noKey} record(s) carry no Id: an update finds its record by Id, and the target refuses one without it.`),i.notInTarget>0&&f.push(`${i.notInTarget} record(s) carry an Id the target does not hold: ${o==="upsert"?"an upsert on the Id finds no record there and creates none":`${o==="update"?"an update":"a delete"} finds no record there`}, and the target refuses it. Two orgs share a record's Id only when it was copied with the org.`),i.ambiguous>0&&f.push(`${i.ambiguous} record(s) match more than one record of the target on ${s}: an upsert finds no single record to update, and the target refuses it.`),i.notSent>0&&f.push(`${i.notSent} record(s) carry no Id: a delete sends ids alone, so the run leaves them out.`);let y=new Map;e.unsettled.forEach((l,m)=>{let a=String(l[e.matchField]??"");a&&d.has(m)&&y.set(a,l)});let g=new Map,c=0;for(let l of e.conflicts){let m=Re(l,y.get(l.recordId),e.matchField,e.writable);if(m.length!==0){c++;for(let a of m)g.set(a,(g.get(a)??0)+1)}}let p=[...g].sort(([l,m],[a,h])=>h-m||l.localeCompare(a)).slice(0,he).map(([l])=>l),u=e.leftOut.reduce((l,{count:m})=>l+m,0);return{objectApiName:n.objectApiName,operation:o,read:e.read,insert:i.insert,update:i.update,delete:i.delete,skipped:u+i.notSent,refused:i.noKey+i.notInTarget+i.ambiguous,conflicts:c,conflictFields:p,notes:f}}var Fe={required_field_missing:"REQUIRED_FIELD_MISSING",value_too_long:"STRING_TOO_LONG",number_out_of_range:"NUMBER_OUTSIDE_VALID_RANGE"};function Ie(e){let n=e.field??"";switch(e.kind){case"required_field_missing":return`${e.rows} record(s) leave ${n} empty, which the target requires: it refuses them (REQUIRED_FIELD_MISSING).`;case"value_too_long":return`${e.rows} record(s) hold a ${n} longer than the ${String(e.detail?.length)} characters the target's field takes (the longest, ${String(e.detail?.longest)}): it refuses them (STRING_TOO_LONG).`;case"number_out_of_range":return`${e.rows} record(s) hold a ${n} larger than the target's field takes: it refuses them (NUMBER_OUTSIDE_VALID_RANGE).`;default:return}}function ln(e,n,t){let r=new Set,o=new O;n.forEach(({payload:i,source:d,creates:f},y)=>{let g=new O;te({objectApiName:e,rows:[{payload:i,source:d,typed:!0}],targetFields:t,picklistValuesByField:null,picklistFields:new Map},g);let c=g.list(new Set).filter(p=>p.severity==="blocking"&&(f||p.kind!=="required_field_missing"));if(c.length!==0){r.add(y);for(let p of c)o.add(p)}});let s=o.list(new Set).flatMap(i=>{let d=Ie(i),f=Fe[i.kind];return d&&f?[{code:f,rows:i.rows,note:d}]:[]});return{refused:r,notes:s.map(({note:i})=>i),refusedFor:s}}function cn(e,n){let t=new Set,r=new Set,o=[],s=[];for(let[i,d]of n){let f=new Set,y=0,g=0,c=0;if(e.forEach((u,l)=>{let m=S(u[i]);if(m===null)return;let a=d.get(m)??0;a===1?(y++,r.add(l)):a>1?(g++,t.add(l)):f.has(m)&&(c++,t.add(l)),f.add(m)}),y>0&&o.push(`LINKED_TO_EXISTING: ${y} record(s) hold a ${i} the target keeps unique, which a record of the target holds already: it refuses them as duplicates (DUPLICATE_VALUE) and names that record, which the run links them to \u2014 what it writes under them points at that record.`),g+c===0)continue;let p=`${g+c} record(s) hold a ${i} the target keeps unique, which `+[g>0?`several records of the target hold already (${g})`:"",c>0?`a record sent before them holds (${c})`:""].filter(Boolean).join(" or ")+": it refuses them (DUPLICATE_VALUE).";o.push(p),s.push({code:"DUPLICATE_VALUE",rows:g+c,note:p})}for(let i of t)r.delete(i);return{refused:t,linked:r,notes:o,refusedFor:s}}import{createHash as Oe}from"node:crypto";var Te=5*6e4,xe=500,Ee=A({sourceOrgId:I().min(1).max(200),targetOrgId:I().min(1).max(200),objectApiName:I().regex(/^[A-Za-z][A-Za-z0-9_]{0,79}$/),watermark:_.datetime(),fingerprint:I().regex(/^[0-9a-f]{64}$/),recordedAt:_.datetime(),filesSeen:_.datetime().optional(),removedAt:_.datetime().optional()}),Ne=A({version:K(1),entries:G(Ee).max(xe),resetAt:_.datetime().optional()});function Sn(e){if(e==null)return{kind:"none"};let n=Ne.safeParse(e);if(n.success)return{kind:"stored",state:n.data};let t=n.error.issues[0];return{kind:"unreadable",issue:`${t.path.join(".")||"state"}: ${t.message}`}}function j(e){return Array.isArray(e)?`[${e.map(j).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>t<r?-1:t>r?1:0).map(([t,r])=>`${JSON.stringify(t)}:${j(r)}`).join(",")}}`:JSON.stringify(e)}function C(e){let n=e?.trim();return n||null}function ve(e,n){let t={direction:e.direction,conflictStrategy:e.conflictStrategy,copiesFiles:e.files?!0:void 0,objectApiName:n.objectApiName,operation:n.operation,externalIdField:C(n.externalIdField),where:C(n.where),fieldMappings:n.fieldMappings??[],unmappedSentAsRead:(n.fieldMappings??[]).length>0?!0:void 0,transformRules:n.transformRules??[],excludedFields:n.excludedFields??[],addOnFields:n.addOnFields??[]};return Oe("sha256").update(j(t)).digest("hex")}function wn(e,n,t){let r=ve(e,n);if(t===null)return{read:"full",reason:"not_saved",fingerprint:r};if(t.kind==="unreadable")return{read:"full",reason:"unreadable",fingerprint:r};if(t.kind==="none")return{read:"full",reason:"first_run",fingerprint:r};let o=t.state.entries.find(s=>s.sourceOrgId===e.sourceOrgId&&s.targetOrgId===e.targetOrgId&&s.objectApiName===n.objectApiName);return o?o.fingerprint!==r?{read:"full",reason:"scope_changed",fingerprint:r}:o.removedAt!==void 0?{read:"full",reason:"removed",fingerprint:r}:{read:"delta",since:o.watermark,fingerprint:r,...o.filesSeen!==void 0?{filesSeen:o.filesSeen}:{}}:{read:"full",reason:t.state.resetAt?"reset":"first_run",fingerprint:r}}var $e=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/;function Rn(e,n=Te){let t=Date.parse(e);if(!Number.isFinite(t))throw new Error(`Not a watermark: "${e}".`);let r=Math.floor((t-n)/1e3)*1e3;return new Date(r).toISOString().replace(/\.\d{3}Z$/,"Z")}function _n(e){let n=Date.parse(e);if(!Number.isFinite(n))throw new Error(`Not a date: "${e}".`);return new Date(Math.floor(n/1e3)*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")}function Ae(e){if(!$e.test(e)||!Number.isFinite(Date.parse(e)))throw new Error(`Not a SOQL datetime: "${e}".`);return e}function kn(e,n){let t=e?.trim()?D(e):void 0;if(n===void 0)return t;let r=`SystemModstamp > ${Ae(n)}`;return t?`${r} AND (${t})`:r}function De(e){if(typeof e!="string"||e==="")return null;let n=Date.parse(e.replace(/([+-]\d{2})(\d{2})$/,"$1:$2"));return Number.isFinite(n)?new Date(n).toISOString():null}function Fn(e,n,t){let r={query:i=>e.query(i),queryMore:i=>e.queryMore(i)},o={query:i=>e.query(i,{scanAll:!0}),queryMore:i=>e.queryMore(i)},s=()=>{if(t?.aborted)throw new Error("The run was cancelled.")};return{async latestModstamp(i){let d=R(i),y=(await e.query(`SELECT SystemModstamp FROM ${d} ORDER BY SystemModstamp DESC LIMIT 1`)).records[0];if(!y)return null;let g=De(y.SystemModstamp);if(g===null)throw new Error(`${d} answered a SystemModstamp that is not a date.`);return g},async deletedRows(i,d,f){let y=R(i),g=new Set(["Id","SystemModstamp",...d.map(k)]),{records:c,truncated:p}=await F(o,`SELECT ${[...g].join(", ")} FROM ${y} WHERE IsDeleted = true AND (${D(f)})`);return{records:c,truncated:p}},async heldInSource(i,d,f){let y=R(i),g=k(d),c=new Set;for(let p of N(f)){s();let{records:u}=await F(r,`SELECT ${g} FROM ${y} WHERE ${g} IN (${p.map(T).join(", ")})`);for(let l of u){let m=S(l[g]);m!==null&&c.add(m)}}return c},async targetIdsByKey(i,d,f){let y=R(i),g=k(d),c=g==="Id"?"Id":`Id, ${g}`,p=new Map;for(let u of N(f)){s();let{records:l}=await F(n,`SELECT ${c} FROM ${y} WHERE ${g} IN (${u.map(T).join(", ")})`);for(let m of l){let a=S(m[g]);a===null||typeof m.Id!="string"||p.set(a,[...p.get(a)??[],m.Id])}}return p}}}var Pe=new Set(["direct","rename","transform"]);function In(e){let n=e.objectApiName;if(e.operation==="insert"||e.operation==="delete")return{refused:`${n} is written by ${e.operation}, which finds no record by a key: a deleted source record cannot be tied to a target record.`};if(e.operation==="update")return{sourceField:"Id",keyField:"Id"};let t=C(e.externalIdField)??"Id";if((e.addOnFields??[]).some(s=>s.fieldApiName===t))return{refused:`${n}: an add-on writes ${t}, the key the upsert matches on, so it ties no deleted source record to one target record.`};let r=e.fieldMappings??[],o=r.find(s=>s.targetField.toLowerCase()===t.toLowerCase());return!o&&!J(r,e.excludedFields??[]).has(t.toLowerCase())?{sourceField:t,keyField:t}:!o||!Pe.has(o.type)?{refused:`${n}: no source field is carried onto ${t}, the key the upsert matches on, so no deleted source record can be tied to a target record.`}:{sourceField:o.sourceField,keyField:t}}async function On(e,n,t,r,o){let s=n.objectApiName,{records:i,truncated:d}=await e.deletedRows(s,[t.sourceField],r),f={ids:[],read:i.length,stillInSource:0,ambiguous:0,noKey:0,truncated:d};if(i.length===0)return f;let y=[];for(let l of i){let m=l[t.sourceField],a=o(l);if(S(m)===null||S(a)===null){f.noKey++;continue}y.push({raw:m,key:a})}if(y.length===0)return f;let g=t.sourceField==="Id"?new Set:await e.heldInSource(s,t.sourceField,y.map(l=>l.raw)),c=y.filter(l=>g.has(S(l.raw))?(f.stillInSource++,!1):!0);if(c.length===0)return f;let p=await e.targetIdsByKey(s,t.keyField,c.map(l=>l.key)),u=new Set;for(let l of c){let m=p.get(S(l.key))??[];m.length>1?f.ambiguous++:m.length===1&&!u.has(m[0])&&(u.add(m[0]),f.ids.push(m[0]))}return f}function Tn(e,n){let t=[];return e.stillInSource>0&&t.push(`${e.stillInSource} record(s) deleted in the source share their ${n} with a record the source still holds: their target record was kept.`),e.ambiguous>0&&t.push(`${e.ambiguous} record(s) deleted in the source match more than one target record on ${n}: none of those target records was deleted.`),e.noKey>0&&t.push(`${e.noKey} record(s) deleted in the source carry no ${n}: no target record is tied to them.`),e.truncated&&t.push("The source's deleted records were read up to a bound: the rest are read by the next run, from the same watermark."),t}function xn(e,n,t,r,o=0){return{read:e.read,...e.read==="delta"?{since:e.since}:{reason:e.reason},changed:n,deletionsChecked:t!==void 0,deleted:t?.deleted??0,deleteFailed:t?.deleteFailed??0,...t?.error!==void 0?{deletionError:t.error}:{},...r!==void 0?{recorded:r}:{},...o>0?{lookupsOwed:o}:{}}}export{Le as a,je as b,Ce as c,ie as d,O as e,de as f,le as g,We as h,ge as i,te as j,Qe as k,He as l,Ye as m,re as n,S as o,rn as p,on as q,_e as r,sn as s,an as t,dn as u,ln as v,cn as w,Te as x,Sn as y,wn as z,Rn as A,_n as B,Ae as C,kn as D,De as E,Fn as F,In as G,On as H,Tn as I,xn as J};
|
|
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{c as rr}from"./chunk-32EUNQT6.mjs";import"./chunk-T7WREYA5.mjs";import"./chunk-H4JUYUSL.mjs";import"./chunk-C2N2TNEU.mjs";import"./chunk-YAJQS3OL.mjs";import"./chunk-Z42PHCVZ.mjs";import"./chunk-DT3T7FRD.mjs";import"./chunk-ZUBBEP75.mjs";import"./chunk-XO5FBOQF.mjs";import"./chunk-KP5G6FUC.mjs";import"./chunk-7EYQYZJP.mjs";import"./chunk-H4OBZIX3.mjs";import"./chunk-V3R45ZWT.mjs";import"./chunk-XSKPYGMT.mjs";import"./chunk-6GQUZ4IP.mjs";import{q as zt}from"./chunk-LAUOSXMN.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-2UU42PTD.mjs";import{b as rn}from"./chunk-2JZGCCPG.mjs";import{a as vo,b as Eo,c as Po,d as Wo,e as Ho,f as Lt,g as Dt,h as $t,i as Ve,j as Ko,k as xe,l as Fe}from"./chunk-G2JR3F63.mjs";import"./chunk-3CX7GPCR.mjs";import"./chunk-A65ADTCR.mjs";import"./chunk-NWOI25WY.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-A7JJWOLT.mjs";import"./chunk-ZXFL2MSN.mjs";import"./chunk-VYOYXTCU.mjs";import"./chunk-C3LNYAVJ.mjs";import"./chunk-GJ6SZVHT.mjs";import"./chunk-52EXDVPN.mjs";import"./chunk-GMY5427L.mjs";import{Wa as qt,a as Co,d as Bt,e as Qo,f as Xo,g as Jo,h as Vo,i as Zo,j as er,k as _t,l as tr,m as nr,q as je}from"./chunk-3HEMJTAP.mjs";import{a as Io}from"./chunk-BN33LVPQ.mjs";import"./chunk-JKT5YAQ2.mjs";import"./chunk-QAPVKPEC.mjs";import{a as Yo}from"./chunk-BNKT3R3F.mjs";import"./chunk-QROPNEGY.mjs";import{b as mt,e as sn}from"./chunk-BZ24IAP5.mjs";import{a as ct}from"./chunk-SCKUIE3R.mjs";import{c as cn,d as dn,f as ln}from"./chunk-6FARZYMJ.mjs";import"./chunk-WB2RIVO3.mjs";import"./chunk-MUEQRIK7.mjs";import"./chunk-ISSP2FZ5.mjs";import"./chunk-XU25YA46.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import{b as un,c as pn,d as Ue,e as fn,f as Ao,g as ko,h as Ro,i as So,j as Oo,k as To,l as It}from"./chunk-P55MKIZX.mjs";import{h as zo,i as Go,k as Uo}from"./chunk-PYRZFUVU.mjs";import"./chunk-O2PUGRNW.mjs";import"./chunk-7SDZR6SR.mjs";import{h as Mo,i as Do,j as $o,k as Bo,l as Nt,m as _o,n as qo}from"./chunk-TEIBWMJM.mjs";import{a as xo,b as xt,c as Ft,d as Fo,e as jo,f as No,g as Lo,h as jt}from"./chunk-BWWQXU2B.mjs";import{d as Yn}from"./chunk-T63U4OZJ.mjs";import{e as ro,f as so,g as io}from"./chunk-YAIIRFKJ.mjs";import"./chunk-Q3DY7TO2.mjs";import"./chunk-3XG25GTF.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import{o as to,p as no,q as Tt,r as oo,s as Xe}from"./chunk-WSUKC2U3.mjs";import{d as Kn}from"./chunk-QIRO4HTE.mjs";import"./chunk-3SKLBRPL.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-JH27IKCO.mjs";import"./chunk-SAMWHL22.mjs";import"./chunk-6KP6WETK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-J24TIGSI.mjs";import{a as Vn,b as Ot,f as Ie,g as Zn,h as eo,j as Qe}from"./chunk-HKUWHVI7.mjs";import"./chunk-VPDEJGPS.mjs";import"./chunk-5LFSFYFJ.mjs";import{b as ft,c as Ge}from"./chunk-LHU6CPGE.mjs";import"./chunk-PBE44M2Y.mjs";import{a as pt,b as nn}from"./chunk-ZUOPC4W2.mjs";import{b as Qn,c as Xn,g as Jn}from"./chunk-JQZTMFO7.mjs";import{$a as lo,Ac as bo,Bc as Mt,Ma as ao,Pb as mo,Ra as Et,_a as co,ac as ho,bb as uo,bc as go,fb as Pt,fc as yo,hb as Je,ib as po,lb as fo,mc as Te,nc as wo,zb as Ct}from"./chunk-JFNLKHY6.mjs";import{q as vt}from"./chunk-VZVICK7Q.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import{a as ae}from"./chunk-4TLYUZD5.mjs";import"./chunk-7PY3VQP3.mjs";import{i as xn}from"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-HFUDCNU5.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-XZISAZA6.mjs";import{b as on,d as an,f as ht,h as or}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import{a as qn,b as At,c as kt,f as zn,h as Gn,j as Ke,l as Un,m as Wn}from"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import{a as He}from"./chunk-EADHKH3A.mjs";import{b as wt,d as bt,e as In}from"./chunk-L4INJ5TZ.mjs";import{$ as vn,Y as Sn,Z as On,_ as Tn,a as mn,b as oe,c as We,d as hn,da as Ce,f as gn,fa as En,g as yn,ia as Pn,ja as Cn,ka as Mn,m as gt,n as wn,o as bn,p as An,q as ce,r as fe,s as yt,t as Pe,u as kn,z as Rn}from"./chunk-KIMQQ6JQ.mjs";import{a as ge,h as ye}from"./chunk-TZE3Y7IQ.mjs";import{b as ee}from"./chunk-CA5NAXSU.mjs";import{b as Ye,c as Rt,j as St,k as Hn}from"./chunk-ZUTUYBNW.mjs";import"./chunk-UNDIBZWG.mjs";import{a as he,j as Me,l as Fn,o as jn,p as Nn,q as Ln,t as Dn,u as $n,v as Bn,w as _n}from"./chunk-ICIYL45C.mjs";import"./chunk-PR74GYVI.mjs";import"./chunk-TMA34QMA.mjs";import"./chunk-TUACWKIH.mjs";import{Fc as Zt,Hc as en,Td as ze,Xc as tn,Y as dt,ic as lt,lc as Qt,mc as Xt,nc as Jt,rc as Oe,sc as Ae,tc as _e,uc as ve,vc as Vt,xc as ut,yc as qe,zc as Ee}from"./chunk-ZQO5PDX5.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var Ut=so,Wt=ro,ke=200;function Or(l,e){let t=new Set(e?.fields.map(n=>n.name)??[]),o=new Set(l.split(", "));for(let n of[he,Ee])t.has(n)&&o.add(n);return[...o].join(", ")}var Tr=10,vr=new Set([ce]),we="IsPersonAccount",Ze="IsStandard",et=class{maxConcurrent;constructor(e=10){this.maxConcurrent=e}async listObjects(e,t,o){let[n,r]=await Promise.all([e.describeGlobal(),t.describeGlobal()]),s=new Set(n.sobjects.filter(c=>c.createable).map(c=>c.name)),i=bt(r.sobjects.filter(c=>!s.has(c.name)),await this.toolingObjects(t)),a=new Map(r.sobjects.map(c=>[c.name,c.createable!==!1]));return n.sobjects.filter(c=>c.queryable&&(c.createable||a.get(c.name)===!0)).filter(c=>o||c.custom).filter(c=>!wt(c.name,i)).map(c=>({apiName:c.name,label:c.label,custom:c.custom,...a.has(c.name)?a.get(c.name)===!1?{notCreateableInTarget:!0}:{}:{missingInTarget:!0}}))}async countObjects(e,t){return this.countRecords(e,t)}async scan(e,t,o,n,r={}){let s=Gt(r.maxDepth,Ut),i=Gt(r.maxObjects,Wt),a=Gt(r.maxRecordsPerObject,5e4),c=r.onProgress??(()=>{});if(o.length===0)throw new Error("Choose the objects to copy: a scan starts from them, and with none chosen it would describe and count every object of the org.");let d=await e.describeGlobal(),m=[...o],u=await t.describeGlobal(),p=bt(u.sobjects,await this.toolingObjects(t)),g=A=>wt(A,p);m=m.filter(A=>!g(A)),c(`describing ${m.length} selected object(s)\u2026`);let y=await this.describeAll(e,m),f=new Set(y.keys()),R=new Map(d.sobjects.map(A=>[A.name,A.custom])),w=new Map;for(let A of d.sobjects)A.keyPrefix&&w.set(A.keyPrefix,A.name);let C=await this.walkRecords(e,y,f,{isStandard:A=>R.get(A)===!1||!R.has(A)&&!A.includes("__"),includeStandardObjects:n,leftOut:g,keyPrefixes:w,maxDepth:s,maxObjects:i,maxRecords:a,say:c}),v=new Set(u.sobjects.map(A=>A.name)),z=[...y.keys()].filter(A=>!v.has(A)),K=await this.currenciesOf(e,t,y),E=await this.personAccountsOf(e,y,f,C.parentIds,{cutShort:C.cutShort,cutAt:C.cutAt});return{objectDescribes:y,autoDiscoveredObjects:C.added,missingInTarget:z,recordCounts:C.recordCounts,totalObjectsScanned:y.size,parentIds:C.parentIds,personAccounts:E,scope:{maxDepth:s,maxObjects:i,selected:[...f],parents:C.added.map(A=>({objectApiName:A,records:C.parentIds.get(A)?.length??0})),leftEmpty:C.leftEmpty,standardNeeded:C.standardNeeded,...C.followedByDefault.length>0?{followedByDefault:C.followedByDefault}:{},...K?{currencies:K}:{},...C.cutShort.length>0?{cutShort:C.cutShort}:{}}}}async readFitRows(e,t,o=()=>{}){let n=new Set(t.objectDescribes.keys()),r=new Map;for(let s of t.scope.selected){let i=t.objectDescribes.get(s);if(!i)continue;o(`reading the lookups of ${s} to fit it\u2026`);let a=new Set(i.fields.map(u=>u.name)),c=tt(s,i).filter(u=>u.targets.some(p=>n.has(p))),d=["Id",...new Set(c.map(u=>u.field)),...(s===ce||s===fe)&&a.has(we)?[we]:[],...s===Ae&&a.has(Ze)?[Ze]:[]],m=await xn(`SELECT ${d.map(ye).join(", ")} FROM ${ye(s)} ORDER BY Id`,async u=>(await this.readAll(e,u)).records);r.set(s,m.filter(u=>typeof u.Id=="string"))}return r}async walkFrom(e,t,o,n=()=>{}){let r=new Map(t.objectDescribes),s=new Set(r.keys()),i=new Map;for(let[c,d]of r)d.keyPrefix&&i.set(d.keyPrefix,c);let a=await this.walkRecords(e,r,new Set(t.scope.selected),{isStandard:()=>!1,includeStandardObjects:!0,leftOut:c=>!s.has(c),keyPrefixes:i,maxDepth:t.scope.maxDepth,maxObjects:s.size,say:n},o);return{added:a.added,parentIds:a.parentIds,personAccounts:a.personAccounts,leftEmpty:a.leftEmpty,namingSelected:a.namingSelected}}async personAccountsOf(e,t,o,n,r){let s=new Map;for(let i of[ce,fe]){if(!t.get(i)?.fields.some(d=>d.name===we))continue;let c=`SELECT COUNT() FROM ${ye(i)} WHERE ${we} = true`;try{let d=r.cutShort.find(u=>u.objectApiName===i)?.copied;if(o.has(i)&&d!==void 0){let u=r.cutAt.get(i)??await this.lastIdOfTheFirst(e,i,d);s.set(i,u!==void 0?(await e.query(`${c} AND Id <= '${ge(u)}'`)).totalSize:Math.min((await e.query(c)).totalSize,d));continue}if(o.has(i)){s.set(i,(await e.query(c)).totalSize);continue}let m=0;for(let u of this.chunk([...n.get(i)??[]],ke)){let p=u.map(g=>`'${ge(g)}'`).join(", ");m+=(await e.query(`${c} AND Id IN (${p})`)).totalSize}s.set(i,m)}catch(d){ae.warn("Autopilot could not count the person accounts it copies",{objectApiName:i,error:ee(d)})}}return s}async lastIdOfTheFirst(e,t,o){let{records:n}=await this.readAll(e,`SELECT Id FROM ${ye(t)} ORDER BY Id`),r=n.length>=o?n[o-1]?.Id:void 0;return typeof r=="string"?r:void 0}async currenciesOf(e,t,o){let n=[...o.values()].filter(a=>a.fields.some(c=>c.name===he)).map(a=>a.name).sort();if(n.length===0)return;let r=await Me(async a=>(await e.query(a)).records,async a=>(await t.query(a)).records),s=r?.target.corporate;if(!r||s===void 0)return;let i=[...r.source.active].filter(a=>!r.target.active.has(a));return i.length>0?{notInTarget:i.sort(),writtenIn:s,objects:n}:void 0}async walkRecords(e,t,o,n,r){let s=new Set(o),i=new Set,a=n.maxRecords??5e4,c=n.maxObjects,d=n.maxObjects*io,m=new Map,u=[],p=[],g=[],y=new Map,f=[],R=new Map,w=new Map,C=new Map,v=[],z=T=>{let O=t.get(T);return O?tt(T,O).map(D=>({...D,targets:D.targets.filter(S=>!n.leftOut(S)&&!i.has(S))})).filter(D=>D.targets.length>0):[]},K=T=>["Id",...new Set(z(T).map(O=>O.field)),...r&&(T===ce||T===fe)&&t.get(T)?.fields.some(O=>O.name===we)?[we]:[]].map(ye).join(", "),E=(T,O,D)=>{let S=`${T.objectApiName}.${T.field}>${O}`;m.has(S)||m.set(S,{objectApiName:T.objectApiName,fieldApiName:T.field,target:O,reason:D,...T.required?{required:!0}:{}})},A=new Map,j=(T,O,D)=>{let S=z(T);for(let ne of O)for(let N of S){let _=ne[N.field];if(typeof _!="string"||_==="")continue;let V=Er(_,N.targets,n.keyPrefixes,r!==void 0&&N.polymorphic);if(!V)continue;if(o.has(V)){r&&D>0&&v.push({objectApiName:T,field:N.field,required:N.required,target:V,id:_});continue}let B={objectApiName:T,field:N.field,required:N.required};if(D>=n.maxDepth&&!N.required){s.has(V)||E(B,V,"depth");continue}if(w.get(V)?.has(_))continue;let Z=A.get(V)??{ids:new Set,required:!1,via:[]};Z.ids.add(_),Z.required||=N.required,Z.via.some(Y=>Y.objectApiName===T&&Y.field===N.field)||Z.via.push(B),A.set(V,Z)}},M=[];for(let T of o){if(r){j(T,r.get(T)??[],0);continue}let O=z(T).filter(D=>D.targets.some(S=>!o.has(S)));if(O.length===0){M.push(T);continue}n.say(`reading the lookups of ${T}\u2026`);try{let D=["Id",...new Set(O.map(N=>N.field))].map(ye).join(", "),{records:S,truncated:ne}=await this.readAll(e,`SELECT ${D} FROM ${ye(T)} ORDER BY Id`,a);if(R.set(T,S.length),ne){let N=(await this.countRecords(e,[T])).get(T);g.push({objectApiName:T,copied:S.length,...N!==void 0?{total:N}:{}});let _=S[S.length-1]?.Id;typeof _=="string"&&y.set(T,_)}j(T,S,0)}catch(D){ae.warn("Autopilot could not read the lookups of a selected object",{objectApiName:T,error:ee(D)}),M.push(T)}}for(let[T,O]of await this.countRecords(e,M))O>a?(R.set(T,a),g.push({objectApiName:T,copied:a,total:O})):R.set(T,O);let te=n.maxDepth+Tr;for(let T=1;A.size>0&&T<=te;T++){let O=A;A=new Map;let D=[];for(let[S,ne]of O){if(s.has(S))continue;let N=n.isStandard(S)&&!n.includeStandardObjects,_=N&&!ne.required&&vr.has(S),V;if(N&&!ne.required&&!_?V="standard":s.size>=c&&(ne.required&&c<d?c++:V="objects"),V){for(let B of ne.via)E(B,S,V);O.delete(S);continue}if(s.add(S),D.push(S),_)p.push({objectApiName:S,referencedBy:ne.via.map(B=>`${B.objectApiName}.${B.field}`)});else if(N){let B=ne.via[0];u.push({objectApiName:S,neededBy:`${B.objectApiName}.${B.field}`})}}if(D.length>0){let S=D.filter(N=>!t.has(N));S.length>0&&n.say(`describing ${S.length} parent object(s) at depth ${T}\u2026`);let ne=await this.describeAll(e,S);for(let N of D){let _=t.get(N)??ne.get(N);_?(t.set(N,_),f.push(N)):(s.delete(N),i.add(N),O.delete(N))}}for(let[S,ne]of O){let N=[...ne.ids].filter(Y=>!w.get(S)?.has(Y));if(N.length===0)continue;n.say(`reading ${N.length} ${S} record(s) by id\u2026`);let _=w.get(S)??new Set;w.set(S,_);let V=S===Oe,B=V?Or(K(S),t.get(S)):K(S),Z=[];for(let Y of this.chunk(N,ke)){let me=Y.map(x=>`'${ge(x)}'`).join(", "),b=(await e.query(`SELECT ${B} FROM ${ye(S)} WHERE Id IN (${me})`)).records.filter(x=>typeof x.Id=="string");for(let x of b)_.add(x.Id);Z.push(...b);let k=b.filter(x=>x[we]===!0).length;r&&k>0&&C.set(S,(C.get(S)??0)+k),j(S,b,T)}if(V){let Y=await this.standardPricesOf(e,B,Z,_);if(Y.length>0){n.say(`reading ${Y.length} standard price(s) the prices need\u2026`);for(let me of Y)_.add(me.Id);j(S,Y.map(me=>({...me,[_e]:void 0})),T)}}}}let se=new Map;for(let T of f){let O=[...w.get(T)??[]];se.set(T,O),R.set(T,O.length)}return{added:f,leftEmpty:[...m.values()].filter(T=>!s.has(T.target)),standardNeeded:u,followedByDefault:p.filter(T=>s.has(T.objectApiName)),cutShort:g,cutAt:y,recordCounts:R,parentIds:se,personAccounts:C,namingSelected:v}}async standardPricesOf(e,t,o,n){let r=s=>[s[qe],s[he],s[Ee]].map(i=>String(i??"")).join("|");try{let[s]=(await e.query(ve)).records,i=s?.Id;if(typeof i!="string")return[];let a=o.filter(u=>u[_e]!==i),c=[...new Set(a.flatMap(u=>{let p=u[qe];return typeof p=="string"&&p!==""?[p]:[]}))];if(c.length===0)return[];let d=new Set(a.map(r)),m=[];for(let u of this.chunk(c,ke)){let p=u.map(y=>`'${ge(y)}'`).join(", "),g=await e.query(`SELECT ${t} FROM ${Oe} WHERE ${_e} = '${ge(i)}' AND ${qe} IN (${p})`);for(let y of g.records){let f=y.Id;typeof f!="string"||n.has(f)||!d.has(r(y))||m.push(y)}}return m}catch(s){return ae.warn("Autopilot could not read the standard prices its prices need",{error:ee(s)}),[]}}async readAll(e,t,o=5e4){let{queryMore:n}=e;if(!n){let s=await e.query(t);return{records:s.records,truncated:s.done===!1}}let r=await He({query:s=>e.query(s),queryMore:s=>n.call(e,s)},t,o);return r.truncated&&ae.warn("Autopilot read the lookups of a selected object to its bound only",{records:r.records.length}),{records:r.records,truncated:r.truncated}}async toolingObjects(e){if(!e.tooling)return[];try{return(await e.tooling.describeGlobal()).sobjects.map(o=>o.name)}catch(t){return ae.warn("Autopilot could not ask the Tooling API which objects are metadata",{error:ee(t)}),[]}}async describeAll(e,t){let o=new Map,n=this.chunk(t,this.maxConcurrent);for(let r of n){let s=await Promise.allSettled(r.map(i=>e.describe(i)));for(let i of s)i.status==="fulfilled"&&o.set(i.value.name,i.value)}return o}async countRecords(e,t){let o=new Map,n=this.chunk(t,this.maxConcurrent);for(let r of n){let s=await Promise.allSettled(r.map(async i=>{let a=await e.query(`SELECT COUNT() FROM ${ye(i)}`);return{name:i,count:a.totalSize}}));for(let i of s)i.status==="fulfilled"&&o.set(i.value.name,i.value.count)}return o}chunk(e,t){let o=[];for(let n=0;n<e.length;n+=t)o.push(e.slice(n,n+t));return o}};function Gt(l,e){return l!==void 0&&Number.isInteger(l)&&l>0?l:e}function tt(l,e){return e.fields.filter(t=>t.referenceTo.length>0&&Jt(t)).map(t=>({field:t.name,targets:[...t.referenceTo],required:Xt(l,t.name,t.nillable),polymorphic:t.referenceTo.length>1}))}function Er(l,e,t,o=!1){if(e.length===1&&!o)return e[0];let n=t.get(l.slice(0,3));return n!==void 0&&e.includes(n)?n:void 0}var sr=3,Pr="the source changed since the plan: plan again";function dr(l,e){return{holds:[...l.links.filter(t=>t.kind==="holds"),...l.requiredOfParents,...l.outward.filter(t=>t.required)],kept:e}}function ir(l,e){return typeof l!="string"||l===""?!1:e===void 0||e!==null&&l.startsWith(e)}function lr(l,e,t){let o=new Map(t.map((s,i)=>[s,i])),n=new Set(e),r={links:[],outward:[],requiredOfParents:[]};for(let[s,i]of l)for(let a of tt(s,i))for(let c of a.targets.filter(d=>l.has(d))){let d=a.polymorphic?{prefix:l.get(c)?.keyPrefix??null}:{},m={objectApiName:s,field:a.field,parent:c,...d};if(!n.has(s))n.has(c)&&a.required&&r.requiredOfParents.push({...m,kind:"holds"});else if(!n.has(c))r.outward.push({...m,required:a.required});else if(a.required)r.links.push({...m,kind:"holds"});else if(c===s)r.links.push({...m,kind:"selfReference"});else{let u=(o.get(c)??0)<(o.get(s)??0);r.links.push({...m,kind:u?"holds":"owed"})}}return r}function ur(l,e){let t=new Set(l),o=new Set(e.links.filter(n=>n.kind!=="holds").map(n=>n.objectApiName));return(n,r)=>t.has(n)&&(r==="insert"||r==="update"&&(o.has(n)||Ce[n]!==void 0))}function pr(l,e,t){return typeof l.unread=="string"?{perRecord:[],notCounted:[],unread:l.unread}:Ro(ze(l,e,t),t)}function Cr(l){let e=new Map(l.order.map((t,o)=>[t,o]));return l.order.map(t=>{let o=l.rows.get(t)??[],n=l.lookups.links.filter(i=>i.objectApiName===t),r=l.lookups.outward.filter(i=>i.objectApiName===t),s={name:t,rows:o,at:new Map(o.map((i,a)=>[i.Id,a])),heldBefore:[],heldAfter:[],loose:[],named:[],roots:[],followers:[],persons:new Set(t===ce||t===fe?o.flatMap((i,a)=>i[we]===!0?[a]:[]):[])};return o.forEach((i,a)=>{let c=[],d=[],m=[];for(let u of n){let p=i[u.field];if(!ir(p,u.prefix))continue;let g={link:u,id:p};u.kind!=="holds"?m.push(g):(e.get(u.parent)??0)<(e.get(t)??0)?c.push(g):d.push(g)}s.heldBefore.push(c),s.heldAfter.push(d),s.loose.push(m),s.named.push(r.flatMap(u=>{let p=i[u.field];return ir(p,u.prefix)?[{parent:u.parent,id:p}]:[]})),(c.length>0?s.followers:s.roots).push(a)}),s})}function ar(l,e){let t=new Map(l.map(r=>[r.name,r])),o=new Map,n=[...e].flatMap(([r,s])=>[...s].map(i=>({name:r,id:i})));for(let r=n.pop();r;r=n.pop()){let s=t.get(r.name),i=s?.at.get(r.id);if(!s||i===void 0)continue;let a=o.get(r.name)??new Set;if(o.set(r.name,a),!a.has(i)){a.add(i);for(let c of[...s.heldBefore[i],...s.heldAfter[i]])n.push({name:c.link.parent,id:c.id})}}return o}function cr(l){return`${l} record${l===1?"":"s"}`}function Mr(l,e){return[...l.parentIds].every(([t,o])=>{let n=new Set(e.get(t)?.ids??[]);return o.every(r=>n.has(r))})}async function fr(l){let{budget:e,room:t,mode:o,parents:n,maxRecords:r}=l,s=Cr(l),i=b=>{let k=o.caps?.[b]??o.all;return k===void 0?void 0:Math.max(1,Math.floor(k))},a=s.some(b=>b.heldAfter.some(k=>k.length>0)),c=new Map;for(let b of s){if(b.name!==Ae)continue;let k=b.rows.filter(x=>x[Ze]===!0);k.length>0&&c.set(b.name,new Set(k.map(x=>x.Id)))}let d=ar(s,c),m=b=>{let k={kept:new Map,ids:new Map,cut:new Map},x=new Set;for(let $ of s){let L=d.get($.name)??x,X=i($.name),F=$.roots.filter(J=>!L.has(J)),G=F.length===0?0:Math.max(1,Math.round(b*Math.min(F.length,X??1/0))),W=It(F.length,G).map(J=>F[J]),q=new Map;for(let J of $.followers){if(L.has(J))continue;let be=$.heldBefore[J].find(Se=>!k.ids.get(Se.link.parent)?.has(Se.id));be?q.set(J,be.link):W.push(J)}W.sort((J,be)=>J-be);let ie=$.name===fe?W.filter(J=>$.persons.has(J)):[],U=ie.length>0?W.filter(J=>!$.persons.has(J)):W,re=X===void 0?U.length:Math.max(0,X-L.size-ie.length),le=U.length>re?It(U.length,re).map(J=>U[J]):U,ue=new Set([...L,...ie,...le]);k.kept.set($.name,ue),k.ids.set($.name,new Set([...ue].map(J=>$.rows[J].Id))),k.cut.set($.name,q)}if(!a)return k;for(let $=!0;$;){$=!1;for(let L of s){let X=d.get(L.name)??x,F=k.kept.get(L.name)??new Set;for(let G of[...F]){if(X.has(G))continue;let W=[...L.heldAfter[G],...L.heldBefore[G]].find(q=>!k.ids.get(q.link.parent)?.has(q.id));W&&(F.delete(G),k.ids.get(L.name)?.delete(L.rows[G].Id),k.cut.get(L.name)?.set(G,W.link),$=!0)}}}return k},u=b=>{let k=new Map;for(let x of s){let $=0;for(let L of b.kept.get(x.name)??[])x.loose[L].some(F=>b.ids.get(F.link.parent)?.has(F.id))&&$++;$>0&&k.set(x.name,$)}return k},p=(b,k)=>{let x=new Map,$=0;for(let F of s){let G=b.kept.get(F.name)??new Set,W=0;for(let q of G)F.persons.has(q)&&W++;x.set(F.name,G.size),$+=Et(F.name,{rows:G.size,personAccounts:W})}for(let[F,{records:G,personAccounts:W}]of k)x.set(F,(x.get(F)??0)+G),$+=Et(F,{rows:G,...W!==void 0?{personAccounts:W}:{}});let L=u(b),X=So(t,(F,G)=>{let W=x.get(F)??0;return G==="insert"||Ce[F]!==void 0?W:L.get(F)??0});return{records:[...x.values()].reduce((F,G)=>F+G,0),bytes:$,roomBytes:X,requests:uo([...x.values()].map(F=>({rows:F})))}},g=new Map;for(let b of s)for(let k of b.named)for(let{parent:x,id:$}of k){let L=g.get(x)??new Set;g.set(x,L),L.add($)}let y=[...g.values()].reduce((b,k)=>b+k.size,0),f=b=>{let k=new Map,x=0;for(let X of s)for(let F of b.kept.get(X.name)??[])for(let{parent:G,id:W}of X.named[F]){let q=k.get(G)??new Set;k.set(G,q),q.has(W)||x++,q.add(W)}let $=y>0?x/y:0,L=new Map;for(let[X,{ids:F,personAccounts:G}]of n){let W=Math.max(0,F.length-(g.get(X)?.size??0)),q=Math.min(F.length,(k.get(X)?.size??0)+Math.ceil(W*$));q!==0&&L.set(X,{records:q,...G!==void 0?{personAccounts:Math.ceil(G*q/F.length)}:{}})}return L},R=b=>new Map(b.added.map(k=>{let x=b.personAccounts.get(k);return[k,{records:b.parentIds.get(k)?.length??0,...x!==void 0?{personAccounts:x}:{}}]})),w=b=>b.bytes+b.roomBytes<=e.bytes,C=b=>e.runRequests===void 0||b.requests<=e.runRequests,v=b=>r===void 0||b.records<=r,z=b=>w(b)&&C(b)&&v(b),K=b=>w(b)?C(b)?"maxTotal":"apiRequests":e.terms.limitedBy,E=b=>w(b)?C(b)?{bound:"maxTotal",records:b.records,allowed:r??0}:{bound:"apiRequests",requests:b.requests,allowed:e.runRequests??0}:{bound:"storage",takesMB:(b.bytes+b.roomBytes)/1048576,fitsMB:e.bytes/1048576},A=b=>{if(!w(b)){let k=wo((b.bytes+b.roomBytes)/1048576,e.bytes/1048576);return`${k.over} MB`+(b.roomBytes>0?", room for what the org's automation creates under them included":"")+`, past the ${k.bound} MB that fit`}return C(b)?`${cr(b.records)}, past the ${r??0} the run may write`:`about ${b.requests} API requests, past the ${e.runRequests??0} that leave the org a tenth of its daily requests`},j=b=>new Map(s.map(k=>[k.name,[...b.kept.get(k.name)??[]].sort((x,$)=>x-$).map(x=>k.rows[x])])),M=(b,k,x,$,L,X)=>{let F=s.map(q=>{let ie=k.cut.get(q.name)??new Map,U=new Map;for(let le of ie.values()){let ue=`${le.field}
|
|
7
|
+
import{c as rr}from"./chunk-BVZ5H3N4.mjs";import"./chunk-KKS2KFBT.mjs";import"./chunk-KXUOHACP.mjs";import"./chunk-JH4ZTVQN.mjs";import"./chunk-2N73W63D.mjs";import"./chunk-27BBEGUD.mjs";import"./chunk-XAUQXYPW.mjs";import"./chunk-NNV7IGM7.mjs";import"./chunk-446GBKAC.mjs";import"./chunk-K7G3W7XH.mjs";import"./chunk-JREKJO3D.mjs";import"./chunk-H4OBZIX3.mjs";import"./chunk-OTJH6AEA.mjs";import"./chunk-GLN4PI5P.mjs";import"./chunk-DKDKCGXV.mjs";import{q as zt}from"./chunk-DIGUC7S4.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-J3TIHLWG.mjs";import{b as rn}from"./chunk-ETNQHIDI.mjs";import{a as vo,b as Eo,c as Po,d as Wo,e as Ho,f as Lt,g as Dt,h as $t,i as Ve,j as Ko,k as xe,l as Fe}from"./chunk-CTPLYUXA.mjs";import"./chunk-D7XUNWWU.mjs";import"./chunk-AHUGG3WU.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-OO24ZYYJ.mjs";import"./chunk-ALBY5SOH.mjs";import"./chunk-6YC2ELCU.mjs";import"./chunk-XCJUNX63.mjs";import"./chunk-WZN36ACK.mjs";import"./chunk-GEEWPTV5.mjs";import"./chunk-GMY5427L.mjs";import{Wa as qt,a as Co,d as Bt,e as Qo,f as Xo,g as Jo,h as Vo,i as Zo,j as er,k as _t,l as tr,m as nr,q as je}from"./chunk-LYOGCIYD.mjs";import{a as Io}from"./chunk-P6WRYJN3.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-X4HZD5U2.mjs";import{a as Yo}from"./chunk-BNKT3R3F.mjs";import"./chunk-QROPNEGY.mjs";import{b as mt,e as sn}from"./chunk-BZ24IAP5.mjs";import{a as ct}from"./chunk-SCKUIE3R.mjs";import{c as cn,d as dn,f as ln}from"./chunk-6FARZYMJ.mjs";import"./chunk-WB2RIVO3.mjs";import"./chunk-HVX2AFYW.mjs";import"./chunk-AXFD2OH6.mjs";import"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import{b as un,c as pn,d as Ue,e as fn,f as Ao,g as ko,h as Ro,i as So,j as Oo,k as To,l as It}from"./chunk-5OGNK3JP.mjs";import{h as zo,i as Go,k as Uo}from"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import{h as Mo,i as Do,j as $o,k as Bo,l as Nt,m as _o,n as qo}from"./chunk-TEIBWMJM.mjs";import{a as xo,b as xt,c as Ft,d as Fo,e as jo,f as No,g as Lo,h as jt}from"./chunk-BWWQXU2B.mjs";import{d as Yn}from"./chunk-T63U4OZJ.mjs";import{e as ro,f as so,g as io}from"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import{o as to,p as no,q as Tt,r as oo,s as Xe}from"./chunk-YBZIDW6W.mjs";import{d as Kn}from"./chunk-QIRO4HTE.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import{a as Vn,b as Ot,f as Ie,g as Zn,h as eo,j as Qe}from"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import{b as ft,c as Ge}from"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import{a as pt,b as nn}from"./chunk-4GCYGQXD.mjs";import{b as Qn,c as Xn,g as Jn}from"./chunk-WXU6ZJIV.mjs";import{$a as Pt,$b as yo,Ga as ao,Jb as mo,La as Et,Ua as co,Va as lo,Wb as ho,Xa as uo,Xb as go,bb as Je,cb as po,fb as fo,gc as Te,hc as wo,tb as Ct,uc as bo,vc as Mt}from"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import{q as vt}from"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import{a as ae}from"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import{i as xn}from"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import{b as on,d as an,f as ht,h as or}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import{a as qn,b as At,c as kt,f as zn,h as Gn,j as Ke,l as Un,m as Wn}from"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import{a as He}from"./chunk-EADHKH3A.mjs";import{b as wt,d as bt,e as In}from"./chunk-Z3MGN42K.mjs";import{$ as vn,Y as Sn,Z as On,_ as Tn,a as mn,b as oe,c as We,d as hn,da as Ce,f as gn,fa as En,g as yn,ia as Pn,ja as Cn,ka as Mn,m as gt,n as wn,o as bn,p as An,q as ce,r as fe,s as yt,t as Pe,u as kn,z as Rn}from"./chunk-2GSMHGIV.mjs";import{a as ge,h as ye}from"./chunk-TZE3Y7IQ.mjs";import{b as ee}from"./chunk-CA5NAXSU.mjs";import{b as Ye,c as Rt,j as St,k as Hn}from"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import{a as he,j as Me,l as Fn,o as jn,p as Nn,q as Ln,t as Dn,u as $n,v as Bn,w as _n}from"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import{Ac as Jt,Ec as Oe,Fc as Ae,Gc as _e,Hc as ve,Ic as Vt,Kc as ut,Lc as qe,Mc as Ee,Sc as Zt,Uc as en,Y as dt,ee as ze,id as tn,vc as lt,yc as Qt,zc as Xt}from"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var Ut=so,Wt=ro,ke=200;function Or(l,e){let t=new Set(e?.fields.map(n=>n.name)??[]),o=new Set(l.split(", "));for(let n of[he,Ee])t.has(n)&&o.add(n);return[...o].join(", ")}var Tr=10,vr=new Set([ce]),we="IsPersonAccount",Ze="IsStandard",et=class{maxConcurrent;constructor(e=10){this.maxConcurrent=e}async listObjects(e,t,o){let[n,r]=await Promise.all([e.describeGlobal(),t.describeGlobal()]),s=new Set(n.sobjects.filter(c=>c.createable).map(c=>c.name)),i=bt(r.sobjects.filter(c=>!s.has(c.name)),await this.toolingObjects(t)),a=new Map(r.sobjects.map(c=>[c.name,c.createable!==!1]));return n.sobjects.filter(c=>c.queryable&&(c.createable||a.get(c.name)===!0)).filter(c=>o||c.custom).filter(c=>!wt(c.name,i)).map(c=>({apiName:c.name,label:c.label,custom:c.custom,...a.has(c.name)?a.get(c.name)===!1?{notCreateableInTarget:!0}:{}:{missingInTarget:!0}}))}async countObjects(e,t){return this.countRecords(e,t)}async scan(e,t,o,n,r={}){let s=Gt(r.maxDepth,Ut),i=Gt(r.maxObjects,Wt),a=Gt(r.maxRecordsPerObject,5e4),c=r.onProgress??(()=>{});if(o.length===0)throw new Error("Choose the objects to copy: a scan starts from them, and with none chosen it would describe and count every object of the org.");let d=await e.describeGlobal(),m=[...o],u=await t.describeGlobal(),p=bt(u.sobjects,await this.toolingObjects(t)),g=A=>wt(A,p);m=m.filter(A=>!g(A)),c(`describing ${m.length} selected object(s)\u2026`);let y=await this.describeAll(e,m),f=new Set(y.keys()),R=new Map(d.sobjects.map(A=>[A.name,A.custom])),w=new Map;for(let A of d.sobjects)A.keyPrefix&&w.set(A.keyPrefix,A.name);let C=await this.walkRecords(e,y,f,{isStandard:A=>R.get(A)===!1||!R.has(A)&&!A.includes("__"),includeStandardObjects:n,leftOut:g,keyPrefixes:w,maxDepth:s,maxObjects:i,maxRecords:a,say:c}),v=new Set(u.sobjects.map(A=>A.name)),z=[...y.keys()].filter(A=>!v.has(A)),K=await this.currenciesOf(e,t,y),E=await this.personAccountsOf(e,y,f,C.parentIds,{cutShort:C.cutShort,cutAt:C.cutAt});return{objectDescribes:y,autoDiscoveredObjects:C.added,missingInTarget:z,recordCounts:C.recordCounts,totalObjectsScanned:y.size,parentIds:C.parentIds,personAccounts:E,scope:{maxDepth:s,maxObjects:i,selected:[...f],parents:C.added.map(A=>({objectApiName:A,records:C.parentIds.get(A)?.length??0})),leftEmpty:C.leftEmpty,standardNeeded:C.standardNeeded,...C.followedByDefault.length>0?{followedByDefault:C.followedByDefault}:{},...K?{currencies:K}:{},...C.cutShort.length>0?{cutShort:C.cutShort}:{}}}}async readFitRows(e,t,o=()=>{}){let n=new Set(t.objectDescribes.keys()),r=new Map;for(let s of t.scope.selected){let i=t.objectDescribes.get(s);if(!i)continue;o(`reading the lookups of ${s} to fit it\u2026`);let a=new Set(i.fields.map(u=>u.name)),c=tt(s,i).filter(u=>u.targets.some(p=>n.has(p))),d=["Id",...new Set(c.map(u=>u.field)),...(s===ce||s===fe)&&a.has(we)?[we]:[],...s===Ae&&a.has(Ze)?[Ze]:[]],m=await xn(`SELECT ${d.map(ye).join(", ")} FROM ${ye(s)} ORDER BY Id`,async u=>(await this.readAll(e,u)).records);r.set(s,m.filter(u=>typeof u.Id=="string"))}return r}async walkFrom(e,t,o,n=()=>{}){let r=new Map(t.objectDescribes),s=new Set(r.keys()),i=new Map;for(let[c,d]of r)d.keyPrefix&&i.set(d.keyPrefix,c);let a=await this.walkRecords(e,r,new Set(t.scope.selected),{isStandard:()=>!1,includeStandardObjects:!0,leftOut:c=>!s.has(c),keyPrefixes:i,maxDepth:t.scope.maxDepth,maxObjects:s.size,say:n},o);return{added:a.added,parentIds:a.parentIds,personAccounts:a.personAccounts,leftEmpty:a.leftEmpty,namingSelected:a.namingSelected}}async personAccountsOf(e,t,o,n,r){let s=new Map;for(let i of[ce,fe]){if(!t.get(i)?.fields.some(d=>d.name===we))continue;let c=`SELECT COUNT() FROM ${ye(i)} WHERE ${we} = true`;try{let d=r.cutShort.find(u=>u.objectApiName===i)?.copied;if(o.has(i)&&d!==void 0){let u=r.cutAt.get(i)??await this.lastIdOfTheFirst(e,i,d);s.set(i,u!==void 0?(await e.query(`${c} AND Id <= '${ge(u)}'`)).totalSize:Math.min((await e.query(c)).totalSize,d));continue}if(o.has(i)){s.set(i,(await e.query(c)).totalSize);continue}let m=0;for(let u of this.chunk([...n.get(i)??[]],ke)){let p=u.map(g=>`'${ge(g)}'`).join(", ");m+=(await e.query(`${c} AND Id IN (${p})`)).totalSize}s.set(i,m)}catch(d){ae.warn("Autopilot could not count the person accounts it copies",{objectApiName:i,error:ee(d)})}}return s}async lastIdOfTheFirst(e,t,o){let{records:n}=await this.readAll(e,`SELECT Id FROM ${ye(t)} ORDER BY Id`),r=n.length>=o?n[o-1]?.Id:void 0;return typeof r=="string"?r:void 0}async currenciesOf(e,t,o){let n=[...o.values()].filter(a=>a.fields.some(c=>c.name===he)).map(a=>a.name).sort();if(n.length===0)return;let r=await Me(async a=>(await e.query(a)).records,async a=>(await t.query(a)).records),s=r?.target.corporate;if(!r||s===void 0)return;let i=[...r.source.active].filter(a=>!r.target.active.has(a));return i.length>0?{notInTarget:i.sort(),writtenIn:s,objects:n}:void 0}async walkRecords(e,t,o,n,r){let s=new Set(o),i=new Set,a=n.maxRecords??5e4,c=n.maxObjects,d=n.maxObjects*io,m=new Map,u=[],p=[],g=[],y=new Map,f=[],R=new Map,w=new Map,C=new Map,v=[],z=T=>{let O=t.get(T);return O?tt(T,O).map(D=>({...D,targets:D.targets.filter(S=>!n.leftOut(S)&&!i.has(S))})).filter(D=>D.targets.length>0):[]},K=T=>["Id",...new Set(z(T).map(O=>O.field)),...r&&(T===ce||T===fe)&&t.get(T)?.fields.some(O=>O.name===we)?[we]:[]].map(ye).join(", "),E=(T,O,D)=>{let S=`${T.objectApiName}.${T.field}>${O}`;m.has(S)||m.set(S,{objectApiName:T.objectApiName,fieldApiName:T.field,target:O,reason:D,...T.required?{required:!0}:{}})},A=new Map,j=(T,O,D)=>{let S=z(T);for(let ne of O)for(let N of S){let _=ne[N.field];if(typeof _!="string"||_==="")continue;let V=Er(_,N.targets,n.keyPrefixes,r!==void 0&&N.polymorphic);if(!V)continue;if(o.has(V)){r&&D>0&&v.push({objectApiName:T,field:N.field,required:N.required,target:V,id:_});continue}let B={objectApiName:T,field:N.field,required:N.required};if(D>=n.maxDepth&&!N.required){s.has(V)||E(B,V,"depth");continue}if(w.get(V)?.has(_))continue;let Z=A.get(V)??{ids:new Set,required:!1,via:[]};Z.ids.add(_),Z.required||=N.required,Z.via.some(Y=>Y.objectApiName===T&&Y.field===N.field)||Z.via.push(B),A.set(V,Z)}},M=[];for(let T of o){if(r){j(T,r.get(T)??[],0);continue}let O=z(T).filter(D=>D.targets.some(S=>!o.has(S)));if(O.length===0){M.push(T);continue}n.say(`reading the lookups of ${T}\u2026`);try{let D=["Id",...new Set(O.map(N=>N.field))].map(ye).join(", "),{records:S,truncated:ne}=await this.readAll(e,`SELECT ${D} FROM ${ye(T)} ORDER BY Id`,a);if(R.set(T,S.length),ne){let N=(await this.countRecords(e,[T])).get(T);g.push({objectApiName:T,copied:S.length,...N!==void 0?{total:N}:{}});let _=S[S.length-1]?.Id;typeof _=="string"&&y.set(T,_)}j(T,S,0)}catch(D){ae.warn("Autopilot could not read the lookups of a selected object",{objectApiName:T,error:ee(D)}),M.push(T)}}for(let[T,O]of await this.countRecords(e,M))O>a?(R.set(T,a),g.push({objectApiName:T,copied:a,total:O})):R.set(T,O);let te=n.maxDepth+Tr;for(let T=1;A.size>0&&T<=te;T++){let O=A;A=new Map;let D=[];for(let[S,ne]of O){if(s.has(S))continue;let N=n.isStandard(S)&&!n.includeStandardObjects,_=N&&!ne.required&&vr.has(S),V;if(N&&!ne.required&&!_?V="standard":s.size>=c&&(ne.required&&c<d?c++:V="objects"),V){for(let B of ne.via)E(B,S,V);O.delete(S);continue}if(s.add(S),D.push(S),_)p.push({objectApiName:S,referencedBy:ne.via.map(B=>`${B.objectApiName}.${B.field}`)});else if(N){let B=ne.via[0];u.push({objectApiName:S,neededBy:`${B.objectApiName}.${B.field}`})}}if(D.length>0){let S=D.filter(N=>!t.has(N));S.length>0&&n.say(`describing ${S.length} parent object(s) at depth ${T}\u2026`);let ne=await this.describeAll(e,S);for(let N of D){let _=t.get(N)??ne.get(N);_?(t.set(N,_),f.push(N)):(s.delete(N),i.add(N),O.delete(N))}}for(let[S,ne]of O){let N=[...ne.ids].filter(Y=>!w.get(S)?.has(Y));if(N.length===0)continue;n.say(`reading ${N.length} ${S} record(s) by id\u2026`);let _=w.get(S)??new Set;w.set(S,_);let V=S===Oe,B=V?Or(K(S),t.get(S)):K(S),Z=[];for(let Y of this.chunk(N,ke)){let me=Y.map(x=>`'${ge(x)}'`).join(", "),b=(await e.query(`SELECT ${B} FROM ${ye(S)} WHERE Id IN (${me})`)).records.filter(x=>typeof x.Id=="string");for(let x of b)_.add(x.Id);Z.push(...b);let k=b.filter(x=>x[we]===!0).length;r&&k>0&&C.set(S,(C.get(S)??0)+k),j(S,b,T)}if(V){let Y=await this.standardPricesOf(e,B,Z,_);if(Y.length>0){n.say(`reading ${Y.length} standard price(s) the prices need\u2026`);for(let me of Y)_.add(me.Id);j(S,Y.map(me=>({...me,[_e]:void 0})),T)}}}}let se=new Map;for(let T of f){let O=[...w.get(T)??[]];se.set(T,O),R.set(T,O.length)}return{added:f,leftEmpty:[...m.values()].filter(T=>!s.has(T.target)),standardNeeded:u,followedByDefault:p.filter(T=>s.has(T.objectApiName)),cutShort:g,cutAt:y,recordCounts:R,parentIds:se,personAccounts:C,namingSelected:v}}async standardPricesOf(e,t,o,n){let r=s=>[s[qe],s[he],s[Ee]].map(i=>String(i??"")).join("|");try{let[s]=(await e.query(ve)).records,i=s?.Id;if(typeof i!="string")return[];let a=o.filter(u=>u[_e]!==i),c=[...new Set(a.flatMap(u=>{let p=u[qe];return typeof p=="string"&&p!==""?[p]:[]}))];if(c.length===0)return[];let d=new Set(a.map(r)),m=[];for(let u of this.chunk(c,ke)){let p=u.map(y=>`'${ge(y)}'`).join(", "),g=await e.query(`SELECT ${t} FROM ${Oe} WHERE ${_e} = '${ge(i)}' AND ${qe} IN (${p})`);for(let y of g.records){let f=y.Id;typeof f!="string"||n.has(f)||!d.has(r(y))||m.push(y)}}return m}catch(s){return ae.warn("Autopilot could not read the standard prices its prices need",{error:ee(s)}),[]}}async readAll(e,t,o=5e4){let{queryMore:n}=e;if(!n){let s=await e.query(t);return{records:s.records,truncated:s.done===!1}}let r=await He({query:s=>e.query(s),queryMore:s=>n.call(e,s)},t,o);return r.truncated&&ae.warn("Autopilot read the lookups of a selected object to its bound only",{records:r.records.length}),{records:r.records,truncated:r.truncated}}async toolingObjects(e){if(!e.tooling)return[];try{return(await e.tooling.describeGlobal()).sobjects.map(o=>o.name)}catch(t){return ae.warn("Autopilot could not ask the Tooling API which objects are metadata",{error:ee(t)}),[]}}async describeAll(e,t){let o=new Map,n=this.chunk(t,this.maxConcurrent);for(let r of n){let s=await Promise.allSettled(r.map(i=>e.describe(i)));for(let i of s)i.status==="fulfilled"&&o.set(i.value.name,i.value)}return o}async countRecords(e,t){let o=new Map,n=this.chunk(t,this.maxConcurrent);for(let r of n){let s=await Promise.allSettled(r.map(async i=>{let a=await e.query(`SELECT COUNT() FROM ${ye(i)}`);return{name:i,count:a.totalSize}}));for(let i of s)i.status==="fulfilled"&&o.set(i.value.name,i.value.count)}return o}chunk(e,t){let o=[];for(let n=0;n<e.length;n+=t)o.push(e.slice(n,n+t));return o}};function Gt(l,e){return l!==void 0&&Number.isInteger(l)&&l>0?l:e}function tt(l,e){return e.fields.filter(t=>t.referenceTo.length>0&&Jt(t)).map(t=>({field:t.name,targets:[...t.referenceTo],required:Xt(l,t.name,t.nillable),polymorphic:t.referenceTo.length>1}))}function Er(l,e,t,o=!1){if(e.length===1&&!o)return e[0];let n=t.get(l.slice(0,3));return n!==void 0&&e.includes(n)?n:void 0}var sr=3,Pr="the source changed since the plan: plan again";function dr(l,e){return{holds:[...l.links.filter(t=>t.kind==="holds"),...l.requiredOfParents,...l.outward.filter(t=>t.required)],kept:e}}function ir(l,e){return typeof l!="string"||l===""?!1:e===void 0||e!==null&&l.startsWith(e)}function lr(l,e,t){let o=new Map(t.map((s,i)=>[s,i])),n=new Set(e),r={links:[],outward:[],requiredOfParents:[]};for(let[s,i]of l)for(let a of tt(s,i))for(let c of a.targets.filter(d=>l.has(d))){let d=a.polymorphic?{prefix:l.get(c)?.keyPrefix??null}:{},m={objectApiName:s,field:a.field,parent:c,...d};if(!n.has(s))n.has(c)&&a.required&&r.requiredOfParents.push({...m,kind:"holds"});else if(!n.has(c))r.outward.push({...m,required:a.required});else if(a.required)r.links.push({...m,kind:"holds"});else if(c===s)r.links.push({...m,kind:"selfReference"});else{let u=(o.get(c)??0)<(o.get(s)??0);r.links.push({...m,kind:u?"holds":"owed"})}}return r}function ur(l,e){let t=new Set(l),o=new Set(e.links.filter(n=>n.kind!=="holds").map(n=>n.objectApiName));return(n,r)=>t.has(n)&&(r==="insert"||r==="update"&&(o.has(n)||Ce[n]!==void 0))}function pr(l,e,t){return typeof l.unread=="string"?{perRecord:[],notCounted:[],unread:l.unread}:Ro(ze(l,e,t),t)}function Cr(l){let e=new Map(l.order.map((t,o)=>[t,o]));return l.order.map(t=>{let o=l.rows.get(t)??[],n=l.lookups.links.filter(i=>i.objectApiName===t),r=l.lookups.outward.filter(i=>i.objectApiName===t),s={name:t,rows:o,at:new Map(o.map((i,a)=>[i.Id,a])),heldBefore:[],heldAfter:[],loose:[],named:[],roots:[],followers:[],persons:new Set(t===ce||t===fe?o.flatMap((i,a)=>i[we]===!0?[a]:[]):[])};return o.forEach((i,a)=>{let c=[],d=[],m=[];for(let u of n){let p=i[u.field];if(!ir(p,u.prefix))continue;let g={link:u,id:p};u.kind!=="holds"?m.push(g):(e.get(u.parent)??0)<(e.get(t)??0)?c.push(g):d.push(g)}s.heldBefore.push(c),s.heldAfter.push(d),s.loose.push(m),s.named.push(r.flatMap(u=>{let p=i[u.field];return ir(p,u.prefix)?[{parent:u.parent,id:p}]:[]})),(c.length>0?s.followers:s.roots).push(a)}),s})}function ar(l,e){let t=new Map(l.map(r=>[r.name,r])),o=new Map,n=[...e].flatMap(([r,s])=>[...s].map(i=>({name:r,id:i})));for(let r=n.pop();r;r=n.pop()){let s=t.get(r.name),i=s?.at.get(r.id);if(!s||i===void 0)continue;let a=o.get(r.name)??new Set;if(o.set(r.name,a),!a.has(i)){a.add(i);for(let c of[...s.heldBefore[i],...s.heldAfter[i]])n.push({name:c.link.parent,id:c.id})}}return o}function cr(l){return`${l} record${l===1?"":"s"}`}function Mr(l,e){return[...l.parentIds].every(([t,o])=>{let n=new Set(e.get(t)?.ids??[]);return o.every(r=>n.has(r))})}async function fr(l){let{budget:e,room:t,mode:o,parents:n,maxRecords:r}=l,s=Cr(l),i=b=>{let k=o.caps?.[b]??o.all;return k===void 0?void 0:Math.max(1,Math.floor(k))},a=s.some(b=>b.heldAfter.some(k=>k.length>0)),c=new Map;for(let b of s){if(b.name!==Ae)continue;let k=b.rows.filter(x=>x[Ze]===!0);k.length>0&&c.set(b.name,new Set(k.map(x=>x.Id)))}let d=ar(s,c),m=b=>{let k={kept:new Map,ids:new Map,cut:new Map},x=new Set;for(let $ of s){let L=d.get($.name)??x,X=i($.name),F=$.roots.filter(J=>!L.has(J)),G=F.length===0?0:Math.max(1,Math.round(b*Math.min(F.length,X??1/0))),W=It(F.length,G).map(J=>F[J]),q=new Map;for(let J of $.followers){if(L.has(J))continue;let be=$.heldBefore[J].find(Se=>!k.ids.get(Se.link.parent)?.has(Se.id));be?q.set(J,be.link):W.push(J)}W.sort((J,be)=>J-be);let ie=$.name===fe?W.filter(J=>$.persons.has(J)):[],U=ie.length>0?W.filter(J=>!$.persons.has(J)):W,re=X===void 0?U.length:Math.max(0,X-L.size-ie.length),le=U.length>re?It(U.length,re).map(J=>U[J]):U,ue=new Set([...L,...ie,...le]);k.kept.set($.name,ue),k.ids.set($.name,new Set([...ue].map(J=>$.rows[J].Id))),k.cut.set($.name,q)}if(!a)return k;for(let $=!0;$;){$=!1;for(let L of s){let X=d.get(L.name)??x,F=k.kept.get(L.name)??new Set;for(let G of[...F]){if(X.has(G))continue;let W=[...L.heldAfter[G],...L.heldBefore[G]].find(q=>!k.ids.get(q.link.parent)?.has(q.id));W&&(F.delete(G),k.ids.get(L.name)?.delete(L.rows[G].Id),k.cut.get(L.name)?.set(G,W.link),$=!0)}}}return k},u=b=>{let k=new Map;for(let x of s){let $=0;for(let L of b.kept.get(x.name)??[])x.loose[L].some(F=>b.ids.get(F.link.parent)?.has(F.id))&&$++;$>0&&k.set(x.name,$)}return k},p=(b,k)=>{let x=new Map,$=0;for(let F of s){let G=b.kept.get(F.name)??new Set,W=0;for(let q of G)F.persons.has(q)&&W++;x.set(F.name,G.size),$+=Et(F.name,{rows:G.size,personAccounts:W})}for(let[F,{records:G,personAccounts:W}]of k)x.set(F,(x.get(F)??0)+G),$+=Et(F,{rows:G,...W!==void 0?{personAccounts:W}:{}});let L=u(b),X=So(t,(F,G)=>{let W=x.get(F)??0;return G==="insert"||Ce[F]!==void 0?W:L.get(F)??0});return{records:[...x.values()].reduce((F,G)=>F+G,0),bytes:$,roomBytes:X,requests:uo([...x.values()].map(F=>({rows:F})))}},g=new Map;for(let b of s)for(let k of b.named)for(let{parent:x,id:$}of k){let L=g.get(x)??new Set;g.set(x,L),L.add($)}let y=[...g.values()].reduce((b,k)=>b+k.size,0),f=b=>{let k=new Map,x=0;for(let X of s)for(let F of b.kept.get(X.name)??[])for(let{parent:G,id:W}of X.named[F]){let q=k.get(G)??new Set;k.set(G,q),q.has(W)||x++,q.add(W)}let $=y>0?x/y:0,L=new Map;for(let[X,{ids:F,personAccounts:G}]of n){let W=Math.max(0,F.length-(g.get(X)?.size??0)),q=Math.min(F.length,(k.get(X)?.size??0)+Math.ceil(W*$));q!==0&&L.set(X,{records:q,...G!==void 0?{personAccounts:Math.ceil(G*q/F.length)}:{}})}return L},R=b=>new Map(b.added.map(k=>{let x=b.personAccounts.get(k);return[k,{records:b.parentIds.get(k)?.length??0,...x!==void 0?{personAccounts:x}:{}}]})),w=b=>b.bytes+b.roomBytes<=e.bytes,C=b=>e.runRequests===void 0||b.requests<=e.runRequests,v=b=>r===void 0||b.records<=r,z=b=>w(b)&&C(b)&&v(b),K=b=>w(b)?C(b)?"maxTotal":"apiRequests":e.terms.limitedBy,E=b=>w(b)?C(b)?{bound:"maxTotal",records:b.records,allowed:r??0}:{bound:"apiRequests",requests:b.requests,allowed:e.runRequests??0}:{bound:"storage",takesMB:(b.bytes+b.roomBytes)/1048576,fitsMB:e.bytes/1048576},A=b=>{if(!w(b)){let k=wo((b.bytes+b.roomBytes)/1048576,e.bytes/1048576);return`${k.over} MB`+(b.roomBytes>0?", room for what the org's automation creates under them included":"")+`, past the ${k.bound} MB that fit`}return C(b)?`${cr(b.records)}, past the ${r??0} the run may write`:`about ${b.requests} API requests, past the ${e.runRequests??0} that leave the org a tenth of its daily requests`},j=b=>new Map(s.map(k=>[k.name,[...b.kept.get(k.name)??[]].sort((x,$)=>x-$).map(x=>k.rows[x])])),M=(b,k,x,$,L,X)=>{let F=s.map(q=>{let ie=k.cut.get(q.name)??new Map,U=new Map;for(let le of ie.values()){let ue=`${le.field}
|
|
8
8
|
${le.parent}`,J=U.get(ue)??{field:le.field,parent:le.parent,count:0};U.set(ue,{...J,count:J.count+1})}let re=k.kept.get(q.name)?.size??0;return{objectApiName:q.name,inSource:q.rows.length,kept:re,cutSpread:q.rows.length-re-ie.size,cutWithParent:[...U.values()].sort((le,ue)=>ue.count-le.count)}}),G=new Map,W=(q,ie,U)=>{let re=`${q}
|
|
9
9
|
${ie}
|
|
10
10
|
${U}`,le=(G.get(re)?.count??0)+1;G.set(re,{objectApiName:q,field:ie,count:le,why:U})};for(let q of s)for(let ie of k.kept.get(q.name)??[])for(let U of q.loose[ie])k.ids.get(U.link.parent)?.has(U.id)||W(q.name,U.link.field,U.link.kind==="owed"?"owed":"selfReference");for(let q of L?.namingSelected??[])q.required||k.ids.get(q.target)?.has(q.id)||W(q.objectApiName,q.field,"onParent");return{heldBy:$,...X?{cannotFit:X.words}:{},kept:j(k),...L?{walk:L}:{},report:{mode:o,heldBy:$,...X?{cannotFit:X.said}:{},budget:{...Oo(e,x.roomBytes,t),...$==="apiRequests"?{limitedBy:"apiRequests"}:{}},...b!==void 0?{share:b}:{},objects:F,emptied:[...G.values()],parents:L?L.added.map(q=>({objectApiName:q,records:L.parentIds.get(q)?.length??0})):[...n].map(([q,{ids:ie}])=>({objectApiName:q,records:ie.length})),records:x.records,estimateMB:x.bytes/1048576}}},te={words:Pr,said:{why:"sourceChanged"}},se=b=>({words:`with these caps the plan takes ${A(b)}: lower them, or fit by share`,said:{why:"caps",over:E(b)}}),T=Object.keys(o.caps??{}).find(b=>!s.some(k=>k.name===b)),O=s.reduce((b,k)=>Math.max(b,Math.min(k.roots.length,i(k.name)??1/0)),0),D=m(1),S=p(D,f(D));if(T!==void 0)return M(void 0,D,S,"caps",void 0,{words:`the plan selects no ${T}: a cap holds an object it selects`,said:{why:"capNotSelected",object:T}});if(s.some(b=>b.rows.length>(l.planned.get(b.name)??0)))return M(void 0,D,S,e.terms.limitedBy,void 0,te);let ne=o.all!==void 0||Object.keys(o.caps??{}).length>0,N=o.share===!0||!ne,_=b=>{let k=m(b/O);return p(k,f(k))};if(s.every(b=>D.kept.get(b.name)?.size===b.rows.length)&&z(S))return M(N?1:void 0,D,S,"whole",void 0);if(O===0)return M(void 0,D,S,e.terms.limitedBy,void 0,te);let B=O;if(!z(S)){if(!N)return M(void 0,D,S,K(S),void 0,se(S));if(B=To(O,b=>z(_(b))),B===0){let b=m(1/O),k=p(b,f(b));return M(1/O,b,k,K(k),void 0,{words:`the least it can be cut to \u2014 one record of each object with none to follow, and what follows them, ${cr(k.records)} \u2014 takes ${A(k)}`,said:{why:"least",over:E(k)}})}}let Z=B<O?K(_(B+1)):ne?"caps":e.terms.limitedBy,Y=b=>N?b/O:void 0;if(n.size===0){let b=m(B/O);return M(Y(B),b,p(b,new Map),Z,void 0)}for(let b=1;b<=sr;b++){let k=m(B/O),x=await l.walk(j(k));if(!Mr(x,n)){let F=p(k,R(x));return M(Y(B),k,F,Z,void 0,te)}let $=x.namingSelected.filter(F=>F.required&&s.find(G=>G.name===F.target)?.at.has(F.id)===!0&&!k.ids.get(F.target)?.has(F.id));if($.length>0){for(let{target:F,id:G}of $){let W=c.get(F)??new Set;c.set(F,W),W.add(G)}d=ar(s,c);continue}let L=p(k,R(x));if(z(L))return M(Y(B),k,L,Z,x);if(Z=K(L),!N)return M(void 0,k,L,Z,x,se(L));if(B===1)return M(Y(B),k,L,Z,x,{words:"the least it can be cut to, with the parents its records name, takes "+A(L),said:{why:"least",over:E(L)}});let X=Math.max((L.bytes+L.roomBytes)/Math.max(1,e.bytes),e.runRequests!==void 0?L.requests/Math.max(1,e.runRequests):0,r!==void 0?L.records/Math.max(1,r):0);B=Math.max(1,Math.min(B-1,Math.floor(B/X)))}let me=m(B/O),Be=p(me,f(me));return M(Y(B),me,Be,Z,void 0,{words:`could not fit in ${sr} rounds: fit by caps`,said:{why:"rounds"}})}function mr(l,e,t){let{selected:o}=l.scope,n=e.walk?.added??[],r=new Set([...o,...n]),s=new Map(e.walk?.parentIds??[]),i=new Map,a=new Map;for(let f of o){let R=e.kept.get(f)??[];s.set(f,R.map(w=>w.Id)),i.set(f,R.length),l.personAccounts.has(f)&&a.set(f,R.filter(w=>w[we]===!0).length)}for(let f of n)i.set(f,e.walk?.parentIds.get(f)?.length??0),l.personAccounts.has(f)&&a.set(f,e.walk?.personAccounts.get(f)??0);let c=new Map([...l.scope.leftEmpty,...e.walk?.leftEmpty??[]].filter(f=>r.has(f.objectApiName)&&!r.has(f.target)).map(f=>[`${f.objectApiName}.${f.fieldApiName}>${f.target}`,f])),{maxDepth:d,maxObjects:m,followedByDefault:u,currencies:p}=l.scope,g=u?.filter(f=>r.has(f.objectApiName)),y=p?.objects.filter(f=>r.has(f));return{...l,objectDescribes:new Map([...l.objectDescribes].filter(([f])=>r.has(f))),autoDiscoveredObjects:n,missingInTarget:l.missingInTarget.filter(f=>r.has(f)),recordCounts:i,totalObjectsScanned:r.size,parentIds:s,personAccounts:a,scope:{maxDepth:d,maxObjects:m,selected:o,parents:n.map(f=>({objectApiName:f,records:i.get(f)??0})),leftEmpty:[...c.values()],standardNeeded:l.scope.standardNeeded.filter(f=>r.has(f.objectApiName)),...g!==void 0&&g.length>0?{followedByDefault:g}:{},...p&&y!==void 0&&y.length>0?{currencies:{...p,objects:y}}:{},fitted:t}}}var nt=class{deps;eventListeners=[];runningExecutors=[];pendingSkips=new Set;constructor(e){this.deps=e}onEvent(e){return this.eventListeners.push(e),()=>{this.eventListeners=this.eventListeners.filter(t=>t!==e)}}emitEvent(e){for(let t of this.eventListeners)try{t(e)}catch{}}listObjects(e,t,o){return this.deps.schemaScanner.listObjects(e,t,o)}countObjects(e,t){return this.deps.schemaScanner.countObjects(e,t)}async scanSchemas(e,t,o,n){this.emitEvent({type:"scan-started",timestamp:new Date().toISOString()});let r=await this.deps.schemaScanner.scan(e,t,o.selectedObjects,o.includeStandardObjects,{...o.maxDepth!==void 0?{maxDepth:o.maxDepth}:{},...o.maxObjects!==void 0?{maxObjects:o.maxObjects}:{},...o.maxRecordsPerObject!==void 0&&o.maxRecordsPerObject>0?{maxRecordsPerObject:o.maxRecordsPerObject}:{},...n?{onProgress:n}:{}});return this.emitEvent({type:"scan-completed",timestamp:new Date().toISOString()}),r}buildGraph(e,t){let o=new Map;for(let[n,r]of e.objectDescribes){let s=r.fields.map(i=>({name:i.name,type:i.type,nillable:i.nillable,referenceTo:i.referenceTo,relationshipName:i.relationshipName}));o.set(n,{name:r.name,fields:s})}return this.deps.graphBuilder.build(o,e.recordCounts,t)}buildCompliance(e,t,o=[]){let n=this.deps.complianceEngine.buildProfile(e,Eo(o,t)),r=this.deps.complianceEngine.generateRules(n);return{profile:n,rules:r}}generatePlan(e,t,o,n){let r=Po(t,e.nodes.map(c=>c.objectApiName),o),s={...this.deps.complianceEngine.buildSummary(o),...r.length>0?{notCovered:r}:{}},i=this.deps.planGenerator.generate(e,t,s),a=n?{...i,scope:n}:i;return this.emitEvent({type:"plan-generated",timestamp:new Date().toISOString()}),a}async fitPlan(e,t){let{scan:o,graph:n,plan:r,rules:s,mode:i,budget:a,maxRecords:c,onProgress:d}=t,{schemaScanner:m}=this.deps,u=0,p={describe:O=>e.describe(O),describeGlobal:()=>e.describeGlobal(),query:O=>(u++,e.query(O)),...e.queryMore?{queryMore:O=>(u++,e.queryMore.call(e,O))}:{}},g=r.waves.map(O=>O.objects),y=new Map,f=g.flatMap(O=>Ue(O,n.edges).groups.filter(D=>D.length>1));for(let O of new Set(f.flat()))y.set(O,await t.describeLookups?.(O).catch(()=>null)??null);let R=fn(g,n.edges,O=>y.get(O)),{selected:w}=o.scope,C=lr(o.objectDescribes,w,R),v=ur(R,C),z=pr(t.automation,t.mutePlan,v),K=await m.readFitRows(p,o,d),E=await fr({order:R.filter(O=>w.includes(O)),rows:K,planned:o.recordCounts,lookups:C,parents:new Map(o.scope.parents.map(({objectApiName:O})=>{let D=o.personAccounts.get(O);return[O,{ids:o.parentIds.get(O)??[],...D!==void 0?{personAccounts:D}:{}}]})),budget:a,room:z,mode:i,...c!==void 0?{maxRecords:c}:{},walk:O=>m.walkFrom(p,o,O,d)}),A=z.unread!==void 0?{automationUnread:z.unread}:{},j={...E.report,requestsRead:u,...A,...t.mutePlan?{countedMuted:!0}:{},...c!==void 0?{maxTotal:c}:{}},M=new Map([...E.kept].map(([O,D])=>[O,D.map(S=>S.Id)])),te={heldBy:E.heldBy,report:j,keptIds:M,...A};if(E.cannotFit!==void 0)return{...te,cannotFit:E.cannotFit};if(E.heldBy==="whole")return te;let se=mr(o,E,j),T=this.buildGraph(se,t.batchSize);return{...te,fitted:{scan:se,graph:T,plan:this.generatePlan(T,r.complianceFramework,s,se.scope),run:dr(C,se.parentIds)}}}async executePlan(e,t,o,n,r,s,i,a){let c=Array.from(n.values()).reduce((R,w)=>R+w,0),d=this.isGrappeActive(c),m=`autopilot-${Date.now()}`;d&&this.deps.onGrappeEvent?.({type:"grappe:started",payload:{operationId:m,totalPartitions:e.waves.length,totalRecords:c}}),this.emitEvent({type:"execution-started",timestamp:new Date().toISOString()});let u=this.deps.createExecutor(),p=()=>{},g=r?u.on("node-completed",r):p,y=r?u.on("node-failed",r):p;for(let R of this.pendingSkips)u.skip(R);this.pendingSkips.clear(),this.runningExecutors.push(u);let f;try{f=await u.execute(e,t.edges,o,n,s,i,a)}finally{this.runningExecutors.splice(this.runningExecutors.indexOf(u),1),g(),y()}return this.emitEvent({type:"execution-completed",timestamp:new Date().toISOString()}),d&&this.deps.onGrappeEvent?.({type:"grappe:completed",payload:{operationId:m,totalProcessed:f.totalSuccess+f.totalSkipped,totalFailed:f.totalFailure}}),f}isGrappeActive(e){let t=this.deps.grappeConfig;return!!(t?.enabled&&this.deps.grappeAdapter&&e>=t.autoActivateThreshold)}generateReport(e,t,o,n,r,s){return this.deps.complianceEngine.generateReport(e,t,o,n,r,s)}latestRunningExecutor(){return this.runningExecutors[this.runningExecutors.length-1]}pause(){this.latestRunningExecutor()?.pause()}resume(){this.latestRunningExecutor()?.resume()}skip(e){let t=this.latestRunningExecutor();if(t){t.skip(e);return}this.pendingSkips.add(e)}};var ot=class{build(e,t,o=200){let n=this.extractEdges(e),r=Ir(n,new Set(e.keys())),s=this.tarjanSCC(Array.from(e.keys()),r),i=this.resolveCycles(s,r),{order:a,levels:c}=this.topologicalSort(Array.from(e.keys()),r,s),d=this.buildNodes(e,t,a,c,o),m=this.computeStats(d,n,i);return{nodes:d,edges:n,cycles:i,stats:m}}extractEdges(e){let t=[],o=new Set(e.keys());for(let[n,r]of e)for(let s of r.fields){if(s.type!=="reference"||s.referenceTo.length===0)continue;let i=s.referenceTo.filter(d=>o.has(d));if(i.length===0)continue;if(i.length>1){for(let d of i)t.push({from:d,to:n,fieldApiName:s.name,relationshipType:"polymorphic",required:!s.nillable});continue}let a=i[0],c;a===n?c="hierarchical":s.nillable?c="lookup":c="master_detail",t.push({from:a,to:n,fieldApiName:s.name,relationshipType:c,required:!s.nillable})}return t}tarjanSCC(e,t){let o=new Map;for(let s of e)o.set(s,[]);for(let s of t){let i=o.get(s.to);i&&i.push(s.from)}let n={index:0,stack:[],onStack:new Set,indices:new Map,lowLinks:new Map,sccs:[]},r=[...e].sort();for(let s of r)n.indices.has(s)||this.tarjanStrongConnect(s,o,n);return n.sccs}tarjanStrongConnect(e,t,o){o.indices.set(e,o.index),o.lowLinks.set(e,o.index),o.index++,o.stack.push(e),o.onStack.add(e);let n=t.get(e)??[];for(let r of n)if(o.indices.has(r)){if(o.onStack.has(r)){let s=o.lowLinks.get(e)??0,i=o.indices.get(r)??0;o.lowLinks.set(e,Math.min(s,i))}}else{this.tarjanStrongConnect(r,t,o);let s=o.lowLinks.get(e)??0,i=o.lowLinks.get(r)??0;o.lowLinks.set(e,Math.min(s,i))}if(o.lowLinks.get(e)===o.indices.get(e)){let r=[],s;do s=o.stack.pop(),o.onStack.delete(s),r.push(s);while(s!==e);o.sccs.push(r.sort())}}resolveCycles(e,t){let o=[],n=new Set;for(let r of t)r.from===r.to&&r.relationshipType==="hierarchical"&&n.add(r.from);for(let r of n)o.push({objects:[r],strategy:"two_pass",description:`Insert ${r} without self-lookup, update in 2nd pass`});for(let r of e){if(r.length<=1)continue;let s=new Set(r),i=t.filter(d=>s.has(d.from)&&s.has(d.to)&&d.from!==d.to),a,c;r.length===2&&i.some(m=>!m.required)?(a="nullable_lookup",c=`Insert ${r[0]} without ${r[1]} lookup, insert ${r[1]} with ${r[0]} lookup, update ${r[0]}`):(a="upsert_external_id",c="Decompose cycle into waves with upsert + external ID"),o.push({objects:[...r],strategy:a,description:c})}return o}topologicalSort(e,t,o){let n=new Map;for(let p=0;p<o.length;p++)for(let g of o[p])n.set(g,p);let r=o.length,s=new Map;for(let p=0;p<r;p++)s.set(p,new Set);for(let p of t){let g=n.get(p.from),y=n.get(p.to);g!==void 0&&y!==void 0&&g!==y&&s.get(y).add(g)}let i=new Map;for(let[p,g]of s)i.set(p,new Set(g));let a=[],c=new Map;for(;i.size>0;){let p=[];for(let[g,y]of i)y.size===0&&p.push(g);if(p.length===0){for(let g of i.keys())a.push(g),c.has(g)||c.set(g,0);break}p.sort((g,y)=>g-y);for(let g of p){a.push(g);let y=s.get(g)??new Set,f=-1;for(let R of y)f=Math.max(f,c.get(R)??0);c.set(g,y.size===0?0:f+1),i.delete(g);for(let R of i.values())R.delete(g)}}let d=new Map,m=new Map,u=0;for(let p of a){let g=o[p],y=c.get(p)??0,f=[...g].sort();for(let R of f)d.set(R,u),m.set(R,y),u++}for(let p of e)d.has(p)||(d.set(p,u),m.set(p,0),u++);return{order:d,levels:m}}buildNodes(e,t,o,n,r){let s=[];for(let i of e.keys()){let a=t.get(i)??0;s.push({objectApiName:i,recordCount:a,estimatedApiCalls:a===0?0:Math.ceil(a/r),piiFields:[],anonymizationRules:[],status:"pending",progress:0,insertOrder:o.get(i)??0,level:n.get(i)??0,successCount:0,failureCount:0,errors:[],elapsedMs:0,apiCallsUsed:0})}return s.sort((i,a)=>i.insertOrder-a.insertOrder),s}computeStats(e,t,o){return{totalObjects:e.length,totalRelationships:t.length,cycleCount:o.length,maxDepth:Math.max(0,...e.map(n=>n.level)),totalRecords:e.reduce((n,r)=>n+r.recordCount,0),totalEstimatedApiCalls:e.reduce((n,r)=>n+r.estimatedApiCalls,0)}}};function Ir(l,e){let t=wn(e);return t.length===0?[...l]:[...l.filter(o=>!(o.to===oe&&o.fieldApiName==="ActivityId")),...t.map(o=>({from:o.sourceObject,to:o.targetObject,fieldApiName:o.relationshipName,relationshipType:"lookup",required:!0}))]}import{createHash as xr,randomUUID as Fr}from"node:crypto";var jr=["fake","mask","hash","nullify","redact","shuffle","truncate","preserve_format","age_band","generalize"],rt=class{builtInRules;constructor(){this.builtInRules=new Map,this.builtInRules.set("gdpr",this.buildGDPRRules()),this.builtInRules.set("ccpa",this.buildCCPARules()),this.builtInRules.set("hipaa",this.buildHIPAARules()),this.builtInRules.set("pci_dss",this.buildPCIDSSRules())}buildProfile(e,t,o=[]){let n=this.builtInRules.get(e)??[];return{framework:e,rules:n,autoDetectedPII:t,userOverrides:o,auditRequired:e!=="none"&&e!=="custom"}}generateRules(e){if(e.framework==="none")return[];let t=new Map;for(let n of e.userOverrides){let r=`${n.objectApiName}.${n.fieldApiName}`;t.set(r,n)}let o=[];for(let n of e.autoDetectedPII){let r=`${n.objectApiName}.${n.fieldApiName}`,s=t.get(r);if(s){if(s.method==="skip")continue;o.push({objectApiName:n.objectApiName,fieldApiName:n.fieldApiName,method:s.method,piiCategory:n.piiCategory,aiConfidence:n.confidence,userOverridden:!0,fieldType:n.fieldType});continue}let i=this.findMatchingRule(e.rules,n.piiCategory),a=i&&i.requiredMethod!=="any"?i.requiredMethod:n.suggestedMethod;o.push({objectApiName:n.objectApiName,fieldApiName:n.fieldApiName,method:a,piiCategory:n.piiCategory,aiConfidence:n.confidence,userOverridden:!1,fieldType:n.fieldType})}return o}buildSummary(e){let t={};for(let n of jr)t[n]=0;for(let n of e)t[n.method]++;let o=[...new Set(e.map(n=>n.objectApiName))];return{totalPiiFields:e.length,totalFieldsToAnonymize:e.length,methodBreakdown:t,objectsWithPii:o}}generateReport(e,t,o,n,r,s){let i=new Set(e.userOverrides.map(y=>`${y.objectApiName}.${y.fieldApiName}`)),a=t.map(y=>{let f=this.findMatchingRule(e.rules,y.piiCategory),R=f?f.id:"custom",w=o.get(y.objectApiName)??0,C=`${y.objectApiName}.${y.fieldApiName}`;return{objectApiName:y.objectApiName,fieldApiName:y.fieldApiName,piiCategory:y.piiCategory,anonymizationMethod:y.method,recordsAnonymized:w,ruleApplied:R,userOverridden:i.has(C)||y.userOverridden}}),c=this.buildObjectSummaries(t,o,e),d=this.computeOverallStatus(c),m=new Date().toISOString(),u=Fr(),p=JSON.stringify(a),g=xr("sha256").update(p).digest("hex");return{id:u,framework:e.framework,generatedAt:m,sourceOrgId:n,targetOrgId:r,totalFieldsScanned:s,piiFieldsDetected:e.autoDetectedPII.length,piiFieldsAnonymized:t.length,entries:a,objectSummaries:c,overallStatus:d,checksumSha256:g}}findMatchingRule(e,t){return e.find(o=>o.targetPiiCategories.includes(t))}buildObjectSummaries(e,t,o){let n=new Set;for(let s of e)n.add(s.objectApiName);for(let s of o.autoDetectedPII)n.add(s.objectApiName);let r=[];for(let s of n){let i=e.filter(p=>p.objectApiName===s),a=o.autoDetectedPII.filter(p=>p.objectApiName===s),c=[...new Set(i.map(p=>p.method))],d=t.get(s)??0,m=a.length>0&&a.every(p=>i.some(g=>g.fieldApiName===p.fieldApiName)),u=a.length===0||m?"pass":i.length>0?"partial":"fail";r.push({objectApiName:s,recordCount:d,piiFieldCount:a.length,anonymizationMethods:c,status:u})}return r}computeOverallStatus(e){return e.length===0||e.every(n=>n.status==="pass")?"pass":e.every(n=>n.status==="fail")?"fail":"partial"}buildGDPRRules(){return[{id:"gdpr-01",framework:"gdpr",category:"data_minimization",description:"Anonymize personal identifiers (name, email, phone, address)",targetPiiCategories:["PII"],requiredMethod:"fake",articleReference:"GDPR Art. 25"},{id:"gdpr-02",framework:"gdpr",category:"data_protection",description:"Hash sensitive identifiers for pseudonymization",targetPiiCategories:["SENSITIVE"],requiredMethod:"hash",articleReference:"GDPR Art. 32"},{id:"gdpr-03",framework:"gdpr",category:"health_data",description:"Nullify health-related data",targetPiiCategories:["PHI"],requiredMethod:"nullify",articleReference:"GDPR Art. 9"},{id:"gdpr-04",framework:"gdpr",category:"financial_data",description:"Mask payment card data",targetPiiCategories:["PCI"],requiredMethod:"mask",articleReference:"GDPR Art. 32"}]}buildCCPARules(){return[{id:"ccpa-01",framework:"ccpa",category:"personal_info",description:"Anonymize personal information (name, email, phone)",targetPiiCategories:["PII"],requiredMethod:"fake"},{id:"ccpa-02",framework:"ccpa",category:"commercial_info",description:"Mask commercial and financial data",targetPiiCategories:["PCI","SENSITIVE"],requiredMethod:"mask"},{id:"ccpa-03",framework:"ccpa",category:"biometric",description:"Nullify biometric and health data",targetPiiCategories:["PHI"],requiredMethod:"nullify"}]}buildHIPAARules(){return[{id:"hipaa-01",framework:"hipaa",category:"safe_harbor",description:"Anonymize patient identifiers (name, address, phone)",targetPiiCategories:["PII","PHI"],requiredMethod:"fake",articleReference:"HIPAA Safe Harbor \xA7164.514(b)"},{id:"hipaa-02",framework:"hipaa",category:"safe_harbor_dates",description:"Generalize dates to year only",targetPiiCategories:["SENSITIVE"],requiredMethod:"age_band",articleReference:"HIPAA Safe Harbor \xA7164.514(b)"},{id:"hipaa-03",framework:"hipaa",category:"safe_harbor_ids",description:"Hash medical record numbers and SSNs",targetPiiCategories:["PHI"],requiredMethod:"hash",articleReference:"HIPAA Safe Harbor \xA7164.514(b)"}]}buildPCIDSSRules(){return[{id:"pci-01",framework:"pci_dss",category:"card_data",description:"Mask PAN to show only last 4 digits",targetPiiCategories:["PCI"],requiredMethod:"mask",articleReference:"PCI-DSS Requirement 3.3"},{id:"pci-02",framework:"pci_dss",category:"auth_data",description:"Nullify CVV, expiration, and magnetic strip data",targetPiiCategories:["PCI"],requiredMethod:"nullify",articleReference:"PCI-DSS Requirement 3.2"},{id:"pci-03",framework:"pci_dss",category:"cardholder",description:"Anonymize cardholder personal data",targetPiiCategories:["PII"],requiredMethod:"fake",articleReference:"PCI-DSS Requirement 3.4"}]}};var st=class{avgSecondsPerApiCall;batchSize;constructor(e){this.avgSecondsPerApiCall=e?.avgSecondsPerApiCall??.5,this.batchSize=e?.batchSize??200}getBatchSize(){return this.batchSize}generate(e,t,o){let n=this.buildWaves(e),r=e.stats.totalRecords,s=e.stats.totalEstimatedApiCalls,i=this.estimateDuration(n,e);return{waves:n,totalRecords:r,estimatedDurationSec:i,estimatedApiCalls:s,complianceFramework:t,anonymizationSummary:o,cycleResolutions:e.cycles}}buildWaves(e){if(e.nodes.length===0)return[];let t=[...e.nodes].sort((i,a)=>i.insertOrder-a.insertOrder),o=new Map;for(let i of t){let a=o.get(i.level);a?a.push(i.objectApiName):o.set(i.level,[i.objectApiName])}let n=[...o.keys()].sort((i,a)=>i-a),r=new Map;for(let i=0;i<n.length;i++){let a=n[i],c=o.get(a);if(c)for(let d of c)r.set(d,i)}let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=o.get(a)??[],d=new Set;for(let u of c)for(let p of e.edges)if(p.to===u){let g=r.get(p.from);g!==void 0&&g<i&&d.add(g)}let m=[...d].sort((u,p)=>u-p);s.push({order:i,objects:c,dependsOn:m})}return s}estimateDuration(e,t){let o=new Map;for(let s of t.nodes)o.set(s.objectApiName,s.estimatedApiCalls);let n=new Map;t.cycles.forEach((s,i)=>{for(let a of s.objects)n.set(a,i)});let r=0;for(let s of e){let i=new Map;for(let a of s.objects){let c=n.get(a),d=c===void 0?`object:${a}`:`cycle:${c}`;i.set(d,(i.get(d)??0)+(o.get(a)??0))}r+=Math.max(0,...i.values())*this.avgSecondsPerApiCall}return r}};var De=class{idMaps=new Map;registerMappings(e,t){let o=this.idMaps.get(e);o||(o=new Map,this.idMaps.set(e,o));for(let[n,r]of t)o.set(n,r)}remapRecords(e,t,o){let n=t.filter(c=>c.to===o),r=0,s=0,i=0,a=[];for(let[c,d]of e.entries()){let m=new Set,u=new Map;for(let p of n){let g=d[p.fieldApiName];if(g==null||g===""){i++;continue}if(typeof g!="string"){i++;continue}let f=this.idMaps.get(p.from)?.get(g);if(f!==void 0)d[p.fieldApiName]=f,m.add(p.fieldApiName),r++;else{let R=u.get(p.fieldApiName);R?R.parents.push(p.from):u.set(p.fieldApiName,{sourceId:g,parents:[p.from]}),s++}}for(let[p,{sourceId:g,parents:y}]of u)m.has(p)||(d[p]=null,a.push({index:c,fieldApiName:p,sourceId:g,parents:y}))}return{remapped:r,missing:s,skipped:i,unresolved:a}}getTargetId(e,t){return this.idMaps.get(e)?.get(t)}hasObject(e){return this.idMaps.has(e)}getMappingCount(e){return this.idMaps.get(e)?.size??0}get totalMappings(){let e=0;for(let t of this.idMaps.values())e+=t.size;return e}clear(){this.idMaps.clear()}};var Nr=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function Ar(l,e,t){let o=en(l);if(e!==void 0&&!Nr.test(e))throw new Error(`Not a record id to read after: "${e}".`);let n=e===void 0?"":` WHERE Id > '${e}'`;return`SELECT FIELDS(ALL) FROM ${o}${n} ORDER BY Id LIMIT ${Math.trunc(t)}`}var Lr={statusCode:Ye,message:"No result returned for the record",fields:[]},Dr={statusCode:Ye,message:"Refused without a reason",fields:[]},hr="PARENT_REFUSED",gr="PARENT_NOT_WRITTEN",Yt="CUT_WITH_PARENT",yr={skipped:l=>`${l} was skipped in this run`,failed:l=>`the run's write of ${l} failed`},$r="PERSON_ACCOUNT_NOT_WRITTEN",Br="PERSON_CONTACT_NOT_LOOKED_UP",_r=`SELECT Id FROM RecordType WHERE SobjectType = '${ce}' AND IsPersonType = true`;function de(l){return l.slice(0,15)}var Re=class{byReason=new Map;add(e){let t=new Set;for(let o of e){let n=`${o.statusCode}\0${o.fields.join(",")}`;if(t.has(n))continue;t.add(n);let r=this.byReason.get(n);this.byReason.set(n,r?{...r,count:r.count+1}:{statusCode:o.statusCode,fields:[...o.fields],count:1,message:o.message})}}addCounted(e){let t=`${e.statusCode}\0${e.fields.join(",")}`,o=this.byReason.get(t);this.byReason.set(t,o?{...o,count:o.count+e.count}:e)}list(){return[...this.byReason.values()].sort((e,t)=>t.count-e.count)}};function qr(l,e){let[t,...o]=l.errors,[n,...r]=l.errorDetails??[];return{...l,...t===void 0?{}:{errors:[Tt(t,e),...o]},...n===void 0?{}:{errorDetails:[{...n,message:Tt(n.message,e)},...r]}}}function wr(){return{written:0,linked:0,failed:0,errors:[],refusals:new Re,apiCallsUsed:0,defaulted:new Map,cutSinceFit:0,heldForRecordType:new Map,sentAgainForALock:{rows:0,written:0,stillLocked:0}}}function zr(l){return{statusCode:qn,fields:["RecordTypeId"],count:l.recordCount,message:Un(l)}}function Gr(l,e){return{objectApiName:l,rows:e.rows,why:{...e.why},...e.predicted?{predicted:e.predicted}:{},...e.readBack?{readBack:e.readBack}:{}}}function br(l){let e=0;for(let[t,o]of l)Ft(t)&&(e+=o);return e}function Ur(l){let e=new Map;for(let t of l.holds)e.set(t.objectApiName,[...e.get(t.objectApiName)??[],t]);return{holds:e,kept:new Map([...l.kept].map(([t,o])=>[t,new Set(o.map(de))])),stayedOut:new Map}}var $e=class extends Co{deps;batchSize;paused=!1;pausePromise=null;pauseResolve=null;skippedObjects=new Set;signal;contactPoints;creatableByObject=new Map;currencies;currencyChanges=new Bn;pricesSettled=new Map;currencyChangesByWrittenId=new Map;keyPrefixByObject=new Map;lifecycleByObject=new Map;standardPricebook;deferredStatuses=[];lookupsByObject=new Map;recordTypeMappings;targetRecordTypes=[];planned=new Set;parentIds=new Map;owedLookups=[];unmappedRecordTypes=new Set;leftToThePlatform=new gn;taskOfEmail=new Map;emailsAfterTheirTask=[];taskTurnOver=!1;emailsHeldAndNotSent=0;leftByStop=new Map;lookupsLeftEmpty=new Map;refusedRecords=new Map;notWritten=new Map;reached=new Set;personTypes;personContactsLinked=0;recordTypesGiven=new Map;recordTypesUnderTheLease=new Map;givenRules=new Map;lease;fit;async creatableFieldsOf(e){if(!this.deps.describeCreateableFields)return null;let t=this.creatableByObject.get(e);if(t!==void 0)return t;try{let o=await this.deps.describeCreateableFields(e),n=o.size>0?o:null;return this.creatableByObject.set(e,n),n}catch{return this.creatableByObject.set(e,null),null}}lookupsOf(e){let t=this.deps.describeLookups;if(!t)return Promise.resolve(null);let o=this.lookupsByObject.get(e);return o||(o=t(e).catch(()=>null),this.lookupsByObject.set(e,o)),o}keyPrefixOf(e){let t=this.deps.describeKeyPrefix;if(!t)return Promise.resolve(void 0);let o=this.keyPrefixByObject.get(e);return o||(o=t(e).catch(()=>{}),this.keyPrefixByObject.set(e,o)),o}constructor(e){super(),this.deps=e,this.batchSize=e.batchSize??200}async recordTypesHeldBack(e){let{describeRecordTypes:t,countRecordTypes:o}=this.deps;if(!t||!o)return[];let n=await this.creatableFieldsOf(e);if(n&&!n.has("RecordTypeId"))return[];try{let r=await t(e);if(!r.some(i=>!i.available&&!i.master))return[];let s=this.inTargetRecordTypes(await o(e));return zn(e,s,kt(r,this.targetRecordTypes))}catch{return[]}}inTargetRecordTypes(e){let t=new Map;for(let[o,n]of e){if(o===null)continue;let r=this.targetRecordTypeOf(o);t.set(r,(t.get(r)??0)+n)}return t}targetRecordTypeOf(e){return this.recordTypeMappings?.find(t=>t.sourceId===e)?.targetId??e}async recordTypesGivenOf(e,t,o=new Map,n=[]){await this.mapRecordTypes(e);let r=new Map;for(let s of new Set(e.waves.flatMap(i=>i.objects))){let i=t.get(s)??0;if(i===0)continue;let a=await this.givenRuleOf(s);if(!a)continue;let c=await this.creatableFieldsOf(s),d,m="masterInSource";if(c&&!c.has("RecordTypeId"))d=i,m="notRead";else{let u=await this.onMasterInSource(s,o.get(s));if(u===void 0)continue;d=n.find(g=>g.objectApiName===s)?Math.min(u,i):u}d!==0&&r.set(s,{objectApiName:s,rows:d,why:{[m]:d},...a.predicted?{predicted:a.predicted}:{}})}return r}async onMasterInSource(e,t){try{if(t===void 0){let r=this.deps.countRecordTypes;return r?br(await r(e)):void 0}let o=this.deps.querySource;if(!o)return;let n=0;for(let r=0;r<t.length;r+=ke){let s=await o(Nt(e,t.slice(r,r+ke)));n+=br(Ke(s))}return n}catch{return}}givenRuleOf(e){let t=this.givenRules.get(e);return t||(t=(async()=>{let o=this.recordTypesUnderTheLease.get(e)??await this.deps.describeRecordTypes?.(e).catch(()=>{});if(!o?.some(s=>!s.master))return;let n=kt(o,this.targetRecordTypes),r=$o(Do(n));return{types:n,...r?{predicted:r}:{}}})(),this.givenRules.set(e,t)),t}async readAgainUnderTheLease(e,t){let o=this.deps.describeRecordTypesAgain;if(!o||!this.lease||this.lease.assigned===0)return;let n=[...new Set(e.waves.flatMap(r=>r.objects))].filter(r=>(t.get(r)??0)>0);await Promise.all(n.map(async r=>{if((await this.deps.describeRecordTypes?.(r).catch(()=>{}))?.some(i=>!i.master))try{this.recordTypesUnderTheLease.set(r,await o(r))}catch{}}))}countCreatedWithoutRecordType(e,t,o,n){let r=this.recordTypesGiven.get(e);r||(r={...t,rows:0,why:{},ids:[]},this.recordTypesGiven.set(e,r)),r.rows++,r.why[o]=(r.why[o]??0)+1,n&&r.ids.length<Bo&&r.ids.push(n)}async afterTheWrites(e){await this.giveTheLeaseBack(),await this.readBackRecordTypes();for(let[t,o]of this.recordTypesGiven){let n=e[t];n&&(e[t]={...n,recordTypeGiven:Gr(t,o)})}}async giveTheLeaseBack(){let e=this.lease;if(e){this.lease=void 0;try{await e.giveBack()}catch(t){ae.warn(`[autopilot] the mute's lease was not given back as the writes ended: ${ee(t)}`)}}}async readBackRecordTypes(){let e=this.deps.queryTarget;e&&await Promise.all([...this.recordTypesGiven].map(async([t,o])=>{if(o.ids.length!==0)try{let n=await e(Nt(t,o.ids));o.readBack=_o(n,o.types)}catch(n){o.readBack={read:0,types:[],unread:ee(n)}}}))}holdOnClosedRecordTypes(e,t,o){let n=o.closedRecordTypes;if(!n)return t;let r=[];for(let s of t){let i=s.RecordTypeId,a=e===fe&&Pe(s),c=typeof i=="string"&&i.length>=15&&!a?n.get(de(this.targetRecordTypeOf(i))):void 0;if(!c){r.push(s);continue}o.failed++;let d=o.heldForRecordType.get(c.recordTypeId);o.heldForRecordType.set(c.recordTypeId,{...c,recordCount:(d?.recordCount??0)+1});let m=s.Id;typeof m=="string"&&m!==""&&this.refusedRecords.set(de(m),e)}return r}async mapRecordTypes(e){let{querySource:t,queryTarget:o}=this.deps;if(!t||!o)return;let n=[...new Set(e.waves.flatMap(s=>s.objects))];if(n.length===0)return;let r=`${xo} AND SobjectType IN (${n.map(s=>`'${ge(s)}'`).join(", ")})`;try{let[s,i]=await Promise.all([t(r),o(r)]),a=xt(s);this.targetRecordTypes=xt(i),this.recordTypeMappings=new jt().buildMapping(a,this.targetRecordTypes);for(let c of No(a,this.targetRecordTypes))ae.warn(`[autopilot] ${Lo(c)}`)}catch(s){ae.warn("Autopilot could not match the record types of the two orgs",{error:ee(s)})}}async matchStandardPricebooks(e){let{querySource:t,queryTarget:o}=this.deps;if(!t||!o)return;let n=new Set(e.waves.flatMap(r=>r.objects));if(!(!n.has(Ae)&&!n.has(Oe)))try{let[r,s]=await Promise.all([t(ve),o(ve)]),i=r[0]?.Id,a=s[0]?.Id;if(typeof i!="string"||typeof a!="string")return;this.standardPricebook={source:i,target:a},this.deps.remapper.registerMappings(Ae,[[i,a]])}catch(r){ae.warn("Autopilot could not match the standard price books",{error:ee(r)})}}async execute(e,t,o,n,r,s=new Map,i={}){if(!this.deps.queryByIds&&[...s.values()].some(f=>f.length>0))throw new Error("This plan reads the parents its objects reference by id, and the run has no read by id.");this.parentIds=s,this.contactPoints=i.keepContactPoints===!0?void 0:new Mo,this.lease=i.lease,this.fit=i.fit?Ur(i.fit):void 0;let a=Date.now();this.signal=r;let c=()=>this.pauseResolve?.();r?.addEventListener("abort",c,{once:!0});let d={},m={},u={totalSuccess:0,totalFailure:0,totalSkipped:0,totalLinked:0,elapsedMs:0,completedObjects:[],failedObjects:[],skippedObjects:[],nodeErrors:d,objectOutcomes:m},p=[];this.emit("execution-started",this.makeEvent({type:"execution-started",timestamp:""}));let g=async f=>{await y(f),f===We&&await this.writeEmailsAfterTheirTask(t,u)},y=async f=>{if(this.skippedObjects.has(f)){let w=n.get(f)??0;u.skippedObjects.push(f),u.totalSkipped+=w,this.notWritten.set(f,"skipped");return}this.reached.add(f);let R=n.get(f)??0;if(await this.checkPause()){p.push(f),m[f]={written:0,linked:0,failed:0,refusals:[],...R>0?{notSent:R}:{}};return}try{let w=await this.executeObject(f,t,o,R);u.totalSuccess+=w.success,u.totalFailure+=w.failure,u.totalLinked=(u.totalLinked??0)+w.linked,w.cutSinceFit>0&&(u.cutSinceFit=(u.cutSinceFit??0)+w.cutSinceFit);let C=this.leftToThePlatform.counts(f);if(m[f]={written:w.success,linked:w.linked,failed:w.failure,refusals:w.refusals,...w.leftToDefault.length>0?{leftToDefault:w.leftToDefault}:{},...C.length>0?{leftToThePlatform:C}:{},...w.notSent!==void 0&&w.notSent>0?{notSent:w.notSent}:{},...this.currenciesReplacedOf(f),...this.pricesSettledOf(f),...f===fe&&this.personContactsLinked>0?{withTheirPersonAccount:this.personContactsLinked}:{},...w.cutSinceFit>0?{cutSinceFit:w.cutSinceFit}:{},...w.threw!==void 0?{threw:w.threw}:{},...w.sentAgainForALock.rows>0?{sentAgainForALock:w.sentAgainForALock}:{}},w.notSent!==void 0){p.push(f);return}let{threw:v}=w;if(v!==void 0||w.errors.length>0&&w.success+w.linked===0){u.failedObjects.push(f),v!==void 0&&this.notWritten.set(f,"failed");let z=v!==void 0?[v,...w.errors]:w.errors;d[f]=z[0],this.emit("node-failed",this.makeEvent({type:"node-failed",timestamp:"",objectApiName:f,errors:z,partialSuccessCount:w.success,failureCount:w.failure,linkedCount:w.linked,refusals:w.refusals}))}else u.completedObjects.push(f),this.emit("node-completed",this.makeEvent({type:"node-completed",timestamp:"",objectApiName:f,successCount:w.success,failureCount:w.failure,linkedCount:w.linked,refusals:w.refusals,elapsedMs:w.elapsedMs,apiCallsUsed:w.apiCallsUsed}))}catch(w){u.failedObjects.push(f),this.notWritten.set(f,"failed");let C=ee(w);d[f]=C,this.emit("node-failed",this.makeEvent({type:"node-failed",timestamp:"",objectApiName:f,errors:[C],partialSuccessCount:0,failureCount:0,linkedCount:0,refusals:[]}))}};try{await this.matchStandardPricebooks(e),await this.mapRecordTypes(e),await this.readAgainUnderTheLease(e,n),this.planned=new Set(e.waves.flatMap(w=>w.objects));let f={};for(let w of e.waves){if(await this.writeWave(w.objects,t,g),this.stopped())break;await this.fillOwedLookups(f),this.emit("wave-completed",this.makeEvent({type:"wave-completed",timestamp:""}))}if(this.stopped()){let w=new Set([...u.completedObjects,...u.failedObjects,...u.skippedObjects,...p]);for(let C of e.waves.flatMap(v=>v.objects)){if(w.has(C))continue;let v=n.get(C)??0;p.push(C),m[C]={written:0,linked:0,failed:0,refusals:[],...v>0?{notSent:v}:{}}}return u.stopped=!0,u.stoppedObjects=p,this.countEmailsTheStopHeld(u,p,m),this.countWhatTheStopLeft(p,m),await this.sayLookupsLeftOwed(t,f),Object.keys(f).length>0&&(u.lookups=f),await this.afterTheWrites(m),this.reportContactPoints(u),u.elapsedMs=Date.now()-a,u}this.emailsAfterTheirTask.length>0&&(await this.writeEmailsAfterTheirTask(t,u),await this.fillOwedLookups(f)),await this.sayLookupsLeftOwed(t,f);let R=await this.applyDeferredStatuses();return Object.keys(R).length>0&&(u.statuses=R),Object.keys(f).length>0&&(u.lookups=f),await this.afterTheWrites(m),this.stopped()&&(u.stopped=!0,u.stoppedObjects=p,this.countEmailsTheStopHeld(u,p,m),this.countWhatTheStopLeft(p,m)),this.reportContactPoints(u),u.elapsedMs=Date.now()-a,this.emit("execution-completed",this.makeEvent({type:"execution-completed",timestamp:""})),u}catch(f){throw u.elapsedMs=Date.now()-a,u.fatalError=ee(f),ae.error("Autopilot execution crashed",{error:u.fatalError}),this.emit("execution-failed",this.makeEvent({type:"execution-failed",timestamp:"",error:u.fatalError})),f}finally{r?.removeEventListener("abort",c),await this.giveTheLeaseBack()}}async writeWave(e,t,o){let{within:n,deps:r,groups:s}=Ue(e,t),i=new Map;s.forEach((m,u)=>m.forEach(p=>i.set(p,u)));let a=[];for(let[m,u]of s.entries()){let p=new Set;for(let g of u)for(let y of r.get(g)??[]){let f=i.get(y);f!==void 0&&f!==m&&p.add(a[f])}a.push((async()=>{await Promise.all(p);let g=u.length>1?un(u,await this.setAtInsert(u,n)):u;for(let y of g)await o(y)})())}let d=(await Promise.allSettled(a)).find(m=>m.status==="rejected");if(d)throw d.reason}async setAtInsert(e,t){let o=new Set(e),n=new Map;for(let r of t)!o.has(r.to)||!o.has(r.from)||n.has(r.to)||n.set(r.to,await this.lookupsOf(r.to));return pn(e,t,r=>n.get(r))}async fillOwedLookups(e){let t=this.owedLookups.splice(0,this.owedLookups.length),{update:o}=this.deps;if(!o||t.length===0)return;let n=new Io;for(let r of t){let s=r.parents.map(i=>this.deps.remapper.getTargetId(i,r.sourceId)).find(i=>i!==void 0);if(!s){this.owedLookups.push(r);continue}n.add({objectApiName:r.objectApiName,recordId:r.recordId,fieldName:r.fieldApiName,value:s})}for(let[r,s]of n.updates()){let i=e[r],a=i?.filled??0,c=new Re;for(let d of i?.refusals??[])c.addCounted(d);for(let d=0;d<s.length;d+=this.batchSize){if(await this.checkPause()){this.noteLeftByStop(r,"lookups",s.slice(d).map(p=>String(p.Id)));break}let m=s.slice(d,d+this.batchSize),u=await Ht(o,r,m);m.forEach((p,g)=>{let y=u[g];if(y?.success){a++;return}let f=Object.keys(p).filter(R=>R!=="Id");c.add(Kt(y).map(R=>({...R,fields:f}))),this.noteLookupLeftEmpty(r,String(p.Id))})}e[r]=this.lookupOutcome(r,a,c)}}noteLookupLeftEmpty(e,t){let o=this.lookupsLeftEmpty.get(e);o||(o=new Set,this.lookupsLeftEmpty.set(e,o)),o.add(t)}lookupOutcome(e,t,o){let n=this.lookupsLeftEmpty.get(e)?.size??0;return{filled:t,refusals:o.list(),...n>0?{leftEmpty:n}:{}}}async sayLookupsLeftOwed(e,t){let o=new Map;for(let n of this.owedLookups.splice(0,this.owedLookups.length)){let r=await this.whyLeftOwed(n,e);if(!r)continue;let s=o.get(n.objectApiName);if(!s){s=new Re;for(let i of t[n.objectApiName]?.refusals??[])s.addCounted(i);o.set(n.objectApiName,s)}s.add([{...r,fields:[n.fieldApiName]}]),this.noteLookupLeftEmpty(n.objectApiName,n.recordId)}for(let[n,r]of o){let s=t[n]?.filled??0;t[n]=this.lookupOutcome(n,s,r)}}async whyLeftOwed(e,t){let{fieldApiName:o,sourceId:n}=e,r=this.refusedRecords.get(de(n)),s=e.parents.find(c=>c===r);if(s)return{statusCode:hr,message:`the ${s} record its ${o} names was refused in this run, and this record, written before it, keeps its ${o} empty.`};let i=this.fit?.stayedOut.get(de(n)),a=e.parents.find(c=>c===i);if(a)return{statusCode:Yt,message:`the ${a} record its ${o} names stayed out with a record the fit cut, and this record, written before it, keeps its ${o} empty.`};for(let c of e.parents){let d=this.notWrittenOf(c);if(d===void 0)continue;let m=t.find(u=>u.from===c&&u.to===e.objectApiName&&u.fieldApiName===o);if(!(m&&!await this.namesARecordOf(e.objectApiName,m,n,e.parents.length)))return{statusCode:gr,message:`the ${c} record its ${o} names was not written: ${yr[d](c)}, and this record, written before it, keeps its ${o} empty.`}}}async executeObject(e,t,o,n){let r=Date.now(),s=wr(),i=()=>{let a=[...s.heldForRecordType.values()];return{success:s.written,linked:s.linked,failure:s.failed,errors:[...a.map(Wn),...s.errors],refusals:[...s.refusals.list(),...a.map(zr)].sort((c,d)=>d.count-c.count),apiCallsUsed:s.apiCallsUsed,elapsedMs:Date.now()-r,leftToDefault:[...s.defaulted].map(([c,d])=>({field:c,count:d})),...s.notSent!==void 0?{notSent:s.notSent}:{},cutSinceFit:s.cutSinceFit,sentAgainForALock:s.sentAgainForALock}};try{return await this.writeEveryPage(e,t,o,n,s,i)}catch(a){return{...i(),threw:ee(a)}}}async writeEveryPage(e,t,o,n,r,s){let i=n>0?await this.recordTypesHeldBack(e):[];i.length>0&&(r.closedRecordTypes=new Map(i.map(u=>[de(u.recordTypeId),u])));let a=u=>{let p=Math.min(u,n);this.emit("node-progress",this.makeEvent({type:"node-progress",timestamp:"",objectApiName:e,progress:n>0?Math.round(p/n*100):100,recordsProcessed:p,recordsTotal:n,apiCallsUsed:r.apiCallsUsed}))},c=0,d,m=this.standardPricebook;if(Vt(e)&&m){let u=[];for(;c<n;){if(await this.checkPause())return r.notSent=n,s();let{rows:v,advance:z,next:K,last:E}=await this.readPage(e,c,d);if(r.apiCallsUsed++,z===0)break;c+=z,d=K;let A=this.leaveToThePlatform(e,v,t);if(this.deps.anonymizer.anonymize(A,o,e),await this.neutralizeContactPoints(e,A),u.push(...A),E)break}let p=await this.pricesInOneCurrencyEach(u,m.source),{standard:g,custom:y}=ut(p.rows,m.source),f=ut(u.filter(v=>p.standsFor.has(String(v.Id))),m.source);p.said.length>0&&this.pricesSettled.set(e,Go(p.said));let R=0,w=0,C=async v=>{for(let z=0;z<v.length;z+=this.batchSize){if(await this.checkPause())return r.notSent=u.length-R-w,!1;let K=v.slice(z,z+this.batchSize);await this.writeBatch(e,K,t,r),R+=K.length,a(R+w)}return!0};for(let[v,z]of[[g,f.standard],[y,f.custom]]){if(!await C(v))return s();let K=this.linkWhatStoodIn(z,p.standsFor,r);if(w+=z.length-K.length,!await C(K))return s()}return s()}for(;c<n;){if(await this.checkPause()){r.notSent=n-c;break}let{rows:u,advance:p,next:g,last:y}=await this.readPage(e,c,d);if(r.apiCallsUsed++,p===0)break;d=g;let f=this.leaveToThePlatform(e,u,t);if(this.deps.anonymizer.anonymize(f,o,e),await this.neutralizeContactPoints(e,f),await this.writeBatch(e,f,t,r),c+=p,a(c),y)break}return s()}async neutralizeContactPoints(e,t){let{contactPoints:o}=this,n=this.deps.describeFields;if(!o||!n||t.length===0)return;let r=await n(e).catch(()=>{});if(!r)return;let s=o.forObject(e,r);if(s)for(let i of t)s(i)}reportContactPoints(e){this.contactPoints&&(e.contactPoints=this.contactPoints.report())}async readPage(e,t,o){let n=this.parentIds.get(e);if(n&&this.deps.queryByIds){let i=n.slice(t,t+Math.min(this.batchSize,ke));return i.length===0?{rows:[],advance:0,next:o,last:!0}:{rows:await this.deps.queryByIds(e,i),advance:i.length,next:o,last:!1}}let r=await this.deps.query(e,o,this.batchSize),s=r.at(-1)?.Id;return{rows:r,advance:r.length,next:typeof s=="string"?s:o,last:r.length>0&&typeof s!="string"}}leaveToThePlatform(e,t,o){let n=new Set(o.filter(r=>r.to===e&&(r.required||Qt(r.to,r.fieldApiName))).map(r=>r.fieldApiName));return this.leftToThePlatform.keep(e,t,[...n])}async writeBatch(e,t,o,n){let r=[],s=t,i=this.standardPricebook;if(e===Ae&&i&&(s=t.filter(E=>E.Id!==i.source),n.linked+=t.length-s.length),s=this.holdOnClosedRecordTypes(e,s,n),s=await this.holdBehindRefusedParents(e,s,o,n),s=this.holdBehindCutParents(e,s,n),e===oe&&(s=this.holdEmailsForTheirTask(s)),e===fe&&(s=await this.linkPersonContacts(s,n,r)),s.length===0){this.register(e,r);return}let a=this.deps.remapper.remapRecords(s,o,e);await this.leaveToDefault(e,s,n);let c=await this.creatableFieldsOf(e),d=c?s.map(E=>{let A={};for(let j of Object.keys(E))(j==="Id"||j==="attributes"||c.has(j))&&(A[j]=E[j]);return A}):s;d=this.translateRecordTypes(e,d);let m=new Map;d.forEach((E,A)=>{if(E.RecordTypeId!==void 0)return;let j=s[A]?.RecordTypeId,M=!c||c.has("RecordTypeId");m.set(E,M&&Ft(j)?"masterInSource":"notRead")});for(let E of d)for(let A of Zt(e,E))delete E[A];let u=await this.replaceCurrencies(e,s,d,c);e===ce&&await this.leaveOutForAccountKind(s,d);let p=new Map;d.forEach((E,A)=>{let j=gt(e,E);for(let M of j)delete E[M];j.length>0&&p.set(A,j)});let g=await this.lookupsOwed(e,s,a.unresolved.filter(E=>!p.get(E.index)?.includes(E.fieldApiName)),c),y=this.deps.queryTarget,f=y?E=>(n.apiCallsUsed++,y(E)):void 0;if(e===mn&&f){let E=await En(f,d);for(let[A,j]of E){let M=d[A].Id;typeof M=="string"&&r.push([M,j])}n.linked+=E.size,d=d.filter((A,j)=>!E.has(j))}if(Sn[e]!==void 0&&f){let E=await On(f,e,d);for(let[A,j]of E){let M=d[A].Id;typeof M=="string"&&r.push([M,j])}n.linked+=E.size,await this.giveFlagsBack(e,[...E].map(([A,j])=>[d[A],j]),n),d=d.filter((A,j)=>!E.has(j))}if(e===We&&f){let E=await this.tasksWrittenWithTheirEmail(d,f);for(let[A,j]of E)r.push([A,j]);n.linked+=E.size,d=d.filter(A=>!E.has(String(A.Id)))}if(d.length===0){this.register(e,r);return}let R=await this.startAsDrafts(e,d),w=m.size>0?await this.givenRuleOf(e):void 0,C=await this.insertSendingLocksAgain(e,d,n),v=await this.keyPrefixOf(e),z=hn[e],K=[];if(d.forEach((E,A)=>{let j=typeof E.Id=="string"?E.Id:void 0,M=C[A];if(!M){this.refuse(e,j,n,void 0);return}if(M.success){n.written++;let se=w?m.get(E):void 0;w&&se&&this.countCreatedWithoutRecordType(e,w,se,M.id);let T=u.get(E);this.currencyChanges.add(e,T),T&&M.id&&this.currencyChangesByWrittenId.set(M.id,T),j&&M.id&&r.push([j,M.id]);let O=R.get(A);O&&M.id&&this.deferredStatuses.push({objectApiName:e,id:M.id,status:O});let D=j?g.get(j):void 0;for(let S of M.id?D??[]:[])this.owedLookups.push({objectApiName:e,recordId:M.id,fieldApiName:S.fieldApiName,sourceId:S.sourceId,parents:S.parents});return}let te=Hn(M,v);if(te.kind==="linked"){n.linked++,j&&r.push([j,te.id]);return}if(te.kind==="unidentified"&&z&&f){K.push({payload:E,sourceId:j,outcome:M});return}this.refuse(e,j,n,M)}),z&&f&&K.length>0){let E=await Pn(f,e,z,K.map(A=>A.payload));K.forEach((A,j)=>{let M=E[j];if(M&&A.sourceId){n.linked++,r.push([A.sourceId,M]);return}this.refuse(e,A.sourceId,n,A.outcome)})}this.register(e,r)}async insertSendingLocksAgain(e,t,o){let n=async i=>(o.apiCallsUsed++,this.deps.insert(e,i)),r=await n(t),s=await oo({outcomes:r.slice(0,t.length),locked:i=>!i.success&&to(i.errors,i.errorDetails),written:i=>i.success,send:i=>Ht((a,c)=>n(c),e,i.map(a=>t[a])),note:qr,wait:async i=>{await this.wait(i),await this.checkPause()},stopped:()=>this.stopped()});return s.refused===0?r:(o.sentAgainForALock={rows:o.sentAgainForALock.rows+s.sentAgain,written:o.sentAgainForALock.written+s.written,stillLocked:o.sentAgainForALock.stillLocked+s.stillLocked},ae.info(`[autopilot] ${e}: ${Xe("record(s)",s)??""}`),[...s.outcomes,...r.slice(t.length)])}async giveFlagsBack(e,t,o){let n=this.deps.update;if(!n||t.length===0||!Tn[e])return;let r=await this.deps.describeFieldsFixedAtInsert?.(e).catch(()=>{}),s=await vn(e,t,i=>!r?.has(i),async i=>(o.apiCallsUsed++,n(e,i)),()=>this.stopped());s&&ae.warn("Autopilot linked relations without a flag or an answer their rows carried",{objectApiName:e,note:s})}holdEmailsForTheirTask(e){for(let o of e){let n=o.ActivityId;typeof o.Id=="string"&&typeof n=="string"&&n!==""&&this.taskOfEmail.set(o.Id,n)}if(this.taskTurnOver||!this.planned.has(We))return e;let t=[];for(let o of e)bn(o)?this.emailsAfterTheirTask.push(o):t.push(o);return t}async tasksWrittenWithTheirEmail(e,t){let o=new Map;for(let[i,a]of this.taskOfEmail){let c=this.deps.remapper.getTargetId(oe,i);c&&o.set(a,c)}let n=e.map(i=>String(i.Id)).filter(i=>o.has(i));if(n.length===0)return new Map;let r;try{r=await An(t,[...new Set(n.map(i=>o.get(i)??""))])}catch(i){return ae.warn("Autopilot could not look up the tasks written with its emails",{error:ee(i)}),new Map}let s=new Map;for(let i of n){let a=r.get(o.get(i)??"");a&&s.set(i,a)}return s}async writeEmailsAfterTheirTask(e,t){this.taskTurnOver=!0;let o=this.emailsAfterTheirTask.splice(0,this.emailsAfterTheirTask.length);if(o.length===0)return;let n=wr();for(let d=0;d<o.length;d+=this.batchSize){if(await this.checkPause()){this.emailsHeldAndNotSent+=o.length-d;break}await this.writeBatch(oe,o.slice(d,d+this.batchSize),e,n)}t.totalSuccess+=n.written,t.totalFailure+=n.failed,t.totalLinked=(t.totalLinked??0)+n.linked;let r=t.objectOutcomes??{};t.objectOutcomes=r;let s=r[oe],i=new Re;for(let d of[...s?.refusals??[],...n.refusals.list()])i.addCounted(d);let a=new Map((s?.leftToDefault??[]).map(d=>[d.field,d.count]));for(let[d,m]of n.defaulted)a.set(d,(a.get(d)??0)+m);let c={...s,written:(s?.written??0)+n.written,linked:(s?.linked??0)+n.linked,failed:(s?.failed??0)+n.failed,refusals:i.list(),...a.size>0?{leftToDefault:[...a].map(([d,m])=>({field:d,count:m}))}:{}};r[oe]=c,c.written+c.linked>0&&t.failedObjects.includes(oe)&&(t.failedObjects.splice(t.failedObjects.indexOf(oe),1),delete t.nodeErrors?.[oe],t.completedObjects.push(oe)),this.emit("node-completed",this.makeEvent({type:"node-completed",timestamp:"",objectApiName:oe,successCount:c.written,failureCount:c.failed,linkedCount:c.linked,refusals:c.refusals,elapsedMs:0,apiCallsUsed:n.apiCallsUsed}))}async leaveToDefault(e,t,o){let n=await this.lookupsOf(e);if(!n)return;let r=In(n.filter(i=>i.name!=="RecordTypeId"),i=>!this.planned.has(i));if(r.size===0)return;let s=await this.creatableFieldsOf(e);for(let i of t)for(let a of r){let c=i[a];c!=null&&c!==""&&(!s||s.has(a))&&o.defaulted.set(a,(o.defaulted.get(a)??0)+1),delete i[a]}}async replaceCurrencies(e,t,o,n){let r=new Map,{querySource:s,queryTarget:i}=this.deps;if(!s||!i)return r;let a=!n||n.has(he);if(!a&&this.currencyChangesByWrittenId.size===0)return r;let c=p=>typeof p?.[he]=="string"&&p[he]!=="";if(!(a?o.some(c):t.some(c)))return r;this.currencies??=Me(s,i,{source:this.deps.toolingSource,target:this.deps.toolingTarget});let d=await this.currencies;if(!d)return r;let m=await this.deps.describeCurrencyFields?.(e).catch(()=>{})??new Map,u=a?[]:(await this.lookupsOf(e)??[]).map(p=>p.name);return o.forEach((p,g)=>{let y=t[g],f=y?.[he],R=a?Ln(p,{read:f,currencyFields:m,ratesOn:Fn(e,y)},d):$n(p,{read:f,parent:y?Dn(e,y,u,w=>this.currencyChangesByWrittenId.get(w)):void 0,currencyFields:m},d);R&&r.set(p,R)}),r}async pricesInOneCurrencyEach(e,t){let o={rows:e,standsFor:new Map,said:[]},{querySource:n,queryTarget:r}=this.deps;if(!n||!r)return o;let s=d=>typeof d[he]=="string"&&d[he]!=="";if(!e.some(s))return o;this.currencies??=Me(n,r,{source:this.deps.toolingSource,target:this.deps.toolingTarget});let i=await this.currencies;if(!i)return o;let{target:a}=i,c=zo({prices:e,standardBookId:t,sellingModels:e.some(d=>typeof d[Ee]=="string"),writtenIn:d=>a.active.has(d)?d:Nn(void 0,a)?.to,active:a.active},[]);return{rows:c.rows,standsFor:c.standsFor,said:c.said}}linkWhatStoodIn(e,t,o){let n=Oe,r=[],s=[];for(let i of e){let a=String(i.Id),c=t.get(a),d=c===void 0?void 0:this.deps.remapper.getTargetId(n,c);if(d===void 0){s.push(i);continue}r.push([a,d]),o.linked++}return this.register(n,r),s}pricesSettledOf(e){let t=this.pricesSettled.get(e)??[];return t.length>0?{pricesSettled:t}:{}}currenciesReplacedOf(e){let t=this.currencyChanges.list().filter(o=>o.objectApiName===e);return t.length>0?{currenciesReplaced:t}:{}}translateRecordTypes(e,t){let o=this.recordTypeMappings;return!o||!t.some(n=>typeof n.RecordTypeId=="string")?t.map(Fo):new jt().apply(t,o,n=>{this.unmappedRecordTypes.has(n)||(this.unmappedRecordTypes.add(n),jo(e,n,"autopilot"))})}async lookupsOwed(e,t,o,n){let r=new Map;if(!this.deps.update||o.length===0)return r;let s=await this.lookupsOf(e);for(let i of o){if(n&&!n.has(i.fieldApiName))continue;let a=s?.find(d=>d.name===i.fieldApiName);if(a&&!a.updateable)continue;let c=t[i.index]?.Id;typeof c=="string"&&r.set(c,[...r.get(c)??[],i])}return r}refuse(e,t,o,n){o.failed++;let r=Kt(n);o.errors.push(n?.errors[0]??Wr(r[0])),o.refusals.add(r),t&&this.refusedRecords.set(de(t),e)}async holdBehindRefusedParents(e,t,o,n){if(this.refusedRecords.size===0&&this.notWritten.size===0&&this.skippedObjects.size===0)return t;let r=o.filter(a=>a.to===e);if(r.length===0)return t;let s=new Map;for(let a of r)s.set(a.fieldApiName,(s.get(a.fieldApiName)??0)+1);let i=[];for(let a of t){let c=gt(e,a),d;for(let y of r){let f=a[y.fieldApiName];if(typeof f!="string"||f===""||c.includes(y.fieldApiName)||this.deps.remapper.getTargetId(y.from,f)!==void 0)continue;let R=this.refusedRecords.get(de(f))===y.from,w=this.notWrittenOf(y.from);if(!R&&w===void 0)continue;let C=s.get(y.fieldApiName)??0;if(!R&&!await this.namesARecordOf(e,y,f,C))continue;let{from:v,fieldApiName:z}=y;d=R||w===void 0?{edge:y,statusCode:hr,message:`the ${v} record its ${z} names was refused in this run, and written without it this record would stand without its ${v}.`}:{edge:y,statusCode:gr,message:`the ${v} record its ${z} names was not written: ${yr[w](v)}, and written without it this record would stand without its ${v}.`};break}if(!d){i.push(a);continue}let{statusCode:m,message:u,edge:p}=d;n.failed++,n.errors.push(`${m}: ${u}`),n.refusals.add([{statusCode:m,message:u,fields:[p.fieldApiName]}]);let g=a.Id;typeof g=="string"&&g!==""&&this.refusedRecords.set(de(g),e)}return i}holdBehindCutParents(e,t,o){let n=this.fit,r=n?.holds.get(e);return!n||!r?t:t.filter(s=>{if(!r.some(c=>{let d=s[c.field];if(typeof d!="string"||d==="")return!1;let{prefix:m}=c;if(m!==void 0&&(m===null||!d.startsWith(m))||this.deps.remapper.getTargetId(c.parent,d)!==void 0)return!1;let u=de(d);return n.stayedOut.has(u)||n.kept.get(c.parent)?.has(u)!==!0}))return!0;o.cutSinceFit++;let a=s.Id;return typeof a=="string"&&a!==""&&n.stayedOut.set(de(a),e),!1})}notWrittenOf(e){if(!this.planned.has(e))return;let t=this.notWritten.get(e);return t||(this.skippedObjects.has(e)&&!this.reached.has(e)?"skipped":void 0)}async namesARecordOf(e,t,o,n){let r=(await this.lookupsOf(e))?.find(s=>s.name===t.fieldApiName);if(r?.referenceTo.length===1)return r.referenceTo[0]===t.from;if(r&&r.referenceTo.length>1){let s=await this.keyPrefixOf(t.from);return typeof s=="string"&&s!==""&&o.startsWith(s)}return n===1}async linkPersonContacts(e,t,o){let n=e.filter(Pe),r=this.deps.queryTarget;if(n.length===0||!r)return e;let s=await this.lookupsOf(ce);if(s&&!s.some(u=>u.name===yt))return e;let i=new Map;for(let u of n){let p=u.AccountId,g=typeof p=="string"&&p!==""?this.deps.remapper.getTargetId(ce,p):void 0;g&&i.set(u,g)}let a=new Map,c;if(i.size>0)try{t.apiCallsUsed++,a=await Rn(r,[...new Set(i.values())])}catch(u){c=ee(u)}let d=(u,p,g)=>{t.failed++,t.errors.push(`${p}: ${g}`),t.refusals.add([{statusCode:p,message:g,fields:["AccountId"]}]);let y=u.Id;typeof y=="string"&&y!==""&&this.refusedRecords.set(de(y),fe)},m=[];for(let u of e){if(!Pe(u)){m.push(u);continue}let p=i.get(u);if(p===void 0){d(u,$r,"the person account this contact belongs to is not in the target: the platform writes the contact with the account, and sent on its own it would stand as a contact of no account.");continue}if(c!==void 0){d(u,Br,`the contact the platform wrote with its person account could not be looked up (${c}): sent, this one would stand beside it as a second contact.`);continue}let g=a.get(p),y=u.Id;if(g===void 0||typeof y!="string"){m.push(u);continue}o.push([y,g]),t.linked++,this.personContactsLinked++}return m}async leaveOutForAccountKind(e,t){let n=e.some(Pe)?await this.takenAsBusiness(t):()=>!1,r=e.map((s,i)=>kn(s,n(t[i])));t.forEach((s,i)=>{for(let a of Object.keys(s))tn(ce,a,r[i])&&delete s[a]})}async takenAsBusiness(e){let t=await this.lookupsOf(ce);if(t&&!t.some(a=>a.name===yt))return()=>!0;let o=this.deps.queryTarget;if(!o)return()=>!1;this.personTypes??=o(_r).then(a=>new Set(a.flatMap(c=>typeof c.Id=="string"?[de(c.Id)]:[])),()=>{});let n=await this.personTypes;if(!n)return()=>!1;let r=await this.deps.describeRecordTypes?.(ce).catch(()=>{}),s=new Set((r??[]).map(a=>de(a.recordTypeId))),i=e.some(a=>typeof a.RecordTypeId!="string")?qo(r):void 0;return a=>{let c=a.RecordTypeId,d=typeof c=="string"&&c!==""?c:i;if(d===void 0)return!1;let m=de(d);return!n.has(m)&&s.has(m)}}register(e,t){t.length>0&&this.deps.remapper.registerMappings(e,t)}async startAsDrafts(e,t){let o=new Map,n=Ce[e],{queryTarget:r,update:s}=this.deps;if(!n||!r||!s)return o;let i=this.lifecycleByObject.get(e);i||(i=Cn(r,n),this.lifecycleByObject.set(e,i));let a=await i;return a&&t.forEach((c,d)=>{let m=Mn(c.Status,a);m&&(o.set(d,String(c.Status)),c.Status=m)}),o}async applyDeferredStatuses(){let e={},{update:t}=this.deps;if(!t||this.deferredStatuses.length===0)return e;let o=new Map;for(let n of this.deferredStatuses)o.set(n.objectApiName,[...o.get(n.objectApiName)??[],n]);for(let[n,r]of o){let s=0,i=0,a=new Re;for(let c=0;c<r.length;c+=this.batchSize){if(await this.checkPause()){this.noteLeftByStop(n,"statuses",r.slice(c).map(u=>u.id));break}let d=r.slice(c,c+this.batchSize),m=await Ht(t,n,d.map(u=>({Id:u.id,Status:u.status})));d.forEach((u,p)=>{let g=m[p];if(g?.success){s++;return}i++,a.add(Kt(g))})}e[n]={applied:s,refusals:a.list(),...i>0?{leftDraft:i}:{}}}return this.deferredStatuses.length=0,e}noteLeftByStop(e,t,o){if(o.length===0)return;let n=this.leftByStop.get(e);n||(n={lookups:new Set,statuses:new Set},this.leftByStop.set(e,n));for(let r of o)n[t].add(r)}countEmailsTheStopHeld(e,t,o){let n=this.emailsAfterTheirTask.splice(0,this.emailsAfterTheirTask.length),r=this.emailsHeldAndNotSent+n.length;if(this.emailsHeldAndNotSent=0,r===0)return;let s=o[oe]??{written:0,linked:0,failed:0,refusals:[]};o[oe]={...s,notSent:(s.notSent??0)+r,heldForTheirTask:r};for(let d of[e.completedObjects,e.failedObjects]){let m=d.indexOf(oe);m>=0&&d.splice(m,1)}if(t.includes(oe))return;let i=[...this.planned],a=i.indexOf(oe),c=t.findIndex(d=>i.indexOf(d)>a);t.splice(c<0?t.length:c,0,oe)}countWhatTheStopLeft(e,t){let o=new Set(e);for(let r of this.owedLookups.splice(0,this.owedLookups.length))r.parents.some(i=>o.has(i)||this.deps.remapper.getTargetId(i,r.sourceId)!==void 0)?this.noteLeftByStop(r.objectApiName,"lookups",[r.recordId]):this.owedLookups.push(r);let n=this.deferredStatuses.splice(0,this.deferredStatuses.length);for(let r of n)this.noteLeftByStop(r.objectApiName,"statuses",[r.id]);for(let[r,s]of this.leftByStop){let i=t[r]??{written:0,linked:0,failed:0,refusals:[]};t[r]={...i,...s.lookups.size>0?{lookupsLeftEmpty:s.lookups.size}:{},...s.statuses.size>0?{statusesNotGivenBack:s.statuses.size}:{}}}}pause(){this.paused||(this.paused=!0,this.pausePromise=new Promise(e=>{this.pauseResolve=e}),this.emit("paused",this.makeEvent({type:"paused",timestamp:""})))}resume(){this.paused&&(this.paused=!1,this.pauseResolve?.(),this.pausePromise=null,this.pauseResolve=null,this.emit("resumed",this.makeEvent({type:"resumed",timestamp:""})))}skip(e){this.skippedObjects.add(e)}stopped(){return this.signal?.aborted===!0}wait(e){return this.deps.wait?this.deps.wait(e):no(e,this.signal)}async checkPause(){return this.stopped()?!0:(this.paused&&this.pausePromise&&await this.pausePromise,this.stopped())}makeEvent(e){return{...e,timestamp:new Date().toISOString()}}};async function Ht(l,e,t){try{return await l(e,t)}catch(o){let n=ee(o);return t.map(()=>({id:"",success:!1,errors:[n],errorDetails:[Rt(n)]}))}}function Kt(l){return l?l.errorDetails&&l.errorDetails.length>0?l.errorDetails:l.errors.length>0?l.errors.map(e=>Rt(e)):[Dr]:[Lr]}function Wr(l){return l.statusCode===Ye?l.message:`${l.statusCode}: ${l.message}`}var it=class{threshold;partitionSize;constructor(e=5e3,t=2e3){this.threshold=e,this.partitionSize=t}shouldUseGrappe(e){return e>this.threshold}partition(e,t){if(t<=this.partitionSize)return[{id:`${e}-0`,objectApiName:e,offset:0,limit:t,recordCount:t}];let o=[],n=0,r=0;for(;n<t;){let s=Math.min(this.partitionSize,t-n);o.push({id:`${e}-${r}`,objectApiName:e,offset:n,limit:s,recordCount:s}),n+=s,r++}return o}getThreshold(){return this.threshold}getPartitionSize(){return this.partitionSize}};var Hr=`sandforge autopilot \u2014 run an Autopilot copy between two orgs, without the editor.
|
package/lib/sandforge-backup.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{a as ae}from"./chunk-
|
|
7
|
+
import{a as ae}from"./chunk-4V3QO7HF.mjs";import{a as N,b as ne,c as ie}from"./chunk-5GBO4KD5.mjs";import"./chunk-LYOGCIYD.mjs";import"./chunk-P6WRYJN3.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-X4HZD5U2.mjs";import{a as H}from"./chunk-BNKT3R3F.mjs";import{a as v}from"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import{a as I}from"./chunk-SCKUIE3R.mjs";import{c as _}from"./chunk-6FARZYMJ.mjs";import{a as de}from"./chunk-WAYQLQAD.mjs";import{m as M,p as J}from"./chunk-FKCIGJOI.mjs";import"./chunk-C6RKM4BB.mjs";import"./chunk-IHGYJZZ2.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import{a as K,c as V,d as X,e as C,f as Y,g as R,h as q,i as ee,j as te,k as se,l as oe,m as re}from"./chunk-HVX2AFYW.mjs";import{Fc as B,Oc as W}from"./chunk-AXFD2OH6.mjs";import{h as F,i as G}from"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-O7GCCRPW.mjs";import"./chunk-4X5D3MSV.mjs";import"./chunk-BOGNK4LV.mjs";import{m as Q}from"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import{h as U}from"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import{b as E}from"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import{b as T,e as L,f as O,h as Z}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import{e as z,g as P}from"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import{Wc as D,x as S}from"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";import{join as ue}from"node:path";var ge=`sandforge backup \u2014 take and restore DataOps snapshots, without the editor.
|
|
8
8
|
|
|
9
9
|
Usage:
|
|
10
10
|
npx sandforge backup --org <alias> [options]
|
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{A as D,B as E,C as F,D as G,a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v,t as w,u as x,v as y,w as z,x as A,y as B,z as C}from"./chunk-
|
|
7
|
+
import{A as D,B as E,C as F,D as G,a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v,t as w,u as x,v as y,w as z,x as A,y as B,z as C}from"./chunk-DNQKVCUV.mjs";import"./chunk-2ADSD5WK.mjs";import"./chunk-3OVTKRS4.mjs";import"./chunk-BH76USTQ.mjs";import{b as a,c as b,d as c}from"./chunk-XKFHTBAB.mjs";import"./chunk-FYWNSMOZ.mjs";import"./chunk-WBELLGNE.mjs";import"./chunk-OS5GE52G.mjs";import"./chunk-W3BQGMTR.mjs";import"./chunk-7DPHZWA4.mjs";import"./chunk-DIGUC7S4.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-J3TIHLWG.mjs";import"./chunk-4V3QO7HF.mjs";import"./chunk-ETNQHIDI.mjs";import"./chunk-QFTF2PGS.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-7V2UYZ6S.mjs";import"./chunk-BPHTA6KP.mjs";import"./chunk-U2CTKIPE.mjs";import"./chunk-ZRUDYB7O.mjs";import"./chunk-I3ZO76LL.mjs";import"./chunk-2K5BYZQM.mjs";import"./chunk-CQAFVEKP.mjs";import"./chunk-PDRXM5WN.mjs";import"./chunk-JBWJ6UEZ.mjs";import"./chunk-NDFFIJL5.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-L4MSL4U7.mjs";import"./chunk-I5C4O3VA.mjs";import"./chunk-RVCPQVKM.mjs";import"./chunk-CTPLYUXA.mjs";import"./chunk-D7XUNWWU.mjs";import"./chunk-AHUGG3WU.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-OO24ZYYJ.mjs";import"./chunk-ALBY5SOH.mjs";import"./chunk-6YC2ELCU.mjs";import"./chunk-XCJUNX63.mjs";import"./chunk-WZN36ACK.mjs";import"./chunk-GEEWPTV5.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-TW3N6W5Z.mjs";import"./chunk-LYOGCIYD.mjs";import"./chunk-P6WRYJN3.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-X4HZD5U2.mjs";import"./chunk-BNKT3R3F.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-WAYQLQAD.mjs";import"./chunk-FKCIGJOI.mjs";import"./chunk-C6RKM4BB.mjs";import"./chunk-IHGYJZZ2.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import"./chunk-HVX2AFYW.mjs";import"./chunk-AXFD2OH6.mjs";import"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-O7GCCRPW.mjs";import"./chunk-4X5D3MSV.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{z as acceptanceRefusal,f as checkpointsOf,d as defaultName,y as heldObjectsOrStop,h as invalidRefusal,w as keepsOutside,x as keptLines,q as linkWritesOf,k as listEntryJson,j as listLines,F as main,r as orgDiffers,e as parseArgs,u as previewExitCode,t as previewJson,s as previewLines,a as previewTotals,i as replayCommandFor,p as requestsLine,g as resolveCheckpoint,E as resultExitCode,D as resultJson,B as rewindLines,A as rewindQuestion,c as rewindStepsOf,l as scopeJson,n as scopeLines,b as selectionDiff,v as selectionLines,o as takeLines,m as takeRefusalWords,G as undoLine,C as undoLines};
|
|
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{b as k}from"./chunk-
|
|
7
|
+
import{b as k}from"./chunk-ETNQHIDI.mjs";import{a as Z,b as Q,c as K,d as V}from"./chunk-5GBO4KD5.mjs";import{c as I,e as Y}from"./chunk-6FARZYMJ.mjs";import{h as U,i as H,j as B}from"./chunk-O7GCCRPW.mjs";import"./chunk-4X5D3MSV.mjs";import"./chunk-BOGNK4LV.mjs";import{j as W}from"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import{b as L,c as P}from"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import{a as D,b as M}from"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import{Aa as J,ia as z}from"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import{b as v,c as N,f as q,h as X}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import{a as F}from"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import{a as j,h as R}from"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var te=/^[A-Za-z0-9]{15}([A-Za-z0-9]{3})?$/,re=/^\d{4}-\d{2}-\d{2}$/,se=["CaseComment","EmailMessage","Asset","Contract","Case","Contact","Account"],ne=`sandforge cleanup \u2014 Bulk delete records you created on a sandbox in the
|
|
8
8
|
--since window, whether or not a clone wrote them. Preview with --dry-run and
|
|
9
9
|
narrow with --objects before deleting.
|
|
10
10
|
|
package/lib/sandforge-clone.mjs
CHANGED
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{$ as M,$a as Ma,$b as Mb,A as l,Aa as la,Ab as lb,B as m,Ba as ma,Bb as mb,C as n,Ca as na,Cb as nb,D as o,Da as oa,Db as ob,E as p,Ea as pa,Eb as pb,F as q,Fa as qa,Fb as qb,G as r,Ga as ra,Gb as rb,H as s,Ha as sa,Hb as sb,I as t,Ia as ta,Ib as tb,J as u,Ja as ua,Jb as ub,K as v,Ka as va,Kb as vb,L as w,La as wa,Lb as wb,M as x,Ma as xa,Mb as xb,N as y,Na as ya,Nb as yb,O as z,Oa as za,Ob as zb,P as A,Pa as Aa,Pb as Ab,Q as B,Qa as Ba,Qb as Bb,R as C,Ra as Ca,Rb as Cb,S as D,Sa as Da,Sb as Db,T as E,Ta as Ea,Tb as Eb,U as F,Ua as Fa,Ub as Fb,V as G,Va as Ga,Vb as Gb,W as H,Wa as Ha,Wb as Hb,X as I,Xa as Ia,Xb as Ib,Y as J,Ya as Ja,Yb as Jb,Z as K,Za as Ka,Zb as Kb,_ as L,_a as La,_b as Lb,aa as N,ab as Na,ac as Nb,ba as O,bb as Oa,bc as Ob,ca as P,cb as Pa,cc as Pb,da as Q,db as Qa,dc as Qb,ea as R,eb as Ra,ec as Rb,fa as S,fb as Sa,fc as Sb,ga as T,gb as Ta,ha as U,hb as Ua,ia as V,ib as Va,ja as W,jb as Wa,ka as X,kb as Xa,la as Y,lb as Ya,ma as Z,mb as Za,na as _,nb as _a,oa as $,ob as $a,pa as aa,pb as ab,q as b,qa as ba,qb as bb,r as c,ra as ca,rb as cb,s as d,sa as da,sb as db,t as e,ta as ea,tb as eb,u as f,ua as fa,ub as fb,v as g,va as ga,vb as gb,w as h,wa as ha,wb as hb,x as i,xa as ia,xb as ib,y as j,ya as ja,yb as jb,z as k,za as ka,zb as kb}from"./chunk-
|
|
7
|
+
import{$ as M,$a as Ma,$b as Mb,A as l,Aa as la,Ab as lb,B as m,Ba as ma,Bb as mb,C as n,Ca as na,Cb as nb,D as o,Da as oa,Db as ob,E as p,Ea as pa,Eb as pb,F as q,Fa as qa,Fb as qb,G as r,Ga as ra,Gb as rb,H as s,Ha as sa,Hb as sb,I as t,Ia as ta,Ib as tb,J as u,Ja as ua,Jb as ub,K as v,Ka as va,Kb as vb,L as w,La as wa,Lb as wb,M as x,Ma as xa,Mb as xb,N as y,Na as ya,Nb as yb,O as z,Oa as za,Ob as zb,P as A,Pa as Aa,Pb as Ab,Q as B,Qa as Ba,Qb as Bb,R as C,Ra as Ca,Rb as Cb,S as D,Sa as Da,Sb as Db,T as E,Ta as Ea,Tb as Eb,U as F,Ua as Fa,Ub as Fb,V as G,Va as Ga,Vb as Gb,W as H,Wa as Ha,Wb as Hb,X as I,Xa as Ia,Xb as Ib,Y as J,Ya as Ja,Yb as Jb,Z as K,Za as Ka,Zb as Kb,_ as L,_a as La,_b as Lb,aa as N,ab as Na,ac as Nb,ba as O,bb as Oa,bc as Ob,ca as P,cb as Pa,cc as Pb,da as Q,db as Qa,dc as Qb,ea as R,eb as Ra,ec as Rb,fa as S,fb as Sa,fc as Sb,ga as T,gb as Ta,ha as U,hb as Ua,ia as V,ib as Va,ja as W,jb as Wa,ka as X,kb as Xa,la as Y,lb as Ya,ma as Z,mb as Za,na as _,nb as _a,oa as $,ob as $a,pa as aa,pb as ab,q as b,qa as ba,qb as bb,r as c,ra as ca,rb as cb,s as d,sa as da,sb as db,t as e,ta as ea,tb as eb,u as f,ua as fa,ub as fb,v as g,va as ga,vb as gb,w as h,wa as ha,wb as hb,x as i,xa as ia,xb as ib,y as j,ya as ja,yb as jb,z as k,za as ka,zb as kb}from"./chunk-LYOGCIYD.mjs";import"./chunk-P6WRYJN3.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-X4HZD5U2.mjs";import{a}from"./chunk-BNKT3R3F.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{Db as CLONE_PREVIEW_UNREAD,L as FIELD_EXCLUSION_UNMATCHED,Mb as ROOT_NEVER_CREATED,ib as SWEEP_CLASS_FLAGS,Nb as TABLE_NEVER_CLONED,E as adaptDescribe,b as apiRequestsLine,C as auditDepsOf,db as automationHeldLines,V as choicesLines,z as cliRunSetup,hb as cliSweepInput,ga as cloneApiRequestsJson,n as cloneInputLine,m as cloneInputOf,Eb as clonePreviewJson,Fb as clonePreviewLines,o as cloneSubjectOf,pb as commandSweepTies,X as contactPointLines,Gb as datedFromItsJournal,W as decisionLines,H as describeObjectInfo,G as describeOnce,fa as discoveryRequestsLine,_ as dryRunAdminChanges,Ab as earlierOfTheRun,Sb as endOfAThrow,Ca as executeOptions,I as failedOutright,qa as fewerRootsOf,na as fewerRootsWords,M as fieldExclusionUnmatchedWords,N as fieldExclusionsUnmatchedLines,P as fieldExclusionsUnmatchedOf,O as fieldExclusionsUnmatchedRefusal,D as fieldInfosOf,K as fileLines,ka as fitKeyWords,za as graphCounts,ca as graphLine,Kb as interruptedLine,a as journalDirOf,Sa as journalGoneWords,wb as journalPartsOf,$ as jsonResult,Ba as listedObjects,F as loadRecordTypes,Qb as lostJobsBeforeTheMute,Rb as main,$a as maxTotalRefusal,j as missingFlagsWords,Y as neutralizedUpsertKeys,g as neverClonedTableRefusal,Aa as notCountedObjectsOf,aa as objectOutcomeLine,ba as objectOutcomePrinter,Q as orphanParentsCappedLine,fb as otherPartIdsOf,xb as otherPartsOf,gb as otherPartsSweepLines,ob as otherRunsOf,v as parseArgs,Na as parseRemoveArgs,Ta as parseRunSummary,Hb as parseVerifyArgs,vb as partsLeft,Wa as partsLeftLines,la as personAccountsAsBusinessLine,Ya as platformCopiesWords,Ka as productionRefusal,c as queryRootOf,Xa as quoteCopiesLines,s as readChoicesFile,sb as readEarlierRemovals,J as recordTypeGivenLines,Ma as rehearsalLines,La as rehearsalPlanLines,_a as removalLines,Ua as removalPlan,Va as removalPlanLines,tb as removalsAfter,zb as removalsOfParts,qb as removalsPath,Cb as removeMain,B as resumeChangedWords,A as resumeRefusal,y as resumedJournalPath,Ob as rootNeverCreatedRefusal,u as rootsArgsOf,S as rootsAskedJson,Ea as rootsChosenFirst,T as rootsLines,oa as rootsMaxTotalRefusal,Da as rootsOptionsOf,pa as rootsStorageRefusal,ub as runInPartsOf,rb as runKey,Pa as runMuteSchema,yb as runRemovalsAfter,Ra as runSummaryOfFile,Qa as runUserIdOf,t as sampleArgsOf,ra as sampleBudgetOf,ta as sampleJson,sa as sampleLines,wa as sampleReadsLine,ya as sampleRefusalExit,ua as sampleResultJson,va as sampleResultLines,xa as samplingProgressPrinter,U as simulationGapLines,R as summaryLines,jb as sweepClassArgsOf,kb as sweepClassOptions,eb as sweepLines,bb as sweepListingLines,ab as sweepOptionWords,mb as sweepOrgOf,lb as sweepPartsOptions,cb as sweepUnsaid,Oa as sweepUserHint,nb as syncRunSpanOf,l as tablesExecuteOptions,e as tablesLeftOut,f as tablesNotReached,h as tablesNotReachedWords,d as tablesQueryOf,k as tablesRunConfig,Ha as targetAutomationReader,Ia as targetGapReader,i as templateWithoutInputWords,Za as tookAlongLines,Ja as typeOrg,w as uncertainRefusal,x as uncertainRetryAt,Z as upsertKeyLines,Ib as verificationLines,Jb as verifyMain,ea as wholeOrgGateLines,da as wholeOrgGraphLine,r as wholeOrgGraphOf,ma as wholeOrgMaxTotalRefusal,q as wholeOrgOptions,ha as wholeOrgQuestion,ia as wholeOrgQuestionWords,ja as wholeOrgRefusalWords,p as wholeOrgRunConfig,Lb as wholeOrgSweepLine,Pb as wholeOrgWriteDeps,Ga as withTemplateFields,Fa as withTheJournal,Bb as writeWhole};
|
|
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{q as A}from"./chunk-
|
|
7
|
+
import{q as A}from"./chunk-QFTF2PGS.mjs";import"./chunk-BXZ73A5M.mjs";import"./chunk-7V2UYZ6S.mjs";import"./chunk-BPHTA6KP.mjs";import"./chunk-U2CTKIPE.mjs";import"./chunk-ZRUDYB7O.mjs";import"./chunk-I3ZO76LL.mjs";import"./chunk-2K5BYZQM.mjs";import"./chunk-CQAFVEKP.mjs";import"./chunk-PDRXM5WN.mjs";import"./chunk-JBWJ6UEZ.mjs";import"./chunk-NDFFIJL5.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-L4MSL4U7.mjs";import"./chunk-I5C4O3VA.mjs";import"./chunk-RVCPQVKM.mjs";import"./chunk-CTPLYUXA.mjs";import"./chunk-D7XUNWWU.mjs";import"./chunk-AHUGG3WU.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-OO24ZYYJ.mjs";import"./chunk-ALBY5SOH.mjs";import"./chunk-6YC2ELCU.mjs";import"./chunk-XCJUNX63.mjs";import"./chunk-WZN36ACK.mjs";import"./chunk-GEEWPTV5.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-WAYQLQAD.mjs";import"./chunk-FKCIGJOI.mjs";import"./chunk-C6RKM4BB.mjs";import"./chunk-IHGYJZZ2.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import{b as C,c as E}from"./chunk-HVX2AFYW.mjs";import"./chunk-AXFD2OH6.mjs";import"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-O7GCCRPW.mjs";import"./chunk-4X5D3MSV.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import{b as O,f as R,h as b}from"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import{hc as h,ic as $,jc as T,kc as v}from"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";var L=`sandforge compare \u2014 compare two orgs the way the Compare page does, without the editor.
|
|
8
8
|
|
|
9
9
|
Usage:
|
|
10
10
|
npx sandforge compare --source <alias> --target <alias> [options]
|
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-
|
|
7
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-JIPT5FUD.mjs";import"./chunk-TW3N6W5Z.mjs";import"./chunk-5GBO4KD5.mjs";import"./chunk-LYOGCIYD.mjs";import"./chunk-P6WRYJN3.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-X4HZD5U2.mjs";import"./chunk-BNKT3R3F.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-6FARZYMJ.mjs";import"./chunk-WAYQLQAD.mjs";import"./chunk-FKCIGJOI.mjs";import"./chunk-C6RKM4BB.mjs";import"./chunk-IHGYJZZ2.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-WB2RIVO3.mjs";import"./chunk-HVX2AFYW.mjs";import"./chunk-AXFD2OH6.mjs";import"./chunk-X2XZQ434.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-O7GCCRPW.mjs";import"./chunk-4X5D3MSV.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-5OGNK3JP.mjs";import"./chunk-QLRWU3MB.mjs";import"./chunk-XMQ5R6TC.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-TEIBWMJM.mjs";import"./chunk-BWWQXU2B.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-HQZUQXDC.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-SX6QWYCQ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-7WSQ65WG.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-7ZBDACVG.mjs";import"./chunk-OUU47Y7A.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-ZXOUWHYE.mjs";import"./chunk-LCDPCUXS.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{j as dryRunLines,m as main,l as maskingInterruptedLine,n as maskingQuestion,b as masksObject,e as missingFieldLine,f as notWritableLine,a as parseArgs,k as restoreInterruptedLine,c as resultLines,g as runWouldBeRefused,i as slicePlanLines,h as sliceRefusedLines,d as sliceSetLines};
|