@credal/sdk 0.1.3 → 0.1.6
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/Client.d.ts +2 -5
- package/dist/cjs/Client.js +6 -11
- package/dist/cjs/api/resources/{permissionsService/types/Group.d.ts → common/types/CustomMetadataValue.d.ts} +1 -4
- package/dist/cjs/api/resources/common/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/common/types/index.js +1 -0
- package/dist/cjs/api/resources/copilots/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/copilots/client/Client.js +9 -9
- package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/documentCatalog/client/Client.js +3 -3
- package/dist/cjs/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.ts +5 -2
- package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/documentCollections/client/Client.js +7 -7
- package/dist/cjs/api/resources/index.d.ts +0 -3
- package/dist/cjs/api/resources/index.js +1 -4
- package/dist/cjs/api/resources/search/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/search/client/Client.js +1 -1
- package/dist/cjs/api/resources/users/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/users/client/Client.js +1 -1
- package/dist/cjs/core/auth/index.d.ts +2 -2
- package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -1
- package/dist/cjs/core/fetcher/Fetcher.js +2 -2
- package/dist/cjs/core/fetcher/index.d.ts +5 -5
- package/dist/cjs/core/fetcher/index.js +5 -5
- package/dist/cjs/core/fetcher/requestWithRetries.js +34 -2
- package/dist/cjs/core/headers.d.ts +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +2 -5
- package/dist/esm/Client.mjs +2 -7
- package/dist/esm/api/resources/{permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.mjs → common/types/CustomMetadataValue.d.mts} +1 -1
- package/dist/esm/api/resources/common/types/index.d.mts +1 -0
- package/dist/esm/api/resources/common/types/index.mjs +1 -0
- package/dist/esm/api/resources/copilots/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/copilots/client/Client.mjs +9 -9
- package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/documentCatalog/client/Client.mjs +3 -3
- package/dist/esm/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.mts +5 -2
- package/dist/esm/api/resources/documentCollections/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/documentCollections/client/Client.mjs +7 -7
- package/dist/esm/api/resources/index.d.mts +0 -3
- package/dist/esm/api/resources/index.mjs +0 -3
- package/dist/esm/api/resources/search/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/search/client/Client.mjs +1 -1
- package/dist/esm/api/resources/users/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/users/client/Client.mjs +1 -1
- package/dist/esm/core/auth/index.d.mts +2 -2
- package/dist/esm/core/fetcher/Fetcher.d.mts +1 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +2 -2
- package/dist/esm/core/fetcher/index.d.mts +5 -5
- package/dist/esm/core/fetcher/index.mjs +2 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +34 -2
- package/dist/esm/core/headers.d.mts +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +0 -213
- package/dist/cjs/api/resources/permissionsService/client/Client.d.ts +0 -86
- package/dist/cjs/api/resources/permissionsService/client/Client.js +0 -260
- package/dist/cjs/api/resources/permissionsService/client/index.d.ts +0 -2
- package/dist/cjs/api/resources/permissionsService/client/index.js +0 -17
- package/dist/cjs/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +0 -26
- package/dist/cjs/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +0 -23
- package/dist/cjs/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.js +0 -5
- package/dist/cjs/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.ts +0 -20
- package/dist/cjs/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.js +0 -5
- package/dist/cjs/api/resources/permissionsService/client/requests/index.d.ts +0 -3
- package/dist/cjs/api/resources/permissionsService/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/permissionsService/index.d.ts +0 -2
- package/dist/cjs/api/resources/permissionsService/index.js +0 -18
- package/dist/cjs/api/resources/permissionsService/types/Action.d.ts +0 -7
- package/dist/cjs/api/resources/permissionsService/types/Action.js +0 -9
- package/dist/cjs/api/resources/permissionsService/types/AuthorizedResource.d.ts +0 -8
- package/dist/cjs/api/resources/permissionsService/types/AuthorizedResource.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/AuthorizedResourceListPage.d.ts +0 -5
- package/dist/cjs/api/resources/permissionsService/types/AuthorizedResourceListPage.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.ts +0 -5
- package/dist/cjs/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.d.ts +0 -6
- package/dist/cjs/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/Group.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/Principal.d.ts +0 -13
- package/dist/cjs/api/resources/permissionsService/types/Principal.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/PrincipalListPage.d.ts +0 -8
- package/dist/cjs/api/resources/permissionsService/types/PrincipalListPage.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/ResourceAuthorizationResult.d.ts +0 -9
- package/dist/cjs/api/resources/permissionsService/types/ResourceAuthorizationResult.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/User.d.ts +0 -8
- package/dist/cjs/api/resources/permissionsService/types/User.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/index.d.ts +0 -10
- package/dist/cjs/api/resources/permissionsService/types/index.js +0 -26
- package/dist/esm/api/resources/permissionsService/client/Client.d.mts +0 -86
- package/dist/esm/api/resources/permissionsService/client/Client.mjs +0 -223
- package/dist/esm/api/resources/permissionsService/client/index.d.mts +0 -2
- package/dist/esm/api/resources/permissionsService/client/index.mjs +0 -1
- package/dist/esm/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.mts +0 -26
- package/dist/esm/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.mts +0 -23
- package/dist/esm/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.mts +0 -20
- package/dist/esm/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/client/requests/index.d.mts +0 -3
- package/dist/esm/api/resources/permissionsService/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/permissionsService/index.d.mts +0 -2
- package/dist/esm/api/resources/permissionsService/index.mjs +0 -2
- package/dist/esm/api/resources/permissionsService/types/Action.d.mts +0 -7
- package/dist/esm/api/resources/permissionsService/types/Action.mjs +0 -6
- package/dist/esm/api/resources/permissionsService/types/AuthorizedResource.d.mts +0 -8
- package/dist/esm/api/resources/permissionsService/types/AuthorizedResource.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/AuthorizedResourceListPage.d.mts +0 -5
- package/dist/esm/api/resources/permissionsService/types/AuthorizedResourceListPage.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.mts +0 -5
- package/dist/esm/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.d.mts +0 -6
- package/dist/esm/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/Group.d.mts +0 -7
- package/dist/esm/api/resources/permissionsService/types/Group.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/Principal.d.mts +0 -13
- package/dist/esm/api/resources/permissionsService/types/Principal.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/PrincipalListPage.d.mts +0 -8
- package/dist/esm/api/resources/permissionsService/types/PrincipalListPage.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/ResourceAuthorizationResult.d.mts +0 -9
- package/dist/esm/api/resources/permissionsService/types/ResourceAuthorizationResult.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/User.d.mts +0 -8
- package/dist/esm/api/resources/permissionsService/types/User.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/index.d.mts +0 -10
- package/dist/esm/api/resources/permissionsService/types/index.mjs +0 -10
- /package/dist/cjs/api/resources/{permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.js → common/types/CustomMetadataValue.js} +0 -0
- /package/dist/esm/api/resources/{permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.mjs → common/types/CustomMetadataValue.mjs} +0 -0
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.6";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.d.mts
CHANGED
|
@@ -6,7 +6,6 @@ import * as core from "./core/index.mjs";
|
|
|
6
6
|
import { Copilots } from "./api/resources/copilots/client/Client.mjs";
|
|
7
7
|
import { DocumentCatalog } from "./api/resources/documentCatalog/client/Client.mjs";
|
|
8
8
|
import { DocumentCollections } from "./api/resources/documentCollections/client/Client.mjs";
|
|
9
|
-
import { PermissionsService } from "./api/resources/permissionsService/client/Client.mjs";
|
|
10
9
|
import { Search } from "./api/resources/search/client/Client.mjs";
|
|
11
10
|
import { Users } from "./api/resources/users/client/Client.mjs";
|
|
12
11
|
export declare namespace CredalClient {
|
|
@@ -16,7 +15,7 @@ export declare namespace CredalClient {
|
|
|
16
15
|
baseUrl?: core.Supplier<string>;
|
|
17
16
|
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
18
17
|
/** Additional headers to include in requests. */
|
|
19
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
18
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
20
19
|
fetcher?: core.FetchFunction;
|
|
21
20
|
}
|
|
22
21
|
interface RequestOptions {
|
|
@@ -29,7 +28,7 @@ export declare namespace CredalClient {
|
|
|
29
28
|
/** Additional query string parameters to include in the request. */
|
|
30
29
|
queryParams?: Record<string, unknown>;
|
|
31
30
|
/** Additional headers to include in the request. */
|
|
32
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
31
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
export declare class CredalClient {
|
|
@@ -37,14 +36,12 @@ export declare class CredalClient {
|
|
|
37
36
|
protected _copilots: Copilots | undefined;
|
|
38
37
|
protected _documentCatalog: DocumentCatalog | undefined;
|
|
39
38
|
protected _documentCollections: DocumentCollections | undefined;
|
|
40
|
-
protected _permissionsService: PermissionsService | undefined;
|
|
41
39
|
protected _search: Search | undefined;
|
|
42
40
|
protected _users: Users | undefined;
|
|
43
41
|
constructor(_options?: CredalClient.Options);
|
|
44
42
|
get copilots(): Copilots;
|
|
45
43
|
get documentCatalog(): DocumentCatalog;
|
|
46
44
|
get documentCollections(): DocumentCollections;
|
|
47
|
-
get permissionsService(): PermissionsService;
|
|
48
45
|
get search(): Search;
|
|
49
46
|
get users(): Users;
|
|
50
47
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -6,7 +6,6 @@ import { mergeHeaders } from "./core/headers.mjs";
|
|
|
6
6
|
import { Copilots } from "./api/resources/copilots/client/Client.mjs";
|
|
7
7
|
import { DocumentCatalog } from "./api/resources/documentCatalog/client/Client.mjs";
|
|
8
8
|
import { DocumentCollections } from "./api/resources/documentCollections/client/Client.mjs";
|
|
9
|
-
import { PermissionsService } from "./api/resources/permissionsService/client/Client.mjs";
|
|
10
9
|
import { Search } from "./api/resources/search/client/Client.mjs";
|
|
11
10
|
import { Users } from "./api/resources/users/client/Client.mjs";
|
|
12
11
|
export class CredalClient {
|
|
@@ -14,8 +13,8 @@ export class CredalClient {
|
|
|
14
13
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
15
14
|
"X-Fern-Language": "JavaScript",
|
|
16
15
|
"X-Fern-SDK-Name": "@credal/sdk",
|
|
17
|
-
"X-Fern-SDK-Version": "0.1.
|
|
18
|
-
"User-Agent": "@credal/sdk/0.1.
|
|
16
|
+
"X-Fern-SDK-Version": "0.1.6",
|
|
17
|
+
"User-Agent": "@credal/sdk/0.1.6",
|
|
19
18
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
20
19
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
21
20
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -32,10 +31,6 @@ export class CredalClient {
|
|
|
32
31
|
var _a;
|
|
33
32
|
return ((_a = this._documentCollections) !== null && _a !== void 0 ? _a : (this._documentCollections = new DocumentCollections(this._options)));
|
|
34
33
|
}
|
|
35
|
-
get permissionsService() {
|
|
36
|
-
var _a;
|
|
37
|
-
return ((_a = this._permissionsService) !== null && _a !== void 0 ? _a : (this._permissionsService = new PermissionsService(this._options)));
|
|
38
|
-
}
|
|
39
34
|
get search() {
|
|
40
35
|
var _a;
|
|
41
36
|
return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Search(this._options)));
|
|
@@ -11,7 +11,7 @@ export declare namespace Copilots {
|
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
12
|
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
15
|
fetcher?: core.FetchFunction;
|
|
16
16
|
}
|
|
17
17
|
interface RequestOptions {
|
|
@@ -24,7 +24,7 @@ export declare namespace Copilots {
|
|
|
24
24
|
/** Additional query string parameters to include in the request. */
|
|
25
25
|
queryParams?: Record<string, unknown>;
|
|
26
26
|
/** Additional headers to include in the request. */
|
|
27
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
27
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
export declare class Copilots {
|
|
@@ -40,7 +40,7 @@ export class Copilots {
|
|
|
40
40
|
__createCopilot(request, requestOptions) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
var _a, _b, _c, _d;
|
|
43
|
-
|
|
43
|
+
let _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);
|
|
44
44
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
45
45
|
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"),
|
|
46
46
|
method: "POST",
|
|
@@ -98,7 +98,7 @@ export class Copilots {
|
|
|
98
98
|
__createConversation(request, requestOptions) {
|
|
99
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
100
|
var _a, _b, _c, _d;
|
|
101
|
-
|
|
101
|
+
let _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);
|
|
102
102
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
103
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"),
|
|
104
104
|
method: "POST",
|
|
@@ -160,7 +160,7 @@ export class Copilots {
|
|
|
160
160
|
__provideMessageFeedback(request, requestOptions) {
|
|
161
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
162
|
var _a, _b, _c, _d;
|
|
163
|
-
|
|
163
|
+
let _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);
|
|
164
164
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
165
165
|
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"),
|
|
166
166
|
method: "POST",
|
|
@@ -224,7 +224,7 @@ export class Copilots {
|
|
|
224
224
|
__sendMessage(request, requestOptions) {
|
|
225
225
|
return __awaiter(this, void 0, void 0, function* () {
|
|
226
226
|
var _a, _b, _c, _d;
|
|
227
|
-
|
|
227
|
+
let _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);
|
|
228
228
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
229
229
|
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"),
|
|
230
230
|
method: "POST",
|
|
@@ -273,7 +273,7 @@ export class Copilots {
|
|
|
273
273
|
__streamMessage(request, requestOptions) {
|
|
274
274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
275
275
|
var _a, _b, _c, _d;
|
|
276
|
-
|
|
276
|
+
let _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);
|
|
277
277
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
278
278
|
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"),
|
|
279
279
|
method: "POST",
|
|
@@ -343,7 +343,7 @@ export class Copilots {
|
|
|
343
343
|
__addCollectionToCopilot(request, requestOptions) {
|
|
344
344
|
return __awaiter(this, void 0, void 0, function* () {
|
|
345
345
|
var _a, _b, _c, _d;
|
|
346
|
-
|
|
346
|
+
let _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);
|
|
347
347
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
348
348
|
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"),
|
|
349
349
|
method: "POST",
|
|
@@ -401,7 +401,7 @@ export class Copilots {
|
|
|
401
401
|
__removeCollectionFromCopilot(request, requestOptions) {
|
|
402
402
|
return __awaiter(this, void 0, void 0, function* () {
|
|
403
403
|
var _a, _b, _c, _d;
|
|
404
|
-
|
|
404
|
+
let _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);
|
|
405
405
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
406
406
|
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"),
|
|
407
407
|
method: "POST",
|
|
@@ -467,7 +467,7 @@ export class Copilots {
|
|
|
467
467
|
__updateConfiguration(request, requestOptions) {
|
|
468
468
|
return __awaiter(this, void 0, void 0, function* () {
|
|
469
469
|
var _a, _b, _c, _d;
|
|
470
|
-
|
|
470
|
+
let _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);
|
|
471
471
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
472
472
|
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"),
|
|
473
473
|
method: "POST",
|
|
@@ -522,7 +522,7 @@ export class Copilots {
|
|
|
522
522
|
__deleteCopilot(request, requestOptions) {
|
|
523
523
|
return __awaiter(this, void 0, void 0, function* () {
|
|
524
524
|
var _a, _b, _c, _d;
|
|
525
|
-
|
|
525
|
+
let _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);
|
|
526
526
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
527
527
|
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"),
|
|
528
528
|
method: "DELETE",
|
|
@@ -11,7 +11,7 @@ export declare namespace DocumentCatalog {
|
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
12
|
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
15
|
fetcher?: core.FetchFunction;
|
|
16
16
|
}
|
|
17
17
|
interface RequestOptions {
|
|
@@ -24,7 +24,7 @@ export declare namespace DocumentCatalog {
|
|
|
24
24
|
/** Additional query string parameters to include in the request. */
|
|
25
25
|
queryParams?: Record<string, unknown>;
|
|
26
26
|
/** Additional headers to include in the request. */
|
|
27
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
27
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
export declare class DocumentCatalog {
|
|
@@ -37,7 +37,7 @@ export class DocumentCatalog {
|
|
|
37
37
|
__uploadDocumentContents(request, requestOptions) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
39
|
var _a, _b, _c, _d;
|
|
40
|
-
|
|
40
|
+
let _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);
|
|
41
41
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
42
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"),
|
|
43
43
|
method: "POST",
|
|
@@ -95,7 +95,7 @@ export class DocumentCatalog {
|
|
|
95
95
|
__syncSourceByUrl(request, requestOptions) {
|
|
96
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
97
|
var _a, _b, _c, _d;
|
|
98
|
-
|
|
98
|
+
let _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);
|
|
99
99
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
100
100
|
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"),
|
|
101
101
|
method: "POST",
|
|
@@ -173,7 +173,7 @@ export class DocumentCatalog {
|
|
|
173
173
|
__metadata(request, requestOptions) {
|
|
174
174
|
return __awaiter(this, void 0, void 0, function* () {
|
|
175
175
|
var _a, _b, _c, _d;
|
|
176
|
-
|
|
176
|
+
let _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);
|
|
177
177
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
178
178
|
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"),
|
|
179
179
|
method: "PATCH",
|
package/dist/esm/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as Credal from "../../../../index.mjs";
|
|
4
5
|
/**
|
|
5
6
|
* @example
|
|
6
7
|
* {
|
|
@@ -25,11 +26,13 @@ export interface UploadDocumentContentsRequest {
|
|
|
25
26
|
/** The external URL of the document you want to upload. If provided Credal will link to this URL. */
|
|
26
27
|
documentExternalUrl?: string;
|
|
27
28
|
/** Optional JSON representing any custom metadata for this document */
|
|
28
|
-
customMetadata?: Record<string,
|
|
29
|
-
/** If specified, document will also be added to
|
|
29
|
+
customMetadata?: Record<string, Credal.CustomMetadataValue>;
|
|
30
|
+
/** 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. */
|
|
30
31
|
collectionId?: string;
|
|
31
32
|
/** If specified, document contents will be re-uploaded and re-embedded even if the document already exists in Credal */
|
|
32
33
|
forceUpdate?: boolean;
|
|
33
34
|
/** If specified, document will be accessible to everyone within the organization of the uploader */
|
|
34
35
|
internalPublic?: boolean;
|
|
36
|
+
/** Document uploads are eventually consistent by default. If specified `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. */
|
|
37
|
+
awaitVectorStoreSync?: boolean;
|
|
35
38
|
}
|
|
@@ -11,7 +11,7 @@ export declare namespace DocumentCollections {
|
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
12
|
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
15
|
fetcher?: core.FetchFunction;
|
|
16
16
|
}
|
|
17
17
|
interface RequestOptions {
|
|
@@ -24,7 +24,7 @@ export declare namespace DocumentCollections {
|
|
|
24
24
|
/** Additional query string parameters to include in the request. */
|
|
25
25
|
queryParams?: Record<string, unknown>;
|
|
26
26
|
/** Additional headers to include in the request. */
|
|
27
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
27
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
export declare class DocumentCollections {
|
|
@@ -44,7 +44,7 @@ export class DocumentCollections {
|
|
|
44
44
|
__addDocumentsToCollection(request, requestOptions) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
var _a, _b, _c, _d;
|
|
47
|
-
|
|
47
|
+
let _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);
|
|
48
48
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
49
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"),
|
|
50
50
|
method: "POST",
|
|
@@ -110,7 +110,7 @@ export class DocumentCollections {
|
|
|
110
110
|
__removeDocumentsFromCollection(request, requestOptions) {
|
|
111
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
112
|
var _a, _b, _c, _d;
|
|
113
|
-
|
|
113
|
+
let _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);
|
|
114
114
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
115
115
|
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"),
|
|
116
116
|
method: "DELETE",
|
|
@@ -170,7 +170,7 @@ export class DocumentCollections {
|
|
|
170
170
|
const { collectionId } = request;
|
|
171
171
|
const _queryParams = {};
|
|
172
172
|
_queryParams["collectionId"] = collectionId;
|
|
173
|
-
|
|
173
|
+
let _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);
|
|
174
174
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
175
175
|
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"),
|
|
176
176
|
method: "GET",
|
|
@@ -232,7 +232,7 @@ export class DocumentCollections {
|
|
|
232
232
|
__createCollection(request, requestOptions) {
|
|
233
233
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
234
|
var _a, _b, _c, _d;
|
|
235
|
-
|
|
235
|
+
let _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);
|
|
236
236
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
237
237
|
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"),
|
|
238
238
|
method: "POST",
|
|
@@ -289,7 +289,7 @@ export class DocumentCollections {
|
|
|
289
289
|
__deleteCollection(request, requestOptions) {
|
|
290
290
|
return __awaiter(this, void 0, void 0, function* () {
|
|
291
291
|
var _a, _b, _c, _d;
|
|
292
|
-
|
|
292
|
+
let _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);
|
|
293
293
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
294
294
|
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"),
|
|
295
295
|
method: "DELETE",
|
|
@@ -362,7 +362,7 @@ export class DocumentCollections {
|
|
|
362
362
|
__createMongoCollectionSync(request, requestOptions) {
|
|
363
363
|
return __awaiter(this, void 0, void 0, function* () {
|
|
364
364
|
var _a, _b, _c, _d;
|
|
365
|
-
|
|
365
|
+
let _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);
|
|
366
366
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
367
367
|
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"),
|
|
368
368
|
method: "POST",
|
|
@@ -435,7 +435,7 @@ export class DocumentCollections {
|
|
|
435
435
|
__updateMongoCollectionSync(request, requestOptions) {
|
|
436
436
|
return __awaiter(this, void 0, void 0, function* () {
|
|
437
437
|
var _a, _b, _c, _d;
|
|
438
|
-
|
|
438
|
+
let _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);
|
|
439
439
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
440
440
|
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"),
|
|
441
441
|
method: "POST",
|
|
@@ -6,8 +6,6 @@ export * as documentCatalog from "./documentCatalog/index.mjs";
|
|
|
6
6
|
export * from "./documentCatalog/types/index.mjs";
|
|
7
7
|
export * as documentCollections from "./documentCollections/index.mjs";
|
|
8
8
|
export * from "./documentCollections/types/index.mjs";
|
|
9
|
-
export * as permissionsService from "./permissionsService/index.mjs";
|
|
10
|
-
export * from "./permissionsService/types/index.mjs";
|
|
11
9
|
export * as search from "./search/index.mjs";
|
|
12
10
|
export * from "./search/types/index.mjs";
|
|
13
11
|
export * as users from "./users/index.mjs";
|
|
@@ -15,5 +13,4 @@ export * from "./users/types/index.mjs";
|
|
|
15
13
|
export * from "./copilots/client/requests/index.mjs";
|
|
16
14
|
export * from "./documentCatalog/client/requests/index.mjs";
|
|
17
15
|
export * from "./documentCollections/client/requests/index.mjs";
|
|
18
|
-
export * from "./permissionsService/client/requests/index.mjs";
|
|
19
16
|
export * from "./search/client/requests/index.mjs";
|
|
@@ -6,8 +6,6 @@ export * as documentCatalog from "./documentCatalog/index.mjs";
|
|
|
6
6
|
export * from "./documentCatalog/types/index.mjs";
|
|
7
7
|
export * as documentCollections from "./documentCollections/index.mjs";
|
|
8
8
|
export * from "./documentCollections/types/index.mjs";
|
|
9
|
-
export * as permissionsService from "./permissionsService/index.mjs";
|
|
10
|
-
export * from "./permissionsService/types/index.mjs";
|
|
11
9
|
export * as search from "./search/index.mjs";
|
|
12
10
|
export * from "./search/types/index.mjs";
|
|
13
11
|
export * as users from "./users/index.mjs";
|
|
@@ -15,5 +13,4 @@ export * from "./users/types/index.mjs";
|
|
|
15
13
|
export * from "./copilots/client/requests/index.mjs";
|
|
16
14
|
export * from "./documentCatalog/client/requests/index.mjs";
|
|
17
15
|
export * from "./documentCollections/client/requests/index.mjs";
|
|
18
|
-
export * from "./permissionsService/client/requests/index.mjs";
|
|
19
16
|
export * from "./search/client/requests/index.mjs";
|
|
@@ -11,7 +11,7 @@ export declare namespace Search {
|
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
12
|
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
15
|
fetcher?: core.FetchFunction;
|
|
16
16
|
}
|
|
17
17
|
interface RequestOptions {
|
|
@@ -24,7 +24,7 @@ export declare namespace Search {
|
|
|
24
24
|
/** Additional query string parameters to include in the request. */
|
|
25
25
|
queryParams?: Record<string, unknown>;
|
|
26
26
|
/** Additional headers to include in the request. */
|
|
27
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
27
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
export declare class Search {
|
|
@@ -50,7 +50,7 @@ export class Search {
|
|
|
50
50
|
__searchDocumentCollection(request, requestOptions) {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
52
|
var _a, _b, _c, _d;
|
|
53
|
-
|
|
53
|
+
let _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);
|
|
54
54
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
55
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"),
|
|
56
56
|
method: "POST",
|
|
@@ -11,7 +11,7 @@ export declare namespace Users {
|
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
12
|
apiKey?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
14
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
15
|
fetcher?: core.FetchFunction;
|
|
16
16
|
}
|
|
17
17
|
interface RequestOptions {
|
|
@@ -24,7 +24,7 @@ export declare namespace Users {
|
|
|
24
24
|
/** Additional query string parameters to include in the request. */
|
|
25
25
|
queryParams?: Record<string, unknown>;
|
|
26
26
|
/** Additional headers to include in the request. */
|
|
27
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
27
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
export declare class Users {
|
|
@@ -45,7 +45,7 @@ export class Users {
|
|
|
45
45
|
__metadata(request, requestOptions) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
47
|
var _a, _b, _c, _d;
|
|
48
|
-
|
|
48
|
+
let _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);
|
|
49
49
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
50
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"),
|
|
51
51
|
method: "PATCH",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
export { AuthProvider } from "./AuthProvider.mjs";
|
|
2
|
+
export { type AuthRequest } from "./AuthRequest.mjs";
|
|
1
3
|
export { BasicAuth } from "./BasicAuth.mjs";
|
|
2
4
|
export { BearerToken } from "./BearerToken.mjs";
|
|
3
|
-
export { type AuthRequest } from "./AuthRequest.mjs";
|
|
4
|
-
export { AuthProvider } from "./AuthProvider.mjs";
|
|
@@ -6,7 +6,7 @@ export declare namespace Fetcher {
|
|
|
6
6
|
url: string;
|
|
7
7
|
method: string;
|
|
8
8
|
contentType?: string;
|
|
9
|
-
headers?: Record<string, string | Supplier<string | undefined> | undefined>;
|
|
9
|
+
headers?: Record<string, string | Supplier<string | null | undefined> | null | undefined>;
|
|
10
10
|
queryParameters?: Record<string, unknown>;
|
|
11
11
|
body?: unknown;
|
|
12
12
|
timeoutMs?: number;
|
|
@@ -8,15 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { toJson } from "../json.mjs";
|
|
11
|
-
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
12
|
-
import { Supplier } from "./Supplier.mjs";
|
|
13
11
|
import { createRequestUrl } from "./createRequestUrl.mjs";
|
|
14
12
|
import { getErrorResponseBody } from "./getErrorResponseBody.mjs";
|
|
15
13
|
import { getFetchFn } from "./getFetchFn.mjs";
|
|
16
14
|
import { getRequestBody } from "./getRequestBody.mjs";
|
|
17
15
|
import { getResponseBody } from "./getResponseBody.mjs";
|
|
18
16
|
import { makeRequest } from "./makeRequest.mjs";
|
|
17
|
+
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
19
18
|
import { requestWithRetries } from "./requestWithRetries.mjs";
|
|
19
|
+
import { Supplier } from "./Supplier.mjs";
|
|
20
20
|
function getHeaders(args) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const newHeaders = {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type { APIResponse } from "./APIResponse.mjs";
|
|
2
|
-
export {
|
|
2
|
+
export type { BinaryResponse } from "./BinaryResponse.mjs";
|
|
3
3
|
export type { Fetcher, FetchFunction } from "./Fetcher.mjs";
|
|
4
|
+
export { fetcher } from "./Fetcher.mjs";
|
|
4
5
|
export { getHeader } from "./getHeader.mjs";
|
|
5
|
-
export { Supplier } from "./Supplier.mjs";
|
|
6
|
-
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
7
|
-
export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
|
|
8
6
|
export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
|
|
9
|
-
export type {
|
|
7
|
+
export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
|
|
8
|
+
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
9
|
+
export { Supplier } from "./Supplier.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { fetcher } from "./Fetcher.mjs";
|
|
2
2
|
export { getHeader } from "./getHeader.mjs";
|
|
3
|
-
export { Supplier } from "./Supplier.mjs";
|
|
4
|
-
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
5
3
|
export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
|
|
4
|
+
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
5
|
+
export { Supplier } from "./Supplier.mjs";
|
|
@@ -16,13 +16,45 @@ function addJitter(delay) {
|
|
|
16
16
|
const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR;
|
|
17
17
|
return delay * jitterMultiplier;
|
|
18
18
|
}
|
|
19
|
+
function getRetryDelayFromHeaders(response, retryAttempt) {
|
|
20
|
+
// Check for Retry-After header first (RFC 7231)
|
|
21
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
22
|
+
if (retryAfter) {
|
|
23
|
+
// Parse as number of seconds...
|
|
24
|
+
const retryAfterSeconds = parseInt(retryAfter, 10);
|
|
25
|
+
if (!isNaN(retryAfterSeconds)) {
|
|
26
|
+
// Convert seconds to milliseconds and cap at MAX_RETRY_DELAY
|
|
27
|
+
return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY);
|
|
28
|
+
}
|
|
29
|
+
// ...or as an HTTP date; both are valid
|
|
30
|
+
const retryAfterDate = new Date(retryAfter);
|
|
31
|
+
if (!isNaN(retryAfterDate.getTime())) {
|
|
32
|
+
const delay = retryAfterDate.getTime() - Date.now();
|
|
33
|
+
return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Then check for industry-standard X-RateLimit-Reset header
|
|
37
|
+
const rateLimitReset = response.headers.get("X-RateLimit-Reset");
|
|
38
|
+
if (rateLimitReset) {
|
|
39
|
+
const resetTime = parseInt(rateLimitReset, 10);
|
|
40
|
+
if (!isNaN(resetTime)) {
|
|
41
|
+
// Assume Unix timestamp in epoch seconds
|
|
42
|
+
const delay = resetTime * 1000 - Date.now();
|
|
43
|
+
if (delay > 0) {
|
|
44
|
+
return Math.min(delay, MAX_RETRY_DELAY);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Fall back to exponential backoff
|
|
49
|
+
return Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY);
|
|
50
|
+
}
|
|
19
51
|
export function requestWithRetries(requestFn_1) {
|
|
20
52
|
return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
21
53
|
let response = yield requestFn();
|
|
22
54
|
for (let i = 0; i < maxRetries; ++i) {
|
|
23
55
|
if ([408, 429].includes(response.status) || response.status >= 500) {
|
|
24
|
-
//
|
|
25
|
-
const baseDelay =
|
|
56
|
+
// Get delay from headers or fall back to exponential backoff
|
|
57
|
+
const baseDelay = getRetryDelayFromHeaders(response, i);
|
|
26
58
|
// Add jitter to the delay
|
|
27
59
|
const delayWithJitter = addJitter(baseDelay);
|
|
28
60
|
yield new Promise((resolve) => setTimeout(resolve, delayWithJitter));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as core from "./index.mjs";
|
|
2
|
-
export declare function mergeHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
|
|
3
|
-
export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
|
|
2
|
+
export declare function mergeHeaders(...headersArray: (Record<string, string | core.Supplier<string | null | undefined> | null | undefined> | null | undefined)[]): Record<string, string | core.Supplier<string | null | undefined>>;
|
|
3
|
+
export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, string | core.Supplier<string | null | undefined> | null | undefined> | null | undefined)[]): Record<string, string | core.Supplier<string | null | undefined>>;
|
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.6";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.
|
|
1
|
+
export const SDK_VERSION = "0.1.6";
|