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.
@@ -64,7 +64,7 @@ declare class CurrentUserManager {
64
64
  getCurrentUser(params?: any): Promise<string>;
65
65
  }
66
66
 
67
- declare class DocumentInstanceManager {
67
+ declare class DocumentManager {
68
68
  constructor(httpHelper: any);
69
69
  _httpHelper: any;
70
70
  GetRevision(documentRevisionId: any): Promise<any>;
@@ -79,7 +79,7 @@ declare class DocApi {
79
79
  isEnabled: any;
80
80
  baseUrl: any;
81
81
  roleSecurity: any;
82
- documentInstances: DocumentInstanceManager;
82
+ documents: DocumentManager;
83
83
  }
84
84
 
85
85
  declare class FormInstanceManager {
@@ -97,7 +97,7 @@ declare class FormsApi {
97
97
  formInstances: FormInstanceManager;
98
98
  }
99
99
 
100
- declare class ModelsManager {
100
+ declare class ModelManager {
101
101
  constructor(httpHelper: any);
102
102
  _httpHelper: any;
103
103
  /**
@@ -113,7 +113,7 @@ declare class ModelsManager {
113
113
  getModelById(modelId: string, params: object): Promise<any>;
114
114
  }
115
115
 
116
- declare class ObjectsManager {
116
+ declare class ObjectManager {
117
117
  constructor(httpHelper: any);
118
118
  _httpHelper: any;
119
119
  /**
@@ -157,8 +157,8 @@ declare class ObjectsApi {
157
157
  _httpHelper: HttpHelper;
158
158
  isEnabled: any;
159
159
  baseUrl: any;
160
- models: ModelsManager;
161
- objects: ObjectsManager;
160
+ models: ModelManager;
161
+ objects: ObjectManager;
162
162
  }
163
163
 
164
164
  declare class WorkflowManager {
@@ -205,12 +205,23 @@ declare class WorkflowManager {
205
205
  GetRunningWorkflowForObject(objectId: string, workflowId: string): Promise<any>;
206
206
  }
207
207
 
208
+ declare class RolesAndPermissionsManager {
209
+ constructor(httpHelper: any);
210
+ _httpHelper: any;
211
+ /**
212
+ * Retrieves available features for the requesting user
213
+ * @param {object} params - Optional URL parameters to include in the request
214
+ */
215
+ getUserFeatures(params: object): Promise<any>;
216
+ }
217
+
208
218
  declare class StudioApi {
209
219
  constructor(sessionToken: any, studioApiConfig: any);
210
220
  _httpHelper: HttpHelper;
211
221
  isEnabled: any;
212
222
  baseUrl: any;
213
223
  workflow: WorkflowManager;
224
+ permissions: RolesAndPermissionsManager;
214
225
  }
215
226
 
216
227
  declare class UserNotificationsManager {
@@ -305,11 +316,11 @@ declare class VVClient {
305
316
  yamlConfig: any;
306
317
  _httpHelper: HttpHelper;
307
318
  currentUser: CurrentUserManager;
308
- _docApi: DocApi;
309
- _formsApi: FormsApi;
310
- _objectsApi: ObjectsApi;
311
- _studioApi: StudioApi;
312
- _notificationsApi: NotificationsApi;
319
+ docApi: DocApi;
320
+ formsApi: FormsApi;
321
+ objectsApi: ObjectsApi;
322
+ studioApi: StudioApi;
323
+ notificationsApi: NotificationsApi;
313
324
  createDocApi(sessionToken: any): Promise<void>;
314
325
  createFormsApi(sessionToken: any): Promise<void>;
315
326
  createObjectsApi(sessionToken: any): Promise<void>;
@@ -64,7 +64,7 @@ declare class CurrentUserManager {
64
64
  getCurrentUser(params?: any): Promise<string>;
65
65
  }
66
66
 
67
- declare class DocumentInstanceManager {
67
+ declare class DocumentManager {
68
68
  constructor(httpHelper: any);
69
69
  _httpHelper: any;
70
70
  GetRevision(documentRevisionId: any): Promise<any>;
@@ -79,7 +79,7 @@ declare class DocApi {
79
79
  isEnabled: any;
80
80
  baseUrl: any;
81
81
  roleSecurity: any;
82
- documentInstances: DocumentInstanceManager;
82
+ documents: DocumentManager;
83
83
  }
84
84
 
85
85
  declare class FormInstanceManager {
@@ -97,7 +97,7 @@ declare class FormsApi {
97
97
  formInstances: FormInstanceManager;
98
98
  }
99
99
 
100
- declare class ModelsManager {
100
+ declare class ModelManager {
101
101
  constructor(httpHelper: any);
102
102
  _httpHelper: any;
103
103
  /**
@@ -113,7 +113,7 @@ declare class ModelsManager {
113
113
  getModelById(modelId: string, params: object): Promise<any>;
114
114
  }
115
115
 
116
- declare class ObjectsManager {
116
+ declare class ObjectManager {
117
117
  constructor(httpHelper: any);
118
118
  _httpHelper: any;
119
119
  /**
@@ -157,8 +157,8 @@ declare class ObjectsApi {
157
157
  _httpHelper: HttpHelper;
158
158
  isEnabled: any;
159
159
  baseUrl: any;
160
- models: ModelsManager;
161
- objects: ObjectsManager;
160
+ models: ModelManager;
161
+ objects: ObjectManager;
162
162
  }
163
163
 
164
164
  declare class WorkflowManager {
@@ -205,12 +205,23 @@ declare class WorkflowManager {
205
205
  GetRunningWorkflowForObject(objectId: string, workflowId: string): Promise<any>;
206
206
  }
207
207
 
208
+ declare class RolesAndPermissionsManager {
209
+ constructor(httpHelper: any);
210
+ _httpHelper: any;
211
+ /**
212
+ * Retrieves available features for the requesting user
213
+ * @param {object} params - Optional URL parameters to include in the request
214
+ */
215
+ getUserFeatures(params: object): Promise<any>;
216
+ }
217
+
208
218
  declare class StudioApi {
209
219
  constructor(sessionToken: any, studioApiConfig: any);
210
220
  _httpHelper: HttpHelper;
211
221
  isEnabled: any;
212
222
  baseUrl: any;
213
223
  workflow: WorkflowManager;
224
+ permissions: RolesAndPermissionsManager;
214
225
  }
215
226
 
216
227
  declare class UserNotificationsManager {
@@ -305,11 +316,11 @@ declare class VVClient {
305
316
  yamlConfig: any;
306
317
  _httpHelper: HttpHelper;
307
318
  currentUser: CurrentUserManager;
308
- _docApi: DocApi;
309
- _formsApi: FormsApi;
310
- _objectsApi: ObjectsApi;
311
- _studioApi: StudioApi;
312
- _notificationsApi: NotificationsApi;
319
+ docApi: DocApi;
320
+ formsApi: FormsApi;
321
+ objectsApi: ObjectsApi;
322
+ studioApi: StudioApi;
323
+ notificationsApi: NotificationsApi;
313
324
  createDocApi(sessionToken: any): Promise<void>;
314
325
  createFormsApi(sessionToken: any): Promise<void>;
315
326
  createObjectsApi(sessionToken: any): Promise<void>;
package/dist/VVRestApi.js CHANGED
@@ -574,9 +574,9 @@ var common_default = {
574
574
  authorize: Authorize
575
575
  };
576
576
 
577
- // lib/docApi/documentInstanceManager.js
577
+ // lib/docApi/documentManager.js
578
578
  init_esm_shims();
579
- var DocumentInstanceManager = class {
579
+ var DocumentManager = class {
580
580
  constructor(httpHelper) {
581
581
  this._httpHelper = httpHelper;
582
582
  }
@@ -637,7 +637,7 @@ var DocApi = class {
637
637
  this.baseUrl = docApiConfig["apiUrl"] || null;
638
638
  this.roleSecurity = docApiConfig["roleSecurity"] || false;
639
639
  if (this.isEnabled) {
640
- this.documentInstances = new DocumentInstanceManager(this._httpHelper);
640
+ this.documents = new DocumentManager(this._httpHelper);
641
641
  }
642
642
  }
643
643
  };
@@ -696,9 +696,9 @@ var FormsApi_default = FormsApi;
696
696
  // lib/ObjectsApi.js
697
697
  init_esm_shims();
698
698
 
699
- // lib/objectsApi/modelsManager.js
699
+ // lib/objectsApi/modelManager.js
700
700
  init_esm_shims();
701
- var ModelsManager = class {
701
+ var ModelManager = class {
702
702
  constructor(httpHelper) {
703
703
  this._httpHelper = httpHelper;
704
704
  }
@@ -727,11 +727,11 @@ var ModelsManager = class {
727
727
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
728
728
  }
729
729
  };
730
- var modelsManager_default = ModelsManager;
730
+ var modelManager_default = ModelManager;
731
731
 
732
- // lib/objectsApi/objectsManager.js
732
+ // lib/objectsApi/objectManager.js
733
733
  init_esm_shims();
734
- var ObjectsManager = class {
734
+ var ObjectManager = class {
735
735
  constructor(httpHelper) {
736
736
  this._httpHelper = httpHelper;
737
737
  }
@@ -809,7 +809,7 @@ var ObjectsManager = class {
809
809
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
810
810
  }
811
811
  };
812
- var objectsManager_default = ObjectsManager;
812
+ var objectManager_default = ObjectManager;
813
813
 
814
814
  // lib/ObjectsApi.js
815
815
  import yaml4 from "js-yaml";
@@ -828,8 +828,8 @@ var ObjectsApi = class {
828
828
  this.isEnabled = objectsApiConfig["isEnabled"] || false;
829
829
  this.baseUrl = objectsApiConfig["apiUrl"] || null;
830
830
  if (this.isEnabled) {
831
- this.models = new modelsManager_default(this._httpHelper);
832
- this.objects = new objectsManager_default(this._httpHelper);
831
+ this.models = new modelManager_default(this._httpHelper);
832
+ this.objects = new objectManager_default(this._httpHelper);
833
833
  }
834
834
  }
835
835
  };
@@ -938,6 +938,27 @@ var WorkflowManager = class {
938
938
  };
939
939
  var workflowManager_default = WorkflowManager;
940
940
 
941
+ // lib/studioApi/rolesAndPermissionsManager.js
942
+ init_esm_shims();
943
+ var RolesAndPermissionsManager = class {
944
+ constructor(httpHelper) {
945
+ this._httpHelper = httpHelper;
946
+ }
947
+ /**
948
+ * Retrieves available features for the requesting user
949
+ * @param {object} params - Optional URL parameters to include in the request
950
+ */
951
+ async getUserFeatures(params) {
952
+ var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.ResourceUserFeatures;
953
+ var url = this._httpHelper.getUrl(resourceUri);
954
+ var opts = { method: "GET" };
955
+ var data = {};
956
+ params = params || {};
957
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
958
+ }
959
+ };
960
+ var rolesAndPermissionsManager_default = RolesAndPermissionsManager;
961
+
941
962
  // lib/StudioApi.js
942
963
  import yaml5 from "js-yaml";
943
964
  import fs5 from "fs";
@@ -956,6 +977,7 @@ var StudioApi = class {
956
977
  this.baseUrl = studioApiConfig["studioApiUrl"] || null;
957
978
  if (this.isEnabled) {
958
979
  this.workflow = new workflowManager_default(this._httpHelper);
980
+ this.permissions = new rolesAndPermissionsManager_default(this._httpHelper);
959
981
  }
960
982
  }
961
983
  };
@@ -1743,9 +1765,8 @@ var UsersManager = class {
1743
1765
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
1744
1766
  }
1745
1767
  getCurrentUser() {
1746
- const resourceUri = this._httpHelper._config.ResourceUri.UsersWhoAmI;
1747
- const baseUrl = this._httpHelper._sessionToken.baseUrl;
1748
- const url = baseUrl + "/api/v1" + resourceUri;
1768
+ const resourceUri = this._httpHelper._config.ResourceUri.UsersMe;
1769
+ const url = this._httpHelper.getUrl(resourceUri);
1749
1770
  const opts = { method: "GET" };
1750
1771
  const params = [];
1751
1772
  return this._httpHelper.doVvClientRequest(url, opts, params, null);
@@ -2041,6 +2062,18 @@ var DocumentsManager = class {
2041
2062
  };
2042
2063
  return this._httpHelper.doVvClientRequest(url, opts, null, data);
2043
2064
  }
2065
+ getDocumentWebDavUrl(documentId) {
2066
+ const resourceUri = this._httpHelper._config.ResourceUri.DocumentsWebDavUrl.replace("{id}", documentId);
2067
+ const url = this._httpHelper.getUrl(resourceUri);
2068
+ const opts = { method: "GET" };
2069
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
2070
+ }
2071
+ getDocumentWopiUrl(documentId) {
2072
+ const resourceUri = this._httpHelper._config.ResourceUri.DocumentsWopiUrl.replace("{id}", documentId);
2073
+ const url = this._httpHelper.getUrl(resourceUri);
2074
+ const opts = { method: "GET" };
2075
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
2076
+ }
2044
2077
  };
2045
2078
 
2046
2079
  // lib/vvRestApi/projectsManager.js
@@ -2250,66 +2283,11 @@ var VVClient = class {
2250
2283
  this.securityMembers = new SecurityMembersManager(this._httpHelper);
2251
2284
  this.layouts = new LayoutsManager(this._httpHelper);
2252
2285
  this.reports = new ReportsManager(this._httpHelper);
2253
- this._docApi = null;
2254
- Object.defineProperties(this, {
2255
- docApi: {
2256
- get: function() {
2257
- if (this._docApi != null && this._docApi.isEnabled && this._docApi.baseUrl) {
2258
- return this._docApi;
2259
- } else {
2260
- throw new ReferenceError("Document Api not enabled");
2261
- }
2262
- }
2263
- }
2264
- });
2265
- this._formsApi = null;
2266
- Object.defineProperties(this, {
2267
- formsApi: {
2268
- get: function() {
2269
- if (this._formsApi != null && this._formsApi.isEnabled && this._formsApi.baseUrl) {
2270
- return this._formsApi;
2271
- } else {
2272
- throw new ReferenceError("Forms Api not enabled");
2273
- }
2274
- }
2275
- }
2276
- });
2277
- this._objectsApi = null;
2278
- Object.defineProperties(this, {
2279
- objectsApi: {
2280
- get: function() {
2281
- if (this._objectsApi != null && this._objectsApi.isEnabled && this._objectsApi.baseUrl) {
2282
- return this._objectsApi;
2283
- } else {
2284
- throw new ReferenceError("Objects Api not enabled");
2285
- }
2286
- }
2287
- }
2288
- });
2289
- this._studioApi = null;
2290
- Object.defineProperties(this, {
2291
- studioApi: {
2292
- get: function() {
2293
- if (this._studioApi != null && this._studioApi.isEnabled && this._studioApi.baseUrl) {
2294
- return this._studioApi;
2295
- } else {
2296
- throw new ReferenceError("Studio Api not enabled");
2297
- }
2298
- }
2299
- }
2300
- });
2301
- this._notificationsApi = null;
2302
- Object.defineProperties(this, {
2303
- notificationsApi: {
2304
- get: function() {
2305
- if (this._notificationsApi != null && this._notificationsApi.isEnabled && this._notificationsApi.baseUrl) {
2306
- return this._notificationsApi;
2307
- } else {
2308
- throw new ReferenceError("Notifications Api not enabled");
2309
- }
2310
- }
2311
- }
2312
- });
2286
+ this.docApi = null;
2287
+ this.formsApi = null;
2288
+ this.objectsApi = null;
2289
+ this.studioApi = null;
2290
+ this.notificationsApi = null;
2313
2291
  }
2314
2292
  async createDocApi(sessionToken) {
2315
2293
  const docApiConfigResponse = JSON.parse(await this.configuration.getDocApiConfig());
@@ -2318,12 +2296,12 @@ var VVClient = class {
2318
2296
  docApiSession.baseUrl = docApiConfigResponse.data["apiUrl"];
2319
2297
  docApiSession.apiUrl = this.yamlConfig.DocApiUri;
2320
2298
  if (docApiSession["tokenType"] == "jwt") {
2321
- this._docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2299
+ this.docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2322
2300
  } else if (this.users) {
2323
2301
  const jwtResponse = JSON.parse(await this.users.getUserJwt(docApiSession.audience));
2324
2302
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2325
2303
  docApiSession.convertToJwt(jwtResponse["data"]);
2326
- this._docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2304
+ this.docApi = new DocApi_default(docApiSession, docApiConfigResponse.data);
2327
2305
  }
2328
2306
  }
2329
2307
  }
@@ -2335,12 +2313,12 @@ var VVClient = class {
2335
2313
  formsApiSession.baseUrl = formsApiConfigResponse.data["formsApiUrl"];
2336
2314
  formsApiSession.apiUrl = this.yamlConfig.FormsApiUri;
2337
2315
  if (formsApiSession["tokenType"] == "jwt") {
2338
- this._formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2316
+ this.formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2339
2317
  } else if (this.users) {
2340
2318
  const jwtResponse = JSON.parse(await this.users.getUserJwt(formsApiSession.audience));
2341
2319
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2342
2320
  formsApiSession.convertToJwt(jwtResponse["data"]);
2343
- this._formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2321
+ this.formsApi = new FormsApi_default(formsApiSession, formsApiConfigResponse.data);
2344
2322
  }
2345
2323
  }
2346
2324
  }
@@ -2352,12 +2330,12 @@ var VVClient = class {
2352
2330
  objectsApiSession.baseUrl = objectsApiConfigResponse.data["apiUrl"];
2353
2331
  objectsApiSession.apiUrl = "";
2354
2332
  if (objectsApiSession["tokenType"] == "jwt") {
2355
- this._objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2333
+ this.objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2356
2334
  } else if (this.users) {
2357
2335
  const jwtResponse = JSON.parse(await this.users.getUserJwt(objectsApiSession.audience));
2358
2336
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2359
2337
  objectsApiSession.convertToJwt(jwtResponse["data"]);
2360
- this._objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2338
+ this.objectsApi = new ObjectsApi_default(objectsApiSession, objectsApiConfigResponse.data);
2361
2339
  }
2362
2340
  }
2363
2341
  }
@@ -2369,12 +2347,12 @@ var VVClient = class {
2369
2347
  studioApiSession.baseUrl = studioApiConfigResponse.data["studioApiUrl"];
2370
2348
  studioApiSession.apiUrl = "";
2371
2349
  if (studioApiSession["tokenType"] == "jwt") {
2372
- this._studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2350
+ this.studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2373
2351
  } else if (this.users) {
2374
2352
  const jwtResponse = JSON.parse(await this.users.getUserJwt(studioApiSession.audience));
2375
2353
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2376
2354
  studioApiSession.convertToJwt(jwtResponse["data"]);
2377
- this._studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2355
+ this.studioApi = new StudioApi_default(studioApiSession, studioApiConfigResponse.data);
2378
2356
  }
2379
2357
  }
2380
2358
  }
@@ -2386,12 +2364,12 @@ var VVClient = class {
2386
2364
  notificationsApiSession.baseUrl = notificationsApiConfigResponse.data["apiUrl"];
2387
2365
  notificationsApiSession.apiUrl = this.yamlConfig.NotificationsApiUri;
2388
2366
  if (notificationsApiSession["tokenType"] == "jwt") {
2389
- this._notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2367
+ this.notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2390
2368
  } else if (this.users) {
2391
2369
  const jwtResponse = JSON.parse(await this.users.getUserJwt(notificationsApiSession.audience));
2392
2370
  if (jwtResponse["data"] && jwtResponse["data"]["token"]) {
2393
2371
  notificationsApiSession.convertToJwt(jwtResponse["data"]);
2394
- this._notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2372
+ this.notificationsApi = new NotificationsApi_default(notificationsApiSession, notificationsApiConfigResponse.data);
2395
2373
  }
2396
2374
  }
2397
2375
  }