wayfarer-cli 2.0.1 → 2.0.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.
@@ -8718,7 +8718,7 @@ async function withDeadline(options, run) {
8718
8718
  if (cause instanceof TransportError) throw cause;
8719
8719
  if (timedOut) throw new TransportError("timeout", `Timed out after ${options.timeoutMs} ms`);
8720
8720
  if (options.signal.aborted) throw new TransportError("aborted", "The request was cancelled.");
8721
- throw new TransportError("network", cause instanceof Error ? cause.message : String(cause));
8721
+ throw new TransportError("network", networkMessage(cause));
8722
8722
  } finally {
8723
8723
  clearTimeout(timer);
8724
8724
  options.signal.removeEventListener("abort", cancel);
@@ -8776,6 +8776,11 @@ async function readEventStream(response, signal, onEvent) {
8776
8776
  }
8777
8777
  return { body: kept.slice(0, size).buffer, stream: { stopped, ...truncated && { truncated } } };
8778
8778
  }
8779
+ function networkMessage(cause) {
8780
+ if (!(cause instanceof Error)) return String(cause);
8781
+ const code = cause.cause instanceof Error && "code" in cause.cause ? cause.cause.code : void 0;
8782
+ return typeof code === "string" && /^[A-Z][A-Z0-9_]*$/.test(code) ? `${cause.message} (${code})` : cause.message;
8783
+ }
8779
8784
 
8780
8785
  // ../core/src/transport/fetch.ts
8781
8786
  var FetchTransport = class {
@@ -10004,7 +10009,7 @@ function vmDecode(encoding, words) {
10004
10009
  return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
10005
10010
  } catch (error) {
10006
10011
  if (!(error instanceof TypeError)) throw error;
10007
- throw new Error("Malformed UTF-8 data");
10012
+ throw new Error("Malformed UTF-8 data", { cause: error });
10008
10013
  }
10009
10014
  }
10010
10015
  function vmRandom(count) {
@@ -10678,6 +10683,7 @@ var RequestSkipped = class extends SendBlockedError {
10678
10683
  nextRequest;
10679
10684
  };
10680
10685
  var NETWORK_ERROR_TEXT = "Network error \u2014 no response was received. The host may not resolve (DNS), may have refused the connection, or may not allow cross-origin requests from this site (CORS). The browser does not reveal which. Check the URL and your connection; for CORS, the Local Bridge can relay the request.";
10686
+ var networkErrorWithoutPage = (reason) => `Network error \u2014 no response was received: ${reason}. Check the URL, that the host resolves, and that it accepts connections.`;
10681
10687
  var SECRET_PLACEHOLDER_BLOCKED = "This request refers to a vault secret that could not be read (it may have been deleted), so it was not sent. Give the variable a value again.";
10682
10688
  function sentBodyPreview(body3) {
10683
10689
  if (body3 === void 0 || typeof body3 === "string") return body3;
@@ -10824,7 +10830,7 @@ async function exchange(spec, ports) {
10824
10830
  const durationMs = Math.round(performance.now() - startedAt);
10825
10831
  timings.requestMs = durationMs;
10826
10832
  ports.watch?.received(request.url);
10827
- const shaped = outcome instanceof TransportError ? shapeFailure(outcome, request.url) : shapeResponse(outcome, request.url, ports.page);
10833
+ const shaped = outcome instanceof TransportError ? shapeFailure(outcome, request.url, ports.page) : shapeResponse(outcome, request.url, ports.page);
10828
10834
  const redactor = new Redactor([...request.secrets, ...request.credentials, ...cookieValues]);
10829
10835
  const secrets = new Redactor(request.secrets);
10830
10836
  const post = await runPostScriptAndAssertions(
@@ -10924,7 +10930,7 @@ function shapeResponse(envelope, url, page) {
10924
10930
  }
10925
10931
  };
10926
10932
  }
10927
- function shapeFailure(failure, url) {
10933
+ function shapeFailure(failure, url, page) {
10928
10934
  const network = failure.kind === "network";
10929
10935
  const statusCode = network ? 0 : failure.kind === "bridge" ? failure.status ?? 0 : void 0;
10930
10936
  return {
@@ -10938,7 +10944,7 @@ function shapeFailure(failure, url) {
10938
10944
  statusText: network ? "Unknown Error" : "",
10939
10945
  bodyIsJson: false,
10940
10946
  dataText: "",
10941
- errorText: network ? NETWORK_ERROR_TEXT : failure.message,
10947
+ errorText: !network ? failure.message : page === void 0 ? networkErrorWithoutPage(failure.message) : NETWORK_ERROR_TEXT,
10942
10948
  headersView: []
10943
10949
  }
10944
10950
  };
@@ -13265,7 +13271,7 @@ async function main(argv) {
13265
13271
  }
13266
13272
  });
13267
13273
  if (values.version) {
13268
- console.log("2.0.1");
13274
+ console.log("2.0.2");
13269
13275
  return 0;
13270
13276
  }
13271
13277
  const [command, file, ...rest] = positionals;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wayfarer-cli",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Runs Wayfarer and Postman collections from the command line, with the engine the Wayfarer app sends with: the same scripts, variables, vault and results.",
5
5
  "license": "MIT",
6
6
  "author": "Ashwin Sathian",