sandforge 1.83.0 → 1.84.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 (254) hide show
  1. package/README.md +1 -1
  2. package/lib/chunk-23SEDORH.mjs +11 -0
  3. package/lib/{chunk-I5C4O3VA.mjs → chunk-24RFOFYT.mjs} +1 -1
  4. package/lib/chunk-26POJDIT.mjs +7 -0
  5. package/lib/{chunk-WJAZ5LHL.mjs → chunk-2AZQHBEF.mjs} +1 -1
  6. package/lib/{chunk-IHGYJZZ2.mjs → chunk-2HVOZUM4.mjs} +1 -1
  7. package/lib/{chunk-3V4YH5KO.mjs → chunk-2JDAOWUW.mjs} +1 -1
  8. package/lib/{chunk-BNKT3R3F.mjs → chunk-2METQHGG.mjs} +1 -1
  9. package/lib/chunk-2WFIVO4F.mjs +13 -0
  10. package/lib/chunk-2YHZBUZE.mjs +7 -0
  11. package/lib/{chunk-7DPHZWA4.mjs → chunk-326AJTIU.mjs} +14 -14
  12. package/lib/{chunk-UIR77ZJD.mjs → chunk-36JOHEJL.mjs} +1 -1
  13. package/lib/chunk-3PVRGTVK.mjs +7 -0
  14. package/lib/{chunk-2WMKJVD2.mjs → chunk-3Q353S2R.mjs} +1 -1
  15. package/lib/chunk-3TZSBHEY.mjs +7 -0
  16. package/lib/{chunk-T36DZJPH.mjs → chunk-43TOMFV4.mjs} +1 -1
  17. package/lib/{chunk-XAMMIPZ4.mjs → chunk-4CVUUVGJ.mjs} +1 -1
  18. package/lib/{chunk-6YC2ELCU.mjs → chunk-4EOHEDFP.mjs} +1 -1
  19. package/lib/{chunk-ZB5E7NHU.mjs → chunk-4JE4BYXK.mjs} +1 -1
  20. package/lib/{chunk-JREKJO3D.mjs → chunk-54WZUS7J.mjs} +1 -1
  21. package/lib/{chunk-CGZGL6VT.mjs → chunk-5CRLRHOJ.mjs} +1 -1
  22. package/lib/{chunk-UOHZW2L4.mjs → chunk-5IZTFMJM.mjs} +1 -1
  23. package/lib/{chunk-6VOQFISN.mjs → chunk-5M5FQ7RP.mjs} +1 -1
  24. package/lib/{chunk-U4YFYSF3.mjs → chunk-5SMWFNE7.mjs} +1 -1
  25. package/lib/{chunk-HQZUQXDC.mjs → chunk-5XTUSN72.mjs} +1 -1
  26. package/lib/chunk-6I6TWNV5.mjs +7 -0
  27. package/lib/{chunk-QLRWU3MB.mjs → chunk-6JWWSDM6.mjs} +1 -1
  28. package/lib/chunk-6O222PW6.mjs +7 -0
  29. package/lib/{chunk-J3TIHLWG.mjs → chunk-6PD6K7LP.mjs} +1 -1
  30. package/lib/{chunk-ISAUCWYK.mjs → chunk-6QE6R6RL.mjs} +1 -1
  31. package/lib/{chunk-2KTGDYUH.mjs → chunk-6WX5ZU7Q.mjs} +1 -1
  32. package/lib/{chunk-XAUQXYPW.mjs → chunk-6YL7BNYD.mjs} +1 -1
  33. package/lib/chunk-6ZLKIT3H.mjs +7 -0
  34. package/lib/{chunk-XKFHTBAB.mjs → chunk-7QYHEHMA.mjs} +1 -1
  35. package/lib/chunk-7SQSWVAU.mjs +9 -0
  36. package/lib/{chunk-NNV7IGM7.mjs → chunk-7UVKIWKV.mjs} +1 -1
  37. package/lib/{chunk-RZKJQOOC.mjs → chunk-7WATA4SB.mjs} +1 -1
  38. package/lib/{chunk-DMT5SCO3.mjs → chunk-7YNM6KFZ.mjs} +1 -1
  39. package/lib/{chunk-TMIESDE5.mjs → chunk-A3MYSOOC.mjs} +1 -1
  40. package/lib/chunk-AL4C3GFT.mjs +7 -0
  41. package/lib/chunk-B3FBHVNN.mjs +21 -0
  42. package/lib/{chunk-CDWZGQAJ.mjs → chunk-B63POIPQ.mjs} +1 -1
  43. package/lib/{chunk-YEVB7LVK.mjs → chunk-BAWCOKRW.mjs} +1 -1
  44. package/lib/{chunk-FVLFO2S6.mjs → chunk-BBRWFKS5.mjs} +1 -1
  45. package/lib/chunk-BEA27DLS.mjs +7 -0
  46. package/lib/chunk-BRY3PLIZ.mjs +7 -0
  47. package/lib/chunk-CBH3TOWK.mjs +341 -0
  48. package/lib/{chunk-7V2UYZ6S.mjs → chunk-CPQIZGG5.mjs} +1 -1
  49. package/lib/chunk-CVHNXJH3.mjs +7 -0
  50. package/lib/{chunk-ZOSESZ22.mjs → chunk-D4GF4FAB.mjs} +1 -1
  51. package/lib/chunk-DGDRQRCW.mjs +7 -0
  52. package/lib/{chunk-2N73W63D.mjs → chunk-DPMRIMUC.mjs} +1 -1
  53. package/lib/chunk-DUN2EPRC.mjs +7 -0
  54. package/lib/chunk-E3A3LOCY.mjs +7 -0
  55. package/lib/{chunk-KWAVSZ2B.mjs → chunk-EAC5QCE3.mjs} +1 -1
  56. package/lib/{chunk-JUOQUG7U.mjs → chunk-EC72TIEG.mjs} +1 -1
  57. package/lib/chunk-EPFCERGL.mjs +7 -0
  58. package/lib/{chunk-6KOUYHEY.mjs → chunk-ETDCBLGU.mjs} +1 -1
  59. package/lib/{chunk-2R6GFNKF.mjs → chunk-F3AQW6IU.mjs} +1 -1
  60. package/lib/{chunk-AHUGG3WU.mjs → chunk-FITPY3L4.mjs} +1 -1
  61. package/lib/chunk-FNJ4SGWO.mjs +7 -0
  62. package/lib/{chunk-EOQON3E5.mjs → chunk-FP7CYB2F.mjs} +1 -1
  63. package/lib/{chunk-262TP6UU.mjs → chunk-GKY2JMHY.mjs} +1 -1
  64. package/lib/{chunk-JBWJ6UEZ.mjs → chunk-GMIGWR6U.mjs} +1 -1
  65. package/lib/{chunk-OS5GE52G.mjs → chunk-GNRSF65U.mjs} +1 -1
  66. package/lib/chunk-GOOVPVWX.mjs +7 -0
  67. package/lib/{chunk-DB5RVDC5.mjs → chunk-GWZRR3MM.mjs} +1 -1
  68. package/lib/{chunk-SX6QWYCQ.mjs → chunk-H2BHESDA.mjs} +2 -2
  69. package/lib/chunk-H4CGM6YO.mjs +7 -0
  70. package/lib/{chunk-NFEBX75O.mjs → chunk-HCGXK7G7.mjs} +1 -1
  71. package/lib/{chunk-4X5D3MSV.mjs → chunk-HIDW7FNV.mjs} +1 -1
  72. package/lib/chunk-HSBXRQTI.mjs +7 -0
  73. package/lib/chunk-HUZPBE47.mjs +7 -0
  74. package/lib/{chunk-F5SBGJWW.mjs → chunk-HV7VPEXP.mjs} +1 -1
  75. package/lib/chunk-I6E6T6YY.mjs +7 -0
  76. package/lib/chunk-IUM4NFKI.mjs +10 -0
  77. package/lib/chunk-IVFVNNGB.mjs +37 -0
  78. package/lib/{chunk-L4MSL4U7.mjs → chunk-IZGCEOYO.mjs} +1 -1
  79. package/lib/{chunk-E3RQ575Y.mjs → chunk-J3DND3BC.mjs} +1 -1
  80. package/lib/{chunk-MJD6CPZZ.mjs → chunk-JAEDM4SI.mjs} +1 -1
  81. package/lib/chunk-JCFBFF4Y.mjs +7 -0
  82. package/lib/{chunk-U2CTKIPE.mjs → chunk-JE6SCT6R.mjs} +1 -1
  83. package/lib/{chunk-XJICAOAQ.mjs → chunk-JGZPD4IM.mjs} +1 -1
  84. package/lib/{chunk-XCJUNX63.mjs → chunk-JKJ74BX5.mjs} +1 -1
  85. package/lib/{chunk-WAYQLQAD.mjs → chunk-JLSIWO4Z.mjs} +1 -1
  86. package/lib/{chunk-D7XUNWWU.mjs → chunk-JSAJS3MY.mjs} +1 -1
  87. package/lib/chunk-JTJK2D36.mjs +7 -0
  88. package/lib/{chunk-OTJH6AEA.mjs → chunk-KAZS5Z6W.mjs} +1 -1
  89. package/lib/chunk-KB4ZHM4Q.mjs +10 -0
  90. package/lib/{chunk-N2HYG3BL.mjs → chunk-KGU4SVIT.mjs} +1 -1
  91. package/lib/{chunk-FKCIGJOI.mjs → chunk-KJWFYBMU.mjs} +2 -2
  92. package/lib/{chunk-KXUOHACP.mjs → chunk-KZTZDC7H.mjs} +1 -1
  93. package/lib/{chunk-S4PRKKGC.mjs → chunk-L2E5WBGD.mjs} +1 -1
  94. package/lib/{chunk-X2XZQ434.mjs → chunk-L53JWJ3S.mjs} +1 -1
  95. package/lib/{chunk-CQAFVEKP.mjs → chunk-LA4KIATH.mjs} +6 -6
  96. package/lib/chunk-LC3NDW4N.mjs +7 -0
  97. package/lib/{chunk-4V3QO7HF.mjs → chunk-LKTNQEBS.mjs} +1 -1
  98. package/lib/chunk-M2ABR4JM.mjs +7 -0
  99. package/lib/{chunk-3CM7LAPE.mjs → chunk-M4BLK6HJ.mjs} +1 -1
  100. package/lib/{chunk-Z3MGN42K.mjs → chunk-M6K34KGF.mjs} +1 -1
  101. package/lib/{chunk-TUPZY2QJ.mjs → chunk-MDMPJEV3.mjs} +1 -1
  102. package/lib/{chunk-BVZ5H3N4.mjs → chunk-MJZU3U5O.mjs} +68 -63
  103. package/lib/{chunk-OUU47Y7A.mjs → chunk-MSIEU5MR.mjs} +1 -1
  104. package/lib/{chunk-QQDZQCO2.mjs → chunk-N4WPCWJO.mjs} +1 -1
  105. package/lib/{chunk-MTM4KG3T.mjs → chunk-NCZKWSC7.mjs} +1 -1
  106. package/lib/{chunk-Y7YUNRKK.mjs → chunk-NED4MBIM.mjs} +1 -1
  107. package/lib/{chunk-QKJXIY6L.mjs → chunk-NOBQTEQD.mjs} +1 -1
  108. package/lib/{chunk-WBELLGNE.mjs → chunk-NSQWI7ZY.mjs} +1 -1
  109. package/lib/{chunk-BPHTA6KP.mjs → chunk-O677VOGO.mjs} +1 -1
  110. package/lib/chunk-OFTT7J2M.mjs +7 -0
  111. package/lib/{chunk-JH4ZTVQN.mjs → chunk-OLCVHL7I.mjs} +1 -1
  112. package/lib/chunk-OM5NORJG.mjs +7 -0
  113. package/lib/{chunk-QP3JLFIO.mjs → chunk-OMNMLKDT.mjs} +1 -1
  114. package/lib/{chunk-WABXKL4N.mjs → chunk-OPMO6I45.mjs} +1 -1
  115. package/lib/{chunk-7ZBDACVG.mjs → chunk-OUZQPYT3.mjs} +1 -1
  116. package/lib/chunk-OVNMB6Q2.mjs +7 -0
  117. package/lib/{chunk-DKDKCGXV.mjs → chunk-PAXNWTYK.mjs} +1 -1
  118. package/lib/{chunk-GLN4PI5P.mjs → chunk-PBY2O6OF.mjs} +1 -1
  119. package/lib/chunk-PEDQPM2P.mjs +926 -0
  120. package/lib/chunk-PH7SP4YK.mjs +21 -0
  121. package/lib/{chunk-BT43WSOS.mjs → chunk-PMN4PAC3.mjs} +1 -1
  122. package/lib/chunk-PMWAFDUB.mjs +48 -0
  123. package/lib/chunk-PPLVFX6N.mjs +7 -0
  124. package/lib/{chunk-L3I6DAHX.mjs → chunk-PR3XCSPO.mjs} +1 -1
  125. package/lib/{chunk-WZN36ACK.mjs → chunk-PR42EZSR.mjs} +1 -1
  126. package/lib/{chunk-NDFFIJL5.mjs → chunk-PWRJRL5U.mjs} +1 -1
  127. package/lib/{chunk-NS6ONPWL.mjs → chunk-Q7GIJBCD.mjs} +1 -1
  128. package/lib/chunk-Q7TLC3I2.mjs +7 -0
  129. package/lib/{chunk-ALBY5SOH.mjs → chunk-QAFPQ3YB.mjs} +1 -1
  130. package/lib/{chunk-KKS2KFBT.mjs → chunk-QKEKG2LD.mjs} +1 -1
  131. package/lib/{chunk-OOIDCHBQ.mjs → chunk-QO53K5W2.mjs} +2 -2
  132. package/lib/{chunk-HVX2AFYW.mjs → chunk-QTG6LUZT.mjs} +1 -1
  133. package/lib/{chunk-K7G3W7XH.mjs → chunk-RE7RYF3B.mjs} +1 -1
  134. package/lib/{chunk-JIPT5FUD.mjs → chunk-RGBGUCJA.mjs} +1 -1
  135. package/lib/{chunk-GT5ZKU6V.mjs → chunk-RGUQOSBU.mjs} +1 -1
  136. package/lib/{chunk-VXZ5PTOM.mjs → chunk-RHNTHGNU.mjs} +1 -1
  137. package/lib/chunk-RKTFFCNS.mjs +7 -0
  138. package/lib/chunk-RMFU4BAL.mjs +28 -0
  139. package/lib/{chunk-DNQKVCUV.mjs → chunk-ROV3QXEF.mjs} +11 -11
  140. package/lib/chunk-RT47RKLY.mjs +7 -0
  141. package/lib/{chunk-ISOSTAJR.mjs → chunk-S42RBRH2.mjs} +1 -1
  142. package/lib/{chunk-27BBEGUD.mjs → chunk-SI267LYR.mjs} +1 -1
  143. package/lib/chunk-T3G6VZNS.mjs +7 -0
  144. package/lib/chunk-TNT27RBG.mjs +7 -0
  145. package/lib/chunk-UBIKR5VO.mjs +7 -0
  146. package/lib/chunk-UI3JQVRU.mjs +8 -0
  147. package/lib/{chunk-RVCPQVKM.mjs → chunk-UIOMAX56.mjs} +1 -1
  148. package/lib/chunk-UX3BVH2Y.mjs +7 -0
  149. package/lib/{chunk-L4RJX7DG.mjs → chunk-VCUXCK36.mjs} +1 -1
  150. package/lib/chunk-VINGECAJ.mjs +10 -0
  151. package/lib/chunk-VOXJHJIE.mjs +7 -0
  152. package/lib/chunk-W6PN6TJG.mjs +7 -0
  153. package/lib/{chunk-D6JT4PAB.mjs → chunk-WAPSSYMT.mjs} +1 -1
  154. package/lib/{chunk-7BQMBXKX.mjs → chunk-WUUKFE2U.mjs} +1 -1
  155. package/lib/chunk-WWTCWWZI.mjs +7 -0
  156. package/lib/chunk-WXDLQT2O.mjs +10 -0
  157. package/lib/{chunk-TCEXCHXR.mjs → chunk-WY5V5PR3.mjs} +1 -1
  158. package/lib/chunk-X4BXESMQ.mjs +7 -0
  159. package/lib/chunk-XBQGZGWR.mjs +7 -0
  160. package/lib/{chunk-AXFD2OH6.mjs → chunk-XGGOUNPP.mjs} +1 -1
  161. package/lib/chunk-XKWW3GKF.mjs +7 -0
  162. package/lib/{chunk-PDRXM5WN.mjs → chunk-Y2DRK37K.mjs} +1 -1
  163. package/lib/{chunk-ZXOUWHYE.mjs → chunk-YA6ATMTB.mjs} +1 -1
  164. package/lib/{chunk-54HYHHVL.mjs → chunk-YDXMTWAT.mjs} +1 -1
  165. package/lib/chunk-YHR4WQPR.mjs +7 -0
  166. package/lib/{chunk-LWES2KZE.mjs → chunk-YTLUYSMF.mjs} +1 -1
  167. package/lib/{chunk-2K5BYZQM.mjs → chunk-YWEQQL3C.mjs} +1 -1
  168. package/lib/{chunk-C6RKM4BB.mjs → chunk-Z4LKKOFY.mjs} +1 -1
  169. package/lib/chunk-ZBAWJUG2.mjs +7 -0
  170. package/lib/{chunk-446GBKAC.mjs → chunk-ZJW6YOMV.mjs} +1 -1
  171. package/lib/chunk-ZQQXSCVI.mjs +7 -0
  172. package/lib/{chunk-L6CLN664.mjs → chunk-ZQWIVYVM.mjs} +1 -1
  173. package/lib/{chunk-CXKZ6TYV.mjs → chunk-ZV7ZFQQC.mjs} +1 -1
  174. package/lib/sandforge-autopilot.mjs +25 -25
  175. package/lib/sandforge-backup.mjs +1 -1
  176. package/lib/sandforge-checkpoint.mjs +1 -1
  177. package/lib/sandforge-cleanup.mjs +1 -1
  178. package/lib/sandforge-clone.mjs +1 -1
  179. package/lib/sandforge-compare.mjs +52 -21
  180. package/lib/sandforge-dataops.mjs +1 -1
  181. package/lib/sandforge-empty.mjs +1 -1
  182. package/lib/sandforge-env.mjs +95 -95
  183. package/lib/sandforge-frozen.mjs +1 -1
  184. package/lib/sandforge-mcp.mjs +12 -12
  185. package/lib/sandforge-monitor.mjs +1 -1
  186. package/lib/sandforge-pipeline.mjs +1 -1
  187. package/lib/sandforge-seed.mjs +1 -1
  188. package/lib/sandforge-sync.mjs +1 -1
  189. package/lib/sandforge-users.mjs +1 -1
  190. package/lib/sandforge.mjs +1 -1
  191. package/lib/sf/sandforge/compare.mjs +2 -2
  192. package/lib/sfPlugin.mjs +1 -1
  193. package/oclif.manifest.json +1 -1
  194. package/package.json +1 -1
  195. package/lib/chunk-2ADSD5WK.mjs +0 -7
  196. package/lib/chunk-2GSMHGIV.mjs +0 -7
  197. package/lib/chunk-36Y225OM.mjs +0 -7
  198. package/lib/chunk-3OVTKRS4.mjs +0 -7
  199. package/lib/chunk-4GCYGQXD.mjs +0 -7
  200. package/lib/chunk-4JKR4PTZ.mjs +0 -8
  201. package/lib/chunk-5OGNK3JP.mjs +0 -37
  202. package/lib/chunk-6QSHWIZI.mjs +0 -48
  203. package/lib/chunk-77IVKH7R.mjs +0 -7
  204. package/lib/chunk-77MZRBWX.mjs +0 -7
  205. package/lib/chunk-7WSQ65WG.mjs +0 -9
  206. package/lib/chunk-A32ISQ6M.mjs +0 -28
  207. package/lib/chunk-AG24QMSY.mjs +0 -7
  208. package/lib/chunk-BH76USTQ.mjs +0 -11
  209. package/lib/chunk-BZ24IAP5.mjs +0 -7
  210. package/lib/chunk-CN5HGFG4.mjs +0 -7
  211. package/lib/chunk-CTPLYUXA.mjs +0 -7
  212. package/lib/chunk-DIGUC7S4.mjs +0 -341
  213. package/lib/chunk-DSR2MSBH.mjs +0 -7
  214. package/lib/chunk-ETNQHIDI.mjs +0 -9
  215. package/lib/chunk-FBXH4VRQ.mjs +0 -7
  216. package/lib/chunk-FYWNSMOZ.mjs +0 -10
  217. package/lib/chunk-GEEWPTV5.mjs +0 -7
  218. package/lib/chunk-GTRU5AV5.mjs +0 -7
  219. package/lib/chunk-I3ZO76LL.mjs +0 -21
  220. package/lib/chunk-ISA2NYJV.mjs +0 -7
  221. package/lib/chunk-IXIY6Q4M.mjs +0 -7
  222. package/lib/chunk-JAV6F6OA.mjs +0 -7
  223. package/lib/chunk-JYUMD357.mjs +0 -7
  224. package/lib/chunk-L47JCNP3.mjs +0 -7
  225. package/lib/chunk-LI2XNV7F.mjs +0 -7
  226. package/lib/chunk-LP2D3JJP.mjs +0 -7
  227. package/lib/chunk-LYOGCIYD.mjs +0 -925
  228. package/lib/chunk-N5UIE4IR.mjs +0 -7
  229. package/lib/chunk-O7GCCRPW.mjs +0 -7
  230. package/lib/chunk-OO24ZYYJ.mjs +0 -7
  231. package/lib/chunk-OS6HFJ7L.mjs +0 -7
  232. package/lib/chunk-P6WRYJN3.mjs +0 -7
  233. package/lib/chunk-PGRY365W.mjs +0 -7
  234. package/lib/chunk-PPGDAUEQ.mjs +0 -7
  235. package/lib/chunk-Q4PPI3KG.mjs +0 -7
  236. package/lib/chunk-QFTF2PGS.mjs +0 -21
  237. package/lib/chunk-QO4MPHZD.mjs +0 -7
  238. package/lib/chunk-QXB6U3ZP.mjs +0 -7
  239. package/lib/chunk-R3OM3X4L.mjs +0 -8
  240. package/lib/chunk-R7GKMAT4.mjs +0 -7
  241. package/lib/chunk-SCKUIE3R.mjs +0 -7
  242. package/lib/chunk-SU65Z2BA.mjs +0 -7
  243. package/lib/chunk-T7DDS4UQ.mjs +0 -7
  244. package/lib/chunk-TQJ5NPRC.mjs +0 -7
  245. package/lib/chunk-VZLJZEV2.mjs +0 -7
  246. package/lib/chunk-W3BQGMTR.mjs +0 -7
  247. package/lib/chunk-WXU6ZJIV.mjs +0 -7
  248. package/lib/chunk-X4HZD5U2.mjs +0 -7
  249. package/lib/chunk-X6XNTOGO.mjs +0 -7
  250. package/lib/chunk-XMQ5R6TC.mjs +0 -10
  251. package/lib/chunk-XPXEQKLR.mjs +0 -7
  252. package/lib/chunk-YBZIDW6W.mjs +0 -7
  253. package/lib/chunk-ZCOSME6P.mjs +0 -7
  254. package/lib/chunk-ZTHC42X6.mjs +0 -7
@@ -1,7 +0,0 @@
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{$ as m,Aa as N,Ba as O,Ca as P,Da as Q,Ea as R,P as a,Q as b,R as c,S as d,T as e,U as f,V as g,W as h,X as i,Y as j,Z as k,_ as l,aa as n,ba as o,ca as p,da as q,ea as r,fa as s,ga as t,ha as u,ia as v,ja as w,ka as x,la as y,ma as z,na as A,oa as B,pa as C,qa as D,ra as E,sa as F,ta as G,ua as H,va as I,wa as J,xa as K,ya as L,za as M}from"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{m as ASSIGNMENT_RULES_SOQL,h as AUTOMATION_READ_MOST,b as CONDITIONS_BOUND,f as CONDITION_REQUESTS_BOUND,c as DEFINITIONS_BOUND,g as DEFINITION_REQUESTS_BOUND,n as DUPLICATE_RULES_SOQL,i as FLOWS_SOQL,k as PROCESSES_SOQL,d as TOOLING_QUERIES_PER_REQUEST,e as TOOLING_RETRIEVES_PER_REQUEST,j as TRIGGERS_SOQL,N as TargetAutomationReader,o as USER_PERMISSIONS_SOQL,l as WORKFLOW_RULES_SOQL,a as answerOf,R as automationLines,p as conditionSoql,z as customObjectIdsSoql,Q as customPermissionsByIdSoql,A as customPermissionsSoql,G as decisionChecks,F as fieldsRequiredFilled,L as inFlight,H as messagesOf,M as objectsTheRunWrites,I as pathsOf,J as permissionKey,C as permissionSetSizesSoql,B as permissionSetsHoldingSoql,D as permissionsNamed,y as processObjectsSoql,O as readBypassGrants,w as readInComposites,x as ruleDefinitionSoql,P as setCustomPermissionsSoql,E as switchesNamed,v as targetAutomationQueries,s as toolingAnswersOf,q as toolingCompositeBody,t as toolingRecordsOf,r as toolingRetrieveBody,u as toolingRetrievesOver,K as unreadPartOf};
@@ -1,7 +0,0 @@
1
- import { createRequire as __sandforgeRequire } from 'node:module';
2
- import { fileURLToPath as __sandforgePath } from 'node:url';
3
- import { dirname as __sandforgeDirname } from 'node:path';
4
- const require = __sandforgeRequire(import.meta.url);
5
- const __filename = __sandforgePath(import.meta.url);
6
- const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-27BBEGUD.mjs";import"./chunk-OTJH6AEA.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as SCENARIO_SIDECAR_SUFFIX,f as compiledForSidecar,g as nodeScenarioSidecarFiles,j as readScenarioRunSidecar,c as scenarioPackFingerprint,d as scenarioRunSidecar,b as scenarioRunSidecarSchema,h as scenarioSidecarPath,e as withAgentChoice,i as writeScenarioRunSidecar};
@@ -1,8 +0,0 @@
1
- import { createRequire as __sandforgeRequire } from 'node:module';
2
- import { fileURLToPath as __sandforgePath } from 'node:url';
3
- import { dirname as __sandforgeDirname } from 'node:path';
4
- const require = __sandforgeRequire(import.meta.url);
5
- const __filename = __sandforgePath(import.meta.url);
6
- const __dirname = __sandforgeDirname(__filename);
7
- import{f as fn}from"./chunk-77IVKH7R.mjs";import{p as ot,q as $n}from"./chunk-2WMKJVD2.mjs";import{d as An,h as Tn,m as On}from"./chunk-VXZ5PTOM.mjs";import{b as un}from"./chunk-SU65Z2BA.mjs";import{a as kn,b as Fn}from"./chunk-HF6LAK3G.mjs";import{j as hn,k as yn,l as wn,m as bn,n as Rn}from"./chunk-ZOSESZ22.mjs";import{a as Sn,b as En}from"./chunk-TQ2TQHTT.mjs";import{d as rt}from"./chunk-HFSBDM7B.mjs";import{c as pn,g as Ae,h as nt,j as mn}from"./chunk-OHEOJISY.mjs";import{a as gn}from"./chunk-EADHKH3A.mjs";import{E as te,_ as ln,b as ee,da as cn,q as Se,r as Ee,t as tt}from"./chunk-2GSMHGIV.mjs";import{h as et}from"./chunk-TZE3Y7IQ.mjs";import{b as N}from"./chunk-CA5NAXSU.mjs";import{$ as Vt,$d as Re,Cc as Zt,Ec as en,Fc as tn,Kd as he,Ld as on,Md as ye,Nc as nn,Nd as sn,Oc as rn,Od as Je,P as Gt,Pd as an,Sd as dn,Td as Ze,Vd as we,X as qt,Z as Ut,_ as pe,_d as be,aa as zt,ba as Qt,ca as Ht,da as Kt,fa as me,ga as Xt,ha as Yt,ia as Jt,m as Wt}from"./chunk-6QSHWIZI.mjs";import{b as H,e as M,i as fe,k as ge,l as P,s as Ye}from"./chunk-WZQEK4WT.mjs";var ho=/^[A-Za-z][A-Za-z0-9_]{0,79}$/;function Pn(e,t){return typeof e=="object"&&e!==null?e[t]:void 0}function Bn(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t):[]}function vn(e){return typeof e=="string"&&ho.test(e)?e:void 0}function Nn(e){let t=new Map;for(let r of Bn(Pn(e,"variables"))){let o=r.name,i=vn(r.objectType);typeof o=="string"&&i&&t.set(o.toLowerCase(),i)}let n=[];for(let r of Bn(Pn(e,"recordCreates"))){let o=r.inputReference,i=vn(r.object)??(typeof o=="string"?t.get(o.toLowerCase()):void 0);i&&!n.some(s=>s.toLowerCase()===i.toLowerCase())&&n.push(i)}return n}var Mn={AccountPartner:["Role"],CampaignMember:["Status"],Case:["Status"],Contract:["Status"],Lead:["Status"],Opportunity:["StageName"],OpportunityPartner:["Role"],Order:["Status"],Partner:["Role"],ServiceAppointment:["Status"],Solution:["Status"],Task:["Priority","Status"],WorkOrder:["Status"],WorkOrderLineItem:["Status"]};function Wa(e,t){let n=new Map,r=t!==void 0&&Object.prototype.hasOwnProperty.call(Mn,t)?Mn[t]:[];for(let o of e){let i=o.type==="multipicklist";if(o.type!=="picklist"&&!i&&!o.picklistValues?.length)continue;let s=(o.type==="combobox"||o.restrictedPicklist===!1)&&!r.includes(o.name);n.set(o.name,{multi:i,restricted:o.restrictedPicklist===!0,required:o.nillable===!1&&o.defaultedOnCreate!==!0,...o.controllerName?{controllerName:o.controllerName}:{},...s?{anyValue:s}:{}})}return n}var yo=new Set;function wo(e,t){let n=new Set(e),r=[],o=new Set,i=(s,a)=>{if(o.has(s))return;let d=t.get(s)?.controllerName;d&&n.has(d)&&a<e.length&&i(d,a+1),!o.has(s)&&(o.add(s),r.push(s))};for(let s of e)i(s,0);return r}function bo(e){return typeof e=="boolean"?String(e):typeof e=="string"&&e!==""?e:void 0}function Ro(e,t){let n=new Map;for(let r of e){let o=t(r),i=n.get(o)??[];i.includes(r)||i.push(r),n.set(o,i)}return[...n]}function So(e,t,n,r,o,i,s){let a=new Set(o.values),d=a,l,u=r.controllerName?bo(e[r.controllerName]):void 0,f=u===void 0?void 0:o.allowedByControllingValue?.get(u);f&&(d=new Set(o.values.filter(R=>f.has(R))),l=r.controllerName);let g=n.filter(R=>!d.has(R));if(g.length===0)return[];let p=R=>s&&!s.has(R)?"not-in-target":a.has(R)?"controlling-value":"record-type",m,w,b=n.filter(R=>d.has(R));return r.multi&&b.length>0?e[t]=b.join(";"):(o.defaultValue!==null&&d.has(o.defaultValue)?(m=o.defaultValue,w="default"):r.required&&(m=o.values.find(R=>d.has(R)),w=m===void 0?void 0:"first"),m===void 0?delete e[t]:e[t]=m),Ro(g,p).map(([R,O])=>({field:t,reason:R,values:O,recordType:i,...R==="controlling-value"&&l?{controllingField:l}:{},...m!==void 0&&w?{replacedBy:m,replacement:w}:{}}))}function Ga(e,t,n,r,o=yo){let i=[];for(let s of wo(Object.keys(e),n)){let a=e[s];if(typeof a!="string"||o.has(s))continue;let d=n.get(s),l=t?.get(s),u=d?.restricted?r?.picklists.get(s):void 0;if(!l&&!u)continue;if(a===""){delete e[s];continue}let f=d?.multi?a.split(";"):[a];if(d&&u&&r){i.push(...So(e,s,f,d,u,r.recordType,l));continue}if(!l||d?.anyValue)continue;let g=f.filter(m=>!l.has(m));if(g.length===0)continue;let p=f.filter(m=>l.has(m));d?.multi&&p.length>0?e[s]=p.join(";"):delete e[s],i.push({field:s,reason:"not-in-target",values:[...new Set(g)]})}return i}var Eo="012000000000000AAA",Te="Master",jn="";function qa(e,t){return e?.get(typeof t=="string"?t:jn)}async function Ao(e,t,n){try{return{picklists:await e(t,n)}}catch(r){return{error:N(r)}}}var xn=class{constructor(t){this.read=t}read;reads=new Map;said=new Set;async forRows(t){let n=new Map,r=[],{read:o}=this;if(!o)return{byRecordType:n,notes:r};if(t.withoutRecordTypes){let l=[...t.fields].filter(([f,g])=>g.restricted&&g.controllerName&&t.written(f)).map(([f])=>f),u=new Set(l.filter(f=>t.rows.some(g=>typeof g[f]=="string"&&g[f]!=="")));if(u.size>0){let f={targetId:Eo,developerName:Te},g=await this.readFor(o,t.objectApiName,f.targetId);this.keep(n,r,t.objectApiName,jn,u,f,g)}return{byRecordType:n,notes:r}}if(!t.recordTypeMappings||!t.written("RecordTypeId"))return{byRecordType:n,notes:r};let i=[...t.fields].filter(([l,u])=>u.restricted&&t.written(l)).map(([l])=>l);if(i.length===0)return{byRecordType:n,notes:r};let s=new Map(t.recordTypeMappings.map(l=>[l.sourceId,l])),a=new Map;for(let l of t.rows){let u=l.RecordTypeId;if(!(typeof u!="string"||!s.has(u)))for(let f of i){let g=l[f];if(typeof g!="string"||g==="")continue;let p=a.get(u)??new Set;p.add(f),a.set(u,p)}}let d=await Promise.all([...a].map(async([l,u])=>{let f=s.get(l);return{sourceId:l,fields:u,target:f,answer:await this.readFor(o,t.objectApiName,f.targetId)}}));for(let{sourceId:l,fields:u,target:f,answer:g}of d)this.keep(n,r,t.objectApiName,l,u,f,g);return{byRecordType:n,notes:r}}readFor(t,n,r){let o=`${n}|${r}`,i=this.reads.get(o);return i||(i=Ao(t,n,r),this.reads.set(o,i)),i}keep(t,n,r,o,i,s,a){let d=`${r}|${s.targetId}`;if("error"in a){this.said.has(d)||(this.said.add(d),n.push({recordType:s.developerName,error:a.error}));return}t.set(o,{recordType:s.developerName,picklists:a.picklists});let l=[...i].filter(u=>!a.picklists.has(u)&&!this.said.has(`${d}|${u}`));if(l.length!==0){for(let u of l)this.said.add(`${d}|${u}`);n.push({recordType:s.developerName,leftOut:l})}}};function Ua(e){return e.error!==void 0?{recordSummary:`(picklist values of record type ${e.recordType} could not be read \u2014 checked against each field's values)`,messages:[e.error]}:{recordSummary:`(picklist values of record type ${e.recordType} not given for ${(e.leftOut??[]).join(", ")} \u2014 checked against each field's values)`,messages:[`The target's answer for record type ${e.recordType} leaves out ${(e.leftOut??[]).join(", ")}.`]}}var Cn=class{entries=new Map;get size(){return this.entries.size}add(t,n){for(let r of n){let o=[t,r.field,r.reason,r.recordType??"",r.controllingField??"",r.replacement??"",r.replacedBy??""].join("\0"),i=this.entries.get(o);if(i){i.entry.rows++;for(let s of r.values)i.values.add(s);continue}this.entries.set(o,{entry:{objectApiName:t,field:r.field,reason:r.reason,values:[],rows:1,...r.recordType!==void 0?{recordType:r.recordType}:{},...r.controllingField!==void 0?{controllingField:r.controllingField}:{},...r.replacedBy!==void 0?{replacedBy:r.replacedBy}:{},...r.replacement!==void 0?{replacement:r.replacement}:{}},values:new Set(r.values)})}}list(){return[...this.entries.values()].map(({entry:t,values:n})=>({...t,values:[...n].sort()}))}};function To(e){let t=`${e.rows} row${e.rows===1?"":"s"}`,n=e.values.map(i=>`"${i}"`).join(", "),r=e.reason==="not-in-target"?"not a value of the field in the target":e.reason==="record-type"?`not allowed for record type ${e.recordType??""}`:`not allowed with the value of ${e.controllingField??"its controlling field"}`,o=e.replacedBy===void 0?"left out":e.replacement==="first"?`replaced by "${e.replacedBy}", the first value record type ${e.recordType??""} allows: the field is required and has no default there`:`replaced by "${e.replacedBy}", the default of record type ${e.recordType??""}`;return`${e.field} on ${t}: ${n} ${r}, ${o}`}function Va(e){return e.length===0?"":`, picklist values not written as read: ${e.map(To).join("; ")}`}function Ya(e){let t={...e.picklistValueMappings?.length?{picklistValueMappings:e.picklistValueMappings}:{},...e.recordTypeMappings?.length?{recordTypeMappings:e.recordTypeMappings}:{},...e.defaultValues?.length?{defaultValues:e.defaultValues}:{},...e.truncateFields?.length?{truncateFields:e.truncateFields}:{},...e.ignoredGaps?.length?{ignoredGaps:e.ignoredGaps}:{},...e.skippedRows?.length?{skippedRows:e.skippedRows}:{}};return Object.keys(t).length>0?t:void 0}var Oo=new Set(["picklist_value_refused","picklist_value_absent","currency_inactive"]);function Ln(e){let t=Gt(e.gapId);return t?t.objectApiName!==e.object?{ignored:`the gap is of ${t.objectApiName}, not of ${e.object}`}:t.field===void 0||t.value===void 0?{ignored:"the gap names no field and value whose rows to hold back"}:Oo.has(t.kind)?{held:{field:t.field,...t.recordType!==void 0?{recordType:t.recordType}:{},value:t.value}}:{ignored:`a ${t.kind} gap does not offer it: its rows are not exactly those holding its value`}:{ignored:"not the id of a gap"}}function Ja(e){let t=Ln(e);return"ignored"in t?t.ignored:void 0}function _n(e,t,n){if(e===void 0)return!0;let r=t??Te;if(e===r)return!0;let o=Ae(e),i=Ae(r);if(o.namespacePrefix!==void 0||i.namespacePrefix===void 0||i.developerName!==e)return!1;if(n===void 0)return!0;let s=nt(e,n,a=>a);return"found"in s&&s.found.namespacePrefix===i.namespacePrefix}function ko(e){return e==null||e===""}var In=class{entries=new Map;get size(){return this.entries.size}add(t,n=1){let r=[t.kind,t.objectApiName,t.field??"",t.recordType??"",t.from??"",t.to??""].join("\0"),o=this.entries.get(r);if(o){o.rows+=n;return}this.entries.set(r,{...t,rows:n})}list(){return[...this.entries.values()].map(t=>({...t}))}},Oe=class{picklists=new Map;defaults=new Map;truncated=new Map;skipped=new Map;ignoredGaps;constructor(t){for(let n of t?.picklistValueMappings??[]){let r=this.picklists.get(n.object)??[];r.push(n),this.picklists.set(n.object,r)}for(let n of t?.defaultValues??[]){let r=this.defaults.get(n.object)??[];r.push(n),this.defaults.set(n.object,r)}for(let{object:n,field:r}of t?.truncateFields??[]){let o=this.truncated.get(n)??new Set;o.add(r),this.truncated.set(n,o)}this.ignoredGaps=new Set(t?.ignoredGaps??[]);for(let n of t?.skippedRows??[]){let r=Ln(n);if(!("held"in r))continue;let o=this.skipped.get(n.object)??[];o.push(r.held),this.skipped.set(n.object,o)}}skipsRowsOf(t){return this.skipped.has(t)}namesARecordTypeBare(t){return[...(this.picklists.get(t)??[]).map(r=>r.recordType),...(this.skipped.get(t)??[]).map(r=>r.recordType)].some(r=>r!==void 0&&r!==Te&&Ae(r).namespacePrefix===void 0)}holdsBack(t,n,r,o,i){for(let s of this.skipped.get(t)??[]){if(!_n(s.recordType,r,i))continue;let a=n(s.field);if(!(typeof a!="string"||!a.split(";").includes(s.value)))return o.add({kind:"skip_rows",objectApiName:t,field:s.field,...s.recordType!==void 0?{recordType:s.recordType}:{},from:s.value}),!0}return!1}changesRowsOf(t){return this.picklists.has(t)||this.defaults.has(t)}defaultOf(t,n){let r=this.defaults.get(t)?.find(o=>o.field===n);return r===void 0?void 0:String(r.value)}applyToRow(t,n,r,o,i){for(let s of this.picklists.get(t)??[]){if(!_n(s.recordType,r,i))continue;let a=n[s.field];if(typeof a!="string"||a==="")continue;let d=a.split(";");if(!d.includes(s.from))continue;let l=d.flatMap(u=>u!==s.from?[u]:s.to===null?[]:[s.to]);l.length===0?delete n[s.field]:n[s.field]=[...new Set(l)].join(";"),o.add({kind:s.to===null?"leave_empty":"map_value",objectApiName:t,field:s.field,...s.recordType!==void 0?{recordType:s.recordType}:{},from:s.from,...s.to!==null?{to:s.to}:{}})}for(let{field:s,value:a}of this.defaults.get(t)??[])ko(n[s])&&(n[s]=a,o.add({kind:"set_default",objectApiName:t,field:s,to:String(a)}))}truncate(t,n,r,o){for(let i of this.truncated.get(t)??[]){let s=n[i],a=r.get(i);typeof s!="string"||a===void 0||a<=0||s.length<=a||(n[i]=s.slice(0,a),o.add({kind:"truncate",objectApiName:t,field:i}))}}truncatedFieldsOf(t){return this.truncated.get(t)??new Set}};function Za(e,t){let n=new Map(t.map(s=>[s.objectApiName,s])),r=[],o=new Map,i=[];for(let s of e){let a=n.get(s.object),d=Dn(s.object,s.from,a?.source??[],"the source");if("reason"in d){i.push({decision:s,reason:d.reason});continue}if(s.to===null){o.set(d.type.recordTypeId,s);continue}let l=Dn(s.object,s.to,a?.target??[],"the target");if("reason"in l){i.push({decision:s,reason:l.reason});continue}o.set(d.type.recordTypeId,s),r.push({sourceId:d.type.recordTypeId,targetId:l.type.recordTypeId,developerName:l.type.developerName})}return{mappings:r,bySource:o,unresolved:i}}function Dn(e,t,n,r){let o=nt(t,n.filter(i=>!i.master),rt);if("found"in o)return{type:o.found};if("ambiguous"in o){let i=o.ambiguous.map(rt),s=i.find(a=>a.namespacePrefix);return{reason:mn(e,t,r,i)+(s?"; a package's is named with its namespace: "+pn(s.namespacePrefix,s.developerName):"")}}return{reason:`${r} has no ${e} record type named ${t}`}}function ed(e,t){return t.bySource.size===0?e?[...e]:void 0:[...(e??[]).filter(n=>!t.bySource.has(n.sourceId)),...t.mappings]}import{createHash as gi}from"node:crypto";var Fo="__pass2__";function Wn(e){let t=e.errors??[],n=t.some(i=>i.skipped===!0),r=t.some(i=>i.objectApiName===Fo&&i.failedCount>0);return e.failedCount===0&&e.failedReads.length===0&&!n&&!r?"success":e.successCount+e.updatedCount+e.linkedCount+(e.wouldInsertCount??0)>0?"partial":"failure"}function nd(e,t,n){return{forgeId:`forge-${Date.now()}`,status:n.status,graph:t,duration:Date.now()-n.startedAt,timestamp:new Date().toISOString(),idRemapCount:e.remapCount,idRemapTable:e.remapTable,idRemapExisting:e.existingSourceIds,...e.withTheirRecordSourceIds?{idRemapWithTheirRecord:e.withTheirRecordSourceIds}:{},...e.withTheirRecordCount!==void 0&&e.withTheirRecordCount>0?{withTheirRecordCount:e.withTheirRecordCount}:{},...e.linkedToCreatedCount!==void 0&&e.linkedToCreatedCount>0?{linkedToCreatedCount:e.linkedToCreatedCount}:{},createdCount:e.successCount,...e.updatedCount>0?{updatedCount:e.updatedCount}:{},linkedExistingCount:e.linkedCount,existingRecords:e.existingRecords,idRemapByObject:e.remapByObject,idRemapCreated:e.createdByObject,readByObject:e.readByObject,failedReads:e.failedReads,errors:e.errors,truncatedObjects:e.truncatedObjects,...e.cappedObjects?{cappedObjects:e.cappedObjects}:{},...e.fieldExclusionsUnmatched?{fieldExclusionsUnmatched:e.fieldExclusionsUnmatched}:{},...e.orphanParentsCapped?{orphanParentsCapped:e.orphanParentsCapped}:{},...e.files?{files:e.files}:{},...e.fileContentFieldsLeftOut?{fileContentFieldsLeftOut:e.fileContentFieldsLeftOut}:{},...e.encryptedFieldsLeftOut?{encryptedFieldsLeftOut:e.encryptedFieldsLeftOut}:{},...e.picklistValuesChanged?{picklistValuesChanged:e.picklistValuesChanged}:{},...e.currenciesReplaced?{currenciesReplaced:e.currenciesReplaced}:{},...e.recordTypesGiven?{recordTypesGiven:e.recordTypesGiven}:{},...e.writtenWithoutFields?{writtenWithoutFields:e.writtenWithoutFields}:{},...e.lookupsLeftEmptyByFilter?{lookupsLeftEmptyByFilter:e.lookupsLeftEmptyByFilter}:{},...e.contactPoints?{contactPoints:e.contactPoints}:{},...e.writtenBetween?{writtenBetween:e.writtenBetween}:{},...e.apiCalls!==void 0?{apiCalls:e.apiCalls}:{},...e.dryRun?{dryRun:!0,wouldInsertCount:e.wouldInsertCount}:{},...e.gaps?{gaps:e.gaps}:{},...e.decisionsApplied?{decisionsApplied:e.decisionsApplied}:{},...e.mayHaveBeenWritten?{mayHaveBeenWritten:e.mayHaveBeenWritten}:{},...e.remapInJournal?{remapInJournal:!0}:{},...e.sample?{sample:e.sample}:{},...e.roots?{roots:e.roots}:{},...e.reads?{reads:e.reads}:{}}}var Gn="RUN_CANCELLED";function id(e){return{idRemapByObject:e.remapByObject,errors:e.errors,notSentByObject:e.notSentByObject,writtenWithoutFields:e.writtenWithoutFields,mayHaveBeenWritten:e.mayHaveBeenWritten}}function ad(e){let t=new Map,n=r=>{let o=t.get(r)??fn(r);return t.set(r,o),o};for(let r of e.idRemapByObject??[]){let o=n(r.objectApiName);o.created+=r.created,o.updated+=r.updated??0}for(let r of e.errors??[]){if(r.objectApiName.startsWith("__")||r.referenceData===!0||r.stage==="scope"&&r.failedCount===0&&r.skipped!==!0)continue;let o=n(r.objectApiName);o.failed+=r.failedCount,r.skipped===!0&&(o.skipped=r.failedCount>0?"counted":"uncounted")}for(let r of e.notSentByObject??[]){let o=n(r.objectApiName);o.notSent=(o.notSent??0)+r.notSent}for(let r of e.writtenWithoutFields??[]){let o=n(r.objectApiName);o.writtenWithoutFields=(o.writtenWithoutFields??0)+r.rows}for(let{objectApiName:r,sourceIds:o}of e.mayHaveBeenWritten??[]){let i=n(r);i.mayHaveBeenWritten=(i.mayHaveBeenWritten??0)+o.length}return[...t.values()]}function dd(e,t){return t.some(r=>r.created+r.updated>0)?"cancelled":(e?Wn(e):"success")==="success"?"stopped":"cancelled"}function ud(e){return e?{details:{contactPoints:e.neutralized?"neutralized":"kept",contactPointFields:e.fields.length,contactPointValues:e.values}}:{}}function ld(e){return Object.fromEntries((e.idRemapByObject??[]).map(t=>[t.objectApiName,t.created+t.linked+(t.updated??0)]))}var Sd=2e3,Ed=1e4,Po=qt;function Ad(e,t,n=Po){let r=t!==void 0&&t>0?Math.floor(t):void 0;return r!==void 0&&r<=n?[]:e.nodes.filter(o=>o.included&&o.recordCountUnknown!==!0).map(o=>({objectApiName:o.objectApiName,rows:r===void 0?o.recordCount:Math.min(o.recordCount,r)})).filter(o=>o.rows>n).sort((o,i)=>i.rows-o.rows)}var Zn=.8,se=1024,Fe=2*se,er=4*se,Bo=8*se,vo=1*se,No=4*se,Mo=255,xo=/__kav$/i,Co=new Map([ee,Se,Ee,"Campaign","CampaignMember"].map(e=>[e.toLowerCase(),e]));function $e(e){return Co.get(e.toLowerCase())??e}function qn(e,t=0){let n=0;for(let r of Object.values(e))typeof r=="string"&&r.length>t&&(n+=Buffer.byteLength(r,"utf8"));return n}function it(e,t){let n=$e(e);return n===ee?qn(t):n===Se?tt(t)?er:Fe:n===Ee&&tt(t)?0:n==="Campaign"?Bo:n==="CampaignMember"?vo:xo.test(e)?No+qn(t,Mo):Fe}function jo(e,t){let n=Math.min(t.personAccounts??0,t.rows),r=t.rows-n,o=$e(e);return o===Se?r*Fe+n*er:o===Ee?r*Fe:r*it(e,{})}function _o(e){let t=e.map(({objectApiName:m,rows:w,counted:b,mayAdd:R=0,mayBeByThePlatform:O})=>{let T={rows:R,storageBytes:R*it(m,{}),...R>0?{mayAdd:R}:{},...O&&O.rows>0?{mayBeByThePlatform:O}:{}};return b?{objectApiName:m,...T,rows:b.rows+T.rows,storageBytes:jo(m,b)+T.storageBytes}:{objectApiName:m,...T,rows:w.length+T.rows,storageBytes:w.reduce((C,A)=>C+it(m,A),0)+T.storageBytes}}).filter(({rows:m})=>m>0).sort((m,w)=>w.rows-m.rows||m.objectApiName.localeCompare(w.objectApiName)),n=e.reduce((m,w)=>m+(w.leftOut?.writtenBefore??0),0),r=e.filter(m=>(m.leftOut?.heldBack??0)>0).map(({objectApiName:m,leftOut:w})=>({objectApiName:m,rows:w?.heldBack??0})),o=e.filter(m=>(m.leftOut?.byThePlatform??0)>0).map(({objectApiName:m,leftOut:w})=>({objectApiName:m,rows:w?.byThePlatform??0})),i=e.flatMap(({objectApiName:m,leftOut:w})=>w?.linkedByValue&&w.linkedByValue.rows>0?[{objectApiName:m,...w.linkedByValue}]:[]),s=m=>e.filter(w=>(w.leftOut?.[m]??0)>0).map(({objectApiName:w,leftOut:b})=>({objectApiName:w,rows:b?.[m]??0})),a=s("recordTypeNotInTarget"),d=s("withoutParent"),l=s("noParentInSource"),u=s("outsideFilter"),f=s("linkedToTarget"),g=s("currencyReplaced"),p=e.flatMap(({objectApiName:m,leftEmpty:w=[]})=>w.filter(({rows:b})=>b>0).map(({field:b,rows:R})=>({objectApiName:m,field:b,rows:R})));return{objects:t,...p.length>0?{leftEmpty:p}:{},totalRows:t.reduce((m,w)=>m+w.rows,0),storageBytes:t.reduce((m,w)=>m+w.storageBytes,0),...n>0||r.length>0||a.length>0||o.length>0||i.length>0||d.length>0||l.length>0||u.length>0||f.length>0||g.length>0?{leftOut:{writtenBefore:n,heldBack:r,...a.length>0?{recordTypeNotInTarget:a}:{},...o.length>0?{byThePlatform:o}:{},...i.length>0?{linkedByValue:i}:{},...d.length>0?{withoutParent:d}:{},...l.length>0?{noParentInSource:l}:{},...u.length>0?{outsideFilter:u}:{},...f.length>0?{linkedToTarget:f}:{},...g.length>0?{currencyReplaced:g}:{}}}:{}}}function Td(e){return JSON.stringify([e.sourceOrgId,e.targetOrgId,e.inputMode,e.recordId??null,e.soqlQuery??null,e.templateId??null,e.aiPrompt??null,...e.queryScope==="records"?["records"]:[]])}var Io=16,Un=class{kept=new Map;note(t,n,r=Date.now()){this.kept.delete(t),this.kept.set(t,{at:r,total:n.totalRows,objects:n.objects.map(({objectApiName:o,rows:i})=>({objectApiName:o,rows:i}))});for(let o of this.kept.keys()){if(this.kept.size<=Io)break;this.kept.delete(o)}}of(t){return this.kept.get(t)}},Do=500;function Lo(e,t){return e>2*t||e-t>Do}function Od(e,t,n=Date.now()){return{minutesBefore:Math.max(1,Math.ceil((n-e.at)/6e4)),total:e.total,objects:e.objects.map(({objectApiName:r,rows:o})=>({objectApiName:r,rows:o})),...Lo(t,e.total)?{farAbove:!0}:{}}}function kd(e){let t=e.objects.reduce((n,r)=>n+(r.mayAdd??0),0);return t>0?{pricesForLines:t}:{}}function Fd(e){let t=e.objects.find(n=>n.mayBeByThePlatform)?.mayBeByThePlatform;return!t||t.rows<=0?{}:{rolesMayBeByThePlatform:{rows:t.rows,...t.before===!0?{before:!0}:{}}}}var ke=P({Max:M(),Remaining:M()}).loose(),Wo=P({DataStorageMB:ke,DailyApiRequests:ke.optional(),DailyBulkApiBatches:ke.optional(),FileStorageMB:ke.optional()}).loose(),Go=P({DailyApiRequests:P({Max:M(),Remaining:M()}).loose()}).loose(),qo="the org does not tell this user its daily API requests";function tr(e,t,n){if(e!==null&&typeof e=="object"&&!(t in e))throw new Error(n)}async function Uo(e){let t=await e.request({method:"GET",url:"/limits"});tr(t,"DataStorageMB",Wt);let n=Wo.parse(t);return{maxMB:n.DataStorageMB.Max,remainingMB:n.DataStorageMB.Remaining,...n.DailyApiRequests?{dailyApiRequests:{max:n.DailyApiRequests.Max,remaining:n.DailyApiRequests.Remaining}}:{},...n.DailyBulkApiBatches?{dailyBulkApiBatches:{max:n.DailyBulkApiBatches.Max,remaining:n.DailyBulkApiBatches.Remaining}}:{},...n.FileStorageMB?{fileStorage:{maxMB:n.FileStorageMB.Max,remainingMB:n.FileStorageMB.Remaining}}:{}}}async function Vn(e){let t=await e.request({method:"GET",url:"/limits"});tr(t,"DailyApiRequests",qo);let n=Go.parse(t);return{max:n.DailyApiRequests.Max,remaining:n.DailyApiRequests.Remaining}}var at=200,nr=2e3,Vo=.1;function zo(e){return e.reduce((t,{rows:n,bulk:r,readRows:o,perCall:i})=>{let s=Math.min(at,Math.max(1,i??at)),a=n<=0?0:r?Rn(n):Math.ceil(n/s),d=o&&o>0?Math.ceil(o/nr):0;return t+a+d},0)}var ct=["checkpoint","mute","readBack","deliverability","fit"],Qo={checkpoint:"for the checkpoint taken first",mute:"to assign and take back the permission sets that mute the target's automation",readBack:"to read back the record types the target gave",deliverability:"to read whether the target delivers its emails",fit:"to fit the run to the storage"};function Ho(e){return ct.reduce((t,n)=>t+Math.max(0,e[n]??0),e.run)}function Ko(e){return ct.some(t=>(e[t]??0)>0)?{...e}:void 0}function st(e,t){let n=typeof e=="number"?void 0:Ko(e),r=typeof e=="number"?e:Ho(e),o=n?{parts:n}:{};if(!t)return{verdict:"unread",estimate:r,unread:"the limits the org answered list no DailyApiRequests",...o};if("unread"in t)return{verdict:"unread",estimate:r,unread:t.unread,...o};let{max:i,remaining:s}=t;return{verdict:r>s?"exceeds":s-r<Vo*i?"near":"fits",estimate:r,max:i,remaining:s,...o}}function Xo(e){if(!e)return"";let t=ct.filter(n=>(e[n]??0)>0).map((n,r)=>`${e[n]}${r===0?" of them":""} ${Qo[n]}`);return t.length>0?` (${t.join(", ")})`:""}var ne="API_BUDGET_EXCEEDED";function Yo(e,t,n){if(e.verdict==="exceeds")return`The run takes about ${e.estimate} API requests${Xo(e.parts)}, and ${t} has ${e.remaining} of its ${e.max} daily requests left: it would stop part way through, its records refused with REQUEST_LIMIT_EXCEEDED. Run it once the org has requests to spare \u2014 the limit is counted over the last 24 hours \u2014 or write fewer records. `+(n?`${n} `:"")+"Nothing was written."}function Jo(e){return e.verdict==="near"?{apiRequests:{estimate:e.estimate,remaining:e.remaining,max:e.max,...e.parts?{parts:{...e.parts}}:{}}}:{}}var Pe="CHECKPOINT_REFUSED";function Zo(e){return e?{checkpoint:e.estimate.apiRequests}:{}}function es(e){let t=e?.refusal;if(t!==void 0)return{code:Pe,message:ot(t),refusal:t}}var ts="The run was stopped while it took the checkpoint first: nothing of it was kept, and nothing was written.";async function $d(e){let t;try{t=await e()}catch(n){return{stop:{code:Pe,message:$n(n)}}}return t.taken?{checkpoint:t.checkpoint}:"stopped"in t?{stop:{code:Gn,message:ts}}:{stop:{code:Pe,message:ot(t.refusal),refusal:t.refusal}}}var zn=1e4,ns=1e4,rs=.01;function os(e,t,n){return t<2e3||kn.has(e)||(n??Fn).has(e)}function Be(e,t,n){if(t<=0)return{jobs:[],rest:0};if(os(e,t,n.restOnly))return{jobs:[],rest:t};let r=[];for(let o=t;o>0;o-=zn){let i=Math.min(o,zn);if(i<2e3)return{jobs:r,rest:i};r.push(i)}return{jobs:r,rest:0}}function ss(e){return yn({stateReads:bn(e,hn,"save")})}function is(e,t,n){let{jobs:r,rest:o}=Be(e,t,n);return r.reduce((i,s)=>i+ss(s),0)+Math.ceil(o/at)}var as=4,ds=3;function us(e){let t=new Set(e.updatedAfterInsert??[]),n=new Map((e.plan.leftOut?.linkedByValue??[]).map(({objectApiName:d,rows:l})=>[d,l])),r=[...e.plan.objects.map(({objectApiName:d,rows:l})=>({objectApiName:d,rows:l+(n.get(d)??0)})),...[...n].filter(([d])=>!e.plan.objects.some(l=>l.objectApiName===d)).map(([d,l])=>({objectApiName:d,rows:l}))],o=e.plan.objects.filter(({objectApiName:d})=>t.has(d)).map(({objectApiName:d,rows:l})=>({objectApiName:d,rows:l})),{bulk:i}=e,s=e.files!==void 0&&e.files>0?e.files:0,a=i?as*r.filter(({rows:d})=>d>0).length:0;return{run:(i?[...r,...o].reduce((d,{objectApiName:l,rows:u})=>d+is(l,u,i),0):zo([...r,...o]))+s+a+Math.max(0,e.sentBefore??0),...Zo(e.checkpoint),...e.mute!==void 0&&e.mute>0?{mute:e.mute}:{},...e.readBack!==void 0&&e.readBack>0?{readBack:e.readBack}:{},...e.deliverability!==void 0&&e.deliverability>0?{deliverability:e.deliverability}:{}}}var ls=200;function cs(e){let t={...e.measures.restOnly?{restOnly:e.measures.restOnly}:{}},n=new Set(e.updatedAfterInsert??[]),r=e.plan.objects.map(({objectApiName:a,rows:d})=>({objectApiName:a,rows:d,writes:Be(a,d,t),updates:n.has(a)?Be(a,d,t):void 0})),o=r.flatMap(({writes:a,updates:d})=>d?[a,d]:[a]),i=e.measures.files,s=i&&"count"in i&&i.count>0?i.count:0;return{objects:r.map(({objectApiName:a,rows:d,writes:l})=>({objectApiName:a,rows:d,jobs:l.jobs.length})),sourceRequests:(e.measures.sourceReads??r.reduce((a,{rows:d})=>a+Math.ceil(Math.max(0,d)/nr),0)+s+Math.ceil(s/ls))+ds*r.filter(({rows:a})=>a>0).length+(e.sourceSentBefore===void 0?Math.max(0,e.measures.heldReads??0):Math.max(0,e.sourceSentBefore)),bulkBatches:o.reduce((a,{jobs:d})=>a+d.reduce((l,u)=>l+Math.ceil(u/ns),0),0),durationSeconds:o.reduce((a,{jobs:d,rest:l})=>a+d.reduce((u,f)=>u+wn(f,"save"),0)+l*rs,0),restObjects:r.filter(({rows:a,writes:d})=>a>0&&d.jobs.length===0).map(({objectApiName:a})=>a)}}var fs="the limits the org answered list no DailyBulkApiBatches";function gs(e,t){if(e.verdict==="exceeds")return`The run writes through Bulk API jobs that take about ${e.estimate} of the daily Bulk API batches, and ${t} has ${e.remaining} of its ${e.max} left: its jobs would be refused part way through. Run it once the org has batches to spare \u2014 the limit is counted over the last 24 hours, and Bulk API 1.0 shares it \u2014 or leave objects out. Nothing was written.`}function ps(e,t){if(e.verdict==="exceeds")return`The run reads the source records in about ${e.estimate} API requests, and ${t} has ${e.remaining} of its ${e.max} daily requests left: the reads would stop part way through, and the org's own integrations with them. Run it once the org has requests to spare \u2014 the limit is counted over the last 24 hours \u2014 or leave objects out. Nothing was written.`}function ms(e,t){if(e.verdict==="exceeds")return`The files to copy take about ${L(e.estimateMB)} MB of file storage, and ${t} has ${e.remainingMB} MB left of ${e.maxMB} MB: leave out the objects whose files take it, turn the copy of files off on Review, or free file storage in ${t}. Nothing was written.`}function hs(e,t){return`A clone of the whole org reads a few objects whole, and ${e.map(({objectApiName:r,rows:o})=>`${r} (${o} rows)`).join(", ")} ${e.length===1?"holds":"hold"} more than the ${t} rows of one object the sandforge.forge.maxRecordsPerObject setting lets a run hold at once: raise the setting or leave the object out on Review. Nothing was written.`}var ys=200;function ws(e){if(!e||e.length===0)return;let t=Math.min(...e.map(r=>r.bound)),n=e.map(({objectApiName:r,rows:o})=>({objectApiName:r,rows:o}));return{code:"READ_BOUND_EXCEEDED",message:hs(n,t),readBound:{bound:t,objects:n.slice(0,ys)}}}var rr="FILES_UNREAD",or="FILE_STORAGE_UNREAD";function bs(e,t,n){if(!e)return{};if("unmeasured"in e)return{files:{unmeasured:!0},stop:{code:rr,message:`The source would neither sum nor list its files, so what they take of the file storage ${n} has left is not known: turn the copy of files off on Review, or run it again once the source answers. Nothing was written.`}};if(e.count<=0)return{};let r=sr({storageBytes:e.bytes},"unread"in t?t:t.fileStorage??{unread:"the limits the org answered list no FileStorageMB"});if(r.verdict==="unread")return{files:{count:e.count,check:r},stop:{code:or,message:`The file storage ${n} has left could not be read (${r.unread}), so the ${e.count} files to copy could not be checked against it: turn the copy of files off on Review, or run it again once the org answers. Nothing was written.`}};let o=ms(r,n);return{files:{count:e.count,check:r},...o!==void 0&&r.verdict==="exceeds"?{stop:{code:"STORAGE_EXCEEDED",message:o,storage:{estimateMB:Number(L(r.estimateMB)),remainingMB:r.remainingMB,kind:"files"}}}:{}}}function Rs(e){let t=e.wholeOrg,n=t?.measures.files,r=st(us({...e,...t?{bulk:t.measures.restOnly?{restOnly:t.measures.restOnly}:{},...n&&"count"in n?{files:n.count}:{}}:{}}),e.budget),o=Yo(r,e.target),i=[],s=es(e.checkpoint);s&&i.push(s),o!==void 0&&i.push({code:ne,message:o,...t&&r.verdict==="exceeds"?{api:{kind:"requests",org:"target",estimate:r.estimate,remaining:r.remaining}}:{}});let a;if(t){let f=cs({...e,measures:t.measures,...t.sourceSentBefore!==void 0?{sourceSentBefore:t.sourceSentBefore}:{}}),g=f.bulkBatches>0?st(f.bulkBatches,t.bulkBatches??{unread:fs}):void 0,p=g&&gs(g,e.target);p!==void 0&&g?.verdict==="exceeds"&&i.push({code:ne,message:p,api:{kind:"bulkBatches",org:"target",estimate:g.estimate,remaining:g.remaining}});let m=st(f.sourceRequests,t.sourceBudget),w=ps(m,t.source);w!==void 0&&m.verdict==="exceeds"&&i.push({code:ne,message:w,api:{kind:"requests",org:"source",estimate:m.estimate,remaining:m.remaining}}),a={source:m,...g?{bulkBatches:g}:{},cost:f}}let[d,...l]=i,u=l.filter(f=>f.code===ne);return{api:r,...d?{stop:d}:{},...t&&u.length>0?{alsoRefused:u}:{},...a?{wholeOrg:a}:{},asks:e.checkpoint!==void 0||t!==void 0,confirmation:{...Jo(r),...e.checkpoint?{checkpoint:e.checkpoint}:{}}}}function sr(e,t,n=0){let r=Math.max(0,n),o=e.storageBytes+r,i=o/1048576,s=r>0?{automationMB:r/1048576}:{};if("unread"in t)return{verdict:"unread",estimateMB:i,unread:t.unread,...s};let{maxMB:a,remainingMB:d}=t;return{verdict:o>d*1048576?"exceeds":o>Zn*d*1048576?"near":"fits",estimateMB:i,maxMB:a,remainingMB:d,...s}}function Ss(e,t){if(!t||t.length===0)return 0;let n=new Map;for(let{objectApiName:r,bytes:o}of t)n.set(r,(n.get(r)??0)+Math.max(0,o));return e.objects.reduce((r,{objectApiName:o,rows:i})=>r+i*(n.get(o)??0),0)}function Ne(e){return`about ${L(e.estimateMB)} MB of data storage`+(e.automationMB!==void 0&&e.automationMB>0?`, about ${L(e.automationMB)} MB of it for what the target's automation creates under them`:"")}function Es(e,t){let n=_o(e),r=t.emailTextBytes,o=e.some(s=>$e(s.objectApiName)===ee&&s.counted);if(r===void 0||!Number.isFinite(r)||!o)return n;let i=n.objects.map(s=>$e(s.objectApiName)===ee?{...s,storageBytes:s.storageBytes+Math.max(0,r)}:s);return{...n,objects:i,storageBytes:i.reduce((s,a)=>s+a.storageBytes,0)}}function As(e,t,n){return e.flatMap(({objectApiName:r,included:o,piiFields:i,anonymizeFields:s})=>{if(!o||!t.has(r))return[];let a=new Set(n?s:[]),d=i.filter(l=>!a.has(l));return d.length>0?[{objectApiName:r,fields:d}]:[]})}function Ts(e){let t=e.leftOut??[],n=new Set(t.map(({objectApiName:i})=>i)),r=[...t,...e.nodes.filter(i=>i.leftOutByUser===!0&&!n.has(i.objectApiName)).map(({objectApiName:i})=>({objectApiName:i,reason:"excludedByUser"}))],o=new Map;for(let{reason:i}of r)o.set(i,(o.get(i)??0)+1);return{objects:r,counts:[...o].map(([i,s])=>({reason:i,count:s})).sort((i,s)=>s.count-i.count||i.reason.localeCompare(s.reason))}}var Os=2;async function Pd(e){let t=b=>({unread:N(b)}),n=Es(e.objects,e.measures),r=await Uo(e.target.limits).catch(t),o="unread"in r?await Vn(e.target.limits).catch(t):r.dailyApiRequests,i=await Vn(e.source.limits).catch(t),s=sr(n,r,Ss(n,e.automation)),a=si(s,e.target.org),d=e.sample?vs({sample:e.sample,storage:r,target:e.target.org}):void 0,l=bs(e.measures.files,r,e.target.org),u=e.sentBefore?.(),f=Rs({plan:n,...e.updatedAfterInsert?{updatedAfterInsert:e.updatedAfterInsert}:{},...e.readBack!==void 0?{readBack:e.readBack}:{},...e.checkpoint?{checkpoint:e.checkpoint}:{},...e.mute!==void 0?{mute:e.mute}:{},deliverability:e.deliverability??Os,...u?{sentBefore:u.target}:{},budget:o,target:e.target.org,wholeOrg:{measures:e.measures,bulkBatches:"unread"in r?r:r.dailyBulkApiBatches,sourceBudget:i,source:e.source.org,...u?.source!==void 0?{sourceSentBefore:u.source}:{}}}),g=[ws(e.measures.readWholeOver),d,d===void 0&&a!==void 0&&s.verdict==="exceeds"?{code:"STORAGE_EXCEEDED",message:`${a} Nothing was written.`,storage:{estimateMB:Number(L(s.estimateMB)),remainingMB:s.remainingMB}}:void 0,l.stop,f.stop,...f.alsoRefused??[]].filter(b=>b!==void 0),p=e.measures.restOnly?{restOnly:e.measures.restOnly}:{},m=new Set(n.objects.map(({objectApiName:b})=>b)),{wholeOrg:w}=f;return{wouldInsert:n.objects.map(({objectApiName:b,rows:R})=>{let{jobs:O,rest:T}=Be(b,R,p);return{objectApiName:b,rows:R,jobs:O.length,byRest:T}}),totalRows:n.totalRows,targetRequests:f.api,sourceRequests:w.source,...w.bulkBatches?{bulkBatches:w.bulkBatches}:{},storage:s,...l.files?{files:l.files}:{},durationSeconds:w.cost.durationSeconds,leftOut:{...Ts(e.graph),...n.leftOut?{rows:n.leftOut}:{}},personalAsIs:As(e.graph.nodes,m,e.anonymizePII),wouldBeRefused:g,...e.measures.personAccountsAsBusiness?{personAccountsAsBusiness:e.measures.personAccountsAsBusiness}:{},...e.sample?{sample:e.sample}:{}}}var ks="SAMPLE_STORAGE_UNREAD",ir="SAMPLE_CANNOT_FIT",Fs="SAMPLE_TOO_LARGE",ar="SAMPLE_PLAN_MISMATCH",dt="SAMPLE_PLAN_GONE";function $s(e){let{storage:t,bounds:n,target:r}=e;if("unread"in t&&!(n.withinMB!==void 0||n.maxTotal!==void 0))return{code:ks,message:`The data storage ${r} has left could not be read (${t.unread}), and a sample is fitted to it: there is nothing to hold it to. Give the most it may take (--fit-within <MB>) or the most records (--max-total <n>), or run it again once the org answers. Nothing was written.`}}function Ps(e,t){if(e.remainingMB===void 0||e.share===void 0)return;let n=Math.max(0,t.remainingMB-(e.roundingMB??0));return Math.floor(e.share*n*1048576)}function Bs(e){let{sample:t,storage:n,target:r}=e,o=Ps(t.budget,n);if(o===void 0||t.storageBytes<=o)return;let i=hr(t.storageBytes/1048576,o/1048576),s=L(t.budget.bytes/1048576);return{code:"STORAGE_EXCEEDED",message:`The sample was fitted to ${s} MB of the data storage ${r} had left (${t.budget.remainingMB} MB), and ${r} now says ${n.remainingMB} MB left, which holds ${i.bound} MB of a sample: the sample takes about ${i.over} MB. Simulate again \u2014 run the dry run again \u2014 to draw a sample that fits: a run never cuts its sample short. Nothing was written.`,storage:{estimateMB:Number(i.over),remainingMB:n.remainingMB},sample:{fittedMB:Number(s),holdsMB:Number(i.bound)}}}function vs(e){let{sample:t,storage:n,target:r}=e;return"unread"in n?$s({storage:n,bounds:t.budget,target:r}):Bs({sample:t,storage:n,target:r})}var Ns=new Set(["gone","changed","otherOrg","otherSetup","otherSha"]),Ms={changed:"is no longer as its dry run wrote it: its ids changed since",otherOrg:"was drawn of another org than the source",otherSetup:"was drawn for another setup of the run \u2014 other flags, filters, objects or options of the sample",otherSha:"is not the plan its dry run printed"};function xs(e,t){return t==="resume"?{code:dt,message:`The plan of the sample this run resumes ${e==="gone"?"is no longer on this machine":"is no longer as it was written"}: the records it was to write cannot be taken up after where it stopped (--resume). Remove what it wrote (--remove), or run the clone again without --resume to draw a new sample. Nothing was written.`,sample:{plan:e}}:e==="gone"?{code:dt,message:'No plan of a sample is at the path given to --fit-plan: give the folder its dry run printed ("sample plan: \u2026"), within a day of it, or leave --fit-plan out to draw a new sample. Nothing was written.',sample:{plan:e}}:{code:ar,message:`The plan given to --fit-plan ${Ms[e]}: run the dry run again with the flags of this run, and replay the plan it prints. Nothing was written.`,sample:{plan:e}}}var Cs=new Set([Fs,ir,dt,ar]),js=20;function Bd(e,t){if(e instanceof Error){if(e.name==="SampleRefusedError"){let{code:n,heaviest:r,sample:o}=e;if(typeof n!="string"||!Cs.has(n))return;let i=Array.isArray(r)?r.flatMap(d=>{let l=d?.objectApiName;return typeof l=="string"?[l]:[]}):[],s=Qt({code:n,sample:o})?.sample??{},a={...s,...n===ir&&s.heaviest===void 0&&i.length>0?{heaviest:i.slice(0,js)}:{}};return V.of({code:n,message:e.message,...Object.keys(a).length>0?{sample:a}:{}})}if(e.name==="SamplePlanError"&&t!=="draw"){let{refusal:n}=e;return typeof n!="string"||!Ns.has(n)?void 0:V.of(xs(n,t))}}}var _s=P({SingleEmail:P({Max:M(),Remaining:M()}).loose().optional(),DailyWorkflowEmails:P({Max:M(),Remaining:M()}).loose().optional()}).loose();async function vd(e){let t=_s.parse(await e.request({method:"GET",url:"/limits"})),n={};for(let r of["SingleEmail","DailyWorkflowEmails"]){let o=t[r];o&&(n[r]={max:o.Max,remaining:o.Remaining})}return n}var Is=15;function dr(e){let t=e.SingleEmail;return t!==void 0&&t.max<=Is}function Ds(e){return dr(e)&&e.DailyWorkflowEmails!==void 0}function Ls(e,t,n=!1){let r=e.map(a=>({...a,sentBy:[...a.sentBy]})),o=(a,d)=>{let l=r.find(u=>u.objectApiName===a.objectApiName&&u.limit===d);if(!l){let u={...a,limit:d,sentBy:[...a.sentBy]};return r.push(u),u}l.perRecord+=a.perRecord;for(let u of a.sentBy)l.sentBy.includes(u)||l.sentBy.push(u);return l},i=e.filter(a=>a.limit==="SingleEmail"),s=e.filter(a=>a.limit==="DailyWorkflowEmails");if(n)for(let a of i)o(a,"DailyWorkflowEmails");if(t)for(let a of s)o(a,"SingleEmail").alertsAmong=!0;return r}function ur(e){let t=new Map(e.objects.map(n=>[n.objectApiName,{rows:n.rows,byThePlatform:0}]));for(let{objectApiName:n,rows:r}of e.leftOut?.byThePlatform??[]){let o=t.get(n)??{rows:0,byThePlatform:0};t.set(n,{rows:o.rows+r,byThePlatform:o.byThePlatform+r})}return t}function ft(e){return new Set([...ur(e)].flatMap(([t,{rows:n}])=>n>0?[t]:[]))}function Ws(e,t,n){let r=ur(e),o=new Map;for(let s of t){let{rows:a,byThePlatform:d}=r.get(s.objectApiName)??{rows:0,byThePlatform:0};if(a===0)continue;let l=o.get(s.limit)??{limit:s.limit,objects:[],emails:0,verdict:"fits"};l.objects.push({objectApiName:s.objectApiName,rows:a,perRecord:s.perRecord,sentBy:s.sentBy,...d>0?{byThePlatform:d}:{}}),l.emails+=a*s.perRecord,o.set(s.limit,l)}let i=ve(n)?n.unread:void 0;return[...o.values()].map(s=>{if(i!==void 0||ve(n))return{...s,verdict:"unread",unread:i};let a=n[s.limit];return a?{...s,verdict:s.emails>a.remaining?"exceeds":"fits",remaining:a.remaining,max:a.max}:{...s,verdict:"unread",unread:`the org's limits list no ${s.limit}`}})}function ve(e){return typeof e.unread=="string"}function Gs(e,t,n){let r=!ve(n)&&dr(n),o=!ve(n)&&Ds(n),i=Ws(e,Ls(t,r,o),n);if(!r)return i;let s=ft(e);return t.some(d=>d.limit==="DailyWorkflowEmails"&&s.has(d.objectApiName))?i.map(d=>d.limit==="SingleEmail"?{...d,alertsCounted:!0}:d):i}async function Nd(e){if(e.plan.totalRows===0||e.objects.length===0)return{checks:[]};let t;try{t=await e.readAutomation(e.objects)}catch(s){return{checks:[],unread:`the target's automation: ${N(s)}`}}let n=Us(t,qs(e.plan)),r=n!==void 0?{unread:n}:{},o=an(t);if(o.length===0)return{checks:[],...r};let i=await e.readLimits().catch(s=>({unread:N(s)}));return{checks:Gs(e.plan,o,i),...r}}function qs(e){let t=ft(e);return(n,r)=>r==="insert"&&t.has(n)}function Us(e,t,n="the target's"){let r=[lr(e.unread,n),Qs(e,t)].filter(o=>o!==void 0).join("; ");return r!==""?r:void 0}var Vs={flows:"flows",processes:"processes",workflowRules:"workflow rules"};function lr(e,t){let n=e.flatMap(({part:r,reason:o})=>{let i=Vs[r];return i!==void 0?[`${t} ${i}: ${o}`]:[]});return n.length>0?n.join("; "):void 0}var K=10;function zs(e){if(e.condition!=="unreadable")return;let t=e.apiName.indexOf("__");return t>0?e.apiName.slice(0,t):void 0}function Qs(e,t){let n=e.objects.flatMap(o=>{let s=[...new Set(he(o).filter(d=>t(o.objectApiName,d.write)).flatMap(d=>d.fired).flatMap(({flow:d,keptQuiet:l})=>d!==void 0&&l!==!0&&d.condition!=="read"&&d.timing!=="beforeSave"?[d]:[]))].map(d=>{let l=zs(d);return l!==void 0?`${d.label} (package ${l}, whose flows the org lets no one read)`:d.label});if(s.length===0)return[];let a=s.length>K?` and ${s.length-K} more`:"";return[{count:s.length,words:`${s.slice(0,K).join(", ")}${a} on ${o.objectApiName}`}]});return n.length===0?void 0:`the definition${n.reduce((o,{count:i})=>o+i,0)===1?"":"s"} of ${n.map(({words:o})=>o).join("; ")}`}function Md(e){return{limit:e.limit,emails:e.emails,remaining:e.remaining??0,max:e.max??0,objects:e.objects.map(({objectApiName:t,perRecord:n})=>({objectApiName:t,perRecord:n})),...e.alertsCounted?{alertsCounted:!0}:{}}}function xd(e){return{limit:e.limit,emails:e.emails,unread:e.unread??""}}var Hs={SingleEmail:{one:"single email",more:"single emails"},DailyWorkflowEmails:{one:"workflow email",more:"workflow emails"}};function cr(e,t){let n=Hs[t];return`${e} ${e===1?n.one:n.more}`}function Ks(e,t){return e.alertsCounted?`, its email alerts among them: ${t} counts them against its single emails, as a Developer Edition does`:""}function Cd(e,t){let n=e.filter(o=>o.verdict==="exceeds");if(n.length===0)return;let r=n.map(o=>`about ${cr(o.emails,o.limit)}`+(o.alertsCounted?" (its email alerts among them, as a Developer Edition counts them)":"")+`, ${o.remaining??0} of ${o.max??0} left today`).join("; ");return`The target's automation would make ${t} send ${r}: 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. Assign the user a bypass that keeps what sends quiet \u2014 muting the target's automation for the run (--mute-automation on the command line, the Mute box on a page) assigns, for the run alone, those the target's flows test \u2014 or write fewer records.`}function jd(e,t){return e.map(n=>{let r=n.objects.map(i=>`${i.perRecord} per ${i.objectApiName}, by ${i.sentBy.join(", ")}`+(i.byThePlatform?`; ${i.byThePlatform} ${i.objectApiName} written by the platform with ${te(i.objectApiName)}, whose flows run all the same`:"")).join("; "),o=` emails: these records make ${t} send about ${cr(n.emails,n.limit)} (${r})`+Ks(n,t);return n.verdict==="unread"?`${o}; what it has left today could not be read (${n.unread??""})`:n.verdict==="fits"?`${o}; it has ${n.remaining??"?"} of ${n.max??"?"} left today`:`${o}, more than the ${n.remaining??"?"} of ${n.max??"?"} it has left today: past them the action fails, and a record whose flow fails in the save is refused (CANNOT_EXECUTE_FLOW_TRIGGER). A bypass that keeps the flow quiet, or a smaller run, avoids it`})}var fr="EMAILS_NOT_ACCEPTED";function _d(e,t={}){let n=[lr(e,"the target's"),...t.applyAssignmentRules===!0?e.filter(({part:r})=>r==="assignmentRules").map(({reason:r})=>`the target's assignment rules: ${r}`):[]].filter(r=>r!==void 0);return n.length>0?n.join("; "):void 0}function Id(e){return"requests"in e&&typeof e.requests=="number"?Math.max(0,e.requests):Jn}function Dd(e){let t=e?.read?.requests??0;return t>0?{deliverability:t}:{}}var gr={clone:{run:"this clone",allTheSame:"to clone all the same"},sync:{run:"this sync",allTheSame:"to sync all the same"},seed:{run:"this seed",allTheSame:"to seed all the same"},autopilot:{run:"this Autopilot run",allTheSame:"to run it all the same"},rewind:{run:"this rewind",allTheSame:"to rewind all the same"},undo:{run:"this undo",allTheSame:"to undo all the same"},masking:{run:"this masking",allTheSame:"to mask all the same"},restore:{run:"this restore",allTheSame:"to restore all the same"},cleanup:{run:"this cleanup",allTheSame:"to delete all the same"},empty:{run:"this emptying",allTheSame:"to empty all the same"},load:{run:"this load",allTheSame:"to load all the same"}},Xs={flow:"flow",process:"process",workflowRule:"workflow rule",assignmentRule:"assignment rule"},Ys={email:"",notRead:" (its definition was not read)",assignment:" (applied: it can mail the owner it assigns)"};function pr(e){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function re(e){let t=new Map;for(let n of e){let r=t.get(n.objectApiName)??[];r.push(`${Xs[n.kind]} "${n.name}"${Ys[n.why]}`),t.set(n.objectApiName,r)}return[...t].map(([n,r])=>{let o=r.length>K?[...r.slice(0,K),`${r.length-K} more`]:r;return`${pr(o)} on ${n}`}).join("; ")}var Qn="read with one line of anonymous Apex that sends nothing";function mr(e){return"level"in e&&e.level==="withheld"}function Js(e){return"unread"in e?`deliverability: not read (${e.unread}) \u2014 the run is refused without --accept-emails, as on All email`:e.level==="all"?`deliverability: All email \u2014 the emails of what still runs go out (${Qn})`:`deliverability: System email only or No access \u2014 none of the emails its flows, processes, workflow rules and Apex send goes out, and the org still counts them against its daily email limits (${Qn})`}function Zs(e,t){let{run:n,allTheSame:r}=gr[e.run],{target:o}=e,i=re(e.senders),s=e.sendersUnread,a=i!==""?`what still runs as ${n} writes its records sends some: ${i}`+(s!==void 0?`; what could not be read may send more (${s})`:""):`what runs as ${n} writes its records could not all be read (${s??""}), so it may send some`,d=[];"unread"in t?d.push(`Whether ${o} delivers the emails its automation sends could not be read (${t.unread}), and ${a}.`,`Nothing was written. Add --accept-emails ${r}, or check Setup > Deliverability: on System email only or No access, none of them goes out.`):d.push(`${o} delivers every email its automation sends (Setup > Deliverability: All email), and ${a}.`,e.keepsAddresses===!0?`They go to the addresses the records and the alerts name: those of the records ${n} writes, as they hold them, the records' owners, the records already in ${o}, and an address an alert names.`:`They go to the addresses the records and the alerts name: those ${n} writes are under .invalid, but not the records' owners, the records already in ${o}, nor an address an alert names.`,`Nothing was written. Add --accept-emails ${r}, set the org's deliverability to System email only, or turn off what sends them.`);let l=e.muteQuiets??[];if(l.length>0){let u=new Set(l.map(g=>`${g.objectApiName}\0${g.kind}\0${g.name}`)),f=e.senders.filter(g=>!u.has(`${g.objectApiName}\0${g.kind}\0${g.name}`));d.push(`--mute-automation keeps quiet ${re(l)}, which ${l.length===1?"tests":"test"} a bypass a permission set of ${o} holds`+(f.length>0?`; it cannot quiet ${re(f)}.`:"."))}return d.join(" ")}function Ld(e){if(e.senders.length===0&&e.sendersUnread===void 0)return{verdict:"nothingSends",confirmation:{}};let t=e.reading??{unread:"the run did not read it"},n={reading:t,senders:[...e.senders],...e.sendersUnread!==void 0?{sendersUnread:e.sendersUnread}:{}},r=Js(t);return mr(t)?{verdict:"withheld",deliverability:n,confirmation:{},line:r,audit:"withheld"}:{verdict:"asks",deliverability:n,confirmation:{deliverability:e.keepsAddresses===!0?{...n,keepsAddresses:!0}:n},...e.accepted?{}:{stop:{code:fr,message:Zs(e,t)}},line:r,audit:"unread"in t?"unread":"all"}}function Wd(e,t){let n=ft(t);return e.filter(r=>!n.has(r.objectApiName))}function Gd(e){if(e.length===0)return;let t=[...new Set(e.map(n=>n.objectApiName))];return` emails: ${re(e)} send nothing: the run writes no ${pr(t)} record. A real run is refused all the same, and names them: it asks before it reads which records it writes`}function qd(e){let t=d=>`${d.objectApiName}\0${d.kind}\0${d.name}`,n=new Set(e.planned.map(t)),r=e.held.filter(d=>!n.has(t(d)));if(r.length===0||e.accepted)return;let o=e.reading;if(o!==void 0&&mr(o))return;let{run:i,allTheSame:s}=gr[e.run],a=o===void 0?`whether ${e.target} delivers them was not read, as nothing that sends one was to run`:"unread"in o?`whether ${e.target} delivers them could not be read (${o.unread})`:`${e.target} delivers every one of them (All email)`;return{code:fr,relit:r,message:`The mute's lease does not hold every permission set it was to assign, and what they were to keep quiet still runs for ${i}: ${re(r)} may send emails, and ${a}. The run's question did not ask about them. Nothing was written. Add --accept-emails ${s}, or run it again once the lease can assign them.`}}function Ud(e){return e.verdict==="unread"?{estimateMB:e.estimateMB,unread:e.unread}:{estimateMB:e.estimateMB,maxMB:e.maxMB,remainingMB:e.remainingMB,near:e.verdict==="near"}}function L(e){return ut(e,e<10?2:1)}function ut(e,t){if(e<=0)return"0";let n=10**t;return(Math.ceil(e*n-1e-9)/n).toString()}function hr(e,t){let n={over:e<10?2:1,bound:t<10?2:1};for(;;){let r={over:ut(e,n.over),bound:ut(t,n.bound)},o=Math.max(n.over,n.bound);if(Number(r.over)>Number(r.bound)||o>=6)return r;n={over:o+1,bound:o+1}}}function yr(e){return e.map(({objectApiName:t,kind:n,name:r})=>({objectApiName:t,kind:n,name:r}))}function ei(e){return yr(Je(e,"insert"))}function ti(e,t){let n=new Set(t);return yr(Je(e,"update",r=>n.has(r)))}var wr=["lookups","statuses","invitees","retry","upsert"];function Vd(e,t={}){let n=lt(e,t.leftOut),r=new Set(n),o=new Map,i=(u,f)=>{if(!r.has(u))return;let g=o.get(u)??new Set;g.add(f),o.set(u,g)},s=e.edges.filter(u=>On(u)&&r.has(u.sourceObject)&&r.has(u.targetObject)),a=new Map;for(let{sourceObject:u,targetObject:f}of s)u!==f&&a.set(u,[...a.get(u)??[],f]);let d=(u,f)=>{let g=new Set([u]),p=[u];for(let m=p.shift();m!==void 0;m=p.shift())for(let w of a.get(m)??[]){if(w===f)return!0;g.has(w)||(g.add(w),p.push(w))}return!1},l=s.filter(u=>u.required!==!0&&u.insertOnly!==!0);for(let{sourceObject:u,targetObject:f}of l)(u===f||d(f,u))&&i(f,"lookups");for(let u of Object.keys(cn))i(u,"statuses");for(let u of Object.keys(ln))i(u,"invitees");if(t.retry===!0)for(let{sourceObject:u,targetObject:f}of l)u!==f&&i(f,"retry");if(t.upsert===!0)for(let u of n)i(u,"upsert");return n.flatMap(u=>{let f=o.get(u);return f?[{objectApiName:u,steps:wr.filter(g=>f.has(g))}]:[]})}function ni(e){let t=new Set(e.flatMap(n=>n.steps));return wr.filter(n=>t.has(n))}function zd(e,t=[]){let n=new Set(t);return dn(e,(r,o)=>o==="insert"||o==="update"&&n.has(r))}function Qd(e,t,n){let r=new Set(ye(e).map(s=>s.toLowerCase())),o=t.filter(s=>!r.has(s.toLowerCase())),i=be(e,o);return o.map(s=>{let a=i.find(l=>l.permission.toLowerCase()===s.toLowerCase()),d=a?.permissionSet?.name;return{permission:s,...d?{permissionSet:d}:{},others:a?.others.map(l=>l.name)??[],...a&&!d?{noneHolds:!0}:{},...d&&n?.alias&&n.username?{command:Re(d,n.alias,n.username)}:{}}})}function ri(e){return e==="flows"||e==="triggers"||e==="processes"||e==="workflowRules"||e==="automation"}function ie(e){return e.unread.flatMap(({part:t,reason:n})=>ri(t)?[{part:t,reason:n}]:[])}var Hd="OWNER_MAP_INACTIVE",Kd="OWNER_MAP_UNKNOWN",V=class e extends Error{code;storage;ceiling;reason;api;readBound;sample;roots;constructor(t,n,r,o,i,s){super(n),this.name="ForgeRunGateError",this.code=t,r&&(this.storage=r),o!==void 0&&(this.ceiling=o),i!==void 0&&(this.reason=i),s?.api&&(this.api=s.api),s?.readBound&&(this.readBound=s.readBound),s?.sample&&(this.sample=s.sample),s?.roots&&(this.roots=s.roots)}static of(t){return new e(t.code,t.message,t.storage,void 0,t.refusal?.code,{...t.api?{api:t.api}:{},...t.readBound?{readBound:t.readBound}:{},...t.sample?{sample:t.sample}:{},...t.roots?{roots:t.roots}:{}})}get stop(){if(zt(this.code))return{code:this.code,...this.storage?{storage:this.storage}:{},...this.ceiling!==void 0?{ceiling:this.ceiling}:{},...this.reason!==void 0&&this.code===Pe?{reason:this.reason}:{},...this.api&&this.code===ne?{api:this.api}:{},...this.readBound&&this.code==="READ_BOUND_EXCEEDED"?{readBound:this.readBound}:{},...this.sample?{sample:this.sample}:{},...this.roots&&(oi.has(this.code)||this.code==="STORAGE_EXCEEDED")?{roots:this.roots}:{}}}},oi=new Set(["ROOTS_QUERY_REFUSED","NO_ROOTS","ROOTS_EXCEEDED","ROOTS_PLAN_MISMATCH","ROOTS_PLAN_GONE"]);function Xd(e){return e instanceof V||e instanceof Error&&e.name==="ForgeRunGateError"&&typeof e.code=="string"}var Hn="FILE_STORAGE_EXCEEDED";function Yd(e){if(!(e instanceof Error)||e.name!=="ForgeFilesRefusedError")return;let{code:t,storage:n}=e;if(t===rr||t===or)return new V(t,e.message);let r=n?.neededBytes,o=n?.remainingBytes;if(t!==Hn||typeof r!="number"||typeof o!="number"||!Number.isFinite(r)||!Number.isFinite(o))return;let i=o/1048576;return new V(Hn,e.message,{estimateMB:Number(hr(r/1048576,i).over),remainingMB:i,kind:"files"})}function si(e,t){if(e.verdict==="exceeds")return`The records to write take ${Ne(e)}, and ${t} has ${e.remainingMB} MB left of ${e.maxMB} MB: leave objects out, lower the records per object, or free data storage in ${t}.`}var Kn=10;function Jd(e,t,n){let r=[`write gate: ${e.totalRows} record(s) to write to ${n}, ${Ne(t)}`];for(let i of e.objects.slice(0,Kn))r.push(` ${i.objectApiName.padEnd(42)}${String(i.rows).padStart(8)}`);let o=e.objects.slice(Kn);if(o.length>0){let i=o.reduce((s,a)=>s+a.rows,0);r.push(` and ${o.length} more object(s), ${i} record(s)`)}for(let{objectApiName:i,mayAdd:s}of e.objects)s!==void 0&&r.push(` counted in: up to ${s} ${i} record(s) the run may read as it writes them, a price in the currency of the record its lines belong to, the source's own beside the one read`);for(let{objectApiName:i,mayBeByThePlatform:s}of e.objects)s!==void 0&&r.push(` counted in: up to ${s.rows} ${i} record(s) the platform `+(s.before===!0?`may have written with ${te(i)}, in the run this one takes up`:`may write itself with ${te(i)}`)+", which the run then links to and does not send");r.push(...ii(e.leftOut));for(let{objectApiName:i,field:s,rows:a}of e.leftEmpty??[])r.push(` written empty: ${i}.${s} on ${a} record(s), the record it names held back by the run, never written`);return t.verdict==="unread"?(r.push(` the data storage ${n} has left could not be read (${t.unread}): whether the records fit is not known`),r):(r.push(` data storage of ${n}: ${t.remainingMB} MB left of ${t.maxMB} MB`),t.verdict==="near"&&r.push(` that is more than ${Math.round(Zn*100)} % of what ${n} has left: Salesforce counts storage a while after a load, so less may be left than it says`),r)}function ii(e){if(!e)return[];let t=[];e.writtenBefore>0&&t.push(` not counted: ${e.writtenBefore} record(s) the run it retries or resumes wrote, which it links to and does not write again`);for(let{objectApiName:n,rows:r}of e.heldBack)t.push(` not counted: ${n}, ${r} record(s), held back for a record type closed to the user the run writes as`);for(let{objectApiName:n,rows:r}of e.recordTypeNotInTarget??[])t.push(` not counted: ${n}, ${r} record(s), held back for a record type the target has none of, which it would refuse`);for(let{objectApiName:n,rows:r}of e.withoutParent??[])t.push(` not counted: ${n}, ${r} record(s) held back with a record they cannot be written without, held back itself`);for(let{objectApiName:n,rows:r}of e.noParentInSource??[])t.push(` not counted: ${n}, ${r} record(s) left aside: a lookup they may not leave empty names a record the source does not hold, which no copy can write`);for(let{objectApiName:n,rows:r}of e.outsideFilter??[])t.push(` not counted: ${n}, ${r} record(s) left aside: a lookup they may not leave empty names a record outside its object's filter, which the run does not copy`);for(let{objectApiName:n,rows:r}of e.byThePlatform??[])t.push(` not counted: ${n}, ${r} record(s) written by the platform with ${te(n)}, which the run links to and does not send`);for(let{objectApiName:n,rows:r,fields:o}of e.linkedByValue??[])t.push(` not counted: ${n}, ${r} record(s) the target holds under the same ${o.join(", ")}, which the run links to and does not create`);for(let{objectApiName:n,rows:r}of e.linkedToTarget??[])t.push(` not counted: ${n}, ${r} record(s), the standard price book: linked to the target's own, never written`);for(let{objectApiName:n,rows:r}of e.currencyReplaced??[])t.push(` not counted: ${n}, ${r} record(s) in a currency the target lacks, replaced by the source's own price in the currency written, for the same product and price book`);return t}var ai={flow:e=>`flow "${e}" runs before a record is deleted, and can refuse the delete`,trigger:e=>`Apex trigger ${e} runs on a delete, and can refuse it`,packageTrigger:e=>`Apex trigger ${e}, installed by a managed package, runs on a delete and can refuse it; no one in the org can change it`,lock:()=>"once activated, a record locks the records under it, which a removal then takes only with it, or once it is back in Draft"},di=["flows","triggers"];function Zd(e,t,n=[],r="--remove"){let o=di.filter(s=>n.some(a=>a.part===s)),i=o.length===0?[]:[` ${o.map(s=>_[s]).join(" and ")} could not be read: whether one refuses the removal is not known`];if(e.length===0&&o.length===0)return[`reversibility: nothing found in ${t} that refuses a removal of this run's records (no flow before a delete, no Apex trigger on one, no record that locks past Draft)`];if(e.length===0){let s=[...o.includes("flows")?[]:["no flow before a delete"],...o.includes("triggers")?[]:["no Apex trigger on a delete"],"no record that locks past Draft"];return[`reversibility: nothing found in ${t} that refuses a removal of this run's records in what could be read (${s.join(", ")})`,...i]}return[`reversibility: a removal of this run's records (${r}) may be refused in ${t}:`,...e.map(({objectApiName:s,kind:a,name:d})=>` ${s}: ${ai[a](d??"")}`),...i]}var _={flows:"the flows",triggers:"the Apex triggers",processes:"the Process Builder processes",workflowRules:"the workflow rules",automation:"the automation"};function W({kind:e,name:t}){return e==="flow"?`flow "${t}"`:e==="process"?`process "${t}"`:e==="workflowRule"?`workflow rule "${t}"`:`Apex trigger ${t}`}var ui={lookups:"a lookup filled in once its record exists",statuses:"an order or a contract given back its status after it went in as a draft",invitees:"an event's invitee given its answer",retry:"a lookup the run it retries left empty filled in",upsert:"a record the target holds written over by --upsert"};function X(e){return e.map(t=>`${t.objectApiName}: ${W(t)}`).join("; ")}function gt(e,t,n){return e.flatMap(r=>{if(r.command){let o=r.others.length>0?`; ${r.others.join(", ")} hold${r.others.length===1?"s":""} it too`:"";return[`${r.permissionSet} is the smallest permission set of ${t} that holds ${r.permission}${o}. Assigned to the user ${n} writes as, it keeps quiet what ${r.permission} excludes: ${r.command}`]}return r.noneHolds?[`No permission set of ${t} holds ${r.permission}: an admin creates one that includes it, and assigns it to the user ${n} writes as.`]:[]})}function pt(e,t,n){let r=[...new Set(e.flatMap(o=>o.permissionSet??[]))];return!n||r.length===0?[]:[`With --mute-automation, the ${t} assigns ${r.join(", ")} to the user it writes as for the ${t} alone, under a lease, and what ${r.length===1?"it keeps":"they keep"} quiet does not fire.`]}function eu(e,t,n={}){let r=n.updated??[],o=ei(e),i=ti(e,r.map(l=>l.objectApiName)),s=ie(e);if(o.length===0&&i.length===0&&s.length===0)return;let a=[];if(o.length>0&&a.push(`${t} runs automation on the records this clone inserts: ${X(o)}.`),i.length>0){let l=ni(r.filter(u=>i.some(f=>f.objectApiName===u.objectApiName))).map(u=>ui[u]);a.push(`${t} runs automation as this clone updates records it inserted (${l.join("; ")}): ${X(i)}.`)}let d=r.length>0?"inserts and updates":"inserts";for(let{part:l,reason:u}of s)a.push(`${_[l][0].toUpperCase()}${_[l].slice(1)} of ${t} could not be read (${u}), so what fires as the clone ${d} is not known.`);return a.push(...gt(n.assign??[],t,"the clone")),a.push(...pt(n.assign??[],"clone",n.mayMute===!0)),a.push(`Nothing was written. Add --accept-automation to clone all the same, or turn that automation off in ${t} first.`),a.join(" ")}function tu(e,t,n={}){let r=Ze(e,n.drafted??[]),o=ie(e);if(r.length===0&&o.length===0)return;let i=[],s=r.filter(d=>d.write==="update"),a=r.filter(d=>d.write==="delete");if(a.length>0){let d=a.map(l=>`${l.objectApiName}: ${W(l)} (${oe[l.when]})`);i.push(`${t} runs automation on the records this removal deletes: ${d.join("; ")}.`)}s.length>0&&i.push(`${t} runs automation as this removal sets activated records back to Draft, the only way the platform deletes them: ${X(s)}.`);for(let{part:d,reason:l}of o)i.push(`${_[d][0].toUpperCase()}${_[d].slice(1)} of ${t} could not be read (${l}), so what fires as the removal deletes is not known.`);return i.push(...gt(n.assign??[],t,"the removal")),i.push(...pt(n.assign??[],"removal",n.mayMute===!0)),i.push(`Nothing was deleted. Add --accept-automation to remove all the same, or turn that automation off in ${t} first.`),i.join(" ")}var oe={before:"before delete",after:"after delete",beforeAndAfter:"before and after delete"};function nu(e,t,n,r){let o=[`removal automation: what ${t} runs as the removal takes the records back`];for(let s of Ze(e,r))o.push(s.write==="delete"?` ${s.objectApiName}: ${oe[s.when]}: ${W(s)}`:` ${s.objectApiName}: set back to Draft before its delete: ${W(s)}`);let i=ie(e);o.length===1&&i.length===0&&o.push(` nothing fires on the ${n} object(s) it deletes records of`);for(let{part:s,reason:a}of i)o.push(` ${_[s]} could not be read: ${a}`);return o}var li={bringBack:"brought back from the recycle bin",recreate:"made again with a new Id",giveBack:"given back its values from before the run",setToDraft:"set back to Draft before its delete"};function ru(e,t,n,r="removal",o){let i=ie(e),s=(a,d)=>{let l=[ci[d](t)];for(let u of we(e,a))l.push(u.step==="delete"?` ${u.objectApiName}: ${oe[u.when]}: ${W(u)}`:` ${u.objectApiName}: ${li[u.step]}: ${W(u)}`);if(l.length===1&&i.length===0){let u=new Set(Object.values(a).flat()).size,f=fi.has(d)?"deletes":"writes";l.push(` nothing fires on the ${u} object(s) it ${f} records of`)}return l};return[...s(n,r),...o?s(o,br(r)):[],...i.map(({part:a,reason:d})=>` ${_[a]} could not be read: ${d}`)]}var ci={removal:e=>`removal automation: what ${e} runs as the removal takes the run back`,reload:e=>`reload automation: what ${e} runs as the reload purges what earlier loads created`,reloadSweep:e=>`reload automation: what ${e} runs as the reload's sweep deletes what the target's automation made for the loads it replaces`,replayAgain:e=>`replay automation: what ${e} runs as the replay purges what earlier replays created`,replayAgainSweep:e=>`replay automation: what ${e} runs as the replay's sweep deletes what the target's automation made for the replays it replaces`};function ou(e,t,n){let r=we(e,n.steps),o=n.sweep?we(e,n.sweep):[],i=ie(e);if(r.length===0&&o.length===0&&i.length===0)return;let s=l=>r.filter(u=>u.step===l),a=Xn[n.subject??"removal"],d=[];if(s("bringBack").length>0&&d.push(`${t} runs automation as ${a.this} brings back from the recycle bin what the run deleted: ${X(s("bringBack"))}.`),s("giveBack").length>0&&d.push(`${t} runs automation as ${a.this} gives the records the run wrote over their values from before it: ${X(s("giveBack"))}.`),s("setToDraft").length>0&&d.push(`${t} runs automation as ${a.this} sets activated records back to Draft, the only way the platform deletes them: ${X(s("setToDraft"))}.`),s("delete").length>0){let l=s("delete").map(u=>`${u.objectApiName}: ${W(u)} (${oe[u.when]})`);d.push(`${t} runs automation on the records ${a.this} deletes: ${l.join("; ")}.`)}if(o.length>0){let l=o.map(u=>`${u.objectApiName}: ${W(u)} (${oe[u.when]})`);d.push(`${t} runs automation on the records ${Xn[br(n.subject??"removal")].this} deletes: ${l.join("; ")}.`)}for(let{part:l,reason:u}of i)d.push(`${_[l][0].toUpperCase()}${_[l].slice(1)} of ${t} could not be read (${u}), so what fires as ${a.the} writes is not known.`);return d.push(...gt(n.assign??[],t,a.who)),d.push(...pt(n.assign??[],a.run,n.mayMute===!0)),d.push(`Nothing was written or deleted. Add --accept-automation to ${a.verb} all the same, or turn that automation off in ${t} first.`),d.join(" ")}var fi=new Set(["reloadSweep","replayAgainSweep"]);function br(e){return e==="replayAgain"||e==="replayAgainSweep"?"replayAgainSweep":"reloadSweep"}var Xn={removal:{this:"this removal",the:"the removal",who:"the removal",run:"removal",verb:"remove"},reload:{this:"this reload's purge",the:"the reload's purge",who:"the reload",run:"reload",verb:"reload"},reloadSweep:{this:"this reload's sweep",the:"the reload's sweep",who:"the reload",run:"reload",verb:"reload"},replayAgain:{this:"this replay's purge",the:"the replay's purge",who:"the replay",run:"replay",verb:"replay again"},replayAgainSweep:{this:"this replay's sweep",the:"the replay's sweep",who:"the replay",run:"replay",verb:"replay again"}};var pi=2e3,mi=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function Sr(e,t){let n=e!==void 0&&Number.isFinite(e)?Math.floor(e):t;return Math.min(pe,Math.max(1,n))}function cu(e){return e===void 0||!Number.isFinite(e)?pi:Math.max(1,Math.floor(e/10))}function Er(e){return e!==void 0&&Number.isFinite(e)&&e>=1?Math.floor(e):Vt}function fu(e){let t=Yt(e);if(t!==void 0)return{issue:t};let n=Ht(e);return n?{objectApiName:n.objectApiName,query:{...n.where!==null?{where:n.where}:{},...n.orderBy!==null?{orderBy:n.orderBy}:{},...n.limit!==null?{limit:n.limit}:{}}}:{issue:{kind:"noObject"}}}function gu(e){if(e.where!==void 0&&!Kt.safeParse(e.where).success)return{kind:"where"};if(e.orderBy!==void 0&&!Xt.safeParse(e.orderBy).success)return{kind:"orderBy"};if(e.limit!==void 0&&!(Number.isInteger(e.limit)&&e.limit>=1&&e.limit<=pe))return{kind:"limit"}}function pu(e,t,n,r){let o=et(e),i=[...t.where!==void 0?[`(${t.where})`]:[],...n!==void 0&&n!==""?[`(${n})`]:[]],s=i.length>0?` WHERE ${i.join(" AND ")}`:"",a=t.limit!==void 0&&t.limit<=r?t.limit:r+1;return`SELECT Id FROM ${o}${s} ORDER BY ${t.orderBy??"Id"} LIMIT ${a}`}function hi(e,t,n){return!Number.isFinite(e)||e<1||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0?0:Math.max(0,Math.min(Math.floor(e)-1,Math.floor(n*e/t)))}function mu(e,t,n){let r=t.where!==void 0?` WHERE ${t.where}`:"";return`SELECT Id FROM ${et(e)}${r} ORDER BY ${t.orderBy??me} LIMIT ${Math.max(1,Math.floor(n))}`}function hu(e,t,n){if(e.verdict!=="exceeds")return;let r=hi(n.count,e.estimateMB,e.remainingMB),o=`the ${n.count} ${n.objectApiName} records the query chooses`,i=r>=1?`about ${r} of ${o} fit, each with what its clone copies: a LIMIT of ${r} in the query clones that many \u2014 after ORDER BY ${me}, the newest \u2014, or narrow its WHERE; or leave objects out, or free data storage in ${t}.`:`one of ${o} takes more than that by itself, with what its clone copies: leave objects out, clone less deep, or free data storage in ${t}.`;return{code:"STORAGE_EXCEEDED",message:`The records to write take ${Ne(e)}, and ${t} has ${e.remainingMB} MB left of ${e.maxMB} MB: ${i} ${G}`,storage:{estimateMB:Number(L(e.estimateMB)),remainingMB:e.remainingMB},...Y(n.objectApiName).roots?{roots:{objectApiName:n.objectApiName,...r>=1?{fits:r}:{}}}:{}}}function yi(e){let t=new Set,n=[];for(let r of e){let o=Sn(r);t.has(o)||(t.add(o),n.push(r))}return n.sort(En)}function Rr(e){return gi("sha256").update(yi(e).join(`
8
- `)).digest("hex")}function yu(e){return mi.test(e)}function wi(e,t){let n=r=>r===void 0?void 0:r.replace(/\s+/g," ").trim();return n(e?.where)===n(t?.where)&&n(e?.orderBy??"Id")===n(t?.orderBy??"Id")&&e?.limit===t?.limit}function wu(e,t){if(e.sourceOrgId!==t.sourceOrgId)return"otherOrg";if(e.objectApiName.toLowerCase()!==t.objectApiName.toLowerCase()||t.query!==void 0&&!wi(e.query,t.query)||t.ids!==void 0&&Rr(t.ids)!==e.sha256)return"otherQuery";if(Rr(e.ids)!==e.sha256)return"changed"}var G="Nothing was written.";function Y(e,t={}){return e!==void 0&&/^[A-Za-z][A-Za-z0-9_]{0,79}$/.test(e)?{roots:{objectApiName:e,...t}}:{}}function bu(e,t){return{code:"ROOTS_QUERY_REFUSED",message:`${Jt(e)}. Nothing was read or written.`,...Y(t)}}function Ru(e,t,n){let r=t?.where!==void 0?` WHERE ${t.where}`:"";return{code:"NO_ROOTS",message:t===void 0?`None of the ${e} records named is in the source org: there is nothing to clone. ${G}`:`The query chooses no ${e} record of the source org: there is nothing to clone. Count what it chooses there with sf data query -q "SELECT COUNT() FROM ${e}${r}", and check its WHERE. ${G}`,...Y(e,{cap:n})}}function Su(e,t,n,r){let o=pe.toLocaleString("en-US"),i=n==="query"&&r?.orderBy!==void 0,s=`${i?"":`ORDER BY ${me} `}LIMIT ${t}`,a=n==="query"?`Give the query ${s}`+(r?.limit!==void 0?` in place of its LIMIT ${r.limit}`:"")+` to clone the first ${t} of its order, narrow its WHERE, or raise --max-roots (the sandforge.forge.maxRoots setting) up to ${o}; past that, copy a sample of the whole org with a filter on its roots.`:`Name ${t} at most, or raise --max-roots up to ${o}.`;return{code:"ROOTS_EXCEEDED",message:`The ${n==="query"?"query chooses":"records named are"} more than the ${t} ${e} records a run clones, and nothing holds ${n==="query"?"it":"them"} to that: refused before anything else was read, rather than cut at an order nobody chose. ${a} ${G}`,...Y(e,{cap:t,...i?{ordered:!0}:{}})}}var bi={otherOrg:"were read of another org than this run reads",otherQuery:"were chosen by another query, of another object, or are other records",changed:"are no longer the ids it was kept with"};function Eu(e,t){return{code:"ROOTS_PLAN_MISMATCH",message:`The records the dry run chose ${bi[t]}: run the dry run again with this query, and give the run the plan it keeps. ${G}`,...Y(e).roots?{roots:{objectApiName:e,plan:t}}:{}}}function Au(e){return{code:"ROOTS_PLAN_GONE",message:`The run this one resumes cloned the records a query chose, and its journal does not name them: reading the query again could choose others. Remove what it wrote, then run the clone again. ${G}`,...Y(e).roots?{roots:{objectApiName:e,plan:"gone"}}:{}}}function Tu(e,t,n){let r=n[n.length-1],o=r?` (${r.objectApiName} came to ${r.rows.toLocaleString("en-US")} after ${n.length} object${n.length===1?"":"s"})`:"";return{code:"READ_BOUND_EXCEEDED",message:`The ${e} roots reach more than ${t.toLocaleString("en-US")} records${o}, and a clone from records holds all it reads before it writes. Take fewer records (a LIMIT), clone less deep (--depth direct), leave objects out, or raise --max-read-total. `+G,readBound:{bound:t,objects:n.slice(0,200).map(i=>({...i})),of:"roots"}}}function Ou(e){let{bound:t,sent:n,next:r,objectApiName:o,sourceRequestsLeft:i}=e,s=i===void 0?"the source would not say what it has left today":`a tenth of the ${i.toLocaleString("en-US")} it has left today`;return{code:"API_BUDGET_EXCEEDED",message:`Reading what the ${e.roots} roots reach would send the source more than ${t.toLocaleString("en-US")} requests (${s}): ${n} sent, ${r} more for ${o}. Take fewer records, clone less deep (--depth direct), or leave objects out. ${G}`,api:{kind:"requests",org:"source",estimate:n+r,remaining:i??t,reading:{bound:t}}}}var mt=class{constructor(t,n){this.given=t;this.store=n}given;store;has(t){return this.given.has(t)||this.store?.mapping(t)?.earlier===!0}retried(t){return this.given.has(t)}get(t){let n=this.given.get(t);if(n!==void 0)return n;let r=this.store?.mapping(t);return r?.earlier?r.targetId:void 0}get from(){return this.given.size===0&&(this.store?.earlierMapped??0)>0?"resume":"retry"}get size(){return this.given.size+(this.store?.earlierMapped??0)}keys(){return this.given.keys()}[Symbol.iterator](){return this.given.entries()}};function q(e){return e!==void 0&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0}function Ar(e){let t=e?.roots,n=e?.rootObjectApiName??t?.objectApiName,r=!!(n&&(e?.rootRecordId||t));return{isScoped:r,dryRun:e?.dryRun??!1,referenceFallback:e?.referenceFallback??(r?"nullify":"keep"),rootRecordId:e?.rootRecordId,rootObjectApiName:n,...t&&n?{roots:{...t,objectApiName:n,cap:Sr(t.cap,Ut),readTotal:Er(t.readTotal)}}:{},recordTypeMappings:e?.recordTypeMappings,maxRecordsPerObject:e?.maxRecordsPerObject,referenceDataObjects:new Set(e?.referenceDataObjects??["BusinessHours","OperatingHours"]),expandOrphanParents:e?.expandOrphanParents??!1,maxOrphanParentExpansions:e?.maxOrphanParentExpansions??20,upsertMode:e?.upsertMode==="auto"?"auto":"off",writeApi:e?.writeApi==="auto"?"auto":"rest",fieldExclusions:e?.fieldExclusions??{},excludedObjects:new Set(e?.excludedObjects??[]),ownerMappings:e?.ownerMappings??{},objectSoqlFilters:e?.objectSoqlFilters,fieldMappings:e?.fieldMappings??{},anonymization:e?.anonymization,keepContactPoints:e?.keepContactPoints===!0,files:e?.files?{maxFileBytes:Math.min(e.files.maxFileBytes>0?e.files.maxFileBytes:10*1048576,35*1048576),acceptedAsIs:e.files.acceptedAsIs===!0}:void 0,writtenBefore:new mt(new Map(Object.entries(e?.writtenBefore??{})),e?.stream?.store),beforeWrite:e?.beforeWrite,stream:e?.stream?{pageSize:q(e.stream.pageSize),ceiling:q(e.stream.ceiling),resumeAfter:e.stream.resumeAfter?new Map(Object.entries(e.stream.resumeAfter)):e.stream.store?.checkpoints()??new Map,onPage:e.stream.onPage,...e.stream.store?{store:e.stream.store}:{},...e.stream.summaryBound!==void 0?{summaryBound:Math.max(0,Math.floor(e.stream.summaryBound))}:{},...q(e.stream.secondPassPageSize)!==void 0?{secondPassPageSize:q(e.stream.secondPassPageSize)}:{},...q(e.stream.writeWindow)!==void 0?{writeWindow:q(e.stream.writeWindow)}:{},...e.stream.everything===!0?{everything:!0}:{},...q(e.stream.wholeReadBound)!==void 0?{wholeReadBound:q(e.stream.wholeReadBound)}:{},...e.stream.sample&&e.stream.everything===!0?{sample:e.stream.sample}:{}}:void 0,decisions:new Oe(e?.decisions),recordTypeDecisions:new Map}}async function Tr(e,t){let{records:n,pages:r}=await gn(e,t);return{records:n,requests:r}}var Ei=25,Mr=15,Ce=5,je=25,yt=60,wt=20,Jn=6+yt+wt+1+6+1+20,ae=4,Ai="SELECT ApiName, Label, TriggerType, RecordTriggerType, TriggerObjectOrEvent.QualifiedApiName, ActiveVersionId, HasAsyncAfterCommitPath FROM FlowDefinitionView WHERE IsActive = true AND TriggerType IN ('RecordBeforeSave', 'RecordAfterSave', 'RecordBeforeDelete')",Ti="SELECT Name, NamespacePrefix, TableEnumOrId, EntityDefinition.QualifiedApiName, UsageBeforeInsert, UsageAfterInsert, UsageBeforeUpdate, UsageAfterUpdate, UsageBeforeDelete, UsageAfterDelete, UsageAfterUndelete FROM ApexTrigger WHERE Status = 'Active'",Oi="SELECT ApiName, Label, TriggerObjectOrEvent.QualifiedApiName, ActiveVersionId FROM FlowDefinitionView WHERE IsActive = true AND ProcessType = 'Workflow'",ki="SELECT Id, Name, NamespacePrefix, TableEnumOrId FROM WorkflowRule",Fi="SELECT Name, SobjectType FROM AssignmentRule WHERE Active = true",$i="SELECT DeveloperName, MasterLabel, SobjectType FROM DuplicateRule WHERE IsActive = true",Pi="SELECT DeveloperName, NamespacePrefix FROM UserSetupEntityAccess WHERE KeyPrefix = '0CP'";function Or(e){return`SELECT Metadata FROM Flow WHERE Id = '${e}'`}function Bi(e,t){if(t.length>Ce)throw new Error(`A Tooling composite holds ${Ce} queries, not ${t.length}`);return{allOrNone:!1,compositeRequest:t.map((n,r)=>({method:"GET",url:`${e}/tooling/query?q=${encodeURIComponent(n)}`,referenceId:`q${r}`}))}}function vi(e,t){if(t.length>je)throw new Error(`A Tooling composite retrieves ${je} records, not ${t.length}`);return{allOrNone:!1,compositeRequest:t.map(({sobject:n,id:r},o)=>{if(!D.test(r))throw new Error(`Not a record id: ${r}`);return{method:"GET",url:`${e}/tooling/sobjects/${n}/${r}`,referenceId:`r${o}`}})}}var xe="PROCESSING_HALTED",Ni=P({compositeResponse:ge(P({body:fe(),httpStatusCode:M(),referenceId:H()}).loose())}),Mi=P({records:ge(Ye(H(),fe()))}).loose(),xi=Ye(H(),fe()),Ci=ge(P({errorCode:H().optional(),message:H().optional()}).loose());function xr(e,t,n,r,o){let i=Ni.safeParse(e);if(!i.success)throw new Error("The org answered the Tooling composite with no composite answer");let s=new Map(i.data.compositeResponse.map(a=>[a.referenceId,a]));return Array.from({length:t},(a,d)=>{let l=s.get(`${n}${d}`);if(!l)return{refused:`The org gave no answer to this ${r} of the composite`};if(l.httpStatusCode<400){let g=o(l.body);return g?{records:g}:{refused:`The org answered with status ${l.httpStatusCode} and no rows`}}let u=Ci.safeParse(l.body),f=u.success?u.data[0]:void 0;return{refused:f?[f.errorCode,f.message].filter(Boolean).join(": "):`status ${l.httpStatusCode}`,...f?.errorCode===xe?{halted:!0}:{}}})}function ji(e,t){return xr(e,t,"q","query",n=>{let r=Mi.safeParse(n);return r.success?r.data.records:void 0})}function _i(e,t){return xr(e,t,"r","retrieve",n=>{let r=xi.safeParse(n);return r.success?[r.data]:void 0})}function Ii(e){return async t=>_i(await e.request({method:"POST",url:"/tooling/composite",body:JSON.stringify(vi(`/services/data/v${e.version}`,t)),headers:{"Content-Type":"application/json"}}),t.length)}function Iu(e){return{query:async(t,n)=>{let r=await e(t);return Tr({query:async o=>r.query(o),queryMore:async o=>r.queryMore(o)},n)},toolingQuery:async(t,n)=>{let r=await e(t);return Tr({query:async o=>r.tooling.query(o),queryMore:async o=>r.tooling.queryMore(o)},n)},toolingQueries:async(t,n)=>{let r=await e(t),o=await r.request({method:"POST",url:"/tooling/composite",body:JSON.stringify(Bi(`/services/data/v${r.version}`,n)),headers:{"Content-Type":"application/json"}});return ji(o,n.length)},toolingRetrieves:async(t,n)=>Ii(await e(t))(n)}}async function Di(e,t,n,r){let o=t.map(u=>({retrieving:r?u.queries.filter(f=>f.retrieve!==void 0):[],waiting:r?u.queries.filter(f=>f.retrieve===void 0):[...u.queries],left:u.requests})),i={retrieving:je,waiting:Ce},s=(u,f)=>{for(let g of o){let p=f.filter(m=>m.queue===g).map(m=>m.query);p.length>0&&g[u].unshift(...p)}},a=(u,f)=>{for(let g of o){let p=f.filter(m=>m.queue===g).map(m=>m.query);p.length===0&&g.retrieving.length===0||(g.reason??=u,g.waiting.unshift(...p,...g.retrieving.splice(0)))}},d=0,l=async()=>{for(;;){let u=o.find(A=>A.left>0&&(A.retrieving.length>0||A.waiting.length>0));if(!u)return;let f=u.retrieving.length>0?"retrieving":"waiting";u.left--,d++;let g=[];for(let A of o){if(A!==u&&A.left<=0)continue;let x=i[f]-g.length;if(x<=0)break;for(let $ of A[f].splice(0,x))g.push({query:$,queue:A})}let p;try{p=r&&f==="retrieving"?await r(g.map(({query:A})=>A.retrieve)):await e(g.map(({query:A})=>A.soql))}catch(A){let x=N(A);if(f==="retrieving")a(x,g);else for(let{query:$}of g)$.refused(x);continue}let m=f==="retrieving"?"retrieve":"query",w=[],b=[],R=0,O,T;if(g.forEach((A,x)=>{let $=p[x]??{refused:`The org gave no answer to this ${m} of the composite`};"records"in $?(A.query.take($.records),R++):$.halted?(w.push(A),O??=$.refused):f==="retrieving"?(b.push(A),T??=$.refused):A.query.refused($.refused)}),f==="retrieving"&&R===0){a(T??O??xe,g);continue}if(b.length>0){for(let{queue:A}of b)A.reason??=T;s("waiting",b)}if(w.length===0)continue;let C=g.length-w.length;if(C===0){for(let{query:A}of w)A.refused(O??xe);continue}i[f]=Math.min(i[f],C);for(let{queue:A}of w)A.reason=O;s(f,w)}};await Promise.all(Array.from({length:Math.max(1,n)},l));for(let u of o)for(let f of[...u.retrieving,...u.waiting])f.refused(u.reason??xe);return d}function Li(e){return`SELECT Metadata FROM WorkflowRule WHERE Id = '${e}'`}function Wi(e){return`SELECT FlowVersionViewId, ApiName, ObjectType FROM FlowVariableView WHERE FlowVersionViewId IN (${e.map(n=>`'${n}'`).join(", ")})`}function Gi(e){return`SELECT DurableId, QualifiedApiName FROM EntityDefinition WHERE QualifiedApiName IN (${e.map(n=>`'${n}'`).join(", ")})`}function qi(e){return`SELECT Id, DeveloperName, NamespacePrefix FROM CustomPermission WHERE DeveloperName IN (${e.map(n=>`'${n}'`).join(", ")})`}function Ui(e){return`SELECT SetupEntityId, ParentId, Parent.Name, Parent.Label, Parent.NamespacePrefix FROM SetupEntityAccess WHERE SetupEntityType = 'CustomPermission' AND SetupEntityId IN (${e.map(n=>`'${n}'`).join(", ")}) AND Parent.IsOwnedByProfile = false AND Parent.PermissionSetGroupId = null`}function Vi(e,t){let n=t.map(r=>`'${r}'`).join(", ");return`SELECT ParentId, COUNT(Id) n FROM ${e} WHERE ParentId IN (${n}) GROUP BY ParentId`}var D=/^[A-Za-z0-9]{15}([A-Za-z0-9]{3})?$/,bt=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,zi="myvariable_current",Qi={RecordBeforeSave:"beforeSave",RecordAfterSave:"afterSave",RecordBeforeDelete:"beforeDelete"},Hi={Create:"create",Update:"update",CreateAndUpdate:"createAndUpdate",Delete:"delete"},Cr={onCreateOnly:"create",onAllChanges:"createAndUpdate",onCreateOrTriggeringUpdate:"createAndUpdate"},Ki=[["UsageBeforeInsert","beforeInsert"],["UsageAfterInsert","afterInsert"],["UsageBeforeUpdate","beforeUpdate"],["UsageAfterUpdate","afterUpdate"],["UsageBeforeDelete","beforeDelete"],["UsageAfterDelete","afterDelete"],["UsageAfterUndelete","afterUndelete"]],Xi={emailAlert:"email",emailSimple:"email",customNotificationAction:"notification",outboundMessage:"outbound"},Yi={emailSimple:"SingleEmail",emailAlert:"DailyWorkflowEmails"},Ji={Alert:"email",OutboundMessage:"outbound"},Zi=new Set(["sms","mms","twilio","whatsapp","vonage","nexmo","messagebird","plivo","sinch"]);function Et(e){if(typeof e!="object"||e===null)return;let t=e.QualifiedApiName;return typeof t=="string"&&t!==""?t:void 0}var h=e=>typeof e=="string"?e:"";function S(e,t){return typeof e=="object"&&e!==null?e[t]:void 0}function v(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t):[]}function At(e,t,n,r){return{apiName:e,label:t||e,timing:n,startsOn:r,condition:"notRead",permissions:[],paths:[],messages:[],switches:[]}}function ea(e){let t=Et(e.TriggerObjectOrEvent),n=Qi[h(e.TriggerType)];if(!t||!n)return;let r=n==="beforeDelete"?"delete":Hi[h(e.RecordTriggerType)]??"createAndUpdate",o=h(e.ActiveVersionId),i=At(h(e.ApiName),h(e.Label),n,r);return e.HasAsyncAfterCommitPath===!0&&(i.paths=[{kind:"async"}]),{objectApiName:t,id:D.test(o)?o:null,flow:i}}function ta(e){let t=h(e.ActiveVersionId);return{objectApiName:Et(e.TriggerObjectOrEvent),id:D.test(t)?t:null,flow:At(h(e.ApiName),h(e.Label),"afterSave","createAndUpdate")}}function na(e){let t=Et(e.EntityDefinition)??(h(e.TableEnumOrId)||void 0),n=h(e.Name);if(!t||!n)return;let r=h(e.NamespacePrefix);return{objectApiName:t,trigger:{name:r?`${r}.${n}`:n,events:Ki.filter(([o])=>e[o]===!0).map(([,o])=>o)}}}function kr(e){return e.startsOn==="create"||e.startsOn==="createAndUpdate"?e.timing==="afterSave"?0:1:e.startsOn==="update"?2:3}function jr(e){let t=new Set(qr(JSON.stringify(e??null)).filter(o=>de(o)==="Permission").map(Rt));if(t.size===0)return[];let n=S(e,"filterFormula"),r=new Set((typeof n=="string"?ue(n):[]).filter(o=>de(o.reference)==="Permission"&&o.value===void 0).map(o=>Rt(o.reference)));return[...t].sort((o,i)=>o.localeCompare(i)).map(o=>({name:o,bypass:r.has(o)}))}function _r(e){return typeof e!="string"?[]:zr(ue(e)).filter(t=>de(t.reference)!=="Permission").map(t=>({...t,where:"start",bypass:!0}))}function ra(e){let t=S(e,"filterFormula");if(typeof t=="string"&&t.trim()!=="")return[...new Set(Ie(t).flatMap(r=>{let o=ia(r);return o?[o]:[]}))];let n=v(S(e,"filters"));return n.length===0||!aa(h(S(e,"filterLogic")),n.length)?[]:[...new Set(n.filter(r=>h(r.operator)==="IsNull"&&S(r.value,"booleanValue")===!1).map(r=>h(r.field)).filter(r=>oa.test(r)))]}var oa=/^[A-Za-z][A-Za-z0-9_]*$/,sa=/^(?:\{!\s*)?\$Record\.([A-Za-z][A-Za-z0-9_]*)\s*\}?$/i;function ia(e){let t=z(e,"NOT");if(t===void 0)return;let n=Ot(t),r=z(n,"ISBLANK")??z(n,"ISNULL");return r===void 0?void 0:sa.exec(r.trim())?.[1]}function aa(e,t){let n=e.trim().toLowerCase();if(n==="and"||t===1&&n!=="or")return!0;if(!/^\d+(\s+and\s+\d+)*$/.test(n))return!1;let r=new Set(n.split(/\s+and\s+/).map(Number));return Array.from({length:t},(o,i)=>i+1).every(o=>r.has(o))}var Ir={permission:"Permission",setup:"Setup",user:"User",profile:"Profile",custommetadata:"CustomMetadata"},Dr=String.raw`[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*`,Lr=new RegExp(String.raw`\$(?:Permission|Setup|User|Profile|CustomMetadata)\.${Dr}`,"gi"),J=String.raw`(?:\{!\s*)?(\$(?:Permission|Setup|User|Profile|CustomMetadata)\.${Dr})\s*\}?`,da=new RegExp(`^${J}$`,"i"),ua=new RegExp(`^NOT\\s+${J}$`,"i"),Wr=new RegExp(`^(?:${J}\\s*(==?|<>|!=)\\s*(TRUE|FALSE)|(TRUE|FALSE)\\s*(==?|<>|!=)\\s*${J})$`,"i"),Fr=String.raw`("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')`,Gr=new RegExp(`^(?:${J}\\s*(==?|<>|!=)\\s*${Fr}|${Fr}\\s*(==?|<>|!=)\\s*${J})$`,"i");function U(e){let t=e.indexOf("."),n=Ir[e.slice(1,t).toLowerCase()];return n?`$${n}${e.slice(t)}`:e}function de(e){return Ir[e.slice(1,e.indexOf(".")).toLowerCase()]}function Rt(e){return e.slice(e.indexOf(".")+1)}function qr(e){return[...new Set([...e.matchAll(Lr)].map(t=>U(t[0])))]}var la=new RegExp(`^${Lr.source}$`,"i");function Ur(e){return typeof e=="string"&&la.test(e)}function _e(e,t){return e.toLowerCase()===t.toLowerCase()}function Vr(e){return e.slice(1,-1).replace(/\\(.)/g,"$1")}function zr(e){let t=new Map;for(let n of e)t.set(`${n.reference.toLowerCase()}=${n.value??""}`,n);return[...t.values()]}function $r(e,t){return e.some(n=>_e(n.reference,t.reference)&&n.value===t.value)}function ue(e){return Ie(e).flatMap(ca)}function Tt(e){return St(e).flatMap(fa)}function ca(e){let t=Wr.exec(e);if(t){let[,o,i,s,a,d,l]=t,u=i??d,f=(s??a).toUpperCase();return(u.startsWith("=")?f==="FALSE":f==="TRUE")?[{reference:U(o??l)}]:[]}let n=Gr.exec(e);if(n){let[,o,i,s,a,d,l]=n;return(i??d).startsWith("=")?[]:[{reference:U(o??l),value:Vr(s??a)}]}let r=z(e,"NOT");if(r===void 0){let o=ua.exec(e);return o?[{reference:U(o[1])}]:[]}return Tt(r)}function fa(e){let t=da.exec(e);if(t)return[{reference:U(t[1])}];let n=Wr.exec(e);if(n){let[,i,s,a,d,l,u]=n,f=s??l,g=(a??d).toUpperCase();return(f.startsWith("=")?g==="TRUE":g==="FALSE")?[{reference:U(i??u)}]:[]}let r=Gr.exec(e);if(r){let[,i,s,a,d,l,u]=r;return(s??l).startsWith("=")?[{reference:U(i??u),value:Vr(a??d)}]:[]}let o=z(e,"NOT");return o===void 0?[]:ue(o)}function Ie(e){let t=Ot(e),n=z(t,"AND");if(n)return De(n,",").flatMap(Ie);let r=De(t,"&&");return r.length>1?r.flatMap(Ie):[t]}function St(e){let t=Ot(e),n=z(t,"OR");if(n)return De(n,",").flatMap(St);let r=De(t,"||");return r.length>1?r.flatMap(St):[t]}function z(e,t){let n=new RegExp(`^${t}\\s*\\(([\\s\\S]*)\\)$`,"i").exec(e);return n&&Qr(n[1])?n[1]:void 0}function Ot(e){let t=e.trim();for(;t.startsWith("(")&&t.endsWith(")")&&Qr(t.slice(1,-1));)t=t.slice(1,-1).trim();return t}function Qr(e){let t=0;for(let{char:n,quoted:r}of Hr(e))if(!r){if(n==="(")t++;else if(n===")"&&--t<0)return!1}return t===0}function De(e,t){let n=[],r=0,o=0;for(let{char:i,index:s,quoted:a}of Hr(e))a||(i==="("?r++:i===")"?r--:r===0&&e.startsWith(t,s)&&(n.push(e.slice(o,s).trim()),o=s+t.length));return n.push(e.slice(o).trim()),n.filter(i=>i!=="")}function*Hr(e){let t=null;for(let n=0;n<e.length;n++){let r=e[n];if(t){r==="\\"?n++:r===t&&(t=null),yield{char:r,index:n,quoted:!0};continue}if(r==='"'||r==="'"){t=r,yield{char:r,index:n,quoted:!0};continue}yield{char:r,index:n,quoted:!1}}}function ga(e){let t=S(e,"start");if(typeof t=="object"&&t!==null){let n=h(S(S(t,"connector"),"targetReference"))||void 0,r=v(S(t,"scheduledPaths")).map(o=>h(S(S(o,"connector"),"targetReference"))||void 0);return{name:n,everyPath:r.every(o=>o===n)}}return{name:h(S(e,"startElementReference"))||void 0,everyPath:!0}}function pa(e,t){let n=e.leftValueReference,r=e.rightValue;if(Ur(n)){let i=U(n);if(typeof S(r,"booleanValue")=="boolean")return[{reference:i}];let s=S(r,"stringValue");return typeof s=="string"?[{reference:i,value:s}]:[]}let o=typeof n=="string"?t.get(n):void 0;return o===void 0?[]:[...Tt(o),...ue(o)]}function ma(e,t){let n=e.leftValueReference,r=typeof n=="string"?t.get(n):void 0;return qr([typeof n=="string"?n:"",h(S(e.rightValue,"elementReference")),r??""].join(" "))}function ha(e,t,n){let{leftValueReference:r,operator:o,rightValue:i}=e;if(o!=="EqualTo"&&o!=="NotEqualTo")return"unknown";let s=o==="EqualTo",a=S(i,"booleanValue");if(Ur(r)){if(!_e(r,t.reference))return"unknown";if(typeof a=="boolean"&&t.value===void 0)return a===s?"true":"false";let u=S(i,"stringValue");return typeof u=="string"&&t.value!==void 0?u===t.value===s?"true":"false":"unknown"}let d=typeof r=="string"?n.get(r):void 0;if(d===void 0||typeof a!="boolean")return"unknown";let l=a===s;return $r(Tt(d),t)?l?"true":"false":$r(ue(d),t)?l?"false":"true":"unknown"}function ya(e,t,n){let r=v(e.conditions);if(r.length===0)return"unknown";let o=r.map(s=>ha(s,t,n)),i=h(e.conditionLogic).toLowerCase()||"and";return i==="and"?o.includes("false")?"false":o.every(s=>s==="true")?"true":"unknown":i==="or"?o.includes("true")?"true":o.every(s=>s==="false")?"false":"unknown":"unknown"}function wa(e,t,n){for(let r of v(e.rules)){let o=ya(r,t,n),i=!h(S(r.connector,"targetReference"));if(o!=="false"){if(o==="true")return i;if(!i)return!1}}return!h(S(e.defaultConnector,"targetReference"))}function Kr(e){let t=v(S(e,"decisions")),n=new Map(v(S(e,"formulas")).filter(f=>typeof f.expression=="string").map(f=>[h(f.name),h(f.expression)])),r=f=>v(f.rules).flatMap(g=>v(g.conditions)),o=[...new Set(t.flatMap(f=>r(f).flatMap(g=>ma(g,n))))];if(o.length===0)return{permissions:[],switches:[]};let{name:i,everyPath:s}=ga(e),a=s?t.find(f=>h(f.name)===i):void 0,d=a?zr(r(a).flatMap(f=>pa(f,n))).filter(f=>wa(a,f,n)):[],l=o.filter(f=>de(f)==="Permission").map(f=>({name:Rt(f),bypass:d.some(g=>_e(g.reference,f)&&g.value===void 0),where:"decision"})).sort((f,g)=>f.name.localeCompare(g.name)),u=o.filter(f=>de(f)!=="Permission").flatMap(f=>{let g=d.filter(p=>_e(p.reference,f));return g.length>0?g.map(p=>({...p,where:"decision",bypass:!0})):[{reference:f,where:"decision",bypass:!1}]}).sort((f,g)=>f.reference.localeCompare(g.reference));return{permissions:l,switches:u}}function ba(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).filter(t=>t!=="").map(t=>t.toLowerCase())}function Ra(...e){return e.some(t=>{let n=ba(t);return n.some(r=>Zi.has(r))||n.some((r,o)=>r==="text"&&/^messages?$/.test(n[o+1]??""))})}function Xr(e){return v(S(e,"actionCalls")).flatMap(t=>{let n=h(t.actionType),r=h(t.label)||h(t.name)||h(t.actionName),o=Xi[n],i=Yi[n];return o?[{kind:o,name:r,...i?{limit:i}:{}}]:n==="apex"&&Ra(h(t.actionName),h(t.name),r)?[{kind:"sms",name:r,guessed:!0}]:[]})}function Sa(e){return v(S(S(e,"start"),"scheduledPaths")).map(t=>{let n=h(t.label)||h(t.name)||void 0;if(h(t.pathType)==="AsyncAfterCommit")return{kind:"async",label:n};let r=Number(t.offsetNumber),o=h(t.timeSource)==="RecordField"?h(t.recordField):"";return{kind:"scheduled",label:n,...Number.isFinite(r)?{offset:r}:{},...h(t.offsetUnit)?{unit:h(t.offsetUnit)}:{},...o?{field:o}:{}}})}function Yr(e,t){let n=Nn(t);n.length>0&&(e.creates=n)}function Ea(e,t){if(typeof t!="object"||t===null)return;let n=S(t,"start"),r=Kr(t);e.permissions=[...jr(n),...r.permissions],e.switches=[..._r(S(n,"filterFormula")),...r.switches];let o=ra(n);o.length>0&&(e.requiresFilled=o),e.paths=Sa(t),e.messages=Xr(t),Yr(e,t)}function Aa(e,t){let n=new Map(v(S(t,"processMetadataValues")).map(o=>[h(o.name),h(S(o.value,"stringValue"))]));e.startsOn=Cr[n.get("TriggerType")??""]??"createAndUpdate";let r=Kr(t);return e.permissions=r.permissions,e.switches=r.switches,e.messages=Xr(t),Yr(e,t),n.get("ObjectType")||void 0}function Ta(e,t){e.startsOn=Cr[h(S(t,"triggerType"))]??"createAndUpdate";let n=S(t,"formula");e.permissions=typeof n=="string"?jr({filterFormula:n}):[],e.switches=_r(n);let r=v(S(t,"workflowTimeTriggers"));return e.paths=r.map(o=>{let i=Number(o.timeLength);return{kind:"scheduled",...Number.isFinite(i)?{offset:i}:{},...h(o.workflowTimeTriggerUnit)?{unit:h(o.workflowTimeTriggerUnit)}:{},...h(o.offsetFromField)?{field:h(o.offsetFromField)}:{}}}),e.messages=[S(t,"actions"),...r.map(o=>o.actions)].flatMap(v).flatMap(o=>{let i=Ji[h(o.type)];return i?[{kind:i,name:h(o.name),...i==="email"?{limit:"DailyWorkflowEmails"}:{}}]:[]}),S(t,"active")===!0}function Jr(e,t){return(e?`${e}__${t}`:t).toLowerCase()}function ht(e,t){let n=un(t);return n===void 0?{part:e,reason:N(t)}:{part:e,reason:`the org could not be reached (${n})`,unreachable:n}}var Pr={flows:0,triggers:1,conditions:2,processes:3,workflowRules:4,definitions:5,assignmentRules:6,duplicateRules:7,userPermissions:8,permissionSets:9};function Oa(e){return[...e].sort((t,n)=>Pr[t.part]-Pr[n.part]||(t.reason<n.reason?-1:t.reason>n.reason?1:0))}async function Me(e,t){let n=new Array(e.length),r=0,o=async()=>{for(;r<e.length;){let i=r++;n[i]=await e[i]()}};return await Promise.all(Array.from({length:Math.min(t,e.length)},o)),n}var Br=[en,An,nn,rn,tn],vr=["ProductCategory","ProductCatalog"];function lt(e,t=new Set){let{referenceDataObjects:n}=Ar(void 0),r=e.nodes.filter(u=>u.included&&!t.has(u.objectApiName)&&!n.has(u.objectApiName)).map(u=>u.objectApiName),o=new Set(r),i=new Set(e.nodes.map(u=>u.objectApiName)),s=Object.entries(Zt).filter(([u,{object:f}])=>o.has(u)&&!i.has(f)&&!t.has(f)).map(([,{object:u}])=>u),a=Tn(e,t),d=u=>e.edges.some(f=>f.required===!0&&u.includes(f.sourceObject)&&a.has(f.sourceObject)&&o.has(f.targetObject)),l=s.length>0||d(Br);return[...new Set([...r,...s,...l?Br.filter(u=>a.has(u)):[],...d(vr)?vr.filter(u=>a.has(u)):[]])]}var Nr=class{deps;constructor(t){this.deps=t}async readForGraph(t,n,r=new Set){return this.read(t,lt(n,r))}async read(t,n,r={}){let o=[],i=0,s=new Map(n.map(c=>[c.toLowerCase(),c])),a=c=>c===void 0?void 0:s.get(c.toLowerCase()),d=(c,y)=>async()=>{try{let E=await y();return i+=E.requests,E.records}catch(E){return i++,o.push(ht(c,E)),[]}},l=c=>()=>this.deps.query(t,c),u=c=>()=>this.deps.toolingQuery(t,c),f=async()=>[],g=n.some(c=>/^(case|lead)$/i.test(c)),[p,m,w,b,R,O]=await Me([d("flows",l(Ai)),d("triggers",u(Ti)),d("processes",l(Oi)),d("workflowRules",u(ki)),g?d("assignmentRules",l(Fi)):f,d("duplicateRules",l($i))],ae),T=p.map(ea).filter(c=>c!==void 0).flatMap(c=>{let y=a(c.objectApiName);return y?[{...c,objectApiName:y}]:[]}),C=m.map(na).filter(c=>c!==void 0).flatMap(c=>{let y=a(c.objectApiName),E=c.trigger.events.some(k=>k!=="afterUndelete"||r.undeletes===!0);return y&&E?[{...c,objectApiName:y}]:[]}),A=w.map(ta),x=A.filter(c=>c.objectApiName===void 0&&c.id!==null).map(c=>c.id),$=n.filter(c=>c.includes("__")&&bt.test(c)),eo=b.some(c=>/^01I/.test(h(c.TableEnumOrId))),[to,no]=await Me([x.length>0?d("processes",l(Wi(x))):f,eo&&$.length>0?d("workflowRules",l(Gi($))):f],ae),ro=new Map(to.filter(c=>h(c.ApiName).toLowerCase()===zi).map(c=>[h(c.FlowVersionViewId),h(c.ObjectType)]));for(let c of A)c.objectApiName===void 0&&c.id!==null&&(c.objectApiName=ro.get(c.id)||void 0);let oo=new Map(no.map(c=>[h(c.DurableId),h(c.QualifiedApiName)])),Le=b.flatMap(c=>{let y=h(c.TableEnumOrId),E=a(oo.get(y)??y),k=h(c.Name),F=h(c.Id);if(!E||!k)return[];let j=h(c.NamespacePrefix),Q=j?`${j}.${k}`:k;return[{objectApiName:E,id:D.test(F)?F:null,flow:At(Q,Q,"afterSave","createAndUpdate")}]}),We=A.filter(c=>c.objectApiName===void 0||a(c.objectApiName)!==void 0),so=new Map(n.map((c,y)=>[c,y])),le=c=>so.get(a(c.objectApiName)??"")??n.length,Ge=T.filter(c=>c.id!==null).sort((c,y)=>kr(c.flow)-kr(y.flow)||le(c)-le(y)||c.flow.label.localeCompare(y.flow.label)),Z=this.deps.toolingQueries,qe=Z?this.deps.toolingRetrieves:void 0,kt=qe?je:Ce,Ft=Z?yt*kt:Ei,$t=Z?wt*kt:Mr,Ue=Ge.slice(0,Ft),Pt=[...We.map(c=>({read:c,kind:"process"})),...Le.map(c=>({read:c,kind:"rule"}))].filter(({read:c})=>c.id!==null).sort((c,y)=>le(c.read)-le(y.read)||(c.kind===y.kind?0:c.kind==="process"?-1:1)||c.read.flow.label.localeCompare(y.read.flow.label)),Bt=Pt.slice(0,$t),Ve,ze,vt=new Set,Nt=c=>c[0]?.Metadata,io=(c,y)=>{c.flow.condition="read",Ea(c.flow,Nt(y))},ao=(c,y)=>{c.flow.condition="unreadable",Ve??=y},uo=({read:c,kind:y})=>y==="process"?Or(c.id):Li(c.id),lo=({read:c,kind:y},E)=>{let k=Nt(E);if(typeof k!="object"||k===null){c.flow.condition="unreadable";return}if(c.flow.condition="read",y==="process"){let F=Aa(c.flow,k);c.objectApiName??=F}else Ta(c.flow,k)||vt.add(c.flow)},co=({read:c},y)=>{c.flow.condition="unreadable",ze??=y},Mt=(c,y,E,k,F)=>c.map(j=>({soql:y(j),retrieve:E(j),take:Q=>k(j,Q),refused:Q=>F(j,Q)})),xt=Mt(Ue,c=>Or(c.id),c=>({sobject:"Flow",id:c.id}),io,ao),Ct=Mt(Bt,uo,({read:c,kind:y})=>({sobject:y==="process"?"Flow":"WorkflowRule",id:c.id}),lo,co);Z?i+=await Di(c=>Z(t,c),[{queries:xt,requests:yt},{queries:Ct,requests:wt}],ae,qe&&(c=>qe(t,c))):await Me([...xt,...Ct].map(c=>async()=>{try{let y=await this.deps.toolingQuery(t,c.soql);i+=y.requests,c.take(y.records)}catch(y){i++,c.refused(N(y))}}),ae),Ve!==void 0&&o.push(ht("conditions",Ve)),ze!==void 0&&o.push(ht("definitions",ze));for(let c of[...T,...We,...Le])c.id===null&&(c.flow.condition="unreadable");let jt=We.flatMap(c=>{let y=a(c.objectApiName);return y?[{...c,objectApiName:y}]:[]}),_t=Le.filter(c=>!vt.has(c.flow)),Qe=[...T,...jt,..._t].flatMap(c=>c.flow.permissions),It;if(Qe.length>0){let[c]=await Me([d("userPermissions",l(Pi))],ae);if(!o.some(y=>y.part==="userPermissions")){let y=new Set(c.map(E=>Jr(h(E.NamespacePrefix),h(E.DeveloperName))));It=y;for(let E of Qe)E.held=y.has(E.name.toLowerCase())}}let Dt=[...new Set(Qe.filter(c=>c.bypass&&c.held!==!0).map(c=>c.name))],He=Dt.length>0?await ka(Dt,c=>d("permissionSets",l(c))(),()=>o.some(c=>c.part==="permissionSets"),async c=>{try{let y=await this.deps.query(t,c);return i+=y.requests,y.records}catch(y){throw i++,y}}):void 0,ce={};if(He?.some(c=>c.permissionSets.length>0)){let{toolingQueries:c,toolingRetrieves:y}=this.deps;try{let{readValidationRuleBypasses:E}=await import("./chunk-TQJ5NPRC.mjs"),k=await E(F=>this.deps.toolingQuery(t,F),n,c&&(F=>c(t,F)),y&&(F=>y(t,F)));i+=k.requests,ce.validationRuleBypasses=k.rules.flatMap(F=>F.permissions.some(j=>It?.has(j.toLowerCase()))?[]:[F]),k.notRead>0&&(ce.validationRulesNotRead=k.notRead)}catch(E){i++,ce.validationRulesUnread=N(E)}}let fo=c=>R.filter(y=>h(y.SobjectType).toLowerCase()===c.toLowerCase()).map(y=>({name:h(y.Name)})).sort((y,E)=>y.name.localeCompare(E.name)),go=c=>O.filter(y=>h(y.SobjectType).toLowerCase()===c.toLowerCase()).map(y=>({name:h(y.MasterLabel)||h(y.DeveloperName),developerName:h(y.DeveloperName)})).sort((y,E)=>y.name.localeCompare(E.name)),po=(c,y)=>c.label.localeCompare(y.label),Ke=(c,y)=>c.filter(E=>E.objectApiName===y).map(E=>E.flow).sort(po),Xe=new Map;for(let c of Ge.slice(Ue.length))Xe.set(c.objectApiName,(Xe.get(c.objectApiName)??0)+1);let Lt=n.flatMap(c=>{let y=Xe.get(c);return y?[{objectApiName:c,flows:y}]:[]}),mo=n.map(c=>({objectApiName:c,flows:Ke(T,c),triggers:C.filter(y=>y.objectApiName===c).map(y=>y.trigger).sort((y,E)=>y.name.localeCompare(E.name)),processes:Ke(jt,c),workflowRules:Ke(_t,c),assignmentRules:fo(c),duplicateRules:go(c)})).filter(c=>c.flows.length>0||c.triggers.length>0||c.processes.length>0||c.workflowRules.length>0||c.assignmentRules.length>0||c.duplicateRules.length>0);return{objectsRead:[...n],objects:mo,unread:Oa(o),conditionsNotRead:Ge.length-Ue.length,conditionsBound:Ft,...Lt.length>0?{conditionsNotReadOn:Lt}:{},definitionsNotRead:Pt.length-Bt.length,definitionsBound:$t,...He?{bypassGrants:He}:{},...ce,requests:i}}};function I(e){return e.slice(0,15)}async function ka(e,t,n,r){let o=e.flatMap(p=>{let m=p.indexOf("__"),w=m>0?p.slice(0,m):"",b=m>0?p.slice(m+2):p;return bt.test(b)&&(!w||bt.test(w))?[{name:p,developerName:b}]:[]});if(o.length===0)return;let i=await t(qi([...new Set(o.map(p=>p.developerName))]));if(n())return;let s=new Map;for(let p of i){let m=h(p.Id);D.test(m)&&s.set(Jr(h(p.NamespacePrefix),h(p.DeveloperName)),m)}let a=o.flatMap(p=>{let m=s.get(p.name.toLowerCase());return m?[m]:[]}),d=a.length>0?await t(Ui(a)):[];if(n())return;let l=[...new Set(d.map(p=>h(p.ParentId)).filter(p=>D.test(p)))],u=new Map;for(let p of["SetupEntityAccess","ObjectPermissions"]){if(l.length===0)break;let m=await t(Vi(p,l));if(n())return;for(let w of m){let b=I(h(w.ParentId)),R=typeof w.n=="number"?w.n:Number(w.n);u.set(b,(u.get(b)??0)+(Number.isFinite(R)?R:0))}}let f=new Map;for(let p of i){let m=h(p.Id);D.test(m)&&f.set(I(m),Zr(h(p.NamespacePrefix),h(p.DeveloperName)))}let g=r&&l.length>0?await Pa(l,f,r):void 0;return o.map(({name:p})=>{let m=s.get(p.toLowerCase()),w=new Map;for(let b of d){if(!m||I(h(b.SetupEntityId))!==I(m))continue;let R=I(h(b.ParentId)),O=b.Parent,T=h(S(O,"Name"));if(!T||w.has(R))continue;let C=h(S(O,"NamespacePrefix"));w.set(R,{name:C?`${C}__${T}`:T,label:h(S(O,"Label"))||T,grants:u.get(R)??0,...g===void 0?{}:"refused"in g?{customPermissionsUnread:g.refused}:{customPermissions:g.bySet.get(R)??[]}})}return{permission:p,permissionSets:[...w.values()].sort((b,R)=>b.grants-R.grants||b.name.localeCompare(R.name))}})}function Zr(e,t){return e?`${e}__${t}`:t}function Fa(e){return`SELECT ParentId, SetupEntityId FROM SetupEntityAccess WHERE SetupEntityType = 'CustomPermission' AND ParentId IN (${e.map(n=>`'${n}'`).join(", ")})`}function $a(e){return`SELECT Id, DeveloperName, NamespacePrefix FROM CustomPermission WHERE Id IN (${e.map(n=>`'${n}'`).join(", ")})`}async function Pa(e,t,n){try{let r=await n(Fa(e)),o=new Map(t),i=[...new Set(r.map(a=>h(a.SetupEntityId)).filter(a=>D.test(a)&&!o.has(I(a))))];if(i.length>0)for(let a of await n($a(i))){let d=h(a.Id);D.test(d)&&o.set(I(d),Zr(h(a.NamespacePrefix),h(a.DeveloperName)))}let s=new Map;for(let a of r){let d=I(h(a.ParentId)),l=o.get(I(h(a.SetupEntityId)));if(!l)continue;let u=s.get(d)??[];u.includes(l)||u.push(l),s.set(d,u)}for(let a of s.values())a.sort((d,l)=>d.localeCompare(l));return{bySet:s}}catch(r){return{refused:N(r)}}}var Ba={insert:"on insert",update:"on update",delete:"on delete"},va={insert:{before:"before save",after:"after save",beforeAndAfter:"before and after save"},update:{before:"before save",after:"after save",beforeAndAfter:"before and after save"},delete:{before:"before delete",after:"after delete",beforeAndAfter:"before and after delete"}},Na={flow:e=>`flow "${e}"`,trigger:e=>`Apex trigger ${e}`,process:e=>`process "${e}"`,workflowRule:e=>`workflow rule "${e}"`},Ma={flows:"the flows",triggers:"the Apex triggers",conditions:"the start conditions of some flows",processes:"the Process Builder processes",workflowRules:"the workflow rules",definitions:"the definitions of some processes or workflow rules",assignmentRules:"the assignment rules",duplicateRules:"the duplicate rules",userPermissions:"the custom permissions of the user the run writes as",permissionSets:"the permission sets that hold a bypass the user the run writes as does not"},xa={email:"email",notification:"custom notification",outbound:"outbound message",sms:"text message"};function Ca(e){let t=e.guessed?" (guessed from the name of an Apex action)":"";return`${xa[e.kind]} "${e.name}"${t}`}function ja(e){let t=e.label?` "${e.label}"`:"";if(e.kind==="async")return`asynchronous path${t}`;if(e.offset===void 0||e.unit===void 0)return`scheduled path${t}`;let n=Math.abs(e.offset),r=n===1?e.unit.replace(/s$/,""):e.unit,o=e.offset<0?"before":"after";return`scheduled path${t} (${n} ${r} ${o} ${e.field??"the save"})`}function _a(e){let t=e.value===void 0?"true":`'${e.value}'`;return e.where==="decision"?`its first decision ends it when ${e.reference} is ${t}`:`not when ${e.reference} is ${t}`}function Ia(e,t){let n=e.flow,r=n?.permissions??[],o=n?.switches??[],i=n?.messages??[],s=n?.paths??[],a=p=>p.held===!0?" (held)":p.held===!1?" (not held)":"",d=r.filter(p=>p.bypass&&p.where!=="decision"),l=r.filter(p=>p.bypass&&p.where==="decision"),u=r.filter(p=>!p.bypass&&p.where!=="decision"),f=[...r.filter(p=>!p.bypass&&p.where==="decision").map(p=>p.name),...o.filter(p=>!p.bypass).map(p=>p.reference)],g=e.kind==="flow"?"start condition":"definition";return[va[t][e.when],...i.length>0?[`SENDS MESSAGES: ${i.map(Ca).join(", ")}`]:[],...s.length>0?[`then after commit: ${s.map(ja).join(", ")}`]:[],...d.length>0?[`not for a user with ${d.map(p=>p.name+a(p)).join(", ")}`]:[],...l.length>0?[`its first decision ends it for a user with ${l.map(p=>p.name+a(p)).join(", ")}`]:[],...o.filter(p=>p.bypass).map(_a),...e.keptQuiet?["quiet for this run"]:[],...u.length>0?[`its start condition names ${u.map(p=>p.name).join(", ")}`]:[],...f.length>0?[`its decisions test ${f.join(", ")}`]:[],...n?.condition==="notRead"?[`${g} not read`]:[],...n?.condition==="unreadable"?[`${g} unreadable`]:[]]}function Du(e,t,n={}){let r=[`target automation: what ${t} runs on the ${e.objectsRead.length} object(s) the run writes`];for(let s of e.objects){r.push(` ${s.objectApiName}`);for(let{write:l,fired:u}of he(s)){let f=u.map(g=>`${Na[g.kind](g.name)} (${Ia(g,l).join("; ")})`);r.push(` ${Ba[l]}: ${f.join(", ")}`)}let a=n.mayApplyAssignmentRules!==!1;for(let l of s.assignmentRules??[])r.push(n.applyAssignmentRules?` assignment rule "${l.name}": applied${a?" (--apply-assignment-rules)":""}: it can give the records it routes another owner, and mail that owner`:` assignment rule "${l.name}": not applied: the run sends Sforce-Auto-Assign: FALSE and keeps the owner it sets${a?" (--apply-assignment-rules applies it)":""}`);let d=s.duplicateRules??[];d.length>0&&r.push(` duplicate rules: ${d.map(l=>`"${l.name}"`).join(", ")}: the run saves a record a rule only alerts on; a rule that blocks still refuses it`)}e.objects.length===0&&r.push(sn(e.unread)?" nothing found in what could be read":" no active flow, process, workflow rule, Apex trigger, assignment rule or duplicate rule runs on them");let o=ye(e),i=on(e).filter(s=>!o.includes(s));if(i.length>0){r.push(` bypass: assign ${i.join(", ")} to the user the run writes as, and the flows whose start condition excludes them stay quiet`+(n.mayMute!==!1?"; --mute-automation assigns them for the run alone, and takes them back as it ends":""));for(let{permission:s,permissionSet:a,others:d}of be(e,i)){if(!a){r.push(` ${s}: no permission set of ${t} holds it: an admin creates one that includes it`);continue}let l=d.length>0?`; also held by ${d.map(f=>f.name).join(", ")}`:"",u=n.username?`: ${Re(a.name,t,n.username)}`:"";r.push(` ${s}: held by permission set ${a.name}, the smallest${l}${u}`)}}if(o.length>0&&r.push(` bypass held: the user the run writes as holds ${o.join(", ")}, and what excludes them stays quiet for this run`),e.conditionsNotRead>0){let s=(e.conditionsNotReadOn??[]).map(({objectApiName:a,flows:d})=>`${a} (${d})`).join(", ");r.push(` ${e.conditionsNotRead} start condition(s) not read: the read takes ${e.conditionsBound} at most`+(s?`; left unread on ${s}`:""))}(e.definitionsNotRead??0)>0&&r.push(` ${e.definitionsNotRead} process or workflow rule definition(s) not read: the read takes ${e.definitionsBound??Mr} at most`);for(let{part:s,reason:a}of e.unread)r.push(` ${Ma[s]} could not be read: ${a}`);return r.push(` read in ${e.requests} request(s) to ${t}`),r}export{Wn as a,nd as b,Gn as c,id as d,ad as e,dd as f,ud as g,ld as h,Wa as i,Ga as j,qa as k,xn as l,Ua as m,Cn as n,To as o,Va as p,Ya as q,Ja as r,In as s,Za as t,ed as u,Sr as v,cu as w,fu as x,gu as y,pu as z,hi as A,mu as B,hu as C,yi as D,Rr as E,yu as F,wu as G,bu as H,Ru as I,Su as J,Eu as K,Au as L,Tu as M,Ou as N,Ar as O,Tr as P,Ei as Q,Mr as R,Ce as S,je as T,yt as U,wt as V,Jn as W,Ai as X,Ti as Y,Oi as Z,ki as _,Fi as $,$i as aa,Pi as ba,Or as ca,Bi as da,vi as ea,ji as fa,_i as ga,Ii as ha,Iu as ia,Di as ja,Li as ka,Wi as la,Gi as ma,qi as na,Ui as oa,Vi as pa,jr as qa,_r as ra,ra as sa,Kr as ta,Xr as ua,Sa as va,Jr as wa,ht as xa,Me as ya,lt as za,Nr as Aa,ka as Ba,Fa as Ca,$a as Da,Du as Ea,Sd as Fa,Ed as Ga,Po as Ha,Ad as Ia,Zn as Ja,it as Ka,jo as La,_o as Ma,Td as Na,Un as Oa,Lo as Pa,Od as Qa,kd as Ra,Fd as Sa,qo as Ta,Uo as Ua,Vn as Va,Vo as Wa,zo as Xa,Ho as Ya,st as Za,ne as _a,Yo as $a,Jo as ab,Pe as bb,Zo as cb,es as db,ts as eb,$d as fb,Be as gb,as as hb,ds as ib,us as jb,cs as kb,fs as lb,gs as mb,ps as nb,ms as ob,hs as pb,ws as qb,bs as rb,Rs as sb,sr as tb,Ss as ub,Ne as vb,Es as wb,As as xb,Ts as yb,Os as zb,Pd as Ab,ks as Bb,ir as Cb,Fs as Db,ar as Eb,dt as Fb,$s as Gb,vs as Hb,Bd as Ib,vd as Jb,Is as Kb,dr as Lb,Ds as Mb,Ls as Nb,Ws as Ob,Gs as Pb,Nd as Qb,qs as Rb,Us as Sb,Md as Tb,xd as Ub,cr as Vb,Cd as Wb,jd as Xb,fr as Yb,_d as Zb,Id as _b,Dd as $b,Js as ac,Ld as bc,Wd as cc,Gd as dc,qd as ec,Ud as fc,L as gc,hr as hc,ei as ic,ti as jc,Vd as kc,ni as lc,zd as mc,Qd as nc,ie as oc,Hd as pc,Kd as qc,V as rc,Xd as sc,Yd as tc,si as uc,Jd as vc,ii as wc,Zd as xc,gt as yc,eu as zc,tu as Ac,nu as Bc,ru as Cc,ou as Dc};
@@ -1,7 +0,0 @@
1
- import { createRequire as __sandforgeRequire } from 'node:module';
2
- import { fileURLToPath as __sandforgePath } from 'node:url';
3
- import { dirname as __sandforgeDirname } from 'node:path';
4
- const require = __sandforgeRequire(import.meta.url);
5
- const __filename = __sandforgePath(import.meta.url);
6
- const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-XKFHTBAB.mjs";import"./chunk-FYWNSMOZ.mjs";import"./chunk-U2CTKIPE.mjs";import"./chunk-NDFFIJL5.mjs";import"./chunk-RVCPQVKM.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-X2XZQ434.mjs";import"./chunk-4X5D3MSV.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-IXIY6Q4M.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-EOQON3E5.mjs";import"./chunk-Y7YUNRKK.mjs";import"./chunk-4JKR4PTZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-WXU6ZJIV.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-ZXOUWHYE.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-ICIYL45C.mjs";import"./chunk-7BQMBXKX.mjs";import"./chunk-KWAVSZ2B.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{h as REWIND_MUTING_STEP_WORDS,g as REWIND_STEP_WORDS,i as acceptanceRefusal,j as boundsRefusal,k as boundsRefusals,e as firedCount,m as notConfirmedRefusal,a as objectsWrittenBy,b as previewTotals,f as remakeUnasked,d as rewindStepsOf,c as selectionDiff,l as undeletableUnattendedRefusal};
@@ -1,7 +0,0 @@
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
- function r(n){return`npx sandforge ${n}`}function o(n){return n.replace(/^sandforge-(?=[a-z]+$)/,"sandforge ")}export{r as a,o as b};
@@ -1,7 +0,0 @@
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{b as i}from"./chunk-CA5NAXSU.mjs";var o=["ENOTFOUND","ECONNREFUSED","ETIMEDOUT","ECONNRESET","EAI_AGAIN","ENETUNREACH","EHOSTUNREACH"];function s(n){if(typeof n=="object"&&n!==null){let{code:t,name:u,cause:r}=n;if(typeof t=="string"&&o.includes(t)||u==="TimeoutError"||r!==void 0&&s(r))return!0}let e=i(n);return o.some(t=>e.includes(t))||e.includes("fetch failed")?!0:/\btimed out\b/i.test(e)}function c(n){let{code:e}=typeof n=="object"&&n!==null?n:{};if(typeof e=="string"&&o.includes(e))return e;let t=i(n),u=o.find(r=>t.includes(r));if(u!==void 0)return u;if(/socket hang up/i.test(t))return"socket hang up";if(s(n))return/\btimed out\b/i.test(t)?"timed out":"no connection"}function f(n){return typeof n.unread=="string"?c(n.unread):n.unread.find(e=>e.unreachable!==void 0)?.unreachable}export{s as a,c as b,f as c};
@@ -1,7 +0,0 @@
1
- import { createRequire as __sandforgeRequire } from 'node:module';
2
- import { fileURLToPath as __sandforgePath } from 'node:url';
3
- import { dirname as __sandforgeDirname } from 'node:path';
4
- const require = __sandforgeRequire(import.meta.url);
5
- const __filename = __sandforgePath(import.meta.url);
6
- const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d,e}from"./chunk-77MZRBWX.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{b as SEED_RUNS_DIR,a as SEED_RUNS_KEPT,e as SeedRunCreations,d as nodeSeedRunCreations,c as seedRunKept};
@@ -1,7 +0,0 @@
1
- import { createRequire as __sandforgeRequire } from 'node:module';
2
- import { fileURLToPath as __sandforgePath } from 'node:url';
3
- import { dirname as __sandforgeDirname } from 'node:path';
4
- const require = __sandforgeRequire(import.meta.url);
5
- const __filename = __sandforgePath(import.meta.url);
6
- const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}from"./chunk-X4HZD5U2.mjs";import"./chunk-NS6ONPWL.mjs";import"./chunk-DSR2MSBH.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-54HYHHVL.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-YBZIDW6W.mjs";import"./chunk-R3OM3X4L.mjs";import"./chunk-77IVKH7R.mjs";import"./chunk-2WMKJVD2.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-VXZ5PTOM.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-ZOSESZ22.mjs";import"./chunk-TQ2TQHTT.mjs";import"./chunk-HFSBDM7B.mjs";import"./chunk-OHEOJISY.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-2GSMHGIV.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{h as ACTIVE_DUPLICATE_RULES_SOQL,a as FORMULAS_BOUND,c as FORMULAS_IN_COMPOSITES_BOUND,b as FORMULA_REQUESTS_BOUND,o as TargetGapReader,i as bypassesOf,j as callsEstimateOf,f as fieldLabelsSoql,p as gapAnsweredBy,d as gapFieldOf,r as gapLines,q as gapsWithAnswers,l as readActiveValidationRules,m as readValidationRuleBypasses,k as toolingQueriesOver,n as toolingValidationRules,g as validationFormulaSoql,e as validationRulesSoql};
@@ -1,7 +0,0 @@
1
- import { createRequire as __sandforgeRequire } from 'node:module';
2
- import { fileURLToPath as __sandforgePath } from 'node:url';
3
- import { dirname as __sandforgeDirname } from 'node:path';
4
- const require = __sandforgeRequire(import.meta.url);
5
- const __filename = __sandforgePath(import.meta.url);
6
- const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d,e,f,g,h,i}from"./chunk-KXUOHACP.mjs";import"./chunk-27BBEGUD.mjs";import"./chunk-OTJH6AEA.mjs";import"./chunk-FVLFO2S6.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-77MZRBWX.mjs";import"./chunk-BT43WSOS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as SCENARIO_PACK_FILE_SUFFIX,b as SCENARIO_PACK_SEARCH,i as findScenarioPack,e as findScenarioPackFiles,f as listScenarioPacks,c as nodeScenarioPackFiles,d as readScenarioPackText,h as saveScenarioPack,g as scenarioPackText};
@@ -1,7 +0,0 @@
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{y as he}from"./chunk-7DPHZWA4.mjs";import{i as ce,j as x,k as de,l as pe}from"./chunk-CQAFVEKP.mjs";import{l as le,n as F}from"./chunk-JBWJ6UEZ.mjs";import{e as C,i as ae,k as D,l as se}from"./chunk-L4MSL4U7.mjs";import{d as j,f as oe,xb as re,yb as ie}from"./chunk-LYOGCIYD.mjs";import{c as ne}from"./chunk-QROPNEGY.mjs";import{a as v}from"./chunk-SCKUIE3R.mjs";import{$a as J}from"./chunk-AXFD2OH6.mjs";import{L as te,e as X,k as Q,z as ee}from"./chunk-N2HYG3BL.mjs";import{gc as S}from"./chunk-R3OM3X4L.mjs";import{Ra as Z,cb as V}from"./chunk-6QSHWIZI.mjs";import{existsSync as $e,readFileSync as ve}from"node:fs";import{hostname as be}from"node:os";import{join as ge,resolve as T}from"node:path";var Ae=["--custom-settings","--mask","--keep-contact-points","--no-real-data"],Ee=["--objects","--exclude-object","--owners","--owner-map","--link","--replay-config"],Ie=["--again","--accept-emails","--max-records",...j.switches,...j.values],Oe=["--preview","--sweep","--sweep-list",...re,"--include-changed"],Ne=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,A=/^00D[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/,me=e=>Z.safeParse(e).success,Se={ownerMap:"--owner-map",objects:"--objects",excluded:"--exclude-object",link:"--link"};function Rt(e,t){let n=c=>e.includes(c),o=c=>{let p=[];for(let w=1;w<e.length;w++){if(e[w]!==c)continue;let $=e[w+1];if($===void 0||$.startsWith("--"))return t(`${c} wants a value.`);p.push($),w++}return p},r=c=>{let p=o(c);return p.length>1&&t(`${c} is given ${p.length} times: give it once.`),p[0]},s=c=>{let p=r(c);if(p!==void 0)return/^\d{1,15}$/.test(p)||t(`${c} takes a whole number, not "${p}".`),Number(p)},d=["--dry-run","--verify","--remove"].filter(n);d.length>1&&t(`Give one of --dry-run, --verify and --remove, not ${d.join(" and ")}. Nothing was run.`);let i=n("--dry-run")?"dryRun":n("--verify")?"verify":n("--remove")?"remove":"replay",a=c=>c.filter(n);if(i==="verify"||i==="remove"){let c=a([...Ae,...Ee]);c.length>0&&t(`${c.join(", ")} ${c.length===1?"is a choice":"are choices"} of a replay and its dry run: --verify reads the choices its last replay was made with, and --remove takes back what it wrote. Nothing was run.`);let p=a(Ie);p.length>0&&t(`${p.join(", ")} goes with a replay or its dry run, not with --${i}. Nothing was run.`)}if(i!=="remove"){let c=a(Oe);c.length>0&&t(`${c.join(", ")} goes with --remove. Nothing was run.`)}n("--sweep")&&n("--sweep-list")&&t("--sweep deletes and --sweep-list only lists: give one of them. Nothing was run."),n("--preview")&&n("--sweep-list")&&t("--preview deletes nothing, and --sweep-list lists what a sweep would take: give --preview without it, or with --sweep. Nothing was run.");let u=ie(e);if("refusal"in u&&t(`${u.refusal} Nothing was run.`),i==="verify"){let c=a(["--mute-automation","--accept-automation"]);c.length>0&&t(`${c.join(", ")} goes with a replay or its removal: a verification only reads. Nothing was run.`)}let m=r("--checkpoint"),f=r("--file");if(m===void 0&&f===void 0)return t("replay needs --checkpoint <id|name> (list names them) or --file <.sfcheckpoint>. Run with --help.");m!==void 0&&f!==void 0&&t("Give --checkpoint or --file, not both. Nothing was run.");let h=r("--from");if(h!==void 0&&m===void 0&&t("--from goes with --checkpoint <name>: it names the org the checkpoint was taken of."),m!==void 0&&!me(m)&&h===void 0&&t(`--checkpoint '${m}' is not a checkpoint's id: a name names one of an org's checkpoints, so give --from <alias|username|00D\u2026>, the org it was taken of, or its id ("${v("checkpoint")} list" names them). Nothing was run.`),f===void 0){let c=a(["--key-env","--keep-days"]);c.length>0&&t(`${c.join(" and ")} goes with --file. Nothing was run.`)}let k=r("--target")??t("replay needs --target <alias>, the org the checkpoint's records go into. Run with --help."),R=o("--objects").flatMap(c=>c.split(",").map(p=>p.trim()).filter(p=>p!=="")),g=o("--exclude-object");for(let[c,p]of[["--objects",R],["--exclude-object",g]]){let w=p.find($=>!Ne.test($));w!==void 0&&t(`${c} takes objects' API names, not "${w}".`)}let E=c=>c.filter((p,w)=>c.findIndex($=>$.toLowerCase()===p.toLowerCase())===w),I=r("--owners")??"same";I!=="same"&&I!=="me"&&t(`--owners takes same or me, not "${I}".`);let we=o("--link").map(c=>{let p=/^([A-Za-z][A-Za-z0-9_]*)=([A-Za-z0-9_,]+)$/.exec(c);return p?{objectApiName:p[1],fields:p[2].split(",").filter(w=>w!=="")}:t(`--link takes Object=Field or Object=Field,Field \u2014 the fields a record of the other org is found by \u2014, not "${c}".`)}),O=r("--owner-map"),Y=O!==void 0?ye("--owner-map",O,t):void 0,Re={owners:I,...Y!==void 0?{ownerMap:Y}:{},customSettings:n("--custom-settings"),mask:n("--mask"),contactPoints:n("--keep-contact-points")?"kept":"neutralized",objects:E(R),excluded:E(g),link:we,...n("--no-real-data")?{noRealData:!0}:{}},P=V.safeParse(Re);if(!P.success){let c=P.error.issues[0],p=String(c?.path[0]??"");return t(`${Se[p]??p}: ${c?.message??"not read"}. Nothing was run.`)}let K=P.data,N=r("--replay-config"),H=N!==void 0?Ce(N,K,t):void 0,_=s("--max-records");_===0&&t('--max-records takes a whole number of 1 or more, not "0". Nothing was run.');let G=Fe(r("--key-env"),t),q=oe(e);return{action:i,...m!==void 0?{checkpoint:m}:{},...h!==void 0?{from:h}:{},...f!==void 0?{file:T(f)}:{},...G!==void 0?{keyEnv:G}:{},keepDays:s("--keep-days")??X,target:k,choices:K,...O!==void 0?{ownerMapFile:T(O)}:{},...H!==void 0?{config:H}:{},...N!==void 0?{configFile:T(N)}:{},again:n("--again"),muteAutomation:n("--mute-automation"),acceptAutomation:n("--accept-automation"),acceptEmails:n("--accept-emails"),...q!==void 0?{checkpointFirst:q}:{},..._!==void 0?{maxRecords:_}:{},preview:n("--preview"),sweep:n("--sweep"),sweepList:n("--sweep-list"),...u,includeChanged:n("--include-changed"),yes:n("--yes")}}function $t(e,t){let n=e.flatMap((r,s)=>r==="--target"?[e[s+1]]:[]);n.length>1&&t(`--target is given ${n.length} times: give it once.`);let o=n[0];return o!==void 0?{target:o}:{}}function ye(e,t,n){try{return JSON.parse(ve(t,"utf8"))}catch(o){return n(`${e}: ${t} does not read as JSON (${o instanceof Error?o.message:String(o)}). Nothing was run.`)}}function Ce(e,t,n){let o=ye("--replay-config",e,n),r=J.safeParse({targetOrgId:"command-line",replay:{organizationId:"00D000000000000AAA",checkpointId:"ck-20000101-000000-0000",choices:t,config:o}});if(!r.success){let s=r.error.issues[0],d=(s?.path??[]).slice(2).join(".");return n(`--replay-config: ${d!==""?`${d}: `:""}${s?.message??"not read"}. It takes the load\u2019s part of a Frozen project\u2019s configuration: requiredFieldDefaults, requiredLookupPlaceholders, picklistRules, defaultPicklistRule, identityKeys, undeletableObjects, duplicateErrorPatterns, mockDetection, protectedOrgIds. Nothing was run.`)}return o}function Fe(e,t){if(e!==void 0)return!/^[A-Za-z_][A-Za-z0-9_]{0,127}$/.test(e)||C(e)!==void 0?t("--key-env takes the name of an environment variable that holds the key, never the key: a key on the command line stays in the shell\u2019s history and the list of processes. Nothing was run."):e}var ze="cli-store.json";function W(e,t){return t?ge(e,".replays"):ce()}var y=class extends Error{constructor(n,o=1){super(n.message);this.refusal=n;this.code=o;this.name="ReplayStop"}refusal;code};function ke(e){try{return new x({root:e})}catch(t){throw new y({code:"STORE_REFUSED",message:`The replays cannot be kept in ${e}: ${t instanceof Error?t.message:String(t)} Name a store outside any repository with --store <folder>. Nothing was read or written.`})}}function B(e,t){let n=D(e);if(!$e(n))return;let o=te({root:n,...t!==void 0?{locksDir:t}:{}});return"store"in o?o.store:void 0}function z(e){return/^[\w./:@+-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function vt(e,t){return`${v("checkpoint")} replay --file ${z(e)} --target ${t}`}function L(e,t,n){return`${v("checkpoint")} replay --checkpoint ${e} --target ${t}`+(n!==void 0?` --store ${z(n)}`:"")}var l=e=>e.toLocaleString("en-US");function b(e){let t=new Date(Date.parse(e)).toISOString();return`${t.slice(0,10)} ${t.slice(11,16)} UTC`}function M(e,t=8){return e.length<=t?e.join(", "):`${e.slice(0,t).join(", ")} and ${l(e.length-t)} more`}function Le(e){return{run:"replay",done:"replayed",source:e,recordedIn:"for this checkpoint on this machine",remove:"--remove",module:"replay",again:"again",againSubject:{purge:"replayAgain",sweep:"replayAgainSweep"},maybeMasks:"the checkpoint does not say whether its take read them unmasked, so they may hold the masks a user without View Encrypted Data reads, such as ****1234"}}var Pe={fileContentNotKept:()=>"a checkpoint keeps no file's content",notInTarget:(e,t)=>`${t} has no such object: deploy it there, or leave it out (--exclude-object ${e})`,notCreateable:(e,t)=>`${t} lets no one create its records`,excluded:()=>"left out as asked"},_e={objectNotReplayed:e=>`the checkpoint holds the records it names and does not replay them: add ${e.split(".")[0]}'s target with --objects`,objectNotHeld:(e,t)=>`the checkpoint does not hold what it names, and ${t} has no record of that Id`,userNotInTarget:(e,t)=>`${t} has no active standard user for it`},fe={requiredLookupMissing:"a required lookup names a record neither replayed nor in the other org",parentRefused:"a parent of theirs is refused, and no orphan is written",personAccountsUnsupported:"the other org has not turned person accounts on",inactiveCurrency:"their currency is not active in the other org",recordTypeUnavailable:"their record type is one the user who replays may not create"};function je(e){return`${Object.hasOwn(fe,e.reason)?fe[e.reason]:e.reason}${e.path?`: ${e.path}`:""}`}var De={byName:"found by its name",byId:"found by its Id",default:"the other org's default for the user who replays"};function xe(e){let{summary:t}=e,n=e.target.name,o=[],{records:r}=t;r.linkedById>0&&o.push(`${l(r.linkedById)} record(s) ${n} holds under the same Id \u2014 a sandbox copied from the same production \u2014: linked, not changed`),r.linkedByKey>0&&o.push(`${l(r.linkedByKey)} record(s) found in ${n} by the fields --link names: linked, not created`);let s=t.owners,d=[s.reasons.notInTarget>0?`their user is not in ${n}: ${l(s.reasons.notInTarget)}`:"",s.reasons.inactive>0?`their user is inactive in ${n}: ${l(s.reasons.inactive)}`:"",s.reasons.queueMissing>0?`their queue is not in ${n}: ${l(s.reasons.queueMissing)}`:""].filter(Boolean);o.push(`owners: ${l(s.kept)} kept, ${l(s.toRunningUser)} to the user who replays`+(d.length>0?` \u2014 ${d.join("; ")}`:""));for(let i of t.recordTypes)o.push(`record type ${i.object}.${i.recordType}: ${De[i.outcome]} \u2014 ${l(i.records)} record(s)`);for(let i of t.refused)o.push(`refused before anything is written: ${i.object} ${l(i.records)} \u2014 `+je(i));for(let i of t.notReplayed)o.push(`not replayed: ${i.object} ${l(i.records)} \u2014 `+Pe[i.reason](i.object,n));e.filesLeft.length>0&&o.push(`${l(e.filesLeft.length)} file(s) left where they were, a checkpoint keeping no file's content:`,...e.filesLeft.map(i=>` ${i.objectApiName}${i.name!==void 0?` '${i.name}'`:""}`));for(let i of t.lookupsEmptied)o.push(`${i.field}: emptied on ${l(i.records)} record(s) \u2014 `+_e[i.reason](i.field,n));for(let i of t.fieldsNotInTarget)o.push(`${i.object}: ${M(i.fields)} left out \u2014 ${n} does not have them`);t.customSettings&&o.push(`custom settings: ${l(t.customSettings.inserted)} row(s) set up, ${l(t.customSettings.alreadyThere)} already in ${n}, kept as they are`);for(let i of t.currencies.refused)o.push(`${i.code}: ${l(i.records)} record(s) refused \u2014 the currency is not active in ${n}: activate it there, or leave those records out`);if(t.currencies.singleCurrencyTarget&&o.push(`${n} has one currency: amounts are kept as they are, in its currency`),t.standardPricebook==="deduced"?o.push("standard price book: told from the price book entries, the checkpoint naming none"):t.standardPricebook==="ambiguous"&&o.push("standard price book: the price book entries do not tell which it was, and those that need it are refused"),t.masked.fields.length>0&&o.push(`masked: ${M(t.masked.fields)}`),(t.masked.unmaskedFreeText??[]).length>0&&o.push(`not masked, free text the masking does not read: ${M(t.masked.unmaskedFreeText??[])}`),o.push(t.contactPoints==="neutralized"?"emails and phone numbers made unreachable (.invalid, numbers that ring nobody); --keep-contact-points keeps them":"emails and phone numbers kept as they are: they reach the people they name"),(t.archivedActivities??0)>0&&o.push(`${l(t.archivedActivities??0)} archived task(s) and event(s) replayed, which ${n} holds live`),t.degraded.length>0&&o.push((e.checkpoint.annex?`its take could not read ${t.degraded.join(", ")}`:"taken before SandForge 1.81, it keeps no record types, users, queues nor standard price book")+`: the records they name get what ${n} gives them, each said above`),o.push("created and modified dates and users are the replay's own: the platform sets them"),e.storage){let{storage:i}=e;o.push(`data storage: about ${S(i.estimateMB)} MB of the ${S(i.remainingMB)} MB ${n} has left of ${S(i.maxMB)} MB`)}return o}var Te=new Set(["REPLAY_SAME_ORG","REPLAY_REAL_DATA","REPLAY_COPY_UNKNOWN","REPLAY_TOO_MANY","REPLAY_NOTHING","REPLAY_CHECKPOINT_UNUSABLE","REPLAY_NO_PILOT","CHECKPOINT_NOT_FOUND","OWNER_MAP_INACTIVE","OWNER_MAP_UNKNOWN","GUARD_REFUSED","NO_LOAD","TARGET_REFRESHED","LOAD_REMOVED","LOAD_STOPPED"]);function Me(e){let t=String(e.type??""),n=e.payload?.code;if(!(!t.endsWith(":error")||typeof n!="string")&&Te.has(n))return{code:n,message:String(e.payload?.message??"")}}function Ue(e,t,n,o={}){switch(e){case"TARGET_REFRESHED":if(/dataset/i.test(t))return`${n} was refreshed after the last replay: the records it created went with the refresh. Replay the checkpoint again, then verify.`;break;case"LOAD_REMOVED":{let r=/removal of (\S+) took part/.exec(t);if(r)return`The removal of ${r[1]} took part of the records the last replay created and left ${l(Number(o.left??0))} in ${n}: a verification would read the ones it took as missing. Remove what is left (--remove), or replay again (--again), which purges or finds it again; then verify.`;let s=/removed on (\S+?)\.(?:\s|$)/.exec(t);return`The records the last replay created were removed${s?` on ${s[1]}`:""}. Replay the checkpoint again, then verify.`}case"LOAD_STOPPED":return"The last replay stopped part way \u2014 it was cancelled, or failed once it had written \u2014 and wrote no counting contract: a verification would judge it by the one before. Replay it again (--again), which purges or finds again what the stopped replay wrote, or take it back (--remove); then verify.";case"NO_LOAD":if(/dataset|\bsas\b/i.test(t))return`No replay of this checkpoint into ${n} is recorded on this machine: nothing names the records to verify. Replay it there, then verify.`;break;case"MAX_RECORDS":{let r=/insert (\d+) record\(s\), more than the (\d+)/.exec(t);if(r)return`This replay would create ${l(Number(r[1]))} record(s), more than the ${l(Number(r[2]))} it may: nothing was written. The checkpoint's records or ${n} changed since that count was taken: run its dry run again, and replay with the count it gives (--max-records).`;break}case"REPLACE_LEAVES_RECORDS":{let r=/would leave (\d+) of their records in the org — (.*?): loaded again/.exec(t);if(r)return`Taking back what the replays before created in ${n} would leave ${r[1]} of their records there \u2014 ${r[2]}: replayed again, the checkpoint's records would stand beside them. Nothing was written. Take the replay back first (--remove; --include-changed takes too what was changed since, and what was added under it since), then replay it again.`;break}case"GUARD_REFUSED":if(o.guard==="non-sandbox")return`A replay goes into a sandbox, a scratch org or a Developer Edition org, never into a production org nor a sandbox marked Staging, which hold real data: ${n} is ${o.tier==="staging"?"a sandbox marked Staging":"a production org"}. Nothing was read or written.`;break}return/dataset/i.test(t)?t.replace(/frozen-dataset load/gi,"replay").replace(/the frozen dataset/gi,"the checkpoint").replace(/the dataset/gi,"the checkpoint").replace(/datasets?/gi,"checkpoint"):t}async function bt(e,t){let n=ke(W(t.storeRoot,t.storeNamed)),o=B(t.storeRoot,t.locksDir);o!==void 0&&await Ye(o,t.say);let r=e.file!==void 0?await qe(e,t):await Ke(e,t,n),s=n.folderOf(r.organizationId,r.checkpointId);await ee(n.root);let d={checkpoints:()=>[t.store,...[B(t.storeRoot,t.locksDir)].filter(f=>f!==void 0)],replays:n},i=t.storeNamed?t.storeRoot:void 0,a=L(r.checkpointId,e.target,i),u=r.name!==void 0?`checkpoint '${r.name}'`:`checkpoint ${r.checkpointId}`,m={request:{organizationId:r.organizationId,checkpointId:r.checkpointId,choices:e.choices,...e.config!==void 0?{config:e.config}:{}},stores:d,folder:s,auditStore:ge(n.root,ze),words:Le(u),refusalOf:Me,reword:(f,h,k)=>Ue(f,h,e.target,k),lines:(f,h)=>Qe(f,h,{asked:e,chosen:r,again:a}),question:f=>`Replay ${u} into ${e.target}, creating ${l(Be(f))} record(s) there${e.again?" once what its replays before created there is purged":""}?`,dryRunEnd:f=>f.length>0?[]:[`To replay it: ${a}${et(e)}`],answer:(f,h)=>nt(f,h,{asked:e,chosen:r,again:a})};await he(We(e,t.json),m)}function Be(e){return e.perObject.reduce((t,n)=>t+n.toInsert,0)}function We(e,t){return{step:e.action==="verify"?"verify":e.action==="remove"?"remove":"load",target:e.target,pilot:!1,reload:e.again,dryRun:e.action==="dryRun",writeEncrypted:!1,muteAutomation:e.muteAutomation,acceptAutomation:e.acceptAutomation,...e.checkpointFirst!==void 0?{checkpointFirst:e.checkpointFirst}:{},includeChanged:e.includeChanged,acceptEmails:e.acceptEmails,sweep:e.sweep,sweepList:e.sweepList,...e.sweepLate?{sweepLate:!0}:{},...e.sweepUntied?{sweepUntied:!0}:{},preview:e.preview,...e.maxRecords!==void 0?{maxTotal:e.maxRecords}:{},yes:e.yes,json:t}}async function Ye(e,t){let n=await e.sweep().catch(()=>{});for(let o of n?.checkpoints??[])t(`deleted the checkpoint '${o.name}' (${o.checkpointId}) of a file received, kept until ${b(o.expiresAt)}: its replays stay, and still take back with --remove`)}async function Ke(e,t,n){let o=e.checkpoint??"",r=B(t.storeRoot,t.locksDir),s=new Set,d=[...await t.listAll(),...await r?.list()??[]].filter(h=>{let k=`${h.organizationId.slice(0,15)}/${h.checkpointId}`;return s.has(k)?!1:(s.add(k),!0)}),i=h=>({organizationId:h.organizationId,checkpointId:h.checkpointId,...h.checkpoint?{name:h.checkpoint.name}:{},of:Ge(h)}),a=e.from;if(me(o)){let h=d.filter(g=>g.checkpointId===o&&(a===void 0||!A.test(a)||ue(g.organizationId,a)));if(h.length===1)return i(h[0]);let k=(await n.list({checkpointId:o})).filter(g=>a===void 0||!A.test(a)||ue(g.sourceOrganizationId,a)),R=[...new Set(k.map(g=>g.sourceOrganizationId))];if(h.length===0&&R.length===1){let g=k[0];return{organizationId:g.sourceOrganizationId,checkpointId:o,...g.checkpointName!==void 0?{name:g.checkpointName}:{}}}if(h.length+R.length>1){let g=[...new Set([...h.map(E=>E.organizationId),...R])];throw new y({code:"AMBIGUOUS",message:`Checkpoints of ${g.length} orgs have the id ${o}: name the org it was taken of with --from (${g.join(", ")}). Nothing was run.`},2)}throw new y({code:"NOT_FOUND",message:`No checkpoint ${o} is kept on this machine, nor a replay of it. `+He(t.storeNamed)})}let u=a??"",m=t.checkpointsOf(d,u,A.test(u)?u:void 0),f=t.resolve(d,m,o,u);if("entry"in f)return i(f.entry);throw"ambiguous"in f?new y({code:"AMBIGUOUS",message:f.ambiguous},2):new y({code:"NOT_FOUND",message:f.none})}function ue(e,t){return e.slice(0,15)===t.slice(0,15)}function He(e){return`"${v("checkpoint")} list" names the checkpoints kept, and "${v("checkpoint")} replays" the replays.${e?"":" One kept in another folder is read with --store <folder>."} A file a teammate sent replays with --file <.sfcheckpoint>.`}function Ge(e){let t=e.checkpoint?.org;if(t===void 0)return;let n=t.alias??t.username;return e.why==="refreshed"?`${n} before its refresh${e.refreshedAt?` on ${e.refreshedAt.slice(0,10)}`:""}`:e.why==="scratchExpired"?`${n}, a scratch org expired since`:n}async function qe(e,t){let n=e.file??"",o=await ae(n);if("refusal"in o)throw new y(o.refusal);let{header:r}=o.read;t.say(`the file holds checkpoint ${r.checkpointId} of org ${r.organizationId}, taken ${b(r.takenAt)}: ${l(r.records)} record(s) of ${l(r.objects)} object(s), exported by SandForge ${r.sandforgeVersion}`);let s={organizationId:r.organizationId,checkpointId:r.checkpointId,file:{path:n,header:r}};if(e.action==="remove")return s;if(e.action!=="verify"){let u=Ze(r,e);if(u!==void 0)throw new y(u)}let d=e.keyEnv!==void 0?Ve(e.keyEnv):await Je(),i=await se({storeRoot:t.storeRoot,...t.locksDir!==void 0?{locksDir:t.locksDir}:{},file:n,key:d,keepDays:e.keepDays,takenOn:{host:be(),pid:process.pid}});if(!i.imported)throw new y(i.refusal);let{checkpoint:a}=i;return t.say(i.outcome==="imported"?`kept checkpoint '${a.name}' of the file on this machine, apart from those it rewinds, to replay it: ${D(t.storeRoot)}, `+(a.expiresAt===null?"until it is deleted":`until ${b(a.expiresAt)} (--keep-days)`):`checkpoint '${a.name}' of the file is kept on this machine already, the same`),{...s,name:a.name,of:a.org.alias??a.org.username}}function Ze(e,t){if(t.choices.mask)return;let n=le({tier:e.orgTier,...e.dataStorageMaxMB!==void 0?{dataStorageMaxMB:e.dataStorageMaxMB}:{},...e.staging?{staging:!0}:{}}),o=`The file holds checkpoint ${e.checkpointId}`;if(n.kind==="real")return{code:"REPLAY_REAL_DATA",message:`${o} of ${n.why==="staging"?"a sandbox marked Staging":`a Partial Copy or Full sandbox, by its data storage (${l(n.dataStorageMaxMB??0)} MB)`}, which may hold real data: it goes into another org masked only. To replay it into ${t.target}, ${F.mask}. Its key was not read, and nothing was kept, read or written.`};if(n.kind==="unknown"&&t.choices.noRealData!==!0)return{code:"REPLAY_COPY_UNKNOWN",message:`${o} of a sandbox, and does not say which: made before SandForge 1.81, it keeps no data storage, and a Partial Copy or a Full sandbox holds production\u2019s records. To replay it into ${t.target}, ${F.mask}, or ${F.noRealData}. Its key was not read, and nothing was kept, read or written.`}}function Ve(e){let t=process.env[e];if(t===void 0||t.trim()==="")throw new y({code:"NO_KEY",message:`${e} is not set: it holds no key. Nothing was run.`},2);let n=C(t);if(n===void 0)throw new y({code:"NO_KEY",message:`${e} holds no key SandForge reads: 52 letters and digits, in groups of four as an export shows one. Nothing was run.`},2);return n}async function Je(){let e=await ne("Key of the file (not shown as you type it):","give --key-env VAR, the name of an environment variable that holds the key");if(e===void 0||e.trim()==="")throw new y({code:"DECLINED",message:"No key was typed. Nothing was run."});let t=C(e);if(t===void 0)throw new y({code:"IMPORT_KEY",message:"That is not a key SandForge draws: 52 letters and digits, in groups of four as the export showed it. Nothing was run."});return t}function Xe(e){let t=e.payload?.replay;return typeof t=="object"&&t!==null?t:void 0}function Qe(e,t,n){let o=Xe(e);if(o===void 0)return t;let{again:r}=n,s=o.target.name,d=o.filesLeft.length>0?` ${l(o.filesLeft.length)} file(s) are not replayed: a checkpoint keeps no file's content.`:"";if(e.type==="frozen:load:preview:response"){let i=n.chosen.of??o.checkpoint.alias??o.checkpoint.organizationId;return[`A replay of checkpoint '${o.checkpoint.name}' (of ${i}, taken ${b(o.checkpoint.takenAt)}) into ${s} would create copies of ${l(o.summary.records.toCreate)} of its records there, parents first, with new Ids; nothing ${s} holds is changed or deleted.${d}`,...t,...xe(o)]}return e.type==="frozen:load:response"?[...t,`To take it back: ${r} --remove`]:t}function et(e){let{choices:t}=e,n=e.checkpointFirst;return[t.objects.length>0?` --objects ${t.objects.join(",")}`:"",...t.excluded.map(o=>` --exclude-object ${o}`),t.owners!=="same"?` --owners ${t.owners}`:"",e.ownerMapFile!==void 0?` --owner-map ${z(e.ownerMapFile)}`:"",...t.link.map(o=>` --link ${o.objectApiName}=${o.fields.join(",")}`),t.customSettings?" --custom-settings":"",t.mask?" --mask":"",t.contactPoints==="kept"?" --keep-contact-points":"",t.noRealData?" --no-real-data":"",e.configFile!==void 0?` --replay-config ${z(e.configFile)}`:"",e.again?" --again":"",e.muteAutomation?" --mute-automation":"",e.acceptAutomation?" --accept-automation":"",e.acceptEmails?" --accept-emails":"",n!==void 0?" --checkpoint-first":"",n?.keepDays!==void 0?` --checkpoint-keep-days ${n.keepDays}`:"",...(n?.excluded??[]).map(o=>` --checkpoint-exclude-object ${o}`),e.maxRecords!==void 0?` --max-records ${e.maxRecords}`:""].join("")}function U(e,t){return e.filter(n=>n.type===t).at(-1)?.payload}var tt=new Set(["tool","step","posted","dataset","checkpoint"]);function nt(e,t,n){let{asked:o,chosen:r,again:s}=n,d=U(e.posted,"frozen:load:preview:response"),i=U(e.posted,"frozen:load:response"),a=i?.replay??d?.replay,u=d?.plan,m=i?.report,f=U(e.posted,"frozen:remove:response")?.result,h=Object.fromEntries(Object.entries(e).filter(([g])=>!tt.has(g))),k=e.checkpoint,R=a?.target.organizationId??t.targetOrgId;return{command:"replay",action:o.action,dryRun:o.action==="dryRun",checkpoint:a?{id:a.checkpoint.checkpointId,name:a.checkpoint.name,organizationId:a.checkpoint.organizationId,takenAt:a.checkpoint.takenAt,tier:a.checkpoint.tier,annex:a.checkpoint.annex}:{id:r.checkpointId,...r.name!==void 0?{name:r.name}:{},organizationId:r.organizationId},target:{alias:o.target,...R!==void 0?{organizationId:Q(R)}:{}},...o.action==="replay"||o.action==="dryRun"?{choices:a?.choices??o.choices}:{},...r.file?{file:r.file.path}:{},...u?{plan:u}:{},...a?{replay:{...a.summary,filesLeft:a.filesLeft,...a.storage?{storage:a.storage}:{},requests:a.requests}}:{},...m?{result:m}:{},...f!==void 0?{removal:f}:{},...h,...k?{checkpointFirst:k}:{},removeWith:`${s} --remove`,...t.refused?{refused:t.refused}:{},...t.ended?{ended:t.ended}:{},exit:t.exit}}function ot(e,t){return{checkpointId:e.checkpointId,...e.checkpointName!==void 0?{checkpointName:e.checkpointName}:{},sourceOrganizationId:e.sourceOrganizationId,...e.takenAt!==void 0?{takenAt:e.takenAt}:{},target:e.target,...e.choices!==void 0?{choices:e.choices}:{},...e.replayedAt!==void 0?{replayedAt:e.replayedAt}:{},inPlace:e.inPlace,inPlaceByObject:e.inPlaceByObject,...e.removed?{removed:!0}:{},removeWith:`${L(e.checkpointId,e.target.name??"<alias>",t)} --remove`}}function rt(e,t,n,o){return e.length===0?[`No replay${n!==void 0?` into ${n}`:""} is kept in ${t}.`]:e.flatMap(r=>{let s=r.target.name??r.target.organizationId,d=r.inPlaceByObject.map(i=>`${i.objectApiName} ${l(i.records)}`).join(", ");return[`${r.checkpointId} ${r.checkpointName!==void 0?`'${r.checkpointName}' `:""}of ${r.sourceOrganizationId}${r.takenAt!==void 0?`, taken ${b(r.takenAt)}`:""} into ${s} (${r.target.organizationId})`+(r.replayedAt!==void 0?` replayed ${b(r.replayedAt)}`:""),r.inPlace>0?` ${l(r.inPlace)} record(s) in place: ${d}`:r.removed?" removed: none of its records is left there":" none of its records is left there",...r.inPlace>0?[` to take it back: ${L(r.checkpointId,r.target.name??"<alias>",o)} --remove`]:[]]})}async function At(e,t){let n=ke(W(t.storeRoot,t.storeNamed)),o=await n.list(e!==void 0&&A.test(e)?{targetOrganizationId:e}:{}),r=e!==void 0&&!A.test(e)?o.filter(d=>d.target.name===e):o,s=t.storeNamed?t.storeRoot:void 0;for(let d of rt(r,n.root,e,s))t.say(d);t.answerJson(r.map(d=>ot(d,s)))}async function Et(e,t){let n;try{n=new x({root:W(t.storeRoot,t.storeNamed)})}catch{return{lines:[],entries:[]}}let o=t.storeNamed?t.storeRoot:void 0,r=[],s=[];for(let d of e){let i=await n.replaysOf(d.organizationId,d.checkpointId).catch(()=>[]),a=pe(i);if(a!==void 0){r.push(` ${a}`);for(let u of de(i))r.push(` to take it back: ${L(u.checkpointId,u.target.name??"<alias>",o)} --remove`),s.push(u)}}return{lines:r,entries:s}}export{Rt as a,$t as b,y as c,vt as d,L as e,je as f,bt as g,ot as h,At as i,Et as j};
@@ -1,7 +0,0 @@
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{Zb as P,bc as v,ec as S}from"./chunk-R3OM3X4L.mjs";import{a as A,b as E}from"./chunk-VV3B6IC3.mjs";import{b as R}from"./chunk-CA5NAXSU.mjs";import{Rd as m,be as h,ee as c}from"./chunk-6QSHWIZI.mjs";import{b,f,k as w,l as p}from"./chunk-WZQEK4WT.mjs";var k="Messaging.reserveSingleEmailCapacity(1);",M="System.NoAccessException: The organization is not permitted to send email",x=`/tooling/executeAnonymous?anonymousBody=${encodeURIComponent(k)}`,I=`/query?q=${encodeURIComponent("SELECT PermissionsEmailSingle FROM UserPermissionAccess")}`,L=3e4,$=p({compiled:f(),success:f(),compileProblem:b().nullish(),exceptionMessage:b().nullish()}).loose(),O=p({records:w(p({PermissionsEmailSingle:f().optional()}).loose())}).loose(),V={reading:{unread:"SandForge runs no Apex in a production org"},requests:0};function U(e){return e%1e3===0?`${e/1e3} s`:`${e} ms`}function T(e,n){return e instanceof A?`the org did not answer within ${U(n)}`:`the org refused it: ${R(e)}`}function _(e){let n=$.safeParse(e);if(!n.success)return{unread:"its answer is not one anonymous Apex gives"};let{compiled:t,success:s,compileProblem:r,exceptionMessage:i}=n.data;if(!t)return{unread:`it did not compile${r?`: ${r}`:""}`};if(s)return{level:"all"};let a=i?.trim();return a===M?{refused:!0}:{unread:a?`the org answered: ${a}`:"it failed, and the org did not say why"}}async function Y(e,n={}){let t=n.timeoutMs??L,s=u=>new E(t).withTimeout("forge:deliverability",()=>e.request({method:"GET",url:u})),r;try{r=await s(x)}catch(u){return{reading:{unread:T(u,t)},requests:1}}let i=_(r);if(!("refused"in i))return{reading:i,requests:1};let a="so the org's refusal does not say how it is set",d;try{d=await s(I)}catch(u){return{reading:{unread:`whether the user the run writes as may send email could not be read (${T(u,t)}), ${a}`},requests:2}}let l=O.safeParse(d),o=l.success?l.data.records[0]?.PermissionsEmailSingle:void 0;return o===!0?{reading:{level:"withheld"},requests:2}:{reading:{unread:o===!1?`the user the run writes as may not send email (Send Email), ${a}`:`the org did not say whether the user the run writes as may send email, ${a}`},requests:2}}async function F(e){let n=m(e.running,{applyAssignmentRules:e.applyAssignmentRules,writes:e.writes}),t=P(e.running.automation.unread??[],{applyAssignmentRules:e.applyAssignmentRules===!0}),s=t!==void 0?{sendersUnread:t}:{};if(n.length===0&&t===void 0)return{senders:n};let r;try{r=await e.read()}catch(i){r={reading:{unread:R(i)},requests:1}}return{senders:n,...s,read:r}}function N(e,n={}){let t=i=>`${i.objectApiName}\0${i.kind}\0${i.name}`,s=m(c(e,void 0,n.writes),n),r=new Set(m(c(e,h(e,n.writes),n.writes),n).map(t));return s.filter(i=>!r.has(t(i)))}function q(e,n){let t=new Set([...n.assigned,...n.held]);return{assign:e.assign.filter(s=>t.has(s.permissionSet))}}var z=["flows","processes","workflowRules"];async function Q(e){let{plan:n,writes:t,applyAssignmentRules:s,read:r,target:i,run:a}=e,d=typeof r.unread=="string"?void 0:r,l=s===!0?{applyAssignmentRules:s}:{},o=await F({running:d?c(d,n,t):{automation:{objects:[],unread:z.map(y=>({part:y,reason:String(r.unread)}))},firing:[]},...l,writes:t,read:e.readDeliverability}),u=e.mayMute===!0&&n===void 0&&d!==void 0&&o.senders.length>0?N(d,{...l,writes:t}):[],g=o.read?.reading;return{ofRun:o,gate:v({senders:o.senders,...o.sendersUnread!==void 0?{sendersUnread:o.sendersUnread}:{},...g!==void 0?{reading:g}:{},accepted:e.accepted,target:i,run:a,muteQuiets:u,keepsAddresses:e.keepsAddresses===!0}),afterLease:(y,D)=>{if(!(n===void 0||d===void 0))return S({planned:o.senders,held:m(c(d,q(n,y),t),{...l,writes:t}),...g!==void 0?{reading:g}:{},accepted:D,target:i,run:a})}}}export{L as a,V as b,Y as c,F as d,N as e,q as f,Q as g};
@@ -1,7 +0,0 @@
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 xe}from"./chunk-NS6ONPWL.mjs";import{a as Pe,b as Te,c as je,d as Oe,f as Me}from"./chunk-M6P5ZZLE.mjs";import{Ba as We,T as De,ba as Le,da as qe,fa as Ie,ja as U,qa as Ve,ra as Ue,wa as Be,ya as B,za as Qe}from"./chunk-R3OM3X4L.mjs";import{b as E}from"./chunk-CA5NAXSU.mjs";import{$d as Ge,O as Fe,Q as ve,R as Ne,S as _e,T as Ae,U as Ce,V as Se,W as Ee,ja as $e}from"./chunk-6QSHWIZI.mjs";import{e as X,l as ee}from"./chunk-WZQEK4WT.mjs";var v=class extends Error{};function ct(e){let r=[],n=0;for(;n<e.length;){let t=e.slice(n),s=/^\s+/.exec(t);if(s){n+=s[0].length;continue}if(t.startsWith("/*")){let d=e.indexOf("*/",n+2);if(d<0)throw new v("an unclosed comment");n=d+2;continue}let l=t[0];if(l==="'"||l==='"'){let d=1;for(;d<t.length&&t[d]!==l;)d+=t[d]==="\\"?2:1;if(d>=t.length)throw new v("an unclosed text");r.push(t.slice(0,d+1)),n+=d+1;continue}let f=/^(?:\d+(?:\.\d+)?|[A-Za-z_$][A-Za-z0-9_$.]*)/.exec(t);if(f){r.push(f[0]),n+=f[0].length;continue}let p=/^(?:&&|\|\||==|!=|<>|<=|>=|[=<>+\-*/^&!(),])/.exec(t);if(!p)throw new v(`an unexpected character: ${t[0]}`);r.push(p[0]),n+=p[0].length}return r}var Ke=[new Set(["||"]),new Set(["&&"]),new Set(["=","==","<>","!=","<",">","<=",">="]),new Set(["+","-","&"]),new Set(["*","/"]),new Set(["^"])];function dt(e){let r=ct(e),n=0,t=()=>r[n],s=u=>{if(r[n]!==u)throw new v(`${u} expected`);n++},l=u=>{if(u>=Ke.length)return f();let o=l(u+1);for(let a=t();a!==void 0&&Ke[u].has(a);a=t())n++,o={kind:"binary",op:a,left:o,right:l(u+1)};return o},f=()=>{if(t()==="!")return n++,{kind:"not",arg:f()};if(t()==="-"||t()==="+"){let u=r[n++],o=f();return u==="-"?{kind:"negative",arg:o}:o}return p()},p=()=>{let u=r[n++];if(u===void 0)throw new v("the formula ends early");if(u==="("){let a=l(0);return s(")"),a}if(u.startsWith("'")||u.startsWith('"'))return{kind:"literal",value:`text:${u.slice(1,-1)}`};if(/^\d/.test(u))return{kind:"literal",value:`number:${Number(u)}`};if(!/^[A-Za-z_$]/.test(u))throw new v(`${u} out of place`);if(t()==="("){n++;let a=[];if(t()!==")")for(a.push(l(0));t()===",";)n++,a.push(l(0));return s(")"),{kind:"call",name:u.toUpperCase(),args:a}}let o=u.toUpperCase();return o==="TRUE"||o==="FALSE"||o==="NULL"?{kind:"literal",value:o.toLowerCase()}:{kind:"reference",name:u.toLowerCase()}},d=l(0);if(n!==r.length)throw new v(`${r[n]} out of place`);return d}function $(e){switch(e.kind){case"call":return e.name==="PRIORVALUE"&&e.args.length===1?$(e.args[0]):{...e,args:e.args.map($)};case"binary":return{...e,left:$(e.left),right:$(e.right)};case"not":case"negative":return{...e,arg:$(e.arg)};default:return e}}function N(e){switch(e.kind){case"call":return`${e.name}(${e.args.map(N).join(",")})`;case"binary":{let r=e.op==="=="?"=":e.op==="!="?"<>":e.op,n=[N(e.left),N(e.right)];return(r==="="||r==="<>")&&n.sort(),`(${n[0]} ${r} ${n[1]})`}case"not":return`NOT(${N(e.arg)})`;case"negative":return`-(${N(e.arg)})`;case"literal":return e.value;case"reference":return e.name}}var ze=e=>e==="true"?"false":e==="false"?"true":"unknown";function O(e){return e.kind==="call"&&e.name==="AND"?e.args.flatMap(O):e.kind==="binary"&&e.op==="&&"?[...O(e.left),...O(e.right)]:[e]}function M(e){return e.kind==="call"&&e.name==="OR"?e.args.flatMap(M):e.kind==="binary"&&e.op==="||"?[...M(e.left),...M(e.right)]:[e]}function te(e){if(e.kind==="not"){let r=te(e.arg);return{condition:r.condition,holds:!r.holds}}if(e.kind==="call"&&e.name==="NOT"&&e.args.length===1){let r=te(e.args[0]);return{condition:r.condition,holds:!r.holds}}return e.kind==="binary"&&(e.op==="<>"||e.op==="!=")?{condition:N({...e,op:"="}),holds:!1}:{condition:N(e),holds:!0}}function ne(e){if(e.kind==="literal"){if(e.value==="true")return"true";if(e.value==="false")return"false"}}function R(e){let r=ne(e);if(r)return r;if(e.kind==="not")return ze(R(e.arg));if(e.kind==="call")switch(e.name){case"ISCHANGED":return"false";case"ISNEW":return"true";case"NOT":return e.args.length===1?ze(R(e.args[0])):"unknown";case"AND":return He(O(e));case"OR":return Ze(M(e));case"IF":{if(e.args.length!==3)return"unknown";let[n,t,s]=e.args,l=R(n);if(l==="true")return R(t);if(l==="false")return R(s);let f=R(t);return f===R(s)?f:"unknown"}default:return"unknown"}return e.kind==="binary"?e.op==="&&"?He(O(e)):e.op==="||"?Ze(M(e)):ft(e):"unknown"}function He(e){let r=e.map(R);if(r.includes("false"))return"false";let n=new Map;for(let t of e){let{condition:s,holds:l}=te(t),f=n.get(s);if(f!==void 0&&f!==l)return"false";n.set(s,l)}return r.every(t=>t==="true")?"true":"unknown"}function Ze(e){let r=e.map(R);return r.includes("true")?"true":r.every(n=>n==="false")?"false":"unknown"}function ft(e){let r=e.op==="="||e.op==="==",n=e.op==="<>"||e.op==="!=";if(N(e.left)===N(e.right))return n||e.op==="<"||e.op===">"?"false":"unknown";if(!r&&!n)return"unknown";let t=ne(e.left)??R(e.left),s=ne(e.right)??R(e.right);return t==="unknown"||s==="unknown"?"unknown":t===s===r?"true":"false"}function Ye(e){try{return R($(dt(e)))==="false"}catch(r){if(r instanceof v)return!1;throw r}}var nt=25,W=20,ie=W*De,G=4,Je=10,pt=2e3,gt=.8,Xe=["validationRules","validationRuleFormulas","duplicateRules","duplicateRuleActions","userPermissions","permissionSets","targetFields","sourceFields","apiBudget"];function mt(e){return typeof e!="object"||e===null?null:{optional:e.optionalFilter===!0}}function Bt(e){return{name:e.name,type:String(e.type),createable:e.createable===!0,nillable:e.nillable!==!1,defaultedOnCreate:e.defaultedOnCreate===!0,referenceTo:(e.referenceTo??[]).filter(r=>typeof r=="string"),picklistValues:(e.picklistValues??[]).filter(r=>r?.active!==!1&&typeof r?.value=="string").map(r=>r?.value),lookupFilter:mt(e.filteredLookupInfo)}}function oe(e){return`SELECT Id, ValidationName, NamespacePrefix, ErrorDisplayField, ErrorMessage, EntityDefinition.QualifiedApiName FROM ValidationRule WHERE Active = true AND EntityDefinition.QualifiedApiName IN (${e.map(n=>`'${n}'`).join(", ")})`}function ht(e){return`SELECT QualifiedApiName, Label FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = '${x.test(e)?e:""}'`}function q(e){return`SELECT Metadata FROM ValidationRule WHERE Id = '${e}'`}var yt="SELECT DeveloperName, MasterLabel, NamespacePrefix, SobjectType FROM DuplicateRule WHERE IsActive = true",ae=/^[A-Za-z0-9]{15}([A-Za-z0-9]{3})?$/,x=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,wt=ee({DailyApiRequests:ee({Max:X(),Remaining:X()}).loose()}).loose(),y=e=>typeof e=="string"?e:"";function le(e){if(typeof e!="object"||e===null)return;let r=e.QualifiedApiName;return typeof r=="string"&&r!==""?r:void 0}function Q(e,r){return e?`${e}__${r}`:r}function L(e){return typeof e=="string"?[e]:Array.isArray(e)?e.filter(r=>typeof r=="string"):[]}function bt(e){return{...e,nodes:e.nodes.map(r=>r.leftOutByUser===!0?{...r,included:!0}:r)}}function se(e,r){let n=y(e).trim(),t=n.slice(n.lastIndexOf(".")+1);if(x.test(t))return r?r.find(s=>s.name.toLowerCase()===t.toLowerCase())?.name:t}function rt(e){let r=Ve({filterFormula:e}).filter(t=>t.bypass).map(t=>t.name),n=Ue(e).map(t=>t.value===void 0?t.reference:`${t.reference} = '${t.value}'`);return{bypasses:[...r.map(t=>`$Permission.${t}`),...n],permissions:r}}function Rt(e,r={}){let n=r.maxRecordsPerObject,t=e.nodes.filter(d=>d.included),s=$e(r)?"atMost":"exact",l=t.map(d=>d.recordCountUnknown===!0?(n===void 0?s="unknown":s==="exact"&&(s="atMost"),{...d,recordCount:n??0}):{...d,recordCount:n===void 0?d.recordCount:Math.min(d.recordCount,n)}),f=new xe().generate({...e,nodes:l}).totalApiCalls,p=l.reduce((d,u)=>d+Math.max(1,Math.ceil(u.recordCount/pt)),0);return{writes:f,reads:p,bound:s}}function P(e){let{idValue:r,...n}=e;return{id:Fe(e.kind,e.objectApiName,e.field,e.recordType,r??e.value),source:"metadata",rows:0,...n}}function ue(e){return e?{field:e}:{}}function Qt(e){return async r=>Ie(await e.request({method:"POST",url:"/tooling/composite",body:JSON.stringify(qe(`/services/data/v${e.version}`,r)),headers:{"Content-Type":"application/json"}}),r.length)}async function kt(e,r,n){let t=e.filter(({id:s})=>ae.test(s));t.length!==0&&await U(r,[{queries:t.map(({id:s,rule:l})=>({soql:q(s),retrieve:{sobject:"ValidationRule",id:s},take:f=>{let p=f[0]?.Metadata,d=typeof p=="object"&&p!==null?p.errorConditionFormula:void 0;typeof d=="string"&&Ye(d)&&(l.onChangeOnly=!0)},refused:()=>{}})),requests:W}],G,n)}async function Ft(e,r,n,t,s){let l=[...new Set(r)].filter(m=>x.test(m));if(l.length===0)return[];let f=new Map(l.map(m=>[m.toLowerCase(),m])),p=new Map(l.map((m,b)=>[m,b])),d=await e(oe(l)),u=new Map,o=async(m,b)=>{let k=se(b,void 0);if(!n)return k;let F=u.get(m);F||(F=n(m).catch(()=>[]),u.set(m,F));let C=y(b).trim().toLowerCase();if(!C)return;let _=k?.toLowerCase(),S=await F;return S.length===0?k:S.find(A=>A.name.toLowerCase()===_)?.name??S.find(A=>A.label?.trim().toLowerCase()===C)?.name},h=(await Promise.all(d.map(async m=>{let b=le(m.EntityDefinition),k=b===void 0?void 0:f.get(b.toLowerCase()),F=y(m.ValidationName);return!k||!F?[]:[{id:y(m.Id),rule:{objectApiName:k,name:Q(y(m.NamespacePrefix),F),message:y(m.ErrorMessage),...ue(await o(k,m.ErrorDisplayField))}}]}))).flat().sort((m,b)=>(p.get(m.rule.objectApiName)??0)-(p.get(b.rule.objectApiName)??0)||m.rule.name.localeCompare(b.rule.name));return t&&await kt(h,t,s),h.map(({rule:m})=>m)}async function Wt(e,r,n,t){let s=[...new Set(r)].filter(a=>x.test(a));if(s.length===0)return{rules:[],notRead:0,requests:0};let l=new Map(s.map(a=>[a.toLowerCase(),a])),f=await e(oe(s)),p=f.requests,d=f.records.flatMap(a=>{let h=le(a.EntityDefinition),m=h===void 0?void 0:l.get(h.toLowerCase()),b=y(a.ValidationName);return!m||!b?[]:[{id:y(a.Id),objectApiName:m,name:Q(y(a.NamespacePrefix),b),read:!1,permissions:[]}]}),u=d.filter(a=>ae.test(a.id)),o=(a,h)=>{let m=typeof h=="object"&&h!==null?h.errorConditionFormula:void 0;typeof m=="string"&&(a.read=!0,a.permissions=rt(m).permissions)};return n?p+=await U(n,[{queries:u.slice(0,ie).map(a=>({soql:q(a.id),retrieve:{sobject:"ValidationRule",id:a.id},take:h=>o(a,h[0]?.Metadata),refused:()=>{}})),requests:W}],G,t):await B(u.slice(0,nt).map(a=>async()=>{try{let h=await e(q(a.id));p+=h.requests,o(a,h.records[0]?.Metadata)}catch{p++}}),G),{rules:d.filter(a=>a.permissions.length>0).map(({objectApiName:a,name:h,permissions:m})=>({objectApiName:a,name:h,permissions:m})),notRead:d.filter(a=>!a.read).length,requests:p}}function Kt(e,r,n){let t=async s=>(await e(ht(s))).flatMap(l=>typeof l.QualifiedApiName=="string"?[{name:l.QualifiedApiName,...typeof l.Label=="string"?{label:l.Label}:{}}]:[]);return s=>Ft(e,s,t,r,n)}var et=class{deps;constructor(r){this.deps=r}async read(r,n,t,s={}){let l=new Set(s.excludedObjects??[]),f=Qe(bt(t),l),p=[];if(f.length===0)return{gaps:[],unread:[],requests:0};let d=0,u=(i,c,g)=>{p.push({part:i,reason:c,...g!==void 0?{objectApiName:g}:{}})},o=new Map(f.map(i=>[i.toLowerCase(),i])),a=i=>i===void 0?void 0:o.get(i.toLowerCase()),h=new Map(f.map((i,c)=>[i,c])),m=f.filter(i=>x.test(i)),b=[],k=[],F,C,_=new Map,S=new Map,A=new Set,I=(i,c,g)=>async()=>{try{let w=await c();d+=w.requests,g(w.records)}catch(w){d++,u(i,E(w))}},ce=(i,c,g,w)=>async()=>{try{let{fields:J,sent:lt,createable:ut}=await this.deps.describeFields(i,c);lt&&d++,w.set(c,J),w===_&&ut===!1&&A.add(c)}catch(J){d++,u(g,`${c}: ${E(J)}`,c)}};await B([...m.length>0?[I("validationRules",()=>this.deps.toolingQuery(n,oe(m)),i=>{b=i})]:[],I("duplicateRules",()=>this.deps.query(n,yt),i=>{k=i}),async()=>{try{d++,F=await this.deps.readLimits(n)}catch(i){C=E(i)}},...f.flatMap(i=>[ce(n,i,"targetFields",_),ce(r,i,"sourceFields",S)])],G);let T=b.flatMap(i=>{let c=a(le(i.EntityDefinition)),g=y(i.ValidationName);if(!c||!g)return[];let w=y(i.Id);return[{id:ae.test(w)?w:null,name:Q(y(i.NamespacePrefix),g),objectApiName:c,...ue(se(i.ErrorDisplayField,_.get(c))),message:y(i.ErrorMessage),formula:"notRead",bypasses:[],permissions:[]}]}).sort((i,c)=>(h.get(i.objectApiName)??0)-(h.get(c.objectApiName)??0)||i.name.localeCompare(c.name)),{toolingQueries:j,toolingRetrieves:de}=this.deps,K=T.filter(i=>i.id!==null).slice(0,j?ie:nt);for(let i of T)i.id===null&&(i.formula="unreadable");let z=k.flatMap(i=>{let c=a(y(i.SobjectType)),g=Q(y(i.NamespacePrefix),y(i.DeveloperName));return!c||!y(i.DeveloperName)?[]:[{objectApiName:c,developerName:g,label:y(i.MasterLabel)||g,fullName:`${y(i.SobjectType)}.${g}`}]}),fe=new Map,pe=[];for(let i=0;i<z.length;i+=Je)pe.push(z.slice(i,i+Je).map(c=>c.fullName));let V,H,ge=(i,c)=>{let g=typeof c=="object"&&c!==null?c.errorConditionFormula:void 0;if(typeof g!="string"){i.formula="unreadable";return}i.formula="read",Object.assign(i,rt(g));let w=se(c.errorDisplayField,_.get(i.objectApiName));w&&(i.field=w)},it=async()=>{if(!j||K.length===0)return;let i=await U(c=>j(n,c),[{queries:K.map(c=>({soql:q(c.id),retrieve:{sobject:"ValidationRule",id:c.id},take:g=>ge(c,g[0]?.Metadata),refused:g=>{c.formula="unreadable",V??=g}})),requests:W}],G,de&&(c=>de(n,c)));d+=i},me=new Map,Z={},he=[...A].filter(i=>x.test(i)),ot=async()=>{let[i,c]=await Promise.all([Oe((g,w)=>this.deps.toolingQuery(g,w),n,he),this.deps.createFacts?this.deps.createFacts(n).then(g=>({facts:g,requests:0})).catch(()=>({facts:{},requests:0})):je(this.deps,n)]);d+=i.requests+c.requests;for(let[g,w]of i.answered)me.set(g,w);Z=c.facts};await B([...he.length>0?[ot]:[],...j?[it]:[],...(j?[]:K).map(i=>async()=>{try{let c=await this.deps.toolingQuery(n,q(i.id));d+=c.requests,ge(i,c.records[0]?.Metadata)}catch(c){d++,i.formula="unreadable",V??=E(c)}}),...pe.map(i=>async()=>{try{d++;for(let c of await this.deps.readDuplicateRules(n,i)){if(typeof c!="object"||c===null)continue;let g=c,w=y(g.fullName);w&&fe.set(w.toLowerCase(),g)}}catch(c){H??=E(c)}})],G),V!==void 0&&u("validationRuleFormulas",V),H!==void 0&&u("duplicateRuleActions",H);let Y=new Set,ye=!1;T.some(i=>i.permissions.length>0)&&await I("userPermissions",()=>this.deps.query(n,Le),i=>{ye=!0;for(let c of i)Y.add(Be(y(c.NamespacePrefix),y(c.DeveloperName)))})();let we=[...new Set(T.flatMap(i=>i.permissions.filter(c=>!Y.has(c.toLowerCase()))))],at=we.length>0?await We(we,async i=>{let c=[];return await I("permissionSets",()=>this.deps.query(n,i),g=>{c=g})(),c},()=>p.some(i=>i.part==="permissionSets")):void 0,be=[...T.map(i=>At(i,ye?Y:void 0,at)),...z.map(i=>Ct(i,fe.get(i.fullName.toLowerCase()))),...f.flatMap(i=>{if(A.has(i))return[_t(i,Pe(i,Z,me.get(i.toLowerCase())),_.get(i)??[],Z)];let c=_.get(i),g=S.get(i);return c&&g?St(i,c,g,s):[]})],Re=wt.safeParse(F),ke=C===void 0&&Re.success?Re.data.DailyApiRequests:void 0;return ke||u("apiBudget",C??"the limits the org answered hold no DailyApiRequests"),be.push(Et(t,s,f[0],ke)),{gaps:Ae(be),unread:vt(p,h),requests:d}}};function vt(e,r){let n=t=>t===void 0?-1:r.get(t)??r.size;return[...e].sort((t,s)=>n(t.objectApiName)-n(s.objectApiName)||Xe.indexOf(t.part)-Xe.indexOf(s.part)||(t.reason<s.reason?-1:t.reason>s.reason?1:0)).map(({part:t,reason:s})=>({part:t,reason:s}))}var Nt={platform:"object_platform_only",setup:"object_setup_only",feature:"object_feature_off",parent:"object_through_parent",user:"object_not_createable"};function _t(e,r,n,t){let s=r==="parent"?Me(n,t):[];return P({kind:Nt[r],severity:Te(r)?"info":"blocking",objectApiName:e,...s.length>0?{detail:{editOn:s}}:{},decisions:["exclude_object"]})}function At(e,r,n){let t=r?e.permissions.filter(f=>r.has(f.toLowerCase())):[],s=t.length>0?[]:e.permissions.flatMap(f=>{let p=n?.find(d=>d.permission.toLowerCase()===f.toLowerCase());return p?[Ce(p)]:[]}),l=e.field?["leave_empty","ignore"]:["ignore"];return P({kind:"validation_rule",severity:t.length>0?"info":"warning",objectApiName:e.objectApiName,...ue(e.field),idValue:e.name,detail:{rule:e.name,message:e.message,formula:e.formula,...e.bypasses.length>0?{bypasses:e.bypasses}:{},...t.length>0?{heldBypasses:t}:{},...s.length>0?{assign:s}:{}},decisions:l,...e.field?{defaultDecision:"leave_empty"}:{}})}function Ct(e,r){let n=y(r?.actionOnInsert).toLowerCase(),t=n==="block"||n==="allow"?n:"unknown",s=L(r?.operationsOnInsert).map(f=>f.toLowerCase());return P({kind:"duplicate_rule",severity:t==="allow"?"info":"warning",objectApiName:e.objectApiName,idValue:e.developerName,detail:{rule:e.label,developerName:e.developerName,action:t,...t==="allow"?{alert:s.includes("alert")}:{},...t==="allow"?{report:s.includes("report")}:{}},decisions:t==="allow"?["ignore"]:["ignore","exclude_object"],...t==="allow"?{defaultDecision:"ignore"}:{}})}function St(e,r,n,t){let s=o=>o.toLowerCase(),l=new Set((t.fieldExclusions?.[e]??[]).map(s)),f=new Map(Object.entries(t.fieldMappings?.[e]??{}).map(([o,a])=>[s(o),s(a)])),p=new Set([...f].filter(([o])=>!l.has(o)).map(([,o])=>o)),d=new Map(n.map(o=>[s(o.name),o])),u=o=>{let a=s(o);if(p.has(a))return;let h=d.get(a);return h?l.has(a)||f.has(a)?"excluded":h.createable?void 0:"notCreateableInSource":"notInSource"};return r.flatMap(o=>{let a=u(o.name);if(o.createable&&!o.nillable&&!o.defaultedOnCreate&&a)return[P({kind:"required_field_missing",severity:"blocking",objectApiName:e,field:o.name,detail:{type:o.type,reason:a,...o.referenceTo.length>0?{referenceTo:o.referenceTo}:{},...o.picklistValues.length>0?{values:o.picklistValues}:{}},decisions:["set_default","exclude_object"]})];if(o.type==="reference"&&o.lookupFilter&&!a){let h=o.nillable;return[P({kind:"lookup_filter",severity:"warning",objectApiName:e,field:o.name,detail:{referenceTo:o.referenceTo,optional:h,filterOptional:o.lookupFilter.optional},decisions:h?["leave_empty","ignore"]:["ignore","exclude_object"],...h?{defaultDecision:"leave_empty"}:{}})]}return[]})}function Et(e,r,n,t){let s=e.nodes[0]?.objectApiName??n,l=Rt(e,r),f=l.writes+l.reads,p="warning";if(t&&l.bound!=="unknown"){let d=f>t.Remaining,u=t.Max-t.Remaining+f>gt*t.Max;p=d&&l.bound==="exact"?"blocking":d||u?"warning":"info"}return P({kind:"api_budget",severity:p,objectApiName:s,detail:{calls:f,writes:l.writes,reads:l.reads,estimate:l.bound,...t?{max:t.Max,remaining:t.Remaining}:{budgetRead:!1}},decisions:["ignore"]})}var $t={blocking:"BLOCKING",warning:"warning",info:"info"},Gt=new Set(["picklist_value_refused","dependent_value_invalid","picklist_value_absent","currency_inactive"]),xt=new Set(["record_type_unmapped","record_type_unavailable"]);function st(e,r,n=[e.id]){if(ve(r.ignoredGaps,e.id,n)!==void 0)return"left as it is";let t=e.objectApiName;if(r.excludedObjects?.includes(t))return`${t} left out of the run`;let s=new Set(e.decisions),{field:l,value:f}=e;if(s.has("skip_rows")&&Ne((r.skippedRows??[]).filter(o=>o.object===t),e.id,n))return"these rows held back";if(Gt.has(e.kind)&&l!==void 0&&f!==void 0&&(s.has("map_value")||s.has("leave_empty"))){let o=(r.picklistValueMappings??[]).filter(h=>h.object===t&&h.field===l&&h.from===f),a=_e(o,e,n);if(a?.to===null&&s.has("leave_empty"))return"the field left empty in these rows";if(a&&a.to!==null&&s.has("map_value"))return`written as "${a.to}"`}let p=xt.has(e.kind)?e.value??e.recordType:void 0;if(p!==void 0&&s.has("map_record_type")){let o=r.recordTypeMappings?.find(a=>a.object===t&&a.from===p);if(o)return o.to===null?"written with the object's default record type":`written as record type ${o.to}`}if(l===void 0)return;let d=o=>o.object===t&&o.field===l,u=s.has("set_default")?r.defaultValues?.find(d):void 0;if(u)return`default "${String(u.value)}"`;if(s.has("truncate")&&r.truncateFields?.some(d))return"cut to the field's length";if(s.has("leave_empty")&&r.fieldExclusions?.[t]?.includes(l))return"the field left out of the rows"}function zt(e,r){let n=e.gaps.map(t=>t.id);return{...e,gaps:e.gaps.map(t=>{let s=st(t,r,n);return s===void 0?t:{...t,answeredBy:s}})}}function tt(e,r,n,t){if(t)return`the mute lifts it (${t.permission}, in ${t.permissionSet}): ${re(e,!0)}`;let s=r?st(e,r,n):void 0;return s===void 0?`${$t[e.severity]}: ${re(e)}`:`answered by the run's decision: ${s} \u2014 ${re(e)}`}var Pt={validationRules:"the validation rules",validationRuleFormulas:"the formulas of some validation rules",duplicateRules:"the duplicate rules",duplicateRuleActions:"what the duplicate rules do on insert",userPermissions:"the custom permissions of the user the run writes as",permissionSets:"the permission sets that hold a bypass of a validation rule the user the run writes as does not",targetFields:"the fields of an object in the target",sourceFields:"the fields of an object in the source",apiBudget:"the daily API requests left"},Tt={notInSource:"the source has no such field",notCreateableInSource:"the source cannot give it",excluded:"the run leaves it out"},D=e=>typeof e=="number"?String(e):"?";function re(e,r=!1){let n=e.detail??{};switch(e.kind){case"required_field_missing":return`required field ${e.field??""} (${y(n.type)}): only the target requires it, and the run does not write it (${Tt[y(n.reason)]??y(n.reason)}): every row is refused unless it is given a value`;case"validation_rule":{let t=e.field?` on ${e.field}`:"",s=[...L(n.bypasses).map(f=>`not when ${f}`),...L(n.heldBypasses).length>0?[`kept quiet for this run: the user it writes as holds ${L(n.heldBypasses).join(", ")}`]:[],...n.formula==="notRead"?["formula not read"]:[],...n.formula==="unreadable"?["formula unreadable"]:[],...e.field&&!r?[`a row it refuses goes again without ${e.field}`]:[]],l=y(n.message)?`: "${y(n.message)}"`:"";return`validation rule "${y(n.rule)}"${t}${l}${s.length>0?` (${s.join("; ")})`:""}`}case"duplicate_rule":{let t=`duplicate rule "${y(n.rule)}"`;if(n.action==="block")return`${t}: blocks an insert it matches: a row it matches is refused, whatever allowSave says`;if(n.action==="allow"){let s=[n.alert===!0?"an alert":"",n.report===!0?"a report":""].filter(Boolean).join(" and ");return`${t}: allows an insert it matches${s?`, with ${s}`:""}: the run saves it (allowSave=true)`}return`${t}: what it does on insert was not read: a rule that blocks refuses a row it matches`}case"lookup_filter":return`lookup filter on ${e.field??""}: not checked before the run; `+(n.optional===!0?"a lookup it refuses is left empty":"the lookup is required, and a row it refuses is refused");case"object_not_createable":return"the user the run writes as may not create its records in the target: every row is skipped, after the objects written before it, unless the object is left out";case"object_platform_only":return"no user can create its records in the target, the platform writes them itself: the run skips every row of it";case"object_setup_only":return"no user can create its records in the target, not even one with Modify All Data, and no permission set gives Create on it: setup the org keeps as records, or the platform's own; the run skips every row of it";case"object_feature_off":return"even a user with Modify All Data may not create its records in the target, though a permission set can give Create on it: a feature or licence the target has not turned on for that user keeps it closed; turn it on, or every row is skipped, after the objects written before it, unless the object is left out";case"object_through_parent":{let t=L(n.editOn);return`no permission set gives Create on it: ${t.length>0?`the user the run writes as creates its records with Edit on ${t.join(" and ")}, which they hang from, or no user can`:"the records they hang from may open it to the user the run writes as, or no user can: read as a user with Modify All Data, the target would tell"}; every row is skipped, after the objects written before it, unless the object is left out`}case"api_budget":{let t=`about ${D(n.calls)} call(s) (${D(n.writes)} write(s) of 200 rows, ${D(n.reads)} read(s))`,s=n.estimate==="atMost"?`at most ${t}, counted on whole tables`:n.estimate==="unknown"?"an unknown number of calls: an object was never counted":t,l=n.budgetRead===!1?"the daily requests left could not be read":`${D(n.remaining)} of ${D(n.max)} daily requests left`;return`API budget: the run takes ${s}; ${l}`}default:return e.kind}}function jt(e,r,n){return Se(e).map(({permission:t,permissionSet:s,others:l})=>{if(!s)return` ${t}: no permission set of ${r} holds it: an admin creates one that includes it`;let f=l.length>0?`; also held by ${l.map(d=>d.name).join(", ")}`:"",p=n?`: ${Ge(s.name,r,n)}`:"";return` ${t}: held by permission set ${s.name}, the smallest${f}${p}`})}function Ht(e,r,n={}){let t=[`target gaps: what ${r} holds against the rows, read from its metadata`],s=e.gaps.map(u=>u.id),l=e.gaps.filter(u=>u.kind==="api_budget"),f=e.gaps.filter(u=>u.kind!=="api_budget"),p=[...new Set(f.map(u=>u.objectApiName))].sort((u,o)=>u.localeCompare(o));for(let u of p){t.push(` ${u}`);for(let o of f.filter(a=>a.objectApiName===u)){let a=Ee(o,n.lifted);t.push(` ${tt(o,n.decisions,s,a)}`),a||t.push(...jt(o,r,n.username))}}f.length===0&&t.push(e.unread.length>0?" nothing found in what could be read":" no validation rule, duplicate rule, field only the target requires or lookup filter");for(let u of l)t.push(` ${tt(u,n.decisions,s)}`);let d=f.filter(u=>u.detail?.formula==="notRead").length;d>0&&t.push(` ${d} validation rule formula(s) not read: the read takes ${n.formulasBound??ie} at most`);for(let{part:u,reason:o}of e.unread)t.push(` ${Pt[u]??u} could not be read: ${o}`);return t.push(` read in ${e.requests} request(s) to ${r}`),t}export{nt as a,W as b,ie as c,Bt as d,oe as e,ht as f,q as g,yt as h,rt as i,Rt as j,Qt as k,Ft as l,Wt as m,Kt as n,et as o,st as p,zt as q,Ht as r};
@@ -1,7 +0,0 @@
1
- import { createRequire as __sandforgeRequire } from 'node:module';
2
- import { fileURLToPath as __sandforgePath } from 'node:url';
3
- import { dirname as __sandforgeDirname } from 'node:path';
4
- const require = __sandforgeRequire(import.meta.url);
5
- const __filename = __sandforgePath(import.meta.url);
6
- const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-OOIDCHBQ.mjs";import"./chunk-DMT5SCO3.mjs";import"./chunk-H33DVU3D.mjs";import"./chunk-TUPZY2QJ.mjs";import"./chunk-JBWJ6UEZ.mjs";import"./chunk-N2HYG3BL.mjs";import"./chunk-4GCYGQXD.mjs";import"./chunk-PPGDAUEQ.mjs";import"./chunk-VV3B6IC3.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-PC247GKX.mjs";import"./chunk-Z3MGN42K.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ISOSTAJR.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as RECOVERY_HANDOFF_DIR_MODE,b as RECOVERY_HANDOFF_FILE_MODE,c as RECOVERY_HANDOFF_FOLDER,d as journalDirOf,h as lastHandoffOf,g as newestHandoffOf,e as recoveryHandoffFolderOf,i as recoveryHandoffNoteOf,f as recoveryHandoffPathOf,j as writeRecoveryHandoff};