visualvault-api 1.2.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.
Files changed (45) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +23 -140
  3. package/dist/VVRestApi.cjs +2552 -0
  4. package/dist/VVRestApi.cjs.map +1 -0
  5. package/dist/VVRestApi.d.cts +386 -0
  6. package/dist/VVRestApi.d.ts +386 -0
  7. package/dist/VVRestApi.js +2522 -0
  8. package/dist/VVRestApi.js.map +1 -0
  9. package/{lib/VVRestApi/VVRestApiNodeJs → dist}/config.yml +3 -3
  10. package/dist/constants.cjs +45 -0
  11. package/dist/constants.cjs.map +1 -0
  12. package/dist/constants.d.cts +48 -0
  13. package/dist/constants.d.ts +48 -0
  14. package/dist/constants.js +20 -0
  15. package/dist/constants.js.map +1 -0
  16. package/dist/index.cjs +2572 -0
  17. package/dist/index.cjs.map +1 -0
  18. package/dist/index.d.cts +2 -0
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.js +2541 -0
  21. package/dist/index.js.map +1 -0
  22. package/package.json +46 -70
  23. package/lib/VVRestApi/VVRestApiNodeJs/DocApi.js +0 -66
  24. package/lib/VVRestApi/VVRestApiNodeJs/FormsApi.js +0 -51
  25. package/lib/VVRestApi/VVRestApiNodeJs/NotificationsApi.js +0 -39
  26. package/lib/VVRestApi/VVRestApiNodeJs/ObjectsApi.js +0 -138
  27. package/lib/VVRestApi/VVRestApiNodeJs/StudioApi.js +0 -156
  28. package/lib/VVRestApi/VVRestApiNodeJs/VVRestApi.js +0 -1974
  29. package/lib/VVRestApi/VVRestApiNodeJs/app.js +0 -128
  30. package/lib/VVRestApi/VVRestApiNodeJs/common.js +0 -1598
  31. package/lib/VVRestApi/VVRestApiNodeJs/dts/express.d.ts +0 -125
  32. package/lib/VVRestApi/VVRestApiNodeJs/dts/node.d.ts +0 -1090
  33. package/lib/VVRestApi/VVRestApiNodeJs/files/237de37cf014ee1199a400d49e26e066.js +0 -51
  34. package/lib/VVRestApi/VVRestApiNodeJs/files/437833dc404aed118b0e644bf02b9c8a.js +0 -1
  35. package/lib/VVRestApi/VVRestApiNodeJs/log.js +0 -20
  36. package/lib/VVRestApi/VVRestApiNodeJs/public/favicon.ico +0 -0
  37. package/lib/VVRestApi/VVRestApiNodeJs/routes/scheduledscripts.js +0 -203
  38. package/lib/VVRestApi/VVRestApiNodeJs/routes/scripts.js +0 -215
  39. package/lib/VVRestApi/VVRestApiNodeJs/routes/testScheduledScripts.js +0 -131
  40. package/lib/VVRestApi/VVRestApiNodeJs/samples/SampleScheduledScript.js +0 -90
  41. package/lib/VVRestApi/VVRestApiNodeJs/samples/SendEmailScript.js +0 -51
  42. package/lib/VVRestApi/VVRestApiNodeJs/samples/fileTest.js +0 -60
  43. package/lib/VVRestApi/VVRestApiNodeJs/samples/sampleFormValidationScript.js +0 -126
  44. package/lib/VVRestApi/VVRestApiNodeJs/views/error.ejs +0 -8
  45. package/lib/VVRestApi/VVRestApiNodeJs/views/index.ejs +0 -8
@@ -1,66 +0,0 @@
1
- //DocApi
2
- var common = require('./common');
3
-
4
- module.exports = class DocApi {
5
- constructor(sessionToken, docApiConfig) {
6
- if (!sessionToken['tokenType'] && sessionToken['tokenType'] != 'jwt') {
7
- return;
8
- }
9
-
10
- var yaml = require('js-yaml');
11
- var fs = require('fs');
12
- var yamlConfig = yaml.safeLoad(fs.readFileSync(__dirname + '/config.yml', 'utf8'));
13
- this._httpHelper = new common.httpHelper(sessionToken, yamlConfig);
14
-
15
- this.isEnabled = docApiConfig['isEnabled'] || false;
16
- this.baseUrl = docApiConfig['apiUrl'] || null;
17
- this.roleSecurity = docApiConfig['roleSecurity'] || false;
18
-
19
- }
20
-
21
- async GetRevision(documentRevisionId) {
22
- let resourceUri = this._httpHelper._config.ResourceUri.DocApi.GetRevision;
23
- resourceUri = resourceUri.replace('{id}', documentRevisionId);
24
- const url = this._httpHelper.getUrl(resourceUri);
25
- const opts = { method: 'GET' };
26
-
27
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
28
- }
29
-
30
- async getDocumentOcrStatus(documentRevisionId) {
31
- let resourceUri = this._httpHelper._config.ResourceUri.DocApi.OcrStatus;
32
- resourceUri = resourceUri.replace('{id}', documentRevisionId);
33
- const url = this._httpHelper.getUrl(resourceUri);
34
-
35
- const opts = { method: 'GET' };
36
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
37
- }
38
-
39
- async updateDocumentOcrStatus(documentRevisionId, data) {
40
- let resourceUri = this._httpHelper._config.ResourceUri.DocApi.OcrStatus;
41
- resourceUri = resourceUri.replace('{id}', documentRevisionId);
42
- const url = this._httpHelper.getUrl(resourceUri);
43
-
44
- const opts = { method: 'PUT' };
45
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
46
- }
47
-
48
- async search(criteriaList, searchFolders, excludeFolders, sortBy, sortDirection = 'desc', page = 0, take = 15, archiveType = 0, roleSecurity = false) {
49
- const url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.DocApi.AdvancedSearch);
50
-
51
- var data = {
52
- criteriaList,
53
- searchFolders,
54
- excludeFolders,
55
- sortBy,
56
- sortDirection,
57
- page,
58
- take,
59
- archiveType,
60
- roleSecurity
61
- };
62
-
63
- const options = { method: 'POST'};
64
- return this._httpHelper.doVvClientRequest(url, options, null, data);
65
- }
66
- }
@@ -1,51 +0,0 @@
1
- //forms api
2
- var common = require('./common');
3
-
4
- module.exports = class FormsApi {
5
- constructor(sessionToken, formsApiConfig){
6
- if(!sessionToken['tokenType'] && sessionToken['tokenType'] != 'jwt'){
7
- return;
8
- }
9
-
10
- var yaml = require('js-yaml');
11
- var fs = require('fs');
12
- var yamlConfig = yaml.safeLoad(fs.readFileSync(__dirname + '/config.yml', 'utf8'));
13
- this._httpHelper = new common.httpHelper(sessionToken, yamlConfig);
14
-
15
- this.isEnabled = formsApiConfig['isEnabled'] || false;
16
- this.baseUrl = formsApiConfig['formsApiUrl'] || null;
17
-
18
- if(this.isEnabled){
19
- this.formInstances = new FormInstanceManager(this._httpHelper);
20
- }
21
- }
22
- }
23
-
24
- class FormInstanceManager{
25
- constructor(httpHelper){
26
- this._httpHelper = httpHelper;
27
- }
28
-
29
- async postForm(params, data, formTemplateRevisionId) {
30
- var resourceUri = this._httpHelper._config.ResourceUri.FormsApi.FormInstance;
31
- var url = this._httpHelper.getUrl(resourceUri);
32
- var opts = { method: 'POST' };
33
-
34
- data['formTemplateId'] = formTemplateRevisionId || data['formTemplateId'];
35
-
36
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
37
- }
38
-
39
- async postFormRevision(params, data, formTemplateRevisionId, formId){
40
- var resourceUri = this._httpHelper._config.ResourceUri.FormsApi.FormInstance;
41
- var url = this._httpHelper.getUrl(resourceUri);
42
- var opts = { method: 'PUT' };
43
-
44
- // only add these if provided. params could already have the value
45
- data['formTemplateId'] = formTemplateRevisionId || data['formTemplateId'];
46
- data['formId'] = formId || data['formId'];
47
-
48
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
49
- }
50
- }
51
-
@@ -1,39 +0,0 @@
1
- // Notifications API
2
- var common = require('./common');
3
-
4
- module.exports = class NotificationsApi {
5
- constructor(sessionToken, notificationsApiConfig) {
6
- if(!sessionToken['tokenType'] && sessionToken['tokenType'] != 'jwt'){
7
- return;
8
- }
9
-
10
- var yaml = require('js-yaml');
11
- var fs = require('fs');
12
- var yamlConfig = yaml.safeLoad(fs.readFileSync(__dirname + '/config.yml', 'utf8'));
13
- console.log("Before")
14
- this._httpHelper = new common.httpHelper(sessionToken, yamlConfig);
15
- console.log('After');
16
-
17
- this.isEnabled = notificationsApiConfig['isEnabled'] || false;
18
- this.baseUrl = notificationsApiConfig['apiUrl'] || null;
19
-
20
- if (this.isEnabled) {
21
- this.users = new UserNotificationsManager(this._httpHelper);
22
- }
23
- }
24
- }
25
-
26
- class UserNotificationsManager {
27
- constructor (httpHelper) {
28
- this._httpHelper = httpHelper;
29
- }
30
-
31
- async forceUIRefresh(userGuid) {
32
- var resourceUri = this._httpHelper._config.ResourceUri.NotificationsApi.ForceUIRefresh.replace('{id}', userGuid);
33
- var url = this._httpHelper.getUrl(resourceUri);
34
- var opts = { method: 'POST' };
35
- var params = {};
36
- var data = {};
37
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
38
- }
39
- }
@@ -1,138 +0,0 @@
1
- //objects api
2
- var common = require('./common');
3
-
4
- module.exports = class ObjectsApi {
5
- constructor(sessionToken, objectsApiConfig) {
6
- if(!sessionToken['tokenType'] && sessionToken['tokenType'] != 'jwt') {
7
- return;
8
- }
9
-
10
- var yaml = require('js-yaml');
11
- var fs = require('fs');
12
- var yamlConfig = yaml.safeLoad(fs.readFileSync(__dirname + '/config.yml', 'utf8'));
13
- this._httpHelper = new common.httpHelper(sessionToken, yamlConfig);
14
-
15
- this.isEnabled = objectsApiConfig['isEnabled'] || false;
16
- this.baseUrl = objectsApiConfig['apiUrl'] || null;
17
- }
18
-
19
- /**
20
- * Retrieves a list of available models
21
- * @param {object} params - Optional URL parameters to include in the request
22
- */
23
- async getModels(params) {
24
- var resourceUri = this._httpHelper._config.ResourceUri.ObjectsApi.Models;
25
- var url = this._httpHelper.getUrl(resourceUri);
26
- var opts = { method: 'GET' };
27
-
28
- params = params || {};
29
-
30
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
31
- }
32
-
33
- /**
34
- * Retrieves a specific model by its ID
35
- * @param {string} modelId - The ID (Guid) for the requested model
36
- * @param {object} params - Optional URL parameters to include in the request
37
- */
38
- async getModelById(modelId, params) {
39
- var resourceUri = this._httpHelper._config.ResourceUri.ObjectsApi.ModelById;
40
- resourceUri = resourceUri.replace('{id}', modelId);
41
- var url = this._httpHelper.getUrl(resourceUri);
42
- var opts = { method: 'GET' };
43
-
44
- params = params || {};
45
-
46
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
47
- }
48
-
49
- /**
50
- * Retrieves a specific object by its ID
51
- * @param {string} objectId - The ID (Guid) for the requested object
52
- * @param {object} params - Optional URL parameters to include in the request
53
- */
54
- async getObject(objectId, params) {
55
- var resourceUri = this._httpHelper._config.ResourceUri.ObjectsApi.ObjectById;
56
- resourceUri = resourceUri.replace('{id}', objectId);
57
- var url = this._httpHelper.getUrl(resourceUri);
58
- var opts = { method: 'GET' };
59
-
60
- params = params || {};
61
-
62
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
63
- }
64
-
65
- /**
66
- * Retrieves a paged list of objects associated with a given model
67
- * @param {string} modelId - The ID (Guid) for the requested model to search
68
- * @param {object} data - Data to send in the request body
69
- * @param {object} params - Optional URL parameters to include in the request
70
- */
71
- async getObjectsByModelId(modelId, data, params) {
72
- var resourceUri = this._httpHelper._config.ResourceUri.ObjectsApi.ObjectSearchByModelId;
73
- resourceUri = resourceUri.replace('{modelId}', modelId);
74
- var url = this._httpHelper.getUrl(resourceUri);
75
- var opts = { method: 'POST' };
76
-
77
- data = data || {};
78
- params = params || {};
79
-
80
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
81
- }
82
-
83
- /**
84
- * Creates a new object adhering to a given model
85
- * @param {string} modelId - The ID (Guid) used to create a new object for that model
86
- * @param {object} data - Data to send in the request body
87
- * @param {object} params - Optional URL parameters to include in the request
88
- */
89
- async createObject(modelId, data, params) {
90
- var resourceUri = this._httpHelper._config.ResourceUri.ObjectsApi.Object;
91
- var url = this._httpHelper.getUrl(resourceUri);
92
- var opts = { method: 'POST' };
93
-
94
- data = data || {};
95
- params = params || {};
96
-
97
- data['modelId'] = modelId || data['modelId'];
98
-
99
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
100
- }
101
-
102
- /**
103
- * Updates an existing object by its ID (Guid) and revision ID (Guid)
104
- * @param {string} objectId - The ID (Guid) for the requested object to update
105
- * @param {string} objectRevisionId - The revision ID (Guid) for the requested object to update
106
- * @param {object} data - Data to send in the request body
107
- * @param {object} params - Optional URL parameters to include in the request
108
- */
109
- async updateObject(objectId, objectRevisionId, data, params) {
110
- var resourceUri = this._httpHelper._config.ResourceUri.ObjectsApi.ObjectById;
111
- resourceUri = resourceUri.replace('{id}', objectId);
112
- var url = this._httpHelper.getUrl(resourceUri);
113
- var opts = { method: 'PUT' };
114
-
115
- data = data || {};
116
- params = params || {};
117
-
118
- data['revisionId'] = objectRevisionId || data['revisionId'];
119
-
120
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
121
- }
122
-
123
- /**
124
- * Deletes an existing object by its ID (Guid)
125
- * @param {string} objectId - The ID (Guid) for the requested object to delete
126
- * @param {object} params - Optional URL parameters to include in the request
127
- */
128
- async deleteObject(objectId, params) {
129
- var resourceUri = this._httpHelper._config.ResourceUri.ObjectsApi.ObjectById;
130
- resourceUri = resourceUri.replace('{id}', objectId);
131
- var url = this._httpHelper.getUrl(resourceUri);
132
- var opts = { method: 'DELETE' };
133
-
134
- params = params || {};
135
-
136
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
137
- }
138
- }
@@ -1,156 +0,0 @@
1
- //studio api
2
- var common = require('./common');
3
-
4
- module.exports = class StudioApi {
5
- constructor(sessionToken, studioApiConfig){
6
- if(!sessionToken['tokenType'] && sessionToken['tokenType'] != 'jwt'){
7
- return;
8
- }
9
-
10
- var yaml = require('js-yaml');
11
- var fs = require('fs');
12
- var yamlConfig = yaml.safeLoad(fs.readFileSync(__dirname + '/config.yml', 'utf8'));
13
- this._httpHelper = new common.httpHelper(sessionToken, yamlConfig);
14
-
15
- this.isEnabled = studioApiConfig['isEnabled'] || false;
16
- this.baseUrl = studioApiConfig['studioApiUrl'] || null;
17
- this.apiUrl = '';
18
-
19
- if(this.isEnabled){
20
- this.workflow = new WorkflowManager(this._httpHelper);
21
- this.permissions = new RolesAndPermissionsManager(this._httpHelper);
22
- }
23
- }
24
- }
25
-
26
- /** Manage Workflows */
27
- class WorkflowManager{
28
- constructor(httpHelper){
29
- this._httpHelper = httpHelper;
30
- }
31
-
32
- /** Gets the latest published workflow by Id*/
33
- async getWorkflow(workflowId){
34
- var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.WorkflowLatestPublishedId.replace('{id}', workflowId);
35
- var url = this._httpHelper.getUrl(resourceUri);
36
- var opts = { method: 'GET' };
37
- var data = {};
38
- var params = {};
39
-
40
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
41
- }
42
-
43
- /** Gets the latest published workflow by Name */
44
- async getWorkflowByName(workflowName){
45
- var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.WorkflowLatestPublished;
46
- var url = this._httpHelper.getUrl(resourceUri);
47
- var opts = { method: 'GET' };
48
- var data = {};
49
- var params = { name: workflowName };
50
-
51
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
52
- }
53
-
54
- /** Gets workflow variables assigned to the workflow */
55
- async getWorkflowVariables(params, workflowId){
56
- var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.WorkflowVariables.replace('{id}', workflowId);
57
- var url = this._httpHelper.getUrl(resourceUri);
58
- var opts = { method: 'GET' };
59
- var data = {};
60
- params = params || {};
61
-
62
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
63
- }
64
-
65
- /**
66
- * Triggers workflow
67
- * @param {string} workflowId
68
- * @param {number} workflowRevision
69
- * @param {string} objectId
70
- * @param {object[]} workflowVariables - workflow values to be submitted to the workflow
71
- * * @param {string} workflowVariables[].name = name of variable
72
- * * @param {*} workflowVariables[].value - value to be passed
73
- * * @param {number} workflowVariables[].dataType - Text: 1, Number: 2, Date: 3, Boolean: 4
74
- */
75
- async triggerWorkflow(workflowId, workflowRevision, objectId, workflowVariables){
76
- var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.WorkflowRun.replace('{id}', workflowId).replace('{revision}', workflowRevision);
77
- var url = this._httpHelper.getUrl(resourceUri);
78
- var opts = { method: 'POST' };
79
- var data ={
80
- objectId: objectId,
81
- reference: 'API',
82
- data: {
83
- workflowVariables: workflowVariables,
84
- dataSetVariables: []
85
- }
86
- };
87
- var params = {};
88
-
89
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
90
- }
91
-
92
- /**
93
- * Terminates the workflow instance
94
- * @param {string} workflowId
95
- * @param {string} instanceId
96
- * @returns
97
- */
98
- async terminateWorkflow(workflowId, instanceId){
99
- var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.WorkflowTerminate.replace('{workflowId}', workflowId).replace('{instanceId}', instanceId);
100
- var url = this._httpHelper.getUrl(resourceUri);
101
- var opts = { method: 'POST' };
102
- var data ={}
103
- var params = {};
104
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
105
- }
106
-
107
- /**
108
- * Returns workflow history for an object under the provided workflow
109
- * @param {string} workflowId
110
- * @param {string} objectId
111
- * @returns
112
- */
113
- async GetWorkflowHistoryForObject(objectId, workflowId){
114
- var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.WorkflowHistoryObject.replace('{workflowId}', workflowId).replace('{objectId}', objectId);
115
- var url = this._httpHelper.getUrl(resourceUri);
116
- var opts = { method: 'GET' };
117
- var data ={}
118
- var params = {};
119
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
120
- }
121
-
122
- /**
123
- * Returns the running workflow, if any, for an object under the provided workflow
124
- * @param {string} workflowId
125
- * @param {string} objectId
126
- * @returns
127
- */
128
- async GetRunningWorkflowForObject(objectId, workflowId){
129
- var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.WorkflowHistoryRunningObject.replace('{workflowId}', workflowId).replace('{objectId}', objectId);
130
- var url = this._httpHelper.getUrl(resourceUri);
131
- var opts = { method: 'GET' };
132
- var data ={}
133
- var params = {};
134
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
135
- }
136
- }
137
-
138
- class RolesAndPermissionsManager {
139
- constructor(httpHelper) {
140
- this._httpHelper = httpHelper;
141
- }
142
-
143
- /**
144
- * Retrieves available features for the requesting user
145
- * @param {object} params - Optional URL parameters to include in the request
146
- */
147
- async getUserFeatures(params) {
148
- var resourceUri = this._httpHelper._config.ResourceUri.StudioApi.ResourceUserFeatures;
149
- var url = this._httpHelper.getUrl(resourceUri);
150
- var opts = { method: 'GET' };
151
- var data = {};
152
- params = params || {};
153
-
154
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
155
- }
156
- }