@docbrasil/api-systemmanager 1.0.104 → 1.0.105
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/external.js +10 -10
- package/dist/bundle.cjs +10 -10
- package/dist/bundle.mjs +1 -1
- package/package.json +1 -1
package/api/external.js
CHANGED
|
@@ -39,10 +39,10 @@ class External {
|
|
|
39
39
|
* @return {object} header with new session
|
|
40
40
|
* @private
|
|
41
41
|
*/
|
|
42
|
-
_setHeader(
|
|
42
|
+
_setHeader(authorization) {
|
|
43
43
|
return {
|
|
44
44
|
headers: {
|
|
45
|
-
|
|
45
|
+
authorization,
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
}
|
|
@@ -55,8 +55,8 @@ class External {
|
|
|
55
55
|
* @return {Promise<object>} data
|
|
56
56
|
* @return {string} _id the id of the form
|
|
57
57
|
* @return {string} orgId the organization id of the form
|
|
58
|
-
* @return {string}
|
|
59
|
-
* The
|
|
58
|
+
* @return {string} authorization the unique token registered internally by the system for all the next calls to the external form APIs
|
|
59
|
+
* The authorization is unique and is ONLY valid for this session.
|
|
60
60
|
* @return {array<object>} groups the form groups to render
|
|
61
61
|
* @public
|
|
62
62
|
* @async
|
|
@@ -90,7 +90,7 @@ class External {
|
|
|
90
90
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
91
91
|
* @description Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
92
92
|
* @param {string} mime the mime type of the document
|
|
93
|
-
* @param {string}
|
|
93
|
+
* @param {string} authorization a legal authorization
|
|
94
94
|
* @returns {Promise<object>} doc
|
|
95
95
|
* @returns {string} doc.mime the original mime type of the document
|
|
96
96
|
* @returns {string} doc.signedUrl the signed url to upload the document
|
|
@@ -102,21 +102,21 @@ class External {
|
|
|
102
102
|
*
|
|
103
103
|
* const API = require('@docbrasil/api-systemmanager');
|
|
104
104
|
* const api = new API();
|
|
105
|
-
* const
|
|
105
|
+
* const authorization = '...';
|
|
106
106
|
* const doc = {
|
|
107
107
|
* mime: 'application/pdf'
|
|
108
108
|
* };
|
|
109
|
-
* const retDoc = await api.external.getUploadDocumentSignedUrl(doc,
|
|
109
|
+
* const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
110
110
|
*/
|
|
111
|
-
async getUploadDocumentSignedUrl(mime,
|
|
111
|
+
async getUploadDocumentSignedUrl(mime, authorization) {
|
|
112
112
|
const self = this;
|
|
113
113
|
|
|
114
114
|
try {
|
|
115
115
|
Joi.assert(mime, Joi.string().required().error(new Error('mime type is required')));
|
|
116
|
-
Joi.assert(
|
|
116
|
+
Joi.assert(authorization, Joi.string().required().error(new Error('authorization is required')));
|
|
117
117
|
|
|
118
118
|
const apiCall = self._client
|
|
119
|
-
.get(`/external/forms/upload/signedurl?mime=${encodeURIComponent(mime)}`, self._setHeader(
|
|
119
|
+
.get(`/external/forms/upload/signedurl?mime=${encodeURIComponent(mime)}`, self._setHeader(authorization));
|
|
120
120
|
|
|
121
121
|
return self._returnData(await apiCall);
|
|
122
122
|
} catch (ex) {
|
package/dist/bundle.cjs
CHANGED
|
@@ -11615,10 +11615,10 @@ class External {
|
|
|
11615
11615
|
* @return {object} header with new session
|
|
11616
11616
|
* @private
|
|
11617
11617
|
*/
|
|
11618
|
-
_setHeader(
|
|
11618
|
+
_setHeader(authorization) {
|
|
11619
11619
|
return {
|
|
11620
11620
|
headers: {
|
|
11621
|
-
|
|
11621
|
+
authorization,
|
|
11622
11622
|
}
|
|
11623
11623
|
};
|
|
11624
11624
|
}
|
|
@@ -11631,8 +11631,8 @@ class External {
|
|
|
11631
11631
|
* @return {Promise<object>} data
|
|
11632
11632
|
* @return {string} _id the id of the form
|
|
11633
11633
|
* @return {string} orgId the organization id of the form
|
|
11634
|
-
* @return {string}
|
|
11635
|
-
* The
|
|
11634
|
+
* @return {string} authorization the unique token registered internally by the system for all the next calls to the external form APIs
|
|
11635
|
+
* The authorization is unique and is ONLY valid for this session.
|
|
11636
11636
|
* @return {array<object>} groups the form groups to render
|
|
11637
11637
|
* @public
|
|
11638
11638
|
* @async
|
|
@@ -11666,7 +11666,7 @@ class External {
|
|
|
11666
11666
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
11667
11667
|
* @description Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
11668
11668
|
* @param {string} mime the mime type of the document
|
|
11669
|
-
* @param {string}
|
|
11669
|
+
* @param {string} authorization a legal authorization
|
|
11670
11670
|
* @returns {Promise<object>} doc
|
|
11671
11671
|
* @returns {string} doc.mime the original mime type of the document
|
|
11672
11672
|
* @returns {string} doc.signedUrl the signed url to upload the document
|
|
@@ -11678,21 +11678,21 @@ class External {
|
|
|
11678
11678
|
*
|
|
11679
11679
|
* const API = require('@docbrasil/api-systemmanager');
|
|
11680
11680
|
* const api = new API();
|
|
11681
|
-
* const
|
|
11681
|
+
* const authorization = '...';
|
|
11682
11682
|
* const doc = {
|
|
11683
11683
|
* mime: 'application/pdf'
|
|
11684
11684
|
* };
|
|
11685
|
-
* const retDoc = await api.external.getUploadDocumentSignedUrl(doc,
|
|
11685
|
+
* const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
11686
11686
|
*/
|
|
11687
|
-
async getUploadDocumentSignedUrl(mime,
|
|
11687
|
+
async getUploadDocumentSignedUrl(mime, authorization) {
|
|
11688
11688
|
const self = this;
|
|
11689
11689
|
|
|
11690
11690
|
try {
|
|
11691
11691
|
Joi__default["default"].assert(mime, Joi__default["default"].string().required().error(new Error('mime type is required')));
|
|
11692
|
-
Joi__default["default"].assert(
|
|
11692
|
+
Joi__default["default"].assert(authorization, Joi__default["default"].string().required().error(new Error('authorization is required')));
|
|
11693
11693
|
|
|
11694
11694
|
const apiCall = self._client
|
|
11695
|
-
.get(`/external/forms/upload/signedurl?mime=${encodeURIComponent(mime)}`, self._setHeader(
|
|
11695
|
+
.get(`/external/forms/upload/signedurl?mime=${encodeURIComponent(mime)}`, self._setHeader(authorization));
|
|
11696
11696
|
|
|
11697
11697
|
return self._returnData(await apiCall);
|
|
11698
11698
|
} catch (ex) {
|