sandforge 1.84.1 → 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-S42RBRH2.mjs → chunk-22L43JMK.mjs} +1 -1
- package/lib/{chunk-Y2DRK37K.mjs → chunk-2LSGWTWX.mjs} +1 -1
- package/lib/{chunk-24RFOFYT.mjs → chunk-2YJJTQNC.mjs} +1 -1
- package/lib/chunk-34SMB5PA.mjs +10 -0
- package/lib/chunk-35B73566.mjs +7 -0
- package/lib/{chunk-3TZSBHEY.mjs → chunk-35IJ4WEU.mjs} +1 -1
- package/lib/chunk-3EHPAFKV.mjs +7 -0
- package/lib/{chunk-6YL7BNYD.mjs → chunk-3HAVVEXF.mjs} +1 -1
- package/lib/{chunk-6JWWSDM6.mjs → chunk-3I6FXFCN.mjs} +1 -1
- package/lib/{chunk-WUUKFE2U.mjs → chunk-3KJCSYXY.mjs} +1 -1
- package/lib/{chunk-2HVOZUM4.mjs → chunk-3L6DVNCR.mjs} +1 -1
- package/lib/chunk-3LRFPGYZ.mjs +7 -0
- package/lib/{chunk-GWZRR3MM.mjs → chunk-3MVWGL5A.mjs} +1 -1
- package/lib/{chunk-KGU4SVIT.mjs → chunk-4CSBZZAL.mjs} +1 -1
- package/lib/{chunk-JE6SCT6R.mjs → chunk-4NSXPONF.mjs} +1 -1
- package/lib/{chunk-UIOMAX56.mjs → chunk-4VLP6RHC.mjs} +1 -1
- package/lib/{chunk-YA6ATMTB.mjs → chunk-4XROG5CT.mjs} +1 -1
- package/lib/chunk-54V4FVEY.mjs +7 -0
- package/lib/chunk-55OJJT2Q.mjs +7 -0
- package/lib/{chunk-6QE6R6RL.mjs → chunk-5EHHQ5UX.mjs} +1 -1
- package/lib/{chunk-FITPY3L4.mjs → chunk-5JMQXHJ2.mjs} +1 -1
- package/lib/{chunk-W6PN6TJG.mjs → chunk-65AMXOQU.mjs} +1 -1
- package/lib/{chunk-3Q353S2R.mjs → chunk-6HHSAPIM.mjs} +1 -1
- package/lib/chunk-6KVBCFVS.mjs +7 -0
- package/lib/chunk-6NG7C2U3.mjs +476 -0
- package/lib/chunk-6ROL3KBM.mjs +7 -0
- package/lib/{chunk-2JDAOWUW.mjs → chunk-72AWCN7U.mjs} +1 -1
- package/lib/{chunk-JLSIWO4Z.mjs → chunk-7KHA5UIQ.mjs} +1 -1
- package/lib/chunk-7O6EFNQS.mjs +10 -0
- package/lib/{chunk-WWTCWWZI.mjs → chunk-A2CH2QGX.mjs} +1 -1
- package/lib/chunk-A2TXLAC3.mjs +276 -0
- package/lib/chunk-ALWVNR34.mjs +7 -0
- package/lib/{chunk-D4GF4FAB.mjs → chunk-ATBQIE2V.mjs} +1 -1
- package/lib/{chunk-NED4MBIM.mjs → chunk-ATQML7ZK.mjs} +1 -1
- package/lib/chunk-AVY742BJ.mjs +7 -0
- package/lib/{chunk-YWEQQL3C.mjs → chunk-AXTB2HJS.mjs} +1 -1
- package/lib/chunk-BBZUGKBZ.mjs +10 -0
- package/lib/chunk-BIDXK7KA.mjs +7 -0
- package/lib/{chunk-O677VOGO.mjs → chunk-BLMJ4WVI.mjs} +1 -1
- package/lib/{chunk-RE7RYF3B.mjs → chunk-BNHJCJJM.mjs} +1 -1
- package/lib/{chunk-5M5FQ7RP.mjs → chunk-BNPQEQXC.mjs} +1 -1
- package/lib/chunk-C5AUNG6T.mjs +37 -0
- package/lib/{chunk-ETDCBLGU.mjs → chunk-C5EQ7GFC.mjs} +1 -1
- package/lib/{chunk-MJZU3U5O.mjs → chunk-C7CKDZMC.mjs} +61 -61
- package/lib/{chunk-HCGXK7G7.mjs → chunk-CB4U22NR.mjs} +1 -1
- package/lib/chunk-CJAWKLAL.mjs +7 -0
- package/lib/chunk-CL75DEMQ.mjs +9 -0
- package/lib/{chunk-VCUXCK36.mjs → chunk-CLUNF4FK.mjs} +1 -1
- package/lib/chunk-CSMGP53U.mjs +7 -0
- package/lib/{chunk-7YNM6KFZ.mjs → chunk-CT324C7I.mjs} +1 -1
- package/lib/{chunk-7UVKIWKV.mjs → chunk-CZXDJXQP.mjs} +1 -1
- package/lib/{chunk-43TOMFV4.mjs → chunk-D2X6U3MS.mjs} +1 -1
- package/lib/{chunk-M6K34KGF.mjs → chunk-DAUX63UB.mjs} +1 -1
- package/lib/chunk-DB7JNALQ.mjs +10 -0
- package/lib/chunk-DDNCJVZ2.mjs +17 -0
- package/lib/{chunk-FP7CYB2F.mjs → chunk-DLSU66MY.mjs} +1 -1
- package/lib/{chunk-JKJ74BX5.mjs → chunk-DO6PSHQZ.mjs} +1 -1
- package/lib/{chunk-MDMPJEV3.mjs → chunk-DUBECLZV.mjs} +1 -1
- package/lib/{chunk-KZTZDC7H.mjs → chunk-DYHF6DNT.mjs} +1 -1
- package/lib/chunk-E5FSPXYH.mjs +930 -0
- package/lib/{chunk-Q7GIJBCD.mjs → chunk-EGL3I3IX.mjs} +1 -1
- package/lib/chunk-EIYMQPMG.mjs +7 -0
- package/lib/{chunk-RHNTHGNU.mjs → chunk-EUIALBMX.mjs} +1 -1
- package/lib/{chunk-NCZKWSC7.mjs → chunk-FI3R5ZOQ.mjs} +1 -1
- package/lib/{chunk-PAXNWTYK.mjs → chunk-FM4QCTO7.mjs} +1 -1
- package/lib/{chunk-HV7VPEXP.mjs → chunk-FRSIEASH.mjs} +1 -1
- package/lib/{chunk-QAFPQ3YB.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-NSQWI7ZY.mjs → chunk-GFB2DNCB.mjs} +1 -1
- package/lib/chunk-GFGMGFSH.mjs +7 -0
- package/lib/{chunk-RGUQOSBU.mjs → chunk-GIFQXB2Q.mjs} +1 -1
- package/lib/{chunk-JAEDM4SI.mjs → chunk-GP5J3DGS.mjs} +1 -1
- package/lib/chunk-GQZEX7LH.mjs +231 -0
- package/lib/{chunk-JSAJS3MY.mjs → chunk-GYDTM62J.mjs} +1 -1
- package/lib/{chunk-OPMO6I45.mjs → chunk-GYFIXUJG.mjs} +1 -1
- package/lib/chunk-GZW2GNFK.mjs +7 -0
- package/lib/chunk-H6BHWAX7.mjs +8 -0
- package/lib/{chunk-EAC5QCE3.mjs → chunk-HDDJ3CVN.mjs} +1 -1
- package/lib/{chunk-5SMWFNE7.mjs → chunk-HDWB4ZOG.mjs} +1 -1
- package/lib/chunk-HGVPBJR6.mjs +7 -0
- package/lib/{chunk-BBRWFKS5.mjs → chunk-HLROVOR6.mjs} +1 -1
- package/lib/{chunk-LKTNQEBS.mjs → chunk-HUOR4M2L.mjs} +1 -1
- package/lib/chunk-HZCS6EED.mjs +8 -0
- package/lib/{chunk-36JOHEJL.mjs → chunk-HZUI56KZ.mjs} +1 -1
- package/lib/chunk-IAB5H7WN.mjs +7 -0
- package/lib/{chunk-X4BXESMQ.mjs → chunk-IQ5UKRHU.mjs} +1 -1
- package/lib/{chunk-54WZUS7J.mjs → chunk-IRQ4WANV.mjs} +1 -1
- package/lib/{chunk-5IZTFMJM.mjs → chunk-IT3DGX37.mjs} +1 -1
- package/lib/chunk-J347SPU6.mjs +49 -0
- package/lib/{chunk-QO53K5W2.mjs → chunk-JANBNTR5.mjs} +1 -1
- package/lib/chunk-JFXQZPRY.mjs +9 -0
- package/lib/{chunk-KAZS5Z6W.mjs → chunk-JRLYWVF4.mjs} +1 -1
- package/lib/{chunk-GKY2JMHY.mjs → chunk-JSNMUTY6.mjs} +1 -1
- package/lib/chunk-JTNJKSAA.mjs +7 -0
- package/lib/{chunk-7WATA4SB.mjs → chunk-JV2LAKWQ.mjs} +1 -1
- package/lib/{chunk-WAPSSYMT.mjs → chunk-JV7K2ZHK.mjs} +1 -1
- package/lib/{chunk-ZBAWJUG2.mjs → chunk-K4TQ7YHX.mjs} +1 -1
- package/lib/chunk-K5PUMHZU.mjs +7 -0
- package/lib/chunk-KH4KLCYG.mjs +7 -0
- package/lib/{chunk-OLCVHL7I.mjs → chunk-KQVLZVOP.mjs} +1 -1
- package/lib/chunk-KWUS7UAV.mjs +19 -0
- package/lib/{chunk-JGZPD4IM.mjs → chunk-L6G73FXM.mjs} +1 -1
- package/lib/{chunk-BAWCOKRW.mjs → chunk-LG466Q5H.mjs} +1 -1
- package/lib/{chunk-GMIGWR6U.mjs → chunk-LHNAR6FC.mjs} +1 -1
- package/lib/chunk-LT4GHEI2.mjs +7 -0
- package/lib/{chunk-EC72TIEG.mjs → chunk-MR262Y3B.mjs} +1 -1
- package/lib/{chunk-LA4KIATH.mjs → chunk-NCCHOV2N.mjs} +1 -1
- package/lib/chunk-NICRSGLS.mjs +7 -0
- package/lib/chunk-NV5QA2HY.mjs +7 -0
- package/lib/{chunk-PR3XCSPO.mjs → chunk-O3GIN5TU.mjs} +1 -1
- package/lib/chunk-O6FHK6NQ.mjs +13 -0
- package/lib/{chunk-M4BLK6HJ.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-N4WPCWJO.mjs → chunk-OO2WY3UB.mjs} +1 -1
- package/lib/{chunk-MSIEU5MR.mjs → chunk-OT2NHL2V.mjs} +1 -1
- package/lib/{chunk-6WX5ZU7Q.mjs → chunk-P2M5ZXWU.mjs} +1 -1
- package/lib/{chunk-GNRSF65U.mjs → chunk-P4YOHLZ4.mjs} +1 -1
- package/lib/chunk-PBHDPTT6.mjs +343 -0
- package/lib/chunk-PE7CHD2W.mjs +7 -0
- package/lib/{chunk-PBY2O6OF.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-J3DND3BC.mjs → chunk-QGVL5EW3.mjs} +1 -1
- package/lib/chunk-QHE2RUWX.mjs +7 -0
- package/lib/{chunk-QKEKG2LD.mjs → chunk-RCW5BZNW.mjs} +1 -1
- package/lib/{chunk-4JE4BYXK.mjs → chunk-RJ6HHG7J.mjs} +1 -1
- package/lib/{chunk-ZQWIVYVM.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-WY5V5PR3.mjs → chunk-RZOINFNL.mjs} +1 -1
- package/lib/chunk-SOOTWGMQ.mjs +7 -0
- package/lib/chunk-STQ2JMIZ.mjs +7 -0
- package/lib/{chunk-6PD6K7LP.mjs → chunk-SUIPDW5O.mjs} +1 -1
- package/lib/{chunk-TNT27RBG.mjs → chunk-SZOJ7BEJ.mjs} +1 -1
- package/lib/{chunk-4EOHEDFP.mjs → chunk-T542Z54E.mjs} +1 -1
- package/lib/chunk-TAN2CIRI.mjs +21 -0
- package/lib/{chunk-A3MYSOOC.mjs → chunk-TCNBINOG.mjs} +1 -1
- package/lib/chunk-TFDF3DBN.mjs +7 -0
- package/lib/chunk-TICZXC53.mjs +9 -0
- package/lib/chunk-TLX45X5U.mjs +7 -0
- package/lib/{chunk-QTG6LUZT.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-UCUFLFNK.mjs +7 -0
- package/lib/chunk-UK3QLBHW.mjs +7 -0
- package/lib/{chunk-IZGCEOYO.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-OFTT7J2M.mjs → chunk-VFKG2G37.mjs} +1 -1
- package/lib/chunk-VJNEW5MQ.mjs +7 -0
- package/lib/{chunk-L53JWJ3S.mjs → chunk-VKREON6Q.mjs} +1 -1
- package/lib/{chunk-NOBQTEQD.mjs → chunk-VNNDYPBL.mjs} +1 -1
- package/lib/{chunk-ZJW6YOMV.mjs → chunk-VRBETPHY.mjs} +1 -1
- package/lib/{chunk-EPFCERGL.mjs → chunk-VT6P3X6R.mjs} +1 -1
- package/lib/{chunk-ZV7ZFQQC.mjs → chunk-VUTQY76O.mjs} +1 -1
- package/lib/chunk-WF5S4FW5.mjs +7 -0
- package/lib/{chunk-Z4LKKOFY.mjs → chunk-WJGK6VGU.mjs} +1 -1
- package/lib/{chunk-5CRLRHOJ.mjs → chunk-WJHMB3SL.mjs} +1 -1
- package/lib/{chunk-OUZQPYT3.mjs → chunk-WQCXOZEJ.mjs} +1 -1
- package/lib/{chunk-L2E5WBGD.mjs → chunk-WVVFR4E3.mjs} +1 -1
- package/lib/{chunk-PWRJRL5U.mjs → chunk-XBYXT74L.mjs} +1 -1
- package/lib/chunk-XJE3LJHP.mjs +7 -0
- package/lib/{chunk-CPQIZGG5.mjs → chunk-XV4CVZYD.mjs} +1 -1
- package/lib/chunk-Y37ED7AS.mjs +7 -0
- package/lib/{chunk-YTLUYSMF.mjs → chunk-YGBNZYT4.mjs} +1 -1
- package/lib/{chunk-4CVUUVGJ.mjs → chunk-YGTOX7IL.mjs} +1 -1
- package/lib/{chunk-OMNMLKDT.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-B63POIPQ.mjs → chunk-YZKZC62O.mjs} +1 -1
- package/lib/{chunk-DPMRIMUC.mjs → chunk-YZQN7BRB.mjs} +1 -1
- package/lib/{chunk-7SQSWVAU.mjs → chunk-Z5IUK2QO.mjs} +1 -1
- package/lib/{chunk-M2ABR4JM.mjs → chunk-ZEGSMW5A.mjs} +1 -1
- package/lib/{chunk-PR42EZSR.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 +32 -14
- 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-23SEDORH.mjs +0 -11
- package/lib/chunk-26POJDIT.mjs +0 -7
- package/lib/chunk-2AZQHBEF.mjs +0 -7
- package/lib/chunk-2METQHGG.mjs +0 -7
- package/lib/chunk-2WFIVO4F.mjs +0 -13
- package/lib/chunk-2YHZBUZE.mjs +0 -7
- package/lib/chunk-326AJTIU.mjs +0 -272
- package/lib/chunk-3PVRGTVK.mjs +0 -7
- package/lib/chunk-5XTUSN72.mjs +0 -8
- package/lib/chunk-6I6TWNV5.mjs +0 -7
- package/lib/chunk-6O222PW6.mjs +0 -7
- package/lib/chunk-6ZLKIT3H.mjs +0 -7
- package/lib/chunk-7QYHEHMA.mjs +0 -9
- package/lib/chunk-B3FBHVNN.mjs +0 -21
- package/lib/chunk-BEA27DLS.mjs +0 -7
- package/lib/chunk-BRY3PLIZ.mjs +0 -7
- package/lib/chunk-CBH3TOWK.mjs +0 -341
- package/lib/chunk-CVHNXJH3.mjs +0 -7
- package/lib/chunk-DGDRQRCW.mjs +0 -7
- package/lib/chunk-DUN2EPRC.mjs +0 -7
- package/lib/chunk-E3A3LOCY.mjs +0 -7
- package/lib/chunk-F2424IKX.mjs +0 -7
- package/lib/chunk-F3AQW6IU.mjs +0 -7
- package/lib/chunk-FNJ4SGWO.mjs +0 -7
- package/lib/chunk-GOOVPVWX.mjs +0 -7
- package/lib/chunk-H2BHESDA.mjs +0 -9
- package/lib/chunk-H4CGM6YO.mjs +0 -7
- package/lib/chunk-HIDW7FNV.mjs +0 -9
- package/lib/chunk-HSBXRQTI.mjs +0 -7
- package/lib/chunk-HUZPBE47.mjs +0 -7
- package/lib/chunk-I6E6T6YY.mjs +0 -7
- package/lib/chunk-IUM4NFKI.mjs +0 -10
- package/lib/chunk-IVFVNNGB.mjs +0 -37
- package/lib/chunk-JCFBFF4Y.mjs +0 -7
- package/lib/chunk-JTJK2D36.mjs +0 -7
- package/lib/chunk-KB4ZHM4Q.mjs +0 -10
- package/lib/chunk-KJWFYBMU.mjs +0 -15
- package/lib/chunk-LC3NDW4N.mjs +0 -7
- package/lib/chunk-OM5NORJG.mjs +0 -7
- package/lib/chunk-OVNMB6Q2.mjs +0 -7
- package/lib/chunk-PEDQPM2P.mjs +0 -926
- package/lib/chunk-PH7SP4YK.mjs +0 -21
- package/lib/chunk-PMN4PAC3.mjs +0 -19
- package/lib/chunk-PMWAFDUB.mjs +0 -48
- package/lib/chunk-PPLVFX6N.mjs +0 -7
- package/lib/chunk-PZBZ7MNC.mjs +0 -7
- package/lib/chunk-QROPNEGY.mjs +0 -14
- package/lib/chunk-RGBGUCJA.mjs +0 -156
- package/lib/chunk-RKTFFCNS.mjs +0 -7
- package/lib/chunk-ROV3QXEF.mjs +0 -475
- package/lib/chunk-RT47RKLY.mjs +0 -7
- package/lib/chunk-SI267LYR.mjs +0 -8
- package/lib/chunk-SRPWW4A2.mjs +0 -10
- package/lib/chunk-T3G6VZNS.mjs +0 -7
- package/lib/chunk-T63U4OZJ.mjs +0 -7
- package/lib/chunk-TEIBWMJM.mjs +0 -7
- package/lib/chunk-TW3N6W5Z.mjs +0 -7
- package/lib/chunk-UBIKR5VO.mjs +0 -7
- package/lib/chunk-UI3JQVRU.mjs +0 -8
- package/lib/chunk-UX3BVH2Y.mjs +0 -7
- package/lib/chunk-VINGECAJ.mjs +0 -10
- package/lib/chunk-VOXJHJIE.mjs +0 -7
- package/lib/chunk-WB2RIVO3.mjs +0 -7
- package/lib/chunk-WXDLQT2O.mjs +0 -10
- package/lib/chunk-XBQGZGWR.mjs +0 -7
- package/lib/chunk-XGGOUNPP.mjs +0 -7
- package/lib/chunk-XKWW3GKF.mjs +0 -7
- package/lib/chunk-YHR4WQPR.mjs +0 -7
- package/lib/chunk-ZQQXSCVI.mjs +0 -7
- package/lib/chunk-ZRUDYB7O.mjs +0 -7
|
@@ -0,0 +1,231 @@
|
|
|
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 le}from"./chunk-TLX45X5U.mjs";import{a as ft,b as ht,c as mt,d as pt}from"./chunk-5GBO4KD5.mjs";import{a as st,j as nt}from"./chunk-QHE2RUWX.mjs";import{c as je}from"./chunk-6FARZYMJ.mjs";import{b as gt,c as wt,g as yt,h as ue}from"./chunk-ON7Y63FK.mjs";import{a as de}from"./chunk-7KHA5UIQ.mjs";import{B as Ae,C as Y,E as et,F as ie,G as X,H as tt,a as He,c as Ue,h as We,i as Ge,j as Je,o as Ye,q as Xe,u as Ke}from"./chunk-YTOTMJTY.mjs";import{a as B,c as ae,d as rt,e as it,f as at,g as dt,h as ut,i as lt,j as ct}from"./chunk-TMIV3IWH.mjs";import{Aa as Be,Kc as Ve}from"./chunk-CJAWKLAL.mjs";import{h as Q,i as K}from"./chunk-VKREON6Q.mjs";import{b as J,f as be,h as ke,k as $e}from"./chunk-DDNCJVZ2.mjs";import{n as U}from"./chunk-C5AUNG6T.mjs";import{q as Ze}from"./chunk-7O6EFNQS.mjs";import{h as Qe}from"./chunk-KWUS7UAV.mjs";import{a as L,c as te}from"./chunk-AL4C3GFT.mjs";import{b as re}from"./chunk-WQCXOZEJ.mjs";import{a as De,b as ne,c as oe,e as _e,f as ve,h as ot}from"./chunk-LCDPCUXS.mjs";import{q as ze}from"./chunk-SZOJ7BEJ.mjs";import{e as Fe,g as qe}from"./chunk-TZE3Y7IQ.mjs";import{b as Me}from"./chunk-CA5NAXSU.mjs";import{Qd as Ce,Rd as H,Sd as G,Vd as Le,Wd as Pe,bd as se,ld as ye,od as Ie,td as Ne,ud as Ee,y as we}from"./chunk-J347SPU6.mjs";import{readFileSync as rs}from"node:fs";import{basename as is,join as as}from"node:path";import{writeFileSync as qt}from"node:fs";import{extname as zt,join as Ht}from"node:path";var Ut={words:1,switches:["--json"],values:["--org","--backup","--store","--max-requests","--out"]},bt=1e6;function Z(t){process.stderr.write(`${t}
|
|
8
|
+
`),process.exit(2)}function vt(t){let o=zt(t).toLowerCase();return o===".md"?"markdown":o===".json"?"json":void 0}function Bt(t){if(t!==void 0)return(!/^[1-9]\d{0,6}$/.test(t)||Number(t)>bt)&&Z(`Not a number of requests, 1 to ${bt}: "${t}"`),Number(t)}function Se(t){return t!==void 0&&vt(t)===void 0&&Z(`--out writes the attestation in Markdown or in JSON: name a .md or a .json file, not "${t}".`),t}function Wt(t){let o=t.slice(2);ne(o,Ut);let e=d=>{let l=o.indexOf(d);return l>=0?o[l+1]:void 0},s=e("--org");s||Z("Missing --org. Run with --help."),oe.test(s)||Z(`Not an sf alias: "${s}"`);let r=e("--backup");r||Z(`Missing --backup: the snapshot a masking run printed, or its set of slices. ${L("backup")} --list --org ${s} lists them.`);let n=Bt(e("--max-requests")),a=Se(e("--out"));return{org:s,backup:r,storeDir:e("--store")??B(),...n!==void 0?{maxRequests:n}:{},...a!==void 0?{out:a}:{},json:o.includes("--json")}}var Vt={clean:"No value left: every record kept was read, and none holds a value it held before.",left:"Values left: records still hold a value they held before the masking, in a field or in their field history.",incomplete:"Incomplete: no value was found left, but records were not read, or no slice kept them."},Gt={email:"email address",phone:"phone number",name:"full name"};function kt(t,o){if(!t||t.length===0)return"";let e=t.slice(0,10);return` \u2014 ${e.join(", ")}${o>e.length?", \u2026":""}`}function Jt(t){let o=t.from==="slices"?"set of slices":"snapshot",e=[`verify ${t.backupId} (${o}${t.template?` of ${t.template.name}`:""}${t.keptAt?`, kept ${t.keptAt}`:""}) in ${t.org.name}`];for(let n of t.objects){e.push(` ${n.objectApiName}: ${n.kept} kept, ${n.verified} verified, ${n.gone} gone since, ${n.notRead} not read${n.notReadCode?` (${n.notReadCode})`:""}`);for(let a of n.fields.filter(d=>d.left>0))e.push(` ${a.fieldApiName}: ${a.left} value(s) left of ${a.compared} compared`+kt(a.leftIds,a.left));for(let a of n.elsewhere)e.push(` found elsewhere: ${a.fieldApiName} (${Gt[a.as]??a.as}) on ${a.records} record(s)${kt(a.ids,a.records)}`);n.fieldsUnseen&&n.fieldsUnseen.length>0&&e.push(` not compared, the org no longer shows them: ${n.fieldsUnseen.join(", ")}`)}for(let n of t.history??[])e.push(` field history of ${n.objectApiName}: `+(n.notTracked?"none kept":n.unread!==void 0?`not read (${n.unread})`:`${n.left??0} line(s) of ${n.historyObject??"its history"} still hold a value of a masked field`));t.slices&&e.push(` slices: ${t.slices.read} read, ${t.slices.restored} restored since, ${t.slices.notTaken} never backed up; ${t.totals.notKept} record(s) no slice kept`);let{reads:s}=t;e.push(` read: ${s.requests} request(s) of at most ${s.maxRequests}, ${(s.durationMs/1e3).toFixed(1)} s`+(s.stoppedAtBound?" \u2014 stopped at that bound: --max-requests reads further":""));let r=t.objects.reduce((n,a)=>n+a.fields.reduce((d,l)=>d+l.compared,0),0);return r>0&&t.totals.valuesLeft===r&&e.push(" Every value compared is still there: the run wrote nothing, or the backup was restored since."),e.push(Vt[t.verdict]),e}function Yt(t){return t.verdict==="clean"?0:1}function Xt(t,o){let{text:e,sha256:s}=gt(o),r=vt(t)==="markdown"?wt(o):e;return qt(t,r,{encoding:"utf8",mode:384}),s}async function xe(t,o,e){let s;try{s=await t.verify(o)}catch(r){let n=r.code;return process.stderr.write(`verify refused${typeof n=="string"?` (${n})`:""}: ${Me(r)}
|
|
9
|
+
`),{code:1}}for(let r of Jt(s))e.log(r);if(e.out!==void 0){let r=Xt(e.out,s);e.log(`attestation: ${e.out} (SHA-256 of its JSON: ${r})`)}return e.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-dataops",command:"verify",verification:s},null,2)}
|
|
10
|
+
`),{code:Yt(s),verification:s}}async function jt(t){let o=Wt(t),e=j=>{process[o.json?"stderr":"stdout"].write(`${j}
|
|
11
|
+
`)},s=ae(o.storeDir);if(s!==void 0){process.stderr.write(`${s}
|
|
12
|
+
`),process.exitCode=1;return}let r=await re(o.org),n=await new de().validateConnection(r.accessToken,r.instanceUrl),a={alias:o.org,orgType:se({isSandbox:n.isSandbox,edition:n.orgType}),metadata:{apiVersion:"66.0",edition:n.orgType}},d=new ue({log:j=>{/^\[WARN\]/.test(j)&&e(` ${j}`)},broker:{postToWebview:()=>{}},orgManager:{getOrg:()=>a},orgRegistry:{getCredentials:async()=>({accessToken:r.accessToken,instanceUrl:r.instanceUrl})},configStore:U(Ht(o.storeDir,"snapshots.json")),infraServices:{backgroundRegistry:new le},nextId:()=>`cli-${Date.now()}-${Math.random().toString(36).slice(2,8)}`});d.setBackupRecordStore(new K(Q(o.storeDir)));let{code:l}=await xe(d,{orgId:o.org,backupId:o.backup,maxRequests:o.maxRequests??Xe},{json:o.json,...o.out!==void 0?{out:o.out}:{},log:e});l!==0&&(process.exitCode=l)}import{existsSync as Kt,writeFileSync as Zt}from"node:fs";import{join as es}from"node:path";var ts={words:1,switches:["--json"],values:["--store","--export","--out"]};function At(t,o){let e=De(t,ts);e!==void 0&&o(`${e} Run with --help.`);let s=a=>{let d=t.indexOf(a);return d>=0?t[d+1]:void 0},r=s("--export"),n=s("--out");return n!==void 0&&r===void 0&&o("--out goes with --export: it names the file the template is written to."),{storeDir:s("--store")??B(),...r!==void 0?{exportId:r}:{},...n!==void 0?{out:n}:{},json:t.includes("--json")}}function ss(t){let o=es(t,"snapshots.json"),e=Kt(o)?new Ke(U(o)).list():[];return[...He,Ue,...e]}function St(t){let o=[];for(let e of t.rules){let s=e.fieldPattern.split(".")[0]??"";s!==""&&!o.includes(s)&&o.push(s)}return o}function xt(t,o,e){let s=` personal fields no rule of the template masks (the inventory read the last ${t.sampleSize} records of each object, ${t.requests} requests):`;if(!(t.notRead.length>0||t.objects.some(a=>a.status==="failed"||a.uncovered.length>0||a.classificationError!==void 0||(a.hiddenClassified?.length??0)>0)))return[`${s} none`];let n=[s];for(let a of t.objects){if(a.status==="failed"){n.push(` ${a.objectApiName}: not read: ${a.message}`);continue}a.classificationError!==void 0&&n.push(` ${a.objectApiName}: how the org classifies its fields was not read, the detector alone named them: ${a.classificationError}`);let d=(a.hiddenClassified??[]).map(l=>` ${a.objectApiName}.${l.fieldApiName}: classified by the org (${Pe(l.orgClassification)||l.orgClassification.classification}), hidden from you: a rule cannot mask it until you can read and edit it`);if(a.uncovered.length===0){n.push(` ${a.objectApiName}: none of its ${a.personal} personal fields`),n.push(...d);continue}for(let l of a.uncovered){let j=l.suggestedRule?l.suggestedRule.ruleType:"no rule, a run cannot write it";n.push(` ${a.objectApiName}.${l.fieldApiName}: ${j} (${l.filled} of ${a.sampled} records sampled hold a value)`)}n.push(...d)}for(let a of t.notRead)n.push(` ${a}: not read, past the ${10} objects one read takes`);if(e!==void 0){let a=te(e.path);return n.push(` to mask them too, add these rules to ${a} and run with --rules ${a}`+(e.savedAs!==void 0?`: a run saves them in the store as template "${e.savedAs}"`:"")),n}return n.push(` to mask them too, write the template to a file (${L("dataops")} templates --export ${o} --out <file>), add these rules to it, and run with --rules <file>`),n}function ns(t){if(t.automatic===!0)return` ${t.id} ${t.name} rules read from the org at the run: every personal field of the objects it masks (ships)`;let o=t.rules.length;return` ${t.id} ${t.name} ${o} rule${o===1?"":"s"} on ${St(t).join(", ")} (${t.saved?"saved":"ships"})`}function Rt(t,o){let e=ss(t.storeDir);if(t.exportId===void 0)return t.json?(o.stdout(`${JSON.stringify({tool:"sandforge-dataops",command:"templates",store:t.storeDir,templates:e.map(n=>({id:n.id,name:n.name,saved:n.saved===!0,...n.automatic===!0?{automatic:!0}:{},objects:St(n),rules:Ne(n).rules}))},null,2)}
|
|
13
|
+
`),0):(o.stdout([`templates that ship, then those saved in ${t.storeDir}:`,...e.map(ns),`write one to a file: ${L("dataops")} templates --export <id> --out <file>`,""].join(`
|
|
14
|
+
`)),0);let s=e.find(n=>n.id===t.exportId);if(!s)return o.stderr(`No template "${t.exportId}" in ${t.storeDir}. Templates: ${e.map(n=>n.id).join(", ")}
|
|
15
|
+
`),1;if(s.automatic===!0)return o.stderr(`"${s.name}" has no rules of its own: a run reads them from its org. Name it with --template ${s.id}, or save a copy from the panel's Preview.
|
|
16
|
+
`),1;let r=Ee(s);if(t.out===void 0)return o.stdout(r),0;try{Zt(t.out,r,"utf8")}catch(n){return o.stderr(`${t.out} could not be written: ${n instanceof Error?n.message:String(n)}
|
|
17
|
+
`),1}return t.json?(o.stdout(`${JSON.stringify({tool:"sandforge-dataops",command:"templates",exported:{id:s.id,name:s.name,rules:s.rules.length,file:t.out}},null,2)}
|
|
18
|
+
`),0):(o.stdout([`exported "${s.name}", ${s.rules.length} rule(s) and no salt, to ${t.out}`,`mask with it: ${L("dataops")} anonymize --org <alias> --rules ${t.out}`,""].join(`
|
|
19
|
+
`)),0)}var ds=`sandforge dataops \u2014 mask an org's records and put them back, verify a masking, list
|
|
20
|
+
templates, without the editor.
|
|
21
|
+
|
|
22
|
+
Usage:
|
|
23
|
+
npx sandforge dataops anonymize \\
|
|
24
|
+
--org <alias> [--object <ApiName>] (--template <id> | --rules <file>
|
|
25
|
+
| --anonymize-everything) [options]
|
|
26
|
+
npx sandforge dataops anonymize \\
|
|
27
|
+
--org <alias> --restore <snapshot or set> [--slice <k[,k]>] [--rewrite-all]
|
|
28
|
+
[--include-changed] [--store <dir>] [--yes]
|
|
29
|
+
npx sandforge dataops anonymize \\
|
|
30
|
+
--org <alias> (--template <id> | --rules <file>) --abandon [--store <dir>] [--yes]
|
|
31
|
+
npx sandforge dataops verify \\
|
|
32
|
+
--org <alias> --backup <snapshot or set> [--out <file.md|file.json>]
|
|
33
|
+
[--max-requests <n>] [--store <dir>] [--json]
|
|
34
|
+
A run and a restore take [--accept-automation] [--accept-emails] [--mute-automation].
|
|
35
|
+
npx sandforge dataops templates \\
|
|
36
|
+
[--export <id> [--out <file>]] [--store <dir>] [--json]
|
|
37
|
+
|
|
38
|
+
Required:
|
|
39
|
+
anonymize the command; or verify, which reads a masking again, or
|
|
40
|
+
templates, which lists the templates (both below)
|
|
41
|
+
--org <alias> sf CLI alias of the org
|
|
42
|
+
--template <id> a template that ships (tpl-gdpr-standard, tpl-ccpa-california,
|
|
43
|
+
tpl-hipaa-health, tpl-sandbox-scrub, tpl-gdpr-complete,
|
|
44
|
+
tpl-auto-personal) or one saved in the store.
|
|
45
|
+
tpl-auto-personal, Every personal field, masks every
|
|
46
|
+
personal field of the objects, its rules read from the
|
|
47
|
+
org at the run: names of people and companies, every
|
|
48
|
+
part of an address, emails, phones, birthdates, the
|
|
49
|
+
fields the org classifies, free text (redact). Without
|
|
50
|
+
--object, the objects the other templates mask
|
|
51
|
+
and those the org classifies a field of
|
|
52
|
+
--anonymize-everything the same as --template tpl-auto-personal: what the
|
|
53
|
+
sandforge.anonymization.mode setting calls everything.
|
|
54
|
+
${Ce}=everything does the same when
|
|
55
|
+
neither --template nor --rules is given
|
|
56
|
+
--rules <file> or a JSON file of rules, saved in the store as a template:
|
|
57
|
+
{"name": "...", "rules": [{"fieldPattern": "Contact.Email",
|
|
58
|
+
"ruleType": "hash"}]} \u2014 a rule as the panel's editor saves it,
|
|
59
|
+
its ruleType fake, mask, hash, nullify, shuffle,
|
|
60
|
+
preserve_format, constant, truncate or redact: redact
|
|
61
|
+
replaces the personal data a text holds and keeps the rest.
|
|
62
|
+
No other key, and no salt: the run draws its key. A dry
|
|
63
|
+
run saves nothing, and says the name a run saves it under
|
|
64
|
+
|
|
65
|
+
Options:
|
|
66
|
+
--object <ApiName> the object to mask, one per run; without it, every object
|
|
67
|
+
the template masks, as the panel's Apply masks them \u2014
|
|
68
|
+
Account's person accounts among them, in an org that has
|
|
69
|
+
person accounts, when the template masks contacts
|
|
70
|
+
--where <clause> with --object: mask only the records this SOQL condition
|
|
71
|
+
selects, written without WHERE
|
|
72
|
+
--dry-run say what a run would mask \u2014 the fields, the records, the
|
|
73
|
+
first records masked as a run masks them \u2014 and write
|
|
74
|
+
nothing; and the personal fields of those objects no
|
|
75
|
+
rule masks, from an inventory of their last records,
|
|
76
|
+
each with the rule a copy of the template would add
|
|
77
|
+
--slices mask in slices of --max-records records each, consecutive
|
|
78
|
+
by Id, each backed up just before it is masked and masked
|
|
79
|
+
from that backup: an object past what one snapshot holds
|
|
80
|
+
is masked with a way back. With --dry-run, their plan: the
|
|
81
|
+
slices, the requests against what the org has left today,
|
|
82
|
+
the disk and the time. A slice that cannot be backed up
|
|
83
|
+
whole stops the run there, and the slices before it stay
|
|
84
|
+
masked with their backups
|
|
85
|
+
--max-requests <n> with --slices: the most requests the run sends. It stops
|
|
86
|
+
between two slices before the next would send more, exit
|
|
87
|
+
3, and --resume masks the rest
|
|
88
|
+
--purge-history delete, for good, the lines of field history of the fields
|
|
89
|
+
a run masks, for the records it masks, after each page it
|
|
90
|
+
writes: a masking of a tracked field writes its original
|
|
91
|
+
value into the history. Refused before anything is written
|
|
92
|
+
(HISTORY_NOT_DELETABLE, exit 1) where the user may not
|
|
93
|
+
delete them; a dry run says it. A --resume of a run given
|
|
94
|
+
it deletes what that run did not reach
|
|
95
|
+
--resume mask only what the last run of the same template, object
|
|
96
|
+
and filter left, from where it stopped; of a run in
|
|
97
|
+
slices, the rest of its set, with the key it was masked
|
|
98
|
+
with
|
|
99
|
+
--abandon give up the set of slices of the template left open on the
|
|
100
|
+
org: nothing more is masked, and no resume carries it on.
|
|
101
|
+
Its slices stay masked, each with its snapshot, which
|
|
102
|
+
--restore puts back until the retention removes them; the
|
|
103
|
+
records no slice reached keep their values. It writes
|
|
104
|
+
nothing to the org
|
|
105
|
+
--restore <id> put back the values a snapshot holds, by Id: the id a run
|
|
106
|
+
printed, a snapshot's or a set of slices'. Of a set, every
|
|
107
|
+
slice not put back yet, in their order: stopped part way,
|
|
108
|
+
the same line puts back the rest. It reads the org's
|
|
109
|
+
values first and writes only the rows where one of them
|
|
110
|
+
differs from the snapshot, and says how many it found
|
|
111
|
+
unchanged
|
|
112
|
+
--slice <k[,k]> with --restore of a set of slices: only these slices, by
|
|
113
|
+
their number, put back again if they were already
|
|
114
|
+
--rewrite-all with --restore: write every row of the snapshot back,
|
|
115
|
+
the ones the org already holds as the snapshot does
|
|
116
|
+
included; of a set, every slice, those put back already
|
|
117
|
+
too
|
|
118
|
+
--include-changed with --restore of the snapshot a Sync run kept of what
|
|
119
|
+
it wrote over: put back the records changed or deleted
|
|
120
|
+
since the run too, which a restore of it otherwise
|
|
121
|
+
leaves as they are and counts, as removing the run does
|
|
122
|
+
--max-age-days <n> the retention, as sandforge.backup.maxAgeDays sets it:
|
|
123
|
+
snapshots taken more than <n> days ago are removed as
|
|
124
|
+
the command starts, each named on stderr \u2014 the one a
|
|
125
|
+
Sync run kept of what it wrote over too, which removing
|
|
126
|
+
that run then no longer puts back; 0 keeps them all
|
|
127
|
+
(default: 30)
|
|
128
|
+
--store <dir> where snapshots, saved templates and checkpoints live, a
|
|
129
|
+
folder of your own, and the key of each run in slices
|
|
130
|
+
until its set ends, in keys/, read by its owner alone;
|
|
131
|
+
the one sandforge backup reads and lists (default:
|
|
132
|
+
~/.sandforge/backups, under the folder
|
|
133
|
+
SANDFORGE_JOURNAL_DIR names when it is set)
|
|
134
|
+
--max-records <n> most records of the object a snapshot holds, as
|
|
135
|
+
sandforge.backup.maxRecordsPerObject sets it; a run with
|
|
136
|
+
more writes nothing, and a dry run says so \u2014 past it,
|
|
137
|
+
--slices masks in slices of this size (default: 50000;
|
|
138
|
+
100 to 1000000, any other refused, exit 2)
|
|
139
|
+
${mt("written over","--dry-run")} --yes do not ask before writing. Without it, a command with no
|
|
140
|
+
terminal to answer the question \u2014 a CI step \u2014 stops
|
|
141
|
+
there, exit 2, and writes nothing. It answers no to a
|
|
142
|
+
restore into a sandbox refreshed since its snapshot,
|
|
143
|
+
which only a yes typed in a terminal writes
|
|
144
|
+
--verify with a run: once it ended, verify it as verify does, against
|
|
145
|
+
the snapshot it took or its set of slices; a resume of a
|
|
146
|
+
run of no slice verifies the snapshot of the run it resumes
|
|
147
|
+
--out <file> with --verify, or verify: write the attestation there,
|
|
148
|
+
Markdown for a .md file, JSON for a .json one
|
|
149
|
+
--json emit what the panel would receive, every other line on
|
|
150
|
+
stderr; a preview's original values are left out
|
|
151
|
+
--help this text
|
|
152
|
+
|
|
153
|
+
verify reads again, by Id, the records whose values a masking kept before it
|
|
154
|
+
wrote \u2014 the snapshot a run printed, or the set of a run in slices \u2014 and says,
|
|
155
|
+
per object and field, the records still holding a value they held (values
|
|
156
|
+
left), and the text fields of a record holding an address, a phone number by
|
|
157
|
+
its last 8 digits, or a full name kept from its masked fields (found
|
|
158
|
+
elsewhere); records the org no longer gives back, or not read, are counted
|
|
159
|
+
apart. It reads only, at most --max-requests requests (default: 1000), and the
|
|
160
|
+
attestation --out writes holds counts and names, never a value nor a record
|
|
161
|
+
Id: the SHA-256 of its JSON is in its Markdown. Exit codes of verify, and of a
|
|
162
|
+
--verify that ran: 0 no value left and every record read; 1 values left,
|
|
163
|
+
records not read or not kept, or the verification refused (a backup no
|
|
164
|
+
masking kept: only a run's own snapshot, or its slices, can be verified).
|
|
165
|
+
|
|
166
|
+
A run takes a snapshot of the records it masks, their masked fields as they are,
|
|
167
|
+
before its first write, and writes nothing unless the snapshot holds every one of
|
|
168
|
+
them. A production org is refused.
|
|
169
|
+
|
|
170
|
+
With --slices, each slice is backed up just before it is masked, and masked from
|
|
171
|
+
that backup, so a record created since is never masked without one: a run says
|
|
172
|
+
at its end the records created during it in a range a slice masked, which
|
|
173
|
+
--resume masks with a slice of their own. The key the run hashes and draws its
|
|
174
|
+
people with is kept in the store's keys/ until its set is done or given up, so a
|
|
175
|
+
resume, in another process too, masks the same values the same way. While the
|
|
176
|
+
set is open, a new run of the template is refused: --resume masks the rest, and
|
|
177
|
+
--abandon gives the set up. The run writes over REST, 200 records a call, and
|
|
178
|
+
sends no Bulk API batch.
|
|
179
|
+
|
|
180
|
+
Before it writes, a run says what field history keeps of the fields it masks:
|
|
181
|
+
the fields the history tracks, and the lines that already hold their values for
|
|
182
|
+
its records; a dry run says it too. Each record it masks adds a line per tracked
|
|
183
|
+
field, the original value with it, unless --purge-history deletes them.
|
|
184
|
+
|
|
185
|
+
Before it writes, a run and a --restore say what the org runs as the records are
|
|
186
|
+
written over \u2014 its record-triggered flows, Apex triggers, processes and workflow
|
|
187
|
+
rules on update, and on undelete for what a restore brings back from the recycle
|
|
188
|
+
bin \u2014, the emails that sends against what the org has left today, and whether
|
|
189
|
+
the org delivers them; a dry run says it too, and what a real run would be
|
|
190
|
+
refused for (with --json, the dataops:automation:response it carries).
|
|
191
|
+
|
|
192
|
+
Ctrl-C stops a run as the panel's Cancel does: before its next page, what it
|
|
193
|
+
masked recorded in the audit trail of the store, and --resume masks only what it
|
|
194
|
+
left \u2014 of a run in slices, from where the slice it was in stopped. It stops a
|
|
195
|
+
--restore before its next batch, what it put back recorded the same way, and the
|
|
196
|
+
same --restore puts back the rest. Ctrl-C again ends the process at once. A
|
|
197
|
+
SIGTERM \u2014 a CI job cancelled or timed out \u2014 or a SIGHUP stops it the same way.
|
|
198
|
+
|
|
199
|
+
Exit codes: 0 the run masked every record it counted, or the restore put back
|
|
200
|
+
every value; 1 it could not start, was refused or failed \u2014 what the org runs as
|
|
201
|
+
it writes, without --accept-automation (AUTOMATION_NOT_ACCEPTED), emails it
|
|
202
|
+
delivers, without --accept-emails (EMAILS_NOT_ACCEPTED), more emails than it
|
|
203
|
+
has left today (EMAILS_EXCEEDED), a mute refused, or field history it may not
|
|
204
|
+
delete with --purge-history (HISTORY_NOT_DELETABLE) among the reasons \u2014, or a
|
|
205
|
+
--dry-run saw that a run would be refused; 2 a bad command line,
|
|
206
|
+
or a question with no terminal to answer it (give --yes); 3 the run left
|
|
207
|
+
records unmasked, their personal data still in the org (--resume masks what
|
|
208
|
+
it left) \u2014 of a run in slices, slices it did not reach, stopped by
|
|
209
|
+
--max-requests or the org's day, or records created during it in a range a
|
|
210
|
+
slice masked \u2014, or the restore left values as they are (rows the org refused, a
|
|
211
|
+
snapshot that holds part of the records, or records of a Sync run's snapshot
|
|
212
|
+
changed since the run, held back without --include-changed); 130 Ctrl-C
|
|
213
|
+
stopped the run, 143 a SIGTERM, 129 a SIGHUP.
|
|
214
|
+
|
|
215
|
+
templates lists what --template names: the templates that ship, then those
|
|
216
|
+
saved in the store, with their rules and objects. --export <id> writes one to
|
|
217
|
+
--out <file>, or on stdout without it: {"name": "...", "rules": [...]}, each
|
|
218
|
+
rule its field, its method and that method's setting, and no salt. --rules
|
|
219
|
+
takes the file as it is, its rules go under a masking: set of sandforge.yaml as
|
|
220
|
+
they are, and the panel's Import reads it. It reads no org. Exit codes: 0; 1 a
|
|
221
|
+
template the store does not hold, or a file it could not write; 2 a bad line.
|
|
222
|
+
`,us="tpl-rules-file",Ot=1e9,ls=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,cs={words:1,switches:["--dry-run","--resume","--slices","--abandon","--rewrite-all","--include-changed","--purge-history","--yes","--json","--verify",H,...ft],values:["--org","--object","--template","--rules","--where","--restore","--slice","--store","--max-records","--max-requests","--max-age-days","--out"]};function p(t){process.stderr.write(`${t}
|
|
223
|
+
`),process.exit(2)}function fs(t){let o;try{o=JSON.parse(rs(t,"utf8"))}catch(n){p(`Cannot read the rules in ${t}: ${n instanceof Error?n.message:String(n)}`)}let e=Array.isArray(o)?{rules:o}:o,s=typeof e=="object"&&e!==null&&!("name"in e)?{...e,name:`Rules from ${is(t)}`}:e,r=Be.safeParse(s);if(!r.success){let n=r.error.issues.map(a=>`${a.path.join(".")||"(file)"}: ${a.message}`).join("; ");p(`The rules in ${t} are not rules the panel saves: ${n}`)}return r.data}function hs(t,o=process.env){let e=t.slice(2);(e.includes("--help")||e.includes("-h"))&&(process.stdout.write(ds),process.exit(0)),e[0]!=="anonymize"&&p(`The commands are anonymize, verify and templates: ${L("dataops")} anonymize --org \u2026 Run with --help.`),ne(e,cs);let s=$=>{let T=e.indexOf($),D=T>=0?e[T+1]:void 0;return T>=0&&(D===void 0||D.startsWith("--"))&&p(`${$} needs a value.`),D},r=$=>e.filter(T=>T===$).length,n=s("--org");n||p("Missing --org. Run with --help."),oe.test(n)||p(`Not an sf alias: "${n}"`);let a=s("--restore"),d=e.includes("--dry-run"),l=e.includes("--resume"),j=e.includes("--slices"),R=e.includes("--abandon"),c=s("--max-records");c!==void 0&&!/^[1-9]\d*$/.test(c)&&p(`Not a number of records: "${c}"`),c!==void 0&&(Number(c)<ie||Number(c)>X)&&p(`--max-records takes ${ie} to ${X} records, not ${c}: a snapshot holds at least ${ie} records of one object and at most ${X}; past that, --slices masks the object in slices of --max-records records, each backed up just before it is masked, or narrow the run with --where.`);let y=s("--max-requests");y!==void 0&&(!/^[1-9]\d{0,9}$/.test(y)||Number(y)>Ot)&&p(`Not a number of requests, 1 to ${Ot}: "${y}"`),y!==void 0&&!j&&a===void 0&&!R&&p("--max-requests bounds a run in slices: give it with --slices.");let v=it(e,"--slice");v.length>0&&a===void 0&&p("--slice goes with --restore: it names the slices of a set to put back. A run in slices is --slices.");let b=e.includes("--rewrite-all");b&&a===void 0&&p("--rewrite-all goes with --restore.");let C=e.includes("--include-changed");C&&a===void 0&&p("--include-changed goes with --restore.");let k=rt(s("--max-age-days")),A=e.includes("--verify"),O=Se(s("--out"));O!==void 0&&!A&&p("--out writes the attestation of a verification: give it with --verify."),A&&(a!==void 0||R||d)&&p("--verify verifies what a run masked: a --restore, an --abandon or a --dry-run masks nothing. The verify command reads a snapshot or a set on its own.");let g={org:n,verify:A,...O!==void 0?{out:O}:{},rewriteAll:b,includeChanged:C,...k!==void 0?{maxAgeDays:k}:{},storeDir:s("--store")??B(),...c!==void 0?{maxRecords:Number(c)}:{},slices:j,...y!==void 0?{maxRequests:Number(y)}:{},purgeHistory:e.includes("--purge-history"),yes:e.includes("--yes"),json:e.includes("--json"),accord:ht(e)};if(a!==void 0){let $=["--object","--template","--rules","--where","--dry-run","--resume","--slices","--max-requests","--abandon","--purge-history",H].filter(T=>e.includes(T));return $.length>0&&p(`--restore puts a snapshot back as it is: drop ${$.join(", ")}.`),{...g,mode:"restore",restoreId:a,...v.length>0?{restoreSlices:at(v)}:{}}}if(R){let $=["--dry-run","--resume","--max-requests","--purge-history"].filter(T=>e.includes(T));$.length>0&&p(`--abandon gives a set of slices up and masks nothing: drop ${$.join(", ")}.`)}r("--object")>1&&p("Give one --object at most: a run masks one object, or every object its template masks.");let x=s("--object");x!==void 0&&!ls.test(x)&&p(`Not an SObject API name: "${x}"`);let S=s("--template"),P=s("--rules"),M=e.includes(H);M&&(S!==void 0&&S!==G||P!==void 0)&&p(`${H} masks with ${G}, every personal field: drop ${P!==void 0?"--rules":"--template"}, or the flag.`);let w=S??(P===void 0&&Le(M,o)==="everything"?G:void 0);w===void 0==(P===void 0)&&p(`Give one of --template or --rules: the rules a run masks with (or ${H}, every personal field).`),d&&l&&p("Give one of --dry-run or --resume.");let E=s("--where")?.trim();return E!==void 0&&(E===""||!Fe(E))&&p(`Not a filter --where can take: "${E}". ${qe}`),E!==void 0&&x===void 0&&p("--where filters the records of one object: give it with --object."),{...g,mode:R?"abandon":d?"dry-run":l?"resume":"run",...x!==void 0?{object:x}:{},...w!==void 0?{templateId:w}:{},...P!==void 0?{rules:fs(P),rulesFile:P}:{},...E!==void 0?{where:E}:{}}}function Lt(t,o){let e=`${o.toLowerCase()}.`;return t.rules.filter(s=>s.fieldPattern.toLowerCase().startsWith(e)||s.fieldPattern==="*")}function ms(t,o){return Lt(t,o).length>0?!0:o.toLowerCase()===ze.toLowerCase()&&We(t.rules).length>0}function Tt(t,o){let e=s=>JSON.stringify(s.map(r=>[r.fieldPattern.toLowerCase(),r.ruleType,r.config??null]).sort((r,n)=>String(r[0]).localeCompare(String(n[0]))));return e(t)===e(o)}function ps(t){if(t==null||t==="")return"(empty)";let o=typeof t=="string"?t:JSON.stringify(t);return JSON.stringify(o.length>40?`${o.slice(0,39)}\u2026`:o)}function It(t,o){let e=[];typeof t.message=="string"&&e.push(t.message);for(let d of t.objects??[])e.push(` ${d.objectApiName.padEnd(28)} counted ${d.total} masked ${d.processed} refused ${d.failed} still original ${d.notMasked}`);let s=t.errors??[];s[0]&&e.push(` e.g. ${s[0].objectApiName}: ${s[0].message}`);let r=t.snapshot;r&&e.push(`snapshot ${r.operationId}: ${r.totalRecords} record(s) as they were before the run. To put their values back:`,` ${o(r.operationId)}`);let n=t.slices;n&&e.push(...ws(n,o));let a=t.history;for(let d of a?.purge===!0?a.objects:[])e.push(` field history ${d.historyObject.padEnd(22)} deleted ${d.deleted??0} refused ${d.refused??0} left ${d.left??0}`+(d.notReached?` not reached ${d.notReached} masked record(s)`:""));return e}function Nt(t,o){let e=[];for(let s of t??[]){let r=s.rows===void 0?"":`; ${s.atLeast?"at least ":""}${s.rows} line(s) already hold their values for these records`,n=` ${s.objectApiName}: its field history (${s.historyObject})`,a=s.withoutValue??[],d=`${a.join(", ")} ${a.length>1?"are":"is"} tracked without ${a.length>1?"their":"its"} value`;s.trackedFields.length>0?(e.push(`${n} keeps ${s.trackedFields.join(", ")}${r}; a run adds a line per record and field it changes, the original value with it`),a.length>0&&e.push(` ${d}: its lines hold none, and are neither counted nor deleted`)):a.length>0?e.push(`${n}: ${d}${r}; a run adds a line per record and field it changes, with no value in it`):e.push(`${n}${r}`),s.unread!==void 0&&e.push(` not read: ${s.unread}`),ye(s)&&e.push(s.deletable?o?" --purge-history deletes those lines of the records it masks, for good, as it goes":" --purge-history would delete those lines of the records it masks, for good":` they cannot be deleted by this user: ${Je}`)}return e}function gs(t,o){let e=(t??[]).filter(s=>ye(s)&&!s.deletable);return o&&e.length>0?`${Ye(e)} (${Ge})`:void 0}function ws(t,o){let e=t.objects.flatMap(n=>n.slices).sort((n,a)=>n.index-a.index),s=e.filter(n=>n.state==="masked").length,r=[`set ${t.setId} (${t.state}): ${s} of ${e.length} slice(s) masked, up to ${t.size} records a slice, ${t.requestsSpent} request(s) sent by this run`,...e.map(n=>` slice ${n.index} ${n.objectApiName.padEnd(20)} ${n.state.padEnd(8)} ${n.rows} record(s) masked ${n.masked} refused ${n.refused} deleted since ${n.deletedSince}${n.late?" created during the run":""}${n.sizeUsed!==void 0?` read ${n.sizeUsed} at a time`:""} snapshot ${n.snapshotId}`)];return t.lateRecords>0&&r.push(` ${t.lateRecords} record(s) created during the run in a range a slice masked, or past its last: no snapshot holds them, and they keep their values`),e.some(n=>n.state!=="pending")&&r.push("To put back the values its slices hold, every slice in one line:",` ${o(t.setId)}`),r}function ys(t,o){return`${t}.${o}: the org has no such field, or field-level security hides it from this user \u2014 a run is refused and masks nothing (give the user read and edit access to it, or take it out of the template)`}function Et(t,o){return o===void 0?`${t}: this user may not edit its records \u2014 a run is refused (CRUD_FLS_DENIED) and masks nothing (give the user edit access to the object)`:`${t}.${o}: this user may read it and not edit it \u2014 a run is refused (CRUD_FLS_DENIED) and masks nothing (give the user edit access to it, or take it out of the template)`}function bs(t,o={},e=!1){let s=t.fieldsNotFound??[],r=t.objects??[],n=o.objects??[];return s.length>0||r.some(a=>a.notCovered===!0||a.error!==void 0||a.writeDenied!==void 0)||n.some(a=>a.count===null&&!(e&&a.slicePlan!==void 0))}function ks(t,o){let e=[],s=t.objects??[];for(let{objectApiName:a,count:d,slicePlan:l}of s)l!==void 0&&(!o&&d!==null&&d>l.size&&e.push(`${a} holds ${d} record(s), more than the ${l.size} a snapshot holds of one object: --slices masks it in ${l.slices} slices, each backed up just before it is masked (the same line with --slices shows their plan), or narrow the run with --where`),o&&l.slices>we&&e.push(`${a} would take ${l.slices} slices of ${l.size} records, more than the ${we} a set holds: give --max-records up to ${X}, or narrow the run with --where`));let r=t.plan;o&&r?.diskFree!==void 0&&Ae(r.diskBytes)>r.diskFree&&e.push(`the slices' snapshots take about ${Y(Ae(r.diskBytes))}, and the store has ${Y(r.diskFree)} free: give --store a folder on another disk, delete the backups no longer needed, or keep backups fewer days (--max-age-days)`);let n=t.sliceSet;return n?.state==="open"&&e.push(`set ${n.setId} of this template is still open on the org (${n.done} of ${n.total} slice(s) masked, last moved ${n.savedAt}), and a new run would mask its rows again: the same line with --resume masks the rest, and --abandon gives it up`),e}function $s(t,o){let e=t.apiBudget;if(e.verdict==="unread")return`the org's requests left today were not read (${e.unread??"no answer"}): the run stops between two slices if the org's day runs short, and --resume masks the rest`;let s=`of ${e.remaining??"?"} the org has left today`;if(e.verdict==="fits")return`${s}: fits`;if(e.verdict==="near")return`${s}: near it \u2014 the run stops between two slices before the org's integrations run short, and --resume masks the rest`;let r=t.requests/Math.max(1,o),n=Math.max(0,Math.floor((e.remaining??0)/Math.max(1,r)));return`${s}: more than that \u2014 about ${Math.min(n,o)} of the ${o} slices go today, the run stops between two of them, and --resume masks the rest`}function vs(t,o,e){let{snapshots:s,updates:r,reads:n}=t.parts;return[" a run in slices:",` requests: about ${t.requests} (snapshots ${s}, updates ${r}, reads ${n}) ${$s(t,o)}`," Bulk API batches: none (the run writes over REST, 200 records a call)",` disk: about ${Y(t.diskBytes)} in ${e}`+(t.diskFree!==void 0?` (${Y(t.diskFree)} free)`:""),` time: about ${Ie(t.seconds)}`]}function Ct(t){if(t===void 0)return[];let o=[` anonymize everything: ${t.rules.length} rule(s) drawn from the org`+(t.frozen?", those of the run that stopped, kept with where it stopped":"")+` on ${t.objects.join(", ")||"no object"}`+(t.defaultObjects?" (the objects the other templates mask, and those the org classifies a field of: name another with --object)":"")," fields field-level security hides from this user are not read, so not masked"];(t.classifiedObjects??[]).length>0&&o.push(` classified by the org, masked beside the others: ${(t.classifiedObjects??[]).join(", ")}`);let e=t.classifiedObjectsUnmasked??[];for(let[r,n]of[["hidden","its classified fields are hidden from you; give the connected user Read and Edit access to them (field-level security, in a permission set)"],["unwritable","no run may write its personal fields"],["unread","the org would not read it"]]){let a=e.filter(d=>d.reason===r).map(d=>d.objectApiName);a.length>0&&o.push(` classified by the org, nothing it can mask: ${a.join(", ")}: ${n}`)}t.classifiedObjectsUnread!==void 0&&o.push(` the objects the org classifies a field of could not be searched (${t.classifiedObjectsUnread}): only the objects the other templates mask are masked`);let s=r=>r.map(n=>`${n.objectApiName}.${n.fieldApiName}`).join(", ");t.hidden.length>0&&o.push(` classified by the org, hidden from this user, not masked: ${s(t.hidden)}`),t.unwritable.length>0&&o.push(` personal, but no run may write them: ${s(t.unwritable)}`);for(let r of t.unread)o.push(` ${r.objectApiName} not read: ${r.message}`);for(let r of t.classificationRefused)o.push(` ${r.objectApiName}: how the org classifies its fields was not read (${r.message}); the detector alone named them`);return o}function js(t,o,e,s){let r=["dry run \u2014 nothing is written"],n=o.objects??[],a=e.objects??[],d=e.fieldsNotFound??[];for(let c of n){let y=c.count===null?"an unknown number of":String(c.count);r.push(` ${c.objectApiName}: ${y} record(s) to mask`);let v=s!==void 0?c.slicePlan:void 0;c.count===null&&r.push(v!==void 0?" not counted by the org: its own figure of the records plans the slices, approximate; the run reads the object a slice at a time by Id, whatever it holds":" not counted by the org: a run stops at its count and masks nothing"),v!==void 0&&r.push(` slices: ${v.approximate?"about ":""}${v.slices} of up to ${v.size} records, each backed up just before it is masked`);let b=a.find(g=>g.objectApiName===c.objectApiName);if(b?.error){r.push(` not read: ${b.error}`);continue}let C=new Map([...Lt(t,c.objectApiName).map(g=>[g.fieldPattern.split(".").pop()?.toLowerCase()??"",g.ruleType]),...Object.entries(b?.methods??{}).map(([g,x])=>[g.toLowerCase(),x])]),k=b?.fields??[];r.push(` fields: ${k.map(g=>`${g} (${C.get(g.toLowerCase())??"?"})`).join(", ")||"(none)"}`);for(let g of d.filter(x=>x.objectApiName===c.objectApiName))r.push(` ${ys(g.objectApiName,g.fieldApiName)}`);b?.notCovered&&r.push(" no field of it can be masked: a run is refused and masks nothing");let A=b?.writeDenied?.deniedFields;A?.length===0&&r.push(` ${Et(c.objectApiName)}`);for(let g of A??[])r.push(` ${Et(c.objectApiName,g)}`);let O=b?.rows??[];if(O.length>0){r.push(" the first records, masked as a run masks them (a run draws its own key, so its made-up names and digests differ from these):");for(let g of O)r.push(` ${g.id}: ${k.map(x=>`${x} ${ps(g.after[x])}`).join(", ")}`)}}let l=n.reduce((c,y)=>c+(y.count??0),0),j=o.plan;if(s!==void 0&&j!==void 0){let c=n.reduce((y,v)=>y+(v.slicePlan?.slices??0),0);r.push(...vs(j,c,s.store)),r.push(" a run backs each slice up just before it masks it, and masks it from that backup: a slice that cannot be backed up whole stops the run there, and the slices before it stay masked with their backups")}else l>0&&r.push(` a run takes a snapshot of these ${l} record(s) first, and writes nothing without it`);let R=o.checkpoint;return R&&r.push(` a run of this template, object and filter stopped short on ${R.savedAt}: --resume masks only what it left`),r}function As(t){return`interrupted: the restore stopped before it was through; what it restored is in the audit trail, and the same line puts back the rest: ${t}`}function Ss(t){return t!==void 0?`interrupted: the masking stopped before it was through; what it masked is in the audit trail, each slice it masked has its snapshot (--restore ${t} puts their values back), and the same line with --resume masks the rest, from where its slice stopped`:"interrupted: the masking stopped before it was through; what it masked is in the audit trail, the snapshot puts their values back (--restore), and the same line with --resume masks only what it left"}function xs(t){return t.map(o=>{if(o.type!=="dataops:anonymize:preview:response")return o;let e=o.payload?.objects??[];return{...o,payload:{...o.payload,objects:e.map(s=>({...s,rows:(s.rows??[]).map(({id:r,after:n})=>({id:r,after:n}))}))}}})}async function Rs(t=process.argv){if(t[2]==="verify"&&!t.includes("--help")&&!t.includes("-h")){await jt(t);return}let o=t.slice(2);if(o[0]==="templates"&&!o.includes("--help")&&!o.includes("-h")){process.exitCode=Rt(At(o,p),{stdout:i=>process.stdout.write(i),stderr:i=>process.stderr.write(i)});return}let e=hs(t),s=i=>{process[e.json?"stderr":"stdout"].write(`${i}
|
|
224
|
+
`)},r=i=>{process.stderr.write(`${i}
|
|
225
|
+
`),process.exitCode=1},n=ae(e.storeDir);if(n!==void 0){r(n);return}let a=await re(e.org),d=await new de().validateConnection(a.accessToken,a.instanceUrl),l={alias:e.org,orgType:se({isSandbox:d.isSandbox,edition:d.orgType}),metadata:{apiVersion:"66.0",edition:d.orgType}};s(`sandforge dataops ${e.org} (${d.isSandbox?"sandbox":d.orgType||"production"}) store: ${e.storeDir}`);let j=U(as(e.storeDir,"snapshots.json")),R=[],c=new Map,y=new le,v={log:i=>{/^\[(WARN|INFO)\]/.test(i)&&s(` ${i}`)},broker:{postToWebview:i=>{if(R.push(i),i.type!=="operation:progress")return;let u=String(i.payload?.operationId??""),f=Number(i.payload?.percentage??0);(f-(c.get(u)??-10)>=10||f===100)&&(c.set(u,f),s(` ${f}% ${String(i.payload?.currentStep??"")}`))}},orgManager:{getOrg:()=>l},orgRegistry:{getCredentials:async()=>({accessToken:a.accessToken,instanceUrl:a.instanceUrl})},configStore:j,services:{getSandforgeSetting:dt(e)},infraServices:{backgroundRegistry:y,productionGuard:new Ze({requestConfirmation:(i,u)=>(s(`refused: ${e.org} is taken for a ${u} org, and this command writes to none (${i})`),Promise.resolve(!1))}),confirmRestoreIntoReplacedOrg:({alias:i,backedUpFrom:u,now:f})=>e.yes?Promise.resolve(!1):J(`${i} answered as org ${u} when this snapshot was taken and answers as org ${f} now. Write its saved values into the org it is now?`)},nextId:()=>`cli-${Date.now()}-${Math.random().toString(36).slice(2,8)}`},b=new tt(v),C=new yt(v);b.setExpiryListener(i=>process.stderr.write(`${ut(i)}
|
|
226
|
+
`)),b.setRunKeyStore(et(e.storeDir)),b.setBackupRecordStore(new K(Q(e.storeDir))),await b.swept(),b.setSyncRuns(Qe(st())),b.setMuteOffered(nt("--mute-automation")),b.setOnCommandLine(!0);let k=async(i,u)=>{let f=`cli-${i.replaceAll(":","-")}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,h={id:f,type:i,timestamp:Date.now(),payload:u};return await C.handle(h)||await b.handle(h),R.find(I=>I.correlationId===f&&(I.type===`${i}:response`||I.type==="dataops:error"))??{type:"dataops:error",payload:{message:`${i} was not answered.`}}},A=i=>i.type==="dataops:error",O=i=>String(i.payload?.message??i.type),g=i=>`${L("dataops")} anonymize --org ${e.org} --restore ${i} --store ${te(e.storeDir)}`,x=async(i,u)=>{let f=await k("dataops:automation",{orgId:e.org,act:i,objects:u,...e.accord});if(A(f)){r(O(f));return}let h=f.payload;for(let m of h.lines)s(m);return h},S=(i,u={})=>{e.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-dataops",command:i,org:e.org,...i!=="restore"?{anonymizationMode:e.templateId===G?"everything":"standard"}:{},...e.slices?{slices:!0}:{},...e.purgeHistory?{purgeHistory:!0}:{},posted:xs(R),...u},null,2)}
|
|
227
|
+
`)};if(e.mode==="restore"){let i=e.restoreId,u=lt(j,i,{...e.restoreSlices?{slices:e.restoreSlices}:{},rewriteAll:e.rewriteAll});if(!u){r(`No snapshot or set of slices "${i}" in ${e.storeDir}.`);return}let f=u.objects.map(_=>_.objectApiName).join(", "),h=await x("restore",u.objects);if(!h){S("restore");return}if(h.refusals.length>0){S("restore");for(let _ of h.refusals)r(je(_));return}if(!e.yes&&!await J(`Put back into ${e.org} the values ${u.words} holds? ${u.totalRecords} record(s) of ${f} will have those fields written over.`)){s("Nothing written.");return}s(`restoring ${i} into ${e.org}${e.rewriteAll?", every row written back":""}\u2026`);let m,_t=$e(_=>{m=_,ke("the restore stops before its next batch, and says what it restored",_);for(let Ft of y.getRunning())y.abort(Ft.operationId)}),q;try{q=await k("dataops:rollback",{orgId:e.org,operationId:i,...e.rewriteAll?{rewriteAll:!0}:{},...e.includeChanged?{includeChanged:!0}:{},...e.restoreSlices?{slices:e.restoreSlices}:{},...e.accord})}finally{_t()}if(S("restore"),A(q)){r(O(q)),e.yes&&q.payload?.code==="ORG_REPLACED_SINCE_BACKUP"&&r("--yes does not answer this question: it is answered yes only when typed in a terminal. Run the same line without --yes in a terminal to answer it; nothing answers it from a CI step.");return}s(String(q.payload?.message??""));for(let _ of ct(q.payload??{}))s(_);if(m){process.stderr.write(`${As(g(i))}
|
|
228
|
+
`),process.exitCode=be(m);return}ve(_e(q.payload??{}));return}let M=(await k("dataops:anonymization-templates",{})).payload?.templates??[],w,E;if(e.rules){let i=e.rules,u=M.find(h=>h.saved===!0&&h.name.trim().toLowerCase()===i.name.toLowerCase()),f=M.find(h=>h.saved!==!0&&h.name.trim().toLowerCase()===i.name.toLowerCase()&&Tt(h.rules,i.rules));if(f)w=f;else if(u&&Tt(u.rules,i.rules))w=u;else if(e.mode==="dry-run"){let h=i.name.trim().toLowerCase();if(M.some(I=>I.saved!==!0&&I.name.trim().toLowerCase()===h)){r(`a run would be refused: a template named "${i.name}" ships with SandForge, and these rules are not its own; name the file otherwise`);return}let m={id:us,name:i.name,description:"",complianceFramework:"custom",saved:!0,rules:i.rules.map(I=>({...I,description:""}))};b.holdTemplate(m),C.holdTemplate(m),w=m,E=i.name,s(u?`a run replaces template "${u.name}" (${u.id}) in the store, its rules changed, and saves these; a dry run saves nothing`:`a run saves these rules in the store as template "${i.name}"; a dry run saves nothing`)}else{u&&await k("dataops:anonymization-template:delete",{templateId:u.id});let h=await k("dataops:anonymization-template:save",{name:i.name,rules:i.rules});if(A(h)){r(O(h));return}w=h.payload?.template,s(`rules saved in the store as template "${w.name}" (${w.id})`)}}else if(w=M.find(i=>i.id===e.templateId),!w){r(`No template "${e.templateId??""}". Templates: `+M.map(i=>`${i.id}${i.saved?` (saved: ${i.name})`:""}`).join(", "));return}let $=e.object,T=w.automatic===!0;if($!==void 0&&!T&&!ms(w,$)){r(`Template "${w.name}" has no rule for ${$}: a run would mask nothing.`);return}let D={orgId:e.org,templateId:w.id,...$!==void 0?{objects:[$]}:{},...e.where!==void 0?{where:e.where}:{}};if(s(`template: ${w.name} (${w.id}) `+($!==void 0?`object: ${$}`:T?"objects: those the other templates mask":"objects: every object the template masks")+(e.where!==void 0?` where: ${e.where}`:"")+(e.slices?" in slices":"")),e.mode==="abandon"){let i=new Ve(j).openFor(e.org,w.id);if(i&&!e.yes){let f=i.objects.flatMap(m=>m.slices).filter(m=>m.state==="masked").length,h=i.objects.reduce((m,I)=>m+I.slices.length,0);if(!await J(`Give up set ${i.setId} of ${w.name} on ${e.org}, ${f} of ${h} slice(s) masked, last moved ${i.lastActivityAt}? Nothing more is masked and no resume carries it on; its slices stay masked, each with its snapshot, which --restore ${i.setId} puts back until the retention removes them.`)){s("Nothing given up.");return}}let u=await k("dataops:anonymize",{...D,abandon:!0});S("abandon");for(let f of It(u.payload??{},g))s(f);A(u)&&(process.exitCode=1);return}let N=await k("dataops:anonymize:coverage",{...D,...e.slices?{slices:!0}:{}});if(A(N)){r(O(N));return}let W=N.payload?.objects??[],Pt=W.reduce((i,u)=>i+(u.count??0),0),Mt=e.slices?W.filter(i=>i.count===null&&i.slicePlan!==void 0):[],ce=N.payload?.sliceSet,fe=N.payload?.history,V=gs(fe,e.purgeHistory),Re=W.map(i=>({objectApiName:i.objectApiName,records:i.count??(e.slices&&i.slicePlan!==void 0?i.slicePlan.slices*i.slicePlan.size:0)}));if(e.mode==="dry-run"){let i=await k("dataops:anonymize:preview",D);if(A(i)){S("dry-run"),r(O(i));return}for(let m of js(w,N.payload??{},i.payload??{},e.slices?{store:e.storeDir}:void 0))s(m);for(let m of Nt(fe,e.purgeHistory))s(m);for(let m of Ct(N.payload?.automatic))s(m);let u=T?void 0:await k("dataops:anonymize:gaps",{orgId:e.org,templateId:w.id,...$!==void 0?{objects:[$]}:{}});if(u!==void 0&&A(u))s(` the personal fields no rule masks were not read: ${O(u)}`);else if(u!==void 0){let m=e.rulesFile!==void 0?{path:e.rulesFile,...E!==void 0?{savedAs:E}:{}}:void 0;for(let I of xt(u.payload,w.id,m))s(I)}let f=await x("masking",Re);if(S("dry-run"),!f)return;for(let m of pt(f))s(m);let h=ks(N.payload??{},e.slices);for(let m of h)s(` a run would be refused: ${m}`);V!==void 0&&s(` a run would be refused: ${V}`),(V!==void 0||h.length>0||f.refusals.length>0||bs(i.payload??{},N.payload??{},e.slices))&&(process.exitCode=1);return}let he=N.payload?.checkpoint;if(e.mode==="resume"&&!he){r(ce!==void 0?`There is nothing to resume for this object and filter: set ${ce.setId} of this template is open on ${e.org}, its run given another object or filter. Its own line with --resume masks the rest, and --abandon gives it up.`:`There is nothing to resume: no run of this template, object and filter stopped short in ${e.storeDir}.`);return}let Oe=e.mode==="resume"&&ce!==void 0;if(e.mode==="run"&&Pt===0&&Mt.length===0){let i=W.filter(u=>u.count===null).map(u=>u.objectApiName);if(i.length>0){r(`${i.join(", ")}: the org did not count the records a run would mask, so nothing was masked (its reason is in the warning above).`);return}s($!==void 0?"Nothing to mask: no record of the object is under the filter.":"Nothing to mask: no object the template masks holds a record."),S("run");return}for(let i of Ct(N.payload?.automatic))s(i);for(let i of Nt(fe,e.purgeHistory))s(i);if(V!==void 0){S(e.mode),r(V);return}let me=await x("masking",Re);if(!me){S(e.mode);return}if(me.refusals.length>0){S(e.mode);for(let i of me.refusals)r(je(i));return}if(!e.yes){let i=$??W.map(f=>f.objectApiName).join(", "),u=Os(e,w.name,i,N,Oe);if(!await J(e.purgeHistory?`${u} The lines of field history of what it masks are then deleted, for good.`:u)){s("Nothing written.");return}}s(e.mode==="resume"?"resuming\u2026":"masking\u2026");let pe,Dt=$e(i=>{pe=i,ke("the masking stops before its next page, and says what it masked",i);for(let u of y.getRunning())y.abort(u.operationId)}),Te=e.slices||Oe,z;try{z=await k("dataops:anonymize",{...D,...e.mode==="resume"?{resumeFrom:he.id}:{snapshot:!0},...Te?{slices:!0}:{},...Te&&e.maxRequests!==void 0?{maxRequests:e.maxRequests}:{},...e.purgeHistory?{purgeHistory:!0}:{},...e.accord})}finally{Dt()}e.verify||S(e.mode);for(let i of It(z.payload??{},g))s(i);let ee=z.payload?.slices;if(pe){e.verify&&S(e.mode),process.stderr.write(`${Ss(ee?.setId)}
|
|
229
|
+
`),process.exitCode=be(pe);return}if(A(z)){e.verify&&S(e.mode),process.exitCode=1;return}let ge=0;if(e.verify){let u=z.payload?.snapshot?.operationId??ee?.setId??(e.mode==="resume"?`${he.id}-snapshot`:void 0);if(u===void 0)process.stderr.write(`--verify: the run kept no values to verify it against.
|
|
230
|
+
`),ge=1,S(e.mode);else{let f=new ue(v);f.setBackupRecordStore(new K(Q(e.storeDir)));let h=await xe(f,{orgId:e.org,backupId:u},{json:!1,...e.out!==void 0?{out:e.out}:{},log:s});ge=h.code,S(e.mode,h.verification?{verification:h.verification}:{})}}if(Number(z.payload?.recordsNotMasked??0)>0||ee?.state==="open"){ee===void 0&&s("A resume masks only what this run left: the same line with --resume, in place of the snapshot it does not take again."),process.exitCode=3;return}ve(ge)}function Os(t,o,e,s,r){let n=s.payload?.objects??[],a=s.payload?.sliceSet,d=s.payload?.checkpoint;if(t.mode==="resume")return r&&a!==void 0?`Resume the masking of ${e} in ${t.org} in slices, set ${a.setId}: ${a.done} of ${a.total} slice(s) masked, last moved ${a.savedAt}? Each slice left is backed up just before it is masked, with the key the set was masked with.`:`Resume the masking of ${e} in ${t.org} that stopped on ${d?.savedAt??"?"}? What it left is written over; the snapshot the first run took holds their values.`;let l=n.reduce((k,A)=>k+(A.count??0),0),j=n.some(k=>k.count===null),R=j?`the records of ${e}`:`${l} record(s) of ${e}`;if(!t.slices)return`Mask ${R} in ${t.org} with ${o}? A snapshot of their values is taken first.`;let c=n.reduce((k,A)=>k+(A.slicePlan?.slices??0),0),y=s.payload?.plan,v=y?.apiBudget,b=y!==void 0?y.requests/Math.max(1,c):0,C=v?.remaining!==void 0&&b>0?Math.min(c,Math.floor(v.remaining/b)):void 0;return`Mask ${R} in ${t.org} with ${o}, in ${j?"about ":""}${c} slice(s)? Each slice is backed up just before it is masked; if one cannot be backed up whole, the run stops there and the slices before it stay masked with their backups.`+(v?.verdict==="exceeds"&&C!==void 0?` The org has ${v.remaining} requests left today, enough for about ${C} of them: the run stops between two slices, and the same line with --resume masks the rest.`:"")}/sandforge-dataops\.[cm]?[jt]s$/.test(process.argv[1]??"")&&(ot(),Rs().then(()=>process.exit()).catch(t=>{process.stderr.write(`${t instanceof Error?t.message:String(t)}
|
|
231
|
+
`),process.exit(1)}));export{hs as a,ms as b,It as c,Nt as d,gs as e,ws as f,ys as g,Et as h,bs as i,ks as j,vs as k,Ct as l,js as m,As as n,Ss as o,Rs as p,Os 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{a as Re}from"./chunk-FITPY3L4.mjs";import{K as we,Q as Se,b as ye}from"./chunk-6I6TWNV5.mjs";import{Ha as he,Ja as be,i as x,j as fe,k as ge,l as D}from"./chunk-IVFVNNGB.mjs";import{g as ue}from"./chunk-LC3NDW4N.mjs";import{$b as ce,ac as le,bc as N,cc as me,jc as B,xc as pe}from"./chunk-KB4ZHM4Q.mjs";import{h as re}from"./chunk-D4GF4FAB.mjs";import{d as oe,e as se,f as ie,g as ae,h as de}from"./chunk-CVHNXJH3.mjs";import{b as z}from"./chunk-HFSBDM7B.mjs";import{q as F}from"./chunk-TNT27RBG.mjs";import{b as v}from"./chunk-CA5NAXSU.mjs";import{c as ee,d as te,g as ne}from"./chunk-S42RBRH2.mjs";import{Kd as K,Nd as Q,Pd as P,_d as V,be as X,ce as J,de as Y,ee as Z,h as W,i as O,id as H,k as U,vc as G}from"./chunk-PMWAFDUB.mjs";var L=1e4,$e=U.REST_API_BATCH_SIZE;function Oe(e){return e.id===void 0&&e.error!==void 0&&(e.errorDetails?.length??0)>0&&oe([e.error],e.errorDetails)}function Pe(e,r){return e.error===void 0?e:{...e,error:ie(e.error,r)}}function C(e){return{successIds:e.flatMap(r=>r.id===void 0?[]:[r.id]),errors:e.flatMap(r=>r.error===void 0?[]:[r.error])}}function Ae(e,r){if(e.aborted||e.outcomes.length!==r||(e.unmatchedIds?.length??0)>0||(e.failures??[]).some(n=>n.recordIndex<0))return;let t=new Array(r);for(let n of e.outcomes){if(n.recordIndex<0||n.recordIndex>=r)return;if(n.success){if(!n.id)return;t[n.recordIndex]={id:n.id}}else{let o=n.error??"Unknown error",s=te(o);t[n.recordIndex]={error:o,...s?{errorDetails:[s]}:{}}}}return t.every(n=>n!==void 0)?t:void 0}function ze(e){let{conn:r,bulkManager:t,retry:n,signal:o,label:s}=e,p=new re(e.bulkThreshold),g,y=async(f,a,c)=>{g??=be(r).then(l=>(l||e.log(`[WARN] ${s}: the org's duplicate rules could not be read: an object of more than the Bulk API threshold goes as a Bulk API job, which a duplicate rule may refuse`),l));let h=await g;if(h===void 0)return he.has(f)?(e.log(`[INFO] ${s}: ${f} goes through REST: the duplicate rules could not be read, and a standard rule watches it`),!0):!1;let b=h.has(f);return b&&e.log(`[INFO] ${s}: ${f} goes through REST: an active duplicate rule watches it, which a Bulk API job cannot waive`+(a>L?` \u2014 ${a} records in ${Math.ceil(a/Math.max(1,c))} calls, slower than one job`:"")),b},R=async(f,a,c)=>{let h=[];for(let b=0;b<a.length;b+=c){if(o.aborted)return{rows:h,stopped:!0};let l=a.slice(b,b+c);e.calls?.sending(f,l.length);let w=await n.execute(async()=>r.sobject(f).create(l,{headers:G()}));if(w.cancelled)return e.calls?.answered(f,[]),{rows:h,stopped:!0};if(w.success&&w.result){let i=[];for(let m of w.result)if(m.success&&m.id)i.push(m.id),h.push({id:m.id});else{let d=ne(m.errors);h.push({error:d,errorDetails:(m.errors??[]).map(ee)})}e.calls?.answered(f,i)}else{let i=w.error?.message??"Insert failed after retries";for(let m=0;m<l.length;m++)h.push({error:i});e.calls?.answered(f,[])}}return{rows:h}},u=e.wait??(f=>se(f,o)),A=async(f,a,c,h)=>{let b=Math.min(Math.max(1,h),$e),l=await ae({outcomes:c,locked:Oe,written:i=>i.id!==void 0,send:async i=>(await R(f,i.map(m=>a[m]),b)).rows,note:Pe,wait:u,stopped:()=>o.aborted}),w=de("record(s)",l);return{rows:l.outcomes,notes:w===void 0?[]:[`${f}: ${w}.`]}};return async(f,a,c,h)=>{let b=(c.length>L||p.shouldUseBulkApi(c.length))&&await y(a,c.length,h),l=b&&await g===void 0?[`The org's duplicate rules could not be read (the user SandForge connects as needs View Setup and Configuration): ${a}, which a standard duplicate rule watches, was sent through REST, whose header lets its matches be saved, rather than as a Bulk API job.`]:[];if(c.length>L&&!b){if(o.aborted)return{successIds:[],errors:[],stopped:!0};let d=new ye({signal:o}),S={connection:r,bulkManager:t,onProgress:(T,Ie)=>{e.onProgress(T,Ie,`Streaming insert ${a}`)},onOpened:T=>e.calls?.sending(a,c.length,{job:T})};e.calls?.sending(a,c.length);let E=await d.executeChunked(S,a,"insert",d.createChunkGenerator(c),c.length);e.calls?.answered(a,E.aborted?[]:E.successIds);let j=E.aborted?void 0:Ae({outcomes:E.outcomes??[],unmatchedIds:E.unmatchedIds},c.length),k=j&&await A(a,c,j,h);return k&&k.notes.length>0?{...C(k.rows),notes:k.notes}:{successIds:E.successIds,errors:E.errors,...E.aborted?{stopped:!0}:{}}}if(p.shouldUseBulkApi(c.length)&&!b){if(o.aborted)return{successIds:[],errors:[],stopped:!0};let d={connection:r,bulkManager:t,onProgress:(k,T)=>{e.onProgress(k,T,`Bulk insert ${a}`)},signal:o,onOpened:k=>e.calls?.sending(a,c.length,{job:k})};e.calls?.sending(a,c.length);let S=await p.executeBulk(d,a,"insert",c);e.calls?.answered(a,S.aborted?[]:S.successIds);let E=Ae(S,c.length),j=E&&await A(a,c,E,h);return j&&j.notes.length>0?{...C(j.rows),rows:j.rows,notes:j.notes}:{successIds:S.successIds,errors:S.failures.map(k=>k.error),...E?{rows:E}:{},...S.aborted?{stopped:!0}:{}}}let w=await R(a,c,h);if(w.stopped)return{...C(w.rows),rows:w.rows,stopped:!0};let i=await A(a,c,w.rows,h),m=[...l,...i.notes];return{...C(i.rows),rows:i.rows,...m.length>0?{notes:m}:{}}}}var xe="SELECT Id, DeveloperName FROM RecordType WHERE SobjectType = 'Account' AND IsPersonType = true";async function rt(e){try{return(await e.query(xe)).records.flatMap(t=>typeof t.Id=="string"&&typeof t.DeveloperName=="string"?[{id:t.Id,developerName:t.DeveloperName}]:[])}catch{return[]}}function ot(e,r,t){let n=new Set(e===F?t.map(o=>o.id.slice(0,15)):[]);return z(r).filter(o=>!o.master&&o.active&&o.available).map(o=>({recordTypeId:o.recordTypeId,developerName:o.developerName,label:o.name,person:n.has(o.recordTypeId.slice(0,15)),isDefault:o.defaultRecordTypeMapping}))}function Ce(e){let{staticValue:r,picklistValues:t}=e.config;return e.ruleType==="static"&&typeof r=="string"?[r]:e.ruleType==="picklist_random"?[...t??[]]:[]}function st(e,r){if(r.length===0)return{template:e,personObjects:[]};let t=new Map(r.map(s=>[s.id.slice(0,15),s.developerName])),n=[],o=[];for(let s of e.objects){if(s.objectApiName!==F){o.push(s);continue}let p=s.fieldRules.find(u=>u.fieldApiName==="RecordTypeId"),g=p?Ce(p):[],y=g.filter(u=>t.has(u.slice(0,15)));if(y.length>0&&y.length<g.length){let u=y.map(A=>t.get(A.slice(0,15))).join(", ");return{refusal:`${F}: ${u} ${y.length===1?"is a person account record type":"are person account record types"} and the other record types chosen are not: a person account and a business account take different fields. Seed one kind in a run.`}}let R=y.length>0?"person":"business";R==="person"&&n.push(s.objectApiName),o.push({...s,fieldRules:s.fieldRules.filter(u=>!H(F,u.fieldApiName,R))})}return{template:{...e,objects:o},personObjects:n}}var Me=/^[a-z]{2,3}(?:_[A-Za-z0-9]{2,4}){0,2}$/;async function ve(e){try{let t=(await e.query("SELECT DefaultLocaleSidKey FROM Organization LIMIT 1")).records[0]?.DefaultLocaleSidKey;return typeof t=="string"&&Me.test(t)?t:void 0}catch{return}}async function at(e,r){return e??await ve(r)??"en_US"}var ft="SEED_FIT_STORAGE_UNREAD",gt="SEED_CANNOT_FIT";function ht(e,r=!1){return q(e.objects.filter(t=>t.recordCount>0).map(t=>t.objectApiName),r)}function q(e,r=!1){let t=new Set(e);return(n,o)=>t.has(n)&&(o==="insert"||o==="update"&&r&&n===Re)}function bt(e,r,t,n){if(typeof e.unread=="string")return{room:{perRecord:[],notCounted:[],unread:e.unread},unread:e.unread};let o=Z(e,r,t);if(!n)return{running:o,room:x(o,t)};let s=[],p=new Set,g=[];for(let u of o.firing){let A=u.flow,f=A?.requiresFilled??[];if(u.write!=="insert"||A?.condition!=="read"||!A.creates?.length)continue;let a=f.filter(b=>n(u.objectApiName,b)==="every"),c=f.filter(b=>n(u.objectApiName,b)==="some"),h={objectApiName:u.objectApiName,name:u.name};a.length>0&&!Ne(o.firing,u)?(p.add(u),s.push({...h,fields:a,why:"leftEmpty"})):(a.length>0||c.length>0)&&(g.push(u),s.push({...h,fields:a.length>0?a:c,why:a.length>0?"automationMayFill":"mayBeLeftEmpty"}))}let y=x({firing:o.firing.filter(u=>!p.has(u))},t),R=x({firing:g},t).perRecord;return{running:o,room:{...y,...R.length>0?{atMost:R}:{},...s.length>0?{starts:s}:{}}}}function Ne(e,r){return e.some(t=>t!==r&&t.objectApiName===r.objectApiName&&t.write==="insert"&&(t.kind==="trigger"||t.kind==="process"||t.kind==="workflowRule"||t.flow?.timing==="beforeSave"))}async function yt(e,r,t){let n=new Set("objects"in r?r.objects.filter(s=>s.flows.some(p=>(p.requiresFilled??[]).length>0)).map(s=>s.objectApiName):[]),o=new Map;for(let s of e.objects)s.recordCount<=0||!n.has(s.objectApiName)||o.set(s.objectApiName,await t(s.objectApiName).catch(()=>{}));return(s,p)=>{let g=e.objects.find(a=>a.objectApiName===s);if(!g)return"none";let y=a=>a.toLowerCase()===p.toLowerCase();if(g.fieldRules.some(a=>y(a.fieldApiName)))return"none";let R=O(s,e.relations);if(R&&y(R.lookupField))return"none";let u=g.rows??[],A=u.filter(a=>Object.entries(a.values).some(([c,h])=>y(c)&&h!==null&&h!=="")).length;if(u.length>0&&A===u.length)return"none";let f=o.get(s);return f?[...f.filled].some(y)?"none":A>0?"some":[...f.empty].some(y)?"every":"some":"some"}}function M(e,r){return O(e.objectApiName,r)?.distribution.mode==="byKey"?"byKey":e.rows!==void 0?"rows":void 0}function ke(e,r){let t=O(e,r.relations);if(!(!t||t.parents.kind!=="generated"||t.distribution.mode==="byKey"||t.parentObject===e||!r.objects.some(n=>n.objectApiName===t.parentObject)))return t}function Ee(e,r){let t=r?.objects?.[e.objectApiName]??r?.all;return t!==void 0?Math.min(e.recordCount,Math.max(1,Math.floor(t))):e.recordCount}function Be(e,r,t){let n=new Map(e.objects.map(g=>[g.objectApiName,g])),o=new Map,s=new Set,p=g=>{let y=o.get(g);if(y!==void 0)return y;let R=n.get(g);if(M(R,e.relations))return o.set(g,R.recordCount),R.recordCount;s.add(g);let u=Math.round(r*Ee(R,t)),A=ke(g,e),f=A&&!s.has(A.parentObject)?Math.max(1,Math.min(u,W(A.distribution,p(A.parentObject)))):Math.max(1,u);return s.delete(g),o.set(g,f),f};return new Map(e.objects.map(g=>[g.objectApiName,p(g.objectApiName)]))}function De(e,r){if(r.cannotFit!==void 0)return e;let t=new Map(r.objects.map(n=>[n.objectApiName,n.after]));return{...e,objects:e.objects.map(n=>{let o=t.get(n.objectApiName);return o!==void 0&&o<n.recordCount?{...n,recordCount:o}:n})}}function Le(e,r){let t=e.objects.filter(s=>!M(s,e.relations)),n=t.filter(s=>!ke(s.objectApiName,e)),o;for(let s of n.length>0?n:t){let p=Ee(s,r);(!o||p>o.records)&&(o={objectApiName:s.objectApiName,records:p})}return o}function _e(e){return`${e} record${e===1?"":"s"}`}function qe(e){let{template:r,personObjects:t,budget:n,room:o}=e,s=e.ask?.caps,p=e.ask?.share===!0||s===void 0,g=d=>{let S=Be(r,d,s),E=De(r,{objects:r.objects.map(k=>({objectApiName:k.objectApiName,before:k.recordCount,after:S.get(k.objectApiName)??k.recordCount}))}),j=fe(o,k=>S.get(k)??0);return{counts:S,bytes:Se(E,t)+j,roomBytes:j,requests:we(E,e.path),records:[...S.values()].reduce((k,T)=>k+T,0)}},y=d=>d.bytes<=n.bytes,R=d=>n.runRequests===void 0||d.requests<=n.runRequests,u=d=>y(d)&&R(d),A=(d,S,E,j)=>({share:d,budget:{...ge(n,S.roomBytes,o),...E==="apiRequests"?{limitedBy:"apiRequests"}:{}},objects:r.objects.map(k=>{let T=M(k,r.relations);return{objectApiName:k.objectApiName,before:k.recordCount,after:S.counts.get(k.objectApiName)??k.recordCount,...T?{keptWhole:T}:{}}}),estimateMB:S.bytes/1048576,...j!==void 0?{cannotFit:j}:{},...o.unread!==void 0?{automationUnread:o.unread}:{}}),f=(d,S,E,j)=>({proposal:A(d,S,E,j),heldBy:E,records:S.records,requests:S.requests}),a=d=>{if(y(d))return`about ${d.requests} API requests, past the ${n.runRequests??0} that leave the org a tenth of its daily requests`;let S=pe(d.bytes/1048576,n.bytes/1048576);return`${S.over} MB`+(d.roomBytes>0?", room for what the org's automation creates under them included":"")+`, past the ${S.bound} MB that fit`},c=d=>y(d)?"apiRequests":n.terms.limitedBy,h=r.objects.filter(d=>M(d,r.relations)).reduce((d,S)=>d+S.recordCount,0),b=g(1);if(u(b)){let d=r.objects.some(S=>(b.counts.get(S.objectApiName)??0)<S.recordCount);return f(1,b,d?"caps":"whole")}if(!p)return f(1,b,c(b),`with these caps the seed takes ${a(b)}: lower them, or fit by share`);let l=Le(r,s);if(!l)return f(1,b,c(b),`the ${h} rows the template gives take ${a(b)}, and rows are kept whole`);let w=d=>g(d/l.records),i=D(l.records,d=>u(w(d)));if(i===0){let d=w(1);return f(1/l.records,d,c(d),`the least it can be cut to \u2014 one ${l.objectApiName} and what follows it`+(h>0?`, with the ${h} rows the template gives kept whole`:"")+`, ${_e(d.records)} \u2014 takes ${a(d)}`)}let m=D(l.records,d=>y(w(d)));return f(i/l.records,w(i),m>i?"apiRequests":n.terms.limitedBy)}function wt(e,r,t,n,o){if(!("unread"in e))return qe({template:r,personObjects:t,budget:e,room:n,path:o}).proposal}function St(e,r){if(!(!e||e.before<r))return{module:"seed",share:e.share,...e.withinMB!==void 0?{withinMB:e.withinMB}:{},kept:r,inSource:e.before}}var Fe=(e,r)=>r==="insert";function je(e){return typeof e.unread=="string"}function We(e){return(K(e).find(t=>t.write==="insert")?.fired??[]).map(t=>{let n=t.flow,o=n?.messages??[];return{kind:t.kind,name:t.name,when:t.when,emails:o.filter(s=>s.kind==="email").length,messages:[...new Set(o.flatMap(s=>s.kind==="email"?[]:[s.kind]))],creates:[...n?.creates??[]],afterCommit:(n?.paths?.length??0)>0,bypasses:(n?.permissions??[]).filter(s=>s.bypass).map(({name:s,held:p})=>p===void 0?{name:s}:{name:s,held:p}),keptQuiet:t.keptQuiet===!0,unread:n!==void 0&&n.condition!=="read"}})}function $(e){return[...new Set(e)].sort((r,t)=>r.localeCompare(t))}function Te(e,r,t,n,o=Fe){let s=e.objects.flatMap(l=>{let w=We(l);return w.length>0?[{objectApiName:l.objectApiName,entries:w}]:[]}),p=je(t)?void 0:t,g=p!==void 0&&ce(p),y=p!==void 0&&le(p),R=N(P(e),g,y),u=s.flatMap(l=>l.entries.flatMap(w=>w.bypasses)),A=$(u.filter(l=>l.held===!0).map(l=>l.name)),f=$(u.map(l=>l.name)).filter(l=>!A.includes(l)),a=V(e,f),c=f.map(l=>{let w=a.find(i=>i.permission.toLowerCase()===l.toLowerCase())?.permissionSet;return w?{permission:l,permissionSet:w.name}:{permission:l}}),h=X(e,o),b=h.assign.length>0;return{org:r,objectsRead:[...e.objectsRead],objects:s,emailsPerRecord:R,...p&&R.length>0?{limits:{...p}}:{},...je(t)?{limitsUnread:t.unread}:{},alertsAsSingle:g,bypasses:c,bypassesHeld:A,...b?{mute:h,emailsPerRecordMuted:N(P(Y(e,J(h))),g,y)}:{},unread:e.unread.map(({part:l,reason:w})=>({part:l,reason:w})),blinded:Q(e.unread),conditionsNotRead:e.conditionsNotRead,...n?{deliverability:n}:{}}}async function Ft(e){let r=e.writes??q(e.objects),t;try{t=await e.readAutomation(e.objects)}catch(s){return{error:v(s)}}let n=e.deliverability??(e.readDeliverability?(await ue({read:t,writes:Fe,readDeliverability:e.readDeliverability,accepted:!1,target:e.org,run:"seed"})).gate.deliverability:void 0);if(P(t).length===0)return{preview:Te(t,e.org,{},n,r)};let o=await e.readLimits().catch(s=>({unread:v(s)}));return{preview:Te(t,e.org,o,n,r)}}function I(e,r="and"){return e.length<=1?e.join(""):e.length===2?`${e[0]} ${r} ${e[1]}`:`${e.slice(0,-1).join(", ")}, ${r} ${e[e.length-1]}`}var It="SEED_EMAILS_EXCEEDED";function $t(e,r,t){if("error"in e)return{checks:[],unknown:[`what ${t} runs as these records are created could not be read (${e.error}): the emails they make it send are not known`]};let{preview:n}=e,o={objects:r.map(i=>({objectApiName:i.objectApiName,rows:i.recordCount,storageBytes:0}))},s=n.limitsUnread!==void 0?{unread:n.limitsUnread}:n.limits??{},p=me(o,n.emailsPerRecord,s),g=new Set(r.filter(i=>i.recordCount>0).map(i=>i.objectApiName)),y=n.objects.flatMap(i=>g.has(i.objectApiName)?i.entries.filter(m=>m.unread&&!m.keptQuiet&&m.when!=="before").map(m=>`"${m.name}" on ${i.objectApiName}`):[]),R=[...p.filter(i=>i.verdict==="unread").map(i=>`about ${B(i.emails,i.limit)}, but what ${t} has left today could not be read (${i.unread??"not said"})`),...n.blinded?[`part of what ${t} runs could not be read: emails it sends may not be counted`]:[],...y.length>0?[`the emails of ${I(y)} are not counted: what ${y.length===1?"it does":"they do"} was not read`]:n.conditionsNotRead>0?[`${n.conditionsNotRead} start condition(s) of ${t} not read: the emails of those flows are not counted`]:[]],u=p.find(i=>i.verdict==="exceeds");if(!u)return R.length>0?{checks:p,unknown:R}:{checks:p};let A=p.filter(i=>i.verdict==="exceeds"),f=$(A.flatMap(i=>i.objects.map(m=>m.objectApiName))),a=$(A.flatMap(i=>i.objects.flatMap(m=>m.sentBy))),c=new Map;for(let i of n.objects.flatMap(m=>m.entries))if(!(i.emails===0||!a.includes(i.name)))for(let{name:m}of i.bypasses)c.set(m,(c.get(m)??new Set).add(i.name));let h=n.bypasses.flatMap(i=>{let m=c.get(i.permission);return m?[{...i,quiets:$([...m])}]:[]}),b=A.map(i=>`about ${B(i.emails,i.limit)} (`+i.objects.map(m=>`${m.perRecord} per ${m.objectApiName}`).join(", ")+`), ${i.remaining??0} of ${i.max??0} left today`).join("; "),l=["lower the record counts",`set ${I(f)} to 0`,`turn off ${I(a.map(i=>`"${i}"`))}`,...h.map(i=>"give the user the seed writes as "+(i.permissionSet?`the permission set ${i.permissionSet}, whose ${i.permission}`:`a permission set holding ${i.permission}, which`)+` keeps ${I(i.quiets.map(m=>`"${m}"`))} quiet`)],w=`The seed was refused before it wrote anything: its records would make ${t} send ${b}. Past what is left, a flow that sends in the save refuses its record (CANNOT_EXECUTE_FLOW_TRIGGER), and the org's own emails stop for the rest of the day. To seed it, ${I(l,"or")}. Nothing was written.`;return{checks:p,refusal:w,figures:{org:t,limit:u.limit,emails:u.emails,remaining:u.remaining??0,max:u.max??0,objects:f,senders:a,bypasses:h},...R.length>0?{unknown:R}:{}}}var Ue={flow:e=>`flow "${e}"`,trigger:e=>`Apex trigger ${e}`,process:e=>`process "${e}"`,workflowRule:e=>`workflow rule "${e}"`},Ge={before:"before save",after:"after save",beforeAndAfter:"before and after save"},He={notification:"custom notifications",outbound:"outbound messages",sms:"text messages"};function Ke(e){let r=n=>n.held===!0?" (held)":n.held===!1?" (not held)":"",t=[Ge[e.when],...e.emails>0?[`${e.emails} email(s) a record`]:[],...e.messages.map(n=>`sends ${He[n]}`),...e.creates.length>0?[`creates ${e.creates.join(", ")}`]:[],...e.afterCommit?["then after commit"]:[],...e.bypasses.length>0?[`not for a user with ${e.bypasses.map(n=>n.name+r(n)).join(", ")}`]:[],...e.keptQuiet?["quiet for this seed"]:[],...e.unread?["what it does was not read"]:[]];return`${Ue[e.kind](e.name)} (${t.join("; ")})`}function Ot(e,r){if("error"in e)return[`target automation: what ${r} runs as these records are created could not be read (${e.error}): the emails they make it send are not known`];let{preview:t}=e,n=[`target automation: what ${r} runs as these records are created`];for(let o of t.objects)n.push(` ${o.objectApiName}: ${o.entries.map(Ke).join(", ")}`);t.objects.length===0&&n.push(t.blinded?" nothing found in what could be read":" nothing runs on them: no flow, Apex trigger, process or workflow rule"),t.bypassesHeld.length>0&&n.push(` bypass held: the user the seed writes as holds ${t.bypassesHeld.join(", ")}, and what names it stays quiet`);for(let o of t.bypasses)n.push(o.permissionSet?` bypass: ${o.permission} keeps quiet what names it; permission set ${o.permissionSet} holds it`:` bypass: ${o.permission} keeps quiet what names it; no permission set of ${r} was found to hold it`);t.alertsAsSingle&&t.emailsPerRecord.some(o=>o.alertsAmong)&&n.push(` ${r} counts its email alerts against its single emails too, as a Developer Edition does`);for(let{part:o,reason:s}of t.unread)n.push(` ${o} could not be read: ${s}`);return t.conditionsNotRead>0&&n.push(` ${t.conditionsNotRead} start condition(s) not read`),n}export{ze as a,rt as b,ot as c,st as d,at as e,ft as f,gt as g,ht as h,q as i,bt as j,yt as k,De as l,qe as m,wt as n,St as o,Ft as p,It as q,$t as r,Ot as s};
|
|
7
|
+
import{a as Re}from"./chunk-5JMQXHJ2.mjs";import{O as we,U as Se,b as ye}from"./chunk-WF5S4FW5.mjs";import{La as he,Na as be,i as x,j as fe,k as ge,l as D}from"./chunk-C5AUNG6T.mjs";import{g as ue}from"./chunk-ZVU7MD2S.mjs";import{Dc as pe,fc as ce,gc as le,hc as N,ic as me,pc as B}from"./chunk-OLCS7JCT.mjs";import{h as re}from"./chunk-ATBQIE2V.mjs";import{d as oe,e as se,f as ie,g as ae,h as de}from"./chunk-UCUFLFNK.mjs";import{b as z}from"./chunk-HFSBDM7B.mjs";import{q as F}from"./chunk-SZOJ7BEJ.mjs";import{b as v}from"./chunk-CA5NAXSU.mjs";import{c as ee,d as te,g as ne}from"./chunk-22L43JMK.mjs";import{Cc as G,Zd as K,ae as Q,ce as P,h as W,i as O,k as U,ne as V,qd as H,qe as X,re as J,se as Y,te as Z}from"./chunk-J347SPU6.mjs";var L=1e4,$e=U.REST_API_BATCH_SIZE;function Oe(e){return e.id===void 0&&e.error!==void 0&&(e.errorDetails?.length??0)>0&&oe([e.error],e.errorDetails)}function Pe(e,r){return e.error===void 0?e:{...e,error:ie(e.error,r)}}function C(e){return{successIds:e.flatMap(r=>r.id===void 0?[]:[r.id]),errors:e.flatMap(r=>r.error===void 0?[]:[r.error])}}function Ae(e,r){if(e.aborted||e.outcomes.length!==r||(e.unmatchedIds?.length??0)>0||(e.failures??[]).some(n=>n.recordIndex<0))return;let t=new Array(r);for(let n of e.outcomes){if(n.recordIndex<0||n.recordIndex>=r)return;if(n.success){if(!n.id)return;t[n.recordIndex]={id:n.id}}else{let o=n.error??"Unknown error",s=te(o);t[n.recordIndex]={error:o,...s?{errorDetails:[s]}:{}}}}return t.every(n=>n!==void 0)?t:void 0}function ze(e){let{conn:r,bulkManager:t,retry:n,signal:o,label:s}=e,p=new re(e.bulkThreshold),g,y=async(f,a,c)=>{g??=be(r).then(l=>(l||e.log(`[WARN] ${s}: the org's duplicate rules could not be read: an object of more than the Bulk API threshold goes as a Bulk API job, which a duplicate rule may refuse`),l));let h=await g;if(h===void 0)return he.has(f)?(e.log(`[INFO] ${s}: ${f} goes through REST: the duplicate rules could not be read, and a standard rule watches it`),!0):!1;let b=h.has(f);return b&&e.log(`[INFO] ${s}: ${f} goes through REST: an active duplicate rule watches it, which a Bulk API job cannot waive`+(a>L?` \u2014 ${a} records in ${Math.ceil(a/Math.max(1,c))} calls, slower than one job`:"")),b},R=async(f,a,c)=>{let h=[];for(let b=0;b<a.length;b+=c){if(o.aborted)return{rows:h,stopped:!0};let l=a.slice(b,b+c);e.calls?.sending(f,l.length);let w=await n.execute(async()=>r.sobject(f).create(l,{headers:G()}));if(w.cancelled)return e.calls?.answered(f,[]),{rows:h,stopped:!0};if(w.success&&w.result){let i=[];for(let m of w.result)if(m.success&&m.id)i.push(m.id),h.push({id:m.id});else{let d=ne(m.errors);h.push({error:d,errorDetails:(m.errors??[]).map(ee)})}e.calls?.answered(f,i)}else{let i=w.error?.message??"Insert failed after retries";for(let m=0;m<l.length;m++)h.push({error:i});e.calls?.answered(f,[])}}return{rows:h}},u=e.wait??(f=>se(f,o)),A=async(f,a,c,h)=>{let b=Math.min(Math.max(1,h),$e),l=await ae({outcomes:c,locked:Oe,written:i=>i.id!==void 0,send:async i=>(await R(f,i.map(m=>a[m]),b)).rows,note:Pe,wait:u,stopped:()=>o.aborted}),w=de("record(s)",l);return{rows:l.outcomes,notes:w===void 0?[]:[`${f}: ${w}.`]}};return async(f,a,c,h)=>{let b=(c.length>L||p.shouldUseBulkApi(c.length))&&await y(a,c.length,h),l=b&&await g===void 0?[`The org's duplicate rules could not be read (the user SandForge connects as needs View Setup and Configuration): ${a}, which a standard duplicate rule watches, was sent through REST, whose header lets its matches be saved, rather than as a Bulk API job.`]:[];if(c.length>L&&!b){if(o.aborted)return{successIds:[],errors:[],stopped:!0};let d=new ye({signal:o}),S={connection:r,bulkManager:t,onProgress:(T,Ie)=>{e.onProgress(T,Ie,`Streaming insert ${a}`)},onOpened:T=>e.calls?.sending(a,c.length,{job:T})};e.calls?.sending(a,c.length);let E=await d.executeChunked(S,a,"insert",d.createChunkGenerator(c),c.length);e.calls?.answered(a,E.aborted?[]:E.successIds);let j=E.aborted?void 0:Ae({outcomes:E.outcomes??[],unmatchedIds:E.unmatchedIds},c.length),k=j&&await A(a,c,j,h);return k&&k.notes.length>0?{...C(k.rows),notes:k.notes}:{successIds:E.successIds,errors:E.errors,...E.aborted?{stopped:!0}:{}}}if(p.shouldUseBulkApi(c.length)&&!b){if(o.aborted)return{successIds:[],errors:[],stopped:!0};let d={connection:r,bulkManager:t,onProgress:(k,T)=>{e.onProgress(k,T,`Bulk insert ${a}`)},signal:o,onOpened:k=>e.calls?.sending(a,c.length,{job:k})};e.calls?.sending(a,c.length);let S=await p.executeBulk(d,a,"insert",c);e.calls?.answered(a,S.aborted?[]:S.successIds);let E=Ae(S,c.length),j=E&&await A(a,c,E,h);return j&&j.notes.length>0?{...C(j.rows),rows:j.rows,notes:j.notes}:{successIds:S.successIds,errors:S.failures.map(k=>k.error),...E?{rows:E}:{},...S.aborted?{stopped:!0}:{}}}let w=await R(a,c,h);if(w.stopped)return{...C(w.rows),rows:w.rows,stopped:!0};let i=await A(a,c,w.rows,h),m=[...l,...i.notes];return{...C(i.rows),rows:i.rows,...m.length>0?{notes:m}:{}}}}var xe="SELECT Id, DeveloperName FROM RecordType WHERE SobjectType = 'Account' AND IsPersonType = true";async function rt(e){try{return(await e.query(xe)).records.flatMap(t=>typeof t.Id=="string"&&typeof t.DeveloperName=="string"?[{id:t.Id,developerName:t.DeveloperName}]:[])}catch{return[]}}function ot(e,r,t){let n=new Set(e===F?t.map(o=>o.id.slice(0,15)):[]);return z(r).filter(o=>!o.master&&o.active&&o.available).map(o=>({recordTypeId:o.recordTypeId,developerName:o.developerName,label:o.name,person:n.has(o.recordTypeId.slice(0,15)),isDefault:o.defaultRecordTypeMapping}))}function Ce(e){let{staticValue:r,picklistValues:t}=e.config;return e.ruleType==="static"&&typeof r=="string"?[r]:e.ruleType==="picklist_random"?[...t??[]]:[]}function st(e,r){if(r.length===0)return{template:e,personObjects:[]};let t=new Map(r.map(s=>[s.id.slice(0,15),s.developerName])),n=[],o=[];for(let s of e.objects){if(s.objectApiName!==F){o.push(s);continue}let p=s.fieldRules.find(u=>u.fieldApiName==="RecordTypeId"),g=p?Ce(p):[],y=g.filter(u=>t.has(u.slice(0,15)));if(y.length>0&&y.length<g.length){let u=y.map(A=>t.get(A.slice(0,15))).join(", ");return{refusal:`${F}: ${u} ${y.length===1?"is a person account record type":"are person account record types"} and the other record types chosen are not: a person account and a business account take different fields. Seed one kind in a run.`}}let R=y.length>0?"person":"business";R==="person"&&n.push(s.objectApiName),o.push({...s,fieldRules:s.fieldRules.filter(u=>!H(F,u.fieldApiName,R))})}return{template:{...e,objects:o},personObjects:n}}var Me=/^[a-z]{2,3}(?:_[A-Za-z0-9]{2,4}){0,2}$/;async function ve(e){try{let t=(await e.query("SELECT DefaultLocaleSidKey FROM Organization LIMIT 1")).records[0]?.DefaultLocaleSidKey;return typeof t=="string"&&Me.test(t)?t:void 0}catch{return}}async function at(e,r){return e??await ve(r)??"en_US"}var ft="SEED_FIT_STORAGE_UNREAD",gt="SEED_CANNOT_FIT";function ht(e,r=!1){return q(e.objects.filter(t=>t.recordCount>0).map(t=>t.objectApiName),r)}function q(e,r=!1){let t=new Set(e);return(n,o)=>t.has(n)&&(o==="insert"||o==="update"&&r&&n===Re)}function bt(e,r,t,n){if(typeof e.unread=="string")return{room:{perRecord:[],notCounted:[],unread:e.unread},unread:e.unread};let o=Z(e,r,t);if(!n)return{running:o,room:x(o,t)};let s=[],p=new Set,g=[];for(let u of o.firing){let A=u.flow,f=A?.requiresFilled??[];if(u.write!=="insert"||A?.condition!=="read"||!A.creates?.length)continue;let a=f.filter(b=>n(u.objectApiName,b)==="every"),c=f.filter(b=>n(u.objectApiName,b)==="some"),h={objectApiName:u.objectApiName,name:u.name};a.length>0&&!Ne(o.firing,u)?(p.add(u),s.push({...h,fields:a,why:"leftEmpty"})):(a.length>0||c.length>0)&&(g.push(u),s.push({...h,fields:a.length>0?a:c,why:a.length>0?"automationMayFill":"mayBeLeftEmpty"}))}let y=x({firing:o.firing.filter(u=>!p.has(u))},t),R=x({firing:g},t).perRecord;return{running:o,room:{...y,...R.length>0?{atMost:R}:{},...s.length>0?{starts:s}:{}}}}function Ne(e,r){return e.some(t=>t!==r&&t.objectApiName===r.objectApiName&&t.write==="insert"&&(t.kind==="trigger"||t.kind==="process"||t.kind==="workflowRule"||t.flow?.timing==="beforeSave"))}async function yt(e,r,t){let n=new Set("objects"in r?r.objects.filter(s=>s.flows.some(p=>(p.requiresFilled??[]).length>0)).map(s=>s.objectApiName):[]),o=new Map;for(let s of e.objects)s.recordCount<=0||!n.has(s.objectApiName)||o.set(s.objectApiName,await t(s.objectApiName).catch(()=>{}));return(s,p)=>{let g=e.objects.find(a=>a.objectApiName===s);if(!g)return"none";let y=a=>a.toLowerCase()===p.toLowerCase();if(g.fieldRules.some(a=>y(a.fieldApiName)))return"none";let R=O(s,e.relations);if(R&&y(R.lookupField))return"none";let u=g.rows??[],A=u.filter(a=>Object.entries(a.values).some(([c,h])=>y(c)&&h!==null&&h!=="")).length;if(u.length>0&&A===u.length)return"none";let f=o.get(s);return f?[...f.filled].some(y)?"none":A>0?"some":[...f.empty].some(y)?"every":"some":"some"}}function M(e,r){return O(e.objectApiName,r)?.distribution.mode==="byKey"?"byKey":e.rows!==void 0?"rows":void 0}function ke(e,r){let t=O(e,r.relations);if(!(!t||t.parents.kind!=="generated"||t.distribution.mode==="byKey"||t.parentObject===e||!r.objects.some(n=>n.objectApiName===t.parentObject)))return t}function Ee(e,r){let t=r?.objects?.[e.objectApiName]??r?.all;return t!==void 0?Math.min(e.recordCount,Math.max(1,Math.floor(t))):e.recordCount}function Be(e,r,t){let n=new Map(e.objects.map(g=>[g.objectApiName,g])),o=new Map,s=new Set,p=g=>{let y=o.get(g);if(y!==void 0)return y;let R=n.get(g);if(M(R,e.relations))return o.set(g,R.recordCount),R.recordCount;s.add(g);let u=Math.round(r*Ee(R,t)),A=ke(g,e),f=A&&!s.has(A.parentObject)?Math.max(1,Math.min(u,W(A.distribution,p(A.parentObject)))):Math.max(1,u);return s.delete(g),o.set(g,f),f};return new Map(e.objects.map(g=>[g.objectApiName,p(g.objectApiName)]))}function De(e,r){if(r.cannotFit!==void 0)return e;let t=new Map(r.objects.map(n=>[n.objectApiName,n.after]));return{...e,objects:e.objects.map(n=>{let o=t.get(n.objectApiName);return o!==void 0&&o<n.recordCount?{...n,recordCount:o}:n})}}function Le(e,r){let t=e.objects.filter(s=>!M(s,e.relations)),n=t.filter(s=>!ke(s.objectApiName,e)),o;for(let s of n.length>0?n:t){let p=Ee(s,r);(!o||p>o.records)&&(o={objectApiName:s.objectApiName,records:p})}return o}function _e(e){return`${e} record${e===1?"":"s"}`}function qe(e){let{template:r,personObjects:t,budget:n,room:o}=e,s=e.ask?.caps,p=e.ask?.share===!0||s===void 0,g=d=>{let S=Be(r,d,s),E=De(r,{objects:r.objects.map(k=>({objectApiName:k.objectApiName,before:k.recordCount,after:S.get(k.objectApiName)??k.recordCount}))}),j=fe(o,k=>S.get(k)??0);return{counts:S,bytes:Se(E,t)+j,roomBytes:j,requests:we(E,e.path),records:[...S.values()].reduce((k,T)=>k+T,0)}},y=d=>d.bytes<=n.bytes,R=d=>n.runRequests===void 0||d.requests<=n.runRequests,u=d=>y(d)&&R(d),A=(d,S,E,j)=>({share:d,budget:{...ge(n,S.roomBytes,o),...E==="apiRequests"?{limitedBy:"apiRequests"}:{}},objects:r.objects.map(k=>{let T=M(k,r.relations);return{objectApiName:k.objectApiName,before:k.recordCount,after:S.counts.get(k.objectApiName)??k.recordCount,...T?{keptWhole:T}:{}}}),estimateMB:S.bytes/1048576,...j!==void 0?{cannotFit:j}:{},...o.unread!==void 0?{automationUnread:o.unread}:{}}),f=(d,S,E,j)=>({proposal:A(d,S,E,j),heldBy:E,records:S.records,requests:S.requests}),a=d=>{if(y(d))return`about ${d.requests} API requests, past the ${n.runRequests??0} that leave the org a tenth of its daily requests`;let S=pe(d.bytes/1048576,n.bytes/1048576);return`${S.over} MB`+(d.roomBytes>0?", room for what the org's automation creates under them included":"")+`, past the ${S.bound} MB that fit`},c=d=>y(d)?"apiRequests":n.terms.limitedBy,h=r.objects.filter(d=>M(d,r.relations)).reduce((d,S)=>d+S.recordCount,0),b=g(1);if(u(b)){let d=r.objects.some(S=>(b.counts.get(S.objectApiName)??0)<S.recordCount);return f(1,b,d?"caps":"whole")}if(!p)return f(1,b,c(b),`with these caps the seed takes ${a(b)}: lower them, or fit by share`);let l=Le(r,s);if(!l)return f(1,b,c(b),`the ${h} rows the template gives take ${a(b)}, and rows are kept whole`);let w=d=>g(d/l.records),i=D(l.records,d=>u(w(d)));if(i===0){let d=w(1);return f(1/l.records,d,c(d),`the least it can be cut to \u2014 one ${l.objectApiName} and what follows it`+(h>0?`, with the ${h} rows the template gives kept whole`:"")+`, ${_e(d.records)} \u2014 takes ${a(d)}`)}let m=D(l.records,d=>y(w(d)));return f(i/l.records,w(i),m>i?"apiRequests":n.terms.limitedBy)}function wt(e,r,t,n,o){if(!("unread"in e))return qe({template:r,personObjects:t,budget:e,room:n,path:o}).proposal}function St(e,r){if(!(!e||e.before<r))return{module:"seed",share:e.share,...e.withinMB!==void 0?{withinMB:e.withinMB}:{},kept:r,inSource:e.before}}var Fe=(e,r)=>r==="insert";function je(e){return typeof e.unread=="string"}function We(e){return(K(e).find(t=>t.write==="insert")?.fired??[]).map(t=>{let n=t.flow,o=n?.messages??[];return{kind:t.kind,name:t.name,when:t.when,emails:o.filter(s=>s.kind==="email").length,messages:[...new Set(o.flatMap(s=>s.kind==="email"?[]:[s.kind]))],creates:[...n?.creates??[]],afterCommit:(n?.paths?.length??0)>0,bypasses:(n?.permissions??[]).filter(s=>s.bypass).map(({name:s,held:p})=>p===void 0?{name:s}:{name:s,held:p}),keptQuiet:t.keptQuiet===!0,unread:n!==void 0&&n.condition!=="read"}})}function $(e){return[...new Set(e)].sort((r,t)=>r.localeCompare(t))}function Te(e,r,t,n,o=Fe){let s=e.objects.flatMap(l=>{let w=We(l);return w.length>0?[{objectApiName:l.objectApiName,entries:w}]:[]}),p=je(t)?void 0:t,g=p!==void 0&&ce(p),y=p!==void 0&&le(p),R=N(P(e),g,y),u=s.flatMap(l=>l.entries.flatMap(w=>w.bypasses)),A=$(u.filter(l=>l.held===!0).map(l=>l.name)),f=$(u.map(l=>l.name)).filter(l=>!A.includes(l)),a=V(e,f),c=f.map(l=>{let w=a.find(i=>i.permission.toLowerCase()===l.toLowerCase())?.permissionSet;return w?{permission:l,permissionSet:w.name}:{permission:l}}),h=X(e,o),b=h.assign.length>0;return{org:r,objectsRead:[...e.objectsRead],objects:s,emailsPerRecord:R,...p&&R.length>0?{limits:{...p}}:{},...je(t)?{limitsUnread:t.unread}:{},alertsAsSingle:g,bypasses:c,bypassesHeld:A,...b?{mute:h,emailsPerRecordMuted:N(P(Y(e,J(h))),g,y)}:{},unread:e.unread.map(({part:l,reason:w})=>({part:l,reason:w})),blinded:Q(e.unread),conditionsNotRead:e.conditionsNotRead,...n?{deliverability:n}:{}}}async function Ft(e){let r=e.writes??q(e.objects),t;try{t=await e.readAutomation(e.objects)}catch(s){return{error:v(s)}}let n=e.deliverability??(e.readDeliverability?(await ue({read:t,writes:Fe,readDeliverability:e.readDeliverability,accepted:!1,target:e.org,run:"seed"})).gate.deliverability:void 0);if(P(t).length===0)return{preview:Te(t,e.org,{},n,r)};let o=await e.readLimits().catch(s=>({unread:v(s)}));return{preview:Te(t,e.org,o,n,r)}}function I(e,r="and"){return e.length<=1?e.join(""):e.length===2?`${e[0]} ${r} ${e[1]}`:`${e.slice(0,-1).join(", ")}, ${r} ${e[e.length-1]}`}var It="SEED_EMAILS_EXCEEDED";function $t(e,r,t){if("error"in e)return{checks:[],unknown:[`what ${t} runs as these records are created could not be read (${e.error}): the emails they make it send are not known`]};let{preview:n}=e,o={objects:r.map(i=>({objectApiName:i.objectApiName,rows:i.recordCount,storageBytes:0}))},s=n.limitsUnread!==void 0?{unread:n.limitsUnread}:n.limits??{},p=me(o,n.emailsPerRecord,s),g=new Set(r.filter(i=>i.recordCount>0).map(i=>i.objectApiName)),y=n.objects.flatMap(i=>g.has(i.objectApiName)?i.entries.filter(m=>m.unread&&!m.keptQuiet&&m.when!=="before").map(m=>`"${m.name}" on ${i.objectApiName}`):[]),R=[...p.filter(i=>i.verdict==="unread").map(i=>`about ${B(i.emails,i.limit)}, but what ${t} has left today could not be read (${i.unread??"not said"})`),...n.blinded?[`part of what ${t} runs could not be read: emails it sends may not be counted`]:[],...y.length>0?[`the emails of ${I(y)} are not counted: what ${y.length===1?"it does":"they do"} was not read`]:n.conditionsNotRead>0?[`${n.conditionsNotRead} start condition(s) of ${t} not read: the emails of those flows are not counted`]:[]],u=p.find(i=>i.verdict==="exceeds");if(!u)return R.length>0?{checks:p,unknown:R}:{checks:p};let A=p.filter(i=>i.verdict==="exceeds"),f=$(A.flatMap(i=>i.objects.map(m=>m.objectApiName))),a=$(A.flatMap(i=>i.objects.flatMap(m=>m.sentBy))),c=new Map;for(let i of n.objects.flatMap(m=>m.entries))if(!(i.emails===0||!a.includes(i.name)))for(let{name:m}of i.bypasses)c.set(m,(c.get(m)??new Set).add(i.name));let h=n.bypasses.flatMap(i=>{let m=c.get(i.permission);return m?[{...i,quiets:$([...m])}]:[]}),b=A.map(i=>`about ${B(i.emails,i.limit)} (`+i.objects.map(m=>`${m.perRecord} per ${m.objectApiName}`).join(", ")+`), ${i.remaining??0} of ${i.max??0} left today`).join("; "),l=["lower the record counts",`set ${I(f)} to 0`,`turn off ${I(a.map(i=>`"${i}"`))}`,...h.map(i=>"give the user the seed writes as "+(i.permissionSet?`the permission set ${i.permissionSet}, whose ${i.permission}`:`a permission set holding ${i.permission}, which`)+` keeps ${I(i.quiets.map(m=>`"${m}"`))} quiet`)],w=`The seed was refused before it wrote anything: its records would make ${t} send ${b}. Past what is left, a flow that sends in the save refuses its record (CANNOT_EXECUTE_FLOW_TRIGGER), and the org's own emails stop for the rest of the day. To seed it, ${I(l,"or")}. Nothing was written.`;return{checks:p,refusal:w,figures:{org:t,limit:u.limit,emails:u.emails,remaining:u.remaining??0,max:u.max??0,objects:f,senders:a,bypasses:h},...R.length>0?{unknown:R}:{}}}var Ue={flow:e=>`flow "${e}"`,trigger:e=>`Apex trigger ${e}`,process:e=>`process "${e}"`,workflowRule:e=>`workflow rule "${e}"`},Ge={before:"before save",after:"after save",beforeAndAfter:"before and after save"},He={notification:"custom notifications",outbound:"outbound messages",sms:"text messages"};function Ke(e){let r=n=>n.held===!0?" (held)":n.held===!1?" (not held)":"",t=[Ge[e.when],...e.emails>0?[`${e.emails} email(s) a record`]:[],...e.messages.map(n=>`sends ${He[n]}`),...e.creates.length>0?[`creates ${e.creates.join(", ")}`]:[],...e.afterCommit?["then after commit"]:[],...e.bypasses.length>0?[`not for a user with ${e.bypasses.map(n=>n.name+r(n)).join(", ")}`]:[],...e.keptQuiet?["quiet for this seed"]:[],...e.unread?["what it does was not read"]:[]];return`${Ue[e.kind](e.name)} (${t.join("; ")})`}function Ot(e,r){if("error"in e)return[`target automation: what ${r} runs as these records are created could not be read (${e.error}): the emails they make it send are not known`];let{preview:t}=e,n=[`target automation: what ${r} runs as these records are created`];for(let o of t.objects)n.push(` ${o.objectApiName}: ${o.entries.map(Ke).join(", ")}`);t.objects.length===0&&n.push(t.blinded?" nothing found in what could be read":" nothing runs on them: no flow, Apex trigger, process or workflow rule"),t.bypassesHeld.length>0&&n.push(` bypass held: the user the seed writes as holds ${t.bypassesHeld.join(", ")}, and what names it stays quiet`);for(let o of t.bypasses)n.push(o.permissionSet?` bypass: ${o.permission} keeps quiet what names it; permission set ${o.permissionSet} holds it`:` bypass: ${o.permission} keeps quiet what names it; no permission set of ${r} was found to hold it`);t.alertsAsSingle&&t.emailsPerRecord.some(o=>o.alertsAmong)&&n.push(` ${r} counts its email alerts against its single emails too, as a Developer Edition does`);for(let{part:o,reason:s}of t.unread)n.push(` ${o} could not be read: ${s}`);return t.conditionsNotRead>0&&n.push(` ${t.conditionsNotRead} start condition(s) not read`),n}export{ze as a,rt as b,ot as c,st as d,at as e,ft as f,gt as g,ht as h,q as i,bt as j,yt as k,De as l,qe as m,wt as n,St as o,Ft as p,It as q,$t as r,Ot as s};
|
|
@@ -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{h as a,i as b,j as c,k as d,l as e}from"./chunk-
|
|
7
|
+
import{h as a,i as b,j as c,k as d,l as e}from"./chunk-NCCHOV2N.mjs";import"./chunk-2LSGWTWX.mjs";import"./chunk-UV74P4H2.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-4CSBZZAL.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-22L43JMK.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as REPLAY_RECORD_FILE,c as ReplayStore,b as defaultReplayStoreRoot,d as replaysInPlace,e as replaysInPlaceWords};
|
|
@@ -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,k,l,m,n}from"./chunk-JFXQZPRY.mjs";import"./chunk-BBZUGKBZ.mjs";import"./chunk-4NSXPONF.mjs";import"./chunk-XBYXT74L.mjs";import"./chunk-4VLP6RHC.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-VKREON6Q.mjs";import"./chunk-CL75DEMQ.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-3LRFPGYZ.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-YDXMTWAT.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-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{i as REWIND_MUTING_STEP_WORDS,h as REWIND_STEP_WORDS,j as acceptanceRefusal,k as boundsRefusal,l as boundsRefusals,f as firedCount,n as notConfirmedRefusal,a as objectsWrittenBy,b as previewTotals,g as remakeUnasked,e as rewindStepsOf,c as selectionDiff,m as undeletableUnattendedRefusal,d as unpickedActsOf};
|
|
@@ -0,0 +1,8 @@
|
|
|
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{closeSync as J,fstatSync as W,openSync as G,readSync as $,writeSync as K}from"node:fs";var H=384;function ft(a){let e=G(a,"a+",H),t=W(e).size;return{size:()=>t,append:n=>{let i=Buffer.from(n,"utf8"),r=0;for(;r<i.length;)r+=K(e,i,r);t+=i.length},read:(n,i)=>{let r=Buffer.alloc(i),s=0;for(;s<i;){let o=$(e,r,s,i-s,n+s);if(o===0)break;s+=o}return r.subarray(0,s)},close:()=>J(e)}}function E(a,e){return e===void 0?a:`${a}/${e}`}var _=/^[A-Za-z][A-Za-z0-9]*$/,I=/^[0-9a-f]{64}$/,Y=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function M(a){if(typeof a!="object"||a===null)return;let{objectApiName:e,ids:t,sha256:n,readAt:i,query:r}=a;if(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_]{0,79}$/.test(e)||!Array.isArray(t)||!t.every(o=>typeof o=="string"&&Y.test(o))||typeof n!="string"||!I.test(n)||typeof i!="string"||!Number.isFinite(Date.parse(i)))return;let s;if(typeof r=="object"&&r!==null){let{where:o,orderBy:c,limit:u}=r;s={...typeof o=="string"?{where:o}:{},...typeof c=="string"?{orderBy:c}:{},...typeof u=="number"&&Number.isInteger(u)?{limit:u}:{}}}return{objectApiName:e,ids:t,sha256:n,readAt:i,...s?{query:s}:{}}}var b=1,k=2,N=3,y=4,Z={created:b,existing:k,updated:N},P={[b]:"created",[k]:"existing",[N]:"updated"},F={[b]:"c",[k]:"e",[N]:"u",[y]:"i"},R={c:b,e:k,u:N,i:y},q="x",V="a",Q="j",z="d",T="n",v="t",X="b",U="found",tt="found-owed";function ut(a,e,t,n){return JSON.stringify([z,a,e,t,n])}function ht(a){if(!a.startsWith(`["${z}"`))return;let e;try{e=JSON.parse(a)}catch{return}if(!Array.isArray(e))return;let[,,,t,n]=e;if(!(typeof t!="string"||!Number.isFinite(Date.parse(t)))&&!(typeof n!="string"||!Number.isFinite(Date.parse(n))))return{orgAt:t,at:n}}function et(a,e=!1){return JSON.stringify([e?"w":"o",a.objectApiName,a.newId,a.sourceId??"",a.fieldName,a.sourceRefId,a.insertOnly?1:0])}var nt=1024*1024,it=1024*1024,rt=2e4,st=2e4,ot=.6,at=3;function p(a){let e=2166136261;for(let t=0;t<a.length;t++)e^=a.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function m(a){let e=2538058380;for(let t=0;t<a.length;t++)e=Math.imul(e^a.charCodeAt(t),1540483477),e^=e>>>15;return e>>>0}var O=class{constructor(e){this.keyAt=e}keyAt;capacity=1024;used=0;h1=new Uint32Array(this.capacity);h2=new Uint32Array(this.capacity);at=new Float64Array(this.capacity);len=new Uint16Array(this.capacity);code=new Uint8Array(this.capacity);get size(){return this.used}get slots(){return this.capacity}find(e,t,n,i){let r=this.capacity-1,s=n&r;for(;;){let o=this.at[s];if(o===0)return~s;if(this.h1[s]===t&&this.h2[s]===n&&(i===o-1||this.keyAt(o-1,this.len[s])===e))return s;s=s+1&r}}offsetOf(e){return this.at[e]-1}lengthOf(e){return this.len[e]}codeOf(e){return this.code[e]}put(e,t,n,i,r,s){let o=e;e<0&&(this.used+1>this.capacity*ot?(this.grow(),o=this.freeSlotFor(n)):o=~e,this.used++,this.h1[o]=t,this.h2[o]=n),this.at[o]=i+1,this.len[o]=r,this.code[o]=s}freeSlotFor(e){let t=this.capacity-1,n=e&t;for(;this.at[n]!==0;)n=n+1&t;return n}grow(){let{h1:e,h2:t,at:n,len:i,code:r}=this;this.capacity*=2,this.h1=new Uint32Array(this.capacity),this.h2=new Uint32Array(this.capacity),this.at=new Float64Array(this.capacity),this.len=new Uint16Array(this.capacity),this.code=new Uint8Array(this.capacity);for(let s=0;s<n.length;s++){if(n[s]===0)continue;let o=this.freeSlotFor(t[s]);this.h1[o]=e[s],this.h2[o]=t[s],this.at[o]=n[s],this.len[o]=i[s],this.code[o]=r[s]}}};function L(a){return a?a[0]==="p"&&a.length>=3?C(String(a[1]),String(a[2])):a[0]==="g"&&a.length>=3?j(String(a[2])):a[0]===v&&a.length>=2?B(String(a[1])):"":""}function B(a){return`t\0${a}`}function C(a,e){return`p\0${a}\0${e}`}function j(a){return`g\0${a}`}function*dt(a){let e=a.size(),t=0,n=Buffer.alloc(0),i=0;for(;t<e;){let r=a.read(t,Math.min(it,e-t));if(r.length===0)break;t+=r.length;let s=n.length>0?Buffer.concat([n,r]):r,o=0;for(;;){let c=s.indexOf(10,o);if(c<0)break;c>o&&(yield{offset:i+o,length:c-o,text:s.toString("utf8",o,c)}),o=c+1}n=s.subarray(o),i+=o}}var D=class a{constructor(e){this.file=e;this.index=new O((t,n)=>this.idOfLine(t,n)),this.marks=new O((t,n)=>L(S(this.lineAt(t,n)))),this.createdTargets=new O((t,n)=>{let i=S(this.lineAt(t,n));return i?A(String(i[2]??"")):""})}file;index;cache=new Map;pending=[];pendingBytes=0;flushQueued=!1;partStart=Number.POSITIVE_INFINITY;parts=0;mappedCount=0;counts=new Map;earlierByObject=new Map;earlierPastCheckpoint=new Map;checkpointsByObject=new Map;owedCount=0;statuses=new Map;given=new Map;marks;createdTargets;createdUnattributedKeys=new Set;readsHeld=[];withTheirRecordMarked=0;callsSent=0;foundAfterStop=new Set;foundOwingUntold=new Set;plan;rootsNamed;static open(e){let t=new a(e);return t.readWhatIsThere(),t}get partCount(){return this.parts}get resumes(){return this.checkpointsByObject.size>0||this.earlierByObject.size>0||this.owedCount>0}get earlierMapped(){return this.partStart===Number.POSITIVE_INFINITY?this.mappedCount:this.mappedBeforePart}mappedBeforePart=0;beginPart(e){this.flush(),this.mappedBeforePart=this.mappedCount,this.withTheirRecordMarked=0,this.partStart=this.file.size(),this.write({part:{n:this.parts,startedAt:e.toISOString()}}),this.parts++,this.flush()}nameSamplePlan(e){if(!I.test(e.sha256))throw new Error("Not the SHA-256 of a plan.");this.write({sample:{dir:e.dir,sha256:e.sha256}}),this.plan={dir:e.dir,sha256:e.sha256},this.flush()}get samplePlan(){return this.plan?{...this.plan}:void 0}nameRoots(e){let t=M(e);if(!t)throw new Error("Not the roots of a clone from records.");this.write({roots:t}),this.rootsNamed=t,this.flush()}get roots(){return this.rootsNamed?{...this.rootsNamed,ids:[...this.rootsNamed.ids]}:void 0}setMapping(e,t,n,i){let r=Z[e],s=p(t),o=m(t),c=this.cache.get(t),u=this.index.find(t,s,o,c?.at),h=u>=0&&this.index.codeOf(u)!==y;h&&this.uncount(t,u,c);let l=JSON.stringify([F[r],t,n,i??""]),f=this.write(l);if(this.index.put(u,s,o,f,Buffer.byteLength(l),r),r===b&&this.indexCreated(n,f,Buffer.byteLength(l)),h||this.mappedCount++,i){let d=this.countsOf(i);r===b?d.created++:r===k?d.linked++:d.updated++}this.remember(t,{at:f,code:r,targetId:n,objectApiName:i??""})}uncount(e,t,n){let i=this.index.offsetOf(t);if(i<this.partStart)return;let r=this.index.codeOf(t),s=n?.at===i?n:this.recordAt(e,t),o=s?.objectApiName?this.counts.get(s.objectApiName):void 0;o&&(r===b?o.created--:r===k?o.linked--:o.updated--)}countsOf(e){let t=this.counts.get(e);return t||(t={created:0,linked:0,updated:0},this.counts.set(e,t)),t}mapping(e){let t=this.lookUp(e);if(!(!t||t.code===y))return{kind:P[t.code],sourceId:e,targetId:t.targetId,...t.objectApiName?{objectApiName:t.objectApiName}:{},earlier:t.at<this.partStart}}createdTarget(e){let t=A(e);if(this.createdUnattributedKeys.has(t))return!0;if(this.createdTargets.size===0)return!1;let n=this.createdTargets.find(t,p(t),m(t));if(n<0)return!1;let i=this.createdTargets.offsetOf(n),r=S(this.lineAt(i,this.createdTargets.lengthOf(n)));if(!r)return!1;let s=String(r[1]),o=this.index.find(s,p(s),m(s));return o>=0&&this.index.offsetOf(o)===i&&this.index.codeOf(o)===b}indexCreated(e,t,n){let i=A(e);if(!i)return;let r=p(i),s=m(i);this.createdTargets.put(this.createdTargets.find(i,r,s),r,s,t,n,b)}targetOf(e){let t=this.lookUp(e);return t&&t.code!==y?t.targetId:void 0}get mappedSize(){return this.mappedCount}countsByObject(){let e=[];for(let[t,{created:n,linked:i,updated:r}]of this.counts)n+i+r!==0&&e.push(r>0?{objectApiName:t,created:n,linked:i,updated:r}:{objectApiName:t,created:n,linked:i});return e}linkedToCreatedCount(){let e=0;for(let f of this.counts.values())e+=f.linked;if(e===0)return 0;let t=this.partStart===Number.POSITIVE_INFINITY?0:this.partStart,n=(f,d)=>{let g=S(this.lineAt(f,d));return g?String(g[2]).slice(0,15):""},i=(f,d)=>{let g=R[String(d[0])];if(g===void 0||g===y||!d[3])return;let w=String(d[1]),x=this.index.find(w,p(w),m(w),f.offset);return x>=0&&this.index.offsetOf(x)===f.offset?g:void 0},r=(f,d)=>f.offset<t?void 0:i(f,d),s=(f,d,g)=>{let w=p(d),x=m(d);f.put(f.find(d,w,x),w,x,g.offset,g.length,0)},o=(f,d)=>f.size>0&&f.find(d,p(d),m(d))>=0,c=new O(n);for(let f of this.lines()){if(!f.text.startsWith('["'))continue;let d=S(f.text);!d||r(f,d)!==k||this.markedWithTheirRecord(String(d[1]))||s(c,String(d[2]).slice(0,15),f)}if(c.size===0)return 0;let u=new O(n),h=new Set;for(let f of this.lines()){if(!f.text.startsWith('["'))continue;let d=S(f.text);if(!d)continue;if(d[0]===T&&Array.isArray(d[2])){for(let w of d[2]){let x=String(w).slice(0,15);o(c,x)&&h.add(x)}continue}if(i(f,d)!==b)continue;let g=String(d[2]).slice(0,15);o(c,g)&&s(u,g,f)}if(u.size===0&&h.size===0)return 0;let l=0;for(let f of this.lines()){if(!f.text.startsWith('["'))continue;let d=S(f.text);if(!d||r(f,d)!==k||this.markedWithTheirRecord(String(d[1])))continue;let g=String(d[2]).slice(0,15);(o(u,g)||h.has(g))&&l++}return l}earlierRecordsOf(e,t=!1){return(t?this.earlierPastCheckpoint:this.earlierByObject).get(e)??0}*mappings(){for(let e of this.lines()){if(!e.text.startsWith('["'))continue;let t=S(e.text);if(!t)continue;let n=R[String(t[0])];if(n===void 0||n===y)continue;let i=String(t[1]),r=this.index.find(i,p(i),m(i),e.offset);if(r<0||this.index.offsetOf(r)!==e.offset)continue;let s=String(t[3]??"");yield{kind:P[n],sourceId:i,targetId:String(t[2]),...s?{objectApiName:s}:{},earlier:e.offset<this.partStart}}}noteRead(e){this.readsHeld.push(e),this.readsHeld.length>=st&&this.settleReads()}settleReads(){let e=this.readsHeld;this.readsHeld=[];for(let t of e){let n=p(t),i=m(t),r=this.index.find(t,n,i,this.cache.get(t)?.at);if(r>=0)continue;let s=JSON.stringify([F[y],t]),o=this.write(s);this.index.put(r,n,i,o,Buffer.byteLength(s),y)}}wasRead(e){return this.readsHeld.includes(e)?!0:this.index.find(e,p(e),m(e),this.cache.get(e)?.at)>=0}checkpoint(e,t,n){if(n!==void 0&&!_.test(n))throw new Error(`Not the name of a pass: ${JSON.stringify(n.slice(0,40))}`);this.settleReads(),this.write({at:{object:e,...n!==void 0?{pass:n}:{},...t}}),this.checkpointsByObject.set(E(e,n),{...t}),this.flush()}checkpoints(){return new Map(this.checkpointsByObject)}owe(e,t=!1){this.owedCount++,this.write(et(e,t))}get owed(){return this.owedCount}*owedPages(e){let t=[];for(let n of this.lines()){if(!n.text.startsWith('["o"')&&!n.text.startsWith('["w"'))continue;let i=S(n.text);if(!i||i.length<7)continue;let[r,s,o,c,u,h,l]=i;t.push({update:{objectApiName:String(s),newId:String(o),sourceId:c?String(c):void 0,fieldName:String(u),sourceRefId:String(h),...l===1?{insertOnly:!0}:{}},toRowWrittenBefore:r==="w"}),t.length>=e&&(yield t,t=[])}t.length>0&&(yield t)}patched(e,t){this.mark(JSON.stringify(["p",e,t]),C(e,t))}wasPatched(e,t){return this.hasMark(C(e,t))}mark(e,t){let n=p(t),i=m(t),r=this.marks.find(t,n,i),s=this.write(e);this.marks.put(r,n,i,s,Buffer.byteLength(e),0)}hasMark(e){return this.marks.size>0&&this.marks.find(e,p(e),m(e))>=0}owedLeftByEarlierParts(){let e=new Set;for(let n of this.lines()){if(n.offset>=this.partStart)break;if(!n.text.startsWith('["p"'))continue;let i=S(n.text);i&&i.length>=3&&e.add(`${String(i[1])}\0${String(i[2])}`)}let t=[];for(let n of this.lines()){if(n.offset>=this.partStart)break;if(!n.text.startsWith('["o"'))continue;let i=S(n.text);if(!i||i.length<7)continue;let[,r,s,o,c,u,h]=i;e.has(`${String(s)}\0${String(c)}`)||t.push({objectApiName:String(r),newId:String(s),sourceId:o?String(o):void 0,fieldName:String(c),sourceRefId:String(u),...h===1?{insertOnly:!0}:{}})}return t}oweStatus(e,t,n){this.write(JSON.stringify(["s",e,t,n])),this.tallyStatus({objectApiName:e,id:t,status:n})}tallyStatus(e){let t=this.statuses.get(e.objectApiName);t||(t={count:0,samples:[]},this.statuses.set(e.objectApiName,t)),t.count++,t.samples.length<at&&t.samples.push(e)}gaveStatus(e,t){this.statusGiven(t)||(this.mark(JSON.stringify(["g",e,t]),j(t)),this.given.set(e,(this.given.get(e)??0)+1))}statusGiven(e){return this.hasMark(j(e))}statusesOwed(){let e=new Map;for(let[t,n]of this.statuses){let i=n.count-(this.given.get(t)??0);i<=0||e.set(t,{count:i,samples:n.samples.filter(({id:r})=>!this.statusGiven(r))})}return e}*statusLines(){for(let e of this.lines()){if(!e.text.startsWith('["s"'))continue;let t=S(e.text);!t||t.length<4||(yield{objectApiName:String(t[1]),id:String(t[2]),status:String(t[3])})}}withTheirRecord(e){let t=B(e),n=p(t),i=m(t),r=this.marks.find(t,n,i),s=this.partStart===Number.POSITIVE_INFINITY?0:this.partStart;if(r>=0&&this.marks.offsetOf(r)>=s)return;let o=JSON.stringify([v,e]),c=this.write(o);this.marks.put(r,n,i,c,Buffer.byteLength(o),0),this.withTheirRecordMarked++}get withTheirRecordCount(){return this.withTheirRecordMarked}markedWithTheirRecord(e){if(this.withTheirRecordMarked===0)return!1;let t=B(e),n=this.marks.find(t,p(t),m(t)),i=this.partStart===Number.POSITIVE_INFINITY?0:this.partStart;return n>=0&&this.marks.offsetOf(n)>=i}*withTheirRecordIds(){if(this.withTheirRecordMarked!==0)for(let e of this.lines()){if(e.offset<this.partStart||!e.text.startsWith(`["${v}"`))continue;let t=S(e.text);t&&t.length>=2&&(yield String(t[1]))}}writtenByThePlatform(e,t){t<=0||this.write(JSON.stringify([X,e,t]))}sent(e,t,n,i=new Date,r){this.callsSent++;let s=`${Math.max(0,this.parts-1)}.${this.callsSent}`;return this.write(JSON.stringify([q,s,e,i.toISOString(),t,n.map(({sourceId:o,fingerprint:c,externalKey:u,jobKey:h})=>r!==void 0&&u!==void 0?[o,c,u]:h!==void 0?[o,c,"",h]:[o,c]),n.flatMap(({owes:o},c)=>(o??[]).map(({field:u,sourceRefId:h,insertOnly:l})=>[c,u,h,l?1:0])),...r!==void 0?[r]:[]])),this.flush(),s}answered(e){this.write(JSON.stringify([V,e]))}jobOpened(e,t){this.write(JSON.stringify([Q,e,t])),this.flush()}createdUnattributed(e,t){if(t.length!==0){this.write(JSON.stringify([T,e,[...t]]));for(let n of t)this.createdUnattributedKeys.add(A(n))}}wasFoundAfterStop(e){return this.foundAfterStop.has(e)}owesUntold(e){return this.foundOwingUntold.has(e)}flush(){if(this.pending.length===0)return;let e=this.pending.join("");this.pending=[],this.pendingBytes=0,this.file.append(e)}close(){this.settleReads(),this.flush(),this.file.close()}write(e){let t=typeof e=="string"?e:JSON.stringify(e),n=this.file.size()+this.pendingBytes,i=`${t}
|
|
8
|
+
`;return this.pending.push(i),this.pendingBytes+=Buffer.byteLength(i),this.pendingBytes>=nt?this.flush():this.flushQueued||(this.flushQueued=!0,queueMicrotask(()=>{this.flushQueued=!1,this.flush()})),n}lineAt(e,t){return e+t>this.file.size()&&this.flush(),this.file.read(e,t).toString("utf8")}idOfLine(e,t){let n=S(this.lineAt(e,t));return n?String(n[1]):""}lookUp(e){let t=this.cache.get(e);if(t)return this.cache.delete(e),this.cache.set(e,t),t;let n=this.index.find(e,p(e),m(e));if(n<0)return;let i=this.recordAt(e,n);return i&&this.remember(e,i),i}recordAt(e,t){let n=this.index.offsetOf(t),i=S(this.lineAt(n,this.index.lengthOf(t)));if(!(!i||String(i[1])!==e))return{at:n,code:this.index.codeOf(t),targetId:String(i[2]??""),objectApiName:String(i[3]??"")}}remember(e,t){if(this.cache.delete(e),this.cache.set(e,t),this.cache.size>rt){let n=this.cache.keys().next().value;n!==void 0&&this.cache.delete(n)}}*lines(){this.flush(),yield*dt(this.file)}readWhatIsThere(){for(let e of this.lines()){if(e.text.startsWith('["')){let n=S(e.text);n&&this.readRegistration(e,n);continue}let t;try{t=JSON.parse(e.text)}catch{continue}if(!(typeof t!="object"||t===null)){if("part"in t)this.parts++;else if("sample"in t){let n=t.sample;if(typeof n!="object"||n===null)continue;let{dir:i,sha256:r}=n;if(typeof i!="string"||i===""||typeof r!="string"||!I.test(r))continue;this.plan={dir:i,sha256:r}}else if("roots"in t){let n=M(t.roots);n&&(this.rootsNamed=n)}else if("at"in t){let n=t.at;if(typeof n!="object"||n===null)continue;let{object:i,pass:r,lastId:s,read:o,done:c}=n;if(typeof i!="string"||typeof s!="string"||typeof o!="number"||r!==void 0&&(typeof r!="string"||!_.test(r)))continue;this.checkpointsByObject.set(E(i,r),{lastId:s,read:o,...c===!0?{done:c}:{}}),r===void 0&&this.earlierPastCheckpoint.delete(i)}}}}readRegistration(e,t){let n=String(t[0]);if(n==="o"||n==="w"){this.owedCount++;return}if(n==="s"){t.length>=4&&this.tallyStatus({objectApiName:String(t[1]),id:String(t[2]),status:String(t[3])});return}if(n==="p"||n==="g"||n===v){let l=L(t);if(!l)return;let f=p(l),d=m(l),g=this.marks.find(l,f,d);if(n==="g"&&g<0){let w=String(t[1]);this.given.set(w,(this.given.get(w)??0)+1)}this.marks.put(g,f,d,e.offset,e.length,0);return}if(n===T){if(Array.isArray(t[2]))for(let l of t[2])this.createdUnattributedKeys.add(A(String(l)));return}let i=R[n];if(i===void 0)return;let r=String(t[1]);i===b&&(t[4]===U||t[4]===tt)&&(this.foundAfterStop.add(r),t[4]===U&&this.foundOwingUntold.add(r));let s=p(r),o=m(r),c=this.index.find(r,s,o),u=c>=0&&this.index.codeOf(c)!==y;if(i===y&&c>=0||(this.index.put(c,s,o,e.offset,e.length,i),i===y))return;i===b&&this.indexCreated(String(t[2]??""),e.offset,e.length),u||this.mappedCount++;let h=String(t[3]??"");h&&(this.earlierByObject.set(h,(this.earlierByObject.get(h)??0)+1),this.earlierPastCheckpoint.set(h,(this.earlierPastCheckpoint.get(h)??0)+1))}};function A(a){return a.slice(0,15)}function S(a){try{let e=JSON.parse(a);return Array.isArray(e)?e:void 0}catch{return}}export{H as a,ft as b,E as c,M as d,q as e,V as f,Q as g,z as h,T as i,v as j,X as k,U as l,tt as m,ut as n,ht as o,et as p,p as q,m as r,O as s,dt as t,D as u};
|
|
@@ -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{
|
|
7
|
+
import{Bd as d,Cd as m,yd as c,zd as l}from"./chunk-J347SPU6.mjs";var g=class{transform(n,r){let t=n;for(let o of r)t=p(t,o.type,o.config);return t}transformRecord(n,r){let t=d([{objectApiName:r.objectApiName,transformRules:r.transformRules}]);if(t.length>0)throw new Error(m(t));let o={...n},s=(r.externalIdField??"Id").toLowerCase(),R=a=>{let i=a.toLowerCase();return i!==s&&i!=="id"};for(let a of r.transformRules){let i=a.field?.trim();if(!i)throw new Error(l(c([r])));for(let f of h(o,i))R(f)&&(o[f]=p(o[f],a.type,a.config))}return o}};function h(e,n){let r=n.toLowerCase();return Object.keys(e).filter(t=>t.toLowerCase()===r)}function u(e){return(n,r)=>typeof n=="string"?e(n,r):n}function w(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.isNaN(n)?void 0:n}var b={uppercase:u(e=>e.toUpperCase()),lowercase:u(e=>e.toLowerCase()),trim:u(e=>e.trim()),truncate:u((e,n)=>e.slice(0,n.length??e.length)),prefix:u((e,n)=>`${n.prefix??""}${e}`),suffix:u((e,n)=>`${e}${n.suffix??""}`),replace:u((e,n)=>n.search?e.split(n.search).join(n.replace??""):e),regex_replace:u((e,n)=>n.regex?e.replace(y(n.regex),n.replace??""):e),map_value:(e,n)=>{let r=String(e??""),t=n.valueMap??{};return r in t?t[r]:e},default_value:(e,n)=>e==null||e===""?n.defaultValue??"":e,format_date:u((e,n)=>T(e,n.dateFormat??"YYYY-MM-DD")),format_number:(e,n)=>{let r=w(e);if(r===void 0)return e;let t=n.numberFormat??"0";return k(r,t)},custom_formula:(e,n)=>{let r=n.formula??"";return x(e,r)}};function y(e){try{return new RegExp(e,"g")}catch(n){throw new Error(`The pattern "${e}" of a Regex replace rule is no regular expression: `+(n instanceof Error?n.message:String(n)))}}function p(e,n,r){let t=b[n];return t(e,r)}function T(e,n){let r=new Date(e);if(isNaN(r.getTime()))return e;let t=r.getUTCFullYear().toString(),o=(r.getUTCMonth()+1).toString().padStart(2,"0"),s=r.getUTCDate().toString().padStart(2,"0");return n.replace("YYYY",t).replace("MM",o).replace("DD",s)}function k(e,n){let r=n.indexOf(".");if(r===-1)return Math.round(e).toString();let t=n.length-r-1;return e.toFixed(t)}function x(e,n){if(n.includes("VALUE")){let r=w(e);if(r!==void 0){let t=n.replace(/VALUE/g,r.toString());return N(t)??e}}return e}function N(e){let n=e.replace(/\s/g,""),r=/^(-?\d+(?:\.\d+)?)([-+*/])(-?\d+(?:\.\d+)?)$/.exec(n);if(!r)return;let t=Number(r[1]),o=r[2],s=Number(r[3]);switch(o){case"+":return t+s;case"-":return t-s;case"*":return t*s;case"/":return s===0?void 0:t/s;default:return}}export{g as a};
|
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{a,b,c,d}from"./chunk-
|
|
7
|
+
import{a,b,c,d}from"./chunk-WJGK6VGU.mjs";import"./chunk-3L6DVNCR.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as StepCancelledError,d as StepExecutor,b as delayMs,c as waitedWords};
|
|
@@ -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}from"./chunk-54V4FVEY.mjs";import"./chunk-PVZ72OOQ.mjs";import"./chunk-QIRO4HTE.mjs";import"./chunk-TYUYPFDJ.mjs";import"./chunk-NTOVCTRS.mjs";export{b as AnonymizationEngine,a as MissingHashSaltError};
|
|
@@ -4,5 +4,5 @@ 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{f as l,g as m,h as f,i as c,j as h}from"./chunk-FQGHL7GR.mjs";import{
|
|
7
|
+
import{f as l,g as m,h as f,i as c,j as h}from"./chunk-FQGHL7GR.mjs";import{Pa as d,Ra as g}from"./chunk-J347SPU6.mjs";var x=50,A="en_US",$=["Contact details must reach nobody:","- every email address uses example.com, example.net, example.org, or a domain ending in .example, .invalid or .test, such as jane.doe@acme.example;",`- every phone number takes one of these forms, X being any digit: ${Object.values(l).map(t=>t.phoneFormats[0]).join(", ")}.`],u=class{callAI;constructor(e){this.callAI=e}async generate(e,i,r){if(i<=0||e.length===0)return[];let o=[],n=i,s=new Set(e.filter(p=>p.fieldType?.toLowerCase()==="phone").map(p=>p.fieldApiName)),a=E();for(;n>0;){let p=Math.min(n,x),R=_(e,p,r),w=await this.callAI(R),y=O(w);o.push(...y.map(N=>I(N,s,a))),n-=p}return o.slice(0,i)}};function E(){let t=0;return e=>h(f(e)??A,t++)}function _(t,e,i){let r=t.map(n=>{let s=[`- ${n.fieldApiName} (${n.ruleType})`];return n.config.aiPrompt&&s.push(`: ${n.config.aiPrompt}`),(n.config.minValue!==void 0||n.config.maxValue!==void 0)&&s.push(` [range: ${n.config.minValue??""}..${n.config.maxValue??""}]`),(n.config.minLength!==void 0||n.config.maxLength!==void 0)&&s.push(` [length: ${n.config.minLength??""}..${n.config.maxLength??""}]`),s.join("")}),o=[];return i&&(o.push(`Persona: ${i}`),o.push("")),o.push(`Generate exactly ${e} JSON objects with these fields:`),o.push(...r),o.push(""),o.push(...$),o.push(""),o.push("Return ONLY a JSON array of objects. No markdown, no explanation."),o.join(`
|
|
8
8
|
`)}function O(t){return d(g,t)}var P=new RegExp("(?<![\\p{L}\\p{N}._%+-])([\\p{L}\\p{N}._%+-]+)@((?:[\\p{L}\\p{N}](?:[\\p{L}\\p{N}-]{0,61}[\\p{L}\\p{N}])?\\.)+\\p{L}{2,63})(?![\\p{L}\\p{N}-])","gu"),S=/phone|mobile|fax|telef|^tel$/i,b=/^\+?[\d ()./-]+$/,D=/(?<![\w+.@-])(?<!\d )(?:(?:\+\d+|\(\d{1,4}\)|0\d*)(?:[ ./-]?\(\d+\)|[ ./-]\d+|(?<=\))\d+)*|\d{3}[ .-]\d{3}[ .-]\d{4}|(?<![€$£¥] ?)(?:[6-9]\d{2}(?<sep>[ .-])\d{3}\k<sep>\d{3}|[6-9]\d{2} \d{2} \d{2} \d{2}|[1-9]{2} (?:9 ?)?\d{4}-\d{4})(?![ ./,-]?\d| ?[€$£¥%]))(?![\w@])/g,F=/^\d{1,4}[./-]\d{1,2}[./-]\d{1,4}$/,L={least:8,most:15};function I(t,e,i){let r={};for(let[o,n]of Object.entries(t))r[o]=k(o,n,e,i);return r}function k(t,e,i,r){let o=i.has(t)||S.test(t.replace(/__p?c$/i,"")),n=typeof e=="number"?String(e):typeof e=="string"?e:void 0;return o&&n!==void 0&&/\d/.test(n)&&b.test(n.trim())?c(n)?e:r(n):typeof e!="string"?e:e.replace(P,(s,a,p)=>m(p)?s:`${a}@${T(p)}`).replace(D,s=>C(s)&&!c(s)?r(s):s)}function C(t){let e=t.replace(/\D/g,"").length;return e>=L.least&&e<=L.most&&!F.test(t)}function T(t){return`${t.split(".").slice(0,-1).join(".")}.example`}export{u as a,E as b,_ as c,O as d,I as e};
|
|
@@ -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{
|
|
7
|
+
import{q as i}from"./chunk-7O6EFNQS.mjs";function u(o,t){let n=e=>e==="production"?`${t} is taken for a production org, and this command writes to none`:void 0;return new i({requestConfirmation:(e,d)=>{let r=n(d);return r===void 0?Promise.resolve(!0):(o(`refused: ${r} (${e})`),Promise.resolve(!1))},declinesWithoutAsking:n})}export{u as a};
|