apacuana-sdk-core 0.2.0 → 0.3.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.
Files changed (32) hide show
  1. package/README.md +64 -15
  2. package/coverage/clover.xml +145 -111
  3. package/coverage/coverage-final.json +6 -6
  4. package/coverage/lcov-report/index.html +30 -30
  5. package/coverage/lcov-report/src/api/certs.js.html +73 -28
  6. package/coverage/lcov-report/src/api/index.html +31 -31
  7. package/coverage/lcov-report/src/api/revocations.js.html +1 -1
  8. package/coverage/lcov-report/src/api/signatures.js.html +186 -159
  9. package/coverage/lcov-report/src/api/users.js.html +24 -63
  10. package/coverage/lcov-report/src/config/index.html +1 -1
  11. package/coverage/lcov-report/src/config/index.js.html +1 -1
  12. package/coverage/lcov-report/src/errors/index.html +1 -1
  13. package/coverage/lcov-report/src/errors/index.js.html +8 -8
  14. package/coverage/lcov-report/src/index.html +1 -1
  15. package/coverage/lcov-report/src/index.js.html +1 -1
  16. package/coverage/lcov-report/src/utils/constant.js.html +4 -4
  17. package/coverage/lcov-report/src/utils/helpers.js.html +101 -50
  18. package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
  19. package/coverage/lcov-report/src/utils/index.html +19 -19
  20. package/coverage/lcov.info +277 -205
  21. package/dist/index.js +136 -242
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +136 -242
  24. package/dist/index.mjs.map +1 -1
  25. package/package.json +1 -1
  26. package/src/api/certs.js +25 -10
  27. package/src/api/signatures.js +106 -97
  28. package/src/api/users.js +16 -29
  29. package/src/utils/helpers.js +17 -0
  30. package/tests/api/certs.test.js +58 -74
  31. package/tests/api/signatures.test.js +18 -73
  32. package/tests/api/users.test.js +10 -10
package/dist/index.mjs CHANGED
@@ -520,7 +520,7 @@ var httpRequest = /*#__PURE__*/function () {
520
520
  * Este método es útil para endpoints que requieren datos en el cuerpo de la petición
521
521
  * para buscar un usuario, como un ID de sesión o un token de acceso.
522
522
  *
523
- * @returns {Promise<object>} Objeto con los detalles del usuario.
523
+ * @returns {Promise<{token: string, userData: object, success: boolean}>} Objeto con el token de sesión, los datos del usuario y un indicador de éxito.
524
524
  * @throws {Error} Si los parámetros de entrada son inválidos.
525
525
  * @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
526
526
  */
@@ -531,62 +531,46 @@ var getCustomer = /*#__PURE__*/function () {
531
531
  while (1) switch (_context.p = _context.n) {
532
532
  case 0:
533
533
  _getConfig = getConfig(), verificationId = _getConfig.verificationId, customerId = _getConfig.customerId;
534
- body = {
535
- verificationid: verificationId,
536
- customerid: customerId
537
- }; // eslint-disable-next-line no-console
538
- console.log("-> Función 'getCustomer' ejecutada.");
539
- // eslint-disable-next-line no-console
540
- console.log("Parámetros recibidos para buscar usuario:", body);
541
-
542
- // 1. Validación de Parámetros de Entrada (Lado del SDK)
543
- if (!(!body || !body.verificationid || !body.customerid)) {
534
+ if (!(!verificationId || !customerId)) {
544
535
  _context.n = 1;
545
536
  break;
546
537
  }
547
- throw new Error("El 'body' con 'userId' es un parámetro requerido para getCustomer.");
538
+ throw new ApacuanaAPIError("Both 'verificationId' and 'customerId' must be configured.", 400, "CONFIGURATION_ERROR");
548
539
  case 1:
549
- _context.p = 1;
550
- _context.n = 2;
551
- return httpRequest("services/api/register/init",
552
- // Endpoint de ejemplo
553
- body,
554
- // Los datos a enviar en el cuerpo de la petición
555
- "POST");
556
- case 2:
540
+ body = {
541
+ verificationid: verificationId,
542
+ customerid: customerId
543
+ };
544
+ _context.p = 2;
545
+ _context.n = 3;
546
+ return httpRequest("services/api/register/init", body, "POST");
547
+ case 3:
557
548
  response = _context.v;
558
- // 3. Procesar la Respuesta del Backend
559
- // Asumiendo que la respuesta exitosa del backend incluye un objeto 'user'
560
- // eslint-disable-next-line no-console
561
- console.log("Respuesta del servidor para el token:", response);
562
549
  if (!(!response.sessionid || !response.entry)) {
563
- _context.n = 3;
550
+ _context.n = 4;
564
551
  break;
565
552
  }
566
- throw new ApacuanaAPIError("La respuesta de la API no contiene el usuario.", 200, "INVALID_API_RESPONSE");
567
- case 3:
553
+ throw new ApacuanaAPIError("The API response does not contain the user.", 200, "INVALID_API_RESPONSE");
554
+ case 4:
568
555
  return _context.a(2, {
569
556
  token: response.sessionid,
570
557
  userData: response.entry,
571
558
  success: true
572
559
  });
573
- case 4:
574
- _context.p = 4;
560
+ case 5:
561
+ _context.p = 5;
575
562
  _t = _context.v;
576
- // 4. Manejo de Errores
577
- // eslint-disable-next-line no-console
578
- console.error("Error en getCustomer:", _t);
579
563
  if (!(_t instanceof ApacuanaAPIError)) {
580
- _context.n = 5;
564
+ _context.n = 6;
581
565
  break;
582
566
  }
583
567
  throw _t;
584
- case 5:
585
- throw new ApacuanaAPIError("Fallo inesperado al obtener el token: ".concat(_t.message || "Error desconocido"));
586
568
  case 6:
569
+ throw new ApacuanaAPIError("Unexpected failure getting token: ".concat(_t.message || "Unknown error"));
570
+ case 7:
587
571
  return _context.a(2);
588
572
  }
589
- }, _callee, null, [[1, 4]]);
573
+ }, _callee, null, [[2, 5]]);
590
574
  }));
591
575
  return function getCustomer() {
592
576
  return _ref.apply(this, arguments);
@@ -32769,6 +32753,11 @@ var validateGetDocsData = function validateGetDocsData(data) {
32769
32753
  throw new ApacuanaAPIError("El parámetro 'status' no es válido. Los valores permitidos son: -1, 0, 1, 2.", 400, "INVALID_PARAMETER");
32770
32754
  }
32771
32755
  };
32756
+ var validateGetDigestData = function validateGetDigestData(signData) {
32757
+ if (!signData || !signData.cert || typeof signData.cert !== "string" || !signData.signatureId || typeof signData.signatureId !== "string") {
32758
+ throw new ApacuanaAPIError("Los parámetros 'cert' y 'signatureId' son requeridos y deben ser cadenas de texto.", 400, "INVALID_PARAMETER");
32759
+ }
32760
+ };
32772
32761
  var helpers = {
32773
32762
  getCertificateStatus: getCertificateStatus,
32774
32763
  exportPrivateKey: exportPrivateKey,
@@ -32776,9 +32765,15 @@ var helpers = {
32776
32765
  encryptedCsr: encryptedCsr,
32777
32766
  validateOnBoardingSignerData: validateOnBoardingSignerData,
32778
32767
  validateCsr: validateCsr,
32779
- validateGetDocsData: validateGetDocsData
32768
+ validateGetDocsData: validateGetDocsData,
32769
+ validateGetDigestData: validateGetDigestData
32780
32770
  };
32781
32771
 
32772
+ /**
32773
+ * Gets the user's certificate status.
32774
+ * @param {boolean} [isCertificateInDevice=false] - Indicates if the certificate is already on the device.
32775
+ * @returns {{status: string, success: boolean}} Object with the certificate status and a success indicator.
32776
+ */
32782
32777
  var getCertStatus = function getCertStatus() {
32783
32778
  var isCertificateInDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
32784
32779
  var config = getConfig();
@@ -32789,299 +32784,198 @@ var getCertStatus = function getCertStatus() {
32789
32784
  };
32790
32785
  };
32791
32786
 
32792
- /*
32793
- const signDocumentOnBoarding = async (documentData, signatureData) => {
32794
- try {
32795
- const response = await httpRequest(
32796
- "/docs/sign",
32797
- { documentData, signatureData },
32798
- "POST"
32799
- );
32800
- if (!response.success) {
32801
- throw new ApacuanaAPIError(
32802
- response.message || "Error desconocido al firmar documento."
32803
- );
32804
- }
32805
- return { signedDocId: response.id, status: response.message };
32806
- } catch (error) {
32807
- if (error.name === "ApacuanaAPIError") {
32808
- throw error;
32809
- }
32810
- throw new ApacuanaAPIError(
32811
- `Fallo en la firma del documento (on-boarding): ${error.message}`
32812
- );
32813
- }
32814
- };
32815
-
32816
- const signDocumentOnPremise = async (signature, cert, privateKey) => {
32817
- helpers.validateSignOnPremiseData({ signature, cert, privateKey });
32818
- try {
32819
- const digestBody = {
32820
- publickey: cert,
32821
- };
32822
-
32823
- const digestResponse = await httpRequest(
32824
- `services/api/documents/getdigest/${signature.id}`,
32825
- digestBody,
32826
- "POST"
32827
- );
32828
-
32829
- const digest = digestResponse.data?.digest || digestResponse.digest;
32830
- if (!digest) {
32831
- throw new ApacuanaAPIError(
32832
- "La generación de firma ha fallado: no se pudo obtener el digest del documento."
32833
- );
32834
- }
32835
-
32836
- const signedDigest = await helpers.signDigest(digest, privateKey);
32837
-
32838
- const signBody = {
32839
- positions: JSON.stringify(
32840
- signature.positions.map((p) => ({
32841
- x: p.x,
32842
- y: p.y,
32843
- page: p.page,
32844
- status: 1,
32845
- }))
32846
- ),
32847
- publickey: cert,
32848
- signeddigest: signedDigest,
32849
- };
32850
-
32851
- const signResponse = await httpRequest(
32852
- `services/api/documents/sign/${signature.id}`,
32853
- signBody,
32854
- "PUT"
32855
- );
32856
-
32857
- return signResponse;
32858
- } catch (error) {
32859
- if (error.name === "ApacuanaAPIError") {
32860
- throw error;
32861
- }
32862
- throw new ApacuanaAPIError(
32863
- `Fallo en la firma del documento (on-premise): ${error.message}`
32864
- );
32865
- }
32866
- };
32867
- */
32868
-
32869
- /**
32870
- * Firma un documento PDF con un certificado digital.
32871
- * @param {object} data - Datos para la firma. Para 'on-boarding', debe contener {documentData, signatureData}. Para 'on-premise', debe contener {signature, cert, privateKey}.
32872
- * @returns {Promise<object>} Objeto con el resultado de la firma.
32873
- */
32874
- /*
32875
- export const signDocument = async (signData) => {
32876
- if (
32877
- !signData ||
32878
- typeof signData !== "object" ||
32879
- Object.keys(signData).length === 0
32880
- ) {
32881
- throw new ApacuanaAPIError(
32882
- "El parámetro 'data' es requerido y debe ser un objeto no vacío.",
32883
- 400,
32884
- "INVALID_PARAMETER"
32885
- );
32886
- }
32887
-
32888
- const { integrationType } = getConfig();
32889
-
32890
- if (integrationType === INTEGRATION_TYPE.ONBOARDING) {
32891
- return signDocumentOnBoarding(signData);
32892
- }
32893
-
32894
- if (integrationType === INTEGRATION_TYPE.ONPREMISE) {
32895
- return signDocumentOnPremise(signData);
32896
- }
32897
-
32898
- throw new ApacuanaAPIError(
32899
- `Tipo de integración no soportado: ${integrationType}`,
32900
- 400,
32901
- "UNSUPPORTED_INTEGRATION_TYPE"
32902
- );
32903
- };
32904
- */
32905
-
32906
32787
  var addSignerOnBoarding = /*#__PURE__*/function () {
32907
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(signerData) {
32908
- var _t;
32909
- return _regenerator().w(function (_context) {
32910
- while (1) switch (_context.p = _context.n) {
32788
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(signerData) {
32789
+ var _t2;
32790
+ return _regenerator().w(function (_context7) {
32791
+ while (1) switch (_context7.p = _context7.n) {
32911
32792
  case 0:
32912
32793
  helpers.validateOnBoardingSignerData(signerData);
32913
- _context.p = 1;
32914
- _context.n = 2;
32794
+ _context7.p = 1;
32795
+ _context7.n = 2;
32915
32796
  return httpRequest("services/api/documents/signing", signerData, "POST");
32916
32797
  case 2:
32917
- return _context.a(2, {
32798
+ return _context7.a(2, {
32918
32799
  signer: signerData.typedoc + signerData.doc,
32919
32800
  success: true
32920
32801
  });
32921
32802
  case 3:
32922
- _context.p = 3;
32923
- _t = _context.v;
32924
- if (!(_t instanceof ApacuanaAPIError)) {
32925
- _context.n = 4;
32803
+ _context7.p = 3;
32804
+ _t2 = _context7.v;
32805
+ if (!(_t2 instanceof ApacuanaAPIError)) {
32806
+ _context7.n = 4;
32926
32807
  break;
32927
32808
  }
32928
- throw _t;
32809
+ throw _t2;
32929
32810
  case 4:
32930
- throw new Error("Fallo al agregar firmante en On-Boarding: ".concat(_t.message));
32811
+ throw new Error("Failed to add signer in On-Boarding: ".concat(_t2.message));
32931
32812
  case 5:
32932
- return _context.a(2);
32813
+ return _context7.a(2);
32933
32814
  }
32934
- }, _callee, null, [[1, 3]]);
32815
+ }, _callee7, null, [[1, 3]]);
32935
32816
  }));
32936
- return function addSignerOnBoarding(_x) {
32937
- return _ref.apply(this, arguments);
32817
+ return function addSignerOnBoarding(_x3) {
32818
+ return _ref7.apply(this, arguments);
32938
32819
  };
32939
32820
  }();
32940
32821
  var addSignerOnPremise = /*#__PURE__*/function () {
32941
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
32942
- return _regenerator().w(function (_context2) {
32943
- while (1) switch (_context2.n) {
32822
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
32823
+ return _regenerator().w(function (_context8) {
32824
+ while (1) switch (_context8.n) {
32944
32825
  case 0:
32945
- return _context2.a(2, Promise.resolve({
32946
- signerId: "on-premise-signer-id",
32947
- status: "added"
32948
- }));
32826
+ throw new ApacuanaAPIError("Adding signers is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
32827
+ case 1:
32828
+ return _context8.a(2);
32949
32829
  }
32950
- }, _callee2);
32830
+ }, _callee8);
32951
32831
  }));
32952
32832
  return function addSignerOnPremise() {
32953
- return _ref2.apply(this, arguments);
32833
+ return _ref8.apply(this, arguments);
32954
32834
  };
32955
32835
  }();
32956
32836
 
32957
32837
  /**
32958
- * Agrega un firmante a un documento, manejando diferentes tipos de integración.
32959
- * @param {object} signerData - Datos del firmante a agregar.
32960
- * @returns {Promise<object>} Objeto con el resultado de agregar el firmante.
32838
+ * Adds a signer to a document, handling different integration types.
32839
+ * @param {object} signerData - Data of the signer to be added.
32840
+ * @returns {Promise<{signer: string, success: boolean}>} Object with the result of adding the signer.
32841
+ * @throws {ApacuanaAPIError} If the signer data is invalid, if the API call fails, or if the integration type is not supported.
32961
32842
  */
32962
32843
  var addSigner = /*#__PURE__*/function () {
32963
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(signerData) {
32964
- var _getConfig, integrationType;
32965
- return _regenerator().w(function (_context3) {
32966
- while (1) switch (_context3.n) {
32844
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(signerData) {
32845
+ var _getConfig3, integrationType;
32846
+ return _regenerator().w(function (_context9) {
32847
+ while (1) switch (_context9.n) {
32967
32848
  case 0:
32968
32849
  if (!(!signerData || _typeof(signerData) !== "object" || Object.keys(signerData).length === 0)) {
32969
- _context3.n = 1;
32850
+ _context9.n = 1;
32970
32851
  break;
32971
32852
  }
32972
- throw new ApacuanaAPIError("Los datos del firmante (signerData) son requeridos y deben ser un objeto no vacío.", 400, "INVALID_PARAMETER");
32853
+ throw new ApacuanaAPIError("Signer data (signerData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
32973
32854
  case 1:
32974
- _getConfig = getConfig(), integrationType = _getConfig.integrationType;
32855
+ _getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
32975
32856
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
32976
- _context3.n = 2;
32857
+ _context9.n = 2;
32977
32858
  break;
32978
32859
  }
32979
- return _context3.a(2, addSignerOnBoarding(signerData));
32860
+ return _context9.a(2, addSignerOnBoarding(signerData));
32980
32861
  case 2:
32981
32862
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
32982
- _context3.n = 3;
32863
+ _context9.n = 3;
32983
32864
  break;
32984
32865
  }
32985
- return _context3.a(2, addSignerOnPremise(signerData));
32866
+ return _context9.a(2, addSignerOnPremise(signerData));
32986
32867
  case 3:
32987
- throw new ApacuanaAPIError("Tipo de integraci\xF3n no soportado: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
32868
+ throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
32988
32869
  case 4:
32989
- return _context3.a(2);
32870
+ return _context9.a(2);
32990
32871
  }
32991
- }, _callee3);
32872
+ }, _callee9);
32992
32873
  }));
32993
- return function addSigner(_x2) {
32994
- return _ref3.apply(this, arguments);
32874
+ return function addSigner(_x4) {
32875
+ return _ref9.apply(this, arguments);
32995
32876
  };
32996
32877
  }();
32997
32878
  var getDocsOnPremise = /*#__PURE__*/function () {
32998
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
32999
- return _regenerator().w(function (_context4) {
33000
- while (1) switch (_context4.n) {
32879
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
32880
+ return _regenerator().w(function (_context0) {
32881
+ while (1) switch (_context0.n) {
33001
32882
  case 0:
33002
- throw new ApacuanaAPIError("La obtención de documentos no está soportada para el tipo de integración: ONBOARDING", 501, "NOT_IMPLEMENTED");
32883
+ throw new ApacuanaAPIError("Document retrieval is not supported for integration type: ONBOARDING", 501, "NOT_IMPLEMENTED");
33003
32884
  case 1:
33004
- return _context4.a(2);
32885
+ return _context0.a(2);
33005
32886
  }
33006
- }, _callee4);
32887
+ }, _callee0);
33007
32888
  }));
33008
32889
  return function getDocsOnPremise() {
33009
- return _ref4.apply(this, arguments);
32890
+ return _ref0.apply(this, arguments);
33010
32891
  };
33011
32892
  }();
33012
32893
  var getDocsOnBoarding = /*#__PURE__*/function () {
33013
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(data) {
33014
- var _getConfig2, customerId, apiUrl, response, _t2;
33015
- return _regenerator().w(function (_context5) {
33016
- while (1) switch (_context5.p = _context5.n) {
32894
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(data) {
32895
+ var _getConfig4, customerId, params, apiUrl, response, _t3;
32896
+ return _regenerator().w(function (_context1) {
32897
+ while (1) switch (_context1.p = _context1.n) {
33017
32898
  case 0:
33018
- _getConfig2 = getConfig(), customerId = _getConfig2.customerId;
32899
+ _getConfig4 = getConfig(), customerId = _getConfig4.customerId;
33019
32900
  if (customerId) {
33020
- _context5.n = 1;
32901
+ _context1.n = 1;
33021
32902
  break;
33022
32903
  }
33023
- throw new ApacuanaAPIError("El 'customerId' no está configurado. Por favor, configure el SDK.", 400, "CONFIGURATION_ERROR");
32904
+ throw new ApacuanaAPIError("'customerId' is not configured. Please configure the SDK.", 400, "CONFIGURATION_ERROR");
33024
32905
  case 1:
33025
- _context5.p = 1;
33026
- apiUrl = "services/api/documents/listcustomer?page=".concat(data.page, "&customerid=").concat(customerId, "&size=").concat(data.size, "&status=").concat(data.status);
33027
- _context5.n = 2;
32906
+ _context1.p = 1;
32907
+ params = new URLSearchParams({
32908
+ page: data.page,
32909
+ customerid: customerId,
32910
+ size: data.size
32911
+ });
32912
+ if (typeof data.status !== "undefined") {
32913
+ params.append("status", data.status);
32914
+ }
32915
+ apiUrl = "services/api/documents/listcustomer?".concat(params.toString());
32916
+ _context1.n = 2;
33028
32917
  return httpRequest(apiUrl, {}, "GET");
33029
32918
  case 2:
33030
- response = _context5.v;
33031
- return _context5.a(2, response);
32919
+ response = _context1.v;
32920
+ return _context1.a(2, {
32921
+ totalRecords: response.numofrecords,
32922
+ records: response.records,
32923
+ success: true
32924
+ });
33032
32925
  case 3:
33033
- _context5.p = 3;
33034
- _t2 = _context5.v;
33035
- if (!(_t2.name === "ApacuanaAPIError")) {
33036
- _context5.n = 4;
32926
+ _context1.p = 3;
32927
+ _t3 = _context1.v;
32928
+ if (!(_t3.name === "ApacuanaAPIError")) {
32929
+ _context1.n = 4;
33037
32930
  break;
33038
32931
  }
33039
- throw _t2;
32932
+ throw _t3;
33040
32933
  case 4:
33041
- throw new ApacuanaAPIError("Fallo al obtener la lista de documentos (on-premise): ".concat(_t2.message));
32934
+ throw new ApacuanaAPIError("Failed to get document list (on-premise): ".concat(_t3.message));
33042
32935
  case 5:
33043
- return _context5.a(2);
32936
+ return _context1.a(2);
33044
32937
  }
33045
- }, _callee5, null, [[1, 3]]);
32938
+ }, _callee1, null, [[1, 3]]);
33046
32939
  }));
33047
- return function getDocsOnBoarding(_x3) {
33048
- return _ref5.apply(this, arguments);
32940
+ return function getDocsOnBoarding(_x5) {
32941
+ return _ref1.apply(this, arguments);
33049
32942
  };
33050
32943
  }();
33051
32944
 
33052
32945
  /**
33053
- * Obtiene una lista de documentos.
33054
- * @param {object} data - Objeto con los parámetros de paginación. Debe contener {page, size}.
33055
- * @returns {Promise<object>} Objeto con la lista de documentos.
32946
+ * Gets a list of documents.
32947
+ * @param {object} data - Object with pagination parameters. Must contain {page, size}.
32948
+ * @returns {Promise<{totalRecords: number, records:any[], success: boolean}>} Object with the list of documents.
32949
+ * @throws {ApacuanaAPIError} If pagination parameters are invalid, if 'customerId' is not configured, if the API call fails, or if the integration type is not supported.
33056
32950
  */
33057
32951
  var getDocs = /*#__PURE__*/function () {
33058
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(data) {
33059
- var _getConfig3, integrationType;
33060
- return _regenerator().w(function (_context6) {
33061
- while (1) switch (_context6.n) {
32952
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(data) {
32953
+ var _getConfig5, integrationType;
32954
+ return _regenerator().w(function (_context10) {
32955
+ while (1) switch (_context10.n) {
33062
32956
  case 0:
33063
32957
  helpers.validateGetDocsData(data);
33064
- _getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
32958
+ _getConfig5 = getConfig(), integrationType = _getConfig5.integrationType;
33065
32959
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
33066
- _context6.n = 1;
32960
+ _context10.n = 1;
33067
32961
  break;
33068
32962
  }
33069
- return _context6.a(2, getDocsOnBoarding(data));
32963
+ return _context10.a(2, getDocsOnBoarding(data));
33070
32964
  case 1:
33071
32965
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
33072
- _context6.n = 2;
32966
+ _context10.n = 2;
33073
32967
  break;
33074
32968
  }
33075
- return _context6.a(2, getDocsOnPremise());
32969
+ return _context10.a(2, getDocsOnPremise());
33076
32970
  case 2:
33077
- throw new ApacuanaAPIError("La obtenci\xF3n de documentos no est\xE1 soportada para un tipo de integraci\xF3n desconocido: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
32971
+ throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
33078
32972
  case 3:
33079
- return _context6.a(2);
32973
+ return _context10.a(2);
33080
32974
  }
33081
- }, _callee6);
32975
+ }, _callee10);
33082
32976
  }));
33083
- return function getDocs(_x4) {
33084
- return _ref6.apply(this, arguments);
32977
+ return function getDocs(_x6) {
32978
+ return _ref10.apply(this, arguments);
33085
32979
  };
33086
32980
  }();
33087
32981