@docbrasil/api-systemmanager 1.0.89 → 1.0.91

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 (57) 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/general/geoLocation.js +88 -88
  16. package/api/general/index.js +22 -22
  17. package/api/login.js +267 -267
  18. package/api/session.js +85 -85
  19. package/api/user/datasource.js +144 -144
  20. package/api/user/document.js +730 -730
  21. package/api/user/index.js +39 -39
  22. package/api/user/notification.js +101 -101
  23. package/api/user/organization.js +230 -230
  24. package/api/user/process.js +191 -191
  25. package/api/user/register.js +205 -205
  26. package/api/user/task.js +201 -201
  27. package/api/user/task_available.js +135 -135
  28. package/api/user/user.js +287 -287
  29. package/api/utils/cypher.js +37 -37
  30. package/api/utils/promises.js +118 -118
  31. package/bundleRollup.js +158 -158
  32. package/dist/bundle.cjs +4875 -4875
  33. package/dist/bundle.mjs +1 -1
  34. package/doc/api.md +674 -336
  35. package/doc.md +653 -653
  36. package/helper/boom.js +487 -487
  37. package/helper/cryptojs.js +6067 -6067
  38. package/index.js +85 -85
  39. package/package-lock.json +4635 -4635
  40. package/package.json +68 -68
  41. package/readme.md +25 -25
  42. package/tests/admin/document.spec.js +45 -45
  43. package/tests/admin/form.spec.js +74 -74
  44. package/tests/admin/list.spec.js +86 -86
  45. package/tests/admin/message.js +92 -92
  46. package/tests/admin/notification.spec.js +174 -174
  47. package/tests/admin/pluginspec..js +71 -71
  48. package/tests/admin/policy.spec.js +71 -71
  49. package/tests/admin/processes.spec.js +119 -119
  50. package/tests/admin/users.spec.js +127 -127
  51. package/tests/documents.spec.js +164 -164
  52. package/tests/login.spec.js +91 -91
  53. package/tests/session.spec..js +58 -58
  54. package/tests/user/documents.js +164 -164
  55. package/tests/user/organization.js +122 -122
  56. package/tests/user/process.js +71 -71
  57. 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;