facturas 0.18.0 → 0.20.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/dist/{chunk-WPHD2GQJ.mjs → chunk-B2M64SIK.mjs} +2 -2
- package/dist/{chunk-DHN6OQJP.mjs → chunk-C2KX652X.mjs} +17 -1
- package/dist/chunk-C2KX652X.mjs.map +1 -0
- package/dist/{chunk-MRBFLBWX.mjs → chunk-JP3LVU7K.mjs} +2 -2
- package/dist/{chunk-EZ4HA3LC.mjs → chunk-NT2A6YMO.mjs} +9 -2
- package/dist/chunk-NT2A6YMO.mjs.map +1 -0
- package/dist/{chunk-JP5IBMVI.mjs → chunk-T5N62FRZ.mjs} +2698 -2469
- package/dist/chunk-T5N62FRZ.mjs.map +1 -0
- package/dist/{chunk-4RD5VQWC.mjs → chunk-TMSP5QPZ.mjs} +3 -3
- package/dist/{chunk-OORNZFI5.mjs → chunk-TXFYTMO4.mjs} +3 -3
- package/dist/cli.d.ts +2 -2
- package/dist/cli.mjs +7 -7
- package/dist/{client-COK5u3oz.d.ts → client-BIkLOgBA.d.ts} +94 -12
- package/dist/constants.d.ts +25 -1
- package/dist/constants.mjs +3 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/{fiscal-evidence-B6UTFGmY.d.ts → fiscal-evidence-Bg4o9nxt.d.ts} +16 -3
- package/dist/index.d.ts +4 -50
- package/dist/index.mjs +15 -9
- package/dist/index.mjs.map +1 -1
- package/dist/padron.mjs +2 -2
- package/dist/wsfe.d.ts +1 -1
- package/dist/wsfe.mjs +3 -3
- package/dist/wsmtxca.d.ts +1 -1
- package/dist/wsmtxca.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-DHN6OQJP.mjs.map +0 -1
- package/dist/chunk-EZ4HA3LC.mjs.map +0 -1
- package/dist/chunk-JP5IBMVI.mjs.map +0 -1
- /package/dist/{chunk-WPHD2GQJ.mjs.map → chunk-B2M64SIK.mjs.map} +0 -0
- /package/dist/{chunk-MRBFLBWX.mjs.map → chunk-JP3LVU7K.mjs.map} +0 -0
- /package/dist/{chunk-4RD5VQWC.mjs.map → chunk-TMSP5QPZ.mjs.map} +0 -0
- /package/dist/{chunk-OORNZFI5.mjs.map → chunk-TXFYTMO4.mjs.map} +0 -0
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
classifyArcaAuthenticationIssues,
|
|
4
4
|
createArcaAuthenticationEvidence,
|
|
5
5
|
executeWithAuthenticationRecovery
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-B2M64SIK.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ArcaInputError,
|
|
9
9
|
ArcaInvalidSoapResponseError,
|
|
10
10
|
ArcaServiceError,
|
|
11
11
|
ArcaSoapFaultError,
|
|
12
12
|
ArcaTransportError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NT2A6YMO.mjs";
|
|
14
14
|
|
|
15
15
|
// src/services/wsmtxca.ts
|
|
16
16
|
function createWsmtxcaService(options) {
|
|
@@ -631,4 +631,4 @@ function formatCompactDateToIso(dateValue) {
|
|
|
631
631
|
export {
|
|
632
632
|
createWsmtxcaService
|
|
633
633
|
};
|
|
634
|
-
//# sourceMappingURL=chunk-
|
|
634
|
+
//# sourceMappingURL=chunk-TMSP5QPZ.mjs.map
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
classifyArcaAuthenticationIssues,
|
|
4
4
|
createArcaAuthenticationEvidence,
|
|
5
5
|
executeWithAuthenticationRecovery
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-B2M64SIK.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ArcaInputError,
|
|
9
9
|
ArcaInvalidSoapResponseError,
|
|
10
10
|
ArcaServiceError,
|
|
11
11
|
ArcaSoapFaultError,
|
|
12
12
|
ArcaTransportError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NT2A6YMO.mjs";
|
|
14
14
|
|
|
15
15
|
// src/internal/dates.ts
|
|
16
16
|
function toIsoDate(value) {
|
|
@@ -1461,4 +1461,4 @@ export {
|
|
|
1461
1461
|
normalizeWsfeVoucherInput,
|
|
1462
1462
|
normalizeWsfeDateInput
|
|
1463
1463
|
};
|
|
1464
|
-
//# sourceMappingURL=chunk-
|
|
1464
|
+
//# sourceMappingURL=chunk-TXFYTMO4.mjs.map
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as ArcaClient } from './client-
|
|
1
|
+
import { A as ArcaClient } from './client-BIkLOgBA.js';
|
|
2
2
|
import { A as ArcaClientOptions, a as ArcaClientConfig } from './types-Su7QwloQ.js';
|
|
3
3
|
import { W as WsaaAuthModule } from './index-DAC3edtw.js';
|
|
4
4
|
import './padron.js';
|
|
5
5
|
import './constants.js';
|
|
6
|
-
import './fiscal-evidence-
|
|
6
|
+
import './fiscal-evidence-Bg4o9nxt.js';
|
|
7
7
|
import './wsfe.js';
|
|
8
8
|
import './wsmtxca.js';
|
|
9
9
|
|
package/dist/cli.mjs
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
createWsaaAuthModule,
|
|
8
8
|
createWsaaStoreAdapter,
|
|
9
9
|
discoverArcaClientConfig
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-T5N62FRZ.mjs";
|
|
11
|
+
import "./chunk-C2KX652X.mjs";
|
|
12
|
+
import "./chunk-JP3LVU7K.mjs";
|
|
13
|
+
import "./chunk-TXFYTMO4.mjs";
|
|
14
|
+
import "./chunk-TMSP5QPZ.mjs";
|
|
15
|
+
import "./chunk-B2M64SIK.mjs";
|
|
16
16
|
import {
|
|
17
17
|
ArcaConfigurationError,
|
|
18
18
|
ArcaServiceError,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
ArcaTransportError,
|
|
21
21
|
isArcaAuthenticationError,
|
|
22
22
|
toArcaSafeErrorMetadata
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-NT2A6YMO.mjs";
|
|
24
24
|
|
|
25
25
|
// src/cli/main.ts
|
|
26
26
|
import { tmpdir } from "os";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { h as ArcaEnvironment, A as ArcaClientOptions } from './types-Su7QwloQ.js';
|
|
2
2
|
import { PadronService } from './padron.js';
|
|
3
|
-
import { e as ArcaAuthorizationOutcome, I as IssuanceService, h as ArcaFiscalIssue, o as ArcaSafeErrorMetadata } from './fiscal-evidence-
|
|
3
|
+
import { e as ArcaAuthorizationOutcome, I as IssuanceService, h as ArcaFiscalIssue, o as ArcaSafeErrorMetadata, V as VoucherDateWindow } from './fiscal-evidence-Bg4o9nxt.js';
|
|
4
4
|
import { WsfeVoucherInput, WsfeVoucherInfo, WsfeDateInput, WsfeService } from './wsfe.js';
|
|
5
|
-
import { VoucherClass, ReceiverCondition, IssuerCondition } from './constants.js';
|
|
5
|
+
import { VoucherClass, ReceiverCondition, IssuerCondition, IssuerConditionId } from './constants.js';
|
|
6
6
|
import { WsmtxcaService } from './wsmtxca.js';
|
|
7
7
|
|
|
8
8
|
type VoucherCoordinates = {
|
|
@@ -165,28 +165,75 @@ declare function wsmtxcaRequest(data: FiscalHeader$1, number?: number): {
|
|
|
165
165
|
fechaServicioHasta: string | undefined;
|
|
166
166
|
fechaVencimientoPago: string | undefined;
|
|
167
167
|
importeOtrosTributos?: number | undefined;
|
|
168
|
-
fechaEmision: string | undefined;
|
|
169
|
-
codigoTipoDocumento: number;
|
|
170
|
-
numeroDocumento: number;
|
|
171
168
|
condicionIVAReceptor: number;
|
|
172
169
|
importeGravado: number;
|
|
173
170
|
importeNoGravado: number;
|
|
174
171
|
importeExento: number;
|
|
175
172
|
importeSubtotal: number;
|
|
173
|
+
codigoTipoDocumento: number | undefined;
|
|
174
|
+
numeroDocumento: number | undefined;
|
|
175
|
+
fechaEmision: string | undefined;
|
|
176
176
|
numeroComprobante?: number | undefined;
|
|
177
177
|
codigoTipoComprobante: number;
|
|
178
178
|
numeroPuntoVenta: number;
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
+
/** Where every printed voucher's QR points, per ARCA's QR specification v1. */
|
|
183
|
+
declare const ARCA_QR_URL = "https://www.arca.gob.ar/fe/qr/";
|
|
184
|
+
/** What the QR of a printed voucher encodes. Amounts are minor units. */
|
|
185
|
+
type ArcaQrInput = {
|
|
186
|
+
/** The issuer's CUIT. */
|
|
187
|
+
taxId: number | string;
|
|
188
|
+
salesPoint: number;
|
|
189
|
+
voucherType: number;
|
|
190
|
+
number: number;
|
|
191
|
+
/** `YYYY-MM-DD` or `YYYYMMDD`. */
|
|
192
|
+
date: string;
|
|
193
|
+
/** The total in the voucher's currency, in minor units. */
|
|
194
|
+
total: number;
|
|
195
|
+
/** ARCA currency id; `PES` when omitted. */
|
|
196
|
+
currency?: string;
|
|
197
|
+
/** Pesos per unit of `currency`; 1 for pesos. */
|
|
198
|
+
exchangeRate?: number | string;
|
|
199
|
+
/** The CAE, or the CAEA when `authorization` is `"CAEA"`. */
|
|
200
|
+
cae: string;
|
|
201
|
+
authorization?: "CAE" | "CAEA";
|
|
202
|
+
/** The receiver's document. Omitted, or type 99, means an unidentified consumidor final. */
|
|
203
|
+
document?: {
|
|
204
|
+
type: number;
|
|
205
|
+
number: number | string;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
/** The JSON the QR carries, in the field order of ARCA's specification. */
|
|
209
|
+
type ArcaQrPayload = {
|
|
210
|
+
ver: 1;
|
|
211
|
+
fecha: string;
|
|
212
|
+
cuit: number;
|
|
213
|
+
ptoVta: number;
|
|
214
|
+
tipoCmp: number;
|
|
215
|
+
nroCmp: number;
|
|
216
|
+
importe: number;
|
|
217
|
+
moneda: string;
|
|
218
|
+
ctz: number;
|
|
219
|
+
tipoDocRec?: number;
|
|
220
|
+
nroDocRec?: number;
|
|
221
|
+
tipoCodAut: "E" | "A";
|
|
222
|
+
codAut: number;
|
|
223
|
+
};
|
|
224
|
+
/** Builds the URL a printed voucher's QR must encode. Pure, no I/O. */
|
|
225
|
+
declare function arcaQrUrl(input: ArcaQrInput): string;
|
|
226
|
+
declare function arcaQrPayload(input: ArcaQrInput): ArcaQrPayload;
|
|
227
|
+
|
|
182
228
|
declare const SUPPORTED_VAT_RATES: readonly [0, 2.5, 5, 10.5, 21, 27];
|
|
183
229
|
type SupportedVatRate = (typeof SUPPORTED_VAT_RATES)[number];
|
|
184
230
|
|
|
185
231
|
/**
|
|
186
232
|
* The line an item describes. WSFE ignores every field here and derives its
|
|
187
233
|
* header from the money alone; WSMTXCA requires `description`, `quantity`,
|
|
188
|
-
* `unit` and `
|
|
189
|
-
*
|
|
234
|
+
* `unit`, `unitPrice`, and `matrixCode` with `matrixUnits` unless `unit` is 97
|
|
235
|
+
* or 99, and sends the line as it is. The line never carries its own VAT
|
|
236
|
+
* amount: that follows from the item's `vat` and its money.
|
|
190
237
|
*/
|
|
191
238
|
type ItemLine = {
|
|
192
239
|
description?: string;
|
|
@@ -195,8 +242,11 @@ type ItemLine = {
|
|
|
195
242
|
/** A major-unit decimal string with up to six decimals, unlike every other amount. */
|
|
196
243
|
unitPrice?: string;
|
|
197
244
|
discount?: number;
|
|
245
|
+
/** Your own product code, at most 50 characters. */
|
|
198
246
|
code?: string;
|
|
247
|
+
/** The product's GTIN, or one of `ARCA_WSMTXCA_GENERIC_CODES`. */
|
|
199
248
|
matrixCode?: string;
|
|
249
|
+
/** Whole units of `matrixCode`, from 1 to 999999. */
|
|
200
250
|
matrixUnits?: number;
|
|
201
251
|
};
|
|
202
252
|
type VatRate = SupportedVatRate | "exempt" | "untaxed";
|
|
@@ -274,6 +324,8 @@ type IssuedVoucher = VoucherCoordinates & {
|
|
|
274
324
|
* authorization is never lost over its QR.
|
|
275
325
|
*/
|
|
276
326
|
qr?: string;
|
|
327
|
+
/** The JSON `qr` carries in base64 after `?p=`. Present whenever `qr` is. */
|
|
328
|
+
qrPayload?: ArcaQrPayload;
|
|
277
329
|
};
|
|
278
330
|
type ServiceFor<O extends IssueOptions> = "service" extends keyof O ? "wsmtxca" extends O["service"] ? O extends {
|
|
279
331
|
service: "wsmtxca";
|
|
@@ -394,6 +446,13 @@ type IssuanceFields = {
|
|
|
394
446
|
buyers?: WsfeVoucherInput["buyers"];
|
|
395
447
|
activities?: WsfeVoucherInput["activities"];
|
|
396
448
|
};
|
|
449
|
+
type VoucherTypeInfo = {
|
|
450
|
+
family: InvoiceFamily;
|
|
451
|
+
voucherClass: VoucherClass;
|
|
452
|
+
kind: "invoice" | "debit_note" | "credit_note";
|
|
453
|
+
};
|
|
454
|
+
/** What an ARCA voucher type the SDK issues is. Pure; throws for any other. */
|
|
455
|
+
declare function describeVoucherType(voucherType: number): VoucherTypeInfo;
|
|
397
456
|
/** FCE business fields; the SDK encodes each provider's different option layout. */
|
|
398
457
|
type FceOptions = {
|
|
399
458
|
cbu?: string;
|
|
@@ -437,18 +496,33 @@ type IssueCommon = IssuanceFields & {
|
|
|
437
496
|
};
|
|
438
497
|
};
|
|
439
498
|
type IssueInput = IssueCommon & ({
|
|
440
|
-
issuer: "responsable_inscripto";
|
|
499
|
+
issuer: "responsable_inscripto" | 1;
|
|
441
500
|
items: readonly VatItem[];
|
|
442
501
|
amounts?: never;
|
|
443
502
|
} | {
|
|
444
|
-
issuer: "monotributo" | "exento" | "no_alcanzado";
|
|
503
|
+
issuer: "monotributo" | "exento" | "no_alcanzado" | 4 | 6 | 15;
|
|
445
504
|
items: readonly AmountItem[];
|
|
446
505
|
amounts?: never;
|
|
447
506
|
} | {
|
|
448
|
-
issuer: IssuerCondition;
|
|
507
|
+
issuer: IssuerCondition | IssuerConditionId;
|
|
449
508
|
amounts: VoucherAmounts;
|
|
450
509
|
items?: never;
|
|
451
510
|
});
|
|
511
|
+
type VoucherDateWindowInput = {
|
|
512
|
+
voucherType: number;
|
|
513
|
+
/** What the voucher bills; `"products"` when omitted, as in `issue()`. */
|
|
514
|
+
concept?: NonNullable<IssuanceFields["concept"]>;
|
|
515
|
+
/** The service that will authorize it; `"wsfe"` when omitted. */
|
|
516
|
+
service?: "wsfe" | "wsmtxca";
|
|
517
|
+
/** When it will be sent; its day in Argentina anchors the window. */
|
|
518
|
+
now?: Date;
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* The dates ARCA accepts for a voucher sent now, the same window `issue()`
|
|
522
|
+
* checks before any call. Pure, no I/O. ARCA still rejects a date before the
|
|
523
|
+
* last voucher of the same type and sales point.
|
|
524
|
+
*/
|
|
525
|
+
declare function voucherDateWindow(input: VoucherDateWindowInput): VoucherDateWindow;
|
|
452
526
|
|
|
453
527
|
/**
|
|
454
528
|
* The credited lines and, at most, the note's own sales point and date.
|
|
@@ -515,6 +589,11 @@ type VouchersService = {
|
|
|
515
589
|
* throws on any other provider error. Reads only: no store and no reserve.
|
|
516
590
|
*/
|
|
517
591
|
lookup(voucher: VoucherCoordinates, options?: PreviewOptions): Promise<VoucherSummary | null>;
|
|
592
|
+
/**
|
|
593
|
+
* The number of the last voucher ARCA authorized for a sales point and
|
|
594
|
+
* voucher type, on WSFE or WSMTXCA; `0` when none was ever authorized.
|
|
595
|
+
*/
|
|
596
|
+
lastAuthorized(sequence: Omit<VoucherCoordinates, "number">, options?: PreviewOptions): Promise<number>;
|
|
518
597
|
/** Consults a durable reservation. Never allocates or authorizes a voucher. */
|
|
519
598
|
recover<O extends RecoveryOptions = {
|
|
520
599
|
include?: never;
|
|
@@ -612,6 +691,8 @@ type ArcaClient = {
|
|
|
612
691
|
previewDebitNote: VouchersService["previewDebitNote"];
|
|
613
692
|
/** Consults one authorized voucher; `null` when ARCA has no such voucher. */
|
|
614
693
|
lookup: VouchersService["lookup"];
|
|
694
|
+
/** The last number ARCA authorized for a sales point and type; `0` when none. */
|
|
695
|
+
lastAuthorized: VouchersService["lastAuthorized"];
|
|
615
696
|
wsfe: WsfeService;
|
|
616
697
|
wsmtxca: WsmtxcaService;
|
|
617
698
|
padron: PadronService;
|
|
@@ -621,10 +702,11 @@ type ArcaClient = {
|
|
|
621
702
|
* Validates the config, wires WSAA authentication and SOAP transport,
|
|
622
703
|
* and returns an object with `issue()`, `preview()`, `issueCreditNote()`,
|
|
623
704
|
* `issueDebitNote()`, `previewCreditNote()`, `previewDebitNote()`, `recover()`,
|
|
624
|
-
* `lookup()` and the `.wsfe`, `.wsmtxca`, and `.padron`
|
|
705
|
+
* `lookup()`, `lastAuthorized()` and the `.wsfe`, `.wsmtxca`, and `.padron`
|
|
706
|
+
* service modules.
|
|
625
707
|
*
|
|
626
708
|
* @throws {ArcaConfigurationError} When the config is missing or invalid.
|
|
627
709
|
*/
|
|
628
710
|
declare function createArcaClient(config?: ArcaClientOptions): ArcaClient;
|
|
629
711
|
|
|
630
|
-
export { type ArcaClient as A, type CreditNoteInput as C, type DebitNoteInput as D, type FceOptions as F, type InvoiceFamily as I, type NotePreview as N, type PeriodNoteInput as P, type Receiver as R, type Tribute as T, type VatItem as V, type WsfeIdentityMatch as W,
|
|
712
|
+
export { type ArcaClient as A, type WsmtxcaLine as B, type CreditNoteInput as C, type DebitNoteInput as D, arcaQrPayload as E, type FceOptions as F, arcaQrUrl as G, createArcaClient as H, type InvoiceFamily as I, describeVoucherType as J, matchWsfeVoucherIdentity as K, voucherDateWindow as L, type NotePreview as N, type PeriodNoteInput as P, type Receiver as R, type Tribute as T, type VatItem as V, type WsfeIdentityMatch as W, ARCA_QR_URL as a, type AmountItem as b, type ArcaClientConfigView as c, type ArcaQrInput as d, type ArcaQrPayload as e, type FiscalHeader as f, type IssuanceFields as g, type IssueAmounts as h, type IssueCommon as i, type IssueInput as j, type IssueOptions as k, type IssueOutcome as l, type IssuePreview as m, type IssueRequest as n, type IssuedVoucher as o, type ItemLine as p, type PreviewOptions as q, type RecoveryOptions as r, type VatRate as s, type VoucherAmounts as t, type VoucherCoordinates as u, type VoucherDateWindowInput as v, type VoucherSummary as w, type VoucherTypeInfo as x, type VouchersService as y, type WsmtxcaIssueRequest as z };
|
package/dist/constants.d.ts
CHANGED
|
@@ -16,6 +16,28 @@ declare const ARCA_DOCUMENT_TYPES: {
|
|
|
16
16
|
readonly DNI: 96;
|
|
17
17
|
readonly CONSUMIDOR_FINAL: 99;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* ARCA's generic WSMTXCA item codes, keyed by the `matrixCode` to send.
|
|
21
|
+
* RG 2904, Anexo VII: for concepts outside the issuer's main line of goods,
|
|
22
|
+
* which carry their GTIN instead. Samples and promotional material use
|
|
23
|
+
* `7790001001054` (Ventas varias).
|
|
24
|
+
* https://www.afip.gob.ar/fe/documentos/codigosGenericosYEspecificos.xls
|
|
25
|
+
*/
|
|
26
|
+
declare const ARCA_WSMTXCA_GENERIC_CODES: {
|
|
27
|
+
readonly "7790001001030": "Descuentos y bonificaciones comerciales";
|
|
28
|
+
readonly "7790001001047": "Conceptos financieros";
|
|
29
|
+
readonly "7790001001054": "Ventas varias";
|
|
30
|
+
readonly "7790001001061": "Bienes de uso";
|
|
31
|
+
readonly "7790001001078": "Servicios prestados";
|
|
32
|
+
readonly "7790001001085": "Fletes";
|
|
33
|
+
readonly "7790001001092": "Alquileres";
|
|
34
|
+
readonly "7790001001115": "Depósito y servicios de logística";
|
|
35
|
+
readonly "7790001001122": "Repuestos y accesorios";
|
|
36
|
+
readonly "7790001001139": "Ajustes impositivos";
|
|
37
|
+
readonly "7790001001146": "Actividades comerciales no codificadas";
|
|
38
|
+
readonly "7790001001153": "Venta de material de rezago";
|
|
39
|
+
readonly "7790001001856": "Anticipos y señas";
|
|
40
|
+
};
|
|
19
41
|
/**
|
|
20
42
|
* Common receiver IVA condition identifiers used by WSFE.
|
|
21
43
|
* Allowed values depend on the voucher class and ARCA's live catalog.
|
|
@@ -69,6 +91,8 @@ declare const ARCA_ISSUER_CONDITION_IDS: {
|
|
|
69
91
|
readonly exento: 4;
|
|
70
92
|
readonly no_alcanzado: 15;
|
|
71
93
|
};
|
|
94
|
+
/** The ARCA identifier of each issuer condition, accepted wherever a name is. */
|
|
95
|
+
type IssuerConditionId = (typeof ARCA_ISSUER_CONDITION_IDS)[IssuerCondition];
|
|
72
96
|
declare const ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS = 1000000000n;
|
|
73
97
|
declare const ARCA_INVOICE_CLASS_BY_ISSUER: {
|
|
74
98
|
readonly responsable_inscripto: {
|
|
@@ -101,4 +125,4 @@ declare const ARCA_INVOICE_CLASS_BY_ISSUER: {
|
|
|
101
125
|
};
|
|
102
126
|
};
|
|
103
127
|
|
|
104
|
-
export { ARCA_CONCEPT_TYPES, ARCA_CURRENCY_IDS, ARCA_DOCUMENT_TYPES, ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS, ARCA_INVOICE_CLASS_BY_ISSUER, ARCA_ISSUER_CONDITION_IDS, ARCA_RECEIVER_CONDITION_IDS, ARCA_RECEIVER_VAT_CONDITIONS, ARCA_VAT_RATES, ARCA_VOUCHER_TYPES, ISO_CURRENCIES, type IssuerCondition, type ReceiverCondition, type VoucherClass };
|
|
128
|
+
export { ARCA_CONCEPT_TYPES, ARCA_CURRENCY_IDS, ARCA_DOCUMENT_TYPES, ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS, ARCA_INVOICE_CLASS_BY_ISSUER, ARCA_ISSUER_CONDITION_IDS, ARCA_RECEIVER_CONDITION_IDS, ARCA_RECEIVER_VAT_CONDITIONS, ARCA_VAT_RATES, ARCA_VOUCHER_TYPES, ARCA_WSMTXCA_GENERIC_CODES, ISO_CURRENCIES, type IssuerCondition, type IssuerConditionId, type ReceiverCondition, type VoucherClass };
|
package/dist/constants.mjs
CHANGED
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
ARCA_RECEIVER_VAT_CONDITIONS,
|
|
10
10
|
ARCA_VAT_RATES,
|
|
11
11
|
ARCA_VOUCHER_TYPES,
|
|
12
|
+
ARCA_WSMTXCA_GENERIC_CODES,
|
|
12
13
|
ISO_CURRENCIES
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-C2KX652X.mjs";
|
|
14
15
|
export {
|
|
15
16
|
ARCA_CONCEPT_TYPES,
|
|
16
17
|
ARCA_CURRENCY_IDS,
|
|
@@ -22,6 +23,7 @@ export {
|
|
|
22
23
|
ARCA_RECEIVER_VAT_CONDITIONS,
|
|
23
24
|
ARCA_VAT_RATES,
|
|
24
25
|
ARCA_VOUCHER_TYPES,
|
|
26
|
+
ARCA_WSMTXCA_GENERIC_CODES,
|
|
25
27
|
ISO_CURRENCIES
|
|
26
28
|
};
|
|
27
29
|
//# sourceMappingURL=constants.mjs.map
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './types-Su7QwloQ.js';
|
|
2
|
-
export { A as ArcaAuthenticationError, a as ArcaAuthenticationErrorOptions, c as ArcaAuthenticationReason, f as ArcaConfigurationError, g as ArcaError, k as ArcaInputError, l as ArcaInputErrorCode, m as ArcaInputErrorOptions, n as ArcaInvalidSoapResponseError, o as ArcaSafeErrorMetadata, p as ArcaServiceError, q as ArcaSoapFaultError, r as ArcaTransportError, t as isArcaAuthenticationError, u as toArcaSafeErrorMetadata } from './fiscal-evidence-
|
|
2
|
+
export { A as ArcaAuthenticationError, a as ArcaAuthenticationErrorOptions, c as ArcaAuthenticationReason, f as ArcaConfigurationError, g as ArcaError, k as ArcaInputError, l as ArcaInputErrorCode, m as ArcaInputErrorOptions, n as ArcaInvalidSoapResponseError, o as ArcaSafeErrorMetadata, p as ArcaServiceError, q as ArcaSoapFaultError, r as ArcaTransportError, V as VoucherDateWindow, t as isArcaAuthenticationError, u as toArcaSafeErrorMetadata } from './fiscal-evidence-Bg4o9nxt.js';
|
package/dist/errors.mjs
CHANGED
|
@@ -12,18 +12,30 @@ declare class ArcaConfigurationError extends ArcaError {
|
|
|
12
12
|
constructor(message: string, options?: ErrorOptions);
|
|
13
13
|
}
|
|
14
14
|
/** Stable routing codes for caller-provided input failures. */
|
|
15
|
-
type ArcaInputErrorCode = "ARCA_INPUT_IDEMPOTENCY_MISMATCH" | "ARCA_INPUT_RESERVATION_NOT_FOUND" | "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";
|
|
15
|
+
type ArcaInputErrorCode = "ARCA_INPUT_IDEMPOTENCY_MISMATCH" | "ARCA_INPUT_RESERVATION_NOT_FOUND" | "ARCA_INPUT_INVALID_DATE" | "ARCA_INPUT_DATE_OUTSIDE_WINDOW" | "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
|
+
/** The first and last day ARCA accepts, both `YYYY-MM-DD` and inclusive. */
|
|
17
|
+
type VoucherDateWindow = {
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
};
|
|
16
21
|
type ArcaInputErrorOptions = ErrorOptions & {
|
|
17
22
|
code: ArcaInputErrorCode;
|
|
18
23
|
field?: string;
|
|
19
24
|
expected?: string;
|
|
25
|
+
window?: VoucherDateWindow;
|
|
20
26
|
};
|
|
21
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Thrown when caller-provided input data is missing or invalid. From
|
|
29
|
+
* `issue()`, `issueCreditNote()` or `issueDebitNote()` it means that call sent
|
|
30
|
+
* no authorization request, so ARCA issued nothing for it.
|
|
31
|
+
*/
|
|
22
32
|
declare class ArcaInputError extends ArcaError {
|
|
23
33
|
readonly code: ArcaInputErrorCode;
|
|
24
34
|
readonly name: string;
|
|
25
35
|
readonly field?: string;
|
|
26
36
|
readonly expected?: string;
|
|
37
|
+
/** With `ARCA_INPUT_DATE_OUTSIDE_WINDOW`, the dates ARCA accepts today. */
|
|
38
|
+
readonly window?: VoucherDateWindow;
|
|
27
39
|
constructor(message: string, options: ArcaInputErrorOptions);
|
|
28
40
|
}
|
|
29
41
|
/** Stable reasons exposed for explicit ARCA authentication rejections. */
|
|
@@ -129,6 +141,7 @@ type ArcaSafeErrorMetadata = {
|
|
|
129
141
|
faultCode?: string;
|
|
130
142
|
field?: string;
|
|
131
143
|
expected?: string;
|
|
144
|
+
window?: VoucherDateWindow;
|
|
132
145
|
/** ArcaServiceError's provider code, always as a string. */
|
|
133
146
|
serviceCode?: string;
|
|
134
147
|
result?: string;
|
|
@@ -211,4 +224,4 @@ type ArcaVoucherLookupResult<TVoucher, TService extends IssuanceService = Issuan
|
|
|
211
224
|
raw: Record<string, unknown>;
|
|
212
225
|
};
|
|
213
226
|
|
|
214
|
-
export { ArcaAuthenticationError as A, type IssuanceService as I, 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, ArcaInputError as k, type ArcaInputErrorCode as l, type ArcaInputErrorOptions as m, ArcaInvalidSoapResponseError as n, type ArcaSafeErrorMetadata as o, ArcaServiceError as p, ArcaSoapFaultError as q, ArcaTransportError as r, type ArcaVoucherLookupResult as s, isArcaAuthenticationError as t, toArcaSafeErrorMetadata as u };
|
|
227
|
+
export { ArcaAuthenticationError as A, type IssuanceService as I, type VoucherDateWindow as V, 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, ArcaInputError as k, type ArcaInputErrorCode as l, type ArcaInputErrorOptions as m, ArcaInvalidSoapResponseError as n, type ArcaSafeErrorMetadata as o, ArcaServiceError as p, ArcaSoapFaultError as q, ArcaTransportError as r, type ArcaVoucherLookupResult as s, isArcaAuthenticationError as t, toArcaSafeErrorMetadata as u };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { a as AmountItem, A as ArcaClient,
|
|
1
|
+
export { a as ARCA_QR_URL, b as AmountItem, A as ArcaClient, c as ArcaClientConfigView, d as ArcaQrInput, e as ArcaQrPayload, C as CreditNoteInput, D as DebitNoteInput, F as FceOptions, f as FiscalHeader, I as InvoiceFamily, g as IssuanceFields, h as IssueAmounts, i as IssueCommon, j as IssueInput, k as IssueOptions, l as IssueOutcome, m as IssuePreview, n as IssueRequest, o as IssuedVoucher, p as ItemLine, N as NotePreview, P as PeriodNoteInput, q as PreviewOptions, R as Receiver, r as RecoveryOptions, T as Tribute, V as VatItem, s as VatRate, t as VoucherAmounts, u as VoucherCoordinates, v as VoucherDateWindowInput, w as VoucherSummary, x as VoucherTypeInfo, y as VouchersService, W as WsfeIdentityMatch, z as WsmtxcaIssueRequest, B as WsmtxcaLine, E as arcaQrPayload, G as arcaQrUrl, H as createArcaClient, J as describeVoucherType, K as matchWsfeVoucherIdentity, L as voucherDateWindow } from './client-BIkLOgBA.js';
|
|
2
2
|
import { h as ArcaEnvironment, a as ArcaClientConfig, i as ArcaStore, j as ArcaWsaaSessionStore } from './types-Su7QwloQ.js';
|
|
3
3
|
export { g as ArcaAuthCredentials, f as ArcaAuthOptions, A as ArcaClientConfig, k as ArcaLogLevel, l as ArcaLoggerConfig, m as ArcaPadronServiceName, n as ArcaRepresentedTaxId, b as ArcaServiceName, o as ArcaServiceTarget, e as ArcaWsaaServiceId, p as ArcaWsaaSessionKey } from './types-Su7QwloQ.js';
|
|
4
|
-
export { ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS, ARCA_INVOICE_CLASS_BY_ISSUER, ARCA_ISSUER_CONDITION_IDS, ARCA_RECEIVER_CONDITION_IDS, IssuerCondition, ReceiverCondition, VoucherClass } from './constants.js';
|
|
5
|
-
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 ArcaInputError, l as ArcaInputErrorCode, m as ArcaInputErrorOptions, n as ArcaInvalidSoapResponseError, o as ArcaSafeErrorMetadata, p as ArcaServiceError, q as ArcaSoapFaultError, r as ArcaTransportError, s as ArcaVoucherLookupResult, I as IssuanceService, t as isArcaAuthenticationError, u as toArcaSafeErrorMetadata } from './fiscal-evidence-
|
|
4
|
+
export { ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS, ARCA_INVOICE_CLASS_BY_ISSUER, ARCA_ISSUER_CONDITION_IDS, ARCA_RECEIVER_CONDITION_IDS, ARCA_WSMTXCA_GENERIC_CODES, IssuerCondition, IssuerConditionId, ReceiverCondition, VoucherClass } from './constants.js';
|
|
5
|
+
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 ArcaInputError, l as ArcaInputErrorCode, m as ArcaInputErrorOptions, n as ArcaInvalidSoapResponseError, o as ArcaSafeErrorMetadata, p as ArcaServiceError, q as ArcaSoapFaultError, r as ArcaTransportError, s as ArcaVoucherLookupResult, I as IssuanceService, V as VoucherDateWindow, t as isArcaAuthenticationError, u as toArcaSafeErrorMetadata } from './fiscal-evidence-Bg4o9nxt.js';
|
|
6
6
|
export { CreatePadronServiceOptions, PadronActivity, PadronAddress, PadronService, PadronTax, PadronTaxIdLookupResult, PadronTaxpayerResult, createPadronService } from './padron.js';
|
|
7
7
|
export { CreateWsfeServiceOptions, WsfeActivity, WsfeActivityType, WsfeAssociatedPeriod, WsfeAssociatedVoucher, WsfeAuthorizationOutcome, WsfeBuyer, WsfeCatalogEntry, WsfeCurrencyType, WsfeDateInput, WsfeIssueInput, WsfeOptionalField, WsfeQuotation, WsfeReceiverVatCondition, WsfeSalesPoint, WsfeServerStatus, WsfeService, WsfeTax, WsfeVatRate, WsfeVoucherInfo, WsfeVoucherInput, WsfeVoucherLookupResult, createWsfeService } from './wsfe.js';
|
|
8
8
|
export { CreateWsmtxcaServiceOptions, WsmtxcaAuthorizationOutcome, WsmtxcaIssueInput, WsmtxcaLastAuthorizedVoucherResult, WsmtxcaSalesPoint, WsmtxcaSalesPointsResult, WsmtxcaService, WsmtxcaVoucherInfo, WsmtxcaVoucherLookupOutcome, createWsmtxcaService } from './wsmtxca.js';
|
|
@@ -38,52 +38,6 @@ declare function createArcaClientConfigFromEnv(options?: CreateArcaClientConfigF
|
|
|
38
38
|
*/
|
|
39
39
|
declare function assertArcaClientConfig(config: ArcaClientConfig): void;
|
|
40
40
|
|
|
41
|
-
/** Where every printed voucher's QR points, per ARCA's QR specification v1. */
|
|
42
|
-
declare const ARCA_QR_URL = "https://www.arca.gob.ar/fe/qr/";
|
|
43
|
-
/** What the QR of a printed voucher encodes. Amounts are minor units. */
|
|
44
|
-
type ArcaQrInput = {
|
|
45
|
-
/** The issuer's CUIT. */
|
|
46
|
-
taxId: number | string;
|
|
47
|
-
salesPoint: number;
|
|
48
|
-
voucherType: number;
|
|
49
|
-
number: number;
|
|
50
|
-
/** `YYYY-MM-DD` or `YYYYMMDD`. */
|
|
51
|
-
date: string;
|
|
52
|
-
/** The total in the voucher's currency, in minor units. */
|
|
53
|
-
total: number;
|
|
54
|
-
/** ARCA currency id; `PES` when omitted. */
|
|
55
|
-
currency?: string;
|
|
56
|
-
/** Pesos per unit of `currency`; 1 for pesos. */
|
|
57
|
-
exchangeRate?: number | string;
|
|
58
|
-
/** The CAE, or the CAEA when `authorization` is `"CAEA"`. */
|
|
59
|
-
cae: string;
|
|
60
|
-
authorization?: "CAE" | "CAEA";
|
|
61
|
-
/** The receiver's document. Omitted, or type 99, means an unidentified consumidor final. */
|
|
62
|
-
document?: {
|
|
63
|
-
type: number;
|
|
64
|
-
number: number | string;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
/** The JSON the QR carries, in the field order of ARCA's specification. */
|
|
68
|
-
type ArcaQrPayload = {
|
|
69
|
-
ver: 1;
|
|
70
|
-
fecha: string;
|
|
71
|
-
cuit: number;
|
|
72
|
-
ptoVta: number;
|
|
73
|
-
tipoCmp: number;
|
|
74
|
-
nroCmp: number;
|
|
75
|
-
importe: number;
|
|
76
|
-
moneda: string;
|
|
77
|
-
ctz: number;
|
|
78
|
-
tipoDocRec?: number;
|
|
79
|
-
nroDocRec?: number;
|
|
80
|
-
tipoCodAut: "E" | "A";
|
|
81
|
-
codAut: number;
|
|
82
|
-
};
|
|
83
|
-
/** Builds the URL a printed voucher's QR must encode. Pure, no I/O. */
|
|
84
|
-
declare function arcaQrUrl(input: ArcaQrInput): string;
|
|
85
|
-
declare function arcaQrPayload(input: ArcaQrInput): ArcaQrPayload;
|
|
86
|
-
|
|
87
41
|
/** Persistent store for a single server with a private durable volume. */
|
|
88
42
|
declare function createFileStore(directory: string): ArcaStore;
|
|
89
43
|
|
|
@@ -115,4 +69,4 @@ declare function createRedisStore(client: RedisClient, options?: {
|
|
|
115
69
|
|
|
116
70
|
declare function createMemoryWsaaSessionStore(): ArcaWsaaSessionStore;
|
|
117
71
|
|
|
118
|
-
export { ARCA_ENVIRONMENTS, ARCA_ENV_VARIABLES,
|
|
72
|
+
export { ARCA_ENVIRONMENTS, ARCA_ENV_VARIABLES, ArcaEnvironment, ArcaStore, ArcaWsaaSessionStore, type CreateArcaClientConfigFromEnvOptions, assertArcaClientConfig, createArcaClientConfigFromEnv, createFileStore, createMemoryStore, createMemoryWsaaSessionStore, createPostgresStore, createRedisStore };
|
package/dist/index.mjs
CHANGED
|
@@ -10,26 +10,29 @@ import {
|
|
|
10
10
|
createArcaClientConfigFromEnv,
|
|
11
11
|
createFileStore,
|
|
12
12
|
createMemoryWsaaSessionStore,
|
|
13
|
+
describeVoucherType,
|
|
13
14
|
matchWsfeVoucherIdentity,
|
|
14
15
|
storeCall,
|
|
16
|
+
voucherDateWindow,
|
|
15
17
|
withLease
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-T5N62FRZ.mjs";
|
|
17
19
|
import {
|
|
18
20
|
ARCA_FINAL_CONSUMER_IDENTIFICATION_THRESHOLD_MINOR_UNITS,
|
|
19
21
|
ARCA_INVOICE_CLASS_BY_ISSUER,
|
|
20
22
|
ARCA_ISSUER_CONDITION_IDS,
|
|
21
|
-
ARCA_RECEIVER_CONDITION_IDS
|
|
22
|
-
|
|
23
|
+
ARCA_RECEIVER_CONDITION_IDS,
|
|
24
|
+
ARCA_WSMTXCA_GENERIC_CODES
|
|
25
|
+
} from "./chunk-C2KX652X.mjs";
|
|
23
26
|
import {
|
|
24
27
|
createPadronService
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JP3LVU7K.mjs";
|
|
26
29
|
import {
|
|
27
30
|
createWsfeService
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-TXFYTMO4.mjs";
|
|
29
32
|
import {
|
|
30
33
|
createWsmtxcaService
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
34
|
+
} from "./chunk-TMSP5QPZ.mjs";
|
|
35
|
+
import "./chunk-B2M64SIK.mjs";
|
|
33
36
|
import {
|
|
34
37
|
ArcaAuthenticationError,
|
|
35
38
|
ArcaConfigurationError,
|
|
@@ -41,7 +44,7 @@ import {
|
|
|
41
44
|
ArcaTransportError,
|
|
42
45
|
isArcaAuthenticationError,
|
|
43
46
|
toArcaSafeErrorMetadata
|
|
44
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-NT2A6YMO.mjs";
|
|
45
48
|
|
|
46
49
|
// src/store/memory.ts
|
|
47
50
|
function createMemoryStore() {
|
|
@@ -226,6 +229,7 @@ export {
|
|
|
226
229
|
ARCA_ISSUER_CONDITION_IDS,
|
|
227
230
|
ARCA_QR_URL,
|
|
228
231
|
ARCA_RECEIVER_CONDITION_IDS,
|
|
232
|
+
ARCA_WSMTXCA_GENERIC_CODES,
|
|
229
233
|
ArcaAuthenticationError,
|
|
230
234
|
ArcaConfigurationError,
|
|
231
235
|
ArcaError,
|
|
@@ -247,8 +251,10 @@ export {
|
|
|
247
251
|
createRedisStore,
|
|
248
252
|
createWsfeService,
|
|
249
253
|
createWsmtxcaService,
|
|
254
|
+
describeVoucherType,
|
|
250
255
|
isArcaAuthenticationError,
|
|
251
256
|
matchWsfeVoucherIdentity,
|
|
252
|
-
toArcaSafeErrorMetadata
|
|
257
|
+
toArcaSafeErrorMetadata,
|
|
258
|
+
voucherDateWindow
|
|
253
259
|
};
|
|
254
260
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/store/memory.ts","../src/store/postgres.ts","../src/store/redis.ts"],"sourcesContent":["import type { ArcaStore } from \"./types\";\n\n/** In-process store for tests; reservations do not survive a restart. */\nexport function createMemoryStore(): ArcaStore {\n const values = new Map<string, string>();\n const locks = new Map<string, Promise<void>>();\n return {\n get: (key) => Promise.resolve(values.get(key) ?? null),\n set(key, value) {\n values.set(key, value);\n return Promise.resolve();\n },\n add(key, value) {\n if (values.has(key)) {\n return Promise.resolve(false);\n }\n values.set(key, value);\n return Promise.resolve(true);\n },\n delete(key) {\n values.delete(key);\n return Promise.resolve();\n },\n async withLock(key, fn) {\n const previous = locks.get(key) ?? Promise.resolve();\n let release: () => void = () => undefined;\n const current = new Promise<void>((resolve) => {\n release = resolve;\n });\n const queued = previous.catch(() => undefined).then(() => current);\n locks.set(key, queued);\n await previous.catch(() => undefined);\n try {\n return await fn();\n } finally {\n release();\n if (locks.get(key) === queued) {\n locks.delete(key);\n }\n }\n },\n };\n}\n","import { ArcaConfigurationError } from \"../errors\";\nimport { ARCA_LEASE_MS, withLease } from \"./lock\";\nimport { type ArcaStore, storeCall } from \"./types\";\n\ntype Row = { key?: string; value?: string };\n/** Uses the caller's SQL client; provision the table before use. */\nexport function createPostgresStore({\n query,\n table = \"arca_store\",\n}: {\n query: (text: string, params: string[]) => Promise<Row[] | { rows: Row[] }>;\n table?: string;\n}): ArcaStore {\n if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(table)) {\n throw new ArcaConfigurationError(\"Invalid ARCA store table identifier.\");\n }\n const name = `\"${table}\"`;\n const lease = Math.round(ARCA_LEASE_MS / 1000);\n const run = (text: string, params: string[]) =>\n storeCall(async () => {\n const result = await query(text, params);\n return Array.isArray(result) ? result : result.rows;\n });\n return {\n async get(key) {\n return (\n (await run(`SELECT value FROM ${name} WHERE key = $1`, [key]))[0]\n ?.value ?? null\n );\n },\n async set(key, value) {\n await run(\n `INSERT INTO ${name} (key, value) VALUES ($1, $2) ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = now()`,\n [key, value]\n );\n },\n async add(key, value) {\n return (\n (\n await run(\n `INSERT INTO ${name} (key, value) VALUES ($1, $2) ON CONFLICT DO NOTHING RETURNING key`,\n [key, value]\n )\n ).length > 0\n );\n },\n async delete(key) {\n await run(`DELETE FROM ${name} WHERE key = $1`, [key]);\n },\n withLock(key, fn) {\n // A lease row, not an advisory lock: it survives a transaction-mode\n // pooler, where a session-scoped lock would be taken on another backend.\n return withLease(\n key,\n {\n async acquire(owner) {\n const taken = await run(\n `INSERT INTO ${name} (key, value) VALUES ($1, $2) ON CONFLICT DO NOTHING RETURNING key`,\n [key, owner]\n );\n if (taken.length > 0) {\n return true;\n }\n const expired = await run(\n `UPDATE ${name} SET value = $2, updated_at = now() WHERE key = $1 AND updated_at < now() - interval '${lease} seconds' RETURNING key`,\n [key, owner]\n );\n return expired.length > 0;\n },\n async renew(owner) {\n await run(\n `UPDATE ${name} SET updated_at = now() WHERE key = $1 AND value = $2`,\n [key, owner]\n );\n },\n async release(owner) {\n await run(`DELETE FROM ${name} WHERE key = $1 AND value = $2`, [\n key,\n owner,\n ]);\n },\n },\n fn\n );\n },\n };\n}\n","import { ArcaConfigurationError } from \"../errors\";\nimport { ARCA_LEASE_MS, withLease } from \"./lock\";\nimport { type ArcaStore, storeCall } from \"./types\";\n\ntype RedisClient = {\n get(key: string): Promise<unknown>;\n set(key: string, value: string): Promise<unknown>;\n call?(...args: string[]): Promise<unknown>;\n del?(key: string): Promise<unknown>;\n};\n/** Uses ioredis or Upstash without importing either driver. */\nexport function createRedisStore(\n client: RedisClient,\n options: { flavor?: \"ioredis\" | \"upstash\" } = {}\n): ArcaStore {\n const flavor =\n options.flavor ??\n (typeof client.call === \"function\" ? \"ioredis\" : \"upstash\");\n if (flavor === \"ioredis\" && !client.call) {\n throw new ArcaConfigurationError(\n \"ARCA Redis ioredis flavor requires client.call.\"\n );\n }\n // The public structural type accepts ioredis's overloaded set method.\n // Only the Upstash flavor invokes its options-object overload.\n const upstashSet = client.set as (\n key: string,\n value: string,\n options: { nx?: true; xx?: true; px?: number }\n ) => Promise<unknown>;\n const read = async (key: string) => {\n const value = await client.get(key);\n if (value === null || value === undefined) {\n return null;\n }\n // Upstash can deserialize stored JSON automatically.\n return typeof value === \"string\" ? value : JSON.stringify(value);\n };\n // A lease, so a crashed holder frees the key; a renewal keeps a live one.\n const lease = (key: string, owner: string, mode: \"nx\" | \"xx\") =>\n storeCall(\n async () =>\n (flavor === \"ioredis\"\n ? await client.call?.(\n \"SET\",\n key,\n owner,\n mode.toUpperCase(),\n \"PX\",\n String(ARCA_LEASE_MS)\n )\n : await upstashSet.call(client, key, owner, {\n [mode]: true,\n px: ARCA_LEASE_MS,\n })) === \"OK\"\n );\n return {\n get: (key) => storeCall(() => read(key)),\n set: (key, value) =>\n storeCall(async () => {\n await client.set(key, value);\n }),\n add: (key, value) =>\n storeCall(\n async () =>\n (flavor === \"ioredis\"\n ? await client.call?.(\"SET\", key, value, \"NX\")\n : await upstashSet.call(client, key, value, { nx: true })) === \"OK\"\n ),\n ...(client.del\n ? {\n delete: (key: string) =>\n storeCall(async () => {\n await client.del?.(key);\n }),\n withLock: <T>(key: string, fn: () => Promise<T>) =>\n withLease(\n key,\n {\n acquire: (owner) => lease(key, owner, \"nx\"),\n renew: async (owner) => {\n // Check and set: only the holder extends its own lease.\n if ((await storeCall(() => read(key))) === owner) {\n await lease(key, owner, \"xx\");\n }\n },\n release: async (owner) => {\n await storeCall(async () => {\n if ((await read(key)) === owner) {\n await client.del?.(key);\n }\n });\n },\n },\n fn\n ),\n }\n : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAAS,oBAA+B;AAC7C,QAAM,SAAS,oBAAI,IAAoB;AACvC,QAAM,QAAQ,oBAAI,IAA2B;AAC7C,SAAO;AAAA,IACL,KAAK,CAAC,QAAQ,QAAQ,QAAQ,OAAO,IAAI,GAAG,KAAK,IAAI;AAAA,IACrD,IAAI,KAAK,OAAO;AACd,aAAO,IAAI,KAAK,KAAK;AACrB,aAAO,QAAQ,QAAQ;AAAA,IACzB;AAAA,IACA,IAAI,KAAK,OAAO;AACd,UAAI,OAAO,IAAI,GAAG,GAAG;AACnB,eAAO,QAAQ,QAAQ,KAAK;AAAA,M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AAAA,YAC9B;AAAA,UACF;AAAA,UACA,SAAS,OAAO,UAAU;AACxB,kBAAM,UAAU,YAAY;AAC1B,kBAAK,MAAM,KAAK,GAAG,MAAO,OAAO;AAC/B,sBAAM,OAAO,MAAM,GAAG;AAAA,cACxB;AAAA,YACF,CAAC;AAAA,UACH;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA,IACJ,IACA,CAAC;AAAA,EACP;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/store/memory.ts","../src/store/postgres.ts","../src/store/redis.ts"],"sourcesContent":["import type { ArcaStore } from \"./types\";\n\n/** In-process store for tests; reservations do not survive a restart. */\nexport function createMemoryStore(): ArcaStore {\n const values = new Map<string, string>();\n const locks = new Map<string, Promise<void>>();\n return {\n get: (key) => Promise.resolve(values.get(key) ?? null),\n set(key, value) {\n values.set(key, value);\n return Promise.resolve();\n },\n add(key, value) {\n if (values.has(key)) {\n return Promise.resolve(false);\n }\n values.set(key, value);\n return Promise.resolve(true);\n },\n delete(key) {\n values.delete(key);\n return Promise.resolve();\n },\n async withLock(key, fn) {\n const previous = locks.get(key) ?? Promise.resolve();\n let release: () => void = () => undefined;\n const current = new Promise<void>((resolve) => {\n release = resolve;\n });\n const queued = previous.catch(() => undefined).then(() => current);\n locks.set(key, queued);\n await previous.catch(() => undefined);\n try {\n return await fn();\n } finally {\n release();\n if (locks.get(key) === queued) {\n locks.delete(key);\n }\n }\n },\n };\n}\n","import { ArcaConfigurationError } from \"../errors\";\nimport { ARCA_LEASE_MS, withLease } from \"./lock\";\nimport { type ArcaStore, storeCall } from \"./types\";\n\ntype Row = { key?: string; value?: string };\n/** Uses the caller's SQL client; provision the table before use. */\nexport function createPostgresStore({\n query,\n table = \"arca_store\",\n}: {\n query: (text: string, params: string[]) => Promise<Row[] | { rows: Row[] }>;\n table?: string;\n}): ArcaStore {\n if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(table)) {\n throw new ArcaConfigurationError(\"Invalid ARCA store table identifier.\");\n }\n const name = `\"${table}\"`;\n const lease = Math.round(ARCA_LEASE_MS / 1000);\n const run = (text: string, params: string[]) =>\n storeCall(async () => {\n const result = await query(text, params);\n return Array.isArray(result) ? result : result.rows;\n });\n return {\n async get(key) {\n return (\n (await run(`SELECT value FROM ${name} WHERE key = $1`, [key]))[0]\n ?.value ?? null\n );\n },\n async set(key, value) {\n await run(\n `INSERT INTO ${name} (key, value) VALUES ($1, $2) ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = now()`,\n [key, value]\n );\n },\n async add(key, value) {\n return (\n (\n await run(\n `INSERT INTO ${name} (key, value) VALUES ($1, $2) ON CONFLICT DO NOTHING RETURNING key`,\n [key, value]\n )\n ).length > 0\n );\n },\n async delete(key) {\n await run(`DELETE FROM ${name} WHERE key = $1`, [key]);\n },\n withLock(key, fn) {\n // A lease row, not an advisory lock: it survives a transaction-mode\n // pooler, where a session-scoped lock would be taken on another backend.\n return withLease(\n key,\n {\n async acquire(owner) {\n const taken = await run(\n `INSERT INTO ${name} (key, value) VALUES ($1, $2) ON CONFLICT DO NOTHING RETURNING key`,\n [key, owner]\n );\n if (taken.length > 0) {\n return true;\n }\n const expired = await run(\n `UPDATE ${name} SET value = $2, updated_at = now() WHERE key = $1 AND updated_at < now() - interval '${lease} seconds' RETURNING key`,\n [key, owner]\n );\n return expired.length > 0;\n },\n async renew(owner) {\n await run(\n `UPDATE ${name} SET updated_at = now() WHERE key = $1 AND value = $2`,\n [key, owner]\n );\n },\n async release(owner) {\n await run(`DELETE FROM ${name} WHERE key = $1 AND value = $2`, [\n key,\n owner,\n ]);\n },\n },\n fn\n );\n },\n };\n}\n","import { ArcaConfigurationError } from \"../errors\";\nimport { ARCA_LEASE_MS, withLease } from \"./lock\";\nimport { type ArcaStore, storeCall } from \"./types\";\n\ntype RedisClient = {\n get(key: string): Promise<unknown>;\n set(key: string, value: string): Promise<unknown>;\n call?(...args: string[]): Promise<unknown>;\n del?(key: string): Promise<unknown>;\n};\n/** Uses ioredis or Upstash without importing either driver. */\nexport function createRedisStore(\n client: RedisClient,\n options: { flavor?: \"ioredis\" | \"upstash\" } = {}\n): ArcaStore {\n const flavor =\n options.flavor ??\n (typeof client.call === \"function\" ? \"ioredis\" : \"upstash\");\n if (flavor === \"ioredis\" && !client.call) {\n throw new ArcaConfigurationError(\n \"ARCA Redis ioredis flavor requires client.call.\"\n );\n }\n // The public structural type accepts ioredis's overloaded set method.\n // Only the Upstash flavor invokes its options-object overload.\n const upstashSet = client.set as (\n key: string,\n value: string,\n options: { nx?: true; xx?: true; px?: number }\n ) => Promise<unknown>;\n const read = async (key: string) => {\n const value = await client.get(key);\n if (value === null || value === undefined) {\n return null;\n }\n // Upstash can deserialize stored JSON automatically.\n return typeof value === \"string\" ? value : JSON.stringify(value);\n };\n // A lease, so a crashed holder frees the key; a renewal keeps a live one.\n const lease = (key: string, owner: string, mode: \"nx\" | \"xx\") =>\n storeCall(\n async () =>\n (flavor === \"ioredis\"\n ? await client.call?.(\n \"SET\",\n key,\n owner,\n mode.toUpperCase(),\n \"PX\",\n String(ARCA_LEASE_MS)\n )\n : await upstashSet.call(client, key, owner, {\n [mode]: true,\n px: ARCA_LEASE_MS,\n })) === \"OK\"\n );\n return {\n get: (key) => storeCall(() => read(key)),\n set: (key, value) =>\n storeCall(async () => {\n await client.set(key, value);\n }),\n add: (key, value) =>\n storeCall(\n async () =>\n (flavor === \"ioredis\"\n ? await client.call?.(\"SET\", key, value, \"NX\")\n : await upstashSet.call(client, key, value, { nx: true })) === \"OK\"\n ),\n ...(client.del\n ? {\n delete: (key: string) =>\n storeCall(async () => {\n await client.del?.(key);\n }),\n withLock: <T>(key: string, fn: () => Promise<T>) =>\n withLease(\n key,\n {\n acquire: (owner) => lease(key, owner, \"nx\"),\n renew: async (owner) => {\n // Check and set: only the holder extends its own lease.\n if ((await storeCall(() => read(key))) === owner) {\n await lease(key, owner, \"xx\");\n }\n },\n release: async (owner) => {\n await storeCall(async () => {\n if ((await read(key)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A,MACE,aACG,WAAW,YACR,MAAM,OAAO,OAAO,OAAO,KAAK,OAAO,IAAI,IAC3C,MAAM,WAAW,KAAK,QAAQ,KAAK,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO;AAAA,IACrE;AAAA,IACF,GAAI,OAAO,MACP;AAAA,MACE,QAAQ,CAAC,QACP,UAAU,YAAY;AACpB,cAAM,OAAO,MAAM,GAAG;AAAA,MACxB,CAAC;AAAA,MACH,UAAU,CAAI,KAAa,OACzB;AAAA,QACE;AAAA,QACA;AAAA,UACE,SAAS,CAAC,UAAU,MAAM,KAAK,OAAO,IAAI;AAAA,UAC1C,OAAO,OAAO,UAAU;AAEtB,gBAAK,MAAM,UAAU,MAAM,KAAK,GAAG,CAAC,MAAO,OAAO;AAChD,oBAAM,MAAM,KAAK,OAAO,IAAI;AAAA,YAC9B;AAAA,UACF;AAAA,UACA,SAAS,OAAO,UAAU;AACxB,kBAAM,UAAU,YAAY;AAC1B,kBAAK,MAAM,KAAK,GAAG,MAAO,OAAO;AAC/B,sBAAM,OAAO,MAAM,GAAG;AAAA,cACxB;AAAA,YACF,CAAC;AAAA,UACH;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA,IACJ,IACA,CAAC;AAAA,EACP;AACF;","names":[]}
|
package/dist/padron.mjs
CHANGED
package/dist/wsfe.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as ArcaClientConfig } from './types-Su7QwloQ.js';
|
|
2
2
|
import { W as WsaaAuthModule, S as SoapTransport } from './index-DAC3edtw.js';
|
|
3
|
-
import { e as ArcaAuthorizationOutcome, s as ArcaVoucherLookupResult } from './fiscal-evidence-
|
|
3
|
+
import { e as ArcaAuthorizationOutcome, s as ArcaVoucherLookupResult } from './fiscal-evidence-Bg4o9nxt.js';
|
|
4
4
|
|
|
5
5
|
/** Accepted public date inputs for WSFE request fields. */
|
|
6
6
|
type WsfeDateInput = `${number}${number}${number}${number}-${number}${number}-${number}${number}` | `${number}${number}${number}${number}${number}${number}${number}${number}`;
|