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,90 +0,0 @@
1
- 
2
-
3
-
4
- module.exports.getCredentials = function () {
5
- var options = {};
6
- options.customerAlias = "sampleCustomer";
7
- options.databaseAlias = "main";
8
- options.userId = "sample.user";
9
- options.password = "mypassword";
10
- options.clientId = "ce9e042d-87f5-42d5-97af-435aff70152b";
11
- options.clientSecret = "/PbgaChHbPoboS/1s07E6pfHCNFSdqPsD3B/yiKHfHw=";
12
-
13
-
14
- return options;
15
- };
16
-
17
- module.exports.main = function (vvClient, response) {
18
- console.log('In user Main method');
19
- var meta = { code: 200, error: '' };
20
-
21
- try {
22
- //setup parameters for making requests to VisualVault
23
- var formParams = {};
24
- formParams.fields = "id, name, description, revision";
25
-
26
- var siteParams = {};
27
- siteParams.fields = "id, name, sitetype";
28
-
29
- var foldersData = {};
30
- foldersData.q = '';
31
- foldersData.fields = 'id,name';
32
- foldersData.folderpath = '/General';
33
- foldersData.metaonly = 'true';
34
-
35
- var Q = require('q');
36
-
37
- //make request to VisualVault
38
- Q
39
- .allSettled(
40
- [
41
- vvClient.forms.getFormTemplates(formParams),
42
- vvClient.sites.getSites(siteParams),
43
- vvClient.library.getFolders(foldersData)
44
-
45
- ]
46
- )
47
- .then(
48
- function (promises) {
49
- console.log("Results count: " + promises.length);
50
-
51
- //example of accessing returned data from request to VisualVault
52
- var promiseFormTemplates = promises[0];
53
- if (promiseFormTemplates.state == 'fulfilled') {
54
- var responseData = JSON.parse(promiseFormTemplates.value);
55
-
56
- var formTemplates = responseData.data;
57
-
58
- console.log("Listing Form Templates");
59
- for (var x = 0; x < formTemplates.length; x++) {
60
- var formTemplate = formTemplates[x];
61
- console.log('FormTemplate Id: ' + formTemplate.id);
62
- console.log('FormTemplate Name: ' + formTemplate.name);
63
- }
64
- }
65
-
66
- meta.code = 200;
67
- meta.error = "";
68
- response.json(200, meta);
69
- }
70
- )
71
- .fail(
72
- function (error) {
73
- console.log(error);
74
-
75
- meta.code = 400;
76
- meta.error = "An error occurred while accessing VisualVault";
77
- response.json(200, meta);
78
- }
79
- );
80
-
81
-
82
-
83
-
84
- } catch (ex) {
85
- meta.code = 400;
86
- meta.error = "An exception occurred while performing this scheduled script";
87
- response.json(200, meta);
88
- }
89
-
90
- };
@@ -1,51 +0,0 @@
1
- 
2
- // Send Email using VisualVault API
3
-
4
- var logger = require('../log');
5
-
6
- module.exports.getCredentials = function () {
7
- var options = {};
8
-
9
- //Your customer name found in the VisualVault URL
10
- options.customerAlias = "ACME";
11
-
12
- //Your customer database name found in the VisualVault URL
13
- options.databaseAlias = "main5";
14
-
15
- //User account credentials
16
- options.userId = "vault.config";
17
- options.password = "p";
18
-
19
- //Developer account or registered OAuth application credentials
20
- options.clientId = "fbb02e0c-2e97-4527-a6d7-9438d8b7b23c";
21
- options.clientSecret = "bBb+IlcCV5duoyyHvrYYamSrDVMGf+rgJ4Gbhn6R7N4=";
22
-
23
- return options;
24
- };
25
-
26
- module.exports.main = function (vvClient, response) {
27
- var currentDate = new Date();
28
- var Q = require('q');
29
-
30
- var emailParams = '';
31
- var emailData = {};
32
- emailData.recipients = 'someone@visualvault.com';
33
- emailData.body = 'test';
34
- emailData.subject = 'scheduled script test';
35
-
36
- //Q is a node package used to create promise objects
37
- //Node.js scripts are asynchronous!
38
-
39
- Q
40
- .allSettled(
41
- [
42
- vvClient.email.postEmails(emailParams, emailData)
43
- ]
44
- )
45
- .then(function (result) {
46
- logger.info("PostEmails success");
47
- })
48
- .fail(function (error) {
49
- logger.info("Error response from postEmails: " + error.message);
50
- });
51
- }
@@ -1,60 +0,0 @@
1
- // credentials
2
- module.exports.getCredentials = function () {
3
- var options = {};
4
- options.customerAlias = "customer";
5
- options.databaseAlias = "alias";
6
- options.userId = "userId";
7
- options.password = "password";
8
- options.clientId = "clientId";
9
- options.clientSecret = "clientSecret";
10
-
11
- return options;
12
- };
13
-
14
- module.exports.main = function (vvClient, response, token) {
15
- var Q = require('q');
16
- // message for writing file called
17
- function err(){console.log("wrote file!");}
18
- // first promise to get related documents of a form by id
19
- Q
20
- .when(
21
- // get form related documents
22
- vvClient.forms.getFormRelatedDocs('34260ABE-22C1-E511-A698-E094676F83F7')
23
- )
24
-
25
- .then(
26
- function (result) {
27
- var response = JSON.parse(result);
28
- // grabs the first id from response object
29
- var id = response.data[0].id;
30
- // 2nd promise taking in the id from the first promise and passing it into the second.
31
- Q
32
- .when(
33
- // request file bytes by id
34
- vvClient.files.getFileBytesId(id)
35
- )
36
- .then(
37
- function (result) {
38
- // the result will be the buffer (byte array) of requested file.
39
- var bytes = result;
40
- // log bytes to console or proceed with buisness logic.
41
- // Here I write the bytes to the file system.
42
- console.log(bytes);
43
- var fs = require('fs');
44
- fs.writeFile("c:/nodeTest/textNEW.xlsx",bytes,err);
45
- }
46
- )
47
-
48
- .fail(
49
- function (error) {
50
- console.log(error);
51
- });
52
-
53
- }
54
- )
55
-
56
- .fail(
57
- function (error) {
58
- console.log(error);
59
- });
60
- };
@@ -1,126 +0,0 @@
1
- 
2
-
3
-
4
- module.exports.getCredentials = function () {
5
- var options = {};
6
- options.customerAlias = "sampleCustomer";
7
- options.databaseAlias = "main";
8
- options.userId = "sample.user";
9
- options.password = "mypassword";
10
- options.clientId = "ce9e042d-87f5-42d5-97af-435aff70152b";
11
- options.clientSecret = "/PbgaChHbPoboS/1s07E6pfHCNFSdqPsD3B/yiKHfHw=";
12
-
13
-
14
- return options;
15
- };
16
-
17
- module.exports.main = function (ffColl, vvClient, response) {
18
- console.log('In user Main method');
19
- var meta = { code: 200, error: '' };
20
-
21
- try {
22
- //example of accessing formfields to be validated
23
- var outArray = [];
24
- var ff1 = ffColl.getFormFieldByName("Name");
25
- if (ff1 != null) {
26
- console.log('Field 1 name: ' + ff1.name);
27
- console.log('Field 1 name: ' + ff1.value);
28
- outArray.push(ff1);
29
- }
30
-
31
- ff1 = ffColl.getFormFieldByName("Dept");
32
- if (ff1 != null) {
33
- console.log('Field 2 name: ' + ff1.name);
34
- console.log('Field 2 name: ' + ff1.value);
35
- outArray.push(ff1);
36
- }
37
-
38
- //setup parameters for making requests to VisualVault
39
- var formParams = {};
40
- formParams.fields = "id, name, description, revision";
41
-
42
- var siteParams = {};
43
- siteParams.fields = "id, name, sitetype";
44
-
45
- var foldersData = {};
46
- foldersData.q = '';
47
- foldersData.fields = 'id,name';
48
- foldersData.folderpath = '/General';
49
- foldersData.metaonly = 'true';
50
-
51
- var Q = require('q');
52
-
53
- //.sites.getSites(siteParams),
54
-
55
- //make request to VisualVault
56
- Q
57
- .allSettled(
58
- [
59
- vvClient.forms.getFormTemplates(formParams),
60
- vvClient.sites.getSites(siteParams),
61
- vvClient.library.getFolders(foldersData)
62
-
63
- ]
64
- )
65
- .then(
66
- function (promises) {
67
- console.log("Results count: " + promises.length);
68
-
69
- //example of accessing returned data from request to VisualVault
70
- var promiseFormTemplates = promises[0];
71
- if (promiseFormTemplates.state == 'fulfilled'){
72
- var responseData = JSON.parse(promiseFormTemplates.value);
73
-
74
- var formTemplates = responseData.data;
75
-
76
- console.log("Listing Form Templates");
77
- for (var x=0; x < formTemplates.length; x++){
78
- var formTemplate = formTemplates[x];
79
- console.log('FormTemplate Id: ' + formTemplate.id);
80
- console.log('FormTemplate Name: ' + formTemplate.name);
81
- }
82
- }
83
-
84
- var outputCollection = [];
85
-
86
- var fld = new vvClient.forms.returnField(
87
- outArray[0].id,
88
- outArray[0].name,
89
- 'New replacement value',
90
- false,
91
- '');
92
- outputCollection.push(fld);
93
-
94
- var fld1 = new vvClient.forms.returnField(
95
- outArray[1].id,
96
- outArray[1].name,
97
- '',
98
- true,
99
- 'This field is required');
100
- outputCollection.push(fld1);
101
-
102
- console.log("Returning: " + outputCollection);
103
-
104
- response.json(200, outputCollection);
105
- }
106
- )
107
- .fail(
108
- function (error) {
109
- console.log(error);
110
-
111
- meta.code = 400;
112
- meta.error = "An error occurred while validating form";
113
- response.json(200, meta);
114
- }
115
- );
116
-
117
-
118
-
119
-
120
- } catch (ex) {
121
- meta.code = 400;
122
- meta.error = "An exception occurred while validating form";
123
- response.json(200, meta);
124
- }
125
-
126
- };
@@ -1,8 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
6
- <meta charset="utf-8">
7
- <title>VisualVault NodeJs Client Library</title>
8
- </head>
@@ -1,8 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
6
- <meta charset="utf-8">
7
- <title>VisualVault NodeJs Client Library</title>
8
- </head>