@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
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Logger = exports.ConsoleLogger = exports.LogLevel = void 0;
4
+ exports.createLogger = createLogger;
5
+ exports.LogLevel = {
6
+ Debug: "debug",
7
+ Info: "info",
8
+ Warn: "warn",
9
+ Error: "error",
10
+ };
11
+ const logLevelMap = {
12
+ [exports.LogLevel.Debug]: 1,
13
+ [exports.LogLevel.Info]: 2,
14
+ [exports.LogLevel.Warn]: 3,
15
+ [exports.LogLevel.Error]: 4,
16
+ };
17
+ /**
18
+ * Default console-based logger implementation.
19
+ */
20
+ class ConsoleLogger {
21
+ debug(message, ...args) {
22
+ console.debug(message, ...args);
23
+ }
24
+ info(message, ...args) {
25
+ console.info(message, ...args);
26
+ }
27
+ warn(message, ...args) {
28
+ console.warn(message, ...args);
29
+ }
30
+ error(message, ...args) {
31
+ console.error(message, ...args);
32
+ }
33
+ }
34
+ exports.ConsoleLogger = ConsoleLogger;
35
+ /**
36
+ * Logger class that provides level-based logging functionality.
37
+ */
38
+ class Logger {
39
+ /**
40
+ * Creates a new logger instance.
41
+ * @param config - Logger configuration
42
+ */
43
+ constructor(config) {
44
+ this.level = logLevelMap[config.level];
45
+ this.logger = config.logger;
46
+ this.silent = config.silent;
47
+ }
48
+ /**
49
+ * Checks if a log level should be output based on configuration.
50
+ * @param level - The log level to check
51
+ * @returns True if the level should be logged
52
+ */
53
+ shouldLog(level) {
54
+ return !this.silent && this.level <= logLevelMap[level];
55
+ }
56
+ /**
57
+ * Checks if debug logging is enabled.
58
+ * @returns True if debug logs should be output
59
+ */
60
+ isDebug() {
61
+ return this.shouldLog(exports.LogLevel.Debug);
62
+ }
63
+ /**
64
+ * Logs a debug message if debug logging is enabled.
65
+ * @param message - The message to log
66
+ * @param args - Additional arguments to log
67
+ */
68
+ debug(message, ...args) {
69
+ if (this.isDebug()) {
70
+ this.logger.debug(message, ...args);
71
+ }
72
+ }
73
+ /**
74
+ * Checks if info logging is enabled.
75
+ * @returns True if info logs should be output
76
+ */
77
+ isInfo() {
78
+ return this.shouldLog(exports.LogLevel.Info);
79
+ }
80
+ /**
81
+ * Logs an info message if info logging is enabled.
82
+ * @param message - The message to log
83
+ * @param args - Additional arguments to log
84
+ */
85
+ info(message, ...args) {
86
+ if (this.isInfo()) {
87
+ this.logger.info(message, ...args);
88
+ }
89
+ }
90
+ /**
91
+ * Checks if warning logging is enabled.
92
+ * @returns True if warning logs should be output
93
+ */
94
+ isWarn() {
95
+ return this.shouldLog(exports.LogLevel.Warn);
96
+ }
97
+ /**
98
+ * Logs a warning message if warning logging is enabled.
99
+ * @param message - The message to log
100
+ * @param args - Additional arguments to log
101
+ */
102
+ warn(message, ...args) {
103
+ if (this.isWarn()) {
104
+ this.logger.warn(message, ...args);
105
+ }
106
+ }
107
+ /**
108
+ * Checks if error logging is enabled.
109
+ * @returns True if error logs should be output
110
+ */
111
+ isError() {
112
+ return this.shouldLog(exports.LogLevel.Error);
113
+ }
114
+ /**
115
+ * Logs an error message if error logging is enabled.
116
+ * @param message - The message to log
117
+ * @param args - Additional arguments to log
118
+ */
119
+ error(message, ...args) {
120
+ if (this.isError()) {
121
+ this.logger.error(message, ...args);
122
+ }
123
+ }
124
+ }
125
+ exports.Logger = Logger;
126
+ function createLogger(config) {
127
+ var _a, _b, _c;
128
+ if (config == null) {
129
+ return defaultLogger;
130
+ }
131
+ if (config instanceof Logger) {
132
+ return config;
133
+ }
134
+ config = config !== null && config !== void 0 ? config : {};
135
+ (_a = config.level) !== null && _a !== void 0 ? _a : (config.level = exports.LogLevel.Info);
136
+ (_b = config.logger) !== null && _b !== void 0 ? _b : (config.logger = new ConsoleLogger());
137
+ (_c = config.silent) !== null && _c !== void 0 ? _c : (config.silent = true);
138
+ return new Logger(config);
139
+ }
140
+ const defaultLogger = new Logger({
141
+ level: exports.LogLevel.Info,
142
+ logger: new ConsoleLogger(),
143
+ silent: true,
144
+ });
@@ -14,7 +14,6 @@ function join(base, ...segments) {
14
14
  url = new URL(base);
15
15
  }
16
16
  catch (_a) {
17
- // Fallback to path joining if URL is malformed
18
17
  return joinPath(base, ...segments);
19
18
  }
20
19
  const lastSegment = segments[segments.length - 1];
@@ -0,0 +1 @@
1
+ export * from "./core/exports.js";
@@ -0,0 +1,17 @@
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("./core/exports.js"), exports);
@@ -3,3 +3,4 @@ export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
3
3
  export { CredalClient } from "./Client.js";
4
4
  export { CredalEnvironment } from "./environments.js";
5
5
  export { CredalError, CredalTimeoutError } from "./errors/index.js";
6
+ export * from "./exports.js";
package/dist/cjs/index.js CHANGED
@@ -32,6 +32,9 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.CredalTimeoutError = exports.CredalError = exports.CredalEnvironment = exports.CredalClient = exports.Credal = void 0;
37
40
  exports.Credal = __importStar(require("./api/index.js"));
@@ -42,3 +45,4 @@ Object.defineProperty(exports, "CredalEnvironment", { enumerable: true, get: fun
42
45
  var index_js_1 = require("./errors/index.js");
43
46
  Object.defineProperty(exports, "CredalError", { enumerable: true, get: function () { return index_js_1.CredalError; } });
44
47
  Object.defineProperty(exports, "CredalTimeoutError", { enumerable: true, get: function () { return index_js_1.CredalTimeoutError; } });
48
+ __exportStar(require("./exports.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.9";
1
+ export declare const SDK_VERSION = "0.1.11";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.1.9";
4
+ exports.SDK_VERSION = "0.1.11";
@@ -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. */
@@ -8,11 +8,11 @@ import { mergeHeaders } from "./core/headers.mjs";
8
8
  import * as core from "./core/index.mjs";
9
9
  export class CredalClient {
10
10
  constructor(_options = {}) {
11
- this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
11
+ this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: mergeHeaders({
12
12
  "X-Fern-Language": "JavaScript",
13
13
  "X-Fern-SDK-Name": "@credal/sdk",
14
- "X-Fern-SDK-Version": "0.1.9",
15
- "User-Agent": "@credal/sdk/0.1.9",
14
+ "X-Fern-SDK-Version": "0.1.11",
15
+ "User-Agent": "@credal/sdk/0.1.11",
16
16
  "X-Fern-Runtime": core.RUNTIME.type,
17
17
  "X-Fern-Runtime-Version": core.RUNTIME.version,
18
18
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -37,7 +37,7 @@ export class Copilots {
37
37
  }
38
38
  __createCopilot(request, requestOptions) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
41
41
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
42
42
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
43
43
  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"),
@@ -50,6 +50,8 @@ export class Copilots {
50
50
  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,
51
51
  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,
52
52
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
53
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
54
+ logging: this._options.logging,
53
55
  });
54
56
  if (_response.ok) {
55
57
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -95,7 +97,7 @@ export class Copilots {
95
97
  }
96
98
  __createConversation(request, requestOptions) {
97
99
  return __awaiter(this, void 0, void 0, function* () {
98
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
100
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
99
101
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
100
102
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
101
103
  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"),
@@ -108,6 +110,8 @@ export class Copilots {
108
110
  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,
109
111
  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,
110
112
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
113
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
114
+ logging: this._options.logging,
111
115
  });
112
116
  if (_response.ok) {
113
117
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -157,7 +161,7 @@ export class Copilots {
157
161
  }
158
162
  __provideMessageFeedback(request, requestOptions) {
159
163
  return __awaiter(this, void 0, void 0, function* () {
160
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
164
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
161
165
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
162
166
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
163
167
  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"),
@@ -170,6 +174,8 @@ export class Copilots {
170
174
  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,
171
175
  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,
172
176
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
177
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
178
+ logging: this._options.logging,
173
179
  });
174
180
  if (_response.ok) {
175
181
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -221,7 +227,7 @@ export class Copilots {
221
227
  }
222
228
  __sendMessage(request, requestOptions) {
223
229
  return __awaiter(this, void 0, void 0, function* () {
224
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
230
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
225
231
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
226
232
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
227
233
  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"),
@@ -234,6 +240,8 @@ export class Copilots {
234
240
  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,
235
241
  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,
236
242
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
243
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
244
+ logging: this._options.logging,
237
245
  });
238
246
  if (_response.ok) {
239
247
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -270,7 +278,7 @@ export class Copilots {
270
278
  }
271
279
  __streamMessage(request, requestOptions) {
272
280
  return __awaiter(this, void 0, void 0, function* () {
273
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
281
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
274
282
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
275
283
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
276
284
  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"),
@@ -284,6 +292,8 @@ export class Copilots {
284
292
  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,
285
293
  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,
286
294
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
295
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
296
+ logging: this._options.logging,
287
297
  });
288
298
  if (_response.ok) {
289
299
  return {
@@ -340,7 +350,7 @@ export class Copilots {
340
350
  }
341
351
  __addCollectionToCopilot(request, requestOptions) {
342
352
  return __awaiter(this, void 0, void 0, function* () {
343
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
353
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
344
354
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
345
355
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
346
356
  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"),
@@ -353,6 +363,8 @@ export class Copilots {
353
363
  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,
354
364
  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,
355
365
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
366
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
367
+ logging: this._options.logging,
356
368
  });
357
369
  if (_response.ok) {
358
370
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -398,7 +410,7 @@ export class Copilots {
398
410
  }
399
411
  __removeCollectionFromCopilot(request, requestOptions) {
400
412
  return __awaiter(this, void 0, void 0, function* () {
401
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
413
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
402
414
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
403
415
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
404
416
  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"),
@@ -411,6 +423,8 @@ export class Copilots {
411
423
  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,
412
424
  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,
413
425
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
426
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
427
+ logging: this._options.logging,
414
428
  });
415
429
  if (_response.ok) {
416
430
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -464,7 +478,7 @@ export class Copilots {
464
478
  }
465
479
  __updateConfiguration(request, requestOptions) {
466
480
  return __awaiter(this, void 0, void 0, function* () {
467
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
481
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
468
482
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
469
483
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
470
484
  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"),
@@ -477,6 +491,8 @@ export class Copilots {
477
491
  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,
478
492
  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,
479
493
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
494
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
495
+ logging: this._options.logging,
480
496
  });
481
497
  if (_response.ok) {
482
498
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -519,7 +535,7 @@ export class Copilots {
519
535
  }
520
536
  __deleteCopilot(request, requestOptions) {
521
537
  return __awaiter(this, void 0, void 0, function* () {
522
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
538
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
523
539
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
524
540
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
525
541
  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"),
@@ -532,6 +548,8 @@ export class Copilots {
532
548
  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,
533
549
  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,
534
550
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
551
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
552
+ logging: this._options.logging,
535
553
  });
536
554
  if (_response.ok) {
537
555
  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
  *
@@ -34,7 +34,7 @@ export class DocumentCatalog {
34
34
  }
35
35
  __uploadDocumentContents(request, requestOptions) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
37
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
38
38
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
39
39
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
40
40
  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"),
@@ -47,6 +47,8 @@ export class DocumentCatalog {
47
47
  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,
48
48
  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,
49
49
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
50
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
51
+ logging: this._options.logging,
50
52
  });
51
53
  if (_response.ok) {
52
54
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -75,6 +77,92 @@ export class DocumentCatalog {
75
77
  }
76
78
  });
77
79
  }
80
+ /**
81
+ * 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.
82
+ *
83
+ * @param {Credal.UploadFileRequest} request
84
+ * @param {DocumentCatalog.RequestOptions} requestOptions - Request-specific configuration.
85
+ */
86
+ uploadFile(request, requestOptions) {
87
+ return core.HttpResponsePromise.fromPromise(this.__uploadFile(request, requestOptions));
88
+ }
89
+ __uploadFile(request, requestOptions) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
92
+ const _request = yield core.newFormData();
93
+ yield _request.appendFile("file", request.file);
94
+ if (request.documentName != null) {
95
+ _request.append("documentName", request.documentName);
96
+ }
97
+ _request.append("uploadAsUserEmail", request.uploadAsUserEmail);
98
+ _request.append("documentExternalId", request.documentExternalId);
99
+ if (request.allowedUsersEmailAddresses != null) {
100
+ _request.append("allowedUsersEmailAddresses", request.allowedUsersEmailAddresses);
101
+ }
102
+ if (request.documentExternalUrl != null) {
103
+ _request.append("documentExternalUrl", request.documentExternalUrl);
104
+ }
105
+ if (request.customMetadata != null) {
106
+ _request.append("customMetadata", request.customMetadata);
107
+ }
108
+ if (request.collectionId != null) {
109
+ _request.append("collectionId", request.collectionId);
110
+ }
111
+ if (request.forceUpdate != null) {
112
+ _request.append("forceUpdate", request.forceUpdate);
113
+ }
114
+ if (request.internalPublic != null) {
115
+ _request.append("internalPublic", request.internalPublic);
116
+ }
117
+ if (request.sourceSystemUpdated != null) {
118
+ _request.append("sourceSystemUpdated", request.sourceSystemUpdated);
119
+ }
120
+ if (request.awaitVectorStoreSync != null) {
121
+ _request.append("awaitVectorStoreSync", request.awaitVectorStoreSync);
122
+ }
123
+ const _maybeEncodedRequest = yield _request.getRequest();
124
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({ Authorization: yield this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
125
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
126
+ 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"),
127
+ method: "POST",
128
+ headers: _headers,
129
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
130
+ requestType: "file",
131
+ duplex: _maybeEncodedRequest.duplex,
132
+ body: _maybeEncodedRequest.body,
133
+ 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,
134
+ 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,
135
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
136
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
137
+ logging: this._options.logging,
138
+ });
139
+ if (_response.ok) {
140
+ return { data: _response.body, rawResponse: _response.rawResponse };
141
+ }
142
+ if (_response.error.reason === "status-code") {
143
+ throw new errors.CredalError({
144
+ statusCode: _response.error.statusCode,
145
+ body: _response.error.body,
146
+ rawResponse: _response.rawResponse,
147
+ });
148
+ }
149
+ switch (_response.error.reason) {
150
+ case "non-json":
151
+ throw new errors.CredalError({
152
+ statusCode: _response.error.statusCode,
153
+ body: _response.error.rawBody,
154
+ rawResponse: _response.rawResponse,
155
+ });
156
+ case "timeout":
157
+ throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/catalog/uploadFile.");
158
+ case "unknown":
159
+ throw new errors.CredalError({
160
+ message: _response.error.errorMessage,
161
+ rawResponse: _response.rawResponse,
162
+ });
163
+ }
164
+ });
165
+ }
78
166
  /**
79
167
  * Sync a document from a source URL. Does not support recursive web search. Reach out to a Credal representative for access.
80
168
  *
@@ -92,7 +180,7 @@ export class DocumentCatalog {
92
180
  }
93
181
  __syncSourceByUrl(request, requestOptions) {
94
182
  return __awaiter(this, void 0, void 0, function* () {
95
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
183
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
96
184
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
97
185
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
98
186
  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"),
@@ -105,6 +193,8 @@ export class DocumentCatalog {
105
193
  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,
106
194
  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,
107
195
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
196
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
197
+ logging: this._options.logging,
108
198
  });
109
199
  if (_response.ok) {
110
200
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -170,7 +260,7 @@ export class DocumentCatalog {
170
260
  }
171
261
  __metadata(request, requestOptions) {
172
262
  return __awaiter(this, void 0, void 0, function* () {
173
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
263
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
174
264
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
175
265
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
176
266
  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"),
@@ -183,6 +273,8 @@ export class DocumentCatalog {
183
273
  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,
184
274
  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,
185
275
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
276
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
277
+ logging: this._options.logging,
186
278
  });
187
279
  if (_response.ok) {
188
280
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -0,0 +1,27 @@
1
+ import type * as core from "../../../../../core/index.mjs";
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,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1 +1,2 @@
1
1
  export type { UploadDocumentContentsRequest } from "./UploadDocumentContentsRequest.mjs";
2
+ export type { UploadFileRequest } from "./UploadFileRequest.mjs";