@credal/sdk 0.0.13 → 0.0.15

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 (332) hide show
  1. package/Client.d.ts +3 -0
  2. package/api/resources/common/types/index.d.ts +1 -0
  3. package/api/resources/common/types/index.js +1 -0
  4. package/api/resources/copilots/client/Client.d.ts +25 -11
  5. package/api/resources/copilots/client/Client.js +119 -37
  6. package/api/resources/copilots/client/requests/CreateCopilotRequest.d.ts +1 -1
  7. package/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.d.ts +1 -1
  8. package/api/resources/copilots/client/requests/SendMessageRequest.d.ts +14 -1
  9. package/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +60 -0
  10. package/api/resources/copilots/client/requests/StreamMessageRequest.js +5 -0
  11. package/api/resources/copilots/client/requests/index.d.ts +1 -0
  12. package/api/resources/copilots/types/BlockedChunk.d.ts +10 -0
  13. package/api/resources/copilots/types/BlockedChunk.js +5 -0
  14. package/api/resources/copilots/types/BooleanFieldSchema.d.ts +8 -0
  15. package/api/resources/copilots/types/BooleanFieldSchema.js +5 -0
  16. package/api/resources/copilots/types/CollectionFilteredData.d.ts +9 -0
  17. package/api/resources/copilots/types/CollectionFilteredData.js +5 -0
  18. package/api/resources/copilots/types/DataChunk.d.ts +6 -0
  19. package/api/resources/copilots/types/DataChunk.js +5 -0
  20. package/api/resources/copilots/types/DataFilter.d.ts +9 -0
  21. package/api/resources/copilots/types/DataFilter.js +5 -0
  22. package/api/resources/copilots/types/DatetimeFieldSchema.d.ts +9 -0
  23. package/api/resources/copilots/types/DatetimeFieldSchema.js +5 -0
  24. package/api/resources/copilots/types/Filter.d.ts +19 -0
  25. package/api/resources/copilots/types/Filter.js +5 -0
  26. package/api/resources/copilots/types/FinalChunk.d.ts +7 -0
  27. package/api/resources/copilots/types/FinalChunk.js +5 -0
  28. package/api/resources/copilots/types/InitialChunk.d.ts +10 -0
  29. package/api/resources/copilots/types/InitialChunk.js +5 -0
  30. package/api/resources/copilots/types/InputVariable.d.ts +7 -0
  31. package/api/resources/copilots/types/InputVariable.js +5 -0
  32. package/api/resources/copilots/types/MessageReply.d.ts +1 -0
  33. package/api/resources/copilots/types/NumberFieldSchema.d.ts +9 -0
  34. package/api/resources/copilots/types/NumberFieldSchema.js +5 -0
  35. package/api/resources/copilots/types/StreamingChunk.d.ts +5 -0
  36. package/api/resources/copilots/types/StreamingChunk.js +5 -0
  37. package/api/resources/copilots/types/StringFieldSchema.d.ts +9 -0
  38. package/api/resources/copilots/types/StringFieldSchema.js +5 -0
  39. package/api/resources/copilots/types/WebSearchResult.d.ts +8 -0
  40. package/api/resources/copilots/types/WebSearchResult.js +5 -0
  41. package/api/resources/copilots/types/index.d.ts +14 -0
  42. package/api/resources/copilots/types/index.js +14 -0
  43. package/api/resources/documentCatalog/client/Client.d.ts +7 -4
  44. package/api/resources/documentCatalog/client/Client.js +13 -13
  45. package/api/resources/documentCollections/client/Client.d.ts +14 -11
  46. package/api/resources/documentCollections/client/Client.js +39 -29
  47. package/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.d.ts +2 -2
  48. package/api/resources/documentCollections/client/requests/CreateCollectionRequest.d.ts +1 -1
  49. package/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.d.ts +2 -2
  50. package/api/resources/permissionsService/client/Client.d.ts +8 -5
  51. package/api/resources/permissionsService/client/Client.js +20 -14
  52. package/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +1 -1
  53. package/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +1 -1
  54. package/api/resources/search/client/Client.d.ts +5 -2
  55. package/api/resources/search/client/Client.js +7 -7
  56. package/api/resources/search/client/requests/SearchDocumentCollectionRequest.d.ts +1 -1
  57. package/api/resources/search/types/index.d.ts +0 -1
  58. package/api/resources/search/types/index.js +0 -1
  59. package/api/resources/users/client/Client.d.ts +4 -1
  60. package/api/resources/users/client/Client.js +5 -3
  61. package/core/fetcher/Fetcher.d.ts +4 -1
  62. package/core/fetcher/Fetcher.js +19 -176
  63. package/core/fetcher/createRequestUrl.d.ts +1 -0
  64. package/core/fetcher/createRequestUrl.js +13 -0
  65. package/core/fetcher/getFetchFn.d.ts +4 -0
  66. package/core/fetcher/getFetchFn.js +59 -0
  67. package/core/fetcher/getRequestBody.d.ts +7 -0
  68. package/core/fetcher/getRequestBody.js +23 -0
  69. package/core/fetcher/getResponseBody.d.ts +1 -0
  70. package/core/fetcher/getResponseBody.js +55 -0
  71. package/core/fetcher/makeRequest.d.ts +1 -0
  72. package/core/fetcher/makeRequest.js +42 -0
  73. package/core/fetcher/requestWithRetries.d.ts +1 -0
  74. package/core/fetcher/requestWithRetries.js +41 -0
  75. package/core/fetcher/signals.d.ts +12 -0
  76. package/core/fetcher/signals.js +37 -0
  77. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  78. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  79. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
  80. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
  81. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  82. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  83. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  84. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +50 -0
  85. package/core/index.d.ts +1 -0
  86. package/core/index.js +1 -0
  87. package/core/runtime/runtime.d.ts +2 -1
  88. package/core/runtime/runtime.js +12 -1
  89. package/core/schemas/Schema.d.ts +8 -4
  90. package/core/schemas/Schema.js +1 -0
  91. package/core/schemas/builders/bigint/bigint.d.ts +2 -0
  92. package/core/schemas/builders/bigint/bigint.js +50 -0
  93. package/core/schemas/builders/bigint/index.d.ts +1 -0
  94. package/core/schemas/builders/bigint/index.js +5 -0
  95. package/core/schemas/builders/index.d.ts +1 -0
  96. package/core/schemas/builders/index.js +1 -0
  97. package/core/schemas/builders/lazy/lazy.d.ts +2 -2
  98. package/core/schemas/builders/lazy/lazy.js +8 -19
  99. package/core/schemas/builders/lazy/lazyObject.js +1 -10
  100. package/core/schemas/builders/list/list.js +31 -44
  101. package/core/schemas/builders/object/object.js +90 -111
  102. package/core/schemas/builders/object/types.d.ts +2 -2
  103. package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  104. package/core/schemas/builders/record/record.js +49 -60
  105. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  106. package/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
  107. package/core/schemas/builders/set/set.js +6 -15
  108. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  109. package/core/schemas/builders/union/union.js +51 -62
  110. package/core/schemas/utils/getErrorMessageForIncorrectType.js +4 -0
  111. package/core/schemas/utils/maybeSkipValidation.js +3 -12
  112. package/core/streaming-fetcher/Stream.d.ts +48 -0
  113. package/core/streaming-fetcher/Stream.js +170 -0
  114. package/core/streaming-fetcher/index.d.ts +1 -0
  115. package/core/streaming-fetcher/index.js +5 -0
  116. package/dist/Client.d.ts +3 -0
  117. package/dist/api/resources/common/types/index.d.ts +1 -0
  118. package/dist/api/resources/common/types/index.js +1 -0
  119. package/dist/api/resources/copilots/client/Client.d.ts +25 -11
  120. package/dist/api/resources/copilots/client/Client.js +119 -37
  121. package/dist/api/resources/copilots/client/requests/CreateCopilotRequest.d.ts +1 -1
  122. package/dist/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.d.ts +1 -1
  123. package/dist/api/resources/copilots/client/requests/SendMessageRequest.d.ts +14 -1
  124. package/dist/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +60 -0
  125. package/dist/api/resources/copilots/client/requests/StreamMessageRequest.js +5 -0
  126. package/dist/api/resources/copilots/client/requests/index.d.ts +1 -0
  127. package/dist/api/resources/copilots/types/BlockedChunk.d.ts +10 -0
  128. package/dist/api/resources/copilots/types/BlockedChunk.js +5 -0
  129. package/dist/api/resources/copilots/types/BooleanFieldSchema.d.ts +8 -0
  130. package/dist/api/resources/copilots/types/BooleanFieldSchema.js +5 -0
  131. package/dist/api/resources/copilots/types/CollectionFilteredData.d.ts +9 -0
  132. package/dist/api/resources/copilots/types/CollectionFilteredData.js +5 -0
  133. package/dist/api/resources/copilots/types/DataChunk.d.ts +6 -0
  134. package/dist/api/resources/copilots/types/DataChunk.js +5 -0
  135. package/dist/api/resources/copilots/types/DataFilter.d.ts +9 -0
  136. package/dist/api/resources/copilots/types/DataFilter.js +5 -0
  137. package/dist/api/resources/copilots/types/DatetimeFieldSchema.d.ts +9 -0
  138. package/dist/api/resources/copilots/types/DatetimeFieldSchema.js +5 -0
  139. package/dist/api/resources/copilots/types/Filter.d.ts +19 -0
  140. package/dist/api/resources/copilots/types/Filter.js +5 -0
  141. package/dist/api/resources/copilots/types/FinalChunk.d.ts +7 -0
  142. package/dist/api/resources/copilots/types/FinalChunk.js +5 -0
  143. package/dist/api/resources/copilots/types/InitialChunk.d.ts +10 -0
  144. package/dist/api/resources/copilots/types/InitialChunk.js +5 -0
  145. package/dist/api/resources/copilots/types/InputVariable.d.ts +7 -0
  146. package/dist/api/resources/copilots/types/InputVariable.js +5 -0
  147. package/dist/api/resources/copilots/types/MessageReply.d.ts +1 -0
  148. package/dist/api/resources/copilots/types/NumberFieldSchema.d.ts +9 -0
  149. package/dist/api/resources/copilots/types/NumberFieldSchema.js +5 -0
  150. package/dist/api/resources/copilots/types/StreamingChunk.d.ts +5 -0
  151. package/dist/api/resources/copilots/types/StreamingChunk.js +5 -0
  152. package/dist/api/resources/copilots/types/StringFieldSchema.d.ts +9 -0
  153. package/dist/api/resources/copilots/types/StringFieldSchema.js +5 -0
  154. package/dist/api/resources/copilots/types/WebSearchResult.d.ts +8 -0
  155. package/dist/api/resources/copilots/types/WebSearchResult.js +5 -0
  156. package/dist/api/resources/copilots/types/index.d.ts +14 -0
  157. package/dist/api/resources/copilots/types/index.js +14 -0
  158. package/dist/api/resources/documentCatalog/client/Client.d.ts +7 -4
  159. package/dist/api/resources/documentCatalog/client/Client.js +13 -13
  160. package/dist/api/resources/documentCollections/client/Client.d.ts +14 -11
  161. package/dist/api/resources/documentCollections/client/Client.js +39 -29
  162. package/dist/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.d.ts +2 -2
  163. package/dist/api/resources/documentCollections/client/requests/CreateCollectionRequest.d.ts +1 -1
  164. package/dist/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.d.ts +2 -2
  165. package/dist/api/resources/permissionsService/client/Client.d.ts +8 -5
  166. package/dist/api/resources/permissionsService/client/Client.js +20 -14
  167. package/dist/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +1 -1
  168. package/dist/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +1 -1
  169. package/dist/api/resources/search/client/Client.d.ts +5 -2
  170. package/dist/api/resources/search/client/Client.js +7 -7
  171. package/dist/api/resources/search/client/requests/SearchDocumentCollectionRequest.d.ts +1 -1
  172. package/dist/api/resources/search/types/index.d.ts +0 -1
  173. package/dist/api/resources/search/types/index.js +0 -1
  174. package/dist/api/resources/users/client/Client.d.ts +4 -1
  175. package/dist/api/resources/users/client/Client.js +5 -3
  176. package/dist/core/fetcher/Fetcher.d.ts +4 -1
  177. package/dist/core/fetcher/Fetcher.js +19 -176
  178. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  179. package/dist/core/fetcher/createRequestUrl.js +13 -0
  180. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  181. package/dist/core/fetcher/getFetchFn.js +59 -0
  182. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  183. package/dist/core/fetcher/getRequestBody.js +23 -0
  184. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  185. package/dist/core/fetcher/getResponseBody.js +55 -0
  186. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  187. package/dist/core/fetcher/makeRequest.js +42 -0
  188. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  189. package/dist/core/fetcher/requestWithRetries.js +41 -0
  190. package/dist/core/fetcher/signals.d.ts +12 -0
  191. package/dist/core/fetcher/signals.js +37 -0
  192. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  193. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  194. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
  195. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
  196. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  197. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  198. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  199. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +50 -0
  200. package/dist/core/index.d.ts +1 -0
  201. package/dist/core/index.js +1 -0
  202. package/dist/core/runtime/runtime.d.ts +2 -1
  203. package/dist/core/runtime/runtime.js +12 -1
  204. package/dist/core/schemas/Schema.d.ts +8 -4
  205. package/dist/core/schemas/Schema.js +1 -0
  206. package/dist/core/schemas/builders/bigint/bigint.d.ts +2 -0
  207. package/dist/core/schemas/builders/bigint/bigint.js +50 -0
  208. package/dist/core/schemas/builders/bigint/index.d.ts +1 -0
  209. package/dist/core/schemas/builders/bigint/index.js +5 -0
  210. package/dist/core/schemas/builders/index.d.ts +1 -0
  211. package/dist/core/schemas/builders/index.js +1 -0
  212. package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
  213. package/dist/core/schemas/builders/lazy/lazy.js +8 -19
  214. package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
  215. package/dist/core/schemas/builders/list/list.js +31 -44
  216. package/dist/core/schemas/builders/object/object.js +90 -111
  217. package/dist/core/schemas/builders/object/types.d.ts +2 -2
  218. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  219. package/dist/core/schemas/builders/record/record.js +49 -60
  220. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  221. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
  222. package/dist/core/schemas/builders/set/set.js +6 -15
  223. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  224. package/dist/core/schemas/builders/union/union.js +51 -62
  225. package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +4 -0
  226. package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
  227. package/dist/core/streaming-fetcher/Stream.d.ts +48 -0
  228. package/dist/core/streaming-fetcher/Stream.js +170 -0
  229. package/dist/core/streaming-fetcher/index.d.ts +1 -0
  230. package/dist/core/streaming-fetcher/index.js +5 -0
  231. package/dist/serialization/resources/common/types/index.d.ts +1 -0
  232. package/dist/serialization/resources/common/types/index.js +1 -0
  233. package/dist/serialization/resources/copilots/client/requests/SendMessageRequest.d.ts +2 -0
  234. package/dist/serialization/resources/copilots/client/requests/SendMessageRequest.js +2 -0
  235. package/dist/serialization/resources/copilots/client/requests/StreamMessageRequest.d.ts +17 -0
  236. package/dist/serialization/resources/copilots/client/requests/StreamMessageRequest.js +38 -0
  237. package/dist/serialization/resources/copilots/client/requests/index.d.ts +1 -0
  238. package/dist/serialization/resources/copilots/client/requests/index.js +3 -1
  239. package/dist/serialization/resources/copilots/types/BlockedChunk.d.ts +16 -0
  240. package/dist/serialization/resources/copilots/types/BlockedChunk.js +37 -0
  241. package/dist/serialization/resources/copilots/types/BooleanFieldSchema.d.ts +14 -0
  242. package/dist/serialization/resources/copilots/types/BooleanFieldSchema.js +35 -0
  243. package/dist/serialization/resources/copilots/types/CollectionFilteredData.d.ts +15 -0
  244. package/dist/serialization/resources/copilots/types/CollectionFilteredData.js +36 -0
  245. package/dist/serialization/resources/copilots/types/DataChunk.d.ts +12 -0
  246. package/dist/serialization/resources/copilots/types/DataChunk.js +33 -0
  247. package/dist/serialization/resources/copilots/types/DataFilter.d.ts +15 -0
  248. package/dist/serialization/resources/copilots/types/DataFilter.js +36 -0
  249. package/dist/serialization/resources/copilots/types/DatetimeFieldSchema.d.ts +15 -0
  250. package/dist/serialization/resources/copilots/types/DatetimeFieldSchema.js +36 -0
  251. package/dist/serialization/resources/copilots/types/Filter.d.ts +26 -0
  252. package/dist/serialization/resources/copilots/types/Filter.js +45 -0
  253. package/dist/serialization/resources/copilots/types/FinalChunk.d.ts +13 -0
  254. package/dist/serialization/resources/copilots/types/FinalChunk.js +34 -0
  255. package/dist/serialization/resources/copilots/types/InitialChunk.d.ts +17 -0
  256. package/dist/serialization/resources/copilots/types/InitialChunk.js +38 -0
  257. package/dist/serialization/resources/copilots/types/InputVariable.d.ts +13 -0
  258. package/dist/serialization/resources/copilots/types/InputVariable.js +34 -0
  259. package/dist/serialization/resources/copilots/types/MessageReply.d.ts +2 -0
  260. package/dist/serialization/resources/copilots/types/MessageReply.js +2 -0
  261. package/dist/serialization/resources/copilots/types/NumberFieldSchema.d.ts +15 -0
  262. package/dist/serialization/resources/copilots/types/NumberFieldSchema.js +36 -0
  263. package/dist/serialization/resources/copilots/types/StreamingChunk.d.ts +14 -0
  264. package/dist/serialization/resources/copilots/types/StreamingChunk.js +35 -0
  265. package/dist/serialization/resources/copilots/types/StringFieldSchema.d.ts +15 -0
  266. package/dist/serialization/resources/copilots/types/StringFieldSchema.js +36 -0
  267. package/dist/serialization/resources/copilots/types/WebSearchResult.d.ts +14 -0
  268. package/dist/serialization/resources/copilots/types/WebSearchResult.js +35 -0
  269. package/dist/serialization/resources/copilots/types/index.d.ts +14 -0
  270. package/dist/serialization/resources/copilots/types/index.js +14 -0
  271. package/dist/serialization/resources/search/types/SingleFieldFilter.d.ts +1 -1
  272. package/dist/serialization/resources/search/types/SingleFieldFilter.js +1 -1
  273. package/dist/serialization/resources/search/types/index.d.ts +0 -1
  274. package/dist/serialization/resources/search/types/index.js +0 -1
  275. package/dist/version.d.ts +1 -0
  276. package/dist/version.js +4 -0
  277. package/package.json +12 -2
  278. package/reference.md +203 -511
  279. package/serialization/resources/common/types/index.d.ts +1 -0
  280. package/serialization/resources/common/types/index.js +1 -0
  281. package/serialization/resources/copilots/client/requests/SendMessageRequest.d.ts +2 -0
  282. package/serialization/resources/copilots/client/requests/SendMessageRequest.js +2 -0
  283. package/serialization/resources/copilots/client/requests/StreamMessageRequest.d.ts +17 -0
  284. package/serialization/resources/copilots/client/requests/StreamMessageRequest.js +38 -0
  285. package/serialization/resources/copilots/client/requests/index.d.ts +1 -0
  286. package/serialization/resources/copilots/client/requests/index.js +3 -1
  287. package/serialization/resources/copilots/types/BlockedChunk.d.ts +16 -0
  288. package/serialization/resources/copilots/types/BlockedChunk.js +37 -0
  289. package/serialization/resources/copilots/types/BooleanFieldSchema.d.ts +14 -0
  290. package/serialization/resources/copilots/types/BooleanFieldSchema.js +35 -0
  291. package/serialization/resources/copilots/types/CollectionFilteredData.d.ts +15 -0
  292. package/serialization/resources/copilots/types/CollectionFilteredData.js +36 -0
  293. package/serialization/resources/copilots/types/DataChunk.d.ts +12 -0
  294. package/serialization/resources/copilots/types/DataChunk.js +33 -0
  295. package/serialization/resources/copilots/types/DataFilter.d.ts +15 -0
  296. package/serialization/resources/copilots/types/DataFilter.js +36 -0
  297. package/serialization/resources/copilots/types/DatetimeFieldSchema.d.ts +15 -0
  298. package/serialization/resources/copilots/types/DatetimeFieldSchema.js +36 -0
  299. package/serialization/resources/copilots/types/Filter.d.ts +26 -0
  300. package/serialization/resources/copilots/types/Filter.js +45 -0
  301. package/serialization/resources/copilots/types/FinalChunk.d.ts +13 -0
  302. package/serialization/resources/copilots/types/FinalChunk.js +34 -0
  303. package/serialization/resources/copilots/types/InitialChunk.d.ts +17 -0
  304. package/serialization/resources/copilots/types/InitialChunk.js +38 -0
  305. package/serialization/resources/copilots/types/InputVariable.d.ts +13 -0
  306. package/serialization/resources/copilots/types/InputVariable.js +34 -0
  307. package/serialization/resources/copilots/types/MessageReply.d.ts +2 -0
  308. package/serialization/resources/copilots/types/MessageReply.js +2 -0
  309. package/serialization/resources/copilots/types/NumberFieldSchema.d.ts +15 -0
  310. package/serialization/resources/copilots/types/NumberFieldSchema.js +36 -0
  311. package/serialization/resources/copilots/types/StreamingChunk.d.ts +14 -0
  312. package/serialization/resources/copilots/types/StreamingChunk.js +35 -0
  313. package/serialization/resources/copilots/types/StringFieldSchema.d.ts +15 -0
  314. package/serialization/resources/copilots/types/StringFieldSchema.js +36 -0
  315. package/serialization/resources/copilots/types/WebSearchResult.d.ts +14 -0
  316. package/serialization/resources/copilots/types/WebSearchResult.js +35 -0
  317. package/serialization/resources/copilots/types/index.d.ts +14 -0
  318. package/serialization/resources/copilots/types/index.js +14 -0
  319. package/serialization/resources/search/types/SingleFieldFilter.d.ts +1 -1
  320. package/serialization/resources/search/types/SingleFieldFilter.js +1 -1
  321. package/serialization/resources/search/types/index.d.ts +0 -1
  322. package/serialization/resources/search/types/index.js +0 -1
  323. package/version.d.ts +1 -0
  324. package/version.js +4 -0
  325. /package/api/resources/{search → common}/types/Operator.d.ts +0 -0
  326. /package/api/resources/{search → common}/types/Operator.js +0 -0
  327. /package/dist/api/resources/{search → common}/types/Operator.d.ts +0 -0
  328. /package/dist/api/resources/{search → common}/types/Operator.js +0 -0
  329. /package/dist/serialization/resources/{search → common}/types/Operator.d.ts +0 -0
  330. /package/dist/serialization/resources/{search → common}/types/Operator.js +0 -0
  331. /package/serialization/resources/{search → common}/types/Operator.d.ts +0 -0
  332. /package/serialization/resources/{search → common}/types/Operator.js +0 -0
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.undiscriminatedUnion = void 0;
13
4
  const Schema_1 = require("../../Schema");
@@ -15,37 +6,35 @@ const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
15
6
  const schema_utils_1 = require("../schema-utils");
16
7
  function undiscriminatedUnion(schemas) {
17
8
  const baseSchema = {
18
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
9
+ parse: (raw, opts) => {
19
10
  return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.parse(raw, opts), schemas, opts);
20
- }),
21
- json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
11
+ },
12
+ json: (parsed, opts) => {
22
13
  return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.json(parsed, opts), schemas, opts);
23
- }),
14
+ },
24
15
  getType: () => Schema_1.SchemaType.UNDISCRIMINATED_UNION,
25
16
  };
26
17
  return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
27
18
  }
28
19
  exports.undiscriminatedUnion = undiscriminatedUnion;
29
20
  function validateAndTransformUndiscriminatedUnion(transform, schemas, opts) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- const errors = [];
32
- for (const [index, schema] of schemas.entries()) {
33
- const transformed = yield transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
34
- if (transformed.ok) {
35
- return transformed;
36
- }
37
- else {
38
- for (const error of transformed.errors) {
39
- errors.push({
40
- path: error.path,
41
- message: `[Variant ${index}] ${error.message}`,
42
- });
43
- }
21
+ const errors = [];
22
+ for (const [index, schema] of schemas.entries()) {
23
+ const transformed = transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
24
+ if (transformed.ok) {
25
+ return transformed;
26
+ }
27
+ else {
28
+ for (const error of transformed.errors) {
29
+ errors.push({
30
+ path: error.path,
31
+ message: `[Variant ${index}] ${error.message}`,
32
+ });
44
33
  }
45
34
  }
46
- return {
47
- ok: false,
48
- errors,
49
- };
50
- });
35
+ }
36
+ return {
37
+ ok: false,
38
+ errors,
39
+ };
51
40
  }
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __rest = (this && this.__rest) || function (s, e) {
12
3
  var t = {};
13
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -36,7 +27,7 @@ function union(discriminant, union) {
36
27
  : discriminant.parsedDiscriminant;
37
28
  const discriminantValueSchema = (0, enum_1.enum_)((0, keys_1.keys)(union));
38
29
  const baseSchema = {
39
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
30
+ parse: (raw, opts) => {
40
31
  return transformAndValidateUnion({
41
32
  value: raw,
42
33
  discriminant: rawDiscriminant,
@@ -53,8 +44,8 @@ function union(discriminant, union) {
53
44
  transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.parse(additionalProperties, opts),
54
45
  breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
55
46
  });
56
- }),
57
- json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
47
+ },
48
+ json: (parsed, opts) => {
58
49
  return transformAndValidateUnion({
59
50
  value: parsed,
60
51
  discriminant: parsedDiscriminant,
@@ -71,71 +62,69 @@ function union(discriminant, union) {
71
62
  transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.json(additionalProperties, opts),
72
63
  breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
73
64
  });
74
- }),
65
+ },
75
66
  getType: () => Schema_1.SchemaType.UNION,
76
67
  };
77
68
  return Object.assign(Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema));
78
69
  }
79
70
  exports.union = union;
80
71
  function transformAndValidateUnion({ value, discriminant, transformedDiscriminant, transformDiscriminantValue, getAdditionalPropertiesSchema, allowUnrecognizedUnionMembers = false, transformAdditionalProperties, breadcrumbsPrefix = [], }) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- if (!(0, isPlainObject_1.isPlainObject)(value)) {
72
+ if (!(0, isPlainObject_1.isPlainObject)(value)) {
73
+ return {
74
+ ok: false,
75
+ errors: [
76
+ {
77
+ path: breadcrumbsPrefix,
78
+ message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
79
+ },
80
+ ],
81
+ };
82
+ }
83
+ const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
84
+ if (discriminantValue == null) {
85
+ return {
86
+ ok: false,
87
+ errors: [
88
+ {
89
+ path: breadcrumbsPrefix,
90
+ message: `Missing discriminant ("${discriminant}")`,
91
+ },
92
+ ],
93
+ };
94
+ }
95
+ const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue);
96
+ if (!transformedDiscriminantValue.ok) {
97
+ return {
98
+ ok: false,
99
+ errors: transformedDiscriminantValue.errors,
100
+ };
101
+ }
102
+ const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
103
+ if (additionalPropertiesSchema == null) {
104
+ if (allowUnrecognizedUnionMembers) {
83
105
  return {
84
- ok: false,
85
- errors: [
86
- {
87
- path: breadcrumbsPrefix,
88
- message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
89
- },
90
- ],
106
+ ok: true,
107
+ value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
91
108
  };
92
109
  }
93
- const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
94
- if (discriminantValue == null) {
110
+ else {
95
111
  return {
96
112
  ok: false,
97
113
  errors: [
98
114
  {
99
- path: breadcrumbsPrefix,
100
- message: `Missing discriminant ("${discriminant}")`,
115
+ path: [...breadcrumbsPrefix, discriminant],
116
+ message: "Unexpected discriminant value",
101
117
  },
102
118
  ],
103
119
  };
104
120
  }
105
- const transformedDiscriminantValue = yield transformDiscriminantValue(discriminantValue);
106
- if (!transformedDiscriminantValue.ok) {
107
- return {
108
- ok: false,
109
- errors: transformedDiscriminantValue.errors,
110
- };
111
- }
112
- const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
113
- if (additionalPropertiesSchema == null) {
114
- if (allowUnrecognizedUnionMembers) {
115
- return {
116
- ok: true,
117
- value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
118
- };
119
- }
120
- else {
121
- return {
122
- ok: false,
123
- errors: [
124
- {
125
- path: [...breadcrumbsPrefix, discriminant],
126
- message: "Unexpected discriminant value",
127
- },
128
- ],
129
- };
130
- }
131
- }
132
- const transformedAdditionalProperties = yield transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
133
- if (!transformedAdditionalProperties.ok) {
134
- return transformedAdditionalProperties;
135
- }
136
- return {
137
- ok: true,
138
- value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
139
- };
140
- });
121
+ }
122
+ const transformedAdditionalProperties = transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
123
+ if (!transformedAdditionalProperties.ok) {
124
+ return transformedAdditionalProperties;
125
+ }
126
+ return {
127
+ ok: true,
128
+ value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
129
+ };
141
130
  }
@@ -12,9 +12,13 @@ function getTypeAsString(value) {
12
12
  if (value === null) {
13
13
  return "null";
14
14
  }
15
+ if (value instanceof BigInt) {
16
+ return "BigInt";
17
+ }
15
18
  switch (typeof value) {
16
19
  case "string":
17
20
  return `"${value}"`;
21
+ case "bigint":
18
22
  case "number":
19
23
  case "boolean":
20
24
  case "undefined":
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.maybeSkipValidation = void 0;
13
4
  function maybeSkipValidation(schema) {
@@ -15,8 +6,8 @@ function maybeSkipValidation(schema) {
15
6
  }
16
7
  exports.maybeSkipValidation = maybeSkipValidation;
17
8
  function transformAndMaybeSkipValidation(transform) {
18
- return (value, opts) => __awaiter(this, void 0, void 0, function* () {
19
- const transformed = yield transform(value, opts);
9
+ return (value, opts) => {
10
+ const transformed = transform(value, opts);
20
11
  const { skipValidation = false } = opts !== null && opts !== void 0 ? opts : {};
21
12
  if (!transformed.ok && skipValidation) {
22
13
  // eslint-disable-next-line no-console
@@ -33,5 +24,5 @@ function transformAndMaybeSkipValidation(transform) {
33
24
  else {
34
25
  return transformed;
35
26
  }
36
- });
27
+ };
37
28
  }
@@ -0,0 +1,48 @@
1
+ /// <reference types="node" />
2
+ import { Readable } from "stream";
3
+ export declare namespace Stream {
4
+ interface Args {
5
+ /**
6
+ * The HTTP response stream to read from.
7
+ */
8
+ stream: Readable | ReadableStream;
9
+ /**
10
+ * The event shape to use for parsing the stream data.
11
+ */
12
+ eventShape: JsonEvent | SseEvent;
13
+ /**
14
+ * An abort signal to stop the stream.
15
+ */
16
+ signal?: AbortSignal;
17
+ }
18
+ interface JsonEvent {
19
+ type: "json";
20
+ messageTerminator: string;
21
+ }
22
+ interface SseEvent {
23
+ type: "sse";
24
+ streamTerminator?: string;
25
+ }
26
+ }
27
+ export declare class Stream<T> implements AsyncIterable<T> {
28
+ private stream;
29
+ private parse;
30
+ /**
31
+ * The prefix to use for each message. For example,
32
+ * for SSE, the prefix is "data: ".
33
+ */
34
+ private prefix;
35
+ private messageTerminator;
36
+ private streamTerminator;
37
+ private controller;
38
+ constructor({ stream, parse, eventShape, signal }: Stream.Args & {
39
+ parse: (val: unknown) => Promise<T>;
40
+ });
41
+ private iterMessages;
42
+ [Symbol.asyncIterator](): AsyncIterator<T, void, unknown>;
43
+ private decodeChunk;
44
+ }
45
+ /**
46
+ * Browser polyfill for ReadableStream
47
+ */
48
+ export declare function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
12
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
+ var m = o[Symbol.asyncIterator], i;
14
+ 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);
15
+ 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); }); }; }
16
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
+ };
18
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
19
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
22
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
23
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
24
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
25
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
26
+ function fulfill(value) { resume("next", value); }
27
+ function reject(value) { resume("throw", value); }
28
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.readableStreamAsyncIterable = exports.Stream = void 0;
32
+ const runtime_1 = require("../runtime");
33
+ const DATA_PREFIX = "data:";
34
+ class Stream {
35
+ constructor({ stream, parse, eventShape, signal }) {
36
+ this.controller = new AbortController();
37
+ this.stream = stream;
38
+ this.parse = parse;
39
+ if (eventShape.type === "sse") {
40
+ this.prefix = DATA_PREFIX;
41
+ this.messageTerminator = "\n";
42
+ this.streamTerminator = eventShape.streamTerminator;
43
+ }
44
+ else {
45
+ this.messageTerminator = eventShape.messageTerminator;
46
+ }
47
+ signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", () => this.controller.abort());
48
+ }
49
+ iterMessages() {
50
+ return __asyncGenerator(this, arguments, function* iterMessages_1() {
51
+ var e_1, _a;
52
+ this.controller.signal;
53
+ const stream = readableStreamAsyncIterable(this.stream);
54
+ let buf = "";
55
+ let prefixSeen = false;
56
+ try {
57
+ for (var stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), !stream_1_1.done;) {
58
+ const chunk = stream_1_1.value;
59
+ buf += this.decodeChunk(chunk);
60
+ let terminatorIndex;
61
+ // Parse the chunk into as many messages as possible
62
+ while ((terminatorIndex = buf.indexOf(this.messageTerminator)) >= 0) {
63
+ // Extract the line from the buffer
64
+ let line = buf.slice(0, terminatorIndex + 1);
65
+ buf = buf.slice(terminatorIndex + 1);
66
+ // Skip empty lines
67
+ if (line.length === 0) {
68
+ continue;
69
+ }
70
+ // Skip the chunk until the prefix is found
71
+ if (!prefixSeen && this.prefix != null) {
72
+ const prefixIndex = line.indexOf(this.prefix);
73
+ if (prefixIndex === -1) {
74
+ continue;
75
+ }
76
+ prefixSeen = true;
77
+ line = line.slice(prefixIndex + this.prefix.length);
78
+ }
79
+ // If the stream terminator is present, return
80
+ if (this.streamTerminator != null && line.includes(this.streamTerminator)) {
81
+ return yield __await(void 0);
82
+ }
83
+ // Otherwise, yield message from the prefix to the terminator
84
+ const message = yield __await(this.parse(JSON.parse(line)));
85
+ yield yield __await(message);
86
+ prefixSeen = false;
87
+ }
88
+ }
89
+ }
90
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
91
+ finally {
92
+ try {
93
+ if (stream_1_1 && !stream_1_1.done && (_a = stream_1.return)) yield __await(_a.call(stream_1));
94
+ }
95
+ finally { if (e_1) throw e_1.error; }
96
+ }
97
+ });
98
+ }
99
+ [Symbol.asyncIterator]() {
100
+ return __asyncGenerator(this, arguments, function* _a() {
101
+ var e_2, _b;
102
+ try {
103
+ for (var _c = __asyncValues(this.iterMessages()), _d; _d = yield __await(_c.next()), !_d.done;) {
104
+ const message = _d.value;
105
+ yield yield __await(message);
106
+ }
107
+ }
108
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
109
+ finally {
110
+ try {
111
+ if (_d && !_d.done && (_b = _c.return)) yield __await(_b.call(_c));
112
+ }
113
+ finally { if (e_2) throw e_2.error; }
114
+ }
115
+ });
116
+ }
117
+ decodeChunk(chunk) {
118
+ let decoded = "";
119
+ // If TextDecoder is present, use it
120
+ if (typeof TextDecoder !== "undefined") {
121
+ const decoder = new TextDecoder("utf8");
122
+ decoded += decoder.decode(chunk);
123
+ }
124
+ // Buffer is present in Node.js environment
125
+ else if (runtime_1.RUNTIME.type === "node" && typeof chunk != "undefined") {
126
+ decoded += Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
127
+ }
128
+ return decoded;
129
+ }
130
+ }
131
+ exports.Stream = Stream;
132
+ /**
133
+ * Browser polyfill for ReadableStream
134
+ */
135
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
136
+ function readableStreamAsyncIterable(stream) {
137
+ if (stream[Symbol.asyncIterator]) {
138
+ return stream;
139
+ }
140
+ const reader = stream.getReader();
141
+ return {
142
+ next() {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ try {
145
+ const result = yield reader.read();
146
+ if (result === null || result === void 0 ? void 0 : result.done) {
147
+ reader.releaseLock();
148
+ } // release lock when stream becomes closed
149
+ return result;
150
+ }
151
+ catch (e) {
152
+ reader.releaseLock(); // release lock when stream becomes errored
153
+ throw e;
154
+ }
155
+ });
156
+ },
157
+ return() {
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ const cancelPromise = reader.cancel();
160
+ reader.releaseLock();
161
+ yield cancelPromise;
162
+ return { done: true, value: undefined };
163
+ });
164
+ },
165
+ [Symbol.asyncIterator]() {
166
+ return this;
167
+ },
168
+ };
169
+ }
170
+ exports.readableStreamAsyncIterable = readableStreamAsyncIterable;
@@ -0,0 +1 @@
1
+ export { Stream } from "./Stream";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Stream = void 0;
4
+ var Stream_1 = require("./Stream");
5
+ Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return Stream_1.Stream; } });
package/dist/Client.d.ts CHANGED
@@ -16,8 +16,11 @@ export declare namespace CredalClient {
16
16
  fetcher?: core.FetchFunction;
17
17
  }
18
18
  interface RequestOptions {
19
+ /** The maximum time to wait for a response in seconds. */
19
20
  timeoutInSeconds?: number;
21
+ /** The number of times to retry the request. Defaults to 2. */
20
22
  maxRetries?: number;
23
+ /** A hook to abort the request. */
21
24
  abortSignal?: AbortSignal;
22
25
  }
23
26
  }
@@ -4,3 +4,4 @@ export * from "./Url";
4
4
  export * from "./ResourceType";
5
5
  export * from "./Collaborator";
6
6
  export * from "./Role";
7
+ export * from "./Operator";
@@ -20,3 +20,4 @@ __exportStar(require("./Url"), exports);
20
20
  __exportStar(require("./ResourceType"), exports);
21
21
  __exportStar(require("./Collaborator"), exports);
22
22
  __exportStar(require("./Role"), exports);
23
+ __exportStar(require("./Operator"), exports);
@@ -11,8 +11,11 @@ export declare namespace Copilots {
11
11
  fetcher?: core.FetchFunction;
12
12
  }
13
13
  interface RequestOptions {
14
+ /** The maximum time to wait for a response in seconds. */
14
15
  timeoutInSeconds?: number;
16
+ /** The number of times to retry the request. Defaults to 2. */
15
17
  maxRetries?: number;
18
+ /** A hook to abort the request. */
16
19
  abortSignal?: AbortSignal;
17
20
  }
18
21
  }
@@ -26,12 +29,12 @@ export declare class Copilots {
26
29
  * @param {Copilots.RequestOptions} requestOptions - Request-specific configuration.
27
30
  *
28
31
  * @example
29
- * await credal.copilots.createCopilot({
32
+ * await client.copilots.createCopilot({
30
33
  * name: "Customer Copilot",
31
34
  * description: "This copilot is used to answer customer requests based on internal documentation.",
32
35
  * collaborators: [{
33
36
  * email: "test@gmail.com",
34
- * role: Credal.Role.Editor
37
+ * role: "editor"
35
38
  * }]
36
39
  * })
37
40
  */
@@ -43,7 +46,7 @@ export declare class Copilots {
43
46
  * @param {Copilots.RequestOptions} requestOptions - Request-specific configuration.
44
47
  *
45
48
  * @example
46
- * await credal.copilots.createConversation({
49
+ * await client.copilots.createConversation({
47
50
  * agentId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
48
51
  * userEmail: "ravin@credal.ai"
49
52
  * })
@@ -54,12 +57,12 @@ export declare class Copilots {
54
57
  * @param {Copilots.RequestOptions} requestOptions - Request-specific configuration.
55
58
  *
56
59
  * @example
57
- * await credal.copilots.provideMessageFeedback({
60
+ * await client.copilots.provideMessageFeedback({
58
61
  * userEmail: "ravin@credal.ai",
59
62
  * messageId: "dd721cd8-4bf2-4b94-9869-258df3dab9dc",
60
63
  * agentId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
61
64
  * messageFeedback: {
62
- * feedback: Credal.FeedbackEnum.Negative,
65
+ * feedback: "NEGATIVE",
63
66
  * suggestedAnswer: "Yes, Credal is SOC 2 compliant."
64
67
  * }
65
68
  * })
@@ -70,13 +73,24 @@ export declare class Copilots {
70
73
  * @param {Copilots.RequestOptions} requestOptions - Request-specific configuration.
71
74
  *
72
75
  * @example
73
- * await credal.copilots.sendMessage({
76
+ * await client.copilots.sendMessage({
74
77
  * agentId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
75
78
  * message: "Is Credal SOC 2 compliant?",
76
- * userEmail: "ravin@credal.ai"
79
+ * userEmail: "ravin@credal.ai",
80
+ * inputVariables: [{
81
+ * name: "input1",
82
+ * urls: ["https://drive.google.com/file/d/123456/view"]
83
+ * }, {
84
+ * name: "input2",
85
+ * urls: ["https://drive.google.com/file/d/123457/view", "https://drive.google.com/file/d/123458/view"]
86
+ * }]
77
87
  * })
78
88
  */
79
89
  sendMessage(request: Credal.SendMessageRequest, requestOptions?: Copilots.RequestOptions): Promise<Credal.SendAgentMessageResponse>;
90
+ /**
91
+ * This endpoint allows you to send a message to a specific copilot and get the response back as a streamed set of Server-Sent Events.
92
+ */
93
+ streamMessage(request: Credal.StreamMessageRequest, requestOptions?: Copilots.RequestOptions): Promise<core.Stream<Credal.StreamingChunk>>;
80
94
  /**
81
95
  * Link a collection with a copilot. The API Key used must be added to both the collection and the copilot beforehand.
82
96
  *
@@ -84,7 +98,7 @@ export declare class Copilots {
84
98
  * @param {Copilots.RequestOptions} requestOptions - Request-specific configuration.
85
99
  *
86
100
  * @example
87
- * await credal.copilots.addCollectionToCopilot({
101
+ * await client.copilots.addCollectionToCopilot({
88
102
  * copilotId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
89
103
  * collectionId: "def1055f-83c5-43d6-b558-f7a38e7b299e"
90
104
  * })
@@ -97,7 +111,7 @@ export declare class Copilots {
97
111
  * @param {Copilots.RequestOptions} requestOptions - Request-specific configuration.
98
112
  *
99
113
  * @example
100
- * await credal.copilots.removeCollectionFromCopilot({
114
+ * await client.copilots.removeCollectionFromCopilot({
101
115
  * copilotId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
102
116
  * collectionId: "def1055f-83c5-43d6-b558-f7a38e7b299e"
103
117
  * })
@@ -110,7 +124,7 @@ export declare class Copilots {
110
124
  * @param {Copilots.RequestOptions} requestOptions - Request-specific configuration.
111
125
  *
112
126
  * @example
113
- * await credal.copilots.updateConfiguration({
127
+ * await client.copilots.updateConfiguration({
114
128
  * copilotId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
115
129
  * configuration: {
116
130
  * name: "Customer Copilot",
@@ -129,7 +143,7 @@ export declare class Copilots {
129
143
  * @param {Copilots.RequestOptions} requestOptions - Request-specific configuration.
130
144
  *
131
145
  * @example
132
- * await credal.copilots.deleteCopilot({
146
+ * await client.copilots.deleteCopilot({
133
147
  * id: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a"
134
148
  * })
135
149
  */