@testsmith/api-spector 0.4.4 → 0.4.5

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.
@@ -23,6 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  ));
24
24
  const undici = require("undici");
25
25
  const promises = require("fs/promises");
26
+ const nodeTls = require("tls");
26
27
  const handle = require("./handle-BGYDylL2.js");
27
28
  const crypto = require("crypto");
28
29
  const path = require("path");
@@ -49,6 +50,7 @@ function _interopNamespaceDefault(e) {
49
50
  n.default = e;
50
51
  return Object.freeze(n);
51
52
  }
53
+ const nodeTls__namespace = /* @__PURE__ */ _interopNamespaceDefault(nodeTls);
52
54
  const crypto__namespace = /* @__PURE__ */ _interopNamespaceDefault(crypto);
53
55
  const vm__namespace = /* @__PURE__ */ _interopNamespaceDefault(vm);
54
56
  let globals = {};
@@ -1033,6 +1035,30 @@ async function fetchOAuth2Token(auth, vars) {
1033
1035
  refreshToken: json["refresh_token"] ? String(json["refresh_token"]) : void 0
1034
1036
  };
1035
1037
  }
1038
+ let systemCertificateStoreApplied = false;
1039
+ function trustSystemCertificateStore(options = {}) {
1040
+ const platform = options.platform ?? process.platform;
1041
+ if (platform !== "win32") return false;
1042
+ if (systemCertificateStoreApplied && !options.force) return false;
1043
+ const tlsApi = options.tlsApi ?? nodeTls__namespace;
1044
+ if (typeof tlsApi.getCACertificates !== "function" || typeof tlsApi.setDefaultCACertificates !== "function") {
1045
+ return false;
1046
+ }
1047
+ try {
1048
+ const defaultCerts = tlsApi.getCACertificates("default");
1049
+ const systemCerts = tlsApi.getCACertificates("system");
1050
+ const combinedCerts = Array.from(/* @__PURE__ */ new Set([...defaultCerts, ...systemCerts]));
1051
+ if (!systemCerts.length || combinedCerts.length === defaultCerts.length) {
1052
+ systemCertificateStoreApplied = true;
1053
+ return false;
1054
+ }
1055
+ tlsApi.setDefaultCACertificates(combinedCerts);
1056
+ systemCertificateStoreApplied = true;
1057
+ return true;
1058
+ } catch {
1059
+ return false;
1060
+ }
1061
+ }
1036
1062
  function maskPii(data, patterns) {
1037
1063
  if (!patterns.length) return data;
1038
1064
  try {
@@ -1156,6 +1182,7 @@ function applyRequestDefaults(req) {
1156
1182
  if (!req.auth) req.auth = { type: "none" };
1157
1183
  }
1158
1184
  async function buildDispatcher(proxy, tls) {
1185
+ if (proxy?.url?.trim()) trustSystemCertificateStore();
1159
1186
  const connectOpts = {};
1160
1187
  let hasTls = false;
1161
1188
  if (tls) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const undici = require("undici");
3
- const requestExec = require("./request-exec-DlvyG4rn.js");
3
+ const requestExec = require("./request-exec-DQfwItAd.js");
4
4
  const promises = require("fs/promises");
5
5
  const path = require("path");
6
6
  const Ajv = require("ajv");
@@ -24,13 +24,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  ));
25
25
  const promises = require("fs/promises");
26
26
  const path = require("path");
27
- const snapshots = require("./chunks/snapshots-B7rDeWNy.js");
27
+ const snapshots = require("./chunks/snapshots-Bm60eRRj.js");
28
28
  const crypto = require("crypto");
29
29
  const undici = require("undici");
30
30
  const os = require("os");
31
31
  const cliCommon = require("./chunks/cli-common-CDQY1erJ.js");
32
32
  const environments = require("./chunks/environments-iM3SUM-4.js");
33
- require("./chunks/request-exec-DlvyG4rn.js");
33
+ require("./chunks/request-exec-DQfwItAd.js");
34
+ require("tls");
34
35
  require("./chunks/handle-BGYDylL2.js");
35
36
  require("dayjs");
36
37
  require("vm");
package/out/main/index.js CHANGED
@@ -27,7 +27,7 @@ const path = require("path");
27
27
  const fs = require("fs");
28
28
  const promises = require("fs/promises");
29
29
  const crypto = require("crypto");
30
- const requestExec = require("./chunks/request-exec-DlvyG4rn.js");
30
+ const requestExec = require("./chunks/request-exec-DQfwItAd.js");
31
31
  const ipcValidate = require("./chunks/ipc-validate-k6KI8adf.js");
32
32
  const uuid = require("uuid");
33
33
  const jsYaml = require("js-yaml");
@@ -39,9 +39,10 @@ const http = require("http");
39
39
  const WebSocket = require("ws");
40
40
  const soapHandler = require("./chunks/soap-handler-CAyUjzxB.js");
41
41
  const os = require("os");
42
- const snapshots = require("./chunks/snapshots-B7rDeWNy.js");
42
+ const snapshots = require("./chunks/snapshots-Bm60eRRj.js");
43
43
  const simpleGit = require("simple-git");
44
44
  const recorder = require("./chunks/recorder-0Ij921El.js");
45
+ require("tls");
45
46
  require("dayjs");
46
47
  require("vm");
47
48
  require("tv4");
@@ -5174,7 +5175,7 @@ function isNewer(a, b) {
5174
5175
  return a2 > b2;
5175
5176
  }
5176
5177
  async function checkForUpdate() {
5177
- const current = "0.4.4";
5178
+ const current = "0.4.5";
5178
5179
  try {
5179
5180
  const res = await fetch(REGISTRY_URL, { signal: AbortSignal.timeout(4e3) });
5180
5181
  if (!res.ok) return null;
@@ -2,11 +2,12 @@
2
2
  "use strict";
3
3
  const promises = require("fs/promises");
4
4
  const path = require("path");
5
- const requestExec = require("./chunks/request-exec-DlvyG4rn.js");
5
+ const requestExec = require("./chunks/request-exec-DQfwItAd.js");
6
6
  const requestCollection = require("./chunks/request-collection-CJoXpvOw.js");
7
7
  const environments = require("./chunks/environments-iM3SUM-4.js");
8
8
  const cliCommon = require("./chunks/cli-common-CDQY1erJ.js");
9
9
  require("undici");
10
+ require("tls");
10
11
  require("./chunks/handle-BGYDylL2.js");
11
12
  require("crypto");
12
13
  require("dayjs");
@@ -396,7 +397,7 @@ async function main() {
396
397
  } else if (!envName && workspace.settings?.defaultEnvironment && !env) {
397
398
  console.warn(cliCommon.color(`Warning: default environment "${workspace.settings.defaultEnvironment}" not found. Running without environment.`, cliCommon.C.yellow));
398
399
  }
399
- const version = `v${"0.4.4"}`;
400
+ const version = `v${"0.4.5"}`;
400
401
  console.log("");
401
402
  console.log(cliCommon.color(" API Test Runner" + (version ? ` ${version}` : ""), cliCommon.C.bold, cliCommon.C.white));
402
403
  console.log(cliCommon.color(` Workspace: ${wsPath}`, cliCommon.C.gray));
@@ -66386,7 +66386,7 @@ function WelcomeScreen() {
66386
66386
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-surface-400 text-sm max-w-sm", children: "Local-first API testing with Robot Framework & Playwright code generation. Secrets stay on your machine." }),
66387
66387
  /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-[11px] mt-3", style: { color: "var(--text-muted)" }, children: [
66388
66388
  "version ",
66389
- "0.4.4"
66389
+ "0.4.5"
66390
66390
  ] })
66391
66391
  ] }),
66392
66392
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 w-64", children: [
@@ -72600,7 +72600,7 @@ function App() {
72600
72600
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#6aa3c8" }, children: "Spector" }),
72601
72601
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ml-2 text-[10px] font-normal opacity-50", children: [
72602
72602
  "v",
72603
- "0.4.4"
72603
+ "0.4.5"
72604
72604
  ] }),
72605
72605
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mx-2 opacity-30", children: "·" }),
72606
72606
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5,7 +5,7 @@
5
5
  <meta charset="UTF-8" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>API Spector</title>
8
- <script type="module" crossorigin src="./assets/index-X3HWqTJC.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-CjLzO0tH.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./assets/index-DkZ0bxof.css">
10
10
  </head>
11
11
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@testsmith/api-spector",
3
3
  "productName": "API Spector",
4
- "version": "0.4.4",
4
+ "version": "0.4.5",
5
5
  "description": "Local-first API testing tool to inspect, test and mock APIs",
6
6
  "repository": {
7
7
  "type": "git",