facturas 0.6.0 → 0.7.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 +9 -2
- package/dist/chunk-C55KOV5N.mjs +1586 -0
- package/dist/chunk-C55KOV5N.mjs.map +1 -0
- package/dist/chunk-EDY3PNKJ.mjs +106 -0
- package/dist/chunk-EDY3PNKJ.mjs.map +1 -0
- package/dist/chunk-IOKZX6CA.mjs +195 -0
- package/dist/chunk-IOKZX6CA.mjs.map +1 -0
- package/dist/chunk-MBWOFO67.mjs +215 -0
- package/dist/chunk-MBWOFO67.mjs.map +1 -0
- package/dist/chunk-PKE4Z4GE.mjs +702 -0
- package/dist/chunk-PKE4Z4GE.mjs.map +1 -0
- package/dist/chunk-VVY2LZIZ.mjs +61 -0
- package/dist/chunk-VVY2LZIZ.mjs.map +1 -0
- package/dist/constants.d.ts +32 -2
- package/dist/constants.mjs +14 -29
- package/dist/constants.mjs.map +1 -1
- package/dist/errors.d.ts +2 -92
- package/dist/errors.mjs +14 -92
- package/dist/errors.mjs.map +1 -1
- package/dist/fiscal-evidence-BQuBbJ3h.d.ts +189 -0
- package/dist/{index-3fdgJ3c2.d.ts → index-CVpygFb0.d.ts} +1 -1
- package/dist/index.d.ts +15 -8
- package/dist/index.mjs +269 -1878
- package/dist/index.mjs.map +1 -1
- package/dist/padron.d.ts +2 -2
- package/dist/padron.mjs +4 -117
- package/dist/padron.mjs.map +1 -1
- package/dist/{types-Cup-oevW.d.ts → types-BXq0da71.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/wsfe.d.ts +48 -7
- package/dist/wsfe.mjs +10 -1007
- package/dist/wsfe.mjs.map +1 -1
- package/dist/wsmtxca.d.ts +3 -3
- package/dist/wsmtxca.mjs +5 -641
- package/dist/wsmtxca.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/fiscal-evidence-DbbFH74x.d.ts +0 -69
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { A as ArcaServiceName } from './types-BXq0da71.js';
|
|
2
|
+
|
|
3
|
+
/** Base error class for all ARCA-related errors. */
|
|
4
|
+
declare class ArcaError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
constructor(message: string, code?: string, options?: ErrorOptions);
|
|
8
|
+
}
|
|
9
|
+
/** Thrown when the ARCA client configuration is missing or invalid. */
|
|
10
|
+
declare class ArcaConfigurationError extends ArcaError {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
constructor(message: string, options?: ErrorOptions);
|
|
13
|
+
}
|
|
14
|
+
/** Stable routing codes for caller-provided input failures. */
|
|
15
|
+
type ArcaInputErrorCode = "ARCA_INPUT_INVALID_DATE" | "ARCA_INPUT_INVALID_AMOUNT" | "ARCA_INPUT_AMOUNT_PRECISION" | "ARCA_INPUT_AMOUNT_MISMATCH" | "ARCA_INPUT_INVALID_EXCHANGE_RATE" | "ARCA_INPUT_INVALID_VALUE" | "ARCA_INPUT_MISSING_FIELD" | "ARCA_INPUT_RESERVED_FIELD";
|
|
16
|
+
type ArcaInputErrorOptions = ErrorOptions & {
|
|
17
|
+
code: ArcaInputErrorCode;
|
|
18
|
+
field?: string;
|
|
19
|
+
expected?: string;
|
|
20
|
+
};
|
|
21
|
+
/** Thrown when caller-provided input data is missing or invalid. */
|
|
22
|
+
declare class ArcaInputError extends ArcaError {
|
|
23
|
+
readonly code: ArcaInputErrorCode;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly field?: string;
|
|
26
|
+
readonly expected?: string;
|
|
27
|
+
constructor(message: string, options: ArcaInputErrorOptions);
|
|
28
|
+
}
|
|
29
|
+
/** Stable reasons exposed for explicit ARCA authentication rejections. */
|
|
30
|
+
type ArcaAuthenticationReason = "invalid_token" | "unauthorized_computer" | "missing_relationship" | "authentication_rejected";
|
|
31
|
+
type ArcaAuthenticationErrorOptions = ErrorOptions & {
|
|
32
|
+
reason: ArcaAuthenticationReason;
|
|
33
|
+
service: ArcaServiceName;
|
|
34
|
+
operation: string;
|
|
35
|
+
providerCode?: string | number;
|
|
36
|
+
};
|
|
37
|
+
/** Thrown when ARCA explicitly rejects credentials before an operation runs. */
|
|
38
|
+
declare class ArcaAuthenticationError extends ArcaError {
|
|
39
|
+
readonly code: "ARCA_AUTHENTICATION_ERROR";
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly reason: ArcaAuthenticationReason;
|
|
42
|
+
readonly service: ArcaServiceName;
|
|
43
|
+
readonly operation: string;
|
|
44
|
+
readonly providerCode?: string | number;
|
|
45
|
+
constructor(message: string, options: ArcaAuthenticationErrorOptions);
|
|
46
|
+
}
|
|
47
|
+
/** Narrows unknown failures to the explicit authentication error contract. */
|
|
48
|
+
declare function isArcaAuthenticationError(error: unknown): error is ArcaAuthenticationError;
|
|
49
|
+
/** Thrown when an HTTP request to an ARCA endpoint fails at the transport level. */
|
|
50
|
+
declare class ArcaTransportError extends ArcaError {
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly statusCode?: number;
|
|
53
|
+
readonly contentType?: string;
|
|
54
|
+
readonly responseBodyLength?: number;
|
|
55
|
+
readonly responseBodyPreview?: string;
|
|
56
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
57
|
+
statusCode?: number;
|
|
58
|
+
contentType?: string;
|
|
59
|
+
responseBodyLength?: number;
|
|
60
|
+
responseBodyPreview?: string;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** Thrown when the SOAP response contains a Fault element. */
|
|
64
|
+
declare class ArcaSoapFaultError extends ArcaError {
|
|
65
|
+
readonly name: string;
|
|
66
|
+
readonly faultCode?: string;
|
|
67
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
68
|
+
faultCode?: string;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** Thrown when a response cannot be parsed as a valid SOAP envelope. */
|
|
72
|
+
declare class ArcaInvalidSoapResponseError extends ArcaError {
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly service?: ArcaServiceName;
|
|
75
|
+
readonly operation?: string;
|
|
76
|
+
readonly endpointUrl?: string;
|
|
77
|
+
readonly statusCode?: number;
|
|
78
|
+
readonly contentType?: string;
|
|
79
|
+
readonly responseBodyLength?: number;
|
|
80
|
+
readonly responseBodyPreview?: string;
|
|
81
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
82
|
+
service?: ArcaServiceName;
|
|
83
|
+
operation?: string;
|
|
84
|
+
endpointUrl?: string;
|
|
85
|
+
statusCode?: number;
|
|
86
|
+
contentType?: string;
|
|
87
|
+
responseBodyLength?: number;
|
|
88
|
+
responseBodyPreview?: string;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** Thrown when an ARCA service (WSFE, WSMTXCA, Padron) returns a domain-level error. */
|
|
92
|
+
declare class ArcaServiceError extends ArcaError {
|
|
93
|
+
readonly name: string;
|
|
94
|
+
readonly serviceCode?: string | number;
|
|
95
|
+
readonly service?: ArcaServiceName;
|
|
96
|
+
readonly operation?: string;
|
|
97
|
+
readonly result?: string;
|
|
98
|
+
readonly resultLevel?: ArcaFiscalResultLevel;
|
|
99
|
+
readonly results?: ArcaFiscalResults;
|
|
100
|
+
readonly cae?: string;
|
|
101
|
+
readonly issues?: readonly ArcaFiscalIssue[];
|
|
102
|
+
constructor(message: string, options?: ErrorOptions & {
|
|
103
|
+
serviceCode?: string | number;
|
|
104
|
+
service?: ArcaServiceName;
|
|
105
|
+
operation?: string;
|
|
106
|
+
result?: string;
|
|
107
|
+
resultLevel?: ArcaFiscalResultLevel;
|
|
108
|
+
results?: ArcaFiscalResults;
|
|
109
|
+
cae?: string;
|
|
110
|
+
issues?: readonly ArcaFiscalIssue[];
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** ARCA services that authorize fiscal vouchers. */
|
|
115
|
+
type ArcaFiscalService = "wsfe" | "wsmtxca";
|
|
116
|
+
/** Location of a structured authorization result in the service response. */
|
|
117
|
+
type ArcaFiscalResultLevel = "header" | "detail" | "operation";
|
|
118
|
+
/** Every structured result field exposed by one provider response. */
|
|
119
|
+
type ArcaFiscalResults = {
|
|
120
|
+
header?: string;
|
|
121
|
+
detail?: string;
|
|
122
|
+
operation?: string;
|
|
123
|
+
};
|
|
124
|
+
/** Source and meaning of one provider issue. */
|
|
125
|
+
type ArcaFiscalIssue = {
|
|
126
|
+
service: ArcaFiscalService;
|
|
127
|
+
operation: string;
|
|
128
|
+
source: "error" | "observation";
|
|
129
|
+
category: "business" | "infrastructure" | "observation" | "unknown";
|
|
130
|
+
code?: string;
|
|
131
|
+
message: string;
|
|
132
|
+
resultLevel?: ArcaFiscalResultLevel;
|
|
133
|
+
};
|
|
134
|
+
/** Why an authorization response cannot prove approval or rejection. */
|
|
135
|
+
type ArcaAuthorizationIndeterminateReason = "authentication_rejected" | "transport_error" | "soap_fault" | "invalid_response" | "incomplete_response" | "contradictory_response" | "unexpected_error";
|
|
136
|
+
/** Safe authentication evidence attached to an exact authorization outcome. */
|
|
137
|
+
type ArcaAuthenticationEvidence = {
|
|
138
|
+
code: "ARCA_AUTHENTICATION_ERROR";
|
|
139
|
+
reason: ArcaAuthenticationReason;
|
|
140
|
+
providerCode?: string | number;
|
|
141
|
+
};
|
|
142
|
+
type ArcaAuthorizationEvidenceBase<TService extends ArcaFiscalService = ArcaFiscalService> = {
|
|
143
|
+
service: TService;
|
|
144
|
+
operation: string;
|
|
145
|
+
results: ArcaFiscalResults;
|
|
146
|
+
errors: ArcaFiscalIssue[];
|
|
147
|
+
observations: ArcaFiscalIssue[];
|
|
148
|
+
raw?: Record<string, unknown>;
|
|
149
|
+
};
|
|
150
|
+
/** Structured evidence returned by one exact voucher authorization attempt. */
|
|
151
|
+
type ArcaAuthorizationOutcome<TService extends ArcaFiscalService = ArcaFiscalService> = (ArcaAuthorizationEvidenceBase<TService> & {
|
|
152
|
+
kind: "authorized";
|
|
153
|
+
result: "A" | "O";
|
|
154
|
+
resultLevel: ArcaFiscalResultLevel;
|
|
155
|
+
cae: string;
|
|
156
|
+
caeExpiry?: string;
|
|
157
|
+
voucherNumber: number;
|
|
158
|
+
}) | (ArcaAuthorizationEvidenceBase<TService> & {
|
|
159
|
+
kind: "rejected";
|
|
160
|
+
result: "R";
|
|
161
|
+
resultLevel: ArcaFiscalResultLevel;
|
|
162
|
+
}) | (ArcaAuthorizationEvidenceBase<TService> & {
|
|
163
|
+
kind: "indeterminate";
|
|
164
|
+
reason: ArcaAuthorizationIndeterminateReason;
|
|
165
|
+
authentication?: ArcaAuthenticationEvidence;
|
|
166
|
+
result?: string;
|
|
167
|
+
resultLevel?: ArcaFiscalResultLevel;
|
|
168
|
+
cae?: string;
|
|
169
|
+
caeExpiry?: string;
|
|
170
|
+
voucherNumber?: number;
|
|
171
|
+
});
|
|
172
|
+
/** Structured result of consulting one exact voucher number. */
|
|
173
|
+
type ArcaVoucherLookupResult<TVoucher, TService extends ArcaFiscalService = ArcaFiscalService> = {
|
|
174
|
+
kind: "found";
|
|
175
|
+
service: TService;
|
|
176
|
+
operation: string;
|
|
177
|
+
voucher: TVoucher;
|
|
178
|
+
observations: ArcaFiscalIssue[];
|
|
179
|
+
raw: Record<string, unknown>;
|
|
180
|
+
} | {
|
|
181
|
+
kind: "not_found";
|
|
182
|
+
service: TService;
|
|
183
|
+
operation: string;
|
|
184
|
+
errors: ArcaFiscalIssue[];
|
|
185
|
+
observations: ArcaFiscalIssue[];
|
|
186
|
+
raw: Record<string, unknown>;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export { ArcaAuthenticationError as A, type ArcaAuthenticationErrorOptions as a, type ArcaAuthenticationEvidence as b, type ArcaAuthenticationReason as c, type ArcaAuthorizationIndeterminateReason as d, type ArcaAuthorizationOutcome as e, ArcaConfigurationError as f, ArcaError as g, type ArcaFiscalIssue as h, type ArcaFiscalResultLevel as i, type ArcaFiscalResults as j, type ArcaFiscalService as k, ArcaInputError as l, type ArcaInputErrorCode as m, type ArcaInputErrorOptions as n, ArcaInvalidSoapResponseError as o, ArcaServiceError as p, ArcaSoapFaultError as q, ArcaTransportError as r, type ArcaVoucherLookupResult as s, isArcaAuthenticationError as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ArcaSoapExecutionOptions, b as ArcaSoapResponse, c as ArcaWsaaServiceId, d as ArcaAuthOptions, e as ArcaAuthCredentials } from './types-
|
|
1
|
+
import { a as ArcaSoapExecutionOptions, b as ArcaSoapResponse, c as ArcaWsaaServiceId, d as ArcaAuthOptions, e as ArcaAuthCredentials } from './types-BXq0da71.js';
|
|
2
2
|
|
|
3
3
|
type SoapTransport = {
|
|
4
4
|
execute<TBody, TResult>(request: ArcaSoapExecutionOptions<TBody>): Promise<ArcaSoapResponse<TResult>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
export { e as ArcaAuthCredentials, d as ArcaAuthOptions, i as ArcaLogLevel, j as ArcaLoggerConfig, k as ArcaPadronServiceName, l as ArcaRepresentedTaxId, A as ArcaServiceName, m as ArcaServiceTarget, c as ArcaWsaaServiceId, n as ArcaWsaaSessionKey } from './types-
|
|
1
|
+
import { f as ArcaEnvironment, g as ArcaClientConfig, h as ArcaWsaaSessionStore } from './types-BXq0da71.js';
|
|
2
|
+
export { e as ArcaAuthCredentials, d as ArcaAuthOptions, i as ArcaLogLevel, j as ArcaLoggerConfig, k as ArcaPadronServiceName, l as ArcaRepresentedTaxId, A as ArcaServiceName, m as ArcaServiceTarget, c as ArcaWsaaServiceId, n as ArcaWsaaSessionKey } from './types-BXq0da71.js';
|
|
3
3
|
import { PadronService } from './padron.js';
|
|
4
4
|
export { CreatePadronServiceOptions, PadronTaxIdLookupResult, PadronTaxpayerResult, createPadronService } from './padron.js';
|
|
5
5
|
import { WsfeService } from './wsfe.js';
|
|
6
|
-
export { CreateWsfeServiceOptions, WsfeActivity, WsfeActivityType, WsfeAssociatedPeriod, WsfeAssociatedVoucher, WsfeAuthorizationOutcome, WsfeAuthorizationResult, WsfeAuthorizeVoucherInput, WsfeBuyer, WsfeCatalogEntry, WsfeCurrencyType, WsfeDateInput, WsfeOptionalField, WsfeQuotation, WsfeReceiverVatCondition, WsfeSalesPoint, WsfeServerStatus, WsfeTax, WsfeVatRate, WsfeVoucherInfo, WsfeVoucherInput, WsfeVoucherLookupResult, createWsfeService } from './wsfe.js';
|
|
6
|
+
export { BuildFacturaBInput, BuildFacturaCInput, CreateWsfeServiceOptions, WsfeActivity, WsfeActivityType, WsfeAssociatedPeriod, WsfeAssociatedVoucher, WsfeAuthorizationOutcome, WsfeAuthorizationResult, WsfeAuthorizeVoucherInput, WsfeBuilderCurrencyInput, WsfeBuilderVatRate, WsfeBuyer, WsfeCatalogEntry, WsfeCurrencyType, WsfeDateInput, WsfeOptionalField, WsfeQuotation, WsfeReceiverVatCondition, WsfeSalesPoint, WsfeServerStatus, WsfeTax, WsfeVatRate, WsfeVoucherInfo, WsfeVoucherInput, WsfeVoucherLookupResult, buildFacturaB, buildFacturaC, createWsfeService } from './wsfe.js';
|
|
7
7
|
import { WsmtxcaService } from './wsmtxca.js';
|
|
8
8
|
export { CreateWsmtxcaServiceOptions, WsmtxcaAuthorizationOutcome, WsmtxcaAuthorizationResult, WsmtxcaAuthorizeVoucherInput, WsmtxcaLastAuthorizedVoucherResult, WsmtxcaSalesPoint, WsmtxcaSalesPointsResult, WsmtxcaVoucherInfo, WsmtxcaVoucherLookupOutcome, WsmtxcaVoucherLookupResult, createWsmtxcaService } from './wsmtxca.js';
|
|
9
|
-
export { ArcaConfigurationError, ArcaError, ArcaInputError, ArcaInvalidSoapResponseError, ArcaServiceError, ArcaSoapFaultError, ArcaTransportError } from './
|
|
10
|
-
|
|
11
|
-
import './index-3fdgJ3c2.js';
|
|
9
|
+
export { A as ArcaAuthenticationError, a as ArcaAuthenticationErrorOptions, b as ArcaAuthenticationEvidence, c as ArcaAuthenticationReason, d as ArcaAuthorizationIndeterminateReason, e as ArcaAuthorizationOutcome, f as ArcaConfigurationError, g as ArcaError, h as ArcaFiscalIssue, i as ArcaFiscalResultLevel, j as ArcaFiscalResults, k as ArcaFiscalService, l as ArcaInputError, m as ArcaInputErrorCode, n as ArcaInputErrorOptions, o as ArcaInvalidSoapResponseError, p as ArcaServiceError, q as ArcaSoapFaultError, r as ArcaTransportError, s as ArcaVoucherLookupResult, t as isArcaAuthenticationError } from './fiscal-evidence-BQuBbJ3h.js';
|
|
10
|
+
import './index-CVpygFb0.js';
|
|
12
11
|
|
|
12
|
+
/** Immutable, credential-free operational view of an ARCA client configuration. */
|
|
13
|
+
type ArcaClientConfigView = Readonly<{
|
|
14
|
+
taxId: string;
|
|
15
|
+
environment: ArcaEnvironment;
|
|
16
|
+
timeout?: number;
|
|
17
|
+
retries?: number;
|
|
18
|
+
retryDelay?: number;
|
|
19
|
+
}>;
|
|
13
20
|
/** Fully wired ARCA client with access to all service modules. */
|
|
14
21
|
type ArcaClient = {
|
|
15
|
-
config:
|
|
22
|
+
readonly config: ArcaClientConfigView;
|
|
16
23
|
wsfe: WsfeService;
|
|
17
24
|
wsmtxca: WsmtxcaService;
|
|
18
25
|
padron: PadronService;
|
|
@@ -60,4 +67,4 @@ declare function assertArcaClientConfig(config: ArcaClientConfig): void;
|
|
|
60
67
|
|
|
61
68
|
declare function createMemoryWsaaSessionStore(): ArcaWsaaSessionStore;
|
|
62
69
|
|
|
63
|
-
export { ARCA_ENVIRONMENTS, ARCA_ENV_VARIABLES, type ArcaClient, ArcaClientConfig, ArcaEnvironment, ArcaWsaaSessionStore, type CreateArcaClientConfigFromEnvOptions, PadronService, WsfeService, WsmtxcaService, assertArcaClientConfig, createArcaClient, createArcaClientConfigFromEnv, createMemoryWsaaSessionStore, resolveArcaEnvironment };
|
|
70
|
+
export { ARCA_ENVIRONMENTS, ARCA_ENV_VARIABLES, type ArcaClient, ArcaClientConfig, type ArcaClientConfigView, ArcaEnvironment, ArcaWsaaSessionStore, type CreateArcaClientConfigFromEnvOptions, PadronService, WsfeService, WsmtxcaService, assertArcaClientConfig, createArcaClient, createArcaClientConfigFromEnv, createMemoryWsaaSessionStore, resolveArcaEnvironment };
|