@bitize/bitmde 0.18.0 → 0.20.0
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/CHANGELOG.md +64 -0
- package/README.md +309 -4
- package/dist/apis/distribuicaoDFe-api.d.ts +13 -1
- package/dist/apis/distribuicaoNFSe-api.d.ts +176 -0
- package/dist/apis/manifestacaoNFSe-api.d.ts +130 -0
- package/dist/apis/recepcaoEvento-api.d.ts +5 -1
- package/dist/controllers/distribuicaoDFe-controller.d.ts +5 -1
- package/dist/controllers/distribuicaoNFSe-controller.d.ts +50 -0
- package/dist/controllers/index.d.ts +84 -0
- package/dist/controllers/manifestacaoNFSe-controller.d.ts +38 -0
- package/dist/controllers/recepcaoEvento-controller.d.ts +5 -1
- package/dist/env/ca.d.ts +8 -2
- package/dist/env/index.d.ts +5 -1
- package/dist/env/nfse.d.ts +32 -0
- package/dist/helpers/distribuicaoDFe-helper.d.ts +4 -0
- package/dist/helpers/distribuicaoNFSe-helper.d.ts +107 -0
- package/dist/helpers/index.d.ts +158 -0
- package/dist/helpers/manifestacaoNFSe-helper.d.ts +80 -0
- package/dist/helpers/recepcaoEvento-helper.d.ts +4 -0
- package/dist/helpers/retorno-helper.d.ts +5 -0
- package/dist/helpers/retornoNfse-helper.d.ts +44 -0
- package/dist/index.d.ts +13 -1
- package/dist/schemas/index.d.ts +17 -0
- package/dist/schemas/manifestacaoNFSe-schema.d.ts +33 -0
- package/dist/services/sefaz-service.d.ts +8 -1
- package/dist/util/assinatura.d.ts +3 -1
- package/dist/util/gzip.d.ts +7 -0
- package/dist/util/index.d.ts +2 -1
- package/dist/validators/chaveNfse-validator.d.ts +14 -0
- package/dist/validators/cnpj-validator.d.ts +19 -0
- package/dist/validators/index.d.ts +50 -0
- package/dist/validators/motivoRejeicao-validator.d.ts +23 -0
- package/dist/validators/nsuNfse-validator.d.ts +20 -0
- package/lib/apis/distribuicaoNFSe-api.js +59 -0
- package/lib/apis/manifestacaoNFSe-api.js +69 -0
- package/lib/controllers/distribuicaoNFSe-controller.js +16 -0
- package/lib/controllers/index.js +3 -1
- package/lib/controllers/manifestacaoNFSe-controller.js +25 -0
- package/lib/env/ca.js +3 -2
- package/lib/env/index.js +12 -1
- package/lib/env/nfse.js +24 -0
- package/lib/env/version.js +1 -1
- package/lib/helpers/distribuicaoDFe-helper.js +2 -2
- package/lib/helpers/distribuicaoNFSe-helper.js +128 -0
- package/lib/helpers/index.js +5 -2
- package/lib/helpers/manifestacaoNFSe-helper.js +105 -0
- package/lib/helpers/recepcaoEvento-helper.js +2 -2
- package/lib/helpers/retorno-helper.js +16 -9
- package/lib/helpers/retornoNfse-helper.js +31 -0
- package/lib/index.js +13 -1
- package/lib/schemas/index.js +2 -1
- package/lib/schemas/manifestacaoNFSe-schema.js +19 -0
- package/lib/services/sefaz-service.js +15 -14
- package/lib/util/assinatura.js +2 -2
- package/lib/util/gzip.js +8 -0
- package/lib/validators/chaveNfse-validator.js +16 -0
- package/lib/validators/cnpj-validator.js +21 -0
- package/lib/validators/index.js +5 -1
- package/lib/validators/motivoRejeicao-validator.js +28 -0
- package/lib/validators/nsuNfse-validator.js +18 -0
- package/package.json +10 -4
package/dist/helpers/index.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ declare const helper: Readonly<{
|
|
|
5
5
|
enviarConsulta(data: string, opts: any): Promise<{
|
|
6
6
|
status: number;
|
|
7
7
|
data: string;
|
|
8
|
+
transportError?: {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
8
12
|
}>;
|
|
9
13
|
montarRequest(opts: any): string;
|
|
10
14
|
montarResponse(data: string): Promise<{
|
|
@@ -39,11 +43,134 @@ declare const helper: Readonly<{
|
|
|
39
43
|
error: string;
|
|
40
44
|
}>;
|
|
41
45
|
};
|
|
46
|
+
DistribuicaoNFSeHelper: {
|
|
47
|
+
new (): {};
|
|
48
|
+
enviarConsulta(config: any, opts: any): Promise<{
|
|
49
|
+
status: number;
|
|
50
|
+
data: string;
|
|
51
|
+
transportError?: {
|
|
52
|
+
code: string;
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
}>;
|
|
56
|
+
montarRequest(opts: any): {
|
|
57
|
+
method: string;
|
|
58
|
+
url: string;
|
|
59
|
+
params?: {
|
|
60
|
+
lote: boolean;
|
|
61
|
+
cnpjConsulta: string;
|
|
62
|
+
};
|
|
63
|
+
headers: any;
|
|
64
|
+
responseType: string;
|
|
65
|
+
};
|
|
66
|
+
montarResponse(corpo: string, cnpj: string): Promise<{
|
|
67
|
+
statusProcessamento: string;
|
|
68
|
+
tipoAmbiente: string;
|
|
69
|
+
versaoAplicativo: string;
|
|
70
|
+
dataHoraProcessamento: string;
|
|
71
|
+
alertas: {
|
|
72
|
+
codigo: string;
|
|
73
|
+
descricao: string;
|
|
74
|
+
complemento: string;
|
|
75
|
+
}[];
|
|
76
|
+
erros: {
|
|
77
|
+
codigo: string;
|
|
78
|
+
descricao: string;
|
|
79
|
+
complemento: string;
|
|
80
|
+
}[];
|
|
81
|
+
documentos: {
|
|
82
|
+
nsu: string;
|
|
83
|
+
chaveAcesso: string;
|
|
84
|
+
tipoDocumento: string;
|
|
85
|
+
tipoEvento: string;
|
|
86
|
+
dataHoraGeracao: string;
|
|
87
|
+
papel: string;
|
|
88
|
+
xml: string;
|
|
89
|
+
json: any;
|
|
90
|
+
}[];
|
|
91
|
+
documentosErros: {
|
|
92
|
+
nsu: string;
|
|
93
|
+
chaveAcesso: string;
|
|
94
|
+
tipoDocumento: string;
|
|
95
|
+
error: string;
|
|
96
|
+
}[];
|
|
97
|
+
} | null>;
|
|
98
|
+
abrirArquivoXml(item: any, cnpj: string): Promise<{
|
|
99
|
+
nsu: string;
|
|
100
|
+
chaveAcesso: string;
|
|
101
|
+
tipoDocumento: string;
|
|
102
|
+
tipoEvento: string;
|
|
103
|
+
dataHoraGeracao: string;
|
|
104
|
+
papel: string;
|
|
105
|
+
xml: string;
|
|
106
|
+
json: any;
|
|
107
|
+
} | {
|
|
108
|
+
nsu: string;
|
|
109
|
+
chaveAcesso: string;
|
|
110
|
+
tipoDocumento: string;
|
|
111
|
+
error: string;
|
|
112
|
+
}>;
|
|
113
|
+
calcularPapel(tipoDocumento: string, json: any, cnpj: string): "" | "tomador" | "prestador" | "intermediario";
|
|
114
|
+
};
|
|
115
|
+
ManifestacaoNFSeHelper: {
|
|
116
|
+
new (): {};
|
|
117
|
+
enviarEvento(config: any, opts: any): Promise<{
|
|
118
|
+
status: number;
|
|
119
|
+
data: string;
|
|
120
|
+
transportError?: {
|
|
121
|
+
code: string;
|
|
122
|
+
message: string;
|
|
123
|
+
};
|
|
124
|
+
}>;
|
|
125
|
+
montarRequest(opts: any): Promise<{
|
|
126
|
+
reqXml: string;
|
|
127
|
+
config: {
|
|
128
|
+
method: string;
|
|
129
|
+
url: string;
|
|
130
|
+
data: string;
|
|
131
|
+
headers: any;
|
|
132
|
+
responseType: string;
|
|
133
|
+
};
|
|
134
|
+
}>;
|
|
135
|
+
montarResponse(corpo: string): Promise<{
|
|
136
|
+
json: {
|
|
137
|
+
tipoAmbiente: string;
|
|
138
|
+
versaoAplicativo: string;
|
|
139
|
+
dataHoraProcessamento: string;
|
|
140
|
+
alertas: {
|
|
141
|
+
codigo: string;
|
|
142
|
+
descricao: string;
|
|
143
|
+
complemento: string;
|
|
144
|
+
}[];
|
|
145
|
+
erros: {
|
|
146
|
+
codigo: string;
|
|
147
|
+
descricao: string;
|
|
148
|
+
complemento: string;
|
|
149
|
+
}[];
|
|
150
|
+
evento: {
|
|
151
|
+
xml?: string;
|
|
152
|
+
json?: any;
|
|
153
|
+
};
|
|
154
|
+
} | null;
|
|
155
|
+
falha?: string;
|
|
156
|
+
}>;
|
|
157
|
+
abrirEvento(eventoXmlGZipB64: string): Promise<{
|
|
158
|
+
evento: {
|
|
159
|
+
xml?: string;
|
|
160
|
+
json?: any;
|
|
161
|
+
};
|
|
162
|
+
falha?: string;
|
|
163
|
+
}>;
|
|
164
|
+
};
|
|
42
165
|
RecepcaoHelper: {
|
|
43
166
|
new (): {};
|
|
44
167
|
enviarEvento(data: string, opts: any): Promise<{
|
|
45
168
|
status: number;
|
|
46
169
|
data: string;
|
|
170
|
+
transportError?: {
|
|
171
|
+
code: string;
|
|
172
|
+
message: string;
|
|
173
|
+
};
|
|
47
174
|
}>;
|
|
48
175
|
montarRequest(opts: any): string;
|
|
49
176
|
montarResponse(data: string): {
|
|
@@ -78,6 +205,10 @@ declare const helper: Readonly<{
|
|
|
78
205
|
retornoSefaz: {
|
|
79
206
|
data: string;
|
|
80
207
|
status: number;
|
|
208
|
+
transportError?: {
|
|
209
|
+
code: string;
|
|
210
|
+
message: string;
|
|
211
|
+
};
|
|
81
212
|
};
|
|
82
213
|
}): {
|
|
83
214
|
data: any;
|
|
@@ -86,4 +217,31 @@ declare const helper: Readonly<{
|
|
|
86
217
|
status: number;
|
|
87
218
|
};
|
|
88
219
|
};
|
|
220
|
+
RetornoNfseHelper: {
|
|
221
|
+
new (): {};
|
|
222
|
+
montarRetorno(options: {
|
|
223
|
+
json: any | null;
|
|
224
|
+
retorno: {
|
|
225
|
+
data: string;
|
|
226
|
+
status: number;
|
|
227
|
+
transportError?: {
|
|
228
|
+
code: string;
|
|
229
|
+
message: string;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
servico?: "ADN" | "SEFIN";
|
|
233
|
+
reqXml?: string;
|
|
234
|
+
falha?: string;
|
|
235
|
+
}): {
|
|
236
|
+
data: any;
|
|
237
|
+
reqXml?: string;
|
|
238
|
+
resBody: string;
|
|
239
|
+
status: number;
|
|
240
|
+
error?: string;
|
|
241
|
+
transportError?: {
|
|
242
|
+
code: string;
|
|
243
|
+
message: string;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
};
|
|
89
247
|
}>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
declare const _exports: typeof ManifestacaoNFSeHelper;
|
|
2
|
+
export = _exports;
|
|
3
|
+
declare class ManifestacaoNFSeHelper {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} config
|
|
7
|
+
* @param {Object} opts
|
|
8
|
+
* @returns {Promise<{status: number, data: string, transportError?: {code: string, message: string}}>}
|
|
9
|
+
*/
|
|
10
|
+
static enviarEvento(config: any, opts: any): Promise<{
|
|
11
|
+
status: number;
|
|
12
|
+
data: string;
|
|
13
|
+
transportError?: {
|
|
14
|
+
code: string;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Monta e assina o `pedRegEvento`, e a config do `POST` ao axios. Os
|
|
20
|
+
* headers vão na requisição, e não na instância, para o axios mesclá-los
|
|
21
|
+
* com o User-Agent.
|
|
22
|
+
*
|
|
23
|
+
* @param {Object} opts
|
|
24
|
+
* @returns {Promise<{reqXml: string, config: {method: string, url: string, data: string, headers: Object, responseType: string}}>}
|
|
25
|
+
*/
|
|
26
|
+
static montarRequest(opts: any): Promise<{
|
|
27
|
+
reqXml: string;
|
|
28
|
+
config: {
|
|
29
|
+
method: string;
|
|
30
|
+
url: string;
|
|
31
|
+
data: string;
|
|
32
|
+
headers: any;
|
|
33
|
+
responseType: string;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Interpreta o corpo cru da SEFIN. Nunca lança: corpo que não é JSON, ou
|
|
38
|
+
* JSON sem `eventoXmlGZipB64` nem `erro`, devolve `json: null`. Evento
|
|
39
|
+
* retornado que não abre devolve `falha`, que o retorno transforma em
|
|
40
|
+
* `error`.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} corpo
|
|
43
|
+
* @returns {Promise<{json: {tipoAmbiente: string, versaoAplicativo: string, dataHoraProcessamento: string, alertas: {codigo: string, descricao: string, complemento: string}[], erros: {codigo: string, descricao: string, complemento: string}[], evento: {xml?: string, json?: Object}} | null, falha?: string}>}
|
|
44
|
+
*/
|
|
45
|
+
static montarResponse(corpo: string): Promise<{
|
|
46
|
+
json: {
|
|
47
|
+
tipoAmbiente: string;
|
|
48
|
+
versaoAplicativo: string;
|
|
49
|
+
dataHoraProcessamento: string;
|
|
50
|
+
alertas: {
|
|
51
|
+
codigo: string;
|
|
52
|
+
descricao: string;
|
|
53
|
+
complemento: string;
|
|
54
|
+
}[];
|
|
55
|
+
erros: {
|
|
56
|
+
codigo: string;
|
|
57
|
+
descricao: string;
|
|
58
|
+
complemento: string;
|
|
59
|
+
}[];
|
|
60
|
+
evento: {
|
|
61
|
+
xml?: string;
|
|
62
|
+
json?: any;
|
|
63
|
+
};
|
|
64
|
+
} | null;
|
|
65
|
+
falha?: string;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Descompacta e interpreta o evento registrado, sem nunca rejeitar.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} eventoXmlGZipB64
|
|
71
|
+
* @returns {Promise<{evento: {xml?: string, json?: Object}, falha?: string}>}
|
|
72
|
+
*/
|
|
73
|
+
static abrirEvento(eventoXmlGZipB64: string): Promise<{
|
|
74
|
+
evento: {
|
|
75
|
+
xml?: string;
|
|
76
|
+
json?: any;
|
|
77
|
+
};
|
|
78
|
+
falha?: string;
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
@@ -9,6 +9,7 @@ declare class RetornoHelper {
|
|
|
9
9
|
* @param {Object} options.retornoSefaz
|
|
10
10
|
* @param {string} options.retornoSefaz.data
|
|
11
11
|
* @param {number} options.retornoSefaz.status
|
|
12
|
+
* @param {{code: string, message: string}} [options.retornoSefaz.transportError]
|
|
12
13
|
* @returns
|
|
13
14
|
*/
|
|
14
15
|
static montarRetorno(options: {
|
|
@@ -17,6 +18,10 @@ declare class RetornoHelper {
|
|
|
17
18
|
retornoSefaz: {
|
|
18
19
|
data: string;
|
|
19
20
|
status: number;
|
|
21
|
+
transportError?: {
|
|
22
|
+
code: string;
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
20
25
|
};
|
|
21
26
|
}): {
|
|
22
27
|
data: any;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const _exports: typeof RetornoNfseHelper;
|
|
2
|
+
export = _exports;
|
|
3
|
+
declare class RetornoNfseHelper {
|
|
4
|
+
/**
|
|
5
|
+
* Formato de retorno das APIs da NFS-e. `status`, `error` e
|
|
6
|
+
* `transportError` têm o mesmo significado das APIs de NF-e; o corpo cru
|
|
7
|
+
* vai em `resBody`.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} options
|
|
10
|
+
* @param {Object | null} options.json `null` quando o corpo não é uma resposta do serviço
|
|
11
|
+
* @param {Object} options.retorno
|
|
12
|
+
* @param {string} options.retorno.data
|
|
13
|
+
* @param {number} options.retorno.status
|
|
14
|
+
* @param {{code: string, message: string}} [options.retorno.transportError]
|
|
15
|
+
* @param {'ADN' | 'SEFIN'} [options.servico = 'ADN'] Nomeia o serviço na mensagem de resposta inesperada
|
|
16
|
+
* @param {string} [options.reqXml] XML de domínio enviado; só existe na manifestação
|
|
17
|
+
* @param {string} [options.falha] Falha do helper ao ler uma resposta bem-sucedida
|
|
18
|
+
* @returns {{data: Object, reqXml?: string, resBody: string, status: number, error?: string, transportError?: {code: string, message: string}}}
|
|
19
|
+
*/
|
|
20
|
+
static montarRetorno(options: {
|
|
21
|
+
json: any | null;
|
|
22
|
+
retorno: {
|
|
23
|
+
data: string;
|
|
24
|
+
status: number;
|
|
25
|
+
transportError?: {
|
|
26
|
+
code: string;
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
servico?: "ADN" | "SEFIN";
|
|
31
|
+
reqXml?: string;
|
|
32
|
+
falha?: string;
|
|
33
|
+
}): {
|
|
34
|
+
data: any;
|
|
35
|
+
reqXml?: string;
|
|
36
|
+
resBody: string;
|
|
37
|
+
status: number;
|
|
38
|
+
error?: string;
|
|
39
|
+
transportError?: {
|
|
40
|
+
code: string;
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
export const CA_ICP_BRASIL: readonly string[];
|
|
2
|
+
export const CA_PADRAO: readonly string[];
|
|
1
3
|
import DistribuicaoDFe = require("./apis/distribuicaoDFe-api");
|
|
4
|
+
import DistribuicaoNFSe = require("./apis/distribuicaoNFSe-api");
|
|
5
|
+
import ManifestacaoNFSe = require("./apis/manifestacaoNFSe-api");
|
|
2
6
|
import RecepcaoEvento = require("./apis/recepcaoEvento-api");
|
|
3
7
|
declare namespace _default {
|
|
8
|
+
export { CA_ICP_BRASIL };
|
|
9
|
+
export { CA_PADRAO };
|
|
4
10
|
export { DistribuicaoDFe };
|
|
11
|
+
export { DistribuicaoNFSe };
|
|
12
|
+
export { ManifestacaoNFSe };
|
|
5
13
|
export { RecepcaoEvento };
|
|
6
14
|
}
|
|
7
15
|
export declare namespace mde {
|
|
16
|
+
export { CA_ICP_BRASIL };
|
|
17
|
+
export { CA_PADRAO };
|
|
8
18
|
export { DistribuicaoDFe };
|
|
19
|
+
export { DistribuicaoNFSe };
|
|
20
|
+
export { ManifestacaoNFSe };
|
|
9
21
|
export { RecepcaoEvento };
|
|
10
22
|
}
|
|
11
|
-
export { DistribuicaoDFe, RecepcaoEvento, _default as default };
|
|
23
|
+
export { DistribuicaoDFe, DistribuicaoNFSe, ManifestacaoNFSe, RecepcaoEvento, _default as default };
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -14,6 +14,23 @@ declare const schema: Readonly<{
|
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
+
ManifestacaoNFSeSchema: {
|
|
18
|
+
new (): {};
|
|
19
|
+
montarSchema(options: {
|
|
20
|
+
tpAmb: string;
|
|
21
|
+
verAplic: string;
|
|
22
|
+
dhEvento: string;
|
|
23
|
+
cnpj: string;
|
|
24
|
+
chNFSe: string;
|
|
25
|
+
evento: {
|
|
26
|
+
codigo: string;
|
|
27
|
+
elemento: string;
|
|
28
|
+
xDesc: string;
|
|
29
|
+
};
|
|
30
|
+
cMotivo?: string;
|
|
31
|
+
xMotivo?: string;
|
|
32
|
+
}): any;
|
|
33
|
+
};
|
|
17
34
|
RecepcaoSchema: {
|
|
18
35
|
new (): {};
|
|
19
36
|
montarSchema(options: any): {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const _exports: typeof ManifestacaoNFSeSchema;
|
|
2
|
+
export = _exports;
|
|
3
|
+
declare class ManifestacaoNFSeSchema {
|
|
4
|
+
/**
|
|
5
|
+
* `pedRegEvento` v1.01 de um evento do tomador. A ordem das chaves é a do
|
|
6
|
+
* `TCInfPedReg` do XSD.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} options
|
|
9
|
+
* @param {string} options.tpAmb
|
|
10
|
+
* @param {string} options.verAplic
|
|
11
|
+
* @param {string} options.dhEvento
|
|
12
|
+
* @param {string} options.cnpj
|
|
13
|
+
* @param {string} options.chNFSe
|
|
14
|
+
* @param {{codigo: string, elemento: string, xDesc: string}} options.evento
|
|
15
|
+
* @param {string} [options.cMotivo]
|
|
16
|
+
* @param {string} [options.xMotivo]
|
|
17
|
+
* @returns {Object}
|
|
18
|
+
*/
|
|
19
|
+
static montarSchema(options: {
|
|
20
|
+
tpAmb: string;
|
|
21
|
+
verAplic: string;
|
|
22
|
+
dhEvento: string;
|
|
23
|
+
cnpj: string;
|
|
24
|
+
chNFSe: string;
|
|
25
|
+
evento: {
|
|
26
|
+
codigo: string;
|
|
27
|
+
elemento: string;
|
|
28
|
+
xDesc: string;
|
|
29
|
+
};
|
|
30
|
+
cMotivo?: string;
|
|
31
|
+
xMotivo?: string;
|
|
32
|
+
}): any;
|
|
33
|
+
}
|
|
@@ -3,10 +3,17 @@ declare class Instance {
|
|
|
3
3
|
constructor(opts: any);
|
|
4
4
|
instance: import("axios").AxiosInstance;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Sem resposta HTTP (cadeia TLS, DNS, conexão recusada, timeout, erro
|
|
7
|
+
* antes do envio), devolve `status: 0` e o motivo em `transportError`.
|
|
8
|
+
*
|
|
9
|
+
* @returns {Promise<{status: number, data: string, transportError?: {code: string, message: string}}>}
|
|
7
10
|
*/
|
|
8
11
|
request(config: any): Promise<{
|
|
9
12
|
status: number;
|
|
10
13
|
data: string;
|
|
14
|
+
transportError?: {
|
|
15
|
+
code: string;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
11
18
|
}>;
|
|
12
19
|
}
|
|
@@ -2,11 +2,13 @@ declare const _exports: typeof Assinatura;
|
|
|
2
2
|
export = _exports;
|
|
3
3
|
declare class Assinatura {
|
|
4
4
|
/**
|
|
5
|
+
* Assina o elemento referenciado e insere a `Signature` logo depois dele.
|
|
5
6
|
*
|
|
6
7
|
* @param {string} cert
|
|
7
8
|
* @param {string} key
|
|
8
9
|
* @param {string} xml
|
|
10
|
+
* @param {string} [elemento = 'infEvento'] `infEvento` na NF-e, `infPedReg` no pedido de evento da NFS-e
|
|
9
11
|
* @returns {string}
|
|
10
12
|
*/
|
|
11
|
-
static assinarXml(cert: string, key: string, xml: string): string;
|
|
13
|
+
static assinarXml(cert: string, key: string, xml: string, elemento?: string): string;
|
|
12
14
|
}
|
package/dist/util/gzip.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
declare const _exports: typeof Gzip;
|
|
2
2
|
export = _exports;
|
|
3
3
|
declare class Gzip {
|
|
4
|
+
/**
|
|
5
|
+
* Inverso do `unzip`: gzip do texto em UTF-8, em base64.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} str
|
|
8
|
+
* @returns {Promise<string>}
|
|
9
|
+
*/
|
|
10
|
+
static zip(str: string): Promise<string>;
|
|
4
11
|
/**
|
|
5
12
|
*
|
|
6
13
|
* @param {string} str
|
package/dist/util/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export = util;
|
|
|
2
2
|
declare const util: Readonly<{
|
|
3
3
|
Assinatura: {
|
|
4
4
|
new (): {};
|
|
5
|
-
assinarXml(cert: string, key: string, xml: string): string;
|
|
5
|
+
assinarXml(cert: string, key: string, xml: string, elemento?: string): string;
|
|
6
6
|
};
|
|
7
7
|
Certificado: {
|
|
8
8
|
new (): {};
|
|
@@ -17,6 +17,7 @@ declare const util: Readonly<{
|
|
|
17
17
|
};
|
|
18
18
|
Gzip: {
|
|
19
19
|
new (): {};
|
|
20
|
+
zip(str: string): Promise<string>;
|
|
20
21
|
unzip(str: string): Promise<string>;
|
|
21
22
|
};
|
|
22
23
|
Xml: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _exports: typeof ChaveNfseValidator;
|
|
2
|
+
export = _exports;
|
|
3
|
+
declare class ChaveNfseValidator {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {string} chave
|
|
7
|
+
*/
|
|
8
|
+
constructor(chave: string);
|
|
9
|
+
chave: string;
|
|
10
|
+
error: string;
|
|
11
|
+
isValid(): boolean;
|
|
12
|
+
getValues(): string;
|
|
13
|
+
getError(): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _exports: typeof CnpjValidator;
|
|
2
|
+
export = _exports;
|
|
3
|
+
declare class CnpjValidator {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} config
|
|
7
|
+
* @param {string} config.cnpj
|
|
8
|
+
*/
|
|
9
|
+
constructor(config: {
|
|
10
|
+
cnpj: string;
|
|
11
|
+
});
|
|
12
|
+
cnpj: string;
|
|
13
|
+
error: string;
|
|
14
|
+
isValid(): boolean;
|
|
15
|
+
getValues(): {
|
|
16
|
+
cnpj: string;
|
|
17
|
+
};
|
|
18
|
+
getError(): string;
|
|
19
|
+
}
|
|
@@ -33,6 +33,15 @@ declare const validator: Readonly<{
|
|
|
33
33
|
getError(): string;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
+
ChaveNfseValidator: {
|
|
37
|
+
new (chave: string): {
|
|
38
|
+
chave: string;
|
|
39
|
+
error: string;
|
|
40
|
+
isValid(): boolean;
|
|
41
|
+
getValues(): string;
|
|
42
|
+
getError(): string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
36
45
|
ChaveValidator: {
|
|
37
46
|
new (chave: string): {
|
|
38
47
|
chave: string;
|
|
@@ -58,6 +67,19 @@ declare const validator: Readonly<{
|
|
|
58
67
|
getError(): string;
|
|
59
68
|
};
|
|
60
69
|
};
|
|
70
|
+
CnpjValidator: {
|
|
71
|
+
new (config: {
|
|
72
|
+
cnpj: string;
|
|
73
|
+
}): {
|
|
74
|
+
cnpj: string;
|
|
75
|
+
error: string;
|
|
76
|
+
isValid(): boolean;
|
|
77
|
+
getValues(): {
|
|
78
|
+
cnpj: string;
|
|
79
|
+
};
|
|
80
|
+
getError(): string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
61
83
|
EventoValidator: {
|
|
62
84
|
new (evento: {
|
|
63
85
|
chNFe: string;
|
|
@@ -108,6 +130,34 @@ declare const validator: Readonly<{
|
|
|
108
130
|
getError(): string;
|
|
109
131
|
};
|
|
110
132
|
};
|
|
133
|
+
MotivoRejeicaoValidator: {
|
|
134
|
+
new (motivo?: {
|
|
135
|
+
cMotivo: "1" | "2" | "3" | "4" | "5" | "9";
|
|
136
|
+
xMotivo?: string;
|
|
137
|
+
}): {
|
|
138
|
+
cMotivo: "1" | "2" | "3" | "4" | "5" | "9";
|
|
139
|
+
xMotivo: string;
|
|
140
|
+
error: string;
|
|
141
|
+
isValid(): boolean;
|
|
142
|
+
getValues(): {
|
|
143
|
+
cMotivo: "1" | "2" | "3" | "4" | "5" | "9";
|
|
144
|
+
xMotivo: string;
|
|
145
|
+
};
|
|
146
|
+
getError(): string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
NsuNfseValidator: {
|
|
150
|
+
new (nsu: string | number, opcoes?: {
|
|
151
|
+
positivo?: boolean;
|
|
152
|
+
}): {
|
|
153
|
+
nsu: string | number;
|
|
154
|
+
positivo: boolean;
|
|
155
|
+
error: string;
|
|
156
|
+
isValid(): boolean;
|
|
157
|
+
getValues(): string | number;
|
|
158
|
+
getError(): string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
111
161
|
NsuValidator: {
|
|
112
162
|
new (nsu: string): {
|
|
113
163
|
nsu: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const _exports: typeof MotivoRejeicaoValidator;
|
|
2
|
+
export = _exports;
|
|
3
|
+
declare class MotivoRejeicaoValidator {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} [motivo]
|
|
7
|
+
* @param {'1' | '2' | '3' | '4' | '5' | '9'} motivo.cMotivo
|
|
8
|
+
* @param {string} [motivo.xMotivo]
|
|
9
|
+
*/
|
|
10
|
+
constructor(motivo?: {
|
|
11
|
+
cMotivo: "1" | "2" | "3" | "4" | "5" | "9";
|
|
12
|
+
xMotivo?: string;
|
|
13
|
+
});
|
|
14
|
+
cMotivo: "1" | "2" | "3" | "4" | "5" | "9";
|
|
15
|
+
xMotivo: string;
|
|
16
|
+
error: string;
|
|
17
|
+
isValid(): boolean;
|
|
18
|
+
getValues(): {
|
|
19
|
+
cMotivo: "1" | "2" | "3" | "4" | "5" | "9";
|
|
20
|
+
xMotivo: string;
|
|
21
|
+
};
|
|
22
|
+
getError(): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _exports: typeof NsuNfseValidator;
|
|
2
|
+
export = _exports;
|
|
3
|
+
declare class NsuNfseValidator {
|
|
4
|
+
/**
|
|
5
|
+
* No ADN o NSU é inteiro: sem o zero-pad do leiaute da NF-e.
|
|
6
|
+
*
|
|
7
|
+
* @param {string | number} nsu
|
|
8
|
+
* @param {Object} [opcoes]
|
|
9
|
+
* @param {boolean} [opcoes.positivo] Recusa o NSU `0`.
|
|
10
|
+
*/
|
|
11
|
+
constructor(nsu: string | number, opcoes?: {
|
|
12
|
+
positivo?: boolean;
|
|
13
|
+
});
|
|
14
|
+
nsu: string | number;
|
|
15
|
+
positivo: boolean;
|
|
16
|
+
error: string;
|
|
17
|
+
isValid(): boolean;
|
|
18
|
+
getValues(): string | number;
|
|
19
|
+
getError(): string;
|
|
20
|
+
}
|