@vitemcp/server 1.9.2 → 1.9.4

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/README.md CHANGED
@@ -656,7 +656,9 @@ server.addTool({
656
656
 
657
657
  #### Working with Resource Templates
658
658
 
659
- The `embedded()` method works seamlessly with resource templates:
659
+ The `embedded()` method works seamlessly with resource templates. A URI reaches
660
+ the same template, with the same arguments, as it would through
661
+ `resources/read`:
660
662
 
661
663
  ```js
662
664
  // Define a resource template
package/dist/ViteMCP.cjs CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkRQEMPJ2Lcjs = require('./chunk-RQEMPJ2L.cjs');
13
+ var _chunkOJUNDONAcjs = require('./chunk-OJUNDONA.cjs');
14
14
 
15
15
 
16
16
 
@@ -25,8 +25,8 @@ var _chunkRQEMPJ2Lcjs = require('./chunk-RQEMPJ2L.cjs');
25
25
 
26
26
 
27
27
 
28
- var _chunkSHPKRGNYcjs = require('./chunk-SHPKRGNY.cjs');
29
- require('./chunk-FEM6LNS4.cjs');
28
+ var _chunkP32QRCBTcjs = require('./chunk-P32QRCBT.cjs');
29
+ require('./chunk-L6BHGIXM.cjs');
30
30
 
31
31
 
32
32
 
@@ -52,5 +52,5 @@ require('./chunk-FEM6LNS4.cjs');
52
52
 
53
53
 
54
54
 
55
- exports.AuthProvider = _chunkSHPKRGNYcjs.AuthProvider; exports.AzureProvider = _chunkSHPKRGNYcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkRQEMPJ2Lcjs.DiscoveryDocumentCache; exports.GitHubProvider = _chunkSHPKRGNYcjs.GitHubProvider; exports.GoogleProvider = _chunkSHPKRGNYcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkRQEMPJ2Lcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkSHPKRGNYcjs.OAuthProvider; exports.OAuthProxy = _chunkSHPKRGNYcjs.OAuthProxy; exports.OAuthProxyError = _chunkSHPKRGNYcjs.OAuthProxyError; exports.ServerState = _chunkRQEMPJ2Lcjs.ServerState; exports.UnexpectedStateError = _chunkRQEMPJ2Lcjs.UnexpectedStateError; exports.UserError = _chunkRQEMPJ2Lcjs.UserError; exports.ViteMCP = _chunkRQEMPJ2Lcjs.ViteMCP; exports.ViteMCPError = _chunkRQEMPJ2Lcjs.ViteMCPError; exports.audioContent = _chunkRQEMPJ2Lcjs.audioContent; exports.delay = _chunkRQEMPJ2Lcjs.delay; exports.getAuthSession = _chunkSHPKRGNYcjs.getAuthSession; exports.imageContent = _chunkRQEMPJ2Lcjs.imageContent; exports.jsonSchemaAdapter = _chunkRQEMPJ2Lcjs.jsonSchemaAdapter; exports.requireAll = _chunkSHPKRGNYcjs.requireAll; exports.requireAny = _chunkSHPKRGNYcjs.requireAny; exports.requireAuth = _chunkSHPKRGNYcjs.requireAuth; exports.requireRole = _chunkSHPKRGNYcjs.requireRole; exports.requireScopes = _chunkSHPKRGNYcjs.requireScopes;
55
+ exports.AuthProvider = _chunkP32QRCBTcjs.AuthProvider; exports.AzureProvider = _chunkP32QRCBTcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkOJUNDONAcjs.DiscoveryDocumentCache; exports.GitHubProvider = _chunkP32QRCBTcjs.GitHubProvider; exports.GoogleProvider = _chunkP32QRCBTcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkOJUNDONAcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkP32QRCBTcjs.OAuthProvider; exports.OAuthProxy = _chunkP32QRCBTcjs.OAuthProxy; exports.OAuthProxyError = _chunkP32QRCBTcjs.OAuthProxyError; exports.ServerState = _chunkOJUNDONAcjs.ServerState; exports.UnexpectedStateError = _chunkOJUNDONAcjs.UnexpectedStateError; exports.UserError = _chunkOJUNDONAcjs.UserError; exports.ViteMCP = _chunkOJUNDONAcjs.ViteMCP; exports.ViteMCPError = _chunkOJUNDONAcjs.ViteMCPError; exports.audioContent = _chunkOJUNDONAcjs.audioContent; exports.delay = _chunkOJUNDONAcjs.delay; exports.getAuthSession = _chunkP32QRCBTcjs.getAuthSession; exports.imageContent = _chunkOJUNDONAcjs.imageContent; exports.jsonSchemaAdapter = _chunkOJUNDONAcjs.jsonSchemaAdapter; exports.requireAll = _chunkP32QRCBTcjs.requireAll; exports.requireAny = _chunkP32QRCBTcjs.requireAny; exports.requireAuth = _chunkP32QRCBTcjs.requireAuth; exports.requireRole = _chunkP32QRCBTcjs.requireRole; exports.requireScopes = _chunkP32QRCBTcjs.requireScopes;
56
56
  //# sourceMappingURL=ViteMCP.cjs.map
package/dist/ViteMCP.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  delay,
11
11
  imageContent,
12
12
  jsonSchemaAdapter
13
- } from "./chunk-DSDLJS6O.js";
13
+ } from "./chunk-5RAYSJ4N.js";
14
14
  import {
15
15
  AuthProvider,
16
16
  AzureProvider,
@@ -25,8 +25,8 @@ import {
25
25
  requireAuth,
26
26
  requireRole,
27
27
  requireScopes
28
- } from "./chunk-KKSDTVEW.js";
29
- import "./chunk-4FH73ERY.js";
28
+ } from "./chunk-4SRXSCYR.js";
29
+ import "./chunk-4LNVOTEL.js";
30
30
  export {
31
31
  AuthProvider,
32
32
  AzureProvider,
@@ -24,7 +24,7 @@
24
24
 
25
25
 
26
26
 
27
- var _chunkSHPKRGNYcjs = require('../chunk-SHPKRGNY.cjs');
27
+ var _chunkP32QRCBTcjs = require('../chunk-P32QRCBT.cjs');
28
28
 
29
29
 
30
30
 
@@ -51,5 +51,5 @@ var _chunkSHPKRGNYcjs = require('../chunk-SHPKRGNY.cjs');
51
51
 
52
52
 
53
53
 
54
- exports.AuthProvider = _chunkSHPKRGNYcjs.AuthProvider; exports.AzureProvider = _chunkSHPKRGNYcjs.AzureProvider; exports.ConsentManager = _chunkSHPKRGNYcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkSHPKRGNYcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkSHPKRGNYcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkSHPKRGNYcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkSHPKRGNYcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkSHPKRGNYcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkSHPKRGNYcjs.DiskStore; exports.EncryptedTokenStorage = _chunkSHPKRGNYcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkSHPKRGNYcjs.GitHubProvider; exports.GoogleProvider = _chunkSHPKRGNYcjs.GoogleProvider; exports.JWKSVerifier = _chunkSHPKRGNYcjs.JWKSVerifier; exports.JWTIssuer = _chunkSHPKRGNYcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkSHPKRGNYcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkSHPKRGNYcjs.OAuthProvider; exports.OAuthProxy = _chunkSHPKRGNYcjs.OAuthProxy; exports.OAuthProxyError = _chunkSHPKRGNYcjs.OAuthProxyError; exports.PKCEUtils = _chunkSHPKRGNYcjs.PKCEUtils; exports.getAuthSession = _chunkSHPKRGNYcjs.getAuthSession; exports.requireAll = _chunkSHPKRGNYcjs.requireAll; exports.requireAny = _chunkSHPKRGNYcjs.requireAny; exports.requireAuth = _chunkSHPKRGNYcjs.requireAuth; exports.requireRole = _chunkSHPKRGNYcjs.requireRole; exports.requireScopes = _chunkSHPKRGNYcjs.requireScopes;
54
+ exports.AuthProvider = _chunkP32QRCBTcjs.AuthProvider; exports.AzureProvider = _chunkP32QRCBTcjs.AzureProvider; exports.ConsentManager = _chunkP32QRCBTcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkP32QRCBTcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkP32QRCBTcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkP32QRCBTcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkP32QRCBTcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkP32QRCBTcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkP32QRCBTcjs.DiskStore; exports.EncryptedTokenStorage = _chunkP32QRCBTcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkP32QRCBTcjs.GitHubProvider; exports.GoogleProvider = _chunkP32QRCBTcjs.GoogleProvider; exports.JWKSVerifier = _chunkP32QRCBTcjs.JWKSVerifier; exports.JWTIssuer = _chunkP32QRCBTcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkP32QRCBTcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkP32QRCBTcjs.OAuthProvider; exports.OAuthProxy = _chunkP32QRCBTcjs.OAuthProxy; exports.OAuthProxyError = _chunkP32QRCBTcjs.OAuthProxyError; exports.PKCEUtils = _chunkP32QRCBTcjs.PKCEUtils; exports.getAuthSession = _chunkP32QRCBTcjs.getAuthSession; exports.requireAll = _chunkP32QRCBTcjs.requireAll; exports.requireAny = _chunkP32QRCBTcjs.requireAny; exports.requireAuth = _chunkP32QRCBTcjs.requireAuth; exports.requireRole = _chunkP32QRCBTcjs.requireRole; exports.requireScopes = _chunkP32QRCBTcjs.requireScopes;
55
55
  //# sourceMappingURL=index.cjs.map
@@ -24,7 +24,7 @@ import {
24
24
  requireAuth,
25
25
  requireRole,
26
26
  requireScopes
27
- } from "../chunk-KKSDTVEW.js";
27
+ } from "../chunk-4SRXSCYR.js";
28
28
  export {
29
29
  AuthProvider,
30
30
  AzureProvider,
@@ -0,0 +1,115 @@
1
+ // src/formatBytes.ts
2
+ var formatBytes = (bytes) => {
3
+ if (bytes >= 1024 * 1024 && bytes % (1024 * 1024) === 0) {
4
+ return `${bytes / (1024 * 1024)} MiB`;
5
+ }
6
+ if (bytes >= 1024 && bytes % 1024 === 0) {
7
+ return `${bytes / 1024} KiB`;
8
+ }
9
+ return `${bytes} bytes`;
10
+ };
11
+
12
+ // src/ownKeysOnly.ts
13
+ var ownKeysOnly = (schema) => Object.defineProperty(schema, "~standard", {
14
+ value: withOwnKeysOnly(schema["~standard"])
15
+ });
16
+ var withOwnKeysOnly = (standard) => ({
17
+ ...standard,
18
+ validate: async (value) => {
19
+ const copies = /* @__PURE__ */ new Map();
20
+ const result = await standard.validate(withoutPrototypes(value, copies));
21
+ if (!result.issues && copies.size > 0) {
22
+ restorePrototypes(result.value, new Set(copies.values()), /* @__PURE__ */ new Set());
23
+ }
24
+ return result;
25
+ }
26
+ });
27
+ var withoutPrototypes = (value, copies) => {
28
+ if (!isPlain(value)) {
29
+ return value;
30
+ }
31
+ const existing = copies.get(value);
32
+ if (existing) {
33
+ return existing;
34
+ }
35
+ const copy = Array.isArray(value) ? [] : /* @__PURE__ */ Object.create(null);
36
+ copies.set(value, copy);
37
+ for (const [key, item] of Object.entries(value)) {
38
+ copy[key] = withoutPrototypes(item, copies);
39
+ }
40
+ return copy;
41
+ };
42
+ var restorePrototypes = (value, copies, seen) => {
43
+ if (!isPlain(value) || seen.has(value)) {
44
+ return;
45
+ }
46
+ seen.add(value);
47
+ if (copies.has(value) && !Array.isArray(value)) {
48
+ Object.setPrototypeOf(value, Object.prototype);
49
+ }
50
+ for (const item of Object.values(value)) {
51
+ restorePrototypes(item, copies, seen);
52
+ }
53
+ };
54
+ var isPlain = (value) => {
55
+ if (typeof value !== "object" || value === null) {
56
+ return false;
57
+ }
58
+ const prototype = Object.getPrototypeOf(value);
59
+ return Array.isArray(value) || prototype === Object.prototype || prototype === null;
60
+ };
61
+
62
+ // src/toSdkSchema.ts
63
+ var toSdkSchema = async (schema, io, convert) => {
64
+ if (!schema) {
65
+ return void 0;
66
+ }
67
+ const standard = withOwnKeysOnly(
68
+ schema["~standard"]
69
+ );
70
+ if (standard.jsonSchema) {
71
+ return { "~standard": standard };
72
+ }
73
+ const json = await convert(schema, io);
74
+ const advertised = io === "input" ? strictInputSchema(json) : json;
75
+ return {
76
+ "~standard": {
77
+ ...standard,
78
+ jsonSchema: { input: () => advertised, output: () => advertised }
79
+ }
80
+ };
81
+ };
82
+ var valibotToJsonSchema = async (schema, io) => {
83
+ let converter;
84
+ try {
85
+ converter = await import("@valibot/to-json-schema");
86
+ } catch {
87
+ throw new Error(
88
+ 'The "@valibot/to-json-schema" package is required to describe Valibot schemas. Install it with: npm install @valibot/to-json-schema'
89
+ );
90
+ }
91
+ return converter.toJsonSchema(schema, {
92
+ errorMode: "ignore",
93
+ typeMode: io
94
+ });
95
+ };
96
+ var strictInputSchema = (schema) => ({
97
+ ...schema,
98
+ additionalProperties: typeof schema.additionalProperties === "object" ? schema.additionalProperties : false,
99
+ ...schema.properties && {
100
+ properties: Object.fromEntries(
101
+ Object.entries(schema.properties).map(([key, value]) => [
102
+ key,
103
+ typeof value === "object" && value.type === "object" ? strictInputSchema(value) : value
104
+ ])
105
+ )
106
+ }
107
+ });
108
+
109
+ export {
110
+ formatBytes,
111
+ ownKeysOnly,
112
+ toSdkSchema,
113
+ valibotToJsonSchema
114
+ };
115
+ //# sourceMappingURL=chunk-4LNVOTEL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/formatBytes.ts","../src/ownKeysOnly.ts","../src/toSdkSchema.ts"],"sourcesContent":["/** Renders a byte cap the way the error message should read (e.g. \"1 MiB\"). */\nexport const formatBytes = (bytes: number): string => {\n if (bytes >= 1024 * 1024 && bytes % (1024 * 1024) === 0) {\n return `${bytes / (1024 * 1024)} MiB`;\n }\n\n if (bytes >= 1024 && bytes % 1024 === 0) {\n return `${bytes / 1024} KiB`;\n }\n\n return `${bytes} bytes`;\n};\n","import type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n/**\n * Has `schema` validate by own keys only — see `withOwnKeysOnly` — by\n * replacing its `~standard` in place. The schema keeps its `shape`, which the\n * SDK reads to complete an argument, and its JSON Schema, which `prompts/list`\n * is built from.\n *\n * For the argument schemas `ViteMCP` and `EdgeViteMCP` build for their\n * prompts. A tool's schemas belong to whoever wrote the tool, so\n * `toSdkSchema` wraps them instead.\n */\nexport const ownKeysOnly = <S extends StandardSchemaV1>(schema: S): S =>\n Object.defineProperty(schema, \"~standard\", {\n value: withOwnKeysOnly(schema[\"~standard\"]),\n });\n\n/**\n * `standard`, with a `validate` that sees only the keys an object has of its\n * own.\n *\n * Zod and Valibot look each key up with `in` and read it with `[]`, and both\n * walk the prototype chain, so a key that was left out reads as present when\n * `Object.prototype` has a member by that name. An optional argument called\n * `toString`, `constructor` or `valueOf`, at any depth, failed every request\n * that left it out, as \"expected string, received function\", and a required\n * one was reported as the wrong type instead of as missing. Validating a copy\n * whose objects have no prototype leaves the library nothing to inherit.\n *\n * A library that hands its input back, as ArkType and `jsonSchemaAdapter` do,\n * hands back the copy, so the copied objects get their prototype back before\n * the value goes on: `execute` still receives ordinary objects.\n */\nexport const withOwnKeysOnly = <P extends StandardSchemaV1.Props>(\n standard: P,\n): P => ({\n ...standard,\n validate: async (value: unknown) => {\n const copies = new Map<object, object>();\n const result = await standard.validate(withoutPrototypes(value, copies));\n\n if (!result.issues && copies.size > 0) {\n restorePrototypes(result.value, new Set(copies.values()), new Set());\n }\n\n return result;\n },\n});\n\n/**\n * `value`, with each plain object in it, at any depth, copied onto one without\n * a prototype, and each array copied to reach them. `copies` maps every\n * original to its copy, so one that occurs twice, or inside itself, is copied\n * once.\n */\nconst withoutPrototypes = (\n value: unknown,\n copies: Map<object, object>,\n): unknown => {\n if (!isPlain(value)) {\n return value;\n }\n\n const existing = copies.get(value);\n\n if (existing) {\n return existing;\n }\n\n const copy: Record<string, unknown> = Array.isArray(value)\n ? []\n : Object.create(null);\n\n copies.set(value, copy);\n\n for (const [key, item] of Object.entries(value)) {\n copy[key] = withoutPrototypes(item, copies);\n }\n\n return copy;\n};\n\n/**\n * Gives each object copy in `copies` that `value` holds, at any depth,\n * `Object.prototype` back.\n */\nconst restorePrototypes = (\n value: unknown,\n copies: Set<object>,\n seen: Set<object>,\n): void => {\n if (!isPlain(value) || seen.has(value)) {\n return;\n }\n\n seen.add(value);\n\n if (copies.has(value) && !Array.isArray(value)) {\n Object.setPrototypeOf(value, Object.prototype);\n }\n\n for (const item of Object.values(value)) {\n restorePrototypes(item, copies, seen);\n }\n};\n\n/**\n * An array, or an object made by a literal or without a prototype: what JSON\n * parses to, and the only kinds of object that are copied.\n */\nconst isPlain = (value: unknown): value is Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const prototype: unknown = Object.getPrototypeOf(value);\n\n return (\n Array.isArray(value) || prototype === Object.prototype || prototype === null\n );\n};\n","import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { JsonSchema } from \"xsschema\";\n\nimport { withOwnKeysOnly } from \"./ownKeysOnly.js\";\n\n/**\n * Turns a Standard Schema that carries no JSON Schema into one. Which\n * libraries that can be done for depends on the runtime, so each entry point\n * supplies its own.\n */\nexport type JsonSchemaConverter = (\n schema: StandardSchemaV1,\n io: \"input\" | \"output\",\n) => Promise<JsonSchema>;\n\n/**\n * A tool's schema as the SDK registers it: one that validates by own keys only\n * (see `withOwnKeysOnly`) and carries a JSON Schema. The schema itself is left\n * as it was, since whoever wrote it may use it elsewhere.\n *\n * Zod v4 and ArkType emit JSON Schema natively, and theirs is kept; anything\n * else (Valibot, say) is converted, and the conversion is only what\n * `tools/list` advertises. Validation stays with the library the schema was\n * written in: the conversion drops what JSON Schema cannot say — a transform,\n * a `check()` — so validating against it instead would pass `execute`\n * arguments the schema never produced.\n *\n * Advertised inputs are closed with `strictInputSchema`. Outputs are left as\n * converted, since closing them would misdescribe results the schema allows.\n *\n * Shared by `ViteMCP` and `EdgeViteMCP`, so what a tool advertises does not\n * depend on which of them serves it. Rejects when `convert` does.\n */\nexport const toSdkSchema = async (\n schema: unknown,\n io: \"input\" | \"output\",\n convert: JsonSchemaConverter,\n): Promise<unknown> => {\n if (!schema) {\n return undefined;\n }\n\n const standard = withOwnKeysOnly(\n (\n schema as {\n \"~standard\": { jsonSchema?: unknown } & StandardSchemaV1.Props;\n }\n )[\"~standard\"],\n );\n\n if (standard.jsonSchema) {\n return { \"~standard\": standard };\n }\n\n const json = await convert(schema as StandardSchemaV1, io);\n const advertised = io === \"input\" ? strictInputSchema(json) : json;\n\n return {\n \"~standard\": {\n ...standard,\n jsonSchema: { input: () => advertised, output: () => advertised },\n },\n };\n};\n\n/**\n * JSON Schema for a Valibot schema, for advertising.\n *\n * Valibot's converter is called directly so it can be told to skip what JSON\n * Schema cannot express — a transform, a `check()` — rather than refuse the\n * whole schema. Valibot still validates, so the copy only has to describe what\n * a caller sends (`typeMode: \"input\"`, which stops at the first transform) or\n * receives (`\"output\"`).\n *\n * The `import()` has to stay inside the `try`. An edge bundle is built with\n * every import resolved ahead of time, and a bundler fails the build over one\n * it cannot resolve — unless it can see the failure is handled, in which case\n * a server that never touches Valibot builds without the converter installed.\n */\nexport const valibotToJsonSchema: JsonSchemaConverter = async (schema, io) => {\n let converter;\n\n try {\n converter = await import(\"@valibot/to-json-schema\");\n } catch {\n throw new Error(\n 'The \"@valibot/to-json-schema\" package is required to describe Valibot ' +\n \"schemas. Install it with: npm install @valibot/to-json-schema\",\n );\n }\n\n return converter.toJsonSchema(schema as never, {\n errorMode: \"ignore\",\n typeMode: io,\n }) as JsonSchema;\n};\n\n/**\n * Closes an advertised input schema's objects to undeclared keys, except where\n * the schema describes those keys itself. A record's value schema, or an\n * object's rest schema, arrives as `additionalProperties`; replacing it with\n * `false` would tell clients the tool takes none of those keys, so a\n * `v.record()` argument could only ever be sent as `{}`.\n */\nconst strictInputSchema = (schema: JsonSchema): JsonSchema => ({\n ...schema,\n additionalProperties:\n typeof schema.additionalProperties === \"object\"\n ? schema.additionalProperties\n : false,\n ...(schema.properties && {\n properties: Object.fromEntries(\n Object.entries(schema.properties).map(([key, value]) => [\n key,\n typeof value === \"object\" && value.type === \"object\"\n ? strictInputSchema(value)\n : value,\n ]),\n ),\n }),\n});\n"],"mappings":"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","names":[]}
@@ -3167,12 +3167,15 @@ var DiskStore = class {
3167
3167
  expiresAt,
3168
3168
  value
3169
3169
  };
3170
+ const tempPath = `${filePath}.${randomUUID()}.tmp`;
3170
3171
  try {
3171
- await writeFile(filePath, JSON.stringify(entry, null, 2), {
3172
+ await writeFile(tempPath, JSON.stringify(entry, null, 2), {
3172
3173
  encoding: "utf-8",
3173
3174
  mode: 384
3174
3175
  });
3176
+ await rename(tempPath, filePath);
3175
3177
  } catch (error) {
3178
+ await rm(tempPath, { force: true });
3176
3179
  console.error(`Failed to save key ${key}:`, error);
3177
3180
  throw error;
3178
3181
  }
@@ -3442,4 +3445,4 @@ export {
3442
3445
  DiskStore,
3443
3446
  JWKSVerifier
3444
3447
  };
3445
- //# sourceMappingURL=chunk-KKSDTVEW.js.map
3448
+ //# sourceMappingURL=chunk-4SRXSCYR.js.map