@ptkl/sdk 1.9.2 → 1.11.0
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/index.0.10.js +283 -78
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +7 -2
- package/dist/v0.10/api/index.d.ts +4 -0
- package/dist/v0.10/api/integrations/dms.d.ts +3 -1
- package/dist/v0.10/api/integrations/timber.d.ts +22 -0
- package/dist/v0.10/api/integrations.d.ts +2 -0
- package/dist/v0.10/api/kortex.d.ts +52 -0
- package/dist/v0.10/api/platform.d.ts +2 -0
- package/dist/v0.10/api/thunder.d.ts +5 -4
- package/dist/v0.10/index.cjs.js +283 -78
- package/dist/v0.10/index.esm.js +282 -79
- package/dist/v0.10/types/component.d.ts +25 -2
- package/dist/v0.10/types/integrations.d.ts +6 -0
- package/dist/v0.10/types/kortex.d.ts +294 -0
- package/dist/v0.10/types/thunder.d.ts +4 -0
- package/dist/v0.10/types/timber.d.ts +77 -0
- package/package.json +1 -1
package/dist/index.0.10.js
CHANGED
|
@@ -113,77 +113,60 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
113
113
|
super();
|
|
114
114
|
this.ref = ref;
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
dateTo: ctx.dateTo,
|
|
168
|
-
dateField: ctx.dateField,
|
|
169
|
-
};
|
|
170
|
-
if (ctx.only && ctx.only.length > 0) {
|
|
171
|
-
params.only = ctx.only;
|
|
172
|
-
}
|
|
173
|
-
else if (ctx.includeFields && ctx.includeFields.length > 0) {
|
|
174
|
-
// Backward-compatible alias. The API now prefers `only`.
|
|
175
|
-
params.includeFields = ctx.includeFields;
|
|
176
|
-
}
|
|
177
|
-
if (Object.keys(ctx.$adv || []).length > 0) {
|
|
178
|
-
params.$adv = [(_a = ctx.$adv) !== null && _a !== void 0 ? _a : {}];
|
|
179
|
-
}
|
|
180
|
-
if (ctx.$aggregate && ctx.$aggregate.length > 0) {
|
|
181
|
-
params.$aggregate = ctx.$aggregate;
|
|
116
|
+
find(filters, opts) {
|
|
117
|
+
if (opts && opts.stream === true) {
|
|
118
|
+
let onMetaCallback = () => { };
|
|
119
|
+
let onDataCallback = () => { };
|
|
120
|
+
let onErrorCallback;
|
|
121
|
+
let onEndCallback;
|
|
122
|
+
let isFirstLine = true;
|
|
123
|
+
const chainable = {
|
|
124
|
+
onMeta: (callback) => {
|
|
125
|
+
onMetaCallback = callback;
|
|
126
|
+
return chainable;
|
|
127
|
+
},
|
|
128
|
+
onData: (callback) => {
|
|
129
|
+
onDataCallback = callback;
|
|
130
|
+
return chainable;
|
|
131
|
+
},
|
|
132
|
+
onError: (callback) => {
|
|
133
|
+
onErrorCallback = callback;
|
|
134
|
+
return chainable;
|
|
135
|
+
},
|
|
136
|
+
onEnd: (callback) => {
|
|
137
|
+
onEndCallback = callback;
|
|
138
|
+
return chainable;
|
|
139
|
+
},
|
|
140
|
+
stream: () => {
|
|
141
|
+
const body = this._buildFindBody(filters, opts);
|
|
142
|
+
const handler = {
|
|
143
|
+
onData: async (doc) => {
|
|
144
|
+
if (isFirstLine) {
|
|
145
|
+
isFirstLine = false;
|
|
146
|
+
const result = onMetaCallback(doc);
|
|
147
|
+
if (result instanceof Promise)
|
|
148
|
+
await result;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const result = onDataCallback(doc);
|
|
152
|
+
if (result instanceof Promise)
|
|
153
|
+
await result;
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
onError: onErrorCallback,
|
|
157
|
+
onEnd: onEndCallback,
|
|
158
|
+
};
|
|
159
|
+
return this._streamNDJSON(`/v4/system/component/${this.ref}/models/stream`, {
|
|
160
|
+
'Accept': 'application/x-ndjson',
|
|
161
|
+
'Content-Type': 'application/json',
|
|
162
|
+
'Accept-Language': (opts === null || opts === void 0 ? void 0 : opts.locale) || 'en_US',
|
|
163
|
+
}, handler, body);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return chainable;
|
|
182
167
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
options: opts
|
|
186
|
-
}, {
|
|
168
|
+
const body = this._buildFindBody(filters, opts);
|
|
169
|
+
return this.client.post(`/v4/system/component/${this.ref}/models`, body, {
|
|
187
170
|
headers: {
|
|
188
171
|
"Accept-Language": (opts === null || opts === void 0 ? void 0 : opts.locale) || "en_US",
|
|
189
172
|
}
|
|
@@ -212,6 +195,34 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
212
195
|
}
|
|
213
196
|
return null;
|
|
214
197
|
}
|
|
198
|
+
/** @private Build the POST body shared by `find` (streaming and non-streaming) */
|
|
199
|
+
_buildFindBody(filters, opts) {
|
|
200
|
+
var _a, _b;
|
|
201
|
+
let ctx = { ...filters };
|
|
202
|
+
let offset = (_a = ctx.currentPage) !== null && _a !== void 0 ? _a : 0;
|
|
203
|
+
let limit = (ctx.perPage == null || ctx.perPage === -1) ? 10 : ctx.perPage;
|
|
204
|
+
let sortDesc = ctx.sortDesc ? -1 : 1;
|
|
205
|
+
if (ctx.filterOn === undefined)
|
|
206
|
+
ctx.filterOn = [];
|
|
207
|
+
const params = {
|
|
208
|
+
offset,
|
|
209
|
+
sortBy: ctx.sortBy,
|
|
210
|
+
sortDesc,
|
|
211
|
+
filter: ctx.filter,
|
|
212
|
+
filterOn: ctx.filterOn,
|
|
213
|
+
limit,
|
|
214
|
+
dateFrom: ctx.dateFrom,
|
|
215
|
+
dateTo: ctx.dateTo,
|
|
216
|
+
dateField: ctx.dateField,
|
|
217
|
+
};
|
|
218
|
+
if (ctx.only && ctx.only.length > 0)
|
|
219
|
+
params.only = ctx.only;
|
|
220
|
+
if (Object.keys(ctx.$adv || {}).length > 0)
|
|
221
|
+
params.$adv = [(_b = ctx.$adv) !== null && _b !== void 0 ? _b : {}];
|
|
222
|
+
if (ctx.$aggregate && ctx.$aggregate.length > 0)
|
|
223
|
+
params.$aggregate = ctx.$aggregate;
|
|
224
|
+
return { ...params, options: opts };
|
|
225
|
+
}
|
|
215
226
|
/**
|
|
216
227
|
* Get model by uuid
|
|
217
228
|
*
|
|
@@ -961,12 +972,13 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
961
972
|
}
|
|
962
973
|
|
|
963
974
|
class Thunder extends PlatformBaseClient {
|
|
964
|
-
async read(type, filters, flag,
|
|
975
|
+
async read(type, filters, flag, opts) {
|
|
976
|
+
const { only, ...options } = opts !== null && opts !== void 0 ? opts : {};
|
|
965
977
|
return await this.client.post("/v3/system/thunder", {
|
|
966
978
|
type,
|
|
967
979
|
filters,
|
|
968
980
|
flag,
|
|
969
|
-
options,
|
|
981
|
+
options: Object.keys(options).length ? options : undefined,
|
|
970
982
|
only,
|
|
971
983
|
});
|
|
972
984
|
}
|
|
@@ -981,14 +993,14 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
981
993
|
async operation(name, filters, data) {
|
|
982
994
|
return await this.write(name, filters, data, "Operation");
|
|
983
995
|
}
|
|
984
|
-
async find(name, filters,
|
|
985
|
-
return await this.read(name, filters, "Find",
|
|
996
|
+
async find(name, filters, options) {
|
|
997
|
+
return await this.read(name, filters, "Find", options);
|
|
986
998
|
}
|
|
987
|
-
async findOne(name, filters,
|
|
988
|
-
return await this.read(name, filters, "FindOne",
|
|
999
|
+
async findOne(name, filters, options) {
|
|
1000
|
+
return await this.read(name, filters, "FindOne", options);
|
|
989
1001
|
}
|
|
990
|
-
async paginate(name, filters, options
|
|
991
|
-
return await this.read(name, filters, "Paginate", options
|
|
1002
|
+
async paginate(name, filters, options) {
|
|
1003
|
+
return await this.read(name, filters, "Paginate", options);
|
|
992
1004
|
}
|
|
993
1005
|
async upsert(name, filters, data) {
|
|
994
1006
|
return await this.write(name, filters, data, "Upsert");
|
|
@@ -1296,6 +1308,145 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1296
1308
|
}
|
|
1297
1309
|
}
|
|
1298
1310
|
|
|
1311
|
+
const BASE = '/luma/kortex/v1';
|
|
1312
|
+
class Kortex extends PlatformBaseClient {
|
|
1313
|
+
// ── Agents ──
|
|
1314
|
+
async createAgent(data) {
|
|
1315
|
+
return await this.client.post(`${BASE}/agents`, data);
|
|
1316
|
+
}
|
|
1317
|
+
async listAgents(params) {
|
|
1318
|
+
return await this.client.get(`${BASE}/agents`, { params });
|
|
1319
|
+
}
|
|
1320
|
+
async getAgent(uuid) {
|
|
1321
|
+
return await this.client.get(`${BASE}/agents/${uuid}`);
|
|
1322
|
+
}
|
|
1323
|
+
async updateAgent(uuid, data) {
|
|
1324
|
+
return await this.client.patch(`${BASE}/agents/${uuid}`, data);
|
|
1325
|
+
}
|
|
1326
|
+
async deleteAgent(uuid) {
|
|
1327
|
+
return await this.client.delete(`${BASE}/agents/${uuid}`);
|
|
1328
|
+
}
|
|
1329
|
+
async listAgentKnowledgeBases(agentUUID) {
|
|
1330
|
+
return await this.client.get(`${BASE}/agents/${agentUUID}/knowledge-bases`);
|
|
1331
|
+
}
|
|
1332
|
+
// ── Knowledge Bases ──
|
|
1333
|
+
async createKnowledgeBase(data) {
|
|
1334
|
+
return await this.client.post(`${BASE}/knowledge-bases`, data);
|
|
1335
|
+
}
|
|
1336
|
+
async listKnowledgeBases(params) {
|
|
1337
|
+
return await this.client.get(`${BASE}/knowledge-bases`, { params });
|
|
1338
|
+
}
|
|
1339
|
+
async getKnowledgeBase(uuid) {
|
|
1340
|
+
return await this.client.get(`${BASE}/knowledge-bases/${uuid}`);
|
|
1341
|
+
}
|
|
1342
|
+
async updateKnowledgeBase(uuid, data) {
|
|
1343
|
+
return await this.client.put(`${BASE}/knowledge-bases/${uuid}`, data);
|
|
1344
|
+
}
|
|
1345
|
+
async deleteKnowledgeBase(uuid) {
|
|
1346
|
+
return await this.client.delete(`${BASE}/knowledge-bases/${uuid}`);
|
|
1347
|
+
}
|
|
1348
|
+
// ── Documents ──
|
|
1349
|
+
async listDocuments(kbUUID, params) {
|
|
1350
|
+
return await this.client.get(`${BASE}/knowledge-bases/${kbUUID}/documents`, { params });
|
|
1351
|
+
}
|
|
1352
|
+
async uploadDocument(kbUUID, formData) {
|
|
1353
|
+
return await this.client.post(`${BASE}/knowledge-bases/${kbUUID}/documents`, formData, {
|
|
1354
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
1355
|
+
timeout: 120000,
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
async getDocument(kbUUID, uuid) {
|
|
1359
|
+
return await this.client.get(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}`);
|
|
1360
|
+
}
|
|
1361
|
+
async deleteDocument(kbUUID, uuid) {
|
|
1362
|
+
return await this.client.delete(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}`);
|
|
1363
|
+
}
|
|
1364
|
+
async retryDocument(kbUUID, uuid) {
|
|
1365
|
+
return await this.client.post(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}/retry`);
|
|
1366
|
+
}
|
|
1367
|
+
// ── Conversations ──
|
|
1368
|
+
async createConversation(data) {
|
|
1369
|
+
return await this.client.post(`${BASE}/conversations`, data);
|
|
1370
|
+
}
|
|
1371
|
+
async listConversations(params) {
|
|
1372
|
+
return await this.client.get(`${BASE}/conversations`, { params });
|
|
1373
|
+
}
|
|
1374
|
+
async getConversation(uuid) {
|
|
1375
|
+
return await this.client.get(`${BASE}/conversations/${uuid}`);
|
|
1376
|
+
}
|
|
1377
|
+
async updateConversation(uuid, data) {
|
|
1378
|
+
return await this.client.put(`${BASE}/conversations/${uuid}`, data);
|
|
1379
|
+
}
|
|
1380
|
+
async deleteConversation(uuid) {
|
|
1381
|
+
return await this.client.delete(`${BASE}/conversations/${uuid}`);
|
|
1382
|
+
}
|
|
1383
|
+
async archiveConversation(uuid) {
|
|
1384
|
+
return await this.client.post(`${BASE}/conversations/${uuid}/archive`);
|
|
1385
|
+
}
|
|
1386
|
+
async unarchiveConversation(uuid) {
|
|
1387
|
+
return await this.client.post(`${BASE}/conversations/${uuid}/unarchive`);
|
|
1388
|
+
}
|
|
1389
|
+
async addParticipant(conversationUUID, data) {
|
|
1390
|
+
return await this.client.post(`${BASE}/conversations/${conversationUUID}/participants`, data);
|
|
1391
|
+
}
|
|
1392
|
+
async removeParticipant(conversationUUID, agentUUID) {
|
|
1393
|
+
return await this.client.delete(`${BASE}/conversations/${conversationUUID}/participants/${agentUUID}`);
|
|
1394
|
+
}
|
|
1395
|
+
// ── Messages / Completions ──
|
|
1396
|
+
async sendMessage(conversationUUID, data) {
|
|
1397
|
+
return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages`, data);
|
|
1398
|
+
}
|
|
1399
|
+
async streamMessage(conversationUUID, data) {
|
|
1400
|
+
return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages`, { ...data, stream: true }, {
|
|
1401
|
+
responseType: 'stream',
|
|
1402
|
+
timeout: 120000,
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
async listMessages(conversationUUID, params) {
|
|
1406
|
+
return await this.client.get(`${BASE}/conversations/${conversationUUID}/messages`, { params });
|
|
1407
|
+
}
|
|
1408
|
+
async injectMessage(conversationUUID, data) {
|
|
1409
|
+
return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages/inject`, data);
|
|
1410
|
+
}
|
|
1411
|
+
// ── OCR ──
|
|
1412
|
+
async ocr(data) {
|
|
1413
|
+
return await this.client.post(`${BASE}/ocr`, data, { timeout: 120000 });
|
|
1414
|
+
}
|
|
1415
|
+
// ── User Access ──
|
|
1416
|
+
async createUserAccess(data) {
|
|
1417
|
+
return await this.client.post(`${BASE}/user-access`, data);
|
|
1418
|
+
}
|
|
1419
|
+
async listUserAccess(params) {
|
|
1420
|
+
return await this.client.get(`${BASE}/user-access`, { params });
|
|
1421
|
+
}
|
|
1422
|
+
async getUserAccess(uuid) {
|
|
1423
|
+
return await this.client.get(`${BASE}/user-access/${uuid}`);
|
|
1424
|
+
}
|
|
1425
|
+
async updateUserAccess(uuid, data) {
|
|
1426
|
+
return await this.client.patch(`${BASE}/user-access/${uuid}`, data);
|
|
1427
|
+
}
|
|
1428
|
+
async deleteUserAccess(uuid) {
|
|
1429
|
+
return await this.client.delete(`${BASE}/user-access/${uuid}`);
|
|
1430
|
+
}
|
|
1431
|
+
async getUserMonthlyUsage(uuid, params) {
|
|
1432
|
+
return await this.client.get(`${BASE}/user-access/${uuid}/usage`, { params });
|
|
1433
|
+
}
|
|
1434
|
+
async getUserUsageBreakdown(uuid) {
|
|
1435
|
+
return await this.client.get(`${BASE}/user-access/${uuid}/usage/breakdown`);
|
|
1436
|
+
}
|
|
1437
|
+
async getMyAccess() {
|
|
1438
|
+
return await this.client.get(`${BASE}/my-access`);
|
|
1439
|
+
}
|
|
1440
|
+
// ── Usage (Admin) ──
|
|
1441
|
+
async listUsage(params) {
|
|
1442
|
+
return await this.client.get(`${BASE}/usage`, { params });
|
|
1443
|
+
}
|
|
1444
|
+
// ── Tier ──
|
|
1445
|
+
async getTier() {
|
|
1446
|
+
return await this.client.get(`${BASE}/tier`);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1299
1450
|
class Project extends PlatformBaseClient {
|
|
1300
1451
|
/**
|
|
1301
1452
|
* Get list of all projects for the current user
|
|
@@ -1520,6 +1671,9 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1520
1671
|
forge() {
|
|
1521
1672
|
return (new Forge()).setClient(this.client);
|
|
1522
1673
|
}
|
|
1674
|
+
kortex() {
|
|
1675
|
+
return (new Kortex()).setClient(this.client);
|
|
1676
|
+
}
|
|
1523
1677
|
component(ref) {
|
|
1524
1678
|
return (new Component(ref)).setClient(this.client);
|
|
1525
1679
|
}
|
|
@@ -1886,6 +2040,12 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1886
2040
|
async generateDocument(payload) {
|
|
1887
2041
|
return this.requestv2('POST', 'documents/document/generate', { data: payload });
|
|
1888
2042
|
}
|
|
2043
|
+
async listDocumentRevisions(path) {
|
|
2044
|
+
return this.requestv2('GET', `documents/revisions/${path}`);
|
|
2045
|
+
}
|
|
2046
|
+
async getDocumentRevision(path, version) {
|
|
2047
|
+
return this.requestv2('GET', `documents/revision/${path}`, { params: { version } });
|
|
2048
|
+
}
|
|
1889
2049
|
async fillPdf(data) {
|
|
1890
2050
|
const { input_path, output_path, output_pdf = false, output_type, output_file_name, replace, form_data, forms } = data;
|
|
1891
2051
|
const responseType = output_pdf ? 'arraybuffer' : 'json';
|
|
@@ -3432,6 +3592,45 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
3432
3592
|
}
|
|
3433
3593
|
}
|
|
3434
3594
|
|
|
3595
|
+
class Timber extends IntegrationsBaseClient {
|
|
3596
|
+
async query(params = {}) {
|
|
3597
|
+
const { data } = await this.client.get("/v1/timber/logs", {
|
|
3598
|
+
params: this.normalizeParams(params),
|
|
3599
|
+
});
|
|
3600
|
+
return data;
|
|
3601
|
+
}
|
|
3602
|
+
async write(payload) {
|
|
3603
|
+
const { data } = await this.client.post("/v1/timber/logs", payload);
|
|
3604
|
+
return data;
|
|
3605
|
+
}
|
|
3606
|
+
async usage() {
|
|
3607
|
+
const { data } = await this.client.get("/v1/timber/usage");
|
|
3608
|
+
return data;
|
|
3609
|
+
}
|
|
3610
|
+
async debug(message, payload) {
|
|
3611
|
+
return this.write({ ...payload, message, level: 'debug' });
|
|
3612
|
+
}
|
|
3613
|
+
async info(message, payload) {
|
|
3614
|
+
return this.write({ ...payload, message, level: 'info' });
|
|
3615
|
+
}
|
|
3616
|
+
async warn(message, payload) {
|
|
3617
|
+
return this.write({ ...payload, message, level: 'warn' });
|
|
3618
|
+
}
|
|
3619
|
+
async error(message, payload) {
|
|
3620
|
+
return this.write({ ...payload, message, level: 'error' });
|
|
3621
|
+
}
|
|
3622
|
+
normalizeParams(params) {
|
|
3623
|
+
const normalized = { ...params };
|
|
3624
|
+
if (params.from instanceof Date) {
|
|
3625
|
+
normalized.from = params.from.toISOString();
|
|
3626
|
+
}
|
|
3627
|
+
if (params.to instanceof Date) {
|
|
3628
|
+
normalized.to = params.to.toISOString();
|
|
3629
|
+
}
|
|
3630
|
+
return normalized;
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3435
3634
|
class Integrations extends IntegrationsBaseClient {
|
|
3436
3635
|
constructor(options) {
|
|
3437
3636
|
super(options);
|
|
@@ -3443,6 +3642,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
3443
3642
|
'protokol-payments': new Payments().setClient(this.client),
|
|
3444
3643
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
3445
3644
|
'protokol-ecommerce': new Ecommerce().setClient(this.client),
|
|
3645
|
+
'protokol-timber': new Timber().setClient(this.client),
|
|
3446
3646
|
};
|
|
3447
3647
|
}
|
|
3448
3648
|
getDMS() {
|
|
@@ -3469,6 +3669,9 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
3469
3669
|
getEcommerce() {
|
|
3470
3670
|
return this.getInterfaceOf('protokol-ecommerce');
|
|
3471
3671
|
}
|
|
3672
|
+
getTimber() {
|
|
3673
|
+
return this.getInterfaceOf('protokol-timber');
|
|
3674
|
+
}
|
|
3472
3675
|
async list() {
|
|
3473
3676
|
const { data } = await this.client.get("/v1/integrations");
|
|
3474
3677
|
return data;
|
|
@@ -3655,6 +3858,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
3655
3858
|
exports.Integration = Integrations;
|
|
3656
3859
|
exports.Integrations = Integrations;
|
|
3657
3860
|
exports.Invoicing = Invoicing;
|
|
3861
|
+
exports.Kortex = Kortex;
|
|
3658
3862
|
exports.Mail = Mail;
|
|
3659
3863
|
exports.NBS = NBS;
|
|
3660
3864
|
exports.PRN = PRN;
|
|
@@ -3666,6 +3870,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
3666
3870
|
exports.SerbiaMinFin = MinFin;
|
|
3667
3871
|
exports.System = System;
|
|
3668
3872
|
exports.Thunder = Thunder;
|
|
3873
|
+
exports.Timber = Timber;
|
|
3669
3874
|
exports.Users = Users;
|
|
3670
3875
|
exports.VPFR = VPFR;
|
|
3671
3876
|
exports.Workflow = Workflow;
|
package/dist/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, StreamHandler, AggregateChainable, ComponentOptions, UpdateManyOptions, CreateManyOptions, Extension, Policy } from "../types/component";
|
|
1
|
+
import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, StreamHandler, AggregateChainable, FindChainable, FindStreamMeta, FindStreamMetaCallback, ComponentOptions, UpdateManyOptions, CreateManyOptions, Extension, Policy } from "../types/component";
|
|
2
2
|
import PlatformBaseClient from "./platformBaseClient";
|
|
3
3
|
import { AxiosResponse } from "axios";
|
|
4
4
|
import type { ComponentModels, ComponentFunctions } from "../types/functions";
|
|
@@ -38,6 +38,9 @@ export default class Component<C extends string = string> extends PlatformBaseCl
|
|
|
38
38
|
* }
|
|
39
39
|
* )
|
|
40
40
|
**/
|
|
41
|
+
find(filters: FindParams, opts: FindOptions & {
|
|
42
|
+
stream: true;
|
|
43
|
+
}): FindChainable;
|
|
41
44
|
find(filters: FindParams, opts?: FindOptions): Promise<AxiosResponse<{
|
|
42
45
|
items: ComponentModel<C>[];
|
|
43
46
|
total: number;
|
|
@@ -58,6 +61,8 @@ export default class Component<C extends string = string> extends PlatformBaseCl
|
|
|
58
61
|
* })
|
|
59
62
|
**/
|
|
60
63
|
findOne(filter: FindAdvancedParams, opts?: FindOptions): Promise<ComponentModel<C> | null>;
|
|
64
|
+
/** @private Build the POST body shared by `find` (streaming and non-streaming) */
|
|
65
|
+
private _buildFindBody;
|
|
61
66
|
/**
|
|
62
67
|
* Get model by uuid
|
|
63
68
|
*
|
|
@@ -323,4 +328,4 @@ export default class Component<C extends string = string> extends PlatformBaseCl
|
|
|
323
328
|
*/
|
|
324
329
|
private _streamNDJSONNode;
|
|
325
330
|
}
|
|
326
|
-
export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, StreamHandler, AggregateChainable, ComponentOptions, Extension, };
|
|
331
|
+
export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, StreamHandler, AggregateChainable, FindChainable, FindStreamMeta, FindStreamMetaCallback, ComponentOptions, Extension, };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type { PlatformFunctions, PlatformFunction, FunctionInput, FunctionOutput, FunctionCallParams, ComponentModels, ComponentFunctions, ComponentModel, ComponentFunctionInput, ComponentFunctionOutput, } from '../types/functions';
|
|
2
2
|
export type { Settings, SettingsField, FieldRoles, FieldConstraints, Context, Preset, PresetContext, Filters, Extension, Policy, SetupData, Model, } from '../types/component';
|
|
3
3
|
export type { WorkflowModel, WorkflowSettings, WorkflowNode, WorkflowNodeConnection, WorkflowCreatePayload, WorkflowUpdatePayload, WorkflowListResponse, } from '../types/workflow';
|
|
4
|
+
export type { PagedResponse as KortexPagedResponse, PaginationParams as KortexPaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document as KortexDocument, Participant, TokenUsage, ToolCall, RAGSource, Message as KortexMessage, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, } from '../types/kortex';
|
|
5
|
+
export type { TimberActor, TimberActorType, TimberChanges, TimberEntry, TimberLevel, TimberQueryParams, TimberQueryResponse, TimberSource, TimberUsage, TimberWritePayload, TimberLogPayload, } from '../types/timber';
|
|
4
6
|
export { default as Component } from './component';
|
|
5
7
|
export { default as Platform } from './platform';
|
|
6
8
|
export { default as Functions } from './functions';
|
|
@@ -14,6 +16,7 @@ export { default as Sandbox } from './sandbox';
|
|
|
14
16
|
export { default as System } from './system';
|
|
15
17
|
export { default as Workflow } from './workflow';
|
|
16
18
|
export { default as Forge } from './forge';
|
|
19
|
+
export { default as Kortex } from './kortex';
|
|
17
20
|
export { default as Project } from './project';
|
|
18
21
|
export { default as Config } from './config';
|
|
19
22
|
export { default as Integrations } from './integrations';
|
|
@@ -28,3 +31,4 @@ export { default as NBS } from './integrations/serbia/nbs';
|
|
|
28
31
|
export { default as VPFR } from './integrations/serbia/minfin/vpfr';
|
|
29
32
|
export { default as Mail } from './integrations/mail';
|
|
30
33
|
export { default as Ecommerce } from './integrations/ecommerce';
|
|
34
|
+
export { default as Timber } from './integrations/timber';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
2
|
import { AxiosResponse } from "axios";
|
|
3
|
-
import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoParams, DataInfo, DataValidationResult, ConversionOptions, HTML2PDFOptions, PDF2HTMLOptions, MediaUploadPayload, MediaUploadBase64Payload, DocumentListParams, DocumentListResponse, DocumentCreatePayload, DocumentUpdatePayload, DocumentRestorePayload, DocumentCommentPayload, DocumentResponse, DocumentGeneratePayload, DocumentGenerateResponse } from "../../types/integrations";
|
|
3
|
+
import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoParams, DataInfo, DataValidationResult, ConversionOptions, HTML2PDFOptions, PDF2HTMLOptions, MediaUploadPayload, MediaUploadBase64Payload, DocumentListParams, DocumentListResponse, DocumentCreatePayload, DocumentUpdatePayload, DocumentRestorePayload, DocumentCommentPayload, DocumentResponse, DocumentGeneratePayload, DocumentGenerateResponse, DocumentRevisionListResponse } from "../../types/integrations";
|
|
4
4
|
/**
|
|
5
5
|
* Document Management System (DMS) API client
|
|
6
6
|
*
|
|
@@ -143,6 +143,8 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
143
143
|
restoreDocument(payload: DocumentRestorePayload): Promise<AxiosResponse<DocumentResponse>>;
|
|
144
144
|
createDocumentComment(payload: DocumentCommentPayload): Promise<AxiosResponse<any, any>>;
|
|
145
145
|
generateDocument(payload: DocumentGeneratePayload): Promise<AxiosResponse<DocumentGenerateResponse>>;
|
|
146
|
+
listDocumentRevisions(path: string): Promise<AxiosResponse<DocumentRevisionListResponse>>;
|
|
147
|
+
getDocumentRevision(path: string, version: string): Promise<AxiosResponse<DocumentResponse>>;
|
|
146
148
|
fillPdf(data: PDFFillOptions): Promise<AxiosResponse<any, any>>;
|
|
147
149
|
/**
|
|
148
150
|
* Convert data between different formats (JSON, CSV, Excel)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
|
+
import { TimberLogPayload, TimberQueryParams, TimberQueryResponse, TimberUsage, TimberWritePayload } from "../../types/timber";
|
|
3
|
+
export default class Timber extends IntegrationsBaseClient {
|
|
4
|
+
query(params?: TimberQueryParams): Promise<TimberQueryResponse>;
|
|
5
|
+
write(payload: TimberWritePayload): Promise<{
|
|
6
|
+
accepted: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
usage(): Promise<TimberUsage>;
|
|
9
|
+
debug(message: string, payload?: TimberLogPayload): Promise<{
|
|
10
|
+
accepted: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
info(message: string, payload?: TimberLogPayload): Promise<{
|
|
13
|
+
accepted: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
warn(message: string, payload?: TimberLogPayload): Promise<{
|
|
16
|
+
accepted: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
error(message: string, payload?: TimberLogPayload): Promise<{
|
|
19
|
+
accepted: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
private normalizeParams;
|
|
22
|
+
}
|
|
@@ -7,6 +7,7 @@ import Payments from "./integrations/payments";
|
|
|
7
7
|
import Minimax from "./integrations/minimax";
|
|
8
8
|
import NBS from "./integrations/serbia/nbs";
|
|
9
9
|
import Ecommerce from "./integrations/ecommerce";
|
|
10
|
+
import Timber from "./integrations/timber";
|
|
10
11
|
export default class Integrations extends IntegrationsBaseClient {
|
|
11
12
|
private integrations;
|
|
12
13
|
constructor(options?: {
|
|
@@ -22,6 +23,7 @@ export default class Integrations extends IntegrationsBaseClient {
|
|
|
22
23
|
getNBS(): NBS;
|
|
23
24
|
getSerbiaMinFin(): MinFin;
|
|
24
25
|
getEcommerce(): Ecommerce;
|
|
26
|
+
getTimber(): Timber;
|
|
25
27
|
list(): Promise<any>;
|
|
26
28
|
isInstalled(id: string): Promise<boolean>;
|
|
27
29
|
isActive(id: string): Promise<boolean>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import PlatformBaseClient from "./platformBaseClient";
|
|
3
|
+
import { PagedResponse, PaginationParams, Agent, AgentCreatePayload, AgentUpdatePayload, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, Message, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier } from '../types/kortex';
|
|
4
|
+
export default class Kortex extends PlatformBaseClient {
|
|
5
|
+
createAgent(data: AgentCreatePayload): Promise<AxiosResponse<Agent>>;
|
|
6
|
+
listAgents(params?: PaginationParams): Promise<AxiosResponse<PagedResponse<Agent>>>;
|
|
7
|
+
getAgent(uuid: string): Promise<AxiosResponse<Agent>>;
|
|
8
|
+
updateAgent(uuid: string, data: AgentUpdatePayload): Promise<AxiosResponse<Agent>>;
|
|
9
|
+
deleteAgent(uuid: string): Promise<AxiosResponse<void>>;
|
|
10
|
+
listAgentKnowledgeBases(agentUUID: string): Promise<AxiosResponse<KnowledgeBase[]>>;
|
|
11
|
+
createKnowledgeBase(data: KnowledgeBaseCreatePayload): Promise<AxiosResponse<KnowledgeBase>>;
|
|
12
|
+
listKnowledgeBases(params?: PaginationParams): Promise<AxiosResponse<PagedResponse<KnowledgeBase>>>;
|
|
13
|
+
getKnowledgeBase(uuid: string): Promise<AxiosResponse<KnowledgeBase>>;
|
|
14
|
+
updateKnowledgeBase(uuid: string, data: KnowledgeBaseUpdatePayload): Promise<AxiosResponse<KnowledgeBase>>;
|
|
15
|
+
deleteKnowledgeBase(uuid: string): Promise<AxiosResponse<void>>;
|
|
16
|
+
listDocuments(kbUUID: string, params?: PaginationParams): Promise<AxiosResponse<PagedResponse<Document>>>;
|
|
17
|
+
uploadDocument(kbUUID: string, formData: FormData): Promise<AxiosResponse<Document>>;
|
|
18
|
+
getDocument(kbUUID: string, uuid: string): Promise<AxiosResponse<Document>>;
|
|
19
|
+
deleteDocument(kbUUID: string, uuid: string): Promise<AxiosResponse<void>>;
|
|
20
|
+
retryDocument(kbUUID: string, uuid: string): Promise<AxiosResponse<void>>;
|
|
21
|
+
createConversation(data: ConversationCreatePayload): Promise<AxiosResponse<Conversation>>;
|
|
22
|
+
listConversations(params?: PaginationParams & {
|
|
23
|
+
all_users?: boolean;
|
|
24
|
+
archived?: boolean;
|
|
25
|
+
}): Promise<AxiosResponse<PagedResponse<Conversation>>>;
|
|
26
|
+
getConversation(uuid: string): Promise<AxiosResponse<Conversation>>;
|
|
27
|
+
updateConversation(uuid: string, data: ConversationUpdatePayload): Promise<AxiosResponse<Conversation>>;
|
|
28
|
+
deleteConversation(uuid: string): Promise<AxiosResponse<void>>;
|
|
29
|
+
archiveConversation(uuid: string): Promise<AxiosResponse<void>>;
|
|
30
|
+
unarchiveConversation(uuid: string): Promise<AxiosResponse<void>>;
|
|
31
|
+
addParticipant(conversationUUID: string, data: ParticipantAddPayload): Promise<AxiosResponse<any>>;
|
|
32
|
+
removeParticipant(conversationUUID: string, agentUUID: string): Promise<AxiosResponse<void>>;
|
|
33
|
+
sendMessage(conversationUUID: string, data: SendMessagePayload): Promise<AxiosResponse<Message>>;
|
|
34
|
+
streamMessage(conversationUUID: string, data: SendMessagePayload): Promise<AxiosResponse<ReadableStream>>;
|
|
35
|
+
listMessages(conversationUUID: string, params?: PaginationParams): Promise<AxiosResponse<PagedResponse<Message>>>;
|
|
36
|
+
injectMessage(conversationUUID: string, data: InjectMessagePayload): Promise<AxiosResponse<Message>>;
|
|
37
|
+
ocr(data: OCRPayload): Promise<AxiosResponse<OCRResult>>;
|
|
38
|
+
createUserAccess(data: UserAccessCreatePayload): Promise<AxiosResponse<UserAccess>>;
|
|
39
|
+
listUserAccess(params?: PaginationParams): Promise<AxiosResponse<PagedResponse<UserAccess>>>;
|
|
40
|
+
getUserAccess(uuid: string): Promise<AxiosResponse<UserAccess>>;
|
|
41
|
+
updateUserAccess(uuid: string, data: UserAccessUpdatePayload): Promise<AxiosResponse<UserAccess>>;
|
|
42
|
+
deleteUserAccess(uuid: string): Promise<AxiosResponse<void>>;
|
|
43
|
+
getUserMonthlyUsage(uuid: string, params?: {
|
|
44
|
+
month?: string;
|
|
45
|
+
}): Promise<AxiosResponse<UserMonthlyUsage>>;
|
|
46
|
+
getUserUsageBreakdown(uuid: string): Promise<AxiosResponse<UserUsageBreakdown>>;
|
|
47
|
+
getMyAccess(): Promise<AxiosResponse<MyAccess>>;
|
|
48
|
+
listUsage(params?: PaginationParams & {
|
|
49
|
+
month?: string;
|
|
50
|
+
}): Promise<AxiosResponse<PagedResponse<AggregatedUsage>>>;
|
|
51
|
+
getTier(): Promise<AxiosResponse<Tier>>;
|
|
52
|
+
}
|
|
@@ -11,6 +11,7 @@ import Sandbox from "./sandbox";
|
|
|
11
11
|
import System from "./system";
|
|
12
12
|
import Workflow from "./workflow";
|
|
13
13
|
import Forge from "./forge";
|
|
14
|
+
import Kortex from "./kortex";
|
|
14
15
|
import Project from "./project";
|
|
15
16
|
import Config from "./config";
|
|
16
17
|
import PlatformBaseClient from "./platformBaseClient";
|
|
@@ -22,6 +23,7 @@ export default class Platform extends PlatformBaseClient {
|
|
|
22
23
|
user(): Users;
|
|
23
24
|
app(appType: string): Apps;
|
|
24
25
|
forge(): Forge;
|
|
26
|
+
kortex(): Kortex;
|
|
25
27
|
component<C extends string>(ref: C): Component<C>;
|
|
26
28
|
componentUtils(): ComponentUtils;
|
|
27
29
|
ratchet(): Ratchet;
|