@docbrasil/api-systemmanager 1.0.91 → 1.0.93
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.
- package/api/admin/index.js +12 -12
- package/api/general/index.js +2 -2
- package/api/user/index.js +8 -8
- package/api/user/register.js +1 -1
- package/api/user/task.js +1 -1
- package/api/user/task_available.js +2 -2
- package/dist/bundle.cjs +2 -2
- package/dist/bundle.mjs +1 -1
- package/index.js +6 -6
- package/package.json +3 -3
- package/tests/user/task_available.js +75 -0
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import Joi from 'joi';
|
|
3
3
|
|
|
4
|
-
import Dispatch from './api/dispatch';
|
|
5
|
-
import Session from './api/session';
|
|
6
|
-
import Login from './api/login';
|
|
4
|
+
import Dispatch from './api/dispatch.js';
|
|
5
|
+
import Session from './api/session.js';
|
|
6
|
+
import Login from './api/login.js';
|
|
7
7
|
|
|
8
|
-
import General from './api/general';
|
|
9
|
-
import User from './api/user';
|
|
10
|
-
import Admin from './api/admin';
|
|
8
|
+
import General from './api/general/index.js';
|
|
9
|
+
import User from './api/user/index.js';
|
|
10
|
+
import Admin from './api/admin/index.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Class API
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docbrasil/api-systemmanager",
|
|
3
3
|
"description": "Module API System Manager",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.93",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"doc": "rm -f doc/api.md && jsdoc2md api/**/** > doc/api.md",
|
|
7
7
|
"doc:w": "rimraf doc/api.md && jsdoc2md api/**/** > doc/api.md",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"@rollup/plugin-json": "^4.1.0",
|
|
47
47
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
48
48
|
"axios-esm": "^1.0.0",
|
|
49
|
-
"chai": "^3.
|
|
49
|
+
"chai": "^4.3.7",
|
|
50
50
|
"dayjs": "^1.10.7",
|
|
51
51
|
"glob": "~7.1.1",
|
|
52
52
|
"license-checker": "^8.0.4",
|
|
53
53
|
"lodash-es": "^4.17.21",
|
|
54
|
-
"mocha": "^
|
|
54
|
+
"mocha": "^10.2.0",
|
|
55
55
|
"proxyquire": "^1.8.0",
|
|
56
56
|
"rollup": "^2.59.0",
|
|
57
57
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import API from '../../index.js';
|
|
4
|
+
|
|
5
|
+
let sm;
|
|
6
|
+
let user;
|
|
7
|
+
let session;
|
|
8
|
+
const apiKey = '25c04b9a-0f6b-11ea-8d71-362b9e155667';
|
|
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('Login', async function () {
|
|
22
|
+
try {
|
|
23
|
+
const retData = await sm.login.apiKey(apiKey);
|
|
24
|
+
|
|
25
|
+
expect(retData).to.not.be.empty;
|
|
26
|
+
expect(retData.auth).to.be.true;
|
|
27
|
+
expect(retData.user).to.be.an('object');
|
|
28
|
+
expect(retData.user).to.be.an('object');
|
|
29
|
+
expect(retData.user).to.not.be.empty;
|
|
30
|
+
expect(retData.user.sessionId).to.not.be.empty;
|
|
31
|
+
expect(retData.user.sessionId.split('.').length).equal(3);
|
|
32
|
+
expect(retData.user.orgId.length).equal(24);
|
|
33
|
+
user = retData.user;
|
|
34
|
+
session = retData.user.sessionId;
|
|
35
|
+
} catch (ex) {
|
|
36
|
+
expect(ex).to.be.empty;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('Get available tasks', async function () {
|
|
41
|
+
try {
|
|
42
|
+
const params = {
|
|
43
|
+
query: {
|
|
44
|
+
"s": [
|
|
45
|
+
{
|
|
46
|
+
"historyBegin": {
|
|
47
|
+
"order": "desc"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"i": 1,
|
|
52
|
+
"p": 20
|
|
53
|
+
},
|
|
54
|
+
orgId: user.orgId
|
|
55
|
+
};
|
|
56
|
+
const retData = await sm.user.task.available.find(params, session);
|
|
57
|
+
|
|
58
|
+
expect(retData).to.not.be.empty;
|
|
59
|
+
expect(retData).to.be.an('object');
|
|
60
|
+
expect(retData.items).to.be.an('array');
|
|
61
|
+
} catch (ex) {
|
|
62
|
+
expect(ex).to.be.empty;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('Logout user', async function () {
|
|
67
|
+
try {
|
|
68
|
+
const retData = await sm.login.logout(session);
|
|
69
|
+
|
|
70
|
+
expect(retData).to.be,true;
|
|
71
|
+
} catch (ex) {
|
|
72
|
+
expect(ex).to.be.empty;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|