faux-studio 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +26 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10681,24 +10681,33 @@ function isExpiringSoon(creds) {
10681
10681
  const expiresAt = new Date(creds.expiresAt).getTime();
10682
10682
  return Date.now() > expiresAt - REFRESH_BUFFER_MS;
10683
10683
  }
10684
+ var inflightRefresh = null;
10684
10685
  async function refreshJwt(creds) {
10685
- const res = await fetch(`${AUTH_BASE}/auth/refresh`, {
10686
- method: "POST",
10687
- headers: { "Content-Type": "application/json" },
10688
- body: JSON.stringify({ refreshToken: creds.refreshToken })
10689
- });
10690
- if (!res.ok) {
10691
- const text = await res.text().catch(() => "");
10692
- throw new Error(`Token refresh failed (HTTP ${res.status})${text ? ": " + text : ""}`);
10686
+ if (inflightRefresh) {
10687
+ return inflightRefresh;
10693
10688
  }
10694
- const data = await res.json();
10695
- return {
10696
- jwt: data.jwt,
10697
- refreshToken: data.refreshToken,
10698
- expiresAt: new Date(Date.now() + data.expiresIn * 1e3).toISOString(),
10699
- user: creds.user
10700
- // Refresh endpoint doesn't return user info — keep existing
10689
+ const doRefresh = async () => {
10690
+ const res = await fetch(`${AUTH_BASE}/auth/refresh`, {
10691
+ method: "POST",
10692
+ headers: { "Content-Type": "application/json" },
10693
+ body: JSON.stringify({ refreshToken: creds.refreshToken })
10694
+ });
10695
+ if (!res.ok) {
10696
+ const text = await res.text().catch(() => "");
10697
+ throw new Error(`Token refresh failed (HTTP ${res.status})${text ? ": " + text : ""}`);
10698
+ }
10699
+ const data = await res.json();
10700
+ return {
10701
+ jwt: data.jwt,
10702
+ refreshToken: data.refreshToken,
10703
+ expiresAt: new Date(Date.now() + data.expiresIn * 1e3).toISOString(),
10704
+ user: creds.user
10705
+ };
10701
10706
  };
10707
+ inflightRefresh = doRefresh().finally(() => {
10708
+ inflightRefresh = null;
10709
+ });
10710
+ return inflightRefresh;
10702
10711
  }
10703
10712
  function openBrowser(url2) {
10704
10713
  let child;
@@ -26290,7 +26299,7 @@ Resources provide quick read-only access to Figma state without tool calls:
26290
26299
  - Create components for reusable UI patterns.`;
26291
26300
  function createMcpServer(deps) {
26292
26301
  const server2 = new Server(
26293
- { name: "faux-studio", version: "0.5.0" },
26302
+ { name: "faux-studio", version: "0.5.1" },
26294
26303
  {
26295
26304
  capabilities: { tools: { listChanged: true }, resources: {}, logging: {} },
26296
26305
  instructions: INSTRUCTIONS
@@ -26830,7 +26839,7 @@ Call setup_figma again once the plugin shows "Ready".`,
26830
26839
  }
26831
26840
  async function main() {
26832
26841
  const startupT0 = Date.now();
26833
- log(`faux-studio v${"0.5.0"} \u2014 process started (PID ${process.pid}, PPID ${process.ppid})`);
26842
+ log(`faux-studio v${"0.5.1"} \u2014 process started (PID ${process.pid}, PPID ${process.ppid})`);
26834
26843
  try {
26835
26844
  const port = await pluginServer.start();
26836
26845
  if (forceTransport === "plugin") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "faux-studio",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "AI-powered Figma design via MCP — connect any AI client to Figma Desktop",
5
5
  "type": "module",
6
6
  "bin": {