@docbrasil/api-systemmanager 1.0.87 → 1.0.88
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/doctypes.js +76 -76
- package/api/admin/document.js +332 -332
- package/api/admin/form.js +151 -151
- package/api/admin/index.js +46 -46
- package/api/admin/list.js +133 -133
- package/api/admin/message.js +194 -194
- package/api/admin/notification.js +233 -233
- package/api/admin/organization.js +124 -124
- package/api/admin/plugin.js +116 -116
- package/api/admin/policy.js +78 -78
- package/api/admin/processes.js +370 -370
- package/api/admin/task.js +125 -125
- package/api/admin/user.js +185 -185
- package/api/dispatch.js +101 -101
- package/api/general/geoLocation.js +88 -88
- package/api/general/index.js +22 -22
- package/api/login.js +267 -267
- package/api/session.js +85 -85
- package/api/user/datasource.js +144 -144
- package/api/user/document.js +731 -687
- package/api/user/index.js +39 -39
- package/api/user/notification.js +101 -101
- package/api/user/organization.js +230 -230
- package/api/user/process.js +191 -191
- package/api/user/register.js +205 -205
- package/api/user/task.js +201 -201
- package/api/user/task_available.js +135 -135
- package/api/user/user.js +287 -287
- package/api/utils/cypher.js +37 -37
- package/api/utils/promises.js +118 -118
- package/bundleRollup.js +158 -158
- package/dist/bundle.cjs +4876 -4832
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +372 -666
- package/doc.md +653 -653
- package/helper/boom.js +487 -487
- package/helper/cryptojs.js +6067 -6067
- package/index.js +85 -85
- package/package-lock.json +4635 -4635
- package/package.json +68 -67
- package/readme.md +25 -25
- package/tests/admin/document.spec.js +45 -45
- package/tests/admin/form.spec.js +74 -74
- package/tests/admin/list.spec.js +86 -86
- package/tests/admin/message.js +92 -92
- package/tests/admin/notification.spec.js +174 -174
- package/tests/admin/pluginspec..js +71 -71
- package/tests/admin/policy.spec.js +71 -71
- package/tests/admin/processes.spec.js +119 -119
- package/tests/admin/users.spec.js +127 -127
- package/tests/documents.spec.js +164 -164
- package/tests/login.spec.js +91 -91
- package/tests/session.spec..js +58 -58
- package/tests/user/documents.js +164 -164
- package/tests/user/organization.js +122 -122
- package/tests/user/process.js +71 -71
- package/tests/user/user.js +88 -88
package/index.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import Joi from 'joi';
|
|
3
|
-
|
|
4
|
-
import Dispatch from './api/dispatch';
|
|
5
|
-
import Session from './api/session';
|
|
6
|
-
import Login from './api/login';
|
|
7
|
-
|
|
8
|
-
import General from './api/general';
|
|
9
|
-
import User from './api/user';
|
|
10
|
-
import Admin from './api/admin';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Class API
|
|
14
|
-
*/
|
|
15
|
-
class API {
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @constructor
|
|
19
|
-
* @description Options for constructor
|
|
20
|
-
* @param {object=} options Options to new instance
|
|
21
|
-
* @param {object=} options.auth Options to authentication
|
|
22
|
-
* @param {string} options.auth.type=null Type (apikey or userpassword)
|
|
23
|
-
* @param {object=} options.auth.credentials Credentials to login SM
|
|
24
|
-
* @param {string} options.auth.credentials.username=null Credentials to login SM
|
|
25
|
-
* @param {string} options.auth.credentials.password=null Credentials to login SM
|
|
26
|
-
* @param {string} options.auth.credentials.session=null Session started by social login
|
|
27
|
-
* @param {string} options.auth.credentials.apikey=null Session started by social login
|
|
28
|
-
* @param {string} options.attemptsRetry=3 Number of login attempts
|
|
29
|
-
* @param {array} [options.httpStatusToRetry=[401]] HTTP status to retry login
|
|
30
|
-
* @param {string} options.uri=http://127.0.0.1:8080 Address of the server
|
|
31
|
-
* @param {object=} options.debug Enable debug of requisitions
|
|
32
|
-
* @param {boolean} options.debug.success=true Enable debug success
|
|
33
|
-
* @param {boolean} options.debug.error=true Enable debug error
|
|
34
|
-
* @example
|
|
35
|
-
*
|
|
36
|
-
* const params = {
|
|
37
|
-
* auth: {
|
|
38
|
-
* type: 'apikey',
|
|
39
|
-
* credentials: {
|
|
40
|
-
* key: '36371923-27dc-4d30-b666-7fc4ecead925'
|
|
41
|
-
* }
|
|
42
|
-
* },
|
|
43
|
-
* url: 'http://cloudbrasil.com.br'
|
|
44
|
-
* };
|
|
45
|
-
*
|
|
46
|
-
* const API = require('@docbrasil/api-systemmanager');
|
|
47
|
-
* const api = new API(params);
|
|
48
|
-
*/
|
|
49
|
-
constructor(options = {}) {
|
|
50
|
-
|
|
51
|
-
if (!_.isUndefined(options)) {
|
|
52
|
-
Joi.assert(options, Joi.object());
|
|
53
|
-
Joi.assert(options.uri, Joi.string());
|
|
54
|
-
Joi.assert(options.debug, Joi.object());
|
|
55
|
-
}
|
|
56
|
-
const self = this;
|
|
57
|
-
|
|
58
|
-
self.options = _.defaultsDeep({}, options, {
|
|
59
|
-
auth: {
|
|
60
|
-
type: null,
|
|
61
|
-
credentials: {
|
|
62
|
-
username: null,
|
|
63
|
-
password: null,
|
|
64
|
-
session: null,
|
|
65
|
-
key: null
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
uri: 'http://localhost:8080',
|
|
69
|
-
attemptsRetry: 3,
|
|
70
|
-
httpStatusToRetry: [401],
|
|
71
|
-
debug: {success: true, error: true}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// API CALL
|
|
75
|
-
self.dispatch = new Dispatch({parent: self});
|
|
76
|
-
self.session = new Session({parent: self});
|
|
77
|
-
self.login = new Login({parent: self});
|
|
78
|
-
|
|
79
|
-
self.general = new General({parent: self});
|
|
80
|
-
self.user = new User({parent: self});
|
|
81
|
-
self.admin = new Admin({parent: self});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export default API;
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import Joi from 'joi';
|
|
3
|
+
|
|
4
|
+
import Dispatch from './api/dispatch';
|
|
5
|
+
import Session from './api/session';
|
|
6
|
+
import Login from './api/login';
|
|
7
|
+
|
|
8
|
+
import General from './api/general';
|
|
9
|
+
import User from './api/user';
|
|
10
|
+
import Admin from './api/admin';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Class API
|
|
14
|
+
*/
|
|
15
|
+
class API {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @constructor
|
|
19
|
+
* @description Options for constructor
|
|
20
|
+
* @param {object=} options Options to new instance
|
|
21
|
+
* @param {object=} options.auth Options to authentication
|
|
22
|
+
* @param {string} options.auth.type=null Type (apikey or userpassword)
|
|
23
|
+
* @param {object=} options.auth.credentials Credentials to login SM
|
|
24
|
+
* @param {string} options.auth.credentials.username=null Credentials to login SM
|
|
25
|
+
* @param {string} options.auth.credentials.password=null Credentials to login SM
|
|
26
|
+
* @param {string} options.auth.credentials.session=null Session started by social login
|
|
27
|
+
* @param {string} options.auth.credentials.apikey=null Session started by social login
|
|
28
|
+
* @param {string} options.attemptsRetry=3 Number of login attempts
|
|
29
|
+
* @param {array} [options.httpStatusToRetry=[401]] HTTP status to retry login
|
|
30
|
+
* @param {string} options.uri=http://127.0.0.1:8080 Address of the server
|
|
31
|
+
* @param {object=} options.debug Enable debug of requisitions
|
|
32
|
+
* @param {boolean} options.debug.success=true Enable debug success
|
|
33
|
+
* @param {boolean} options.debug.error=true Enable debug error
|
|
34
|
+
* @example
|
|
35
|
+
*
|
|
36
|
+
* const params = {
|
|
37
|
+
* auth: {
|
|
38
|
+
* type: 'apikey',
|
|
39
|
+
* credentials: {
|
|
40
|
+
* key: '36371923-27dc-4d30-b666-7fc4ecead925'
|
|
41
|
+
* }
|
|
42
|
+
* },
|
|
43
|
+
* url: 'http://cloudbrasil.com.br'
|
|
44
|
+
* };
|
|
45
|
+
*
|
|
46
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
47
|
+
* const api = new API(params);
|
|
48
|
+
*/
|
|
49
|
+
constructor(options = {}) {
|
|
50
|
+
|
|
51
|
+
if (!_.isUndefined(options)) {
|
|
52
|
+
Joi.assert(options, Joi.object());
|
|
53
|
+
Joi.assert(options.uri, Joi.string());
|
|
54
|
+
Joi.assert(options.debug, Joi.object());
|
|
55
|
+
}
|
|
56
|
+
const self = this;
|
|
57
|
+
|
|
58
|
+
self.options = _.defaultsDeep({}, options, {
|
|
59
|
+
auth: {
|
|
60
|
+
type: null,
|
|
61
|
+
credentials: {
|
|
62
|
+
username: null,
|
|
63
|
+
password: null,
|
|
64
|
+
session: null,
|
|
65
|
+
key: null
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
uri: 'http://localhost:8080',
|
|
69
|
+
attemptsRetry: 3,
|
|
70
|
+
httpStatusToRetry: [401],
|
|
71
|
+
debug: {success: true, error: true}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// API CALL
|
|
75
|
+
self.dispatch = new Dispatch({parent: self});
|
|
76
|
+
self.session = new Session({parent: self});
|
|
77
|
+
self.login = new Login({parent: self});
|
|
78
|
+
|
|
79
|
+
self.general = new General({parent: self});
|
|
80
|
+
self.user = new User({parent: self});
|
|
81
|
+
self.admin = new Admin({parent: self});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default API;
|