@docbrasil/api-systemmanager 1.0.60 → 1.0.63
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 +1 -1
- package/api/user/user.js +74 -0
- package/dist/bundle.cjs +75 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +58 -252
- package/package.json +1 -1
package/api/user/document.js
CHANGED
|
@@ -98,7 +98,7 @@ class Documents {
|
|
|
98
98
|
ocrDocumentBackend: _.get(params, 'ocrDocumentBackend', false),
|
|
99
99
|
bytes: _.get(params, 'bytes'),
|
|
100
100
|
docAreaPermission: _.get(params, 'docAreaPermission', {}),
|
|
101
|
-
docTypeFields: _.get(params, 'docTypeFields',
|
|
101
|
+
docTypeFields: _.get(params, 'docTypeFields', []), // {"extraId": userId},
|
|
102
102
|
docTypeFieldsData: _.get(params, 'docTypeFieldsData', {}), // {"extraId": userId},
|
|
103
103
|
signedUrl: _.get(params, 'signedUrl', ''),
|
|
104
104
|
urlType: _.get(params, 'urlType', 'S3'),
|
package/api/user/user.js
CHANGED
|
@@ -119,6 +119,80 @@ class User {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
124
|
+
* @description Remove the signature of user by session
|
|
125
|
+
* @param {string} session Is token JWT of user NOT allow SU
|
|
126
|
+
* @return {Promise}
|
|
127
|
+
* @public
|
|
128
|
+
* @async
|
|
129
|
+
* @example
|
|
130
|
+
*
|
|
131
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
132
|
+
* const api = new API();
|
|
133
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
134
|
+
* await api.user.profile.removeSignature(session);
|
|
135
|
+
*/
|
|
136
|
+
async removeSignature(session) {
|
|
137
|
+
const self = this;
|
|
138
|
+
|
|
139
|
+
try {
|
|
140
|
+
Joi.assert(session, Joi.string().required());
|
|
141
|
+
|
|
142
|
+
const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
|
|
143
|
+
return self._returnData(await apiCall);
|
|
144
|
+
} catch (ex) {
|
|
145
|
+
throw ex;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
151
|
+
* @description Sava a new signature of user by session
|
|
152
|
+
* @param {object} data The signature data to save
|
|
153
|
+
* @param {string} data.type CURSIVE or HANDWRITE
|
|
154
|
+
* @param {string} data.file CURSIVE the <fontname>:<name used on the signature>
|
|
155
|
+
* HANDWRITE the base 64 image (w/o the mime a base prefix)
|
|
156
|
+
* @param {string} session Is token JWT of user NOT allow SU
|
|
157
|
+
* @return {Promise}
|
|
158
|
+
* @public
|
|
159
|
+
* @async
|
|
160
|
+
* @example
|
|
161
|
+
*
|
|
162
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
163
|
+
* const api = new API();
|
|
164
|
+
* const data = {
|
|
165
|
+
* type: 'CURSIVE',
|
|
166
|
+
* file: 'allura:Mary John Heart'
|
|
167
|
+
* };
|
|
168
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
169
|
+
* await api.user.profile.saveSignature(data, session);
|
|
170
|
+
*
|
|
171
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
172
|
+
* const api = new API();
|
|
173
|
+
* const data = {
|
|
174
|
+
* type: 'HANDWRITE',
|
|
175
|
+
* file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
176
|
+
* };
|
|
177
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
178
|
+
* await api.user.profile.saveSignature(session);
|
|
179
|
+
*/
|
|
180
|
+
async saveSignature(data, session) {
|
|
181
|
+
const self = this;
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
Joi.assert(data, Joi.object().required());
|
|
185
|
+
Joi.assert(data.type, Joi.string().required());
|
|
186
|
+
Joi.assert(data.file, Joi.string().required());
|
|
187
|
+
Joi.assert(session, Joi.string().required());
|
|
188
|
+
|
|
189
|
+
const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
|
|
190
|
+
return self._returnData(await apiCall);
|
|
191
|
+
} catch (ex) {
|
|
192
|
+
throw ex;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
122
196
|
/**
|
|
123
197
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
124
198
|
* @description Update a user profile by id
|
package/dist/bundle.cjs
CHANGED
|
@@ -650,6 +650,7 @@ class Documents {
|
|
|
650
650
|
ocrDocumentBackend: ___default["default"].get(params, 'ocrDocumentBackend', false),
|
|
651
651
|
bytes: ___default["default"].get(params, 'bytes'),
|
|
652
652
|
docAreaPermission: ___default["default"].get(params, 'docAreaPermission', {}),
|
|
653
|
+
docTypeFields: ___default["default"].get(params, 'docTypeFields', []), // {"extraId": userId},
|
|
653
654
|
docTypeFieldsData: ___default["default"].get(params, 'docTypeFieldsData', {}), // {"extraId": userId},
|
|
654
655
|
signedUrl: ___default["default"].get(params, 'signedUrl', ''),
|
|
655
656
|
urlType: ___default["default"].get(params, 'urlType', 'S3'),
|
|
@@ -1769,6 +1770,80 @@ class User {
|
|
|
1769
1770
|
}
|
|
1770
1771
|
}
|
|
1771
1772
|
|
|
1773
|
+
/**
|
|
1774
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
1775
|
+
* @description Remove the signature of user by session
|
|
1776
|
+
* @param {string} session Is token JWT of user NOT allow SU
|
|
1777
|
+
* @return {Promise}
|
|
1778
|
+
* @public
|
|
1779
|
+
* @async
|
|
1780
|
+
* @example
|
|
1781
|
+
*
|
|
1782
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
1783
|
+
* const api = new API();
|
|
1784
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1785
|
+
* await api.user.profile.removeSignature(session);
|
|
1786
|
+
*/
|
|
1787
|
+
async removeSignature(session) {
|
|
1788
|
+
const self = this;
|
|
1789
|
+
|
|
1790
|
+
try {
|
|
1791
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required());
|
|
1792
|
+
|
|
1793
|
+
const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
|
|
1794
|
+
return self._returnData(await apiCall);
|
|
1795
|
+
} catch (ex) {
|
|
1796
|
+
throw ex;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
1802
|
+
* @description Sava a new signature of user by session
|
|
1803
|
+
* @param {object} data The signature data to save
|
|
1804
|
+
* @param {string} data.type CURSIVE or HANDWRITE
|
|
1805
|
+
* @param {string} data.file CURSIVE the <fontname>:<name used on the signature>
|
|
1806
|
+
* HANDWRITE the base 64 image (w/o the mime a base prefix)
|
|
1807
|
+
* @param {string} session Is token JWT of user NOT allow SU
|
|
1808
|
+
* @return {Promise}
|
|
1809
|
+
* @public
|
|
1810
|
+
* @async
|
|
1811
|
+
* @example
|
|
1812
|
+
*
|
|
1813
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
1814
|
+
* const api = new API();
|
|
1815
|
+
* const data = {
|
|
1816
|
+
* type: 'CURSIVE',
|
|
1817
|
+
* file: 'allura:Mary John Heart'
|
|
1818
|
+
* };
|
|
1819
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1820
|
+
* await api.user.profile.saveSignature(data, session);
|
|
1821
|
+
*
|
|
1822
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
1823
|
+
* const api = new API();
|
|
1824
|
+
* const data = {
|
|
1825
|
+
* type: 'HANDWRITE',
|
|
1826
|
+
* file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
1827
|
+
* };
|
|
1828
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1829
|
+
* await api.user.profile.saveSignature(session);
|
|
1830
|
+
*/
|
|
1831
|
+
async saveSignature(data, session) {
|
|
1832
|
+
const self = this;
|
|
1833
|
+
|
|
1834
|
+
try {
|
|
1835
|
+
Joi__default["default"].assert(data, Joi__default["default"].object().required());
|
|
1836
|
+
Joi__default["default"].assert(data.type, Joi__default["default"].string().required());
|
|
1837
|
+
Joi__default["default"].assert(data.file, Joi__default["default"].string().required());
|
|
1838
|
+
Joi__default["default"].assert(session, Joi__default["default"].string().required());
|
|
1839
|
+
|
|
1840
|
+
const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
|
|
1841
|
+
return self._returnData(await apiCall);
|
|
1842
|
+
} catch (ex) {
|
|
1843
|
+
throw ex;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1772
1847
|
/**
|
|
1773
1848
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
1774
1849
|
* @description Update a user profile by id
|