facturas 0.7.1 → 0.8.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 +16 -4
- package/dist/chunk-76WU5BVI.mjs +109 -0
- package/dist/chunk-76WU5BVI.mjs.map +1 -0
- package/dist/{chunk-MBWOFO67.mjs → chunk-HUT3PFKF.mjs} +14 -2
- package/dist/{chunk-MBWOFO67.mjs.map → chunk-HUT3PFKF.mjs.map} +1 -1
- package/dist/{chunk-EDY3PNKJ.mjs → chunk-NUV5RZPZ.mjs} +2 -2
- package/dist/{chunk-IOKZX6CA.mjs → chunk-PPYGVNFA.mjs} +2 -2
- package/dist/{chunk-OHHXHYLV.mjs → chunk-TOVSOJ3G.mjs} +222 -45
- package/dist/chunk-TOVSOJ3G.mjs.map +1 -0
- package/dist/{chunk-A3C3Y5PI.mjs → chunk-ZX4OOCML.mjs} +3 -3
- package/dist/constants.d.ts +49 -1
- package/dist/constants.mjs +9 -1
- package/dist/{fiscal-evidence-BQuBbJ3h.d.ts → errors-B0uouRzR.d.ts} +82 -74
- package/dist/errors.d.ts +1 -1
- package/dist/errors.mjs +5 -3
- package/dist/index.d.ts +199 -5
- package/dist/index.mjs +712 -10
- package/dist/index.mjs.map +1 -1
- package/dist/padron.mjs +2 -2
- package/dist/wsfe-CG_erq7V.d.ts +314 -0
- package/dist/wsfe.d.ts +4 -309
- package/dist/wsfe.mjs +4 -4
- package/dist/wsmtxca.d.ts +1 -1
- package/dist/wsmtxca.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-OHHXHYLV.mjs.map +0 -1
- package/dist/chunk-VVY2LZIZ.mjs +0 -61
- package/dist/chunk-VVY2LZIZ.mjs.map +0 -1
- /package/dist/{chunk-EDY3PNKJ.mjs.map → chunk-NUV5RZPZ.mjs.map} +0 -0
- /package/dist/{chunk-IOKZX6CA.mjs.map → chunk-PPYGVNFA.mjs.map} +0 -0
- /package/dist/{chunk-A3C3Y5PI.mjs.map → chunk-ZX4OOCML.mjs.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,206 @@ import { f as ArcaEnvironment, g as ArcaClientConfig, h as ArcaWsaaSessionStore
|
|
|
2
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
|
-
import {
|
|
6
|
-
export {
|
|
5
|
+
import { VoucherClass, ReceiverCondition } from './constants.js';
|
|
6
|
+
export { ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS, ARCA_INVOICE_CLASS_BY_ISSUER, ARCA_ISSUER_CONDITION_IDS, ARCA_RECEIVER_CONDITION_IDS, IssuerCondition } from './constants.js';
|
|
7
|
+
import { A as ArcaAuthorizationOutcome, a as ArcaFiscalIssue, b as ArcaSafeErrorMetadata } from './errors-B0uouRzR.js';
|
|
8
|
+
export { c as ArcaAuthenticationError, d as ArcaAuthenticationErrorOptions, e as ArcaAuthenticationEvidence, f as ArcaAuthenticationReason, g as ArcaAuthorizationIndeterminateReason, h as ArcaConfigurationError, i as ArcaError, j as ArcaFiscalResultLevel, k as ArcaFiscalResults, l as ArcaFiscalService, m as ArcaInputError, n as ArcaInputErrorCode, o as ArcaInputErrorOptions, p as ArcaInvalidSoapResponseError, q as ArcaServiceError, r as ArcaSoapFaultError, s as ArcaTransportError, t as ArcaVoucherLookupResult, u as isArcaAuthenticationError, v as toArcaSafeErrorMetadata } from './errors-B0uouRzR.js';
|
|
9
|
+
import { S as SupportedVatRate, W as WsfeVoucherInput, a as WsfeVoucherInfo, b as WsfeDateInput, c as WsfeService } from './wsfe-CG_erq7V.js';
|
|
10
|
+
export { B as BuildFacturaBInput, d as BuildFacturaCInput, C as CreateWsfeServiceOptions, e as WsfeActivity, f as WsfeActivityType, g as WsfeAssociatedPeriod, h as WsfeAssociatedVoucher, i as WsfeAuthorizationOutcome, j as WsfeAuthorizationResult, k as WsfeAuthorizeVoucherInput, l as WsfeBuilderCurrencyInput, m as WsfeBuilderVatRate, n as WsfeBuyer, o as WsfeCatalogEntry, p as WsfeCurrencyType, q as WsfeOptionalField, r as WsfeQuotation, s as WsfeReceiverVatCondition, t as WsfeSalesPoint, u as WsfeServerStatus, v as WsfeTax, w as WsfeVatRate, x as WsfeVoucherLookupResult, y as buildFacturaB, z as buildFacturaC, A as createWsfeService } from './wsfe-CG_erq7V.js';
|
|
7
11
|
import { WsmtxcaService } from './wsmtxca.js';
|
|
8
12
|
export { CreateWsmtxcaServiceOptions, WsmtxcaAuthorizationOutcome, WsmtxcaAuthorizationResult, WsmtxcaAuthorizeVoucherInput, WsmtxcaLastAuthorizedVoucherResult, WsmtxcaSalesPoint, WsmtxcaSalesPointsResult, WsmtxcaVoucherInfo, WsmtxcaVoucherLookupOutcome, WsmtxcaVoucherLookupResult, createWsmtxcaService } from './wsmtxca.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
13
|
import './index-CVpygFb0.js';
|
|
11
14
|
|
|
15
|
+
type VatRate = SupportedVatRate | "exempt" | "untaxed";
|
|
16
|
+
type VatItem = {
|
|
17
|
+
net: number;
|
|
18
|
+
gross?: never;
|
|
19
|
+
amount?: never;
|
|
20
|
+
vat: VatRate;
|
|
21
|
+
} | {
|
|
22
|
+
gross: number;
|
|
23
|
+
net?: never;
|
|
24
|
+
amount?: never;
|
|
25
|
+
vat: VatRate;
|
|
26
|
+
};
|
|
27
|
+
type AmountItem = {
|
|
28
|
+
amount: number;
|
|
29
|
+
vat?: never;
|
|
30
|
+
net?: never;
|
|
31
|
+
gross?: never;
|
|
32
|
+
};
|
|
33
|
+
type IssueAmounts = {
|
|
34
|
+
computedTotal: number;
|
|
35
|
+
sentTotal: number;
|
|
36
|
+
vatAdjustment: number;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type VoucherCoordinates = {
|
|
40
|
+
salesPoint: number;
|
|
41
|
+
voucherType: number;
|
|
42
|
+
number: number;
|
|
43
|
+
};
|
|
44
|
+
/** Raw-free consultation evidence. Missing provider fields remain absent. */
|
|
45
|
+
type VoucherSummary = {
|
|
46
|
+
number: number;
|
|
47
|
+
salesPoint?: number;
|
|
48
|
+
voucherType?: number;
|
|
49
|
+
date?: string;
|
|
50
|
+
concept?: number;
|
|
51
|
+
documentType?: number;
|
|
52
|
+
documentNumber?: string;
|
|
53
|
+
receiverVatConditionId?: number;
|
|
54
|
+
currencyId?: string;
|
|
55
|
+
exchangeRate?: number;
|
|
56
|
+
totalAmount?: number;
|
|
57
|
+
netAmount?: number;
|
|
58
|
+
vatAmount?: number;
|
|
59
|
+
exemptAmount?: number;
|
|
60
|
+
nonTaxableAmount?: number;
|
|
61
|
+
taxAmount?: number;
|
|
62
|
+
vatRates?: {
|
|
63
|
+
id: number;
|
|
64
|
+
baseAmount: number;
|
|
65
|
+
amount: number;
|
|
66
|
+
}[];
|
|
67
|
+
serviceStartDate?: string;
|
|
68
|
+
serviceEndDate?: string;
|
|
69
|
+
paymentDueDate?: string;
|
|
70
|
+
result?: string;
|
|
71
|
+
cae?: string;
|
|
72
|
+
caeExpiry?: string;
|
|
73
|
+
};
|
|
74
|
+
type WsfeIdentityMatch = {
|
|
75
|
+
matches: true;
|
|
76
|
+
} | {
|
|
77
|
+
matches: false;
|
|
78
|
+
evidence: "conflict" | "incomplete";
|
|
79
|
+
reason: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Compares the invoice subset supported by vouchers.issue(). This proves
|
|
83
|
+
* consistency, not authorship; callers must serialize writers per taxpayer,
|
|
84
|
+
* sales point and voucher type. Unsupported exact-API extensions are incomplete.
|
|
85
|
+
*/
|
|
86
|
+
declare function matchWsfeVoucherIdentity(sent: WsfeVoucherInput, number: number, found: WsfeVoucherInfo): WsfeIdentityMatch;
|
|
87
|
+
|
|
88
|
+
type IssueOptions = {
|
|
89
|
+
representedTaxId?: number | string;
|
|
90
|
+
forceRefresh?: boolean;
|
|
91
|
+
include?: {
|
|
92
|
+
raw?: boolean;
|
|
93
|
+
exactInput?: boolean;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
type IssuedVoucher = VoucherCoordinates & {
|
|
97
|
+
voucherClass: VoucherClass;
|
|
98
|
+
date: string;
|
|
99
|
+
cae: string;
|
|
100
|
+
caeExpiry: string;
|
|
101
|
+
amounts: IssueAmounts;
|
|
102
|
+
};
|
|
103
|
+
type WithRaw<T, O extends IssueOptions> = T & (true extends NonNullable<O["include"]>["raw"] ? {
|
|
104
|
+
raw?: Record<string, unknown>;
|
|
105
|
+
} : unknown);
|
|
106
|
+
type WithSent<O extends IssueOptions> = O extends {
|
|
107
|
+
include: {
|
|
108
|
+
exactInput: true;
|
|
109
|
+
};
|
|
110
|
+
} ? {
|
|
111
|
+
sent: WsfeVoucherInput;
|
|
112
|
+
} : true extends NonNullable<O["include"]>["exactInput"] ? {
|
|
113
|
+
sent?: WsfeVoucherInput;
|
|
114
|
+
} : unknown;
|
|
115
|
+
type Evidence<K extends ArcaAuthorizationOutcome<"wsfe">["kind"], O extends IssueOptions> = WithRaw<Omit<Extract<ArcaAuthorizationOutcome<"wsfe">, {
|
|
116
|
+
kind: K;
|
|
117
|
+
}>, "raw">, O>;
|
|
118
|
+
/** Fiscal outcomes are returned, never thrown or automatically resubmitted. */
|
|
119
|
+
type IssueOutcome<O extends IssueOptions = {
|
|
120
|
+
include?: never;
|
|
121
|
+
}> = ({
|
|
122
|
+
kind: "authorized";
|
|
123
|
+
recoveredByMatch: false;
|
|
124
|
+
voucher: IssuedVoucher;
|
|
125
|
+
authorization: Evidence<"authorized", O>;
|
|
126
|
+
} & WithSent<O>) | ({
|
|
127
|
+
kind: "authorized";
|
|
128
|
+
recoveredByMatch: true;
|
|
129
|
+
voucher: IssuedVoucher;
|
|
130
|
+
attempt: Evidence<"indeterminate", O>;
|
|
131
|
+
lookup: WithRaw<VoucherSummary, O>;
|
|
132
|
+
} & WithSent<O>) | {
|
|
133
|
+
kind: "rejected";
|
|
134
|
+
attempted: VoucherCoordinates;
|
|
135
|
+
issues: ArcaFiscalIssue[];
|
|
136
|
+
authorization: Evidence<"rejected", O>;
|
|
137
|
+
} | {
|
|
138
|
+
kind: "indeterminate";
|
|
139
|
+
attempted: VoucherCoordinates;
|
|
140
|
+
attempt: Evidence<"indeterminate", O>;
|
|
141
|
+
lookup: WithRaw<{
|
|
142
|
+
kind: "not_found";
|
|
143
|
+
}, O> | WithRaw<{
|
|
144
|
+
kind: "incomplete";
|
|
145
|
+
reason: string;
|
|
146
|
+
}, O> | {
|
|
147
|
+
kind: "failed";
|
|
148
|
+
error: ArcaSafeErrorMetadata;
|
|
149
|
+
};
|
|
150
|
+
} | {
|
|
151
|
+
kind: "conflict";
|
|
152
|
+
attempted: VoucherCoordinates;
|
|
153
|
+
attempt: Evidence<"indeterminate", O>;
|
|
154
|
+
found: WithRaw<VoucherSummary, O>;
|
|
155
|
+
reason: string;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
type Receiver = {
|
|
159
|
+
condition: "consumidor_final";
|
|
160
|
+
cuit?: number | string;
|
|
161
|
+
dni?: number | string;
|
|
162
|
+
} | {
|
|
163
|
+
condition: Exclude<ReceiverCondition, "consumidor_final">;
|
|
164
|
+
cuit: number | string;
|
|
165
|
+
dni?: never;
|
|
166
|
+
};
|
|
167
|
+
type IssueCommon = {
|
|
168
|
+
salesPoint: number;
|
|
169
|
+
to: Receiver;
|
|
170
|
+
total?: number;
|
|
171
|
+
date?: WsfeDateInput;
|
|
172
|
+
currency?: "ARS" | "USD";
|
|
173
|
+
exchangeRate?: string;
|
|
174
|
+
service?: {
|
|
175
|
+
from: WsfeDateInput;
|
|
176
|
+
to: WsfeDateInput;
|
|
177
|
+
dueDate: WsfeDateInput;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
type IssueInput = IssueCommon & ({
|
|
181
|
+
issuer: "responsable_inscripto";
|
|
182
|
+
items: readonly VatItem[];
|
|
183
|
+
} | {
|
|
184
|
+
issuer: "monotributo" | "exento" | "no_alcanzado";
|
|
185
|
+
items: readonly AmountItem[];
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
type VouchersService = {
|
|
189
|
+
/**
|
|
190
|
+
* Single-writer contract: serialize calls per (representedTaxId, salesPoint,
|
|
191
|
+
* voucherType), including concurrent promises in one process. The SDK does not
|
|
192
|
+
* coordinate writers; uncoordinated calls collide on ARCA 10016. Servers and
|
|
193
|
+
* queues must persist attempts and use wsfe.authorizeVoucherOutcome() directly.
|
|
194
|
+
* See the "does not serialize concurrent calls" test in services/vouchers.test.ts.
|
|
195
|
+
*
|
|
196
|
+
* One next-number read, one authorization attempt (zero transport retries), and
|
|
197
|
+
* at most one identity-matched lookup after indeterminate. Never resubmits.
|
|
198
|
+
* Local validation and next-number read failures throw before authorization.
|
|
199
|
+
*/
|
|
200
|
+
issue<O extends IssueOptions = {
|
|
201
|
+
include?: never;
|
|
202
|
+
}>(input: IssueInput, options?: O): Promise<IssueOutcome<O>>;
|
|
203
|
+
};
|
|
204
|
+
|
|
12
205
|
/** Immutable, credential-free operational view of an ARCA client configuration. */
|
|
13
206
|
type ArcaClientConfigView = Readonly<{
|
|
14
207
|
taxId: string;
|
|
@@ -21,13 +214,14 @@ type ArcaClientConfigView = Readonly<{
|
|
|
21
214
|
type ArcaClient = {
|
|
22
215
|
readonly config: ArcaClientConfigView;
|
|
23
216
|
wsfe: WsfeService;
|
|
217
|
+
vouchers: VouchersService;
|
|
24
218
|
wsmtxca: WsmtxcaService;
|
|
25
219
|
padron: PadronService;
|
|
26
220
|
};
|
|
27
221
|
/**
|
|
28
222
|
* Creates an ARCA client from the given configuration.
|
|
29
223
|
* Validates the config, wires WSAA authentication and SOAP transport,
|
|
30
|
-
* and returns an object with `.wsfe`, `.wsmtxca`, and `.padron` service modules.
|
|
224
|
+
* and returns an object with `.vouchers`, `.wsfe`, `.wsmtxca`, and `.padron` service modules.
|
|
31
225
|
*
|
|
32
226
|
* @throws {ArcaConfigurationError} When the config is missing or invalid.
|
|
33
227
|
*/
|
|
@@ -67,4 +261,4 @@ declare function assertArcaClientConfig(config: ArcaClientConfig): void;
|
|
|
67
261
|
|
|
68
262
|
declare function createMemoryWsaaSessionStore(): ArcaWsaaSessionStore;
|
|
69
263
|
|
|
70
|
-
export { ARCA_ENVIRONMENTS, ARCA_ENV_VARIABLES, type ArcaClient, ArcaClientConfig, type ArcaClientConfigView, ArcaEnvironment, ArcaWsaaSessionStore, type CreateArcaClientConfigFromEnvOptions, PadronService, WsfeService, WsmtxcaService, assertArcaClientConfig, createArcaClient, createArcaClientConfigFromEnv, createMemoryWsaaSessionStore, resolveArcaEnvironment };
|
|
264
|
+
export { ARCA_ENVIRONMENTS, ARCA_ENV_VARIABLES, type AmountItem, ArcaAuthorizationOutcome, type ArcaClient, ArcaClientConfig, type ArcaClientConfigView, ArcaEnvironment, ArcaFiscalIssue, ArcaSafeErrorMetadata, ArcaWsaaSessionStore, type CreateArcaClientConfigFromEnvOptions, type IssueAmounts, type IssueCommon, type IssueInput, type IssueOptions, type IssueOutcome, type IssuedVoucher, PadronService, type Receiver, ReceiverCondition, type VatItem, type VatRate, VoucherClass, type VoucherCoordinates, type VoucherSummary, type VouchersService, WsfeDateInput, type WsfeIdentityMatch, WsfeService, WsfeVoucherInfo, WsfeVoucherInput, WsmtxcaService, assertArcaClientConfig, createArcaClient, createArcaClientConfigFromEnv, createMemoryWsaaSessionStore, matchWsfeVoucherIdentity, resolveArcaEnvironment };
|