apacuana-sdk-core 0.7.0 → 0.9.0
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/README.md +93 -8
- package/coverage/clover.xml +198 -131
- package/coverage/coverage-final.json +7 -7
- package/coverage/lcov-report/index.html +35 -35
- package/coverage/lcov-report/src/api/certs.js.html +1 -1
- package/coverage/lcov-report/src/api/index.html +32 -32
- package/coverage/lcov-report/src/api/revocations.js.html +79 -43
- package/coverage/lcov-report/src/api/signatures.js.html +595 -73
- package/coverage/lcov-report/src/api/users.js.html +1 -1
- package/coverage/lcov-report/src/config/index.html +11 -11
- package/coverage/lcov-report/src/config/index.js.html +12 -15
- 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 +1 -1
- package/coverage/lcov-report/src/index.js.html +38 -5
- package/coverage/lcov-report/src/utils/constant.js.html +4 -4
- package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
- package/coverage/lcov-report/src/utils/httpClient.js.html +65 -35
- package/coverage/lcov-report/src/utils/index.html +15 -15
- package/coverage/lcov.info +353 -222
- package/dist/api/signatures.d.ts +5 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +377 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +377 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/revocations.js +14 -2
- package/src/api/signatures.js +174 -0
- package/src/config/index.js +1 -2
- package/src/index.js +14 -3
- package/src/utils/httpClient.js +29 -19
- package/tests/api/revocations.test.js +118 -5
- package/tests/api/signatures.test.js +306 -0
package/dist/index.mjs
CHANGED
|
@@ -332,9 +332,8 @@ var setConfig = function setConfig(newConfig) {
|
|
|
332
332
|
var getConfig = function getConfig() {
|
|
333
333
|
return _objectSpread2({}, config);
|
|
334
334
|
};
|
|
335
|
-
var
|
|
335
|
+
var close = function close() {
|
|
336
336
|
config = _objectSpread2({}, defaultConfig);
|
|
337
|
-
console.log("Apacuana SDK: Configuración limpiada.");
|
|
338
337
|
};
|
|
339
338
|
|
|
340
339
|
// src/errors/index.js
|
|
@@ -378,7 +377,6 @@ var initHttpClient = function initHttpClient() {
|
|
|
378
377
|
axiosInstance = axios.create({
|
|
379
378
|
baseURL: config.apiUrl,
|
|
380
379
|
headers: {
|
|
381
|
-
"Content-Type": "application/json",
|
|
382
380
|
"APACUANA-API-Key": config.apiKey,
|
|
383
381
|
"APACUANA-SECRET-Key": config.secretKey
|
|
384
382
|
// La cabecera Authorization se deja vacía al inicio.
|
|
@@ -391,7 +389,9 @@ var initHttpClient = function initHttpClient() {
|
|
|
391
389
|
axiosInstance.interceptors.response.use(function (response) {
|
|
392
390
|
// Maneja errores lógicos de la API (si el backend devuelve status 2xx con { success: false })
|
|
393
391
|
if (response.data && response.data.success === false) {
|
|
394
|
-
|
|
392
|
+
var _response$data, _response$data2;
|
|
393
|
+
var errorMessage = ((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.msg) || ((_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.message) || "Error lógico desconocido desde la API.";
|
|
394
|
+
throw new ApacuanaAPIError(errorMessage, response.status, response.data.code || "LOGICAL_API_ERROR");
|
|
395
395
|
}
|
|
396
396
|
return response;
|
|
397
397
|
}, function (error) {
|
|
@@ -402,7 +402,8 @@ var initHttpClient = function initHttpClient() {
|
|
|
402
402
|
var _error$response = error.response,
|
|
403
403
|
status = _error$response.status,
|
|
404
404
|
data = _error$response.data;
|
|
405
|
-
|
|
405
|
+
var errorMessage = (data === null || data === void 0 ? void 0 : data.msg) || (data === null || data === void 0 ? void 0 : data.message) || "Error desconocido desde la API.";
|
|
406
|
+
throw new ApacuanaAPIError(errorMessage, status, (data === null || data === void 0 ? void 0 : data.code) || "API_ERROR");
|
|
406
407
|
}
|
|
407
408
|
if (error.request) {
|
|
408
409
|
// La petición fue hecha, pero no se recibió respuesta (red caída, CORS, timeout)
|
|
@@ -446,6 +447,9 @@ var httpRequest = /*#__PURE__*/function () {
|
|
|
446
447
|
var data,
|
|
447
448
|
method,
|
|
448
449
|
dataToSend,
|
|
450
|
+
requestConfig,
|
|
451
|
+
hasFile,
|
|
452
|
+
formData,
|
|
449
453
|
response,
|
|
450
454
|
_args = arguments,
|
|
451
455
|
_t,
|
|
@@ -461,9 +465,19 @@ var httpRequest = /*#__PURE__*/function () {
|
|
|
461
465
|
}
|
|
462
466
|
throw new Error("Apacuana SDK: Cliente HTTP no inicializado. " + "Llama a apacuana.init() primero.");
|
|
463
467
|
case 1:
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
468
|
+
requestConfig = {};
|
|
469
|
+
hasFile = Object.values(data).some(function (value) {
|
|
470
|
+
return typeof File !== "undefined" && value instanceof File;
|
|
471
|
+
});
|
|
472
|
+
if (hasFile) {
|
|
473
|
+
formData = new FormData();
|
|
474
|
+
Object.keys(data).forEach(function (key) {
|
|
475
|
+
formData.append(key, data[key]);
|
|
476
|
+
});
|
|
477
|
+
dataToSend = formData;
|
|
478
|
+
} else {
|
|
479
|
+
dataToSend = _objectSpread2({}, data);
|
|
480
|
+
}
|
|
467
481
|
_context.p = 2;
|
|
468
482
|
_t = method.toUpperCase();
|
|
469
483
|
_context.n = _t === "GET" ? 3 : _t === "POST" ? 5 : _t === "PUT" ? 7 : _t === "DELETE" ? 9 : 11;
|
|
@@ -478,21 +492,21 @@ var httpRequest = /*#__PURE__*/function () {
|
|
|
478
492
|
return _context.a(3, 12);
|
|
479
493
|
case 5:
|
|
480
494
|
_context.n = 6;
|
|
481
|
-
return axiosInstance.post(path, dataToSend);
|
|
495
|
+
return axiosInstance.post(path, dataToSend, requestConfig);
|
|
482
496
|
case 6:
|
|
483
497
|
response = _context.v;
|
|
484
498
|
return _context.a(3, 12);
|
|
485
499
|
case 7:
|
|
486
500
|
_context.n = 8;
|
|
487
|
-
return axiosInstance.put(path, dataToSend);
|
|
501
|
+
return axiosInstance.put(path, dataToSend, requestConfig);
|
|
488
502
|
case 8:
|
|
489
503
|
response = _context.v;
|
|
490
504
|
return _context.a(3, 12);
|
|
491
505
|
case 9:
|
|
492
506
|
_context.n = 10;
|
|
493
|
-
return axiosInstance["delete"](path, {
|
|
507
|
+
return axiosInstance["delete"](path, _objectSpread2({
|
|
494
508
|
data: dataToSend
|
|
495
|
-
});
|
|
509
|
+
}, requestConfig));
|
|
496
510
|
case 10:
|
|
497
511
|
response = _context.v;
|
|
498
512
|
return _context.a(3, 12);
|
|
@@ -503,9 +517,6 @@ var httpRequest = /*#__PURE__*/function () {
|
|
|
503
517
|
case 13:
|
|
504
518
|
_context.p = 13;
|
|
505
519
|
_t2 = _context.v;
|
|
506
|
-
// Si la petición falla, el interceptor ya procesó el error.
|
|
507
|
-
// Simplemente relanzamos el error para que sea capturado por la función de API.
|
|
508
|
-
// eslint-disable-next-line no-console
|
|
509
520
|
console.error("[HTTP Client] Fallo en la petici\xF3n a ".concat(path, ":"), _t2);
|
|
510
521
|
throw _t2;
|
|
511
522
|
case 14:
|
|
@@ -663,36 +674,43 @@ var requestRevocation = /*#__PURE__*/function () {
|
|
|
663
674
|
*/
|
|
664
675
|
var getRevocationReasons = /*#__PURE__*/function () {
|
|
665
676
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
666
|
-
var response, _t2;
|
|
677
|
+
var _getConfig, integrationType, response, _t2;
|
|
667
678
|
return _regenerator().w(function (_context2) {
|
|
668
679
|
while (1) switch (_context2.p = _context2.n) {
|
|
669
680
|
case 0:
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
681
|
+
_getConfig = getConfig(), integrationType = _getConfig.integrationType;
|
|
682
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
683
|
+
_context2.n = 1;
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
throw new ApacuanaAPIError("Get revocation reasons is not supported for integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
|
|
673
687
|
case 1:
|
|
688
|
+
_context2.p = 1;
|
|
689
|
+
_context2.n = 2;
|
|
690
|
+
return httpRequest("GET", "config/api/revocation/reasonsonboarding", {});
|
|
691
|
+
case 2:
|
|
674
692
|
response = _context2.v;
|
|
675
693
|
if (response.records) {
|
|
676
|
-
_context2.n =
|
|
694
|
+
_context2.n = 3;
|
|
677
695
|
break;
|
|
678
696
|
}
|
|
679
697
|
throw new ApacuanaAPIError("Failed to fetch revocation reasons.");
|
|
680
|
-
case 2:
|
|
681
|
-
return _context2.a(2, response.records);
|
|
682
698
|
case 3:
|
|
683
|
-
_context2.
|
|
699
|
+
return _context2.a(2, response.records);
|
|
700
|
+
case 4:
|
|
701
|
+
_context2.p = 4;
|
|
684
702
|
_t2 = _context2.v;
|
|
685
703
|
if (!(_t2 instanceof ApacuanaAPIError)) {
|
|
686
|
-
_context2.n =
|
|
704
|
+
_context2.n = 5;
|
|
687
705
|
break;
|
|
688
706
|
}
|
|
689
707
|
throw _t2;
|
|
690
|
-
case 4:
|
|
691
|
-
throw new Error("Failed to get revocation reasons. Please try again later.");
|
|
692
708
|
case 5:
|
|
709
|
+
throw new Error("Failed to get revocation reasons. Please try again later.");
|
|
710
|
+
case 6:
|
|
693
711
|
return _context2.a(2);
|
|
694
712
|
}
|
|
695
|
-
}, _callee2, null, [[
|
|
713
|
+
}, _callee2, null, [[1, 4]]);
|
|
696
714
|
}));
|
|
697
715
|
return function getRevocationReasons() {
|
|
698
716
|
return _ref2.apply(this, arguments);
|
|
@@ -33366,6 +33384,154 @@ var getDocsOnBoarding = /*#__PURE__*/function () {
|
|
|
33366
33384
|
return _ref8.apply(this, arguments);
|
|
33367
33385
|
};
|
|
33368
33386
|
}();
|
|
33387
|
+
var uploadSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
33388
|
+
var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(_ref9) {
|
|
33389
|
+
var file, response, _t5;
|
|
33390
|
+
return _regenerator().w(function (_context9) {
|
|
33391
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
33392
|
+
case 0:
|
|
33393
|
+
file = _ref9.file;
|
|
33394
|
+
_context9.p = 1;
|
|
33395
|
+
_context9.n = 2;
|
|
33396
|
+
return httpRequest("services/api/customer/signaturephoto", {
|
|
33397
|
+
file: file
|
|
33398
|
+
}, "POST");
|
|
33399
|
+
case 2:
|
|
33400
|
+
response = _context9.v;
|
|
33401
|
+
return _context9.a(2, _objectSpread2(_objectSpread2({}, response), {}, {
|
|
33402
|
+
success: true
|
|
33403
|
+
}));
|
|
33404
|
+
case 3:
|
|
33405
|
+
_context9.p = 3;
|
|
33406
|
+
_t5 = _context9.v;
|
|
33407
|
+
if (!(_t5 instanceof ApacuanaAPIError)) {
|
|
33408
|
+
_context9.n = 4;
|
|
33409
|
+
break;
|
|
33410
|
+
}
|
|
33411
|
+
throw _t5;
|
|
33412
|
+
case 4:
|
|
33413
|
+
throw new ApacuanaAPIError("Failed to upload signature variant: ".concat(_t5.message || "Unknown error"));
|
|
33414
|
+
case 5:
|
|
33415
|
+
return _context9.a(2);
|
|
33416
|
+
}
|
|
33417
|
+
}, _callee9, null, [[1, 3]]);
|
|
33418
|
+
}));
|
|
33419
|
+
return function uploadSignatureVariantOnBoarding(_x5) {
|
|
33420
|
+
return _ref0.apply(this, arguments);
|
|
33421
|
+
};
|
|
33422
|
+
}();
|
|
33423
|
+
var uploadSignatureVariantOnPremise = /*#__PURE__*/function () {
|
|
33424
|
+
var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
33425
|
+
return _regenerator().w(function (_context0) {
|
|
33426
|
+
while (1) switch (_context0.n) {
|
|
33427
|
+
case 0:
|
|
33428
|
+
throw new ApacuanaAPIError("Uploading signature variants is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
33429
|
+
case 1:
|
|
33430
|
+
return _context0.a(2);
|
|
33431
|
+
}
|
|
33432
|
+
}, _callee0);
|
|
33433
|
+
}));
|
|
33434
|
+
return function uploadSignatureVariantOnPremise() {
|
|
33435
|
+
return _ref1.apply(this, arguments);
|
|
33436
|
+
};
|
|
33437
|
+
}();
|
|
33438
|
+
var getSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
33439
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
33440
|
+
var _getConfig2, customerId, response, _t6;
|
|
33441
|
+
return _regenerator().w(function (_context1) {
|
|
33442
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
33443
|
+
case 0:
|
|
33444
|
+
_getConfig2 = getConfig(), customerId = _getConfig2.customerId;
|
|
33445
|
+
_context1.p = 1;
|
|
33446
|
+
_context1.n = 2;
|
|
33447
|
+
return httpRequest("services/api/customer/getsignaturephotosdk/".concat(customerId), {}, "GET");
|
|
33448
|
+
case 2:
|
|
33449
|
+
response = _context1.v;
|
|
33450
|
+
return _context1.a(2, _objectSpread2(_objectSpread2({}, response), {}, {
|
|
33451
|
+
success: true
|
|
33452
|
+
}));
|
|
33453
|
+
case 3:
|
|
33454
|
+
_context1.p = 3;
|
|
33455
|
+
_t6 = _context1.v;
|
|
33456
|
+
if (!(_t6 instanceof ApacuanaAPIError)) {
|
|
33457
|
+
_context1.n = 4;
|
|
33458
|
+
break;
|
|
33459
|
+
}
|
|
33460
|
+
throw _t6;
|
|
33461
|
+
case 4:
|
|
33462
|
+
throw new ApacuanaAPIError("Failed to get signature variant: ".concat(_t6.message || "Unknown error"));
|
|
33463
|
+
case 5:
|
|
33464
|
+
return _context1.a(2);
|
|
33465
|
+
}
|
|
33466
|
+
}, _callee1, null, [[1, 3]]);
|
|
33467
|
+
}));
|
|
33468
|
+
return function getSignatureVariantOnBoarding() {
|
|
33469
|
+
return _ref10.apply(this, arguments);
|
|
33470
|
+
};
|
|
33471
|
+
}();
|
|
33472
|
+
var getSignatureVariantOnPremise = /*#__PURE__*/function () {
|
|
33473
|
+
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
33474
|
+
return _regenerator().w(function (_context10) {
|
|
33475
|
+
while (1) switch (_context10.n) {
|
|
33476
|
+
case 0:
|
|
33477
|
+
throw new ApacuanaAPIError("Getting signature variants is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
33478
|
+
case 1:
|
|
33479
|
+
return _context10.a(2);
|
|
33480
|
+
}
|
|
33481
|
+
}, _callee10);
|
|
33482
|
+
}));
|
|
33483
|
+
return function getSignatureVariantOnPremise() {
|
|
33484
|
+
return _ref11.apply(this, arguments);
|
|
33485
|
+
};
|
|
33486
|
+
}();
|
|
33487
|
+
var deleteSignatureVariantOnBoarding = /*#__PURE__*/function () {
|
|
33488
|
+
var _ref12 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
33489
|
+
var response, _t7;
|
|
33490
|
+
return _regenerator().w(function (_context11) {
|
|
33491
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
33492
|
+
case 0:
|
|
33493
|
+
_context11.p = 0;
|
|
33494
|
+
_context11.n = 1;
|
|
33495
|
+
return httpRequest("services/api/customer/cleansignaturephoto", {}, "DELETE");
|
|
33496
|
+
case 1:
|
|
33497
|
+
response = _context11.v;
|
|
33498
|
+
return _context11.a(2, _objectSpread2(_objectSpread2({}, response), {}, {
|
|
33499
|
+
success: true
|
|
33500
|
+
}));
|
|
33501
|
+
case 2:
|
|
33502
|
+
_context11.p = 2;
|
|
33503
|
+
_t7 = _context11.v;
|
|
33504
|
+
if (!(_t7 instanceof ApacuanaAPIError)) {
|
|
33505
|
+
_context11.n = 3;
|
|
33506
|
+
break;
|
|
33507
|
+
}
|
|
33508
|
+
throw _t7;
|
|
33509
|
+
case 3:
|
|
33510
|
+
throw new ApacuanaAPIError("Failed to delete signature variant: ".concat(_t7.message || "Unknown error"));
|
|
33511
|
+
case 4:
|
|
33512
|
+
return _context11.a(2);
|
|
33513
|
+
}
|
|
33514
|
+
}, _callee11, null, [[0, 2]]);
|
|
33515
|
+
}));
|
|
33516
|
+
return function deleteSignatureVariantOnBoarding() {
|
|
33517
|
+
return _ref12.apply(this, arguments);
|
|
33518
|
+
};
|
|
33519
|
+
}();
|
|
33520
|
+
var deleteSignatureVariantOnPremise = /*#__PURE__*/function () {
|
|
33521
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
33522
|
+
return _regenerator().w(function (_context12) {
|
|
33523
|
+
while (1) switch (_context12.n) {
|
|
33524
|
+
case 0:
|
|
33525
|
+
throw new ApacuanaAPIError("Deleting signature variants is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
33526
|
+
case 1:
|
|
33527
|
+
return _context12.a(2);
|
|
33528
|
+
}
|
|
33529
|
+
}, _callee12);
|
|
33530
|
+
}));
|
|
33531
|
+
return function deleteSignatureVariantOnPremise() {
|
|
33532
|
+
return _ref13.apply(this, arguments);
|
|
33533
|
+
};
|
|
33534
|
+
}();
|
|
33369
33535
|
|
|
33370
33536
|
// =================================================================
|
|
33371
33537
|
// Exported Functions
|
|
@@ -33379,32 +33545,32 @@ var getDocsOnBoarding = /*#__PURE__*/function () {
|
|
|
33379
33545
|
* @throws {ApacuanaAPIError} Arroja un error 'NOT_IMPLEMENTED' para cualquier tipo de integración.
|
|
33380
33546
|
*/
|
|
33381
33547
|
var signDocument = /*#__PURE__*/function () {
|
|
33382
|
-
var
|
|
33383
|
-
var
|
|
33384
|
-
return _regenerator().w(function (
|
|
33385
|
-
while (1) switch (
|
|
33548
|
+
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(signData) {
|
|
33549
|
+
var _getConfig3, integrationType;
|
|
33550
|
+
return _regenerator().w(function (_context13) {
|
|
33551
|
+
while (1) switch (_context13.n) {
|
|
33386
33552
|
case 0:
|
|
33387
|
-
|
|
33553
|
+
_getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
|
|
33388
33554
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33389
|
-
|
|
33555
|
+
_context13.n = 1;
|
|
33390
33556
|
break;
|
|
33391
33557
|
}
|
|
33392
|
-
return
|
|
33558
|
+
return _context13.a(2, signDocumentOnBoarding(signData));
|
|
33393
33559
|
case 1:
|
|
33394
33560
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33395
|
-
|
|
33561
|
+
_context13.n = 2;
|
|
33396
33562
|
break;
|
|
33397
33563
|
}
|
|
33398
|
-
return
|
|
33564
|
+
return _context13.a(2, signDocumentOnPremise());
|
|
33399
33565
|
case 2:
|
|
33400
33566
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33401
33567
|
case 3:
|
|
33402
|
-
return
|
|
33568
|
+
return _context13.a(2);
|
|
33403
33569
|
}
|
|
33404
|
-
},
|
|
33570
|
+
}, _callee13);
|
|
33405
33571
|
}));
|
|
33406
|
-
return function signDocument(
|
|
33407
|
-
return
|
|
33572
|
+
return function signDocument(_x6) {
|
|
33573
|
+
return _ref14.apply(this, arguments);
|
|
33408
33574
|
};
|
|
33409
33575
|
}();
|
|
33410
33576
|
|
|
@@ -33415,33 +33581,33 @@ var signDocument = /*#__PURE__*/function () {
|
|
|
33415
33581
|
* @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.
|
|
33416
33582
|
*/
|
|
33417
33583
|
var getDigest = /*#__PURE__*/function () {
|
|
33418
|
-
var
|
|
33419
|
-
var
|
|
33420
|
-
return _regenerator().w(function (
|
|
33421
|
-
while (1) switch (
|
|
33584
|
+
var _ref15 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(signData) {
|
|
33585
|
+
var _getConfig4, integrationType;
|
|
33586
|
+
return _regenerator().w(function (_context14) {
|
|
33587
|
+
while (1) switch (_context14.n) {
|
|
33422
33588
|
case 0:
|
|
33423
33589
|
helpers.validateGetDigestData(signData);
|
|
33424
|
-
|
|
33590
|
+
_getConfig4 = getConfig(), integrationType = _getConfig4.integrationType;
|
|
33425
33591
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33426
|
-
|
|
33592
|
+
_context14.n = 1;
|
|
33427
33593
|
break;
|
|
33428
33594
|
}
|
|
33429
|
-
return
|
|
33595
|
+
return _context14.a(2, getDigestToSignOnBoarding(signData));
|
|
33430
33596
|
case 1:
|
|
33431
33597
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33432
|
-
|
|
33598
|
+
_context14.n = 2;
|
|
33433
33599
|
break;
|
|
33434
33600
|
}
|
|
33435
|
-
return
|
|
33601
|
+
return _context14.a(2, getDigestToSignOnPremise());
|
|
33436
33602
|
case 2:
|
|
33437
33603
|
throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
|
|
33438
33604
|
case 3:
|
|
33439
|
-
return
|
|
33605
|
+
return _context14.a(2);
|
|
33440
33606
|
}
|
|
33441
|
-
},
|
|
33607
|
+
}, _callee14);
|
|
33442
33608
|
}));
|
|
33443
|
-
return function getDigest(
|
|
33444
|
-
return
|
|
33609
|
+
return function getDigest(_x7) {
|
|
33610
|
+
return _ref15.apply(this, arguments);
|
|
33445
33611
|
};
|
|
33446
33612
|
}();
|
|
33447
33613
|
|
|
@@ -33477,38 +33643,38 @@ var getDigest = /*#__PURE__*/function () {
|
|
|
33477
33643
|
* @throws {ApacuanaAPIError} If signerData is invalid or if the integration type is not supported.
|
|
33478
33644
|
*/
|
|
33479
33645
|
var addSigner = /*#__PURE__*/function () {
|
|
33480
|
-
var
|
|
33481
|
-
var
|
|
33482
|
-
return _regenerator().w(function (
|
|
33483
|
-
while (1) switch (
|
|
33646
|
+
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(signerData) {
|
|
33647
|
+
var _getConfig5, integrationType;
|
|
33648
|
+
return _regenerator().w(function (_context15) {
|
|
33649
|
+
while (1) switch (_context15.n) {
|
|
33484
33650
|
case 0:
|
|
33485
33651
|
if (!(!signerData || _typeof(signerData) !== "object" || Object.keys(signerData).length === 0)) {
|
|
33486
|
-
|
|
33652
|
+
_context15.n = 1;
|
|
33487
33653
|
break;
|
|
33488
33654
|
}
|
|
33489
33655
|
throw new ApacuanaAPIError("Signer data (signerData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
|
|
33490
33656
|
case 1:
|
|
33491
|
-
|
|
33657
|
+
_getConfig5 = getConfig(), integrationType = _getConfig5.integrationType;
|
|
33492
33658
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33493
|
-
|
|
33659
|
+
_context15.n = 2;
|
|
33494
33660
|
break;
|
|
33495
33661
|
}
|
|
33496
|
-
return
|
|
33662
|
+
return _context15.a(2, addSignerOnBoarding(signerData));
|
|
33497
33663
|
case 2:
|
|
33498
33664
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33499
|
-
|
|
33665
|
+
_context15.n = 3;
|
|
33500
33666
|
break;
|
|
33501
33667
|
}
|
|
33502
|
-
return
|
|
33668
|
+
return _context15.a(2, addSignerOnPremise());
|
|
33503
33669
|
case 3:
|
|
33504
33670
|
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33505
33671
|
case 4:
|
|
33506
|
-
return
|
|
33672
|
+
return _context15.a(2);
|
|
33507
33673
|
}
|
|
33508
|
-
},
|
|
33674
|
+
}, _callee15);
|
|
33509
33675
|
}));
|
|
33510
|
-
return function addSigner(
|
|
33511
|
-
return
|
|
33676
|
+
return function addSigner(_x8) {
|
|
33677
|
+
return _ref16.apply(this, arguments);
|
|
33512
33678
|
};
|
|
33513
33679
|
}();
|
|
33514
33680
|
|
|
@@ -33519,33 +33685,158 @@ var addSigner = /*#__PURE__*/function () {
|
|
|
33519
33685
|
* @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.
|
|
33520
33686
|
*/
|
|
33521
33687
|
var getDocs = /*#__PURE__*/function () {
|
|
33522
|
-
var
|
|
33523
|
-
var
|
|
33524
|
-
return _regenerator().w(function (
|
|
33525
|
-
while (1) switch (
|
|
33688
|
+
var _ref17 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(data) {
|
|
33689
|
+
var _getConfig6, integrationType;
|
|
33690
|
+
return _regenerator().w(function (_context16) {
|
|
33691
|
+
while (1) switch (_context16.n) {
|
|
33526
33692
|
case 0:
|
|
33527
33693
|
helpers.validateGetDocsData(data);
|
|
33528
|
-
|
|
33694
|
+
_getConfig6 = getConfig(), integrationType = _getConfig6.integrationType;
|
|
33529
33695
|
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33530
|
-
|
|
33696
|
+
_context16.n = 1;
|
|
33531
33697
|
break;
|
|
33532
33698
|
}
|
|
33533
|
-
return
|
|
33699
|
+
return _context16.a(2, getDocsOnBoarding(data));
|
|
33534
33700
|
case 1:
|
|
33535
33701
|
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33536
|
-
|
|
33702
|
+
_context16.n = 2;
|
|
33537
33703
|
break;
|
|
33538
33704
|
}
|
|
33539
|
-
return
|
|
33705
|
+
return _context16.a(2, getDocsOnPremise());
|
|
33540
33706
|
case 2:
|
|
33541
33707
|
throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
|
|
33542
33708
|
case 3:
|
|
33543
|
-
return
|
|
33709
|
+
return _context16.a(2);
|
|
33544
33710
|
}
|
|
33545
|
-
},
|
|
33711
|
+
}, _callee16);
|
|
33546
33712
|
}));
|
|
33547
|
-
return function getDocs(
|
|
33548
|
-
return
|
|
33713
|
+
return function getDocs(_x9) {
|
|
33714
|
+
return _ref17.apply(this, arguments);
|
|
33715
|
+
};
|
|
33716
|
+
}();
|
|
33717
|
+
|
|
33718
|
+
/**
|
|
33719
|
+
* Sube una variante de firma para un firmante.
|
|
33720
|
+
* @param {object} data - Datos para la subida.
|
|
33721
|
+
* @param {File} data.file - El archivo de la variante de firma (debe ser PNG).
|
|
33722
|
+
* @returns {Promise<object>} Una promesa que resuelve a un objeto con el resultado de la operación.
|
|
33723
|
+
* @throws {ApacuanaAPIError} Si los datos son inválidos o la llamada a la API falla.
|
|
33724
|
+
*/
|
|
33725
|
+
var uploadSignatureVariant = /*#__PURE__*/function () {
|
|
33726
|
+
var _ref18 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(data) {
|
|
33727
|
+
var _getConfig7, integrationType;
|
|
33728
|
+
return _regenerator().w(function (_context17) {
|
|
33729
|
+
while (1) switch (_context17.n) {
|
|
33730
|
+
case 0:
|
|
33731
|
+
if (!(!data || !data.file)) {
|
|
33732
|
+
_context17.n = 1;
|
|
33733
|
+
break;
|
|
33734
|
+
}
|
|
33735
|
+
throw new ApacuanaAPIError("El parámetro 'file' es requerido.", 400, "INVALID_PARAMETER");
|
|
33736
|
+
case 1:
|
|
33737
|
+
if (!(typeof File === "undefined" || !(data.file instanceof File))) {
|
|
33738
|
+
_context17.n = 2;
|
|
33739
|
+
break;
|
|
33740
|
+
}
|
|
33741
|
+
throw new ApacuanaAPIError("El parámetro 'file' debe ser una instancia de 'File'.", 400, "INVALID_PARAMETER");
|
|
33742
|
+
case 2:
|
|
33743
|
+
if (!(data.file.type !== "image/png")) {
|
|
33744
|
+
_context17.n = 3;
|
|
33745
|
+
break;
|
|
33746
|
+
}
|
|
33747
|
+
throw new ApacuanaAPIError("El archivo debe ser de tipo PNG (image/png).", 400, "INVALID_PARAMETER");
|
|
33748
|
+
case 3:
|
|
33749
|
+
_getConfig7 = getConfig(), integrationType = _getConfig7.integrationType;
|
|
33750
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33751
|
+
_context17.n = 4;
|
|
33752
|
+
break;
|
|
33753
|
+
}
|
|
33754
|
+
return _context17.a(2, uploadSignatureVariantOnBoarding(data));
|
|
33755
|
+
case 4:
|
|
33756
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33757
|
+
_context17.n = 5;
|
|
33758
|
+
break;
|
|
33759
|
+
}
|
|
33760
|
+
return _context17.a(2, uploadSignatureVariantOnPremise());
|
|
33761
|
+
case 5:
|
|
33762
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33763
|
+
case 6:
|
|
33764
|
+
return _context17.a(2);
|
|
33765
|
+
}
|
|
33766
|
+
}, _callee17);
|
|
33767
|
+
}));
|
|
33768
|
+
return function uploadSignatureVariant(_x0) {
|
|
33769
|
+
return _ref18.apply(this, arguments);
|
|
33770
|
+
};
|
|
33771
|
+
}();
|
|
33772
|
+
|
|
33773
|
+
/**
|
|
33774
|
+
* Obtiene la variante de firma del firmante.
|
|
33775
|
+
* @returns {Promise<object>} Una promesa que resuelve a un objeto con los datos de la variante de firma.
|
|
33776
|
+
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
33777
|
+
*/
|
|
33778
|
+
var getSignatureVariant = /*#__PURE__*/function () {
|
|
33779
|
+
var _ref19 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
33780
|
+
var _getConfig8, integrationType;
|
|
33781
|
+
return _regenerator().w(function (_context18) {
|
|
33782
|
+
while (1) switch (_context18.n) {
|
|
33783
|
+
case 0:
|
|
33784
|
+
_getConfig8 = getConfig(), integrationType = _getConfig8.integrationType;
|
|
33785
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33786
|
+
_context18.n = 1;
|
|
33787
|
+
break;
|
|
33788
|
+
}
|
|
33789
|
+
return _context18.a(2, getSignatureVariantOnBoarding());
|
|
33790
|
+
case 1:
|
|
33791
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33792
|
+
_context18.n = 2;
|
|
33793
|
+
break;
|
|
33794
|
+
}
|
|
33795
|
+
return _context18.a(2, getSignatureVariantOnPremise());
|
|
33796
|
+
case 2:
|
|
33797
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33798
|
+
case 3:
|
|
33799
|
+
return _context18.a(2);
|
|
33800
|
+
}
|
|
33801
|
+
}, _callee18);
|
|
33802
|
+
}));
|
|
33803
|
+
return function getSignatureVariant() {
|
|
33804
|
+
return _ref19.apply(this, arguments);
|
|
33805
|
+
};
|
|
33806
|
+
}();
|
|
33807
|
+
|
|
33808
|
+
/**
|
|
33809
|
+
* Elimina la variante de firma del firmante.
|
|
33810
|
+
* @returns {Promise<object>} Una promesa que resuelve a un objeto con el resultado de la operación.
|
|
33811
|
+
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
33812
|
+
*/
|
|
33813
|
+
var deleteSignatureVariant = /*#__PURE__*/function () {
|
|
33814
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
|
|
33815
|
+
var _getConfig9, integrationType;
|
|
33816
|
+
return _regenerator().w(function (_context19) {
|
|
33817
|
+
while (1) switch (_context19.n) {
|
|
33818
|
+
case 0:
|
|
33819
|
+
_getConfig9 = getConfig(), integrationType = _getConfig9.integrationType;
|
|
33820
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33821
|
+
_context19.n = 1;
|
|
33822
|
+
break;
|
|
33823
|
+
}
|
|
33824
|
+
return _context19.a(2, deleteSignatureVariantOnBoarding());
|
|
33825
|
+
case 1:
|
|
33826
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33827
|
+
_context19.n = 2;
|
|
33828
|
+
break;
|
|
33829
|
+
}
|
|
33830
|
+
return _context19.a(2, deleteSignatureVariantOnPremise());
|
|
33831
|
+
case 2:
|
|
33832
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33833
|
+
case 3:
|
|
33834
|
+
return _context19.a(2);
|
|
33835
|
+
}
|
|
33836
|
+
}, _callee19);
|
|
33837
|
+
}));
|
|
33838
|
+
return function deleteSignatureVariant() {
|
|
33839
|
+
return _ref20.apply(this, arguments);
|
|
33549
33840
|
};
|
|
33550
33841
|
}();
|
|
33551
33842
|
|
|
@@ -33606,8 +33897,8 @@ var apacuana = {
|
|
|
33606
33897
|
}
|
|
33607
33898
|
return init;
|
|
33608
33899
|
}(),
|
|
33609
|
-
close: function close() {
|
|
33610
|
-
return
|
|
33900
|
+
close: function close$1() {
|
|
33901
|
+
return close();
|
|
33611
33902
|
},
|
|
33612
33903
|
getConfig: getConfig,
|
|
33613
33904
|
requestRevocation: requestRevocation,
|
|
@@ -33618,7 +33909,10 @@ var apacuana = {
|
|
|
33618
33909
|
generateCert: generateCert,
|
|
33619
33910
|
signDocument: signDocument,
|
|
33620
33911
|
getDigest: getDigest,
|
|
33621
|
-
getRevocationReasons: getRevocationReasons
|
|
33912
|
+
getRevocationReasons: getRevocationReasons,
|
|
33913
|
+
uploadSignatureVariant: uploadSignatureVariant,
|
|
33914
|
+
getSignatureVariant: getSignatureVariant,
|
|
33915
|
+
deleteSignatureVariant: deleteSignatureVariant
|
|
33622
33916
|
};
|
|
33623
33917
|
|
|
33624
33918
|
export { apacuana as default };
|