@ptkl/sdk 1.0.3 → 1.3.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 +453 -135
- package/dist/index.0.9.js +135 -8
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +152 -20
- package/dist/v0.10/api/functions.d.ts +1 -2
- package/dist/v0.10/api/index.d.ts +4 -2
- package/dist/v0.10/api/integrations/dms.d.ts +0 -9
- package/dist/v0.10/api/integrations/mail.d.ts +125 -0
- package/dist/v0.10/api/integrations/serbia/minfin/index.d.ts +10 -0
- package/dist/v0.10/api/integrations/serbia/minfin/vpfr.d.ts +4 -0
- package/dist/v0.10/api/integrations/serbia/nbs/index.d.ts +10 -0
- package/dist/v0.10/api/integrations/serbiaUtil.d.ts +9 -7
- package/dist/v0.10/api/integrations.d.ts +6 -3
- package/dist/v0.10/api/platform.d.ts +2 -2
- package/dist/v0.10/api/platformBaseClient.d.ts +0 -1
- package/dist/v0.10/api/project.d.ts +6 -1
- package/dist/v0.10/index.cjs.js +453 -135
- package/dist/v0.10/index.esm.js +451 -135
- package/dist/v0.10/types/component.d.ts +73 -3
- package/dist/v0.10/types/integrations/mail.d.ts +156 -0
- package/dist/v0.10/types/integrations/minimax.d.ts +961 -0
- package/dist/v0.10/types/integrations/payments.d.ts +48 -0
- package/dist/v0.10/types/integrations/serbiaUtils.d.ts +40 -0
- package/dist/v0.10/types/integrations/serbiaUtits.d.ts +37 -0
- package/dist/v0.9/api/functions.d.ts +1 -2
- package/dist/v0.9/api/index.d.ts +1 -0
- package/dist/v0.9/api/integrations/mail.d.ts +69 -0
- package/dist/v0.9/api/integrations/serbiaUtil.d.ts +10 -7
- package/dist/v0.9/api/integrations.d.ts +2 -0
- package/dist/v0.9/api/platformBaseClient.d.ts +0 -1
- package/dist/v0.9/api/project.d.ts +6 -1
- package/dist/v0.9/api/roles.d.ts +12 -0
- package/dist/v0.9/index.cjs.js +135 -8
- package/dist/v0.9/index.esm.js +135 -9
- package/dist/v0.9/types/integrations/mail.d.ts +155 -0
- package/dist/v0.9/types/integrations/minimax.d.ts +961 -0
- package/dist/v0.9/types/integrations/payments.d.ts +48 -0
- package/dist/v0.9/types/integrations/serbiaUtits.d.ts +40 -0
- package/dist/v0.9/types/integrations.d.ts +0 -12
- package/package.json +1 -1
package/dist/v0.10/index.esm.js
CHANGED
|
@@ -24,7 +24,6 @@ const isSandbox = typeof window !== "undefined";
|
|
|
24
24
|
*
|
|
25
25
|
* @class PlatformBaseClient
|
|
26
26
|
* @extends BaseClient
|
|
27
|
-
* @constructor
|
|
28
27
|
* @param {AxiosInstance} [client] - The axios instance to use for the client
|
|
29
28
|
*
|
|
30
29
|
* @example
|
|
@@ -35,7 +34,7 @@ const isSandbox = typeof window !== "undefined";
|
|
|
35
34
|
*/
|
|
36
35
|
class PlatformBaseClient extends BaseClient {
|
|
37
36
|
constructor(options) {
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
39
38
|
let { env = null, token = null, host = null, } = options !== null && options !== void 0 ? options : {};
|
|
40
39
|
let headers = {};
|
|
41
40
|
var project_uuid = null;
|
|
@@ -44,23 +43,23 @@ class PlatformBaseClient extends BaseClient {
|
|
|
44
43
|
const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
|
|
45
44
|
host = (_a = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _a !== void 0 ? _a : host;
|
|
46
45
|
// @ts-ignore
|
|
47
|
-
env =
|
|
48
|
-
token =
|
|
46
|
+
env = (_b = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV) !== null && _b !== void 0 ? _b : env;
|
|
47
|
+
token = (_c = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN) !== null && _c !== void 0 ? _c : token;
|
|
49
48
|
project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
|
|
50
49
|
if (isBrowser) {
|
|
51
50
|
if (sessionStorage.getItem('protokol_context') == "forge") {
|
|
52
|
-
headers['X-Project-Env'] = (
|
|
51
|
+
headers['X-Project-Env'] = (_d = sessionStorage.getItem('forge_app_env')) !== null && _d !== void 0 ? _d : "dev";
|
|
53
52
|
}
|
|
54
53
|
else {
|
|
55
|
-
headers['X-Project-Env'] = (
|
|
54
|
+
headers['X-Project-Env'] = (_e = localStorage.getItem('current_env')) !== null && _e !== void 0 ? _e : "dev";
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
host = (
|
|
61
|
-
env = (
|
|
62
|
-
token = (
|
|
63
|
-
project_uuid = (
|
|
58
|
+
if (isNode) {
|
|
59
|
+
host = (_f = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _f !== void 0 ? _f : null;
|
|
60
|
+
env = (_g = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _g !== void 0 ? _g : null;
|
|
61
|
+
token = (_h = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _h !== void 0 ? _h : null;
|
|
62
|
+
project_uuid = (_j = process.env.PROJECT_UUID) !== null && _j !== void 0 ? _j : null;
|
|
64
63
|
}
|
|
65
64
|
if (token) {
|
|
66
65
|
headers['Authorization'] = `Bearer ${token}`;
|
|
@@ -88,21 +87,9 @@ class PlatformBaseClient extends BaseClient {
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
class Component extends PlatformBaseClient {
|
|
91
|
-
constructor(ref = null
|
|
92
|
-
var _a;
|
|
90
|
+
constructor(ref = null) {
|
|
93
91
|
super();
|
|
94
92
|
this.ref = ref;
|
|
95
|
-
this.version = (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : null;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Get the base path for component API calls
|
|
99
|
-
* @private
|
|
100
|
-
*/
|
|
101
|
-
getComponentPath() {
|
|
102
|
-
if (this.version) {
|
|
103
|
-
return `/v3/system/component/${this.ref}/v/${this.version}`;
|
|
104
|
-
}
|
|
105
|
-
return `/v3/system/component/${this.ref}`;
|
|
106
93
|
}
|
|
107
94
|
/**
|
|
108
95
|
* Find method to search for models
|
|
@@ -126,7 +113,6 @@ class Component extends PlatformBaseClient {
|
|
|
126
113
|
* )
|
|
127
114
|
**/
|
|
128
115
|
async find(filters, opts) {
|
|
129
|
-
const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== void 0 ? opts : {};
|
|
130
116
|
let payload = {
|
|
131
117
|
context: filters,
|
|
132
118
|
ref: this.ref,
|
|
@@ -152,32 +138,18 @@ class Component extends PlatformBaseClient {
|
|
|
152
138
|
sortBy: ctx.sortBy,
|
|
153
139
|
sortDesc: sortDesc,
|
|
154
140
|
filter: ctx.filter,
|
|
155
|
-
filterOn: ctx.filterOn
|
|
141
|
+
filterOn: ctx.filterOn,
|
|
156
142
|
limit: limit,
|
|
157
143
|
dateFrom: ctx.dateFrom,
|
|
158
144
|
dateTo: ctx.dateTo,
|
|
159
145
|
dateField: ctx.dateField,
|
|
160
146
|
};
|
|
161
|
-
|
|
162
|
-
params
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
params.$aggregate = JSON.stringify(ctx.$aggregate);
|
|
166
|
-
}
|
|
167
|
-
if (opts) {
|
|
168
|
-
Object.keys(opts).forEach(k => {
|
|
169
|
-
if (['cache', 'buildttl', 'locale'].includes(k)) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
params[`_opt_${k}`] = opts ? opts[k] : null;
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
return await this.client.get(`${this.getComponentPath()}/models`, {
|
|
176
|
-
params: params,
|
|
147
|
+
return await this.client.post(`/v4/system/component/${this.ref}/models`, {
|
|
148
|
+
...params,
|
|
149
|
+
options: opts
|
|
150
|
+
}, {
|
|
177
151
|
headers: {
|
|
178
|
-
|
|
179
|
-
'X-Build-Ttl': buildttl,
|
|
180
|
-
'Accept-Language': locale
|
|
152
|
+
"Accept-Language": (opts === null || opts === void 0 ? void 0 : opts.locale) || "en_US",
|
|
181
153
|
}
|
|
182
154
|
});
|
|
183
155
|
}
|
|
@@ -211,17 +183,34 @@ class Component extends PlatformBaseClient {
|
|
|
211
183
|
* @returns (Promise<Model>)
|
|
212
184
|
*/
|
|
213
185
|
async get(uuid) {
|
|
214
|
-
return await this.client.get(
|
|
186
|
+
return await this.client.get(`/v4/system/component/${this.ref}/model/${uuid}`);
|
|
215
187
|
}
|
|
216
188
|
/**
|
|
217
189
|
* Update model by uuid
|
|
218
190
|
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
191
|
+
* Regular fields in `data` are applied via `$set`. You can include MongoDB
|
|
192
|
+
* update operators (prefixed with `$`) directly in the data object for
|
|
193
|
+
* granular updates like incrementing, pushing to arrays, etc.
|
|
194
|
+
*
|
|
195
|
+
* @param uuid - The uuid of the model to update
|
|
196
|
+
* @param data - Fields to update, optionally including update operators
|
|
197
|
+
* @param options - Update options
|
|
198
|
+
* @returns The updated model
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* // Simple update (backwards compatible)
|
|
202
|
+
* await component.update(uuid, { name: "John" }, opts)
|
|
203
|
+
*
|
|
204
|
+
* // With update operators
|
|
205
|
+
* await component.update(uuid, {
|
|
206
|
+
* name: "John",
|
|
207
|
+
* $inc: { login_count: 1 },
|
|
208
|
+
* $push: { tags: "verified" },
|
|
209
|
+
* $addToSet: { roles: "admin" }
|
|
210
|
+
* }, opts)
|
|
222
211
|
*/
|
|
223
212
|
async update(uuid, data, options) {
|
|
224
|
-
return await this.client.post(
|
|
213
|
+
return await this.client.post(`/v4/system/component/${this.ref}/model/${uuid}`, {
|
|
225
214
|
data,
|
|
226
215
|
options,
|
|
227
216
|
});
|
|
@@ -234,7 +223,7 @@ class Component extends PlatformBaseClient {
|
|
|
234
223
|
* @returns
|
|
235
224
|
*/
|
|
236
225
|
async updateMany(data, options) {
|
|
237
|
-
return await this.client.patch(
|
|
226
|
+
return await this.client.patch(`/v4/system/component/${this.ref}/models/bulk`, {
|
|
238
227
|
data,
|
|
239
228
|
options
|
|
240
229
|
});
|
|
@@ -247,7 +236,7 @@ class Component extends PlatformBaseClient {
|
|
|
247
236
|
* @returns
|
|
248
237
|
*/
|
|
249
238
|
async createMany(data, options) {
|
|
250
|
-
return await this.client.post(
|
|
239
|
+
return await this.client.post(`/v4/system/component/${this.ref}/models/bulk`, {
|
|
251
240
|
data,
|
|
252
241
|
options
|
|
253
242
|
});
|
|
@@ -255,37 +244,59 @@ class Component extends PlatformBaseClient {
|
|
|
255
244
|
/**
|
|
256
245
|
* Modify models by filters
|
|
257
246
|
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
247
|
+
* Updates all models matching the given filters. Supports inline update
|
|
248
|
+
* operators in the data payload for granular operations.
|
|
249
|
+
*
|
|
250
|
+
* @param filters - Query filters to match models
|
|
251
|
+
* @param data - Fields to update, optionally including update operators
|
|
252
|
+
* @param options - Modify options (e.g. upsert)
|
|
253
|
+
* @returns The modified models
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* await component.modify(
|
|
257
|
+
* { status: "active" },
|
|
258
|
+
* { $inc: { impression_count: 1 }, $addToSet: { viewers: "user-1" } },
|
|
259
|
+
* { upsert: false }
|
|
260
|
+
* )
|
|
261
261
|
*/
|
|
262
262
|
async modify(filters, data, options) {
|
|
263
|
-
return await this.client.patch(
|
|
263
|
+
return await this.client.patch(`/v4/system/component/${this.ref}/modify/model`, {
|
|
264
264
|
filters,
|
|
265
265
|
data,
|
|
266
266
|
options,
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
269
|
/**
|
|
270
|
-
* Concurrent update model by uuid
|
|
270
|
+
* Concurrent update model by uuid with optimistic locking
|
|
271
271
|
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
272
|
+
* Uses version-based concurrency control — the update will fail with a
|
|
273
|
+
* conflict error if the document has been modified since the provided version.
|
|
274
|
+
* Supports inline update operators in the data payload.
|
|
275
|
+
*
|
|
276
|
+
* @param uuid - The uuid of the model
|
|
277
|
+
* @param version - The expected __version__ of the model
|
|
278
|
+
* @param data - Fields to update, optionally including update operators
|
|
279
|
+
* @param options - Update options
|
|
280
|
+
* @returns The updated model
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* await component.concurrentUpdate(uuid, model.__version__, {
|
|
284
|
+
* status: "processed",
|
|
285
|
+
* $inc: { retry_count: 1 }
|
|
286
|
+
* }, opts)
|
|
276
287
|
*/
|
|
277
288
|
async concurrentUpdate(uuid, version, data, options) {
|
|
278
|
-
return await this.client.post(
|
|
289
|
+
return await this.client.post(`/v4/system/component/${this.ref}/model/${uuid}`, {
|
|
279
290
|
version: version,
|
|
280
291
|
data,
|
|
281
292
|
options,
|
|
282
293
|
});
|
|
283
294
|
}
|
|
284
295
|
async create(model) {
|
|
285
|
-
return await this.client.post(
|
|
296
|
+
return await this.client.post(`/v4/system/component/${this.ref}/model`, model);
|
|
286
297
|
}
|
|
287
298
|
async delete(uuid) {
|
|
288
|
-
return await this.client.delete(
|
|
299
|
+
return await this.client.delete(`/v4/system/component/${this.ref}/model/${uuid}`);
|
|
289
300
|
}
|
|
290
301
|
/**
|
|
291
302
|
* Execute aggregate pipeline with optional streaming support
|
|
@@ -338,14 +349,14 @@ class Component extends PlatformBaseClient {
|
|
|
338
349
|
onError: onErrorCallback,
|
|
339
350
|
onEnd: onEndCallback
|
|
340
351
|
};
|
|
341
|
-
streamPromise = this._streamNDJSON(
|
|
352
|
+
streamPromise = this._streamNDJSON(`/v4/system/component/${this.ref}/aggregate`, {
|
|
342
353
|
'Accept': 'application/x-ndjson',
|
|
343
354
|
'Content-Type': 'application/json'
|
|
344
355
|
}, handler, pipeline);
|
|
345
356
|
}
|
|
346
357
|
return streamPromise.then(resolve, reject);
|
|
347
358
|
}
|
|
348
|
-
return this.client.post(
|
|
359
|
+
return this.client.post(`/v4/system/component/${this.ref}/aggregate`, pipeline)
|
|
349
360
|
.then(resolve, reject);
|
|
350
361
|
},
|
|
351
362
|
catch: (reject) => {
|
|
@@ -357,8 +368,18 @@ class Component extends PlatformBaseClient {
|
|
|
357
368
|
async settings() {
|
|
358
369
|
return await this.client.get(`/v3/system/component/settings/${this.ref}`);
|
|
359
370
|
}
|
|
371
|
+
async settingsForVersion(version) {
|
|
372
|
+
return await this.client.get(`/v3/system/component/settings/${this.ref}/${version}`);
|
|
373
|
+
}
|
|
374
|
+
async publish(version, env) {
|
|
375
|
+
return await this.client.post(`/v3/system/component/version/publish`, {
|
|
376
|
+
ref: this.ref,
|
|
377
|
+
version,
|
|
378
|
+
env,
|
|
379
|
+
});
|
|
380
|
+
}
|
|
360
381
|
async saveSettings(settings, version) {
|
|
361
|
-
return await this.client.post(`/
|
|
382
|
+
return await this.client.post(`/v4/system/component/settings/${this.ref}/${version}`, settings);
|
|
362
383
|
}
|
|
363
384
|
async saveTemplatesDist(version, sdkVersion, engine, dist) {
|
|
364
385
|
return await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
|
|
@@ -370,18 +391,127 @@ class Component extends PlatformBaseClient {
|
|
|
370
391
|
});
|
|
371
392
|
}
|
|
372
393
|
async workflow(event, input) {
|
|
373
|
-
return await this.client.post(
|
|
394
|
+
return await this.client.post(`/v3/system/component/${this.ref}/workflow/event`, {
|
|
374
395
|
event,
|
|
375
396
|
input
|
|
376
397
|
});
|
|
377
398
|
}
|
|
378
399
|
async function(name, input) {
|
|
379
|
-
return await this.client.post(
|
|
400
|
+
return await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, {
|
|
380
401
|
data: input
|
|
381
402
|
});
|
|
382
403
|
}
|
|
383
404
|
async revisions(uuid) {
|
|
384
|
-
return await this.client.get(
|
|
405
|
+
return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}/revisions`);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Install a new extension on the component
|
|
409
|
+
*
|
|
410
|
+
* @param extension - The extension definition to install
|
|
411
|
+
* @param version - The component version to install the extension on
|
|
412
|
+
* @returns Updated component settings
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```typescript
|
|
416
|
+
* await component.installExtension({
|
|
417
|
+
* name: 'shipping_tracker',
|
|
418
|
+
* is_active: true,
|
|
419
|
+
* fields: [...],
|
|
420
|
+
* config: { api_key: 'key' }
|
|
421
|
+
* }, '0.1.0')
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
async installExtension(extension, version) {
|
|
425
|
+
return await this.client.post(`/v4/system/component/${this.ref}/${version}/extensions`, extension);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Update an existing extension on the component
|
|
429
|
+
*
|
|
430
|
+
* @param name - The name of the extension to update
|
|
431
|
+
* @param version - The component version
|
|
432
|
+
* @param data - Partial extension data to update
|
|
433
|
+
* @returns Updated component settings
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* ```typescript
|
|
437
|
+
* await component.updateExtension('shipping_tracker', '0.1.0', {
|
|
438
|
+
* is_active: false,
|
|
439
|
+
* config: { api_key: 'new-key' }
|
|
440
|
+
* })
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
async updateExtension(name, version, data) {
|
|
444
|
+
return await this.client.patch(`/v4/system/component/${this.ref}/${version}/extensions/${name}`, data);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Delete an extension from the component
|
|
448
|
+
*
|
|
449
|
+
* @param name - The name of the extension to delete
|
|
450
|
+
* @param version - The component version
|
|
451
|
+
* @returns Updated component settings
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* await component.deleteExtension('shipping_tracker', '0.1.0')
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
async deleteExtension(name, version) {
|
|
459
|
+
return await this.client.delete(`/v4/system/component/${this.ref}/${version}/extensions/${name}`);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Install a new policy on the component
|
|
463
|
+
*
|
|
464
|
+
* @param policy - The policy definition to install
|
|
465
|
+
* @param version - The component version to install the policy on
|
|
466
|
+
* @returns Updated component settings
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```typescript
|
|
470
|
+
* await component.installPolicy({
|
|
471
|
+
* type: 'field_access',
|
|
472
|
+
* name: 'restrict_email',
|
|
473
|
+
* enabled: true,
|
|
474
|
+
* priority: 1,
|
|
475
|
+
* config: { fields: ['email'], actions: ['see'], roles: ['role-uuid'] }
|
|
476
|
+
* }, '0.1.0')
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
async installPolicy(policy, version) {
|
|
480
|
+
return await this.client.post(`/v4/system/component/${this.ref}/${version}/policies`, policy);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Update an existing policy on the component
|
|
484
|
+
*
|
|
485
|
+
* @param name - The name of the policy to update
|
|
486
|
+
* @param version - The component version
|
|
487
|
+
* @param data - Partial policy data to update
|
|
488
|
+
* @returns Updated component settings
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```typescript
|
|
492
|
+
* await component.updatePolicy('restrict_email', '0.1.0', {
|
|
493
|
+
* enabled: false,
|
|
494
|
+
* priority: 2
|
|
495
|
+
* })
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
async updatePolicy(name, version, data) {
|
|
499
|
+
return await this.client.patch(`/v4/system/component/${this.ref}/${version}/policies/${name}`, data);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Delete a policy from the component
|
|
503
|
+
*
|
|
504
|
+
* @param name - The name of the policy to delete
|
|
505
|
+
* @param version - The component version
|
|
506
|
+
* @returns Updated component settings
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* ```typescript
|
|
510
|
+
* await component.deletePolicy('restrict_email', '0.1.0')
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
async deletePolicy(name, version) {
|
|
514
|
+
return await this.client.delete(`/v4/system/component/${this.ref}/${version}/policies/${name}`);
|
|
385
515
|
}
|
|
386
516
|
/**
|
|
387
517
|
* Internal method to handle NDJSON streaming responses
|
|
@@ -474,8 +604,7 @@ class Functions extends PlatformBaseClient {
|
|
|
474
604
|
* Run platform function
|
|
475
605
|
*
|
|
476
606
|
* @param id - Function ID
|
|
477
|
-
* @param
|
|
478
|
-
* @param query - Query parameters
|
|
607
|
+
* @param d - Object containing input data, query parameters, and headers
|
|
479
608
|
* @returns - Function result
|
|
480
609
|
*
|
|
481
610
|
* @example
|
|
@@ -930,7 +1059,7 @@ class Sandbox extends PlatformBaseClient {
|
|
|
930
1059
|
* const result = await platform.sandbox().spark("myFunction", { foo: "bar" })
|
|
931
1060
|
*/
|
|
932
1061
|
async spark(name, data) {
|
|
933
|
-
return await this.client.post(`/
|
|
1062
|
+
return await this.client.post(`/luma/sandbox/v1/spark/exec/${name}`, data);
|
|
934
1063
|
}
|
|
935
1064
|
}
|
|
936
1065
|
|
|
@@ -1001,7 +1130,7 @@ class Project extends PlatformBaseClient {
|
|
|
1001
1130
|
}
|
|
1002
1131
|
/**
|
|
1003
1132
|
* Invite a user to the project
|
|
1004
|
-
* @param
|
|
1133
|
+
* @param emails Array of emails
|
|
1005
1134
|
* @param roles Array of role UUIDs
|
|
1006
1135
|
*/
|
|
1007
1136
|
async invite(emails, roles) {
|
|
@@ -1027,6 +1156,13 @@ class Project extends PlatformBaseClient {
|
|
|
1027
1156
|
async acceptInvite(uuid) {
|
|
1028
1157
|
return await this.client.get(`/v1/project/invite/accept/${uuid}`);
|
|
1029
1158
|
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Revoke an invite
|
|
1161
|
+
* @param uuid Invite UUID
|
|
1162
|
+
*/
|
|
1163
|
+
async revokeInvite(uuid) {
|
|
1164
|
+
return await this.client.delete(`/v1/project/invite/${uuid}`);
|
|
1165
|
+
}
|
|
1030
1166
|
/**
|
|
1031
1167
|
* Register through an invite
|
|
1032
1168
|
* @param uuid Invite UUID
|
|
@@ -1190,8 +1326,8 @@ class Platform extends PlatformBaseClient {
|
|
|
1190
1326
|
forge() {
|
|
1191
1327
|
return (new Forge()).setClient(this.client);
|
|
1192
1328
|
}
|
|
1193
|
-
component(ref
|
|
1194
|
-
return (new Component(ref
|
|
1329
|
+
component(ref) {
|
|
1330
|
+
return (new Component(ref)).setClient(this.client);
|
|
1195
1331
|
}
|
|
1196
1332
|
componentUtils() {
|
|
1197
1333
|
return (new ComponentUtils()).setClient(this.client);
|
|
@@ -1219,31 +1355,6 @@ class Platform extends PlatformBaseClient {
|
|
|
1219
1355
|
}
|
|
1220
1356
|
}
|
|
1221
1357
|
|
|
1222
|
-
class Invoicing extends PlatformBaseClient {
|
|
1223
|
-
async getSalesInvoices(provider, page) {
|
|
1224
|
-
return await this.request("GET", `invoices/${provider}/sales`, {
|
|
1225
|
-
params: {
|
|
1226
|
-
page: page || 1
|
|
1227
|
-
}
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
async acceptPurchaseInvoice(provider, id, comment) {
|
|
1231
|
-
return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
|
|
1232
|
-
data: {
|
|
1233
|
-
accepted: true,
|
|
1234
|
-
comment: comment
|
|
1235
|
-
}
|
|
1236
|
-
});
|
|
1237
|
-
}
|
|
1238
|
-
async request(method, endpoint, params) {
|
|
1239
|
-
return await this.client.request({
|
|
1240
|
-
method: method,
|
|
1241
|
-
url: `/karadjordje/v1/${endpoint}`,
|
|
1242
|
-
...params
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
1358
|
class IntegrationsBaseClient extends BaseClient {
|
|
1248
1359
|
constructor(options) {
|
|
1249
1360
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -1266,7 +1377,7 @@ class IntegrationsBaseClient extends BaseClient {
|
|
|
1266
1377
|
}
|
|
1267
1378
|
}
|
|
1268
1379
|
}
|
|
1269
|
-
|
|
1380
|
+
if (isNode) {
|
|
1270
1381
|
host = (_d = host !== null && host !== void 0 ? host : process.env.INTEGRATION_API) !== null && _d !== void 0 ? _d : null;
|
|
1271
1382
|
env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
|
|
1272
1383
|
token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
|
|
@@ -1599,7 +1710,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1599
1710
|
* - Explicit structure: JSON with `header`, `items`, and `footer` properties
|
|
1600
1711
|
* - Auto-detection: Mixed JSON arrays with metadata objects and summary rows
|
|
1601
1712
|
*
|
|
1602
|
-
* @param lib - Library reference UUID
|
|
1603
1713
|
* @param data - Raw data to convert
|
|
1604
1714
|
* @param params - Conversion parameters including structured data options
|
|
1605
1715
|
* @returns Promise resolving to converted data
|
|
@@ -1692,7 +1802,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1692
1802
|
/**
|
|
1693
1803
|
* Get information about data format and structure
|
|
1694
1804
|
*
|
|
1695
|
-
* @param lib - Library reference UUID
|
|
1696
1805
|
* @param data - Raw data to analyze
|
|
1697
1806
|
* @param params - Analysis parameters
|
|
1698
1807
|
* @returns Promise resolving to data information
|
|
@@ -1733,7 +1842,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1733
1842
|
/**
|
|
1734
1843
|
* Validate data format without performing conversion
|
|
1735
1844
|
*
|
|
1736
|
-
* @param lib - Library reference UUID
|
|
1737
1845
|
* @param data - Raw data to validate
|
|
1738
1846
|
* @param params - Validation parameters
|
|
1739
1847
|
* @returns Promise resolving to validation result
|
|
@@ -1781,7 +1889,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1781
1889
|
* - Regular arrays are converted directly to CSV
|
|
1782
1890
|
* - Structured data (with metadata objects) is automatically detected and formatted
|
|
1783
1891
|
*
|
|
1784
|
-
* @param lib - Library reference UUID
|
|
1785
1892
|
* @param jsonData - JSON data (array of objects or structured data)
|
|
1786
1893
|
* @returns Promise resolving to CSV string
|
|
1787
1894
|
*
|
|
@@ -1832,7 +1939,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1832
1939
|
* Supports both regular JSON arrays and structured data patterns.
|
|
1833
1940
|
* Excel files are always generated with .xlsx extension.
|
|
1834
1941
|
*
|
|
1835
|
-
* @param lib - Library reference UUID
|
|
1836
1942
|
* @param jsonData - JSON data (array of objects or structured data)
|
|
1837
1943
|
* @param options - Optional conversion options
|
|
1838
1944
|
* @returns Promise resolving to Excel file as Blob
|
|
@@ -1891,7 +1997,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1891
1997
|
/**
|
|
1892
1998
|
* Convert CSV data to JSON format
|
|
1893
1999
|
*
|
|
1894
|
-
* @param lib - Library reference UUID
|
|
1895
2000
|
* @param csvData - CSV data string (with headers in first row)
|
|
1896
2001
|
* @returns Promise resolving to JSON array
|
|
1897
2002
|
*
|
|
@@ -1922,7 +2027,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1922
2027
|
/**
|
|
1923
2028
|
* Convert CSV data to Excel (.xlsx) format
|
|
1924
2029
|
*
|
|
1925
|
-
* @param lib - Library reference UUID
|
|
1926
2030
|
* @param csvData - CSV data string (with headers in first row)
|
|
1927
2031
|
* @param options - Optional conversion options
|
|
1928
2032
|
* @returns Promise resolving to Excel file as Blob
|
|
@@ -1960,7 +2064,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1960
2064
|
/**
|
|
1961
2065
|
* Convert Excel (.xlsx) data to JSON format
|
|
1962
2066
|
*
|
|
1963
|
-
* @param lib - Library reference UUID
|
|
1964
2067
|
* @param excelData - Excel file data as Blob or ArrayBuffer
|
|
1965
2068
|
* @param options - Optional conversion options
|
|
1966
2069
|
* @returns Promise resolving to JSON array
|
|
@@ -2000,7 +2103,6 @@ class DMS extends IntegrationsBaseClient {
|
|
|
2000
2103
|
/**
|
|
2001
2104
|
* Convert Excel (.xlsx) data to CSV format
|
|
2002
2105
|
*
|
|
2003
|
-
* @param lib - Library reference UUID
|
|
2004
2106
|
* @param excelData - Excel file data as Blob or ArrayBuffer
|
|
2005
2107
|
* @param options - Optional conversion options
|
|
2006
2108
|
* @returns Promise resolving to CSV string
|
|
@@ -2064,18 +2166,175 @@ class DMS extends IntegrationsBaseClient {
|
|
|
2064
2166
|
}
|
|
2065
2167
|
}
|
|
2066
2168
|
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2169
|
+
/**
|
|
2170
|
+
* SDK client for the Protokol Mail integration.
|
|
2171
|
+
*
|
|
2172
|
+
* Provides methods to send emails, list email logs, resend failed emails,
|
|
2173
|
+
* and manage attachments through the Protokol Mail API.
|
|
2174
|
+
*
|
|
2175
|
+
* @example
|
|
2176
|
+
* ```typescript
|
|
2177
|
+
* import { Mail } from "@ptkl/sdk/beta"
|
|
2178
|
+
*
|
|
2179
|
+
* const mail = new Mail()
|
|
2180
|
+
*
|
|
2181
|
+
* // Send an email
|
|
2182
|
+
* const result = await mail.send({
|
|
2183
|
+
* to: ["user@example.com"],
|
|
2184
|
+
* subject: "Hello",
|
|
2185
|
+
* body: "<h1>Welcome!</h1>"
|
|
2186
|
+
* })
|
|
2187
|
+
*
|
|
2188
|
+
* console.log(result.message_id)
|
|
2189
|
+
* ```
|
|
2190
|
+
*/
|
|
2191
|
+
class Mail extends IntegrationsBaseClient {
|
|
2192
|
+
/**
|
|
2193
|
+
* Send an email. The email is queued for async delivery.
|
|
2194
|
+
*
|
|
2195
|
+
* Supports both JSON body (with base64-encoded attachments) and
|
|
2196
|
+
* multipart/form-data (with file uploads).
|
|
2197
|
+
*
|
|
2198
|
+
* @param input - The email content and recipients
|
|
2199
|
+
* @returns The queued email's message ID and status
|
|
2200
|
+
*
|
|
2201
|
+
* @example
|
|
2202
|
+
* ```typescript
|
|
2203
|
+
* const result = await mail.send({
|
|
2204
|
+
* to: ["recipient@example.com"],
|
|
2205
|
+
* cc: ["cc@example.com"],
|
|
2206
|
+
* subject: "Invoice #123",
|
|
2207
|
+
* body: "<p>Please find your invoice attached.</p>",
|
|
2208
|
+
* reply_to: "billing@company.com",
|
|
2209
|
+
* sender_name: "Billing Department",
|
|
2210
|
+
* attachments: [{
|
|
2211
|
+
* file_name: "invoice.pdf",
|
|
2212
|
+
* mime_type: "application/pdf",
|
|
2213
|
+
* content: "base64encodedcontent...",
|
|
2214
|
+
* size: 12345
|
|
2215
|
+
* }]
|
|
2216
|
+
* })
|
|
2217
|
+
* ```
|
|
2218
|
+
*/
|
|
2219
|
+
async send(input) {
|
|
2220
|
+
const { data } = await this.client.post("/protokol-mail/v1/emails", input);
|
|
2221
|
+
return data;
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* List emails for the current project with optional filtering and pagination.
|
|
2225
|
+
*
|
|
2226
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
2227
|
+
* @returns Paginated list of email log entries
|
|
2228
|
+
*
|
|
2229
|
+
* @example
|
|
2230
|
+
* ```typescript
|
|
2231
|
+
* // List all emails
|
|
2232
|
+
* const emails = await mail.list()
|
|
2233
|
+
*
|
|
2234
|
+
* // List failed emails, page 2
|
|
2235
|
+
* const failed = await mail.list({ status: "failed", page: 2, limit: 10 })
|
|
2236
|
+
* ```
|
|
2237
|
+
*/
|
|
2238
|
+
async list(params) {
|
|
2239
|
+
const { data } = await this.client.get("/protokol-mail/v1/emails", { params });
|
|
2240
|
+
return data;
|
|
2070
2241
|
}
|
|
2242
|
+
/**
|
|
2243
|
+
* Get a single email by its message ID.
|
|
2244
|
+
*
|
|
2245
|
+
* @param messageId - The UUID of the email message
|
|
2246
|
+
* @returns The full email log entry
|
|
2247
|
+
*
|
|
2248
|
+
* @example
|
|
2249
|
+
* ```typescript
|
|
2250
|
+
* const email = await mail.get("550e8400-e29b-41d4-a716-446655440000")
|
|
2251
|
+
* console.log(email.status, email.subject)
|
|
2252
|
+
* ```
|
|
2253
|
+
*/
|
|
2254
|
+
async get(messageId) {
|
|
2255
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}`);
|
|
2256
|
+
return data;
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Resend a previously failed email. Resets the retry counter and
|
|
2260
|
+
* re-queues the email for delivery.
|
|
2261
|
+
*
|
|
2262
|
+
* @param messageId - The UUID of the email to resend
|
|
2263
|
+
* @returns Confirmation with the message ID
|
|
2264
|
+
*
|
|
2265
|
+
* @example
|
|
2266
|
+
* ```typescript
|
|
2267
|
+
* await mail.resend("550e8400-e29b-41d4-a716-446655440000")
|
|
2268
|
+
* ```
|
|
2269
|
+
*/
|
|
2270
|
+
async resend(messageId) {
|
|
2271
|
+
const { data } = await this.client.post(`/protokol-mail/v1/emails/${messageId}/resend`);
|
|
2272
|
+
return data;
|
|
2273
|
+
}
|
|
2274
|
+
/**
|
|
2275
|
+
* List attachment metadata for a specific email.
|
|
2276
|
+
*
|
|
2277
|
+
* @param messageId - The UUID of the email message
|
|
2278
|
+
* @returns Array of attachment metadata entries
|
|
2279
|
+
*
|
|
2280
|
+
* @example
|
|
2281
|
+
* ```typescript
|
|
2282
|
+
* const attachments = await mail.listAttachments("550e8400-e29b-41d4-a716-446655440000")
|
|
2283
|
+
* attachments.forEach(att => console.log(att.file_name, att.file_size))
|
|
2284
|
+
* ```
|
|
2285
|
+
*/
|
|
2286
|
+
async listAttachments(messageId) {
|
|
2287
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}/attachments`);
|
|
2288
|
+
return data;
|
|
2289
|
+
}
|
|
2290
|
+
/**
|
|
2291
|
+
* Download an attachment's binary content.
|
|
2292
|
+
*
|
|
2293
|
+
* @param messageId - The UUID of the email message
|
|
2294
|
+
* @param attachmentId - The UUID of the attachment
|
|
2295
|
+
* @returns The raw binary data as an ArrayBuffer
|
|
2296
|
+
*
|
|
2297
|
+
* @example
|
|
2298
|
+
* ```typescript
|
|
2299
|
+
* const content = await mail.downloadAttachment(
|
|
2300
|
+
* "550e8400-e29b-41d4-a716-446655440000",
|
|
2301
|
+
* "660e8400-e29b-41d4-a716-446655440000"
|
|
2302
|
+
* )
|
|
2303
|
+
* ```
|
|
2304
|
+
*/
|
|
2305
|
+
async downloadAttachment(messageId, attachmentId) {
|
|
2306
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}/attachments/${attachmentId}`, { responseType: "arraybuffer" });
|
|
2307
|
+
return data;
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
class VPFR extends IntegrationsBaseClient {
|
|
2312
|
+
async request(method, endpoint, params) {
|
|
2313
|
+
return await this.client.request({
|
|
2314
|
+
method: method,
|
|
2315
|
+
url: `/v1/karadjordje/vpfr/${endpoint}`,
|
|
2316
|
+
...params
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
class MinFin extends IntegrationsBaseClient {
|
|
2071
2322
|
async getReceiptFromUrl(url, source) {
|
|
2072
|
-
return await this.services("POST", "receipt/
|
|
2323
|
+
return await this.services("POST", "receipt/extract", {
|
|
2073
2324
|
data: {
|
|
2074
2325
|
url,
|
|
2075
2326
|
source
|
|
2076
2327
|
}
|
|
2077
2328
|
});
|
|
2078
2329
|
}
|
|
2330
|
+
async getReceiptFromQrCode(qrCodeImage, source) {
|
|
2331
|
+
return await this.services("POST", "receipt/extract", {
|
|
2332
|
+
data: {
|
|
2333
|
+
qrCodeImage,
|
|
2334
|
+
source
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
}
|
|
2079
2338
|
async getContoList() {
|
|
2080
2339
|
return await this.services("GET", "conto");
|
|
2081
2340
|
}
|
|
@@ -2089,15 +2348,8 @@ class SerbiaUtil extends IntegrationsBaseClient {
|
|
|
2089
2348
|
...params
|
|
2090
2349
|
});
|
|
2091
2350
|
}
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
class VPFR extends IntegrationsBaseClient {
|
|
2095
|
-
async request(method, endpoint, params) {
|
|
2096
|
-
return await this.client.request({
|
|
2097
|
-
method: method,
|
|
2098
|
-
url: `/v1/karadjordje/vpfr/${endpoint}`,
|
|
2099
|
-
...params
|
|
2100
|
-
});
|
|
2351
|
+
vpfr() {
|
|
2352
|
+
return new VPFR().setClient(this.client);
|
|
2101
2353
|
}
|
|
2102
2354
|
}
|
|
2103
2355
|
|
|
@@ -2880,28 +3132,58 @@ class Minimax extends IntegrationsBaseClient {
|
|
|
2880
3132
|
}
|
|
2881
3133
|
}
|
|
2882
3134
|
|
|
2883
|
-
|
|
3135
|
+
class NBS extends IntegrationsBaseClient {
|
|
3136
|
+
async nbsSearch(params) {
|
|
3137
|
+
return await this.services("GET", "nbs/search", { params });
|
|
3138
|
+
}
|
|
3139
|
+
async getNbsIpsQrCode(code, size, lang) {
|
|
3140
|
+
return await this.request("GET", `ipsQr/generate`, {
|
|
3141
|
+
params: {
|
|
3142
|
+
size,
|
|
3143
|
+
lang
|
|
3144
|
+
},
|
|
3145
|
+
data: {
|
|
3146
|
+
...code
|
|
3147
|
+
}
|
|
3148
|
+
});
|
|
3149
|
+
}
|
|
3150
|
+
async validateNbsIpsQrCode(qrCodeString, lang) {
|
|
3151
|
+
return await this.request("GET", `ipsQr/validate`, {
|
|
3152
|
+
params: {
|
|
3153
|
+
lang
|
|
3154
|
+
},
|
|
3155
|
+
data: {
|
|
3156
|
+
QRCodeString: qrCodeString
|
|
3157
|
+
}
|
|
3158
|
+
});
|
|
3159
|
+
}
|
|
3160
|
+
async services(method, endpoint, params) {
|
|
3161
|
+
return this.request(method, `services/${endpoint}`, params);
|
|
3162
|
+
}
|
|
3163
|
+
async request(method, endpoint, params) {
|
|
3164
|
+
return await this.client.request({
|
|
3165
|
+
method: method,
|
|
3166
|
+
url: `/v1/karadjordje/${endpoint}`,
|
|
3167
|
+
...params
|
|
3168
|
+
});
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
|
|
2884
3172
|
class Integrations extends IntegrationsBaseClient {
|
|
2885
3173
|
constructor(options) {
|
|
2886
3174
|
super(options);
|
|
2887
3175
|
this.integrations = {
|
|
2888
|
-
'
|
|
2889
|
-
'protokol-vpfr': new VPFR().setClient(this.client),
|
|
3176
|
+
'serbia-minfin': new MinFin().setClient(this.client),
|
|
2890
3177
|
'protokol-dms': new DMS().setClient(this.client),
|
|
2891
|
-
'
|
|
3178
|
+
'protokol-mail': new Mail().setClient(this.client),
|
|
3179
|
+
'nbs': new NBS().setClient(this.client),
|
|
2892
3180
|
'protokol-payments': new Payments().setClient(this.client),
|
|
2893
3181
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
2894
3182
|
};
|
|
2895
3183
|
}
|
|
2896
|
-
getSerbiaUtilities() {
|
|
2897
|
-
return this.getInterfaceOf('serbia-utilities');
|
|
2898
|
-
}
|
|
2899
3184
|
getDMS() {
|
|
2900
3185
|
return this.getInterfaceOf('protokol-dms');
|
|
2901
3186
|
}
|
|
2902
|
-
getVPFR() {
|
|
2903
|
-
return this.getInterfaceOf('protokol-vpfr');
|
|
2904
|
-
}
|
|
2905
3187
|
getInvoicing() {
|
|
2906
3188
|
return this.getInterfaceOf('protokol-invoicing');
|
|
2907
3189
|
}
|
|
@@ -2911,6 +3193,15 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
2911
3193
|
getMinimax() {
|
|
2912
3194
|
return this.getInterfaceOf('protokol-minimax');
|
|
2913
3195
|
}
|
|
3196
|
+
getMail() {
|
|
3197
|
+
return this.getInterfaceOf('protokol-mail');
|
|
3198
|
+
}
|
|
3199
|
+
getNBS() {
|
|
3200
|
+
return this.getInterfaceOf('nbs');
|
|
3201
|
+
}
|
|
3202
|
+
getSerbiaMinFin() {
|
|
3203
|
+
return this.getInterfaceOf('serbia-minfin');
|
|
3204
|
+
}
|
|
2914
3205
|
async isInstalled(id) {
|
|
2915
3206
|
const { data } = await this.client.get("/v1/integrations");
|
|
2916
3207
|
return data.find((i) => i.id == id) !== undefined;
|
|
@@ -2925,4 +3216,29 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
2925
3216
|
}
|
|
2926
3217
|
}
|
|
2927
3218
|
|
|
2928
|
-
|
|
3219
|
+
class Invoicing extends PlatformBaseClient {
|
|
3220
|
+
async getSalesInvoices(provider, page) {
|
|
3221
|
+
return await this.request("GET", `invoices/${provider}/sales`, {
|
|
3222
|
+
params: {
|
|
3223
|
+
page: page || 1
|
|
3224
|
+
}
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
async acceptPurchaseInvoice(provider, id, comment) {
|
|
3228
|
+
return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
|
|
3229
|
+
data: {
|
|
3230
|
+
accepted: true,
|
|
3231
|
+
comment: comment
|
|
3232
|
+
}
|
|
3233
|
+
});
|
|
3234
|
+
}
|
|
3235
|
+
async request(method, endpoint, params) {
|
|
3236
|
+
return await this.client.request({
|
|
3237
|
+
method: method,
|
|
3238
|
+
url: `/karadjordje/v1/${endpoint}`,
|
|
3239
|
+
...params
|
|
3240
|
+
});
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Mail, NBS, Payments, Platform, Project, Ratchet, Sandbox, MinFin as SerbiaMinFin, System, Thunder, Users, VPFR, Workflow };
|