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