@pereirajair/nfse-gov-br-node 0.0.3
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/dist/config/environments.d.ts +8 -0
- package/dist/config/environments.js +10 -0
- package/dist/core/certificate.d.ts +18 -0
- package/dist/core/certificate.js +90 -0
- package/dist/core/client.d.ts +27 -0
- package/dist/core/client.js +96 -0
- package/dist/core/signer.d.ts +10 -0
- package/dist/core/signer.js +86 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +14 -0
- package/dist/models/dps.d.ts +83 -0
- package/dist/models/dps.js +5 -0
- package/dist/models/responses.d.ts +28 -0
- package/dist/models/responses.js +2 -0
- package/dist/services/consultas.d.ts +18 -0
- package/dist/services/consultas.js +50 -0
- package/dist/services/dps.d.ts +13 -0
- package/dist/services/dps.js +51 -0
- package/dist/utils/compression.d.ts +7 -0
- package/dist/utils/compression.js +50 -0
- package/dist/utils/xml.d.ts +10 -0
- package/dist/utils/xml.js +66 -0
- package/package.json +28 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the available environments for the NFSe API.
|
|
3
|
+
*/
|
|
4
|
+
export type NfseEnvironment = 'producao' | 'homologacao';
|
|
5
|
+
/**
|
|
6
|
+
* A mapping of environments to their respective API base URLs.
|
|
7
|
+
*/
|
|
8
|
+
export declare const environmentUrls: Record<NfseEnvironment, string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.environmentUrls = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A mapping of environments to their respective API base URLs.
|
|
6
|
+
*/
|
|
7
|
+
exports.environmentUrls = {
|
|
8
|
+
producao: 'https://www.nfse.gov.br',
|
|
9
|
+
homologacao: 'https://www.producaorestrita.nfse.gov.br',
|
|
10
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as forge from 'node-forge';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for the extracted certificate data.
|
|
4
|
+
*/
|
|
5
|
+
export interface CertificateData {
|
|
6
|
+
privateKey: forge.pki.PrivateKey;
|
|
7
|
+
certificate: forge.pki.Certificate;
|
|
8
|
+
caCertificates: forge.pki.Certificate[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Loads an A1 certificate from a PFX/P12 file.
|
|
12
|
+
*
|
|
13
|
+
* @param pfxBuffer The buffer containing the PFX/P12 file content.
|
|
14
|
+
* @param password The password for the certificate.
|
|
15
|
+
* @returns An object containing the private key, certificate, and CA certificates.
|
|
16
|
+
* @throws Will throw an error if the certificate cannot be loaded or parsed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadA1Certificate(pfxBuffer: Buffer, password: string): CertificateData;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.loadA1Certificate = loadA1Certificate;
|
|
37
|
+
const forge = __importStar(require("node-forge"));
|
|
38
|
+
/**
|
|
39
|
+
* Loads an A1 certificate from a PFX/P12 file.
|
|
40
|
+
*
|
|
41
|
+
* @param pfxBuffer The buffer containing the PFX/P12 file content.
|
|
42
|
+
* @param password The password for the certificate.
|
|
43
|
+
* @returns An object containing the private key, certificate, and CA certificates.
|
|
44
|
+
* @throws Will throw an error if the certificate cannot be loaded or parsed.
|
|
45
|
+
*/
|
|
46
|
+
function loadA1Certificate(pfxBuffer, password) {
|
|
47
|
+
try {
|
|
48
|
+
const p12Asn1 = forge.asn1.fromDer(pfxBuffer.toString('binary'));
|
|
49
|
+
const p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, false, password);
|
|
50
|
+
let privateKey = null;
|
|
51
|
+
let certificate = null;
|
|
52
|
+
const caCertificates = [];
|
|
53
|
+
// Find the private key and certificate
|
|
54
|
+
for (const safeContent of p12.safeContents) {
|
|
55
|
+
for (const key in safeContent.safeBags) {
|
|
56
|
+
const bags = safeContent.safeBags[key];
|
|
57
|
+
if (Array.isArray(bags)) {
|
|
58
|
+
for (const bag of bags) {
|
|
59
|
+
if (bag.type === forge.pki.oids.pkcs8ShroudedKeyBag) {
|
|
60
|
+
privateKey = bag.key;
|
|
61
|
+
}
|
|
62
|
+
else if (bag.type === forge.pki.oids.certBag) {
|
|
63
|
+
if (certificate === null) {
|
|
64
|
+
certificate = bag.cert;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
caCertificates.push(bag.cert);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!privateKey || !certificate) {
|
|
75
|
+
throw new Error('Could not find private key or certificate in PFX/P12 file.');
|
|
76
|
+
}
|
|
77
|
+
return { privateKey, certificate, caCertificates };
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error instanceof Error) {
|
|
81
|
+
if (error.message.includes('Invalid password')) {
|
|
82
|
+
throw new Error('The provided password for the certificate is incorrect.');
|
|
83
|
+
}
|
|
84
|
+
if (error.message.includes('Unable to parse PKCS#12')) {
|
|
85
|
+
throw new Error('Unable to parse the certificate. The file may be corrupt or in an unsupported format.');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
throw new Error(`Failed to load A1 certificate: ${error}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CertificateData } from './certificate';
|
|
2
|
+
import { NfseEnvironment } from '../config/environments';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the NfseClient.
|
|
5
|
+
*/
|
|
6
|
+
export interface NfseClientConfig {
|
|
7
|
+
environment: NfseEnvironment;
|
|
8
|
+
certificate: CertificateData;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A secure HTTP client for communicating with the NFSe Nacional API.
|
|
13
|
+
* It handles mTLS authentication using a provided A1 certificate.
|
|
14
|
+
*/
|
|
15
|
+
export declare class NfseClient {
|
|
16
|
+
private readonly client;
|
|
17
|
+
private readonly config;
|
|
18
|
+
constructor(config: NfseClientConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Sends a POST request to the specified path with the given XML payload.
|
|
21
|
+
*
|
|
22
|
+
* @param path The API endpoint path.
|
|
23
|
+
* @param xmlPayload The XML string to send.
|
|
24
|
+
* @returns A promise that resolves with the response data.
|
|
25
|
+
*/
|
|
26
|
+
post(path: string, xmlPayload: string): Promise<any>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.NfseClient = void 0;
|
|
40
|
+
const axios_1 = __importDefault(require("axios"));
|
|
41
|
+
const https = __importStar(require("https"));
|
|
42
|
+
const forge = __importStar(require("node-forge"));
|
|
43
|
+
const environments_1 = require("../config/environments");
|
|
44
|
+
/**
|
|
45
|
+
* A secure HTTP client for communicating with the NFSe Nacional API.
|
|
46
|
+
* It handles mTLS authentication using a provided A1 certificate.
|
|
47
|
+
*/
|
|
48
|
+
class NfseClient {
|
|
49
|
+
constructor(config) {
|
|
50
|
+
this.config = config;
|
|
51
|
+
const { privateKey, certificate, caCertificates } = this.config.certificate;
|
|
52
|
+
const { environment, timeout = 30000 } = this.config;
|
|
53
|
+
// node-forge requires a password to create a PFX. Since this is for an in-memory
|
|
54
|
+
// representation passed directly to the https.Agent, we can use a temporary, random one.
|
|
55
|
+
const tempPassword = Math.random().toString(36).substring(2);
|
|
56
|
+
const p12Asn1 = forge.pkcs12.toPkcs12Asn1(privateKey, [certificate, ...caCertificates], tempPassword, { algorithm: '3des' });
|
|
57
|
+
const p12Der = forge.asn1.toDer(p12Asn1).getBytes();
|
|
58
|
+
const p12Buffer = Buffer.from(p12Der, 'binary');
|
|
59
|
+
const httpsAgent = new https.Agent({
|
|
60
|
+
pfx: p12Buffer,
|
|
61
|
+
passphrase: tempPassword,
|
|
62
|
+
rejectUnauthorized: true, // Ensure the server certificate is validated
|
|
63
|
+
});
|
|
64
|
+
this.client = axios_1.default.create({
|
|
65
|
+
baseURL: environments_1.environmentUrls[environment],
|
|
66
|
+
httpsAgent,
|
|
67
|
+
timeout,
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/xml;charset=utf-8',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sends a POST request to the specified path with the given XML payload.
|
|
75
|
+
*
|
|
76
|
+
* @param path The API endpoint path.
|
|
77
|
+
* @param xmlPayload The XML string to send.
|
|
78
|
+
* @returns A promise that resolves with the response data.
|
|
79
|
+
*/
|
|
80
|
+
async post(path, xmlPayload) {
|
|
81
|
+
try {
|
|
82
|
+
const response = await this.client.post(path, xmlPayload);
|
|
83
|
+
return response.data;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
// Enhance error handling to provide more context
|
|
87
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
88
|
+
const { response } = error;
|
|
89
|
+
const errorMessage = (response === null || response === void 0 ? void 0 : response.data) || error.message;
|
|
90
|
+
throw new Error(`API request failed with status ${response === null || response === void 0 ? void 0 : response.status}: ${errorMessage}`);
|
|
91
|
+
}
|
|
92
|
+
throw new Error(`An unexpected error occurred: ${error}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.NfseClient = NfseClient;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CertificateData } from './certificate';
|
|
2
|
+
/**
|
|
3
|
+
* Signs an XML string with the provided certificate data.
|
|
4
|
+
*
|
|
5
|
+
* @param xml The XML string to sign.
|
|
6
|
+
* @param certificateData The certificate data to use for signing.
|
|
7
|
+
* @param tagToSign The name of the tag within the XML to which the signature will be appended.
|
|
8
|
+
* @returns The signed XML string.
|
|
9
|
+
*/
|
|
10
|
+
export declare function signXml(xml: string, certificateData: CertificateData, tagToSign: string): string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.signXml = signXml;
|
|
37
|
+
const forge = __importStar(require("node-forge"));
|
|
38
|
+
/**
|
|
39
|
+
* Signs an XML string with the provided certificate data.
|
|
40
|
+
*
|
|
41
|
+
* @param xml The XML string to sign.
|
|
42
|
+
* @param certificateData The certificate data to use for signing.
|
|
43
|
+
* @param tagToSign The name of the tag within the XML to which the signature will be appended.
|
|
44
|
+
* @returns The signed XML string.
|
|
45
|
+
*/
|
|
46
|
+
function signXml(xml, certificateData, tagToSign) {
|
|
47
|
+
const { privateKey, certificate } = certificateData;
|
|
48
|
+
// 1. Create the digest of the XML
|
|
49
|
+
const md = forge.md.sha256.create();
|
|
50
|
+
md.update(xml, 'utf8');
|
|
51
|
+
const digest = md.digest().bytes();
|
|
52
|
+
const digestB64 = forge.util.encode64(digest);
|
|
53
|
+
// 2. Define the <SignedInfo> block. This is what actually gets signed.
|
|
54
|
+
const signedInfo = `<SignedInfo>
|
|
55
|
+
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
|
|
56
|
+
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
|
|
57
|
+
<Reference URI="">
|
|
58
|
+
<Transforms>
|
|
59
|
+
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
|
|
60
|
+
</Transforms>
|
|
61
|
+
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
|
|
62
|
+
<DigestValue>${digestB64}</DigestValue>
|
|
63
|
+
</Reference>
|
|
64
|
+
</SignedInfo>`;
|
|
65
|
+
// 3. Create the signature of the <SignedInfo> block
|
|
66
|
+
const signatureMd = forge.md.sha256.create();
|
|
67
|
+
signatureMd.update(signedInfo, 'utf8');
|
|
68
|
+
const signature = privateKey.sign(signatureMd);
|
|
69
|
+
const signatureB64 = forge.util.encode64(signature);
|
|
70
|
+
// 4. Extract the certificate in Base64 format
|
|
71
|
+
const certPem = forge.pki.certificateToPem(certificate);
|
|
72
|
+
const certB64 = forge.util.encode64(certPem.replace(/-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----|\r|\n/g, ''));
|
|
73
|
+
// 5. Assemble the final <Signature> block
|
|
74
|
+
const signatureBlock = `<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
|
75
|
+
${signedInfo}
|
|
76
|
+
<SignatureValue>${signatureB64}</SignatureValue>
|
|
77
|
+
<KeyInfo>
|
|
78
|
+
<X509Data>
|
|
79
|
+
<X509Certificate>${certB64}</X509Certificate>
|
|
80
|
+
</X509Data>
|
|
81
|
+
</KeyInfo>
|
|
82
|
+
</Signature>`;
|
|
83
|
+
// 6. Inject the signature block into the original XML
|
|
84
|
+
const signedXml = xml.replace(`</${tagToSign}>`, `${signatureBlock}</${tagToSign}>`);
|
|
85
|
+
return signedXml;
|
|
86
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { NfseClient } from './core/client';
|
|
2
|
+
export type { NfseClientConfig } from './core/client';
|
|
3
|
+
export { loadA1Certificate } from './core/certificate';
|
|
4
|
+
export type { CertificateData } from './core/certificate';
|
|
5
|
+
export { enviaDps } from './services/dps';
|
|
6
|
+
export { consultarNfseChave, consultarDpsChave } from './services/consultas';
|
|
7
|
+
export { environmentUrls } from './config/environments';
|
|
8
|
+
export type { NfseEnvironment } from './config/environments';
|
|
9
|
+
export type { DPS, Endereco, Contato, NFSeResponse } from './models/dps';
|
|
10
|
+
export type { NFSe, DPSConsultaResponse } from './models/responses';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.environmentUrls = exports.consultarDpsChave = exports.consultarNfseChave = exports.enviaDps = exports.loadA1Certificate = exports.NfseClient = void 0;
|
|
4
|
+
var client_1 = require("./core/client");
|
|
5
|
+
Object.defineProperty(exports, "NfseClient", { enumerable: true, get: function () { return client_1.NfseClient; } });
|
|
6
|
+
var certificate_1 = require("./core/certificate");
|
|
7
|
+
Object.defineProperty(exports, "loadA1Certificate", { enumerable: true, get: function () { return certificate_1.loadA1Certificate; } });
|
|
8
|
+
var dps_1 = require("./services/dps");
|
|
9
|
+
Object.defineProperty(exports, "enviaDps", { enumerable: true, get: function () { return dps_1.enviaDps; } });
|
|
10
|
+
var consultas_1 = require("./services/consultas");
|
|
11
|
+
Object.defineProperty(exports, "consultarNfseChave", { enumerable: true, get: function () { return consultas_1.consultarNfseChave; } });
|
|
12
|
+
Object.defineProperty(exports, "consultarDpsChave", { enumerable: true, get: function () { return consultas_1.consultarDpsChave; } });
|
|
13
|
+
var environments_1 = require("./config/environments");
|
|
14
|
+
Object.defineProperty(exports, "environmentUrls", { enumerable: true, get: function () { return environments_1.environmentUrls; } });
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on ANEXO_I-SEFIN_ADN-DPS_NFSe-SNNFSe
|
|
3
|
+
*/
|
|
4
|
+
export interface Endereco {
|
|
5
|
+
logradouro: string;
|
|
6
|
+
numero: string;
|
|
7
|
+
complemento?: string;
|
|
8
|
+
bairro: string;
|
|
9
|
+
codigoMunicipio: string;
|
|
10
|
+
uf: string;
|
|
11
|
+
cep: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Contato {
|
|
14
|
+
telefone?: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface DPS {
|
|
18
|
+
identificacao: {
|
|
19
|
+
numero: string;
|
|
20
|
+
serie: string;
|
|
21
|
+
dataEmissao: Date;
|
|
22
|
+
competencia: Date;
|
|
23
|
+
tipoTributacao: 'T' | 'F' | 'A' | 'B' | 'M' | 'N' | 'X' | 'V' | 'P' | 'S';
|
|
24
|
+
};
|
|
25
|
+
prestador: {
|
|
26
|
+
cnpj: string;
|
|
27
|
+
inscricaoMunicipal?: string;
|
|
28
|
+
regimeEspecialTributacao?: string;
|
|
29
|
+
};
|
|
30
|
+
tomador: {
|
|
31
|
+
identificacao: {
|
|
32
|
+
cnpjCpf: string;
|
|
33
|
+
inscricaoMunicipal?: string;
|
|
34
|
+
};
|
|
35
|
+
razaoSocial: string;
|
|
36
|
+
endereco: Endereco;
|
|
37
|
+
contato?: Contato;
|
|
38
|
+
};
|
|
39
|
+
servico: {
|
|
40
|
+
codigoNbs: string;
|
|
41
|
+
discriminacao: string;
|
|
42
|
+
valorServicos: number;
|
|
43
|
+
valorDeducoes?: number;
|
|
44
|
+
valorPis?: number;
|
|
45
|
+
valorCofins?: number;
|
|
46
|
+
valorInss?: number;
|
|
47
|
+
valorIr?: number;
|
|
48
|
+
valorCsll?: number;
|
|
49
|
+
issRetido: boolean;
|
|
50
|
+
valorIss?: number;
|
|
51
|
+
aliquota?: number;
|
|
52
|
+
descontoIncondicionado?: number;
|
|
53
|
+
descontoCondicionado?: number;
|
|
54
|
+
itemListaServico: string;
|
|
55
|
+
codigoCnae?: string;
|
|
56
|
+
codigoTributacaoMunicipio?: string;
|
|
57
|
+
municipioPrestacao: string;
|
|
58
|
+
paisPrestacao?: string;
|
|
59
|
+
};
|
|
60
|
+
construcaoCivil?: {
|
|
61
|
+
codigoObra?: string;
|
|
62
|
+
art?: string;
|
|
63
|
+
inscricaoImobiliaria?: string;
|
|
64
|
+
endereco?: Endereco;
|
|
65
|
+
};
|
|
66
|
+
atividadesEvento?: {
|
|
67
|
+
codigoEvento: string;
|
|
68
|
+
nomeEvento: string;
|
|
69
|
+
dataInicio: Date;
|
|
70
|
+
dataFim: Date;
|
|
71
|
+
endereco: Endereco;
|
|
72
|
+
};
|
|
73
|
+
ibsCbs?: {
|
|
74
|
+
situacaoTributaria: string;
|
|
75
|
+
classificacaoTributaria: string;
|
|
76
|
+
valorAliquota?: number;
|
|
77
|
+
valorIBS?: number;
|
|
78
|
+
valorCBS?: number;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export interface NFSeResponse {
|
|
82
|
+
chaveAcesso: string;
|
|
83
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the structure of a successfully queried NFSe.
|
|
3
|
+
* The fields here are based on common NFSe layouts and should be
|
|
4
|
+
* adjusted according to the actual API response.
|
|
5
|
+
*/
|
|
6
|
+
export interface NFSe {
|
|
7
|
+
chaveAcesso: string;
|
|
8
|
+
numero: string;
|
|
9
|
+
dataEmissao: Date;
|
|
10
|
+
status: string;
|
|
11
|
+
valorTotal: number;
|
|
12
|
+
prestador: {
|
|
13
|
+
cnpj: string;
|
|
14
|
+
razaoSocial: string;
|
|
15
|
+
};
|
|
16
|
+
tomador: {
|
|
17
|
+
cnpjCpf: string;
|
|
18
|
+
razaoSocial: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Represents the structure of a successfully queried DPS.
|
|
23
|
+
*/
|
|
24
|
+
export interface DPSConsultaResponse {
|
|
25
|
+
chaveAcesso: string;
|
|
26
|
+
status: 'enviada' | 'processada' | 'erro';
|
|
27
|
+
numeroNfse?: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NfseClient } from '../core/client';
|
|
2
|
+
import { NFSe, DPSConsultaResponse } from '../models/responses';
|
|
3
|
+
/**
|
|
4
|
+
* Consults an NFSe by its access key.
|
|
5
|
+
*
|
|
6
|
+
* @param chaveAcesso The 50-character access key of the NFSe.
|
|
7
|
+
* @param client An instance of the configured NfseClient.
|
|
8
|
+
* @returns A promise that resolves with the NFSe data.
|
|
9
|
+
*/
|
|
10
|
+
export declare function consultarNfseChave(chaveAcesso: string, client: NfseClient): Promise<NFSe>;
|
|
11
|
+
/**
|
|
12
|
+
* Consults a DPS by its access key.
|
|
13
|
+
*
|
|
14
|
+
* @param chaveAcesso The access key of the DPS.
|
|
15
|
+
* @param client An instance of the configured NfseClient.
|
|
16
|
+
* @returns A promise that resolves with the DPS consultation data.
|
|
17
|
+
*/
|
|
18
|
+
export declare function consultarDpsChave(chaveAcesso: string, client: NfseClient): Promise<DPSConsultaResponse>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.consultarNfseChave = consultarNfseChave;
|
|
4
|
+
exports.consultarDpsChave = consultarDpsChave;
|
|
5
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
6
|
+
/**
|
|
7
|
+
* Consults an NFSe by its access key.
|
|
8
|
+
*
|
|
9
|
+
* @param chaveAcesso The 50-character access key of the NFSe.
|
|
10
|
+
* @param client An instance of the configured NfseClient.
|
|
11
|
+
* @returns A promise that resolves with the NFSe data.
|
|
12
|
+
*/
|
|
13
|
+
async function consultarNfseChave(chaveAcesso, client) {
|
|
14
|
+
var _a;
|
|
15
|
+
const xmlPayload = `<ConsultarNfse>
|
|
16
|
+
<chaveAcesso>${chaveAcesso}</chaveAcesso>
|
|
17
|
+
</ConsultarNfse>`;
|
|
18
|
+
// Placeholder for the actual API endpoint
|
|
19
|
+
const responseXml = await client.post('/ws/consultarNfse', xmlPayload);
|
|
20
|
+
const parser = new fast_xml_parser_1.XMLParser();
|
|
21
|
+
const parsedResponse = parser.parse(responseXml);
|
|
22
|
+
// The exact path to the data needs to be verified against the API's response
|
|
23
|
+
const nfseData = (_a = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.retornoConsultaNfse) === null || _a === void 0 ? void 0 : _a.nfse;
|
|
24
|
+
if (!nfseData) {
|
|
25
|
+
throw new Error('Could not find NFSe data in the API response.');
|
|
26
|
+
}
|
|
27
|
+
return nfseData;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Consults a DPS by its access key.
|
|
31
|
+
*
|
|
32
|
+
* @param chaveAcesso The access key of the DPS.
|
|
33
|
+
* @param client An instance of the configured NfseClient.
|
|
34
|
+
* @returns A promise that resolves with the DPS consultation data.
|
|
35
|
+
*/
|
|
36
|
+
async function consultarDpsChave(chaveAcesso, client) {
|
|
37
|
+
const xmlPayload = `<ConsultarDps>
|
|
38
|
+
<chaveAcesso>${chaveAcesso}</chaveAcesso>
|
|
39
|
+
</ConsultarDps>`;
|
|
40
|
+
// Placeholder for the actual API endpoint
|
|
41
|
+
const responseXml = await client.post('/ws/consultarDps', xmlPayload);
|
|
42
|
+
const parser = new fast_xml_parser_1.XMLParser();
|
|
43
|
+
const parsedResponse = parser.parse(responseXml);
|
|
44
|
+
// The exact path to the data needs to be verified against the API's response
|
|
45
|
+
const dpsData = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.retornoConsultaDps;
|
|
46
|
+
if (!dpsData) {
|
|
47
|
+
throw new Error('Could not find DPS data in the API response.');
|
|
48
|
+
}
|
|
49
|
+
return dpsData;
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DPS, NFSeResponse } from '../models/dps';
|
|
2
|
+
import { NfseClient } from '../core/client';
|
|
3
|
+
import { CertificateData } from '../core/certificate';
|
|
4
|
+
/**
|
|
5
|
+
* Orchestrates the process of sending a DPS to the NFSe Nacional API.
|
|
6
|
+
*
|
|
7
|
+
* @param dps The DPS object to be sent.
|
|
8
|
+
* @param client An instance of the configured NfseClient.
|
|
9
|
+
* @param certificate The certificate data for signing.
|
|
10
|
+
* @returns A promise that resolves with the response from the API.
|
|
11
|
+
* @throws Will throw an error if any step of the process fails.
|
|
12
|
+
*/
|
|
13
|
+
export declare function enviaDps(dps: DPS, client: NfseClient, certificate: CertificateData): Promise<NFSeResponse>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enviaDps = enviaDps;
|
|
4
|
+
const xml_1 = require("../utils/xml");
|
|
5
|
+
const signer_1 = require("../core/signer");
|
|
6
|
+
const compression_1 = require("../utils/compression");
|
|
7
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
8
|
+
/**
|
|
9
|
+
* Orchestrates the process of sending a DPS to the NFSe Nacional API.
|
|
10
|
+
*
|
|
11
|
+
* @param dps The DPS object to be sent.
|
|
12
|
+
* @param client An instance of the configured NfseClient.
|
|
13
|
+
* @param certificate The certificate data for signing.
|
|
14
|
+
* @returns A promise that resolves with the response from the API.
|
|
15
|
+
* @throws Will throw an error if any step of the process fails.
|
|
16
|
+
*/
|
|
17
|
+
async function enviaDps(dps, client, certificate) {
|
|
18
|
+
var _a;
|
|
19
|
+
try {
|
|
20
|
+
// 1. Build the DPS XML from the object
|
|
21
|
+
const dpsXml = (0, xml_1.buildDpsXml)(dps);
|
|
22
|
+
// 2. Sign the DPS XML document
|
|
23
|
+
// The signature must be applied to the <DPS> tag
|
|
24
|
+
const signedDpsXml = (0, signer_1.signXml)(dpsXml, certificate, 'DPS');
|
|
25
|
+
// 3. Compress and Base64 encode the signed XML
|
|
26
|
+
const compressedPayload = await (0, compression_1.compressAndEncodeXml)(signedDpsXml);
|
|
27
|
+
// 4. Wrap the payload in the required structure for the API
|
|
28
|
+
const finalXml = `<EnviarDeclaracaoServico><dps_compactado>${compressedPayload}</dps_compactado></EnviarDeclaracaoServico>`;
|
|
29
|
+
// 5. Send the request using the mTLS client
|
|
30
|
+
// The specific endpoint path needs to be confirmed from the official documentation,
|
|
31
|
+
// '/ws/enviarDps' is a placeholder based on common patterns.
|
|
32
|
+
const responseXml = await client.post('/ws/enviarDps', finalXml);
|
|
33
|
+
// 6. Parse the XML response
|
|
34
|
+
const parser = new fast_xml_parser_1.XMLParser();
|
|
35
|
+
const parsedResponse = parser.parse(responseXml);
|
|
36
|
+
// The exact path to the response data needs to be verified against the API's actual response structure.
|
|
37
|
+
const chaveAcesso = (_a = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.retornoEnvioDps) === null || _a === void 0 ? void 0 : _a.chaveAcesso;
|
|
38
|
+
if (!chaveAcesso) {
|
|
39
|
+
throw new Error('Could not find chaveAcesso in the API response.');
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
chaveAcesso,
|
|
43
|
+
...parsedResponse.retornoEnvioDps,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error('Failed to send DPS:', error);
|
|
48
|
+
// Re-throw the error to be handled by the caller
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compresses an XML string using GZip and then encodes it in Base64.
|
|
3
|
+
*
|
|
4
|
+
* @param xml The input XML string.
|
|
5
|
+
* @returns A promise that resolves with the Base64 encoded GZipped string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function compressAndEncodeXml(xml: string): Promise<string>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.compressAndEncodeXml = compressAndEncodeXml;
|
|
37
|
+
const zlib = __importStar(require("zlib"));
|
|
38
|
+
const util_1 = require("util");
|
|
39
|
+
const gzip = (0, util_1.promisify)(zlib.gzip);
|
|
40
|
+
/**
|
|
41
|
+
* Compresses an XML string using GZip and then encodes it in Base64.
|
|
42
|
+
*
|
|
43
|
+
* @param xml The input XML string.
|
|
44
|
+
* @returns A promise that resolves with the Base64 encoded GZipped string.
|
|
45
|
+
*/
|
|
46
|
+
async function compressAndEncodeXml(xml) {
|
|
47
|
+
const buffer = Buffer.from(xml, 'utf-8');
|
|
48
|
+
const compressedBuffer = await gzip(buffer);
|
|
49
|
+
return compressedBuffer.toString('base64');
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DPS } from '../models/dps';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a DPS object to its XML string representation.
|
|
4
|
+
* Note: This is a simplified builder for the MVP. A more robust XML library
|
|
5
|
+
* might be used in the future for better maintainability.
|
|
6
|
+
*
|
|
7
|
+
* @param dps The DPS object.
|
|
8
|
+
* @returns The XML string representation of the DPS.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildDpsXml(dps: DPS): string;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildDpsXml = buildDpsXml;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
/**
|
|
6
|
+
* Converts a DPS object to its XML string representation.
|
|
7
|
+
* Note: This is a simplified builder for the MVP. A more robust XML library
|
|
8
|
+
* might be used in the future for better maintainability.
|
|
9
|
+
*
|
|
10
|
+
* @param dps The DPS object.
|
|
11
|
+
* @returns The XML string representation of the DPS.
|
|
12
|
+
*/
|
|
13
|
+
function buildDpsXml(dps) {
|
|
14
|
+
// Helper to format dates to 'yyyy-MM-dd'
|
|
15
|
+
const formatDate = (date) => (0, date_fns_1.format)(date, 'yyyy-MM-dd');
|
|
16
|
+
// Helper to safely add optional elements
|
|
17
|
+
const addOptional = (tag, value) => (value ? `<${tag}>${value}</${tag}>` : '');
|
|
18
|
+
const addOptionalFloat = (tag, value) => (value ? `<${tag}>${value.toFixed(2)}</${tag}>` : '');
|
|
19
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
20
|
+
<DPS xmlns="http://www.nfse.gov.br/nfse">
|
|
21
|
+
<identificacao>
|
|
22
|
+
<numero>${dps.identificacao.numero}</numero>
|
|
23
|
+
<serie>${dps.identificacao.serie}</serie>
|
|
24
|
+
<dataEmissao>${formatDate(dps.identificacao.dataEmissao)}</dataEmissao>
|
|
25
|
+
<competencia>${formatDate(dps.identificacao.competencia)}</competencia>
|
|
26
|
+
<tipoTributacao>${dps.identificacao.tipoTributacao}</tipoTributacao>
|
|
27
|
+
</identificacao>
|
|
28
|
+
<prestador>
|
|
29
|
+
<cnpj>${dps.prestador.cnpj}</cnpj>
|
|
30
|
+
${addOptional('inscricaoMunicipal', dps.prestador.inscricaoMunicipal)}
|
|
31
|
+
${addOptional('regimeEspecialTributacao', dps.prestador.regimeEspecialTributacao)}
|
|
32
|
+
</prestador>
|
|
33
|
+
<tomador>
|
|
34
|
+
<identificacao>
|
|
35
|
+
<cnpjCpf>${dps.tomador.identificacao.cnpjCpf}</cnpjCpf>
|
|
36
|
+
${addOptional('inscricaoMunicipal', dps.tomador.identificacao.inscricaoMunicipal)}
|
|
37
|
+
</identificacao>
|
|
38
|
+
<razaoSocial>${dps.tomador.razaoSocial}</razaoSocial>
|
|
39
|
+
<endereco>
|
|
40
|
+
<logradouro>${dps.tomador.endereco.logradouro}</logradouro>
|
|
41
|
+
<numero>${dps.tomador.endereco.numero}</numero>
|
|
42
|
+
${addOptional('complemento', dps.tomador.endereco.complemento)}
|
|
43
|
+
<bairro>${dps.tomador.endereco.bairro}</bairro>
|
|
44
|
+
<codigoMunicipio>${dps.tomador.endereco.codigoMunicipio}</codigoMunicipio>
|
|
45
|
+
<uf>${dps.tomador.endereco.uf}</uf>
|
|
46
|
+
<cep>${dps.tomador.endereco.cep}</cep>
|
|
47
|
+
</endereco>
|
|
48
|
+
</tomador>
|
|
49
|
+
<servico>
|
|
50
|
+
<codigoNbs>${dps.servico.codigoNbs}</codigoNbs>
|
|
51
|
+
<discriminacao>${dps.servico.discriminacao}</discriminacao>
|
|
52
|
+
<valorServicos>${dps.servico.valorServicos.toFixed(2)}</valorServicos>
|
|
53
|
+
${addOptionalFloat('valorDeducoes', dps.servico.valorDeducoes)}
|
|
54
|
+
${addOptionalFloat('valorPis', dps.servico.valorPis)}
|
|
55
|
+
${addOptionalFloat('valorCofins', dps.servico.valorCofins)}
|
|
56
|
+
${addOptionalFloat('valorInss', dps.servico.valorInss)}
|
|
57
|
+
${addOptionalFloat('valorIr', dps.servico.valorIr)}
|
|
58
|
+
${addOptionalFloat('valorCsll', dps.servico.valorCsll)}
|
|
59
|
+
<issRetido>${dps.servico.issRetido}</issRetido>
|
|
60
|
+
${addOptionalFloat('valorIss', dps.servico.valorIss)}
|
|
61
|
+
${addOptionalFloat('aliquota', dps.servico.aliquota)}
|
|
62
|
+
<itemListaServico>${dps.servico.itemListaServico}</itemListaServico>
|
|
63
|
+
<municipioPrestacao>${dps.servico.municipioPrestacao}</municipioPrestacao>
|
|
64
|
+
</servico>
|
|
65
|
+
</DPS>`;
|
|
66
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pereirajair/nfse-gov-br-node",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "Library for interacting with the Brazilian NFSe Nacional API",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p tsconfig.build.json",
|
|
12
|
+
"test": "jest"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/jest": "^30.0.0",
|
|
16
|
+
"@types/node": "^25.0.10",
|
|
17
|
+
"@types/node-forge": "^1.3.14",
|
|
18
|
+
"ts-jest": "^29.4.6",
|
|
19
|
+
"typescript": "^5.9.3"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"axios": "^1.13.4",
|
|
23
|
+
"date-fns": "^2.30.0",
|
|
24
|
+
"fast-xml-parser": "^4.5.3",
|
|
25
|
+
"node-forge": "^1.3.3",
|
|
26
|
+
"zod": "^3.25.76"
|
|
27
|
+
}
|
|
28
|
+
}
|