@ptkl/sdk 1.0.3 → 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.
@@ -36,7 +36,7 @@ var ProtokolSDK010 = (function (exports, axios) {
36
36
  */
37
37
  class PlatformBaseClient extends BaseClient {
38
38
  constructor(options) {
39
- var _a, _b, _c, _d, _e, _f, _g;
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
40
40
  let { env = null, token = null, host = null, } = options !== null && options !== void 0 ? options : {};
41
41
  let headers = {};
42
42
  var project_uuid = null;
@@ -45,23 +45,23 @@ var ProtokolSDK010 = (function (exports, axios) {
45
45
  const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
46
46
  host = (_a = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _a !== void 0 ? _a : host;
47
47
  // @ts-ignore
48
- env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
49
- token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
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
50
  project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
51
51
  if (isBrowser) {
52
52
  if (sessionStorage.getItem('protokol_context') == "forge") {
53
- headers['X-Project-Env'] = (_b = sessionStorage.getItem('forge_app_env')) !== null && _b !== void 0 ? _b : "dev";
53
+ headers['X-Project-Env'] = (_d = sessionStorage.getItem('forge_app_env')) !== null && _d !== void 0 ? _d : "dev";
54
54
  }
55
55
  else {
56
- headers['X-Project-Env'] = (_c = localStorage.getItem('current_env')) !== null && _c !== void 0 ? _c : "dev";
56
+ headers['X-Project-Env'] = (_e = localStorage.getItem('current_env')) !== null && _e !== void 0 ? _e : "dev";
57
57
  }
58
58
  }
59
59
  }
60
- else if (isNode) {
61
- host = (_d = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _d !== void 0 ? _d : null;
62
- env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
63
- token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
64
- project_uuid = (_g = process.env.PROJECT_UUID) !== null && _g !== void 0 ? _g : null;
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;
65
65
  }
66
66
  if (token) {
67
67
  headers['Authorization'] = `Bearer ${token}`;
@@ -89,21 +89,9 @@ var ProtokolSDK010 = (function (exports, axios) {
89
89
  }
90
90
 
91
91
  class Component extends PlatformBaseClient {
92
- constructor(ref = null, options) {
93
- var _a;
92
+ constructor(ref = null) {
94
93
  super();
95
94
  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
95
  }
108
96
  /**
109
97
  * Find method to search for models
@@ -127,7 +115,6 @@ var ProtokolSDK010 = (function (exports, axios) {
127
115
  * )
128
116
  **/
129
117
  async find(filters, opts) {
130
- const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== void 0 ? opts : {};
131
118
  let payload = {
132
119
  context: filters,
133
120
  ref: this.ref,
@@ -153,7 +140,7 @@ var ProtokolSDK010 = (function (exports, axios) {
153
140
  sortBy: ctx.sortBy,
154
141
  sortDesc: sortDesc,
155
142
  filter: ctx.filter,
156
- filterOn: ctx.filterOn.join(","),
143
+ filterOn: ctx.filterOn,
157
144
  limit: limit,
158
145
  dateFrom: ctx.dateFrom,
159
146
  dateTo: ctx.dateTo,
@@ -165,20 +152,12 @@ var ProtokolSDK010 = (function (exports, axios) {
165
152
  if (ctx.$aggregate && ctx.$aggregate.length > 0) {
166
153
  params.$aggregate = JSON.stringify(ctx.$aggregate);
167
154
  }
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,
155
+ return await this.client.post(`/v4/system/component/${this.ref}/models`, {
156
+ ...params,
157
+ options: opts
158
+ }, {
178
159
  headers: {
179
- 'X-Cache': cache,
180
- 'X-Build-Ttl': buildttl,
181
- 'Accept-Language': locale
160
+ "Accept-Language": (opts === null || opts === void 0 ? void 0 : opts.locale) || "en_US",
182
161
  }
183
162
  });
184
163
  }
@@ -212,7 +191,7 @@ var ProtokolSDK010 = (function (exports, axios) {
212
191
  * @returns (Promise<Model>)
213
192
  */
214
193
  async get(uuid) {
215
- return await this.client.get(`${this.getComponentPath()}/model/${uuid}`);
194
+ return await this.client.get(`/v4/system/component/${this.ref}/model/${uuid}`);
216
195
  }
217
196
  /**
218
197
  * Update model by uuid
@@ -222,7 +201,7 @@ var ProtokolSDK010 = (function (exports, axios) {
222
201
  * @returns
223
202
  */
224
203
  async update(uuid, data, options) {
225
- return await this.client.post(`${this.getComponentPath()}/model/${uuid}`, {
204
+ return await this.client.post(`/v4/system/component/${this.ref}/model/${uuid}`, {
226
205
  data,
227
206
  options,
228
207
  });
@@ -235,7 +214,7 @@ var ProtokolSDK010 = (function (exports, axios) {
235
214
  * @returns
236
215
  */
237
216
  async updateMany(data, options) {
238
- return await this.client.patch(`${this.getComponentPath()}/models/bulk`, {
217
+ return await this.client.patch(`/v4/system/component/${this.ref}/models/bulk`, {
239
218
  data,
240
219
  options
241
220
  });
@@ -248,7 +227,7 @@ var ProtokolSDK010 = (function (exports, axios) {
248
227
  * @returns
249
228
  */
250
229
  async createMany(data, options) {
251
- return await this.client.post(`${this.getComponentPath()}/models/bulk`, {
230
+ return await this.client.post(`/v4/system/component/${this.ref}/models/bulk`, {
252
231
  data,
253
232
  options
254
233
  });
@@ -261,7 +240,7 @@ var ProtokolSDK010 = (function (exports, axios) {
261
240
  * @returns
262
241
  */
263
242
  async modify(filters, data, options) {
264
- return await this.client.patch(`${this.getComponentPath()}/modify/model`, {
243
+ return await this.client.patch(`/v4/system/component/${this.ref}/modify/model`, {
265
244
  filters,
266
245
  data,
267
246
  options,
@@ -276,17 +255,17 @@ var ProtokolSDK010 = (function (exports, axios) {
276
255
  * @returns
277
256
  */
278
257
  async concurrentUpdate(uuid, version, data, options) {
279
- return await this.client.post(`${this.getComponentPath()}/model/${uuid}`, {
258
+ return await this.client.post(`/v4/system/component/${this.ref}/model/${uuid}`, {
280
259
  version: version,
281
260
  data,
282
261
  options,
283
262
  });
284
263
  }
285
264
  async create(model) {
286
- return await this.client.post(`${this.getComponentPath()}/model`, model);
265
+ return await this.client.post(`/v4/system/component/${this.ref}/model`, model);
287
266
  }
288
267
  async delete(uuid) {
289
- return await this.client.delete(`${this.getComponentPath()}/model/${uuid}`);
268
+ return await this.client.delete(`/v4/system/component/${this.ref}/model/${uuid}`);
290
269
  }
291
270
  /**
292
271
  * Execute aggregate pipeline with optional streaming support
@@ -339,14 +318,14 @@ var ProtokolSDK010 = (function (exports, axios) {
339
318
  onError: onErrorCallback,
340
319
  onEnd: onEndCallback
341
320
  };
342
- streamPromise = this._streamNDJSON(`${this.getComponentPath()}/aggregate`, {
321
+ streamPromise = this._streamNDJSON(`/v4/system/component/${this.ref}/aggregate`, {
343
322
  'Accept': 'application/x-ndjson',
344
323
  'Content-Type': 'application/json'
345
324
  }, handler, pipeline);
346
325
  }
347
326
  return streamPromise.then(resolve, reject);
348
327
  }
349
- return this.client.post(`${this.getComponentPath()}/aggregate`, pipeline)
328
+ return this.client.post(`/v4/system/component/${this.ref}/aggregate`, pipeline)
350
329
  .then(resolve, reject);
351
330
  },
352
331
  catch: (reject) => {
@@ -358,8 +337,18 @@ var ProtokolSDK010 = (function (exports, axios) {
358
337
  async settings() {
359
338
  return await this.client.get(`/v3/system/component/settings/${this.ref}`);
360
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
+ }
361
350
  async saveSettings(settings, version) {
362
- return await this.client.post(`/v3/system/component/settings/${this.ref}/${version}`, settings);
351
+ return await this.client.post(`/v4/system/component/settings/${this.ref}/${version}`, settings);
363
352
  }
364
353
  async saveTemplatesDist(version, sdkVersion, engine, dist) {
365
354
  return await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
@@ -371,18 +360,18 @@ var ProtokolSDK010 = (function (exports, axios) {
371
360
  });
372
361
  }
373
362
  async workflow(event, input) {
374
- return await this.client.post(`${this.getComponentPath()}/workflow/event`, {
363
+ return await this.client.post(`/v3/system/component/${this.ref}/workflow/event`, {
375
364
  event,
376
365
  input
377
366
  });
378
367
  }
379
368
  async function(name, input) {
380
- return await this.client.post(`${this.getComponentPath()}/function/${name}`, {
369
+ return await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, {
381
370
  data: input
382
371
  });
383
372
  }
384
373
  async revisions(uuid) {
385
- return await this.client.get(`${this.getComponentPath()}/model/${uuid}/revisions`);
374
+ return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}/revisions`);
386
375
  }
387
376
  /**
388
377
  * Internal method to handle NDJSON streaming responses
@@ -931,7 +920,7 @@ var ProtokolSDK010 = (function (exports, axios) {
931
920
  * const result = await platform.sandbox().spark("myFunction", { foo: "bar" })
932
921
  */
933
922
  async spark(name, data) {
934
- return await this.client.post(`/v1/project/sandbox/spark/exec/${name}`, data);
923
+ return await this.client.post(`/luma/sandbox/v1/spark/exec/${name}`, data);
935
924
  }
936
925
  }
937
926
 
@@ -1028,6 +1017,13 @@ var ProtokolSDK010 = (function (exports, axios) {
1028
1017
  async acceptInvite(uuid) {
1029
1018
  return await this.client.get(`/v1/project/invite/accept/${uuid}`);
1030
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
+ }
1031
1027
  /**
1032
1028
  * Register through an invite
1033
1029
  * @param uuid Invite UUID
@@ -1191,8 +1187,8 @@ var ProtokolSDK010 = (function (exports, axios) {
1191
1187
  forge() {
1192
1188
  return (new Forge()).setClient(this.client);
1193
1189
  }
1194
- component(ref, options) {
1195
- return (new Component(ref, options)).setClient(this.client);
1190
+ component(ref) {
1191
+ return (new Component(ref)).setClient(this.client);
1196
1192
  }
1197
1193
  componentUtils() {
1198
1194
  return (new ComponentUtils()).setClient(this.client);
@@ -1220,31 +1216,6 @@ var ProtokolSDK010 = (function (exports, axios) {
1220
1216
  }
1221
1217
  }
1222
1218
 
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
1219
  class IntegrationsBaseClient extends BaseClient {
1249
1220
  constructor(options) {
1250
1221
  var _a, _b, _c, _d, _e, _f, _g;
@@ -1267,7 +1238,7 @@ var ProtokolSDK010 = (function (exports, axios) {
1267
1238
  }
1268
1239
  }
1269
1240
  }
1270
- else if (isNode) {
1241
+ if (isNode) {
1271
1242
  host = (_d = host !== null && host !== void 0 ? host : process.env.INTEGRATION_API) !== null && _d !== void 0 ? _d : null;
1272
1243
  env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
1273
1244
  token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
@@ -2065,18 +2036,33 @@ var ProtokolSDK010 = (function (exports, axios) {
2065
2036
  }
2066
2037
  }
2067
2038
 
2068
- class SerbiaUtil extends IntegrationsBaseClient {
2069
- async nbsSearch(params) {
2070
- return await this.services("GET", "nbs/search", { params });
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
+ });
2071
2046
  }
2047
+ }
2048
+
2049
+ class MinFin extends IntegrationsBaseClient {
2072
2050
  async getReceiptFromUrl(url, source) {
2073
- return await this.services("POST", "receipt/crawl", {
2051
+ return await this.services("POST", "receipt/extract", {
2074
2052
  data: {
2075
2053
  url,
2076
2054
  source
2077
2055
  }
2078
2056
  });
2079
2057
  }
2058
+ async getReceiptFromQrCode(qrCodeImage, source) {
2059
+ return await this.services("POST", "receipt/extract", {
2060
+ data: {
2061
+ qrCodeImage,
2062
+ source
2063
+ }
2064
+ });
2065
+ }
2080
2066
  async getContoList() {
2081
2067
  return await this.services("GET", "conto");
2082
2068
  }
@@ -2090,15 +2076,8 @@ var ProtokolSDK010 = (function (exports, axios) {
2090
2076
  ...params
2091
2077
  });
2092
2078
  }
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
- });
2079
+ vpfr() {
2080
+ return new VPFR().setClient(this.client);
2102
2081
  }
2103
2082
  }
2104
2083
 
@@ -2881,28 +2860,57 @@ var ProtokolSDK010 = (function (exports, axios) {
2881
2860
  }
2882
2861
  }
2883
2862
 
2884
- // import integrations
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
+
2885
2900
  class Integrations extends IntegrationsBaseClient {
2886
2901
  constructor(options) {
2887
2902
  super(options);
2888
2903
  this.integrations = {
2889
- 'protokol-invoicing': new Invoicing().setClient(this.client),
2890
- 'protokol-vpfr': new VPFR().setClient(this.client),
2904
+ 'serbia-minfin': new MinFin().setClient(this.client),
2891
2905
  'protokol-dms': new DMS().setClient(this.client),
2892
- 'serbia-utilities': new SerbiaUtil().setClient(this.client),
2906
+ 'nbs': new NBS().setClient(this.client),
2893
2907
  'protokol-payments': new Payments().setClient(this.client),
2894
2908
  'protokol-minimax': new Minimax().setClient(this.client),
2895
2909
  };
2896
2910
  }
2897
- getSerbiaUtilities() {
2898
- return this.getInterfaceOf('serbia-utilities');
2899
- }
2900
2911
  getDMS() {
2901
2912
  return this.getInterfaceOf('protokol-dms');
2902
2913
  }
2903
- getVPFR() {
2904
- return this.getInterfaceOf('protokol-vpfr');
2905
- }
2906
2914
  getInvoicing() {
2907
2915
  return this.getInterfaceOf('protokol-invoicing');
2908
2916
  }
@@ -2912,6 +2920,12 @@ var ProtokolSDK010 = (function (exports, axios) {
2912
2920
  getMinimax() {
2913
2921
  return this.getInterfaceOf('protokol-minimax');
2914
2922
  }
2923
+ getNBS() {
2924
+ return this.getInterfaceOf('nbs');
2925
+ }
2926
+ getSerbiaMinFin() {
2927
+ return this.getInterfaceOf('serbia-minfin');
2928
+ }
2915
2929
  async isInstalled(id) {
2916
2930
  const { data } = await this.client.get("/v1/integrations");
2917
2931
  return data.find((i) => i.id == id) !== undefined;
@@ -2926,6 +2940,31 @@ var ProtokolSDK010 = (function (exports, axios) {
2926
2940
  }
2927
2941
  }
2928
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
+
2929
2968
  exports.APIUser = APIUser;
2930
2969
  exports.Apps = Apps;
2931
2970
  exports.Component = Component;
@@ -2937,12 +2976,13 @@ var ProtokolSDK010 = (function (exports, axios) {
2937
2976
  exports.Integration = Integrations;
2938
2977
  exports.Integrations = Integrations;
2939
2978
  exports.Invoicing = Invoicing;
2979
+ exports.NBS = NBS;
2940
2980
  exports.Payments = Payments;
2941
2981
  exports.Platform = Platform;
2942
2982
  exports.Project = Project;
2943
2983
  exports.Ratchet = Ratchet;
2944
2984
  exports.Sandbox = Sandbox;
2945
- exports.SerbiaUtil = SerbiaUtil;
2985
+ exports.SerbiaMinFin = MinFin;
2946
2986
  exports.System = System;
2947
2987
  exports.Thunder = Thunder;
2948
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
- else if (isNode) {
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
- else if (isNode) {
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", { params });
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/crawl", {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",
@@ -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
- private version;
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>>;
@@ -18,5 +18,6 @@ export { default as Integration } from './integrations';
18
18
  export { default as Payments } from './integrations/payments';
19
19
  export { default as Invoicing } from './integrations/invoicing';
20
20
  export { default as DMS } from './integrations/dms';
21
- export { default as SerbiaUtil } from './integrations/serbiaUtil';
22
- export { default as VPFR } from './integrations/vpfr';
21
+ export { default as SerbiaMinFin } from './integrations/serbia/minfin';
22
+ export { default as NBS } from './integrations/serbia/nbs';
23
+ export { default as VPFR } from './integrations/serbia/minfin/vpfr';
@@ -0,0 +1,10 @@
1
+ import IntegrationsBaseClient from "../../../integrationsBaseClient";
2
+ import VPFR from "./vpfr";
3
+ export default class MinFin extends IntegrationsBaseClient {
4
+ getReceiptFromUrl(url: string, source: string): Promise<import("axios").AxiosResponse<any, any>>;
5
+ getReceiptFromQrCode(qrCodeImage: string, source: string): Promise<import("axios").AxiosResponse<any, any>>;
6
+ getContoList(): Promise<import("axios").AxiosResponse<any, any>>;
7
+ private services;
8
+ private request;
9
+ vpfr(): VPFR;
10
+ }
@@ -0,0 +1,4 @@
1
+ import IntegrationsBaseClient from "../../../integrationsBaseClient";
2
+ export default class VPFR extends IntegrationsBaseClient {
3
+ request(method: string, endpoint: string, params?: any): Promise<import("axios").AxiosResponse<any, any>>;
4
+ }
@@ -0,0 +1,10 @@
1
+ import IntegrationsBaseClient from "../../../integrationsBaseClient";
2
+ import { AxiosResponse } from "axios";
3
+ import { NbsIpsQrCode, IPSQrCodeResponse, NBSSearchParams } from "../../../../types/integrations/serbiaUtils";
4
+ export default class NBS extends IntegrationsBaseClient {
5
+ nbsSearch(params: NBSSearchParams): Promise<AxiosResponse<any, any>>;
6
+ getNbsIpsQrCode(code: NbsIpsQrCode, size: number, lang?: string): Promise<AxiosResponse<IPSQrCodeResponse>>;
7
+ validateNbsIpsQrCode(qrCodeString: string, lang?: string): Promise<AxiosResponse<IPSQrCodeResponse>>;
8
+ services(method: string, endpoint: string, params?: any): Promise<AxiosResponse<any, any>>;
9
+ request(method: string, endpoint: string, params: any): Promise<AxiosResponse<any, any>>;
10
+ }
@@ -1,10 +1,12 @@
1
1
  import IntegrationsBaseClient from "../integrationsBaseClient";
2
- import { NbsIpsQrCode } from "../../types/integrations";
2
+ import { AxiosResponse } from "axios";
3
+ import { GenerateIPSQrCodeRequest, IPSQrCodeResponse } from "../../types/integrations/serbiaUtits";
3
4
  export default class SerbiaUtil extends IntegrationsBaseClient {
4
- nbsSearch(params: any): Promise<import("axios").AxiosResponse<any, any>>;
5
- generateNbsIpsQrCode(params: NbsIpsQrCode): any;
6
- getReceiptFromUrl(url: string, source: string): Promise<import("axios").AxiosResponse<any, any>>;
7
- getContoList(): Promise<import("axios").AxiosResponse<any, any>>;
8
- services(method: string, endpoint: string, params?: any): Promise<import("axios").AxiosResponse<any, any>>;
9
- request(method: string, endpoint: string, params: any): Promise<import("axios").AxiosResponse<any, any>>;
5
+ nbsSearch(params: any): Promise<AxiosResponse<any, any>>;
6
+ getNbsIpsQrCode(code: GenerateIPSQrCodeRequest, size: number, lang?: string): Promise<AxiosResponse<IPSQrCodeResponse>>;
7
+ validateNbsIpsQrCode(qrCodeString: string, lang?: string): Promise<AxiosResponse<IPSQrCodeResponse>>;
8
+ getReceiptFromUrl(url: string, source: string): Promise<AxiosResponse<any, any>>;
9
+ getContoList(): Promise<AxiosResponse<any, any>>;
10
+ services(method: string, endpoint: string, params?: any): Promise<AxiosResponse<any, any>>;
11
+ request(method: string, endpoint: string, params: any): Promise<AxiosResponse<any, any>>;
10
12
  }