@ptkl/sdk 1.14.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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;
@@ -21668,6 +21947,135 @@ class DMS extends IntegrationsBaseClient {
21668
21947
  timeout: 120000
21669
21948
  });
21670
21949
  }
21950
+ // ===================================================================
21951
+ // Backup (Library Export Archives)
21952
+ // ===================================================================
21953
+ /**
21954
+ * Create a library export archive (a snapshot of the project's library or a directory within it)
21955
+ *
21956
+ * The library is resolved server-side from the project in the auth context —
21957
+ * there is a single library per project.
21958
+ *
21959
+ * @param payload - Optional export scope/format options
21960
+ * @returns `{ mode, export }` when the export is queued asynchronously.
21961
+ * Depending on server-side sizing, the endpoint may instead stream the
21962
+ * archive back directly as a binary response body (not this JSON shape).
21963
+ *
21964
+ * @example
21965
+ * ```typescript
21966
+ * const result = await dms.createExport({ path: 'legal', format: 'zip' });
21967
+ * ```
21968
+ */
21969
+ async createExport(payload) {
21970
+ return this.request('POST', `library/exports`, { data: payload !== null && payload !== void 0 ? payload : {} });
21971
+ }
21972
+ /**
21973
+ * List export archives for the project's library
21974
+ */
21975
+ async listExports() {
21976
+ return this.request('GET', `library/exports`);
21977
+ }
21978
+ /**
21979
+ * Get a single export archive (an archived snapshot of a library/dir)
21980
+ *
21981
+ * @param exportUuid - Export UUID
21982
+ * @returns `{ export, download_url }`
21983
+ */
21984
+ async getExport(exportUuid) {
21985
+ return this.request('GET', `library/exports/${exportUuid}`);
21986
+ }
21987
+ // ===================================================================
21988
+ // Policies (Quota / File-Type / Notification, library & dir scope)
21989
+ // ===================================================================
21990
+ /**
21991
+ * Get the effective library-level policy for the project's library
21992
+ */
21993
+ async getLibraryPolicy() {
21994
+ return this.request('GET', `library/policy`);
21995
+ }
21996
+ /**
21997
+ * Set/update the library-level policy for the project's library
21998
+ *
21999
+ * @param payload - Policy fields to set
22000
+ */
22001
+ async setLibraryPolicy(payload) {
22002
+ return this.request('PUT', `library/policy`, { data: payload });
22003
+ }
22004
+ /**
22005
+ * Get the directory-level policy (resolves platform-default → library → dir)
22006
+ *
22007
+ * @param path - Directory path
22008
+ */
22009
+ async getDirPolicy(path) {
22010
+ return this.request('GET', `library/dir/policy`, { params: { path } });
22011
+ }
22012
+ /**
22013
+ * Set/update the directory-level policy
22014
+ *
22015
+ * @param path - Directory path
22016
+ * @param payload - Policy fields to set (only fields provided override the library policy)
22017
+ */
22018
+ async setDirPolicy(path, payload) {
22019
+ return this.request('PUT', `library/dir/policy`, { data: payload, params: { path } });
22020
+ }
22021
+ /**
22022
+ * Remove a directory-level policy override (directory falls back to the library policy)
22023
+ *
22024
+ * @param path - Directory path
22025
+ */
22026
+ async deleteDirPolicy(path) {
22027
+ return this.request('DELETE', `library/dir/policy`, { params: { path } });
22028
+ }
22029
+ // ===================================================================
22030
+ // Reminders (Notification Rules & Per-File Notifications)
22031
+ // ===================================================================
22032
+ /**
22033
+ * List notification rules for the project's library
22034
+ */
22035
+ async listNotificationRules() {
22036
+ return this.request('GET', `library/notification-rules`);
22037
+ }
22038
+ /**
22039
+ * Create a recurring reminder (notification rule) for a media file
22040
+ *
22041
+ * @param payload - Recurring reminder definition (media_uuid/file_key, frequency, start_at, ...)
22042
+ */
22043
+ async createNotificationRule(payload) {
22044
+ return this.request('POST', `library/notification-rules`, { data: payload });
22045
+ }
22046
+ /**
22047
+ * Delete a notification rule
22048
+ *
22049
+ * @param ruleUuid - Notification rule UUID
22050
+ */
22051
+ async deleteNotificationRule(ruleUuid) {
22052
+ return this.request('DELETE', `library/notification-rules/${ruleUuid}`);
22053
+ }
22054
+ /**
22055
+ * List custom reminders scheduled for a specific file
22056
+ *
22057
+ * @param mediaUuid - Media UUID
22058
+ */
22059
+ async listFileNotifications(mediaUuid) {
22060
+ return this.request('GET', `library/media/${mediaUuid}/notifications`);
22061
+ }
22062
+ /**
22063
+ * Create a custom reminder for a specific file
22064
+ *
22065
+ * @param mediaUuid - Media UUID
22066
+ * @param payload - Reminder details (note, notify_at, optional recipient)
22067
+ */
22068
+ async createFileNotification(mediaUuid, payload) {
22069
+ return this.request('POST', `library/media/${mediaUuid}/notifications`, { data: payload });
22070
+ }
22071
+ /**
22072
+ * Cancel/delete a custom file reminder
22073
+ *
22074
+ * @param notificationUuid - Notification UUID
22075
+ */
22076
+ async deleteFileNotification(notificationUuid) {
22077
+ return this.request('DELETE', `library/notifications/${notificationUuid}`);
22078
+ }
21671
22079
  async request(method, endpoint, params) {
21672
22080
  return await this.client.request({
21673
22081
  method: method,
@@ -22837,6 +23245,65 @@ class Integrations extends IntegrationsBaseClient {
22837
23245
  const { data } = await this.client.get("/v1/integrations");
22838
23246
  return data.find((i) => i.id == id && i.status == "active") !== undefined;
22839
23247
  }
23248
+ /**
23249
+ * Install (integrate) an integration into the current project.
23250
+ * POST /v1/integrate
23251
+ */
23252
+ async install(id, data) {
23253
+ const { data: resp } = await this.client.post("/v1/integrate", {
23254
+ id,
23255
+ ...(data !== undefined ? { data } : {}),
23256
+ });
23257
+ return resp;
23258
+ }
23259
+ /**
23260
+ * Uninstall (remove) an integration from the current project.
23261
+ * PUT /v1/integrate
23262
+ */
23263
+ async uninstall(id) {
23264
+ const { data } = await this.client.put("/v1/integrate", { id });
23265
+ return data;
23266
+ }
23267
+ /**
23268
+ * Activate an installed integration.
23269
+ * POST /v1/integration/{id}/activate
23270
+ */
23271
+ async activate(id) {
23272
+ const { data } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/activate`);
23273
+ return data;
23274
+ }
23275
+ /**
23276
+ * Deactivate an installed integration.
23277
+ * POST /v1/integration/{id}/deactivate
23278
+ */
23279
+ async deactivate(id) {
23280
+ const { data } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/deactivate`);
23281
+ return data;
23282
+ }
23283
+ /**
23284
+ * Advance/update the onboarding state of an installed integration.
23285
+ * POST /v1/integration/{id}/onboarding
23286
+ */
23287
+ async onboarding(id, data) {
23288
+ const { data: resp } = await this.client.post(`/v1/integration/${encodeURIComponent(id)}/onboarding`, data);
23289
+ return resp;
23290
+ }
23291
+ /**
23292
+ * List marketplace-available integrations (subscription/geo aware).
23293
+ * GET /v1/marketplace/integrations
23294
+ */
23295
+ async marketplace() {
23296
+ const { data } = await this.client.get("/v1/marketplace/integrations");
23297
+ return data;
23298
+ }
23299
+ /**
23300
+ * List explorable integration templates (subscription/geo aware).
23301
+ * GET /v1/integrations/explore
23302
+ */
23303
+ async explore() {
23304
+ const { data } = await this.client.get("/v1/integrations/explore");
23305
+ return data;
23306
+ }
22840
23307
  getInterfaceOf(id) {
22841
23308
  try {
22842
23309
  return this.integrations[id];
@@ -22849,57 +23316,286 @@ class Integrations extends IntegrationsBaseClient {
22849
23316
 
22850
23317
  class Satellites extends IntegrationsBaseClient {
22851
23318
  async list() {
22852
- const { data } = await this.client.get('/satellites/templates');
23319
+ const { data } = await this.client.get('/v1/satellites/templates');
22853
23320
  return data;
22854
23321
  }
22855
23322
  async create(payload) {
22856
- const { data } = await this.client.post('/satellites/templates', payload.template);
23323
+ const { data } = await this.client.post('/v1/satellites/templates', payload.template);
22857
23324
  if (payload.schema) {
22858
23325
  await this.createVersion(data.id, payload.schema);
22859
23326
  }
22860
23327
  return data;
22861
23328
  }
22862
23329
  async get(id) {
22863
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
23330
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}`);
22864
23331
  return data;
22865
23332
  }
22866
23333
  async delete(id) {
22867
- const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
23334
+ const { data } = await this.client.delete(`/v1/satellites/templates/${encodeURIComponent(id)}`);
22868
23335
  return data;
22869
23336
  }
22870
23337
  async createVersion(id, payload) {
22871
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
23338
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
22872
23339
  return data;
22873
23340
  }
22874
23341
  async versions(id) {
22875
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
23342
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/versions`);
22876
23343
  return data;
22877
23344
  }
22878
23345
  async deploy(id, payload) {
22879
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
23346
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
22880
23347
  return data;
22881
23348
  }
22882
23349
  async rollback(id, payload) {
22883
- const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
23350
+ const { data } = await this.client.post(`/v1/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
22884
23351
  return data;
22885
23352
  }
22886
23353
  async permissions(id) {
22887
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
23354
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/permissions`);
22888
23355
  return data;
22889
23356
  }
22890
23357
  async logs(id, params = {}) {
22891
23358
  const since = params.since instanceof Date ? params.since.toISOString() : params.since;
22892
- const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
23359
+ const { data } = await this.client.get(`/v1/satellites/templates/${encodeURIComponent(id)}/logs`, {
22893
23360
  params: since ? { since } : undefined,
22894
23361
  });
22895
23362
  return data;
22896
23363
  }
22897
23364
  async execute(id, command, payload = {}) {
22898
- const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
23365
+ const { data } = await this.client.post(`/v1/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
22899
23366
  return data;
22900
23367
  }
22901
23368
  }
22902
23369
 
23370
+ const BASE = "/luma/transactions/v1";
23371
+ /**
23372
+ * Transactions client — billing/subscriptions, invoices, credits/balance,
23373
+ * usage pricing and per-project billing-mode overrides. All routes go
23374
+ * through the `transactions/…` gateway prefix (`/luma/transactions/v1/...`),
23375
+ * matching the transactions service's REST surface
23376
+ * (`internal/controllers/{subscription,invoices,topup,credit_history,billing_modes,prices,balance}.go`).
23377
+ *
23378
+ * This is the **billing** service — not distributed/database transactions.
23379
+ */
23380
+ class Transactions extends PlatformBaseClient {
23381
+ // ---------------------------------------------------------------
23382
+ // Subscriptions
23383
+ // ---------------------------------------------------------------
23384
+ /**
23385
+ * List all subscriptions (including expired) for the current project.
23386
+ *
23387
+ * @example
23388
+ * const subs = await platform.transactions().getSubscriptions()
23389
+ */
23390
+ async getSubscriptions() {
23391
+ return await this.client.get(`${BASE}/billing/subscription`);
23392
+ }
23393
+ /**
23394
+ * Renew an expired subscription (and any others sharing its bundle
23395
+ * `ref_no`) — creates a renewal invoice and returns a checkout link.
23396
+ */
23397
+ async renewSubscription(payload) {
23398
+ return await this.client.post(`${BASE}/subscription/renew`, payload);
23399
+ }
23400
+ /**
23401
+ * Cancel a subscription. Issues a refund automatically if still within
23402
+ * the refund period.
23403
+ */
23404
+ async cancelSubscription(payload) {
23405
+ return await this.client.post(`${BASE}/subscription/cancel`, payload);
23406
+ }
23407
+ // ---------------------------------------------------------------
23408
+ // Invoices
23409
+ // ---------------------------------------------------------------
23410
+ /**
23411
+ * List all invoices for the current project.
23412
+ */
23413
+ async getInvoices() {
23414
+ return await this.client.get(`${BASE}/billing/invoices`);
23415
+ }
23416
+ /**
23417
+ * Get a single invoice by uuid.
23418
+ */
23419
+ async getInvoice(uuid) {
23420
+ return await this.client.get(`${BASE}/billing/invoice/${uuid}`);
23421
+ }
23422
+ /**
23423
+ * Download an invoice as a PDF. Resolves with the raw PDF bytes
23424
+ * (`responseType: "arraybuffer"`).
23425
+ *
23426
+ * @example
23427
+ * const { data } = await platform.transactions().getInvoicePdf(uuid)
23428
+ * fs.writeFileSync("invoice.pdf", Buffer.from(data))
23429
+ */
23430
+ async getInvoicePdf(uuid) {
23431
+ return await this.client.get(`${BASE}/billing/invoice/${uuid}/pdf`, {
23432
+ responseType: "arraybuffer",
23433
+ });
23434
+ }
23435
+ // ---------------------------------------------------------------
23436
+ // Balance / credits / top-up
23437
+ // ---------------------------------------------------------------
23438
+ /**
23439
+ * Get the current project's credit balance.
23440
+ */
23441
+ async getBalance() {
23442
+ return await this.client.get(`${BASE}/billing/balance`);
23443
+ }
23444
+ /**
23445
+ * Generate a checkout link to manually top up the project's credit balance.
23446
+ */
23447
+ async topUp(payload) {
23448
+ return await this.client.post(`${BASE}/billing/topup`, payload);
23449
+ }
23450
+ /**
23451
+ * Get the project's credit activity (deductions/top-ups) history, paginated.
23452
+ */
23453
+ async getCreditsHistory(query) {
23454
+ return await this.client.get(`${BASE}/billing/credits/history`, {
23455
+ params: query,
23456
+ });
23457
+ }
23458
+ // ---------------------------------------------------------------
23459
+ // Prices
23460
+ // ---------------------------------------------------------------
23461
+ /**
23462
+ * Get the usage-based pricing table for a given currency.
23463
+ *
23464
+ * @param currency - ISO 4217 currency code, e.g. "USD" or "RSD".
23465
+ */
23466
+ async getPrices(currency) {
23467
+ return await this.client.get(`${BASE}/prices/${currency}`);
23468
+ }
23469
+ // ---------------------------------------------------------------
23470
+ // Billing modes (per-project usage billing overrides)
23471
+ // ---------------------------------------------------------------
23472
+ /**
23473
+ * Get the project's usage-billing-mode overrides plus platform defaults.
23474
+ */
23475
+ async getBillingModes() {
23476
+ return await this.client.get(`${BASE}/billing/billing-modes`);
23477
+ }
23478
+ /**
23479
+ * Set the billing mode ("credits" | "hybrid" | "invoice") for a usage
23480
+ * option code on the current project.
23481
+ */
23482
+ async updateBillingModes(payload) {
23483
+ return await this.client.put(`${BASE}/billing/billing-modes`, payload);
23484
+ }
23485
+ }
23486
+
23487
+ // apis
23488
+ class Platform extends PlatformBaseClient {
23489
+ getPlatformClient() {
23490
+ return this.client;
23491
+ }
23492
+ getPlatformBaseURL() {
23493
+ var _a;
23494
+ return (_a = this.client.defaults.baseURL) !== null && _a !== void 0 ? _a : "";
23495
+ }
23496
+ apiUser() {
23497
+ return (new APIUser()).setClient(this.client);
23498
+ }
23499
+ function() {
23500
+ return (new Functions()).setClient(this.client);
23501
+ }
23502
+ user() {
23503
+ return (new Users()).setClient(this.client);
23504
+ }
23505
+ app(appType) {
23506
+ return (new Apps(appType)).setClient(this.client);
23507
+ }
23508
+ forge() {
23509
+ return (new Forge()).setClient(this.client);
23510
+ }
23511
+ kortex() {
23512
+ return (new Kortex()).setClient(this.client);
23513
+ }
23514
+ component(ref) {
23515
+ return (new Component(ref)).setClient(this.client);
23516
+ }
23517
+ componentUtils() {
23518
+ return (new ComponentUtils()).setClient(this.client);
23519
+ }
23520
+ ratchet() {
23521
+ return (new Ratchet()).setClient(this.client);
23522
+ }
23523
+ sandbox() {
23524
+ return (new Sandbox()).setClient(this.client);
23525
+ }
23526
+ system() {
23527
+ return (new System()).setClient(this.client);
23528
+ }
23529
+ workflow() {
23530
+ return (new Workflow()).setClient(this.client);
23531
+ }
23532
+ thunder() {
23533
+ return (new Thunder()).setClient(this.client);
23534
+ }
23535
+ project() {
23536
+ return (new Project()).setClient(this.client);
23537
+ }
23538
+ config() {
23539
+ return (new Config()).setClient(this.client);
23540
+ }
23541
+ /**
23542
+ * Convenience factory for the Integrations gateway façade.
23543
+ *
23544
+ * Integrations live behind a different gateway (`INTEGRATION_API` /
23545
+ * `host/luma/integrations`) than the rest of the platform API, so this
23546
+ * returns an independently-configured `Integrations` client (it does not
23547
+ * reuse `this.client`, whose base URL points at the platform host). The
23548
+ * Platform's resolved token/env/host are propagated so the child client
23549
+ * carries the same credentials.
23550
+ */
23551
+ integrations() {
23552
+ return new Integrations(this.getIntegrationsGatewayOptions());
23553
+ }
23554
+ /**
23555
+ * Convenience factory for the Satellites (custom JSON-RPC integrations) client.
23556
+ *
23557
+ * Same gateway note as `integrations()` — Satellites talks to the
23558
+ * integrations gateway, not the platform host, so a fresh, independently
23559
+ * configured client is returned, with the Platform's credentials propagated.
23560
+ */
23561
+ satellites() {
23562
+ return new Satellites(this.getIntegrationsGatewayOptions());
23563
+ }
23564
+ /**
23565
+ * Builds the options for a child integrations-gateway client (`Integrations`/
23566
+ * `Satellites`), propagating this Platform's resolved token/env, and deriving
23567
+ * the gateway host from this Platform's host when one was explicitly set.
23568
+ * When `this.host` is unset, `host` is left `undefined` so the child client's
23569
+ * own env-var/default resolution applies.
23570
+ */
23571
+ getIntegrationsGatewayOptions() {
23572
+ var _a, _b;
23573
+ return {
23574
+ token: (_a = this.token) !== null && _a !== void 0 ? _a : undefined,
23575
+ env: (_b = this.env) !== null && _b !== void 0 ? _b : undefined,
23576
+ host: this.host ? `${this.host.replace(/\/+$/, "")}/luma/integrations` : undefined,
23577
+ };
23578
+ }
23579
+ /**
23580
+ * Transactions (billing) client — subscriptions, invoices, credits/balance,
23581
+ * usage pricing and billing-mode overrides. Reached through the platform
23582
+ * gateway (`transactions/…`), so it reuses `this.client` like the other
23583
+ * native/proxied-service factories.
23584
+ *
23585
+ * This is the **billing** service — not distributed/database transactions.
23586
+ */
23587
+ transactions() {
23588
+ return (new Transactions()).setClient(this.client);
23589
+ }
23590
+ /**
23591
+ * Alias for `transactions()` — reads more naturally at call sites that
23592
+ * only care about billing (`platform.billing().getBalance()`).
23593
+ */
23594
+ billing() {
23595
+ return this.transactions();
23596
+ }
23597
+ }
23598
+
22903
23599
  // PRN — Protokol Resource Name
22904
23600
  //
22905
23601
  // Format:
@@ -23078,6 +23774,7 @@ exports.SerbiaMinFin = MinFin;
23078
23774
  exports.System = System;
23079
23775
  exports.Thunder = Thunder;
23080
23776
  exports.Timber = Timber;
23777
+ exports.Transactions = Transactions;
23081
23778
  exports.Users = Users;
23082
23779
  exports.VPFR = VPFR;
23083
23780
  exports.Workflow = Workflow;