mavenagi 0.0.0-alpha.2 → 0.0.0-alpha.20

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 (779) hide show
  1. package/Client.d.ts +21 -0
  2. package/Client.js +20 -0
  3. package/README.md +70 -16
  4. package/api/resources/actions/client/Client.d.ts +96 -0
  5. package/api/resources/actions/client/Client.js +316 -0
  6. package/api/resources/actions/client/index.d.ts +1 -0
  7. package/api/resources/actions/client/index.js +1 -0
  8. package/api/resources/actions/index.d.ts +2 -0
  9. package/api/resources/actions/index.js +2 -0
  10. package/api/resources/actions/types/ActionBase.d.ts +18 -0
  11. package/api/resources/actions/types/ActionParameter.d.ts +9 -0
  12. package/api/resources/actions/types/ActionRequest.d.ts +31 -0
  13. package/api/resources/actions/types/ActionResponse.d.ts +35 -0
  14. package/api/resources/actions/types/ConversationExecutedActionPrecondition.d.ts +12 -0
  15. package/api/resources/actions/types/ConversationPrecondition.d.ts +20 -0
  16. package/api/resources/actions/types/MetadataPrecondition.d.ts +12 -0
  17. package/api/resources/actions/types/Precondition.d.ts +31 -0
  18. package/api/resources/actions/types/PreconditionGroup.d.ts +8 -0
  19. package/api/resources/actions/types/PreconditionGroupOperator.d.ts +8 -0
  20. package/api/resources/actions/types/PreconditionGroupOperator.js +7 -0
  21. package/api/resources/actions/types/PreconditionOperator.d.ts +7 -0
  22. package/api/resources/{knowledge/types/IdBody.d.ts → actions/types/PreconditionOperator.js} +3 -3
  23. package/api/resources/actions/types/index.d.ts +11 -0
  24. package/api/resources/actions/types/index.js +11 -0
  25. package/api/resources/appSettings/client/Client.d.ts +47 -0
  26. package/api/resources/appSettings/client/Client.js +124 -0
  27. package/api/resources/appSettings/client/index.d.ts +1 -0
  28. package/api/resources/appSettings/client/index.js +1 -0
  29. package/api/resources/appSettings/index.d.ts +1 -0
  30. package/api/resources/appSettings/index.js +1 -0
  31. package/api/resources/commons/errors/{AgentNotFoundError.d.ts → BadRequestError.d.ts} +1 -1
  32. package/api/resources/{conversation/errors/EmptyConversationError.js → commons/errors/BadRequestError.js} +3 -3
  33. package/{dist/api/resources/commons/errors/AgentNotFoundError.d.ts → api/resources/commons/errors/NotFoundError.d.ts} +1 -1
  34. package/{dist/api/resources/commons/errors/AgentNotFoundError.js → api/resources/commons/errors/NotFoundError.js} +3 -3
  35. package/api/resources/{conversation/errors/EmptyConversationError.d.ts → commons/errors/ServerError.d.ts} +1 -1
  36. package/api/resources/commons/errors/ServerError.js +14 -0
  37. package/api/resources/commons/errors/index.d.ts +3 -1
  38. package/api/resources/commons/errors/index.js +3 -1
  39. package/api/resources/commons/types/AppUser.d.ts +9 -0
  40. package/api/resources/commons/types/AppUserIdentifier.d.ts +9 -0
  41. package/api/resources/commons/types/AppUserIdentifyingPropertyType.d.ts +8 -0
  42. package/api/resources/commons/types/AppUserIdentifyingPropertyType.js +7 -0
  43. package/api/resources/commons/types/AppUserRequest.d.ts +26 -0
  44. package/api/resources/commons/types/AppUserResponse.d.ts +42 -0
  45. package/api/resources/commons/types/EntityId.d.ts +14 -0
  46. package/api/resources/commons/types/EntityIdBase.d.ts +10 -0
  47. package/api/resources/commons/types/EntityType.d.ts +16 -0
  48. package/api/resources/commons/types/EntityType.js +15 -0
  49. package/api/resources/commons/types/EventTriggerBase.d.ts +10 -0
  50. package/api/resources/commons/types/EventTriggerResponse.d.ts +22 -0
  51. package/api/resources/commons/types/EventTriggerResponse.js +4 -0
  52. package/api/resources/commons/types/EventTriggerType.d.ts +8 -0
  53. package/api/resources/commons/types/EventTriggerType.js +7 -0
  54. package/api/resources/commons/types/Feedback.d.ts +12 -0
  55. package/api/resources/commons/types/Feedback.js +4 -0
  56. package/api/resources/commons/types/FeedbackBase.d.ts +10 -0
  57. package/api/resources/commons/types/FeedbackBase.js +4 -0
  58. package/api/resources/{conversation → commons}/types/FeedbackType.d.ts +3 -1
  59. package/{dist/api/resources/conversation → api/resources/commons}/types/FeedbackType.js +2 -0
  60. package/api/resources/commons/types/UserData.d.ts +10 -0
  61. package/api/resources/commons/types/UserData.js +4 -0
  62. package/api/resources/commons/types/VisibilityType.d.ts +9 -0
  63. package/api/resources/commons/types/VisibilityType.js +8 -0
  64. package/api/resources/commons/types/index.d.ts +16 -1
  65. package/api/resources/commons/types/index.js +16 -1
  66. package/api/resources/conversation/client/Client.d.ts +136 -42
  67. package/api/resources/conversation/client/Client.js +451 -130
  68. package/api/resources/conversation/index.d.ts +0 -1
  69. package/api/resources/conversation/index.js +0 -1
  70. package/api/resources/conversation/types/ActionFormField.d.ts +1 -0
  71. package/api/resources/conversation/types/AskRequest.d.ts +15 -3
  72. package/api/resources/conversation/types/AskStreamActionEvent.d.ts +6 -0
  73. package/api/resources/conversation/types/AskStreamActionEvent.js +4 -0
  74. package/api/resources/conversation/types/AskStreamStartEvent.d.ts +2 -1
  75. package/api/resources/conversation/types/AskStreamTextEvent.d.ts +1 -0
  76. package/api/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
  77. package/api/resources/conversation/types/BotMessage.d.ts +2 -0
  78. package/api/resources/conversation/types/Capability.d.ts +18 -0
  79. package/api/resources/conversation/types/Capability.js +8 -0
  80. package/{dist/api/resources/knowledge/types/IdBody.d.ts → api/resources/conversation/types/CategorizationResponse.d.ts} +2 -2
  81. package/api/resources/conversation/types/CategorizationResponse.js +4 -0
  82. package/api/resources/conversation/types/ConversationAnalysis.d.ts +12 -0
  83. package/api/resources/conversation/types/ConversationAnalysis.js +4 -0
  84. package/api/resources/conversation/types/ConversationBase.d.ts +14 -4
  85. package/api/resources/conversation/types/ConversationMessageBase.d.ts +4 -5
  86. package/api/resources/conversation/types/ConversationMessageRequest.d.ts +3 -1
  87. package/api/resources/conversation/types/ConversationRequest.d.ts +2 -0
  88. package/api/resources/conversation/types/ConversationResponse.d.ts +4 -0
  89. package/api/resources/conversation/types/FeedbackRequest.d.ts +7 -7
  90. package/api/resources/conversation/types/GenerateMavenSuggestionsRequest.d.ts +2 -1
  91. package/api/resources/conversation/types/ResponseConfig.d.ts +12 -0
  92. package/api/resources/conversation/types/ResponseConfig.js +4 -0
  93. package/api/resources/conversation/types/ResponseLength.d.ts +9 -0
  94. package/api/resources/conversation/types/ResponseLength.js +8 -0
  95. package/api/resources/conversation/types/Sentiment.d.ts +14 -0
  96. package/api/resources/conversation/types/Sentiment.js +10 -0
  97. package/api/resources/conversation/types/StreamResponse.d.ts +4 -1
  98. package/api/resources/conversation/types/SubmitActionFormRequest.d.ts +8 -0
  99. package/api/resources/conversation/types/SubmitActionFormRequest.js +4 -0
  100. package/api/resources/conversation/types/UserMessage.d.ts +3 -3
  101. package/api/resources/conversation/types/UserMessageBase.d.ts +11 -0
  102. package/api/resources/conversation/types/UserMessageBase.js +4 -0
  103. package/api/resources/conversation/types/index.d.ts +9 -3
  104. package/api/resources/conversation/types/index.js +9 -3
  105. package/api/resources/index.d.ts +6 -2
  106. package/api/resources/index.js +6 -2
  107. package/api/resources/knowledge/client/Client.d.ts +85 -73
  108. package/api/resources/knowledge/client/Client.js +233 -175
  109. package/api/resources/knowledge/index.d.ts +0 -1
  110. package/api/resources/knowledge/index.js +0 -1
  111. package/{dist/api/resources/knowledge/types/KnowledgeDocument.d.ts → api/resources/knowledge/types/BaseKnowledgeDocument.d.ts} +2 -5
  112. package/api/resources/knowledge/types/BaseKnowledgeDocument.js +4 -0
  113. package/api/resources/knowledge/types/{KnowledgeBase.d.ts → KnowledgeBaseProperties.d.ts} +3 -3
  114. package/api/resources/knowledge/types/KnowledgeBaseProperties.js +4 -0
  115. package/api/resources/knowledge/types/KnowledgeBaseRequest.d.ts +18 -0
  116. package/api/resources/knowledge/types/KnowledgeBaseRequest.js +4 -0
  117. package/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +22 -0
  118. package/api/resources/knowledge/types/KnowledgeBaseResponse.js +4 -0
  119. package/api/resources/knowledge/types/KnowledgeBaseType.d.ts +1 -1
  120. package/api/resources/knowledge/types/KnowledgeBaseVersion.d.ts +7 -3
  121. package/api/resources/knowledge/types/KnowledgeDocumentContentType.d.ts +11 -0
  122. package/api/resources/knowledge/types/KnowledgeDocumentContentType.js +7 -0
  123. package/api/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +22 -0
  124. package/api/resources/knowledge/types/KnowledgeDocumentRequest.js +4 -0
  125. package/api/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +24 -0
  126. package/api/resources/knowledge/types/KnowledgeDocumentResponse.js +4 -0
  127. package/api/resources/knowledge/types/index.d.ts +7 -5
  128. package/api/resources/knowledge/types/index.js +7 -5
  129. package/api/resources/triggers/client/Client.d.ts +83 -0
  130. package/api/resources/triggers/client/Client.js +303 -0
  131. package/api/resources/triggers/client/index.d.ts +1 -0
  132. package/api/resources/triggers/client/index.js +1 -0
  133. package/api/resources/triggers/index.d.ts +2 -0
  134. package/api/resources/triggers/index.js +2 -0
  135. package/api/resources/triggers/types/EventTriggerRequest.d.ts +18 -0
  136. package/api/resources/triggers/types/EventTriggerRequest.js +4 -0
  137. package/api/resources/triggers/types/index.d.ts +1 -0
  138. package/api/resources/triggers/types/index.js +1 -0
  139. package/api/resources/users/client/Client.d.ts +77 -0
  140. package/api/resources/users/client/Client.js +228 -0
  141. package/api/resources/users/client/index.d.ts +1 -0
  142. package/api/resources/users/client/index.js +1 -0
  143. package/api/resources/users/index.d.ts +1 -0
  144. package/api/resources/users/index.js +1 -0
  145. package/core/fetcher/Fetcher.d.ts +4 -1
  146. package/core/fetcher/Fetcher.js +18 -159
  147. package/core/fetcher/createRequestUrl.d.ts +1 -0
  148. package/core/fetcher/createRequestUrl.js +6 -0
  149. package/core/fetcher/getFetchFn.d.ts +4 -0
  150. package/core/fetcher/getFetchFn.js +32 -0
  151. package/core/fetcher/getRequestBody.d.ts +7 -0
  152. package/core/fetcher/getRequestBody.js +19 -0
  153. package/core/fetcher/getResponseBody.d.ts +1 -0
  154. package/core/fetcher/getResponseBody.js +48 -0
  155. package/core/fetcher/makeRequest.d.ts +1 -0
  156. package/core/fetcher/makeRequest.js +38 -0
  157. package/core/fetcher/requestWithRetries.d.ts +1 -0
  158. package/core/fetcher/requestWithRetries.js +28 -0
  159. package/core/fetcher/signals.d.ts +12 -0
  160. package/core/fetcher/signals.js +32 -0
  161. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  162. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +222 -0
  163. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  164. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +104 -0
  165. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +30 -0
  166. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +204 -0
  167. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +17 -0
  168. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +23 -0
  169. package/core/index.d.ts +1 -1
  170. package/core/index.js +1 -1
  171. package/core/runtime/runtime.d.ts +1 -0
  172. package/core/runtime/runtime.js +1 -0
  173. package/core/schemas/Schema.d.ts +7 -4
  174. package/core/schemas/builders/lazy/lazy.d.ts +2 -2
  175. package/core/schemas/builders/lazy/lazy.js +8 -19
  176. package/core/schemas/builders/lazy/lazyObject.js +1 -10
  177. package/core/schemas/builders/list/list.js +31 -44
  178. package/core/schemas/builders/object/object.js +90 -111
  179. package/core/schemas/builders/object/types.d.ts +2 -2
  180. package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  181. package/core/schemas/builders/record/record.js +49 -60
  182. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  183. package/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
  184. package/core/schemas/builders/set/set.js +6 -15
  185. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  186. package/core/schemas/builders/union/union.js +51 -62
  187. package/core/schemas/utils/maybeSkipValidation.js +3 -12
  188. package/dist/Client.d.ts +21 -0
  189. package/dist/Client.js +20 -0
  190. package/dist/api/resources/actions/client/Client.d.ts +96 -0
  191. package/dist/api/resources/actions/client/Client.js +316 -0
  192. package/dist/api/resources/actions/client/index.d.ts +1 -0
  193. package/dist/api/resources/actions/client/index.js +1 -0
  194. package/dist/api/resources/actions/index.d.ts +2 -0
  195. package/dist/api/resources/actions/index.js +2 -0
  196. package/dist/api/resources/actions/types/ActionBase.d.ts +18 -0
  197. package/dist/api/resources/actions/types/ActionBase.js +4 -0
  198. package/dist/api/resources/actions/types/ActionParameter.d.ts +9 -0
  199. package/dist/api/resources/actions/types/ActionParameter.js +4 -0
  200. package/dist/api/resources/actions/types/ActionRequest.d.ts +31 -0
  201. package/dist/api/resources/actions/types/ActionRequest.js +4 -0
  202. package/dist/api/resources/actions/types/ActionResponse.d.ts +35 -0
  203. package/dist/api/resources/actions/types/ActionResponse.js +4 -0
  204. package/dist/api/resources/actions/types/ConversationExecutedActionPrecondition.d.ts +12 -0
  205. package/dist/api/resources/actions/types/ConversationExecutedActionPrecondition.js +4 -0
  206. package/dist/api/resources/actions/types/ConversationPrecondition.d.ts +20 -0
  207. package/dist/api/resources/actions/types/ConversationPrecondition.js +4 -0
  208. package/dist/api/resources/actions/types/MetadataPrecondition.d.ts +12 -0
  209. package/dist/api/resources/actions/types/MetadataPrecondition.js +4 -0
  210. package/dist/api/resources/actions/types/Precondition.d.ts +31 -0
  211. package/dist/api/resources/actions/types/Precondition.js +4 -0
  212. package/dist/api/resources/actions/types/PreconditionGroup.d.ts +8 -0
  213. package/dist/api/resources/actions/types/PreconditionGroup.js +4 -0
  214. package/dist/api/resources/actions/types/PreconditionGroupOperator.d.ts +8 -0
  215. package/dist/api/resources/actions/types/PreconditionGroupOperator.js +7 -0
  216. package/dist/api/resources/actions/types/PreconditionOperator.d.ts +7 -0
  217. package/dist/api/resources/actions/types/PreconditionOperator.js +6 -0
  218. package/dist/api/resources/actions/types/index.d.ts +11 -0
  219. package/dist/api/resources/actions/types/index.js +11 -0
  220. package/dist/api/resources/appSettings/client/Client.d.ts +47 -0
  221. package/dist/api/resources/appSettings/client/Client.js +124 -0
  222. package/dist/api/resources/appSettings/client/index.d.ts +1 -0
  223. package/dist/api/resources/appSettings/client/index.js +1 -0
  224. package/dist/api/resources/appSettings/index.d.ts +1 -0
  225. package/dist/api/resources/appSettings/index.js +1 -0
  226. package/dist/api/resources/{conversation/errors/EmptyConversationError.d.ts → commons/errors/BadRequestError.d.ts} +1 -1
  227. package/dist/api/resources/{knowledge/errors/VersionInProgressError.js → commons/errors/BadRequestError.js} +3 -3
  228. package/dist/api/resources/commons/errors/NotFoundError.d.ts +8 -0
  229. package/{api/resources/commons/errors/AgentNotFoundError.js → dist/api/resources/commons/errors/NotFoundError.js} +3 -3
  230. package/dist/api/resources/commons/errors/ServerError.d.ts +8 -0
  231. package/dist/api/resources/commons/errors/ServerError.js +14 -0
  232. package/dist/api/resources/commons/errors/index.d.ts +3 -1
  233. package/dist/api/resources/commons/errors/index.js +3 -1
  234. package/dist/api/resources/commons/types/AppUser.d.ts +9 -0
  235. package/dist/api/resources/commons/types/AppUser.js +4 -0
  236. package/dist/api/resources/commons/types/AppUserIdentifier.d.ts +9 -0
  237. package/dist/api/resources/commons/types/AppUserIdentifier.js +4 -0
  238. package/dist/api/resources/commons/types/AppUserIdentifyingPropertyType.d.ts +8 -0
  239. package/dist/api/resources/commons/types/AppUserIdentifyingPropertyType.js +7 -0
  240. package/dist/api/resources/commons/types/AppUserRequest.d.ts +26 -0
  241. package/dist/api/resources/commons/types/AppUserRequest.js +4 -0
  242. package/dist/api/resources/commons/types/AppUserResponse.d.ts +42 -0
  243. package/dist/api/resources/commons/types/AppUserResponse.js +4 -0
  244. package/dist/api/resources/commons/types/EntityId.d.ts +14 -0
  245. package/dist/api/resources/commons/types/EntityId.js +4 -0
  246. package/dist/api/resources/commons/types/EntityIdBase.d.ts +10 -0
  247. package/dist/api/resources/commons/types/EntityIdBase.js +4 -0
  248. package/dist/api/resources/commons/types/EntityType.d.ts +16 -0
  249. package/dist/api/resources/commons/types/EntityType.js +15 -0
  250. package/dist/api/resources/commons/types/EventTriggerBase.d.ts +10 -0
  251. package/dist/api/resources/commons/types/EventTriggerBase.js +4 -0
  252. package/dist/api/resources/commons/types/EventTriggerResponse.d.ts +22 -0
  253. package/dist/api/resources/commons/types/EventTriggerResponse.js +4 -0
  254. package/dist/api/resources/commons/types/EventTriggerType.d.ts +8 -0
  255. package/dist/api/resources/commons/types/EventTriggerType.js +7 -0
  256. package/dist/api/resources/commons/types/Feedback.d.ts +12 -0
  257. package/dist/api/resources/commons/types/Feedback.js +4 -0
  258. package/dist/api/resources/commons/types/FeedbackBase.d.ts +10 -0
  259. package/dist/api/resources/commons/types/FeedbackBase.js +4 -0
  260. package/dist/api/resources/{conversation → commons}/types/FeedbackType.d.ts +3 -1
  261. package/{api/resources/conversation → dist/api/resources/commons}/types/FeedbackType.js +2 -0
  262. package/dist/api/resources/commons/types/UserData.d.ts +10 -0
  263. package/dist/api/resources/commons/types/UserData.js +4 -0
  264. package/dist/api/resources/commons/types/VisibilityType.d.ts +9 -0
  265. package/dist/api/resources/commons/types/VisibilityType.js +8 -0
  266. package/dist/api/resources/commons/types/index.d.ts +16 -1
  267. package/dist/api/resources/commons/types/index.js +16 -1
  268. package/dist/api/resources/conversation/client/Client.d.ts +136 -42
  269. package/dist/api/resources/conversation/client/Client.js +451 -130
  270. package/dist/api/resources/conversation/index.d.ts +0 -1
  271. package/dist/api/resources/conversation/index.js +0 -1
  272. package/dist/api/resources/conversation/types/ActionFormField.d.ts +1 -0
  273. package/dist/api/resources/conversation/types/AskRequest.d.ts +15 -3
  274. package/dist/api/resources/conversation/types/AskStreamActionEvent.d.ts +6 -0
  275. package/dist/api/resources/conversation/types/AskStreamActionEvent.js +4 -0
  276. package/dist/api/resources/conversation/types/AskStreamStartEvent.d.ts +2 -1
  277. package/dist/api/resources/conversation/types/AskStreamTextEvent.d.ts +1 -0
  278. package/dist/api/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
  279. package/dist/api/resources/conversation/types/BotMessage.d.ts +2 -0
  280. package/dist/api/resources/conversation/types/Capability.d.ts +18 -0
  281. package/dist/api/resources/conversation/types/Capability.js +8 -0
  282. package/dist/api/resources/conversation/types/CategorizationResponse.d.ts +6 -0
  283. package/dist/api/resources/conversation/types/CategorizationResponse.js +4 -0
  284. package/dist/api/resources/conversation/types/ConversationAnalysis.d.ts +12 -0
  285. package/dist/api/resources/conversation/types/ConversationAnalysis.js +4 -0
  286. package/dist/api/resources/conversation/types/ConversationBase.d.ts +14 -4
  287. package/dist/api/resources/conversation/types/ConversationMessageBase.d.ts +4 -5
  288. package/dist/api/resources/conversation/types/ConversationMessageRequest.d.ts +3 -1
  289. package/dist/api/resources/conversation/types/ConversationRequest.d.ts +2 -0
  290. package/dist/api/resources/conversation/types/ConversationResponse.d.ts +4 -0
  291. package/dist/api/resources/conversation/types/FeedbackRequest.d.ts +7 -7
  292. package/dist/api/resources/conversation/types/GenerateMavenSuggestionsRequest.d.ts +2 -1
  293. package/dist/api/resources/conversation/types/ResponseConfig.d.ts +12 -0
  294. package/dist/api/resources/conversation/types/ResponseConfig.js +4 -0
  295. package/dist/api/resources/conversation/types/ResponseLength.d.ts +9 -0
  296. package/dist/api/resources/conversation/types/ResponseLength.js +8 -0
  297. package/dist/api/resources/conversation/types/Sentiment.d.ts +14 -0
  298. package/dist/api/resources/conversation/types/Sentiment.js +10 -0
  299. package/dist/api/resources/conversation/types/StreamResponse.d.ts +4 -1
  300. package/dist/api/resources/conversation/types/SubmitActionFormRequest.d.ts +8 -0
  301. package/dist/api/resources/conversation/types/SubmitActionFormRequest.js +4 -0
  302. package/dist/api/resources/conversation/types/UserMessage.d.ts +3 -3
  303. package/dist/api/resources/conversation/types/UserMessageBase.d.ts +11 -0
  304. package/dist/api/resources/conversation/types/UserMessageBase.js +4 -0
  305. package/dist/api/resources/conversation/types/index.d.ts +9 -3
  306. package/dist/api/resources/conversation/types/index.js +9 -3
  307. package/dist/api/resources/index.d.ts +6 -2
  308. package/dist/api/resources/index.js +6 -2
  309. package/dist/api/resources/knowledge/client/Client.d.ts +85 -73
  310. package/dist/api/resources/knowledge/client/Client.js +233 -175
  311. package/dist/api/resources/knowledge/index.d.ts +0 -1
  312. package/dist/api/resources/knowledge/index.js +0 -1
  313. package/{api/resources/knowledge/types/KnowledgeDocument.d.ts → dist/api/resources/knowledge/types/BaseKnowledgeDocument.d.ts} +2 -5
  314. package/dist/api/resources/knowledge/types/BaseKnowledgeDocument.js +4 -0
  315. package/dist/api/resources/knowledge/types/{KnowledgeBase.d.ts → KnowledgeBaseProperties.d.ts} +3 -3
  316. package/dist/api/resources/knowledge/types/KnowledgeBaseProperties.js +4 -0
  317. package/dist/api/resources/knowledge/types/KnowledgeBaseRequest.d.ts +18 -0
  318. package/dist/api/resources/knowledge/types/KnowledgeBaseRequest.js +4 -0
  319. package/dist/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +22 -0
  320. package/dist/api/resources/knowledge/types/KnowledgeBaseResponse.js +4 -0
  321. package/dist/api/resources/knowledge/types/KnowledgeBaseType.d.ts +1 -1
  322. package/dist/api/resources/knowledge/types/KnowledgeBaseVersion.d.ts +7 -3
  323. package/dist/api/resources/knowledge/types/KnowledgeDocumentContentType.d.ts +11 -0
  324. package/dist/api/resources/knowledge/types/KnowledgeDocumentContentType.js +7 -0
  325. package/dist/api/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +22 -0
  326. package/dist/api/resources/knowledge/types/KnowledgeDocumentRequest.js +4 -0
  327. package/dist/api/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +24 -0
  328. package/dist/api/resources/knowledge/types/KnowledgeDocumentResponse.js +4 -0
  329. package/dist/api/resources/knowledge/types/index.d.ts +7 -5
  330. package/dist/api/resources/knowledge/types/index.js +7 -5
  331. package/dist/api/resources/triggers/client/Client.d.ts +83 -0
  332. package/dist/api/resources/triggers/client/Client.js +303 -0
  333. package/dist/api/resources/triggers/client/index.d.ts +1 -0
  334. package/dist/api/resources/triggers/client/index.js +1 -0
  335. package/dist/api/resources/triggers/index.d.ts +2 -0
  336. package/dist/api/resources/triggers/index.js +2 -0
  337. package/dist/api/resources/triggers/types/EventTriggerRequest.d.ts +18 -0
  338. package/dist/api/resources/triggers/types/EventTriggerRequest.js +4 -0
  339. package/dist/api/resources/triggers/types/index.d.ts +1 -0
  340. package/dist/api/resources/triggers/types/index.js +1 -0
  341. package/dist/api/resources/users/client/Client.d.ts +77 -0
  342. package/dist/api/resources/users/client/Client.js +228 -0
  343. package/dist/api/resources/users/client/index.d.ts +1 -0
  344. package/dist/api/resources/users/client/index.js +1 -0
  345. package/dist/api/resources/users/index.d.ts +1 -0
  346. package/dist/api/resources/users/index.js +1 -0
  347. package/dist/core/fetcher/Fetcher.d.ts +4 -1
  348. package/dist/core/fetcher/Fetcher.js +18 -159
  349. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  350. package/dist/core/fetcher/createRequestUrl.js +6 -0
  351. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  352. package/dist/core/fetcher/getFetchFn.js +32 -0
  353. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  354. package/dist/core/fetcher/getRequestBody.js +19 -0
  355. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  356. package/dist/core/fetcher/getResponseBody.js +48 -0
  357. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  358. package/dist/core/fetcher/makeRequest.js +38 -0
  359. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  360. package/dist/core/fetcher/requestWithRetries.js +28 -0
  361. package/dist/core/fetcher/signals.d.ts +12 -0
  362. package/dist/core/fetcher/signals.js +32 -0
  363. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  364. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +222 -0
  365. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  366. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +104 -0
  367. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +30 -0
  368. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +204 -0
  369. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +17 -0
  370. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +23 -0
  371. package/dist/core/index.d.ts +1 -1
  372. package/dist/core/index.js +1 -1
  373. package/dist/core/runtime/runtime.d.ts +1 -0
  374. package/dist/core/runtime/runtime.js +1 -0
  375. package/dist/core/schemas/Schema.d.ts +7 -4
  376. package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
  377. package/dist/core/schemas/builders/lazy/lazy.js +8 -19
  378. package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
  379. package/dist/core/schemas/builders/list/list.js +31 -44
  380. package/dist/core/schemas/builders/object/object.js +90 -111
  381. package/dist/core/schemas/builders/object/types.d.ts +2 -2
  382. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  383. package/dist/core/schemas/builders/record/record.js +49 -60
  384. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  385. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
  386. package/dist/core/schemas/builders/set/set.js +6 -15
  387. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  388. package/dist/core/schemas/builders/union/union.js +51 -62
  389. package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
  390. package/dist/serialization/resources/actions/index.d.ts +1 -0
  391. package/dist/serialization/resources/actions/index.js +1 -0
  392. package/dist/serialization/resources/actions/types/ActionBase.d.ts +18 -0
  393. package/dist/serialization/resources/actions/types/ActionBase.js +14 -0
  394. package/dist/serialization/resources/actions/types/ActionParameter.d.ts +15 -0
  395. package/dist/serialization/resources/actions/types/ActionParameter.js +10 -0
  396. package/dist/serialization/resources/actions/types/ActionRequest.d.ts +14 -0
  397. package/dist/serialization/resources/actions/types/ActionRequest.js +11 -0
  398. package/dist/serialization/resources/actions/types/ActionResponse.d.ts +14 -0
  399. package/dist/serialization/resources/actions/types/ActionResponse.js +11 -0
  400. package/dist/serialization/resources/actions/types/ConversationExecutedActionPrecondition.d.ts +15 -0
  401. package/dist/serialization/resources/actions/types/ConversationExecutedActionPrecondition.js +10 -0
  402. package/dist/serialization/resources/actions/types/ConversationPrecondition.d.ts +22 -0
  403. package/dist/serialization/resources/actions/types/ConversationPrecondition.js +18 -0
  404. package/dist/serialization/resources/actions/types/MetadataPrecondition.d.ts +15 -0
  405. package/dist/serialization/resources/actions/types/MetadataPrecondition.js +10 -0
  406. package/dist/serialization/resources/actions/types/Precondition.d.ts +22 -0
  407. package/dist/serialization/resources/actions/types/Precondition.js +19 -0
  408. package/dist/serialization/resources/actions/types/PreconditionGroup.d.ts +14 -0
  409. package/dist/serialization/resources/actions/types/PreconditionGroup.js +10 -0
  410. package/dist/serialization/resources/actions/types/PreconditionGroupOperator.d.ts +10 -0
  411. package/dist/serialization/resources/actions/types/PreconditionGroupOperator.js +5 -0
  412. package/dist/serialization/resources/actions/types/PreconditionOperator.d.ts +10 -0
  413. package/dist/serialization/resources/actions/types/PreconditionOperator.js +5 -0
  414. package/dist/serialization/resources/actions/types/index.d.ts +11 -0
  415. package/dist/serialization/resources/actions/types/index.js +11 -0
  416. package/dist/serialization/resources/appSettings/client/get.d.ts +9 -0
  417. package/dist/serialization/resources/appSettings/client/get.js +5 -0
  418. package/dist/serialization/resources/appSettings/client/index.d.ts +1 -0
  419. package/dist/serialization/resources/appSettings/client/index.js +1 -0
  420. package/dist/serialization/resources/appSettings/index.d.ts +1 -0
  421. package/dist/serialization/resources/appSettings/index.js +1 -0
  422. package/dist/serialization/resources/commons/types/AppUser.d.ts +15 -0
  423. package/dist/serialization/resources/commons/types/AppUser.js +10 -0
  424. package/dist/serialization/resources/commons/types/AppUserIdentifier.d.ts +14 -0
  425. package/dist/serialization/resources/commons/types/AppUserIdentifier.js +9 -0
  426. package/dist/serialization/resources/commons/types/AppUserIdentifyingPropertyType.d.ts +10 -0
  427. package/dist/serialization/resources/commons/types/AppUserIdentifyingPropertyType.js +5 -0
  428. package/dist/serialization/resources/commons/types/AppUserRequest.d.ts +14 -0
  429. package/dist/serialization/resources/commons/types/AppUserRequest.js +11 -0
  430. package/dist/serialization/resources/commons/types/AppUserResponse.d.ts +16 -0
  431. package/dist/serialization/resources/commons/types/AppUserResponse.js +13 -0
  432. package/dist/serialization/resources/commons/types/EntityId.d.ts +17 -0
  433. package/dist/serialization/resources/commons/types/EntityId.js +14 -0
  434. package/{serialization/resources/knowledge/types/IdBody.d.ts → dist/serialization/resources/commons/types/EntityIdBase.d.ts} +3 -3
  435. package/dist/serialization/resources/{knowledge/types/IdBody.js → commons/types/EntityIdBase.js} +2 -2
  436. package/dist/serialization/resources/commons/types/EntityType.d.ts +10 -0
  437. package/dist/serialization/resources/commons/types/EntityType.js +16 -0
  438. package/dist/serialization/resources/commons/types/EventTriggerBase.d.ts +14 -0
  439. package/dist/serialization/resources/commons/types/EventTriggerBase.js +9 -0
  440. package/dist/serialization/resources/commons/types/EventTriggerResponse.d.ts +14 -0
  441. package/dist/serialization/resources/commons/types/EventTriggerResponse.js +11 -0
  442. package/dist/serialization/resources/commons/types/EventTriggerType.d.ts +10 -0
  443. package/dist/serialization/resources/commons/types/EventTriggerType.js +5 -0
  444. package/dist/serialization/resources/commons/types/Feedback.d.ts +16 -0
  445. package/dist/serialization/resources/commons/types/Feedback.js +13 -0
  446. package/dist/serialization/resources/commons/types/FeedbackBase.d.ts +14 -0
  447. package/dist/serialization/resources/commons/types/FeedbackBase.js +9 -0
  448. package/{serialization/resources/conversation → dist/serialization/resources/commons}/types/FeedbackType.d.ts +1 -1
  449. package/dist/serialization/resources/{conversation → commons}/types/FeedbackType.js +1 -1
  450. package/dist/serialization/resources/commons/types/UserData.d.ts +14 -0
  451. package/dist/serialization/resources/commons/types/UserData.js +9 -0
  452. package/dist/serialization/resources/commons/types/VisibilityType.d.ts +10 -0
  453. package/dist/serialization/resources/commons/types/VisibilityType.js +5 -0
  454. package/dist/serialization/resources/commons/types/index.d.ts +16 -1
  455. package/dist/serialization/resources/commons/types/index.js +16 -1
  456. package/dist/serialization/resources/conversation/client/addConversationMetadata.d.ts +13 -0
  457. package/dist/serialization/resources/conversation/client/addConversationMetadata.js +6 -0
  458. package/dist/serialization/resources/conversation/client/index.d.ts +1 -0
  459. package/dist/serialization/resources/conversation/client/index.js +1 -0
  460. package/dist/serialization/resources/conversation/types/ActionFormField.d.ts +1 -0
  461. package/dist/serialization/resources/conversation/types/ActionFormField.js +1 -0
  462. package/dist/serialization/resources/conversation/types/AskRequest.d.ts +3 -3
  463. package/dist/serialization/resources/conversation/types/AskRequest.js +3 -3
  464. package/dist/serialization/resources/conversation/types/AskStreamActionEvent.d.ts +12 -0
  465. package/dist/serialization/resources/conversation/types/AskStreamActionEvent.js +6 -0
  466. package/dist/serialization/resources/conversation/types/AskStreamStartEvent.d.ts +2 -1
  467. package/dist/serialization/resources/conversation/types/AskStreamStartEvent.js +2 -1
  468. package/dist/serialization/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
  469. package/dist/serialization/resources/conversation/types/BotActionFormResponse.js +1 -0
  470. package/dist/serialization/resources/conversation/types/BotMessage.d.ts +2 -0
  471. package/dist/serialization/resources/conversation/types/BotMessage.js +2 -0
  472. package/dist/serialization/resources/conversation/types/Capability.d.ts +10 -0
  473. package/dist/serialization/resources/conversation/types/Capability.js +5 -0
  474. package/dist/serialization/resources/{commons/types/User.d.ts → conversation/types/CategorizationResponse.d.ts} +3 -5
  475. package/dist/serialization/resources/conversation/types/CategorizationResponse.js +7 -0
  476. package/dist/serialization/resources/conversation/types/ConversationAnalysis.d.ts +15 -0
  477. package/dist/serialization/resources/conversation/types/ConversationAnalysis.js +10 -0
  478. package/dist/serialization/resources/conversation/types/ConversationBase.d.ts +8 -3
  479. package/dist/serialization/resources/conversation/types/ConversationBase.js +8 -3
  480. package/dist/serialization/resources/conversation/types/ConversationMessageBase.d.ts +2 -3
  481. package/dist/serialization/resources/conversation/types/ConversationMessageBase.js +2 -3
  482. package/dist/serialization/resources/conversation/types/ConversationMessageRequest.d.ts +4 -2
  483. package/dist/serialization/resources/conversation/types/ConversationMessageRequest.js +7 -2
  484. package/dist/serialization/resources/conversation/types/ConversationRequest.d.ts +2 -0
  485. package/dist/serialization/resources/conversation/types/ConversationRequest.js +2 -0
  486. package/dist/serialization/resources/conversation/types/ConversationResponse.d.ts +4 -0
  487. package/dist/serialization/resources/conversation/types/ConversationResponse.js +4 -0
  488. package/dist/serialization/resources/conversation/types/FeedbackRequest.d.ts +6 -5
  489. package/dist/serialization/resources/conversation/types/FeedbackRequest.js +9 -6
  490. package/dist/serialization/resources/conversation/types/GenerateMavenSuggestionsRequest.d.ts +2 -1
  491. package/dist/serialization/resources/conversation/types/GenerateMavenSuggestionsRequest.js +2 -1
  492. package/dist/serialization/resources/conversation/types/ResponseConfig.d.ts +16 -0
  493. package/dist/serialization/resources/conversation/types/ResponseConfig.js +11 -0
  494. package/dist/serialization/resources/conversation/types/ResponseLength.d.ts +10 -0
  495. package/dist/serialization/resources/conversation/types/ResponseLength.js +5 -0
  496. package/dist/serialization/resources/conversation/types/Sentiment.d.ts +10 -0
  497. package/dist/serialization/resources/conversation/types/Sentiment.js +5 -0
  498. package/dist/serialization/resources/conversation/types/StreamResponse.d.ts +5 -1
  499. package/dist/serialization/resources/conversation/types/StreamResponse.js +2 -0
  500. package/dist/serialization/resources/conversation/types/SubmitActionFormRequest.d.ts +13 -0
  501. package/dist/serialization/resources/conversation/types/SubmitActionFormRequest.js +8 -0
  502. package/dist/serialization/resources/conversation/types/UserMessage.d.ts +4 -5
  503. package/dist/serialization/resources/conversation/types/UserMessage.js +4 -5
  504. package/dist/serialization/resources/conversation/types/UserMessageBase.d.ts +17 -0
  505. package/dist/serialization/resources/conversation/types/UserMessageBase.js +14 -0
  506. package/dist/serialization/resources/conversation/types/index.d.ts +9 -3
  507. package/dist/serialization/resources/conversation/types/index.js +9 -3
  508. package/dist/serialization/resources/index.d.ts +5 -0
  509. package/dist/serialization/resources/index.js +5 -0
  510. package/dist/serialization/resources/knowledge/types/{KnowledgeDocument.d.ts → BaseKnowledgeDocument.d.ts} +3 -5
  511. package/{serialization/resources/knowledge/types/KnowledgeDocument.js → dist/serialization/resources/knowledge/types/BaseKnowledgeDocument.js} +2 -6
  512. package/{serialization/resources/knowledge/types/KnowledgeBase.d.ts → dist/serialization/resources/knowledge/types/KnowledgeBaseProperties.d.ts} +4 -5
  513. package/dist/serialization/resources/knowledge/types/{KnowledgeBase.js → KnowledgeBaseProperties.js} +3 -6
  514. package/dist/serialization/resources/knowledge/types/KnowledgeBaseRequest.d.ts +14 -0
  515. package/dist/serialization/resources/knowledge/types/KnowledgeBaseRequest.js +11 -0
  516. package/dist/serialization/resources/knowledge/types/KnowledgeBaseResponse.d.ts +14 -0
  517. package/dist/serialization/resources/knowledge/types/KnowledgeBaseResponse.js +11 -0
  518. package/dist/serialization/resources/knowledge/types/KnowledgeBaseVersion.d.ts +0 -1
  519. package/dist/serialization/resources/knowledge/types/KnowledgeBaseVersion.js +0 -1
  520. package/dist/serialization/resources/knowledge/types/KnowledgeDocumentContentType.d.ts +10 -0
  521. package/dist/serialization/resources/knowledge/types/KnowledgeDocumentContentType.js +5 -0
  522. package/dist/serialization/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +17 -0
  523. package/dist/serialization/resources/knowledge/types/KnowledgeDocumentRequest.js +14 -0
  524. package/dist/serialization/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +15 -0
  525. package/dist/serialization/resources/knowledge/types/KnowledgeDocumentResponse.js +12 -0
  526. package/dist/serialization/resources/knowledge/types/index.d.ts +7 -5
  527. package/dist/serialization/resources/knowledge/types/index.js +7 -5
  528. package/dist/serialization/resources/triggers/index.d.ts +1 -0
  529. package/dist/serialization/resources/triggers/index.js +1 -0
  530. package/dist/serialization/resources/triggers/types/EventTriggerRequest.d.ts +14 -0
  531. package/dist/serialization/resources/triggers/types/EventTriggerRequest.js +11 -0
  532. package/dist/serialization/resources/triggers/types/index.d.ts +1 -0
  533. package/dist/serialization/resources/triggers/types/index.js +1 -0
  534. package/package.json +7 -2
  535. package/reference.md +1863 -0
  536. package/serialization/resources/actions/index.d.ts +1 -0
  537. package/serialization/resources/actions/index.js +1 -0
  538. package/serialization/resources/actions/types/ActionBase.d.ts +18 -0
  539. package/serialization/resources/actions/types/ActionBase.js +14 -0
  540. package/serialization/resources/actions/types/ActionParameter.d.ts +15 -0
  541. package/serialization/resources/actions/types/ActionParameter.js +10 -0
  542. package/serialization/resources/actions/types/ActionRequest.d.ts +14 -0
  543. package/serialization/resources/actions/types/ActionRequest.js +11 -0
  544. package/serialization/resources/actions/types/ActionResponse.d.ts +14 -0
  545. package/serialization/resources/actions/types/ActionResponse.js +11 -0
  546. package/serialization/resources/actions/types/ConversationExecutedActionPrecondition.d.ts +15 -0
  547. package/serialization/resources/actions/types/ConversationExecutedActionPrecondition.js +10 -0
  548. package/serialization/resources/actions/types/ConversationPrecondition.d.ts +22 -0
  549. package/serialization/resources/actions/types/ConversationPrecondition.js +18 -0
  550. package/serialization/resources/actions/types/MetadataPrecondition.d.ts +15 -0
  551. package/serialization/resources/actions/types/MetadataPrecondition.js +10 -0
  552. package/serialization/resources/actions/types/Precondition.d.ts +22 -0
  553. package/serialization/resources/actions/types/Precondition.js +19 -0
  554. package/serialization/resources/actions/types/PreconditionGroup.d.ts +14 -0
  555. package/serialization/resources/actions/types/PreconditionGroup.js +10 -0
  556. package/serialization/resources/actions/types/PreconditionGroupOperator.d.ts +10 -0
  557. package/serialization/resources/actions/types/PreconditionGroupOperator.js +5 -0
  558. package/serialization/resources/actions/types/PreconditionOperator.d.ts +10 -0
  559. package/serialization/resources/actions/types/PreconditionOperator.js +5 -0
  560. package/serialization/resources/actions/types/index.d.ts +11 -0
  561. package/serialization/resources/actions/types/index.js +11 -0
  562. package/serialization/resources/appSettings/client/get.d.ts +9 -0
  563. package/serialization/resources/appSettings/client/get.js +5 -0
  564. package/serialization/resources/appSettings/client/index.d.ts +1 -0
  565. package/serialization/resources/appSettings/client/index.js +1 -0
  566. package/serialization/resources/appSettings/index.d.ts +1 -0
  567. package/serialization/resources/appSettings/index.js +1 -0
  568. package/serialization/resources/commons/types/AppUser.d.ts +15 -0
  569. package/serialization/resources/commons/types/AppUser.js +10 -0
  570. package/serialization/resources/commons/types/AppUserIdentifier.d.ts +14 -0
  571. package/serialization/resources/commons/types/AppUserIdentifier.js +9 -0
  572. package/serialization/resources/commons/types/AppUserIdentifyingPropertyType.d.ts +10 -0
  573. package/serialization/resources/commons/types/AppUserIdentifyingPropertyType.js +5 -0
  574. package/serialization/resources/commons/types/AppUserRequest.d.ts +14 -0
  575. package/serialization/resources/commons/types/AppUserRequest.js +11 -0
  576. package/serialization/resources/commons/types/AppUserResponse.d.ts +16 -0
  577. package/serialization/resources/commons/types/AppUserResponse.js +13 -0
  578. package/serialization/resources/commons/types/EntityId.d.ts +17 -0
  579. package/serialization/resources/commons/types/EntityId.js +14 -0
  580. package/{dist/serialization/resources/knowledge/types/IdBody.d.ts → serialization/resources/commons/types/EntityIdBase.d.ts} +3 -3
  581. package/serialization/resources/{knowledge/types/IdBody.js → commons/types/EntityIdBase.js} +2 -2
  582. package/serialization/resources/commons/types/EntityType.d.ts +10 -0
  583. package/serialization/resources/commons/types/EntityType.js +16 -0
  584. package/serialization/resources/commons/types/EventTriggerBase.d.ts +14 -0
  585. package/serialization/resources/commons/types/EventTriggerBase.js +9 -0
  586. package/serialization/resources/commons/types/EventTriggerResponse.d.ts +14 -0
  587. package/serialization/resources/commons/types/EventTriggerResponse.js +11 -0
  588. package/serialization/resources/commons/types/EventTriggerType.d.ts +10 -0
  589. package/serialization/resources/commons/types/EventTriggerType.js +5 -0
  590. package/serialization/resources/commons/types/Feedback.d.ts +16 -0
  591. package/serialization/resources/commons/types/Feedback.js +13 -0
  592. package/serialization/resources/commons/types/FeedbackBase.d.ts +14 -0
  593. package/serialization/resources/commons/types/FeedbackBase.js +9 -0
  594. package/{dist/serialization/resources/conversation → serialization/resources/commons}/types/FeedbackType.d.ts +1 -1
  595. package/serialization/resources/{conversation → commons}/types/FeedbackType.js +1 -1
  596. package/serialization/resources/commons/types/UserData.d.ts +14 -0
  597. package/serialization/resources/commons/types/UserData.js +9 -0
  598. package/serialization/resources/commons/types/VisibilityType.d.ts +10 -0
  599. package/serialization/resources/commons/types/VisibilityType.js +5 -0
  600. package/serialization/resources/commons/types/index.d.ts +16 -1
  601. package/serialization/resources/commons/types/index.js +16 -1
  602. package/serialization/resources/conversation/client/addConversationMetadata.d.ts +13 -0
  603. package/serialization/resources/conversation/client/addConversationMetadata.js +6 -0
  604. package/serialization/resources/conversation/client/index.d.ts +1 -0
  605. package/serialization/resources/conversation/client/index.js +1 -0
  606. package/serialization/resources/conversation/types/ActionFormField.d.ts +1 -0
  607. package/serialization/resources/conversation/types/ActionFormField.js +1 -0
  608. package/serialization/resources/conversation/types/AskRequest.d.ts +3 -3
  609. package/serialization/resources/conversation/types/AskRequest.js +3 -3
  610. package/serialization/resources/conversation/types/AskStreamActionEvent.d.ts +12 -0
  611. package/serialization/resources/conversation/types/AskStreamActionEvent.js +6 -0
  612. package/serialization/resources/conversation/types/AskStreamStartEvent.d.ts +2 -1
  613. package/serialization/resources/conversation/types/AskStreamStartEvent.js +2 -1
  614. package/serialization/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
  615. package/serialization/resources/conversation/types/BotActionFormResponse.js +1 -0
  616. package/serialization/resources/conversation/types/BotMessage.d.ts +2 -0
  617. package/serialization/resources/conversation/types/BotMessage.js +2 -0
  618. package/serialization/resources/conversation/types/Capability.d.ts +10 -0
  619. package/serialization/resources/conversation/types/Capability.js +5 -0
  620. package/serialization/resources/{commons/types/User.d.ts → conversation/types/CategorizationResponse.d.ts} +3 -5
  621. package/serialization/resources/conversation/types/CategorizationResponse.js +7 -0
  622. package/serialization/resources/conversation/types/ConversationAnalysis.d.ts +15 -0
  623. package/serialization/resources/conversation/types/ConversationAnalysis.js +10 -0
  624. package/serialization/resources/conversation/types/ConversationBase.d.ts +8 -3
  625. package/serialization/resources/conversation/types/ConversationBase.js +8 -3
  626. package/serialization/resources/conversation/types/ConversationMessageBase.d.ts +2 -3
  627. package/serialization/resources/conversation/types/ConversationMessageBase.js +2 -3
  628. package/serialization/resources/conversation/types/ConversationMessageRequest.d.ts +4 -2
  629. package/serialization/resources/conversation/types/ConversationMessageRequest.js +7 -2
  630. package/serialization/resources/conversation/types/ConversationRequest.d.ts +2 -0
  631. package/serialization/resources/conversation/types/ConversationRequest.js +2 -0
  632. package/serialization/resources/conversation/types/ConversationResponse.d.ts +4 -0
  633. package/serialization/resources/conversation/types/ConversationResponse.js +4 -0
  634. package/serialization/resources/conversation/types/FeedbackRequest.d.ts +6 -5
  635. package/serialization/resources/conversation/types/FeedbackRequest.js +9 -6
  636. package/serialization/resources/conversation/types/GenerateMavenSuggestionsRequest.d.ts +2 -1
  637. package/serialization/resources/conversation/types/GenerateMavenSuggestionsRequest.js +2 -1
  638. package/serialization/resources/conversation/types/ResponseConfig.d.ts +16 -0
  639. package/serialization/resources/conversation/types/ResponseConfig.js +11 -0
  640. package/serialization/resources/conversation/types/ResponseLength.d.ts +10 -0
  641. package/serialization/resources/conversation/types/ResponseLength.js +5 -0
  642. package/serialization/resources/conversation/types/Sentiment.d.ts +10 -0
  643. package/serialization/resources/conversation/types/Sentiment.js +5 -0
  644. package/serialization/resources/conversation/types/StreamResponse.d.ts +5 -1
  645. package/serialization/resources/conversation/types/StreamResponse.js +2 -0
  646. package/serialization/resources/conversation/types/SubmitActionFormRequest.d.ts +13 -0
  647. package/serialization/resources/conversation/types/SubmitActionFormRequest.js +8 -0
  648. package/serialization/resources/conversation/types/UserMessage.d.ts +4 -5
  649. package/serialization/resources/conversation/types/UserMessage.js +4 -5
  650. package/serialization/resources/conversation/types/UserMessageBase.d.ts +17 -0
  651. package/serialization/resources/conversation/types/UserMessageBase.js +14 -0
  652. package/serialization/resources/conversation/types/index.d.ts +9 -3
  653. package/serialization/resources/conversation/types/index.js +9 -3
  654. package/serialization/resources/index.d.ts +5 -0
  655. package/serialization/resources/index.js +5 -0
  656. package/serialization/resources/knowledge/types/{KnowledgeDocument.d.ts → BaseKnowledgeDocument.d.ts} +3 -5
  657. package/{dist/serialization/resources/knowledge/types/KnowledgeDocument.js → serialization/resources/knowledge/types/BaseKnowledgeDocument.js} +2 -6
  658. package/{dist/serialization/resources/knowledge/types/KnowledgeBase.d.ts → serialization/resources/knowledge/types/KnowledgeBaseProperties.d.ts} +4 -5
  659. package/serialization/resources/knowledge/types/{KnowledgeBase.js → KnowledgeBaseProperties.js} +3 -6
  660. package/serialization/resources/knowledge/types/KnowledgeBaseRequest.d.ts +14 -0
  661. package/serialization/resources/knowledge/types/KnowledgeBaseRequest.js +11 -0
  662. package/serialization/resources/knowledge/types/KnowledgeBaseResponse.d.ts +14 -0
  663. package/serialization/resources/knowledge/types/KnowledgeBaseResponse.js +11 -0
  664. package/serialization/resources/knowledge/types/KnowledgeBaseVersion.d.ts +0 -1
  665. package/serialization/resources/knowledge/types/KnowledgeBaseVersion.js +0 -1
  666. package/serialization/resources/knowledge/types/KnowledgeDocumentContentType.d.ts +10 -0
  667. package/serialization/resources/knowledge/types/KnowledgeDocumentContentType.js +5 -0
  668. package/serialization/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +17 -0
  669. package/serialization/resources/knowledge/types/KnowledgeDocumentRequest.js +14 -0
  670. package/serialization/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +15 -0
  671. package/serialization/resources/knowledge/types/KnowledgeDocumentResponse.js +12 -0
  672. package/serialization/resources/knowledge/types/index.d.ts +7 -5
  673. package/serialization/resources/knowledge/types/index.js +7 -5
  674. package/serialization/resources/triggers/index.d.ts +1 -0
  675. package/serialization/resources/triggers/index.js +1 -0
  676. package/serialization/resources/triggers/types/EventTriggerRequest.d.ts +14 -0
  677. package/serialization/resources/triggers/types/EventTriggerRequest.js +11 -0
  678. package/serialization/resources/triggers/types/index.d.ts +1 -0
  679. package/serialization/resources/triggers/types/index.js +1 -0
  680. package/api/resources/commons/types/User.d.ts +0 -9
  681. package/api/resources/conversation/errors/ConversationAlreadyExistsError.d.ts +0 -8
  682. package/api/resources/conversation/errors/ConversationAlreadyExistsError.js +0 -14
  683. package/api/resources/conversation/errors/ConversationMessageNotFoundError.d.ts +0 -8
  684. package/api/resources/conversation/errors/ConversationMessageNotFoundError.js +0 -14
  685. package/api/resources/conversation/errors/ConversationNotFoundError.d.ts +0 -8
  686. package/api/resources/conversation/errors/ConversationNotFoundError.js +0 -14
  687. package/api/resources/conversation/errors/InvalidConversationIdError.d.ts +0 -8
  688. package/api/resources/conversation/errors/InvalidConversationIdError.js +0 -14
  689. package/api/resources/conversation/errors/InvalidConversationMessageIdError.d.ts +0 -8
  690. package/api/resources/conversation/errors/InvalidConversationMessageIdError.js +0 -14
  691. package/api/resources/conversation/errors/InvalidFeedbackTypeError.d.ts +0 -8
  692. package/api/resources/conversation/errors/InvalidFeedbackTypeError.js +0 -14
  693. package/api/resources/conversation/errors/index.d.ts +0 -7
  694. package/api/resources/conversation/errors/index.js +0 -7
  695. package/api/resources/conversation/types/ConversationContext.d.ts +0 -20
  696. package/api/resources/conversation/types/ConversationMessageContext.d.ts +0 -12
  697. package/api/resources/knowledge/errors/DocumentCreationError.d.ts +0 -7
  698. package/api/resources/knowledge/errors/DocumentCreationError.js +0 -13
  699. package/api/resources/knowledge/errors/DocumentNotFoundError.d.ts +0 -8
  700. package/api/resources/knowledge/errors/DocumentNotFoundError.js +0 -14
  701. package/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.d.ts +0 -8
  702. package/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.js +0 -14
  703. package/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.d.ts +0 -8
  704. package/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.js +0 -14
  705. package/api/resources/knowledge/errors/VersionInProgressError.d.ts +0 -8
  706. package/api/resources/knowledge/errors/VersionInProgressError.js +0 -14
  707. package/api/resources/knowledge/errors/VersionNotInProgressError.d.ts +0 -8
  708. package/api/resources/knowledge/errors/VersionNotInProgressError.js +0 -14
  709. package/api/resources/knowledge/errors/index.d.ts +0 -6
  710. package/api/resources/knowledge/errors/index.js +0 -6
  711. package/api/resources/knowledge/types/KnowledgeBaseId.d.ts +0 -7
  712. package/api/resources/knowledge/types/KnowledgeDocumentId.d.ts +0 -9
  713. package/dist/api/resources/commons/types/User.d.ts +0 -9
  714. package/dist/api/resources/conversation/errors/ConversationAlreadyExistsError.d.ts +0 -8
  715. package/dist/api/resources/conversation/errors/ConversationAlreadyExistsError.js +0 -14
  716. package/dist/api/resources/conversation/errors/ConversationMessageNotFoundError.d.ts +0 -8
  717. package/dist/api/resources/conversation/errors/ConversationMessageNotFoundError.js +0 -14
  718. package/dist/api/resources/conversation/errors/ConversationNotFoundError.d.ts +0 -8
  719. package/dist/api/resources/conversation/errors/ConversationNotFoundError.js +0 -14
  720. package/dist/api/resources/conversation/errors/EmptyConversationError.js +0 -14
  721. package/dist/api/resources/conversation/errors/InvalidConversationIdError.d.ts +0 -8
  722. package/dist/api/resources/conversation/errors/InvalidConversationIdError.js +0 -14
  723. package/dist/api/resources/conversation/errors/InvalidConversationMessageIdError.d.ts +0 -8
  724. package/dist/api/resources/conversation/errors/InvalidConversationMessageIdError.js +0 -14
  725. package/dist/api/resources/conversation/errors/InvalidFeedbackTypeError.d.ts +0 -8
  726. package/dist/api/resources/conversation/errors/InvalidFeedbackTypeError.js +0 -14
  727. package/dist/api/resources/conversation/errors/index.d.ts +0 -7
  728. package/dist/api/resources/conversation/errors/index.js +0 -7
  729. package/dist/api/resources/conversation/types/ConversationContext.d.ts +0 -20
  730. package/dist/api/resources/conversation/types/ConversationMessageContext.d.ts +0 -12
  731. package/dist/api/resources/knowledge/errors/DocumentCreationError.d.ts +0 -7
  732. package/dist/api/resources/knowledge/errors/DocumentCreationError.js +0 -13
  733. package/dist/api/resources/knowledge/errors/DocumentNotFoundError.d.ts +0 -8
  734. package/dist/api/resources/knowledge/errors/DocumentNotFoundError.js +0 -14
  735. package/dist/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.d.ts +0 -8
  736. package/dist/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.js +0 -14
  737. package/dist/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.d.ts +0 -8
  738. package/dist/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.js +0 -14
  739. package/dist/api/resources/knowledge/errors/VersionInProgressError.d.ts +0 -8
  740. package/dist/api/resources/knowledge/errors/VersionNotInProgressError.d.ts +0 -8
  741. package/dist/api/resources/knowledge/errors/VersionNotInProgressError.js +0 -14
  742. package/dist/api/resources/knowledge/errors/index.d.ts +0 -6
  743. package/dist/api/resources/knowledge/errors/index.js +0 -6
  744. package/dist/api/resources/knowledge/types/KnowledgeBaseId.d.ts +0 -7
  745. package/dist/api/resources/knowledge/types/KnowledgeDocumentId.d.ts +0 -9
  746. package/dist/serialization/resources/commons/types/User.js +0 -9
  747. package/dist/serialization/resources/conversation/types/ConversationContext.d.ts +0 -20
  748. package/dist/serialization/resources/conversation/types/ConversationContext.js +0 -15
  749. package/dist/serialization/resources/conversation/types/ConversationMessageContext.d.ts +0 -16
  750. package/dist/serialization/resources/conversation/types/ConversationMessageContext.js +0 -11
  751. package/dist/serialization/resources/knowledge/types/KnowledgeBaseId.d.ts +0 -12
  752. package/dist/serialization/resources/knowledge/types/KnowledgeBaseId.js +0 -7
  753. package/dist/serialization/resources/knowledge/types/KnowledgeDocumentId.d.ts +0 -13
  754. package/dist/serialization/resources/knowledge/types/KnowledgeDocumentId.js +0 -8
  755. package/serialization/resources/commons/types/User.js +0 -9
  756. package/serialization/resources/conversation/types/ConversationContext.d.ts +0 -20
  757. package/serialization/resources/conversation/types/ConversationContext.js +0 -15
  758. package/serialization/resources/conversation/types/ConversationMessageContext.d.ts +0 -16
  759. package/serialization/resources/conversation/types/ConversationMessageContext.js +0 -11
  760. package/serialization/resources/knowledge/types/KnowledgeBaseId.d.ts +0 -12
  761. package/serialization/resources/knowledge/types/KnowledgeBaseId.js +0 -7
  762. package/serialization/resources/knowledge/types/KnowledgeDocumentId.d.ts +0 -13
  763. package/serialization/resources/knowledge/types/KnowledgeDocumentId.js +0 -8
  764. /package/api/resources/{commons/types/User.js → actions/types/ActionBase.js} +0 -0
  765. /package/api/resources/{conversation/types/ConversationContext.js → actions/types/ActionParameter.js} +0 -0
  766. /package/api/resources/{conversation/types/ConversationMessageContext.js → actions/types/ActionRequest.js} +0 -0
  767. /package/api/resources/{knowledge/types/IdBody.js → actions/types/ActionResponse.js} +0 -0
  768. /package/api/resources/{knowledge/types/KnowledgeBase.js → actions/types/ConversationExecutedActionPrecondition.js} +0 -0
  769. /package/api/resources/{knowledge/types/KnowledgeBaseId.js → actions/types/ConversationPrecondition.js} +0 -0
  770. /package/api/resources/{knowledge/types/KnowledgeDocument.js → actions/types/MetadataPrecondition.js} +0 -0
  771. /package/api/resources/{knowledge/types/KnowledgeDocumentId.js → actions/types/Precondition.js} +0 -0
  772. /package/{dist/api/resources/commons/types/User.js → api/resources/actions/types/PreconditionGroup.js} +0 -0
  773. /package/{dist/api/resources/conversation/types/ConversationContext.js → api/resources/commons/types/AppUser.js} +0 -0
  774. /package/{dist/api/resources/conversation/types/ConversationMessageContext.js → api/resources/commons/types/AppUserIdentifier.js} +0 -0
  775. /package/{dist/api/resources/knowledge/types/IdBody.js → api/resources/commons/types/AppUserRequest.js} +0 -0
  776. /package/{dist/api/resources/knowledge/types/KnowledgeBase.js → api/resources/commons/types/AppUserResponse.js} +0 -0
  777. /package/{dist/api/resources/knowledge/types/KnowledgeBaseId.js → api/resources/commons/types/EntityId.js} +0 -0
  778. /package/{dist/api/resources/knowledge/types/KnowledgeDocument.js → api/resources/commons/types/EntityIdBase.js} +0 -0
  779. /package/{dist/api/resources/knowledge/types/KnowledgeDocumentId.js → api/resources/commons/types/EventTriggerBase.js} +0 -0
@@ -0,0 +1,48 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { chooseStreamWrapper } from "./stream-wrappers/chooseStreamWrapper";
11
+ export function getResponseBody(response, responseType) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ if (response.body != null && responseType === "blob") {
14
+ return yield response.blob();
15
+ }
16
+ else if (response.body != null && responseType === "sse") {
17
+ return response.body;
18
+ }
19
+ else if (response.body != null && responseType === "streaming") {
20
+ return chooseStreamWrapper(response.body);
21
+ }
22
+ else if (response.body != null && responseType === "text") {
23
+ return yield response.text();
24
+ }
25
+ else {
26
+ const text = yield response.text();
27
+ if (text.length > 0) {
28
+ try {
29
+ let responseBody = JSON.parse(text);
30
+ return responseBody;
31
+ }
32
+ catch (err) {
33
+ return {
34
+ ok: false,
35
+ error: {
36
+ reason: "non-json",
37
+ statusCode: response.status,
38
+ rawBody: text,
39
+ },
40
+ };
41
+ }
42
+ }
43
+ else {
44
+ return undefined;
45
+ }
46
+ }
47
+ });
48
+ }
@@ -0,0 +1 @@
1
+ export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number | undefined, abortSignal?: AbortSignal | undefined, withCredentials?: boolean | undefined, duplex?: "half" | undefined) => Promise<Response>;
@@ -0,0 +1,38 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { anySignal, getTimeoutSignal } from "./signals";
11
+ export const makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex) => __awaiter(void 0, void 0, void 0, function* () {
12
+ const signals = [];
13
+ // Add timeout signal
14
+ let timeoutAbortId = undefined;
15
+ if (timeoutMs != null) {
16
+ const { signal, abortId } = getTimeoutSignal(timeoutMs);
17
+ timeoutAbortId = abortId;
18
+ signals.push(signal);
19
+ }
20
+ // Add arbitrary signal
21
+ if (abortSignal != null) {
22
+ signals.push(abortSignal);
23
+ }
24
+ let newSignals = anySignal(signals);
25
+ const response = yield fetchFn(url, {
26
+ method: method,
27
+ headers,
28
+ body: requestBody,
29
+ signal: newSignals,
30
+ credentials: withCredentials ? "include" : undefined,
31
+ // @ts-ignore
32
+ duplex,
33
+ });
34
+ if (timeoutAbortId != null) {
35
+ clearTimeout(timeoutAbortId);
36
+ }
37
+ return response;
38
+ });
@@ -0,0 +1 @@
1
+ export declare function requestWithRetries(requestFn: () => Promise<Response>, maxRetries?: number): Promise<Response>;
@@ -0,0 +1,28 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ const INITIAL_RETRY_DELAY = 1;
11
+ const MAX_RETRY_DELAY = 60;
12
+ const DEFAULT_MAX_RETRIES = 2;
13
+ export function requestWithRetries(requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ let response = yield requestFn();
16
+ for (let i = 0; i < maxRetries; ++i) {
17
+ if ([408, 409, 429].includes(response.status) || response.status >= 500) {
18
+ const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
19
+ yield new Promise((resolve) => setTimeout(resolve, delay));
20
+ response = yield requestFn();
21
+ }
22
+ else {
23
+ break;
24
+ }
25
+ }
26
+ return response;
27
+ });
28
+ }
@@ -0,0 +1,12 @@
1
+ /// <reference types="node" />
2
+ export declare function getTimeoutSignal(timeoutMs: number): {
3
+ signal: AbortSignal;
4
+ abortId: NodeJS.Timeout;
5
+ };
6
+ /**
7
+ * Returns an abort signal that is getting aborted when
8
+ * at least one of the specified abort signals is aborted.
9
+ *
10
+ * Requires at least node.js 18.
11
+ */
12
+ export declare function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal;
@@ -0,0 +1,32 @@
1
+ const TIMEOUT = "timeout";
2
+ export function getTimeoutSignal(timeoutMs) {
3
+ const controller = new AbortController();
4
+ const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
5
+ return { signal: controller.signal, abortId };
6
+ }
7
+ /**
8
+ * Returns an abort signal that is getting aborted when
9
+ * at least one of the specified abort signals is aborted.
10
+ *
11
+ * Requires at least node.js 18.
12
+ */
13
+ export function anySignal(...args) {
14
+ // Allowing signals to be passed either as array
15
+ // of signals or as multiple arguments.
16
+ const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args);
17
+ const controller = new AbortController();
18
+ for (const signal of signals) {
19
+ if (signal.aborted) {
20
+ // Exiting early if one of the signals
21
+ // is already aborted.
22
+ controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
23
+ break;
24
+ }
25
+ // Listening for signals and removing the listeners
26
+ // when at least one symbol is aborted.
27
+ signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
28
+ signal: controller.signal,
29
+ });
30
+ }
31
+ return controller.signal;
32
+ }
@@ -0,0 +1,30 @@
1
+ /// <reference types="node" />
2
+ import type { Writable } from "stream";
3
+ import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
4
+ export declare class Node18UniversalStreamWrapper implements StreamWrapper<Node18UniversalStreamWrapper | Writable | WritableStream<Uint8Array>, Uint8Array> {
5
+ private readableStream;
6
+ private reader;
7
+ private events;
8
+ private paused;
9
+ private resumeCallback;
10
+ private encoding;
11
+ constructor(readableStream: ReadableStream<Uint8Array>);
12
+ on(event: string, callback: EventCallback): void;
13
+ off(event: string, callback: EventCallback): void;
14
+ pipe(dest: Node18UniversalStreamWrapper | Writable | WritableStream<Uint8Array>): Node18UniversalStreamWrapper | Writable | WritableStream<Uint8Array>;
15
+ pipeTo(dest: Node18UniversalStreamWrapper | Writable | WritableStream<Uint8Array>): Node18UniversalStreamWrapper | Writable | WritableStream<Uint8Array>;
16
+ unpipe(dest: Node18UniversalStreamWrapper | Writable | WritableStream<Uint8Array>): void;
17
+ destroy(error?: Error): void;
18
+ pause(): void;
19
+ resume(): void;
20
+ get isPaused(): boolean;
21
+ read(): Promise<Uint8Array | undefined>;
22
+ setEncoding(encoding: string): void;
23
+ text(): Promise<string>;
24
+ json<T>(): Promise<T>;
25
+ private _write;
26
+ private _end;
27
+ private _error;
28
+ private _emit;
29
+ private _startReading;
30
+ }
@@ -0,0 +1,222 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export class Node18UniversalStreamWrapper {
11
+ constructor(readableStream) {
12
+ this.readableStream = readableStream;
13
+ this.reader = this.readableStream.getReader();
14
+ this.events = {
15
+ data: [],
16
+ end: [],
17
+ error: [],
18
+ readable: [],
19
+ close: [],
20
+ pause: [],
21
+ resume: [],
22
+ };
23
+ this.paused = false;
24
+ this.resumeCallback = null;
25
+ this.encoding = null;
26
+ }
27
+ on(event, callback) {
28
+ var _a;
29
+ (_a = this.events[event]) === null || _a === void 0 ? void 0 : _a.push(callback);
30
+ }
31
+ off(event, callback) {
32
+ var _a;
33
+ this.events[event] = (_a = this.events[event]) === null || _a === void 0 ? void 0 : _a.filter((cb) => cb !== callback);
34
+ }
35
+ pipe(dest) {
36
+ this.on("data", (chunk) => __awaiter(this, void 0, void 0, function* () {
37
+ if (dest instanceof Node18UniversalStreamWrapper) {
38
+ dest._write(chunk);
39
+ }
40
+ else if (dest instanceof WritableStream) {
41
+ const writer = dest.getWriter();
42
+ writer.write(chunk).then(() => writer.releaseLock());
43
+ }
44
+ else {
45
+ dest.write(chunk);
46
+ }
47
+ }));
48
+ this.on("end", () => __awaiter(this, void 0, void 0, function* () {
49
+ if (dest instanceof Node18UniversalStreamWrapper) {
50
+ dest._end();
51
+ }
52
+ else if (dest instanceof WritableStream) {
53
+ const writer = dest.getWriter();
54
+ writer.close();
55
+ }
56
+ else {
57
+ dest.end();
58
+ }
59
+ }));
60
+ this.on("error", (error) => __awaiter(this, void 0, void 0, function* () {
61
+ if (dest instanceof Node18UniversalStreamWrapper) {
62
+ dest._error(error);
63
+ }
64
+ else if (dest instanceof WritableStream) {
65
+ const writer = dest.getWriter();
66
+ writer.abort(error);
67
+ }
68
+ else {
69
+ dest.destroy(error);
70
+ }
71
+ }));
72
+ this._startReading();
73
+ return dest;
74
+ }
75
+ pipeTo(dest) {
76
+ return this.pipe(dest);
77
+ }
78
+ unpipe(dest) {
79
+ this.off("data", (chunk) => __awaiter(this, void 0, void 0, function* () {
80
+ if (dest instanceof Node18UniversalStreamWrapper) {
81
+ dest._write(chunk);
82
+ }
83
+ else if (dest instanceof WritableStream) {
84
+ const writer = dest.getWriter();
85
+ writer.write(chunk).then(() => writer.releaseLock());
86
+ }
87
+ else {
88
+ dest.write(chunk);
89
+ }
90
+ }));
91
+ this.off("end", () => __awaiter(this, void 0, void 0, function* () {
92
+ if (dest instanceof Node18UniversalStreamWrapper) {
93
+ dest._end();
94
+ }
95
+ else if (dest instanceof WritableStream) {
96
+ const writer = dest.getWriter();
97
+ writer.close();
98
+ }
99
+ else {
100
+ dest.end();
101
+ }
102
+ }));
103
+ this.off("error", (error) => __awaiter(this, void 0, void 0, function* () {
104
+ if (dest instanceof Node18UniversalStreamWrapper) {
105
+ dest._error(error);
106
+ }
107
+ else if (dest instanceof WritableStream) {
108
+ const writer = dest.getWriter();
109
+ writer.abort(error);
110
+ }
111
+ else {
112
+ dest.destroy(error);
113
+ }
114
+ }));
115
+ }
116
+ destroy(error) {
117
+ this.reader
118
+ .cancel(error)
119
+ .then(() => {
120
+ this._emit("close");
121
+ })
122
+ .catch((err) => {
123
+ this._emit("error", err);
124
+ });
125
+ }
126
+ pause() {
127
+ this.paused = true;
128
+ this._emit("pause");
129
+ }
130
+ resume() {
131
+ if (this.paused) {
132
+ this.paused = false;
133
+ this._emit("resume");
134
+ if (this.resumeCallback) {
135
+ this.resumeCallback();
136
+ this.resumeCallback = null;
137
+ }
138
+ }
139
+ }
140
+ get isPaused() {
141
+ return this.paused;
142
+ }
143
+ read() {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ if (this.paused) {
146
+ yield new Promise((resolve) => {
147
+ this.resumeCallback = resolve;
148
+ });
149
+ }
150
+ const { done, value } = yield this.reader.read();
151
+ if (done) {
152
+ return undefined;
153
+ }
154
+ return value;
155
+ });
156
+ }
157
+ setEncoding(encoding) {
158
+ this.encoding = encoding;
159
+ }
160
+ text() {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ const chunks = [];
163
+ while (true) {
164
+ const { done, value } = yield this.reader.read();
165
+ if (done)
166
+ break;
167
+ if (value)
168
+ chunks.push(value);
169
+ }
170
+ const decoder = new TextDecoder(this.encoding || "utf-8");
171
+ return decoder.decode(yield new Blob(chunks).arrayBuffer());
172
+ });
173
+ }
174
+ json() {
175
+ return __awaiter(this, void 0, void 0, function* () {
176
+ const text = yield this.text();
177
+ return JSON.parse(text);
178
+ });
179
+ }
180
+ _write(chunk) {
181
+ this._emit("data", chunk);
182
+ }
183
+ _end() {
184
+ this._emit("end");
185
+ }
186
+ _error(error) {
187
+ this._emit("error", error);
188
+ }
189
+ _emit(event, data) {
190
+ if (this.events[event]) {
191
+ for (const callback of this.events[event] || []) {
192
+ callback(data);
193
+ }
194
+ }
195
+ }
196
+ _startReading() {
197
+ return __awaiter(this, void 0, void 0, function* () {
198
+ try {
199
+ this._emit("readable");
200
+ while (true) {
201
+ if (this.paused) {
202
+ yield new Promise((resolve) => {
203
+ this.resumeCallback = resolve;
204
+ });
205
+ }
206
+ const { done, value } = yield this.reader.read();
207
+ if (done) {
208
+ this._emit("end");
209
+ this._emit("close");
210
+ break;
211
+ }
212
+ if (value) {
213
+ this._emit("data", value);
214
+ }
215
+ }
216
+ }
217
+ catch (error) {
218
+ this._emit("error", error);
219
+ }
220
+ });
221
+ }
222
+ }
@@ -0,0 +1,21 @@
1
+ /// <reference types="node" />
2
+ import type { Readable, Writable } from "stream";
3
+ import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
4
+ export declare class NodePre18StreamWrapper implements StreamWrapper<Writable, Buffer> {
5
+ private readableStream;
6
+ private encoding;
7
+ constructor(readableStream: Readable);
8
+ on(event: string, callback: EventCallback): void;
9
+ off(event: string, callback: EventCallback): void;
10
+ pipe(dest: Writable): Writable;
11
+ pipeTo(dest: Writable): Writable;
12
+ unpipe(dest?: Writable): void;
13
+ destroy(error?: Error): void;
14
+ pause(): void;
15
+ resume(): void;
16
+ get isPaused(): boolean;
17
+ read(): Promise<Buffer | undefined>;
18
+ setEncoding(encoding?: string): void;
19
+ text(): Promise<string>;
20
+ json<T>(): Promise<T>;
21
+ }
@@ -0,0 +1,104 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
11
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
12
+ var m = o[Symbol.asyncIterator], i;
13
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
14
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
15
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
16
+ };
17
+ export class NodePre18StreamWrapper {
18
+ constructor(readableStream) {
19
+ this.readableStream = readableStream;
20
+ }
21
+ on(event, callback) {
22
+ this.readableStream.on(event, callback);
23
+ }
24
+ off(event, callback) {
25
+ this.readableStream.off(event, callback);
26
+ }
27
+ pipe(dest) {
28
+ this.readableStream.pipe(dest);
29
+ return dest;
30
+ }
31
+ pipeTo(dest) {
32
+ return this.pipe(dest);
33
+ }
34
+ unpipe(dest) {
35
+ if (dest) {
36
+ this.readableStream.unpipe(dest);
37
+ }
38
+ else {
39
+ this.readableStream.unpipe();
40
+ }
41
+ }
42
+ destroy(error) {
43
+ this.readableStream.destroy(error);
44
+ }
45
+ pause() {
46
+ this.readableStream.pause();
47
+ }
48
+ resume() {
49
+ this.readableStream.resume();
50
+ }
51
+ get isPaused() {
52
+ return this.readableStream.isPaused();
53
+ }
54
+ read() {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ return new Promise((resolve, reject) => {
57
+ const chunk = this.readableStream.read();
58
+ if (chunk) {
59
+ resolve(chunk);
60
+ }
61
+ else {
62
+ this.readableStream.once("readable", () => {
63
+ const chunk = this.readableStream.read();
64
+ resolve(chunk);
65
+ });
66
+ this.readableStream.once("error", reject);
67
+ }
68
+ });
69
+ });
70
+ }
71
+ setEncoding(encoding) {
72
+ this.readableStream.setEncoding(encoding);
73
+ this.encoding = encoding;
74
+ }
75
+ text() {
76
+ var e_1, _a;
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const chunks = [];
79
+ const encoder = new TextEncoder();
80
+ this.readableStream.setEncoding((this.encoding || "utf-8"));
81
+ try {
82
+ for (var _b = __asyncValues(this.readableStream), _c; _c = yield _b.next(), !_c.done;) {
83
+ const chunk = _c.value;
84
+ chunks.push(encoder.encode(chunk));
85
+ }
86
+ }
87
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
88
+ finally {
89
+ try {
90
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
91
+ }
92
+ finally { if (e_1) throw e_1.error; }
93
+ }
94
+ const decoder = new TextDecoder(this.encoding || "utf-8");
95
+ return decoder.decode(Buffer.concat(chunks));
96
+ });
97
+ }
98
+ json() {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const text = yield this.text();
101
+ return JSON.parse(text);
102
+ });
103
+ }
104
+ }
@@ -0,0 +1,30 @@
1
+ import { StreamWrapper } from "./chooseStreamWrapper";
2
+ declare type EventCallback = (data?: any) => void;
3
+ export declare class UndiciStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array> implements StreamWrapper<UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>, ReadFormat> {
4
+ private readableStream;
5
+ private reader;
6
+ private events;
7
+ private paused;
8
+ private resumeCallback;
9
+ private encoding;
10
+ constructor(readableStream: ReadableStream<ReadFormat>);
11
+ on(event: string, callback: EventCallback): void;
12
+ off(event: string, callback: EventCallback): void;
13
+ pipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
14
+ pipeTo(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
15
+ unpipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<any>): void;
16
+ destroy(error?: Error): void;
17
+ pause(): void;
18
+ resume(): void;
19
+ get isPaused(): boolean;
20
+ read(): Promise<ReadFormat | undefined>;
21
+ setEncoding(encoding: string): void;
22
+ text(): Promise<string>;
23
+ json<T>(): Promise<T>;
24
+ private _write;
25
+ private _end;
26
+ private _error;
27
+ private _emit;
28
+ private _startReading;
29
+ }
30
+ export {};