@ptkl/sdk 0.9.12 → 0.9.15

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.
@@ -115,27 +115,6 @@ var ProtokolSDK09 = (function (exports, axios) {
115
115
  }
116
116
  }
117
117
 
118
- class Roles extends PlatformBaseClient {
119
- async create(role) {
120
- return await this.client.post("/v1/user/role/create", role);
121
- }
122
- async delete(uuid) {
123
- return await this.client.delete(`/v1/user/role/delete/${uuid}`);
124
- }
125
- async list() {
126
- return await this.client.get(`/v1/user/role/list`);
127
- }
128
- async availablePermissions() {
129
- return await this.client.get(`/v1/user/permissions/list`);
130
- }
131
- async permissions() {
132
- return await this.client.get(`/v1/user/role/permissions`);
133
- }
134
- async edit(permissions, workspaces, level, uuid) {
135
- return await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
136
- }
137
- }
138
-
139
118
  class APIUser extends PlatformBaseClient {
140
119
  async auth(username, password, project) {
141
120
  return this.client.post("/v1/user/api/auth", {
@@ -165,36 +144,110 @@ var ProtokolSDK09 = (function (exports, axios) {
165
144
  }
166
145
 
167
146
  class Users extends PlatformBaseClient {
168
- async invite(email, roles) {
169
- return await this.client.post("/v1/project/invite", {
147
+ async auth(username, password, project) {
148
+ return await this.client.post("/v1/user/login", {
149
+ username,
150
+ password,
151
+ response_type: 'token',
152
+ }, {
153
+ headers: {
154
+ 'X-Project-Uuid': project
155
+ }
156
+ });
157
+ }
158
+ /**
159
+ * Resend confirmation email
160
+ * @param email User email
161
+ */
162
+ async resendConfirmationEmail(email) {
163
+ return await this.client.post("/v1/user/send/confirmation/email", {
170
164
  email,
171
- roles,
172
165
  });
173
166
  }
174
- //Gets the current user's claims
175
- async getClaims() {
176
- return await this.client.get("/v1/user/claims");
167
+ // Password Reset (Request Only)
168
+ // Note: Only the REQUEST is exposed, not the password reset completion
169
+ // The actual password reset should be done through the official web interface
170
+ /**
171
+ * Request password reset email
172
+ * This only sends an email with a reset link, does not expose or change passwords
173
+ * @param email User email
174
+ */
175
+ async requestPasswordReset(email) {
176
+ return await this.client.post("/v1/user/resetpassword", { email });
177
177
  }
178
- //Gets the current user's model
178
+ // User Profile & Management
179
+ /**
180
+ * Get current user's model
181
+ */
179
182
  async getUser() {
180
183
  return await this.client.get("/v1/user/model");
181
184
  }
182
- async delete(uuid) {
183
- return await this.client.delete(`/v1/project/user/${uuid}`);
185
+ /**
186
+ * Get current user's claims
187
+ */
188
+ async getClaims() {
189
+ return await this.client.get("/v1/user/claims");
184
190
  }
185
- async permissions() {
186
- return await this.client.delete(`/v1/user/role/permissions`);
191
+ /**
192
+ * Edit user profile
193
+ * @param data Profile update data
194
+ */
195
+ async editProfile(data) {
196
+ return await this.client.post("/v1/user/profile/edit", data);
187
197
  }
188
- async auth(username, password, project) {
189
- return await this.client.post("/v1/user/login", {
190
- username,
191
- password,
192
- response_type: "token",
193
- }, {
194
- headers: {
195
- "X-Project-Uuid": project,
196
- }
197
- });
198
+ // Permissions & Roles
199
+ /**
200
+ * Get user permissions
201
+ */
202
+ async getPermissions() {
203
+ return await this.client.get("/v1/user/role/permissions");
204
+ }
205
+ /**
206
+ * Get list of available permissions
207
+ */
208
+ async listPermissions() {
209
+ return await this.client.get("/v1/user/permissions/list");
210
+ }
211
+ /**
212
+ * Create a new role
213
+ * @param role Role data including name, permissions, workspaces, and level
214
+ */
215
+ async createRole(role) {
216
+ return await this.client.post("/v1/user/role/create", role);
217
+ }
218
+ /**
219
+ * Delete a role
220
+ * @param uuid Role UUID
221
+ */
222
+ async deleteRole(uuid) {
223
+ return await this.client.delete(`/v1/user/role/delete/${uuid}`);
224
+ }
225
+ /**
226
+ * List all roles
227
+ */
228
+ async listRoles() {
229
+ return await this.client.get(`/v1/user/role/list`);
230
+ }
231
+ /**
232
+ * Get role details by UUID
233
+ * @param uuid Role UUID
234
+ */
235
+ async getRoleModel(uuid) {
236
+ return await this.client.get(`/v1/user/role/edit/${uuid}`);
237
+ }
238
+ /**
239
+ * Edit a role
240
+ * @param uuid Role UUID
241
+ * @param data Role update data including permissions, workspaces, and level
242
+ */
243
+ async editRole(uuid, data) {
244
+ return await this.client.post(`/v1/user/role/edit/${uuid}`, data);
245
+ }
246
+ /**
247
+ * @deprecated Use getPermissions() instead
248
+ */
249
+ async permissions() {
250
+ return await this.client.get(`/v1/user/role/permissions`);
198
251
  }
199
252
  }
200
253
 
@@ -421,6 +474,9 @@ var ProtokolSDK09 = (function (exports, axios) {
421
474
  data: input
422
475
  });
423
476
  }
477
+ async revisions(uuid) {
478
+ return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}/revisions`);
479
+ }
424
480
  }
425
481
 
426
482
  class ComponentUtils extends PlatformBaseClient {
@@ -504,6 +560,7 @@ var ProtokolSDK09 = (function (exports, axios) {
504
560
  async resourceResolver(ref, resourceName, format) {
505
561
  return await this.client.post("/v3/system/resource-resolver", {
506
562
  type: resourceName,
563
+ ref,
507
564
  format,
508
565
  });
509
566
  }
@@ -538,6 +595,199 @@ var ProtokolSDK09 = (function (exports, axios) {
538
595
  }
539
596
  }
540
597
 
598
+ class Project extends PlatformBaseClient {
599
+ /**
600
+ * Get list of all projects for the current user
601
+ */
602
+ async list() {
603
+ return await this.client.get("/v1/project/list");
604
+ }
605
+ /**
606
+ * Create a new project
607
+ * @param data Project creation data
608
+ */
609
+ async create(data) {
610
+ return await this.client.post("/v1/project/create", data);
611
+ }
612
+ /**
613
+ * Get information about a specific project
614
+ */
615
+ async info() {
616
+ return await this.client.get("/v1/project/info");
617
+ }
618
+ /**
619
+ * Archive a project
620
+ */
621
+ async archive() {
622
+ return await this.client.patch("/v1/project/archive");
623
+ }
624
+ /**
625
+ * Invite a user to the project
626
+ * @param email Array of emails
627
+ * @param roles Array of role UUIDs
628
+ */
629
+ async invite(emails, roles) {
630
+ return await this.client.post("/v1/project/invite", { emails: emails.join(","), roles });
631
+ }
632
+ /**
633
+ * Get list of project invites
634
+ */
635
+ async getInvites() {
636
+ return await this.client.get("/v1/project/invites");
637
+ }
638
+ /**
639
+ * Get a specific invite by UUID
640
+ * @param uuid Invite UUID
641
+ */
642
+ async getInvite(uuid) {
643
+ return await this.client.get(`/v1/project/invite/${uuid}`);
644
+ }
645
+ /**
646
+ * Accept an invite
647
+ * @param uuid Invite UUID
648
+ */
649
+ async acceptInvite(uuid) {
650
+ return await this.client.get(`/v1/project/invite/accept/${uuid}`);
651
+ }
652
+ /**
653
+ * Register through an invite
654
+ * @param uuid Invite UUID
655
+ * @param data Registration data
656
+ */
657
+ async registerWithInvite(uuid, data) {
658
+ return await this.client.post(`/v1/project/invite/register/${uuid}`, data);
659
+ }
660
+ /**
661
+ * Get list of project users
662
+ */
663
+ async getUsers() {
664
+ return await this.client.get("/v1/project/users");
665
+ }
666
+ /**
667
+ * Get a specific project user
668
+ * @param uuid User UUID
669
+ */
670
+ async getUser(uuid) {
671
+ return await this.client.get(`/v1/project/user/${uuid}`);
672
+ }
673
+ /**
674
+ * Update a project user
675
+ * @param uuid User UUID
676
+ * @param data Update data
677
+ */
678
+ async updateUser(uuid, data) {
679
+ return await this.client.put(`/v1/project/user/${uuid}`, data);
680
+ }
681
+ /**
682
+ * Delete a user from the project
683
+ * @param uuid User UUID
684
+ */
685
+ async deleteUser(uuid) {
686
+ return await this.client.delete(`/v1/project/user/${uuid}`);
687
+ }
688
+ /**
689
+ * Update project settings
690
+ * @param settings Settings data
691
+ */
692
+ async updateSettings(settings) {
693
+ return await this.client.post("/v1/project/settings", settings);
694
+ }
695
+ // Workspace Methods
696
+ /**
697
+ * Create a new workspace
698
+ * @param data Workspace data
699
+ */
700
+ async createWorkspace(data) {
701
+ return await this.client.post("/v1/project/workspace", data);
702
+ }
703
+ /**
704
+ * Update a workspace
705
+ * @param uuid Workspace UUID
706
+ * @param data Update data
707
+ */
708
+ async updateWorkspace(uuid, data) {
709
+ return await this.client.put(`/v1/project/workspace/${uuid}`, data);
710
+ }
711
+ /**
712
+ * Delete a workspace
713
+ * @param uuid Workspace UUID
714
+ */
715
+ async deleteWorkspace(uuid) {
716
+ return await this.client.delete(`/v1/project/workspace/${uuid}`);
717
+ }
718
+ // Template Methods
719
+ /**
720
+ * Get available templates
721
+ */
722
+ async getAvailableTemplates() {
723
+ return await this.client.get("/v1/project/template/available");
724
+ }
725
+ /**
726
+ * Search for templates
727
+ * @param query Search query
728
+ */
729
+ async searchTemplates(query) {
730
+ return await this.client.post("/v1/project/template/search", query);
731
+ }
732
+ /**
733
+ * Get template by ID
734
+ * @param id Template ID
735
+ */
736
+ async getTemplate(id) {
737
+ return await this.client.get(`/v1/project/template/${id}`);
738
+ }
739
+ /**
740
+ * Get template by activation code
741
+ * @param code Activation code
742
+ */
743
+ async getTemplateByCode(code) {
744
+ return await this.client.get(`/v1/project/template/activationCode/${code}`);
745
+ }
746
+ /**
747
+ * Get templates for a workspace
748
+ */
749
+ async getWorkspaceTemplates() {
750
+ return await this.client.get("/v1/project/template/workspace");
751
+ }
752
+ /**
753
+ * Install a template
754
+ * @param data Installation data
755
+ */
756
+ async installTemplate(data) {
757
+ return await this.client.post("/v1/project/template/install", data);
758
+ }
759
+ /**
760
+ * Uninstall a template
761
+ * @param data Uninstallation data
762
+ */
763
+ async uninstallTemplate(data) {
764
+ return await this.client.post("/v1/project/template/uninstall", data);
765
+ }
766
+ /**
767
+ * Upgrade a template
768
+ * @param data Upgrade data
769
+ */
770
+ async upgradeTemplate(data) {
771
+ return await this.client.post("/v1/project/template/upgrade", data);
772
+ }
773
+ }
774
+
775
+ class Config extends PlatformBaseClient {
776
+ /**
777
+ * Get user configuration
778
+ */
779
+ async getUserConfig() {
780
+ return await this.client.get("/v1/config/user");
781
+ }
782
+ /**
783
+ * Update user configuration
784
+ * @param config Configuration data
785
+ */
786
+ async updateUserConfig(config) {
787
+ return await this.client.put("/v1/config/user", config);
788
+ }
789
+ }
790
+
541
791
  // apis
542
792
  class Platform extends PlatformBaseClient {
543
793
  getPlatformClient() {
@@ -553,9 +803,6 @@ var ProtokolSDK09 = (function (exports, axios) {
553
803
  function() {
554
804
  return (new Functions()).setClient(this.client);
555
805
  }
556
- role() {
557
- return (new Roles()).setClient(this.client);
558
- }
559
806
  user() {
560
807
  return (new Users()).setClient(this.client);
561
808
  }
@@ -586,6 +833,12 @@ var ProtokolSDK09 = (function (exports, axios) {
586
833
  thunder() {
587
834
  return (new Thunder()).setClient(this.client);
588
835
  }
836
+ project() {
837
+ return (new Project()).setClient(this.client);
838
+ }
839
+ config() {
840
+ return (new Config()).setClient(this.client);
841
+ }
589
842
  }
590
843
 
591
844
  class Invoicing extends PlatformBaseClient {
@@ -1326,7 +1579,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1326
1579
  }
1327
1580
 
1328
1581
  class SerbiaUtil extends IntegrationsBaseClient {
1329
- async nsbSearch(params) {
1582
+ async nbsSearch(params) {
1330
1583
  return await this.services("GET", "nbs/search", { params });
1331
1584
  }
1332
1585
  async getReceiptFromUrl(url, source) {
@@ -1424,6 +1677,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1424
1677
  exports.Apps = Apps;
1425
1678
  exports.Component = Component;
1426
1679
  exports.ComponentUtils = ComponentUtils;
1680
+ exports.Config = Config;
1427
1681
  exports.DMS = DMS;
1428
1682
  exports.Forge = Forge;
1429
1683
  exports.Functions = Functions;
@@ -1431,8 +1685,8 @@ var ProtokolSDK09 = (function (exports, axios) {
1431
1685
  exports.Integrations = Integrations;
1432
1686
  exports.Invoicing = Invoicing;
1433
1687
  exports.Payments = Payments;
1688
+ exports.Project = Project;
1434
1689
  exports.Ratchet = Ratchet;
1435
- exports.Roles = Roles;
1436
1690
  exports.Sandbox = Sandbox;
1437
1691
  exports.SerbiaUtil = SerbiaUtil;
1438
1692
  exports.System = System;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.9.11",
3
+ "version": "0.9.12",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",
@@ -42,6 +42,7 @@
42
42
  "@rollup/plugin-replace": "^6.0.2",
43
43
  "axios": "^1.7.7",
44
44
  "dom-parser": "^1.1.5",
45
+ "form-data": "^4.0.4",
45
46
  "lodash": "^4.17.21"
46
47
  }
47
48
  }
@@ -88,5 +88,6 @@ export default class Component extends PlatformBaseClient {
88
88
  saveTemplatesDist(version: string, sdkVersion: string, engine: string, dist: Record<string, string>): Promise<any>;
89
89
  workflow(event: string, input: any): Promise<AxiosResponse<any, any>>;
90
90
  function(name: string, input: any): Promise<AxiosResponse<any, any>>;
91
+ revisions(uuid: string): Promise<AxiosResponse<any, any>>;
91
92
  }
92
93
  export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, };
@@ -0,0 +1,14 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ import { AxiosResponse } from "axios";
3
+ import { ConfigUpdateRequest, UserConfig } from '../types/config';
4
+ export default class Config extends PlatformBaseClient {
5
+ /**
6
+ * Get user configuration
7
+ */
8
+ getUserConfig(): Promise<AxiosResponse<UserConfig>>;
9
+ /**
10
+ * Update user configuration
11
+ * @param config Configuration data
12
+ */
13
+ updateUserConfig(config: ConfigUpdateRequest): Promise<AxiosResponse<any>>;
14
+ }
@@ -1,6 +1,8 @@
1
1
  import IntegrationsBaseClient from "../integrationsBaseClient";
2
+ import { NbsIpsQrCode } from "../../types/integrations";
2
3
  export default class SerbiaUtil extends IntegrationsBaseClient {
3
- nsbSearch(params: any): Promise<import("axios").AxiosResponse<any, any>>;
4
+ nbsSearch(params: any): Promise<import("axios").AxiosResponse<any, any>>;
5
+ generateNbsIpsQrCode(params: NbsIpsQrCode): any;
4
6
  getReceiptFromUrl(url: string, source: string): Promise<import("axios").AxiosResponse<any, any>>;
5
7
  getContoList(): Promise<import("axios").AxiosResponse<any, any>>;
6
8
  services(method: string, endpoint: string, params?: any): Promise<import("axios").AxiosResponse<any, any>>;
@@ -1,6 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import Functions from "./functions";
3
- import Roles from "./roles";
4
3
  import APIUser from "./apiUser";
5
4
  import Users from "./users";
6
5
  import Apps from "./apps";
@@ -12,13 +11,14 @@ import Sandbox from "./sandbox";
12
11
  import System from "./system";
13
12
  import Workflow from "./workflow";
14
13
  import Forge from "./forge";
14
+ import Project from "./project";
15
+ import Config from "./config";
15
16
  import PlatformBaseClient from "./platformBaseClient";
16
17
  export default class Platform extends PlatformBaseClient {
17
18
  getPlatformClient(): AxiosInstance;
18
19
  getPlatformBaseURL(): string;
19
20
  apiUser(): APIUser;
20
21
  function(): Functions;
21
- role(): Roles;
22
22
  user(): Users;
23
23
  app(appType: string): Apps;
24
24
  forge(): Forge;
@@ -29,4 +29,6 @@ export default class Platform extends PlatformBaseClient {
29
29
  system(): System;
30
30
  workflow(): Workflow;
31
31
  thunder(): Thunder;
32
+ project(): Project;
33
+ config(): Config;
32
34
  }
@@ -0,0 +1,146 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ import { AxiosResponse } from "axios";
3
+ export default class Project extends PlatformBaseClient {
4
+ /**
5
+ * Get list of all projects for the current user
6
+ */
7
+ list(): Promise<AxiosResponse<any>>;
8
+ /**
9
+ * Create a new project
10
+ * @param data Project creation data
11
+ */
12
+ create(data: {
13
+ name: string;
14
+ description?: string;
15
+ [key: string]: any;
16
+ }): Promise<AxiosResponse<any>>;
17
+ /**
18
+ * Get information about a specific project
19
+ */
20
+ info(): Promise<AxiosResponse<any>>;
21
+ /**
22
+ * Archive a project
23
+ */
24
+ archive(): Promise<AxiosResponse<any>>;
25
+ /**
26
+ * Invite a user to the project
27
+ * @param email Array of emails
28
+ * @param roles Array of role UUIDs
29
+ */
30
+ invite(emails: string[], roles: string[]): Promise<AxiosResponse<any>>;
31
+ /**
32
+ * Get list of project invites
33
+ */
34
+ getInvites(): Promise<AxiosResponse<any>>;
35
+ /**
36
+ * Get a specific invite by UUID
37
+ * @param uuid Invite UUID
38
+ */
39
+ getInvite(uuid: string): Promise<AxiosResponse<any>>;
40
+ /**
41
+ * Accept an invite
42
+ * @param uuid Invite UUID
43
+ */
44
+ acceptInvite(uuid: string): Promise<AxiosResponse<any>>;
45
+ /**
46
+ * Register through an invite
47
+ * @param uuid Invite UUID
48
+ * @param data Registration data
49
+ */
50
+ registerWithInvite(uuid: string, data: any): Promise<AxiosResponse<any>>;
51
+ /**
52
+ * Get list of project users
53
+ */
54
+ getUsers(): Promise<AxiosResponse<any>>;
55
+ /**
56
+ * Get a specific project user
57
+ * @param uuid User UUID
58
+ */
59
+ getUser(uuid: string): Promise<AxiosResponse<any>>;
60
+ /**
61
+ * Update a project user
62
+ * @param uuid User UUID
63
+ * @param data Update data
64
+ */
65
+ updateUser(uuid: string, data: any): Promise<AxiosResponse<any>>;
66
+ /**
67
+ * Delete a user from the project
68
+ * @param uuid User UUID
69
+ */
70
+ deleteUser(uuid: string): Promise<AxiosResponse<any>>;
71
+ /**
72
+ * Update project settings
73
+ * @param settings Settings data
74
+ */
75
+ updateSettings(settings: any): Promise<AxiosResponse<any>>;
76
+ /**
77
+ * Create a new workspace
78
+ * @param data Workspace data
79
+ */
80
+ createWorkspace(data: {
81
+ name: string;
82
+ description?: string;
83
+ [key: string]: any;
84
+ }): Promise<AxiosResponse<any>>;
85
+ /**
86
+ * Update a workspace
87
+ * @param uuid Workspace UUID
88
+ * @param data Update data
89
+ */
90
+ updateWorkspace(uuid: string, data: any): Promise<AxiosResponse<any>>;
91
+ /**
92
+ * Delete a workspace
93
+ * @param uuid Workspace UUID
94
+ */
95
+ deleteWorkspace(uuid: string): Promise<AxiosResponse<any>>;
96
+ /**
97
+ * Get available templates
98
+ */
99
+ getAvailableTemplates(): Promise<AxiosResponse<any>>;
100
+ /**
101
+ * Search for templates
102
+ * @param query Search query
103
+ */
104
+ searchTemplates(query: any): Promise<AxiosResponse<any>>;
105
+ /**
106
+ * Get template by ID
107
+ * @param id Template ID
108
+ */
109
+ getTemplate(id: string): Promise<AxiosResponse<any>>;
110
+ /**
111
+ * Get template by activation code
112
+ * @param code Activation code
113
+ */
114
+ getTemplateByCode(code: string): Promise<AxiosResponse<any>>;
115
+ /**
116
+ * Get templates for a workspace
117
+ */
118
+ getWorkspaceTemplates(): Promise<AxiosResponse<any>>;
119
+ /**
120
+ * Install a template
121
+ * @param data Installation data
122
+ */
123
+ installTemplate(data: {
124
+ template_id: string;
125
+ workspace_uuid: string;
126
+ [key: string]: any;
127
+ }): Promise<AxiosResponse<any>>;
128
+ /**
129
+ * Uninstall a template
130
+ * @param data Uninstallation data
131
+ */
132
+ uninstallTemplate(data: {
133
+ template_id: string;
134
+ workspace_uuid: string;
135
+ [key: string]: any;
136
+ }): Promise<AxiosResponse<any>>;
137
+ /**
138
+ * Upgrade a template
139
+ * @param data Upgrade data
140
+ */
141
+ upgradeTemplate(data: {
142
+ template_id: string;
143
+ workspace_uuid: string;
144
+ [key: string]: any;
145
+ }): Promise<AxiosResponse<any>>;
146
+ }