arca-sdk 0.1.1 → 0.1.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/index.cjs CHANGED
@@ -242,6 +242,26 @@ var TicketManager = class {
242
242
  }
243
243
  };
244
244
 
245
+ // src/utils/network.ts
246
+ var import_https = __toESM(require("https"), 1);
247
+ async function callArcaApi(url, options) {
248
+ const isNode = typeof process !== "undefined" && process.versions && process.versions.node;
249
+ if (isNode) {
250
+ const agent = new import_https.default.Agent({
251
+ // Permitir llaves DH de 1024 bits (AFIP) bajando a Security Level 1
252
+ // solo para esta conexión específica.
253
+ ciphers: "DEFAULT@SECLEVEL=1",
254
+ rejectUnauthorized: true
255
+ // Seguimos validando el certificado
256
+ });
257
+ return fetch(url, {
258
+ ...options,
259
+ agent
260
+ });
261
+ }
262
+ return fetch(url, options);
263
+ }
264
+
245
265
  // src/auth/wsaa.ts
246
266
  var WsaaService = class {
247
267
  config;
@@ -310,7 +330,7 @@ var WsaaService = class {
310
330
  );
311
331
  }
312
332
  const endpoint = getWsaaEndpoint(this.config.environment);
313
- const response = await fetch(endpoint, {
333
+ const response = await callArcaApi(endpoint, {
314
334
  method: "POST",
315
335
  headers: {
316
336
  "Content-Type": "text/xml; charset=utf-8",
@@ -599,7 +619,7 @@ var WsfeService = class {
599
619
  ivaData: request.ivaData
600
620
  });
601
621
  const endpoint = getWsfeEndpoint(this.config.environment);
602
- const response = await fetch(endpoint, {
622
+ const response = await callArcaApi(endpoint, {
603
623
  method: "POST",
604
624
  headers: {
605
625
  "Content-Type": "text/xml; charset=utf-8",
package/dist/index.js CHANGED
@@ -198,6 +198,26 @@ var TicketManager = class {
198
198
  }
199
199
  };
200
200
 
201
+ // src/utils/network.ts
202
+ import https from "https";
203
+ async function callArcaApi(url, options) {
204
+ const isNode = typeof process !== "undefined" && process.versions && process.versions.node;
205
+ if (isNode) {
206
+ const agent = new https.Agent({
207
+ // Permitir llaves DH de 1024 bits (AFIP) bajando a Security Level 1
208
+ // solo para esta conexión específica.
209
+ ciphers: "DEFAULT@SECLEVEL=1",
210
+ rejectUnauthorized: true
211
+ // Seguimos validando el certificado
212
+ });
213
+ return fetch(url, {
214
+ ...options,
215
+ agent
216
+ });
217
+ }
218
+ return fetch(url, options);
219
+ }
220
+
201
221
  // src/auth/wsaa.ts
202
222
  var WsaaService = class {
203
223
  config;
@@ -266,7 +286,7 @@ var WsaaService = class {
266
286
  );
267
287
  }
268
288
  const endpoint = getWsaaEndpoint(this.config.environment);
269
- const response = await fetch(endpoint, {
289
+ const response = await callArcaApi(endpoint, {
270
290
  method: "POST",
271
291
  headers: {
272
292
  "Content-Type": "text/xml; charset=utf-8",
@@ -555,7 +575,7 @@ var WsfeService = class {
555
575
  ivaData: request.ivaData
556
576
  });
557
577
  const endpoint = getWsfeEndpoint(this.config.environment);
558
- const response = await fetch(endpoint, {
578
+ const response = await callArcaApi(endpoint, {
559
579
  method: "POST",
560
580
  headers: {
561
581
  "Content-Type": "text/xml; charset=utf-8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arca-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "SDK moderna en TypeScript para ARCA (ex-AFIP)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",