sandforge 1.82.0 → 1.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/lib/{chunk-JLZRZL5E.mjs → chunk-262TP6UU.mjs} +1 -1
  2. package/lib/{chunk-Z42PHCVZ.mjs → chunk-27BBEGUD.mjs} +1 -1
  3. package/lib/{chunk-YGJF55VJ.mjs → chunk-2ADSD5WK.mjs} +1 -1
  4. package/lib/{chunk-KIMQQ6JQ.mjs → chunk-2GSMHGIV.mjs} +1 -1
  5. package/lib/chunk-2K5BYZQM.mjs +8 -0
  6. package/lib/{chunk-DJCGURW7.mjs → chunk-2KTGDYUH.mjs} +1 -1
  7. package/lib/{chunk-YAJQS3OL.mjs → chunk-2N73W63D.mjs} +1 -1
  8. package/lib/{chunk-LXDSRP2W.mjs → chunk-2R6GFNKF.mjs} +1 -1
  9. package/lib/{chunk-VZVICK7Q.mjs → chunk-2WMKJVD2.mjs} +1 -1
  10. package/lib/{chunk-CV47FDQW.mjs → chunk-36Y225OM.mjs} +1 -1
  11. package/lib/{chunk-3C2ZZIFN.mjs → chunk-3CM7LAPE.mjs} +1 -1
  12. package/lib/{chunk-HIHCYMSL.mjs → chunk-3OVTKRS4.mjs} +1 -1
  13. package/lib/{chunk-XFU3HRUV.mjs → chunk-3V4YH5KO.mjs} +1 -1
  14. package/lib/{chunk-XO5FBOQF.mjs → chunk-446GBKAC.mjs} +1 -1
  15. package/lib/{chunk-ZUOPC4W2.mjs → chunk-4GCYGQXD.mjs} +1 -1
  16. package/lib/{chunk-GCGHHN4K.mjs → chunk-4V3QO7HF.mjs} +1 -1
  17. package/lib/{chunk-VZT4E2OJ.mjs → chunk-4X5D3MSV.mjs} +1 -1
  18. package/lib/{chunk-P55MKIZX.mjs → chunk-5OGNK3JP.mjs} +1 -1
  19. package/lib/{chunk-3MGMNK3Q.mjs → chunk-6KOUYHEY.mjs} +1 -1
  20. package/lib/chunk-6QSHWIZI.mjs +48 -0
  21. package/lib/chunk-6VOQFISN.mjs +7 -0
  22. package/lib/{chunk-VYOYXTCU.mjs → chunk-6YC2ELCU.mjs} +1 -1
  23. package/lib/chunk-77IVKH7R.mjs +7 -0
  24. package/lib/{chunk-JKT5YAQ2.mjs → chunk-77MZRBWX.mjs} +1 -1
  25. package/lib/{chunk-PR74GYVI.mjs → chunk-7BQMBXKX.mjs} +1 -1
  26. package/lib/{chunk-SZGGFST2.mjs → chunk-7DPHZWA4.mjs} +1 -1
  27. package/lib/chunk-7V2UYZ6S.mjs +7 -0
  28. package/lib/{chunk-HKUWHVI7.mjs → chunk-7WSQ65WG.mjs} +1 -1
  29. package/lib/{chunk-LHU6CPGE.mjs → chunk-7ZBDACVG.mjs} +1 -1
  30. package/lib/{chunk-WT3SCUHS.mjs → chunk-AG24QMSY.mjs} +1 -1
  31. package/lib/{chunk-A65ADTCR.mjs → chunk-AHUGG3WU.mjs} +1 -1
  32. package/lib/{chunk-ZXFL2MSN.mjs → chunk-ALBY5SOH.mjs} +1 -1
  33. package/lib/chunk-AXFD2OH6.mjs +7 -0
  34. package/lib/{chunk-JESRFE2Z.mjs → chunk-BH76USTQ.mjs} +1 -1
  35. package/lib/{chunk-DBBPDSFN.mjs → chunk-BPHTA6KP.mjs} +1 -1
  36. package/lib/{chunk-3SKLBRPL.mjs → chunk-BT43WSOS.mjs} +1 -1
  37. package/lib/{chunk-32EUNQT6.mjs → chunk-BVZ5H3N4.mjs} +1 -1
  38. package/lib/{chunk-PWVDNN2C.mjs → chunk-C6RKM4BB.mjs} +1 -1
  39. package/lib/{chunk-27Z76O2O.mjs → chunk-CDWZGQAJ.mjs} +1 -1
  40. package/lib/chunk-CGZGL6VT.mjs +7 -0
  41. package/lib/{chunk-P63WJMXQ.mjs → chunk-CN5HGFG4.mjs} +1 -1
  42. package/lib/{chunk-Y4TDVDP2.mjs → chunk-CQAFVEKP.mjs} +1 -1
  43. package/lib/{chunk-G2JR3F63.mjs → chunk-CTPLYUXA.mjs} +1 -1
  44. package/lib/chunk-CXKZ6TYV.mjs +9 -0
  45. package/lib/{chunk-FKK5YBGZ.mjs → chunk-D6JT4PAB.mjs} +1 -1
  46. package/lib/{chunk-3CX7GPCR.mjs → chunk-D7XUNWWU.mjs} +1 -1
  47. package/lib/{chunk-PPHVWUFY.mjs → chunk-DB5RVDC5.mjs} +1 -1
  48. package/lib/{chunk-LAUOSXMN.mjs → chunk-DIGUC7S4.mjs} +1 -1
  49. package/lib/{chunk-6GQUZ4IP.mjs → chunk-DKDKCGXV.mjs} +1 -1
  50. package/lib/chunk-DMT5SCO3.mjs +7 -0
  51. package/lib/{chunk-KKOA62S4.mjs → chunk-DNQKVCUV.mjs} +4 -3
  52. package/lib/{chunk-3XG25GTF.mjs → chunk-DSR2MSBH.mjs} +1 -1
  53. package/lib/{chunk-ZHIZY3ZC.mjs → chunk-E3RQ575Y.mjs} +1 -1
  54. package/lib/{chunk-SAMWHL22.mjs → chunk-EOQON3E5.mjs} +1 -1
  55. package/lib/{chunk-2JZGCCPG.mjs → chunk-ETNQHIDI.mjs} +1 -1
  56. package/lib/chunk-F5SBGJWW.mjs +7 -0
  57. package/lib/chunk-FBXH4VRQ.mjs +7 -0
  58. package/lib/chunk-FKCIGJOI.mjs +15 -0
  59. package/lib/{chunk-NWOI25WY.mjs → chunk-FVLFO2S6.mjs} +1 -1
  60. package/lib/{chunk-MKTXJCXN.mjs → chunk-FYWNSMOZ.mjs} +1 -1
  61. package/lib/{chunk-52EXDVPN.mjs → chunk-GEEWPTV5.mjs} +1 -1
  62. package/lib/{chunk-XSKPYGMT.mjs → chunk-GLN4PI5P.mjs} +1 -1
  63. package/lib/{chunk-DWMRIWV5.mjs → chunk-GT5ZKU6V.mjs} +1 -1
  64. package/lib/chunk-GTRU5AV5.mjs +7 -0
  65. package/lib/chunk-H33DVU3D.mjs +7 -0
  66. package/lib/{chunk-YAIIRFKJ.mjs → chunk-HQZUQXDC.mjs} +1 -1
  67. package/lib/{chunk-MUEQRIK7.mjs → chunk-HVX2AFYW.mjs} +1 -1
  68. package/lib/chunk-I3ZO76LL.mjs +21 -0
  69. package/lib/{chunk-7WSLT5VX.mjs → chunk-I5C4O3VA.mjs} +1 -1
  70. package/lib/{chunk-6VSZNZHH.mjs → chunk-IHGYJZZ2.mjs} +1 -1
  71. package/lib/{chunk-DIS254AN.mjs → chunk-ISA2NYJV.mjs} +1 -1
  72. package/lib/{chunk-GGUOIDWP.mjs → chunk-ISAUCWYK.mjs} +1 -1
  73. package/lib/{chunk-ZUTUYBNW.mjs → chunk-ISOSTAJR.mjs} +1 -1
  74. package/lib/chunk-IXIY6Q4M.mjs +7 -0
  75. package/lib/{chunk-2UU42PTD.mjs → chunk-J3TIHLWG.mjs} +1 -1
  76. package/lib/{chunk-GGNUACTY.mjs → chunk-JAV6F6OA.mjs} +1 -1
  77. package/lib/chunk-JBWJ6UEZ.mjs +7 -0
  78. package/lib/{chunk-C2N2TNEU.mjs → chunk-JH4ZTVQN.mjs} +1 -1
  79. package/lib/{chunk-FOIWWK7G.mjs → chunk-JIPT5FUD.mjs} +1 -1
  80. package/lib/{chunk-7EYQYZJP.mjs → chunk-JREKJO3D.mjs} +1 -1
  81. package/lib/{chunk-VQJMP3DC.mjs → chunk-JUOQUG7U.mjs} +1 -1
  82. package/lib/chunk-JYUMD357.mjs +7 -0
  83. package/lib/{chunk-KP5G6FUC.mjs → chunk-K7G3W7XH.mjs} +1 -1
  84. package/lib/{chunk-T7WREYA5.mjs → chunk-KKS2KFBT.mjs} +1 -1
  85. package/lib/{chunk-TMA34QMA.mjs → chunk-KWAVSZ2B.mjs} +1 -1
  86. package/lib/{chunk-H4JUYUSL.mjs → chunk-KXUOHACP.mjs} +1 -1
  87. package/lib/{chunk-STRMWSIQ.mjs → chunk-L3I6DAHX.mjs} +1 -1
  88. package/lib/{chunk-TCBAE65A.mjs → chunk-L47JCNP3.mjs} +1 -1
  89. package/lib/{chunk-5K2I2DMP.mjs → chunk-L4MSL4U7.mjs} +1 -1
  90. package/lib/chunk-L4RJX7DG.mjs +7 -0
  91. package/lib/{chunk-47UHTN3Q.mjs → chunk-L6CLN664.mjs} +1 -1
  92. package/lib/chunk-LI2XNV7F.mjs +7 -0
  93. package/lib/chunk-LP2D3JJP.mjs +7 -0
  94. package/lib/{chunk-KJYEQHYP.mjs → chunk-LWES2KZE.mjs} +1 -1
  95. package/lib/{chunk-3HEMJTAP.mjs → chunk-LYOGCIYD.mjs} +2 -2
  96. package/lib/{chunk-VPDEJGPS.mjs → chunk-MJD6CPZZ.mjs} +1 -1
  97. package/lib/{chunk-SNEOKYV7.mjs → chunk-MTM4KG3T.mjs} +1 -1
  98. package/lib/{chunk-J24TIGSI.mjs → chunk-N2HYG3BL.mjs} +1 -1
  99. package/lib/chunk-N5UIE4IR.mjs +7 -0
  100. package/lib/{chunk-YMDFF657.mjs → chunk-NDFFIJL5.mjs} +1 -1
  101. package/lib/{chunk-WOOUISSO.mjs → chunk-NFEBX75O.mjs} +1 -1
  102. package/lib/{chunk-ZUBBEP75.mjs → chunk-NNV7IGM7.mjs} +1 -1
  103. package/lib/{chunk-Q3DY7TO2.mjs → chunk-NS6ONPWL.mjs} +1 -1
  104. package/lib/{chunk-IVZJSDJD.mjs → chunk-O7GCCRPW.mjs} +1 -1
  105. package/lib/{chunk-A7JJWOLT.mjs → chunk-OO24ZYYJ.mjs} +1 -1
  106. package/lib/chunk-OOIDCHBQ.mjs +9 -0
  107. package/lib/{chunk-AUS6NFLZ.mjs → chunk-OS5GE52G.mjs} +1 -1
  108. package/lib/chunk-OS6HFJ7L.mjs +7 -0
  109. package/lib/{chunk-V3R45ZWT.mjs → chunk-OTJH6AEA.mjs} +1 -1
  110. package/lib/{chunk-PBE44M2Y.mjs → chunk-OUU47Y7A.mjs} +1 -1
  111. package/lib/{chunk-BN33LVPQ.mjs → chunk-P6WRYJN3.mjs} +1 -1
  112. package/lib/{chunk-JJITOWZK.mjs → chunk-PDRXM5WN.mjs} +1 -1
  113. package/lib/{chunk-RYRMUPMY.mjs → chunk-PGRY365W.mjs} +1 -1
  114. package/lib/chunk-Q4PPI3KG.mjs +7 -0
  115. package/lib/chunk-QFTF2PGS.mjs +21 -0
  116. package/lib/chunk-QKJXIY6L.mjs +7 -0
  117. package/lib/{chunk-PYRZFUVU.mjs → chunk-QLRWU3MB.mjs} +1 -1
  118. package/lib/chunk-QO4MPHZD.mjs +7 -0
  119. package/lib/chunk-QP3JLFIO.mjs +7 -0
  120. package/lib/{chunk-NLB3RGIY.mjs → chunk-QQDZQCO2.mjs} +1 -1
  121. package/lib/{chunk-7CVDVBEE.mjs → chunk-QXB6U3ZP.mjs} +1 -1
  122. package/lib/chunk-R3OM3X4L.mjs +8 -0
  123. package/lib/chunk-R7GKMAT4.mjs +7 -0
  124. package/lib/{chunk-YT22LMF7.mjs → chunk-RVCPQVKM.mjs} +1 -1
  125. package/lib/{chunk-TWV4A5RK.mjs → chunk-RZKJQOOC.mjs} +1 -1
  126. package/lib/chunk-S4PRKKGC.mjs +8 -0
  127. package/lib/{chunk-JH27IKCO.mjs → chunk-SX6QWYCQ.mjs} +1 -1
  128. package/lib/{chunk-UHFLKP26.mjs → chunk-T36DZJPH.mjs} +1 -1
  129. package/lib/{chunk-CZLJZQCS.mjs → chunk-T7DDS4UQ.mjs} +1 -1
  130. package/lib/chunk-TCEXCHXR.mjs +7 -0
  131. package/lib/chunk-TMIESDE5.mjs +7 -0
  132. package/lib/chunk-TQJ5NPRC.mjs +7 -0
  133. package/lib/chunk-TUPZY2QJ.mjs +7 -0
  134. package/lib/{chunk-GBGHJTPC.mjs → chunk-U2CTKIPE.mjs} +1 -1
  135. package/lib/{chunk-3HROD5RE.mjs → chunk-U4YFYSF3.mjs} +1 -1
  136. package/lib/{chunk-Q6SXNKV2.mjs → chunk-UIR77ZJD.mjs} +1 -1
  137. package/lib/{chunk-FA4ZKDCU.mjs → chunk-UOHZW2L4.mjs} +1 -1
  138. package/lib/{chunk-7PY3VQP3.mjs → chunk-VXZ5PTOM.mjs} +1 -1
  139. package/lib/{chunk-7LKI7OAS.mjs → chunk-VZLJZEV2.mjs} +1 -1
  140. package/lib/{chunk-YH4DYI6D.mjs → chunk-W3BQGMTR.mjs} +1 -1
  141. package/lib/{chunk-CELEBWEZ.mjs → chunk-WABXKL4N.mjs} +1 -1
  142. package/lib/{chunk-EEFUE2ES.mjs → chunk-WAYQLQAD.mjs} +1 -1
  143. package/lib/{chunk-RCYEBY42.mjs → chunk-WBELLGNE.mjs} +1 -1
  144. package/lib/{chunk-SFGZFB4F.mjs → chunk-WJAZ5LHL.mjs} +1 -1
  145. package/lib/{chunk-JQZTMFO7.mjs → chunk-WXU6ZJIV.mjs} +1 -1
  146. package/lib/{chunk-GJ6SZVHT.mjs → chunk-WZN36ACK.mjs} +1 -1
  147. package/lib/{chunk-XU25YA46.mjs → chunk-X2XZQ434.mjs} +1 -1
  148. package/lib/{chunk-QAPVKPEC.mjs → chunk-X4HZD5U2.mjs} +1 -1
  149. package/lib/chunk-X6XNTOGO.mjs +7 -0
  150. package/lib/{chunk-XK5W7BVE.mjs → chunk-XAMMIPZ4.mjs} +1 -1
  151. package/lib/{chunk-DT3T7FRD.mjs → chunk-XAUQXYPW.mjs} +1 -1
  152. package/lib/{chunk-C3LNYAVJ.mjs → chunk-XCJUNX63.mjs} +1 -1
  153. package/lib/chunk-XJICAOAQ.mjs +7 -0
  154. package/lib/{chunk-CBL42DUU.mjs → chunk-XKFHTBAB.mjs} +1 -1
  155. package/lib/{chunk-O2PUGRNW.mjs → chunk-XMQ5R6TC.mjs} +1 -1
  156. package/lib/chunk-XPXEQKLR.mjs +7 -0
  157. package/lib/{chunk-6KP6WETK.mjs → chunk-Y7YUNRKK.mjs} +1 -1
  158. package/lib/{chunk-WSUKC2U3.mjs → chunk-YBZIDW6W.mjs} +1 -1
  159. package/lib/{chunk-RTWYLOCA.mjs → chunk-YEVB7LVK.mjs} +1 -1
  160. package/lib/{chunk-L4INJ5TZ.mjs → chunk-Z3MGN42K.mjs} +1 -1
  161. package/lib/{chunk-EOFO3PHS.mjs → chunk-ZB5E7NHU.mjs} +1 -1
  162. package/lib/chunk-ZCOSME6P.mjs +7 -0
  163. package/lib/{chunk-HFUDCNU5.mjs → chunk-ZOSESZ22.mjs} +1 -1
  164. package/lib/chunk-ZTHC42X6.mjs +7 -0
  165. package/lib/{chunk-XZISAZA6.mjs → chunk-ZXOUWHYE.mjs} +1 -1
  166. package/lib/sandforge-autopilot.mjs +1 -1
  167. package/lib/sandforge-backup.mjs +1 -1
  168. package/lib/sandforge-checkpoint.mjs +1 -1
  169. package/lib/sandforge-cleanup.mjs +1 -1
  170. package/lib/sandforge-clone.mjs +1 -1
  171. package/lib/sandforge-compare.mjs +1 -1
  172. package/lib/sandforge-dataops.mjs +1 -1
  173. package/lib/sandforge-empty.mjs +4 -4
  174. package/lib/sandforge-env.mjs +98 -99
  175. package/lib/sandforge-frozen.mjs +1 -1
  176. package/lib/sandforge-mcp.mjs +2 -2
  177. package/lib/sandforge-monitor.mjs +1 -1
  178. package/lib/sandforge-pipeline.mjs +1 -1
  179. package/lib/sandforge-seed.mjs +1 -1
  180. package/lib/sandforge-sync.mjs +1 -1
  181. package/lib/sandforge-users.mjs +21 -23
  182. package/oclif.manifest.json +1 -1
  183. package/package.json +1 -1
  184. package/lib/chunk-42BFLWHR.mjs +0 -7
  185. package/lib/chunk-466F37VD.mjs +0 -7
  186. package/lib/chunk-7SDZR6SR.mjs +0 -7
  187. package/lib/chunk-BMTNTBBM.mjs +0 -7
  188. package/lib/chunk-CCEH7L53.mjs +0 -7
  189. package/lib/chunk-DIL62SUN.mjs +0 -7
  190. package/lib/chunk-FZF23M6R.mjs +0 -7
  191. package/lib/chunk-GHPR5UVV.mjs +0 -7
  192. package/lib/chunk-HQQVANWQ.mjs +0 -20
  193. package/lib/chunk-IRZJU2PG.mjs +0 -22
  194. package/lib/chunk-ISSP2FZ5.mjs +0 -7
  195. package/lib/chunk-JFNLKHY6.mjs +0 -8
  196. package/lib/chunk-O4BROUGM.mjs +0 -7
  197. package/lib/chunk-PE435FVH.mjs +0 -15
  198. package/lib/chunk-RLWB7F26.mjs +0 -7
  199. package/lib/chunk-WEMLDUQA.mjs +0 -7
  200. package/lib/chunk-ZQO5PDX5.mjs +0 -48
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{c as es,e as ts,g as ns,h as We}from"./chunk-T7WREYA5.mjs";import{c as is,d as ds,i as cs}from"./chunk-H4JUYUSL.mjs";import{b as ls,c as us}from"./chunk-C2N2TNEU.mjs";import{g as as}from"./chunk-YAJQS3OL.mjs";import{d as rs,g as Je,i as ss,j as os}from"./chunk-Z42PHCVZ.mjs";import{a as _r}from"./chunk-DT3T7FRD.mjs";import{a as Dr}from"./chunk-ZUBBEP75.mjs";import{a as Lr}from"./chunk-XO5FBOQF.mjs";import{a as Ke,b as It}from"./chunk-KP5G6FUC.mjs";import{a as Tt,b as Ur}from"./chunk-7EYQYZJP.mjs";import{f as Ge}from"./chunk-H4OBZIX3.mjs";import{b as Yr}from"./chunk-V3R45ZWT.mjs";import{a as Nr}from"./chunk-XSKPYGMT.mjs";import{a as Pr}from"./chunk-6GQUZ4IP.mjs";import{H as Er,J as jt,K as xr,O as Ot,P as Cr}from"./chunk-LAUOSXMN.mjs";import{b as ln}from"./chunk-2JZGCCPG.mjs";import{a as pr,b as Mr,d as Br,e as zr,f as Kr,g as Gr,h as Wr,j as Jr,k as Vr,l as Et,m as xt,p as Zr,q as Hr,r as Xr,s as Qr}from"./chunk-3CX7GPCR.mjs";import{d as qr}from"./chunk-A65ADTCR.mjs";import{a as Fr}from"./chunk-NWOI25WY.mjs";import{f as hr}from"./chunk-FQGHL7GR.mjs";import{I as $r,J as Ar,L as jr,Q as Or,R as Ir,S as Tr,T as $t,U as At,a as fr,c as mr,j as gr,k as wr,u as br}from"./chunk-A7JJWOLT.mjs";import{a as yr,c as Rr}from"./chunk-C3LNYAVJ.mjs";import{d as Sr,e as kr,f as vr}from"./chunk-GJ6SZVHT.mjs";import{Ab as dr,Bb as qe,Cb as cr,Db as lr,Eb as ur,Wa as ve,b as K,cb as er,d as St,db as kt,e as Kn,f as Gn,g as Wn,h as Jn,i as Vn,k as ze,l as Zn,lb as tr,n as Hn,o as Xn,p as Qn,pb as nr,qb as $e,rb as rr,sb as vt,tb as sr,xb as or,yb as ar,zb as ir}from"./chunk-3HEMJTAP.mjs";import{b as Rt,c as zn,d as qn}from"./chunk-JKT5YAQ2.mjs";import{a as ce,d as Dn,j as Ue,k as Ln}from"./chunk-BNKT3R3F.mjs";import{b as _e,e as De}from"./chunk-BZ24IAP5.mjs";import{a as en}from"./chunk-SCKUIE3R.mjs";import{a as ct,b as fn,c as Le,d as Y,e as pn,f as hn,g as lt,h as mn,j as gn}from"./chunk-6FARZYMJ.mjs";import{_ as bn,yc as vn,zc as $n}from"./chunk-ISSP2FZ5.mjs";import{Ha as Mn,Wa as yt,Xa as Bn,db as Un,f as _n}from"./chunk-P55MKIZX.mjs";import{b as yn}from"./chunk-O2PUGRNW.mjs";import{C as ft,N as ye,Q as pt,a as wn}from"./chunk-7SDZR6SR.mjs";import{h as Sn,l as kn,n as Me,p as Be}from"./chunk-3SKLBRPL.mjs";import{a as ht,b as Re,f as In,g as Tn,h as mt,j as fe}from"./chunk-HKUWHVI7.mjs";import{b as be,c as ue}from"./chunk-LHU6CPGE.mjs";import{a as we,b as cn,f as it}from"./chunk-ZUOPC4W2.mjs";import{b as An,c as jn,g as On}from"./chunk-JQZTMFO7.mjs";import{Ic as wt,Jc as bt,Pb as Pn,bc as Nn,eb as xn,fc as Fn,hb as Se,lb as Cn,mc as ke,tc as gt}from"./chunk-JFNLKHY6.mjs";import{q as En}from"./chunk-VZVICK7Q.mjs";import{b as Fe,d as un,f as dt,h as Yn}from"./chunk-LCDPCUXS.mjs";import{b as ut}from"./chunk-HFSBDM7B.mjs";import{q as de}from"./chunk-KIMQQ6JQ.mjs";import{d as Rn}from"./chunk-TUACWKIH.mjs";import{Ea as nt,Eb as rt,Jd as ot,Kd as an,Ld as dn,Md as at,Qb as Ne,Rb as st,Ub as nn,Vb as rn,Xc as sn,e as le,gd as on,h as tn}from"./chunk-ZQO5PDX5.mjs";import{A as P}from"./chunk-WZQEK4WT.mjs";import{randomInt as Xs,randomUUID as Qs}from"node:crypto";import{existsSync as Rs,readFileSync as je,renameSync as Ys,writeFileSync as eo}from"node:fs";import{dirname as to,join as no}from"node:path";import{existsSync as ps,readFileSync as hs}from"node:fs";import{dirname as fs,resolve as Ct}from"node:path";function Pt(t,n=e=>hs(e,"utf8")){let e=st.find(i=>i.id===t);if(e)return{pack:e,from:"built-in"};if(!ps(t))return{refusal:`--scenario takes the id of a scenario SandForge ships (${st.map(i=>i.id).join(", ")}) or a scenario file, not "${t}".`};let r;try{r=n(t)}catch(i){return{refusal:`${t} could not be read: ${i instanceof Error?i.message:String(i)}`}}let o=ds(r);return"issues"in o?{refusal:`${t} is not a scenario pack:
7
+ import{c as es,e as ts,g as ns,h as We}from"./chunk-KKS2KFBT.mjs";import{c as is,d as ds,i as cs}from"./chunk-KXUOHACP.mjs";import{b as ls,c as us}from"./chunk-JH4ZTVQN.mjs";import{g as as}from"./chunk-2N73W63D.mjs";import{d as rs,g as Je,i as ss,j as os}from"./chunk-27BBEGUD.mjs";import{a as _r}from"./chunk-XAUQXYPW.mjs";import{a as Dr}from"./chunk-NNV7IGM7.mjs";import{a as Lr}from"./chunk-446GBKAC.mjs";import{a as Ke,b as It}from"./chunk-K7G3W7XH.mjs";import{a as Tt,b as Ur}from"./chunk-JREKJO3D.mjs";import{f as Ge}from"./chunk-H4OBZIX3.mjs";import{b as Yr}from"./chunk-OTJH6AEA.mjs";import{a as Nr}from"./chunk-GLN4PI5P.mjs";import{a as Pr}from"./chunk-DKDKCGXV.mjs";import{H as Er,J as jt,K as xr,O as Ot,P as Cr}from"./chunk-DIGUC7S4.mjs";import{b as ln}from"./chunk-ETNQHIDI.mjs";import{a as pr,b as Mr,d as Br,e as zr,f as Kr,g as Gr,h as Wr,j as Jr,k as Vr,l as Et,m as xt,p as Zr,q as Hr,r as Xr,s as Qr}from"./chunk-D7XUNWWU.mjs";import{d as qr}from"./chunk-AHUGG3WU.mjs";import{a as Fr}from"./chunk-FVLFO2S6.mjs";import{f as hr}from"./chunk-FQGHL7GR.mjs";import{I as $r,J as Ar,L as jr,Q as Or,R as Ir,S as Tr,T as $t,U as At,a as fr,c as mr,j as gr,k as wr,u as br}from"./chunk-OO24ZYYJ.mjs";import{a as yr,c as Rr}from"./chunk-XCJUNX63.mjs";import{d as Sr,e as kr,f as vr}from"./chunk-WZN36ACK.mjs";import{Ab as dr,Bb as qe,Cb as cr,Db as lr,Eb as ur,Wa as ve,b as K,cb as er,d as St,db as kt,e as Kn,f as Gn,g as Wn,h as Jn,i as Vn,k as ze,l as Zn,lb as tr,n as Hn,o as Xn,p as Qn,pb as nr,qb as $e,rb as rr,sb as vt,tb as sr,xb as or,yb as ar,zb as ir}from"./chunk-LYOGCIYD.mjs";import{b as Rt,c as zn,d as qn}from"./chunk-77MZRBWX.mjs";import{a as ce,d as Dn,j as Ue,k as Ln}from"./chunk-BNKT3R3F.mjs";import{b as _e,e as De}from"./chunk-BZ24IAP5.mjs";import{a as en}from"./chunk-SCKUIE3R.mjs";import{a as ct,b as fn,c as Le,d as Y,e as pn,f as hn,g as lt,h as mn,j as gn}from"./chunk-6FARZYMJ.mjs";import{_ as bn,yc as vn,zc as $n}from"./chunk-AXFD2OH6.mjs";import{Ha as Mn,Wa as yt,Xa as Bn,db as Un,f as _n}from"./chunk-5OGNK3JP.mjs";import{b as yn}from"./chunk-XMQ5R6TC.mjs";import{B as ft,M as ye,P as pt,a as wn}from"./chunk-IXIY6Q4M.mjs";import{h as Sn,l as kn,n as Me,p as Be}from"./chunk-BT43WSOS.mjs";import{a as ht,b as Re,f as In,g as Tn,h as mt,j as fe}from"./chunk-7WSQ65WG.mjs";import{b as be,c as ue}from"./chunk-7ZBDACVG.mjs";import{a as we,b as cn,f as it}from"./chunk-4GCYGQXD.mjs";import{b as An,c as jn,g as On}from"./chunk-WXU6ZJIV.mjs";import{$b as Fn,Cc as wt,Dc as bt,Jb as Pn,Xb as Nn,_a as xn,bb as Se,fb as Cn,gc as ke,nc as gt}from"./chunk-R3OM3X4L.mjs";import{q as En}from"./chunk-2WMKJVD2.mjs";import{b as Fe,d as un,f as dt,h as Yn}from"./chunk-LCDPCUXS.mjs";import{b as ut}from"./chunk-HFSBDM7B.mjs";import{q as de}from"./chunk-2GSMHGIV.mjs";import{d as Rn}from"./chunk-TUACWKIH.mjs";import{Ea as nt,Rb as rt,Wd as ot,Xd as an,Yd as dn,Zd as at,bc as Ne,cc as st,e as le,fc as nn,gc as rn,h as tn,id as sn,td as on}from"./chunk-6QSHWIZI.mjs";import{A as P}from"./chunk-WZQEK4WT.mjs";import{randomInt as Xs,randomUUID as Qs}from"node:crypto";import{existsSync as Rs,readFileSync as je,renameSync as Ys,writeFileSync as eo}from"node:fs";import{dirname as to,join as no}from"node:path";import{existsSync as ps,readFileSync as hs}from"node:fs";import{dirname as fs,resolve as Ct}from"node:path";function Pt(t,n=e=>hs(e,"utf8")){let e=st.find(i=>i.id===t);if(e)return{pack:e,from:"built-in"};if(!ps(t))return{refusal:`--scenario takes the id of a scenario SandForge ships (${st.map(i=>i.id).join(", ")}) or a scenario file, not "${t}".`};let r;try{r=n(t)}catch(i){return{refusal:`${t} could not be read: ${i instanceof Error?i.message:String(i)}`}}let o=ds(r);return"issues"in o?{refusal:`${t} is not a scenario pack:
8
8
  ${o.issues.map(i=>` ${i}`).join(`
9
9
  `)}`}:{pack:o.pack,from:Ct(t)}}async function ms(t,n,e){let r=ns(n,{caseStatus:await es(t.query),knowledge:await ts(t.objectAccess,t.describe),...e!==void 0?{seed:e}:{}});if("issues"in r)return r;let{options:o}=r.preparation;return{...r,compiled:Yr(n,o),options:o}}function gs(t,n){let{options:e,knowledge:r,caseStatusFrom:o}=n;return[`scenario: ${t.id} (${t.name}), seed ${e.seed} (--scenario-seed ${e.seed} writes the same again)`,...n.objects.map(i=>` ${i.objectApiName}: ${i.recordCount} record(s)`+(i.optional?", skipped by an org without it":"")),` cases: open "${e.caseStatus.open}", closed "${e.caseStatus.closed}"`+(o.from==="org"?" (the org's)":` (a new org's: ${o.reason})`),r.available?" articles: published once written, each closed case linked to the article of its topic, "+(e.articleBodyField?`their body in ${e.articleBodyField}`+(e.articleBodyLength!==void 0?` (${e.articleBodyLength} characters, every fact kept)`:""):"with their summary alone: the org offers no field for a body"):` articles: skipped, ${r.reason}: the tests that answer from Knowledge are written, and the agent will have no article to cite`,` tests: ${n.tests}, written to a file once the run has ended (--test-file)`]}function ws(t){if(!t)return[];if(t.skipped!==void 0)return[`articles: ${t.skipped}`];let n=(e,r)=>r?[`${e}: ${r.done} of ${r.asked}`,...r.notDone.map(({key:o,reason:i})=>` ${o}: ${i}`)]:[];return[...n("articles published",t.publish),...n("closed cases linked to their article",t.links)]}async function bs(t){let n=new Set(t.compiled.tests.flatMap(o=>o.openCase?[o.openCase.caseKey]:[])),e=Object.keys(t.caseIds).filter(o=>n.has(o)).length,r={packId:t.pack.id,tests:t.compiled.tests.length,openCases:n.size,openCasesWritten:e};if(e===0)return r;try{let o=await ss(Je(),t.journalDir,rs({runId:t.runId,pack:t.pack,compiled:t.compiled,options:t.options,caseIds:t.caseIds}));return{...r,companion:o}}catch(o){return{...r,unkept:o instanceof Error?o.message:String(o)}}}function Nt(t,n,e){return[`${en("seed")} --test-file`,t,"--target",n,"--agent <agent API name>",...e.topics.map(r=>`--topic ${r.key}=<agent topic>`)].join(" ")}function Gs(t){return t.flatMap(n=>[` ${n.name}${n.label?` (${n.label})`:""}`,...n.topics.map(e=>` topic ${e.name}`+(e.actions.length>0?`: ${e.actions.map(r=>r.name).join(", ")}`:""))])}var Ws={switches:["--overwrite","--json"],values:["--test-file","--target","--agent","--topic","--guard-topic","--test-runner","--scenario","--project"]},Js=/^([a-z][a-z0-9-]*)=([^\s:=,]+)(?::([^\s:=]+))?$/;function Vs(t){let n=t.slice(2);Fe(n,Ws);let e=c=>{process.stderr.write(`${c}
10
10
  `),process.exit(2)},r=c=>{let p=n.indexOf(c);return p>=0&&p+1<n.length?n[p+1]:void 0},o=r("--test-file"),i=r("--target");(!o||!i)&&e("--test-file takes the file of a scenario run, or its run id, and --target the org it wrote to. Run with --help.");let s=[];for(let c=0;c<n.length;c++){if(n[c]!=="--topic")continue;let p=n[c+1]??"",g=Js.exec(p);g||e(`--topic wants "<scenario topic>=<agent topic>" or "<scenario topic>=<agent topic>:<action>,<action>", not "${p}".`);let[,R,A,b]=g;s.push({packTopic:R,agentTopic:A,actions:b?b.split(","):[]})}let d=r("--test-runner")??"testing-center";rt.includes(d)||e(`--test-runner takes ${rt.join(" or ")}, not "${d}".`);let u=r("--agent"),f=r("--scenario");return{run:o,target:i,...u!==void 0?{agent:u}:{},topics:s,guardTopic:r("--guard-topic")??null,runner:d,...f!==void 0?{scenario:f}:{},project:Ct(r("--project")??process.cwd()),overwrite:n.includes("--overwrite"),json:n.includes("--json")}}function Zs(t,n){if(ps(t)&&t.endsWith(".ndjson")){let e=Me(hs(t,"utf8"));if(e)return{runId:e.runId,storagePath:fs(fs(Ct(t))),targetOrgId:e.targetOrgId,...e.targetOrganizationId?{targetOrganizationId:e.targetOrganizationId}:{}}}return{runId:t,storagePath:n}}async function ys(t,n,e){let r=Vs(t),o=b=>{process[r.json?"stderr":"stdout"].write(`${b}
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{b as f}from"./chunk-CA5NAXSU.mjs";import{Zd as S,_d as h,ce as g,de as y,ee as P}from"./chunk-ZQO5PDX5.mjs";var T=576*60*60*1e3,b=T,m=class extends Error{constructor(e){super(e),this.name="StepCancelledError"}},w=Symbol("stopped");function $(t,e,n,i){let r=new Date().toISOString();return{stepId:t.id,stepName:t.name,stepType:t.type,status:"completed",output:e,summary:i,startTime:n,endTime:r,duration:new Date(r).getTime()-new Date(n).getTime()}}function u(t,e,n){let i=new Date().toISOString();return{stepId:t.id,stepName:t.name,stepType:t.type,status:"failed",error:e,startTime:n,endTime:i,duration:new Date(i).getTime()-new Date(n).getTime()}}function v(t){return P(t.type)?`Step "${t.name}" is a ${String(t.type)} step, which SandForge no longer supports: remove it from the pipeline.`:y(t.type)?`Step "${t.name}" is a ${String(t.type)} step, and this step type cannot run in a pipeline yet.`:`Step "${t.name}" is a "${String(t.type)}" step, a step type this release of SandForge does not have: the pipeline was saved by a later release, or written by hand. Remove the step, or update SandForge.`}function H(t){let{timeout:e}=t;if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e))return`Step "${t.name}" has a timeout that is not a number of milliseconds: ${JSON.stringify(e)}.`;if(e>b)return`Step "${t.name}" has a timeout of ${e} ms, longer than a step can be given: set at most 24 days (${b} ms).`}}function x(t){let e=t.seconds,n=e===void 0?t.durationMs:e;if(typeof n!="number"||!Number.isFinite(n)||n<0)return;let i=e===void 0?n:n*1e3;return i<=T?i:void 0}function l(t){return String(Math.round(t/100)/10)}function M(t,e){let n=Math.max(t,e),i=n-t;return i<=Math.max(5e3,t/100)?`Waited ${l(n)} s.`:`Waited ${l(n)} s by the wall clock, ${l(i)} s more than the ${l(t)} s asked: the machine's clock or a sleep may account for it.`}function C(t){if(t.config.seconds===void 0&&t.config.durationMs===void 0)return`Delay step "${t.name}" has no duration: set how many seconds it waits.`;if(x(t.config)===void 0)return`Delay step "${t.name}" has no usable duration: set a number of seconds, from 0 up to 24 days.`}function E(t,e,n){let i=`Condition step "${t.name}"`;switch(n){case"noEarlierStep":return`${i} tests how the previous step went, and no step comes before it.`;case"noCompare":return`${i} tests how many differences a comparison found, and no Compare step comes before it.`;case"noPrecheck":return`${i} tests ${e}, which a Pre-check hands on, and no Pre-check before it takes that reading.`}}function k(t){let e=t.condition;if(!e||typeof e.field!="string"||e.field.trim()==="")return`Condition step "${t.name}" has no condition to evaluate.`;let n=S(e);return n===void 0?void 0:`Condition step "${t.name}" ${n}.`}function I(t,e){let n=k(t);if(n!==void 0||!t.condition||!e)return n;let i=t.condition,r=g(i,e.steps.slice(0,e.index),e.declared);return r===void 0?void 0:E(t,i.field,r)}function O(t,e){return e?.aborted?Promise.resolve(!1):new Promise(n=>{let i=()=>{clearTimeout(r),n(!1)},r=setTimeout(()=>{e?.removeEventListener("abort",i),n(!0)},t);e?.addEventListener("abort",i,{once:!0})})}var D=class{handlers=new Map;checks=new Map;constructor(){this.registerDefaults()}async execute(e,n){let i=new Date().toISOString(),r=this.check(e);if(r)return u(e,r,i);let o=this.getExecutor(e.type),c=e.retries??0,a="";for(let p=0;p<=c;p++){let s=await this.attempt(o,e,n);if("result"in s)return s.result;if(s.stopped)return{...u(e,s.error,i),status:"stopped"};a=s.error}return u(e,a,i)}async attempt(e,n,i){let r=i.signal;if(r?.aborted)return{error:`Step "${n.name}" was stopped before it started.`,stopped:!0};let o=new AbortController,c=new Promise(d=>{o.signal.addEventListener("abort",()=>d(w),{once:!0})}),a=()=>o.abort();r?.addEventListener("abort",a,{once:!0});let p=!1,s=n.timeout,R=s!==void 0&&s>0?setTimeout(()=>{p=!0,o.abort()},s):void 0;try{let d=await Promise.race([e(n,{...i,signal:o.signal}),c]);return d!==w?{result:d}:p?{error:`Step "${n.name}" timed out after ${s} ms.`}:{error:`Step "${n.name}" was stopped before it finished.`,stopped:!0}}catch(d){return d instanceof m?{error:d.message,stopped:!0}:{error:f(d)}}finally{clearTimeout(R),r?.removeEventListener("abort",a)}}check(e,n){return this.handlers.has(e.type)?H(e)??this.checks.get(e.type)?.(e,n):v(e)}getExecutor(e){return this.handlers.get(e)??this.refusingHandler}registerHandler(e,n,i){this.handlers.set(e,n),i?this.checks.set(e,i):this.checks.delete(e)}wrapHandler(e,n){let i=this.handlers.get(e);i&&this.handlers.set(e,n(i))}refusingHandler=async e=>u(e,v(e),new Date().toISOString());registerDefaults(){this.handlers.set("delay",this.createDelayHandler()),this.checks.set("delay",C),this.handlers.set("condition",this.createConditionHandler()),this.checks.set("condition",I)}createDelayHandler(){return async(e,n)=>{let i=new Date().toISOString(),r=x(e.config);if(r===void 0)return u(e,C(e)??"No usable duration",i);let o=Date.now();if(!await O(r,n.signal))return u(e,`Delay step "${e.name}" was stopped before its ${r} ms wait ended.`,i);let a=Math.max(r,Date.now()-o);return $(e,{delayed:r,heldMs:a},i,M(r,a))}}createConditionHandler(){return async(e,n)=>{let i=new Date().toISOString(),r=k(e);if(r||!e.condition)return u(e,r??"No condition",i);try{let o=h(e.condition,n.variables);return $(e,{conditionMet:o},i,o?"The condition held.":"The condition did not hold.")}catch(o){return u(e,`Condition step "${e.name}" could not be evaluated: ${f(o)}.`,i)}}}};export{m as a,x as b,M as c,D as d};
7
+ import{b as f}from"./chunk-CA5NAXSU.mjs";import{ke as S,le as h,pe as g,qe as y,re as P}from"./chunk-6QSHWIZI.mjs";var T=576*60*60*1e3,b=T,m=class extends Error{constructor(e){super(e),this.name="StepCancelledError"}},w=Symbol("stopped");function $(t,e,n,i){let r=new Date().toISOString();return{stepId:t.id,stepName:t.name,stepType:t.type,status:"completed",output:e,summary:i,startTime:n,endTime:r,duration:new Date(r).getTime()-new Date(n).getTime()}}function u(t,e,n){let i=new Date().toISOString();return{stepId:t.id,stepName:t.name,stepType:t.type,status:"failed",error:e,startTime:n,endTime:i,duration:new Date(i).getTime()-new Date(n).getTime()}}function v(t){return P(t.type)?`Step "${t.name}" is a ${String(t.type)} step, which SandForge no longer supports: remove it from the pipeline.`:y(t.type)?`Step "${t.name}" is a ${String(t.type)} step, and this step type cannot run in a pipeline yet.`:`Step "${t.name}" is a "${String(t.type)}" step, a step type this release of SandForge does not have: the pipeline was saved by a later release, or written by hand. Remove the step, or update SandForge.`}function H(t){let{timeout:e}=t;if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e))return`Step "${t.name}" has a timeout that is not a number of milliseconds: ${JSON.stringify(e)}.`;if(e>b)return`Step "${t.name}" has a timeout of ${e} ms, longer than a step can be given: set at most 24 days (${b} ms).`}}function x(t){let e=t.seconds,n=e===void 0?t.durationMs:e;if(typeof n!="number"||!Number.isFinite(n)||n<0)return;let i=e===void 0?n:n*1e3;return i<=T?i:void 0}function l(t){return String(Math.round(t/100)/10)}function M(t,e){let n=Math.max(t,e),i=n-t;return i<=Math.max(5e3,t/100)?`Waited ${l(n)} s.`:`Waited ${l(n)} s by the wall clock, ${l(i)} s more than the ${l(t)} s asked: the machine's clock or a sleep may account for it.`}function C(t){if(t.config.seconds===void 0&&t.config.durationMs===void 0)return`Delay step "${t.name}" has no duration: set how many seconds it waits.`;if(x(t.config)===void 0)return`Delay step "${t.name}" has no usable duration: set a number of seconds, from 0 up to 24 days.`}function E(t,e,n){let i=`Condition step "${t.name}"`;switch(n){case"noEarlierStep":return`${i} tests how the previous step went, and no step comes before it.`;case"noCompare":return`${i} tests how many differences a comparison found, and no Compare step comes before it.`;case"noPrecheck":return`${i} tests ${e}, which a Pre-check hands on, and no Pre-check before it takes that reading.`}}function k(t){let e=t.condition;if(!e||typeof e.field!="string"||e.field.trim()==="")return`Condition step "${t.name}" has no condition to evaluate.`;let n=S(e);return n===void 0?void 0:`Condition step "${t.name}" ${n}.`}function I(t,e){let n=k(t);if(n!==void 0||!t.condition||!e)return n;let i=t.condition,r=g(i,e.steps.slice(0,e.index),e.declared);return r===void 0?void 0:E(t,i.field,r)}function O(t,e){return e?.aborted?Promise.resolve(!1):new Promise(n=>{let i=()=>{clearTimeout(r),n(!1)},r=setTimeout(()=>{e?.removeEventListener("abort",i),n(!0)},t);e?.addEventListener("abort",i,{once:!0})})}var D=class{handlers=new Map;checks=new Map;constructor(){this.registerDefaults()}async execute(e,n){let i=new Date().toISOString(),r=this.check(e);if(r)return u(e,r,i);let o=this.getExecutor(e.type),c=e.retries??0,a="";for(let p=0;p<=c;p++){let s=await this.attempt(o,e,n);if("result"in s)return s.result;if(s.stopped)return{...u(e,s.error,i),status:"stopped"};a=s.error}return u(e,a,i)}async attempt(e,n,i){let r=i.signal;if(r?.aborted)return{error:`Step "${n.name}" was stopped before it started.`,stopped:!0};let o=new AbortController,c=new Promise(d=>{o.signal.addEventListener("abort",()=>d(w),{once:!0})}),a=()=>o.abort();r?.addEventListener("abort",a,{once:!0});let p=!1,s=n.timeout,R=s!==void 0&&s>0?setTimeout(()=>{p=!0,o.abort()},s):void 0;try{let d=await Promise.race([e(n,{...i,signal:o.signal}),c]);return d!==w?{result:d}:p?{error:`Step "${n.name}" timed out after ${s} ms.`}:{error:`Step "${n.name}" was stopped before it finished.`,stopped:!0}}catch(d){return d instanceof m?{error:d.message,stopped:!0}:{error:f(d)}}finally{clearTimeout(R),r?.removeEventListener("abort",a)}}check(e,n){return this.handlers.has(e.type)?H(e)??this.checks.get(e.type)?.(e,n):v(e)}getExecutor(e){return this.handlers.get(e)??this.refusingHandler}registerHandler(e,n,i){this.handlers.set(e,n),i?this.checks.set(e,i):this.checks.delete(e)}wrapHandler(e,n){let i=this.handlers.get(e);i&&this.handlers.set(e,n(i))}refusingHandler=async e=>u(e,v(e),new Date().toISOString());registerDefaults(){this.handlers.set("delay",this.createDelayHandler()),this.checks.set("delay",C),this.handlers.set("condition",this.createConditionHandler()),this.checks.set("condition",I)}createDelayHandler(){return async(e,n)=>{let i=new Date().toISOString(),r=x(e.config);if(r===void 0)return u(e,C(e)??"No usable duration",i);let o=Date.now();if(!await O(r,n.signal))return u(e,`Delay step "${e.name}" was stopped before its ${r} ms wait ended.`,i);let a=Math.max(r,Date.now()-o);return $(e,{delayed:r,heldMs:a},i,M(r,a))}}createConditionHandler(){return async(e,n)=>{let i=new Date().toISOString(),r=k(e);if(r||!e.condition)return u(e,r??"No condition",i);try{let o=h(e.condition,n.variables);return $(e,{conditionMet:o},i,o?"The condition held.":"The condition did not hold.")}catch(o){return u(e,`Condition step "${e.name}" could not be evaluated: ${f(o)}.`,i)}}}};export{m as a,x as b,M as c,D as d};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a,b}from"./chunk-KP5G6FUC.mjs";import"./chunk-ZQO5PDX5.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as describedFieldsOf,b as requiredForAccountKinds};
7
+ import{a,b}from"./chunk-K7G3W7XH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as describedFieldsOf,b as requiredForAccountKinds};
@@ -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-L4RJX7DG.mjs";import"./chunk-TCEXCHXR.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{b as applyUsers,a as planUsersIn};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{b as a,c as b,d as c}from"./chunk-BN33LVPQ.mjs";import"./chunk-3XG25GTF.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-WSUKC2U3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-HFUDCNU5.mjs";import"./chunk-KIMQQ6JQ.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ZUTUYBNW.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ZQO5PDX5.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{c as CycleFkPass,b as RecordsOwingAcrossParts,a as patchCycleFkUpdates};
7
+ import{b as a,c as b,d as c}from"./chunk-P6WRYJN3.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{c as CycleFkPass,b as RecordsOwingAcrossParts,a as patchCycleFkUpdates};
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{d as ae}from"./chunk-JJITOWZK.mjs";import{b as F,d as B}from"./chunk-UV74P4H2.mjs";import{H as ne,d as te,k as E,z as re}from"./chunk-J24TIGSI.mjs";import{Ra as J,Ua as Z,cb as q}from"./chunk-ZQO5PDX5.mjs";import{b as l,e as h,i as X,k as I,l as f,r as Q,s as T,u as _,v as x,z as ee}from"./chunk-WZQEK4WT.mjs";import{randomBytes as _e}from"node:crypto";import{open as Je,readFile as Be,readdir as De,rename as $e,rm as Ue,stat as Ge}from"node:fs/promises";import{homedir as We}from"node:os";import{join as k,resolve as Ze}from"node:path";import*as L from"node:fs";import*as D from"node:path";function Ie(n){return`counting-contract.${F(n)}.json`}function K(n,e,t){return n.assertOutsideRepo(D.join(e,Ie(t)))}function Qe(n,e,t){let r=K(n,e,t.orgId);return L.mkdirSync(D.dirname(r),{recursive:!0}),L.writeFileSync(r,`${JSON.stringify(t,null,2)}
7
+ import{d as ae}from"./chunk-PDRXM5WN.mjs";import{b as F,d as B}from"./chunk-UV74P4H2.mjs";import{H as ne,d as te,k as E,z as re}from"./chunk-N2HYG3BL.mjs";import{Ra as J,Ua as Z,cb as q}from"./chunk-6QSHWIZI.mjs";import{b as l,e as h,i as X,k as I,l as f,r as Q,s as T,u as _,v as x,z as ee}from"./chunk-WZQEK4WT.mjs";import{randomBytes as _e}from"node:crypto";import{open as Je,readFile as Be,readdir as De,rename as $e,rm as Ue,stat as Ge}from"node:fs/promises";import{homedir as We}from"node:os";import{join as k,resolve as Ze}from"node:path";import*as L from"node:fs";import*as D from"node:path";function Ie(n){return`counting-contract.${F(n)}.json`}function K(n,e,t){return n.assertOutsideRepo(D.join(e,Ie(t)))}function Qe(n,e,t){let r=K(n,e,t.orgId);return L.mkdirSync(D.dirname(r),{recursive:!0}),L.writeFileSync(r,`${JSON.stringify(t,null,2)}
8
8
  `,"utf8"),r}function et(n,e){let t=n.assertOutsideRepo(e),r=JSON.parse(L.readFileSync(t,"utf8"));if(r.version!==1||typeof r.objects!="object"||r.objects===null)throw new Error(`Invalid counting contract at ${t}: version 1 with objects expected`);return r}function tt(n,e){if(n.loadStartedAt!==void 0)return n.loadStartedAt===e.startedAt;let t=Date.parse(n.writtenAt),r=Date.parse(e.endedAt);return Number.isFinite(t)&&Number.isFinite(r)&&t>=r}import*as w from"node:fs/promises";import*as O from"node:path";var it=4*1024*1024,ot=64*1024*1024;var oe=1e4,M=l().regex(/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/),b=l().min(1).max(40),st=f({forgeId:l().min(1).max(200),targetOrgId:l().min(1).max(128),timestamp:b,duration:h().nonnegative(),status:_(["success","partial","failure"]),cancelled:x(!0).optional(),writtenBetween:f({first:b,last:b}).optional(),retryOf:l().min(1).max(200).optional(),objects:I(f({objectApiName:l().regex(/^[A-Za-z][A-Za-z0-9_]*$/),ids:I(M)})),linked:h().int().nonnegative(),mayHaveBeenWritten:h().int().nonnegative().optional(),undo:f({removedAt:b,deleted:h().int().nonnegative(),alreadyGone:h().int().nonnegative(),kept:h().int().nonnegative(),refused:h().int().nonnegative(),notReached:h().int().nonnegative().optional(),notVisible:h().int().nonnegative().optional()}).optional(),removalStamps:T(M,b).optional(),removalSpans:I(f({first:b,last:b,userId:M})).optional(),removalLeft:I(M).optional(),sweep:f({sweptAt:b,deleted:h().int().nonnegative(),keptChanged:h().int().nonnegative(),refused:h().int().nonnegative()}).optional(),inJournal:f({journalId:l().min(1).max(200),part:h().int().nonnegative(),left:I(f({objectApiName:l().regex(/^[A-Za-z][A-Za-z0-9_]*$/),count:h().int().nonnegative()}))}).optional()}),dt=f({version:x(1),plans:I(X())}),ct=f({version:x(1),runs:I(f({forgeId:l().min(1).max(300),ids:I(M),late:I(M).optional()}))});var U="referenceid-mapping.json",ze=/^referenceid-mapping\.([A-Za-z0-9_-]{1,128})\.json$/,Re=/^referenceid-mapping\.([A-Za-z0-9_-]{1,128})\.load-\d{1,16}\.ndjson$/,N=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,V=new Set;function ve(n){try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}var Se=f({at:l().min(1).max(40),object:l().regex(/^[A-Za-z][A-Za-z0-9_]{0,79}$/),created:I(Q([l().min(1).max(400),l().regex(N)])).max(1e4)}),Oe=f({journal:f({startedAt:l().min(1).max(40),pid:h().int().positive(),runUserId:l().regex(N).optional()})});function be(n){let e,t={},r=new Map,o;for(let a of n.split(`
9
9
  `)){if(a.trim()==="")continue;let s;try{s=JSON.parse(a)}catch{continue}if(!e){let c=Oe.safeParse(s);c.success&&(e=c.data.journal);continue}let i=Se.safeParse(s);if(!i.success)continue;let d=r.get(i.data.object)??[];for(let[c,u]of i.data.created)Object.prototype.hasOwnProperty.call(t,c)||d.push(c),t[c]=u;r.set(i.data.object,d),o=i.data.at}if(!(!e||o===void 0||Object.keys(t).length===0))return{startedAt:e.startedAt,pid:e.pid,load:{updatedAt:o,mapping:t,created:[...r].filter(([,a])=>a.length>0).map(([a,s])=>({objectApiName:a,referenceIds:s})),load:{startedAt:e.startedAt,endedAt:o},...e.runUserId?{runUserId:e.runUserId}:{}}}}function je(n){return`referenceid-mapping.${F(n)}.json`}async function $(n){let e;try{e=await w.readFile(n,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}return JSON.parse(e)}async function pe(n,e){let t=e.assertOutsideRepo(n),r;try{r=await w.readdir(t)}catch(a){if(a.code==="ENOENT")return[];throw a}let o=new Set(r.flatMap(a=>ze.exec(a)?.[1]??Re.exec(a)?.[1]??[]));if(r.includes(U)){let s=(await $(e.assertOutsideRepo(O.join(t,U))))?.orgId;typeof s=="string"&&Ae(s)&&o.add(s)}return[...o].sort()}function Ae(n){try{return F(n),!0}catch{return!1}}var Ee=I(f({objectApiName:l(),referenceIds:I(l())})),ke=f({startedAt:l(),endedAt:l()}),xe=f({first:l(),last:l()}),Fe=f({removedAt:l(),deleted:h(),alreadyGone:h(),kept:h(),refused:h(),notReached:h().optional()}),Le=T(l(),l()),Me=I(f({first:l(),last:l(),userId:l()})),se=T(l(),l()),Y=l().regex(N);function R(n,e){let t=n.safeParse(e);return t.success?t.data:void 0}function S(n){if(typeof n!="object"||n===null)return;let e=n,t=typeof e.mapping=="object"&&e.mapping!==null?Object.fromEntries(Object.entries(e.mapping).filter(m=>typeof m[1]=="string")):{},r=R(Ee,e.created),o=R(ke,e.load),a=R(xe,e.writtenBetween),s=R(Fe,e.removal),i=R(Le,e.removalStamps),d=R(Me,e.removalSpans),c=R(se,e.personContacts),u=R(se,e.withTheirRecord),g=R(Y,e.runUserId),p=R(I(Y),e.madeEarlier),P=R(I(Y),e.lateEarlier);return{updatedAt:typeof e.updatedAt=="string"?e.updatedAt:"",mapping:t,...r?{created:r}:{},...o?{load:o}:{},...a?{writtenBetween:a}:{},...s?{removal:s}:{},...i?{removalStamps:i}:{},...d?{removalSpans:d}:{},...c?{personContacts:c}:{},...u?{withTheirRecord:u}:{},...g?{runUserId:g}:{},...p?{madeEarlier:p}:{},...P?{lateEarlier:P}:{}}}function j(n){return Array.isArray(n.earlier)?n.earlier.flatMap(e=>S(e)??[]):[]}function A(n){return n.load?.endedAt??n.updatedAt}function Ne(n,e){return n.slice(0,15)===e.slice(0,15)}function v(n){return n.slice(0,15)}function de(n,e){let t={};for(let[r,o]of Object.entries(n??{}))Object.prototype.hasOwnProperty.call(e,o)?Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=o):delete e[r];return t}function ce(n,e){if(e.size===0)return n;let t=Object.fromEntries(Object.entries(n.mapping).filter(([,d])=>!e.has(v(d)))),r=de(n.personContacts,t),o=de(n.withTheirRecord,t),a=n.created?.map(({objectApiName:d,referenceIds:c})=>({objectApiName:d,referenceIds:c.filter(u=>Object.prototype.hasOwnProperty.call(t,u))})).filter(d=>d.referenceIds.length>0),s=Object.fromEntries(Object.entries(n.removalStamps??{}).filter(([d])=>!e.has(v(d)))),i={...n,mapping:t};return delete i.removalStamps,delete i.personContacts,delete i.withTheirRecord,{...i,...a?{created:a}:{},...Object.keys(s).length>0?{removalStamps:s}:{},...Object.keys(r).length>0?{personContacts:r}:{},...Object.keys(o).length>0?{withTheirRecord:o}:{}}}function le(n){return n.created?n.created.some(e=>e.referenceIds.length>0):Object.keys(n.mapping).length>0}var G=class{constructor(e,t){this.sasDir=e;this.guard=t?.guard??new B,this.orgId=t?.orgId??"";let r=t?.organizationId;this.askOrganizationId=typeof r=="function"?r:async()=>r,this.now=t?.now??(()=>new Date)}sasDir;guard;orgId;askOrganizationId;organizationId;now;get filePath(){return this.guard.assertOutsideRepo(O.join(this.sasDir,this.orgId===""?U:je(this.orgId)))}get singleFilePath(){return this.orgId===""?void 0:this.guard.assertOutsideRepo(O.join(this.sasDir,U))}get journalStem(){return this.orgId===""?"referenceid-mapping":`referenceid-mapping.${F(this.orgId)}`}journalPath(e){let t=typeof e=="string"?Date.parse(e):e.getTime();return this.guard.assertOutsideRepo(O.join(this.sasDir,`${this.journalStem}.load-${Math.max(0,Math.trunc(t))}.ndjson`))}retiring=new Map;journal(e){let t=this.journalPath(e),r=!1,o=!1,a=!1,s,i=Promise.resolve(),d;V.add(t);let c=g=>{i=i.then(async()=>{if(!(d!==void 0||o))try{if(!r){r=!0,await w.mkdir(O.dirname(t),{recursive:!0});let p={journal:{startedAt:e.toISOString(),pid:process.pid,...s?{runUserId:s}:{}}};await w.appendFile(t,`${JSON.stringify(p)}
10
10
  `,"utf8")}await w.appendFile(t,`${JSON.stringify(g)}
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{b as N}from"./chunk-WB2RIVO3.mjs";import{a as k}from"./chunk-BOGNK4LV.mjs";import{i as S}from"./chunk-O2PUGRNW.mjs";import{a as _,b as E}from"./chunk-T63U4OZJ.mjs";import{Ac as X,Sa as L,Wb as M,Zb as W,bb as F,cc as z,db as w,fb as U,fc as V,gb as x,ib as G,jb as v,lb as B,lc as H,zb as j}from"./chunk-JFNLKHY6.mjs";import{b as C,f as P,k as b,l as D}from"./chunk-WZQEK4WT.mjs";var q={PII:"PII",PHI:"PHI",PCI:"PCI",Confidential:"SENSITIVE"},K={PII:"fake",PHI:"nullify",PCI:"mask",SENSITIVE:"hash",NONE:"fake"},$={name_pattern:"field_name",type_analysis:"field_name",content_pattern:"content_sampling"},J=.9;function ie(e,t){let n=[];for(let[i,a]of t){let c=a.fields.filter(o=>o.createable&&N({name:o.name,label:o.label,type:o.type})),l=new Map(c.map(o=>[o.name,o])),r=new Map,s=e.detectPII(i,c.map(o=>({apiName:o.name,label:o.label,type:o.type})));for(let o of s.piiFields){let u=l.get(o.fieldApiName);if(!u)continue;let d=q[o.classification];r.set(u.name,{objectApiName:i,fieldApiName:u.name,fieldLabel:u.label,fieldType:u.type,piiCategory:d,detectionMethod:$[o.detectionMethod],confidence:o.confidence,suggestedMethod:K[d]})}for(let o of c)r.has(o.name)||E(o.name,o.type)===void 0||r.set(o.name,{objectApiName:i,fieldApiName:o.name,fieldLabel:o.label,fieldType:o.type,piiCategory:"PII",detectionMethod:"field_name",confidence:J,suggestedMethod:"fake"});n.push(...r.values())}return n}function ae(e,t){let n=a=>`${a.objectApiName}.${a.fieldApiName}`,i=new Set(e.map(n));return[...e,...t.filter(a=>!i.has(n(a)))]}var Y=["Contact","Lead"];function re(e,t,n){if(e==="none")return[];let i=new Set(t),a=[];for(let c of Y){if(!i.has(c))continue;let l=n.filter(s=>s.objectApiName===c).map(s=>s.fieldApiName),r=[];l.some(_)||r.push("name"),l.some(s=>E(s,"string")==="email")||r.push("email"),l.some(s=>E(s,"string")==="phone")||r.push("phone"),r.length>0&&a.push({objectApiName:c,missing:r})}return a}function ce(e){return e.fatalError!==void 0?"failure":e.totalFailure>0||e.failedObjects.length>0?e.totalSuccess+(e.totalLinked??0)>0?"partial":"failure":[...Object.values(e.lookups??{}),...Object.values(e.statuses??{})].some(n=>n.refusals.length>0)||e.stopped===!0?"partial":"success"}var Q=D({name:C().min(1),referenceTo:b(C()).min(1),createable:P().optional(),updateable:P().optional()}).loose();function de(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let i=Q.safeParse(n);i.success&&t.push({name:i.data.name,referenceTo:i.data.referenceTo,createable:i.data.createable??!1,updateable:i.data.updateable??!1})}return t}var ge={STORAGE_EXCEEDED:"AUTOPILOT_STORAGE_EXCEEDED",API_BUDGET_EXCEEDED:"API_BUDGET_EXCEEDED",WRITE_DECLINED:"AUTOPILOT_WRITE_DECLINED",CONFIRMATION_UNAVAILABLE:"AUTOPILOT_CONFIRMATION_UNAVAILABLE",CHECKPOINT_REFUSED:"CHECKPOINT_REFUSED",RUN_CANCELLED:"RUN_CANCELLED",EMAILS_NOT_ACCEPTED:z},Ae={NO_PLAN:"AUTOPILOT_NO_PLAN",STORAGE_UNREAD:"AUTOPILOT_FIT_STORAGE_UNREAD",READ_REFUSED:"AUTOPILOT_FIT_READ_REFUSED",STALE:"AUTOPILOT_FIT_STALE"};function Ie(e,t,n=new Map){return L(e.waves.flatMap(i=>i.objects).map(i=>{let a=n.get(i);return{objectApiName:i,rows:[],counted:{rows:t.get(i)??0,...a!==void 0?{personAccounts:a}:{}}}}))}function he(e){return[...new Set(e.waves.flatMap(t=>t.objects.map(String)))]}async function Ce(e){return M(e)}function Z(e){return e.filter(t=>t.verdict==="exceeds").map(W)}function ee(e){return e.filter(t=>t.verdict==="unread").map(t=>({limit:t.limit,emails:t.emails,unread:t.unread??""}))}function Pe(e){return e.objects.filter(({rows:t})=>t>0).length}async function te(e,t,n,i,a={}){let c="unread"in t?await n().catch(o=>({unread:o instanceof Error?o.message:String(o)})):t.dailyApiRequests,{readBack:l=0,deliverability:r=0,mute:s=0}=a;return w({run:F(e.objects.map(({rows:o})=>({rows:o}))),...G(i),...s>0?{mute:s}:{},...l>0?{readBack:l}:{},...r>0?{deliverability:r}:{}},c)}async function ke(e){let{plan:t}=e,n=j(t,e.storage);if(t.totalRows===0)return{go:!0,check:n,asked:!1};let i=e.checkpointFirst?.estimate,a=v(i);if(a)return{go:!1,...a,check:n};let c=X(n,e.org);if(c)return{go:!1,code:"STORAGE_EXCEEDED",message:`${c} Nothing was written.`,check:n};let l=await te(t,e.storage,e.readApiBudget,i,{...e.readBack!==void 0?{readBack:e.readBack}:{},...e.mute!==void 0?{mute:e.mute}:{},...V(e.runEmails?.ofRun)}),r=U(l,e.org);if(r)return{go:!1,code:"API_BUDGET_EXCEEDED",message:r,check:n};let s=e.confirmAboveRecords,o=s>0&&t.totalRows>s?s:void 0,u=Z(e.emails??[]),d=ee(e.emails??[]),g=e.emailsUncounted,f=e.runEmails?.gate,y=f?.verdict==="asks",R=async m=>{let p=k(f,m&&y),I=e.checkpointFirst;if(I===void 0)return{go:!0,check:n,asked:m,...p};let h=await B(()=>I.take(I.estimate));return"stop"in h?{go:!1,...h.stop,check:n,...p}:{go:!0,check:n,asked:m,checkpoint:h.checkpoint,...p}};if(o===void 0&&n.verdict==="fits"&&u.length===0&&d.length===0&&g===void 0&&i===void 0&&!y)return R(!1);let A=S(e.orgTier),T=await e.confirm({stage:"write",module:"autopilot",org:e.org,orgTier:e.orgTier,objects:t.objects.map(({objectApiName:m,rows:p})=>({objectApiName:m,rows:p})),total:t.totalRows,...o!==void 0?{aboveRecords:o}:{},...A!==void 0&&t.totalRows>A?{largeVolume:A}:{},storage:H(n),counted:!0,...u.length>0?{emails:u}:{},...d.length>0?{emailsUnread:d}:{},...g!==void 0?{emailsUncounted:g}:{},...x(l),...i!==void 0?{checkpoint:i}:{},...f?.confirmation});if(T==="confirmed")return R(!0);let O=k(f,!1);return T==="declined"?{go:!1,code:"WRITE_DECLINED",message:"The Autopilot run was cancelled before it wrote anything. Nothing was written.",check:n,...O}:{go:!1,code:"CONFIRMATION_UNAVAILABLE",message:"The Autopilot run needed a confirmation before it wrote, and there was no one to ask. Nothing was written: run it again from the Autopilot page, where the question is asked.",check:n,...O}}export{ie as a,ae as b,re as c,ce as d,de as e,ge as f,Ae as g,Ie as h,he as i,Ce as j,Pe as k,te as l,ke as m};
7
+ import{b as N}from"./chunk-WB2RIVO3.mjs";import{a as k}from"./chunk-BOGNK4LV.mjs";import{i as S}from"./chunk-XMQ5R6TC.mjs";import{a as _,b as E}from"./chunk-T63U4OZJ.mjs";import{$a as U,$b as V,Ma as L,Qb as M,Tb as W,Xa as F,Yb as z,Za as w,ab as x,cb as G,db as v,fb as B,fc as H,tb as j,uc as X}from"./chunk-R3OM3X4L.mjs";import{b as C,f as P,k as b,l as D}from"./chunk-WZQEK4WT.mjs";var q={PII:"PII",PHI:"PHI",PCI:"PCI",Confidential:"SENSITIVE"},K={PII:"fake",PHI:"nullify",PCI:"mask",SENSITIVE:"hash",NONE:"fake"},$={name_pattern:"field_name",type_analysis:"field_name",content_pattern:"content_sampling"},J=.9;function ie(e,t){let n=[];for(let[i,a]of t){let c=a.fields.filter(o=>o.createable&&N({name:o.name,label:o.label,type:o.type})),l=new Map(c.map(o=>[o.name,o])),r=new Map,s=e.detectPII(i,c.map(o=>({apiName:o.name,label:o.label,type:o.type})));for(let o of s.piiFields){let u=l.get(o.fieldApiName);if(!u)continue;let d=q[o.classification];r.set(u.name,{objectApiName:i,fieldApiName:u.name,fieldLabel:u.label,fieldType:u.type,piiCategory:d,detectionMethod:$[o.detectionMethod],confidence:o.confidence,suggestedMethod:K[d]})}for(let o of c)r.has(o.name)||E(o.name,o.type)===void 0||r.set(o.name,{objectApiName:i,fieldApiName:o.name,fieldLabel:o.label,fieldType:o.type,piiCategory:"PII",detectionMethod:"field_name",confidence:J,suggestedMethod:"fake"});n.push(...r.values())}return n}function ae(e,t){let n=a=>`${a.objectApiName}.${a.fieldApiName}`,i=new Set(e.map(n));return[...e,...t.filter(a=>!i.has(n(a)))]}var Y=["Contact","Lead"];function re(e,t,n){if(e==="none")return[];let i=new Set(t),a=[];for(let c of Y){if(!i.has(c))continue;let l=n.filter(s=>s.objectApiName===c).map(s=>s.fieldApiName),r=[];l.some(_)||r.push("name"),l.some(s=>E(s,"string")==="email")||r.push("email"),l.some(s=>E(s,"string")==="phone")||r.push("phone"),r.length>0&&a.push({objectApiName:c,missing:r})}return a}function ce(e){return e.fatalError!==void 0?"failure":e.totalFailure>0||e.failedObjects.length>0?e.totalSuccess+(e.totalLinked??0)>0?"partial":"failure":[...Object.values(e.lookups??{}),...Object.values(e.statuses??{})].some(n=>n.refusals.length>0)||e.stopped===!0?"partial":"success"}var Q=D({name:C().min(1),referenceTo:b(C()).min(1),createable:P().optional(),updateable:P().optional()}).loose();function de(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let i=Q.safeParse(n);i.success&&t.push({name:i.data.name,referenceTo:i.data.referenceTo,createable:i.data.createable??!1,updateable:i.data.updateable??!1})}return t}var ge={STORAGE_EXCEEDED:"AUTOPILOT_STORAGE_EXCEEDED",API_BUDGET_EXCEEDED:"API_BUDGET_EXCEEDED",WRITE_DECLINED:"AUTOPILOT_WRITE_DECLINED",CONFIRMATION_UNAVAILABLE:"AUTOPILOT_CONFIRMATION_UNAVAILABLE",CHECKPOINT_REFUSED:"CHECKPOINT_REFUSED",RUN_CANCELLED:"RUN_CANCELLED",EMAILS_NOT_ACCEPTED:z},Ae={NO_PLAN:"AUTOPILOT_NO_PLAN",STORAGE_UNREAD:"AUTOPILOT_FIT_STORAGE_UNREAD",READ_REFUSED:"AUTOPILOT_FIT_READ_REFUSED",STALE:"AUTOPILOT_FIT_STALE"};function Ie(e,t,n=new Map){return L(e.waves.flatMap(i=>i.objects).map(i=>{let a=n.get(i);return{objectApiName:i,rows:[],counted:{rows:t.get(i)??0,...a!==void 0?{personAccounts:a}:{}}}}))}function he(e){return[...new Set(e.waves.flatMap(t=>t.objects.map(String)))]}async function Ce(e){return M(e)}function Z(e){return e.filter(t=>t.verdict==="exceeds").map(W)}function ee(e){return e.filter(t=>t.verdict==="unread").map(t=>({limit:t.limit,emails:t.emails,unread:t.unread??""}))}function Pe(e){return e.objects.filter(({rows:t})=>t>0).length}async function te(e,t,n,i,a={}){let c="unread"in t?await n().catch(o=>({unread:o instanceof Error?o.message:String(o)})):t.dailyApiRequests,{readBack:l=0,deliverability:r=0,mute:s=0}=a;return w({run:F(e.objects.map(({rows:o})=>({rows:o}))),...G(i),...s>0?{mute:s}:{},...l>0?{readBack:l}:{},...r>0?{deliverability:r}:{}},c)}async function ke(e){let{plan:t}=e,n=j(t,e.storage);if(t.totalRows===0)return{go:!0,check:n,asked:!1};let i=e.checkpointFirst?.estimate,a=v(i);if(a)return{go:!1,...a,check:n};let c=X(n,e.org);if(c)return{go:!1,code:"STORAGE_EXCEEDED",message:`${c} Nothing was written.`,check:n};let l=await te(t,e.storage,e.readApiBudget,i,{...e.readBack!==void 0?{readBack:e.readBack}:{},...e.mute!==void 0?{mute:e.mute}:{},...V(e.runEmails?.ofRun)}),r=U(l,e.org);if(r)return{go:!1,code:"API_BUDGET_EXCEEDED",message:r,check:n};let s=e.confirmAboveRecords,o=s>0&&t.totalRows>s?s:void 0,u=Z(e.emails??[]),d=ee(e.emails??[]),g=e.emailsUncounted,f=e.runEmails?.gate,y=f?.verdict==="asks",R=async m=>{let p=k(f,m&&y),I=e.checkpointFirst;if(I===void 0)return{go:!0,check:n,asked:m,...p};let h=await B(()=>I.take(I.estimate));return"stop"in h?{go:!1,...h.stop,check:n,...p}:{go:!0,check:n,asked:m,checkpoint:h.checkpoint,...p}};if(o===void 0&&n.verdict==="fits"&&u.length===0&&d.length===0&&g===void 0&&i===void 0&&!y)return R(!1);let A=S(e.orgTier),T=await e.confirm({stage:"write",module:"autopilot",org:e.org,orgTier:e.orgTier,objects:t.objects.map(({objectApiName:m,rows:p})=>({objectApiName:m,rows:p})),total:t.totalRows,...o!==void 0?{aboveRecords:o}:{},...A!==void 0&&t.totalRows>A?{largeVolume:A}:{},storage:H(n),counted:!0,...u.length>0?{emails:u}:{},...d.length>0?{emailsUnread:d}:{},...g!==void 0?{emailsUncounted:g}:{},...x(l),...i!==void 0?{checkpoint:i}:{},...f?.confirmation});if(T==="confirmed")return R(!0);let O=k(f,!1);return T==="declined"?{go:!1,code:"WRITE_DECLINED",message:"The Autopilot run was cancelled before it wrote anything. Nothing was written.",check:n,...O}:{go:!1,code:"CONFIRMATION_UNAVAILABLE",message:"The Autopilot run needed a confirmation before it wrote, and there was no one to ask. Nothing was written: run it again from the Autopilot page, where the question is asked.",check:n,...O}}export{ie as a,ae as b,re as c,ce as d,de as e,ge as f,Ae as g,Ie as h,he as i,Ce as j,Pe as k,te as l,ke as m};
@@ -0,0 +1,9 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{d as v}from"./chunk-UV74P4H2.mjs";import{d as f,k as h,z as b}from"./chunk-N2HYG3BL.mjs";import{Ua as E,ib as x,jb as U,kb as A,lb as P,sb as _}from"./chunk-6QSHWIZI.mjs";import{b as o,e as l,f as m,k as i,m as a,u as c,v as w,z as O}from"./chunk-WZQEK4WT.mjs";import{randomBytes as k}from"node:crypto";import{open as I,readFile as j,readdir as F,rename as M,rm as J}from"node:fs/promises";import{homedir as Z}from"node:os";import{join as p,resolve as G}from"node:path";var T="users";function se(n=process.env){let e=n.SANDFORGE_JOURNAL_DIR,r=e!==void 0&&e.trim()!==""?G(e):p(Z(),".sandforge");return p(r,T)}var g=O.datetime({offset:!0}),R=l().int().nonnegative(),y=l().int().positive().max(999999),D=a({isActive:m(),isFrozen:m(),profileId:o().regex(/^00e[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/)}),H=a({id:o().regex(/^(?:0Pa|011)[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/),what:c(["permissionSet","permissionSetGroup","group"]),name:o().regex(/^[A-Za-z][A-Za-z0-9_]*$/).max(80),type:c(["Regular","Queue"]).optional()}),X=a({applied:_,after:D,accesses:i(H).max(U+A+P),inFile:m()}),L=a({at:g,status:c(["success","partial","failure","cancelled"]),undone:R,kept:R,codes:i(o().regex(/^[A-Z][A-Z_]{1,63}$/)).max(50)}),S=a({version:w(1),organizationId:E,run:y,replaces:y.optional(),status:c(["running","success","partial","failure","cancelled"]),startedAt:g,endedAt:g.optional(),emailsToPeople:R,users:i(X).max(2*x),removals:i(L).max(1e3).optional()});function C(n){return`refused with ${n}; the org\u2019s words are not kept, as they may name the person`}function N(n){return{...n,users:n.users.map(e=>e.applied.refused===void 0?e:{...e,applied:{...e.applied,refused:e.applied.refused.map(r=>({...r,message:C(r.code)}))}})}}var K=/^run-([1-9]\d{0,5})\.json$/,$=class{root;guard;constructor(e){this.guard=e.guard??new v,this.root=this.guard.assertOutsideRepo(e.root)}folderOf(e){return this.guard.assertOutsideRepo(p(this.root,h(e)))}fileOf(e,r){return p(this.folderOf(e),`run-${y.parse(r)}.json`)}async begin(e,r){let s=this.folderOf(e);await b(s);for(let t=await this.highest(e)+1;;t+=1){let u=S.parse(N({...r,version:1,organizationId:h(e),run:t})),d;try{d=await I(this.fileOf(e,t),"wx",f)}catch(z){if(z.code==="EEXIST")continue;throw z}try{await d.writeFile(`${JSON.stringify(u,null,2)}
8
+ `,"utf8"),await d.sync()}finally{await d.close()}return u}}async write(e){let r=S.parse(N(e));await W(this.fileOf(r.organizationId,r.run),`${JSON.stringify(r,null,2)}
9
+ `)}async read(e,r){let s;try{s=await j(this.fileOf(e,r),"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}try{let t=S.safeParse(JSON.parse(s));return t.success&&t.data.run===r?t.data:void 0}catch{return}}async list(e){let r=[];for(let s of(await this.numbers(e)).sort((t,u)=>u-t)){let t=await this.read(e,s);t&&r.push(t)}return r}async numbers(e){let r;try{r=await F(this.folderOf(e))}catch(s){if(s.code==="ENOENT")return[];throw s}return r.flatMap(s=>{let t=K.exec(s);return t?[Number(t[1])]:[]})}async highest(e){return Math.max(0,...await this.numbers(e))}};async function W(n,e){let r=`${n}.${process.pid}-${k(4).toString("hex")}.tmp`,s=await I(r,"wx",f);try{try{await s.writeFile(e,"utf8"),await s.sync()}finally{await s.close()}await M(r,n)}catch(t){throw await J(r,{force:!0}),t}}export{se as a,X as b,S as c,$ as d};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{Q as f,j as k,k as s}from"./chunk-J24TIGSI.mjs";import{a as d,b as u}from"./chunk-PC247GKX.mjs";import{tb as i}from"./chunk-ZQO5PDX5.mjs";import{b as c,l as a,u as p}from"./chunk-WZQEK4WT.mjs";import{homedir as E}from"node:os";import{join as O}from"node:path";var $=a({...d,operation:p(["apply","destroy","reset","recover"]),env:i,alias:c().min(1).max(255).optional()}),l=u(n=>{let e=$.safeParse(n);return e.success?e.data:void 0});function j(n=E()){return k(n)}function v(n,e){return O(n,`${s(e)}.env.lock`)}function K(n,e,o,r={}){let m=v(n,e),y=i.parse(o.env),t=l.acquire(m,h=>({...h,operation:o.operation,env:y,...o.alias!==void 0?{alias:o.alias}:{}}),r);return"busy"in t?{busy:L(t.busy)}:{lock:{organizationId:s(e),release:t.lock.release}}}function N(n,e,o={}){let r=l.holder(v(n,e),o);return r!==void 0?L(r):void 0}function L({version:n,token:e,...o}){return o}function g(n){return`process ${n.pid} on ${n.host}, since ${n.acquiredAt}`}function R(n){return`${w(n)}. Nothing was written: run this again once it ends. Two jobs applying to one org from two machines are not kept apart: give them one concurrency group.`}function w(n){let e=n.alias!==void 0?` to ${n.alias}`:"";return`${n.operation==="apply"?"an apply":n.operation==="recover"?"a state recover":`a ${n.operation}`} of ${n.env}${e} is under way on this machine (${g(n)})`}function _(n,e,o={}){let r=f(n,e,o);if(r!==void 0)return`a checkpoint ${r.operation} of this org is under way on this machine (${g(r)}): its records would be read or written as the step writes. Run this again once it ends.`}export{j as a,v as b,K as c,N as d,R as e,w as f,_ as g};
7
+ import{Q as f,j as k,k as s}from"./chunk-N2HYG3BL.mjs";import{a as d,b as u}from"./chunk-PC247GKX.mjs";import{vb as i}from"./chunk-6QSHWIZI.mjs";import{b as c,l as a,u as p}from"./chunk-WZQEK4WT.mjs";import{homedir as E}from"node:os";import{join as O}from"node:path";var $=a({...d,operation:p(["apply","destroy","reset","recover"]),env:i,alias:c().min(1).max(255).optional()}),l=u(n=>{let e=$.safeParse(n);return e.success?e.data:void 0});function j(n=E()){return k(n)}function v(n,e){return O(n,`${s(e)}.env.lock`)}function K(n,e,o,r={}){let m=v(n,e),y=i.parse(o.env),t=l.acquire(m,h=>({...h,operation:o.operation,env:y,...o.alias!==void 0?{alias:o.alias}:{}}),r);return"busy"in t?{busy:L(t.busy)}:{lock:{organizationId:s(e),release:t.lock.release}}}function N(n,e,o={}){let r=l.holder(v(n,e),o);return r!==void 0?L(r):void 0}function L({version:n,token:e,...o}){return o}function g(n){return`process ${n.pid} on ${n.host}, since ${n.acquiredAt}`}function R(n){return`${w(n)}. Nothing was written: run this again once it ends. Two jobs applying to one org from two machines are not kept apart: give them one concurrency group.`}function w(n){let e=n.alias!==void 0?` to ${n.alias}`:"";return`${n.operation==="apply"?"an apply":n.operation==="recover"?"a state recover":`a ${n.operation}`} of ${n.env}${e} is under way on this machine (${g(n)})`}function _(n,e,o={}){let r=f(n,e,o);if(r!==void 0)return`a checkpoint ${r.operation} of this org is under way on this machine (${g(r)}): its records would be read or written as the step writes. Run this again once it ends.`}export{j as a,v as b,K as c,N as d,R as e,w as f,_ as g};
@@ -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-A65ADTCR.mjs";import{K as we,Q as Se,b as ye}from"./chunk-A7JJWOLT.mjs";import{Ga as he,Ia as be,h as x,i as fe,j as ge,k as D}from"./chunk-P55MKIZX.mjs";import{o as se,p as ie,q as ae,r as de,s as ue}from"./chunk-WSUKC2U3.mjs";import{g as oe}from"./chunk-JQZTMFO7.mjs";import{$b as B,Rb as ce,Sb as le,Tb as N,Ub as me,nc as pe}from"./chunk-JFNLKHY6.mjs";import{h as re}from"./chunk-HFUDCNU5.mjs";import{b as z}from"./chunk-HFSBDM7B.mjs";import{q as F}from"./chunk-KIMQQ6JQ.mjs";import{b as v}from"./chunk-CA5NAXSU.mjs";import{c as ee,d as te,g as ne}from"./chunk-ZUTUYBNW.mjs";import{Ad as Q,Cd as P,Nd as V,Qd as X,Rd as J,Sd as Y,Td as Z,Xc as H,h as W,i as O,ic as G,k as U,xd as K}from"./chunk-ZQO5PDX5.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&&se([e.error],e.errorDetails)}function Pe(e,r){return e.error===void 0?e:{...e,error:ae(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=>ie(f,o)),A=async(f,a,c,h)=>{let b=Math.min(Math.max(1,h),$e),l=await de({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=ue("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 oe({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-AHUGG3WU.mjs";import{K as we,Q as Se,b as ye}from"./chunk-OO24ZYYJ.mjs";import{Ga as he,Ia as be,h as x,i as fe,j as ge,k as D}from"./chunk-5OGNK3JP.mjs";import{o as se,p as ie,q as ae,r as de,s as ue}from"./chunk-YBZIDW6W.mjs";import{g as oe}from"./chunk-WXU6ZJIV.mjs";import{Lb as ce,Mb as le,Nb as N,Ob as me,Vb as B,hc as pe}from"./chunk-R3OM3X4L.mjs";import{h as re}from"./chunk-ZOSESZ22.mjs";import{b as z}from"./chunk-HFSBDM7B.mjs";import{q as F}from"./chunk-2GSMHGIV.mjs";import{b as v}from"./chunk-CA5NAXSU.mjs";import{c as ee,d as te,g as ne}from"./chunk-ISOSTAJR.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-6QSHWIZI.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&&se([e.error],e.errorDetails)}function Pe(e,r){return e.error===void 0?e:{...e,error:ae(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=>ie(f,o)),A=async(f,a,c,h)=>{let b=Math.min(Math.max(1,h),$e),l=await de({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=ue("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 oe({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{a,b,c,d,e,f,g,h}from"./chunk-T7WREYA5.mjs";import"./chunk-V3R45ZWT.mjs";import"./chunk-A65ADTCR.mjs";import"./chunk-NWOI25WY.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-VPDEJGPS.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ZQO5PDX5.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{d as ARTICLE_OBJECT,b as CASE_STATUS_BY_LABEL_SOQL,a as CASE_STATUS_SOQL,g as prepareScenario,c as readScenarioCaseStatus,f as scenarioCasePicklists,e as scenarioKnowledge,h as toolingQueryAll};
7
+ import{a,b,c,d,e,f,g,h}from"./chunk-KKS2KFBT.mjs";import"./chunk-OTJH6AEA.mjs";import"./chunk-AHUGG3WU.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{d as ARTICLE_OBJECT,b as CASE_STATUS_BY_LABEL_SOQL,a as CASE_STATUS_SOQL,g as prepareScenario,c as readScenarioCaseStatus,f as scenarioCasePicklists,e as scenarioKnowledge,h as toolingQueryAll};
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a as qr}from"./chunk-INIQ23K6.mjs";import{a as Gr}from"./chunk-2UU42PTD.mjs";import{b as Kt}from"./chunk-2JZGCCPG.mjs";import{$ as Kr,C as _r,F as Wr,G as Ur,H as Br,V as zr,W as mt,X as wt,Y as Jr,Z as Hr,aa as yt,ba as Yr,c as Or,e as jr,f as Cr,h as xr,j as Ir,k as Er,u as Tr,x as Mr}from"./chunk-A7JJWOLT.mjs";import{b as Fr,g as Pr}from"./chunk-ZXFL2MSN.mjs";import{a as Lr,f as Dr}from"./chunk-VYOYXTCU.mjs";import{e as gt,m as Nr}from"./chunk-52EXDVPN.mjs";import{Ab as Sr,Bb as ft,Cb as vr,Db as $r,Eb as Ar,Wa as De,Y as hr,cb as pr,d as at,db as ct,e as rr,f as or,g as sr,h as ir,i as dt,j as ar,k as dr,l as cr,lb as gr,mb as mr,n as ur,p as lr,pb as ut,qb as We,rb as wr,sb as lt,tb as yr,xb as br,yb as Rr,zb as kr}from"./chunk-3HEMJTAP.mjs";import{k as Mn,n as _n}from"./chunk-QAPVKPEC.mjs";import{a as _e,j as Xn,k as Zn}from"./chunk-BNKT3R3F.mjs";import{b as xe,e as Ve}from"./chunk-BZ24IAP5.mjs";import{a as _t}from"./chunk-SCKUIE3R.mjs";import{a as Yt,b as Vt,c as Te,d as Xt,e as Zt,g as Qt,h as en,j as tn}from"./chunk-6FARZYMJ.mjs";import{a as ht,c as pt}from"./chunk-MUEQRIK7.mjs";import{B as hn,Gc as En,x as ln,y as fn,yc as Cn}from"./chunk-ISSP2FZ5.mjs";import{h as ot,i as st}from"./chunk-XU25YA46.mjs";import{Wa as Qn,Xa as er,bb as tr,db as nr,m as Le}from"./chunk-P55MKIZX.mjs";import{k as Vn}from"./chunk-PYRZFUVU.mjs";import{b as yn,l as In}from"./chunk-O2PUGRNW.mjs";import{C as mn,N as Fe,Q as wn,a as nn}from"./chunk-7SDZR6SR.mjs";import{n as Nn}from"./chunk-WSUKC2U3.mjs";import{a as Ze,b as bn,c as kn,f as Sn,h as Qe,k as vn,l as $n,n as An,o as On,p as et,s as tt,u as nt,x as jn}from"./chunk-3SKLBRPL.mjs";import{c as rt,d as xn}from"./chunk-SAMWHL22.mjs";import{a as Pe,b as Ne,g as Pn,h as Me,j as fe}from"./chunk-HKUWHVI7.mjs";import{b as Ce,c as ke}from"./chunk-LHU6CPGE.mjs";import{a as Re,b as Jt,f as Ye}from"./chunk-ZUOPC4W2.mjs";import{b as Tn,c as Fn}from"./chunk-JQZTMFO7.mjs";import{$a as Un,$b as Gn,Ic as Kn,Jc as Yn,La as Dn,Pb as qn,_a as Wn,cc as it,eb as Bn,gc as zn,hb as he,i as Xe,mc as Jn,na as Ln,tc as Hn}from"./chunk-JFNLKHY6.mjs";import{i as rn}from"./chunk-INIT2UKJ.mjs";import{h as gn}from"./chunk-HFUDCNU5.mjs";import{b as co}from"./chunk-MS4FJDFD.mjs";import{D as le,F as un,p as an}from"./chunk-XZISAZA6.mjs";import{b as Ht,d as Ie,f as Ee,h as fr}from"./chunk-LCDPCUXS.mjs";import{a as re}from"./chunk-EADHKH3A.mjs";import{j as pn}from"./chunk-ZUTUYBNW.mjs";import{j as on,w as sn}from"./chunk-ICIYL45C.mjs";import{a as cn}from"./chunk-PR74GYVI.mjs";import{a as dn}from"./chunk-TMA34QMA.mjs";import{d as Rn}from"./chunk-TUACWKIH.mjs";import{$c as Bt,Ic as Dt,Jc as Ke,Jd as qt,Ld as Gt,Mc as Wt,Md as zt,_c as Ut,ic as Lt}from"./chunk-ZQO5PDX5.mjs";import{A as R}from"./chunk-WZQEK4WT.mjs";import{d as ao}from"./chunk-NTOVCTRS.mjs";var ko=ao(co());import{randomUUID as go}from"node:crypto";import{existsSync as Se,mkdirSync as mo,readFileSync as ve,renameSync as wo,writeFileSync as yo}from"node:fs";import{dirname as bo,join as pe,resolve as Ro}from"node:path";var So=`sandforge sync \u2014 run a Sync between two orgs, without the editor.
7
+ import{a as qr}from"./chunk-INIQ23K6.mjs";import{a as Gr}from"./chunk-J3TIHLWG.mjs";import{b as Kt}from"./chunk-ETNQHIDI.mjs";import{$ as Kr,C as _r,F as Wr,G as Ur,H as Br,V as zr,W as mt,X as wt,Y as Jr,Z as Hr,aa as yt,ba as Yr,c as Or,e as jr,f as Cr,h as xr,j as Ir,k as Er,u as Tr,x as Mr}from"./chunk-OO24ZYYJ.mjs";import{b as Fr,g as Pr}from"./chunk-ALBY5SOH.mjs";import{a as Lr,f as Dr}from"./chunk-6YC2ELCU.mjs";import{e as gt,m as Nr}from"./chunk-GEEWPTV5.mjs";import{Ab as Sr,Bb as ft,Cb as vr,Db as $r,Eb as Ar,Wa as De,Y as hr,cb as pr,d as at,db as ct,e as rr,f as or,g as sr,h as ir,i as dt,j as ar,k as dr,l as cr,lb as gr,mb as mr,n as ur,p as lr,pb as ut,qb as We,rb as wr,sb as lt,tb as yr,xb as br,yb as Rr,zb as kr}from"./chunk-LYOGCIYD.mjs";import{k as Mn,n as _n}from"./chunk-X4HZD5U2.mjs";import{a as _e,j as Xn,k as Zn}from"./chunk-BNKT3R3F.mjs";import{b as xe,e as Ve}from"./chunk-BZ24IAP5.mjs";import{a as _t}from"./chunk-SCKUIE3R.mjs";import{a as Yt,b as Vt,c as Te,d as Xt,e as Zt,g as Qt,h as en,j as tn}from"./chunk-6FARZYMJ.mjs";import{a as ht,c as pt}from"./chunk-HVX2AFYW.mjs";import{B as hn,Gc as En,x as ln,y as fn,yc as Cn}from"./chunk-AXFD2OH6.mjs";import{h as ot,i as st}from"./chunk-X2XZQ434.mjs";import{Wa as Qn,Xa as er,bb as tr,db as nr,m as Le}from"./chunk-5OGNK3JP.mjs";import{k as Vn}from"./chunk-QLRWU3MB.mjs";import{b as yn,l as In}from"./chunk-XMQ5R6TC.mjs";import{B as mn,M as Fe,P as wn,a as nn}from"./chunk-IXIY6Q4M.mjs";import{n as Nn}from"./chunk-YBZIDW6W.mjs";import{a as Ze,b as bn,c as kn,f as Sn,h as Qe,k as vn,l as $n,n as An,o as On,p as et,s as tt,u as nt,x as jn}from"./chunk-BT43WSOS.mjs";import{c as rt,d as xn}from"./chunk-EOQON3E5.mjs";import{a as Pe,b as Ne,g as Pn,h as Me,j as fe}from"./chunk-7WSQ65WG.mjs";import{b as Ce,c as ke}from"./chunk-7ZBDACVG.mjs";import{a as Re,b as Jt,f as Ye}from"./chunk-4GCYGQXD.mjs";import{b as Tn,c as Fn}from"./chunk-WXU6ZJIV.mjs";import{Cc as Kn,Dc as Yn,Fa as Dn,Jb as qn,Ua as Wn,Va as Un,Vb as Gn,Yb as it,_a as Bn,ac as zn,bb as he,c as Xe,gc as Jn,ha as Ln,nc as Hn}from"./chunk-R3OM3X4L.mjs";import{i as rn}from"./chunk-INIT2UKJ.mjs";import{h as gn}from"./chunk-ZOSESZ22.mjs";import{b as co}from"./chunk-MS4FJDFD.mjs";import{D as le,F as un,p as an}from"./chunk-ZXOUWHYE.mjs";import{b as Ht,d as Ie,f as Ee,h as fr}from"./chunk-LCDPCUXS.mjs";import{a as re}from"./chunk-EADHKH3A.mjs";import{j as pn}from"./chunk-ISOSTAJR.mjs";import{j as on,w as sn}from"./chunk-ICIYL45C.mjs";import{a as cn}from"./chunk-7BQMBXKX.mjs";import{a as dn}from"./chunk-KWAVSZ2B.mjs";import{d as Rn}from"./chunk-TUACWKIH.mjs";import{Vc as Dt,Wc as Ke,Wd as qt,Yd as Gt,Zc as Wt,Zd as zt,ld as Ut,md as Bt,vc as Lt}from"./chunk-6QSHWIZI.mjs";import{A as R}from"./chunk-WZQEK4WT.mjs";import{d as ao}from"./chunk-NTOVCTRS.mjs";var ko=ao(co());import{randomUUID as go}from"node:crypto";import{existsSync as Se,mkdirSync as mo,readFileSync as ve,renameSync as wo,writeFileSync as yo}from"node:fs";import{dirname as bo,join as pe,resolve as Ro}from"node:path";var So=`sandforge sync \u2014 run a Sync between two orgs, without the editor.
8
8
 
9
9
  Usage:
10
10
  npx sandforge sync \\
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{G as w,Hb as k,Tb as j,e as m,f as h,i as $,j as y,wc as v}from"./chunk-ZQO5PDX5.mjs";var R=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,T=new Set(["static","random","sequence","formula","reference","picklist_random","ai_generate","faker","regex","from_csv"]),A=class{validate(n){let t=[],a=[];return S(n,t),N(n,t,a),P(n,t),n.objects?.length&&C(n,t),M(n,t),q(n,t),{valid:t.length===0,errors:t,warnings:a}}};function S(e,n){(!e.name||e.name.trim().length===0)&&n.push({field:"name",message:"Template name is required"})}function N(e,n,t){if(!e.objects||e.objects.length===0){n.push({field:"objects",message:"Template must have at least one object"});return}for(let a of e.objects)E(a,n,t,$(a.objectApiName,e.relations))}function E(e,n,t,a){let i=`objects[${e.objectApiName}]`;(!e.objectApiName||e.objectApiName.trim().length===0)&&n.push({field:i,message:"Object API name is required"}),e.recordCount<=0&&n.push({field:`${i}.recordCount`,message:"Record count must be positive"}),e.recordCount>0&&e.fieldRules.length===0&&!a&&!V(e.rows)&&n.push({field:`${i}.fieldRules`,message:`${e.objectApiName} asks for ${e.recordCount} record(s) and names no field to fill: add at least one field rule`}),e.recordCount>1e5&&t.push({field:`${i}.recordCount`,message:"Record count exceeds 100,000 \u2014 consider using grappe mode"}),e.batchSize<=0&&n.push({field:`${i}.batchSize`,message:"Batch size must be positive"});for(let s of e.fieldRules)F(s,i,n);e.rows!==void 0&&x(e.rows,i,n)}function V(e){return Array.isArray(e)&&e.some(n=>b(n?.values)&&Object.keys(n.values).length>0)}function b(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function x(e,n,t){if(!Array.isArray(e)||e.length===0){t.push({field:`${n}.rows`,message:"Rows, when given, are at least one"});return}let a=new Set,i=h.maxKeyLength;for(let[s,o]of e.entries()){let r=`${n}.rows[${s}]`,c=b(o)?o:{},{key:d,parentKey:l,values:f}=c;if(typeof d!="string"||d.length===0||d.length>i?t.push({field:`${r}.key`,message:`A row is named by a key of 1 to ${i} characters`}):a.has(d)?t.push({field:`${r}.key`,message:`The key "${d}" names more than one row: each row is named once`}):a.add(d),l!==void 0&&(typeof l!="string"||l.length===0||l.length>i)&&t.push({field:`${r}.parentKey`,message:`A row names its parent by a key of 1 to ${i} characters`}),!b(f)){t.push({field:`${r}.values`,message:"A row gives its values as fields and values"});continue}for(let[u,g]of Object.entries(f))O(g)||t.push({field:`${r}.values[${u}]`,message:`${u} is given a value no field takes: a text of at most ${h.maxTextLength} characters, a number, true or false, or null`})}}function O(e){return e===null||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):typeof e=="string"&&e.length<=h.maxTextLength}function C(e,n){let t=i=>{let[s,o,...r]=i,c=s==="objects"?e.objects[Number(o)]:void 0,d=s==="relations"?e.relations?.[Number(o)]:void 0,l=c?`objects[${c.objectApiName}]`:d?`relations[${d.childObject}.${d.lookupField}]`:`${String(s)}[${String(o)}]`;return r.reduce((f,u)=>typeof u=="number"?`${f}[${u}]`:`${f}.${u}`,l)};if(e.objects.every(i=>i.rows===void 0||Array.isArray(i.rows)&&i.rows.every(b)))for(let i of w(e))n.push({field:t(i.path),message:i.message})}function F(e,n,t){let a=`${n}.fieldRules[${e.fieldApiName}]`;(!e.fieldApiName||e.fieldApiName.trim().length===0)&&t.push({field:a,message:"Field API name is required"}),T.has(e.ruleType)||t.push({field:`${a}.ruleType`,message:`Invalid rule type: ${e.ruleType}`}),I(e,a,t)}function I(e,n,t){switch(e.ruleType){case"reference":e.config.referenceObject||t.push({field:`${n}.config.referenceObject`,message:"Reference rule requires a referenceObject"});break;case"picklist_random":(!e.config.picklistValues||e.config.picklistValues.length===0)&&t.push({field:`${n}.config.picklistValues`,message:"Picklist rule requires at least one value"});break;case"faker":e.config.fakerMethod?j(e.config.fakerMethod)||t.push({field:`${n}.config.fakerMethod`,message:`Faker method "${e.config.fakerMethod}" in ${n} is not implemented: choose a method SandForge generates. No record was written.`}):t.push({field:`${n}.config.fakerMethod`,message:"Faker rule requires a fakerMethod"});break;case"ai_generate":e.fieldType!==void 0&&!k(e.fieldType)&&t.push({field:`${n}.ruleType`,message:`AI generation in ${n} writes text, which a "${e.fieldType}" field cannot hold: choose another rule for this field. No record was written.`});break;case"regex":e.config.regexPattern||t.push({field:`${n}.config.regexPattern`,message:"Regex rule requires a regexPattern"});break;case"from_csv":e.config.csvColumn||t.push({field:`${n}.config.csvColumn`,message:"CSV rule requires a csvColumn"});break}}function P(e,n){let t=new Set(e.objects.map(i=>i.objectApiName)),a=new Set;for(let i of e.relations??[]){let{childObject:s,lookupField:o,parentObject:r}=i,c=`relations[${s}.${o}]`;if(t.has(s)||n.push({field:c,message:`The relation on ${s}.${o} fills an object the template does not write`}),a.has(s)&&n.push({field:c,message:`${s} has more than one relation: an object takes its record count from one relation, so keep one and let the other lookup draw from its field rule`}),a.add(s),i.parents.kind==="generated")r===s?n.push({field:c,message:`${s} records cannot point at ${s} records written by the same insert: draw the parents from records already in the org`}):t.has(r)||n.push({field:c,message:`The relation draws ${s}'s parents from the ${r} records this run writes, and the template writes none`});else if(i.parents.kind==="records"){let d=Array.isArray(i.parents.ids)?i.parents.ids:[],l=m.maxExistingParents;if(d.length<1||d.length>l)n.push({field:`${c}.parents.ids`,message:`The relation on ${s}.${o} names between 1 and ${l} ${r} records by id, not ${d.length}`});else{let f=d.filter(g=>typeof g!="string"||!R.test(g)),u=d.filter(g=>typeof g=="string").map(g=>g.slice(0,15));f.length>0?n.push({field:`${c}.parents.ids`,message:`The relation on ${s}.${o} names ${f.length} parent(s) by something that is not a record id, 15 or 18 letters and digits: ${f.slice(0,3).map(String).join(", ")}`}):new Set(u).size!==u.length&&n.push({field:`${c}.parents.ids`,message:`The relation on ${s}.${o} names the same ${r} record more than once: each parent is given once`})}}else p(i.parents.limit,1,m.maxExistingParents)||n.push({field:`${c}.parents.limit`,message:`The relation on ${s}.${o} reads between 1 and ${m.maxExistingParents} existing ${r} records`});_(i.distribution)||n.push({field:`${c}.distribution`,message:`The relation on ${s}.${o} gives each ${r} a number of children it cannot use`})}}function p(e,n,t){return Number.isInteger(e)&&e>=n&&e<=t}function _(e){let n=m.maxPerParent;switch(e.mode){case"perParent":return p(e.count,1,n);case"range":return p(e.min,0,n)&&p(e.max,1,n)&&e.min<=e.max;case"ratio":return Number.isFinite(e.ratio)&&e.ratio>=m.minRatio&&e.ratio<=n;case"byKey":return!0;default:return!1}}function M(e,n){let t=new Set(e.objects.map(a=>a.objectApiName));for(let a of e.objects){let i=$(a.objectApiName,e.relations);for(let s of a.fieldRules)i&&s.fieldApiName===i.lookupField||v(s,t)||s.ruleType==="reference"&&s.config.referenceObject&&(t.has(s.config.referenceObject)||n.push({field:`objects[${a.objectApiName}].fieldRules[${s.fieldApiName}]`,message:`Reference target "${s.config.referenceObject}" is not in the template`}))}}function q(e,n){let t=new Map;for(let o of e.objects)t.set(o.objectApiName,y(o,e.relations));let a=new Set,i=new Set;function s(o){if(i.has(o))return!0;if(a.has(o))return!1;i.add(o);let r=t.get(o)??[];for(let c of r)if(s(c))return!0;return i.delete(o),a.add(o),!1}for(let o of e.objects)if(s(o.objectApiName)){n.push({field:`objects[${o.objectApiName}]`,message:"Circular dependency detected"});break}}export{A as a};
7
+ import{G as w,Jc as v,Ub as k,e as m,ec as j,f as h,i as $,j as y}from"./chunk-6QSHWIZI.mjs";var R=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,T=new Set(["static","random","sequence","formula","reference","picklist_random","ai_generate","faker","regex","from_csv"]),A=class{validate(n){let t=[],a=[];return S(n,t),N(n,t,a),P(n,t),n.objects?.length&&C(n,t),M(n,t),q(n,t),{valid:t.length===0,errors:t,warnings:a}}};function S(e,n){(!e.name||e.name.trim().length===0)&&n.push({field:"name",message:"Template name is required"})}function N(e,n,t){if(!e.objects||e.objects.length===0){n.push({field:"objects",message:"Template must have at least one object"});return}for(let a of e.objects)E(a,n,t,$(a.objectApiName,e.relations))}function E(e,n,t,a){let i=`objects[${e.objectApiName}]`;(!e.objectApiName||e.objectApiName.trim().length===0)&&n.push({field:i,message:"Object API name is required"}),e.recordCount<=0&&n.push({field:`${i}.recordCount`,message:"Record count must be positive"}),e.recordCount>0&&e.fieldRules.length===0&&!a&&!V(e.rows)&&n.push({field:`${i}.fieldRules`,message:`${e.objectApiName} asks for ${e.recordCount} record(s) and names no field to fill: add at least one field rule`}),e.recordCount>1e5&&t.push({field:`${i}.recordCount`,message:"Record count exceeds 100,000 \u2014 consider using grappe mode"}),e.batchSize<=0&&n.push({field:`${i}.batchSize`,message:"Batch size must be positive"});for(let s of e.fieldRules)F(s,i,n);e.rows!==void 0&&x(e.rows,i,n)}function V(e){return Array.isArray(e)&&e.some(n=>b(n?.values)&&Object.keys(n.values).length>0)}function b(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function x(e,n,t){if(!Array.isArray(e)||e.length===0){t.push({field:`${n}.rows`,message:"Rows, when given, are at least one"});return}let a=new Set,i=h.maxKeyLength;for(let[s,o]of e.entries()){let r=`${n}.rows[${s}]`,c=b(o)?o:{},{key:d,parentKey:l,values:f}=c;if(typeof d!="string"||d.length===0||d.length>i?t.push({field:`${r}.key`,message:`A row is named by a key of 1 to ${i} characters`}):a.has(d)?t.push({field:`${r}.key`,message:`The key "${d}" names more than one row: each row is named once`}):a.add(d),l!==void 0&&(typeof l!="string"||l.length===0||l.length>i)&&t.push({field:`${r}.parentKey`,message:`A row names its parent by a key of 1 to ${i} characters`}),!b(f)){t.push({field:`${r}.values`,message:"A row gives its values as fields and values"});continue}for(let[u,g]of Object.entries(f))O(g)||t.push({field:`${r}.values[${u}]`,message:`${u} is given a value no field takes: a text of at most ${h.maxTextLength} characters, a number, true or false, or null`})}}function O(e){return e===null||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):typeof e=="string"&&e.length<=h.maxTextLength}function C(e,n){let t=i=>{let[s,o,...r]=i,c=s==="objects"?e.objects[Number(o)]:void 0,d=s==="relations"?e.relations?.[Number(o)]:void 0,l=c?`objects[${c.objectApiName}]`:d?`relations[${d.childObject}.${d.lookupField}]`:`${String(s)}[${String(o)}]`;return r.reduce((f,u)=>typeof u=="number"?`${f}[${u}]`:`${f}.${u}`,l)};if(e.objects.every(i=>i.rows===void 0||Array.isArray(i.rows)&&i.rows.every(b)))for(let i of w(e))n.push({field:t(i.path),message:i.message})}function F(e,n,t){let a=`${n}.fieldRules[${e.fieldApiName}]`;(!e.fieldApiName||e.fieldApiName.trim().length===0)&&t.push({field:a,message:"Field API name is required"}),T.has(e.ruleType)||t.push({field:`${a}.ruleType`,message:`Invalid rule type: ${e.ruleType}`}),I(e,a,t)}function I(e,n,t){switch(e.ruleType){case"reference":e.config.referenceObject||t.push({field:`${n}.config.referenceObject`,message:"Reference rule requires a referenceObject"});break;case"picklist_random":(!e.config.picklistValues||e.config.picklistValues.length===0)&&t.push({field:`${n}.config.picklistValues`,message:"Picklist rule requires at least one value"});break;case"faker":e.config.fakerMethod?j(e.config.fakerMethod)||t.push({field:`${n}.config.fakerMethod`,message:`Faker method "${e.config.fakerMethod}" in ${n} is not implemented: choose a method SandForge generates. No record was written.`}):t.push({field:`${n}.config.fakerMethod`,message:"Faker rule requires a fakerMethod"});break;case"ai_generate":e.fieldType!==void 0&&!k(e.fieldType)&&t.push({field:`${n}.ruleType`,message:`AI generation in ${n} writes text, which a "${e.fieldType}" field cannot hold: choose another rule for this field. No record was written.`});break;case"regex":e.config.regexPattern||t.push({field:`${n}.config.regexPattern`,message:"Regex rule requires a regexPattern"});break;case"from_csv":e.config.csvColumn||t.push({field:`${n}.config.csvColumn`,message:"CSV rule requires a csvColumn"});break}}function P(e,n){let t=new Set(e.objects.map(i=>i.objectApiName)),a=new Set;for(let i of e.relations??[]){let{childObject:s,lookupField:o,parentObject:r}=i,c=`relations[${s}.${o}]`;if(t.has(s)||n.push({field:c,message:`The relation on ${s}.${o} fills an object the template does not write`}),a.has(s)&&n.push({field:c,message:`${s} has more than one relation: an object takes its record count from one relation, so keep one and let the other lookup draw from its field rule`}),a.add(s),i.parents.kind==="generated")r===s?n.push({field:c,message:`${s} records cannot point at ${s} records written by the same insert: draw the parents from records already in the org`}):t.has(r)||n.push({field:c,message:`The relation draws ${s}'s parents from the ${r} records this run writes, and the template writes none`});else if(i.parents.kind==="records"){let d=Array.isArray(i.parents.ids)?i.parents.ids:[],l=m.maxExistingParents;if(d.length<1||d.length>l)n.push({field:`${c}.parents.ids`,message:`The relation on ${s}.${o} names between 1 and ${l} ${r} records by id, not ${d.length}`});else{let f=d.filter(g=>typeof g!="string"||!R.test(g)),u=d.filter(g=>typeof g=="string").map(g=>g.slice(0,15));f.length>0?n.push({field:`${c}.parents.ids`,message:`The relation on ${s}.${o} names ${f.length} parent(s) by something that is not a record id, 15 or 18 letters and digits: ${f.slice(0,3).map(String).join(", ")}`}):new Set(u).size!==u.length&&n.push({field:`${c}.parents.ids`,message:`The relation on ${s}.${o} names the same ${r} record more than once: each parent is given once`})}}else p(i.parents.limit,1,m.maxExistingParents)||n.push({field:`${c}.parents.limit`,message:`The relation on ${s}.${o} reads between 1 and ${m.maxExistingParents} existing ${r} records`});_(i.distribution)||n.push({field:`${c}.distribution`,message:`The relation on ${s}.${o} gives each ${r} a number of children it cannot use`})}}function p(e,n,t){return Number.isInteger(e)&&e>=n&&e<=t}function _(e){let n=m.maxPerParent;switch(e.mode){case"perParent":return p(e.count,1,n);case"range":return p(e.min,0,n)&&p(e.max,1,n)&&e.min<=e.max;case"ratio":return Number.isFinite(e.ratio)&&e.ratio>=m.minRatio&&e.ratio<=n;case"byKey":return!0;default:return!1}}function M(e,n){let t=new Set(e.objects.map(a=>a.objectApiName));for(let a of e.objects){let i=$(a.objectApiName,e.relations);for(let s of a.fieldRules)i&&s.fieldApiName===i.lookupField||v(s,t)||s.ruleType==="reference"&&s.config.referenceObject&&(t.has(s.config.referenceObject)||n.push({field:`objects[${a.objectApiName}].fieldRules[${s.fieldApiName}]`,message:`Reference target "${s.config.referenceObject}" is not in the template`}))}}function q(e,n){let t=new Map;for(let o of e.objects)t.set(o.objectApiName,y(o,e.relations));let a=new Set,i=new Set;function s(o){if(i.has(o))return!0;if(a.has(o))return!1;i.add(o);let r=t.get(o)??[];for(let c of r)if(s(c))return!0;return i.delete(o),a.add(o),!1}for(let o of e.objects)if(s(o.objectApiName)){n.push({field:`objects[${o.objectApiName}]`,message:"Circular dependency detected"});break}}export{A as a};
@@ -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{f as u,g as l}from"./chunk-H33DVU3D.mjs";import{c as d}from"./chunk-TUPZY2QJ.mjs";var p="## Still to do, in this order",f="## Not touched by SandForge";function s(n){return`\`${n.replace(/[`\r\n]+/g," ").trim()}\``}function h(n){return n.replace(/[\r\n]+/g," ").trim()}function y(n){return n.replace(/\.\d{3}Z$/,"Z")}function S(n,o){return`# Handoff: ${s(n)} on ${s(o.alias??o.organizationId)}`}function $(n){let o=d(n.host),e=n.kind==="sandbox"?`sandbox${o!==void 0?` ${s(o)}`:""}`:n.kind==="scratch"?"scratch org":"Developer Edition org";return`- Org: ${n.alias!==void 0?`${s(n.alias)}, `:""}${e}, ${s(n.organizationId)}.`}function b(n,o){let e=[p,""];e.push("1. Credentials and technical components: point them away from production.");let r=n?.endpoints;if(r===void 0)e.push(` - Not audited: ${o.endpoints}`);else{for(let t of r.found)e.push(` - ${l[t.source]} ${s(t.name)} names ${s(t.host)}, ${u[t.why]}.`);r.found.length===0&&r.unread===void 0&&e.push(" - None of those read names production."),r.unread!==void 0&&e.push(" - Not all read: check the Named Credentials, the Remote Site Settings and the Custom Metadata in Setup.")}e.push("2. Scheduled jobs: schedule again those gone, and give those stuck a user who can run them.");let i=n?.schedules;if(i===void 0)e.push(` - Not audited: ${o.schedules}`);else{for(let t of i.jobs)t.status==="gone"?e.push(` - ${s(t.name)} (${h(t.type)}) was scheduled in the inventory of ${i.against?.savedAt.slice(0,10)??"?"}, and is not now.`):(t.status==="frozen"||t.status==="inactive")&&e.push(` - ${s(t.name)} (${h(t.type)}) runs as ${t.owner!==void 0?s(t.owner):"a user not read"}, who is ${t.status}: its next run fails.`);i.against===void 0&&e.push(" - No inventory from before the refresh was kept on this machine: what is gone is not known."),i.unread!==void 0&&e.push(" - Not all read: Setup > Scheduled Jobs lists them."),!i.jobs.some(t=>t.status!=="new")&&i.unread===void 0&&e.push(i.against!==void 0?" - None gone, none stuck.":" - None stuck.")}e.push("3. Automations that send emails \u2014 flows, workflow rules, Apex \u2014: turn them on last, once the addresses and the masking are as the testers need them."),e.push("4. Deliverability.");let a=n?.deliverability;return a?.read==="closed"?e.push(" - Read closed, System email only or No access: leave it so until the masking is done."):a?.read==="open"?e.push(" - Read open, All email: what runs there emails whoever its records name. Set it to System email only in Setup > Deliverability until the masking is done."):e.push(" - Not read: Setup > Deliverability shows it."),e}var c=["- Named and External Credentials: Setup, or a deployment of your project by `sf`.","- Metadata: your deployment.","- Single sign-on and DKIM keys: Setup.","- Deliverability: Setup > Deliverability.","- Passwords: each user's own, by Forgot your password? on the sandbox's login page."];function w(){return[f,"",...c]}export{s as a,y as b,S as c,$ as d,b as e,w as f};
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{b as ft}from"./chunk-HIHCYMSL.mjs";import{b as lt,n as ut}from"./chunk-JESRFE2Z.mjs";import{a as rt,b as K,c as dt,d as Y,f as ct,i as ht,k as me}from"./chunk-CBL42DUU.mjs";import{f as at}from"./chunk-MKTXJCXN.mjs";import{a as ue,b as F,c as et,f as tt}from"./chunk-AUS6NFLZ.mjs";import{a as wt,b as gt,c as we,d as kt,e as ge,g as bt,h as yt,i as vt,j as ke}from"./chunk-YH4DYI6D.mjs";import{q as pt}from"./chunk-HQQVANWQ.mjs";import{e as se}from"./chunk-5K2I2DMP.mjs";import{a as mt}from"./chunk-TW3N6W5Z.mjs";import{d as pe}from"./chunk-3HEMJTAP.mjs";import{a as ot,b as fe,c as it}from"./chunk-QROPNEGY.mjs";import{b as oe,e as qe}from"./chunk-BZ24IAP5.mjs";import{a as ne}from"./chunk-SCKUIE3R.mjs";import{c as V}from"./chunk-6FARZYMJ.mjs";import{hb as ze}from"./chunk-ISSP2FZ5.mjs";import{a as Ke,n as Ye,o as Xe}from"./chunk-VZT4E2OJ.mjs";import{C as Je}from"./chunk-7SDZR6SR.mjs";import{I as Ze,L as Qe,e as H,i as le}from"./chunk-J24TIGSI.mjs";import{d as Ve,j as ie}from"./chunk-HKUWHVI7.mjs";import{a as We}from"./chunk-LHU6CPGE.mjs";import{r as Ue}from"./chunk-PBE44M2Y.mjs";import{mc as nt}from"./chunk-JFNLKHY6.mjs";import{b as Me,f as B,h as st}from"./chunk-LCDPCUXS.mjs";import{k as Ge}from"./chunk-L4INJ5TZ.mjs";import{da as He}from"./chunk-KIMQQ6JQ.mjs";import{A as ce,Id as he,Ld as _e,Ra as Te,Tc as Fe,Va as Be}from"./chunk-ZQO5PDX5.mjs";import{mkdtempSync as pn,readFileSync as mn,rmSync as wn}from"node:fs";import{tmpdir as gn}from"node:os";import{join as Ot,resolve as be}from"node:path";var kn=`sandforge checkpoint \u2014 take a checkpoint of an org's data, and rewind the org to it, without the editor.
7
+ import{b as ft}from"./chunk-3OVTKRS4.mjs";import{b as lt,n as ut}from"./chunk-BH76USTQ.mjs";import{a as rt,b as K,c as dt,d as Y,f as ct,i as ht,k as me}from"./chunk-XKFHTBAB.mjs";import{f as at}from"./chunk-FYWNSMOZ.mjs";import{a as ue,b as F,c as et,f as tt}from"./chunk-OS5GE52G.mjs";import{a as wt,b as gt,c as we,d as kt,e as ge,g as bt,h as yt,i as vt,j as ke}from"./chunk-W3BQGMTR.mjs";import{q as pt}from"./chunk-QFTF2PGS.mjs";import{e as se}from"./chunk-L4MSL4U7.mjs";import{a as mt}from"./chunk-TW3N6W5Z.mjs";import{d as pe}from"./chunk-LYOGCIYD.mjs";import{a as ot,b as fe,c as it}from"./chunk-QROPNEGY.mjs";import{b as oe,e as qe}from"./chunk-BZ24IAP5.mjs";import{a as ne}from"./chunk-SCKUIE3R.mjs";import{c as V}from"./chunk-6FARZYMJ.mjs";import{hb as ze}from"./chunk-AXFD2OH6.mjs";import{a as Ke,n as Ye,o as Xe}from"./chunk-4X5D3MSV.mjs";import{B as Je}from"./chunk-IXIY6Q4M.mjs";import{I as Ze,L as Qe,e as H,i as le}from"./chunk-N2HYG3BL.mjs";import{d as Ve,j as ie}from"./chunk-7WSQ65WG.mjs";import{a as We}from"./chunk-7ZBDACVG.mjs";import{r as Ue}from"./chunk-OUU47Y7A.mjs";import{gc as nt}from"./chunk-R3OM3X4L.mjs";import{b as Me,f as B,h as st}from"./chunk-LCDPCUXS.mjs";import{k as Ge}from"./chunk-Z3MGN42K.mjs";import{da as He}from"./chunk-2GSMHGIV.mjs";import{A as ce,Ra as Te,Va as Be,Vd as he,Yd as _e,ed as Fe}from"./chunk-6QSHWIZI.mjs";import{mkdtempSync as pn,readFileSync as mn,rmSync as wn}from"node:fs";import{tmpdir as gn}from"node:os";import{join as Ot,resolve as be}from"node:path";var kn=`sandforge checkpoint \u2014 take a checkpoint of an org's data, and rewind the org to it, without the editor.
8
8
 
9
9
  Usage:
10
10
  npx sandforge checkpoint <command> --org <alias> [options]
@@ -153,8 +153,9 @@ replay:
153
153
  --keep-days <n> with --file: when its checkpoint expires here (default: ${H}; 0 keeps
154
154
  it until deleted)
155
155
  --target <alias> the org the records go into: a sandbox, a scratch org or a
156
- Developer Edition org; never a production org, a sandbox marked
157
- Staging, nor the checkpoint's own org, which rewind brings back
156
+ Developer Edition org; never a production org nor the
157
+ checkpoint's own org, which rewind brings back. The Staging mark
158
+ the editor gives a sandbox is not seen here
158
159
  --dry-run say what it would create, link, leave and refuse, and write
159
160
  nothing
160
161
  --objects <A,B> replay these objects alone (default: every object it holds);