sandforge 1.85.0 → 1.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/{chunk-THYQOG24.mjs → chunk-22L43JMK.mjs} +1 -1
- package/lib/{chunk-U4S27YRP.mjs → chunk-2LSGWTWX.mjs} +1 -1
- package/lib/{chunk-MRN72UEO.mjs → chunk-2YJJTQNC.mjs} +1 -1
- package/lib/chunk-34SMB5PA.mjs +10 -0
- package/lib/chunk-35B73566.mjs +7 -0
- package/lib/{chunk-YZKE6D3K.mjs → chunk-35IJ4WEU.mjs} +1 -1
- package/lib/chunk-3EHPAFKV.mjs +7 -0
- package/lib/{chunk-3OKDWZ32.mjs → chunk-3HAVVEXF.mjs} +1 -1
- package/lib/{chunk-32ZB5ICW.mjs → chunk-3I6FXFCN.mjs} +1 -1
- package/lib/{chunk-JFVY66BS.mjs → chunk-3KJCSYXY.mjs} +1 -1
- package/lib/{chunk-ULEYGOZU.mjs → chunk-3L6DVNCR.mjs} +1 -1
- package/lib/chunk-3LRFPGYZ.mjs +7 -0
- package/lib/{chunk-GHUA6OQQ.mjs → chunk-3MVWGL5A.mjs} +1 -1
- package/lib/{chunk-SF52ZSIV.mjs → chunk-4CSBZZAL.mjs} +1 -1
- package/lib/{chunk-FBYFCKPG.mjs → chunk-4NSXPONF.mjs} +1 -1
- package/lib/{chunk-A3QNSALB.mjs → chunk-4VLP6RHC.mjs} +1 -1
- package/lib/{chunk-TWYNQ2OO.mjs → chunk-4XROG5CT.mjs} +1 -1
- package/lib/chunk-54V4FVEY.mjs +7 -0
- package/lib/chunk-55OJJT2Q.mjs +7 -0
- package/lib/{chunk-JRI6A24G.mjs → chunk-5EHHQ5UX.mjs} +1 -1
- package/lib/{chunk-VPGX5Z5D.mjs → chunk-5JMQXHJ2.mjs} +1 -1
- package/lib/{chunk-CI2O7WBH.mjs → chunk-65AMXOQU.mjs} +1 -1
- package/lib/{chunk-5T3LFDJ5.mjs → chunk-6HHSAPIM.mjs} +1 -1
- package/lib/chunk-6KVBCFVS.mjs +7 -0
- package/lib/chunk-6NG7C2U3.mjs +476 -0
- package/lib/{chunk-F2424IKX.mjs → chunk-6ROL3KBM.mjs} +1 -1
- package/lib/{chunk-7ZYCRIHE.mjs → chunk-72AWCN7U.mjs} +1 -1
- package/lib/{chunk-MQLTEXB7.mjs → chunk-7KHA5UIQ.mjs} +1 -1
- package/lib/chunk-7O6EFNQS.mjs +10 -0
- package/lib/{chunk-73SLYGWD.mjs → chunk-A2CH2QGX.mjs} +1 -1
- package/lib/chunk-A2TXLAC3.mjs +276 -0
- package/lib/chunk-ALWVNR34.mjs +7 -0
- package/lib/{chunk-JBOGAUGH.mjs → chunk-ATBQIE2V.mjs} +1 -1
- package/lib/{chunk-C2MHMI7U.mjs → chunk-ATQML7ZK.mjs} +1 -1
- package/lib/chunk-AVY742BJ.mjs +7 -0
- package/lib/{chunk-VLAU5QQT.mjs → chunk-AXTB2HJS.mjs} +1 -1
- package/lib/chunk-BBZUGKBZ.mjs +10 -0
- package/lib/chunk-BIDXK7KA.mjs +7 -0
- package/lib/{chunk-KYLHS74X.mjs → chunk-BLMJ4WVI.mjs} +1 -1
- package/lib/{chunk-A7YP27GQ.mjs → chunk-BNHJCJJM.mjs} +1 -1
- package/lib/{chunk-ZDMSTL2L.mjs → chunk-BNPQEQXC.mjs} +1 -1
- package/lib/chunk-C5AUNG6T.mjs +37 -0
- package/lib/{chunk-LY6EPMIP.mjs → chunk-C5EQ7GFC.mjs} +1 -1
- package/lib/{chunk-LOO42EW5.mjs → chunk-C7CKDZMC.mjs} +62 -62
- package/lib/{chunk-ZP3WJGS3.mjs → chunk-CB4U22NR.mjs} +1 -1
- package/lib/chunk-CJAWKLAL.mjs +7 -0
- package/lib/chunk-CL75DEMQ.mjs +9 -0
- package/lib/{chunk-7L6FE5PP.mjs → chunk-CLUNF4FK.mjs} +1 -1
- package/lib/chunk-CSMGP53U.mjs +7 -0
- package/lib/{chunk-S6BMJSLD.mjs → chunk-CT324C7I.mjs} +1 -1
- package/lib/{chunk-YXOPKGDX.mjs → chunk-CZXDJXQP.mjs} +1 -1
- package/lib/{chunk-PGG4ULEW.mjs → chunk-D2X6U3MS.mjs} +1 -1
- package/lib/{chunk-FG4Y4ZVL.mjs → chunk-DAUX63UB.mjs} +1 -1
- package/lib/chunk-DB7JNALQ.mjs +10 -0
- package/lib/chunk-DDNCJVZ2.mjs +17 -0
- package/lib/{chunk-YGE4AUXG.mjs → chunk-DLSU66MY.mjs} +1 -1
- package/lib/{chunk-DCJBP3LE.mjs → chunk-DO6PSHQZ.mjs} +1 -1
- package/lib/{chunk-ROTDZKOE.mjs → chunk-DUBECLZV.mjs} +1 -1
- package/lib/{chunk-SES5HPBZ.mjs → chunk-DYHF6DNT.mjs} +1 -1
- package/lib/chunk-E5FSPXYH.mjs +930 -0
- package/lib/{chunk-QAXKUEJT.mjs → chunk-EGL3I3IX.mjs} +1 -1
- package/lib/chunk-EIYMQPMG.mjs +7 -0
- package/lib/{chunk-AX3YF7SC.mjs → chunk-EUIALBMX.mjs} +1 -1
- package/lib/{chunk-57QRXYAZ.mjs → chunk-FI3R5ZOQ.mjs} +1 -1
- package/lib/{chunk-FCZDWGQI.mjs → chunk-FM4QCTO7.mjs} +1 -1
- package/lib/{chunk-74HZ274R.mjs → chunk-FRSIEASH.mjs} +1 -1
- package/lib/{chunk-G6IYOZEH.mjs → chunk-FV6MOSHD.mjs} +1 -1
- package/lib/chunk-FYG47CNA.mjs +7 -0
- package/lib/chunk-GB6W4Q56.mjs +7 -0
- package/lib/chunk-GEV2DCMK.mjs +7 -0
- package/lib/{chunk-NZJXEULY.mjs → chunk-GFB2DNCB.mjs} +1 -1
- package/lib/chunk-GFGMGFSH.mjs +7 -0
- package/lib/{chunk-EFHDE7W4.mjs → chunk-GIFQXB2Q.mjs} +1 -1
- package/lib/{chunk-P6A22FMQ.mjs → chunk-GP5J3DGS.mjs} +1 -1
- package/lib/chunk-GQZEX7LH.mjs +231 -0
- package/lib/{chunk-BRN42U26.mjs → chunk-GYDTM62J.mjs} +1 -1
- package/lib/{chunk-GNCEHAJY.mjs → chunk-GYFIXUJG.mjs} +1 -1
- package/lib/chunk-GZW2GNFK.mjs +7 -0
- package/lib/chunk-H6BHWAX7.mjs +8 -0
- package/lib/{chunk-GUYEXPJ4.mjs → chunk-HDDJ3CVN.mjs} +1 -1
- package/lib/{chunk-3GATEVHC.mjs → chunk-HDWB4ZOG.mjs} +1 -1
- package/lib/chunk-HGVPBJR6.mjs +7 -0
- package/lib/{chunk-55VBV2WK.mjs → chunk-HLROVOR6.mjs} +1 -1
- package/lib/{chunk-HV3TDLFR.mjs → chunk-HUOR4M2L.mjs} +1 -1
- package/lib/chunk-HZCS6EED.mjs +8 -0
- package/lib/{chunk-WZX6VCIT.mjs → chunk-HZUI56KZ.mjs} +1 -1
- package/lib/chunk-IAB5H7WN.mjs +7 -0
- package/lib/{chunk-RY7WUJXH.mjs → chunk-IQ5UKRHU.mjs} +1 -1
- package/lib/{chunk-OUWR5M5G.mjs → chunk-IRQ4WANV.mjs} +1 -1
- package/lib/{chunk-F44EHXLI.mjs → chunk-IT3DGX37.mjs} +1 -1
- package/lib/chunk-J347SPU6.mjs +49 -0
- package/lib/{chunk-IZ2M2RGO.mjs → chunk-JANBNTR5.mjs} +1 -1
- package/lib/chunk-JFXQZPRY.mjs +9 -0
- package/lib/{chunk-VKA5OZBJ.mjs → chunk-JRLYWVF4.mjs} +1 -1
- package/lib/{chunk-FM5ESRH6.mjs → chunk-JSNMUTY6.mjs} +1 -1
- package/lib/chunk-JTNJKSAA.mjs +7 -0
- package/lib/{chunk-4D6OHSX3.mjs → chunk-JV2LAKWQ.mjs} +1 -1
- package/lib/{chunk-BY42YL4D.mjs → chunk-JV7K2ZHK.mjs} +1 -1
- package/lib/{chunk-A6IJUOLB.mjs → chunk-K4TQ7YHX.mjs} +1 -1
- package/lib/chunk-K5PUMHZU.mjs +7 -0
- package/lib/chunk-KH4KLCYG.mjs +7 -0
- package/lib/{chunk-FZF6FB65.mjs → chunk-KQVLZVOP.mjs} +1 -1
- package/lib/chunk-KWUS7UAV.mjs +19 -0
- package/lib/{chunk-2UUSF32M.mjs → chunk-L6G73FXM.mjs} +1 -1
- package/lib/{chunk-LUNGNCM3.mjs → chunk-LG466Q5H.mjs} +1 -1
- package/lib/{chunk-YTBM3TSW.mjs → chunk-LHNAR6FC.mjs} +1 -1
- package/lib/chunk-LT4GHEI2.mjs +7 -0
- package/lib/{chunk-P3OYE2FS.mjs → chunk-MR262Y3B.mjs} +1 -1
- package/lib/{chunk-TSTCHIBU.mjs → chunk-NCCHOV2N.mjs} +1 -1
- package/lib/chunk-NICRSGLS.mjs +7 -0
- package/lib/chunk-NV5QA2HY.mjs +7 -0
- package/lib/{chunk-6HAKOS6W.mjs → chunk-O3GIN5TU.mjs} +1 -1
- package/lib/chunk-O6FHK6NQ.mjs +13 -0
- package/lib/{chunk-OXIIKAUZ.mjs → chunk-O7YIEFG7.mjs} +1 -1
- package/lib/chunk-OCUVAA5E.mjs +7 -0
- package/lib/chunk-OLCS7JCT.mjs +14 -0
- package/lib/chunk-ON7Y63FK.mjs +9 -0
- package/lib/{chunk-K2WOT75I.mjs → chunk-OO2WY3UB.mjs} +1 -1
- package/lib/{chunk-3EOIAC2M.mjs → chunk-OT2NHL2V.mjs} +1 -1
- package/lib/{chunk-BK5SRDAD.mjs → chunk-P2M5ZXWU.mjs} +1 -1
- package/lib/{chunk-DCZYWMSA.mjs → chunk-P4YOHLZ4.mjs} +1 -1
- package/lib/chunk-PBHDPTT6.mjs +343 -0
- package/lib/chunk-PE7CHD2W.mjs +7 -0
- package/lib/{chunk-LU7M5URW.mjs → chunk-PIQ2I67B.mjs} +1 -1
- package/lib/chunk-PKYDNZJK.mjs +7 -0
- package/lib/chunk-PVZ72OOQ.mjs +7 -0
- package/lib/chunk-QACFTHJM.mjs +8 -0
- package/lib/{chunk-LNAZHI3J.mjs → chunk-QGVL5EW3.mjs} +1 -1
- package/lib/chunk-QHE2RUWX.mjs +7 -0
- package/lib/{chunk-4RNP65FV.mjs → chunk-RCW5BZNW.mjs} +1 -1
- package/lib/{chunk-OTKXTBTX.mjs → chunk-RJ6HHG7J.mjs} +1 -1
- package/lib/{chunk-IVDBVWKK.mjs → chunk-RPTEEI4R.mjs} +1 -1
- package/lib/chunk-RQW5S67A.mjs +7 -0
- package/lib/chunk-RTCMYMED.mjs +7 -0
- package/lib/chunk-RWVX7XSD.mjs +7 -0
- package/lib/{chunk-2UUS4IGB.mjs → chunk-RZOINFNL.mjs} +1 -1
- package/lib/chunk-SOOTWGMQ.mjs +7 -0
- package/lib/chunk-STQ2JMIZ.mjs +7 -0
- package/lib/{chunk-RC25QQVF.mjs → chunk-SUIPDW5O.mjs} +1 -1
- package/lib/{chunk-Z354SAEF.mjs → chunk-SZOJ7BEJ.mjs} +1 -1
- package/lib/{chunk-45375WT5.mjs → chunk-T542Z54E.mjs} +1 -1
- package/lib/chunk-TAN2CIRI.mjs +21 -0
- package/lib/{chunk-BGJBYDRW.mjs → chunk-TCNBINOG.mjs} +1 -1
- package/lib/chunk-TFDF3DBN.mjs +7 -0
- package/lib/{chunk-B5A4JHNN.mjs → chunk-TICZXC53.mjs} +1 -1
- package/lib/chunk-TLX45X5U.mjs +7 -0
- package/lib/{chunk-W6SLQZKQ.mjs → chunk-TMIV3IWH.mjs} +1 -1
- package/lib/chunk-TQ6HEJ73.mjs +11 -0
- package/lib/chunk-TTU5EQZ6.mjs +7 -0
- package/lib/chunk-TYUYPFDJ.mjs +7 -0
- package/lib/chunk-TZXYVMZC.mjs +7 -0
- package/lib/{chunk-4N425UJC.mjs → chunk-UCUFLFNK.mjs} +1 -1
- package/lib/chunk-UK3QLBHW.mjs +7 -0
- package/lib/{chunk-SKGAERV4.mjs → chunk-UM2B4GR7.mjs} +1 -1
- package/lib/chunk-UZFTTNOP.mjs +7 -0
- package/lib/chunk-V3AXSKSU.mjs +7 -0
- package/lib/chunk-VA6EEI6X.mjs +21 -0
- package/lib/{chunk-LSEM2BZH.mjs → chunk-VFKG2G37.mjs} +1 -1
- package/lib/chunk-VJNEW5MQ.mjs +7 -0
- package/lib/{chunk-EYFP3NA6.mjs → chunk-VKREON6Q.mjs} +1 -1
- package/lib/{chunk-TIVI2KGB.mjs → chunk-VNNDYPBL.mjs} +1 -1
- package/lib/{chunk-J3FJ3BWE.mjs → chunk-VRBETPHY.mjs} +1 -1
- package/lib/{chunk-UX4AOSMU.mjs → chunk-VT6P3X6R.mjs} +1 -1
- package/lib/{chunk-CUOWQMGW.mjs → chunk-VUTQY76O.mjs} +1 -1
- package/lib/chunk-WF5S4FW5.mjs +7 -0
- package/lib/{chunk-JHJDDQDE.mjs → chunk-WJGK6VGU.mjs} +1 -1
- package/lib/{chunk-IZREPWYQ.mjs → chunk-WJHMB3SL.mjs} +1 -1
- package/lib/{chunk-XZRON54U.mjs → chunk-WQCXOZEJ.mjs} +1 -1
- package/lib/{chunk-N2MXYD67.mjs → chunk-WVVFR4E3.mjs} +1 -1
- package/lib/{chunk-GG5I52UT.mjs → chunk-XBYXT74L.mjs} +1 -1
- package/lib/chunk-XJE3LJHP.mjs +7 -0
- package/lib/{chunk-3QCUSZIZ.mjs → chunk-XV4CVZYD.mjs} +1 -1
- package/lib/chunk-Y37ED7AS.mjs +7 -0
- package/lib/{chunk-MN3XBJPE.mjs → chunk-YGBNZYT4.mjs} +1 -1
- package/lib/{chunk-SBDF4AE5.mjs → chunk-YGTOX7IL.mjs} +1 -1
- package/lib/{chunk-SQM32AOQ.mjs → chunk-YJ27WHKR.mjs} +1 -1
- package/lib/chunk-YRULC27A.mjs +7 -0
- package/lib/{chunk-RMFU4BAL.mjs → chunk-YSVAHT4Q.mjs} +4 -4
- package/lib/chunk-YTOTMJTY.mjs +15 -0
- package/lib/{chunk-SU24AE3H.mjs → chunk-YZKZC62O.mjs} +1 -1
- package/lib/{chunk-LJNRN7MY.mjs → chunk-YZQN7BRB.mjs} +1 -1
- package/lib/{chunk-NMF55UBQ.mjs → chunk-Z5IUK2QO.mjs} +1 -1
- package/lib/{chunk-6ZWY36LK.mjs → chunk-ZEGSMW5A.mjs} +1 -1
- package/lib/{chunk-YV7JYHJP.mjs → chunk-ZIKLQZBG.mjs} +1 -1
- package/lib/chunk-ZVU7MD2S.mjs +7 -0
- package/lib/sandforge-autopilot.mjs +33 -27
- package/lib/sandforge-backup.mjs +19 -19
- 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 +29 -16
- package/lib/sandforge-dataops.mjs +1 -1
- package/lib/sandforge-empty.mjs +11 -13
- package/lib/sandforge-env.mjs +105 -105
- 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 +13 -13
- package/lib/sandforge-seed.mjs +1 -1
- package/lib/sandforge-sync.mjs +1 -1
- package/lib/sandforge-users.mjs +13 -15
- package/lib/sandforge.mjs +1 -1
- package/lib/sf/sandforge/dataops.mjs +2 -2
- package/lib/sfPlugin.mjs +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/lib/chunk-26EGXYZ4.mjs +0 -21
- package/lib/chunk-2JRVBXJL.mjs +0 -7
- package/lib/chunk-2METQHGG.mjs +0 -7
- package/lib/chunk-3XU7CEJQ.mjs +0 -7
- package/lib/chunk-4BQPAVMP.mjs +0 -14
- package/lib/chunk-4KMKOE77.mjs +0 -156
- package/lib/chunk-4RPA7Z52.mjs +0 -7
- package/lib/chunk-5C7LQXYS.mjs +0 -7
- package/lib/chunk-5EESNYE3.mjs +0 -8
- package/lib/chunk-6ZW6BLV5.mjs +0 -7
- package/lib/chunk-AAOMUI7S.mjs +0 -15
- package/lib/chunk-AIUAEBHR.mjs +0 -7
- package/lib/chunk-BD724WOH.mjs +0 -7
- package/lib/chunk-CRPLDXJU.mjs +0 -48
- package/lib/chunk-CSSOLHE3.mjs +0 -7
- package/lib/chunk-D63HEQ3B.mjs +0 -7
- package/lib/chunk-DN7YBILC.mjs +0 -21
- package/lib/chunk-DNE7JI3A.mjs +0 -11
- package/lib/chunk-EFHM2U4D.mjs +0 -7
- package/lib/chunk-EINEGS6E.mjs +0 -7
- package/lib/chunk-EM5EFMHA.mjs +0 -272
- package/lib/chunk-FH5UR35W.mjs +0 -7
- package/lib/chunk-FN7TOBJR.mjs +0 -7
- package/lib/chunk-HGJFATSI.mjs +0 -10
- package/lib/chunk-HOEE3PE5.mjs +0 -7
- package/lib/chunk-HV63UGL5.mjs +0 -7
- package/lib/chunk-JKFCGYJE.mjs +0 -7
- package/lib/chunk-KATBU46O.mjs +0 -7
- package/lib/chunk-LD34JNCC.mjs +0 -7
- package/lib/chunk-LPN4WYTP.mjs +0 -478
- package/lib/chunk-MAOUFJ47.mjs +0 -7
- package/lib/chunk-MB2DG66I.mjs +0 -13
- package/lib/chunk-NCASRA7L.mjs +0 -9
- package/lib/chunk-NEKNAILD.mjs +0 -7
- package/lib/chunk-NN2IO4WE.mjs +0 -7
- package/lib/chunk-O3ZQSWDN.mjs +0 -10
- package/lib/chunk-OFQOKSEW.mjs +0 -7
- package/lib/chunk-PP7PJXRJ.mjs +0 -341
- package/lib/chunk-PT2E2HFD.mjs +0 -7
- package/lib/chunk-PZBZ7MNC.mjs +0 -7
- package/lib/chunk-QBYK5XIT.mjs +0 -8
- package/lib/chunk-RFD6NPWJ.mjs +0 -8
- package/lib/chunk-RIIJJRGF.mjs +0 -7
- package/lib/chunk-RKTFFCNS.mjs +0 -7
- package/lib/chunk-RM5G4IP6.mjs +0 -19
- package/lib/chunk-RTPNK7OB.mjs +0 -7
- package/lib/chunk-RZXEO5IE.mjs +0 -7
- package/lib/chunk-SAHGDSZQ.mjs +0 -37
- package/lib/chunk-SRPWW4A2.mjs +0 -10
- package/lib/chunk-SVNSAHG3.mjs +0 -7
- package/lib/chunk-T63U4OZJ.mjs +0 -7
- package/lib/chunk-TE2W76II.mjs +0 -10
- package/lib/chunk-TEIBWMJM.mjs +0 -7
- package/lib/chunk-TFGJDZFE.mjs +0 -7
- package/lib/chunk-TG52WNGV.mjs +0 -10
- package/lib/chunk-TQONVFI3.mjs +0 -7
- package/lib/chunk-TW3N6W5Z.mjs +0 -7
- package/lib/chunk-UZMLPKW6.mjs +0 -7
- package/lib/chunk-WB2RIVO3.mjs +0 -7
- package/lib/chunk-WQO7RXEB.mjs +0 -926
- package/lib/chunk-X3MBY2RX.mjs +0 -7
- package/lib/chunk-XMJRXXUN.mjs +0 -7
- package/lib/chunk-YNMU5I7P.mjs +0 -7
- package/lib/chunk-YSQJKIO6.mjs +0 -7
- package/lib/chunk-YVVPJRZC.mjs +0 -7
- package/lib/chunk-ZLQHBI6V.mjs +0 -9
- package/lib/chunk-ZRUDYB7O.mjs +0 -7
|
@@ -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 B,b as J}from"./chunk-PC247GKX.mjs";import{a as S}from"./chunk-
|
|
7
|
+
import{a as B,b as J}from"./chunk-PC247GKX.mjs";import{a as S}from"./chunk-22L43JMK.mjs";import{Ua as h,Va as E,Wa as U,Xa as D,cb as b}from"./chunk-J347SPU6.mjs";import{b as l,l as m,s as C,u as M,v as K}from"./chunk-WZQEK4WT.mjs";import{randomBytes as L}from"node:crypto";import{mkdirSync as ye,statSync as Z}from"node:fs";import{mkdir as w,open as Oe,readFile as R,readdir as _,rename as Fe,rm as f,rmdir as xe,stat as x}from"node:fs/promises";import{homedir as V}from"node:os";import{join as c,resolve as Ie}from"node:path";import{promisify as Q}from"node:util";import{gunzip as Ce,gzip as be}from"node:zlib";import{createHash as me}from"node:crypto";var G=16,Y=m({digest:l().regex(/^[0-9a-f]{64}$/),fields:C(l(),l().regex(new RegExp(`^[0-9a-f]{${G}}$`)))});function W(n){return me("sha256").update(n).digest("hex")}function we(n){return JSON.stringify([n.name.toLowerCase(),n.type,n.createable===!0,n.updateable===!0,n.nillable===!0,[...n.referenceTo??[]].sort(),n.encrypted===!0])}function dn(n){let e=n.map(t=>({name:t.name,key:t.name.toLowerCase(),line:we(t)})).sort((t,r)=>t.key<r.key?-1:t.key>r.key?1:0);return{digest:W(e.map(({line:t})=>t).join(`
|
|
8
8
|
`)),fields:Object.fromEntries(e.map(({name:t,line:r})=>[t,W(r).slice(0,G)]))}}function pn(n,e){let t={added:[],removed:[],changed:[]};if(n.digest===e.digest)return t;let r=new Map(Object.entries(n.fields).map(([o,s])=>[o.toLowerCase(),{name:o,print:s}])),i=new Map(Object.entries(e.fields).map(([o,s])=>[o.toLowerCase(),{name:o,print:s}]));for(let[o,{name:s,print:a}]of i){let p=r.get(o);p===void 0?t.added.push(s):p.print!==a&&t.changed.push(s)}for(let[o,{name:s}]of r)i.has(o)||t.removed.push(s);return t.added.sort(),t.removed.sort(),t.changed.sort(),t}var g=448,Pe=384,Ee=30,ee=3,De=15,ne=1440*6e4,I=1440*6e4,Se=Q(be),ve=Q(Ce),T="checkpoint.json",ze="fingerprints.json.gz",Ae="fingerprints.json",Le="snapshots.json",te="replay.json.gz",re=/^[A-Za-z][A-Za-z0-9_]*$/;function In(n=process.env){let e=n.SANDFORGE_JOURNAL_DIR,t=e!==void 0&&e.trim()!==""?Ie(e):c(V(),".sandforge");return c(t,"checkpoints")}function Re(n=V()){return c(n,".sandforge","locks")}function k(n){let e=D.safeParse(n).success?S(n.slice(0,15)):void 0;if(e===void 0)throw new d("invalid","Not an Organization Id");return e}function Ne(n){return n.length===18&&D.safeParse(n).success&&S(n.slice(0,15))===n}function v(n,e,t){return ie(c(n,e,t),e,t)}function ie(n,e,t){return{organizationId:e,checkpointId:t,dir:n,checkpointFile:c(n,T),fingerprintsFile:c(n,ze),plainFingerprintsFile:c(n,Ae),snapshotsFile:c(n,Le),indexDir:c(n,"index"),binDir:c(n,"bin"),filesDir:c(n,"files"),previewsDir:c(n,"previews"),rewindsDir:c(n,"rewinds")}}function oe(n){if(!re.test(n)||n.length>80)throw new d("invalid","Not a Salesforce API name");return n}function Cn(n,e){return c(n.indexDir,`${oe(e)}.idx`)}function bn(n){return c(n.indexDir,"recreated.ndjson")}function Pn(n){return c(n.indexDir,"notInBin.ndjson")}function En(n,e){return c(n.binDir,`${oe(e)}.ids`)}function Dn(n){return c(n.filesDir,"documents.ndjson")}function Sn(n){return c(n.filesDir,"links.ndjson")}function vn(n){return c(n.dir,te)}var $e=[/^checkpoint\.json$/,/^fingerprints\.json(?:\.gz)?$/,/^snapshots\.json$/,/^backups\/[A-Za-z0-9_-]{1,200}__[A-Za-z][A-Za-z0-9_]{0,79}\.ndjson(?:\.gz)?$/,/^bin\/[A-Za-z][A-Za-z0-9_]{0,79}\.ids$/,/^files\/(?:links|documents)\.ndjson(?:\.gz)?$/,/^index\/(?:recreated|notInBin)\.ndjson$/,/^replay\.json\.gz$/],zn=te,je=["","backups","bin","files","index"],An=T;function se(n){return $e.some(e=>e.test(n))}async function Ln(n){let e=[];for(let t of je){let r;try{r=await _(c(n.dir,t),{withFileTypes:!0})}catch(i){if(F(i)==="ENOENT"||F(i)==="ENOTDIR")continue;throw i}for(let i of r){let o=t===""?i.name:`${t}/${i.name}`;if(!i.isFile()||!se(o))continue;let s=c(n.dir,t,i.name);e.push({path:o,file:s,bytes:(await x(s)).size})}}return e.sort((t,r)=>ge(t.path,r.path))}function Rn(n,e){if(!se(e))throw new d("invalid","Not a file a checkpoint holds");return c(n,...e.split("/"))}function Nn(n,e){return c(n.previewsDir,O(E,e))}function H(n,e){return c(n.rewindsDir,O(U,e))}function O(n,e){let t=n.safeParse(e);if(!t.success)throw new d("invalid","Not an id of this store");return t.data}async function X(n){await w(n,{recursive:!0,mode:g})}var q="abcdefghijklmnopqrstuvwxyz0123456789";function $n(n,e=new Date){let t=e.toISOString(),r=`${t.slice(0,4)}${t.slice(5,7)}${t.slice(8,10)}`,i=`${t.slice(11,13)}${t.slice(14,16)}${t.slice(17,19)}`,o=Array.from(L(4),s=>q[s%q.length]).join("");return`${n}-${r}-${i}-${o}`}function _e(n,e){if(!Number.isInteger(e)||e<0)throw new RangeError(`Not a number of days: ${e}`);return e===0?null:new Date(n.getTime()+e*I).toISOString()}function ce(n,e){return n.expiresAt!==null&&Date.parse(n.expiresAt)<=e}function Te(n,e){if(n.expiresAt===null)return!1;let t=Date.parse(n.expiresAt);return t>e&&t-e<=ee*I}function He(n,e){let t=e-De*I;return Date.parse(n.readFrom)<t?new Date(t).toISOString():void 0}function Me(n,e){let t=ae(n);return t!==void 0&&t<=e}function ae(n){let e=n.scratchExpiresAt;if(e===void 0)return;let t=Date.parse(e);if(Number.isFinite(t))return/^\d{4}-\d{2}-\d{2}$/.test(e)?t+I:t}function Ke(n,e){let t=ae(n);return t!==void 0&&t>e&&t-e<=ee*I}var d=class extends Error{constructor(t,r){super(r);this.code=t;this.name="CheckpointStoreError"}code};function jn(n,e,t){let r=n.detail!==void 0?` (${n.detail})`:"";if(n.path===e)switch(n.reason){case"otherOwner":return`another user of this machine owns it, and could read and replace the checkpoints in it. ${t} names a folder of your own.`;case"notAFolder":return`it is a file, not a folder. ${t} names a folder for them, or move the file away.`;case"cannotMake":return`it could not be made${r}. ${t} names a folder this user can write.`}let i="the folder of every org\u2019s lock, whatever the store";switch(n.reason){case"otherOwner":return`${i}, is owned by another user of this machine: run as its owner, or remove it.`;case"notAFolder":return`${i}, is a file, not a folder: move the file away.`;case"cannotMake":return`${i}, could not be made${r}: make it a folder this user can write.`}}var de=m({version:K(1),objects:C(l().regex(re).max(80),Y)});async function Ue(n,e){let t;try{t=JSON.parse(await Je(n))}catch{throw new d("damaged","The checkpoint\u2019s field prints cannot be read")}let r=de.safeParse(t);if(!r.success)throw new d("damaged","The checkpoint\u2019s field prints do not parse");let i=new Map(Object.entries(r.data.objects));for(let o of e)if(i.get(o.objectApiName)?.digest!==o.fingerprint)throw new d("damaged",`The field prints of ${o.objectApiName} are not the checkpoint\u2019s`);return i}async function Be(n){let e=de.safeParse({version:1,objects:n});if(!e.success)throw new d("invalid",`Not field prints: ${e.error.message}`);return Se(`${JSON.stringify(e.data)}
|
|
9
9
|
`)}async function Je(n){let e;try{e=await R(n.fingerprintsFile)}catch(t){if(t.code!=="ENOENT")throw t;return R(n.plainFingerprintsFile,"utf8")}return(await ve(e)).toString("utf8")}function _n(n){let e=n.uid??(()=>process.getuid?.()),t=n.locksDir??Re();for(let r of[n.root,t]){let i=We(r,e);if(i!==void 0)return{refusal:i}}return{store:new N({...n,locksDir:t})}}function We(n,e){try{let t=Z(n,{throwIfNoEntry:!1});if(t!==void 0&&!t.isDirectory())return{reason:"notAFolder",path:n};ye(n,{recursive:!0,mode:g});let r=e();return r!==void 0&&Z(n).uid!==r?{reason:"otherOwner",path:n}:void 0}catch(t){return{reason:"cannotMake",path:n,detail:cn(t)}}}var N=class{root;locksDir;renameFile;lockOptions;changes=new Map;constructor(e){this.root=e.root,this.locksDir=e.locksDir,this.renameFile=e.rename??((t,r)=>Fe(t,r)),this.lockOptions={...e.lockSelf?{self:e.lockSelf}:{},...e.lockChecks?{checks:e.lockChecks}:{}}}folderOf(e,t){return v(this.root,k(e),O(h,t))}async create(e,t){let r=this.folderOf(e,t);await X(c(this.root,r.organizationId));try{await w(r.dir,{mode:g})}catch(i){throw F(i)==="EEXIST"?new d("exists",`A checkpoint ${t} is kept already`):i}return await w(r.indexDir,{mode:g}),await w(r.binDir,{mode:g}),r}async write(e){let t=z(e),r=this.folderOf(t.org.organizationId,t.checkpointId);await this.writeWhole(r.checkpointFile,$(t))}async writeFingerprints(e,t){await this.writeWhole(e.fingerprintsFile,await Be(t))}async readFingerprints(e,t){return Ue(e,t.objects)}async checkpointsOf(e){return this.readsOf(k(e))}async read(e){let t=O(h,e);for(let r of await this.organizationKeys()){let i=v(this.root,r,t);if(await y(i.dir))return A(i)}}async update(e,t){let r=async()=>{let a=await this.read(e);if(a===void 0)throw new d("notFound",`No checkpoint ${e} is kept`);if(a.checkpoint===void 0)throw new d("damaged",`The checkpoint ${e} is damaged`);let p=t(structuredClone(a.checkpoint));if(p.checkpointId!==a.folder.checkpointId||j(p.org.organizationId)!==a.folder.organizationId)throw new d("invalid","A change never moves a checkpoint");return await this.write(p),b.parse(p)},o=(this.changes.get(e)??Promise.resolve()).then(r,r),s=o.catch(()=>{});return this.changes.set(e,s),s.then(()=>{this.changes.get(e)===s&&this.changes.delete(e)}),o}keep(e,t,r=new Date){return this.update(e,i=>({...i,expiresAt:t?null:_e(r,Ee)}))}async list(e={}){let t=(e.now??new Date).getTime(),r=e.organizationId!==void 0?k(e.organizationId):void 0,i=[];for(let o of await this.organizationKeys(r)){let s=await this.readsOf(o),a=qe(s);for(let p of s)i.push(await Qe(p,t,a,e.refreshedAt))}return i.sort((o,s)=>ge(s.checkpointId,o.checkpointId))}async delete(e){let t=await this.read(e);if(t===void 0)return{outcome:"notFound"};let r=this.lock(t.folder.organizationId,"delete",t.folder.checkpointId);if("busy"in r)return{outcome:"busy",holder:r.busy};try{await f(t.folder.dir,{recursive:!0,force:!0})}finally{r.lock.release()}return t.checkpoint?{outcome:"deleted",checkpoint:t.checkpoint}:{outcome:"deleted"}}async importInto(e,t,r){let i=this.folderOf(e,t),o=c(this.root,i.organizationId);await X(o);let s=ie(c(o,`${Ge}${L(6).toString("hex")}`),i.organizationId,i.checkpointId);await w(s.dir,{mode:g});try{let a=z(await r(s));if(a.checkpointId!==i.checkpointId||j(a.org.organizationId)!==i.organizationId)throw new d("invalid","An import keeps the checkpoint it was asked to");let p=z({...a,bytes:await Xe(s.dir,a)});if(await this.writeWhole(s.checkpointFile,$(p)),await y(i.dir))return{outcome:"exists"};try{await this.renameFile(s.dir,i.dir)}catch(u){if(await y(i.dir))return{outcome:"exists"};throw u}return{outcome:"imported",checkpoint:p}}finally{await f(s.dir,{recursive:!0,force:!0}),await xe(o).catch(()=>{})}}async sweep(e=new Date){let t=e.getTime(),r={checkpoints:[],journals:[],previews:0,skipped:[]};for(let i of await this.organizationKeys()){await Ze(c(this.root,i),t);let o=await en(await this.readsOf(i),t);if(o.length===0)continue;let s=this.lock(i,"sweep");if("busy"in s){r.skipped.push(i);continue}try{for(let a of o)await nn(await A(a),t,r)}finally{s.lock.release()}}return r}lock(e,t,r){return on(this.locksDir,e,{operation:t,...r!==void 0?{checkpointId:r}:{}},this.lockOptions)}heldBy(e){return sn(this.locksDir,e,this.lockOptions)}async organizationKeys(e){return(await P(this.root)).filter(r=>Ne(r)&&(e===void 0||r===e))}async readsOf(e){let t=(await P(c(this.root,e))).filter(i=>h.safeParse(i).success),r=[];for(let i of t)r.push(await A(v(this.root,e,i)));return r}async writeWhole(e,t){let r=`${e}.${process.pid}-${L(4).toString("hex")}.tmp`,i=await Oe(r,"wx",Pe);try{try{await i.writeFile(t,typeof t=="string"?"utf8":void 0),await i.sync()}finally{await i.close()}await this.renameFile(r,e)}catch(o){throw await f(r,{force:!0}),o}}},Ge=".importing-",Ye=/^\.importing-[0-9a-f]{12}$/;async function Ze(n,e){for(let t of await P(n)){if(!Ye.test(t))continue;let r=c(n,t),i=await x(r).catch(()=>{});i!==void 0&&i.mtimeMs+ne<=e&&await f(r,{recursive:!0,force:!0})}}function z(n){let e=b.safeParse(n);if(!e.success)throw new d("invalid",`Not a checkpoint: ${e.error.message}`);return e.data}function $(n){return`${JSON.stringify(n,null,2)}
|
|
10
10
|
`}async function pe(n,e){let t=0;for(let r of await _(n,{withFileTypes:!0})){let i=c(n,r.name);r.isDirectory()?t+=await pe(i,e):r.isFile()&&i!==e&&(t+=(await x(i)).size)}return t}async function Xe(n,e){let t=await pe(n,c(n,T)),r=o=>Buffer.byteLength($({...e,bytes:o}),"utf8"),i=t+r(t);return i=t+r(i),i}async function A(n){let e;try{e=JSON.parse(await R(n.checkpointFile,"utf8"))}catch{return{folder:n}}let t=b.safeParse(e);return t.success?t.data.checkpointId!==n.checkpointId||j(t.data.org.organizationId)!==n.organizationId?{folder:n}:{folder:n,checkpoint:t.data}:{folder:n}}function qe(n){let e;for(let{folder:t,checkpoint:r}of n){let i=r?.lastRewind?.rewindId;i!==void 0&&(e===void 0||i>e.rewindId)&&(e={checkpointId:t.checkpointId,rewindId:i})}return e}function Ve(n,e,t,r){if(n.status==="taking")return{why:"taking"};if(n.status==="failed")return{why:"failed"};let i=r?.(e);if(i!==void 0)return{why:"refreshed",refreshedAt:i};if(Me(n.org,t))return{why:"scratchExpired"}}async function Qe({folder:n,checkpoint:e},t,r,i){let o={checkpointId:n.checkpointId,organizationId:n.organizationId};if(e===void 0)return{...o,valid:!1,why:"damaged"};let s=Ve(e,n.organizationId,t,i);if(s!==void 0)return{...o,checkpoint:e,valid:!1,why:s.why,...s.refreshedAt!==void 0?{refreshedAt:s.refreshedAt}:{}};let a={...o,checkpoint:e,valid:!0};Te(e,t)&&(a.expiresSoon=!0),Ke(e.org,t)&&(a.scratchExpiresSoon=!0);let p=He(e,t);p!==void 0&&(a.binReachSince=p);let u=e.lastRewind;return u!==void 0&&r?.checkpointId===n.checkpointId&&u.undoUntil!==void 0&&u.undoneAt===void 0&&Date.parse(u.undoUntil)>t&&await y(H(n,u.rewindId))&&(a.undo={rewindId:u.rewindId,until:u.undoUntil}),a}async function en(n,e){let t=[];for(let{folder:r,checkpoint:i}of n)i!==void 0&&(ce(i,e)||await ue(r,i,e)||(await fe(r,e)).length>0)&&t.push(r);return t}async function ue(n,e,t){let r=e.lastRewind?.undoUntil;return e.lastRewind!==void 0&&r!==void 0&&Date.parse(r)<=t&&await y(H(n,e.lastRewind.rewindId))}async function fe(n,e){let t=[];for(let r of await P(n.previewsDir)){if(!E.safeParse(r).success)continue;let i=c(n.previewsDir,r),o=await x(i).catch(()=>{});o!==void 0&&o.mtimeMs+ne<=e&&t.push(i)}return t}async function nn(n,e,t){let{folder:r,checkpoint:i}=n;if(i===void 0)return;if(i.expiresAt!==null&&ce(i,e)){await f(r.dir,{recursive:!0,force:!0});let s=i.lastRewind?.undoUntil,a=s!==void 0&&i.lastRewind?.undoneAt===void 0&&Date.parse(s)>e;t.checkpoints.push({organizationId:r.organizationId,checkpointId:r.checkpointId,name:i.name,...i.org.alias!==void 0?{alias:i.org.alias}:{},takenAt:i.takenAt,expiresAt:i.expiresAt,...a?{undoUntil:s}:{}});return}let o=i.lastRewind;o?.undoUntil!==void 0&&await ue(r,i,e)&&(await f(H(r,o.rewindId),{recursive:!0,force:!0}),t.journals.push({organizationId:r.organizationId,checkpointId:r.checkpointId,name:i.name,rewindId:o.rewindId,undoUntil:o.undoUntil}));for(let s of await fe(r,e))await f(s,{recursive:!0,force:!0}),t.previews+=1}var tn=m({...B,operation:M(["take","rewind","undo","delete","sweep","empty"]),checkpointId:h.optional()}),le=J(n=>{let e=tn.safeParse(n);return e.success?e.data:void 0});function rn(n,e){return c(n,`${k(e)}.lock`)}function on(n,e,t,r={}){let i=k(e),o=t.checkpointId!==void 0?O(h,t.checkpointId):void 0,s=le.acquire(c(n,`${i}.lock`),a=>({...a,operation:t.operation,...o!==void 0?{checkpointId:o}:{}}),r);return"busy"in s?{busy:he(s.busy)}:{lock:{organizationId:i,release:s.lock.release}}}function sn(n,e,t={}){let r=le.holder(rn(n,e),t);return r!==void 0?he(r):void 0}function he({version:n,token:e,...t}){return t}async function P(n){try{return(await _(n,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name)}catch(e){if(F(e)==="ENOENT"||F(e)==="ENOTDIR")return[];throw e}}async function y(n){return(await x(n).catch(()=>{}))?.isDirectory()===!0}function j(n){try{return k(n)}catch{return}}function ge(n,e){return n<e?-1:n>e?1:0}function F(n){return n?.code}function cn(n){return n instanceof Error?n.message:String(n)}export{dn as a,pn as b,g as c,Pe as d,Ee as e,ee as f,De as g,ne as h,In as i,Re as j,k,Cn as l,bn as m,Pn as n,En as o,Dn as p,Sn as q,vn as r,zn as s,An as t,se as u,Ln as v,Rn as w,Nn as x,H as y,X as z,$n as A,_e as B,ce as C,Te as D,He as E,Me as F,Ke as G,d as H,jn as I,Ue as J,Be as K,_n as L,N as M,qe as N,rn as O,on as P,sn as Q};
|
|
@@ -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{g as v}from"./chunk-
|
|
7
|
+
import{g as v}from"./chunk-DAUX63UB.mjs";var x=!0;function D(t){let e=new Map;for(let n of t){let r=n.SobjectType;if(typeof r!="string"||r==="")continue;let o=r.toLowerCase(),c=e.get(o)??{viewAll:!1,modifyAll:!1};e.set(o,{viewAll:c.viewAll||n.PermissionsViewAllRecords===!0,modifyAll:c.modifyAll||n.PermissionsModifyAllRecords===!0})}return e}function E(t){return[...t.values()].some(e=>e.modifyAll)}var I=new Set(["task","event"]),M=new Set(["product2","pricebook2","pricebookentry"]),N=new Set(["user","group"]);function L(t){let e=[];for(let n of t.fields){if(n.type!=="reference")continue;let r=(n.referenceTo??[]).filter(o=>!N.has(o.toLowerCase()));r.length>0&&e.push({field:n.name,targets:r})}return e}function R(t,e){if(I.has(t))return"activities";if(M.has(t))return"catalog";if(t===v.toLowerCase())return"filesNotProven";if(e.has(t))return"settingNotProven"}function G(t,e){let n=j(e.describes),r=k(e.customSettings),o=new Map;for(let c of t){let f=c.toLowerCase();if(R(f,r)!==void 0||e.grants.has(f))continue;let u=n.get(f);if(u!==void 0)for(let{targets:p}of L(u)){if(p.length!==1)continue;let s=p[0],i=s.toLowerCase();!n.has(i)&&!o.has(i)&&o.set(i,s)}}return[...o.values()]}function j(t){return new Map([...t].map(e=>[e.name.toLowerCase(),e]))}function k(t){return new Set([...t??[]].map(e=>e.toLowerCase()))}function P(t,e,n){return(t.childRelationships??[]).some(r=>r.cascadeDelete===!0&&r.childSObject.toLowerCase()===e&&r.field.toLowerCase()===n.toLowerCase())}function $(t,e,n={}){let r=n.byParent??x,o=j(e.describes),c=k(e.customSettings),f=new Map,u=(s,i)=>{let d=s.toLowerCase(),C=f.get(d);if(C!==void 0)return C;let m=R(d,c);if(m!==void 0)return{reason:m};let h=e.grants.get(d);if(h!==void 0)return h.modifyAll?{access:"object"}:{reason:h.viewAll?"noModifyAll":"noViewAll"};if(!r)return{reason:"parentNotSeen",detail:"held through its parents is not proven"};let A=o.get(d);if(A===void 0)return{reason:"parentNotSeen",detail:"it could not be described"};let w=[];for(let{field:l,targets:a}of L(A)){let b=a.filter(y=>!o.has(y.toLowerCase())),g=a.filter(y=>{let S=o.get(y.toLowerCase());return S!==void 0&&P(S,d,l)});if(a.length>1){if(g.length>0||b.length>0)return{reason:"parentNotSeen",detail:`${l} may name a record of ${a.join(", ")}`};continue}if(b.length>0)return{reason:"parentNotSeen",detail:`${b[0]}, which ${l} names, could not be described`};g.length>0&&w.push({field:l,parent:g[0]})}if(w.length===0)return{reason:"parentNotSeen",detail:"it hangs from no record whose delete takes it along"};let O=new Set([...i,d]);for(let{field:l,parent:a}of w){let b=a.toLowerCase(),g=O.has(b)?void 0:u(a,O);if(g===void 0||!("access"in g))return{reason:"parentNotSeen",detail:`${a}, which ${l} names, is not held whole`}}return{access:"parent"}},p=new Map;for(let s of t){let i=u(s,new Set);f.set(s.toLowerCase(),i),p.set(s,i)}return p}export{D as a,E as b,G as c,$ as d};
|
|
@@ -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{c as A}from"./chunk-66NMFCWX.mjs";import{a as D}from"./chunk-
|
|
7
|
+
import{c as A}from"./chunk-66NMFCWX.mjs";import{a as D}from"./chunk-DLSU66MY.mjs";import{g as R}from"./chunk-DAUX63UB.mjs";import{c as x,q as g,r as h,t as P,u as k}from"./chunk-SZOJ7BEJ.mjs";import{qd as O}from"./chunk-J347SPU6.mjs";import{b as d,f as l,k as m,l as b}from"./chunk-WZQEK4WT.mjs";var j=[{child:"Entitlement",field:"AccountId",parent:"Account",refused:"always"},{child:"Order",field:"AccountId",parent:"Account",refused:"pastDraft"},{child:"Opportunity",field:"AccountId",parent:"Account",refused:"closedWon",rows:{field:"IsWon",value:!0}}];function C(e,n,t){let[s,r,a]=[e,n,t??""].map(i=>i.toLowerCase());return j.some(i=>i.refused==="always"&&i.child.toLowerCase()===s&&i.field.toLowerCase()===r&&(t===void 0||i.parent.toLowerCase()===a))}var W=b({name:d(),type:d(),createable:l().optional(),updateable:l().optional(),nillable:l().optional(),calculated:l().optional(),autoNumber:l().optional(),permissionable:l().optional(),encrypted:l().optional(),referenceTo:m(d()).nullish()}).loose(),oe=b({name:d(),undeletable:l().optional(),fields:m(W),childRelationships:m(b({childSObject:d(),field:d(),cascadeDelete:l().optional(),restrictedDelete:l().optional()}).loose()).nullish()}).loose(),F=["Id","SystemModstamp","CreatedDate","CreatedById","LastModifiedDate","LastModifiedById"],S="IsPersonAccount",M="Event",I=["LatestPublishedVersionId","ContentSize"],_=["ParentId","ContentAssetId","IsArchived"],v="VersionData";function N(e){return e.toLowerCase()===R.toLowerCase()}function B(e){return new Set(N(e)?I.map(n=>n.toLowerCase()):[])}function U(e){return e===x||e===M?"scanAllLive":"query"}function V(e){let n={name:e.name,label:e.name,labelPlural:e.name,keyPrefix:null,custom:!1,createable:!0,updateable:!0,deletable:!0,queryable:!0,fields:e.fields.map(t=>({name:t.name,label:t.name,type:t.type,length:0,nillable:t.nillable===!0,createable:t.createable===!0,updateable:t.updateable===!0,externalId:!1,referenceTo:t.referenceTo??[],relationshipName:null,picklistValues:[],defaultValue:null,calculated:t.calculated===!0,autoNumber:t.autoNumber===!0,unique:!1,...t.permissionable===void 0?{}:{permissionable:t.permissionable}})),recordTypeInfos:[],childRelationships:[]};return new A(async()=>n)}function G(e){return e.type==="address"||e.type==="location"}function y(e){return new Map(e.fields.map(n=>[n.name.toLowerCase(),n]))}async function K(e,n){let t=y(e),s=F.filter(o=>t.has(o.toLowerCase())),r=t.get(S.toLowerCase());r&&(e.name===g||e.name===h)&&s.push(r.name);let a=N(e.name);if(a)for(let o of I){let c=t.get(o.toLowerCase());c&&s.push(c.name)}let i=new Set(a?_.map(o=>o.toLowerCase()):[]),p=new Set(s.map(o=>o.toLowerCase())),f=e.fields.map(o=>o.name).filter(o=>!p.has(o.toLowerCase())&&!i.has(o.toLowerCase())),{writable:L,skipped:z,denied:T}=await V(e).partitionWritableFields(e.name,"upsert",f),w=[],u=new Map;for(let o of T)u.set(o,"fls");for(let o of z){let c=t.get(o.toLowerCase());c&&G(c)&&u.set(o,"compound")}let E=new Set(L);for(let o of L){let c=t.get(o.toLowerCase())?.type;c==="base64"?u.set(o,"base64"):c===D&&!n.viewsEncryptedData&&u.set(o,"encrypted")}for(let o of f){let c=u.get(o);c!==void 0?w.push({field:o,reason:c}):E.has(o)&&s.push(o)}return a&&w.push({field:v,reason:"base64"}),{fields:s,leftOutFields:w}}function q(e,n){let t=y(e),s=e.name.toLowerCase(),r=new Set;for(let a of n)for(let i of a.childRelationships??[]){if(i.cascadeDelete!==!0||i.childSObject.toLowerCase()!==s||C(e.name,i.field,a.name))continue;let p=t.get(i.field.toLowerCase());p&&r.add(p.name)}return[...r].sort()}function Y(e,n){let t=y(e),s=e.name.toLowerCase(),r=new Set;for(let a of n)for(let i of a.childRelationships??[]){if(!(i.restrictedDelete===!0&&i.cascadeDelete!==!0||C(e.name,i.field,a.name))||i.childSObject.toLowerCase()!==s)continue;let f=t.get(i.field.toLowerCase());f&&r.add(f.name)}return[...r].sort()}function re(e){let n=e.cascadeParents.filter(t=>C(e.objectApiName,t));return n.length===0?e:{...e,cascadeParents:e.cascadeParents.filter(t=>!n.includes(t)),restrictParents:[...new Set([...e.restrictParents??[],...n])].sort()}}async function se(e,n,t){return{objectApiName:e.name,readMode:U(e.name),undeletable:e.undeletable===!0,cascadeParents:q(e,n),restrictParents:Y(e,n),...await K(e,t)}}function H(e,n){let t=e.toLowerCase(),s=new Set;for(let r of n){let a=r.indexOf(".");a<=0||a===r.length-1||r.slice(0,a).toLowerCase()===t&&s.add(r.slice(a+1).toLowerCase())}return s}function J(e,n){let t=n.toLowerCase();return t!==S.toLowerCase()&&!F.some(s=>s.toLowerCase()===t)&&!B(e).has(t)}function ae(e,n,t){let s=H(e,t);return n.filter(r=>J(e,r)&&!s.has(r.toLowerCase()))}function ie(e,n){return e===h&&P(n)}function ce(e,n,t){let s=e===g?k(n,!1):void 0,r={};typeof n.Id=="string"&&(r.Id=n.Id);for(let a of t)a in n&&(s!==void 0&&O(g,a,s)||(r[a]=n[a]));return r}export{j as a,C as b,W as c,oe as d,F as e,S as f,I as g,U as h,re as i,se as j,H as k,ae as l,ie as m,ce as n};
|
|
@@ -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-Z354SAEF.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-JFVY66BS.mjs";import{O as z,Q as B,T as V,Uc as R}from"./chunk-CRPLDXJU.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-SZOJ7BEJ.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-3KJCSYXY.mjs";import{$c as R,O as z,Q as B,T as V}from"./chunk-J347SPU6.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};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{a as m,b as d}from"./chunk-PVZ72OOQ.mjs";import{a as p,b as g,c as u}from"./chunk-QIRO4HTE.mjs";import{d as h}from"./chunk-TYUYPFDJ.mjs";import{createHmac as y,randomBytes as D}from"node:crypto";var R={Street:"address",City:"city",PostalCode:"postalCode"};function w(r){if(Object.hasOwn(p,r))return p[r];if(Object.hasOwn(R,r))return R[r]}function S(r,t,n){return n.flatMap(e=>{if(e.method==="redact")return[];let a=r[e.fieldApiName];if(typeof a!="string")return[];let o=e.fieldApiName;if(!h(o)&&w(o)===void 0&&!m(a))return[];let i=t[o];return[{original:a,masked:i==null?null:String(i)}]})}function v(r){let t=r.truncateLength;return typeof t=="number"&&Number.isFinite(t)&&t>0?Math.floor(t):0}function O(r,t){let n=r.maskKeepLast;if(typeof n!="number"||!Number.isFinite(n)||n<=0)return 0;let e=Math.floor(n);return t>e?e:0}var k=/^[^\s@]+@[^\s@]+$/,c="example.invalid";function z(r){let t=r.lastIndexOf("@");return`${t===-1?r:r.slice(0,t)}@${c}`}var f=class extends Error{constructor(t){super(`Hash rule for ${t} has no hashSalt. The values being hashed are low-entropy PII (emails, phone numbers, names), so an unkeyed digest is recovered by enumeration in seconds. Set config.hashSalt to a secret value.`),this.name="MissingHashSaltError"}},A=class{personaRegistry;fallbackKey;constructor(t,n){this.fallbackKey=n??D(32).toString("hex"),this.personaRegistry=t??new u(this.fallbackKey)}saltedRegistries=new Map;registryFor(t){let n=t.config.hashSalt;if(!n)return this.personaRegistry;let e=this.saltedRegistries.get(n);return e||(e=new u(n),this.saltedRegistries.set(n,e)),e}namesGiven(){return this.personaRegistry.namesGiven()}continueFrom(t){return this.personaRegistry.continueFrom(t)}forgetRecords(){this.personaRegistry.forgetRecords();for(let t of this.saltedRegistries.values())t.forgetRecords()}peopleHeld(){let t=this.personaRegistry.size;for(let n of this.saltedRegistries.values())t+=n.size;return t}anonymize(t,n){return t.map(e=>{let a={...e},o=String(e.Id??e.id??""),i=[];for(let s of n)s.fieldApiName in a&&(s.method==="redact"?i.push(s):a[s.fieldApiName]=this.applyRule(a[s.fieldApiName],s,o));if(i.length>0){let s=S(e,a,n);for(let l of i)a[l.fieldApiName]=this.applyRedact(e[l.fieldApiName],l,s)}return a})}applyRule(t,n,e=""){let o={mask:(i,s)=>this.applyMask(i,s),hash:(i,s)=>this.applyHash(i,s),fake:(i,s)=>this.applyFake(i,s,e),nullify:()=>null,shuffle:(i,s)=>this.applyShuffle(i,s),truncate:(i,s)=>this.applyTruncate(i,s),constant:(i,s)=>s.config.constantValue??"",preserve_format:i=>this.applyPreserveFormat(i),redact:(i,s)=>this.applyRedact(i,s,[])}[n.method];return o?o(t,n):t}preview(t,n,e){let a=t.slice(0,Math.max(0,e));return this.anonymize(a,n)}validateRules(t){let n=[];for(let e of t)e.fieldApiName||n.push("Rule must specify a fieldApiName"),e.objectApiName||n.push("Rule must specify an objectApiName"),e.method==="mask"&&!e.config.maskChar&&n.push(`Mask rule for ${e.fieldApiName} must specify a maskChar`),e.method==="hash"&&e.config.hashAlgorithm!=="sha256"&&e.config.hashAlgorithm!=="md5"&&n.push(`Hash rule for ${e.fieldApiName} must specify hashAlgorithm as sha256 or md5`),e.method==="hash"&&!e.config.hashSalt&&n.push(`Hash rule for ${e.fieldApiName} must specify a hashSalt \u2014 an unkeyed digest of low-entropy PII is trivially reversible`),e.method==="constant"&&e.config.constantValue===void 0&&n.push(`Constant rule for ${e.fieldApiName} must specify a constantValue`);return n}applyMask(t,n){let e=String(t??""),a=n.config.maskChar??"*",o=n.config.maskStart??0,i=n.config.maskEnd??e.length-O(n.config,e.length),s=e.split("");for(let l=o;l<Math.min(i,s.length);l++)s[l]=a;return s.join("")}applyHash(t,n){let e=n.config.hashSalt;if(!e)throw new f(n.fieldApiName);let a=n.config.hashAlgorithm??"sha256",o=String(t??""),i=y(a,e).update(o).digest("hex").slice(0,32);return k.test(o)?`${a}-${i}@${c}`:`${a}:${i}`}applyFake(t,n,e){let a=e!==""?e:this.keyedDigest(String(t??""),n),o=this.registryFor(n).getPersona(a),i=w(n.fieldApiName);if(i==="email")return z(o.email);if(i)return o[i];let s=this.keyedDigest(`${n.fieldApiName}:${a}`,n).slice(0,8);return k.test(String(t??""))?`fake-${s}@${c}`:`fake_${s}`}applyShuffle(t,n){return g(String(t??""),n.config.hashSalt??this.fallbackKey)}applyTruncate(t,n){let e=v(n.config);if(e===0)return"";let a=String(t??"");return n.config.truncateKeep==="first"?a.slice(0,e):a.slice(-e)}applyRedact(t,n,e){return typeof t!="string"?t:d(t,{known:e,digest:a=>this.keyedDigest(a,n)})}keyedDigest(t,n){return y("sha256",n.config.hashSalt??this.fallbackKey).update(t).digest("hex")}applyPreserveFormat(t){return String(t??"").replace(/[a-zA-Z]/g,"x").replace(/[0-9]/g,"0")}};export{f as a,A as b};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{a as b}from"./chunk-RWVX7XSD.mjs";import"./chunk-O6FHK6NQ.mjs";import"./chunk-GFB2DNCB.mjs";import{a}from"./chunk-JFXQZPRY.mjs";import"./chunk-BBZUGKBZ.mjs";import"./chunk-P4YOHLZ4.mjs";import"./chunk-BLMJ4WVI.mjs";import"./chunk-4NSXPONF.mjs";import"./chunk-XBYXT74L.mjs";import"./chunk-2YJJTQNC.mjs";import"./chunk-4VLP6RHC.mjs";import"./chunk-FV6MOSHD.mjs";import"./chunk-YTOTMJTY.mjs";import"./chunk-WJGK6VGU.mjs";import"./chunk-3L6DVNCR.mjs";import"./chunk-54V4FVEY.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-TZXYVMZC.mjs";import"./chunk-CJAWKLAL.mjs";import"./chunk-PE7CHD2W.mjs";import"./chunk-VKREON6Q.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-VFKG2G37.mjs";import"./chunk-CL75DEMQ.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-7O6EFNQS.mjs";import"./chunk-3LRFPGYZ.mjs";import"./chunk-KWUS7UAV.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-NV5QA2HY.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-YDXMTWAT.mjs";import"./chunk-PVZ72OOQ.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-TYUYPFDJ.mjs";import"./chunk-DLSU66MY.mjs";import"./chunk-ATQML7ZK.mjs";import"./chunk-H6BHWAX7.mjs";import"./chunk-4CSBZZAL.mjs";import"./chunk-GP5J3DGS.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-OT2NHL2V.mjs";import"./chunk-ZVU7MD2S.mjs";import"./chunk-OLCS7JCT.mjs";import"./chunk-TQ6HEJ73.mjs";import"./chunk-65AMXOQU.mjs";import"./chunk-6HHSAPIM.mjs";import"./chunk-K5PUMHZU.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-EUIALBMX.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-Q7TLC3I2.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ATBQIE2V.mjs";import"./chunk-UCUFLFNK.mjs";import"./chunk-4XROG5CT.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-DAUX63UB.mjs";import"./chunk-SZOJ7BEJ.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-22L43JMK.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-3KJCSYXY.mjs";import"./chunk-HDDJ3CVN.mjs";import"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as objectsWrittenBy,b as previewCheckpoint};
|
|
@@ -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}from"./chunk-
|
|
7
|
+
import{a}from"./chunk-FM4QCTO7.mjs";import"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as SeedValidator};
|
|
@@ -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{b as S,d as z}from"./chunk-
|
|
7
|
+
import{b as S,d as z}from"./chunk-GP5J3DGS.mjs";import{h as I}from"./chunk-TZE3Y7IQ.mjs";import{b as h}from"./chunk-CA5NAXSU.mjs";import{Cc as R}from"./chunk-J347SPU6.mjs";import{b as f,e as b,f as y,i as A,k,l as m,o as K}from"./chunk-WZQEK4WT.mjs";var w="Knowledge__kav",j="CaseArticle",T="Case",P="Summary",B=255,D=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,L=m({name:f(),type:f(),length:b().optional(),extraTypeInfo:f().nullish(),htmlFormatted:y().optional(),createable:y().optional()}).loose(),F=m({fields:k(A())}).loose();function M(e){if(!(e.type!=="textarea"||e.createable!==!0))return e.name===P?"summary":e.extraTypeInfo==="richtextarea"||e.htmlFormatted===!0?"richText":(e.length??0)>B?"longText":void 0}var O={richText:0,longText:1,summary:2};function G(e){let r=F.safeParse(e);if(!r.success)return[];let o=[];for(let t of r.data.fields){let n=L.safeParse(t);if(!n.success)continue;let d=M(n.data);d===void 0||typeof n.data.length!="number"||o.push({name:n.data.name,length:n.data.length,kind:d})}return o.sort((t,n)=>O[t.kind]-O[n.kind]||n.length-t.length||t.name.localeCompare(n.name))}function U(e){return{articleBodyField:e.name,articleBodyLength:e.length,...e.kind==="richText"?{articleBodyHtml:!0}:{}}}var x=m({success:y(),errors:k(K([m({statusCode:f().optional(),message:f().optional()}).loose(),f()])).optional()}).loose();function $(e){let r=x.safeParse(e),o=r.success?r.data.errors?.[0]:void 0;return o===void 0?"The org gave no reason.":typeof o=="string"?o:[o.statusCode,o.message].filter(Boolean).join(": ")||"The org gave no reason."}function N(e){let r=x.safeParse(e);return r.success&&r.data.success}function C(e){return e.slice(0,15)}function X(e){return async({ids:r,results:o})=>{let t=r.get(w)??new Map;if(t.size===0)return{skipped:o.find(u=>u.objectApiName===w)?.errors[0]??`The run wrote no ${w} article, so none was published or linked.`};let n={};return e.plan.publish&&(n.publish=await _(e,t)),e.plan.links.length>0&&(n.links=await v(e,t,r.get(T)??new Map)),n}}async function _(e,r){let o={asked:r.size,done:0,notDone:[]};for(let[t,n]of r){if(e.signal?.aborted){o.notDone.push({key:t,reason:"Left a draft: the run was stopped before it was published."});continue}if(!D.test(n)){o.notDone.push({key:t,reason:`Left a draft: ${n} is not a record id.`});continue}try{await e.org.request({method:"PATCH",url:`/knowledgeManagement/articleVersions/masterVersions/${n}`,body:JSON.stringify({publishStatus:"Online"}),headers:{"Content-Type":"application/json"}}),o.done++}catch(d){o.notDone.push({key:t,reason:`Left a draft: ${h(d)}`})}finally{e.journal?.wroteAgain(w,[n])}}return o}async function v(e,r,o){let t={asked:e.plan.links.length,done:0,notDone:[]},n,d;try{n=await q(e.org,[...r.values()])}catch(s){n=new Map,d=h(s)}let u=[],c=(s,a)=>{t.notDone.push({key:s,reason:`Not linked: ${a}.`})};for(let{caseKey:s,articleKey:a}of e.plan.links){let l=o.get(s),g=r.get(a);if(l===void 0){c(s,"its case was not written");continue}if(g===void 0){c(s,`its article ${a} was not written`);continue}let i=n.get(C(g));if(i===void 0){c(s,`the article of ${a} could not be read back`+(d?` (${d})`:": the org no longer holds its version"));continue}u.push({caseKey:s,caseId:l,articleId:i,versionId:g})}for(let s=0;s<u.length;s+=S){let a=u.slice(s,s+S);if(e.signal?.aborted){for(let{caseKey:i}of a)t.notDone.push({key:i,reason:"Not linked: the run was stopped before it."});continue}let l;try{l=await e.org.sobject(j).create(a.map(({caseId:i,articleId:p})=>({CaseId:i,KnowledgeArticleId:p})),{headers:R()})}catch(i){let p=`Not linked: ${h(i)}`;for(let{caseKey:E}of a)t.notDone.push({key:E,reason:p});l=[]}finally{e.journal?.wroteAgain(T,a.map(({caseId:i})=>i)),e.journal?.wroteAgain(w,[...new Set(a.map(({versionId:i})=>i))])}let g=Array.isArray(l)?l:[l];g.length!==0&&a.forEach(({caseKey:i},p)=>{N(g[p])?t.done++:t.notDone.push({key:i,reason:`Not linked: ${$(g[p])}`})})}return t}async function q(e,r){let o=I(w),t=new Map;for(let n of z(r)){let d=await e.query(`SELECT Id, KnowledgeArticleId FROM ${o} WHERE Id IN (${n})`);for(let u of d.records){let c=u;typeof c?.Id=="string"&&typeof c.KnowledgeArticleId=="string"&&t.set(C(c.Id),c.KnowledgeArticleId)}}return t}export{w as a,G as b,U as c,X as d};
|
|
@@ -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 c}from"./chunk-Q7TLC3I2.mjs";import{
|
|
7
|
+
import{a as d,b as c}from"./chunk-Q7TLC3I2.mjs";import{bd as a,dd as u}from"./chunk-J347SPU6.mjs";async function I(t){let e=(await t.query("SELECT Id, IsSandbox FROM Organization LIMIT 1")).records[0];if(typeof e?.Id!="string")throw new Error("The org gave no Organization record: whether it is a sandbox cannot be told.");if(e.IsSandbox===!0)return{id:e.Id,sandbox:!0};try{let r=(await t.query("SELECT OrganizationType FROM Organization LIMIT 1")).records[0]?.OrganizationType;return typeof r=="string"&&r!==""?{id:e.Id,sandbox:!1,edition:r}:{id:e.Id,sandbox:!1}}catch{return{id:e.Id,sandbox:!1}}}function h(t){let n=a({isSandbox:t.sandbox,edition:t.edition});return u(n,t.edition)==="production"}function p(t){let{errorCode:n,statusCode:e}=typeof t=="object"&&t!==null?t:{},o=t instanceof Error?t.message:String(t);return e===403||typeof n=="string"&&/^INSUFFICIENT_ACCESS/.test(n)||/\bINSUFFICIENT_ACCESS/.test(o)||(n==="INVALID_TYPE"||/\bINVALID_TYPE\b/.test(o))&&/\bOrganization\b/.test(o)}function l(t){if(d(t))return"auth";if(c(t))return"network";if(p(t))return"organizationRefused"}function O(t,n,e){let o=n instanceof Error?n.message:String(n);switch(e){case"auth":return`${t} refused the session SandForge holds for it (${o}): reconnect it \u2014 Reconnect on the Organizations page, or "sf org login web --alias ${t}" for a command line \u2014 then try again.`;case"network":return`${t} did not answer (${o}): try again once it answers.`;case"organizationRefused":return`${t} would not show its Organization record (${o}): reading it takes the View Setup and Configuration permission, which the user SandForge connects as lacks: give it to them, or connect as a user who has it.`}}var g=/\/services\/Soap\//,f=/\/services\/data\/v\d+\.\d+\/jobs\/(?:ingest|query)(?:[/?]|$)/,y=/^\/jobs\/(?:ingest|query)(?:[/?]|$)/;function b(t){let n=typeof t=="string"?t:t?.url??"";return f.test(n)||y.test(n)}function S(t){let n=0;if(typeof t.request!="function")return()=>n;let e=t._transport,o=t.request.bind(t);if(t.request=(...r)=>((e===void 0||!b(r[0]))&&n++,o(...r)),e!==void 0){let r=e.httpRequest.bind(e);e.httpRequest=(...i)=>{let s=i[0].url;return(g.test(s)||f.test(s))&&n++,r(...i)}}return()=>n}export{I as a,h as b,p as c,l as d,O as e,S as f};
|
|
@@ -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{g as m,h as S,i as E,j as x}from"./chunk-
|
|
7
|
+
import{g as m,h as S,i as E,j as x}from"./chunk-DAUX63UB.mjs";import{b as C}from"./chunk-CA5NAXSU.mjs";import{Ne as T,z as R}from"./chunk-J347SPU6.mjs";import{statfs as q}from"node:fs/promises";var re=["reads","leasePlan","stillRunning","deliverabilityRead","question","checkpointTake","leaseAcquire","afterLeaseCheck","write","leaseRelease","recordTypeReadBack","result"];function ie(e){let t=[],n=s=>e.indexOf(s),r=s=>e.lastIndexOf(s),o=(s,c,d,p=r(s),l=n(c))=>{p>=0&&l>=0&&p>l&&t.push(d)};o("leasePlan","stillRunning","what still runs was computed before the lease was planned"),o("stillRunning","deliverabilityRead","the deliverability was read before what still runs was known"),o("deliverabilityRead","question","the deliverability was read after the question it belongs to",n("deliverabilityRead")),o("question","checkpointTake","the checkpoint was taken before the last question"),o("question","leaseAcquire","the lease was taken before the last question"),o("checkpointTake","leaseAcquire","the lease was taken before the checkpoint"),o("leaseAcquire","afterLeaseCheck","the lease was checked before it was taken"),o("checkpointTake","write","a record was written before the checkpoint was taken"),o("leaseAcquire","write","a record was written before the lease was taken"),o("afterLeaseCheck","write","a record was written before the lease was checked"),o("write","leaseRelease","the lease was given back before the last write"),o("write","recordTypeReadBack","the record types were read back before the last write"),o("leaseRelease","recordTypeReadBack","the record types were read back while the lease was held"),n("leaseAcquire")>=0&&n("leaseRelease")<0&&t.push("the lease was never given back");let i=n("result");return i>=0&&e.slice(i+1).some(s=>s!=="result")&&t.push("the run went on past its result"),t}var W={insert:"go in",update:"are updated",delete:"are deleted",undelete:"come back"},L={flow:"flow",process:"process",workflowRule:"workflow rule",trigger:"Apex trigger"},h=3,v=/__e$/i;function u(e){return e.toLowerCase()}function A(e){let t=new Set,n=[];for(let r of e)t.has(u(r))||(t.add(u(r)),n.push(r));return n}function F(e){let t=e.slice(0,h),n=e.length-t.length,r=`${t.join("; ")}${n>0?`; and ${n} more`:""}`;return`${r.charAt(0).toUpperCase()}${r.slice(1)}.`}function I(e){let t=A(e.written),n=new Set(t.map(u)),r=new Map;for(let i of e.running.firing)if(i.flow!==void 0)for(let s of i.flow.creates??[]){let c=u(s);if(n.has(c)||v.test(s))continue;let d=r.get(c);d===void 0&&(d={objectApiName:s,clauses:[],by:[]},r.set(c,d));let p=`the target's ${L[i.kind]} '${i.name}' creates ${s} records as ${i.objectApiName} records ${W[i.write]}`;d.clauses.includes(p)||(d.clauses.push(p),d.by.push({kind:i.kind,name:i.name,objectApiName:i.objectApiName,write:i.write}))}let o=[...r.values()].map(({objectApiName:i,clauses:s,by:c})=>({objectApiName:i,code:"createdByAutomation",reason:F(s),creators:c.slice(0,h),...c.length>h?{moreCreators:c.length-h}:{}}));return{written:t,added:o,excluded:A(e.request.excluded??[]),picked:[...t,...o.map(({objectApiName:i})=>i)]}}var M={[u(m)]:{code:"files",reason:"Files, which every checkpoint of picked objects holds: a rewind deletes the files added since to the records it holds."},[u(x)]:{code:"attachments",reason:"Attachments, which every checkpoint of picked objects holds: a rewind deletes the attachments added since."}},K="Held as every checkpoint of picked objects holds it.",U={[u("AccountContactRelation")]:"Account contact relations, which the platform writes with each contact: a rewind deletes those made since with their contacts, and keeps no contact for them."},J=new Set([E,S].map(u)),z="A rewind leaves its records as they are.",k="No record was read.";function w(e,t,n){let r=new Map(t.map(a=>[u(a),a])),o=r.has(u(m)),i=a=>r.has(u(a))||o&&J.has(u(a)),s=[],c=a=>{let f=r.get(u(a));f!==void 0&&!s.includes(f)&&s.push(f)};for(let a of e.written)c(a);for(let{objectApiName:a}of e.added)c(a);for(let a of t)c(a);let d=new Set(e.picked.map(u)),p=[...e.added.flatMap(a=>{let f=r.get(u(a.objectApiName));return f===void 0?[]:[{...a,objectApiName:f}]}),...t.filter(a=>!d.has(u(a))).map(a=>({objectApiName:a,...M[u(a)]??{code:"heldUnasked",reason:U[u(a)]??K}}))],l=n.filter(({objectApiName:a})=>!i(a)).map(({objectApiName:a,reason:f,code:b,detail:y,records:O,limit:B})=>({objectApiName:a,...b!==void 0?{code:b}:{},reason:`${f} ${z}`,...y!==void 0?{detail:y}:{},...O!==void 0?{records:O}:{},...B!==void 0?{limit:B}:{}})),H=new Map(n.map(({objectApiName:a,reason:f})=>[u(a),f]));return{objects:s,added:p,notHeld:l,holds:i,why:a=>H.get(u(a))}}function g(e,t,n){return e.written.some(o=>t.holds(o))?void 0:e.written.length===0?{code:"NOTHING_HELD",message:`The run names no object it writes: a checkpoint before it would hold nothing a rewind could take back. ${n}`}:{code:"NOTHING_HELD",message:`The checkpoint before the run would hold none of the objects the run writes, so a rewind to it could take nothing of the run back. ${e.written.map(o=>`${o}: ${t.why(o)??"The take did not hold it."}`).join(" ")} ${n}`}}function G(e,t,n){let r={state:"planned",estimate:t.estimate,keepDays:n};if(t.objects.length===0&&t.leftOut.length===0&&t.refusal!==void 0)return{...r,objects:[],added:[],notHeld:[],refusal:t.refusal};let o=w(e,t.objects.map(({objectApiName:s})=>s),t.leftOut),i=g(e,o,k)??t.refusal;return{...r,objects:o.objects,added:o.added,notHeld:o.notHeld,...i!==void 0?{refusal:i}:{}}}var V=1.1;function N(e){return`${(e/(1024*1024)).toFixed(1)} MB`}function P(e,t){if(!(t===void 0||t>=Math.ceil(e*V)))return{code:"DISK",message:`The checkpoint before the run takes about ${N(e)} on this machine, and its disk has ${N(t)} free, less than that and a tenth more: make room, or leave objects out of the checkpoint. ${k}`}}async function _(e){try{let t=await q(e);return Number(t.bavail)*Number(t.bsize)}catch{return}}var Y={forge:"Forge run",sync:"Sync run",seed:"Seed run",autopilot:"Autopilot run",frozen:"Frozen Dataset load",empty:"emptying",replay:"checkpoint replay"};function Q(e){return`Before ${Y[e]} ${T}`}function se(e,t){let{min:n,max:r}=R,o=i=>typeof i=="number"&&Number.isInteger(i)&&i>=n&&i<=r;if(e!==void 0){if(!o(e))throw new RangeError(`Not a number of days to keep a checkpoint, ${n} to ${r}: ${e}`);return e}return o(t)?t:R.default}function X(e,t){return{mode:"picked",objects:e.picked,...e.excluded.length>0?{excluded:e.excluded}:{},nameWithDate:Q(t.module),keepDays:t.keepDays,unprovenLeftOut:!0,beforeRun:{module:t.module,operationId:t.operationId,tool:t.tool}}}function j(e,t){let{checkpoint:n}=t,r=w(e,n.objects.map(({objectApiName:o})=>o),n.scope.leftOut);return{state:"taken",checkpointId:n.checkpointId,name:n.name,takenAt:n.takenAt,expiresAt:n.expiresAt,objects:r.objects,records:n.objects.reduce((o,i)=>o+i.records,0),bytes:n.bytes,requests:t.requests?.total??t.estimate.apiRequests,added:r.added,notHeld:r.notHeld}}function D(e){return`${e.operation==="take"?"a checkpoint is being taken":e.operation==="rewind"?"a rewind is writing":e.operation==="undo"?"an undo is writing":e.operation==="empty"?"an emptying of its objects is writing":"SandForge is deleting checkpoints"} (process ${e.pid} on ${e.host})`}async function Z(e,t,n){let r=w(t,n.checkpoint.objects.map(({objectApiName:c})=>c),n.checkpoint.scope.leftOut);if(g(t,r,"")===void 0)return{taken:!0,checkpoint:j(t,n)};let o=await e.delete(n.checkpoint.checkpointId),i=o.outcome==="busy"?`It is kept all the same, as ${D(o.holder)}: delete it from the Checkpoints page once that has ended. Nothing was written.`:"It was deleted again; nothing was written.",s=g(t,r,i);return s===void 0?{taken:!0,checkpoint:j(t,n)}:{taken:!1,refusal:s}}function $(e,t,n){return{...e,...X(t,n)}}async function ae(e,t,n){let{scopeCheckpoint:r}=await import("./chunk-TTU5EQZ6.mjs"),o=I(n),i=await r(e,$(t,o,n)),s=G(o,i,n.keepDays);if(s.refusal!==void 0)return s;let c=P(s.estimate.bytes,await(e.freeBytes??_)(e.store.root));return c===void 0?s:{...s,refusal:c}}async function ce(e,t,n,r){let o=await import("./chunk-TTU5EQZ6.mjs"),i=I(n);if(r!==void 0){let c=P(r.estimate.bytes,await(e.freeBytes??_)(e.store.root));if(c!==void 0)return{taken:!1,refusal:c}}let s;try{s=await o.takeCheckpoint(e,$(t,i,n))}catch(c){if(c instanceof o.CheckpointTakeStopped)return{taken:!1,stopped:!0};throw c}return s.taken?Z(e.store,i,s):{taken:!1,refusal:s.refusal}}async function ue(e,t,n){if(n)return{info:t};let r=await e.delete(t.checkpointId);return r.outcome==="busy"?{info:t,notDeleted:`The checkpoint '${t.name}' taken before the run is kept, though the run wrote nothing: ${D(r.holder)}. Delete it from the Checkpoints page once that has ended.`}:{info:{state:"deleted",deleted:"nothingWritten"}}}function de(e){return`The checkpoint before the run was refused: ${e.message.endsWith(k)?e.message.slice(0,-k.length).trimEnd():e.message} Nothing was written. Untick Checkpoint first to run without it, or fix what refuses it.`}function fe(e){return`The checkpoint before the run could not be taken: ${C(e).replace(/\.$/,"")}. Nothing was written.`}var pe="The checkpoint taken before the run was deleted: the run wrote nothing.";function le(e){return`Taking the checkpoint first (${Math.round(e)}%)`}export{re as a,ie as b,I as c,G as d,V as e,P as f,_ as g,Q as h,se as i,X as j,j as k,Z as l,ae as m,ce as n,ue as o,de as p,fe as q,pe as r,le as s};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
+
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
+
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
+
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
+
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
+
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-QACFTHJM.mjs";import"./chunk-JRLYWVF4.mjs";import"./chunk-HLROVOR6.mjs";import"./chunk-VT6P3X6R.mjs";import"./chunk-34SMB5PA.mjs";import"./chunk-KWUS7UAV.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-K5PUMHZU.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as SCENARIO_SIDECAR_SUFFIX,f as compiledForSidecar,g as nodeScenarioSidecarFiles,j as readScenarioRunSidecar,c as scenarioPackFingerprint,d as scenarioRunSidecar,b as scenarioRunSidecarSchema,h as scenarioSidecarPath,e as withAgentChoice,i as writeScenarioRunSidecar};
|