@testsmith/api-spector 0.7.0 → 0.7.1

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/out/main/index.js CHANGED
@@ -5943,7 +5943,7 @@ function isNewer(a, b) {
5943
5943
  return a2 > b2;
5944
5944
  }
5945
5945
  async function checkForUpdate() {
5946
- const current = "0.7.0";
5946
+ const current = "0.7.1";
5947
5947
  try {
5948
5948
  const res = await fetch(REGISTRY_URL, { signal: AbortSignal.timeout(4e3) });
5949
5949
  if (!res.ok) return null;
@@ -495,7 +495,7 @@ async function main() {
495
495
  } else if (!envName && workspace.settings?.defaultEnvironment && !env) {
496
496
  console.warn(cliCommon.color(`Warning: default environment "${workspace.settings.defaultEnvironment}" not found. Running without environment.`, cliCommon.C.yellow));
497
497
  }
498
- const version = `v${"0.7.0"}`;
498
+ const version = `v${"0.7.1"}`;
499
499
  console.log("");
500
500
  console.log(cliCommon.color(" API Test Runner" + (version ? ` ${version}` : ""), cliCommon.C.bold, cliCommon.C.white));
501
501
  console.log(cliCommon.color(` Workspace: ${wsPath}`, cliCommon.C.gray));
@@ -1,5 +1,5 @@
1
1
  import { l as linter, E as EditorView, L as LanguageSupport, e as LRLanguage, s as styleTags, i as indentNodeProp, f as delimitedIndent, m as foldNodeProp, n as foldInside, S as StateField, p as LRParser, q as StateEffect, u as tags, r as reactExports, j as jsxRuntimeExports, c as ReactCodeMirror, o as oneDark, b as json } from "./codemirror-F6m3Hm1M.js";
2
- import { u as useT, a as useStore, b as useActiveEnvironment } from "./index-Bquy5IRN.js";
2
+ import { u as useT, a as useStore, b as useActiveEnvironment } from "./index-CLBcI0SH.js";
3
3
  import "./ajv-2MAg6kGF.js";
4
4
  function devAssert(condition, message) {
5
5
  const booleanCondition = Boolean(condition);
@@ -1,5 +1,5 @@
1
1
  import { r as reactExports, j as jsxRuntimeExports, c as ReactCodeMirror, o as oneDark, x as xml } from "./codemirror-F6m3Hm1M.js";
2
- import { u as useT, c as btnPrimaryCls, d as commentKeymap } from "./index-Bquy5IRN.js";
2
+ import { u as useT, c as btnPrimaryCls, d as commentKeymap } from "./index-CLBcI0SH.js";
3
3
  import "./ajv-2MAg6kGF.js";
4
4
  const SOAP_11_CONTENT_TYPE = "text/xml; charset=utf-8";
5
5
  const SOAP_12_CONTENT_TYPE = "application/soap+xml; charset=utf-8";
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphQLEditor-DVmXF8Zt.js","./codemirror-F6m3Hm1M.js","./ajv-2MAg6kGF.js","./SoapEditor-Dnt4GqdH.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphQLEditor-D0M4hFOH.js","./codemirror-F6m3Hm1M.js","./ajv-2MAg6kGF.js","./SoapEditor-0kW0ngi9.js"])))=>i.map(i=>d[i]);
2
2
  import { r as reactExports, g as getDefaultExportFromCjs, R as React$2, a as autocompletion, h as hoverTooltip, j as jsxRuntimeExports, k as keymap, t as toggleComment, x as xml, b as json, c as ReactCodeMirror, o as oneDark, d as javascript } from "./codemirror-F6m3Hm1M.js";
3
3
  import { A as Ajv } from "./ajv-2MAg6kGF.js";
4
4
  var client = { exports: {} };
@@ -27438,8 +27438,8 @@ function jsonWithComments() {
27438
27438
  function xmlWithComments() {
27439
27439
  return [xml(), commentKeymap];
27440
27440
  }
27441
- const GraphQLEditor = reactExports.lazy(() => __vitePreload(() => import("./GraphQLEditor-DVmXF8Zt.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url).then((m) => ({ default: m.GraphQLEditor })));
27442
- const SoapEditor = reactExports.lazy(() => __vitePreload(() => import("./SoapEditor-Dnt4GqdH.js"), true ? __vite__mapDeps([3,1,2]) : void 0, import.meta.url).then((m) => ({ default: m.SoapEditor })));
27441
+ const GraphQLEditor = reactExports.lazy(() => __vitePreload(() => import("./GraphQLEditor-D0M4hFOH.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url).then((m) => ({ default: m.GraphQLEditor })));
27442
+ const SoapEditor = reactExports.lazy(() => __vitePreload(() => import("./SoapEditor-0kW0ngi9.js"), true ? __vite__mapDeps([3,1,2]) : void 0, import.meta.url).then((m) => ({ default: m.SoapEditor })));
27443
27443
  function BodyTab({ request: request2, onChange }) {
27444
27444
  const t = useT();
27445
27445
  const editorFallback = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-xs text-surface-500", children: t("Loading editor…") });
@@ -32532,6 +32532,8 @@ function WelcomeScreen() {
32532
32532
  const [gitUrl, setGitUrl] = reactExports.useState("");
32533
32533
  const [gitBusy, setGitBusy] = reactExports.useState(false);
32534
32534
  const [gitError, setGitError] = reactExports.useState(null);
32535
+ const busyRef = reactExports.useRef(false);
32536
+ const [busy, setBusy] = reactExports.useState(false);
32535
32537
  reactExports.useEffect(() => {
32536
32538
  electron$k.getRecentWorkspaces().then(setRecents).catch(() => setRecents([]));
32537
32539
  electron$k.getUpdateMode().then((mode) => {
@@ -32543,18 +32545,33 @@ function WelcomeScreen() {
32543
32545
  });
32544
32546
  }, []);
32545
32547
  async function openWorkspace() {
32546
- const result = await electron$k.openWorkspace();
32547
- if (!result) return;
32548
- await applyWorkspace(result.workspace, result.workspacePath);
32548
+ if (busyRef.current) return;
32549
+ busyRef.current = true;
32550
+ setBusy(true);
32551
+ try {
32552
+ const result = await electron$k.openWorkspace();
32553
+ if (result) await applyWorkspace(result.workspace, result.workspacePath);
32554
+ } finally {
32555
+ busyRef.current = false;
32556
+ setBusy(false);
32557
+ }
32549
32558
  }
32550
32559
  async function newWorkspace() {
32551
- const result = await electron$k.newWorkspace();
32552
- if (!result) return;
32553
- await applyWorkspace(result.workspace, result.workspacePath);
32560
+ if (busyRef.current) return;
32561
+ busyRef.current = true;
32562
+ setBusy(true);
32563
+ try {
32564
+ const result = await electron$k.newWorkspace();
32565
+ if (result) await applyWorkspace(result.workspace, result.workspacePath);
32566
+ } finally {
32567
+ busyRef.current = false;
32568
+ setBusy(false);
32569
+ }
32554
32570
  }
32555
32571
  async function openFromGit() {
32556
32572
  const url = gitUrl.trim();
32557
- if (!url || gitBusy) return;
32573
+ if (!url || busyRef.current) return;
32574
+ busyRef.current = true;
32558
32575
  setGitBusy(true);
32559
32576
  setGitError(null);
32560
32577
  try {
@@ -32564,16 +32581,25 @@ function WelcomeScreen() {
32564
32581
  } catch (err) {
32565
32582
  setGitError(err instanceof Error ? err.message : t("Could not open the repository"));
32566
32583
  } finally {
32584
+ busyRef.current = false;
32567
32585
  setGitBusy(false);
32568
32586
  }
32569
32587
  }
32570
32588
  async function openRecent(path) {
32571
- const result = await electron$k.openWorkspacePath(path);
32572
- if (!result) {
32573
- setRecents((prev) => prev.filter((r) => r.path !== path));
32574
- return;
32589
+ if (busyRef.current) return;
32590
+ busyRef.current = true;
32591
+ setBusy(true);
32592
+ try {
32593
+ const result = await electron$k.openWorkspacePath(path);
32594
+ if (!result) {
32595
+ setRecents((prev) => prev.filter((r) => r.path !== path));
32596
+ return;
32597
+ }
32598
+ await applyWorkspace(result.workspace, result.workspacePath);
32599
+ } finally {
32600
+ busyRef.current = false;
32601
+ setBusy(false);
32575
32602
  }
32576
- await applyWorkspace(result.workspace, result.workspacePath);
32577
32603
  }
32578
32604
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex flex-col items-center justify-center gap-6 text-center p-8", children: [
32579
32605
  update && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-1 px-4 py-2 rounded-lg border border-blue-800 bg-blue-950/40 text-xs", children: [
@@ -32600,14 +32626,15 @@ function WelcomeScreen() {
32600
32626
  )
32601
32627
  ] }),
32602
32628
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-surface-400 text-sm max-w-sm", children: t("Local-first API testing with Robot Framework & Playwright code generation. Secrets stay on your machine.") }),
32603
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-[11px] mt-3", style: { color: "var(--text-muted)" }, children: t("version :version", { version: "0.7.0" }) })
32629
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-[11px] mt-3", style: { color: "var(--text-muted)" }, children: t("version :version", { version: "0.7.1" }) })
32604
32630
  ] }),
32605
32631
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 w-64", children: [
32606
32632
  /* @__PURE__ */ jsxRuntimeExports.jsx(
32607
32633
  "button",
32608
32634
  {
32609
32635
  onClick: openWorkspace,
32610
- className: "px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded text-sm font-medium transition-colors",
32636
+ disabled: busy || gitBusy,
32637
+ className: "px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded text-sm font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
32611
32638
  children: t("Open Workspace")
32612
32639
  }
32613
32640
  ),
@@ -32615,7 +32642,8 @@ function WelcomeScreen() {
32615
32642
  "button",
32616
32643
  {
32617
32644
  onClick: newWorkspace,
32618
- className: "px-4 py-2 bg-surface-800 hover:bg-surface-700 rounded text-sm font-medium transition-colors",
32645
+ disabled: busy || gitBusy,
32646
+ className: "px-4 py-2 bg-surface-800 hover:bg-surface-700 rounded text-sm font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
32619
32647
  children: t("New Workspace")
32620
32648
  }
32621
32649
  ),
@@ -32631,7 +32659,7 @@ function WelcomeScreen() {
32631
32659
  },
32632
32660
  placeholder: "https://github.com/owner/repo",
32633
32661
  autoFocus: true,
32634
- disabled: gitBusy,
32662
+ disabled: busy || gitBusy,
32635
32663
  className: "px-3 py-2 bg-surface-900 border border-surface-700 rounded text-xs focus:outline-none focus:border-blue-600 disabled:opacity-60"
32636
32664
  }
32637
32665
  ),
@@ -32639,7 +32667,7 @@ function WelcomeScreen() {
32639
32667
  "button",
32640
32668
  {
32641
32669
  onClick: openFromGit,
32642
- disabled: gitBusy || !gitUrl.trim(),
32670
+ disabled: busy || gitBusy || !gitUrl.trim(),
32643
32671
  className: "px-4 py-2 bg-surface-800 hover:bg-surface-700 rounded text-sm font-medium transition-colors disabled:opacity-50",
32644
32672
  children: gitBusy ? t("Cloning…") : t("Clone & Open")
32645
32673
  }
@@ -32660,8 +32688,9 @@ function WelcomeScreen() {
32660
32688
  "button",
32661
32689
  {
32662
32690
  onClick: () => openRecent(r.path),
32691
+ disabled: busy || gitBusy,
32663
32692
  title: r.path,
32664
- className: "flex flex-col items-start px-2 py-1.5 rounded hover:bg-surface-800 transition-colors text-left group shrink-0",
32693
+ className: "flex flex-col items-start px-2 py-1.5 rounded hover:bg-surface-800 transition-colors text-left group shrink-0 disabled:opacity-50 disabled:cursor-not-allowed",
32665
32694
  children: [
32666
32695
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-surface-200 group-hover:text-white truncate max-w-full", children: r.name }),
32667
32696
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[10px] text-surface-500 truncate max-w-full", children: r.path })
@@ -35328,6 +35357,32 @@ function Toolbar({ onOpenDocs: _onOpenDocs }) {
35328
35357
  await electron$d.saveWorkspace(updated);
35329
35358
  }
35330
35359
  }
35360
+ const wsBusyRef = reactExports.useRef(false);
35361
+ const [wsBusy, setWsBusy] = reactExports.useState(false);
35362
+ async function openWs() {
35363
+ if (wsBusyRef.current) return;
35364
+ wsBusyRef.current = true;
35365
+ setWsBusy(true);
35366
+ try {
35367
+ const result = await electron$d.openWorkspace();
35368
+ if (result) await applyWorkspace(result.workspace, result.workspacePath);
35369
+ } finally {
35370
+ wsBusyRef.current = false;
35371
+ setWsBusy(false);
35372
+ }
35373
+ }
35374
+ async function newWs() {
35375
+ if (wsBusyRef.current) return;
35376
+ wsBusyRef.current = true;
35377
+ setWsBusy(true);
35378
+ try {
35379
+ const result = await electron$d.newWorkspace();
35380
+ if (result) await applyWorkspace(result.workspace, result.workspacePath);
35381
+ } finally {
35382
+ wsBusyRef.current = false;
35383
+ setWsBusy(false);
35384
+ }
35385
+ }
35331
35386
  if (!workspace) return null;
35332
35387
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-drag bg-surface-950 border-b border-surface-800 flex-shrink-0", children: [
35333
35388
  workspaceSettingsOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(WorkspaceSettingsModal, { onClose: () => setWorkspaceSettingsOpen(false) }),
@@ -35413,11 +35468,9 @@ function Toolbar({ onOpenDocs: _onOpenDocs }) {
35413
35468
  /* @__PURE__ */ jsxRuntimeExports.jsx(
35414
35469
  "button",
35415
35470
  {
35416
- onClick: async () => {
35417
- const result = await electron$d.openWorkspace();
35418
- if (result) await applyWorkspace(result.workspace, result.workspacePath);
35419
- },
35420
- className: "px-2.5 py-1 text-xs bg-surface-800 hover:bg-surface-700 rounded transition-colors",
35471
+ onClick: openWs,
35472
+ disabled: wsBusy,
35473
+ className: "px-2.5 py-1 text-xs bg-surface-800 hover:bg-surface-700 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
35421
35474
  title: t("Open a different workspace"),
35422
35475
  children: t("Open WS")
35423
35476
  }
@@ -35425,11 +35478,9 @@ function Toolbar({ onOpenDocs: _onOpenDocs }) {
35425
35478
  /* @__PURE__ */ jsxRuntimeExports.jsx(
35426
35479
  "button",
35427
35480
  {
35428
- onClick: async () => {
35429
- const result = await electron$d.newWorkspace();
35430
- if (result) await applyWorkspace(result.workspace, result.workspacePath);
35431
- },
35432
- className: "px-2.5 py-1 text-xs bg-surface-800 hover:bg-surface-700 rounded transition-colors",
35481
+ onClick: newWs,
35482
+ disabled: wsBusy,
35483
+ className: "px-2.5 py-1 text-xs bg-surface-800 hover:bg-surface-700 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
35433
35484
  title: t("Create a new workspace"),
35434
35485
  children: t("New WS")
35435
35486
  }
@@ -41667,7 +41718,7 @@ function App() {
41667
41718
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#6aa3c8" }, children: "Spector" }),
41668
41719
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ml-2 text-[10px] font-normal opacity-50", children: [
41669
41720
  "v",
41670
- "0.7.0"
41721
+ "0.7.1"
41671
41722
  ] }),
41672
41723
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mx-2 opacity-30", children: "·" }),
41673
41724
  /* @__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-Bquy5IRN.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-CLBcI0SH.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="./assets/codemirror-F6m3Hm1M.js">
10
10
  <link rel="modulepreload" crossorigin href="./assets/ajv-2MAg6kGF.js">
11
11
  <link rel="stylesheet" crossorigin href="./assets/index-DfWnNkH3.css">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@testsmith/api-spector",
3
3
  "productName": "API Spector",
4
- "version": "0.7.0",
4
+ "version": "0.7.1",
5
5
  "description": "Local-first API testing tool to inspect, test and mock APIs",
6
6
  "repository": {
7
7
  "type": "git",