@docbrasil/api-systemmanager 1.1.20 → 1.1.22

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.
@@ -65,7 +65,7 @@ class MyTasks {
65
65
  * const API = require('@docbrasil/api-systemmanager');
66
66
  * const api = new API();
67
67
  * const params = {
68
- * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
68
+ * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20, filter: {checklistsTags:['checklist']}},
69
69
  * orgId: '55e4a3bd6be6b45210833fae',
70
70
  * };
71
71
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
package/api/user/user.js CHANGED
@@ -267,7 +267,7 @@ class User {
267
267
  * const api = new API();
268
268
  * const id = '616eccaaa9360a05293b10fe';
269
269
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
270
- * await api.user.changeOrganization.updateAvatar(id, session);
270
+ * await api.user.changeOrganization(id, session);
271
271
  */
272
272
  async changeOrganization(id, session) {
273
273
  const self = this;
@@ -282,6 +282,105 @@ class User {
282
282
  throw ex;
283
283
  }
284
284
  }
285
+
286
+ /**
287
+ * @author Myndware <augusto.pissarra@myndware.com>
288
+ * @description Get the Atlas Chart JWT Token, so we can access authorized the created charts
289
+ * @param {object} query={} The query, if any, to add to the JWT token
290
+ * @param {array<string>} query.orgIds An array of orgIds that we want to filter by
291
+ * @param {array<string>} query.orgProcessIds An array of orgProcessId that we want to filter by
292
+ * @param {array<string>} query.tags An array of org processes tags that we want to filter by
293
+ * @param {date} query.startDate The start date in ISO format that we want to filter by
294
+ * @param {date} query.endDate The start date in ISO format that we want to filter by
295
+ * @param {string} session Is token JWT of user NOT allow SU
296
+ * @return {Promise<string>} JWT Token
297
+ * @public
298
+ * @async
299
+ * @example
300
+ *
301
+ * const API = require('@docbrasil/api-systemmanager');
302
+ * const api = new API();
303
+ * const query = { orgIds: ['616eccaaa9360a05293b10fe'] };
304
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
305
+ * const jwtToken = await api.user.getChartJWT(query, session);
306
+ */
307
+ async getChartJWT(query = {}, session) {
308
+ const self = this;
309
+
310
+ try {
311
+ Joi.assert(session, Joi.string().required());
312
+ const url = `/users/charts/info?query=${JSON.stringify(query)}`;
313
+
314
+ const apiCall = self._client.get(url, self._setHeader(session));
315
+ return self._returnData(await apiCall);
316
+ } catch (ex) {
317
+ throw ex;
318
+ }
319
+ }
320
+
321
+ /**
322
+ * @author Myndware <augusto.pissarra@myndware.com>
323
+ * @description Get the user organizations to run dashboard filtering
324
+ * @param {string} session Is token JWT of user NOT allow SU
325
+ * @return {Promise}
326
+ * @return {array<object>} Array of organizations
327
+ * @return {array<object>} id The id of the organization
328
+ * @return {array<object>} text The name of the organization
329
+ * @public
330
+ * @async
331
+ * @example
332
+ *
333
+ * const API = require('@docbrasil/api-systemmanager');
334
+ * const api = new API();
335
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
336
+ * const organizations = await api.user.getChartOrganizations(session);
337
+ */
338
+ async getChartOrganizations(session) {
339
+ const self = this;
340
+
341
+ try {
342
+ Joi.assert(session, Joi.string().required());
343
+ const apiCall = self._client.get('/users/charts/organizations', self._setHeader(session));
344
+ return self._returnData(await apiCall);
345
+ } catch (ex) {
346
+ throw ex;
347
+ }
348
+ }
349
+
350
+ /**
351
+ * @author Myndware <augusto.pissarra@myndware.com>
352
+ * @description Given orgIds, return all the tags and org processes ids that can be used to filter dashboards
353
+ * @param {array<string>} orgIds=[] An array of orgIds
354
+ * @param {string} session Is token JWT of user NOT allow SU
355
+ * @return {Promise}
356
+ * @return {array<object>} The array of each org process and tags associated with them
357
+ * @return {srting} id The id of the org process
358
+ * @return {srting} name The name of the org process
359
+ * @return {array<srting>} tags The array of tags of the org process
360
+ * @public
361
+ * @async
362
+ * @example
363
+ *
364
+ * const API = require('@docbrasil/api-systemmanager');
365
+ * const api = new API();
366
+ * const orgIds: ['616eccaaa9360a05293b10fe'];
367
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
368
+ * const jwtToken = await api.user.getChartTags(orgIds, session);
369
+ */
370
+ async getChartTags(orgIds = [], session) {
371
+ const self = this;
372
+
373
+ try {
374
+ Joi.assert(session, Joi.string().required());
375
+ const url = `/users/charts/tags?orgIds=${JSON.stringify(orgIds)}`;
376
+
377
+ const apiCall = self._client.get(url, self._setHeader(session));
378
+ return self._returnData(await apiCall);
379
+ } catch (ex) {
380
+ throw ex;
381
+ }
382
+ }
383
+
285
384
  }
286
385
 
287
386
  export default User;
package/dist/bundle.cjs CHANGED
@@ -2211,7 +2211,7 @@ class MyTasks {
2211
2211
  * const API = require('@docbrasil/api-systemmanager');
2212
2212
  * const api = new API();
2213
2213
  * const params = {
2214
- * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
2214
+ * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20, filter: {checklistsTags:['checklist']}},
2215
2215
  * orgId: '55e4a3bd6be6b45210833fae',
2216
2216
  * };
2217
2217
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
@@ -3099,7 +3099,7 @@ class User {
3099
3099
  * const api = new API();
3100
3100
  * const id = '616eccaaa9360a05293b10fe';
3101
3101
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
3102
- * await api.user.changeOrganization.updateAvatar(id, session);
3102
+ * await api.user.changeOrganization(id, session);
3103
3103
  */
3104
3104
  async changeOrganization(id, session) {
3105
3105
  const self = this;
@@ -3114,6 +3114,105 @@ class User {
3114
3114
  throw ex;
3115
3115
  }
3116
3116
  }
3117
+
3118
+ /**
3119
+ * @author Myndware <augusto.pissarra@myndware.com>
3120
+ * @description Get the Atlas Chart JWT Token, so we can access authorized the created charts
3121
+ * @param {object} query={} The query, if any, to add to the JWT token
3122
+ * @param {array<string>} query.orgIds An array of orgIds that we want to filter by
3123
+ * @param {array<string>} query.orgProcessIds An array of orgProcessId that we want to filter by
3124
+ * @param {array<string>} query.tags An array of org processes tags that we want to filter by
3125
+ * @param {date} query.startDate The start date in ISO format that we want to filter by
3126
+ * @param {date} query.endDate The start date in ISO format that we want to filter by
3127
+ * @param {string} session Is token JWT of user NOT allow SU
3128
+ * @return {Promise<string>} JWT Token
3129
+ * @public
3130
+ * @async
3131
+ * @example
3132
+ *
3133
+ * const API = require('@docbrasil/api-systemmanager');
3134
+ * const api = new API();
3135
+ * const query = { orgIds: ['616eccaaa9360a05293b10fe'] };
3136
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
3137
+ * const jwtToken = await api.user.getChartJWT(query, session);
3138
+ */
3139
+ async getChartJWT(query = {}, session) {
3140
+ const self = this;
3141
+
3142
+ try {
3143
+ Joi__default["default"].assert(session, Joi__default["default"].string().required());
3144
+ const url = `/users/charts/info?query=${JSON.stringify(query)}`;
3145
+
3146
+ const apiCall = self._client.get(url, self._setHeader(session));
3147
+ return self._returnData(await apiCall);
3148
+ } catch (ex) {
3149
+ throw ex;
3150
+ }
3151
+ }
3152
+
3153
+ /**
3154
+ * @author Myndware <augusto.pissarra@myndware.com>
3155
+ * @description Get the user organizations to run dashboard filtering
3156
+ * @param {string} session Is token JWT of user NOT allow SU
3157
+ * @return {Promise}
3158
+ * @return {array<object>} Array of organizations
3159
+ * @return {array<object>} id The id of the organization
3160
+ * @return {array<object>} text The name of the organization
3161
+ * @public
3162
+ * @async
3163
+ * @example
3164
+ *
3165
+ * const API = require('@docbrasil/api-systemmanager');
3166
+ * const api = new API();
3167
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
3168
+ * const organizations = await api.user.getChartOrganizations(session);
3169
+ */
3170
+ async getChartOrganizations(session) {
3171
+ const self = this;
3172
+
3173
+ try {
3174
+ Joi__default["default"].assert(session, Joi__default["default"].string().required());
3175
+ const apiCall = self._client.get('/users/charts/organizations', self._setHeader(session));
3176
+ return self._returnData(await apiCall);
3177
+ } catch (ex) {
3178
+ throw ex;
3179
+ }
3180
+ }
3181
+
3182
+ /**
3183
+ * @author Myndware <augusto.pissarra@myndware.com>
3184
+ * @description Given orgIds, return all the tags and org processes ids that can be used to filter dashboards
3185
+ * @param {array<string>} orgIds=[] An array of orgIds
3186
+ * @param {string} session Is token JWT of user NOT allow SU
3187
+ * @return {Promise}
3188
+ * @return {array<object>} The array of each org process and tags associated with them
3189
+ * @return {srting} id The id of the org process
3190
+ * @return {srting} name The name of the org process
3191
+ * @return {array<srting>} tags The array of tags of the org process
3192
+ * @public
3193
+ * @async
3194
+ * @example
3195
+ *
3196
+ * const API = require('@docbrasil/api-systemmanager');
3197
+ * const api = new API();
3198
+ * const orgIds: ['616eccaaa9360a05293b10fe'];
3199
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
3200
+ * const jwtToken = await api.user.getChartTags(orgIds, session);
3201
+ */
3202
+ async getChartTags(orgIds = [], session) {
3203
+ const self = this;
3204
+
3205
+ try {
3206
+ Joi__default["default"].assert(session, Joi__default["default"].string().required());
3207
+ const url = `/users/charts/tags?orgIds=${JSON.stringify(orgIds)}`;
3208
+
3209
+ const apiCall = self._client.get(url, self._setHeader(session));
3210
+ return self._returnData(await apiCall);
3211
+ } catch (ex) {
3212
+ throw ex;
3213
+ }
3214
+ }
3215
+
3117
3216
  }
3118
3217
 
3119
3218
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};