@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.
package/dist/index.cjs.js CHANGED
@@ -19083,27 +19083,6 @@ class Functions extends PlatformBaseClient {
19083
19083
  }
19084
19084
  }
19085
19085
 
19086
- class Roles extends PlatformBaseClient {
19087
- async create(role) {
19088
- return await this.client.post("/v1/user/role/create", role);
19089
- }
19090
- async delete(uuid) {
19091
- return await this.client.delete(`/v1/user/role/delete/${uuid}`);
19092
- }
19093
- async list() {
19094
- return await this.client.get(`/v1/user/role/list`);
19095
- }
19096
- async availablePermissions() {
19097
- return await this.client.get(`/v1/user/permissions/list`);
19098
- }
19099
- async permissions() {
19100
- return await this.client.get(`/v1/user/role/permissions`);
19101
- }
19102
- async edit(permissions, workspaces, level, uuid) {
19103
- return await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
19104
- }
19105
- }
19106
-
19107
19086
  class APIUser extends PlatformBaseClient {
19108
19087
  async auth(username, password, project) {
19109
19088
  return this.client.post("/v1/user/api/auth", {
@@ -19133,36 +19112,110 @@ class APIUser extends PlatformBaseClient {
19133
19112
  }
19134
19113
 
19135
19114
  class Users extends PlatformBaseClient {
19136
- async invite(email, roles) {
19137
- return await this.client.post("/v1/project/invite", {
19115
+ async auth(username, password, project) {
19116
+ return await this.client.post("/v1/user/login", {
19117
+ username,
19118
+ password,
19119
+ response_type: 'token',
19120
+ }, {
19121
+ headers: {
19122
+ 'X-Project-Uuid': project
19123
+ }
19124
+ });
19125
+ }
19126
+ /**
19127
+ * Resend confirmation email
19128
+ * @param email User email
19129
+ */
19130
+ async resendConfirmationEmail(email) {
19131
+ return await this.client.post("/v1/user/send/confirmation/email", {
19138
19132
  email,
19139
- roles,
19140
19133
  });
19141
19134
  }
19142
- //Gets the current user's claims
19143
- async getClaims() {
19144
- return await this.client.get("/v1/user/claims");
19135
+ // Password Reset (Request Only)
19136
+ // Note: Only the REQUEST is exposed, not the password reset completion
19137
+ // The actual password reset should be done through the official web interface
19138
+ /**
19139
+ * Request password reset email
19140
+ * This only sends an email with a reset link, does not expose or change passwords
19141
+ * @param email User email
19142
+ */
19143
+ async requestPasswordReset(email) {
19144
+ return await this.client.post("/v1/user/resetpassword", { email });
19145
19145
  }
19146
- //Gets the current user's model
19146
+ // User Profile & Management
19147
+ /**
19148
+ * Get current user's model
19149
+ */
19147
19150
  async getUser() {
19148
19151
  return await this.client.get("/v1/user/model");
19149
19152
  }
19150
- async delete(uuid) {
19151
- return await this.client.delete(`/v1/project/user/${uuid}`);
19153
+ /**
19154
+ * Get current user's claims
19155
+ */
19156
+ async getClaims() {
19157
+ return await this.client.get("/v1/user/claims");
19152
19158
  }
19153
- async permissions() {
19154
- return await this.client.delete(`/v1/user/role/permissions`);
19159
+ /**
19160
+ * Edit user profile
19161
+ * @param data Profile update data
19162
+ */
19163
+ async editProfile(data) {
19164
+ return await this.client.post("/v1/user/profile/edit", data);
19155
19165
  }
19156
- async auth(username, password, project) {
19157
- return await this.client.post("/v1/user/login", {
19158
- username,
19159
- password,
19160
- response_type: "token",
19161
- }, {
19162
- headers: {
19163
- "X-Project-Uuid": project,
19164
- }
19165
- });
19166
+ // Permissions & Roles
19167
+ /**
19168
+ * Get user permissions
19169
+ */
19170
+ async getPermissions() {
19171
+ return await this.client.get("/v1/user/role/permissions");
19172
+ }
19173
+ /**
19174
+ * Get list of available permissions
19175
+ */
19176
+ async listPermissions() {
19177
+ return await this.client.get("/v1/user/permissions/list");
19178
+ }
19179
+ /**
19180
+ * Create a new role
19181
+ * @param role Role data including name, permissions, workspaces, and level
19182
+ */
19183
+ async createRole(role) {
19184
+ return await this.client.post("/v1/user/role/create", role);
19185
+ }
19186
+ /**
19187
+ * Delete a role
19188
+ * @param uuid Role UUID
19189
+ */
19190
+ async deleteRole(uuid) {
19191
+ return await this.client.delete(`/v1/user/role/delete/${uuid}`);
19192
+ }
19193
+ /**
19194
+ * List all roles
19195
+ */
19196
+ async listRoles() {
19197
+ return await this.client.get(`/v1/user/role/list`);
19198
+ }
19199
+ /**
19200
+ * Get role details by UUID
19201
+ * @param uuid Role UUID
19202
+ */
19203
+ async getRoleModel(uuid) {
19204
+ return await this.client.get(`/v1/user/role/edit/${uuid}`);
19205
+ }
19206
+ /**
19207
+ * Edit a role
19208
+ * @param uuid Role UUID
19209
+ * @param data Role update data including permissions, workspaces, and level
19210
+ */
19211
+ async editRole(uuid, data) {
19212
+ return await this.client.post(`/v1/user/role/edit/${uuid}`, data);
19213
+ }
19214
+ /**
19215
+ * @deprecated Use getPermissions() instead
19216
+ */
19217
+ async permissions() {
19218
+ return await this.client.get(`/v1/user/role/permissions`);
19166
19219
  }
19167
19220
  }
19168
19221
 
@@ -19389,6 +19442,9 @@ class Component extends PlatformBaseClient {
19389
19442
  data: input
19390
19443
  });
19391
19444
  }
19445
+ async revisions(uuid) {
19446
+ return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}/revisions`);
19447
+ }
19392
19448
  }
19393
19449
 
19394
19450
  class ComponentUtils extends PlatformBaseClient {
@@ -19472,6 +19528,7 @@ class System extends PlatformBaseClient {
19472
19528
  async resourceResolver(ref, resourceName, format) {
19473
19529
  return await this.client.post("/v3/system/resource-resolver", {
19474
19530
  type: resourceName,
19531
+ ref,
19475
19532
  format,
19476
19533
  });
19477
19534
  }
@@ -19506,6 +19563,199 @@ class Forge extends PlatformBaseClient {
19506
19563
  }
19507
19564
  }
19508
19565
 
19566
+ class Project extends PlatformBaseClient {
19567
+ /**
19568
+ * Get list of all projects for the current user
19569
+ */
19570
+ async list() {
19571
+ return await this.client.get("/v1/project/list");
19572
+ }
19573
+ /**
19574
+ * Create a new project
19575
+ * @param data Project creation data
19576
+ */
19577
+ async create(data) {
19578
+ return await this.client.post("/v1/project/create", data);
19579
+ }
19580
+ /**
19581
+ * Get information about a specific project
19582
+ */
19583
+ async info() {
19584
+ return await this.client.get("/v1/project/info");
19585
+ }
19586
+ /**
19587
+ * Archive a project
19588
+ */
19589
+ async archive() {
19590
+ return await this.client.patch("/v1/project/archive");
19591
+ }
19592
+ /**
19593
+ * Invite a user to the project
19594
+ * @param email Array of emails
19595
+ * @param roles Array of role UUIDs
19596
+ */
19597
+ async invite(emails, roles) {
19598
+ return await this.client.post("/v1/project/invite", { emails: emails.join(","), roles });
19599
+ }
19600
+ /**
19601
+ * Get list of project invites
19602
+ */
19603
+ async getInvites() {
19604
+ return await this.client.get("/v1/project/invites");
19605
+ }
19606
+ /**
19607
+ * Get a specific invite by UUID
19608
+ * @param uuid Invite UUID
19609
+ */
19610
+ async getInvite(uuid) {
19611
+ return await this.client.get(`/v1/project/invite/${uuid}`);
19612
+ }
19613
+ /**
19614
+ * Accept an invite
19615
+ * @param uuid Invite UUID
19616
+ */
19617
+ async acceptInvite(uuid) {
19618
+ return await this.client.get(`/v1/project/invite/accept/${uuid}`);
19619
+ }
19620
+ /**
19621
+ * Register through an invite
19622
+ * @param uuid Invite UUID
19623
+ * @param data Registration data
19624
+ */
19625
+ async registerWithInvite(uuid, data) {
19626
+ return await this.client.post(`/v1/project/invite/register/${uuid}`, data);
19627
+ }
19628
+ /**
19629
+ * Get list of project users
19630
+ */
19631
+ async getUsers() {
19632
+ return await this.client.get("/v1/project/users");
19633
+ }
19634
+ /**
19635
+ * Get a specific project user
19636
+ * @param uuid User UUID
19637
+ */
19638
+ async getUser(uuid) {
19639
+ return await this.client.get(`/v1/project/user/${uuid}`);
19640
+ }
19641
+ /**
19642
+ * Update a project user
19643
+ * @param uuid User UUID
19644
+ * @param data Update data
19645
+ */
19646
+ async updateUser(uuid, data) {
19647
+ return await this.client.put(`/v1/project/user/${uuid}`, data);
19648
+ }
19649
+ /**
19650
+ * Delete a user from the project
19651
+ * @param uuid User UUID
19652
+ */
19653
+ async deleteUser(uuid) {
19654
+ return await this.client.delete(`/v1/project/user/${uuid}`);
19655
+ }
19656
+ /**
19657
+ * Update project settings
19658
+ * @param settings Settings data
19659
+ */
19660
+ async updateSettings(settings) {
19661
+ return await this.client.post("/v1/project/settings", settings);
19662
+ }
19663
+ // Workspace Methods
19664
+ /**
19665
+ * Create a new workspace
19666
+ * @param data Workspace data
19667
+ */
19668
+ async createWorkspace(data) {
19669
+ return await this.client.post("/v1/project/workspace", data);
19670
+ }
19671
+ /**
19672
+ * Update a workspace
19673
+ * @param uuid Workspace UUID
19674
+ * @param data Update data
19675
+ */
19676
+ async updateWorkspace(uuid, data) {
19677
+ return await this.client.put(`/v1/project/workspace/${uuid}`, data);
19678
+ }
19679
+ /**
19680
+ * Delete a workspace
19681
+ * @param uuid Workspace UUID
19682
+ */
19683
+ async deleteWorkspace(uuid) {
19684
+ return await this.client.delete(`/v1/project/workspace/${uuid}`);
19685
+ }
19686
+ // Template Methods
19687
+ /**
19688
+ * Get available templates
19689
+ */
19690
+ async getAvailableTemplates() {
19691
+ return await this.client.get("/v1/project/template/available");
19692
+ }
19693
+ /**
19694
+ * Search for templates
19695
+ * @param query Search query
19696
+ */
19697
+ async searchTemplates(query) {
19698
+ return await this.client.post("/v1/project/template/search", query);
19699
+ }
19700
+ /**
19701
+ * Get template by ID
19702
+ * @param id Template ID
19703
+ */
19704
+ async getTemplate(id) {
19705
+ return await this.client.get(`/v1/project/template/${id}`);
19706
+ }
19707
+ /**
19708
+ * Get template by activation code
19709
+ * @param code Activation code
19710
+ */
19711
+ async getTemplateByCode(code) {
19712
+ return await this.client.get(`/v1/project/template/activationCode/${code}`);
19713
+ }
19714
+ /**
19715
+ * Get templates for a workspace
19716
+ */
19717
+ async getWorkspaceTemplates() {
19718
+ return await this.client.get("/v1/project/template/workspace");
19719
+ }
19720
+ /**
19721
+ * Install a template
19722
+ * @param data Installation data
19723
+ */
19724
+ async installTemplate(data) {
19725
+ return await this.client.post("/v1/project/template/install", data);
19726
+ }
19727
+ /**
19728
+ * Uninstall a template
19729
+ * @param data Uninstallation data
19730
+ */
19731
+ async uninstallTemplate(data) {
19732
+ return await this.client.post("/v1/project/template/uninstall", data);
19733
+ }
19734
+ /**
19735
+ * Upgrade a template
19736
+ * @param data Upgrade data
19737
+ */
19738
+ async upgradeTemplate(data) {
19739
+ return await this.client.post("/v1/project/template/upgrade", data);
19740
+ }
19741
+ }
19742
+
19743
+ class Config extends PlatformBaseClient {
19744
+ /**
19745
+ * Get user configuration
19746
+ */
19747
+ async getUserConfig() {
19748
+ return await this.client.get("/v1/config/user");
19749
+ }
19750
+ /**
19751
+ * Update user configuration
19752
+ * @param config Configuration data
19753
+ */
19754
+ async updateUserConfig(config) {
19755
+ return await this.client.put("/v1/config/user", config);
19756
+ }
19757
+ }
19758
+
19509
19759
  // apis
19510
19760
  class Platform extends PlatformBaseClient {
19511
19761
  getPlatformClient() {
@@ -19521,9 +19771,6 @@ class Platform extends PlatformBaseClient {
19521
19771
  function() {
19522
19772
  return (new Functions()).setClient(this.client);
19523
19773
  }
19524
- role() {
19525
- return (new Roles()).setClient(this.client);
19526
- }
19527
19774
  user() {
19528
19775
  return (new Users()).setClient(this.client);
19529
19776
  }
@@ -19554,6 +19801,12 @@ class Platform extends PlatformBaseClient {
19554
19801
  thunder() {
19555
19802
  return (new Thunder()).setClient(this.client);
19556
19803
  }
19804
+ project() {
19805
+ return (new Project()).setClient(this.client);
19806
+ }
19807
+ config() {
19808
+ return (new Config()).setClient(this.client);
19809
+ }
19557
19810
  }
19558
19811
 
19559
19812
  class Invoicing extends PlatformBaseClient {
@@ -19725,7 +19978,6 @@ class DMS extends IntegrationsBaseClient {
19725
19978
  });
19726
19979
  if (count == files.length) {
19727
19980
  formData.append('path', payload.uploadDir);
19728
- formData.append('ref', payload.uuid);
19729
19981
  if (payload.public) {
19730
19982
  formData.append('is_public', "true");
19731
19983
  }
@@ -19753,7 +20005,7 @@ class DMS extends IntegrationsBaseClient {
19753
20005
  });
19754
20006
  }
19755
20007
  async getMedia(lib, key, encoding) {
19756
- return this.request('GET', `media/library/${lib}/get/${key}`, {
20008
+ return this.request('GET', `media/get/${key}`, {
19757
20009
  params: {
19758
20010
  encoding
19759
20011
  },
@@ -19761,21 +20013,21 @@ class DMS extends IntegrationsBaseClient {
19761
20013
  });
19762
20014
  }
19763
20015
  async download(lib, key) {
19764
- return this.request('POST', `media/library/${lib}/download`, {
20016
+ return this.request('POST', `media/download`, {
19765
20017
  data: {
19766
20018
  key
19767
20019
  },
19768
20020
  responseType: 'blob'
19769
20021
  });
19770
20022
  }
19771
- async getExifData(lib, key) {
19772
- return this.request('GET', `media/library/${lib}/exif/${key}`);
20023
+ async getExifData(key) {
20024
+ return this.request('GET', `media/exif/${key}`);
19773
20025
  }
19774
- async html2pdf(lib, data) {
20026
+ async html2pdf(data) {
19775
20027
  const { output_pdf = false, input_path, input_html, output_path, output_file_name, output_type, data: templateData } = data;
19776
20028
  const type = output_pdf ? 'arraybuffer' : 'json';
19777
20029
  const contentType = output_pdf ? 'application/pdf' : 'application/json';
19778
- return this.request('POST', `media/library/${lib}/html2pdf`, {
20030
+ return this.request('POST', `media/pdf/html2pdf`, {
19779
20031
  data: {
19780
20032
  output_pdf,
19781
20033
  input_path,
@@ -19791,20 +20043,20 @@ class DMS extends IntegrationsBaseClient {
19791
20043
  responseType: type
19792
20044
  });
19793
20045
  }
19794
- async createDir(lib, path) {
19795
- return this.request('POST', `media/library/${lib}/dir`, { data: { path } });
20046
+ async createDir(path) {
20047
+ return this.request('POST', `media/library/dir`, { data: { path } });
19796
20048
  }
19797
- async deleteDir(lib, path) {
19798
- return this.request('POST', `media/library/${lib}/delete/dir`, { data: { path } });
20049
+ async deleteDir(path) {
20050
+ return this.request('DELETE', `media/library/dir`, { data: { path } });
19799
20051
  }
19800
- async dirs(lib, data) {
19801
- return await this.request("POST", `media/library/${lib}/dirs`, { data });
20052
+ async dirs(data) {
20053
+ return await this.request("POST", `media/library/dirs`, { data });
19802
20054
  }
19803
20055
  async fillPdf(lib, data) {
19804
20056
  const { input_path, output_path, output_pdf = false, output_type, output_file_name, form_data, forms } = data;
19805
20057
  const responseType = output_pdf ? 'arraybuffer' : 'json';
19806
20058
  const contentType = output_pdf ? 'application/pdf' : 'application/json';
19807
- return this.request('POST', `media/library/${lib}/pdf/fill`, {
20059
+ return this.request('POST', `media/pdf/fill`, {
19808
20060
  data: {
19809
20061
  input_path,
19810
20062
  output_path,
@@ -19916,7 +20168,7 @@ class DMS extends IntegrationsBaseClient {
19916
20168
  else if (to === 'excel' || to === 'xlsx') {
19917
20169
  responseType = 'blob';
19918
20170
  }
19919
- return this.request('POST', `media/library/${lib}/convert/data`, {
20171
+ return this.request('POST', `media/convert/data`, {
19920
20172
  data,
19921
20173
  params: queryParams,
19922
20174
  responseType,
@@ -19958,7 +20210,7 @@ class DMS extends IntegrationsBaseClient {
19958
20210
  */
19959
20211
  async getDataInfo(lib, data, params) {
19960
20212
  const { format } = params;
19961
- return this.request('POST', `media/library/${lib}/convert/info`, {
20213
+ return this.request('POST', `media/convert/info`, {
19962
20214
  data,
19963
20215
  params: { format },
19964
20216
  headers: {
@@ -20002,7 +20254,7 @@ class DMS extends IntegrationsBaseClient {
20002
20254
  */
20003
20255
  async validateData(lib, data, params) {
20004
20256
  const { format } = params;
20005
- return this.request('POST', `media/library/${lib}/convert/validate`, {
20257
+ return this.request('POST', `media/convert/validate`, {
20006
20258
  data,
20007
20259
  params: { format },
20008
20260
  headers: {
@@ -20053,7 +20305,7 @@ class DMS extends IntegrationsBaseClient {
20053
20305
  if (options === null || options === void 0 ? void 0 : options.field_order) {
20054
20306
  params.field_order = options.field_order.join(',');
20055
20307
  }
20056
- return this.request('POST', `media/library/${lib}/convert/json-to-csv`, {
20308
+ return this.request('POST', `media/convert/json-to-csv`, {
20057
20309
  params,
20058
20310
  data: jsonData,
20059
20311
  responseType: 'text',
@@ -20115,7 +20367,7 @@ class DMS extends IntegrationsBaseClient {
20115
20367
  if (options === null || options === void 0 ? void 0 : options.field_order) {
20116
20368
  params.field_order = options.field_order.join(',');
20117
20369
  }
20118
- return this.request('POST', `media/library/${lib}/convert/json-to-excel`, {
20370
+ return this.request('POST', `media/convert/json-to-excel`, {
20119
20371
  data: jsonData,
20120
20372
  params,
20121
20373
  responseType: 'blob',
@@ -20147,7 +20399,7 @@ class DMS extends IntegrationsBaseClient {
20147
20399
  * ```
20148
20400
  */
20149
20401
  async csvToJson(lib, csvData) {
20150
- return this.request('POST', `media/library/${lib}/convert/csv-to-json`, {
20402
+ return this.request('POST', `media/convert/csv-to-json`, {
20151
20403
  data: csvData,
20152
20404
  responseType: 'json',
20153
20405
  headers: {
@@ -20184,7 +20436,7 @@ class DMS extends IntegrationsBaseClient {
20184
20436
  if (options === null || options === void 0 ? void 0 : options.sheet_name) {
20185
20437
  params.sheet_name = options.sheet_name;
20186
20438
  }
20187
- return this.request('POST', `media/library/${lib}/convert/csv-to-excel`, {
20439
+ return this.request('POST', `media/convert/csv-to-excel`, {
20188
20440
  data: csvData,
20189
20441
  params,
20190
20442
  responseType: 'blob',
@@ -20224,7 +20476,7 @@ class DMS extends IntegrationsBaseClient {
20224
20476
  if (options === null || options === void 0 ? void 0 : options.sheet_name) {
20225
20477
  params.sheet_name = options.sheet_name;
20226
20478
  }
20227
- return this.request('POST', `media/library/${lib}/convert/excel-to-json`, {
20479
+ return this.request('POST', `media/convert/excel-to-json`, {
20228
20480
  data: excelData,
20229
20481
  params,
20230
20482
  responseType: 'json',
@@ -20268,7 +20520,7 @@ class DMS extends IntegrationsBaseClient {
20268
20520
  if (options === null || options === void 0 ? void 0 : options.sheet_name) {
20269
20521
  params.sheet_name = options.sheet_name;
20270
20522
  }
20271
- return this.request('POST', `media/library/${lib}/convert/excel-to-csv`, {
20523
+ return this.request('POST', `media/convert/excel-to-csv`, {
20272
20524
  data: excelData,
20273
20525
  params,
20274
20526
  responseType: 'text',
@@ -20280,7 +20532,7 @@ class DMS extends IntegrationsBaseClient {
20280
20532
  async request(method, endpoint, params) {
20281
20533
  return await this.client.request({
20282
20534
  method: method,
20283
- url: `/v2/dms/${endpoint}`,
20535
+ url: `/v3/dms/${endpoint}`,
20284
20536
  ...params
20285
20537
  });
20286
20538
  }
@@ -20294,7 +20546,7 @@ class DMS extends IntegrationsBaseClient {
20294
20546
  }
20295
20547
 
20296
20548
  class SerbiaUtil extends IntegrationsBaseClient {
20297
- async nsbSearch(params) {
20549
+ async nbsSearch(params) {
20298
20550
  return await this.services("GET", "nbs/search", { params });
20299
20551
  }
20300
20552
  async getReceiptFromUrl(url, source) {
@@ -20392,6 +20644,7 @@ exports.APIUser = APIUser;
20392
20644
  exports.Apps = Apps;
20393
20645
  exports.Component = Component;
20394
20646
  exports.ComponentUtils = ComponentUtils;
20647
+ exports.Config = Config;
20395
20648
  exports.DMS = DMS;
20396
20649
  exports.Forge = Forge;
20397
20650
  exports.Functions = Functions;
@@ -20399,8 +20652,8 @@ exports.Integration = Integrations;
20399
20652
  exports.Integrations = Integrations;
20400
20653
  exports.Invoicing = Invoicing;
20401
20654
  exports.Payments = Payments;
20655
+ exports.Project = Project;
20402
20656
  exports.Ratchet = Ratchet;
20403
- exports.Roles = Roles;
20404
20657
  exports.Sandbox = Sandbox;
20405
20658
  exports.SerbiaUtil = SerbiaUtil;
20406
20659
  exports.System = System;