sandforge 1.79.0 → 1.80.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 (192) hide show
  1. package/lib/{chunk-JVL444U5.mjs → chunk-2BA2XKAY.mjs} +1 -1
  2. package/lib/chunk-2CNCDM56.mjs +7 -0
  3. package/lib/{chunk-W7KFAY55.mjs → chunk-2GTBABKU.mjs} +1 -1
  4. package/lib/{chunk-DLDX6RRC.mjs → chunk-2NBYT7GR.mjs} +1 -1
  5. package/lib/{chunk-HV2MXMGI.mjs → chunk-2UZPIMUC.mjs} +1 -1
  6. package/lib/chunk-3F6Q5E7I.mjs +14 -0
  7. package/lib/{chunk-PBI4BYWW.mjs → chunk-3RZQZHEB.mjs} +1 -1
  8. package/lib/{chunk-P7GSGFJO.mjs → chunk-3TJON4F3.mjs} +1 -1
  9. package/lib/chunk-4VS2V6WU.mjs +25 -0
  10. package/lib/{chunk-TQX3PURV.mjs → chunk-5K5VLULK.mjs} +1 -1
  11. package/lib/{chunk-MYTIL2JD.mjs → chunk-5TC3QB4U.mjs} +1 -1
  12. package/lib/{chunk-NM4MDLK4.mjs → chunk-6XYKJSGX.mjs} +1 -1
  13. package/lib/{chunk-RFEO2KAN.mjs → chunk-74Q6DORA.mjs} +1 -1
  14. package/lib/chunk-7ABODJ4G.mjs +7 -0
  15. package/lib/{chunk-ZPYJPGDK.mjs → chunk-7EGQP6S4.mjs} +1 -1
  16. package/lib/chunk-7FFGJWHN.mjs +7 -0
  17. package/lib/chunk-7YDNUBO5.mjs +7 -0
  18. package/lib/{chunk-CGWXQX75.mjs → chunk-A527W53V.mjs} +1 -1
  19. package/lib/chunk-ADOAS63R.mjs +7 -0
  20. package/lib/chunk-AEKONPF4.mjs +7 -0
  21. package/lib/{chunk-4HFRHFGQ.mjs → chunk-B5QQJ4SI.mjs} +1 -1
  22. package/lib/{chunk-2BVTCNWA.mjs → chunk-BGUEWRK2.mjs} +1 -1
  23. package/lib/{chunk-GNC27UEU.mjs → chunk-BKDV4ENO.mjs} +1 -1
  24. package/lib/{chunk-QRV2OSIS.mjs → chunk-BTWDMNN3.mjs} +1 -1
  25. package/lib/{chunk-FOVVHGEP.mjs → chunk-BV6VTP3J.mjs} +1 -1
  26. package/lib/{chunk-PZTSVQSF.mjs → chunk-BXU6WFMH.mjs} +1 -1
  27. package/lib/{chunk-ZQOZ4EFW.mjs → chunk-BY2HJFFG.mjs} +1 -1
  28. package/lib/{chunk-NZ5ZZLKS.mjs → chunk-CEX3NEZL.mjs} +1 -1
  29. package/lib/{chunk-HTJ5OGP5.mjs → chunk-CHYDMRSV.mjs} +1 -1
  30. package/lib/chunk-CION3VMZ.mjs +7 -0
  31. package/lib/chunk-COFG7Q6R.mjs +7 -0
  32. package/lib/chunk-CSBS5U5I.mjs +7 -0
  33. package/lib/{chunk-55HEMHEG.mjs → chunk-CU2INBND.mjs} +1 -1
  34. package/lib/chunk-DB7RBE5D.mjs +7 -0
  35. package/lib/{chunk-QPF6C5MX.mjs → chunk-DBB3EMIN.mjs} +1 -1
  36. package/lib/{chunk-F74IHMGL.mjs → chunk-DYFALGRT.mjs} +1 -1
  37. package/lib/{chunk-TEOLMRDO.mjs → chunk-E5AHXLS6.mjs} +1 -1
  38. package/lib/{chunk-LRFAIUN7.mjs → chunk-E5ZB3LU5.mjs} +1 -1
  39. package/lib/chunk-EFR2Y7E4.mjs +7 -0
  40. package/lib/chunk-EHQ3FX6X.mjs +7 -0
  41. package/lib/{chunk-RAAANPPG.mjs → chunk-ELFXJHU7.mjs} +1 -1
  42. package/lib/{chunk-BN7A4GRQ.mjs → chunk-EMNC6YI4.mjs} +1 -1
  43. package/lib/{chunk-HJC7AIBK.mjs → chunk-EQNW3UC2.mjs} +1 -1
  44. package/lib/{chunk-Z7X534S4.mjs → chunk-F43REJDZ.mjs} +2 -2
  45. package/lib/{chunk-QQZZMKU3.mjs → chunk-F6GUDTOB.mjs} +1 -1
  46. package/lib/{chunk-6EBMEGZB.mjs → chunk-FGRG7ANU.mjs} +1 -1
  47. package/lib/{chunk-4NAHW2D3.mjs → chunk-FKG7Q3WH.mjs} +1 -1
  48. package/lib/{chunk-7UQD6V6F.mjs → chunk-FPKYYFM7.mjs} +1 -1
  49. package/lib/{chunk-ZJKCWBRJ.mjs → chunk-FXXLX4O6.mjs} +1 -1
  50. package/lib/chunk-G35N4P7D.mjs +7 -0
  51. package/lib/{chunk-SIOZXPFG.mjs → chunk-GGD7ON3M.mjs} +1 -1
  52. package/lib/chunk-GSG7WZHM.mjs +7 -0
  53. package/lib/{chunk-OTWRDD6L.mjs → chunk-GSKCGQIP.mjs} +1 -1
  54. package/lib/{chunk-3CA767QB.mjs → chunk-HEKAZJRH.mjs} +1 -1
  55. package/lib/{chunk-4SNDMJP2.mjs → chunk-HLWMJF6Y.mjs} +1 -1
  56. package/lib/chunk-HOJYWTP7.mjs +20 -0
  57. package/lib/chunk-HS4YRX4J.mjs +7 -0
  58. package/lib/chunk-IFETCRWE.mjs +10 -0
  59. package/lib/{chunk-PUOX4NBJ.mjs → chunk-IG2MTQRP.mjs} +1 -1
  60. package/lib/{chunk-RACDTRZA.mjs → chunk-IGYH7GMA.mjs} +1 -1
  61. package/lib/{chunk-X65MT4W3.mjs → chunk-IOIWJ3DJ.mjs} +1 -1
  62. package/lib/{chunk-4U6NXJNL.mjs → chunk-IQXHJEYB.mjs} +1 -1
  63. package/lib/{chunk-P2PJYWGQ.mjs → chunk-IWDREM66.mjs} +1 -1
  64. package/lib/{chunk-ZOVSMN5C.mjs → chunk-IZQZ6ZUF.mjs} +1 -1
  65. package/lib/{chunk-XBG5SP6Q.mjs → chunk-J525F5KI.mjs} +1 -1
  66. package/lib/{chunk-5CD257T7.mjs → chunk-JEERQRLW.mjs} +1 -1
  67. package/lib/{chunk-6QSM2WIH.mjs → chunk-JPUR2CFX.mjs} +1 -1
  68. package/lib/chunk-JWTSEDIQ.mjs +7 -0
  69. package/lib/chunk-K327QKMD.mjs +7 -0
  70. package/lib/{chunk-J7HVXMSW.mjs → chunk-KBJ5VERV.mjs} +1 -1
  71. package/lib/chunk-KDGMAGQR.mjs +7 -0
  72. package/lib/chunk-KRCA6IPH.mjs +8 -0
  73. package/lib/chunk-KYEDBS54.mjs +7 -0
  74. package/lib/chunk-L5FGY6YA.mjs +7 -0
  75. package/lib/{chunk-PNCONNFJ.mjs → chunk-L77FJZEP.mjs} +1 -1
  76. package/lib/{chunk-3OHPD72J.mjs → chunk-LKQ5RKIV.mjs} +1 -1
  77. package/lib/{chunk-WJY54JO7.mjs → chunk-LPBMBW3O.mjs} +1 -1
  78. package/lib/{chunk-LV6G4XTK.mjs → chunk-LWW4U276.mjs} +1 -1
  79. package/lib/{chunk-IAZB4WIL.mjs → chunk-M3ROUWDX.mjs} +1 -1
  80. package/lib/chunk-MFG4MUIO.mjs +9 -0
  81. package/lib/{chunk-H45UXY6G.mjs → chunk-MHMH6MTP.mjs} +1 -1
  82. package/lib/{chunk-HCIDVIOW.mjs → chunk-MILU7WFN.mjs} +1 -1
  83. package/lib/chunk-MJU2PGZQ.mjs +15 -0
  84. package/lib/{chunk-HJKM3E56.mjs → chunk-MJVTDA5Q.mjs} +1 -1
  85. package/lib/{chunk-SBIMVCXT.mjs → chunk-MS4FJDFD.mjs} +9 -9
  86. package/lib/{chunk-3SRXFZSD.mjs → chunk-MYW5QNGI.mjs} +1 -1
  87. package/lib/{chunk-VHI54FBK.mjs → chunk-N652NMZ4.mjs} +26 -26
  88. package/lib/{chunk-3DCUADVK.mjs → chunk-NTFIRZP6.mjs} +1 -1
  89. package/lib/{chunk-342FN7AO.mjs → chunk-NZC67CGR.mjs} +1 -1
  90. package/lib/{chunk-RSYICMZG.mjs → chunk-O2HDYYUV.mjs} +1 -1
  91. package/lib/chunk-OAZRPP4I.mjs +7 -0
  92. package/lib/{chunk-BILZ3SSR.mjs → chunk-OHWNPXWW.mjs} +1 -1
  93. package/lib/chunk-OLSGVAIL.mjs +341 -0
  94. package/lib/chunk-OO6CLPEH.mjs +7 -0
  95. package/lib/chunk-OPXCV2KL.mjs +7 -0
  96. package/lib/chunk-P33PSCXK.mjs +7 -0
  97. package/lib/{chunk-AUTM6H6Z.mjs → chunk-PJ5I73CK.mjs} +1 -1
  98. package/lib/{chunk-NTDN2JQZ.mjs → chunk-PZPJKATS.mjs} +1 -1
  99. package/lib/{chunk-5QKTYCWE.mjs → chunk-Q3DM32KF.mjs} +1 -1
  100. package/lib/{chunk-K22PA4XL.mjs → chunk-QR3WELJQ.mjs} +1 -1
  101. package/lib/{chunk-42RER7V4.mjs → chunk-R3X3LV64.mjs} +1 -1
  102. package/lib/chunk-RMBPOTD7.mjs +7 -0
  103. package/lib/{chunk-IEYG5ATY.mjs → chunk-RPI7LRTW.mjs} +1 -1
  104. package/lib/{chunk-5MMXFWPD.mjs → chunk-SE4QEZUG.mjs} +1 -1
  105. package/lib/{chunk-ALJVEUUS.mjs → chunk-SIHORWVK.mjs} +1 -1
  106. package/lib/{chunk-AAVJ5XVX.mjs → chunk-SOGQW4IG.mjs} +1 -1
  107. package/lib/chunk-SOU4FRYN.mjs +7 -0
  108. package/lib/chunk-SU65Z2BA.mjs +7 -0
  109. package/lib/chunk-T62WNR54.mjs +7 -0
  110. package/lib/{chunk-5O6JOMHS.mjs → chunk-TSLJUSLW.mjs} +1 -1
  111. package/lib/chunk-TTFDUKUS.mjs +47 -0
  112. package/lib/{chunk-57VHUYNG.mjs → chunk-TTKXMDBN.mjs} +1 -1
  113. package/lib/chunk-UCD54V2M.mjs +7 -0
  114. package/lib/{chunk-TBZMC2VV.mjs → chunk-UNJA4J37.mjs} +1 -1
  115. package/lib/{chunk-NGSMZZDA.mjs → chunk-VE6XKGGD.mjs} +1 -1
  116. package/lib/chunk-VS7ZXUII.mjs +824 -0
  117. package/lib/{chunk-ALUFROGA.mjs → chunk-VXQLDM4R.mjs} +1 -1
  118. package/lib/chunk-VYXMVJL5.mjs +7 -0
  119. package/lib/{chunk-WFEB5X4U.mjs → chunk-W622GUAW.mjs} +1 -1
  120. package/lib/chunk-W7U5E5ZL.mjs +9 -0
  121. package/lib/{chunk-AR7BE5O2.mjs → chunk-WA7EYLAQ.mjs} +1 -1
  122. package/lib/{chunk-EQF2IJS2.mjs → chunk-WR4Q363I.mjs} +1 -1
  123. package/lib/{chunk-ZXH4MBWP.mjs → chunk-WU3GLFZO.mjs} +1 -1
  124. package/lib/chunk-WXAQ7FK3.mjs +115 -0
  125. package/lib/{chunk-YBU4Z4QV.mjs → chunk-X5JYBPXP.mjs} +1 -1
  126. package/lib/chunk-XAMBCQPU.mjs +7 -0
  127. package/lib/{chunk-LQ4DRFUH.mjs → chunk-XLXIPIEW.mjs} +1 -1
  128. package/lib/{chunk-H2PJNIYJ.mjs → chunk-XUWL6ZPC.mjs} +1 -1
  129. package/lib/{chunk-P42X3B4D.mjs → chunk-YKKRIEH4.mjs} +1 -1
  130. package/lib/chunk-YRQGKDHM.mjs +7 -0
  131. package/lib/chunk-ZM6OJGIG.mjs +7 -0
  132. package/lib/{chunk-SFURUNJM.mjs → chunk-ZVAED4QV.mjs} +1 -1
  133. package/lib/sandforge-autopilot.mjs +29 -24
  134. package/lib/sandforge-backup.mjs +25 -21
  135. package/lib/sandforge-checkpoint.mjs +15 -14
  136. package/lib/sandforge-cleanup.mjs +14 -10
  137. package/lib/sandforge-clone.mjs +1 -1
  138. package/lib/sandforge-compare.mjs +9 -8
  139. package/lib/sandforge-dataops.mjs +1 -1
  140. package/lib/sandforge-empty.mjs +15 -15
  141. package/lib/sandforge-env.mjs +88 -88
  142. package/lib/sandforge-frozen.mjs +43 -34
  143. package/lib/sandforge-mcp.mjs +12 -12
  144. package/lib/sandforge-monitor.mjs +7 -7
  145. package/lib/sandforge-seed.mjs +1 -1
  146. package/lib/sandforge-sync.mjs +1 -1
  147. package/lib/sandforge.mjs +4 -4
  148. package/package.json +1 -1
  149. package/lib/chunk-2S5OMIIA.mjs +0 -7
  150. package/lib/chunk-36U7IQ6Y.mjs +0 -25
  151. package/lib/chunk-3F5YMM2F.mjs +0 -7
  152. package/lib/chunk-3RYLICRX.mjs +0 -7
  153. package/lib/chunk-4GL773D5.mjs +0 -7
  154. package/lib/chunk-4XZ5YT5O.mjs +0 -7
  155. package/lib/chunk-5AJRHRXA.mjs +0 -20
  156. package/lib/chunk-5HMAPZBV.mjs +0 -7
  157. package/lib/chunk-6LAXTAVN.mjs +0 -7
  158. package/lib/chunk-6MUEPV7M.mjs +0 -9
  159. package/lib/chunk-75ADZS6B.mjs +0 -7
  160. package/lib/chunk-B45CNPUX.mjs +0 -47
  161. package/lib/chunk-BS5T3MOQ.mjs +0 -7
  162. package/lib/chunk-D3QRXG63.mjs +0 -787
  163. package/lib/chunk-EEVVGGM6.mjs +0 -7
  164. package/lib/chunk-ENLBYECD.mjs +0 -7
  165. package/lib/chunk-EQOQASDQ.mjs +0 -7
  166. package/lib/chunk-FQBRBBY4.mjs +0 -7
  167. package/lib/chunk-GAM726CK.mjs +0 -7
  168. package/lib/chunk-HUMEKZT5.mjs +0 -8
  169. package/lib/chunk-I3JKJTLO.mjs +0 -110
  170. package/lib/chunk-KLX67VPL.mjs +0 -7
  171. package/lib/chunk-L776PUMV.mjs +0 -7
  172. package/lib/chunk-NEVXIGR6.mjs +0 -10
  173. package/lib/chunk-NHWE66K5.mjs +0 -7
  174. package/lib/chunk-OQOZAPCI.mjs +0 -7
  175. package/lib/chunk-PA3MKJVH.mjs +0 -7
  176. package/lib/chunk-RH3N2H7P.mjs +0 -7
  177. package/lib/chunk-SRQDABQ2.mjs +0 -15
  178. package/lib/chunk-SVS6UMDU.mjs +0 -323
  179. package/lib/chunk-TNXUU6W7.mjs +0 -14
  180. package/lib/chunk-VXHDBYMI.mjs +0 -7
  181. package/lib/chunk-WRU5FJFC.mjs +0 -7
  182. package/lib/chunk-X2PY6MWZ.mjs +0 -7
  183. package/lib/chunk-XEFDB2R4.mjs +0 -7
  184. package/lib/chunk-XETCPL7E.mjs +0 -7
  185. package/lib/chunk-Y5CGXLUB.mjs +0 -7
  186. package/lib/chunk-Y6J6QFI2.mjs +0 -7
  187. package/lib/chunk-YMJVMFPY.mjs +0 -7
  188. package/lib/chunk-YPSRZRIT.mjs +0 -7
  189. package/lib/chunk-YW2SBL4Z.mjs +0 -7
  190. package/lib/chunk-ZE6HKRR4.mjs +0 -9
  191. package/lib/chunk-ZLZRU6MO.mjs +0 -7
  192. package/lib/chunk-ZYEE34WO.mjs +0 -7
@@ -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-W7KFAY55.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-B45CNPUX.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{a as FakerFallback,b as generateByMethod};
7
+ import{a,b}from"./chunk-2GTBABKU.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-TTFDUKUS.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{a as FakerFallback,b as generateByMethod};
@@ -4,9 +4,9 @@ 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 Qr,e as Yr,g as es,h as Ge}from"./chunk-AAVJ5XVX.mjs";import{c as os,d as as,i as is}from"./chunk-WFEB5X4U.mjs";import{b as ds,c as cs}from"./chunk-AR7BE5O2.mjs";import{g as ss}from"./chunk-3OHPD72J.mjs";import{f as Ke}from"./chunk-3RYLICRX.mjs";import{d as ts,g as We,i as ns,j as rs}from"./chunk-PUOX4NBJ.mjs";import{b as Xr}from"./chunk-EQF2IJS2.mjs";import{a as Pr}from"./chunk-HTJ5OGP5.mjs";import{a as Fr}from"./chunk-QQZZMKU3.mjs";import{a as _r}from"./chunk-PZTSVQSF.mjs";import{a as Dr}from"./chunk-W7KFAY55.mjs";import{a as Ot,b as It}from"./chunk-5HMAPZBV.mjs";import{a as Tt,b as Br}from"./chunk-YPSRZRIT.mjs";import{a as Cr}from"./chunk-FOVVHGEP.mjs";import{F as Tr,H as At,I as Er,M as jt,N as xr}from"./chunk-SVS6UMDU.mjs";import{a as cn}from"./chunk-ZE6HKRR4.mjs";import{a as pr,b as Lr,d as Mr,e as Ur,f as qr,g as Kr,h as Gr,j as Wr,k as Et,l as xt,o as Jr,p as Vr,q as Zr,r as Hr}from"./chunk-OQOZAPCI.mjs";import{a as Nr}from"./chunk-RSYICMZG.mjs";import{d as zr}from"./chunk-IAZB4WIL.mjs";import{f as hr}from"./chunk-FQGHL7GR.mjs";import{G as $r,H as Ar,J as jr,O as Or,P as Ir,Q as vt,R as $t,a as fr,c as mr,m as gr,n as wr,x as br}from"./chunk-XEFDB2R4.mjs";import{a as yr,c as Rr}from"./chunk-GNC27UEU.mjs";import{d as Sr,e as kr,f as vr}from"./chunk-YBU4Z4QV.mjs";import{Ba as ve,Ia as er,Ja as St,K as ae,Qa as tr,Ua as nr,Va as $e,Wa as rr,Xa as kt,Ya as sr,ab as or,b as _n,bb as ar,c as Ue,cb as ir,d as Dn,db as dr,e as G,eb as qe,fb as cr,g as Rt,gb as lr,h as Kn,hb as ur,i as Gn,j as Wn,k as Jn,l as Vn,n as ze,o as Zn,q as Hn,r as Xn,s as Qn}from"./chunk-D3QRXG63.mjs";import{b as yt,c as Un,d as zn}from"./chunk-TEOLMRDO.mjs";import{a as qn}from"./chunk-SCKUIE3R.mjs";import{b as _e,e as De}from"./chunk-BZ24IAP5.mjs";import{a as dt,b as un,c as Le,d as X,e as fn,f as pn,g as ct,h as hn,j as mn}from"./chunk-AV5SWEHP.mjs";import{_ as wn,wc as kn,xc as vn}from"./chunk-YMJVMFPY.mjs";import{ab as Ln,f as Fn,pb as bt,qb as Mn,yb as Bn}from"./chunk-36U7IQ6Y.mjs";import{b as bn}from"./chunk-Z7X534S4.mjs";import{C as ut,N as Re,Q as ft,a as gn}from"./chunk-6QSM2WIH.mjs";import{h as Rn,l as Sn,m as Me,o as Be}from"./chunk-NTDN2JQZ.mjs";import{b as ye,c as le}from"./chunk-L776PUMV.mjs";import{A as ue,r as pt,s as Se,w as On,x as In,y as ht}from"./chunk-6MUEPV7M.mjs";import{a as be,b as dn,c as at}from"./chunk-RH3N2H7P.mjs";import{d as yn}from"./chunk-TUACWKIH.mjs";import{Ba as Nn,Ia as fe,P as En,Pa as mt,S as ke,W as xn,bb as gt,cb as wt,ka as Cn,r as $n,s as An,w as jn,xa as Pn}from"./chunk-VXHDBYMI.mjs";import{q as Tn}from"./chunk-ENLBYECD.mjs";import{b as lt}from"./chunk-WIO4XO4F.mjs";import{p as oe}from"./chunk-CGWXQX75.mjs";import{a as Fe,c as ln,e as it,g as Yn}from"./chunk-MTMH6H2A.mjs";import{Ra as nt,Tc as st,Uc as on,Vc as an,Wc as ot,bb as Ne,cb as rt,d as ce,ea as tt,fb as tn,fc as rn,g as en,gb as nn,qc as sn}from"./chunk-B45CNPUX.mjs";import{A as F}from"./chunk-7EANH5PY.mjs";import{randomInt as Vs,randomUUID as Zs}from"node:crypto";import{existsSync as bs,readFileSync as je,renameSync as Hs,writeFileSync as Xs}from"node:fs";import{dirname as Qs,join as Ys}from"node:path";import{existsSync as us,readFileSync as fs}from"node:fs";import{dirname as ls,resolve as Ct}from"node:path";function Pt(t,n=e=>fs(e,"utf8")){let e=rt.find(i=>i.id===t);if(e)return{pack:e,from:"built-in"};if(!us(t))return{refusal:`--scenario takes the id of a scenario SandForge ships (${rt.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=as(r);return"issues"in o?{refusal:`${t} is not a scenario pack:
7
+ import{c as Qr,e as Yr,g as es,h as Ge}from"./chunk-SOGQW4IG.mjs";import{c as os,d as as,i as is}from"./chunk-W622GUAW.mjs";import{b as ds,c as cs}from"./chunk-WA7EYLAQ.mjs";import{g as ss}from"./chunk-LKQ5RKIV.mjs";import{f as Ke}from"./chunk-XAMBCQPU.mjs";import{d as ts,g as We,i as ns,j as rs}from"./chunk-IG2MTQRP.mjs";import{b as Xr}from"./chunk-WR4Q363I.mjs";import{a as Pr}from"./chunk-CHYDMRSV.mjs";import{a as Fr}from"./chunk-F6GUDTOB.mjs";import{a as _r}from"./chunk-BXU6WFMH.mjs";import{a as Dr}from"./chunk-2GTBABKU.mjs";import{a as Ot,b as It}from"./chunk-P33PSCXK.mjs";import{a as Tt,b as Br}from"./chunk-UCD54V2M.mjs";import{a as Cr}from"./chunk-BV6VTP3J.mjs";import{H as Tr,J as At,K as Er,O as jt,P as xr}from"./chunk-OLSGVAIL.mjs";import{b as ln}from"./chunk-W7U5E5ZL.mjs";import{a as pr,b as Lr,d as Mr,e as Ur,f as qr,g as Kr,h as Gr,j as Wr,k as Et,l as xt,o as Jr,p as Vr,q as Zr,r as Hr}from"./chunk-EFR2Y7E4.mjs";import{a as Nr}from"./chunk-O2HDYYUV.mjs";import{d as zr}from"./chunk-M3ROUWDX.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 vt,T as $t,a as fr,c as mr,j as gr,k as wr,u as br}from"./chunk-ZM6OJGIG.mjs";import{a as yr,c as Rr}from"./chunk-BKDV4ENO.mjs";import{d as Sr,e as kr,f as vr}from"./chunk-X5JYBPXP.mjs";import{Na as ve,O as ie,Va as er,Wa as St,b as Dn,c as Ue,cb as tr,d as Ln,e as G,g as Rt,gb as nr,h as Kn,hb as $e,i as Gn,ib as rr,j as Wn,jb as kt,k as Jn,kb as sr,l as Vn,n as ze,o as Zn,ob as or,pb as ar,q as Hn,qb as ir,r as Xn,rb as dr,s as Qn,sb as qe,tb as cr,ub as lr,vb as ur}from"./chunk-VS7ZXUII.mjs";import{b as yt,c as zn,d as qn}from"./chunk-E5AHXLS6.mjs";import{b as _e,e as De}from"./chunk-BZ24IAP5.mjs";import{a as en}from"./chunk-SCKUIE3R.mjs";import{a as dt,b as fn,c as Le,d as X,e as pn,f as hn,g as ct,h as mn,j as gn}from"./chunk-AV5SWEHP.mjs";import{_ as bn,wc as vn,xc as $n}from"./chunk-2CNCDM56.mjs";import{bb as Mn,f as _n,qb as bt,rb as Bn,zb as Un}from"./chunk-4VS2V6WU.mjs";import{b as yn}from"./chunk-F43REJDZ.mjs";import{C as ut,N as Re,Q as ft,a as wn}from"./chunk-JPUR2CFX.mjs";import{h as Sn,l as kn,m as Me,o as Be}from"./chunk-PZPJKATS.mjs";import{b as ye,c as le}from"./chunk-KDGMAGQR.mjs";import{B as ue,s as pt,t as Se,x as In,y as Tn,z as ht}from"./chunk-MFG4MUIO.mjs";import{b as be,c as cn,g as at}from"./chunk-HS4YRX4J.mjs";import{d as Rn}from"./chunk-TUACWKIH.mjs";import{Ba as Fn,Ia as fe,P as xn,Pa as mt,S as ke,W as Cn,bb as gt,cb as wt,ka as Pn,r as An,s as jn,w as On,xa as Nn}from"./chunk-VYXMVJL5.mjs";import{q as En}from"./chunk-AEKONPF4.mjs";import{b as lt}from"./chunk-WIO4XO4F.mjs";import{p as ae}from"./chunk-A527W53V.mjs";import{a as Fe,c as un,e as it,g as Yn}from"./chunk-MTMH6H2A.mjs";import{Ua as nt,Wc as st,Xc as an,Yc as dn,Zc as ot,d as ce,eb as Ne,fb as rt,g as tn,ga as tt,ib as nn,ic as sn,jb as rn,tc as on}from"./chunk-TTFDUKUS.mjs";import{A as F}from"./chunk-7EANH5PY.mjs";import{randomInt as Vs,randomUUID as Zs}from"node:crypto";import{existsSync as bs,readFileSync as je,renameSync as Hs,writeFileSync as Xs}from"node:fs";import{dirname as Qs,join as Ys}from"node:path";import{existsSync as us,readFileSync as fs}from"node:fs";import{dirname as ls,resolve as Ct}from"node:path";function Pt(t,n=e=>fs(e,"utf8")){let e=rt.find(i=>i.id===t);if(e)return{pack:e,from:"built-in"};if(!us(t))return{refusal:`--scenario takes the id of a scenario SandForge ships (${rt.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=as(r);return"issues"in o?{refusal:`${t} is not a scenario pack:
8
8
  ${o.issues.map(i=>` ${i}`).join(`
9
- `)}`}:{pack:o.pack,from:Ct(t)}}async function ps(t,n,e){let r=es(n,{caseStatus:await Qr(t.query),knowledge:await Yr(t.objectAccess,t.describe),...e!==void 0?{seed:e}:{}});if("issues"in r)return r;let{options:o}=r.preparation;return{...r,compiled:Xr(n,o),options:o}}function hs(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 ms(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 gs(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 ns(We(),t.journalDir,ts({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[`${qn("seed")} --test-file`,t,"--target",n,"--agent <agent API name>",...e.topics.map(r=>`--topic ${r.key}=<agent topic>`)].join(" ")}function zs(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 qs={switches:["--overwrite","--json"],values:["--test-file","--target","--agent","--topic","--guard-topic","--test-runner","--scenario","--project"]},Ks=/^([a-z][a-z0-9-]*)=([^\s:=,]+)(?::([^\s:=]+))?$/;function Gs(t){let n=t.slice(2);Fe(n,qs);let e=c=>{process.stderr.write(`${c}
9
+ `)}`}:{pack:o.pack,from:Ct(t)}}async function ps(t,n,e){let r=es(n,{caseStatus:await Qr(t.query),knowledge:await Yr(t.objectAccess,t.describe),...e!==void 0?{seed:e}:{}});if("issues"in r)return r;let{options:o}=r.preparation;return{...r,compiled:Xr(n,o),options:o}}function hs(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 ms(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 gs(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 ns(We(),t.journalDir,ts({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 zs(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 qs={switches:["--overwrite","--json"],values:["--test-file","--target","--agent","--topic","--guard-topic","--test-runner","--scenario","--project"]},Ks=/^([a-z][a-z0-9-]*)=([^\s:=,]+)(?::([^\s:=]+))?$/;function Gs(t){let n=t.slice(2);Fe(n,qs);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=Ks.exec(p);g||e(`--topic wants "<scenario topic>=<agent topic>" or "<scenario topic>=<agent topic>:<action>,<action>", not "${p}".`);let[,R,$,b]=g;s.push({packTopic:R,agentTopic:$,actions:b?b.split(","):[]})}let d=r("--test-runner")??"testing-center";nt.includes(d)||e(`--test-runner takes ${nt.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 Ws(t,n){if(us(t)&&t.endsWith(".ndjson")){let e=Me(fs(t,"utf8"));if(e)return{runId:e.runId,storagePath:ls(ls(Ct(t))),targetOrgId:e.targetOrgId,...e.targetOrganizationId?{targetOrganizationId:e.targetOrganizationId}:{}}}return{runId:t,storagePath:n}}async function ws(t,n,e){let r=Gs(t),o=b=>{process[r.json?"stderr":"stdout"].write(`${b}
11
11
  `)},i=(b,x)=>{process.stderr.write(`${x}
12
12
  `),process.exitCode=b},s=Ws(r.run,e),d=await rs(We(),s.storagePath,s.runId);if(d.kind!=="read"){i(2,d.kind==="absent"?`${r.run}: no scenario run kept a companion file by that name, so there is no test file to write from it.`:d.message);return}let{sidecar:u}=d,f;if(r.scenario!==void 0){let b=Pt(r.scenario);if("refusal"in b){i(2,b.refusal);return}f=b.pack}let c=f??await is(os(),[r.project],u.packId,u.packFingerprint),p=await n(r.target);if(s.targetOrganizationId!==void 0){let b=await p.organizationId();if(b!==void 0&&b.slice(0,15)!==s.targetOrganizationId.slice(0,15)){i(2,`${r.target} is not the org this run wrote to: give --target that org.`);return}}let g=await Ke(Ge(p.tooling));if(g.kind==="no-agent"){i(1,g.message);return}if(g.kind==="unreadable"){i(1,g.message);return}if(r.agent===void 0){o(`the agents of ${r.target}:`);for(let b of zs(g.catalog.agents))o(b);i(2,`--test-file takes --agent, the API name of the agent the tests are for, and a --topic for each topic of the scenario ${u.packId}`+(c?` (${c.topics.map(b=>b.key).join(", ")})`:"")+". Run with --help.");return}let R={agent:r.agent,runner:r.runner,topics:r.topics,guardTopic:r.guardTopic},$=await cs({sidecar:We(),spec:ss()},{runId:s.runId,storagePath:s.storagePath,project:await ds([r.project]),alias:r.target,choice:R,overwrite:r.overwrite,readCatalog:async()=>g,findPack:async()=>c});r.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-seed",outcome:$},null,2)}
@@ -373,7 +373,7 @@ sweep was refused or did not take all it was asked to (a --sweep-untied refused
373
373
  included), or the run was partial and --fail-on-partial was given; 130 a Ctrl-C
374
374
  stopped the run, 143 a SIGTERM (a CI job cancelled or timed out), 129 a SIGHUP:
375
375
  its file keeps what it created.
376
- `,Is=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,Ae=2**32-1,to=/^env-[a-z0-9][a-z0-9-]{0,195}$/;function Ft(t){let n=t>>>0;return()=>{n=n+1831565813>>>0;let e=n;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var no=2654435769,ro=2246822507,so=/^([A-Za-z][A-Za-z0-9_]{0,79})\.([A-Za-z][A-Za-z0-9_]{0,79})=([A-Za-z][A-Za-z0-9_]{0,79})$/,oo=10,ys="--parent-ids names the parents: it goes with neither --existing, --where nor --parent-limit.",ao=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function io(t,n){let e=(t??"").split(",").map(i=>i.trim()).filter(i=>i!==""),r=ce.maxExistingParents;e.length===0&&n("--parent-ids wants record ids, comma-separated."),e.length>r&&n(`--parent-ids takes ${r} ids at most, not ${e.length}.`);let o=e.filter(i=>!ao.test(i));return o.length>0&&n(`--parent-ids takes record ids, 15 or 18 letters and digits, not "${o.slice(0,3).join('", "')}".`),new Set(e.map(i=>i.slice(0,15))).size!==e.length&&n("--parent-ids names a record twice: give each parent once."),e}function co(t,n){let e=[],r=ce.maxPerParent,o=(s,d,u,f)=>{let c=Number(s);return(!Number.isInteger(c)||c<d||c>u)&&n(`${f} takes a whole number from ${d} to ${u}, not "${s??""}".`),c},i=s=>(s.parents.kind==="records"&&n(ys),s.parents.kind!=="existing"&&(s.parents={kind:"existing",limit:oo}),s.parents);for(let s=0;s<t.length;s++){let d=t[s],u=t[s+1];if(d==="--relation"){let g=so.exec(u??"");g||n(`--relation wants "Child.Lookup=Parent", not "${u??""}".`);let[,R,$,b]=g;e.push({childObject:R,lookupField:$,parentObject:b,parents:{kind:"generated"},distribution:{mode:"perParent",count:1}}),s++;continue}if(!["--per-parent","--between","--ratio","--existing","--where","--parent-limit","--parent-ids"].includes(d))continue;let c=e.at(-1);c||n(`${d} applies to a relation: give --relation before it.`);let p=c;if(d==="--existing"){i(p);continue}if(s++,d==="--per-parent")p.distribution={mode:"perParent",count:o(u,1,r,d)};else if(d==="--between"){let g=/^(\d+)-(\d+)$/.exec(u??"");g||n(`--between wants "<min>-<max>", not "${u??""}".`);let[,R,$]=g,b=o(R,0,r,d),x=o($,Math.max(1,b),r,d);p.distribution={mode:"range",min:b,max:x}}else if(d==="--ratio"){let g=Number(u);(!Number.isFinite(g)||g<ce.minRatio||g>r)&&n(`--ratio takes a number from ${ce.minRatio} to ${r}, not "${u??""}".`),p.distribution={mode:"ratio",ratio:g}}else d==="--where"?(u?.trim()||n("--where wants a SOQL condition."),i(p).where=u):d==="--parent-ids"?(p.parents.kind==="existing"&&n(ys),p.parents={kind:"records",ids:io(u,n)}):i(p).limit=o(u,1,ce.maxExistingParents,d)}return e}function lo(t,n,e){let r=t.map(o=>({...o}));for(let o of n){let i=`${o.childObject}.${o.lookupField}`,s=r.find(f=>f.objectApiName===o.childObject);s||e(`--relation ${i}: give ${o.childObject} with --object too.`);let d;if(o.parents.kind==="existing")d=o.parents.limit;else if(o.parents.kind==="records")d=o.parents.ids.length;else{let f=r.find(c=>c.objectApiName===o.parentObject);(!f||o.parentObject===o.childObject)&&e(`--relation ${i}: the ${o.parentObject} records this run writes cannot be the parents; give ${o.parentObject} with --object, or add --existing.`),d=f.recordCount}if(o.distribution.mode==="byKey")continue;let u=en(o.distribution,d);u<1&&e(`--relation ${i} gives no parent a child: raise --ratio.`),s.recordCount=u}return r}var uo={switches:["--list-templates","--dry-run","--json","--existing","--fail-on-partial","--mute-automation","--accept-emails",...Rt.switches],values:["--target","--template","--template-file","--scenario","--scenario-seed","--run-id","--object","--batch-size","--seed","--locale","--record-type","--relation","--per-parent","--between","--ratio","--where","--parent-limit","--parent-ids","--fit","--fit-cap","--fit-within",...Rt.values]},Rs=1e5;function fo(t,n){let e=u=>t.flatMap((f,c)=>f===u&&c+1<t.length?[t[c+1]]:[]),r=u=>t.includes(u),o=e("--fit");r("--fit")&&(o.length!==1||o[0]!=="share")&&n(`--fit takes share, once, not "${o.join(" ")}".`);let i={objects:{}};for(let u of e("--fit-cap")){let f=/^(?:([A-Za-z][A-Za-z0-9_]{0,79})=)?(\d{1,6})$/.exec(u),c=f?Number(f[2]):NaN;(!f||c<1||c>Rs)&&n(`--fit-cap wants "<Object>=<n>" or "<n>", n a whole number from 1 to ${Rs}, not "${u}".`);let p=f[1];p===void 0?(i.all!==void 0&&n("--fit-cap <n> caps every object: give it once."),i.all=c):(i.objects[p]!==void 0&&n(`--fit-cap ${p}: give each object one cap.`),i.objects[p]=c)}let s=i.all!==void 0||Object.keys(i.objects).length>0,d;if(r("--fit-within")){let[u]=e("--fit-within");d=Number(u),!r("--fit")&&!s&&n("--fit-within goes with --fit share or --fit-cap."),(u===void 0||!/^\d+(?:\.\d+)?$/.test(u)||d<=0||d>1e6)&&n(`--fit-within takes a number of MB above 0, up to 1000000, not "${u??""}".`)}if(!(!r("--fit")&&!s))return{share:r("--fit"),...s?{caps:{...i.all!==void 0?{all:i.all}:{},...Object.keys(i.objects).length>0?{objects:i.objects}:{}}}:{},...d!==void 0?{withinMB:d}:{}}}function Ss(t){let n=t.slice(2);if((n.includes("--help")||n.includes("-h"))&&(process.stdout.write(eo),process.exit(0)),Fe(n,uo),n.includes("--list-templates")){for(let m of Ne)process.stdout.write(`${m.id.padEnd(34)}${m.objects.length} object(s) ${Ts(m)}
376
+ `,Is=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,Ae=2**32-1,to=/^env-[a-z0-9][a-z0-9-]{0,195}$/;function Ft(t){let n=t>>>0;return()=>{n=n+1831565813>>>0;let e=n;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var no=2654435769,ro=2246822507,so=/^([A-Za-z][A-Za-z0-9_]{0,79})\.([A-Za-z][A-Za-z0-9_]{0,79})=([A-Za-z][A-Za-z0-9_]{0,79})$/,oo=10,ys="--parent-ids names the parents: it goes with neither --existing, --where nor --parent-limit.",ao=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function io(t,n){let e=(t??"").split(",").map(i=>i.trim()).filter(i=>i!==""),r=ce.maxExistingParents;e.length===0&&n("--parent-ids wants record ids, comma-separated."),e.length>r&&n(`--parent-ids takes ${r} ids at most, not ${e.length}.`);let o=e.filter(i=>!ao.test(i));return o.length>0&&n(`--parent-ids takes record ids, 15 or 18 letters and digits, not "${o.slice(0,3).join('", "')}".`),new Set(e.map(i=>i.slice(0,15))).size!==e.length&&n("--parent-ids names a record twice: give each parent once."),e}function co(t,n){let e=[],r=ce.maxPerParent,o=(s,d,u,f)=>{let c=Number(s);return(!Number.isInteger(c)||c<d||c>u)&&n(`${f} takes a whole number from ${d} to ${u}, not "${s??""}".`),c},i=s=>(s.parents.kind==="records"&&n(ys),s.parents.kind!=="existing"&&(s.parents={kind:"existing",limit:oo}),s.parents);for(let s=0;s<t.length;s++){let d=t[s],u=t[s+1];if(d==="--relation"){let g=so.exec(u??"");g||n(`--relation wants "Child.Lookup=Parent", not "${u??""}".`);let[,R,$,b]=g;e.push({childObject:R,lookupField:$,parentObject:b,parents:{kind:"generated"},distribution:{mode:"perParent",count:1}}),s++;continue}if(!["--per-parent","--between","--ratio","--existing","--where","--parent-limit","--parent-ids"].includes(d))continue;let c=e.at(-1);c||n(`${d} applies to a relation: give --relation before it.`);let p=c;if(d==="--existing"){i(p);continue}if(s++,d==="--per-parent")p.distribution={mode:"perParent",count:o(u,1,r,d)};else if(d==="--between"){let g=/^(\d+)-(\d+)$/.exec(u??"");g||n(`--between wants "<min>-<max>", not "${u??""}".`);let[,R,$]=g,b=o(R,0,r,d),x=o($,Math.max(1,b),r,d);p.distribution={mode:"range",min:b,max:x}}else if(d==="--ratio"){let g=Number(u);(!Number.isFinite(g)||g<ce.minRatio||g>r)&&n(`--ratio takes a number from ${ce.minRatio} to ${r}, not "${u??""}".`),p.distribution={mode:"ratio",ratio:g}}else d==="--where"?(u?.trim()||n("--where wants a SOQL condition."),i(p).where=u):d==="--parent-ids"?(p.parents.kind==="existing"&&n(ys),p.parents={kind:"records",ids:io(u,n)}):i(p).limit=o(u,1,ce.maxExistingParents,d)}return e}function lo(t,n,e){let r=t.map(o=>({...o}));for(let o of n){let i=`${o.childObject}.${o.lookupField}`,s=r.find(f=>f.objectApiName===o.childObject);s||e(`--relation ${i}: give ${o.childObject} with --object too.`);let d;if(o.parents.kind==="existing")d=o.parents.limit;else if(o.parents.kind==="records")d=o.parents.ids.length;else{let f=r.find(c=>c.objectApiName===o.parentObject);(!f||o.parentObject===o.childObject)&&e(`--relation ${i}: the ${o.parentObject} records this run writes cannot be the parents; give ${o.parentObject} with --object, or add --existing.`),d=f.recordCount}if(o.distribution.mode==="byKey")continue;let u=tn(o.distribution,d);u<1&&e(`--relation ${i} gives no parent a child: raise --ratio.`),s.recordCount=u}return r}var uo={switches:["--list-templates","--dry-run","--json","--existing","--fail-on-partial","--mute-automation","--accept-emails",...Rt.switches],values:["--target","--template","--template-file","--scenario","--scenario-seed","--run-id","--object","--batch-size","--seed","--locale","--record-type","--relation","--per-parent","--between","--ratio","--where","--parent-limit","--parent-ids","--fit","--fit-cap","--fit-within",...Rt.values]},Rs=1e5;function fo(t,n){let e=u=>t.flatMap((f,c)=>f===u&&c+1<t.length?[t[c+1]]:[]),r=u=>t.includes(u),o=e("--fit");r("--fit")&&(o.length!==1||o[0]!=="share")&&n(`--fit takes share, once, not "${o.join(" ")}".`);let i={objects:{}};for(let u of e("--fit-cap")){let f=/^(?:([A-Za-z][A-Za-z0-9_]{0,79})=)?(\d{1,6})$/.exec(u),c=f?Number(f[2]):NaN;(!f||c<1||c>Rs)&&n(`--fit-cap wants "<Object>=<n>" or "<n>", n a whole number from 1 to ${Rs}, not "${u}".`);let p=f[1];p===void 0?(i.all!==void 0&&n("--fit-cap <n> caps every object: give it once."),i.all=c):(i.objects[p]!==void 0&&n(`--fit-cap ${p}: give each object one cap.`),i.objects[p]=c)}let s=i.all!==void 0||Object.keys(i.objects).length>0,d;if(r("--fit-within")){let[u]=e("--fit-within");d=Number(u),!r("--fit")&&!s&&n("--fit-within goes with --fit share or --fit-cap."),(u===void 0||!/^\d+(?:\.\d+)?$/.test(u)||d<=0||d>1e6)&&n(`--fit-within takes a number of MB above 0, up to 1000000, not "${u??""}".`)}if(!(!r("--fit")&&!s))return{share:r("--fit"),...s?{caps:{...i.all!==void 0?{all:i.all}:{},...Object.keys(i.objects).length>0?{objects:i.objects}:{}}}:{},...d!==void 0?{withinMB:d}:{}}}function Ss(t){let n=t.slice(2);if((n.includes("--help")||n.includes("-h"))&&(process.stdout.write(eo),process.exit(0)),Fe(n,uo),n.includes("--list-templates")){for(let m of Ne)process.stdout.write(`${m.id.padEnd(34)}${m.objects.length} object(s) ${Ts(m)}
377
377
  `);process.exit(0)}let e=(m,A)=>{let y=n.indexOf(m);return y>=0&&y+1<n.length?n[y+1]:A},r=m=>{process.stderr.write(`${m}
378
378
  `),process.exit(2)},o=m=>{let A=[];for(let y=0;y<n.length;y++)n[y]===m&&y+1<n.length&&A.push(n[y+1]);return A},i=e("--target"),s=e("--template"),d=e("--template-file"),u=e("--scenario"),f=o("--object");i||(process.stderr.write(`Missing --target. Run with --help.
379
379
  `),process.exit(2)),!s&&d===void 0&&u===void 0&&f.length===0&&(process.stderr.write(`Nothing to seed: give --template, --template-file, --scenario or --object. Run with --help.
@@ -381,41 +381,41 @@ its file keeps what it created.
381
381
  `),process.exit(2));let p=e("--run-id");p!==void 0&&!to.test(p)&&r(`--run-id takes "env-" then lowercase letters, digits and hyphens, 200 characters at most, not "${p}".`);let g=f.map(m=>{let A=m.lastIndexOf(":"),y=A>0?m.slice(0,A):m,O=A>0?Number(m.slice(A+1)):NaN;return Is.test(y)||(process.stderr.write(`Not an SObject API name: "${y}"
382
382
  `),process.exit(2)),(!Number.isInteger(O)||O<1||O>1e5)&&(process.stderr.write(`--object wants "Name:<count>", not "${m}".
383
383
  `),process.exit(2)),{objectApiName:y,recordCount:O}}),R=Number(e("--batch-size","200")??"200");(!Number.isInteger(R)||R<1||R>1e4)&&(process.stderr.write(`--batch-size takes a whole number between 1 and 10000.
384
- `),process.exit(2));let $=co(n,r);$.length>0&&s&&r("--relation goes with --object: a built-in template carries its own links.");let b;if(n.includes("--seed")){let m=e("--seed");b=Number(m),(m===void 0||!/^\d+$/.test(m)||!Number.isSafeInteger(b)||b>Ae)&&r(`--seed takes a whole number from 0 to ${Ae}, not "${m??""}".`)}let x=e("--locale");n.includes("--locale")&&(x===void 0||!Dt.includes(x))&&r(`--locale takes one of ${Dt.join(", ")}, not "${x??""}".`);let C={};for(let m of o("--record-type")){let A=/^([A-Za-z][A-Za-z0-9_]{0,79})=([A-Za-z][A-Za-z0-9_]{0,79}(?:,[A-Za-z][A-Za-z0-9_]{0,79})*)$/.exec(m);A||r(`--record-type wants "Object=Name" or "Object=Name,Other", not "${m}".`);let[,y,O]=A;d===void 0&&!g.some(M=>M.objectApiName===y)&&r(`--record-type ${y}: give ${y} with --object too.`),C[y]=[...new Set(O.split(","))]}let z=fo(n,r),S=Gn(n);return{target:i,templateId:s,...d!==void 0?{templateFile:d}:{},...u!==void 0?{scenario:u}:{},...c!==void 0?{scenarioSeed:c}:{},...p!==void 0?{runId:p}:{},objects:lo(g,$,r),relations:$,batchSize:R,dryRun:n.includes("--dry-run"),json:n.includes("--json"),failOnPartial:n.includes("--fail-on-partial"),muteAutomation:n.includes("--mute-automation"),acceptEmails:n.includes("--accept-emails"),...b!==void 0?{seed:b}:{},...x!==void 0?{locale:x}:{},recordTypes:C,...z?{fit:z}:{},...S!==void 0?{checkpointFirst:S}:{}}}var po=Ys(__dirname,"catalogue.en.json"),Je;function ho(){if(Je===void 0)try{Je=JSON.parse(je(po,"utf8"))}catch{Je=null}return Je}function Ts(t,n=ho()){if(!t.name.startsWith("seed.templates.")||!n)return t.name;let e=n;for(let r of t.name.split(".")){if(e===null||typeof e!="object")return t.name;e=e[r]}return typeof e=="string"&&e.trim()!==""?e:t.name}var mo=10;function go(t,n){let e;try{e=je(t,"utf8")}catch(d){return{refusal:`--template-file ${t} cannot be read: ${d instanceof Error?d.message:String(d)}`}}let r;try{r=JSON.parse(e)}catch(d){return{refusal:`--template-file ${t} is not JSON: ${d instanceof Error?d.message:String(d)}`}}let o=wn.safeParse(r);if(!o.success){let{issues:d}=o.error,u=d.slice(0,mo).map(c=>` ${c.path.join(".")||"(the template)"}: ${c.message}`),f=d.length-u.length;return{refusal:[`--template-file ${t} is not a seed template the panel would run:`,...u,...f>0?[` and ${f} more`]:[]].join(`
384
+ `),process.exit(2));let $=co(n,r);$.length>0&&s&&r("--relation goes with --object: a built-in template carries its own links.");let b;if(n.includes("--seed")){let m=e("--seed");b=Number(m),(m===void 0||!/^\d+$/.test(m)||!Number.isSafeInteger(b)||b>Ae)&&r(`--seed takes a whole number from 0 to ${Ae}, not "${m??""}".`)}let x=e("--locale");n.includes("--locale")&&(x===void 0||!Dt.includes(x))&&r(`--locale takes one of ${Dt.join(", ")}, not "${x??""}".`);let C={};for(let m of o("--record-type")){let A=/^([A-Za-z][A-Za-z0-9_]{0,79})=([A-Za-z][A-Za-z0-9_]{0,79}(?:,[A-Za-z][A-Za-z0-9_]{0,79})*)$/.exec(m);A||r(`--record-type wants "Object=Name" or "Object=Name,Other", not "${m}".`);let[,y,O]=A;d===void 0&&!g.some(M=>M.objectApiName===y)&&r(`--record-type ${y}: give ${y} with --object too.`),C[y]=[...new Set(O.split(","))]}let z=fo(n,r),S=Gn(n);return{target:i,templateId:s,...d!==void 0?{templateFile:d}:{},...u!==void 0?{scenario:u}:{},...c!==void 0?{scenarioSeed:c}:{},...p!==void 0?{runId:p}:{},objects:lo(g,$,r),relations:$,batchSize:R,dryRun:n.includes("--dry-run"),json:n.includes("--json"),failOnPartial:n.includes("--fail-on-partial"),muteAutomation:n.includes("--mute-automation"),acceptEmails:n.includes("--accept-emails"),...b!==void 0?{seed:b}:{},...x!==void 0?{locale:x}:{},recordTypes:C,...z?{fit:z}:{},...S!==void 0?{checkpointFirst:S}:{}}}var po=Ys(__dirname,"catalogue.en.json"),Je;function ho(){if(Je===void 0)try{Je=JSON.parse(je(po,"utf8"))}catch{Je=null}return Je}function Ts(t,n=ho()){if(!t.name.startsWith("seed.templates.")||!n)return t.name;let e=n;for(let r of t.name.split(".")){if(e===null||typeof e!="object")return t.name;e=e[r]}return typeof e=="string"&&e.trim()!==""?e:t.name}var mo=10;function go(t,n){let e;try{e=je(t,"utf8")}catch(d){return{refusal:`--template-file ${t} cannot be read: ${d instanceof Error?d.message:String(d)}`}}let r;try{r=JSON.parse(e)}catch(d){return{refusal:`--template-file ${t} is not JSON: ${d instanceof Error?d.message:String(d)}`}}let o=bn.safeParse(r);if(!o.success){let{issues:d}=o.error,u=d.slice(0,mo).map(c=>` ${c.path.join(".")||"(the template)"}: ${c.message}`),f=d.length-u.length;return{refusal:[`--template-file ${t} is not a seed template the panel would run:`,...u,...f>0?[` and ${f} more`]:[]].join(`
385
385
  `)}}let i=new Date().toISOString(),s=o.data;return{template:{...s,id:typeof s.id=="string"&&s.id!==""?s.id:`cli-${Date.now()}`,version:typeof s.version=="number"?s.version:1,createdAt:typeof s.createdAt=="string"?s.createdAt:i,updatedAt:typeof s.updatedAt=="string"?s.updatedAt:i,objects:o.data.objects.map(d=>({...d,batchSize:d.batchSize??n}))}}}function wo(t,n){let e=jt(t,n,yt);return e===void 0?void 0:`--run-id ${t}: a run of that id is kept already, in ${e}. Give an id no run has.`}function bo(t,n){for(let e of Object.keys(n)){let r=t.objects.find(o=>o.objectApiName===e);if(r===void 0)return`--record-type ${e}: the template file writes no ${e}; it writes ${t.objects.map(o=>o.objectApiName).join(", ")}.`;if(r.fieldRules.some(o=>o.fieldApiName==="RecordTypeId"))return`--record-type ${e}: the template file gives ${e} its record type already, by a RecordTypeId rule: give it in one place.`}}function yo(t){if(!t)return null;let n=Ne.find(e=>e.id===t);if(!n){let e=Ne.map(r=>r.id).join(", ");process.stderr.write(`No template "${t}". There is: ${e}
386
- `),process.exit(2)}return n}function Ro(t,n,e="business"){let r=e==="person"&&n===oe,o=t.filter(s=>s.createable&&!rn(n??"",s.name,r?"person":"business")&&(s.name==="Name"||So(s)||r&&ko.has(s.name)||!s.nillable&&s.defaultedOnCreate!==!0)),i=[];for(let s of o){let d=nn({fieldApiName:s.name,type:s.type,picklistValues:(s.picklistValues??[]).filter(u=>u.active!==!1&&typeof u.value=="string").map(u=>u.value),referenceTo:[],length:s.length??0,integerDigits:tn(s),objectApiName:n});d.ruleType==="static"&&d.config.staticValue===void 0||i.push({fieldApiName:s.name,fieldType:s.type,ruleType:d.ruleType,config:d.config})}return i}function So(t){return(t.type==="email"||t.type==="phone")&&!t.name.includes("__")}var ko=new Set(["FirstName","LastName"]),vo="SELECT DeveloperName FROM RecordType WHERE SobjectType = 'Account' AND IsPersonType = true";async function $o(t){try{let n=await t.query(vo);return new Set(n.records.flatMap(e=>typeof e.DeveloperName=="string"?[e.DeveloperName]:[]))}catch{return new Set}}function Ao(t,n){let e=t.filter(o=>n.has(o));if(e.length===0)return{kind:"business"};if(e.length===t.length)return{kind:"person"};let r=t.filter(o=>!n.has(o));return{refusal:`--record-type ${oe}: ${e.join(", ")} ${e.length===1?"is a person account record type":"are person account record types"} and ${r.join(", ")} ${r.length===1?"is":"are"} not: a person account and a business account take different fields. Seed one kind in a run.`}}function jo(t){return` ${oe}: ${t.join(", ")} ${t.length===1?"is a person account record type":"are person account record types"}: the accounts are written as person accounts, with a first and last name, the person\u2019s email and phones, and no Name, which the org builds from the two names`}function ks(t,n,e){let r=lt(e).filter(s=>!s.master),o=r.filter(s=>s.active&&s.available),i=[];for(let s of n){let d=r.find(u=>u.developerName===s);if(!d||!d.active||!d.available){let u=o.map(f=>f.developerName).join(", ")||"none";return{refusal:`--record-type ${t}=${s}: `+(d?d.active?`the running user may not use record type ${s}`:`record type ${s} is inactive`:`${t} has no record type ${s}`)+`. Open to them: ${u}.`}}i.push(d.recordTypeId)}return{rule:i.length===1?{fieldApiName:"RecordTypeId",fieldType:"reference",ruleType:"static",config:{staticValue:i[0]}}:{fieldApiName:"RecordTypeId",fieldType:"reference",ruleType:"picklist_random",config:{picklistValues:i}}}}function Oo(t,n){let e=lt(n).filter(i=>!i.master&&i.active&&i.available);if(e.length<2)return;let r=e.find(i=>i.defaultRecordTypeMapping),o=_n()?.startsWith("sandforge env")===!0?`the resource's recordTypes for ${t}, in the file, chooses`:`${Dn("--record-type")} ${t}=<Name> chooses`;return` ${t}: ${e.length} record types open to you (${e.map(i=>i.developerName).join(", ")}); the records take ${r?`your default, ${r.developerName}`:"your default"}: ${o}`}function Io(t){switch(t.mode){case"perParent":return`${t.count} per parent`;case"range":return`${t.min} to ${t.max} per parent`;case"ratio":return`${t.ratio} per parent on average`;case"byKey":return"each under the parent row its key names"}}function To(t){return new $r({...t.signal?{signal:t.signal}:{},...t.onRowIds?{onRowIds:t.onRowIds}:{},...t.knowledge?{knowledge:t.knowledge}:{},validator:new Cr,readExistingParentIds:t.readExistingParentIds,...t.readPresentParentIds?{readPresentParentIds:t.readPresentParentIds}:{},...t.describeKeyPrefix?{describeKeyPrefix:t.describeKeyPrefix}:{},describeCreateableFields:t.describeCreateableFields,...t.describeVisibleFields?{describeVisibleFields:t.describeVisibleFields}:{},...t.describePicklistValues?{describePicklistValues:t.describePicklistValues}:{},...t.describeFieldLengths?{describeFieldLengths:t.describeFieldLengths}:{},...t.describeRequiredFields?{describeRequiredFields:t.describeRequiredFields}:{},...t.objectAccess?{objectAccess:t.objectAccess}:{},...t.readTarget?{readTarget:t.readTarget}:{},...t.update?{update:t.update}:{},planBuilder:new Pr,fieldMapper:new Fr({aiGenerator:new Nr(()=>{throw new Error("This template has an AI field rule. sandforge seed runs without an AI key: use the panel for it, or replace the rule with a faker one.")}),fakerFallback:new Dr(t.locale,{random:Ft(t.seed^no)}),random:Ft(t.seed^ro)}),referenceLinker:new _r,insert:t.insert,generateId:()=>`cli-${Math.random().toString(36).slice(2)}`,now:()=>new Date().toISOString(),random:Ft(t.seed)})}function Eo(t,n,e){return t<=n?"(REST)":e===!0?"(REST: an active duplicate rule watches the object, which a Bulk API job cannot waive)":e===!1?"(a Bulk API job)":"(a Bulk API job, or REST when an active duplicate rule watches the object)"}function xo(t,n){let e=`data storage: about ${fe(t.estimateMB)} MB to write`;return t.verdict==="unread"?`${e}; what ${n} has left could not be read (${t.unread})`:`${e}, ${n} has ${t.remainingMB} MB left of ${t.maxMB} MB`+(t.verdict==="near"?": close to what it has left":"")}async function Co(t){let n=await Jr({org:t.target,objects:t.objects.map(r=>r.objectApiName),readAutomation:t.readAutomation,readLimits:t.readLimits}),e=Zr(n,t.objects,t.target);return{lines:[...Hr(n,t.target),...Pn(e.checks,t.target),...(e.unknown??[]).map(r=>` emails: ${r}`)],gate:e}}function Po(t,n,e,r){return{storage:{bytes:Or(t,n),...e.check,...e.refusedFor==="storage"?{refusal:e.refusal}:{}},apiRequests:Es(e,r)}}function Es(t,n){return{...t.api,...n!==void 0?{sent:n}:{},...t.refusedFor==="apiRequests"?{refusal:t.refusal}:{}}}function No(t){switch(t.kind){case"trigger":return`what Apex trigger ${t.name} on ${t.objectApiName} creates`;case"notRead":return`what "${t.name}" on ${t.objectApiName} creates: it was not read`;case"share":return`the ${t.name} rows the flows of ${t.objectApiName} create`}}function Fo(t){return`${Math.floor(t*1e3)/10} %`}function vs(t,n,e){let{proposal:r}=t,o=r.budget,i=e.applied?"fit":"--fit share would seed";if(r.cannotFit!==void 0)return[`${i}: the seed cannot be fitted: ${r.cannotFit}`];if(t.heldBy==="whole")return[`${i}: the seed fits as it is, ${t.records} records, about ${fe(r.estimateMB)} MB: nothing cut`];let s=fe(o.budgetMB+o.automationMB),d=t.heldBy==="apiRequests"?`the largest whose writes leave ${n} a tenth of its daily API requests`:t.heldBy==="within"?`the largest that fits the ${o.withinMB??s} MB asked (--fit-within)`:`the largest that fits ${s} MB: ${o.share*100} % of the ${o.remainingMB} MB ${n} says it has left of ${o.maxMB}, ${o.roundingMB} MB kept first for the rounding of what it says`,u=e.roomUnread!==void 0?`no room kept for what its automation creates: it could not be read (${e.roomUnread})`:o.automationMB>0?`${fe(o.automationMB)} MB of it kept for what its flows still running create under these records`:"nothing kept for its flows: none still running creates records under these"+(e.muted?" (--mute-automation keeps the others quiet)":""),f=Math.max(...r.objects.map(c=>c.objectApiName.length));return[t.heldBy==="caps"?`${i}: the caps asked, within the ${s} MB that fit; ${u}`:`${i}: share ${Fo(r.share)}, ${d}; ${u}`,...r.objects.map(c=>` ${c.objectApiName.padEnd(f)} ${c.after} of ${c.before}`+(c.keptWhole==="rows"?" (kept whole: the rows the template gives)":c.keptWhole==="byKey"?" (kept whole: each under the parent row its key names)":"")),...(o.notCounted??[]).map(c=>` not counted: ${No(c)}`),` fitted seed: ${t.records} records, about ${fe(r.estimateMB)} MB`+(o.automationMB>0?" with what its flows create under them":"")+`, ${t.requests} API requests`,` ${Fn(n)}`]}function _o(t,n,e){return{applied:n,...t.proposal,heldBy:t.heldBy,records:t.records,requests:t.requests,...e?.caps?{caps:e.caps}:{},...e?.withinMB!==void 0?{withinMB:e.withinMB}:{}}}async function Do(t=process.argv){if(t.slice(2).includes("--remove"))return Ho(t);if(t.slice(2).includes("--test-file"))return(t.slice(2).includes("--help")||t.slice(2).includes("-h"))&&Ss(t),ws(t,Lo,ae());let n=Date.now(),e=Ss(t),r;if(e.scenario!==void 0){let a=Pt(e.scenario);"refusal"in a&&(process.stderr.write(`${a.refusal}
386
+ `),process.exit(2)}return n}function Ro(t,n,e="business"){let r=e==="person"&&n===ae,o=t.filter(s=>s.createable&&!sn(n??"",s.name,r?"person":"business")&&(s.name==="Name"||So(s)||r&&ko.has(s.name)||!s.nillable&&s.defaultedOnCreate!==!0)),i=[];for(let s of o){let d=rn({fieldApiName:s.name,type:s.type,picklistValues:(s.picklistValues??[]).filter(u=>u.active!==!1&&typeof u.value=="string").map(u=>u.value),referenceTo:[],length:s.length??0,integerDigits:nn(s),objectApiName:n});d.ruleType==="static"&&d.config.staticValue===void 0||i.push({fieldApiName:s.name,fieldType:s.type,ruleType:d.ruleType,config:d.config})}return i}function So(t){return(t.type==="email"||t.type==="phone")&&!t.name.includes("__")}var ko=new Set(["FirstName","LastName"]),vo="SELECT DeveloperName FROM RecordType WHERE SobjectType = 'Account' AND IsPersonType = true";async function $o(t){try{let n=await t.query(vo);return new Set(n.records.flatMap(e=>typeof e.DeveloperName=="string"?[e.DeveloperName]:[]))}catch{return new Set}}function Ao(t,n){let e=t.filter(o=>n.has(o));if(e.length===0)return{kind:"business"};if(e.length===t.length)return{kind:"person"};let r=t.filter(o=>!n.has(o));return{refusal:`--record-type ${ae}: ${e.join(", ")} ${e.length===1?"is a person account record type":"are person account record types"} and ${r.join(", ")} ${r.length===1?"is":"are"} not: a person account and a business account take different fields. Seed one kind in a run.`}}function jo(t){return` ${ae}: ${t.join(", ")} ${t.length===1?"is a person account record type":"are person account record types"}: the accounts are written as person accounts, with a first and last name, the person\u2019s email and phones, and no Name, which the org builds from the two names`}function ks(t,n,e){let r=lt(e).filter(s=>!s.master),o=r.filter(s=>s.active&&s.available),i=[];for(let s of n){let d=r.find(u=>u.developerName===s);if(!d||!d.active||!d.available){let u=o.map(f=>f.developerName).join(", ")||"none";return{refusal:`--record-type ${t}=${s}: `+(d?d.active?`the running user may not use record type ${s}`:`record type ${s} is inactive`:`${t} has no record type ${s}`)+`. Open to them: ${u}.`}}i.push(d.recordTypeId)}return{rule:i.length===1?{fieldApiName:"RecordTypeId",fieldType:"reference",ruleType:"static",config:{staticValue:i[0]}}:{fieldApiName:"RecordTypeId",fieldType:"reference",ruleType:"picklist_random",config:{picklistValues:i}}}}function Oo(t,n){let e=lt(n).filter(i=>!i.master&&i.active&&i.available);if(e.length<2)return;let r=e.find(i=>i.defaultRecordTypeMapping),o=Dn()?.startsWith("sandforge env")===!0?`the resource's recordTypes for ${t}, in the file, chooses`:`${Ln("--record-type")} ${t}=<Name> chooses`;return` ${t}: ${e.length} record types open to you (${e.map(i=>i.developerName).join(", ")}); the records take ${r?`your default, ${r.developerName}`:"your default"}: ${o}`}function Io(t){switch(t.mode){case"perParent":return`${t.count} per parent`;case"range":return`${t.min} to ${t.max} per parent`;case"ratio":return`${t.ratio} per parent on average`;case"byKey":return"each under the parent row its key names"}}function To(t){return new $r({...t.signal?{signal:t.signal}:{},...t.onRowIds?{onRowIds:t.onRowIds}:{},...t.knowledge?{knowledge:t.knowledge}:{},validator:new Cr,readExistingParentIds:t.readExistingParentIds,...t.readPresentParentIds?{readPresentParentIds:t.readPresentParentIds}:{},...t.describeKeyPrefix?{describeKeyPrefix:t.describeKeyPrefix}:{},describeCreateableFields:t.describeCreateableFields,...t.describeVisibleFields?{describeVisibleFields:t.describeVisibleFields}:{},...t.describeComputedFields?{describeComputedFields:t.describeComputedFields}:{},...t.describePicklistValues?{describePicklistValues:t.describePicklistValues}:{},...t.describeFieldLengths?{describeFieldLengths:t.describeFieldLengths}:{},...t.describeRequiredFields?{describeRequiredFields:t.describeRequiredFields}:{},...t.objectAccess?{objectAccess:t.objectAccess}:{},...t.readTarget?{readTarget:t.readTarget}:{},...t.update?{update:t.update}:{},planBuilder:new Pr,fieldMapper:new Fr({aiGenerator:new Nr(()=>{throw new Error("This template has an AI field rule. sandforge seed runs without an AI key: use the panel for it, or replace the rule with a faker one.")}),fakerFallback:new Dr(t.locale,{random:Ft(t.seed^no)}),random:Ft(t.seed^ro)}),referenceLinker:new _r,insert:t.insert,generateId:()=>`cli-${Math.random().toString(36).slice(2)}`,now:()=>new Date().toISOString(),random:Ft(t.seed)})}function Eo(t,n,e){return t<=n?"(REST)":e===!0?"(REST: an active duplicate rule watches the object, which a Bulk API job cannot waive)":e===!1?"(a Bulk API job)":"(a Bulk API job, or REST when an active duplicate rule watches the object)"}function xo(t,n){let e=`data storage: about ${fe(t.estimateMB)} MB to write`;return t.verdict==="unread"?`${e}; what ${n} has left could not be read (${t.unread})`:`${e}, ${n} has ${t.remainingMB} MB left of ${t.maxMB} MB`+(t.verdict==="near"?": close to what it has left":"")}async function Co(t){let n=await Jr({org:t.target,objects:t.objects.map(r=>r.objectApiName),readAutomation:t.readAutomation,readLimits:t.readLimits}),e=Zr(n,t.objects,t.target);return{lines:[...Hr(n,t.target),...Nn(e.checks,t.target),...(e.unknown??[]).map(r=>` emails: ${r}`)],gate:e}}function Po(t,n,e,r){return{storage:{bytes:Or(t,n),...e.check,...e.refusedFor==="storage"?{refusal:e.refusal}:{}},apiRequests:Es(e,r)}}function Es(t,n){return{...t.api,...n!==void 0?{sent:n}:{},...t.refusedFor==="apiRequests"?{refusal:t.refusal}:{}}}function No(t){switch(t.kind){case"trigger":return`what Apex trigger ${t.name} on ${t.objectApiName} creates`;case"notRead":return`what "${t.name}" on ${t.objectApiName} creates: it was not read`;case"share":return`the ${t.name} rows the flows of ${t.objectApiName} create`}}function Fo(t){return`${Math.floor(t*1e3)/10} %`}function vs(t,n,e){let{proposal:r}=t,o=r.budget,i=e.applied?"fit":"--fit share would seed";if(r.cannotFit!==void 0)return[`${i}: the seed cannot be fitted: ${r.cannotFit}`];if(t.heldBy==="whole")return[`${i}: the seed fits as it is, ${t.records} records, about ${fe(r.estimateMB)} MB: nothing cut`];let s=fe(o.budgetMB+o.automationMB),d=t.heldBy==="apiRequests"?`the largest whose writes leave ${n} a tenth of its daily API requests`:t.heldBy==="within"?`the largest that fits the ${o.withinMB??s} MB asked (--fit-within)`:`the largest that fits ${s} MB: ${o.share*100} % of the ${o.remainingMB} MB ${n} says it has left of ${o.maxMB}, ${o.roundingMB} MB kept first for the rounding of what it says`,u=e.roomUnread!==void 0?`no room kept for what its automation creates: it could not be read (${e.roomUnread})`:o.automationMB>0?`${fe(o.automationMB)} MB of it kept for what its flows still running create under these records`:"nothing kept for its flows: none still running creates records under these"+(e.muted?" (--mute-automation keeps the others quiet)":""),f=Math.max(...r.objects.map(c=>c.objectApiName.length));return[t.heldBy==="caps"?`${i}: the caps asked, within the ${s} MB that fit; ${u}`:`${i}: share ${Fo(r.share)}, ${d}; ${u}`,...r.objects.map(c=>` ${c.objectApiName.padEnd(f)} ${c.after} of ${c.before}`+(c.keptWhole==="rows"?" (kept whole: the rows the template gives)":c.keptWhole==="byKey"?" (kept whole: each under the parent row its key names)":"")),...(o.notCounted??[]).map(c=>` not counted: ${No(c)}`),` fitted seed: ${t.records} records, about ${fe(r.estimateMB)} MB`+(o.automationMB>0?" with what its flows create under them":"")+`, ${t.requests} API requests`,` ${_n(n)}`]}function _o(t,n,e){return{applied:n,...t.proposal,heldBy:t.heldBy,records:t.records,requests:t.requests,...e?.caps?{caps:e.caps}:{},...e?.withinMB!==void 0?{withinMB:e.withinMB}:{}}}async function Do(t=process.argv){if(t.slice(2).includes("--remove"))return Ho(t);if(t.slice(2).includes("--test-file"))return(t.slice(2).includes("--help")||t.slice(2).includes("-h"))&&Ss(t),ws(t,Lo,ie());let n=Date.now(),e=Ss(t),r;if(e.scenario!==void 0){let a=Pt(e.scenario);"refusal"in a&&(process.stderr.write(`${a.refusal}
387
387
  `),process.exit(2)),r=a.pack}let o;if(e.templateFile!==void 0){let a=go(e.templateFile,e.batchSize);"refusal"in a&&(process.stderr.write(`${a.refusal}
388
388
  `),process.exit(2)),o=a.template;let l=bo(o,e.recordTypes);l!==void 0&&(process.stderr.write(`${l}
389
- `),process.exit(2))}let i=e.runId!==void 0?wo(e.runId,ae()):void 0;i!==void 0&&(process.stderr.write(`${i}
389
+ `),process.exit(2))}let i=e.runId!==void 0?wo(e.runId,ie()):void 0;i!==void 0&&(process.stderr.write(`${i}
390
390
  `),process.exit(2));let s=a=>{process[e.json?"stderr":"stdout"].write(`${a}
391
- `)},d=e.seed??Vs(0,Ae+1),u=new Date().toISOString();s(`sandforge seed -> ${e.target}`),s(`seed: ${d} (--seed ${d} draws the same again)`);let f=await ye(e.target),c=le(f),p=[at(c)],g=()=>p.reduce((a,l)=>a+l(),0),R=e.dryRun?void 0:await cn(c,e.target,{tool:"sandforge seed",action:"write",readOnly:"--dry-run"}),$=await Ur(e.locale,c),b=a=>c.sobject(a).describe(),x=new Map,C=a=>{let l=x.get(a);return l||(l=b(a),x.set(a,l)),l};s(`locale: ${$}${e.locale?"":" (the org's; --locale draws in another)"}`);let z=new Date().toISOString(),S=o??yo(e.templateId),m;if(r!==void 0){let a=await ps({query:async l=>(await c.query(l)).records,objectAccess:Tt(c),describe:l=>c.sobject(l).describe()},r,e.scenarioSeed);"issues"in a&&(process.stderr.write(`The scenario cannot be compiled: ${a.issues.join("; ")}
391
+ `)},d=e.seed??Vs(0,Ae+1),u=new Date().toISOString();s(`sandforge seed -> ${e.target}`),s(`seed: ${d} (--seed ${d} draws the same again)`);let f=await ye(e.target),c=le(f),p=[at(c)],g=()=>p.reduce((a,l)=>a+l(),0),R=e.dryRun?void 0:await ln(c,e.target,{tool:"sandforge seed",action:"write",readOnly:"--dry-run"}),$=await Ur(e.locale,c),b=a=>c.sobject(a).describe(),x=new Map,C=a=>{let l=x.get(a);return l||(l=b(a),x.set(a,l)),l};s(`locale: ${$}${e.locale?"":" (the org's; --locale draws in another)"}`);let z=new Date().toISOString(),S=o??yo(e.templateId),m;if(r!==void 0){let a=await ps({query:async l=>(await c.query(l)).records,objectAccess:Tt(c),describe:l=>c.sobject(l).describe()},r,e.scenarioSeed);"issues"in a&&(process.stderr.write(`The scenario cannot be compiled: ${a.issues.join("; ")}
392
392
  `),process.exit(2)),m=a,S=a.compiled.template;for(let l of hs(r,a.preparation))s(l)}for(let a of e.relations){let l=a.parents.kind==="generated"?`the ${a.parentObject} records this run writes`:a.parents.kind==="records"?`the ${a.parents.ids.length} ${a.parentObject} records named by id`:`at most ${a.parents.limit} ${a.parentObject} records already in the org`+(a.parents.where?` where ${a.parents.where}`:""),h=e.objects.find(E=>E.objectApiName===a.childObject)?.recordCount;s(` relation ${a.childObject}.${a.lookupField}: up to ${h} record(s), ${Io(a.distribution)}, over ${l}`)}let A=[],y=[];if(o!==void 0&&Object.keys(e.recordTypes).length>0){let a=[];for(let l of o.objects){let h=e.recordTypes[l.objectApiName];if(!h){a.push(l);continue}let E=await C(l.objectApiName),N=ks(l.objectApiName,h,E.recordTypeInfos);"refusal"in N&&(process.stderr.write(`${N.refusal}
393
- `),process.exit(2)),a.push({...l,fieldRules:[...l.fieldRules,N.rule]})}o={...o,objects:a},S=o}if(o?.objects.some(a=>a.objectApiName===oe)){let a=Mr(o,await Lr(c));"refusal"in a&&(process.stderr.write(`${a.refusal}
394
- `),process.exit(2)),S=a.template,y.push(...a.personObjects);for(let l of a.personObjects){let h=` ${l}: the template gives it person account record types: the accounts are written as person accounts, without Name, which the org builds from the two names`;s(h),A.push(h.trim())}}if(!S){let a=[];for(let[l,h]of e.objects.entries()){let E=await C(h.objectApiName),N=e.recordTypes[h.objectApiName],se="business";if(N&&h.objectApiName===oe){let L=Ao(N,await $o(c));if("refusal"in L&&(process.stderr.write(`${L.refusal}
395
- `),process.exit(2)),se=L.kind,se==="person"){y.push(oe);let Yt=jo(N);s(Yt),A.push(Yt.trim())}}let Pe=E.createable===!1,Qt=E.fields,et=Ro(Pe?Qt.map(L=>({...L,createable:!0})):Qt,h.objectApiName,se);if(N){let L=ks(h.objectApiName,N,E.recordTypeInfos);"refusal"in L&&(process.stderr.write(`${L.refusal}
396
- `),process.exit(2)),et.push(L.rule)}else{let L=Oo(h.objectApiName,E.recordTypeInfos);L&&s(L)}s(Pe?` ${h.objectApiName}: the user this seed runs as may not create its records: skipped`:` ${h.objectApiName}: ${et.map(L=>L.fieldApiName).join(", ")||"(none)"}`),a.push({objectApiName:h.objectApiName,recordCount:h.recordCount,fieldRules:et,excludedFields:[],insertOrder:l,batchSize:e.batchSize})}S={id:`cli-${Date.now()}`,name:"sandforge seed",description:"Headless run",version:1,strategy:"faker",objects:a,...e.relations.length>0?{relations:e.relations}:{},tags:["cli"],createdAt:z,updatedAt:z}}for(let a of Object.keys(e.fit?.caps?.objects??{}))S.objects.some(l=>l.objectApiName===a)||(process.stderr.write(`--fit-cap ${a}: the seed writes no ${a}.
397
- `),process.exit(2));let O=await ve(c).read(e.target,S.objects.map(a=>a.objectApiName)).catch(a=>({unread:a instanceof Error?a.message:String(a)})),M=Gr(S,m!==void 0),k=(a,l=[])=>{throw e.json&&process.stdout.write(pn({tool:"sandforge-seed",target:e.target,elapsedMs:G(n)},a,l)),new Error([a,...l].map(Le).join(`
398
- `))},I,B;if(e.muteAutomation)try{I=await ht(async()=>pt(c),O,{writes:M});for(let a of ue(I.muted,e.target))s(` ${a}`)}catch(a){if(!Se(a))throw a;B=a.refusal,e.dryRun&&s(` ${X(a.refusal)}`)}let P=Wr(O,I?.plan,M),Q={...P.unread!==void 0?{roomUnread:P.unread}:{},muted:(I?.plan?.assign.length??0)>0},_=e.runId??`sandforge-seed-${Zs()}`,H=e.checkpointFirst?Jn({module:"seed",operationId:_,request:e.checkpointFirst,session:f,org:Wn(f,R??await be(c)),connect:a=>{let l=le(a);return p.push(at(l)),l},journalDir:ae(),say:s,own:{runId:_}}):void 0,q,pe=[],ie=a=>{let l={code:ke,message:a};pe.push(l),e.dryRun&&s(` ${X(l)}`)},Y=S.objects.filter(a=>a.recordCount>0);if(H&&Y.length>0){let a={written:Y.map(l=>l.objectApiName),running:P.running??{firing:[]}};try{q={ask:a,estimate:await H.scope(a)}}catch(l){ie(Tn(l))}}let W=await jn({read:O,...I?.plan?{plan:I.plan}:{},writes:M,readDeliverability:async()=>dn(R??await be(c))?$n:An(c),accepted:e.acceptEmails===!0,target:e.target,run:"seed",keepsAddresses:!0,mayMute:e.muteAutomation!==!0&&Ue("--mute-automation")}),he=Nn(W.ofRun),w={...he,...On(I?.plan)},v=Tt(c),T=await Br(S,v),j=()=>g()-(he.deliverability??0),me=Ot(C),V=await jr(T,{describeCreateableFields:me.createable,describeRequiredFields:It(me,y)}),ee={duplicateRules:Ln(O),slices:V,bulkThreshold:tt.bulk.threshold,typedFirst:e.dryRun,sentBefore:j()},D=await vt(c,T,y,e.target,q?.estimate,w,ee),ge,Ve,Lt=a=>{Ve=a,e.dryRun&&s(` ${X(a)}`)};if(e.fit&&D.refusedFor!=="checkpoint"&&pe.length===0){let a=$t(D,e.fit.withinMB);if("unread"in a)Lt({code:qr,message:`The seed was refused before it wrote anything: it cannot be fitted to ${e.target}, whose data storage left could not be read (${a.unread}). Nothing was written.`});else{let l=xt({template:T,personObjects:y,budget:a,room:P.room,ask:e.fit,path:ee});ge={applied:!0,fit:l};for(let h of vs(l,e.target,{applied:!0,...Q}))s(h);l.proposal.cannotFit!==void 0?Lt({code:Kr,message:`The seed was refused before it wrote anything: it cannot be fitted to ${e.target}: ${l.proposal.cannotFit}. Nothing was written.`}):l.heldBy!=="whole"&&(S=Et(S,l.proposal),T=Et(T,l.proposal),ee={...ee,sentBefore:j()},D=await vt(c,T,y,e.target,q?.estimate,w,ee))}}s(xo(D.check,e.target));let Oe;if(q)for(let a of Vn(q.estimate))s(a);if(D.refusedFor==="checkpoint")ie(ze({code:ke,message:D.refusal??"",...D.checkpointRefusal?{refusal:D.checkpointRefusal}:{}}));else if(D.refusal){if(!e.fit){let a=$t(D);if(!("unread"in a)){let l=xt({template:T,personObjects:y,budget:a,room:P.room,path:ee});ge={applied:!1,fit:l};for(let h of vs(l,e.target,{applied:!1,...Q}))s(` ${h}`)}}Oe={code:D.refusedFor==="apiRequests"?En:Ir,message:D.refusal},e.dryRun&&s(` ${X(Oe)}`)}let te=await Co({target:e.target,objects:S.objects,readAutomation:async()=>{let a=I?.automation??O;if(typeof a.unread=="string")throw new Error(a.unread);return a},readLimits:()=>Cn(c)});for(let a of te.lines)s(a);W.gate.line!==void 0&&s(` ${W.gate.line}`);let Ie=te.gate.refusal!==void 0?{code:Vr,message:te.gate.refusal}:void 0;Ie&&e.dryRun&&s(` ${X(Ie)}`);let we=W.gate.stop;we&&e.dryRun&&s(` ${X(we)}`);let Mt=[...B!==void 0?[B]:[],...pe,...Ve!==void 0?[Ve]:[],...Oe!==void 0?[Oe]:[],...Ie!==void 0?[Ie]:[],...we?[we]:[]],[Bt,...Ns]=Mt;!e.dryRun&&Bt!==void 0&&k(Bt,Ns),s(`template: ${Ts(S)} (${S.objects.length} object(s))`);let Ut=e.dryRun?void 0:zn(ae()),J=Ut?.recorder({runId:_,targetOrgId:R?.id??e.target,targetAlias:e.target,startedAt:u,...R?{targetOrganizationId:R.id}:{}});Bn(J,()=>c.identity(),"sandforge seed");let K=Ut?.pathOf(_),ne=new AbortController,Ze,Fs=a=>{Ze=a,process.stderr.write(`
393
+ `),process.exit(2)),a.push({...l,fieldRules:[...l.fieldRules,N.rule]})}o={...o,objects:a},S=o}if(o?.objects.some(a=>a.objectApiName===ae)){let a=Mr(o,await Lr(c));"refusal"in a&&(process.stderr.write(`${a.refusal}
394
+ `),process.exit(2)),S=a.template,y.push(...a.personObjects);for(let l of a.personObjects){let h=` ${l}: the template gives it person account record types: the accounts are written as person accounts, without Name, which the org builds from the two names`;s(h),A.push(h.trim())}}if(!S){let a=[];for(let[l,h]of e.objects.entries()){let E=await C(h.objectApiName),N=e.recordTypes[h.objectApiName],oe="business";if(N&&h.objectApiName===ae){let L=Ao(N,await $o(c));if("refusal"in L&&(process.stderr.write(`${L.refusal}
395
+ `),process.exit(2)),oe=L.kind,oe==="person"){y.push(ae);let Yt=jo(N);s(Yt),A.push(Yt.trim())}}let Pe=E.createable===!1,Qt=E.fields,et=Ro(Pe?Qt.map(L=>({...L,createable:!0})):Qt,h.objectApiName,oe);if(N){let L=ks(h.objectApiName,N,E.recordTypeInfos);"refusal"in L&&(process.stderr.write(`${L.refusal}
396
+ `),process.exit(2)),et.push(L.rule)}else{let L=Oo(h.objectApiName,E.recordTypeInfos);L&&s(L)}s(Pe?` ${h.objectApiName}: the user this seed runs as may not create its records: skipped (give that user Create on it in a permission set)`:` ${h.objectApiName}: ${et.map(L=>L.fieldApiName).join(", ")||"(none)"}`),a.push({objectApiName:h.objectApiName,recordCount:h.recordCount,fieldRules:et,excludedFields:[],insertOrder:l,batchSize:e.batchSize})}S={id:`cli-${Date.now()}`,name:"sandforge seed",description:"Headless run",version:1,strategy:"faker",objects:a,...e.relations.length>0?{relations:e.relations}:{},tags:["cli"],createdAt:z,updatedAt:z}}for(let a of Object.keys(e.fit?.caps?.objects??{}))S.objects.some(l=>l.objectApiName===a)||(process.stderr.write(`--fit-cap ${a}: the seed writes no ${a}.
397
+ `),process.exit(2));let O=await ve(c).read(e.target,S.objects.map(a=>a.objectApiName)).catch(a=>({unread:a instanceof Error?a.message:String(a)})),M=Gr(S,m!==void 0),k=(a,l=[])=>{throw e.json&&process.stdout.write(hn({tool:"sandforge-seed",target:e.target,elapsedMs:G(n)},a,l)),new Error([a,...l].map(Le).join(`
398
+ `))},I,B;if(e.muteAutomation)try{I=await ht(async()=>pt(c),O,{writes:M});for(let a of ue(I.muted,e.target))s(` ${a}`)}catch(a){if(!Se(a))throw a;B=a.refusal,e.dryRun&&s(` ${X(a.refusal)}`)}let P=Wr(O,I?.plan,M),Q={...P.unread!==void 0?{roomUnread:P.unread}:{},muted:(I?.plan?.assign.length??0)>0},_=e.runId??`sandforge-seed-${Zs()}`,H=e.checkpointFirst?Jn({module:"seed",operationId:_,request:e.checkpointFirst,session:f,org:Wn(f,R??await be(c)),connect:a=>{let l=le(a);return p.push(at(l)),l},journalDir:ie(),say:s,own:{runId:_}}):void 0,q,pe=[],de=a=>{let l={code:ke,message:a};pe.push(l),e.dryRun&&s(` ${X(l)}`)},Y=S.objects.filter(a=>a.recordCount>0);if(H&&Y.length>0){let a={written:Y.map(l=>l.objectApiName),running:P.running??{firing:[]}};try{q={ask:a,estimate:await H.scope(a)}}catch(l){de(En(l))}}let W=await On({read:O,...I?.plan?{plan:I.plan}:{},writes:M,readDeliverability:async()=>cn(R??await be(c))?An:jn(c),accepted:e.acceptEmails===!0,target:e.target,run:"seed",keepsAddresses:!0,mayMute:e.muteAutomation!==!0&&Ue("--mute-automation")}),he=Fn(W.ofRun),w={...he,...In(I?.plan)},v=Tt(c),T=await Br(S,v),j=()=>g()-(he.deliverability??0),me=Ot(C),V=await jr(T,{describeCreateableFields:me.createable,describeRequiredFields:It(me,y)}),ee={duplicateRules:Mn(O),slices:V,bulkThreshold:tt.bulk.threshold,typedFirst:e.dryRun,sentBefore:j()},D=await vt(c,T,y,e.target,q?.estimate,w,ee),ge,Ve,Lt=a=>{Ve=a,e.dryRun&&s(` ${X(a)}`)};if(e.fit&&D.refusedFor!=="checkpoint"&&pe.length===0){let a=$t(D,e.fit.withinMB);if("unread"in a)Lt({code:qr,message:`The seed was refused before it wrote anything: it cannot be fitted to ${e.target}, whose data storage left could not be read (${a.unread}): give --fit-within <MB>, the most it may take, to fit it to that. Nothing was written.`});else{let l=xt({template:T,personObjects:y,budget:a,room:P.room,ask:e.fit,path:ee});ge={applied:!0,fit:l};for(let h of vs(l,e.target,{applied:!0,...Q}))s(h);l.proposal.cannotFit!==void 0?Lt({code:Kr,message:`The seed was refused before it wrote anything: it cannot be fitted to ${e.target}: ${l.proposal.cannotFit}. Nothing was written.`}):l.heldBy!=="whole"&&(S=Et(S,l.proposal),T=Et(T,l.proposal),ee={...ee,sentBefore:j()},D=await vt(c,T,y,e.target,q?.estimate,w,ee))}}s(xo(D.check,e.target));let Oe;if(q)for(let a of Vn(q.estimate))s(a);if(D.refusedFor==="checkpoint")de(ze({code:ke,message:D.refusal??"",...D.checkpointRefusal?{refusal:D.checkpointRefusal}:{}}));else if(D.refusal){if(!e.fit){let a=$t(D);if(!("unread"in a)){let l=xt({template:T,personObjects:y,budget:a,room:P.room,path:ee});ge={applied:!1,fit:l};for(let h of vs(l,e.target,{applied:!1,...Q}))s(` ${h}`)}}Oe={code:D.refusedFor==="apiRequests"?xn:Ir,message:D.refusal},e.dryRun&&s(` ${X(Oe)}`)}let te=await Co({target:e.target,objects:S.objects,readAutomation:async()=>{let a=I?.automation??O;if(typeof a.unread=="string")throw new Error(a.unread);return a},readLimits:()=>Pn(c)});for(let a of te.lines)s(a);W.gate.line!==void 0&&s(` ${W.gate.line}`);let Ie=te.gate.refusal!==void 0?{code:Vr,message:te.gate.refusal}:void 0;Ie&&e.dryRun&&s(` ${X(Ie)}`);let we=W.gate.stop;we&&e.dryRun&&s(` ${X(we)}`);let Mt=[...B!==void 0?[B]:[],...pe,...Ve!==void 0?[Ve]:[],...Oe!==void 0?[Oe]:[],...Ie!==void 0?[Ie]:[],...we?[we]:[]],[Bt,...Ns]=Mt;!e.dryRun&&Bt!==void 0&&k(Bt,Ns),s(`template: ${Ts(S)} (${S.objects.length} object(s))`);let Ut=e.dryRun?void 0:qn(ie()),J=Ut?.recorder({runId:_,targetOrgId:R?.id??e.target,targetAlias:e.target,startedAt:u,...R?{targetOrganizationId:R.id}:{}});Un(J,()=>c.identity(),"sandforge seed");let K=Ut?.pathOf(_),ne=new AbortController,Ze,Fs=a=>{Ze=a,process.stderr.write(`
399
399
  interrupted: the seed stops before its next call to the org, and says what it wrote
400
- `),ne.abort()},Te=tt,zt=new Map,qt=!1,_s=pr({conn:c,bulkThreshold:Te.bulk.threshold,bulkManager:new gn(Te.bulk.maxConcurrentJobs),retry:new fr({retryConfig:Te.retry,signal:ne.signal}),signal:ne.signal,label:"sandforge seed",log:a=>s(` ${a}`),onProgress:(a,l,h)=>{let E=l>0?Math.floor(a/l*10):10;(zt.get(h)??-1)>=E||(zt.set(h,E),s(` ${h}: ${a} of ${l}`))},...J?{calls:{sending:(a,l,h)=>J.sending(a,l,h),answered:(a,l)=>J.answered(a,l)}}:{}}),Ee=e.dryRun?Sr():void 0,Ds=0,Ls=async(a,l,h,E)=>{if(e.dryRun){s(` [dry-run] ${l}: ${h.length} record(s) `+Eo(h.length,Te.bulk.threshold,Ar(ee.duplicateRules,l)));let se=h.map(()=>`dry-${Ds++}`);return Ee?.inserted(l,h,se),{successIds:se,errors:[],rows:se.map(Pe=>({id:Pe}))}}h.length>0&&(qt=!0);let N=await _s(a,l,h,E);return J?.note(l,N.successIds),s(` ${l}: ${N.successIds.length} written, ${N.errors.length} refused`+(N.stopped?", stopped":"")),N},de=Ot(a=>c.sobject(a).describe()),Kt={},Ms=To({readExistingParentIds:(a,l,h)=>yr(c,a,l,h),readPresentParentIds:(a,l)=>Rr(c,a,l),describeKeyPrefix:de.keyPrefix,describeCreateableFields:de.createable,describeVisibleFields:de.visible,describePicklistValues:de.picklistValues,describeFieldLengths:de.lengths,describeRequiredFields:It(de,y),objectAccess:v,insert:Ls,...Ee?{readTarget:Ee.readTarget,update:async(a,l,h)=>(s(` [dry-run] ${l}: ${h.length} record(s) the platform writes with their opportunity, given the fields generated for them (REST update)`),Ee.update(a,l,h))}:vr(c),seed:d,locale:$,signal:ne.signal,...m?{onRowIds:(a,l)=>{a==="Case"&&Object.assign(Kt,l)}}:{},...m&&!e.dryRun?{knowledge:zr({org:c,plan:{publish:!0,links:m.compiled.closedCaseArticles},...J?{journal:J}:{},signal:ne.signal})}:{}});s(e.dryRun?`
400
+ `),ne.abort()},Te=tt,zt=new Map,qt=!1,_s=pr({conn:c,bulkThreshold:Te.bulk.threshold,bulkManager:new wn(Te.bulk.maxConcurrentJobs),retry:new fr({retryConfig:Te.retry,signal:ne.signal}),signal:ne.signal,label:"sandforge seed",log:a=>s(` ${a}`),onProgress:(a,l,h)=>{let E=l>0?Math.floor(a/l*10):10;(zt.get(h)??-1)>=E||(zt.set(h,E),s(` ${h}: ${a} of ${l}`))},...J?{calls:{sending:(a,l,h)=>J.sending(a,l,h),answered:(a,l)=>J.answered(a,l)}}:{}}),Ee=e.dryRun?Sr():void 0,Ds=0,Ls=async(a,l,h,E)=>{if(e.dryRun){s(` [dry-run] ${l}: ${h.length} record(s) `+Eo(h.length,Te.bulk.threshold,Ar(ee.duplicateRules,l)));let oe=h.map(()=>`dry-${Ds++}`);return Ee?.inserted(l,h,oe),{successIds:oe,errors:[],rows:oe.map(Pe=>({id:Pe}))}}h.length>0&&(qt=!0);let N=await _s(a,l,h,E);return J?.note(l,N.successIds),s(` ${l}: ${N.successIds.length} written, ${N.errors.length} refused`+(N.stopped?", stopped":"")),N},re=Ot(a=>c.sobject(a).describe()),Kt={},Ms=To({readExistingParentIds:(a,l,h)=>yr(c,a,l,h),readPresentParentIds:(a,l)=>Rr(c,a,l),describeKeyPrefix:re.keyPrefix,describeCreateableFields:re.createable,describeVisibleFields:re.visible,describeComputedFields:re.computed,describePicklistValues:re.picklistValues,describeFieldLengths:re.lengths,describeRequiredFields:It(re,y),objectAccess:v,insert:Ls,...Ee?{readTarget:Ee.readTarget,update:async(a,l,h)=>(s(` [dry-run] ${l}: ${h.length} record(s) the platform writes with their opportunity, given the fields generated for them (REST update)`),Ee.update(a,l,h))}:vr(c),seed:d,locale:$,signal:ne.signal,...m?{onRowIds:(a,l)=>{a==="Case"&&Object.assign(Kt,l)}}:{},...m&&!e.dryRun?{knowledge:zr({org:c,plan:{publish:!0,links:m.compiled.closedCaseArticles},...J?{journal:J}:{},signal:ne.signal})}:{}});s(e.dryRun?`
401
401
  executing\u2026 (DRY-RUN)`:`
402
- executing\u2026 (REAL)`),K!==void 0&&s(`run file: ${K} (--remove ${K} takes back what the run creates)`);let Bs=e.dryRun?()=>{}:De(Fs),U,He,Gt=a=>{He=a instanceof Error?a.message:String(a)},re=I?.muted,Xe,Qe,Wt=async()=>{!H||!Xe||Qe||(Qe=await Hn(H,Xe,qt,e.target,s))};try{if(!e.dryRun&&H&&q){let h=q,E=await xn(()=>H.take(h.ask,h.estimate,{signal:ne.signal}));if("stop"in E){E.stop.code===ke&&k({code:ke,message:ze(E.stop)}),process.stderr.write(`${ze(E.stop)}
403
- `),it(_e(Ze??"SIGINT"));return}Xe=E.checkpoint,J?.checkpoint?.(E.checkpoint);for(let N of Zn(E.checkpoint,e.target,e.muteAutomation===!0))s(N)}let a=!e.dryRun&&I?.prepared?await I.prepared.acquire(_).catch(h=>{if(!Se(h))throw h;return k(h.refusal)}):void 0;a&&(re=a.outcome);let l=a?W.afterLease(a.outcome,e.acceptEmails===!0):void 0;if(a&&l){re=await a.release();for(let h of ue(re,e.target))s(h);k(l)}U=await Ms.execute(S,e.target,_).finally(async()=>{if(a){re=await a.release();for(let h of ue(re,e.target))s(h)}}),re&&!e.dryRun&&(U={...U,mutedAutomation:re}),await Wt()}catch(a){throw await J?.end({status:"failure",finishedAt:new Date().toISOString(),objectResults:[]}).catch(Gt),await Wt(),K!==void 0&&bs(K)&&process.stderr.write(`the seed stopped on an error; what it created is kept in ${K}, and --remove ${K} takes it back
402
+ executing\u2026 (REAL)`),K!==void 0&&s(`run file: ${K} (--remove ${K} takes back what the run creates)`);let Bs=e.dryRun?()=>{}:De(Fs),U,He,Gt=a=>{He=a instanceof Error?a.message:String(a)},se=I?.muted,Xe,Qe,Wt=async()=>{!H||!Xe||Qe||(Qe=await Hn(H,Xe,qt,e.target,s))};try{if(!e.dryRun&&H&&q){let h=q,E=await Cn(()=>H.take(h.ask,h.estimate,{signal:ne.signal}));if("stop"in E){E.stop.code===ke&&k({code:ke,message:ze(E.stop)}),process.stderr.write(`${ze(E.stop)}
403
+ `),it(_e(Ze??"SIGINT"));return}Xe=E.checkpoint,J?.checkpoint?.(E.checkpoint);for(let N of Zn(E.checkpoint,e.target,e.muteAutomation===!0))s(N)}let a=!e.dryRun&&I?.prepared?await I.prepared.acquire(_).catch(h=>{if(!Se(h))throw h;return k(h.refusal)}):void 0;a&&(se=a.outcome);let l=a?W.afterLease(a.outcome,e.acceptEmails===!0):void 0;if(a&&l){se=await a.release();for(let h of ue(se,e.target))s(h);k(l)}U=await Ms.execute(S,e.target,_).finally(async()=>{if(a){se=await a.release();for(let h of ue(se,e.target))s(h)}}),se&&!e.dryRun&&(U={...U,mutedAutomation:se}),await Wt()}catch(a){throw await J?.end({status:"failure",finishedAt:new Date().toISOString(),objectResults:[]}).catch(Gt),await Wt(),K!==void 0&&bs(K)&&process.stderr.write(`the seed stopped on an error; what it created is kept in ${K}, and --remove ${K} takes it back
404
404
  `),a}finally{Bs()}await J?.end({finishedAt:new Date().toISOString(),status:U.status,...U.cancelled?{cancelled:!0}:{},objectResults:U.objectResults}).catch(Gt),He!==void 0&&process.stderr.write(`what the run created could not all be written to ${K??"its file"} (${He}): --remove takes it back from the --json summary
405
- `);let Z=K!==void 0&&bs(K)?K:void 0,xe=m&&r&&Z!==void 0?await gs({journalDir:ae(),runId:_,pack:r,compiled:m.compiled,options:m.options,caseIds:Kt}):void 0,Jt=xe?.companion!==void 0?await Ke(Ge(xs(c))).catch(()=>{}):void 0,Vt=G(n),Ce=ne.signal.aborted;it(Ce?_e(Ze??"SIGINT"):ln(U.status,e.failOnPartial));let Ye=U.objectResults.reduce((a,l)=>a+l.createdIds.length,0),Zt=!e.dryRun&&Ye>0?R?.id??await Cs(c):void 0,Ht=e.dryRun?q?.estimate:Qe,Xt=te.gate.refusal??we?.message,Us=Mt;if(e.json){process.stdout.write(`${JSON.stringify({tool:"sandforge-seed",target:e.target,...Zt?{targetOrgId:Zt}:{},dryRun:e.dryRun,seed:d,startedAt:u,finishedAt:new Date().toISOString(),...A.length>0?{notes:A}:{},emails:{checks:te.gate.checks,...Xt!==void 0?{refusal:Xt}:{},...te.gate.unknown?{unknown:te.gate.unknown}:{},...W.gate.deliverability?{deliverability:W.gate.deliverability}:{}},...e.dryRun?Po(T,y,D,g()):{apiRequests:Es(D,g())},...ge?{fit:_o(ge.fit,ge.applied,e.fit)}:{},...e.dryRun?In(I):{},...Ht?{checkpoint:Ht}:{},...fn(Us),result:U,...Z?{runFile:Z}:{},...m&&r?{scenario:{packId:r.id,options:m.options,tests:m.compiled.tests.length,...xe??{},...Jt?.kind==="no-agent"?{agents:"none"}:{}}}:{},elapsedMs:Vt,...Ce?{interrupted:!0}:{}},null,2)}
405
+ `);let Z=K!==void 0&&bs(K)?K:void 0,xe=m&&r&&Z!==void 0?await gs({journalDir:ie(),runId:_,pack:r,compiled:m.compiled,options:m.options,caseIds:Kt}):void 0,Jt=xe?.companion!==void 0?await Ke(Ge(xs(c))).catch(()=>{}):void 0,Vt=G(n),Ce=ne.signal.aborted;it(Ce?_e(Ze??"SIGINT"):un(U.status,e.failOnPartial));let Ye=U.objectResults.reduce((a,l)=>a+l.createdIds.length,0),Zt=!e.dryRun&&Ye>0?R?.id??await Cs(c):void 0,Ht=e.dryRun?q?.estimate:Qe,Xt=te.gate.refusal??we?.message,Us=Mt;if(e.json){process.stdout.write(`${JSON.stringify({tool:"sandforge-seed",target:e.target,...Zt?{targetOrgId:Zt}:{},dryRun:e.dryRun,seed:d,startedAt:u,finishedAt:new Date().toISOString(),...A.length>0?{notes:A}:{},emails:{checks:te.gate.checks,...Xt!==void 0?{refusal:Xt}:{},...te.gate.unknown?{unknown:te.gate.unknown}:{},...W.gate.deliverability?{deliverability:W.gate.deliverability}:{}},...e.dryRun?Po(T,y,D,g()):{apiRequests:Es(D,g())},...ge?{fit:_o(ge.fit,ge.applied,e.fit)}:{},...e.dryRun?Tn(I):{},...Ht?{checkpoint:Ht}:{},...pn(Us),result:U,...Z?{runFile:Z}:{},...m&&r?{scenario:{packId:r.id,options:m.options,tests:m.compiled.tests.length,...xe??{},...Jt?.kind==="no-agent"?{agents:"none"}:{}}}:{},elapsedMs:Vt,...Ce?{interrupted:!0}:{}},null,2)}
406
406
  `),Ce&&process.stderr.write(`${As(Z)}
407
407
  `);return}s(`
408
408
  status: ${String(U.status??"unknown")}`),s(`created: ${String(U.totalRecordsCreated??0)}`);for(let a of U.objectResults??[]){s(` ${a.objectApiName}: ${a.recordsCreated} created, ${a.recordsFailed} failed`);let l=kr(a.writtenByThePlatform);l!==void 0&&s(` ${l}`);for(let h of Bo(a.errors??[]))s(` ${h}`)}for(let a of ms(U.knowledge))s(a);if(s(`seed: ${d}`),!e.dryRun&&Ye>0&&s(`
409
409
  created ${Ye} record(s) in ${e.target}: `+(Z!==void 0?`--remove ${Z} takes them back`:"run with --json and save the summary to a file, and --remove takes them back from it")),r&&xe&&Z!==void 0)for(let a of Mo(xe,Jt,Z,e.target,r))s(a);if(Ce){process.stderr.write(`${As(Z)}
410
410
  `);return}s(`
411
411
  done in ${Vt}ms`)}function xs(t){return{query:async n=>t.tooling.query(n),queryMore:async n=>t.tooling.queryMore(n)}}async function Lo(t){let n=le(await ye(t));return{tooling:xs(n),organizationId:()=>Cs(n)}}function Mo(t,n,e,r,o){let i=`
412
- scenario ${t.packId}: ${t.openCasesWritten} of its ${t.openCases} open case(s) written, which its ${t.tests} test(s) are about`;return t.unkept!==void 0?[i,` the ids of its cases could not be kept (${t.unkept}): no test file can be written from this run`]:t.companion===void 0?[i," no open case was written: no test file can be written from this run"]:n?.kind==="no-agent"?[i,` ${n.message}`,` ${Nt(e,r,o)}`]:[i," the test file is written from this run, never deployed nor run:",` ${Nt(e,r,o)}`]}var $s=5;function Bo(t){let n=sn(t),e=n.slice(0,$s).flatMap(o=>{let i=o.fields.length>0?` (${o.fields.join(", ")})`:"",s=`${o.count} \xD7 ${o.code??o.example}${i}`;return o.code===null?[s]:[s,` ${o.example}`]}),r=n.length-$s;return r>0?[...e,`and ${r} other reason(s)`]:e}function As(t){return t!==void 0?`interrupted: the seed stopped before it was through; ${t} keeps what it wrote, and --remove ${t} takes it back`:"interrupted: the seed stopped before it was through; the summary above says what it wrote, and --remove takes it back from that summary saved to a file (--json)"}async function Cs(t){try{let e=(await t.query("SELECT Id FROM Organization LIMIT 1")).records[0]?.Id;return typeof e=="string"?e:void 0}catch{return}}var _t=new Set(["--remove","--target","--preview","--include-changed","--accept-automation","--mute-automation","--sweep","--sweep-list",...or,"--leave-undeletable","--json"]),Uo=new Set(["--remove","--target"]);function zo(t){let n=t.slice(2);for(let s=0;s<n.length;s++){let d=n[s];if(Uo.has(d)){s++;continue}d==="--dry-run"&&(process.stderr.write(`--remove does not take --dry-run: a removal that did not read it would delete for real. --preview says what the removal would do, and writes nothing. Run with --help.
412
+ scenario ${t.packId}: ${t.openCasesWritten} of its ${t.openCases} open case(s) written, which its ${t.tests} test(s) are about`;return t.unkept!==void 0?[i,` the ids of its cases could not be kept (${t.unkept}): no test file can be written from this run`]:t.companion===void 0?[i," no open case was written: no test file can be written from this run"]:n?.kind==="no-agent"?[i,` ${n.message}`,` ${Nt(e,r,o)}`]:[i," the test file is written from this run, never deployed nor run:",` ${Nt(e,r,o)}`]}var $s=5;function Bo(t){let n=on(t),e=n.slice(0,$s).flatMap(o=>{let i=o.fields.length>0?` (${o.fields.join(", ")})`:"",s=`${o.count} \xD7 ${o.code??o.example}${i}`;return o.code===null?[s]:[s,` ${o.example}`]}),r=n.length-$s;return r>0?[...e,`and ${r} other reason(s)`]:e}function As(t){return t!==void 0?`interrupted: the seed stopped before it was through; ${t} keeps what it wrote, and --remove ${t} takes it back`:"interrupted: the seed stopped before it was through; the summary above says what it wrote, and --remove takes it back from that summary saved to a file (--json)"}async function Cs(t){try{let e=(await t.query("SELECT Id FROM Organization LIMIT 1")).records[0]?.Id;return typeof e=="string"?e:void 0}catch{return}}var _t=new Set(["--remove","--target","--preview","--include-changed","--accept-automation","--mute-automation","--sweep","--sweep-list",...or,"--leave-undeletable","--json"]),Uo=new Set(["--remove","--target"]);function zo(t){let n=t.slice(2);for(let s=0;s<n.length;s++){let d=n[s];if(Uo.has(d)){s++;continue}d==="--dry-run"&&(process.stderr.write(`--remove does not take --dry-run: a removal that did not read it would delete for real. --preview says what the removal would do, and writes nothing. Run with --help.
413
413
  `),process.exit(2)),_t.has(d)||(process.stderr.write(`--remove takes --target, --preview, --include-changed, --accept-automation, --mute-automation, --sweep, --sweep-late, --sweep-untied, --sweep-list, --leave-undeletable and --json, not "${d}". Run with --help.
414
414
  `),process.exit(2))}let e=s=>{let d=n.indexOf(s);return d>=0&&d+1<n.length?n[d+1]:void 0},r=e("--remove"),o=e("--target");(!r||!o||_t.has(r)||_t.has(o))&&(process.stderr.write(`--remove takes the file a run printed its --json summary to, or the run file it named as it began, or its run id, and --target the org the run wrote to. Run with --help.
415
415
  `),process.exit(2)),n.includes("--sweep")&&n.includes("--sweep-list")&&(process.stderr.write(`--sweep deletes and --sweep-list only lists: give one of them. Run with --help.
416
416
  `),process.exit(2)),n.includes("--preview")&&n.includes("--sweep-list")&&(process.stderr.write(`--preview writes nothing, and --sweep-list lists what a sweep would take: give --preview without it, or with --sweep. Run with --help.
417
417
  `),process.exit(2));let i=ar(n);return"refusal"in i&&(process.stderr.write(`${i.refusal} Run with --help.
418
- `),process.exit(2)),{summaryPath:r,target:o,includeChanged:n.includes("--include-changed"),sweep:n.includes("--sweep"),sweepList:n.includes("--sweep-list"),...i,json:n.includes("--json"),leaveUndeletable:n.includes("--leave-undeletable"),acceptAutomation:n.includes("--accept-automation"),muteAutomation:n.includes("--mute-automation"),...n.includes("--preview")?{preview:!0}:{}}}var js=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,qo=F.object({tool:F.literal("sandforge-seed"),target:F.string().min(1),targetOrgId:F.string().regex(js).optional(),dryRun:F.boolean(),startedAt:F.string().min(1).max(40).optional(),finishedAt:F.string().min(1).max(40).optional(),result:F.object({operationId:F.string().min(1).max(200).optional(),status:F.enum(["success","partial","failure"]),objectResults:F.array(F.object({objectApiName:F.string().regex(Is),createdIds:F.array(F.string().regex(js)),truncated:F.boolean().optional()}).loose())}).loose()}).loose();function Ko(t){let n;try{n=JSON.parse(t)}catch{return{refusal:"is not JSON: save the output of a run printed with --json."}}let e=hn(n,"sandforge-seed");if(e)return{refusal:mn(e)};let r=qo.safeParse(n);if(!r.success){let o=r.error.issues[0];return{refusal:`is not the summary of a sandforge seed run (${o.path.join(".")||"summary"}: ${o.message}).`}}return r.data.dryRun?{refusal:"is the summary of a dry run, which wrote nothing: there is nothing to remove."}:r.data.result.objectResults.some(o=>o.truncated===!0)?{refusal:"names only the first of the records some object created: the rest cannot be told apart from the org\u2019s own."}:{summary:r.data}}function Go(t,n){return Un({runId:t.result.operationId??"sandforge-seed",targetOrgId:t.target,...t.startedAt!==void 0?{startedAt:t.startedAt}:{},...t.finishedAt!==void 0?{finishedAt:t.finishedAt}:{},status:t.result.status,objectResults:t.result.objectResults},n)}var Os=3;async function Wo(t,n){let e=Rn(Qs(t),""),r;try{r=Me(je(t,"utf8"))}catch(i){process.stderr.write(`--remove ${t} cannot be read: ${i instanceof Error?i.message:String(i)}
418
+ `),process.exit(2)),{summaryPath:r,target:o,includeChanged:n.includes("--include-changed"),sweep:n.includes("--sweep"),sweepList:n.includes("--sweep-list"),...i,json:n.includes("--json"),leaveUndeletable:n.includes("--leave-undeletable"),acceptAutomation:n.includes("--accept-automation"),muteAutomation:n.includes("--mute-automation"),...n.includes("--preview")?{preview:!0}:{}}}var js=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,qo=F.object({tool:F.literal("sandforge-seed"),target:F.string().min(1),targetOrgId:F.string().regex(js).optional(),dryRun:F.boolean(),startedAt:F.string().min(1).max(40).optional(),finishedAt:F.string().min(1).max(40).optional(),result:F.object({operationId:F.string().min(1).max(200).optional(),status:F.enum(["success","partial","failure"]),objectResults:F.array(F.object({objectApiName:F.string().regex(Is),createdIds:F.array(F.string().regex(js)),truncated:F.boolean().optional()}).loose())}).loose()}).loose();function Ko(t){let n;try{n=JSON.parse(t)}catch{return{refusal:"is not JSON: save the output of a run printed with --json."}}let e=mn(n,"sandforge-seed");if(e)return{refusal:gn(e)};let r=qo.safeParse(n);if(!r.success){let o=r.error.issues[0];return{refusal:`is not the summary of a sandforge seed run (${o.path.join(".")||"summary"}: ${o.message}).`}}return r.data.dryRun?{refusal:"is the summary of a dry run, which wrote nothing: there is nothing to remove."}:r.data.result.objectResults.some(o=>o.truncated===!0)?{refusal:"names only the first of the records some object created: the rest cannot be told apart from the org\u2019s own."}:{summary:r.data}}function Go(t,n){return zn({runId:t.result.operationId??"sandforge-seed",targetOrgId:t.target,...t.startedAt!==void 0?{startedAt:t.startedAt}:{},...t.finishedAt!==void 0?{finishedAt:t.finishedAt}:{},status:t.result.status,objectResults:t.result.objectResults},n)}var Os=3;async function Wo(t,n){let e=Sn(Qs(t),""),r;try{r=Me(je(t,"utf8"))}catch(i){process.stderr.write(`--remove ${t} cannot be read: ${i instanceof Error?i.message:String(i)}
419
419
  `),process.exit(2)}(!r||r.configId!=="sandforge-seed")&&(process.stderr.write(`--remove ${t} names no run of sandforge seed.
420
420
  `),process.exit(2)),e.pathOf(r.runId)!==t&&(process.stderr.write(`--remove ${t} is the file of the run ${r.runId} under another name: give it as ${e.pathOf(r.runId)}, where what its removals did is kept beside it.
421
421
  `),process.exit(2));let o=await e.get(r.runId)??r;return o.targetOrganizationId===void 0&&o.targetOrgId!==n.target&&(process.stderr.write(`The run wrote to ${o.targetOrgId}, and what it created is removed from that org only: give --target ${o.targetOrgId}.
@@ -423,19 +423,19 @@ scenario ${t.packId}: ${t.openCasesWritten} of its ${t.openCases} open case(s) w
423
423
  `),process.exit(2)}let r=Ko(e);"refusal"in r&&(process.stderr.write(`--remove ${t.summaryPath} ${r.refusal}
424
424
  `),process.exit(2));let{summary:o}=r;o.targetOrgId===void 0&&o.target!==t.target&&(process.stderr.write(`The run wrote to ${o.target}, and what it created is removed from that org only: give --target ${o.target}.
425
425
  `),process.exit(2));let i=Tr(t.summaryPath),s=o.result.operationId??"sandforge-seed",d,u;try{u=je(i,"utf8")}catch(p){p?.code!=="ENOENT"&&(process.stderr.write(`${i} cannot be read: ${p instanceof Error?p.message:String(p)}
426
- `),process.exit(2))}if(u!==void 0){let p;try{p=JSON.parse(u)}catch{p=void 0}let g=p?.runId;d=g===s?Sn(p):void 0,g!==s?n(`${i} is of another run: it is not read, and this removal's takes its place`):d||(process.stderr.write(`${i} does not read as what earlier removals did.
426
+ `),process.exit(2))}if(u!==void 0){let p;try{p=JSON.parse(u)}catch{p=void 0}let g=p?.runId;d=g===s?kn(p):void 0,g!==s?n(`${i} is of another run: it is not read, and this removal's takes its place`):d||(process.stderr.write(`${i} does not read as what earlier removals did.
427
427
  `),process.exit(2))}let f=Go(o,d),c=d??{};return{run:f,...o.targetOrgId!==void 0?{targetOrgId:o.targetOrgId}:{},...d?{earlier:d}:{},...Vo(o.result),updateRemoval:async p=>{c=p(c);let g=`${i}.${process.pid}.tmp`;Xs(g,`${JSON.stringify({version:1,runId:f.runId,...c},null,2)}
428
428
  `),Hs(g,i)}}}async function Ps(t,n,e,r,o,i){let{earlier:s}=o,d;try{d=await ve(t).read(n,r.created.map(f=>f.objectApiName))}catch(f){d={error:f instanceof Error?f.message:String(f)}}let u=ur({otherRuns:await lr({organizationId:e,alias:n,span:cr(r),own:{runId:r.runId,ids:r.created.flatMap(f=>f.ids)}}),...o.muted?{muted:o.muted}:{},...s?.removalSpans?{removalSpans:s.removalSpans}:{},...s?.madeEarlier?{made:s.madeEarlier}:{},...s?.lateEarlier?{late:s.lateEarlier}:{}});return wr(Re(t,"sandforge seed --sweep"),r.created,d,i,void 0,[],{...o.runUserId?{runUserId:o.runUserId}:{},ties:u})}async function Ho(t=process.argv){let n=Date.now(),e=zo(t),r=w=>{process[e.json?"stderr":"stdout"].write(`${w}
429
- `)},o=jt(e.summaryPath,ae(),yt),i=o!==void 0?await Wo(o,e):Zo(e,r),{earlier:s}=i,d=i.run;if(yn(d)&&k({code:un,message:`The run is still writing, in process ${d.writer?.pid??"?"}: remove it once it has ended. Nothing was deleted.`}),e.preview)return ea(e,i,d,r,n);let u,f=(w,v,T,j,me)=>{if(e.json){process.stdout.write(`${JSON.stringify({tool:"sandforge-seed",action:"remove",summary:e.summaryPath,target:e.target,includeChanged:e.includeChanged,result:{status:w,planned:T,objects:v,...j?{sweep:j}:{},...u?{sweepListing:u}:{},...me?{mutedAutomation:me}:{}},elapsedMs:G(n)},null,2)}
429
+ `)},o=jt(e.summaryPath,ie(),yt),i=o!==void 0?await Wo(o,e):Zo(e,r),{earlier:s}=i,d=i.run;if(Rn(d)&&k({code:fn,message:`The run is still writing, in process ${d.writer?.pid??"?"}: remove it once it has ended. Nothing was deleted.`}),e.preview)return ea(e,i,d,r,n);let u,f=(w,v,T,j,me)=>{if(e.json){process.stdout.write(`${JSON.stringify({tool:"sandforge-seed",action:"remove",summary:e.summaryPath,target:e.target,includeChanged:e.includeChanged,result:{status:w,planned:T,objects:v,...j?{sweep:j}:{},...u?{sweepListing:u}:{},...me?{mutedAutomation:me}:{}},elapsedMs:G(n)},null,2)}
430
430
  `);for(let V of kt(v,e))r(V);return}for(let V of j?sr(j):[])r(V);for(let V of Er(w,v))r(V);for(let V of kt(v,e))r(V);r(`
431
431
  done in ${G(n)}ms`)},c=i.runs!==void 0&&(d.jobs??[]).length>0;if(Be(d).length===0&&!c&&!e.sweep&&!e.sweepList){r(s?.undo?`what the run created was removed already, on ${s.undo.removedAt}`:"The run created nothing: there is nothing of it to remove."),f("success",[],0);return}let p=await ye(e.target),g=le(p),R=await be(g),$=e.sweepList?void 0:At(e.target,R,"sandforge seed");if($&&k({code:"PRODUCTION_TARGET",message:$}),i.targetOrgId!==void 0&&i.targetOrgId.slice(0,15)!==R.id.slice(0,15)&&k({code:dt,message:`${e.target} is not the org the run wrote to (${i.targetOrgId}), and what it created is removed from that org only. Nothing was deleted.`}),c&&i.runs){let w=i.runs,v=await mr(w,d,g,()=>Re(g,"sandforge seed --remove").serverTime());for(let T of xr(v,e.target))r(T);v.some(T=>T.answered)&&(d=await w.get(d.runId)??d)}let b=Be(d),x=w=>Ps(g,e.target,R.id,d,i,w);if(e.sweepList){let w=await bt(qe(g,"sandforge seed --sweep-list"),await x(),s?.removalSpans??[]);for(let v of $e(w,e.target,e,!0))r(v);e.json?process.stdout.write(`${JSON.stringify({tool:"sandforge-seed",action:"sweep-list",summary:e.summaryPath,target:e.target,listing:w,elapsedMs:G(n)},null,2)}
432
432
  `):r(`
433
- done in ${G(n)}ms`),w.refusal!==void 0&&process.exit(Os);return}r(`sandforge seed --remove ${e.summaryPath} from ${e.target}`);for(let{objectApiName:w,ids:v}of b)r(` ${w}: ${v.length} to remove`);b.length===0&&r("nothing left of the run to remove"),e.sweep&&r(`before them, a sweep deletes what the target's automation made for the run, as the run's user, tied to its records \u2014 run ${nr("--sweep-list")} to see what`);let C=new AbortController,z=De(()=>C.abort()),S=s??{},m=e.sweep?Mn(qe(g,"sandforge seed --sweep",C.signal),await x(C.signal),{includeChanged:e.includeChanged,removalSpans:S.removalSpans??[],...ir(e),approve:async w=>{u=w,r("");for(let v of $e(w,e.target,e))r(v)}}):void 0;await m?.ask();let A=rr(m,u);if(A){u=A,r("");for(let w of $e(A,e.target,e))r(w)}let y=[...new Set(b.map(({objectApiName:w})=>w))],O=st({setToDraft:ut(y),delete:ft(y)},m?.takes??[]),M=O.delete??[];function k(w){return process.stderr.write(`${Le(w)}
434
- `),e.json&&process.stdout.write(ct({tool:"sandforge-seed",...e.preview?{action:"remove-preview"}:{},summary:e.summaryPath,target:e.target,elapsedMs:G(n)},w)),process.exit(1)}let I=w=>(z(),k(w)),B;if(M.length>0&&!C.signal.aborted){let w=await ve(g).read(e.target,M);r("");for(let j of gt(w,e.target,O))r(j);if(e.muteAutomation)try{B=await ht(async()=>pt(g),w,{writes:an(O)});for(let j of ue(B.muted,e.target))r(` ${j}`)}catch(j){if(!Se(j))throw j;I(j.refusal)}let v=B?.automation??w,T=wt(v,e.target,{steps:O,assign:mt(v,ot(v,O)),mayMute:B===void 0&&Ue("--mute-automation")});T&&!e.acceptAutomation&&I({code:"AUTOMATION_NOT_ACCEPTED",message:T})}let P,Q,_=B?.muted,H=async()=>{!B?.prepared||C.signal.aborted||(Q=await B.prepared.acquire(`sandforge seed --remove ${d.runId}`).catch(w=>{if(!Se(w))throw w;return I(w.refusal)}),_=Q.outcome)},q=Re(g,"sandforge seed --remove"),pe=await gr(q,d.created),ie;try{P=await kn({run:d,org:q,includeChanged:e.includeChanged,...dr(m),...i.runUserId?{runUserId:i.runUserId}:{},onUndeletable:Qn(e.leaveUndeletable,e.target,w=>{ie=w}),beforeFirstWrite:H,signal:C.signal,store:{updateRemoval:(w,v)=>i.updateRemoval(T=>(S=v(T),S))}})}finally{z();let w=m?.made??new Set,v=m?.late??new Set,T=m?.gone??new Set;if((w.size>0||v.size>0||T.size>0)&&await i.updateRemoval(j=>br(j,w,v,T)).catch(j=>{process.stderr.write(`What the sweep found made for the run could not be kept (${j instanceof Error?j.message:String(j)}): a later --sweep may list it as tied to nothing.
435
- `)}),Q){_=await Q.release();for(let j of ue(_,e.target))r(j)}}_&&(P={...P,result:{...P.result,mutedAutomation:_}}),P.stoppedForUndeletable&&(ie&&k(ie),process.exit(1));let Y=P.result.status==="cancelled"?{}:await pe.take();for(let w of[...P.notes,...Y.note?[Y.note]:[]])process.stderr.write(`${w}
436
- `);let W=m?.result(),he=bn(P.result.status,W);f(he,Y.object?[...P.result.objects,Y.object]:P.result.objects,P.planned,W,_),he!=="success"&&process.exit(Os)}var Xo="not read by a preview: what the target's automation does as the records go \u2014 a trigger or a flow that deletes, keeps or creates other records \u2014 and what hangs from them, which a removal reads at each object\u2019s turn: a record kept for records that stay is counted with those to delete";function Qo(t){return`${JSON.stringify({tool:"sandforge-seed",action:"remove-preview",summary:t.summary,target:t.target,includeChanged:t.includeChanged,preview:t.preview,...t.sweepListing?{sweepListing:t.sweepListing}:{},refusals:t.refusals.map(({message:n})=>n),refusalCodes:t.refusals.map(({code:n})=>n),notes:t.notes,elapsedMs:t.elapsedMs},null,2)}
433
+ done in ${G(n)}ms`),w.refusal!==void 0&&process.exit(Os);return}r(`sandforge seed --remove ${e.summaryPath} from ${e.target}`);for(let{objectApiName:w,ids:v}of b)r(` ${w}: ${v.length} to remove`);b.length===0&&r("nothing left of the run to remove"),e.sweep&&r(`before them, a sweep deletes what the target's automation made for the run, as the run's user, tied to its records \u2014 run ${nr("--sweep-list")} to see what`);let C=new AbortController,z=De(()=>C.abort()),S=s??{},m=e.sweep?Bn(qe(g,"sandforge seed --sweep",C.signal),await x(C.signal),{includeChanged:e.includeChanged,removalSpans:S.removalSpans??[],...ir(e),approve:async w=>{u=w,r("");for(let v of $e(w,e.target,e))r(v)}}):void 0;await m?.ask();let A=rr(m,u);if(A){u=A,r("");for(let w of $e(A,e.target,e))r(w)}let y=[...new Set(b.map(({objectApiName:w})=>w))],O=st({setToDraft:ut(y),delete:ft(y)},m?.takes??[]),M=O.delete??[];function k(w){return process.stderr.write(`${Le(w)}
434
+ `),e.json&&process.stdout.write(ct({tool:"sandforge-seed",...e.preview?{action:"remove-preview"}:{},summary:e.summaryPath,target:e.target,elapsedMs:G(n)},w)),process.exit(1)}let I=w=>(z(),k(w)),B;if(M.length>0&&!C.signal.aborted){let w=await ve(g).read(e.target,M);r("");for(let j of gt(w,e.target,O))r(j);if(e.muteAutomation)try{B=await ht(async()=>pt(g),w,{writes:dn(O)});for(let j of ue(B.muted,e.target))r(` ${j}`)}catch(j){if(!Se(j))throw j;I(j.refusal)}let v=B?.automation??w,T=wt(v,e.target,{steps:O,assign:mt(v,ot(v,O)),mayMute:B===void 0&&Ue("--mute-automation")});T&&!e.acceptAutomation&&I({code:"AUTOMATION_NOT_ACCEPTED",message:T})}let P,Q,_=B?.muted,H=async()=>{!B?.prepared||C.signal.aborted||(Q=await B.prepared.acquire(`sandforge seed --remove ${d.runId}`).catch(w=>{if(!Se(w))throw w;return I(w.refusal)}),_=Q.outcome)},q=Re(g,"sandforge seed --remove"),pe=await gr(q,d.created),de;try{P=await vn({run:d,org:q,includeChanged:e.includeChanged,...dr(m),...i.runUserId?{runUserId:i.runUserId}:{},onUndeletable:Qn(e.leaveUndeletable,e.target,w=>{de=w}),beforeFirstWrite:H,signal:C.signal,store:{updateRemoval:(w,v)=>i.updateRemoval(T=>(S=v(T),S))}})}finally{z();let w=m?.made??new Set,v=m?.late??new Set,T=m?.gone??new Set;if((w.size>0||v.size>0||T.size>0)&&await i.updateRemoval(j=>br(j,w,v,T)).catch(j=>{process.stderr.write(`What the sweep found made for the run could not be kept (${j instanceof Error?j.message:String(j)}): a later --sweep may list it as tied to nothing.
435
+ `)}),Q){_=await Q.release();for(let j of ue(_,e.target))r(j)}}_&&(P={...P,result:{...P.result,mutedAutomation:_}}),P.stoppedForUndeletable&&(de&&k(de),process.exit(1));let Y=P.result.status==="cancelled"?{}:await pe.take();for(let w of[...P.notes,...Y.note?[Y.note]:[]])process.stderr.write(`${w}
436
+ `);let W=m?.result(),he=yn(P.result.status,W);f(he,Y.object?[...P.result.objects,Y.object]:P.result.objects,P.planned,W,_),he!=="success"&&process.exit(Os)}var Xo="not read by a preview: what the target's automation does as the records go \u2014 a trigger or a flow that deletes, keeps or creates other records \u2014 and what hangs from them, which a removal reads at each object\u2019s turn: a record kept for records that stay is counted with those to delete";function Qo(t){return`${JSON.stringify({tool:"sandforge-seed",action:"remove-preview",summary:t.summary,target:t.target,includeChanged:t.includeChanged,preview:t.preview,...t.sweepListing?{sweepListing:t.sweepListing}:{},refusals:t.refusals.map(({message:n})=>n),refusalCodes:t.refusals.map(({code:n})=>n),notes:t.notes,elapsedMs:t.elapsedMs},null,2)}
437
437
  `}function Yo(t,n,e,r){let o=s=>t.userNames[s]??s,i=["preview: what a removal would do; nothing was written"];for(let s of t.objects){let d=[s.toDelete>0?`${s.toDelete} to delete`:"",r&&s.changedSince>0?`${s.changedSince} of them changed since the run`:"",s.alreadyGone>0?`${s.alreadyGone} gone already`:"",s.notVisible>0?`${s.notVisible} not visible`:"",s.keptChanged>0?`${s.keptChanged} kept, changed since the run`:"",s.undeletable>0?`${s.undeletable} left, the user may not delete them`:"",s.unread>0?`${s.unread} left, not read`:""].filter(Boolean);i.push(` ${s.objectApiName}: ${d.join(", ")||"nothing"} of ${s.planned}${tr(s)}`);let u=Object.entries(s.changedBy).sort((f,c)=>c[1]-f[1]);u.length>0&&i.push(` last changed by: ${u.map(([f,c])=>`${o(f)} ${c}`).join(" \xB7 ")}`);for(let f of s.reasons)i.push(` ${f}`)}for(let s of n)i.push(X(s,"a removal"));return[...i,...e]}async function ea(t,n,e,r,o){let i=Be(e),s=[],d,u=n.runs!==void 0?(e.jobs??[]).length:0;u>0&&s.push(`the run's file names ${u} Bulk API job(s) no line of it answers: a removal reads back what they created first and removes it with the rest; this preview counts only what the file holds`);let f=(k,I)=>{if(s.push(Xo),t.json){process.stdout.write(Qo({summary:t.summaryPath,target:t.target,includeChanged:t.includeChanged,preview:k,refusals:I,notes:s,elapsedMs:G(o),...d?{sweepListing:d}:{}}));return}r("");for(let B of Yo(k,I,s,t.includeChanged))r(B);r(`
438
438
  done in ${G(o)}ms`)};if(r(`sandforge seed --remove ${t.summaryPath} --preview of ${t.target}`),i.length===0&&!t.sweep){s.push(n.earlier?.undo?`what the run created was removed already, on ${n.earlier.undo.removedAt}`:"The run created nothing: there is nothing of it to remove."),f({planned:0,objects:[],userNames:{}},[]);return}let c=await ye(t.target),p=le(c),g=await be(p);if(n.targetOrgId!==void 0&&n.targetOrgId.slice(0,15)!==g.id.slice(0,15)){let k={code:dt,message:`${t.target} is not the org the run wrote to (${n.targetOrgId}): its records are read in that org only. Nothing of the run was read.`};process.stderr.write(`${Le(k)}
439
- `),t.json&&process.stdout.write(ct({tool:"sandforge-seed",action:"remove-preview",summary:t.summaryPath,target:t.target,elapsedMs:G(o)},k)),process.exit(1)}let R=[],$=At(t.target,g,"sandforge seed");if($&&R.push({code:"PRODUCTION_TARGET",message:$}),t.sweep){d=await bt(qe(p,"sandforge seed --remove --preview --sweep"),await Ps(p,t.target,g.id,e,n),n.earlier?.removalSpans??[]),r("");for(let k of $e(d,t.target,t,!0))r(k)}let b=[...new Set(i.map(({objectApiName:k})=>k))],x=st({setToDraft:ut(b),delete:ft(b)},d?on(d,t):[]),C=await ve(p).read(t.target,x.delete??[]);r("");for(let k of gt(C,t.target,x))r(k);let z=wt(C,t.target,{steps:x,assign:mt(C,ot(C,x)),mayMute:!t.muteAutomation&&Ue("--mute-automation")});if(z&&!t.acceptAutomation&&R.push({code:"AUTOMATION_NOT_ACCEPTED",message:z}),i.length===0){s.push("nothing left of the run to remove"),f({planned:0,objects:[],userNames:{}},R);return}let S=new AbortController,m,A=De(k=>{m=k,S.abort()}),y;try{y=await vn({run:e,org:Re(p,"sandforge seed --remove --preview"),includeChanged:t.includeChanged,signal:S.signal})}finally{A()}let O=y.outcome.preview;O||(process.stderr.write(`interrupted: the preview stopped before it was through, and wrote nothing
439
+ `),t.json&&process.stdout.write(ct({tool:"sandforge-seed",action:"remove-preview",summary:t.summaryPath,target:t.target,elapsedMs:G(o)},k)),process.exit(1)}let R=[],$=At(t.target,g,"sandforge seed");if($&&R.push({code:"PRODUCTION_TARGET",message:$}),t.sweep){d=await bt(qe(p,"sandforge seed --remove --preview --sweep"),await Ps(p,t.target,g.id,e,n),n.earlier?.removalSpans??[]),r("");for(let k of $e(d,t.target,t,!0))r(k)}let b=[...new Set(i.map(({objectApiName:k})=>k))],x=st({setToDraft:ut(b),delete:ft(b)},d?an(d,t):[]),C=await ve(p).read(t.target,x.delete??[]);r("");for(let k of gt(C,t.target,x))r(k);let z=wt(C,t.target,{steps:x,assign:mt(C,ot(C,x)),mayMute:!t.muteAutomation&&Ue("--mute-automation")});if(z&&!t.acceptAutomation&&R.push({code:"AUTOMATION_NOT_ACCEPTED",message:z}),i.length===0){s.push("nothing left of the run to remove"),f({planned:0,objects:[],userNames:{}},R);return}let S=new AbortController,m,A=De(k=>{m=k,S.abort()}),y;try{y=await $n({run:e,org:Re(p,"sandforge seed --remove --preview"),includeChanged:t.includeChanged,signal:S.signal})}finally{A()}let O=y.outcome.preview;O||(process.stderr.write(`interrupted: the preview stopped before it was through, and wrote nothing
440
440
  `),process.exit(_e(m??"SIGINT")));let M=y.outcome.undeletable??[];if(M.length>0&&!t.leaveUndeletable){let k=M.map(I=>`${I.objectApiName} (${I.records} records)`).join(", ");R.push({code:Xn,message:`The user SandForge connects as may not delete the records of ${k} in ${t.target}: a removal stops before its first delete, unless given --leave-undeletable, which removes the rest and leaves those.`})}f({planned:y.planned,objects:O.objects,...M.length>0?{undeletable:M}:{},userNames:O.userNames},R)}process.argv[1]?.includes("sandforge-seed")&&(Yn(),Do().then(()=>process.exit(process.exitCode??0)).catch(t=>{process.stderr.write(`${t instanceof Error?t.message:String(t)}
441
441
  `),process.exit(1)}));export{to as a,Ft as b,fo as c,Ss as d,Ts as e,go as f,wo as g,bo as h,yo as i,Ro as j,$o as k,Ao as l,jo as m,ks as n,Oo as o,Io as p,To as q,Eo as r,xo as s,Co as t,Po as u,Es as v,vs as w,_o as x,Do as y,Mo as z,Bo as A,As as B,zo as C,Ko as D,Go as E,Ho as F,Xo as G,Qo as H,Yo as I};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-3OHPD72J.mjs";import"./chunk-3RYLICRX.mjs";import"./chunk-PUOX4NBJ.mjs";import"./chunk-EQF2IJS2.mjs";import"./chunk-RSYICMZG.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-TEOLMRDO.mjs";import"./chunk-NTDN2JQZ.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-B45CNPUX.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{b as AGENT_TEST_RUN_WAIT_MINUTES,a as AGENT_TEST_SPECS_DIR,e as agentTestApiName,f as agentTestCommands,d as agentTestSpecFileName,c as agentTestSpecYaml,g as nodeAgentTestSpecFiles,h as writeAgentTestSpec,i as writeScenarioTestSpec,j as yamlOf};
7
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-LKQ5RKIV.mjs";import"./chunk-XAMBCQPU.mjs";import"./chunk-IG2MTQRP.mjs";import"./chunk-WR4Q363I.mjs";import"./chunk-O2HDYYUV.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-E5AHXLS6.mjs";import"./chunk-PZPJKATS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-TTFDUKUS.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{b as AGENT_TEST_RUN_WAIT_MINUTES,a as AGENT_TEST_SPECS_DIR,e as agentTestApiName,f as agentTestCommands,d as agentTestSpecFileName,c as agentTestSpecYaml,g as nodeAgentTestSpecFiles,h as writeAgentTestSpec,i as writeScenarioTestSpec,j as yamlOf};
@@ -4,6 +4,6 @@ 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 B}from"./chunk-BOGNK4LV.mjs";import{Da as x,Ga as L,la as D,ma as P,na as O,sa as S,t as k,u as A,v as b,za as v}from"./chunk-VXHDBYMI.mjs";import{ca as w}from"./chunk-CGWXQX75.mjs";import{Nc as R,Oc as g,Vc as f,bd as p}from"./chunk-B45CNPUX.mjs";var C=["undelete","insert","update","delete"],M={SingleEmail:{one:"single email",more:"single emails"},DailyWorkflowEmails:{one:"workflow email",more:"workflow emails"}};function U(e,t){let n=M[t];return`${e} ${e===1?n.one:n.more}`}var I={rewind:{what:"This rewind",then:"rewind again"},undo:{what:"This undo",then:"undo the rewind again"}};function _(e){return e.toGiveBack.records+e.toBringBack.inBin+e.toBringBack.withParent}var N="Order";function T(e){return e.toDelete.createdSince+e.toDelete.broughtBackSince+e.toDelete.comesBackWithParent+(e.toBringBack.carriers??0)}function $(e){return e.objectApiName===N?T(e):0}function W(e){return e.deleted+e.withParentDeleted+e.nextPassDeleted}function F(e){return e.objectApiName===N?W(e):0}function G(e){return w[e.objectApiName]!==void 0?e.toRecreate??0:0}function j(e){return w[e.objectApiName]!==void 0?e.recreated:0}function K(e){return e.flatMap(t=>h(t.objectApiName,{undelete:t.toBringBack.inBin+t.toBringBack.withParent+t.toBringBack.deletedWhileTaken+(t.toBringBack.carriers??0),insert:t.toRecreate??0,update:_(t)+G(t)+$(t),delete:T(t)}))}function Z(e){return e.flatMap(t=>h(t.objectApiName,{undelete:t.broughtBack+t.backWithParent+(t.carriers??0),insert:t.recreated,update:t.givenBackFirst+t.givenBackAfter+t.givenBackNextPass+j(t)+F(t),delete:W(t)}))}function ee(e,t=[],n=[]){let i=a=>{let o=new Map;for(let{objectApiName:m,count:d}of a)o.set(m,(o.get(m)??0)+d);return o},c=i(t),s=i(n);return[...new Set([...e.map(a=>a.objectApiName),...c.keys(),...s.keys()])].flatMap(a=>{let o=e.find(m=>m.objectApiName===a);return h(a,{undelete:o?.deleted??0,insert:0,update:(o?.givenBack??0)+(s.get(a)??0),delete:(o?.broughtBack??0)+(c.get(a)??0)})})}function h(e,t){return C.filter(n=>t[n]>0).map(n=>({objectApiName:e,write:n,records:t[n]}))}function te(e,t){let n=new Set(e.filter(i=>i.records>0).map(i=>`${i.objectApiName}
7
+ import{c as B}from"./chunk-BOGNK4LV.mjs";import{Da as x,Ga as L,la as D,ma as P,na as O,sa as S,t as k,u as A,v as b,za as v}from"./chunk-VYXMVJL5.mjs";import{ca as w}from"./chunk-A527W53V.mjs";import{Qc as R,Rc as g,Yc as f,ed as p}from"./chunk-TTFDUKUS.mjs";var C=["undelete","insert","update","delete"],M={SingleEmail:{one:"single email",more:"single emails"},DailyWorkflowEmails:{one:"workflow email",more:"workflow emails"}};function U(e,t){let n=M[t];return`${e} ${e===1?n.one:n.more}`}var I={rewind:{what:"This rewind",then:"rewind again"},undo:{what:"This undo",then:"undo the rewind again"}};function _(e){return e.toGiveBack.records+e.toBringBack.inBin+e.toBringBack.withParent}var N="Order";function T(e){return e.toDelete.createdSince+e.toDelete.broughtBackSince+e.toDelete.comesBackWithParent+(e.toBringBack.carriers??0)}function $(e){return e.objectApiName===N?T(e):0}function W(e){return e.deleted+e.withParentDeleted+e.nextPassDeleted}function F(e){return e.objectApiName===N?W(e):0}function G(e){return w[e.objectApiName]!==void 0?e.toRecreate??0:0}function j(e){return w[e.objectApiName]!==void 0?e.recreated:0}function K(e){return e.flatMap(t=>h(t.objectApiName,{undelete:t.toBringBack.inBin+t.toBringBack.withParent+t.toBringBack.deletedWhileTaken+(t.toBringBack.carriers??0),insert:t.toRecreate??0,update:_(t)+G(t)+$(t),delete:T(t)}))}function Z(e){return e.flatMap(t=>h(t.objectApiName,{undelete:t.broughtBack+t.backWithParent+(t.carriers??0),insert:t.recreated,update:t.givenBackFirst+t.givenBackAfter+t.givenBackNextPass+j(t)+F(t),delete:W(t)}))}function ee(e,t=[],n=[]){let i=a=>{let o=new Map;for(let{objectApiName:m,count:d}of a)o.set(m,(o.get(m)??0)+d);return o},c=i(t),s=i(n);return[...new Set([...e.map(a=>a.objectApiName),...c.keys(),...s.keys()])].flatMap(a=>{let o=e.find(m=>m.objectApiName===a);return h(a,{undelete:o?.deleted??0,insert:0,update:(o?.givenBack??0)+(s.get(a)??0),delete:(o?.broughtBack??0)+(c.get(a)??0)})})}function h(e,t){return C.filter(n=>t[n]>0).map(n=>({objectApiName:e,write:n,records:t[n]}))}function te(e,t){let n=new Set(e.filter(i=>i.records>0).map(i=>`${i.objectApiName}
8
8
  ${i.write}`));return S(t,(i,c)=>n.has(`${i}
9
9
  ${c}`),"the org's")}function ne(e,t){return t===void 0?"":`The emails it sends as the ${e} writes were not counted against its daily limits, as what sends them was not read (${t}). `}function y(e){return typeof e.unread=="string"}function ie(e,t,n){let i=!y(n)&&D(n),c=!y(n)&&P(n),s=new Map;for(let r of C){let a=R(t,r);if(a.length===0)continue;let o=O(a,i,c),m=new Set(a.filter(d=>d.limit==="DailyWorkflowEmails").map(d=>d.objectApiName));for(let{objectApiName:d,records:E}of e.filter(l=>l.write===r))for(let l of o.filter(u=>u.objectApiName===d)){let u=s.get(l.limit)??{limit:l.limit,emails:0,objects:[],verdict:"fits"};u.emails+=E*l.perRecord,u.objects.push({objectApiName:d,write:r,records:E,perRecord:l.perRecord,sentBy:[...l.sentBy]}),i&&l.limit==="SingleEmail"&&m.has(d)&&(u.alertsCounted=!0),s.set(l.limit,u)}}return[...s.values()].map(r=>{if(y(n))return{...r,verdict:"unread",unread:n.unread};let a=n[r.limit];return a?{...r,verdict:r.emails>a.remaining?"exceeds":"fits",remaining:a.remaining,max:a.max}:{...r,verdict:"unread",unread:`the org's limits list no ${r.limit}`}})}function re(e,t,n){let i=t.filter(r=>r.verdict==="exceeds");if(i.length===0)return;let c=i.map(r=>`about ${U(r.emails,r.limit)}`+(r.alertsCounted?" (its email alerts among them, as a Developer Edition counts them)":"")+`, ${r.remaining??0} of ${r.max??0} left today`).join("; "),s=I[e];return{code:"EMAILS",message:`${s.what} would make ${n} send ${c}: past them, each record whose flow fails in the save is refused (CANNOT_EXECUTE_FLOW_TRIGGER), and the org's own emails stop for the rest of the day. Turn off what sends them, or assign the user a bypass that keeps it quiet, then ${s.then}. No record was written.`}}function ae(e){let t=f(e.steps),n=g(p(e.automation,e.plan,t),{writes:t}),i=v(e.automation.unread);return{senders:n,...i!==void 0?{sendersUnread:i}:{}}}function q(e){let t=e.mayMute&&e.plan===void 0&&e.senders.length>0?A(e.automation,{writes:f(e.steps)}):[],n=x({senders:e.senders,...e.sendersUnread!==void 0?{sendersUnread:e.sendersUnread}:{},...e.reading!==void 0?{reading:e.reading}:{},accepted:e.accepted,target:e.orgName,run:e.act,muteQuiets:t,keepsAddresses:!0});return n.stop?{gate:n,refusal:{code:"EMAILS_DELIVERED",message:n.stop.message}}:{gate:n}}async function se(e){let t=f(e.steps),n=await k({running:p(e.automation,e.plan,t),writes:t,read:e.read});return{ofRun:n,...q({...e,senders:n.senders,...n.sendersUnread!==void 0?{sendersUnread:n.sendersUnread}:{},...n.read!==void 0?{reading:n.read.reading}:{}})}}function oe(e){let t=f(e.steps),n=g(p(e.automation,b(e.plan,e.held),t),{writes:t}),i=L({planned:e.planned,held:n,...e.reading!==void 0?{reading:e.reading}:{},accepted:e.accepted,target:e.orgName,run:e.act});return i?{code:"EMAILS_DELIVERED",message:i.message}:void 0}var Q=", or run it again once the lease can assign them",V="--mute-automation keeps quiet";function de(e,t,n){if(e.code!=="EMAILS_DELIVERED")return e;let i=t==="undo"?"Tick the box for these emails in the undo's confirmation to undo all the same":e.message.includes(Q)?"Untick Mute automation to be asked about them and rewind all the same":`Tick "Let ${n} send these emails" in the preview to rewind all the same`;return{...e,message:B(e.message,t,i).replace(V,"Mute automation keeps quiet")}}export{U as a,_ as b,$ as c,F as d,G as e,j as f,K as g,Z as h,ee as i,te as j,ne as k,ie as l,re as m,ae as n,q as o,se as p,oe as q,de as r};
@@ -4,5 +4,5 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{f as l,g as m,h as f,i as c,j as h}from"./chunk-FQGHL7GR.mjs";import{ma as d,oa as g}from"./chunk-B45CNPUX.mjs";var x=50,A="en_US",$=["Contact details must reach nobody:","- every email address uses example.com, example.net, example.org, or a domain ending in .example, .invalid or .test, such as jane.doe@acme.example;",`- every phone number takes one of these forms, X being any digit: ${Object.values(l).map(t=>t.phoneFormats[0]).join(", ")}.`],u=class{callAI;constructor(e){this.callAI=e}async generate(e,i,r){if(i<=0||e.length===0)return[];let o=[],n=i,s=new Set(e.filter(p=>p.fieldType?.toLowerCase()==="phone").map(p=>p.fieldApiName)),a=E();for(;n>0;){let p=Math.min(n,x),R=_(e,p,r),w=await this.callAI(R),y=O(w);o.push(...y.map(N=>I(N,s,a))),n-=p}return o.slice(0,i)}};function E(){let t=0;return e=>h(f(e)??A,t++)}function _(t,e,i){let r=t.map(n=>{let s=[`- ${n.fieldApiName} (${n.ruleType})`];return n.config.aiPrompt&&s.push(`: ${n.config.aiPrompt}`),(n.config.minValue!==void 0||n.config.maxValue!==void 0)&&s.push(` [range: ${n.config.minValue??""}..${n.config.maxValue??""}]`),(n.config.minLength!==void 0||n.config.maxLength!==void 0)&&s.push(` [length: ${n.config.minLength??""}..${n.config.maxLength??""}]`),s.join("")}),o=[];return i&&(o.push(`Persona: ${i}`),o.push("")),o.push(`Generate exactly ${e} JSON objects with these fields:`),o.push(...r),o.push(""),o.push(...$),o.push(""),o.push("Return ONLY a JSON array of objects. No markdown, no explanation."),o.join(`
7
+ import{f as l,g as m,h as f,i as c,j as h}from"./chunk-FQGHL7GR.mjs";import{oa as d,qa as g}from"./chunk-TTFDUKUS.mjs";var x=50,A="en_US",$=["Contact details must reach nobody:","- every email address uses example.com, example.net, example.org, or a domain ending in .example, .invalid or .test, such as jane.doe@acme.example;",`- every phone number takes one of these forms, X being any digit: ${Object.values(l).map(t=>t.phoneFormats[0]).join(", ")}.`],u=class{callAI;constructor(e){this.callAI=e}async generate(e,i,r){if(i<=0||e.length===0)return[];let o=[],n=i,s=new Set(e.filter(p=>p.fieldType?.toLowerCase()==="phone").map(p=>p.fieldApiName)),a=E();for(;n>0;){let p=Math.min(n,x),R=_(e,p,r),w=await this.callAI(R),y=O(w);o.push(...y.map(N=>I(N,s,a))),n-=p}return o.slice(0,i)}};function E(){let t=0;return e=>h(f(e)??A,t++)}function _(t,e,i){let r=t.map(n=>{let s=[`- ${n.fieldApiName} (${n.ruleType})`];return n.config.aiPrompt&&s.push(`: ${n.config.aiPrompt}`),(n.config.minValue!==void 0||n.config.maxValue!==void 0)&&s.push(` [range: ${n.config.minValue??""}..${n.config.maxValue??""}]`),(n.config.minLength!==void 0||n.config.maxLength!==void 0)&&s.push(` [length: ${n.config.minLength??""}..${n.config.maxLength??""}]`),s.join("")}),o=[];return i&&(o.push(`Persona: ${i}`),o.push("")),o.push(`Generate exactly ${e} JSON objects with these fields:`),o.push(...r),o.push(""),o.push(...$),o.push(""),o.push("Return ONLY a JSON array of objects. No markdown, no explanation."),o.join(`
8
8
  `)}function O(t){return d(g,t)}var P=new RegExp("(?<![\\p{L}\\p{N}._%+-])([\\p{L}\\p{N}._%+-]+)@((?:[\\p{L}\\p{N}](?:[\\p{L}\\p{N}-]{0,61}[\\p{L}\\p{N}])?\\.)+\\p{L}{2,63})(?![\\p{L}\\p{N}-])","gu"),S=/phone|mobile|fax|telef|^tel$/i,b=/^\+?[\d ()./-]+$/,D=/(?<![\w+.@-])(?<!\d )(?:(?:\+\d+|\(\d{1,4}\)|0\d*)(?:[ ./-]?\(\d+\)|[ ./-]\d+|(?<=\))\d+)*|\d{3}[ .-]\d{3}[ .-]\d{4}|(?<![€$£¥] ?)(?:[6-9]\d{2}(?<sep>[ .-])\d{3}\k<sep>\d{3}|[6-9]\d{2} \d{2} \d{2} \d{2}|[1-9]{2} (?:9 ?)?\d{4}-\d{4})(?![ ./,-]?\d| ?[€$£¥%]))(?![\w@])/g,F=/^\d{1,4}[./-]\d{1,2}[./-]\d{1,4}$/,L={least:8,most:15};function I(t,e,i){let r={};for(let[o,n]of Object.entries(t))r[o]=k(o,n,e,i);return r}function k(t,e,i,r){let o=i.has(t)||S.test(t.replace(/__p?c$/i,"")),n=typeof e=="number"?String(e):typeof e=="string"?e:void 0;return o&&n!==void 0&&/\d/.test(n)&&b.test(n.trim())?c(n)?e:r(n):typeof e!="string"?e:e.replace(P,(s,a,p)=>m(p)?s:`${a}@${T(p)}`).replace(D,s=>C(s)&&!c(s)?r(s):s)}function C(t){let e=t.replace(/\D/g,"").length;return e>=L.least&&e<=L.most&&!F.test(t)}function T(t){return`${t.split(".").slice(0,-1).join(".")}.example`}export{u as a,E as b,_ as c,O as d,I as e};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{a as P,b as $}from"./chunk-JEERQRLW.mjs";import{b as O,c as b,e as E,f as D}from"./chunk-HS4YRX4J.mjs";import{b as S}from"./chunk-CA5NAXSU.mjs";import{ac as R,y as f}from"./chunk-TTFDUKUS.mjs";var y=[{field:"PermissionsViewAllData",label:"View All Data"},{field:"PermissionsModifyAllData",label:"Modify All Data"}],I="PermissionsQueryAllFiles",T="PermissionsCustomizeApplication",d="No record was read or written.";function c(e,t){return{allowed:!1,refusal:{code:e,message:t}}}function w(e,t){return c("PRODUCTION",`${e} is a production org, or cannot be told from one: ${t}. Checkpoints are for sandboxes, scratch orgs and Developer Edition orgs: SandForge never takes a checkpoint of, or rewinds, a production org. ${d}`)}function N(e){return e.edition?`its Organization record says IsSandbox false, edition ${e.edition}`:"its Organization record says IsSandbox false, and no edition"}function j(e,t){return e.slice(0,15)===t.slice(0,15)}function V(e,t){return e.orgType==="Scratch"?"scratch":t.sandbox?"sandbox":"developer"}var z={take:"A checkpoint needs a user with View All Data and Modify All Data: a rewind to it must",preview:"A preview needs a user with View All Data and Modify All Data: a record the user cannot see would read as deleted since, and the rewind it shows must",rewind:"Rewind needs a user with View All Data and Modify All Data: it must",undo:"Undo needs a user with View All Data and Modify All Data: it must",import:"An import needs a user with View All Data and Modify All Data: SandForge never keeps on this machine records its user could not see in the org, and a rewind to it must"},F={take:"Leave the custom settings out of the checkpoint, or give the user Customize Application.",preview:"This checkpoint holds custom settings: give the user Customize Application.",rewind:"This checkpoint holds custom settings: give the user Customize Application.",undo:"This checkpoint holds custom settings: give the user Customize Application.",import:"This checkpoint holds custom settings: give the user Customize Application."};function x(e){return c("PERMISSIONS",`${e.username} needs Customize Application to keep and rewind custom settings, and doesn't have it: View All Custom Settings lets a user read them, never write them. ${F[e.act]} ${d}`)}async function _(e,t){let r=[...y.map(n=>n.field),...t?[T]:[]],i=async n=>(await e.query(`SELECT ${n.join(", ")} FROM UserPermissionAccess`)).records[0],o;try{o=await i([...r,I])}catch{try{o=await i(r)}catch(n){return{unread:n instanceof Error?n.message:String(n)}}}return{missing:y.filter(n=>o?.[n.field]!==!0).map(n=>n.label),viewAllData:o?.PermissionsViewAllData===!0,modifyAllData:o?.PermissionsModifyAllData===!0,queryAllFiles:o?.[I]===!0,customizeApplication:o?.[T]===!0}}var q=/^005[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,L=/^0PG[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,M="SobjectType, PermissionsViewAllRecords, PermissionsModifyAllRecords";async function A(e,t){let r=await e.query(t),i=1,o=[...r.records];for(;!r.done;){let n=r.nextRecordsUrl;if(n===void 0||e.queryMore===void 0)throw new Error(`the org answered ${o.length} rows of ${r.totalSize}, and no next page`);r=await e.queryMore(n),i++,o.push(...r.records)}return{rows:o,requests:i}}async function U(e,t){let r=0;try{let i=await t();if(r++,!q.test(i))throw new Error(`the org named the user ${JSON.stringify(i)}`);let o=await A(e,`SELECT ${M} FROM ObjectPermissions WHERE ParentId IN (SELECT PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId = '${i}' AND PermissionSetGroupId = null)`);r+=o.requests;let n=await A(e,`SELECT PermissionSetGroupId FROM PermissionSetAssignment WHERE AssigneeId = '${i}' AND PermissionSetGroupId != null`);r+=n.requests;let l=[...new Set(n.rows.map(a=>a.PermissionSetGroupId).filter(a=>typeof a=="string"&&L.test(a)))],s=[...o.rows];if(l.length>0){let a=await A(e,`SELECT ${M} FROM ObjectPermissions WHERE Parent.PermissionSetGroupId IN (${l.map(u=>`'${u}'`).join(", ")})`);r+=a.requests,s.push(...a.rows)}return{grants:P(s),requests:r}}catch(i){return{unread:S(i)}}}var v={take:"A checkpoint needs a user with View All Data and Modify All Data, or with View All and Modify All on each object it holds: a rewind to it must see and put back what everyone changed there.",preview:"A preview needs a user with View All Data and Modify All Data, or with View All and Modify All on each object it reads: a record the user cannot see would read as deleted since.",rewind:"Rewind needs a user with View All Data and Modify All Data, or with View All and Modify All on each object it puts back: it must see and put back what everyone changed there.",undo:"Undo needs a user with View All Data and Modify All Data, or with View All and Modify All on each object it takes back: it must see and put back what everyone changed there."};async function J(e,t,r={}){let{orgName:i,registered:o}=t;if(o===void 0)return w(i,"SandForge has no record of what kind of org it is");if(!R(o))return w(i,"SandForge has it registered as a production org");let n;try{n=await O(e)}catch(p){let C=E(p);if(C!==void 0)return c("ORG_UNTYPED",`${D(i,p,C)} SandForge takes a checkpoint of no org it cannot tell from a production one. ${d}`);let G=p instanceof Error?p.message:String(p);return w(i,`it did not say what org it is (${G})`)}if(b(n))return w(i,N(n));if(t.act!=="take"&&!j(n.id,t.organizationId))return c("OTHER_ORG",t.act==="import"?`${i} is another org than the one this file holds a checkpoint of: it is imported for the org it was taken of alone, under any alias of it. ${f} Nothing was imported.`:`${i} is another org than the one this checkpoint was taken of: its Organization Id has changed, as a sandbox's does when it is refreshed. This checkpoint is of the org before it, and can only be deleted. ${f} ${d}`);let l=t.customSettings===!0,s=await _(e,l),a=`${z[t.act]} see and put back what everyone changed.`;if("unread"in s)return c("PERMISSIONS",`${a} SandForge could not read whether ${t.username} has them (${s.unread}), and takes an org that will not say for a user who has neither. `+d);let u=s.missing.length===y.length?"them":s.missing.join(" and "),g=t.act,m=g==="import"?void 0:r.userId;if(s.missing.length>0&&m===void 0)return c("PERMISSIONS",`${a} ${t.username} doesn't have ${u}. ${d}`);if(l&&!s.customizeApplication)return x(t);let k={allowed:!0,org:n,tier:V(o,n),queryAllFiles:s.queryAllFiles};if(s.missing.length===0||m===void 0||g==="import")return{...k,grants:{kind:"org"}};let h=await U(e,m);return"unread"in h?c("PERMISSIONS",`${v[g]} ${t.username} doesn't have ${u}, and SandForge could not read which objects they have View All and Modify All on (${h.unread}). View Setup and Configuration lets a user read their own permissions; with View All Data and Modify All Data, nothing needs reading. `+d):$(h.grants)?{...k,grants:{kind:"perObject",viewAllData:s.viewAllData,modifyAllData:s.modifyAllData,objects:h.grants,requests:h.requests}}:c("PERMISSIONS",`${v[g]} ${t.username} doesn't have ${u}, nor View All and Modify All on any object. Give the user View All and Modify All on the objects to hold, or View All Data and Modify All Data. ${d}`)}export{U as a,J as 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{a,b,c,d}from"./chunk-IAZB4WIL.mjs";import"./chunk-OTWRDD6L.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-B45CNPUX.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{a as ARTICLE_VERSION_OBJECT,b as articleBodyFields,c as articleBodyOptions,d as seedKnowledge};
7
+ import{a,b,c,d}from"./chunk-M3ROUWDX.mjs";import"./chunk-GSKCGQIP.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-TTFDUKUS.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{a as ARTICLE_VERSION_OBJECT,b as articleBodyFields,c as articleBodyOptions,d as seedKnowledge};