apacuana-sdk-core 0.4.0 → 0.5.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 +72 -72
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/src/api/certs.js.html +1 -1
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/revocations.js.html +1 -1
- package/coverage/lcov-report/src/api/signatures.js.html +320 -140
- 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 +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.js.html +1 -1
- 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 +121 -121
- package/dist/api/signatures.d.ts +103 -12
- package/dist/index.js +88 -88
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +88 -88
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/signatures.js +156 -96
- package/tests/api/signatures.test.js +11 -4
package/dist/index.js
CHANGED
|
@@ -32893,125 +32893,83 @@ var getCertStatus = function getCertStatus() {
|
|
|
32893
32893
|
};
|
|
32894
32894
|
|
|
32895
32895
|
var addSignerOnBoarding = /*#__PURE__*/function () {
|
|
32896
|
-
var
|
|
32896
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(signerData) {
|
|
32897
32897
|
var _t2;
|
|
32898
|
-
return _regenerator().w(function (
|
|
32899
|
-
while (1) switch (
|
|
32898
|
+
return _regenerator().w(function (_context5) {
|
|
32899
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
32900
32900
|
case 0:
|
|
32901
32901
|
helpers.validateOnBoardingSignerData(signerData);
|
|
32902
|
-
|
|
32903
|
-
|
|
32902
|
+
_context5.p = 1;
|
|
32903
|
+
_context5.n = 2;
|
|
32904
32904
|
return httpRequest("services/api/documents/signing", signerData, "POST");
|
|
32905
32905
|
case 2:
|
|
32906
|
-
return
|
|
32906
|
+
return _context5.a(2, {
|
|
32907
32907
|
signer: signerData.typedoc + signerData.doc,
|
|
32908
32908
|
success: true
|
|
32909
32909
|
});
|
|
32910
32910
|
case 3:
|
|
32911
|
-
|
|
32912
|
-
_t2 =
|
|
32911
|
+
_context5.p = 3;
|
|
32912
|
+
_t2 = _context5.v;
|
|
32913
32913
|
if (!(_t2 instanceof ApacuanaAPIError)) {
|
|
32914
|
-
|
|
32914
|
+
_context5.n = 4;
|
|
32915
32915
|
break;
|
|
32916
32916
|
}
|
|
32917
32917
|
throw _t2;
|
|
32918
32918
|
case 4:
|
|
32919
32919
|
throw new Error("Failed to add signer in On-Boarding: ".concat(_t2.message));
|
|
32920
32920
|
case 5:
|
|
32921
|
-
return
|
|
32921
|
+
return _context5.a(2);
|
|
32922
32922
|
}
|
|
32923
|
-
},
|
|
32923
|
+
}, _callee5, null, [[1, 3]]);
|
|
32924
32924
|
}));
|
|
32925
|
-
return function addSignerOnBoarding(
|
|
32926
|
-
return
|
|
32925
|
+
return function addSignerOnBoarding(_x2) {
|
|
32926
|
+
return _ref5.apply(this, arguments);
|
|
32927
32927
|
};
|
|
32928
32928
|
}();
|
|
32929
32929
|
var addSignerOnPremise = /*#__PURE__*/function () {
|
|
32930
|
-
var
|
|
32931
|
-
return _regenerator().w(function (
|
|
32932
|
-
while (1) switch (
|
|
32930
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
32931
|
+
return _regenerator().w(function (_context6) {
|
|
32932
|
+
while (1) switch (_context6.n) {
|
|
32933
32933
|
case 0:
|
|
32934
32934
|
throw new ApacuanaAPIError("Adding signers is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
32935
32935
|
case 1:
|
|
32936
|
-
return
|
|
32936
|
+
return _context6.a(2);
|
|
32937
32937
|
}
|
|
32938
|
-
},
|
|
32938
|
+
}, _callee6);
|
|
32939
32939
|
}));
|
|
32940
32940
|
return function addSignerOnPremise() {
|
|
32941
|
-
return
|
|
32942
|
-
};
|
|
32943
|
-
}();
|
|
32944
|
-
|
|
32945
|
-
/**
|
|
32946
|
-
* Adds a signer to a document, handling different integration types.
|
|
32947
|
-
* @param {object} signerData - Data of the signer to be added.
|
|
32948
|
-
* @returns {Promise<{signer: string, success: boolean}>} Object with the result of adding the signer.
|
|
32949
|
-
* @throws {ApacuanaAPIError} If the signer data is invalid, if the API call fails, or if the integration type is not supported.
|
|
32950
|
-
*/
|
|
32951
|
-
var addSigner = /*#__PURE__*/function () {
|
|
32952
|
-
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(signerData) {
|
|
32953
|
-
var _getConfig3, integrationType;
|
|
32954
|
-
return _regenerator().w(function (_context9) {
|
|
32955
|
-
while (1) switch (_context9.n) {
|
|
32956
|
-
case 0:
|
|
32957
|
-
if (!(!signerData || _typeof(signerData) !== "object" || Object.keys(signerData).length === 0)) {
|
|
32958
|
-
_context9.n = 1;
|
|
32959
|
-
break;
|
|
32960
|
-
}
|
|
32961
|
-
throw new ApacuanaAPIError("Signer data (signerData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
|
|
32962
|
-
case 1:
|
|
32963
|
-
_getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
|
|
32964
|
-
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
32965
|
-
_context9.n = 2;
|
|
32966
|
-
break;
|
|
32967
|
-
}
|
|
32968
|
-
return _context9.a(2, addSignerOnBoarding(signerData));
|
|
32969
|
-
case 2:
|
|
32970
|
-
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
32971
|
-
_context9.n = 3;
|
|
32972
|
-
break;
|
|
32973
|
-
}
|
|
32974
|
-
return _context9.a(2, addSignerOnPremise(signerData));
|
|
32975
|
-
case 3:
|
|
32976
|
-
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
32977
|
-
case 4:
|
|
32978
|
-
return _context9.a(2);
|
|
32979
|
-
}
|
|
32980
|
-
}, _callee9);
|
|
32981
|
-
}));
|
|
32982
|
-
return function addSigner(_x4) {
|
|
32983
|
-
return _ref9.apply(this, arguments);
|
|
32941
|
+
return _ref6.apply(this, arguments);
|
|
32984
32942
|
};
|
|
32985
32943
|
}();
|
|
32986
32944
|
var getDocsOnPremise = /*#__PURE__*/function () {
|
|
32987
|
-
var
|
|
32988
|
-
return _regenerator().w(function (
|
|
32989
|
-
while (1) switch (
|
|
32945
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
32946
|
+
return _regenerator().w(function (_context7) {
|
|
32947
|
+
while (1) switch (_context7.n) {
|
|
32990
32948
|
case 0:
|
|
32991
|
-
throw new ApacuanaAPIError("Document retrieval is not supported for integration type:
|
|
32949
|
+
throw new ApacuanaAPIError("Document retrieval is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
|
|
32992
32950
|
case 1:
|
|
32993
|
-
return
|
|
32951
|
+
return _context7.a(2);
|
|
32994
32952
|
}
|
|
32995
|
-
},
|
|
32953
|
+
}, _callee7);
|
|
32996
32954
|
}));
|
|
32997
32955
|
return function getDocsOnPremise() {
|
|
32998
|
-
return
|
|
32956
|
+
return _ref7.apply(this, arguments);
|
|
32999
32957
|
};
|
|
33000
32958
|
}();
|
|
33001
32959
|
var getDocsOnBoarding = /*#__PURE__*/function () {
|
|
33002
|
-
var
|
|
33003
|
-
var
|
|
33004
|
-
return _regenerator().w(function (
|
|
33005
|
-
while (1) switch (
|
|
32960
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(data) {
|
|
32961
|
+
var _getConfig, customerId, params, apiUrl, response, _t3;
|
|
32962
|
+
return _regenerator().w(function (_context8) {
|
|
32963
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
33006
32964
|
case 0:
|
|
33007
|
-
|
|
32965
|
+
_getConfig = getConfig(), customerId = _getConfig.customerId;
|
|
33008
32966
|
if (customerId) {
|
|
33009
|
-
|
|
32967
|
+
_context8.n = 1;
|
|
33010
32968
|
break;
|
|
33011
32969
|
}
|
|
33012
32970
|
throw new ApacuanaAPIError("'customerId' is not configured. Please configure the SDK.", 400, "CONFIGURATION_ERROR");
|
|
33013
32971
|
case 1:
|
|
33014
|
-
|
|
32972
|
+
_context8.p = 1;
|
|
33015
32973
|
params = new URLSearchParams({
|
|
33016
32974
|
page: data.page,
|
|
33017
32975
|
customerid: customerId,
|
|
@@ -33021,40 +32979,82 @@ var getDocsOnBoarding = /*#__PURE__*/function () {
|
|
|
33021
32979
|
params.append("status", data.status);
|
|
33022
32980
|
}
|
|
33023
32981
|
apiUrl = "services/api/documents/listcustomer?".concat(params.toString());
|
|
33024
|
-
|
|
32982
|
+
_context8.n = 2;
|
|
33025
32983
|
return httpRequest(apiUrl, {}, "GET");
|
|
33026
32984
|
case 2:
|
|
33027
|
-
response =
|
|
33028
|
-
return
|
|
32985
|
+
response = _context8.v;
|
|
32986
|
+
return _context8.a(2, {
|
|
33029
32987
|
totalRecords: response.numofrecords,
|
|
33030
32988
|
records: response.records,
|
|
33031
32989
|
success: true
|
|
33032
32990
|
});
|
|
33033
32991
|
case 3:
|
|
33034
|
-
|
|
33035
|
-
_t3 =
|
|
32992
|
+
_context8.p = 3;
|
|
32993
|
+
_t3 = _context8.v;
|
|
33036
32994
|
if (!(_t3.name === "ApacuanaAPIError")) {
|
|
33037
|
-
|
|
32995
|
+
_context8.n = 4;
|
|
33038
32996
|
break;
|
|
33039
32997
|
}
|
|
33040
32998
|
throw _t3;
|
|
33041
32999
|
case 4:
|
|
33042
|
-
throw new ApacuanaAPIError("Failed to get document list (on-
|
|
33000
|
+
throw new ApacuanaAPIError("Failed to get document list (on-boarding): ".concat(_t3.message));
|
|
33043
33001
|
case 5:
|
|
33002
|
+
return _context8.a(2);
|
|
33003
|
+
}
|
|
33004
|
+
}, _callee8, null, [[1, 3]]);
|
|
33005
|
+
}));
|
|
33006
|
+
return function getDocsOnBoarding(_x3) {
|
|
33007
|
+
return _ref8.apply(this, arguments);
|
|
33008
|
+
};
|
|
33009
|
+
}();
|
|
33010
|
+
|
|
33011
|
+
/**
|
|
33012
|
+
* Añade un firmante a un documento.
|
|
33013
|
+
* @param {SignerData} signerData - Los datos del firmante que se va a añadir.
|
|
33014
|
+
* @returns {Promise<AddSignerResponse>} Una promesa que resuelve a un objeto con el resultado de la operación.
|
|
33015
|
+
* @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.
|
|
33016
|
+
*/
|
|
33017
|
+
var addSigner = /*#__PURE__*/function () {
|
|
33018
|
+
var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(signerData) {
|
|
33019
|
+
var _getConfig4, integrationType;
|
|
33020
|
+
return _regenerator().w(function (_context1) {
|
|
33021
|
+
while (1) switch (_context1.n) {
|
|
33022
|
+
case 0:
|
|
33023
|
+
if (!(!signerData || _typeof(signerData) !== "object" || Object.keys(signerData).length === 0)) {
|
|
33024
|
+
_context1.n = 1;
|
|
33025
|
+
break;
|
|
33026
|
+
}
|
|
33027
|
+
throw new ApacuanaAPIError("Signer data (signerData) is required and must be a non-empty object.", 400, "INVALID_PARAMETER");
|
|
33028
|
+
case 1:
|
|
33029
|
+
_getConfig4 = getConfig(), integrationType = _getConfig4.integrationType;
|
|
33030
|
+
if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
|
|
33031
|
+
_context1.n = 2;
|
|
33032
|
+
break;
|
|
33033
|
+
}
|
|
33034
|
+
return _context1.a(2, addSignerOnBoarding(signerData));
|
|
33035
|
+
case 2:
|
|
33036
|
+
if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
|
|
33037
|
+
_context1.n = 3;
|
|
33038
|
+
break;
|
|
33039
|
+
}
|
|
33040
|
+
return _context1.a(2, addSignerOnPremise());
|
|
33041
|
+
case 3:
|
|
33042
|
+
throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
|
|
33043
|
+
case 4:
|
|
33044
33044
|
return _context1.a(2);
|
|
33045
33045
|
}
|
|
33046
|
-
}, _callee1
|
|
33046
|
+
}, _callee1);
|
|
33047
33047
|
}));
|
|
33048
|
-
return function
|
|
33048
|
+
return function addSigner(_x5) {
|
|
33049
33049
|
return _ref1.apply(this, arguments);
|
|
33050
33050
|
};
|
|
33051
33051
|
}();
|
|
33052
33052
|
|
|
33053
33053
|
/**
|
|
33054
|
-
*
|
|
33055
|
-
* @param {
|
|
33056
|
-
* @returns {Promise<
|
|
33057
|
-
* @throws {ApacuanaAPIError}
|
|
33054
|
+
* Obtiene una lista de documentos basada en los filtros especificados.
|
|
33055
|
+
* @param {GetDocsParams} data - Objeto con parámetros de paginación y filtros.
|
|
33056
|
+
* @returns {Promise<GetDocsResponse>} Una promesa que resuelve a un objeto con la lista de documentos.
|
|
33057
|
+
* @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.
|
|
33058
33058
|
*/
|
|
33059
33059
|
var getDocs = /*#__PURE__*/function () {
|
|
33060
33060
|
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(data) {
|