@docbrasil/api-systemmanager 1.1.19 → 1.1.21

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 (104) hide show
  1. package/api/admin/doctypes.js +3 -3
  2. package/api/admin/document.js +7 -7
  3. package/api/admin/form.js +3 -3
  4. package/api/admin/index.js +1 -1
  5. package/api/admin/list.js +3 -3
  6. package/api/admin/message.js +2 -2
  7. package/api/admin/notification.js +5 -5
  8. package/api/admin/organization.js +3 -3
  9. package/api/admin/plugin.js +2 -2
  10. package/api/admin/policy.js +3 -3
  11. package/api/admin/processes.js +4 -4
  12. package/api/admin/task.js +3 -3
  13. package/api/admin/user.js +6 -6
  14. package/api/dispatch.js +2 -2
  15. package/api/external.js +5 -5
  16. package/api/general/geoLocation.js +3 -3
  17. package/api/general/index.js +1 -1
  18. package/api/login.js +7 -7
  19. package/api/session.js +1 -1
  20. package/api/user/application.js +2 -2
  21. package/api/user/datasource.js +2 -2
  22. package/api/user/document.js +13 -13
  23. package/api/user/help.js +2 -2
  24. package/api/user/index.js +1 -1
  25. package/api/user/my_tasks.js +11 -11
  26. package/api/user/notification.js +4 -4
  27. package/api/user/organization.js +4 -4
  28. package/api/user/page.js +2 -2
  29. package/api/user/process.js +12 -12
  30. package/api/user/register.js +4 -4
  31. package/api/user/settings.js +5 -5
  32. package/api/user/task.js +41 -4
  33. package/api/user/task_available.js +3 -3
  34. package/api/user/updates.js +1 -1
  35. package/api/user/user.js +108 -9
  36. package/dist/bundle.cjs +279 -143
  37. package/dist/bundle.mjs +1 -1
  38. package/doc/api.md +202 -102
  39. package/docs/Admin.html +1 -1
  40. package/docs/AdminDocuments.html +6 -6
  41. package/docs/AdminForm.html +2 -2
  42. package/docs/AdminLists.html +2 -2
  43. package/docs/AdminNotification.html +4 -4
  44. package/docs/AdminPlugin.html +1 -1
  45. package/docs/AdminPolicy.html +1 -1
  46. package/docs/AdminProcesses.html +2 -2
  47. package/docs/AdminTask.html +1 -1
  48. package/docs/AdminUser.html +4 -4
  49. package/docs/Application.html +1 -1
  50. package/docs/Datasource.html +1 -1
  51. package/docs/Dispatch.html +1 -1
  52. package/docs/Documents.html +10 -10
  53. package/docs/External.html +4 -4
  54. package/docs/GeoLocation.html +1 -1
  55. package/docs/Help.html +1 -1
  56. package/docs/Login.html +6 -6
  57. package/docs/MyTasks.html +11 -11
  58. package/docs/Notification.html +3 -3
  59. package/docs/Organization.html +6 -6
  60. package/docs/Page.html +1 -1
  61. package/docs/Process.html +9 -9
  62. package/docs/Register.html +3 -3
  63. package/docs/Settings.html +3 -3
  64. package/docs/Task.html +287 -3
  65. package/docs/TaskAvailable.html +2 -2
  66. package/docs/User.html +925 -7
  67. package/docs/Users.html +2 -2
  68. package/docs/admin_doctypes.js.html +3 -3
  69. package/docs/admin_document.js.html +7 -7
  70. package/docs/admin_form.js.html +3 -3
  71. package/docs/admin_index.js.html +1 -1
  72. package/docs/admin_list.js.html +3 -3
  73. package/docs/admin_message.js.html +2 -2
  74. package/docs/admin_notification.js.html +5 -5
  75. package/docs/admin_organization.js.html +3 -3
  76. package/docs/admin_plugin.js.html +2 -2
  77. package/docs/admin_policy.js.html +3 -3
  78. package/docs/admin_processes.js.html +4 -4
  79. package/docs/admin_task.js.html +3 -3
  80. package/docs/admin_user.js.html +6 -6
  81. package/docs/dispatch.js.html +2 -2
  82. package/docs/external.js.html +5 -5
  83. package/docs/general_geoLocation.js.html +3 -3
  84. package/docs/general_index.js.html +1 -1
  85. package/docs/login.js.html +7 -7
  86. package/docs/session.js.html +1 -1
  87. package/docs/user_application.js.html +2 -2
  88. package/docs/user_datasource.js.html +2 -2
  89. package/docs/user_document.js.html +13 -13
  90. package/docs/user_help.js.html +2 -2
  91. package/docs/user_index.js.html +1 -1
  92. package/docs/user_my_tasks.js.html +12 -12
  93. package/docs/user_notification.js.html +4 -4
  94. package/docs/user_organization.js.html +4 -4
  95. package/docs/user_page.js.html +2 -2
  96. package/docs/user_process.js.html +12 -12
  97. package/docs/user_register.js.html +4 -4
  98. package/docs/user_settings.js.html +5 -5
  99. package/docs/user_task.js.html +41 -4
  100. package/docs/user_task_available.js.html +3 -3
  101. package/docs/user_updates.js.html +1 -1
  102. package/docs/user_user.js.html +108 -9
  103. package/package.json +1 -1
  104. package/.project +0 -11
@@ -110,7 +110,7 @@ class User {
110
110
  }
111
111
 
112
112
  /**
113
- * @author CloudBrasil <abernardo.br@gmail.com>
113
+ * @author Myndware <augusto.pissarra@myndware.com>
114
114
  * @description Get the return data and check for errors
115
115
  * @param {object} retData Response HTTP
116
116
  * @return {*}
@@ -125,7 +125,7 @@ class User {
125
125
  }
126
126
 
127
127
  /**
128
- * @author CloudBrasil <abernardo.br@gmail.com>
128
+ * @author Myndware <augusto.pissarra@myndware.com>
129
129
  * @description Set header with new session
130
130
  * @param {string} session Session, token JWT
131
131
  * @return {object} header with new session
@@ -140,7 +140,7 @@ class User {
140
140
  }
141
141
 
142
142
  /**
143
- * @author CloudBrasil <abernardo.br@gmail.com>
143
+ * @author Myndware <augusto.pissarra@myndware.com>
144
144
  * @description Update avatar of user by session of user not allow session user SU
145
145
  * @param {object} params Params to update avatar
146
146
  * @param {string} params.avatar Image in base64 to update
@@ -180,7 +180,7 @@ class User {
180
180
  }
181
181
 
182
182
  /**
183
- * @author CloudBrasil <abernardo.br@gmail.com>
183
+ * @author Myndware <augusto.pissarra@myndware.com>
184
184
  * @description Remove avatar of user by session of user not allow session user SU
185
185
  * @param {string} session Is token JWT of user NOT allow SU
186
186
  * @return {Promise}
@@ -207,7 +207,7 @@ class User {
207
207
  }
208
208
 
209
209
  /**
210
- * @author CloudBrasil <abernardo.br@gmail.com>
210
+ * @author Myndware <augusto.pissarra@myndware.com>
211
211
  * @description Remove the signature of user by session
212
212
  * @param {string} session Is token JWT of user NOT allow SU
213
213
  * @return {Promise}
@@ -234,7 +234,7 @@ class User {
234
234
  }
235
235
 
236
236
  /**
237
- * @author CloudBrasil <abernardo.br@gmail.com>
237
+ * @author Myndware <augusto.pissarra@myndware.com>
238
238
  * @description Sava a new signature of user by session
239
239
  * @param {object} data The signature data to save
240
240
  * @param {string} data.type CURSIVE or HANDWRITE
@@ -281,7 +281,7 @@ class User {
281
281
  }
282
282
 
283
283
  /**
284
- * @author CloudBrasil <abernardo.br@gmail.com>
284
+ * @author Myndware <augusto.pissarra@myndware.com>
285
285
  * @description Update a user profile by id
286
286
  * @param {object} params Params to update task
287
287
  * @param {string} params.name The name of the user
@@ -341,7 +341,7 @@ class User {
341
341
  }
342
342
 
343
343
  /**
344
- * @author CloudBrasil <abernardo.br@gmail.com>
344
+ * @author Myndware <augusto.pissarra@myndware.com>
345
345
  * @description Change a user's organization
346
346
  * @param {string} id Organization id
347
347
  * @param {string} session Is token JWT of user NOT allow SU
@@ -354,7 +354,7 @@ class User {
354
354
  * const api = new API();
355
355
  * const id = '616eccaaa9360a05293b10fe';
356
356
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
357
- * await api.user.changeOrganization.updateAvatar(id, session);
357
+ * await api.user.changeOrganization(id, session);
358
358
  */
359
359
  async changeOrganization(id, session) {
360
360
  const self = this;
@@ -369,6 +369,105 @@ class User {
369
369
  throw ex;
370
370
  }
371
371
  }
372
+
373
+ /**
374
+ * @author Myndware <augusto.pissarra@myndware.com>
375
+ * @description Get the Atlas Chart JWT Token, so we can access authorized the created charts
376
+ * @param {object} query={} The query, if any, to add to the JWT token
377
+ * @param {array<string>} query.orgIds An array of orgIds that we want to filter by
378
+ * @param {array<string>} query.orgProcessIds An array of orgProcessId that we want to filter by
379
+ * @param {array<string>} query.tags An array of org processes tags that we want to filter by
380
+ * @param {date} query.startDate The start date in ISO format that we want to filter by
381
+ * @param {date} query.endDate The start date in ISO format that we want to filter by
382
+ * @param {string} session Is token JWT of user NOT allow SU
383
+ * @return {Promise<string>} JWT Token
384
+ * @public
385
+ * @async
386
+ * @example
387
+ *
388
+ * const API = require('@docbrasil/api-systemmanager');
389
+ * const api = new API();
390
+ * const query = { orgIds: ['616eccaaa9360a05293b10fe'] };
391
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
392
+ * const jwtToken = await api.user.changeOrganization.getChartJWT(query, session);
393
+ */
394
+ async getChartJWT(query = {}, session) {
395
+ const self = this;
396
+
397
+ try {
398
+ Joi.assert(session, Joi.string().required());
399
+ const url = `/users/charts/info?query=${JSON.stringify(query)}`;
400
+
401
+ const apiCall = self._client.get(url, self._setHeader(session));
402
+ return self._returnData(await apiCall);
403
+ } catch (ex) {
404
+ throw ex;
405
+ }
406
+ }
407
+
408
+ /**
409
+ * @author Myndware <augusto.pissarra@myndware.com>
410
+ * @description Get the user organizations to run dashboard filtering
411
+ * @param {string} session Is token JWT of user NOT allow SU
412
+ * @return {Promise}
413
+ * @return {array<object>} Array of organizations
414
+ * @return {array<object>} id The id of the organization
415
+ * @return {array<object>} text The name of the organization
416
+ * @public
417
+ * @async
418
+ * @example
419
+ *
420
+ * const API = require('@docbrasil/api-systemmanager');
421
+ * const api = new API();
422
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
423
+ * const organizations = await api.user.changeOrganization.getChartOrganizations(session);
424
+ */
425
+ async getChartOrganizations(session) {
426
+ const self = this;
427
+
428
+ try {
429
+ Joi.assert(session, Joi.string().required());
430
+ const apiCall = self._client.get('/users/charts/organizations', self._setHeader(session));
431
+ return self._returnData(await apiCall);
432
+ } catch (ex) {
433
+ throw ex;
434
+ }
435
+ }
436
+
437
+ /**
438
+ * @author Myndware <augusto.pissarra@myndware.com>
439
+ * @description Given orgIds, return all the tags and org processes ids that can be used to filter dashboards
440
+ * @param {array<string>} orgIds=[] An array of orgIds
441
+ * @param {string} session Is token JWT of user NOT allow SU
442
+ * @return {Promise}
443
+ * @return {array<object>} The array of each org process and tags associated with them
444
+ * @return {srting} id The id of the org process
445
+ * @return {srting} name The name of the org process
446
+ * @return {array<srting>} tags The array of tags of the org process
447
+ * @public
448
+ * @async
449
+ * @example
450
+ *
451
+ * const API = require('@docbrasil/api-systemmanager');
452
+ * const api = new API();
453
+ * const orgIds: ['616eccaaa9360a05293b10fe'];
454
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
455
+ * const jwtToken = await api.user.changeOrganization.getChartTags(orgIds, session);
456
+ */
457
+ async getChartTags(orgIds = [], session) {
458
+ const self = this;
459
+
460
+ try {
461
+ Joi.assert(session, Joi.string().required());
462
+ const url = `/users/charts/tags?orgIds=${JSON.stringify(orgIds)}`;
463
+
464
+ const apiCall = self._client.get(url, self._setHeader(session));
465
+ return self._returnData(await apiCall);
466
+ } catch (ex) {
467
+ throw ex;
468
+ }
469
+ }
470
+
372
471
  }
373
472
 
374
473
  export default User;
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.1.19",
4
+ "version": "1.1.21",
5
5
  "scripts": {
6
6
  "htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
7
7
  "doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",
package/.project DELETED
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name>api-systemmanager</name>
4
- <comment></comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- </buildSpec>
9
- <natures>
10
- </natures>
11
- </projectDescription>