apacuana-sdk-core 1.26.10 → 1.27.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 (34) hide show
  1. package/README.md +19 -11
  2. package/coverage/clover.xml +102 -87
  3. package/coverage/coverage-final.json +4 -4
  4. package/coverage/lcov-report/index.html +27 -27
  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 +158 -32
  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 +15 -15
  16. package/coverage/lcov-report/src/index.js.html +39 -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 +203 -170
  24. package/dist/api/users.d.ts +4 -0
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +144 -45
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +144 -45
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/src/api/users.js +57 -15
  32. package/src/index.js +11 -1
  33. package/tests/api/users.test.js +122 -3
  34. package/tests/integration/searchCustomer.test.js +14 -5
package/README.md CHANGED
@@ -69,6 +69,7 @@ El SDK puede inicializarse sin el parámetro `customerId`, lo que permite el acc
69
69
  - `lockDocument(documentId)`
70
70
  - `deleteSignature(params)`
71
71
  - `searchCustomer(params)`
72
+ - `findCustomers(params)`
72
73
 
73
74
  **Funciones privadas (requieren `customerId`):**
74
75
 
@@ -171,7 +172,7 @@ const result = await apacuana.getCustomer();
171
172
 
172
173
  ### `searchCustomer(params)`
173
174
 
174
- Busca un cliente en el flujo de onboarding por correo electrónico y/o cédula. Es una función pública (no requiere `customerId`). Debe recibir al menos uno de los dos campos; si no, lanza un `ApacuanaAPIError` con código `INVALID_SEARCH_QUERY`. El resultado viene en `data.customer`, con el registro del cliente ya desanidado, o `null` si no hay coincidencia.
175
+ Busca UN cliente en el flujo de onboarding por correo electrónico y/o cédula. Es una función pública (no requiere `customerId`). Debe recibir al menos uno de los dos campos; si no, lanza un `ApacuanaAPIError` con código `INVALID_SEARCH_QUERY`. La API puede responder con un solo registro (`entry`) o con varios (`entries`); en ambos casos, el resultado viene en `data.customer` con el primer match, o `null` si no hay ninguno. Si hay varias coincidencias y necesitas verlas todas, usa [`findCustomers`](#findcustomersparams).
175
176
 
176
177
  #### Parámetros:
177
178
 
@@ -181,19 +182,26 @@ Busca un cliente en el flujo de onboarding por correo electrónico y/o cédula.
181
182
  #### Ejemplo:
182
183
 
183
184
  ```js
184
- // Por email
185
- const byEmail = await apacuana.searchCustomer({ email: "samuel_dear@hotmail.com" });
185
+ const result = await apacuana.searchCustomer({ email: "samuel_dear@hotmail.com" });
186
186
 
187
- // Por cédula
188
- const byDoc = await apacuana.searchCustomer({ doc: "28152139" });
187
+ result.data.customer; // datos del primer cliente encontrado, o null si no hay match
188
+ ```
189
189
 
190
- // Combinado
191
- const result = await apacuana.searchCustomer({
192
- email: "samuel_dear@hotmail.com",
193
- doc: "28152139",
194
- });
190
+ ### `findCustomers(params)`
191
+
192
+ Igual que `searchCustomer`, pero devuelve **todas** las coincidencias en vez de solo la primera. Misma validación de parámetros y mismo endpoint; el resultado viene en `data.customers`, un array (`[]` si no hay ninguna coincidencia).
193
+
194
+ #### Parámetros:
195
+
196
+ - `email` (string, opcional): Correo electrónico a buscar.
197
+ - `doc` (string, opcional): Número de cédula a buscar.
198
+
199
+ #### Ejemplo:
200
+
201
+ ```js
202
+ const result = await apacuana.findCustomers({ email: "samuel_dear@hotmail.com" });
195
203
 
196
- result.data.customer; // datos del cliente, o null si no hay match
204
+ result.data.customers; // array con todas las coincidencias ([] si no hay ninguna)
197
205
  ```
198
206
 
199
207
  ### `generateCert(params)`
@@ -1,80 +1,82 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1783527521589" clover="3.2.0">
3
- <project timestamp="1783527521589" name="All files">
4
- <metrics statements="681" coveredstatements="393" conditionals="511" coveredconditionals="190" methods="111" coveredmethods="59" elements="1303" coveredelements="642" complexity="0" loc="681" ncloc="681" packages="6" files="12" classes="12"/>
2
+ <coverage generated="1788886558886" clover="3.2.0">
3
+ <project timestamp="1788886558887" name="All files">
4
+ <metrics statements="696" coveredstatements="406" conditionals="523" coveredconditionals="199" methods="114" coveredmethods="61" elements="1333" coveredelements="666" complexity="0" loc="696" ncloc="696" packages="6" files="12" classes="12"/>
5
5
  <package name="src">
6
- <metrics statements="65" coveredstatements="15" conditionals="15" coveredconditionals="3" methods="24" coveredmethods="1"/>
6
+ <metrics statements="67" coveredstatements="15" conditionals="15" coveredconditionals="3" methods="25" coveredmethods="1"/>
7
7
  <file name="index.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/index.js">
8
- <metrics statements="65" coveredstatements="15" conditionals="15" coveredconditionals="3" methods="24" coveredmethods="1"/>
9
- <line num="33" count="1" type="cond" truecount="0" falsecount="1"/>
10
- <line num="34" count="0" type="stmt"/>
11
- <line num="36" count="0" type="cond" truecount="0" falsecount="4"/>
12
- <line num="37" count="0" type="stmt"/>
13
- <line num="44" count="0" type="cond" truecount="0" falsecount="4"/>
14
- <line num="45" count="0" type="stmt"/>
15
- <line num="53" count="1" type="stmt"/>
16
- <line num="58" count="4" type="stmt"/>
17
- <line num="59" count="4" type="stmt"/>
18
- <line num="60" count="3" type="stmt"/>
19
- <line num="61" count="3" type="stmt"/>
20
- <line num="63" count="3" type="cond" truecount="1" falsecount="1"/>
21
- <line num="64" count="3" type="stmt"/>
22
- <line num="65" count="2" type="stmt"/>
23
- <line num="66" count="2" type="stmt"/>
24
- <line num="67" count="2" type="stmt"/>
25
- <line num="68" count="2" type="stmt"/>
26
- <line num="74" count="0" type="stmt"/>
27
- <line num="79" count="2" type="stmt"/>
28
- <line num="80" count="2" type="cond" truecount="1" falsecount="1"/>
29
- <line num="81" count="0" type="stmt"/>
30
- <line num="83" count="2" type="stmt"/>
31
- <line num="93" count="0" type="stmt"/>
32
- <line num="94" count="0" type="stmt"/>
33
- <line num="97" count="0" type="stmt"/>
8
+ <metrics statements="67" coveredstatements="15" conditionals="15" coveredconditionals="3" methods="25" coveredmethods="1"/>
9
+ <line num="38" count="1" type="cond" truecount="0" falsecount="1"/>
10
+ <line num="39" count="0" type="stmt"/>
11
+ <line num="41" count="0" type="cond" truecount="0" falsecount="4"/>
12
+ <line num="42" count="0" type="stmt"/>
13
+ <line num="49" count="0" type="cond" truecount="0" falsecount="4"/>
14
+ <line num="50" count="0" type="stmt"/>
15
+ <line num="58" count="1" type="stmt"/>
16
+ <line num="63" count="4" type="stmt"/>
17
+ <line num="64" count="4" type="stmt"/>
18
+ <line num="65" count="3" type="stmt"/>
19
+ <line num="66" count="3" type="stmt"/>
20
+ <line num="68" count="3" type="cond" truecount="1" falsecount="1"/>
21
+ <line num="69" count="3" type="stmt"/>
22
+ <line num="70" count="2" type="stmt"/>
23
+ <line num="71" count="2" type="stmt"/>
24
+ <line num="72" count="2" type="stmt"/>
25
+ <line num="73" count="2" type="stmt"/>
26
+ <line num="79" count="0" type="stmt"/>
27
+ <line num="84" count="2" type="stmt"/>
28
+ <line num="85" count="2" type="cond" truecount="1" falsecount="1"/>
29
+ <line num="86" count="0" type="stmt"/>
30
+ <line num="88" count="2" type="stmt"/>
34
31
  <line num="98" count="0" type="stmt"/>
32
+ <line num="99" count="0" type="stmt"/>
33
+ <line num="102" count="0" type="stmt"/>
35
34
  <line num="103" count="0" type="stmt"/>
36
- <line num="104" count="0" type="stmt"/>
37
- <line num="107" count="0" type="stmt"/>
38
35
  <line num="108" count="0" type="stmt"/>
39
- <line num="111" count="0" type="stmt"/>
36
+ <line num="109" count="0" type="stmt"/>
40
37
  <line num="112" count="0" type="stmt"/>
41
- <line num="115" count="0" type="stmt"/>
38
+ <line num="113" count="0" type="stmt"/>
42
39
  <line num="116" count="0" type="stmt"/>
40
+ <line num="117" count="0" type="stmt"/>
41
+ <line num="120" count="0" type="stmt"/>
43
42
  <line num="121" count="0" type="stmt"/>
44
- <line num="122" count="0" type="stmt"/>
45
- <line num="125" count="0" type="stmt"/>
46
43
  <line num="126" count="0" type="stmt"/>
47
- <line num="129" count="0" type="stmt"/>
44
+ <line num="127" count="0" type="stmt"/>
48
45
  <line num="130" count="0" type="stmt"/>
49
- <line num="133" count="0" type="stmt"/>
46
+ <line num="131" count="0" type="stmt"/>
50
47
  <line num="134" count="0" type="stmt"/>
51
- <line num="137" count="0" type="stmt"/>
48
+ <line num="135" count="0" type="stmt"/>
52
49
  <line num="138" count="0" type="stmt"/>
53
- <line num="141" count="0" type="stmt"/>
50
+ <line num="139" count="0" type="stmt"/>
54
51
  <line num="142" count="0" type="stmt"/>
55
- <line num="145" count="0" type="stmt"/>
52
+ <line num="143" count="0" type="stmt"/>
56
53
  <line num="146" count="0" type="stmt"/>
57
- <line num="149" count="0" type="stmt"/>
54
+ <line num="147" count="0" type="stmt"/>
58
55
  <line num="150" count="0" type="stmt"/>
59
- <line num="153" count="0" type="stmt"/>
56
+ <line num="151" count="0" type="stmt"/>
60
57
  <line num="154" count="0" type="stmt"/>
58
+ <line num="155" count="0" type="stmt"/>
61
59
  <line num="158" count="0" type="stmt"/>
62
60
  <line num="159" count="0" type="stmt"/>
63
61
  <line num="163" count="0" type="stmt"/>
64
62
  <line num="164" count="0" type="stmt"/>
65
63
  <line num="168" count="0" type="stmt"/>
66
64
  <line num="169" count="0" type="stmt"/>
67
- <line num="172" count="0" type="stmt"/>
68
65
  <line num="173" count="0" type="stmt"/>
69
- <line num="177" count="0" type="stmt"/>
66
+ <line num="174" count="0" type="stmt"/>
70
67
  <line num="178" count="0" type="stmt"/>
71
- <line num="181" count="0" type="stmt"/>
68
+ <line num="179" count="0" type="stmt"/>
72
69
  <line num="182" count="0" type="stmt"/>
73
- <line num="185" count="0" type="stmt"/>
70
+ <line num="183" count="0" type="stmt"/>
71
+ <line num="187" count="0" type="stmt"/>
72
+ <line num="188" count="0" type="stmt"/>
73
+ <line num="191" count="0" type="stmt"/>
74
+ <line num="192" count="0" type="stmt"/>
75
+ <line num="195" count="0" type="stmt"/>
74
76
  </file>
75
77
  </package>
76
78
  <package name="src.api">
77
- <metrics statements="395" coveredstatements="343" conditionals="245" coveredconditionals="183" methods="59" coveredmethods="56"/>
79
+ <metrics statements="408" coveredstatements="356" conditionals="257" coveredconditionals="192" methods="61" coveredmethods="58"/>
78
80
  <file name="certs.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/api/certs.js">
79
81
  <metrics statements="80" coveredstatements="72" conditionals="38" coveredconditionals="31" methods="13" coveredmethods="13"/>
80
82
  <line num="25" count="2" type="stmt"/>
@@ -443,7 +445,7 @@
443
445
  <line num="724" count="1" type="stmt"/>
444
446
  </file>
445
447
  <file name="users.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/api/users.js">
446
- <metrics statements="40" coveredstatements="26" conditionals="44" coveredconditionals="24" methods="4" coveredmethods="2"/>
448
+ <metrics statements="53" coveredstatements="39" conditionals="56" coveredconditionals="33" methods="6" coveredmethods="4"/>
447
449
  <line num="27" count="2" type="stmt"/>
448
450
  <line num="28" count="5" type="stmt"/>
449
451
  <line num="30" count="5" type="cond" truecount="4" falsecount="0"/>
@@ -457,33 +459,46 @@
457
459
  <line num="63" count="3" type="cond" truecount="2" falsecount="0"/>
458
460
  <line num="64" count="2" type="stmt"/>
459
461
  <line num="66" count="1" type="stmt"/>
460
- <line num="100" count="2" type="cond" truecount="0" falsecount="1"/>
461
- <line num="101" count="6" type="cond" truecount="4" falsecount="0"/>
462
- <line num="102" count="1" type="stmt"/>
463
- <line num="109" count="5" type="stmt"/>
464
- <line num="110" count="5" type="cond" truecount="2" falsecount="0"/>
465
- <line num="111" count="5" type="cond" truecount="2" falsecount="0"/>
466
- <line num="113" count="5" type="stmt"/>
467
- <line num="114" count="5" type="stmt"/>
468
- <line num="120" count="3" type="cond" truecount="2" falsecount="0"/>
469
- <line num="122" count="2" type="cond" truecount="2" falsecount="0"/>
470
- <line num="123" count="1" type="stmt"/>
471
- <line num="125" count="1" type="stmt"/>
472
- <line num="131" count="2" type="stmt"/>
473
- <line num="132" count="0" type="stmt"/>
474
- <line num="133" count="0" type="stmt"/>
475
- <line num="134" count="0" type="stmt"/>
476
- <line num="135" count="0" type="stmt"/>
477
- <line num="137" count="0" type="cond" truecount="0" falsecount="5"/>
478
- <line num="142" count="0" type="cond" truecount="0" falsecount="4"/>
479
- <line num="143" count="0" type="stmt"/>
480
- <line num="144" count="0" type="cond" truecount="0" falsecount="4"/>
481
- <line num="145" count="0" type="stmt"/>
482
- <line num="149" count="0" type="stmt"/>
483
- <line num="155" count="0" type="stmt"/>
484
- <line num="159" count="0" type="cond" truecount="0" falsecount="2"/>
485
- <line num="160" count="0" type="stmt"/>
486
- <line num="162" count="0" type="stmt"/>
462
+ <line num="92" count="2" type="cond" truecount="0" falsecount="1"/>
463
+ <line num="93" count="16" type="cond" truecount="4" falsecount="0"/>
464
+ <line num="94" count="2" type="stmt"/>
465
+ <line num="101" count="14" type="stmt"/>
466
+ <line num="102" count="14" type="cond" truecount="2" falsecount="0"/>
467
+ <line num="103" count="14" type="cond" truecount="2" falsecount="0"/>
468
+ <line num="105" count="14" type="stmt"/>
469
+ <line num="117" count="10" type="cond" truecount="4" falsecount="0"/>
470
+ <line num="118" count="2" type="stmt"/>
471
+ <line num="120" count="8" type="cond" truecount="2" falsecount="0"/>
472
+ <line num="121" count="4" type="stmt"/>
473
+ <line num="134" count="2" type="cond" truecount="0" falsecount="1"/>
474
+ <line num="135" count="10" type="stmt"/>
475
+ <line num="136" count="10" type="stmt"/>
476
+ <line num="138" count="7" type="cond" truecount="2" falsecount="0"/>
477
+ <line num="140" count="3" type="cond" truecount="2" falsecount="0"/>
478
+ <line num="141" count="2" type="stmt"/>
479
+ <line num="143" count="1" type="stmt"/>
480
+ <line num="158" count="2" type="cond" truecount="0" falsecount="1"/>
481
+ <line num="159" count="6" type="stmt"/>
482
+ <line num="160" count="6" type="stmt"/>
483
+ <line num="162" count="3" type="stmt"/>
484
+ <line num="164" count="3" type="cond" truecount="2" falsecount="0"/>
485
+ <line num="165" count="2" type="stmt"/>
486
+ <line num="167" count="1" type="stmt"/>
487
+ <line num="173" count="2" type="stmt"/>
488
+ <line num="174" count="0" type="stmt"/>
489
+ <line num="175" count="0" type="stmt"/>
490
+ <line num="176" count="0" type="stmt"/>
491
+ <line num="177" count="0" type="stmt"/>
492
+ <line num="179" count="0" type="cond" truecount="0" falsecount="5"/>
493
+ <line num="184" count="0" type="cond" truecount="0" falsecount="4"/>
494
+ <line num="185" count="0" type="stmt"/>
495
+ <line num="186" count="0" type="cond" truecount="0" falsecount="4"/>
496
+ <line num="187" count="0" type="stmt"/>
497
+ <line num="191" count="0" type="stmt"/>
498
+ <line num="197" count="0" type="stmt"/>
499
+ <line num="201" count="0" type="cond" truecount="0" falsecount="2"/>
500
+ <line num="202" count="0" type="stmt"/>
501
+ <line num="204" count="0" type="stmt"/>
487
502
  </file>
488
503
  </package>
489
504
  <package name="src.config">
@@ -508,23 +523,23 @@
508
523
  <metrics statements="7" coveredstatements="7" conditionals="4" coveredconditionals="3" methods="1" coveredmethods="1"/>
509
524
  <file name="index.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/errors/index.js">
510
525
  <metrics statements="7" coveredstatements="7" conditionals="4" coveredconditionals="3" methods="1" coveredmethods="1"/>
511
- <line num="8" count="124" type="stmt"/>
512
- <line num="9" count="124" type="stmt"/>
513
- <line num="10" count="124" type="stmt"/>
514
- <line num="11" count="124" type="stmt"/>
515
- <line num="12" count="124" type="stmt"/>
516
- <line num="15" count="124" type="cond" truecount="1" falsecount="1"/>
517
- <line num="16" count="124" type="stmt"/>
526
+ <line num="8" count="127" type="stmt"/>
527
+ <line num="9" count="127" type="stmt"/>
528
+ <line num="10" count="127" type="stmt"/>
529
+ <line num="11" count="127" type="stmt"/>
530
+ <line num="12" count="127" type="stmt"/>
531
+ <line num="15" count="127" type="cond" truecount="1" falsecount="1"/>
532
+ <line num="16" count="127" type="stmt"/>
518
533
  </file>
519
534
  </package>
520
535
  <package name="src.success">
521
536
  <metrics statements="4" coveredstatements="4" conditionals="1" coveredconditionals="1" methods="1" coveredmethods="1"/>
522
537
  <file name="index.js" path="/builds/3dlinkweb/apacuana/libs/apacuana-sdk-core/main/src/success/index.js">
523
538
  <metrics statements="4" coveredstatements="4" conditionals="1" coveredconditionals="1" methods="1" coveredmethods="1"/>
524
- <line num="3" count="26" type="stmt"/>
525
- <line num="4" count="26" type="stmt"/>
526
- <line num="5" count="26" type="stmt"/>
527
- <line num="6" count="26" type="stmt"/>
539
+ <line num="3" count="33" type="stmt"/>
540
+ <line num="4" count="33" type="stmt"/>
541
+ <line num="5" count="33" type="stmt"/>
542
+ <line num="6" count="33" type="stmt"/>
528
543
  </file>
529
544
  </package>
530
545
  <package name="src.utils">