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/index.js CHANGED
@@ -577,9 +577,9 @@ var common_default = {
577
577
  authorize: Authorize
578
578
  };
579
579
 
580
- // lib/docApi/documentInstanceManager.js
580
+ // lib/docApi/documentManager.js
581
581
  init_esm_shims();
582
- var DocumentInstanceManager = class {
582
+ var DocumentManager = class {
583
583
  constructor(httpHelper) {
584
584
  this._httpHelper = httpHelper;
585
585
  }
@@ -640,7 +640,7 @@ var DocApi = class {
640
640
  this.baseUrl = docApiConfig["apiUrl"] || null;
641
641
  this.roleSecurity = docApiConfig["roleSecurity"] || false;
642
642
  if (this.isEnabled) {
643
- this.documentInstances = new DocumentInstanceManager(this._httpHelper);
643
+ this.documents = new DocumentManager(this._httpHelper);
644
644
  }
645
645
  }
646
646
  };
@@ -699,9 +699,9 @@ var FormsApi_default = FormsApi;
699
699
  // lib/ObjectsApi.js
700
700
  init_esm_shims();
701
701
 
702
- // lib/objectsApi/modelsManager.js
702
+ // lib/objectsApi/modelManager.js
703
703
  init_esm_shims();
704
- var ModelsManager = class {
704
+ var ModelManager = class {
705
705
  constructor(httpHelper) {
706
706
  this._httpHelper = httpHelper;
707
707
  }
@@ -730,11 +730,11 @@ var ModelsManager = class {
730
730
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
731
731
  }
732
732
  };
733
- var modelsManager_default = ModelsManager;
733
+ var modelManager_default = ModelManager;
734
734
 
735
- // lib/objectsApi/objectsManager.js
735
+ // lib/objectsApi/objectManager.js
736
736
  init_esm_shims();
737
- var ObjectsManager = class {
737
+ var ObjectManager = class {
738
738
  constructor(httpHelper) {
739
739
  this._httpHelper = httpHelper;
740
740
  }
@@ -812,7 +812,7 @@ var ObjectsManager = class {
812
812
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
813
813
  }
814
814
  };
815
- var objectsManager_default = ObjectsManager;
815
+ var objectManager_default = ObjectManager;
816
816
 
817
817
  // lib/ObjectsApi.js
818
818
  import yaml4 from "js-yaml";
@@ -831,8 +831,8 @@ var ObjectsApi = class {
831
831
  this.isEnabled = objectsApiConfig["isEnabled"] || false;
832
832
  this.baseUrl = objectsApiConfig["apiUrl"] || null;
833
833
  if (this.isEnabled) {
834
- this.models = new modelsManager_default(this._httpHelper);
835
- this.objects = new objectsManager_default(this._httpHelper);
834
+ this.models = new modelManager_default(this._httpHelper);
835
+ this.objects = new objectManager_default(this._httpHelper);
836
836
  }
837
837
  }
838
838
  };
@@ -941,6 +941,27 @@ var WorkflowManager = class {
941
941
  };
942
942
  var workflowManager_default = WorkflowManager;
943
943
 
944
+ // lib/studioApi/rolesAndPermissionsManager.js
945
+ init_esm_shims();
946
+ var RolesAndPermissionsManager = class {
947
+ constructor(httpHelper) {
948
+ this._httpHelper = httpHelper;
949
+ }
950
+ /**
951
+ * Retrieves available features for the requesting user
952
+ * @param {object} params - Optional URL parameters to include in the request
953
+ */
954
+ async getUserFeatures(params) {
955
+ var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.ResourceUserFeatures;
956
+ var url = this._httpHelper.getUrl(resourceUri);
957
+ var opts = { method: "GET" };
958
+ var data = {};
959
+ params = params || {};
960
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
961
+ }
962
+ };
963
+ var rolesAndPermissionsManager_default = RolesAndPermissionsManager;
964
+
944
965
  // lib/StudioApi.js
945
966
  import yaml5 from "js-yaml";
946
967
  import fs5 from "fs";
@@ -959,6 +980,7 @@ var StudioApi = class {
959
980
  this.baseUrl = studioApiConfig["studioApiUrl"] || null;
960
981
  if (this.isEnabled) {
961
982
  this.workflow = new workflowManager_default(this._httpHelper);
983
+ this.permissions = new rolesAndPermissionsManager_default(this._httpHelper);
962
984
  }
963
985
  }
964
986
  };
@@ -1746,9 +1768,8 @@ var UsersManager = class {
1746
1768
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
1747
1769
  }
1748
1770
  getCurrentUser() {
1749
- const resourceUri = this._httpHelper._config.ResourceUri.UsersWhoAmI;
1750
- const baseUrl = this._httpHelper._sessionToken.baseUrl;
1751
- const url = baseUrl + "/api/v1" + resourceUri;
1771
+ const resourceUri = this._httpHelper._config.ResourceUri.UsersMe;
1772
+ const url = this._httpHelper.getUrl(resourceUri);
1752
1773
  const opts = { method: "GET" };
1753
1774
  const params = [];
1754
1775
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
@@ -2044,6 +2065,18 @@ var DocumentsManager = class {
2044
2065
  };
2045
2066
  return this._httpHelper.doVvClientRequest(url, opts, null, data);
2046
2067
  }
2068
+ getDocumentWebDavUrl(documentId) {
2069
+ const resourceUri = this._httpHelper._config.ResourceUri.DocumentsWebDavUrl.replace("{id}", documentId);
2070
+ const url = this._httpHelper.getUrl(resourceUri);
2071
+ const opts = { method: "GET" };
2072
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
2073
+ }
2074
+ getDocumentWopiUrl(documentId) {
2075
+ const resourceUri = this._httpHelper._config.ResourceUri.DocumentsWopiUrl.replace("{id}", documentId);
2076
+ const url = this._httpHelper.getUrl(resourceUri);
2077
+ const opts = { method: "GET" };
2078
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
2079
+ }
2047
2080
  };
2048
2081
 
2049
2082
  // lib/vvRestApi/projectsManager.js
@@ -2253,66 +2286,11 @@ var VVClient = class {
2253
2286
  this.securityMembers = new SecurityMembersManager(this._httpHelper);
2254
2287
  this.layouts = new LayoutsManager(this._httpHelper);
2255
2288
  this.reports = new ReportsManager(this._httpHelper);
2256
- this._docApi = null;
2257
- Object.defineProperties(this, {
2258
- docApi: {
2259
- get: function() {
2260
- if (this._docApi != null && this._docApi.isEnabled && this._docApi.baseUrl) {
2261
- return this._docApi;
2262
- } else {
2263
- throw new ReferenceError("Document Api not enabled");
2264
- }
2265
- }
2266
- }
2267
- });
2268
- this._formsApi = null;
2269
- Object.defineProperties(this, {
2270
- formsApi: {
2271
- get: function() {
2272
- if (this._formsApi != null && this._formsApi.isEnabled && this._formsApi.baseUrl) {
2273
- return this._formsApi;
2274
- } else {
2275
- throw new ReferenceError("Forms Api not enabled");
2276
- }
2277
- }
2278
- }
2279
- });
2280
- this._objectsApi = null;
2281
- Object.defineProperties(this, {
2282
- objectsApi: {
2283
- get: function() {
2284
- if (this._objectsApi != null && this._objectsApi.isEnabled && this._objectsApi.baseUrl) {
2285
- return this._objectsApi;
2286
- } else {
2287
- throw new ReferenceError("Objects Api not enabled");
2288
- }
2289
- }
2290
- }
2291
- });
2292
- this._studioApi = null;
2293
- Object.defineProperties(this, {
2294
- studioApi: {
2295
- get: function() {
2296
- if (this._studioApi != null && this._studioApi.isEnabled && this._studioApi.baseUrl) {
2297
- return this._studioApi;
2298
- } else {
2299
- throw new ReferenceError("Studio Api not enabled");
2300
- }
2301
- }
2302
- }
2303
- });
2304
- this._notificationsApi = null;
2305
- Object.defineProperties(this, {
2306
- notificationsApi: {
2307
- get: function() {
2308
- if (this._notificationsApi != null && this._notificationsApi.isEnabled && this._notificationsApi.baseUrl) {
2309
- return this._notificationsApi;
2310
- } else {
2311
- throw new ReferenceError("Notifications Api not enabled");
2312
- }
2313
- }
2314
- }
2315
- });
2289
+ this.docApi = null;
2290
+ this.formsApi = null;
2291
+ this.objectsApi = null;
2292
+ this.studioApi = null;
2293
+ this.notificationsApi = null;
2316
2294
  }
2317
2295
  async createDocApi(sessionToken) {
2318
2296
  const docApiConfigResponse = JSON.parse(await this.configuration.getDocApiConfig());
@@ -2321,12 +2299,12 @@ var VVClient = class {
2321
2299
  docApiSession.baseUrl = docApiConfigResponse.data["apiUrl"];
2322
2300
  docApiSession.apiUrl = this.yamlConfig.DocApiUri;
2323
2301
  if (docApiSession["tokenType"] == "jwt") {
2324
- this._docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2302
+ this.docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2325
2303
  } else if (this.users) {
2326
2304
  const jwtResponse = JSON.parse(await this.users.getUserJwt(docApiSession.audience));
2327
2305
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2328
2306
  docApiSession.convertToJwt(jwtResponse["data"]);
2329
- this._docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2307
+ this.docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2330
2308
  }
2331
2309
  }
2332
2310
  }
@@ -2338,12 +2316,12 @@ var VVClient = class {
2338
2316
  formsApiSession.baseUrl = formsApiConfigResponse.data["formsApiUrl"];
2339
2317
  formsApiSession.apiUrl = this.yamlConfig.FormsApiUri;
2340
2318
  if (formsApiSession["tokenType"] == "jwt") {
2341
- this._formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2319
+ this.formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2342
2320
  } else if (this.users) {
2343
2321
  const jwtResponse = JSON.parse(await this.users.getUserJwt(formsApiSession.audience));
2344
2322
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2345
2323
  formsApiSession.convertToJwt(jwtResponse["data"]);
2346
- this._formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2324
+ this.formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2347
2325
  }
2348
2326
  }
2349
2327
  }
@@ -2355,12 +2333,12 @@ var VVClient = class {
2355
2333
  objectsApiSession.baseUrl = objectsApiConfigResponse.data["apiUrl"];
2356
2334
  objectsApiSession.apiUrl = "";
2357
2335
  if (objectsApiSession["tokenType"] == "jwt") {
2358
- this._objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2336
+ this.objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2359
2337
  } else if (this.users) {
2360
2338
  const jwtResponse = JSON.parse(await this.users.getUserJwt(objectsApiSession.audience));
2361
2339
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2362
2340
  objectsApiSession.convertToJwt(jwtResponse["data"]);
2363
- this._objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2341
+ this.objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2364
2342
  }
2365
2343
  }
2366
2344
  }
@@ -2372,12 +2350,12 @@ var VVClient = class {
2372
2350
  studioApiSession.baseUrl = studioApiConfigResponse.data["studioApiUrl"];
2373
2351
  studioApiSession.apiUrl = "";
2374
2352
  if (studioApiSession["tokenType"] == "jwt") {
2375
- this._studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2353
+ this.studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2376
2354
  } else if (this.users) {
2377
2355
  const jwtResponse = JSON.parse(await this.users.getUserJwt(studioApiSession.audience));
2378
2356
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2379
2357
  studioApiSession.convertToJwt(jwtResponse["data"]);
2380
- this._studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2358
+ this.studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2381
2359
  }
2382
2360
  }
2383
2361
  }
@@ -2389,12 +2367,12 @@ var VVClient = class {
2389
2367
  notificationsApiSession.baseUrl = notificationsApiConfigResponse.data["apiUrl"];
2390
2368
  notificationsApiSession.apiUrl = this.yamlConfig.NotificationsApiUri;
2391
2369
  if (notificationsApiSession["tokenType"] == "jwt") {
2392
- this._notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2370
+ this.notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2393
2371
  } else if (this.users) {
2394
2372
  const jwtResponse = JSON.parse(await this.users.getUserJwt(notificationsApiSession.audience));
2395
2373
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2396
2374
  notificationsApiSession.convertToJwt(jwtResponse["data"]);
2397
- this._notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2375
+ this.notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2398
2376
  }
2399
2377
  }
2400
2378
  }