apacuana-sdk-core 0.12.0 → 0.14.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 (49) hide show
  1. package/README.md +131 -164
  2. package/coverage/clover.xml +386 -296
  3. package/coverage/coverage-final.json +7 -7
  4. package/coverage/lcov-report/index.html +38 -38
  5. package/coverage/lcov-report/src/api/certs.js.html +14 -8
  6. package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
  7. package/coverage/lcov-report/src/api/index.html +31 -31
  8. package/coverage/lcov-report/src/api/revocations.js.html +2 -2
  9. package/coverage/lcov-report/src/api/signatures.js.html +17 -56
  10. package/coverage/lcov-report/src/api/users.js.html +160 -13
  11. package/coverage/lcov-report/src/config/index.html +1 -1
  12. package/coverage/lcov-report/src/config/index.js.html +1 -1
  13. package/coverage/lcov-report/src/errors/index.html +1 -1
  14. package/coverage/lcov-report/src/errors/index.js.html +1 -1
  15. package/coverage/lcov-report/src/index.html +21 -21
  16. package/coverage/lcov-report/src/index.js.html +267 -63
  17. package/coverage/lcov-report/src/success/index.html +1 -1
  18. package/coverage/lcov-report/src/success/index.js.html +1 -1
  19. package/coverage/lcov-report/src/utils/constant.js.html +115 -4
  20. package/coverage/lcov-report/src/utils/helpers.js.html +286 -22
  21. package/coverage/lcov-report/src/utils/httpClient.js.html +32 -20
  22. package/coverage/lcov-report/src/utils/index.html +24 -24
  23. package/coverage/lcov.info +776 -586
  24. package/dist/api/users.d.ts +27 -21
  25. package/dist/index.d.ts +19 -42
  26. package/dist/index.js +357 -251
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +357 -251
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/types/certs.d.ts +20 -34
  31. package/dist/types/signatures.d.ts +19 -4
  32. package/dist/utils/constant.d.ts +31 -0
  33. package/dist/utils/helpers.d.ts +5 -3
  34. package/package.json +1 -1
  35. package/src/api/certs.js +4 -2
  36. package/src/api/revocations.js +1 -1
  37. package/src/api/signatures.js +8 -21
  38. package/src/api/users.js +51 -2
  39. package/src/index.js +113 -45
  40. package/src/types/certs.js +36 -25
  41. package/src/types/signatures.js +6 -1
  42. package/src/utils/constant.js +37 -0
  43. package/src/utils/helpers.js +100 -12
  44. package/src/utils/httpClient.js +16 -12
  45. package/tests/api/certs.test.js +11 -3
  46. package/tests/api/revocations.test.js +1 -1
  47. package/tests/api/signatures.test.js +73 -16
  48. package/tests/api/users.test.js +1 -1
  49. package/tests/index.test.js +3 -2
@@ -1,4 +1,5 @@
1
- export default getCustomer;
1
+ export function getCustomer(): Promise<GetCustomerResponse>;
2
+ export function createApacuanaUser(userData: CreateUserPayload): Promise<ApacuanaSuccess>;
2
3
  export type GetCustomerData = {
3
4
  /**
4
5
  * - El token de sesión del usuario.
@@ -19,23 +20,28 @@ export type GetCustomerResponse = {
19
20
  */
20
21
  data: GetCustomerData;
21
22
  };
22
- /**
23
- * @typedef {object} GetCustomerData
24
- * @property {string} token - El token de sesión del usuario.
25
- * @property {object} userData - Los datos del usuario obtenidos.
26
- */
27
- /**
28
- * @typedef {object} GetCustomerResponse
29
- * @property {true} success - Indica que la operación fue exitosa.
30
- * @property {GetCustomerData} data - El payload de la respuesta.
31
- */
32
- /**
33
- * Obtiene el token de un usuario a través de una petición POST.
34
- * Este método es útil para endpoints que requieren datos en el cuerpo de la petición
35
- * para buscar un usuario, como un ID de sesión o un token de acceso.
36
- *
37
- * @returns {Promise<GetCustomerResponse>} Una promesa que resuelve a un objeto con la respuesta exitosa.
38
- * @throws {Error} Si los parámetros de entrada son inválidos.
39
- * @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
40
- */
41
- declare function getCustomer(): Promise<GetCustomerResponse>;
23
+ export type CreateUserPayload = {
24
+ /**
25
+ * - Correo electrónico del usuario.
26
+ */
27
+ usr: string;
28
+ /**
29
+ * - Contraseña del usuario.
30
+ */
31
+ pwd: string;
32
+ /**
33
+ * - Tipo de documento de identidad (ej. 'V', 'P', 'E').
34
+ */
35
+ kinddoc: string;
36
+ /**
37
+ * - Número de documento de identidad.
38
+ */
39
+ doc: string;
40
+ };
41
+ export type CreateUserResponse = {
42
+ /**
43
+ * - Mensaje de confirmación de la creación del usuario.
44
+ */
45
+ message: string;
46
+ };
47
+ import ApacuanaSuccess from "../success";
package/dist/index.d.ts CHANGED
@@ -1,48 +1,25 @@
1
1
  export default apacuana;
2
2
  declare namespace apacuana {
3
- export function init(config: {
4
- apiUrl: string;
5
- secretKey: string;
6
- apiKey: string;
7
- verificationId: string;
8
- customerId: string;
9
- integrationType: string;
10
- }): Promise<object>;
3
+ export function init(config: any): Promise<ApacuanaSuccess>;
4
+ export function requestRevocation(data: any): Promise<import("./types/revocations").RequestRevocationResponse>;
5
+ export function getRevocationReasons(): Promise<import("./types/revocations").GetRevocationReasonsResponse>;
6
+ export function generateCert(data: any): Promise<any>;
7
+ export function getCertStatus(isCertificateInDevice: any): any;
8
+ export function getCertTypes(): Promise<any>;
9
+ export function getRequerimentsByTypeUser(data: any): Promise<any>;
10
+ export function addSigner(data: any): Promise<import("./types/signatures").AddSignerResponse>;
11
+ export function deleteSignatureVariant(): Promise<object>;
12
+ export function getDigest(data: any): Promise<import("./types/signatures").GetDigestResponse>;
13
+ export function getDocs(data: any): Promise<import("./types/signatures").GetDocsResponse>;
14
+ export function getSignatureVariant(): Promise<object>;
15
+ export function signDocument(data: any): Promise<object>;
16
+ export function uploadSignatureVariant(data: any): Promise<object>;
17
+ export function getCustomer(): Promise<import("./api/users").GetCustomerResponse>;
18
+ export function createFaceLivenessSession(): Promise<import("./types/faceLiveness").CreateFaceLivenessSessionResponse>;
19
+ export function createApacuanaUser(data: any): Promise<ApacuanaSuccess>;
20
+ export function validateFaceLiveness(data: any): Promise<ApacuanaSuccess>;
11
21
  export function close(): void;
12
22
  export { getConfig };
13
- export { requestRevocation };
14
- export { getCertStatus };
15
- export { getCustomer };
16
- export { addSigner };
17
- export { getDocs };
18
- export { generateCert };
19
- export { signDocument };
20
- export { getDigest };
21
- export { getRevocationReasons };
22
- export { uploadSignatureVariant };
23
- export { getSignatureVariant };
24
- export { deleteSignatureVariant };
25
- export { getCertTypes };
26
- export { getRequerimentsByTypeUser };
27
- export { createFaceLivenessSession };
28
- export { validateFaceLiveness };
29
- export { requestCertificate };
30
23
  }
24
+ import ApacuanaSuccess from "./success/index";
31
25
  import { getConfig } from "./config/index";
32
- import { requestRevocation } from "./api/revocations";
33
- import { getCertStatus } from "./api/certs";
34
- import getCustomer from "./api/users";
35
- import { addSigner } from "./api/signatures";
36
- import { getDocs } from "./api/signatures";
37
- import { generateCert } from "./api/certs";
38
- import { signDocument } from "./api/signatures";
39
- import { getDigest } from "./api/signatures";
40
- import { getRevocationReasons } from "./api/revocations";
41
- import { uploadSignatureVariant } from "./api/signatures";
42
- import { getSignatureVariant } from "./api/signatures";
43
- import { deleteSignatureVariant } from "./api/signatures";
44
- import { getCertTypes } from "./api/certs";
45
- import { getRequerimentsByTypeUser } from "./api/certs";
46
- import { createFaceLivenessSession } from "./api/faceLiveness";
47
- import { validateFaceLiveness } from "./api/faceLiveness";
48
- import { requestCertificate } from "./api/certs";