apacuana-sdk-core 1.26.0 → 1.26.2
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/.env +8 -0
- package/README.md +69 -0
- package/coverage/clover.xml +192 -147
- package/coverage/coverage-final.json +4 -4
- package/coverage/lcov-report/index.html +27 -27
- package/coverage/lcov-report/src/api/certs.js.html +1 -1
- package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
- package/coverage/lcov-report/src/api/index.html +18 -18
- package/coverage/lcov-report/src/api/revocations.js.html +1 -1
- package/coverage/lcov-report/src/api/signatures.js.html +413 -11
- package/coverage/lcov-report/src/api/users.js.html +1 -1
- package/coverage/lcov-report/src/config/index.html +1 -1
- package/coverage/lcov-report/src/config/index.js.html +1 -1
- package/coverage/lcov-report/src/errors/index.html +1 -1
- package/coverage/lcov-report/src/errors/index.js.html +8 -8
- package/coverage/lcov-report/src/index.html +15 -15
- package/coverage/lcov-report/src/index.js.html +41 -8
- package/coverage/lcov-report/src/success/index.html +1 -1
- package/coverage/lcov-report/src/success/index.js.html +5 -5
- package/coverage/lcov-report/src/utils/constant.js.html +1 -1
- package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
- package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +343 -253
- package/dist/api/signatures.d.ts +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +290 -93
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +290 -93
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/signatures.js +136 -2
- package/src/index.js +11 -0
- package/tests/api/signatures.test.js +166 -2
- package/tests/integration/createAndLockDocument.test.js +93 -0
- package/coverage/lcov-report/api/index.html +0 -131
- package/coverage/lcov-report/api/signatures.js.html +0 -1093
- package/coverage/lcov-report/api/users.js.html +0 -292
- package/coverage/lcov-report/certs.js.html +0 -175
- package/coverage/lcov-report/config/index.html +0 -116
- package/coverage/lcov-report/config/index.js.html +0 -208
- package/coverage/lcov-report/errors/index.html +0 -116
- package/coverage/lcov-report/errors/index.js.html +0 -148
- package/coverage/lcov-report/utils/constant.js.html +0 -145
- package/coverage/lcov-report/utils/httpClient.js.html +0 -646
- package/coverage/lcov-report/utils/index.html +0 -131
package/dist/index.mjs
CHANGED
|
@@ -33967,12 +33967,11 @@ var addMemberOnBoarding = /*#__PURE__*/function () {
|
|
|
33967
33967
|
return _regenerator().w(function (_context13) {
|
|
33968
33968
|
while (1) switch (_context13.p = _context13.n) {
|
|
33969
33969
|
case 0:
|
|
33970
|
-
payload = helpers.validateAddMemberData(memberData);
|
|
33970
|
+
payload = helpers.validateAddMemberData(memberData);
|
|
33971
33971
|
apiPayload = {
|
|
33972
33972
|
docid: payload.documentId,
|
|
33973
33973
|
kinddoc: payload.typedoc,
|
|
33974
|
-
doc: payload.doc
|
|
33975
|
-
signature: payload.signature
|
|
33974
|
+
doc: payload.doc
|
|
33976
33975
|
};
|
|
33977
33976
|
_context13.p = 1;
|
|
33978
33977
|
_context13.n = 2;
|
|
@@ -34014,6 +34013,104 @@ var addMemberOnPremise = /*#__PURE__*/function () {
|
|
|
34014
34013
|
return _ref15.apply(this, arguments);
|
|
34015
34014
|
};
|
|
34016
34015
|
}();
|
|
34016
|
+
var createDocumentOnBoarding = /*#__PURE__*/function () {
|
|
34017
|
+
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(documentData) {
|
|
34018
|
+
var formData, response, _t9;
|
|
34019
|
+
return _regenerator().w(function (_context15) {
|
|
34020
|
+
while (1) switch (_context15.p = _context15.n) {
|
|
34021
|
+
case 0:
|
|
34022
|
+
formData = new FormData();
|
|
34023
|
+
formData.append("name", documentData.name);
|
|
34024
|
+
formData.append("reference", documentData.reference);
|
|
34025
|
+
_context15.p = 1;
|
|
34026
|
+
_context15.n = 2;
|
|
34027
|
+
return httpRequest("services/api/documents", formData, "POST");
|
|
34028
|
+
case 2:
|
|
34029
|
+
response = _context15.v;
|
|
34030
|
+
return _context15.a(2, new ApacuanaSuccess({
|
|
34031
|
+
msg: response.msg,
|
|
34032
|
+
id: response.id
|
|
34033
|
+
}));
|
|
34034
|
+
case 3:
|
|
34035
|
+
_context15.p = 3;
|
|
34036
|
+
_t9 = _context15.v;
|
|
34037
|
+
if (!(_t9 instanceof ApacuanaAPIError)) {
|
|
34038
|
+
_context15.n = 4;
|
|
34039
|
+
break;
|
|
34040
|
+
}
|
|
34041
|
+
throw _t9;
|
|
34042
|
+
case 4:
|
|
34043
|
+
throw new ApacuanaAPIError("Failed to create document: ".concat(_t9.message || "Unknown error"));
|
|
34044
|
+
case 5:
|
|
34045
|
+
return _context15.a(2);
|
|
34046
|
+
}
|
|
34047
|
+
}, _callee15, null, [[1, 3]]);
|
|
34048
|
+
}));
|
|
34049
|
+
return function createDocumentOnBoarding(_x7) {
|
|
34050
|
+
return _ref16.apply(this, arguments);
|
|
34051
|
+
};
|
|
34052
|
+
}();
|
|
34053
|
+
var createDocumentOnPremise = /*#__PURE__*/function () {
|
|
34054
|
+
var _ref17 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
34055
|
+
return _regenerator().w(function (_context16) {
|
|
34056
|
+
while (1) switch (_context16.n) {
|
|
34057
|
+
case 0:
|
|
34058
|
+
throw new ApacuanaAPIError("Creating documents is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
34059
|
+
case 1:
|
|
34060
|
+
return _context16.a(2);
|
|
34061
|
+
}
|
|
34062
|
+
}, _callee16);
|
|
34063
|
+
}));
|
|
34064
|
+
return function createDocumentOnPremise() {
|
|
34065
|
+
return _ref17.apply(this, arguments);
|
|
34066
|
+
};
|
|
34067
|
+
}();
|
|
34068
|
+
var lockDocumentOnBoarding = /*#__PURE__*/function () {
|
|
34069
|
+
var _ref18 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(documentId) {
|
|
34070
|
+
var response, _t0;
|
|
34071
|
+
return _regenerator().w(function (_context17) {
|
|
34072
|
+
while (1) switch (_context17.p = _context17.n) {
|
|
34073
|
+
case 0:
|
|
34074
|
+
_context17.p = 0;
|
|
34075
|
+
_context17.n = 1;
|
|
34076
|
+
return httpRequest("services/api/documents/lock/".concat(documentId), {}, "PUT");
|
|
34077
|
+
case 1:
|
|
34078
|
+
response = _context17.v;
|
|
34079
|
+
return _context17.a(2, new ApacuanaSuccess(response));
|
|
34080
|
+
case 2:
|
|
34081
|
+
_context17.p = 2;
|
|
34082
|
+
_t0 = _context17.v;
|
|
34083
|
+
if (!(_t0 instanceof ApacuanaAPIError)) {
|
|
34084
|
+
_context17.n = 3;
|
|
34085
|
+
break;
|
|
34086
|
+
}
|
|
34087
|
+
throw _t0;
|
|
34088
|
+
case 3:
|
|
34089
|
+
throw new ApacuanaAPIError("Failed to lock document: ".concat(_t0.message || "Unknown error"));
|
|
34090
|
+
case 4:
|
|
34091
|
+
return _context17.a(2);
|
|
34092
|
+
}
|
|
34093
|
+
}, _callee17, null, [[0, 2]]);
|
|
34094
|
+
}));
|
|
34095
|
+
return function lockDocumentOnBoarding(_x8) {
|
|
34096
|
+
return _ref18.apply(this, arguments);
|
|
34097
|
+
};
|
|
34098
|
+
}();
|
|
34099
|
+
var lockDocumentOnPremise = /*#__PURE__*/function () {
|
|
34100
|
+
var _ref19 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
34101
|
+
return _regenerator().w(function (_context18) {
|
|
34102
|
+
while (1) switch (_context18.n) {
|
|
34103
|
+
case 0:
|
|
34104
|
+
throw new ApacuanaAPIError("Locking documents is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
34105
|
+
case 1:
|
|
34106
|
+
return _context18.a(2);
|
|
34107
|
+
}
|
|
34108
|
+
}, _callee18);
|
|
34109
|
+
}));
|
|
34110
|
+
return function lockDocumentOnPremise() {
|
|
34111
|
+
return _ref19.apply(this, arguments);
|
|
34112
|
+
};
|
|
34113
|
+
}();
|
|
34017
34114
|
|
|
34018
34115
|
// =================================================================
|
|
34019
34116
|
// Exported Functions
|
|
@@ -34027,32 +34124,32 @@ var addMemberOnPremise = /*#__PURE__*/function () {
|
|
|
34027
34124
|
* @throws {ApacuanaAPIError} Arroja un error 'NOT_IMPLEMENTED' para cualquier tipo de integración.
|
|
34028
34125
|
*/
|
|
34029
34126
|
var signDocument = /*#__PURE__*/function () {
|
|
34030
|
-
var
|
|
34127
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(signData) {
|
|
34031
34128
|
var _getConfig3, integrationType;
|
|
34032
|
-
return _regenerator().w(function (
|
|
34033
|
-
while (1) switch (
|
|
34129
|
+
return _regenerator().w(function (_context19) {
|
|
34130
|
+
while (1) switch (_context19.n) {
|
|
34034
34131
|
case 0:
|
|
34035
34132
|
_getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
|
|
34036
34133
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34037
|
-
|
|
34134
|
+
_context19.n = 1;
|
|
34038
34135
|
break;
|
|
34039
34136
|
}
|
|
34040
|
-
return
|
|
34137
|
+
return _context19.a(2, signDocumentOnBoarding(signData));
|
|
34041
34138
|
case 1:
|
|
34042
34139
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34043
|
-
|
|
34140
|
+
_context19.n = 2;
|
|
34044
34141
|
break;
|
|
34045
34142
|
}
|
|
34046
|
-
return
|
|
34143
|
+
return _context19.a(2, signDocumentOnPremise());
|
|
34047
34144
|
case 2:
|
|
34048
34145
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34049
34146
|
case 3:
|
|
34050
|
-
return
|
|
34147
|
+
return _context19.a(2);
|
|
34051
34148
|
}
|
|
34052
|
-
},
|
|
34149
|
+
}, _callee19);
|
|
34053
34150
|
}));
|
|
34054
|
-
return function signDocument(
|
|
34055
|
-
return
|
|
34151
|
+
return function signDocument(_x9) {
|
|
34152
|
+
return _ref20.apply(this, arguments);
|
|
34056
34153
|
};
|
|
34057
34154
|
}();
|
|
34058
34155
|
|
|
@@ -34063,33 +34160,33 @@ var signDocument = /*#__PURE__*/function () {
|
|
|
34063
34160
|
* @throws {ApacuanaAPIError} Si los datos de entrada son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
|
|
34064
34161
|
*/
|
|
34065
34162
|
var getDigest = /*#__PURE__*/function () {
|
|
34066
|
-
var
|
|
34163
|
+
var _ref21 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(signData) {
|
|
34067
34164
|
var _getConfig4, integrationType;
|
|
34068
|
-
return _regenerator().w(function (
|
|
34069
|
-
while (1) switch (
|
|
34165
|
+
return _regenerator().w(function (_context20) {
|
|
34166
|
+
while (1) switch (_context20.n) {
|
|
34070
34167
|
case 0:
|
|
34071
34168
|
helpers.validateGetDigestData(signData);
|
|
34072
34169
|
_getConfig4 = getConfig(), integrationType = _getConfig4.integrationType;
|
|
34073
34170
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34074
|
-
|
|
34171
|
+
_context20.n = 1;
|
|
34075
34172
|
break;
|
|
34076
34173
|
}
|
|
34077
|
-
return
|
|
34174
|
+
return _context20.a(2, getDigestToSignOnBoarding(signData));
|
|
34078
34175
|
case 1:
|
|
34079
34176
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34080
|
-
|
|
34177
|
+
_context20.n = 2;
|
|
34081
34178
|
break;
|
|
34082
34179
|
}
|
|
34083
|
-
return
|
|
34180
|
+
return _context20.a(2, getDigestToSignOnPremise());
|
|
34084
34181
|
case 2:
|
|
34085
34182
|
throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
|
|
34086
34183
|
case 3:
|
|
34087
|
-
return
|
|
34184
|
+
return _context20.a(2);
|
|
34088
34185
|
}
|
|
34089
|
-
},
|
|
34186
|
+
}, _callee20);
|
|
34090
34187
|
}));
|
|
34091
|
-
return function getDigest(
|
|
34092
|
-
return
|
|
34188
|
+
return function getDigest(_x0) {
|
|
34189
|
+
return _ref21.apply(this, arguments);
|
|
34093
34190
|
};
|
|
34094
34191
|
}();
|
|
34095
34192
|
|
|
@@ -34100,38 +34197,38 @@ var getDigest = /*#__PURE__*/function () {
|
|
|
34100
34197
|
* @throws {ApacuanaAPIError} Si los datos del firmante son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
|
|
34101
34198
|
*/
|
|
34102
34199
|
var addSigner = /*#__PURE__*/function () {
|
|
34103
|
-
var
|
|
34200
|
+
var _ref22 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(signerData) {
|
|
34104
34201
|
var _getConfig5, integrationType;
|
|
34105
|
-
return _regenerator().w(function (
|
|
34106
|
-
while (1) switch (
|
|
34202
|
+
return _regenerator().w(function (_context21) {
|
|
34203
|
+
while (1) switch (_context21.n) {
|
|
34107
34204
|
case 0:
|
|
34108
34205
|
if (!(!signerData || _typeof(signerData) !== "object" || Object.keys(signerData).length === 0)) {
|
|
34109
|
-
|
|
34206
|
+
_context21.n = 1;
|
|
34110
34207
|
break;
|
|
34111
34208
|
}
|
|
34112
34209
|
throw new ApacuanaAPIError("Signer data (signerData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
|
|
34113
34210
|
case 1:
|
|
34114
34211
|
_getConfig5 = getConfig(), integrationType = _getConfig5.integrationType;
|
|
34115
34212
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34116
|
-
|
|
34213
|
+
_context21.n = 2;
|
|
34117
34214
|
break;
|
|
34118
34215
|
}
|
|
34119
|
-
return
|
|
34216
|
+
return _context21.a(2, addSignerOnBoarding(signerData));
|
|
34120
34217
|
case 2:
|
|
34121
34218
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34122
|
-
|
|
34219
|
+
_context21.n = 3;
|
|
34123
34220
|
break;
|
|
34124
34221
|
}
|
|
34125
|
-
return
|
|
34222
|
+
return _context21.a(2, addSignerOnPremise());
|
|
34126
34223
|
case 3:
|
|
34127
34224
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34128
34225
|
case 4:
|
|
34129
|
-
return
|
|
34226
|
+
return _context21.a(2);
|
|
34130
34227
|
}
|
|
34131
|
-
},
|
|
34228
|
+
}, _callee21);
|
|
34132
34229
|
}));
|
|
34133
|
-
return function addSigner(
|
|
34134
|
-
return
|
|
34230
|
+
return function addSigner(_x1) {
|
|
34231
|
+
return _ref22.apply(this, arguments);
|
|
34135
34232
|
};
|
|
34136
34233
|
}();
|
|
34137
34234
|
|
|
@@ -34142,33 +34239,33 @@ var addSigner = /*#__PURE__*/function () {
|
|
|
34142
34239
|
* @throws {ApacuanaAPIError} Si los parámetros de paginación son inválidos, 'customerId' no está configurado, la llamada a la API falla, o el tipo de integración no es soportado.
|
|
34143
34240
|
*/
|
|
34144
34241
|
var getDocs = /*#__PURE__*/function () {
|
|
34145
|
-
var
|
|
34242
|
+
var _ref23 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(data) {
|
|
34146
34243
|
var _getConfig6, integrationType;
|
|
34147
|
-
return _regenerator().w(function (
|
|
34148
|
-
while (1) switch (
|
|
34244
|
+
return _regenerator().w(function (_context22) {
|
|
34245
|
+
while (1) switch (_context22.n) {
|
|
34149
34246
|
case 0:
|
|
34150
34247
|
helpers.validateGetDocsData(data);
|
|
34151
34248
|
_getConfig6 = getConfig(), integrationType = _getConfig6.integrationType;
|
|
34152
34249
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34153
|
-
|
|
34250
|
+
_context22.n = 1;
|
|
34154
34251
|
break;
|
|
34155
34252
|
}
|
|
34156
|
-
return
|
|
34253
|
+
return _context22.a(2, getDocsOnBoarding(data));
|
|
34157
34254
|
case 1:
|
|
34158
34255
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34159
|
-
|
|
34256
|
+
_context22.n = 2;
|
|
34160
34257
|
break;
|
|
34161
34258
|
}
|
|
34162
|
-
return
|
|
34259
|
+
return _context22.a(2, getDocsOnPremise());
|
|
34163
34260
|
case 2:
|
|
34164
34261
|
throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
|
|
34165
34262
|
case 3:
|
|
34166
|
-
return
|
|
34263
|
+
return _context22.a(2);
|
|
34167
34264
|
}
|
|
34168
|
-
},
|
|
34265
|
+
}, _callee22);
|
|
34169
34266
|
}));
|
|
34170
|
-
return function getDocs(
|
|
34171
|
-
return
|
|
34267
|
+
return function getDocs(_x10) {
|
|
34268
|
+
return _ref23.apply(this, arguments);
|
|
34172
34269
|
};
|
|
34173
34270
|
}();
|
|
34174
34271
|
|
|
@@ -34180,50 +34277,50 @@ var getDocs = /*#__PURE__*/function () {
|
|
|
34180
34277
|
* @throws {ApacuanaAPIError} Si los datos son inválidos o la llamada a la API falla.
|
|
34181
34278
|
*/
|
|
34182
34279
|
var uploadSignatureVariant = /*#__PURE__*/function () {
|
|
34183
|
-
var
|
|
34280
|
+
var _ref24 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(data) {
|
|
34184
34281
|
var _getConfig7, integrationType;
|
|
34185
|
-
return _regenerator().w(function (
|
|
34186
|
-
while (1) switch (
|
|
34282
|
+
return _regenerator().w(function (_context23) {
|
|
34283
|
+
while (1) switch (_context23.n) {
|
|
34187
34284
|
case 0:
|
|
34188
34285
|
if (!(!data || !data.file)) {
|
|
34189
|
-
|
|
34286
|
+
_context23.n = 1;
|
|
34190
34287
|
break;
|
|
34191
34288
|
}
|
|
34192
34289
|
throw new ApacuanaAPIError("El parámetro 'file' es requerido.", 400, "INVALID_PARAMETER");
|
|
34193
34290
|
case 1:
|
|
34194
34291
|
if (!(typeof File === "undefined" || !(data.file instanceof File))) {
|
|
34195
|
-
|
|
34292
|
+
_context23.n = 2;
|
|
34196
34293
|
break;
|
|
34197
34294
|
}
|
|
34198
34295
|
throw new ApacuanaAPIError("El parámetro 'file' debe ser una instancia de 'File'.", 400, "INVALID_PARAMETER");
|
|
34199
34296
|
case 2:
|
|
34200
34297
|
if (!(data.file.type !== "image/png")) {
|
|
34201
|
-
|
|
34298
|
+
_context23.n = 3;
|
|
34202
34299
|
break;
|
|
34203
34300
|
}
|
|
34204
34301
|
throw new ApacuanaAPIError("El archivo debe ser de tipo PNG (image/png).", 400, "INVALID_PARAMETER");
|
|
34205
34302
|
case 3:
|
|
34206
34303
|
_getConfig7 = getConfig(), integrationType = _getConfig7.integrationType;
|
|
34207
34304
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34208
|
-
|
|
34305
|
+
_context23.n = 4;
|
|
34209
34306
|
break;
|
|
34210
34307
|
}
|
|
34211
|
-
return
|
|
34308
|
+
return _context23.a(2, uploadSignatureVariantOnBoarding(data));
|
|
34212
34309
|
case 4:
|
|
34213
34310
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34214
|
-
|
|
34311
|
+
_context23.n = 5;
|
|
34215
34312
|
break;
|
|
34216
34313
|
}
|
|
34217
|
-
return
|
|
34314
|
+
return _context23.a(2, uploadSignatureVariantOnPremise());
|
|
34218
34315
|
case 5:
|
|
34219
34316
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34220
34317
|
case 6:
|
|
34221
|
-
return
|
|
34318
|
+
return _context23.a(2);
|
|
34222
34319
|
}
|
|
34223
|
-
},
|
|
34320
|
+
}, _callee23);
|
|
34224
34321
|
}));
|
|
34225
|
-
return function uploadSignatureVariant(
|
|
34226
|
-
return
|
|
34322
|
+
return function uploadSignatureVariant(_x11) {
|
|
34323
|
+
return _ref24.apply(this, arguments);
|
|
34227
34324
|
};
|
|
34228
34325
|
}();
|
|
34229
34326
|
|
|
@@ -34233,32 +34330,32 @@ var uploadSignatureVariant = /*#__PURE__*/function () {
|
|
|
34233
34330
|
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
34234
34331
|
*/
|
|
34235
34332
|
var getSignatureVariant = /*#__PURE__*/function () {
|
|
34236
|
-
var
|
|
34333
|
+
var _ref25 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24() {
|
|
34237
34334
|
var _getConfig8, integrationType;
|
|
34238
|
-
return _regenerator().w(function (
|
|
34239
|
-
while (1) switch (
|
|
34335
|
+
return _regenerator().w(function (_context24) {
|
|
34336
|
+
while (1) switch (_context24.n) {
|
|
34240
34337
|
case 0:
|
|
34241
34338
|
_getConfig8 = getConfig(), integrationType = _getConfig8.integrationType;
|
|
34242
34339
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34243
|
-
|
|
34340
|
+
_context24.n = 1;
|
|
34244
34341
|
break;
|
|
34245
34342
|
}
|
|
34246
|
-
return
|
|
34343
|
+
return _context24.a(2, getSignatureVariantOnBoarding());
|
|
34247
34344
|
case 1:
|
|
34248
34345
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34249
|
-
|
|
34346
|
+
_context24.n = 2;
|
|
34250
34347
|
break;
|
|
34251
34348
|
}
|
|
34252
|
-
return
|
|
34349
|
+
return _context24.a(2, getSignatureVariantOnPremise());
|
|
34253
34350
|
case 2:
|
|
34254
34351
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34255
34352
|
case 3:
|
|
34256
|
-
return
|
|
34353
|
+
return _context24.a(2);
|
|
34257
34354
|
}
|
|
34258
|
-
},
|
|
34355
|
+
}, _callee24);
|
|
34259
34356
|
}));
|
|
34260
34357
|
return function getSignatureVariant() {
|
|
34261
|
-
return
|
|
34358
|
+
return _ref25.apply(this, arguments);
|
|
34262
34359
|
};
|
|
34263
34360
|
}();
|
|
34264
34361
|
|
|
@@ -34268,32 +34365,32 @@ var getSignatureVariant = /*#__PURE__*/function () {
|
|
|
34268
34365
|
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
34269
34366
|
*/
|
|
34270
34367
|
var deleteSignatureVariant = /*#__PURE__*/function () {
|
|
34271
|
-
var
|
|
34368
|
+
var _ref26 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
|
|
34272
34369
|
var _getConfig9, integrationType;
|
|
34273
|
-
return _regenerator().w(function (
|
|
34274
|
-
while (1) switch (
|
|
34370
|
+
return _regenerator().w(function (_context25) {
|
|
34371
|
+
while (1) switch (_context25.n) {
|
|
34275
34372
|
case 0:
|
|
34276
34373
|
_getConfig9 = getConfig(), integrationType = _getConfig9.integrationType;
|
|
34277
34374
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34278
|
-
|
|
34375
|
+
_context25.n = 1;
|
|
34279
34376
|
break;
|
|
34280
34377
|
}
|
|
34281
|
-
return
|
|
34378
|
+
return _context25.a(2, deleteSignatureVariantOnBoarding());
|
|
34282
34379
|
case 1:
|
|
34283
34380
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34284
|
-
|
|
34381
|
+
_context25.n = 2;
|
|
34285
34382
|
break;
|
|
34286
34383
|
}
|
|
34287
|
-
return
|
|
34384
|
+
return _context25.a(2, deleteSignatureVariantOnPremise());
|
|
34288
34385
|
case 2:
|
|
34289
34386
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34290
34387
|
case 3:
|
|
34291
|
-
return
|
|
34388
|
+
return _context25.a(2);
|
|
34292
34389
|
}
|
|
34293
|
-
},
|
|
34390
|
+
}, _callee25);
|
|
34294
34391
|
}));
|
|
34295
34392
|
return function deleteSignatureVariant() {
|
|
34296
|
-
return
|
|
34393
|
+
return _ref26.apply(this, arguments);
|
|
34297
34394
|
};
|
|
34298
34395
|
}();
|
|
34299
34396
|
|
|
@@ -34304,32 +34401,124 @@ var deleteSignatureVariant = /*#__PURE__*/function () {
|
|
|
34304
34401
|
* @throws {ApacuanaAPIError} Si los datos del signatario son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
|
|
34305
34402
|
*/
|
|
34306
34403
|
var addMember = /*#__PURE__*/function () {
|
|
34307
|
-
var
|
|
34404
|
+
var _ref27 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(memberData) {
|
|
34308
34405
|
var _getConfig0, integrationType;
|
|
34309
|
-
return _regenerator().w(function (
|
|
34310
|
-
while (1) switch (
|
|
34406
|
+
return _regenerator().w(function (_context26) {
|
|
34407
|
+
while (1) switch (_context26.n) {
|
|
34311
34408
|
case 0:
|
|
34312
34409
|
_getConfig0 = getConfig(), integrationType = _getConfig0.integrationType;
|
|
34313
34410
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34314
|
-
|
|
34411
|
+
_context26.n = 1;
|
|
34315
34412
|
break;
|
|
34316
34413
|
}
|
|
34317
|
-
return
|
|
34414
|
+
return _context26.a(2, addMemberOnBoarding(memberData));
|
|
34318
34415
|
case 1:
|
|
34319
34416
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34320
|
-
|
|
34417
|
+
_context26.n = 2;
|
|
34321
34418
|
break;
|
|
34322
34419
|
}
|
|
34323
|
-
return
|
|
34420
|
+
return _context26.a(2, addMemberOnPremise());
|
|
34324
34421
|
case 2:
|
|
34325
34422
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34326
34423
|
case 3:
|
|
34327
|
-
return
|
|
34424
|
+
return _context26.a(2);
|
|
34328
34425
|
}
|
|
34329
|
-
},
|
|
34426
|
+
}, _callee26);
|
|
34330
34427
|
}));
|
|
34331
|
-
return function addMember(
|
|
34332
|
-
return
|
|
34428
|
+
return function addMember(_x12) {
|
|
34429
|
+
return _ref27.apply(this, arguments);
|
|
34430
|
+
};
|
|
34431
|
+
}();
|
|
34432
|
+
|
|
34433
|
+
/**
|
|
34434
|
+
* Crea un nuevo documento para ser firmado.
|
|
34435
|
+
* @param {object} documentData - Datos del documento a crear.
|
|
34436
|
+
* @param {string} documentData.name - Nombre del documento.
|
|
34437
|
+
* @param {string} documentData.reference - Referencia del documento.
|
|
34438
|
+
* @returns {Promise<object>} Una promesa que resuelve a un objeto con `{ msg, id }` del documento creado.
|
|
34439
|
+
* @throws {ApacuanaAPIError} Si los datos son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
|
|
34440
|
+
*/
|
|
34441
|
+
var createDocument = /*#__PURE__*/function () {
|
|
34442
|
+
var _ref28 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(documentData) {
|
|
34443
|
+
var _getConfig1, integrationType;
|
|
34444
|
+
return _regenerator().w(function (_context27) {
|
|
34445
|
+
while (1) switch (_context27.n) {
|
|
34446
|
+
case 0:
|
|
34447
|
+
if (!(!documentData || _typeof(documentData) !== "object" || Object.keys(documentData).length === 0)) {
|
|
34448
|
+
_context27.n = 1;
|
|
34449
|
+
break;
|
|
34450
|
+
}
|
|
34451
|
+
throw new ApacuanaAPIError("Document data (documentData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
|
|
34452
|
+
case 1:
|
|
34453
|
+
if (!(!documentData.name || !documentData.reference)) {
|
|
34454
|
+
_context27.n = 2;
|
|
34455
|
+
break;
|
|
34456
|
+
}
|
|
34457
|
+
throw new ApacuanaAPIError("Fields 'name' and 'reference' are required.", 400, "INVALID_PARAMETER");
|
|
34458
|
+
case 2:
|
|
34459
|
+
_getConfig1 = getConfig(), integrationType = _getConfig1.integrationType;
|
|
34460
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34461
|
+
_context27.n = 3;
|
|
34462
|
+
break;
|
|
34463
|
+
}
|
|
34464
|
+
return _context27.a(2, createDocumentOnBoarding(documentData));
|
|
34465
|
+
case 3:
|
|
34466
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34467
|
+
_context27.n = 4;
|
|
34468
|
+
break;
|
|
34469
|
+
}
|
|
34470
|
+
return _context27.a(2, createDocumentOnPremise());
|
|
34471
|
+
case 4:
|
|
34472
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34473
|
+
case 5:
|
|
34474
|
+
return _context27.a(2);
|
|
34475
|
+
}
|
|
34476
|
+
}, _callee27);
|
|
34477
|
+
}));
|
|
34478
|
+
return function createDocument(_x13) {
|
|
34479
|
+
return _ref28.apply(this, arguments);
|
|
34480
|
+
};
|
|
34481
|
+
}();
|
|
34482
|
+
|
|
34483
|
+
/**
|
|
34484
|
+
* Bloquea un documento para evitar modificaciones.
|
|
34485
|
+
* @param {string} documentId - ID (UUID) del documento a bloquear.
|
|
34486
|
+
* @returns {Promise<object>} Una promesa que resuelve al response de la API.
|
|
34487
|
+
* @throws {ApacuanaAPIError} Si el documentId es inválido, la llamada a la API falla, o el tipo de integración no es soportado.
|
|
34488
|
+
*/
|
|
34489
|
+
var lockDocument = /*#__PURE__*/function () {
|
|
34490
|
+
var _ref29 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(documentId) {
|
|
34491
|
+
var _getConfig10, integrationType;
|
|
34492
|
+
return _regenerator().w(function (_context28) {
|
|
34493
|
+
while (1) switch (_context28.n) {
|
|
34494
|
+
case 0:
|
|
34495
|
+
if (!(!documentId || typeof documentId !== "string")) {
|
|
34496
|
+
_context28.n = 1;
|
|
34497
|
+
break;
|
|
34498
|
+
}
|
|
34499
|
+
throw new ApacuanaAPIError("Field 'documentId' is required and must be a string.", 400, "INVALID_PARAMETER");
|
|
34500
|
+
case 1:
|
|
34501
|
+
_getConfig10 = getConfig(), integrationType = _getConfig10.integrationType;
|
|
34502
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34503
|
+
_context28.n = 2;
|
|
34504
|
+
break;
|
|
34505
|
+
}
|
|
34506
|
+
return _context28.a(2, lockDocumentOnBoarding(documentId));
|
|
34507
|
+
case 2:
|
|
34508
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34509
|
+
_context28.n = 3;
|
|
34510
|
+
break;
|
|
34511
|
+
}
|
|
34512
|
+
return _context28.a(2, lockDocumentOnPremise());
|
|
34513
|
+
case 3:
|
|
34514
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34515
|
+
case 4:
|
|
34516
|
+
return _context28.a(2);
|
|
34517
|
+
}
|
|
34518
|
+
}, _callee28);
|
|
34519
|
+
}));
|
|
34520
|
+
return function lockDocument(_x14) {
|
|
34521
|
+
return _ref29.apply(this, arguments);
|
|
34333
34522
|
};
|
|
34334
34523
|
}();
|
|
34335
34524
|
|
|
@@ -34575,6 +34764,14 @@ var apacuana = {
|
|
|
34575
34764
|
checkSdk(true);
|
|
34576
34765
|
return sendFaceLiveness(data);
|
|
34577
34766
|
},
|
|
34767
|
+
createDocument: function createDocument$1(data) {
|
|
34768
|
+
checkSdk(false);
|
|
34769
|
+
return createDocument(data);
|
|
34770
|
+
},
|
|
34771
|
+
lockDocument: function lockDocument$1(documentId) {
|
|
34772
|
+
checkSdk(false);
|
|
34773
|
+
return lockDocument(documentId);
|
|
34774
|
+
},
|
|
34578
34775
|
close: function close$1() {
|
|
34579
34776
|
return close();
|
|
34580
34777
|
},
|