@credal/sdk 0.0.15 → 0.0.17

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 (166) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +17 -12
  3. package/api/resources/actions/client/Client.d.ts +46 -0
  4. package/api/resources/actions/client/Client.js +134 -0
  5. package/api/resources/actions/client/index.d.ts +1 -0
  6. package/api/resources/actions/client/index.js +17 -0
  7. package/api/resources/actions/client/requests/InvokeActionRequest.d.ts +46 -0
  8. package/api/resources/actions/client/requests/InvokeActionRequest.js +5 -0
  9. package/api/resources/actions/client/requests/index.d.ts +1 -0
  10. package/api/resources/actions/client/requests/index.js +2 -0
  11. package/api/resources/actions/index.d.ts +2 -0
  12. package/api/resources/actions/index.js +18 -0
  13. package/api/resources/actions/types/ActionStatus.d.ts +12 -0
  14. package/api/resources/actions/types/ActionStatus.js +14 -0
  15. package/api/resources/actions/types/Conversation.d.ts +6 -0
  16. package/api/resources/actions/types/Conversation.js +5 -0
  17. package/api/resources/actions/types/DirectMessage.d.ts +6 -0
  18. package/api/resources/actions/types/DirectMessage.js +5 -0
  19. package/api/resources/actions/types/HumanConfirmationChannel.d.ts +16 -0
  20. package/api/resources/actions/types/HumanConfirmationChannel.js +5 -0
  21. package/api/resources/actions/types/InvokeActionResponse.d.ts +8 -0
  22. package/api/resources/actions/types/InvokeActionResponse.js +5 -0
  23. package/api/resources/actions/types/SlackThread.d.ts +7 -0
  24. package/api/resources/actions/types/SlackThread.js +5 -0
  25. package/api/resources/actions/types/index.d.ts +6 -0
  26. package/api/resources/actions/types/index.js +22 -0
  27. package/api/resources/copilots/client/Client.d.ts +2 -2
  28. package/api/resources/copilots/client/Client.js +20 -20
  29. package/api/resources/copilots/client/requests/SendMessageRequest.d.ts +2 -2
  30. package/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +4 -4
  31. package/api/resources/copilots/types/InputVariable.d.ts +1 -1
  32. package/api/resources/copilots/types/StreamingChunk.d.ts +15 -1
  33. package/api/resources/documentCatalog/client/Client.d.ts +13 -0
  34. package/api/resources/documentCatalog/client/Client.js +67 -4
  35. package/api/resources/documentCatalog/types/SyncSourceByUrlRequest.d.ts +7 -0
  36. package/api/resources/documentCatalog/types/SyncSourceByUrlRequest.js +5 -0
  37. package/api/resources/documentCatalog/types/SyncSourceByUrlResponse.d.ts +6 -0
  38. package/api/resources/documentCatalog/types/SyncSourceByUrlResponse.js +5 -0
  39. package/api/resources/documentCatalog/types/index.d.ts +2 -0
  40. package/api/resources/documentCatalog/types/index.js +2 -0
  41. package/api/resources/documentCollections/client/Client.js +12 -12
  42. package/api/resources/index.d.ts +3 -0
  43. package/api/resources/index.js +4 -1
  44. package/api/resources/permissionsService/client/Client.js +6 -6
  45. package/api/resources/search/client/Client.js +2 -2
  46. package/api/resources/users/client/Client.js +2 -2
  47. package/dist/Client.d.ts +3 -0
  48. package/dist/Client.js +17 -12
  49. package/dist/api/resources/actions/client/Client.d.ts +46 -0
  50. package/dist/api/resources/actions/client/Client.js +134 -0
  51. package/dist/api/resources/actions/client/index.d.ts +1 -0
  52. package/dist/api/resources/actions/client/index.js +17 -0
  53. package/dist/api/resources/actions/client/requests/InvokeActionRequest.d.ts +46 -0
  54. package/dist/api/resources/actions/client/requests/InvokeActionRequest.js +5 -0
  55. package/dist/api/resources/actions/client/requests/index.d.ts +1 -0
  56. package/dist/api/resources/actions/client/requests/index.js +2 -0
  57. package/dist/api/resources/actions/index.d.ts +2 -0
  58. package/dist/api/resources/actions/index.js +18 -0
  59. package/dist/api/resources/actions/types/ActionStatus.d.ts +12 -0
  60. package/dist/api/resources/actions/types/ActionStatus.js +14 -0
  61. package/dist/api/resources/actions/types/Conversation.d.ts +6 -0
  62. package/dist/api/resources/actions/types/Conversation.js +5 -0
  63. package/dist/api/resources/actions/types/DirectMessage.d.ts +6 -0
  64. package/dist/api/resources/actions/types/DirectMessage.js +5 -0
  65. package/dist/api/resources/actions/types/HumanConfirmationChannel.d.ts +16 -0
  66. package/dist/api/resources/actions/types/HumanConfirmationChannel.js +5 -0
  67. package/dist/api/resources/actions/types/InvokeActionResponse.d.ts +8 -0
  68. package/dist/api/resources/actions/types/InvokeActionResponse.js +5 -0
  69. package/dist/api/resources/actions/types/SlackThread.d.ts +7 -0
  70. package/dist/api/resources/actions/types/SlackThread.js +5 -0
  71. package/dist/api/resources/actions/types/index.d.ts +6 -0
  72. package/dist/api/resources/actions/types/index.js +22 -0
  73. package/dist/api/resources/copilots/client/Client.d.ts +2 -2
  74. package/dist/api/resources/copilots/client/Client.js +20 -20
  75. package/dist/api/resources/copilots/client/requests/SendMessageRequest.d.ts +2 -2
  76. package/dist/api/resources/copilots/client/requests/StreamMessageRequest.d.ts +4 -4
  77. package/dist/api/resources/copilots/types/InputVariable.d.ts +1 -1
  78. package/dist/api/resources/copilots/types/StreamingChunk.d.ts +15 -1
  79. package/dist/api/resources/documentCatalog/client/Client.d.ts +13 -0
  80. package/dist/api/resources/documentCatalog/client/Client.js +67 -4
  81. package/dist/api/resources/documentCatalog/types/SyncSourceByUrlRequest.d.ts +7 -0
  82. package/dist/api/resources/documentCatalog/types/SyncSourceByUrlRequest.js +5 -0
  83. package/dist/api/resources/documentCatalog/types/SyncSourceByUrlResponse.d.ts +6 -0
  84. package/dist/api/resources/documentCatalog/types/SyncSourceByUrlResponse.js +5 -0
  85. package/dist/api/resources/documentCatalog/types/index.d.ts +2 -0
  86. package/dist/api/resources/documentCatalog/types/index.js +2 -0
  87. package/dist/api/resources/documentCollections/client/Client.js +12 -12
  88. package/dist/api/resources/index.d.ts +3 -0
  89. package/dist/api/resources/index.js +4 -1
  90. package/dist/api/resources/permissionsService/client/Client.js +6 -6
  91. package/dist/api/resources/search/client/Client.js +2 -2
  92. package/dist/api/resources/users/client/Client.js +2 -2
  93. package/dist/serialization/resources/actions/client/index.d.ts +1 -0
  94. package/dist/serialization/resources/actions/client/index.js +17 -0
  95. package/dist/serialization/resources/actions/client/requests/InvokeActionRequest.d.ts +18 -0
  96. package/dist/serialization/resources/actions/client/requests/InvokeActionRequest.js +39 -0
  97. package/dist/serialization/resources/actions/client/requests/index.d.ts +1 -0
  98. package/dist/serialization/resources/actions/client/requests/index.js +5 -0
  99. package/dist/serialization/resources/actions/index.d.ts +2 -0
  100. package/dist/serialization/resources/actions/index.js +18 -0
  101. package/dist/serialization/resources/actions/types/ActionStatus.d.ts +10 -0
  102. package/dist/serialization/resources/actions/types/ActionStatus.js +38 -0
  103. package/dist/serialization/resources/actions/types/Conversation.d.ts +12 -0
  104. package/dist/serialization/resources/actions/types/Conversation.js +33 -0
  105. package/dist/serialization/resources/actions/types/DirectMessage.d.ts +12 -0
  106. package/dist/serialization/resources/actions/types/DirectMessage.js +33 -0
  107. package/dist/serialization/resources/actions/types/HumanConfirmationChannel.d.ts +22 -0
  108. package/dist/serialization/resources/actions/types/HumanConfirmationChannel.js +43 -0
  109. package/dist/serialization/resources/actions/types/InvokeActionResponse.d.ts +14 -0
  110. package/dist/serialization/resources/actions/types/InvokeActionResponse.js +35 -0
  111. package/dist/serialization/resources/actions/types/SlackThread.d.ts +13 -0
  112. package/dist/serialization/resources/actions/types/SlackThread.js +34 -0
  113. package/dist/serialization/resources/actions/types/index.d.ts +6 -0
  114. package/dist/serialization/resources/actions/types/index.js +22 -0
  115. package/dist/serialization/resources/copilots/types/InputVariable.d.ts +1 -1
  116. package/dist/serialization/resources/copilots/types/InputVariable.js +1 -1
  117. package/dist/serialization/resources/copilots/types/StreamingChunk.d.ts +13 -1
  118. package/dist/serialization/resources/copilots/types/StreamingChunk.js +11 -1
  119. package/dist/serialization/resources/documentCatalog/types/SyncSourceByUrlRequest.d.ts +13 -0
  120. package/dist/serialization/resources/documentCatalog/types/SyncSourceByUrlRequest.js +34 -0
  121. package/dist/serialization/resources/documentCatalog/types/SyncSourceByUrlResponse.d.ts +12 -0
  122. package/dist/serialization/resources/documentCatalog/types/SyncSourceByUrlResponse.js +33 -0
  123. package/dist/serialization/resources/documentCatalog/types/index.d.ts +2 -0
  124. package/dist/serialization/resources/documentCatalog/types/index.js +2 -0
  125. package/dist/serialization/resources/index.d.ts +3 -0
  126. package/dist/serialization/resources/index.js +4 -1
  127. package/dist/version.d.ts +1 -1
  128. package/dist/version.js +1 -1
  129. package/package.json +1 -1
  130. package/reference.md +145 -4
  131. package/serialization/resources/actions/client/index.d.ts +1 -0
  132. package/serialization/resources/actions/client/index.js +17 -0
  133. package/serialization/resources/actions/client/requests/InvokeActionRequest.d.ts +18 -0
  134. package/serialization/resources/actions/client/requests/InvokeActionRequest.js +39 -0
  135. package/serialization/resources/actions/client/requests/index.d.ts +1 -0
  136. package/serialization/resources/actions/client/requests/index.js +5 -0
  137. package/serialization/resources/actions/index.d.ts +2 -0
  138. package/serialization/resources/actions/index.js +18 -0
  139. package/serialization/resources/actions/types/ActionStatus.d.ts +10 -0
  140. package/serialization/resources/actions/types/ActionStatus.js +38 -0
  141. package/serialization/resources/actions/types/Conversation.d.ts +12 -0
  142. package/serialization/resources/actions/types/Conversation.js +33 -0
  143. package/serialization/resources/actions/types/DirectMessage.d.ts +12 -0
  144. package/serialization/resources/actions/types/DirectMessage.js +33 -0
  145. package/serialization/resources/actions/types/HumanConfirmationChannel.d.ts +22 -0
  146. package/serialization/resources/actions/types/HumanConfirmationChannel.js +43 -0
  147. package/serialization/resources/actions/types/InvokeActionResponse.d.ts +14 -0
  148. package/serialization/resources/actions/types/InvokeActionResponse.js +35 -0
  149. package/serialization/resources/actions/types/SlackThread.d.ts +13 -0
  150. package/serialization/resources/actions/types/SlackThread.js +34 -0
  151. package/serialization/resources/actions/types/index.d.ts +6 -0
  152. package/serialization/resources/actions/types/index.js +22 -0
  153. package/serialization/resources/copilots/types/InputVariable.d.ts +1 -1
  154. package/serialization/resources/copilots/types/InputVariable.js +1 -1
  155. package/serialization/resources/copilots/types/StreamingChunk.d.ts +13 -1
  156. package/serialization/resources/copilots/types/StreamingChunk.js +11 -1
  157. package/serialization/resources/documentCatalog/types/SyncSourceByUrlRequest.d.ts +13 -0
  158. package/serialization/resources/documentCatalog/types/SyncSourceByUrlRequest.js +34 -0
  159. package/serialization/resources/documentCatalog/types/SyncSourceByUrlResponse.d.ts +12 -0
  160. package/serialization/resources/documentCatalog/types/SyncSourceByUrlResponse.js +33 -0
  161. package/serialization/resources/documentCatalog/types/index.d.ts +2 -0
  162. package/serialization/resources/documentCatalog/types/index.js +2 -0
  163. package/serialization/resources/index.d.ts +3 -0
  164. package/serialization/resources/index.js +4 -1
  165. package/version.d.ts +1 -1
  166. package/version.js +1 -1
@@ -10,10 +10,10 @@ import * as Credal from "../../../../index";
10
10
  * userEmail: "ravin@credal.ai",
11
11
  * inputVariables: [{
12
12
  * name: "input1",
13
- * urls: ["https://drive.google.com/file/d/123456/view"]
13
+ * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c24"]
14
14
  * }, {
15
15
  * name: "input2",
16
- * urls: ["https://drive.google.com/file/d/123457/view", "https://drive.google.com/file/d/123458/view"]
16
+ * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c25", "82e4b12a-6990-45d4-8ebd-85c00e030c26"]
17
17
  * }]
18
18
  * }
19
19
  */
@@ -10,10 +10,10 @@ import * as Credal from "../../../../index";
10
10
  * email: "ravin@credal.ai",
11
11
  * inputVariables: [{
12
12
  * name: "input1",
13
- * urls: ["https://drive.google.com/file/d/123456/view"]
13
+ * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c24"]
14
14
  * }, {
15
15
  * name: "input2",
16
- * urls: ["https://drive.google.com/file/d/123457/view", "https://drive.google.com/file/d/123458/view"]
16
+ * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c25", "82e4b12a-6990-45d4-8ebd-85c00e030c26"]
17
17
  * }]
18
18
  * }
19
19
  *
@@ -24,10 +24,10 @@ import * as Credal from "../../../../index";
24
24
  * email: "ravin@credal.ai",
25
25
  * inputVariables: [{
26
26
  * name: "input1",
27
- * urls: ["https://drive.google.com/file/d/123456/view"]
27
+ * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c26"]
28
28
  * }, {
29
29
  * name: "input2",
30
- * urls: ["https://drive.google.com/file/d/123457/view", "https://drive.google.com/file/d/123458/view"]
30
+ * ids: ["82e4b12a-6990-45d4-8ebd-85c00e030c25", "82e4b12a-6990-45d4-8ebd-85c00e030c24"]
31
31
  * }]
32
32
  * }
33
33
  */
@@ -3,5 +3,5 @@
3
3
  */
4
4
  export interface InputVariable {
5
5
  name: string;
6
- urls: string[];
6
+ ids: string[];
7
7
  }
@@ -2,4 +2,18 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Credal from "../../../index";
5
- export declare type StreamingChunk = Credal.InitialChunk | Credal.DataChunk | Credal.FinalChunk | Credal.BlockedChunk;
5
+ export declare type StreamingChunk = Credal.StreamingChunk.Initial | Credal.StreamingChunk.DataChunk | Credal.StreamingChunk.FinalChunk | Credal.StreamingChunk.Blocked;
6
+ export declare namespace StreamingChunk {
7
+ interface Initial extends Credal.InitialChunk {
8
+ event: "initial";
9
+ }
10
+ interface DataChunk extends Credal.DataChunk {
11
+ event: "data_chunk";
12
+ }
13
+ interface FinalChunk extends Credal.FinalChunk {
14
+ event: "final_chunk";
15
+ }
16
+ interface Blocked extends Credal.BlockedChunk {
17
+ event: "blocked";
18
+ }
19
+ }
@@ -36,6 +36,19 @@ export declare class DocumentCatalog {
36
36
  * })
37
37
  */
38
38
  uploadDocumentContents(request: Credal.UploadDocumentContentsRequest, requestOptions?: DocumentCatalog.RequestOptions): Promise<Credal.UploadDocumentResponse>;
39
+ /**
40
+ * Sync a document from a source URL. Does not support recursive web search. Reach out to a Credal representative for access.
41
+ *
42
+ * @param {Credal.SyncSourceByUrlRequest} request
43
+ * @param {DocumentCatalog.RequestOptions} requestOptions - Request-specific configuration.
44
+ *
45
+ * @example
46
+ * await client.documentCatalog.syncSourceByUrl({
47
+ * sourceUrl: "https://drive.google.com/file/d/123456/view",
48
+ * uploadAsUserEmail: "ria@credal.ai"
49
+ * })
50
+ */
51
+ syncSourceByUrl(request: Credal.SyncSourceByUrlRequest, requestOptions?: DocumentCatalog.RequestOptions): Promise<Credal.SyncSourceByUrlResponse>;
39
52
  /**
40
53
  * Bulk patch metadata for documents, synced natively by Credal or manual API uploads
41
54
  *
@@ -71,8 +71,8 @@ class DocumentCatalog {
71
71
  Authorization: yield this._getAuthorizationHeader(),
72
72
  "X-Fern-Language": "JavaScript",
73
73
  "X-Fern-SDK-Name": "@credal/sdk",
74
- "X-Fern-SDK-Version": "0.0.15",
75
- "User-Agent": "@credal/sdk/0.0.15",
74
+ "X-Fern-SDK-Version": "0.0.17",
75
+ "User-Agent": "@credal/sdk/0.0.17",
76
76
  "X-Fern-Runtime": core.RUNTIME.type,
77
77
  "X-Fern-Runtime-Version": core.RUNTIME.version,
78
78
  },
@@ -112,6 +112,69 @@ class DocumentCatalog {
112
112
  }
113
113
  });
114
114
  }
115
+ /**
116
+ * Sync a document from a source URL. Does not support recursive web search. Reach out to a Credal representative for access.
117
+ *
118
+ * @param {Credal.SyncSourceByUrlRequest} request
119
+ * @param {DocumentCatalog.RequestOptions} requestOptions - Request-specific configuration.
120
+ *
121
+ * @example
122
+ * await client.documentCatalog.syncSourceByUrl({
123
+ * sourceUrl: "https://drive.google.com/file/d/123456/view",
124
+ * uploadAsUserEmail: "ria@credal.ai"
125
+ * })
126
+ */
127
+ syncSourceByUrl(request, requestOptions) {
128
+ var _a, _b;
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
131
+ url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CredalEnvironment.Production, "/v0/catalog/syncSourceByUrl"),
132
+ method: "POST",
133
+ headers: {
134
+ Authorization: yield this._getAuthorizationHeader(),
135
+ "X-Fern-Language": "JavaScript",
136
+ "X-Fern-SDK-Name": "@credal/sdk",
137
+ "X-Fern-SDK-Version": "0.0.17",
138
+ "User-Agent": "@credal/sdk/0.0.17",
139
+ "X-Fern-Runtime": core.RUNTIME.type,
140
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
141
+ },
142
+ contentType: "application/json",
143
+ requestType: "json",
144
+ body: serializers.SyncSourceByUrlRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
145
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
146
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
147
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
148
+ });
149
+ if (_response.ok) {
150
+ return serializers.SyncSourceByUrlResponse.parseOrThrow(_response.body, {
151
+ unrecognizedObjectKeys: "passthrough",
152
+ allowUnrecognizedUnionMembers: true,
153
+ allowUnrecognizedEnumValues: true,
154
+ breadcrumbsPrefix: ["response"],
155
+ });
156
+ }
157
+ if (_response.error.reason === "status-code") {
158
+ throw new errors.CredalError({
159
+ statusCode: _response.error.statusCode,
160
+ body: _response.error.body,
161
+ });
162
+ }
163
+ switch (_response.error.reason) {
164
+ case "non-json":
165
+ throw new errors.CredalError({
166
+ statusCode: _response.error.statusCode,
167
+ body: _response.error.rawBody,
168
+ });
169
+ case "timeout":
170
+ throw new errors.CredalTimeoutError();
171
+ case "unknown":
172
+ throw new errors.CredalError({
173
+ message: _response.error.errorMessage,
174
+ });
175
+ }
176
+ });
177
+ }
115
178
  /**
116
179
  * Bulk patch metadata for documents, synced natively by Credal or manual API uploads
117
180
  *
@@ -154,8 +217,8 @@ class DocumentCatalog {
154
217
  Authorization: yield this._getAuthorizationHeader(),
155
218
  "X-Fern-Language": "JavaScript",
156
219
  "X-Fern-SDK-Name": "@credal/sdk",
157
- "X-Fern-SDK-Version": "0.0.15",
158
- "User-Agent": "@credal/sdk/0.0.15",
220
+ "X-Fern-SDK-Version": "0.0.17",
221
+ "User-Agent": "@credal/sdk/0.0.17",
159
222
  "X-Fern-Runtime": core.RUNTIME.type,
160
223
  "X-Fern-Runtime-Version": core.RUNTIME.version,
161
224
  },
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface SyncSourceByUrlRequest {
5
+ uploadAsUserEmail: string;
6
+ sourceUrl: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface SyncSourceByUrlResponse {
5
+ sourceId: string;
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,5 @@
1
1
  export * from "./UploadDocumentResponse";
2
2
  export * from "./DocumentMetadataPatch";
3
3
  export * from "./DocumentMetadataPatchRequest";
4
+ export * from "./SyncSourceByUrlRequest";
5
+ export * from "./SyncSourceByUrlResponse";
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./UploadDocumentResponse"), exports);
18
18
  __exportStar(require("./DocumentMetadataPatch"), exports);
19
19
  __exportStar(require("./DocumentMetadataPatchRequest"), exports);
20
+ __exportStar(require("./SyncSourceByUrlRequest"), exports);
21
+ __exportStar(require("./SyncSourceByUrlResponse"), exports);
@@ -78,8 +78,8 @@ class DocumentCollections {
78
78
  Authorization: yield this._getAuthorizationHeader(),
79
79
  "X-Fern-Language": "JavaScript",
80
80
  "X-Fern-SDK-Name": "@credal/sdk",
81
- "X-Fern-SDK-Version": "0.0.15",
82
- "User-Agent": "@credal/sdk/0.0.15",
81
+ "X-Fern-SDK-Version": "0.0.17",
82
+ "User-Agent": "@credal/sdk/0.0.17",
83
83
  "X-Fern-Runtime": core.RUNTIME.type,
84
84
  "X-Fern-Runtime-Version": core.RUNTIME.version,
85
85
  },
@@ -144,8 +144,8 @@ class DocumentCollections {
144
144
  Authorization: yield this._getAuthorizationHeader(),
145
145
  "X-Fern-Language": "JavaScript",
146
146
  "X-Fern-SDK-Name": "@credal/sdk",
147
- "X-Fern-SDK-Version": "0.0.15",
148
- "User-Agent": "@credal/sdk/0.0.15",
147
+ "X-Fern-SDK-Version": "0.0.17",
148
+ "User-Agent": "@credal/sdk/0.0.17",
149
149
  "X-Fern-Runtime": core.RUNTIME.type,
150
150
  "X-Fern-Runtime-Version": core.RUNTIME.version,
151
151
  },
@@ -208,8 +208,8 @@ class DocumentCollections {
208
208
  Authorization: yield this._getAuthorizationHeader(),
209
209
  "X-Fern-Language": "JavaScript",
210
210
  "X-Fern-SDK-Name": "@credal/sdk",
211
- "X-Fern-SDK-Version": "0.0.15",
212
- "User-Agent": "@credal/sdk/0.0.15",
211
+ "X-Fern-SDK-Version": "0.0.17",
212
+ "User-Agent": "@credal/sdk/0.0.17",
213
213
  "X-Fern-Runtime": core.RUNTIME.type,
214
214
  "X-Fern-Runtime-Version": core.RUNTIME.version,
215
215
  },
@@ -270,8 +270,8 @@ class DocumentCollections {
270
270
  Authorization: yield this._getAuthorizationHeader(),
271
271
  "X-Fern-Language": "JavaScript",
272
272
  "X-Fern-SDK-Name": "@credal/sdk",
273
- "X-Fern-SDK-Version": "0.0.15",
274
- "User-Agent": "@credal/sdk/0.0.15",
273
+ "X-Fern-SDK-Version": "0.0.17",
274
+ "User-Agent": "@credal/sdk/0.0.17",
275
275
  "X-Fern-Runtime": core.RUNTIME.type,
276
276
  "X-Fern-Runtime-Version": core.RUNTIME.version,
277
277
  },
@@ -348,8 +348,8 @@ class DocumentCollections {
348
348
  Authorization: yield this._getAuthorizationHeader(),
349
349
  "X-Fern-Language": "JavaScript",
350
350
  "X-Fern-SDK-Name": "@credal/sdk",
351
- "X-Fern-SDK-Version": "0.0.15",
352
- "User-Agent": "@credal/sdk/0.0.15",
351
+ "X-Fern-SDK-Version": "0.0.17",
352
+ "User-Agent": "@credal/sdk/0.0.17",
353
353
  "X-Fern-Runtime": core.RUNTIME.type,
354
354
  "X-Fern-Runtime-Version": core.RUNTIME.version,
355
355
  },
@@ -428,8 +428,8 @@ class DocumentCollections {
428
428
  Authorization: yield this._getAuthorizationHeader(),
429
429
  "X-Fern-Language": "JavaScript",
430
430
  "X-Fern-SDK-Name": "@credal/sdk",
431
- "X-Fern-SDK-Version": "0.0.15",
432
- "User-Agent": "@credal/sdk/0.0.15",
431
+ "X-Fern-SDK-Version": "0.0.17",
432
+ "User-Agent": "@credal/sdk/0.0.17",
433
433
  "X-Fern-Runtime": core.RUNTIME.type,
434
434
  "X-Fern-Runtime-Version": core.RUNTIME.version,
435
435
  },
@@ -1,3 +1,5 @@
1
+ export * as actions from "./actions";
2
+ export * from "./actions/types";
1
3
  export * as common from "./common";
2
4
  export * from "./common/types";
3
5
  export * as copilots from "./copilots";
@@ -12,6 +14,7 @@ export * as search from "./search";
12
14
  export * from "./search/types";
13
15
  export * as users from "./users";
14
16
  export * from "./users/types";
17
+ export * from "./actions/client/requests";
15
18
  export * from "./copilots/client/requests";
16
19
  export * from "./documentCatalog/client/requests";
17
20
  export * from "./documentCollections/client/requests";
@@ -26,7 +26,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.users = exports.search = exports.permissionsService = exports.documentCollections = exports.documentCatalog = exports.copilots = exports.common = void 0;
29
+ exports.users = exports.search = exports.permissionsService = exports.documentCollections = exports.documentCatalog = exports.copilots = exports.common = exports.actions = void 0;
30
+ exports.actions = __importStar(require("./actions"));
31
+ __exportStar(require("./actions/types"), exports);
30
32
  exports.common = __importStar(require("./common"));
31
33
  __exportStar(require("./common/types"), exports);
32
34
  exports.copilots = __importStar(require("./copilots"));
@@ -41,6 +43,7 @@ exports.search = __importStar(require("./search"));
41
43
  __exportStar(require("./search/types"), exports);
42
44
  exports.users = __importStar(require("./users"));
43
45
  __exportStar(require("./users/types"), exports);
46
+ __exportStar(require("./actions/client/requests"), exports);
44
47
  __exportStar(require("./copilots/client/requests"), exports);
45
48
  __exportStar(require("./documentCatalog/client/requests"), exports);
46
49
  __exportStar(require("./documentCollections/client/requests"), exports);
@@ -74,8 +74,8 @@ class PermissionsService {
74
74
  Authorization: yield this._getAuthorizationHeader(),
75
75
  "X-Fern-Language": "JavaScript",
76
76
  "X-Fern-SDK-Name": "@credal/sdk",
77
- "X-Fern-SDK-Version": "0.0.15",
78
- "User-Agent": "@credal/sdk/0.0.15",
77
+ "X-Fern-SDK-Version": "0.0.17",
78
+ "User-Agent": "@credal/sdk/0.0.17",
79
79
  "X-Fern-Runtime": core.RUNTIME.type,
80
80
  "X-Fern-Runtime-Version": core.RUNTIME.version,
81
81
  },
@@ -146,8 +146,8 @@ class PermissionsService {
146
146
  Authorization: yield this._getAuthorizationHeader(),
147
147
  "X-Fern-Language": "JavaScript",
148
148
  "X-Fern-SDK-Name": "@credal/sdk",
149
- "X-Fern-SDK-Version": "0.0.15",
150
- "User-Agent": "@credal/sdk/0.0.15",
149
+ "X-Fern-SDK-Version": "0.0.17",
150
+ "User-Agent": "@credal/sdk/0.0.17",
151
151
  "X-Fern-Runtime": core.RUNTIME.type,
152
152
  "X-Fern-Runtime-Version": core.RUNTIME.version,
153
153
  },
@@ -210,8 +210,8 @@ class PermissionsService {
210
210
  Authorization: yield this._getAuthorizationHeader(),
211
211
  "X-Fern-Language": "JavaScript",
212
212
  "X-Fern-SDK-Name": "@credal/sdk",
213
- "X-Fern-SDK-Version": "0.0.15",
214
- "User-Agent": "@credal/sdk/0.0.15",
213
+ "X-Fern-SDK-Version": "0.0.17",
214
+ "User-Agent": "@credal/sdk/0.0.17",
215
215
  "X-Fern-Runtime": core.RUNTIME.type,
216
216
  "X-Fern-Runtime-Version": core.RUNTIME.version,
217
217
  },
@@ -84,8 +84,8 @@ class Search {
84
84
  Authorization: yield this._getAuthorizationHeader(),
85
85
  "X-Fern-Language": "JavaScript",
86
86
  "X-Fern-SDK-Name": "@credal/sdk",
87
- "X-Fern-SDK-Version": "0.0.15",
88
- "User-Agent": "@credal/sdk/0.0.15",
87
+ "X-Fern-SDK-Version": "0.0.17",
88
+ "User-Agent": "@credal/sdk/0.0.17",
89
89
  "X-Fern-Runtime": core.RUNTIME.type,
90
90
  "X-Fern-Runtime-Version": core.RUNTIME.version,
91
91
  },
@@ -79,8 +79,8 @@ class Users {
79
79
  Authorization: yield this._getAuthorizationHeader(),
80
80
  "X-Fern-Language": "JavaScript",
81
81
  "X-Fern-SDK-Name": "@credal/sdk",
82
- "X-Fern-SDK-Version": "0.0.15",
83
- "User-Agent": "@credal/sdk/0.0.15",
82
+ "X-Fern-SDK-Version": "0.0.17",
83
+ "User-Agent": "@credal/sdk/0.0.17",
84
84
  "X-Fern-Runtime": core.RUNTIME.type,
85
85
  "X-Fern-Runtime-Version": core.RUNTIME.version,
86
86
  },
package/dist/Client.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import * as environments from "./environments";
5
5
  import * as core from "./core";
6
+ import { Actions } from "./api/resources/actions/client/Client";
6
7
  import { Copilots } from "./api/resources/copilots/client/Client";
7
8
  import { DocumentCatalog } from "./api/resources/documentCatalog/client/Client";
8
9
  import { DocumentCollections } from "./api/resources/documentCollections/client/Client";
@@ -27,6 +28,8 @@ export declare namespace CredalClient {
27
28
  export declare class CredalClient {
28
29
  protected readonly _options: CredalClient.Options;
29
30
  constructor(_options?: CredalClient.Options);
31
+ protected _actions: Actions | undefined;
32
+ get actions(): Actions;
30
33
  protected _copilots: Copilots | undefined;
31
34
  get copilots(): Copilots;
32
35
  protected _documentCatalog: DocumentCatalog | undefined;
package/dist/Client.js CHANGED
@@ -4,39 +4,44 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CredalClient = void 0;
7
- const Client_1 = require("./api/resources/copilots/client/Client");
8
- const Client_2 = require("./api/resources/documentCatalog/client/Client");
9
- const Client_3 = require("./api/resources/documentCollections/client/Client");
10
- const Client_4 = require("./api/resources/permissionsService/client/Client");
11
- const Client_5 = require("./api/resources/search/client/Client");
12
- const Client_6 = require("./api/resources/users/client/Client");
7
+ const Client_1 = require("./api/resources/actions/client/Client");
8
+ const Client_2 = require("./api/resources/copilots/client/Client");
9
+ const Client_3 = require("./api/resources/documentCatalog/client/Client");
10
+ const Client_4 = require("./api/resources/documentCollections/client/Client");
11
+ const Client_5 = require("./api/resources/permissionsService/client/Client");
12
+ const Client_6 = require("./api/resources/search/client/Client");
13
+ const Client_7 = require("./api/resources/users/client/Client");
13
14
  class CredalClient {
14
15
  constructor(_options = {}) {
15
16
  this._options = _options;
16
17
  }
18
+ get actions() {
19
+ var _a;
20
+ return ((_a = this._actions) !== null && _a !== void 0 ? _a : (this._actions = new Client_1.Actions(this._options)));
21
+ }
17
22
  get copilots() {
18
23
  var _a;
19
- return ((_a = this._copilots) !== null && _a !== void 0 ? _a : (this._copilots = new Client_1.Copilots(this._options)));
24
+ return ((_a = this._copilots) !== null && _a !== void 0 ? _a : (this._copilots = new Client_2.Copilots(this._options)));
20
25
  }
21
26
  get documentCatalog() {
22
27
  var _a;
23
- return ((_a = this._documentCatalog) !== null && _a !== void 0 ? _a : (this._documentCatalog = new Client_2.DocumentCatalog(this._options)));
28
+ return ((_a = this._documentCatalog) !== null && _a !== void 0 ? _a : (this._documentCatalog = new Client_3.DocumentCatalog(this._options)));
24
29
  }
25
30
  get documentCollections() {
26
31
  var _a;
27
- return ((_a = this._documentCollections) !== null && _a !== void 0 ? _a : (this._documentCollections = new Client_3.DocumentCollections(this._options)));
32
+ return ((_a = this._documentCollections) !== null && _a !== void 0 ? _a : (this._documentCollections = new Client_4.DocumentCollections(this._options)));
28
33
  }
29
34
  get permissionsService() {
30
35
  var _a;
31
- return ((_a = this._permissionsService) !== null && _a !== void 0 ? _a : (this._permissionsService = new Client_4.PermissionsService(this._options)));
36
+ return ((_a = this._permissionsService) !== null && _a !== void 0 ? _a : (this._permissionsService = new Client_5.PermissionsService(this._options)));
32
37
  }
33
38
  get search() {
34
39
  var _a;
35
- return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_5.Search(this._options)));
40
+ return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_6.Search(this._options)));
36
41
  }
37
42
  get users() {
38
43
  var _a;
39
- return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_6.Users(this._options)));
44
+ return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_7.Users(this._options)));
40
45
  }
41
46
  }
42
47
  exports.CredalClient = CredalClient;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments";
5
+ import * as core from "../../../../core";
6
+ import * as Credal from "../../../index";
7
+ export declare namespace Actions {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.CredalEnvironment | string>;
10
+ apiKey?: core.Supplier<core.BearerToken | undefined>;
11
+ fetcher?: core.FetchFunction;
12
+ }
13
+ interface RequestOptions {
14
+ /** The maximum time to wait for a response in seconds. */
15
+ timeoutInSeconds?: number;
16
+ /** The number of times to retry the request. Defaults to 2. */
17
+ maxRetries?: number;
18
+ /** A hook to abort the request. */
19
+ abortSignal?: AbortSignal;
20
+ }
21
+ }
22
+ export declare class Actions {
23
+ protected readonly _options: Actions.Options;
24
+ constructor(_options?: Actions.Options);
25
+ /**
26
+ * Invoke an action, asking for human confirmation if necessary
27
+ *
28
+ * @param {Credal.InvokeActionRequest} request
29
+ * @param {Actions.RequestOptions} requestOptions - Request-specific configuration.
30
+ *
31
+ * @example
32
+ * await client.actions.invokeAction({
33
+ * actionId: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
34
+ * userEmail: "string",
35
+ * requireHumanConfirmation: true,
36
+ * humanConfirmationChannel: {
37
+ * type: "directMessage",
38
+ * channelId: "string"
39
+ * },
40
+ * justification: "string",
41
+ * auditLogId: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"
42
+ * })
43
+ */
44
+ invokeAction(request: Credal.InvokeActionRequest, requestOptions?: Actions.RequestOptions): Promise<Credal.InvokeActionResponse>;
45
+ protected _getAuthorizationHeader(): Promise<string>;
46
+ }
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __importDefault = (this && this.__importDefault) || function (mod) {
38
+ return (mod && mod.__esModule) ? mod : { "default": mod };
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.Actions = void 0;
42
+ const environments = __importStar(require("../../../../environments"));
43
+ const core = __importStar(require("../../../../core"));
44
+ const serializers = __importStar(require("../../../../serialization/index"));
45
+ const url_join_1 = __importDefault(require("url-join"));
46
+ const errors = __importStar(require("../../../../errors/index"));
47
+ class Actions {
48
+ constructor(_options = {}) {
49
+ this._options = _options;
50
+ }
51
+ /**
52
+ * Invoke an action, asking for human confirmation if necessary
53
+ *
54
+ * @param {Credal.InvokeActionRequest} request
55
+ * @param {Actions.RequestOptions} requestOptions - Request-specific configuration.
56
+ *
57
+ * @example
58
+ * await client.actions.invokeAction({
59
+ * actionId: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
60
+ * userEmail: "string",
61
+ * requireHumanConfirmation: true,
62
+ * humanConfirmationChannel: {
63
+ * type: "directMessage",
64
+ * channelId: "string"
65
+ * },
66
+ * justification: "string",
67
+ * auditLogId: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"
68
+ * })
69
+ */
70
+ invokeAction(request, requestOptions) {
71
+ var _a, _b;
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
74
+ url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.CredalEnvironment.Production, "/v0/actions/invokeAction"),
75
+ method: "POST",
76
+ headers: {
77
+ Authorization: yield this._getAuthorizationHeader(),
78
+ "X-Fern-Language": "JavaScript",
79
+ "X-Fern-SDK-Name": "@credal/sdk",
80
+ "X-Fern-SDK-Version": "0.0.17",
81
+ "User-Agent": "@credal/sdk/0.0.17",
82
+ "X-Fern-Runtime": core.RUNTIME.type,
83
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
84
+ },
85
+ contentType: "application/json",
86
+ requestType: "json",
87
+ body: serializers.InvokeActionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
88
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
89
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
90
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
91
+ });
92
+ if (_response.ok) {
93
+ return serializers.InvokeActionResponse.parseOrThrow(_response.body, {
94
+ unrecognizedObjectKeys: "passthrough",
95
+ allowUnrecognizedUnionMembers: true,
96
+ allowUnrecognizedEnumValues: true,
97
+ breadcrumbsPrefix: ["response"],
98
+ });
99
+ }
100
+ if (_response.error.reason === "status-code") {
101
+ throw new errors.CredalError({
102
+ statusCode: _response.error.statusCode,
103
+ body: _response.error.body,
104
+ });
105
+ }
106
+ switch (_response.error.reason) {
107
+ case "non-json":
108
+ throw new errors.CredalError({
109
+ statusCode: _response.error.statusCode,
110
+ body: _response.error.rawBody,
111
+ });
112
+ case "timeout":
113
+ throw new errors.CredalTimeoutError();
114
+ case "unknown":
115
+ throw new errors.CredalError({
116
+ message: _response.error.errorMessage,
117
+ });
118
+ }
119
+ });
120
+ }
121
+ _getAuthorizationHeader() {
122
+ var _a;
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["CREDAL_API_KEY"];
125
+ if (bearer == null) {
126
+ throw new errors.CredalError({
127
+ message: "Please specify CREDAL_API_KEY when instantiating the client.",
128
+ });
129
+ }
130
+ return `Bearer ${bearer}`;
131
+ });
132
+ }
133
+ }
134
+ exports.Actions = Actions;