@treeunfe/types 1.0.4 → 1.0.5

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.
@@ -1,71 +1,71 @@
1
1
 
2
- > @treeunfe/types@1.0.3 build /home/runner/work/treeunfe-dfe/treeunfe-dfe/packages/types
2
+ > @treeunfe/types@1.0.4 build /home/runner/work/treeunfe-dfe/treeunfe-dfe/packages/types
3
3
  > rollup -c
4
4
 
5
- (node:3507) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/treeunfe-dfe/treeunfe-dfe/packages/types/rollup.config.js is not specified and it doesn't parse as CommonJS.
5
+ (node:3512) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/treeunfe-dfe/treeunfe-dfe/packages/types/rollup.config.js is not specified and it doesn't parse as CommonJS.
6
6
  Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
7
7
  To eliminate this warning, add "type": "module" to /home/runner/work/treeunfe-dfe/treeunfe-dfe/packages/types/package.json.
8
8
  (Use `node --trace-warnings ...` to show where the warning was created)
9
9
  
10
10
  src/index.ts → dist/index.cjs...
11
11
  (!) [plugin typescript] @rollup/plugin-typescript: outputToFilesystem option is defaulting to true.
12
- created dist/index.cjs in 1.9s
12
+ created dist/index.cjs in 1.8s
13
13
  
14
14
  src/index.ts → dist/index.mjs...
15
- created dist/index.mjs in 936ms
15
+ created dist/index.mjs in 900ms
16
16
  
17
17
  src/common/index.ts → dist/common/index.cjs...
18
18
  (!) Generated an empty chunk
19
19
  "index"
20
- created dist/common/index.cjs in 654ms
20
+ created dist/common/index.cjs in 594ms
21
21
  
22
22
  src/common/index.ts → dist/common/index.mjs...
23
23
  (!) Generated an empty chunk
24
24
  "index"
25
- created dist/common/index.mjs in 605ms
25
+ created dist/common/index.mjs in 564ms
26
26
  
27
27
  src/cte/index.ts → dist/cte/index.cjs...
28
28
  (!) Generated an empty chunk
29
29
  "index"
30
- created dist/cte/index.cjs in 699ms
30
+ created dist/cte/index.cjs in 649ms
31
31
  
32
32
  src/cte/index.ts → dist/cte/index.mjs...
33
33
  (!) Generated an empty chunk
34
34
  "index"
35
- created dist/cte/index.mjs in 585ms
35
+ created dist/cte/index.mjs in 577ms
36
36
  
37
37
  src/nfce/index.ts → dist/nfce/index.cjs...
38
38
  (!) Generated an empty chunk
39
39
  "index"
40
- created dist/nfce/index.cjs in 534ms
40
+ created dist/nfce/index.cjs in 502ms
41
41
  
42
42
  src/nfce/index.ts → dist/nfce/index.mjs...
43
43
  (!) Generated an empty chunk
44
44
  "index"
45
- created dist/nfce/index.mjs in 590ms
45
+ created dist/nfce/index.mjs in 551ms
46
46
  
47
47
  src/nfe/index.ts → dist/nfe/index.cjs...
48
48
  (!) Generated an empty chunk
49
49
  "index"
50
- created dist/nfe/index.cjs in 556ms
50
+ created dist/nfe/index.cjs in 521ms
51
51
  
52
52
  src/nfe/index.ts → dist/nfe/index.mjs...
53
53
  (!) Generated an empty chunk
54
54
  "index"
55
- created dist/nfe/index.mjs in 555ms
55
+ created dist/nfe/index.mjs in 506ms
56
56
  
57
57
  src/nfse/index.ts → dist/nfse/index.cjs...
58
- created dist/nfse/index.cjs in 642ms
58
+ created dist/nfse/index.cjs in 606ms
59
59
  
60
60
  src/nfse/index.ts → dist/nfse/index.mjs...
61
- created dist/nfse/index.mjs in 534ms
61
+ created dist/nfse/index.mjs in 495ms
62
62
  
63
63
  src/interfaces/index.ts → dist/interfaces/index.cjs...
64
64
  (!) Generated an empty chunk
65
65
  "index"
66
- created dist/interfaces/index.cjs in 504ms
66
+ created dist/interfaces/index.cjs in 477ms
67
67
  
68
68
  src/interfaces/index.ts → dist/interfaces/index.mjs...
69
69
  (!) Generated an empty chunk
70
70
  "index"
71
- created dist/interfaces/index.mjs in 489ms
71
+ created dist/interfaces/index.mjs in 448ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @treeunfe/types
2
2
 
3
+ ## 1.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Release patch version
8
+
3
9
  ## 1.0.4
4
10
 
5
11
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,255 @@
1
+ # Treeunfe DFe 🪄
2
+
3
+ > Biblioteca Node.js open source para integração com webservices da SEFAZ, desenvolvida e mantida pela **Treeunfe**.
4
+
5
+ [![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.pt-br.html)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/)
7
+ [![Node.js](https://img.shields.io/badge/Node.js-16%2B-green.svg)](https://nodejs.org/)
8
+
9
+ ## 📖 Sobre
10
+
11
+ **Treeunfe DFe** é uma biblioteca open source desenvolvida e mantida pela empresa **Treeunfe**, projetada para simplificar a integração com os webservices da SEFAZ. A biblioteca oferece uma solução robusta e modular para automação de processos relacionados a documentos fiscais eletrônicos.
12
+
13
+ ### ✨ Características
14
+
15
+ - 🚀 **Open Source**: Código aberto e gratuito para uso
16
+ - 🔄 **Atualizações Frequentes**: Mantida ativamente pela Treeunfe com atualizações regulares
17
+ - 📦 **Modular**: Instale apenas os módulos que você precisa
18
+ - 🛠️ **TypeScript**: Totalmente tipado para melhor experiência de desenvolvimento
19
+ - 📚 **Documentação Completa**: Documentação detalhada e exemplos práticos
20
+
21
+ ## 🏢 Sobre a Treeunfe
22
+
23
+ A **Treeunfe** é uma empresa especializada em soluções fiscais e tributárias. Esta biblioteca é mantida ativamente pela equipe Treeunfe, garantindo atualizações frequentes, correções de bugs e suporte às últimas normas técnicas da SEFAZ.
24
+
25
+ ## 📦 Instalação
26
+
27
+ A biblioteca é modular, permitindo instalar apenas os módulos necessários:
28
+
29
+ ```bash
30
+ # Instalar módulo NFe
31
+ npm install @treeunfe/nfe @treeunfe/types @treeunfe/shared
32
+
33
+ # Instalar módulo NFCe
34
+ npm install @treeunfe/nfce @treeunfe/types @treeunfe/shared
35
+
36
+ # Instalar módulo CTe
37
+ npm install @treeunfe/cte @treeunfe/types @treeunfe/shared
38
+
39
+ # Instalar módulo NFSe
40
+ npm install @treeunfe/nfse @treeunfe/types @treeunfe/shared
41
+
42
+ # Instalar módulo DANFE (geração de PDF)
43
+ npm install @treeunfe/danfe
44
+ ```
45
+
46
+ ## 🚀 Início Rápido
47
+
48
+ ### Exemplo: NFe
49
+
50
+ ```typescript
51
+ import { NFe, TreeunfeDFeService } from '@treeunfe/nfe';
52
+ import { TreeunfeDFeProps } from '@treeunfe/types';
53
+ import path from 'path';
54
+
55
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
56
+
57
+ // Inicializar serviço
58
+ const treeunfeDFeService = new TreeunfeDFeService();
59
+ const nfeHandler = new NFe(treeunfeDFeService);
60
+
61
+ // Configurar ambiente
62
+ await nfeHandler.LoadEnvironment({
63
+ config: {
64
+ dfe: {
65
+ baixarXMLDistribuicao: true,
66
+ pathXMLDistribuicao: "tmp/DistribuicaoDFe/NFe",
67
+ armazenarXMLAutorizacao: true,
68
+ pathXMLAutorizacao: "tmp/Autorizacao/NFe",
69
+ armazenarXMLRetorno: true,
70
+ pathXMLRetorno: "tmp/RequestLogs/NFe",
71
+ armazenarXMLConsulta: true,
72
+ pathXMLConsulta: "tmp/RequestLogs/NFe",
73
+
74
+ pathCertificado: path.resolve(__dirname, "certificado.pfx"),
75
+ senhaCertificado: "sua_senha_aqui",
76
+ UF: "SP",
77
+ CPFCNPJ: "00000000000000",
78
+ },
79
+ nfe: {
80
+ ambiente: 2, // 1 = Produção, 2 = Homologação
81
+ versaoDF: "4.00",
82
+ tokenCSC: 'seu_token_csc',
83
+ idCSRT: '01'
84
+ },
85
+ lib: {
86
+ connection: {
87
+ timeout: 30000,
88
+ },
89
+ log: {
90
+ exibirLogNoConsole: true,
91
+ armazenarLogs: true,
92
+ pathLogs: 'tmp/Logs/NFe'
93
+ },
94
+ useOpenSSL: false,
95
+ useForSchemaValidation: 'validateSchemaJsBased',
96
+ }
97
+ } as TreeunfeDFeProps
98
+ });
99
+
100
+ // Consultar status do serviço
101
+ await nfeHandler.ConsultaStatusServico();
102
+
103
+ // Consultar protocolo
104
+ await nfeHandler.ConsultaProtocolo('00000000000000000000000000000000000000000000');
105
+ ```
106
+
107
+ ### Exemplo: NFSe
108
+
109
+ ```typescript
110
+ import { NFSe } from '@treeunfe/nfse';
111
+ import { TreeunfeDFeService } from '@treeunfe/nfe';
112
+ import { TreeunfeDFeProps } from '@treeunfe/types';
113
+ import path from 'path';
114
+
115
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
116
+
117
+ // Inicializar serviço
118
+ const treeunfeDFeService = new TreeunfeDFeService();
119
+ const nfseHandler = new NFSe(treeunfeDFeService);
120
+
121
+ // Configurar ambiente
122
+ await nfseHandler.LoadEnvironment({
123
+ config: {
124
+ dfe: {
125
+ baixarXMLDistribuicao: true,
126
+ pathXMLDistribuicao: "tmp/DistribuicaoDFe/NFSe",
127
+ armazenarXMLAutorizacao: true,
128
+ pathXMLAutorizacao: "tmp/Autorizacao/NFSe",
129
+ armazenarXMLRetorno: true,
130
+ pathXMLRetorno: "tmp/RequestLogs/NFSe",
131
+
132
+ pathCertificado: path.resolve(__dirname, "certificado.pfx"),
133
+ senhaCertificado: "sua_senha_aqui",
134
+ UF: "SP",
135
+ CPFCNPJ: "00000000000000",
136
+ },
137
+ nfse: {
138
+ ambiente: 2, // 1 = Produção, 2 = Homologação
139
+ versao: "1.00"
140
+ },
141
+ lib: {
142
+ connection: {
143
+ timeout: 30000,
144
+ },
145
+ log: {
146
+ exibirLogNoConsole: true,
147
+ armazenarLogs: true,
148
+ pathLogs: 'tmp/Logs/NFSe'
149
+ },
150
+ useOpenSSL: false,
151
+ useForSchemaValidation: 'validateSchemaJsBased',
152
+ }
153
+ } as TreeunfeDFeProps
154
+ });
155
+
156
+ // Consultar NFSe por chave
157
+ await nfseHandler.Consulta({
158
+ chaveAcesso: '00000000000000000000000000000000000000000000'
159
+ });
160
+ ```
161
+
162
+ ## 📚 Funcionalidades
163
+
164
+ ### NFe (Nota Fiscal Eletrônica)
165
+ - ✅ Autorização de NFe
166
+ - ✅ Consulta de Protocolo
167
+ - ✅ Consulta de Status do Serviço
168
+ - ✅ Distribuição DFe (por NSU, Último NSU ou Chave)
169
+ - ✅ Inutilização de NFe
170
+ - ✅ Recepção de Eventos (Cancelamento, Carta de Correção, EPEC, etc.)
171
+ - ✅ Geração de DANFE
172
+
173
+ ### NFCe (Nota Fiscal de Consumidor Eletrônica)
174
+ - ✅ Autorização de NFCe
175
+ - ✅ Consulta de Protocolo
176
+ - ✅ Geração de QR Code
177
+ - ✅ Geração de DANFE
178
+
179
+ ### CTe (Conhecimento de Transporte Eletrônico)
180
+ - ✅ Distribuição DFe (por NSU, Último NSU ou Chave)
181
+ - ✅ Download automático de documentos CT-e
182
+
183
+ ### NFSe (Nota Fiscal de Serviços Eletrônica)
184
+ - ✅ Autorização de NFSe
185
+ - ✅ Consulta de NFSe
186
+ - ✅ Consulta de Parâmetros Municipais
187
+ - ✅ Registro de Eventos (Cancelamento, etc.)
188
+ - ✅ Distribuição por NSU
189
+
190
+ ## 📖 Documentação
191
+
192
+ Para documentação completa, exemplos detalhados e referência da API, acesse:
193
+
194
+ **🔗 [Documentação Completa](https://nfewizard-org.github.io/)**
195
+
196
+ ## ⚙️ Requisitos
197
+
198
+ - **Node.js**: Versão 16 ou superior
199
+ - **Certificado**: Certificado A1 (arquivo .pfx)
200
+ - **TypeScript**: Recomendado (mas não obrigatório)
201
+
202
+ ### Validação de Schema
203
+
204
+ Por padrão, a biblioteca utiliza validação baseada em Java. Para ambientes sem suporte ao JDK (como Vercel, AWS Lambda sem layers), configure:
205
+
206
+ ```typescript
207
+ lib: {
208
+ useForSchemaValidation: 'validateSchemaJsBased'
209
+ }
210
+ ```
211
+
212
+ ## 🤝 Contribuindo
213
+
214
+ Contribuições são bem-vindas! Este é um projeto open source mantido pela Treeunfe, e sua colaboração é muito apreciada.
215
+
216
+ ### Como Contribuir
217
+
218
+ 1. **Reportar Bugs**: Abra uma issue descrevendo o problema
219
+ 2. **Sugerir Funcionalidades**: Compartilhe suas ideias
220
+ 3. **Enviar Pull Requests**: Contribua com código, documentação ou melhorias
221
+ 4. **Espalhar a Palavra**: Compartilhe o projeto com outros desenvolvedores
222
+
223
+ ### Ao Abrir uma Issue
224
+
225
+ Por favor, inclua as seguintes informações:
226
+
227
+ ```markdown
228
+ ## Parametrização
229
+ - UF: SP
230
+ - Certificado: A1
231
+ - Método: NFE_ConsultaStatusServico
232
+ - Status: ✅ Funcionando / ❌ Com erro
233
+ ```
234
+
235
+ Inclua também os logs gerados no diretório configurado em `pathLogs` (arquivos `app.jsonl`, `error.jsonl` e `http.jsonl`).
236
+
237
+ ## 📝 Licença
238
+
239
+ Este projeto é licenciado sob a [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.pt-br.html).
240
+
241
+ ## 🏢 Mantido por Treeunfe
242
+
243
+ Desenvolvido e mantido com ❤️ pela equipe **Treeunfe**.
244
+
245
+ - 🌐 Website: [Treeunfe](https://treeunfe.com.br)
246
+ - 📧 Suporte: suporte@treeunfe.com.br
247
+ - 💬 Issues: [GitHub Issues](https://github.com/treeunfe/treeunfe-dfe/issues)
248
+
249
+ ## ⭐ Agradecimentos
250
+
251
+ Agradecemos a todos os contribuidores e usuários que tornam este projeto possível!
252
+
253
+ ---
254
+
255
+ **Treeunfe DFe** - Simplificando a integração com a SEFAZ 🚀
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeunfe/types",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Tipos TypeScript para Treeunfe DFe ecosystem (NFe, NFCe, CTe, NFSe)",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -63,7 +63,6 @@
63
63
  "url": "https://github.com/treeunfe/treeunfe-dfe",
64
64
  "directory": "packages/types"
65
65
  },
66
- "readme": "../../README.md",
67
66
  "dependencies": {},
68
67
  "devDependencies": {
69
68
  "@rollup/plugin-commonjs": "^25.0.7",