@docbrasil/api-systemmanager 1.0.97 → 1.0.98

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 +4878 -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
@@ -1,71 +1,71 @@
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 apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
11
-
12
- describe('Start API policy', function () {
13
- before(function (done) {
14
-
15
- try {
16
- sm = new API();
17
- done();
18
- } catch (ex) {
19
- expect(ex).to.be.empty;
20
- }
21
- });
22
-
23
- it('Login SU', async function () {
24
- try {
25
- const retData = await sm.login.apiKey(apiKey);
26
-
27
- expect(retData).to.not.be.empty;
28
- expect(retData.auth).to.be.true;
29
- expect(retData.user).to.be.an('object');
30
- expect(retData.user).to.be.an('object');
31
- expect(retData.user).to.not.be.empty;
32
- expect(retData.user.sessionId).to.not.be.empty;
33
- expect(retData.user.sessionId.split('.').length).equal(3);
34
- expect(retData.user.orgId.length).equal(24);
35
-
36
- session = retData.user.sessionId;
37
- userId = retData.user._id;
38
- orgId = retData.user.orgId;
39
- } catch (ex) {
40
- expect(ex).to.be.empty;
41
- }
42
- });
43
-
44
- it('Get policies', async function () {
45
- try {
46
- const retData = await sm.admin.policy.find(session);
47
-
48
- expect(retData).to.not.be.empty;
49
- expect(retData).to.be.an('array');
50
- expect(retData[0]).to.include.all.keys('_id', 'name', 'policy', 'description');
51
- } catch (ex) {
52
- expect(ex).to.be.empty;
53
- }
54
- });
55
-
56
- it('Logout user', async function () {
57
- try {
58
- const retData = await sm.login.logout(session);
59
-
60
- expect(retData).to.not.be.empty;
61
- expect(retData).to.be.an('object');
62
- expect(retData.response).to.not.be.empty;
63
- expect(retData.response).equal('OK');
64
- } catch (ex) {
65
- expect(ex).to.be.empty;
66
- }
67
- });
68
- });
69
-
70
-
71
-
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 apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
11
+
12
+ describe('Start API policy', function () {
13
+ before(function (done) {
14
+
15
+ try {
16
+ sm = new API();
17
+ done();
18
+ } catch (ex) {
19
+ expect(ex).to.be.empty;
20
+ }
21
+ });
22
+
23
+ it('Login SU', async function () {
24
+ try {
25
+ const retData = await sm.login.apiKey(apiKey);
26
+
27
+ expect(retData).to.not.be.empty;
28
+ expect(retData.auth).to.be.true;
29
+ expect(retData.user).to.be.an('object');
30
+ expect(retData.user).to.be.an('object');
31
+ expect(retData.user).to.not.be.empty;
32
+ expect(retData.user.sessionId).to.not.be.empty;
33
+ expect(retData.user.sessionId.split('.').length).equal(3);
34
+ expect(retData.user.orgId.length).equal(24);
35
+
36
+ session = retData.user.sessionId;
37
+ userId = retData.user._id;
38
+ orgId = retData.user.orgId;
39
+ } catch (ex) {
40
+ expect(ex).to.be.empty;
41
+ }
42
+ });
43
+
44
+ it('Get policies', async function () {
45
+ try {
46
+ const retData = await sm.admin.policy.find(session);
47
+
48
+ expect(retData).to.not.be.empty;
49
+ expect(retData).to.be.an('array');
50
+ expect(retData[0]).to.include.all.keys('_id', 'name', 'policy', 'description');
51
+ } catch (ex) {
52
+ expect(ex).to.be.empty;
53
+ }
54
+ });
55
+
56
+ it('Logout user', async function () {
57
+ try {
58
+ const retData = await sm.login.logout(session);
59
+
60
+ expect(retData).to.not.be.empty;
61
+ expect(retData).to.be.an('object');
62
+ expect(retData.response).to.not.be.empty;
63
+ expect(retData.response).equal('OK');
64
+ } catch (ex) {
65
+ expect(ex).to.be.empty;
66
+ }
67
+ });
68
+ });
69
+
70
+
71
+
@@ -1,119 +1,119 @@
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 apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
11
-
12
- describe('Start API policy', function () {
13
- before(function (done) {
14
-
15
- try {
16
- sm = new API();
17
- done();
18
- } catch (ex) {
19
- expect(ex).to.be.empty;
20
- }
21
- });
22
-
23
- it('Login SU', async function () {
24
- try {
25
- const retData = await sm.login.apiKey(apiKey);
26
-
27
- expect(retData).to.not.be.empty;
28
- expect(retData.auth).to.be.true;
29
- expect(retData.user).to.be.an('object');
30
- expect(retData.user).to.be.an('object');
31
- expect(retData.user).to.not.be.empty;
32
- expect(retData.user.sessionId).to.not.be.empty;
33
- expect(retData.user.sessionId.split('.').length).equal(3);
34
- expect(retData.user.orgId.length).equal(24);
35
-
36
- session = retData.user.sessionId;
37
- userId = retData.user._id;
38
- orgId = retData.user.orgId;
39
- } catch (ex) {
40
- expect(ex).to.be.empty;
41
- }
42
- });
43
-
44
- it('Search process: Context recruiter', async function () {
45
- try {
46
- const setParams = {
47
- orgProcessId: {value: '5f57d4f3b8fe3d0d22fc99be'},
48
- initParams: [
49
- {
50
- value: '5f67651a7dae1a260eb92625',
51
- name: 'initParams.jobId',
52
- },
53
- {
54
- value: 'remote',
55
- name: 'initParams.type',
56
- },
57
- {
58
- value: '23/09/2020 13:00',
59
- type: 'date_time',
60
- oper: '>=',
61
- name: 'initParams.startDateTime'
62
- },
63
- {
64
- value: '23/09/2020 15:00',
65
- type: 'date_time',
66
- oper: '<=',
67
- name: 'initParams.endDateTime'
68
- },
69
- ],
70
- orgId
71
- };
72
- const retData = await sm.admin.processes.search(setParams, session);
73
-
74
- expect(retData.items).to.not.be.empty;
75
- expect(retData.items).to.be.an('array');
76
- expect(retData.items[0]).to.include.all.keys('history', 'properties');
77
- } catch (ex) {
78
- expect(ex).to.be.empty;
79
- }
80
- });
81
-
82
- it('Search process: Context professional', async function () {
83
- try {
84
- const setParams = {
85
- orgProcessId: {value: '5f57d4f3b8fe3d0d22fc99be'},
86
- initParams: [
87
- {
88
- value: [{id: '5f677fa16d92486104823bcb'}],
89
- name: 'initParams.candidates.id',
90
- },
91
- ],
92
- orgId
93
- };
94
- const retData = await sm.admin.processes.search(setParams, session);
95
-
96
- expect(retData.items).to.not.be.empty;
97
- expect(retData.items).to.be.an('array');
98
- expect(retData.items[0]).to.include.all.keys('history', 'properties');
99
- } catch (ex) {
100
- expect(ex).to.be.empty;
101
- }
102
- });
103
-
104
- it('Logout user', async function () {
105
- try {
106
- const retData = await sm.login.logout(session);
107
-
108
- expect(retData).to.not.be.empty;
109
- expect(retData).to.be.an('object');
110
- expect(retData.response).to.not.be.empty;
111
- expect(retData.response).equal('OK');
112
- } catch (ex) {
113
- expect(ex).to.be.empty;
114
- }
115
- });
116
- });
117
-
118
-
119
-
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 apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
11
+
12
+ describe('Start API policy', function () {
13
+ before(function (done) {
14
+
15
+ try {
16
+ sm = new API();
17
+ done();
18
+ } catch (ex) {
19
+ expect(ex).to.be.empty;
20
+ }
21
+ });
22
+
23
+ it('Login SU', async function () {
24
+ try {
25
+ const retData = await sm.login.apiKey(apiKey);
26
+
27
+ expect(retData).to.not.be.empty;
28
+ expect(retData.auth).to.be.true;
29
+ expect(retData.user).to.be.an('object');
30
+ expect(retData.user).to.be.an('object');
31
+ expect(retData.user).to.not.be.empty;
32
+ expect(retData.user.sessionId).to.not.be.empty;
33
+ expect(retData.user.sessionId.split('.').length).equal(3);
34
+ expect(retData.user.orgId.length).equal(24);
35
+
36
+ session = retData.user.sessionId;
37
+ userId = retData.user._id;
38
+ orgId = retData.user.orgId;
39
+ } catch (ex) {
40
+ expect(ex).to.be.empty;
41
+ }
42
+ });
43
+
44
+ it('Search process: Context recruiter', async function () {
45
+ try {
46
+ const setParams = {
47
+ orgProcessId: {value: '5f57d4f3b8fe3d0d22fc99be'},
48
+ initParams: [
49
+ {
50
+ value: '5f67651a7dae1a260eb92625',
51
+ name: 'initParams.jobId',
52
+ },
53
+ {
54
+ value: 'remote',
55
+ name: 'initParams.type',
56
+ },
57
+ {
58
+ value: '23/09/2020 13:00',
59
+ type: 'date_time',
60
+ oper: '>=',
61
+ name: 'initParams.startDateTime'
62
+ },
63
+ {
64
+ value: '23/09/2020 15:00',
65
+ type: 'date_time',
66
+ oper: '<=',
67
+ name: 'initParams.endDateTime'
68
+ },
69
+ ],
70
+ orgId
71
+ };
72
+ const retData = await sm.admin.processes.search(setParams, session);
73
+
74
+ expect(retData.items).to.not.be.empty;
75
+ expect(retData.items).to.be.an('array');
76
+ expect(retData.items[0]).to.include.all.keys('history', 'properties');
77
+ } catch (ex) {
78
+ expect(ex).to.be.empty;
79
+ }
80
+ });
81
+
82
+ it('Search process: Context professional', async function () {
83
+ try {
84
+ const setParams = {
85
+ orgProcessId: {value: '5f57d4f3b8fe3d0d22fc99be'},
86
+ initParams: [
87
+ {
88
+ value: [{id: '5f677fa16d92486104823bcb'}],
89
+ name: 'initParams.candidates.id',
90
+ },
91
+ ],
92
+ orgId
93
+ };
94
+ const retData = await sm.admin.processes.search(setParams, session);
95
+
96
+ expect(retData.items).to.not.be.empty;
97
+ expect(retData.items).to.be.an('array');
98
+ expect(retData.items[0]).to.include.all.keys('history', 'properties');
99
+ } catch (ex) {
100
+ expect(ex).to.be.empty;
101
+ }
102
+ });
103
+
104
+ it('Logout user', async function () {
105
+ try {
106
+ const retData = await sm.login.logout(session);
107
+
108
+ expect(retData).to.not.be.empty;
109
+ expect(retData).to.be.an('object');
110
+ expect(retData.response).to.not.be.empty;
111
+ expect(retData.response).equal('OK');
112
+ } catch (ex) {
113
+ expect(ex).to.be.empty;
114
+ }
115
+ });
116
+ });
117
+
118
+
119
+
@@ -1,127 +1,127 @@
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 sm;
9
- let updatePass = {id: userId, oldPassword: '123456', newPassword: '123456789'};
10
- let apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
11
- let emailExist = 'emailisunique@gmail.com';
12
-
13
- describe('Start API users', 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
- } catch (ex) {
40
- expect(ex).to.be.empty;
41
- }
42
- });
43
-
44
- it('Get profile', async function () {
45
- try {
46
- const retData = await sm.admin.user.findById(userId, session);
47
-
48
- expect(retData).to.not.be.empty;
49
- expect(retData).to.be.an('object');
50
- expect(retData._id).equal(userId);
51
- expect(retData.name).equal('Automation SM');
52
- expect(retData.username).equal('en_automation');
53
- } catch (ex) {
54
- expect(ex).to.be.empty;
55
- }
56
- });
57
-
58
- it('Update password', async function () {
59
- try {
60
- updatePass.userId = userId;
61
- const retData = await sm.admin.user.findByIdAndUpdatePassword(updatePass, session);
62
-
63
- expect(retData).to.not.be.empty;
64
- expect(retData).to.be.an('object');
65
- expect(retData._id).equal(userId);
66
- expect(retData.name).equal('Automation SM');
67
- expect(retData.username).equal('en_automation');
68
- } catch (ex) {
69
- expect(ex).to.be.empty;
70
- }
71
- });
72
-
73
- it('Rollback Update password', async function () {
74
- try {
75
- updatePass.oldPassword = '123456789';
76
- updatePass.newPassword = '123456';
77
- updatePass.id = userId;
78
- const retData = await sm.admin.user.findByIdAndUpdatePassword(updatePass, session);
79
-
80
- expect(retData).to.not.be.empty;
81
- expect(retData).to.be.an('object');
82
- expect(retData._id).equal(userId);
83
- expect(retData.name).equal('Automation SM');
84
- expect(retData.username).equal('en_automation');
85
- } catch (ex) {
86
- expect(ex).to.be.empty;
87
- }
88
- });
89
-
90
- it('Email is unique', async function () {
91
- try {
92
- const retData = await sm.admin.user.emailExist(emailExist, session);
93
-
94
- expect(retData).to.not.be.empty;
95
- expect(retData).to.be.an('object');
96
- expect(retData.exist).to.be.false;
97
- } catch (ex) {
98
- expect(ex).to.be.empty;
99
- }
100
- });
101
-
102
- it('Email is not unique', async function () {
103
- try {
104
- emailExist = 'ana.breda@gmail.com';
105
- const retData = await sm.admin.user.emailExist(emailExist, session);
106
-
107
- expect(retData).to.not.be.empty;
108
- expect(retData).to.be.an('object');
109
- expect(retData.exist).to.be.true;
110
- } catch (ex) {
111
- expect(ex).to.be.empty;
112
- }
113
- });
114
-
115
- it('Logout user', async function () {
116
- try {
117
- const retData = await sm.login.logout(session);
118
-
119
- expect(retData).to.not.be.empty;
120
- expect(retData).to.be.an('object');
121
- expect(retData.response).to.not.be.empty;
122
- expect(retData.response).equal('OK');
123
- } catch (ex) {
124
- expect(ex).to.be.empty;
125
- }
126
- });
127
- });
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 sm;
9
+ let updatePass = {id: userId, oldPassword: '123456', newPassword: '123456789'};
10
+ let apiKey = '38bd15aa-6418-4d4f-812a-e7ed5b3bfcde';
11
+ let emailExist = 'emailisunique@gmail.com';
12
+
13
+ describe('Start API users', 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
+ } catch (ex) {
40
+ expect(ex).to.be.empty;
41
+ }
42
+ });
43
+
44
+ it('Get profile', async function () {
45
+ try {
46
+ const retData = await sm.admin.user.findById(userId, session);
47
+
48
+ expect(retData).to.not.be.empty;
49
+ expect(retData).to.be.an('object');
50
+ expect(retData._id).equal(userId);
51
+ expect(retData.name).equal('Automation SM');
52
+ expect(retData.username).equal('en_automation');
53
+ } catch (ex) {
54
+ expect(ex).to.be.empty;
55
+ }
56
+ });
57
+
58
+ it('Update password', async function () {
59
+ try {
60
+ updatePass.userId = userId;
61
+ const retData = await sm.admin.user.findByIdAndUpdatePassword(updatePass, session);
62
+
63
+ expect(retData).to.not.be.empty;
64
+ expect(retData).to.be.an('object');
65
+ expect(retData._id).equal(userId);
66
+ expect(retData.name).equal('Automation SM');
67
+ expect(retData.username).equal('en_automation');
68
+ } catch (ex) {
69
+ expect(ex).to.be.empty;
70
+ }
71
+ });
72
+
73
+ it('Rollback Update password', async function () {
74
+ try {
75
+ updatePass.oldPassword = '123456789';
76
+ updatePass.newPassword = '123456';
77
+ updatePass.id = userId;
78
+ const retData = await sm.admin.user.findByIdAndUpdatePassword(updatePass, session);
79
+
80
+ expect(retData).to.not.be.empty;
81
+ expect(retData).to.be.an('object');
82
+ expect(retData._id).equal(userId);
83
+ expect(retData.name).equal('Automation SM');
84
+ expect(retData.username).equal('en_automation');
85
+ } catch (ex) {
86
+ expect(ex).to.be.empty;
87
+ }
88
+ });
89
+
90
+ it('Email is unique', async function () {
91
+ try {
92
+ const retData = await sm.admin.user.emailExist(emailExist, session);
93
+
94
+ expect(retData).to.not.be.empty;
95
+ expect(retData).to.be.an('object');
96
+ expect(retData.exist).to.be.false;
97
+ } catch (ex) {
98
+ expect(ex).to.be.empty;
99
+ }
100
+ });
101
+
102
+ it('Email is not unique', async function () {
103
+ try {
104
+ emailExist = 'ana.breda@gmail.com';
105
+ const retData = await sm.admin.user.emailExist(emailExist, session);
106
+
107
+ expect(retData).to.not.be.empty;
108
+ expect(retData).to.be.an('object');
109
+ expect(retData.exist).to.be.true;
110
+ } catch (ex) {
111
+ expect(ex).to.be.empty;
112
+ }
113
+ });
114
+
115
+ it('Logout user', async function () {
116
+ try {
117
+ const retData = await sm.login.logout(session);
118
+
119
+ expect(retData).to.not.be.empty;
120
+ expect(retData).to.be.an('object');
121
+ expect(retData.response).to.not.be.empty;
122
+ expect(retData.response).equal('OK');
123
+ } catch (ex) {
124
+ expect(ex).to.be.empty;
125
+ }
126
+ });
127
+ });