open-banking-chile 2.1.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/LICENSE +21 -0
- package/README.md +371 -0
- package/dist/cli.cjs +4406 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +4385 -0
- package/dist/index.cjs +3813 -0
- package/dist/index.d.cts +133 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +3763 -0
- package/package.json +67 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/** Origen del movimiento */
|
|
2
|
+
declare const MOVEMENT_SOURCE: {
|
|
3
|
+
readonly account: "account";
|
|
4
|
+
readonly credit_card_unbilled: "credit_card_unbilled";
|
|
5
|
+
readonly credit_card_billed: "credit_card_billed";
|
|
6
|
+
};
|
|
7
|
+
type MovementSource = typeof MOVEMENT_SOURCE[keyof typeof MOVEMENT_SOURCE];
|
|
8
|
+
/** Titular de la tarjeta */
|
|
9
|
+
declare const CARD_OWNER: {
|
|
10
|
+
readonly titular: "titular";
|
|
11
|
+
readonly adicional: "adicional";
|
|
12
|
+
};
|
|
13
|
+
type CardOwner = typeof CARD_OWNER[keyof typeof CARD_OWNER];
|
|
14
|
+
/** Un movimiento bancario individual */
|
|
15
|
+
interface BankMovement {
|
|
16
|
+
/** Fecha del movimiento (formato dd-mm-yyyy) */
|
|
17
|
+
date: string;
|
|
18
|
+
/** Descripción del movimiento (sin prefijos de origen) */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Monto: positivo = abono (depósito), negativo = cargo (gasto) */
|
|
21
|
+
amount: number;
|
|
22
|
+
/** Saldo después del movimiento */
|
|
23
|
+
balance: number;
|
|
24
|
+
/** Origen: cuenta corriente, TC no facturada, TC facturada */
|
|
25
|
+
source: MovementSource;
|
|
26
|
+
/** Titular o adicional de la tarjeta */
|
|
27
|
+
owner?: CardOwner;
|
|
28
|
+
/** Cuotas (ej: "01/01", "02/06") */
|
|
29
|
+
installments?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Saldo de una tarjeta de crédito */
|
|
32
|
+
interface CreditCardBalance {
|
|
33
|
+
/** Etiqueta de la tarjeta (ej: "Mastercard Black ****5824") */
|
|
34
|
+
label: string;
|
|
35
|
+
/** Cupo nacional */
|
|
36
|
+
national?: {
|
|
37
|
+
used: number;
|
|
38
|
+
available: number;
|
|
39
|
+
total: number;
|
|
40
|
+
};
|
|
41
|
+
/** Cupo internacional */
|
|
42
|
+
international?: {
|
|
43
|
+
used: number;
|
|
44
|
+
available: number;
|
|
45
|
+
total: number;
|
|
46
|
+
currency: string;
|
|
47
|
+
};
|
|
48
|
+
/** Periodo de facturación actual (ej: "Febrero 2026") */
|
|
49
|
+
billingPeriod?: string;
|
|
50
|
+
/** Próxima fecha de facturación (ej: "19 de marzo") */
|
|
51
|
+
nextBillingDate?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Resultado del scraping */
|
|
54
|
+
interface ScrapeResult {
|
|
55
|
+
/** Si el scraping fue exitoso */
|
|
56
|
+
success: boolean;
|
|
57
|
+
/** Nombre del banco */
|
|
58
|
+
bank: string;
|
|
59
|
+
/** Lista de movimientos encontrados */
|
|
60
|
+
movements: BankMovement[];
|
|
61
|
+
/** Saldo actual de la cuenta */
|
|
62
|
+
balance?: number;
|
|
63
|
+
/** Saldos de tarjetas de crédito */
|
|
64
|
+
creditCards?: CreditCardBalance[];
|
|
65
|
+
/** Mensaje de error si success = false */
|
|
66
|
+
error?: string;
|
|
67
|
+
/** Screenshot en base64 (para debugging) */
|
|
68
|
+
screenshot?: string;
|
|
69
|
+
/** Log de debug con pasos del scraper */
|
|
70
|
+
debug?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Credenciales de autenticación */
|
|
73
|
+
interface BankCredentials {
|
|
74
|
+
/** RUT del titular (con o sin formato, ej: "12345678-9" o "123456789") */
|
|
75
|
+
rut: string;
|
|
76
|
+
/** Clave de internet del banco */
|
|
77
|
+
password: string;
|
|
78
|
+
}
|
|
79
|
+
/** Opciones para el scraper */
|
|
80
|
+
interface ScraperOptions extends BankCredentials {
|
|
81
|
+
/** Ruta al ejecutable de Chrome/Chromium. Si no se provee, busca automáticamente. */
|
|
82
|
+
chromePath?: string;
|
|
83
|
+
/** Si es true, guarda screenshots en ./screenshots/ para debugging */
|
|
84
|
+
saveScreenshots?: boolean;
|
|
85
|
+
/** Si es true, usa headless: false (para debugging visual) */
|
|
86
|
+
headful?: boolean;
|
|
87
|
+
/** Filtro Titular/Adicional para TC (ej: "T" = titular, "A" = adicional, "B" = todos). Default: "B" */
|
|
88
|
+
owner?: "T" | "A" | "B";
|
|
89
|
+
/** Callback de progreso para mostrar estado al usuario */
|
|
90
|
+
onProgress?: (step: string) => void;
|
|
91
|
+
}
|
|
92
|
+
/** Interfaz que debe implementar cada banco */
|
|
93
|
+
interface BankScraper {
|
|
94
|
+
/** Identificador único del banco (ej: "falabella", "santander") */
|
|
95
|
+
id: string;
|
|
96
|
+
/** Nombre completo del banco */
|
|
97
|
+
name: string;
|
|
98
|
+
/** URL del portal web del banco */
|
|
99
|
+
url: string;
|
|
100
|
+
/** Ejecutar el scraping */
|
|
101
|
+
scrape(options: ScraperOptions): Promise<ScrapeResult>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare const bchile: BankScraper;
|
|
105
|
+
|
|
106
|
+
declare const bci: BankScraper;
|
|
107
|
+
|
|
108
|
+
declare const bestado: BankScraper;
|
|
109
|
+
|
|
110
|
+
declare const bice: BankScraper;
|
|
111
|
+
|
|
112
|
+
declare const edwards: BankScraper;
|
|
113
|
+
|
|
114
|
+
declare const falabella: BankScraper;
|
|
115
|
+
|
|
116
|
+
declare const itau: BankScraper;
|
|
117
|
+
|
|
118
|
+
declare const santander: BankScraper;
|
|
119
|
+
|
|
120
|
+
declare const scotiabank: BankScraper;
|
|
121
|
+
|
|
122
|
+
/** Registro de todos los bancos disponibles */
|
|
123
|
+
declare const banks: Record<string, BankScraper>;
|
|
124
|
+
/** Lista de bancos soportados */
|
|
125
|
+
declare function listBanks(): Array<{
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
url: string;
|
|
129
|
+
}>;
|
|
130
|
+
/** Obtener un scraper por ID */
|
|
131
|
+
declare function getBank(id: string): BankScraper | undefined;
|
|
132
|
+
|
|
133
|
+
export { type BankCredentials, type BankMovement, type BankScraper, CARD_OWNER, type CardOwner, type CreditCardBalance, MOVEMENT_SOURCE, type MovementSource, type ScrapeResult, type ScraperOptions, banks, bchile, bci, bestado, bice, edwards, falabella, getBank, itau, listBanks, santander, scotiabank };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/** Origen del movimiento */
|
|
2
|
+
declare const MOVEMENT_SOURCE: {
|
|
3
|
+
readonly account: "account";
|
|
4
|
+
readonly credit_card_unbilled: "credit_card_unbilled";
|
|
5
|
+
readonly credit_card_billed: "credit_card_billed";
|
|
6
|
+
};
|
|
7
|
+
type MovementSource = typeof MOVEMENT_SOURCE[keyof typeof MOVEMENT_SOURCE];
|
|
8
|
+
/** Titular de la tarjeta */
|
|
9
|
+
declare const CARD_OWNER: {
|
|
10
|
+
readonly titular: "titular";
|
|
11
|
+
readonly adicional: "adicional";
|
|
12
|
+
};
|
|
13
|
+
type CardOwner = typeof CARD_OWNER[keyof typeof CARD_OWNER];
|
|
14
|
+
/** Un movimiento bancario individual */
|
|
15
|
+
interface BankMovement {
|
|
16
|
+
/** Fecha del movimiento (formato dd-mm-yyyy) */
|
|
17
|
+
date: string;
|
|
18
|
+
/** Descripción del movimiento (sin prefijos de origen) */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Monto: positivo = abono (depósito), negativo = cargo (gasto) */
|
|
21
|
+
amount: number;
|
|
22
|
+
/** Saldo después del movimiento */
|
|
23
|
+
balance: number;
|
|
24
|
+
/** Origen: cuenta corriente, TC no facturada, TC facturada */
|
|
25
|
+
source: MovementSource;
|
|
26
|
+
/** Titular o adicional de la tarjeta */
|
|
27
|
+
owner?: CardOwner;
|
|
28
|
+
/** Cuotas (ej: "01/01", "02/06") */
|
|
29
|
+
installments?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Saldo de una tarjeta de crédito */
|
|
32
|
+
interface CreditCardBalance {
|
|
33
|
+
/** Etiqueta de la tarjeta (ej: "Mastercard Black ****5824") */
|
|
34
|
+
label: string;
|
|
35
|
+
/** Cupo nacional */
|
|
36
|
+
national?: {
|
|
37
|
+
used: number;
|
|
38
|
+
available: number;
|
|
39
|
+
total: number;
|
|
40
|
+
};
|
|
41
|
+
/** Cupo internacional */
|
|
42
|
+
international?: {
|
|
43
|
+
used: number;
|
|
44
|
+
available: number;
|
|
45
|
+
total: number;
|
|
46
|
+
currency: string;
|
|
47
|
+
};
|
|
48
|
+
/** Periodo de facturación actual (ej: "Febrero 2026") */
|
|
49
|
+
billingPeriod?: string;
|
|
50
|
+
/** Próxima fecha de facturación (ej: "19 de marzo") */
|
|
51
|
+
nextBillingDate?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Resultado del scraping */
|
|
54
|
+
interface ScrapeResult {
|
|
55
|
+
/** Si el scraping fue exitoso */
|
|
56
|
+
success: boolean;
|
|
57
|
+
/** Nombre del banco */
|
|
58
|
+
bank: string;
|
|
59
|
+
/** Lista de movimientos encontrados */
|
|
60
|
+
movements: BankMovement[];
|
|
61
|
+
/** Saldo actual de la cuenta */
|
|
62
|
+
balance?: number;
|
|
63
|
+
/** Saldos de tarjetas de crédito */
|
|
64
|
+
creditCards?: CreditCardBalance[];
|
|
65
|
+
/** Mensaje de error si success = false */
|
|
66
|
+
error?: string;
|
|
67
|
+
/** Screenshot en base64 (para debugging) */
|
|
68
|
+
screenshot?: string;
|
|
69
|
+
/** Log de debug con pasos del scraper */
|
|
70
|
+
debug?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Credenciales de autenticación */
|
|
73
|
+
interface BankCredentials {
|
|
74
|
+
/** RUT del titular (con o sin formato, ej: "12345678-9" o "123456789") */
|
|
75
|
+
rut: string;
|
|
76
|
+
/** Clave de internet del banco */
|
|
77
|
+
password: string;
|
|
78
|
+
}
|
|
79
|
+
/** Opciones para el scraper */
|
|
80
|
+
interface ScraperOptions extends BankCredentials {
|
|
81
|
+
/** Ruta al ejecutable de Chrome/Chromium. Si no se provee, busca automáticamente. */
|
|
82
|
+
chromePath?: string;
|
|
83
|
+
/** Si es true, guarda screenshots en ./screenshots/ para debugging */
|
|
84
|
+
saveScreenshots?: boolean;
|
|
85
|
+
/** Si es true, usa headless: false (para debugging visual) */
|
|
86
|
+
headful?: boolean;
|
|
87
|
+
/** Filtro Titular/Adicional para TC (ej: "T" = titular, "A" = adicional, "B" = todos). Default: "B" */
|
|
88
|
+
owner?: "T" | "A" | "B";
|
|
89
|
+
/** Callback de progreso para mostrar estado al usuario */
|
|
90
|
+
onProgress?: (step: string) => void;
|
|
91
|
+
}
|
|
92
|
+
/** Interfaz que debe implementar cada banco */
|
|
93
|
+
interface BankScraper {
|
|
94
|
+
/** Identificador único del banco (ej: "falabella", "santander") */
|
|
95
|
+
id: string;
|
|
96
|
+
/** Nombre completo del banco */
|
|
97
|
+
name: string;
|
|
98
|
+
/** URL del portal web del banco */
|
|
99
|
+
url: string;
|
|
100
|
+
/** Ejecutar el scraping */
|
|
101
|
+
scrape(options: ScraperOptions): Promise<ScrapeResult>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare const bchile: BankScraper;
|
|
105
|
+
|
|
106
|
+
declare const bci: BankScraper;
|
|
107
|
+
|
|
108
|
+
declare const bestado: BankScraper;
|
|
109
|
+
|
|
110
|
+
declare const bice: BankScraper;
|
|
111
|
+
|
|
112
|
+
declare const edwards: BankScraper;
|
|
113
|
+
|
|
114
|
+
declare const falabella: BankScraper;
|
|
115
|
+
|
|
116
|
+
declare const itau: BankScraper;
|
|
117
|
+
|
|
118
|
+
declare const santander: BankScraper;
|
|
119
|
+
|
|
120
|
+
declare const scotiabank: BankScraper;
|
|
121
|
+
|
|
122
|
+
/** Registro de todos los bancos disponibles */
|
|
123
|
+
declare const banks: Record<string, BankScraper>;
|
|
124
|
+
/** Lista de bancos soportados */
|
|
125
|
+
declare function listBanks(): Array<{
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
url: string;
|
|
129
|
+
}>;
|
|
130
|
+
/** Obtener un scraper por ID */
|
|
131
|
+
declare function getBank(id: string): BankScraper | undefined;
|
|
132
|
+
|
|
133
|
+
export { type BankCredentials, type BankMovement, type BankScraper, CARD_OWNER, type CardOwner, type CreditCardBalance, MOVEMENT_SOURCE, type MovementSource, type ScrapeResult, type ScraperOptions, banks, bchile, bci, bestado, bice, edwards, falabella, getBank, itau, listBanks, santander, scotiabank };
|