@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.
@@ -19066,6 +19066,9 @@ class PlatformBaseClient extends BaseClient {
19066
19066
  this.env = null;
19067
19067
  this.token = null;
19068
19068
  this.host = null;
19069
+ this.env = env;
19070
+ this.token = token;
19071
+ this.host = host;
19069
19072
  }
19070
19073
  }
19071
19074
 
@@ -19083,6 +19086,7 @@ class Component extends PlatformBaseClient {
19083
19086
  if (opts && opts.stream === true) {
19084
19087
  let onMetaCallback = () => { };
19085
19088
  let onDataCallback = () => { };
19089
+ let onCursorCallback = () => { };
19086
19090
  let onErrorCallback;
19087
19091
  let onEndCallback;
19088
19092
  let isFirstLine = true;
@@ -19095,6 +19099,10 @@ class Component extends PlatformBaseClient {
19095
19099
  onDataCallback = callback;
19096
19100
  return chainable;
19097
19101
  },
19102
+ onCursor: (callback) => {
19103
+ onCursorCallback = callback;
19104
+ return chainable;
19105
+ },
19098
19106
  onError: (callback) => {
19099
19107
  onErrorCallback = callback;
19100
19108
  return chainable;
@@ -19113,6 +19121,11 @@ class Component extends PlatformBaseClient {
19113
19121
  if (result instanceof Promise)
19114
19122
  await result;
19115
19123
  }
19124
+ else if ('next_cursor' in doc && !('uuid' in doc)) {
19125
+ const result = onCursorCallback(doc);
19126
+ if (result instanceof Promise)
19127
+ await result;
19128
+ }
19116
19129
  else {
19117
19130
  const result = onDataCallback(doc);
19118
19131
  if (result instanceof Promise)
@@ -19183,6 +19196,8 @@ class Component extends PlatformBaseClient {
19183
19196
  };
19184
19197
  if (ctx.only && ctx.only.length > 0)
19185
19198
  params.only = ctx.only;
19199
+ if (ctx.cursor)
19200
+ params.cursor = ctx.cursor;
19186
19201
  if (Object.keys(ctx.$adv || {}).length > 0)
19187
19202
  params.$adv = [(_b = ctx.$adv) !== null && _b !== void 0 ? _b : {}];
19188
19203
  if (ctx.$aggregate && ctx.$aggregate.length > 0)
@@ -19849,11 +19864,32 @@ class Users extends PlatformBaseClient {
19849
19864
  }
19850
19865
  // Permissions & Roles
19851
19866
  /**
19852
- * Get user permissions
19867
+ * Get the current token's permissions.
19868
+ *
19869
+ * Returns the resolved permission set carried by the calling token. For a
19870
+ * forge actor token this is the scoped intersection minted at launch time —
19871
+ * see `getPrincipalPermissions()` for the underlying user's full set.
19853
19872
  */
19854
19873
  async getPermissions() {
19855
19874
  return await this.client.get("/v1/user/role/permissions");
19856
19875
  }
19876
+ /**
19877
+ * Get the FULL permissions of the user the current token is acting on behalf
19878
+ * of (the "principal").
19879
+ *
19880
+ * When a forge app runs under an actor token, `getPermissions()` returns only
19881
+ * the token's scoped permissions — the intersection of the app's declared
19882
+ * runtime permissions and the user's permissions. This instead returns the
19883
+ * complete permission set of the underlying user, so the app can check what
19884
+ * that user is actually allowed to do, independent of what the app itself was
19885
+ * granted. The token scope is unchanged: this exposes knowledge, not capability.
19886
+ *
19887
+ * For a normal user session (no actor token) it returns the caller's own
19888
+ * permissions, identical to `getPermissions()`'s scope.
19889
+ */
19890
+ async getPrincipalPermissions() {
19891
+ return await this.client.get("/v1/user/role/principal-permissions");
19892
+ }
19857
19893
  /**
19858
19894
  * Get list of available permissions
19859
19895
  */
@@ -19938,7 +19974,7 @@ class ComponentUtils extends PlatformBaseClient {
19938
19974
  * @returns Promise resolving to the created/updated component
19939
19975
  */
19940
19976
  async setup(data) {
19941
- return await this.client.post("/v3/system/component/setup", data);
19977
+ return await this.client.post("/v4/system/component/setup", data);
19942
19978
  }
19943
19979
  }
19944
19980
 
@@ -20194,9 +20230,22 @@ class Ratchet extends PlatformBaseClient {
20194
20230
  }
20195
20231
  }
20196
20232
 
20233
+ /**
20234
+ * Sandbox client — spark (FaaS) functions/apps, long-running runtimes, and
20235
+ * their K8s deployments. All routes go through the `sandbox/…` gateway
20236
+ * prefix (`/luma/sandbox/v1/...`), matching the sandbox service's REST
20237
+ * surface (`internal/controllers/{spark.go,spark.v1.go,runtime.v1.go}` and
20238
+ * the deployment lifecycle in `internal/controllers/ecomm/deployment.go`).
20239
+ */
20197
20240
  class Sandbox extends PlatformBaseClient {
20241
+ // ---------------------------------------------------------------
20242
+ // Spark (FaaS functions / apps)
20243
+ // ---------------------------------------------------------------
20198
20244
  /**
20199
- * Call the sandbox service to execute a serverless function
20245
+ * Call the sandbox service to execute a serverless function.
20246
+ *
20247
+ * Kept for backwards compatibility — equivalent to
20248
+ * `execSpark(name, data)`.
20200
20249
  *
20201
20250
  * @param name
20202
20251
  * @param data
@@ -20208,6 +20257,143 @@ class Sandbox extends PlatformBaseClient {
20208
20257
  async spark(name, data) {
20209
20258
  return await this.client.post(`/luma/sandbox/v1/spark/exec/${name}`, data);
20210
20259
  }
20260
+ /**
20261
+ * Create a new spark (function or app).
20262
+ *
20263
+ * @example
20264
+ * const spark = await platform.sandbox().createSpark({ name: "myFunction", runtime: "node20", memory: 256 })
20265
+ */
20266
+ async createSpark(payload) {
20267
+ return await this.client.post(`/luma/sandbox/v1/spark`, payload);
20268
+ }
20269
+ /**
20270
+ * Get a spark by uuid.
20271
+ */
20272
+ async getSpark(uuid) {
20273
+ return await this.client.get(`/luma/sandbox/v1/spark/${uuid}`);
20274
+ }
20275
+ /**
20276
+ * Update a spark's memory/settings/env vars.
20277
+ */
20278
+ async updateSpark(uuid, payload) {
20279
+ return await this.client.patch(`/luma/sandbox/v1/spark/${uuid}`, payload);
20280
+ }
20281
+ /**
20282
+ * Delete a spark.
20283
+ */
20284
+ async deleteSpark(uuid) {
20285
+ return await this.client.delete(`/luma/sandbox/v1/spark/${uuid}`);
20286
+ }
20287
+ /**
20288
+ * List all sparks for the current project.
20289
+ */
20290
+ async listSparks() {
20291
+ return await this.client.get(`/luma/sandbox/v1/spark`);
20292
+ }
20293
+ /**
20294
+ * Deploy a specific spark version to the dev environment.
20295
+ */
20296
+ async deploySpark(uuid, version) {
20297
+ return await this.client.put(`/luma/sandbox/v1/spark/deploy/${uuid}/${version}`);
20298
+ }
20299
+ /**
20300
+ * Cancel an in-progress spark deployment.
20301
+ *
20302
+ * @param uuid
20303
+ * @param env - defaults to "dev" on the server if omitted
20304
+ */
20305
+ async cancelSpark(uuid, env) {
20306
+ return await this.client.put(`/luma/sandbox/v1/spark/cancel/${uuid}`, undefined, { params: env ? { env } : undefined });
20307
+ }
20308
+ /**
20309
+ * Release a deployed spark version to the live/public environment.
20310
+ */
20311
+ async releaseSpark(uuid, version) {
20312
+ return await this.client.put(`/luma/sandbox/v1/spark/release/${uuid}/${version}`);
20313
+ }
20314
+ /**
20315
+ * Execute a deployed spark by name. Mirrors `spark()` but accepts the
20316
+ * full request shape (method/query/headers) — the exec route accepts
20317
+ * GET/POST/PATCH/PUT/DELETE.
20318
+ *
20319
+ * @example
20320
+ * const result = await platform.sandbox().execSpark("myFunction", { foo: "bar" })
20321
+ * const result = await platform.sandbox().execSpark("myFunction", undefined, { method: "GET" })
20322
+ */
20323
+ async execSpark(name, data, options) {
20324
+ var _a;
20325
+ const method = ((_a = options === null || options === void 0 ? void 0 : options.method) !== null && _a !== void 0 ? _a : "POST").toLowerCase();
20326
+ return await this.client.request({
20327
+ url: `/luma/sandbox/v1/spark/exec/${name}`,
20328
+ method,
20329
+ data,
20330
+ params: options === null || options === void 0 ? void 0 : options.query,
20331
+ headers: options === null || options === void 0 ? void 0 : options.headers,
20332
+ });
20333
+ }
20334
+ /**
20335
+ * Fetch logs for a spark.
20336
+ */
20337
+ async sparkLogs(uuid, params) {
20338
+ return await this.client.get(`/luma/sandbox/v1/spark/logs/${uuid}`, { params });
20339
+ }
20340
+ /**
20341
+ * Get the current project's spark tier (plan/quota).
20342
+ */
20343
+ async sparkTier() {
20344
+ return await this.client.get(`/luma/sandbox/v1/spark/project/tier`);
20345
+ }
20346
+ // ---------------------------------------------------------------
20347
+ // Runtimes (long-running user API deployments)
20348
+ // ---------------------------------------------------------------
20349
+ /**
20350
+ * List all runtimes for the current project.
20351
+ */
20352
+ async listRuntimes() {
20353
+ return await this.client.get(`/luma/sandbox/v1/runtime`);
20354
+ }
20355
+ /**
20356
+ * Create a new runtime.
20357
+ */
20358
+ async createRuntime(payload) {
20359
+ return await this.client.post(`/luma/sandbox/v1/runtime`, payload);
20360
+ }
20361
+ /**
20362
+ * Get a runtime by ref (name/uuid).
20363
+ */
20364
+ async getRuntime(ref) {
20365
+ return await this.client.get(`/luma/sandbox/v1/runtime/${ref}`);
20366
+ }
20367
+ /**
20368
+ * Update a runtime's image/resources/env vars/tags.
20369
+ */
20370
+ async updateRuntime(ref, payload) {
20371
+ return await this.client.patch(`/luma/sandbox/v1/runtime/${ref}`, payload);
20372
+ }
20373
+ /**
20374
+ * Delete a runtime.
20375
+ */
20376
+ async deleteRuntime(ref) {
20377
+ return await this.client.delete(`/luma/sandbox/v1/runtime/${ref}`);
20378
+ }
20379
+ /**
20380
+ * (Re)deploy a runtime.
20381
+ */
20382
+ async deployRuntime(ref) {
20383
+ return await this.client.post(`/luma/sandbox/v1/runtime/${ref}/deploy`);
20384
+ }
20385
+ /**
20386
+ * Restart a running runtime.
20387
+ */
20388
+ async restartRuntime(ref) {
20389
+ return await this.client.post(`/luma/sandbox/v1/runtime/${ref}/restart`);
20390
+ }
20391
+ /**
20392
+ * Fetch logs for a runtime.
20393
+ */
20394
+ async runtimeLogs(ref, params) {
20395
+ return await this.client.get(`/luma/sandbox/v1/runtime/${ref}/logs`, { params });
20396
+ }
20211
20397
  }
20212
20398
 
20213
20399
  class System extends PlatformBaseClient {
@@ -20235,6 +20421,17 @@ class System extends PlatformBaseClient {
20235
20421
  }
20236
20422
  }
20237
20423
 
20424
+ function nodeControlQuery(options) {
20425
+ const params = new URLSearchParams();
20426
+ if ((options === null || options === void 0 ? void 0 : options.iterationIdx) !== undefined) {
20427
+ params.set('iteration_idx', String(options.iterationIdx));
20428
+ }
20429
+ if ((options === null || options === void 0 ? void 0 : options.parentNodeId) !== undefined) {
20430
+ params.set('parent_node_id', String(options.parentNodeId));
20431
+ }
20432
+ const qs = params.toString();
20433
+ return qs ? `?${qs}` : '';
20434
+ }
20238
20435
  class Workflow extends PlatformBaseClient {
20239
20436
  async create(data) {
20240
20437
  return await this.client.post(`/v1/project/workflow/workflow`, data);
@@ -20257,6 +20454,68 @@ class Workflow extends PlatformBaseClient {
20257
20454
  async publish(event, data) {
20258
20455
  return await this.client.post(`/v1/project/workflow/workflow/event/${event}`, data);
20259
20456
  }
20457
+ /**
20458
+ * Install (create + publish) a workflow in one call.
20459
+ * Rejects if a workflow with the same name + integrator already exists.
20460
+ */
20461
+ async install(data) {
20462
+ return await this.client.post(`/v1/project/workflow/workflow/install`, data);
20463
+ }
20464
+ // --- Execution history ---
20465
+ async getHistory(query) {
20466
+ return await this.client.get(`/v1/project/workflow/workflows/history`, { params: query });
20467
+ }
20468
+ async getHistoryEntry(executionUuid) {
20469
+ return await this.client.get(`/v1/project/workflow/workflows/history/${executionUuid}`);
20470
+ }
20471
+ async getStats(query) {
20472
+ return await this.client.get(`/v1/project/workflow/workflows/stats`, { params: query });
20473
+ }
20474
+ // --- Running executions ---
20475
+ async getRunning(query) {
20476
+ return await this.client.get(`/v1/project/workflow/workflows/running`, { params: query });
20477
+ }
20478
+ async getRunningEntry(executionUuid) {
20479
+ return await this.client.get(`/v1/project/workflow/workflows/running/${executionUuid}`);
20480
+ }
20481
+ // --- Workflow execution control ---
20482
+ async pause(executionUuid) {
20483
+ return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/pause`);
20484
+ }
20485
+ async resume(executionUuid) {
20486
+ return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/resume`);
20487
+ }
20488
+ async kill(executionUuid) {
20489
+ return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/kill`);
20490
+ }
20491
+ /**
20492
+ * Restart a failed/killed workflow execution from history.
20493
+ * `clearState: true` discards prior node state instead of a smart resume.
20494
+ */
20495
+ async restart(executionUuid, options) {
20496
+ const qs = (options === null || options === void 0 ? void 0 : options.clearState) ? '?clear_state=true' : '';
20497
+ return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/restart${qs}`);
20498
+ }
20499
+ // --- Node-level control ---
20500
+ async pauseNode(executionUuid, nodeId, options) {
20501
+ return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/nodes/${nodeId}/pause${nodeControlQuery(options)}`);
20502
+ }
20503
+ async resumeNode(executionUuid, nodeId, options) {
20504
+ return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/nodes/${nodeId}/resume${nodeControlQuery(options)}`);
20505
+ }
20506
+ async killNode(executionUuid, nodeId, options) {
20507
+ return await this.client.post(`/v1/project/workflow/workflows/${executionUuid}/nodes/${nodeId}/kill${nodeControlQuery(options)}`);
20508
+ }
20509
+ // --- Errors ---
20510
+ async getErrors() {
20511
+ return await this.client.get(`/v1/project/workflow/errors`);
20512
+ }
20513
+ async removeError(id) {
20514
+ return await this.client.delete(`/v1/project/workflow/errors/${id}`);
20515
+ }
20516
+ async removeAllErrors() {
20517
+ return await this.client.delete(`/v1/project/workflow/errors`);
20518
+ }
20260
20519
  }
20261
20520
 
20262
20521
  /**
@@ -20369,7 +20628,8 @@ class Forge extends PlatformBaseClient {
20369
20628
  *
20370
20629
  * Resolving the app does NOT grant access. Execution is still authorized against
20371
20630
  * the caller's permissions — for a `platform`-access service the caller must hold
20372
- * `execute forge::service::{appUuid}::{name}`; `public`-access services require none.
20631
+ * `service::{name} forge::{appUuid}`; `public`-access services require none. An
20632
+ * app's own runtime token is implicitly granted this for all of its own services.
20373
20633
  */
20374
20634
  async runService(target, body, options) {
20375
20635
  var _a;
@@ -20389,148 +20649,161 @@ class Forge extends PlatformBaseClient {
20389
20649
  }
20390
20650
  // Service execution is owned by the forge runtime (forge-runtime gateway ->
20391
20651
  // platform-forge), which resolves the ref (name → uuid, marketplace → custom)
20392
- // and executes the service, enforcing `execute forge::service::{uuid}::{name}`
20652
+ // and executes the service, enforcing `service::{name} forge::{uuid}`
20393
20653
  // for platform-access services before running.
20394
20654
  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);
20395
20655
  }
20396
20656
  }
20397
20657
 
20398
- const BASE = '/luma/kortex/v1';
20658
+ const BASE$1 = '/luma/kortex/v1';
20399
20659
  class Kortex extends PlatformBaseClient {
20400
20660
  // ── Agents ──
20401
20661
  async createAgent(data) {
20402
- return await this.client.post(`${BASE}/agents`, data);
20662
+ return await this.client.post(`${BASE$1}/agents`, data);
20403
20663
  }
20404
20664
  async listAgents(params) {
20405
- return await this.client.get(`${BASE}/agents`, { params });
20665
+ return await this.client.get(`${BASE$1}/agents`, { params });
20406
20666
  }
20407
20667
  async getAgent(uuid) {
20408
- return await this.client.get(`${BASE}/agents/${uuid}`);
20668
+ return await this.client.get(`${BASE$1}/agents/${uuid}`);
20409
20669
  }
20410
20670
  async updateAgent(uuid, data) {
20411
- return await this.client.patch(`${BASE}/agents/${uuid}`, data);
20671
+ return await this.client.patch(`${BASE$1}/agents/${uuid}`, data);
20412
20672
  }
20413
20673
  async deleteAgent(uuid) {
20414
- return await this.client.delete(`${BASE}/agents/${uuid}`);
20674
+ return await this.client.delete(`${BASE$1}/agents/${uuid}`);
20415
20675
  }
20416
20676
  async listAgentKnowledgeBases(agentUUID) {
20417
- return await this.client.get(`${BASE}/agents/${agentUUID}/knowledge-bases`);
20677
+ return await this.client.get(`${BASE$1}/agents/${agentUUID}/knowledge-bases`);
20418
20678
  }
20419
20679
  // ── Knowledge Bases ──
20420
20680
  async createKnowledgeBase(data) {
20421
- return await this.client.post(`${BASE}/knowledge-bases`, data);
20681
+ return await this.client.post(`${BASE$1}/knowledge-bases`, data);
20422
20682
  }
20423
20683
  async listKnowledgeBases(params) {
20424
- return await this.client.get(`${BASE}/knowledge-bases`, { params });
20684
+ return await this.client.get(`${BASE$1}/knowledge-bases`, { params });
20425
20685
  }
20426
20686
  async getKnowledgeBase(uuid) {
20427
- return await this.client.get(`${BASE}/knowledge-bases/${uuid}`);
20687
+ return await this.client.get(`${BASE$1}/knowledge-bases/${uuid}`);
20428
20688
  }
20429
20689
  async updateKnowledgeBase(uuid, data) {
20430
- return await this.client.put(`${BASE}/knowledge-bases/${uuid}`, data);
20690
+ return await this.client.put(`${BASE$1}/knowledge-bases/${uuid}`, data);
20431
20691
  }
20432
20692
  async deleteKnowledgeBase(uuid) {
20433
- return await this.client.delete(`${BASE}/knowledge-bases/${uuid}`);
20693
+ return await this.client.delete(`${BASE$1}/knowledge-bases/${uuid}`);
20694
+ }
20695
+ // Searches the knowledge bases attached to `data.agent_uuid` (collections
20696
+ // are derived from the agent, not passed explicitly). `top_k` is clamped
20697
+ // to 1-10 server-side. Response is `{ chunks: KnowledgeBaseSearchChunk[] }`.
20698
+ async searchKnowledgeBase(data) {
20699
+ return await this.client.post(`${BASE$1}/knowledge-bases/search`, data);
20434
20700
  }
20435
20701
  // ── Documents ──
20436
20702
  async listDocuments(kbUUID, params) {
20437
- return await this.client.get(`${BASE}/knowledge-bases/${kbUUID}/documents`, { params });
20703
+ return await this.client.get(`${BASE$1}/knowledge-bases/${kbUUID}/documents`, { params });
20438
20704
  }
20439
20705
  async uploadDocument(kbUUID, formData) {
20440
- return await this.client.post(`${BASE}/knowledge-bases/${kbUUID}/documents`, formData, {
20706
+ return await this.client.post(`${BASE$1}/knowledge-bases/${kbUUID}/documents`, formData, {
20441
20707
  headers: { 'Content-Type': 'multipart/form-data' },
20442
20708
  timeout: 120000,
20443
20709
  });
20444
20710
  }
20445
20711
  async getDocument(kbUUID, uuid) {
20446
- return await this.client.get(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}`);
20712
+ return await this.client.get(`${BASE$1}/knowledge-bases/${kbUUID}/documents/${uuid}`);
20447
20713
  }
20448
20714
  async deleteDocument(kbUUID, uuid) {
20449
- return await this.client.delete(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}`);
20715
+ return await this.client.delete(`${BASE$1}/knowledge-bases/${kbUUID}/documents/${uuid}`);
20450
20716
  }
20451
20717
  async retryDocument(kbUUID, uuid) {
20452
- return await this.client.post(`${BASE}/knowledge-bases/${kbUUID}/documents/${uuid}/retry`);
20718
+ return await this.client.post(`${BASE$1}/knowledge-bases/${kbUUID}/documents/${uuid}/retry`);
20453
20719
  }
20454
20720
  // ── Conversations ──
20455
20721
  async createConversation(data) {
20456
- return await this.client.post(`${BASE}/conversations`, data);
20722
+ return await this.client.post(`${BASE$1}/conversations`, data);
20457
20723
  }
20458
20724
  async listConversations(params) {
20459
- return await this.client.get(`${BASE}/conversations`, { params });
20725
+ return await this.client.get(`${BASE$1}/conversations`, { params });
20460
20726
  }
20461
20727
  async getConversation(uuid) {
20462
- return await this.client.get(`${BASE}/conversations/${uuid}`);
20728
+ return await this.client.get(`${BASE$1}/conversations/${uuid}`);
20463
20729
  }
20464
20730
  async updateConversation(uuid, data) {
20465
- return await this.client.put(`${BASE}/conversations/${uuid}`, data);
20731
+ return await this.client.put(`${BASE$1}/conversations/${uuid}`, data);
20466
20732
  }
20467
20733
  async deleteConversation(uuid) {
20468
- return await this.client.delete(`${BASE}/conversations/${uuid}`);
20734
+ return await this.client.delete(`${BASE$1}/conversations/${uuid}`);
20469
20735
  }
20470
20736
  async archiveConversation(uuid) {
20471
- return await this.client.post(`${BASE}/conversations/${uuid}/archive`);
20737
+ return await this.client.post(`${BASE$1}/conversations/${uuid}/archive`);
20472
20738
  }
20473
20739
  async unarchiveConversation(uuid) {
20474
- return await this.client.post(`${BASE}/conversations/${uuid}/unarchive`);
20740
+ return await this.client.post(`${BASE$1}/conversations/${uuid}/unarchive`);
20475
20741
  }
20476
20742
  async addParticipant(conversationUUID, data) {
20477
- return await this.client.post(`${BASE}/conversations/${conversationUUID}/participants`, data);
20743
+ return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/participants`, data);
20478
20744
  }
20479
20745
  async removeParticipant(conversationUUID, agentUUID) {
20480
- return await this.client.delete(`${BASE}/conversations/${conversationUUID}/participants/${agentUUID}`);
20746
+ return await this.client.delete(`${BASE$1}/conversations/${conversationUUID}/participants/${agentUUID}`);
20481
20747
  }
20482
20748
  // ── Messages / Completions ──
20483
20749
  async sendMessage(conversationUUID, data) {
20484
- return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages`, data);
20750
+ return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages`, data);
20485
20751
  }
20486
20752
  async streamMessage(conversationUUID, data) {
20487
- return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages`, { ...data, stream: true }, {
20753
+ return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages`, { ...data, stream: true }, {
20488
20754
  responseType: 'stream',
20489
20755
  timeout: 120000,
20490
20756
  });
20491
20757
  }
20492
20758
  async listMessages(conversationUUID, params) {
20493
- return await this.client.get(`${BASE}/conversations/${conversationUUID}/messages`, { params });
20759
+ return await this.client.get(`${BASE$1}/conversations/${conversationUUID}/messages`, { params });
20494
20760
  }
20495
20761
  async injectMessage(conversationUUID, data) {
20496
- return await this.client.post(`${BASE}/conversations/${conversationUUID}/messages/inject`, data);
20762
+ return await this.client.post(`${BASE$1}/conversations/${conversationUUID}/messages/inject`, data);
20497
20763
  }
20498
20764
  // ── OCR ──
20499
20765
  async ocr(data) {
20500
- return await this.client.post(`${BASE}/ocr`, data, { timeout: 120000 });
20766
+ return await this.client.post(`${BASE$1}/ocr`, data, { timeout: 120000 });
20767
+ }
20768
+ // ── Workflow ──
20769
+ async workflowComplete(data) {
20770
+ return await this.client.post(`${BASE$1}/workflow/complete`, data);
20771
+ }
20772
+ async workflowOcr(data) {
20773
+ return await this.client.post(`${BASE$1}/workflow/ocr`, data, { timeout: 120000 });
20501
20774
  }
20502
20775
  // ── User Access ──
20503
20776
  async createUserAccess(data) {
20504
- return await this.client.post(`${BASE}/user-access`, data);
20777
+ return await this.client.post(`${BASE$1}/user-access`, data);
20505
20778
  }
20506
20779
  async listUserAccess(params) {
20507
- return await this.client.get(`${BASE}/user-access`, { params });
20780
+ return await this.client.get(`${BASE$1}/user-access`, { params });
20508
20781
  }
20509
20782
  async getUserAccess(uuid) {
20510
- return await this.client.get(`${BASE}/user-access/${uuid}`);
20783
+ return await this.client.get(`${BASE$1}/user-access/${uuid}`);
20511
20784
  }
20512
20785
  async updateUserAccess(uuid, data) {
20513
- return await this.client.patch(`${BASE}/user-access/${uuid}`, data);
20786
+ return await this.client.patch(`${BASE$1}/user-access/${uuid}`, data);
20514
20787
  }
20515
20788
  async deleteUserAccess(uuid) {
20516
- return await this.client.delete(`${BASE}/user-access/${uuid}`);
20789
+ return await this.client.delete(`${BASE$1}/user-access/${uuid}`);
20517
20790
  }
20518
20791
  async getUserMonthlyUsage(uuid, params) {
20519
- return await this.client.get(`${BASE}/user-access/${uuid}/usage`, { params });
20792
+ return await this.client.get(`${BASE$1}/user-access/${uuid}/usage`, { params });
20520
20793
  }
20521
20794
  async getUserUsageBreakdown(uuid) {
20522
- return await this.client.get(`${BASE}/user-access/${uuid}/usage/breakdown`);
20795
+ return await this.client.get(`${BASE$1}/user-access/${uuid}/usage/breakdown`);
20523
20796
  }
20524
20797
  async getMyAccess() {
20525
- return await this.client.get(`${BASE}/my-access`);
20798
+ return await this.client.get(`${BASE$1}/my-access`);
20526
20799
  }
20527
20800
  // ── Usage (Admin) ──
20528
20801
  async listUsage(params) {
20529
- return await this.client.get(`${BASE}/usage`, { params });
20802
+ return await this.client.get(`${BASE$1}/usage`, { params });
20530
20803
  }
20531
20804
  // ── Tier ──
20532
20805
  async getTier() {
20533
- return await this.client.get(`${BASE}/tier`);
20806
+ return await this.client.get(`${BASE$1}/tier`);
20534
20807
  }
20535
20808
  }
20536
20809
 
@@ -20561,12 +20834,50 @@ class Project extends PlatformBaseClient {
20561
20834
  return await this.client.patch("/v1/project/archive");
20562
20835
  }
20563
20836
  /**
20564
- * Invite a user to the project
20565
- * @param emails Array of emails
20566
- * @param roles Array of role UUIDs
20837
+ * Invite one or more users to the project.
20838
+ *
20839
+ * `POST /v1/project/invite` only accepts a single `email` per request
20840
+ * (see `InviteToProject` in platform-api's
20841
+ * `internal/project/controllers/invite.go`), so this method issues one
20842
+ * request per entry in `emails`, sequentially, with body
20843
+ * `{ email, role_uuid: roles, subject?, comment? }`.
20844
+ *
20845
+ * Return shape (always a single `AxiosResponse`, so existing callers
20846
+ * that do `(await project.invite(...)).data` keep compiling/working
20847
+ * unchanged):
20848
+ * - Exactly one email: the raw `AxiosResponse` from that single request
20849
+ * (`.data` is that invite's response body, as before).
20850
+ * - More than one email: a response shaped like the last request's
20851
+ * `AxiosResponse`, but with `.data` replaced by an array of each
20852
+ * individual request's `.data`, in the same order as `emails`.
20853
+ *
20854
+ * @param emails Array of email addresses to invite
20855
+ * @param roles Array of role UUIDs to grant every invitee
20856
+ * @param extra Optional subject/comment applied to every invite
20567
20857
  */
20568
- async invite(emails, roles) {
20569
- return await this.client.post("/v1/project/invite", { emails: emails.join(","), roles });
20858
+ async invite(emails, roles, extra) {
20859
+ const bodyExtra = {};
20860
+ if ((extra === null || extra === void 0 ? void 0 : extra.subject) !== undefined)
20861
+ bodyExtra.subject = extra.subject;
20862
+ if ((extra === null || extra === void 0 ? void 0 : extra.comment) !== undefined)
20863
+ bodyExtra.comment = extra.comment;
20864
+ const responses = [];
20865
+ for (const email of emails) {
20866
+ const res = await this.client.post("/v1/project/invite", {
20867
+ email,
20868
+ role_uuid: roles,
20869
+ ...bodyExtra,
20870
+ });
20871
+ responses.push(res);
20872
+ }
20873
+ if (responses.length === 1) {
20874
+ return responses[0];
20875
+ }
20876
+ const last = responses[responses.length - 1];
20877
+ return {
20878
+ ...last,
20879
+ data: responses.map((r) => r.data),
20880
+ };
20570
20881
  }
20571
20882
  /**
20572
20883
  * Get list of project invites
@@ -20696,25 +21007,49 @@ class Project extends PlatformBaseClient {
20696
21007
  return await this.client.get("/v1/project/template/workspace");
20697
21008
  }
20698
21009
  /**
20699
- * Install a template
20700
- * @param data Installation data
21010
+ * Install a template.
21011
+ *
21012
+ * `POST /v1/project/template/install` decodes body `TemplateInstall = { id,
21013
+ * data, activation_code }` and resolves the target workspace from the
21014
+ * `X-Workspace-Uuid` request header (not the body) — see platform-api's
21015
+ * `template_install.go`. This method keeps the ergonomic object-arg
21016
+ * signature but maps it onto that contract: `template_id` becomes body
21017
+ * `id`, `workspace_uuid` is sent as the `X-Workspace-Uuid` header, and any
21018
+ * `data`/`activation_code` passed in are forwarded in the body as-is.
21019
+ *
21020
+ * @param data `{ template_id, workspace_uuid, data?, activation_code? }`
20701
21021
  */
20702
21022
  async installTemplate(data) {
20703
- return await this.client.post("/v1/project/template/install", data);
21023
+ const { template_id, workspace_uuid, ...rest } = data;
21024
+ return await this.client.post("/v1/project/template/install", { id: template_id, ...rest }, { headers: { "X-Workspace-Uuid": workspace_uuid } });
20704
21025
  }
20705
21026
  /**
20706
- * Uninstall a template
20707
- * @param data Uninstallation data
21027
+ * Uninstall a template.
21028
+ *
21029
+ * `POST /v1/project/template/uninstall` decodes body `TemplateInstall = {
21030
+ * id, data, activation_code }` and resolves the target workspace from the
21031
+ * `X-Workspace-Uuid` request header (not the body) — see platform-api's
21032
+ * `template_uninstall.go`. See `installTemplate` for the mapping.
21033
+ *
21034
+ * @param data `{ template_id, workspace_uuid, data?, activation_code? }`
20708
21035
  */
20709
21036
  async uninstallTemplate(data) {
20710
- return await this.client.post("/v1/project/template/uninstall", data);
21037
+ const { template_id, workspace_uuid, ...rest } = data;
21038
+ return await this.client.post("/v1/project/template/uninstall", { id: template_id, ...rest }, { headers: { "X-Workspace-Uuid": workspace_uuid } });
20711
21039
  }
20712
21040
  /**
20713
- * Upgrade a template
20714
- * @param data Upgrade data
21041
+ * Upgrade a template.
21042
+ *
21043
+ * `POST /v1/project/template/upgrade` decodes body `TemplateInstall = {
21044
+ * id, data, activation_code }` and resolves the target workspace from the
21045
+ * `X-Workspace-Uuid` request header (not the body) — see platform-api's
21046
+ * `template_upgrade.go`. See `installTemplate` for the mapping.
21047
+ *
21048
+ * @param data `{ template_id, workspace_uuid, data?, activation_code? }`
20715
21049
  */
20716
21050
  async upgradeTemplate(data) {
20717
- return await this.client.post("/v1/project/template/upgrade", data);
21051
+ const { template_id, workspace_uuid, ...rest } = data;
21052
+ return await this.client.post("/v1/project/template/upgrade", { id: template_id, ...rest }, { headers: { "X-Workspace-Uuid": workspace_uuid } });
20718
21053
  }
20719
21054
  }
20720
21055
 
@@ -20734,62 +21069,6 @@ class Config extends PlatformBaseClient {
20734
21069
  }
20735
21070
  }
20736
21071
 
20737
- // apis
20738
- class Platform extends PlatformBaseClient {
20739
- getPlatformClient() {
20740
- return this.client;
20741
- }
20742
- getPlatformBaseURL() {
20743
- var _a;
20744
- return (_a = this.client.defaults.baseURL) !== null && _a !== void 0 ? _a : "";
20745
- }
20746
- apiUser() {
20747
- return (new APIUser()).setClient(this.client);
20748
- }
20749
- function() {
20750
- return (new Functions()).setClient(this.client);
20751
- }
20752
- user() {
20753
- return (new Users()).setClient(this.client);
20754
- }
20755
- app(appType) {
20756
- return (new Apps(appType)).setClient(this.client);
20757
- }
20758
- forge() {
20759
- return (new Forge()).setClient(this.client);
20760
- }
20761
- kortex() {
20762
- return (new Kortex()).setClient(this.client);
20763
- }
20764
- component(ref) {
20765
- return (new Component(ref)).setClient(this.client);
20766
- }
20767
- componentUtils() {
20768
- return (new ComponentUtils()).setClient(this.client);
20769
- }
20770
- ratchet() {
20771
- return (new Ratchet()).setClient(this.client);
20772
- }
20773
- sandbox() {
20774
- return (new Sandbox()).setClient(this.client);
20775
- }
20776
- system() {
20777
- return (new System()).setClient(this.client);
20778
- }
20779
- workflow() {
20780
- return (new Workflow()).setClient(this.client);
20781
- }
20782
- thunder() {
20783
- return (new Thunder()).setClient(this.client);
20784
- }
20785
- project() {
20786
- return (new Project()).setClient(this.client);
20787
- }
20788
- config() {
20789
- return (new Config()).setClient(this.client);
20790
- }
20791
- }
20792
-
20793
21072
  class IntegrationsBaseClient extends BaseClient {
20794
21073
  constructor(options) {
20795
21074
  var _a, _b, _c, _d, _e, _f, _g;
@@ -20803,6 +21082,7 @@ class IntegrationsBaseClient extends BaseClient {
20803
21082
  // @ts-ignore
20804
21083
  env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
20805
21084
  token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
21085
+ project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
20806
21086
  if (isBrowser) {
20807
21087
  if (sessionStorage.getItem('protokol_context') === 'forge') {
20808
21088
  headers['X-Project-Env'] = (_b = sessionStorage.getItem('forge_app_env')) !== null && _b !== void 0 ? _b : 'dev';
@@ -21668,6 +21948,135 @@ class DMS extends IntegrationsBaseClient {
21668
21948
  timeout: 120000
21669
21949
  });
21670
21950
  }
21951
+ // ===================================================================
21952
+ // Backup (Library Export Archives)
21953
+ // ===================================================================
21954
+ /**
21955
+ * Create a library export archive (a snapshot of the project's library or a directory within it)
21956
+ *
21957
+ * The library is resolved server-side from the project in the auth context —
21958
+ * there is a single library per project.
21959
+ *
21960
+ * @param payload - Optional export scope/format options
21961
+ * @returns `{ mode, export }` when the export is queued asynchronously.
21962
+ * Depending on server-side sizing, the endpoint may instead stream the
21963
+ * archive back directly as a binary response body (not this JSON shape).
21964
+ *
21965
+ * @example
21966
+ * ```typescript
21967
+ * const result = await dms.createExport({ path: 'legal', format: 'zip' });
21968
+ * ```
21969
+ */
21970
+ async createExport(payload) {
21971
+ return this.request('POST', `library/exports`, { data: payload !== null && payload !== void 0 ? payload : {} });
21972
+ }
21973
+ /**
21974
+ * List export archives for the project's library
21975
+ */
21976
+ async listExports() {
21977
+ return this.request('GET', `library/exports`);
21978
+ }
21979
+ /**
21980
+ * Get a single export archive (an archived snapshot of a library/dir)
21981
+ *
21982
+ * @param exportUuid - Export UUID
21983
+ * @returns `{ export, download_url }`
21984
+ */
21985
+ async getExport(exportUuid) {
21986
+ return this.request('GET', `library/exports/${exportUuid}`);
21987
+ }
21988
+ // ===================================================================
21989
+ // Policies (Quota / File-Type / Notification, library & dir scope)
21990
+ // ===================================================================
21991
+ /**
21992
+ * Get the effective library-level policy for the project's library
21993
+ */
21994
+ async getLibraryPolicy() {
21995
+ return this.request('GET', `library/policy`);
21996
+ }
21997
+ /**
21998
+ * Set/update the library-level policy for the project's library
21999
+ *
22000
+ * @param payload - Policy fields to set
22001
+ */
22002
+ async setLibraryPolicy(payload) {
22003
+ return this.request('PUT', `library/policy`, { data: payload });
22004
+ }
22005
+ /**
22006
+ * Get the directory-level policy (resolves platform-default → library → dir)
22007
+ *
22008
+ * @param path - Directory path
22009
+ */
22010
+ async getDirPolicy(path) {
22011
+ return this.request('GET', `library/dir/policy`, { params: { path } });
22012
+ }
22013
+ /**
22014
+ * Set/update the directory-level policy
22015
+ *
22016
+ * @param path - Directory path
22017
+ * @param payload - Policy fields to set (only fields provided override the library policy)
22018
+ */
22019
+ async setDirPolicy(path, payload) {
22020
+ return this.request('PUT', `library/dir/policy`, { data: payload, params: { path } });
22021
+ }
22022
+ /**
22023
+ * Remove a directory-level policy override (directory falls back to the library policy)
22024
+ *
22025
+ * @param path - Directory path
22026
+ */
22027
+ async deleteDirPolicy(path) {
22028
+ return this.request('DELETE', `library/dir/policy`, { params: { path } });
22029
+ }
22030
+ // ===================================================================
22031
+ // Reminders (Notification Rules & Per-File Notifications)
22032
+ // ===================================================================
22033
+ /**
22034
+ * List notification rules for the project's library
22035
+ */
22036
+ async listNotificationRules() {
22037
+ return this.request('GET', `library/notification-rules`);
22038
+ }
22039
+ /**
22040
+ * Create a recurring reminder (notification rule) for a media file
22041
+ *
22042
+ * @param payload - Recurring reminder definition (media_uuid/file_key, frequency, start_at, ...)
22043
+ */
22044
+ async createNotificationRule(payload) {
22045
+ return this.request('POST', `library/notification-rules`, { data: payload });
22046
+ }
22047
+ /**
22048
+ * Delete a notification rule
22049
+ *
22050
+ * @param ruleUuid - Notification rule UUID
22051
+ */
22052
+ async deleteNotificationRule(ruleUuid) {
22053
+ return this.request('DELETE', `library/notification-rules/${ruleUuid}`);
22054
+ }
22055
+ /**
22056
+ * List custom reminders scheduled for a specific file
22057
+ *
22058
+ * @param mediaUuid - Media UUID
22059
+ */
22060
+ async listFileNotifications(mediaUuid) {
22061
+ return this.request('GET', `library/media/${mediaUuid}/notifications`);
22062
+ }
22063
+ /**
22064
+ * Create a custom reminder for a specific file
22065
+ *
22066
+ * @param mediaUuid - Media UUID
22067
+ * @param payload - Reminder details (note, notify_at, optional recipient)
22068
+ */
22069
+ async createFileNotification(mediaUuid, payload) {
22070
+ return this.request('POST', `library/media/${mediaUuid}/notifications`, { data: payload });
22071
+ }
22072
+ /**
22073
+ * Cancel/delete a custom file reminder
22074
+ *
22075
+ * @param notificationUuid - Notification UUID
22076
+ */
22077
+ async deleteFileNotification(notificationUuid) {
22078
+ return this.request('DELETE', `library/notifications/${notificationUuid}`);
22079
+ }
21671
22080
  async request(method, endpoint, params) {
21672
22081
  return await this.client.request({
21673
22082
  method: method,
@@ -21879,36 +22288,41 @@ class MinFin extends IntegrationsBaseClient {
21879
22288
  }
21880
22289
 
21881
22290
  class Payments extends IntegrationsBaseClient {
22291
+ // FIXME: No backend route exists for listing/searching transactions (neither
22292
+ // monri.route.ts nor wspay.route.ts under karadjordje/src/routes/v1/payments/
22293
+ // expose a "list" endpoint). This method's URL is left as-is (still broken)
22294
+ // rather than being "fixed" to another guessed path that would still 404.
22295
+ // Do not call this method until a corresponding backend route is added.
21882
22296
  async getTransactions(userId, params) {
21883
22297
  return await this.client.get(`/karadjordje/v1/payment/${userId}/list`, {
21884
22298
  params,
21885
22299
  });
21886
22300
  }
21887
- async getTransaction(provider, userId, transactionId) {
21888
- return await this.client.get(`/karadjordje/v1/payment/${provider}/${userId}/getTransaction`, {
22301
+ async getTransaction(provider, transactionId) {
22302
+ return await this.client.get(`/karadjordje/v1/payment/${provider}/getTransaction`, {
21889
22303
  params: { transactionId },
21890
22304
  });
21891
22305
  }
21892
22306
  async settings(provider) {
21893
22307
  return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
21894
22308
  }
21895
- async deactivatePaymentLink(provider, user, transactionId) {
21896
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/deactivate/${transactionId}`);
22309
+ async deactivatePaymentLink(provider, transactionId) {
22310
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/deactivate/${transactionId}`);
21897
22311
  }
21898
- async voidTransaction(provider, user, transactionId) {
21899
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/void/${transactionId}`);
22312
+ async voidTransaction(provider, transactionId) {
22313
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/void/${transactionId}`);
21900
22314
  }
21901
- async refund(provider, user, transactionId) {
21902
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/refund/${transactionId}`);
22315
+ async refund(provider, transactionId) {
22316
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/refund/${transactionId}`);
21903
22317
  }
21904
- async getPaymentLink(provider, user, options) {
21905
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, options);
22318
+ async getPaymentLink(provider, options) {
22319
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/getPaymentLink`, options);
21906
22320
  }
21907
- async getTokenRequestLink(provider, user, options) {
21908
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getTokenRequestLink`, options);
22321
+ async getTokenRequestLink(provider, options) {
22322
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/getTokenRequestLink`, options);
21909
22323
  }
21910
- async directPayUsingToken(provider, user, options) {
21911
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/directPayUsingToken`, options);
22324
+ async directPayUsingToken(provider, options) {
22325
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/directPayUsingToken`, options);
21912
22326
  }
21913
22327
  }
21914
22328
 
@@ -22837,6 +23251,65 @@ class Integrations extends IntegrationsBaseClient {
22837
23251
  const { data } = await this.client.get("/v1/integrations");
22838
23252
  return data.find((i) => i.id == id && i.status == "active") !== undefined;
22839
23253
  }
23254
+ /**
23255
+ * Install (integrate) an integration into the current project.
23256
+ * POST /v1/integrate
23257
+ */
23258
+ async install(id, data) {
23259
+ const { data: resp } = await this.client.post("/v1/integrate", {
23260
+ id,
23261
+ ...(data !== undefined ? { data } : {}),
23262
+ });
23263
+ return resp;
23264
+ }
23265
+ /**
23266
+ * Uninstall (remove) an integration from the current project.
23267
+ * PUT /v1/integrate
23268
+ */
23269
+ async uninstall(id) {
23270
+ const { data } = await this.client.put("/v1/integrate", { id });
23271
+ return data;
23272
+ }
23273
+ /**
23274
+ * Activate an installed integration.
23275
+ * POST /v1/integration/{id}/activate
23276
+ */
23277
+ async activate(id) {
23278
+ const { data } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/activate`);
23279
+ return data;
23280
+ }
23281
+ /**
23282
+ * Deactivate an installed integration.
23283
+ * POST /v1/integration/{id}/deactivate
23284
+ */
23285
+ async deactivate(id) {
23286
+ const { data } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/deactivate`);
23287
+ return data;
23288
+ }
23289
+ /**
23290
+ * Advance/update the onboarding state of an installed integration.
23291
+ * POST /v1/integration/{id}/onboarding
23292
+ */
23293
+ async onboarding(id, data) {
23294
+ const { data: resp } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/onboarding`, data);
23295
+ return resp;
23296
+ }
23297
+ /**
23298
+ * List marketplace-available integrations (subscription/geo aware).
23299
+ * GET /v1/marketplace/integrations
23300
+ */
23301
+ async marketplace() {
23302
+ const { data } = await this.client.get("/v1/marketplace/integrations");
23303
+ return data;
23304
+ }
23305
+ /**
23306
+ * List explorable integration templates (subscription/geo aware).
23307
+ * GET /v1/integrations/explore
23308
+ */
23309
+ async explore() {
23310
+ const { data } = await this.client.get("/v1/integrations/explore");
23311
+ return data;
23312
+ }
22840
23313
  getInterfaceOf(id) {
22841
23314
  try {
22842
23315
  return this.integrations[id];
@@ -22849,57 +23322,286 @@ class Integrations extends IntegrationsBaseClient {
22849
23322
 
22850
23323
  class Satellites extends IntegrationsBaseClient {
22851
23324
  async list() {
22852
- const { data } = await this.client.get('/satellites/templates');
23325
+ const { data } = await this.client.get('/v1/satellites/templates');
22853
23326
  return data;
22854
23327
  }
22855
23328
  async create(payload) {
22856
- const { data } = await this.client.post('/satellites/templates', payload.template);
23329
+ const { data } = await this.client.post('/v1/satellites/templates', payload.template);
22857
23330
  if (payload.schema) {
22858
23331
  await this.createVersion(data.id, payload.schema);
22859
23332
  }
22860
23333
  return data;
22861
23334
  }
22862
23335
  async get(id) {
22863
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
23336
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}`);
22864
23337
  return data;
22865
23338
  }
22866
23339
  async delete(id) {
22867
- const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
23340
+ const { data } = await this.client.delete(`/v1/satellites/templates/${encodeURIComponent(id)}`);
22868
23341
  return data;
22869
23342
  }
22870
23343
  async createVersion(id, payload) {
22871
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
23344
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
22872
23345
  return data;
22873
23346
  }
22874
23347
  async versions(id) {
22875
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
23348
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/versions`);
22876
23349
  return data;
22877
23350
  }
22878
23351
  async deploy(id, payload) {
22879
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
23352
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
22880
23353
  return data;
22881
23354
  }
22882
23355
  async rollback(id, payload) {
22883
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
23356
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
22884
23357
  return data;
22885
23358
  }
22886
23359
  async permissions(id) {
22887
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
23360
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/permissions`);
22888
23361
  return data;
22889
23362
  }
22890
23363
  async logs(id, params = {}) {
22891
23364
  const since = params.since instanceof Date ? params.since.toISOString() : params.since;
22892
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
23365
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/logs`, {
22893
23366
  params: since ? { since } : undefined,
22894
23367
  });
22895
23368
  return data;
22896
23369
  }
22897
23370
  async execute(id, command, payload = {}) {
22898
- const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
23371
+ const { data } = await this.client.post(`/v1/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
22899
23372
  return data;
22900
23373
  }
22901
23374
  }
22902
23375
 
23376
+ const BASE = "/luma/transactions/v1";
23377
+ /**
23378
+ * Transactions client — billing/subscriptions, invoices, credits/balance,
23379
+ * usage pricing and per-project billing-mode overrides. All routes go
23380
+ * through the `transactions/…` gateway prefix (`/luma/transactions/v1/...`),
23381
+ * matching the transactions service's REST surface
23382
+ * (`internal/controllers/{subscription,invoices,topup,credit_history,billing_modes,prices,balance}.go`).
23383
+ *
23384
+ * This is the **billing** service — not distributed/database transactions.
23385
+ */
23386
+ class Transactions extends PlatformBaseClient {
23387
+ // ---------------------------------------------------------------
23388
+ // Subscriptions
23389
+ // ---------------------------------------------------------------
23390
+ /**
23391
+ * List all subscriptions (including expired) for the current project.
23392
+ *
23393
+ * @example
23394
+ * const subs = await platform.transactions().getSubscriptions()
23395
+ */
23396
+ async getSubscriptions() {
23397
+ return await this.client.get(`${BASE}/billing/subscription`);
23398
+ }
23399
+ /**
23400
+ * Renew an expired subscription (and any others sharing its bundle
23401
+ * `ref_no`) — creates a renewal invoice and returns a checkout link.
23402
+ */
23403
+ async renewSubscription(payload) {
23404
+ return await this.client.post(`${BASE}/subscription/renew`, payload);
23405
+ }
23406
+ /**
23407
+ * Cancel a subscription. Issues a refund automatically if still within
23408
+ * the refund period.
23409
+ */
23410
+ async cancelSubscription(payload) {
23411
+ return await this.client.post(`${BASE}/subscription/cancel`, payload);
23412
+ }
23413
+ // ---------------------------------------------------------------
23414
+ // Invoices
23415
+ // ---------------------------------------------------------------
23416
+ /**
23417
+ * List all invoices for the current project.
23418
+ */
23419
+ async getInvoices() {
23420
+ return await this.client.get(`${BASE}/billing/invoices`);
23421
+ }
23422
+ /**
23423
+ * Get a single invoice by uuid.
23424
+ */
23425
+ async getInvoice(uuid) {
23426
+ return await this.client.get(`${BASE}/billing/invoice/${uuid}`);
23427
+ }
23428
+ /**
23429
+ * Download an invoice as a PDF. Resolves with the raw PDF bytes
23430
+ * (`responseType: "arraybuffer"`).
23431
+ *
23432
+ * @example
23433
+ * const { data } = await platform.transactions().getInvoicePdf(uuid)
23434
+ * fs.writeFileSync("invoice.pdf", Buffer.from(data))
23435
+ */
23436
+ async getInvoicePdf(uuid) {
23437
+ return await this.client.get(`${BASE}/billing/invoice/${uuid}/pdf`, {
23438
+ responseType: "arraybuffer",
23439
+ });
23440
+ }
23441
+ // ---------------------------------------------------------------
23442
+ // Balance / credits / top-up
23443
+ // ---------------------------------------------------------------
23444
+ /**
23445
+ * Get the current project's credit balance.
23446
+ */
23447
+ async getBalance() {
23448
+ return await this.client.get(`${BASE}/billing/balance`);
23449
+ }
23450
+ /**
23451
+ * Generate a checkout link to manually top up the project's credit balance.
23452
+ */
23453
+ async topUp(payload) {
23454
+ return await this.client.post(`${BASE}/billing/topup`, payload);
23455
+ }
23456
+ /**
23457
+ * Get the project's credit activity (deductions/top-ups) history, paginated.
23458
+ */
23459
+ async getCreditsHistory(query) {
23460
+ return await this.client.get(`${BASE}/billing/credits/history`, {
23461
+ params: query,
23462
+ });
23463
+ }
23464
+ // ---------------------------------------------------------------
23465
+ // Prices
23466
+ // ---------------------------------------------------------------
23467
+ /**
23468
+ * Get the usage-based pricing table for a given currency.
23469
+ *
23470
+ * @param currency - ISO 4217 currency code, e.g. "USD" or "RSD".
23471
+ */
23472
+ async getPrices(currency) {
23473
+ return await this.client.get(`${BASE}/prices/${currency}`);
23474
+ }
23475
+ // ---------------------------------------------------------------
23476
+ // Billing modes (per-project usage billing overrides)
23477
+ // ---------------------------------------------------------------
23478
+ /**
23479
+ * Get the project's usage-billing-mode overrides plus platform defaults.
23480
+ */
23481
+ async getBillingModes() {
23482
+ return await this.client.get(`${BASE}/billing/billing-modes`);
23483
+ }
23484
+ /**
23485
+ * Set the billing mode ("credits" | "hybrid" | "invoice") for a usage
23486
+ * option code on the current project.
23487
+ */
23488
+ async updateBillingModes(payload) {
23489
+ return await this.client.put(`${BASE}/billing/billing-modes`, payload);
23490
+ }
23491
+ }
23492
+
23493
+ // apis
23494
+ class Platform extends PlatformBaseClient {
23495
+ getPlatformClient() {
23496
+ return this.client;
23497
+ }
23498
+ getPlatformBaseURL() {
23499
+ var _a;
23500
+ return (_a = this.client.defaults.baseURL) !== null && _a !== void 0 ? _a : "";
23501
+ }
23502
+ apiUser() {
23503
+ return (new APIUser()).setClient(this.client);
23504
+ }
23505
+ function() {
23506
+ return (new Functions()).setClient(this.client);
23507
+ }
23508
+ user() {
23509
+ return (new Users()).setClient(this.client);
23510
+ }
23511
+ app(appType) {
23512
+ return (new Apps(appType)).setClient(this.client);
23513
+ }
23514
+ forge() {
23515
+ return (new Forge()).setClient(this.client);
23516
+ }
23517
+ kortex() {
23518
+ return (new Kortex()).setClient(this.client);
23519
+ }
23520
+ component(ref) {
23521
+ return (new Component(ref)).setClient(this.client);
23522
+ }
23523
+ componentUtils() {
23524
+ return (new ComponentUtils()).setClient(this.client);
23525
+ }
23526
+ ratchet() {
23527
+ return (new Ratchet()).setClient(this.client);
23528
+ }
23529
+ sandbox() {
23530
+ return (new Sandbox()).setClient(this.client);
23531
+ }
23532
+ system() {
23533
+ return (new System()).setClient(this.client);
23534
+ }
23535
+ workflow() {
23536
+ return (new Workflow()).setClient(this.client);
23537
+ }
23538
+ thunder() {
23539
+ return (new Thunder()).setClient(this.client);
23540
+ }
23541
+ project() {
23542
+ return (new Project()).setClient(this.client);
23543
+ }
23544
+ config() {
23545
+ return (new Config()).setClient(this.client);
23546
+ }
23547
+ /**
23548
+ * Convenience factory for the Integrations gateway façade.
23549
+ *
23550
+ * Integrations live behind a different gateway (`INTEGRATION_API` /
23551
+ * `host/luma/integrations`) than the rest of the platform API, so this
23552
+ * returns an independently-configured `Integrations` client (it does not
23553
+ * reuse `this.client`, whose base URL points at the platform host). The
23554
+ * Platform's resolved token/env/host are propagated so the child client
23555
+ * carries the same credentials.
23556
+ */
23557
+ integrations() {
23558
+ return new Integrations(this.getIntegrationsGatewayOptions());
23559
+ }
23560
+ /**
23561
+ * Convenience factory for the Satellites (custom JSON-RPC integrations) client.
23562
+ *
23563
+ * Same gateway note as `integrations()` — Satellites talks to the
23564
+ * integrations gateway, not the platform host, so a fresh, independently
23565
+ * configured client is returned, with the Platform's credentials propagated.
23566
+ */
23567
+ satellites() {
23568
+ return new Satellites(this.getIntegrationsGatewayOptions());
23569
+ }
23570
+ /**
23571
+ * Builds the options for a child integrations-gateway client (`Integrations`/
23572
+ * `Satellites`), propagating this Platform's resolved token/env, and deriving
23573
+ * the gateway host from this Platform's host when one was explicitly set.
23574
+ * When `this.host` is unset, `host` is left `undefined` so the child client's
23575
+ * own env-var/default resolution applies.
23576
+ */
23577
+ getIntegrationsGatewayOptions() {
23578
+ var _a, _b;
23579
+ return {
23580
+ token: (_a = this.token) !== null && _a !== void 0 ? _a : undefined,
23581
+ env: (_b = this.env) !== null && _b !== void 0 ? _b : undefined,
23582
+ host: this.host ? `${this.host.replace(/\/+$/, "")}/luma/integrations` : undefined,
23583
+ };
23584
+ }
23585
+ /**
23586
+ * Transactions (billing) client — subscriptions, invoices, credits/balance,
23587
+ * usage pricing and billing-mode overrides. Reached through the platform
23588
+ * gateway (`transactions/…`), so it reuses `this.client` like the other
23589
+ * native/proxied-service factories.
23590
+ *
23591
+ * This is the **billing** service — not distributed/database transactions.
23592
+ */
23593
+ transactions() {
23594
+ return (new Transactions()).setClient(this.client);
23595
+ }
23596
+ /**
23597
+ * Alias for `transactions()` — reads more naturally at call sites that
23598
+ * only care about billing (`platform.billing().getBalance()`).
23599
+ */
23600
+ billing() {
23601
+ return this.transactions();
23602
+ }
23603
+ }
23604
+
22903
23605
  // PRN — Protokol Resource Name
22904
23606
  //
22905
23607
  // Format:
@@ -23078,6 +23780,7 @@ exports.SerbiaMinFin = MinFin;
23078
23780
  exports.System = System;
23079
23781
  exports.Thunder = Thunder;
23080
23782
  exports.Timber = Timber;
23783
+ exports.Transactions = Transactions;
23081
23784
  exports.Users = Users;
23082
23785
  exports.VPFR = VPFR;
23083
23786
  exports.Workflow = Workflow;