nfets 0.0.14 → 0.0.15

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.
@@ -3,7 +3,7 @@ import { E as Either, N as NFeTsError, L as Left, R as Right } from '../either-C
3
3
  export { l as left, r as right } from '../either-CdHd_Yt7.cjs';
4
4
  import { Either as Either$1 } from '@nfets/core/shared/either';
5
5
  import { NFeTsError as NFeTsError$1 } from '@nfets/core/domain/errors/nfets-error';
6
- import { ReadCertificateRequest as ReadCertificateRequest$1, ReadCertificateResponse as ReadCertificateResponse$1 } from '@nfets/core/domain/entities/certificate/certificate';
6
+ import { ReadCertificateRequest as ReadCertificateRequest$1, ReadCertificateResponse as ReadCertificateResponse$1, CertificateInfo as CertificateInfo$1 } from '@nfets/core/domain/entities/certificate/certificate';
7
7
  import { SignatureAlgorithm as SignatureAlgorithm$1 } from '@nfets/core/domain/entities/signer/algo';
8
8
  import { SignerOptions as SignerOptions$1, SignedEntity as SignedEntity$1, StrategyPattern as StrategyPattern$1, XmlToolkit as XmlToolkit$1 } from '@nfets/core/domain';
9
9
  import { ValidationError as ValidationError$1, ValidationOptions } from 'class-validator';
@@ -94,6 +94,11 @@ declare const Environment: {
94
94
  };
95
95
  type EnvironmentCode = (typeof Environment)[keyof typeof Environment];
96
96
 
97
+ type Namespaced<T extends object = object> = T & {
98
+ $?: {
99
+ xmlns: string;
100
+ };
101
+ };
97
102
  interface SignedInfo {
98
103
  CanonicalizationMethod: CanonicalizationMethod;
99
104
  SignatureMethod: SignatureMethod;
@@ -261,6 +266,7 @@ interface CertificateRepository {
261
266
  sign(content: string, privateKey: KeyObject, algorithm: SignatureAlgorithm$1): Promise<Either$1<NFeTsError$1, string>>;
262
267
  getStringCertificate(certificate: X509Certificate): string;
263
268
  getStringPrivateKey(privateKey: KeyObject): string;
269
+ getCertificateInfo(certificate: X509Certificate): CertificateInfo$1;
264
270
  }
265
271
 
266
272
  interface RemoteTransmissionRepository<C extends Client> {
@@ -354,15 +360,18 @@ declare const SkipAllValidations: () => ClassDecorator;
354
360
 
355
361
  declare const IsDecimal: (validationOptions?: ValidationOptions) => PropertyDecorator;
356
362
 
357
- interface ChoiceGroup {
358
- properties: [string, ...string[]];
363
+ interface ChoiceGroup<P extends string | number | symbol> {
364
+ properties: [P, ...P[]];
359
365
  required?: boolean;
360
366
  }
361
- interface ChoiceOptions extends ValidationOptions, ChoiceGroup {
367
+ interface ChoiceOptions<P extends string | number | symbol> extends ValidationOptions, ChoiceGroup<P> {
362
368
  }
363
- declare const Choice: (options: ChoiceOptions) => ClassDecorator;
369
+ declare const Choice: <T extends object>(options: ChoiceOptions<keyof T>) => ClassDecorator;
364
370
 
365
- declare const plainToInstance: <T extends object>(payload: object, klass: new () => T) => T;
371
+ declare const clearEmptyValues: (instance: object) => void;
372
+ declare const plainToInstance: <T extends object>(payload: object, klass: new () => T, options?: {
373
+ clearEmptyValues?: boolean;
374
+ }) => T;
366
375
 
367
376
  interface TransformDecimalArgs extends ValidationOptions {
368
377
  fixed?: number;
@@ -522,6 +531,16 @@ declare class NativeCertificateRepository implements CertificateRepository$1 {
522
531
  constructor(httpClient: HttpClient$1, cache?: CacheAdapter$1);
523
532
  read(request: ReadCertificateRequest$1): Promise<Either$1<NFeTsError$1, ReadCertificateResponse$1>>;
524
533
  sign(content: string, privateKey: KeyObject, algorithm?: SignatureAlgorithm$1): Promise<Left<NFeTsError$1> | Right<string>>;
534
+ getCertificateInfo(certificate: X509Certificate): {
535
+ CNPJ: string | undefined;
536
+ CPF: string | undefined;
537
+ CN: string | undefined;
538
+ O: string | undefined;
539
+ OU: string | undefined;
540
+ ST: string | undefined;
541
+ L: string | undefined;
542
+ C: string | undefined;
543
+ };
525
544
  getStringCertificate(certificate: X509Certificate): string;
526
545
  getStringPrivateKey(privateKey: KeyObject): string;
527
546
  private getPfxBuffer;
@@ -573,4 +592,4 @@ type DeepPartial<T> = {
573
592
 
574
593
  declare const unreachable: (_: never) => never;
575
594
 
576
- export { ASN1, type BuilderOptions, type CacheAdapter, CanonicalizationMethod$1 as CanonicalizationMethod, type CanonicalizeOptions, type CertificateInfo, type CertificateRepository, Choice, type ChoiceOptions, type Client, Decimal, type DecimalValue, type DeepPartial, DigestAlgorithm, Either, EntitySigner, Environment, type EnvironmentCode, type ExtractReturnType, type HeaderValue, type HttpClient, type HttpClientHeaders, type HttpResponse, IsDecimal, type KnownKeys, Left, MemoryCacheAdapter, NFeTsError, NativeCertificateRepository, NullCacheAdapter, type ParserOptions, type ReadCertificateRequest, type ReadCertificateResponse, type RemoteTransmissionRepository, type RenderOptions, type RequestConfig, type ResponseType, Right, type SendTransmissionPayload, type Signature, SignatureAlgorithm, SignatureMethod$1 as SignatureMethod, SignatureNamespace, type SignedEntity, type SignedInfo, Signer, type SignerOptions, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, type StateAcronym, StateAcronyms, type StateCode, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, StateCodes, type StrategyPattern, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, type Transforms, type Transmitter, type TransmitterOptions, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, type XmlDeclarationAttributes, XmlSigner, type XmlToolkit, defaultBuilderOptions, defaultCanonicalizeOptions, defaultParserOptions, leftFromError, mapConstraintsToErrors, plainToInstance, unreachable };
595
+ export { ASN1, type BuilderOptions, type CacheAdapter, CanonicalizationMethod$1 as CanonicalizationMethod, type CanonicalizeOptions, type CertificateInfo, type CertificateRepository, Choice, type ChoiceOptions, type Client, Decimal, type DecimalValue, type DeepPartial, DigestAlgorithm, Either, EntitySigner, Environment, type EnvironmentCode, type ExtractReturnType, type HeaderValue, type HttpClient, type HttpClientHeaders, type HttpResponse, IsDecimal, type KnownKeys, Left, MemoryCacheAdapter, NFeTsError, type Namespaced, NativeCertificateRepository, NullCacheAdapter, type ParserOptions, type ReadCertificateRequest, type ReadCertificateResponse, type RemoteTransmissionRepository, type RenderOptions, type RequestConfig, type ResponseType, Right, type SendTransmissionPayload, type Signature, SignatureAlgorithm, SignatureMethod$1 as SignatureMethod, SignatureNamespace, type SignedEntity, type SignedInfo, Signer, type SignerOptions, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, type StateAcronym, StateAcronyms, type StateCode, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, StateCodes, type StrategyPattern, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, type Transforms, type Transmitter, type TransmitterOptions, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, type XmlDeclarationAttributes, XmlSigner, type XmlToolkit, clearEmptyValues, defaultBuilderOptions, defaultCanonicalizeOptions, defaultParserOptions, leftFromError, mapConstraintsToErrors, plainToInstance, unreachable };
@@ -3,7 +3,7 @@ import { E as Either, N as NFeTsError, L as Left, R as Right } from '../either-C
3
3
  export { l as left, r as right } from '../either-CdHd_Yt7.js';
4
4
  import { Either as Either$1 } from '@nfets/core/shared/either';
5
5
  import { NFeTsError as NFeTsError$1 } from '@nfets/core/domain/errors/nfets-error';
6
- import { ReadCertificateRequest as ReadCertificateRequest$1, ReadCertificateResponse as ReadCertificateResponse$1 } from '@nfets/core/domain/entities/certificate/certificate';
6
+ import { ReadCertificateRequest as ReadCertificateRequest$1, ReadCertificateResponse as ReadCertificateResponse$1, CertificateInfo as CertificateInfo$1 } from '@nfets/core/domain/entities/certificate/certificate';
7
7
  import { SignatureAlgorithm as SignatureAlgorithm$1 } from '@nfets/core/domain/entities/signer/algo';
8
8
  import { SignerOptions as SignerOptions$1, SignedEntity as SignedEntity$1, StrategyPattern as StrategyPattern$1, XmlToolkit as XmlToolkit$1 } from '@nfets/core/domain';
9
9
  import { ValidationError as ValidationError$1, ValidationOptions } from 'class-validator';
@@ -94,6 +94,11 @@ declare const Environment: {
94
94
  };
95
95
  type EnvironmentCode = (typeof Environment)[keyof typeof Environment];
96
96
 
97
+ type Namespaced<T extends object = object> = T & {
98
+ $?: {
99
+ xmlns: string;
100
+ };
101
+ };
97
102
  interface SignedInfo {
98
103
  CanonicalizationMethod: CanonicalizationMethod;
99
104
  SignatureMethod: SignatureMethod;
@@ -261,6 +266,7 @@ interface CertificateRepository {
261
266
  sign(content: string, privateKey: KeyObject, algorithm: SignatureAlgorithm$1): Promise<Either$1<NFeTsError$1, string>>;
262
267
  getStringCertificate(certificate: X509Certificate): string;
263
268
  getStringPrivateKey(privateKey: KeyObject): string;
269
+ getCertificateInfo(certificate: X509Certificate): CertificateInfo$1;
264
270
  }
265
271
 
266
272
  interface RemoteTransmissionRepository<C extends Client> {
@@ -354,15 +360,18 @@ declare const SkipAllValidations: () => ClassDecorator;
354
360
 
355
361
  declare const IsDecimal: (validationOptions?: ValidationOptions) => PropertyDecorator;
356
362
 
357
- interface ChoiceGroup {
358
- properties: [string, ...string[]];
363
+ interface ChoiceGroup<P extends string | number | symbol> {
364
+ properties: [P, ...P[]];
359
365
  required?: boolean;
360
366
  }
361
- interface ChoiceOptions extends ValidationOptions, ChoiceGroup {
367
+ interface ChoiceOptions<P extends string | number | symbol> extends ValidationOptions, ChoiceGroup<P> {
362
368
  }
363
- declare const Choice: (options: ChoiceOptions) => ClassDecorator;
369
+ declare const Choice: <T extends object>(options: ChoiceOptions<keyof T>) => ClassDecorator;
364
370
 
365
- declare const plainToInstance: <T extends object>(payload: object, klass: new () => T) => T;
371
+ declare const clearEmptyValues: (instance: object) => void;
372
+ declare const plainToInstance: <T extends object>(payload: object, klass: new () => T, options?: {
373
+ clearEmptyValues?: boolean;
374
+ }) => T;
366
375
 
367
376
  interface TransformDecimalArgs extends ValidationOptions {
368
377
  fixed?: number;
@@ -522,6 +531,16 @@ declare class NativeCertificateRepository implements CertificateRepository$1 {
522
531
  constructor(httpClient: HttpClient$1, cache?: CacheAdapter$1);
523
532
  read(request: ReadCertificateRequest$1): Promise<Either$1<NFeTsError$1, ReadCertificateResponse$1>>;
524
533
  sign(content: string, privateKey: KeyObject, algorithm?: SignatureAlgorithm$1): Promise<Left<NFeTsError$1> | Right<string>>;
534
+ getCertificateInfo(certificate: X509Certificate): {
535
+ CNPJ: string | undefined;
536
+ CPF: string | undefined;
537
+ CN: string | undefined;
538
+ O: string | undefined;
539
+ OU: string | undefined;
540
+ ST: string | undefined;
541
+ L: string | undefined;
542
+ C: string | undefined;
543
+ };
525
544
  getStringCertificate(certificate: X509Certificate): string;
526
545
  getStringPrivateKey(privateKey: KeyObject): string;
527
546
  private getPfxBuffer;
@@ -573,4 +592,4 @@ type DeepPartial<T> = {
573
592
 
574
593
  declare const unreachable: (_: never) => never;
575
594
 
576
- export { ASN1, type BuilderOptions, type CacheAdapter, CanonicalizationMethod$1 as CanonicalizationMethod, type CanonicalizeOptions, type CertificateInfo, type CertificateRepository, Choice, type ChoiceOptions, type Client, Decimal, type DecimalValue, type DeepPartial, DigestAlgorithm, Either, EntitySigner, Environment, type EnvironmentCode, type ExtractReturnType, type HeaderValue, type HttpClient, type HttpClientHeaders, type HttpResponse, IsDecimal, type KnownKeys, Left, MemoryCacheAdapter, NFeTsError, NativeCertificateRepository, NullCacheAdapter, type ParserOptions, type ReadCertificateRequest, type ReadCertificateResponse, type RemoteTransmissionRepository, type RenderOptions, type RequestConfig, type ResponseType, Right, type SendTransmissionPayload, type Signature, SignatureAlgorithm, SignatureMethod$1 as SignatureMethod, SignatureNamespace, type SignedEntity, type SignedInfo, Signer, type SignerOptions, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, type StateAcronym, StateAcronyms, type StateCode, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, StateCodes, type StrategyPattern, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, type Transforms, type Transmitter, type TransmitterOptions, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, type XmlDeclarationAttributes, XmlSigner, type XmlToolkit, defaultBuilderOptions, defaultCanonicalizeOptions, defaultParserOptions, leftFromError, mapConstraintsToErrors, plainToInstance, unreachable };
595
+ export { ASN1, type BuilderOptions, type CacheAdapter, CanonicalizationMethod$1 as CanonicalizationMethod, type CanonicalizeOptions, type CertificateInfo, type CertificateRepository, Choice, type ChoiceOptions, type Client, Decimal, type DecimalValue, type DeepPartial, DigestAlgorithm, Either, EntitySigner, Environment, type EnvironmentCode, type ExtractReturnType, type HeaderValue, type HttpClient, type HttpClientHeaders, type HttpResponse, IsDecimal, type KnownKeys, Left, MemoryCacheAdapter, NFeTsError, type Namespaced, NativeCertificateRepository, NullCacheAdapter, type ParserOptions, type ReadCertificateRequest, type ReadCertificateResponse, type RemoteTransmissionRepository, type RenderOptions, type RequestConfig, type ResponseType, Right, type SendTransmissionPayload, type Signature, SignatureAlgorithm, SignatureMethod$1 as SignatureMethod, SignatureNamespace, type SignedEntity, type SignedInfo, Signer, type SignerOptions, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, type StateAcronym, StateAcronyms, type StateCode, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, StateCodes, type StrategyPattern, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, type Transforms, type Transmitter, type TransmitterOptions, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, type XmlDeclarationAttributes, XmlSigner, type XmlToolkit, clearEmptyValues, defaultBuilderOptions, defaultCanonicalizeOptions, defaultParserOptions, leftFromError, mapConstraintsToErrors, plainToInstance, unreachable };
@@ -1 +1 @@
1
- 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,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,g,ga,h,ha,i,ia,j,ja,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-XYOTPYUB.mjs";import"../chunk-3WPW27WV.mjs";import"../chunk-W6MRGYXP.mjs";export{ca as ASN1,b as CanonicalizationMethod,A as Choice,da as Decimal,e as DigestAlgorithm,q as EntitySigner,h as Environment,z as IsDecimal,m as Left,ea as MemoryCacheAdapter,i as NFeTsError,fa as NativeCertificateRepository,ga as NullCacheAdapter,n as Right,d as SignatureAlgorithm,c as SignatureMethod,a as SignatureNamespace,l as Signer,u as SkipAllValidations,t as SkipValidation,s as SkipValidationMetadata,ha as SoapRemoteTransmissionRepository,g as StateAcronyms,D as StateCodeAcValidator,E as StateCodeAlValidator,F as StateCodeAmValidator,G as StateCodeApValidator,H as StateCodeBaValidator,I as StateCodeCeValidator,J as StateCodeDfValidator,K as StateCodeEsValidator,L as StateCodeGoValidator,M as StateCodeMaValidator,N as StateCodeMgValidator,O as StateCodeMsValidator,P as StateCodeMtValidator,Q as StateCodePaValidator,R as StateCodePbValidator,S as StateCodePeValidator,T as StateCodePiValidator,U as StateCodePrValidator,V as StateCodeRjValidator,W as StateCodeRnValidator,X as StateCodeRoValidator,Y as StateCodeRrValidator,Z as StateCodeRsValidator,_ as StateCodeScValidator,$ as StateCodeSeValidator,aa as StateCodeSpValidator,ba as StateCodeToValidator,f as StateCodes,C as TransformDateString,B as TransformDecimal,w as ValidateErrorsMetadata,y as Validates,j as ValidationError,ja as Xml2JsToolkit,r as XmlSigner,o as left,ia as leftFromError,x as mapConstraintsToErrors,v as plainToInstance,p as right,k as unreachable};
1
+ 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,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,g,ga,h,ha,i,ia,j,ja,k,ka,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-GMWKIB4E.mjs";import"../chunk-3WPW27WV.mjs";import"../chunk-W6MRGYXP.mjs";export{da as ASN1,b as CanonicalizationMethod,B as Choice,ea as Decimal,e as DigestAlgorithm,q as EntitySigner,h as Environment,A as IsDecimal,m as Left,fa as MemoryCacheAdapter,i as NFeTsError,ga as NativeCertificateRepository,ha as NullCacheAdapter,n as Right,d as SignatureAlgorithm,c as SignatureMethod,a as SignatureNamespace,l as Signer,u as SkipAllValidations,t as SkipValidation,s as SkipValidationMetadata,ia as SoapRemoteTransmissionRepository,g as StateAcronyms,E as StateCodeAcValidator,F as StateCodeAlValidator,G as StateCodeAmValidator,H as StateCodeApValidator,I as StateCodeBaValidator,J as StateCodeCeValidator,K as StateCodeDfValidator,L as StateCodeEsValidator,M as StateCodeGoValidator,N as StateCodeMaValidator,O as StateCodeMgValidator,P as StateCodeMsValidator,Q as StateCodeMtValidator,R as StateCodePaValidator,S as StateCodePbValidator,T as StateCodePeValidator,U as StateCodePiValidator,V as StateCodePrValidator,W as StateCodeRjValidator,X as StateCodeRnValidator,Y as StateCodeRoValidator,Z as StateCodeRrValidator,_ as StateCodeRsValidator,$ as StateCodeScValidator,aa as StateCodeSeValidator,ba as StateCodeSpValidator,ca as StateCodeToValidator,f as StateCodes,D as TransformDateString,C as TransformDecimal,x as ValidateErrorsMetadata,z as Validates,j as ValidationError,ka as Xml2JsToolkit,r as XmlSigner,v as clearEmptyValues,o as left,ja as leftFromError,y as mapConstraintsToErrors,w as plainToInstance,p as right,k as unreachable};