nfse-br 0.0.0-stage → 2.0.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/LICENSE +21 -0
- package/README.md +183 -2
- package/assets/fonts/LICENSE-LiberationSans.txt +102 -0
- package/assets/fonts/LiberationSans-Bold.ttf +0 -0
- package/assets/fonts/LiberationSans-Regular.ttf +0 -0
- package/completions/_nfse +200 -0
- package/completions/nfse.bash +69 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +1355 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client.d.ts +39 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +82 -0
- package/dist/client.js.map +1 -0
- package/dist/config/index.d.ts +45 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +80 -0
- package/dist/config/index.js.map +1 -0
- package/dist/domain/errors.d.ts +111 -0
- package/dist/domain/errors.d.ts.map +1 -0
- package/dist/domain/errors.js +133 -0
- package/dist/domain/errors.js.map +1 -0
- package/dist/domain/signature-policy.d.ts +55 -0
- package/dist/domain/signature-policy.d.ts.map +1 -0
- package/dist/domain/signature-policy.js +84 -0
- package/dist/domain/signature-policy.js.map +1 -0
- package/dist/domain/types.d.ts +295 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/domain/types.js +9 -0
- package/dist/domain/types.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/certificate.d.ts +42 -0
- package/dist/infra/certificate.d.ts.map +1 -0
- package/dist/infra/certificate.js +106 -0
- package/dist/infra/certificate.js.map +1 -0
- package/dist/infra/transport-errors.d.ts +24 -0
- package/dist/infra/transport-errors.d.ts.map +1 -0
- package/dist/infra/transport-errors.js +95 -0
- package/dist/infra/transport-errors.js.map +1 -0
- package/dist/infra/xml-signer.d.ts +21 -0
- package/dist/infra/xml-signer.d.ts.map +1 -0
- package/dist/infra/xml-signer.js +55 -0
- package/dist/infra/xml-signer.js.map +1 -0
- package/dist/infra/xml.d.ts +32 -0
- package/dist/infra/xml.d.ts.map +1 -0
- package/dist/infra/xml.js +73 -0
- package/dist/infra/xml.js.map +1 -0
- package/dist/providers/giss/http-client.d.ts +11 -0
- package/dist/providers/giss/http-client.d.ts.map +1 -0
- package/dist/providers/giss/http-client.js +61 -0
- package/dist/providers/giss/http-client.js.map +1 -0
- package/dist/providers/giss/messages/parser.d.ts +72 -0
- package/dist/providers/giss/messages/parser.d.ts.map +1 -0
- package/dist/providers/giss/messages/parser.js +160 -0
- package/dist/providers/giss/messages/parser.js.map +1 -0
- package/dist/providers/giss/messages/provided-services.d.ts +64 -0
- package/dist/providers/giss/messages/provided-services.d.ts.map +1 -0
- package/dist/providers/giss/messages/provided-services.js +415 -0
- package/dist/providers/giss/messages/provided-services.js.map +1 -0
- package/dist/providers/giss/messages/taken-services.d.ts +32 -0
- package/dist/providers/giss/messages/taken-services.d.ts.map +1 -0
- package/dist/providers/giss/messages/taken-services.js +241 -0
- package/dist/providers/giss/messages/taken-services.js.map +1 -0
- package/dist/providers/giss/municipalities.d.ts +38 -0
- package/dist/providers/giss/municipalities.d.ts.map +1 -0
- package/dist/providers/giss/municipalities.js +225 -0
- package/dist/providers/giss/municipalities.js.map +1 -0
- package/dist/providers/giss/nfsc-service.d.ts +61 -0
- package/dist/providers/giss/nfsc-service.d.ts.map +1 -0
- package/dist/providers/giss/nfsc-service.js +88 -0
- package/dist/providers/giss/nfsc-service.js.map +1 -0
- package/dist/providers/giss/nfse-service.d.ts +130 -0
- package/dist/providers/giss/nfse-service.d.ts.map +1 -0
- package/dist/providers/giss/nfse-service.js +224 -0
- package/dist/providers/giss/nfse-service.js.map +1 -0
- package/dist/providers/giss/portal-service.d.ts +300 -0
- package/dist/providers/giss/portal-service.d.ts.map +1 -0
- package/dist/providers/giss/portal-service.js +444 -0
- package/dist/providers/giss/portal-service.js.map +1 -0
- package/dist/providers/giss/soap-client.d.ts +46 -0
- package/dist/providers/giss/soap-client.d.ts.map +1 -0
- package/dist/providers/giss/soap-client.js +131 -0
- package/dist/providers/giss/soap-client.js.map +1 -0
- package/dist/providers/nacional/danfse/danfse-data.d.ts +132 -0
- package/dist/providers/nacional/danfse/danfse-data.d.ts.map +1 -0
- package/dist/providers/nacional/danfse/danfse-data.js +436 -0
- package/dist/providers/nacional/danfse/danfse-data.js.map +1 -0
- package/dist/providers/nacional/danfse/danfse-pdf.d.ts +24 -0
- package/dist/providers/nacional/danfse/danfse-pdf.d.ts.map +1 -0
- package/dist/providers/nacional/danfse/danfse-pdf.js +466 -0
- package/dist/providers/nacional/danfse/danfse-pdf.js.map +1 -0
- package/dist/providers/nacional/danfse/ibge-municipalities.d.ts +5 -0
- package/dist/providers/nacional/danfse/ibge-municipalities.d.ts.map +1 -0
- package/dist/providers/nacional/danfse/ibge-municipalities.js +19 -0
- package/dist/providers/nacional/danfse/ibge-municipalities.js.map +1 -0
- package/dist/providers/nacional/danfse/logo.d.ts +6 -0
- package/dist/providers/nacional/danfse/logo.d.ts.map +1 -0
- package/dist/providers/nacional/danfse/logo.js +6 -0
- package/dist/providers/nacional/danfse/logo.js.map +1 -0
- package/dist/providers/nacional/messages.d.ts +99 -0
- package/dist/providers/nacional/messages.d.ts.map +1 -0
- package/dist/providers/nacional/messages.js +277 -0
- package/dist/providers/nacional/messages.js.map +1 -0
- package/dist/providers/nacional/national-client.d.ts +26 -0
- package/dist/providers/nacional/national-client.d.ts.map +1 -0
- package/dist/providers/nacional/national-client.js +56 -0
- package/dist/providers/nacional/national-client.js.map +1 -0
- package/dist/providers/nacional/national-service.d.ts +123 -0
- package/dist/providers/nacional/national-service.d.ts.map +1 -0
- package/dist/providers/nacional/national-service.js +233 -0
- package/dist/providers/nacional/national-service.js.map +1 -0
- package/dist/services/lookup-service.d.ts +41 -0
- package/dist/services/lookup-service.d.ts.map +1 -0
- package/dist/services/lookup-service.js +122 -0
- package/dist/services/lookup-service.js.map +1 -0
- package/dist/storage/contact-repository.d.ts +46 -0
- package/dist/storage/contact-repository.d.ts.map +1 -0
- package/dist/storage/contact-repository.js +105 -0
- package/dist/storage/contact-repository.js.map +1 -0
- package/dist/storage/invoice-sync.d.ts +12 -0
- package/dist/storage/invoice-sync.d.ts.map +1 -0
- package/dist/storage/invoice-sync.js +71 -0
- package/dist/storage/invoice-sync.js.map +1 -0
- package/dist/storage/profile-repository.d.ts +76 -0
- package/dist/storage/profile-repository.d.ts.map +1 -0
- package/dist/storage/profile-repository.js +135 -0
- package/dist/storage/profile-repository.js.map +1 -0
- package/dist/validation/schema-validator.d.ts +27 -0
- package/dist/validation/schema-validator.d.ts.map +1 -0
- package/dist/validation/schema-validator.js +68 -0
- package/dist/validation/schema-validator.js.map +1 -0
- package/package.json +90 -4
- package/schemas/giss/prestados/cabecalho-v2_04.xsd +25 -0
- package/schemas/giss/prestados/cancelar-nfse-envio-v2_04.xsd +23 -0
- package/schemas/giss/prestados/cancelar-nfse-reposta-v2_04.xsd +26 -0
- package/schemas/giss/prestados/consultar-lote-rps-envio-v2_04.xsd +29 -0
- package/schemas/giss/prestados/consultar-lote-rps-resposta-v2_04.xsd +40 -0
- package/schemas/giss/prestados/consultar-nfse-faixa-envio-v2_04.xsd +38 -0
- package/schemas/giss/prestados/consultar-nfse-faixa-resposta-v2_04.xsd +34 -0
- package/schemas/giss/prestados/consultar-nfse-rps-envio-v2_04.xsd +28 -0
- package/schemas/giss/prestados/consultar-nfse-rps-resposta-v2_04.xsd +26 -0
- package/schemas/giss/prestados/consultar-nfse-servico-prestado-envio-v2_04.xsd +58 -0
- package/schemas/giss/prestados/consultar-nfse-servico-prestado-resposta-v2_04.xsd +34 -0
- package/schemas/giss/prestados/consultar-nfse-servico-tomado-envio-v2_04.xsd +58 -0
- package/schemas/giss/prestados/consultar-nfse-servico-tomado-resposta-v2_04.xsd +34 -0
- package/schemas/giss/prestados/enviar-lote-rps-envio-v2_04.xsd +26 -0
- package/schemas/giss/prestados/enviar-lote-rps-resposta-v2_04.xsd +32 -0
- package/schemas/giss/prestados/enviar-lote-rps-sincrono-envio-v2_04.xsd +26 -0
- package/schemas/giss/prestados/enviar-lote-rps-sincrono-resposta-v2_04.xsd +44 -0
- package/schemas/giss/prestados/gerar-nfse-envio-v2_04.xsd +24 -0
- package/schemas/giss/prestados/gerar-nfse-resposta-v2_04.xsd +36 -0
- package/schemas/giss/prestados/nfse_v2-04.xsd +3492 -0
- package/schemas/giss/prestados/substituir-nfse-envio-v2_04.xsd +37 -0
- package/schemas/giss/prestados/substituir-nfse-resposta-v2_04.xsd +51 -0
- package/schemas/giss/prestados/tipos-v2_04.xsd +3176 -0
- package/schemas/giss/prestados/xmldsig-core-schema20020212.xsd +316 -0
- package/schemas/giss/tomados/cancelar-nota-servico-comprado-envio-v1_00.xsd +26 -0
- package/schemas/giss/tomados/cancelar-nota-servico-comprado-resposta-v1_00.xsd +33 -0
- package/schemas/giss/tomados/consultar-lote-nota-servico-comprado-envio-v1_00.xsd +33 -0
- package/schemas/giss/tomados/consultar-lote-nota-servico-comprado-resposta-v1_00.xsd +51 -0
- package/schemas/giss/tomados/consultar-nota-servico-comprado-envio-v1_00.xsd +38 -0
- package/schemas/giss/tomados/consultar-nota-servico-comprado-resposta-v1_00.xsd +33 -0
- package/schemas/giss/tomados/consultar-protocolo-nota-servico-comprado-envio-v1_00.xsd +35 -0
- package/schemas/giss/tomados/consultar-protocolo-nota-servico-comprado-resposta-v1_00.xsd +34 -0
- package/schemas/giss/tomados/emitir-nota-servico-comprado-envio-v1_00.xsd +28 -0
- package/schemas/giss/tomados/emitir-nota-servico-comprado-resposta-v1_00.xsd +32 -0
- package/schemas/giss/tomados/enviar-lote-nota-servico-comprado-envio-v1_00.xsd +31 -0
- package/schemas/giss/tomados/enviar-lote-nota-servico-comprado-resposta-v1_00.xsd +40 -0
- package/schemas/giss/tomados/tipos-servicos-comprados-v1_00.xsd +3370 -0
- package/schemas/giss/tomados/tipos-servicos-comprados-v1_01.xsd +540 -0
- package/schemas/giss/tomados/vigente/LEIA-ME.md +10 -0
- package/schemas/giss/tomados/vigente/cancelar-nota-servico-comprado-envio-v1_00.xsd +26 -0
- package/schemas/giss/tomados/vigente/cancelar-nota-servico-comprado-resposta-v1_00.xsd +33 -0
- package/schemas/giss/tomados/vigente/consultar-lote-nota-servico-comprado-envio-v1_00.xsd +33 -0
- package/schemas/giss/tomados/vigente/consultar-lote-nota-servico-comprado-resposta-v1_00.xsd +51 -0
- package/schemas/giss/tomados/vigente/consultar-nota-servico-comprado-envio-v1_00.xsd +38 -0
- package/schemas/giss/tomados/vigente/consultar-nota-servico-comprado-resposta-v1_00.xsd +33 -0
- package/schemas/giss/tomados/vigente/consultar-protocolo-nota-servico-comprado-envio-v1_00.xsd +35 -0
- package/schemas/giss/tomados/vigente/consultar-protocolo-nota-servico-comprado-resposta-v1_00.xsd +34 -0
- package/schemas/giss/tomados/vigente/emitir-nota-servico-comprado-envio-v1_00.xsd +28 -0
- package/schemas/giss/tomados/vigente/emitir-nota-servico-comprado-resposta-v1_00.xsd +32 -0
- package/schemas/giss/tomados/vigente/enviar-lote-nota-servico-comprado-envio-v1_00.xsd +31 -0
- package/schemas/giss/tomados/vigente/enviar-lote-nota-servico-comprado-resposta-v1_00.xsd +40 -0
- package/schemas/giss/tomados/vigente/tipos-servicos-comprados-v1_00.xsd +3221 -0
- package/schemas/giss/tomados/vigente/xmldsig-core-schema20020212.xsd +316 -0
- package/schemas/giss/tomados/xmldsig-core-schema20020212.xsd +316 -0
- package/schemas/nacional/CNC_v1.00.xsd +14 -0
- package/schemas/nacional/DPS_v1.00.xsd +13 -0
- package/schemas/nacional/DPS_v1.01.xsd +14 -0
- package/schemas/nacional/NFSe_v1.00.xsd +14 -0
- package/schemas/nacional/NFSe_v1.01.xsd +15 -0
- package/schemas/nacional/evento_v1.00.xsd +15 -0
- package/schemas/nacional/evento_v1.01.xsd +15 -0
- package/schemas/nacional/pedRegEvento_v1.00.xsd +15 -0
- package/schemas/nacional/pedRegEvento_v1.01.xsd +15 -0
- package/schemas/nacional/tiposCnc_v1.00.xsd +166 -0
- package/schemas/nacional/tiposComplexos_v1.00.xsd +1828 -0
- package/schemas/nacional/tiposComplexos_v1.01.xsd +2709 -0
- package/schemas/nacional/tiposEventos_v1.00.xsd +733 -0
- package/schemas/nacional/tiposEventos_v1.01.xsd +780 -0
- package/schemas/nacional/tiposSimples_v1.00.xsd +1658 -0
- package/schemas/nacional/tiposSimples_v1.01.xsd +1844 -0
- package/schemas/nacional/xmldsig-core-schema.xsd +318 -0
- package/schemas/nacional-restrita/CNC_v1.00.xsd +14 -0
- package/schemas/nacional-restrita/DPS_v1.01.xsd +14 -0
- package/schemas/nacional-restrita/NFSe_v1.01.xsd +15 -0
- package/schemas/nacional-restrita/evento_v1.01.xsd +15 -0
- package/schemas/nacional-restrita/pedRegEvento_v1.01.xsd +15 -0
- package/schemas/nacional-restrita/tiposCnc_v1.00.xsd +166 -0
- package/schemas/nacional-restrita/tiposComplexos_v1.01.xsd +2747 -0
- package/schemas/nacional-restrita/tiposEventos_v1.01.xsd +780 -0
- package/schemas/nacional-restrita/tiposSimples_v1.01.xsd +1865 -0
- package/schemas/nacional-restrita/xmldsig-core-schema.xsd +309 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Caio Henrique Agiani Pimenta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,184 @@
|
|
|
1
|
-
#
|
|
1
|
+
# nfse-br
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node/TypeScript client and CLI for Brazilian service invoices (NFS-e), with two issuing
|
|
4
|
+
systems behind one certificate and one command line:
|
|
5
|
+
|
|
6
|
+
- **Sistema Nacional NFS-e** (SEFIN + ADN): the national issuer, and the way to issue for the
|
|
7
|
+
**Simples Nacional** since 2026-11-01 (Res. CGSN 191/2026). Issue, cancel, query, DANFSe.
|
|
8
|
+
See [docs/national.md](docs/national.md).
|
|
9
|
+
- **GissOnline** (legacy for the Simples): the Web Services of **32 cities** (24 in São Paulo,
|
|
10
|
+
including Guarulhos, Santos and Santo André). It follows ABRASF 2.04 with the LC 214/2025
|
|
11
|
+
extensions (NT SE/CGNFS-e nº 007). The city is one environment variable; see
|
|
12
|
+
[docs/municipalities.md](docs/municipalities.md).
|
|
13
|
+
|
|
14
|
+
Formerly `gissonline-nfse`. The `giss` command and `GissClient` still work as aliases.
|
|
15
|
+
|
|
16
|
+
On GissOnline it covers all **16 operations** of the two published SOAP services: `nfse`
|
|
17
|
+
(services provided) and `nfsc` (services received). It also covers the portal REST API,
|
|
18
|
+
the only way to reach the customer and supplier directory and the municipal activity table.
|
|
19
|
+
|
|
20
|
+
- Issue, cancel and replace invoices, single or in batches
|
|
21
|
+
- Queries by period, competence, number range, RPS and protocol
|
|
22
|
+
- The city activity table, where `CodigoTributacaoMunicipio` and its LC 116 item come from
|
|
23
|
+
- Declaration of received services (supplier invoices)
|
|
24
|
+
- XMLDSig signing with an A1 certificate, in the shape each operation requires
|
|
25
|
+
- Portal login with that same certificate, so no CPF and password are needed
|
|
26
|
+
- Fale Conosco messages: read the replies from the city hall, and open new ones
|
|
27
|
+
- Validation against the official XSD before sending
|
|
28
|
+
- National issuer: issue, cancel, query, DANFSe and the distribution of every invoice
|
|
29
|
+
where your CNPJ appears
|
|
30
|
+
- Typed errors that say whether a retry is safe; see [docs/errors.md](docs/errors.md)
|
|
31
|
+
- No write operation fires without `--confirm`
|
|
32
|
+
|
|
33
|
+
## Which system issues?
|
|
34
|
+
|
|
35
|
+
| Taxpayer | Issue with | Notes |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| ME/EPP in the Simples Nacional | **National** (the default) | GissOnline stopped issuing for them on 2026-11-01. Confirmed in production (Suzano, 2026-11-13) |
|
|
38
|
+
| Not in the Simples | National is also the default | In a city that has not adopted it, `issue` answers `E0039`: pass `--issuer giss` (check with `nfse national-status`) |
|
|
39
|
+
| MEI | National web issuer | Not exercised by this client; RN 239 exempts MEI from the city agreement too |
|
|
40
|
+
|
|
41
|
+
GissOnline is still the way to **read** what it already holds: invoices issued until
|
|
42
|
+
2026-10-31, the customer and supplier directory, the activity table and the Fale Conosco
|
|
43
|
+
messages. Its issuing, cancelling and replacing are still in the client, but a Simples optant
|
|
44
|
+
should not count on them: GissOnline blocks them since 2026-11-01, and on 2026-11-13 its
|
|
45
|
+
homologation environment refused an RPS with `E160` (schema). Not tested in production.
|
|
46
|
+
|
|
47
|
+
Numbering is separate: the national system numbers invoices from 1 per issuer, apart from
|
|
48
|
+
GissOnline's sequence. `nDPS` (the request number) is yours to choose with `--dps`.
|
|
49
|
+
|
|
50
|
+
## Requirements
|
|
51
|
+
|
|
52
|
+
- Node 22+. Running from the repository without a build needs 22.18+, where `.ts` files
|
|
53
|
+
execute natively
|
|
54
|
+
- A1 ICP-Brasil digital certificate (`.pfx`) for the provider
|
|
55
|
+
- `xmllint` (optional) — enables XSD validation before sending
|
|
56
|
+
|
|
57
|
+
## Install
|
|
58
|
+
|
|
59
|
+
### As a package
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install nfse-br # in a project
|
|
63
|
+
npm install -g nfse-br # or globally, for the nfse command
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The `nfse` binary (with `giss` kept as an alias) becomes available in the shell and reads the `.env` of the current
|
|
67
|
+
directory. Shell completion for bash and zsh is described in [docs/cli.md](docs/cli.md#shell-completion).
|
|
68
|
+
|
|
69
|
+
### From the repository
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install
|
|
73
|
+
cp .env.example .env # fill in the credentials
|
|
74
|
+
cp /path/to/certificate.pfx cert/ # the folder ships empty
|
|
75
|
+
npm run nfse -- latest # same as `nfse latest`
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Scripts: `npm run build` (compiles to `dist/`), `npm run typecheck`, `npm run nfse`.
|
|
79
|
+
|
|
80
|
+
`cert/` and `data/` are versioned empty (just a `.gitkeep`) to mark where the files go —
|
|
81
|
+
their contents never enter the repository.
|
|
82
|
+
|
|
83
|
+
## Quick start
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# National issuer — the default for `issue` (use --issuer giss for a city that has not adopted it)
|
|
87
|
+
nfse national-status # the city's agreement (see docs/national.md)
|
|
88
|
+
nfse issue --customer acme --amount 1500 --description "Consulting" --dps 7
|
|
89
|
+
nfse issue --customer acme --amount 1500 --description "Consulting" --dps 7 --confirm
|
|
90
|
+
nfse national-pdf --key <50-digit key> # the DANFSe, rendered from the invoice XML
|
|
91
|
+
nfse cancel --key <key> --reason 1 --text "Wrong service code, will be reissued" --confirm
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For an ME/EPP apportioned through the Simples the DPS carries no ISS rate (the DAS carries
|
|
95
|
+
it). Pass `--item`, `--cnae` and `--nbs` of the service you are billing: the default profile
|
|
96
|
+
is software development. Use `--dps N` in sequence so a retry is safe. The step by step, with
|
|
97
|
+
what the service refused and why, is in [docs/national.md](docs/national.md).
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# GissOnline (queries, directory, and issuing where the city still serves you)
|
|
101
|
+
nfse latest # the most recent invoices
|
|
102
|
+
nfse activities --company # activity codes this company can use
|
|
103
|
+
nfse issue --issuer giss --customer acme --amount 1500 --description "Consulting"
|
|
104
|
+
nfse issue --issuer giss --customer acme --amount 1500 --description "Consulting" --confirm
|
|
105
|
+
nfse pdf --number 573 # the invoice as a file
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import { NfseClient, PortalService } from "nfse-br";
|
|
110
|
+
|
|
111
|
+
// `nfse` and `nfsc` are the two Web Services; `config` and `certificate` come
|
|
112
|
+
// resolved. Destructuring a service is safe — destructuring a method is not.
|
|
113
|
+
const { nfse, config, certificate } = new NfseClient();
|
|
114
|
+
|
|
115
|
+
const { invoices } = await nfse.queryProvidedServices({
|
|
116
|
+
issuePeriod: { from: "2026-07-01", to: "2026-07-31" },
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// CodigoTributacaoMunicipio and its LC 116 item, from the city's own table.
|
|
120
|
+
// This route is public — no login, no certificate:
|
|
121
|
+
const activities = await PortalService.listActivities(config.cityCode);
|
|
122
|
+
// [{ code: "6319400", serviceListItem: "1.09", description: "Portais…", rate: 4 }, …]
|
|
123
|
+
|
|
124
|
+
// Anything company-specific needs a session. The A1 that signs the RPS opens
|
|
125
|
+
// the portal too, so no CPF and password are required:
|
|
126
|
+
const portal = await PortalService.authenticate({ certificate, cityCode: config.cityCode });
|
|
127
|
+
const mine = await portal.companyActivities(); // rate valid today, by default
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Nothing that writes fires without `--confirm`.
|
|
131
|
+
|
|
132
|
+
## Documentation
|
|
133
|
+
|
|
134
|
+
| | |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| [examples/](examples/) | Runnable scripts, all checked against production |
|
|
137
|
+
| [docs/cli.md](docs/cli.md) | Every command, completion, documents and lookups |
|
|
138
|
+
| [docs/municipalities.md](docs/municipalities.md) | The cities that publish the Web Service |
|
|
139
|
+
| [docs/library.md](docs/library.md) | Using it as a package, and the 16 operations |
|
|
140
|
+
| [docs/configuration.md](docs/configuration.md) | `.env`, serving several companies, tax profile, homologation |
|
|
141
|
+
| [docs/issuing.md](docs/issuing.md) | What actually issues an invoice, and why |
|
|
142
|
+
| [docs/national.md](docs/national.md) | The national issuer: the 2026-11-01 move for Simples Nacional, what the live service accepts, numbering |
|
|
143
|
+
| [docs/errors.md](docs/errors.md) | Error codes, retries, and what is safe to repeat |
|
|
144
|
+
| [docs/gotchas.md](docs/gotchas.md) | What the live service taught us the hard way |
|
|
145
|
+
| [docs/architecture.md](docs/architecture.md) | Layers, patterns, mTLS, SOAP and the signature |
|
|
146
|
+
|
|
147
|
+
Under `docs/`: technical manuals (Services Provided v1.6, Services Received/CST v2.5,
|
|
148
|
+
PIS/COFINS/CSLL v1.0), XML samples and the errors and alerts spreadsheet. The XSD live
|
|
149
|
+
in `schemas/`, one folder per provider.
|
|
150
|
+
Source: <https://suzano.giss.com.br/giss-ajuda/desenvolvedores.html>.
|
|
151
|
+
|
|
152
|
+
`schemas/giss/tomados/vigente/` carries the services-received XSD with the `tipos` v1_01
|
|
153
|
+
merged over v1_00 — necessary because the published v1_01 is a delta that does not compile
|
|
154
|
+
on its own. The originals stay untouched in the directory above.
|
|
155
|
+
|
|
156
|
+
## Security
|
|
157
|
+
|
|
158
|
+
Never committed (already covered by `.gitignore`):
|
|
159
|
+
|
|
160
|
+
- `.env` — certificate password and portal credentials
|
|
161
|
+
- `cert/*` — the `.pfx` and exported PEM files (the key is written **without a passphrase**,
|
|
162
|
+
mode `0600`)
|
|
163
|
+
- `data/*` — local directory and tax profile, holding third-party data
|
|
164
|
+
|
|
165
|
+
Two notes on the code: the `APP_ID` in `portal-service.ts` is not a secret — it is a public
|
|
166
|
+
constant from the portal bundle, sent by any browser that opens the site. And the signature
|
|
167
|
+
uses `rsa-sha1` with a `sha1` digest: weak by today's standards, but it is what the service
|
|
168
|
+
validates (manual, section 6.3).
|
|
169
|
+
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
Commits follow [Conventional Commits](https://www.conventionalcommits.org), enforced by a
|
|
173
|
+
local hook and a CI check. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
174
|
+
|
|
175
|
+
## Disclaimer
|
|
176
|
+
|
|
177
|
+
Independent project, not affiliated with Eicon, GissOnline or the Comitê Gestor da NFS-e. The portal REST API is
|
|
178
|
+
internal and has no public contract — it may change without notice. Issuing, cancelling or
|
|
179
|
+
replacing an invoice has real tax effects: check the profile values with your accountant
|
|
180
|
+
before using `--confirm` in production.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Digitized data copyright (c) 2010 Google Corporation
|
|
2
|
+
with Reserved Font Arimo, Tinos and Cousine.
|
|
3
|
+
Copyright (c) 2012 Red Hat, Inc.
|
|
4
|
+
with Reserved Font Name Liberation.
|
|
5
|
+
|
|
6
|
+
This Font Software is licensed under the SIL Open Font License,
|
|
7
|
+
Version 1.1.
|
|
8
|
+
|
|
9
|
+
This license is copied below, and is also available with a FAQ at:
|
|
10
|
+
http://scripts.sil.org/OFL
|
|
11
|
+
|
|
12
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
13
|
+
|
|
14
|
+
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
|
|
15
|
+
worldwide development of collaborative font projects, to support the font
|
|
16
|
+
creation efforts of academic and linguistic communities, and to provide
|
|
17
|
+
a free and open framework in which fonts may be shared and improved in
|
|
18
|
+
partnership with others.
|
|
19
|
+
|
|
20
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
21
|
+
redistributed freely as long as they are not sold by themselves.
|
|
22
|
+
The fonts, including any derivative works, can be bundled, embedded,
|
|
23
|
+
redistributed and/or sold with any software provided that any reserved
|
|
24
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
25
|
+
however, cannot be released under any other type of license. The
|
|
26
|
+
requirement for fonts to remain under this license does not apply to
|
|
27
|
+
any document created using the fonts or their derivatives.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
DEFINITIONS
|
|
32
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
33
|
+
Holder(s) under this license and clearly marked as such.
|
|
34
|
+
This may include source files, build scripts and documentation.
|
|
35
|
+
|
|
36
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
37
|
+
copyright statement(s).
|
|
38
|
+
|
|
39
|
+
"Original Version" refers to the collection of Font Software components
|
|
40
|
+
as distributed by the Copyright Holder(s).
|
|
41
|
+
|
|
42
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
43
|
+
or substituting ? in part or in whole ?
|
|
44
|
+
any of the components of the Original Version, by changing formats or
|
|
45
|
+
by porting the Font Software to a new environment.
|
|
46
|
+
|
|
47
|
+
"Author" refers to any designer, engineer, programmer, technical writer
|
|
48
|
+
or other person who contributed to the Font Software.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
PERMISSION & CONDITIONS
|
|
52
|
+
|
|
53
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
54
|
+
copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
55
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
56
|
+
Software, subject to the following conditions:
|
|
57
|
+
|
|
58
|
+
1) Neither the Font Software nor any of its individual components,in
|
|
59
|
+
Original or Modified Versions, may be sold by itself.
|
|
60
|
+
|
|
61
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
62
|
+
redistributed and/or sold with any software, provided that each copy
|
|
63
|
+
contains the above copyright notice and this license. These can be
|
|
64
|
+
included either as stand-alone text files, human-readable headers or
|
|
65
|
+
in the appropriate machine-readable metadata fields within text or
|
|
66
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
67
|
+
|
|
68
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
69
|
+
Name(s) unless explicit written permission is granted by the
|
|
70
|
+
corresponding Copyright Holder. This restriction only applies to the
|
|
71
|
+
primary font name as presented to the users.
|
|
72
|
+
|
|
73
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
74
|
+
Software shall not be used to promote, endorse or advertise any
|
|
75
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
76
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
77
|
+
permission.
|
|
78
|
+
|
|
79
|
+
5) The Font Software, modified or unmodified, in part or in whole, must
|
|
80
|
+
be distributed entirely under this license, and must not be distributed
|
|
81
|
+
under any other license. The requirement for fonts to remain under
|
|
82
|
+
this license does not apply to any document created using the Font
|
|
83
|
+
Software.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
TERMINATION
|
|
88
|
+
This license becomes null and void if any of the above conditions are not met.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
DISCLAIMER
|
|
93
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
94
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
95
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
96
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
97
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
98
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
99
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
100
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
|
101
|
+
DEALINGS IN THE FONT SOFTWARE.
|
|
102
|
+
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
#compdef nfse giss
|
|
2
|
+
# Zsh completion for the nfse CLI (and its giss alias).
|
|
3
|
+
#
|
|
4
|
+
# mkdir -p ~/.zsh/completions
|
|
5
|
+
# cp completions/_nfse ~/.zsh/completions/
|
|
6
|
+
# # in ~/.zshrc, before `compinit`:
|
|
7
|
+
# fpath=(~/.zsh/completions $fpath)
|
|
8
|
+
#
|
|
9
|
+
# With oh-my-zsh, ~/.oh-my-zsh/completions is already on fpath.
|
|
10
|
+
|
|
11
|
+
_nfse() {
|
|
12
|
+
local -a commands global_opts
|
|
13
|
+
local context state line
|
|
14
|
+
|
|
15
|
+
commands=(
|
|
16
|
+
'cert:A1 certificate details'
|
|
17
|
+
'latest:Most recent invoices'
|
|
18
|
+
'issued:Invoices by issue or competence period'
|
|
19
|
+
'range:Invoices by number range'
|
|
20
|
+
'rps:Invoice generated from an RPS'
|
|
21
|
+
'batch:Status of an RPS batch'
|
|
22
|
+
'received:Invoices where you are the customer'
|
|
23
|
+
'purchased-batch:Invoices declared in a batch (nfsc)'
|
|
24
|
+
'purchased-protocol:Status of a protocol (nfsc)'
|
|
25
|
+
'purchased-number:Received invoices by declared number'
|
|
26
|
+
'issue:Issue an invoice'
|
|
27
|
+
'cancel:Cancel an invoice'
|
|
28
|
+
'replace:Cancel and reissue an invoice'
|
|
29
|
+
'customers:List or sync customers'
|
|
30
|
+
'suppliers:List or sync suppliers'
|
|
31
|
+
'customer-add:Add a customer to the local directory'
|
|
32
|
+
'supplier-add:Add a supplier to the local directory'
|
|
33
|
+
'customer-rm:Remove a customer'
|
|
34
|
+
'supplier-rm:Remove a supplier'
|
|
35
|
+
'portal-list:Portal directory'
|
|
36
|
+
'portal-add:Register in the portal'
|
|
37
|
+
'portal-rm:Remove from the portal'
|
|
38
|
+
'portal-import:Import the portal directory'
|
|
39
|
+
'pdf:Download the invoice PDF'
|
|
40
|
+
'xml:Download the invoice XML'
|
|
41
|
+
'cities:Cities known to publish the Web Service'
|
|
42
|
+
'activities:Municipal activity table (CodigoTributacaoMunicipio)'
|
|
43
|
+
'messages:Fale Conosco messages you opened'
|
|
44
|
+
'message:Open a message to the city hall'
|
|
45
|
+
'zip:Look up a postal code (BrasilAPI)'
|
|
46
|
+
'cnpj:Look up a company by CNPJ (BrasilAPI)'
|
|
47
|
+
'profile:Show or save the tax profile defaults'
|
|
48
|
+
'national-status:City adhesion to the national issuer'
|
|
49
|
+
'national-get:National invoice by access key'
|
|
50
|
+
'national-pdf:Download the DANFSe'
|
|
51
|
+
'national-xml:Download the national invoice XML'
|
|
52
|
+
'national-docs:Invoices and events where your CNPJ appears'
|
|
53
|
+
'danfse:DANFSe from a saved national XML (offline)'
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
global_opts=(
|
|
57
|
+
'--env[Environment]:environment:(producao homologacao)'
|
|
58
|
+
'--issuer[Who issues]:issuer:(giss nacional)'
|
|
59
|
+
'--json[JSON output]'
|
|
60
|
+
'--xml[Raw XML output]'
|
|
61
|
+
'--debug[Log the XML sent and received]'
|
|
62
|
+
'--help[Show help]'
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
_arguments -C \
|
|
66
|
+
'1: :->command' \
|
|
67
|
+
'*:: :->args' && return 0
|
|
68
|
+
|
|
69
|
+
case $state in
|
|
70
|
+
command)
|
|
71
|
+
_describe -t commands 'giss command' commands && return 0
|
|
72
|
+
;;
|
|
73
|
+
args)
|
|
74
|
+
case $words[1] in
|
|
75
|
+
cert)
|
|
76
|
+
_arguments $global_opts '--export[Write the PEM files]' '--out[Target directory]:directory:_files -/'
|
|
77
|
+
;;
|
|
78
|
+
latest)
|
|
79
|
+
_arguments $global_opts '--limit[How many invoices]:number:' '--months[How far back]:number:'
|
|
80
|
+
;;
|
|
81
|
+
issued|received)
|
|
82
|
+
_arguments $global_opts \
|
|
83
|
+
'--from[Start date]:date (YYYY-MM-DD):' \
|
|
84
|
+
'--to[End date]:date (YYYY-MM-DD):' \
|
|
85
|
+
'--competence[Use the competence period]' \
|
|
86
|
+
'--number[Specific invoice number]:number:' \
|
|
87
|
+
'--page[Result page]:number:' \
|
|
88
|
+
'--all[Walk every page]'
|
|
89
|
+
;;
|
|
90
|
+
range)
|
|
91
|
+
_arguments $global_opts '--first[First number]:number:' '--last[Last number]:number:' '--page[Result page]:number:'
|
|
92
|
+
;;
|
|
93
|
+
rps)
|
|
94
|
+
_arguments $global_opts '--number[RPS number]:number:' '--series[RPS series]:series:' '--type[RPS type]:type:(1 2 3)'
|
|
95
|
+
;;
|
|
96
|
+
batch|purchased-batch|purchased-protocol)
|
|
97
|
+
_arguments $global_opts '--protocol[Protocol]:protocol:'
|
|
98
|
+
;;
|
|
99
|
+
purchased-number)
|
|
100
|
+
_arguments $global_opts '--from[Start date]:date:' '--to[End date]:date:' \
|
|
101
|
+
'--number[Declared number]:number:' '--series[Declared series]:series:'
|
|
102
|
+
;;
|
|
103
|
+
issue)
|
|
104
|
+
_arguments $global_opts \
|
|
105
|
+
'--customer[Tax id or alias]:customer:' \
|
|
106
|
+
'--amount[Service amount]:amount:' \
|
|
107
|
+
'--description[Service description]:text:' \
|
|
108
|
+
'--competence[Competence date]:date (YYYY-MM-DD):' \
|
|
109
|
+
'--rps[RPS number]:number:' \
|
|
110
|
+
'--series[RPS series]:series:' \
|
|
111
|
+
'--item[LC 116 item]:item:' \
|
|
112
|
+
'--cnae[CNAE code]:code:' \
|
|
113
|
+
'--nbs[NBS code]:code:' \
|
|
114
|
+
'--rate[ISS rate in percent]:rate:' \
|
|
115
|
+
'--csll[CSLL withheld]:amount:' \
|
|
116
|
+
'--inss[INSS withheld]:amount:' \
|
|
117
|
+
'--income-tax[Income tax withheld]:amount:' \
|
|
118
|
+
'--notes[Additional information]:text:' \
|
|
119
|
+
'--confirm[Actually issue it]'
|
|
120
|
+
;;
|
|
121
|
+
cancel)
|
|
122
|
+
_arguments $global_opts '--number[Invoice number]:number:' \
|
|
123
|
+
'--reason[Cancellation reason]:reason:((1\:"issuing error" 2\:"service not provided" 3\:"signature error" 4\:"duplicate invoice" 5\:"processing error"))' \
|
|
124
|
+
'--confirm[Actually cancel it]'
|
|
125
|
+
;;
|
|
126
|
+
replace)
|
|
127
|
+
_arguments $global_opts '--number[Invoice number]:number:' \
|
|
128
|
+
'--reason[Cancellation reason]:reason:(1 2 3 4 5)' \
|
|
129
|
+
'--customer[Tax id or alias]:customer:' '--amount[Service amount]:amount:' \
|
|
130
|
+
'--description[Service description]:text:' '--confirm[Actually replace it]'
|
|
131
|
+
;;
|
|
132
|
+
customers|suppliers)
|
|
133
|
+
_arguments $global_opts '--sync[Sync from invoices]' '--from[Start date]:date:' '--to[End date]:date:'
|
|
134
|
+
;;
|
|
135
|
+
customer-add|supplier-add|portal-add)
|
|
136
|
+
_arguments $global_opts \
|
|
137
|
+
'--tax-id[CPF or CNPJ]:tax id:' '--name[Legal name]:name:' '--alias[Short alias]:alias:' \
|
|
138
|
+
'--registration[Municipal registration]:number:' '--email[Email]:email:' '--phone[Phone]:phone:' \
|
|
139
|
+
'--trade-name[Trade name]:name:' '--street[Street]:street:' '--number[Street number]:number:' \
|
|
140
|
+
'--district[District]:district:' '--city[City IBGE code]:code:' '--state[State]:uf:' \
|
|
141
|
+
'--zip[Zip code]:zip:' '--complement[Complement]:text:' '--street-type[Street type]:type:' \
|
|
142
|
+
'--simples[Simples Nacional]:option:(1 2)' '--mei[MEI]' '--type[Role]:role:((1\:customer 2\:supplier))' \
|
|
143
|
+
'--confirm[Actually save it]'
|
|
144
|
+
;;
|
|
145
|
+
customer-rm|supplier-rm)
|
|
146
|
+
_arguments $global_opts '--tax-id[CPF or CNPJ]:tax id:'
|
|
147
|
+
;;
|
|
148
|
+
portal-rm)
|
|
149
|
+
_arguments $global_opts '--tax-id[CPF or CNPJ]:tax id:' '--type[Role]:role:(1 2)' '--confirm[Actually remove it]'
|
|
150
|
+
;;
|
|
151
|
+
portal-list|portal-import)
|
|
152
|
+
_arguments $global_opts '--type[Role]:role:((1\:customer 2\:supplier))'
|
|
153
|
+
;;
|
|
154
|
+
pdf|xml)
|
|
155
|
+
_arguments $global_opts '--number[Invoice number]:number:' \
|
|
156
|
+
'--out[Target directory or file]:target:_files'
|
|
157
|
+
;;
|
|
158
|
+
cities)
|
|
159
|
+
_arguments $global_opts '--state[Filter by state]:uf:(AL GO MG PE PR SP)'
|
|
160
|
+
;;
|
|
161
|
+
messages)
|
|
162
|
+
_arguments $global_opts '--id[Message id]:id:' '--unread[Only unanswered replies]' \
|
|
163
|
+
'--attachment[Attachment id to download]:id:' '--out[Target directory]:directory:_files -/' \
|
|
164
|
+
'--city[City IBGE code]:code:'
|
|
165
|
+
;;
|
|
166
|
+
message)
|
|
167
|
+
_arguments $global_opts '--subject[Subject]:text:' '--text[Message body]:text:' \
|
|
168
|
+
'--city[City IBGE code]:code:' '--confirm[Actually send it]'
|
|
169
|
+
;;
|
|
170
|
+
activities)
|
|
171
|
+
_arguments $global_opts '--item[LC 116 item]:item:' '--city[City IBGE code]:code:' \
|
|
172
|
+
'--company[Only what the company is bound to]' '--date[Rate valid on this date]:date (YYYY-MM-DD):'
|
|
173
|
+
;;
|
|
174
|
+
national-get)
|
|
175
|
+
_arguments $global_opts '--key[50-digit access key]:key:'
|
|
176
|
+
;;
|
|
177
|
+
national-pdf|national-xml)
|
|
178
|
+
_arguments $global_opts '--key[50-digit access key]:key:' \
|
|
179
|
+
'--out[Target directory or file]:target:_files'
|
|
180
|
+
;;
|
|
181
|
+
national-docs)
|
|
182
|
+
_arguments $global_opts '--from[Start after this NSU]:nsu:'
|
|
183
|
+
;;
|
|
184
|
+
danfse)
|
|
185
|
+
_arguments $global_opts '*--event[Event XML of the invoice]:event:_files -g "*.xml"' \
|
|
186
|
+
'--status[Watermark]:status:(cancelled replaced)' \
|
|
187
|
+
'--out[Target directory or file]:target:_files' '1:invoice XML:_files -g "*.xml"'
|
|
188
|
+
;;
|
|
189
|
+
profile)
|
|
190
|
+
_arguments $global_opts '--save[Write to data/profile.json]'
|
|
191
|
+
;;
|
|
192
|
+
*)
|
|
193
|
+
_arguments $global_opts
|
|
194
|
+
;;
|
|
195
|
+
esac
|
|
196
|
+
;;
|
|
197
|
+
esac
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
_nfse "$@"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Bash completion for the nfse CLI (and its giss alias). For zsh use `_nfse` in this same folder.
|
|
2
|
+
# source completions/nfse.bash
|
|
3
|
+
# or copy it to /usr/local/etc/bash_completion.d/ (or /etc/bash_completion.d/).
|
|
4
|
+
_nfse_completions() {
|
|
5
|
+
local cur prev commands global_opts opts
|
|
6
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
7
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
8
|
+
|
|
9
|
+
commands="cert latest issued range rps batch received purchased-batch \
|
|
10
|
+
purchased-protocol purchased-number issue cancel replace customers \
|
|
11
|
+
suppliers customer-add supplier-add customer-rm supplier-rm \
|
|
12
|
+
portal-list portal-add portal-rm portal-import pdf xml zip cnpj cities \
|
|
13
|
+
activities messages message profile national-status national-get \
|
|
14
|
+
national-pdf national-xml national-docs danfse"
|
|
15
|
+
|
|
16
|
+
global_opts="--env --issuer --json --xml --debug --help"
|
|
17
|
+
|
|
18
|
+
# known values for some flags
|
|
19
|
+
case "$prev" in
|
|
20
|
+
--env) COMPREPLY=($(compgen -W "producao homologacao" -- "$cur")); return ;;
|
|
21
|
+
--issuer) COMPREPLY=($(compgen -W "giss nacional" -- "$cur")); return ;;
|
|
22
|
+
--reason) COMPREPLY=($(compgen -W "1 2 3 4 5" -- "$cur")); return ;;
|
|
23
|
+
--type) COMPREPLY=($(compgen -W "1 2" -- "$cur")); return ;;
|
|
24
|
+
--simples) COMPREPLY=($(compgen -W "1 2" -- "$cur")); return ;;
|
|
25
|
+
--out) COMPREPLY=($(compgen -d -- "$cur")); return ;;
|
|
26
|
+
esac
|
|
27
|
+
|
|
28
|
+
# first argument: the command
|
|
29
|
+
if [ "$COMP_CWORD" -eq 1 ]; then
|
|
30
|
+
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
|
|
31
|
+
return
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
case "${COMP_WORDS[1]}" in
|
|
35
|
+
cert) opts="--export --out" ;;
|
|
36
|
+
latest) opts="--limit --months" ;;
|
|
37
|
+
issued|received) opts="--from --to --competence --number --page --all" ;;
|
|
38
|
+
range) opts="--first --last --page" ;;
|
|
39
|
+
rps) opts="--number --series --type" ;;
|
|
40
|
+
batch|purchased-batch|purchased-protocol) opts="--protocol" ;;
|
|
41
|
+
purchased-number) opts="--from --to --number --series" ;;
|
|
42
|
+
issue) opts="--customer --amount --description --competence --rps --series \
|
|
43
|
+
--item --cnae --nbs --rate --csll --inss --income-tax --notes --confirm" ;;
|
|
44
|
+
cancel) opts="--number --reason --confirm" ;;
|
|
45
|
+
replace) opts="--number --reason --customer --amount --description --confirm" ;;
|
|
46
|
+
customers|suppliers) opts="--sync --from --to" ;;
|
|
47
|
+
customer-add|supplier-add|portal-add)
|
|
48
|
+
opts="--tax-id --name --alias --registration --email --phone --trade-name \
|
|
49
|
+
--street --number --district --city --state --zip --complement --street-type \
|
|
50
|
+
--simples --mei --type --confirm" ;;
|
|
51
|
+
customer-rm|supplier-rm) opts="--tax-id" ;;
|
|
52
|
+
portal-rm) opts="--tax-id --type --confirm" ;;
|
|
53
|
+
portal-list|portal-import) opts="--type" ;;
|
|
54
|
+
pdf|xml) opts="--number --out" ;;
|
|
55
|
+
cities) opts="--state" ;;
|
|
56
|
+
activities) opts="--item --city --company --date" ;;
|
|
57
|
+
national-get) opts="--key" ;;
|
|
58
|
+
national-pdf|national-xml) opts="--key --out" ;;
|
|
59
|
+
national-docs) opts="--from" ;;
|
|
60
|
+
danfse) opts="--event --status --out" ;;
|
|
61
|
+
messages) opts="--id --unread --attachment --out --city" ;;
|
|
62
|
+
message) opts="--subject --text --city --confirm" ;;
|
|
63
|
+
profile) opts="--save" ;;
|
|
64
|
+
*) opts="" ;;
|
|
65
|
+
esac
|
|
66
|
+
|
|
67
|
+
COMPREPLY=($(compgen -W "$opts $global_opts" -- "$cur"))
|
|
68
|
+
}
|
|
69
|
+
complete -F _nfse_completions nfse giss
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|