@chatbotkit/sdk 1.20.0 → 1.21.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.cjs +94 -52
- package/dist/cjs/client.d.ts +3 -13
- package/dist/cjs/contact/index.cjs +1 -1
- package/dist/cjs/contact/index.d.ts +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/param.cjs +1 -1
- package/dist/cjs/platform/content/doc/index.cjs +3 -0
- package/dist/cjs/platform/content/doc/index.d.ts +1 -0
- package/dist/cjs/platform/content/doc/v1.cjs +10 -0
- package/dist/cjs/platform/content/doc/v1.d.ts +5 -0
- package/dist/cjs/platform/content/manual/index.cjs +3 -0
- package/dist/cjs/platform/content/manual/index.d.ts +1 -0
- package/dist/cjs/platform/content/manual/v1.cjs +10 -0
- package/dist/cjs/platform/content/manual/v1.d.ts +5 -0
- package/dist/esm/client.d.ts +3 -13
- package/dist/esm/client.js +78 -33
- package/dist/esm/contact/index.d.ts +1 -1
- package/dist/esm/contact/index.js +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/platform/content/doc/index.d.ts +1 -0
- package/dist/esm/platform/content/doc/index.js +4 -1
- package/dist/esm/platform/content/doc/v1.d.ts +5 -0
- package/dist/esm/platform/content/doc/v1.js +9 -0
- package/dist/esm/platform/content/manual/index.d.ts +1 -0
- package/dist/esm/platform/content/manual/index.js +4 -1
- package/dist/esm/platform/content/manual/v1.d.ts +5 -0
- package/dist/esm/platform/content/manual/v1.js +9 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/cjs/client.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _ChatBotKitClient_secret, _ChatBotKitClient_baseUrl, _ChatBotKitClient_endpoints, _ChatBotKitClient_runAsUserId, _ChatBotKitClient_runAsChildUserEmail, _ChatBotKitClient_timezone, _ChatBotKitClient_headers, _ChatBotKitClient_timeout, _ChatBotKitClient_retries, _ChatBotKitClient_retryDelay, _ChatBotKitClient_retryTimeout, _ChatBotKitClient_fetchFn, _ChatBotKitClient_cacheMap;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.ChatBotKitClient = exports.ResponsePromise = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
4
6
|
const fetch_1 = require("@chatbotkit/fetch");
|
|
5
7
|
const fetchPlusPlus = (0, fetch_1.withRetry)((0, fetch_1.withTimeout)(fetch_1.fetch, { timeout: Infinity }), {
|
|
6
8
|
retries: 3,
|
|
@@ -30,25 +32,24 @@ class ResponsePromise {
|
|
|
30
32
|
return 'ResponsePromise';
|
|
31
33
|
}
|
|
32
34
|
async getRequest(params) {
|
|
33
|
-
var _a, _b, _c, _d;
|
|
34
35
|
let body;
|
|
35
36
|
const { method, headers, data, timeout, retries, retryDelay, retryTimeout, fetchFn, } = this.request;
|
|
36
37
|
if (data) {
|
|
37
|
-
body =
|
|
38
|
+
body = params?.data || data;
|
|
38
39
|
}
|
|
39
40
|
const url = this.url.toString();
|
|
40
|
-
const response = await (
|
|
41
|
-
method:
|
|
41
|
+
const response = await (params?.fetchFn || fetchFn || fetchPlusPlus)(url, {
|
|
42
|
+
method: params?.method || method,
|
|
42
43
|
headers: {
|
|
43
44
|
...headers,
|
|
44
|
-
...params
|
|
45
|
+
...params?.headers,
|
|
45
46
|
},
|
|
46
47
|
body,
|
|
47
48
|
...{
|
|
48
|
-
timeout:
|
|
49
|
-
retries:
|
|
50
|
-
retryDelay:
|
|
51
|
-
retryTimeout:
|
|
49
|
+
timeout: params?.timeout ?? timeout,
|
|
50
|
+
retries: params?.retries ?? retries,
|
|
51
|
+
retryDelay: params?.retryDelay ?? retryDelay,
|
|
52
|
+
retryTimeout: params?.retryTimeout ?? retryTimeout,
|
|
52
53
|
},
|
|
53
54
|
mode: 'cors',
|
|
54
55
|
cache: 'no-cache',
|
|
@@ -62,7 +63,7 @@ class ResponsePromise {
|
|
|
62
63
|
message = data.message || `HTTP Error: ${response.statusText}`;
|
|
63
64
|
code = data.code || `ERROR_${response.status}`;
|
|
64
65
|
}
|
|
65
|
-
catch
|
|
66
|
+
catch {
|
|
66
67
|
const data = standardErrors[response.status] || standardErrors.default;
|
|
67
68
|
message = data.message;
|
|
68
69
|
code = data.code;
|
|
@@ -127,10 +128,9 @@ class ResponsePromise {
|
|
|
127
128
|
yield* (0, fetch_1.jsonl)(response.body);
|
|
128
129
|
}
|
|
129
130
|
async cache(key = 'default') {
|
|
130
|
-
var _a;
|
|
131
131
|
const cacheKey = JSON.stringify({
|
|
132
132
|
key,
|
|
133
|
-
method:
|
|
133
|
+
method: this.request?.method || 'GET',
|
|
134
134
|
url: this.url.toString(),
|
|
135
135
|
});
|
|
136
136
|
if (!this.cacheMap.has(cacheKey)) {
|
|
@@ -154,35 +154,76 @@ class ResponsePromise {
|
|
|
154
154
|
exports.ResponsePromise = ResponsePromise;
|
|
155
155
|
class ChatBotKitClient {
|
|
156
156
|
constructor(options) {
|
|
157
|
-
this
|
|
158
|
-
this
|
|
157
|
+
_ChatBotKitClient_secret.set(this, null);
|
|
158
|
+
_ChatBotKitClient_baseUrl.set(this, void 0);
|
|
159
|
+
_ChatBotKitClient_endpoints.set(this, void 0);
|
|
160
|
+
_ChatBotKitClient_runAsUserId.set(this, void 0);
|
|
161
|
+
_ChatBotKitClient_runAsChildUserEmail.set(this, void 0);
|
|
162
|
+
_ChatBotKitClient_timezone.set(this, void 0);
|
|
163
|
+
_ChatBotKitClient_headers.set(this, void 0);
|
|
164
|
+
_ChatBotKitClient_timeout.set(this, void 0);
|
|
165
|
+
_ChatBotKitClient_retries.set(this, void 0);
|
|
166
|
+
_ChatBotKitClient_retryDelay.set(this, void 0);
|
|
167
|
+
_ChatBotKitClient_retryTimeout.set(this, void 0);
|
|
168
|
+
_ChatBotKitClient_fetchFn.set(this, void 0);
|
|
169
|
+
_ChatBotKitClient_cacheMap.set(this, void 0);
|
|
170
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_secret, options.secret, "f");
|
|
171
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_baseUrl, new URL(options.baseUrl || `https://api.chatbotkit.com`), "f");
|
|
159
172
|
if (options.host) {
|
|
160
|
-
this.
|
|
173
|
+
tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_baseUrl, "f").host = options.host;
|
|
161
174
|
}
|
|
162
175
|
if (options.protocol) {
|
|
163
|
-
this.
|
|
164
|
-
}
|
|
165
|
-
this
|
|
166
|
-
this
|
|
167
|
-
this
|
|
168
|
-
this
|
|
169
|
-
this
|
|
170
|
-
this
|
|
171
|
-
this
|
|
172
|
-
this
|
|
173
|
-
this
|
|
174
|
-
this
|
|
175
|
-
this
|
|
176
|
+
tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_baseUrl, "f").protocol = options.protocol;
|
|
177
|
+
}
|
|
178
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_endpoints, options.endpoints || {}, "f");
|
|
179
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_runAsUserId, options.runAsUserId, "f");
|
|
180
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_runAsChildUserEmail, options.runAsChildUserEmail, "f");
|
|
181
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_timezone, options.timezone, "f");
|
|
182
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_headers, options.headers || {}, "f");
|
|
183
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_timeout, options.timeout, "f");
|
|
184
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_retries, options.retries, "f");
|
|
185
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_retryDelay, options.retryDelay, "f");
|
|
186
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_retryTimeout, options.retryTimeout, "f");
|
|
187
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_fetchFn, options.fetchFn || fetchPlusPlus, "f");
|
|
188
|
+
tslib_1.__classPrivateFieldSet(this, _ChatBotKitClient_cacheMap, new Map(), "f");
|
|
189
|
+
}
|
|
190
|
+
extend(extensionOptions) {
|
|
191
|
+
const currentOptions = {
|
|
192
|
+
secret: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_secret, "f") || '',
|
|
193
|
+
baseUrl: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_baseUrl, "f").toString(),
|
|
194
|
+
endpoints: { ...tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_endpoints, "f") },
|
|
195
|
+
runAsUserId: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_runAsUserId, "f"),
|
|
196
|
+
runAsChildUserEmail: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_runAsChildUserEmail, "f"),
|
|
197
|
+
timezone: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_timezone, "f"),
|
|
198
|
+
headers: { ...tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_headers, "f") },
|
|
199
|
+
timeout: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_timeout, "f"),
|
|
200
|
+
retries: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_retries, "f"),
|
|
201
|
+
retryDelay: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_retryDelay, "f"),
|
|
202
|
+
retryTimeout: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_retryTimeout, "f"),
|
|
203
|
+
fetchFn: tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_fetchFn, "f"),
|
|
204
|
+
};
|
|
205
|
+
const mergedOptions = {
|
|
206
|
+
...currentOptions,
|
|
207
|
+
...extensionOptions,
|
|
208
|
+
endpoints: {
|
|
209
|
+
...currentOptions.endpoints,
|
|
210
|
+
...(extensionOptions.endpoints || {}),
|
|
211
|
+
},
|
|
212
|
+
headers: {
|
|
213
|
+
...currentOptions.headers,
|
|
214
|
+
...(extensionOptions.headers || {}),
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
return new this.constructor(mergedOptions);
|
|
176
218
|
}
|
|
177
219
|
clientFetch(path, options) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const url = new URL(this.endpoints[(options === null || options === void 0 ? void 0 : options.endpoint) || path] || path, this.url);
|
|
220
|
+
let method = options?.method;
|
|
221
|
+
const url = new URL(tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_endpoints, "f")[options?.endpoint || path] || path, tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_baseUrl, "f"));
|
|
181
222
|
if (url.hostname === 'api.chatbotkit.com' &&
|
|
182
223
|
url.pathname.startsWith('/api/')) {
|
|
183
224
|
url.pathname = url.pathname.substring(4);
|
|
184
225
|
}
|
|
185
|
-
if (options
|
|
226
|
+
if (options?.query) {
|
|
186
227
|
for (const key in options.query) {
|
|
187
228
|
const value = options.query[key];
|
|
188
229
|
if (typeof value === 'object') {
|
|
@@ -201,34 +242,34 @@ class ChatBotKitClient {
|
|
|
201
242
|
}
|
|
202
243
|
}
|
|
203
244
|
const headers = {
|
|
204
|
-
...this
|
|
245
|
+
...tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_headers, "f"),
|
|
205
246
|
};
|
|
206
|
-
if (!
|
|
207
|
-
if (this
|
|
208
|
-
headers['authorization'] = `Bearer ${this
|
|
247
|
+
if (!options?.external) {
|
|
248
|
+
if (tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_secret, "f")) {
|
|
249
|
+
headers['authorization'] = `Bearer ${tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_secret, "f")}`;
|
|
209
250
|
}
|
|
210
|
-
if (this
|
|
211
|
-
headers['x-runas-user-id'] = this
|
|
251
|
+
if (tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_runAsUserId, "f")) {
|
|
252
|
+
headers['x-runas-user-id'] = tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_runAsUserId, "f");
|
|
212
253
|
}
|
|
213
|
-
if (this
|
|
214
|
-
headers['x-runas-child-user-email'] = this
|
|
254
|
+
if (tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_runAsChildUserEmail, "f")) {
|
|
255
|
+
headers['x-runas-child-user-email'] = tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_runAsChildUserEmail, "f");
|
|
215
256
|
}
|
|
216
257
|
}
|
|
217
|
-
if (this
|
|
218
|
-
headers['x-timezone'] = this
|
|
258
|
+
if (tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_timezone, "f")) {
|
|
259
|
+
headers['x-timezone'] = tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_timezone, "f");
|
|
219
260
|
}
|
|
220
261
|
let data;
|
|
221
|
-
if (options
|
|
262
|
+
if (options?.record) {
|
|
222
263
|
method = method || 'POST';
|
|
223
264
|
data = JSON.stringify(options.record);
|
|
224
265
|
headers['content-type'] = 'application/json';
|
|
225
266
|
}
|
|
226
|
-
else if (options
|
|
267
|
+
else if (options?.buffer) {
|
|
227
268
|
method = method || 'POST';
|
|
228
269
|
data = options.buffer;
|
|
229
270
|
headers['content-type'] = 'application/octet-stream';
|
|
230
271
|
}
|
|
231
|
-
else if (options
|
|
272
|
+
else if (options?.file) {
|
|
232
273
|
method = method || 'POST';
|
|
233
274
|
data = new fetch_1.FormData();
|
|
234
275
|
data.append('file', new fetch_1.Blob([options.file.data], { type: options.file.type }), options.file.name);
|
|
@@ -236,20 +277,21 @@ class ChatBotKitClient {
|
|
|
236
277
|
else {
|
|
237
278
|
method = method || 'GET';
|
|
238
279
|
}
|
|
239
|
-
if (options
|
|
280
|
+
if (options?.headers) {
|
|
240
281
|
Object.assign(headers, options.headers);
|
|
241
282
|
}
|
|
242
283
|
const request = {
|
|
243
284
|
method,
|
|
244
285
|
headers,
|
|
245
286
|
data,
|
|
246
|
-
timeout:
|
|
247
|
-
retries:
|
|
248
|
-
retryDelay:
|
|
249
|
-
retryTimeout:
|
|
250
|
-
fetchFn:
|
|
287
|
+
timeout: options?.timeout ?? tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_timeout, "f"),
|
|
288
|
+
retries: options?.retries ?? tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_retries, "f"),
|
|
289
|
+
retryDelay: options?.retryDelay ?? tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_retryDelay, "f"),
|
|
290
|
+
retryTimeout: options?.retryTimeout ?? tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_retryTimeout, "f"),
|
|
291
|
+
fetchFn: options?.fetchFn || tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_fetchFn, "f"),
|
|
251
292
|
};
|
|
252
|
-
return new ResponsePromise(url, request, this
|
|
293
|
+
return new ResponsePromise(url, request, tslib_1.__classPrivateFieldGet(this, _ChatBotKitClient_cacheMap, "f"));
|
|
253
294
|
}
|
|
254
295
|
}
|
|
255
296
|
exports.ChatBotKitClient = ChatBotKitClient;
|
|
297
|
+
_ChatBotKitClient_secret = new WeakMap(), _ChatBotKitClient_baseUrl = new WeakMap(), _ChatBotKitClient_endpoints = new WeakMap(), _ChatBotKitClient_runAsUserId = new WeakMap(), _ChatBotKitClient_runAsChildUserEmail = new WeakMap(), _ChatBotKitClient_timezone = new WeakMap(), _ChatBotKitClient_headers = new WeakMap(), _ChatBotKitClient_timeout = new WeakMap(), _ChatBotKitClient_retries = new WeakMap(), _ChatBotKitClient_retryDelay = new WeakMap(), _ChatBotKitClient_retryTimeout = new WeakMap(), _ChatBotKitClient_fetchFn = new WeakMap(), _ChatBotKitClient_cacheMap = new WeakMap();
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -45,19 +45,7 @@ export class ResponsePromise<T, U> {
|
|
|
45
45
|
}
|
|
46
46
|
export class ChatBotKitClient {
|
|
47
47
|
constructor(options: ChatBotKitClientOptions);
|
|
48
|
-
|
|
49
|
-
url: URL;
|
|
50
|
-
endpoints: Record<string, string>;
|
|
51
|
-
runAsUserId: string;
|
|
52
|
-
runAsChildUserEmail: string;
|
|
53
|
-
timezone: string;
|
|
54
|
-
headers: Record<string, string>;
|
|
55
|
-
timeout: number;
|
|
56
|
-
retries: number;
|
|
57
|
-
retryDelay: number;
|
|
58
|
-
retryTimeout: boolean;
|
|
59
|
-
fetchFn: FetchFunction;
|
|
60
|
-
cacheMap: Map<any, any>;
|
|
48
|
+
extend(extensionOptions: Partial<ChatBotKitClientOptions>): this;
|
|
61
49
|
clientFetch<T, U>(path: string, options?: {
|
|
62
50
|
method?: string;
|
|
63
51
|
headers?: Record<string, any>;
|
|
@@ -77,10 +65,12 @@ export class ChatBotKitClient {
|
|
|
77
65
|
retryTimeout?: boolean;
|
|
78
66
|
fetchFn?: FetchFunction;
|
|
79
67
|
}): ResponsePromise<T, U>;
|
|
68
|
+
#private;
|
|
80
69
|
}
|
|
81
70
|
export type FetchFunction = import("@chatbotkit/fetch").FetchFn<import("@chatbotkit/fetch").withRetryOptions & import("@chatbotkit/fetch").withTimeoutOptions>;
|
|
82
71
|
export type ChatBotKitClientOptions = {
|
|
83
72
|
secret: string;
|
|
73
|
+
baseUrl?: string | URL;
|
|
84
74
|
host?: string;
|
|
85
75
|
protocol?: "http:" | "https:";
|
|
86
76
|
endpoints?: Record<string, string>;
|
|
@@ -13,7 +13,7 @@ class ContactClient extends client_js_1.ChatBotKitClient {
|
|
|
13
13
|
this.task = new index_js_4.TaskClient(options);
|
|
14
14
|
this.space = new index_js_3.SpaceClient(options);
|
|
15
15
|
this.conversation = new index_js_1.ConversationClient(options);
|
|
16
|
-
this.
|
|
16
|
+
this.secret = new index_js_2.SecretClient(options);
|
|
17
17
|
}
|
|
18
18
|
list(request) {
|
|
19
19
|
return (0, v1_js_1.listContacts)(this, request);
|
|
@@ -2,7 +2,7 @@ export class ContactClient extends ChatBotKitClient {
|
|
|
2
2
|
task: TaskClient;
|
|
3
3
|
space: SpaceClient;
|
|
4
4
|
conversation: ConversationClient;
|
|
5
|
-
|
|
5
|
+
secret: SecretClient;
|
|
6
6
|
list(request?: import("./v1.js").ContactListRequest): ResponsePromise<import("./v1.js").ContactListResponse, import("./v1.js").ContactListStreamType>;
|
|
7
7
|
fetch(contactId: string): ResponsePromise<import("./v1.js").ContactFetchResponse, never>;
|
|
8
8
|
create(request: import("./v1.js").ContactCreateRequest): Promise<import("./v1.js").ContactCreateResponse>;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ class ChatBotKit extends client_js_1.ChatBotKitClient {
|
|
|
50
50
|
this.bot = new index_js_2.BotClient(options);
|
|
51
51
|
this.channel = new index_js_3.ChannelClient(options);
|
|
52
52
|
this.file = new index_js_7.FileClient(options);
|
|
53
|
+
this.secret = new index_js_16.SecretClient(options);
|
|
53
54
|
this.magic = new index_js_10.MagicClient(options);
|
|
54
55
|
this.partner = new index_js_12.PartnerClient(options);
|
|
55
56
|
this.dataset = new index_js_6.DatasetClient(options);
|
|
@@ -64,7 +65,6 @@ class ChatBotKit extends client_js_1.ChatBotKitClient {
|
|
|
64
65
|
this.policy = new index_js_14.PolicyClient(options);
|
|
65
66
|
this.portal = new index_js_15.PortalClient(options);
|
|
66
67
|
this.usage = new index_js_21.UsageClient(options);
|
|
67
|
-
this.secrets = new index_js_16.SecretClient(options);
|
|
68
68
|
this.graphql = new index_js_8.GraphqlClient(options);
|
|
69
69
|
}
|
|
70
70
|
}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export class ChatBotKit extends ChatBotKitClient {
|
|
|
4
4
|
bot: BotClient;
|
|
5
5
|
channel: ChannelClient;
|
|
6
6
|
file: FileClient;
|
|
7
|
+
secret: SecretClient;
|
|
7
8
|
magic: MagicClient;
|
|
8
9
|
partner: PartnerClient;
|
|
9
10
|
dataset: DatasetClient;
|
|
@@ -18,7 +19,6 @@ export class ChatBotKit extends ChatBotKitClient {
|
|
|
18
19
|
policy: PolicyClient;
|
|
19
20
|
portal: PortalClient;
|
|
20
21
|
usage: UsageClient;
|
|
21
|
-
secrets: SecretClient;
|
|
22
22
|
graphql: GraphqlClient;
|
|
23
23
|
}
|
|
24
24
|
export default ChatBotKit;
|
package/dist/cjs/param.cjs
CHANGED
|
@@ -5,7 +5,7 @@ function buildParamString(name, params, defaultParams) {
|
|
|
5
5
|
const parts = [];
|
|
6
6
|
for (const [name, value] of Object.entries(params || {})) {
|
|
7
7
|
if (value) {
|
|
8
|
-
if (
|
|
8
|
+
if (defaultParams?.[name] != value) {
|
|
9
9
|
parts.push(`${name}=${value}`);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -10,6 +10,9 @@ class PlatformContentDocClient extends client_js_1.ChatBotKitClient {
|
|
|
10
10
|
list(request) {
|
|
11
11
|
return (0, v1_js_1.listPlatformContentDocs)(this, request);
|
|
12
12
|
}
|
|
13
|
+
search(request) {
|
|
14
|
+
return (0, v1_js_1.searchPlatformContentDocs)(this, request);
|
|
15
|
+
}
|
|
13
16
|
fetch(docId) {
|
|
14
17
|
return (0, v1_js_1.fetchPlatformContentDoc)(this, docId);
|
|
15
18
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export class PlatformContentDocClient extends ChatBotKitClient {
|
|
2
2
|
list(request?: import("./v1.js").PlatformContentDocListRequest): ResponsePromise<import("./v1.js").PlatformContentDocListResponse, import("./v1.js").PlatformContentDocListStreamType>;
|
|
3
|
+
search(request: import("./v1.js").PlatformContentDocSearchRequest): Promise<import("./v1.js").PlatformContentDocSearchResponse>;
|
|
3
4
|
fetch(docId: string): ResponsePromise<import("./v1.js").PlatformContentDocFetchResponse, never>;
|
|
4
5
|
}
|
|
5
6
|
export default PlatformContentDocClient;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listPlatformContentDocs = listPlatformContentDocs;
|
|
4
|
+
exports.searchPlatformContentDocs = searchPlatformContentDocs;
|
|
4
5
|
exports.fetchPlatformContentDoc = fetchPlatformContentDoc;
|
|
5
6
|
function listPlatformContentDocs(client, request) {
|
|
6
7
|
let url = `/api/v1/platform/content/doc/list`;
|
|
7
8
|
const response = client.clientFetch(url, { query: request });
|
|
8
9
|
return response;
|
|
9
10
|
}
|
|
11
|
+
async function searchPlatformContentDocs(client, request) {
|
|
12
|
+
const url = `/api/v1/platform/content/doc/search`;
|
|
13
|
+
const response = await client.clientFetch(url, {
|
|
14
|
+
record: {
|
|
15
|
+
...request,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
10
20
|
function fetchPlatformContentDoc(client, docId) {
|
|
11
21
|
const url = `/api/v1/platform/content/doc/${docId}/fetch`;
|
|
12
22
|
const response = client.clientFetch(url, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export function listPlatformContentDocs(client: ChatBotKitClient, request?: PlatformContentDocListRequest): ResponsePromise<PlatformContentDocListResponse, PlatformContentDocListStreamType>;
|
|
2
|
+
export function searchPlatformContentDocs(client: ChatBotKitClient, request: PlatformContentDocSearchRequest): Promise<PlatformContentDocSearchResponse>;
|
|
2
3
|
export function fetchPlatformContentDoc(client: ChatBotKitClient, docId: string): ResponsePromise<PlatformContentDocFetchResponse, never>;
|
|
3
4
|
export type ChatBotKitClient = import("../../../client.js").ChatBotKitClient;
|
|
4
5
|
export type ResponsePromise<T, U> = import("../../../client.js").ResponsePromise<T, U>;
|
|
@@ -11,4 +12,8 @@ export type PlatformContentDocListRequest = {
|
|
|
11
12
|
export type PlatformContentDocListResponse = import("../../../types/api/v1.js").operations["listPlatformContentDocs"]["responses"]["200"]["content"]["application/json"];
|
|
12
13
|
export type PlatformContentDocListItem = PlatformContentDocListResponse["items"][number];
|
|
13
14
|
export type PlatformContentDocListStreamType = import("../../../types/api/v1.js").operations["listPlatformContentDocs"]["responses"]["200"]["content"]["application/jsonl"];
|
|
15
|
+
export type PlatformContentDocSearchRequestBody = import("../../../types/api/v1.js").operations["searchPlatformContentDocs"]["requestBody"]["content"]["application/json"];
|
|
16
|
+
export type PlatformContentDocSearchRequest = PlatformContentDocSearchRequestBody;
|
|
17
|
+
export type PlatformContentDocSearchResponseBody = import("../../../types/api/v1.js").operations["searchPlatformContentDocs"]["responses"]["200"]["content"]["application/json"];
|
|
18
|
+
export type PlatformContentDocSearchResponse = PlatformContentDocSearchResponseBody;
|
|
14
19
|
export type PlatformContentDocFetchResponse = import("../../../types/api/v1.js").operations["fetchPlatformContentDoc"]["responses"]["200"]["content"]["application/json"];
|
|
@@ -10,6 +10,9 @@ class PlatformContentManualClient extends client_js_1.ChatBotKitClient {
|
|
|
10
10
|
list(request) {
|
|
11
11
|
return (0, v1_js_1.listPlatformContentManuals)(this, request);
|
|
12
12
|
}
|
|
13
|
+
search(request) {
|
|
14
|
+
return (0, v1_js_1.searchPlatformContentManuals)(this, request);
|
|
15
|
+
}
|
|
13
16
|
fetch(manualId) {
|
|
14
17
|
return (0, v1_js_1.fetchPlatformContentManual)(this, manualId);
|
|
15
18
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export class PlatformContentManualClient extends ChatBotKitClient {
|
|
2
2
|
list(request?: import("./v1.js").PlatformContentManualListRequest): ResponsePromise<import("./v1.js").PlatformContentManualListResponse, import("./v1.js").PlatformContentManualListStreamType>;
|
|
3
|
+
search(request: import("./v1.js").PlatformContentManualSearchRequest): Promise<import("./v1.js").PlatformContentManualSearchResponse>;
|
|
3
4
|
fetch(manualId: string): ResponsePromise<import("./v1.js").PlatformContentManualFetchResponse, never>;
|
|
4
5
|
}
|
|
5
6
|
export default PlatformContentManualClient;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listPlatformContentManuals = listPlatformContentManuals;
|
|
4
|
+
exports.searchPlatformContentManuals = searchPlatformContentManuals;
|
|
4
5
|
exports.fetchPlatformContentManual = fetchPlatformContentManual;
|
|
5
6
|
function listPlatformContentManuals(client, request) {
|
|
6
7
|
let url = `/api/v1/platform/content/manual/list`;
|
|
7
8
|
const response = client.clientFetch(url, { query: request });
|
|
8
9
|
return response;
|
|
9
10
|
}
|
|
11
|
+
async function searchPlatformContentManuals(client, request) {
|
|
12
|
+
const url = `/api/v1/platform/content/manual/search`;
|
|
13
|
+
const response = await client.clientFetch(url, {
|
|
14
|
+
record: {
|
|
15
|
+
...request,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
10
20
|
function fetchPlatformContentManual(client, manualId) {
|
|
11
21
|
const url = `/api/v1/platform/content/manual/${manualId}/fetch`;
|
|
12
22
|
const response = client.clientFetch(url, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export function listPlatformContentManuals(client: ChatBotKitClient, request?: PlatformContentManualListRequest): ResponsePromise<PlatformContentManualListResponse, PlatformContentManualListStreamType>;
|
|
2
|
+
export function searchPlatformContentManuals(client: ChatBotKitClient, request: PlatformContentManualSearchRequest): Promise<PlatformContentManualSearchResponse>;
|
|
2
3
|
export function fetchPlatformContentManual(client: ChatBotKitClient, manualId: string): ResponsePromise<PlatformContentManualFetchResponse, never>;
|
|
3
4
|
export type ChatBotKitClient = import("../../../client.js").ChatBotKitClient;
|
|
4
5
|
export type ResponsePromise<T, U> = import("../../../client.js").ResponsePromise<T, U>;
|
|
@@ -11,4 +12,8 @@ export type PlatformContentManualListRequest = {
|
|
|
11
12
|
export type PlatformContentManualListResponse = import("../../../types/api/v1.js").operations["listPlatformContentManuals"]["responses"]["200"]["content"]["application/json"];
|
|
12
13
|
export type PlatformContentManualListItem = PlatformContentManualListResponse["items"][number];
|
|
13
14
|
export type PlatformContentManualListStreamType = import("../../../types/api/v1.js").operations["listPlatformContentManuals"]["responses"]["200"]["content"]["application/jsonl"];
|
|
15
|
+
export type PlatformContentManualSearchRequestBody = import("../../../types/api/v1.js").operations["searchPlatformContentManuals"]["requestBody"]["content"]["application/json"];
|
|
16
|
+
export type PlatformContentManualSearchRequest = PlatformContentManualSearchRequestBody;
|
|
17
|
+
export type PlatformContentManualSearchResponseBody = import("../../../types/api/v1.js").operations["searchPlatformContentManuals"]["responses"]["200"]["content"]["application/json"];
|
|
18
|
+
export type PlatformContentManualSearchResponse = PlatformContentManualSearchResponseBody;
|
|
14
19
|
export type PlatformContentManualFetchResponse = import("../../../types/api/v1.js").operations["fetchPlatformContentManual"]["responses"]["200"]["content"]["application/json"];
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -45,19 +45,7 @@ export class ResponsePromise<T, U> {
|
|
|
45
45
|
}
|
|
46
46
|
export class ChatBotKitClient {
|
|
47
47
|
constructor(options: ChatBotKitClientOptions);
|
|
48
|
-
|
|
49
|
-
url: URL;
|
|
50
|
-
endpoints: Record<string, string>;
|
|
51
|
-
runAsUserId: string | undefined;
|
|
52
|
-
runAsChildUserEmail: string | undefined;
|
|
53
|
-
timezone: string | undefined;
|
|
54
|
-
headers: Record<string, string>;
|
|
55
|
-
timeout: number | undefined;
|
|
56
|
-
retries: number | undefined;
|
|
57
|
-
retryDelay: number | undefined;
|
|
58
|
-
retryTimeout: boolean | undefined;
|
|
59
|
-
fetchFn: FetchFunction;
|
|
60
|
-
cacheMap: Map<any, any>;
|
|
48
|
+
extend(extensionOptions: Partial<ChatBotKitClientOptions>): this;
|
|
61
49
|
clientFetch<T, U>(path: string, options?: {
|
|
62
50
|
method?: string;
|
|
63
51
|
headers?: Record<string, any>;
|
|
@@ -77,10 +65,12 @@ export class ChatBotKitClient {
|
|
|
77
65
|
retryTimeout?: boolean;
|
|
78
66
|
fetchFn?: FetchFunction;
|
|
79
67
|
}): ResponsePromise<T, U>;
|
|
68
|
+
#private;
|
|
80
69
|
}
|
|
81
70
|
export type FetchFunction = import("@chatbotkit/fetch").FetchFn<import("@chatbotkit/fetch").withRetryOptions & import("@chatbotkit/fetch").withTimeoutOptions>;
|
|
82
71
|
export type ChatBotKitClientOptions = {
|
|
83
72
|
secret: string;
|
|
73
|
+
baseUrl?: string | URL | undefined;
|
|
84
74
|
host?: string | undefined;
|
|
85
75
|
protocol?: "http:" | "https:" | undefined;
|
|
86
76
|
endpoints?: Record<string, string> | undefined;
|