facturas 0.5.0 → 0.5.2

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/wsfe.d.ts CHANGED
@@ -79,6 +79,7 @@ type WsfeAuthorizeVoucherInput = {
79
79
  representedTaxId?: number | string;
80
80
  data: WsfeVoucherInput;
81
81
  voucherNumber: number;
82
+ forceRefresh?: boolean;
82
83
  };
83
84
  /** Result of a successful WSFE voucher authorization. */
84
85
  type WsfeAuthorizationResult = {
@@ -140,13 +141,14 @@ type WsfeService = {
140
141
  createNextVoucher(input: {
141
142
  representedTaxId?: number | string;
142
143
  data: WsfeVoucherInput;
144
+ forceRefresh?: boolean;
143
145
  }): Promise<WsfeAuthorizationResult>;
144
146
  /** Returns the next available voucher number for the given sales point and type. */
145
147
  getNextVoucherNumber(input: {
146
148
  representedTaxId?: number | string;
147
149
  salesPoint: number;
148
150
  voucherType: number;
149
- forceAuthRefresh?: boolean;
151
+ forceRefresh?: boolean;
150
152
  }): Promise<number>;
151
153
  /**
152
154
  * @deprecated Use `getNextVoucherNumber()` instead.
@@ -156,58 +158,58 @@ type WsfeService = {
156
158
  representedTaxId?: number | string;
157
159
  salesPoint: number;
158
160
  voucherType: number;
159
- forceAuthRefresh?: boolean;
161
+ forceRefresh?: boolean;
160
162
  }): Promise<number>;
161
163
  /** Lists all configured points of sale for the taxpayer. */
162
164
  getSalesPoints(input: {
163
165
  representedTaxId?: number | string;
164
- forceAuthRefresh?: boolean;
166
+ forceRefresh?: boolean;
165
167
  }): Promise<WsfeSalesPoint[]>;
166
168
  /** Lists voucher types accepted by WSFE. */
167
169
  getVoucherTypes(input: {
168
170
  representedTaxId?: number | string;
169
- forceAuthRefresh?: boolean;
171
+ forceRefresh?: boolean;
170
172
  }): Promise<WsfeCatalogEntry[]>;
171
173
  /** Lists document types accepted by WSFE. */
172
174
  getDocumentTypes(input: {
173
175
  representedTaxId?: number | string;
174
- forceAuthRefresh?: boolean;
176
+ forceRefresh?: boolean;
175
177
  }): Promise<WsfeCatalogEntry[]>;
176
178
  /** Lists concept types accepted by WSFE. */
177
179
  getConceptTypes(input: {
178
180
  representedTaxId?: number | string;
179
- forceAuthRefresh?: boolean;
181
+ forceRefresh?: boolean;
180
182
  }): Promise<WsfeCatalogEntry[]>;
181
183
  /** Lists supported currency types. */
182
184
  getCurrencyTypes(input: {
183
185
  representedTaxId?: number | string;
184
- forceAuthRefresh?: boolean;
186
+ forceRefresh?: boolean;
185
187
  }): Promise<WsfeCurrencyType[]>;
186
188
  /** Lists VAT rates accepted by WSFE. */
187
189
  getVatRates(input: {
188
190
  representedTaxId?: number | string;
189
- forceAuthRefresh?: boolean;
191
+ forceRefresh?: boolean;
190
192
  }): Promise<WsfeCatalogEntry[]>;
191
193
  /** Lists tax types accepted by WSFE. */
192
194
  getTaxTypes(input: {
193
195
  representedTaxId?: number | string;
194
- forceAuthRefresh?: boolean;
196
+ forceRefresh?: boolean;
195
197
  }): Promise<WsfeCatalogEntry[]>;
196
198
  /** Lists optional field types accepted by WSFE. */
197
199
  getOptionalTypes(input: {
198
200
  representedTaxId?: number | string;
199
- forceAuthRefresh?: boolean;
201
+ forceRefresh?: boolean;
200
202
  }): Promise<WsfeCatalogEntry[]>;
201
203
  /** Lists activities enabled for the taxpayer. */
202
204
  getActivities(input: {
203
205
  representedTaxId?: number | string;
204
- forceAuthRefresh?: boolean;
206
+ forceRefresh?: boolean;
205
207
  }): Promise<WsfeActivityType[]>;
206
208
  /** Lists receiver VAT condition values accepted by WSFE. */
207
209
  getReceiverVatConditions(input: {
208
210
  representedTaxId?: number | string;
209
211
  voucherClass?: string;
210
- forceAuthRefresh?: boolean;
212
+ forceRefresh?: boolean;
211
213
  }): Promise<WsfeReceiverVatCondition[]>;
212
214
  /** Reports WSFE backend status without requiring taxpayer authorization. */
213
215
  getServerStatus(): Promise<WsfeServerStatus>;
@@ -215,7 +217,7 @@ type WsfeService = {
215
217
  getQuotation(input: {
216
218
  currencyId: string;
217
219
  representedTaxId?: number | string;
218
- forceAuthRefresh?: boolean;
220
+ forceRefresh?: boolean;
219
221
  }): Promise<WsfeQuotation>;
220
222
  /** Retrieves details for a specific voucher. Returns `null` if not found. */
221
223
  getVoucherInfo(input: {
@@ -223,6 +225,7 @@ type WsfeService = {
223
225
  number: number;
224
226
  salesPoint: number;
225
227
  voucherType: number;
228
+ forceRefresh?: boolean;
226
229
  }): Promise<WsfeVoucherInfo | null>;
227
230
  };
228
231
  type CreateWsfeServiceOptions = {
@@ -31,7 +31,7 @@ function createWsfeService(options) {
31
31
  async function executeWsfeAuthenticatedOperation(operation, input, body = {}) {
32
32
  const auth = await options.auth.login("wsfe", {
33
33
  representedTaxId: input.representedTaxId,
34
- forceRefresh: input.forceAuthRefresh
34
+ forceRefresh: input.forceRefresh
35
35
  });
36
36
  const response = await options.soap.execute({
37
37
  service: "wsfe",
@@ -59,13 +59,13 @@ function createWsfeService(options) {
59
59
  representedTaxId,
60
60
  salesPoint,
61
61
  voucherType,
62
- forceAuthRefresh
62
+ forceRefresh
63
63
  }) {
64
64
  const result = await executeWsfeAuthenticatedOperation(
65
65
  "FECompUltimoAutorizado",
66
66
  {
67
67
  representedTaxId,
68
- forceAuthRefresh
68
+ forceRefresh
69
69
  },
70
70
  {
71
71
  PtoVta: salesPoint,
@@ -77,29 +77,35 @@ function createWsfeService(options) {
77
77
  async function getWsfeCatalog(operation, resultKey, input) {
78
78
  const result = await executeWsfeAuthenticatedOperation(operation, {
79
79
  representedTaxId: input.representedTaxId,
80
- forceAuthRefresh: input.forceAuthRefresh
80
+ forceRefresh: input.forceRefresh
81
81
  });
82
82
  return getWsfeResultEntries(result, resultKey).map(mapWsfeCatalogEntry);
83
83
  }
84
84
  function authorizeVoucher({
85
85
  representedTaxId,
86
86
  data,
87
- voucherNumber
87
+ voucherNumber,
88
+ forceRefresh
88
89
  }) {
89
90
  const normalizedInput = normalizeWsfeVoucherInput(data);
90
91
  return authorizeNormalizedVoucher({
91
92
  representedTaxId,
92
93
  data: normalizedInput,
93
- voucherNumber
94
+ voucherNumber,
95
+ forceRefresh
94
96
  });
95
97
  }
96
98
  async function authorizeNormalizedVoucher({
97
99
  representedTaxId,
98
100
  data: normalizedInput,
99
- voucherNumber
101
+ voucherNumber,
102
+ forceRefresh
100
103
  }) {
101
104
  const requestData = mapWsfeVoucherInput(normalizedInput, voucherNumber);
102
- const auth = await options.auth.login("wsfe", { representedTaxId });
105
+ const auth = await options.auth.login("wsfe", {
106
+ representedTaxId,
107
+ forceRefresh
108
+ });
103
109
  const response = await options.soap.execute({
104
110
  service: "wsfe",
105
111
  operation: "FECAESolicitar",
@@ -139,12 +145,13 @@ function createWsfeService(options) {
139
145
  }
140
146
  return {
141
147
  authorizeVoucher,
142
- async createNextVoucher({ representedTaxId, data }) {
148
+ async createNextVoucher({ representedTaxId, data, forceRefresh }) {
143
149
  const normalizedInput = normalizeWsfeVoucherInput(data);
144
150
  const voucherNumber = await getNextVoucherNumber({
145
151
  representedTaxId,
146
152
  salesPoint: normalizedInput.salesPoint,
147
- voucherType: normalizedInput.voucherType
153
+ voucherType: normalizedInput.voucherType,
154
+ forceRefresh
148
155
  });
149
156
  return authorizeNormalizedVoucher({
150
157
  representedTaxId,
@@ -156,12 +163,12 @@ function createWsfeService(options) {
156
163
  getLastVoucher(input) {
157
164
  return getNextVoucherNumber(input);
158
165
  },
159
- async getSalesPoints({ representedTaxId, forceAuthRefresh }) {
166
+ async getSalesPoints({ representedTaxId, forceRefresh }) {
160
167
  const result = await executeWsfeAuthenticatedOperation(
161
168
  "FEParamGetPtosVenta",
162
169
  {
163
170
  representedTaxId,
164
- forceAuthRefresh
171
+ forceRefresh
165
172
  }
166
173
  );
167
174
  const rawPoints = result.ResultGet?.PtoVenta;
@@ -180,12 +187,12 @@ function createWsfeService(options) {
180
187
  getConceptTypes(input) {
181
188
  return getWsfeCatalog("FEParamGetTiposConcepto", "ConceptoTipo", input);
182
189
  },
183
- async getCurrencyTypes({ representedTaxId, forceAuthRefresh }) {
190
+ async getCurrencyTypes({ representedTaxId, forceRefresh }) {
184
191
  const result = await executeWsfeAuthenticatedOperation(
185
192
  "FEParamGetTiposMonedas",
186
193
  {
187
194
  representedTaxId,
188
- forceAuthRefresh
195
+ forceRefresh
189
196
  }
190
197
  );
191
198
  return getWsfeResultEntries(result, "Moneda").map(mapWsfeCurrencyType);
@@ -199,12 +206,12 @@ function createWsfeService(options) {
199
206
  getOptionalTypes(input) {
200
207
  return getWsfeCatalog("FEParamGetTiposOpcional", "OpcionalTipo", input);
201
208
  },
202
- async getActivities({ representedTaxId, forceAuthRefresh }) {
209
+ async getActivities({ representedTaxId, forceRefresh }) {
203
210
  const result = await executeWsfeAuthenticatedOperation(
204
211
  "FEParamGetActividades",
205
212
  {
206
213
  representedTaxId,
207
- forceAuthRefresh
214
+ forceRefresh
208
215
  }
209
216
  );
210
217
  return getWsfeResultEntries(result, "ActividadesTipo").map(
@@ -214,13 +221,13 @@ function createWsfeService(options) {
214
221
  async getReceiverVatConditions({
215
222
  representedTaxId,
216
223
  voucherClass,
217
- forceAuthRefresh
224
+ forceRefresh
218
225
  }) {
219
226
  const result = await executeWsfeAuthenticatedOperation(
220
227
  "FEParamGetCondicionIvaReceptor",
221
228
  {
222
229
  representedTaxId,
223
- forceAuthRefresh
230
+ forceRefresh
224
231
  },
225
232
  {
226
233
  ...voucherClass === void 0 ? {} : { ClaseCmp: voucherClass }
@@ -234,12 +241,12 @@ function createWsfeService(options) {
234
241
  const result = await executeWsfeOperation("FEDummy");
235
242
  return mapWsfeServerStatus(result);
236
243
  },
237
- async getQuotation({ currencyId, representedTaxId, forceAuthRefresh }) {
244
+ async getQuotation({ currencyId, representedTaxId, forceRefresh }) {
238
245
  const result = await executeWsfeAuthenticatedOperation(
239
246
  "FEParamGetCotizacion",
240
247
  {
241
248
  representedTaxId,
242
- forceAuthRefresh
249
+ forceRefresh
243
250
  },
244
251
  {
245
252
  MonId: currencyId
@@ -252,12 +259,14 @@ function createWsfeService(options) {
252
259
  representedTaxId,
253
260
  number,
254
261
  salesPoint,
255
- voucherType
262
+ voucherType,
263
+ forceRefresh
256
264
  }) {
257
265
  const result = await executeWsfeAuthenticatedOperation(
258
266
  "FECompConsultar",
259
267
  {
260
- representedTaxId
268
+ representedTaxId,
269
+ forceRefresh
261
270
  },
262
271
  {
263
272
  FeCompConsReq: {
@@ -630,4 +639,4 @@ function getWsfeResultEntries(result, key) {
630
639
  export {
631
640
  createWsfeService
632
641
  };
633
- //# sourceMappingURL=wsfe.js.map
642
+ //# sourceMappingURL=wsfe.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts","../src/services/wsfe.ts"],"sourcesContent":["import type { ArcaServiceName } from \"./internal/types\";\n\n/** Base error class for all ARCA-related errors. */\nexport class ArcaError extends Error {\n readonly code: string;\n override readonly name: string = \"ArcaError\";\n\n constructor(message: string, code = \"ARCA_ERROR\", options?: ErrorOptions) {\n super(message, options);\n this.code = code;\n }\n}\n\n/** Thrown when the ARCA client configuration is missing or invalid. */\nexport class ArcaConfigurationError extends ArcaError {\n override readonly name: string = \"ArcaConfigurationError\";\n\n constructor(message: string, options?: ErrorOptions) {\n super(message, \"ARCA_CONFIGURATION_ERROR\", options);\n }\n}\n\n/** Thrown when caller-provided input data is missing or invalid. */\nexport class ArcaInputError extends ArcaError {\n override readonly name: string = \"ArcaInputError\";\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_INPUT_ERROR\", options);\n this.detail = options?.detail;\n }\n}\n\n/** Thrown when an HTTP request to an ARCA endpoint fails at the transport level. */\nexport class ArcaTransportError extends ArcaError {\n override readonly name: string = \"ArcaTransportError\";\n readonly statusCode?: number;\n readonly contentType?: string;\n readonly responseBody?: string;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n statusCode?: number;\n contentType?: string;\n responseBody?: string;\n }\n ) {\n super(message, \"ARCA_TRANSPORT_ERROR\", options);\n this.statusCode = options?.statusCode;\n this.contentType = options?.contentType;\n this.responseBody = options?.responseBody;\n }\n}\n\n/** Thrown when the SOAP response contains a Fault element. */\nexport class ArcaSoapFaultError extends ArcaError {\n override readonly name: string = \"ArcaSoapFaultError\";\n readonly faultCode?: string;\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n faultCode?: string;\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_SOAP_FAULT\", options);\n this.faultCode = options?.faultCode;\n this.detail = options?.detail;\n }\n}\n\n/** Thrown when a response cannot be parsed as a valid SOAP envelope. */\nexport class ArcaInvalidSoapResponseError extends ArcaError {\n override readonly name: string = \"ArcaInvalidSoapResponseError\";\n readonly service?: ArcaServiceName;\n readonly operation?: string;\n readonly endpointUrl?: string;\n readonly statusCode?: number;\n readonly contentType?: string;\n readonly responseBodyLength?: number;\n readonly responseBodyPreview?: string;\n readonly parsedDetail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n service?: ArcaServiceName;\n operation?: string;\n endpointUrl?: string;\n statusCode?: number;\n contentType?: string;\n responseBodyLength?: number;\n responseBodyPreview?: string;\n parsedDetail?: unknown;\n }\n ) {\n super(message, \"ARCA_INVALID_SOAP_RESPONSE\", options);\n this.service = options?.service;\n this.operation = options?.operation;\n this.endpointUrl = options?.endpointUrl;\n this.statusCode = options?.statusCode;\n this.contentType = options?.contentType;\n this.responseBodyLength = options?.responseBodyLength;\n this.responseBodyPreview = options?.responseBodyPreview;\n this.parsedDetail = options?.parsedDetail;\n }\n}\n\n/** Thrown when an ARCA service (WSFE, WSMTXCA, Padron) returns a domain-level error. */\nexport class ArcaServiceError extends ArcaError {\n override readonly name: string = \"ArcaServiceError\";\n readonly serviceCode?: string | number;\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n serviceCode?: string | number;\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_SERVICE_ERROR\", options);\n this.serviceCode = options?.serviceCode;\n this.detail = options?.detail;\n }\n}\n","import { ArcaInputError, ArcaServiceError } from \"../errors\";\nimport type { ArcaClientConfig, ArcaRepresentedTaxId } from \"../internal/types\";\nimport type { SoapTransport } from \"../soap\";\nimport type { WsaaAuthModule } from \"../wsaa\";\n\n/** Accepted public date inputs for WSFE request fields. */\nexport type WsfeDateInput =\n | `${number}${number}${number}${number}-${number}${number}-${number}${number}`\n | `${number}${number}${number}${number}${number}${number}${number}${number}`;\n\n/** An associated voucher referenced by a WSFE invoice request. */\nexport type WsfeAssociatedVoucher = {\n type: number;\n salesPoint: number;\n number: number;\n taxId?: string;\n voucherDate?: WsfeDateInput;\n};\n\n/** An associated period used by WSFE credit/debit notes without associated vouchers. */\nexport type WsfeAssociatedPeriod = {\n startDate: WsfeDateInput;\n endDate: WsfeDateInput;\n};\n\n/** A tax (tributo) item in a WSFE invoice request. */\nexport type WsfeTax = {\n id: number;\n description?: string;\n baseAmount: number;\n rate: number;\n amount: number;\n};\n\n/** A VAT rate (alícuota IVA) item in a WSFE invoice request. */\nexport type WsfeVatRate = {\n id: number;\n baseAmount: number;\n amount: number;\n};\n\n/** An optional field (campo opcional) in a WSFE invoice request. */\nexport type WsfeOptionalField = {\n id: string;\n value: string;\n};\n\n/** A buyer (comprador) in a WSFE invoice request. */\nexport type WsfeBuyer = {\n documentType: number;\n documentNumber: number;\n percentage: number;\n};\n\n/** An activity associated with a WSFE invoice request. */\nexport type WsfeActivity = {\n id: number;\n};\n\n/** Input data for authorizing a WSFE voucher. */\nexport type WsfeVoucherInput = {\n salesPoint: number;\n voucherType: number;\n concept: number;\n documentType: number;\n documentNumber: number;\n receiverVatConditionId?: number;\n voucherDate: WsfeDateInput;\n totalAmount: number;\n nonTaxableAmount: number;\n netAmount: number;\n exemptAmount: number;\n taxAmount: number;\n vatAmount: number;\n currencyId: string;\n exchangeRate?: number;\n sameCurrencyForeignCancellation?: \"S\" | \"N\";\n serviceStartDate?: WsfeDateInput;\n serviceEndDate?: WsfeDateInput;\n paymentDueDate?: WsfeDateInput;\n associatedVouchers?: WsfeAssociatedVoucher[];\n associatedPeriod?: WsfeAssociatedPeriod;\n taxes?: WsfeTax[];\n vatRates?: WsfeVatRate[];\n optionalFields?: WsfeOptionalField[];\n buyers?: WsfeBuyer[];\n activities?: WsfeActivity[];\n};\n\n/** Input for authorizing a WSFE voucher with an explicit voucher number. */\nexport type WsfeAuthorizeVoucherInput = {\n representedTaxId?: number | string;\n data: WsfeVoucherInput;\n voucherNumber: number;\n forceRefresh?: boolean;\n};\n\n/** Result of a successful WSFE voucher authorization. */\nexport type WsfeAuthorizationResult = {\n cae: string;\n caeExpiry: string;\n voucherNumber: number;\n raw: Record<string, unknown>;\n};\n\n/** A point-of-sale entry returned by {@link WsfeService.getSalesPoints}. */\nexport type WsfeSalesPoint = {\n number: number;\n emissionType?: string;\n blocked?: string;\n deletedSince?: string;\n};\n\n/** Voucher details returned by {@link WsfeService.getVoucherInfo}. */\nexport type WsfeVoucherInfo = {\n voucherNumber: number;\n voucherDate?: string;\n salesPoint?: number;\n voucherType?: number;\n totalAmount?: number;\n result?: string;\n cae?: string;\n caeExpiry?: string;\n raw: Record<string, unknown>;\n};\n\nexport type WsfeCatalogEntry = {\n id: number;\n description: string;\n};\n\nexport type WsfeActivityType = WsfeCatalogEntry & {\n order: number;\n};\n\nexport type WsfeReceiverVatCondition = WsfeCatalogEntry & {\n voucherClass: string;\n};\n\nexport type WsfeCurrencyType = {\n id: string;\n description: string;\n validFrom: string;\n validTo: string;\n};\n\nexport type WsfeServerStatus = {\n appServer: string;\n dbServer: string;\n authServer: string;\n};\n\nexport type WsfeQuotation = {\n currencyId: string;\n rate: number;\n date: string;\n};\n\n/** WSFE electronic invoicing service. */\nexport type WsfeService = {\n /** Authorizes a voucher with the explicit number sent as `CbteDesde` and `CbteHasta`. */\n authorizeVoucher(\n input: WsfeAuthorizeVoucherInput\n ): Promise<WsfeAuthorizationResult>;\n /** Authorizes a new voucher by fetching the next number and requesting a CAE. */\n createNextVoucher(input: {\n representedTaxId?: number | string;\n data: WsfeVoucherInput;\n forceRefresh?: boolean;\n }): Promise<WsfeAuthorizationResult>;\n /** Returns the next available voucher number for the given sales point and type. */\n getNextVoucherNumber(input: {\n representedTaxId?: number | string;\n salesPoint: number;\n voucherType: number;\n forceRefresh?: boolean;\n }): Promise<number>;\n /**\n * @deprecated Use `getNextVoucherNumber()` instead.\n * Returns the next available voucher number, not the last authorized one.\n */\n getLastVoucher(input: {\n representedTaxId?: number | string;\n salesPoint: number;\n voucherType: number;\n forceRefresh?: boolean;\n }): Promise<number>;\n /** Lists all configured points of sale for the taxpayer. */\n getSalesPoints(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeSalesPoint[]>;\n /** Lists voucher types accepted by WSFE. */\n getVoucherTypes(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeCatalogEntry[]>;\n /** Lists document types accepted by WSFE. */\n getDocumentTypes(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeCatalogEntry[]>;\n /** Lists concept types accepted by WSFE. */\n getConceptTypes(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeCatalogEntry[]>;\n /** Lists supported currency types. */\n getCurrencyTypes(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeCurrencyType[]>;\n /** Lists VAT rates accepted by WSFE. */\n getVatRates(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeCatalogEntry[]>;\n /** Lists tax types accepted by WSFE. */\n getTaxTypes(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeCatalogEntry[]>;\n /** Lists optional field types accepted by WSFE. */\n getOptionalTypes(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeCatalogEntry[]>;\n /** Lists activities enabled for the taxpayer. */\n getActivities(input: {\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeActivityType[]>;\n /** Lists receiver VAT condition values accepted by WSFE. */\n getReceiverVatConditions(input: {\n representedTaxId?: number | string;\n voucherClass?: string;\n forceRefresh?: boolean;\n }): Promise<WsfeReceiverVatCondition[]>;\n /** Reports WSFE backend status without requiring taxpayer authorization. */\n getServerStatus(): Promise<WsfeServerStatus>;\n /** Returns the exchange rate for a given currency. */\n getQuotation(input: {\n currencyId: string;\n representedTaxId?: number | string;\n forceRefresh?: boolean;\n }): Promise<WsfeQuotation>;\n /** Retrieves details for a specific voucher. Returns `null` if not found. */\n getVoucherInfo(input: {\n representedTaxId?: number | string;\n number: number;\n salesPoint: number;\n voucherType: number;\n forceRefresh?: boolean;\n }): Promise<WsfeVoucherInfo | null>;\n};\n\nexport type CreateWsfeServiceOptions = {\n config: ArcaClientConfig;\n auth: WsaaAuthModule;\n soap: SoapTransport;\n};\n\ntype NormalizedWsfeAssociatedVoucher = Omit<\n WsfeAssociatedVoucher,\n \"voucherDate\"\n> & {\n voucherDate?: string;\n};\n\ntype NormalizedWsfeAssociatedPeriod = {\n startDate: string;\n endDate: string;\n};\n\ntype NormalizedWsfeVoucherInput = Omit<\n WsfeVoucherInput,\n | \"voucherDate\"\n | \"serviceStartDate\"\n | \"serviceEndDate\"\n | \"paymentDueDate\"\n | \"associatedVouchers\"\n | \"associatedPeriod\"\n> & {\n voucherDate: string;\n serviceStartDate?: string;\n serviceEndDate?: string;\n paymentDueDate?: string;\n associatedVouchers?: NormalizedWsfeAssociatedVoucher[];\n associatedPeriod?: NormalizedWsfeAssociatedPeriod;\n};\n\n/** Creates a WSFE service instance wired with authentication and SOAP transport. */\nexport function createWsfeService(\n options: CreateWsfeServiceOptions\n): WsfeService {\n async function executeWsfeAuthenticatedOperation(\n operation: string,\n input: {\n representedTaxId?: ArcaRepresentedTaxId;\n forceRefresh?: boolean;\n },\n body: Record<string, unknown> = {}\n ) {\n const auth = await options.auth.login(\"wsfe\", {\n representedTaxId: input.representedTaxId,\n forceRefresh: input.forceRefresh,\n });\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service: \"wsfe\",\n operation,\n body: {\n Auth: createWsfeAuth(\n input.representedTaxId ?? options.config.taxId,\n auth.token,\n auth.sign\n ),\n ...body,\n },\n });\n\n return unwrapWsfeOperationResult(operation, response.result);\n }\n\n async function executeWsfeOperation(\n operation: string,\n body: Record<string, unknown> = {}\n ) {\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service: \"wsfe\",\n operation,\n body,\n });\n\n return unwrapWsfeOperationResult(operation, response.result);\n }\n\n async function getNextVoucherNumber({\n representedTaxId,\n salesPoint,\n voucherType,\n forceRefresh,\n }: {\n representedTaxId?: number | string;\n salesPoint: number;\n voucherType: number;\n forceRefresh?: boolean;\n }) {\n const result = await executeWsfeAuthenticatedOperation(\n \"FECompUltimoAutorizado\",\n {\n representedTaxId,\n forceRefresh,\n },\n {\n PtoVta: salesPoint,\n CbteTipo: voucherType,\n }\n );\n return Number(result.CbteNro ?? 0) + 1;\n }\n\n async function getWsfeCatalog(\n operation: string,\n resultKey: string,\n input: {\n representedTaxId?: ArcaRepresentedTaxId;\n forceRefresh?: boolean;\n }\n ): Promise<WsfeCatalogEntry[]> {\n const result = await executeWsfeAuthenticatedOperation(operation, {\n representedTaxId: input.representedTaxId,\n forceRefresh: input.forceRefresh,\n });\n return getWsfeResultEntries(result, resultKey).map(mapWsfeCatalogEntry);\n }\n\n function authorizeVoucher({\n representedTaxId,\n data,\n voucherNumber,\n forceRefresh,\n }: WsfeAuthorizeVoucherInput): Promise<WsfeAuthorizationResult> {\n const normalizedInput = normalizeWsfeVoucherInput(data);\n return authorizeNormalizedVoucher({\n representedTaxId,\n data: normalizedInput,\n voucherNumber,\n forceRefresh,\n });\n }\n\n async function authorizeNormalizedVoucher({\n representedTaxId,\n data: normalizedInput,\n voucherNumber,\n forceRefresh,\n }: {\n representedTaxId?: number | string;\n data: NormalizedWsfeVoucherInput;\n voucherNumber: number;\n forceRefresh?: boolean;\n }): Promise<WsfeAuthorizationResult> {\n const requestData = mapWsfeVoucherInput(normalizedInput, voucherNumber);\n\n const auth = await options.auth.login(\"wsfe\", {\n representedTaxId,\n forceRefresh,\n });\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service: \"wsfe\",\n operation: \"FECAESolicitar\",\n body: {\n Auth: createWsfeAuth(\n representedTaxId ?? options.config.taxId,\n auth.token,\n auth.sign\n ),\n FeCAEReq: {\n FeCabReq: {\n CantReg: 1,\n PtoVta: normalizedInput.salesPoint,\n CbteTipo: normalizedInput.voucherType,\n },\n FeDetReq: {\n FECAEDetRequest: requestData,\n },\n },\n },\n });\n\n const result = unwrapWsfeOperationResult(\"FECAESolicitar\", response.result);\n const detailResponse = normalizeWsfeDetailResponse(result);\n const cae = detailResponse.CAE;\n const caeExpiry = detailResponse.CAEFchVto;\n\n if (typeof cae !== \"string\" || typeof caeExpiry !== \"string\") {\n throw new ArcaServiceError(\"WSFE did not return CAE authorization data\", {\n detail: result,\n });\n }\n\n return {\n cae,\n caeExpiry: String(caeExpiry),\n voucherNumber,\n raw: result,\n };\n }\n\n return {\n authorizeVoucher,\n async createNextVoucher({ representedTaxId, data, forceRefresh }) {\n const normalizedInput = normalizeWsfeVoucherInput(data);\n\n const voucherNumber = await getNextVoucherNumber({\n representedTaxId,\n salesPoint: normalizedInput.salesPoint,\n voucherType: normalizedInput.voucherType,\n forceRefresh,\n });\n\n return authorizeNormalizedVoucher({\n representedTaxId,\n data: normalizedInput,\n voucherNumber,\n });\n },\n getNextVoucherNumber,\n getLastVoucher(input) {\n return getNextVoucherNumber(input);\n },\n async getSalesPoints({ representedTaxId, forceRefresh }) {\n const result = await executeWsfeAuthenticatedOperation(\n \"FEParamGetPtosVenta\",\n {\n representedTaxId,\n forceRefresh,\n }\n );\n const rawPoints = (\n result.ResultGet as Record<string, unknown> | undefined\n )?.PtoVenta;\n if (!rawPoints) {\n return [];\n }\n const entries = Array.isArray(rawPoints) ? rawPoints : [rawPoints];\n return entries.map(mapWsfeSalesPoint);\n },\n getVoucherTypes(input) {\n return getWsfeCatalog(\"FEParamGetTiposCbte\", \"CbteTipo\", input);\n },\n getDocumentTypes(input) {\n return getWsfeCatalog(\"FEParamGetTiposDoc\", \"DocTipo\", input);\n },\n getConceptTypes(input) {\n return getWsfeCatalog(\"FEParamGetTiposConcepto\", \"ConceptoTipo\", input);\n },\n async getCurrencyTypes({ representedTaxId, forceRefresh }) {\n const result = await executeWsfeAuthenticatedOperation(\n \"FEParamGetTiposMonedas\",\n {\n representedTaxId,\n forceRefresh,\n }\n );\n return getWsfeResultEntries(result, \"Moneda\").map(mapWsfeCurrencyType);\n },\n getVatRates(input) {\n return getWsfeCatalog(\"FEParamGetTiposIva\", \"IvaTipo\", input);\n },\n getTaxTypes(input) {\n return getWsfeCatalog(\"FEParamGetTiposTributos\", \"TributoTipo\", input);\n },\n getOptionalTypes(input) {\n return getWsfeCatalog(\"FEParamGetTiposOpcional\", \"OpcionalTipo\", input);\n },\n async getActivities({ representedTaxId, forceRefresh }) {\n const result = await executeWsfeAuthenticatedOperation(\n \"FEParamGetActividades\",\n {\n representedTaxId,\n forceRefresh,\n }\n );\n return getWsfeResultEntries(result, \"ActividadesTipo\").map(\n mapWsfeActivityType\n );\n },\n async getReceiverVatConditions({\n representedTaxId,\n voucherClass,\n forceRefresh,\n }) {\n const result = await executeWsfeAuthenticatedOperation(\n \"FEParamGetCondicionIvaReceptor\",\n {\n representedTaxId,\n forceRefresh,\n },\n {\n ...(voucherClass === undefined ? {} : { ClaseCmp: voucherClass }),\n }\n );\n return getWsfeResultEntries(result, \"CondicionIvaReceptor\").map(\n mapWsfeReceiverVatCondition\n );\n },\n async getServerStatus() {\n const result = await executeWsfeOperation(\"FEDummy\");\n return mapWsfeServerStatus(result);\n },\n async getQuotation({ currencyId, representedTaxId, forceRefresh }) {\n const result = await executeWsfeAuthenticatedOperation(\n \"FEParamGetCotizacion\",\n {\n representedTaxId,\n forceRefresh,\n },\n {\n MonId: currencyId,\n }\n );\n const raw =\n (result.ResultGet as Record<string, unknown> | undefined) ?? {};\n return mapWsfeQuotation(raw);\n },\n async getVoucherInfo({\n representedTaxId,\n number,\n salesPoint,\n voucherType,\n forceRefresh,\n }) {\n const result = await executeWsfeAuthenticatedOperation(\n \"FECompConsultar\",\n {\n representedTaxId,\n forceRefresh,\n },\n {\n FeCompConsReq: {\n CbteNro: number,\n PtoVta: salesPoint,\n CbteTipo: voucherType,\n },\n }\n );\n const raw = (result.ResultGet as Record<string, unknown> | null) ?? null;\n if (!raw) {\n return null;\n }\n return mapWsfeVoucherInfo(raw);\n },\n };\n}\n\nfunction mapWsfeVoucherInput(\n input: NormalizedWsfeVoucherInput,\n voucherNumber: number\n): Record<string, unknown> {\n const sendsSameForeignCurrencyCancellation =\n input.currencyId !== \"PES\" && input.sameCurrencyForeignCancellation === \"S\";\n\n if (\n input.exchangeRate === undefined &&\n !sendsSameForeignCurrencyCancellation\n ) {\n throw new ArcaInputError(\n \"exchangeRate is required unless sameCurrencyForeignCancellation is S for a foreign-currency voucher.\"\n );\n }\n\n const data: Record<string, unknown> = {\n Concepto: input.concept,\n DocTipo: input.documentType,\n DocNro: input.documentNumber,\n CbteDesde: voucherNumber,\n CbteHasta: voucherNumber,\n CbteFch: input.voucherDate,\n ImpTotal: input.totalAmount,\n ImpTotConc: input.nonTaxableAmount,\n ImpNeto: input.netAmount,\n ImpOpEx: input.exemptAmount,\n ImpTrib: input.taxAmount,\n ImpIVA: input.vatAmount,\n MonId: input.currencyId,\n PtoVta: input.salesPoint,\n CbteTipo: input.voucherType,\n };\n\n if (!sendsSameForeignCurrencyCancellation) {\n data.MonCotiz = input.exchangeRate;\n }\n\n if (input.receiverVatConditionId !== undefined) {\n data.CondicionIVAReceptorId = input.receiverVatConditionId;\n }\n\n if (\n input.currencyId !== \"PES\" &&\n input.sameCurrencyForeignCancellation !== undefined\n ) {\n data.CanMisMonExt = input.sameCurrencyForeignCancellation;\n }\n\n if (input.serviceStartDate !== undefined) {\n data.FchServDesde = input.serviceStartDate;\n }\n if (input.serviceEndDate !== undefined) {\n data.FchServHasta = input.serviceEndDate;\n }\n if (input.paymentDueDate !== undefined) {\n data.FchVtoPago = input.paymentDueDate;\n }\n\n if (input.associatedVouchers) {\n data.CbtesAsoc = {\n CbteAsoc: input.associatedVouchers.map((v) => ({\n Tipo: v.type,\n PtoVta: v.salesPoint,\n Nro: v.number,\n ...(v.taxId === undefined ? {} : { Cuit: v.taxId }),\n ...(v.voucherDate === undefined ? {} : { CbteFch: v.voucherDate }),\n })),\n };\n }\n\n if (input.associatedPeriod) {\n data.PeriodoAsoc = {\n FchDesde: input.associatedPeriod.startDate,\n FchHasta: input.associatedPeriod.endDate,\n };\n }\n\n if (input.taxes) {\n data.Tributos = {\n Tributo: input.taxes.map((t) => ({\n Id: t.id,\n ...(t.description === undefined ? {} : { Desc: t.description }),\n BaseImp: t.baseAmount,\n Alic: t.rate,\n Importe: t.amount,\n })),\n };\n }\n\n if (input.vatRates) {\n data.Iva = {\n AlicIva: input.vatRates.map((v) => ({\n Id: v.id,\n BaseImp: v.baseAmount,\n Importe: v.amount,\n })),\n };\n }\n\n if (input.optionalFields) {\n data.Opcionales = {\n Opcional: input.optionalFields.map((o) => ({\n Id: o.id,\n Valor: o.value,\n })),\n };\n }\n\n if (input.buyers) {\n data.Compradores = {\n Comprador: input.buyers.map((b) => ({\n DocTipo: b.documentType,\n DocNro: b.documentNumber,\n Porcentaje: b.percentage,\n })),\n };\n }\n\n if (input.activities) {\n data.Actividades = {\n Actividad: input.activities.map((a) => ({\n Id: a.id,\n })),\n };\n }\n\n return data;\n}\n\nfunction normalizeWsfeVoucherInput(\n input: WsfeVoucherInput\n): NormalizedWsfeVoucherInput {\n const {\n voucherDate,\n serviceStartDate,\n serviceEndDate,\n paymentDueDate,\n associatedVouchers,\n associatedPeriod,\n ...rest\n } = input;\n\n return {\n ...rest,\n voucherDate: normalizeWsfeDateInput(voucherDate, \"voucherDate\"),\n ...(serviceStartDate === undefined\n ? {}\n : {\n serviceStartDate: normalizeWsfeDateInput(\n serviceStartDate,\n \"serviceStartDate\"\n ),\n }),\n ...(serviceEndDate === undefined\n ? {}\n : {\n serviceEndDate: normalizeWsfeDateInput(\n serviceEndDate,\n \"serviceEndDate\"\n ),\n }),\n ...(paymentDueDate === undefined\n ? {}\n : {\n paymentDueDate: normalizeWsfeDateInput(\n paymentDueDate,\n \"paymentDueDate\"\n ),\n }),\n ...(associatedVouchers === undefined\n ? {}\n : {\n associatedVouchers: associatedVouchers.map((voucher, index) => {\n const { voucherDate: associatedVoucherDate, ...associatedRest } =\n voucher;\n\n return {\n ...associatedRest,\n ...(associatedVoucherDate === undefined\n ? {}\n : {\n voucherDate: normalizeWsfeDateInput(\n associatedVoucherDate,\n `associatedVouchers[${index}].voucherDate`\n ),\n }),\n };\n }),\n }),\n ...(associatedPeriod === undefined\n ? {}\n : {\n associatedPeriod: {\n startDate: normalizeWsfeDateInput(\n associatedPeriod.startDate,\n \"associatedPeriod.startDate\"\n ),\n endDate: normalizeWsfeDateInput(\n associatedPeriod.endDate,\n \"associatedPeriod.endDate\"\n ),\n },\n }),\n };\n}\n\nfunction normalizeWsfeDateInput(\n value: WsfeDateInput,\n fieldName: string\n): string {\n if (typeof value !== \"string\") {\n throw new ArcaInputError(\n `Invalid WSFE ${fieldName}: expected a YYYY-MM-DD or YYYYMMDD string`,\n {\n detail: { field: fieldName, value },\n }\n );\n }\n\n const normalizedValue = value.trim();\n const afipMatch = normalizedValue.match(/^(\\d{4})(\\d{2})(\\d{2})$/);\n if (afipMatch) {\n const [, year, month, day] = afipMatch;\n assertValidCalendarDate(year, month, day, fieldName, normalizedValue);\n return normalizedValue;\n }\n\n const isoMatch = normalizedValue.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/);\n if (isoMatch) {\n const [, year, month, day] = isoMatch;\n assertValidCalendarDate(year, month, day, fieldName, normalizedValue);\n return `${year}${month}${day}`;\n }\n\n throw new ArcaInputError(\n `Invalid WSFE ${fieldName}: expected a YYYY-MM-DD or YYYYMMDD string`,\n {\n detail: { field: fieldName, value: normalizedValue },\n }\n );\n}\n\nfunction assertValidCalendarDate(\n yearInput: string,\n monthInput: string,\n dayInput: string,\n fieldName: string,\n value: string\n) {\n const year = Number(yearInput);\n const month = Number(monthInput);\n const day = Number(dayInput);\n const candidate = new Date(Date.UTC(year, month - 1, day));\n\n if (\n candidate.getUTCFullYear() !== year ||\n candidate.getUTCMonth() !== month - 1 ||\n candidate.getUTCDate() !== day\n ) {\n throw new ArcaInputError(\n `Invalid WSFE ${fieldName}: received a non-existent calendar date`,\n {\n detail: { field: fieldName, value },\n }\n );\n }\n}\n\nfunction mapWsfeSalesPoint(raw: unknown): WsfeSalesPoint {\n const record = raw as Record<string, unknown>;\n return {\n number: Number(record.Nro ?? 0),\n ...(record.EmisionTipo === undefined\n ? {}\n : { emissionType: String(record.EmisionTipo) }),\n ...(record.Bloqueado === undefined\n ? {}\n : { blocked: String(record.Bloqueado) }),\n ...(record.FchBaja === undefined\n ? {}\n : { deletedSince: String(record.FchBaja) }),\n };\n}\n\nfunction mapWsfeCatalogEntry(raw: unknown): WsfeCatalogEntry {\n const record = raw as Record<string, unknown>;\n return {\n id: Number(record.Id ?? 0),\n description: String(record.Desc ?? \"\"),\n };\n}\n\nfunction mapWsfeActivityType(raw: unknown): WsfeActivityType {\n const record = raw as Record<string, unknown>;\n return {\n id: Number(record.Id ?? 0),\n description: String(record.Desc ?? \"\"),\n order: Number(record.Orden ?? 0),\n };\n}\n\nfunction mapWsfeReceiverVatCondition(raw: unknown): WsfeReceiverVatCondition {\n const record = raw as Record<string, unknown>;\n return {\n id: Number(record.Id ?? 0),\n description: String(record.Desc ?? \"\"),\n voucherClass: String(record.Cmp_Clase ?? \"\"),\n };\n}\n\nfunction mapWsfeCurrencyType(raw: unknown): WsfeCurrencyType {\n const record = raw as Record<string, unknown>;\n return {\n id: String(record.Id ?? \"\"),\n description: String(record.Desc ?? \"\"),\n validFrom: String(record.FchDesde ?? \"\"),\n validTo: String(record.FchHasta ?? \"\"),\n };\n}\n\nfunction mapWsfeServerStatus(raw: Record<string, unknown>): WsfeServerStatus {\n return {\n appServer: String(raw.AppServer ?? \"\"),\n dbServer: String(raw.DbServer ?? \"\"),\n authServer: String(raw.AuthServer ?? \"\"),\n };\n}\n\nfunction mapWsfeQuotation(raw: Record<string, unknown>): WsfeQuotation {\n return {\n currencyId: String(raw.MonId ?? \"\"),\n rate: Number(raw.MonCotiz ?? 0),\n date: String(raw.FchCotiz ?? \"\"),\n };\n}\n\nfunction mapWsfeVoucherInfo(raw: Record<string, unknown>): WsfeVoucherInfo {\n return {\n voucherNumber: Number(raw.CbteDesde ?? raw.CbteHasta ?? 0),\n ...(raw.CbteFch === undefined ? {} : { voucherDate: String(raw.CbteFch) }),\n ...(raw.PtoVta === undefined ? {} : { salesPoint: Number(raw.PtoVta) }),\n ...(raw.CbteTipo === undefined\n ? {}\n : { voucherType: Number(raw.CbteTipo) }),\n ...(raw.ImpTotal === undefined\n ? {}\n : { totalAmount: Number(raw.ImpTotal) }),\n ...(raw.Resultado === undefined ? {} : { result: String(raw.Resultado) }),\n ...(raw.CAE === undefined ? {} : { cae: String(raw.CAE) }),\n ...(raw.CAEFchVto === undefined\n ? {}\n : { caeExpiry: String(raw.CAEFchVto) }),\n raw,\n };\n}\n\nfunction createWsfeAuth(\n representedTaxId: number | string,\n token: string,\n sign: string\n) {\n return {\n Token: token,\n Sign: sign,\n Cuit: Number.parseInt(String(representedTaxId), 10),\n };\n}\n\nfunction unwrapWsfeOperationResult(\n operation: string,\n response: Record<string, unknown>\n) {\n const operationResponse = response[`${operation}Response`] as\n | Record<string, unknown>\n | undefined;\n const result = (operationResponse?.[`${operation}Result`] ??\n response[`${operation}Result`] ??\n response) as Record<string, unknown>;\n\n if (operation === \"FECAESolicitar\") {\n const detailResponse = normalizeWsfeDetailResponse(result);\n const resultCode = detailResponse.Resultado;\n if (resultCode && resultCode !== \"A\") {\n const observationsContainer = detailResponse.Observaciones as\n | Record<string, unknown>\n | undefined;\n const observations = normalizeWsfeErrors(observationsContainer?.Obs);\n if (observations.length > 0) {\n const firstObservation = observations[0];\n if (!firstObservation) {\n throw new ArcaServiceError(\n \"WSFE returned an empty observation list\",\n {\n detail: result,\n }\n );\n }\n throw new ArcaServiceError(firstObservation.message, {\n serviceCode: firstObservation.code,\n detail: result,\n });\n }\n }\n }\n\n const errorsContainer = result.Errors as Record<string, unknown> | undefined;\n const errors = normalizeWsfeErrors(errorsContainer?.Err);\n if (errors.length > 0) {\n const firstError = errors[0];\n if (!firstError) {\n throw new ArcaServiceError(\"WSFE returned an empty error list\", {\n detail: result,\n });\n }\n throw new ArcaServiceError(firstError.message, {\n serviceCode: firstError.code,\n detail: result,\n });\n }\n\n return result;\n}\n\nfunction normalizeWsfeDetailResponse(result: Record<string, unknown>) {\n const detailResponse = result.FeDetResp as\n | Record<string, unknown>\n | undefined;\n const rawDetail = detailResponse?.FECAEDetResponse;\n\n if (Array.isArray(rawDetail)) {\n return (rawDetail[0] as Record<string, unknown>) ?? {};\n }\n\n return (rawDetail as Record<string, unknown> | undefined) ?? {};\n}\n\nfunction normalizeWsfeErrors(rawErrors: unknown) {\n const entries = Array.isArray(rawErrors)\n ? rawErrors\n : rawErrors\n ? [rawErrors]\n : [];\n\n return entries\n .map((entry) => entry as Record<string, unknown>)\n .map((entry) => {\n const code = entry.Code ?? entry.code ?? \"N/A\";\n const message = entry.Msg ?? entry.msg ?? \"Unknown WSFE error\";\n return {\n code: String(code),\n message: `(${String(code)}) ${String(message)}`,\n };\n });\n}\n\nfunction getWsfeResultEntries(\n result: Record<string, unknown>,\n key: string\n): Record<string, unknown>[] {\n const rawEntries = (\n result.ResultGet as Record<string, unknown> | undefined\n )?.[key];\n if (!rawEntries) {\n return [];\n }\n\n return (Array.isArray(rawEntries) ? rawEntries : [rawEntries]).map(\n (entry) => entry as Record<string, unknown>\n );\n}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AG;AACrB,UAAM,aAAa,OAAO,CAAC;AAC3B,QAAI,CAAC,YAAY;AACf,YAAM,IAAI,iBAAiB,qCAAqC;AAAA,QAC9D,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AACA,UAAM,IAAI,iBAAiB,WAAW,SAAS;AAAA,MAC7C,aAAa,WAAW;AAAA,MACxB,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAEA,SAAS,4BAA4B,QAAiC;AACpE,QAAM,iBAAiB,OAAO;AAG9B,QAAM,YAAY,gBAAgB;AAElC,MAAI,MAAM,QAAQ,SAAS,GAAG;AAC5B,WAAQ,UAAU,CAAC,KAAiC,CAAC;AAAA,EACvD;AAEA,SAAQ,aAAqD,CAAC;AAChE;AAEA,SAAS,oBAAoB,WAAoB;AAC/C,QAAM,UAAU,MAAM,QAAQ,SAAS,IACnC,YACA,YACE,CAAC,SAAS,IACV,CAAC;AAEP,SAAO,QACJ,IAAI,CAAC,UAAU,KAAgC,EAC/C,IAAI,CAAC,UAAU;AACd,UAAM,OAAO,MAAM,QAAQ,MAAM,QAAQ;AACzC,UAAM,UAAU,MAAM,OAAO,MAAM,OAAO;AAC1C,WAAO;AAAA,MACL,MAAM,OAAO,IAAI;AAAA,MACjB,SAAS,IAAI,OAAO,IAAI,CAAC,KAAK,OAAO,OAAO,CAAC;AAAA,IAC/C;AAAA,EACF,CAAC;AACL;AAEA,SAAS,qBACP,QACA,KAC2B;AAC3B,QAAM,aACJ,OAAO,YACL,GAAG;AACP,MAAI,CAAC,YAAY;AACf,WAAO,CAAC;AAAA,EACV;AAEA,UAAQ,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC,UAAU,GAAG;AAAA,IAC7D,CAAC,UAAU;AAAA,EACb;AACF;","names":[]}
package/dist/wsmtxca.d.ts CHANGED
@@ -27,12 +27,14 @@ type WsmtxcaService = {
27
27
  authorizeVoucher(input: {
28
28
  representedTaxId?: ArcaRepresentedTaxId;
29
29
  data: Record<string, unknown>;
30
+ forceRefresh?: boolean;
30
31
  }): Promise<WsmtxcaAuthorizationResult>;
31
32
  /** Returns the last authorized voucher number for the given sales point and type. */
32
33
  getLastAuthorizedVoucher(input: {
33
34
  representedTaxId?: ArcaRepresentedTaxId;
34
35
  voucherType: number;
35
36
  salesPoint: number;
37
+ forceRefresh?: boolean;
36
38
  }): Promise<WsmtxcaLastAuthorizedVoucherResult>;
37
39
  /** Retrieves details for a specific voucher. */
38
40
  getVoucher(input: {
@@ -40,6 +42,7 @@ type WsmtxcaService = {
40
42
  voucherType: number;
41
43
  salesPoint: number;
42
44
  voucherNumber: number;
45
+ forceRefresh?: boolean;
43
46
  }): Promise<WsmtxcaVoucherLookupResult>;
44
47
  };
45
48
  type CreateWsmtxcaServiceOptions = {
@@ -21,8 +21,11 @@ var ArcaServiceError = class extends ArcaError {
21
21
  // src/services/wsmtxca.ts
22
22
  function createWsmtxcaService(options) {
23
23
  return {
24
- async authorizeVoucher({ representedTaxId, data }) {
25
- const auth = await options.auth.login("wsmtxca", { representedTaxId });
24
+ async authorizeVoucher({ representedTaxId, data, forceRefresh }) {
25
+ const auth = await options.auth.login("wsmtxca", {
26
+ representedTaxId,
27
+ forceRefresh
28
+ });
26
29
  const response = await options.soap.execute({
27
30
  service: "wsmtxca",
28
31
  operation: "autorizarComprobante",
@@ -68,9 +71,13 @@ function createWsmtxcaService(options) {
68
71
  async getLastAuthorizedVoucher({
69
72
  representedTaxId,
70
73
  voucherType,
71
- salesPoint
74
+ salesPoint,
75
+ forceRefresh
72
76
  }) {
73
- const auth = await options.auth.login("wsmtxca", { representedTaxId });
77
+ const auth = await options.auth.login("wsmtxca", {
78
+ representedTaxId,
79
+ forceRefresh
80
+ });
74
81
  const response = await options.soap.execute({
75
82
  service: "wsmtxca",
76
83
  operation: "consultarUltimoComprobanteAutorizado",
@@ -105,9 +112,13 @@ function createWsmtxcaService(options) {
105
112
  representedTaxId,
106
113
  voucherType,
107
114
  salesPoint,
108
- voucherNumber
115
+ voucherNumber,
116
+ forceRefresh
109
117
  }) {
110
- const auth = await options.auth.login("wsmtxca", { representedTaxId });
118
+ const auth = await options.auth.login("wsmtxca", {
119
+ representedTaxId,
120
+ forceRefresh
121
+ });
111
122
  const response = await options.soap.execute({
112
123
  service: "wsmtxca",
113
124
  operation: "consultarComprobante",
@@ -244,4 +255,4 @@ function formatCompactDateToIso(dateValue) {
244
255
  export {
245
256
  createWsmtxcaService
246
257
  };
247
- //# sourceMappingURL=wsmtxca.js.map
258
+ //# sourceMappingURL=wsmtxca.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts","../src/services/wsmtxca.ts"],"sourcesContent":["import type { ArcaServiceName } from \"./internal/types\";\n\n/** Base error class for all ARCA-related errors. */\nexport class ArcaError extends Error {\n readonly code: string;\n override readonly name: string = \"ArcaError\";\n\n constructor(message: string, code = \"ARCA_ERROR\", options?: ErrorOptions) {\n super(message, options);\n this.code = code;\n }\n}\n\n/** Thrown when the ARCA client configuration is missing or invalid. */\nexport class ArcaConfigurationError extends ArcaError {\n override readonly name: string = \"ArcaConfigurationError\";\n\n constructor(message: string, options?: ErrorOptions) {\n super(message, \"ARCA_CONFIGURATION_ERROR\", options);\n }\n}\n\n/** Thrown when caller-provided input data is missing or invalid. */\nexport class ArcaInputError extends ArcaError {\n override readonly name: string = \"ArcaInputError\";\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_INPUT_ERROR\", options);\n this.detail = options?.detail;\n }\n}\n\n/** Thrown when an HTTP request to an ARCA endpoint fails at the transport level. */\nexport class ArcaTransportError extends ArcaError {\n override readonly name: string = \"ArcaTransportError\";\n readonly statusCode?: number;\n readonly contentType?: string;\n readonly responseBody?: string;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n statusCode?: number;\n contentType?: string;\n responseBody?: string;\n }\n ) {\n super(message, \"ARCA_TRANSPORT_ERROR\", options);\n this.statusCode = options?.statusCode;\n this.contentType = options?.contentType;\n this.responseBody = options?.responseBody;\n }\n}\n\n/** Thrown when the SOAP response contains a Fault element. */\nexport class ArcaSoapFaultError extends ArcaError {\n override readonly name: string = \"ArcaSoapFaultError\";\n readonly faultCode?: string;\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n faultCode?: string;\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_SOAP_FAULT\", options);\n this.faultCode = options?.faultCode;\n this.detail = options?.detail;\n }\n}\n\n/** Thrown when a response cannot be parsed as a valid SOAP envelope. */\nexport class ArcaInvalidSoapResponseError extends ArcaError {\n override readonly name: string = \"ArcaInvalidSoapResponseError\";\n readonly service?: ArcaServiceName;\n readonly operation?: string;\n readonly endpointUrl?: string;\n readonly statusCode?: number;\n readonly contentType?: string;\n readonly responseBodyLength?: number;\n readonly responseBodyPreview?: string;\n readonly parsedDetail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n service?: ArcaServiceName;\n operation?: string;\n endpointUrl?: string;\n statusCode?: number;\n contentType?: string;\n responseBodyLength?: number;\n responseBodyPreview?: string;\n parsedDetail?: unknown;\n }\n ) {\n super(message, \"ARCA_INVALID_SOAP_RESPONSE\", options);\n this.service = options?.service;\n this.operation = options?.operation;\n this.endpointUrl = options?.endpointUrl;\n this.statusCode = options?.statusCode;\n this.contentType = options?.contentType;\n this.responseBodyLength = options?.responseBodyLength;\n this.responseBodyPreview = options?.responseBodyPreview;\n this.parsedDetail = options?.parsedDetail;\n }\n}\n\n/** Thrown when an ARCA service (WSFE, WSMTXCA, Padron) returns a domain-level error. */\nexport class ArcaServiceError extends ArcaError {\n override readonly name: string = \"ArcaServiceError\";\n readonly serviceCode?: string | number;\n readonly detail?: unknown;\n\n constructor(\n message: string,\n options?: ErrorOptions & {\n serviceCode?: string | number;\n detail?: unknown;\n }\n ) {\n super(message, \"ARCA_SERVICE_ERROR\", options);\n this.serviceCode = options?.serviceCode;\n this.detail = options?.detail;\n }\n}\n","import { ArcaServiceError } from \"../errors\";\nimport type { ArcaClientConfig, ArcaRepresentedTaxId } from \"../internal/types\";\nimport type { SoapTransport } from \"../soap\";\nimport type { WsaaAuthModule } from \"../wsaa\";\n\n/** Result of a successful WSMTXCA voucher authorization. */\nexport type WsmtxcaAuthorizationResult = {\n cae: string;\n caeExpiry?: string;\n voucherNumber: number;\n messages: string[];\n raw: Record<string, unknown>;\n};\n\n/** Result of querying the last authorized voucher number. */\nexport type WsmtxcaLastAuthorizedVoucherResult = {\n voucherNumber: number;\n raw: Record<string, unknown>;\n};\n\n/** Result of looking up a specific WSMTXCA voucher. */\nexport type WsmtxcaVoucherLookupResult = {\n invoiceDate: string;\n voucher: Record<string, unknown>;\n messages: string[];\n raw: Record<string, unknown>;\n};\n\n/** WSMTXCA electronic invoicing service (Factura de Crédito Electrónica). */\nexport type WsmtxcaService = {\n /** Authorizes a voucher and returns the CAE. */\n authorizeVoucher(input: {\n representedTaxId?: ArcaRepresentedTaxId;\n data: Record<string, unknown>;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaAuthorizationResult>;\n /** Returns the last authorized voucher number for the given sales point and type. */\n getLastAuthorizedVoucher(input: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaLastAuthorizedVoucherResult>;\n /** Retrieves details for a specific voucher. */\n getVoucher(input: {\n representedTaxId?: ArcaRepresentedTaxId;\n voucherType: number;\n salesPoint: number;\n voucherNumber: number;\n forceRefresh?: boolean;\n }): Promise<WsmtxcaVoucherLookupResult>;\n};\n\nexport type CreateWsmtxcaServiceOptions = {\n config: ArcaClientConfig;\n auth: WsaaAuthModule;\n soap: SoapTransport;\n};\n\n/** Creates a WSMTXCA service instance wired with authentication and SOAP transport. */\nexport function createWsmtxcaService(\n options: CreateWsmtxcaServiceOptions\n): WsmtxcaService {\n return {\n async authorizeVoucher({ representedTaxId, data, forceRefresh }) {\n const auth = await options.auth.login(\"wsmtxca\", {\n representedTaxId,\n forceRefresh,\n });\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service: \"wsmtxca\",\n operation: \"autorizarComprobante\",\n bodyElementName: \"autorizarComprobanteRequest\",\n bodyElementNamespaceMode: \"prefix\",\n body: {\n authRequest: createWsmtxcaAuth(\n representedTaxId ?? options.config.taxId,\n auth.token,\n auth.sign\n ),\n ...(data as Record<string, unknown>),\n },\n });\n\n const raw = unwrapWsmtxcaOperationResponse(\n response.result,\n \"autorizarComprobante\"\n );\n const authorizationPayload = extractWsmtxcaAuthorizationPayload(raw);\n const messages = extractWsmtxcaMessages(raw);\n const resultado = raw.resultado ?? authorizationPayload.resultado;\n\n const caeValue =\n authorizationPayload.CAE ??\n authorizationPayload.codigoAutorizacion ??\n raw.codigoAutorizacion;\n\n if (resultado === \"R\" || caeValue == null) {\n throw new ArcaServiceError(\n messages.join(\" | \") || \"WSMTXCA rejected the voucher authorization\",\n { detail: raw }\n );\n }\n\n return {\n cae: String(caeValue),\n caeExpiry: normalizeWsmtxcaResponseDate(\n authorizationPayload.fechaVencimientoCAE ??\n authorizationPayload.fechaVencimiento ??\n raw.fechaVencimiento\n ),\n voucherNumber: parseWsmtxcaVoucherNumber(\n authorizationPayload.numeroComprobante ?? raw.numeroComprobante,\n \"WSMTXCA did not return the authorized voucher number\",\n raw\n ),\n messages,\n raw,\n };\n },\n async getLastAuthorizedVoucher({\n representedTaxId,\n voucherType,\n salesPoint,\n forceRefresh,\n }) {\n const auth = await options.auth.login(\"wsmtxca\", {\n representedTaxId,\n forceRefresh,\n });\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service: \"wsmtxca\",\n operation: \"consultarUltimoComprobanteAutorizado\",\n bodyElementName: \"consultarUltimoComprobanteAutorizadoRequest\",\n bodyElementNamespaceMode: \"prefix\",\n body: {\n authRequest: createWsmtxcaAuth(\n representedTaxId ?? options.config.taxId,\n auth.token,\n auth.sign\n ),\n consultaUltimoComprobanteAutorizadoRequest: {\n codigoTipoComprobante: voucherType,\n numeroPuntoVenta: salesPoint,\n },\n },\n });\n\n const raw = unwrapWsmtxcaOperationResponse(\n response.result,\n \"consultarUltimoComprobanteAutorizado\"\n );\n return {\n voucherNumber: parseWsmtxcaVoucherNumber(\n raw.numeroComprobante ?? raw.cbteNro ?? raw.nroComprobante,\n extractWsmtxcaMessages(raw).join(\" | \") ||\n \"WSMTXCA did not return the last authorized voucher number\",\n raw\n ),\n raw,\n };\n },\n async getVoucher({\n representedTaxId,\n voucherType,\n salesPoint,\n voucherNumber,\n forceRefresh,\n }) {\n const auth = await options.auth.login(\"wsmtxca\", {\n representedTaxId,\n forceRefresh,\n });\n const response = await options.soap.execute<\n Record<string, unknown>,\n Record<string, unknown>\n >({\n service: \"wsmtxca\",\n operation: \"consultarComprobante\",\n bodyElementName: \"consultarComprobanteRequest\",\n bodyElementNamespaceMode: \"prefix\",\n body: {\n authRequest: createWsmtxcaAuth(\n representedTaxId ?? options.config.taxId,\n auth.token,\n auth.sign\n ),\n consultaComprobanteRequest: {\n codigoTipoComprobante: voucherType,\n numeroPuntoVenta: salesPoint,\n numeroComprobante: voucherNumber,\n },\n },\n });\n\n const raw = unwrapWsmtxcaOperationResponse(\n response.result,\n \"consultarComprobante\"\n );\n const voucher = extractWsmtxcaVoucherPayload(raw);\n const messages = extractWsmtxcaMessages(raw);\n const invoiceDate = normalizeWsmtxcaResponseDate(\n voucher.fechaEmision ?? voucher.fecha ?? voucher.CbteFch\n );\n\n if (!invoiceDate) {\n throw new ArcaServiceError(\n messages[0] ?? \"WSMTXCA did not return the voucher issue date\",\n { detail: raw }\n );\n }\n\n return {\n invoiceDate,\n voucher,\n messages,\n raw,\n };\n },\n };\n}\n\nfunction createWsmtxcaAuth(\n representedTaxId: number | string,\n token: string,\n sign: string\n) {\n return {\n token,\n sign,\n cuitRepresentada: Number.parseInt(String(representedTaxId), 10),\n };\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === \"object\"\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction unwrapWsmtxcaOperationResponse(\n response: unknown,\n operation:\n | \"autorizarComprobante\"\n | \"consultarUltimoComprobanteAutorizado\"\n | \"consultarComprobante\"\n) {\n const responseRecord = toRecord(response) ?? {};\n\n if (operation === \"autorizarComprobante\") {\n return (\n toRecord(responseRecord.autorizarComprobanteResponse) ??\n toRecord(responseRecord.autorizarComprobanteResult) ??\n toRecord(responseRecord.comprobanteCAEResponse) ??\n toRecord(responseRecord.comprobanteCAEReponse) ??\n responseRecord\n );\n }\n\n if (operation === \"consultarComprobante\") {\n return (\n toRecord(responseRecord.consultarComprobanteResponse) ??\n toRecord(responseRecord.consultaComprobanteResponse) ??\n toRecord(responseRecord.consultarComprobanteResult) ??\n responseRecord\n );\n }\n\n return (\n toRecord(responseRecord.consultarUltimoComprobanteAutorizadoResponse) ??\n toRecord(responseRecord.consultaUltimoComprobanteAutorizadoResponse) ??\n toRecord(responseRecord.consultarUltimoComprobanteAutorizadoResult) ??\n responseRecord\n );\n}\n\nfunction extractWsmtxcaAuthorizationPayload(raw: Record<string, unknown>) {\n return (\n toRecord(raw.comprobanteResponse) ??\n toRecord(raw.comprobanteCAEResponse) ??\n toRecord(raw.comprobanteCAEReponse) ??\n raw\n );\n}\n\nfunction extractWsmtxcaVoucherPayload(raw: Record<string, unknown>) {\n return (\n toRecord(raw.comprobanteResponse) ??\n toRecord(raw.comprobante) ??\n toRecord(raw.cmp) ??\n raw\n );\n}\n\nfunction extractWsmtxcaMessages(raw: Record<string, unknown>): string[] {\n const rawErrors = raw.arrayErrores as\n | { codigoDescripcion?: unknown }\n | undefined;\n const rawObservations = raw.arrayObservaciones as\n | { codigoDescripcion?: unknown }\n | undefined;\n\n const toEntries = (\n value: unknown\n ): Array<{ codigo?: unknown; descripcion?: unknown }> => {\n if (!value) {\n return [];\n }\n if (Array.isArray(value)) {\n return value as Array<{ codigo?: unknown; descripcion?: unknown }>;\n }\n if (typeof value === \"object\") {\n return [value as { codigo?: unknown; descripcion?: unknown }];\n }\n return [];\n };\n\n const errors = toEntries(rawErrors?.codigoDescripcion).map((entry) => {\n const code = entry.codigo == null ? \"N/A\" : String(entry.codigo);\n const description =\n entry.descripcion == null\n ? \"Unknown WSMTXCA error\"\n : String(entry.descripcion);\n return `Error ${code}: ${description}`;\n });\n\n const observations = toEntries(rawObservations?.codigoDescripcion).map(\n (entry) => {\n const code = entry.codigo == null ? \"N/A\" : String(entry.codigo);\n const description =\n entry.descripcion == null ? \"\" : String(entry.descripcion);\n return `Obs ${code}: ${description}`.trim();\n }\n );\n\n return [...errors, ...observations];\n}\n\nfunction parseWsmtxcaVoucherNumber(\n value: unknown,\n message: string,\n detail: Record<string, unknown>\n) {\n const parsed = Number.parseInt(String(value ?? \"\"), 10);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n throw new ArcaServiceError(message, { detail });\n }\n return parsed;\n}\n\nfunction normalizeWsmtxcaResponseDate(value: unknown): string | undefined {\n if (typeof value === \"number\" && Number.isInteger(value)) {\n return formatCompactDateToIso(value);\n }\n\n if (typeof value !== \"string\") {\n return undefined;\n }\n\n const trimmed = value.trim();\n if (!trimmed) {\n return undefined;\n }\n\n if (/^\\d{8}$/.test(trimmed)) {\n return formatCompactDateToIso(Number.parseInt(trimmed, 10));\n }\n\n if (/^\\d{4}-\\d{2}-\\d{2}/.test(trimmed)) {\n return trimmed.slice(0, 10);\n }\n\n return undefined;\n}\n\nfunction formatCompactDateToIso(dateValue?: number | null): string | undefined {\n if (!dateValue) {\n return undefined;\n }\n\n const raw = String(dateValue);\n if (raw.length !== 8) {\n return undefined;\n }\n\n return `${raw.slice(0, 4)}-${raw.slice(4, 6)}-${raw.slice(6, 8)}`;\n}\n"],"mappings":";AAGO,IAAM,YAAN,cAAwB,MAAM;AAAA,EAC1B;AAAA,EACS,OAAe;AAAA,EAEjC,YAAY,SAAiB,OAAO,cAAc,SAAwB;AACxE,UAAM,SAA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KAAK,UAAU,GAAG;AAC3C,UAAM,IAAI,iBAAiB,SAAS,EAAE,OAAO,CAAC;AAAA,EAChD;AACA,SAAO;AACT;AAEA,SAAS,6BAA6B,OAAoC;AACxE,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,GAAG;AACxD,WAAO,uBAAuB,KAAK;AAAA,EACrC;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,MAAI,UAAU,KAAK,OAAO,GAAG;AAC3B,WAAO,uBAAuB,OAAO,SAAS,SAAS,EAAE,CAAC;AAAA,EAC5D;AAEA,MAAI,qBAAqB,KAAK,OAAO,GAAG;AACtC,WAAO,QAAQ,MAAM,GAAG,EAAE;AAAA,EAC5B;AAEA,SAAO;AACT;AAEA,SAAS,uBAAuB,WAA+C;AAC7E,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,QAAM,MAAM,OAAO,SAAS;AAC5B,MAAI,IAAI,WAAW,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,SAAO,GAAG,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC;AACjE;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "facturas",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Node.js client for ARCA services including WSFE, WSMTXCA, and padron lookups.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,8 @@
27
27
  "node": ">=20"
28
28
  },
29
29
  "sideEffects": false,
30
- "main": "./dist/index.js",
30
+ "main": "./dist/index.mjs",
31
+ "module": "./dist/index.mjs",
31
32
  "types": "./dist/index.d.ts",
32
33
  "files": [
33
34
  "dist",
@@ -37,31 +38,31 @@
37
38
  "exports": {
38
39
  ".": {
39
40
  "types": "./dist/index.d.ts",
40
- "import": "./dist/index.js"
41
+ "default": "./dist/index.mjs"
41
42
  },
42
43
  "./errors": {
43
44
  "types": "./dist/errors.d.ts",
44
- "import": "./dist/errors.js"
45
+ "default": "./dist/errors.mjs"
45
46
  },
46
47
  "./constants": {
47
48
  "types": "./dist/constants.d.ts",
48
- "import": "./dist/constants.js"
49
+ "default": "./dist/constants.mjs"
49
50
  },
50
51
  "./types": {
51
52
  "types": "./dist/types.d.ts",
52
- "import": "./dist/types.js"
53
+ "default": "./dist/types.mjs"
53
54
  },
54
55
  "./wsfe": {
55
56
  "types": "./dist/wsfe.d.ts",
56
- "import": "./dist/wsfe.js"
57
+ "default": "./dist/wsfe.mjs"
57
58
  },
58
59
  "./wsmtxca": {
59
60
  "types": "./dist/wsmtxca.d.ts",
60
- "import": "./dist/wsmtxca.js"
61
+ "default": "./dist/wsmtxca.mjs"
61
62
  },
62
63
  "./padron": {
63
64
  "types": "./dist/padron.d.ts",
64
- "import": "./dist/padron.js"
65
+ "default": "./dist/padron.mjs"
65
66
  },
66
67
  "./package.json": "./package.json"
67
68
  },
@@ -69,7 +70,7 @@
69
70
  "access": "public"
70
71
  },
71
72
  "dependencies": {
72
- "fast-xml-parser": "^4.5.3",
73
+ "fast-xml-parser": "^5.8.0",
73
74
  "node-forge": "^1.3.1"
74
75
  },
75
76
  "devDependencies": {
@@ -89,6 +90,7 @@
89
90
  "test": "vitest run --config vitest.config.ts",
90
91
  "test:coverage": "vitest run --config vitest.config.ts --coverage",
91
92
  "check": "ultracite check",
93
+ "check:exports": "pnpm build && node scripts/check-package-exports.mjs",
92
94
  "fix": "ultracite fix"
93
95
  }
94
96
  }