@ptkl/sdk 0.9.1 → 0.9.3

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.cjs.js CHANGED
@@ -17977,6 +17977,17 @@ class Users extends PlatformBaseClient {
17977
17977
  async permissions() {
17978
17978
  return await this.client.delete(`/v1/user/role/permissions`);
17979
17979
  }
17980
+ async auth(username, password, project) {
17981
+ return await this.client.post("/v1/user/login", {
17982
+ username,
17983
+ password,
17984
+ response_type: "token",
17985
+ }, {
17986
+ headers: {
17987
+ "X-Project-Uuid": project,
17988
+ }
17989
+ });
17990
+ }
17980
17991
  }
17981
17992
 
17982
17993
  class Apps extends PlatformBaseClient {
@@ -18091,9 +18102,10 @@ class Component extends PlatformBaseClient {
18091
18102
  * })
18092
18103
  **/
18093
18104
  async findOne(filter, opts) {
18094
- const { items } = await this.find({
18105
+ const { data } = await this.find({
18095
18106
  $adv: filter
18096
18107
  }, opts);
18108
+ const { items } = data || {};
18097
18109
  if (items && items.length > 0) {
18098
18110
  return items[0];
18099
18111
  }
@@ -18426,7 +18438,7 @@ class IntegrationsBaseClient extends BaseClient {
18426
18438
  }
18427
18439
  }
18428
18440
 
18429
- class Media extends IntegrationsBaseClient {
18441
+ class DMS extends IntegrationsBaseClient {
18430
18442
  async list(data) {
18431
18443
  return this.request('POST', 'media/list', { data });
18432
18444
  }
@@ -18580,10 +18592,12 @@ class Payments extends IntegrationsBaseClient {
18580
18592
  async settings(provider) {
18581
18593
  return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
18582
18594
  }
18583
- async getPaymentLink(provider, amount, description, user) {
18595
+ async getPaymentLink(provider, user, options) {
18596
+ var _a;
18584
18597
  return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
18585
- totalAmount: amount.toString(),
18586
- description,
18598
+ totalAmount: options.totalAmount.toString(),
18599
+ description: options.description,
18600
+ redirectUrl: (_a = options.redirectUrl) !== null && _a !== undefined ? _a : null,
18587
18601
  });
18588
18602
  }
18589
18603
  }
@@ -18595,7 +18609,7 @@ class Integrations extends IntegrationsBaseClient {
18595
18609
  this.integrations = {
18596
18610
  'protokol-invoicing': new Invoicing().setClient(this.client),
18597
18611
  'protokol-vpfr': new VPFR().setClient(this.client),
18598
- 'protokol-media': new Media().setClient(this.client),
18612
+ 'protokol-media': new DMS().setClient(this.client),
18599
18613
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
18600
18614
  'protokol-payments': new Payments().setClient(this.client),
18601
18615
  };
@@ -18633,13 +18647,20 @@ exports.APIUser = APIUser;
18633
18647
  exports.Apps = Apps;
18634
18648
  exports.Component = Component;
18635
18649
  exports.ComponentUtils = ComponentUtils;
18650
+ exports.Forge = Forge;
18636
18651
  exports.Functions = Functions;
18637
18652
  exports.Integration = Integrations;
18653
+ exports.Integrations = Integrations;
18654
+ exports.Invoicing = Invoicing;
18655
+ exports.Media = DMS;
18656
+ exports.Payments = Payments;
18638
18657
  exports.Ratchet = Ratchet;
18639
18658
  exports.Roles = Roles;
18640
18659
  exports.Sandbox = Sandbox;
18660
+ exports.SerbiaUtil = SerbiaUtil;
18641
18661
  exports.System = System;
18642
18662
  exports.Thunder = Thunder;
18643
- exports.Users = Users;
18663
+ exports.User = Users;
18664
+ exports.VPFR = VPFR;
18644
18665
  exports.Workflow = Workflow;
18645
18666
  exports.default = Platform;
package/dist/index.esm.js CHANGED
@@ -167,6 +167,17 @@ class Users extends PlatformBaseClient {
167
167
  async permissions() {
168
168
  return await this.client.delete(`/v1/user/role/permissions`);
169
169
  }
170
+ async auth(username, password, project) {
171
+ return await this.client.post("/v1/user/login", {
172
+ username,
173
+ password,
174
+ response_type: "token",
175
+ }, {
176
+ headers: {
177
+ "X-Project-Uuid": project,
178
+ }
179
+ });
180
+ }
170
181
  }
171
182
 
172
183
  class Apps extends PlatformBaseClient {
@@ -281,9 +292,10 @@ class Component extends PlatformBaseClient {
281
292
  * })
282
293
  **/
283
294
  async findOne(filter, opts) {
284
- const { items } = await this.find({
295
+ const { data } = await this.find({
285
296
  $adv: filter
286
297
  }, opts);
298
+ const { items } = data || {};
287
299
  if (items && items.length > 0) {
288
300
  return items[0];
289
301
  }
@@ -616,7 +628,7 @@ class IntegrationsBaseClient extends BaseClient {
616
628
  }
617
629
  }
618
630
 
619
- class Media extends IntegrationsBaseClient {
631
+ class DMS extends IntegrationsBaseClient {
620
632
  async list(data) {
621
633
  return this.request('POST', 'media/list', { data });
622
634
  }
@@ -770,10 +782,12 @@ class Payments extends IntegrationsBaseClient {
770
782
  async settings(provider) {
771
783
  return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
772
784
  }
773
- async getPaymentLink(provider, amount, description, user) {
785
+ async getPaymentLink(provider, user, options) {
786
+ var _a;
774
787
  return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
775
- totalAmount: amount.toString(),
776
- description,
788
+ totalAmount: options.totalAmount.toString(),
789
+ description: options.description,
790
+ redirectUrl: (_a = options.redirectUrl) !== null && _a !== undefined ? _a : null,
777
791
  });
778
792
  }
779
793
  }
@@ -785,7 +799,7 @@ class Integrations extends IntegrationsBaseClient {
785
799
  this.integrations = {
786
800
  'protokol-invoicing': new Invoicing().setClient(this.client),
787
801
  'protokol-vpfr': new VPFR().setClient(this.client),
788
- 'protokol-media': new Media().setClient(this.client),
802
+ 'protokol-media': new DMS().setClient(this.client),
789
803
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
790
804
  'protokol-payments': new Payments().setClient(this.client),
791
805
  };
@@ -819,4 +833,4 @@ class Integrations extends IntegrationsBaseClient {
819
833
  }
820
834
  }
821
835
 
822
- export { APIUser, Apps, Component, ComponentUtils, Functions, Integrations as Integration, Ratchet, Roles, Sandbox, System, Thunder, Users, Workflow, Platform as default };
836
+ export { APIUser, Apps, Component, ComponentUtils, Forge, Functions, Integrations as Integration, Integrations, Invoicing, DMS as Media, Payments, Ratchet, Roles, Sandbox, SerbiaUtil, System, Thunder, Users as User, VPFR, Workflow, Platform as default };
@@ -1,4 +1,4 @@
1
- var ProtokolSDK = (function (exports, axios) {
1
+ var ProtokolSDK09 = (function (exports, axios) {
2
2
  'use strict';
3
3
 
4
4
  class BaseClient {
@@ -168,6 +168,17 @@ var ProtokolSDK = (function (exports, axios) {
168
168
  async permissions() {
169
169
  return await this.client.delete(`/v1/user/role/permissions`);
170
170
  }
171
+ async auth(username, password, project) {
172
+ return await this.client.post("/v1/user/login", {
173
+ username,
174
+ password,
175
+ response_type: "token",
176
+ }, {
177
+ headers: {
178
+ "X-Project-Uuid": project,
179
+ }
180
+ });
181
+ }
171
182
  }
172
183
 
173
184
  class Apps extends PlatformBaseClient {
@@ -282,9 +293,10 @@ var ProtokolSDK = (function (exports, axios) {
282
293
  * })
283
294
  **/
284
295
  async findOne(filter, opts) {
285
- const { items } = await this.find({
296
+ const { data } = await this.find({
286
297
  $adv: filter
287
298
  }, opts);
299
+ const { items } = data || {};
288
300
  if (items && items.length > 0) {
289
301
  return items[0];
290
302
  }
@@ -617,7 +629,7 @@ var ProtokolSDK = (function (exports, axios) {
617
629
  }
618
630
  }
619
631
 
620
- class Media extends IntegrationsBaseClient {
632
+ class DMS extends IntegrationsBaseClient {
621
633
  async list(data) {
622
634
  return this.request('POST', 'media/list', { data });
623
635
  }
@@ -771,10 +783,12 @@ var ProtokolSDK = (function (exports, axios) {
771
783
  async settings(provider) {
772
784
  return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
773
785
  }
774
- async getPaymentLink(provider, amount, description, user) {
786
+ async getPaymentLink(provider, user, options) {
787
+ var _a;
775
788
  return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
776
- totalAmount: amount.toString(),
777
- description,
789
+ totalAmount: options.totalAmount.toString(),
790
+ description: options.description,
791
+ redirectUrl: (_a = options.redirectUrl) !== null && _a !== undefined ? _a : null,
778
792
  });
779
793
  }
780
794
  }
@@ -786,7 +800,7 @@ var ProtokolSDK = (function (exports, axios) {
786
800
  this.integrations = {
787
801
  'protokol-invoicing': new Invoicing().setClient(this.client),
788
802
  'protokol-vpfr': new VPFR().setClient(this.client),
789
- 'protokol-media': new Media().setClient(this.client),
803
+ 'protokol-media': new DMS().setClient(this.client),
790
804
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
791
805
  'protokol-payments': new Payments().setClient(this.client),
792
806
  };
@@ -824,14 +838,21 @@ var ProtokolSDK = (function (exports, axios) {
824
838
  exports.Apps = Apps;
825
839
  exports.Component = Component;
826
840
  exports.ComponentUtils = ComponentUtils;
841
+ exports.Forge = Forge;
827
842
  exports.Functions = Functions;
828
843
  exports.Integration = Integrations;
844
+ exports.Integrations = Integrations;
845
+ exports.Invoicing = Invoicing;
846
+ exports.Media = DMS;
847
+ exports.Payments = Payments;
829
848
  exports.Ratchet = Ratchet;
830
849
  exports.Roles = Roles;
831
850
  exports.Sandbox = Sandbox;
851
+ exports.SerbiaUtil = SerbiaUtil;
832
852
  exports.System = System;
833
853
  exports.Thunder = Thunder;
834
- exports.Users = Users;
854
+ exports.User = Users;
855
+ exports.VPFR = VPFR;
835
856
  exports.Workflow = Workflow;
836
857
  exports.default = Platform;
837
858
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"
@@ -1,5 +1,6 @@
1
1
  import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions } from "src/types/component";
2
2
  import PlatformBaseClient from "./platformBaseClient";
3
+ import { AxiosResponse } from "axios";
3
4
  export default class Component extends PlatformBaseClient {
4
5
  private ref;
5
6
  constructor(ref?: string | null);
@@ -24,7 +25,7 @@ export default class Component extends PlatformBaseClient {
24
25
  * }
25
26
  * )
26
27
  **/
27
- find(filters: FindParams, opts?: FindOptions): Promise<FindResponse>;
28
+ find(filters: FindParams, opts?: FindOptions): Promise<AxiosResponse<FindResponse>>;
28
29
  /**
29
30
  * FindOne method to search for a single model
30
31
  *
@@ -45,7 +46,7 @@ export default class Component extends PlatformBaseClient {
45
46
  * @param uuid string - The uuid of the model
46
47
  * @returns (Promise<Model>)
47
48
  */
48
- get(uuid: string): Promise<Model>;
49
+ get(uuid: string): Promise<AxiosResponse<Model>>;
49
50
  /**
50
51
  * Update model by uuid
51
52
  *
@@ -53,7 +54,7 @@ export default class Component extends PlatformBaseClient {
53
54
  * @param data
54
55
  * @returns
55
56
  */
56
- update(uuid: string, data: Record<string, any>, options: UpdateOptions): Promise<import("axios").AxiosResponse<any, any>>;
57
+ update(uuid: string, data: Record<string, any>, options: UpdateOptions): Promise<AxiosResponse<any, any>>;
57
58
  /**
58
59
  * Update many models
59
60
  *
@@ -61,7 +62,7 @@ export default class Component extends PlatformBaseClient {
61
62
  * @param options
62
63
  * @returns
63
64
  */
64
- updateMany(data: Record<string, any>[], options: UpdateOptions): Promise<import("axios").AxiosResponse<any, any>>;
65
+ updateMany(data: Record<string, any>[], options: UpdateOptions): Promise<AxiosResponse<any, any>>;
65
66
  /**
66
67
  * Modify models by filters
67
68
  *
@@ -69,7 +70,7 @@ export default class Component extends PlatformBaseClient {
69
70
  * @param options
70
71
  * @returns
71
72
  */
72
- modify(filters: Record<string, any>, data: Record<string, any>, options: ModifyOptions): Promise<import("axios").AxiosResponse<any, any>>;
73
+ modify(filters: Record<string, any>, data: Record<string, any>, options: ModifyOptions): Promise<AxiosResponse<any, any>>;
73
74
  /**
74
75
  * Concurrent update model by uuid
75
76
  *
@@ -78,14 +79,14 @@ export default class Component extends PlatformBaseClient {
78
79
  * @param data
79
80
  * @returns
80
81
  */
81
- concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options: UpdateOptions): Promise<import("axios").AxiosResponse<any, any>>;
82
- create(model: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
83
- delete(uuid: string): Promise<import("axios").AxiosResponse<any, any>>;
84
- aggregate(pipeline: FindAggregateParams): Promise<import("axios").AxiosResponse<any, any>>;
85
- settings(): Promise<import("axios").AxiosResponse<any, any>>;
86
- saveSettings(settings: any, version: string): Promise<import("axios").AxiosResponse<any, any>>;
82
+ concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options: UpdateOptions): Promise<AxiosResponse<any, any>>;
83
+ create(model: Record<string, any>): Promise<AxiosResponse<any, any>>;
84
+ delete(uuid: string): Promise<AxiosResponse<any, any>>;
85
+ aggregate(pipeline: FindAggregateParams): Promise<AxiosResponse<any, any>>;
86
+ settings(): Promise<AxiosResponse<any, any>>;
87
+ saveSettings(settings: any, version: string): Promise<AxiosResponse<any, any>>;
87
88
  saveTemplatesDist(version: string, sdkVersion: string, engine: string, dist: Record<string, string>): Promise<any>;
88
- workflow(event: string, input: any): Promise<import("axios").AxiosResponse<any, any>>;
89
- function(name: string, input: any): Promise<import("axios").AxiosResponse<any, any>>;
89
+ workflow(event: string, input: any): Promise<AxiosResponse<any, any>>;
90
+ function(name: string, input: any): Promise<AxiosResponse<any, any>>;
90
91
  }
91
92
  export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, };
@@ -0,0 +1,17 @@
1
+ import IntegrationsBaseClient from "../integrationsBaseClient";
2
+ export default class DMS extends IntegrationsBaseClient {
3
+ list(data: any): Promise<import("axios").AxiosResponse<any, any>>;
4
+ libraries(): Promise<import("axios").AxiosResponse<any, any>>;
5
+ upload(payload: any): Promise<import("axios").AxiosResponse<any, any> | undefined>;
6
+ delete(data: any): Promise<import("axios").AxiosResponse<any, any>>;
7
+ uploadBase64(data: any): Promise<import("axios").AxiosResponse<any, any>>;
8
+ getMedia(lib: string, key: string, encoding: string): Promise<import("axios").AxiosResponse<any, any>>;
9
+ download(lib: string, key: string): Promise<import("axios").AxiosResponse<any, any>>;
10
+ getExifData(lib: string, key: string): Promise<import("axios").AxiosResponse<any, any>>;
11
+ html2pdf(lib: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
12
+ createDir(lib: string, path: string): Promise<import("axios").AxiosResponse<any, any>>;
13
+ deleteDir(lib: string, path: string): Promise<import("axios").AxiosResponse<any, any>>;
14
+ dirs(lib: string, data: string): Promise<import("axios").AxiosResponse<any, any>>;
15
+ request(method: string, endpoint: string, params?: any): Promise<import("axios").AxiosResponse<any, any>>;
16
+ requestv1(method: string, endpoint: string, params?: any): Promise<import("axios").AxiosResponse<any, any>>;
17
+ }
@@ -1,7 +1,7 @@
1
1
  import IntegrationsBaseClient from "../integrationsBaseClient";
2
- import { PaymentProvider } from "../../types/integrations";
2
+ import { PaymentProvider, GetPaymentLinkOptions } from "../../types/integrations";
3
3
  export default class Payments extends IntegrationsBaseClient {
4
4
  getTransactions(user: string): Promise<import("axios").AxiosResponse<any, any>>;
5
5
  settings(provider: PaymentProvider): Promise<import("axios").AxiosResponse<any, any>>;
6
- getPaymentLink(provider: PaymentProvider, amount: number, description: string, user: string): Promise<import("axios").AxiosResponse<any, any>>;
6
+ getPaymentLink(provider: PaymentProvider, user: string, options: GetPaymentLinkOptions): Promise<import("axios").AxiosResponse<any, any>>;
7
7
  }
@@ -1,4 +1,5 @@
1
1
  import IntegrationsBaseClient from "./integrationsBaseClient";
2
+ import Payments from "./integrations/payments";
2
3
  export default class Integrations extends IntegrationsBaseClient {
3
4
  private integrations;
4
5
  constructor(options?: {
@@ -10,7 +11,7 @@ export default class Integrations extends IntegrationsBaseClient {
10
11
  getDMS(): any;
11
12
  getVPFR(): any;
12
13
  getInvoicing(): any;
13
- getPayments(): any;
14
+ getPayments(): Payments;
14
15
  isInstalled(id: string): Promise<boolean>;
15
16
  getInterfaceOf(id: string): any;
16
17
  }
@@ -3,4 +3,5 @@ export default class Users extends PlatformBaseClient {
3
3
  invite(email: string, roles: string[]): Promise<import("axios").AxiosResponse<any, any>>;
4
4
  delete(uuid: string): Promise<import("axios").AxiosResponse<any, any>>;
5
5
  permissions(): Promise<import("axios").AxiosResponse<any, any>>;
6
+ auth(username: string, password: string, project: string): Promise<import("axios").AxiosResponse<any, any>>;
6
7
  }
@@ -4,7 +4,7 @@ export { default as Integration } from './api/integrations';
4
4
  export { default as Ratchet } from './api/ratchet';
5
5
  export { default as Sandbox } from './api/sandbox';
6
6
  export { default as System } from './api/system';
7
- export { default as Users } from './api/users';
7
+ export { default as User } from './api/users';
8
8
  export { default as Functions } from './api/functions';
9
9
  export { default as APIUser } from './api/apiUser';
10
10
  export { default as Roles } from './api/roles';
@@ -12,4 +12,13 @@ export { default as Apps } from './api/apps';
12
12
  export { default as Workflow } from './api/workflow';
13
13
  export { default as ComponentUtils } from './api/componentUtils';
14
14
  export { default as Thunder } from './api/thunder';
15
+ export { default as Forge } from './api/forge';
16
+ export { default as Integrations } from './api/integrations';
17
+ export { default as Payments } from './api/integrations/payments';
18
+ export { default as Invoicing } from './api/integrations/invoicing';
19
+ export { default as Media } from './api/integrations/dms';
20
+ export { default as SerbiaUtil } from './api/integrations/serbiaUtil';
21
+ export { default as VPFR } from './api/integrations/vpfr';
22
+ export type * from './types/component';
23
+ export type * from './types/integrations';
15
24
  export default Platform;
@@ -1 +1,6 @@
1
1
  export type PaymentProvider = 'monri';
2
+ export type GetPaymentLinkOptions = {
3
+ totalAmount: number;
4
+ description: string;
5
+ redirectUrl?: string | null;
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"