@devly-cl/sii-client 0.4.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -26
- package/dist/application/invoice-queries.d.ts +17 -0
- package/dist/application/invoice-queries.js +51 -0
- package/dist/application/issuance.d.ts +40 -0
- package/dist/application/issuance.js +79 -0
- package/dist/contracts.d.ts +66 -0
- package/dist/contracts.js +2 -0
- package/dist/domain/document.d.ts +47 -0
- package/dist/domain/document.js +38 -0
- package/dist/domain/invoice-xml.d.ts +58 -11
- package/dist/domain/invoice-xml.js +0 -138
- package/dist/domain/invoicing.d.ts +52 -0
- package/dist/domain/invoicing.js +157 -0
- package/dist/domain/issued-invoice.d.ts +16 -9
- package/dist/domain/issued-invoice.js +4 -43
- package/dist/domain/received-invoice.d.ts +11 -7
- package/dist/domain/received-invoice.js +0 -10
- package/dist/domain/sii-error.d.ts +3 -3
- package/dist/domain/sii-error.js +10 -4
- package/dist/index.d.ts +13 -3
- package/dist/index.js +12 -3
- package/dist/infrastructure/dte-xml.d.ts +11 -0
- package/dist/infrastructure/dte-xml.js +173 -0
- package/dist/infrastructure/facturador-gateway.d.ts +28 -0
- package/dist/infrastructure/facturador-gateway.js +411 -0
- package/dist/infrastructure/facturador.d.ts +18 -0
- package/dist/infrastructure/facturador.js +231 -0
- package/dist/infrastructure/invoice-pdf.d.ts +9 -0
- package/dist/infrastructure/invoice-pdf.js +171 -0
- package/dist/infrastructure/rcv-gateway.d.ts +17 -0
- package/dist/infrastructure/rcv-gateway.js +105 -0
- package/dist/infrastructure/rcv-normalization.d.ts +6 -0
- package/dist/infrastructure/rcv-normalization.js +55 -0
- package/dist/infrastructure/sii-client.d.ts +52 -54
- package/dist/infrastructure/sii-client.js +66 -487
- package/dist/infrastructure/sii-http-session.d.ts +25 -0
- package/dist/infrastructure/sii-http-session.js +344 -0
- package/dist/sii-error.d.ts +27 -0
- package/dist/sii-error.js +86 -0
- package/package.json +4 -4
|
@@ -1,58 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
msgeRespuesta: string | null;
|
|
14
|
-
codError: unknown;
|
|
15
|
-
};
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
}
|
|
18
|
-
export interface EmpresaAutorizada extends RegistroSii {
|
|
19
|
-
usrEmpRut: number;
|
|
20
|
-
usrEmpDv: string;
|
|
21
|
-
usrEmpRutDv: string;
|
|
22
|
-
}
|
|
23
|
-
export interface SiiClientOptions {
|
|
24
|
-
empresaRut: string;
|
|
25
|
-
timeoutMs?: number;
|
|
26
|
-
retries?: number;
|
|
27
|
-
fetchImpl?: typeof globalThis.fetch;
|
|
28
|
-
}
|
|
29
|
-
export interface CredencialesSii {
|
|
30
|
-
rut: string;
|
|
31
|
-
clave: string;
|
|
32
|
-
}
|
|
33
|
-
export interface ConsultaResumen {
|
|
34
|
-
periodo: string;
|
|
35
|
-
operacion: Operacion;
|
|
36
|
-
estado?: EstadoCompra;
|
|
37
|
-
}
|
|
38
|
-
export interface SesionSii {
|
|
39
|
-
usuarioRut: string;
|
|
40
|
-
empresaRut: string;
|
|
41
|
-
representacion: false;
|
|
42
|
-
}
|
|
43
|
-
/** Una instancia = una empresa y una sesión personal. Nunca comparte cookies. */
|
|
1
|
+
import { type PreparedDocument, type SentDocument } from '../domain/document';
|
|
2
|
+
import type { InvoiceInput } from '../domain/invoicing';
|
|
3
|
+
import type { IssuedInvoicesQuery, IssuedInvoicesResult } from '../domain/issued-invoice';
|
|
4
|
+
import type { ReceivedInvoicesQuery, ReceivedInvoicesResult } from '../domain/received-invoice';
|
|
5
|
+
import type { IssuedInvoiceXmlQuery, ReceivedInvoiceXmlQuery, InvoiceXmlResult, IssuedDocumentXmlQuery, IssuedDocumentXmlResult } from '../domain/invoice-xml';
|
|
6
|
+
import type { AuthorizedCompany, SummaryQuery, SiiResponse, SiiClientOptions, SiiCredentials, SiiSession, IssuedInvoicePdfQuery, ReceivedInvoicePdfQuery, PdfDownloadOptions, InvoicePdfResult } from '../contracts';
|
|
7
|
+
import { type SignDocumentInput } from '../application/issuance';
|
|
8
|
+
export { SiiError } from '../sii-error';
|
|
9
|
+
export type * from '../contracts';
|
|
10
|
+
export type { PreparedDocument, SignedDocument, SentDocument, DocumentoPreparado, DocumentoFirmado, DocumentoEnviado } from '../domain/document';
|
|
11
|
+
export type { SignDocumentInput, FirmaDocumento } from '../application/issuance';
|
|
12
|
+
/** One company and personal session; composition and compatibility stay at this boundary. */
|
|
44
13
|
export declare class SiiClient {
|
|
45
14
|
#private;
|
|
46
|
-
constructor(
|
|
47
|
-
login(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
15
|
+
constructor(options: SiiClientOptions);
|
|
16
|
+
login(credentials: SiiCredentials): Promise<SiiSession>;
|
|
17
|
+
getAuthorizedCompanies(): Promise<SiiResponse<AuthorizedCompany>>;
|
|
18
|
+
getSummary(input: SummaryQuery): Promise<SiiResponse>;
|
|
19
|
+
getIssuedInvoices(input: IssuedInvoicesQuery): Promise<IssuedInvoicesResult>;
|
|
20
|
+
getReceivedInvoices(input: ReceivedInvoicesQuery): Promise<ReceivedInvoicesResult>;
|
|
21
|
+
getIssuedInvoiceXml(input: IssuedInvoiceXmlQuery): Promise<InvoiceXmlResult>;
|
|
22
|
+
getReceivedInvoiceXml(input: ReceivedInvoiceXmlQuery): Promise<InvoiceXmlResult>;
|
|
23
|
+
getIssuedDocumentXml(input: IssuedDocumentXmlQuery): Promise<IssuedDocumentXmlResult>;
|
|
24
|
+
getIssuedInvoicePdf(input: IssuedInvoicePdfQuery, options?: PdfDownloadOptions): Promise<InvoicePdfResult>;
|
|
25
|
+
getReceivedInvoicePdf(input: ReceivedInvoicePdfQuery, options?: PdfDownloadOptions): Promise<InvoicePdfResult>;
|
|
26
|
+
prepareInvoice(input: InvoiceInput): Promise<PreparedDocument>;
|
|
27
|
+
prepareCancellationCreditNote(input: {
|
|
28
|
+
factura: IssuedInvoiceXmlQuery;
|
|
29
|
+
issuedDate: string;
|
|
30
|
+
}): Promise<PreparedDocument>;
|
|
31
|
+
signAndSend(input: SignDocumentInput): Promise<SentDocument>;
|
|
57
32
|
dispose(): Promise<void>;
|
|
33
|
+
/** @deprecated Use getAuthorizedCompanies. */
|
|
34
|
+
getEmpresasAutorizadas(): Promise<SiiResponse<AuthorizedCompany>>;
|
|
35
|
+
/** @deprecated Use getSummary. */
|
|
36
|
+
getResumen(input: SummaryQuery): Promise<SiiResponse>;
|
|
37
|
+
/** @deprecated Use getIssuedInvoices. */
|
|
38
|
+
getFacturasEmitidas(input: IssuedInvoicesQuery): Promise<IssuedInvoicesResult>;
|
|
39
|
+
/** @deprecated Use getReceivedInvoices. */
|
|
40
|
+
getFacturasRecibidas(input: ReceivedInvoicesQuery): Promise<ReceivedInvoicesResult>;
|
|
41
|
+
/** @deprecated Use getIssuedInvoiceXml. */
|
|
42
|
+
getXmlFacturaEmitida(input: IssuedInvoiceXmlQuery): Promise<InvoiceXmlResult>;
|
|
43
|
+
/** @deprecated Use getReceivedInvoiceXml. */
|
|
44
|
+
getXmlFacturaRecibida(input: ReceivedInvoiceXmlQuery): Promise<InvoiceXmlResult>;
|
|
45
|
+
/** @deprecated Use getIssuedDocumentXml. */
|
|
46
|
+
getXmlDocumentoEmitido(input: IssuedDocumentXmlQuery): Promise<IssuedDocumentXmlResult>;
|
|
47
|
+
/** @deprecated Use prepareInvoice. */
|
|
48
|
+
prepararFactura(input: InvoiceInput): Promise<PreparedDocument>;
|
|
49
|
+
/** @deprecated Use prepareCancellationCreditNote. */
|
|
50
|
+
prepararNotaCreditoAnulacion(input: {
|
|
51
|
+
factura: IssuedInvoiceXmlQuery;
|
|
52
|
+
issuedDate: string;
|
|
53
|
+
}): Promise<PreparedDocument>;
|
|
54
|
+
/** @deprecated Use signAndSend. */
|
|
55
|
+
firmarYEnviar(input: SignDocumentInput): Promise<SentDocument>;
|
|
58
56
|
}
|