@docbrasil/api-systemmanager 1.1.27 → 1.1.28
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.
- package/api/user/document.js +48 -4
- package/dist/bundle.cjs +48 -4
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +29 -0
- package/docs/Documents.html +344 -0
- package/docs/user_document.js.html +48 -4
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -1541,6 +1541,7 @@ Class for documents, permission user
|
|
|
1541
1541
|
* [.exportExcelForAllPages(params, session)](#Documents+exportExcelForAllPages) ⇒ <code>promise</code>
|
|
1542
1542
|
* [.exportWmsExcelForAllPages(params, session)](#Documents+exportWmsExcelForAllPages) ⇒ <code>promise</code>
|
|
1543
1543
|
* [.performDownloadComplete(params, session)](#Documents+performDownloadComplete) ⇒ <code>promise</code>
|
|
1544
|
+
* [.searchDocumentsMongo(params, session)](#Documents+searchDocumentsMongo) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1544
1545
|
|
|
1545
1546
|
<a name="Documents+add"></a>
|
|
1546
1547
|
|
|
@@ -2037,6 +2038,34 @@ const params = {
|
|
|
2037
2038
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2038
2039
|
const retSearch = await api.user.document.performDownloadComplete(params, session);
|
|
2039
2040
|
```
|
|
2041
|
+
<a name="Documents+searchDocumentsMongo"></a>
|
|
2042
|
+
|
|
2043
|
+
### documents.searchDocumentsMongo(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2044
|
+
Method to search documents direct on MongoDB (use carefully and only in cases you need to access direct data
|
|
2045
|
+
|
|
2046
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
2047
|
+
**Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.<object></code> - items the items returned from search<code>number</code> - took the number of documents taken<code>number</code> - totalCount the total count of all documents
|
|
2048
|
+
**Access**: public
|
|
2049
|
+
**Author**: Myndware <augusto.pissarra@myndware.com>
|
|
2050
|
+
|
|
2051
|
+
| Param | Type | Description |
|
|
2052
|
+
| --- | --- | --- |
|
|
2053
|
+
| params | <code>object</code> | Params to search the documents |
|
|
2054
|
+
| params.query | <code>object</code> | Search documents query |
|
|
2055
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2056
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2057
|
+
|
|
2058
|
+
**Example**
|
|
2059
|
+
```js
|
|
2060
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2061
|
+
const api = new API();
|
|
2062
|
+
const params = {
|
|
2063
|
+
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
2064
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2065
|
+
};
|
|
2066
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2067
|
+
const retSearch = await api.user.document.searchDocumentsMongo(params, session);
|
|
2068
|
+
```
|
|
2040
2069
|
<a name="Help"></a>
|
|
2041
2070
|
|
|
2042
2071
|
## Help
|
package/docs/Documents.html
CHANGED
|
@@ -4835,6 +4835,350 @@ const retSearch = await api.user.document.searchDocuments(params, session);</cod
|
|
|
4835
4835
|
|
|
4836
4836
|
|
|
4837
4837
|
|
|
4838
|
+
</div>
|
|
4839
|
+
|
|
4840
|
+
<div class="member">
|
|
4841
|
+
|
|
4842
|
+
|
|
4843
|
+
|
|
4844
|
+
<h4 class="name" id="searchDocumentsMongo">
|
|
4845
|
+
<a class="href-link" href="#searchDocumentsMongo">#</a>
|
|
4846
|
+
|
|
4847
|
+
|
|
4848
|
+
<span class='tag'>async</span>
|
|
4849
|
+
|
|
4850
|
+
|
|
4851
|
+
<span class="code-name">
|
|
4852
|
+
|
|
4853
|
+
searchDocumentsMongo<span class="signature">(params, session)</span><span class="type-signature"> → {promise|number|array.<object>|number|number}</span>
|
|
4854
|
+
|
|
4855
|
+
</span>
|
|
4856
|
+
</h4>
|
|
4857
|
+
|
|
4858
|
+
|
|
4859
|
+
|
|
4860
|
+
|
|
4861
|
+
<div class="description">
|
|
4862
|
+
Method to search documents direct on MongoDB (use carefully and only in cases you need to access direct data
|
|
4863
|
+
</div>
|
|
4864
|
+
|
|
4865
|
+
|
|
4866
|
+
|
|
4867
|
+
|
|
4868
|
+
|
|
4869
|
+
|
|
4870
|
+
|
|
4871
|
+
|
|
4872
|
+
|
|
4873
|
+
|
|
4874
|
+
<h5>Parameters:</h5>
|
|
4875
|
+
|
|
4876
|
+
<div class="table-container">
|
|
4877
|
+
<table class="params table">
|
|
4878
|
+
<thead>
|
|
4879
|
+
<tr>
|
|
4880
|
+
|
|
4881
|
+
<th>Name</th>
|
|
4882
|
+
|
|
4883
|
+
|
|
4884
|
+
<th>Type</th>
|
|
4885
|
+
|
|
4886
|
+
|
|
4887
|
+
|
|
4888
|
+
|
|
4889
|
+
|
|
4890
|
+
<th class="last">Description</th>
|
|
4891
|
+
</tr>
|
|
4892
|
+
</thead>
|
|
4893
|
+
|
|
4894
|
+
<tbody>
|
|
4895
|
+
|
|
4896
|
+
|
|
4897
|
+
|
|
4898
|
+
<tr class="deep-level-0">
|
|
4899
|
+
|
|
4900
|
+
<td class="name"><code>params</code></td>
|
|
4901
|
+
|
|
4902
|
+
|
|
4903
|
+
<td class="type">
|
|
4904
|
+
|
|
4905
|
+
|
|
4906
|
+
<code class="param-type">object</code>
|
|
4907
|
+
|
|
4908
|
+
|
|
4909
|
+
|
|
4910
|
+
</td>
|
|
4911
|
+
|
|
4912
|
+
|
|
4913
|
+
|
|
4914
|
+
|
|
4915
|
+
|
|
4916
|
+
<td class="description last">Params to search the documents</td>
|
|
4917
|
+
</tr>
|
|
4918
|
+
|
|
4919
|
+
|
|
4920
|
+
|
|
4921
|
+
|
|
4922
|
+
<tr class="deep-level-1">
|
|
4923
|
+
|
|
4924
|
+
<td class="name"><code>query</code></td>
|
|
4925
|
+
|
|
4926
|
+
|
|
4927
|
+
<td class="type">
|
|
4928
|
+
|
|
4929
|
+
|
|
4930
|
+
<code class="param-type">object</code>
|
|
4931
|
+
|
|
4932
|
+
|
|
4933
|
+
|
|
4934
|
+
</td>
|
|
4935
|
+
|
|
4936
|
+
|
|
4937
|
+
|
|
4938
|
+
|
|
4939
|
+
|
|
4940
|
+
<td class="description last">Search documents query</td>
|
|
4941
|
+
</tr>
|
|
4942
|
+
|
|
4943
|
+
|
|
4944
|
+
|
|
4945
|
+
<tr class="deep-level-1">
|
|
4946
|
+
|
|
4947
|
+
<td class="name"><code>orgId</code></td>
|
|
4948
|
+
|
|
4949
|
+
|
|
4950
|
+
<td class="type">
|
|
4951
|
+
|
|
4952
|
+
|
|
4953
|
+
<code class="param-type">object</code>
|
|
4954
|
+
|
|
4955
|
+
|
|
4956
|
+
|
|
4957
|
+
</td>
|
|
4958
|
+
|
|
4959
|
+
|
|
4960
|
+
|
|
4961
|
+
|
|
4962
|
+
|
|
4963
|
+
<td class="description last">Organization id (_id database)</td>
|
|
4964
|
+
</tr>
|
|
4965
|
+
|
|
4966
|
+
|
|
4967
|
+
|
|
4968
|
+
|
|
4969
|
+
|
|
4970
|
+
|
|
4971
|
+
|
|
4972
|
+
<tr class="deep-level-0">
|
|
4973
|
+
|
|
4974
|
+
<td class="name"><code>session</code></td>
|
|
4975
|
+
|
|
4976
|
+
|
|
4977
|
+
<td class="type">
|
|
4978
|
+
|
|
4979
|
+
|
|
4980
|
+
<code class="param-type">string</code>
|
|
4981
|
+
|
|
4982
|
+
|
|
4983
|
+
|
|
4984
|
+
</td>
|
|
4985
|
+
|
|
4986
|
+
|
|
4987
|
+
|
|
4988
|
+
|
|
4989
|
+
|
|
4990
|
+
<td class="description last">Session, token JWT</td>
|
|
4991
|
+
</tr>
|
|
4992
|
+
|
|
4993
|
+
|
|
4994
|
+
|
|
4995
|
+
</tbody>
|
|
4996
|
+
</table>
|
|
4997
|
+
</div>
|
|
4998
|
+
|
|
4999
|
+
|
|
5000
|
+
|
|
5001
|
+
|
|
5002
|
+
|
|
5003
|
+
<dl class="details">
|
|
5004
|
+
|
|
5005
|
+
|
|
5006
|
+
|
|
5007
|
+
|
|
5008
|
+
|
|
5009
|
+
|
|
5010
|
+
|
|
5011
|
+
|
|
5012
|
+
|
|
5013
|
+
|
|
5014
|
+
|
|
5015
|
+
|
|
5016
|
+
|
|
5017
|
+
|
|
5018
|
+
|
|
5019
|
+
|
|
5020
|
+
|
|
5021
|
+
|
|
5022
|
+
<dt class="tag-author">Author:</dt>
|
|
5023
|
+
<dd class="tag-author">
|
|
5024
|
+
<ul>
|
|
5025
|
+
<li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
|
|
5026
|
+
</ul>
|
|
5027
|
+
</dd>
|
|
5028
|
+
|
|
5029
|
+
|
|
5030
|
+
|
|
5031
|
+
|
|
5032
|
+
|
|
5033
|
+
|
|
5034
|
+
|
|
5035
|
+
|
|
5036
|
+
|
|
5037
|
+
|
|
5038
|
+
|
|
5039
|
+
|
|
5040
|
+
|
|
5041
|
+
|
|
5042
|
+
<p class="tag-source">
|
|
5043
|
+
<a href="user_document.js.html" class="button">View Source</a>
|
|
5044
|
+
<span>
|
|
5045
|
+
<a href="user_document.js.html">user/document.js</a>, <a href="user_document.js.html#line961">line 961</a>
|
|
5046
|
+
</span>
|
|
5047
|
+
</p>
|
|
5048
|
+
|
|
5049
|
+
</dl>
|
|
5050
|
+
|
|
5051
|
+
|
|
5052
|
+
|
|
5053
|
+
|
|
5054
|
+
|
|
5055
|
+
|
|
5056
|
+
|
|
5057
|
+
|
|
5058
|
+
|
|
5059
|
+
|
|
5060
|
+
|
|
5061
|
+
|
|
5062
|
+
|
|
5063
|
+
|
|
5064
|
+
|
|
5065
|
+
|
|
5066
|
+
|
|
5067
|
+
|
|
5068
|
+
<div class='columns method-parameter'>
|
|
5069
|
+
<div class="column is-2"><label>Returns:</label></div>
|
|
5070
|
+
<div class="column is-10">
|
|
5071
|
+
|
|
5072
|
+
|
|
5073
|
+
|
|
5074
|
+
<div class="columns">
|
|
5075
|
+
|
|
5076
|
+
<div class='param-desc column is-7'>returned data from the search</div>
|
|
5077
|
+
|
|
5078
|
+
|
|
5079
|
+
<div class='column is-5 has-text-left'>
|
|
5080
|
+
<label>Type: </label>
|
|
5081
|
+
|
|
5082
|
+
<code class="param-type">promise</code>
|
|
5083
|
+
|
|
5084
|
+
|
|
5085
|
+
</div>
|
|
5086
|
+
|
|
5087
|
+
</div>
|
|
5088
|
+
|
|
5089
|
+
|
|
5090
|
+
|
|
5091
|
+
|
|
5092
|
+
<div class="columns">
|
|
5093
|
+
|
|
5094
|
+
<div class='param-desc column is-7'>count the count of items searched</div>
|
|
5095
|
+
|
|
5096
|
+
|
|
5097
|
+
<div class='column is-5 has-text-left'>
|
|
5098
|
+
<label>Type: </label>
|
|
5099
|
+
|
|
5100
|
+
<code class="param-type">number</code>
|
|
5101
|
+
|
|
5102
|
+
|
|
5103
|
+
</div>
|
|
5104
|
+
|
|
5105
|
+
</div>
|
|
5106
|
+
|
|
5107
|
+
|
|
5108
|
+
|
|
5109
|
+
|
|
5110
|
+
<div class="columns">
|
|
5111
|
+
|
|
5112
|
+
<div class='param-desc column is-7'>items the items returned from search</div>
|
|
5113
|
+
|
|
5114
|
+
|
|
5115
|
+
<div class='column is-5 has-text-left'>
|
|
5116
|
+
<label>Type: </label>
|
|
5117
|
+
|
|
5118
|
+
<code class="param-type">array.<object></code>
|
|
5119
|
+
|
|
5120
|
+
|
|
5121
|
+
</div>
|
|
5122
|
+
|
|
5123
|
+
</div>
|
|
5124
|
+
|
|
5125
|
+
|
|
5126
|
+
|
|
5127
|
+
|
|
5128
|
+
<div class="columns">
|
|
5129
|
+
|
|
5130
|
+
<div class='param-desc column is-7'>took the number of documents taken</div>
|
|
5131
|
+
|
|
5132
|
+
|
|
5133
|
+
<div class='column is-5 has-text-left'>
|
|
5134
|
+
<label>Type: </label>
|
|
5135
|
+
|
|
5136
|
+
<code class="param-type">number</code>
|
|
5137
|
+
|
|
5138
|
+
|
|
5139
|
+
</div>
|
|
5140
|
+
|
|
5141
|
+
</div>
|
|
5142
|
+
|
|
5143
|
+
|
|
5144
|
+
|
|
5145
|
+
|
|
5146
|
+
<div class="columns">
|
|
5147
|
+
|
|
5148
|
+
<div class='param-desc column is-7'>totalCount the total count of all documents</div>
|
|
5149
|
+
|
|
5150
|
+
|
|
5151
|
+
<div class='column is-5 has-text-left'>
|
|
5152
|
+
<label>Type: </label>
|
|
5153
|
+
|
|
5154
|
+
<code class="param-type">number</code>
|
|
5155
|
+
|
|
5156
|
+
|
|
5157
|
+
</div>
|
|
5158
|
+
|
|
5159
|
+
</div>
|
|
5160
|
+
|
|
5161
|
+
|
|
5162
|
+
</div>
|
|
5163
|
+
</div>
|
|
5164
|
+
|
|
5165
|
+
|
|
5166
|
+
|
|
5167
|
+
|
|
5168
|
+
<h5>Example</h5>
|
|
5169
|
+
|
|
5170
|
+
|
|
5171
|
+
<pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
|
|
5172
|
+
const api = new API();
|
|
5173
|
+
const params = {
|
|
5174
|
+
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
5175
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
5176
|
+
};
|
|
5177
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
5178
|
+
const retSearch = await api.user.document.searchDocumentsMongo(params, session);</code></pre>
|
|
5179
|
+
|
|
5180
|
+
|
|
5181
|
+
|
|
4838
5182
|
</div>
|
|
4839
5183
|
|
|
4840
5184
|
<div class="member">
|
|
@@ -952,18 +952,18 @@ class Documents {
|
|
|
952
952
|
*/
|
|
953
953
|
async exportWmsExcelForAllPages(params, session) {
|
|
954
954
|
const self = this;
|
|
955
|
-
|
|
955
|
+
|
|
956
956
|
try {
|
|
957
957
|
Joi.assert(params, Joi.object().required(), 'Params to export Wms Excel for all pages');
|
|
958
958
|
Joi.assert(params.query, Joi.object().required(), 'The query for the export Wms Excel for all pages');
|
|
959
959
|
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
960
960
|
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
961
|
-
|
|
961
|
+
|
|
962
962
|
const {query, orgId} = params;
|
|
963
963
|
const searchParams = new URLSearchParams(query);
|
|
964
964
|
const queryString = searchParams.toString();
|
|
965
965
|
const apiCall = self._client.get(`/organizations/${orgId}/documents/wms/export/excel?${queryString}`, self._setHeader(session));
|
|
966
|
-
|
|
966
|
+
|
|
967
967
|
return self._returnData(await apiCall);
|
|
968
968
|
} catch (ex) {
|
|
969
969
|
throw ex;
|
|
@@ -1013,13 +1013,57 @@ class Documents {
|
|
|
1013
1013
|
const {query, orgId, data} = params;
|
|
1014
1014
|
const searchParams = new URLSearchParams(query);
|
|
1015
1015
|
const queryString = searchParams.toString();
|
|
1016
|
-
|
|
1016
|
+
|
|
1017
1017
|
const apiCall = self._client.post(`/organizations/${orgId}/documents/download/attachments?${queryString}`, data, self._setHeader(session));
|
|
1018
1018
|
return self._returnData(await apiCall);
|
|
1019
1019
|
} catch (ex) {
|
|
1020
1020
|
throw ex;
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
1026
|
+
* @description Method to search documents direct on MongoDB (use carefully and only in cases you need to access direct data
|
|
1027
|
+
* @param {object} params Params to search the documents
|
|
1028
|
+
* @param {object} params.query Search documents query
|
|
1029
|
+
* @param {object} params.orgId Organization id (_id database)
|
|
1030
|
+
* @param {string} session Session, token JWT
|
|
1031
|
+
* @returns {promise} returned data from the search
|
|
1032
|
+
* @returns {number} count the count of items searched
|
|
1033
|
+
* @returns {array<object>} items the items returned from search
|
|
1034
|
+
* @returns {number} took the number of documents taken
|
|
1035
|
+
* @returns {number} totalCount the total count of all documents
|
|
1036
|
+
* @public
|
|
1037
|
+
* @example
|
|
1038
|
+
*
|
|
1039
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
1040
|
+
* const api = new API();
|
|
1041
|
+
* const params = {
|
|
1042
|
+
* query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1043
|
+
* orgId: '55e4a3bd6be6b45210833fae',
|
|
1044
|
+
* };
|
|
1045
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1046
|
+
* const retSearch = await api.user.document.searchDocumentsMongo(params, session);
|
|
1047
|
+
*/
|
|
1048
|
+
async searchDocumentsMongo(params, session) {
|
|
1049
|
+
const self = this;
|
|
1050
|
+
|
|
1051
|
+
try {
|
|
1052
|
+
Joi.assert(params, Joi.object().required(), 'Params to search the documents');
|
|
1053
|
+
Joi.assert(params.query, Joi.object().required(), 'The query for the search documents');
|
|
1054
|
+
Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
|
|
1055
|
+
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
1056
|
+
|
|
1057
|
+
const {query, orgId} = params;
|
|
1058
|
+
const searchParams = new URLSearchParams(query);
|
|
1059
|
+
const queryString = searchParams.toString();
|
|
1060
|
+
const apiCall = self._client.get(`/organizations/${orgId}/documents/search/direct?${queryString}`, self._setHeader(session));
|
|
1061
|
+
|
|
1062
|
+
return self._returnData(await apiCall);
|
|
1063
|
+
} catch (ex) {
|
|
1064
|
+
throw ex;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1023
1067
|
}
|
|
1024
1068
|
|
|
1025
1069
|
export default Documents;
|
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.
|
|
4
|
+
"version": "1.1.28",
|
|
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",
|