@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
package/index.js CHANGED
@@ -1,85 +1,87 @@
1
- import _ from 'lodash';
2
- import Joi from 'joi';
3
-
4
- import Dispatch from './api/dispatch.js';
5
- import Session from './api/session.js';
6
- import Login from './api/login.js';
7
-
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
-
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.js';
5
+ import Session from './api/session.js';
6
+ import Login from './api/login.js';
7
+
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
+ import External from './api/external.js';
12
+
13
+ /**
14
+ * Class API
15
+ */
16
+ class API {
17
+
18
+ /**
19
+ * @constructor
20
+ * @description Options for constructor
21
+ * @param {object=} options Options to new instance
22
+ * @param {object=} options.auth Options to authentication
23
+ * @param {string} options.auth.type=null Type (apikey or userpassword)
24
+ * @param {object=} options.auth.credentials Credentials to login SM
25
+ * @param {string} options.auth.credentials.username=null Credentials to login SM
26
+ * @param {string} options.auth.credentials.password=null Credentials to login SM
27
+ * @param {string} options.auth.credentials.session=null Session started by social login
28
+ * @param {string} options.auth.credentials.apikey=null Session started by social login
29
+ * @param {string} options.attemptsRetry=3 Number of login attempts
30
+ * @param {array} [options.httpStatusToRetry=[401]] HTTP status to retry login
31
+ * @param {string} options.uri=http://127.0.0.1:8080 Address of the server
32
+ * @param {object=} options.debug Enable debug of requisitions
33
+ * @param {boolean} options.debug.success=true Enable debug success
34
+ * @param {boolean} options.debug.error=true Enable debug error
35
+ * @example
36
+ *
37
+ * const params = {
38
+ * auth: {
39
+ * type: 'apikey',
40
+ * credentials: {
41
+ * key: '36371923-27dc-4d30-b666-7fc4ecead925'
42
+ * }
43
+ * },
44
+ * url: 'http://cloudbrasil.com.br'
45
+ * };
46
+ *
47
+ * const API = require('@docbrasil/api-systemmanager');
48
+ * const api = new API(params);
49
+ */
50
+ constructor(options = {}) {
51
+
52
+ if (!_.isUndefined(options)) {
53
+ Joi.assert(options, Joi.object());
54
+ Joi.assert(options.uri, Joi.string());
55
+ Joi.assert(options.debug, Joi.object());
56
+ }
57
+ const self = this;
58
+
59
+ self.options = _.defaultsDeep({}, options, {
60
+ auth: {
61
+ type: null,
62
+ credentials: {
63
+ username: null,
64
+ password: null,
65
+ session: null,
66
+ key: null
67
+ }
68
+ },
69
+ uri: 'http://localhost:8080',
70
+ attemptsRetry: 3,
71
+ httpStatusToRetry: [401],
72
+ debug: {success: true, error: true}
73
+ });
74
+
75
+ // API CALL
76
+ self.dispatch = new Dispatch({parent: self});
77
+ self.session = new Session({parent: self});
78
+ self.login = new Login({parent: self});
79
+
80
+ self.general = new General({parent: self});
81
+ self.user = new User({parent: self});
82
+ self.admin = new Admin({parent: self});
83
+ self.external = new External({parent: self});
84
+ }
85
+ }
86
+
87
+ export default API;