apacuana-sdk-core 0.11.0 → 0.12.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/coverage/clover.xml +117 -114
- package/coverage/coverage-final.json +6 -6
- package/coverage/lcov-report/index.html +12 -12
- package/coverage/lcov-report/src/api/certs.js.html +1 -1
- package/coverage/lcov-report/src/api/faceLiveness.js.html +34 -7
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/revocations.js.html +50 -5
- package/coverage/lcov-report/src/api/signatures.js.html +1 -1
- package/coverage/lcov-report/src/api/users.js.html +20 -5
- 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 +13 -13
- package/coverage/lcov-report/src/index.js.html +72 -12
- 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 +195 -188
- package/dist/api/revocations.d.ts +6 -3
- package/dist/api/users.d.ts +16 -6
- package/dist/index.js +58 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -15
- package/dist/index.mjs.map +1 -1
- package/dist/types/faceLiveness.d.ts +6 -5
- package/dist/types/revocations.d.ts +26 -15
- package/dist/types/signatures.d.ts +60 -65
- package/package.json +1 -1
- package/src/api/faceLiveness.js +13 -4
- package/src/api/revocations.js +18 -3
- package/src/api/users.js +8 -3
- package/src/index.js +25 -5
- package/src/types/faceLiveness.js +11 -2
- package/src/types/revocations.js +29 -9
- package/src/types/signatures.js +42 -28
- package/tests/api/faceLiveness.test.js +28 -30
- package/tests/api/revocations.test.js +4 -4
- package/tests/index.test.js +16 -8
package/dist/index.js
CHANGED
|
@@ -541,10 +541,15 @@ var ApacuanaSuccess = /*#__PURE__*/_createClass(function ApacuanaSuccess(data) {
|
|
|
541
541
|
});
|
|
542
542
|
|
|
543
543
|
/**
|
|
544
|
-
* @typedef {object}
|
|
544
|
+
* @typedef {object} GetCustomerData
|
|
545
545
|
* @property {string} token - El token de sesión del usuario.
|
|
546
546
|
* @property {object} userData - Los datos del usuario obtenidos.
|
|
547
|
-
|
|
547
|
+
*/
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* @typedef {object} GetCustomerResponse
|
|
551
|
+
* @property {true} success - Indica que la operación fue exitosa.
|
|
552
|
+
* @property {GetCustomerData} data - El payload de la respuesta.
|
|
548
553
|
*/
|
|
549
554
|
|
|
550
555
|
/**
|
|
@@ -552,7 +557,7 @@ var ApacuanaSuccess = /*#__PURE__*/_createClass(function ApacuanaSuccess(data) {
|
|
|
552
557
|
* Este método es útil para endpoints que requieren datos en el cuerpo de la petición
|
|
553
558
|
* para buscar un usuario, como un ID de sesión o un token de acceso.
|
|
554
559
|
*
|
|
555
|
-
* @returns {Promise<GetCustomerResponse>}
|
|
560
|
+
* @returns {Promise<GetCustomerResponse>} Una promesa que resuelve a un objeto con la respuesta exitosa.
|
|
556
561
|
* @throws {Error} Si los parámetros de entrada son inválidos.
|
|
557
562
|
* @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
|
|
558
563
|
*/
|
|
@@ -608,6 +613,9 @@ var getCustomer = /*#__PURE__*/function () {
|
|
|
608
613
|
};
|
|
609
614
|
}();
|
|
610
615
|
|
|
616
|
+
/** @typedef {import("../types/revocations").RequestRevocationResponse} RequestRevocationResponse */
|
|
617
|
+
/** @typedef {import("../types/revocations").GetRevocationReasonsResponse} GetRevocationReasonsResponse */
|
|
618
|
+
|
|
611
619
|
var requestRevocationOnBoarding = /*#__PURE__*/function () {
|
|
612
620
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
613
621
|
var response, _t;
|
|
@@ -616,7 +624,7 @@ var requestRevocationOnBoarding = /*#__PURE__*/function () {
|
|
|
616
624
|
case 0:
|
|
617
625
|
_context.p = 0;
|
|
618
626
|
_context.n = 1;
|
|
619
|
-
return httpRequest("services/api/
|
|
627
|
+
return httpRequest("services/api/onboardingclient/requestcert", params, "POST");
|
|
620
628
|
case 1:
|
|
621
629
|
response = _context.v;
|
|
622
630
|
return _context.a(2, new ApacuanaSuccess(response));
|
|
@@ -654,6 +662,14 @@ var requestRevocationOnPremise = /*#__PURE__*/function () {
|
|
|
654
662
|
return _ref2.apply(this, arguments);
|
|
655
663
|
};
|
|
656
664
|
}();
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Solicita la revocación de un certificado.
|
|
668
|
+
* @param {object} params - Parámetros para la solicitud.
|
|
669
|
+
* @param {number} params.reasonCode - El código de la razón de la revocación.
|
|
670
|
+
* @returns {Promise<RequestRevocationResponse>} Una promesa que resuelve con la confirmación de la solicitud.
|
|
671
|
+
* @throws {Error} Si los parámetros son inválidos.
|
|
672
|
+
*/
|
|
657
673
|
var requestRevocation = /*#__PURE__*/function () {
|
|
658
674
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(params) {
|
|
659
675
|
var _getConfig, integrationType;
|
|
@@ -697,7 +713,7 @@ var getRevocationReasonsOnBoarding = /*#__PURE__*/function () {
|
|
|
697
713
|
case 0:
|
|
698
714
|
_context4.p = 0;
|
|
699
715
|
_context4.n = 1;
|
|
700
|
-
return httpRequest("
|
|
716
|
+
return httpRequest("config/api/revocation/reasonsonboarding", {}, "GET");
|
|
701
717
|
case 1:
|
|
702
718
|
response = _context4.v;
|
|
703
719
|
if (!(!response || !response.records)) {
|
|
@@ -706,7 +722,9 @@ var getRevocationReasonsOnBoarding = /*#__PURE__*/function () {
|
|
|
706
722
|
}
|
|
707
723
|
throw new ApacuanaAPIError("Failed to fetch revocation reasons.");
|
|
708
724
|
case 2:
|
|
709
|
-
return _context4.a(2, new ApacuanaSuccess(
|
|
725
|
+
return _context4.a(2, new ApacuanaSuccess({
|
|
726
|
+
reasons: response.records
|
|
727
|
+
}));
|
|
710
728
|
case 3:
|
|
711
729
|
_context4.p = 3;
|
|
712
730
|
_t2 = _context4.v;
|
|
@@ -741,6 +759,12 @@ var getRevocationReasonsOnPremise = /*#__PURE__*/function () {
|
|
|
741
759
|
return _ref5.apply(this, arguments);
|
|
742
760
|
};
|
|
743
761
|
}();
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Obtiene la lista de razones de revocación de certificados.
|
|
765
|
+
* @returns {Promise<GetRevocationReasonsResponse>} Una promesa que resuelve con la lista de razones de revocación.
|
|
766
|
+
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
767
|
+
*/
|
|
744
768
|
var getRevocationReasons = /*#__PURE__*/function () {
|
|
745
769
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
746
770
|
var _getConfig2, integrationType;
|
|
@@ -34049,6 +34073,12 @@ var deleteSignatureVariant = /*#__PURE__*/function () {
|
|
|
34049
34073
|
};
|
|
34050
34074
|
}();
|
|
34051
34075
|
|
|
34076
|
+
/**
|
|
34077
|
+
* Creates a new Face Liveness session.
|
|
34078
|
+
* @returns {Promise<CreateFaceLivenessSessionResponse>} Object with the session ID and a success indicator.
|
|
34079
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
34080
|
+
* @throws {Error} If the request fails for another reason.
|
|
34081
|
+
*/
|
|
34052
34082
|
var createFaceLivenessSessionOnBoarding = /*#__PURE__*/function () {
|
|
34053
34083
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
34054
34084
|
var response, _t;
|
|
@@ -34060,14 +34090,14 @@ var createFaceLivenessSessionOnBoarding = /*#__PURE__*/function () {
|
|
|
34060
34090
|
return httpRequest("services/api/faceliveness/create", {}, "POST");
|
|
34061
34091
|
case 1:
|
|
34062
34092
|
response = _context.v;
|
|
34063
|
-
if (response.
|
|
34093
|
+
if (response.sessionid) {
|
|
34064
34094
|
_context.n = 2;
|
|
34065
34095
|
break;
|
|
34066
34096
|
}
|
|
34067
34097
|
throw new ApacuanaAPIError("The API response does not contain the session ID.", response.status, "INVALID_API_RESPONSE");
|
|
34068
34098
|
case 2:
|
|
34069
34099
|
return _context.a(2, new ApacuanaSuccess({
|
|
34070
|
-
sessionId: response.
|
|
34100
|
+
sessionId: response.sessionid
|
|
34071
34101
|
}));
|
|
34072
34102
|
case 3:
|
|
34073
34103
|
_context.p = 3;
|
|
@@ -34078,7 +34108,7 @@ var createFaceLivenessSessionOnBoarding = /*#__PURE__*/function () {
|
|
|
34078
34108
|
}
|
|
34079
34109
|
throw _t;
|
|
34080
34110
|
case 4:
|
|
34081
|
-
throw new
|
|
34111
|
+
throw new ApacuanaAPIError("Failed to create Face Liveness session: ".concat(_t.message));
|
|
34082
34112
|
case 5:
|
|
34083
34113
|
return _context.a(2);
|
|
34084
34114
|
}
|
|
@@ -34268,7 +34298,7 @@ var apacuana = {
|
|
|
34268
34298
|
*/
|
|
34269
34299
|
init: function () {
|
|
34270
34300
|
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
|
|
34271
|
-
var currentConfig,
|
|
34301
|
+
var currentConfig, customer, _customer$data, token, userData, _t;
|
|
34272
34302
|
return _regenerator().w(function (_context) {
|
|
34273
34303
|
while (1) switch (_context.p = _context.n) {
|
|
34274
34304
|
case 0:
|
|
@@ -34280,27 +34310,37 @@ var apacuana = {
|
|
|
34280
34310
|
_context.n = 1;
|
|
34281
34311
|
break;
|
|
34282
34312
|
}
|
|
34283
|
-
throw new
|
|
34313
|
+
throw new ApacuanaAPIError("Apacuana SDK: La configuración de CustomerId no se ha guardado" + " correctamente.", 400, {
|
|
34314
|
+
code: "CONFIG_ERROR"
|
|
34315
|
+
});
|
|
34284
34316
|
case 1:
|
|
34285
34317
|
_context.n = 2;
|
|
34286
34318
|
return getCustomer();
|
|
34287
34319
|
case 2:
|
|
34288
|
-
|
|
34289
|
-
token =
|
|
34290
|
-
userData = _yield$getCustomer.userData;
|
|
34320
|
+
customer = _context.v;
|
|
34321
|
+
_customer$data = customer.data, token = _customer$data.token, userData = _customer$data.userData;
|
|
34291
34322
|
setConfig(_objectSpread2(_objectSpread2({}, currentConfig), {}, {
|
|
34292
34323
|
token: token,
|
|
34293
34324
|
userData: userData
|
|
34294
34325
|
}));
|
|
34295
34326
|
setAuthToken(token);
|
|
34296
|
-
return _context.a(2,
|
|
34327
|
+
return _context.a(2, new ApacuanaSuccess({
|
|
34328
|
+
initialized: true,
|
|
34329
|
+
message: "SDK inicializado correctamente."
|
|
34330
|
+
}));
|
|
34297
34331
|
case 3:
|
|
34298
34332
|
_context.p = 3;
|
|
34299
34333
|
_t = _context.v;
|
|
34300
34334
|
// eslint-disable-next-line no-console
|
|
34301
34335
|
console.error("Error durante la inicialización del SDK:", _t);
|
|
34336
|
+
if (!(_t instanceof ApacuanaAPIError)) {
|
|
34337
|
+
_context.n = 4;
|
|
34338
|
+
break;
|
|
34339
|
+
}
|
|
34302
34340
|
throw _t;
|
|
34303
34341
|
case 4:
|
|
34342
|
+
throw new ApacuanaAPIError(_t.message || "Error desconocido durante la inicialización.", 500, _t);
|
|
34343
|
+
case 5:
|
|
34304
34344
|
return _context.a(2);
|
|
34305
34345
|
}
|
|
34306
34346
|
}, _callee, null, [[0, 3]]);
|
|
@@ -34310,6 +34350,9 @@ var apacuana = {
|
|
|
34310
34350
|
}
|
|
34311
34351
|
return init;
|
|
34312
34352
|
}(),
|
|
34353
|
+
/**
|
|
34354
|
+
* Permite obtener la configuración actual del SDK.
|
|
34355
|
+
*/
|
|
34313
34356
|
close: function close$1() {
|
|
34314
34357
|
return close();
|
|
34315
34358
|
},
|