fastmcp 4.28.4 → 4.29.0
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 +21 -0
- package/dist/FastMCP.cjs +4 -4
- package/dist/FastMCP.d.cts +4 -2
- package/dist/FastMCP.d.ts +4 -2
- package/dist/FastMCP.js +3 -3
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-DPJW5QEO.cjs → chunk-5EEESM57.cjs} +64 -92
- package/dist/chunk-5EEESM57.cjs.map +1 -0
- package/dist/{chunk-OCCYKYIM.cjs → chunk-FBDPX4H2.cjs} +30 -3
- package/dist/chunk-FBDPX4H2.cjs.map +1 -0
- package/dist/{chunk-B2QUCZGV.js → chunk-JCKJRUCE.js} +30 -3
- package/dist/chunk-JCKJRUCE.js.map +1 -0
- package/dist/{chunk-UFPH23EN.js → chunk-RWPENEKV.js} +5 -1
- package/dist/{chunk-UFPH23EN.js.map → chunk-RWPENEKV.js.map} +1 -1
- package/dist/{chunk-7IQ5QHVZ.cjs → chunk-UHJQUSUX.cjs} +5 -1
- package/dist/chunk-UHJQUSUX.cjs.map +1 -0
- package/dist/{chunk-Q57EM4LH.js → chunk-VN5SZ6IE.js} +31 -59
- package/dist/chunk-VN5SZ6IE.js.map +1 -0
- package/dist/edge/index.cjs +15 -4
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.d.cts +4 -0
- package/dist/edge/index.d.ts +4 -0
- package/dist/edge/index.js +13 -2
- package/dist/edge/index.js.map +1 -1
- package/dist/examples/custom-routes.cjs +4 -4
- package/dist/examples/custom-routes.js +3 -3
- package/dist/openapi/index.cjs +145 -132
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.js +136 -123
- package/dist/openapi/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-7IQ5QHVZ.cjs.map +0 -1
- package/dist/chunk-B2QUCZGV.js.map +0 -1
- package/dist/chunk-DPJW5QEO.cjs.map +0 -1
- package/dist/chunk-OCCYKYIM.cjs.map +0 -1
- package/dist/chunk-Q57EM4LH.js.map +0 -1
package/dist/openapi/index.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
5
|
+
var _chunk5EEESM57cjs = require('../chunk-5EEESM57.cjs');
|
|
6
|
+
require('../chunk-UHJQUSUX.cjs');
|
|
7
|
+
require('../chunk-FBDPX4H2.cjs');
|
|
8
8
|
|
|
9
9
|
// src/openapi/loadSpec.ts
|
|
10
10
|
var _swaggerparser = require('@apidevtools/swagger-parser'); var _swaggerparser2 = _interopRequireDefault(_swaggerparser);
|
|
@@ -220,7 +220,8 @@ function extractBodyProperties(requestBody, sharedDefs) {
|
|
|
220
220
|
}
|
|
221
221
|
const schema = bodyEncoding === "form" ? resolveComponentRef(declaredSchema, sharedDefs) : declaredSchema;
|
|
222
222
|
const schemaProperties = schema.properties;
|
|
223
|
-
|
|
223
|
+
const composedJsonBody = bodyEncoding === "json" && ["allOf", "anyOf", "oneOf"].some((key) => Array.isArray(schema[key]));
|
|
224
|
+
if (!composedJsonBody && schema.type === "object" && schemaProperties && (bodyEncoding === "form" || schema.additionalProperties === false || Object.keys(schemaProperties).length > 0)) {
|
|
224
225
|
const requiredNames = new Set(
|
|
225
226
|
_nullishCoalesce(schema.required, () => ( []))
|
|
226
227
|
);
|
|
@@ -517,115 +518,30 @@ function slugify(value) {
|
|
|
517
518
|
|
|
518
519
|
// src/openapi/requestBuilder.ts
|
|
519
520
|
async function executeRequest(options) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
);
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
const bodyProps = /* @__PURE__ */ Object.create(null);
|
|
531
|
-
for (const [key, value] of Object.entries(options.args)) {
|
|
532
|
-
const mapping = options.parameterMap[key];
|
|
533
|
-
if (!mapping || value === void 0) {
|
|
534
|
-
continue;
|
|
535
|
-
}
|
|
536
|
-
if (value === null && (mapping.in === "query" || mapping.in === "header" || mapping.in === "cookie")) {
|
|
537
|
-
continue;
|
|
538
|
-
}
|
|
539
|
-
switch (mapping.in) {
|
|
540
|
-
case "body":
|
|
541
|
-
bodyProps[mapping.name] = value;
|
|
542
|
-
break;
|
|
543
|
-
case "cookie": {
|
|
544
|
-
const pair = `${mapping.name}=${encodeCookieValue(mapping, value)}`;
|
|
545
|
-
const existing = headers.get("cookie");
|
|
546
|
-
headers.set("cookie", existing ? `${existing}; ${pair}` : pair);
|
|
547
|
-
break;
|
|
548
|
-
}
|
|
549
|
-
case "header":
|
|
550
|
-
headers.set(
|
|
551
|
-
mapping.name,
|
|
552
|
-
serializeHeaderValue(value, mapping.style, mapping.explode)
|
|
553
|
-
);
|
|
554
|
-
break;
|
|
555
|
-
case "path":
|
|
556
|
-
pathParams[mapping.name] = encodePathValue(
|
|
557
|
-
value,
|
|
558
|
-
mapping.style,
|
|
559
|
-
mapping.explode
|
|
560
|
-
);
|
|
561
|
-
break;
|
|
562
|
-
case "query": {
|
|
563
|
-
const query = new URLSearchParams();
|
|
564
|
-
appendQueryValue(
|
|
565
|
-
query,
|
|
566
|
-
mapping.name,
|
|
567
|
-
mapping.style,
|
|
568
|
-
value,
|
|
569
|
-
mapping.explode
|
|
570
|
-
);
|
|
571
|
-
if (query.size > 0) {
|
|
572
|
-
queryParts.push(serializeQuery(query, mapping.allowReserved));
|
|
573
|
-
}
|
|
574
|
-
break;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
let path = options.route.path;
|
|
579
|
-
for (const [name, value] of Object.entries(pathParams)) {
|
|
580
|
-
path = path.replaceAll(`{${name}}`, value);
|
|
581
|
-
}
|
|
582
|
-
assertNoSubstitutedDotSegments(options.route, path);
|
|
583
|
-
const url = new URL(baseUrl.replace(/\/$/, "") + path);
|
|
584
|
-
url.search = queryParts.join("&");
|
|
585
|
-
let body;
|
|
586
|
-
const requiredJsonBody = options.bodyEncoding === "json" && _optionalChain([options, 'access', _19 => _19.route, 'access', _20 => _20.requestBody, 'optionalAccess', _21 => _21.required]) === true && !options.wholeBodyKey;
|
|
587
|
-
if (Object.keys(bodyProps).length > 0 || requiredJsonBody) {
|
|
588
|
-
const payload = options.wholeBodyKey ? bodyProps[options.wholeBodyKey] : bodyProps;
|
|
589
|
-
if (options.bodyEncoding === "form") {
|
|
590
|
-
if (!headers.has("content-type")) {
|
|
591
|
-
headers.set("content-type", "application/x-www-form-urlencoded");
|
|
592
|
-
}
|
|
593
|
-
body = encodeFormBody(payload);
|
|
594
|
-
} else {
|
|
595
|
-
if (!headers.has("content-type")) {
|
|
596
|
-
headers.set("content-type", "application/json");
|
|
597
|
-
}
|
|
598
|
-
body = JSON.stringify(payload);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
const response = await options.fetchImpl(url.toString(), {
|
|
602
|
-
body,
|
|
603
|
-
headers,
|
|
604
|
-
method: options.route.method.toUpperCase(),
|
|
605
|
-
signal: options.signal
|
|
606
|
-
});
|
|
607
|
-
const text = await response.text();
|
|
608
|
-
if (!response.ok) {
|
|
609
|
-
throw new (0, _chunkDPJW5QEOcjs.UserError)(
|
|
610
|
-
`${options.route.method.toUpperCase()} ${path} failed with ${response.status}: ${text.slice(0, 2e3)}`
|
|
611
|
-
);
|
|
521
|
+
return readTextResponse(await fetchResponse(options));
|
|
522
|
+
}
|
|
523
|
+
async function executeResourceRequest(options) {
|
|
524
|
+
const response = await fetchResponse(options);
|
|
525
|
+
const mimeType = _optionalChain([response, 'access', _19 => _19.headers, 'access', _20 => _20.get, 'call', _21 => _21("content-type"), 'optionalAccess', _22 => _22.split, 'call', _23 => _23(";"), 'access', _24 => _24[0], 'access', _25 => _25.trim, 'call', _26 => _26(), 'access', _27 => _27.toLowerCase, 'call', _28 => _28()]);
|
|
526
|
+
if (mimeType && !mimeType.startsWith("text/") && !mimeType.includes("json") && !/(?:\/|\+)(?:x-)?(?:xml|yaml|javascript|ecmascript)$/.test(mimeType) && mimeType !== "application/x-www-form-urlencoded") {
|
|
527
|
+
return {
|
|
528
|
+
blob: Buffer.from(await response.arrayBuffer()).toString("base64"),
|
|
529
|
+
mimeType
|
|
530
|
+
};
|
|
612
531
|
}
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
return { text };
|
|
620
|
-
}
|
|
532
|
+
const { text } = await readTextResponse(response);
|
|
533
|
+
try {
|
|
534
|
+
JSON.parse(text);
|
|
535
|
+
return { mimeType: "application/json", text };
|
|
536
|
+
} catch (e2) {
|
|
537
|
+
return { mimeType: "text/plain", text };
|
|
621
538
|
}
|
|
622
|
-
return { text };
|
|
623
539
|
}
|
|
624
540
|
function resolveBaseUrl(servers, origin, overrideUrl) {
|
|
625
541
|
if (overrideUrl) {
|
|
626
542
|
return overrideUrl.replace(/\/$/, "");
|
|
627
543
|
}
|
|
628
|
-
const server = _optionalChain([servers, 'optionalAccess',
|
|
544
|
+
const server = _optionalChain([servers, 'optionalAccess', _29 => _29[0]]);
|
|
629
545
|
if (!server) {
|
|
630
546
|
throw new Error(
|
|
631
547
|
"The OpenAPI document has no `servers` entry. Pass `baseUrl` to fromOpenAPI() explicitly."
|
|
@@ -709,7 +625,7 @@ function assertNoSubstitutedDotSegments(route, resolvedPath) {
|
|
|
709
625
|
const templateSegments = new Set(route.path.split("/"));
|
|
710
626
|
for (const segment of resolvedPath.split("/")) {
|
|
711
627
|
if ((segment === "." || segment === "..") && !templateSegments.has(segment)) {
|
|
712
|
-
throw new (0,
|
|
628
|
+
throw new (0, _chunk5EEESM57cjs.UserError)(
|
|
713
629
|
`${route.method.toUpperCase()} ${route.path}: path parameter values must not produce a "${segment}" path segment.`
|
|
714
630
|
);
|
|
715
631
|
}
|
|
@@ -722,7 +638,7 @@ function encodeCookieValue(mapping, value) {
|
|
|
722
638
|
return encodePathComponent(text);
|
|
723
639
|
}
|
|
724
640
|
if (/[;,]/.test(text)) {
|
|
725
|
-
throw new (0,
|
|
641
|
+
throw new (0, _chunk5EEESM57cjs.UserError)(
|
|
726
642
|
`Cookie parameter "${mapping.name}" uses style "cookie" and its value contains ";" or ","`
|
|
727
643
|
);
|
|
728
644
|
}
|
|
@@ -765,6 +681,115 @@ function encodePathValue(value, style, explode) {
|
|
|
765
681
|
}
|
|
766
682
|
return encodeURIComponent(String(value));
|
|
767
683
|
}
|
|
684
|
+
async function fetchResponse(options) {
|
|
685
|
+
const baseUrl = resolveBaseUrl(
|
|
686
|
+
options.servers,
|
|
687
|
+
options.origin,
|
|
688
|
+
options.baseUrlOverride
|
|
689
|
+
);
|
|
690
|
+
const pathParams = /* @__PURE__ */ Object.create(null);
|
|
691
|
+
const queryParts = [];
|
|
692
|
+
const headers = new Headers(
|
|
693
|
+
await resolveHeaders(options.headers, options.context)
|
|
694
|
+
);
|
|
695
|
+
const bodyProps = /* @__PURE__ */ Object.create(null);
|
|
696
|
+
for (const [key, value] of Object.entries(options.args)) {
|
|
697
|
+
const mapping = options.parameterMap[key];
|
|
698
|
+
if (!mapping || value === void 0) {
|
|
699
|
+
continue;
|
|
700
|
+
}
|
|
701
|
+
if (value === null && (mapping.in === "query" || mapping.in === "header" || mapping.in === "cookie")) {
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
switch (mapping.in) {
|
|
705
|
+
case "body":
|
|
706
|
+
bodyProps[mapping.name] = value;
|
|
707
|
+
break;
|
|
708
|
+
case "cookie": {
|
|
709
|
+
const pair = `${mapping.name}=${encodeCookieValue(mapping, value)}`;
|
|
710
|
+
const existing = headers.get("cookie");
|
|
711
|
+
headers.set("cookie", existing ? `${existing}; ${pair}` : pair);
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
case "header":
|
|
715
|
+
headers.set(
|
|
716
|
+
mapping.name,
|
|
717
|
+
serializeHeaderValue(value, mapping.style, mapping.explode)
|
|
718
|
+
);
|
|
719
|
+
break;
|
|
720
|
+
case "path":
|
|
721
|
+
pathParams[mapping.name] = encodePathValue(
|
|
722
|
+
value,
|
|
723
|
+
mapping.style,
|
|
724
|
+
mapping.explode
|
|
725
|
+
);
|
|
726
|
+
break;
|
|
727
|
+
case "query": {
|
|
728
|
+
const query = new URLSearchParams();
|
|
729
|
+
appendQueryValue(
|
|
730
|
+
query,
|
|
731
|
+
mapping.name,
|
|
732
|
+
mapping.style,
|
|
733
|
+
value,
|
|
734
|
+
mapping.explode
|
|
735
|
+
);
|
|
736
|
+
if (query.size > 0) {
|
|
737
|
+
queryParts.push(serializeQuery(query, mapping.allowReserved));
|
|
738
|
+
}
|
|
739
|
+
break;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
let path = options.route.path;
|
|
744
|
+
for (const [name, value] of Object.entries(pathParams)) {
|
|
745
|
+
path = path.replaceAll(`{${name}}`, value);
|
|
746
|
+
}
|
|
747
|
+
assertNoSubstitutedDotSegments(options.route, path);
|
|
748
|
+
const url = new URL(baseUrl.replace(/\/$/, "") + path);
|
|
749
|
+
url.search = queryParts.join("&");
|
|
750
|
+
let body;
|
|
751
|
+
const requiredJsonBody = options.bodyEncoding === "json" && _optionalChain([options, 'access', _30 => _30.route, 'access', _31 => _31.requestBody, 'optionalAccess', _32 => _32.required]) === true && !options.wholeBodyKey;
|
|
752
|
+
if (Object.keys(bodyProps).length > 0 || requiredJsonBody) {
|
|
753
|
+
const payload = options.wholeBodyKey ? bodyProps[options.wholeBodyKey] : bodyProps;
|
|
754
|
+
if (options.bodyEncoding === "form") {
|
|
755
|
+
if (!headers.has("content-type")) {
|
|
756
|
+
headers.set("content-type", "application/x-www-form-urlencoded");
|
|
757
|
+
}
|
|
758
|
+
body = encodeFormBody(payload);
|
|
759
|
+
} else {
|
|
760
|
+
if (!headers.has("content-type")) {
|
|
761
|
+
headers.set("content-type", "application/json");
|
|
762
|
+
}
|
|
763
|
+
body = JSON.stringify(payload);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
const response = await options.fetchImpl(url.toString(), {
|
|
767
|
+
body,
|
|
768
|
+
headers,
|
|
769
|
+
method: options.route.method.toUpperCase(),
|
|
770
|
+
signal: options.signal
|
|
771
|
+
});
|
|
772
|
+
if (!response.ok) {
|
|
773
|
+
const text = await response.text();
|
|
774
|
+
throw new (0, _chunk5EEESM57cjs.UserError)(
|
|
775
|
+
`${options.route.method.toUpperCase()} ${path} failed with ${response.status}: ${text.slice(0, 2e3)}`
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
return response;
|
|
779
|
+
}
|
|
780
|
+
async function readTextResponse(response) {
|
|
781
|
+
const text = await response.text();
|
|
782
|
+
const mediaType = _optionalChain([response, 'access', _33 => _33.headers, 'access', _34 => _34.get, 'call', _35 => _35("content-type"), 'optionalAccess', _36 => _36.split, 'call', _37 => _37(";"), 'access', _38 => _38[0]]);
|
|
783
|
+
if (_optionalChain([mediaType, 'optionalAccess', _39 => _39.toLowerCase, 'call', _40 => _40(), 'access', _41 => _41.includes, 'call', _42 => _42("json")])) {
|
|
784
|
+
try {
|
|
785
|
+
const json = JSON.parse(text);
|
|
786
|
+
return { json, text: JSON.stringify(json, null, 2) };
|
|
787
|
+
} catch (e4) {
|
|
788
|
+
return { text };
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
return { text };
|
|
792
|
+
}
|
|
768
793
|
async function resolveHeaders(headers, context) {
|
|
769
794
|
if (!headers) {
|
|
770
795
|
return {};
|
|
@@ -885,7 +910,7 @@ function extractRoutes(document) {
|
|
|
885
910
|
requestBody: operation.requestBody ? resolveRef(document, operation.requestBody) : void 0,
|
|
886
911
|
responses: resolveResponses(document, operation.responses),
|
|
887
912
|
servers: [operation.servers, pathItem.servers, document.servers].find(
|
|
888
|
-
(servers) => _optionalChain([servers, 'optionalAccess',
|
|
913
|
+
(servers) => _optionalChain([servers, 'optionalAccess', _43 => _43.length])
|
|
889
914
|
),
|
|
890
915
|
summary: operation.summary,
|
|
891
916
|
tags: _nullishCoalesce(operation.tags, () => ( []))
|
|
@@ -936,7 +961,7 @@ function resolveRef(document, value) {
|
|
|
936
961
|
);
|
|
937
962
|
let node = document;
|
|
938
963
|
for (const segment of segments) {
|
|
939
|
-
node = _optionalChain([node, 'optionalAccess',
|
|
964
|
+
node = _optionalChain([node, 'optionalAccess', _44 => _44[segment]]);
|
|
940
965
|
}
|
|
941
966
|
return node;
|
|
942
967
|
}
|
|
@@ -1006,8 +1031,8 @@ async function fromOpenAPI(options) {
|
|
|
1006
1031
|
const selected = selectRoutes(routes, options);
|
|
1007
1032
|
const names = generateNames(selected, options.mcpNames);
|
|
1008
1033
|
const sharedDefs = buildSharedDefs(document);
|
|
1009
|
-
const server = _nullishCoalesce(options.server, () => ( new (0,
|
|
1010
|
-
name: _nullishCoalesce(_nullishCoalesce(options.name, () => ( _optionalChain([document, 'access',
|
|
1034
|
+
const server = _nullishCoalesce(options.server, () => ( new (0, _chunk5EEESM57cjs.FastMCP)({
|
|
1035
|
+
name: _nullishCoalesce(_nullishCoalesce(options.name, () => ( _optionalChain([document, 'access', _45 => _45.info, 'optionalAccess', _46 => _46.title]))), () => ( "OpenAPI Server")),
|
|
1011
1036
|
version: _nullishCoalesce(options.version, () => ( "1.0.0"))
|
|
1012
1037
|
})));
|
|
1013
1038
|
const skippedOperations = [];
|
|
@@ -1052,7 +1077,7 @@ async function fromOpenAPI(options) {
|
|
|
1052
1077
|
continue;
|
|
1053
1078
|
}
|
|
1054
1079
|
const outputSchemaJson = buildOutputSchema(route, sharedDefs);
|
|
1055
|
-
const outputSchema = outputSchemaJson ?
|
|
1080
|
+
const outputSchema = outputSchemaJson ? _chunk5EEESM57cjs.jsonSchemaAdapter.call(void 0, outputSchemaJson) : void 0;
|
|
1056
1081
|
server.addTool({
|
|
1057
1082
|
description: _nullishCoalesce(route.summary, () => ( `${route.method.toUpperCase()} ${route.path}`)),
|
|
1058
1083
|
execute: async (args, context) => {
|
|
@@ -1067,7 +1092,7 @@ async function fromOpenAPI(options) {
|
|
|
1067
1092
|
return resolveToolResult(result, outputSchema);
|
|
1068
1093
|
},
|
|
1069
1094
|
name,
|
|
1070
|
-
parameters:
|
|
1095
|
+
parameters: _chunk5EEESM57cjs.jsonSchemaAdapter.call(void 0, flatSchema),
|
|
1071
1096
|
...outputSchema ? { outputSchema } : {}
|
|
1072
1097
|
});
|
|
1073
1098
|
}
|
|
@@ -1086,9 +1111,7 @@ function registerResource(server, route, name, parameterMap, requiredKeys, execO
|
|
|
1086
1111
|
if (mapping.kind === "resource") {
|
|
1087
1112
|
server.addResource({
|
|
1088
1113
|
description,
|
|
1089
|
-
load: async (_auth, context) =>
|
|
1090
|
-
await executeRequest({ ...execOptions, args: {}, context })
|
|
1091
|
-
),
|
|
1114
|
+
load: async (_auth, context) => executeResourceRequest({ ...execOptions, args: {}, context }),
|
|
1092
1115
|
name,
|
|
1093
1116
|
uri: mapping.uri
|
|
1094
1117
|
});
|
|
@@ -1097,13 +1120,11 @@ function registerResource(server, route, name, parameterMap, requiredKeys, execO
|
|
|
1097
1120
|
server.addResourceTemplate({
|
|
1098
1121
|
arguments: mapping.args,
|
|
1099
1122
|
description,
|
|
1100
|
-
load: async (args, _auth, context) =>
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
})
|
|
1106
|
-
),
|
|
1123
|
+
load: async (args, _auth, context) => executeResourceRequest({
|
|
1124
|
+
...execOptions,
|
|
1125
|
+
args,
|
|
1126
|
+
context
|
|
1127
|
+
}),
|
|
1107
1128
|
name,
|
|
1108
1129
|
uriTemplate: mapping.uriTemplate
|
|
1109
1130
|
});
|
|
@@ -1121,14 +1142,6 @@ async function resolveToolResult(result, outputSchema) {
|
|
|
1121
1142
|
}
|
|
1122
1143
|
return { content: [{ text, type: "text" }], isError: true };
|
|
1123
1144
|
}
|
|
1124
|
-
function wrapAsResourceResult({ text }) {
|
|
1125
|
-
try {
|
|
1126
|
-
JSON.parse(text);
|
|
1127
|
-
return { mimeType: "application/json", text };
|
|
1128
|
-
} catch (e4) {
|
|
1129
|
-
return { mimeType: "text/plain", text };
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
1145
|
|
|
1133
1146
|
|
|
1134
1147
|
exports.fromOpenAPI = fromOpenAPI;
|