beeai-framework 0.1.3 → 0.1.5

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 (451) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/amazon-bedrock/backend/chat.cjs.map +1 -1
  3. package/dist/adapters/amazon-bedrock/backend/chat.d.cts +1 -1
  4. package/dist/adapters/amazon-bedrock/backend/chat.d.ts +1 -1
  5. package/dist/adapters/amazon-bedrock/backend/chat.js.map +1 -1
  6. package/dist/adapters/amazon-bedrock/backend/client.cjs.map +1 -1
  7. package/dist/adapters/amazon-bedrock/backend/client.js.map +1 -1
  8. package/dist/adapters/amazon-bedrock/backend/embedding.cjs.map +1 -1
  9. package/dist/adapters/amazon-bedrock/backend/embedding.d.cts +1 -1
  10. package/dist/adapters/amazon-bedrock/backend/embedding.d.ts +1 -1
  11. package/dist/adapters/amazon-bedrock/backend/embedding.js.map +1 -1
  12. package/dist/adapters/anthropic/backend/chat.cjs.map +1 -1
  13. package/dist/adapters/anthropic/backend/chat.d.cts +1 -1
  14. package/dist/adapters/anthropic/backend/chat.d.ts +1 -1
  15. package/dist/adapters/anthropic/backend/chat.js.map +1 -1
  16. package/dist/adapters/anthropic/backend/client.cjs.map +1 -1
  17. package/dist/adapters/anthropic/backend/client.js.map +1 -1
  18. package/dist/adapters/anthropic/backend/embedding.cjs.map +1 -1
  19. package/dist/adapters/anthropic/backend/embedding.d.cts +1 -1
  20. package/dist/adapters/anthropic/backend/embedding.d.ts +1 -1
  21. package/dist/adapters/anthropic/backend/embedding.js.map +1 -1
  22. package/dist/adapters/azure-openai/backend/chat.cjs.map +1 -1
  23. package/dist/adapters/azure-openai/backend/chat.d.cts +2 -2
  24. package/dist/adapters/azure-openai/backend/chat.d.ts +2 -2
  25. package/dist/adapters/azure-openai/backend/chat.js.map +1 -1
  26. package/dist/adapters/azure-openai/backend/client.cjs.map +1 -1
  27. package/dist/adapters/azure-openai/backend/client.js.map +1 -1
  28. package/dist/adapters/azure-openai/backend/embedding.cjs.map +1 -1
  29. package/dist/adapters/azure-openai/backend/embedding.d.cts +1 -1
  30. package/dist/adapters/azure-openai/backend/embedding.d.ts +1 -1
  31. package/dist/adapters/azure-openai/backend/embedding.js.map +1 -1
  32. package/dist/adapters/dummy/backend/chat.cjs.map +1 -1
  33. package/dist/adapters/dummy/backend/chat.d.cts +1 -1
  34. package/dist/adapters/dummy/backend/chat.d.ts +1 -1
  35. package/dist/adapters/dummy/backend/chat.js.map +1 -1
  36. package/dist/adapters/dummy/backend/embedding.cjs.map +1 -1
  37. package/dist/adapters/dummy/backend/embedding.d.cts +1 -1
  38. package/dist/adapters/dummy/backend/embedding.d.ts +1 -1
  39. package/dist/adapters/dummy/backend/embedding.js.map +1 -1
  40. package/dist/adapters/google-vertex/backend/chat.cjs.map +1 -1
  41. package/dist/adapters/google-vertex/backend/chat.d.cts +1 -1
  42. package/dist/adapters/google-vertex/backend/chat.d.ts +1 -1
  43. package/dist/adapters/google-vertex/backend/chat.js.map +1 -1
  44. package/dist/adapters/google-vertex/backend/client.cjs.map +1 -1
  45. package/dist/adapters/google-vertex/backend/client.js.map +1 -1
  46. package/dist/adapters/google-vertex/backend/embedding.cjs.map +1 -1
  47. package/dist/adapters/google-vertex/backend/embedding.d.cts +1 -1
  48. package/dist/adapters/google-vertex/backend/embedding.d.ts +1 -1
  49. package/dist/adapters/google-vertex/backend/embedding.js.map +1 -1
  50. package/dist/adapters/groq/backend/chat.cjs.map +1 -1
  51. package/dist/adapters/groq/backend/chat.d.cts +1 -1
  52. package/dist/adapters/groq/backend/chat.d.ts +1 -1
  53. package/dist/adapters/groq/backend/chat.js.map +1 -1
  54. package/dist/adapters/groq/backend/client.cjs.map +1 -1
  55. package/dist/adapters/groq/backend/client.js.map +1 -1
  56. package/dist/adapters/groq/backend/embedding.cjs.map +1 -1
  57. package/dist/adapters/groq/backend/embedding.d.cts +1 -1
  58. package/dist/adapters/groq/backend/embedding.d.ts +1 -1
  59. package/dist/adapters/groq/backend/embedding.js.map +1 -1
  60. package/dist/adapters/langchain/backend/chat.cjs.map +1 -1
  61. package/dist/adapters/langchain/backend/chat.d.cts +1 -1
  62. package/dist/adapters/langchain/backend/chat.d.ts +1 -1
  63. package/dist/adapters/langchain/backend/chat.js.map +1 -1
  64. package/dist/adapters/langchain/backend/embedding.cjs.map +1 -1
  65. package/dist/adapters/langchain/backend/embedding.d.cts +1 -1
  66. package/dist/adapters/langchain/backend/embedding.d.ts +1 -1
  67. package/dist/adapters/langchain/backend/embedding.js.map +1 -1
  68. package/dist/adapters/langchain/tools.cjs.map +1 -1
  69. package/dist/adapters/langchain/tools.d.cts +1 -1
  70. package/dist/adapters/langchain/tools.d.ts +1 -1
  71. package/dist/adapters/langchain/tools.js.map +1 -1
  72. package/dist/adapters/ollama/backend/chat.cjs.map +1 -1
  73. package/dist/adapters/ollama/backend/chat.d.cts +1 -1
  74. package/dist/adapters/ollama/backend/chat.d.ts +1 -1
  75. package/dist/adapters/ollama/backend/chat.js.map +1 -1
  76. package/dist/adapters/ollama/backend/client.cjs.map +1 -1
  77. package/dist/adapters/ollama/backend/client.js.map +1 -1
  78. package/dist/adapters/ollama/backend/embedding.cjs.map +1 -1
  79. package/dist/adapters/ollama/backend/embedding.d.cts +1 -1
  80. package/dist/adapters/ollama/backend/embedding.d.ts +1 -1
  81. package/dist/adapters/ollama/backend/embedding.js.map +1 -1
  82. package/dist/adapters/openai/backend/chat.cjs.map +1 -1
  83. package/dist/adapters/openai/backend/chat.d.cts +1 -1
  84. package/dist/adapters/openai/backend/chat.d.ts +1 -1
  85. package/dist/adapters/openai/backend/chat.js.map +1 -1
  86. package/dist/adapters/openai/backend/client.cjs.map +1 -1
  87. package/dist/adapters/openai/backend/client.js.map +1 -1
  88. package/dist/adapters/openai/backend/embedding.cjs.map +1 -1
  89. package/dist/adapters/openai/backend/embedding.d.cts +2 -2
  90. package/dist/adapters/openai/backend/embedding.d.ts +2 -2
  91. package/dist/adapters/openai/backend/embedding.js.map +1 -1
  92. package/dist/adapters/vercel/backend/chat.cjs +2 -2
  93. package/dist/adapters/vercel/backend/chat.cjs.map +1 -1
  94. package/dist/adapters/vercel/backend/chat.d.cts +1 -1
  95. package/dist/adapters/vercel/backend/chat.d.ts +1 -1
  96. package/dist/adapters/vercel/backend/chat.js +2 -2
  97. package/dist/adapters/vercel/backend/chat.js.map +1 -1
  98. package/dist/adapters/vercel/backend/embedding.cjs.map +1 -1
  99. package/dist/adapters/vercel/backend/embedding.d.cts +5 -5
  100. package/dist/adapters/vercel/backend/embedding.d.ts +5 -5
  101. package/dist/adapters/vercel/backend/embedding.js.map +1 -1
  102. package/dist/adapters/watsonx/backend/chat.cjs.map +1 -1
  103. package/dist/adapters/watsonx/backend/chat.d.cts +1 -1
  104. package/dist/adapters/watsonx/backend/chat.d.ts +1 -1
  105. package/dist/adapters/watsonx/backend/chat.js.map +1 -1
  106. package/dist/adapters/watsonx/backend/client.cjs.map +1 -1
  107. package/dist/adapters/watsonx/backend/client.js.map +1 -1
  108. package/dist/adapters/watsonx/backend/embedding.cjs.map +1 -1
  109. package/dist/adapters/watsonx/backend/embedding.d.cts +1 -1
  110. package/dist/adapters/watsonx/backend/embedding.d.ts +1 -1
  111. package/dist/adapters/watsonx/backend/embedding.js.map +1 -1
  112. package/dist/{agent-D9gpIPf2.d.ts → agent-DNfflu8t.d.ts} +4 -4
  113. package/dist/{agent-xmwFrFrh.d.cts → agent-wkCuP7e1.d.cts} +4 -4
  114. package/dist/agents/base.cjs +1 -1
  115. package/dist/agents/base.cjs.map +1 -1
  116. package/dist/agents/base.d.cts +2 -2
  117. package/dist/agents/base.d.ts +2 -2
  118. package/dist/agents/base.js +1 -1
  119. package/dist/agents/base.js.map +1 -1
  120. package/dist/agents/bee/agent.cjs.map +1 -1
  121. package/dist/agents/bee/agent.d.cts +3 -3
  122. package/dist/agents/bee/agent.d.ts +3 -3
  123. package/dist/agents/bee/agent.js.map +1 -1
  124. package/dist/agents/bee/prompts.cjs.map +1 -1
  125. package/dist/agents/bee/prompts.js.map +1 -1
  126. package/dist/agents/bee/runners/base.cjs.map +1 -1
  127. package/dist/agents/bee/runners/base.d.cts +3 -3
  128. package/dist/agents/bee/runners/base.d.ts +3 -3
  129. package/dist/agents/bee/runners/base.js.map +1 -1
  130. package/dist/agents/bee/runners/deep-think/prompts.cjs.map +1 -1
  131. package/dist/agents/bee/runners/deep-think/prompts.js.map +1 -1
  132. package/dist/agents/bee/runners/deep-think/runner.cjs +11 -11
  133. package/dist/agents/bee/runners/deep-think/runner.cjs.map +1 -1
  134. package/dist/agents/bee/runners/deep-think/runner.d.cts +3 -3
  135. package/dist/agents/bee/runners/deep-think/runner.d.ts +3 -3
  136. package/dist/agents/bee/runners/deep-think/runner.js +2 -2
  137. package/dist/agents/bee/runners/deep-think/runner.js.map +1 -1
  138. package/dist/agents/bee/runners/default/runner.cjs.map +1 -1
  139. package/dist/agents/bee/runners/default/runner.d.cts +3 -3
  140. package/dist/agents/bee/runners/default/runner.d.ts +3 -3
  141. package/dist/agents/bee/runners/default/runner.js +1 -1
  142. package/dist/agents/bee/runners/default/runner.js.map +1 -1
  143. package/dist/agents/bee/runners/default/runner.spec.cjs.map +1 -1
  144. package/dist/agents/bee/runners/default/runner.spec.js.map +1 -1
  145. package/dist/agents/bee/runners/granite/prompts.cjs.map +1 -1
  146. package/dist/agents/bee/runners/granite/prompts.js.map +1 -1
  147. package/dist/agents/bee/runners/granite/runner.cjs +11 -11
  148. package/dist/agents/bee/runners/granite/runner.cjs.map +1 -1
  149. package/dist/agents/bee/runners/granite/runner.d.cts +3 -3
  150. package/dist/agents/bee/runners/granite/runner.d.ts +3 -3
  151. package/dist/agents/bee/runners/granite/runner.js +2 -2
  152. package/dist/agents/bee/runners/granite/runner.js.map +1 -1
  153. package/dist/agents/bee/types.d.cts +1 -1
  154. package/dist/agents/bee/types.d.ts +1 -1
  155. package/dist/agents/experimental/replan/agent.cjs.map +1 -1
  156. package/dist/agents/experimental/replan/agent.d.cts +2 -2
  157. package/dist/agents/experimental/replan/agent.d.ts +2 -2
  158. package/dist/agents/experimental/replan/agent.js.map +1 -1
  159. package/dist/agents/experimental/replan/prompts.cjs.map +1 -1
  160. package/dist/agents/experimental/replan/prompts.d.cts +1 -1
  161. package/dist/agents/experimental/replan/prompts.d.ts +1 -1
  162. package/dist/agents/experimental/replan/prompts.js.map +1 -1
  163. package/dist/agents/experimental/streamlit/agent.cjs.map +1 -1
  164. package/dist/agents/experimental/streamlit/agent.d.cts +2 -2
  165. package/dist/agents/experimental/streamlit/agent.d.ts +2 -2
  166. package/dist/agents/experimental/streamlit/agent.js.map +1 -1
  167. package/dist/agents/experimental/streamlit/prompts.cjs.map +1 -1
  168. package/dist/agents/experimental/streamlit/prompts.js.map +1 -1
  169. package/dist/agents/types.d.cts +2 -2
  170. package/dist/agents/types.d.ts +2 -2
  171. package/dist/backend/backend.cjs.map +1 -1
  172. package/dist/backend/backend.d.cts +1 -1
  173. package/dist/backend/backend.d.ts +1 -1
  174. package/dist/backend/backend.js.map +1 -1
  175. package/dist/backend/chat.cjs +1 -1
  176. package/dist/backend/chat.cjs.map +1 -1
  177. package/dist/backend/chat.d.cts +1 -1
  178. package/dist/backend/chat.d.ts +1 -1
  179. package/dist/backend/chat.js +1 -1
  180. package/dist/backend/chat.js.map +1 -1
  181. package/dist/backend/client.cjs.map +1 -1
  182. package/dist/backend/client.js.map +1 -1
  183. package/dist/backend/constants.cjs.map +1 -1
  184. package/dist/backend/constants.js.map +1 -1
  185. package/dist/backend/core.d.cts +1 -1
  186. package/dist/backend/core.d.ts +1 -1
  187. package/dist/backend/embedding.cjs +1 -1
  188. package/dist/backend/embedding.cjs.map +1 -1
  189. package/dist/backend/embedding.d.cts +1 -1
  190. package/dist/backend/embedding.d.ts +1 -1
  191. package/dist/backend/embedding.js +1 -1
  192. package/dist/backend/embedding.js.map +1 -1
  193. package/dist/backend/errors.cjs.map +1 -1
  194. package/dist/backend/errors.js.map +1 -1
  195. package/dist/backend/message.cjs.map +1 -1
  196. package/dist/backend/message.js.map +1 -1
  197. package/dist/backend/utils.cjs +2 -1
  198. package/dist/backend/utils.cjs.map +1 -1
  199. package/dist/backend/utils.js +2 -1
  200. package/dist/backend/utils.js.map +1 -1
  201. package/dist/{base-daM6fHUP.d.cts → base-Csr9guq2.d.cts} +1 -1
  202. package/dist/{base-mmG-8Pk9.d.ts → base-DHhpWHQm.d.ts} +1 -1
  203. package/dist/cache/base.cjs.map +1 -1
  204. package/dist/cache/base.js.map +1 -1
  205. package/dist/cache/decoratorCache.cjs.map +1 -1
  206. package/dist/cache/decoratorCache.js.map +1 -1
  207. package/dist/cache/fileCache.cjs.map +1 -1
  208. package/dist/cache/fileCache.js.map +1 -1
  209. package/dist/cache/nullCache.cjs.map +1 -1
  210. package/dist/cache/nullCache.js.map +1 -1
  211. package/dist/cache/slidingCache.cjs.map +1 -1
  212. package/dist/cache/slidingCache.js.map +1 -1
  213. package/dist/cache/unconstrainedCache.cjs.map +1 -1
  214. package/dist/cache/unconstrainedCache.js.map +1 -1
  215. package/dist/context.cjs.map +1 -1
  216. package/dist/context.d.cts +1 -1
  217. package/dist/context.d.ts +1 -1
  218. package/dist/context.js.map +1 -1
  219. package/dist/emitter/emitter.cjs.map +1 -1
  220. package/dist/emitter/emitter.d.cts +1 -1
  221. package/dist/emitter/emitter.d.ts +1 -1
  222. package/dist/emitter/emitter.js.map +1 -1
  223. package/dist/emitter/errors.cjs.map +1 -1
  224. package/dist/emitter/errors.js.map +1 -1
  225. package/dist/emitter/types.d.cts +1 -1
  226. package/dist/emitter/types.d.ts +1 -1
  227. package/dist/emitter/utils.cjs.map +1 -1
  228. package/dist/emitter/utils.js.map +1 -1
  229. package/dist/errors.cjs +4 -4
  230. package/dist/errors.cjs.map +1 -1
  231. package/dist/errors.js +4 -4
  232. package/dist/errors.js.map +1 -1
  233. package/dist/index.d.cts +2 -2
  234. package/dist/index.d.ts +2 -2
  235. package/dist/instrumentation/config.cjs.map +1 -1
  236. package/dist/instrumentation/config.js.map +1 -1
  237. package/dist/instrumentation/create-telemetry-middleware.cjs +1 -1
  238. package/dist/instrumentation/create-telemetry-middleware.cjs.map +1 -1
  239. package/dist/instrumentation/create-telemetry-middleware.d.cts +1 -1
  240. package/dist/instrumentation/create-telemetry-middleware.d.ts +1 -1
  241. package/dist/instrumentation/create-telemetry-middleware.js +1 -1
  242. package/dist/instrumentation/create-telemetry-middleware.js.map +1 -1
  243. package/dist/instrumentation/helpers/create-span.cjs.map +1 -1
  244. package/dist/instrumentation/helpers/create-span.js.map +1 -1
  245. package/dist/instrumentation/helpers/get-error-safe.cjs.map +1 -1
  246. package/dist/instrumentation/helpers/get-error-safe.js.map +1 -1
  247. package/dist/instrumentation/helpers/get-serialized-object-safe.cjs.map +1 -1
  248. package/dist/instrumentation/helpers/get-serialized-object-safe.js.map +1 -1
  249. package/dist/instrumentation/helpers/id-name-manager.cjs.map +1 -1
  250. package/dist/instrumentation/helpers/id-name-manager.js.map +1 -1
  251. package/dist/instrumentation/helpers/trace-serializer.cjs.map +1 -1
  252. package/dist/instrumentation/helpers/trace-serializer.js.map +1 -1
  253. package/dist/instrumentation/helpers/utils.cjs.map +1 -1
  254. package/dist/instrumentation/helpers/utils.d.cts +1 -1
  255. package/dist/instrumentation/helpers/utils.d.ts +1 -1
  256. package/dist/instrumentation/helpers/utils.js.map +1 -1
  257. package/dist/instrumentation/logger.cjs.map +1 -1
  258. package/dist/instrumentation/logger.js.map +1 -1
  259. package/dist/instrumentation/tracer.cjs.map +1 -1
  260. package/dist/instrumentation/tracer.js.map +1 -1
  261. package/dist/internals/env.cjs +2 -2
  262. package/dist/internals/env.cjs.map +1 -1
  263. package/dist/internals/env.js +2 -2
  264. package/dist/internals/env.js.map +1 -1
  265. package/dist/internals/fetcher.cjs.map +1 -1
  266. package/dist/internals/fetcher.d.cts +1 -1
  267. package/dist/internals/fetcher.d.ts +1 -1
  268. package/dist/internals/fetcher.js.map +1 -1
  269. package/dist/internals/helpers/array.cjs.map +1 -1
  270. package/dist/internals/helpers/array.js.map +1 -1
  271. package/dist/internals/helpers/cancellation.cjs.map +1 -1
  272. package/dist/internals/helpers/cancellation.js.map +1 -1
  273. package/dist/internals/helpers/counter.cjs.map +1 -1
  274. package/dist/internals/helpers/counter.js.map +1 -1
  275. package/dist/internals/helpers/general.cjs.map +1 -1
  276. package/dist/internals/helpers/general.js.map +1 -1
  277. package/dist/internals/helpers/guards.cjs.map +1 -1
  278. package/dist/internals/helpers/guards.js.map +1 -1
  279. package/dist/internals/helpers/hash.cjs.map +1 -1
  280. package/dist/internals/helpers/hash.js.map +1 -1
  281. package/dist/internals/helpers/map.cjs.map +1 -1
  282. package/dist/internals/helpers/map.js.map +1 -1
  283. package/dist/internals/helpers/math.cjs.map +1 -1
  284. package/dist/internals/helpers/math.js.map +1 -1
  285. package/dist/internals/helpers/number.cjs.map +1 -1
  286. package/dist/internals/helpers/number.js.map +1 -1
  287. package/dist/internals/helpers/object.cjs.map +1 -1
  288. package/dist/internals/helpers/object.js.map +1 -1
  289. package/dist/internals/helpers/paginate.cjs.map +1 -1
  290. package/dist/internals/helpers/paginate.js.map +1 -1
  291. package/dist/internals/helpers/promise.cjs.map +1 -1
  292. package/dist/internals/helpers/promise.js.map +1 -1
  293. package/dist/internals/helpers/prototype.cjs.map +1 -1
  294. package/dist/internals/helpers/prototype.js.map +1 -1
  295. package/dist/internals/helpers/retry.cjs.map +1 -1
  296. package/dist/internals/helpers/retry.js.map +1 -1
  297. package/dist/internals/helpers/retryable.cjs.map +1 -1
  298. package/dist/internals/helpers/retryable.js.map +1 -1
  299. package/dist/internals/helpers/schema.cjs.map +1 -1
  300. package/dist/internals/helpers/schema.d.cts +1 -1
  301. package/dist/internals/helpers/schema.d.ts +1 -1
  302. package/dist/internals/helpers/schema.js.map +1 -1
  303. package/dist/internals/helpers/stream.cjs.map +1 -1
  304. package/dist/internals/helpers/stream.js.map +1 -1
  305. package/dist/internals/helpers/string.cjs.map +1 -1
  306. package/dist/internals/helpers/string.js.map +1 -1
  307. package/dist/internals/helpers/weakRef.cjs.map +1 -1
  308. package/dist/internals/helpers/weakRef.js.map +1 -1
  309. package/dist/internals/serializable.cjs.map +1 -1
  310. package/dist/internals/serializable.js.map +1 -1
  311. package/dist/internals/types.cjs.map +1 -1
  312. package/dist/internals/types.js.map +1 -1
  313. package/dist/logger/logger.cjs.map +1 -1
  314. package/dist/logger/logger.js.map +1 -1
  315. package/dist/logger/pretty.cjs.map +1 -1
  316. package/dist/logger/pretty.js.map +1 -1
  317. package/dist/memory/base.cjs.map +1 -1
  318. package/dist/memory/base.js.map +1 -1
  319. package/dist/memory/slidingMemory.cjs.map +1 -1
  320. package/dist/memory/slidingMemory.js.map +1 -1
  321. package/dist/memory/summarizeMemory.cjs.map +1 -1
  322. package/dist/memory/summarizeMemory.d.cts +1 -1
  323. package/dist/memory/summarizeMemory.d.ts +1 -1
  324. package/dist/memory/summarizeMemory.js.map +1 -1
  325. package/dist/memory/tokenMemory.cjs.map +1 -1
  326. package/dist/memory/tokenMemory.js.map +1 -1
  327. package/dist/memory/unconstrainedMemory.cjs.map +1 -1
  328. package/dist/memory/unconstrainedMemory.js.map +1 -1
  329. package/dist/parsers/errors.cjs.map +1 -1
  330. package/dist/parsers/errors.js.map +1 -1
  331. package/dist/parsers/field.cjs.map +1 -1
  332. package/dist/parsers/field.js.map +1 -1
  333. package/dist/parsers/linePrefix.cjs.map +1 -1
  334. package/dist/parsers/linePrefix.d.cts +1 -1
  335. package/dist/parsers/linePrefix.d.ts +1 -1
  336. package/dist/parsers/linePrefix.js.map +1 -1
  337. package/dist/serializer/error.cjs.map +1 -1
  338. package/dist/serializer/error.js.map +1 -1
  339. package/dist/serializer/serializer.cjs +3 -3
  340. package/dist/serializer/serializer.cjs.map +1 -1
  341. package/dist/serializer/serializer.js +2 -2
  342. package/dist/serializer/serializer.js.map +1 -1
  343. package/dist/serializer/utils.cjs.map +1 -1
  344. package/dist/serializer/utils.js.map +1 -1
  345. package/dist/template.cjs.map +1 -1
  346. package/dist/template.d.cts +1 -1
  347. package/dist/template.d.ts +1 -1
  348. package/dist/template.js.map +1 -1
  349. package/dist/tools/arxiv.cjs.map +1 -1
  350. package/dist/tools/arxiv.d.cts +2 -2
  351. package/dist/tools/arxiv.d.ts +2 -2
  352. package/dist/tools/arxiv.js.map +1 -1
  353. package/dist/tools/base.cjs.map +1 -1
  354. package/dist/tools/base.d.cts +2 -2
  355. package/dist/tools/base.d.ts +2 -2
  356. package/dist/tools/base.js.map +1 -1
  357. package/dist/tools/calculator.cjs.map +1 -1
  358. package/dist/tools/calculator.d.cts +1 -1
  359. package/dist/tools/calculator.d.ts +1 -1
  360. package/dist/tools/calculator.js.map +1 -1
  361. package/dist/tools/custom.cjs.map +1 -1
  362. package/dist/tools/custom.d.cts +1 -1
  363. package/dist/tools/custom.d.ts +1 -1
  364. package/dist/tools/custom.js.map +1 -1
  365. package/dist/tools/database/elasticsearch.cjs.map +1 -1
  366. package/dist/tools/database/elasticsearch.d.cts +1 -1
  367. package/dist/tools/database/elasticsearch.d.ts +1 -1
  368. package/dist/tools/database/elasticsearch.js.map +1 -1
  369. package/dist/tools/database/metadata.cjs.map +1 -1
  370. package/dist/tools/database/metadata.js.map +1 -1
  371. package/dist/tools/database/milvus.cjs.map +1 -1
  372. package/dist/tools/database/milvus.d.cts +1 -1
  373. package/dist/tools/database/milvus.d.ts +1 -1
  374. package/dist/tools/database/milvus.js.map +1 -1
  375. package/dist/tools/database/sql.cjs.map +1 -1
  376. package/dist/tools/database/sql.d.cts +3 -3
  377. package/dist/tools/database/sql.d.ts +3 -3
  378. package/dist/tools/database/sql.js.map +1 -1
  379. package/dist/tools/llm.cjs.map +1 -1
  380. package/dist/tools/llm.d.cts +1 -1
  381. package/dist/tools/llm.d.ts +1 -1
  382. package/dist/tools/llm.js +1 -1
  383. package/dist/tools/llm.js.map +1 -1
  384. package/dist/tools/mcp.cjs.map +1 -1
  385. package/dist/tools/mcp.d.cts +1 -1
  386. package/dist/tools/mcp.d.ts +1 -1
  387. package/dist/tools/mcp.js.map +1 -1
  388. package/dist/tools/openapi.cjs.map +1 -1
  389. package/dist/tools/openapi.d.cts +1 -1
  390. package/dist/tools/openapi.d.ts +1 -1
  391. package/dist/tools/openapi.js +1 -1
  392. package/dist/tools/openapi.js.map +1 -1
  393. package/dist/tools/python/output.cjs.map +1 -1
  394. package/dist/tools/python/output.d.cts +1 -1
  395. package/dist/tools/python/output.d.ts +1 -1
  396. package/dist/tools/python/output.js.map +1 -1
  397. package/dist/tools/python/python.cjs.map +1 -1
  398. package/dist/tools/python/python.d.cts +1 -1
  399. package/dist/tools/python/python.d.ts +1 -1
  400. package/dist/tools/python/python.js.map +1 -1
  401. package/dist/tools/python/storage.cjs.map +1 -1
  402. package/dist/tools/python/storage.js.map +1 -1
  403. package/dist/tools/search/base.cjs.map +1 -1
  404. package/dist/tools/search/base.d.cts +1 -1
  405. package/dist/tools/search/base.d.ts +1 -1
  406. package/dist/tools/search/base.js.map +1 -1
  407. package/dist/tools/search/duckDuckGoSearch.cjs +19 -19
  408. package/dist/tools/search/duckDuckGoSearch.cjs.map +1 -1
  409. package/dist/tools/search/duckDuckGoSearch.d.cts +2 -4
  410. package/dist/tools/search/duckDuckGoSearch.d.ts +2 -4
  411. package/dist/tools/search/duckDuckGoSearch.js +17 -13
  412. package/dist/tools/search/duckDuckGoSearch.js.map +1 -1
  413. package/dist/tools/search/googleSearch.cjs.map +1 -1
  414. package/dist/tools/search/googleSearch.d.cts +1 -1
  415. package/dist/tools/search/googleSearch.d.ts +1 -1
  416. package/dist/tools/search/googleSearch.js.map +1 -1
  417. package/dist/tools/search/searXNGSearch.cjs.map +1 -1
  418. package/dist/tools/search/searXNGSearch.d.cts +1 -1
  419. package/dist/tools/search/searXNGSearch.d.ts +1 -1
  420. package/dist/tools/search/searXNGSearch.js.map +1 -1
  421. package/dist/tools/search/wikipedia.cjs.map +1 -1
  422. package/dist/tools/search/wikipedia.d.cts +1 -1
  423. package/dist/tools/search/wikipedia.d.ts +1 -1
  424. package/dist/tools/search/wikipedia.js.map +1 -1
  425. package/dist/tools/similarity.cjs.map +1 -1
  426. package/dist/tools/similarity.d.cts +2 -2
  427. package/dist/tools/similarity.d.ts +2 -2
  428. package/dist/tools/similarity.js.map +1 -1
  429. package/dist/tools/weather/openMeteo.cjs.map +1 -1
  430. package/dist/tools/weather/openMeteo.d.cts +2 -2
  431. package/dist/tools/weather/openMeteo.d.ts +2 -2
  432. package/dist/tools/weather/openMeteo.js.map +1 -1
  433. package/dist/tools/web/webCrawler.cjs.map +1 -1
  434. package/dist/tools/web/webCrawler.d.cts +2 -2
  435. package/dist/tools/web/webCrawler.d.ts +2 -2
  436. package/dist/tools/web/webCrawler.js.map +1 -1
  437. package/dist/version.cjs +1 -1
  438. package/dist/version.cjs.map +1 -1
  439. package/dist/version.js +1 -1
  440. package/dist/version.js.map +1 -1
  441. package/dist/workflows/agent.cjs.map +1 -1
  442. package/dist/workflows/agent.d.cts +2 -2
  443. package/dist/workflows/agent.d.ts +2 -2
  444. package/dist/workflows/agent.js.map +1 -1
  445. package/dist/workflows/workflow.cjs.map +1 -1
  446. package/dist/workflows/workflow.d.cts +1 -1
  447. package/dist/workflows/workflow.d.ts +1 -1
  448. package/dist/workflows/workflow.js.map +1 -1
  449. package/package.json +28 -20
  450. package/dist/{emitter-C9EN5B0j.d.cts → emitter-BWtGHYn0.d.cts} +1 -1
  451. package/dist/{emitter-BxVxGBbJ.d.ts → emitter-l0W9gC1A.d.ts} +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/instrumentation/helpers/trace-serializer.ts"],"names":["DEFAULT_IGNORE_KEYS","traceSerializer","ignored_keys","mergedIgnoreKeys","Set","body","JSON","stringify","key","value","has","startsWith"],"mappings":";;;;AAgBA,MAAMA,mBAAsB,GAAA;AAAC,EAAA,SAAA;AAAW,EAAA,QAAA;AAAU,EAAA,QAAA;AAAU,EAAA,WAAA;AAAa,EAAA;;AAElE,SAASC,eAAgB,CAAA,EAAEC,YAAe,GAAA,IAAiC,EAAA;AAChF,EAAMC,MAAAA,gBAAAA,uBAAuBC,GAAI,CAAA;AAAIJ,IAAAA,GAAAA,mBAAAA;AAAwBE,IAAAA,GAAAA;AAAa,GAAA,CAAA;AAE1E,EAAA,OAAO,CAACG,IAAAA,KACNC,IAAKC,CAAAA,SAAAA,CACHF,sBACC,CAAA,MAAA;AACC,IAAO,OAAA,CAACG,KAAKC,KAAAA,KAAAA;AAEX,MAAA,IAAIN,iBAAiBO,GAAIF,CAAAA,GAAAA,KAAQA,GAAIG,CAAAA,UAAAA,CAAW,GAAA,CAAM,EAAA;AACpD,QAAA;AACF;AAEA,MAAOF,OAAAA,KAAAA;AACT,KAAA;AACF,GAAA,GAAA,CAAA;AAEN;AAjBgBR,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA","file":"trace-serializer.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_IGNORE_KEYS = [\"emitter\", \"logger\", \"tokens\", \"createdBy\", \"client\"];\n\nexport function traceSerializer({ ignored_keys = [] }: { ignored_keys?: string[] }) {\n const mergedIgnoreKeys = new Set([...DEFAULT_IGNORE_KEYS, ...ignored_keys]);\n\n return (body: object) =>\n JSON.stringify(\n body,\n (() => {\n return (key, value) => {\n // Ignore specific keys, all owned entities and keys starting with underscore\n if (mergedIgnoreKeys.has(key) || key.startsWith(\"_\")) {\n return;\n }\n\n return value;\n };\n })(),\n );\n}\n"]}
1
+ {"version":3,"sources":["trace-serializer.ts"],"names":["DEFAULT_IGNORE_KEYS","traceSerializer","ignored_keys","mergedIgnoreKeys","Set","body","JSON","stringify","key","value","has","startsWith"],"mappings":";;;;AAgBA,MAAMA,mBAAsB,GAAA;AAAC,EAAA,SAAA;AAAW,EAAA,QAAA;AAAU,EAAA,QAAA;AAAU,EAAA,WAAA;AAAa,EAAA;;AAElE,SAASC,eAAgB,CAAA,EAAEC,YAAe,GAAA,IAAiC,EAAA;AAChF,EAAMC,MAAAA,gBAAAA,uBAAuBC,GAAI,CAAA;AAAIJ,IAAAA,GAAAA,mBAAAA;AAAwBE,IAAAA,GAAAA;AAAa,GAAA,CAAA;AAE1E,EAAA,OAAO,CAACG,IAAAA,KACNC,IAAKC,CAAAA,SAAAA,CACHF,sBACC,CAAA,MAAA;AACC,IAAO,OAAA,CAACG,KAAKC,KAAAA,KAAAA;AAEX,MAAA,IAAIN,iBAAiBO,GAAIF,CAAAA,GAAAA,KAAQA,GAAIG,CAAAA,UAAAA,CAAW,GAAA,CAAM,EAAA;AACpD,QAAA;AACF;AAEA,MAAOF,OAAAA,KAAAA;AACT,KAAA;AACF,GAAA,GAAA,CAAA;AAEN;AAjBgBR,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA","file":"trace-serializer.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_IGNORE_KEYS = [\"emitter\", \"logger\", \"tokens\", \"createdBy\", \"client\"];\n\nexport function traceSerializer({ ignored_keys = [] }: { ignored_keys?: string[] }) {\n const mergedIgnoreKeys = new Set([...DEFAULT_IGNORE_KEYS, ...ignored_keys]);\n\n return (body: object) =>\n JSON.stringify(\n body,\n (() => {\n return (key, value) => {\n // Ignore specific keys, all owned entities and keys starting with underscore\n if (mergedIgnoreKeys.has(key) || key.startsWith(\"_\")) {\n return;\n }\n\n return value;\n };\n })(),\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/instrumentation/helpers/trace-serializer.ts"],"names":["DEFAULT_IGNORE_KEYS","traceSerializer","ignored_keys","mergedIgnoreKeys","Set","body","JSON","stringify","key","value","has","startsWith"],"mappings":";;AAgBA,MAAMA,mBAAsB,GAAA;AAAC,EAAA,SAAA;AAAW,EAAA,QAAA;AAAU,EAAA,QAAA;AAAU,EAAA,WAAA;AAAa,EAAA;;AAElE,SAASC,eAAgB,CAAA,EAAEC,YAAe,GAAA,IAAiC,EAAA;AAChF,EAAMC,MAAAA,gBAAAA,uBAAuBC,GAAI,CAAA;AAAIJ,IAAAA,GAAAA,mBAAAA;AAAwBE,IAAAA,GAAAA;AAAa,GAAA,CAAA;AAE1E,EAAA,OAAO,CAACG,IAAAA,KACNC,IAAKC,CAAAA,SAAAA,CACHF,sBACC,CAAA,MAAA;AACC,IAAO,OAAA,CAACG,KAAKC,KAAAA,KAAAA;AAEX,MAAA,IAAIN,iBAAiBO,GAAIF,CAAAA,GAAAA,KAAQA,GAAIG,CAAAA,UAAAA,CAAW,GAAA,CAAM,EAAA;AACpD,QAAA;AACF;AAEA,MAAOF,OAAAA,KAAAA;AACT,KAAA;AACF,GAAA,GAAA,CAAA;AAEN;AAjBgBR,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA","file":"trace-serializer.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_IGNORE_KEYS = [\"emitter\", \"logger\", \"tokens\", \"createdBy\", \"client\"];\n\nexport function traceSerializer({ ignored_keys = [] }: { ignored_keys?: string[] }) {\n const mergedIgnoreKeys = new Set([...DEFAULT_IGNORE_KEYS, ...ignored_keys]);\n\n return (body: object) =>\n JSON.stringify(\n body,\n (() => {\n return (key, value) => {\n // Ignore specific keys, all owned entities and keys starting with underscore\n if (mergedIgnoreKeys.has(key) || key.startsWith(\"_\")) {\n return;\n }\n\n return value;\n };\n })(),\n );\n}\n"]}
1
+ {"version":3,"sources":["trace-serializer.ts"],"names":["DEFAULT_IGNORE_KEYS","traceSerializer","ignored_keys","mergedIgnoreKeys","Set","body","JSON","stringify","key","value","has","startsWith"],"mappings":";;AAgBA,MAAMA,mBAAsB,GAAA;AAAC,EAAA,SAAA;AAAW,EAAA,QAAA;AAAU,EAAA,QAAA;AAAU,EAAA,WAAA;AAAa,EAAA;;AAElE,SAASC,eAAgB,CAAA,EAAEC,YAAe,GAAA,IAAiC,EAAA;AAChF,EAAMC,MAAAA,gBAAAA,uBAAuBC,GAAI,CAAA;AAAIJ,IAAAA,GAAAA,mBAAAA;AAAwBE,IAAAA,GAAAA;AAAa,GAAA,CAAA;AAE1E,EAAA,OAAO,CAACG,IAAAA,KACNC,IAAKC,CAAAA,SAAAA,CACHF,sBACC,CAAA,MAAA;AACC,IAAO,OAAA,CAACG,KAAKC,KAAAA,KAAAA;AAEX,MAAA,IAAIN,iBAAiBO,GAAIF,CAAAA,GAAAA,KAAQA,GAAIG,CAAAA,UAAAA,CAAW,GAAA,CAAM,EAAA;AACpD,QAAA;AACF;AAEA,MAAOF,OAAAA,KAAAA;AACT,KAAA;AACF,GAAA,GAAA,CAAA;AAEN;AAjBgBR,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA","file":"trace-serializer.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_IGNORE_KEYS = [\"emitter\", \"logger\", \"tokens\", \"createdBy\", \"client\"];\n\nexport function traceSerializer({ ignored_keys = [] }: { ignored_keys?: string[] }) {\n const mergedIgnoreKeys = new Set([...DEFAULT_IGNORE_KEYS, ...ignored_keys]);\n\n return (body: object) =>\n JSON.stringify(\n body,\n (() => {\n return (key, value) => {\n // Ignore specific keys, all owned entities and keys starting with underscore\n if (mergedIgnoreKeys.has(key) || key.startsWith(\"_\")) {\n return;\n }\n\n return value;\n };\n })(),\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/instrumentation/helpers/utils.ts"],"names":["assertLLMWithMessagesToPromptFn","instance","Boolean","ChatModel"],"mappings":";;;;;;AAkBO,SAASA,gCAAgCC,QAAgB,EAAA;AAC9D,EAAOC,OAAAA,OAAAA,CAAQD,QAAYA,IAAAA,QAAAA,YAAoBE,kBAAAA,CAAAA;AACjD;AAFgBH,MAAAA,CAAAA,+BAAAA,EAAAA,iCAAAA,CAAAA","file":"utils.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ChatModel } from \"@/backend/chat.js\";\n\nexport function assertLLMWithMessagesToPromptFn(instance: object): instance is ChatModel {\n return Boolean(instance && instance instanceof ChatModel);\n}\n"]}
1
+ {"version":3,"sources":["utils.ts"],"names":["assertLLMWithMessagesToPromptFn","instance","Boolean","ChatModel"],"mappings":";;;;;;AAkBO,SAASA,gCAAgCC,QAAgB,EAAA;AAC9D,EAAOC,OAAAA,OAAAA,CAAQD,QAAYA,IAAAA,QAAAA,YAAoBE,kBAAAA,CAAAA;AACjD;AAFgBH,MAAAA,CAAAA,+BAAAA,EAAAA,iCAAAA,CAAAA","file":"utils.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ChatModel } from \"@/backend/chat.js\";\n\nexport function assertLLMWithMessagesToPromptFn(instance: object): instance is ChatModel {\n return Boolean(instance && instance instanceof ChatModel);\n}\n"]}
@@ -5,7 +5,7 @@ import '../../internals/types.cjs';
5
5
  import '../../internals/helpers/guards.cjs';
6
6
  import 'ai';
7
7
  import '../../context.cjs';
8
- import '../../emitter-C9EN5B0j.cjs';
8
+ import '../../emitter-BWtGHYn0.cjs';
9
9
  import '../../internals/helpers/promise.cjs';
10
10
  import '../../errors.cjs';
11
11
  import 'promise-based-task';
@@ -5,7 +5,7 @@ import '../../internals/types.js';
5
5
  import '../../internals/helpers/guards.js';
6
6
  import 'ai';
7
7
  import '../../context.js';
8
- import '../../emitter-BxVxGBbJ.js';
8
+ import '../../emitter-l0W9gC1A.js';
9
9
  import '../../internals/helpers/promise.js';
10
10
  import '../../errors.js';
11
11
  import 'promise-based-task';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/instrumentation/helpers/utils.ts"],"names":["assertLLMWithMessagesToPromptFn","instance","Boolean","ChatModel"],"mappings":";;;;AAkBO,SAASA,gCAAgCC,QAAgB,EAAA;AAC9D,EAAOC,OAAAA,OAAAA,CAAQD,QAAYA,IAAAA,QAAAA,YAAoBE,SAAAA,CAAAA;AACjD;AAFgBH,MAAAA,CAAAA,+BAAAA,EAAAA,iCAAAA,CAAAA","file":"utils.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ChatModel } from \"@/backend/chat.js\";\n\nexport function assertLLMWithMessagesToPromptFn(instance: object): instance is ChatModel {\n return Boolean(instance && instance instanceof ChatModel);\n}\n"]}
1
+ {"version":3,"sources":["utils.ts"],"names":["assertLLMWithMessagesToPromptFn","instance","Boolean","ChatModel"],"mappings":";;;;AAkBO,SAASA,gCAAgCC,QAAgB,EAAA;AAC9D,EAAOC,OAAAA,OAAAA,CAAQD,QAAYA,IAAAA,QAAAA,YAAoBE,SAAAA,CAAAA;AACjD;AAFgBH,MAAAA,CAAAA,+BAAAA,EAAAA,iCAAAA,CAAAA","file":"utils.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ChatModel } from \"@/backend/chat.js\";\n\nexport function assertLLMWithMessagesToPromptFn(instance: object): instance is ChatModel {\n return Boolean(instance && instance instanceof ChatModel);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/instrumentation/logger.ts"],"names":["instrumentationLogger","Logger","root","child","name","level","LoggerLevel","WARN"],"mappings":";;;;AAkBaA,MAAAA,qBAAAA,GAAwBC,iBAAOC,CAAAA,IAAAA,CAAKC,KAAM,CAAA;EACrDC,IAAM,EAAA,iBAAA;AACNC,EAAAA,KAAAA,EAAOC,sBAAYC,CAAAA;AACrB,CAAA","file":"logger.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger, LoggerLevel } from \"@/logger/logger.js\";\n\nexport const instrumentationLogger = Logger.root.child({\n name: \"instrumentation\",\n level: LoggerLevel.WARN,\n});\n"]}
1
+ {"version":3,"sources":["logger.ts"],"names":["instrumentationLogger","Logger","root","child","name","level","LoggerLevel","WARN"],"mappings":";;;;AAkBaA,MAAAA,qBAAAA,GAAwBC,iBAAOC,CAAAA,IAAAA,CAAKC,KAAM,CAAA;EACrDC,IAAM,EAAA,iBAAA;AACNC,EAAAA,KAAAA,EAAOC,sBAAYC,CAAAA;AACrB,CAAA","file":"logger.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger, LoggerLevel } from \"@/logger/logger.js\";\n\nexport const instrumentationLogger = Logger.root.child({\n name: \"instrumentation\",\n level: LoggerLevel.WARN,\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/instrumentation/logger.ts"],"names":["instrumentationLogger","Logger","root","child","name","level","LoggerLevel","WARN"],"mappings":";;AAkBaA,MAAAA,qBAAAA,GAAwBC,MAAOC,CAAAA,IAAAA,CAAKC,KAAM,CAAA;EACrDC,IAAM,EAAA,iBAAA;AACNC,EAAAA,KAAAA,EAAOC,WAAYC,CAAAA;AACrB,CAAA","file":"logger.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger, LoggerLevel } from \"@/logger/logger.js\";\n\nexport const instrumentationLogger = Logger.root.child({\n name: \"instrumentation\",\n level: LoggerLevel.WARN,\n});\n"]}
1
+ {"version":3,"sources":["logger.ts"],"names":["instrumentationLogger","Logger","root","child","name","level","LoggerLevel","WARN"],"mappings":";;AAkBaA,MAAAA,qBAAAA,GAAwBC,MAAOC,CAAAA,IAAAA,CAAKC,KAAM,CAAA;EACrDC,IAAM,EAAA,iBAAA;AACNC,EAAAA,KAAAA,EAAOC,WAAYC,CAAAA;AACrB,CAAA","file":"logger.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger, LoggerLevel } from \"@/logger/logger.js\";\n\nexport const instrumentationLogger = Logger.root.child({\n name: \"instrumentation\",\n level: LoggerLevel.WARN,\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/instrumentation/tracer.ts"],"names":["tracer","opentelemetry","trace","getTracer","Version","activeTracesMap","Map","buildSpansForParent","spans","parentId","traceId","filter","fwSpan","parent_id","forEach","startActiveSpan","context","span_id","startTime","start_time","attributes","target","name","data","JSON","stringify","ctx","activeSpan","setStatus","status","end","end_time","buildTraceTree","prompt","history","generatedMessage","version","runErrorSpanKey","endTime","source","undefined","response","runErrorSpan","find","span","code","SpanStatusCode","OK"],"mappings":";;;;;;;;;;;AAoBO,MAAMA,MAASC,GAAAA,8BAAAA,CAAcC,KAAMC,CAAAA,SAAAA,CAAU,mBAAmBC,mBAAAA;AAE1DC,MAAAA,eAAAA,uBAAsBC,GAAAA;AAqBnC,SAASC,mBAAoB,CAAA,EAAEC,KAAOC,EAAAA,QAAAA,EAAUC,SAAmC,EAAA;AACjFF,EACGG,KAAAA,CAAAA,MAAAA,CAAO,CAACC,MAAWA,KAAAA,MAAAA,CAAOC,cAAcJ,QAAAA,CAAAA,CACxCK,OAAQ,CAAA,CAACF,MAAAA,KAAAA;AACRZ,IAAOe,MAAAA,CAAAA,eAAAA,CACLH,MAAOI,CAAAA,OAAAA,CAAQC,OACf,EAAA;;AAEEC,MAAAA,SAAAA,EAAWN,MAAOO,CAAAA,UAAAA;;MAElBC,UAAY,EAAA;AACVC,QAAAA,MAAAA,EAAQT,OAAOQ,UAAWC,C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vB,MAAA,GAAIE,qBAAqBK,KAAa,CAAA,IAAA;QAAEC,QAAUjB,EAAAA,IAAAA,CAAKC,UAAUU,gBAAAA;AAAkB,OAAA;AACnF,MAAA,GAAID,OAAW,IAAA;QAAEA,OAASV,EAAAA,IAAAA,CAAKC,UAAUS,OAAAA;AAAS;AACpD;AACF,GAAA,EACA,CAACP,UAAAA,KAAAA;AAEC,IAAMe,MAAAA,YAAAA,GAAelC,MAAMmC,IAAK,CAAA,CAACC,SAASA,IAAKxB,CAAAA,UAAAA,CAAWC,WAAWgB,eAAAA,CAAAA;AACrE,IAAA,IAAIK,YAAc,EAAA;AAChBf,MAAWC,UAAAA,CAAAA,SAAAA,CAAUc,aAAab,MAAM,CAAA;KACnC,MAAA;AACLF,MAAAA,UAAAA,CAAWC,SAAU,CAAA;AAAEiB,QAAAA,IAAAA,EAAMC,4BAAeC,CAAAA;OAAG,CAAA;AACjD;AAGAxC,IAAoB,mBAAA,CAAA;AAAEC,MAAAA,KAAAA;AAAOE,MAAAA,OAAAA;MAASD,QAAU+B,EAAAA,KAAAA;KAAU,CAAA;AAG1Db,IAAAA,UAAAA,CAAWG,IAAIQ,OAAAA,CAAAA;GACjB,CAAA;AAEJ;AA1CgBN,MAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA","file":"tracer.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Version } from \"@/version.js\";\nimport opentelemetry, { SpanStatusCode, TimeInput } from \"@opentelemetry/api\";\nimport { FrameworkSpan, GeneratedResponse } from \"./types.js\";\n\nexport const tracer = opentelemetry.trace.getTracer(\"beeai-framework\", Version);\n\nexport const activeTracesMap = new Map<string, string>();\n\ninterface ComputeTreeProps {\n prompt?: string | null;\n history: GeneratedResponse[] | undefined;\n generatedMessage: GeneratedResponse | undefined;\n spans: FrameworkSpan[];\n traceId: string;\n version: string;\n runErrorSpanKey: string;\n startTime: TimeInput;\n endTime: TimeInput;\n source: string;\n}\n\ninterface BuildSpansForParentProps {\n spans: FrameworkSpan[];\n traceId: string;\n parentId: string | undefined;\n}\n\nfunction buildSpansForParent({ spans, parentId, traceId }: BuildSpansForParentProps) {\n spans\n .filter((fwSpan) => fwSpan.parent_id === parentId)\n .forEach((fwSpan) => {\n tracer.startActiveSpan(\n fwSpan.context.span_id,\n {\n // custom start time\n startTime: fwSpan.start_time,\n // set span important attributes\n attributes: {\n target: fwSpan.attributes.target,\n name: fwSpan.name,\n traceId,\n ...(fwSpan.attributes.data && { data: JSON.stringify(fwSpan.attributes.data) }),\n ...(fwSpan.attributes.ctx && { ctx: JSON.stringify(fwSpan.attributes.ctx) }),\n },\n },\n (activeSpan) => {\n // set status\n activeSpan.setStatus(fwSpan.status);\n\n // set nested spans\n buildSpansForParent({ spans, traceId, parentId: fwSpan.context.span_id });\n\n // finish the span\n activeSpan.end(fwSpan.end_time);\n },\n );\n });\n}\n\nexport function buildTraceTree({\n prompt,\n history,\n generatedMessage,\n spans,\n traceId,\n version,\n runErrorSpanKey,\n startTime,\n endTime,\n source,\n}: ComputeTreeProps) {\n tracer.startActiveSpan(\n `beeai-framework-${source}-${traceId}`,\n {\n // custom start time\n startTime,\n // set main span important attributes\n attributes: {\n traceId,\n version,\n ...(prompt && { prompt }),\n ...(generatedMessage !== undefined && { response: JSON.stringify(generatedMessage) }),\n ...(history && { history: JSON.stringify(history) }),\n },\n },\n (activeSpan) => {\n // set status\n const runErrorSpan = spans.find((span) => span.attributes.target === runErrorSpanKey);\n if (runErrorSpan) {\n activeSpan.setStatus(runErrorSpan.status);\n } else {\n activeSpan.setStatus({ code: SpanStatusCode.OK });\n }\n\n // set nested spans\n buildSpansForParent({ spans, traceId, parentId: undefined });\n\n // finish the main span with custom end time\n activeSpan.end(endTime);\n },\n );\n}\n"]}
1
+ {"version":3,"sources":["tracer.ts"],"names":["tracer","opentelemetry","trace","getTracer","Version","activeTracesMap","Map","buildSpansForParent","spans","parentId","traceId","filter","fwSpan","parent_id","forEach","startActiveSpan","context","span_id","startTime","start_time","attributes","target","name","data","JSON","stringify","ctx","activeSpan","setStatus","status","end","end_time","buildTraceTree","prompt","history","generatedMessage","version","runErrorSpanKey","endTime","source","undefined","response","runErrorSpan","find","span","code","SpanStatusCode","OK"],"mappings":";;;;;;;;;;;AAoBO,MAAMA,MAASC,GAAAA,8BAAAA,CAAcC,KAAMC,CAAAA,SAAAA,CAAU,mBAAmBC,mBAAAA;AAE1DC,MAAAA,eAAAA,uBAAsBC,GAAAA;AAqBnC,SAASC,mBAAoB,CAAA,EAAEC,KAAOC,EAAAA,QAAAA,EAAUC,SAAmC,EAAA;AACjFF,EACGG,KAAAA,CAAAA,MAAAA,CAAO,CAACC,MAAWA,KAAAA,MAAAA,CAAOC,cAAcJ,QAAAA,CAAAA,CACxCK,OAAQ,CAAA,CAACF,MAAAA,KAAAA;AACRZ,IAAOe,MAAAA,CAAAA,eAAAA,CACLH,MAAOI,CAAAA,OAAAA,CAAQC,OACf,EAAA;;AAEEC,MAAAA,SAAAA,EAAWN,MAAOO,CAAAA,UAAAA;;MAElBC,UAAY,EAAA;AACVC,QAAAA,MAAAA,EAAQT,OAAOQ,UAAWC,CAAAA,MAAAA;AAC1BC,QAAAA,IAAAA,EAAMV,MAAOU,CAAAA,IAAAA;AACbZ,QAAAA,OAAAA;QACA,GAAIE,MAAAA,CAAOQ,WAAWG,IAAQ,IAAA;AAAEA,UAAAA,IAAAA,EAAMC,IAAKC,CAAAA,SAAAA,CAAUb,MAAOQ,CAAAA,UAAAA,CAAWG,IAAI;AAAE,SAAA;QAC7E,GAAIX,MAAAA,CA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C,MAAMmC,IAAK,CAAA,CAACC,SAASA,IAAKxB,CAAAA,UAAAA,CAAWC,WAAWgB,eAAAA,CAAAA;AACrE,IAAA,IAAIK,YAAc,EAAA;AAChBf,MAAWC,UAAAA,CAAAA,SAAAA,CAAUc,aAAab,MAAM,CAAA;KACnC,MAAA;AACLF,MAAAA,UAAAA,CAAWC,SAAU,CAAA;AAAEiB,QAAAA,IAAAA,EAAMC,4BAAeC,CAAAA;OAAG,CAAA;AACjD;AAGAxC,IAAoB,mBAAA,CAAA;AAAEC,MAAAA,KAAAA;AAAOE,MAAAA,OAAAA;MAASD,QAAU+B,EAAAA;KAAU,CAAA;AAG1Db,IAAAA,UAAAA,CAAWG,IAAIQ,OAAAA,CAAAA;GACjB,CAAA;AAEJ;AA1CgBN,MAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA","file":"tracer.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Version } from \"@/version.js\";\nimport opentelemetry, { SpanStatusCode, TimeInput } from \"@opentelemetry/api\";\nimport { FrameworkSpan, GeneratedResponse } from \"./types.js\";\n\nexport const tracer = opentelemetry.trace.getTracer(\"beeai-framework\", Version);\n\nexport const activeTracesMap = new Map<string, string>();\n\ninterface ComputeTreeProps {\n prompt?: string | null;\n history: GeneratedResponse[] | undefined;\n generatedMessage: GeneratedResponse | undefined;\n spans: FrameworkSpan[];\n traceId: string;\n version: string;\n runErrorSpanKey: string;\n startTime: TimeInput;\n endTime: TimeInput;\n source: string;\n}\n\ninterface BuildSpansForParentProps {\n spans: FrameworkSpan[];\n traceId: string;\n parentId: string | undefined;\n}\n\nfunction buildSpansForParent({ spans, parentId, traceId }: BuildSpansForParentProps) {\n spans\n .filter((fwSpan) => fwSpan.parent_id === parentId)\n .forEach((fwSpan) => {\n tracer.startActiveSpan(\n fwSpan.context.span_id,\n {\n // custom start time\n startTime: fwSpan.start_time,\n // set span important attributes\n attributes: {\n target: fwSpan.attributes.target,\n name: fwSpan.name,\n traceId,\n ...(fwSpan.attributes.data && { data: JSON.stringify(fwSpan.attributes.data) }),\n ...(fwSpan.attributes.ctx && { ctx: JSON.stringify(fwSpan.attributes.ctx) }),\n },\n },\n (activeSpan) => {\n // set status\n activeSpan.setStatus(fwSpan.status);\n\n // set nested spans\n buildSpansForParent({ spans, traceId, parentId: fwSpan.context.span_id });\n\n // finish the span\n activeSpan.end(fwSpan.end_time);\n },\n );\n });\n}\n\nexport function buildTraceTree({\n prompt,\n history,\n generatedMessage,\n spans,\n traceId,\n version,\n runErrorSpanKey,\n startTime,\n endTime,\n source,\n}: ComputeTreeProps) {\n tracer.startActiveSpan(\n `beeai-framework-${source}-${traceId}`,\n {\n // custom start time\n startTime,\n // set main span important attributes\n attributes: {\n traceId,\n version,\n ...(prompt && { prompt }),\n ...(generatedMessage !== undefined && { response: JSON.stringify(generatedMessage) }),\n ...(history && { history: JSON.stringify(history) }),\n },\n },\n (activeSpan) => {\n // set status\n const runErrorSpan = spans.find((span) => span.attributes.target === runErrorSpanKey);\n if (runErrorSpan) {\n activeSpan.setStatus(runErrorSpan.status);\n } else {\n activeSpan.setStatus({ code: SpanStatusCode.OK });\n }\n\n // set nested spans\n buildSpansForParent({ spans, traceId, parentId: undefined });\n\n // finish the main span with custom end time\n activeSpan.end(endTime);\n },\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/instrumentation/tracer.ts"],"names":["tracer","opentelemetry","trace","getTracer","Version","activeTracesMap","Map","buildSpansForParent","spans","parentId","traceId","filter","fwSpan","parent_id","forEach","startActiveSpan","context","span_id","startTime","start_time","attributes","target","name","data","JSON","stringify","ctx","activeSpan","setStatus","status","end","end_time","buildTraceTree","prompt","history","generatedMessage","version","runErrorSpanKey","endTime","source","undefined","response","runErrorSpan","find","span","code","SpanStatusCode","OK"],"mappings":";;;;;AAoBO,MAAMA,MAASC,GAAAA,aAAAA,CAAcC,KAAMC,CAAAA,SAAAA,CAAU,mBAAmBC,OAAAA;AAE1DC,MAAAA,eAAAA,uBAAsBC,GAAAA;AAqBnC,SAASC,mBAAoB,CAAA,EAAEC,KAAOC,EAAAA,QAAAA,EAAUC,SAAmC,EAAA;AACjFF,EACGG,KAAAA,CAAAA,MAAAA,CAAO,CAACC,MAAWA,KAAAA,MAAAA,CAAOC,cAAcJ,QAAAA,CAAAA,CACxCK,OAAQ,CAAA,CAACF,MAAAA,KAAAA;AACRZ,IAAOe,MAAAA,CAAAA,eAAAA,CACLH,MAAOI,CAAAA,OAAAA,CAAQC,OACf,EAAA;;AAEEC,MAAAA,SAAAA,EAAWN,MAAOO,CAAAA,UAAAA;;MAElBC,UAAY,EAAA;AACVC,QAAAA,MAAAA,EAAQT,OAAOQ,UAAWC,CAAAA,MAAAA;AAC1BC,QAAAA,IAAAA,EAAMV,MAAOU,CAAAA,IAAAA;AACbZ,QAAAA,OAAAA;QACA,GAAIE,MAAAA,CAAOQ,WAAWG,IAAQ,IAAA;AAAEA,UAAAA,IAAAA,EAAMC,IAAKC,CAAAA,SAAAA,CAAUb,MAAOQ,CAAAA,UAAAA,CAAWG,IAAI;AAAE,SAAA;QAC7E,GAAIX,MAAAA,CAAOQ,WAAWM,GAAO,IAAA;AAAEA,UAAAA,GAAAA,EAAKF,IAAKC,CAAAA,SAAAA,CAAUb,MAAOQ,CAAAA,UAAAA,CAAWM,GAAG;AAAE;AAC5E;AACF,KAAA,EACA,CAACC,UAAAA,KAAAA;AAECA,MAAWC,UAAAA,CAAAA,SAAAA,CAAUhB,OAAOiB,MAAM,CAAA;AAGlCtB,MAAoB,mBAAA,CAAA;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AAMC,cAAeC,CAAAA;OAAG,CAAA;AACjD;AAGAxC,IAAoB,mBAAA,CAAA;AAAEC,MAAAA,KAAAA;AAAOE,MAAAA,OAAAA;MAASD,QAAU+B,EAAAA,KAAAA;KAAU,CAAA;AAG1Db,IAAAA,UAAAA,CAAWG,IAAIQ,OAAAA,CAAAA;GACjB,CAAA;AAEJ;AA1CgBN,MAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA","file":"tracer.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Version } from \"@/version.js\";\nimport opentelemetry, { SpanStatusCode, TimeInput } from \"@opentelemetry/api\";\nimport { FrameworkSpan, GeneratedResponse } from \"./types.js\";\n\nexport const tracer = opentelemetry.trace.getTracer(\"beeai-framework\", Version);\n\nexport const activeTracesMap = new Map<string, string>();\n\ninterface ComputeTreeProps {\n prompt?: string | null;\n history: GeneratedResponse[] | undefined;\n generatedMessage: GeneratedResponse | undefined;\n spans: FrameworkSpan[];\n traceId: string;\n version: string;\n runErrorSpanKey: string;\n startTime: TimeInput;\n endTime: TimeInput;\n source: string;\n}\n\ninterface BuildSpansForParentProps {\n spans: FrameworkSpan[];\n traceId: string;\n parentId: string | undefined;\n}\n\nfunction buildSpansForParent({ spans, parentId, traceId }: BuildSpansForParentProps) {\n spans\n .filter((fwSpan) => fwSpan.parent_id === parentId)\n .forEach((fwSpan) => {\n tracer.startActiveSpan(\n fwSpan.context.span_id,\n {\n // custom start time\n startTime: fwSpan.start_time,\n // set span important attributes\n attributes: {\n target: fwSpan.attributes.target,\n name: fwSpan.name,\n traceId,\n ...(fwSpan.attributes.data && { data: JSON.stringify(fwSpan.attributes.data) }),\n ...(fwSpan.attributes.ctx && { ctx: JSON.stringify(fwSpan.attributes.ctx) }),\n },\n },\n (activeSpan) => {\n // set status\n activeSpan.setStatus(fwSpan.status);\n\n // set nested spans\n buildSpansForParent({ spans, traceId, parentId: fwSpan.context.span_id });\n\n // finish the span\n activeSpan.end(fwSpan.end_time);\n },\n );\n });\n}\n\nexport function buildTraceTree({\n prompt,\n history,\n generatedMessage,\n spans,\n traceId,\n version,\n runErrorSpanKey,\n startTime,\n endTime,\n source,\n}: ComputeTreeProps) {\n tracer.startActiveSpan(\n `beeai-framework-${source}-${traceId}`,\n {\n // custom start time\n startTime,\n // set main span important attributes\n attributes: {\n traceId,\n version,\n ...(prompt && { prompt }),\n ...(generatedMessage !== undefined && { response: JSON.stringify(generatedMessage) }),\n ...(history && { history: JSON.stringify(history) }),\n },\n },\n (activeSpan) => {\n // set status\n const runErrorSpan = spans.find((span) => span.attributes.target === runErrorSpanKey);\n if (runErrorSpan) {\n activeSpan.setStatus(runErrorSpan.status);\n } else {\n activeSpan.setStatus({ code: SpanStatusCode.OK });\n }\n\n // set nested spans\n buildSpansForParent({ spans, traceId, parentId: undefined });\n\n // finish the main span with custom end time\n activeSpan.end(endTime);\n },\n );\n}\n"]}
1
+ {"version":3,"sources":["tracer.ts"],"names":["tracer","opentelemetry","trace","getTracer","Version","activeTracesMap","Map","buildSpansForParent","spans","parentId","traceId","filter","fwSpan","parent_id","forEach","startActiveSpan","context","span_id","startTime","start_time","attributes","target","name","data","JSON","stringify","ctx","activeSpan","setStatus","status","end","end_time","buildTraceTree","prompt","history","generatedMessage","version","runErrorSpanKey","endTime","source","undefined","response","runErrorSpan","find","span","code","SpanStatusCode","OK"],"mappings":";;;;;AAoBO,MAAMA,MAASC,GAAAA,aAAAA,CAAcC,KAAMC,CAAAA,SAAAA,CAAU,mBAAmBC,OAAAA;AAE1DC,MAAAA,eAAAA,uBAAs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cesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Version } from \"@/version.js\";\nimport opentelemetry, { SpanStatusCode, TimeInput } from \"@opentelemetry/api\";\nimport { FrameworkSpan, GeneratedResponse } from \"./types.js\";\n\nexport const tracer = opentelemetry.trace.getTracer(\"beeai-framework\", Version);\n\nexport const activeTracesMap = new Map<string, string>();\n\ninterface ComputeTreeProps {\n prompt?: string | null;\n history: GeneratedResponse[] | undefined;\n generatedMessage: GeneratedResponse | undefined;\n spans: FrameworkSpan[];\n traceId: string;\n version: string;\n runErrorSpanKey: string;\n startTime: TimeInput;\n endTime: TimeInput;\n source: string;\n}\n\ninterface BuildSpansForParentProps {\n spans: FrameworkSpan[];\n traceId: string;\n parentId: string | undefined;\n}\n\nfunction buildSpansForParent({ spans, parentId, traceId }: BuildSpansForParentProps) {\n spans\n .filter((fwSpan) => fwSpan.parent_id === parentId)\n .forEach((fwSpan) => {\n tracer.startActiveSpan(\n fwSpan.context.span_id,\n {\n // custom start time\n startTime: fwSpan.start_time,\n // set span important attributes\n attributes: {\n target: fwSpan.attributes.target,\n name: fwSpan.name,\n traceId,\n ...(fwSpan.attributes.data && { data: JSON.stringify(fwSpan.attributes.data) }),\n ...(fwSpan.attributes.ctx && { ctx: JSON.stringify(fwSpan.attributes.ctx) }),\n },\n },\n (activeSpan) => {\n // set status\n activeSpan.setStatus(fwSpan.status);\n\n // set nested spans\n buildSpansForParent({ spans, traceId, parentId: fwSpan.context.span_id });\n\n // finish the span\n activeSpan.end(fwSpan.end_time);\n },\n );\n });\n}\n\nexport function buildTraceTree({\n prompt,\n history,\n generatedMessage,\n spans,\n traceId,\n version,\n runErrorSpanKey,\n startTime,\n endTime,\n source,\n}: ComputeTreeProps) {\n tracer.startActiveSpan(\n `beeai-framework-${source}-${traceId}`,\n {\n // custom start time\n startTime,\n // set main span important attributes\n attributes: {\n traceId,\n version,\n ...(prompt && { prompt }),\n ...(generatedMessage !== undefined && { response: JSON.stringify(generatedMessage) }),\n ...(history && { history: JSON.stringify(history) }),\n },\n },\n (activeSpan) => {\n // set status\n const runErrorSpan = spans.find((span) => span.attributes.target === runErrorSpanKey);\n if (runErrorSpan) {\n activeSpan.setStatus(runErrorSpan.status);\n } else {\n activeSpan.setStatus({ code: SpanStatusCode.OK });\n }\n\n // set nested spans\n buildSpansForParent({ spans, traceId, parentId: undefined });\n\n // finish the main span with custom end time\n activeSpan.end(endTime);\n },\n );\n}\n"]}
@@ -17,9 +17,9 @@ function parseEnv(key, schema, defaultValue) {
17
17
  const result = schema.safeParse(value);
18
18
  if (!result.success) {
19
19
  if (value === void 0) {
20
- throw new errors_cjs.FrameworkError(`Required variable '${key}' is not set!`);
20
+ throw new errors_cjs.FrameworkError(`The required variable '${key}' is not set!`);
21
21
  }
22
- throw new errors_cjs.FrameworkError(`Failed to parse ENV variable (${key})!`, [
22
+ throw new errors_cjs.FrameworkError(`Failed to parse the environment variable (${key})!`, [
23
23
  result.error
24
24
  ]);
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/internals/env.ts"],"names":["getEnv","key","fallback","getProp","process","env","parseEnv","schema","defaultValue","value","result","safeParse","success","undefined","FrameworkError","error","data","asBoolean","z","string","String","trim","toLowerCase","hasEnv"],"mappings":";;;;;;;;AAsBO,SAASA,MAAAA,CAAOC,KAAaC,QAAiB,EAAA;AACnD,EAAOC,OAAAA,kBAAAA,CAAQC,QAAQC,GAAK,EAAA;AAACJ,IAAAA;KAAMC,QAAAA,CAAAA;AACrC;AAFgBF,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA;AAIT,SAASM,QAAAA,CACdL,GACAM,EAAAA,MAAAA,EACAC,YAAqB,EAAA;AAErB,EAAMC,MAAAA,KAAAA,GAAQT,MAAOC,CAAAA,GAAAA,CAAQO,IAAAA,YAAAA;AAC7B,EAAME,MAAAA,MAAAA,GAASH,MAAOI,CAAAA,SAAAA,CAAUF,KAAAA,CAAAA;AAChC,EAAI,IAAA,CAACC,OAAOE,OAAS,EAAA;AACnB,IAAA,IAAIH,UAAUI,KAAW,CAAA,EAAA;AACvB,MAAA,MAAM,IAAIC,yBAAAA,CAAe,CAAsBb,mBAAAA,EAAAA,GAAAA,CAAkB,aAAA,CAAA,CAAA;AACnE;AAEA,IAAA,MAAM,IAAIa,yBAAAA,CAAe,CAAiCb,8BAAAA,EAAAA,GAAAA,CAAS,EAAA,CAAA,EAAA;MAACS,MAAOK,CAAAA;AAAM,KAAA,CAAA;AACnF;AACA,EAAA,OAAOL,MAAOM,CAAAA,IAAAA;AAChB;AAfgBV,MAAAA,CAAAA,QAAAA,EAAAA,UAAAA,CAAAA;AAgBhBA,QAAAA,CAASW,SAAY,GAAA,CAAChB,GAAaC,EAAAA,QAAAA,GAAW,KAAK,KAAA;AACjD,EAAA,OAAOI,QAASL,CAAAA,GAAAA,EAAKiB,KAAEC,CAAAA,MAAAA,EAAUC,EAAAA,MAAAA,CAAOlB,QAAAA,CAAAA,CAAWmB,CAAAA,IAAAA,EAAOC,CAAAA,WAAAA,EAAkB,KAAA,MAAA;AAC9E,CAAA;AAEO,SAASC,OAAOtB,GAAW,EAAA;AAChC,EAAOE,OAAAA,kBAAAA,CAAQC,QAAQC,GAAK,EAAA;AAACJ,IAAAA;GAAI,CAAMY,KAAAA,KAAAA,CAAAA;AACzC;AAFgBU,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"env.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z, ZodSchema } from \"zod\";\nimport { FrameworkError } from \"@/errors.js\";\nimport { getProp } from \"@/internals/helpers/object.js\";\n\nexport function getEnv(key: string, fallback?: never): string | undefined;\nexport function getEnv(key: string, fallback: string): string;\nexport function getEnv(key: string, fallback?: string) {\n return getProp(process.env, [key], fallback);\n}\n\nexport function parseEnv<T extends ZodSchema>(\n key: string,\n schema: T,\n defaultValue?: string,\n): z.output<T> {\n const value = getEnv(key) ?? defaultValue;\n const result = schema.safeParse(value);\n if (!result.success) {\n if (value === undefined) {\n throw new FrameworkError(`Required variable '${key}' is not set!`);\n }\n\n throw new FrameworkError(`Failed to parse ENV variable (${key})!`, [result.error]);\n }\n return result.data;\n}\nparseEnv.asBoolean = (key: string, fallback = false) => {\n return parseEnv(key, z.string(), String(fallback)).trim().toLowerCase() === \"true\";\n};\n\nexport function hasEnv(key: string) {\n return getProp(process.env, [key]) !== undefined;\n}\n"]}
1
+ {"version":3,"sources":["env.ts"],"names":["getEnv","key","fallback","getProp","process","env","parseEnv","schema","defaultValue","value","result","safeParse","success","undefined","FrameworkError","error","data","asBoolean","z","string","String","trim","toLowerCase","hasEnv"],"mappings":";;;;;;;;AAsBO,SAASA,MAAAA,CAAOC,KAAaC,QAAiB,EAAA;AACnD,EAAOC,OAAAA,kBAAAA,CAAQC,QAAQC,GAAK,EAAA;AAACJ,IAAAA;KAAMC,QAAAA,CAAAA;AACrC;AAFgBF,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA;AAIT,SAASM,QAAAA,CACdL,GACAM,EAAAA,MAAAA,EACAC,YAAqB,EAAA;AAErB,EAAMC,MAAAA,KAAAA,GAAQT,MAAOC,CAAAA,GAAAA,CAAQO,IAAAA,YAAAA;AAC7B,EAAME,MAAAA,MAAAA,GAASH,MAAOI,CAAAA,SAAAA,CAAUF,KAAAA,CAAAA;AAChC,EAAI,IAAA,CAACC,OAAOE,OAAS,EAAA;AACnB,IAAA,IAAIH,UAAUI,MAAW,EAAA;AACvB,MAAA,MAAM,IAAIC,yBAAAA,CAAe,CAA0Bb,uBAAAA,EAAAA,GAAAA,CAAkB,aAAA,CAAA,CAAA;AACvE;AAEA,IAAA,MAAM,IAAIa,yBAAAA,CAAe,CAA6Cb,0CAAAA,EAAAA,GAAAA,CAAS,EAAA,CAAA,EAAA;MAACS,MAAOK,CAAAA;AAAM,KAAA,CAAA;AAC/F;AACA,EAAA,OAAOL,MAAOM,CAAAA,IAAAA;AAChB;AAfgBV,MAAAA,CAAAA,QAAAA,EAAAA,UAAAA,CAAAA;AAgBhBA,QAAAA,CAASW,SAAY,GAAA,CAAChB,GAAaC,EAAAA,QAAAA,GAAW,KAAK,KAAA;AACjD,EAAA,OAAOI,QAASL,CAAAA,GAAAA,EAAKiB,KAAEC,CAAAA,MAAAA,EAAUC,EAAAA,MAAAA,CAAOlB,QAAAA,CAAAA,CAAWmB,CAAAA,IAAAA,EAAOC,CAAAA,WAAAA,EAAkB,KAAA,MAAA;AAC9E,CAAA;AAEO,SAASC,OAAOtB,GAAW,EAAA;AAChC,EAAOE,OAAAA,kBAAAA,CAAQC,QAAQC,GAAK,EAAA;AAACJ,IAAAA;GAAI,CAAMY,KAAAA,MAAAA;AACzC;AAFgBU,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"env.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z, ZodSchema } from \"zod\";\nimport { FrameworkError } from \"@/errors.js\";\nimport { getProp } from \"@/internals/helpers/object.js\";\n\nexport function getEnv(key: string, fallback?: never): string | undefined;\nexport function getEnv(key: string, fallback: string): string;\nexport function getEnv(key: string, fallback?: string) {\n return getProp(process.env, [key], fallback);\n}\n\nexport function parseEnv<T extends ZodSchema>(\n key: string,\n schema: T,\n defaultValue?: string,\n): z.output<T> {\n const value = getEnv(key) ?? defaultValue;\n const result = schema.safeParse(value);\n if (!result.success) {\n if (value === undefined) {\n throw new FrameworkError(`The required variable '${key}' is not set!`);\n }\n\n throw new FrameworkError(`Failed to parse the environment variable (${key})!`, [result.error]);\n }\n return result.data;\n}\nparseEnv.asBoolean = (key: string, fallback = false) => {\n return parseEnv(key, z.string(), String(fallback)).trim().toLowerCase() === \"true\";\n};\n\nexport function hasEnv(key: string) {\n return getProp(process.env, [key]) !== undefined;\n}\n"]}
@@ -15,9 +15,9 @@ function parseEnv(key, schema, defaultValue) {
15
15
  const result = schema.safeParse(value);
16
16
  if (!result.success) {
17
17
  if (value === void 0) {
18
- throw new FrameworkError(`Required variable '${key}' is not set!`);
18
+ throw new FrameworkError(`The required variable '${key}' is not set!`);
19
19
  }
20
- throw new FrameworkError(`Failed to parse ENV variable (${key})!`, [
20
+ throw new FrameworkError(`Failed to parse the environment variable (${key})!`, [
21
21
  result.error
22
22
  ]);
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/internals/env.ts"],"names":["getEnv","key","fallback","getProp","process","env","parseEnv","schema","defaultValue","value","result","safeParse","success","undefined","FrameworkError","error","data","asBoolean","z","string","String","trim","toLowerCase","hasEnv"],"mappings":";;;;;;AAsBO,SAASA,MAAAA,CAAOC,KAAaC,QAAiB,EAAA;AACnD,EAAOC,OAAAA,OAAAA,CAAQC,QAAQC,GAAK,EAAA;AAACJ,IAAAA;KAAMC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n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z, ZodSchema } from \"zod\";\nimport { FrameworkError } from \"@/errors.js\";\nimport { getProp } from \"@/internals/helpers/object.js\";\n\nexport function getEnv(key: string, fallback?: never): string | undefined;\nexport function getEnv(key: string, fallback: string): string;\nexport function getEnv(key: string, fallback?: string) {\n return getProp(process.env, [key], fallback);\n}\n\nexport function parseEnv<T extends ZodSchema>(\n key: string,\n schema: T,\n defaultValue?: string,\n): z.output<T> {\n const value = getEnv(key) ?? defaultValue;\n const result = schema.safeParse(value);\n if (!result.success) {\n if (value === undefined) {\n throw new FrameworkError(`Required variable '${key}' is not set!`);\n }\n\n throw new FrameworkError(`Failed to parse ENV variable (${key})!`, [result.error]);\n }\n return result.data;\n}\nparseEnv.asBoolean = (key: string, fallback = false) => {\n return parseEnv(key, z.string(), String(fallback)).trim().toLowerCase() === \"true\";\n};\n\nexport function hasEnv(key: string) {\n return getProp(process.env, [key]) !== undefined;\n}\n"]}
1
+ {"version":3,"sources":["env.ts"],"names":["getEnv","key","fallback","getProp","process","env","parseEnv","schema","defaultValue","value","result","safeParse","success","undefined","FrameworkError","error","data","asBoolean","z","string","String","trim","toLowerCase","hasEnv"],"mappings":";;;;;;AAsBO,SAASA,MAAAA,CAAOC,KAAaC,QAAiB,EAAA;AACnD,EAAOC,OAAAA,OAAAA,CAAQC,QAAQC,GAAK,EAAA;AAACJ,IAAAA;KAAMC,QAAAA,CAAAA;AACrC;AAFgBF,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA;AAIT,SAASM,QAAAA,CACdL,GACAM,EAAAA,MAAAA,EACAC,YAAqB,EAAA;AAErB,EAAMC,MAAAA,KAAAA,GAAQT,MAAOC,CAAAA,GAAAA,CAAQO,IAAAA,YAAAA;AAC7B,EAAME,MAAAA,MAAAA,GAASH,MAAOI,CAAAA,SAAAA,CAAUF,KAAAA,CAAAA;AAChC,EAAI,IAAA,CAACC,OAAOE,OAAS,EAAA;AACnB,IAAA,IAAIH,UAAUI,MAAW,EAAA;AACvB,MAAA,MAAM,IAAIC,cAAAA,CAAe,CAA0Bb,uBAAAA,EAAAA,GAAAA,CAAkB,aAAA,CAAA,CAAA;AACvE;AAEA,IAAA,MAAM,IAAIa,cAAAA,CAAe,CAA6Cb,0CAAAA,EAAAA,GAAAA,CAAS,EAAA,CAAA,EAAA;MAACS,MAAOK,CAAAA;AAAM,KAAA,CAAA;AAC/F;AACA,EAAA,OAAOL,MAAOM,CAAAA,IAAAA;AAChB;AAfgBV,MAAAA,CAAAA,QAAAA,EAAAA,UAAAA,CAAAA;AAgBhBA,QAAAA,CAASW,SAAY,GAAA,CAAChB,GAAaC,EAAAA,QAAAA,GAAW,KAAK,KAAA;AACjD,EAAA,OAAOI,QAASL,CAAAA,GAAAA,EAAKiB,CAAEC,CAAAA,MAAAA,EAAUC,EAAAA,MAAAA,CAAOlB,QAAAA,CAAAA,CAAWmB,CAAAA,IAAAA,EAAOC,CAAAA,WAAAA,EAAkB,KAAA,MAAA;AAC9E,CAAA;AAEO,SAASC,OAAOtB,GAAW,EAAA;AAChC,EAAOE,OAAAA,OAAAA,CAAQC,QAAQC,GAAK,EAAA;AAACJ,IAAAA;GAAI,CAAMY,KAAAA,MAAAA;AACzC;AAFgBU,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"env.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z, ZodSchema } from \"zod\";\nimport { FrameworkError } from \"@/errors.js\";\nimport { getProp } from \"@/internals/helpers/object.js\";\n\nexport function getEnv(key: string, fallback?: never): string | undefined;\nexport function getEnv(key: string, fallback: string): string;\nexport function getEnv(key: string, fallback?: string) {\n return getProp(process.env, [key], fallback);\n}\n\nexport function parseEnv<T extends ZodSchema>(\n key: string,\n schema: T,\n defaultValue?: string,\n): z.output<T> {\n const value = getEnv(key) ?? defaultValue;\n const result = schema.safeParse(value);\n if (!result.success) {\n if (value === undefined) {\n throw new FrameworkError(`The required variable '${key}' is not set!`);\n }\n\n throw new FrameworkError(`Failed to parse the environment variable (${key})!`, [result.error]);\n }\n return result.data;\n}\nparseEnv.asBoolean = (key: string, fallback = false) => {\n return parseEnv(key, z.string(), String(fallback)).trim().toLowerCase() === \"true\";\n};\n\nexport function hasEnv(key: string) {\n return getProp(process.env, [key]) !== undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/internals/fetcher.ts"],"names":["RestfulClientError","FrameworkError","createURLParams","data","urlTokenParams","URLSearchParams","key","value","Object","entries","undefined","Array","isArray","forEach","v","append","String","isPlainObject","set","toString","RestfulClient","Serializable","emitter","constructor","input","Emitter","root","child","namespace","creator","stream","path","init","paths","baseUrl","headers","groupId","url","URL","options","method","then","raw","assign","fromEntries","emit","emitterToGenerator","fetchEventSource","onopen","response","ok","get","EventStreamContentType","context","err","text","isRetryable","status","onmessage","msg","event","onclose","onerror","catch","error","doNothing","finally","fetch","getHeaders","target","searchParams","includes","json","createSnapshot","shallowCopy","loadSnapshot","snapshot"],"mappings":";;;;;;;;;;;;AA6BO,MAAMA,2BAA2BC,yBAAAA,CAAAA;EA7BxC;;;AA6BwD;AAGjD,SAASC,gBACdC,IAAyE,EAAA;AAEz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A;UACnDqD,OAAS,EAAA;AACPhB,YAAAA,GAAAA,EAAKY,QAASZ,CAAAA,GAAAA;YACd2B,KAAO,EAAA,MAAMf,SAASM,IAAI,EAAA;AAC1BN,YAAAA;AACF,WAAA;UACAO,WAAa,EAAA;AAAC,YAAA,GAAA;AAAK,YAAA;YAAKe,QAAStB,CAAAA,QAAAA,CAASQ,UAAU,GAAA;SACtD,CAAA;AACF;AAEA,MAAMtD,MAAAA,IAAAA,GAAO,MAAM8C,QAAAA,CAASuB,IAAI,EAAA;AAChC,MAAMlD,MAAAA,OAAAA,CAAQuB,KAAK,cAAgB,EAAA;AAAEI,QAAAA,QAAAA;AAAU9C,QAAAA,IAAAA;AAAMqB,QAAAA;OAAM,CAAA;AAC3D,MAAOrB,OAAAA,IAAAA;AACT,KAAA,CAAA,OAAS6D,KAAO,EAAA;AACd,MAAM1C,MAAAA,OAAAA,CAAQuB,KAAK,YAAc,EAAA;AAAEmB,QAAAA,KAAAA;AAAOxC,QAAAA;OAAa,CAAA;AACvD,MAAMwC,MAAAA,KAAAA;KACR,SAAA;AACE,MAAM1C,MAAAA,OAAAA,CAAQuB,KAAK,WAAa,EAAA;AAAErB,QAAAA;OAAa,CAAA;AACjD;AACF;EAEAiD,cAAiB,GAAA;AACf,IAAO,OAAA;MACLjD,KAAOkD,EAAAA,qBAAAA,CAAY,KAAKlD,KAAK,CAAA;AAC7BF,MAAAA,OAAAA,EAAS,IAAKA,CAAAA;AAChB,KAAA;AACF;AAEAqD,EAAAA,YAAAA,CAAaC,QAAwD,EAAA;AACnEpE,IAAOmC,MAAAA,CAAAA,MAAAA,CAAO,MAAMiC,QAAAA,CAAAA;AACtB;AACF","file":"fetcher.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FrameworkError } from \"@/errors.js\";\nimport { Serializable } from \"@/internals/serializable.js\";\nimport {\n EventSourceMessage,\n EventStreamContentType,\n fetchEventSource,\n} from \"@ai-zen/node-fetch-event-source\";\nimport { FetchEventSourceInit } from \"@ai-zen/node-fetch-event-source/lib/cjs/fetch.js\";\nimport { emitterToGenerator } from \"@/internals/helpers/promise.js\";\nimport { doNothing, isPlainObject } from \"remeda\";\nimport { Callback, Emitter } from \"@/emitter/emitter.js\";\nimport { shallowCopy } from \"@/serializer/utils.js\";\n\nexport class RestfulClientError extends FrameworkError {}\n\ntype URLParamType = string | number | boolean | null | undefined;\nexport function createURLParams(\n data: Record<string, URLParamType | URLParamType[] | Record<string, any>>,\n) {\n const urlTokenParams = new URLSearchParams();\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n value.forEach((v) => {\n if (v !== undefined) {\n urlTokenParams.append(key, String(v));\n }\n });\n } else if (isPlainObject(value)) {\n urlTokenParams.set(key, createURLParams(value).toString());\n } else {\n urlTokenParams.set(key, String(value));\n }\n }\n return urlTokenParams;\n}\n\ninterface FetchInput {\n url: string;\n options: RequestInit;\n}\n\nexport interface StreamInput {\n url: string;\n options: FetchEventSourceInit;\n}\n\nexport interface RestfulClientEvents {\n fetchStart: Callback<{ input: FetchInput }>;\n fetchError: Callback<{ error: Error; input: FetchInput }>;\n fetchSuccess: Callback<{ response: Response; data: any; input: FetchInput }>;\n fetchDone: Callback<{ input: FetchInput }>;\n\n streamStart: Callback<{ input: StreamInput }>;\n streamOpen: Callback<{ input: StreamInput }>;\n streamSuccess: Callback<{ input: StreamInput }>;\n streamMessage: Callback<{ data: EventSourceMessage; input: StreamInput }>;\n streamError: Callback<{ error: Error; input: StreamInput }>;\n streamDone: Callback<{ input: StreamInput }>;\n}\n\nexport class RestfulClient<K extends Record<string, string>> extends Serializable {\n public readonly emitter = Emitter.root.child<RestfulClientEvents>({\n namespace: [\"internals\", \"restfulClient\"],\n creator: this,\n });\n\n constructor(\n protected input: {\n baseUrl: string;\n headers: () => Promise<Headers>;\n paths: K;\n },\n ) {\n super();\n }\n\n async *stream(\n path: keyof K,\n init: FetchEventSourceInit,\n ): AsyncGenerator<EventSourceMessage, void, void> {\n const { paths, baseUrl, headers } = this.input;\n const emitter = this.emitter.child({\n groupId: \"stream\",\n });\n\n const input: StreamInput = {\n url: new URL(paths[path] ?? path, baseUrl).toString(),\n options: {\n ...init,\n method: \"POST\",\n headers: await headers().then((raw) =>\n Object.assign(Object.fromEntries(raw.entries()), init?.headers),\n ),\n },\n };\n await emitter.emit(\"streamStart\", { input });\n\n return yield* emitterToGenerator(async ({ emit }) =>\n fetchEventSource(input.url, {\n ...input.options,\n async onopen(response) {\n if (response.ok && response.headers.get(\"content-type\") === EventStreamContentType) {\n await emitter.emit(\"streamOpen\", { input });\n return;\n }\n throw new RestfulClientError(\"Failed to stream!\", [], {\n context: {\n url: response.url,\n err: await response.text(),\n response,\n },\n isRetryable: response.status >= 400 && response.status < 500 && response.status !== 429,\n });\n },\n async onmessage(msg) {\n if (msg?.event === \"error\") {\n throw new RestfulClientError(`Error during streaming has occurred.`, [], {\n context: msg,\n });\n }\n await emitter.emit(\"streamMessage\", { input, data: msg });\n emit(msg);\n },\n onclose() {},\n onerror(err) {\n throw new RestfulClientError(`Error during streaming has occurred.`, [err]);\n },\n })\n .then(() => emitter.emit(\"streamSuccess\", { input }))\n .catch(async (error) => {\n await emitter.emit(\"streamError\", { input, error }).catch(doNothing());\n throw error;\n })\n .finally(() => emitter.emit(\"streamDone\", { input })),\n );\n }\n\n async fetch(path: keyof K, init?: RequestInit & { searchParams?: URLSearchParams }) {\n const emitter = this.emitter.child({\n groupId: \"fetch\",\n });\n\n const { paths, baseUrl, headers: getHeaders } = this.input;\n\n const target = new URL(paths[path] ?? path, baseUrl);\n if (init?.searchParams) {\n for (const [key, value] of init.searchParams) {\n target.searchParams.set(key, value);\n }\n }\n\n const input: FetchInput = {\n url: target.toString(),\n options: {\n ...init,\n headers: await getHeaders().then((raw) =>\n Object.assign(Object.fromEntries(raw.entries()), init?.headers),\n ),\n },\n };\n\n await emitter.emit(\"fetchStart\", { input });\n try {\n const response = await fetch(input.url, input.options);\n\n if (!response.ok) {\n throw new RestfulClientError(\"Fetch has failed\", [], {\n context: {\n url: response.url,\n error: await response.text(),\n response,\n },\n isRetryable: [408, 503].includes(response.status ?? 500),\n });\n }\n\n const data = await response.json();\n await emitter.emit(\"fetchSuccess\", { response, data, input });\n return data;\n } catch (error) {\n await emitter.emit(\"fetchError\", { error, input: input });\n throw error;\n } finally {\n await emitter.emit(\"fetchDone\", { input: input });\n }\n }\n\n createSnapshot() {\n return {\n input: shallowCopy(this.input),\n emitter: this.emitter,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>): void {\n Object.assign(this, snapshot);\n }\n}\n"]}
1
+ {"version":3,"sources":["fetcher.ts"],"names":["RestfulClientError","FrameworkError","createURLParams","data","urlTokenParams","URLSearchParams","key","value","Object","entries","undefined","Array","isArray","forEach","v","append","String","isPlainObject","set","toString","RestfulClient","Serializable","emitter","constructor","input","Emitter","root","child","namespace","creator","stream","path","init","paths","baseUrl","headers","groupId","url","URL","options","method","then","raw","assign","fromEntries","emit","emitterToGenerator","fetchEventSource","onopen","response","ok","get","EventStreamContentType","context","err","text","isRetryable","status","onmessage","msg","event","onclose","onerror","catch","error","doNothing","finally","fetch","getHeaders","target","searchParams","includes","json","createSnapshot","shallowCopy","loadSnapshot","snapshot"],"mappings":";;;;;;;;;;;;AA6BO,MAAMA,2BAA2BC,yBAAAA,CAAAA;EA7BxC;;;AA6BwD;AAGjD,SAASC,gBACdC,IAAyE,EAAA;AAEzE,EAAMC,MAAAA,cAAAA,GAAiB,IAAIC,eAAAA,EAAAA;AA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AAAA;YACd2B,KAAO,EAAA,MAAMf,SAASM,IAAI,EAAA;AAC1BN,YAAAA;AACF,WAAA;UACAO,WAAa,EAAA;AAAC,YAAA,GAAA;AAAK,YAAA;YAAKe,QAAStB,CAAAA,QAAAA,CAASQ,UAAU,GAAA;SACtD,CAAA;AACF;AAEA,MAAMtD,MAAAA,IAAAA,GAAO,MAAM8C,QAAAA,CAASuB,IAAI,EAAA;AAChC,MAAMlD,MAAAA,OAAAA,CAAQuB,KAAK,cAAgB,EAAA;AAAEI,QAAAA,QAAAA;AAAU9C,QAAAA,IAAAA;AAAMqB,QAAAA;OAAM,CAAA;AAC3D,MAAOrB,OAAAA,IAAAA;AACT,KAAA,CAAA,OAAS6D,KAAO,EAAA;AACd,MAAM1C,MAAAA,OAAAA,CAAQuB,KAAK,YAAc,EAAA;AAAEmB,QAAAA,KAAAA;AAAOxC,QAAAA;OAAa,CAAA;AACvD,MAAMwC,MAAAA,KAAAA;KACR,SAAA;AACE,MAAM1C,MAAAA,OAAAA,CAAQuB,KAAK,WAAa,EAAA;AAAErB,QAAAA;OAAa,CAAA;AACjD;AACF;EAEAiD,cAAiB,GAAA;AACf,IAAO,OAAA;MACLjD,KAAOkD,EAAAA,qBAAAA,CAAY,KAAKlD,KAAK,CAAA;AAC7BF,MAAAA,OAAAA,EAAS,IAAKA,CAAAA;AAChB,KAAA;AACF;AAEAqD,EAAAA,YAAAA,CAAaC,QAAwD,EAAA;AACnEpE,IAAOmC,MAAAA,CAAAA,MAAAA,CAAO,MAAMiC,QAAAA,CAAAA;AACtB;AACF","file":"fetcher.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FrameworkError } from \"@/errors.js\";\nimport { Serializable } from \"@/internals/serializable.js\";\nimport {\n EventSourceMessage,\n EventStreamContentType,\n fetchEventSource,\n} from \"@ai-zen/node-fetch-event-source\";\nimport { FetchEventSourceInit } from \"@ai-zen/node-fetch-event-source/lib/cjs/fetch.js\";\nimport { emitterToGenerator } from \"@/internals/helpers/promise.js\";\nimport { doNothing, isPlainObject } from \"remeda\";\nimport { Callback, Emitter } from \"@/emitter/emitter.js\";\nimport { shallowCopy } from \"@/serializer/utils.js\";\n\nexport class RestfulClientError extends FrameworkError {}\n\ntype URLParamType = string | number | boolean | null | undefined;\nexport function createURLParams(\n data: Record<string, URLParamType | URLParamType[] | Record<string, any>>,\n) {\n const urlTokenParams = new URLSearchParams();\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n value.forEach((v) => {\n if (v !== undefined) {\n urlTokenParams.append(key, String(v));\n }\n });\n } else if (isPlainObject(value)) {\n urlTokenParams.set(key, createURLParams(value).toString());\n } else {\n urlTokenParams.set(key, String(value));\n }\n }\n return urlTokenParams;\n}\n\ninterface FetchInput {\n url: string;\n options: RequestInit;\n}\n\nexport interface StreamInput {\n url: string;\n options: FetchEventSourceInit;\n}\n\nexport interface RestfulClientEvents {\n fetchStart: Callback<{ input: FetchInput }>;\n fetchError: Callback<{ error: Error; input: FetchInput }>;\n fetchSuccess: Callback<{ response: Response; data: any; input: FetchInput }>;\n fetchDone: Callback<{ input: FetchInput }>;\n\n streamStart: Callback<{ input: StreamInput }>;\n streamOpen: Callback<{ input: StreamInput }>;\n streamSuccess: Callback<{ input: StreamInput }>;\n streamMessage: Callback<{ data: EventSourceMessage; input: StreamInput }>;\n streamError: Callback<{ error: Error; input: StreamInput }>;\n streamDone: Callback<{ input: StreamInput }>;\n}\n\nexport class RestfulClient<K extends Record<string, string>> extends Serializable {\n public readonly emitter = Emitter.root.child<RestfulClientEvents>({\n namespace: [\"internals\", \"restfulClient\"],\n creator: this,\n });\n\n constructor(\n protected input: {\n baseUrl: string;\n headers: () => Promise<Headers>;\n paths: K;\n },\n ) {\n super();\n }\n\n async *stream(\n path: keyof K,\n init: FetchEventSourceInit,\n ): AsyncGenerator<EventSourceMessage, void, void> {\n const { paths, baseUrl, headers } = this.input;\n const emitter = this.emitter.child({\n groupId: \"stream\",\n });\n\n const input: StreamInput = {\n url: new URL(paths[path] ?? path, baseUrl).toString(),\n options: {\n ...init,\n method: \"POST\",\n headers: await headers().then((raw) =>\n Object.assign(Object.fromEntries(raw.entries()), init?.headers),\n ),\n },\n };\n await emitter.emit(\"streamStart\", { input });\n\n return yield* emitterToGenerator(async ({ emit }) =>\n fetchEventSource(input.url, {\n ...input.options,\n async onopen(response) {\n if (response.ok && response.headers.get(\"content-type\") === EventStreamContentType) {\n await emitter.emit(\"streamOpen\", { input });\n return;\n }\n throw new RestfulClientError(\"Failed to stream!\", [], {\n context: {\n url: response.url,\n err: await response.text(),\n response,\n },\n isRetryable: response.status >= 400 && response.status < 500 && response.status !== 429,\n });\n },\n async onmessage(msg) {\n if (msg?.event === \"error\") {\n throw new RestfulClientError(`Error during streaming has occurred.`, [], {\n context: msg,\n });\n }\n await emitter.emit(\"streamMessage\", { input, data: msg });\n emit(msg);\n },\n onclose() {},\n onerror(err) {\n throw new RestfulClientError(`Error during streaming has occurred.`, [err]);\n },\n })\n .then(() => emitter.emit(\"streamSuccess\", { input }))\n .catch(async (error) => {\n await emitter.emit(\"streamError\", { input, error }).catch(doNothing());\n throw error;\n })\n .finally(() => emitter.emit(\"streamDone\", { input })),\n );\n }\n\n async fetch(path: keyof K, init?: RequestInit & { searchParams?: URLSearchParams }) {\n const emitter = this.emitter.child({\n groupId: \"fetch\",\n });\n\n const { paths, baseUrl, headers: getHeaders } = this.input;\n\n const target = new URL(paths[path] ?? path, baseUrl);\n if (init?.searchParams) {\n for (const [key, value] of init.searchParams) {\n target.searchParams.set(key, value);\n }\n }\n\n const input: FetchInput = {\n url: target.toString(),\n options: {\n ...init,\n headers: await getHeaders().then((raw) =>\n Object.assign(Object.fromEntries(raw.entries()), init?.headers),\n ),\n },\n };\n\n await emitter.emit(\"fetchStart\", { input });\n try {\n const response = await fetch(input.url, input.options);\n\n if (!response.ok) {\n throw new RestfulClientError(\"Fetch has failed\", [], {\n context: {\n url: response.url,\n error: await response.text(),\n response,\n },\n isRetryable: [408, 503].includes(response.status ?? 500),\n });\n }\n\n const data = await response.json();\n await emitter.emit(\"fetchSuccess\", { response, data, input });\n return data;\n } catch (error) {\n await emitter.emit(\"fetchError\", { error, input: input });\n throw error;\n } finally {\n await emitter.emit(\"fetchDone\", { input: input });\n }\n }\n\n createSnapshot() {\n return {\n input: shallowCopy(this.input),\n emitter: this.emitter,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>): void {\n Object.assign(this, snapshot);\n }\n}\n"]}
@@ -2,7 +2,7 @@ import { FrameworkError } from '../errors.cjs';
2
2
  import { Serializable } from './serializable.cjs';
3
3
  import { EventSourceMessage } from '@ai-zen/node-fetch-event-source';
4
4
  import { FetchEventSourceInit } from '@ai-zen/node-fetch-event-source/lib/cjs/fetch.js';
5
- import { C as Callback, E as Emitter } from '../emitter-C9EN5B0j.cjs';
5
+ import { C as Callback, E as Emitter } from '../emitter-BWtGHYn0.cjs';
6
6
  import './types.cjs';
7
7
  import './helpers/guards.cjs';
8
8
 
@@ -2,7 +2,7 @@ import { FrameworkError } from '../errors.js';
2
2
  import { Serializable } from './serializable.js';
3
3
  import { EventSourceMessage } from '@ai-zen/node-fetch-event-source';
4
4
  import { FetchEventSourceInit } from '@ai-zen/node-fetch-event-source/lib/cjs/fetch.js';
5
- import { C as Callback, E as Emitter } from '../emitter-BxVxGBbJ.js';
5
+ import { C as Callback, E as Emitter } from '../emitter-l0W9gC1A.js';
6
6
  import './types.js';
7
7
  import './helpers/guards.js';
8
8
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/internals/fetcher.ts"],"names":["RestfulClientError","FrameworkError","createURLParams","data","urlTokenParams","URLSearchParams","key","value","Object","entries","undefined","Array","isArray","forEach","v","append","String","isPlainObject","set","toString","RestfulClient","Serializable","emitter","constructor","input","Emitter","root","child","namespace","creator","stream","path","init","paths","baseUrl","headers","groupId","url","URL","options","method","then","raw","assign","fromEntries","emit","emitterToGenerator","fetchEventSource","onopen","response","ok","get","EventStreamContentType","context","err","text","isRetryable","status","onmessage","msg","event","onclose","onerror","catch","error","doNothing","finally","fetch","getHeaders","target","searchParams","includes","json","createSnapshot","shallowCopy","loadSnapshot","snapshot"],"mappings":";;;;;;;;;;AA6BO,MAAMA,2BAA2BC,cAAAA,CAAAA;EA7BxC;;;AA6BwD;AAGjD,SAASC,gBACdC,IAAyE,EAAA;AAEzE,EAAMC,MAAAA,cAAAA,GAAiB,IAAIC,eAAAA,EAAAA;AAC3B,EAAA,KAAA,MAAW,CAACC,GAAKC,EAAAA,KAAAA,KAAUC,MAAOC,CAAAA,OAAAA,CAAQN,IAAAA,CAAO,EAAA;AAC/C,IAAA,IAAII,UAAUG,KAAW,CAAA,EAAA;AACvB,MAAA;AACF;AAEA,IAAIC,IAAAA,KAAAA,CAAMC,OAAQL,CAAAA,KAAAA,CAAQ,EAAA;AACxBA,MAAMM,KAAAA,CAAAA,OAAAA,CAAQ,CAACC,CAAAA,KAAAA;AACb,QAAA,IAAIA,MAAMJ,KAAW,CAAA,EAAA;AACnBN,UAAAA,cAAAA,CAAeW,MAAOT,CAAAA,GAAAA,EAAKU,MAAOF,CAAAA,CAAAA,CAAAA,CAAAA;AACpC;OACF,CAAA;KACSG,MAAAA,IAAAA,aAAAA,CAAcV,KAAAA,CAAQ,EAAA;AAC/BH,MAAAA,cAAAA,CAAec,IAAIZ,GAAKJ,EAAAA,eAAAA,CAAgBK,KAAAA,CAAAA,CAAOY,UAAQ,CAAA;KAClD,MAAA;AACLf,MAAAA,cAAAA,CAAec,GAAIZ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A;AAAErB,QAAAA;OAAa,CAAA;AACjD;AACF;EAEAiD,cAAiB,GAAA;AACf,IAAO,OAAA;MACLjD,KAAOkD,EAAAA,WAAAA,CAAY,KAAKlD,KAAK,CAAA;AAC7BF,MAAAA,OAAAA,EAAS,IAAKA,CAAAA;AAChB,KAAA;AACF;AAEAqD,EAAAA,YAAAA,CAAaC,QAAwD,EAAA;AACnEpE,IAAOmC,MAAAA,CAAAA,MAAAA,CAAO,MAAMiC,QAAAA,CAAAA;AACtB;AACF","file":"fetcher.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FrameworkError } from \"@/errors.js\";\nimport { Serializable } from \"@/internals/serializable.js\";\nimport {\n EventSourceMessage,\n EventStreamContentType,\n fetchEventSource,\n} from \"@ai-zen/node-fetch-event-source\";\nimport { FetchEventSourceInit } from \"@ai-zen/node-fetch-event-source/lib/cjs/fetch.js\";\nimport { emitterToGenerator } from \"@/internals/helpers/promise.js\";\nimport { doNothing, isPlainObject } from \"remeda\";\nimport { Callback, Emitter } from \"@/emitter/emitter.js\";\nimport { shallowCopy } from \"@/serializer/utils.js\";\n\nexport class RestfulClientError extends FrameworkError {}\n\ntype URLParamType = string | number | boolean | null | undefined;\nexport function createURLParams(\n data: Record<string, URLParamType | URLParamType[] | Record<string, any>>,\n) {\n const urlTokenParams = new URLSearchParams();\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n value.forEach((v) => {\n if (v !== undefined) {\n urlTokenParams.append(key, String(v));\n }\n });\n } else if (isPlainObject(value)) {\n urlTokenParams.set(key, createURLParams(value).toString());\n } else {\n urlTokenParams.set(key, String(value));\n }\n }\n return urlTokenParams;\n}\n\ninterface FetchInput {\n url: string;\n options: RequestInit;\n}\n\nexport interface StreamInput {\n url: string;\n options: FetchEventSourceInit;\n}\n\nexport interface RestfulClientEvents {\n fetchStart: Callback<{ input: FetchInput }>;\n fetchError: Callback<{ error: Error; input: FetchInput }>;\n fetchSuccess: Callback<{ response: Response; data: any; input: FetchInput }>;\n fetchDone: Callback<{ input: FetchInput }>;\n\n streamStart: Callback<{ input: StreamInput }>;\n streamOpen: Callback<{ input: StreamInput }>;\n streamSuccess: Callback<{ input: StreamInput }>;\n streamMessage: Callback<{ data: EventSourceMessage; input: StreamInput }>;\n streamError: Callback<{ error: Error; input: StreamInput }>;\n streamDone: Callback<{ input: StreamInput }>;\n}\n\nexport class RestfulClient<K extends Record<string, string>> extends Serializable {\n public readonly emitter = Emitter.root.child<RestfulClientEvents>({\n namespace: [\"internals\", \"restfulClient\"],\n creator: this,\n });\n\n constructor(\n protected input: {\n baseUrl: string;\n headers: () => Promise<Headers>;\n paths: K;\n },\n ) {\n super();\n }\n\n async *stream(\n path: keyof K,\n init: FetchEventSourceInit,\n ): AsyncGenerator<EventSourceMessage, void, void> {\n const { paths, baseUrl, headers } = this.input;\n const emitter = this.emitter.child({\n groupId: \"stream\",\n });\n\n const input: StreamInput = {\n url: new URL(paths[path] ?? path, baseUrl).toString(),\n options: {\n ...init,\n method: \"POST\",\n headers: await headers().then((raw) =>\n Object.assign(Object.fromEntries(raw.entries()), init?.headers),\n ),\n },\n };\n await emitter.emit(\"streamStart\", { input });\n\n return yield* emitterToGenerator(async ({ emit }) =>\n fetchEventSource(input.url, {\n ...input.options,\n async onopen(response) {\n if (response.ok && response.headers.get(\"content-type\") === EventStreamContentType) {\n await emitter.emit(\"streamOpen\", { input });\n return;\n }\n throw new RestfulClientError(\"Failed to stream!\", [], {\n context: {\n url: response.url,\n err: await response.text(),\n response,\n },\n isRetryable: response.status >= 400 && response.status < 500 && response.status !== 429,\n });\n },\n async onmessage(msg) {\n if (msg?.event === \"error\") {\n throw new RestfulClientError(`Error during streaming has occurred.`, [], {\n context: msg,\n });\n }\n await emitter.emit(\"streamMessage\", { input, data: msg });\n emit(msg);\n },\n onclose() {},\n onerror(err) {\n throw new RestfulClientError(`Error during streaming has occurred.`, [err]);\n },\n })\n .then(() => emitter.emit(\"streamSuccess\", { input }))\n .catch(async (error) => {\n await emitter.emit(\"streamError\", { input, error }).catch(doNothing());\n throw error;\n })\n .finally(() => emitter.emit(\"streamDone\", { input })),\n );\n }\n\n async fetch(path: keyof K, init?: RequestInit & { searchParams?: URLSearchParams }) {\n const emitter = this.emitter.child({\n groupId: \"fetch\",\n });\n\n const { paths, baseUrl, headers: getHeaders } = this.input;\n\n const target = new URL(paths[path] ?? path, baseUrl);\n if (init?.searchParams) {\n for (const [key, value] of init.searchParams) {\n target.searchParams.set(key, value);\n }\n }\n\n const input: FetchInput = {\n url: target.toString(),\n options: {\n ...init,\n headers: await getHeaders().then((raw) =>\n Object.assign(Object.fromEntries(raw.entries()), init?.headers),\n ),\n },\n };\n\n await emitter.emit(\"fetchStart\", { input });\n try {\n const response = await fetch(input.url, input.options);\n\n if (!response.ok) {\n throw new RestfulClientError(\"Fetch has failed\", [], {\n context: {\n url: response.url,\n error: await response.text(),\n response,\n },\n isRetryable: [408, 503].includes(response.status ?? 500),\n });\n }\n\n const data = await response.json();\n await emitter.emit(\"fetchSuccess\", { response, data, input });\n return data;\n } catch (error) {\n await emitter.emit(\"fetchError\", { error, input: input });\n throw error;\n } finally {\n await emitter.emit(\"fetchDone\", { input: input });\n }\n }\n\n createSnapshot() {\n return {\n input: shallowCopy(this.input),\n emitter: this.emitter,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>): void {\n Object.assign(this, snapshot);\n }\n}\n"]}
1
+ {"version":3,"sources":["fetcher.ts"],"names":["RestfulClientError","FrameworkError","createURLParams","data","urlTokenParams","URLSearchParams","key","value","Object","entries","undefined","Array","isArray","forEach","v","append","String","isPlainObject","set","toString","RestfulClient","Serializable","emitter","constructor","input","Emitter","root","child","namespace","creator","stream","path","init","paths","baseUrl","headers","groupId","url","URL","options","method","then","raw","assign","fromEntries","emit","emitterToGenerator","fetchEventSource","onopen","response","ok","get","EventStreamContentType","context","err","text","isRetryable","status","onmessage","msg","event","onclose","onerror","catch","error","doNothing","finally","fetch","getHeaders","target","searchParams","includes","json","createSnapshot","shallowCopy","loadSnapshot","snapshot"],"mappings":";;;;;;;;;;AA6BO,MAAMA,2BAA2BC,cAAAA,CAAAA;EA7BxC;;;AA6BwD;AAGjD,SAASC,gBACdC,IAAyE,EAAA;AAEzE,EAAMC,MAAAA,cAAAA,GAAiB,IAAIC,eAAAA,EAAAA;AAC3B,EAAA,KAAA,MAAW,CAACC,GAAKC,EAAAA,KAAAA,KAAUC,MAAOC,CAAAA,OAAAA,CAAQN,IAAAA,CAAO,EAAA;AAC/C,IAAA,IAAII,UAAUG,MAAW,EAAA;AACvB,MAAA;AACF;AAEA,IAAIC,IAAAA,KAAAA,CAAMC,OAAQL,CAAAA,KAAAA,CAAQ,EAAA;AACxBA,MAAMM,KAAAA,CAAAA,OAAAA,CAAQ,CAACC,CAAAA,KAAAA;AACb,QAAA,IAAIA,MAAMJ,MAAW,EAAA;AACnBN,UAAAA,cAAAA,CAAeW,MAAOT,CAAAA,GAAAA,EAAKU,MAAOF,CAAAA,CAAAA,CAAAA,CAAAA;AACpC;OACF,CAAA;KACSG,MAAAA,IAAAA,aAAAA,CAAcV,KAAAA,CAAQ,EAAA;AAC/BH,MAAAA,cAAAA,CAAec,IAAIZ,GAAKJ,EAAAA,eAAAA,CAAgBK,KAAAA,CAAAA,CAAOY,UAAQ,CAAA;KAClD,MAAA;AACLf,MAAAA,cAAAA,CAAec,GAAIZ,CAAAA,GAAAA,EAAKU,MAAOT,CAAAA,KAAAA,CAAAA,CAAAA;AACjC;AACF;AACA,EAA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ACLjD,KAAOkD,EAAAA,WAAAA,CAAY,KAAKlD,KAAK,CAAA;AAC7BF,MAAAA,OAAAA,EAAS,IAAKA,CAAAA;AAChB,KAAA;AACF;AAEAqD,EAAAA,YAAAA,CAAaC,QAAwD,EAAA;AACnEpE,IAAOmC,MAAAA,CAAAA,MAAAA,CAAO,MAAMiC,QAAAA,CAAAA;AACtB;AACF","file":"fetcher.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FrameworkError } from \"@/errors.js\";\nimport { Serializable } from \"@/internals/serializable.js\";\nimport {\n EventSourceMessage,\n EventStreamContentType,\n fetchEventSource,\n} from \"@ai-zen/node-fetch-event-source\";\nimport { FetchEventSourceInit } from \"@ai-zen/node-fetch-event-source/lib/cjs/fetch.js\";\nimport { emitterToGenerator } from \"@/internals/helpers/promise.js\";\nimport { doNothing, isPlainObject } from \"remeda\";\nimport { Callback, Emitter } from \"@/emitter/emitter.js\";\nimport { shallowCopy } from \"@/serializer/utils.js\";\n\nexport class RestfulClientError extends FrameworkError {}\n\ntype URLParamType = string | number | boolean | null | undefined;\nexport function createURLParams(\n data: Record<string, URLParamType | URLParamType[] | Record<string, any>>,\n) {\n const urlTokenParams = new URLSearchParams();\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n value.forEach((v) => {\n if (v !== undefined) {\n urlTokenParams.append(key, String(v));\n }\n });\n } else if (isPlainObject(value)) {\n urlTokenParams.set(key, createURLParams(value).toString());\n } else {\n urlTokenParams.set(key, String(value));\n }\n }\n return urlTokenParams;\n}\n\ninterface FetchInput {\n url: string;\n options: RequestInit;\n}\n\nexport interface StreamInput {\n url: string;\n options: FetchEventSourceInit;\n}\n\nexport interface RestfulClientEvents {\n fetchStart: Callback<{ input: FetchInput }>;\n fetchError: Callback<{ error: Error; input: FetchInput }>;\n fetchSuccess: Callback<{ response: Response; data: any; input: FetchInput }>;\n fetchDone: Callback<{ input: FetchInput }>;\n\n streamStart: Callback<{ input: StreamInput }>;\n streamOpen: Callback<{ input: StreamInput }>;\n streamSuccess: Callback<{ input: StreamInput }>;\n streamMessage: Callback<{ data: EventSourceMessage; input: StreamInput }>;\n streamError: Callback<{ error: Error; input: StreamInput }>;\n streamDone: Callback<{ input: StreamInput }>;\n}\n\nexport class RestfulClient<K extends Record<string, string>> extends Serializable {\n public readonly emitter = Emitter.root.child<RestfulClientEvents>({\n namespace: [\"internals\", \"restfulClient\"],\n creator: this,\n });\n\n constructor(\n protected input: {\n baseUrl: string;\n headers: () => Promise<Headers>;\n paths: K;\n },\n ) {\n super();\n }\n\n async *stream(\n path: keyof K,\n init: FetchEventSourceInit,\n ): AsyncGenerator<EventSourceMessage, void, void> {\n const { paths, baseUrl, headers } = this.input;\n const emitter = this.emitter.child({\n groupId: \"stream\",\n });\n\n const input: StreamInput = {\n url: new URL(paths[path] ?? path, baseUrl).toString(),\n options: {\n ...init,\n method: \"POST\",\n headers: await headers().then((raw) =>\n Object.assign(Object.fromEntries(raw.entries()), init?.headers),\n ),\n },\n };\n await emitter.emit(\"streamStart\", { input });\n\n return yield* emitterToGenerator(async ({ emit }) =>\n fetchEventSource(input.url, {\n ...input.options,\n async onopen(response) {\n if (response.ok && response.headers.get(\"content-type\") === EventStreamContentType) {\n await emitter.emit(\"streamOpen\", { input });\n return;\n }\n throw new RestfulClientError(\"Failed to stream!\", [], {\n context: {\n url: response.url,\n err: await response.text(),\n response,\n },\n isRetryable: response.status >= 400 && response.status < 500 && response.status !== 429,\n });\n },\n async onmessage(msg) {\n if (msg?.event === \"error\") {\n throw new RestfulClientError(`Error during streaming has occurred.`, [], {\n context: msg,\n });\n }\n await emitter.emit(\"streamMessage\", { input, data: msg });\n emit(msg);\n },\n onclose() {},\n onerror(err) {\n throw new RestfulClientError(`Error during streaming has occurred.`, [err]);\n },\n })\n .then(() => emitter.emit(\"streamSuccess\", { input }))\n .catch(async (error) => {\n await emitter.emit(\"streamError\", { input, error }).catch(doNothing());\n throw error;\n })\n .finally(() => emitter.emit(\"streamDone\", { input })),\n );\n }\n\n async fetch(path: keyof K, init?: RequestInit & { searchParams?: URLSearchParams }) {\n const emitter = this.emitter.child({\n groupId: \"fetch\",\n });\n\n const { paths, baseUrl, headers: getHeaders } = this.input;\n\n const target = new URL(paths[path] ?? path, baseUrl);\n if (init?.searchParams) {\n for (const [key, value] of init.searchParams) {\n target.searchParams.set(key, value);\n }\n }\n\n const input: FetchInput = {\n url: target.toString(),\n options: {\n ...init,\n headers: await getHeaders().then((raw) =>\n Object.assign(Object.fromEntries(raw.entries()), init?.headers),\n ),\n },\n };\n\n await emitter.emit(\"fetchStart\", { input });\n try {\n const response = await fetch(input.url, input.options);\n\n if (!response.ok) {\n throw new RestfulClientError(\"Fetch has failed\", [], {\n context: {\n url: response.url,\n error: await response.text(),\n response,\n },\n isRetryable: [408, 503].includes(response.status ?? 500),\n });\n }\n\n const data = await response.json();\n await emitter.emit(\"fetchSuccess\", { response, data, input });\n return data;\n } catch (error) {\n await emitter.emit(\"fetchError\", { error, input: input });\n throw error;\n } finally {\n await emitter.emit(\"fetchDone\", { input: input });\n }\n }\n\n createSnapshot() {\n return {\n input: shallowCopy(this.input),\n emitter: this.emitter,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>): void {\n Object.assign(this, snapshot);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/array.ts"],"names":["removeFromArray","arr","target","index","findIndex","value","splice","castArray","result","Array","isArray","hasMinLength","n","length"],"mappings":";;;;AAgBO,SAASA,eAAAA,CAAmBC,KAAUC,MAAS,EAAA;AACpD,EAAA,MAAMC,QAAQF,GAAIG,CAAAA,SAAAA,CAAU,CAACC,KAAAA,KAAUA,UAAUH,MAAAA,CAAAA;AACjD,EAAA,IAAIC,UAAU,CAAI,CAAA,EAAA;AAChB,IAAO,OAAA,KAAA;AACT;AAEAF,EAAIK,GAAAA,CAAAA,MAAAA,CAAOH,OAAO,CAAA,CAAA;AAClB,EAAO,OAAA,IAAA;AACT;AARgBH,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA;AAUT,SAASO,UAAaN,GAAM,EAAA;AACjC,EAAA,MAAMO,MAASC,GAAAA,KAAAA,CAAMC,OAAQT,CAAAA,GAAAA,IAAOA,GAAM,GAAA;AAACA,IAAAA;;AAC3C,EAAOO,OAAAA,MAAAA;AACT;AAHgBD,MAAAA,CAAAA,SAAAA,EAAAA,WAAAA,CAAAA;AAST,SAASI,YAAAA,CAAkCV,KAAUW,CAAI,EAAA;AAC9D,EAAA,OAAOX,IAAIY,MAAUD,IAAAA,CAAAA;AACvB;AAFgBD,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA","file":"array.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function removeFromArray<T>(arr: T[], target: T): boolean {\n const index = arr.findIndex((value) => value === target);\n if (index === -1) {\n return false;\n }\n\n arr.splice(index, 1);\n return true;\n}\n\nexport function castArray<T>(arr: T) {\n const result = Array.isArray(arr) ? arr : [arr];\n return result as T extends unknown[] ? T : [T];\n}\n\ntype HasMinLength<T, N extends number, T2 extends any[] = []> = T2[\"length\"] extends N\n ? [...T2, ...T[]]\n : HasMinLength<T, N, [any, ...T2]>;\n\nexport function hasMinLength<T, N extends number>(arr: T[], n: N): arr is HasMinLength<T, N> {\n return arr.length >= n;\n}\n"]}
1
+ {"version":3,"sources":["array.ts"],"names":["removeFromArray","arr","target","index","findIndex","value","splice","castArray","result","Array","isArray","hasMinLength","n","length"],"mappings":";;;;AAgBO,SAASA,eAAAA,CAAmBC,KAAUC,MAAS,EAAA;AACpD,EAAA,MAAMC,QAAQF,GAAIG,CAAAA,SAAAA,CAAU,CAACC,KAAAA,KAAUA,UAAUH,MAAAA,CAAAA;AACjD,EAAA,IAAIC,UAAU,EAAI,EAAA;AAChB,IAAO,OAAA,KAAA;AACT;AAEAF,EAAIK,GAAAA,CAAAA,MAAAA,CAAOH,OAAO,CAAA,CAAA;AAClB,EAAO,OAAA,IAAA;AACT;AARgBH,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA;AAUT,SAASO,UAAaN,GAAM,EAAA;AACjC,EAAA,MAAMO,MAASC,GAAAA,KAAAA,CAAMC,OAAQT,CAAAA,GAAAA,IAAOA,GAAM,GAAA;AAACA,IAAAA;;AAC3C,EAAOO,OAAAA,MAAAA;AACT;AAHgBD,MAAAA,CAAAA,SAAAA,EAAAA,WAAAA,CAAAA;AAST,SAASI,YAAAA,CAAkCV,KAAUW,CAAI,EAAA;AAC9D,EAAA,OAAOX,IAAIY,MAAUD,IAAAA,CAAAA;AACvB;AAFgBD,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA","file":"array.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function removeFromArray<T>(arr: T[], target: T): boolean {\n const index = arr.findIndex((value) => value === target);\n if (index === -1) {\n return false;\n }\n\n arr.splice(index, 1);\n return true;\n}\n\nexport function castArray<T>(arr: T) {\n const result = Array.isArray(arr) ? arr : [arr];\n return result as T extends unknown[] ? T : [T];\n}\n\ntype HasMinLength<T, N extends number, T2 extends any[] = []> = T2[\"length\"] extends N\n ? [...T2, ...T[]]\n : HasMinLength<T, N, [any, ...T2]>;\n\nexport function hasMinLength<T, N extends number>(arr: T[], n: N): arr is HasMinLength<T, N> {\n return arr.length >= n;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/array.ts"],"names":["removeFromArray","arr","target","index","findIndex","value","splice","castArray","result","Array","isArray","hasMinLength","n","length"],"mappings":";;AAgBO,SAASA,eAAAA,CAAmBC,KAAUC,MAAS,EAAA;AACpD,EAAA,MAAMC,QAAQF,GAAIG,CAAAA,SAAAA,CAAU,CAACC,KAAAA,KAAUA,UAAUH,MAAAA,CAAAA;AACjD,EAAA,IAAIC,UAAU,CAAI,CAAA,EAAA;AAChB,IAAO,OAAA,KAAA;AACT;AAEAF,EAAIK,GAAAA,CAAAA,MAAAA,CAAOH,OAAO,CAAA,CAAA;AAClB,EAAO,OAAA,IAAA;AACT;AARgBH,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA;AAUT,SAASO,UAAaN,GAAM,EAAA;AACjC,EAAA,MAAMO,MAASC,GAAAA,KAAAA,CAAMC,OAAQT,CAAAA,GAAAA,IAAOA,GAAM,GAAA;AAACA,IAAAA;;AAC3C,EAAOO,OAAAA,MAAAA;AACT;AAHgBD,MAAAA,CAAAA,SAAAA,EAAAA,WAAAA,CAAAA;AAST,SAASI,YAAAA,CAAkCV,KAAUW,CAAI,EAAA;AAC9D,EAAA,OAAOX,IAAIY,MAAUD,IAAAA,CAAAA;AACvB;AAFgBD,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA","file":"array.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function removeFromArray<T>(arr: T[], target: T): boolean {\n const index = arr.findIndex((value) => value === target);\n if (index === -1) {\n return false;\n }\n\n arr.splice(index, 1);\n return true;\n}\n\nexport function castArray<T>(arr: T) {\n const result = Array.isArray(arr) ? arr : [arr];\n return result as T extends unknown[] ? T : [T];\n}\n\ntype HasMinLength<T, N extends number, T2 extends any[] = []> = T2[\"length\"] extends N\n ? [...T2, ...T[]]\n : HasMinLength<T, N, [any, ...T2]>;\n\nexport function hasMinLength<T, N extends number>(arr: T[], n: N): arr is HasMinLength<T, N> {\n return arr.length >= n;\n}\n"]}
1
+ {"version":3,"sources":["array.ts"],"names":["removeFromArray","arr","target","index","findIndex","value","splice","castArray","result","Array","isArray","hasMinLength","n","length"],"mappings":";;AAgBO,SAASA,eAAAA,CAAmBC,KAAUC,MAAS,EAAA;AACpD,EAAA,MAAMC,QAAQF,GAAIG,CAAAA,SAAAA,CAAU,CAACC,KAAAA,KAAUA,UAAUH,MAAAA,CAAAA;AACjD,EAAA,IAAIC,UAAU,EAAI,EAAA;AAChB,IAAO,OAAA,KAAA;AACT;AAEAF,EAAIK,GAAAA,CAAAA,MAAAA,CAAOH,OAAO,CAAA,CAAA;AAClB,EAAO,OAAA,IAAA;AACT;AARgBH,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA;AAUT,SAASO,UAAaN,GAAM,EAAA;AACjC,EAAA,MAAMO,MAASC,GAAAA,KAAAA,CAAMC,OAAQT,CAAAA,GAAAA,IAAOA,GAAM,GAAA;AAACA,IAAAA;;AAC3C,EAAOO,OAAAA,MAAAA;AACT;AAHgBD,MAAAA,CAAAA,SAAAA,EAAAA,WAAAA,CAAAA;AAST,SAASI,YAAAA,CAAkCV,KAAUW,CAAI,EAAA;AAC9D,EAAA,OAAOX,IAAIY,MAAUD,IAAAA,CAAAA;AACvB;AAFgBD,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA","file":"array.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function removeFromArray<T>(arr: T[], target: T): boolean {\n const index = arr.findIndex((value) => value === target);\n if (index === -1) {\n return false;\n }\n\n arr.splice(index, 1);\n return true;\n}\n\nexport function castArray<T>(arr: T) {\n const result = Array.isArray(arr) ? arr : [arr];\n return result as T extends unknown[] ? T : [T];\n}\n\ntype HasMinLength<T, N extends number, T2 extends any[] = []> = T2[\"length\"] extends N\n ? [...T2, ...T[]]\n : HasMinLength<T, N, [any, ...T2]>;\n\nexport function hasMinLength<T, N extends number>(arr: T[], n: N): arr is HasMinLength<T, N> {\n return arr.length >= n;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/cancellation.ts"],"names":["createAbortController","signals","controller","AbortController","registerSignals","forEach","signal","aborted","abort","reason","addEventListener","once"],"mappings":";;;;AAgBO,SAASA,yBAAyBC,OAAoC,EAAA;AAC3E,EAAMC,MAAAA,UAAAA,GAAa,IAAIC,eAAAA,EAAAA;AACvBC,EAAAA,eAAAA,CAAgBF,YAAYD,OAAAA,CAAAA;AAC5B,EAAOC,OAAAA,UAAAA;AACT;AAJgBF,MAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA;AAMT,SAASI,eAAAA,CAAgBF,YAA6BD,OAAoC,EAAA;AAC/FA,EAAQI,OAAAA,CAAAA,OAAAA,CAAQ,CAACC,MAAAA,KAAAA;AACf,IAAA,IAAIA,QAAQC,OAAS,EAAA;AACnBL,MAAWM,UAAAA,CAAAA,KAAAA,CAAMF,OAAOG,MAAM,CAAA;AAChC;AAEAH,IAAQI,MAAAA,EAAAA,gBAAAA,GACN,SACA,MAAA;AACER,MAAWM,UAAAA,CAAAA,KAAAA,CAAMF,QAAQG,MAAAA,CAAAA;KAE3B,EAAA;MACEE,IAAM,EAAA,IAAA;AACNL,MAAAA,MAAAA,EAAQJ,UAAWI,CAAAA;KACrB,CAAA;GAEJ,CAAA;AACF;AAjBgBF,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA","file":"cancellation.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function createAbortController(...signals: (AbortSignal | undefined)[]) {\n const controller = new AbortController();\n registerSignals(controller, signals);\n return controller;\n}\n\nexport function registerSignals(controller: AbortController, signals: (AbortSignal | undefined)[]) {\n signals.forEach((signal) => {\n if (signal?.aborted) {\n controller.abort(signal.reason);\n }\n\n signal?.addEventListener?.(\n \"abort\",\n () => {\n controller.abort(signal?.reason);\n },\n {\n once: true,\n signal: controller.signal,\n },\n );\n });\n}\n"]}
1
+ {"version":3,"sources":["cancellation.ts"],"names":["createAbortController","signals","controller","AbortController","registerSignals","forEach","signal","aborted","abort","reason","addEventListener","once"],"mappings":";;;;AAgBO,SAASA,yBAAyBC,OAAoC,EAAA;AAC3E,EAAMC,MAAAA,UAAAA,GAAa,IAAIC,eAAAA,EAAAA;AACvBC,EAAAA,eAAAA,CAAgBF,YAAYD,OAAAA,CAAAA;AAC5B,EAAOC,OAAAA,UAAAA;AACT;AAJgBF,MAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA;AAMT,SAASI,eAAAA,CAAgBF,YAA6BD,OAAoC,EAAA;AAC/FA,EAAQI,OAAAA,CAAAA,OAAAA,CAAQ,CAACC,MAAAA,KAAAA;AACf,IAAA,IAAIA,QAAQC,OAAS,EAAA;AACnBL,MAAWM,UAAAA,CAAAA,KAAAA,CAAMF,OAAOG,MAAM,CAAA;AAChC;AAEAH,IAAQI,MAAAA,EAAAA,gBAAAA,GACN,SACA,MAAA;AACER,MAAWM,UAAAA,CAAAA,KAAAA,CAAMF,QAAQG,MAAAA,CAAAA;KAE3B,EAAA;MACEE,IAAM,EAAA,IAAA;AACNL,MAAAA,MAAAA,EAAQJ,UAAWI,CAAAA;KACrB,CAAA;GAEJ,CAAA;AACF;AAjBgBF,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA","file":"cancellation.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function createAbortController(...signals: (AbortSignal | undefined)[]) {\n const controller = new AbortController();\n registerSignals(controller, signals);\n return controller;\n}\n\nexport function registerSignals(controller: AbortController, signals: (AbortSignal | undefined)[]) {\n signals.forEach((signal) => {\n if (signal?.aborted) {\n controller.abort(signal.reason);\n }\n\n signal?.addEventListener?.(\n \"abort\",\n () => {\n controller.abort(signal?.reason);\n },\n {\n once: true,\n signal: controller.signal,\n },\n );\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/cancellation.ts"],"names":["createAbortController","signals","controller","AbortController","registerSignals","forEach","signal","aborted","abort","reason","addEventListener","once"],"mappings":";;AAgBO,SAASA,yBAAyBC,OAAoC,EAAA;AAC3E,EAAMC,MAAAA,UAAAA,GAAa,IAAIC,eAAAA,EAAAA;AACvBC,EAAAA,eAAAA,CAAgBF,YAAYD,OAAAA,CAAAA;AAC5B,EAAOC,OAAAA,UAAAA;AACT;AAJgBF,MAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA;AAMT,SAASI,eAAAA,CAAgBF,YAA6BD,OAAoC,EAAA;AAC/FA,EAAQI,OAAAA,CAAAA,OAAAA,CAAQ,CAACC,MAAAA,KAAAA;AACf,IAAA,IAAIA,QAAQC,OAAS,EAAA;AACnBL,MAAWM,UAAAA,CAAAA,KAAAA,CAAMF,OAAOG,MAAM,CAAA;AAChC;AAEAH,IAAQI,MAAAA,EAAAA,gBAAAA,GACN,SACA,MAAA;AACER,MAAWM,UAAAA,CAAAA,KAAAA,CAAMF,QAAQG,MAAAA,CAAAA;KAE3B,EAAA;MACEE,IAAM,EAAA,IAAA;AACNL,MAAAA,MAAAA,EAAQJ,UAAWI,CAAAA;KACrB,CAAA;GAEJ,CAAA;AACF;AAjBgBF,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA","file":"cancellation.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function createAbortController(...signals: (AbortSignal | undefined)[]) {\n const controller = new AbortController();\n registerSignals(controller, signals);\n return controller;\n}\n\nexport function registerSignals(controller: AbortController, signals: (AbortSignal | undefined)[]) {\n signals.forEach((signal) => {\n if (signal?.aborted) {\n controller.abort(signal.reason);\n }\n\n signal?.addEventListener?.(\n \"abort\",\n () => {\n controller.abort(signal?.reason);\n },\n {\n once: true,\n signal: controller.signal,\n },\n );\n });\n}\n"]}
1
+ {"version":3,"sources":["cancellation.ts"],"names":["createAbortController","signals","controller","AbortController","registerSignals","forEach","signal","aborted","abort","reason","addEventListener","once"],"mappings":";;AAgBO,SAASA,yBAAyBC,OAAoC,EAAA;AAC3E,EAAMC,MAAAA,UAAAA,GAAa,IAAIC,eAAAA,EAAAA;AACvBC,EAAAA,eAAAA,CAAgBF,YAAYD,OAAAA,CAAAA;AAC5B,EAAOC,OAAAA,UAAAA;AACT;AAJgBF,MAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA;AAMT,SAASI,eAAAA,CAAgBF,YAA6BD,OAAoC,EAAA;AAC/FA,EAAQI,OAAAA,CAAAA,OAAAA,CAAQ,CAACC,MAAAA,KAAAA;AACf,IAAA,IAAIA,QAAQC,OAAS,EAAA;AACnBL,MAAWM,UAAAA,CAAAA,KAAAA,CAAMF,OAAOG,MAAM,CAAA;AAChC;AAEAH,IAAQI,MAAAA,EAAAA,gBAAAA,GACN,SACA,MAAA;AACER,MAAWM,UAAAA,CAAAA,KAAAA,CAAMF,QAAQG,MAAAA,CAAAA;KAE3B,EAAA;MACEE,IAAM,EAAA,IAAA;AACNL,MAAAA,MAAAA,EAAQJ,UAAWI,CAAAA;KACrB,CAAA;GAEJ,CAAA;AACF;AAjBgBF,MAAAA,CAAAA,eAAAA,EAAAA,iBAAAA,CAAAA","file":"cancellation.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function createAbortController(...signals: (AbortSignal | undefined)[]) {\n const controller = new AbortController();\n registerSignals(controller, signals);\n return controller;\n}\n\nexport function registerSignals(controller: AbortController, signals: (AbortSignal | undefined)[]) {\n signals.forEach((signal) => {\n if (signal?.aborted) {\n controller.abort(signal.reason);\n }\n\n signal?.addEventListener?.(\n \"abort\",\n () => {\n controller.abort(signal?.reason);\n },\n {\n once: true,\n signal: controller.signal,\n },\n );\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/counter.ts"],"names":["RetryCounter","Serializable","remaining","maxRetries","lastError","finalError","constructor","ErrorClass","use","error","undefined","isFatal","isRetryable","createSnapshot","loadSnapshot","snapshot","Object","assign"],"mappings":";;;;;;AAmBO,MAAMA,qBAAqBC,6BAAAA,CAAAA;EAnBlC;;;;AAoBSC,EAAAA,SAAAA;AACYC,EAAAA,UAAAA;AACTC,EAAAA,SAAAA;AACAC,EAAAA,UAAAA;EAEVC,WACEH,CAAAA,UAAAA,GAAa,GACHI,UACV,EAAA;AACA,IAAK,KAAA,EAAA,EAAA,KAFKA,UAAAA,GAAAA,UAAAA;AAGV,IAAA,IAAA,CAAKJ,UAAaA,GAAAA,UAAAA;AAClB,IAAA,IAAA,CAAKD,SAAYC,GAAAA,UAAAA;AACnB;AAEAK,EAAAA,GAAAA,CAAIC,KAAe,EAAA;AACjB,IAAA,IAAI,KAAKJ,UAAY,EAAA;AACnB,MAAA,MAAM,IAAKA,CAAAA,UAAAA;AACb;AAEA,IAAKD,IAAAA,CAAAA,SAAAA,GAAYK,SAAS,IAAKL,CAAAA,SAAAA;AAC/B,IAAKF,IAAAA,CAAAA,SAAAA,EAAAA;AACL,IAAI,IAAA,IAAA,CAAKA,YAAY,CAAG,EAAA;AACtB,MAAKG,IAAAA,CAAAA,UAAAA,GAAa,IAAI,IAAKE,CAAAA,UAAAA,CACzB,qCAAqC,IAAKJ,CAAAA,UAAU,CACpD,mBAAA,CAAA,EAAA,IAAA,CAAKC,SAAY,GAAA;QAAC,IAAKA,CAAAA;UAAaM,KACpC,CAAA,EAAA;QAAEC,OAAS,EAAA,IAAA;QAAMC,WAAa,EAAA;OAAM,CAAA;AAEtC,MAAA,MAAM,IAAKP,CAAAA,UAAAA;AACb;AACF;EAEAQ,cAAiB,GAAA;AACf,IAAO,OAAA;AACLX,MAAAA,SAAAA,EAAW,IAAKA,CAAAA,SAAAA;AAChBC,MAAAA,UAAAA,EAAY,IAAKA,CAAAA,UAAAA;AACjBC,MAAAA,SAAAA,EAAW,IAAKA,CAAAA,SAAAA;AAChBC,MAAAA,UAAAA,EAAY,IAAKA,CAAAA,UAAAA;AACjBE,MAAAA,UAAAA,EAAY,IAAKA,CAAAA;AACnB,KAAA;AACF;AAEAO,EAAAA,YAAAA,CAAaC,QAAkD,EAAA;AAC7DC,IAAOC,MAAAA,CAAAA,MAAAA,CAAO,MAAMF,QAAAA,CAAAA;AACtB;AACF","file":"counter.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FrameworkError } from \"@/errors.js\";\nimport { Serializable } from \"@/internals/serializable.js\";\n\nexport class RetryCounter extends Serializable {\n public remaining: number;\n protected readonly maxRetries: number;\n protected lastError?: Error;\n protected finalError?: Error;\n\n constructor(\n maxRetries = 0,\n protected ErrorClass: typeof FrameworkError,\n ) {\n super();\n this.maxRetries = maxRetries;\n this.remaining = maxRetries;\n }\n\n use(error?: Error) {\n if (this.finalError) {\n throw this.finalError;\n }\n\n this.lastError = error ?? this.lastError;\n this.remaining--;\n if (this.remaining < 0) {\n this.finalError = new this.ErrorClass(\n `Maximal amount of global retries (${this.maxRetries}) has been reached.`,\n this.lastError ? [this.lastError] : undefined,\n { isFatal: true, isRetryable: false },\n );\n throw this.finalError;\n }\n }\n\n createSnapshot() {\n return {\n remaining: this.remaining,\n maxRetries: this.maxRetries,\n lastError: this.lastError,\n finalError: this.finalError,\n ErrorClass: this.ErrorClass,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {\n Object.assign(this, snapshot);\n }\n}\n"]}
1
+ {"version":3,"sources":["counter.ts"],"names":["RetryCounter","Serializable","remaining","maxRetries","lastError","finalError","constructor","ErrorClass","use","error","undefined","isFatal","isRetryable","createSnapshot","loadSnapshot","snapshot","Object","assign"],"mappings":";;;;;;AAmBO,MAAMA,qBAAqBC,6BAAAA,CAAAA;EAnBlC;;;;AAoBSC,EAAAA,SAAAA;AACYC,EAAAA,UAAAA;AACTC,EAAAA,SAAAA;AACAC,EAAAA,UAAAA;EAEVC,WACEH,CAAAA,UAAAA,GAAa,GACHI,UACV,EAAA;AACA,IAAK,KAAA,EAAA,EAAA,KAFKA,UAAAA,GAAAA,UAAAA;AAGV,IAAA,IAAA,CAAKJ,UAAaA,GAAAA,UAAAA;AAClB,IAAA,IAAA,CAAKD,SAAYC,GAAAA,UAAAA;AACnB;AAEAK,EAAAA,GAAAA,CAAIC,KAAe,EAAA;AACjB,IAAA,IAAI,KAAKJ,UAAY,EAAA;AACnB,MAAA,MAAM,IAAKA,CAAAA,UAAAA;AACb;AAEA,IAAKD,IAAAA,CAAAA,SAAAA,GAAYK,SAAS,IAAKL,CAAAA,SAAAA;AAC/B,IAAKF,IAAAA,CAAAA,SAAAA,EAAAA;AACL,IAAI,IAAA,IAAA,CAAKA,YAAY,CAAG,EAAA;AACtB,MAAKG,IAAAA,CAAAA,UAAAA,GAAa,IAAI,IAAKE,CAAAA,UAAAA,CACzB,qCAAqC,IAAKJ,CAAAA,UAAU,CACpD,mBAAA,CAAA,EAAA,IAAA,CAAKC,SAAY,GAAA;QAAC,IAAKA,CAAAA;UAAaM,MACpC,EAAA;QAAEC,OAAS,EAAA,IAAA;QAAMC,WAAa,EAAA;OAAM,CAAA;AAEtC,MAAA,MAAM,IAAKP,CAAAA,UAAAA;AACb;AACF;EAEAQ,cAAiB,GAAA;AACf,IAAO,OAAA;AACLX,MAAAA,SAAAA,EAAW,IAAKA,CAAAA,SAAAA;AAChBC,MAAAA,UAAAA,EAAY,IAAKA,CAAAA,UAAAA;AACjBC,MAAAA,SAAAA,EAAW,IAAKA,CAAAA,SAAAA;AAChBC,MAAAA,UAAAA,EAAY,IAAKA,CAAAA,UAAAA;AACjBE,MAAAA,UAAAA,EAAY,IAAKA,CAAAA;AACnB,KAAA;AACF;AAEAO,EAAAA,YAAAA,CAAaC,QAAkD,EAAA;AAC7DC,IAAOC,MAAAA,CAAAA,MAAAA,CAAO,MAAMF,QAAAA,CAAAA;AACtB;AACF","file":"counter.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FrameworkError } from \"@/errors.js\";\nimport { Serializable } from \"@/internals/serializable.js\";\n\nexport class RetryCounter extends Serializable {\n public remaining: number;\n protected readonly maxRetries: number;\n protected lastError?: Error;\n protected finalError?: Error;\n\n constructor(\n maxRetries = 0,\n protected ErrorClass: typeof FrameworkError,\n ) {\n super();\n this.maxRetries = maxRetries;\n this.remaining = maxRetries;\n }\n\n use(error?: Error) {\n if (this.finalError) {\n throw this.finalError;\n }\n\n this.lastError = error ?? this.lastError;\n this.remaining--;\n if (this.remaining < 0) {\n this.finalError = new this.ErrorClass(\n `Maximal amount of global retries (${this.maxRetries}) has been reached.`,\n this.lastError ? [this.lastError] : undefined,\n { isFatal: true, isRetryable: false },\n );\n throw this.finalError;\n }\n }\n\n createSnapshot() {\n return {\n remaining: this.remaining,\n maxRetries: this.maxRetries,\n lastError: this.lastError,\n finalError: this.finalError,\n ErrorClass: this.ErrorClass,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {\n Object.assign(this, snapshot);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/counter.ts"],"names":["RetryCounter","Serializable","remaining","maxRetries","lastError","finalError","constructor","ErrorClass","use","error","undefined","isFatal","isRetryable","createSnapshot","loadSnapshot","snapshot","Object","assign"],"mappings":";;;;AAmBO,MAAMA,qBAAqBC,YAAAA,CAAAA;EAnBlC;;;;AAoBSC,EAAAA,SAAAA;AACYC,EAAAA,UAAAA;AACTC,EAAAA,SAAAA;AACAC,EAAAA,UAAAA;EAEVC,WACEH,CAAAA,UAAAA,GAAa,GACHI,UACV,EAAA;AACA,IAAK,KAAA,EAAA,EAAA,KAFKA,UAAAA,GAAAA,UAAAA;AAGV,IAAA,IAAA,CAAKJ,UAAaA,GAAAA,UAAAA;AAClB,IAAA,IAAA,CAAKD,SAAYC,GAAAA,UAAAA;AACnB;AAEAK,EAAAA,GAAAA,CAAIC,KAAe,EAAA;AACjB,IAAA,IAAI,KAAKJ,UAAY,EAAA;AACnB,MAAA,MAAM,IAAKA,CAAAA,UAAAA;AACb;AAEA,IAAKD,IAAAA,CAAAA,SAAAA,GAAYK,SAAS,IAAKL,CAAAA,SAAAA;AAC/B,IAAKF,IAAAA,CAAAA,SAAAA,EAAAA;AACL,IAAI,IAAA,IAAA,CAAKA,YAAY,CAAG,EAAA;AACtB,MAAKG,IAAAA,CAAAA,UAAAA,GAAa,IAAI,IAAKE,CAAAA,UAAAA,CACzB,qCAAqC,IAAKJ,CAAAA,UAAU,CACpD,mBAAA,CAAA,EAAA,IAAA,CAAKC,SAAY,GAAA;QAAC,IAAKA,CAAAA;UAAaM,KACpC,CAAA,EAAA;QAAEC,OAAS,EAAA,IAAA;QAAMC,WAAa,EAAA;OAAM,CAAA;AAEtC,MAAA,MAAM,IAAKP,CAAAA,UAAAA;AACb;AACF;EAEAQ,cAAiB,GAAA;AACf,IAAO,OAAA;AACLX,MAAAA,SAAAA,EAAW,IAAKA,CAAAA,SAAAA;AAChBC,MAAAA,UAAAA,EAAY,IAAKA,CAAAA,UAAAA;AACjBC,MAAAA,SAAAA,EAAW,IAAKA,CAAAA,SAAAA;AAChBC,MAAAA,UAAAA,EAAY,IAAKA,CAAAA,UAAAA;AACjBE,MAAAA,UAAAA,EAAY,IAAKA,CAAAA;AACnB,KAAA;AACF;AAEAO,EAAAA,YAAAA,CAAaC,QAAkD,EAAA;AAC7DC,IAAOC,MAAAA,CAAAA,MAAAA,CAAO,MAAMF,QAAAA,CAAAA;AACtB;AACF","file":"counter.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FrameworkError } from \"@/errors.js\";\nimport { Serializable } from \"@/internals/serializable.js\";\n\nexport class RetryCounter extends Serializable {\n public remaining: number;\n protected readonly maxRetries: number;\n protected lastError?: Error;\n protected finalError?: Error;\n\n constructor(\n maxRetries = 0,\n protected ErrorClass: typeof FrameworkError,\n ) {\n super();\n this.maxRetries = maxRetries;\n this.remaining = maxRetries;\n }\n\n use(error?: Error) {\n if (this.finalError) {\n throw this.finalError;\n }\n\n this.lastError = error ?? this.lastError;\n this.remaining--;\n if (this.remaining < 0) {\n this.finalError = new this.ErrorClass(\n `Maximal amount of global retries (${this.maxRetries}) has been reached.`,\n this.lastError ? [this.lastError] : undefined,\n { isFatal: true, isRetryable: false },\n );\n throw this.finalError;\n }\n }\n\n createSnapshot() {\n return {\n remaining: this.remaining,\n maxRetries: this.maxRetries,\n lastError: this.lastError,\n finalError: this.finalError,\n ErrorClass: this.ErrorClass,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {\n Object.assign(this, snapshot);\n }\n}\n"]}
1
+ {"version":3,"sources":["counter.ts"],"names":["RetryCounter","Serializable","remaining","maxRetries","lastError","finalError","constructor","ErrorClass","use","error","undefined","isFatal","isRetryable","createSnapshot","loadSnapshot","snapshot","Object","assign"],"mappings":";;;;AAmBO,MAAMA,qBAAqBC,YAAAA,CAAAA;EAnBlC;;;;AAoBSC,EAAAA,SAAAA;AACYC,EAAAA,UAAAA;AACTC,EAAAA,SAAAA;AACAC,EAAAA,UAAAA;EAEVC,WACEH,CAAAA,UAAAA,GAAa,GACHI,UACV,EAAA;AACA,IAAK,KAAA,EAAA,EAAA,KAFKA,UAAAA,GAAAA,UAAAA;AAGV,IAAA,IAAA,CAAKJ,UAAaA,GAAAA,UAAAA;AAClB,IAAA,IAAA,CAAKD,SAAYC,GAAAA,UAAAA;AACnB;AAEAK,EAAAA,GAAAA,CAAIC,KAAe,EAAA;AACjB,IAAA,IAAI,KAAKJ,UAAY,EAAA;AACnB,MAAA,MAAM,IAAKA,CAAAA,UAAAA;AACb;AAEA,IAAKD,IAAAA,CAAAA,SAAAA,GAAYK,SAAS,IAAKL,CAAAA,SAAAA;AAC/B,IAAKF,IAAAA,CAAAA,SAAAA,EAAAA;AACL,IAAI,IAAA,IAAA,CAAKA,YAAY,CAAG,EAAA;AACtB,MAAKG,IAAAA,CAAAA,UAAAA,GAAa,IAAI,IAAKE,CAAAA,UAAAA,CACzB,qCAAqC,IAAKJ,CAAAA,UAAU,CACpD,mBAAA,CAAA,EAAA,IAAA,CAAKC,SAAY,GAAA;QAAC,IAAKA,CAAAA;UAAaM,MACpC,EAAA;QAAEC,OAAS,EAAA,IAAA;QAAMC,WAAa,EAAA;OAAM,CAAA;AAEtC,MAAA,MAAM,IAAKP,CAAAA,UAAAA;AACb;AACF;EAEAQ,cAAiB,GAAA;AACf,IAAO,OAAA;AACLX,MAAAA,SAAAA,EAAW,IAAKA,CAAAA,SAAAA;AAChBC,MAAAA,UAAAA,EAAY,IAAKA,CAAAA,UAAAA;AACjBC,MAAAA,SAAAA,EAAW,IAAKA,CAAAA,SAAAA;AAChBC,MAAAA,UAAAA,EAAY,IAAKA,CAAAA,UAAAA;AACjBE,MAAAA,UAAAA,EAAY,IAAKA,CAAAA;AACnB,KAAA;AACF;AAEAO,EAAAA,YAAAA,CAAaC,QAAkD,EAAA;AAC7DC,IAAOC,MAAAA,CAAAA,MAAAA,CAAO,MAAMF,QAAAA,CAAAA;AACtB;AACF","file":"counter.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FrameworkError } from \"@/errors.js\";\nimport { Serializable } from \"@/internals/serializable.js\";\n\nexport class RetryCounter extends Serializable {\n public remaining: number;\n protected readonly maxRetries: number;\n protected lastError?: Error;\n protected finalError?: Error;\n\n constructor(\n maxRetries = 0,\n protected ErrorClass: typeof FrameworkError,\n ) {\n super();\n this.maxRetries = maxRetries;\n this.remaining = maxRetries;\n }\n\n use(error?: Error) {\n if (this.finalError) {\n throw this.finalError;\n }\n\n this.lastError = error ?? this.lastError;\n this.remaining--;\n if (this.remaining < 0) {\n this.finalError = new this.ErrorClass(\n `Maximal amount of global retries (${this.maxRetries}) has been reached.`,\n this.lastError ? [this.lastError] : undefined,\n { isFatal: true, isRetryable: false },\n );\n throw this.finalError;\n }\n }\n\n createSnapshot() {\n return {\n remaining: this.remaining,\n maxRetries: this.maxRetries,\n lastError: this.lastError,\n finalError: this.finalError,\n ErrorClass: this.ErrorClass,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {\n Object.assign(this, snapshot);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/general.ts"],"names":["sleep","ms","signal","start","Date","now","ctx","iteration","elapsed","setTimeout","validate","value","schema","parse"],"mappings":";;;;;;AAmBA,gBAAuBA,KAAAA,CAAMC,IAAYC,MAAoB,EAAA;AAC3D,EAAMC,MAAAA,KAAAA,GAAQC,KAAKC,GAAG,EAAA;AACtB,EAAA,MAAMC,GAAM,GAAA;IAAEC,SAAW,EAAA,CAAA;IAAGC,OAAS,EAAA;AAAE,GAAA;AACvC,EAAA,OAAO,IAAM,EAAA;AACX,IAAA,MAAMC,oBAAWR,EAAI,EAAA;AACnBC,MAAAA;KACF,CAAA;AACAI,IAAIE,GAAAA,CAAAA,OAAAA,GAAUJ,IAAKC,CAAAA,GAAAA,EAAQF,GAAAA,KAAAA;AAC3BG,IAAIC,GAAAA,CAAAA,SAAAA,EAAAA;AACJ,IAAMD,MAAAA,GAAAA;AACR;AACF;AAXuBN,MAAAA,CAAAA,KAAAA,EAAAA,OAAAA,CAAAA;AAahB,SAASU,QAAAA,CAAYC,OAAgBC,MAAkB,EAAA;AAC5DA,EAAAA,MAAAA,CAAOC,MAAMF,KAAAA,CAAAA;AACf;AAFgBD,MAAAA,CAAAA,QAAAA,EAAAA,UAAAA,CAAAA","file":"general.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { setTimeout } from \"node:timers/promises\";\nimport { ZodType } from \"zod\";\n\nexport async function* sleep(ms: number, signal?: AbortSignal) {\n const start = Date.now();\n const ctx = { iteration: 0, elapsed: 0 };\n while (true) {\n await setTimeout(ms, {\n signal,\n });\n ctx.elapsed = Date.now() - start;\n ctx.iteration++;\n yield ctx;\n }\n}\n\nexport function validate<T>(value: unknown, schema: ZodType<T>): asserts value is T {\n schema.parse(value);\n}\n"]}
1
+ {"version":3,"sources":["general.ts"],"names":["sleep","ms","signal","start","Date","now","ctx","iteration","elapsed","setTimeout","validate","value","schema","parse"],"mappings":";;;;;;AAmBA,gBAAuBA,KAAAA,CAAMC,IAAYC,MAAoB,EAAA;AAC3D,EAAMC,MAAAA,KAAAA,GAAQC,KAAKC,GAAG,EAAA;AACtB,EAAA,MAAMC,GAAM,GAAA;IAAEC,SAAW,EAAA,CAAA;IAAGC,OAAS,EAAA;AAAE,GAAA;AACvC,EAAA,OAAO,IAAM,EAAA;AACX,IAAA,MAAMC,oBAAWR,EAAI,EAAA;AACnBC,MAAAA;KACF,CAAA;AACAI,IAAIE,GAAAA,CAAAA,OAAAA,GAAUJ,IAAKC,CAAAA,GAAAA,EAAQF,GAAAA,KAAAA;AAC3BG,IAAIC,GAAAA,CAAAA,SAAAA,EAAAA;AACJ,IAAMD,MAAAA,GAAAA;AACR;AACF;AAXuBN,MAAAA,CAAAA,KAAAA,EAAAA,OAAAA,CAAAA;AAahB,SAASU,QAAAA,CAAYC,OAAgBC,MAAkB,EAAA;AAC5DA,EAAAA,MAAAA,CAAOC,MAAMF,KAAAA,CAAAA;AACf;AAFgBD,MAAAA,CAAAA,QAAAA,EAAAA,UAAAA,CAAAA","file":"general.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { setTimeout } from \"node:timers/promises\";\nimport { ZodType } from \"zod\";\n\nexport async function* sleep(ms: number, signal?: AbortSignal) {\n const start = Date.now();\n const ctx = { iteration: 0, elapsed: 0 };\n while (true) {\n await setTimeout(ms, {\n signal,\n });\n ctx.elapsed = Date.now() - start;\n ctx.iteration++;\n yield ctx;\n }\n}\n\nexport function validate<T>(value: unknown, schema: ZodType<T>): asserts value is T {\n schema.parse(value);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/general.ts"],"names":["sleep","ms","signal","start","Date","now","ctx","iteration","elapsed","setTimeout","validate","value","schema","parse"],"mappings":";;;;AAmBA,gBAAuBA,KAAAA,CAAMC,IAAYC,MAAoB,EAAA;AAC3D,EAAMC,MAAAA,KAAAA,GAAQC,KAAKC,GAAG,EAAA;AACtB,EAAA,MAAMC,GAAM,GAAA;IAAEC,SAAW,EAAA,CAAA;IAAGC,OAAS,EAAA;AAAE,GAAA;AACvC,EAAA,OAAO,IAAM,EAAA;AACX,IAAA,MAAMC,WAAWR,EAAI,EAAA;AACnBC,MAAAA;KACF,CAAA;AACAI,IAAIE,GAAAA,CAAAA,OAAAA,GAAUJ,IAAKC,CAAAA,GAAAA,EAAQF,GAAAA,KAAAA;AAC3BG,IAAIC,GAAAA,CAAAA,SAAAA,EAAAA;AACJ,IAAMD,MAAAA,GAAAA;AACR;AACF;AAXuBN,MAAAA,CAAAA,KAAAA,EAAAA,OAAAA,CAAAA;AAahB,SAASU,QAAAA,CAAYC,OAAgBC,MAAkB,EAAA;AAC5DA,EAAAA,MAAAA,CAAOC,MAAMF,KAAAA,CAAAA;AACf;AAFgBD,MAAAA,CAAAA,QAAAA,EAAAA,UAAAA,CAAAA","file":"general.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { setTimeout } from \"node:timers/promises\";\nimport { ZodType } from \"zod\";\n\nexport async function* sleep(ms: number, signal?: AbortSignal) {\n const start = Date.now();\n const ctx = { iteration: 0, elapsed: 0 };\n while (true) {\n await setTimeout(ms, {\n signal,\n });\n ctx.elapsed = Date.now() - start;\n ctx.iteration++;\n yield ctx;\n }\n}\n\nexport function validate<T>(value: unknown, schema: ZodType<T>): asserts value is T {\n schema.parse(value);\n}\n"]}
1
+ {"version":3,"sources":["general.ts"],"names":["sleep","ms","signal","start","Date","now","ctx","iteration","elapsed","setTimeout","validate","value","schema","parse"],"mappings":";;;;AAmBA,gBAAuBA,KAAAA,CAAMC,IAAYC,MAAoB,EAAA;AAC3D,EAAMC,MAAAA,KAAAA,GAAQC,KAAKC,GAAG,EAAA;AACtB,EAAA,MAAMC,GAAM,GAAA;IAAEC,SAAW,EAAA,CAAA;IAAGC,OAAS,EAAA;AAAE,GAAA;AACvC,EAAA,OAAO,IAAM,EAAA;AACX,IAAA,MAAMC,WAAWR,EAAI,EAAA;AACnBC,MAAAA;KACF,CAAA;AACAI,IAAIE,GAAAA,CAAAA,OAAAA,GAAUJ,IAAKC,CAAAA,GAAAA,EAAQF,GAAAA,KAAAA;AAC3BG,IAAIC,GAAAA,CAAAA,SAAAA,EAAAA;AACJ,IAAMD,MAAAA,GAAAA;AACR;AACF;AAXuBN,MAAAA,CAAAA,KAAAA,EAAAA,OAAAA,CAAAA;AAahB,SAASU,QAAAA,CAAYC,OAAgBC,MAAkB,EAAA;AAC5DA,EAAAA,MAAAA,CAAOC,MAAMF,KAAAA,CAAAA;AACf;AAFgBD,MAAAA,CAAAA,QAAAA,EAAAA,UAAAA,CAAAA","file":"general.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { setTimeout } from \"node:timers/promises\";\nimport { ZodType } from \"zod\";\n\nexport async function* sleep(ms: number, signal?: AbortSignal) {\n const start = Date.now();\n const ctx = { iteration: 0, elapsed: 0 };\n while (true) {\n await setTimeout(ms, {\n signal,\n });\n ctx.elapsed = Date.now() - start;\n ctx.iteration++;\n yield ctx;\n }\n}\n\nexport function validate<T>(value: unknown, schema: ZodType<T>): asserts value is T {\n schema.parse(value);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/guards.ts"],"names":["isPrimitive","value","R","isString","isNumber","isBoolean","isNullish","isSymbol"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,SAASA,YAAYC,KAAc,EAAA;AACxC,EAAA,OACEC,aAAEC,QAASF,CAAAA,KAAAA,KACXC,YAAEE,CAAAA,QAAAA,CAASH,KAAAA,CACXC,IAAAA,YAAAA,CAAEG,SAAUJ,CAAAA,KAAAA,KACZC,YAAEI,CAAAA,SAAAA,CAAUL,KAAAA,CACZC,IAAAA,YAAAA,CAAEK,SAASN,KAAAA,CAAAA;AAEf;AARgBD,MAAAA,CAAAA,WAAAA,EAAAA,aAAAA,CAAAA","file":"guards.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as R from \"remeda\";\n\nexport type Primitive = string | number | symbol | bigint | boolean | null | undefined;\nexport function isPrimitive(value: unknown): value is Primitive {\n return (\n R.isString(value) ||\n R.isNumber(value) ||\n R.isBoolean(value) ||\n R.isNullish(value) ||\n R.isSymbol(value)\n );\n}\n"]}
1
+ {"version":3,"sources":["guards.ts"],"names":["isPrimitive","value","R","isString","isNumber","isBoolean","isNullish","isSymbol"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,SAASA,YAAYC,KAAc,EAAA;AACxC,EAAA,OACEC,aAAEC,QAASF,CAAAA,KAAAA,KACXC,YAAEE,CAAAA,QAAAA,CAASH,KAAAA,CACXC,IAAAA,YAAAA,CAAEG,SAAUJ,CAAAA,KAAAA,KACZC,YAAEI,CAAAA,SAAAA,CAAUL,KAAAA,CACZC,IAAAA,YAAAA,CAAEK,SAASN,KAAAA,CAAAA;AAEf;AARgBD,MAAAA,CAAAA,WAAAA,EAAAA,aAAAA,CAAAA","file":"guards.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as R from \"remeda\";\n\nexport type Primitive = string | number | symbol | bigint | boolean | null | undefined;\nexport function isPrimitive(value: unknown): value is Primitive {\n return (\n R.isString(value) ||\n R.isNumber(value) ||\n R.isBoolean(value) ||\n R.isNullish(value) ||\n R.isSymbol(value)\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/guards.ts"],"names":["isPrimitive","value","R","isString","isNumber","isBoolean","isNullish","isSymbol"],"mappings":";;;;AAmBO,SAASA,YAAYC,KAAc,EAAA;AACxC,EAAA,OACEC,EAAEC,QAASF,CAAAA,KAAAA,KACXC,CAAEE,CAAAA,QAAAA,CAASH,KAAAA,CACXC,IAAAA,CAAAA,CAAEG,SAAUJ,CAAAA,KAAAA,KACZC,CAAEI,CAAAA,SAAAA,CAAUL,KAAAA,CACZC,IAAAA,CAAAA,CAAEK,SAASN,KAAAA,CAAAA;AAEf;AARgBD,MAAAA,CAAAA,WAAAA,EAAAA,aAAAA,CAAAA","file":"guards.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as R from \"remeda\";\n\nexport type Primitive = string | number | symbol | bigint | boolean | null | undefined;\nexport function isPrimitive(value: unknown): value is Primitive {\n return (\n R.isString(value) ||\n R.isNumber(value) ||\n R.isBoolean(value) ||\n R.isNullish(value) ||\n R.isSymbol(value)\n );\n}\n"]}
1
+ {"version":3,"sources":["guards.ts"],"names":["isPrimitive","value","R","isString","isNumber","isBoolean","isNullish","isSymbol"],"mappings":";;;;AAmBO,SAASA,YAAYC,KAAc,EAAA;AACxC,EAAA,OACEC,EAAEC,QAASF,CAAAA,KAAAA,KACXC,CAAEE,CAAAA,QAAAA,CAASH,KAAAA,CACXC,IAAAA,CAAAA,CAAEG,SAAUJ,CAAAA,KAAAA,KACZC,CAAEI,CAAAA,SAAAA,CAAUL,KAAAA,CACZC,IAAAA,CAAAA,CAAEK,SAASN,KAAAA,CAAAA;AAEf;AARgBD,MAAAA,CAAAA,WAAAA,EAAAA,aAAAA,CAAAA","file":"guards.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as R from \"remeda\";\n\nexport type Primitive = string | number | symbol | bigint | boolean | null | undefined;\nexport function isPrimitive(value: unknown): value is Primitive {\n return (\n R.isString(value) ||\n R.isNumber(value) ||\n R.isBoolean(value) ||\n R.isNullish(value) ||\n R.isSymbol(value)\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/hash.ts"],"names":["createHash","input","length","NotImplementedError","_createHash","update","digest","slice","createRandomHash","randomBytes","toString"],"mappings":";;;;;;;AAmBO,SAASA,UAAAA,CAAWC,KAAeC,EAAAA,MAAAA,GAAS,CAAC,EAAA;AAClD,EAAA,IAAIA,SAAS,EAAI,EAAA;AACf,IAAM,MAAA,IAAIC,+BAAoB,iCAAA,CAAA;AAChC;AAEA,EAAA,OAAOC,sBAAY,CAAA,QAAA,CAChBC,CAAAA,MAAAA,CAAOJ,KAAAA,CAAAA,CACPK,MAAO,CAAA,KAAA,CACPC,CAAAA,KAAAA,CAAM,CAAGL,EAAAA,MAAAA,GAAS,CAAA,CAAA;AACvB;AATgBF,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA;AAWT,SAASQ,gBAAAA,CAAiBN,SAAS,CAAC,EAAA;AACzC,EAAA,OAAOF,WAAWS,uBAAY,CAAA,EAAA,EAAIC,QAAS,CAAA,QAAA,GAAWR,MAAAA,CAAAA;AACxD;AAFgBM,MAAAA,CAAAA,gBAAAA,EAAAA,kBAAAA,CAAAA","file":"hash.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createHash as _createHash, randomBytes } from \"node:crypto\";\nimport { NotImplementedError } from \"@/errors.js\";\n\nexport function createHash(input: string, length = 4) {\n if (length > 32) {\n throw new NotImplementedError(\"Max supported hash length is 32\");\n }\n\n return _createHash(\"sha256\")\n .update(input)\n .digest(\"hex\")\n .slice(0, length * 2);\n}\n\nexport function createRandomHash(length = 4) {\n return createHash(randomBytes(20).toString(\"base64\"), length);\n}\n"]}
1
+ {"version":3,"sources":["hash.ts"],"names":["createHash","input","length","NotImplementedError","_createHash","update","digest","slice","createRandomHash","randomBytes","toString"],"mappings":";;;;;;;AAmBO,SAASA,UAAAA,CAAWC,KAAeC,EAAAA,MAAAA,GAAS,CAAC,EAAA;AAClD,EAAA,IAAIA,SAAS,EAAI,EAAA;AACf,IAAM,MAAA,IAAIC,+BAAoB,iCAAA,CAAA;AAChC;AAEA,EAAA,OAAOC,sBAAY,CAAA,QAAA,CAChBC,CAAAA,MAAAA,CAAOJ,KAAAA,CAAAA,CACPK,MAAO,CAAA,KAAA,CACPC,CAAAA,KAAAA,CAAM,CAAGL,EAAAA,MAAAA,GAAS,CAAA,CAAA;AACvB;AATgBF,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA;AAWT,SAASQ,gBAAAA,CAAiBN,SAAS,CAAC,EAAA;AACzC,EAAA,OAAOF,WAAWS,uBAAY,CAAA,EAAA,EAAIC,QAAS,CAAA,QAAA,GAAWR,MAAAA,CAAAA;AACxD;AAFgBM,MAAAA,CAAAA,gBAAAA,EAAAA,kBAAAA,CAAAA","file":"hash.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createHash as _createHash, randomBytes } from \"node:crypto\";\nimport { NotImplementedError } from \"@/errors.js\";\n\nexport function createHash(input: string, length = 4) {\n if (length > 32) {\n throw new NotImplementedError(\"Max supported hash length is 32\");\n }\n\n return _createHash(\"sha256\")\n .update(input)\n .digest(\"hex\")\n .slice(0, length * 2);\n}\n\nexport function createRandomHash(length = 4) {\n return createHash(randomBytes(20).toString(\"base64\"), length);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/hash.ts"],"names":["createHash","input","length","NotImplementedError","_createHash","update","digest","slice","createRandomHash","randomBytes","toString"],"mappings":";;;;;AAmBO,SAASA,UAAAA,CAAWC,KAAeC,EAAAA,MAAAA,GAAS,CAAC,EAAA;AAClD,EAAA,IAAIA,SAAS,EAAI,EAAA;AACf,IAAM,MAAA,IAAIC,oBAAoB,iCAAA,CAAA;AAChC;AAEA,EAAA,OAAOC,YAAY,CAAA,QAAA,CAChBC,CAAAA,MAAAA,CAAOJ,KAAAA,CAAAA,CACPK,MAAO,CAAA,KAAA,CACPC,CAAAA,KAAAA,CAAM,CAAGL,EAAAA,MAAAA,GAAS,CAAA,CAAA;AACvB;AATgBF,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA;AAWT,SAASQ,gBAAAA,CAAiBN,SAAS,CAAC,EAAA;AACzC,EAAA,OAAOF,WAAWS,WAAY,CAAA,EAAA,EAAIC,QAAS,CAAA,QAAA,GAAWR,MAAAA,CAAAA;AACxD;AAFgBM,MAAAA,CAAAA,gBAAAA,EAAAA,kBAAAA,CAAAA","file":"hash.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createHash as _createHash, randomBytes } from \"node:crypto\";\nimport { NotImplementedError } from \"@/errors.js\";\n\nexport function createHash(input: string, length = 4) {\n if (length > 32) {\n throw new NotImplementedError(\"Max supported hash length is 32\");\n }\n\n return _createHash(\"sha256\")\n .update(input)\n .digest(\"hex\")\n .slice(0, length * 2);\n}\n\nexport function createRandomHash(length = 4) {\n return createHash(randomBytes(20).toString(\"base64\"), length);\n}\n"]}
1
+ {"version":3,"sources":["hash.ts"],"names":["createHash","input","length","NotImplementedError","_createHash","update","digest","slice","createRandomHash","randomBytes","toString"],"mappings":";;;;;AAmBO,SAASA,UAAAA,CAAWC,KAAeC,EAAAA,MAAAA,GAAS,CAAC,EAAA;AAClD,EAAA,IAAIA,SAAS,EAAI,EAAA;AACf,IAAM,MAAA,IAAIC,oBAAoB,iCAAA,CAAA;AAChC;AAEA,EAAA,OAAOC,YAAY,CAAA,QAAA,CAChBC,CAAAA,MAAAA,CAAOJ,KAAAA,CAAAA,CACPK,MAAO,CAAA,KAAA,CACPC,CAAAA,KAAAA,CAAM,CAAGL,EAAAA,MAAAA,GAAS,CAAA,CAAA;AACvB;AATgBF,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA;AAWT,SAASQ,gBAAAA,CAAiBN,SAAS,CAAC,EAAA;AACzC,EAAA,OAAOF,WAAWS,WAAY,CAAA,EAAA,EAAIC,QAAS,CAAA,QAAA,GAAWR,MAAAA,CAAAA;AACxD;AAFgBM,MAAAA,CAAAA,gBAAAA,EAAAA,kBAAAA,CAAAA","file":"hash.js","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createHash as _createHash, randomBytes } from \"node:crypto\";\nimport { NotImplementedError } from \"@/errors.js\";\n\nexport function createHash(input: string, length = 4) {\n if (length > 32) {\n throw new NotImplementedError(\"Max supported hash length is 32\");\n }\n\n return _createHash(\"sha256\")\n .update(input)\n .digest(\"hex\")\n .slice(0, length * 2);\n}\n\nexport function createRandomHash(length = 4) {\n return createHash(randomBytes(20).toString(\"base64\"), length);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internals/helpers/map.ts"],"names":["findUniqueKey","baseKey","map","key","i","has","concat","String"],"mappings":";;;;AAgBO,SAASA,aAAAA,CAAcC,SAAiBC,GAAyB,EAAA;AACtE,EAAA,IAAIC,GAAMF,GAAAA,OAAAA;AACV,EAAA,KAAA,IAASG,IAAI,CAAGF,EAAAA,GAAAA,CAAIG,GAAIF,CAAAA,GAAAA,GAAMC,CAAK,EAAA,EAAA;AACjCD,IAAAA,GAAAA,GAAMF,OAAQK,CAAAA,MAAAA,CAAOC,MAAOH,CAAAA,CAAAA,CAAAA,CAAAA;AAC9B;AACA,EAAOD,OAAAA,GAAAA;AACT;AANgBH,MAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"map.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function findUniqueKey(baseKey: string, map: Map<string, unknown>) {\n let key = baseKey;\n for (let i = 1; map.has(key); i++) {\n key = baseKey.concat(String(i));\n }\n return key;\n}\n"]}
1
+ {"version":3,"sources":["map.ts"],"names":["findUniqueKey","baseKey","map","key","i","has","concat","String"],"mappings":";;;;AAgBO,SAASA,aAAAA,CAAcC,SAAiBC,GAAyB,EAAA;AACtE,EAAA,IAAIC,GAAMF,GAAAA,OAAAA;AACV,EAAA,KAAA,IAASG,IAAI,CAAGF,EAAAA,GAAAA,CAAIG,GAAIF,CAAAA,GAAAA,GAAMC,CAAK,EAAA,EAAA;AACjCD,IAAAA,GAAAA,GAAMF,OAAQK,CAAAA,MAAAA,CAAOC,MAAOH,CAAAA,CAAAA,CAAAA,CAAAA;AAC9B;AACA,EAAOD,OAAAA,GAAAA;AACT;AANgBH,MAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"map.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function findUniqueKey(baseKey: string, map: Map<string, unknown>) {\n let key = baseKey;\n for (let i = 1; map.has(key); i++) {\n key = baseKey.concat(String(i));\n }\n return key;\n}\n"]}