@ptkl/sdk 0.9.12 → 0.10.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.
@@ -1,4 +1,4 @@
1
- var ProtokolSDK09 = (function (exports, axios) {
1
+ var ProtokolSDK010 = (function (exports, axios) {
2
2
  'use strict';
3
3
 
4
4
  class BaseClient {
@@ -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 {
@@ -757,7 +1010,6 @@ var ProtokolSDK09 = (function (exports, axios) {
757
1010
  });
758
1011
  if (count == files.length) {
759
1012
  formData.append('path', payload.uploadDir);
760
- formData.append('ref', payload.uuid);
761
1013
  if (payload.public) {
762
1014
  formData.append('is_public', "true");
763
1015
  }
@@ -785,7 +1037,7 @@ var ProtokolSDK09 = (function (exports, axios) {
785
1037
  });
786
1038
  }
787
1039
  async getMedia(lib, key, encoding) {
788
- return this.request('GET', `media/library/${lib}/get/${key}`, {
1040
+ return this.request('GET', `media/get/${key}`, {
789
1041
  params: {
790
1042
  encoding
791
1043
  },
@@ -793,21 +1045,21 @@ var ProtokolSDK09 = (function (exports, axios) {
793
1045
  });
794
1046
  }
795
1047
  async download(lib, key) {
796
- return this.request('POST', `media/library/${lib}/download`, {
1048
+ return this.request('POST', `media/download`, {
797
1049
  data: {
798
1050
  key
799
1051
  },
800
1052
  responseType: 'blob'
801
1053
  });
802
1054
  }
803
- async getExifData(lib, key) {
804
- return this.request('GET', `media/library/${lib}/exif/${key}`);
1055
+ async getExifData(key) {
1056
+ return this.request('GET', `media/exif/${key}`);
805
1057
  }
806
- async html2pdf(lib, data) {
1058
+ async html2pdf(data) {
807
1059
  const { output_pdf = false, input_path, input_html, output_path, output_file_name, output_type, data: templateData } = data;
808
1060
  const type = output_pdf ? 'arraybuffer' : 'json';
809
1061
  const contentType = output_pdf ? 'application/pdf' : 'application/json';
810
- return this.request('POST', `media/library/${lib}/html2pdf`, {
1062
+ return this.request('POST', `media/pdf/html2pdf`, {
811
1063
  data: {
812
1064
  output_pdf,
813
1065
  input_path,
@@ -823,20 +1075,20 @@ var ProtokolSDK09 = (function (exports, axios) {
823
1075
  responseType: type
824
1076
  });
825
1077
  }
826
- async createDir(lib, path) {
827
- return this.request('POST', `media/library/${lib}/dir`, { data: { path } });
1078
+ async createDir(path) {
1079
+ return this.request('POST', `media/library/dir`, { data: { path } });
828
1080
  }
829
- async deleteDir(lib, path) {
830
- return this.request('POST', `media/library/${lib}/delete/dir`, { data: { path } });
1081
+ async deleteDir(path) {
1082
+ return this.request('DELETE', `media/library/dir`, { data: { path } });
831
1083
  }
832
- async dirs(lib, data) {
833
- return await this.request("POST", `media/library/${lib}/dirs`, { data });
1084
+ async dirs(data) {
1085
+ return await this.request("POST", `media/library/dirs`, { data });
834
1086
  }
835
1087
  async fillPdf(lib, data) {
836
1088
  const { input_path, output_path, output_pdf = false, output_type, output_file_name, form_data, forms } = data;
837
1089
  const responseType = output_pdf ? 'arraybuffer' : 'json';
838
1090
  const contentType = output_pdf ? 'application/pdf' : 'application/json';
839
- return this.request('POST', `media/library/${lib}/pdf/fill`, {
1091
+ return this.request('POST', `media/pdf/fill`, {
840
1092
  data: {
841
1093
  input_path,
842
1094
  output_path,
@@ -948,7 +1200,7 @@ var ProtokolSDK09 = (function (exports, axios) {
948
1200
  else if (to === 'excel' || to === 'xlsx') {
949
1201
  responseType = 'blob';
950
1202
  }
951
- return this.request('POST', `media/library/${lib}/convert/data`, {
1203
+ return this.request('POST', `media/convert/data`, {
952
1204
  data,
953
1205
  params: queryParams,
954
1206
  responseType,
@@ -990,7 +1242,7 @@ var ProtokolSDK09 = (function (exports, axios) {
990
1242
  */
991
1243
  async getDataInfo(lib, data, params) {
992
1244
  const { format } = params;
993
- return this.request('POST', `media/library/${lib}/convert/info`, {
1245
+ return this.request('POST', `media/convert/info`, {
994
1246
  data,
995
1247
  params: { format },
996
1248
  headers: {
@@ -1034,7 +1286,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1034
1286
  */
1035
1287
  async validateData(lib, data, params) {
1036
1288
  const { format } = params;
1037
- return this.request('POST', `media/library/${lib}/convert/validate`, {
1289
+ return this.request('POST', `media/convert/validate`, {
1038
1290
  data,
1039
1291
  params: { format },
1040
1292
  headers: {
@@ -1085,7 +1337,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1085
1337
  if (options === null || options === void 0 ? void 0 : options.field_order) {
1086
1338
  params.field_order = options.field_order.join(',');
1087
1339
  }
1088
- return this.request('POST', `media/library/${lib}/convert/json-to-csv`, {
1340
+ return this.request('POST', `media/convert/json-to-csv`, {
1089
1341
  params,
1090
1342
  data: jsonData,
1091
1343
  responseType: 'text',
@@ -1147,7 +1399,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1147
1399
  if (options === null || options === void 0 ? void 0 : options.field_order) {
1148
1400
  params.field_order = options.field_order.join(',');
1149
1401
  }
1150
- return this.request('POST', `media/library/${lib}/convert/json-to-excel`, {
1402
+ return this.request('POST', `media/convert/json-to-excel`, {
1151
1403
  data: jsonData,
1152
1404
  params,
1153
1405
  responseType: 'blob',
@@ -1179,7 +1431,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1179
1431
  * ```
1180
1432
  */
1181
1433
  async csvToJson(lib, csvData) {
1182
- return this.request('POST', `media/library/${lib}/convert/csv-to-json`, {
1434
+ return this.request('POST', `media/convert/csv-to-json`, {
1183
1435
  data: csvData,
1184
1436
  responseType: 'json',
1185
1437
  headers: {
@@ -1216,7 +1468,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1216
1468
  if (options === null || options === void 0 ? void 0 : options.sheet_name) {
1217
1469
  params.sheet_name = options.sheet_name;
1218
1470
  }
1219
- return this.request('POST', `media/library/${lib}/convert/csv-to-excel`, {
1471
+ return this.request('POST', `media/convert/csv-to-excel`, {
1220
1472
  data: csvData,
1221
1473
  params,
1222
1474
  responseType: 'blob',
@@ -1256,7 +1508,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1256
1508
  if (options === null || options === void 0 ? void 0 : options.sheet_name) {
1257
1509
  params.sheet_name = options.sheet_name;
1258
1510
  }
1259
- return this.request('POST', `media/library/${lib}/convert/excel-to-json`, {
1511
+ return this.request('POST', `media/convert/excel-to-json`, {
1260
1512
  data: excelData,
1261
1513
  params,
1262
1514
  responseType: 'json',
@@ -1300,7 +1552,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1300
1552
  if (options === null || options === void 0 ? void 0 : options.sheet_name) {
1301
1553
  params.sheet_name = options.sheet_name;
1302
1554
  }
1303
- return this.request('POST', `media/library/${lib}/convert/excel-to-csv`, {
1555
+ return this.request('POST', `media/convert/excel-to-csv`, {
1304
1556
  data: excelData,
1305
1557
  params,
1306
1558
  responseType: 'text',
@@ -1312,7 +1564,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1312
1564
  async request(method, endpoint, params) {
1313
1565
  return await this.client.request({
1314
1566
  method: method,
1315
- url: `/v2/dms/${endpoint}`,
1567
+ url: `/v3/dms/${endpoint}`,
1316
1568
  ...params
1317
1569
  });
1318
1570
  }
@@ -1326,7 +1578,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1326
1578
  }
1327
1579
 
1328
1580
  class SerbiaUtil extends IntegrationsBaseClient {
1329
- async nsbSearch(params) {
1581
+ async nbsSearch(params) {
1330
1582
  return await this.services("GET", "nbs/search", { params });
1331
1583
  }
1332
1584
  async getReceiptFromUrl(url, source) {
@@ -1424,6 +1676,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1424
1676
  exports.Apps = Apps;
1425
1677
  exports.Component = Component;
1426
1678
  exports.ComponentUtils = ComponentUtils;
1679
+ exports.Config = Config;
1427
1680
  exports.DMS = DMS;
1428
1681
  exports.Forge = Forge;
1429
1682
  exports.Functions = Functions;
@@ -1431,8 +1684,8 @@ var ProtokolSDK09 = (function (exports, axios) {
1431
1684
  exports.Integrations = Integrations;
1432
1685
  exports.Invoicing = Invoicing;
1433
1686
  exports.Payments = Payments;
1687
+ exports.Project = Project;
1434
1688
  exports.Ratchet = Ratchet;
1435
- exports.Roles = Roles;
1436
1689
  exports.Sandbox = Sandbox;
1437
1690
  exports.SerbiaUtil = SerbiaUtil;
1438
1691
  exports.System = System;