apacuana-sdk-core 1.26.1 → 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 +181 -136
- 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 +417 -9
- 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 +325 -235
- package/dist/api/signatures.d.ts +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +288 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +288 -90
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/signatures.js +136 -0
- 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
|
@@ -34013,6 +34013,104 @@ var addMemberOnPremise = /*#__PURE__*/function () {
|
|
|
34013
34013
|
return _ref15.apply(this, arguments);
|
|
34014
34014
|
};
|
|
34015
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
|
+
}();
|
|
34016
34114
|
|
|
34017
34115
|
// =================================================================
|
|
34018
34116
|
// Exported Functions
|
|
@@ -34026,32 +34124,32 @@ var addMemberOnPremise = /*#__PURE__*/function () {
|
|
|
34026
34124
|
* @throws {ApacuanaAPIError} Arroja un error 'NOT_IMPLEMENTED' para cualquier tipo de integración.
|
|
34027
34125
|
*/
|
|
34028
34126
|
var signDocument = /*#__PURE__*/function () {
|
|
34029
|
-
var
|
|
34127
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(signData) {
|
|
34030
34128
|
var _getConfig3, integrationType;
|
|
34031
|
-
return _regenerator().w(function (
|
|
34032
|
-
while (1) switch (
|
|
34129
|
+
return _regenerator().w(function (_context19) {
|
|
34130
|
+
while (1) switch (_context19.n) {
|
|
34033
34131
|
case 0:
|
|
34034
34132
|
_getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
|
|
34035
34133
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34036
|
-
|
|
34134
|
+
_context19.n = 1;
|
|
34037
34135
|
break;
|
|
34038
34136
|
}
|
|
34039
|
-
return
|
|
34137
|
+
return _context19.a(2, signDocumentOnBoarding(signData));
|
|
34040
34138
|
case 1:
|
|
34041
34139
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34042
|
-
|
|
34140
|
+
_context19.n = 2;
|
|
34043
34141
|
break;
|
|
34044
34142
|
}
|
|
34045
|
-
return
|
|
34143
|
+
return _context19.a(2, signDocumentOnPremise());
|
|
34046
34144
|
case 2:
|
|
34047
34145
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34048
34146
|
case 3:
|
|
34049
|
-
return
|
|
34147
|
+
return _context19.a(2);
|
|
34050
34148
|
}
|
|
34051
|
-
},
|
|
34149
|
+
}, _callee19);
|
|
34052
34150
|
}));
|
|
34053
|
-
return function signDocument(
|
|
34054
|
-
return
|
|
34151
|
+
return function signDocument(_x9) {
|
|
34152
|
+
return _ref20.apply(this, arguments);
|
|
34055
34153
|
};
|
|
34056
34154
|
}();
|
|
34057
34155
|
|
|
@@ -34062,33 +34160,33 @@ var signDocument = /*#__PURE__*/function () {
|
|
|
34062
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.
|
|
34063
34161
|
*/
|
|
34064
34162
|
var getDigest = /*#__PURE__*/function () {
|
|
34065
|
-
var
|
|
34163
|
+
var _ref21 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(signData) {
|
|
34066
34164
|
var _getConfig4, integrationType;
|
|
34067
|
-
return _regenerator().w(function (
|
|
34068
|
-
while (1) switch (
|
|
34165
|
+
return _regenerator().w(function (_context20) {
|
|
34166
|
+
while (1) switch (_context20.n) {
|
|
34069
34167
|
case 0:
|
|
34070
34168
|
helpers.validateGetDigestData(signData);
|
|
34071
34169
|
_getConfig4 = getConfig(), integrationType = _getConfig4.integrationType;
|
|
34072
34170
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34073
|
-
|
|
34171
|
+
_context20.n = 1;
|
|
34074
34172
|
break;
|
|
34075
34173
|
}
|
|
34076
|
-
return
|
|
34174
|
+
return _context20.a(2, getDigestToSignOnBoarding(signData));
|
|
34077
34175
|
case 1:
|
|
34078
34176
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34079
|
-
|
|
34177
|
+
_context20.n = 2;
|
|
34080
34178
|
break;
|
|
34081
34179
|
}
|
|
34082
|
-
return
|
|
34180
|
+
return _context20.a(2, getDigestToSignOnPremise());
|
|
34083
34181
|
case 2:
|
|
34084
34182
|
throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
|
|
34085
34183
|
case 3:
|
|
34086
|
-
return
|
|
34184
|
+
return _context20.a(2);
|
|
34087
34185
|
}
|
|
34088
|
-
},
|
|
34186
|
+
}, _callee20);
|
|
34089
34187
|
}));
|
|
34090
|
-
return function getDigest(
|
|
34091
|
-
return
|
|
34188
|
+
return function getDigest(_x0) {
|
|
34189
|
+
return _ref21.apply(this, arguments);
|
|
34092
34190
|
};
|
|
34093
34191
|
}();
|
|
34094
34192
|
|
|
@@ -34099,38 +34197,38 @@ var getDigest = /*#__PURE__*/function () {
|
|
|
34099
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.
|
|
34100
34198
|
*/
|
|
34101
34199
|
var addSigner = /*#__PURE__*/function () {
|
|
34102
|
-
var
|
|
34200
|
+
var _ref22 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(signerData) {
|
|
34103
34201
|
var _getConfig5, integrationType;
|
|
34104
|
-
return _regenerator().w(function (
|
|
34105
|
-
while (1) switch (
|
|
34202
|
+
return _regenerator().w(function (_context21) {
|
|
34203
|
+
while (1) switch (_context21.n) {
|
|
34106
34204
|
case 0:
|
|
34107
34205
|
if (!(!signerData || _typeof(signerData) !== "object" || Object.keys(signerData).length === 0)) {
|
|
34108
|
-
|
|
34206
|
+
_context21.n = 1;
|
|
34109
34207
|
break;
|
|
34110
34208
|
}
|
|
34111
34209
|
throw new ApacuanaAPIError("Signer data (signerData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
|
|
34112
34210
|
case 1:
|
|
34113
34211
|
_getConfig5 = getConfig(), integrationType = _getConfig5.integrationType;
|
|
34114
34212
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34115
|
-
|
|
34213
|
+
_context21.n = 2;
|
|
34116
34214
|
break;
|
|
34117
34215
|
}
|
|
34118
|
-
return
|
|
34216
|
+
return _context21.a(2, addSignerOnBoarding(signerData));
|
|
34119
34217
|
case 2:
|
|
34120
34218
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34121
|
-
|
|
34219
|
+
_context21.n = 3;
|
|
34122
34220
|
break;
|
|
34123
34221
|
}
|
|
34124
|
-
return
|
|
34222
|
+
return _context21.a(2, addSignerOnPremise());
|
|
34125
34223
|
case 3:
|
|
34126
34224
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34127
34225
|
case 4:
|
|
34128
|
-
return
|
|
34226
|
+
return _context21.a(2);
|
|
34129
34227
|
}
|
|
34130
|
-
},
|
|
34228
|
+
}, _callee21);
|
|
34131
34229
|
}));
|
|
34132
|
-
return function addSigner(
|
|
34133
|
-
return
|
|
34230
|
+
return function addSigner(_x1) {
|
|
34231
|
+
return _ref22.apply(this, arguments);
|
|
34134
34232
|
};
|
|
34135
34233
|
}();
|
|
34136
34234
|
|
|
@@ -34141,33 +34239,33 @@ var addSigner = /*#__PURE__*/function () {
|
|
|
34141
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.
|
|
34142
34240
|
*/
|
|
34143
34241
|
var getDocs = /*#__PURE__*/function () {
|
|
34144
|
-
var
|
|
34242
|
+
var _ref23 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(data) {
|
|
34145
34243
|
var _getConfig6, integrationType;
|
|
34146
|
-
return _regenerator().w(function (
|
|
34147
|
-
while (1) switch (
|
|
34244
|
+
return _regenerator().w(function (_context22) {
|
|
34245
|
+
while (1) switch (_context22.n) {
|
|
34148
34246
|
case 0:
|
|
34149
34247
|
helpers.validateGetDocsData(data);
|
|
34150
34248
|
_getConfig6 = getConfig(), integrationType = _getConfig6.integrationType;
|
|
34151
34249
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34152
|
-
|
|
34250
|
+
_context22.n = 1;
|
|
34153
34251
|
break;
|
|
34154
34252
|
}
|
|
34155
|
-
return
|
|
34253
|
+
return _context22.a(2, getDocsOnBoarding(data));
|
|
34156
34254
|
case 1:
|
|
34157
34255
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34158
|
-
|
|
34256
|
+
_context22.n = 2;
|
|
34159
34257
|
break;
|
|
34160
34258
|
}
|
|
34161
|
-
return
|
|
34259
|
+
return _context22.a(2, getDocsOnPremise());
|
|
34162
34260
|
case 2:
|
|
34163
34261
|
throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
|
|
34164
34262
|
case 3:
|
|
34165
|
-
return
|
|
34263
|
+
return _context22.a(2);
|
|
34166
34264
|
}
|
|
34167
|
-
},
|
|
34265
|
+
}, _callee22);
|
|
34168
34266
|
}));
|
|
34169
|
-
return function getDocs(
|
|
34170
|
-
return
|
|
34267
|
+
return function getDocs(_x10) {
|
|
34268
|
+
return _ref23.apply(this, arguments);
|
|
34171
34269
|
};
|
|
34172
34270
|
}();
|
|
34173
34271
|
|
|
@@ -34179,50 +34277,50 @@ var getDocs = /*#__PURE__*/function () {
|
|
|
34179
34277
|
* @throws {ApacuanaAPIError} Si los datos son inválidos o la llamada a la API falla.
|
|
34180
34278
|
*/
|
|
34181
34279
|
var uploadSignatureVariant = /*#__PURE__*/function () {
|
|
34182
|
-
var
|
|
34280
|
+
var _ref24 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(data) {
|
|
34183
34281
|
var _getConfig7, integrationType;
|
|
34184
|
-
return _regenerator().w(function (
|
|
34185
|
-
while (1) switch (
|
|
34282
|
+
return _regenerator().w(function (_context23) {
|
|
34283
|
+
while (1) switch (_context23.n) {
|
|
34186
34284
|
case 0:
|
|
34187
34285
|
if (!(!data || !data.file)) {
|
|
34188
|
-
|
|
34286
|
+
_context23.n = 1;
|
|
34189
34287
|
break;
|
|
34190
34288
|
}
|
|
34191
34289
|
throw new ApacuanaAPIError("El parámetro 'file' es requerido.", 400, "INVALID_PARAMETER");
|
|
34192
34290
|
case 1:
|
|
34193
34291
|
if (!(typeof File === "undefined" || !(data.file instanceof File))) {
|
|
34194
|
-
|
|
34292
|
+
_context23.n = 2;
|
|
34195
34293
|
break;
|
|
34196
34294
|
}
|
|
34197
34295
|
throw new ApacuanaAPIError("El parámetro 'file' debe ser una instancia de 'File'.", 400, "INVALID_PARAMETER");
|
|
34198
34296
|
case 2:
|
|
34199
34297
|
if (!(data.file.type !== "image/png")) {
|
|
34200
|
-
|
|
34298
|
+
_context23.n = 3;
|
|
34201
34299
|
break;
|
|
34202
34300
|
}
|
|
34203
34301
|
throw new ApacuanaAPIError("El archivo debe ser de tipo PNG (image/png).", 400, "INVALID_PARAMETER");
|
|
34204
34302
|
case 3:
|
|
34205
34303
|
_getConfig7 = getConfig(), integrationType = _getConfig7.integrationType;
|
|
34206
34304
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34207
|
-
|
|
34305
|
+
_context23.n = 4;
|
|
34208
34306
|
break;
|
|
34209
34307
|
}
|
|
34210
|
-
return
|
|
34308
|
+
return _context23.a(2, uploadSignatureVariantOnBoarding(data));
|
|
34211
34309
|
case 4:
|
|
34212
34310
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34213
|
-
|
|
34311
|
+
_context23.n = 5;
|
|
34214
34312
|
break;
|
|
34215
34313
|
}
|
|
34216
|
-
return
|
|
34314
|
+
return _context23.a(2, uploadSignatureVariantOnPremise());
|
|
34217
34315
|
case 5:
|
|
34218
34316
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34219
34317
|
case 6:
|
|
34220
|
-
return
|
|
34318
|
+
return _context23.a(2);
|
|
34221
34319
|
}
|
|
34222
|
-
},
|
|
34320
|
+
}, _callee23);
|
|
34223
34321
|
}));
|
|
34224
|
-
return function uploadSignatureVariant(
|
|
34225
|
-
return
|
|
34322
|
+
return function uploadSignatureVariant(_x11) {
|
|
34323
|
+
return _ref24.apply(this, arguments);
|
|
34226
34324
|
};
|
|
34227
34325
|
}();
|
|
34228
34326
|
|
|
@@ -34232,32 +34330,32 @@ var uploadSignatureVariant = /*#__PURE__*/function () {
|
|
|
34232
34330
|
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
34233
34331
|
*/
|
|
34234
34332
|
var getSignatureVariant = /*#__PURE__*/function () {
|
|
34235
|
-
var
|
|
34333
|
+
var _ref25 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24() {
|
|
34236
34334
|
var _getConfig8, integrationType;
|
|
34237
|
-
return _regenerator().w(function (
|
|
34238
|
-
while (1) switch (
|
|
34335
|
+
return _regenerator().w(function (_context24) {
|
|
34336
|
+
while (1) switch (_context24.n) {
|
|
34239
34337
|
case 0:
|
|
34240
34338
|
_getConfig8 = getConfig(), integrationType = _getConfig8.integrationType;
|
|
34241
34339
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34242
|
-
|
|
34340
|
+
_context24.n = 1;
|
|
34243
34341
|
break;
|
|
34244
34342
|
}
|
|
34245
|
-
return
|
|
34343
|
+
return _context24.a(2, getSignatureVariantOnBoarding());
|
|
34246
34344
|
case 1:
|
|
34247
34345
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34248
|
-
|
|
34346
|
+
_context24.n = 2;
|
|
34249
34347
|
break;
|
|
34250
34348
|
}
|
|
34251
|
-
return
|
|
34349
|
+
return _context24.a(2, getSignatureVariantOnPremise());
|
|
34252
34350
|
case 2:
|
|
34253
34351
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34254
34352
|
case 3:
|
|
34255
|
-
return
|
|
34353
|
+
return _context24.a(2);
|
|
34256
34354
|
}
|
|
34257
|
-
},
|
|
34355
|
+
}, _callee24);
|
|
34258
34356
|
}));
|
|
34259
34357
|
return function getSignatureVariant() {
|
|
34260
|
-
return
|
|
34358
|
+
return _ref25.apply(this, arguments);
|
|
34261
34359
|
};
|
|
34262
34360
|
}();
|
|
34263
34361
|
|
|
@@ -34267,32 +34365,32 @@ var getSignatureVariant = /*#__PURE__*/function () {
|
|
|
34267
34365
|
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
34268
34366
|
*/
|
|
34269
34367
|
var deleteSignatureVariant = /*#__PURE__*/function () {
|
|
34270
|
-
var
|
|
34368
|
+
var _ref26 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
|
|
34271
34369
|
var _getConfig9, integrationType;
|
|
34272
|
-
return _regenerator().w(function (
|
|
34273
|
-
while (1) switch (
|
|
34370
|
+
return _regenerator().w(function (_context25) {
|
|
34371
|
+
while (1) switch (_context25.n) {
|
|
34274
34372
|
case 0:
|
|
34275
34373
|
_getConfig9 = getConfig(), integrationType = _getConfig9.integrationType;
|
|
34276
34374
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34277
|
-
|
|
34375
|
+
_context25.n = 1;
|
|
34278
34376
|
break;
|
|
34279
34377
|
}
|
|
34280
|
-
return
|
|
34378
|
+
return _context25.a(2, deleteSignatureVariantOnBoarding());
|
|
34281
34379
|
case 1:
|
|
34282
34380
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34283
|
-
|
|
34381
|
+
_context25.n = 2;
|
|
34284
34382
|
break;
|
|
34285
34383
|
}
|
|
34286
|
-
return
|
|
34384
|
+
return _context25.a(2, deleteSignatureVariantOnPremise());
|
|
34287
34385
|
case 2:
|
|
34288
34386
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34289
34387
|
case 3:
|
|
34290
|
-
return
|
|
34388
|
+
return _context25.a(2);
|
|
34291
34389
|
}
|
|
34292
|
-
},
|
|
34390
|
+
}, _callee25);
|
|
34293
34391
|
}));
|
|
34294
34392
|
return function deleteSignatureVariant() {
|
|
34295
|
-
return
|
|
34393
|
+
return _ref26.apply(this, arguments);
|
|
34296
34394
|
};
|
|
34297
34395
|
}();
|
|
34298
34396
|
|
|
@@ -34303,32 +34401,124 @@ var deleteSignatureVariant = /*#__PURE__*/function () {
|
|
|
34303
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.
|
|
34304
34402
|
*/
|
|
34305
34403
|
var addMember = /*#__PURE__*/function () {
|
|
34306
|
-
var
|
|
34404
|
+
var _ref27 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(memberData) {
|
|
34307
34405
|
var _getConfig0, integrationType;
|
|
34308
|
-
return _regenerator().w(function (
|
|
34309
|
-
while (1) switch (
|
|
34406
|
+
return _regenerator().w(function (_context26) {
|
|
34407
|
+
while (1) switch (_context26.n) {
|
|
34310
34408
|
case 0:
|
|
34311
34409
|
_getConfig0 = getConfig(), integrationType = _getConfig0.integrationType;
|
|
34312
34410
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
34313
|
-
|
|
34411
|
+
_context26.n = 1;
|
|
34314
34412
|
break;
|
|
34315
34413
|
}
|
|
34316
|
-
return
|
|
34414
|
+
return _context26.a(2, addMemberOnBoarding(memberData));
|
|
34317
34415
|
case 1:
|
|
34318
34416
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
34319
|
-
|
|
34417
|
+
_context26.n = 2;
|
|
34320
34418
|
break;
|
|
34321
34419
|
}
|
|
34322
|
-
return
|
|
34420
|
+
return _context26.a(2, addMemberOnPremise());
|
|
34323
34421
|
case 2:
|
|
34324
34422
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
34325
34423
|
case 3:
|
|
34326
|
-
return
|
|
34424
|
+
return _context26.a(2);
|
|
34327
34425
|
}
|
|
34328
|
-
},
|
|
34426
|
+
}, _callee26);
|
|
34329
34427
|
}));
|
|
34330
|
-
return function addMember(
|
|
34331
|
-
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);
|
|
34332
34522
|
};
|
|
34333
34523
|
}();
|
|
34334
34524
|
|
|
@@ -34574,6 +34764,14 @@ var apacuana = {
|
|
|
34574
34764
|
checkSdk(true);
|
|
34575
34765
|
return sendFaceLiveness(data);
|
|
34576
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
|
+
},
|
|
34577
34775
|
close: function close$1() {
|
|
34578
34776
|
return close();
|
|
34579
34777
|
},
|