nfets 0.0.15 → 0.0.17
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/build/Release/xml_validator.node +0 -0
- package/dist/chunk-5KI5OGAA.mjs +7 -0
- package/dist/chunk-I4KZJHBR.mjs +0 -0
- package/dist/chunk-PEB34YMB.mjs +259 -0
- package/dist/core/index.cjs +59 -59
- package/dist/core/index.d.cts +19 -356
- package/dist/core/index.d.ts +19 -356
- package/dist/core/index.mjs +1 -1
- package/dist/index.cjs +78 -78
- package/dist/index.d.cts +3 -65
- package/dist/index.d.ts +3 -65
- package/dist/index.mjs +1 -1
- package/dist/nfe/index.cjs +248 -11
- package/dist/nfe/index.d.cts +203 -204
- package/dist/nfe/index.d.ts +203 -204
- package/dist/nfe/index.mjs +1 -1
- package/dist/types-BVhE6D84.d.cts +405 -0
- package/dist/types-BVhE6D84.d.ts +405 -0
- package/package.json +6 -5
- package/dist/chunk-3WPW27WV.mjs +0 -24
- package/dist/chunk-GMWKIB4E.mjs +0 -238
- package/dist/chunk-V2LFKSE4.mjs +0 -7
- package/dist/either-CdHd_Yt7.d.cts +0 -20
- package/dist/either-CdHd_Yt7.d.ts +0 -20
package/dist/core/index.d.cts
CHANGED
|
@@ -1,351 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { l as left, r as right } from '../either-CdHd_Yt7.cjs';
|
|
4
|
-
import { Either as Either$1 } from '@nfets/core/shared/either';
|
|
5
|
-
import { NFeTsError as NFeTsError$1 } from '@nfets/core/domain/errors/nfets-error';
|
|
6
|
-
import { ReadCertificateRequest as ReadCertificateRequest$1, ReadCertificateResponse as ReadCertificateResponse$1, CertificateInfo as CertificateInfo$1 } from '@nfets/core/domain/entities/certificate/certificate';
|
|
7
|
-
import { SignatureAlgorithm as SignatureAlgorithm$1 } from '@nfets/core/domain/entities/signer/algo';
|
|
8
|
-
import { SignerOptions as SignerOptions$1, SignedEntity as SignedEntity$1, StrategyPattern as StrategyPattern$1, XmlToolkit as XmlToolkit$1 } from '@nfets/core/domain';
|
|
1
|
+
import { x as NFeTsError, Q as Signer, M as SignerOptions, a as ReadCertificateResponse, W as Left, Y as Right, a0 as Decimal$2, D as DecimalValue, y as CacheAdapter, z as CertificateRepository, J as HttpClient, R as ReadCertificateRequest, V as Either, d as SignatureAlgorithm, m as Client, L as RemoteTransmissionRepository, w as XmlToolkit, n as SendTransmissionPayload, o as ExtractReturnType, P as ParserOptions, B as BuilderOptions, s as CanonicalizeOptions } from '../types-BVhE6D84.cjs';
|
|
2
|
+
export { b as CanonicalizationMethod, C as CertificateInfo, $ as DeepPartial, e as DigestAlgorithm, U as EntitySigner, E as Environment, j as EnvironmentCode, H as HeaderValue, A as HttpClientHeaders, I as HttpResponse, K as KnownKeys, N as Namespaced, u as RenderOptions, G as RequestConfig, F as ResponseType, l as Signature, c as SignatureMethod, S as SignatureNamespace, O as SignedEntity, k as SignedInfo, i as StateAcronym, g as StateAcronyms, h as StateCode, f as StateCodes, T as Transforms, q as Transmitter, p as TransmitterOptions, X as XmlDeclarationAttributes, t as defaultBuilderOptions, r as defaultCanonicalizeOptions, v as defaultParserOptions, Z as left, _ as right } from '../types-BVhE6D84.cjs';
|
|
9
3
|
import { ValidationError as ValidationError$1, ValidationOptions } from 'class-validator';
|
|
4
|
+
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
10
5
|
import { Decimal as Decimal$1 } from 'decimal.js';
|
|
11
|
-
import { Decimal as Decimal$2, DecimalValue as DecimalValue$1 } from '@nfets/core/domain/entities/calculator/decimal';
|
|
12
|
-
import { CacheAdapter as CacheAdapter$1 } from '@nfets/core/domain/repositories/cache-adapter';
|
|
13
|
-
import { CertificateRepository as CertificateRepository$1 } from '@nfets/core/domain/repositories/certificate-repository';
|
|
14
|
-
import { HttpClient as HttpClient$1 } from '@nfets/core/domain/repositories/http-client';
|
|
15
6
|
import { Agent } from 'node:https';
|
|
16
|
-
import { RemoteTransmissionRepository as RemoteTransmissionRepository$1 } from '@nfets/core/domain/repositories/remote-transmission-repository';
|
|
17
|
-
import { Client as Client$1, SendTransmissionPayload as SendTransmissionPayload$1, ExtractReturnType as ExtractReturnType$1 } from '@nfets/core/domain/entities/transmission/payload';
|
|
18
7
|
import * as Xml2js from 'xml2js';
|
|
19
8
|
|
|
20
|
-
type DecimalValue = string | number | bigint;
|
|
21
|
-
|
|
22
|
-
interface ReadCertificateRequest {
|
|
23
|
-
pfxPathOrBase64: string;
|
|
24
|
-
password: string;
|
|
25
|
-
}
|
|
26
|
-
interface ReadCertificateResponse {
|
|
27
|
-
password: string;
|
|
28
|
-
ca: X509Certificate[];
|
|
29
|
-
certificate: X509Certificate;
|
|
30
|
-
privateKey: KeyObject;
|
|
31
|
-
}
|
|
32
|
-
interface CertificateInfo {
|
|
33
|
-
CNPJ?: string;
|
|
34
|
-
CPF?: string;
|
|
35
|
-
O?: string;
|
|
36
|
-
C?: string;
|
|
37
|
-
ST?: string;
|
|
38
|
-
L?: string;
|
|
39
|
-
CN?: string;
|
|
40
|
-
OU?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
declare const SignatureNamespace: "http://www.w3.org/2000/09/xmldsig#";
|
|
44
|
-
declare const CanonicalizationMethod$1: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
|
|
45
|
-
declare enum SignatureMethod$1 {
|
|
46
|
-
RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1",
|
|
47
|
-
RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
|
|
48
|
-
}
|
|
49
|
-
declare enum SignatureAlgorithm {
|
|
50
|
-
SHA1 = "sha1",
|
|
51
|
-
SHA256 = "sha256"
|
|
52
|
-
}
|
|
53
|
-
declare enum DigestAlgorithm {
|
|
54
|
-
SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1",
|
|
55
|
-
SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256"
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
declare const StateCodes: {
|
|
59
|
-
readonly AC: "12";
|
|
60
|
-
readonly AL: "27";
|
|
61
|
-
readonly AM: "13";
|
|
62
|
-
readonly AP: "16";
|
|
63
|
-
readonly BA: "29";
|
|
64
|
-
readonly CE: "23";
|
|
65
|
-
readonly DF: "53";
|
|
66
|
-
readonly ES: "32";
|
|
67
|
-
readonly GO: "52";
|
|
68
|
-
readonly MA: "21";
|
|
69
|
-
readonly MG: "31";
|
|
70
|
-
readonly MS: "50";
|
|
71
|
-
readonly MT: "51";
|
|
72
|
-
readonly PA: "15";
|
|
73
|
-
readonly PB: "25";
|
|
74
|
-
readonly PE: "26";
|
|
75
|
-
readonly PI: "22";
|
|
76
|
-
readonly PR: "41";
|
|
77
|
-
readonly RJ: "33";
|
|
78
|
-
readonly RN: "24";
|
|
79
|
-
readonly RO: "11";
|
|
80
|
-
readonly RR: "14";
|
|
81
|
-
readonly RS: "43";
|
|
82
|
-
readonly SC: "42";
|
|
83
|
-
readonly SE: "28";
|
|
84
|
-
readonly SP: "35";
|
|
85
|
-
readonly TO: "17";
|
|
86
|
-
};
|
|
87
|
-
declare const StateAcronyms: StateAcronym[];
|
|
88
|
-
type StateCode = (typeof StateCodes)[keyof typeof StateCodes];
|
|
89
|
-
type StateAcronym = keyof typeof StateCodes;
|
|
90
|
-
|
|
91
|
-
declare const Environment: {
|
|
92
|
-
readonly Production: "1";
|
|
93
|
-
readonly Homolog: "2";
|
|
94
|
-
};
|
|
95
|
-
type EnvironmentCode = (typeof Environment)[keyof typeof Environment];
|
|
96
|
-
|
|
97
|
-
type Namespaced<T extends object = object> = T & {
|
|
98
|
-
$?: {
|
|
99
|
-
xmlns: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
interface SignedInfo {
|
|
103
|
-
CanonicalizationMethod: CanonicalizationMethod;
|
|
104
|
-
SignatureMethod: SignatureMethod;
|
|
105
|
-
Reference: Reference;
|
|
106
|
-
}
|
|
107
|
-
interface CanonicalizationMethod {
|
|
108
|
-
$: {
|
|
109
|
-
Algorithm: 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315';
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
interface SignatureMethod {
|
|
113
|
-
$: {
|
|
114
|
-
Algorithm: `${SignatureMethod$1}`;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
interface Reference {
|
|
118
|
-
Transforms: Transforms;
|
|
119
|
-
DigestMethod: DigestMethod;
|
|
120
|
-
DigestValue: string;
|
|
121
|
-
$: {
|
|
122
|
-
URI: string;
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
interface Transforms {
|
|
126
|
-
Transform: [
|
|
127
|
-
Transform<'http://www.w3.org/2000/09/xmldsig#enveloped-signature'>,
|
|
128
|
-
Transform<'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'>
|
|
129
|
-
];
|
|
130
|
-
}
|
|
131
|
-
interface Transform<T extends string> {
|
|
132
|
-
$: {
|
|
133
|
-
Algorithm: T;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
interface DigestMethod {
|
|
137
|
-
$: {
|
|
138
|
-
Algorithm: `${DigestAlgorithm}`;
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
interface KeyInfo {
|
|
142
|
-
X509Data: X509Data;
|
|
143
|
-
}
|
|
144
|
-
interface X509Data {
|
|
145
|
-
X509Certificate: string;
|
|
146
|
-
}
|
|
147
|
-
interface Signature {
|
|
148
|
-
$: {
|
|
149
|
-
xmlns: typeof SignatureNamespace;
|
|
150
|
-
};
|
|
151
|
-
SignedInfo: SignedInfo;
|
|
152
|
-
SignatureValue: string;
|
|
153
|
-
KeyInfo: KeyInfo;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
9
|
interface StrategyPattern<T, R> {
|
|
157
10
|
execute(...args: T[]): R;
|
|
158
11
|
}
|
|
159
12
|
|
|
160
|
-
type HeaderValue = string | string[] | number | boolean | null;
|
|
161
|
-
type HttpClientHeaders = Record<string, HeaderValue>;
|
|
162
|
-
type ResponseType = 'arraybuffer' | 'json';
|
|
163
|
-
interface RequestConfig {
|
|
164
|
-
headers?: HttpClientHeaders;
|
|
165
|
-
responseType?: ResponseType;
|
|
166
|
-
}
|
|
167
|
-
interface HttpResponse<T = unknown> {
|
|
168
|
-
data: T;
|
|
169
|
-
status: number;
|
|
170
|
-
statusText: string;
|
|
171
|
-
headers: HttpClientHeaders;
|
|
172
|
-
}
|
|
173
|
-
interface HttpClient {
|
|
174
|
-
get<T = unknown, R = HttpResponse<T>>(url: string, config?: RequestConfig): Promise<R>;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
type Client = Record<string, (args: any, opt?: RequestConfig) => Promise<any>>;
|
|
178
|
-
type KnownKeys<T> = keyof {
|
|
179
|
-
[K in keyof T as {} extends Record<K, 1> ? never : K]: T[K];
|
|
180
|
-
};
|
|
181
|
-
type SendTransmissionPayload<C extends Client> = {
|
|
182
|
-
[M in KnownKeys<C> & string]: {
|
|
183
|
-
url: string;
|
|
184
|
-
method: M;
|
|
185
|
-
root: string;
|
|
186
|
-
xsd: string;
|
|
187
|
-
payload: Parameters<C[M]>[0];
|
|
188
|
-
};
|
|
189
|
-
}[KnownKeys<C> & string];
|
|
190
|
-
type ExtractReturnType<C extends Client, P extends SendTransmissionPayload<C>> = P extends {
|
|
191
|
-
method: infer M extends keyof C;
|
|
192
|
-
} ? Awaited<ReturnType<C[M]>> : never;
|
|
193
|
-
|
|
194
|
-
interface TransmitterOptions {
|
|
195
|
-
certificate?: ReadCertificateResponse;
|
|
196
|
-
}
|
|
197
|
-
interface Transmitter<C extends Client> {
|
|
198
|
-
configure(options: TransmitterOptions): Transmitter<C>;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
declare const defaultCanonicalizeOptions: CanonicalizeOptions;
|
|
202
|
-
interface CanonicalizeOptions {
|
|
203
|
-
includeComments: boolean;
|
|
204
|
-
exclusive: boolean;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
declare const defaultBuilderOptions: BuilderOptions;
|
|
208
|
-
interface XmlDeclarationAttributes {
|
|
209
|
-
version: string;
|
|
210
|
-
encoding?: string | undefined;
|
|
211
|
-
standalone?: boolean | undefined;
|
|
212
|
-
}
|
|
213
|
-
interface RenderOptions {
|
|
214
|
-
pretty?: boolean | undefined;
|
|
215
|
-
indent?: string | undefined;
|
|
216
|
-
newline?: string | undefined;
|
|
217
|
-
}
|
|
218
|
-
interface BuilderOptions {
|
|
219
|
-
attrkey?: string | undefined;
|
|
220
|
-
charkey?: string | undefined;
|
|
221
|
-
rootName?: string | undefined;
|
|
222
|
-
renderOpts?: RenderOptions | undefined;
|
|
223
|
-
xmldec?: XmlDeclarationAttributes | undefined;
|
|
224
|
-
doctype?: 'xml';
|
|
225
|
-
headless?: boolean | undefined;
|
|
226
|
-
allowSurrogateChars?: boolean | undefined;
|
|
227
|
-
cdata?: boolean | undefined;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
declare const defaultParserOptions: ParserOptions;
|
|
231
|
-
interface ParserOptions {
|
|
232
|
-
trim?: boolean;
|
|
233
|
-
normalizeTags?: boolean;
|
|
234
|
-
normalize?: boolean;
|
|
235
|
-
explicitRoot?: boolean;
|
|
236
|
-
xmlns?: boolean;
|
|
237
|
-
explicitArray?: boolean;
|
|
238
|
-
preserveChildrenOrder?: boolean;
|
|
239
|
-
strict?: boolean;
|
|
240
|
-
chunkSize?: number;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
interface XmlToolkit {
|
|
244
|
-
parse<T>(xml: string, options?: ParserOptions): Promise<T>;
|
|
245
|
-
build(object: object, options?: BuilderOptions): Promise<string>;
|
|
246
|
-
validate(xml: string, xsdPathReference: string, xsdFilename: string): Promise<Either<NFeTsError, void>>;
|
|
247
|
-
canonicalize(xml: string, options?: CanonicalizeOptions): string;
|
|
248
|
-
digest(xml: string, algorithm: SignatureAlgorithm, options?: CanonicalizeOptions): string;
|
|
249
|
-
getNode(xml: string, tag: string): string | null;
|
|
250
|
-
getFirstNode(xml: string): string | null;
|
|
251
|
-
getAttribute(xml: string, tag: string): string | null;
|
|
252
|
-
appendNode(xml: string, node: string): string;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
13
|
declare class ValidationError extends NFeTsError {
|
|
256
14
|
}
|
|
257
15
|
|
|
258
|
-
interface CacheAdapter {
|
|
259
|
-
get<T>(key: string): Promise<T | null>;
|
|
260
|
-
has(key: string): Promise<boolean>;
|
|
261
|
-
set(key: string, value: unknown): Promise<boolean>;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
interface CertificateRepository {
|
|
265
|
-
read(request: ReadCertificateRequest$1): Promise<Either$1<NFeTsError$1, ReadCertificateResponse$1>>;
|
|
266
|
-
sign(content: string, privateKey: KeyObject, algorithm: SignatureAlgorithm$1): Promise<Either$1<NFeTsError$1, string>>;
|
|
267
|
-
getStringCertificate(certificate: X509Certificate): string;
|
|
268
|
-
getStringPrivateKey(privateKey: KeyObject): string;
|
|
269
|
-
getCertificateInfo(certificate: X509Certificate): CertificateInfo$1;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
interface RemoteTransmissionRepository<C extends Client> {
|
|
273
|
-
setCertificate(certificate: ReadCertificateResponse): RemoteTransmissionRepository<C>;
|
|
274
|
-
send<P extends SendTransmissionPayload<C>>(params: P): Promise<Either<NFeTsError, ExtractReturnType<C, P>>>;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
interface SignerOptions<T = string> {
|
|
278
|
-
tag: T;
|
|
279
|
-
mark: string;
|
|
280
|
-
}
|
|
281
|
-
type SignedEntity<T extends object> = T & {
|
|
282
|
-
Signature: Signature;
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
declare abstract class Signer {
|
|
286
|
-
protected readonly toolkit: XmlToolkit;
|
|
287
|
-
protected readonly certificateRepository: CertificateRepository;
|
|
288
|
-
protected readonly algorithm: SignatureAlgorithm;
|
|
289
|
-
protected readonly canonical: CanonicalizeOptions;
|
|
290
|
-
constructor(toolkit: XmlToolkit, certificateRepository: CertificateRepository, algorithm?: SignatureAlgorithm, canonical?: CanonicalizeOptions);
|
|
291
|
-
protected assemble(SignedInfo: SignedInfo, SignatureValue: string, certificate: X509Certificate): {
|
|
292
|
-
$: {
|
|
293
|
-
xmlns: "http://www.w3.org/2000/09/xmldsig#";
|
|
294
|
-
};
|
|
295
|
-
SignedInfo: SignedInfo;
|
|
296
|
-
SignatureValue: string;
|
|
297
|
-
KeyInfo: {
|
|
298
|
-
X509Data: {
|
|
299
|
-
X509Certificate: string;
|
|
300
|
-
};
|
|
301
|
-
};
|
|
302
|
-
};
|
|
303
|
-
protected signedInfo(node: string, mark: string): {
|
|
304
|
-
CanonicalizationMethod: {
|
|
305
|
-
$: {
|
|
306
|
-
Algorithm: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
|
|
307
|
-
};
|
|
308
|
-
};
|
|
309
|
-
SignatureMethod: {
|
|
310
|
-
$: {
|
|
311
|
-
Algorithm: SignatureMethod$1;
|
|
312
|
-
};
|
|
313
|
-
};
|
|
314
|
-
Reference: {
|
|
315
|
-
$: {
|
|
316
|
-
URI: string;
|
|
317
|
-
};
|
|
318
|
-
Transforms: {
|
|
319
|
-
Transform: [{
|
|
320
|
-
$: {
|
|
321
|
-
Algorithm: "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
|
|
322
|
-
};
|
|
323
|
-
}, {
|
|
324
|
-
$: {
|
|
325
|
-
Algorithm: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
|
|
326
|
-
};
|
|
327
|
-
}];
|
|
328
|
-
};
|
|
329
|
-
DigestMethod: {
|
|
330
|
-
$: {
|
|
331
|
-
Algorithm: DigestAlgorithm;
|
|
332
|
-
};
|
|
333
|
-
};
|
|
334
|
-
DigestValue: string;
|
|
335
|
-
};
|
|
336
|
-
};
|
|
337
|
-
private digest;
|
|
338
|
-
protected signOrLeft(signedInfo: SignedInfo, privateKey: KeyObject): Promise<Either<NFeTsError, string>>;
|
|
339
|
-
private get transforms();
|
|
340
|
-
private get digestAlgorithm();
|
|
341
|
-
private get signatureMethod();
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
declare class EntitySigner extends Signer {
|
|
345
|
-
sign<T extends object, K extends keyof T = keyof T>(content: T, options: SignerOptions$1<K>, cert: ReadCertificateResponse): Promise<Either<NFeTsError, SignedEntity$1<T>>>;
|
|
346
|
-
private ns;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
16
|
declare class XmlSigner extends Signer {
|
|
350
17
|
sign(xml: string, options: SignerOptions, cert: ReadCertificateResponse): Promise<Left<NFeTsError> | Right<string>>;
|
|
351
18
|
}
|
|
@@ -383,7 +50,7 @@ interface TransformToDateStringArgs extends ValidationOptions {
|
|
|
383
50
|
}
|
|
384
51
|
declare const TransformDateString: (args?: TransformToDateStringArgs) => (target: object, propertyKey: string | symbol) => void;
|
|
385
52
|
|
|
386
|
-
interface StateCodeValidatorStrategy extends StrategyPattern
|
|
53
|
+
interface StateCodeValidatorStrategy extends StrategyPattern<string, boolean> {
|
|
387
54
|
execute(stateCode: string): boolean;
|
|
388
55
|
}
|
|
389
56
|
|
|
@@ -513,24 +180,24 @@ declare class ASN1 {
|
|
|
513
180
|
}
|
|
514
181
|
|
|
515
182
|
declare class Decimal extends Decimal$1 implements Decimal$2 {
|
|
516
|
-
static from(value: DecimalValue
|
|
517
|
-
static newOrZero(value?: DecimalValue
|
|
518
|
-
static newOrUndefined(value?: DecimalValue
|
|
183
|
+
static from(value: DecimalValue | Decimal): Decimal$2;
|
|
184
|
+
static newOrZero(value?: DecimalValue | Decimal): Decimal$2;
|
|
185
|
+
static newOrUndefined(value?: DecimalValue | Decimal): Decimal$2 | undefined;
|
|
519
186
|
}
|
|
520
187
|
|
|
521
|
-
declare class MemoryCacheAdapter implements CacheAdapter
|
|
188
|
+
declare class MemoryCacheAdapter implements CacheAdapter {
|
|
522
189
|
private cache;
|
|
523
190
|
get<T>(key: string): Promise<T | null>;
|
|
524
191
|
has(key: string): Promise<boolean>;
|
|
525
192
|
set(key: string, value: unknown): Promise<boolean>;
|
|
526
193
|
}
|
|
527
194
|
|
|
528
|
-
declare class NativeCertificateRepository implements CertificateRepository
|
|
195
|
+
declare class NativeCertificateRepository implements CertificateRepository {
|
|
529
196
|
private readonly httpClient;
|
|
530
197
|
private readonly cache;
|
|
531
|
-
constructor(httpClient: HttpClient
|
|
532
|
-
read(request: ReadCertificateRequest
|
|
533
|
-
sign(content: string, privateKey: KeyObject, algorithm?: SignatureAlgorithm
|
|
198
|
+
constructor(httpClient: HttpClient, cache?: CacheAdapter);
|
|
199
|
+
read(request: ReadCertificateRequest): Promise<Either<NFeTsError, ReadCertificateResponse>>;
|
|
200
|
+
sign(content: string, privateKey: KeyObject, algorithm?: SignatureAlgorithm): Promise<Left<NFeTsError> | Right<string>>;
|
|
534
201
|
getCertificateInfo(certificate: X509Certificate): {
|
|
535
202
|
CNPJ: string | undefined;
|
|
536
203
|
CPF: string | undefined;
|
|
@@ -549,29 +216,29 @@ declare class NativeCertificateRepository implements CertificateRepository$1 {
|
|
|
549
216
|
private isValidRemoteUrl;
|
|
550
217
|
}
|
|
551
218
|
|
|
552
|
-
declare class NullCacheAdapter implements CacheAdapter
|
|
219
|
+
declare class NullCacheAdapter implements CacheAdapter {
|
|
553
220
|
get<T>(_: string): Promise<T | null>;
|
|
554
221
|
has(_: string): Promise<boolean>;
|
|
555
222
|
set(_: string, __: unknown): Promise<boolean>;
|
|
556
223
|
}
|
|
557
224
|
|
|
558
|
-
declare class SoapRemoteTransmissionRepository<C extends Client
|
|
225
|
+
declare class SoapRemoteTransmissionRepository<C extends Client> implements RemoteTransmissionRepository<C> {
|
|
559
226
|
private readonly toolkit;
|
|
560
227
|
private readonly certificateRepository;
|
|
561
228
|
private certificate?;
|
|
562
|
-
constructor(toolkit: XmlToolkit
|
|
563
|
-
setCertificate(certificate: ReadCertificateResponse
|
|
229
|
+
constructor(toolkit: XmlToolkit, certificateRepository: CertificateRepository);
|
|
230
|
+
setCertificate(certificate: ReadCertificateResponse): this;
|
|
564
231
|
protected get httpsAgent(): Agent;
|
|
565
232
|
protected get defaultSoapHeaders(): {
|
|
566
233
|
'Content-Type': string;
|
|
567
234
|
};
|
|
568
|
-
send<P extends SendTransmissionPayload
|
|
235
|
+
send<P extends SendTransmissionPayload<C>>(params: P): Promise<Left<NFeTsError> | Right<ExtractReturnType<C, P>>>;
|
|
569
236
|
}
|
|
570
237
|
|
|
571
238
|
declare class Xml2JsToolkit implements XmlToolkit {
|
|
572
239
|
private readonly xml2js;
|
|
573
240
|
constructor(xml2js?: typeof Xml2js);
|
|
574
|
-
validate(xml: string,
|
|
241
|
+
validate(xml: string, xsd: string): Promise<Left<NFeTsError> | Right<never>>;
|
|
575
242
|
parse<T>(xml: string, options?: ParserOptions): Promise<T>;
|
|
576
243
|
build(object: object, options?: BuilderOptions): Promise<string>;
|
|
577
244
|
digest(xml: string, algorithm: SignatureAlgorithm, options?: CanonicalizeOptions): string;
|
|
@@ -586,10 +253,6 @@ declare class Xml2JsToolkit implements XmlToolkit {
|
|
|
586
253
|
|
|
587
254
|
declare const leftFromError: (error: unknown) => Left<NFeTsError>;
|
|
588
255
|
|
|
589
|
-
type DeepPartial<T> = {
|
|
590
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
591
|
-
};
|
|
592
|
-
|
|
593
256
|
declare const unreachable: (_: never) => never;
|
|
594
257
|
|
|
595
|
-
export { ASN1,
|
|
258
|
+
export { ASN1, BuilderOptions, CacheAdapter, CanonicalizeOptions, CertificateRepository, Choice, type ChoiceOptions, Client, Decimal, DecimalValue, Either, ExtractReturnType, HttpClient, IsDecimal, Left, MemoryCacheAdapter, NFeTsError, NativeCertificateRepository, NullCacheAdapter, ParserOptions, ReadCertificateRequest, ReadCertificateResponse, RemoteTransmissionRepository, Right, SendTransmissionPayload, SignatureAlgorithm, Signer, SignerOptions, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, 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, type StrategyPattern, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, XmlSigner, XmlToolkit, clearEmptyValues, leftFromError, mapConstraintsToErrors, plainToInstance, unreachable };
|