@vitemcp/server 1.9.1 → 1.9.3
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 +3 -1
- package/dist/ViteMCP.cjs +4 -4
- package/dist/ViteMCP.js +3 -3
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-IHX3AXKW.js → chunk-3O5CBV4T.js} +8 -8
- package/dist/chunk-3O5CBV4T.js.map +1 -0
- package/dist/{chunk-KKSDTVEW.js → chunk-4SRXSCYR.js} +5 -2
- package/dist/{chunk-KKSDTVEW.js.map → chunk-4SRXSCYR.js.map} +1 -1
- package/dist/{chunk-4FH73ERY.js → chunk-NKMXT32U.js} +15 -1
- package/dist/chunk-NKMXT32U.js.map +1 -0
- package/dist/{chunk-SHPKRGNY.cjs → chunk-P32QRCBT.cjs} +5 -2
- package/dist/chunk-P32QRCBT.cjs.map +1 -0
- package/dist/{chunk-FEM6LNS4.cjs → chunk-SM24SJ4X.cjs} +16 -2
- package/dist/chunk-SM24SJ4X.cjs.map +1 -0
- package/dist/{chunk-Y52P2PCS.cjs → chunk-WRKQIQHB.cjs} +12 -12
- package/dist/chunk-WRKQIQHB.cjs.map +1 -0
- package/dist/edge/index.cjs +6 -5
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.js +3 -2
- package/dist/edge/index.js.map +1 -1
- package/dist/openapi/index.cjs +56 -26
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.js +48 -18
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -3
- package/dist/chunk-4FH73ERY.js.map +0 -1
- package/dist/chunk-FEM6LNS4.cjs.map +0 -1
- package/dist/chunk-IHX3AXKW.js.map +0 -1
- package/dist/chunk-SHPKRGNY.cjs.map +0 -1
- package/dist/chunk-Y52P2PCS.cjs.map +0 -1
|
@@ -9,6 +9,19 @@ var formatBytes = (bytes) => {
|
|
|
9
9
|
return `${bytes} bytes`;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// src/ownKeysOnly.ts
|
|
13
|
+
var ownKeysOnly = (schema) => {
|
|
14
|
+
const standard = schema["~standard"];
|
|
15
|
+
return Object.defineProperty(schema, "~standard", {
|
|
16
|
+
value: {
|
|
17
|
+
...standard,
|
|
18
|
+
validate: (value) => standard.validate(
|
|
19
|
+
typeof value === "object" && value !== null && !Array.isArray(value) ? Object.assign(/* @__PURE__ */ Object.create(null), value) : value
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
12
25
|
// src/toSdkSchema.ts
|
|
13
26
|
var toSdkSchema = async (schema, io, convert) => {
|
|
14
27
|
if (!schema) {
|
|
@@ -58,7 +71,8 @@ var strictInputSchema = (schema) => ({
|
|
|
58
71
|
|
|
59
72
|
export {
|
|
60
73
|
formatBytes,
|
|
74
|
+
ownKeysOnly,
|
|
61
75
|
toSdkSchema,
|
|
62
76
|
valibotToJsonSchema
|
|
63
77
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
78
|
+
//# sourceMappingURL=chunk-NKMXT32U.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 an object by its own keys only.\n *\n * Zod looks each key up with `in` and reads it with `[]`, and both walk the\n * prototype chain, so an argument the client left out reads as present when\n * `Object.prototype` has a member by that name. An optional prompt argument\n * called `toString`, `constructor` or `valueOf` failed every request that left\n * it out, as \"expected string, received function\", and a required one was\n * reported as the wrong type instead of as missing. A copy of the input without\n * a prototype leaves Zod nothing to inherit.\n *\n * Only `~standard.validate` changes. 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 * Shared by `ViteMCP` and `EdgeViteMCP`, which both build their prompts'\n * argument schemas with Zod.\n */\nexport const ownKeysOnly = <S extends StandardSchemaV1>(schema: S): S => {\n const standard = schema[\"~standard\"];\n\n return Object.defineProperty(schema, \"~standard\", {\n value: {\n ...standard,\n validate: (value: unknown) =>\n standard.validate(\n typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? Object.assign(Object.create(null), value)\n : value,\n ),\n },\n });\n};\n","import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { JsonSchema } from \"xsschema\";\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 * Gives the SDK a JSON Schema for a schema that has none of its own. Zod v4\n * and ArkType emit JSON Schema natively and pass through; anything else\n * (Valibot, say) is converted, and the conversion is only what `tools/list`\n * advertises. Validation stays with the library the schema was written in:\n * the conversion drops what JSON Schema cannot say — a transform, a\n * `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 = (\n schema as {\n \"~standard\": { jsonSchema?: unknown } & StandardSchemaV1.Props;\n }\n )[\"~standard\"];\n\n if (standard.jsonSchema) {\n return schema;\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 jsonSchema: { input: () => advertised, output: () => advertised },\n validate: (value: unknown) => standard.validate(value),\n vendor: standard.vendor,\n version: standard.version,\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":";AACO,IAAM,cAAc,CAAC,UAA0B;AACpD,MA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AAAA,IAC7C,WAAW;AAAA,IACX,UAAU;AAAA,EACZ,CAAC;AACH;AASA,IAAM,oBAAoB,CAAC,YAAoC;AAAA,EAC7D,GAAG;AAAA,EACH,sBACE,OAAO,OAAO,yBAAyB,WACnC,OAAO,uBACP;AAAA,EACN,GAAI,OAAO,cAAc;AAAA,IACvB,YAAY,OAAO;AAAA,MACjB,OAAO,QAAQ,OAAO,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,QACtD;AAAA,QACA,OAAO,UAAU,YAAY,MAAM,SAAS,WACxC,kBAAkB,KAAK,IACvB;AAAA,MACN,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
|
|
@@ -3167,12 +3167,15 @@ var DiskStore = (_class6 = class {
|
|
|
3167
3167
|
expiresAt,
|
|
3168
3168
|
value
|
|
3169
3169
|
};
|
|
3170
|
+
const tempPath = `${filePath}.${_crypto.randomUUID.call(void 0, )}.tmp`;
|
|
3170
3171
|
try {
|
|
3171
|
-
await _promises.writeFile.call(void 0,
|
|
3172
|
+
await _promises.writeFile.call(void 0, tempPath, JSON.stringify(entry, null, 2), {
|
|
3172
3173
|
encoding: "utf-8",
|
|
3173
3174
|
mode: 384
|
|
3174
3175
|
});
|
|
3176
|
+
await _promises.rename.call(void 0, tempPath, filePath);
|
|
3175
3177
|
} catch (error) {
|
|
3178
|
+
await _promises.rm.call(void 0, tempPath, { force: true });
|
|
3176
3179
|
console.error(`Failed to save key ${key}:`, error);
|
|
3177
3180
|
throw error;
|
|
3178
3181
|
}
|
|
@@ -3442,4 +3445,4 @@ Original error: ${error.message}`
|
|
|
3442
3445
|
|
|
3443
3446
|
|
|
3444
3447
|
exports.withoutTrailingSlash = withoutTrailingSlash; exports.getAuthSession = getAuthSession; exports.requireAll = requireAll; exports.requireAny = requireAny; exports.requireAuth = requireAuth; exports.requireRole = requireRole; exports.requireScopes = requireScopes; exports.DEFAULT_ACCESS_TOKEN_TTL = DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_REFRESH_TOKEN_TTL = DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_AUTHORIZATION_CODE_TTL = DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_TRANSACTION_TTL = DEFAULT_TRANSACTION_TTL; exports.ConsentManager = ConsentManager; exports.JWTIssuer = JWTIssuer; exports.PKCEUtils = PKCEUtils; exports.EncryptedTokenStorage = EncryptedTokenStorage; exports.MemoryTokenStorage = MemoryTokenStorage; exports.OAuthProxy = OAuthProxy; exports.OAuthProxyError = OAuthProxyError; exports.AuthProvider = AuthProvider; exports.AzureProvider = AzureProvider; exports.GitHubProvider = GitHubProvider; exports.GoogleProvider = GoogleProvider; exports.OAuthProvider = OAuthProvider; exports.DiskStore = DiskStore; exports.JWKSVerifier = JWKSVerifier;
|
|
3445
|
-
//# sourceMappingURL=chunk-
|
|
3448
|
+
//# sourceMappingURL=chunk-P32QRCBT.cjs.map
|