@credal/sdk 0.1.12 → 0.1.14
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 +9 -1
- package/dist/cjs/BaseClient.js +10 -2
- package/dist/cjs/Client.d.ts +2 -1
- package/dist/cjs/Client.js +1 -1
- package/dist/cjs/api/resources/copilots/client/Client.d.ts +22 -2
- package/dist/cjs/api/resources/copilots/client/Client.js +81 -17
- package/dist/cjs/api/resources/copilots/client/requests/ExportCopilotsRequest.d.ts +21 -0
- package/dist/cjs/api/resources/copilots/client/requests/ExportCopilotsRequest.js +3 -0
- package/dist/cjs/api/resources/copilots/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/copilots/types/ExportCopilotsResponse.d.ts +9 -0
- package/dist/cjs/api/resources/copilots/types/ExportCopilotsResponse.js +3 -0
- package/dist/cjs/api/resources/copilots/types/ExportedCopilot.d.ts +24 -0
- package/dist/cjs/api/resources/copilots/types/ExportedCopilot.js +3 -0
- package/dist/cjs/api/resources/copilots/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/copilots/types/index.js +2 -0
- package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/documentCatalog/client/Client.js +9 -17
- package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/documentCollections/client/Client.js +15 -20
- package/dist/cjs/api/resources/search/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/search/client/Client.js +3 -14
- package/dist/cjs/api/resources/users/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/users/client/Client.js +3 -14
- package/dist/cjs/auth/BearerAuthProvider.d.ts +14 -0
- package/dist/cjs/auth/BearerAuthProvider.js +72 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +4 -1
- package/dist/cjs/core/auth/BearerToken.d.ts +3 -1
- package/dist/cjs/core/auth/BearerToken.js +7 -6
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +9 -1
- package/dist/esm/BaseClient.mjs +9 -2
- package/dist/esm/Client.d.mts +2 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/copilots/client/Client.d.mts +22 -2
- package/dist/esm/api/resources/copilots/client/Client.mjs +83 -19
- package/dist/esm/api/resources/copilots/client/requests/ExportCopilotsRequest.d.mts +21 -0
- package/dist/esm/api/resources/copilots/client/requests/ExportCopilotsRequest.mjs +2 -0
- package/dist/esm/api/resources/copilots/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/copilots/types/ExportCopilotsResponse.d.mts +9 -0
- package/dist/esm/api/resources/copilots/types/ExportCopilotsResponse.mjs +2 -0
- package/dist/esm/api/resources/copilots/types/ExportedCopilot.d.mts +24 -0
- package/dist/esm/api/resources/copilots/types/ExportedCopilot.mjs +2 -0
- package/dist/esm/api/resources/copilots/types/index.d.mts +2 -0
- package/dist/esm/api/resources/copilots/types/index.mjs +2 -0
- package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/documentCatalog/client/Client.mjs +10 -18
- package/dist/esm/api/resources/documentCollections/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/documentCollections/client/Client.mjs +17 -22
- package/dist/esm/api/resources/search/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/search/client/Client.mjs +5 -16
- package/dist/esm/api/resources/users/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/users/client/Client.mjs +5 -16
- package/dist/esm/auth/BearerAuthProvider.d.mts +14 -0
- package/dist/esm/auth/BearerAuthProvider.mjs +35 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +4 -1
- package/dist/esm/core/auth/BearerToken.d.mts +3 -1
- package/dist/esm/core/auth/BearerToken.mjs +7 -6
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +72 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ExportedCopilot {
|
|
2
|
+
/** The unique identifier of the copilot. */
|
|
3
|
+
id: string;
|
|
4
|
+
/** The name of the deployed copilot version. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** The description of the deployed copilot version. */
|
|
7
|
+
description: string;
|
|
8
|
+
/** Model configuration including provider, model name, temperature, and other settings. */
|
|
9
|
+
modelConfiguration?: unknown;
|
|
10
|
+
/** AI endpoint configuration including base URL and authentication details. */
|
|
11
|
+
aiEndpointConfiguration?: unknown;
|
|
12
|
+
/** List of tool configurations available to the copilot. */
|
|
13
|
+
toolConfigurations?: unknown;
|
|
14
|
+
/** Input variable configurations for the copilot. */
|
|
15
|
+
inputs?: unknown;
|
|
16
|
+
/** Deployment settings and configuration. */
|
|
17
|
+
deploymentConfiguration?: unknown;
|
|
18
|
+
/** ISO 8601 timestamp when the copilot was originally created. */
|
|
19
|
+
agentCreatedDatetime: string;
|
|
20
|
+
/** ISO 8601 timestamp when the deployed version was created. */
|
|
21
|
+
versionCreatedDatetime: string;
|
|
22
|
+
/** Indicates if the copilot is currently deployed (always true for export results). */
|
|
23
|
+
isDeployed: boolean;
|
|
24
|
+
}
|
|
@@ -12,6 +12,8 @@ export * from "./DeleteCopilotResponse.mjs";
|
|
|
12
12
|
export * from "./EndOfMessageChunk.mjs";
|
|
13
13
|
export * from "./ErrorChunk.mjs";
|
|
14
14
|
export * from "./ErrorChunkData.mjs";
|
|
15
|
+
export * from "./ExportCopilotsResponse.mjs";
|
|
16
|
+
export * from "./ExportedCopilot.mjs";
|
|
15
17
|
export * from "./FeedbackEnum.mjs";
|
|
16
18
|
export * from "./Filter.mjs";
|
|
17
19
|
export * from "./FinalChunk.mjs";
|
|
@@ -12,6 +12,8 @@ export * from "./DeleteCopilotResponse.mjs";
|
|
|
12
12
|
export * from "./EndOfMessageChunk.mjs";
|
|
13
13
|
export * from "./ErrorChunk.mjs";
|
|
14
14
|
export * from "./ErrorChunkData.mjs";
|
|
15
|
+
export * from "./ExportCopilotsResponse.mjs";
|
|
16
|
+
export * from "./ExportedCopilot.mjs";
|
|
15
17
|
export * from "./FeedbackEnum.mjs";
|
|
16
18
|
export * from "./Filter.mjs";
|
|
17
19
|
export * from "./FinalChunk.mjs";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
2
3
|
import * as core from "../../../../core/index.mjs";
|
|
3
4
|
import type * as Credal from "../../../index.mjs";
|
|
4
5
|
export declare namespace DocumentCatalogClient {
|
|
@@ -8,7 +9,7 @@ export declare namespace DocumentCatalogClient {
|
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export declare class DocumentCatalogClient {
|
|
11
|
-
protected readonly _options: DocumentCatalogClient.Options
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<DocumentCatalogClient.Options>;
|
|
12
13
|
constructor(options?: DocumentCatalogClient.Options);
|
|
13
14
|
/**
|
|
14
15
|
* @param {Credal.UploadDocumentContentsRequest} request
|
|
@@ -81,5 +82,4 @@ export declare class DocumentCatalogClient {
|
|
|
81
82
|
*/
|
|
82
83
|
metadata(request: Credal.DocumentMetadataPatchRequest, requestOptions?: DocumentCatalogClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
83
84
|
private __metadata;
|
|
84
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
85
85
|
}
|
|
@@ -8,14 +8,14 @@ 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 {
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
12
|
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
16
16
|
export class DocumentCatalogClient {
|
|
17
17
|
constructor(options = {}) {
|
|
18
|
-
this._options =
|
|
18
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* @param {Credal.UploadDocumentContentsRequest} request
|
|
@@ -36,7 +36,8 @@ export class DocumentCatalogClient {
|
|
|
36
36
|
__uploadDocumentContents(request, requestOptions) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
38
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
39
|
-
const
|
|
39
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
40
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
40
41
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
41
42
|
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"),
|
|
42
43
|
method: "POST",
|
|
@@ -122,7 +123,8 @@ export class DocumentCatalogClient {
|
|
|
122
123
|
_request.append("awaitVectorStoreSync", request.awaitVectorStoreSync);
|
|
123
124
|
}
|
|
124
125
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
125
|
-
const
|
|
126
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
127
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
126
128
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
127
129
|
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"),
|
|
128
130
|
method: "POST",
|
|
@@ -182,7 +184,8 @@ export class DocumentCatalogClient {
|
|
|
182
184
|
__syncSourceByUrl(request, requestOptions) {
|
|
183
185
|
return __awaiter(this, void 0, void 0, function* () {
|
|
184
186
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
185
|
-
const
|
|
187
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
188
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
186
189
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
187
190
|
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"),
|
|
188
191
|
method: "POST",
|
|
@@ -262,7 +265,8 @@ export class DocumentCatalogClient {
|
|
|
262
265
|
__metadata(request, requestOptions) {
|
|
263
266
|
return __awaiter(this, void 0, void 0, function* () {
|
|
264
267
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
265
|
-
const
|
|
268
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
269
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
266
270
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
267
271
|
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"),
|
|
268
272
|
method: "PATCH",
|
|
@@ -304,16 +308,4 @@ export class DocumentCatalogClient {
|
|
|
304
308
|
}
|
|
305
309
|
});
|
|
306
310
|
}
|
|
307
|
-
_getAuthorizationHeader() {
|
|
308
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
309
|
-
var _a;
|
|
310
|
-
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env.CREDAL_API_KEY;
|
|
311
|
-
if (bearer == null) {
|
|
312
|
-
throw new errors.CredalError({
|
|
313
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
return `Bearer ${bearer}`;
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
311
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
2
3
|
import * as core from "../../../../core/index.mjs";
|
|
3
4
|
import type * as Credal from "../../../index.mjs";
|
|
4
5
|
export declare namespace DocumentCollectionsClient {
|
|
@@ -8,7 +9,7 @@ export declare namespace DocumentCollectionsClient {
|
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export declare class DocumentCollectionsClient {
|
|
11
|
-
protected readonly _options: DocumentCollectionsClient.Options
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<DocumentCollectionsClient.Options>;
|
|
12
13
|
constructor(options?: DocumentCollectionsClient.Options);
|
|
13
14
|
/**
|
|
14
15
|
* 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.
|
|
@@ -156,5 +157,4 @@ export declare class DocumentCollectionsClient {
|
|
|
156
157
|
*/
|
|
157
158
|
updateMongoCollectionSync(request: Credal.UpdateMongoCollectionSyncRequest, requestOptions?: DocumentCollectionsClient.RequestOptions): core.HttpResponsePromise<Credal.MongoCollectionSyncResponse>;
|
|
158
159
|
private __updateMongoCollectionSync;
|
|
159
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
160
160
|
}
|
|
@@ -8,14 +8,14 @@ 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 {
|
|
12
|
-
import { mergeHeaders
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
16
16
|
export class DocumentCollectionsClient {
|
|
17
17
|
constructor(options = {}) {
|
|
18
|
-
this._options =
|
|
18
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
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.
|
|
@@ -43,7 +43,8 @@ export class DocumentCollectionsClient {
|
|
|
43
43
|
__addDocumentsToCollection(request, requestOptions) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
46
|
-
const
|
|
46
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
47
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, 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/documentCollections/addDocumentsToCollection"),
|
|
49
50
|
method: "POST",
|
|
@@ -111,7 +112,8 @@ export class DocumentCollectionsClient {
|
|
|
111
112
|
__removeDocumentsFromCollection(request, requestOptions) {
|
|
112
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
114
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
114
|
-
const
|
|
115
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
116
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
115
117
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
116
118
|
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"),
|
|
117
119
|
method: "DELETE",
|
|
@@ -173,7 +175,8 @@ export class DocumentCollectionsClient {
|
|
|
173
175
|
const { collectionId } = request;
|
|
174
176
|
const _queryParams = {};
|
|
175
177
|
_queryParams.collectionId = collectionId;
|
|
176
|
-
const
|
|
178
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
179
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
177
180
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
178
181
|
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/listDocumentsInCollection"),
|
|
179
182
|
method: "GET",
|
|
@@ -237,7 +240,8 @@ export class DocumentCollectionsClient {
|
|
|
237
240
|
__createCollection(request, requestOptions) {
|
|
238
241
|
return __awaiter(this, void 0, void 0, function* () {
|
|
239
242
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
240
|
-
const
|
|
243
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
244
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
241
245
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
242
246
|
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"),
|
|
243
247
|
method: "POST",
|
|
@@ -296,7 +300,8 @@ export class DocumentCollectionsClient {
|
|
|
296
300
|
__deleteCollection(request, requestOptions) {
|
|
297
301
|
return __awaiter(this, void 0, void 0, function* () {
|
|
298
302
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
299
|
-
const
|
|
303
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
304
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
300
305
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
301
306
|
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"),
|
|
302
307
|
method: "DELETE",
|
|
@@ -371,7 +376,8 @@ export class DocumentCollectionsClient {
|
|
|
371
376
|
__createMongoCollectionSync(request, requestOptions) {
|
|
372
377
|
return __awaiter(this, void 0, void 0, function* () {
|
|
373
378
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
374
|
-
const
|
|
379
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
380
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
375
381
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
376
382
|
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"),
|
|
377
383
|
method: "POST",
|
|
@@ -446,7 +452,8 @@ export class DocumentCollectionsClient {
|
|
|
446
452
|
__updateMongoCollectionSync(request, requestOptions) {
|
|
447
453
|
return __awaiter(this, void 0, void 0, function* () {
|
|
448
454
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
449
|
-
const
|
|
455
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
456
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
450
457
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
451
458
|
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"),
|
|
452
459
|
method: "POST",
|
|
@@ -488,16 +495,4 @@ export class DocumentCollectionsClient {
|
|
|
488
495
|
}
|
|
489
496
|
});
|
|
490
497
|
}
|
|
491
|
-
_getAuthorizationHeader() {
|
|
492
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
493
|
-
var _a;
|
|
494
|
-
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env.CREDAL_API_KEY;
|
|
495
|
-
if (bearer == null) {
|
|
496
|
-
throw new errors.CredalError({
|
|
497
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
return `Bearer ${bearer}`;
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
498
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
2
3
|
import * as core from "../../../../core/index.mjs";
|
|
3
4
|
import type * as Credal from "../../../index.mjs";
|
|
4
5
|
export declare namespace SearchClient {
|
|
@@ -8,7 +9,7 @@ export declare namespace SearchClient {
|
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export declare class SearchClient {
|
|
11
|
-
protected readonly _options: SearchClient.Options
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<SearchClient.Options>;
|
|
12
13
|
constructor(options?: SearchClient.Options);
|
|
13
14
|
/**
|
|
14
15
|
* Search across all documents in a document collection using the document metadata and contents.
|
|
@@ -38,5 +39,4 @@ export declare class SearchClient {
|
|
|
38
39
|
*/
|
|
39
40
|
searchDocumentCollection(request: Credal.SearchDocumentCollectionRequest, requestOptions?: SearchClient.RequestOptions): core.HttpResponsePromise<Credal.SearchDocumentCollectionResponse>;
|
|
40
41
|
private __searchDocumentCollection;
|
|
41
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
42
42
|
}
|
|
@@ -8,14 +8,14 @@ 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 {
|
|
12
|
-
import { mergeHeaders
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
16
16
|
export class SearchClient {
|
|
17
17
|
constructor(options = {}) {
|
|
18
|
-
this._options =
|
|
18
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Search across all documents in a document collection using the document metadata and contents.
|
|
@@ -49,7 +49,8 @@ export class SearchClient {
|
|
|
49
49
|
__searchDocumentCollection(request, requestOptions) {
|
|
50
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
51
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
52
|
-
const
|
|
52
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
53
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
53
54
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
54
55
|
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"),
|
|
55
56
|
method: "POST",
|
|
@@ -94,16 +95,4 @@ export class SearchClient {
|
|
|
94
95
|
}
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
_getAuthorizationHeader() {
|
|
98
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
var _a;
|
|
100
|
-
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env.CREDAL_API_KEY;
|
|
101
|
-
if (bearer == null) {
|
|
102
|
-
throw new errors.CredalError({
|
|
103
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return `Bearer ${bearer}`;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
98
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
2
3
|
import * as core from "../../../../core/index.mjs";
|
|
3
4
|
import type * as Credal from "../../../index.mjs";
|
|
4
5
|
export declare namespace UsersClient {
|
|
@@ -8,7 +9,7 @@ export declare namespace UsersClient {
|
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export declare class UsersClient {
|
|
11
|
-
protected readonly _options: UsersClient.Options
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<UsersClient.Options>;
|
|
12
13
|
constructor(options?: UsersClient.Options);
|
|
13
14
|
/**
|
|
14
15
|
* Bulk patch metadata for users
|
|
@@ -33,5 +34,4 @@ export declare class UsersClient {
|
|
|
33
34
|
*/
|
|
34
35
|
metadata(request: Credal.UserMetadataPatch[], requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
35
36
|
private __metadata;
|
|
36
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
37
37
|
}
|
|
@@ -8,14 +8,14 @@ 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 {
|
|
12
|
-
import { mergeHeaders
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
16
16
|
export class UsersClient {
|
|
17
17
|
constructor(options = {}) {
|
|
18
|
-
this._options =
|
|
18
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Bulk patch metadata for users
|
|
@@ -44,7 +44,8 @@ export class UsersClient {
|
|
|
44
44
|
__metadata(request, requestOptions) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
47
|
-
const
|
|
47
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
48
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
48
49
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
49
50
|
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"),
|
|
50
51
|
method: "PATCH",
|
|
@@ -86,16 +87,4 @@ export class UsersClient {
|
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
_getAuthorizationHeader() {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
var _a;
|
|
92
|
-
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env.CREDAL_API_KEY;
|
|
93
|
-
if (bearer == null) {
|
|
94
|
-
throw new errors.CredalError({
|
|
95
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return `Bearer ${bearer}`;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
90
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as core from "../core/index.mjs";
|
|
2
|
+
export declare namespace BearerAuthProvider {
|
|
3
|
+
interface Options {
|
|
4
|
+
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export declare class BearerAuthProvider implements core.AuthProvider {
|
|
8
|
+
private readonly token;
|
|
9
|
+
constructor(options: BearerAuthProvider.Options);
|
|
10
|
+
static canCreate(options: BearerAuthProvider.Options): boolean;
|
|
11
|
+
getAuthRequest(_arg?: {
|
|
12
|
+
endpointMetadata?: core.EndpointMetadata;
|
|
13
|
+
}): Promise<core.AuthRequest>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import * as core from "../core/index.mjs";
|
|
12
|
+
import * as errors from "../errors/index.mjs";
|
|
13
|
+
export class BearerAuthProvider {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.token = options.apiKey;
|
|
16
|
+
}
|
|
17
|
+
static canCreate(options) {
|
|
18
|
+
var _a;
|
|
19
|
+
return options.apiKey != null || ((_a = process.env) === null || _a === void 0 ? void 0 : _a.CREDAL_API_KEY) != null;
|
|
20
|
+
}
|
|
21
|
+
getAuthRequest(_arg) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const apiKey = (_a = (yield core.Supplier.get(this.token))) !== null && _a !== void 0 ? _a : (_b = process.env) === null || _b === void 0 ? void 0 : _b.CREDAL_API_KEY;
|
|
25
|
+
if (apiKey == null) {
|
|
26
|
+
throw new errors.CredalError({
|
|
27
|
+
message: "Please specify a apiKey by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BearerAuthProvider } from "./BearerAuthProvider.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BearerAuthProvider } from "./BearerAuthProvider.mjs";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { EndpointMetadata } from "../fetcher/EndpointMetadata.mjs";
|
|
1
2
|
import type { AuthRequest } from "./AuthRequest.mjs";
|
|
2
3
|
export interface AuthProvider {
|
|
3
|
-
getAuthRequest(
|
|
4
|
+
getAuthRequest(arg?: {
|
|
5
|
+
endpointMetadata?: EndpointMetadata;
|
|
6
|
+
}): Promise<AuthRequest>;
|
|
4
7
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type BearerToken = string;
|
|
2
|
+
declare function toAuthorizationHeader(token: string | undefined): string | undefined;
|
|
2
3
|
export declare const BearerToken: {
|
|
3
|
-
toAuthorizationHeader:
|
|
4
|
+
toAuthorizationHeader: typeof toAuthorizationHeader;
|
|
4
5
|
fromAuthorizationHeader: (header: string) => BearerToken;
|
|
5
6
|
};
|
|
7
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
|
|
2
|
+
function toAuthorizationHeader(token) {
|
|
3
|
+
if (token == null) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
return `Bearer ${token}`;
|
|
7
|
+
}
|
|
2
8
|
export const BearerToken = {
|
|
3
|
-
toAuthorizationHeader:
|
|
4
|
-
if (token == null) {
|
|
5
|
-
return undefined;
|
|
6
|
-
}
|
|
7
|
-
return `Bearer ${token}`;
|
|
8
|
-
},
|
|
9
|
+
toAuthorizationHeader: toAuthorizationHeader,
|
|
9
10
|
fromAuthorizationHeader: (header) => {
|
|
10
11
|
return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
|
|
11
12
|
},
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.14";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.
|
|
1
|
+
export const SDK_VERSION = "0.1.14";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -584,6 +584,78 @@ await client.copilots.deleteCopilot({
|
|
|
584
584
|
</dl>
|
|
585
585
|
|
|
586
586
|
|
|
587
|
+
</dd>
|
|
588
|
+
</dl>
|
|
589
|
+
</details>
|
|
590
|
+
|
|
591
|
+
<details><summary><code>client.copilots.<a href="/src/api/resources/copilots/client/Client.ts">export</a>({ ...params }) -> Credal.ExportCopilotsResponse</code></summary>
|
|
592
|
+
<dl>
|
|
593
|
+
<dd>
|
|
594
|
+
|
|
595
|
+
#### 📝 Description
|
|
596
|
+
|
|
597
|
+
<dl>
|
|
598
|
+
<dd>
|
|
599
|
+
|
|
600
|
+
<dl>
|
|
601
|
+
<dd>
|
|
602
|
+
|
|
603
|
+
Export copilot configurations for backup or migration purposes.
|
|
604
|
+
|
|
605
|
+
**IMPORTANT**: This endpoint requires:
|
|
606
|
+
- Admin privileges
|
|
607
|
+
- The 'ai-usage-analytics-log.export' scope on the API key
|
|
608
|
+
|
|
609
|
+
Returns all deployed copilots with their full configuration including model settings, tools, and deployment details. Optional date filters can be applied to narrow down results.
|
|
610
|
+
</dd>
|
|
611
|
+
</dl>
|
|
612
|
+
</dd>
|
|
613
|
+
</dl>
|
|
614
|
+
|
|
615
|
+
#### 🔌 Usage
|
|
616
|
+
|
|
617
|
+
<dl>
|
|
618
|
+
<dd>
|
|
619
|
+
|
|
620
|
+
<dl>
|
|
621
|
+
<dd>
|
|
622
|
+
|
|
623
|
+
```typescript
|
|
624
|
+
await client.copilots.export({
|
|
625
|
+
agentCreatedFrom: "2024-01-01T00:00:00Z",
|
|
626
|
+
agentCreatedTo: "2024-12-31T23:59:59Z"
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
```
|
|
630
|
+
</dd>
|
|
631
|
+
</dl>
|
|
632
|
+
</dd>
|
|
633
|
+
</dl>
|
|
634
|
+
|
|
635
|
+
#### ⚙️ Parameters
|
|
636
|
+
|
|
637
|
+
<dl>
|
|
638
|
+
<dd>
|
|
639
|
+
|
|
640
|
+
<dl>
|
|
641
|
+
<dd>
|
|
642
|
+
|
|
643
|
+
**request:** `Credal.ExportCopilotsRequest`
|
|
644
|
+
|
|
645
|
+
</dd>
|
|
646
|
+
</dl>
|
|
647
|
+
|
|
648
|
+
<dl>
|
|
649
|
+
<dd>
|
|
650
|
+
|
|
651
|
+
**requestOptions:** `CopilotsClient.RequestOptions`
|
|
652
|
+
|
|
653
|
+
</dd>
|
|
654
|
+
</dl>
|
|
655
|
+
</dd>
|
|
656
|
+
</dl>
|
|
657
|
+
|
|
658
|
+
|
|
587
659
|
</dd>
|
|
588
660
|
</dl>
|
|
589
661
|
</details>
|