Socket
Socket
Sign inDemoInstall

nfe2stalk

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nfe2stalk - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

lib/service/iti.js

36

example/index.js
const nfe2stalk = require('../lib/nfe2stalk')
let options = {
every: '10',
fullNotify: true
tempo: '10',
tipoTempo: 's',
notificacaoCompleta: true
}
nfe2stalk.monitor.iniciar(options)
nfe2stalk.monitor.iti.iniciar(options)
nfe2stalk.monitor.sefaz.iniciar(options)
nfe2stalk.monitor.monitorar.on('alerta', (alerta) => {
console.log('alerta')
console.log(alerta)
nfe2stalk.monitor.iti.monitorar.on('alerta', (iti) => {
console.log('iti')
console.log(iti)
console.log('------------------------------------')
})
nfe2stalk.monitor.sefaz.monitorar.on('alerta', (sefaz) => {
console.log('sefaz')
console.log(sefaz)
console.log('------------------------------------')
})
// nova versão
nfe2stalk.monitor.iti.limparAlertas().then((qtAlertas) => {
console.log(`${qtAlertas} removidos`)
})
.catch((err) => {
console.log(err)
})
nfe2stalk.monitor.sefaz.limparAlertas().then((qtAlertas) => {
console.log(`${qtAlertas} removidos`)
})
.catch((err) => {
console.log(err)
})

1

lib/nfe2stalk.js
function Nfe2Stalk () {
this.resources = []
}

@@ -4,0 +3,0 @@

@@ -1,41 +0,7 @@

const schedule = require('node-schedule')
const util = require('./utils')
const EventEmitter = require('events')
var alerta = false
const sefaz = require('./sites/sefaz')
const iti = require('./sites/iti')
class MyEmitter extends EventEmitter {}
const monitorar = new MyEmitter()
function iniciar (options) {
// return new Promise((resolve, reject) => {
let j = schedule.scheduleJob(`*/${options.every} * * * * *`, function () {
util.crawler(function (err, info) {
if (err) {
return monitorar.emit('alerta', err)
}
// console.log(info)
if (info.numero) {
info.url = `http://www.nfe.fazenda.gov.br/portal/informe.aspx?ehCTG=false#${info.numero}`
alerta = info
return monitorar.emit('alerta', alerta)
}
if (options.fullNotify && !info) {
alerta = false
return monitorar.emit('alerta', alerta)
}
alerta = info
monitorar.emit('alerta', alerta)
})
})
// })
}
module.exports = {
iniciar,
alerta,
monitorar
sefaz,
iti
}
{
"name": "nfe2stalk",
"description": "Lib para receber em tempo real as alterações e informes da Sefaz NF-e",
"description": "Um jeito simples de receber as novidades da Sefaz NF-e",
"readmeFilename": "README.md",

@@ -13,3 +13,3 @@ "keywords": [

],
"version": "1.0.0",
"version": "2.0.0",
"author": {

@@ -16,0 +16,0 @@ "name": "Igor Souza Martins",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc