sandforge 1.85.0 → 1.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/README.md +1 -1
  2. package/lib/{chunk-THYQOG24.mjs → chunk-22L43JMK.mjs} +1 -1
  3. package/lib/{chunk-U4S27YRP.mjs → chunk-2LSGWTWX.mjs} +1 -1
  4. package/lib/{chunk-MRN72UEO.mjs → chunk-2YJJTQNC.mjs} +1 -1
  5. package/lib/chunk-34SMB5PA.mjs +10 -0
  6. package/lib/chunk-35B73566.mjs +7 -0
  7. package/lib/{chunk-YZKE6D3K.mjs → chunk-35IJ4WEU.mjs} +1 -1
  8. package/lib/chunk-3EHPAFKV.mjs +7 -0
  9. package/lib/{chunk-3OKDWZ32.mjs → chunk-3HAVVEXF.mjs} +1 -1
  10. package/lib/{chunk-32ZB5ICW.mjs → chunk-3I6FXFCN.mjs} +1 -1
  11. package/lib/{chunk-JFVY66BS.mjs → chunk-3KJCSYXY.mjs} +1 -1
  12. package/lib/{chunk-ULEYGOZU.mjs → chunk-3L6DVNCR.mjs} +1 -1
  13. package/lib/chunk-3LRFPGYZ.mjs +7 -0
  14. package/lib/{chunk-GHUA6OQQ.mjs → chunk-3MVWGL5A.mjs} +1 -1
  15. package/lib/{chunk-SF52ZSIV.mjs → chunk-4CSBZZAL.mjs} +1 -1
  16. package/lib/{chunk-FBYFCKPG.mjs → chunk-4NSXPONF.mjs} +1 -1
  17. package/lib/{chunk-A3QNSALB.mjs → chunk-4VLP6RHC.mjs} +1 -1
  18. package/lib/{chunk-TWYNQ2OO.mjs → chunk-4XROG5CT.mjs} +1 -1
  19. package/lib/chunk-54V4FVEY.mjs +7 -0
  20. package/lib/chunk-55OJJT2Q.mjs +7 -0
  21. package/lib/{chunk-JRI6A24G.mjs → chunk-5EHHQ5UX.mjs} +1 -1
  22. package/lib/{chunk-VPGX5Z5D.mjs → chunk-5JMQXHJ2.mjs} +1 -1
  23. package/lib/{chunk-CI2O7WBH.mjs → chunk-65AMXOQU.mjs} +1 -1
  24. package/lib/{chunk-5T3LFDJ5.mjs → chunk-6HHSAPIM.mjs} +1 -1
  25. package/lib/chunk-6KVBCFVS.mjs +7 -0
  26. package/lib/chunk-6NG7C2U3.mjs +476 -0
  27. package/lib/{chunk-F2424IKX.mjs → chunk-6ROL3KBM.mjs} +1 -1
  28. package/lib/{chunk-7ZYCRIHE.mjs → chunk-72AWCN7U.mjs} +1 -1
  29. package/lib/{chunk-MQLTEXB7.mjs → chunk-7KHA5UIQ.mjs} +1 -1
  30. package/lib/chunk-7O6EFNQS.mjs +10 -0
  31. package/lib/{chunk-73SLYGWD.mjs → chunk-A2CH2QGX.mjs} +1 -1
  32. package/lib/chunk-A2TXLAC3.mjs +276 -0
  33. package/lib/chunk-ALWVNR34.mjs +7 -0
  34. package/lib/{chunk-JBOGAUGH.mjs → chunk-ATBQIE2V.mjs} +1 -1
  35. package/lib/{chunk-C2MHMI7U.mjs → chunk-ATQML7ZK.mjs} +1 -1
  36. package/lib/chunk-AVY742BJ.mjs +7 -0
  37. package/lib/{chunk-VLAU5QQT.mjs → chunk-AXTB2HJS.mjs} +1 -1
  38. package/lib/chunk-BBZUGKBZ.mjs +10 -0
  39. package/lib/chunk-BIDXK7KA.mjs +7 -0
  40. package/lib/{chunk-KYLHS74X.mjs → chunk-BLMJ4WVI.mjs} +1 -1
  41. package/lib/{chunk-A7YP27GQ.mjs → chunk-BNHJCJJM.mjs} +1 -1
  42. package/lib/{chunk-ZDMSTL2L.mjs → chunk-BNPQEQXC.mjs} +1 -1
  43. package/lib/chunk-C5AUNG6T.mjs +37 -0
  44. package/lib/{chunk-LY6EPMIP.mjs → chunk-C5EQ7GFC.mjs} +1 -1
  45. package/lib/{chunk-LOO42EW5.mjs → chunk-C7CKDZMC.mjs} +62 -62
  46. package/lib/{chunk-ZP3WJGS3.mjs → chunk-CB4U22NR.mjs} +1 -1
  47. package/lib/chunk-CJAWKLAL.mjs +7 -0
  48. package/lib/chunk-CL75DEMQ.mjs +9 -0
  49. package/lib/{chunk-7L6FE5PP.mjs → chunk-CLUNF4FK.mjs} +1 -1
  50. package/lib/chunk-CSMGP53U.mjs +7 -0
  51. package/lib/{chunk-S6BMJSLD.mjs → chunk-CT324C7I.mjs} +1 -1
  52. package/lib/{chunk-YXOPKGDX.mjs → chunk-CZXDJXQP.mjs} +1 -1
  53. package/lib/{chunk-PGG4ULEW.mjs → chunk-D2X6U3MS.mjs} +1 -1
  54. package/lib/{chunk-FG4Y4ZVL.mjs → chunk-DAUX63UB.mjs} +1 -1
  55. package/lib/chunk-DB7JNALQ.mjs +10 -0
  56. package/lib/chunk-DDNCJVZ2.mjs +17 -0
  57. package/lib/{chunk-YGE4AUXG.mjs → chunk-DLSU66MY.mjs} +1 -1
  58. package/lib/{chunk-DCJBP3LE.mjs → chunk-DO6PSHQZ.mjs} +1 -1
  59. package/lib/{chunk-ROTDZKOE.mjs → chunk-DUBECLZV.mjs} +1 -1
  60. package/lib/{chunk-SES5HPBZ.mjs → chunk-DYHF6DNT.mjs} +1 -1
  61. package/lib/chunk-E5FSPXYH.mjs +930 -0
  62. package/lib/{chunk-QAXKUEJT.mjs → chunk-EGL3I3IX.mjs} +1 -1
  63. package/lib/chunk-EIYMQPMG.mjs +7 -0
  64. package/lib/{chunk-AX3YF7SC.mjs → chunk-EUIALBMX.mjs} +1 -1
  65. package/lib/{chunk-57QRXYAZ.mjs → chunk-FI3R5ZOQ.mjs} +1 -1
  66. package/lib/{chunk-FCZDWGQI.mjs → chunk-FM4QCTO7.mjs} +1 -1
  67. package/lib/{chunk-74HZ274R.mjs → chunk-FRSIEASH.mjs} +1 -1
  68. package/lib/{chunk-G6IYOZEH.mjs → chunk-FV6MOSHD.mjs} +1 -1
  69. package/lib/chunk-FYG47CNA.mjs +7 -0
  70. package/lib/chunk-GB6W4Q56.mjs +7 -0
  71. package/lib/chunk-GEV2DCMK.mjs +7 -0
  72. package/lib/{chunk-NZJXEULY.mjs → chunk-GFB2DNCB.mjs} +1 -1
  73. package/lib/chunk-GFGMGFSH.mjs +7 -0
  74. package/lib/{chunk-EFHDE7W4.mjs → chunk-GIFQXB2Q.mjs} +1 -1
  75. package/lib/{chunk-P6A22FMQ.mjs → chunk-GP5J3DGS.mjs} +1 -1
  76. package/lib/chunk-GQZEX7LH.mjs +231 -0
  77. package/lib/{chunk-BRN42U26.mjs → chunk-GYDTM62J.mjs} +1 -1
  78. package/lib/{chunk-GNCEHAJY.mjs → chunk-GYFIXUJG.mjs} +1 -1
  79. package/lib/chunk-GZW2GNFK.mjs +7 -0
  80. package/lib/chunk-H6BHWAX7.mjs +8 -0
  81. package/lib/{chunk-GUYEXPJ4.mjs → chunk-HDDJ3CVN.mjs} +1 -1
  82. package/lib/{chunk-3GATEVHC.mjs → chunk-HDWB4ZOG.mjs} +1 -1
  83. package/lib/chunk-HGVPBJR6.mjs +7 -0
  84. package/lib/{chunk-55VBV2WK.mjs → chunk-HLROVOR6.mjs} +1 -1
  85. package/lib/{chunk-HV3TDLFR.mjs → chunk-HUOR4M2L.mjs} +1 -1
  86. package/lib/chunk-HZCS6EED.mjs +8 -0
  87. package/lib/{chunk-WZX6VCIT.mjs → chunk-HZUI56KZ.mjs} +1 -1
  88. package/lib/chunk-IAB5H7WN.mjs +7 -0
  89. package/lib/{chunk-RY7WUJXH.mjs → chunk-IQ5UKRHU.mjs} +1 -1
  90. package/lib/{chunk-OUWR5M5G.mjs → chunk-IRQ4WANV.mjs} +1 -1
  91. package/lib/{chunk-F44EHXLI.mjs → chunk-IT3DGX37.mjs} +1 -1
  92. package/lib/chunk-J347SPU6.mjs +49 -0
  93. package/lib/{chunk-IZ2M2RGO.mjs → chunk-JANBNTR5.mjs} +1 -1
  94. package/lib/chunk-JFXQZPRY.mjs +9 -0
  95. package/lib/{chunk-VKA5OZBJ.mjs → chunk-JRLYWVF4.mjs} +1 -1
  96. package/lib/{chunk-FM5ESRH6.mjs → chunk-JSNMUTY6.mjs} +1 -1
  97. package/lib/chunk-JTNJKSAA.mjs +7 -0
  98. package/lib/{chunk-4D6OHSX3.mjs → chunk-JV2LAKWQ.mjs} +1 -1
  99. package/lib/{chunk-BY42YL4D.mjs → chunk-JV7K2ZHK.mjs} +1 -1
  100. package/lib/{chunk-A6IJUOLB.mjs → chunk-K4TQ7YHX.mjs} +1 -1
  101. package/lib/chunk-K5PUMHZU.mjs +7 -0
  102. package/lib/chunk-KH4KLCYG.mjs +7 -0
  103. package/lib/{chunk-FZF6FB65.mjs → chunk-KQVLZVOP.mjs} +1 -1
  104. package/lib/chunk-KWUS7UAV.mjs +19 -0
  105. package/lib/{chunk-2UUSF32M.mjs → chunk-L6G73FXM.mjs} +1 -1
  106. package/lib/{chunk-LUNGNCM3.mjs → chunk-LG466Q5H.mjs} +1 -1
  107. package/lib/{chunk-YTBM3TSW.mjs → chunk-LHNAR6FC.mjs} +1 -1
  108. package/lib/chunk-LT4GHEI2.mjs +7 -0
  109. package/lib/{chunk-P3OYE2FS.mjs → chunk-MR262Y3B.mjs} +1 -1
  110. package/lib/{chunk-TSTCHIBU.mjs → chunk-NCCHOV2N.mjs} +1 -1
  111. package/lib/chunk-NICRSGLS.mjs +7 -0
  112. package/lib/chunk-NV5QA2HY.mjs +7 -0
  113. package/lib/{chunk-6HAKOS6W.mjs → chunk-O3GIN5TU.mjs} +1 -1
  114. package/lib/chunk-O6FHK6NQ.mjs +13 -0
  115. package/lib/{chunk-OXIIKAUZ.mjs → chunk-O7YIEFG7.mjs} +1 -1
  116. package/lib/chunk-OCUVAA5E.mjs +7 -0
  117. package/lib/chunk-OLCS7JCT.mjs +14 -0
  118. package/lib/chunk-ON7Y63FK.mjs +9 -0
  119. package/lib/{chunk-K2WOT75I.mjs → chunk-OO2WY3UB.mjs} +1 -1
  120. package/lib/{chunk-3EOIAC2M.mjs → chunk-OT2NHL2V.mjs} +1 -1
  121. package/lib/{chunk-BK5SRDAD.mjs → chunk-P2M5ZXWU.mjs} +1 -1
  122. package/lib/{chunk-DCZYWMSA.mjs → chunk-P4YOHLZ4.mjs} +1 -1
  123. package/lib/chunk-PBHDPTT6.mjs +343 -0
  124. package/lib/chunk-PE7CHD2W.mjs +7 -0
  125. package/lib/{chunk-LU7M5URW.mjs → chunk-PIQ2I67B.mjs} +1 -1
  126. package/lib/chunk-PKYDNZJK.mjs +7 -0
  127. package/lib/chunk-PVZ72OOQ.mjs +7 -0
  128. package/lib/chunk-QACFTHJM.mjs +8 -0
  129. package/lib/{chunk-LNAZHI3J.mjs → chunk-QGVL5EW3.mjs} +1 -1
  130. package/lib/chunk-QHE2RUWX.mjs +7 -0
  131. package/lib/{chunk-4RNP65FV.mjs → chunk-RCW5BZNW.mjs} +1 -1
  132. package/lib/{chunk-OTKXTBTX.mjs → chunk-RJ6HHG7J.mjs} +1 -1
  133. package/lib/{chunk-IVDBVWKK.mjs → chunk-RPTEEI4R.mjs} +1 -1
  134. package/lib/chunk-RQW5S67A.mjs +7 -0
  135. package/lib/chunk-RTCMYMED.mjs +7 -0
  136. package/lib/chunk-RWVX7XSD.mjs +7 -0
  137. package/lib/{chunk-2UUS4IGB.mjs → chunk-RZOINFNL.mjs} +1 -1
  138. package/lib/chunk-SOOTWGMQ.mjs +7 -0
  139. package/lib/chunk-STQ2JMIZ.mjs +7 -0
  140. package/lib/{chunk-RC25QQVF.mjs → chunk-SUIPDW5O.mjs} +1 -1
  141. package/lib/{chunk-Z354SAEF.mjs → chunk-SZOJ7BEJ.mjs} +1 -1
  142. package/lib/{chunk-45375WT5.mjs → chunk-T542Z54E.mjs} +1 -1
  143. package/lib/chunk-TAN2CIRI.mjs +21 -0
  144. package/lib/{chunk-BGJBYDRW.mjs → chunk-TCNBINOG.mjs} +1 -1
  145. package/lib/chunk-TFDF3DBN.mjs +7 -0
  146. package/lib/{chunk-B5A4JHNN.mjs → chunk-TICZXC53.mjs} +1 -1
  147. package/lib/chunk-TLX45X5U.mjs +7 -0
  148. package/lib/{chunk-W6SLQZKQ.mjs → chunk-TMIV3IWH.mjs} +1 -1
  149. package/lib/chunk-TQ6HEJ73.mjs +11 -0
  150. package/lib/chunk-TTU5EQZ6.mjs +7 -0
  151. package/lib/chunk-TYUYPFDJ.mjs +7 -0
  152. package/lib/chunk-TZXYVMZC.mjs +7 -0
  153. package/lib/{chunk-4N425UJC.mjs → chunk-UCUFLFNK.mjs} +1 -1
  154. package/lib/chunk-UK3QLBHW.mjs +7 -0
  155. package/lib/{chunk-SKGAERV4.mjs → chunk-UM2B4GR7.mjs} +1 -1
  156. package/lib/chunk-UZFTTNOP.mjs +7 -0
  157. package/lib/chunk-V3AXSKSU.mjs +7 -0
  158. package/lib/chunk-VA6EEI6X.mjs +21 -0
  159. package/lib/{chunk-LSEM2BZH.mjs → chunk-VFKG2G37.mjs} +1 -1
  160. package/lib/chunk-VJNEW5MQ.mjs +7 -0
  161. package/lib/{chunk-EYFP3NA6.mjs → chunk-VKREON6Q.mjs} +1 -1
  162. package/lib/{chunk-TIVI2KGB.mjs → chunk-VNNDYPBL.mjs} +1 -1
  163. package/lib/{chunk-J3FJ3BWE.mjs → chunk-VRBETPHY.mjs} +1 -1
  164. package/lib/{chunk-UX4AOSMU.mjs → chunk-VT6P3X6R.mjs} +1 -1
  165. package/lib/{chunk-CUOWQMGW.mjs → chunk-VUTQY76O.mjs} +1 -1
  166. package/lib/chunk-WF5S4FW5.mjs +7 -0
  167. package/lib/{chunk-JHJDDQDE.mjs → chunk-WJGK6VGU.mjs} +1 -1
  168. package/lib/{chunk-IZREPWYQ.mjs → chunk-WJHMB3SL.mjs} +1 -1
  169. package/lib/{chunk-XZRON54U.mjs → chunk-WQCXOZEJ.mjs} +1 -1
  170. package/lib/{chunk-N2MXYD67.mjs → chunk-WVVFR4E3.mjs} +1 -1
  171. package/lib/{chunk-GG5I52UT.mjs → chunk-XBYXT74L.mjs} +1 -1
  172. package/lib/chunk-XJE3LJHP.mjs +7 -0
  173. package/lib/{chunk-3QCUSZIZ.mjs → chunk-XV4CVZYD.mjs} +1 -1
  174. package/lib/chunk-Y37ED7AS.mjs +7 -0
  175. package/lib/{chunk-MN3XBJPE.mjs → chunk-YGBNZYT4.mjs} +1 -1
  176. package/lib/{chunk-SBDF4AE5.mjs → chunk-YGTOX7IL.mjs} +1 -1
  177. package/lib/{chunk-SQM32AOQ.mjs → chunk-YJ27WHKR.mjs} +1 -1
  178. package/lib/chunk-YRULC27A.mjs +7 -0
  179. package/lib/{chunk-RMFU4BAL.mjs → chunk-YSVAHT4Q.mjs} +4 -4
  180. package/lib/chunk-YTOTMJTY.mjs +15 -0
  181. package/lib/{chunk-SU24AE3H.mjs → chunk-YZKZC62O.mjs} +1 -1
  182. package/lib/{chunk-LJNRN7MY.mjs → chunk-YZQN7BRB.mjs} +1 -1
  183. package/lib/{chunk-NMF55UBQ.mjs → chunk-Z5IUK2QO.mjs} +1 -1
  184. package/lib/{chunk-6ZWY36LK.mjs → chunk-ZEGSMW5A.mjs} +1 -1
  185. package/lib/{chunk-YV7JYHJP.mjs → chunk-ZIKLQZBG.mjs} +1 -1
  186. package/lib/chunk-ZVU7MD2S.mjs +7 -0
  187. package/lib/sandforge-autopilot.mjs +33 -27
  188. package/lib/sandforge-backup.mjs +19 -19
  189. package/lib/sandforge-checkpoint.mjs +1 -1
  190. package/lib/sandforge-cleanup.mjs +1 -1
  191. package/lib/sandforge-clone.mjs +1 -1
  192. package/lib/sandforge-compare.mjs +29 -16
  193. package/lib/sandforge-dataops.mjs +1 -1
  194. package/lib/sandforge-empty.mjs +11 -13
  195. package/lib/sandforge-env.mjs +105 -105
  196. package/lib/sandforge-frozen.mjs +1 -1
  197. package/lib/sandforge-mcp.mjs +2 -2
  198. package/lib/sandforge-monitor.mjs +1 -1
  199. package/lib/sandforge-pipeline.mjs +13 -13
  200. package/lib/sandforge-seed.mjs +1 -1
  201. package/lib/sandforge-sync.mjs +1 -1
  202. package/lib/sandforge-users.mjs +13 -15
  203. package/lib/sandforge.mjs +1 -1
  204. package/lib/sf/sandforge/dataops.mjs +2 -2
  205. package/lib/sfPlugin.mjs +1 -1
  206. package/oclif.manifest.json +1 -1
  207. package/package.json +1 -1
  208. package/lib/chunk-26EGXYZ4.mjs +0 -21
  209. package/lib/chunk-2JRVBXJL.mjs +0 -7
  210. package/lib/chunk-2METQHGG.mjs +0 -7
  211. package/lib/chunk-3XU7CEJQ.mjs +0 -7
  212. package/lib/chunk-4BQPAVMP.mjs +0 -14
  213. package/lib/chunk-4KMKOE77.mjs +0 -156
  214. package/lib/chunk-4RPA7Z52.mjs +0 -7
  215. package/lib/chunk-5C7LQXYS.mjs +0 -7
  216. package/lib/chunk-5EESNYE3.mjs +0 -8
  217. package/lib/chunk-6ZW6BLV5.mjs +0 -7
  218. package/lib/chunk-AAOMUI7S.mjs +0 -15
  219. package/lib/chunk-AIUAEBHR.mjs +0 -7
  220. package/lib/chunk-BD724WOH.mjs +0 -7
  221. package/lib/chunk-CRPLDXJU.mjs +0 -48
  222. package/lib/chunk-CSSOLHE3.mjs +0 -7
  223. package/lib/chunk-D63HEQ3B.mjs +0 -7
  224. package/lib/chunk-DN7YBILC.mjs +0 -21
  225. package/lib/chunk-DNE7JI3A.mjs +0 -11
  226. package/lib/chunk-EFHM2U4D.mjs +0 -7
  227. package/lib/chunk-EINEGS6E.mjs +0 -7
  228. package/lib/chunk-EM5EFMHA.mjs +0 -272
  229. package/lib/chunk-FH5UR35W.mjs +0 -7
  230. package/lib/chunk-FN7TOBJR.mjs +0 -7
  231. package/lib/chunk-HGJFATSI.mjs +0 -10
  232. package/lib/chunk-HOEE3PE5.mjs +0 -7
  233. package/lib/chunk-HV63UGL5.mjs +0 -7
  234. package/lib/chunk-JKFCGYJE.mjs +0 -7
  235. package/lib/chunk-KATBU46O.mjs +0 -7
  236. package/lib/chunk-LD34JNCC.mjs +0 -7
  237. package/lib/chunk-LPN4WYTP.mjs +0 -478
  238. package/lib/chunk-MAOUFJ47.mjs +0 -7
  239. package/lib/chunk-MB2DG66I.mjs +0 -13
  240. package/lib/chunk-NCASRA7L.mjs +0 -9
  241. package/lib/chunk-NEKNAILD.mjs +0 -7
  242. package/lib/chunk-NN2IO4WE.mjs +0 -7
  243. package/lib/chunk-O3ZQSWDN.mjs +0 -10
  244. package/lib/chunk-OFQOKSEW.mjs +0 -7
  245. package/lib/chunk-PP7PJXRJ.mjs +0 -341
  246. package/lib/chunk-PT2E2HFD.mjs +0 -7
  247. package/lib/chunk-PZBZ7MNC.mjs +0 -7
  248. package/lib/chunk-QBYK5XIT.mjs +0 -8
  249. package/lib/chunk-RFD6NPWJ.mjs +0 -8
  250. package/lib/chunk-RIIJJRGF.mjs +0 -7
  251. package/lib/chunk-RKTFFCNS.mjs +0 -7
  252. package/lib/chunk-RM5G4IP6.mjs +0 -19
  253. package/lib/chunk-RTPNK7OB.mjs +0 -7
  254. package/lib/chunk-RZXEO5IE.mjs +0 -7
  255. package/lib/chunk-SAHGDSZQ.mjs +0 -37
  256. package/lib/chunk-SRPWW4A2.mjs +0 -10
  257. package/lib/chunk-SVNSAHG3.mjs +0 -7
  258. package/lib/chunk-T63U4OZJ.mjs +0 -7
  259. package/lib/chunk-TE2W76II.mjs +0 -10
  260. package/lib/chunk-TEIBWMJM.mjs +0 -7
  261. package/lib/chunk-TFGJDZFE.mjs +0 -7
  262. package/lib/chunk-TG52WNGV.mjs +0 -10
  263. package/lib/chunk-TQONVFI3.mjs +0 -7
  264. package/lib/chunk-TW3N6W5Z.mjs +0 -7
  265. package/lib/chunk-UZMLPKW6.mjs +0 -7
  266. package/lib/chunk-WB2RIVO3.mjs +0 -7
  267. package/lib/chunk-WQO7RXEB.mjs +0 -926
  268. package/lib/chunk-X3MBY2RX.mjs +0 -7
  269. package/lib/chunk-XMJRXXUN.mjs +0 -7
  270. package/lib/chunk-YNMU5I7P.mjs +0 -7
  271. package/lib/chunk-YSQJKIO6.mjs +0 -7
  272. package/lib/chunk-YVVPJRZC.mjs +0 -7
  273. package/lib/chunk-ZLQHBI6V.mjs +0 -9
  274. package/lib/chunk-ZRUDYB7O.mjs +0 -7
@@ -0,0 +1,8 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{c as V,e as _e,j as Le}from"./chunk-NV5QA2HY.mjs";import{b as Be}from"./chunk-EGL3I3IX.mjs";import{a as Qe}from"./chunk-M6P5ZZLE.mjs";import{c as We,d as ze}from"./chunk-ATQML7ZK.mjs";import{d as Ge,z as $e}from"./chunk-4CSBZZAL.mjs";import{a as qe}from"./chunk-VV3B6IC3.mjs";import{a as k}from"./chunk-4TLYUZD5.mjs";import{m as Ue}from"./chunk-EUIALBMX.mjs";import{a as oe,b as Te}from"./chunk-Q7TLC3I2.mjs";import{b as ke}from"./chunk-EADHKH3A.mjs";import{a as X,c as Ne,g as ne,j as Me,n as xe}from"./chunk-DAUX63UB.mjs";import{a as Pe,h as $}from"./chunk-TZE3Y7IQ.mjs";import{a as Ae,b as T}from"./chunk-CA5NAXSU.mjs";import{Ca as fe,Gc as ee,Hc as te,Ic as re,Wd as pe,fa as Ie,ka as De,za as ve}from"./chunk-J347SPU6.mjs";import{b as Re,e as Fe,i as je,k as Se,l as ue}from"./chunk-WZQEK4WT.mjs";import{appendFile as at}from"node:fs/promises";var ge=new Set(["Task","Event"]),ct=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,lt="an emptying";function dt(e){let t=$(e.objectApiName),o=ge.has(e.objectApiName),r=[...e.filter!==void 0&&e.filter.trim()!==""?[`(${e.filter})`]:[],...o?["IsDeleted = false"]:[]];return{soql:`SELECT Id FROM ${t}${r.length>0?` WHERE ${r.join(" AND ")}`:""}`,scanAll:o}}async function Zt(e,t,o,r={}){let n=()=>r.signal?.aborted===!0,c=[];await $e(t);for(let i of o){let{soql:a,scanAll:d}=dt(i),f={objectApiName:i.objectApiName,count:0};if(c.push(f),n())return{stopped:!0,read:c};let h=We(t,i.objectApiName),l=!0,b=0,y=await e.query(a,{scanAll:d});for(;;){let F=y.records.map(C=>{let E=C.Id;if(typeof E!="string"||!ct.test(E))throw new Error(`The org answered a ${i.objectApiName} row with no record id: its ids are not read.`);return E});if((F.length>0||l)&&(await at(h,F.map(C=>`${C}
8
+ `).join(""),{encoding:"utf8",mode:Ge,flag:l?"w":"a"}),l=!1),f.count+=F.length,r.onPage?.(i.objectApiName,f.count),b=F.length===0?b+1:0,y.done||!y.nextRecordsUrl)break;if(b>=ke)throw new Error(`The org kept answering empty pages of ${i.objectApiName} without saying it was done: ${f.count} id(s) read, the rest not.`);if(n())return{stopped:!0,read:c};y=await e.queryMore(y.nextRecordsUrl)}}return{stopped:!1,spool:await ze(t,c,lt)}}function se(e,t,o){return t.nillable!==!1||t.referenceTo.length!==1?!1:t.isMasterDetail||(o??[]).some(r=>r.isCascadeDelete&&r.childSObject===e&&r.field===t.name)}var He=30;async function Xe(e,t,o,r){let n=[...new Set(o)],c=[];for(let a=0;a<n.length;a+=He)c.push(n.slice(a,a+He));let i={objects:[],requests:0,refused:[]};for(let a=0;a<c.length&&!r?.aborted;a+=6){let d=await Promise.all(c.slice(a,a+6).map(f=>ut(e,t,f,r)));for(let f of d)i.objects.push(...f.objects),i.refused.push(...f.refused),i.requests+=f.requests,f.hidden&&(i.hidden??=[]).push(...f.hidden)}return i}async function ut(e,t,o,r){let n=await e.readFieldClassification(t,o,r),c={objects:[],requests:n.requests,refused:[]};for(let i of o){let a=n.objects.get(i);if(a===void 0||a.refused!==void 0){c.refused.push({objectApiName:i,message:a?.refused??"The org did not answer for this object."});continue}if(a.fields.size===0)continue;let d;try{d=await e.describeObject(t,i,r)}catch(h){c.refused.push({objectApiName:i,message:T(h)});continue}let f={};for(let h of d.fields){let l=a.fields.get(h.name.toLowerCase());l===void 0||!_e(h)||h.createable===!1||(f[h.name]=l.classification)}Object.keys(f).length>0&&c.objects.push({objectApiName:i,fields:f});for(let h of Le(d.fields,a.fields))(c.hidden??=[]).push({objectApiName:i,fieldApiName:h.fieldApiName,classification:h.orgClassification})}return c}function ar(e){let o=[`classification: ${e.objects.reduce((r,n)=>r+Object.keys(n.fields).length,0)} field(s) the source org classifies as personal, anonymized as the detector's are (${e.requests} Tooling request(s))`];for(let r of e.objects)for(let[n,c]of Object.entries(r.fields))o.push(` ${r.objectApiName}.${n}: ${pe(c)}`);for(let r of e.refused)o.push(` ${r.objectApiName}: classification not read, its fields stand as the detector names them: ${r.message}`);for(let r of e.hidden??[])o.push(ft(r));return o}function ft(e){return` ${e.objectApiName}.${e.fieldApiName}: ${pe(e.classification)} \u2014 classified by the org, hidden from you: not read, not copied. Grant Read on the field (field-level security) to copy it anonymized.`}var Y=.001,he=.01,pt=50,gt=5,mt=2,ht=4;function bt(e){return e.level===0||e.recordCount>0||e.status==="error"||e.recordCountUnknown===!0}function Ye(e){return e.inputMode==="record"&&typeof e.recordId=="string"&&e.recordId!==""}function me(e){if(!De(e)||e.inputMode!=="soql")return;let t=Ie(e.soqlQuery??"");return t?{where:t.where,limit:t.limit}:void 0}function yt(e,t,o){let r=[];o===0&&Ye(e)&&r.push(`Id = '${Pe(e.recordId??"")}'`);let n=o===0?me(e):void 0;n?.where&&r.push(`(${n.where})`);let c=e.objectSoqlFilters?.[t];return c&&r.push(`(${c})`),`SELECT COUNT() FROM ${$(t)}${r.length>0?` WHERE ${r.join(" AND ")}`:""}`}var be=typeof setImmediate=="function"?()=>new Promise(e=>setImmediate(e)):()=>new Promise(e=>setTimeout(e,0)),P=class extends Error{constructor(){super("Discovery cancelled"),this.name="DiscoveryCancelled"}};function x(e,t){return t?t.aborted?Promise.reject(new P):new Promise((o,r)=>{let n=()=>r(new P);t.addEventListener("abort",n,{once:!0}),e().then(c=>{t.removeEventListener("abort",n),o(c)},c=>{t.removeEventListener("abort",n),r(c)})}):e()}function Ot(e){return e.fieldCount>0||e.piiFields.length>0}function Ct(e,t){if(e.type!=="master-detail")return e;let o=(t.get(e.targetObject)?.fields??[]).filter(n=>n.referenceTo.includes(e.sourceObject)),r=t.get(e.sourceObject)?.childRelationships;return o.some(n=>se(e.targetObject,n,r))?e:{...e,type:"lookup"}}function J(){return{nodes:[],edges:[],totalRecords:0,estimatedSizeMB:0,estimatedDurationSeconds:0,truncated:!1}}var Ve=class{deps;constructor(t){this.deps=t}async discover(t,o){if(t.inputMode==="org"||t.depth==="all")return Je(this.deps,t,o);let r=o?.signal;if(r?.aborted)return J();o?.onProgress?.({phase:"resolving-root",discoveredCount:0,queueRemaining:1});let n=Date.now(),c;try{c=await this.resolveRootObject(t,r)}catch(m){if(m instanceof P)return J();throw m}let i=Date.now();i-n>2e3&&k.warn(`[forge-discover] resolveRootObject took ${i-n}ms (cold path, consider verifying describeGlobal cache state)`);let a=this.resolveMaxDepth(t),d=o?.maxNodes??pt,f=d,h=d*mt,l=new Set,b=[],y=d*ht,F=0,C=0,E=new Set,j=[],W=new Map,M=new Map,L=()=>F+C+w.length<f&&j.length+C+w.length<y,z=(m,D)=>{l.has(m)||b.push([m,D]),l.add(m)},v=m=>{l.delete(m)&&(b=b.filter(([D])=>D!==m))},U=new Map,B=(m,D,N,S)=>{if(X(m.sourceObject)||X(m.targetObject)||m.sourceObject===m.targetObject)return;let s=`${m.sourceObject}|${m.targetObject}`,u=U.get(s)??new Map;(N!==void 0||!u.has(D))&&u.set(D,{settable:N,insertOnly:S}),U.set(s,u);let g=W.get(s);if(!g){W.set(s,m);return}let p=m.type==="master-detail"&&g.type==="lookup"?m:g,I=g.required===!0||m.required===!0;W.set(s,I?{...p,required:I}:p)},w=[[c,0]];for(E.add(c);w.length>0&&!r?.aborted;){await be();let m=f-F;if(m<=0)break;let D=Math.min(6,m,w.length),N=w.splice(0,D),S=await Promise.all(N.map(async([s,u])=>{let g,p=!1,I=yt(t,s,u);try{let[R,H]=await Promise.all([x(()=>this.deps.describeObject(t.sourceOrgId,s,r),r),x(()=>this.deps.queryCount(t.sourceOrgId,I,r),r).catch(_=>{if(_ instanceof P)throw _;return g=T(_),p=ie(_),-1})]);return{objectName:s,depth:u,describe:R,recordCount:H,countError:g,countRefused:p}}catch(R){return R instanceof P||r?.aborted?{objectName:s,depth:u,describe:null,recordCount:-1,cancelled:!0}:{objectName:s,depth:u,describe:null,recordCount:-1,describeError:T(R)}}}));C=S.length;for(let s of S){if(C--,s.cancelled)continue;let{objectName:u,depth:g,describe:p,recordCount:I,countError:R,countRefused:H,describeError:_}=s;if(!p){j.push({objectApiName:u,recordCount:0,fieldCount:0,status:"error",progress:0,included:!1,piiFields:[],anonymizeFields:[],level:g,successCount:0,failureCount:0,errors:[`Describe unavailable: ${_??"unknown error"}`],createableFieldCount:0,estimatedSizeMB:0,estimatedApiCalls:0,batchStrategy:"auto"}),F++,o?.onProgress?.({phase:"object",objectApiName:u,discoveredCount:j.length,queueRemaining:w.length});continue}M.set(u,p);let ae=I<0,ce=ae&&H!==!0,le=ae&&!ce,de=g===0?me(t)?.limit:void 0,K=ae?0:typeof de=="number"&&Number.isFinite(de)?Math.min(I,de):I,ot=g===0&&(Ye(t)||me(t)!==void 0),Oe=V(this.deps.detectPII,u,p.fields,t.anonymizationMode),nt=p.fields.filter(O=>O.type!=="id").length,Ce={objectApiName:u,...p.label?{label:p.label}:{},recordCount:K,...ce?{recordCountUnknown:!0}:{},fieldCount:p.fields.length,status:le?"error":"idle",progress:0,included:le?!1:ce||ot||!t.skipEmpty||K>0,piiFields:Oe,anonymizeFields:t.anonymizePII?Oe:[],level:g,successCount:0,failureCount:0,errors:le?[`Record count unavailable: ${R??"unknown error"}`]:[],createableFieldCount:nt,estimatedSizeMB:K*Y,estimatedApiCalls:Math.ceil(K/200),batchStrategy:"auto"};j.push(Ce);let we=bt(Ce);if(we&&F++,g<a&&we){for(let O of p.fields){if(O.referenceTo.length===0)continue;let Ee=te(O),Z=Ee&&ee(u,O.name,O.nillable),st=re(O);for(let A of O.referenceTo){B({sourceObject:A,targetObject:u,relationshipName:O.relationshipName??O.name,type:O.isMasterDetail?"master-detail":"lookup",required:Z},O.name,Ee,st);let it=l.has(A);(!E.has(A)||Z&&it)&&!X(A)&&(L()?(E.add(A),v(A),Z?w.unshift([A,g+1]):w.push([A,g+1])):Z&&f<h?(E.add(A),v(A),f++,w.unshift([A,g+1])):(E.add(A),z(A,g+1)))}}for(let O of p.childRelationships)B({sourceObject:u,targetObject:O.childSObject,relationshipName:O.relationshipName,type:O.isCascadeDelete?"master-detail":"lookup"},O.field,void 0,void 0),!E.has(O.childSObject)&&!X(O.childSObject)&&(E.add(O.childSObject),L()?w.push([O.childSObject,g+1]):z(O.childSObject,g+1))}o?.onProgress?.({phase:"object",objectApiName:u,discoveredCount:j.length,queueRemaining:w.length})}for(;b.length>0&&L();){let[s,u]=b.shift();l.delete(s),w.push([s,u])}}let Q=j.reduce((m,D)=>m+D.recordCount,0),G=[...W].map(([m,D])=>{let N=[...U.get(m)?.values()??[]],S=Ct(D,M);return N.length>0&&N.every(s=>s.settable===!1)&&(S={...S,settable:!1}),N.some(s=>s.insertOnly===!0)&&(S={...S,insertOnly:!0}),S});return{nodes:j,edges:G,totalRecords:Q,estimatedSizeMB:Q*Y,estimatedDurationSeconds:Q*he,truncated:b.length>0}}personalFields(t){return this.deps.detectPII(t)}async readClassification(t,o,r){let n=this.deps.readFieldClassification;if(n!==void 0)return Xe({describeObject:this.deps.describeObject,readFieldClassification:n},t,o,r)}async readPersonalFields(t,o,r){let n=t.nodes.filter(i=>!Ot(i)&&i.status!=="error"),c=new Map;for(let i=0;i<n.length&&!r?.aborted;i+=6)await Promise.all(n.slice(i,i+6).map(async({objectApiName:a})=>{try{let d=await this.deps.describeObject(o.sourceOrgId,a,r),f=V(this.deps.detectPII,a,d.fields,o.anonymizationMode);f.length>0&&c.set(a,f)}catch(d){k.warn(`[forge] personal fields of ${a} not read: ${T(d)}`)}}));return c.size===0?t:{...t,nodes:t.nodes.map(i=>{let a=c.get(i.objectApiName);return a?{...i,piiFields:a,anonymizeFields:o.anonymizePII?[...a]:[]}:i})}}async resolveRootObject(t,o){if(t.inputMode==="record"&&t.recordId){let r=t.recordId.substring(0,3),c=(await x(()=>this.deps.describeGlobal(t.sourceOrgId,o),o)).find(i=>i.keyPrefix===r);if(!c)throw new Error(`No object found for record ID prefix "${r}". The ID may not belong to any accessible object in this org.`);return c.name}if(t.inputMode==="soql"&&t.soqlQuery)return wt(t.soqlQuery);throw new Error(`Cannot resolve root object for inputMode "${t.inputMode}". Provide a valid recordId (for "record" mode) or soqlQuery (for "soql" mode).`)}resolveMaxDepth(t){switch(t.depth){case"direct":return 1;case"full":return gt;case"custom":return Math.max(1,Math.min(10,t.customDepth??3));case"all":throw new Error("A clone of the whole org is discovered without a walk (WholeOrgDiscovery)")}}};function wt(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/--[^\n]*/g,"");for(let r=0;r<32;r++){let n=t.replace(/\([^()]*\)/g,"");if(n===t)break;t=n}let o=/\bFROM\s+(\w+)/i.exec(t);if(!o)throw new Error('Could not parse object name from SOQL query. Ensure the query uses standard "SELECT ... FROM ObjectName" syntax.');return $(o[1])}var Et={clone:"write",empty:"delete"},Rt=["settings","definition"],Ft=new Set(["contentworkspace"]);function jt(e){if(e.name.includes("__"))return!1;let t=e.name.toLowerCase();return Ft.has(t)||Rt.some(o=>t.endsWith(o))?!0:e.createable===!1&&t!==ne.toLowerCase()}function St(e,t){return e.objectApiName<t.objectApiName?-1:e.objectApiName>t.objectApiName?1:0}function It(e,t,o,r={}){let n=xe(e,{mode:"everything",access:Et[o],...r.excluded!==void 0?{excluded:r.excluded}:{},...r.customSettings!==void 0?{customSettings:r.customSettings}:{}},t),c=new Map(e.map(d=>[d.name.toLowerCase(),d])),i=[],a=[];for(let d of n.candidates){let f=c.get(d.toLowerCase());f!==void 0&&jt(f)?a.push({objectApiName:d,reason:"configuration"}):i.push(d)}return a.length===0?n:{...n,candidates:i,leftOut:[...n.leftOut,...a].sort(St)}}var Dt=new Set([ne,Me].map(e=>e.toLowerCase())),Ke="withTheirRecords",vt="noLayout";function At(e){switch(e){case"configuration":return{reason:"setup"};case"chatter":case"history":case"sharing":case"changeEvent":case"unsupportedKind":case"customSetting":case"files":case"setup":case"platformCreated":case"metadata":case"notWritable":case"excludedByUser":return{reason:e};case"heldWithFiles":return{reason:"files",detail:Ke};case"notFound":case"notCustomSetting":return{reason:"missingInTarget"}}}function Tt(e){switch(e){case"platform":return{reason:"platformCreated"};case"setup":return{reason:"setup"};case"feature":case"parent":return{reason:"notWritable",detail:e};case"user":return{reason:"notWritable"}}}function Pt(e){if(e.createable!==!0||e.queryable!==!0)return;let t=e.updateable===!0,o=e.deletable===!0;if(!(t&&o))return!t&&!o?{reason:"createOnly"}:{reason:"createOnly",detail:t?Mt:Nt}}var Nt="noEdit",Mt="noDelete";function xt(e,t){return e.objectApiName<t.objectApiName?-1:e.objectApiName>t.objectApiName?1:0}function Ze(e,t,o,r={}){let n=It(t,o,"clone",r),c=new Map(e.map(l=>[l.name.toLowerCase(),l])),i=new Map(t.map(l=>[l.name.toLowerCase(),l])),a=[],d=[],f=new Set,h=(l,b,y)=>{f.add(l.toLowerCase()),d.push({objectApiName:l,reason:b,...y!==void 0?{detail:y}:{}})};for(let l of e)i.has(l.name.toLowerCase())||h(l.name,"missingInTarget");for(let l of n.leftOut){let b=l.objectApiName.toLowerCase(),y=c.get(b);if(!y||f.has(b))continue;let F=i.get(b),C=At(l.reason),E=b!==ne.toLowerCase();C.reason==="notWritable"&&E&&F?.createable!==!0&&r.createFacts&&(C=Tt(Qe(y.name,r.createFacts))),C.reason==="notWritable"&&E&&F&&(C=Pt(F)??C);let j=l.reason==="setup"&&F?.layoutable===!1&&!Ne(l.objectApiName);h(y.name,C.reason,j?vt:C.detail??l.detail)}for(let l of n.candidates){let b=l.toLowerCase(),y=c.get(b);y&&(y.queryable!==!0?h(y.name,"notQueryable"):Dt.has(b)?h(y.name,"files",Ke):a.push(y.name))}return a.sort(),d.sort(xt),{candidates:a,leftOut:d}}var ye=1950,et=2e4,_t=1e6,Lt=18,kt=200,qt=new Set(["QUERY_TIMEOUT","OPERATION_TOO_LARGE","REQUEST_LIMIT_EXCEEDED","REQUEST_RUNNING_TOO_LONG","SERVER_UNAVAILABLE","UNKNOWN_EXCEPTION"]);function ie(e){if(e instanceof qe||Te(e))return!1;let t=Ae(T(e));return t===void 0?!1:!qt.has(t)&&!t.startsWith("ERROR_HTTP_")}function Gt(e,t){let o=ge.has(e),r=[...t?[`(${t})`]:[],...o?["IsDeleted = false"]:[]];return{soql:`SELECT COUNT() FROM ${$(e)}${r.length>0?` WHERE ${r.join(" AND ")}`:""}`,all:o}}async function tt(e,t){let o=0,r=!1,n=()=>r,c=async()=>{for(;!r&&o<e.length;){let i=o++;try{await t(e[i],i,n)}catch(a){throw r=!0,a}}};await Promise.all(Array.from({length:Math.min(6,e.length)},c))}async function $t(e,t){try{return await e()}catch(o){if(o instanceof P||oe(o)||ie(o))throw o;return k.warn(`[forge-discover] whole org: describe of ${t} unanswered, asked again: ${T(o)}`),e()}}function rt(e){if(!(e<=fe))throw new Error(`The source org lists ${e} objects a clone of the whole org leaves out, more than the ${fe} one graph says. Nothing was written. Clone the org in parts instead: a run from a record or from a query for each part.`)}var Wt=ue({name:Re().min(1),count:Fe().int().nonnegative()});function zt(e){let t=ue({sObjects:Se(je())}).safeParse(e);if(!t.success)return;let o=new Map;for(let r of t.data.sObjects){let n=Wt.safeParse(r);n.success&&o.set(n.data.name,n.data.count)}return o}function Ut(e){let t=new Map;for(let[o,r]of e)for(let n of r.fields){if(n.referenceTo.length===0)continue;let c=te(n),i=c&&ee(o,n.name,n.nillable),a=re(n);for(let d of n.referenceTo){if(d===o||!e.has(d))continue;let f=`${d}|${o}`,h={sourceObject:d,targetObject:o,relationshipName:n.relationshipName??n.name,type:se(o,n,e.get(d)?.childRelationships)?"master-detail":"lookup",required:i},l=t.get(f);if(!l){t.set(f,{edge:h,noneSettable:!c,insertOnly:a});continue}let b=h.type==="master-detail"&&l.edge.type==="lookup"?h:l.edge;l.edge={...b,required:l.edge.required===!0||i},l.noneSettable=l.noneSettable&&!c,l.insertOnly=l.insertOnly||a}}return[...t.values()].map(({edge:o,noneSettable:r,insertOnly:n})=>({...o,...r?{settable:!1}:{},...n?{insertOnly:!0}:{}}))}function Bt(e,t){let o=t.filter(Ue),r=Be(e,o).reverse(),n=new Map;r.forEach((a,d)=>{for(let f of a)n.set(f,d)});let c=new Map;for(let a of o){let d=c.get(a.targetObject)??[];d.push(a.sourceObject),c.set(a.targetObject,d)}let i=r.map(()=>0);return r.forEach((a,d)=>{for(let f of a)for(let h of c.get(f)??[]){let l=n.get(h);l!==void 0&&l!==d&&(i[d]=Math.max(i[d],i[l]+1))}}),new Map(e.map(a=>[a,Math.min(Lt,1+i[n.get(a)??0])]))}async function Je(e,t,o){let r=ve(t);if(r!==void 0)throw new Error(r);let n=o?.signal;if(n?.aborted)return J();try{return await Qt(e,t,o)}catch(c){if(c instanceof P||n?.aborted)return J();throw c}}async function Qt(e,t,o){let r=o?.signal,n=s=>o?.onProgress?.(s),c=Date.now(),i=s=>u=>{if(u instanceof P)throw u;return k.warn(`[forge-discover] whole org: ${T(u)}`),s},{toolingObjects:a,recordCounts:d,createFacts:f}=e;n({phase:"listing",discoveredCount:0,queueRemaining:0});let[h,l,b,y,F]=await Promise.all([x(()=>e.describeGlobal(t.sourceOrgId,r),r),x(()=>e.describeGlobal(t.targetOrgId,r),r),a?x(()=>a(t.targetOrgId,r),r).catch(i([])):Promise.resolve([]),f?x(()=>f(t.targetOrgId),r).catch(i(void 0)):Promise.resolve(void 0),d?x(()=>d(t.sourceOrgId,r),r).catch(i(void 0)):Promise.resolve(void 0)]),C=zt(F),E=t.excludedObjects??[],{candidates:j,leftOut:W}=Ze(h,l,b,{...y?{createFacts:y}:{},...E.length>0?{excluded:E}:{}}),M=[...W];rt(M.length);let L=j.map(()=>{}),z=0;n({phase:"counting",discoveredCount:0,queueRemaining:j.length,total:j.length}),await tt(j,async(s,u,g)=>{let p=C?.get(s),I=t.objectSoqlFilters?.[s];if(p!==void 0&&p>_t&&!I)L[u]={objectApiName:s,rows:p,approximate:!0};else try{let{soql:R,all:H}=Gt(s,I),_=await x(()=>e.queryCount(t.sourceOrgId,R,r,H?{all:!0}:void 0),r);if(g())return;_>0?L[u]={objectApiName:s,rows:_}:M.push({objectApiName:s,reason:"empty"})}catch(R){if(R instanceof P||oe(R))throw R;if(g())return;ie(R)?M.push({objectApiName:s,reason:"unreadable",detail:T(R)}):(k.warn(`[forge-discover] whole org: ${s} not counted, kept: ${T(R)}`),L[u]=p!==void 0&&p>0&&!I?{objectApiName:s,rows:p,approximate:!0}:{objectApiName:s,rows:0,unknown:!0})}z++,n({phase:"counting",objectApiName:s,discoveredCount:z,queueRemaining:j.length-z,total:j.length})});let v=L.filter(s=>s!==void 0);if(v.length>ye)throw new Error(`The source org holds records in ${v.length} objects a clone of the whole org would take, more than the ${ye} one run writes. Nothing was written. Leave ${v.length-ye} of them out or more, or clone the org in parts instead: a run from a record or from a query for each part.`);let U=v.map(()=>{}),B=0;n({phase:"describing",discoveredCount:0,queueRemaining:v.length,total:v.length}),await tt(v,async({objectApiName:s},u,g)=>{try{let p=await $t(()=>x(()=>e.describeObject(t.sourceOrgId,s,r),r),s);if(g())return;U[u]=p}catch(p){if(p instanceof P||oe(p))throw p;if(g())return;M.push({objectApiName:s,reason:"notDescribed",detail:T(p)})}B++,n({phase:"describing",objectApiName:s,discoveredCount:B,queueRemaining:v.length-B,total:v.length})}),await be();let w=new Map,Q=new Map;v.forEach((s,u)=>{let g=U[u];g&&(w.set(s.objectApiName,g),Q.set(s.objectApiName,s))});let G=Ut(w);if(G.length>et)throw new Error(`The ${w.size} objects of the source org a clone of the whole org would take relate ${G.length} pairs of objects, more than the ${et} one run writes in order. Nothing was written. Clone the org in parts instead: a run from a record or from a query for each part.`);let m=[...w.keys()],D=Bt(m,G),N=m.map(s=>{let u=w.get(s),g=Q.get(s),p=g.rows,I=V(e.detectPII,s,u.fields,t.anonymizationMode);return{objectApiName:s,...u.label?{label:u.label}:{},recordCount:p,...g.approximate?{recordCountApproximate:!0}:{},...g.unknown?{recordCountUnknown:!0}:{},fieldCount:u.fields.length,status:"idle",progress:0,included:!0,piiFields:I,anonymizeFields:t.anonymizePII?[...I]:[],level:D.get(s)??1,successCount:0,failureCount:0,errors:[],createableFieldCount:u.fields.filter(R=>R.type!=="id").length,estimatedSizeMB:p*Y,estimatedApiCalls:Math.ceil(p/kt),batchStrategy:"auto"}});rt(M.length);let S=N.reduce((s,u)=>s+u.recordCount,0);return M.sort((s,u)=>s.objectApiName<u.objectApiName?-1:s.objectApiName>u.objectApiName?1:0),k.info(`[forge-discover] whole org: ${N.length} object(s), ${G.length} relation(s), ${M.length} left out, ${S} record(s), in ${Date.now()-c}ms`),{nodes:N,edges:G,totalRecords:S,estimatedSizeMB:S*Y,estimatedDurationSeconds:S*he,truncated:!1,leftOut:M}}export{ge as a,lt as b,Zt as c,se as d,ar as e,ft as f,pt as g,gt as h,mt as i,bt as j,Ot as k,Ve as l,It as m,ye as n,et as o,ie as p,tt as q,zt as r,Je as s};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a}from"./chunk-GUYEXPJ4.mjs";import"./chunk-CRPLDXJU.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as TransformPipeline};
7
+ import{a}from"./chunk-HDDJ3CVN.mjs";import"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as TransformPipeline};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __sandforgeRequire } from 'node:module';
2
+ import { fileURLToPath as __sandforgePath } from 'node:url';
3
+ import { dirname as __sandforgeDirname } from 'node:path';
4
+ const require = __sandforgeRequire(import.meta.url);
5
+ const __filename = __sandforgePath(import.meta.url);
6
+ const __dirname = __sandforgeDirname(__filename);
7
+ import{k as A,n as b}from"./chunk-ALWVNR34.mjs";import{g as C}from"./chunk-AVY742BJ.mjs";import{r as y,u as R}from"./chunk-35B73566.mjs";import{Ma as j,ra as w,xa as P}from"./chunk-OLCS7JCT.mjs";import{a as h}from"./chunk-EADHKH3A.mjs";import{vd as p,wd as g}from"./chunk-J347SPU6.mjs";var $=e=>typeof e=="string"?e:"";function L(e){let{tooling:o}=e;return{rules:b(async i=>(await h({query:async t=>o.query(t),queryMore:async t=>o.queryMore(t)},i)).records,A(e),P(e),{liftedBy:!0,reads:!0}),held:async()=>new Set((await h({query:async i=>e.query(i),queryMore:async i=>e.queryMore(i)},w)).records.map(i=>j($(i.NamespacePrefix),$(i.DeveloperName)))),unreachable:async i=>C((await e.sobject(i).describe()).fields.map(t=>({name:t.name,type:t.type,...typeof t.length=="number"?{length:t.length}:{},queryable:!0,createable:t.createable===!0,isReference:t.type==="reference"}))).map(({name:t,kind:r})=>({name:t,kind:r}))}}function v(e){return e instanceof Error?e.message:String(e)}async function x(e,o,i){if(o.length===0)return{rules:[]};let t;try{t=await e.rules(o)}catch(a){return{rules:[],unread:v(a)}}let r=t.some(a=>!a.onChangeOnly&&(a.liftedBy??[]).length>0),u;if(r)try{u=await e.held()}catch(a){u={unread:v(a)}}let s=new Map,n=e.unreachable;if(n){let a=new Set(t.filter(l=>!l.onChangeOnly&&(l.reads??[]).length>0).map(l=>l.objectApiName));for(let l of a)s.set(l,await n(l).catch(()=>[]))}return V(t,u,i,s)}function V(e,o,i,t){let r=o!==void 0&&!("unread"in o)?o:void 0,u=[],s=new Map;for(let n of e){if(n.onChangeOnly){s.set(n.objectApiName,[...s.get(n.objectApiName)??[],n.name]);continue}let a=n.liftedBy,l=r?(a??[]).filter(d=>r.has(d.toLowerCase())):[],c=l.length===0&&(a??[]).length>0?i?.find(d=>d.kind==="validationRule"&&d.name===n.name&&d.objectApiName.toLowerCase()===n.objectApiName.toLowerCase()):void 0,m=y(n.reads,t?.get(n.objectApiName)??[]).map(({field:d})=>d);u.push({objectApiName:n.objectApiName,name:n.name,message:n.message,...m.length>0?{readsUnreachable:m}:{},...n.field!==void 0?{field:n.field}:{},...a!==void 0?{liftedBy:[...a]}:{},...l.length>0?{held:l}:{},...c?{liftedByMute:{permission:c.permission,permissionSet:c.permissionSet}}:{}})}return{rules:u,...s.size>0?{onChangeOnly:[...s].map(([n,a])=>({objectApiName:n,names:a}))}:{},...o!==void 0&&"unread"in o?{heldUnread:o.unread}:{}}}function U(e,o){let i=new Set(o.map(n=>n.toLowerCase())),t=n=>i.has(n.toLowerCase()),{onChangeOnly:r,...u}=e,s=(r??[]).filter(n=>t(n.objectApiName));return{...u,rules:e.rules.filter(n=>t(n.objectApiName)),...s.length>0?{onChangeOnly:s}:{}}}function f(e){return e.map(o=>`$Permission.${o}`).join(" or ")}function k(e,o=!1){return(e.held??[]).length>0?`kept quiet for this run: the user it writes as holds ${f(e.held??[])}`:e.liftedByMute?`lifted for the run: the mute assigns ${e.liftedByMute.permissionSet}, which holds `+f([e.liftedByMute.permission]):e.liftedBy===void 0?"its formula was not read: what lifts it is not known":e.liftedBy.length===0?"no custom permission lifts it":o?`lifted for a user who holds ${f(e.liftedBy)}; whether the user the run writes as does could not be read`:`lifted for a user who holds ${f(e.liftedBy)}, which the user the run writes as does not`}function F(e,o,i=!1){if(e.unread!==void 0)return[`validation rules: those of ${o} could not be listed (${e.unread}): any of them may refuse a record`];let t=e.onChangeOnly??[];if(e.rules.length===0&&t.length===0)return[`validation rules: ${o} has no active rule on the objects the plan writes`];let r=[`validation rules: those of ${o} that may refuse these inserts, read from its metadata; the plan does not evaluate them, the org does as each record goes in`],u=[...new Set(e.rules.map(s=>s.objectApiName))];for(let s of u){r.push(` ${s}`);for(let n of e.rules.filter(a=>a.objectApiName===s)){let a=n.field!==void 0?` on ${n.field}`:"";r.push(` ${n.name}${a}: ${n.message?`"${n.message}"`:"(no message)"}`),r.push(` ${k(n,e.heldUnread!==void 0)}`),!i&&(n.readsUnreachable??[]).length>0&&r.push(` ${R((n.readsUnreachable??[]).map(l=>({field:l})))}`)}}return e.rules.length===0&&r.push(" none may refuse an insert"),t.length>0&&r.push(` left out of them, their formula holding only on a change of a record, which an insert never is; the second pass, which fills lookups and gives statuses back, may meet them: ${t.map(({objectApiName:s,names:n})=>`${s}: ${n.join(", ")}`).join("; ")}`),e.heldUnread!==void 0&&r.push(` the custom permissions of the user the run writes as could not be read: ${e.heldUnread}`),r}function K(e,o,i){if(!e||i.statusCode!==p)return;if(e.unread!==void 0)return"refused by a validation rule of the target, which the plan could not list";let t=g(e,o,i);return t?`refused by ${t.name}, among the validation rules the plan listed above: `+k(t,e.heldUnread!==void 0):"refused by a validation rule of the target: the plan listed above those that may refuse these inserts"}export{L as a,x as b,V as c,U as d,k as e,F as f,K as g};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a as T,b as F,d as B,k as R}from"./chunk-JKFCGYJE.mjs";import{a as L,f as C,i as $,j as _}from"./chunk-YDXMTWAT.mjs";import{b as N}from"./chunk-EINEGS6E.mjs";import{a as I}from"./chunk-4TLYUZD5.mjs";import{a as j,d as x}from"./chunk-4N425UJC.mjs";import{b as P}from"./chunk-CA5NAXSU.mjs";import{qd as A}from"./chunk-CRPLDXJU.mjs";var w=class{byObject=new Map;add(e){let t=this.byObject.get(e.objectApiName);t||(t=new Map,this.byObject.set(e.objectApiName,t));let s=t.get(e.recordId),r=s?.[e.fieldName];if(r!==void 0&&r!==e.value)return{taken:!1,kept:r};let n=s??{Id:e.recordId};return n[e.fieldName]=e.value,t.set(e.recordId,n),{taken:!0}}updates(){return[...this.byObject].map(([e,t])=>[e,[...t.values()]])}};var J="DUPLICATES_DETECTED",X=3,Y=2e3;function Z(i){return new Promise(e=>setTimeout(e,i))}function z(i){let e=i.errorDetails??[];return x(i.errors,e.length===i.errors.length?e:void 0)}function q(i){let e=i.errorDetails;return e?.length!==1||e[0].statusCode===J||z(i)}function Q(i){let e=Object.keys(i).find(s=>s!=="Id"),t=e===void 0?void 0:i[e];return typeof t=="string"?t:""}function U(i){return{objectApiName:i,op:"update"}}function V(i){let e=i.automation??"the target's automation";I.warn(`[forge] ${i.objectApiName}: ${e} hit ${i.limit??"a Salesforce limit"} on an update of ${i.from} records \u2014 sending a record on its own, then smaller calls.`)}function y(i){return Object.keys(i).filter(e=>e!=="Id").length}async function fe(i){if(!i.enabled||!i.updateRecords||i.pendingFkUpdates.length===0)return null;let e=new E(i);return await e.patch(i.pendingFkUpdates),e.finish()}var ee=1024,te=.6;function K(i){let e=2166136261;for(let t=0;t<i.length;t++)e^=i.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function M(i){let e=2538058380;for(let t=0;t<i.length;t++)e=Math.imul(e^i.charCodeAt(t),1540483477),e^=e>>>15;return e>>>0}var H=class{capacity=ee;used=0;h1=new Uint32Array(this.capacity);h2=new Uint32Array(this.capacity);firstPart=new Float64Array(this.capacity);several=new Uint8Array(this.capacity);note(e,t){let s=K(t),r=M(t),n=this.find(s,r);if(n>=0){this.firstPart[n]!==e+1&&(this.several[n]=1);return}this.used+1>this.capacity*te&&this.grow();let o=this.freeSlotFor(r);this.h1[o]=s,this.h2[o]=r,this.firstPart[o]=e+1,this.used++}spans(e){let t=this.find(K(e),M(e));return t>=0&&this.several[t]===1}find(e,t){let s=this.capacity-1;for(let r=t&s;;r=r+1&s){if(this.firstPart[r]===0)return-1;if(this.h1[r]===e&&this.h2[r]===t)return r}}freeSlotFor(e){let t=this.capacity-1,s=e&t;for(;this.firstPart[s]!==0;)s=s+1&t;return s}grow(){let{h1:e,h2:t,firstPart:s,several:r}=this;this.capacity*=2,this.h1=new Uint32Array(this.capacity),this.h2=new Uint32Array(this.capacity),this.firstPart=new Float64Array(this.capacity),this.several=new Uint8Array(this.capacity);for(let n=0;n<s.length;n++){if(s[n]===0)continue;let o=this.freeSlotFor(t[n]);this.h1[o]=e[n],this.h2[o]=t[n],this.firstPart[o]=s[n],this.several[o]=r[n]}}},E=class{constructor(e){this.input=e;this.splits=e.splitting!==void 0,this.splitting=e.splitting??L(0),this.bulkUnsupported=e.bulkUnsupported??new Set}input;resolvedCount=0;unresolvedCount=0;insertOnlyLost=0;unresolved=[];pass2Failed=0;pass2Samples=[];notSent=0;notSentObjects=new Set;cancelled=!1;handed=0;held=new w;splitting;splits;bulkUnsupported;backoff=new j({initialDelay:Y});limitOf(e){return this.splits&&e&&!e.success?A(e.errors):void 0}async patch(e,t){let{input:s}=this;if(!s.enabled||!s.updateRecords||e.length===0)return;this.handed+=e.length;let r=new w;for(let n of e)this.take(n,t?.(n)===!0?this.held:r);await this.send(r)}async sendHeld(){await this.send(this.held)}take(e,t){let{input:s}=this,{remapper:r}=s,n=r.get(e.sourceRefId);if(!n){if(s.deferUnresolved){s.stillPending?.push(e);return}if(s.outsideTheSample?.(e)){s.onLeftOutsideTheSample?.(e.objectApiName,e.fieldName);return}this.unresolvedCount++,this.unresolved.length<3&&this.unresolved.push({recordSummary:`${e.objectApiName} source=${e.sourceId??"?"} target=${e.newId} ${e.fieldName}=<source ${e.sourceRefId}>`,messages:[`Cycle FK '${e.fieldName}' could not be resolved \u2014 referenced parent (source ${e.sourceRefId}) was not cloned`]});return}if(e.insertOnly){this.insertOnlyLost++,this.unresolved.length<3&&this.unresolved.push({recordSummary:`${e.objectApiName} source=${e.sourceId??"?"} target=${e.newId} ${e.fieldName}`,messages:[`Lookup '${e.fieldName}' left empty: only an insert sets it, and the record it names (source ${e.sourceRefId}) was written after this one`]});return}let o=t.add({objectApiName:e.objectApiName,recordId:e.newId,fieldName:e.fieldName,value:n});if(!o.taken){this.unresolvedCount++,this.unresolved.length<3&&this.unresolved.push({recordSummary:`${e.objectApiName} source=${e.sourceId??"?"} target=${e.newId} ${e.fieldName}`,messages:[`Conflicting cycle FK update for ${e.fieldName}: ${String(o.kept)} vs ${n}`]});return}this.resolvedCount++}async send(e){for(let[t,s]of e.updates()){if(this.jobsFor(t,s.length)){await this.sendAsJobs(t,s);continue}await this.sendObject(t,s)}}jobsFor(e,t){let{input:s}=this;return s.bulkUpdate!==void 0&&t>=2e3&&s.restOnly?.has(e)!==!0&&!this.bulkUnsupported.has(e)}leaveNotSent(e,t){for(let s of t)this.notSent+=y(s);t.length>0&&this.notSentObjects.add(e)}async sendObject(e,t,s,r){let{input:n}=this,{targetOrgId:o}=n,d=n.updateRecords;if(!d||t.length===0)return;let c=()=>(this.cancelled||(this.cancelled=n.stopped?.()===!0),this.cancelled);if(c()){this.leaveNotSent(e,t);return}let l,a=await _(t,{key:U(e),sizes:this.splitting.sizes,allowance:this.splitting.allowance,maxSize:B.rest,...r,beforeEachSend:()=>c()?"stop":void 0,send:async p=>{try{return{answers:await d(o,e,[...p])}}catch(h){return l={error:h},{answers:[]}}},limited:p=>this.limitOf(p),settle:(p,h,k,S)=>{let v=l;l=void 0,v?this.callThrew(e,p,v.error):this.settleAnswers(e,p,h,k,S,s),n.onAnswered?.()},onFirstRefusal:V});a.stopped&&this.leaveNotSent(e,[...a.stopped.part,...a.stopped.rest])}settleAnswers(e,t,s,r,n,o){let{input:d}=this;for(let c=0;c<t.length;c++){if(r.has(c))continue;let l=s[c];l?l.success?d.onPatched?.(e,t[c]):o&&z(l)?o.push(t[c]):this.refused(e,t[c],l,n.get(c)):(this.pass2Failed+=y(t[c]),this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:R(t[c]),messages:[`No result returned for record (API truncated batch: ${s.length}/${t.length})`]}))}}refused(e,t,s,r){this.tellRefusedByFilter(e,t,s),this.pass2Failed+=y(t),this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:R(t),messages:r===void 0?s.errors:[...s.errors,C(r,$(this.splitting.allowance,U(e)),"run")]})}callThrew(e,t,s){for(let r of t)this.pass2Failed+=y(r);this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:`${e} batch failed`,messages:[P(s)]})}async sendAsJobs(e,t){let{input:s}=this,r=s.bulkUpdate;if(!r)return;let n=t.map((l,a)=>({record:l,at:a,value:Q(l)})).sort((l,a)=>l.value===a.value?l.at-a.at:l.value<a.value?-1:1).map(({record:l})=>l),o=U(e),{sizes:d,allowance:c}=this.splitting;for(let l=0;l<n.length;l+=F){let a=n.slice(l,l+F);if(this.cancelled||(this.cancelled=s.stopped?.()===!0),this.cancelled){this.leaveNotSent(e,a);continue}let p=d.of(o);if(p<200){let u=Math.ceil(a.length/p),f=c.take(o,u);d.countExtraCalls(o,f);let m=a.slice(0,f*p);try{await this.sendObject(e,m,void 0,{pricedAs:"job",paid:{calls:f}})}finally{f<u&&d.spend(o)}if(f===u)continue;if(a=a.slice(m.length),this.cancelled){this.leaveNotSent(e,a);continue}if(a.length<2e3){await this.sendObject(e,a);continue}}let h;try{h=await r(e,a)}catch(u){if(!(u instanceof T)){await this.sendObject(e,a);continue}for(let f of a)this.pass2Failed+=y(f);this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:`${e}: a Bulk API job of ${a.length} updates was lost`,messages:[P(u),"The target may hold any of these lookups: they are counted as left empty."]}),s.onAnswered?.();continue}if(h.aborted){this.cancelled=!0,this.leaveNotSent(e,a);continue}if(h.untouched){h.untouched.unsupported&&this.bulkUnsupported.add(e),await this.sendObject(e,a);continue}let k=[],S=[],v=[],b;a.forEach((u,f)=>{let m=h.rows[f]??"unprocessed",g=h.answers[f],O=m==="answered"?this.limitOf(g):void 0;O&&g?(b??=O,S.push(u),v.push(g)):m==="answered"&&g?.success?s.onPatched?.(e,u):m==="may-have-written"?(this.pass2Failed+=y(u),this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:R(u),messages:["The Bulk API job may have written this update without saying so."]})):m!=="answered"||!g||q(g)?k.push(u):this.refused(e,u,g)}),s.onAnswered?.(),await this.sendAgainByRest(e,k),await this.sendObject(e,S,void 0,{refusedIn:{from:200,answers:v,...b?{cause:b}:{}}})}}async sendAgainByRest(e,t){let s=t;for(let r=0;s.length>0;r++){r>0&&await(this.input.wait??Z)(this.backoff.calculateDelay(r-1));let n=[];await this.sendObject(e,s,r<X-1?n:void 0),s=n}}tellRefusedByFilter(e,t,s){let r=this.input.onRefusedByFilter,n=t.Id;if(!r||typeof n!="string")return;let o=new Set((s.errorDetails??[]).filter(d=>d.statusCode===N).flatMap(d=>d.fields));for(let d of Object.keys(t))d!=="Id"&&o.has(d)&&r(e,d,n)}finish(){let{resolvedCount:e,unresolvedCount:t,insertOnlyLost:s,pass2Failed:r,notSent:n}=this;if(this.handed===0)return null;let o=e+t+s;if(this.input.deferUnresolved&&e===0&&r===0&&s===0)return null;let d=r+t+s+n;if(this.input.onProgress({objectName:"__pass2__",status:d>0?"error":"done",progress:100,message:`Pass 2 (cycle FK update): ${e-r-n}/${o} resolved`+(n>0?`; cancelled with ${n} not sent`:"")}),d>0){let c=n>0?[{recordSummary:`${[...this.notSentObjects].join(", ")}: ${n} lookup${n===1?"":"s"} not sent`,messages:["The run was cancelled before they were filled in: they stay empty."]}]:[];return{objectApiName:"__pass2__",stage:"insert",failedCount:d,attemptedCount:o,samples:[...c,...this.pass2Samples,...this.unresolved].slice(0,3)}}return null}};export{w as a,fe as b,H as c,E as d};
7
+ import{a as T,b as F,d as B,k as R}from"./chunk-CSMGP53U.mjs";import{a as L,f as C,i as $,j as _}from"./chunk-YDXMTWAT.mjs";import{b as N}from"./chunk-35B73566.mjs";import{a as I}from"./chunk-4TLYUZD5.mjs";import{a as j,d as x}from"./chunk-UCUFLFNK.mjs";import{b as P}from"./chunk-CA5NAXSU.mjs";import{Yb as A}from"./chunk-J347SPU6.mjs";var w=class{byObject=new Map;add(e){let t=this.byObject.get(e.objectApiName);t||(t=new Map,this.byObject.set(e.objectApiName,t));let s=t.get(e.recordId),r=s?.[e.fieldName];if(r!==void 0&&r!==e.value)return{taken:!1,kept:r};let n=s??{Id:e.recordId};return n[e.fieldName]=e.value,t.set(e.recordId,n),{taken:!0}}updates(){return[...this.byObject].map(([e,t])=>[e,[...t.values()]])}};var J="DUPLICATES_DETECTED",X=3,Y=2e3;function Z(i){return new Promise(e=>setTimeout(e,i))}function z(i){let e=i.errorDetails??[];return x(i.errors,e.length===i.errors.length?e:void 0)}function q(i){let e=i.errorDetails;return e?.length!==1||e[0].statusCode===J||z(i)}function Q(i){let e=Object.keys(i).find(s=>s!=="Id"),t=e===void 0?void 0:i[e];return typeof t=="string"?t:""}function U(i){return{objectApiName:i,op:"update"}}function V(i){let e=i.automation??"the target's automation";I.warn(`[forge] ${i.objectApiName}: ${e} hit ${i.limit??"a Salesforce limit"} on an update of ${i.from} records \u2014 sending a record on its own, then smaller calls.`)}function y(i){return Object.keys(i).filter(e=>e!=="Id").length}async function fe(i){if(!i.enabled||!i.updateRecords||i.pendingFkUpdates.length===0)return null;let e=new E(i);return await e.patch(i.pendingFkUpdates),e.finish()}var ee=1024,te=.6;function K(i){let e=2166136261;for(let t=0;t<i.length;t++)e^=i.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function M(i){let e=2538058380;for(let t=0;t<i.length;t++)e=Math.imul(e^i.charCodeAt(t),1540483477),e^=e>>>15;return e>>>0}var H=class{capacity=ee;used=0;h1=new Uint32Array(this.capacity);h2=new Uint32Array(this.capacity);firstPart=new Float64Array(this.capacity);several=new Uint8Array(this.capacity);note(e,t){let s=K(t),r=M(t),n=this.find(s,r);if(n>=0){this.firstPart[n]!==e+1&&(this.several[n]=1);return}this.used+1>this.capacity*te&&this.grow();let o=this.freeSlotFor(r);this.h1[o]=s,this.h2[o]=r,this.firstPart[o]=e+1,this.used++}spans(e){let t=this.find(K(e),M(e));return t>=0&&this.several[t]===1}find(e,t){let s=this.capacity-1;for(let r=t&s;;r=r+1&s){if(this.firstPart[r]===0)return-1;if(this.h1[r]===e&&this.h2[r]===t)return r}}freeSlotFor(e){let t=this.capacity-1,s=e&t;for(;this.firstPart[s]!==0;)s=s+1&t;return s}grow(){let{h1:e,h2:t,firstPart:s,several:r}=this;this.capacity*=2,this.h1=new Uint32Array(this.capacity),this.h2=new Uint32Array(this.capacity),this.firstPart=new Float64Array(this.capacity),this.several=new Uint8Array(this.capacity);for(let n=0;n<s.length;n++){if(s[n]===0)continue;let o=this.freeSlotFor(t[n]);this.h1[o]=e[n],this.h2[o]=t[n],this.firstPart[o]=s[n],this.several[o]=r[n]}}},E=class{constructor(e){this.input=e;this.splits=e.splitting!==void 0,this.splitting=e.splitting??L(0),this.bulkUnsupported=e.bulkUnsupported??new Set}input;resolvedCount=0;unresolvedCount=0;insertOnlyLost=0;unresolved=[];pass2Failed=0;pass2Samples=[];notSent=0;notSentObjects=new Set;cancelled=!1;handed=0;held=new w;splitting;splits;bulkUnsupported;backoff=new j({initialDelay:Y});limitOf(e){return this.splits&&e&&!e.success?A(e.errors):void 0}async patch(e,t){let{input:s}=this;if(!s.enabled||!s.updateRecords||e.length===0)return;this.handed+=e.length;let r=new w;for(let n of e)this.take(n,t?.(n)===!0?this.held:r);await this.send(r)}async sendHeld(){await this.send(this.held)}take(e,t){let{input:s}=this,{remapper:r}=s,n=r.get(e.sourceRefId);if(!n){if(s.deferUnresolved){s.stillPending?.push(e);return}if(s.outsideTheSample?.(e)){s.onLeftOutsideTheSample?.(e.objectApiName,e.fieldName);return}this.unresolvedCount++,this.unresolved.length<3&&this.unresolved.push({recordSummary:`${e.objectApiName} source=${e.sourceId??"?"} target=${e.newId} ${e.fieldName}=<source ${e.sourceRefId}>`,messages:[`Cycle FK '${e.fieldName}' could not be resolved \u2014 referenced parent (source ${e.sourceRefId}) was not cloned`]});return}if(e.insertOnly){this.insertOnlyLost++,this.unresolved.length<3&&this.unresolved.push({recordSummary:`${e.objectApiName} source=${e.sourceId??"?"} target=${e.newId} ${e.fieldName}`,messages:[`Lookup '${e.fieldName}' left empty: only an insert sets it, and the record it names (source ${e.sourceRefId}) was written after this one`]});return}let o=t.add({objectApiName:e.objectApiName,recordId:e.newId,fieldName:e.fieldName,value:n});if(!o.taken){this.unresolvedCount++,this.unresolved.length<3&&this.unresolved.push({recordSummary:`${e.objectApiName} source=${e.sourceId??"?"} target=${e.newId} ${e.fieldName}`,messages:[`Conflicting cycle FK update for ${e.fieldName}: ${String(o.kept)} vs ${n}`]});return}this.resolvedCount++}async send(e){for(let[t,s]of e.updates()){if(this.jobsFor(t,s.length)){await this.sendAsJobs(t,s);continue}await this.sendObject(t,s)}}jobsFor(e,t){let{input:s}=this;return s.bulkUpdate!==void 0&&t>=2e3&&s.restOnly?.has(e)!==!0&&!this.bulkUnsupported.has(e)}leaveNotSent(e,t){for(let s of t)this.notSent+=y(s);t.length>0&&this.notSentObjects.add(e)}async sendObject(e,t,s,r){let{input:n}=this,{targetOrgId:o}=n,d=n.updateRecords;if(!d||t.length===0)return;let c=()=>(this.cancelled||(this.cancelled=n.stopped?.()===!0),this.cancelled);if(c()){this.leaveNotSent(e,t);return}let l,a=await _(t,{key:U(e),sizes:this.splitting.sizes,allowance:this.splitting.allowance,maxSize:B.rest,...r,beforeEachSend:()=>c()?"stop":void 0,send:async p=>{try{return{answers:await d(o,e,[...p])}}catch(h){return l={error:h},{answers:[]}}},limited:p=>this.limitOf(p),settle:(p,h,k,S)=>{let v=l;l=void 0,v?this.callThrew(e,p,v.error):this.settleAnswers(e,p,h,k,S,s),n.onAnswered?.()},onFirstRefusal:V});a.stopped&&this.leaveNotSent(e,[...a.stopped.part,...a.stopped.rest])}settleAnswers(e,t,s,r,n,o){let{input:d}=this;for(let c=0;c<t.length;c++){if(r.has(c))continue;let l=s[c];l?l.success?d.onPatched?.(e,t[c]):o&&z(l)?o.push(t[c]):this.refused(e,t[c],l,n.get(c)):(this.pass2Failed+=y(t[c]),this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:R(t[c]),messages:[`No result returned for record (API truncated batch: ${s.length}/${t.length})`]}))}}refused(e,t,s,r){this.tellRefusedByFilter(e,t,s),this.pass2Failed+=y(t),this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:R(t),messages:r===void 0?s.errors:[...s.errors,C(r,$(this.splitting.allowance,U(e)),"run")]})}callThrew(e,t,s){for(let r of t)this.pass2Failed+=y(r);this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:`${e} batch failed`,messages:[P(s)]})}async sendAsJobs(e,t){let{input:s}=this,r=s.bulkUpdate;if(!r)return;let n=t.map((l,a)=>({record:l,at:a,value:Q(l)})).sort((l,a)=>l.value===a.value?l.at-a.at:l.value<a.value?-1:1).map(({record:l})=>l),o=U(e),{sizes:d,allowance:c}=this.splitting;for(let l=0;l<n.length;l+=F){let a=n.slice(l,l+F);if(this.cancelled||(this.cancelled=s.stopped?.()===!0),this.cancelled){this.leaveNotSent(e,a);continue}let p=d.of(o);if(p<200){let u=Math.ceil(a.length/p),f=c.take(o,u);d.countExtraCalls(o,f);let m=a.slice(0,f*p);try{await this.sendObject(e,m,void 0,{pricedAs:"job",paid:{calls:f}})}finally{f<u&&d.spend(o)}if(f===u)continue;if(a=a.slice(m.length),this.cancelled){this.leaveNotSent(e,a);continue}if(a.length<2e3){await this.sendObject(e,a);continue}}let h;try{h=await r(e,a)}catch(u){if(!(u instanceof T)){await this.sendObject(e,a);continue}for(let f of a)this.pass2Failed+=y(f);this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:`${e}: a Bulk API job of ${a.length} updates was lost`,messages:[P(u),"The target may hold any of these lookups: they are counted as left empty."]}),s.onAnswered?.();continue}if(h.aborted){this.cancelled=!0,this.leaveNotSent(e,a);continue}if(h.untouched){h.untouched.unsupported&&this.bulkUnsupported.add(e),await this.sendObject(e,a);continue}let k=[],S=[],v=[],b;a.forEach((u,f)=>{let m=h.rows[f]??"unprocessed",g=h.answers[f],O=m==="answered"?this.limitOf(g):void 0;O&&g?(b??=O,S.push(u),v.push(g)):m==="answered"&&g?.success?s.onPatched?.(e,u):m==="may-have-written"?(this.pass2Failed+=y(u),this.pass2Samples.length<3&&this.pass2Samples.push({recordSummary:R(u),messages:["The Bulk API job may have written this update without saying so."]})):m!=="answered"||!g||q(g)?k.push(u):this.refused(e,u,g)}),s.onAnswered?.(),await this.sendAgainByRest(e,k),await this.sendObject(e,S,void 0,{refusedIn:{from:200,answers:v,...b?{cause:b}:{}}})}}async sendAgainByRest(e,t){let s=t;for(let r=0;s.length>0;r++){r>0&&await(this.input.wait??Z)(this.backoff.calculateDelay(r-1));let n=[];await this.sendObject(e,s,r<X-1?n:void 0),s=n}}tellRefusedByFilter(e,t,s){let r=this.input.onRefusedByFilter,n=t.Id;if(!r||typeof n!="string")return;let o=new Set((s.errorDetails??[]).filter(d=>d.statusCode===N).flatMap(d=>d.fields));for(let d of Object.keys(t))d!=="Id"&&o.has(d)&&r(e,d,n)}finish(){let{resolvedCount:e,unresolvedCount:t,insertOnlyLost:s,pass2Failed:r,notSent:n}=this;if(this.handed===0)return null;let o=e+t+s;if(this.input.deferUnresolved&&e===0&&r===0&&s===0)return null;let d=r+t+s+n;if(this.input.onProgress({objectName:"__pass2__",status:d>0?"error":"done",progress:100,message:`Pass 2 (cycle FK update): ${e-r-n}/${o} resolved`+(n>0?`; cancelled with ${n} not sent`:"")}),d>0){let c=n>0?[{recordSummary:`${[...this.notSentObjects].join(", ")}: ${n} lookup${n===1?"":"s"} not sent`,messages:["The run was cancelled before they were filled in: they stay empty."]}]:[];return{objectApiName:"__pass2__",stage:"insert",failedCount:d,attemptedCount:o,samples:[...c,...this.pass2Samples,...this.unresolved].slice(0,3)}}return null}};export{w as a,fe as b,H as c,E as d};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{j as c}from"./chunk-CRPLDXJU.mjs";var a=/__kav$/i,d="Campaign";function u(e){return a.test(e)?"Salesforce Knowledge is not turned on in it: tick Knowledge User on your user (Setup > Users), then enable it in Setup > Knowledge Settings":void 0}var b="a campaign needs the Marketing User box ticked on the user, in Setup > Users",f=/^005[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/;function m(e){let n,t;return async s=>{n??=e.describeGlobal().then(o=>new Map(o.sobjects.map(i=>[i.name.toLowerCase(),i.createable===!0])));let r=(await n).get(s.toLowerCase());if(r===void 0){let o=u(s);return{access:"absent",...o?{reason:o}:{}}}return s===d&&(t??=l(e),!r||!await t)?{access:"readOnly",reason:b}:r?{access:"createable"}:{access:"readOnly"}}}async function j(e,n){let t=new Set;for(let{objectApiName:s,optional:r}of e.objects)if(r===!0)try{(await n(s)).access!=="createable"&&t.add(s)}catch{}if(t.size===0)return e;for(let s=!0;s;){s=!1;for(let r of e.objects)t.has(r.objectApiName)||c(r,e.relations).some(o=>t.has(o))&&(t.add(r.objectApiName),s=!0)}return{...e,objects:e.objects.filter(s=>!t.has(s.objectApiName)),...e.relations?{relations:e.relations.filter(({childObject:s,parentObject:r})=>!t.has(s)&&!t.has(r))}:{}}}async function l(e){try{let{user_id:n}=await e.identity();return f.test(n)?(await e.query(`SELECT UserPermissionsMarketingUser FROM User WHERE Id = '${n}'`)).records[0]?.UserPermissionsMarketingUser!==!1:!0}catch{return!0}}export{m as a,j as b};
7
+ import{j as c}from"./chunk-J347SPU6.mjs";var a=/__kav$/i,d="Campaign";function u(e){return a.test(e)?"Salesforce Knowledge is not turned on in it: tick Knowledge User on your user (Setup > Users), then enable it in Setup > Knowledge Settings":void 0}var b="a campaign needs the Marketing User box ticked on the user, in Setup > Users",f=/^005[A-Za-z0-9]{12}(?:[A-Za-z0-9]{3})?$/;function m(e){let n,t;return async s=>{n??=e.describeGlobal().then(o=>new Map(o.sobjects.map(i=>[i.name.toLowerCase(),i.createable===!0])));let r=(await n).get(s.toLowerCase());if(r===void 0){let o=u(s);return{access:"absent",...o?{reason:o}:{}}}return s===d&&(t??=l(e),!r||!await t)?{access:"readOnly",reason:b}:r?{access:"createable"}:{access:"readOnly"}}}async function j(e,n){let t=new Set;for(let{objectApiName:s,optional:r}of e.objects)if(r===!0)try{(await n(s)).access!=="createable"&&t.add(s)}catch{}if(t.size===0)return e;for(let s=!0;s;){s=!1;for(let r of e.objects)t.has(r.objectApiName)||c(r,e.relations).some(o=>t.has(o))&&(t.add(r.objectApiName),s=!0)}return{...e,objects:e.objects.filter(s=>!t.has(s.objectApiName)),...e.relations?{relations:e.relations.filter(({childObject:s,parentObject:r})=>!t.has(s)&&!t.has(r))}:{}}}async function l(e){try{let{user_id:n}=await e.identity();return f.test(n)?(await e.query(`SELECT UserPermissionsMarketingUser FROM User WHERE Id = '${n}'`)).records[0]?.UserPermissionsMarketingUser!==!1:!0}catch{return!0}}export{m as a,j as b};
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a,b}from"./chunk-LU7M5URW.mjs";import"./chunk-CRPLDXJU.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as DataPlanBuilder,b as resolveInsertOrder};
7
+ import{a,b}from"./chunk-PIQ2I67B.mjs";import"./chunk-J347SPU6.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as DataPlanBuilder,b as resolveInsertOrder};