nfets 0.0.45 → 0.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
- import { h as StateCode, j as EnvironmentCode, D as DecimalValue, i as StateAcronym, l as Signature, f as StateCodes, p as TransmitterOptions, q as Transmitter, m as Client, G as RequestConfig, O as SignedEntity, Y as Either, x as NFeTsError, a as ReadCertificateResponse, R as ReadCertificateRequest, J as HttpClient, w as XmlToolkit, y as CacheAdapter, z as CertificateRepository, L as RemoteTransmissionRepository, U as EntitySigner, V as XmlSigner, Z as Left, _ as Right, N as Namespaced } from '../xml-signer-BmpwXTKY.cjs';
1
+ import { h as StateCode, j as EnvironmentCode, D as DecimalValue, i as StateAcronym, l as Signature, f as StateCodes, p as TransmitterOptions, q as Transmitter, m as Client, G as RequestConfig, O as SignedEntity, Z as Either, x as NFeTsError, a as ReadCertificateResponse, Q as SignerRepository, d as SignatureAlgorithm, _ as Left, $ as Right, R as ReadCertificateRequest, J as HttpClient, w as XmlToolkit, y as CacheAdapter, z as CertificateRepository, L as RemoteTransmissionRepository, V as EntitySigner, W as XmlSigner, N as Namespaced } from '../xml-signer-Cu3OlWV1.cjs';
2
+ import { Writable } from 'node:stream';
2
3
  import 'node:crypto';
3
4
 
4
5
  type DeepPartial<T> = {
@@ -1623,12 +1624,17 @@ declare class NFe implements NFe$1 {
1623
1624
  Signature?: Signature;
1624
1625
  }
1625
1626
 
1627
+ declare class CryptoSignerRepository implements SignerRepository {
1628
+ sign(content: string, cert: ReadCertificateResponse, algorithm: SignatureAlgorithm): Promise<Left<NFeTsError> | Right<string>>;
1629
+ }
1630
+
1626
1631
  declare abstract class Pipeline {
1627
1632
  protected readonly certificate?: ReadCertificateRequest | undefined;
1628
1633
  protected readonly xmlns = "http://www.portalfiscal.inf.br/nfe";
1629
1634
  protected readonly http: HttpClient;
1630
1635
  protected readonly toolkit: XmlToolkit;
1631
1636
  protected readonly caching: CacheAdapter;
1637
+ protected readonly signerRepository: CryptoSignerRepository;
1632
1638
  protected readonly certificates: CertificateRepository;
1633
1639
  protected readonly soap: RemoteTransmissionRepository<NfeRemoteClient>;
1634
1640
  protected readonly signer: EntitySigner;
@@ -4613,6 +4619,124 @@ declare class NfceXmlBuilderPipeline<T extends object> extends NfeXmlBuilderPipe
4613
4619
  protected readonly builder: (InfNFeBuilder<T> & IdeBuilder<T>) | AssembleNfeBuilder<T>;
4614
4620
  }
4615
4621
 
4622
+ type DocumentOptions = PDFKit.PDFDocumentOptions;
4623
+ interface TextOptions extends PDFKit.Mixins.TextOptions {
4624
+ x?: number | undefined;
4625
+ y?: number | undefined;
4626
+ }
4627
+ type ImageOptions = PDFKit.Mixins.ImageOption;
4628
+ type ColorValue = PDFKit.Mixins.ColorValue;
4629
+ type RuleValue = PDFKit.Mixins.RuleValue;
4630
+ type TableOptionsWithData = PDFKit.Mixins.TableOptionsWithData;
4631
+ type TupleOfLength<N extends number, T = unknown> = N extends N ? number extends N ? T[] : _TupleOfLength<T, N, []> : never;
4632
+ type _TupleOfLength<T, N extends number, R extends readonly unknown[]> = R['length'] extends N ? R : _TupleOfLength<T, N, readonly [...R, T]>;
4633
+ interface RowBuilderOptions {
4634
+ x: number;
4635
+ y: number;
4636
+ width: number;
4637
+ }
4638
+ interface RowOptions<C extends number> {
4639
+ columns?: C;
4640
+ gap?: number;
4641
+ left?: number;
4642
+ right?: number;
4643
+ size?: TupleOfLength<C, number>;
4644
+ }
4645
+ type RowBuilderFunction = (options: RowBuilderOptions) => PdfBuilder;
4646
+ interface PdfBuilder {
4647
+ table(options: TableOptionsWithData): this;
4648
+ restore(): this;
4649
+ save(): this;
4650
+ end(): void;
4651
+ path(path: string): this;
4652
+ translate(x: number, y: number): this;
4653
+ scale(x: number, y?: number): this;
4654
+ page(options?: DocumentOptions): this;
4655
+ pipe(stream: Writable): this;
4656
+ configure(options: DocumentOptions): this;
4657
+ font(font: string, familyOrSize?: string | number, size?: number): this;
4658
+ fontSize(size: number): this;
4659
+ text(text: string, options?: TextOptions): this;
4660
+ widthOfString(text: string, options?: PDFKit.Mixins.TextOptions): number;
4661
+ heightOfString(text: string, options?: PDFKit.Mixins.TextOptions): number;
4662
+ currentLineHeight(includeGap?: boolean): number;
4663
+ rect(x: number, y: number, w: number, h: number): this;
4664
+ fill(rule: RuleValue): this;
4665
+ fill(color?: ColorValue, rule?: RuleValue): this;
4666
+ stroke(color?: ColorValue): this;
4667
+ image(image: string, x: number, y: number, options?: ImageOptions): this;
4668
+ image(image: string, options?: ImageOptions): this;
4669
+ pageWidth(): number;
4670
+ pageHeight(): number;
4671
+ pageMargins(): PDFKit.Mixins.ExpandedSides<number>;
4672
+ x(): number;
4673
+ y(): number;
4674
+ moveDown(amount?: number): this;
4675
+ row(...items: [...TupleOfLength<1, RowBuilderFunction>]): this;
4676
+ row<C extends number>(options: RowOptions<C>, ...items: [...TupleOfLength<C, RowBuilderFunction>]): this;
4677
+ }
4678
+
4679
+ interface Builder {
4680
+ setup(): void;
4681
+ build(options?: RowBuilderOptions): Promise<PdfBuilder> | PdfBuilder;
4682
+ end(): void;
4683
+ height?: () => number;
4684
+ }
4685
+
4686
+ declare const DanfceSize: {
4687
+ readonly '80mm': number;
4688
+ };
4689
+ interface DanfceOptions {
4690
+ textFontSize: number;
4691
+ titleFontSize: number;
4692
+ width: keyof typeof DanfceSize;
4693
+ height: number;
4694
+ ignoreDefaultLogo?: boolean;
4695
+ logo?: string;
4696
+ credits?: string;
4697
+ }
4698
+
4699
+ declare abstract class DanfcePdfDocument {
4700
+ protected readonly stream: Writable;
4701
+ data: NFCe$1;
4702
+ protNFe?: ProtNFe;
4703
+ readonly builder: PdfBuilder;
4704
+ readonly toolkit: XmlToolkit;
4705
+ readonly defaults: {
4706
+ displayTitle: true;
4707
+ font: string;
4708
+ info: {
4709
+ Author: string;
4710
+ Creator: string;
4711
+ Keywords: string;
4712
+ Title: string;
4713
+ Subject: string;
4714
+ };
4715
+ };
4716
+ options: DanfceOptions;
4717
+ protected abstract get builders(): Builder[];
4718
+ protected abstract clone(stream: Writable): DanfcePdfDocument;
4719
+ constructor(stream: Writable);
4720
+ protected getDynamicHeight(xml: string, factory: (stream: Writable) => DanfcePdfDocument): Promise<number>;
4721
+ protected height(): number;
4722
+ protected apply(): void;
4723
+ protected parse(xml: string): Promise<void>;
4724
+ build(xml: string): Promise<this>;
4725
+ end(): void;
4726
+ currency(value: DecimalValue, maximumFractionDigits?: number): string;
4727
+ isValueNotEmpty(value?: DecimalValue): value is DecimalValue;
4728
+ }
4729
+
4730
+ declare class DanfceDefaultPdfDocument extends DanfcePdfDocument {
4731
+ clone(stream: Writable): DanfcePdfDocument;
4732
+ protected get builders(): Builder[];
4733
+ }
4734
+
4735
+ declare class DanfceReducedPdfDocument extends DanfcePdfDocument {
4736
+ clone(stream: Writable): DanfcePdfDocument;
4737
+ protected get builders(): Builder[];
4738
+ }
4739
+
4616
4740
  declare class NfeXmlBuilder<T extends object = NFe$1> implements INfeXmlBuilder<T> {
4617
4741
  protected readonly builder: XmlToolkit;
4618
4742
  protected contingency?: ContingencyOptions | undefined;
@@ -4692,4 +4816,4 @@ declare class NFCe implements NFCe$1 {
4692
4816
  Signature?: Signature;
4693
4817
  }
4694
4818
 
4695
- export { type AccessKey, AccessKeyBuilder, type AssembleDetXmlBuilder, type AssembleNfeBuilder, type AsynchronousAutorizacaoResponse, type AutXMLBuilder, type AutorizacaoPayload, type AutorizacaoRequest, type AutorizacaoResponse, type AvulsaBuilder, type CanaBuilder, type CobrBuilder, type CofinsBuilder, type CofinsStBuilder, type CompraBuilder, type ConsultStatusPayload, type ConsultStatusRequest, type ConsultStatusResponse, type ConsultaCadastroPayload, type ConsultaCadastroRequest, type ConsultaCadastroResponse, type ConsultaProtocoloPayload, type ConsultaProtocoloRequest, type ConsultaProtocoloResponse, type ContingencyOptions, DefaultDetBuilderAggregator, DefaultTotalBuilderAggregator, type DestBuilder, type DetBuilder, type DetBuilderAggregator, type DetEventoCancelamento, type DetGroupBuilder, type EmitBuilder, type EntregaBuilder, type EventoCancelamento, type EventoItem, type EventoItemAttributes, type EventoLotePayload, type EventoLoteResponse, type EventoPayload, type EventoRequest, type EventoResponse, type ExportaBuilder, type IIBuilder, type INfeDetXmlBuilder, type INfeXmlBuilder, type IcmsBuilder, type IcmsIpiBuilder, type IcmsOrIssQnBuilder, type IcmsufdestBuilder, type IdeBuilder, type ImpostoBuilder, type InfAdicBuilder, type InfEvento, type InfEventoAttributes, type InfIntermedBuilder, type InfInut, type InfInutAttributes, type InfNFeBuilder, type InfRespTecBuilder, type InfSolicNFFBuilder, type InutNFeAttributes, type InutilizacaoPayload, type InutilizacaoRequest, type InutilizacaoResponse, type IssIpiBuilder, type IssQnBuilder, type NFCe$1 as NFCe, NFCe as NFCeDto, type NFCeProc, type NFe$1 as NFe, type NFeAttributes, NFe as NFeDto, type NFeProc, NfceAuthorizerPipeline, NfceConsultStatusPipeline, NfceQrcode, type NfceQrcodeOptions, type NfceQrcodeOptions200, type NfceQrcodeOptions300, type NfceQrcodeOptionsBase, type NfceRemoteClient, NfceRemoteTransmitter, type NfceTransmitter, type NfceTransmitterOptions, NfceXmlBuilder, NfceXmlBuilderPipeline, NfeAuthorizationResponsePipeline, NfeAuthorizerPipeline, NfeConsultStatusPipeline, NfeDetXmlBuilder, NfeNfceCancelPipeline, NfeNfceVoidRangePipeline, type NfeRemoteClient, NfeRemoteTransmitter, type NfeTransmitter, type NfeTransmitterOptions, NfeXmlBuilder, NfeXmlBuilderPipeline, type OptionalSharedImpostoBuilder, type PagBuilder, type PisBuilder, type PisStBuilder, type ProcEventoNFe, type ProdBuilder, type RetAutorizacaoPayload, type RetAutorizacaoRequest, type RetAutorizacaoResponse, type RetCancNFe, type RetEvento, type RetEventoItem, type RetiradaBuilder, type Schema, type SynchronousAutorizacaoResponse, type TotalBuilder, type TotalBuilderAggregator, TpEmis, TpEvent, type TranspBuilder, type VerifiedAccessKey, type VoidRangePayload, schemas };
4819
+ export { type AccessKey, AccessKeyBuilder, type AssembleDetXmlBuilder, type AssembleNfeBuilder, type AsynchronousAutorizacaoResponse, type AutXMLBuilder, type AutorizacaoPayload, type AutorizacaoRequest, type AutorizacaoResponse, type AvulsaBuilder, type CanaBuilder, type CobrBuilder, type CofinsBuilder, type CofinsStBuilder, type CompraBuilder, type ConsultStatusPayload, type ConsultStatusRequest, type ConsultStatusResponse, type ConsultaCadastroPayload, type ConsultaCadastroRequest, type ConsultaCadastroResponse, type ConsultaProtocoloPayload, type ConsultaProtocoloRequest, type ConsultaProtocoloResponse, type ContingencyOptions, DanfceDefaultPdfDocument, DanfceReducedPdfDocument, DefaultDetBuilderAggregator, DefaultTotalBuilderAggregator, type DestBuilder, type DetBuilder, type DetBuilderAggregator, type DetEventoCancelamento, type DetGroupBuilder, type EmitBuilder, type EntregaBuilder, type EventoCancelamento, type EventoItem, type EventoItemAttributes, type EventoLotePayload, type EventoLoteResponse, type EventoPayload, type EventoRequest, type EventoResponse, type ExportaBuilder, type IIBuilder, type INfeDetXmlBuilder, type INfeXmlBuilder, type IcmsBuilder, type IcmsIpiBuilder, type IcmsOrIssQnBuilder, type IcmsufdestBuilder, type IdeBuilder, type ImpostoBuilder, type InfAdicBuilder, type InfEvento, type InfEventoAttributes, type InfIntermedBuilder, type InfInut, type InfInutAttributes, type InfNFeBuilder, type InfRespTecBuilder, type InfSolicNFFBuilder, type InutNFeAttributes, type InutilizacaoPayload, type InutilizacaoRequest, type InutilizacaoResponse, type IssIpiBuilder, type IssQnBuilder, type NFCe$1 as NFCe, NFCe as NFCeDto, type NFCeProc, type NFe$1 as NFe, type NFeAttributes, NFe as NFeDto, type NFeProc, NfceAuthorizerPipeline, NfceConsultStatusPipeline, NfceQrcode, type NfceQrcodeOptions, type NfceQrcodeOptions200, type NfceQrcodeOptions300, type NfceQrcodeOptionsBase, type NfceRemoteClient, NfceRemoteTransmitter, type NfceTransmitter, type NfceTransmitterOptions, NfceXmlBuilder, NfceXmlBuilderPipeline, NfeAuthorizationResponsePipeline, NfeAuthorizerPipeline, NfeConsultStatusPipeline, NfeDetXmlBuilder, NfeNfceCancelPipeline, NfeNfceVoidRangePipeline, type NfeRemoteClient, NfeRemoteTransmitter, type NfeTransmitter, type NfeTransmitterOptions, NfeXmlBuilder, NfeXmlBuilderPipeline, type OptionalSharedImpostoBuilder, type PagBuilder, type PisBuilder, type PisStBuilder, type ProcEventoNFe, type ProdBuilder, type RetAutorizacaoPayload, type RetAutorizacaoRequest, type RetAutorizacaoResponse, type RetCancNFe, type RetEvento, type RetEventoItem, type RetiradaBuilder, type Schema, type SynchronousAutorizacaoResponse, type TotalBuilder, type TotalBuilderAggregator, TpEmis, TpEvent, type TranspBuilder, type VerifiedAccessKey, type VoidRangePayload, schemas };
@@ -1,4 +1,5 @@
1
- import { h as StateCode, j as EnvironmentCode, D as DecimalValue, i as StateAcronym, l as Signature, f as StateCodes, p as TransmitterOptions, q as Transmitter, m as Client, G as RequestConfig, O as SignedEntity, Y as Either, x as NFeTsError, a as ReadCertificateResponse, R as ReadCertificateRequest, J as HttpClient, w as XmlToolkit, y as CacheAdapter, z as CertificateRepository, L as RemoteTransmissionRepository, U as EntitySigner, V as XmlSigner, Z as Left, _ as Right, N as Namespaced } from '../xml-signer-BmpwXTKY.js';
1
+ import { h as StateCode, j as EnvironmentCode, D as DecimalValue, i as StateAcronym, l as Signature, f as StateCodes, p as TransmitterOptions, q as Transmitter, m as Client, G as RequestConfig, O as SignedEntity, Z as Either, x as NFeTsError, a as ReadCertificateResponse, Q as SignerRepository, d as SignatureAlgorithm, _ as Left, $ as Right, R as ReadCertificateRequest, J as HttpClient, w as XmlToolkit, y as CacheAdapter, z as CertificateRepository, L as RemoteTransmissionRepository, V as EntitySigner, W as XmlSigner, N as Namespaced } from '../xml-signer-Cu3OlWV1.js';
2
+ import { Writable } from 'node:stream';
2
3
  import 'node:crypto';
3
4
 
4
5
  type DeepPartial<T> = {
@@ -1623,12 +1624,17 @@ declare class NFe implements NFe$1 {
1623
1624
  Signature?: Signature;
1624
1625
  }
1625
1626
 
1627
+ declare class CryptoSignerRepository implements SignerRepository {
1628
+ sign(content: string, cert: ReadCertificateResponse, algorithm: SignatureAlgorithm): Promise<Left<NFeTsError> | Right<string>>;
1629
+ }
1630
+
1626
1631
  declare abstract class Pipeline {
1627
1632
  protected readonly certificate?: ReadCertificateRequest | undefined;
1628
1633
  protected readonly xmlns = "http://www.portalfiscal.inf.br/nfe";
1629
1634
  protected readonly http: HttpClient;
1630
1635
  protected readonly toolkit: XmlToolkit;
1631
1636
  protected readonly caching: CacheAdapter;
1637
+ protected readonly signerRepository: CryptoSignerRepository;
1632
1638
  protected readonly certificates: CertificateRepository;
1633
1639
  protected readonly soap: RemoteTransmissionRepository<NfeRemoteClient>;
1634
1640
  protected readonly signer: EntitySigner;
@@ -4613,6 +4619,124 @@ declare class NfceXmlBuilderPipeline<T extends object> extends NfeXmlBuilderPipe
4613
4619
  protected readonly builder: (InfNFeBuilder<T> & IdeBuilder<T>) | AssembleNfeBuilder<T>;
4614
4620
  }
4615
4621
 
4622
+ type DocumentOptions = PDFKit.PDFDocumentOptions;
4623
+ interface TextOptions extends PDFKit.Mixins.TextOptions {
4624
+ x?: number | undefined;
4625
+ y?: number | undefined;
4626
+ }
4627
+ type ImageOptions = PDFKit.Mixins.ImageOption;
4628
+ type ColorValue = PDFKit.Mixins.ColorValue;
4629
+ type RuleValue = PDFKit.Mixins.RuleValue;
4630
+ type TableOptionsWithData = PDFKit.Mixins.TableOptionsWithData;
4631
+ type TupleOfLength<N extends number, T = unknown> = N extends N ? number extends N ? T[] : _TupleOfLength<T, N, []> : never;
4632
+ type _TupleOfLength<T, N extends number, R extends readonly unknown[]> = R['length'] extends N ? R : _TupleOfLength<T, N, readonly [...R, T]>;
4633
+ interface RowBuilderOptions {
4634
+ x: number;
4635
+ y: number;
4636
+ width: number;
4637
+ }
4638
+ interface RowOptions<C extends number> {
4639
+ columns?: C;
4640
+ gap?: number;
4641
+ left?: number;
4642
+ right?: number;
4643
+ size?: TupleOfLength<C, number>;
4644
+ }
4645
+ type RowBuilderFunction = (options: RowBuilderOptions) => PdfBuilder;
4646
+ interface PdfBuilder {
4647
+ table(options: TableOptionsWithData): this;
4648
+ restore(): this;
4649
+ save(): this;
4650
+ end(): void;
4651
+ path(path: string): this;
4652
+ translate(x: number, y: number): this;
4653
+ scale(x: number, y?: number): this;
4654
+ page(options?: DocumentOptions): this;
4655
+ pipe(stream: Writable): this;
4656
+ configure(options: DocumentOptions): this;
4657
+ font(font: string, familyOrSize?: string | number, size?: number): this;
4658
+ fontSize(size: number): this;
4659
+ text(text: string, options?: TextOptions): this;
4660
+ widthOfString(text: string, options?: PDFKit.Mixins.TextOptions): number;
4661
+ heightOfString(text: string, options?: PDFKit.Mixins.TextOptions): number;
4662
+ currentLineHeight(includeGap?: boolean): number;
4663
+ rect(x: number, y: number, w: number, h: number): this;
4664
+ fill(rule: RuleValue): this;
4665
+ fill(color?: ColorValue, rule?: RuleValue): this;
4666
+ stroke(color?: ColorValue): this;
4667
+ image(image: string, x: number, y: number, options?: ImageOptions): this;
4668
+ image(image: string, options?: ImageOptions): this;
4669
+ pageWidth(): number;
4670
+ pageHeight(): number;
4671
+ pageMargins(): PDFKit.Mixins.ExpandedSides<number>;
4672
+ x(): number;
4673
+ y(): number;
4674
+ moveDown(amount?: number): this;
4675
+ row(...items: [...TupleOfLength<1, RowBuilderFunction>]): this;
4676
+ row<C extends number>(options: RowOptions<C>, ...items: [...TupleOfLength<C, RowBuilderFunction>]): this;
4677
+ }
4678
+
4679
+ interface Builder {
4680
+ setup(): void;
4681
+ build(options?: RowBuilderOptions): Promise<PdfBuilder> | PdfBuilder;
4682
+ end(): void;
4683
+ height?: () => number;
4684
+ }
4685
+
4686
+ declare const DanfceSize: {
4687
+ readonly '80mm': number;
4688
+ };
4689
+ interface DanfceOptions {
4690
+ textFontSize: number;
4691
+ titleFontSize: number;
4692
+ width: keyof typeof DanfceSize;
4693
+ height: number;
4694
+ ignoreDefaultLogo?: boolean;
4695
+ logo?: string;
4696
+ credits?: string;
4697
+ }
4698
+
4699
+ declare abstract class DanfcePdfDocument {
4700
+ protected readonly stream: Writable;
4701
+ data: NFCe$1;
4702
+ protNFe?: ProtNFe;
4703
+ readonly builder: PdfBuilder;
4704
+ readonly toolkit: XmlToolkit;
4705
+ readonly defaults: {
4706
+ displayTitle: true;
4707
+ font: string;
4708
+ info: {
4709
+ Author: string;
4710
+ Creator: string;
4711
+ Keywords: string;
4712
+ Title: string;
4713
+ Subject: string;
4714
+ };
4715
+ };
4716
+ options: DanfceOptions;
4717
+ protected abstract get builders(): Builder[];
4718
+ protected abstract clone(stream: Writable): DanfcePdfDocument;
4719
+ constructor(stream: Writable);
4720
+ protected getDynamicHeight(xml: string, factory: (stream: Writable) => DanfcePdfDocument): Promise<number>;
4721
+ protected height(): number;
4722
+ protected apply(): void;
4723
+ protected parse(xml: string): Promise<void>;
4724
+ build(xml: string): Promise<this>;
4725
+ end(): void;
4726
+ currency(value: DecimalValue, maximumFractionDigits?: number): string;
4727
+ isValueNotEmpty(value?: DecimalValue): value is DecimalValue;
4728
+ }
4729
+
4730
+ declare class DanfceDefaultPdfDocument extends DanfcePdfDocument {
4731
+ clone(stream: Writable): DanfcePdfDocument;
4732
+ protected get builders(): Builder[];
4733
+ }
4734
+
4735
+ declare class DanfceReducedPdfDocument extends DanfcePdfDocument {
4736
+ clone(stream: Writable): DanfcePdfDocument;
4737
+ protected get builders(): Builder[];
4738
+ }
4739
+
4616
4740
  declare class NfeXmlBuilder<T extends object = NFe$1> implements INfeXmlBuilder<T> {
4617
4741
  protected readonly builder: XmlToolkit;
4618
4742
  protected contingency?: ContingencyOptions | undefined;
@@ -4692,4 +4816,4 @@ declare class NFCe implements NFCe$1 {
4692
4816
  Signature?: Signature;
4693
4817
  }
4694
4818
 
4695
- export { type AccessKey, AccessKeyBuilder, type AssembleDetXmlBuilder, type AssembleNfeBuilder, type AsynchronousAutorizacaoResponse, type AutXMLBuilder, type AutorizacaoPayload, type AutorizacaoRequest, type AutorizacaoResponse, type AvulsaBuilder, type CanaBuilder, type CobrBuilder, type CofinsBuilder, type CofinsStBuilder, type CompraBuilder, type ConsultStatusPayload, type ConsultStatusRequest, type ConsultStatusResponse, type ConsultaCadastroPayload, type ConsultaCadastroRequest, type ConsultaCadastroResponse, type ConsultaProtocoloPayload, type ConsultaProtocoloRequest, type ConsultaProtocoloResponse, type ContingencyOptions, DefaultDetBuilderAggregator, DefaultTotalBuilderAggregator, type DestBuilder, type DetBuilder, type DetBuilderAggregator, type DetEventoCancelamento, type DetGroupBuilder, type EmitBuilder, type EntregaBuilder, type EventoCancelamento, type EventoItem, type EventoItemAttributes, type EventoLotePayload, type EventoLoteResponse, type EventoPayload, type EventoRequest, type EventoResponse, type ExportaBuilder, type IIBuilder, type INfeDetXmlBuilder, type INfeXmlBuilder, type IcmsBuilder, type IcmsIpiBuilder, type IcmsOrIssQnBuilder, type IcmsufdestBuilder, type IdeBuilder, type ImpostoBuilder, type InfAdicBuilder, type InfEvento, type InfEventoAttributes, type InfIntermedBuilder, type InfInut, type InfInutAttributes, type InfNFeBuilder, type InfRespTecBuilder, type InfSolicNFFBuilder, type InutNFeAttributes, type InutilizacaoPayload, type InutilizacaoRequest, type InutilizacaoResponse, type IssIpiBuilder, type IssQnBuilder, type NFCe$1 as NFCe, NFCe as NFCeDto, type NFCeProc, type NFe$1 as NFe, type NFeAttributes, NFe as NFeDto, type NFeProc, NfceAuthorizerPipeline, NfceConsultStatusPipeline, NfceQrcode, type NfceQrcodeOptions, type NfceQrcodeOptions200, type NfceQrcodeOptions300, type NfceQrcodeOptionsBase, type NfceRemoteClient, NfceRemoteTransmitter, type NfceTransmitter, type NfceTransmitterOptions, NfceXmlBuilder, NfceXmlBuilderPipeline, NfeAuthorizationResponsePipeline, NfeAuthorizerPipeline, NfeConsultStatusPipeline, NfeDetXmlBuilder, NfeNfceCancelPipeline, NfeNfceVoidRangePipeline, type NfeRemoteClient, NfeRemoteTransmitter, type NfeTransmitter, type NfeTransmitterOptions, NfeXmlBuilder, NfeXmlBuilderPipeline, type OptionalSharedImpostoBuilder, type PagBuilder, type PisBuilder, type PisStBuilder, type ProcEventoNFe, type ProdBuilder, type RetAutorizacaoPayload, type RetAutorizacaoRequest, type RetAutorizacaoResponse, type RetCancNFe, type RetEvento, type RetEventoItem, type RetiradaBuilder, type Schema, type SynchronousAutorizacaoResponse, type TotalBuilder, type TotalBuilderAggregator, TpEmis, TpEvent, type TranspBuilder, type VerifiedAccessKey, type VoidRangePayload, schemas };
4819
+ export { type AccessKey, AccessKeyBuilder, type AssembleDetXmlBuilder, type AssembleNfeBuilder, type AsynchronousAutorizacaoResponse, type AutXMLBuilder, type AutorizacaoPayload, type AutorizacaoRequest, type AutorizacaoResponse, type AvulsaBuilder, type CanaBuilder, type CobrBuilder, type CofinsBuilder, type CofinsStBuilder, type CompraBuilder, type ConsultStatusPayload, type ConsultStatusRequest, type ConsultStatusResponse, type ConsultaCadastroPayload, type ConsultaCadastroRequest, type ConsultaCadastroResponse, type ConsultaProtocoloPayload, type ConsultaProtocoloRequest, type ConsultaProtocoloResponse, type ContingencyOptions, DanfceDefaultPdfDocument, DanfceReducedPdfDocument, DefaultDetBuilderAggregator, DefaultTotalBuilderAggregator, type DestBuilder, type DetBuilder, type DetBuilderAggregator, type DetEventoCancelamento, type DetGroupBuilder, type EmitBuilder, type EntregaBuilder, type EventoCancelamento, type EventoItem, type EventoItemAttributes, type EventoLotePayload, type EventoLoteResponse, type EventoPayload, type EventoRequest, type EventoResponse, type ExportaBuilder, type IIBuilder, type INfeDetXmlBuilder, type INfeXmlBuilder, type IcmsBuilder, type IcmsIpiBuilder, type IcmsOrIssQnBuilder, type IcmsufdestBuilder, type IdeBuilder, type ImpostoBuilder, type InfAdicBuilder, type InfEvento, type InfEventoAttributes, type InfIntermedBuilder, type InfInut, type InfInutAttributes, type InfNFeBuilder, type InfRespTecBuilder, type InfSolicNFFBuilder, type InutNFeAttributes, type InutilizacaoPayload, type InutilizacaoRequest, type InutilizacaoResponse, type IssIpiBuilder, type IssQnBuilder, type NFCe$1 as NFCe, NFCe as NFCeDto, type NFCeProc, type NFe$1 as NFe, type NFeAttributes, NFe as NFeDto, type NFeProc, NfceAuthorizerPipeline, NfceConsultStatusPipeline, NfceQrcode, type NfceQrcodeOptions, type NfceQrcodeOptions200, type NfceQrcodeOptions300, type NfceQrcodeOptionsBase, type NfceRemoteClient, NfceRemoteTransmitter, type NfceTransmitter, type NfceTransmitterOptions, NfceXmlBuilder, NfceXmlBuilderPipeline, NfeAuthorizationResponsePipeline, NfeAuthorizerPipeline, NfeConsultStatusPipeline, NfeDetXmlBuilder, NfeNfceCancelPipeline, NfeNfceVoidRangePipeline, type NfeRemoteClient, NfeRemoteTransmitter, type NfeTransmitter, type NfeTransmitterOptions, NfeXmlBuilder, NfeXmlBuilderPipeline, type OptionalSharedImpostoBuilder, type PagBuilder, type PisBuilder, type PisStBuilder, type ProcEventoNFe, type ProdBuilder, type RetAutorizacaoPayload, type RetAutorizacaoRequest, type RetAutorizacaoResponse, type RetCancNFe, type RetEvento, type RetEventoItem, type RetiradaBuilder, type Schema, type SynchronousAutorizacaoResponse, type TotalBuilder, type TotalBuilderAggregator, TpEmis, TpEvent, type TranspBuilder, type VerifiedAccessKey, type VoidRangePayload, schemas };
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"../chunk-ZRYCG7PM.mjs";import"../chunk-XGHTJXFZ.mjs";import"../chunk-W6MRGYXP.mjs";export{d as AccessKeyBuilder,e as DefaultDetBuilderAggregator,f as DefaultTotalBuilderAggregator,u as NFCeDto,q as NFeDto,k as NfceAuthorizerPipeline,m as NfceConsultStatusPipeline,j as NfceQrcode,i as NfceRemoteTransmitter,v as NfceXmlBuilder,w as NfceXmlBuilderPipeline,n as NfeAuthorizationResponsePipeline,h as NfeAuthorizerPipeline,l as NfeConsultStatusPipeline,r as NfeDetXmlBuilder,o as NfeNfceCancelPipeline,p as NfeNfceVoidRangePipeline,g as NfeRemoteTransmitter,s as NfeXmlBuilder,t as NfeXmlBuilderPipeline,a as TpEmis,b as TpEvent,c as schemas};
2
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y}from"../chunk-NIXT5RTQ.mjs";import"../chunk-Q47VIRPG.mjs";import"../chunk-W6MRGYXP.mjs";export{d as AccessKeyBuilder,x as DanfceDefaultPdfDocument,y as DanfceReducedPdfDocument,e as DefaultDetBuilderAggregator,f as DefaultTotalBuilderAggregator,u as NFCeDto,q as NFeDto,k as NfceAuthorizerPipeline,m as NfceConsultStatusPipeline,j as NfceQrcode,i as NfceRemoteTransmitter,v as NfceXmlBuilder,w as NfceXmlBuilderPipeline,n as NfeAuthorizationResponsePipeline,h as NfeAuthorizerPipeline,l as NfeConsultStatusPipeline,r as NfeDetXmlBuilder,o as NfeNfceCancelPipeline,p as NfeNfceVoidRangePipeline,g as NfeRemoteTransmitter,s as NfeXmlBuilder,t as NfeXmlBuilderPipeline,a as TpEmis,b as TpEvent,c as schemas};
@@ -67,7 +67,7 @@ interface ReadCertificateResponse {
67
67
  password: string;
68
68
  ca: X509Certificate[];
69
69
  certificate: X509Certificate;
70
- privateKey: KeyObject;
70
+ privateKey?: KeyObject;
71
71
  }
72
72
  interface CertificateInfo {
73
73
  CNPJ?: string;
@@ -313,7 +313,7 @@ interface CacheAdapter {
313
313
 
314
314
  interface CertificateRepository {
315
315
  read(request: ReadCertificateRequest): Promise<Either<NFeTsError, ReadCertificateResponse>>;
316
- sign(content: string, privateKey: KeyObject, algorithm: SignatureAlgorithm): Promise<Either<NFeTsError, string>>;
316
+ sign(content: string, cert: ReadCertificateResponse, algorithm: SignatureAlgorithm): Promise<Either<NFeTsError, string>>;
317
317
  getStringCertificate(certificate: X509Certificate): string;
318
318
  getStringPrivateKey(privateKey: KeyObject): string;
319
319
  getCertificateInfo(certificate: X509Certificate): CertificateInfo;
@@ -331,6 +331,9 @@ interface SignerOptions<T = string> {
331
331
  type SignedEntity<T extends object> = T & {
332
332
  Signature: Signature;
333
333
  };
334
+ interface SignerRepository {
335
+ sign(content: string, cert: ReadCertificateResponse, algorithm: SignatureAlgorithm): Promise<Either<NFeTsError, string>>;
336
+ }
334
337
 
335
338
  declare abstract class Signer {
336
339
  protected readonly toolkit: XmlToolkit;
@@ -385,7 +388,7 @@ declare abstract class Signer {
385
388
  };
386
389
  };
387
390
  private digest;
388
- protected signOrLeft(signedInfo: SignedInfo, privateKey: KeyObject): Promise<Either<NFeTsError, string>>;
391
+ protected signOrLeft(signedInfo: SignedInfo, cert: ReadCertificateResponse): Promise<Either<NFeTsError, string>>;
389
392
  private get transforms();
390
393
  private get digestAlgorithm();
391
394
  private get signatureMethod();
@@ -400,4 +403,4 @@ declare class XmlSigner extends Signer {
400
403
  sign(xml: string, options: SignerOptions, cert: ReadCertificateResponse): Promise<Left<NFeTsError> | Right<string>>;
401
404
  }
402
405
 
403
- export { type HttpClientHeaders as A, type BuilderOptions as B, type CertificateInfo as C, type DecimalValue as D, Environment as E, type ResponseType as F, type RequestConfig as G, type HeaderValue as H, type HttpResponse as I, type HttpClient as J, type KnownKeys as K, type RemoteTransmissionRepository as L, type SignerOptions as M, type Namespaced as N, type SignedEntity as O, type ParserOptions as P, Signer as Q, type ReadCertificateRequest as R, SignatureNamespace as S, type Transforms as T, EntitySigner as U, XmlSigner as V, type Decimal as W, type XmlDeclarationAttributes as X, type Either as Y, Left as Z, Right as _, type ReadCertificateResponse as a, CanonicalizationMethod$1 as b, SignatureMethod$1 as c, SignatureAlgorithm as d, DigestAlgorithm as e, StateCodes as f, StateAcronyms as g, type StateCode as h, type StateAcronym as i, type EnvironmentCode as j, type SignedInfo as k, type Signature as l, type Client as m, type SendTransmissionPayload as n, type ExtractReturnType as o, type TransmitterOptions as p, type Transmitter as q, defaultCanonicalizeOptions as r, type CanonicalizeOptions as s, defaultBuilderOptions as t, type RenderOptions as u, defaultParserOptions as v, type XmlToolkit as w, NFeTsError as x, type CacheAdapter as y, type CertificateRepository as z };
406
+ export { Right as $, type HttpClientHeaders as A, type BuilderOptions as B, type CertificateInfo as C, type DecimalValue as D, Environment as E, type ResponseType as F, type RequestConfig as G, type HeaderValue as H, type HttpResponse as I, type HttpClient as J, type KnownKeys as K, type RemoteTransmissionRepository as L, type SignerOptions as M, type Namespaced as N, type SignedEntity as O, type ParserOptions as P, type SignerRepository as Q, type ReadCertificateRequest as R, SignatureNamespace as S, type Transforms as T, Signer as U, EntitySigner as V, XmlSigner as W, type XmlDeclarationAttributes as X, type Decimal as Y, type Either as Z, Left as _, type ReadCertificateResponse as a, CanonicalizationMethod$1 as b, SignatureMethod$1 as c, SignatureAlgorithm as d, DigestAlgorithm as e, StateCodes as f, StateAcronyms as g, type StateCode as h, type StateAcronym as i, type EnvironmentCode as j, type SignedInfo as k, type Signature as l, type Client as m, type SendTransmissionPayload as n, type ExtractReturnType as o, type TransmitterOptions as p, type Transmitter as q, defaultCanonicalizeOptions as r, type CanonicalizeOptions as s, defaultBuilderOptions as t, type RenderOptions as u, defaultParserOptions as v, type XmlToolkit as w, NFeTsError as x, type CacheAdapter as y, type CertificateRepository as z };
@@ -67,7 +67,7 @@ interface ReadCertificateResponse {
67
67
  password: string;
68
68
  ca: X509Certificate[];
69
69
  certificate: X509Certificate;
70
- privateKey: KeyObject;
70
+ privateKey?: KeyObject;
71
71
  }
72
72
  interface CertificateInfo {
73
73
  CNPJ?: string;
@@ -313,7 +313,7 @@ interface CacheAdapter {
313
313
 
314
314
  interface CertificateRepository {
315
315
  read(request: ReadCertificateRequest): Promise<Either<NFeTsError, ReadCertificateResponse>>;
316
- sign(content: string, privateKey: KeyObject, algorithm: SignatureAlgorithm): Promise<Either<NFeTsError, string>>;
316
+ sign(content: string, cert: ReadCertificateResponse, algorithm: SignatureAlgorithm): Promise<Either<NFeTsError, string>>;
317
317
  getStringCertificate(certificate: X509Certificate): string;
318
318
  getStringPrivateKey(privateKey: KeyObject): string;
319
319
  getCertificateInfo(certificate: X509Certificate): CertificateInfo;
@@ -331,6 +331,9 @@ interface SignerOptions<T = string> {
331
331
  type SignedEntity<T extends object> = T & {
332
332
  Signature: Signature;
333
333
  };
334
+ interface SignerRepository {
335
+ sign(content: string, cert: ReadCertificateResponse, algorithm: SignatureAlgorithm): Promise<Either<NFeTsError, string>>;
336
+ }
334
337
 
335
338
  declare abstract class Signer {
336
339
  protected readonly toolkit: XmlToolkit;
@@ -385,7 +388,7 @@ declare abstract class Signer {
385
388
  };
386
389
  };
387
390
  private digest;
388
- protected signOrLeft(signedInfo: SignedInfo, privateKey: KeyObject): Promise<Either<NFeTsError, string>>;
391
+ protected signOrLeft(signedInfo: SignedInfo, cert: ReadCertificateResponse): Promise<Either<NFeTsError, string>>;
389
392
  private get transforms();
390
393
  private get digestAlgorithm();
391
394
  private get signatureMethod();
@@ -400,4 +403,4 @@ declare class XmlSigner extends Signer {
400
403
  sign(xml: string, options: SignerOptions, cert: ReadCertificateResponse): Promise<Left<NFeTsError> | Right<string>>;
401
404
  }
402
405
 
403
- export { type HttpClientHeaders as A, type BuilderOptions as B, type CertificateInfo as C, type DecimalValue as D, Environment as E, type ResponseType as F, type RequestConfig as G, type HeaderValue as H, type HttpResponse as I, type HttpClient as J, type KnownKeys as K, type RemoteTransmissionRepository as L, type SignerOptions as M, type Namespaced as N, type SignedEntity as O, type ParserOptions as P, Signer as Q, type ReadCertificateRequest as R, SignatureNamespace as S, type Transforms as T, EntitySigner as U, XmlSigner as V, type Decimal as W, type XmlDeclarationAttributes as X, type Either as Y, Left as Z, Right as _, type ReadCertificateResponse as a, CanonicalizationMethod$1 as b, SignatureMethod$1 as c, SignatureAlgorithm as d, DigestAlgorithm as e, StateCodes as f, StateAcronyms as g, type StateCode as h, type StateAcronym as i, type EnvironmentCode as j, type SignedInfo as k, type Signature as l, type Client as m, type SendTransmissionPayload as n, type ExtractReturnType as o, type TransmitterOptions as p, type Transmitter as q, defaultCanonicalizeOptions as r, type CanonicalizeOptions as s, defaultBuilderOptions as t, type RenderOptions as u, defaultParserOptions as v, type XmlToolkit as w, NFeTsError as x, type CacheAdapter as y, type CertificateRepository as z };
406
+ export { Right as $, type HttpClientHeaders as A, type BuilderOptions as B, type CertificateInfo as C, type DecimalValue as D, Environment as E, type ResponseType as F, type RequestConfig as G, type HeaderValue as H, type HttpResponse as I, type HttpClient as J, type KnownKeys as K, type RemoteTransmissionRepository as L, type SignerOptions as M, type Namespaced as N, type SignedEntity as O, type ParserOptions as P, type SignerRepository as Q, type ReadCertificateRequest as R, SignatureNamespace as S, type Transforms as T, Signer as U, EntitySigner as V, XmlSigner as W, type XmlDeclarationAttributes as X, type Decimal as Y, type Either as Z, Left as _, type ReadCertificateResponse as a, CanonicalizationMethod$1 as b, SignatureMethod$1 as c, SignatureAlgorithm as d, DigestAlgorithm as e, StateCodes as f, StateAcronyms as g, type StateCode as h, type StateAcronym as i, type EnvironmentCode as j, type SignedInfo as k, type Signature as l, type Client as m, type SendTransmissionPayload as n, type ExtractReturnType as o, type TransmitterOptions as p, type Transmitter as q, defaultCanonicalizeOptions as r, type CanonicalizeOptions as s, defaultBuilderOptions as t, type RenderOptions as u, defaultParserOptions as v, type XmlToolkit as w, NFeTsError as x, type CacheAdapter as y, type CertificateRepository as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nfets",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "description": "typescript libraries for Brazilian's SEFAZ standards",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -68,6 +68,7 @@
68
68
  "@types/pdfkit": "^0.17.3",
69
69
  "@typescript-eslint/parser": "^8.21.0",
70
70
  "axios": "^1.7.9",
71
+ "cross-env": "^10.1.0",
71
72
  "eslint": "^9.19.0",
72
73
  "eslint-plugin-prettier": "^5.2.3",
73
74
  "fs-extra": "^11.3.0",