@ptkl/sdk 1.11.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.
- package/dist/index.0.10.js +156 -0
- package/dist/index.0.9.js +57 -0
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +1 -0
- package/dist/v0.10/api/forge.d.ts +9 -0
- package/dist/v0.10/api/index.d.ts +3 -0
- package/dist/v0.10/api/integrations/dms.d.ts +54 -1
- package/dist/v0.10/api/satellites.d.ts +17 -0
- package/dist/v0.10/index.cjs.js +156 -0
- package/dist/v0.10/index.esm.js +156 -1
- package/dist/v0.10/types/integrations.d.ts +97 -0
- package/dist/v0.10/types/satellites.d.ts +100 -0
- package/dist/v0.9/api/forge.d.ts +3 -0
- package/dist/v0.9/api/index.d.ts +2 -0
- package/dist/v0.9/api/integrations/timber.d.ts +22 -0
- package/dist/v0.9/api/integrations.d.ts +2 -0
- package/dist/v0.9/index.cjs.js +57 -0
- package/dist/v0.9/index.esm.js +57 -1
- package/dist/v0.9/types/integrations/timber.d.ts +77 -0
- package/package.json +1 -1
package/dist/v0.10/index.esm.js
CHANGED
|
@@ -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
|
*
|
|
@@ -1288,6 +1293,7 @@ class Workflow extends PlatformBaseClient {
|
|
|
1288
1293
|
}
|
|
1289
1294
|
|
|
1290
1295
|
class Forge extends PlatformBaseClient {
|
|
1296
|
+
// --- Management (appservice) ---
|
|
1291
1297
|
async bundleUpload(buffer) {
|
|
1292
1298
|
return await this.client.post(`/luma/appservice/v1/forge/upload`, buffer, {
|
|
1293
1299
|
headers: {
|
|
@@ -1305,6 +1311,36 @@ class Forge extends PlatformBaseClient {
|
|
|
1305
1311
|
async list() {
|
|
1306
1312
|
return await this.client.get(`/luma/appservice/v1/forge`);
|
|
1307
1313
|
}
|
|
1314
|
+
async listServices(ref) {
|
|
1315
|
+
return await this.client.get(`/luma/appservice/v1/forge/${ref}/services`);
|
|
1316
|
+
}
|
|
1317
|
+
// --- Variables ---
|
|
1318
|
+
async getVariables(ref) {
|
|
1319
|
+
return await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
1320
|
+
}
|
|
1321
|
+
async updateVariables(ref, variables) {
|
|
1322
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, variables);
|
|
1323
|
+
}
|
|
1324
|
+
async addVariable(ref, key, value) {
|
|
1325
|
+
var _a;
|
|
1326
|
+
const resp = await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
1327
|
+
const current = (_a = resp.data) !== null && _a !== void 0 ? _a : {};
|
|
1328
|
+
current[key] = value;
|
|
1329
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, current);
|
|
1330
|
+
}
|
|
1331
|
+
// --- Service execution (forge-runtime) ---
|
|
1332
|
+
async callService(appUuid, serviceName, options) {
|
|
1333
|
+
var _a, _b, _c;
|
|
1334
|
+
const queryString = (options === null || options === void 0 ? void 0 : options.query)
|
|
1335
|
+
? '?' + new URLSearchParams(options.query).toString()
|
|
1336
|
+
: '';
|
|
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);
|
|
1343
|
+
}
|
|
1308
1344
|
}
|
|
1309
1345
|
|
|
1310
1346
|
const BASE = '/luma/kortex/v1';
|
|
@@ -2514,6 +2550,72 @@ class DMS extends IntegrationsBaseClient {
|
|
|
2514
2550
|
}
|
|
2515
2551
|
});
|
|
2516
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
|
+
}
|
|
2517
2619
|
async request(method, endpoint, params) {
|
|
2518
2620
|
return await this.client.request({
|
|
2519
2621
|
method: method,
|
|
@@ -3693,6 +3795,59 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
3693
3795
|
}
|
|
3694
3796
|
}
|
|
3695
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
|
+
|
|
3696
3851
|
// PRN — Protokol Resource Name
|
|
3697
3852
|
//
|
|
3698
3853
|
// Format:
|
|
@@ -3845,4 +4000,4 @@ class Invoicing extends PlatformBaseClient {
|
|
|
3845
4000
|
}
|
|
3846
4001
|
}
|
|
3847
4002
|
|
|
3848
|
-
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/dist/v0.9/api/forge.d.ts
CHANGED
|
@@ -4,4 +4,7 @@ export default class Forge extends PlatformBaseClient {
|
|
|
4
4
|
getWorkspaceApps(): Promise<any>;
|
|
5
5
|
removeVersion(ref: string, version: string): Promise<any>;
|
|
6
6
|
list(): Promise<any>;
|
|
7
|
+
getVariables(ref: string): Promise<any>;
|
|
8
|
+
updateVariables(ref: string, variables: Record<string, any>): Promise<any>;
|
|
9
|
+
addVariable(ref: string, key: string, value: any): Promise<any>;
|
|
7
10
|
}
|
package/dist/v0.9/api/index.d.ts
CHANGED
|
@@ -26,5 +26,7 @@ export { default as SerbiaUtil } from './integrations/serbiaUtil';
|
|
|
26
26
|
export { default as VPFR } from './integrations/vpfr';
|
|
27
27
|
export { default as Mail } from './integrations/mail';
|
|
28
28
|
export { default as Ecommerce } from './integrations/ecommerce';
|
|
29
|
+
export { default as Timber } from './integrations/timber';
|
|
30
|
+
export type { TimberQueryParams, TimberQueryResponse, TimberWritePayload, TimberLogPayload, TimberUsage, TimberEntry, } from '../types/integrations/timber';
|
|
29
31
|
import Platfrom from './platform';
|
|
30
32
|
export default Platfrom;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
|
+
import { TimberLogPayload, TimberQueryParams, TimberQueryResponse, TimberUsage, TimberWritePayload } from "../../types/integrations/timber";
|
|
3
|
+
export default class Timber extends IntegrationsBaseClient {
|
|
4
|
+
query(params?: TimberQueryParams): Promise<TimberQueryResponse>;
|
|
5
|
+
write(payload: TimberWritePayload): Promise<{
|
|
6
|
+
accepted: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
usage(): Promise<TimberUsage>;
|
|
9
|
+
debug(message: string, payload?: TimberLogPayload): Promise<{
|
|
10
|
+
accepted: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
info(message: string, payload?: TimberLogPayload): Promise<{
|
|
13
|
+
accepted: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
warn(message: string, payload?: TimberLogPayload): Promise<{
|
|
16
|
+
accepted: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
error(message: string, payload?: TimberLogPayload): Promise<{
|
|
19
|
+
accepted: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
private normalizeParams;
|
|
22
|
+
}
|
|
@@ -6,6 +6,7 @@ import IntegrationsBaseClient from "./integrationsBaseClient";
|
|
|
6
6
|
import Payments from "./integrations/payments";
|
|
7
7
|
import Minimax from "./integrations/minimax";
|
|
8
8
|
import Ecommerce from "./integrations/ecommerce";
|
|
9
|
+
import Timber from "./integrations/timber";
|
|
9
10
|
export default class Integrations extends IntegrationsBaseClient {
|
|
10
11
|
private integrations;
|
|
11
12
|
constructor(options?: {
|
|
@@ -21,6 +22,7 @@ export default class Integrations extends IntegrationsBaseClient {
|
|
|
21
22
|
getPayments(): Payments;
|
|
22
23
|
getMinimax(): Minimax;
|
|
23
24
|
getEcommerce(): Ecommerce;
|
|
25
|
+
getTimber(): Timber;
|
|
24
26
|
list(): Promise<any>;
|
|
25
27
|
isInstalled(id: string): Promise<boolean>;
|
|
26
28
|
isActive(id: string): Promise<boolean>;
|
package/dist/v0.9/index.cjs.js
CHANGED
|
@@ -19952,6 +19952,19 @@ class Forge extends PlatformBaseClient {
|
|
|
19952
19952
|
async list() {
|
|
19953
19953
|
return await this.client.get(`/luma/appservice/v1/forge`);
|
|
19954
19954
|
}
|
|
19955
|
+
async getVariables(ref) {
|
|
19956
|
+
return await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
19957
|
+
}
|
|
19958
|
+
async updateVariables(ref, variables) {
|
|
19959
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, variables);
|
|
19960
|
+
}
|
|
19961
|
+
async addVariable(ref, key, value) {
|
|
19962
|
+
var _a;
|
|
19963
|
+
const resp = await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
19964
|
+
const current = (_a = resp.data) !== null && _a !== void 0 ? _a : {};
|
|
19965
|
+
current[key] = value;
|
|
19966
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, current);
|
|
19967
|
+
}
|
|
19955
19968
|
}
|
|
19956
19969
|
|
|
19957
19970
|
class Project extends PlatformBaseClient {
|
|
@@ -21938,6 +21951,45 @@ class Ecommerce extends IntegrationsBaseClient {
|
|
|
21938
21951
|
}
|
|
21939
21952
|
}
|
|
21940
21953
|
|
|
21954
|
+
class Timber extends IntegrationsBaseClient {
|
|
21955
|
+
async query(params = {}) {
|
|
21956
|
+
const { data } = await this.client.get("/v1/timber/logs", {
|
|
21957
|
+
params: this.normalizeParams(params),
|
|
21958
|
+
});
|
|
21959
|
+
return data;
|
|
21960
|
+
}
|
|
21961
|
+
async write(payload) {
|
|
21962
|
+
const { data } = await this.client.post("/v1/timber/logs", payload);
|
|
21963
|
+
return data;
|
|
21964
|
+
}
|
|
21965
|
+
async usage() {
|
|
21966
|
+
const { data } = await this.client.get("/v1/timber/usage");
|
|
21967
|
+
return data;
|
|
21968
|
+
}
|
|
21969
|
+
async debug(message, payload) {
|
|
21970
|
+
return this.write({ ...payload, message, level: 'debug' });
|
|
21971
|
+
}
|
|
21972
|
+
async info(message, payload) {
|
|
21973
|
+
return this.write({ ...payload, message, level: 'info' });
|
|
21974
|
+
}
|
|
21975
|
+
async warn(message, payload) {
|
|
21976
|
+
return this.write({ ...payload, message, level: 'warn' });
|
|
21977
|
+
}
|
|
21978
|
+
async error(message, payload) {
|
|
21979
|
+
return this.write({ ...payload, message, level: 'error' });
|
|
21980
|
+
}
|
|
21981
|
+
normalizeParams(params) {
|
|
21982
|
+
const normalized = { ...params };
|
|
21983
|
+
if (params.from instanceof Date) {
|
|
21984
|
+
normalized.from = params.from.toISOString();
|
|
21985
|
+
}
|
|
21986
|
+
if (params.to instanceof Date) {
|
|
21987
|
+
normalized.to = params.to.toISOString();
|
|
21988
|
+
}
|
|
21989
|
+
return normalized;
|
|
21990
|
+
}
|
|
21991
|
+
}
|
|
21992
|
+
|
|
21941
21993
|
// import integrations
|
|
21942
21994
|
class Integrations extends IntegrationsBaseClient {
|
|
21943
21995
|
constructor(options) {
|
|
@@ -21951,6 +22003,7 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
21951
22003
|
'protokol-payments': new Payments().setClient(this.client),
|
|
21952
22004
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
21953
22005
|
'protokol-ecommerce': new Ecommerce().setClient(this.client),
|
|
22006
|
+
'protokol-timber': new Timber().setClient(this.client),
|
|
21954
22007
|
};
|
|
21955
22008
|
}
|
|
21956
22009
|
getSerbiaUtilities() {
|
|
@@ -21977,6 +22030,9 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
21977
22030
|
getEcommerce() {
|
|
21978
22031
|
return this.getInterfaceOf('protokol-ecommerce');
|
|
21979
22032
|
}
|
|
22033
|
+
getTimber() {
|
|
22034
|
+
return this.getInterfaceOf('protokol-timber');
|
|
22035
|
+
}
|
|
21980
22036
|
async list() {
|
|
21981
22037
|
const { data } = await this.client.get("/v1/integrations");
|
|
21982
22038
|
return data;
|
|
@@ -22152,6 +22208,7 @@ exports.Sandbox = Sandbox;
|
|
|
22152
22208
|
exports.SerbiaUtil = SerbiaUtil;
|
|
22153
22209
|
exports.System = System;
|
|
22154
22210
|
exports.Thunder = Thunder;
|
|
22211
|
+
exports.Timber = Timber;
|
|
22155
22212
|
exports.Users = Users;
|
|
22156
22213
|
exports.VPFR = VPFR;
|
|
22157
22214
|
exports.Workflow = Workflow;
|
package/dist/v0.9/index.esm.js
CHANGED
|
@@ -983,6 +983,19 @@ class Forge extends PlatformBaseClient {
|
|
|
983
983
|
async list() {
|
|
984
984
|
return await this.client.get(`/luma/appservice/v1/forge`);
|
|
985
985
|
}
|
|
986
|
+
async getVariables(ref) {
|
|
987
|
+
return await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
988
|
+
}
|
|
989
|
+
async updateVariables(ref, variables) {
|
|
990
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, variables);
|
|
991
|
+
}
|
|
992
|
+
async addVariable(ref, key, value) {
|
|
993
|
+
var _a;
|
|
994
|
+
const resp = await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
995
|
+
const current = (_a = resp.data) !== null && _a !== void 0 ? _a : {};
|
|
996
|
+
current[key] = value;
|
|
997
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, current);
|
|
998
|
+
}
|
|
986
999
|
}
|
|
987
1000
|
|
|
988
1001
|
class Project extends PlatformBaseClient {
|
|
@@ -2969,6 +2982,45 @@ class Ecommerce extends IntegrationsBaseClient {
|
|
|
2969
2982
|
}
|
|
2970
2983
|
}
|
|
2971
2984
|
|
|
2985
|
+
class Timber extends IntegrationsBaseClient {
|
|
2986
|
+
async query(params = {}) {
|
|
2987
|
+
const { data } = await this.client.get("/v1/timber/logs", {
|
|
2988
|
+
params: this.normalizeParams(params),
|
|
2989
|
+
});
|
|
2990
|
+
return data;
|
|
2991
|
+
}
|
|
2992
|
+
async write(payload) {
|
|
2993
|
+
const { data } = await this.client.post("/v1/timber/logs", payload);
|
|
2994
|
+
return data;
|
|
2995
|
+
}
|
|
2996
|
+
async usage() {
|
|
2997
|
+
const { data } = await this.client.get("/v1/timber/usage");
|
|
2998
|
+
return data;
|
|
2999
|
+
}
|
|
3000
|
+
async debug(message, payload) {
|
|
3001
|
+
return this.write({ ...payload, message, level: 'debug' });
|
|
3002
|
+
}
|
|
3003
|
+
async info(message, payload) {
|
|
3004
|
+
return this.write({ ...payload, message, level: 'info' });
|
|
3005
|
+
}
|
|
3006
|
+
async warn(message, payload) {
|
|
3007
|
+
return this.write({ ...payload, message, level: 'warn' });
|
|
3008
|
+
}
|
|
3009
|
+
async error(message, payload) {
|
|
3010
|
+
return this.write({ ...payload, message, level: 'error' });
|
|
3011
|
+
}
|
|
3012
|
+
normalizeParams(params) {
|
|
3013
|
+
const normalized = { ...params };
|
|
3014
|
+
if (params.from instanceof Date) {
|
|
3015
|
+
normalized.from = params.from.toISOString();
|
|
3016
|
+
}
|
|
3017
|
+
if (params.to instanceof Date) {
|
|
3018
|
+
normalized.to = params.to.toISOString();
|
|
3019
|
+
}
|
|
3020
|
+
return normalized;
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
|
|
2972
3024
|
// import integrations
|
|
2973
3025
|
class Integrations extends IntegrationsBaseClient {
|
|
2974
3026
|
constructor(options) {
|
|
@@ -2982,6 +3034,7 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
2982
3034
|
'protokol-payments': new Payments().setClient(this.client),
|
|
2983
3035
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
2984
3036
|
'protokol-ecommerce': new Ecommerce().setClient(this.client),
|
|
3037
|
+
'protokol-timber': new Timber().setClient(this.client),
|
|
2985
3038
|
};
|
|
2986
3039
|
}
|
|
2987
3040
|
getSerbiaUtilities() {
|
|
@@ -3008,6 +3061,9 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
3008
3061
|
getEcommerce() {
|
|
3009
3062
|
return this.getInterfaceOf('protokol-ecommerce');
|
|
3010
3063
|
}
|
|
3064
|
+
getTimber() {
|
|
3065
|
+
return this.getInterfaceOf('protokol-timber');
|
|
3066
|
+
}
|
|
3011
3067
|
async list() {
|
|
3012
3068
|
const { data } = await this.client.get("/v1/integrations");
|
|
3013
3069
|
return data;
|
|
@@ -3161,4 +3217,4 @@ function parsePRN(s) {
|
|
|
3161
3217
|
// Export all API modules for version 0.9
|
|
3162
3218
|
// This version has specific method signatures and behaviors for v0.9
|
|
3163
3219
|
|
|
3164
|
-
export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Ecommerce, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Mail, PRN, Payments, Platform, Project, Ratchet, Sandbox, SerbiaUtil, System, Thunder, Users, VPFR, Workflow, Platform as default, parsePRN };
|
|
3220
|
+
export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Ecommerce, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Mail, PRN, Payments, Platform, Project, Ratchet, Sandbox, SerbiaUtil, System, Thunder, Timber, Users, VPFR, Workflow, Platform as default, parsePRN };
|