@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.
Files changed (126) hide show
  1. package/dist/cjs/Client.d.ts +2 -5
  2. package/dist/cjs/Client.js +6 -11
  3. package/dist/cjs/api/resources/{permissionsService/types/Group.d.ts → common/types/CustomMetadataValue.d.ts} +1 -4
  4. package/dist/cjs/api/resources/common/types/index.d.ts +1 -0
  5. package/dist/cjs/api/resources/common/types/index.js +1 -0
  6. package/dist/cjs/api/resources/copilots/client/Client.d.ts +2 -2
  7. package/dist/cjs/api/resources/copilots/client/Client.js +9 -9
  8. package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +2 -2
  9. package/dist/cjs/api/resources/documentCatalog/client/Client.js +3 -3
  10. package/dist/cjs/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.ts +5 -2
  11. package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +2 -2
  12. package/dist/cjs/api/resources/documentCollections/client/Client.js +7 -7
  13. package/dist/cjs/api/resources/index.d.ts +0 -3
  14. package/dist/cjs/api/resources/index.js +1 -4
  15. package/dist/cjs/api/resources/search/client/Client.d.ts +2 -2
  16. package/dist/cjs/api/resources/search/client/Client.js +1 -1
  17. package/dist/cjs/api/resources/users/client/Client.d.ts +2 -2
  18. package/dist/cjs/api/resources/users/client/Client.js +1 -1
  19. package/dist/cjs/core/auth/index.d.ts +2 -2
  20. package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -1
  21. package/dist/cjs/core/fetcher/Fetcher.js +2 -2
  22. package/dist/cjs/core/fetcher/index.d.ts +5 -5
  23. package/dist/cjs/core/fetcher/index.js +5 -5
  24. package/dist/cjs/core/fetcher/requestWithRetries.js +34 -2
  25. package/dist/cjs/core/headers.d.ts +2 -2
  26. package/dist/cjs/version.d.ts +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/esm/Client.d.mts +2 -5
  29. package/dist/esm/Client.mjs +2 -7
  30. package/dist/esm/api/resources/{permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.mjs → common/types/CustomMetadataValue.d.mts} +1 -1
  31. package/dist/esm/api/resources/common/types/index.d.mts +1 -0
  32. package/dist/esm/api/resources/common/types/index.mjs +1 -0
  33. package/dist/esm/api/resources/copilots/client/Client.d.mts +2 -2
  34. package/dist/esm/api/resources/copilots/client/Client.mjs +9 -9
  35. package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +2 -2
  36. package/dist/esm/api/resources/documentCatalog/client/Client.mjs +3 -3
  37. package/dist/esm/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.mts +5 -2
  38. package/dist/esm/api/resources/documentCollections/client/Client.d.mts +2 -2
  39. package/dist/esm/api/resources/documentCollections/client/Client.mjs +7 -7
  40. package/dist/esm/api/resources/index.d.mts +0 -3
  41. package/dist/esm/api/resources/index.mjs +0 -3
  42. package/dist/esm/api/resources/search/client/Client.d.mts +2 -2
  43. package/dist/esm/api/resources/search/client/Client.mjs +1 -1
  44. package/dist/esm/api/resources/users/client/Client.d.mts +2 -2
  45. package/dist/esm/api/resources/users/client/Client.mjs +1 -1
  46. package/dist/esm/core/auth/index.d.mts +2 -2
  47. package/dist/esm/core/fetcher/Fetcher.d.mts +1 -1
  48. package/dist/esm/core/fetcher/Fetcher.mjs +2 -2
  49. package/dist/esm/core/fetcher/index.d.mts +5 -5
  50. package/dist/esm/core/fetcher/index.mjs +2 -2
  51. package/dist/esm/core/fetcher/requestWithRetries.mjs +34 -2
  52. package/dist/esm/core/headers.d.mts +2 -2
  53. package/dist/esm/version.d.mts +1 -1
  54. package/dist/esm/version.mjs +1 -1
  55. package/package.json +1 -1
  56. package/reference.md +0 -213
  57. package/dist/cjs/api/resources/permissionsService/client/Client.d.ts +0 -86
  58. package/dist/cjs/api/resources/permissionsService/client/Client.js +0 -260
  59. package/dist/cjs/api/resources/permissionsService/client/index.d.ts +0 -2
  60. package/dist/cjs/api/resources/permissionsService/client/index.js +0 -17
  61. package/dist/cjs/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +0 -26
  62. package/dist/cjs/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +0 -23
  63. package/dist/cjs/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.js +0 -5
  64. package/dist/cjs/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.ts +0 -20
  65. package/dist/cjs/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.js +0 -5
  66. package/dist/cjs/api/resources/permissionsService/client/requests/index.d.ts +0 -3
  67. package/dist/cjs/api/resources/permissionsService/client/requests/index.js +0 -2
  68. package/dist/cjs/api/resources/permissionsService/index.d.ts +0 -2
  69. package/dist/cjs/api/resources/permissionsService/index.js +0 -18
  70. package/dist/cjs/api/resources/permissionsService/types/Action.d.ts +0 -7
  71. package/dist/cjs/api/resources/permissionsService/types/Action.js +0 -9
  72. package/dist/cjs/api/resources/permissionsService/types/AuthorizedResource.d.ts +0 -8
  73. package/dist/cjs/api/resources/permissionsService/types/AuthorizedResource.js +0 -5
  74. package/dist/cjs/api/resources/permissionsService/types/AuthorizedResourceListPage.d.ts +0 -5
  75. package/dist/cjs/api/resources/permissionsService/types/AuthorizedResourceListPage.js +0 -5
  76. package/dist/cjs/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.ts +0 -5
  77. package/dist/cjs/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.js +0 -5
  78. package/dist/cjs/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.d.ts +0 -6
  79. package/dist/cjs/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.js +0 -5
  80. package/dist/cjs/api/resources/permissionsService/types/Group.js +0 -5
  81. package/dist/cjs/api/resources/permissionsService/types/Principal.d.ts +0 -13
  82. package/dist/cjs/api/resources/permissionsService/types/Principal.js +0 -5
  83. package/dist/cjs/api/resources/permissionsService/types/PrincipalListPage.d.ts +0 -8
  84. package/dist/cjs/api/resources/permissionsService/types/PrincipalListPage.js +0 -5
  85. package/dist/cjs/api/resources/permissionsService/types/ResourceAuthorizationResult.d.ts +0 -9
  86. package/dist/cjs/api/resources/permissionsService/types/ResourceAuthorizationResult.js +0 -5
  87. package/dist/cjs/api/resources/permissionsService/types/User.d.ts +0 -8
  88. package/dist/cjs/api/resources/permissionsService/types/User.js +0 -5
  89. package/dist/cjs/api/resources/permissionsService/types/index.d.ts +0 -10
  90. package/dist/cjs/api/resources/permissionsService/types/index.js +0 -26
  91. package/dist/esm/api/resources/permissionsService/client/Client.d.mts +0 -86
  92. package/dist/esm/api/resources/permissionsService/client/Client.mjs +0 -223
  93. package/dist/esm/api/resources/permissionsService/client/index.d.mts +0 -2
  94. package/dist/esm/api/resources/permissionsService/client/index.mjs +0 -1
  95. package/dist/esm/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.mts +0 -26
  96. package/dist/esm/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.mts +0 -23
  97. package/dist/esm/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.mts +0 -20
  98. package/dist/esm/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.mjs +0 -4
  99. package/dist/esm/api/resources/permissionsService/client/requests/index.d.mts +0 -3
  100. package/dist/esm/api/resources/permissionsService/client/requests/index.mjs +0 -1
  101. package/dist/esm/api/resources/permissionsService/index.d.mts +0 -2
  102. package/dist/esm/api/resources/permissionsService/index.mjs +0 -2
  103. package/dist/esm/api/resources/permissionsService/types/Action.d.mts +0 -7
  104. package/dist/esm/api/resources/permissionsService/types/Action.mjs +0 -6
  105. package/dist/esm/api/resources/permissionsService/types/AuthorizedResource.d.mts +0 -8
  106. package/dist/esm/api/resources/permissionsService/types/AuthorizedResource.mjs +0 -4
  107. package/dist/esm/api/resources/permissionsService/types/AuthorizedResourceListPage.d.mts +0 -5
  108. package/dist/esm/api/resources/permissionsService/types/AuthorizedResourceListPage.mjs +0 -4
  109. package/dist/esm/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.mts +0 -5
  110. package/dist/esm/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.mjs +0 -4
  111. package/dist/esm/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.d.mts +0 -6
  112. package/dist/esm/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.mjs +0 -4
  113. package/dist/esm/api/resources/permissionsService/types/Group.d.mts +0 -7
  114. package/dist/esm/api/resources/permissionsService/types/Group.mjs +0 -4
  115. package/dist/esm/api/resources/permissionsService/types/Principal.d.mts +0 -13
  116. package/dist/esm/api/resources/permissionsService/types/Principal.mjs +0 -4
  117. package/dist/esm/api/resources/permissionsService/types/PrincipalListPage.d.mts +0 -8
  118. package/dist/esm/api/resources/permissionsService/types/PrincipalListPage.mjs +0 -4
  119. package/dist/esm/api/resources/permissionsService/types/ResourceAuthorizationResult.d.mts +0 -9
  120. package/dist/esm/api/resources/permissionsService/types/ResourceAuthorizationResult.mjs +0 -4
  121. package/dist/esm/api/resources/permissionsService/types/User.d.mts +0 -8
  122. package/dist/esm/api/resources/permissionsService/types/User.mjs +0 -4
  123. package/dist/esm/api/resources/permissionsService/types/index.d.mts +0 -10
  124. package/dist/esm/api/resources/permissionsService/types/index.mjs +0 -10
  125. /package/dist/cjs/api/resources/{permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.js → common/types/CustomMetadataValue.js} +0 -0
  126. /package/dist/esm/api/resources/{permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.mjs → common/types/CustomMetadataValue.mjs} +0 -0
@@ -6,7 +6,6 @@ import * as core from "./core/index.js";
6
6
  import { Copilots } from "./api/resources/copilots/client/Client.js";
7
7
  import { DocumentCatalog } from "./api/resources/documentCatalog/client/Client.js";
8
8
  import { DocumentCollections } from "./api/resources/documentCollections/client/Client.js";
9
- import { PermissionsService } from "./api/resources/permissionsService/client/Client.js";
10
9
  import { Search } from "./api/resources/search/client/Client.js";
11
10
  import { Users } from "./api/resources/users/client/Client.js";
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
  }
@@ -42,16 +42,15 @@ const headers_js_1 = require("./core/headers.js");
42
42
  const Client_js_1 = require("./api/resources/copilots/client/Client.js");
43
43
  const Client_js_2 = require("./api/resources/documentCatalog/client/Client.js");
44
44
  const Client_js_3 = require("./api/resources/documentCollections/client/Client.js");
45
- const Client_js_4 = require("./api/resources/permissionsService/client/Client.js");
46
- const Client_js_5 = require("./api/resources/search/client/Client.js");
47
- const Client_js_6 = require("./api/resources/users/client/Client.js");
45
+ const Client_js_4 = require("./api/resources/search/client/Client.js");
46
+ const Client_js_5 = require("./api/resources/users/client/Client.js");
48
47
  class CredalClient {
49
48
  constructor(_options = {}) {
50
49
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
51
50
  "X-Fern-Language": "JavaScript",
52
51
  "X-Fern-SDK-Name": "@credal/sdk",
53
- "X-Fern-SDK-Version": "0.1.3",
54
- "User-Agent": "@credal/sdk/0.1.3",
52
+ "X-Fern-SDK-Version": "0.1.6",
53
+ "User-Agent": "@credal/sdk/0.1.6",
55
54
  "X-Fern-Runtime": core.RUNTIME.type,
56
55
  "X-Fern-Runtime-Version": core.RUNTIME.version,
57
56
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -68,17 +67,13 @@ class CredalClient {
68
67
  var _a;
69
68
  return ((_a = this._documentCollections) !== null && _a !== void 0 ? _a : (this._documentCollections = new Client_js_3.DocumentCollections(this._options)));
70
69
  }
71
- get permissionsService() {
72
- var _a;
73
- return ((_a = this._permissionsService) !== null && _a !== void 0 ? _a : (this._permissionsService = new Client_js_4.PermissionsService(this._options)));
74
- }
75
70
  get search() {
76
71
  var _a;
77
- return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_js_5.Search(this._options)));
72
+ return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_js_4.Search(this._options)));
78
73
  }
79
74
  get users() {
80
75
  var _a;
81
- return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_js_6.Users(this._options)));
76
+ return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_js_5.Users(this._options)));
82
77
  }
83
78
  }
84
79
  exports.CredalClient = CredalClient;
@@ -1,7 +1,4 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export interface Group {
5
- name: string;
6
- id?: string;
7
- }
4
+ export type CustomMetadataValue = string | number | boolean | string;
@@ -5,3 +5,4 @@ export * from "./ResourceType.js";
5
5
  export * from "./Collaborator.js";
6
6
  export * from "./Role.js";
7
7
  export * from "./Operator.js";
8
+ export * from "./CustomMetadataValue.js";
@@ -21,3 +21,4 @@ __exportStar(require("./ResourceType.js"), exports);
21
21
  __exportStar(require("./Collaborator.js"), exports);
22
22
  __exportStar(require("./Role.js"), exports);
23
23
  __exportStar(require("./Operator.js"), exports);
24
+ __exportStar(require("./CustomMetadataValue.js"), exports);
@@ -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 {
@@ -76,7 +76,7 @@ class Copilots {
76
76
  __createCopilot(request, requestOptions) {
77
77
  return __awaiter(this, void 0, void 0, function* () {
78
78
  var _a, _b, _c, _d;
79
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
79
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
80
80
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
81
81
  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"),
82
82
  method: "POST",
@@ -134,7 +134,7 @@ class Copilots {
134
134
  __createConversation(request, requestOptions) {
135
135
  return __awaiter(this, void 0, void 0, function* () {
136
136
  var _a, _b, _c, _d;
137
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
137
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
138
138
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
139
139
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/createConversation"),
140
140
  method: "POST",
@@ -196,7 +196,7 @@ class Copilots {
196
196
  __provideMessageFeedback(request, requestOptions) {
197
197
  return __awaiter(this, void 0, void 0, function* () {
198
198
  var _a, _b, _c, _d;
199
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
199
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
200
200
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
201
201
  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"),
202
202
  method: "POST",
@@ -260,7 +260,7 @@ class Copilots {
260
260
  __sendMessage(request, requestOptions) {
261
261
  return __awaiter(this, void 0, void 0, function* () {
262
262
  var _a, _b, _c, _d;
263
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
263
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
264
264
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
265
265
  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"),
266
266
  method: "POST",
@@ -309,7 +309,7 @@ class Copilots {
309
309
  __streamMessage(request, requestOptions) {
310
310
  return __awaiter(this, void 0, void 0, function* () {
311
311
  var _a, _b, _c, _d;
312
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
312
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
313
313
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
314
314
  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"),
315
315
  method: "POST",
@@ -379,7 +379,7 @@ class Copilots {
379
379
  __addCollectionToCopilot(request, requestOptions) {
380
380
  return __awaiter(this, void 0, void 0, function* () {
381
381
  var _a, _b, _c, _d;
382
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
382
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
383
383
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
384
384
  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"),
385
385
  method: "POST",
@@ -437,7 +437,7 @@ class Copilots {
437
437
  __removeCollectionFromCopilot(request, requestOptions) {
438
438
  return __awaiter(this, void 0, void 0, function* () {
439
439
  var _a, _b, _c, _d;
440
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
440
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
441
441
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
442
442
  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"),
443
443
  method: "POST",
@@ -503,7 +503,7 @@ class Copilots {
503
503
  __updateConfiguration(request, requestOptions) {
504
504
  return __awaiter(this, void 0, void 0, function* () {
505
505
  var _a, _b, _c, _d;
506
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
506
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
507
507
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
508
508
  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"),
509
509
  method: "POST",
@@ -558,7 +558,7 @@ class Copilots {
558
558
  __deleteCopilot(request, requestOptions) {
559
559
  return __awaiter(this, void 0, void 0, function* () {
560
560
  var _a, _b, _c, _d;
561
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
561
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
562
562
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
563
563
  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"),
564
564
  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 {
@@ -73,7 +73,7 @@ class DocumentCatalog {
73
73
  __uploadDocumentContents(request, requestOptions) {
74
74
  return __awaiter(this, void 0, void 0, function* () {
75
75
  var _a, _b, _c, _d;
76
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
76
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
77
77
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
78
78
  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"),
79
79
  method: "POST",
@@ -131,7 +131,7 @@ class DocumentCatalog {
131
131
  __syncSourceByUrl(request, requestOptions) {
132
132
  return __awaiter(this, void 0, void 0, function* () {
133
133
  var _a, _b, _c, _d;
134
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
134
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
135
135
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
136
136
  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"),
137
137
  method: "POST",
@@ -209,7 +209,7 @@ class DocumentCatalog {
209
209
  __metadata(request, requestOptions) {
210
210
  return __awaiter(this, void 0, void 0, function* () {
211
211
  var _a, _b, _c, _d;
212
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
212
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
213
213
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
214
214
  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"),
215
215
  method: "PATCH",
@@ -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.js";
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, unknown>;
29
- /** If specified, document will also be added to a particular document collection */
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 {
@@ -80,7 +80,7 @@ class DocumentCollections {
80
80
  __addDocumentsToCollection(request, requestOptions) {
81
81
  return __awaiter(this, void 0, void 0, function* () {
82
82
  var _a, _b, _c, _d;
83
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
83
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
84
84
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
85
85
  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"),
86
86
  method: "POST",
@@ -146,7 +146,7 @@ class DocumentCollections {
146
146
  __removeDocumentsFromCollection(request, requestOptions) {
147
147
  return __awaiter(this, void 0, void 0, function* () {
148
148
  var _a, _b, _c, _d;
149
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
149
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
150
150
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
151
151
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/removeDocumentsFromCollection"),
152
152
  method: "DELETE",
@@ -206,7 +206,7 @@ class DocumentCollections {
206
206
  const { collectionId } = request;
207
207
  const _queryParams = {};
208
208
  _queryParams["collectionId"] = collectionId;
209
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
209
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
210
210
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
211
211
  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"),
212
212
  method: "GET",
@@ -268,7 +268,7 @@ class DocumentCollections {
268
268
  __createCollection(request, requestOptions) {
269
269
  return __awaiter(this, void 0, void 0, function* () {
270
270
  var _a, _b, _c, _d;
271
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
271
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
272
272
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
273
273
  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"),
274
274
  method: "POST",
@@ -325,7 +325,7 @@ class DocumentCollections {
325
325
  __deleteCollection(request, requestOptions) {
326
326
  return __awaiter(this, void 0, void 0, function* () {
327
327
  var _a, _b, _c, _d;
328
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
328
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
329
329
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
330
330
  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"),
331
331
  method: "DELETE",
@@ -398,7 +398,7 @@ class DocumentCollections {
398
398
  __createMongoCollectionSync(request, requestOptions) {
399
399
  return __awaiter(this, void 0, void 0, function* () {
400
400
  var _a, _b, _c, _d;
401
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
401
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
402
402
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
403
403
  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"),
404
404
  method: "POST",
@@ -471,7 +471,7 @@ class DocumentCollections {
471
471
  __updateMongoCollectionSync(request, requestOptions) {
472
472
  return __awaiter(this, void 0, void 0, function* () {
473
473
  var _a, _b, _c, _d;
474
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
474
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
475
475
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
476
476
  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"),
477
477
  method: "POST",
@@ -6,8 +6,6 @@ export * as documentCatalog from "./documentCatalog/index.js";
6
6
  export * from "./documentCatalog/types/index.js";
7
7
  export * as documentCollections from "./documentCollections/index.js";
8
8
  export * from "./documentCollections/types/index.js";
9
- export * as permissionsService from "./permissionsService/index.js";
10
- export * from "./permissionsService/types/index.js";
11
9
  export * as search from "./search/index.js";
12
10
  export * from "./search/types/index.js";
13
11
  export * as users from "./users/index.js";
@@ -15,5 +13,4 @@ export * from "./users/types/index.js";
15
13
  export * from "./copilots/client/requests/index.js";
16
14
  export * from "./documentCatalog/client/requests/index.js";
17
15
  export * from "./documentCollections/client/requests/index.js";
18
- export * from "./permissionsService/client/requests/index.js";
19
16
  export * from "./search/client/requests/index.js";
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.users = exports.search = exports.permissionsService = exports.documentCollections = exports.documentCatalog = exports.copilots = exports.common = void 0;
39
+ exports.users = exports.search = exports.documentCollections = exports.documentCatalog = exports.copilots = exports.common = void 0;
40
40
  exports.common = __importStar(require("./common/index.js"));
41
41
  __exportStar(require("./common/types/index.js"), exports);
42
42
  exports.copilots = __importStar(require("./copilots/index.js"));
@@ -45,8 +45,6 @@ exports.documentCatalog = __importStar(require("./documentCatalog/index.js"));
45
45
  __exportStar(require("./documentCatalog/types/index.js"), exports);
46
46
  exports.documentCollections = __importStar(require("./documentCollections/index.js"));
47
47
  __exportStar(require("./documentCollections/types/index.js"), exports);
48
- exports.permissionsService = __importStar(require("./permissionsService/index.js"));
49
- __exportStar(require("./permissionsService/types/index.js"), exports);
50
48
  exports.search = __importStar(require("./search/index.js"));
51
49
  __exportStar(require("./search/types/index.js"), exports);
52
50
  exports.users = __importStar(require("./users/index.js"));
@@ -54,5 +52,4 @@ __exportStar(require("./users/types/index.js"), exports);
54
52
  __exportStar(require("./copilots/client/requests/index.js"), exports);
55
53
  __exportStar(require("./documentCatalog/client/requests/index.js"), exports);
56
54
  __exportStar(require("./documentCollections/client/requests/index.js"), exports);
57
- __exportStar(require("./permissionsService/client/requests/index.js"), exports);
58
55
  __exportStar(require("./search/client/requests/index.js"), exports);
@@ -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 {
@@ -86,7 +86,7 @@ class Search {
86
86
  __searchDocumentCollection(request, requestOptions) {
87
87
  return __awaiter(this, void 0, void 0, function* () {
88
88
  var _a, _b, _c, _d;
89
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
89
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
90
90
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
91
91
  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"),
92
92
  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 {
@@ -81,7 +81,7 @@ class Users {
81
81
  __metadata(request, requestOptions) {
82
82
  return __awaiter(this, void 0, void 0, function* () {
83
83
  var _a, _b, _c, _d;
84
- var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
84
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
85
85
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
86
86
  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"),
87
87
  method: "PATCH",
@@ -1,4 +1,4 @@
1
+ export { AuthProvider } from "./AuthProvider.js";
2
+ export { type AuthRequest } from "./AuthRequest.js";
1
3
  export { BasicAuth } from "./BasicAuth.js";
2
4
  export { BearerToken } from "./BearerToken.js";
3
- export { type AuthRequest } from "./AuthRequest.js";
4
- export { AuthProvider } from "./AuthProvider.js";
@@ -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;
@@ -12,15 +12,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.fetcher = void 0;
13
13
  exports.fetcherImpl = fetcherImpl;
14
14
  const json_js_1 = require("../json.js");
15
- const RawResponse_js_1 = require("./RawResponse.js");
16
- const Supplier_js_1 = require("./Supplier.js");
17
15
  const createRequestUrl_js_1 = require("./createRequestUrl.js");
18
16
  const getErrorResponseBody_js_1 = require("./getErrorResponseBody.js");
19
17
  const getFetchFn_js_1 = require("./getFetchFn.js");
20
18
  const getRequestBody_js_1 = require("./getRequestBody.js");
21
19
  const getResponseBody_js_1 = require("./getResponseBody.js");
22
20
  const makeRequest_js_1 = require("./makeRequest.js");
21
+ const RawResponse_js_1 = require("./RawResponse.js");
23
22
  const requestWithRetries_js_1 = require("./requestWithRetries.js");
23
+ const Supplier_js_1 = require("./Supplier.js");
24
24
  function getHeaders(args) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
26
  const newHeaders = {};
@@ -1,9 +1,9 @@
1
1
  export type { APIResponse } from "./APIResponse.js";
2
- export { fetcher } from "./Fetcher.js";
2
+ export type { BinaryResponse } from "./BinaryResponse.js";
3
3
  export type { Fetcher, FetchFunction } from "./Fetcher.js";
4
+ export { fetcher } from "./Fetcher.js";
4
5
  export { getHeader } from "./getHeader.js";
5
- export { Supplier } from "./Supplier.js";
6
- export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
7
- export type { RawResponse, WithRawResponse } from "./RawResponse.js";
8
6
  export { HttpResponsePromise } from "./HttpResponsePromise.js";
9
- export type { BinaryResponse } from "./BinaryResponse.js";
7
+ export type { RawResponse, WithRawResponse } from "./RawResponse.js";
8
+ export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
9
+ export { Supplier } from "./Supplier.js";
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpResponsePromise = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.Supplier = exports.getHeader = exports.fetcher = void 0;
3
+ exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = void 0;
4
4
  var Fetcher_js_1 = require("./Fetcher.js");
5
5
  Object.defineProperty(exports, "fetcher", { enumerable: true, get: function () { return Fetcher_js_1.fetcher; } });
6
6
  var getHeader_js_1 = require("./getHeader.js");
7
7
  Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_js_1.getHeader; } });
8
- var Supplier_js_1 = require("./Supplier.js");
9
- Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return Supplier_js_1.Supplier; } });
8
+ var HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
9
+ Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
10
10
  var RawResponse_js_1 = require("./RawResponse.js");
11
11
  Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.abortRawResponse; } });
12
12
  Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.toRawResponse; } });
13
13
  Object.defineProperty(exports, "unknownRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.unknownRawResponse; } });
14
- var HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
15
- Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
14
+ var Supplier_js_1 = require("./Supplier.js");
15
+ Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return Supplier_js_1.Supplier; } });
@@ -19,13 +19,45 @@ function addJitter(delay) {
19
19
  const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR;
20
20
  return delay * jitterMultiplier;
21
21
  }
22
+ function getRetryDelayFromHeaders(response, retryAttempt) {
23
+ // Check for Retry-After header first (RFC 7231)
24
+ const retryAfter = response.headers.get("Retry-After");
25
+ if (retryAfter) {
26
+ // Parse as number of seconds...
27
+ const retryAfterSeconds = parseInt(retryAfter, 10);
28
+ if (!isNaN(retryAfterSeconds)) {
29
+ // Convert seconds to milliseconds and cap at MAX_RETRY_DELAY
30
+ return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY);
31
+ }
32
+ // ...or as an HTTP date; both are valid
33
+ const retryAfterDate = new Date(retryAfter);
34
+ if (!isNaN(retryAfterDate.getTime())) {
35
+ const delay = retryAfterDate.getTime() - Date.now();
36
+ return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY);
37
+ }
38
+ }
39
+ // Then check for industry-standard X-RateLimit-Reset header
40
+ const rateLimitReset = response.headers.get("X-RateLimit-Reset");
41
+ if (rateLimitReset) {
42
+ const resetTime = parseInt(rateLimitReset, 10);
43
+ if (!isNaN(resetTime)) {
44
+ // Assume Unix timestamp in epoch seconds
45
+ const delay = resetTime * 1000 - Date.now();
46
+ if (delay > 0) {
47
+ return Math.min(delay, MAX_RETRY_DELAY);
48
+ }
49
+ }
50
+ }
51
+ // Fall back to exponential backoff
52
+ return Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY);
53
+ }
22
54
  function requestWithRetries(requestFn_1) {
23
55
  return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
24
56
  let response = yield requestFn();
25
57
  for (let i = 0; i < maxRetries; ++i) {
26
58
  if ([408, 429].includes(response.status) || response.status >= 500) {
27
- // Calculate base delay using exponential backoff (in milliseconds)
28
- const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
59
+ // Get delay from headers or fall back to exponential backoff
60
+ const baseDelay = getRetryDelayFromHeaders(response, i);
29
61
  // Add jitter to the delay
30
62
  const delayWithJitter = addJitter(baseDelay);
31
63
  yield new Promise((resolve) => setTimeout(resolve, delayWithJitter));
@@ -1,3 +1,3 @@
1
1
  import * as core from "./index.js";
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>>;