@credal/sdk 0.0.24 → 0.0.25

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 (445) hide show
  1. package/Client.d.ts +10 -6
  2. package/api/resources/common/types/Operator.d.ts +1 -1
  3. package/api/resources/common/types/ResourceIdentifier.d.ts +1 -1
  4. package/api/resources/common/types/ResourceType.d.ts +1 -1
  5. package/api/resources/common/types/Role.d.ts +1 -1
  6. package/api/resources/copilots/client/Client.d.ts +4 -0
  7. package/api/resources/copilots/client/Client.js +55 -117
  8. package/api/resources/copilots/client/requests/AddCollectionToCopilotRequest.d.ts +2 -8
  9. package/api/resources/copilots/client/requests/CreateConversationRequest.d.ts +2 -8
  10. package/api/resources/copilots/client/requests/CreateCopilotRequest.d.ts +3 -12
  11. package/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.d.ts +4 -16
  12. package/api/resources/copilots/client/requests/RemoveCollectionFromCopilotRequest.d.ts +2 -8
  13. package/api/resources/copilots/client/requests/SendMessageRequest.d.ts +5 -20
  14. package/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +19 -20
  15. package/api/resources/copilots/client/requests/UpdateConfigurationRequest.d.ts +1 -4
  16. package/api/resources/copilots/types/ErrorChunk.d.ts +7 -0
  17. package/api/resources/copilots/types/ErrorChunk.js +5 -0
  18. package/api/resources/copilots/types/ErrorChunkData.d.ts +6 -0
  19. package/api/resources/copilots/types/ErrorChunkData.js +5 -0
  20. package/api/resources/copilots/types/FeedbackEnum.d.ts +1 -1
  21. package/api/resources/copilots/types/Filter.d.ts +1 -1
  22. package/api/resources/copilots/types/SendMessageResponse.d.ts +3 -5
  23. package/api/resources/copilots/types/StreamingChunk.d.ts +4 -1
  24. package/api/resources/copilots/types/index.d.ts +2 -0
  25. package/api/resources/copilots/types/index.js +2 -0
  26. package/api/resources/documentCatalog/client/Client.d.ts +4 -0
  27. package/api/resources/documentCatalog/client/Client.js +31 -45
  28. package/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.ts +10 -40
  29. package/api/resources/documentCollections/client/Client.d.ts +4 -0
  30. package/api/resources/documentCollections/client/Client.js +43 -81
  31. package/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.d.ts +1 -4
  32. package/api/resources/documentCollections/client/requests/CreateCollectionRequest.d.ts +3 -12
  33. package/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.d.ts +1 -4
  34. package/api/resources/index.js +17 -7
  35. package/api/resources/permissionsService/client/Client.d.ts +4 -0
  36. package/api/resources/permissionsService/client/Client.js +31 -45
  37. package/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +3 -12
  38. package/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +3 -12
  39. package/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.ts +4 -16
  40. package/api/resources/permissionsService/types/Action.d.ts +1 -1
  41. package/api/resources/permissionsService/types/AuthorizedResourceListPage.d.ts +1 -1
  42. package/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.ts +1 -1
  43. package/api/resources/permissionsService/types/Principal.d.ts +1 -1
  44. package/api/resources/search/client/Client.d.ts +4 -0
  45. package/api/resources/search/client/Client.js +23 -21
  46. package/api/resources/search/client/requests/SearchDocumentCollectionRequest.d.ts +3 -12
  47. package/api/resources/users/client/Client.d.ts +4 -0
  48. package/api/resources/users/client/Client.js +23 -21
  49. package/core/auth/BearerToken.d.ts +1 -1
  50. package/core/fetcher/APIResponse.d.ts +1 -1
  51. package/core/fetcher/Fetcher.d.ts +2 -2
  52. package/core/fetcher/Fetcher.js +6 -5
  53. package/core/fetcher/Supplier.d.ts +1 -1
  54. package/core/fetcher/createRequestUrl.d.ts +1 -1
  55. package/core/fetcher/createRequestUrl.js +1 -2
  56. package/core/fetcher/getFetchFn.js +18 -9
  57. package/core/fetcher/getHeader.js +1 -2
  58. package/core/fetcher/getRequestBody.js +5 -5
  59. package/core/fetcher/getResponseBody.js +1 -2
  60. package/core/fetcher/makeRequest.d.ts +1 -1
  61. package/core/fetcher/requestWithRetries.js +4 -5
  62. package/core/fetcher/signals.d.ts +0 -1
  63. package/core/fetcher/signals.js +2 -3
  64. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
  65. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
  66. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  67. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
  68. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
  69. package/core/index.js +17 -7
  70. package/core/json.d.ts +15 -0
  71. package/core/json.js +24 -0
  72. package/core/runtime/runtime.d.ts +1 -1
  73. package/core/runtime/runtime.js +51 -41
  74. package/core/schemas/Schema.d.ts +7 -5
  75. package/core/schemas/Schema.js +2 -0
  76. package/core/schemas/builders/bigint/bigint.d.ts +1 -1
  77. package/core/schemas/builders/bigint/bigint.js +22 -19
  78. package/core/schemas/builders/date/date.js +1 -2
  79. package/core/schemas/builders/enum/enum.js +1 -2
  80. package/core/schemas/builders/lazy/lazy.d.ts +1 -1
  81. package/core/schemas/builders/lazy/lazy.js +3 -4
  82. package/core/schemas/builders/lazy/lazyObject.js +1 -2
  83. package/core/schemas/builders/list/list.js +1 -2
  84. package/core/schemas/builders/literals/booleanLiteral.js +1 -2
  85. package/core/schemas/builders/literals/stringLiteral.js +1 -2
  86. package/core/schemas/builders/object/object.d.ts +1 -1
  87. package/core/schemas/builders/object/object.js +31 -3
  88. package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
  89. package/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
  90. package/core/schemas/builders/object/property.js +2 -3
  91. package/core/schemas/builders/object/types.d.ts +16 -11
  92. package/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
  93. package/core/schemas/builders/object-like/types.d.ts +1 -1
  94. package/core/schemas/builders/record/record.js +2 -4
  95. package/core/schemas/builders/record/types.d.ts +2 -2
  96. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
  97. package/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
  98. package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
  99. package/core/schemas/builders/set/set.js +1 -2
  100. package/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
  101. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
  102. package/core/schemas/builders/union/discriminant.js +1 -2
  103. package/core/schemas/builders/union/types.d.ts +6 -6
  104. package/core/schemas/builders/union/union.d.ts +1 -1
  105. package/core/schemas/builders/union/union.js +1 -2
  106. package/core/schemas/utils/MaybePromise.d.ts +1 -1
  107. package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
  108. package/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
  109. package/core/schemas/utils/entries.d.ts +1 -1
  110. package/core/schemas/utils/entries.js +1 -2
  111. package/core/schemas/utils/filterObject.d.ts +1 -1
  112. package/core/schemas/utils/filterObject.js +1 -2
  113. package/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
  114. package/core/schemas/utils/isPlainObject.js +1 -2
  115. package/core/schemas/utils/keys.d.ts +1 -1
  116. package/core/schemas/utils/keys.js +1 -2
  117. package/core/schemas/utils/maybeSkipValidation.js +1 -2
  118. package/core/schemas/utils/partition.js +1 -2
  119. package/core/streaming-fetcher/Stream.d.ts +0 -1
  120. package/core/streaming-fetcher/Stream.js +20 -21
  121. package/dist/Client.d.ts +10 -6
  122. package/dist/api/resources/common/types/Operator.d.ts +1 -1
  123. package/dist/api/resources/common/types/ResourceIdentifier.d.ts +1 -1
  124. package/dist/api/resources/common/types/ResourceType.d.ts +1 -1
  125. package/dist/api/resources/common/types/Role.d.ts +1 -1
  126. package/dist/api/resources/copilots/client/Client.d.ts +4 -0
  127. package/dist/api/resources/copilots/client/Client.js +55 -117
  128. package/dist/api/resources/copilots/client/requests/AddCollectionToCopilotRequest.d.ts +2 -8
  129. package/dist/api/resources/copilots/client/requests/CreateConversationRequest.d.ts +2 -8
  130. package/dist/api/resources/copilots/client/requests/CreateCopilotRequest.d.ts +3 -12
  131. package/dist/api/resources/copilots/client/requests/ProvideMessageFeedbackRequest.d.ts +4 -16
  132. package/dist/api/resources/copilots/client/requests/RemoveCollectionFromCopilotRequest.d.ts +2 -8
  133. package/dist/api/resources/copilots/client/requests/SendMessageRequest.d.ts +5 -20
  134. package/dist/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +19 -20
  135. package/dist/api/resources/copilots/client/requests/UpdateConfigurationRequest.d.ts +1 -4
  136. package/dist/api/resources/copilots/types/ErrorChunk.d.ts +7 -0
  137. package/dist/api/resources/copilots/types/ErrorChunk.js +5 -0
  138. package/dist/api/resources/copilots/types/ErrorChunkData.d.ts +6 -0
  139. package/dist/api/resources/copilots/types/ErrorChunkData.js +5 -0
  140. package/dist/api/resources/copilots/types/FeedbackEnum.d.ts +1 -1
  141. package/dist/api/resources/copilots/types/Filter.d.ts +1 -1
  142. package/dist/api/resources/copilots/types/SendMessageResponse.d.ts +3 -5
  143. package/dist/api/resources/copilots/types/StreamingChunk.d.ts +4 -1
  144. package/dist/api/resources/copilots/types/index.d.ts +2 -0
  145. package/dist/api/resources/copilots/types/index.js +2 -0
  146. package/dist/api/resources/documentCatalog/client/Client.d.ts +4 -0
  147. package/dist/api/resources/documentCatalog/client/Client.js +31 -45
  148. package/dist/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.ts +10 -40
  149. package/dist/api/resources/documentCollections/client/Client.d.ts +4 -0
  150. package/dist/api/resources/documentCollections/client/Client.js +43 -81
  151. package/dist/api/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.d.ts +1 -4
  152. package/dist/api/resources/documentCollections/client/requests/CreateCollectionRequest.d.ts +3 -12
  153. package/dist/api/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.d.ts +1 -4
  154. package/dist/api/resources/index.js +17 -7
  155. package/dist/api/resources/permissionsService/client/Client.d.ts +4 -0
  156. package/dist/api/resources/permissionsService/client/Client.js +31 -45
  157. package/dist/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +3 -12
  158. package/dist/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +3 -12
  159. package/dist/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.ts +4 -16
  160. package/dist/api/resources/permissionsService/types/Action.d.ts +1 -1
  161. package/dist/api/resources/permissionsService/types/AuthorizedResourceListPage.d.ts +1 -1
  162. package/dist/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.ts +1 -1
  163. package/dist/api/resources/permissionsService/types/Principal.d.ts +1 -1
  164. package/dist/api/resources/search/client/Client.d.ts +4 -0
  165. package/dist/api/resources/search/client/Client.js +23 -21
  166. package/dist/api/resources/search/client/requests/SearchDocumentCollectionRequest.d.ts +3 -12
  167. package/dist/api/resources/users/client/Client.d.ts +4 -0
  168. package/dist/api/resources/users/client/Client.js +23 -21
  169. package/dist/core/auth/BearerToken.d.ts +1 -1
  170. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  171. package/dist/core/fetcher/Fetcher.d.ts +2 -2
  172. package/dist/core/fetcher/Fetcher.js +6 -5
  173. package/dist/core/fetcher/Supplier.d.ts +1 -1
  174. package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
  175. package/dist/core/fetcher/createRequestUrl.js +1 -2
  176. package/dist/core/fetcher/getFetchFn.js +18 -9
  177. package/dist/core/fetcher/getHeader.js +1 -2
  178. package/dist/core/fetcher/getRequestBody.js +5 -5
  179. package/dist/core/fetcher/getResponseBody.js +1 -2
  180. package/dist/core/fetcher/makeRequest.d.ts +1 -1
  181. package/dist/core/fetcher/requestWithRetries.js +4 -5
  182. package/dist/core/fetcher/signals.d.ts +0 -1
  183. package/dist/core/fetcher/signals.js +2 -3
  184. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
  185. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
  186. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  187. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
  188. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
  189. package/dist/core/index.js +17 -7
  190. package/dist/core/json.d.ts +15 -0
  191. package/dist/core/json.js +24 -0
  192. package/dist/core/runtime/runtime.d.ts +1 -1
  193. package/dist/core/runtime/runtime.js +51 -41
  194. package/dist/core/schemas/Schema.d.ts +7 -5
  195. package/dist/core/schemas/Schema.js +2 -0
  196. package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
  197. package/dist/core/schemas/builders/bigint/bigint.js +22 -19
  198. package/dist/core/schemas/builders/date/date.js +1 -2
  199. package/dist/core/schemas/builders/enum/enum.js +1 -2
  200. package/dist/core/schemas/builders/lazy/lazy.d.ts +1 -1
  201. package/dist/core/schemas/builders/lazy/lazy.js +3 -4
  202. package/dist/core/schemas/builders/lazy/lazyObject.js +1 -2
  203. package/dist/core/schemas/builders/list/list.js +1 -2
  204. package/dist/core/schemas/builders/literals/booleanLiteral.js +1 -2
  205. package/dist/core/schemas/builders/literals/stringLiteral.js +1 -2
  206. package/dist/core/schemas/builders/object/object.d.ts +1 -1
  207. package/dist/core/schemas/builders/object/object.js +31 -3
  208. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
  209. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
  210. package/dist/core/schemas/builders/object/property.js +2 -3
  211. package/dist/core/schemas/builders/object/types.d.ts +16 -11
  212. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
  213. package/dist/core/schemas/builders/object-like/types.d.ts +1 -1
  214. package/dist/core/schemas/builders/record/record.js +2 -4
  215. package/dist/core/schemas/builders/record/types.d.ts +2 -2
  216. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
  217. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
  218. package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
  219. package/dist/core/schemas/builders/set/set.js +1 -2
  220. package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
  221. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
  222. package/dist/core/schemas/builders/union/discriminant.js +1 -2
  223. package/dist/core/schemas/builders/union/types.d.ts +6 -6
  224. package/dist/core/schemas/builders/union/union.d.ts +1 -1
  225. package/dist/core/schemas/builders/union/union.js +1 -2
  226. package/dist/core/schemas/utils/MaybePromise.d.ts +1 -1
  227. package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
  228. package/dist/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
  229. package/dist/core/schemas/utils/entries.d.ts +1 -1
  230. package/dist/core/schemas/utils/entries.js +1 -2
  231. package/dist/core/schemas/utils/filterObject.d.ts +1 -1
  232. package/dist/core/schemas/utils/filterObject.js +1 -2
  233. package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
  234. package/dist/core/schemas/utils/isPlainObject.js +1 -2
  235. package/dist/core/schemas/utils/keys.d.ts +1 -1
  236. package/dist/core/schemas/utils/keys.js +1 -2
  237. package/dist/core/schemas/utils/maybeSkipValidation.js +1 -2
  238. package/dist/core/schemas/utils/partition.js +1 -2
  239. package/dist/core/streaming-fetcher/Stream.d.ts +0 -1
  240. package/dist/core/streaming-fetcher/Stream.js +20 -21
  241. package/dist/environments.d.ts +1 -1
  242. package/dist/errors/CredalError.js +2 -1
  243. package/dist/errors/CredalTimeoutError.d.ts +1 -1
  244. package/dist/errors/CredalTimeoutError.js +2 -2
  245. package/dist/index.d.ts +1 -0
  246. package/dist/index.js +19 -8
  247. package/dist/serialization/resources/common/types/Collaborator.js +17 -7
  248. package/dist/serialization/resources/common/types/ExternalResourceId.js +17 -7
  249. package/dist/serialization/resources/common/types/Operator.js +17 -7
  250. package/dist/serialization/resources/common/types/ResourceIdentifier.js +17 -7
  251. package/dist/serialization/resources/common/types/ResourceType.js +17 -7
  252. package/dist/serialization/resources/common/types/Role.js +17 -7
  253. package/dist/serialization/resources/common/types/Url.js +17 -7
  254. package/dist/serialization/resources/copilots/client/requests/AddCollectionToCopilotRequest.js +17 -7
  255. package/dist/serialization/resources/copilots/client/requests/CreateConversationRequest.js +17 -7
  256. package/dist/serialization/resources/copilots/client/requests/CreateCopilotRequest.js +17 -7
  257. package/dist/serialization/resources/copilots/client/requests/DeleteCopilotRequest.js +17 -7
  258. package/dist/serialization/resources/copilots/client/requests/ProvideMessageFeedbackRequest.js +17 -7
  259. package/dist/serialization/resources/copilots/client/requests/RemoveCollectionFromCopilotRequest.js +17 -7
  260. package/dist/serialization/resources/copilots/client/requests/SendMessageRequest.js +17 -7
  261. package/dist/serialization/resources/copilots/client/requests/StreamMessageRequest.js +17 -7
  262. package/dist/serialization/resources/copilots/client/requests/UpdateConfigurationRequest.js +17 -7
  263. package/dist/serialization/resources/copilots/types/AiEndpointConfiguration.js +17 -7
  264. package/dist/serialization/resources/copilots/types/BlockedChunk.js +17 -7
  265. package/dist/serialization/resources/copilots/types/BooleanFieldSchema.js +17 -7
  266. package/dist/serialization/resources/copilots/types/CollectionFilteredData.js +17 -7
  267. package/dist/serialization/resources/copilots/types/Configuration.js +17 -7
  268. package/dist/serialization/resources/copilots/types/CreateConversationResponse.js +17 -7
  269. package/dist/serialization/resources/copilots/types/CreateCopilotResponse.js +17 -7
  270. package/dist/serialization/resources/copilots/types/DataChunk.js +17 -7
  271. package/dist/serialization/resources/copilots/types/DataFilter.js +17 -7
  272. package/dist/serialization/resources/copilots/types/DatetimeFieldSchema.js +17 -7
  273. package/dist/serialization/resources/copilots/types/DeleteCopilotResponse.js +17 -7
  274. package/dist/serialization/resources/copilots/types/EndOfMessageChunk.js +17 -7
  275. package/dist/serialization/resources/copilots/types/ErrorChunk.d.ts +13 -0
  276. package/dist/serialization/resources/copilots/types/ErrorChunk.js +44 -0
  277. package/dist/serialization/resources/copilots/types/ErrorChunkData.d.ts +12 -0
  278. package/dist/serialization/resources/copilots/types/ErrorChunkData.js +43 -0
  279. package/dist/serialization/resources/copilots/types/FeedbackEnum.js +17 -7
  280. package/dist/serialization/resources/copilots/types/Filter.js +17 -7
  281. package/dist/serialization/resources/copilots/types/FinalChunk.js +17 -7
  282. package/dist/serialization/resources/copilots/types/InitialChunk.js +17 -7
  283. package/dist/serialization/resources/copilots/types/InputVariable.js +17 -7
  284. package/dist/serialization/resources/copilots/types/InsertedAuditLog.js +17 -7
  285. package/dist/serialization/resources/copilots/types/MessageBlocked.js +17 -7
  286. package/dist/serialization/resources/copilots/types/MessageFeedback.js +17 -7
  287. package/dist/serialization/resources/copilots/types/MessageReply.js +17 -7
  288. package/dist/serialization/resources/copilots/types/NumberFieldSchema.js +17 -7
  289. package/dist/serialization/resources/copilots/types/PolicyTrigger.js +17 -7
  290. package/dist/serialization/resources/copilots/types/ReferencedSource.js +17 -7
  291. package/dist/serialization/resources/copilots/types/ResponseChunk.js +17 -7
  292. package/dist/serialization/resources/copilots/types/SendAgentMessageResponse.js +17 -7
  293. package/dist/serialization/resources/copilots/types/SendMessageResponse.js +17 -7
  294. package/dist/serialization/resources/copilots/types/StreamingChunk.d.ts +5 -1
  295. package/dist/serialization/resources/copilots/types/StreamingChunk.js +19 -7
  296. package/dist/serialization/resources/copilots/types/StringFieldSchema.js +17 -7
  297. package/dist/serialization/resources/copilots/types/WebSearchResult.js +17 -7
  298. package/dist/serialization/resources/copilots/types/index.d.ts +2 -0
  299. package/dist/serialization/resources/copilots/types/index.js +2 -0
  300. package/dist/serialization/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.js +17 -7
  301. package/dist/serialization/resources/documentCatalog/types/DocumentMetadataPatch.js +17 -7
  302. package/dist/serialization/resources/documentCatalog/types/DocumentMetadataPatchRequest.js +17 -7
  303. package/dist/serialization/resources/documentCatalog/types/SyncSourceByUrlRequest.js +17 -7
  304. package/dist/serialization/resources/documentCatalog/types/SyncSourceByUrlResponse.js +17 -7
  305. package/dist/serialization/resources/documentCatalog/types/UploadDocumentResponse.js +17 -7
  306. package/dist/serialization/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.js +17 -7
  307. package/dist/serialization/resources/documentCollections/client/requests/CreateCollectionRequest.js +17 -7
  308. package/dist/serialization/resources/documentCollections/client/requests/CreateMongoCollectionSyncRequest.js +17 -7
  309. package/dist/serialization/resources/documentCollections/client/requests/DeleteCollectionRequest.js +17 -7
  310. package/dist/serialization/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.js +17 -7
  311. package/dist/serialization/resources/documentCollections/client/requests/UpdateMongoCollectionSyncRequest.js +17 -7
  312. package/dist/serialization/resources/documentCollections/types/CreateCollectionResponse.js +17 -7
  313. package/dist/serialization/resources/documentCollections/types/DeleteCollectionResponse.js +17 -7
  314. package/dist/serialization/resources/documentCollections/types/MongoCollectionSyncConfig.js +17 -7
  315. package/dist/serialization/resources/documentCollections/types/MongoCollectionSyncResponse.js +17 -7
  316. package/dist/serialization/resources/documentCollections/types/MongoSourceFieldsConfig.js +17 -7
  317. package/dist/serialization/resources/index.js +17 -7
  318. package/dist/serialization/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.js +17 -7
  319. package/dist/serialization/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.js +17 -7
  320. package/dist/serialization/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.js +17 -7
  321. package/dist/serialization/resources/permissionsService/types/Action.js +17 -7
  322. package/dist/serialization/resources/permissionsService/types/AuthorizedResource.js +17 -7
  323. package/dist/serialization/resources/permissionsService/types/AuthorizedResourceListPage.js +17 -7
  324. package/dist/serialization/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.js +17 -7
  325. package/dist/serialization/resources/permissionsService/types/CheckResourceAuthorizationResponse.js +17 -7
  326. package/dist/serialization/resources/permissionsService/types/Group.js +17 -7
  327. package/dist/serialization/resources/permissionsService/types/Principal.js +17 -7
  328. package/dist/serialization/resources/permissionsService/types/PrincipalListPage.js +17 -7
  329. package/dist/serialization/resources/permissionsService/types/ResourceAuthorizationResult.js +17 -7
  330. package/dist/serialization/resources/permissionsService/types/User.js +17 -7
  331. package/dist/serialization/resources/search/client/requests/SearchDocumentCollectionRequest.js +17 -7
  332. package/dist/serialization/resources/search/types/DocumentCollectionSearchOptions.js +17 -7
  333. package/dist/serialization/resources/search/types/DocumentCollectionSearchResult.js +17 -7
  334. package/dist/serialization/resources/search/types/SearchDocumentCollectionResponse.js +17 -7
  335. package/dist/serialization/resources/search/types/SearchResultChunk.js +17 -7
  336. package/dist/serialization/resources/search/types/SingleFieldFilter.js +17 -7
  337. package/dist/serialization/resources/users/client/index.js +17 -7
  338. package/dist/serialization/resources/users/client/metadata.js +17 -7
  339. package/dist/serialization/resources/users/types/UserMetadataPatch.js +17 -7
  340. package/dist/version.d.ts +1 -1
  341. package/dist/version.js +1 -1
  342. package/environments.d.ts +1 -1
  343. package/errors/CredalError.js +2 -1
  344. package/errors/CredalTimeoutError.d.ts +1 -1
  345. package/errors/CredalTimeoutError.js +2 -2
  346. package/index.d.ts +1 -0
  347. package/index.js +19 -8
  348. package/{jest.config.js → jest.config.mjs} +4 -1
  349. package/package.json +16 -17
  350. package/scripts/rename-to-esm-files.js +115 -0
  351. package/serialization/resources/common/types/Collaborator.js +17 -7
  352. package/serialization/resources/common/types/ExternalResourceId.js +17 -7
  353. package/serialization/resources/common/types/Operator.js +17 -7
  354. package/serialization/resources/common/types/ResourceIdentifier.js +17 -7
  355. package/serialization/resources/common/types/ResourceType.js +17 -7
  356. package/serialization/resources/common/types/Role.js +17 -7
  357. package/serialization/resources/common/types/Url.js +17 -7
  358. package/serialization/resources/copilots/client/requests/AddCollectionToCopilotRequest.js +17 -7
  359. package/serialization/resources/copilots/client/requests/CreateConversationRequest.js +17 -7
  360. package/serialization/resources/copilots/client/requests/CreateCopilotRequest.js +17 -7
  361. package/serialization/resources/copilots/client/requests/DeleteCopilotRequest.js +17 -7
  362. package/serialization/resources/copilots/client/requests/ProvideMessageFeedbackRequest.js +17 -7
  363. package/serialization/resources/copilots/client/requests/RemoveCollectionFromCopilotRequest.js +17 -7
  364. package/serialization/resources/copilots/client/requests/SendMessageRequest.js +17 -7
  365. package/serialization/resources/copilots/client/requests/StreamMessageRequest.js +17 -7
  366. package/serialization/resources/copilots/client/requests/UpdateConfigurationRequest.js +17 -7
  367. package/serialization/resources/copilots/types/AiEndpointConfiguration.js +17 -7
  368. package/serialization/resources/copilots/types/BlockedChunk.js +17 -7
  369. package/serialization/resources/copilots/types/BooleanFieldSchema.js +17 -7
  370. package/serialization/resources/copilots/types/CollectionFilteredData.js +17 -7
  371. package/serialization/resources/copilots/types/Configuration.js +17 -7
  372. package/serialization/resources/copilots/types/CreateConversationResponse.js +17 -7
  373. package/serialization/resources/copilots/types/CreateCopilotResponse.js +17 -7
  374. package/serialization/resources/copilots/types/DataChunk.js +17 -7
  375. package/serialization/resources/copilots/types/DataFilter.js +17 -7
  376. package/serialization/resources/copilots/types/DatetimeFieldSchema.js +17 -7
  377. package/serialization/resources/copilots/types/DeleteCopilotResponse.js +17 -7
  378. package/serialization/resources/copilots/types/EndOfMessageChunk.js +17 -7
  379. package/serialization/resources/copilots/types/ErrorChunk.d.ts +13 -0
  380. package/serialization/resources/copilots/types/ErrorChunk.js +44 -0
  381. package/serialization/resources/copilots/types/ErrorChunkData.d.ts +12 -0
  382. package/serialization/resources/copilots/types/ErrorChunkData.js +43 -0
  383. package/serialization/resources/copilots/types/FeedbackEnum.js +17 -7
  384. package/serialization/resources/copilots/types/Filter.js +17 -7
  385. package/serialization/resources/copilots/types/FinalChunk.js +17 -7
  386. package/serialization/resources/copilots/types/InitialChunk.js +17 -7
  387. package/serialization/resources/copilots/types/InputVariable.js +17 -7
  388. package/serialization/resources/copilots/types/InsertedAuditLog.js +17 -7
  389. package/serialization/resources/copilots/types/MessageBlocked.js +17 -7
  390. package/serialization/resources/copilots/types/MessageFeedback.js +17 -7
  391. package/serialization/resources/copilots/types/MessageReply.js +17 -7
  392. package/serialization/resources/copilots/types/NumberFieldSchema.js +17 -7
  393. package/serialization/resources/copilots/types/PolicyTrigger.js +17 -7
  394. package/serialization/resources/copilots/types/ReferencedSource.js +17 -7
  395. package/serialization/resources/copilots/types/ResponseChunk.js +17 -7
  396. package/serialization/resources/copilots/types/SendAgentMessageResponse.js +17 -7
  397. package/serialization/resources/copilots/types/SendMessageResponse.js +17 -7
  398. package/serialization/resources/copilots/types/StreamingChunk.d.ts +5 -1
  399. package/serialization/resources/copilots/types/StreamingChunk.js +19 -7
  400. package/serialization/resources/copilots/types/StringFieldSchema.js +17 -7
  401. package/serialization/resources/copilots/types/WebSearchResult.js +17 -7
  402. package/serialization/resources/copilots/types/index.d.ts +2 -0
  403. package/serialization/resources/copilots/types/index.js +2 -0
  404. package/serialization/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.js +17 -7
  405. package/serialization/resources/documentCatalog/types/DocumentMetadataPatch.js +17 -7
  406. package/serialization/resources/documentCatalog/types/DocumentMetadataPatchRequest.js +17 -7
  407. package/serialization/resources/documentCatalog/types/SyncSourceByUrlRequest.js +17 -7
  408. package/serialization/resources/documentCatalog/types/SyncSourceByUrlResponse.js +17 -7
  409. package/serialization/resources/documentCatalog/types/UploadDocumentResponse.js +17 -7
  410. package/serialization/resources/documentCollections/client/requests/AddDocumentsToCollectionRequest.js +17 -7
  411. package/serialization/resources/documentCollections/client/requests/CreateCollectionRequest.js +17 -7
  412. package/serialization/resources/documentCollections/client/requests/CreateMongoCollectionSyncRequest.js +17 -7
  413. package/serialization/resources/documentCollections/client/requests/DeleteCollectionRequest.js +17 -7
  414. package/serialization/resources/documentCollections/client/requests/RemoveDocumentsFromCollectionRequest.js +17 -7
  415. package/serialization/resources/documentCollections/client/requests/UpdateMongoCollectionSyncRequest.js +17 -7
  416. package/serialization/resources/documentCollections/types/CreateCollectionResponse.js +17 -7
  417. package/serialization/resources/documentCollections/types/DeleteCollectionResponse.js +17 -7
  418. package/serialization/resources/documentCollections/types/MongoCollectionSyncConfig.js +17 -7
  419. package/serialization/resources/documentCollections/types/MongoCollectionSyncResponse.js +17 -7
  420. package/serialization/resources/documentCollections/types/MongoSourceFieldsConfig.js +17 -7
  421. package/serialization/resources/index.js +17 -7
  422. package/serialization/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.js +17 -7
  423. package/serialization/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.js +17 -7
  424. package/serialization/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.js +17 -7
  425. package/serialization/resources/permissionsService/types/Action.js +17 -7
  426. package/serialization/resources/permissionsService/types/AuthorizedResource.js +17 -7
  427. package/serialization/resources/permissionsService/types/AuthorizedResourceListPage.js +17 -7
  428. package/serialization/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.js +17 -7
  429. package/serialization/resources/permissionsService/types/CheckResourceAuthorizationResponse.js +17 -7
  430. package/serialization/resources/permissionsService/types/Group.js +17 -7
  431. package/serialization/resources/permissionsService/types/Principal.js +17 -7
  432. package/serialization/resources/permissionsService/types/PrincipalListPage.js +17 -7
  433. package/serialization/resources/permissionsService/types/ResourceAuthorizationResult.js +17 -7
  434. package/serialization/resources/permissionsService/types/User.js +17 -7
  435. package/serialization/resources/search/client/requests/SearchDocumentCollectionRequest.js +17 -7
  436. package/serialization/resources/search/types/DocumentCollectionSearchOptions.js +17 -7
  437. package/serialization/resources/search/types/DocumentCollectionSearchResult.js +17 -7
  438. package/serialization/resources/search/types/SearchDocumentCollectionResponse.js +17 -7
  439. package/serialization/resources/search/types/SearchResultChunk.js +17 -7
  440. package/serialization/resources/search/types/SingleFieldFilter.js +17 -7
  441. package/serialization/resources/users/client/index.js +17 -7
  442. package/serialization/resources/users/client/metadata.js +17 -7
  443. package/serialization/resources/users/types/UserMetadataPatch.js +17 -7
  444. package/version.d.ts +1 -1
  445. package/version.js +1 -1
@@ -9,14 +9,8 @@
9
9
  * }
10
10
  */
11
11
  export interface CreateConversationRequest {
12
- /**
13
- * Credal-generated Copilot ID to specify which agent to route the request to.
14
- *
15
- */
12
+ /** Credal-generated Copilot ID to specify which agent to route the request to. */
16
13
  agentId: string;
17
- /**
18
- * End-user for the conversation.
19
- *
20
- */
14
+ /** End-user for the conversation. */
21
15
  userEmail: string;
22
16
  }
@@ -14,19 +14,10 @@ import * as Credal from "../../../../index";
14
14
  * }
15
15
  */
16
16
  export interface CreateCopilotRequest {
17
- /**
18
- * A descriptive name for the copilot.
19
- *
20
- */
17
+ /** A descriptive name for the copilot. */
21
18
  name: string;
22
- /**
23
- * An in depth name for the copilot's function. Useful for routing requests to the right copilot.
24
- *
25
- */
19
+ /** An in depth name for the copilot's function. Useful for routing requests to the right copilot. */
26
20
  description: string;
27
- /**
28
- * A list of collaborator emails and roles that will have access to the copilot.
29
- *
30
- */
21
+ /** A list of collaborator emails and roles that will have access to the copilot. */
31
22
  collaborators: Credal.Collaborator[];
32
23
  }
@@ -16,24 +16,12 @@ import * as Credal from "../../../../index";
16
16
  * }
17
17
  */
18
18
  export interface ProvideMessageFeedbackRequest {
19
- /**
20
- * Credal-generated Copilot ID to specify which agent to route the request to.
21
- *
22
- */
19
+ /** Credal-generated Copilot ID to specify which agent to route the request to. */
23
20
  agentId: string;
24
- /**
25
- * The user profile you want to use when providing feedback.
26
- *
27
- */
21
+ /** The user profile you want to use when providing feedback. */
28
22
  userEmail: string;
29
- /**
30
- * The message ID for which feedback is being provided.
31
- *
32
- */
23
+ /** The message ID for which feedback is being provided. */
33
24
  messageId: string;
34
- /**
35
- * The feedback provided by the user.
36
- *
37
- */
25
+ /** The feedback provided by the user. */
38
26
  messageFeedback: Credal.MessageFeedback;
39
27
  }
@@ -9,14 +9,8 @@
9
9
  * }
10
10
  */
11
11
  export interface RemoveCollectionFromCopilotRequest {
12
- /**
13
- * Credal-generated copilot ID to add the collection to.
14
- *
15
- */
12
+ /** Credal-generated copilot ID to add the collection to. */
16
13
  copilotId: string;
17
- /**
18
- * Credal-generated collection ID to add.
19
- *
20
- */
14
+ /** Credal-generated collection ID to add. */
21
15
  collectionId: string;
22
16
  }
@@ -18,29 +18,14 @@ import * as Credal from "../../../../index";
18
18
  * }
19
19
  */
20
20
  export interface SendMessageRequest {
21
- /**
22
- * Credal-generated Copilot ID to specify which agent to route the request to.
23
- *
24
- */
21
+ /** Credal-generated Copilot ID to specify which agent to route the request to. */
25
22
  agentId: string;
26
- /**
27
- * The message you want to send to your copilot.
28
- *
29
- */
23
+ /** The message you want to send to your copilot. */
30
24
  message: string;
31
- /**
32
- * The user profile you want to use when sending the message.
33
- *
34
- */
25
+ /** The user profile you want to use when sending the message. */
35
26
  userEmail: string;
36
- /**
37
- * Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations.
38
- *
39
- */
27
+ /** Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations. */
40
28
  conversationId?: string;
41
- /**
42
- * Optional input variables to be used in the message. Map the name of the variable to a list of urls.
43
- *
44
- */
29
+ /** Optional input variables to be used in the message. Map the name of the variable to a list of urls. */
45
30
  inputVariables?: Credal.InputVariable[];
46
31
  }
@@ -30,31 +30,30 @@ import * as Credal from "../../../../index";
30
30
  * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c25", "82e4b12a-6990-45d4-8ebd-85c00e030c24"]
31
31
  * }]
32
32
  * }
33
+ *
34
+ * @example
35
+ * {
36
+ * copilotId: "82e4b12a-6990-45d4-8ebd-85c00e030c25",
37
+ * message: "Is Credal SOC 2 compliant?",
38
+ * email: "ravin@credal.ai",
39
+ * inputVariables: [{
40
+ * name: "input1",
41
+ * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c24"]
42
+ * }, {
43
+ * name: "input2",
44
+ * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c25", "82e4b12a-6990-45d4-8ebd-85c00e030c26"]
45
+ * }]
46
+ * }
33
47
  */
34
48
  export interface StreamMessageRequest {
35
- /**
36
- * Credal-generated Copilot ID to specify which agent to route the request to.
37
- *
38
- */
49
+ /** Credal-generated Copilot ID to specify which agent to route the request to. */
39
50
  copilotId: string;
40
- /**
41
- * The message you want to send to your copilot.
42
- *
43
- */
51
+ /** The message you want to send to your copilot. */
44
52
  message: string;
45
- /**
46
- * The user profile you want to use when sending the message.
47
- *
48
- */
53
+ /** The user profile you want to use when sending the message. */
49
54
  email: string;
50
- /**
51
- * Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations.
52
- *
53
- */
55
+ /** Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations. */
54
56
  conversationId?: string;
55
- /**
56
- * Optional input variables to be used in the message. Map the name of the variable to a list of urls.
57
- *
58
- */
57
+ /** Optional input variables to be used in the message. Map the name of the variable to a list of urls. */
59
58
  inputVariables?: Credal.InputVariable[];
60
59
  }
@@ -18,10 +18,7 @@ import * as Credal from "../../../../index";
18
18
  * }
19
19
  */
20
20
  export interface UpdateConfigurationRequest {
21
- /**
22
- * Credal-generated copilot ID to add the collection to.
23
- *
24
- */
21
+ /** Credal-generated copilot ID to add the collection to. */
25
22
  copilotId: string;
26
23
  configuration: Credal.Configuration;
27
24
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Credal from "../../../index";
5
+ export interface ErrorChunk {
6
+ error: Credal.ErrorChunkData;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ErrorChunkData {
5
+ message: string;
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export declare type FeedbackEnum = "POSITIVE" | "NEGATIVE";
4
+ export type FeedbackEnum = "POSITIVE" | "NEGATIVE";
5
5
  export declare const FeedbackEnum: {
6
6
  readonly Positive: "POSITIVE";
7
7
  readonly Negative: "NEGATIVE";
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Credal from "../../../index";
5
- export declare type Filter = Credal.Filter.String | Credal.Filter.Number | Credal.Filter.Boolean | Credal.Filter.Datetime;
5
+ export type Filter = Credal.Filter.String | Credal.Filter.Number | Credal.Filter.Boolean | Credal.Filter.Datetime;
6
6
  export declare namespace Filter {
7
7
  interface String extends Credal.StringFieldSchema {
8
8
  fieldType: "string";
@@ -2,16 +2,14 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Credal from "../../../index";
5
- export declare type SendMessageResponse =
5
+ export type SendMessageResponse =
6
6
  /**
7
7
  * Returned when there is a reply
8
- * fetched from the copilot.
9
- * */
8
+ * fetched from the copilot. */
10
9
  Credal.SendMessageResponse.AiResponseResult
11
10
  /**
12
11
  * Returned when Credal detects possible
13
- * infosec violations and blocks the message.
14
- * */
12
+ * infosec violations and blocks the message. */
15
13
  | Credal.SendMessageResponse.BlockedResult;
16
14
  export declare namespace SendMessageResponse {
17
15
  interface AiResponseResult extends Credal.MessageReply {
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Credal from "../../../index";
5
- export declare type StreamingChunk = Credal.StreamingChunk.Initial | Credal.StreamingChunk.DataChunk | Credal.StreamingChunk.EndOfMessage | Credal.StreamingChunk.FinalChunk | Credal.StreamingChunk.Blocked;
5
+ export type StreamingChunk = Credal.StreamingChunk.Initial | Credal.StreamingChunk.DataChunk | Credal.StreamingChunk.EndOfMessage | Credal.StreamingChunk.FinalChunk | Credal.StreamingChunk.Blocked | Credal.StreamingChunk.ErrorChunk;
6
6
  export declare namespace StreamingChunk {
7
7
  interface Initial extends Credal.InitialChunk {
8
8
  event: "initial";
@@ -19,4 +19,7 @@ export declare namespace StreamingChunk {
19
19
  interface Blocked extends Credal.BlockedChunk {
20
20
  event: "blocked";
21
21
  }
22
+ interface ErrorChunk extends Credal.ErrorChunk {
23
+ event: "error_chunk";
24
+ }
22
25
  }
@@ -27,4 +27,6 @@ export * from "./DataChunk";
27
27
  export * from "./FinalChunk";
28
28
  export * from "./EndOfMessageChunk";
29
29
  export * from "./BlockedChunk";
30
+ export * from "./ErrorChunkData";
31
+ export * from "./ErrorChunk";
30
32
  export * from "./StreamingChunk";
@@ -43,4 +43,6 @@ __exportStar(require("./DataChunk"), exports);
43
43
  __exportStar(require("./FinalChunk"), exports);
44
44
  __exportStar(require("./EndOfMessageChunk"), exports);
45
45
  __exportStar(require("./BlockedChunk"), exports);
46
+ __exportStar(require("./ErrorChunkData"), exports);
47
+ __exportStar(require("./ErrorChunk"), exports);
46
48
  __exportStar(require("./StreamingChunk"), exports);
@@ -7,6 +7,8 @@ import * as Credal from "../../../index";
7
7
  export declare namespace DocumentCatalog {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.CredalEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<core.BearerToken | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }
@@ -17,6 +19,8 @@ export declare namespace DocumentCatalog {
17
19
  maxRetries?: number;
18
20
  /** A hook to abort the request. */
19
21
  abortSignal?: AbortSignal;
22
+ /** Additional headers to include in the request. */
23
+ headers?: Record<string, string>;
20
24
  }
21
25
  }
22
26
  export declare class DocumentCatalog {
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -62,20 +72,12 @@ class DocumentCatalog {
62
72
  * })
63
73
  */
64
74
  uploadDocumentContents(request, requestOptions) {
65
- var _a, _b;
66
75
  return __awaiter(this, void 0, void 0, function* () {
76
+ var _a, _b, _c;
67
77
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
68
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CredalEnvironment.Production, "/v0/catalog/uploadDocumentContents"),
78
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/catalog/uploadDocumentContents"),
69
79
  method: "POST",
70
- headers: {
71
- Authorization: yield this._getAuthorizationHeader(),
72
- "X-Fern-Language": "JavaScript",
73
- "X-Fern-SDK-Name": "@credal/sdk",
74
- "X-Fern-SDK-Version": "0.0.24",
75
- "User-Agent": "@credal/sdk/0.0.24",
76
- "X-Fern-Runtime": core.RUNTIME.type,
77
- "X-Fern-Runtime-Version": core.RUNTIME.version,
78
- },
80
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.25", "User-Agent": "@credal/sdk/0.0.25", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
79
81
  contentType: "application/json",
80
82
  requestType: "json",
81
83
  body: serializers.UploadDocumentContentsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -104,7 +106,7 @@ class DocumentCatalog {
104
106
  body: _response.error.rawBody,
105
107
  });
106
108
  case "timeout":
107
- throw new errors.CredalTimeoutError();
109
+ throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/catalog/uploadDocumentContents.");
108
110
  case "unknown":
109
111
  throw new errors.CredalError({
110
112
  message: _response.error.errorMessage,
@@ -125,20 +127,12 @@ class DocumentCatalog {
125
127
  * })
126
128
  */
127
129
  syncSourceByUrl(request, requestOptions) {
128
- var _a, _b;
129
130
  return __awaiter(this, void 0, void 0, function* () {
131
+ var _a, _b, _c;
130
132
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
131
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CredalEnvironment.Production, "/v0/catalog/syncSourceByUrl"),
133
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/catalog/syncSourceByUrl"),
132
134
  method: "POST",
133
- headers: {
134
- Authorization: yield this._getAuthorizationHeader(),
135
- "X-Fern-Language": "JavaScript",
136
- "X-Fern-SDK-Name": "@credal/sdk",
137
- "X-Fern-SDK-Version": "0.0.24",
138
- "User-Agent": "@credal/sdk/0.0.24",
139
- "X-Fern-Runtime": core.RUNTIME.type,
140
- "X-Fern-Runtime-Version": core.RUNTIME.version,
141
- },
135
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.25", "User-Agent": "@credal/sdk/0.0.25", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
142
136
  contentType: "application/json",
143
137
  requestType: "json",
144
138
  body: serializers.SyncSourceByUrlRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -167,7 +161,7 @@ class DocumentCatalog {
167
161
  body: _response.error.rawBody,
168
162
  });
169
163
  case "timeout":
170
- throw new errors.CredalTimeoutError();
164
+ throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/catalog/syncSourceByUrl.");
171
165
  case "unknown":
172
166
  throw new errors.CredalError({
173
167
  message: _response.error.errorMessage,
@@ -208,20 +202,12 @@ class DocumentCatalog {
208
202
  * })
209
203
  */
210
204
  metadata(request, requestOptions) {
211
- var _a, _b;
212
205
  return __awaiter(this, void 0, void 0, function* () {
206
+ var _a, _b, _c;
213
207
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
214
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CredalEnvironment.Production, "/v0/catalog/metadata"),
208
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/catalog/metadata"),
215
209
  method: "PATCH",
216
- headers: {
217
- Authorization: yield this._getAuthorizationHeader(),
218
- "X-Fern-Language": "JavaScript",
219
- "X-Fern-SDK-Name": "@credal/sdk",
220
- "X-Fern-SDK-Version": "0.0.24",
221
- "User-Agent": "@credal/sdk/0.0.24",
222
- "X-Fern-Runtime": core.RUNTIME.type,
223
- "X-Fern-Runtime-Version": core.RUNTIME.version,
224
- },
210
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.25", "User-Agent": "@credal/sdk/0.0.25", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
225
211
  contentType: "application/json",
226
212
  requestType: "json",
227
213
  body: serializers.DocumentMetadataPatchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -245,7 +231,7 @@ class DocumentCatalog {
245
231
  body: _response.error.rawBody,
246
232
  });
247
233
  case "timeout":
248
- throw new errors.CredalTimeoutError();
234
+ throw new errors.CredalTimeoutError("Timeout exceeded when calling PATCH /v0/catalog/metadata.");
249
235
  case "unknown":
250
236
  throw new errors.CredalError({
251
237
  message: _response.error.errorMessage,
@@ -254,12 +240,12 @@ class DocumentCatalog {
254
240
  });
255
241
  }
256
242
  _getAuthorizationHeader() {
257
- var _a;
258
243
  return __awaiter(this, void 0, void 0, function* () {
244
+ var _a;
259
245
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["CREDAL_API_KEY"];
260
246
  if (bearer == null) {
261
247
  throw new errors.CredalError({
262
- message: "Please specify CREDAL_API_KEY when instantiating the client.",
248
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
263
249
  });
264
250
  }
265
251
  return `Bearer ${bearer}`;
@@ -12,54 +12,24 @@
12
12
  * }
13
13
  */
14
14
  export interface UploadDocumentContentsRequest {
15
- /**
16
- * The name of the document you want to upload.
17
- *
18
- */
15
+ /** The name of the document you want to upload. */
19
16
  documentName: string;
20
- /**
21
- * The full LLM-formatted text contents of the document you want to upload.
22
- *
23
- */
17
+ /** The full LLM-formatted text contents of the document you want to upload. */
24
18
  documentContents: string;
25
- /**
26
- * Users allowed to access the document. Unlike Credal's out of the box connectors which reconcile various permissions models from 3rd party software, for custom uploads the caller is responsible for specifying who can access the document and currently flattening groups if applicable. Documents can also be marked as internal public.
27
- *
28
- */
19
+ /** Users allowed to access the document. Unlike Credal's out of the box connectors which reconcile various permissions models from 3rd party software, for custom uploads the caller is responsible for specifying who can access the document and currently flattening groups if applicable. Documents can also be marked as internal public. */
29
20
  allowedUsersEmailAddresses: string[];
30
- /**
31
- * [Legacy] The user on behalf of whom the document should be uploaded. In most cases, this can simply be the email of the developer making the API call. This field will be removed in the future in favor of purely specifying permissions via allowedUsersEmailAddresses.
32
- *
33
- */
21
+ /** [Legacy] The user on behalf of whom the document should be uploaded. In most cases, this can simply be the email of the developer making the API call. This field will be removed in the future in favor of purely specifying permissions via allowedUsersEmailAddresses. */
34
22
  uploadAsUserEmail: string;
35
- /**
36
- * The external ID of the document. This is typically the ID as it exists in its original external system. Uploads to the same external ID will update the document in Credal.
37
- *
38
- */
23
+ /** The external ID of the document. This is typically the ID as it exists in its original external system. Uploads to the same external ID will update the document in Credal. */
39
24
  documentExternalId: string;
40
- /**
41
- * The external URL of the document you want to upload. If provided Credal will link to this URL.
42
- *
43
- */
25
+ /** The external URL of the document you want to upload. If provided Credal will link to this URL. */
44
26
  documentExternalUrl?: string;
45
- /**
46
- * Optional JSON representing any custom metdata for this document
47
- *
48
- */
27
+ /** Optional JSON representing any custom metdata for this document */
49
28
  customMetadata?: unknown;
50
- /**
51
- * If specified, document will also be added to a particular document collection
52
- *
53
- */
29
+ /** If specified, document will also be added to a particular document collection */
54
30
  collectionId?: string;
55
- /**
56
- * If specified, document contents will be re-uploaded and re-embedded even if the document already exists in Credal
57
- *
58
- */
31
+ /** If specified, document contents will be re-uploaded and re-embedded even if the document already exists in Credal */
59
32
  forceUpdate?: boolean;
60
- /**
61
- * If specified, document will be accessible to everyone within the organization of the uploader
62
- *
63
- */
33
+ /** If specified, document will be accessible to everyone within the organization of the uploader */
64
34
  internalPublic?: boolean;
65
35
  }
@@ -7,6 +7,8 @@ import * as Credal from "../../../index";
7
7
  export declare namespace DocumentCollections {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.CredalEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<core.BearerToken | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }
@@ -17,6 +19,8 @@ export declare namespace DocumentCollections {
17
19
  maxRetries?: number;
18
20
  /** A hook to abort the request. */
19
21
  abortSignal?: AbortSignal;
22
+ /** Additional headers to include in the request. */
23
+ headers?: Record<string, string>;
20
24
  }
21
25
  }
22
26
  export declare class DocumentCollections {