@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.
- package/dist/index.cjs.js +301 -47
- package/dist/index.esm.js +300 -47
- package/dist/index.iife.js +301 -47
- package/dist/package.json +2 -1
- package/dist/types/api/component.d.ts +1 -0
- package/dist/types/api/config.d.ts +14 -0
- package/dist/types/api/integrations/serbiaUtil.d.ts +3 -1
- package/dist/types/api/platform.d.ts +4 -2
- package/dist/types/api/project.d.ts +146 -0
- package/dist/types/api/users.d.ts +64 -6
- package/dist/types/index.d.ts +4 -1
- package/dist/types/types/config.d.ts +11 -0
- package/dist/types/types/integrations.d.ts +12 -0
- package/dist/types/types/media.d.ts +103 -0
- package/dist/types/types/project.d.ts +64 -0
- package/dist/types/types/users.d.ts +32 -0
- package/package.json +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -114,27 +114,6 @@ class Functions extends PlatformBaseClient {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
class Roles extends PlatformBaseClient {
|
|
118
|
-
async create(role) {
|
|
119
|
-
return await this.client.post("/v1/user/role/create", role);
|
|
120
|
-
}
|
|
121
|
-
async delete(uuid) {
|
|
122
|
-
return await this.client.delete(`/v1/user/role/delete/${uuid}`);
|
|
123
|
-
}
|
|
124
|
-
async list() {
|
|
125
|
-
return await this.client.get(`/v1/user/role/list`);
|
|
126
|
-
}
|
|
127
|
-
async availablePermissions() {
|
|
128
|
-
return await this.client.get(`/v1/user/permissions/list`);
|
|
129
|
-
}
|
|
130
|
-
async permissions() {
|
|
131
|
-
return await this.client.get(`/v1/user/role/permissions`);
|
|
132
|
-
}
|
|
133
|
-
async edit(permissions, workspaces, level, uuid) {
|
|
134
|
-
return await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
117
|
class APIUser extends PlatformBaseClient {
|
|
139
118
|
async auth(username, password, project) {
|
|
140
119
|
return this.client.post("/v1/user/api/auth", {
|
|
@@ -164,36 +143,110 @@ class APIUser extends PlatformBaseClient {
|
|
|
164
143
|
}
|
|
165
144
|
|
|
166
145
|
class Users extends PlatformBaseClient {
|
|
167
|
-
async
|
|
168
|
-
return await this.client.post("/v1/
|
|
146
|
+
async auth(username, password, project) {
|
|
147
|
+
return await this.client.post("/v1/user/login", {
|
|
148
|
+
username,
|
|
149
|
+
password,
|
|
150
|
+
response_type: 'token',
|
|
151
|
+
}, {
|
|
152
|
+
headers: {
|
|
153
|
+
'X-Project-Uuid': project
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Resend confirmation email
|
|
159
|
+
* @param email User email
|
|
160
|
+
*/
|
|
161
|
+
async resendConfirmationEmail(email) {
|
|
162
|
+
return await this.client.post("/v1/user/send/confirmation/email", {
|
|
169
163
|
email,
|
|
170
|
-
roles,
|
|
171
164
|
});
|
|
172
165
|
}
|
|
173
|
-
//
|
|
174
|
-
|
|
175
|
-
|
|
166
|
+
// Password Reset (Request Only)
|
|
167
|
+
// Note: Only the REQUEST is exposed, not the password reset completion
|
|
168
|
+
// The actual password reset should be done through the official web interface
|
|
169
|
+
/**
|
|
170
|
+
* Request password reset email
|
|
171
|
+
* This only sends an email with a reset link, does not expose or change passwords
|
|
172
|
+
* @param email User email
|
|
173
|
+
*/
|
|
174
|
+
async requestPasswordReset(email) {
|
|
175
|
+
return await this.client.post("/v1/user/resetpassword", { email });
|
|
176
176
|
}
|
|
177
|
-
//
|
|
177
|
+
// User Profile & Management
|
|
178
|
+
/**
|
|
179
|
+
* Get current user's model
|
|
180
|
+
*/
|
|
178
181
|
async getUser() {
|
|
179
182
|
return await this.client.get("/v1/user/model");
|
|
180
183
|
}
|
|
181
|
-
|
|
182
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Get current user's claims
|
|
186
|
+
*/
|
|
187
|
+
async getClaims() {
|
|
188
|
+
return await this.client.get("/v1/user/claims");
|
|
183
189
|
}
|
|
184
|
-
|
|
185
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Edit user profile
|
|
192
|
+
* @param data Profile update data
|
|
193
|
+
*/
|
|
194
|
+
async editProfile(data) {
|
|
195
|
+
return await this.client.post("/v1/user/profile/edit", data);
|
|
186
196
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
+
// Permissions & Roles
|
|
198
|
+
/**
|
|
199
|
+
* Get user permissions
|
|
200
|
+
*/
|
|
201
|
+
async getPermissions() {
|
|
202
|
+
return await this.client.get("/v1/user/role/permissions");
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get list of available permissions
|
|
206
|
+
*/
|
|
207
|
+
async listPermissions() {
|
|
208
|
+
return await this.client.get("/v1/user/permissions/list");
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Create a new role
|
|
212
|
+
* @param role Role data including name, permissions, workspaces, and level
|
|
213
|
+
*/
|
|
214
|
+
async createRole(role) {
|
|
215
|
+
return await this.client.post("/v1/user/role/create", role);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Delete a role
|
|
219
|
+
* @param uuid Role UUID
|
|
220
|
+
*/
|
|
221
|
+
async deleteRole(uuid) {
|
|
222
|
+
return await this.client.delete(`/v1/user/role/delete/${uuid}`);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* List all roles
|
|
226
|
+
*/
|
|
227
|
+
async listRoles() {
|
|
228
|
+
return await this.client.get(`/v1/user/role/list`);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get role details by UUID
|
|
232
|
+
* @param uuid Role UUID
|
|
233
|
+
*/
|
|
234
|
+
async getRoleModel(uuid) {
|
|
235
|
+
return await this.client.get(`/v1/user/role/edit/${uuid}`);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Edit a role
|
|
239
|
+
* @param uuid Role UUID
|
|
240
|
+
* @param data Role update data including permissions, workspaces, and level
|
|
241
|
+
*/
|
|
242
|
+
async editRole(uuid, data) {
|
|
243
|
+
return await this.client.post(`/v1/user/role/edit/${uuid}`, data);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @deprecated Use getPermissions() instead
|
|
247
|
+
*/
|
|
248
|
+
async permissions() {
|
|
249
|
+
return await this.client.get(`/v1/user/role/permissions`);
|
|
197
250
|
}
|
|
198
251
|
}
|
|
199
252
|
|
|
@@ -420,6 +473,9 @@ class Component extends PlatformBaseClient {
|
|
|
420
473
|
data: input
|
|
421
474
|
});
|
|
422
475
|
}
|
|
476
|
+
async revisions(uuid) {
|
|
477
|
+
return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}/revisions`);
|
|
478
|
+
}
|
|
423
479
|
}
|
|
424
480
|
|
|
425
481
|
class ComponentUtils extends PlatformBaseClient {
|
|
@@ -503,6 +559,7 @@ class System extends PlatformBaseClient {
|
|
|
503
559
|
async resourceResolver(ref, resourceName, format) {
|
|
504
560
|
return await this.client.post("/v3/system/resource-resolver", {
|
|
505
561
|
type: resourceName,
|
|
562
|
+
ref,
|
|
506
563
|
format,
|
|
507
564
|
});
|
|
508
565
|
}
|
|
@@ -537,6 +594,199 @@ class Forge extends PlatformBaseClient {
|
|
|
537
594
|
}
|
|
538
595
|
}
|
|
539
596
|
|
|
597
|
+
class Project extends PlatformBaseClient {
|
|
598
|
+
/**
|
|
599
|
+
* Get list of all projects for the current user
|
|
600
|
+
*/
|
|
601
|
+
async list() {
|
|
602
|
+
return await this.client.get("/v1/project/list");
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Create a new project
|
|
606
|
+
* @param data Project creation data
|
|
607
|
+
*/
|
|
608
|
+
async create(data) {
|
|
609
|
+
return await this.client.post("/v1/project/create", data);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Get information about a specific project
|
|
613
|
+
*/
|
|
614
|
+
async info() {
|
|
615
|
+
return await this.client.get("/v1/project/info");
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Archive a project
|
|
619
|
+
*/
|
|
620
|
+
async archive() {
|
|
621
|
+
return await this.client.patch("/v1/project/archive");
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Invite a user to the project
|
|
625
|
+
* @param email Array of emails
|
|
626
|
+
* @param roles Array of role UUIDs
|
|
627
|
+
*/
|
|
628
|
+
async invite(emails, roles) {
|
|
629
|
+
return await this.client.post("/v1/project/invite", { emails: emails.join(","), roles });
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Get list of project invites
|
|
633
|
+
*/
|
|
634
|
+
async getInvites() {
|
|
635
|
+
return await this.client.get("/v1/project/invites");
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Get a specific invite by UUID
|
|
639
|
+
* @param uuid Invite UUID
|
|
640
|
+
*/
|
|
641
|
+
async getInvite(uuid) {
|
|
642
|
+
return await this.client.get(`/v1/project/invite/${uuid}`);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Accept an invite
|
|
646
|
+
* @param uuid Invite UUID
|
|
647
|
+
*/
|
|
648
|
+
async acceptInvite(uuid) {
|
|
649
|
+
return await this.client.get(`/v1/project/invite/accept/${uuid}`);
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Register through an invite
|
|
653
|
+
* @param uuid Invite UUID
|
|
654
|
+
* @param data Registration data
|
|
655
|
+
*/
|
|
656
|
+
async registerWithInvite(uuid, data) {
|
|
657
|
+
return await this.client.post(`/v1/project/invite/register/${uuid}`, data);
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Get list of project users
|
|
661
|
+
*/
|
|
662
|
+
async getUsers() {
|
|
663
|
+
return await this.client.get("/v1/project/users");
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Get a specific project user
|
|
667
|
+
* @param uuid User UUID
|
|
668
|
+
*/
|
|
669
|
+
async getUser(uuid) {
|
|
670
|
+
return await this.client.get(`/v1/project/user/${uuid}`);
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Update a project user
|
|
674
|
+
* @param uuid User UUID
|
|
675
|
+
* @param data Update data
|
|
676
|
+
*/
|
|
677
|
+
async updateUser(uuid, data) {
|
|
678
|
+
return await this.client.put(`/v1/project/user/${uuid}`, data);
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Delete a user from the project
|
|
682
|
+
* @param uuid User UUID
|
|
683
|
+
*/
|
|
684
|
+
async deleteUser(uuid) {
|
|
685
|
+
return await this.client.delete(`/v1/project/user/${uuid}`);
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Update project settings
|
|
689
|
+
* @param settings Settings data
|
|
690
|
+
*/
|
|
691
|
+
async updateSettings(settings) {
|
|
692
|
+
return await this.client.post("/v1/project/settings", settings);
|
|
693
|
+
}
|
|
694
|
+
// Workspace Methods
|
|
695
|
+
/**
|
|
696
|
+
* Create a new workspace
|
|
697
|
+
* @param data Workspace data
|
|
698
|
+
*/
|
|
699
|
+
async createWorkspace(data) {
|
|
700
|
+
return await this.client.post("/v1/project/workspace", data);
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Update a workspace
|
|
704
|
+
* @param uuid Workspace UUID
|
|
705
|
+
* @param data Update data
|
|
706
|
+
*/
|
|
707
|
+
async updateWorkspace(uuid, data) {
|
|
708
|
+
return await this.client.put(`/v1/project/workspace/${uuid}`, data);
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Delete a workspace
|
|
712
|
+
* @param uuid Workspace UUID
|
|
713
|
+
*/
|
|
714
|
+
async deleteWorkspace(uuid) {
|
|
715
|
+
return await this.client.delete(`/v1/project/workspace/${uuid}`);
|
|
716
|
+
}
|
|
717
|
+
// Template Methods
|
|
718
|
+
/**
|
|
719
|
+
* Get available templates
|
|
720
|
+
*/
|
|
721
|
+
async getAvailableTemplates() {
|
|
722
|
+
return await this.client.get("/v1/project/template/available");
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Search for templates
|
|
726
|
+
* @param query Search query
|
|
727
|
+
*/
|
|
728
|
+
async searchTemplates(query) {
|
|
729
|
+
return await this.client.post("/v1/project/template/search", query);
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Get template by ID
|
|
733
|
+
* @param id Template ID
|
|
734
|
+
*/
|
|
735
|
+
async getTemplate(id) {
|
|
736
|
+
return await this.client.get(`/v1/project/template/${id}`);
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Get template by activation code
|
|
740
|
+
* @param code Activation code
|
|
741
|
+
*/
|
|
742
|
+
async getTemplateByCode(code) {
|
|
743
|
+
return await this.client.get(`/v1/project/template/activationCode/${code}`);
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Get templates for a workspace
|
|
747
|
+
*/
|
|
748
|
+
async getWorkspaceTemplates() {
|
|
749
|
+
return await this.client.get("/v1/project/template/workspace");
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Install a template
|
|
753
|
+
* @param data Installation data
|
|
754
|
+
*/
|
|
755
|
+
async installTemplate(data) {
|
|
756
|
+
return await this.client.post("/v1/project/template/install", data);
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Uninstall a template
|
|
760
|
+
* @param data Uninstallation data
|
|
761
|
+
*/
|
|
762
|
+
async uninstallTemplate(data) {
|
|
763
|
+
return await this.client.post("/v1/project/template/uninstall", data);
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Upgrade a template
|
|
767
|
+
* @param data Upgrade data
|
|
768
|
+
*/
|
|
769
|
+
async upgradeTemplate(data) {
|
|
770
|
+
return await this.client.post("/v1/project/template/upgrade", data);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
class Config extends PlatformBaseClient {
|
|
775
|
+
/**
|
|
776
|
+
* Get user configuration
|
|
777
|
+
*/
|
|
778
|
+
async getUserConfig() {
|
|
779
|
+
return await this.client.get("/v1/config/user");
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Update user configuration
|
|
783
|
+
* @param config Configuration data
|
|
784
|
+
*/
|
|
785
|
+
async updateUserConfig(config) {
|
|
786
|
+
return await this.client.put("/v1/config/user", config);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
540
790
|
// apis
|
|
541
791
|
class Platform extends PlatformBaseClient {
|
|
542
792
|
getPlatformClient() {
|
|
@@ -552,9 +802,6 @@ class Platform extends PlatformBaseClient {
|
|
|
552
802
|
function() {
|
|
553
803
|
return (new Functions()).setClient(this.client);
|
|
554
804
|
}
|
|
555
|
-
role() {
|
|
556
|
-
return (new Roles()).setClient(this.client);
|
|
557
|
-
}
|
|
558
805
|
user() {
|
|
559
806
|
return (new Users()).setClient(this.client);
|
|
560
807
|
}
|
|
@@ -585,6 +832,12 @@ class Platform extends PlatformBaseClient {
|
|
|
585
832
|
thunder() {
|
|
586
833
|
return (new Thunder()).setClient(this.client);
|
|
587
834
|
}
|
|
835
|
+
project() {
|
|
836
|
+
return (new Project()).setClient(this.client);
|
|
837
|
+
}
|
|
838
|
+
config() {
|
|
839
|
+
return (new Config()).setClient(this.client);
|
|
840
|
+
}
|
|
588
841
|
}
|
|
589
842
|
|
|
590
843
|
class Invoicing extends PlatformBaseClient {
|
|
@@ -1325,7 +1578,7 @@ class DMS extends IntegrationsBaseClient {
|
|
|
1325
1578
|
}
|
|
1326
1579
|
|
|
1327
1580
|
class SerbiaUtil extends IntegrationsBaseClient {
|
|
1328
|
-
async
|
|
1581
|
+
async nbsSearch(params) {
|
|
1329
1582
|
return await this.services("GET", "nbs/search", { params });
|
|
1330
1583
|
}
|
|
1331
1584
|
async getReceiptFromUrl(url, source) {
|
|
@@ -1419,4 +1672,4 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
1419
1672
|
}
|
|
1420
1673
|
}
|
|
1421
1674
|
|
|
1422
|
-
export { APIUser, Apps, Component, ComponentUtils, DMS, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Payments,
|
|
1675
|
+
export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Payments, Project, Ratchet, Sandbox, SerbiaUtil, System, Thunder, Users as User, VPFR, Workflow, Platform as default };
|