@vitemcp/server 1.9.12 → 1.9.13
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/dist/{OAuthProvider-B78zmLtB.d.cts → OAuthProvider-BDDi19HO.d.cts} +15 -3
- package/dist/{OAuthProvider-B78zmLtB.d.ts → OAuthProvider-BDDi19HO.d.ts} +15 -3
- package/dist/ViteMCP.cjs +3 -3
- package/dist/ViteMCP.d.cts +2 -2
- package/dist/ViteMCP.d.ts +2 -2
- package/dist/ViteMCP.js +2 -2
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-NZ34AKP4.js → chunk-5XM67UD5.js} +29 -5
- package/dist/chunk-5XM67UD5.js.map +1 -0
- package/dist/{chunk-7T5D57AM.cjs → chunk-NCSND5TI.cjs} +3 -3
- package/dist/{chunk-7T5D57AM.cjs.map → chunk-NCSND5TI.cjs.map} +1 -1
- package/dist/{chunk-WBP37JPX.js → chunk-QGWUABBC.js} +2 -2
- package/dist/{chunk-2X4JCSQQ.cjs → chunk-SKQK3QGJ.cjs} +29 -5
- package/dist/chunk-SKQK3QGJ.cjs.map +1 -0
- package/dist/openapi/index.cjs +99 -35
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +2 -2
- package/dist/openapi/index.d.ts +2 -2
- package/dist/openapi/index.js +82 -18
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2X4JCSQQ.cjs.map +0 -1
- package/dist/chunk-NZ34AKP4.js.map +0 -1
- /package/dist/{chunk-WBP37JPX.js.map → chunk-QGWUABBC.js.map} +0 -0
package/dist/openapi/index.js
CHANGED
|
@@ -3,18 +3,19 @@ import {
|
|
|
3
3
|
ViteMCP,
|
|
4
4
|
cancelResponseBody,
|
|
5
5
|
jsonSchemaAdapter
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-QGWUABBC.js";
|
|
7
|
+
import "../chunk-5XM67UD5.js";
|
|
8
8
|
import "../chunk-JMDI672G.js";
|
|
9
9
|
|
|
10
10
|
// src/openapi/parameters.ts
|
|
11
|
-
var appendQueryParameter = (query, parameter,
|
|
11
|
+
var appendQueryParameter = (query, parameter, given) => {
|
|
12
12
|
const style = parameter.style ?? "form";
|
|
13
13
|
const explode = parameter.explode ?? style === "form";
|
|
14
14
|
const name = parameter.name;
|
|
15
|
-
if (
|
|
15
|
+
if (given === null || given === void 0) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
+
const value = withoutNullMembers(given);
|
|
18
19
|
if (style === "deepObject") {
|
|
19
20
|
if (isRecord(value)) {
|
|
20
21
|
for (const [key, entry] of Object.entries(value)) {
|
|
@@ -74,8 +75,9 @@ var serializePathParameter = (parameter, value) => {
|
|
|
74
75
|
}
|
|
75
76
|
return body;
|
|
76
77
|
};
|
|
77
|
-
var serializeSimpleParameter = (parameter,
|
|
78
|
+
var serializeSimpleParameter = (parameter, given) => {
|
|
78
79
|
const explode = parameter.explode ?? false;
|
|
80
|
+
const value = withoutNullMembers(given);
|
|
79
81
|
if (Array.isArray(value)) {
|
|
80
82
|
return value.map(stringify).join(",");
|
|
81
83
|
}
|
|
@@ -95,6 +97,17 @@ var DELIMITERS = {
|
|
|
95
97
|
spaceDelimited: " "
|
|
96
98
|
};
|
|
97
99
|
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
100
|
+
var withoutNullMembers = (value) => {
|
|
101
|
+
if (Array.isArray(value)) {
|
|
102
|
+
return value.filter((entry) => entry !== null);
|
|
103
|
+
}
|
|
104
|
+
if (isRecord(value)) {
|
|
105
|
+
return Object.fromEntries(
|
|
106
|
+
Object.entries(value).filter(([, entry]) => entry !== null)
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return value;
|
|
110
|
+
};
|
|
98
111
|
var serializeSimple = (value, explode, name, style) => {
|
|
99
112
|
const encode = (entry) => encodeURIComponent(stringify(entry));
|
|
100
113
|
if (Array.isArray(value)) {
|
|
@@ -732,6 +745,41 @@ var collectDefinitions = (schema, definitions) => {
|
|
|
732
745
|
[...referenced].sort().map((name) => [name, definitions[name]])
|
|
733
746
|
);
|
|
734
747
|
};
|
|
748
|
+
var schemaFor = (schema, direction) => {
|
|
749
|
+
if (Array.isArray(schema)) {
|
|
750
|
+
return schema.map((entry) => schemaFor(entry, direction));
|
|
751
|
+
}
|
|
752
|
+
if (!schema || typeof schema !== "object") {
|
|
753
|
+
return schema;
|
|
754
|
+
}
|
|
755
|
+
const result = {};
|
|
756
|
+
for (const [key, entry] of Object.entries(schema)) {
|
|
757
|
+
if (VALUE_KEYWORDS.has(key)) {
|
|
758
|
+
result[key] = entry;
|
|
759
|
+
} else if (SCHEMA_MAP_KEYWORDS.has(key) && entry && typeof entry === "object") {
|
|
760
|
+
result[key] = Object.fromEntries(
|
|
761
|
+
Object.entries(entry).map(
|
|
762
|
+
([name, member]) => [name, schemaFor(member, direction)]
|
|
763
|
+
)
|
|
764
|
+
);
|
|
765
|
+
} else {
|
|
766
|
+
result[key] = schemaFor(entry, direction);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
const { properties, required } = result;
|
|
770
|
+
if (Array.isArray(required) && properties && typeof properties === "object") {
|
|
771
|
+
const otherDirectionOnly = direction === "request" ? "readOnly" : "writeOnly";
|
|
772
|
+
const kept = required.filter(
|
|
773
|
+
(name) => typeof name !== "string" || !Object.hasOwn(properties, name) || properties[name]?.[otherDirectionOnly] !== true
|
|
774
|
+
);
|
|
775
|
+
if (kept.length > 0) {
|
|
776
|
+
result.required = kept;
|
|
777
|
+
} else {
|
|
778
|
+
delete result.required;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
return result;
|
|
782
|
+
};
|
|
735
783
|
var normalizeKeywords = (schema) => {
|
|
736
784
|
if (!("nullable" in schema) && !("required" in schema) && typeof schema.exclusiveMaximum !== "boolean" && typeof schema.exclusiveMinimum !== "boolean") {
|
|
737
785
|
return schema;
|
|
@@ -830,7 +878,7 @@ var buildToolBinding = (route, normalizer, withOutputSchema) => {
|
|
|
830
878
|
const requiredOnceSent = [];
|
|
831
879
|
for (const [name, property] of body.properties) {
|
|
832
880
|
const key = name === "__proto__" ? claimKey(`${name}__body`) : name;
|
|
833
|
-
properties[key] = property.schema;
|
|
881
|
+
properties[key] = schemaFor(property.schema, "request");
|
|
834
882
|
parameters[key] = { kind: "body", name };
|
|
835
883
|
bodyKeys.push(key);
|
|
836
884
|
if (property.required) {
|
|
@@ -849,7 +897,7 @@ var buildToolBinding = (route, normalizer, withOutputSchema) => {
|
|
|
849
897
|
}
|
|
850
898
|
const definitions = collectDefinitions(properties, normalizer.definitions);
|
|
851
899
|
if (definitions) {
|
|
852
|
-
inputSchema.$defs = definitions;
|
|
900
|
+
inputSchema.$defs = definitionsFor(definitions, "request");
|
|
853
901
|
}
|
|
854
902
|
return {
|
|
855
903
|
bodyEncoding: body.encoding,
|
|
@@ -890,7 +938,8 @@ var describeBody = (route, normalizer) => {
|
|
|
890
938
|
if (object && Object.keys(object.properties).length > 0) {
|
|
891
939
|
for (const [name, property] of Object.entries(object.properties)) {
|
|
892
940
|
properties.set(name, {
|
|
893
|
-
|
|
941
|
+
// The server's to fill in; see `schemaFor`.
|
|
942
|
+
required: object.required.has(name) && property.readOnly !== true,
|
|
894
943
|
schema: property
|
|
895
944
|
});
|
|
896
945
|
}
|
|
@@ -901,27 +950,42 @@ var describeBody = (route, normalizer) => {
|
|
|
901
950
|
};
|
|
902
951
|
var MAX_OUTPUT_SCHEMA_DEFINITIONS = 100;
|
|
903
952
|
var buildOutputSchema = (route, normalizer) => {
|
|
904
|
-
const
|
|
905
|
-
const
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
953
|
+
const statuses = Object.keys(route.responses).filter((code) => /^2\d\d$/.test(code)).sort();
|
|
954
|
+
const alternatives = /* @__PURE__ */ new Map();
|
|
955
|
+
for (const status of statuses) {
|
|
956
|
+
const content = route.responses[status]?.content;
|
|
957
|
+
const contentType = content && findJsonContentType(Object.keys(content));
|
|
958
|
+
const raw = contentType ? content?.[contentType]?.schema : void 0;
|
|
959
|
+
if (!raw) {
|
|
960
|
+
return void 0;
|
|
961
|
+
}
|
|
962
|
+
const schema2 = normalizer.normalize(raw);
|
|
963
|
+
if (!resolvesToObject(schema2, normalizer.definitions)) {
|
|
964
|
+
return void 0;
|
|
965
|
+
}
|
|
966
|
+
alternatives.set(JSON.stringify(schema2), schema2);
|
|
910
967
|
}
|
|
911
|
-
|
|
912
|
-
if (!resolvesToObject(schema, normalizer.definitions)) {
|
|
968
|
+
if (alternatives.size === 0) {
|
|
913
969
|
return void 0;
|
|
914
970
|
}
|
|
971
|
+
const [first, ...others] = alternatives.values();
|
|
972
|
+
const schema = others.length === 0 ? first : { anyOf: [first, ...others] };
|
|
915
973
|
const definitions = collectDefinitions(schema, normalizer.definitions);
|
|
916
974
|
if (definitions && Object.keys(definitions).length > MAX_OUTPUT_SCHEMA_DEFINITIONS) {
|
|
917
975
|
return void 0;
|
|
918
976
|
}
|
|
919
977
|
return {
|
|
920
|
-
...schema,
|
|
978
|
+
...schemaFor(schema, "response"),
|
|
921
979
|
type: "object",
|
|
922
|
-
...definitions ? { $defs: definitions } : {}
|
|
980
|
+
...definitions ? { $defs: definitionsFor(definitions, "response") } : {}
|
|
923
981
|
};
|
|
924
982
|
};
|
|
983
|
+
var definitionsFor = (definitions, direction) => Object.fromEntries(
|
|
984
|
+
Object.entries(definitions).map(([name, definition]) => [
|
|
985
|
+
name,
|
|
986
|
+
schemaFor(definition, direction)
|
|
987
|
+
])
|
|
988
|
+
);
|
|
925
989
|
var describeParameter = (parameter, normalizer) => {
|
|
926
990
|
const schema = normalizer.normalize(parameter.schema ?? { type: "string" });
|
|
927
991
|
const description = [
|