@credal/sdk 0.1.10 → 0.1.12
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.
- package/dist/cjs/BaseClient.d.ts +6 -1
- package/dist/cjs/BaseClient.js +47 -0
- package/dist/cjs/Client.d.ts +16 -16
- package/dist/cjs/Client.js +8 -49
- package/dist/cjs/api/resources/copilots/client/Client.d.ts +21 -21
- package/dist/cjs/api/resources/copilots/client/Client.js +41 -22
- package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +12 -12
- package/dist/cjs/api/resources/documentCatalog/client/Client.js +22 -13
- package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +18 -18
- package/dist/cjs/api/resources/documentCollections/client/Client.js +34 -19
- package/dist/cjs/api/resources/search/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/search/client/Client.js +10 -7
- package/dist/cjs/api/resources/users/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/users/client/Client.js +10 -7
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +1 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/cjs/core/fetcher/Fetcher.js +202 -9
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +0 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
- package/dist/cjs/core/fetcher/signals.d.ts +0 -6
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/headers.js +6 -4
- package/dist/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.js +2 -1
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/url/join.js +0 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +6 -1
- package/dist/esm/BaseClient.mjs +13 -1
- package/dist/esm/Client.d.mts +16 -16
- package/dist/esm/Client.mjs +13 -21
- package/dist/esm/api/resources/copilots/client/Client.d.mts +21 -21
- package/dist/esm/api/resources/copilots/client/Client.mjs +39 -20
- package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +12 -12
- package/dist/esm/api/resources/documentCatalog/client/Client.mjs +20 -11
- package/dist/esm/api/resources/documentCollections/client/Client.d.mts +18 -18
- package/dist/esm/api/resources/documentCollections/client/Client.mjs +32 -17
- package/dist/esm/api/resources/search/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/search/client/Client.mjs +8 -5
- package/dist/esm/api/resources/users/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/users/client/Client.mjs +8 -5
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +4 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +202 -9
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
- package/dist/esm/core/fetcher/signals.d.mts +0 -6
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/headers.mjs +6 -4
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/url/join.mjs +0 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -2
- package/reference.md +21 -21
|
@@ -8,19 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
import { normalizeClientOptions } from "../../../../BaseClient.mjs";
|
|
11
12
|
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
12
13
|
import * as core from "../../../../core/index.mjs";
|
|
13
14
|
import * as environments from "../../../../environments.mjs";
|
|
14
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
15
|
-
export class
|
|
16
|
-
constructor(
|
|
17
|
-
this._options =
|
|
16
|
+
export class DocumentCollectionsClient {
|
|
17
|
+
constructor(options = {}) {
|
|
18
|
+
this._options = normalizeClientOptions(options);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Add documents to a document collection. Note that the documents must already exist in the document catalog to use this endpoint. If you want to upload a new document to a collection, use the `uploadDocumentContents` endpoint.
|
|
21
22
|
*
|
|
22
23
|
* @param {Credal.AddDocumentsToCollectionRequest} request
|
|
23
|
-
* @param {
|
|
24
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
24
25
|
*
|
|
25
26
|
* @example
|
|
26
27
|
* await client.documentCollections.addDocumentsToCollection({
|
|
@@ -41,7 +42,7 @@ export class DocumentCollections {
|
|
|
41
42
|
}
|
|
42
43
|
__addDocumentsToCollection(request, requestOptions) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
45
46
|
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);
|
|
46
47
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
47
48
|
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"),
|
|
@@ -54,6 +55,8 @@ export class DocumentCollections {
|
|
|
54
55
|
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,
|
|
55
56
|
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,
|
|
56
57
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
58
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
59
|
+
logging: this._options.logging,
|
|
57
60
|
});
|
|
58
61
|
if (_response.ok) {
|
|
59
62
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -86,7 +89,7 @@ export class DocumentCollections {
|
|
|
86
89
|
* Remove documents from a collection
|
|
87
90
|
*
|
|
88
91
|
* @param {Credal.RemoveDocumentsFromCollectionRequest} request
|
|
89
|
-
* @param {
|
|
92
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
90
93
|
*
|
|
91
94
|
* @example
|
|
92
95
|
* await client.documentCollections.removeDocumentsFromCollection({
|
|
@@ -107,7 +110,7 @@ export class DocumentCollections {
|
|
|
107
110
|
}
|
|
108
111
|
__removeDocumentsFromCollection(request, requestOptions) {
|
|
109
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
113
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
111
114
|
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);
|
|
112
115
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
113
116
|
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"),
|
|
@@ -120,6 +123,8 @@ export class DocumentCollections {
|
|
|
120
123
|
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,
|
|
121
124
|
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,
|
|
122
125
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
126
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
127
|
+
logging: this._options.logging,
|
|
123
128
|
});
|
|
124
129
|
if (_response.ok) {
|
|
125
130
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -152,7 +157,7 @@ export class DocumentCollections {
|
|
|
152
157
|
* List documents in a collection
|
|
153
158
|
*
|
|
154
159
|
* @param {Credal.ListDocumentsInCollectionRequest} request
|
|
155
|
-
* @param {
|
|
160
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
156
161
|
*
|
|
157
162
|
* @example
|
|
158
163
|
* await client.documentCollections.listDocumentsInCollection({
|
|
@@ -164,7 +169,7 @@ export class DocumentCollections {
|
|
|
164
169
|
}
|
|
165
170
|
__listDocumentsInCollection(request, requestOptions) {
|
|
166
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
168
173
|
const { collectionId } = request;
|
|
169
174
|
const _queryParams = {};
|
|
170
175
|
_queryParams.collectionId = collectionId;
|
|
@@ -177,6 +182,8 @@ export class DocumentCollections {
|
|
|
177
182
|
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,
|
|
178
183
|
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,
|
|
179
184
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
185
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
186
|
+
logging: this._options.logging,
|
|
180
187
|
});
|
|
181
188
|
if (_response.ok) {
|
|
182
189
|
return {
|
|
@@ -212,7 +219,7 @@ export class DocumentCollections {
|
|
|
212
219
|
* Create a new collection. The API key used will be added to the collection for future Requests
|
|
213
220
|
*
|
|
214
221
|
* @param {Credal.CreateCollectionRequest} request
|
|
215
|
-
* @param {
|
|
222
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
216
223
|
*
|
|
217
224
|
* @example
|
|
218
225
|
* await client.documentCollections.createCollection({
|
|
@@ -229,7 +236,7 @@ export class DocumentCollections {
|
|
|
229
236
|
}
|
|
230
237
|
__createCollection(request, requestOptions) {
|
|
231
238
|
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
233
240
|
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);
|
|
234
241
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
235
242
|
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"),
|
|
@@ -242,6 +249,8 @@ export class DocumentCollections {
|
|
|
242
249
|
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,
|
|
243
250
|
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,
|
|
244
251
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
252
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
253
|
+
logging: this._options.logging,
|
|
245
254
|
});
|
|
246
255
|
if (_response.ok) {
|
|
247
256
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -274,7 +283,7 @@ export class DocumentCollections {
|
|
|
274
283
|
* Delete the collection.
|
|
275
284
|
*
|
|
276
285
|
* @param {Credal.DeleteCollectionRequest} request
|
|
277
|
-
* @param {
|
|
286
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
278
287
|
*
|
|
279
288
|
* @example
|
|
280
289
|
* await client.documentCollections.deleteCollection({
|
|
@@ -286,7 +295,7 @@ export class DocumentCollections {
|
|
|
286
295
|
}
|
|
287
296
|
__deleteCollection(request, requestOptions) {
|
|
288
297
|
return __awaiter(this, void 0, void 0, function* () {
|
|
289
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
298
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
290
299
|
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);
|
|
291
300
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
292
301
|
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"),
|
|
@@ -299,6 +308,8 @@ export class DocumentCollections {
|
|
|
299
308
|
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,
|
|
300
309
|
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,
|
|
301
310
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
311
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
312
|
+
logging: this._options.logging,
|
|
302
313
|
});
|
|
303
314
|
if (_response.ok) {
|
|
304
315
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -331,7 +342,7 @@ export class DocumentCollections {
|
|
|
331
342
|
* Credal lets you easily sync your MongoDB data for use in Collections and Agents. Create a new sync from a MongoDB collection to a Credal collection.
|
|
332
343
|
*
|
|
333
344
|
* @param {Credal.CreateMongoCollectionSyncRequest} request
|
|
334
|
-
* @param {
|
|
345
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
335
346
|
*
|
|
336
347
|
* @example
|
|
337
348
|
* await client.documentCollections.createMongoCollectionSync({
|
|
@@ -359,7 +370,7 @@ export class DocumentCollections {
|
|
|
359
370
|
}
|
|
360
371
|
__createMongoCollectionSync(request, requestOptions) {
|
|
361
372
|
return __awaiter(this, void 0, void 0, function* () {
|
|
362
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
373
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
363
374
|
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);
|
|
364
375
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
365
376
|
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"),
|
|
@@ -372,6 +383,8 @@ export class DocumentCollections {
|
|
|
372
383
|
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,
|
|
373
384
|
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,
|
|
374
385
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
386
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
387
|
+
logging: this._options.logging,
|
|
375
388
|
});
|
|
376
389
|
if (_response.ok) {
|
|
377
390
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -404,7 +417,7 @@ export class DocumentCollections {
|
|
|
404
417
|
* Credal lets you easily sync your MongoDB data for use in Collections and Agents. Update an existing sync from a MongoDB collection to a Credal collection via the `mongoCredentialId`, to disambiguate between multiple potential syncs to a given collection.
|
|
405
418
|
*
|
|
406
419
|
* @param {Credal.UpdateMongoCollectionSyncRequest} request
|
|
407
|
-
* @param {
|
|
420
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
408
421
|
*
|
|
409
422
|
* @example
|
|
410
423
|
* await client.documentCollections.updateMongoCollectionSync({
|
|
@@ -432,7 +445,7 @@ export class DocumentCollections {
|
|
|
432
445
|
}
|
|
433
446
|
__updateMongoCollectionSync(request, requestOptions) {
|
|
434
447
|
return __awaiter(this, void 0, void 0, function* () {
|
|
435
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
448
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
436
449
|
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);
|
|
437
450
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
438
451
|
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"),
|
|
@@ -445,6 +458,8 @@ export class DocumentCollections {
|
|
|
445
458
|
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,
|
|
446
459
|
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,
|
|
447
460
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
461
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
462
|
+
logging: this._options.logging,
|
|
448
463
|
});
|
|
449
464
|
if (_response.ok) {
|
|
450
465
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import type * as Credal from "../../../index.mjs";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace SearchClient {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
10
|
+
export declare class SearchClient {
|
|
11
|
+
protected readonly _options: SearchClient.Options;
|
|
12
|
+
constructor(options?: SearchClient.Options);
|
|
13
13
|
/**
|
|
14
14
|
* Search across all documents in a document collection using the document metadata and contents.
|
|
15
15
|
*
|
|
16
16
|
* @param {Credal.SearchDocumentCollectionRequest} request
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* await client.search.searchDocumentCollection({
|
|
@@ -36,7 +36,7 @@ export declare class Search {
|
|
|
36
36
|
* }
|
|
37
37
|
* })
|
|
38
38
|
*/
|
|
39
|
-
searchDocumentCollection(request: Credal.SearchDocumentCollectionRequest, requestOptions?:
|
|
39
|
+
searchDocumentCollection(request: Credal.SearchDocumentCollectionRequest, requestOptions?: SearchClient.RequestOptions): core.HttpResponsePromise<Credal.SearchDocumentCollectionResponse>;
|
|
40
40
|
private __searchDocumentCollection;
|
|
41
41
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
42
42
|
}
|
|
@@ -8,19 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
import { normalizeClientOptions } from "../../../../BaseClient.mjs";
|
|
11
12
|
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
12
13
|
import * as core from "../../../../core/index.mjs";
|
|
13
14
|
import * as environments from "../../../../environments.mjs";
|
|
14
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
15
|
-
export class
|
|
16
|
-
constructor(
|
|
17
|
-
this._options =
|
|
16
|
+
export class SearchClient {
|
|
17
|
+
constructor(options = {}) {
|
|
18
|
+
this._options = normalizeClientOptions(options);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Search across all documents in a document collection using the document metadata and contents.
|
|
21
22
|
*
|
|
22
23
|
* @param {Credal.SearchDocumentCollectionRequest} request
|
|
23
|
-
* @param {
|
|
24
|
+
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
24
25
|
*
|
|
25
26
|
* @example
|
|
26
27
|
* await client.search.searchDocumentCollection({
|
|
@@ -47,7 +48,7 @@ export class Search {
|
|
|
47
48
|
}
|
|
48
49
|
__searchDocumentCollection(request, requestOptions) {
|
|
49
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
51
52
|
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);
|
|
52
53
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
53
54
|
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"),
|
|
@@ -60,6 +61,8 @@ export class Search {
|
|
|
60
61
|
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,
|
|
61
62
|
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,
|
|
62
63
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
64
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
65
|
+
logging: this._options.logging,
|
|
63
66
|
});
|
|
64
67
|
if (_response.ok) {
|
|
65
68
|
return {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import type * as Credal from "../../../index.mjs";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace UsersClient {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
10
|
+
export declare class UsersClient {
|
|
11
|
+
protected readonly _options: UsersClient.Options;
|
|
12
|
+
constructor(options?: UsersClient.Options);
|
|
13
13
|
/**
|
|
14
14
|
* Bulk patch metadata for users
|
|
15
15
|
*
|
|
16
16
|
* @param {Credal.UserMetadataPatch[]} request
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* await client.users.metadata([{
|
|
@@ -31,7 +31,7 @@ export declare class Users {
|
|
|
31
31
|
* userEmail: "jack@credal.ai"
|
|
32
32
|
* }])
|
|
33
33
|
*/
|
|
34
|
-
metadata(request: Credal.UserMetadataPatch[], requestOptions?:
|
|
34
|
+
metadata(request: Credal.UserMetadataPatch[], requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
35
35
|
private __metadata;
|
|
36
36
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
37
37
|
}
|
|
@@ -8,19 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
import { normalizeClientOptions } from "../../../../BaseClient.mjs";
|
|
11
12
|
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
12
13
|
import * as core from "../../../../core/index.mjs";
|
|
13
14
|
import * as environments from "../../../../environments.mjs";
|
|
14
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
15
|
-
export class
|
|
16
|
-
constructor(
|
|
17
|
-
this._options =
|
|
16
|
+
export class UsersClient {
|
|
17
|
+
constructor(options = {}) {
|
|
18
|
+
this._options = normalizeClientOptions(options);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Bulk patch metadata for users
|
|
21
22
|
*
|
|
22
23
|
* @param {Credal.UserMetadataPatch[]} request
|
|
23
|
-
* @param {
|
|
24
|
+
* @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
24
25
|
*
|
|
25
26
|
* @example
|
|
26
27
|
* await client.users.metadata([{
|
|
@@ -42,7 +43,7 @@ export class Users {
|
|
|
42
43
|
}
|
|
43
44
|
__metadata(request, requestOptions) {
|
|
44
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
46
47
|
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);
|
|
47
48
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
48
49
|
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"),
|
|
@@ -55,6 +56,8 @@ export class Users {
|
|
|
55
56
|
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,
|
|
56
57
|
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,
|
|
57
58
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
59
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
60
|
+
logging: this._options.logging,
|
|
58
61
|
});
|
|
59
62
|
if (_response.ok) {
|
|
60
63
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LogConfig, type Logger } from "../logging/logger.mjs";
|
|
1
2
|
import type { APIResponse } from "./APIResponse.mjs";
|
|
2
3
|
import type { EndpointMetadata } from "./EndpointMetadata.mjs";
|
|
3
4
|
import { EndpointSupplier } from "./EndpointSupplier.mjs";
|
|
@@ -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 {
|