@ptkl/sdk 1.14.0 → 1.16.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.
@@ -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 user permissions
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("/v3/system/component/setup", data);
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
- * `execute forge::service::{appUuid}::{name}`; `public`-access services require none.
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 `execute forge::service::{uuid}::{name}`
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 a user to the project
1599
- * @param emails Array of emails
1600
- * @param roles Array of role UUIDs
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
- return await this.client.post("/v1/project/invite", { emails: emails.join(","), roles });
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
- * @param data Installation data
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
- return await this.client.post("/v1/project/template/install", data);
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
- * @param data Uninstallation data
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
- return await this.client.post("/v1/project/template/uninstall", data);
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
- * @param data Upgrade data
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
- return await this.client.post("/v1/project/template/upgrade", data);
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;
@@ -1837,6 +2116,7 @@ var ProtokolSDK010 = (function (exports, axios) {
1837
2116
  // @ts-ignore
1838
2117
  env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
1839
2118
  token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
2119
+ project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
1840
2120
  if (isBrowser) {
1841
2121
  if (sessionStorage.getItem('protokol_context') === 'forge') {
1842
2122
  headers['X-Project-Env'] = (_b = sessionStorage.getItem('forge_app_env')) !== null && _b !== void 0 ? _b : 'dev';
@@ -2702,6 +2982,135 @@ var ProtokolSDK010 = (function (exports, axios) {
2702
2982
  timeout: 120000
2703
2983
  });
2704
2984
  }
2985
+ // ===================================================================
2986
+ // Backup (Library Export Archives)
2987
+ // ===================================================================
2988
+ /**
2989
+ * Create a library export archive (a snapshot of the project's library or a directory within it)
2990
+ *
2991
+ * The library is resolved server-side from the project in the auth context —
2992
+ * there is a single library per project.
2993
+ *
2994
+ * @param payload - Optional export scope/format options
2995
+ * @returns `{ mode, export }` when the export is queued asynchronously.
2996
+ * Depending on server-side sizing, the endpoint may instead stream the
2997
+ * archive back directly as a binary response body (not this JSON shape).
2998
+ *
2999
+ * @example
3000
+ * ```typescript
3001
+ * const result = await dms.createExport({ path: 'legal', format: 'zip' });
3002
+ * ```
3003
+ */
3004
+ async createExport(payload) {
3005
+ return this.request('POST', `library/exports`, { data: payload !== null && payload !== void 0 ? payload : {} });
3006
+ }
3007
+ /**
3008
+ * List export archives for the project's library
3009
+ */
3010
+ async listExports() {
3011
+ return this.request('GET', `library/exports`);
3012
+ }
3013
+ /**
3014
+ * Get a single export archive (an archived snapshot of a library/dir)
3015
+ *
3016
+ * @param exportUuid - Export UUID
3017
+ * @returns `{ export, download_url }`
3018
+ */
3019
+ async getExport(exportUuid) {
3020
+ return this.request('GET', `library/exports/${exportUuid}`);
3021
+ }
3022
+ // ===================================================================
3023
+ // Policies (Quota / File-Type / Notification, library & dir scope)
3024
+ // ===================================================================
3025
+ /**
3026
+ * Get the effective library-level policy for the project's library
3027
+ */
3028
+ async getLibraryPolicy() {
3029
+ return this.request('GET', `library/policy`);
3030
+ }
3031
+ /**
3032
+ * Set/update the library-level policy for the project's library
3033
+ *
3034
+ * @param payload - Policy fields to set
3035
+ */
3036
+ async setLibraryPolicy(payload) {
3037
+ return this.request('PUT', `library/policy`, { data: payload });
3038
+ }
3039
+ /**
3040
+ * Get the directory-level policy (resolves platform-default → library → dir)
3041
+ *
3042
+ * @param path - Directory path
3043
+ */
3044
+ async getDirPolicy(path) {
3045
+ return this.request('GET', `library/dir/policy`, { params: { path } });
3046
+ }
3047
+ /**
3048
+ * Set/update the directory-level policy
3049
+ *
3050
+ * @param path - Directory path
3051
+ * @param payload - Policy fields to set (only fields provided override the library policy)
3052
+ */
3053
+ async setDirPolicy(path, payload) {
3054
+ return this.request('PUT', `library/dir/policy`, { data: payload, params: { path } });
3055
+ }
3056
+ /**
3057
+ * Remove a directory-level policy override (directory falls back to the library policy)
3058
+ *
3059
+ * @param path - Directory path
3060
+ */
3061
+ async deleteDirPolicy(path) {
3062
+ return this.request('DELETE', `library/dir/policy`, { params: { path } });
3063
+ }
3064
+ // ===================================================================
3065
+ // Reminders (Notification Rules & Per-File Notifications)
3066
+ // ===================================================================
3067
+ /**
3068
+ * List notification rules for the project's library
3069
+ */
3070
+ async listNotificationRules() {
3071
+ return this.request('GET', `library/notification-rules`);
3072
+ }
3073
+ /**
3074
+ * Create a recurring reminder (notification rule) for a media file
3075
+ *
3076
+ * @param payload - Recurring reminder definition (media_uuid/file_key, frequency, start_at, ...)
3077
+ */
3078
+ async createNotificationRule(payload) {
3079
+ return this.request('POST', `library/notification-rules`, { data: payload });
3080
+ }
3081
+ /**
3082
+ * Delete a notification rule
3083
+ *
3084
+ * @param ruleUuid - Notification rule UUID
3085
+ */
3086
+ async deleteNotificationRule(ruleUuid) {
3087
+ return this.request('DELETE', `library/notification-rules/${ruleUuid}`);
3088
+ }
3089
+ /**
3090
+ * List custom reminders scheduled for a specific file
3091
+ *
3092
+ * @param mediaUuid - Media UUID
3093
+ */
3094
+ async listFileNotifications(mediaUuid) {
3095
+ return this.request('GET', `library/media/${mediaUuid}/notifications`);
3096
+ }
3097
+ /**
3098
+ * Create a custom reminder for a specific file
3099
+ *
3100
+ * @param mediaUuid - Media UUID
3101
+ * @param payload - Reminder details (note, notify_at, optional recipient)
3102
+ */
3103
+ async createFileNotification(mediaUuid, payload) {
3104
+ return this.request('POST', `library/media/${mediaUuid}/notifications`, { data: payload });
3105
+ }
3106
+ /**
3107
+ * Cancel/delete a custom file reminder
3108
+ *
3109
+ * @param notificationUuid - Notification UUID
3110
+ */
3111
+ async deleteFileNotification(notificationUuid) {
3112
+ return this.request('DELETE', `library/notifications/${notificationUuid}`);
3113
+ }
2705
3114
  async request(method, endpoint, params) {
2706
3115
  return await this.client.request({
2707
3116
  method: method,
@@ -2913,36 +3322,41 @@ var ProtokolSDK010 = (function (exports, axios) {
2913
3322
  }
2914
3323
 
2915
3324
  class Payments extends IntegrationsBaseClient {
3325
+ // FIXME: No backend route exists for listing/searching transactions (neither
3326
+ // monri.route.ts nor wspay.route.ts under karadjordje/src/routes/v1/payments/
3327
+ // expose a "list" endpoint). This method's URL is left as-is (still broken)
3328
+ // rather than being "fixed" to another guessed path that would still 404.
3329
+ // Do not call this method until a corresponding backend route is added.
2916
3330
  async getTransactions(userId, params) {
2917
3331
  return await this.client.get(`/karadjordje/v1/payment/${userId}/list`, {
2918
3332
  params,
2919
3333
  });
2920
3334
  }
2921
- async getTransaction(provider, userId, transactionId) {
2922
- return await this.client.get(`/karadjordje/v1/payment/${provider}/${userId}/getTransaction`, {
3335
+ async getTransaction(provider, transactionId) {
3336
+ return await this.client.get(`/karadjordje/v1/payment/${provider}/getTransaction`, {
2923
3337
  params: { transactionId },
2924
3338
  });
2925
3339
  }
2926
3340
  async settings(provider) {
2927
3341
  return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
2928
3342
  }
2929
- async deactivatePaymentLink(provider, user, transactionId) {
2930
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/deactivate/${transactionId}`);
3343
+ async deactivatePaymentLink(provider, transactionId) {
3344
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/deactivate/${transactionId}`);
2931
3345
  }
2932
- async voidTransaction(provider, user, transactionId) {
2933
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/void/${transactionId}`);
3346
+ async voidTransaction(provider, transactionId) {
3347
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/void/${transactionId}`);
2934
3348
  }
2935
- async refund(provider, user, transactionId) {
2936
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/refund/${transactionId}`);
3349
+ async refund(provider, transactionId) {
3350
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/refund/${transactionId}`);
2937
3351
  }
2938
- async getPaymentLink(provider, user, options) {
2939
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, options);
3352
+ async getPaymentLink(provider, options) {
3353
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/getPaymentLink`, options);
2940
3354
  }
2941
- async getTokenRequestLink(provider, user, options) {
2942
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getTokenRequestLink`, options);
3355
+ async getTokenRequestLink(provider, options) {
3356
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/getTokenRequestLink`, options);
2943
3357
  }
2944
- async directPayUsingToken(provider, user, options) {
2945
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/directPayUsingToken`, options);
3358
+ async directPayUsingToken(provider, options) {
3359
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/directPayUsingToken`, options);
2946
3360
  }
2947
3361
  }
2948
3362
 
@@ -3871,6 +4285,65 @@ var ProtokolSDK010 = (function (exports, axios) {
3871
4285
  const { data } = await this.client.get("/v1/integrations");
3872
4286
  return data.find((i) => i.id == id && i.status == "active") !== undefined;
3873
4287
  }
4288
+ /**
4289
+ * Install (integrate) an integration into the current project.
4290
+ * POST /v1/integrate
4291
+ */
4292
+ async install(id, data) {
4293
+ const { data: resp } = await this.client.post("/v1/integrate", {
4294
+ id,
4295
+ ...(data !== undefined ? { data } : {}),
4296
+ });
4297
+ return resp;
4298
+ }
4299
+ /**
4300
+ * Uninstall (remove) an integration from the current project.
4301
+ * PUT /v1/integrate
4302
+ */
4303
+ async uninstall(id) {
4304
+ const { data } = await this.client.put("/v1/integrate", { id });
4305
+ return data;
4306
+ }
4307
+ /**
4308
+ * Activate an installed integration.
4309
+ * POST /v1/integration/{id}/activate
4310
+ */
4311
+ async activate(id) {
4312
+ const { data } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/activate`);
4313
+ return data;
4314
+ }
4315
+ /**
4316
+ * Deactivate an installed integration.
4317
+ * POST /v1/integration/{id}/deactivate
4318
+ */
4319
+ async deactivate(id) {
4320
+ const { data } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/deactivate`);
4321
+ return data;
4322
+ }
4323
+ /**
4324
+ * Advance/update the onboarding state of an installed integration.
4325
+ * POST /v1/integration/{id}/onboarding
4326
+ */
4327
+ async onboarding(id, data) {
4328
+ const { data: resp } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/onboarding`, data);
4329
+ return resp;
4330
+ }
4331
+ /**
4332
+ * List marketplace-available integrations (subscription/geo aware).
4333
+ * GET /v1/marketplace/integrations
4334
+ */
4335
+ async marketplace() {
4336
+ const { data } = await this.client.get("/v1/marketplace/integrations");
4337
+ return data;
4338
+ }
4339
+ /**
4340
+ * List explorable integration templates (subscription/geo aware).
4341
+ * GET /v1/integrations/explore
4342
+ */
4343
+ async explore() {
4344
+ const { data } = await this.client.get("/v1/integrations/explore");
4345
+ return data;
4346
+ }
3874
4347
  getInterfaceOf(id) {
3875
4348
  try {
3876
4349
  return this.integrations[id];
@@ -3883,57 +4356,286 @@ var ProtokolSDK010 = (function (exports, axios) {
3883
4356
 
3884
4357
  class Satellites extends IntegrationsBaseClient {
3885
4358
  async list() {
3886
- const { data } = await this.client.get('/satellites/templates');
4359
+ const { data } = await this.client.get('/v1/satellites/templates');
3887
4360
  return data;
3888
4361
  }
3889
4362
  async create(payload) {
3890
- const { data } = await this.client.post('/satellites/templates', payload.template);
4363
+ const { data } = await this.client.post('/v1/satellites/templates', payload.template);
3891
4364
  if (payload.schema) {
3892
4365
  await this.createVersion(data.id, payload.schema);
3893
4366
  }
3894
4367
  return data;
3895
4368
  }
3896
4369
  async get(id) {
3897
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
4370
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}`);
3898
4371
  return data;
3899
4372
  }
3900
4373
  async delete(id) {
3901
- const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
4374
+ const { data } = await this.client.delete(`/v1/satellites/templates/${encodeURIComponent(id)}`);
3902
4375
  return data;
3903
4376
  }
3904
4377
  async createVersion(id, payload) {
3905
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
4378
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
3906
4379
  return data;
3907
4380
  }
3908
4381
  async versions(id) {
3909
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
4382
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/versions`);
3910
4383
  return data;
3911
4384
  }
3912
4385
  async deploy(id, payload) {
3913
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
4386
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
3914
4387
  return data;
3915
4388
  }
3916
4389
  async rollback(id, payload) {
3917
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
4390
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
3918
4391
  return data;
3919
4392
  }
3920
4393
  async permissions(id) {
3921
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
4394
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/permissions`);
3922
4395
  return data;
3923
4396
  }
3924
4397
  async logs(id, params = {}) {
3925
4398
  const since = params.since instanceof Date ? params.since.toISOString() : params.since;
3926
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
4399
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/logs`, {
3927
4400
  params: since ? { since } : undefined,
3928
4401
  });
3929
4402
  return data;
3930
4403
  }
3931
4404
  async execute(id, command, payload = {}) {
3932
- const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
4405
+ const { data } = await this.client.post(`/v1/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
3933
4406
  return data;
3934
4407
  }
3935
4408
  }
3936
4409
 
4410
+ const BASE = "/luma/transactions/v1";
4411
+ /**
4412
+ * Transactions client — billing/subscriptions, invoices, credits/balance,
4413
+ * usage pricing and per-project billing-mode overrides. All routes go
4414
+ * through the `transactions/…` gateway prefix (`/luma/transactions/v1/...`),
4415
+ * matching the transactions service's REST surface
4416
+ * (`internal/controllers/{subscription,invoices,topup,credit_history,billing_modes,prices,balance}.go`).
4417
+ *
4418
+ * This is the **billing** service — not distributed/database transactions.
4419
+ */
4420
+ class Transactions extends PlatformBaseClient {
4421
+ // ---------------------------------------------------------------
4422
+ // Subscriptions
4423
+ // ---------------------------------------------------------------
4424
+ /**
4425
+ * List all subscriptions (including expired) for the current project.
4426
+ *
4427
+ * @example
4428
+ * const subs = await platform.transactions().getSubscriptions()
4429
+ */
4430
+ async getSubscriptions() {
4431
+ return await this.client.get(`${BASE}/billing/subscription`);
4432
+ }
4433
+ /**
4434
+ * Renew an expired subscription (and any others sharing its bundle
4435
+ * `ref_no`) — creates a renewal invoice and returns a checkout link.
4436
+ */
4437
+ async renewSubscription(payload) {
4438
+ return await this.client.post(`${BASE}/subscription/renew`, payload);
4439
+ }
4440
+ /**
4441
+ * Cancel a subscription. Issues a refund automatically if still within
4442
+ * the refund period.
4443
+ */
4444
+ async cancelSubscription(payload) {
4445
+ return await this.client.post(`${BASE}/subscription/cancel`, payload);
4446
+ }
4447
+ // ---------------------------------------------------------------
4448
+ // Invoices
4449
+ // ---------------------------------------------------------------
4450
+ /**
4451
+ * List all invoices for the current project.
4452
+ */
4453
+ async getInvoices() {
4454
+ return await this.client.get(`${BASE}/billing/invoices`);
4455
+ }
4456
+ /**
4457
+ * Get a single invoice by uuid.
4458
+ */
4459
+ async getInvoice(uuid) {
4460
+ return await this.client.get(`${BASE}/billing/invoice/${uuid}`);
4461
+ }
4462
+ /**
4463
+ * Download an invoice as a PDF. Resolves with the raw PDF bytes
4464
+ * (`responseType: "arraybuffer"`).
4465
+ *
4466
+ * @example
4467
+ * const { data } = await platform.transactions().getInvoicePdf(uuid)
4468
+ * fs.writeFileSync("invoice.pdf", Buffer.from(data))
4469
+ */
4470
+ async getInvoicePdf(uuid) {
4471
+ return await this.client.get(`${BASE}/billing/invoice/${uuid}/pdf`, {
4472
+ responseType: "arraybuffer",
4473
+ });
4474
+ }
4475
+ // ---------------------------------------------------------------
4476
+ // Balance / credits / top-up
4477
+ // ---------------------------------------------------------------
4478
+ /**
4479
+ * Get the current project's credit balance.
4480
+ */
4481
+ async getBalance() {
4482
+ return await this.client.get(`${BASE}/billing/balance`);
4483
+ }
4484
+ /**
4485
+ * Generate a checkout link to manually top up the project's credit balance.
4486
+ */
4487
+ async topUp(payload) {
4488
+ return await this.client.post(`${BASE}/billing/topup`, payload);
4489
+ }
4490
+ /**
4491
+ * Get the project's credit activity (deductions/top-ups) history, paginated.
4492
+ */
4493
+ async getCreditsHistory(query) {
4494
+ return await this.client.get(`${BASE}/billing/credits/history`, {
4495
+ params: query,
4496
+ });
4497
+ }
4498
+ // ---------------------------------------------------------------
4499
+ // Prices
4500
+ // ---------------------------------------------------------------
4501
+ /**
4502
+ * Get the usage-based pricing table for a given currency.
4503
+ *
4504
+ * @param currency - ISO 4217 currency code, e.g. "USD" or "RSD".
4505
+ */
4506
+ async getPrices(currency) {
4507
+ return await this.client.get(`${BASE}/prices/${currency}`);
4508
+ }
4509
+ // ---------------------------------------------------------------
4510
+ // Billing modes (per-project usage billing overrides)
4511
+ // ---------------------------------------------------------------
4512
+ /**
4513
+ * Get the project's usage-billing-mode overrides plus platform defaults.
4514
+ */
4515
+ async getBillingModes() {
4516
+ return await this.client.get(`${BASE}/billing/billing-modes`);
4517
+ }
4518
+ /**
4519
+ * Set the billing mode ("credits" | "hybrid" | "invoice") for a usage
4520
+ * option code on the current project.
4521
+ */
4522
+ async updateBillingModes(payload) {
4523
+ return await this.client.put(`${BASE}/billing/billing-modes`, payload);
4524
+ }
4525
+ }
4526
+
4527
+ // apis
4528
+ class Platform extends PlatformBaseClient {
4529
+ getPlatformClient() {
4530
+ return this.client;
4531
+ }
4532
+ getPlatformBaseURL() {
4533
+ var _a;
4534
+ return (_a = this.client.defaults.baseURL) !== null && _a !== void 0 ? _a : "";
4535
+ }
4536
+ apiUser() {
4537
+ return (new APIUser()).setClient(this.client);
4538
+ }
4539
+ function() {
4540
+ return (new Functions()).setClient(this.client);
4541
+ }
4542
+ user() {
4543
+ return (new Users()).setClient(this.client);
4544
+ }
4545
+ app(appType) {
4546
+ return (new Apps(appType)).setClient(this.client);
4547
+ }
4548
+ forge() {
4549
+ return (new Forge()).setClient(this.client);
4550
+ }
4551
+ kortex() {
4552
+ return (new Kortex()).setClient(this.client);
4553
+ }
4554
+ component(ref) {
4555
+ return (new Component(ref)).setClient(this.client);
4556
+ }
4557
+ componentUtils() {
4558
+ return (new ComponentUtils()).setClient(this.client);
4559
+ }
4560
+ ratchet() {
4561
+ return (new Ratchet()).setClient(this.client);
4562
+ }
4563
+ sandbox() {
4564
+ return (new Sandbox()).setClient(this.client);
4565
+ }
4566
+ system() {
4567
+ return (new System()).setClient(this.client);
4568
+ }
4569
+ workflow() {
4570
+ return (new Workflow()).setClient(this.client);
4571
+ }
4572
+ thunder() {
4573
+ return (new Thunder()).setClient(this.client);
4574
+ }
4575
+ project() {
4576
+ return (new Project()).setClient(this.client);
4577
+ }
4578
+ config() {
4579
+ return (new Config()).setClient(this.client);
4580
+ }
4581
+ /**
4582
+ * Convenience factory for the Integrations gateway façade.
4583
+ *
4584
+ * Integrations live behind a different gateway (`INTEGRATION_API` /
4585
+ * `host/luma/integrations`) than the rest of the platform API, so this
4586
+ * returns an independently-configured `Integrations` client (it does not
4587
+ * reuse `this.client`, whose base URL points at the platform host). The
4588
+ * Platform's resolved token/env/host are propagated so the child client
4589
+ * carries the same credentials.
4590
+ */
4591
+ integrations() {
4592
+ return new Integrations(this.getIntegrationsGatewayOptions());
4593
+ }
4594
+ /**
4595
+ * Convenience factory for the Satellites (custom JSON-RPC integrations) client.
4596
+ *
4597
+ * Same gateway note as `integrations()` — Satellites talks to the
4598
+ * integrations gateway, not the platform host, so a fresh, independently
4599
+ * configured client is returned, with the Platform's credentials propagated.
4600
+ */
4601
+ satellites() {
4602
+ return new Satellites(this.getIntegrationsGatewayOptions());
4603
+ }
4604
+ /**
4605
+ * Builds the options for a child integrations-gateway client (`Integrations`/
4606
+ * `Satellites`), propagating this Platform's resolved token/env, and deriving
4607
+ * the gateway host from this Platform's host when one was explicitly set.
4608
+ * When `this.host` is unset, `host` is left `undefined` so the child client's
4609
+ * own env-var/default resolution applies.
4610
+ */
4611
+ getIntegrationsGatewayOptions() {
4612
+ var _a, _b;
4613
+ return {
4614
+ token: (_a = this.token) !== null && _a !== void 0 ? _a : undefined,
4615
+ env: (_b = this.env) !== null && _b !== void 0 ? _b : undefined,
4616
+ host: this.host ? `${this.host.replace(/\/+$/, "")}/luma/integrations` : undefined,
4617
+ };
4618
+ }
4619
+ /**
4620
+ * Transactions (billing) client — subscriptions, invoices, credits/balance,
4621
+ * usage pricing and billing-mode overrides. Reached through the platform
4622
+ * gateway (`transactions/…`), so it reuses `this.client` like the other
4623
+ * native/proxied-service factories.
4624
+ *
4625
+ * This is the **billing** service — not distributed/database transactions.
4626
+ */
4627
+ transactions() {
4628
+ return (new Transactions()).setClient(this.client);
4629
+ }
4630
+ /**
4631
+ * Alias for `transactions()` — reads more naturally at call sites that
4632
+ * only care about billing (`platform.billing().getBalance()`).
4633
+ */
4634
+ billing() {
4635
+ return this.transactions();
4636
+ }
4637
+ }
4638
+
3937
4639
  // PRN — Protokol Resource Name
3938
4640
  //
3939
4641
  // Format:
@@ -4112,6 +4814,7 @@ var ProtokolSDK010 = (function (exports, axios) {
4112
4814
  exports.System = System;
4113
4815
  exports.Thunder = Thunder;
4114
4816
  exports.Timber = Timber;
4817
+ exports.Transactions = Transactions;
4115
4818
  exports.Users = Users;
4116
4819
  exports.VPFR = VPFR;
4117
4820
  exports.Workflow = Workflow;