visualvault-api 2.0.0-beta.0 → 2.0.0-beta.2

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/config.yml CHANGED
@@ -21,6 +21,8 @@ ResourceUri:
21
21
  DocumentsIdOcr: /documents/{id}/ocr
22
22
  DocumentsIdRelateDocument: /documents/{id}/relateDocument
23
23
  DocumentsIdExpiration: /documents/{id}/expiration
24
+ DocumentsWebDavUrl: /documents/{id}/webdavurl
25
+ DocumentsWopiUrl: /documents/{id}/wopiurl
24
26
  Files: /files
25
27
  FilesQuery: /files?q=
26
28
  FilesId: /files/{id}
@@ -95,6 +97,7 @@ ResourceUri:
95
97
  ObjectById: /object/{id}
96
98
  ObjectSearchByModelId: /object/search/{modelId}
97
99
  StudioApi:
100
+ ResourceUserFeatures: /resources/userFeatures
98
101
  WorkflowLatestPublished: /workflows/latest/published
99
102
  WorkflowLatestPublishedId: /workflows/latest/published/{id}
100
103
  WorkflowVariables: /workflows/{id}/variables
package/dist/index.cjs CHANGED
@@ -608,9 +608,9 @@ var common_default = {
608
608
  authorize: Authorize
609
609
  };
610
610
 
611
- // lib/docApi/documentInstanceManager.js
611
+ // lib/docApi/documentManager.js
612
612
  init_cjs_shims();
613
- var DocumentInstanceManager = class {
613
+ var DocumentManager = class {
614
614
  constructor(httpHelper) {
615
615
  this._httpHelper = httpHelper;
616
616
  }
@@ -671,7 +671,7 @@ var DocApi = class {
671
671
  this.baseUrl = docApiConfig["apiUrl"] || null;
672
672
  this.roleSecurity = docApiConfig["roleSecurity"] || false;
673
673
  if (this.isEnabled) {
674
- this.documentInstances = new DocumentInstanceManager(this._httpHelper);
674
+ this.documents = new DocumentManager(this._httpHelper);
675
675
  }
676
676
  }
677
677
  };
@@ -730,9 +730,9 @@ var FormsApi_default = FormsApi;
730
730
  // lib/ObjectsApi.js
731
731
  init_cjs_shims();
732
732
 
733
- // lib/objectsApi/modelsManager.js
733
+ // lib/objectsApi/modelManager.js
734
734
  init_cjs_shims();
735
- var ModelsManager = class {
735
+ var ModelManager = class {
736
736
  constructor(httpHelper) {
737
737
  this._httpHelper = httpHelper;
738
738
  }
@@ -761,11 +761,11 @@ var ModelsManager = class {
761
761
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
762
762
  }
763
763
  };
764
- var modelsManager_default = ModelsManager;
764
+ var modelManager_default = ModelManager;
765
765
 
766
- // lib/objectsApi/objectsManager.js
766
+ // lib/objectsApi/objectManager.js
767
767
  init_cjs_shims();
768
- var ObjectsManager = class {
768
+ var ObjectManager = class {
769
769
  constructor(httpHelper) {
770
770
  this._httpHelper = httpHelper;
771
771
  }
@@ -843,7 +843,7 @@ var ObjectsManager = class {
843
843
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
844
844
  }
845
845
  };
846
- var objectsManager_default = ObjectsManager;
846
+ var objectManager_default = ObjectManager;
847
847
 
848
848
  // lib/ObjectsApi.js
849
849
  var import_js_yaml4 = __toESM(require("js-yaml"), 1);
@@ -862,8 +862,8 @@ var ObjectsApi = class {
862
862
  this.isEnabled = objectsApiConfig["isEnabled"] || false;
863
863
  this.baseUrl = objectsApiConfig["apiUrl"] || null;
864
864
  if (this.isEnabled) {
865
- this.models = new modelsManager_default(this._httpHelper);
866
- this.objects = new objectsManager_default(this._httpHelper);
865
+ this.models = new modelManager_default(this._httpHelper);
866
+ this.objects = new objectManager_default(this._httpHelper);
867
867
  }
868
868
  }
869
869
  };
@@ -972,6 +972,27 @@ var WorkflowManager = class {
972
972
  };
973
973
  var workflowManager_default = WorkflowManager;
974
974
 
975
+ // lib/studioApi/rolesAndPermissionsManager.js
976
+ init_cjs_shims();
977
+ var RolesAndPermissionsManager = class {
978
+ constructor(httpHelper) {
979
+ this._httpHelper = httpHelper;
980
+ }
981
+ /**
982
+ * Retrieves available features for the requesting user
983
+ * @param {object} params - Optional URL parameters to include in the request
984
+ */
985
+ async getUserFeatures(params) {
986
+ var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.ResourceUserFeatures;
987
+ var url = this._httpHelper.getUrl(resourceUri);
988
+ var opts = { method: "GET" };
989
+ var data = {};
990
+ params = params || {};
991
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
992
+ }
993
+ };
994
+ var rolesAndPermissionsManager_default = RolesAndPermissionsManager;
995
+
975
996
  // lib/StudioApi.js
976
997
  var import_js_yaml5 = __toESM(require("js-yaml"), 1);
977
998
  var import_fs5 = __toESM(require("fs"), 1);
@@ -990,6 +1011,7 @@ var StudioApi = class {
990
1011
  this.baseUrl = studioApiConfig["studioApiUrl"] || null;
991
1012
  if (this.isEnabled) {
992
1013
  this.workflow = new workflowManager_default(this._httpHelper);
1014
+ this.permissions = new rolesAndPermissionsManager_default(this._httpHelper);
993
1015
  }
994
1016
  }
995
1017
  };
@@ -1777,9 +1799,8 @@ var UsersManager = class {
1777
1799
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
1778
1800
  }
1779
1801
  getCurrentUser() {
1780
- const resourceUri = this._httpHelper._config.ResourceUri.UsersWhoAmI;
1781
- const baseUrl = this._httpHelper._sessionToken.baseUrl;
1782
- const url = baseUrl + "/api/v1" + resourceUri;
1802
+ const resourceUri = this._httpHelper._config.ResourceUri.UsersMe;
1803
+ const url = this._httpHelper.getUrl(resourceUri);
1783
1804
  const opts = { method: "GET" };
1784
1805
  const params = [];
1785
1806
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
@@ -2075,6 +2096,18 @@ var DocumentsManager = class {
2075
2096
  };
2076
2097
  return this._httpHelper.doVvClientRequest(url, opts, null, data);
2077
2098
  }
2099
+ getDocumentWebDavUrl(documentId) {
2100
+ const resourceUri = this._httpHelper._config.ResourceUri.DocumentsWebDavUrl.replace("{id}", documentId);
2101
+ const url = this._httpHelper.getUrl(resourceUri);
2102
+ const opts = { method: "GET" };
2103
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
2104
+ }
2105
+ getDocumentWopiUrl(documentId) {
2106
+ const resourceUri = this._httpHelper._config.ResourceUri.DocumentsWopiUrl.replace("{id}", documentId);
2107
+ const url = this._httpHelper.getUrl(resourceUri);
2108
+ const opts = { method: "GET" };
2109
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
2110
+ }
2078
2111
  };
2079
2112
 
2080
2113
  // lib/vvRestApi/projectsManager.js
@@ -2284,66 +2317,11 @@ var VVClient = class {
2284
2317
  this.securityMembers = new SecurityMembersManager(this._httpHelper);
2285
2318
  this.layouts = new LayoutsManager(this._httpHelper);
2286
2319
  this.reports = new ReportsManager(this._httpHelper);
2287
- this._docApi = null;
2288
- Object.defineProperties(this, {
2289
- docApi: {
2290
- get: function() {
2291
- if (this._docApi != null && this._docApi.isEnabled && this._docApi.baseUrl) {
2292
- return this._docApi;
2293
- } else {
2294
- throw new ReferenceError("Document Api not enabled");
2295
- }
2296
- }
2297
- }
2298
- });
2299
- this._formsApi = null;
2300
- Object.defineProperties(this, {
2301
- formsApi: {
2302
- get: function() {
2303
- if (this._formsApi != null && this._formsApi.isEnabled && this._formsApi.baseUrl) {
2304
- return this._formsApi;
2305
- } else {
2306
- throw new ReferenceError("Forms Api not enabled");
2307
- }
2308
- }
2309
- }
2310
- });
2311
- this._objectsApi = null;
2312
- Object.defineProperties(this, {
2313
- objectsApi: {
2314
- get: function() {
2315
- if (this._objectsApi != null && this._objectsApi.isEnabled && this._objectsApi.baseUrl) {
2316
- return this._objectsApi;
2317
- } else {
2318
- throw new ReferenceError("Objects Api not enabled");
2319
- }
2320
- }
2321
- }
2322
- });
2323
- this._studioApi = null;
2324
- Object.defineProperties(this, {
2325
- studioApi: {
2326
- get: function() {
2327
- if (this._studioApi != null && this._studioApi.isEnabled && this._studioApi.baseUrl) {
2328
- return this._studioApi;
2329
- } else {
2330
- throw new ReferenceError("Studio Api not enabled");
2331
- }
2332
- }
2333
- }
2334
- });
2335
- this._notificationsApi = null;
2336
- Object.defineProperties(this, {
2337
- notificationsApi: {
2338
- get: function() {
2339
- if (this._notificationsApi != null && this._notificationsApi.isEnabled && this._notificationsApi.baseUrl) {
2340
- return this._notificationsApi;
2341
- } else {
2342
- throw new ReferenceError("Notifications Api not enabled");
2343
- }
2344
- }
2345
- }
2346
- });
2320
+ this.docApi = null;
2321
+ this.formsApi = null;
2322
+ this.objectsApi = null;
2323
+ this.studioApi = null;
2324
+ this.notificationsApi = null;
2347
2325
  }
2348
2326
  async createDocApi(sessionToken) {
2349
2327
  const docApiConfigResponse = JSON.parse(await this.configuration.getDocApiConfig());
@@ -2352,12 +2330,12 @@ var VVClient = class {
2352
2330
  docApiSession.baseUrl = docApiConfigResponse.data["apiUrl"];
2353
2331
  docApiSession.apiUrl = this.yamlConfig.DocApiUri;
2354
2332
  if (docApiSession["tokenType"] == "jwt") {
2355
- this._docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2333
+ this.docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2356
2334
  } else if (this.users) {
2357
2335
  const jwtResponse = JSON.parse(await this.users.getUserJwt(docApiSession.audience));
2358
2336
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2359
2337
  docApiSession.convertToJwt(jwtResponse["data"]);
2360
- this._docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2338
+ this.docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2361
2339
  }
2362
2340
  }
2363
2341
  }
@@ -2369,12 +2347,12 @@ var VVClient = class {
2369
2347
  formsApiSession.baseUrl = formsApiConfigResponse.data["formsApiUrl"];
2370
2348
  formsApiSession.apiUrl = this.yamlConfig.FormsApiUri;
2371
2349
  if (formsApiSession["tokenType"] == "jwt") {
2372
- this._formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2350
+ this.formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2373
2351
  } else if (this.users) {
2374
2352
  const jwtResponse = JSON.parse(await this.users.getUserJwt(formsApiSession.audience));
2375
2353
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2376
2354
  formsApiSession.convertToJwt(jwtResponse["data"]);
2377
- this._formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2355
+ this.formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2378
2356
  }
2379
2357
  }
2380
2358
  }
@@ -2386,12 +2364,12 @@ var VVClient = class {
2386
2364
  objectsApiSession.baseUrl = objectsApiConfigResponse.data["apiUrl"];
2387
2365
  objectsApiSession.apiUrl = "";
2388
2366
  if (objectsApiSession["tokenType"] == "jwt") {
2389
- this._objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2367
+ this.objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2390
2368
  } else if (this.users) {
2391
2369
  const jwtResponse = JSON.parse(await this.users.getUserJwt(objectsApiSession.audience));
2392
2370
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2393
2371
  objectsApiSession.convertToJwt(jwtResponse["data"]);
2394
- this._objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2372
+ this.objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2395
2373
  }
2396
2374
  }
2397
2375
  }
@@ -2403,12 +2381,12 @@ var VVClient = class {
2403
2381
  studioApiSession.baseUrl = studioApiConfigResponse.data["studioApiUrl"];
2404
2382
  studioApiSession.apiUrl = "";
2405
2383
  if (studioApiSession["tokenType"] == "jwt") {
2406
- this._studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2384
+ this.studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2407
2385
  } else if (this.users) {
2408
2386
  const jwtResponse = JSON.parse(await this.users.getUserJwt(studioApiSession.audience));
2409
2387
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2410
2388
  studioApiSession.convertToJwt(jwtResponse["data"]);
2411
- this._studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2389
+ this.studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2412
2390
  }
2413
2391
  }
2414
2392
  }
@@ -2420,12 +2398,12 @@ var VVClient = class {
2420
2398
  notificationsApiSession.baseUrl = notificationsApiConfigResponse.data["apiUrl"];
2421
2399
  notificationsApiSession.apiUrl = this.yamlConfig.NotificationsApiUri;
2422
2400
  if (notificationsApiSession["tokenType"] == "jwt") {
2423
- this._notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2401
+ this.notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2424
2402
  } else if (this.users) {
2425
2403
  const jwtResponse = JSON.parse(await this.users.getUserJwt(notificationsApiSession.audience));
2426
2404
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2427
2405
  notificationsApiSession.convertToJwt(jwtResponse["data"]);
2428
- this._notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2406
+ this.notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2429
2407
  }
2430
2408
  }
2431
2409
  }