@ptkl/sdk 1.0.2 → 1.1.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 +173 -134
- package/dist/index.0.9.js +42 -4
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +3 -7
- package/dist/v0.10/api/index.d.ts +3 -2
- 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 +4 -3
- package/dist/v0.10/api/platform.d.ts +2 -2
- package/dist/v0.10/api/project.d.ts +5 -0
- package/dist/v0.10/index.cjs.js +173 -134
- package/dist/v0.10/index.esm.js +172 -134
- package/dist/v0.10/types/component.d.ts +2 -2
- 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.10/util/detectEnv.d.ts +2 -1
- package/dist/v0.9/api/integrations/serbiaUtil.d.ts +10 -7
- package/dist/v0.9/api/project.d.ts +5 -0
- package/dist/v0.9/api/roles.d.ts +12 -0
- package/dist/v0.9/index.cjs.js +42 -4
- package/dist/v0.9/index.esm.js +42 -4
- 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
|
@@ -10,11 +10,12 @@ class BaseClient {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
typeof process !== "undefined" &&
|
|
13
|
+
const isNode = typeof process !== "undefined" &&
|
|
14
14
|
process.versions != null &&
|
|
15
15
|
process.versions.node != null;
|
|
16
16
|
const isBrowser = typeof window !== "undefined" &&
|
|
17
17
|
typeof document !== "undefined";
|
|
18
|
+
const isSandbox = typeof window !== "undefined";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Base client for the platform API
|
|
@@ -34,32 +35,32 @@ const isBrowser = typeof window !== "undefined" &&
|
|
|
34
35
|
*/
|
|
35
36
|
class PlatformBaseClient extends BaseClient {
|
|
36
37
|
constructor(options) {
|
|
37
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
38
39
|
let { env = null, token = null, host = null, } = options !== null && options !== void 0 ? options : {};
|
|
39
40
|
let headers = {};
|
|
40
41
|
var project_uuid = null;
|
|
41
|
-
if (isBrowser) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
if (isBrowser || isSandbox) {
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
|
|
45
|
+
host = (_a = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _a !== void 0 ? _a : host;
|
|
46
|
+
// @ts-ignore
|
|
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;
|
|
49
|
+
project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
|
|
50
|
+
if (isBrowser) {
|
|
51
|
+
if (sessionStorage.getItem('protokol_context') == "forge") {
|
|
52
|
+
headers['X-Project-Env'] = (_d = sessionStorage.getItem('forge_app_env')) !== null && _d !== void 0 ? _d : "dev";
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
headers['X-Project-Env'] = (_e = localStorage.getItem('current_env')) !== null && _e !== void 0 ? _e : "dev";
|
|
56
|
+
}
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
host = (
|
|
60
|
-
env = (
|
|
61
|
-
token = (
|
|
62
|
-
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;
|
|
63
64
|
}
|
|
64
65
|
if (token) {
|
|
65
66
|
headers['Authorization'] = `Bearer ${token}`;
|
|
@@ -87,21 +88,9 @@ class PlatformBaseClient extends BaseClient {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
class Component extends PlatformBaseClient {
|
|
90
|
-
constructor(ref = null
|
|
91
|
-
var _a;
|
|
91
|
+
constructor(ref = null) {
|
|
92
92
|
super();
|
|
93
93
|
this.ref = ref;
|
|
94
|
-
this.version = (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : null;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Get the base path for component API calls
|
|
98
|
-
* @private
|
|
99
|
-
*/
|
|
100
|
-
getComponentPath() {
|
|
101
|
-
if (this.version) {
|
|
102
|
-
return `/v3/system/component/${this.ref}/v/${this.version}`;
|
|
103
|
-
}
|
|
104
|
-
return `/v3/system/component/${this.ref}`;
|
|
105
94
|
}
|
|
106
95
|
/**
|
|
107
96
|
* Find method to search for models
|
|
@@ -125,7 +114,6 @@ class Component extends PlatformBaseClient {
|
|
|
125
114
|
* )
|
|
126
115
|
**/
|
|
127
116
|
async find(filters, opts) {
|
|
128
|
-
const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== void 0 ? opts : {};
|
|
129
117
|
let payload = {
|
|
130
118
|
context: filters,
|
|
131
119
|
ref: this.ref,
|
|
@@ -151,7 +139,7 @@ class Component extends PlatformBaseClient {
|
|
|
151
139
|
sortBy: ctx.sortBy,
|
|
152
140
|
sortDesc: sortDesc,
|
|
153
141
|
filter: ctx.filter,
|
|
154
|
-
filterOn: ctx.filterOn
|
|
142
|
+
filterOn: ctx.filterOn,
|
|
155
143
|
limit: limit,
|
|
156
144
|
dateFrom: ctx.dateFrom,
|
|
157
145
|
dateTo: ctx.dateTo,
|
|
@@ -163,20 +151,12 @@ class Component extends PlatformBaseClient {
|
|
|
163
151
|
if (ctx.$aggregate && ctx.$aggregate.length > 0) {
|
|
164
152
|
params.$aggregate = JSON.stringify(ctx.$aggregate);
|
|
165
153
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
params[`_opt_${k}`] = opts ? opts[k] : null;
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
return await this.client.get(`${this.getComponentPath()}/models`, {
|
|
175
|
-
params: params,
|
|
154
|
+
return await this.client.post(`/v4/system/component/${this.ref}/models`, {
|
|
155
|
+
...params,
|
|
156
|
+
options: opts
|
|
157
|
+
}, {
|
|
176
158
|
headers: {
|
|
177
|
-
|
|
178
|
-
'X-Build-Ttl': buildttl,
|
|
179
|
-
'Accept-Language': locale
|
|
159
|
+
"Accept-Language": (opts === null || opts === void 0 ? void 0 : opts.locale) || "en_US",
|
|
180
160
|
}
|
|
181
161
|
});
|
|
182
162
|
}
|
|
@@ -210,7 +190,7 @@ class Component extends PlatformBaseClient {
|
|
|
210
190
|
* @returns (Promise<Model>)
|
|
211
191
|
*/
|
|
212
192
|
async get(uuid) {
|
|
213
|
-
return await this.client.get(
|
|
193
|
+
return await this.client.get(`/v4/system/component/${this.ref}/model/${uuid}`);
|
|
214
194
|
}
|
|
215
195
|
/**
|
|
216
196
|
* Update model by uuid
|
|
@@ -220,7 +200,7 @@ class Component extends PlatformBaseClient {
|
|
|
220
200
|
* @returns
|
|
221
201
|
*/
|
|
222
202
|
async update(uuid, data, options) {
|
|
223
|
-
return await this.client.post(
|
|
203
|
+
return await this.client.post(`/v4/system/component/${this.ref}/model/${uuid}`, {
|
|
224
204
|
data,
|
|
225
205
|
options,
|
|
226
206
|
});
|
|
@@ -233,7 +213,7 @@ class Component extends PlatformBaseClient {
|
|
|
233
213
|
* @returns
|
|
234
214
|
*/
|
|
235
215
|
async updateMany(data, options) {
|
|
236
|
-
return await this.client.patch(
|
|
216
|
+
return await this.client.patch(`/v4/system/component/${this.ref}/models/bulk`, {
|
|
237
217
|
data,
|
|
238
218
|
options
|
|
239
219
|
});
|
|
@@ -246,7 +226,7 @@ class Component extends PlatformBaseClient {
|
|
|
246
226
|
* @returns
|
|
247
227
|
*/
|
|
248
228
|
async createMany(data, options) {
|
|
249
|
-
return await this.client.post(
|
|
229
|
+
return await this.client.post(`/v4/system/component/${this.ref}/models/bulk`, {
|
|
250
230
|
data,
|
|
251
231
|
options
|
|
252
232
|
});
|
|
@@ -259,7 +239,7 @@ class Component extends PlatformBaseClient {
|
|
|
259
239
|
* @returns
|
|
260
240
|
*/
|
|
261
241
|
async modify(filters, data, options) {
|
|
262
|
-
return await this.client.patch(
|
|
242
|
+
return await this.client.patch(`/v4/system/component/${this.ref}/modify/model`, {
|
|
263
243
|
filters,
|
|
264
244
|
data,
|
|
265
245
|
options,
|
|
@@ -274,17 +254,17 @@ class Component extends PlatformBaseClient {
|
|
|
274
254
|
* @returns
|
|
275
255
|
*/
|
|
276
256
|
async concurrentUpdate(uuid, version, data, options) {
|
|
277
|
-
return await this.client.post(
|
|
257
|
+
return await this.client.post(`/v4/system/component/${this.ref}/model/${uuid}`, {
|
|
278
258
|
version: version,
|
|
279
259
|
data,
|
|
280
260
|
options,
|
|
281
261
|
});
|
|
282
262
|
}
|
|
283
263
|
async create(model) {
|
|
284
|
-
return await this.client.post(
|
|
264
|
+
return await this.client.post(`/v4/system/component/${this.ref}/model`, model);
|
|
285
265
|
}
|
|
286
266
|
async delete(uuid) {
|
|
287
|
-
return await this.client.delete(
|
|
267
|
+
return await this.client.delete(`/v4/system/component/${this.ref}/model/${uuid}`);
|
|
288
268
|
}
|
|
289
269
|
/**
|
|
290
270
|
* Execute aggregate pipeline with optional streaming support
|
|
@@ -337,14 +317,14 @@ class Component extends PlatformBaseClient {
|
|
|
337
317
|
onError: onErrorCallback,
|
|
338
318
|
onEnd: onEndCallback
|
|
339
319
|
};
|
|
340
|
-
streamPromise = this._streamNDJSON(
|
|
320
|
+
streamPromise = this._streamNDJSON(`/v4/system/component/${this.ref}/aggregate`, {
|
|
341
321
|
'Accept': 'application/x-ndjson',
|
|
342
322
|
'Content-Type': 'application/json'
|
|
343
323
|
}, handler, pipeline);
|
|
344
324
|
}
|
|
345
325
|
return streamPromise.then(resolve, reject);
|
|
346
326
|
}
|
|
347
|
-
return this.client.post(
|
|
327
|
+
return this.client.post(`/v4/system/component/${this.ref}/aggregate`, pipeline)
|
|
348
328
|
.then(resolve, reject);
|
|
349
329
|
},
|
|
350
330
|
catch: (reject) => {
|
|
@@ -356,8 +336,18 @@ class Component extends PlatformBaseClient {
|
|
|
356
336
|
async settings() {
|
|
357
337
|
return await this.client.get(`/v3/system/component/settings/${this.ref}`);
|
|
358
338
|
}
|
|
339
|
+
async settingsForVersion(version) {
|
|
340
|
+
return await this.client.get(`/v3/system/component/settings/${this.ref}/${version}`);
|
|
341
|
+
}
|
|
342
|
+
async publish(version, env) {
|
|
343
|
+
return await this.client.post(`/v3/system/component/version/publish`, {
|
|
344
|
+
ref: this.ref,
|
|
345
|
+
version,
|
|
346
|
+
env,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
359
349
|
async saveSettings(settings, version) {
|
|
360
|
-
return await this.client.post(`/
|
|
350
|
+
return await this.client.post(`/v4/system/component/settings/${this.ref}/${version}`, settings);
|
|
361
351
|
}
|
|
362
352
|
async saveTemplatesDist(version, sdkVersion, engine, dist) {
|
|
363
353
|
return await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
|
|
@@ -369,18 +359,18 @@ class Component extends PlatformBaseClient {
|
|
|
369
359
|
});
|
|
370
360
|
}
|
|
371
361
|
async workflow(event, input) {
|
|
372
|
-
return await this.client.post(
|
|
362
|
+
return await this.client.post(`/v3/system/component/${this.ref}/workflow/event`, {
|
|
373
363
|
event,
|
|
374
364
|
input
|
|
375
365
|
});
|
|
376
366
|
}
|
|
377
367
|
async function(name, input) {
|
|
378
|
-
return await this.client.post(
|
|
368
|
+
return await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, {
|
|
379
369
|
data: input
|
|
380
370
|
});
|
|
381
371
|
}
|
|
382
372
|
async revisions(uuid) {
|
|
383
|
-
return await this.client.get(
|
|
373
|
+
return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}/revisions`);
|
|
384
374
|
}
|
|
385
375
|
/**
|
|
386
376
|
* Internal method to handle NDJSON streaming responses
|
|
@@ -929,7 +919,7 @@ class Sandbox extends PlatformBaseClient {
|
|
|
929
919
|
* const result = await platform.sandbox().spark("myFunction", { foo: "bar" })
|
|
930
920
|
*/
|
|
931
921
|
async spark(name, data) {
|
|
932
|
-
return await this.client.post(`/
|
|
922
|
+
return await this.client.post(`/luma/sandbox/v1/spark/exec/${name}`, data);
|
|
933
923
|
}
|
|
934
924
|
}
|
|
935
925
|
|
|
@@ -1026,6 +1016,13 @@ class Project extends PlatformBaseClient {
|
|
|
1026
1016
|
async acceptInvite(uuid) {
|
|
1027
1017
|
return await this.client.get(`/v1/project/invite/accept/${uuid}`);
|
|
1028
1018
|
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Revoke an invite
|
|
1021
|
+
* @param uuid Invite UUID
|
|
1022
|
+
*/
|
|
1023
|
+
async revokeInvite(uuid) {
|
|
1024
|
+
return await this.client.delete(`/v1/project/invite/${uuid}`);
|
|
1025
|
+
}
|
|
1029
1026
|
/**
|
|
1030
1027
|
* Register through an invite
|
|
1031
1028
|
* @param uuid Invite UUID
|
|
@@ -1189,8 +1186,8 @@ class Platform extends PlatformBaseClient {
|
|
|
1189
1186
|
forge() {
|
|
1190
1187
|
return (new Forge()).setClient(this.client);
|
|
1191
1188
|
}
|
|
1192
|
-
component(ref
|
|
1193
|
-
return (new Component(ref
|
|
1189
|
+
component(ref) {
|
|
1190
|
+
return (new Component(ref)).setClient(this.client);
|
|
1194
1191
|
}
|
|
1195
1192
|
componentUtils() {
|
|
1196
1193
|
return (new ComponentUtils()).setClient(this.client);
|
|
@@ -1218,57 +1215,30 @@ class Platform extends PlatformBaseClient {
|
|
|
1218
1215
|
}
|
|
1219
1216
|
}
|
|
1220
1217
|
|
|
1221
|
-
class Invoicing extends PlatformBaseClient {
|
|
1222
|
-
async getSalesInvoices(provider, page) {
|
|
1223
|
-
return await this.request("GET", `invoices/${provider}/sales`, {
|
|
1224
|
-
params: {
|
|
1225
|
-
page: page || 1
|
|
1226
|
-
}
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1229
|
-
async acceptPurchaseInvoice(provider, id, comment) {
|
|
1230
|
-
return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
|
|
1231
|
-
data: {
|
|
1232
|
-
accepted: true,
|
|
1233
|
-
comment: comment
|
|
1234
|
-
}
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
async request(method, endpoint, params) {
|
|
1238
|
-
return await this.client.request({
|
|
1239
|
-
method: method,
|
|
1240
|
-
url: `/karadjordje/v1/${endpoint}`,
|
|
1241
|
-
...params
|
|
1242
|
-
});
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
1218
|
class IntegrationsBaseClient extends BaseClient {
|
|
1247
1219
|
constructor(options) {
|
|
1248
1220
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1249
1221
|
let { env = null, token = null, host = null, } = options !== null && options !== void 0 ? options : {};
|
|
1250
1222
|
let headers = {};
|
|
1251
1223
|
var project_uuid = null;
|
|
1252
|
-
if (isBrowser) {
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
if (
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
|
|
1267
|
-
project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
|
|
1224
|
+
if (isBrowser || isSandbox) {
|
|
1225
|
+
// @ts-ignore
|
|
1226
|
+
const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
|
|
1227
|
+
host = (_a = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.INTEGRATION_API) !== null && _a !== void 0 ? _a : host;
|
|
1228
|
+
// @ts-ignore
|
|
1229
|
+
env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
|
|
1230
|
+
token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
|
|
1231
|
+
if (isBrowser) {
|
|
1232
|
+
if (sessionStorage.getItem('protokol_context') == "forge") {
|
|
1233
|
+
headers['X-Project-Env'] = (_b = sessionStorage.getItem('forge_app_env')) !== null && _b !== void 0 ? _b : "dev";
|
|
1234
|
+
}
|
|
1235
|
+
else {
|
|
1236
|
+
headers['X-Project-Env'] = (_c = localStorage.getItem('current_env')) !== null && _c !== void 0 ? _c : "dev";
|
|
1237
|
+
}
|
|
1268
1238
|
}
|
|
1269
1239
|
}
|
|
1270
|
-
|
|
1271
|
-
host = (_d = host !== null && host !== void 0 ? host : process.env.
|
|
1240
|
+
if (isNode) {
|
|
1241
|
+
host = (_d = host !== null && host !== void 0 ? host : process.env.INTEGRATION_API) !== null && _d !== void 0 ? _d : null;
|
|
1272
1242
|
env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
|
|
1273
1243
|
token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
|
|
1274
1244
|
project_uuid = (_g = process.env.PROJECT_UUID) !== null && _g !== void 0 ? _g : null;
|
|
@@ -2065,18 +2035,33 @@ class DMS extends IntegrationsBaseClient {
|
|
|
2065
2035
|
}
|
|
2066
2036
|
}
|
|
2067
2037
|
|
|
2068
|
-
class
|
|
2069
|
-
async
|
|
2070
|
-
return await this.
|
|
2038
|
+
class VPFR extends IntegrationsBaseClient {
|
|
2039
|
+
async request(method, endpoint, params) {
|
|
2040
|
+
return await this.client.request({
|
|
2041
|
+
method: method,
|
|
2042
|
+
url: `/v1/karadjordje/vpfr/${endpoint}`,
|
|
2043
|
+
...params
|
|
2044
|
+
});
|
|
2071
2045
|
}
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
class MinFin extends IntegrationsBaseClient {
|
|
2072
2049
|
async getReceiptFromUrl(url, source) {
|
|
2073
|
-
return await this.services("POST", "receipt/
|
|
2050
|
+
return await this.services("POST", "receipt/extract", {
|
|
2074
2051
|
data: {
|
|
2075
2052
|
url,
|
|
2076
2053
|
source
|
|
2077
2054
|
}
|
|
2078
2055
|
});
|
|
2079
2056
|
}
|
|
2057
|
+
async getReceiptFromQrCode(qrCodeImage, source) {
|
|
2058
|
+
return await this.services("POST", "receipt/extract", {
|
|
2059
|
+
data: {
|
|
2060
|
+
qrCodeImage,
|
|
2061
|
+
source
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2080
2065
|
async getContoList() {
|
|
2081
2066
|
return await this.services("GET", "conto");
|
|
2082
2067
|
}
|
|
@@ -2090,15 +2075,8 @@ class SerbiaUtil extends IntegrationsBaseClient {
|
|
|
2090
2075
|
...params
|
|
2091
2076
|
});
|
|
2092
2077
|
}
|
|
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
|
-
});
|
|
2078
|
+
vpfr() {
|
|
2079
|
+
return new VPFR().setClient(this.client);
|
|
2102
2080
|
}
|
|
2103
2081
|
}
|
|
2104
2082
|
|
|
@@ -2881,28 +2859,57 @@ class Minimax extends IntegrationsBaseClient {
|
|
|
2881
2859
|
}
|
|
2882
2860
|
}
|
|
2883
2861
|
|
|
2884
|
-
|
|
2862
|
+
class NBS extends IntegrationsBaseClient {
|
|
2863
|
+
async nbsSearch(params) {
|
|
2864
|
+
return await this.services("GET", "nbs/search", { params });
|
|
2865
|
+
}
|
|
2866
|
+
async getNbsIpsQrCode(code, size, lang) {
|
|
2867
|
+
return await this.request("GET", `ipsQr/generate`, {
|
|
2868
|
+
params: {
|
|
2869
|
+
size,
|
|
2870
|
+
lang
|
|
2871
|
+
},
|
|
2872
|
+
data: {
|
|
2873
|
+
...code
|
|
2874
|
+
}
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
async validateNbsIpsQrCode(qrCodeString, lang) {
|
|
2878
|
+
return await this.request("GET", `ipsQr/validate`, {
|
|
2879
|
+
params: {
|
|
2880
|
+
lang
|
|
2881
|
+
},
|
|
2882
|
+
data: {
|
|
2883
|
+
QRCodeString: qrCodeString
|
|
2884
|
+
}
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
async services(method, endpoint, params) {
|
|
2888
|
+
return this.request(method, `services/${endpoint}`, params);
|
|
2889
|
+
}
|
|
2890
|
+
async request(method, endpoint, params) {
|
|
2891
|
+
return await this.client.request({
|
|
2892
|
+
method: method,
|
|
2893
|
+
url: `/v1/karadjordje/${endpoint}`,
|
|
2894
|
+
...params
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2885
2899
|
class Integrations extends IntegrationsBaseClient {
|
|
2886
2900
|
constructor(options) {
|
|
2887
2901
|
super(options);
|
|
2888
2902
|
this.integrations = {
|
|
2889
|
-
'
|
|
2890
|
-
'protokol-vpfr': new VPFR().setClient(this.client),
|
|
2903
|
+
'serbia-minfin': new MinFin().setClient(this.client),
|
|
2891
2904
|
'protokol-dms': new DMS().setClient(this.client),
|
|
2892
|
-
'
|
|
2905
|
+
'nbs': new NBS().setClient(this.client),
|
|
2893
2906
|
'protokol-payments': new Payments().setClient(this.client),
|
|
2894
2907
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
2895
2908
|
};
|
|
2896
2909
|
}
|
|
2897
|
-
getSerbiaUtilities() {
|
|
2898
|
-
return this.getInterfaceOf('serbia-utilities');
|
|
2899
|
-
}
|
|
2900
2910
|
getDMS() {
|
|
2901
2911
|
return this.getInterfaceOf('protokol-dms');
|
|
2902
2912
|
}
|
|
2903
|
-
getVPFR() {
|
|
2904
|
-
return this.getInterfaceOf('protokol-vpfr');
|
|
2905
|
-
}
|
|
2906
2913
|
getInvoicing() {
|
|
2907
2914
|
return this.getInterfaceOf('protokol-invoicing');
|
|
2908
2915
|
}
|
|
@@ -2912,6 +2919,12 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
2912
2919
|
getMinimax() {
|
|
2913
2920
|
return this.getInterfaceOf('protokol-minimax');
|
|
2914
2921
|
}
|
|
2922
|
+
getNBS() {
|
|
2923
|
+
return this.getInterfaceOf('nbs');
|
|
2924
|
+
}
|
|
2925
|
+
getSerbiaMinFin() {
|
|
2926
|
+
return this.getInterfaceOf('serbia-minfin');
|
|
2927
|
+
}
|
|
2915
2928
|
async isInstalled(id) {
|
|
2916
2929
|
const { data } = await this.client.get("/v1/integrations");
|
|
2917
2930
|
return data.find((i) => i.id == id) !== undefined;
|
|
@@ -2926,4 +2939,29 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
2926
2939
|
}
|
|
2927
2940
|
}
|
|
2928
2941
|
|
|
2929
|
-
|
|
2942
|
+
class Invoicing extends PlatformBaseClient {
|
|
2943
|
+
async getSalesInvoices(provider, page) {
|
|
2944
|
+
return await this.request("GET", `invoices/${provider}/sales`, {
|
|
2945
|
+
params: {
|
|
2946
|
+
page: page || 1
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2949
|
+
}
|
|
2950
|
+
async acceptPurchaseInvoice(provider, id, comment) {
|
|
2951
|
+
return await this.request('POST', `invoices/${provider}/purchase/acceptReject/${id}`, {
|
|
2952
|
+
data: {
|
|
2953
|
+
accepted: true,
|
|
2954
|
+
comment: comment
|
|
2955
|
+
}
|
|
2956
|
+
});
|
|
2957
|
+
}
|
|
2958
|
+
async request(method, endpoint, params) {
|
|
2959
|
+
return await this.client.request({
|
|
2960
|
+
method: method,
|
|
2961
|
+
url: `/karadjordje/v1/${endpoint}`,
|
|
2962
|
+
...params
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Forge, Functions, Integrations as Integration, Integrations, Invoicing, NBS, Payments, Platform, Project, Ratchet, Sandbox, MinFin as SerbiaMinFin, System, Thunder, Users, VPFR, Workflow };
|