npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zfiscoo-sdk

v0.1.0

Published

TypeScript SDK do Fiscal Gateway — emissão de NFC-e/NF-e/NFS-e no Brasil. Async-native, ESM nativo, fetch puro.

Downloads

103

Readme

zfiscoo-sdk

TypeScript SDK do Fiscal Gateway — emissão async-native de NFC-e/NF-e/NFS-e no Brasil.

ESM nativo, fetch puro (sem axios), zero deps. Funciona em Node 18+, Bun, Deno e browser.

Install

npm install zfiscoo-sdk
# ou
pnpm add zfiscoo-sdk
# ou
bun add zfiscoo-sdk

Uso básico

import { FiscalClient } from 'zfiscoo-sdk';

const fiscal = new FiscalClient({
  apiKey: process.env.FISCAL_KEY!,
  baseUrl: 'https://api.zfiscoo.zek.app.br', // omitir = produção
});

// 1. Cria emissor (uma vez por CNPJ)
const issuer = await fiscal.issuers.create({
  cnpj: '12345678000199',
  razao_social: 'Restaurante X LTDA',
  ie: '123456789',
  regime_tributario: 'simples_nacional',
  endereco: {
    cep: '01310100',
    logradouro: 'Av Paulista',
    numero: '1000',
    bairro: 'Bela Vista',
    municipio: 'São Paulo',
    municipio_codigo: '3550308',
    uf: 'SP',
  },
  cfop_padrao: '5102',
});

// 2. Emite NFC-e (POST recebe 202, processamento async)
const issued = await fiscal.nfce.issue({
  issuer_id: issuer.id,
  external_ref: 'pedido-12345',
  items: [
    {
      codigo: 'X-001',
      descricao: 'X-Burger',
      ncm: '21069090',
      quantidade: 1,
      valor_unitario: 25.0,
    },
  ],
  payments: [{ tipo: 'pix', valor: 25.0 }],
});

// 3. Aguarda status terminal (authorized | denied | failed | cancelled)
const final = await fiscal.nfce.waitForFinal(issued.id);
console.log(final.status); // 'authorized'
console.log(final.chave_acesso); // '35260112345...'

Idempotency

Pra evitar duplicação em retry:

await fiscal.nfce.issue(
  { issuer_id: '...', items: [...], payments: [...] },
  { idempotencyKey: 'pedido-12345' }, // mesma key + mesmo body = mesma resposta
);

Streaming (SSE)

for await (const event of fiscal.nfce.stream(invoiceId)) {
  console.log(event); // { type: 'sefaz_request', data: { ... } }
  if (event.type === 'authorized') break;
}

Webhooks

Em vez de polling, configure um endpoint pra receber:

await fiscal.webhooks.create({
  url: 'https://seu-app.com/fiscal-webhook',
  events: ['invoice.authorized', 'invoice.denied', 'invoice.cancelled'],
});

O SDK retorna secret na criação — use pra validar HMAC:

import { verifyWebhookSignature } from 'zfiscoo-sdk';

const isValid = verifyWebhookSignature({
  body: rawBody,
  signature: req.headers['x-fiscal-signature'],
  secret: SAVED_SECRET,
});

API reference completa

Docs interativas (Swagger): https://api.zfiscoo.zek.app.br/docs

Compatibilidade

| Ambiente | Suportado | |---|---| | Node 18+ | ✅ | | Node 20+ | ✅ | | Bun | ✅ | | Deno | ✅ | | Browser (com cors-proxy) | ✅ |

License

MIT