@bitize/bitmde 0.17.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +431 -0
  2. package/LICENSE +22 -0
  3. package/README.md +398 -0
  4. package/dist/apis/distribuicaoDFe-api.d.ts +113 -0
  5. package/dist/apis/recepcaoEvento-api.d.ts +81 -0
  6. package/dist/controllers/distribuicaoDFe-controller.d.ts +30 -0
  7. package/dist/controllers/index.d.ts +58 -0
  8. package/dist/controllers/recepcaoEvento-controller.d.ts +37 -0
  9. package/dist/env/ca.d.ts +6 -0
  10. package/dist/env/distribuicao.d.ts +8 -0
  11. package/dist/env/evento.d.ts +18 -0
  12. package/dist/env/index.d.ts +8 -0
  13. package/dist/env/recepcao.d.ts +8 -0
  14. package/dist/env/uf.d.ts +1 -0
  15. package/dist/env/version.d.ts +1 -0
  16. package/dist/env/zone.d.ts +1 -0
  17. package/dist/helpers/distribuicaoDFe-helper.d.ts +41 -0
  18. package/dist/helpers/index.d.ts +74 -0
  19. package/dist/helpers/recepcaoEvento-helper.d.ts +48 -0
  20. package/dist/helpers/retorno-helper.d.ts +27 -0
  21. package/dist/index.d.ts +11 -0
  22. package/dist/schemas/distribuicaoDFe-schema.d.ts +15 -0
  23. package/dist/schemas/index.d.ts +37 -0
  24. package/dist/schemas/recepcaoEvento-schema.d.ts +21 -0
  25. package/dist/services/sefaz-service.d.ts +12 -0
  26. package/dist/util/assinatura.d.ts +12 -0
  27. package/dist/util/certificado.d.ts +14 -0
  28. package/dist/util/data.d.ts +11 -0
  29. package/dist/util/gzip.d.ts +10 -0
  30. package/dist/util/index.d.ts +32 -0
  31. package/dist/util/xml.d.ts +22 -0
  32. package/dist/util/zeroPad.d.ts +10 -0
  33. package/dist/validators/ambiente-validator.d.ts +19 -0
  34. package/dist/validators/certificado-validator.d.ts +29 -0
  35. package/dist/validators/chave-validator.d.ts +14 -0
  36. package/dist/validators/cnpjCpf-validator.d.ts +23 -0
  37. package/dist/validators/evento-validator.d.ts +30 -0
  38. package/dist/validators/index.d.ts +146 -0
  39. package/dist/validators/lote-validator.d.ts +35 -0
  40. package/dist/validators/nsu-validator.d.ts +14 -0
  41. package/dist/validators/uf-validator.d.ts +19 -0
  42. package/dist/validators/zone-validator.d.ts +19 -0
  43. package/lib/apis/distribuicaoDFe-api.js +64 -0
  44. package/lib/apis/recepcaoEvento-api.js +65 -0
  45. package/lib/controllers/distribuicaoDFe-controller.js +17 -0
  46. package/lib/controllers/index.js +6 -0
  47. package/lib/controllers/recepcaoEvento-controller.js +17 -0
  48. package/lib/env/ca.js +5 -0
  49. package/lib/env/distribuicao.js +8 -0
  50. package/lib/env/evento.js +22 -0
  51. package/lib/env/index.js +11 -0
  52. package/lib/env/recepcao.js +8 -0
  53. package/lib/env/uf.js +5 -0
  54. package/lib/env/version.js +3 -0
  55. package/lib/env/zone.js +5 -0
  56. package/lib/helpers/distribuicaoDFe-helper.js +58 -0
  57. package/lib/helpers/index.js +7 -0
  58. package/lib/helpers/recepcaoEvento-helper.js +64 -0
  59. package/lib/helpers/retorno-helper.js +18 -0
  60. package/lib/index.js +12 -0
  61. package/lib/schemas/distribuicaoDFe-schema.js +25 -0
  62. package/lib/schemas/index.js +6 -0
  63. package/lib/schemas/recepcaoEvento-schema.js +30 -0
  64. package/lib/services/sefaz-service.js +63 -0
  65. package/lib/util/assinatura.js +25 -0
  66. package/lib/util/certificado.js +21 -0
  67. package/lib/util/data.js +9 -0
  68. package/lib/util/gzip.js +16 -0
  69. package/lib/util/index.js +10 -0
  70. package/lib/util/xml.js +28 -0
  71. package/lib/util/zeroPad.js +7 -0
  72. package/lib/validators/ambiente-validator.js +19 -0
  73. package/lib/validators/certificado-validator.js +32 -0
  74. package/lib/validators/chave-validator.js +16 -0
  75. package/lib/validators/cnpjCpf-validator.js +23 -0
  76. package/lib/validators/evento-validator.js +39 -0
  77. package/lib/validators/index.js +13 -0
  78. package/lib/validators/lote-validator.js +26 -0
  79. package/lib/validators/nsu-validator.js +19 -0
  80. package/lib/validators/uf-validator.js +21 -0
  81. package/lib/validators/zone-validator.js +24 -0
  82. package/package.json +82 -0
package/lib/index.js ADDED
@@ -0,0 +1,12 @@
1
+ let DistribuicaoDFe = require("./apis/distribuicaoDFe-api"), RecepcaoEvento = require("./apis/recepcaoEvento-api");
2
+
3
+ module.exports = {
4
+ DistribuicaoDFe: DistribuicaoDFe,
5
+ RecepcaoEvento: RecepcaoEvento
6
+ }, module.exports.default = {
7
+ DistribuicaoDFe: DistribuicaoDFe,
8
+ RecepcaoEvento: RecepcaoEvento
9
+ }, module.exports.mde = {
10
+ DistribuicaoDFe: DistribuicaoDFe,
11
+ RecepcaoEvento: RecepcaoEvento
12
+ };
@@ -0,0 +1,25 @@
1
+ class DistribuicaoSchema {
2
+ static montarSchema(t) {
3
+ var e = {
4
+ tpAmb: t.tpAmb,
5
+ cUFAutor: t.cUFAutor
6
+ };
7
+ return t.cnpj ? e.CNPJ = t.cnpj : e.CPF = t.cpf, t.ultNSU ? e.distNSU = {
8
+ ultNSU: t.ultNSU
9
+ } : t.chNFe ? e.consChNFe = {
10
+ chNFe: t.chNFe
11
+ } : e.consNSU = {
12
+ NSU: t.nsu
13
+ }, e["@_xmlns"] = "http://www.portalfiscal.inf.br/nfe", e["@_versao"] = "1.01",
14
+ {
15
+ nfeDistDFeInteresse: {
16
+ nfeDadosMsg: {
17
+ distDFeInt: e
18
+ },
19
+ "@_xmlns": "http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe"
20
+ }
21
+ };
22
+ }
23
+ }
24
+
25
+ module.exports = Object.freeze(DistribuicaoSchema);
@@ -0,0 +1,6 @@
1
+ let DistribuicaoSchema = require("./distribuicaoDFe-schema"), RecepcaoSchema = require("./recepcaoEvento-schema"), schema = Object.freeze({
2
+ DistribuicaoSchema: DistribuicaoSchema,
3
+ RecepcaoSchema: RecepcaoSchema
4
+ });
5
+
6
+ module.exports = schema;
@@ -0,0 +1,30 @@
1
+ class RecepcaoSchema {
2
+ static montarSchema(e) {
3
+ var t = {
4
+ cOrgao: e.cOrgao,
5
+ tpAmb: e.tpAmb
6
+ };
7
+ return e.cnpj ? t.CNPJ = e.cnpj : t.CPF = e.cpf, t.chNFe = e.chNFe, t.dhEvento = e.dhEvento,
8
+ t.tpEvento = e.tpEvento, t.nSeqEvento = e.nSeqEvento, t.verEvento = "1.00",
9
+ t.detEvento = {
10
+ descEvento: e.descEvento,
11
+ "@_versao": "1.00"
12
+ }, e.xJust && (t.detEvento.xJust = e.xJust), t["@_Id"] = e.infEventoId,
13
+ {
14
+ nfeDadosMsg: {
15
+ envEvento: {
16
+ idLote: e.idLote,
17
+ evento: {
18
+ infEvento: t,
19
+ "@_versao": "1.00"
20
+ },
21
+ "@_xmlns": "http://www.portalfiscal.inf.br/nfe",
22
+ "@_versao": "1.00"
23
+ },
24
+ "@_xmlns": "http://www.portalfiscal.inf.br/nfe/wsdl/NFeRecepcaoEvento4"
25
+ }
26
+ };
27
+ }
28
+ }
29
+
30
+ module.exports = Object.freeze(RecepcaoSchema);
@@ -0,0 +1,63 @@
1
+ let axios = require("axios").default, https = require("https"), VERSION = require("../env").VERSION;
2
+
3
+ class Instance {
4
+ constructor(t) {
5
+ var {
6
+ baseURL: e,
7
+ ca: s,
8
+ cert: a,
9
+ key: r
10
+ } = t, a = Object.assign({
11
+ cert: a,
12
+ key: r,
13
+ ca: s,
14
+ rejectUnauthorized: !1
15
+ }, {
16
+ ...t.httpsOptions
17
+ }), r = new https.Agent(a), s = Object.assign({
18
+ baseURL: e,
19
+ headers: {
20
+ "User-Agent": "bitmde/" + VERSION,
21
+ "Content-Type": "application/soap+xml; charset=utf-8"
22
+ },
23
+ httpsAgent: r,
24
+ timeout: 6e4
25
+ }, {
26
+ ...t.requestOptions
27
+ }), a = axios.create({
28
+ ...s
29
+ });
30
+ this.instance = a;
31
+ }
32
+ async request(e) {
33
+ try {
34
+ var {
35
+ status: s,
36
+ data: t
37
+ } = await this.instance(e);
38
+ return {
39
+ status: s,
40
+ data: t
41
+ };
42
+ } catch (t) {
43
+ return t.response ? ({
44
+ status: e,
45
+ data: s
46
+ } = t.response, {
47
+ status: e,
48
+ data: s
49
+ }) : t.request ? "ECONNABORTED" === t.code ? {
50
+ status: 504,
51
+ data: `<error>${t.message || t}</error>`
52
+ } : {
53
+ status: 502,
54
+ data: `<error>${t.message || t}</error>`
55
+ } : {
56
+ status: 500,
57
+ data: `<error>${t.message || t}</error>`
58
+ };
59
+ }
60
+ }
61
+ }
62
+
63
+ module.exports = Instance;
@@ -0,0 +1,25 @@
1
+ let SignedXml = require("xml-crypto").SignedXml;
2
+
3
+ class Assinatura {
4
+ static assinarXml(e, t, a) {
5
+ var r = "//*[local-name(.)='infEvento']", i = [ "http://www.w3.org/2000/09/xmldsig#enveloped-signature", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315" ], t = new SignedXml({
6
+ privateKey: t,
7
+ publicCert: e,
8
+ canonicalizationAlgorithm: i[1],
9
+ signatureAlgorithm: "http://www.w3.org/2000/09/xmldsig#rsa-sha1",
10
+ getKeyInfoContent: () => `<X509Data><X509Certificate>${e.split("-----")[2].replace(/[\r\n]/g, "")}</X509Certificate></X509Data>`
11
+ });
12
+ return t.addReference({
13
+ xpath: r,
14
+ transforms: i,
15
+ digestAlgorithm: "http://www.w3.org/2000/09/xmldsig#sha1"
16
+ }), t.computeSignature(a, {
17
+ location: {
18
+ reference: r,
19
+ action: "after"
20
+ }
21
+ }), t.getSignedXml();
22
+ }
23
+ }
24
+
25
+ module.exports = Object.freeze(Assinatura);
@@ -0,0 +1,21 @@
1
+ let forge = require("node-forge");
2
+
3
+ class Certificado {
4
+ static p12ToPem(e, r) {
5
+ e = e.toString("base64"), e = forge.asn1.fromDer(forge.util.decode64(e)),
6
+ e = forge.pkcs12.pkcs12FromAsn1(e, !0, r), r = e.getBags({
7
+ bagType: forge.pki.oids.pkcs8ShroudedKeyBag
8
+ })[forge.pki.oids.pkcs8ShroudedKeyBag].concat(e.getBags({
9
+ bagType: forge.pki.oids.keyBag
10
+ })[forge.pki.oids.keyBag]), e = e.getBags({
11
+ bagType: forge.pki.oids.certBag
12
+ })[forge.pki.oids.certBag].sort((e, r) => new Date(e.cert.validity.notAfter) - new Date(r.cert.validity.notAfter)),
13
+ r = forge.pki.privateKeyToAsn1(r[0].key), r = forge.pki.wrapRsaPrivateKey(r);
14
+ return {
15
+ cert: forge.pki.certificateToPem(e[0].cert),
16
+ key: forge.pki.privateKeyInfoToPem(r)
17
+ };
18
+ }
19
+ }
20
+
21
+ module.exports = Object.freeze(Certificado);
@@ -0,0 +1,9 @@
1
+ let DateTime = require("luxon").DateTime;
2
+
3
+ class Data {
4
+ static toFormat(e, t) {
5
+ return DateTime.fromJSDate(e).setZone(t).toFormat("yyyy-MM-dd'T'HH:mm:ssZZ");
6
+ }
7
+ }
8
+
9
+ module.exports = Object.freeze(Data);
@@ -0,0 +1,16 @@
1
+ let zlib = require("zlib");
2
+
3
+ class Gzip {
4
+ static unzip(e) {
5
+ let i = Buffer.from(e, "base64");
6
+ return new Promise((t, r) => {
7
+ zlib.unzip(i, function(e, i) {
8
+ e && r(e);
9
+ e = i.toString("utf8");
10
+ t(e);
11
+ });
12
+ });
13
+ }
14
+ }
15
+
16
+ module.exports = Object.freeze(Gzip);
@@ -0,0 +1,10 @@
1
+ let Assinatura = require("./assinatura"), Certificado = require("./certificado"), Data = require("./data"), Gzip = require("./gzip"), Xml = require("./xml"), ZeroPad = require("./zeroPad"), util = Object.freeze({
2
+ Assinatura: Assinatura,
3
+ Certificado: Certificado,
4
+ Data: Data,
5
+ Gzip: Gzip,
6
+ Xml: Xml,
7
+ ZeroPad: ZeroPad
8
+ });
9
+
10
+ module.exports = util;
@@ -0,0 +1,28 @@
1
+ let {
2
+ XMLBuilder,
3
+ XMLParser
4
+ } = require("fast-xml-parser");
5
+
6
+ class Xml {
7
+ static envelopar(e) {
8
+ return `<?xml version="1.0" encoding="utf-8"?><soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"><soap12:Body>${e}</soap12:Body></soap12:Envelope>`;
9
+ }
10
+ static jsonToXml(e) {
11
+ return new XMLBuilder({
12
+ ignoreAttributes: !1
13
+ }).build(e);
14
+ }
15
+ static xmlToJson(e) {
16
+ return new XMLParser({
17
+ attributeNamePrefix: "@_",
18
+ textNodeName: "value",
19
+ ignoreAttributes: !1,
20
+ allowBooleanAttributes: !1,
21
+ parseAttributeValue: !1,
22
+ parseTagValue: !1,
23
+ trimValues: !0
24
+ }).parse(e);
25
+ }
26
+ }
27
+
28
+ module.exports = Object.freeze(Xml);
@@ -0,0 +1,7 @@
1
+ class ZeroPad {
2
+ static padNsu(e) {
3
+ return e.padStart(15, "0");
4
+ }
5
+ }
6
+
7
+ module.exports = Object.freeze(ZeroPad);
@@ -0,0 +1,19 @@
1
+ class AmbienteValidator {
2
+ constructor(t) {
3
+ t = t.tpAmb;
4
+ this.tpAmb = t, this.error = "";
5
+ }
6
+ isValid() {
7
+ return this.tpAmb ? "1" === this.tpAmb || "2" === this.tpAmb || !(this.error = "Ambiente com valor inválido.") : !(this.error = "Ambiente não informado.");
8
+ }
9
+ getValues() {
10
+ return {
11
+ tpAmb: this.tpAmb
12
+ };
13
+ }
14
+ getError() {
15
+ return this.error;
16
+ }
17
+ }
18
+
19
+ module.exports = Object.freeze(AmbienteValidator);
@@ -0,0 +1,32 @@
1
+ let Certificado = require("../util").Certificado;
2
+
3
+ class CertificadoValidator {
4
+ constructor(r) {
5
+ var {
6
+ pfx: r,
7
+ passphrase: t,
8
+ cert: e,
9
+ key: i
10
+ } = r;
11
+ this.pfx = r, this.passphrase = t, this.cert = e, this.key = i, this.error = "";
12
+ }
13
+ isValid() {
14
+ if (this.pfx) {
15
+ if (!this.passphrase) return !(this.error = "Senha do Certificado não informada.");
16
+ var r = Certificado.p12ToPem(this.pfx, this.passphrase);
17
+ this.cert = r.cert, this.key = r.key;
18
+ }
19
+ return this.cert ? !!this.key || !(this.error = "Key não informada.") : !(this.error = "Cert não informado.");
20
+ }
21
+ getValues() {
22
+ return {
23
+ cert: this.cert.toString(),
24
+ key: this.key.toString()
25
+ };
26
+ }
27
+ getError() {
28
+ return this.error;
29
+ }
30
+ }
31
+
32
+ module.exports = Object.freeze(CertificadoValidator);
@@ -0,0 +1,16 @@
1
+ class ChaveValidator {
2
+ constructor(r) {
3
+ this.chave = r, this.error = "";
4
+ }
5
+ isValid() {
6
+ return this.chave ? (this.chave = String(this.chave), 44 === this.chave.length || !(this.error = "Chave da NF-e com tamanho incorreto.")) : !(this.error = "Chave da NF-e não informada.");
7
+ }
8
+ getValues() {
9
+ return this.chave;
10
+ }
11
+ getError() {
12
+ return this.error;
13
+ }
14
+ }
15
+
16
+ module.exports = Object.freeze(ChaveValidator);
@@ -0,0 +1,23 @@
1
+ class CnpjCpfValidator {
2
+ constructor(r) {
3
+ var {
4
+ cnpj: r,
5
+ cpf: t
6
+ } = r;
7
+ this.cnpj = r, this.cpf = t, this.error = "";
8
+ }
9
+ isValid() {
10
+ return !(!this.cnpj && !this.cpf && (this.error = "CNPJ/CPF não informado."));
11
+ }
12
+ getValues() {
13
+ return {
14
+ cnpj: this.cnpj,
15
+ cpf: this.cpf
16
+ };
17
+ }
18
+ getError() {
19
+ return this.error;
20
+ }
21
+ }
22
+
23
+ module.exports = Object.freeze(CnpjCpfValidator);
@@ -0,0 +1,39 @@
1
+ let EVENTOS = require("../env").EVENTOS;
2
+
3
+ class EventoValidator {
4
+ constructor(t) {
5
+ var {
6
+ chNFe: t,
7
+ tipoEvento: i,
8
+ justificativa: e
9
+ } = t;
10
+ this.chNFe = t, this.tipoEvento = i, this.justificativa = e, this.error = "";
11
+ }
12
+ isValid() {
13
+ if (!this.chNFe) return !(this.error = "Chave da NF-e não informada.");
14
+ if (!this.tipoEvento) return !(this.error = "Tipo Evento não informado.");
15
+ if (!EVENTOS[this.tipoEvento]) return !(this.error = "Tipo Evento deve conter um dos valores: 210200, 210210, 210220 ou 210240");
16
+ if (210240 === Number(this.tipoEvento)) {
17
+ if (!this.justificativa) return !(this.error = "Justificativa não informada.");
18
+ if (this.justificativa.length < 15 || 255 < this.justificativa.length) return !(this.error = "Justificativa com tamanho incorreto.");
19
+ }
20
+ var {
21
+ tpEvento: t,
22
+ descEvento: i
23
+ } = EVENTOS[this.tipoEvento];
24
+ return this.tpEvento = t, this.descEvento = i, !0;
25
+ }
26
+ getValues() {
27
+ return {
28
+ chNFe: this.chNFe,
29
+ justificativa: this.justificativa,
30
+ tpEvento: this.tpEvento,
31
+ descEvento: this.descEvento
32
+ };
33
+ }
34
+ getError() {
35
+ return this.error;
36
+ }
37
+ }
38
+
39
+ module.exports = Object.freeze(EventoValidator);
@@ -0,0 +1,13 @@
1
+ let AmbienteValidator = require("./ambiente-validator"), CertificadoValidator = require("./certificado-validator"), ChaveValidator = require("./chave-validator"), CnpjCpfValidator = require("./cnpjCpf-validator"), EventoValidator = require("./evento-validator"), LoteValidator = require("./lote-validator"), NsuValidator = require("./nsu-validator"), UfValidator = require("./uf-validator"), ZoneValidator = require("./zone-validator"), validator = Object.freeze({
2
+ AmbienteValidator: AmbienteValidator,
3
+ CertificadoValidator: CertificadoValidator,
4
+ ChaveValidator: ChaveValidator,
5
+ CnpjCpfValidator: CnpjCpfValidator,
6
+ EventoValidator: EventoValidator,
7
+ LoteValidator: LoteValidator,
8
+ NsuValidator: NsuValidator,
9
+ UfValidator: UfValidator,
10
+ ZoneValidator: ZoneValidator
11
+ });
12
+
13
+ module.exports = validator;
@@ -0,0 +1,26 @@
1
+ let LOTE_MIN_LENGTH = 1, LOTE_MAX_LENGTH = 20;
2
+
3
+ class LoteValidator {
4
+ constructor(t) {
5
+ var {
6
+ idLote: t,
7
+ lote: e
8
+ } = t;
9
+ this.idLote = t, this.lote = e, this.error = "";
10
+ }
11
+ isValid() {
12
+ return this.idLote || (this.idLote = "1"), Array.isArray(this.lote) ? !(this.lote.length < LOTE_MIN_LENGTH || this.lote.length > LOTE_MAX_LENGTH) || (this.error = `Um lote deve possuir no mínimo ${LOTE_MIN_LENGTH} e no máximo ${LOTE_MAX_LENGTH} eventos.`,
13
+ !1) : !(this.error = "Lote não informado.");
14
+ }
15
+ getValues() {
16
+ return {
17
+ idLote: this.idLote,
18
+ lote: this.lote
19
+ };
20
+ }
21
+ getError() {
22
+ return this.error;
23
+ }
24
+ }
25
+
26
+ module.exports = Object.freeze(LoteValidator);
@@ -0,0 +1,19 @@
1
+ let ZeroPad = require("../util").ZeroPad;
2
+
3
+ class NsuValidator {
4
+ constructor(r) {
5
+ this.nsu = r, this.error = "";
6
+ }
7
+ isValid() {
8
+ return this.nsu ? (this.nsu = String(this.nsu), 15 < this.nsu.length ? !(this.error = "NSU com tamanho incorreto.") : (this.nsu = ZeroPad.padNsu(this.nsu),
9
+ !0)) : !(this.error = "NSU não informado.");
10
+ }
11
+ getValues() {
12
+ return this.nsu;
13
+ }
14
+ getError() {
15
+ return this.error;
16
+ }
17
+ }
18
+
19
+ module.exports = Object.freeze(NsuValidator);
@@ -0,0 +1,21 @@
1
+ let CODIGOS_UF = require("../env").CODIGOS_UF;
2
+
3
+ class UfValidator {
4
+ constructor(r) {
5
+ r = r.cUFAutor;
6
+ this.cUFAutor = r, this.error = "";
7
+ }
8
+ isValid() {
9
+ return this.cUFAutor ? !!CODIGOS_UF.includes(this.cUFAutor) || !(this.error = "Código UF inválido.") : !(this.error = "Código UF do Autor não informado.");
10
+ }
11
+ getValues() {
12
+ return {
13
+ cUFAutor: this.cUFAutor
14
+ };
15
+ }
16
+ getError() {
17
+ return this.error;
18
+ }
19
+ }
20
+
21
+ module.exports = Object.freeze(UfValidator);
@@ -0,0 +1,24 @@
1
+ let ZONES = require("../env").ZONES;
2
+
3
+ class ZoneValidator {
4
+ constructor(e) {
5
+ e = e.timezone;
6
+ this.timezone = e, this.error = "";
7
+ }
8
+ isValid() {
9
+ if (this.timezone) {
10
+ if (!ZONES.includes(this.timezone)) return !(this.error = "Timezone inválido.");
11
+ } else this.timezone = "America/Sao_Paulo";
12
+ return !0;
13
+ }
14
+ getValues() {
15
+ return {
16
+ timezone: this.timezone
17
+ };
18
+ }
19
+ getError() {
20
+ return this.error;
21
+ }
22
+ }
23
+
24
+ module.exports = Object.freeze(ZoneValidator);
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@bitize/bitmde",
3
+ "version": "0.17.0",
4
+ "description": "Biblioteca para consultar notas destinadas e enviar evento de manifestação do destinatário",
5
+ "main": "./lib/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "require": "./lib/index.js",
11
+ "default": "./lib/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "lib/",
17
+ "dist/",
18
+ "CHANGELOG.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "npm run script && npm run types",
22
+ "script": "node ./scripts/index.js",
23
+ "release": "git pull && npm run build && npm publish",
24
+ "test": "mocha",
25
+ "test:ci": "mocha --ignore test/sefaz.test.js",
26
+ "format": "prettier --write .",
27
+ "format:check": "prettier --check .",
28
+ "certs:teste": "sh ./scripts/gerar-certificado-teste.sh",
29
+ "types": "npx tsc"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/bitize/bitmde.git"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "keywords": [
39
+ "nfe",
40
+ "sefaz",
41
+ "nota",
42
+ "fiscal",
43
+ "evento",
44
+ "manifestacao",
45
+ "destinatario",
46
+ "distribuicao",
47
+ "dfe",
48
+ "mde",
49
+ "soap",
50
+ "manifestacaonfe",
51
+ "distribuicaodfe"
52
+ ],
53
+ "author": "Bitize",
54
+ "contributors": [
55
+ "Lucas Melo <lucashpmelo94@gmail.com> (autor original do node-mde)"
56
+ ],
57
+ "license": "MIT",
58
+ "bugs": {
59
+ "url": "https://github.com/bitize/bitmde/issues"
60
+ },
61
+ "homepage": "https://github.com/bitize/bitmde#readme",
62
+ "dependencies": {
63
+ "axios": "1.19.0",
64
+ "fast-xml-parser": "5.11.0",
65
+ "luxon": "^3.7.2",
66
+ "node-forge": "1.4.0",
67
+ "xml-crypto": "6.1.2"
68
+ },
69
+ "devDependencies": {
70
+ "@types/luxon": "^3.7.4",
71
+ "@types/node": "^26.2.0",
72
+ "@types/node-forge": "^1.3.14",
73
+ "mocha": "^11.8.0",
74
+ "prettier": "3.9.6",
75
+ "typescript": "^5.9.3",
76
+ "uglify-js": "^3.19.3"
77
+ },
78
+ "overrides": {
79
+ "diff": "^9.0.0",
80
+ "serialize-javascript": "^7.1.0"
81
+ }
82
+ }