@vitemcp/server 1.9.4 → 1.9.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.
@@ -3084,6 +3084,7 @@ import {
3084
3084
  writeFile
3085
3085
  } from "fs/promises";
3086
3086
  import { join } from "path";
3087
+ import { setTimeout as delay } from "timers/promises";
3087
3088
  var DiskStore = class {
3088
3089
  cleanupInFlight = null;
3089
3090
  cleanupInterval = null;
@@ -3173,7 +3174,7 @@ var DiskStore = class {
3173
3174
  encoding: "utf-8",
3174
3175
  mode: 384
3175
3176
  });
3176
- await rename(tempPath, filePath);
3177
+ await renameIntoPlace(tempPath, filePath);
3177
3178
  } catch (error) {
3178
3179
  await rm(tempPath, { force: true });
3179
3180
  console.error(`Failed to save key ${key}:`, error);
@@ -3279,6 +3280,21 @@ var DiskStore = class {
3279
3280
  }
3280
3281
  }
3281
3282
  };
3283
+ var TRANSIENT_RENAME_CODES = /* @__PURE__ */ new Set(["EACCES", "EBUSY", "EPERM"]);
3284
+ var renameIntoPlace = async (source, destination) => {
3285
+ for (let attempt = 0; ; attempt++) {
3286
+ try {
3287
+ await rename(source, destination);
3288
+ return;
3289
+ } catch (error) {
3290
+ const code = error.code ?? "";
3291
+ if (process.platform !== "win32" || attempt >= 5 || !TRANSIENT_RENAME_CODES.has(code)) {
3292
+ throw error;
3293
+ }
3294
+ await delay(10 * 2 ** attempt);
3295
+ }
3296
+ }
3297
+ };
3282
3298
 
3283
3299
  // src/auth/utils/jwks.ts
3284
3300
  var JWKSVerifier = class {
@@ -3445,4 +3461,4 @@ export {
3445
3461
  DiskStore,
3446
3462
  JWKSVerifier
3447
3463
  };
3448
- //# sourceMappingURL=chunk-4SRXSCYR.js.map
3464
+ //# sourceMappingURL=chunk-WXZQZWBE.js.map