@credal/sdk 0.1.9 → 0.1.11

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 (105) hide show
  1. package/dist/cjs/BaseClient.d.ts +4 -0
  2. package/dist/cjs/Client.js +3 -3
  3. package/dist/cjs/api/resources/copilots/client/Client.js +27 -9
  4. package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +8 -0
  5. package/dist/cjs/api/resources/documentCatalog/client/Client.js +95 -3
  6. package/dist/cjs/api/resources/documentCatalog/client/requests/UploadFileRequest.d.ts +27 -0
  7. package/dist/cjs/api/resources/documentCatalog/client/requests/UploadFileRequest.js +3 -0
  8. package/dist/cjs/api/resources/documentCatalog/client/requests/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/documentCollections/client/Client.js +21 -7
  10. package/dist/cjs/api/resources/search/client/Client.js +3 -1
  11. package/dist/cjs/api/resources/users/client/Client.js +3 -1
  12. package/dist/cjs/core/exports.d.ts +2 -0
  13. package/dist/cjs/core/exports.js +18 -0
  14. package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -1
  15. package/dist/cjs/core/fetcher/Fetcher.js +202 -9
  16. package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
  17. package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
  18. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  19. package/dist/cjs/core/fetcher/makeRequest.js +0 -2
  20. package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
  21. package/dist/cjs/core/fetcher/signals.d.ts +0 -6
  22. package/dist/cjs/core/fetcher/signals.js +0 -12
  23. package/dist/cjs/core/file/exports.d.ts +1 -0
  24. package/dist/cjs/core/file/exports.js +2 -0
  25. package/dist/cjs/core/file/file.d.ts +10 -0
  26. package/dist/cjs/core/file/file.js +221 -0
  27. package/dist/cjs/core/file/index.d.ts +2 -0
  28. package/dist/cjs/core/file/index.js +18 -0
  29. package/dist/cjs/core/file/types.d.ts +66 -0
  30. package/dist/cjs/core/file/types.js +2 -0
  31. package/dist/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
  32. package/dist/cjs/core/form-data-utils/FormDataWrapper.js +185 -0
  33. package/dist/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
  34. package/dist/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
  35. package/dist/cjs/core/form-data-utils/index.d.ts +2 -0
  36. package/dist/cjs/core/form-data-utils/index.js +20 -0
  37. package/dist/cjs/core/headers.js +6 -4
  38. package/dist/cjs/core/index.d.ts +3 -0
  39. package/dist/cjs/core/index.js +4 -1
  40. package/dist/cjs/core/logging/exports.d.ts +18 -0
  41. package/dist/cjs/core/logging/exports.js +45 -0
  42. package/dist/cjs/core/logging/index.d.ts +1 -0
  43. package/dist/cjs/core/logging/index.js +17 -0
  44. package/dist/cjs/core/logging/logger.d.ts +126 -0
  45. package/dist/cjs/core/logging/logger.js +144 -0
  46. package/dist/cjs/core/url/join.js +0 -1
  47. package/dist/cjs/exports.d.ts +1 -0
  48. package/dist/cjs/exports.js +17 -0
  49. package/dist/cjs/index.d.ts +1 -0
  50. package/dist/cjs/index.js +4 -0
  51. package/dist/cjs/version.d.ts +1 -1
  52. package/dist/cjs/version.js +1 -1
  53. package/dist/esm/BaseClient.d.mts +4 -0
  54. package/dist/esm/Client.mjs +3 -3
  55. package/dist/esm/api/resources/copilots/client/Client.mjs +27 -9
  56. package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +8 -0
  57. package/dist/esm/api/resources/documentCatalog/client/Client.mjs +95 -3
  58. package/dist/esm/api/resources/documentCatalog/client/requests/UploadFileRequest.d.mts +27 -0
  59. package/dist/esm/api/resources/documentCatalog/client/requests/UploadFileRequest.mjs +2 -0
  60. package/dist/esm/api/resources/documentCatalog/client/requests/index.d.mts +1 -0
  61. package/dist/esm/api/resources/documentCollections/client/Client.mjs +21 -7
  62. package/dist/esm/api/resources/search/client/Client.mjs +3 -1
  63. package/dist/esm/api/resources/users/client/Client.mjs +3 -1
  64. package/dist/esm/core/exports.d.mts +2 -0
  65. package/dist/esm/core/exports.mjs +2 -0
  66. package/dist/esm/core/fetcher/Fetcher.d.mts +4 -1
  67. package/dist/esm/core/fetcher/Fetcher.mjs +202 -9
  68. package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
  69. package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
  70. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  71. package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
  72. package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
  73. package/dist/esm/core/fetcher/signals.d.mts +0 -6
  74. package/dist/esm/core/fetcher/signals.mjs +0 -12
  75. package/dist/esm/core/file/exports.d.mts +1 -0
  76. package/dist/esm/core/file/exports.mjs +1 -0
  77. package/dist/esm/core/file/file.d.mts +10 -0
  78. package/dist/esm/core/file/file.mjs +184 -0
  79. package/dist/esm/core/file/index.d.mts +2 -0
  80. package/dist/esm/core/file/index.mjs +2 -0
  81. package/dist/esm/core/file/types.d.mts +66 -0
  82. package/dist/esm/core/file/types.mjs +1 -0
  83. package/dist/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
  84. package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +147 -0
  85. package/dist/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
  86. package/dist/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
  87. package/dist/esm/core/form-data-utils/index.d.mts +2 -0
  88. package/dist/esm/core/form-data-utils/index.mjs +2 -0
  89. package/dist/esm/core/headers.mjs +6 -4
  90. package/dist/esm/core/index.d.mts +3 -0
  91. package/dist/esm/core/index.mjs +3 -0
  92. package/dist/esm/core/logging/exports.d.mts +18 -0
  93. package/dist/esm/core/logging/exports.mjs +9 -0
  94. package/dist/esm/core/logging/index.d.mts +1 -0
  95. package/dist/esm/core/logging/index.mjs +1 -0
  96. package/dist/esm/core/logging/logger.d.mts +126 -0
  97. package/dist/esm/core/logging/logger.mjs +138 -0
  98. package/dist/esm/core/url/join.mjs +0 -1
  99. package/dist/esm/exports.d.mts +1 -0
  100. package/dist/esm/exports.mjs +1 -0
  101. package/dist/esm/index.d.mts +1 -0
  102. package/dist/esm/index.mjs +1 -0
  103. package/dist/esm/version.d.mts +1 -1
  104. package/dist/esm/version.mjs +1 -1
  105. package/package.json +3 -2
@@ -11,7 +11,11 @@ export interface BaseClientOptions {
11
11
  timeoutInSeconds?: number;
12
12
  /** The default number of times to retry the request. Defaults to 2. */
13
13
  maxRetries?: number;
14
+ /** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
15
+ fetch?: typeof fetch;
14
16
  fetcher?: core.FetchFunction;
17
+ /** Configure logging for the client. */
18
+ logging?: core.logging.LogConfig | core.logging.Logger;
15
19
  }
16
20
  export interface BaseRequestOptions {
17
21
  /** The maximum time to wait for a response in seconds. */
@@ -44,11 +44,11 @@ const headers_js_1 = require("./core/headers.js");
44
44
  const core = __importStar(require("./core/index.js"));
45
45
  class CredalClient {
46
46
  constructor(_options = {}) {
47
- this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
47
+ this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: (0, headers_js_1.mergeHeaders)({
48
48
  "X-Fern-Language": "JavaScript",
49
49
  "X-Fern-SDK-Name": "@credal/sdk",
50
- "X-Fern-SDK-Version": "0.1.9",
51
- "User-Agent": "@credal/sdk/0.1.9",
50
+ "X-Fern-SDK-Version": "0.1.11",
51
+ "User-Agent": "@credal/sdk/0.1.11",
52
52
  "X-Fern-Runtime": core.RUNTIME.type,
53
53
  "X-Fern-Runtime-Version": core.RUNTIME.version,
54
54
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -73,7 +73,7 @@ class Copilots {
73
73
  }
74
74
  __createCopilot(request, requestOptions) {
75
75
  return __awaiter(this, void 0, void 0, function* () {
76
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
76
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
77
77
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
78
78
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
79
79
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/createCopilot"),
@@ -86,6 +86,8 @@ class Copilots {
86
86
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
87
87
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
88
88
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
89
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
90
+ logging: this._options.logging,
89
91
  });
90
92
  if (_response.ok) {
91
93
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -131,7 +133,7 @@ class Copilots {
131
133
  }
132
134
  __createConversation(request, requestOptions) {
133
135
  return __awaiter(this, void 0, void 0, function* () {
134
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
136
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
135
137
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
136
138
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
137
139
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/createConversation"),
@@ -144,6 +146,8 @@ class Copilots {
144
146
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
145
147
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
146
148
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
149
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
150
+ logging: this._options.logging,
147
151
  });
148
152
  if (_response.ok) {
149
153
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -193,7 +197,7 @@ class Copilots {
193
197
  }
194
198
  __provideMessageFeedback(request, requestOptions) {
195
199
  return __awaiter(this, void 0, void 0, function* () {
196
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
200
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
197
201
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
198
202
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
199
203
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/provideMessageFeedback"),
@@ -206,6 +210,8 @@ class Copilots {
206
210
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
207
211
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
208
212
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
213
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
214
+ logging: this._options.logging,
209
215
  });
210
216
  if (_response.ok) {
211
217
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -257,7 +263,7 @@ class Copilots {
257
263
  }
258
264
  __sendMessage(request, requestOptions) {
259
265
  return __awaiter(this, void 0, void 0, function* () {
260
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
266
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
261
267
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
262
268
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
263
269
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/sendMessage"),
@@ -270,6 +276,8 @@ class Copilots {
270
276
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
271
277
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
272
278
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
279
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
280
+ logging: this._options.logging,
273
281
  });
274
282
  if (_response.ok) {
275
283
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -306,7 +314,7 @@ class Copilots {
306
314
  }
307
315
  __streamMessage(request, requestOptions) {
308
316
  return __awaiter(this, void 0, void 0, function* () {
309
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
317
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
310
318
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
311
319
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
312
320
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/streamMessage"),
@@ -320,6 +328,8 @@ class Copilots {
320
328
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
321
329
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
322
330
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
331
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
332
+ logging: this._options.logging,
323
333
  });
324
334
  if (_response.ok) {
325
335
  return {
@@ -376,7 +386,7 @@ class Copilots {
376
386
  }
377
387
  __addCollectionToCopilot(request, requestOptions) {
378
388
  return __awaiter(this, void 0, void 0, function* () {
379
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
389
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
380
390
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
381
391
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
382
392
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/addCollectionToCopilot"),
@@ -389,6 +399,8 @@ class Copilots {
389
399
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
390
400
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
391
401
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
402
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
403
+ logging: this._options.logging,
392
404
  });
393
405
  if (_response.ok) {
394
406
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -434,7 +446,7 @@ class Copilots {
434
446
  }
435
447
  __removeCollectionFromCopilot(request, requestOptions) {
436
448
  return __awaiter(this, void 0, void 0, function* () {
437
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
449
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
438
450
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
439
451
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
440
452
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/removeCollectionFromCopilot"),
@@ -447,6 +459,8 @@ class Copilots {
447
459
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
448
460
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
449
461
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
462
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
463
+ logging: this._options.logging,
450
464
  });
451
465
  if (_response.ok) {
452
466
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -500,7 +514,7 @@ class Copilots {
500
514
  }
501
515
  __updateConfiguration(request, requestOptions) {
502
516
  return __awaiter(this, void 0, void 0, function* () {
503
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
517
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
504
518
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
505
519
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
506
520
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/updateConfiguration"),
@@ -513,6 +527,8 @@ class Copilots {
513
527
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
514
528
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
515
529
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
530
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
531
+ logging: this._options.logging,
516
532
  });
517
533
  if (_response.ok) {
518
534
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -555,7 +571,7 @@ class Copilots {
555
571
  }
556
572
  __deleteCopilot(request, requestOptions) {
557
573
  return __awaiter(this, void 0, void 0, function* () {
558
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
574
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
559
575
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
560
576
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
561
577
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/deleteCopilot"),
@@ -568,6 +584,8 @@ class Copilots {
568
584
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
569
585
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
570
586
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
587
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
588
+ logging: this._options.logging,
571
589
  });
572
590
  if (_response.ok) {
573
591
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -25,6 +25,14 @@ export declare class DocumentCatalog {
25
25
  */
26
26
  uploadDocumentContents(request: Credal.UploadDocumentContentsRequest, requestOptions?: DocumentCatalog.RequestOptions): core.HttpResponsePromise<Credal.UploadDocumentResponse>;
27
27
  private __uploadDocumentContents;
28
+ /**
29
+ * Upload a file (PDF, Word, Excel, CSV, PowerPoint) to Credal. Unlike uploadDocumentContents which requires pre-parsed text, this endpoint accepts actual file uploads and automatically parses them using Credal's parsing service.
30
+ *
31
+ * @param {Credal.UploadFileRequest} request
32
+ * @param {DocumentCatalog.RequestOptions} requestOptions - Request-specific configuration.
33
+ */
34
+ uploadFile(request: Credal.UploadFileRequest, requestOptions?: DocumentCatalog.RequestOptions): core.HttpResponsePromise<Credal.UploadDocumentResponse>;
35
+ private __uploadFile;
28
36
  /**
29
37
  * Sync a document from a source URL. Does not support recursive web search. Reach out to a Credal representative for access.
30
38
  *
@@ -70,7 +70,7 @@ class DocumentCatalog {
70
70
  }
71
71
  __uploadDocumentContents(request, requestOptions) {
72
72
  return __awaiter(this, void 0, void 0, function* () {
73
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
73
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
74
74
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
75
75
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
76
76
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/catalog/uploadDocumentContents"),
@@ -83,6 +83,8 @@ class DocumentCatalog {
83
83
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
84
84
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
85
85
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
86
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
87
+ logging: this._options.logging,
86
88
  });
87
89
  if (_response.ok) {
88
90
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -111,6 +113,92 @@ class DocumentCatalog {
111
113
  }
112
114
  });
113
115
  }
116
+ /**
117
+ * Upload a file (PDF, Word, Excel, CSV, PowerPoint) to Credal. Unlike uploadDocumentContents which requires pre-parsed text, this endpoint accepts actual file uploads and automatically parses them using Credal's parsing service.
118
+ *
119
+ * @param {Credal.UploadFileRequest} request
120
+ * @param {DocumentCatalog.RequestOptions} requestOptions - Request-specific configuration.
121
+ */
122
+ uploadFile(request, requestOptions) {
123
+ return core.HttpResponsePromise.fromPromise(this.__uploadFile(request, requestOptions));
124
+ }
125
+ __uploadFile(request, requestOptions) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
128
+ const _request = yield core.newFormData();
129
+ yield _request.appendFile("file", request.file);
130
+ if (request.documentName != null) {
131
+ _request.append("documentName", request.documentName);
132
+ }
133
+ _request.append("uploadAsUserEmail", request.uploadAsUserEmail);
134
+ _request.append("documentExternalId", request.documentExternalId);
135
+ if (request.allowedUsersEmailAddresses != null) {
136
+ _request.append("allowedUsersEmailAddresses", request.allowedUsersEmailAddresses);
137
+ }
138
+ if (request.documentExternalUrl != null) {
139
+ _request.append("documentExternalUrl", request.documentExternalUrl);
140
+ }
141
+ if (request.customMetadata != null) {
142
+ _request.append("customMetadata", request.customMetadata);
143
+ }
144
+ if (request.collectionId != null) {
145
+ _request.append("collectionId", request.collectionId);
146
+ }
147
+ if (request.forceUpdate != null) {
148
+ _request.append("forceUpdate", request.forceUpdate);
149
+ }
150
+ if (request.internalPublic != null) {
151
+ _request.append("internalPublic", request.internalPublic);
152
+ }
153
+ if (request.sourceSystemUpdated != null) {
154
+ _request.append("sourceSystemUpdated", request.sourceSystemUpdated);
155
+ }
156
+ if (request.awaitVectorStoreSync != null) {
157
+ _request.append("awaitVectorStoreSync", request.awaitVectorStoreSync);
158
+ }
159
+ const _maybeEncodedRequest = yield _request.getRequest();
160
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: yield this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
161
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
162
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/catalog/uploadFile"),
163
+ method: "POST",
164
+ headers: _headers,
165
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
166
+ requestType: "file",
167
+ duplex: _maybeEncodedRequest.duplex,
168
+ body: _maybeEncodedRequest.body,
169
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
170
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
171
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
172
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
173
+ logging: this._options.logging,
174
+ });
175
+ if (_response.ok) {
176
+ return { data: _response.body, rawResponse: _response.rawResponse };
177
+ }
178
+ if (_response.error.reason === "status-code") {
179
+ throw new errors.CredalError({
180
+ statusCode: _response.error.statusCode,
181
+ body: _response.error.body,
182
+ rawResponse: _response.rawResponse,
183
+ });
184
+ }
185
+ switch (_response.error.reason) {
186
+ case "non-json":
187
+ throw new errors.CredalError({
188
+ statusCode: _response.error.statusCode,
189
+ body: _response.error.rawBody,
190
+ rawResponse: _response.rawResponse,
191
+ });
192
+ case "timeout":
193
+ throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/catalog/uploadFile.");
194
+ case "unknown":
195
+ throw new errors.CredalError({
196
+ message: _response.error.errorMessage,
197
+ rawResponse: _response.rawResponse,
198
+ });
199
+ }
200
+ });
201
+ }
114
202
  /**
115
203
  * Sync a document from a source URL. Does not support recursive web search. Reach out to a Credal representative for access.
116
204
  *
@@ -128,7 +216,7 @@ class DocumentCatalog {
128
216
  }
129
217
  __syncSourceByUrl(request, requestOptions) {
130
218
  return __awaiter(this, void 0, void 0, function* () {
131
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
219
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
132
220
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
133
221
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
134
222
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/catalog/syncSourceByUrl"),
@@ -141,6 +229,8 @@ class DocumentCatalog {
141
229
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
142
230
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
143
231
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
232
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
233
+ logging: this._options.logging,
144
234
  });
145
235
  if (_response.ok) {
146
236
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -206,7 +296,7 @@ class DocumentCatalog {
206
296
  }
207
297
  __metadata(request, requestOptions) {
208
298
  return __awaiter(this, void 0, void 0, function* () {
209
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
299
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
210
300
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
211
301
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
212
302
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/catalog/metadata"),
@@ -219,6 +309,8 @@ class DocumentCatalog {
219
309
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
220
310
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
221
311
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
312
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
313
+ logging: this._options.logging,
222
314
  });
223
315
  if (_response.ok) {
224
316
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -0,0 +1,27 @@
1
+ import type * as core from "../../../../../core/index.js";
2
+ export interface UploadFileRequest {
3
+ /** The file to upload. Supported formats: PDF (.pdf), Word (.docx), Excel (.xlsx, .xls), PowerPoint (.pptx, .ppt), CSV (.csv), and text files. */
4
+ file: core.file.Uploadable;
5
+ /** The name of the document you want to upload. If not provided, the original filename will be used. */
6
+ documentName?: string;
7
+ /** [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. */
8
+ uploadAsUserEmail: string;
9
+ /** 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. */
10
+ documentExternalId: string;
11
+ /** Users allowed to access the document. Can be provided as a JSON array string (e.g., ["user1@example.com","user2@example.com"]) or comma-separated list (e.g., "user1@example.com,user2@example.com"). 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. */
12
+ allowedUsersEmailAddresses?: string;
13
+ /** The external URL of the document you want to upload. If provided Credal will link to this URL. */
14
+ documentExternalUrl?: string;
15
+ /** Optional JSON string representing any custom metadata for this document (e.g., '{"key1":"value1","key2":"value2"}'). */
16
+ customMetadata?: string;
17
+ /** If specified, the document will also be added to the provided document collection. This operation is eventually consistent, meaning the document does not immediately start appearing in searches of that collection due to an asynchronous embedding process. To achieve strong consistency use the `awaitVectorStoreSync` parameter. */
18
+ collectionId?: string;
19
+ /** If set to "true", document contents will be re-uploaded and re-embedded even if the document already exists in Credal. */
20
+ forceUpdate?: string;
21
+ /** If set to "true", document will be accessible to everyone within the organization of the uploader. */
22
+ internalPublic?: string;
23
+ /** ISO 8601 date string indicating when the document was last updated in the source system (e.g., "2025-11-03T21:15:00Z"). */
24
+ sourceSystemUpdated?: string;
25
+ /** Document uploads are eventually consistent by default. If set to "true" the API will wait for the vector store to be updated before returning. This is useful if you want to ensure that the document is immediately searchable after this call returns. */
26
+ awaitVectorStoreSync?: string;
27
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,2 @@
1
1
  export type { UploadDocumentContentsRequest } from "./UploadDocumentContentsRequest.js";
2
+ export type { UploadFileRequest } from "./UploadFileRequest.js";
@@ -77,7 +77,7 @@ class DocumentCollections {
77
77
  }
78
78
  __addDocumentsToCollection(request, requestOptions) {
79
79
  return __awaiter(this, void 0, void 0, function* () {
80
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
80
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
81
81
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
82
82
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
83
83
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/addDocumentsToCollection"),
@@ -90,6 +90,8 @@ class DocumentCollections {
90
90
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
91
91
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
92
92
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
93
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
94
+ logging: this._options.logging,
93
95
  });
94
96
  if (_response.ok) {
95
97
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -143,7 +145,7 @@ class DocumentCollections {
143
145
  }
144
146
  __removeDocumentsFromCollection(request, requestOptions) {
145
147
  return __awaiter(this, void 0, void 0, function* () {
146
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
148
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
147
149
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
148
150
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
149
151
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/removeDocumentsFromCollection"),
@@ -156,6 +158,8 @@ class DocumentCollections {
156
158
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
157
159
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
158
160
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
161
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
162
+ logging: this._options.logging,
159
163
  });
160
164
  if (_response.ok) {
161
165
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -200,7 +204,7 @@ class DocumentCollections {
200
204
  }
201
205
  __listDocumentsInCollection(request, requestOptions) {
202
206
  return __awaiter(this, void 0, void 0, function* () {
203
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
207
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
204
208
  const { collectionId } = request;
205
209
  const _queryParams = {};
206
210
  _queryParams.collectionId = collectionId;
@@ -213,6 +217,8 @@ class DocumentCollections {
213
217
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
214
218
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
215
219
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
220
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
221
+ logging: this._options.logging,
216
222
  });
217
223
  if (_response.ok) {
218
224
  return {
@@ -265,7 +271,7 @@ class DocumentCollections {
265
271
  }
266
272
  __createCollection(request, requestOptions) {
267
273
  return __awaiter(this, void 0, void 0, function* () {
268
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
274
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
269
275
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
270
276
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
271
277
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/createCollection"),
@@ -278,6 +284,8 @@ class DocumentCollections {
278
284
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
279
285
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
280
286
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
287
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
288
+ logging: this._options.logging,
281
289
  });
282
290
  if (_response.ok) {
283
291
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -322,7 +330,7 @@ class DocumentCollections {
322
330
  }
323
331
  __deleteCollection(request, requestOptions) {
324
332
  return __awaiter(this, void 0, void 0, function* () {
325
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
333
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
326
334
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
327
335
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
328
336
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/deleteCollection"),
@@ -335,6 +343,8 @@ class DocumentCollections {
335
343
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
336
344
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
337
345
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
346
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
347
+ logging: this._options.logging,
338
348
  });
339
349
  if (_response.ok) {
340
350
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -395,7 +405,7 @@ class DocumentCollections {
395
405
  }
396
406
  __createMongoCollectionSync(request, requestOptions) {
397
407
  return __awaiter(this, void 0, void 0, function* () {
398
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
408
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
399
409
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
400
410
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
401
411
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/mongodb/createMongoSync"),
@@ -408,6 +418,8 @@ class DocumentCollections {
408
418
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
409
419
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
410
420
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
421
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
422
+ logging: this._options.logging,
411
423
  });
412
424
  if (_response.ok) {
413
425
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -468,7 +480,7 @@ class DocumentCollections {
468
480
  }
469
481
  __updateMongoCollectionSync(request, requestOptions) {
470
482
  return __awaiter(this, void 0, void 0, function* () {
471
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
483
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
472
484
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
473
485
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
474
486
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/mongodb/updateMongoSync"),
@@ -481,6 +493,8 @@ class DocumentCollections {
481
493
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
482
494
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
483
495
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
496
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
497
+ logging: this._options.logging,
484
498
  });
485
499
  if (_response.ok) {
486
500
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -83,7 +83,7 @@ class Search {
83
83
  }
84
84
  __searchDocumentCollection(request, requestOptions) {
85
85
  return __awaiter(this, void 0, void 0, function* () {
86
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
86
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
87
87
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
88
88
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
89
89
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/search/searchDocumentCollection"),
@@ -96,6 +96,8 @@ class Search {
96
96
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
97
97
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
98
98
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
99
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
100
+ logging: this._options.logging,
99
101
  });
100
102
  if (_response.ok) {
101
103
  return {
@@ -78,7 +78,7 @@ class Users {
78
78
  }
79
79
  __metadata(request, requestOptions) {
80
80
  return __awaiter(this, void 0, void 0, function* () {
81
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
81
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
82
82
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
83
83
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
84
84
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/users/metadata"),
@@ -91,6 +91,8 @@ class Users {
91
91
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
92
92
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
93
93
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
94
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
95
+ logging: this._options.logging,
94
96
  });
95
97
  if (_response.ok) {
96
98
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -0,0 +1,2 @@
1
+ export * from "./file/exports.js";
2
+ export * from "./logging/exports.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./file/exports.js"), exports);
18
+ __exportStar(require("./logging/exports.js"), exports);
@@ -1,3 +1,4 @@
1
+ import { type LogConfig, type Logger } from "../logging/logger.js";
1
2
  import type { APIResponse } from "./APIResponse.js";
2
3
  import type { EndpointMetadata } from "./EndpointMetadata.js";
3
4
  import { EndpointSupplier } from "./EndpointSupplier.js";
@@ -14,10 +15,12 @@ export declare namespace Fetcher {
14
15
  maxRetries?: number;
15
16
  withCredentials?: boolean;
16
17
  abortSignal?: AbortSignal;
17
- requestType?: "json" | "file" | "bytes";
18
+ requestType?: "json" | "file" | "bytes" | "form" | "other";
18
19
  responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response";
19
20
  duplex?: "half";
20
21
  endpointMetadata?: EndpointMetadata;
22
+ fetchFn?: typeof fetch;
23
+ logging?: LogConfig | Logger;
21
24
  }
22
25
  type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
23
26
  interface FailedStatusCodeError {