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