@ptkl/sdk 1.12.0 → 1.14.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.
@@ -345,6 +345,11 @@ var ProtokolSDK010 = (function (exports, axios) {
345
345
  async delete(uuid) {
346
346
  return await this.client.delete(`/v4/system/component/${this.ref}/model/${uuid}`);
347
347
  }
348
+ async deleteMany(uuids) {
349
+ return await this.client.delete(`/v4/system/component/${this.ref}/models/bulk`, {
350
+ data: uuids,
351
+ });
352
+ }
348
353
  /**
349
354
  * Execute aggregate pipeline with optional streaming support
350
355
  *
@@ -1288,6 +1293,59 @@ var ProtokolSDK010 = (function (exports, axios) {
1288
1293
  }
1289
1294
  }
1290
1295
 
1296
+ /**
1297
+ * Resolve the current app's UUID from the ambient platform context.
1298
+ * The platform injects it per-installation: FORGE_APP_UUID in __ENV_VARIABLES__
1299
+ * for public views, and forge_app_uuid in sessionStorage for platform views.
1300
+ * Returns null outside the browser (e.g. Node/CLI), where the caller must pass
1301
+ * an explicit appUuid.
1302
+ */
1303
+ function resolveCurrentAppUuid() {
1304
+ var _a;
1305
+ if (!isBrowser)
1306
+ return null;
1307
+ // @ts-ignore
1308
+ const fromEnv = (_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_APP_UUID;
1309
+ if (fromEnv)
1310
+ return fromEnv;
1311
+ try {
1312
+ return sessionStorage.getItem("forge_app_uuid");
1313
+ }
1314
+ catch {
1315
+ return null;
1316
+ }
1317
+ }
1318
+ /**
1319
+ * Resolve a service target into { ref, serviceName }.
1320
+ *
1321
+ * Two forms, cleanly split:
1322
+ * - a bare service name (no "prn:" prefix) → the CURRENT app's service (the ref
1323
+ * is the current app's uuid, resolved from the platform context); or
1324
+ * - a service PRN `prn:forge:{ref}:service/{serviceName}` → ANOTHER app's service
1325
+ * (canonical PRN grammar: kind + name in the path, url-encoded).
1326
+ *
1327
+ * A PRN's `ref` may be an app **name** OR a uuid. Names aren't unique within a
1328
+ * project (a marketplace install and a custom app can share one), so the runtime
1329
+ * resolves a name deterministically **marketplace → custom**. Pass the uuid when
1330
+ * you need a *specific* app.
1331
+ */
1332
+ function parseServiceTarget(target) {
1333
+ if (!target.startsWith("prn:")) {
1334
+ // bare service name → the current app
1335
+ return { ref: resolveCurrentAppUuid(), serviceName: target };
1336
+ }
1337
+ // PRN → another app. Path form: prn:forge:{ref}:service/{serviceName}
1338
+ // (the PRN path segment is "service/{name}", with the name url-encoded).
1339
+ const [, type, ref, ...rest] = target.split(":");
1340
+ const path = rest.join(":"); // the PRN path, e.g. "service/{name}"
1341
+ const [kind, ...nameParts] = path.split("/");
1342
+ const serviceName = decodeURIComponent(nameParts.join("/"));
1343
+ if (type !== "forge" || kind !== "service" || !ref || !serviceName) {
1344
+ throw new Error(`runService: invalid service PRN "${target}" ` +
1345
+ `(expected prn:forge:{ref}:service/{serviceName}, where ref is an app name or uuid)`);
1346
+ }
1347
+ return { ref, serviceName };
1348
+ }
1291
1349
  class Forge extends PlatformBaseClient {
1292
1350
  // --- Management (appservice) ---
1293
1351
  async bundleUpload(buffer) {
@@ -1325,12 +1383,49 @@ var ProtokolSDK010 = (function (exports, axios) {
1325
1383
  return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, current);
1326
1384
  }
1327
1385
  // --- Service execution (forge-runtime) ---
1328
- async callService(appUuid, serviceName, options) {
1386
+ /**
1387
+ * Run a Forge service: `runService(target, body?, { query?, headers? })`.
1388
+ * Mirrors `axios.post(url, data, config)` — the 2nd arg is the request payload.
1389
+ *
1390
+ * `target` is either:
1391
+ * - a bare service name — runs that service on the CURRENT app; or
1392
+ * - a service PRN `prn:forge:{ref}:service/{name}` — runs it on ANOTHER app,
1393
+ * where `ref` is the app's **name** or uuid. A name is resolved by the
1394
+ * runtime deterministically (marketplace → custom); use the uuid to pin a
1395
+ * specific app. This is the addressing to use where there's no ambient
1396
+ * "current app" — e.g. a workflow, which has no per-install uuid to hardcode.
1397
+ *
1398
+ * `body` is sent as the POST body; `options.query` / `options.headers` are optional.
1399
+ *
1400
+ * The current app's uuid (bare-name form) is resolved automatically from the
1401
+ * platform context (FORGE_APP_UUID for public views, forge_app_uuid in
1402
+ * sessionStorage for platform views), so app code never needs its own uuid.
1403
+ *
1404
+ * Resolving the app does NOT grant access. Execution is still authorized against
1405
+ * the caller's permissions — for a `platform`-access service the caller must hold
1406
+ * `execute forge::service::{appUuid}::{name}`; `public`-access services require none.
1407
+ */
1408
+ async runService(target, body, options) {
1329
1409
  var _a;
1410
+ const { ref, serviceName } = parseServiceTarget(target);
1330
1411
  const queryString = (options === null || options === void 0 ? void 0 : options.query)
1331
1412
  ? '?' + new URLSearchParams(options.query).toString()
1332
1413
  : '';
1333
- return await this.client.post(`/luma/forge-runtime/api/services/${appUuid}/${serviceName}${queryString}`, (_a = options === null || options === void 0 ? void 0 : options.body) !== null && _a !== void 0 ? _a : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
1414
+ // @ts-ignore
1415
+ const devServiceUrl = isBrowser && ((_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_DEV_SERVICE_URL);
1416
+ if (devServiceUrl) {
1417
+ // The dev service server routes by name; the ref is ignored.
1418
+ return axios.post(`${devServiceUrl}/${serviceName}${queryString}`, body !== null && body !== void 0 ? body : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
1419
+ }
1420
+ if (!ref) {
1421
+ throw new Error("runService: could not resolve the current app from the platform context. " +
1422
+ "Use a service PRN with an explicit ref: prn:forge:{name|uuid}:service/{serviceName}.");
1423
+ }
1424
+ // Service execution is owned by the forge runtime (forge-runtime gateway ->
1425
+ // platform-forge), which resolves the ref (name → uuid, marketplace → custom)
1426
+ // and executes the service, enforcing `execute forge::service::{uuid}::{name}`
1427
+ // for platform-access services before running.
1428
+ 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);
1334
1429
  }
1335
1430
  }
1336
1431
 
@@ -2541,6 +2636,72 @@ var ProtokolSDK010 = (function (exports, axios) {
2541
2636
  }
2542
2637
  });
2543
2638
  }
2639
+ // ===================================================================
2640
+ // Text Extraction
2641
+ // ===================================================================
2642
+ /**
2643
+ * Extract text from any document format
2644
+ *
2645
+ * Supports PDF, DOCX, XLSX, PPTX, ODT, RTF, EPUB, CSV, images, and 40+ other formats.
2646
+ * Provide either a DMS file path or base64-encoded file data.
2647
+ *
2648
+ * @param payload - File path or base64 data to extract text from
2649
+ * @returns Extracted text content and character count
2650
+ *
2651
+ * @example
2652
+ * ```typescript
2653
+ * // From a DMS file path
2654
+ * const result = await dms.extractText({ input_path: 'uploads/contract.pdf' });
2655
+ * console.log(result.data.text);
2656
+ * console.log(result.data.char_count);
2657
+ *
2658
+ * // From base64 data
2659
+ * const result = await dms.extractText({
2660
+ * file_data: 'data:application/pdf;base64,...',
2661
+ * file_name: 'invoice.pdf'
2662
+ * });
2663
+ * ```
2664
+ */
2665
+ async extractText(payload) {
2666
+ return this.request('POST', 'media/extract-text', { data: payload });
2667
+ }
2668
+ // ===================================================================
2669
+ // OCR Extraction
2670
+ // ===================================================================
2671
+ /**
2672
+ * Run OCR extraction on an image using a saved model
2673
+ *
2674
+ * Crops each labeled region from the image and runs OCR to extract text.
2675
+ * Returns structured key-value results.
2676
+ *
2677
+ * @param payload - Model UUID, image (base64 or DMS key), and optional document boundary
2678
+ * @returns Extraction results as label-text pairs
2679
+ *
2680
+ * @example
2681
+ * ```typescript
2682
+ * // From a DMS file
2683
+ * const result = await dms.ocrExtract({
2684
+ * model_uuid: 'model-uuid',
2685
+ * image_key: 'uploads/scan.jpg',
2686
+ * document_boundary: { x: 0.05, y: 0.08, width: 0.9, height: 0.85 }
2687
+ * });
2688
+ *
2689
+ * console.log(result.data.results);
2690
+ * // { name: "John Smith", date_of_birth: "01.01.1990", id_number: "123456789" }
2691
+ *
2692
+ * // From base64
2693
+ * const result = await dms.ocrExtract({
2694
+ * model_uuid: 'model-uuid',
2695
+ * image: 'data:image/jpeg;base64,...'
2696
+ * });
2697
+ * ```
2698
+ */
2699
+ async ocrExtract(payload) {
2700
+ return this.request('POST', 'media/ocr/extract', {
2701
+ data: payload,
2702
+ timeout: 120000
2703
+ });
2704
+ }
2544
2705
  async request(method, endpoint, params) {
2545
2706
  return await this.client.request({
2546
2707
  method: method,
@@ -3720,6 +3881,59 @@ var ProtokolSDK010 = (function (exports, axios) {
3720
3881
  }
3721
3882
  }
3722
3883
 
3884
+ class Satellites extends IntegrationsBaseClient {
3885
+ async list() {
3886
+ const { data } = await this.client.get('/satellites/templates');
3887
+ return data;
3888
+ }
3889
+ async create(payload) {
3890
+ const { data } = await this.client.post('/satellites/templates', payload.template);
3891
+ if (payload.schema) {
3892
+ await this.createVersion(data.id, payload.schema);
3893
+ }
3894
+ return data;
3895
+ }
3896
+ async get(id) {
3897
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
3898
+ return data;
3899
+ }
3900
+ async delete(id) {
3901
+ const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
3902
+ return data;
3903
+ }
3904
+ async createVersion(id, payload) {
3905
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
3906
+ return data;
3907
+ }
3908
+ async versions(id) {
3909
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
3910
+ return data;
3911
+ }
3912
+ async deploy(id, payload) {
3913
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
3914
+ return data;
3915
+ }
3916
+ async rollback(id, payload) {
3917
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
3918
+ return data;
3919
+ }
3920
+ async permissions(id) {
3921
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
3922
+ return data;
3923
+ }
3924
+ async logs(id, params = {}) {
3925
+ const since = params.since instanceof Date ? params.since.toISOString() : params.since;
3926
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
3927
+ params: since ? { since } : undefined,
3928
+ });
3929
+ return data;
3930
+ }
3931
+ async execute(id, command, payload = {}) {
3932
+ const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
3933
+ return data;
3934
+ }
3935
+ }
3936
+
3723
3937
  // PRN — Protokol Resource Name
3724
3938
  //
3725
3939
  // Format:
@@ -3893,6 +4107,7 @@ var ProtokolSDK010 = (function (exports, axios) {
3893
4107
  exports.Project = Project;
3894
4108
  exports.Ratchet = Ratchet;
3895
4109
  exports.Sandbox = Sandbox;
4110
+ exports.Satellites = Satellites;
3896
4111
  exports.SerbiaMinFin = MinFin;
3897
4112
  exports.System = System;
3898
4113
  exports.Thunder = Thunder;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",
@@ -152,6 +152,7 @@ export default class Component<C extends string = string> extends PlatformBaseCl
152
152
  concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options?: UpdateOptions): Promise<AxiosResponse<any, any>>;
153
153
  create(model: C extends keyof ComponentModels ? Partial<ComponentModels[C]> & Record<string, any> : Record<string, any>): Promise<ComponentModel<C>>;
154
154
  delete(uuid: string): Promise<AxiosResponse<any, any>>;
155
+ deleteMany(uuids: string[]): Promise<AxiosResponse<any, any>>;
155
156
  /**
156
157
  * Execute aggregate pipeline with optional streaming support
157
158
  *
@@ -8,8 +8,29 @@ export default class Forge extends PlatformBaseClient {
8
8
  getVariables(ref: string): Promise<any>;
9
9
  updateVariables(ref: string, variables: Record<string, any>): Promise<any>;
10
10
  addVariable(ref: string, key: string, value: any): Promise<any>;
11
- callService(appUuid: string, serviceName: string, options?: {
12
- body?: any;
11
+ /**
12
+ * Run a Forge service: `runService(target, body?, { query?, headers? })`.
13
+ * Mirrors `axios.post(url, data, config)` — the 2nd arg is the request payload.
14
+ *
15
+ * `target` is either:
16
+ * - a bare service name — runs that service on the CURRENT app; or
17
+ * - a service PRN `prn:forge:{ref}:service/{name}` — runs it on ANOTHER app,
18
+ * where `ref` is the app's **name** or uuid. A name is resolved by the
19
+ * runtime deterministically (marketplace → custom); use the uuid to pin a
20
+ * specific app. This is the addressing to use where there's no ambient
21
+ * "current app" — e.g. a workflow, which has no per-install uuid to hardcode.
22
+ *
23
+ * `body` is sent as the POST body; `options.query` / `options.headers` are optional.
24
+ *
25
+ * The current app's uuid (bare-name form) is resolved automatically from the
26
+ * platform context (FORGE_APP_UUID for public views, forge_app_uuid in
27
+ * sessionStorage for platform views), so app code never needs its own uuid.
28
+ *
29
+ * Resolving the app does NOT grant access. Execution is still authorized against
30
+ * the caller's permissions — for a `platform`-access service the caller must hold
31
+ * `execute forge::service::{appUuid}::{name}`; `public`-access services require none.
32
+ */
33
+ runService(target: string, body?: any, options?: {
13
34
  query?: Record<string, string>;
14
35
  headers?: Record<string, string>;
15
36
  }): Promise<any>;
@@ -3,6 +3,7 @@ export type { Settings, SettingsField, FieldRoles, FieldConstraints, Context, Pr
3
3
  export type { WorkflowModel, WorkflowSettings, WorkflowNode, WorkflowNodeConnection, WorkflowCreatePayload, WorkflowUpdatePayload, WorkflowListResponse, } from '../types/workflow';
4
4
  export type { PagedResponse as KortexPagedResponse, PaginationParams as KortexPaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document as KortexDocument, Participant, TokenUsage, ToolCall, RAGSource, Message as KortexMessage, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, } from '../types/kortex';
5
5
  export type { TimberActor, TimberActorType, TimberChanges, TimberEntry, TimberLevel, TimberQueryParams, TimberQueryResponse, TimberSource, TimberUsage, TimberWritePayload, TimberLogPayload, } from '../types/timber';
6
+ export type { SatelliteAuthConfig, SatelliteAuthType, SatelliteCommandExecutePayload, SatelliteCommandExecuteResponse, SatelliteCreatePayload, SatelliteDeployPayload, SatelliteEnv, SatelliteJsonRpcCommand, SatelliteLocaleText, SatelliteLogsParams, SatellitePermission, SatellitePermissionExport, SatelliteSchemaPayload, SatelliteSchemaVersion, SatelliteTemplate, SatelliteTemplatePayload, SatelliteWorkflowNode, SatelliteWorkflowNodeField, } from '../types/satellites';
6
7
  export { default as Component } from './component';
7
8
  export { default as Platform } from './platform';
8
9
  export { default as Functions } from './functions';
@@ -21,11 +22,13 @@ export { default as Project } from './project';
21
22
  export { default as Config } from './config';
22
23
  export { default as Integrations } from './integrations';
23
24
  export { default as Integration } from './integrations';
25
+ export { default as Satellites } from './satellites';
24
26
  export { PRN, parsePRN } from '../util/prn';
25
27
  export type { ParsedPRN } from '../util/prn';
26
28
  export { default as Payments } from './integrations/payments';
27
29
  export { default as Invoicing } from './integrations/invoicing';
28
30
  export { default as DMS } from './integrations/dms';
31
+ export type { ExtractTextPayload, ExtractTextResult, OCRBoundaryRect, OCRExtractPayload, OCRExtractResult, } from '../types/integrations';
29
32
  export { default as SerbiaMinFin } from './integrations/serbia/minfin';
30
33
  export { default as NBS } from './integrations/serbia/nbs';
31
34
  export { default as VPFR } from './integrations/serbia/minfin/vpfr';
@@ -1,6 +1,6 @@
1
1
  import IntegrationsBaseClient from "../integrationsBaseClient";
2
2
  import { AxiosResponse } from "axios";
3
- import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoParams, DataInfo, DataValidationResult, ConversionOptions, HTML2PDFOptions, PDF2HTMLOptions, MediaUploadPayload, MediaUploadBase64Payload, DocumentListParams, DocumentListResponse, DocumentCreatePayload, DocumentUpdatePayload, DocumentRestorePayload, DocumentCommentPayload, DocumentResponse, DocumentGeneratePayload, DocumentGenerateResponse, DocumentRevisionListResponse } from "../../types/integrations";
3
+ import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoParams, DataInfo, DataValidationResult, ConversionOptions, HTML2PDFOptions, PDF2HTMLOptions, MediaUploadPayload, MediaUploadBase64Payload, DocumentListParams, DocumentListResponse, DocumentCreatePayload, DocumentUpdatePayload, DocumentRestorePayload, DocumentCommentPayload, DocumentResponse, DocumentGeneratePayload, DocumentGenerateResponse, DocumentRevisionListResponse, ExtractTextPayload, ExtractTextResult, OCRExtractPayload, OCRExtractResult } from "../../types/integrations";
4
4
  /**
5
5
  * Document Management System (DMS) API client
6
6
  *
@@ -457,6 +457,59 @@ export default class DMS extends IntegrationsBaseClient {
457
457
  * ```
458
458
  */
459
459
  excelToCsv(excelData: Blob | ArrayBuffer, options?: ConversionOptions): Promise<AxiosResponse<string>>;
460
+ /**
461
+ * Extract text from any document format
462
+ *
463
+ * Supports PDF, DOCX, XLSX, PPTX, ODT, RTF, EPUB, CSV, images, and 40+ other formats.
464
+ * Provide either a DMS file path or base64-encoded file data.
465
+ *
466
+ * @param payload - File path or base64 data to extract text from
467
+ * @returns Extracted text content and character count
468
+ *
469
+ * @example
470
+ * ```typescript
471
+ * // From a DMS file path
472
+ * const result = await dms.extractText({ input_path: 'uploads/contract.pdf' });
473
+ * console.log(result.data.text);
474
+ * console.log(result.data.char_count);
475
+ *
476
+ * // From base64 data
477
+ * const result = await dms.extractText({
478
+ * file_data: 'data:application/pdf;base64,...',
479
+ * file_name: 'invoice.pdf'
480
+ * });
481
+ * ```
482
+ */
483
+ extractText(payload: ExtractTextPayload): Promise<AxiosResponse<ExtractTextResult>>;
484
+ /**
485
+ * Run OCR extraction on an image using a saved model
486
+ *
487
+ * Crops each labeled region from the image and runs OCR to extract text.
488
+ * Returns structured key-value results.
489
+ *
490
+ * @param payload - Model UUID, image (base64 or DMS key), and optional document boundary
491
+ * @returns Extraction results as label-text pairs
492
+ *
493
+ * @example
494
+ * ```typescript
495
+ * // From a DMS file
496
+ * const result = await dms.ocrExtract({
497
+ * model_uuid: 'model-uuid',
498
+ * image_key: 'uploads/scan.jpg',
499
+ * document_boundary: { x: 0.05, y: 0.08, width: 0.9, height: 0.85 }
500
+ * });
501
+ *
502
+ * console.log(result.data.results);
503
+ * // { name: "John Smith", date_of_birth: "01.01.1990", id_number: "123456789" }
504
+ *
505
+ * // From base64
506
+ * const result = await dms.ocrExtract({
507
+ * model_uuid: 'model-uuid',
508
+ * image: 'data:image/jpeg;base64,...'
509
+ * });
510
+ * ```
511
+ */
512
+ ocrExtract(payload: OCRExtractPayload): Promise<AxiosResponse<OCRExtractResult>>;
460
513
  request(method: string, endpoint: string, params?: any): Promise<AxiosResponse<any, any>>;
461
514
  requestv2(method: string, endpoint: string, params?: any): Promise<AxiosResponse<any, any>>;
462
515
  requestv1(method: string, endpoint: string, params?: any): Promise<AxiosResponse<any, any>>;
@@ -0,0 +1,17 @@
1
+ import IntegrationsBaseClient from './integrationsBaseClient';
2
+ import type { SatelliteCommandExecutePayload, SatelliteCommandExecuteResponse, SatelliteCreatePayload, SatelliteDeployPayload, SatelliteLogsParams, SatellitePermissionExport, SatelliteSchemaPayload, SatelliteSchemaVersion, SatelliteTemplate } from '../types/satellites';
3
+ export default class Satellites extends IntegrationsBaseClient {
4
+ list(): Promise<SatelliteTemplate[]>;
5
+ create(payload: SatelliteCreatePayload): Promise<SatelliteTemplate>;
6
+ get(id: string): Promise<SatelliteTemplate>;
7
+ delete(id: string): Promise<{
8
+ deleted: boolean;
9
+ }>;
10
+ createVersion(id: string, payload: SatelliteSchemaPayload): Promise<SatelliteSchemaVersion>;
11
+ versions(id: string): Promise<SatelliteSchemaVersion[]>;
12
+ deploy(id: string, payload: SatelliteDeployPayload): Promise<SatelliteTemplate>;
13
+ rollback(id: string, payload: SatelliteDeployPayload): Promise<SatelliteTemplate>;
14
+ permissions(id: string): Promise<SatellitePermissionExport[]>;
15
+ logs(id: string, params?: SatelliteLogsParams): Promise<any>;
16
+ execute<T = any>(id: string, command: string, payload?: SatelliteCommandExecutePayload): Promise<SatelliteCommandExecuteResponse<T>>;
17
+ }
@@ -19311,6 +19311,11 @@ class Component extends PlatformBaseClient {
19311
19311
  async delete(uuid) {
19312
19312
  return await this.client.delete(`/v4/system/component/${this.ref}/model/${uuid}`);
19313
19313
  }
19314
+ async deleteMany(uuids) {
19315
+ return await this.client.delete(`/v4/system/component/${this.ref}/models/bulk`, {
19316
+ data: uuids,
19317
+ });
19318
+ }
19314
19319
  /**
19315
19320
  * Execute aggregate pipeline with optional streaming support
19316
19321
  *
@@ -20254,6 +20259,59 @@ class Workflow extends PlatformBaseClient {
20254
20259
  }
20255
20260
  }
20256
20261
 
20262
+ /**
20263
+ * Resolve the current app's UUID from the ambient platform context.
20264
+ * The platform injects it per-installation: FORGE_APP_UUID in __ENV_VARIABLES__
20265
+ * for public views, and forge_app_uuid in sessionStorage for platform views.
20266
+ * Returns null outside the browser (e.g. Node/CLI), where the caller must pass
20267
+ * an explicit appUuid.
20268
+ */
20269
+ function resolveCurrentAppUuid() {
20270
+ var _a;
20271
+ if (!isBrowser)
20272
+ return null;
20273
+ // @ts-ignore
20274
+ const fromEnv = (_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_APP_UUID;
20275
+ if (fromEnv)
20276
+ return fromEnv;
20277
+ try {
20278
+ return sessionStorage.getItem("forge_app_uuid");
20279
+ }
20280
+ catch {
20281
+ return null;
20282
+ }
20283
+ }
20284
+ /**
20285
+ * Resolve a service target into { ref, serviceName }.
20286
+ *
20287
+ * Two forms, cleanly split:
20288
+ * - a bare service name (no "prn:" prefix) → the CURRENT app's service (the ref
20289
+ * is the current app's uuid, resolved from the platform context); or
20290
+ * - a service PRN `prn:forge:{ref}:service/{serviceName}` → ANOTHER app's service
20291
+ * (canonical PRN grammar: kind + name in the path, url-encoded).
20292
+ *
20293
+ * A PRN's `ref` may be an app **name** OR a uuid. Names aren't unique within a
20294
+ * project (a marketplace install and a custom app can share one), so the runtime
20295
+ * resolves a name deterministically **marketplace → custom**. Pass the uuid when
20296
+ * you need a *specific* app.
20297
+ */
20298
+ function parseServiceTarget(target) {
20299
+ if (!target.startsWith("prn:")) {
20300
+ // bare service name → the current app
20301
+ return { ref: resolveCurrentAppUuid(), serviceName: target };
20302
+ }
20303
+ // PRN → another app. Path form: prn:forge:{ref}:service/{serviceName}
20304
+ // (the PRN path segment is "service/{name}", with the name url-encoded).
20305
+ const [, type, ref, ...rest] = target.split(":");
20306
+ const path = rest.join(":"); // the PRN path, e.g. "service/{name}"
20307
+ const [kind, ...nameParts] = path.split("/");
20308
+ const serviceName = decodeURIComponent(nameParts.join("/"));
20309
+ if (type !== "forge" || kind !== "service" || !ref || !serviceName) {
20310
+ throw new Error(`runService: invalid service PRN "${target}" ` +
20311
+ `(expected prn:forge:{ref}:service/{serviceName}, where ref is an app name or uuid)`);
20312
+ }
20313
+ return { ref, serviceName };
20314
+ }
20257
20315
  class Forge extends PlatformBaseClient {
20258
20316
  // --- Management (appservice) ---
20259
20317
  async bundleUpload(buffer) {
@@ -20291,12 +20349,49 @@ class Forge extends PlatformBaseClient {
20291
20349
  return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, current);
20292
20350
  }
20293
20351
  // --- Service execution (forge-runtime) ---
20294
- async callService(appUuid, serviceName, options) {
20352
+ /**
20353
+ * Run a Forge service: `runService(target, body?, { query?, headers? })`.
20354
+ * Mirrors `axios.post(url, data, config)` — the 2nd arg is the request payload.
20355
+ *
20356
+ * `target` is either:
20357
+ * - a bare service name — runs that service on the CURRENT app; or
20358
+ * - a service PRN `prn:forge:{ref}:service/{name}` — runs it on ANOTHER app,
20359
+ * where `ref` is the app's **name** or uuid. A name is resolved by the
20360
+ * runtime deterministically (marketplace → custom); use the uuid to pin a
20361
+ * specific app. This is the addressing to use where there's no ambient
20362
+ * "current app" — e.g. a workflow, which has no per-install uuid to hardcode.
20363
+ *
20364
+ * `body` is sent as the POST body; `options.query` / `options.headers` are optional.
20365
+ *
20366
+ * The current app's uuid (bare-name form) is resolved automatically from the
20367
+ * platform context (FORGE_APP_UUID for public views, forge_app_uuid in
20368
+ * sessionStorage for platform views), so app code never needs its own uuid.
20369
+ *
20370
+ * Resolving the app does NOT grant access. Execution is still authorized against
20371
+ * the caller's permissions — for a `platform`-access service the caller must hold
20372
+ * `execute forge::service::{appUuid}::{name}`; `public`-access services require none.
20373
+ */
20374
+ async runService(target, body, options) {
20295
20375
  var _a;
20376
+ const { ref, serviceName } = parseServiceTarget(target);
20296
20377
  const queryString = (options === null || options === void 0 ? void 0 : options.query)
20297
20378
  ? '?' + new URLSearchParams(options.query).toString()
20298
20379
  : '';
20299
- return await this.client.post(`/luma/forge-runtime/api/services/${appUuid}/${serviceName}${queryString}`, (_a = options === null || options === void 0 ? void 0 : options.body) !== null && _a !== void 0 ? _a : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
20380
+ // @ts-ignore
20381
+ const devServiceUrl = isBrowser && ((_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_DEV_SERVICE_URL);
20382
+ if (devServiceUrl) {
20383
+ // The dev service server routes by name; the ref is ignored.
20384
+ return axios.post(`${devServiceUrl}/${serviceName}${queryString}`, body !== null && body !== void 0 ? body : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
20385
+ }
20386
+ if (!ref) {
20387
+ throw new Error("runService: could not resolve the current app from the platform context. " +
20388
+ "Use a service PRN with an explicit ref: prn:forge:{name|uuid}:service/{serviceName}.");
20389
+ }
20390
+ // Service execution is owned by the forge runtime (forge-runtime gateway ->
20391
+ // platform-forge), which resolves the ref (name → uuid, marketplace → custom)
20392
+ // and executes the service, enforcing `execute forge::service::{uuid}::{name}`
20393
+ // for platform-access services before running.
20394
+ 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);
20300
20395
  }
20301
20396
  }
20302
20397
 
@@ -21507,6 +21602,72 @@ class DMS extends IntegrationsBaseClient {
21507
21602
  }
21508
21603
  });
21509
21604
  }
21605
+ // ===================================================================
21606
+ // Text Extraction
21607
+ // ===================================================================
21608
+ /**
21609
+ * Extract text from any document format
21610
+ *
21611
+ * Supports PDF, DOCX, XLSX, PPTX, ODT, RTF, EPUB, CSV, images, and 40+ other formats.
21612
+ * Provide either a DMS file path or base64-encoded file data.
21613
+ *
21614
+ * @param payload - File path or base64 data to extract text from
21615
+ * @returns Extracted text content and character count
21616
+ *
21617
+ * @example
21618
+ * ```typescript
21619
+ * // From a DMS file path
21620
+ * const result = await dms.extractText({ input_path: 'uploads/contract.pdf' });
21621
+ * console.log(result.data.text);
21622
+ * console.log(result.data.char_count);
21623
+ *
21624
+ * // From base64 data
21625
+ * const result = await dms.extractText({
21626
+ * file_data: 'data:application/pdf;base64,...',
21627
+ * file_name: 'invoice.pdf'
21628
+ * });
21629
+ * ```
21630
+ */
21631
+ async extractText(payload) {
21632
+ return this.request('POST', 'media/extract-text', { data: payload });
21633
+ }
21634
+ // ===================================================================
21635
+ // OCR Extraction
21636
+ // ===================================================================
21637
+ /**
21638
+ * Run OCR extraction on an image using a saved model
21639
+ *
21640
+ * Crops each labeled region from the image and runs OCR to extract text.
21641
+ * Returns structured key-value results.
21642
+ *
21643
+ * @param payload - Model UUID, image (base64 or DMS key), and optional document boundary
21644
+ * @returns Extraction results as label-text pairs
21645
+ *
21646
+ * @example
21647
+ * ```typescript
21648
+ * // From a DMS file
21649
+ * const result = await dms.ocrExtract({
21650
+ * model_uuid: 'model-uuid',
21651
+ * image_key: 'uploads/scan.jpg',
21652
+ * document_boundary: { x: 0.05, y: 0.08, width: 0.9, height: 0.85 }
21653
+ * });
21654
+ *
21655
+ * console.log(result.data.results);
21656
+ * // { name: "John Smith", date_of_birth: "01.01.1990", id_number: "123456789" }
21657
+ *
21658
+ * // From base64
21659
+ * const result = await dms.ocrExtract({
21660
+ * model_uuid: 'model-uuid',
21661
+ * image: 'data:image/jpeg;base64,...'
21662
+ * });
21663
+ * ```
21664
+ */
21665
+ async ocrExtract(payload) {
21666
+ return this.request('POST', 'media/ocr/extract', {
21667
+ data: payload,
21668
+ timeout: 120000
21669
+ });
21670
+ }
21510
21671
  async request(method, endpoint, params) {
21511
21672
  return await this.client.request({
21512
21673
  method: method,
@@ -22686,6 +22847,59 @@ class Integrations extends IntegrationsBaseClient {
22686
22847
  }
22687
22848
  }
22688
22849
 
22850
+ class Satellites extends IntegrationsBaseClient {
22851
+ async list() {
22852
+ const { data } = await this.client.get('/satellites/templates');
22853
+ return data;
22854
+ }
22855
+ async create(payload) {
22856
+ const { data } = await this.client.post('/satellites/templates', payload.template);
22857
+ if (payload.schema) {
22858
+ await this.createVersion(data.id, payload.schema);
22859
+ }
22860
+ return data;
22861
+ }
22862
+ async get(id) {
22863
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
22864
+ return data;
22865
+ }
22866
+ async delete(id) {
22867
+ const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
22868
+ return data;
22869
+ }
22870
+ async createVersion(id, payload) {
22871
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
22872
+ return data;
22873
+ }
22874
+ async versions(id) {
22875
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
22876
+ return data;
22877
+ }
22878
+ async deploy(id, payload) {
22879
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
22880
+ return data;
22881
+ }
22882
+ async rollback(id, payload) {
22883
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
22884
+ return data;
22885
+ }
22886
+ async permissions(id) {
22887
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
22888
+ return data;
22889
+ }
22890
+ async logs(id, params = {}) {
22891
+ const since = params.since instanceof Date ? params.since.toISOString() : params.since;
22892
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
22893
+ params: since ? { since } : undefined,
22894
+ });
22895
+ return data;
22896
+ }
22897
+ async execute(id, command, payload = {}) {
22898
+ const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
22899
+ return data;
22900
+ }
22901
+ }
22902
+
22689
22903
  // PRN — Protokol Resource Name
22690
22904
  //
22691
22905
  // Format:
@@ -22859,6 +23073,7 @@ exports.Platform = Platform;
22859
23073
  exports.Project = Project;
22860
23074
  exports.Ratchet = Ratchet;
22861
23075
  exports.Sandbox = Sandbox;
23076
+ exports.Satellites = Satellites;
22862
23077
  exports.SerbiaMinFin = MinFin;
22863
23078
  exports.System = System;
22864
23079
  exports.Thunder = Thunder;
@@ -344,6 +344,11 @@ class Component extends PlatformBaseClient {
344
344
  async delete(uuid) {
345
345
  return await this.client.delete(`/v4/system/component/${this.ref}/model/${uuid}`);
346
346
  }
347
+ async deleteMany(uuids) {
348
+ return await this.client.delete(`/v4/system/component/${this.ref}/models/bulk`, {
349
+ data: uuids,
350
+ });
351
+ }
347
352
  /**
348
353
  * Execute aggregate pipeline with optional streaming support
349
354
  *
@@ -1287,6 +1292,59 @@ class Workflow extends PlatformBaseClient {
1287
1292
  }
1288
1293
  }
1289
1294
 
1295
+ /**
1296
+ * Resolve the current app's UUID from the ambient platform context.
1297
+ * The platform injects it per-installation: FORGE_APP_UUID in __ENV_VARIABLES__
1298
+ * for public views, and forge_app_uuid in sessionStorage for platform views.
1299
+ * Returns null outside the browser (e.g. Node/CLI), where the caller must pass
1300
+ * an explicit appUuid.
1301
+ */
1302
+ function resolveCurrentAppUuid() {
1303
+ var _a;
1304
+ if (!isBrowser)
1305
+ return null;
1306
+ // @ts-ignore
1307
+ const fromEnv = (_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_APP_UUID;
1308
+ if (fromEnv)
1309
+ return fromEnv;
1310
+ try {
1311
+ return sessionStorage.getItem("forge_app_uuid");
1312
+ }
1313
+ catch {
1314
+ return null;
1315
+ }
1316
+ }
1317
+ /**
1318
+ * Resolve a service target into { ref, serviceName }.
1319
+ *
1320
+ * Two forms, cleanly split:
1321
+ * - a bare service name (no "prn:" prefix) → the CURRENT app's service (the ref
1322
+ * is the current app's uuid, resolved from the platform context); or
1323
+ * - a service PRN `prn:forge:{ref}:service/{serviceName}` → ANOTHER app's service
1324
+ * (canonical PRN grammar: kind + name in the path, url-encoded).
1325
+ *
1326
+ * A PRN's `ref` may be an app **name** OR a uuid. Names aren't unique within a
1327
+ * project (a marketplace install and a custom app can share one), so the runtime
1328
+ * resolves a name deterministically **marketplace → custom**. Pass the uuid when
1329
+ * you need a *specific* app.
1330
+ */
1331
+ function parseServiceTarget(target) {
1332
+ if (!target.startsWith("prn:")) {
1333
+ // bare service name → the current app
1334
+ return { ref: resolveCurrentAppUuid(), serviceName: target };
1335
+ }
1336
+ // PRN → another app. Path form: prn:forge:{ref}:service/{serviceName}
1337
+ // (the PRN path segment is "service/{name}", with the name url-encoded).
1338
+ const [, type, ref, ...rest] = target.split(":");
1339
+ const path = rest.join(":"); // the PRN path, e.g. "service/{name}"
1340
+ const [kind, ...nameParts] = path.split("/");
1341
+ const serviceName = decodeURIComponent(nameParts.join("/"));
1342
+ if (type !== "forge" || kind !== "service" || !ref || !serviceName) {
1343
+ throw new Error(`runService: invalid service PRN "${target}" ` +
1344
+ `(expected prn:forge:{ref}:service/{serviceName}, where ref is an app name or uuid)`);
1345
+ }
1346
+ return { ref, serviceName };
1347
+ }
1290
1348
  class Forge extends PlatformBaseClient {
1291
1349
  // --- Management (appservice) ---
1292
1350
  async bundleUpload(buffer) {
@@ -1324,12 +1382,49 @@ class Forge extends PlatformBaseClient {
1324
1382
  return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, current);
1325
1383
  }
1326
1384
  // --- Service execution (forge-runtime) ---
1327
- async callService(appUuid, serviceName, options) {
1385
+ /**
1386
+ * Run a Forge service: `runService(target, body?, { query?, headers? })`.
1387
+ * Mirrors `axios.post(url, data, config)` — the 2nd arg is the request payload.
1388
+ *
1389
+ * `target` is either:
1390
+ * - a bare service name — runs that service on the CURRENT app; or
1391
+ * - a service PRN `prn:forge:{ref}:service/{name}` — runs it on ANOTHER app,
1392
+ * where `ref` is the app's **name** or uuid. A name is resolved by the
1393
+ * runtime deterministically (marketplace → custom); use the uuid to pin a
1394
+ * specific app. This is the addressing to use where there's no ambient
1395
+ * "current app" — e.g. a workflow, which has no per-install uuid to hardcode.
1396
+ *
1397
+ * `body` is sent as the POST body; `options.query` / `options.headers` are optional.
1398
+ *
1399
+ * The current app's uuid (bare-name form) is resolved automatically from the
1400
+ * platform context (FORGE_APP_UUID for public views, forge_app_uuid in
1401
+ * sessionStorage for platform views), so app code never needs its own uuid.
1402
+ *
1403
+ * Resolving the app does NOT grant access. Execution is still authorized against
1404
+ * the caller's permissions — for a `platform`-access service the caller must hold
1405
+ * `execute forge::service::{appUuid}::{name}`; `public`-access services require none.
1406
+ */
1407
+ async runService(target, body, options) {
1328
1408
  var _a;
1409
+ const { ref, serviceName } = parseServiceTarget(target);
1329
1410
  const queryString = (options === null || options === void 0 ? void 0 : options.query)
1330
1411
  ? '?' + new URLSearchParams(options.query).toString()
1331
1412
  : '';
1332
- return await this.client.post(`/luma/forge-runtime/api/services/${appUuid}/${serviceName}${queryString}`, (_a = options === null || options === void 0 ? void 0 : options.body) !== null && _a !== void 0 ? _a : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
1413
+ // @ts-ignore
1414
+ const devServiceUrl = isBrowser && ((_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_DEV_SERVICE_URL);
1415
+ if (devServiceUrl) {
1416
+ // The dev service server routes by name; the ref is ignored.
1417
+ return axios.post(`${devServiceUrl}/${serviceName}${queryString}`, body !== null && body !== void 0 ? body : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
1418
+ }
1419
+ if (!ref) {
1420
+ throw new Error("runService: could not resolve the current app from the platform context. " +
1421
+ "Use a service PRN with an explicit ref: prn:forge:{name|uuid}:service/{serviceName}.");
1422
+ }
1423
+ // Service execution is owned by the forge runtime (forge-runtime gateway ->
1424
+ // platform-forge), which resolves the ref (name → uuid, marketplace → custom)
1425
+ // and executes the service, enforcing `execute forge::service::{uuid}::{name}`
1426
+ // for platform-access services before running.
1427
+ 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);
1333
1428
  }
1334
1429
  }
1335
1430
 
@@ -2540,6 +2635,72 @@ class DMS extends IntegrationsBaseClient {
2540
2635
  }
2541
2636
  });
2542
2637
  }
2638
+ // ===================================================================
2639
+ // Text Extraction
2640
+ // ===================================================================
2641
+ /**
2642
+ * Extract text from any document format
2643
+ *
2644
+ * Supports PDF, DOCX, XLSX, PPTX, ODT, RTF, EPUB, CSV, images, and 40+ other formats.
2645
+ * Provide either a DMS file path or base64-encoded file data.
2646
+ *
2647
+ * @param payload - File path or base64 data to extract text from
2648
+ * @returns Extracted text content and character count
2649
+ *
2650
+ * @example
2651
+ * ```typescript
2652
+ * // From a DMS file path
2653
+ * const result = await dms.extractText({ input_path: 'uploads/contract.pdf' });
2654
+ * console.log(result.data.text);
2655
+ * console.log(result.data.char_count);
2656
+ *
2657
+ * // From base64 data
2658
+ * const result = await dms.extractText({
2659
+ * file_data: 'data:application/pdf;base64,...',
2660
+ * file_name: 'invoice.pdf'
2661
+ * });
2662
+ * ```
2663
+ */
2664
+ async extractText(payload) {
2665
+ return this.request('POST', 'media/extract-text', { data: payload });
2666
+ }
2667
+ // ===================================================================
2668
+ // OCR Extraction
2669
+ // ===================================================================
2670
+ /**
2671
+ * Run OCR extraction on an image using a saved model
2672
+ *
2673
+ * Crops each labeled region from the image and runs OCR to extract text.
2674
+ * Returns structured key-value results.
2675
+ *
2676
+ * @param payload - Model UUID, image (base64 or DMS key), and optional document boundary
2677
+ * @returns Extraction results as label-text pairs
2678
+ *
2679
+ * @example
2680
+ * ```typescript
2681
+ * // From a DMS file
2682
+ * const result = await dms.ocrExtract({
2683
+ * model_uuid: 'model-uuid',
2684
+ * image_key: 'uploads/scan.jpg',
2685
+ * document_boundary: { x: 0.05, y: 0.08, width: 0.9, height: 0.85 }
2686
+ * });
2687
+ *
2688
+ * console.log(result.data.results);
2689
+ * // { name: "John Smith", date_of_birth: "01.01.1990", id_number: "123456789" }
2690
+ *
2691
+ * // From base64
2692
+ * const result = await dms.ocrExtract({
2693
+ * model_uuid: 'model-uuid',
2694
+ * image: 'data:image/jpeg;base64,...'
2695
+ * });
2696
+ * ```
2697
+ */
2698
+ async ocrExtract(payload) {
2699
+ return this.request('POST', 'media/ocr/extract', {
2700
+ data: payload,
2701
+ timeout: 120000
2702
+ });
2703
+ }
2543
2704
  async request(method, endpoint, params) {
2544
2705
  return await this.client.request({
2545
2706
  method: method,
@@ -3719,6 +3880,59 @@ class Integrations extends IntegrationsBaseClient {
3719
3880
  }
3720
3881
  }
3721
3882
 
3883
+ class Satellites extends IntegrationsBaseClient {
3884
+ async list() {
3885
+ const { data } = await this.client.get('/satellites/templates');
3886
+ return data;
3887
+ }
3888
+ async create(payload) {
3889
+ const { data } = await this.client.post('/satellites/templates', payload.template);
3890
+ if (payload.schema) {
3891
+ await this.createVersion(data.id, payload.schema);
3892
+ }
3893
+ return data;
3894
+ }
3895
+ async get(id) {
3896
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
3897
+ return data;
3898
+ }
3899
+ async delete(id) {
3900
+ const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
3901
+ return data;
3902
+ }
3903
+ async createVersion(id, payload) {
3904
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
3905
+ return data;
3906
+ }
3907
+ async versions(id) {
3908
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
3909
+ return data;
3910
+ }
3911
+ async deploy(id, payload) {
3912
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
3913
+ return data;
3914
+ }
3915
+ async rollback(id, payload) {
3916
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
3917
+ return data;
3918
+ }
3919
+ async permissions(id) {
3920
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
3921
+ return data;
3922
+ }
3923
+ async logs(id, params = {}) {
3924
+ const since = params.since instanceof Date ? params.since.toISOString() : params.since;
3925
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
3926
+ params: since ? { since } : undefined,
3927
+ });
3928
+ return data;
3929
+ }
3930
+ async execute(id, command, payload = {}) {
3931
+ const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
3932
+ return data;
3933
+ }
3934
+ }
3935
+
3722
3936
  // PRN — Protokol Resource Name
3723
3937
  //
3724
3938
  // Format:
@@ -3871,4 +4085,4 @@ class Invoicing extends PlatformBaseClient {
3871
4085
  }
3872
4086
  }
3873
4087
 
3874
- export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Ecommerce, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Kortex, Mail, NBS, PRN, Payments, Platform, Project, Ratchet, Sandbox, MinFin as SerbiaMinFin, System, Thunder, Timber, Users, VPFR, Workflow, parsePRN };
4088
+ export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Ecommerce, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Kortex, Mail, NBS, PRN, Payments, Platform, Project, Ratchet, Sandbox, Satellites, MinFin as SerbiaMinFin, System, Thunder, Timber, Users, VPFR, Workflow, parsePRN };
@@ -345,3 +345,100 @@ export type DocumentRevisionItem = {
345
345
  updatedBy: DocumentAuditEntry;
346
346
  };
347
347
  export type DocumentRevisionListResponse = DocumentRevisionItem[];
348
+ export type DMSPlan = {
349
+ plan: 'free' | 'paid';
350
+ allowed_storage: number;
351
+ used_storage: number;
352
+ };
353
+ export type ExtractTextPayload = {
354
+ input_path?: string;
355
+ input_data?: string;
356
+ file_name?: string;
357
+ output_path?: string;
358
+ output_text?: boolean;
359
+ output_file_name?: string;
360
+ replace?: boolean;
361
+ };
362
+ export type ExtractTextResult = {
363
+ text: string;
364
+ char_count: number;
365
+ };
366
+ export type OCRBoundaryRect = {
367
+ x: number;
368
+ y: number;
369
+ width: number;
370
+ height: number;
371
+ };
372
+ export type OCRModelRegion = {
373
+ label: string;
374
+ x: number;
375
+ y: number;
376
+ width: number;
377
+ height: number;
378
+ };
379
+ export type OCRModelConfig = {
380
+ psm?: number | null;
381
+ backend?: string;
382
+ };
383
+ export type OCRModelSample = {
384
+ uuid: string;
385
+ ocr_model_uuid: string;
386
+ image_key: string;
387
+ image_url?: string;
388
+ is_primary: boolean;
389
+ document_boundary?: OCRBoundaryRect | null;
390
+ created_at?: string;
391
+ updated_at?: string;
392
+ };
393
+ export type OCRModel = {
394
+ uuid: string;
395
+ project_uuid: string;
396
+ name: string;
397
+ description: string;
398
+ engine: 'default' | 'kortex';
399
+ language: string;
400
+ config?: OCRModelConfig | null;
401
+ regions: OCRModelRegion[];
402
+ samples?: OCRModelSample[];
403
+ created_by: string;
404
+ created_at?: string;
405
+ updated_at?: string;
406
+ };
407
+ export type OCRModelCreatePayload = {
408
+ name: string;
409
+ description?: string;
410
+ engine?: 'default' | 'kortex';
411
+ language?: string;
412
+ config?: OCRModelConfig;
413
+ regions?: OCRModelRegion[];
414
+ };
415
+ export type OCRModelUpdatePayload = {
416
+ name?: string;
417
+ description?: string;
418
+ engine?: string;
419
+ language?: string;
420
+ config?: OCRModelConfig;
421
+ regions?: OCRModelRegion[];
422
+ };
423
+ export type OCRSampleAddPayload = {
424
+ image_key: string;
425
+ image_url?: string;
426
+ is_primary?: boolean;
427
+ document_boundary?: OCRBoundaryRect;
428
+ };
429
+ export type OCRSampleUpdatePayload = {
430
+ is_primary?: boolean;
431
+ document_boundary?: OCRBoundaryRect;
432
+ };
433
+ export type OCRExtractPayload = {
434
+ model_uuid: string;
435
+ image_key?: string;
436
+ image?: string;
437
+ document_boundary?: OCRBoundaryRect;
438
+ };
439
+ export type OCRExtractResult = {
440
+ model_uuid: string;
441
+ model_name: string;
442
+ results: Record<string, string>;
443
+ errors?: string[];
444
+ };
@@ -0,0 +1,100 @@
1
+ export type SatelliteEnv = 'dev' | 'live';
2
+ export type SatelliteAuthType = 'bearer' | 'api_key';
3
+ export type SatelliteLocaleText = string | {
4
+ locales?: Record<string, string>;
5
+ [locale: string]: any;
6
+ };
7
+ export type SatelliteAuthConfig = {
8
+ header_name?: string;
9
+ secret?: string;
10
+ };
11
+ export type SatelliteTemplatePayload = {
12
+ id: string;
13
+ label?: SatelliteLocaleText;
14
+ description?: SatelliteLocaleText;
15
+ icon?: string;
16
+ jsonrpc_endpoint_url: string;
17
+ health_check_url?: string;
18
+ logs_url?: string;
19
+ auth_type?: SatelliteAuthType;
20
+ auth_config?: SatelliteAuthConfig;
21
+ timeout_ms?: number;
22
+ };
23
+ export type SatelliteTemplate = Omit<SatelliteTemplatePayload, 'auth_config'> & {
24
+ project_uuid?: string;
25
+ uuid?: string;
26
+ status?: string;
27
+ dev_version?: string;
28
+ live_version?: string;
29
+ last_health_status?: string;
30
+ last_health_checked_at?: string;
31
+ created_at?: string;
32
+ updated_at?: string;
33
+ auth_config?: Omit<SatelliteAuthConfig, 'secret'>;
34
+ };
35
+ export type SatellitePermission = {
36
+ action: string;
37
+ label?: SatelliteLocaleText;
38
+ description?: SatelliteLocaleText;
39
+ };
40
+ export type SatelliteJsonRpcCommand = {
41
+ name: string;
42
+ method: string;
43
+ permission_action?: string;
44
+ };
45
+ export type SatelliteWorkflowNodeField = {
46
+ name: string;
47
+ type: string;
48
+ required?: boolean;
49
+ label?: SatelliteLocaleText;
50
+ description?: SatelliteLocaleText;
51
+ default?: any;
52
+ };
53
+ export type SatelliteWorkflowNode = {
54
+ name: string;
55
+ label?: SatelliteLocaleText;
56
+ description?: SatelliteLocaleText;
57
+ icon?: string;
58
+ command: string;
59
+ inputs?: SatelliteWorkflowNodeField[];
60
+ outputs?: SatelliteWorkflowNodeField[];
61
+ };
62
+ export type SatelliteSchemaPayload = {
63
+ schema_version: string;
64
+ schema?: Record<string, any>;
65
+ permissions?: SatellitePermission[];
66
+ jsonrpc_commands?: SatelliteJsonRpcCommand[];
67
+ workflownodes?: SatelliteWorkflowNode[];
68
+ };
69
+ export type SatelliteCreatePayload = {
70
+ template: SatelliteTemplatePayload;
71
+ schema?: SatelliteSchemaPayload;
72
+ };
73
+ export type SatelliteSchemaVersion = SatelliteSchemaPayload & {
74
+ version?: number;
75
+ satellite_uuid?: string;
76
+ project_uuid?: string;
77
+ created_at?: string;
78
+ };
79
+ export type SatelliteDeployPayload = {
80
+ schema_version: string;
81
+ env: SatelliteEnv;
82
+ };
83
+ export type SatellitePermissionExport = {
84
+ action: string;
85
+ permission_key: string;
86
+ label?: SatelliteLocaleText;
87
+ description?: SatelliteLocaleText;
88
+ };
89
+ export type SatelliteCommandExecutePayload = {
90
+ inputs?: Record<string, any>;
91
+ context?: Record<string, any>;
92
+ session?: string;
93
+ caller_prn?: string;
94
+ };
95
+ export type SatelliteCommandExecuteResponse<T = any> = {
96
+ result: T;
97
+ };
98
+ export type SatelliteLogsParams = {
99
+ since?: string | Date;
100
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",