node-sped-nfe 1.1.4 → 1.1.6
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/README.md +16 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/utils/eventos.js +198 -72
- package/dist/utils/extras.d.ts +3 -1
- package/dist/utils/extras.js +49 -1
- package/dist/utils/tools.d.ts +14 -0
- package/dist/utils/tools.js +305 -90
- package/package.json +6 -3
- package/schemas/PL_009_V4/110150_v1.00.xsd +88 -0
- package/schemas/PL_009_V4/Averb_v1.00.xsd +11 -0
- package/schemas/PL_009_V4/CCe_v1.00.xsd +11 -0
- package/schemas/PL_009_V4/EPEC_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/EPP1.xml +13 -0
- package/schemas/PL_009_V4/ERP1.xml +19 -0
- package/schemas/PL_009_V4/EventoCancEConf_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/EventoCancInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/EventoEConf_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/EventoInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/MT_inutNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/SuframaInternaliza_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/SuframaVistoria_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/confRecebto_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/consCad_v2.00.xsd +9 -0
- package/schemas/PL_009_V4/consGTIN_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/consNFeDest_v1.01.xsd +10 -0
- package/schemas/PL_009_V4/consReciNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/consReciNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/consSitNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/consSitNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/consStatServ_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/consStatServ_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/distDFeInt_v1.00.xsd +71 -0
- package/schemas/PL_009_V4/distDFeInt_v1.01.xsd +97 -0
- package/schemas/PL_009_V4/downloadNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/e110110_v1.00.xsd +58 -0
- package/schemas/PL_009_V4/e110111_v1.00.xsd +42 -0
- package/schemas/PL_009_V4/e110112_v1.00.xsd +69 -0
- package/schemas/PL_009_V4/e110130_v1.00.xsd +102 -0
- package/schemas/PL_009_V4/e110131_v1.00.xsd +51 -0
- package/schemas/PL_009_V4/e110140NFCe_v1.00.xsd +118 -0
- package/schemas/PL_009_V4/e110140NFe_v1.00.xsd +124 -0
- package/schemas/PL_009_V4/e110140_v1.00.xsd +124 -0
- package/schemas/PL_009_V4/e110150_v1.00.xsd +88 -0
- package/schemas/PL_009_V4/e110192_v1.00.xsd +106 -0
- package/schemas/PL_009_V4/e110193_v1.00.xsd +40 -0
- package/schemas/PL_009_V4/e110750_v1.00.xsd +138 -0
- package/schemas/PL_009_V4/e110751_v1.00.xsd +39 -0
- package/schemas/PL_009_V4/e111500_v1.00.xsd +69 -0
- package/schemas/PL_009_V4/e111501_v1.00.xsd +69 -0
- package/schemas/PL_009_V4/e111502_v1.00.xsd +50 -0
- package/schemas/PL_009_V4/e111503_v1.00.xsd +50 -0
- package/schemas/PL_009_V4/e210200_v1.00.xsd +31 -0
- package/schemas/PL_009_V4/e210210_v1.00.xsd +31 -0
- package/schemas/PL_009_V4/e210220_v1.00.xsd +44 -0
- package/schemas/PL_009_V4/e210240_v1.00.xsd +44 -0
- package/schemas/PL_009_V4/e411500_v1.00.xsd +134 -0
- package/schemas/PL_009_V4/e411501_v1.00.xsd +134 -0
- package/schemas/PL_009_V4/e411502_v1.00.xsd +95 -0
- package/schemas/PL_009_V4/e411503_v1.00.xsd +95 -0
- package/schemas/PL_009_V4/e610130_v1.00.xsd +128 -0
- package/schemas/PL_009_V4/e610131_v1.00.xsd +68 -0
- package/schemas/PL_009_V4/e790700_v1.00.xsd +125 -0
- package/schemas/PL_009_V4/e990900_v1.00.xsd +87 -0
- package/schemas/PL_009_V4/e990910_v1.00.xsd +81 -0
- package/schemas/PL_009_V4/envAverb_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/envCCe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/envCancelPProrrogNFe_v1.0.xsd +50 -0
- package/schemas/PL_009_V4/envComprovanteEntregaNFe_v1.00.xsd +11 -0
- package/schemas/PL_009_V4/envConfRecebto_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/envEPEC_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/envEventoAtorInteressado_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/envEventoCancEConf_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/envEventoCancEntregaNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/envEventoCancInsucessoNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/envEventoCancNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/envEventoCancSubst_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/envEventoEConf_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/envEventoEntregaNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/envEventoInsucessoNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/envEvento_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/envFiscoNfe_v1.0.xsd +179 -0
- package/schemas/PL_009_V4/envPProrrogNFe_v1.0.xsd +65 -0
- package/schemas/PL_009_V4/envRemIndus_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/envSuframaInternaliza_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/envSuframaVistoria_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/enviNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/enviNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/eventoAtorInteressado_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/eventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/eventoCancNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/eventoCancSubst_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/eventoEPEC_v0.01.xsd +267 -0
- package/schemas/PL_009_V4/eventoEPEC_v1.00.xsd +231 -0
- package/schemas/PL_009_V4/eventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/eventoRemIndus_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/inutNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/inutNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/leiauteAverb_v1.00.xsd +482 -0
- package/schemas/PL_009_V4/leiauteCCe_v1.00.xsd +382 -0
- package/schemas/PL_009_V4/leiauteCcgConsGTIN_v1.00.xsd +94 -0
- package/schemas/PL_009_V4/leiauteComprovanteEntregaNFe_v1.00.xsd +487 -0
- package/schemas/PL_009_V4/leiauteConfRecebto_v1.00.xsd +369 -0
- package/schemas/PL_009_V4/leiauteConsNFeDest_v1.01.xsd +483 -0
- package/schemas/PL_009_V4/leiauteConsSitNFe_v3.10.xsd +502 -0
- package/schemas/PL_009_V4/leiauteConsSitNFe_v4.00.xsd +502 -0
- package/schemas/PL_009_V4/leiauteConsStatServ_v3.10.xsd +98 -0
- package/schemas/PL_009_V4/leiauteConsStatServ_v4.00.xsd +98 -0
- package/schemas/PL_009_V4/leiauteConsultaCadastro_v2.00.xsd +404 -0
- package/schemas/PL_009_V4/leiauteDownloadNFe_v1.00.xsd +149 -0
- package/schemas/PL_009_V4/leiauteEPEC_v1.00.xsd +423 -0
- package/schemas/PL_009_V4/leiauteEventoAtorInteressado_v1.00.xsd +384 -0
- package/schemas/PL_009_V4/leiauteEventoCancEConf_v1.00.xsd +296 -0
- package/schemas/PL_009_V4/leiauteEventoCancEntregaNFe_v1.00.xsd +307 -0
- package/schemas/PL_009_V4/leiauteEventoCancInsucessoNFe_v1.00.xsd +297 -0
- package/schemas/PL_009_V4/leiauteEventoCancNFe_v1.00.xsd +358 -0
- package/schemas/PL_009_V4/leiauteEventoCancSubst_v1.00.xsd +366 -0
- package/schemas/PL_009_V4/leiauteEventoEConf_v1.00.xsd +296 -0
- package/schemas/PL_009_V4/leiauteEventoEntregaNFe_v1.00.xsd +321 -0
- package/schemas/PL_009_V4/leiauteEventoInsucessoNFe_v1.00.xsd +297 -0
- package/schemas/PL_009_V4/leiauteEvento_v1.00.xsd +335 -0
- package/schemas/PL_009_V4/leiauteInutNFe_v3.10.xsd +193 -0
- package/schemas/PL_009_V4/leiauteInutNFe_v4.00.xsd +193 -0
- package/schemas/PL_009_V4/leiauteInutNFe_v4.00_MT.xsd +200 -0
- package/schemas/PL_009_V4/leiauteNFe_v3.10.xsd +6060 -0
- package/schemas/PL_009_V4/leiauteNFe_v4.00.xsd +7412 -0
- package/schemas/PL_009_V4/leiauteRemIndus_v1.00.xsd +344 -0
- package/schemas/PL_009_V4/leiauteSuframaInternaliza_v1.00.xsd +642 -0
- package/schemas/PL_009_V4/leiauteSuframaVistoria_v1.00.xsd +648 -0
- package/schemas/PL_009_V4/nfe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/nfe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/procAverbNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/procCCeNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/procComprovanteEntregaNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/procConfRecebtoNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEPEC_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoAtorInteressado_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoCancEConf_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoCancInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoCancNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoCancSubst_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoEConf_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/procEventoNFe_v99.99.xsd +37 -0
- package/schemas/PL_009_V4/procInutNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/procInutNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/procNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/procNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/procRemIndus_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/prod_leiauteNFe_v4.00.xsd +6736 -0
- package/schemas/PL_009_V4/resEvento_v1.00.xsd +94 -0
- package/schemas/PL_009_V4/resEvento_v1.01.xsd +108 -0
- package/schemas/PL_009_V4/resNFe_v1.00.xsd +110 -0
- package/schemas/PL_009_V4/resNFe_v1.01.xsd +122 -0
- package/schemas/PL_009_V4/retComprovanteEntregaNFe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/retConsCad_v2.00.xsd +9 -0
- package/schemas/PL_009_V4/retConsGTIN_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retConsReciNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/retConsReciNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/retConsSitNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/retConsSitNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/retConsStatServ_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/retConsStatServ_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/retDistDFeInt_v1.00.xsd +84 -0
- package/schemas/PL_009_V4/retDistDFeInt_v1.01.xsd +99 -0
- package/schemas/PL_009_V4/retDownloadNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvAverb_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvAverb_v1.00_1.xsd +9 -0
- package/schemas/PL_009_V4/retEnvCCe_v1.00.xsd +10 -0
- package/schemas/PL_009_V4/retEnvCancelPProrrogNFe_v1.0.xsd +231 -0
- package/schemas/PL_009_V4/retEnvConfRecebto_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvEPEC_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvEventoAtorInteressado_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvEventoCancNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvEventoCancSubst_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvEvento_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvFiscoNFe_v1.0.xsd +234 -0
- package/schemas/PL_009_V4/retEnvRemIndus_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvSuframaInternaliza_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnvSuframaVistoria_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEnviNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/retEnviNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/retEventoCancEConf_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEventoCancInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEventoEConf_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEventoEPEC_v0.01.xsd +207 -0
- package/schemas/PL_009_V4/retEventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retEventoInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_009_V4/retInutNFe_v3.10.xsd +9 -0
- package/schemas/PL_009_V4/retInutNFe_v4.00.xsd +9 -0
- package/schemas/PL_009_V4/retPProrrogNFe_v1.0.xsd +233 -0
- package/schemas/PL_009_V4/retconsNFeDest_v1.01.xsd +9 -0
- package/schemas/PL_009_V4/tiposBasico_v1.03.xsd +871 -0
- package/schemas/PL_009_V4/tiposBasico_v3.10.xsd +571 -0
- package/schemas/PL_009_V4/tiposBasico_v4.00.xsd +598 -0
- package/schemas/PL_009_V4/tiposBasicosCcgConsGTIN_v1.00.xsd +84 -0
- package/schemas/PL_009_V4/tiposDistDFe_v1.00.xsd +217 -0
- package/schemas/PL_009_V4/tiposDistDFe_v1.01.xsd +222 -0
- package/schemas/PL_009_V4/xmldsig-core-schema_v1.01.xsd +98 -0
- package/schemas/PL_009p_NT2024_003/consReciNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/consSitNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/consStatServ_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/enviNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/inutNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/leiauteConsSitNFe_v4.00.xsd +502 -0
- package/schemas/PL_009p_NT2024_003/leiauteConsStatServ_v4.00.xsd +98 -0
- package/schemas/PL_009p_NT2024_003/leiauteInutNFe_v4.00.xsd +193 -0
- package/schemas/PL_009p_NT2024_003/leiauteNFe_v4.00.xsd +7412 -0
- package/schemas/PL_009p_NT2024_003/nfe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/procInutNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/procNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/retConsReciNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/retConsSitNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/retConsStatServ_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/retEnviNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/retInutNFe_v4.00.xsd +9 -0
- package/schemas/PL_009p_NT2024_003/tiposBasico_v4.00.xsd +598 -0
- package/schemas/PL_009p_NT2024_003/xmldsig-core-schema_v1.01.xsd +98 -0
- package/schemas/PL_010_V1/110150_v1.00.xsd +88 -0
- package/schemas/PL_010_V1/Averb_v1.00.xsd +11 -0
- package/schemas/PL_010_V1/CCe_v1.00.xsd +11 -0
- package/schemas/PL_010_V1/DFeTiposBasicos_v1.00.xsd +938 -0
- package/schemas/PL_010_V1/EPEC_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/EPP1.xml +13 -0
- package/schemas/PL_010_V1/ERP1.xml +19 -0
- package/schemas/PL_010_V1/EventoCancEConf_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/EventoCancInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/EventoEConf_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/EventoInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/MT_inutNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/SuframaInternaliza_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/SuframaVistoria_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/confRecebto_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/consCad_v2.00.xsd +9 -0
- package/schemas/PL_010_V1/consGTIN_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/consNFeDest_v1.01.xsd +10 -0
- package/schemas/PL_010_V1/consReciNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/consReciNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/consSitNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/consSitNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/consStatServ_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/consStatServ_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/distDFeInt_v1.00.xsd +71 -0
- package/schemas/PL_010_V1/distDFeInt_v1.01.xsd +97 -0
- package/schemas/PL_010_V1/downloadNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/e110110_v1.00.xsd +58 -0
- package/schemas/PL_010_V1/e110111_v1.00.xsd +42 -0
- package/schemas/PL_010_V1/e110112_v1.00.xsd +69 -0
- package/schemas/PL_010_V1/e110130_v1.00.xsd +102 -0
- package/schemas/PL_010_V1/e110131_v1.00.xsd +51 -0
- package/schemas/PL_010_V1/e110140NFCe_v1.00.xsd +118 -0
- package/schemas/PL_010_V1/e110140NFe_v1.00.xsd +124 -0
- package/schemas/PL_010_V1/e110140_v1.00.xsd +124 -0
- package/schemas/PL_010_V1/e110150_v1.00.xsd +88 -0
- package/schemas/PL_010_V1/e110192_v1.00.xsd +106 -0
- package/schemas/PL_010_V1/e110193_v1.00.xsd +40 -0
- package/schemas/PL_010_V1/e110750_v1.00.xsd +138 -0
- package/schemas/PL_010_V1/e110751_v1.00.xsd +39 -0
- package/schemas/PL_010_V1/e111500_v1.00.xsd +69 -0
- package/schemas/PL_010_V1/e111501_v1.00.xsd +69 -0
- package/schemas/PL_010_V1/e111502_v1.00.xsd +50 -0
- package/schemas/PL_010_V1/e111503_v1.00.xsd +50 -0
- package/schemas/PL_010_V1/e210200_v1.00.xsd +31 -0
- package/schemas/PL_010_V1/e210210_v1.00.xsd +31 -0
- package/schemas/PL_010_V1/e210220_v1.00.xsd +44 -0
- package/schemas/PL_010_V1/e210240_v1.00.xsd +44 -0
- package/schemas/PL_010_V1/e411500_v1.00.xsd +134 -0
- package/schemas/PL_010_V1/e411501_v1.00.xsd +134 -0
- package/schemas/PL_010_V1/e411502_v1.00.xsd +95 -0
- package/schemas/PL_010_V1/e411503_v1.00.xsd +95 -0
- package/schemas/PL_010_V1/e610130_v1.00.xsd +128 -0
- package/schemas/PL_010_V1/e610131_v1.00.xsd +68 -0
- package/schemas/PL_010_V1/e790700_v1.00.xsd +125 -0
- package/schemas/PL_010_V1/e990900_v1.00.xsd +87 -0
- package/schemas/PL_010_V1/e990910_v1.00.xsd +81 -0
- package/schemas/PL_010_V1/envAverb_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/envCCe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/envCancelPProrrogNFe_v1.0.xsd +50 -0
- package/schemas/PL_010_V1/envComprovanteEntregaNFe_v1.00.xsd +11 -0
- package/schemas/PL_010_V1/envConfRecebto_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/envEPEC_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/envEventoAtorInteressado_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/envEventoCancEConf_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/envEventoCancEntregaNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/envEventoCancInsucessoNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/envEventoCancNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/envEventoCancSubst_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/envEventoEConf_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/envEventoEntregaNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/envEventoInsucessoNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/envEvento_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/envFiscoNfe_v1.0.xsd +179 -0
- package/schemas/PL_010_V1/envPProrrogNFe_v1.0.xsd +65 -0
- package/schemas/PL_010_V1/envRemIndus_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/envSuframaInternaliza_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/envSuframaVistoria_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/enviNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/enviNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/eventoAtorInteressado_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/eventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/eventoCancNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/eventoCancSubst_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/eventoEPEC_v0.01.xsd +267 -0
- package/schemas/PL_010_V1/eventoEPEC_v1.00.xsd +231 -0
- package/schemas/PL_010_V1/eventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/eventoRemIndus_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/inutNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/inutNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/leiauteAverb_v1.00.xsd +482 -0
- package/schemas/PL_010_V1/leiauteCCe_v1.00.xsd +382 -0
- package/schemas/PL_010_V1/leiauteCcgConsGTIN_v1.00.xsd +94 -0
- package/schemas/PL_010_V1/leiauteComprovanteEntregaNFe_v1.00.xsd +487 -0
- package/schemas/PL_010_V1/leiauteConfRecebto_v1.00.xsd +369 -0
- package/schemas/PL_010_V1/leiauteConsNFeDest_v1.01.xsd +483 -0
- package/schemas/PL_010_V1/leiauteConsSitNFe_v3.10.xsd +502 -0
- package/schemas/PL_010_V1/leiauteConsSitNFe_v4.00.xsd +502 -0
- package/schemas/PL_010_V1/leiauteConsStatServ_v3.10.xsd +98 -0
- package/schemas/PL_010_V1/leiauteConsStatServ_v4.00.xsd +98 -0
- package/schemas/PL_010_V1/leiauteConsultaCadastro_v2.00.xsd +404 -0
- package/schemas/PL_010_V1/leiauteDownloadNFe_v1.00.xsd +149 -0
- package/schemas/PL_010_V1/leiauteEPEC_v1.00.xsd +423 -0
- package/schemas/PL_010_V1/leiauteEventoAtorInteressado_v1.00.xsd +384 -0
- package/schemas/PL_010_V1/leiauteEventoCancEConf_v1.00.xsd +296 -0
- package/schemas/PL_010_V1/leiauteEventoCancEntregaNFe_v1.00.xsd +307 -0
- package/schemas/PL_010_V1/leiauteEventoCancInsucessoNFe_v1.00.xsd +297 -0
- package/schemas/PL_010_V1/leiauteEventoCancNFe_v1.00.xsd +358 -0
- package/schemas/PL_010_V1/leiauteEventoCancSubst_v1.00.xsd +366 -0
- package/schemas/PL_010_V1/leiauteEventoEConf_v1.00.xsd +296 -0
- package/schemas/PL_010_V1/leiauteEventoEntregaNFe_v1.00.xsd +321 -0
- package/schemas/PL_010_V1/leiauteEventoInsucessoNFe_v1.00.xsd +297 -0
- package/schemas/PL_010_V1/leiauteEvento_v1.00.xsd +335 -0
- package/schemas/PL_010_V1/leiauteInutNFe_v3.10.xsd +193 -0
- package/schemas/PL_010_V1/leiauteInutNFe_v4.00.xsd +193 -0
- package/schemas/PL_010_V1/leiauteInutNFe_v4.00_MT.xsd +200 -0
- package/schemas/PL_010_V1/leiauteNFe_v3.10.xsd +6060 -0
- package/schemas/PL_010_V1/leiauteNFe_v4.00.xsd +7438 -0
- package/schemas/PL_010_V1/leiauteRemIndus_v1.00.xsd +344 -0
- package/schemas/PL_010_V1/leiauteSuframaInternaliza_v1.00.xsd +642 -0
- package/schemas/PL_010_V1/leiauteSuframaVistoria_v1.00.xsd +648 -0
- package/schemas/PL_010_V1/nfe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/nfe_v4.00.xsd +10 -0
- package/schemas/PL_010_V1/procAverbNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/procCCeNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/procComprovanteEntregaNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/procConfRecebtoNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEPEC_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoAtorInteressado_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoCancEConf_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoCancInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoCancNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoCancSubst_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoEConf_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/procEventoNFe_v99.99.xsd +37 -0
- package/schemas/PL_010_V1/procInutNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/procInutNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/procNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/procNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/procRemIndus_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/prod_leiauteNFe_v4.00.xsd +6736 -0
- package/schemas/PL_010_V1/resEvento_v1.00.xsd +94 -0
- package/schemas/PL_010_V1/resEvento_v1.01.xsd +108 -0
- package/schemas/PL_010_V1/resNFe_v1.00.xsd +110 -0
- package/schemas/PL_010_V1/resNFe_v1.01.xsd +122 -0
- package/schemas/PL_010_V1/retComprovanteEntregaNFe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/retConsCad_v2.00.xsd +9 -0
- package/schemas/PL_010_V1/retConsGTIN_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retConsReciNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/retConsReciNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/retConsSitNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/retConsSitNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/retConsStatServ_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/retConsStatServ_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/retDistDFeInt_v1.00.xsd +84 -0
- package/schemas/PL_010_V1/retDistDFeInt_v1.01.xsd +99 -0
- package/schemas/PL_010_V1/retDownloadNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvAverb_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvAverb_v1.00_1.xsd +9 -0
- package/schemas/PL_010_V1/retEnvCCe_v1.00.xsd +10 -0
- package/schemas/PL_010_V1/retEnvCancelPProrrogNFe_v1.0.xsd +231 -0
- package/schemas/PL_010_V1/retEnvConfRecebto_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvEPEC_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvEventoAtorInteressado_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvEventoCancNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvEventoCancSubst_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvEvento_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvFiscoNFe_v1.0.xsd +234 -0
- package/schemas/PL_010_V1/retEnvRemIndus_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvSuframaInternaliza_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnvSuframaVistoria_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEnviNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/retEnviNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/retEventoCancEConf_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEventoCancInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEventoEConf_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEventoEPEC_v0.01.xsd +207 -0
- package/schemas/PL_010_V1/retEventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retEventoInsucessoNFe_v1.00.xsd +9 -0
- package/schemas/PL_010_V1/retInutNFe_v3.10.xsd +9 -0
- package/schemas/PL_010_V1/retInutNFe_v4.00.xsd +9 -0
- package/schemas/PL_010_V1/retPProrrogNFe_v1.0.xsd +233 -0
- package/schemas/PL_010_V1/retconsNFeDest_v1.01.xsd +9 -0
- package/schemas/PL_010_V1/tiposBasico_v1.03.xsd +871 -0
- package/schemas/PL_010_V1/tiposBasico_v3.10.xsd +571 -0
- package/schemas/PL_010_V1/tiposBasico_v4.00.xsd +598 -0
- package/schemas/PL_010_V1/tiposBasicosCcgConsGTIN_v1.00.xsd +84 -0
- package/schemas/PL_010_V1/tiposDistDFe_v1.00.xsd +217 -0
- package/schemas/PL_010_V1/tiposDistDFe_v1.01.xsd +222 -0
- package/schemas/PL_010_V1/xmldsig-core-schema_v1.01.xsd +98 -0
- package/schemas/Teste/EventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/Teste/EventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/Teste/e110130_v1.00.xsd +102 -0
- package/schemas/Teste/e110131_v1.00.xsd +51 -0
- package/schemas/Teste/envEventoCancEntregaNFe_v1.00.xsd +10 -0
- package/schemas/Teste/envEventoEntregaNFe_v1.00.xsd +10 -0
- package/schemas/Teste/leiauteEventoCancEntregaNFe_v1.00.xsd +307 -0
- package/schemas/Teste/leiauteEventoEntregaNFe_v1.00.xsd +321 -0
- package/schemas/Teste/procEventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/Teste/procEventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/Teste/retEventoCancEntregaNFe_v1.00.xsd +9 -0
- package/schemas/Teste/retEventoEntregaNFe_v1.00.xsd +9 -0
- package/schemas/Teste/tiposBasico_v1.03.xsd +871 -0
- package/schemas/Teste/xmldsig-core-schema_v1.01.xsd +98 -0
package/dist/utils/extras.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
declare const cUF2UF: any, UF2cUF: any;
|
2
2
|
declare const xml2json: (xml: string) => Promise<object>;
|
3
3
|
declare const json2xml: (obj: object) => Promise<string>;
|
4
|
-
|
4
|
+
declare const formatData: (dataUsr?: Date) => string;
|
5
|
+
declare const docZip: (xml: string, retorno?: string) => Promise<unknown>;
|
6
|
+
export { cUF2UF, UF2cUF, json2xml, xml2json, formatData, docZip };
|
package/dist/utils/extras.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import { XMLParser, XMLBuilder } from "fast-xml-parser";
|
2
|
+
import { gunzipSync } from 'zlib'; // ou zlibSync
|
3
|
+
import { Buffer } from 'buffer';
|
2
4
|
const cUF2UF = {
|
3
5
|
"11": "RO",
|
4
6
|
"12": "AC",
|
@@ -292,4 +294,50 @@ const json2xml = (obj) => {
|
|
292
294
|
resvol(XMLBuil.build(obj));
|
293
295
|
});
|
294
296
|
};
|
295
|
-
|
297
|
+
const formatData = (dataUsr = new Date()) => {
|
298
|
+
const ano = dataUsr.getFullYear();
|
299
|
+
const mes = String(dataUsr.getMonth() + 1).padStart(2, '0'); // Adiciona 1 porque os meses começam do 0
|
300
|
+
const dia = String(dataUsr.getDate()).padStart(2, '0');
|
301
|
+
const horas = String(dataUsr.getHours()).padStart(2, '0');
|
302
|
+
const minutos = String(dataUsr.getMinutes()).padStart(2, '0');
|
303
|
+
const segundos = String(dataUsr.getSeconds()).padStart(2, '0');
|
304
|
+
const fusoHorario = -dataUsr.getTimezoneOffset() / 60; // Obtém o fuso horário em horas
|
305
|
+
const formatoISO = `${ano}-${mes}-${dia}T${horas}:${minutos}:${segundos}${fusoHorario >= 0 ? '+' : '-'}${String(Math.abs(fusoHorario)).padStart(2, '0')}:00`;
|
306
|
+
return formatoISO;
|
307
|
+
};
|
308
|
+
const docZip = async (xml, retorno = "original") => {
|
309
|
+
return new Promise(async (resolve, reject) => {
|
310
|
+
if (typeof retorno == "undefined")
|
311
|
+
retorno = "original";
|
312
|
+
const decodeDocZipToXml = (docZipBase64) => {
|
313
|
+
// 1. Converte base64 para buffer
|
314
|
+
const zippedBuffer = Buffer.from(docZipBase64, 'base64');
|
315
|
+
// 2. Descomprime com gzip
|
316
|
+
const xmlBuffer = gunzipSync(zippedBuffer);
|
317
|
+
// 3. Converte para string UTF-8
|
318
|
+
return xmlBuffer.toString('utf8');
|
319
|
+
};
|
320
|
+
const jXml = await xml2json(xml);
|
321
|
+
try {
|
322
|
+
var docZips = jXml["soap:Envelope"]["soap:Body"]["nfeDistDFeInteresseResponse"]["nfeDistDFeInteresseResult"]["retDistDFeInt"];
|
323
|
+
if (typeof docZips['loteDistDFeInt'] == "undefined")
|
324
|
+
return resolve([]);
|
325
|
+
docZips = docZips["loteDistDFeInt"]['docZip'];
|
326
|
+
if (!Array.isArray(docZips))
|
327
|
+
docZips = [docZips];
|
328
|
+
for (const doc of docZips) {
|
329
|
+
doc['xml'] = decodeDocZipToXml(doc['#text']);
|
330
|
+
doc['NSU'] = doc['@NSU'];
|
331
|
+
doc['schema'] = doc['@schema'];
|
332
|
+
delete doc['#text'];
|
333
|
+
delete doc['@NSU'];
|
334
|
+
delete doc['@schema'];
|
335
|
+
}
|
336
|
+
resolve(docZips);
|
337
|
+
}
|
338
|
+
catch (error) {
|
339
|
+
reject(error);
|
340
|
+
}
|
341
|
+
});
|
342
|
+
};
|
343
|
+
export { cUF2UF, UF2cUF, json2xml, xml2json, formatData, docZip };
|
package/dist/utils/tools.d.ts
CHANGED
@@ -10,6 +10,8 @@ declare class Tools {
|
|
10
10
|
versao: string;
|
11
11
|
timeout: number;
|
12
12
|
openssl: null;
|
13
|
+
CPF: string;
|
14
|
+
CNPJ: string;
|
13
15
|
}, certificado?: {
|
14
16
|
pfx: string;
|
15
17
|
senha: string;
|
@@ -20,6 +22,18 @@ declare class Tools {
|
|
20
22
|
json2xml(obj: object): Promise<string>;
|
21
23
|
getCertificado(): Promise<object>;
|
22
24
|
consultarNFe(chNFe: string): Promise<string>;
|
25
|
+
sefazEvento({ chNFe, tpEvento, nProt, justificativa, textoCorrecao, sequencial }: {
|
26
|
+
chNFe?: string | undefined;
|
27
|
+
tpEvento?: string | undefined;
|
28
|
+
nProt?: string | undefined;
|
29
|
+
justificativa?: string | undefined;
|
30
|
+
textoCorrecao?: string | undefined;
|
31
|
+
sequencial?: number | undefined;
|
32
|
+
}): Promise<string>;
|
33
|
+
sefazDistDFe({ ultNSU }: {
|
34
|
+
ultNSU?: string;
|
35
|
+
}): Promise<string>;
|
23
36
|
sefazStatus(): Promise<string>;
|
37
|
+
validarNFe(xml: string): Promise<any>;
|
24
38
|
}
|
25
39
|
export { Tools };
|
package/dist/utils/tools.js
CHANGED
@@ -9,8 +9,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
11
|
};
|
12
|
-
var _Tools_instances, _Tools_cert,
|
13
|
-
import {
|
12
|
+
var _Tools_instances, _Tools_cert, _Tools_pem, _Tools_config, _Tools_getSignature, _Tools_gerarQRCodeNFCe, _Tools_descEvento, _Tools_xmlValido, _Tools_certTools;
|
13
|
+
import { XMLBuilder } from "fast-xml-parser";
|
14
14
|
import https from "https";
|
15
15
|
import { spawnSync } from "child_process";
|
16
16
|
import tmp from "tmp";
|
@@ -20,17 +20,14 @@ import fs from "fs";
|
|
20
20
|
import path from 'path';
|
21
21
|
import { fileURLToPath } from 'url';
|
22
22
|
import pem from 'pem';
|
23
|
-
import { cUF2UF } from "./extras.js";
|
23
|
+
import { cUF2UF, json2xml, xml2json, UF2cUF } from "./extras.js";
|
24
|
+
import { SignedXml } from 'xml-crypto';
|
24
25
|
const __filename = fileURLToPath(import.meta.url);
|
25
26
|
const __dirname = path.dirname(__filename);
|
26
27
|
class Tools {
|
27
|
-
constructor(config = { mod: "", xmllint: 'xmllint', UF: '', tpAmb: 2, CSC: "", CSCid: "", versao: "4.00", timeout: 30, openssl: null }, certificado = { pfx: "", senha: "" }) {
|
28
|
+
constructor(config = { mod: "", xmllint: 'xmllint', UF: '', tpAmb: 2, CSC: "", CSCid: "", versao: "4.00", timeout: 30, openssl: null, CPF: "", CNPJ: "" }, certificado = { pfx: "", senha: "" }) {
|
28
29
|
_Tools_instances.add(this);
|
29
30
|
_Tools_cert.set(this, void 0);
|
30
|
-
_Tools_xmlTools.set(this, {
|
31
|
-
XMLBuilder: {},
|
32
|
-
XMLParser: {}
|
33
|
-
});
|
34
31
|
_Tools_pem.set(this, {
|
35
32
|
key: "", // A chave privada extraída do PKCS#12, em formato PEM
|
36
33
|
cert: "", // O certificado extraído, em formato PEM
|
@@ -55,15 +52,6 @@ class Tools {
|
|
55
52
|
//Configurar certificado
|
56
53
|
__classPrivateFieldSet(this, _Tools_config, config, "f");
|
57
54
|
__classPrivateFieldSet(this, _Tools_cert, certificado, "f");
|
58
|
-
__classPrivateFieldGet(this, _Tools_xmlTools, "f").XMLBuilder = new XMLBuilder({
|
59
|
-
ignoreAttributes: false,
|
60
|
-
attributeNamePrefix: "@",
|
61
|
-
});
|
62
|
-
__classPrivateFieldGet(this, _Tools_xmlTools, "f").XMLParser = new XMLParser({
|
63
|
-
ignoreAttributes: false,
|
64
|
-
attributeNamePrefix: "@",
|
65
|
-
parseTagValue: false, // Evita conversão automática de valores
|
66
|
-
});
|
67
55
|
}
|
68
56
|
sefazEnviaLote(xml, data = { idLote: 1, indSinc: 0, compactar: false }) {
|
69
57
|
return new Promise(async (resvol, reject) => {
|
@@ -107,7 +95,7 @@ class Tools {
|
|
107
95
|
},
|
108
96
|
rejectUnauthorized: false
|
109
97
|
},
|
110
|
-
...__classPrivateFieldGet(this,
|
98
|
+
...await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_certTools).call(this)
|
111
99
|
}, (res) => {
|
112
100
|
let data = '';
|
113
101
|
res.on('data', (chunk) => {
|
@@ -139,71 +127,33 @@ class Tools {
|
|
139
127
|
return new Promise(async (resvol, reject) => {
|
140
128
|
if (data.tag === undefined)
|
141
129
|
data.tag = "infNFe";
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
let signedInfo = {
|
147
|
-
"SignedInfo": {
|
148
|
-
"@xmlns": "http://www.w3.org/2000/09/xmldsig#",
|
149
|
-
"CanonicalizationMethod": {
|
150
|
-
"@Algorithm": "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
|
151
|
-
},
|
152
|
-
"SignatureMethod": {
|
153
|
-
"@Algorithm": "http://www.w3.org/2000/09/xmldsig#rsa-sha1" // Mantém SHA1
|
154
|
-
},
|
155
|
-
"Reference": {
|
156
|
-
"@URI": `#${xml.NFe.infNFe['@Id']}`,
|
157
|
-
"Transforms": {
|
158
|
-
"Transform": [
|
159
|
-
{
|
160
|
-
"@Algorithm": "http://www.w3.org/2000/09/xmldsig#enveloped-signature"
|
161
|
-
},
|
162
|
-
{
|
163
|
-
"@Algorithm": "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
|
164
|
-
},
|
165
|
-
]
|
166
|
-
},
|
167
|
-
"DigestMethod": {
|
168
|
-
"@Algorithm": "http://www.w3.org/2000/09/xmldsig#sha1" // Mantém SHA1
|
169
|
-
},
|
170
|
-
"DigestValue": crypto.createHash('sha1').update(await this.json2xml({ infNFe: xml.NFe.infNFe }), 'utf8') // Mantém Hash SHA1
|
171
|
-
.digest('base64')
|
172
|
-
}
|
173
|
-
}
|
174
|
-
};
|
175
|
-
sign.update(await this.json2xml(signedInfo), 'utf8');
|
176
|
-
xml.NFe.Signature = {
|
177
|
-
...signedInfo,
|
178
|
-
...{
|
179
|
-
"SignatureValue": sign.sign(tempPem.key, 'base64'),
|
180
|
-
"KeyInfo": {
|
181
|
-
"X509Data": {
|
182
|
-
"X509Certificate": tempPem.cert.replace(/-----BEGIN CERTIFICATE-----/g, '').replace(/-----END CERTIFICATE-----/g, '').replace(/\r\n/g, '')
|
183
|
-
}
|
184
|
-
},
|
185
|
-
"@xmlns": "http://www.w3.org/2000/09/xmldsig#"
|
130
|
+
var xml = await this.xml2json(xmlJSON);
|
131
|
+
if (data.tag == "infNFe") {
|
132
|
+
if (xml.NFe.infNFe.ide.mod == 65) {
|
133
|
+
xml.NFe.infNFeSupl.qrCode = __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_gerarQRCodeNFCe).call(this, xml.NFe, "2", __classPrivateFieldGet(this, _Tools_config, "f").CSCid, __classPrivateFieldGet(this, _Tools_config, "f").CSC);
|
186
134
|
}
|
187
|
-
|
188
|
-
|
189
|
-
|
135
|
+
xml.NFe = {
|
136
|
+
...xml.NFe,
|
137
|
+
...await xml2json(await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_getSignature).call(this, xmlJSON, data.tag))
|
138
|
+
};
|
190
139
|
}
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
}
|
140
|
+
else if (data.tag == "infEvento") {
|
141
|
+
xml.envEvento.evento = {
|
142
|
+
...xml.envEvento.evento,
|
143
|
+
...(await xml2json(await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_getSignature).call(this, xmlJSON, data.tag)))
|
144
|
+
};
|
145
|
+
}
|
146
|
+
resvol(await json2xml(xml));
|
197
147
|
});
|
198
148
|
}
|
199
149
|
async xml2json(xml) {
|
200
150
|
return new Promise((resvol, reject) => {
|
201
|
-
|
151
|
+
xml2json(xml).then(resvol).catch(reject);
|
202
152
|
});
|
203
153
|
}
|
204
154
|
async json2xml(obj) {
|
205
155
|
return new Promise((resvol, reject) => {
|
206
|
-
|
156
|
+
json2xml(obj).then(resvol).catch(reject);
|
207
157
|
});
|
208
158
|
}
|
209
159
|
//Obter certificado
|
@@ -247,10 +197,10 @@ class Tools {
|
|
247
197
|
attributeNamePrefix: "@"
|
248
198
|
});
|
249
199
|
// Validação do XML interno (opcional)
|
250
|
-
__classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, builder.build({ consSitNFe }), `consSitNFe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`);
|
200
|
+
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, builder.build({ consSitNFe }), `consSitNFe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`).catch(reject);
|
201
|
+
;
|
251
202
|
const xml = builder.build(xmlObj);
|
252
203
|
let tempUF = urlEventos(UF, __classPrivateFieldGet(this, _Tools_config, "f").versao);
|
253
|
-
console.log(tempUF);
|
254
204
|
const url = tempUF[`mod${mod}`][(__classPrivateFieldGet(this, _Tools_config, "f").tpAmb == 1 ? "producao" : "homologacao")].NFeConsultaProtocolo;
|
255
205
|
const req = https.request(url, {
|
256
206
|
method: 'POST',
|
@@ -281,6 +231,215 @@ class Tools {
|
|
281
231
|
}
|
282
232
|
});
|
283
233
|
}
|
234
|
+
async sefazEvento({ chNFe = "", tpEvento = "", nProt = "", justificativa = "", textoCorrecao = "", sequencial = 1 }) {
|
235
|
+
return new Promise(async (resolve, reject) => {
|
236
|
+
try {
|
237
|
+
if (!chNFe)
|
238
|
+
throw "sefazEvento({chNFe}) -> não definido!";
|
239
|
+
if (!tpEvento)
|
240
|
+
throw "sefazEvento({tpEvento}) -> não definido!";
|
241
|
+
if (!__classPrivateFieldGet(this, _Tools_config, "f").CNPJ && !__classPrivateFieldGet(this, _Tools_config, "f").CPF)
|
242
|
+
throw "new Tools({CNPJ|CPF}) -> não definido!";
|
243
|
+
const geradorLote = function () {
|
244
|
+
const agora = new Date();
|
245
|
+
const ano = agora.getFullYear().toString().slice(2); // Só os 2 últimos dígitos do ano
|
246
|
+
const mes = String(agora.getMonth() + 1).padStart(2, '0');
|
247
|
+
const dia = String(agora.getDate()).padStart(2, '0');
|
248
|
+
const hora = String(agora.getHours()).padStart(2, '0');
|
249
|
+
const minuto = String(agora.getMinutes()).padStart(2, '0');
|
250
|
+
const segundo = String(agora.getSeconds()).padStart(2, '0');
|
251
|
+
// Junta tudo
|
252
|
+
let idLote = `${ano}${mes}${dia}${hora}${minuto}${segundo}`;
|
253
|
+
// Se ainda tiver menos de 15 dígitos, adiciona um número aleatório no final
|
254
|
+
while (idLote.length < 15) {
|
255
|
+
idLote += Math.floor(Math.random() * 10); // Adiciona dígitos aleatórios
|
256
|
+
}
|
257
|
+
return idLote;
|
258
|
+
};
|
259
|
+
const tempUF = urlEventos(`AN`, __classPrivateFieldGet(this, _Tools_config, "f").versao);
|
260
|
+
let detEvento = {
|
261
|
+
"@versao": "1.00",
|
262
|
+
"descEvento": __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_descEvento).call(this, `${tpEvento}`)
|
263
|
+
};
|
264
|
+
// Adicionar campos específicos por tipo de evento
|
265
|
+
if (tpEvento === "110111") { // Cancelamento
|
266
|
+
if (!nProt)
|
267
|
+
throw "sefazEvento({nProt}) obrigatório para Cancelamento!";
|
268
|
+
if (!justificativa)
|
269
|
+
throw "sefazEvento({justificativa}) obrigatório para Cancelamento!";
|
270
|
+
detEvento["nProt"] = nProt;
|
271
|
+
detEvento["xJust"] = justificativa;
|
272
|
+
}
|
273
|
+
else if (tpEvento === "110110") { // Carta de Correção
|
274
|
+
if (!textoCorrecao)
|
275
|
+
throw "sefazEvento({textoCorrecao}) obrigatório para Carta de Correção!";
|
276
|
+
detEvento["xCorrecao"] = textoCorrecao;
|
277
|
+
detEvento["xCondUso"] = "A carta de correção é disciplinada pelo § 1º-A do art. 7º do Convênio S/N, de 15 de dezembro de 1970...";
|
278
|
+
}
|
279
|
+
else if (tpEvento === "210240") { // Operação não realizada
|
280
|
+
if (!justificativa)
|
281
|
+
throw "sefazEvento({justificativa}) obrigatório para Operação não realizada!";
|
282
|
+
detEvento["xJust"] = justificativa;
|
283
|
+
}
|
284
|
+
// Ciência (210210), Confirmação (210200), Desconhecimento (210220) não precisam de campos extras
|
285
|
+
const evento = {
|
286
|
+
"envEvento": {
|
287
|
+
"@xmlns": "http://www.portalfiscal.inf.br/nfe",
|
288
|
+
"@versao": "1.00",
|
289
|
+
"idLote": "250429141621528",
|
290
|
+
"evento": {
|
291
|
+
"@xmlns": "http://www.portalfiscal.inf.br/nfe",
|
292
|
+
"@versao": "1.00",
|
293
|
+
"infEvento": {
|
294
|
+
"@Id": `ID${tpEvento}${chNFe}${sequencial.toString().padStart(2, '0')}`,
|
295
|
+
"cOrgao": "91",
|
296
|
+
"tpAmb": __classPrivateFieldGet(this, _Tools_config, "f").tpAmb,
|
297
|
+
"CNPJ": __classPrivateFieldGet(this, _Tools_config, "f").CNPJ,
|
298
|
+
"chNFe": chNFe,
|
299
|
+
"dhEvento": "2025-04-29T14:16:21-03:00",
|
300
|
+
"tpEvento": tpEvento,
|
301
|
+
"nSeqEvento": sequencial,
|
302
|
+
"verEvento": "1.00",
|
303
|
+
"detEvento": detEvento
|
304
|
+
}
|
305
|
+
}
|
306
|
+
}
|
307
|
+
};
|
308
|
+
let xmlSing = await json2xml(evento);
|
309
|
+
xmlSing = await this.xmlSign(xmlSing, { tag: "infEvento" }); //Assinado
|
310
|
+
fs.writeFileSync("testes/xmlEvento.xml", xmlSing, "utf8");
|
311
|
+
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, xmlSing, `envEvento_v1.00`).catch(reject); //Validar corpo
|
312
|
+
xmlSing = await json2xml({
|
313
|
+
"soap:Envelope": {
|
314
|
+
"@xmlns:soap": "http://www.w3.org/2003/05/soap-envelope",
|
315
|
+
"@xmlns:nfe": "http://www.portalfiscal.inf.br/nfe/wsdl/NFeRecepcaoEvento4",
|
316
|
+
"soap:Body": {
|
317
|
+
"nfe:nfeDadosMsg": await xml2json(xmlSing)
|
318
|
+
}
|
319
|
+
}
|
320
|
+
});
|
321
|
+
try {
|
322
|
+
const req = https.request(tempUF[`mod${__classPrivateFieldGet(this, _Tools_config, "f").mod}`][(__classPrivateFieldGet(this, _Tools_config, "f").tpAmb == 1 ? "producao" : "homologacao")].NFeRecepcaoEvento, {
|
323
|
+
...{
|
324
|
+
method: 'POST',
|
325
|
+
headers: {
|
326
|
+
'Content-Type': 'application/soap+xml; charset=utf-8',
|
327
|
+
'Content-Length': xmlSing.length,
|
328
|
+
},
|
329
|
+
rejectUnauthorized: false,
|
330
|
+
},
|
331
|
+
...await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_certTools).call(this)
|
332
|
+
}, (res) => {
|
333
|
+
let data = '';
|
334
|
+
res.on('data', (chunk) => {
|
335
|
+
data += chunk;
|
336
|
+
});
|
337
|
+
res.on('end', () => {
|
338
|
+
resolve(data);
|
339
|
+
});
|
340
|
+
});
|
341
|
+
req.setTimeout(__classPrivateFieldGet(this, _Tools_config, "f").timeout * 1000, () => {
|
342
|
+
reject({
|
343
|
+
name: 'TimeoutError',
|
344
|
+
message: 'The operation was aborted due to timeout'
|
345
|
+
});
|
346
|
+
req.destroy(); // cancela a requisição
|
347
|
+
});
|
348
|
+
req.on('error', (erro) => {
|
349
|
+
reject(erro);
|
350
|
+
});
|
351
|
+
req.write(xmlSing);
|
352
|
+
req.end();
|
353
|
+
}
|
354
|
+
catch (erro) {
|
355
|
+
reject(erro);
|
356
|
+
}
|
357
|
+
}
|
358
|
+
catch (erro) {
|
359
|
+
reject(erro);
|
360
|
+
}
|
361
|
+
});
|
362
|
+
}
|
363
|
+
async sefazDistDFe({ ultNSU = "000000000000000" }) {
|
364
|
+
return new Promise(async (resolve, reject) => {
|
365
|
+
try {
|
366
|
+
if (!__classPrivateFieldGet(this, _Tools_config, "f").CNPJ)
|
367
|
+
throw "CNPJ não definido!";
|
368
|
+
if (__classPrivateFieldGet(this, _Tools_config, "f").CNPJ.length !== 14)
|
369
|
+
throw "CNPJ inválido!";
|
370
|
+
// Gera o XML da consulta
|
371
|
+
// Prepara o SOAP
|
372
|
+
var xmlSing = await json2xml({
|
373
|
+
"distDFeInt": {
|
374
|
+
"@xmlns": "http://www.portalfiscal.inf.br/nfe",
|
375
|
+
"@versao": "1.01",
|
376
|
+
"tpAmb": 1, // 1 = produção, 2 = homologação
|
377
|
+
"cUFAutor": UF2cUF[__classPrivateFieldGet(this, _Tools_config, "f").UF], // "AN" - Ambiente Nacional
|
378
|
+
"CNPJ": __classPrivateFieldGet(this, _Tools_config, "f").CNPJ,
|
379
|
+
"distNSU": {
|
380
|
+
"ultNSU": `${ultNSU}`.padStart(15, '0')
|
381
|
+
}
|
382
|
+
}
|
383
|
+
});
|
384
|
+
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, xmlSing, `distDFeInt_v1.01`).catch(reject); //Validar corpo
|
385
|
+
const tempUF = urlEventos(`AN`, __classPrivateFieldGet(this, _Tools_config, "f").versao);
|
386
|
+
xmlSing = await json2xml({
|
387
|
+
"soap:Envelope": {
|
388
|
+
"@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
389
|
+
"@xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
|
390
|
+
"@xmlns:soap": "http://www.w3.org/2003/05/soap-envelope",
|
391
|
+
"soap:Body": {
|
392
|
+
"nfeDistDFeInteresse": {
|
393
|
+
"@xmlns": "http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe",
|
394
|
+
"nfeDadosMsg": {
|
395
|
+
...{ "@xmlns": "http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe" },
|
396
|
+
...await xml2json(xmlSing)
|
397
|
+
}
|
398
|
+
}
|
399
|
+
}
|
400
|
+
}
|
401
|
+
});
|
402
|
+
// HTTPS Request
|
403
|
+
const req = https.request(tempUF[`mod${__classPrivateFieldGet(this, _Tools_config, "f").mod}`][(__classPrivateFieldGet(this, _Tools_config, "f").tpAmb == 1 ? "producao" : "homologacao")].NFeDistribuicaoDFe, {
|
404
|
+
...{
|
405
|
+
method: 'POST',
|
406
|
+
headers: {
|
407
|
+
'Content-Type': 'application/soap+xml; charset=utf-8',
|
408
|
+
'Content-Length': xmlSing.length,
|
409
|
+
},
|
410
|
+
rejectUnauthorized: false
|
411
|
+
},
|
412
|
+
...await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_certTools).call(this)
|
413
|
+
}, (res) => {
|
414
|
+
let data = '';
|
415
|
+
res.on('data', (chunk) => {
|
416
|
+
console.log(chunk);
|
417
|
+
data += chunk;
|
418
|
+
});
|
419
|
+
res.on('end', () => {
|
420
|
+
resolve(data);
|
421
|
+
});
|
422
|
+
});
|
423
|
+
req.setTimeout(__classPrivateFieldGet(this, _Tools_config, "f").timeout * 1000, () => {
|
424
|
+
reject({
|
425
|
+
name: 'TimeoutError',
|
426
|
+
message: 'The operation was aborted due to timeout'
|
427
|
+
});
|
428
|
+
req.destroy(); // cancela a requisição
|
429
|
+
});
|
430
|
+
req.on('error', (erro) => {
|
431
|
+
reject(erro);
|
432
|
+
});
|
433
|
+
req.write(xmlSing);
|
434
|
+
req.end();
|
435
|
+
// Opcional: salvar a requisição para análise
|
436
|
+
fs.writeFileSync("testes/consultaDistribuicao.xml", xmlSing, "utf8");
|
437
|
+
}
|
438
|
+
catch (erro) {
|
439
|
+
reject(erro);
|
440
|
+
}
|
441
|
+
});
|
442
|
+
}
|
284
443
|
//Consulta status sefaz
|
285
444
|
async sefazStatus() {
|
286
445
|
return new Promise(async (resvol, reject) => {
|
@@ -316,7 +475,7 @@ class Tools {
|
|
316
475
|
attributeNamePrefix: "@"
|
317
476
|
});
|
318
477
|
//Validação
|
319
|
-
__classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, tempBuild.build({ consStatServ }), `consStatServ_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`);
|
478
|
+
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, tempBuild.build({ consStatServ }), `consStatServ_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`).catch(reject);
|
320
479
|
let tempUF = urlEventos(__classPrivateFieldGet(this, _Tools_config, "f").UF, __classPrivateFieldGet(this, _Tools_config, "f").versao);
|
321
480
|
let xml = tempBuild.build(xmlObj);
|
322
481
|
const req = https.request(tempUF[`mod${__classPrivateFieldGet(this, _Tools_config, "f").mod}`][(__classPrivateFieldGet(this, _Tools_config, "f").tpAmb == 1 ? "producao" : "homologacao")].NFeStatusServico, {
|
@@ -356,8 +515,48 @@ class Tools {
|
|
356
515
|
}
|
357
516
|
});
|
358
517
|
}
|
518
|
+
async validarNFe(xml) {
|
519
|
+
return new Promise((resolve, reject) => {
|
520
|
+
__classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, xml, `nfe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`).then(resolve).catch(reject);
|
521
|
+
});
|
522
|
+
}
|
359
523
|
}
|
360
|
-
_Tools_cert = new WeakMap(),
|
524
|
+
_Tools_cert = new WeakMap(), _Tools_pem = new WeakMap(), _Tools_config = new WeakMap(), _Tools_instances = new WeakSet(), _Tools_getSignature =
|
525
|
+
//Responsavel por gerar assinatura
|
526
|
+
async function _Tools_getSignature(xmlJSON, tag) {
|
527
|
+
return new Promise(async (resvol, reject) => {
|
528
|
+
let tempPem = await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_certTools).call(this);
|
529
|
+
const sig = new SignedXml({
|
530
|
+
privateKey: tempPem.key,
|
531
|
+
canonicalizationAlgorithm: 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315',
|
532
|
+
signatureAlgorithm: 'http://www.w3.org/2000/09/xmldsig#rsa-sha1',
|
533
|
+
publicCert: tempPem.pem,
|
534
|
+
getKeyInfoContent: (args) => {
|
535
|
+
const cert = tempPem.cert
|
536
|
+
.toString()
|
537
|
+
.replace('-----BEGIN CERTIFICATE-----', '')
|
538
|
+
.replace('-----END CERTIFICATE-----', '')
|
539
|
+
.replace(/\r?\n|\r/g, '');
|
540
|
+
return `<X509Data><X509Certificate>${cert}</X509Certificate></X509Data>`;
|
541
|
+
}
|
542
|
+
});
|
543
|
+
sig.addReference({
|
544
|
+
xpath: `//*[local-name(.)='${tag}']`,
|
545
|
+
transforms: [
|
546
|
+
'http://www.w3.org/2000/09/xmldsig#enveloped-signature',
|
547
|
+
'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'
|
548
|
+
],
|
549
|
+
digestAlgorithm: 'http://www.w3.org/2000/09/xmldsig#sha1'
|
550
|
+
});
|
551
|
+
sig.computeSignature(xmlJSON, {
|
552
|
+
location: {
|
553
|
+
reference: `//*[local-name()='${tag}']`,
|
554
|
+
action: 'after' // <- insere DENTRO da tag <evento>
|
555
|
+
}
|
556
|
+
});
|
557
|
+
return resvol(sig.getSignatureXml());
|
558
|
+
});
|
559
|
+
}, _Tools_gerarQRCodeNFCe = function _Tools_gerarQRCodeNFCe(NFe, versaoQRCode = "2", idCSC, CSC) {
|
361
560
|
let s = '|', concat, hash;
|
362
561
|
if (NFe.infNFe.ide.tpEmis == 1) {
|
363
562
|
concat = [NFe.infNFe['@Id'].replace("NFe", ""), versaoQRCode, NFe.infNFe.ide.tpAmb, Number(idCSC)].join(s);
|
@@ -368,22 +567,38 @@ _Tools_cert = new WeakMap(), _Tools_xmlTools = new WeakMap(), _Tools_pem = new W
|
|
368
567
|
}
|
369
568
|
hash = crypto.createHash('sha1').update(concat + CSC).digest('hex');
|
370
569
|
return NFe.infNFeSupl.qrCode + '?p=' + concat + s + hash;
|
570
|
+
}, _Tools_descEvento = function _Tools_descEvento(tpEvento) {
|
571
|
+
const eventos = {
|
572
|
+
"110110": "Carta de Correcao",
|
573
|
+
"110111": "Cancelamento",
|
574
|
+
"210200": "Confirmacao da Operacao",
|
575
|
+
"210210": "Ciencia da Operacao",
|
576
|
+
"210220": "Desconhecimento da Operacao",
|
577
|
+
"210240": "Operacao nao Realizada"
|
578
|
+
};
|
579
|
+
return eventos[tpEvento] || "Evento";
|
371
580
|
}, _Tools_xmlValido =
|
372
581
|
//Validar XML da NFe, somente apos assinar
|
373
582
|
async function _Tools_xmlValido(xml, xsd) {
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
583
|
+
return new Promise((resolve, reject) => {
|
584
|
+
const xmlFile = tmp.fileSync({ mode: 0o644, prefix: 'xml-', postfix: '.xml' });
|
585
|
+
fs.writeFileSync(xmlFile.name, xml, { encoding: 'utf8' });
|
586
|
+
const schemaPath = path.resolve(__dirname, `../../schemas/PL_010_V1/${xsd}.xsd`);
|
587
|
+
const verif = spawnSync(__classPrivateFieldGet(this, _Tools_config, "f").xmllint, ['--noout', '--schema', schemaPath, xmlFile.name], { encoding: 'utf8' });
|
588
|
+
xmlFile.removeCallback();
|
589
|
+
// Aqui, usamos o operador de encadeamento opcional (?.)
|
590
|
+
if (verif.error) {
|
591
|
+
return reject("Biblioteca xmllint não encontrada!");
|
592
|
+
}
|
593
|
+
else if (!verif.stderr.includes(".xml validates")) {
|
594
|
+
return reject(verif.stderr.replace(/\/tmp\/[^:\s]+\.xml/g, '') // Remove os caminhos /tmp/*.xml
|
595
|
+
.replace(/\s{2,}/g, ' ') // Ajusta múltiplos espaços para um só
|
596
|
+
.trim()); // Remove espaços no começo e fim)
|
597
|
+
}
|
598
|
+
else {
|
599
|
+
resolve(true);
|
600
|
+
}
|
601
|
+
});
|
387
602
|
}, _Tools_certTools = function _Tools_certTools() {
|
388
603
|
return new Promise(async (resvol, reject) => {
|
389
604
|
if (__classPrivateFieldGet(this, _Tools_pem, "f").key != "")
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "node-sped-nfe",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.6",
|
4
4
|
"author": "Kalmon V. Tavares",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|
@@ -32,7 +32,6 @@
|
|
32
32
|
"teste": "node testes/teste.js"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
|
-
"@types/axios": "^0.9.36",
|
36
35
|
"@types/node": "^22.14.0",
|
37
36
|
"@types/node-forge": "^1.3.11",
|
38
37
|
"@types/pem": "^1.14.4",
|
@@ -41,10 +40,14 @@
|
|
41
40
|
"typescript": "^5.0.0"
|
42
41
|
},
|
43
42
|
"dependencies": {
|
43
|
+
"@xmldom/xmldom": "^0.9.8",
|
44
44
|
"crypto": "^1.0.1",
|
45
45
|
"fast-xml-parser": "^4.5.1",
|
46
46
|
"pem": "^1.14.8",
|
47
|
-
"tmp": "^0.2.3"
|
47
|
+
"tmp": "^0.2.3",
|
48
|
+
"xml-crypto": "^6.1.2",
|
49
|
+
"xmldom": "^0.6.0",
|
50
|
+
"zlib": "^1.0.5"
|
48
51
|
},
|
49
52
|
"repository": {
|
50
53
|
"type": "git",
|