@docbrasil/api-systemmanager 1.0.97 → 1.0.99

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 (59) hide show
  1. package/api/admin/doctypes.js +76 -76
  2. package/api/admin/document.js +332 -332
  3. package/api/admin/form.js +151 -151
  4. package/api/admin/index.js +46 -46
  5. package/api/admin/list.js +133 -133
  6. package/api/admin/message.js +194 -194
  7. package/api/admin/notification.js +233 -233
  8. package/api/admin/organization.js +124 -124
  9. package/api/admin/plugin.js +116 -116
  10. package/api/admin/policy.js +78 -78
  11. package/api/admin/processes.js +370 -370
  12. package/api/admin/task.js +125 -125
  13. package/api/admin/user.js +185 -185
  14. package/api/dispatch.js +101 -101
  15. package/api/external.js +86 -0
  16. package/api/general/geoLocation.js +88 -88
  17. package/api/general/index.js +23 -23
  18. package/api/login.js +267 -267
  19. package/api/session.js +85 -85
  20. package/api/user/datasource.js +144 -144
  21. package/api/user/document.js +730 -730
  22. package/api/user/index.js +39 -39
  23. package/api/user/notification.js +101 -101
  24. package/api/user/organization.js +230 -230
  25. package/api/user/process.js +191 -191
  26. package/api/user/register.js +205 -205
  27. package/api/user/task.js +201 -202
  28. package/api/user/task_available.js +135 -135
  29. package/api/user/user.js +287 -287
  30. package/api/utils/cypher.js +37 -37
  31. package/api/utils/promises.js +118 -118
  32. package/bundleRollup.js +158 -158
  33. package/dist/bundle.cjs +4957 -4876
  34. package/dist/bundle.mjs +1 -1
  35. package/doc/api.md +2453 -2453
  36. package/doc.md +653 -653
  37. package/helper/boom.js +487 -487
  38. package/helper/cryptojs.js +6067 -6067
  39. package/index.js +87 -85
  40. package/package-lock.json +4635 -4635
  41. package/package.json +68 -68
  42. package/readme.md +25 -25
  43. package/tests/admin/document.spec.js +45 -45
  44. package/tests/admin/form.spec.js +74 -74
  45. package/tests/admin/list.spec.js +86 -86
  46. package/tests/admin/message.js +92 -92
  47. package/tests/admin/notification.spec.js +174 -174
  48. package/tests/admin/pluginspec..js +71 -71
  49. package/tests/admin/policy.spec.js +71 -71
  50. package/tests/admin/processes.spec.js +119 -119
  51. package/tests/admin/users.spec.js +127 -127
  52. package/tests/documents.spec.js +164 -164
  53. package/tests/login.spec.js +91 -91
  54. package/tests/session.spec..js +58 -58
  55. package/tests/user/documents.js +164 -164
  56. package/tests/user/organization.js +122 -122
  57. package/tests/user/process.js +71 -71
  58. package/tests/user/task_available.js +75 -75
  59. package/tests/user/user.js +88 -88
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
- {
2
- "name": "@docbrasil/api-systemmanager",
3
- "description": "Module API System Manager",
4
- "version": "1.0.97",
5
- "scripts": {
6
- "doc": "rm -f doc/api.md && jsdoc2md api/**/** > doc/api.md",
7
- "doc:w": "rimraf doc/api.md && jsdoc2md api/**/** > doc/api.md",
8
- "build": "node bundleRollup.js"
9
- },
10
- "type": "module",
11
- "main": "./dist/bundle.mjs",
12
- "browser": "./dist/bundle.mjs",
13
- "exports": {
14
- "require": "./dist/bundle.cjs",
15
- "import": "./dist/bundle.mjs"
16
- },
17
- "engines": {
18
- "node": ">=14.x"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/cloudbrasil/api-systemmanager"
23
- },
24
- "license": "Apache-2.0",
25
- "licenses": [
26
- {
27
- "type": "Apache-2.0",
28
- "url": "https://spdx.org/licenses/Apache-2.0.html"
29
- }
30
- ],
31
- "dependencies": {
32
- "@hapi/boom": "^8.0.1",
33
- "async": "^3.1.0",
34
- "axios": "^0.21.2",
35
- "crypto-js": "^4.1.1",
36
- "i": "^0.3.7",
37
- "joi": "^17.4.2",
38
- "jsdoc-to-markdown": "^6.0.1",
39
- "lodash": "^4.17.21",
40
- "moment": "^2.27.0",
41
- "npm": "^6.14.6"
42
- },
43
- "devDependencies": {
44
- "@rollup/plugin-alias": "^3.1.8",
45
- "@rollup/plugin-commonjs": "^21.0.1",
46
- "@rollup/plugin-json": "^4.1.0",
47
- "@rollup/plugin-node-resolve": "^13.0.6",
48
- "axios-esm": "^1.0.0",
49
- "chai": "^4.3.7",
50
- "dayjs": "^1.10.7",
51
- "glob": "~7.1.1",
52
- "license-checker": "^8.0.4",
53
- "lodash-es": "^4.17.21",
54
- "mocha": "^10.2.0",
55
- "proxyquire": "^1.8.0",
56
- "rollup": "^2.59.0",
57
- "rollup-plugin-cleanup": "^3.2.1",
58
- "rollup-plugin-node-polyfills": "^0.2.1",
59
- "rollup-plugin-uglify": "^6.0.4",
60
- "sinon": "^7.5.0"
61
- },
62
- "maintainers": [
63
- {
64
- "name": "abernardo.br",
65
- "email": "abernardo.br@gmail.com"
66
- }
67
- ]
68
- }
1
+ {
2
+ "name": "@docbrasil/api-systemmanager",
3
+ "description": "Module API System Manager",
4
+ "version": "1.0.99",
5
+ "scripts": {
6
+ "doc": "rm -f doc/api.md && jsdoc2md api/**/** > doc/api.md",
7
+ "doc:w": "rimraf doc/api.md && jsdoc2md api/**/** > doc/api.md",
8
+ "build": "node bundleRollup.js"
9
+ },
10
+ "type": "module",
11
+ "main": "./dist/bundle.mjs",
12
+ "browser": "./dist/bundle.mjs",
13
+ "exports": {
14
+ "require": "./dist/bundle.cjs",
15
+ "import": "./dist/bundle.mjs"
16
+ },
17
+ "engines": {
18
+ "node": ">=14.x"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/cloudbrasil/api-systemmanager"
23
+ },
24
+ "license": "Apache-2.0",
25
+ "licenses": [
26
+ {
27
+ "type": "Apache-2.0",
28
+ "url": "https://spdx.org/licenses/Apache-2.0.html"
29
+ }
30
+ ],
31
+ "dependencies": {
32
+ "@hapi/boom": "^8.0.1",
33
+ "async": "^3.1.0",
34
+ "axios": "^0.21.2",
35
+ "crypto-js": "^4.1.1",
36
+ "i": "^0.3.7",
37
+ "joi": "^17.4.2",
38
+ "jsdoc-to-markdown": "^6.0.1",
39
+ "lodash": "^4.17.21",
40
+ "moment": "^2.27.0",
41
+ "npm": "^6.14.6"
42
+ },
43
+ "devDependencies": {
44
+ "@rollup/plugin-alias": "^3.1.8",
45
+ "@rollup/plugin-commonjs": "^21.0.1",
46
+ "@rollup/plugin-json": "^4.1.0",
47
+ "@rollup/plugin-node-resolve": "^13.0.6",
48
+ "axios-esm": "^1.0.0",
49
+ "chai": "^4.3.7",
50
+ "dayjs": "^1.10.7",
51
+ "glob": "~7.1.1",
52
+ "license-checker": "^8.0.4",
53
+ "lodash-es": "^4.17.21",
54
+ "mocha": "^10.2.0",
55
+ "proxyquire": "^1.8.0",
56
+ "rollup": "^2.59.0",
57
+ "rollup-plugin-cleanup": "^3.2.1",
58
+ "rollup-plugin-node-polyfills": "^0.2.1",
59
+ "rollup-plugin-uglify": "^6.0.4",
60
+ "sinon": "^7.5.0"
61
+ },
62
+ "maintainers": [
63
+ {
64
+ "name": "abernardo.br",
65
+ "email": "abernardo.br@gmail.com"
66
+ }
67
+ ]
68
+ }
package/readme.md CHANGED
@@ -1,25 +1,25 @@
1
- ### README
2
- <p>Requisitos para uso da API System Manager e ter os acessos para super usuário para chamadas e saber o endereço URI do servidor</p>
3
- <p>Verifique sua versão do nodejs esperamos que tenha a versão v14+ </p>
4
-
5
- ### Instalando
6
-
7
- #### Pelo npm
8
- ```
9
- npm i @docbrasil/api-systemmanager
10
- ```
11
-
12
- #### Pelo yarn
13
- ```
14
- yarn add @docbrasil/api-systemmanager
15
- ```
16
-
17
- ```javascript
18
- const APISystemManager = require('@docbrasil/api-systemmanager');
19
- const api = new APISystemManager();
20
- ```
21
- <p>Feito agora você já pode chamar os methos e fazer a interação com system manager</p>
22
-
23
- ### API
24
- * Link para documentação da API: [CLIQUE AQUI!](https://github.com/cloudbrasil/api-systemmanager/blob/develop/doc/api.md)
25
- * Exemplos de uso da API:: [CLIQUE AQUI!](https://github.com/cloudbrasil/api-systemmanager/wiki)
1
+ ### README
2
+ <p>Requisitos para uso da API System Manager e ter os acessos para super usuário para chamadas e saber o endereço URI do servidor</p>
3
+ <p>Verifique sua versão do nodejs esperamos que tenha a versão v14+ </p>
4
+
5
+ ### Instalando
6
+
7
+ #### Pelo npm
8
+ ```
9
+ npm i @docbrasil/api-systemmanager
10
+ ```
11
+
12
+ #### Pelo yarn
13
+ ```
14
+ yarn add @docbrasil/api-systemmanager
15
+ ```
16
+
17
+ ```javascript
18
+ const APISystemManager = require('@docbrasil/api-systemmanager');
19
+ const api = new APISystemManager();
20
+ ```
21
+ <p>Feito agora você já pode chamar os methos e fazer a interação com system manager</p>
22
+
23
+ ### API
24
+ * Link para documentação da API: [CLIQUE AQUI!](https://github.com/cloudbrasil/api-systemmanager/blob/develop/doc/api.md)
25
+ * Exemplos de uso da API:: [CLIQUE AQUI!](https://github.com/cloudbrasil/api-systemmanager/wiki)
@@ -1,45 +1,45 @@
1
- const _ = require('lodash');
2
- const expect = require('chai').expect;
3
-
4
- const API = require('../../index');
5
-
6
- let sm;
7
- let docId = '60c7c5b849f54c763a527499';
8
- let apiKey = '346cf019-6127-448e-971f-b0ad6801dbf2';
9
-
10
- describe('Start API Documents', function () {
11
- before(function (done) {
12
-
13
- try {
14
- sm = new API();
15
- done();
16
- } catch (ex) {
17
- expect(ex).to.be.empty;
18
- }
19
- });
20
-
21
- it('Get signed url, method get', async function () {
22
- try {
23
- const retData = await sm.admin.document.signedUrl({ docId, methodType: 'get' }, apiKey);
24
- expect(retData).to.not.be.empty;
25
- expect(retData.signedUrl).to.not.be.empty;
26
- expect(retData.document).to.not.be.empty;
27
- } catch (ex) {
28
- expect(ex).to.be.empty;
29
- }
30
- });
31
-
32
- it('Get signed url, method get', async function () {
33
- try {
34
- const retData = await sm.admin.document.signedUrl({ docId, methodType: 'put' }, apiKey);
35
- expect(retData).to.not.be.empty;
36
- expect(retData.signedUrl).to.not.be.empty;
37
- expect(retData.areaId).to.not.be.empty;
38
- expect(retData.type).to.not.be.empty;
39
- expect(retData.name).to.not.be.empty;
40
- expect(retData.filename).to.not.be.empty;
41
- } catch (ex) {
42
- expect(ex).to.be.empty;
43
- }
44
- });
45
- });
1
+ const _ = require('lodash');
2
+ const expect = require('chai').expect;
3
+
4
+ const API = require('../../index');
5
+
6
+ let sm;
7
+ let docId = '60c7c5b849f54c763a527499';
8
+ let apiKey = '346cf019-6127-448e-971f-b0ad6801dbf2';
9
+
10
+ describe('Start API Documents', function () {
11
+ before(function (done) {
12
+
13
+ try {
14
+ sm = new API();
15
+ done();
16
+ } catch (ex) {
17
+ expect(ex).to.be.empty;
18
+ }
19
+ });
20
+
21
+ it('Get signed url, method get', async function () {
22
+ try {
23
+ const retData = await sm.admin.document.signedUrl({ docId, methodType: 'get' }, apiKey);
24
+ expect(retData).to.not.be.empty;
25
+ expect(retData.signedUrl).to.not.be.empty;
26
+ expect(retData.document).to.not.be.empty;
27
+ } catch (ex) {
28
+ expect(ex).to.be.empty;
29
+ }
30
+ });
31
+
32
+ it('Get signed url, method get', async function () {
33
+ try {
34
+ const retData = await sm.admin.document.signedUrl({ docId, methodType: 'put' }, apiKey);
35
+ expect(retData).to.not.be.empty;
36
+ expect(retData.signedUrl).to.not.be.empty;
37
+ expect(retData.areaId).to.not.be.empty;
38
+ expect(retData.type).to.not.be.empty;
39
+ expect(retData.name).to.not.be.empty;
40
+ expect(retData.filename).to.not.be.empty;
41
+ } catch (ex) {
42
+ expect(ex).to.be.empty;
43
+ }
44
+ });
45
+ });
@@ -1,74 +1,74 @@
1
- const _ = require('lodash');
2
- const expect = require('chai').expect;
3
-
4
- const API = require('../../index');
5
-
6
- let session;
7
- let userId;
8
- let orgId;
9
- let sm;
10
- let formId = '5e834cf792207e480d6a879c';
11
- let apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
12
-
13
- describe('Start API forms', function () {
14
- before(function (done) {
15
-
16
- try {
17
- sm = new API();
18
- done();
19
- } catch (ex) {
20
- expect(ex).to.be.empty;
21
- }
22
- });
23
-
24
- it('Login SU', async function () {
25
- try {
26
- const retData = await sm.login.apiKey(apiKey);
27
-
28
- expect(retData).to.not.be.empty;
29
- expect(retData.auth).to.be.true;
30
- expect(retData.user).to.be.an('object');
31
- expect(retData.user).to.be.an('object');
32
- expect(retData.user).to.not.be.empty;
33
- expect(retData.user.sessionId).to.not.be.empty;
34
- expect(retData.user.sessionId.split('.').length).equal(3);
35
- expect(retData.user.orgId.length).equal(24);
36
-
37
- session = retData.user.sessionId;
38
- userId = retData.user._id;
39
- orgId = retData.user.orgId;
40
- } catch (ex) {
41
- expect(ex).to.be.empty;
42
- }
43
- });
44
-
45
- it('Get form by ID', async function () {
46
- try {
47
- const params = {id: formId, orgId};
48
- const retData = await sm.admin.form.findById(params, session);
49
-
50
- expect(retData).to.not.be.empty;
51
- expect(retData).to.be.an('object');
52
- expect(retData._id).equal(formId);
53
- expect(retData.form).to.not.be.empty;
54
- expect(retData.form).to.be.an('object');
55
- expect(retData.form.form).to.not.be.empty;
56
- expect(retData.form.form).to.be.an('array');
57
- } catch (ex) {
58
- expect(ex).to.be.empty;
59
- }
60
- });
61
-
62
- it('Logout user', async function () {
63
- try {
64
- const retData = await sm.login.logout(session);
65
-
66
- expect(retData).to.not.be.empty;
67
- expect(retData).to.be.an('object');
68
- expect(retData.response).to.not.be.empty;
69
- expect(retData.response).equal('OK');
70
- } catch (ex) {
71
- expect(ex).to.be.empty;
72
- }
73
- });
74
- });
1
+ const _ = require('lodash');
2
+ const expect = require('chai').expect;
3
+
4
+ const API = require('../../index');
5
+
6
+ let session;
7
+ let userId;
8
+ let orgId;
9
+ let sm;
10
+ let formId = '5e834cf792207e480d6a879c';
11
+ let apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
12
+
13
+ describe('Start API forms', function () {
14
+ before(function (done) {
15
+
16
+ try {
17
+ sm = new API();
18
+ done();
19
+ } catch (ex) {
20
+ expect(ex).to.be.empty;
21
+ }
22
+ });
23
+
24
+ it('Login SU', async function () {
25
+ try {
26
+ const retData = await sm.login.apiKey(apiKey);
27
+
28
+ expect(retData).to.not.be.empty;
29
+ expect(retData.auth).to.be.true;
30
+ expect(retData.user).to.be.an('object');
31
+ expect(retData.user).to.be.an('object');
32
+ expect(retData.user).to.not.be.empty;
33
+ expect(retData.user.sessionId).to.not.be.empty;
34
+ expect(retData.user.sessionId.split('.').length).equal(3);
35
+ expect(retData.user.orgId.length).equal(24);
36
+
37
+ session = retData.user.sessionId;
38
+ userId = retData.user._id;
39
+ orgId = retData.user.orgId;
40
+ } catch (ex) {
41
+ expect(ex).to.be.empty;
42
+ }
43
+ });
44
+
45
+ it('Get form by ID', async function () {
46
+ try {
47
+ const params = {id: formId, orgId};
48
+ const retData = await sm.admin.form.findById(params, session);
49
+
50
+ expect(retData).to.not.be.empty;
51
+ expect(retData).to.be.an('object');
52
+ expect(retData._id).equal(formId);
53
+ expect(retData.form).to.not.be.empty;
54
+ expect(retData.form).to.be.an('object');
55
+ expect(retData.form.form).to.not.be.empty;
56
+ expect(retData.form.form).to.be.an('array');
57
+ } catch (ex) {
58
+ expect(ex).to.be.empty;
59
+ }
60
+ });
61
+
62
+ it('Logout user', async function () {
63
+ try {
64
+ const retData = await sm.login.logout(session);
65
+
66
+ expect(retData).to.not.be.empty;
67
+ expect(retData).to.be.an('object');
68
+ expect(retData.response).to.not.be.empty;
69
+ expect(retData.response).equal('OK');
70
+ } catch (ex) {
71
+ expect(ex).to.be.empty;
72
+ }
73
+ });
74
+ });
@@ -1,86 +1,86 @@
1
- const _ = require('lodash');
2
- const expect = require('chai').expect;
3
-
4
- const API = require('../../index');
5
-
6
- let userId;
7
- let orgId;
8
- let sm;
9
- let session;
10
- let listId = '5e553471f0c1ed539e97519c';
11
- let apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
12
-
13
- describe('Start API lists', function () {
14
- before(function (done) {
15
-
16
- try {
17
- sm = new API();
18
- done();
19
- } catch (ex) {
20
- expect(ex).to.be.empty;
21
- }
22
- });
23
-
24
- it('Login SU', async function () {
25
- try {
26
- const retData = await sm.login.apiKey(apiKey);
27
-
28
- expect(retData).to.not.be.empty;
29
- expect(retData.auth).to.be.true;
30
- expect(retData.user).to.be.an('object');
31
- expect(retData.user).to.be.an('object');
32
- expect(retData.user).to.not.be.empty;
33
- expect(retData.user.sessionId).to.not.be.empty;
34
- expect(retData.user.sessionId.split('.').length).equal(3);
35
- expect(retData.user.orgId.length).equal(24);
36
-
37
- session = retData.user.sessionId;
38
- userId = retData.user._id;
39
- orgId = retData.user.orgId;
40
- } catch (ex) {
41
- expect(ex).to.be.empty;
42
- }
43
- });
44
-
45
- it('Get list by ID', async function () {
46
- try {
47
- const params = {id: listId, orgId};
48
- const retData = await sm.admin.list.findById(params, session);
49
-
50
- expect(retData).to.not.be.empty;
51
- expect(retData).to.be.an('object');
52
- expect(retData._id).equal(listId);
53
- expect(retData.list).to.not.be.empty;
54
- expect(retData.list).to.be.an('array');
55
- } catch (ex) {
56
- expect(ex).to.be.empty;
57
- }
58
- });
59
-
60
- it('Get all lists', async function () {
61
- try {
62
-
63
- const params = {orgId};
64
- const retData = await sm.admin.list.find(params, session);
65
-
66
- expect(retData).to.not.be.empty;
67
- expect(retData).to.be.an('array');
68
- } catch (ex) {
69
- expect(ex).to.be.empty;
70
- }
71
- });
72
-
73
- it('Logout user', async function () {
74
- try {
75
- const retData = await sm.login.logout(session);
76
-
77
- expect(retData).to.not.be.empty;
78
- expect(retData).to.be.an('object');
79
- expect(retData.response).to.not.be.empty;
80
- expect(retData.response).equal('OK');
81
- } catch (ex) {
82
- expect(ex).to.be.empty;
83
- }
84
- });
85
- });
86
-
1
+ const _ = require('lodash');
2
+ const expect = require('chai').expect;
3
+
4
+ const API = require('../../index');
5
+
6
+ let userId;
7
+ let orgId;
8
+ let sm;
9
+ let session;
10
+ let listId = '5e553471f0c1ed539e97519c';
11
+ let apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
12
+
13
+ describe('Start API lists', function () {
14
+ before(function (done) {
15
+
16
+ try {
17
+ sm = new API();
18
+ done();
19
+ } catch (ex) {
20
+ expect(ex).to.be.empty;
21
+ }
22
+ });
23
+
24
+ it('Login SU', async function () {
25
+ try {
26
+ const retData = await sm.login.apiKey(apiKey);
27
+
28
+ expect(retData).to.not.be.empty;
29
+ expect(retData.auth).to.be.true;
30
+ expect(retData.user).to.be.an('object');
31
+ expect(retData.user).to.be.an('object');
32
+ expect(retData.user).to.not.be.empty;
33
+ expect(retData.user.sessionId).to.not.be.empty;
34
+ expect(retData.user.sessionId.split('.').length).equal(3);
35
+ expect(retData.user.orgId.length).equal(24);
36
+
37
+ session = retData.user.sessionId;
38
+ userId = retData.user._id;
39
+ orgId = retData.user.orgId;
40
+ } catch (ex) {
41
+ expect(ex).to.be.empty;
42
+ }
43
+ });
44
+
45
+ it('Get list by ID', async function () {
46
+ try {
47
+ const params = {id: listId, orgId};
48
+ const retData = await sm.admin.list.findById(params, session);
49
+
50
+ expect(retData).to.not.be.empty;
51
+ expect(retData).to.be.an('object');
52
+ expect(retData._id).equal(listId);
53
+ expect(retData.list).to.not.be.empty;
54
+ expect(retData.list).to.be.an('array');
55
+ } catch (ex) {
56
+ expect(ex).to.be.empty;
57
+ }
58
+ });
59
+
60
+ it('Get all lists', async function () {
61
+ try {
62
+
63
+ const params = {orgId};
64
+ const retData = await sm.admin.list.find(params, session);
65
+
66
+ expect(retData).to.not.be.empty;
67
+ expect(retData).to.be.an('array');
68
+ } catch (ex) {
69
+ expect(ex).to.be.empty;
70
+ }
71
+ });
72
+
73
+ it('Logout user', async function () {
74
+ try {
75
+ const retData = await sm.login.logout(session);
76
+
77
+ expect(retData).to.not.be.empty;
78
+ expect(retData).to.be.an('object');
79
+ expect(retData.response).to.not.be.empty;
80
+ expect(retData.response).equal('OK');
81
+ } catch (ex) {
82
+ expect(ex).to.be.empty;
83
+ }
84
+ });
85
+ });
86
+