@docbrasil/api-systemmanager 1.0.106 → 1.0.108

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 (76) hide show
  1. package/.github/workflows/static.yml +43 -0
  2. package/api/external.js +41 -0
  3. package/api/user/process.js +44 -0
  4. package/api/user/task.js +1 -0
  5. package/api/user/task_available.js +1 -1
  6. package/dist/bundle.cjs +87 -1
  7. package/dist/bundle.mjs +1 -1
  8. package/doc/api.md +412 -1
  9. package/docs/Admin.html +336 -0
  10. package/docs/AdminDocuments.html +2235 -0
  11. package/docs/AdminForm.html +934 -0
  12. package/docs/AdminLists.html +895 -0
  13. package/docs/AdminMessage.html +1490 -0
  14. package/docs/AdminNotification.html +1636 -0
  15. package/docs/AdminPlugin.html +696 -0
  16. package/docs/AdminPolicy.html +451 -0
  17. package/docs/AdminProcesses.html +692 -0
  18. package/docs/AdminTask.html +740 -0
  19. package/docs/AdminUser.html +1203 -0
  20. package/docs/Datasource.html +660 -0
  21. package/docs/Dispatch.html +624 -0
  22. package/docs/Documents.html +4875 -0
  23. package/docs/External.html +1203 -0
  24. package/docs/GeoLocation.html +503 -0
  25. package/docs/Login.html +1839 -0
  26. package/docs/Notification.html +625 -0
  27. package/docs/Organization.html +2767 -0
  28. package/docs/Process.html +1598 -0
  29. package/docs/Register.html +1604 -0
  30. package/docs/Session.html +482 -0
  31. package/docs/Task.html +1394 -0
  32. package/docs/TaskAvailable.html +893 -0
  33. package/docs/User.html +2002 -0
  34. package/docs/Users.html +569 -0
  35. package/docs/admin_doctypes.js.html +193 -0
  36. package/docs/admin_document.js.html +449 -0
  37. package/docs/admin_form.js.html +268 -0
  38. package/docs/admin_index.js.html +163 -0
  39. package/docs/admin_list.js.html +250 -0
  40. package/docs/admin_message.js.html +311 -0
  41. package/docs/admin_notification.js.html +350 -0
  42. package/docs/admin_organization.js.html +241 -0
  43. package/docs/admin_plugin.js.html +233 -0
  44. package/docs/admin_policy.js.html +195 -0
  45. package/docs/admin_processes.js.html +487 -0
  46. package/docs/admin_task.js.html +242 -0
  47. package/docs/admin_user.js.html +302 -0
  48. package/docs/dispatch.js.html +218 -0
  49. package/docs/external.js.html +333 -0
  50. package/docs/general_geoLocation.js.html +205 -0
  51. package/docs/general_index.js.html +140 -0
  52. package/docs/index.html +129 -0
  53. package/docs/login.js.html +384 -0
  54. package/docs/scripts/app.min.js +1 -0
  55. package/docs/scripts/linenumber.js +26 -0
  56. package/docs/scripts/search.js +39 -0
  57. package/docs/session.js.html +202 -0
  58. package/docs/styles/app.min.css +1 -0
  59. package/docs/styles/iframe.css +13 -0
  60. package/docs/styles/prettify-jsdoc.css +111 -0
  61. package/docs/styles/prettify-tomorrow.css +132 -0
  62. package/docs/styles/reset.css +44 -0
  63. package/docs/user_datasource.js.html +261 -0
  64. package/docs/user_document.js.html +847 -0
  65. package/docs/user_index.js.html +156 -0
  66. package/docs/user_notification.js.html +218 -0
  67. package/docs/user_organization.js.html +347 -0
  68. package/docs/user_process.js.html +352 -0
  69. package/docs/user_register.js.html +322 -0
  70. package/docs/user_task.js.html +319 -0
  71. package/docs/user_task_available.js.html +252 -0
  72. package/docs/user_user.js.html +404 -0
  73. package/docs/utils_promises.js.html +235 -0
  74. package/package.json +7 -4
  75. package/readme.md +7 -8
  76. package/doc.md +0 -653
@@ -0,0 +1,43 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches: ["develop"]
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: false
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v3
34
+ - name: Setup Pages
35
+ uses: actions/configure-pages@v3
36
+ - name: Upload artifact
37
+ uses: actions/upload-pages-artifact@v1
38
+ with:
39
+ # Upload entire repository
40
+ path: '.'
41
+ - name: Deploy to GitHub Pages
42
+ id: deployment
43
+ uses: actions/deploy-pages@v2
package/api/external.js CHANGED
@@ -124,6 +124,47 @@ class External {
124
124
  }
125
125
  }
126
126
 
127
+ /**
128
+ * @author CloudBrasil <abernardo.br@gmail.com>
129
+ * @description Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
130
+ * @param {array<object>} docs the list of documents
131
+ * @param {string} docs.mime the mime type of the document
132
+ * @param {string} authorization a legal authorization
133
+ * @returns {Promise<array>} docs
134
+ * @returns {string} docs.mime the original mime type of the document
135
+ * @returns {string} docs.signedUrl the signed url to upload the document
136
+ * @returns {string} docs.filename the filename of the uploaded file
137
+ * @returns {string} docs.extension the extension of the filename, obtained from the mime type
138
+ * @public
139
+ * @async
140
+ * @example
141
+ *
142
+ * const API = require('@docbrasil/api-systemmanager');
143
+ * const api = new API();
144
+ * const authorization = '...';
145
+ * const docs = [
146
+ * {
147
+ * mime: 'application/pdf'
148
+ * }
149
+ * ];
150
+ * const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
151
+ */
152
+ async getUploadDocumentSignedUrl(docs, authorization) {
153
+ const self = this;
154
+
155
+ try {
156
+ Joi.assert(docs, Joi.string().array().error(new Error('docs is required')));
157
+ Joi.assert(authorization, Joi.string().required().error(new Error('authorization is required')));
158
+
159
+ const apiCall = self._client
160
+ .post(`/external/forms/upload/signedurls`, docs, self._setHeader(authorization));
161
+
162
+ return self._returnData(await apiCall);
163
+ } catch (ex) {
164
+ throw ex;
165
+ }
166
+ }
167
+
127
168
  /**
128
169
  * @author CloudBrasil <abernardo.br@gmail.com>
129
170
  * @description Handles the execution of an external form
@@ -186,6 +186,50 @@ class Process {
186
186
  throw ex;
187
187
  }
188
188
  }
189
+
190
+ /**
191
+ * @author CloudBrasil <abernardo.br@gmail.com>
192
+ * @description Method to search processes
193
+ * @param {object} params Params to search processes
194
+ * @param {object} params.query Search process query
195
+ * @param {object} params.orgId Organization id (_id database)
196
+ * @param {string} session Session, token JWT
197
+ * @returns {promise} returned data from the search
198
+ * @returns {number} count the count of items searched
199
+ * @returns {array<object>} items the items returned from search
200
+ * @returns {number} page the page of the search (on pagination), zero indexed
201
+ * @returns {number} perPage how many items per page
202
+ * @public
203
+ * @example
204
+ *
205
+ * const API = require('@docbrasil/api-systemmanager');
206
+ * const api = new API();
207
+ * const params = {
208
+ * query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
209
+ * orgId: '55e4a3bd6be6b45210833fae',
210
+ * };
211
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
212
+ * const retSearch = await api.user.process.find(params, session);
213
+ */
214
+ async find(params, session) {
215
+ const self = this;
216
+
217
+ try {
218
+ Joi.assert(params, Joi.object().required(), 'Params to search processes');
219
+ Joi.assert(params.query, Joi.object().required(), 'The query for the search');
220
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
221
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
222
+
223
+ const {query, orgId} = params;
224
+ const queryString = JSON.stringify(query);
225
+ const apiCall = self._client
226
+ .post(`/organizations/${orgId}/process/advsearch?query=${queryString}`, {}, self._setHeader(session));
227
+
228
+ return self._returnData(await apiCall);
229
+ } catch (ex) {
230
+ throw ex;
231
+ }
232
+ }
189
233
  }
190
234
 
191
235
  export default Process;
package/api/user/task.js CHANGED
@@ -124,6 +124,7 @@ class Task {
124
124
  async findByIdAndUpdate(params, session) {
125
125
  const self = this;
126
126
 
127
+
127
128
  try {
128
129
  Joi.assert(params, Joi.object().required());
129
130
  Joi.assert(params.userId, Joi.string().required(), 'User id (_id database)');
@@ -51,7 +51,7 @@ class TaskAvailable {
51
51
  * @author CloudBrasil <abernardo.br@gmail.com>
52
52
  * @description Method to find available tasks for a user
53
53
  * @param {object} params Params to get task
54
- * @param {object} params.query Search process query
54
+ * @param {object} params.query Search available tasks query
55
55
  * @param {object} params.orgId Organization id (_id database)
56
56
  * @param {string} session Session, token JWT
57
57
  * @returns {promise} returned data from the search
package/dist/bundle.cjs CHANGED
@@ -1687,6 +1687,50 @@ class Process {
1687
1687
  throw ex;
1688
1688
  }
1689
1689
  }
1690
+
1691
+ /**
1692
+ * @author CloudBrasil <abernardo.br@gmail.com>
1693
+ * @description Method to search processes
1694
+ * @param {object} params Params to search processes
1695
+ * @param {object} params.query Search process query
1696
+ * @param {object} params.orgId Organization id (_id database)
1697
+ * @param {string} session Session, token JWT
1698
+ * @returns {promise} returned data from the search
1699
+ * @returns {number} count the count of items searched
1700
+ * @returns {array<object>} items the items returned from search
1701
+ * @returns {number} page the page of the search (on pagination), zero indexed
1702
+ * @returns {number} perPage how many items per page
1703
+ * @public
1704
+ * @example
1705
+ *
1706
+ * const API = require('@docbrasil/api-systemmanager');
1707
+ * const api = new API();
1708
+ * const params = {
1709
+ * query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
1710
+ * orgId: '55e4a3bd6be6b45210833fae',
1711
+ * };
1712
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1713
+ * const retSearch = await api.user.process.find(params, session);
1714
+ */
1715
+ async find(params, session) {
1716
+ const self = this;
1717
+
1718
+ try {
1719
+ Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to search processes');
1720
+ Joi__default["default"].assert(params.query, Joi__default["default"].object().required(), 'The query for the search');
1721
+ Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'Organization id (_id database)');
1722
+ Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session token JWT');
1723
+
1724
+ const {query, orgId} = params;
1725
+ const queryString = JSON.stringify(query);
1726
+ const apiCall = self._client
1727
+ .post(`/organizations/${orgId}/process/advsearch?query=${queryString}`, {}, self._setHeader(session));
1728
+
1729
+ return self._returnData(await apiCall);
1730
+ } catch (ex) {
1731
+ throw ex;
1732
+ }
1733
+ }
1690
1734
  }
1691
1735
 
1692
1736
  /**
@@ -1738,7 +1782,7 @@ class TaskAvailable {
1738
1782
  * @author CloudBrasil <abernardo.br@gmail.com>
1739
1783
  * @description Method to find available tasks for a user
1740
1784
  * @param {object} params Params to get task
1741
- * @param {object} params.query Search process query
1785
+ * @param {object} params.query Search available tasks query
1742
1786
  * @param {object} params.orgId Organization id (_id database)
1743
1787
  * @param {string} session Session, token JWT
1744
1788
  * @returns {promise} returned data from the search
@@ -1940,6 +1984,7 @@ class Task {
1940
1984
  async findByIdAndUpdate(params, session) {
1941
1985
  const self = this;
1942
1986
 
1987
+
1943
1988
  try {
1944
1989
  Joi__default["default"].assert(params, Joi__default["default"].object().required());
1945
1990
  Joi__default["default"].assert(params.userId, Joi__default["default"].string().required(), 'User id (_id database)');
@@ -11700,6 +11745,47 @@ class External {
11700
11745
  }
11701
11746
  }
11702
11747
 
11748
+ /**
11749
+ * @author CloudBrasil <abernardo.br@gmail.com>
11750
+ * @description Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
11751
+ * @param {array<object>} docs the list of documents
11752
+ * @param {string} docs.mime the mime type of the document
11753
+ * @param {string} authorization a legal authorization
11754
+ * @returns {Promise<array>} docs
11755
+ * @returns {string} docs.mime the original mime type of the document
11756
+ * @returns {string} docs.signedUrl the signed url to upload the document
11757
+ * @returns {string} docs.filename the filename of the uploaded file
11758
+ * @returns {string} docs.extension the extension of the filename, obtained from the mime type
11759
+ * @public
11760
+ * @async
11761
+ * @example
11762
+ *
11763
+ * const API = require('@docbrasil/api-systemmanager');
11764
+ * const api = new API();
11765
+ * const authorization = '...';
11766
+ * const docs = [
11767
+ * {
11768
+ * mime: 'application/pdf'
11769
+ * }
11770
+ * ];
11771
+ * const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
11772
+ */
11773
+ async getUploadDocumentSignedUrl(docs, authorization) {
11774
+ const self = this;
11775
+
11776
+ try {
11777
+ Joi__default["default"].assert(docs, Joi__default["default"].string().array().error(new Error('docs is required')));
11778
+ Joi__default["default"].assert(authorization, Joi__default["default"].string().required().error(new Error('authorization is required')));
11779
+
11780
+ const apiCall = self._client
11781
+ .post(`/external/forms/upload/signedurls`, docs, self._setHeader(authorization));
11782
+
11783
+ return self._returnData(await apiCall);
11784
+ } catch (ex) {
11785
+ throw ex;
11786
+ }
11787
+ }
11788
+
11703
11789
  /**
11704
11790
  * @author CloudBrasil <abernardo.br@gmail.com>
11705
11791
  * @description Handles the execution of an external form