langgraph-ui-components 0.0.4 → 0.0.7

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 (520) hide show
  1. package/dist/index.es10.js +31 -16
  2. package/dist/index.es10.js.map +1 -1
  3. package/dist/index.es100.js +143 -3134
  4. package/dist/index.es100.js.map +1 -1
  5. package/dist/index.es101.js +202 -36
  6. package/dist/index.es101.js.map +1 -1
  7. package/dist/index.es102.js +14 -5
  8. package/dist/index.es102.js.map +1 -1
  9. package/dist/index.es103.js +27 -70
  10. package/dist/index.es103.js.map +1 -1
  11. package/dist/index.es104.js +28 -31
  12. package/dist/index.es104.js.map +1 -1
  13. package/dist/index.es105.js +3157 -5
  14. package/dist/index.es105.js.map +1 -1
  15. package/dist/index.es106.js +18 -2
  16. package/dist/index.es106.js.map +1 -1
  17. package/dist/index.es107.js +5 -11
  18. package/dist/index.es107.js.map +1 -1
  19. package/dist/index.es108.js +2 -503
  20. package/dist/index.es108.js.map +1 -1
  21. package/dist/index.es109.js +11 -5
  22. package/dist/index.es109.js.map +1 -1
  23. package/dist/index.es11.js +166 -123
  24. package/dist/index.es11.js.map +1 -1
  25. package/dist/index.es110.js +503 -2
  26. package/dist/index.es110.js.map +1 -1
  27. package/dist/index.es111.js +5 -146
  28. package/dist/index.es111.js.map +1 -1
  29. package/dist/index.es112.js +2 -908
  30. package/dist/index.es112.js.map +1 -1
  31. package/dist/index.es113.js +128 -262
  32. package/dist/index.es113.js.map +1 -1
  33. package/dist/index.es114.js +907 -3
  34. package/dist/index.es114.js.map +1 -1
  35. package/dist/index.es115.js +262 -426
  36. package/dist/index.es115.js.map +1 -1
  37. package/dist/index.es116.js +3 -47
  38. package/dist/index.es116.js.map +1 -1
  39. package/dist/index.es117.js +443 -21
  40. package/dist/index.es117.js.map +1 -1
  41. package/dist/index.es118.js +42 -75
  42. package/dist/index.es118.js.map +1 -1
  43. package/dist/index.es119.js +22 -129
  44. package/dist/index.es119.js.map +1 -1
  45. package/dist/index.es12.js +13 -103
  46. package/dist/index.es12.js.map +1 -1
  47. package/dist/index.es120.js +74 -44
  48. package/dist/index.es120.js.map +1 -1
  49. package/dist/index.es121.js +129 -10
  50. package/dist/index.es121.js.map +1 -1
  51. package/dist/index.es122.js +47 -43
  52. package/dist/index.es122.js.map +1 -1
  53. package/dist/index.es123.js +9 -98
  54. package/dist/index.es123.js.map +1 -1
  55. package/dist/index.es124.js +43 -51
  56. package/dist/index.es124.js.map +1 -1
  57. package/dist/index.es125.js +96 -13
  58. package/dist/index.es125.js.map +1 -1
  59. package/dist/index.es126.js +52 -14
  60. package/dist/index.es126.js.map +1 -1
  61. package/dist/index.es127.js +156 -81
  62. package/dist/index.es127.js.map +1 -1
  63. package/dist/index.es128.js +2 -2
  64. package/dist/index.es129.js +14 -55
  65. package/dist/index.es129.js.map +1 -1
  66. package/dist/index.es13.js +126 -32
  67. package/dist/index.es13.js.map +1 -1
  68. package/dist/index.es130.js +87 -98
  69. package/dist/index.es130.js.map +1 -1
  70. package/dist/index.es131.js +2 -191
  71. package/dist/index.es131.js.map +1 -1
  72. package/dist/index.es132.js +54 -108
  73. package/dist/index.es132.js.map +1 -1
  74. package/dist/index.es133.js +98 -33
  75. package/dist/index.es133.js.map +1 -1
  76. package/dist/index.es134.js +191 -10
  77. package/dist/index.es134.js.map +1 -1
  78. package/dist/index.es135.js +109 -10
  79. package/dist/index.es135.js.map +1 -1
  80. package/dist/index.es136.js +35 -12
  81. package/dist/index.es136.js.map +1 -1
  82. package/dist/index.es137.js +10 -91
  83. package/dist/index.es137.js.map +1 -1
  84. package/dist/index.es138.js +11 -275
  85. package/dist/index.es138.js.map +1 -1
  86. package/dist/index.es139.js +12 -2
  87. package/dist/index.es139.js.map +1 -1
  88. package/dist/index.es140.js +88 -161
  89. package/dist/index.es140.js.map +1 -1
  90. package/dist/index.es141.js +270 -46
  91. package/dist/index.es141.js.map +1 -1
  92. package/dist/index.es142.js +2 -40
  93. package/dist/index.es142.js.map +1 -1
  94. package/dist/index.es143.js +164 -35
  95. package/dist/index.es143.js.map +1 -1
  96. package/dist/index.es144.js +45 -34
  97. package/dist/index.es144.js.map +1 -1
  98. package/dist/index.es145.js +37 -21
  99. package/dist/index.es145.js.map +1 -1
  100. package/dist/index.es146.js +32 -588
  101. package/dist/index.es146.js.map +1 -1
  102. package/dist/index.es147.js +32 -117
  103. package/dist/index.es147.js.map +1 -1
  104. package/dist/index.es148.js +22 -162
  105. package/dist/index.es148.js.map +1 -1
  106. package/dist/index.es149.js +591 -2
  107. package/dist/index.es149.js.map +1 -1
  108. package/dist/index.es15.js +15 -15
  109. package/dist/index.es150.js +125 -2
  110. package/dist/index.es150.js.map +1 -1
  111. package/dist/index.es151.js +2 -2
  112. package/dist/index.es152.js +2 -22
  113. package/dist/index.es152.js.map +1 -1
  114. package/dist/index.es153.js +22 -2
  115. package/dist/index.es153.js.map +1 -1
  116. package/dist/index.es154.js +2 -25
  117. package/dist/index.es154.js.map +1 -1
  118. package/dist/index.es155.js +25 -8
  119. package/dist/index.es155.js.map +1 -1
  120. package/dist/index.es156.js +4 -5
  121. package/dist/index.es156.js.map +1 -1
  122. package/dist/index.es157.js +7 -12
  123. package/dist/index.es157.js.map +1 -1
  124. package/dist/index.es158.js +5 -6
  125. package/dist/index.es158.js.map +1 -1
  126. package/dist/index.es159.js +12 -63
  127. package/dist/index.es159.js.map +1 -1
  128. package/dist/index.es160.js +5 -21
  129. package/dist/index.es160.js.map +1 -1
  130. package/dist/index.es161.js +24 -5
  131. package/dist/index.es161.js.map +1 -1
  132. package/dist/index.es162.js +11 -348
  133. package/dist/index.es162.js.map +1 -1
  134. package/dist/index.es163.js +52 -23
  135. package/dist/index.es163.js.map +1 -1
  136. package/dist/index.es164.js +63 -11
  137. package/dist/index.es164.js.map +1 -1
  138. package/dist/index.es165.js +21 -53
  139. package/dist/index.es165.js.map +1 -1
  140. package/dist/index.es166.js +6 -7
  141. package/dist/index.es166.js.map +1 -1
  142. package/dist/index.es167.js +342 -96
  143. package/dist/index.es167.js.map +1 -1
  144. package/dist/index.es168.js +6 -118
  145. package/dist/index.es168.js.map +1 -1
  146. package/dist/index.es169.js +98 -131
  147. package/dist/index.es169.js.map +1 -1
  148. package/dist/index.es17.js +2 -2
  149. package/dist/index.es170.js +108 -104
  150. package/dist/index.es170.js.map +1 -1
  151. package/dist/index.es171.js +136 -6
  152. package/dist/index.es171.js.map +1 -1
  153. package/dist/index.es172.js +114 -3
  154. package/dist/index.es172.js.map +1 -1
  155. package/dist/index.es173.js +6 -2
  156. package/dist/index.es173.js.map +1 -1
  157. package/dist/index.es174.js +2 -3737
  158. package/dist/index.es174.js.map +1 -1
  159. package/dist/index.es175.js +3682 -287
  160. package/dist/index.es175.js.map +1 -1
  161. package/dist/index.es176.js +321 -88
  162. package/dist/index.es176.js.map +1 -1
  163. package/dist/index.es177.js +95 -119
  164. package/dist/index.es177.js.map +1 -1
  165. package/dist/index.es178.js +131 -13
  166. package/dist/index.es178.js.map +1 -1
  167. package/dist/index.es179.js +13 -150
  168. package/dist/index.es179.js.map +1 -1
  169. package/dist/index.es180.js +150 -13
  170. package/dist/index.es180.js.map +1 -1
  171. package/dist/index.es181.js +13 -6
  172. package/dist/index.es181.js.map +1 -1
  173. package/dist/index.es182.js +6 -19
  174. package/dist/index.es182.js.map +1 -1
  175. package/dist/index.es183.js +17 -86
  176. package/dist/index.es183.js.map +1 -1
  177. package/dist/index.es184.js +69 -222
  178. package/dist/index.es184.js.map +1 -1
  179. package/dist/index.es185.js +242 -23
  180. package/dist/index.es185.js.map +1 -1
  181. package/dist/index.es186.js +23 -5
  182. package/dist/index.es186.js.map +1 -1
  183. package/dist/index.es187.js +6 -4
  184. package/dist/index.es187.js.map +1 -1
  185. package/dist/index.es188.js +4 -18
  186. package/dist/index.es188.js.map +1 -1
  187. package/dist/index.es189.js +16 -6
  188. package/dist/index.es189.js.map +1 -1
  189. package/dist/index.es19.js +119 -15
  190. package/dist/index.es19.js.map +1 -1
  191. package/dist/index.es190.js +7 -141
  192. package/dist/index.es190.js.map +1 -1
  193. package/dist/index.es191.js +142 -2
  194. package/dist/index.es191.js.map +1 -1
  195. package/dist/index.es192.js +2 -32
  196. package/dist/index.es192.js.map +1 -1
  197. package/dist/index.es193.js +31 -5
  198. package/dist/index.es193.js.map +1 -1
  199. package/dist/index.es194.js +5 -105
  200. package/dist/index.es194.js.map +1 -1
  201. package/dist/index.es195.js +106 -13
  202. package/dist/index.es195.js.map +1 -1
  203. package/dist/index.es196.js +12 -17
  204. package/dist/index.es196.js.map +1 -1
  205. package/dist/index.es197.js +15 -28
  206. package/dist/index.es197.js.map +1 -1
  207. package/dist/index.es198.js +30 -3
  208. package/dist/index.es198.js.map +1 -1
  209. package/dist/index.es199.js +3 -4
  210. package/dist/index.es199.js.map +1 -1
  211. package/dist/index.es2.js +24 -16
  212. package/dist/index.es2.js.map +1 -1
  213. package/dist/index.es20.js +17 -68
  214. package/dist/index.es20.js.map +1 -1
  215. package/dist/index.es200.js +5 -5
  216. package/dist/index.es200.js.map +1 -1
  217. package/dist/index.es201.js +4 -36
  218. package/dist/index.es201.js.map +1 -1
  219. package/dist/index.es202.js +36 -7
  220. package/dist/index.es202.js.map +1 -1
  221. package/dist/index.es203.js +7 -5
  222. package/dist/index.es203.js.map +1 -1
  223. package/dist/index.es204.js +5 -6
  224. package/dist/index.es204.js.map +1 -1
  225. package/dist/index.es205.js +6 -41
  226. package/dist/index.es205.js.map +1 -1
  227. package/dist/index.es206.js +41 -12
  228. package/dist/index.es206.js.map +1 -1
  229. package/dist/index.es207.js +11 -240
  230. package/dist/index.es207.js.map +1 -1
  231. package/dist/index.es208.js +239 -48
  232. package/dist/index.es208.js.map +1 -1
  233. package/dist/index.es209.js +49 -33
  234. package/dist/index.es209.js.map +1 -1
  235. package/dist/index.es21.js +3 -3
  236. package/dist/index.es21.js.map +1 -1
  237. package/dist/index.es210.js +32 -10
  238. package/dist/index.es210.js.map +1 -1
  239. package/dist/index.es211.js +12 -7
  240. package/dist/index.es211.js.map +1 -1
  241. package/dist/index.es212.js +7 -6
  242. package/dist/index.es212.js.map +1 -1
  243. package/dist/index.es213.js +6 -64
  244. package/dist/index.es213.js.map +1 -1
  245. package/dist/index.es214.js +60 -36
  246. package/dist/index.es214.js.map +1 -1
  247. package/dist/index.es215.js +39 -30
  248. package/dist/index.es215.js.map +1 -1
  249. package/dist/index.es216.js +30 -60
  250. package/dist/index.es216.js.map +1 -1
  251. package/dist/index.es217.js +60 -13
  252. package/dist/index.es217.js.map +1 -1
  253. package/dist/index.es218.js +9 -17
  254. package/dist/index.es218.js.map +1 -1
  255. package/dist/index.es219.js +23 -5
  256. package/dist/index.es219.js.map +1 -1
  257. package/dist/index.es22.js +1 -1
  258. package/dist/index.es220.js +4 -16
  259. package/dist/index.es220.js.map +1 -1
  260. package/dist/index.es221.js +14 -30
  261. package/dist/index.es221.js.map +1 -1
  262. package/dist/index.es222.js +32 -4
  263. package/dist/index.es222.js.map +1 -1
  264. package/dist/index.es223.js +4 -4
  265. package/dist/index.es223.js.map +1 -1
  266. package/dist/index.es224.js +5 -5
  267. package/dist/index.es224.js.map +1 -1
  268. package/dist/index.es225.js +5 -8
  269. package/dist/index.es225.js.map +1 -1
  270. package/dist/index.es226.js +6 -90
  271. package/dist/index.es226.js.map +1 -1
  272. package/dist/index.es227.js +90 -16
  273. package/dist/index.es227.js.map +1 -1
  274. package/dist/index.es228.js +17 -761
  275. package/dist/index.es228.js.map +1 -1
  276. package/dist/index.es229.js +762 -66
  277. package/dist/index.es229.js.map +1 -1
  278. package/dist/index.es230.js +66 -174
  279. package/dist/index.es230.js.map +1 -1
  280. package/dist/index.es231.js +169 -33
  281. package/dist/index.es231.js.map +1 -1
  282. package/dist/index.es232.js +37 -136
  283. package/dist/index.es232.js.map +1 -1
  284. package/dist/index.es233.js +136 -92
  285. package/dist/index.es233.js.map +1 -1
  286. package/dist/index.es234.js +92 -32
  287. package/dist/index.es234.js.map +1 -1
  288. package/dist/index.es235.js +32 -284
  289. package/dist/index.es235.js.map +1 -1
  290. package/dist/index.es236.js +284 -25
  291. package/dist/index.es236.js.map +1 -1
  292. package/dist/index.es237.js +22 -20
  293. package/dist/index.es237.js.map +1 -1
  294. package/dist/index.es238.js +22 -13
  295. package/dist/index.es238.js.map +1 -1
  296. package/dist/index.es239.js +12 -12
  297. package/dist/index.es239.js.map +1 -1
  298. package/dist/index.es24.js +103 -305
  299. package/dist/index.es24.js.map +1 -1
  300. package/dist/index.es240.js +13 -24
  301. package/dist/index.es240.js.map +1 -1
  302. package/dist/index.es241.js +22 -42
  303. package/dist/index.es241.js.map +1 -1
  304. package/dist/index.es242.js +45 -11
  305. package/dist/index.es242.js.map +1 -1
  306. package/dist/index.es243.js +10 -10
  307. package/dist/index.es243.js.map +1 -1
  308. package/dist/index.es244.js +10 -10
  309. package/dist/index.es244.js.map +1 -1
  310. package/dist/index.es245.js +11 -14
  311. package/dist/index.es245.js.map +1 -1
  312. package/dist/index.es246.js +14 -11
  313. package/dist/index.es246.js.map +1 -1
  314. package/dist/index.es247.js +11 -11
  315. package/dist/index.es247.js.map +1 -1
  316. package/dist/index.es248.js +10 -10
  317. package/dist/index.es248.js.map +1 -1
  318. package/dist/index.es249.js +11 -15
  319. package/dist/index.es249.js.map +1 -1
  320. package/dist/index.es25.js +68 -121
  321. package/dist/index.es25.js.map +1 -1
  322. package/dist/index.es250.js +15 -11
  323. package/dist/index.es250.js.map +1 -1
  324. package/dist/index.es251.js +10 -10
  325. package/dist/index.es251.js.map +1 -1
  326. package/dist/index.es252.js +11 -11
  327. package/dist/index.es252.js.map +1 -1
  328. package/dist/index.es253.js +10 -10
  329. package/dist/index.es253.js.map +1 -1
  330. package/dist/index.es254.js +10 -10
  331. package/dist/index.es254.js.map +1 -1
  332. package/dist/index.es255.js +10 -10
  333. package/dist/index.es255.js.map +1 -1
  334. package/dist/index.es256.js +10 -10
  335. package/dist/index.es256.js.map +1 -1
  336. package/dist/index.es257.js +10 -10
  337. package/dist/index.es257.js.map +1 -1
  338. package/dist/index.es258.js +11 -56
  339. package/dist/index.es258.js.map +1 -1
  340. package/dist/index.es259.js +53 -46
  341. package/dist/index.es259.js.map +1 -1
  342. package/dist/index.es26.js +305 -5
  343. package/dist/index.es26.js.map +1 -1
  344. package/dist/index.es260.js +42 -112
  345. package/dist/index.es260.js.map +1 -1
  346. package/dist/index.es261.js +87 -352
  347. package/dist/index.es261.js.map +1 -1
  348. package/dist/index.es262.js +381 -15
  349. package/dist/index.es262.js.map +1 -1
  350. package/dist/index.es263.js +17 -10
  351. package/dist/index.es263.js.map +1 -1
  352. package/dist/index.es264.js +10 -30
  353. package/dist/index.es264.js.map +1 -1
  354. package/dist/index.es265.js +17 -17
  355. package/dist/index.es265.js.map +1 -1
  356. package/dist/index.es266.js +25 -56
  357. package/dist/index.es266.js.map +1 -1
  358. package/dist/index.es267.js +59 -14
  359. package/dist/index.es267.js.map +1 -1
  360. package/dist/index.es268.js +14 -74
  361. package/dist/index.es268.js.map +1 -1
  362. package/dist/index.es269.js +77 -11
  363. package/dist/index.es269.js.map +1 -1
  364. package/dist/index.es270.js +10 -10
  365. package/dist/index.es270.js.map +1 -1
  366. package/dist/index.es271.js +11 -15
  367. package/dist/index.es271.js.map +1 -1
  368. package/dist/index.es272.js +14 -51
  369. package/dist/index.es272.js.map +1 -1
  370. package/dist/index.es273.js +44 -158
  371. package/dist/index.es273.js.map +1 -1
  372. package/dist/index.es274.js +167 -2
  373. package/dist/index.es274.js.map +1 -1
  374. package/dist/index.es275.js +2 -11
  375. package/dist/index.es275.js.map +1 -1
  376. package/dist/index.es276.js +9 -18
  377. package/dist/index.es276.js.map +1 -1
  378. package/dist/index.es277.js +17 -36
  379. package/dist/index.es277.js.map +1 -1
  380. package/dist/index.es278.js +42 -0
  381. package/dist/index.es278.js.map +1 -0
  382. package/dist/index.es28.js +7 -7
  383. package/dist/index.es29.js +1 -1
  384. package/dist/index.es32.js +4 -4
  385. package/dist/index.es33.js +1191 -13
  386. package/dist/index.es33.js.map +1 -1
  387. package/dist/index.es34.js +6 -117
  388. package/dist/index.es34.js.map +1 -1
  389. package/dist/index.es35.js +8 -70
  390. package/dist/index.es35.js.map +1 -1
  391. package/dist/index.es36.js +148 -19
  392. package/dist/index.es36.js.map +1 -1
  393. package/dist/index.es37.js +112 -255
  394. package/dist/index.es37.js.map +1 -1
  395. package/dist/index.es38.js +68 -40
  396. package/dist/index.es38.js.map +1 -1
  397. package/dist/index.es39.js +17 -214
  398. package/dist/index.es39.js.map +1 -1
  399. package/dist/index.es40.js +247 -53
  400. package/dist/index.es40.js.map +1 -1
  401. package/dist/index.es41.js +24 -123
  402. package/dist/index.es41.js.map +1 -1
  403. package/dist/index.es42.js +205 -14
  404. package/dist/index.es42.js.map +1 -1
  405. package/dist/index.es43.js +58 -221
  406. package/dist/index.es43.js.map +1 -1
  407. package/dist/index.es44.js +140 -7
  408. package/dist/index.es44.js.map +1 -1
  409. package/dist/index.es45.js +17 -1185
  410. package/dist/index.es45.js.map +1 -1
  411. package/dist/index.es46.js +229 -6
  412. package/dist/index.es46.js.map +1 -1
  413. package/dist/index.es47.js +15 -146
  414. package/dist/index.es47.js.map +1 -1
  415. package/dist/index.es48.js +6 -8
  416. package/dist/index.es48.js.map +1 -1
  417. package/dist/index.es49.js +84 -87
  418. package/dist/index.es49.js.map +1 -1
  419. package/dist/index.es50.js +7 -3
  420. package/dist/index.es50.js.map +1 -1
  421. package/dist/index.es51.js +14 -35
  422. package/dist/index.es51.js.map +1 -1
  423. package/dist/index.es52.js +7 -71
  424. package/dist/index.es52.js.map +1 -1
  425. package/dist/index.es53.js +89 -33
  426. package/dist/index.es53.js.map +1 -1
  427. package/dist/index.es54.js +3 -305
  428. package/dist/index.es54.js.map +1 -1
  429. package/dist/index.es55.js +36 -9
  430. package/dist/index.es55.js.map +1 -1
  431. package/dist/index.es56.js +64 -83
  432. package/dist/index.es56.js.map +1 -1
  433. package/dist/index.es57.js +36 -6
  434. package/dist/index.es57.js.map +1 -1
  435. package/dist/index.es58.js +303 -12
  436. package/dist/index.es58.js.map +1 -1
  437. package/dist/index.es59.js +9 -143
  438. package/dist/index.es59.js.map +1 -1
  439. package/dist/index.es60.js +5 -299
  440. package/dist/index.es60.js.map +1 -1
  441. package/dist/index.es61.js +158 -61
  442. package/dist/index.es61.js.map +1 -1
  443. package/dist/index.es62.js +658 -199
  444. package/dist/index.es62.js.map +1 -1
  445. package/dist/index.es63.js +138 -29
  446. package/dist/index.es63.js.map +1 -1
  447. package/dist/index.es64.js +299 -8
  448. package/dist/index.es64.js.map +1 -1
  449. package/dist/index.es65.js +65 -11
  450. package/dist/index.es65.js.map +1 -1
  451. package/dist/index.es66.js +201 -175
  452. package/dist/index.es66.js.map +1 -1
  453. package/dist/index.es67.js +33 -23
  454. package/dist/index.es67.js.map +1 -1
  455. package/dist/index.es68.js +8 -1399
  456. package/dist/index.es68.js.map +1 -1
  457. package/dist/index.es69.js +12 -9
  458. package/dist/index.es69.js.map +1 -1
  459. package/dist/index.es70.js +187 -8
  460. package/dist/index.es70.js.map +1 -1
  461. package/dist/index.es71.js +24 -6
  462. package/dist/index.es71.js.map +1 -1
  463. package/dist/index.es72.js +1384 -147
  464. package/dist/index.es72.js.map +1 -1
  465. package/dist/index.es73.js +9 -672
  466. package/dist/index.es73.js.map +1 -1
  467. package/dist/index.es74.js +8 -12
  468. package/dist/index.es74.js.map +1 -1
  469. package/dist/index.es75.js +35 -38
  470. package/dist/index.es75.js.map +1 -1
  471. package/dist/index.es76.js +5 -34
  472. package/dist/index.es76.js.map +1 -1
  473. package/dist/index.es77.js +64 -223
  474. package/dist/index.es77.js.map +1 -1
  475. package/dist/index.es78.js +36 -29
  476. package/dist/index.es78.js.map +1 -1
  477. package/dist/index.es79.js +11 -74
  478. package/dist/index.es79.js.map +1 -1
  479. package/dist/index.es80.js +37 -73
  480. package/dist/index.es80.js.map +1 -1
  481. package/dist/index.es81.js +32 -50
  482. package/dist/index.es81.js.map +1 -1
  483. package/dist/index.es82.js +228 -26
  484. package/dist/index.es82.js.map +1 -1
  485. package/dist/index.es83.js +6 -19
  486. package/dist/index.es83.js.map +1 -1
  487. package/dist/index.es84.js +72 -54
  488. package/dist/index.es84.js.map +1 -1
  489. package/dist/index.es85.js +76 -13
  490. package/dist/index.es85.js.map +1 -1
  491. package/dist/index.es86.js +47 -132
  492. package/dist/index.es86.js.map +1 -1
  493. package/dist/index.es87.js +29 -20
  494. package/dist/index.es87.js.map +1 -1
  495. package/dist/index.es88.js +37 -176
  496. package/dist/index.es88.js.map +1 -1
  497. package/dist/index.es89.js +49 -233
  498. package/dist/index.es89.js.map +1 -1
  499. package/dist/index.es90.js +13 -355
  500. package/dist/index.es90.js.map +1 -1
  501. package/dist/index.es91.js +128 -128
  502. package/dist/index.es91.js.map +1 -1
  503. package/dist/index.es92.js +21 -70
  504. package/dist/index.es92.js.map +1 -1
  505. package/dist/index.es93.js +179 -34
  506. package/dist/index.es93.js.map +1 -1
  507. package/dist/index.es94.js +230 -26
  508. package/dist/index.es94.js.map +1 -1
  509. package/dist/index.es95.js +346 -157
  510. package/dist/index.es95.js.map +1 -1
  511. package/dist/index.es96.js +129 -195
  512. package/dist/index.es96.js.map +1 -1
  513. package/dist/index.es97.js +70 -14
  514. package/dist/index.es97.js.map +1 -1
  515. package/dist/index.es98.js +35 -28
  516. package/dist/index.es98.js.map +1 -1
  517. package/dist/index.es99.js +34 -31
  518. package/dist/index.es99.js.map +1 -1
  519. package/dist/styles.css +1 -1
  520. package/package.json +8 -11
@@ -1,447 +1,283 @@
1
- import { __export } from "./index.es48.js";
2
- import { getRuntimeEnvironment } from "./index.es129.js";
3
- import { BaseCallbackHandler } from "./index.es130.js";
4
- import { convertToDottedOrderFormat, RunTree } from "./index.es112.js";
5
- var base_exports = {};
6
- __export(base_exports, {
7
- BaseTracer: () => BaseTracer,
8
- isBaseTracer: () => isBaseTracer
1
+ import { __export } from "./index.es52.js";
2
+ import { _deepClone, PatchError, unescapePathComponent, isInteger, hasUndefined } from "./index.es140.js";
3
+ var core_exports = {};
4
+ __export(core_exports, {
5
+ JsonPatchError: () => JsonPatchError,
6
+ _areEquals: () => _areEquals,
7
+ applyOperation: () => applyOperation,
8
+ applyPatch: () => applyPatch,
9
+ applyReducer: () => applyReducer,
10
+ deepClone: () => deepClone,
11
+ getValueByPointer: () => getValueByPointer,
12
+ validate: () => validate,
13
+ validator: () => validator
9
14
  });
10
- const convertRunTreeToRun = (runTree) => {
11
- if (!runTree) return void 0;
12
- runTree.events = runTree.events ?? [];
13
- runTree.child_runs = runTree.child_runs ?? [];
14
- return runTree;
15
- };
16
- function convertRunToRunTree(run, parentRun) {
17
- if (!run) return void 0;
18
- return new RunTree({
19
- ...run,
20
- start_time: run._serialized_start_time ?? run.start_time,
21
- parent_run: convertRunToRunTree(parentRun),
22
- child_runs: run.child_runs.map((r) => convertRunToRunTree(r)).filter((r) => r !== void 0),
23
- extra: {
24
- ...run.extra,
25
- runtime: getRuntimeEnvironment()
26
- },
27
- tracingEnabled: false
28
- });
29
- }
30
- function _coerceToDict(value, defaultKey) {
31
- return value && !Array.isArray(value) && typeof value === "object" ? value : { [defaultKey]: value };
15
+ const JsonPatchError = PatchError;
16
+ const deepClone = _deepClone;
17
+ function isDangerousKey(key) {
18
+ return Object.getOwnPropertyNames(Object.prototype).includes(key);
32
19
  }
33
- function isBaseTracer(x) {
34
- return typeof x._addRunToRunMap === "function";
35
- }
36
- var BaseTracer = class extends BaseCallbackHandler {
37
- /** @deprecated Use `runTreeMap` instead. */
38
- runMap = /* @__PURE__ */ new Map();
39
- runTreeMap = /* @__PURE__ */ new Map();
40
- usesRunTreeMap = false;
41
- constructor(_fields) {
42
- super(...arguments);
43
- }
44
- copy() {
45
- return this;
46
- }
47
- getRunById(runId) {
48
- if (runId === void 0) return void 0;
49
- return this.usesRunTreeMap ? convertRunTreeToRun(this.runTreeMap.get(runId)) : this.runMap.get(runId);
50
- }
51
- stringifyError(error) {
52
- if (error instanceof Error) return error.message + (error?.stack ? `
53
-
54
- ${error.stack}` : "");
55
- if (typeof error === "string") return error;
56
- return `${error}`;
57
- }
58
- _addChildRun(parentRun, childRun) {
59
- parentRun.child_runs.push(childRun);
60
- }
61
- _addRunToRunMap(run) {
62
- const { dottedOrder: currentDottedOrder, microsecondPrecisionDatestring } = convertToDottedOrderFormat(new Date(run.start_time).getTime(), run.id, run.execution_order);
63
- const storedRun = { ...run };
64
- const parentRun = this.getRunById(storedRun.parent_run_id);
65
- if (storedRun.parent_run_id !== void 0) if (parentRun) {
66
- this._addChildRun(parentRun, storedRun);
67
- parentRun.child_execution_order = Math.max(parentRun.child_execution_order, storedRun.child_execution_order);
68
- storedRun.trace_id = parentRun.trace_id;
69
- if (parentRun.dotted_order !== void 0) {
70
- storedRun.dotted_order = [parentRun.dotted_order, currentDottedOrder].join(".");
71
- storedRun._serialized_start_time = microsecondPrecisionDatestring;
72
- }
73
- } else storedRun.parent_run_id = void 0;
74
- else {
75
- storedRun.trace_id = storedRun.id;
76
- storedRun.dotted_order = currentDottedOrder;
77
- storedRun._serialized_start_time = microsecondPrecisionDatestring;
78
- }
79
- if (this.usesRunTreeMap) {
80
- const runTree = convertRunToRunTree(storedRun, parentRun);
81
- if (runTree !== void 0) this.runTreeMap.set(storedRun.id, runTree);
82
- } else this.runMap.set(storedRun.id, storedRun);
83
- return storedRun;
84
- }
85
- async _endTrace(run) {
86
- const parentRun = run.parent_run_id !== void 0 && this.getRunById(run.parent_run_id);
87
- if (parentRun) parentRun.child_execution_order = Math.max(parentRun.child_execution_order, run.child_execution_order);
88
- else await this.persistRun(run);
89
- await this.onRunUpdate?.(run);
90
- if (this.usesRunTreeMap) this.runTreeMap.delete(run.id);
91
- else this.runMap.delete(run.id);
92
- }
93
- _getExecutionOrder(parentRunId) {
94
- const parentRun = parentRunId !== void 0 && this.getRunById(parentRunId);
95
- if (!parentRun) return 1;
96
- return parentRun.child_execution_order + 1;
97
- }
98
- /**
99
- * Create and add a run to the run map for LLM start events.
100
- * This must sometimes be done synchronously to avoid race conditions
101
- * when callbacks are backgrounded, so we expose it as a separate method here.
102
- */
103
- _createRunForLLMStart(llm, prompts, runId, parentRunId, extraParams, tags, metadata, name) {
104
- const execution_order = this._getExecutionOrder(parentRunId);
105
- const start_time = Date.now();
106
- const finalExtraParams = metadata ? {
107
- ...extraParams,
108
- metadata
109
- } : extraParams;
110
- const run = {
111
- id: runId,
112
- name: name ?? llm.id[llm.id.length - 1],
113
- parent_run_id: parentRunId,
114
- start_time,
115
- serialized: llm,
116
- events: [{
117
- name: "start",
118
- time: new Date(start_time).toISOString()
119
- }],
120
- inputs: { prompts },
121
- execution_order,
122
- child_runs: [],
123
- child_execution_order: execution_order,
124
- run_type: "llm",
125
- extra: finalExtraParams ?? {},
126
- tags: tags || []
20
+ const objOps = {
21
+ add: function(obj, key, document) {
22
+ if (isDangerousKey(key)) throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` prop is banned for security reasons");
23
+ obj[key] = this.value;
24
+ return { newDocument: document };
25
+ },
26
+ remove: function(obj, key, document) {
27
+ if (isDangerousKey(key)) throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` prop is banned for security reasons");
28
+ var removed = obj[key];
29
+ delete obj[key];
30
+ return {
31
+ newDocument: document,
32
+ removed
127
33
  };
128
- return this._addRunToRunMap(run);
129
- }
130
- async handleLLMStart(llm, prompts, runId, parentRunId, extraParams, tags, metadata, name) {
131
- const run = this.getRunById(runId) ?? this._createRunForLLMStart(llm, prompts, runId, parentRunId, extraParams, tags, metadata, name);
132
- await this.onRunCreate?.(run);
133
- await this.onLLMStart?.(run);
134
- return run;
135
- }
136
- /**
137
- * Create and add a run to the run map for chat model start events.
138
- * This must sometimes be done synchronously to avoid race conditions
139
- * when callbacks are backgrounded, so we expose it as a separate method here.
140
- */
141
- _createRunForChatModelStart(llm, messages, runId, parentRunId, extraParams, tags, metadata, name) {
142
- const execution_order = this._getExecutionOrder(parentRunId);
143
- const start_time = Date.now();
144
- const finalExtraParams = metadata ? {
145
- ...extraParams,
146
- metadata
147
- } : extraParams;
148
- const run = {
149
- id: runId,
150
- name: name ?? llm.id[llm.id.length - 1],
151
- parent_run_id: parentRunId,
152
- start_time,
153
- serialized: llm,
154
- events: [{
155
- name: "start",
156
- time: new Date(start_time).toISOString()
157
- }],
158
- inputs: { messages },
159
- execution_order,
160
- child_runs: [],
161
- child_execution_order: execution_order,
162
- run_type: "llm",
163
- extra: finalExtraParams ?? {},
164
- tags: tags || []
34
+ },
35
+ replace: function(obj, key, document) {
36
+ if (isDangerousKey(key)) throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` prop is banned for security reasons");
37
+ var removed = obj[key];
38
+ obj[key] = this.value;
39
+ return {
40
+ newDocument: document,
41
+ removed
165
42
  };
166
- return this._addRunToRunMap(run);
167
- }
168
- async handleChatModelStart(llm, messages, runId, parentRunId, extraParams, tags, metadata, name) {
169
- const run = this.getRunById(runId) ?? this._createRunForChatModelStart(llm, messages, runId, parentRunId, extraParams, tags, metadata, name);
170
- await this.onRunCreate?.(run);
171
- await this.onLLMStart?.(run);
172
- return run;
173
- }
174
- async handleLLMEnd(output, runId, _parentRunId, _tags, extraParams) {
175
- const run = this.getRunById(runId);
176
- if (!run || run?.run_type !== "llm") throw new Error("No LLM run to end.");
177
- run.end_time = Date.now();
178
- run.outputs = output;
179
- run.events.push({
180
- name: "end",
181
- time: new Date(run.end_time).toISOString()
43
+ },
44
+ move: function(obj, key, document) {
45
+ let removed = getValueByPointer(document, this.path);
46
+ if (removed) removed = _deepClone(removed);
47
+ const originalValue = applyOperation(document, {
48
+ op: "remove",
49
+ path: this.from
50
+ }).removed;
51
+ applyOperation(document, {
52
+ op: "add",
53
+ path: this.path,
54
+ value: originalValue
182
55
  });
183
- run.extra = {
184
- ...run.extra,
185
- ...extraParams
56
+ return {
57
+ newDocument: document,
58
+ removed
186
59
  };
187
- await this.onLLMEnd?.(run);
188
- await this._endTrace(run);
189
- return run;
190
- }
191
- async handleLLMError(error, runId, _parentRunId, _tags, extraParams) {
192
- const run = this.getRunById(runId);
193
- if (!run || run?.run_type !== "llm") throw new Error("No LLM run to end.");
194
- run.end_time = Date.now();
195
- run.error = this.stringifyError(error);
196
- run.events.push({
197
- name: "error",
198
- time: new Date(run.end_time).toISOString()
60
+ },
61
+ copy: function(obj, key, document) {
62
+ const valueToCopy = getValueByPointer(document, this.from);
63
+ applyOperation(document, {
64
+ op: "add",
65
+ path: this.path,
66
+ value: _deepClone(valueToCopy)
199
67
  });
200
- run.extra = {
201
- ...run.extra,
202
- ...extraParams
68
+ return { newDocument: document };
69
+ },
70
+ test: function(obj, key, document) {
71
+ return {
72
+ newDocument: document,
73
+ test: _areEquals(obj[key], this.value)
203
74
  };
204
- await this.onLLMError?.(run);
205
- await this._endTrace(run);
206
- return run;
75
+ },
76
+ _get: function(obj, key, document) {
77
+ this.value = obj[key];
78
+ return { newDocument: document };
207
79
  }
208
- /**
209
- * Create and add a run to the run map for chain start events.
210
- * This must sometimes be done synchronously to avoid race conditions
211
- * when callbacks are backgrounded, so we expose it as a separate method here.
212
- */
213
- _createRunForChainStart(chain, inputs, runId, parentRunId, tags, metadata, runType, name, extra) {
214
- const execution_order = this._getExecutionOrder(parentRunId);
215
- const start_time = Date.now();
216
- const run = {
217
- id: runId,
218
- name: name ?? chain.id[chain.id.length - 1],
219
- parent_run_id: parentRunId,
220
- start_time,
221
- serialized: chain,
222
- events: [{
223
- name: "start",
224
- time: new Date(start_time).toISOString()
225
- }],
226
- inputs,
227
- execution_order,
228
- child_execution_order: execution_order,
229
- run_type: runType ?? "chain",
230
- child_runs: [],
231
- extra: metadata ? {
232
- ...extra,
233
- metadata
234
- } : { ...extra },
235
- tags: tags || []
80
+ };
81
+ var arrOps = {
82
+ add: function(arr, i, document) {
83
+ if (isInteger(i)) arr.splice(i, 0, this.value);
84
+ else arr[i] = this.value;
85
+ return {
86
+ newDocument: document,
87
+ index: i
236
88
  };
237
- return this._addRunToRunMap(run);
238
- }
239
- async handleChainStart(chain, inputs, runId, parentRunId, tags, metadata, runType, name) {
240
- const run = this.getRunById(runId) ?? this._createRunForChainStart(chain, inputs, runId, parentRunId, tags, metadata, runType, name);
241
- await this.onRunCreate?.(run);
242
- await this.onChainStart?.(run);
243
- return run;
244
- }
245
- async handleChainEnd(outputs, runId, _parentRunId, _tags, kwargs) {
246
- const run = this.getRunById(runId);
247
- if (!run) throw new Error("No chain run to end.");
248
- run.end_time = Date.now();
249
- run.outputs = _coerceToDict(outputs, "output");
250
- run.events.push({
251
- name: "end",
252
- time: new Date(run.end_time).toISOString()
253
- });
254
- if (kwargs?.inputs !== void 0) run.inputs = _coerceToDict(kwargs.inputs, "input");
255
- await this.onChainEnd?.(run);
256
- await this._endTrace(run);
257
- return run;
258
- }
259
- async handleChainError(error, runId, _parentRunId, _tags, kwargs) {
260
- const run = this.getRunById(runId);
261
- if (!run) throw new Error("No chain run to end.");
262
- run.end_time = Date.now();
263
- run.error = this.stringifyError(error);
264
- run.events.push({
265
- name: "error",
266
- time: new Date(run.end_time).toISOString()
267
- });
268
- if (kwargs?.inputs !== void 0) run.inputs = _coerceToDict(kwargs.inputs, "input");
269
- await this.onChainError?.(run);
270
- await this._endTrace(run);
271
- return run;
272
- }
273
- /**
274
- * Create and add a run to the run map for tool start events.
275
- * This must sometimes be done synchronously to avoid race conditions
276
- * when callbacks are backgrounded, so we expose it as a separate method here.
277
- */
278
- _createRunForToolStart(tool, input, runId, parentRunId, tags, metadata, name) {
279
- const execution_order = this._getExecutionOrder(parentRunId);
280
- const start_time = Date.now();
281
- const run = {
282
- id: runId,
283
- name: name ?? tool.id[tool.id.length - 1],
284
- parent_run_id: parentRunId,
285
- start_time,
286
- serialized: tool,
287
- events: [{
288
- name: "start",
289
- time: new Date(start_time).toISOString()
290
- }],
291
- inputs: { input },
292
- execution_order,
293
- child_execution_order: execution_order,
294
- run_type: "tool",
295
- child_runs: [],
296
- extra: metadata ? { metadata } : {},
297
- tags: tags || []
89
+ },
90
+ remove: function(arr, i, document) {
91
+ var removedList = arr.splice(i, 1);
92
+ return {
93
+ newDocument: document,
94
+ removed: removedList[0]
298
95
  };
299
- return this._addRunToRunMap(run);
300
- }
301
- async handleToolStart(tool, input, runId, parentRunId, tags, metadata, name) {
302
- const run = this.getRunById(runId) ?? this._createRunForToolStart(tool, input, runId, parentRunId, tags, metadata, name);
303
- await this.onRunCreate?.(run);
304
- await this.onToolStart?.(run);
305
- return run;
306
- }
307
- async handleToolEnd(output, runId) {
308
- const run = this.getRunById(runId);
309
- if (!run || run?.run_type !== "tool") throw new Error("No tool run to end");
310
- run.end_time = Date.now();
311
- run.outputs = { output };
312
- run.events.push({
313
- name: "end",
314
- time: new Date(run.end_time).toISOString()
315
- });
316
- await this.onToolEnd?.(run);
317
- await this._endTrace(run);
318
- return run;
319
- }
320
- async handleToolError(error, runId) {
321
- const run = this.getRunById(runId);
322
- if (!run || run?.run_type !== "tool") throw new Error("No tool run to end");
323
- run.end_time = Date.now();
324
- run.error = this.stringifyError(error);
325
- run.events.push({
326
- name: "error",
327
- time: new Date(run.end_time).toISOString()
328
- });
329
- await this.onToolError?.(run);
330
- await this._endTrace(run);
331
- return run;
332
- }
333
- async handleAgentAction(action, runId) {
334
- const run = this.getRunById(runId);
335
- if (!run || run?.run_type !== "chain") return;
336
- const agentRun = run;
337
- agentRun.actions = agentRun.actions || [];
338
- agentRun.actions.push(action);
339
- agentRun.events.push({
340
- name: "agent_action",
341
- time: (/* @__PURE__ */ new Date()).toISOString(),
342
- kwargs: { action }
343
- });
344
- await this.onAgentAction?.(run);
345
- }
346
- async handleAgentEnd(action, runId) {
347
- const run = this.getRunById(runId);
348
- if (!run || run?.run_type !== "chain") return;
349
- run.events.push({
350
- name: "agent_end",
351
- time: (/* @__PURE__ */ new Date()).toISOString(),
352
- kwargs: { action }
353
- });
354
- await this.onAgentEnd?.(run);
355
- }
356
- /**
357
- * Create and add a run to the run map for retriever start events.
358
- * This must sometimes be done synchronously to avoid race conditions
359
- * when callbacks are backgrounded, so we expose it as a separate method here.
360
- */
361
- _createRunForRetrieverStart(retriever, query, runId, parentRunId, tags, metadata, name) {
362
- const execution_order = this._getExecutionOrder(parentRunId);
363
- const start_time = Date.now();
364
- const run = {
365
- id: runId,
366
- name: name ?? retriever.id[retriever.id.length - 1],
367
- parent_run_id: parentRunId,
368
- start_time,
369
- serialized: retriever,
370
- events: [{
371
- name: "start",
372
- time: new Date(start_time).toISOString()
373
- }],
374
- inputs: { query },
375
- execution_order,
376
- child_execution_order: execution_order,
377
- run_type: "retriever",
378
- child_runs: [],
379
- extra: metadata ? { metadata } : {},
380
- tags: tags || []
96
+ },
97
+ replace: function(arr, i, document) {
98
+ var removed = arr[i];
99
+ arr[i] = this.value;
100
+ return {
101
+ newDocument: document,
102
+ removed
381
103
  };
382
- return this._addRunToRunMap(run);
104
+ },
105
+ move: objOps.move,
106
+ copy: objOps.copy,
107
+ test: objOps.test,
108
+ _get: objOps._get
109
+ };
110
+ function getValueByPointer(document, pointer) {
111
+ if (pointer == "") return document;
112
+ var getOriginalDestination = {
113
+ op: "_get",
114
+ path: pointer
115
+ };
116
+ applyOperation(document, getOriginalDestination);
117
+ return getOriginalDestination.value;
118
+ }
119
+ function applyOperation(document, operation, validateOperation = false, mutateDocument = true, banPrototypeModifications = true, index = 0) {
120
+ if (validateOperation) if (typeof validateOperation == "function") validateOperation(operation, 0, document, operation.path);
121
+ else validator(operation, 0);
122
+ if (operation.path === "") {
123
+ let returnValue = { newDocument: document };
124
+ if (operation.op === "add") {
125
+ returnValue.newDocument = operation.value;
126
+ return returnValue;
127
+ } else if (operation.op === "replace") {
128
+ returnValue.newDocument = operation.value;
129
+ returnValue.removed = document;
130
+ return returnValue;
131
+ } else if (operation.op === "move" || operation.op === "copy") {
132
+ returnValue.newDocument = getValueByPointer(document, operation.from);
133
+ if (operation.op === "move") returnValue.removed = document;
134
+ return returnValue;
135
+ } else if (operation.op === "test") {
136
+ returnValue.test = _areEquals(document, operation.value);
137
+ if (returnValue.test === false) throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document);
138
+ returnValue.newDocument = document;
139
+ return returnValue;
140
+ } else if (operation.op === "remove") {
141
+ returnValue.removed = document;
142
+ returnValue.newDocument = null;
143
+ return returnValue;
144
+ } else if (operation.op === "_get") {
145
+ operation.value = document;
146
+ return returnValue;
147
+ } else if (validateOperation) throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation, document);
148
+ else return returnValue;
149
+ } else {
150
+ if (!mutateDocument) document = _deepClone(document);
151
+ const path = operation.path || "";
152
+ const keys = path.split("/");
153
+ let obj = document;
154
+ let t = 1;
155
+ let len = keys.length;
156
+ let existingPathFragment = void 0;
157
+ let key;
158
+ let validateFunction;
159
+ if (typeof validateOperation == "function") validateFunction = validateOperation;
160
+ else validateFunction = validator;
161
+ while (true) {
162
+ key = keys[t];
163
+ if (key && key.indexOf("~") != -1) key = unescapePathComponent(key);
164
+ if (banPrototypeModifications && (key == "__proto__" || key == "prototype" && t > 0 && keys[t - 1] == "constructor")) throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");
165
+ if (validateOperation) {
166
+ if (existingPathFragment === void 0) {
167
+ if (obj[key] === void 0) existingPathFragment = keys.slice(0, t).join("/");
168
+ else if (t == len - 1) existingPathFragment = operation.path;
169
+ if (existingPathFragment !== void 0) validateFunction(operation, 0, document, existingPathFragment);
170
+ }
171
+ }
172
+ t++;
173
+ if (Array.isArray(obj)) {
174
+ if (key === "-") key = obj.length;
175
+ else if (validateOperation && !isInteger(key)) throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document);
176
+ else if (isInteger(key)) key = ~~key;
177
+ if (t >= len) {
178
+ if (validateOperation && operation.op === "add" && key > obj.length) throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation, document);
179
+ const returnValue = arrOps[operation.op].call(operation, obj, key, document);
180
+ if (returnValue.test === false) throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document);
181
+ return returnValue;
182
+ }
183
+ } else if (t >= len) {
184
+ const returnValue = objOps[operation.op].call(operation, obj, key, document);
185
+ if (returnValue.test === false) throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document);
186
+ return returnValue;
187
+ }
188
+ obj = obj[key];
189
+ if (validateOperation && t < len && (!obj || typeof obj !== "object")) throw new JsonPatchError("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", index, operation, document);
190
+ }
383
191
  }
384
- async handleRetrieverStart(retriever, query, runId, parentRunId, tags, metadata, name) {
385
- const run = this.getRunById(runId) ?? this._createRunForRetrieverStart(retriever, query, runId, parentRunId, tags, metadata, name);
386
- await this.onRunCreate?.(run);
387
- await this.onRetrieverStart?.(run);
388
- return run;
192
+ }
193
+ function applyPatch(document, patch, validateOperation, mutateDocument = true, banPrototypeModifications = true) {
194
+ if (validateOperation) {
195
+ if (!Array.isArray(patch)) throw new JsonPatchError("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
389
196
  }
390
- async handleRetrieverEnd(documents, runId) {
391
- const run = this.getRunById(runId);
392
- if (!run || run?.run_type !== "retriever") throw new Error("No retriever run to end");
393
- run.end_time = Date.now();
394
- run.outputs = { documents };
395
- run.events.push({
396
- name: "end",
397
- time: new Date(run.end_time).toISOString()
398
- });
399
- await this.onRetrieverEnd?.(run);
400
- await this._endTrace(run);
401
- return run;
197
+ if (!mutateDocument) document = _deepClone(document);
198
+ const results = new Array(patch.length);
199
+ for (let i = 0, length = patch.length; i < length; i++) {
200
+ results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);
201
+ document = results[i].newDocument;
402
202
  }
403
- async handleRetrieverError(error, runId) {
404
- const run = this.getRunById(runId);
405
- if (!run || run?.run_type !== "retriever") throw new Error("No retriever run to end");
406
- run.end_time = Date.now();
407
- run.error = this.stringifyError(error);
408
- run.events.push({
409
- name: "error",
410
- time: new Date(run.end_time).toISOString()
411
- });
412
- await this.onRetrieverError?.(run);
413
- await this._endTrace(run);
414
- return run;
203
+ results.newDocument = document;
204
+ return results;
205
+ }
206
+ function applyReducer(document, operation, index) {
207
+ const operationResult = applyOperation(document, operation);
208
+ if (operationResult.test === false) throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document);
209
+ return operationResult.newDocument;
210
+ }
211
+ function validator(operation, index, document, existingPathFragment) {
212
+ if (typeof operation !== "object" || operation === null || Array.isArray(operation)) throw new JsonPatchError("Operation is not an object", "OPERATION_NOT_AN_OBJECT", index, operation, document);
213
+ else if (!objOps[operation.op]) throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation, document);
214
+ else if (typeof operation.path !== "string") throw new JsonPatchError("Operation `path` property is not a string", "OPERATION_PATH_INVALID", index, operation, document);
215
+ else if (operation.path.indexOf("/") !== 0 && operation.path.length > 0) throw new JsonPatchError('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", index, operation, document);
216
+ else if ((operation.op === "move" || operation.op === "copy") && typeof operation.from !== "string") throw new JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", index, operation, document);
217
+ else if ((operation.op === "add" || operation.op === "replace" || operation.op === "test") && operation.value === void 0) throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", index, operation, document);
218
+ else if ((operation.op === "add" || operation.op === "replace" || operation.op === "test") && hasUndefined(operation.value)) throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", index, operation, document);
219
+ else if (document) {
220
+ if (operation.op == "add") {
221
+ var pathLen = operation.path.split("/").length;
222
+ var existingPathLen = existingPathFragment.split("/").length;
223
+ if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) throw new JsonPatchError("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", index, operation, document);
224
+ } else if (operation.op === "replace" || operation.op === "remove" || operation.op === "_get") {
225
+ if (operation.path !== existingPathFragment) throw new JsonPatchError("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", index, operation, document);
226
+ } else if (operation.op === "move" || operation.op === "copy") {
227
+ var existingValue = {
228
+ op: "_get",
229
+ path: operation.from,
230
+ value: void 0
231
+ };
232
+ var error = validate([existingValue], document);
233
+ if (error && error.name === "OPERATION_PATH_UNRESOLVABLE") throw new JsonPatchError("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", index, operation, document);
234
+ }
415
235
  }
416
- async handleText(text, runId) {
417
- const run = this.getRunById(runId);
418
- if (!run || run?.run_type !== "chain") return;
419
- run.events.push({
420
- name: "text",
421
- time: (/* @__PURE__ */ new Date()).toISOString(),
422
- kwargs: { text }
423
- });
424
- await this.onText?.(run);
236
+ }
237
+ function validate(sequence, document, externalValidator) {
238
+ try {
239
+ if (!Array.isArray(sequence)) throw new JsonPatchError("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
240
+ if (document) applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);
241
+ else {
242
+ externalValidator = externalValidator || validator;
243
+ for (var i = 0; i < sequence.length; i++) externalValidator(sequence[i], i, document, void 0);
244
+ }
245
+ } catch (e) {
246
+ if (e instanceof JsonPatchError) return e;
247
+ else throw e;
425
248
  }
426
- async handleLLMNewToken(token, idx, runId, _parentRunId, _tags, fields) {
427
- const run = this.getRunById(runId);
428
- if (!run || run?.run_type !== "llm") throw new Error(`Invalid "runId" provided to "handleLLMNewToken" callback.`);
429
- run.events.push({
430
- name: "new_token",
431
- time: (/* @__PURE__ */ new Date()).toISOString(),
432
- kwargs: {
433
- token,
434
- idx,
435
- chunk: fields?.chunk
436
- }
437
- });
438
- await this.onLLMNewToken?.(run, token, { chunk: fields?.chunk });
439
- return run;
249
+ }
250
+ function _areEquals(a, b) {
251
+ if (a === b) return true;
252
+ if (a && b && typeof a == "object" && typeof b == "object") {
253
+ var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;
254
+ if (arrA && arrB) {
255
+ length = a.length;
256
+ if (length != b.length) return false;
257
+ for (i = length; i-- !== 0; ) if (!_areEquals(a[i], b[i])) return false;
258
+ return true;
259
+ }
260
+ if (arrA != arrB) return false;
261
+ var keys = Object.keys(a);
262
+ length = keys.length;
263
+ if (length !== Object.keys(b).length) return false;
264
+ for (i = length; i-- !== 0; ) if (!b.hasOwnProperty(keys[i])) return false;
265
+ for (i = length; i-- !== 0; ) {
266
+ key = keys[i];
267
+ if (!_areEquals(a[key], b[key])) return false;
268
+ }
269
+ return true;
440
270
  }
441
- };
271
+ return a !== a && b !== b;
272
+ }
442
273
  export {
443
- BaseTracer,
444
- base_exports,
445
- isBaseTracer
274
+ _areEquals,
275
+ applyOperation,
276
+ applyPatch,
277
+ applyReducer,
278
+ core_exports,
279
+ getValueByPointer,
280
+ validate,
281
+ validator
446
282
  };
447
283
  //# sourceMappingURL=index.es115.js.map