@ptkl/sdk 1.12.0 → 1.13.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
  *
@@ -1326,11 +1331,16 @@ var ProtokolSDK010 = (function (exports, axios) {
1326
1331
  }
1327
1332
  // --- Service execution (forge-runtime) ---
1328
1333
  async callService(appUuid, serviceName, options) {
1329
- var _a;
1334
+ var _a, _b, _c;
1330
1335
  const queryString = (options === null || options === void 0 ? void 0 : options.query)
1331
1336
  ? '?' + new URLSearchParams(options.query).toString()
1332
1337
  : '';
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);
1338
+ // @ts-ignore
1339
+ const devServiceUrl = isBrowser && ((_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_DEV_SERVICE_URL);
1340
+ if (devServiceUrl) {
1341
+ return axios.post(`${devServiceUrl}/${serviceName}${queryString}`, (_b = options === null || options === void 0 ? void 0 : options.body) !== null && _b !== void 0 ? _b : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
1342
+ }
1343
+ return await this.client.post(`/luma/forge-runtime/api/services/${appUuid}/${serviceName}${queryString}`, (_c = options === null || options === void 0 ? void 0 : options.body) !== null && _c !== void 0 ? _c : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
1334
1344
  }
1335
1345
  }
1336
1346
 
@@ -2541,6 +2551,72 @@ var ProtokolSDK010 = (function (exports, axios) {
2541
2551
  }
2542
2552
  });
2543
2553
  }
2554
+ // ===================================================================
2555
+ // Text Extraction
2556
+ // ===================================================================
2557
+ /**
2558
+ * Extract text from any document format
2559
+ *
2560
+ * Supports PDF, DOCX, XLSX, PPTX, ODT, RTF, EPUB, CSV, images, and 40+ other formats.
2561
+ * Provide either a DMS file path or base64-encoded file data.
2562
+ *
2563
+ * @param payload - File path or base64 data to extract text from
2564
+ * @returns Extracted text content and character count
2565
+ *
2566
+ * @example
2567
+ * ```typescript
2568
+ * // From a DMS file path
2569
+ * const result = await dms.extractText({ input_path: 'uploads/contract.pdf' });
2570
+ * console.log(result.data.text);
2571
+ * console.log(result.data.char_count);
2572
+ *
2573
+ * // From base64 data
2574
+ * const result = await dms.extractText({
2575
+ * file_data: 'data:application/pdf;base64,...',
2576
+ * file_name: 'invoice.pdf'
2577
+ * });
2578
+ * ```
2579
+ */
2580
+ async extractText(payload) {
2581
+ return this.request('POST', 'media/extract-text', { data: payload });
2582
+ }
2583
+ // ===================================================================
2584
+ // OCR Extraction
2585
+ // ===================================================================
2586
+ /**
2587
+ * Run OCR extraction on an image using a saved model
2588
+ *
2589
+ * Crops each labeled region from the image and runs OCR to extract text.
2590
+ * Returns structured key-value results.
2591
+ *
2592
+ * @param payload - Model UUID, image (base64 or DMS key), and optional document boundary
2593
+ * @returns Extraction results as label-text pairs
2594
+ *
2595
+ * @example
2596
+ * ```typescript
2597
+ * // From a DMS file
2598
+ * const result = await dms.ocrExtract({
2599
+ * model_uuid: 'model-uuid',
2600
+ * image_key: 'uploads/scan.jpg',
2601
+ * document_boundary: { x: 0.05, y: 0.08, width: 0.9, height: 0.85 }
2602
+ * });
2603
+ *
2604
+ * console.log(result.data.results);
2605
+ * // { name: "John Smith", date_of_birth: "01.01.1990", id_number: "123456789" }
2606
+ *
2607
+ * // From base64
2608
+ * const result = await dms.ocrExtract({
2609
+ * model_uuid: 'model-uuid',
2610
+ * image: 'data:image/jpeg;base64,...'
2611
+ * });
2612
+ * ```
2613
+ */
2614
+ async ocrExtract(payload) {
2615
+ return this.request('POST', 'media/ocr/extract', {
2616
+ data: payload,
2617
+ timeout: 120000
2618
+ });
2619
+ }
2544
2620
  async request(method, endpoint, params) {
2545
2621
  return await this.client.request({
2546
2622
  method: method,
@@ -3720,6 +3796,59 @@ var ProtokolSDK010 = (function (exports, axios) {
3720
3796
  }
3721
3797
  }
3722
3798
 
3799
+ class Satellites extends IntegrationsBaseClient {
3800
+ async list() {
3801
+ const { data } = await this.client.get('/satellites/templates');
3802
+ return data;
3803
+ }
3804
+ async create(payload) {
3805
+ const { data } = await this.client.post('/satellites/templates', payload.template);
3806
+ if (payload.schema) {
3807
+ await this.createVersion(data.id, payload.schema);
3808
+ }
3809
+ return data;
3810
+ }
3811
+ async get(id) {
3812
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
3813
+ return data;
3814
+ }
3815
+ async delete(id) {
3816
+ const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
3817
+ return data;
3818
+ }
3819
+ async createVersion(id, payload) {
3820
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
3821
+ return data;
3822
+ }
3823
+ async versions(id) {
3824
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
3825
+ return data;
3826
+ }
3827
+ async deploy(id, payload) {
3828
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
3829
+ return data;
3830
+ }
3831
+ async rollback(id, payload) {
3832
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
3833
+ return data;
3834
+ }
3835
+ async permissions(id) {
3836
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
3837
+ return data;
3838
+ }
3839
+ async logs(id, params = {}) {
3840
+ const since = params.since instanceof Date ? params.since.toISOString() : params.since;
3841
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
3842
+ params: since ? { since } : undefined,
3843
+ });
3844
+ return data;
3845
+ }
3846
+ async execute(id, command, payload = {}) {
3847
+ const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
3848
+ return data;
3849
+ }
3850
+ }
3851
+
3723
3852
  // PRN — Protokol Resource Name
3724
3853
  //
3725
3854
  // Format:
@@ -3893,6 +4022,7 @@ var ProtokolSDK010 = (function (exports, axios) {
3893
4022
  exports.Project = Project;
3894
4023
  exports.Ratchet = Ratchet;
3895
4024
  exports.Sandbox = Sandbox;
4025
+ exports.Satellites = Satellites;
3896
4026
  exports.SerbiaMinFin = MinFin;
3897
4027
  exports.System = System;
3898
4028
  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.13.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
  *
@@ -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
  *
@@ -20292,11 +20297,16 @@ class Forge extends PlatformBaseClient {
20292
20297
  }
20293
20298
  // --- Service execution (forge-runtime) ---
20294
20299
  async callService(appUuid, serviceName, options) {
20295
- var _a;
20300
+ var _a, _b, _c;
20296
20301
  const queryString = (options === null || options === void 0 ? void 0 : options.query)
20297
20302
  ? '?' + new URLSearchParams(options.query).toString()
20298
20303
  : '';
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);
20304
+ // @ts-ignore
20305
+ const devServiceUrl = isBrowser && ((_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_DEV_SERVICE_URL);
20306
+ if (devServiceUrl) {
20307
+ return axios.post(`${devServiceUrl}/${serviceName}${queryString}`, (_b = options === null || options === void 0 ? void 0 : options.body) !== null && _b !== void 0 ? _b : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
20308
+ }
20309
+ return await this.client.post(`/luma/forge-runtime/api/services/${appUuid}/${serviceName}${queryString}`, (_c = options === null || options === void 0 ? void 0 : options.body) !== null && _c !== void 0 ? _c : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
20300
20310
  }
20301
20311
  }
20302
20312
 
@@ -21507,6 +21517,72 @@ class DMS extends IntegrationsBaseClient {
21507
21517
  }
21508
21518
  });
21509
21519
  }
21520
+ // ===================================================================
21521
+ // Text Extraction
21522
+ // ===================================================================
21523
+ /**
21524
+ * Extract text from any document format
21525
+ *
21526
+ * Supports PDF, DOCX, XLSX, PPTX, ODT, RTF, EPUB, CSV, images, and 40+ other formats.
21527
+ * Provide either a DMS file path or base64-encoded file data.
21528
+ *
21529
+ * @param payload - File path or base64 data to extract text from
21530
+ * @returns Extracted text content and character count
21531
+ *
21532
+ * @example
21533
+ * ```typescript
21534
+ * // From a DMS file path
21535
+ * const result = await dms.extractText({ input_path: 'uploads/contract.pdf' });
21536
+ * console.log(result.data.text);
21537
+ * console.log(result.data.char_count);
21538
+ *
21539
+ * // From base64 data
21540
+ * const result = await dms.extractText({
21541
+ * file_data: 'data:application/pdf;base64,...',
21542
+ * file_name: 'invoice.pdf'
21543
+ * });
21544
+ * ```
21545
+ */
21546
+ async extractText(payload) {
21547
+ return this.request('POST', 'media/extract-text', { data: payload });
21548
+ }
21549
+ // ===================================================================
21550
+ // OCR Extraction
21551
+ // ===================================================================
21552
+ /**
21553
+ * Run OCR extraction on an image using a saved model
21554
+ *
21555
+ * Crops each labeled region from the image and runs OCR to extract text.
21556
+ * Returns structured key-value results.
21557
+ *
21558
+ * @param payload - Model UUID, image (base64 or DMS key), and optional document boundary
21559
+ * @returns Extraction results as label-text pairs
21560
+ *
21561
+ * @example
21562
+ * ```typescript
21563
+ * // From a DMS file
21564
+ * const result = await dms.ocrExtract({
21565
+ * model_uuid: 'model-uuid',
21566
+ * image_key: 'uploads/scan.jpg',
21567
+ * document_boundary: { x: 0.05, y: 0.08, width: 0.9, height: 0.85 }
21568
+ * });
21569
+ *
21570
+ * console.log(result.data.results);
21571
+ * // { name: "John Smith", date_of_birth: "01.01.1990", id_number: "123456789" }
21572
+ *
21573
+ * // From base64
21574
+ * const result = await dms.ocrExtract({
21575
+ * model_uuid: 'model-uuid',
21576
+ * image: 'data:image/jpeg;base64,...'
21577
+ * });
21578
+ * ```
21579
+ */
21580
+ async ocrExtract(payload) {
21581
+ return this.request('POST', 'media/ocr/extract', {
21582
+ data: payload,
21583
+ timeout: 120000
21584
+ });
21585
+ }
21510
21586
  async request(method, endpoint, params) {
21511
21587
  return await this.client.request({
21512
21588
  method: method,
@@ -22686,6 +22762,59 @@ class Integrations extends IntegrationsBaseClient {
22686
22762
  }
22687
22763
  }
22688
22764
 
22765
+ class Satellites extends IntegrationsBaseClient {
22766
+ async list() {
22767
+ const { data } = await this.client.get('/satellites/templates');
22768
+ return data;
22769
+ }
22770
+ async create(payload) {
22771
+ const { data } = await this.client.post('/satellites/templates', payload.template);
22772
+ if (payload.schema) {
22773
+ await this.createVersion(data.id, payload.schema);
22774
+ }
22775
+ return data;
22776
+ }
22777
+ async get(id) {
22778
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
22779
+ return data;
22780
+ }
22781
+ async delete(id) {
22782
+ const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
22783
+ return data;
22784
+ }
22785
+ async createVersion(id, payload) {
22786
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
22787
+ return data;
22788
+ }
22789
+ async versions(id) {
22790
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
22791
+ return data;
22792
+ }
22793
+ async deploy(id, payload) {
22794
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
22795
+ return data;
22796
+ }
22797
+ async rollback(id, payload) {
22798
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
22799
+ return data;
22800
+ }
22801
+ async permissions(id) {
22802
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
22803
+ return data;
22804
+ }
22805
+ async logs(id, params = {}) {
22806
+ const since = params.since instanceof Date ? params.since.toISOString() : params.since;
22807
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
22808
+ params: since ? { since } : undefined,
22809
+ });
22810
+ return data;
22811
+ }
22812
+ async execute(id, command, payload = {}) {
22813
+ const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
22814
+ return data;
22815
+ }
22816
+ }
22817
+
22689
22818
  // PRN — Protokol Resource Name
22690
22819
  //
22691
22820
  // Format:
@@ -22859,6 +22988,7 @@ exports.Platform = Platform;
22859
22988
  exports.Project = Project;
22860
22989
  exports.Ratchet = Ratchet;
22861
22990
  exports.Sandbox = Sandbox;
22991
+ exports.Satellites = Satellites;
22862
22992
  exports.SerbiaMinFin = MinFin;
22863
22993
  exports.System = System;
22864
22994
  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
  *
@@ -1325,11 +1330,16 @@ class Forge extends PlatformBaseClient {
1325
1330
  }
1326
1331
  // --- Service execution (forge-runtime) ---
1327
1332
  async callService(appUuid, serviceName, options) {
1328
- var _a;
1333
+ var _a, _b, _c;
1329
1334
  const queryString = (options === null || options === void 0 ? void 0 : options.query)
1330
1335
  ? '?' + new URLSearchParams(options.query).toString()
1331
1336
  : '';
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);
1337
+ // @ts-ignore
1338
+ const devServiceUrl = isBrowser && ((_a = window.__ENV_VARIABLES__) === null || _a === void 0 ? void 0 : _a.FORGE_DEV_SERVICE_URL);
1339
+ if (devServiceUrl) {
1340
+ return axios.post(`${devServiceUrl}/${serviceName}${queryString}`, (_b = options === null || options === void 0 ? void 0 : options.body) !== null && _b !== void 0 ? _b : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
1341
+ }
1342
+ return await this.client.post(`/luma/forge-runtime/api/services/${appUuid}/${serviceName}${queryString}`, (_c = options === null || options === void 0 ? void 0 : options.body) !== null && _c !== void 0 ? _c : {}, (options === null || options === void 0 ? void 0 : options.headers) ? { headers: options.headers } : undefined);
1333
1343
  }
1334
1344
  }
1335
1345
 
@@ -2540,6 +2550,72 @@ class DMS extends IntegrationsBaseClient {
2540
2550
  }
2541
2551
  });
2542
2552
  }
2553
+ // ===================================================================
2554
+ // Text Extraction
2555
+ // ===================================================================
2556
+ /**
2557
+ * Extract text from any document format
2558
+ *
2559
+ * Supports PDF, DOCX, XLSX, PPTX, ODT, RTF, EPUB, CSV, images, and 40+ other formats.
2560
+ * Provide either a DMS file path or base64-encoded file data.
2561
+ *
2562
+ * @param payload - File path or base64 data to extract text from
2563
+ * @returns Extracted text content and character count
2564
+ *
2565
+ * @example
2566
+ * ```typescript
2567
+ * // From a DMS file path
2568
+ * const result = await dms.extractText({ input_path: 'uploads/contract.pdf' });
2569
+ * console.log(result.data.text);
2570
+ * console.log(result.data.char_count);
2571
+ *
2572
+ * // From base64 data
2573
+ * const result = await dms.extractText({
2574
+ * file_data: 'data:application/pdf;base64,...',
2575
+ * file_name: 'invoice.pdf'
2576
+ * });
2577
+ * ```
2578
+ */
2579
+ async extractText(payload) {
2580
+ return this.request('POST', 'media/extract-text', { data: payload });
2581
+ }
2582
+ // ===================================================================
2583
+ // OCR Extraction
2584
+ // ===================================================================
2585
+ /**
2586
+ * Run OCR extraction on an image using a saved model
2587
+ *
2588
+ * Crops each labeled region from the image and runs OCR to extract text.
2589
+ * Returns structured key-value results.
2590
+ *
2591
+ * @param payload - Model UUID, image (base64 or DMS key), and optional document boundary
2592
+ * @returns Extraction results as label-text pairs
2593
+ *
2594
+ * @example
2595
+ * ```typescript
2596
+ * // From a DMS file
2597
+ * const result = await dms.ocrExtract({
2598
+ * model_uuid: 'model-uuid',
2599
+ * image_key: 'uploads/scan.jpg',
2600
+ * document_boundary: { x: 0.05, y: 0.08, width: 0.9, height: 0.85 }
2601
+ * });
2602
+ *
2603
+ * console.log(result.data.results);
2604
+ * // { name: "John Smith", date_of_birth: "01.01.1990", id_number: "123456789" }
2605
+ *
2606
+ * // From base64
2607
+ * const result = await dms.ocrExtract({
2608
+ * model_uuid: 'model-uuid',
2609
+ * image: 'data:image/jpeg;base64,...'
2610
+ * });
2611
+ * ```
2612
+ */
2613
+ async ocrExtract(payload) {
2614
+ return this.request('POST', 'media/ocr/extract', {
2615
+ data: payload,
2616
+ timeout: 120000
2617
+ });
2618
+ }
2543
2619
  async request(method, endpoint, params) {
2544
2620
  return await this.client.request({
2545
2621
  method: method,
@@ -3719,6 +3795,59 @@ class Integrations extends IntegrationsBaseClient {
3719
3795
  }
3720
3796
  }
3721
3797
 
3798
+ class Satellites extends IntegrationsBaseClient {
3799
+ async list() {
3800
+ const { data } = await this.client.get('/satellites/templates');
3801
+ return data;
3802
+ }
3803
+ async create(payload) {
3804
+ const { data } = await this.client.post('/satellites/templates', payload.template);
3805
+ if (payload.schema) {
3806
+ await this.createVersion(data.id, payload.schema);
3807
+ }
3808
+ return data;
3809
+ }
3810
+ async get(id) {
3811
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}`);
3812
+ return data;
3813
+ }
3814
+ async delete(id) {
3815
+ const { data } = await this.client.delete(`/satellites/templates/${encodeURIComponent(id)}`);
3816
+ return data;
3817
+ }
3818
+ async createVersion(id, payload) {
3819
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/versions`, payload);
3820
+ return data;
3821
+ }
3822
+ async versions(id) {
3823
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/versions`);
3824
+ return data;
3825
+ }
3826
+ async deploy(id, payload) {
3827
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/deploy`, payload);
3828
+ return data;
3829
+ }
3830
+ async rollback(id, payload) {
3831
+ const { data } = await this.client.post(`/satellites/templates/${encodeURIComponent(id)}/rollback`, payload);
3832
+ return data;
3833
+ }
3834
+ async permissions(id) {
3835
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/permissions`);
3836
+ return data;
3837
+ }
3838
+ async logs(id, params = {}) {
3839
+ const since = params.since instanceof Date ? params.since.toISOString() : params.since;
3840
+ const { data } = await this.client.get(`/satellites/templates/${encodeURIComponent(id)}/logs`, {
3841
+ params: since ? { since } : undefined,
3842
+ });
3843
+ return data;
3844
+ }
3845
+ async execute(id, command, payload = {}) {
3846
+ const { data } = await this.client.post(`/satellites/${encodeURIComponent(id)}/commands/${encodeURIComponent(command)}/execute`, payload);
3847
+ return data;
3848
+ }
3849
+ }
3850
+
3722
3851
  // PRN — Protokol Resource Name
3723
3852
  //
3724
3853
  // Format:
@@ -3871,4 +4000,4 @@ class Invoicing extends PlatformBaseClient {
3871
4000
  }
3872
4001
  }
3873
4002
 
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 };
4003
+ 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.13.0",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",