@ptkl/sdk 1.14.0 → 1.15.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 +824 -127
- package/dist/index.0.9.js +22 -1
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +3 -2
- package/dist/v0.10/api/forge.d.ts +2 -1
- package/dist/v0.10/api/index.d.ts +2 -0
- package/dist/v0.10/api/integrations/dms.d.ts +93 -1
- package/dist/v0.10/api/integrations.d.ts +38 -0
- package/dist/v0.10/api/kortex.d.ts +4 -1
- package/dist/v0.10/api/platform.d.ts +44 -0
- package/dist/v0.10/api/project.d.ts +52 -11
- package/dist/v0.10/api/sandbox.d.ts +126 -2
- package/dist/v0.10/api/transactions.d.ts +75 -0
- package/dist/v0.10/api/users.d.ts +22 -3
- package/dist/v0.10/api/workflow.d.ts +25 -1
- package/dist/v0.10/index.cjs.js +824 -127
- package/dist/v0.10/index.esm.js +824 -128
- package/dist/v0.10/types/component.d.ts +9 -1
- package/dist/v0.10/types/integrations.d.ts +142 -0
- package/dist/v0.10/types/kortex.d.ts +16 -1
- package/dist/v0.10/types/sandbox.d.ts +116 -0
- package/dist/v0.10/types/transactions.d.ts +198 -0
- package/dist/v0.10/types/users.d.ts +10 -0
- package/dist/v0.10/types/workflow.d.ts +104 -1
- package/dist/v0.9/api/users.d.ts +22 -3
- package/dist/v0.9/index.cjs.js +22 -1
- package/dist/v0.9/index.esm.js +22 -1
- package/dist/v0.9/types/component.d.ts +1 -0
- package/dist/v0.9/types/users.d.ts +10 -0
- package/package.json +1 -1
package/dist/index.0.10.js
CHANGED
|
@@ -100,6 +100,9 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
100
100
|
this.env = null;
|
|
101
101
|
this.token = null;
|
|
102
102
|
this.host = null;
|
|
103
|
+
this.env = env;
|
|
104
|
+
this.token = token;
|
|
105
|
+
this.host = host;
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
|
|
@@ -117,6 +120,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
117
120
|
if (opts && opts.stream === true) {
|
|
118
121
|
let onMetaCallback = () => { };
|
|
119
122
|
let onDataCallback = () => { };
|
|
123
|
+
let onCursorCallback = () => { };
|
|
120
124
|
let onErrorCallback;
|
|
121
125
|
let onEndCallback;
|
|
122
126
|
let isFirstLine = true;
|
|
@@ -129,6 +133,10 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
129
133
|
onDataCallback = callback;
|
|
130
134
|
return chainable;
|
|
131
135
|
},
|
|
136
|
+
onCursor: (callback) => {
|
|
137
|
+
onCursorCallback = callback;
|
|
138
|
+
return chainable;
|
|
139
|
+
},
|
|
132
140
|
onError: (callback) => {
|
|
133
141
|
onErrorCallback = callback;
|
|
134
142
|
return chainable;
|
|
@@ -147,6 +155,11 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
147
155
|
if (result instanceof Promise)
|
|
148
156
|
await result;
|
|
149
157
|
}
|
|
158
|
+
else if ('next_cursor' in doc && !('uuid' in doc)) {
|
|
159
|
+
const result = onCursorCallback(doc);
|
|
160
|
+
if (result instanceof Promise)
|
|
161
|
+
await result;
|
|
162
|
+
}
|
|
150
163
|
else {
|
|
151
164
|
const result = onDataCallback(doc);
|
|
152
165
|
if (result instanceof Promise)
|
|
@@ -217,6 +230,8 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
217
230
|
};
|
|
218
231
|
if (ctx.only && ctx.only.length > 0)
|
|
219
232
|
params.only = ctx.only;
|
|
233
|
+
if (ctx.cursor)
|
|
234
|
+
params.cursor = ctx.cursor;
|
|
220
235
|
if (Object.keys(ctx.$adv || {}).length > 0)
|
|
221
236
|
params.$adv = [(_b = ctx.$adv) !== null && _b !== void 0 ? _b : {}];
|
|
222
237
|
if (ctx.$aggregate && ctx.$aggregate.length > 0)
|
|
@@ -883,11 +898,32 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
883
898
|
}
|
|
884
899
|
// Permissions & Roles
|
|
885
900
|
/**
|
|
886
|
-
* Get
|
|
901
|
+
* Get the current token's permissions.
|
|
902
|
+
*
|
|
903
|
+
* Returns the resolved permission set carried by the calling token. For a
|
|
904
|
+
* forge actor token this is the scoped intersection minted at launch time —
|
|
905
|
+
* see `getPrincipalPermissions()` for the underlying user's full set.
|
|
887
906
|
*/
|
|
888
907
|
async getPermissions() {
|
|
889
908
|
return await this.client.get("/v1/user/role/permissions");
|
|
890
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* Get the FULL permissions of the user the current token is acting on behalf
|
|
912
|
+
* of (the "principal").
|
|
913
|
+
*
|
|
914
|
+
* When a forge app runs under an actor token, `getPermissions()` returns only
|
|
915
|
+
* the token's scoped permissions — the intersection of the app's declared
|
|
916
|
+
* runtime permissions and the user's permissions. This instead returns the
|
|
917
|
+
* complete permission set of the underlying user, so the app can check what
|
|
918
|
+
* that user is actually allowed to do, independent of what the app itself was
|
|
919
|
+
* granted. The token scope is unchanged: this exposes knowledge, not capability.
|
|
920
|
+
*
|
|
921
|
+
* For a normal user session (no actor token) it returns the caller's own
|
|
922
|
+
* permissions, identical to `getPermissions()`'s scope.
|
|
923
|
+
*/
|
|
924
|
+
async getPrincipalPermissions() {
|
|
925
|
+
return await this.client.get("/v1/user/role/principal-permissions");
|
|
926
|
+
}
|
|
891
927
|
/**
|
|
892
928
|
* Get list of available permissions
|
|
893
929
|
*/
|
|
@@ -972,7 +1008,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
972
1008
|
* @returns Promise resolving to the created/updated component
|
|
973
1009
|
*/
|
|
974
1010
|
async setup(data) {
|
|
975
|
-
return await this.client.post("/
|
|
1011
|
+
return await this.client.post("/v4/system/component/setup", data);
|
|
976
1012
|
}
|
|
977
1013
|
}
|
|
978
1014
|
|
|
@@ -1228,9 +1264,22 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1228
1264
|
}
|
|
1229
1265
|
}
|
|
1230
1266
|
|
|
1267
|
+
/**
|
|
1268
|
+
* Sandbox client — spark (FaaS) functions/apps, long-running runtimes, and
|
|
1269
|
+
* their K8s deployments. All routes go through the `sandbox/…` gateway
|
|
1270
|
+
* prefix (`/luma/sandbox/v1/...`), matching the sandbox service's REST
|
|
1271
|
+
* surface (`internal/controllers/{spark.go,spark.v1.go,runtime.v1.go}` and
|
|
1272
|
+
* the deployment lifecycle in `internal/controllers/ecomm/deployment.go`).
|
|
1273
|
+
*/
|
|
1231
1274
|
class Sandbox extends PlatformBaseClient {
|
|
1275
|
+
// ---------------------------------------------------------------
|
|
1276
|
+
// Spark (FaaS functions / apps)
|
|
1277
|
+
// ---------------------------------------------------------------
|
|
1232
1278
|
/**
|
|
1233
|
-
* Call the sandbox service to execute a serverless function
|
|
1279
|
+
* Call the sandbox service to execute a serverless function.
|
|
1280
|
+
*
|
|
1281
|
+
* Kept for backwards compatibility — equivalent to
|
|
1282
|
+
* `execSpark(name, data)`.
|
|
1234
1283
|
*
|
|
1235
1284
|
* @param name
|
|
1236
1285
|
* @param data
|
|
@@ -1242,6 +1291,143 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1242
1291
|
async spark(name, data) {
|
|
1243
1292
|
return await this.client.post(`/luma/sandbox/v1/spark/exec/${name}`, data);
|
|
1244
1293
|
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Create a new spark (function or app).
|
|
1296
|
+
*
|
|
1297
|
+
* @example
|
|
1298
|
+
* const spark = await platform.sandbox().createSpark({ name: "myFunction", runtime: "node20", memory: 256 })
|
|
1299
|
+
*/
|
|
1300
|
+
async createSpark(payload) {
|
|
1301
|
+
return await this.client.post(`/luma/sandbox/v1/spark`, payload);
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Get a spark by uuid.
|
|
1305
|
+
*/
|
|
1306
|
+
async getSpark(uuid) {
|
|
1307
|
+
return await this.client.get(`/luma/sandbox/v1/spark/${uuid}`);
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Update a spark's memory/settings/env vars.
|
|
1311
|
+
*/
|
|
1312
|
+
async updateSpark(uuid, payload) {
|
|
1313
|
+
return await this.client.patch(`/luma/sandbox/v1/spark/${uuid}`, payload);
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Delete a spark.
|
|
1317
|
+
*/
|
|
1318
|
+
async deleteSpark(uuid) {
|
|
1319
|
+
return await this.client.delete(`/luma/sandbox/v1/spark/${uuid}`);
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* List all sparks for the current project.
|
|
1323
|
+
*/
|
|
1324
|
+
async listSparks() {
|
|
1325
|
+
return await this.client.get(`/luma/sandbox/v1/spark`);
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Deploy a specific spark version to the dev environment.
|
|
1329
|
+
*/
|
|
1330
|
+
async deploySpark(uuid, version) {
|
|
1331
|
+
return await this.client.put(`/luma/sandbox/v1/spark/deploy/${uuid}/${version}`);
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Cancel an in-progress spark deployment.
|
|
1335
|
+
*
|
|
1336
|
+
* @param uuid
|
|
1337
|
+
* @param env - defaults to "dev" on the server if omitted
|
|
1338
|
+
*/
|
|
1339
|
+
async cancelSpark(uuid, env) {
|
|
1340
|
+
return await this.client.put(`/luma/sandbox/v1/spark/cancel/${uuid}`, undefined, { params: env ? { env } : undefined });
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Release a deployed spark version to the live/public environment.
|
|
1344
|
+
*/
|
|
1345
|
+
async releaseSpark(uuid, version) {
|
|
1346
|
+
return await this.client.put(`/luma/sandbox/v1/spark/release/${uuid}/${version}`);
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Execute a deployed spark by name. Mirrors `spark()` but accepts the
|
|
1350
|
+
* full request shape (method/query/headers) — the exec route accepts
|
|
1351
|
+
* GET/POST/PATCH/PUT/DELETE.
|
|
1352
|
+
*
|
|
1353
|
+
* @example
|
|
1354
|
+
* const result = await platform.sandbox().execSpark("myFunction", { foo: "bar" })
|
|
1355
|
+
* const result = await platform.sandbox().execSpark("myFunction", undefined, { method: "GET" })
|
|
1356
|
+
*/
|
|
1357
|
+
async execSpark(name, data, options) {
|
|
1358
|
+
var _a;
|
|
1359
|
+
const method = ((_a = options === null || options === void 0 ? void 0 : options.method) !== null && _a !== void 0 ? _a : "POST").toLowerCase();
|
|
1360
|
+
return await this.client.request({
|
|
1361
|
+
url: `/luma/sandbox/v1/spark/exec/${name}`,
|
|
1362
|
+
method,
|
|
1363
|
+
data,
|
|
1364
|
+
params: options === null || options === void 0 ? void 0 : options.query,
|
|
1365
|
+
headers: options === null || options === void 0 ? void 0 : options.headers,
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Fetch logs for a spark.
|
|
1370
|
+
*/
|
|
1371
|
+
async sparkLogs(uuid, params) {
|
|
1372
|
+
return await this.client.get(`/luma/sandbox/v1/spark/logs/${uuid}`, { params });
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Get the current project's spark tier (plan/quota).
|
|
1376
|
+
*/
|
|
1377
|
+
async sparkTier() {
|
|
1378
|
+
return await this.client.get(`/luma/sandbox/v1/spark/project/tier`);
|
|
1379
|
+
}
|
|
1380
|
+
// ---------------------------------------------------------------
|
|
1381
|
+
// Runtimes (long-running user API deployments)
|
|
1382
|
+
// ---------------------------------------------------------------
|
|
1383
|
+
/**
|
|
1384
|
+
* List all runtimes for the current project.
|
|
1385
|
+
*/
|
|
1386
|
+
async listRuntimes() {
|
|
1387
|
+
return await this.client.get(`/luma/sandbox/v1/runtime`);
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Create a new runtime.
|
|
1391
|
+
*/
|
|
1392
|
+
async createRuntime(payload) {
|
|
1393
|
+
return await this.client.post(`/luma/sandbox/v1/runtime`, payload);
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Get a runtime by ref (name/uuid).
|
|
1397
|
+
*/
|
|
1398
|
+
async getRuntime(ref) {
|
|
1399
|
+
return await this.client.get(`/luma/sandbox/v1/runtime/${ref}`);
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Update a runtime's image/resources/env vars/tags.
|
|
1403
|
+
*/
|
|
1404
|
+
async updateRuntime(ref, payload) {
|
|
1405
|
+
return await this.client.patch(`/luma/sandbox/v1/runtime/${ref}`, payload);
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Delete a runtime.
|
|
1409
|
+
*/
|
|
1410
|
+
async deleteRuntime(ref) {
|
|
1411
|
+
return await this.client.delete(`/luma/sandbox/v1/runtime/${ref}`);
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* (Re)deploy a runtime.
|
|
1415
|
+
*/
|
|
1416
|
+
async deployRuntime(ref) {
|
|
1417
|
+
return await this.client.post(`/luma/sandbox/v1/runtime/${ref}/deploy`);
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Restart a running runtime.
|
|
1421
|
+
*/
|
|
1422
|
+
async restartRuntime(ref) {
|
|
1423
|
+
return await this.client.post(`/luma/sandbox/v1/runtime/${ref}/restart`);
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Fetch logs for a runtime.
|
|
1427
|
+
*/
|
|
1428
|
+
async runtimeLogs(ref, params) {
|
|
1429
|
+
return await this.client.get(`/luma/sandbox/v1/runtime/${ref}/logs`, { params });
|
|
1430
|
+
}
|
|
1245
1431
|
}
|
|
1246
1432
|
|
|
1247
1433
|
class System extends PlatformBaseClient {
|
|
@@ -1269,6 +1455,17 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1269
1455
|
}
|
|
1270
1456
|
}
|
|
1271
1457
|
|
|
1458
|
+
function nodeControlQuery(options) {
|
|
1459
|
+
const params = new URLSearchParams();
|
|
1460
|
+
if ((options === null || options === void 0 ? void 0 : options.iterationIdx) !== undefined) {
|
|
1461
|
+
params.set('iteration_idx', String(options.iterationIdx));
|
|
1462
|
+
}
|
|
1463
|
+
if ((options === null || options === void 0 ? void 0 : options.parentNodeId) !== undefined) {
|
|
1464
|
+
params.set('parent_node_id', String(options.parentNodeId));
|
|
1465
|
+
}
|
|
1466
|
+
const qs = params.toString();
|
|
1467
|
+
return qs ? `?${qs}` : '';
|
|
1468
|
+
}
|
|
1272
1469
|
class Workflow extends PlatformBaseClient {
|
|
1273
1470
|
async create(data) {
|
|
1274
1471
|
return await this.client.post(`/v1/project/workflow/workflow`, data);
|
|
@@ -1291,6 +1488,68 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1291
1488
|
async publish(event, data) {
|
|
1292
1489
|
return await this.client.post(`/v1/project/workflow/workflow/event/${event}`, data);
|
|
1293
1490
|
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Install (create + publish) a workflow in one call.
|
|
1493
|
+
* Rejects if a workflow with the same name + integrator already exists.
|
|
1494
|
+
*/
|
|
1495
|
+
async install(data) {
|
|
1496
|
+
return await this.client.post(`/v1/project/workflow/workflow/install`, data);
|
|
1497
|
+
}
|
|
1498
|
+
// --- Execution history ---
|
|
1499
|
+
async getHistory(query) {
|
|
1500
|
+
return await this.client.get(`/v1/project/workflow/workflows/history`, { params: query });
|
|
1501
|
+
}
|
|
1502
|
+
async getHistoryEntry(executionUuid) {
|
|
1503
|
+
return await this.client.get(`/v1/project/workflow/workflows/history/${executionUuid}`);
|
|
1504
|
+
}
|
|
1505
|
+
async getStats(query) {
|
|
1506
|
+
return await this.client.get(`/v1/project/workflow/workflows/stats`, { params: query });
|
|
1507
|
+
}
|
|
1508
|
+
// --- Running executions ---
|
|
1509
|
+
async getRunning(query) {
|
|
1510
|
+
return await this.client.get(`/v1/project/workflow/workflows/running`, { params: query });
|
|
1511
|
+
}
|
|
1512
|
+
async getRunningEntry(executionUuid) {
|
|
1513
|
+
return await this.client.get(`/v1/project/workflow/workflows/running/${executionUuid}`);
|
|
1514
|
+
}
|
|
1515
|
+
// --- Workflow execution control ---
|
|
1516
|
+
async pause(executionUuid) {
|
|
1517
|
+
return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/pause`);
|
|
1518
|
+
}
|
|
1519
|
+
async resume(executionUuid) {
|
|
1520
|
+
return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/resume`);
|
|
1521
|
+
}
|
|
1522
|
+
async kill(executionUuid) {
|
|
1523
|
+
return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/kill`);
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Restart a failed/killed workflow execution from history.
|
|
1527
|
+
* `clearState: true` discards prior node state instead of a smart resume.
|
|
1528
|
+
*/
|
|
1529
|
+
async restart(executionUuid, options) {
|
|
1530
|
+
const qs = (options === null || options === void 0 ? void 0 : options.clearState) ? '?clear_state=true' : '';
|
|
1531
|
+
return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/restart${qs}`);
|
|
1532
|
+
}
|
|
1533
|
+
// --- Node-level control ---
|
|
1534
|
+
async pauseNode(executionUuid, nodeId, options) {
|
|
1535
|
+
return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/nodes/${nodeId}/pause${nodeControlQuery(options)}`);
|
|
1536
|
+
}
|
|
1537
|
+
async resumeNode(executionUuid, nodeId, options) {
|
|
1538
|
+
return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/nodes/${nodeId}/resume${nodeControlQuery(options)}`);
|
|
1539
|
+
}
|
|
1540
|
+
async killNode(executionUuid, nodeId, options) {
|
|
1541
|
+
return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/nodes/${nodeId}/kill${nodeControlQuery(options)}`);
|
|
1542
|
+
}
|
|
1543
|
+
// --- Errors ---
|
|
1544
|
+
async getErrors() {
|
|
1545
|
+
return await this.client.get(`/v1/project/workflow/errors`);
|
|
1546
|
+
}
|
|
1547
|
+
async removeError(id) {
|
|
1548
|
+
return await this.client.delete(`/v1/project/workflow/errors/${id}`);
|
|
1549
|
+
}
|
|
1550
|
+
async removeAllErrors() {
|
|
1551
|
+
return await this.client.delete(`/v1/project/workflow/errors`);
|
|
1552
|
+
}
|
|
1294
1553
|
}
|
|
1295
1554
|
|
|
1296
1555
|
/**
|
|
@@ -1403,7 +1662,8 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1403
1662
|
*
|
|
1404
1663
|
* Resolving the app does NOT grant access. Execution is still authorized against
|
|
1405
1664
|
* the caller's permissions — for a `platform`-access service the caller must hold
|
|
1406
|
-
* `
|
|
1665
|
+
* `service::{name} forge::{appUuid}`; `public`-access services require none. An
|
|
1666
|
+
* app's own runtime token is implicitly granted this for all of its own services.
|
|
1407
1667
|
*/
|
|
1408
1668
|
async runService(target, body, options) {
|
|
1409
1669
|
var _a;
|
|
@@ -1423,148 +1683,161 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1423
1683
|
}
|
|
1424
1684
|
// Service execution is owned by the forge runtime (forge-runtime gateway ->
|
|
1425
1685
|
// platform-forge), which resolves the ref (name → uuid, marketplace → custom)
|
|
1426
|
-
// and executes the service, enforcing `
|
|
1686
|
+
// and executes the service, enforcing `service::{name} forge::{uuid}`
|
|
1427
1687
|
// for platform-access services before running.
|
|
1428
1688
|
return await this.client.post(`/luma/forge-runtime/api/services/${ref}/${serviceName}${queryString}`, body !== null && body !== void 0 ? body : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
|
|
1429
1689
|
}
|
|
1430
1690
|
}
|
|
1431
1691
|
|
|
1432
|
-
const BASE = '/luma/kortex/v1';
|
|
1692
|
+
const BASE$1 = '/luma/kortex/v1';
|
|
1433
1693
|
class Kortex extends PlatformBaseClient {
|
|
1434
1694
|
// ── Agents ──
|
|
1435
1695
|
async createAgent(data) {
|
|
1436
|
-
return await this.client.post(`${BASE}/agents`, data);
|
|
1696
|
+
return await this.client.post(`${BASE$1}/agents`, data);
|
|
1437
1697
|
}
|
|
1438
1698
|
async listAgents(params) {
|
|
1439
|
-
return await this.client.get(`${BASE}/agents`, { params });
|
|
1699
|
+
return await this.client.get(`${BASE$1}/agents`, { params });
|
|
1440
1700
|
}
|
|
1441
1701
|
async getAgent(uuid) {
|
|
1442
|
-
return await this.client.get(`${BASE}/agents/${uuid}`);
|
|
1702
|
+
return await this.client.get(`${BASE$1}/agents/${uuid}`);
|
|
1443
1703
|
}
|
|
1444
1704
|
async updateAgent(uuid, data) {
|
|
1445
|
-
return await this.client.patch(`${BASE}/agents/${uuid}`, data);
|
|
1705
|
+
return await this.client.patch(`${BASE$1}/agents/${uuid}`, data);
|
|
1446
1706
|
}
|
|
1447
1707
|
async deleteAgent(uuid) {
|
|
1448
|
-
return await this.client.delete(`${BASE}/agents/${uuid}`);
|
|
1708
|
+
return await this.client.delete(`${BASE$1}/agents/${uuid}`);
|
|
1449
1709
|
}
|
|
1450
1710
|
async listAgentKnowledgeBases(agentUUID) {
|
|
1451
|
-
return await this.client.get(`${BASE}/agents/${agentUUID}/knowledge-bases`);
|
|
1711
|
+
return await this.client.get(`${BASE$1}/agents/${agentUUID}/knowledge-bases`);
|
|
1452
1712
|
}
|
|
1453
1713
|
// ── Knowledge Bases ──
|
|
1454
1714
|
async createKnowledgeBase(data) {
|
|
1455
|
-
return await this.client.post(`${BASE}/knowledge-bases`, data);
|
|
1715
|
+
return await this.client.post(`${BASE$1}/knowledge-bases`, data);
|
|
1456
1716
|
}
|
|
1457
1717
|
async listKnowledgeBases(params) {
|
|
1458
|
-
return await this.client.get(`${BASE}/knowledge-bases`, { params });
|
|
1718
|
+
return await this.client.get(`${BASE$1}/knowledge-bases`, { params });
|
|
1459
1719
|
}
|
|
1460
1720
|
async getKnowledgeBase(uuid) {
|
|
1461
|
-
return await this.client.get(`${BASE}/knowledge-bases/${uuid}`);
|
|
1721
|
+
return await this.client.get(`${BASE$1}/knowledge-bases/${uuid}`);
|
|
1462
1722
|
}
|
|
1463
1723
|
async updateKnowledgeBase(uuid, data) {
|
|
1464
|
-
return await this.client.put(`${BASE}/knowledge-bases/${uuid}`, data);
|
|
1724
|
+
return await this.client.put(`${BASE$1}/knowledge-bases/${uuid}`, data);
|
|
1465
1725
|
}
|
|
1466
1726
|
async deleteKnowledgeBase(uuid) {
|
|
1467
|
-
return await this.client.delete(`${BASE}/knowledge-bases/${uuid}`);
|
|
1727
|
+
return await this.client.delete(`${BASE$1}/knowledge-bases/${uuid}`);
|
|
1728
|
+
}
|
|
1729
|
+
// Searches the knowledge bases attached to `data.agent_uuid` (collections
|
|
1730
|
+
// are derived from the agent, not passed explicitly). `top_k` is clamped
|
|
1731
|
+
// to 1-10 server-side. Response is `{ chunks: KnowledgeBaseSearchChunk[] }`.
|
|
1732
|
+
async searchKnowledgeBase(data) {
|
|
1733
|
+
return await this.client.post(`${BASE$1}/knowledge-bases/search`, data);
|
|
1468
1734
|
}
|
|
1469
1735
|
// ── Documents ──
|
|
1470
1736
|
async listDocuments(kbUUID, params) {
|
|
1471
|
-
return await this.client.get(`${BASE}/knowledge-bases/${kbUUID}/documents`, { params });
|
|
1737
|
+
return await this.client.get(`${BASE$1}/knowledge-bases/${kbUUID}/documents`, { params });
|
|
1472
1738
|
}
|
|
1473
1739
|
async uploadDocument(kbUUID, formData) {
|
|
1474
|
-
return await this.client.post(`${BASE}/knowledge-bases/${kbUUID}/documents`, formData, {
|
|
1740
|
+
return await this.client.post(`${BASE$1}/knowledge-bases/${kbUUID}/documents`, formData, {
|
|
1475
1741
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
1476
1742
|
timeout: 120000,
|
|
1477
1743
|
});
|
|
1478
1744
|
}
|
|
1479
1745
|
async getDocument(kbUUID, uuid) {
|
|
1480
|
-
return await this.client.get(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}`);
|
|
1746
|
+
return await this.client.get(`${BASE$1}/knowledge-bases/${kbUUID}/documents/${uuid}`);
|
|
1481
1747
|
}
|
|
1482
1748
|
async deleteDocument(kbUUID, uuid) {
|
|
1483
|
-
return await this.client.delete(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}`);
|
|
1749
|
+
return await this.client.delete(`${BASE$1}/knowledge-bases/${kbUUID}/documents/${uuid}`);
|
|
1484
1750
|
}
|
|
1485
1751
|
async retryDocument(kbUUID, uuid) {
|
|
1486
|
-
return await this.client.post(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}/retry`);
|
|
1752
|
+
return await this.client.post(`${BASE$1}/knowledge-bases/${kbUUID}/documents/${uuid}/retry`);
|
|
1487
1753
|
}
|
|
1488
1754
|
// ── Conversations ──
|
|
1489
1755
|
async createConversation(data) {
|
|
1490
|
-
return await this.client.post(`${BASE}/conversations`, data);
|
|
1756
|
+
return await this.client.post(`${BASE$1}/conversations`, data);
|
|
1491
1757
|
}
|
|
1492
1758
|
async listConversations(params) {
|
|
1493
|
-
return await this.client.get(`${BASE}/conversations`, { params });
|
|
1759
|
+
return await this.client.get(`${BASE$1}/conversations`, { params });
|
|
1494
1760
|
}
|
|
1495
1761
|
async getConversation(uuid) {
|
|
1496
|
-
return await this.client.get(`${BASE}/conversations/${uuid}`);
|
|
1762
|
+
return await this.client.get(`${BASE$1}/conversations/${uuid}`);
|
|
1497
1763
|
}
|
|
1498
1764
|
async updateConversation(uuid, data) {
|
|
1499
|
-
return await this.client.put(`${BASE}/conversations/${uuid}`, data);
|
|
1765
|
+
return await this.client.put(`${BASE$1}/conversations/${uuid}`, data);
|
|
1500
1766
|
}
|
|
1501
1767
|
async deleteConversation(uuid) {
|
|
1502
|
-
return await this.client.delete(`${BASE}/conversations/${uuid}`);
|
|
1768
|
+
return await this.client.delete(`${BASE$1}/conversations/${uuid}`);
|
|
1503
1769
|
}
|
|
1504
1770
|
async archiveConversation(uuid) {
|
|
1505
|
-
return await this.client.post(`${BASE}/conversations/${uuid}/archive`);
|
|
1771
|
+
return await this.client.post(`${BASE$1}/conversations/${uuid}/archive`);
|
|
1506
1772
|
}
|
|
1507
1773
|
async unarchiveConversation(uuid) {
|
|
1508
|
-
return await this.client.post(`${BASE}/conversations/${uuid}/unarchive`);
|
|
1774
|
+
return await this.client.post(`${BASE$1}/conversations/${uuid}/unarchive`);
|
|
1509
1775
|
}
|
|
1510
1776
|
async addParticipant(conversationUUID, data) {
|
|
1511
|
-
return await this.client.post(`${BASE}/conversations/${conversationUUID}/participants`, data);
|
|
1777
|
+
return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/participants`, data);
|
|
1512
1778
|
}
|
|
1513
1779
|
async removeParticipant(conversationUUID, agentUUID) {
|
|
1514
|
-
return await this.client.delete(`${BASE}/conversations/${conversationUUID}/participants/${agentUUID}`);
|
|
1780
|
+
return await this.client.delete(`${BASE$1}/conversations/${conversationUUID}/participants/${agentUUID}`);
|
|
1515
1781
|
}
|
|
1516
1782
|
// ── Messages / Completions ──
|
|
1517
1783
|
async sendMessage(conversationUUID, data) {
|
|
1518
|
-
return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages`, data);
|
|
1784
|
+
return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages`, data);
|
|
1519
1785
|
}
|
|
1520
1786
|
async streamMessage(conversationUUID, data) {
|
|
1521
|
-
return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages`, { ...data, stream: true }, {
|
|
1787
|
+
return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages`, { ...data, stream: true }, {
|
|
1522
1788
|
responseType: 'stream',
|
|
1523
1789
|
timeout: 120000,
|
|
1524
1790
|
});
|
|
1525
1791
|
}
|
|
1526
1792
|
async listMessages(conversationUUID, params) {
|
|
1527
|
-
return await this.client.get(`${BASE}/conversations/${conversationUUID}/messages`, { params });
|
|
1793
|
+
return await this.client.get(`${BASE$1}/conversations/${conversationUUID}/messages`, { params });
|
|
1528
1794
|
}
|
|
1529
1795
|
async injectMessage(conversationUUID, data) {
|
|
1530
|
-
return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages/inject`, data);
|
|
1796
|
+
return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages/inject`, data);
|
|
1531
1797
|
}
|
|
1532
1798
|
// ── OCR ──
|
|
1533
1799
|
async ocr(data) {
|
|
1534
|
-
return await this.client.post(`${BASE}/ocr`, data, { timeout: 120000 });
|
|
1800
|
+
return await this.client.post(`${BASE$1}/ocr`, data, { timeout: 120000 });
|
|
1801
|
+
}
|
|
1802
|
+
// ── Workflow ──
|
|
1803
|
+
async workflowComplete(data) {
|
|
1804
|
+
return await this.client.post(`${BASE$1}/workflow/complete`, data);
|
|
1805
|
+
}
|
|
1806
|
+
async workflowOcr(data) {
|
|
1807
|
+
return await this.client.post(`${BASE$1}/workflow/ocr`, data, { timeout: 120000 });
|
|
1535
1808
|
}
|
|
1536
1809
|
// ── User Access ──
|
|
1537
1810
|
async createUserAccess(data) {
|
|
1538
|
-
return await this.client.post(`${BASE}/user-access`, data);
|
|
1811
|
+
return await this.client.post(`${BASE$1}/user-access`, data);
|
|
1539
1812
|
}
|
|
1540
1813
|
async listUserAccess(params) {
|
|
1541
|
-
return await this.client.get(`${BASE}/user-access`, { params });
|
|
1814
|
+
return await this.client.get(`${BASE$1}/user-access`, { params });
|
|
1542
1815
|
}
|
|
1543
1816
|
async getUserAccess(uuid) {
|
|
1544
|
-
return await this.client.get(`${BASE}/user-access/${uuid}`);
|
|
1817
|
+
return await this.client.get(`${BASE$1}/user-access/${uuid}`);
|
|
1545
1818
|
}
|
|
1546
1819
|
async updateUserAccess(uuid, data) {
|
|
1547
|
-
return await this.client.patch(`${BASE}/user-access/${uuid}`, data);
|
|
1820
|
+
return await this.client.patch(`${BASE$1}/user-access/${uuid}`, data);
|
|
1548
1821
|
}
|
|
1549
1822
|
async deleteUserAccess(uuid) {
|
|
1550
|
-
return await this.client.delete(`${BASE}/user-access/${uuid}`);
|
|
1823
|
+
return await this.client.delete(`${BASE$1}/user-access/${uuid}`);
|
|
1551
1824
|
}
|
|
1552
1825
|
async getUserMonthlyUsage(uuid, params) {
|
|
1553
|
-
return await this.client.get(`${BASE}/user-access/${uuid}/usage`, { params });
|
|
1826
|
+
return await this.client.get(`${BASE$1}/user-access/${uuid}/usage`, { params });
|
|
1554
1827
|
}
|
|
1555
1828
|
async getUserUsageBreakdown(uuid) {
|
|
1556
|
-
return await this.client.get(`${BASE}/user-access/${uuid}/usage/breakdown`);
|
|
1829
|
+
return await this.client.get(`${BASE$1}/user-access/${uuid}/usage/breakdown`);
|
|
1557
1830
|
}
|
|
1558
1831
|
async getMyAccess() {
|
|
1559
|
-
return await this.client.get(`${BASE}/my-access`);
|
|
1832
|
+
return await this.client.get(`${BASE$1}/my-access`);
|
|
1560
1833
|
}
|
|
1561
1834
|
// ── Usage (Admin) ──
|
|
1562
1835
|
async listUsage(params) {
|
|
1563
|
-
return await this.client.get(`${BASE}/usage`, { params });
|
|
1836
|
+
return await this.client.get(`${BASE$1}/usage`, { params });
|
|
1564
1837
|
}
|
|
1565
1838
|
// ── Tier ──
|
|
1566
1839
|
async getTier() {
|
|
1567
|
-
return await this.client.get(`${BASE}/tier`);
|
|
1840
|
+
return await this.client.get(`${BASE$1}/tier`);
|
|
1568
1841
|
}
|
|
1569
1842
|
}
|
|
1570
1843
|
|
|
@@ -1595,12 +1868,50 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1595
1868
|
return await this.client.patch("/v1/project/archive");
|
|
1596
1869
|
}
|
|
1597
1870
|
/**
|
|
1598
|
-
* Invite
|
|
1599
|
-
*
|
|
1600
|
-
*
|
|
1871
|
+
* Invite one or more users to the project.
|
|
1872
|
+
*
|
|
1873
|
+
* `POST /v1/project/invite` only accepts a single `email` per request
|
|
1874
|
+
* (see `InviteToProject` in platform-api's
|
|
1875
|
+
* `internal/project/controllers/invite.go`), so this method issues one
|
|
1876
|
+
* request per entry in `emails`, sequentially, with body
|
|
1877
|
+
* `{ email, role_uuid: roles, subject?, comment? }`.
|
|
1878
|
+
*
|
|
1879
|
+
* Return shape (always a single `AxiosResponse`, so existing callers
|
|
1880
|
+
* that do `(await project.invite(...)).data` keep compiling/working
|
|
1881
|
+
* unchanged):
|
|
1882
|
+
* - Exactly one email: the raw `AxiosResponse` from that single request
|
|
1883
|
+
* (`.data` is that invite's response body, as before).
|
|
1884
|
+
* - More than one email: a response shaped like the last request's
|
|
1885
|
+
* `AxiosResponse`, but with `.data` replaced by an array of each
|
|
1886
|
+
* individual request's `.data`, in the same order as `emails`.
|
|
1887
|
+
*
|
|
1888
|
+
* @param emails Array of email addresses to invite
|
|
1889
|
+
* @param roles Array of role UUIDs to grant every invitee
|
|
1890
|
+
* @param extra Optional subject/comment applied to every invite
|
|
1601
1891
|
*/
|
|
1602
|
-
async invite(emails, roles) {
|
|
1603
|
-
|
|
1892
|
+
async invite(emails, roles, extra) {
|
|
1893
|
+
const bodyExtra = {};
|
|
1894
|
+
if ((extra === null || extra === void 0 ? void 0 : extra.subject) !== undefined)
|
|
1895
|
+
bodyExtra.subject = extra.subject;
|
|
1896
|
+
if ((extra === null || extra === void 0 ? void 0 : extra.comment) !== undefined)
|
|
1897
|
+
bodyExtra.comment = extra.comment;
|
|
1898
|
+
const responses = [];
|
|
1899
|
+
for (const email of emails) {
|
|
1900
|
+
const res = await this.client.post("/v1/project/invite", {
|
|
1901
|
+
email,
|
|
1902
|
+
role_uuid: roles,
|
|
1903
|
+
...bodyExtra,
|
|
1904
|
+
});
|
|
1905
|
+
responses.push(res);
|
|
1906
|
+
}
|
|
1907
|
+
if (responses.length === 1) {
|
|
1908
|
+
return responses[0];
|
|
1909
|
+
}
|
|
1910
|
+
const last = responses[responses.length - 1];
|
|
1911
|
+
return {
|
|
1912
|
+
...last,
|
|
1913
|
+
data: responses.map((r) => r.data),
|
|
1914
|
+
};
|
|
1604
1915
|
}
|
|
1605
1916
|
/**
|
|
1606
1917
|
* Get list of project invites
|
|
@@ -1730,25 +2041,49 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1730
2041
|
return await this.client.get("/v1/project/template/workspace");
|
|
1731
2042
|
}
|
|
1732
2043
|
/**
|
|
1733
|
-
* Install a template
|
|
1734
|
-
*
|
|
2044
|
+
* Install a template.
|
|
2045
|
+
*
|
|
2046
|
+
* `POST /v1/project/template/install` decodes body `TemplateInstall = { id,
|
|
2047
|
+
* data, activation_code }` and resolves the target workspace from the
|
|
2048
|
+
* `X-Workspace-Uuid` request header (not the body) — see platform-api's
|
|
2049
|
+
* `template_install.go`. This method keeps the ergonomic object-arg
|
|
2050
|
+
* signature but maps it onto that contract: `template_id` becomes body
|
|
2051
|
+
* `id`, `workspace_uuid` is sent as the `X-Workspace-Uuid` header, and any
|
|
2052
|
+
* `data`/`activation_code` passed in are forwarded in the body as-is.
|
|
2053
|
+
*
|
|
2054
|
+
* @param data `{ template_id, workspace_uuid, data?, activation_code? }`
|
|
1735
2055
|
*/
|
|
1736
2056
|
async installTemplate(data) {
|
|
1737
|
-
|
|
2057
|
+
const { template_id, workspace_uuid, ...rest } = data;
|
|
2058
|
+
return await this.client.post("/v1/project/template/install", { id: template_id, ...rest }, { headers: { "X-Workspace-Uuid": workspace_uuid } });
|
|
1738
2059
|
}
|
|
1739
2060
|
/**
|
|
1740
|
-
* Uninstall a template
|
|
1741
|
-
*
|
|
2061
|
+
* Uninstall a template.
|
|
2062
|
+
*
|
|
2063
|
+
* `POST /v1/project/template/uninstall` decodes body `TemplateInstall = {
|
|
2064
|
+
* id, data, activation_code }` and resolves the target workspace from the
|
|
2065
|
+
* `X-Workspace-Uuid` request header (not the body) — see platform-api's
|
|
2066
|
+
* `template_uninstall.go`. See `installTemplate` for the mapping.
|
|
2067
|
+
*
|
|
2068
|
+
* @param data `{ template_id, workspace_uuid, data?, activation_code? }`
|
|
1742
2069
|
*/
|
|
1743
2070
|
async uninstallTemplate(data) {
|
|
1744
|
-
|
|
2071
|
+
const { template_id, workspace_uuid, ...rest } = data;
|
|
2072
|
+
return await this.client.post("/v1/project/template/uninstall", { id: template_id, ...rest }, { headers: { "X-Workspace-Uuid": workspace_uuid } });
|
|
1745
2073
|
}
|
|
1746
2074
|
/**
|
|
1747
|
-
* Upgrade a template
|
|
1748
|
-
*
|
|
2075
|
+
* Upgrade a template.
|
|
2076
|
+
*
|
|
2077
|
+
* `POST /v1/project/template/upgrade` decodes body `TemplateInstall = {
|
|
2078
|
+
* id, data, activation_code }` and resolves the target workspace from the
|
|
2079
|
+
* `X-Workspace-Uuid` request header (not the body) — see platform-api's
|
|
2080
|
+
* `template_upgrade.go`. See `installTemplate` for the mapping.
|
|
2081
|
+
*
|
|
2082
|
+
* @param data `{ template_id, workspace_uuid, data?, activation_code? }`
|
|
1749
2083
|
*/
|
|
1750
2084
|
async upgradeTemplate(data) {
|
|
1751
|
-
|
|
2085
|
+
const { template_id, workspace_uuid, ...rest } = data;
|
|
2086
|
+
return await this.client.post("/v1/project/template/upgrade", { id: template_id, ...rest }, { headers: { "X-Workspace-Uuid": workspace_uuid } });
|
|
1752
2087
|
}
|
|
1753
2088
|
}
|
|
1754
2089
|
|
|
@@ -1768,62 +2103,6 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1768
2103
|
}
|
|
1769
2104
|
}
|
|
1770
2105
|
|
|
1771
|
-
// apis
|
|
1772
|
-
class Platform extends PlatformBaseClient {
|
|
1773
|
-
getPlatformClient() {
|
|
1774
|
-
return this.client;
|
|
1775
|
-
}
|
|
1776
|
-
getPlatformBaseURL() {
|
|
1777
|
-
var _a;
|
|
1778
|
-
return (_a = this.client.defaults.baseURL) !== null && _a !== void 0 ? _a : "";
|
|
1779
|
-
}
|
|
1780
|
-
apiUser() {
|
|
1781
|
-
return (new APIUser()).setClient(this.client);
|
|
1782
|
-
}
|
|
1783
|
-
function() {
|
|
1784
|
-
return (new Functions()).setClient(this.client);
|
|
1785
|
-
}
|
|
1786
|
-
user() {
|
|
1787
|
-
return (new Users()).setClient(this.client);
|
|
1788
|
-
}
|
|
1789
|
-
app(appType) {
|
|
1790
|
-
return (new Apps(appType)).setClient(this.client);
|
|
1791
|
-
}
|
|
1792
|
-
forge() {
|
|
1793
|
-
return (new Forge()).setClient(this.client);
|
|
1794
|
-
}
|
|
1795
|
-
kortex() {
|
|
1796
|
-
return (new Kortex()).setClient(this.client);
|
|
1797
|
-
}
|
|
1798
|
-
component(ref) {
|
|
1799
|
-
return (new Component(ref)).setClient(this.client);
|
|
1800
|
-
}
|
|
1801
|
-
componentUtils() {
|
|
1802
|
-
return (new ComponentUtils()).setClient(this.client);
|
|
1803
|
-
}
|
|
1804
|
-
ratchet() {
|
|
1805
|
-
return (new Ratchet()).setClient(this.client);
|
|
1806
|
-
}
|
|
1807
|
-
sandbox() {
|
|
1808
|
-
return (new Sandbox()).setClient(this.client);
|
|
1809
|
-
}
|
|
1810
|
-
system() {
|
|
1811
|
-
return (new System()).setClient(this.client);
|
|
1812
|
-
}
|
|
1813
|
-
workflow() {
|
|
1814
|
-
return (new Workflow()).setClient(this.client);
|
|
1815
|
-
}
|
|
1816
|
-
thunder() {
|
|
1817
|
-
return (new Thunder()).setClient(this.client);
|
|
1818
|
-
}
|
|
1819
|
-
project() {
|
|
1820
|
-
return (new Project()).setClient(this.client);
|
|
1821
|
-
}
|
|
1822
|
-
config() {
|
|
1823
|
-
return (new Config()).setClient(this.client);
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
2106
|
class IntegrationsBaseClient extends BaseClient {
|
|
1828
2107
|
constructor(options) {
|
|
1829
2108
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -2702,6 +2981,135 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
2702
2981
|
timeout: 120000
|
|
2703
2982
|
});
|
|
2704
2983
|
}
|
|
2984
|
+
// ===================================================================
|
|
2985
|
+
// Backup (Library Export Archives)
|
|
2986
|
+
// ===================================================================
|
|
2987
|
+
/**
|
|
2988
|
+
* Create a library export archive (a snapshot of the project's library or a directory within it)
|
|
2989
|
+
*
|
|
2990
|
+
* The library is resolved server-side from the project in the auth context —
|
|
2991
|
+
* there is a single library per project.
|
|
2992
|
+
*
|
|
2993
|
+
* @param payload - Optional export scope/format options
|
|
2994
|
+
* @returns `{ mode, export }` when the export is queued asynchronously.
|
|
2995
|
+
* Depending on server-side sizing, the endpoint may instead stream the
|
|
2996
|
+
* archive back directly as a binary response body (not this JSON shape).
|
|
2997
|
+
*
|
|
2998
|
+
* @example
|
|
2999
|
+
* ```typescript
|
|
3000
|
+
* const result = await dms.createExport({ path: 'legal', format: 'zip' });
|
|
3001
|
+
* ```
|
|
3002
|
+
*/
|
|
3003
|
+
async createExport(payload) {
|
|
3004
|
+
return this.request('POST', `library/exports`, { data: payload !== null && payload !== void 0 ? payload : {} });
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* List export archives for the project's library
|
|
3008
|
+
*/
|
|
3009
|
+
async listExports() {
|
|
3010
|
+
return this.request('GET', `library/exports`);
|
|
3011
|
+
}
|
|
3012
|
+
/**
|
|
3013
|
+
* Get a single export archive (an archived snapshot of a library/dir)
|
|
3014
|
+
*
|
|
3015
|
+
* @param exportUuid - Export UUID
|
|
3016
|
+
* @returns `{ export, download_url }`
|
|
3017
|
+
*/
|
|
3018
|
+
async getExport(exportUuid) {
|
|
3019
|
+
return this.request('GET', `library/exports/${exportUuid}`);
|
|
3020
|
+
}
|
|
3021
|
+
// ===================================================================
|
|
3022
|
+
// Policies (Quota / File-Type / Notification, library & dir scope)
|
|
3023
|
+
// ===================================================================
|
|
3024
|
+
/**
|
|
3025
|
+
* Get the effective library-level policy for the project's library
|
|
3026
|
+
*/
|
|
3027
|
+
async getLibraryPolicy() {
|
|
3028
|
+
return this.request('GET', `library/policy`);
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* Set/update the library-level policy for the project's library
|
|
3032
|
+
*
|
|
3033
|
+
* @param payload - Policy fields to set
|
|
3034
|
+
*/
|
|
3035
|
+
async setLibraryPolicy(payload) {
|
|
3036
|
+
return this.request('PUT', `library/policy`, { data: payload });
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
3039
|
+
* Get the directory-level policy (resolves platform-default → library → dir)
|
|
3040
|
+
*
|
|
3041
|
+
* @param path - Directory path
|
|
3042
|
+
*/
|
|
3043
|
+
async getDirPolicy(path) {
|
|
3044
|
+
return this.request('GET', `library/dir/policy`, { params: { path } });
|
|
3045
|
+
}
|
|
3046
|
+
/**
|
|
3047
|
+
* Set/update the directory-level policy
|
|
3048
|
+
*
|
|
3049
|
+
* @param path - Directory path
|
|
3050
|
+
* @param payload - Policy fields to set (only fields provided override the library policy)
|
|
3051
|
+
*/
|
|
3052
|
+
async setDirPolicy(path, payload) {
|
|
3053
|
+
return this.request('PUT', `library/dir/policy`, { data: payload, params: { path } });
|
|
3054
|
+
}
|
|
3055
|
+
/**
|
|
3056
|
+
* Remove a directory-level policy override (directory falls back to the library policy)
|
|
3057
|
+
*
|
|
3058
|
+
* @param path - Directory path
|
|
3059
|
+
*/
|
|
3060
|
+
async deleteDirPolicy(path) {
|
|
3061
|
+
return this.request('DELETE', `library/dir/policy`, { params: { path } });
|
|
3062
|
+
}
|
|
3063
|
+
// ===================================================================
|
|
3064
|
+
// Reminders (Notification Rules & Per-File Notifications)
|
|
3065
|
+
// ===================================================================
|
|
3066
|
+
/**
|
|
3067
|
+
* List notification rules for the project's library
|
|
3068
|
+
*/
|
|
3069
|
+
async listNotificationRules() {
|
|
3070
|
+
return this.request('GET', `library/notification-rules`);
|
|
3071
|
+
}
|
|
3072
|
+
/**
|
|
3073
|
+
* Create a recurring reminder (notification rule) for a media file
|
|
3074
|
+
*
|
|
3075
|
+
* @param payload - Recurring reminder definition (media_uuid/file_key, frequency, start_at, ...)
|
|
3076
|
+
*/
|
|
3077
|
+
async createNotificationRule(payload) {
|
|
3078
|
+
return this.request('POST', `library/notification-rules`, { data: payload });
|
|
3079
|
+
}
|
|
3080
|
+
/**
|
|
3081
|
+
* Delete a notification rule
|
|
3082
|
+
*
|
|
3083
|
+
* @param ruleUuid - Notification rule UUID
|
|
3084
|
+
*/
|
|
3085
|
+
async deleteNotificationRule(ruleUuid) {
|
|
3086
|
+
return this.request('DELETE', `library/notification-rules/${ruleUuid}`);
|
|
3087
|
+
}
|
|
3088
|
+
/**
|
|
3089
|
+
* List custom reminders scheduled for a specific file
|
|
3090
|
+
*
|
|
3091
|
+
* @param mediaUuid - Media UUID
|
|
3092
|
+
*/
|
|
3093
|
+
async listFileNotifications(mediaUuid) {
|
|
3094
|
+
return this.request('GET', `library/media/${mediaUuid}/notifications`);
|
|
3095
|
+
}
|
|
3096
|
+
/**
|
|
3097
|
+
* Create a custom reminder for a specific file
|
|
3098
|
+
*
|
|
3099
|
+
* @param mediaUuid - Media UUID
|
|
3100
|
+
* @param payload - Reminder details (note, notify_at, optional recipient)
|
|
3101
|
+
*/
|
|
3102
|
+
async createFileNotification(mediaUuid, payload) {
|
|
3103
|
+
return this.request('POST', `library/media/${mediaUuid}/notifications`, { data: payload });
|
|
3104
|
+
}
|
|
3105
|
+
/**
|
|
3106
|
+
* Cancel/delete a custom file reminder
|
|
3107
|
+
*
|
|
3108
|
+
* @param notificationUuid - Notification UUID
|
|
3109
|
+
*/
|
|
3110
|
+
async deleteFileNotification(notificationUuid) {
|
|
3111
|
+
return this.request('DELETE', `library/notifications/${notificationUuid}`);
|
|
3112
|
+
}
|
|
2705
3113
|
async request(method, endpoint, params) {
|
|
2706
3114
|
return await this.client.request({
|
|
2707
3115
|
method: method,
|
|
@@ -3871,6 +4279,65 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
3871
4279
|
const { data } = await this.client.get("/v1/integrations");
|
|
3872
4280
|
return data.find((i) => i.id == id && i.status == "active") !== undefined;
|
|
3873
4281
|
}
|
|
4282
|
+
/**
|
|
4283
|
+
* Install (integrate) an integration into the current project.
|
|
4284
|
+
* POST /v1/integrate
|
|
4285
|
+
*/
|
|
4286
|
+
async install(id, data) {
|
|
4287
|
+
const { data: resp } = await this.client.post("/v1/integrate", {
|
|
4288
|
+
id,
|
|
4289
|
+
...(data !== undefined ? { data } : {}),
|
|
4290
|
+
});
|
|
4291
|
+
return resp;
|
|
4292
|
+
}
|
|
4293
|
+
/**
|
|
4294
|
+
* Uninstall (remove) an integration from the current project.
|
|
4295
|
+
* PUT /v1/integrate
|
|
4296
|
+
*/
|
|
4297
|
+
async uninstall(id) {
|
|
4298
|
+
const { data } = await this.client.put("/v1/integrate", { id });
|
|
4299
|
+
return data;
|
|
4300
|
+
}
|
|
4301
|
+
/**
|
|
4302
|
+
* Activate an installed integration.
|
|
4303
|
+
* POST /v1/integration/{id}/activate
|
|
4304
|
+
*/
|
|
4305
|
+
async activate(id) {
|
|
4306
|
+
const { data } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/activate`);
|
|
4307
|
+
return data;
|
|
4308
|
+
}
|
|
4309
|
+
/**
|
|
4310
|
+
* Deactivate an installed integration.
|
|
4311
|
+
* POST /v1/integration/{id}/deactivate
|
|
4312
|
+
*/
|
|
4313
|
+
async deactivate(id) {
|
|
4314
|
+
const { data } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/deactivate`);
|
|
4315
|
+
return data;
|
|
4316
|
+
}
|
|
4317
|
+
/**
|
|
4318
|
+
* Advance/update the onboarding state of an installed integration.
|
|
4319
|
+
* POST /v1/integration/{id}/onboarding
|
|
4320
|
+
*/
|
|
4321
|
+
async onboarding(id, data) {
|
|
4322
|
+
const { data: resp } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/onboarding`, data);
|
|
4323
|
+
return resp;
|
|
4324
|
+
}
|
|
4325
|
+
/**
|
|
4326
|
+
* List marketplace-available integrations (subscription/geo aware).
|
|
4327
|
+
* GET /v1/marketplace/integrations
|
|
4328
|
+
*/
|
|
4329
|
+
async marketplace() {
|
|
4330
|
+
const { data } = await this.client.get("/v1/marketplace/integrations");
|
|
4331
|
+
return data;
|
|
4332
|
+
}
|
|
4333
|
+
/**
|
|
4334
|
+
* List explorable integration templates (subscription/geo aware).
|
|
4335
|
+
* GET /v1/integrations/explore
|
|
4336
|
+
*/
|
|
4337
|
+
async explore() {
|
|
4338
|
+
const { data } = await this.client.get("/v1/integrations/explore");
|
|
4339
|
+
return data;
|
|
4340
|
+
}
|
|
3874
4341
|
getInterfaceOf(id) {
|
|
3875
4342
|
try {
|
|
3876
4343
|
return this.integrations[id];
|
|
@@ -3883,57 +4350,286 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
3883
4350
|
|
|
3884
4351
|
class Satellites extends IntegrationsBaseClient {
|
|
3885
4352
|
async list() {
|
|
3886
|
-
const { data } = await this.client.get('/satellites/templates');
|
|
4353
|
+
const { data } = await this.client.get('/v1/satellites/templates');
|
|
3887
4354
|
return data;
|
|
3888
4355
|
}
|
|
3889
4356
|
async create(payload) {
|
|
3890
|
-
const { data } = await this.client.post('/satellites/templates', payload.template);
|
|
4357
|
+
const { data } = await this.client.post('/v1/satellites/templates', payload.template);
|
|
3891
4358
|
if (payload.schema) {
|
|
3892
4359
|
await this.createVersion(data.id, payload.schema);
|
|
3893
4360
|
}
|
|
3894
4361
|
return data;
|
|
3895
4362
|
}
|
|
3896
4363
|
async get(id) {
|
|
3897
|
-
const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
|
|
4364
|
+
const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}`);
|
|
3898
4365
|
return data;
|
|
3899
4366
|
}
|
|
3900
4367
|
async delete(id) {
|
|
3901
|
-
const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
|
|
4368
|
+
const { data } = await this.client.delete(`/v1/satellites/templates/${encodeURIComponent(id)}`);
|
|
3902
4369
|
return data;
|
|
3903
4370
|
}
|
|
3904
4371
|
async createVersion(id, payload) {
|
|
3905
|
-
const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
|
|
4372
|
+
const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
|
|
3906
4373
|
return data;
|
|
3907
4374
|
}
|
|
3908
4375
|
async versions(id) {
|
|
3909
|
-
const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
|
|
4376
|
+
const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/versions`);
|
|
3910
4377
|
return data;
|
|
3911
4378
|
}
|
|
3912
4379
|
async deploy(id, payload) {
|
|
3913
|
-
const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
|
|
4380
|
+
const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
|
|
3914
4381
|
return data;
|
|
3915
4382
|
}
|
|
3916
4383
|
async rollback(id, payload) {
|
|
3917
|
-
const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
|
|
4384
|
+
const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
|
|
3918
4385
|
return data;
|
|
3919
4386
|
}
|
|
3920
4387
|
async permissions(id) {
|
|
3921
|
-
const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
|
|
4388
|
+
const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/permissions`);
|
|
3922
4389
|
return data;
|
|
3923
4390
|
}
|
|
3924
4391
|
async logs(id, params = {}) {
|
|
3925
4392
|
const since = params.since instanceof Date ? params.since.toISOString() : params.since;
|
|
3926
|
-
const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
|
|
4393
|
+
const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/logs`, {
|
|
3927
4394
|
params: since ? { since } : undefined,
|
|
3928
4395
|
});
|
|
3929
4396
|
return data;
|
|
3930
4397
|
}
|
|
3931
4398
|
async execute(id, command, payload = {}) {
|
|
3932
|
-
const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
|
|
4399
|
+
const { data } = await this.client.post(`/v1/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
|
|
3933
4400
|
return data;
|
|
3934
4401
|
}
|
|
3935
4402
|
}
|
|
3936
4403
|
|
|
4404
|
+
const BASE = "/luma/transactions/v1";
|
|
4405
|
+
/**
|
|
4406
|
+
* Transactions client — billing/subscriptions, invoices, credits/balance,
|
|
4407
|
+
* usage pricing and per-project billing-mode overrides. All routes go
|
|
4408
|
+
* through the `transactions/…` gateway prefix (`/luma/transactions/v1/...`),
|
|
4409
|
+
* matching the transactions service's REST surface
|
|
4410
|
+
* (`internal/controllers/{subscription,invoices,topup,credit_history,billing_modes,prices,balance}.go`).
|
|
4411
|
+
*
|
|
4412
|
+
* This is the **billing** service — not distributed/database transactions.
|
|
4413
|
+
*/
|
|
4414
|
+
class Transactions extends PlatformBaseClient {
|
|
4415
|
+
// ---------------------------------------------------------------
|
|
4416
|
+
// Subscriptions
|
|
4417
|
+
// ---------------------------------------------------------------
|
|
4418
|
+
/**
|
|
4419
|
+
* List all subscriptions (including expired) for the current project.
|
|
4420
|
+
*
|
|
4421
|
+
* @example
|
|
4422
|
+
* const subs = await platform.transactions().getSubscriptions()
|
|
4423
|
+
*/
|
|
4424
|
+
async getSubscriptions() {
|
|
4425
|
+
return await this.client.get(`${BASE}/billing/subscription`);
|
|
4426
|
+
}
|
|
4427
|
+
/**
|
|
4428
|
+
* Renew an expired subscription (and any others sharing its bundle
|
|
4429
|
+
* `ref_no`) — creates a renewal invoice and returns a checkout link.
|
|
4430
|
+
*/
|
|
4431
|
+
async renewSubscription(payload) {
|
|
4432
|
+
return await this.client.post(`${BASE}/subscription/renew`, payload);
|
|
4433
|
+
}
|
|
4434
|
+
/**
|
|
4435
|
+
* Cancel a subscription. Issues a refund automatically if still within
|
|
4436
|
+
* the refund period.
|
|
4437
|
+
*/
|
|
4438
|
+
async cancelSubscription(payload) {
|
|
4439
|
+
return await this.client.post(`${BASE}/subscription/cancel`, payload);
|
|
4440
|
+
}
|
|
4441
|
+
// ---------------------------------------------------------------
|
|
4442
|
+
// Invoices
|
|
4443
|
+
// ---------------------------------------------------------------
|
|
4444
|
+
/**
|
|
4445
|
+
* List all invoices for the current project.
|
|
4446
|
+
*/
|
|
4447
|
+
async getInvoices() {
|
|
4448
|
+
return await this.client.get(`${BASE}/billing/invoices`);
|
|
4449
|
+
}
|
|
4450
|
+
/**
|
|
4451
|
+
* Get a single invoice by uuid.
|
|
4452
|
+
*/
|
|
4453
|
+
async getInvoice(uuid) {
|
|
4454
|
+
return await this.client.get(`${BASE}/billing/invoice/${uuid}`);
|
|
4455
|
+
}
|
|
4456
|
+
/**
|
|
4457
|
+
* Download an invoice as a PDF. Resolves with the raw PDF bytes
|
|
4458
|
+
* (`responseType: "arraybuffer"`).
|
|
4459
|
+
*
|
|
4460
|
+
* @example
|
|
4461
|
+
* const { data } = await platform.transactions().getInvoicePdf(uuid)
|
|
4462
|
+
* fs.writeFileSync("invoice.pdf", Buffer.from(data))
|
|
4463
|
+
*/
|
|
4464
|
+
async getInvoicePdf(uuid) {
|
|
4465
|
+
return await this.client.get(`${BASE}/billing/invoice/${uuid}/pdf`, {
|
|
4466
|
+
responseType: "arraybuffer",
|
|
4467
|
+
});
|
|
4468
|
+
}
|
|
4469
|
+
// ---------------------------------------------------------------
|
|
4470
|
+
// Balance / credits / top-up
|
|
4471
|
+
// ---------------------------------------------------------------
|
|
4472
|
+
/**
|
|
4473
|
+
* Get the current project's credit balance.
|
|
4474
|
+
*/
|
|
4475
|
+
async getBalance() {
|
|
4476
|
+
return await this.client.get(`${BASE}/billing/balance`);
|
|
4477
|
+
}
|
|
4478
|
+
/**
|
|
4479
|
+
* Generate a checkout link to manually top up the project's credit balance.
|
|
4480
|
+
*/
|
|
4481
|
+
async topUp(payload) {
|
|
4482
|
+
return await this.client.post(`${BASE}/billing/topup`, payload);
|
|
4483
|
+
}
|
|
4484
|
+
/**
|
|
4485
|
+
* Get the project's credit activity (deductions/top-ups) history, paginated.
|
|
4486
|
+
*/
|
|
4487
|
+
async getCreditsHistory(query) {
|
|
4488
|
+
return await this.client.get(`${BASE}/billing/credits/history`, {
|
|
4489
|
+
params: query,
|
|
4490
|
+
});
|
|
4491
|
+
}
|
|
4492
|
+
// ---------------------------------------------------------------
|
|
4493
|
+
// Prices
|
|
4494
|
+
// ---------------------------------------------------------------
|
|
4495
|
+
/**
|
|
4496
|
+
* Get the usage-based pricing table for a given currency.
|
|
4497
|
+
*
|
|
4498
|
+
* @param currency - ISO 4217 currency code, e.g. "USD" or "RSD".
|
|
4499
|
+
*/
|
|
4500
|
+
async getPrices(currency) {
|
|
4501
|
+
return await this.client.get(`${BASE}/prices/${currency}`);
|
|
4502
|
+
}
|
|
4503
|
+
// ---------------------------------------------------------------
|
|
4504
|
+
// Billing modes (per-project usage billing overrides)
|
|
4505
|
+
// ---------------------------------------------------------------
|
|
4506
|
+
/**
|
|
4507
|
+
* Get the project's usage-billing-mode overrides plus platform defaults.
|
|
4508
|
+
*/
|
|
4509
|
+
async getBillingModes() {
|
|
4510
|
+
return await this.client.get(`${BASE}/billing/billing-modes`);
|
|
4511
|
+
}
|
|
4512
|
+
/**
|
|
4513
|
+
* Set the billing mode ("credits" | "hybrid" | "invoice") for a usage
|
|
4514
|
+
* option code on the current project.
|
|
4515
|
+
*/
|
|
4516
|
+
async updateBillingModes(payload) {
|
|
4517
|
+
return await this.client.put(`${BASE}/billing/billing-modes`, payload);
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
|
|
4521
|
+
// apis
|
|
4522
|
+
class Platform extends PlatformBaseClient {
|
|
4523
|
+
getPlatformClient() {
|
|
4524
|
+
return this.client;
|
|
4525
|
+
}
|
|
4526
|
+
getPlatformBaseURL() {
|
|
4527
|
+
var _a;
|
|
4528
|
+
return (_a = this.client.defaults.baseURL) !== null && _a !== void 0 ? _a : "";
|
|
4529
|
+
}
|
|
4530
|
+
apiUser() {
|
|
4531
|
+
return (new APIUser()).setClient(this.client);
|
|
4532
|
+
}
|
|
4533
|
+
function() {
|
|
4534
|
+
return (new Functions()).setClient(this.client);
|
|
4535
|
+
}
|
|
4536
|
+
user() {
|
|
4537
|
+
return (new Users()).setClient(this.client);
|
|
4538
|
+
}
|
|
4539
|
+
app(appType) {
|
|
4540
|
+
return (new Apps(appType)).setClient(this.client);
|
|
4541
|
+
}
|
|
4542
|
+
forge() {
|
|
4543
|
+
return (new Forge()).setClient(this.client);
|
|
4544
|
+
}
|
|
4545
|
+
kortex() {
|
|
4546
|
+
return (new Kortex()).setClient(this.client);
|
|
4547
|
+
}
|
|
4548
|
+
component(ref) {
|
|
4549
|
+
return (new Component(ref)).setClient(this.client);
|
|
4550
|
+
}
|
|
4551
|
+
componentUtils() {
|
|
4552
|
+
return (new ComponentUtils()).setClient(this.client);
|
|
4553
|
+
}
|
|
4554
|
+
ratchet() {
|
|
4555
|
+
return (new Ratchet()).setClient(this.client);
|
|
4556
|
+
}
|
|
4557
|
+
sandbox() {
|
|
4558
|
+
return (new Sandbox()).setClient(this.client);
|
|
4559
|
+
}
|
|
4560
|
+
system() {
|
|
4561
|
+
return (new System()).setClient(this.client);
|
|
4562
|
+
}
|
|
4563
|
+
workflow() {
|
|
4564
|
+
return (new Workflow()).setClient(this.client);
|
|
4565
|
+
}
|
|
4566
|
+
thunder() {
|
|
4567
|
+
return (new Thunder()).setClient(this.client);
|
|
4568
|
+
}
|
|
4569
|
+
project() {
|
|
4570
|
+
return (new Project()).setClient(this.client);
|
|
4571
|
+
}
|
|
4572
|
+
config() {
|
|
4573
|
+
return (new Config()).setClient(this.client);
|
|
4574
|
+
}
|
|
4575
|
+
/**
|
|
4576
|
+
* Convenience factory for the Integrations gateway façade.
|
|
4577
|
+
*
|
|
4578
|
+
* Integrations live behind a different gateway (`INTEGRATION_API` /
|
|
4579
|
+
* `host/luma/integrations`) than the rest of the platform API, so this
|
|
4580
|
+
* returns an independently-configured `Integrations` client (it does not
|
|
4581
|
+
* reuse `this.client`, whose base URL points at the platform host). The
|
|
4582
|
+
* Platform's resolved token/env/host are propagated so the child client
|
|
4583
|
+
* carries the same credentials.
|
|
4584
|
+
*/
|
|
4585
|
+
integrations() {
|
|
4586
|
+
return new Integrations(this.getIntegrationsGatewayOptions());
|
|
4587
|
+
}
|
|
4588
|
+
/**
|
|
4589
|
+
* Convenience factory for the Satellites (custom JSON-RPC integrations) client.
|
|
4590
|
+
*
|
|
4591
|
+
* Same gateway note as `integrations()` — Satellites talks to the
|
|
4592
|
+
* integrations gateway, not the platform host, so a fresh, independently
|
|
4593
|
+
* configured client is returned, with the Platform's credentials propagated.
|
|
4594
|
+
*/
|
|
4595
|
+
satellites() {
|
|
4596
|
+
return new Satellites(this.getIntegrationsGatewayOptions());
|
|
4597
|
+
}
|
|
4598
|
+
/**
|
|
4599
|
+
* Builds the options for a child integrations-gateway client (`Integrations`/
|
|
4600
|
+
* `Satellites`), propagating this Platform's resolved token/env, and deriving
|
|
4601
|
+
* the gateway host from this Platform's host when one was explicitly set.
|
|
4602
|
+
* When `this.host` is unset, `host` is left `undefined` so the child client's
|
|
4603
|
+
* own env-var/default resolution applies.
|
|
4604
|
+
*/
|
|
4605
|
+
getIntegrationsGatewayOptions() {
|
|
4606
|
+
var _a, _b;
|
|
4607
|
+
return {
|
|
4608
|
+
token: (_a = this.token) !== null && _a !== void 0 ? _a : undefined,
|
|
4609
|
+
env: (_b = this.env) !== null && _b !== void 0 ? _b : undefined,
|
|
4610
|
+
host: this.host ? `${this.host.replace(/\/+$/, "")}/luma/integrations` : undefined,
|
|
4611
|
+
};
|
|
4612
|
+
}
|
|
4613
|
+
/**
|
|
4614
|
+
* Transactions (billing) client — subscriptions, invoices, credits/balance,
|
|
4615
|
+
* usage pricing and billing-mode overrides. Reached through the platform
|
|
4616
|
+
* gateway (`transactions/…`), so it reuses `this.client` like the other
|
|
4617
|
+
* native/proxied-service factories.
|
|
4618
|
+
*
|
|
4619
|
+
* This is the **billing** service — not distributed/database transactions.
|
|
4620
|
+
*/
|
|
4621
|
+
transactions() {
|
|
4622
|
+
return (new Transactions()).setClient(this.client);
|
|
4623
|
+
}
|
|
4624
|
+
/**
|
|
4625
|
+
* Alias for `transactions()` — reads more naturally at call sites that
|
|
4626
|
+
* only care about billing (`platform.billing().getBalance()`).
|
|
4627
|
+
*/
|
|
4628
|
+
billing() {
|
|
4629
|
+
return this.transactions();
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4632
|
+
|
|
3937
4633
|
// PRN — Protokol Resource Name
|
|
3938
4634
|
//
|
|
3939
4635
|
// Format:
|
|
@@ -4112,6 +4808,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
4112
4808
|
exports.System = System;
|
|
4113
4809
|
exports.Thunder = Thunder;
|
|
4114
4810
|
exports.Timber = Timber;
|
|
4811
|
+
exports.Transactions = Transactions;
|
|
4115
4812
|
exports.Users = Users;
|
|
4116
4813
|
exports.VPFR = VPFR;
|
|
4117
4814
|
exports.Workflow = Workflow;
|