apacuana-sdk-core 1.26.8 → 1.26.10

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 (34) hide show
  1. package/README.md +28 -0
  2. package/coverage/clover.xml +50 -36
  3. package/coverage/coverage-final.json +4 -4
  4. package/coverage/lcov-report/index.html +25 -25
  5. package/coverage/lcov-report/src/api/certs.js.html +1 -1
  6. package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
  7. package/coverage/lcov-report/src/api/index.html +18 -18
  8. package/coverage/lcov-report/src/api/revocations.js.html +1 -1
  9. package/coverage/lcov-report/src/api/signatures.js.html +1 -1
  10. package/coverage/lcov-report/src/api/users.js.html +127 -10
  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 +8 -8
  15. package/coverage/lcov-report/src/index.html +14 -14
  16. package/coverage/lcov-report/src/index.js.html +24 -9
  17. package/coverage/lcov-report/src/success/index.html +1 -1
  18. package/coverage/lcov-report/src/success/index.js.html +5 -5
  19. package/coverage/lcov-report/src/utils/constant.js.html +1 -1
  20. package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
  21. package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
  22. package/coverage/lcov-report/src/utils/index.html +1 -1
  23. package/coverage/lcov.info +98 -65
  24. package/dist/api/users.d.ts +5 -1
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +78 -16
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +78 -16
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/src/api/users.js +39 -0
  32. package/src/index.js +6 -1
  33. package/tests/api/users.test.js +68 -1
  34. package/tests/integration/searchCustomer.test.js +75 -0
@@ -101,7 +101,7 @@
101
101
  <div class='footer quiet pad2 space-top1 center small'>
102
102
  Code coverage generated by
103
103
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
- at 2026-06-23T18:15:51.091Z
104
+ at 2026-07-08T16:18:41.551Z
105
105
  </div>
106
106
  <script src="../../prettify.js"></script>
107
107
  <script>
@@ -72,10 +72,10 @@
72
72
  <a name='L7'></a><a href='#L7'>7</a>
73
73
  <a name='L8'></a><a href='#L8'>8</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
74
74
  <span class="cline-any cline-neutral">&nbsp;</span>
75
- <span class="cline-any cline-yes">23x</span>
76
- <span class="cline-any cline-yes">23x</span>
77
- <span class="cline-any cline-yes">23x</span>
78
- <span class="cline-any cline-yes">23x</span>
75
+ <span class="cline-any cline-yes">26x</span>
76
+ <span class="cline-any cline-yes">26x</span>
77
+ <span class="cline-any cline-yes">26x</span>
78
+ <span class="cline-any cline-yes">26x</span>
79
79
  <span class="cline-any cline-neutral">&nbsp;</span>
80
80
  <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">export default class ApacuanaSuccess {
81
81
  constructor(data, statusCode = 200) {
@@ -91,7 +91,7 @@
91
91
  <div class='footer quiet pad2 space-top1 center small'>
92
92
  Code coverage generated by
93
93
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
94
- at 2026-06-23T18:15:51.091Z
94
+ at 2026-07-08T16:18:41.551Z
95
95
  </div>
96
96
  <script src="../../prettify.js"></script>
97
97
  <script>
@@ -247,7 +247,7 @@ export const INTEGRATION_TYPE = {
247
247
  <div class='footer quiet pad2 space-top1 center small'>
248
248
  Code coverage generated by
249
249
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
250
- at 2026-06-23T18:15:51.091Z
250
+ at 2026-07-08T16:18:41.551Z
251
251
  </div>
252
252
  <script src="../../prettify.js"></script>
253
253
  <script>
@@ -1471,7 +1471,7 @@ export default {
1471
1471
  <div class='footer quiet pad2 space-top1 center small'>
1472
1472
  Code coverage generated by
1473
1473
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
1474
- at 2026-06-23T18:15:51.091Z
1474
+ at 2026-07-08T16:18:41.551Z
1475
1475
  </div>
1476
1476
  <script src="../../prettify.js"></script>
1477
1477
  <script>
@@ -649,7 +649,7 @@ export const httpRequest = <span class="fstat-no" title="function not covered" >
649
649
  <div class='footer quiet pad2 space-top1 center small'>
650
650
  Code coverage generated by
651
651
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
652
- at 2026-06-23T18:15:51.091Z
652
+ at 2026-07-08T16:18:41.551Z
653
653
  </div>
654
654
  <script src="../../prettify.js"></script>
655
655
  <script>
@@ -131,7 +131,7 @@
131
131
  <div class='footer quiet pad2 space-top1 center small'>
132
132
  Code coverage generated by
133
133
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
134
- at 2026-06-23T18:15:51.091Z
134
+ at 2026-07-08T16:18:41.551Z
135
135
  </div>
136
136
  <script src="../../prettify.js"></script>
137
137
  <script>
@@ -19,11 +19,12 @@ FN:148,(anonymous_15)
19
19
  FN:152,(anonymous_16)
20
20
  FN:157,(anonymous_17)
21
21
  FN:162,(anonymous_18)
22
- FN:166,(anonymous_19)
22
+ FN:167,(anonymous_19)
23
23
  FN:171,(anonymous_20)
24
- FN:175,(anonymous_21)
24
+ FN:176,(anonymous_21)
25
25
  FN:180,(anonymous_22)
26
- FNF:23
26
+ FN:185,(anonymous_23)
27
+ FNF:24
27
28
  FNH:1
28
29
  FNDA:0,(anonymous_0)
29
30
  FNDA:4,(anonymous_1)
@@ -48,6 +49,7 @@ FNDA:0,(anonymous_19)
48
49
  FNDA:0,(anonymous_20)
49
50
  FNDA:0,(anonymous_21)
50
51
  FNDA:0,(anonymous_22)
52
+ FNDA:0,(anonymous_23)
51
53
  DA:33,1
52
54
  DA:34,0
53
55
  DA:36,0
@@ -104,14 +106,16 @@ DA:158,0
104
106
  DA:159,0
105
107
  DA:163,0
106
108
  DA:164,0
107
- DA:167,0
108
109
  DA:168,0
110
+ DA:169,0
109
111
  DA:172,0
110
112
  DA:173,0
111
- DA:176,0
112
113
  DA:177,0
113
- DA:180,0
114
- LF:63
114
+ DA:178,0
115
+ DA:181,0
116
+ DA:182,0
117
+ DA:185,0
118
+ LF:65
115
119
  LH:15
116
120
  BRDA:33,0,0,0
117
121
  BRDA:36,1,0,0
@@ -836,13 +840,15 @@ end_of_record
836
840
  TN:
837
841
  SF:src/api/users.js
838
842
  FN:27,(anonymous_0)
839
- FN:92,(anonymous_1)
840
- FN:95,(anonymous_2)
841
- FNF:3
842
- FNH:1
843
+ FN:100,(anonymous_1)
844
+ FN:131,(anonymous_2)
845
+ FN:134,(anonymous_3)
846
+ FNF:4
847
+ FNH:2
843
848
  FNDA:5,(anonymous_0)
844
- FNDA:0,(anonymous_1)
849
+ FNDA:6,(anonymous_1)
845
850
  FNDA:0,(anonymous_2)
851
+ FNDA:0,(anonymous_3)
846
852
  DA:27,2
847
853
  DA:28,5
848
854
  DA:30,5
@@ -856,23 +862,35 @@ DA:58,1
856
862
  DA:63,3
857
863
  DA:64,2
858
864
  DA:66,1
859
- DA:92,2
860
- DA:93,0
861
- DA:94,0
862
- DA:95,0
863
- DA:96,0
864
- DA:98,0
865
- DA:103,0
866
- DA:104,0
867
- DA:105,0
868
- DA:106,0
869
- DA:110,0
870
- DA:116,0
871
- DA:120,0
872
- DA:121,0
873
- DA:123,0
874
- LF:28
875
- LH:14
865
+ DA:100,2
866
+ DA:101,6
867
+ DA:102,1
868
+ DA:109,5
869
+ DA:110,5
870
+ DA:111,5
871
+ DA:113,5
872
+ DA:114,5
873
+ DA:120,3
874
+ DA:122,2
875
+ DA:123,1
876
+ DA:125,1
877
+ DA:131,2
878
+ DA:132,0
879
+ DA:133,0
880
+ DA:134,0
881
+ DA:135,0
882
+ DA:137,0
883
+ DA:142,0
884
+ DA:143,0
885
+ DA:144,0
886
+ DA:145,0
887
+ DA:149,0
888
+ DA:155,0
889
+ DA:159,0
890
+ DA:160,0
891
+ DA:162,0
892
+ LF:40
893
+ LH:26
876
894
  BRDA:30,0,0,1
877
895
  BRDA:30,0,1,4
878
896
  BRDA:30,1,0,5
@@ -885,25 +903,40 @@ BRDA:63,4,0,2
885
903
  BRDA:63,4,1,1
886
904
  BRDA:67,5,0,1
887
905
  BRDA:67,5,1,0
888
- BRDA:98,6,0,0
889
- BRDA:98,6,1,0
890
- BRDA:98,6,2,0
891
- BRDA:98,6,3,0
892
- BRDA:98,6,4,0
893
- BRDA:103,7,0,0
894
- BRDA:103,7,1,0
895
- BRDA:103,8,0,0
896
- BRDA:103,8,1,0
897
- BRDA:105,9,0,0
898
- BRDA:105,9,1,0
899
- BRDA:105,10,0,0
900
- BRDA:105,10,1,0
901
- BRDA:120,11,0,0
902
- BRDA:120,11,1,0
903
- BRDA:124,12,0,0
904
- BRDA:124,12,1,0
905
- BRF:29
906
- BRH:11
906
+ BRDA:100,6,0,0
907
+ BRDA:101,7,0,1
908
+ BRDA:101,7,1,5
909
+ BRDA:101,8,0,6
910
+ BRDA:101,8,1,4
911
+ BRDA:110,9,0,2
912
+ BRDA:110,9,1,3
913
+ BRDA:111,10,0,4
914
+ BRDA:111,10,1,1
915
+ BRDA:120,11,0,3
916
+ BRDA:120,11,1,1
917
+ BRDA:122,12,0,1
918
+ BRDA:122,12,1,1
919
+ BRDA:126,13,0,1
920
+ BRDA:126,13,1,0
921
+ BRDA:137,14,0,0
922
+ BRDA:137,14,1,0
923
+ BRDA:137,14,2,0
924
+ BRDA:137,14,3,0
925
+ BRDA:137,14,4,0
926
+ BRDA:142,15,0,0
927
+ BRDA:142,15,1,0
928
+ BRDA:142,16,0,0
929
+ BRDA:142,16,1,0
930
+ BRDA:144,17,0,0
931
+ BRDA:144,17,1,0
932
+ BRDA:144,18,0,0
933
+ BRDA:144,18,1,0
934
+ BRDA:159,19,0,0
935
+ BRDA:159,19,1,0
936
+ BRDA:163,20,0,0
937
+ BRDA:163,20,1,0
938
+ BRF:44
939
+ BRH:24
907
940
  end_of_record
908
941
  TN:
909
942
  SF:src/config/index.js
@@ -946,19 +979,19 @@ SF:src/errors/index.js
946
979
  FN:7,(anonymous_0)
947
980
  FNF:1
948
981
  FNH:1
949
- FNDA:121,(anonymous_0)
950
- DA:8,121
951
- DA:9,121
952
- DA:10,121
953
- DA:11,121
954
- DA:12,121
955
- DA:15,121
956
- DA:16,121
982
+ FNDA:124,(anonymous_0)
983
+ DA:8,124
984
+ DA:9,124
985
+ DA:10,124
986
+ DA:11,124
987
+ DA:12,124
988
+ DA:15,124
989
+ DA:16,124
957
990
  LF:7
958
991
  LH:7
959
- BRDA:7,0,0,13
960
- BRDA:7,1,0,13
961
- BRDA:15,2,0,121
992
+ BRDA:7,0,0,14
993
+ BRDA:7,1,0,14
994
+ BRDA:15,2,0,124
962
995
  BRDA:15,2,1,0
963
996
  BRF:4
964
997
  BRH:3
@@ -968,14 +1001,14 @@ SF:src/success/index.js
968
1001
  FN:2,(anonymous_0)
969
1002
  FNF:1
970
1003
  FNH:1
971
- FNDA:23,(anonymous_0)
972
- DA:3,23
973
- DA:4,23
974
- DA:5,23
975
- DA:6,23
1004
+ FNDA:26,(anonymous_0)
1005
+ DA:3,26
1006
+ DA:4,26
1007
+ DA:5,26
1008
+ DA:6,26
976
1009
  LF:4
977
1010
  LH:4
978
- BRDA:2,0,0,23
1011
+ BRDA:2,0,0,26
979
1012
  BRF:1
980
1013
  BRH:1
981
1014
  end_of_record
@@ -1,5 +1,9 @@
1
1
  export function getCustomer(): Promise<GetCustomerResponse>;
2
- export function createApacuanaUser(userData: CreateUserPayload): Promise<ApacuanaSuccess>;
2
+ export function searchCustomer({ email, doc }?: {
3
+ email?: string | undefined;
4
+ doc?: string | undefined;
5
+ }): Promise<ApacuanaSuccess>;
6
+ export function createApacuanaUser(userData: any): Promise<ApacuanaSuccess>;
3
7
  export type GetCustomerData = {
4
8
  /**
5
9
  * - El token de sesión del usuario.
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ declare namespace apacuana {
17
17
  export function signDocument(data: any): Promise<object>;
18
18
  export function uploadSignatureVariant(data: any): Promise<object>;
19
19
  export function getCustomer(): Promise<import("./api/users").GetCustomerResponse>;
20
+ export function searchCustomer(data: any): Promise<ApacuanaSuccess>;
20
21
  export function createApacuanaUser(data: any): Promise<ApacuanaSuccess>;
21
22
  export function sendFaceLiveness(data: any): Promise<ApacuanaSuccess>;
22
23
  export function createDocument(data: any): Promise<object>;
package/dist/index.js CHANGED
@@ -33193,13 +33193,71 @@ var getCustomer = /*#__PURE__*/function () {
33193
33193
  * @throws {ApacuanaAPIError} Si los datos de entrada son inválidos o si ocurre un error en la API.
33194
33194
  */
33195
33195
 
33196
- var createApacuanaUser = /*#__PURE__*/function () {
33197
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(userData) {
33198
- var formData, response, _t2;
33196
+ /**
33197
+ * Busca clientes en el flujo de onboarding por correo y/o cédula.
33198
+ * @param {object} params
33199
+ * @param {string} [params.email] - Correo electrónico a buscar.
33200
+ * @param {string} [params.doc] - Número de cédula a buscar.
33201
+ * @returns {Promise<ApacuanaSuccess>} Resuelve con `{ customer }`, el registro del cliente encontrado.
33202
+ * @throws {ApacuanaAPIError} Si la búsqueda es inválida o la API falla.
33203
+ */
33204
+ var searchCustomer = /*#__PURE__*/function () {
33205
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
33206
+ var _ref3,
33207
+ email,
33208
+ doc,
33209
+ params,
33210
+ _response$entry,
33211
+ response,
33212
+ _args2 = arguments,
33213
+ _t2;
33199
33214
  return _regenerator().w(function (_context2) {
33200
33215
  while (1) switch (_context2.p = _context2.n) {
33201
33216
  case 0:
33202
- _context2.p = 0;
33217
+ _ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, email = _ref3.email, doc = _ref3.doc;
33218
+ if (!(!email && !doc)) {
33219
+ _context2.n = 1;
33220
+ break;
33221
+ }
33222
+ throw new ApacuanaAPIError("At least one of 'email' or 'doc' is required.", 400, "INVALID_SEARCH_QUERY");
33223
+ case 1:
33224
+ params = {};
33225
+ if (email) params.email = email;
33226
+ if (doc) params.doc = doc;
33227
+ _context2.p = 2;
33228
+ _context2.n = 3;
33229
+ return httpRequest("services/api/onboardingclient/searchcustomers", params, "GET");
33230
+ case 3:
33231
+ response = _context2.v;
33232
+ return _context2.a(2, new ApacuanaSuccess({
33233
+ customer: (_response$entry = response.entry) !== null && _response$entry !== void 0 ? _response$entry : null
33234
+ }));
33235
+ case 4:
33236
+ _context2.p = 4;
33237
+ _t2 = _context2.v;
33238
+ if (!(_t2 instanceof ApacuanaAPIError)) {
33239
+ _context2.n = 5;
33240
+ break;
33241
+ }
33242
+ throw _t2;
33243
+ case 5:
33244
+ throw new ApacuanaAPIError("Unexpected failure searching customer: ".concat(_t2.message || "Unknown error"));
33245
+ case 6:
33246
+ return _context2.a(2);
33247
+ }
33248
+ }, _callee2, null, [[2, 4]]);
33249
+ }));
33250
+ return function searchCustomer() {
33251
+ return _ref2.apply(this, arguments);
33252
+ };
33253
+ }();
33254
+ var createApacuanaUser = /*#__PURE__*/function () {
33255
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(userData) {
33256
+ var formData, response, _t3;
33257
+ return _regenerator().w(function (_context3) {
33258
+ while (1) switch (_context3.p = _context3.n) {
33259
+ case 0:
33260
+ _context3.p = 0;
33203
33261
  formData = new FormData();
33204
33262
  Object.keys(userData).forEach(function (key) {
33205
33263
  var value = userData[key];
@@ -33210,28 +33268,28 @@ var createApacuanaUser = /*#__PURE__*/function () {
33210
33268
  formData.append(key, String(value));
33211
33269
  }
33212
33270
  });
33213
- _context2.n = 1;
33271
+ _context3.n = 1;
33214
33272
  return httpRequest("services/api/register/initial", formData, "POST");
33215
33273
  case 1:
33216
- response = _context2.v;
33217
- return _context2.a(2, new ApacuanaSuccess(_objectSpread2({}, response)));
33274
+ response = _context3.v;
33275
+ return _context3.a(2, new ApacuanaSuccess(_objectSpread2({}, response)));
33218
33276
  case 2:
33219
- _context2.p = 2;
33220
- _t2 = _context2.v;
33221
- if (!(_t2 instanceof ApacuanaAPIError)) {
33222
- _context2.n = 3;
33277
+ _context3.p = 2;
33278
+ _t3 = _context3.v;
33279
+ if (!(_t3 instanceof ApacuanaAPIError)) {
33280
+ _context3.n = 3;
33223
33281
  break;
33224
33282
  }
33225
- throw _t2;
33283
+ throw _t3;
33226
33284
  case 3:
33227
- throw new ApacuanaAPIError("Unexpected failure creating user: ".concat(_t2.message || "Unknown error"));
33285
+ throw new ApacuanaAPIError("Unexpected failure creating user: ".concat(_t3.message || "Unknown error"));
33228
33286
  case 4:
33229
- return _context2.a(2);
33287
+ return _context3.a(2);
33230
33288
  }
33231
- }, _callee2, null, [[0, 2]]);
33289
+ }, _callee3, null, [[0, 2]]);
33232
33290
  }));
33233
33291
  return function createApacuanaUser(_x) {
33234
- return _ref2.apply(this, arguments);
33292
+ return _ref4.apply(this, arguments);
33235
33293
  };
33236
33294
  }();
33237
33295
 
@@ -34890,6 +34948,10 @@ var apacuana = {
34890
34948
  checkSdk(true);
34891
34949
  return getCustomer();
34892
34950
  },
34951
+ searchCustomer: function searchCustomer$1(data) {
34952
+ checkSdk(false);
34953
+ return searchCustomer(data);
34954
+ },
34893
34955
  createApacuanaUser: function createApacuanaUser$1(data) {
34894
34956
  checkSdk(false);
34895
34957
  return createApacuanaUser(data);