node-sped-nfe 1.2.0 → 1.2.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.
- package/dist/utils/extras.js +1 -1
- package/dist/utils/tools.js +19 -7
- package/package.json +1 -1
package/dist/utils/extras.js
CHANGED
@@ -319,7 +319,7 @@ const docZip = async (xml, retorno = "original") => {
|
|
319
319
|
};
|
320
320
|
const jXml = await xml2json(xml);
|
321
321
|
try {
|
322
|
-
var docZips = jXml["
|
322
|
+
var docZips = jXml["nfeDistDFeInteresseResponse"]["nfeDistDFeInteresseResult"]["retDistDFeInt"];
|
323
323
|
if (typeof docZips['loteDistDFeInt'] == "undefined")
|
324
324
|
return resolve([]);
|
325
325
|
docZips = docZips["loteDistDFeInt"]['docZip'];
|
package/dist/utils/tools.js
CHANGED
@@ -54,7 +54,7 @@ class Tools {
|
|
54
54
|
__classPrivateFieldSet(this, _Tools_cert, certificado, "f");
|
55
55
|
}
|
56
56
|
sefazEnviaLote(xml, data = { idLote: 1, indSinc: 0, compactar: false }) {
|
57
|
-
return new Promise(async (
|
57
|
+
return new Promise(async (resolve, reject) => {
|
58
58
|
if (typeof data.idLote == "undefined")
|
59
59
|
data.idLote = 1;
|
60
60
|
if (typeof data.indSinc == "undefined")
|
@@ -102,7 +102,9 @@ class Tools {
|
|
102
102
|
data += chunk;
|
103
103
|
});
|
104
104
|
res.on('end', () => {
|
105
|
-
|
105
|
+
xml2json(data).then((jRes) => {
|
106
|
+
json2xml(jRes['soap:Envelope']['soap:Body']).then(resolve).catch(reject);
|
107
|
+
});
|
106
108
|
});
|
107
109
|
});
|
108
110
|
req.setTimeout(__classPrivateFieldGet(this, _Tools_config, "f").timeout * 1000, () => {
|
@@ -213,7 +215,11 @@ class Tools {
|
|
213
215
|
}, (res) => {
|
214
216
|
let data = '';
|
215
217
|
res.on('data', (chunk) => data += chunk);
|
216
|
-
res.on('end', () =>
|
218
|
+
res.on('end', () => {
|
219
|
+
xml2json(data).then((jRes) => {
|
220
|
+
json2xml(jRes['soap:Envelope']['soap:Body']).then(resolve).catch(reject);
|
221
|
+
});
|
222
|
+
});
|
217
223
|
});
|
218
224
|
req.setTimeout(__classPrivateFieldGet(this, _Tools_config, "f").timeout * 1000, () => {
|
219
225
|
reject({
|
@@ -334,7 +340,9 @@ class Tools {
|
|
334
340
|
data += chunk;
|
335
341
|
});
|
336
342
|
res.on('end', () => {
|
337
|
-
|
343
|
+
xml2json(data).then((jRes) => {
|
344
|
+
json2xml(jRes['soap:Envelope']['soap:Body']).then(resolve).catch(reject);
|
345
|
+
});
|
338
346
|
});
|
339
347
|
});
|
340
348
|
req.setTimeout(__classPrivateFieldGet(this, _Tools_config, "f").timeout * 1000, () => {
|
@@ -420,7 +428,9 @@ class Tools {
|
|
420
428
|
data += chunk;
|
421
429
|
});
|
422
430
|
res.on('end', () => {
|
423
|
-
|
431
|
+
xml2json(data).then((jRes) => {
|
432
|
+
json2xml(jRes['soap:Envelope']['soap:Body']).then(resolve).catch(reject);
|
433
|
+
});
|
424
434
|
});
|
425
435
|
});
|
426
436
|
req.setTimeout(__classPrivateFieldGet(this, _Tools_config, "f").timeout * 1000, () => {
|
@@ -443,7 +453,7 @@ class Tools {
|
|
443
453
|
}
|
444
454
|
//Consulta status sefaz
|
445
455
|
async sefazStatus() {
|
446
|
-
return new Promise(async (
|
456
|
+
return new Promise(async (resolve, reject) => {
|
447
457
|
if (typeof __classPrivateFieldGet(this, _Tools_config, "f").UF == "undefined")
|
448
458
|
throw "sefazStatus({...UF}) -> não definido!";
|
449
459
|
if (typeof __classPrivateFieldGet(this, _Tools_config, "f").tpAmb == "undefined")
|
@@ -495,7 +505,9 @@ class Tools {
|
|
495
505
|
data += chunk;
|
496
506
|
});
|
497
507
|
res.on('end', () => {
|
498
|
-
|
508
|
+
xml2json(data).then((jRes) => {
|
509
|
+
json2xml(jRes['soap:Envelope']['soap:Body']).then(resolve).catch(reject);
|
510
|
+
});
|
499
511
|
});
|
500
512
|
});
|
501
513
|
req.setTimeout(__classPrivateFieldGet(this, _Tools_config, "f").timeout * 1000, () => {
|