@piyushdoorwar/yamlet 1.1.0 → 1.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.
Files changed (2) hide show
  1. package/dist/yamlet.js +15 -5
  2. package/package.json +1 -1
package/dist/yamlet.js CHANGED
@@ -9,7 +9,19 @@ import { existsSync, promises as fs } from "node:fs";
9
9
  import { STATUS_CODES } from "node:http";
10
10
  import path from "node:path";
11
11
  import { performance } from "node:perf_hooks";
12
- import { Agent, FormData, request as request2 } from "undici";
12
+ import { FormData, request as request2 } from "undici";
13
+
14
+ // core/src/agents.ts
15
+ import { Agent } from "undici";
16
+ var ATTEMPT_TIMEOUT_MS = 2500;
17
+ var standard;
18
+ var insecure;
19
+ function defaultAgent() {
20
+ return standard ??= new Agent({ autoSelectFamily: true, autoSelectFamilyAttemptTimeout: ATTEMPT_TIMEOUT_MS });
21
+ }
22
+ function insecureAgent() {
23
+ return insecure ??= new Agent({ autoSelectFamily: true, autoSelectFamilyAttemptTimeout: ATTEMPT_TIMEOUT_MS, connect: { rejectUnauthorized: false } });
24
+ }
13
25
 
14
26
  // core/src/cookieJar.ts
15
27
  function parseSetCookie(header) {
@@ -319,7 +331,7 @@ async function requestToken(cfg, resolve2, form, opts = {}) {
319
331
  method: "POST",
320
332
  headers,
321
333
  body: body.toString(),
322
- dispatcher: opts.dispatcher,
334
+ dispatcher: opts.dispatcher ?? defaultAgent(),
323
335
  signal: opts.signal
324
336
  });
325
337
  const text = await res.body.text();
@@ -1455,8 +1467,6 @@ ${opts.script}
1455
1467
 
1456
1468
  // core/src/requestExecutor.ts
1457
1469
  var MAX_REDIRECTS = 10;
1458
- var insecure;
1459
- var insecureAgent = () => insecure ??= new Agent({ connect: { rejectUnauthorized: false } });
1460
1470
  var NETWORK_HINTS = {
1461
1471
  ENOTFOUND: "host name could not be resolved",
1462
1472
  EAI_AGAIN: "DNS lookup timed out",
@@ -1709,7 +1719,7 @@ async function execute(input) {
1709
1719
  const tests = [];
1710
1720
  const logs = [];
1711
1721
  const settings = { ...defaultSettings(), ...req.settings };
1712
- const dispatcher = input.dispatcher ?? (settings.skipSslVerification ? insecureAgent() : void 0);
1722
+ const dispatcher = input.dispatcher ?? (settings.skipSslVerification ? insecureAgent() : defaultAgent());
1713
1723
  const scriptBase = {
1714
1724
  request: req,
1715
1725
  variables: vars,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piyushdoorwar/yamlet",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Run Yamlet API collections (Git-friendly YAML) from the command line or CI.",
5
5
  "type": "module",
6
6
  "bin": {