@devlas/dte-sii 2.14.0 → 2.14.1

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 (2) hide show
  1. package/cert/CertRunner.js +14 -1
  2. package/package.json +1 -1
@@ -4051,7 +4051,13 @@ class CertRunner {
4051
4051
  const cookieJar = await this._obtenerCookiesSII();
4052
4052
  const cookieStr = Object.entries(cookieJar).map(([k, v]) => `${k}=${v}`).join('; ');
4053
4053
 
4054
+ // ⚠️ Este era el ÚNICO cliente HTTP de la librería que no dejaba rastro, y es
4055
+ // precisamente el que responde "¿el SII ya habilitó el timbraje?": consulta
4056
+ // of_solicita_folios_dcto en palena y mira si el tipo 39 aparece en el select.
4057
+ // Cuando la respuesta es "todavía no", sin la captura no queda forma de saber si el
4058
+ // SII contestó eso de verdad o si la consulta salió mal.
4054
4059
  const fetchHtml = (url) => new Promise((resolve, reject) => {
4060
+ const _t0 = Date.now();
4055
4061
  const req = https.get(url, {
4056
4062
  headers: {
4057
4063
  'Cookie': cookieStr,
@@ -4062,7 +4068,14 @@ class CertRunner {
4062
4068
  }, (res) => {
4063
4069
  const chunks = [];
4064
4070
  res.on('data', c => chunks.push(c));
4065
- res.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')));
4071
+ res.on('end', () => {
4072
+ const _body = Buffer.concat(chunks).toString('utf-8');
4073
+ registrarHttpDebug({
4074
+ url, method: 'GET', status: res.statusCode, headers: res.headers,
4075
+ body: _body, ms: Date.now() - _t0, cliente: 'verificarAutorizacionBoleta',
4076
+ });
4077
+ resolve(_body);
4078
+ });
4066
4079
  });
4067
4080
  req.on('error', reject);
4068
4081
  req.setTimeout(20000, () => { req.destroy(); reject(new Error('Timeout')); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlas/dte-sii",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "description": "Facturación y boletas electrónicas para el SII de Chile. Genera, timbra, firma y envía DTEs, libros electrónicos y automatiza la certificación.",
5
5
  "main": "index.js",
6
6
  "types": "dte-sii.d.ts",