@testsmith/api-spector 0.3.9 → 0.4.0

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.
@@ -396,7 +396,7 @@ async function main() {
396
396
  } else if (!envName && workspace.settings?.defaultEnvironment && !env) {
397
397
  console.warn(cliCommon.color(`Warning: default environment "${workspace.settings.defaultEnvironment}" not found. Running without environment.`, cliCommon.C.yellow));
398
398
  }
399
- const version = `v${"0.3.9"}`;
399
+ const version = `v${"0.4.0"}`;
400
400
  console.log("");
401
401
  console.log(cliCommon.color(" API Test Runner" + (version ? ` ${version}` : ""), cliCommon.C.bold, cliCommon.C.white));
402
402
  console.log(cliCommon.color(` Workspace: ${wsPath}`, cliCommon.C.gray));
@@ -35468,7 +35468,11 @@ function AuthEditor({
35468
35468
  /* @__PURE__ */ jsxRuntimeExports.jsx(
35469
35469
  "button",
35470
35470
  {
35471
- onClick: () => secrets.saveSecret(auth.passwordSecretRef ?? "NTLM_PASSWORD"),
35471
+ onClick: () => {
35472
+ const ref2 = auth.passwordSecretRef ?? "NTLM_PASSWORD";
35473
+ onChange({ passwordSecretRef: ref2 });
35474
+ void secrets.saveSecret(ref2);
35475
+ },
35472
35476
  className: "px-2 py-1 bg-blue-700 hover:bg-blue-600 rounded transition-colors",
35473
35477
  children: secrets.saved ? "✓" : "Save"
35474
35478
  }
@@ -35581,7 +35585,11 @@ function AuthEditor({
35581
35585
  /* @__PURE__ */ jsxRuntimeExports.jsx(
35582
35586
  "button",
35583
35587
  {
35584
- onClick: () => secrets.saveSecret(auth.apiKeySecretRef ?? "API_KEY"),
35588
+ onClick: () => {
35589
+ const ref2 = auth.apiKeySecretRef ?? "API_KEY";
35590
+ onChange({ apiKeySecretRef: ref2 });
35591
+ void secrets.saveSecret(ref2);
35592
+ },
35585
35593
  className: "px-2 py-1 bg-blue-700 hover:bg-blue-600 rounded transition-colors",
35586
35594
  children: secrets.saved ? "✓" : "Save"
35587
35595
  }
@@ -35640,55 +35648,88 @@ function BasicCredentialsFields({
35640
35648
  label,
35641
35649
  note
35642
35650
  }) {
35651
+ const [keychainOpen, setKeychainOpen] = reactExports.useState(!!auth.passwordSecretRef);
35643
35652
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1.5", children: [
35644
35653
  label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-surface-500 text-[10px] uppercase tracking-wide", children: label }),
35645
35654
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
35646
35655
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
35647
35656
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-surface-400", children: "Username" }),
35648
35657
  /* @__PURE__ */ jsxRuntimeExports.jsx(
35649
- "input",
35658
+ VarInput,
35650
35659
  {
35651
35660
  value: auth.username ?? "",
35652
- onChange: (e) => setAuth({ username: e.target.value }),
35661
+ onChange: (v) => setAuth({ username: v }),
35662
+ placeholder: "username",
35653
35663
  className: "mt-1 w-full bg-surface-800 border border-surface-700 rounded px-2 py-1 focus:outline-none focus:border-blue-500"
35654
35664
  }
35655
35665
  )
35656
35666
  ] }),
35657
35667
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
35658
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-surface-400", children: "Password" }),
35659
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 mt-1", children: [
35660
- /* @__PURE__ */ jsxRuntimeExports.jsx(
35661
- "input",
35662
- {
35663
- type: "password",
35664
- value: secretValue,
35665
- onChange: (e) => setSecretValue(e.target.value),
35666
- placeholder: auth.passwordSecretRef ? `Stored as "${auth.passwordSecretRef}"` : "Password",
35667
- className: "flex-1 bg-surface-800 border border-surface-700 rounded px-2 py-1 focus:outline-none focus:border-blue-500 font-mono"
35668
- }
35669
- ),
35670
- /* @__PURE__ */ jsxRuntimeExports.jsx(
35671
- "button",
35672
- {
35673
- onClick: () => saveSecret(auth.passwordSecretRef ?? "API_PASSWORD"),
35674
- className: "px-2 py-1 bg-blue-700 hover:bg-blue-600 rounded transition-colors",
35675
- children: saved ? "✓" : "Save"
35676
- }
35677
- )
35678
- ] })
35668
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "text-surface-400", children: [
35669
+ "Password",
35670
+ " ",
35671
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-surface-500 text-[10px]", children: [
35672
+ "- supports ",
35673
+ "{{variables}}"
35674
+ ] })
35675
+ ] }),
35676
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
35677
+ VarInput,
35678
+ {
35679
+ value: auth.password ?? "",
35680
+ onChange: (v) => setAuth({ password: v }),
35681
+ placeholder: "password or API token",
35682
+ className: "mt-1 w-full bg-surface-800 border border-surface-700 rounded px-2 py-1 focus:outline-none focus:border-blue-500 font-mono"
35683
+ }
35684
+ )
35679
35685
  ] })
35680
35686
  ] }),
35681
- /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-surface-400 text-[10px]", children: [
35682
- "Password stored in OS keychain as",
35683
- " ",
35684
- /* @__PURE__ */ jsxRuntimeExports.jsx(
35685
- "input",
35686
- {
35687
- value: auth.passwordSecretRef ?? "API_PASSWORD",
35688
- onChange: (e) => setAuth({ passwordSecretRef: e.target.value }),
35689
- className: "inline bg-transparent border-b border-surface-700 focus:outline-none focus:border-blue-500 w-24"
35690
- }
35691
- )
35687
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
35688
+ "button",
35689
+ {
35690
+ onClick: () => setKeychainOpen((o) => !o),
35691
+ className: "text-[10px] text-surface-500 hover:text-surface-300 text-left transition-colors w-fit",
35692
+ children: [
35693
+ keychainOpen ? "▾" : "",
35694
+ " Store password in OS keychain instead"
35695
+ ]
35696
+ }
35697
+ ),
35698
+ keychainOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 pl-3 border-l border-surface-800", children: [
35699
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-surface-500 text-[10px]", children: "Encrypt the password in your OS keychain rather than saving it with the request. Leave the Password field above empty to use the keychain value." }),
35700
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
35701
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
35702
+ "input",
35703
+ {
35704
+ type: "password",
35705
+ value: secretValue,
35706
+ onChange: (e) => setSecretValue(e.target.value),
35707
+ placeholder: auth.passwordSecretRef ? `Stored as "${auth.passwordSecretRef}"` : "Password",
35708
+ className: "flex-1 bg-surface-800 border border-surface-700 rounded px-2 py-1 focus:outline-none focus:border-blue-500 font-mono"
35709
+ }
35710
+ ),
35711
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
35712
+ "input",
35713
+ {
35714
+ value: auth.passwordSecretRef ?? "API_PASSWORD",
35715
+ onChange: (e) => setAuth({ passwordSecretRef: e.target.value }),
35716
+ placeholder: "Keychain key",
35717
+ className: "w-32 bg-surface-800 border border-surface-700 rounded px-2 py-1 focus:outline-none focus:border-blue-500"
35718
+ }
35719
+ ),
35720
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
35721
+ "button",
35722
+ {
35723
+ onClick: () => {
35724
+ const ref2 = auth.passwordSecretRef ?? "API_PASSWORD";
35725
+ setAuth({ passwordSecretRef: ref2 });
35726
+ void saveSecret(ref2);
35727
+ },
35728
+ className: "px-2 py-1 bg-blue-700 hover:bg-blue-600 rounded transition-colors",
35729
+ children: saved ? "✓" : "Save"
35730
+ }
35731
+ )
35732
+ ] })
35692
35733
  ] }),
35693
35734
  note && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-surface-600 text-[10px]", children: note })
35694
35735
  ] });
@@ -35758,7 +35799,11 @@ function BearerPanel({
35758
35799
  /* @__PURE__ */ jsxRuntimeExports.jsx(
35759
35800
  "button",
35760
35801
  {
35761
- onClick: () => saveSecret(auth.tokenSecretRef ?? "API_TOKEN"),
35802
+ onClick: () => {
35803
+ const ref2 = auth.tokenSecretRef ?? "API_TOKEN";
35804
+ setAuth({ tokenSecretRef: ref2 });
35805
+ void saveSecret(ref2);
35806
+ },
35762
35807
  className: "px-2 py-1 bg-blue-700 hover:bg-blue-600 rounded transition-colors",
35763
35808
  children: saved ? "✓" : "Save"
35764
35809
  }
@@ -55915,7 +55960,11 @@ function AuthTab({ request, onChange }) {
55915
55960
  /* @__PURE__ */ jsxRuntimeExports.jsx(
55916
55961
  "button",
55917
55962
  {
55918
- onClick: () => saveSecret(auth.oauth2ClientSecretRef ?? "OAUTH2_CLIENT_SECRET"),
55963
+ onClick: () => {
55964
+ const ref2 = auth.oauth2ClientSecretRef ?? "OAUTH2_CLIENT_SECRET";
55965
+ setAuth({ oauth2ClientSecretRef: ref2 });
55966
+ void saveSecret(ref2);
55967
+ },
55919
55968
  className: "px-2 py-1 bg-blue-700 hover:bg-blue-600 rounded transition-colors",
55920
55969
  children: saved ? "✓" : "Save"
55921
55970
  }
@@ -72085,7 +72134,7 @@ function App() {
72085
72134
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#6aa3c8" }, children: "Spector" }),
72086
72135
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ml-2 text-[10px] font-normal opacity-50", children: [
72087
72136
  "v",
72088
- "0.3.9"
72137
+ "0.4.0"
72089
72138
  ] }),
72090
72139
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mx-2 opacity-30", children: "·" }),
72091
72140
  /* @__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-BdUvP_cg.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-BtkRge9R.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./assets/index-B6kFQEbI.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.3.9",
4
+ "version": "0.4.0",
5
5
  "description": "Local-first API testing tool to inspect, test and mock APIs",
6
6
  "repository": {
7
7
  "type": "git",