@farm.js/core 0.1.37 → 0.1.39
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/{agent-mcp-BC0bAGVF.d.mts → agent-mcp-BhneNPb4.d.mts} +1 -1
- package/dist/{agent-mcp-jyDHbQKe.d.ts → agent-mcp-HcTYQmNX.d.ts} +1 -1
- package/dist/{agent-mcp-handler-SJAHFSPI.cjs → agent-mcp-handler-MRGP3WJ3.cjs} +5 -5
- package/dist/{agent-mcp-handler-LPJ2CADR.mjs → agent-mcp-handler-OLRMZONF.mjs} +4 -4
- package/dist/agent-runtime.cjs +3 -3
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +2 -2
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +5 -5
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +4 -4
- package/dist/api/runtime.cjs +4 -4
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api/runtime.mjs +3 -3
- package/dist/api.cjs +7 -7
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +6 -6
- package/dist/{app-CKO3iN1c.d.ts → app-CMkoghtp.d.ts} +21 -3
- package/dist/{app-Cbkj9ufe.d.mts → app-DVzmmbNO.d.mts} +21 -3
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/app-markdown.mjs +3 -3
- package/dist/chunk-2ZYGC6SS.cjs +576 -0
- package/dist/{chunk-75X755YZ.cjs → chunk-34UCJRQO.cjs} +2 -2
- package/dist/{chunk-CVH2BXPY.cjs → chunk-3LOLJTFV.cjs} +6 -6
- package/dist/{chunk-4GPOC4LN.cjs → chunk-472NCAZ7.cjs} +3 -3
- package/dist/{chunk-O6WAEAX3.mjs → chunk-5BWWFHR2.mjs} +70 -15
- package/dist/{chunk-6LGFV2CQ.cjs → chunk-5OKBARDN.cjs} +2 -2
- package/dist/{chunk-3IP27TCG.cjs → chunk-5PWXMJOH.cjs} +19 -19
- package/dist/{chunk-WT4TGLXT.cjs → chunk-5ULKUBIA.cjs} +6 -6
- package/dist/{chunk-WRPHYQVY.mjs → chunk-677THUVP.mjs} +1 -1
- package/dist/chunk-6BK3K2GB.mjs +318 -0
- package/dist/{chunk-HEVMCTSR.mjs → chunk-6HB6V3R7.mjs} +1 -1
- package/dist/{chunk-NICDYKBS.cjs → chunk-6XWDE2P2.cjs} +22 -4
- package/dist/{chunk-CXEN47J3.mjs → chunk-73WX6PRY.mjs} +25 -0
- package/dist/{chunk-EXG5LD6B.mjs → chunk-75HN5IZ3.mjs} +21 -9
- package/dist/{chunk-7O5M4UKW.cjs → chunk-A657YSP4.cjs} +2 -2
- package/dist/{chunk-LBDP3YT3.mjs → chunk-ARC7I3O2.mjs} +1 -1
- package/dist/{chunk-Q5FYSK45.cjs → chunk-AS2VPMEE.cjs} +640 -521
- package/dist/{chunk-Z5BEWYVO.mjs → chunk-ATSDUUFK.mjs} +27 -1
- package/dist/{chunk-EMMQ64QW.cjs → chunk-B5J2YVG7.cjs} +16 -16
- package/dist/{chunk-FWE7LEQC.cjs → chunk-BD3D7EZV.cjs} +4 -4
- package/dist/{chunk-Z7LA7MHQ.mjs → chunk-BFJTHYTN.mjs} +1 -1
- package/dist/{chunk-UJZLSXUB.cjs → chunk-BWIQR4DH.cjs} +30 -4
- package/dist/{chunk-W2YDNK66.cjs → chunk-BXDJXFQG.cjs} +4 -4
- package/dist/{chunk-MCIZVNOQ.mjs → chunk-BZHXGVMA.mjs} +1 -1
- package/dist/{chunk-7DWNJI73.cjs → chunk-CIOT4HGT.cjs} +37 -19
- package/dist/{chunk-KDTBF3UU.mjs → chunk-CNNOLE4O.mjs} +1 -1
- package/dist/{chunk-TDNWPAVR.mjs → chunk-CUM5NYL5.mjs} +1 -1
- package/dist/{chunk-HITLGIAO.cjs → chunk-CY2ZQ5C6.cjs} +7 -6
- package/dist/{chunk-KPFKMDM7.mjs → chunk-EGCTIS5F.mjs} +2 -2
- package/dist/{chunk-VR4GD5I3.cjs → chunk-EIPC3FDA.cjs} +12 -4
- package/dist/{chunk-B5PFZLKV.cjs → chunk-EKN7NSZO.cjs} +25 -8
- package/dist/{chunk-6SJ2KJTA.mjs → chunk-EPYU2EBL.mjs} +1 -1
- package/dist/{chunk-LBGILORX.mjs → chunk-GKBWWRBG.mjs} +101 -10
- package/dist/{chunk-PTZ2TVNE.cjs → chunk-H5CLOUZS.cjs} +5 -5
- package/dist/{chunk-DTSROJ5J.mjs → chunk-HD5CF3OE.mjs} +1 -1
- package/dist/{chunk-3A4KGQYI.cjs → chunk-HRETEZ2Z.cjs} +27 -15
- package/dist/{chunk-ATWHHSY2.cjs → chunk-HRSAQ23K.cjs} +7 -7
- package/dist/{chunk-IAIYV4RZ.mjs → chunk-HXRYZWTA.mjs} +1 -1
- package/dist/{chunk-4P6ULFMD.mjs → chunk-HYTZYOW2.mjs} +222 -103
- package/dist/{chunk-HMRSWN47.mjs → chunk-INL3THCU.mjs} +1 -1
- package/dist/{chunk-FBOJ55OM.mjs → chunk-IVLZZZEI.mjs} +1 -1
- package/dist/{chunk-ENLZ4R3Y.mjs → chunk-J7K2NZD6.mjs} +7 -6
- package/dist/{chunk-PMQHMWZU.cjs → chunk-JCYYXBAJ.cjs} +3 -3
- package/dist/{chunk-K3SAEIM3.mjs → chunk-KTSUBU2E.mjs} +2 -2
- package/dist/{chunk-LPFV45AY.cjs → chunk-LMPAPBUA.cjs} +19 -19
- package/dist/{chunk-EK4QAEFZ.cjs → chunk-LZESP4IR.cjs} +25 -0
- package/dist/{chunk-TW4GYDBJ.mjs → chunk-MLY2RP5R.mjs} +10 -2
- package/dist/{chunk-BHY547NB.cjs → chunk-NBBEQLOK.cjs} +9 -9
- package/dist/{chunk-WQ7T2263.mjs → chunk-OAHTRMIC.mjs} +3 -3
- package/dist/{chunk-HZFM2LWQ.mjs → chunk-P3PLW4FR.mjs} +34 -2
- package/dist/{chunk-UH6QN5NL.mjs → chunk-P664ZVTV.mjs} +2 -2
- package/dist/{chunk-TE2G5ION.cjs → chunk-PGZDEPTM.cjs} +88 -33
- package/dist/{chunk-3KGDJLJK.mjs → chunk-POSPE3IO.mjs} +19 -1
- package/dist/{chunk-FGRYBX5X.mjs → chunk-PVZE2JGJ.mjs} +2 -2
- package/dist/{chunk-TPLJVC7E.mjs → chunk-QFW2IH5E.mjs} +23 -6
- package/dist/{chunk-5BXGGEC7.cjs → chunk-QG775BRV.cjs} +17 -17
- package/dist/{chunk-S3VWVTVA.mjs → chunk-QRKIMN7T.mjs} +13 -1
- package/dist/chunk-QTXBII4Z.cjs +632 -0
- package/dist/{chunk-NQ6QFZWD.cjs → chunk-QUCXCDE2.cjs} +1 -1
- package/dist/{chunk-NFMDCAOS.mjs → chunk-QYMZOOC5.mjs} +3 -3
- package/dist/{chunk-CI6E3UOH.cjs → chunk-RG4A6LB2.cjs} +7 -7
- package/dist/{chunk-LOFKRKO7.cjs → chunk-RVXFINNS.cjs} +113 -22
- package/dist/{chunk-7SQ5SGYZ.cjs → chunk-RW63BOV7.cjs} +2 -2
- package/dist/{chunk-U6MPZ35Q.cjs → chunk-RWFLWR5J.cjs} +8 -8
- package/dist/{chunk-EUV4YR3V.cjs → chunk-SGBJ247Q.cjs} +18 -2
- package/dist/{chunk-J3ANCZKA.mjs → chunk-SKVTP5PR.mjs} +1 -1
- package/dist/{chunk-YCKO6FRS.mjs → chunk-SOP2EAA6.mjs} +1 -1
- package/dist/{chunk-ND2CWPOD.mjs → chunk-TS4JHGUJ.mjs} +1 -1
- package/dist/chunk-U6QLDL3G.mjs +576 -0
- package/dist/{chunk-OW67PDDS.cjs → chunk-ULASELLA.cjs} +13 -1
- package/dist/{chunk-4GWRFP22.cjs → chunk-UPJLHLJU.cjs} +35 -3
- package/dist/{chunk-WWIKMBRN.mjs → chunk-VNGH5MLF.mjs} +17 -1
- package/dist/{chunk-NNSAQX3U.mjs → chunk-VT4WFRHA.mjs} +1 -1
- package/dist/{chunk-JPNFPAZ4.mjs → chunk-VWBHM3F6.mjs} +2 -2
- package/dist/{chunk-ADOAUDQ6.cjs → chunk-VXEEATVD.cjs} +2 -2
- package/dist/{chunk-RRMVL6CJ.mjs → chunk-W36M2BQ4.mjs} +1 -1
- package/dist/{chunk-4WQ6PGSJ.cjs → chunk-WEW2JVA4.cjs} +4 -4
- package/dist/{chunk-4E5WBPEG.mjs → chunk-WFRT7JPX.mjs} +8 -533
- package/dist/{chunk-VXAWRDK7.mjs → chunk-WLL43JMO.mjs} +1 -1
- package/dist/chunk-WW46B6HA.cjs +318 -0
- package/dist/{chunk-D3C5LBQY.cjs → chunk-WXJLNP33.cjs} +2 -2
- package/dist/{chunk-NDILNQ4L.cjs → chunk-XKG2BLFN.cjs} +2 -2
- package/dist/{chunk-6TJITR2B.cjs → chunk-YFYUYWL7.cjs} +870 -751
- package/dist/{chunk-XOPOIFTJ.mjs → chunk-YKZRDB5Z.mjs} +25 -7
- package/dist/{chunk-K4I4O5TS.mjs → chunk-ZUPXLIGB.mjs} +790 -671
- package/dist/{chunk-G2TEB74S.cjs → chunk-ZXH4TS3F.cjs} +2 -2
- package/dist/{client-plugins-CV4eJ9De.d.mts → client-plugins-CsCuCLBz.d.mts} +58 -7
- package/dist/{client-plugins-C8DjftDF.d.ts → client-plugins-D0ke-Hc8.d.ts} +58 -7
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +7 -7
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +6 -6
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-KVOY2TCZ.mjs → devtools-5AFIPVUJ.mjs} +8 -6
- package/dist/{devtools-JXFQNWSH.cjs → devtools-LW4QQ5J3.cjs} +9 -7
- package/dist/docs.cjs +12 -10
- package/dist/docs.d.mts +20 -2
- package/dist/docs.d.ts +20 -2
- package/dist/docs.mjs +11 -9
- package/dist/headers.cjs +6 -4
- package/dist/headers.d.mts +11 -1
- package/dist/headers.d.ts +11 -1
- package/dist/headers.mjs +5 -3
- package/dist/index.cjs +55 -42
- package/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.mjs +55 -42
- package/dist/integrations.cjs +5 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +4 -2
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +30 -29
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +29 -28
- package/dist/internal/cli-runtime.cjs +11 -9
- package/dist/internal/cli-runtime.mjs +10 -8
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +9 -7
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +8 -6
- package/dist/internal/docs-precompiled-runtime.cjs +19 -13
- package/dist/internal/docs-precompiled-runtime.d.mts +5 -0
- package/dist/internal/docs-precompiled-runtime.d.ts +5 -0
- package/dist/internal/docs-precompiled-runtime.mjs +14 -8
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-node-env.cjs +6 -2
- package/dist/internal/production-node-env.d.mts +10 -1
- package/dist/internal/production-node-env.d.ts +10 -1
- package/dist/internal/production-node-env.mjs +5 -1
- package/dist/internal/production-runtime.cjs +38 -16
- package/dist/internal/production-runtime.d.mts +51 -11
- package/dist/internal/production-runtime.d.ts +51 -11
- package/dist/internal/production-runtime.mjs +40 -18
- package/dist/markdown.cjs +8 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +7 -1
- package/dist/middleware.cjs +10 -8
- package/dist/middleware.d.mts +24 -4
- package/dist/middleware.d.ts +24 -4
- package/dist/middleware.mjs +10 -8
- package/dist/navigation.cjs +6 -6
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +5 -5
- package/dist/plugin.cjs +23 -22
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +22 -21
- package/dist/{production-runtime-C2kkrPVZ.d.ts → production-runtime-BaI3WHnV.d.ts} +1 -1
- package/dist/{production-runtime-Du_FHb2-.d.mts → production-runtime-DfRP0cV0.d.mts} +1 -1
- package/dist/query/client.cjs +8 -8
- package/dist/query/client.mjs +3 -3
- package/dist/{render-plan-BnnPTpus.d.ts → render-plan-CfIdJKAf.d.ts} +1 -1
- package/dist/{render-plan-Cgx7v8tJ.d.mts → render-plan-Dg8RBYFa.d.mts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +13 -4
- package/dist/renderer.d.ts +13 -4
- package/dist/{request-BNWr7r5e.d.ts → request-CEbHIIl4.d.ts} +4 -2
- package/dist/{request-sKayKcop.d.mts → request-DfE02G_A.d.mts} +4 -2
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-DWFp3Yq4.d.mts → route-rendering-BHyOfXjD.d.mts} +1 -1
- package/dist/{route-rendering-Bx4Auw6Q.d.ts → route-rendering-C4oHbv6C.d.ts} +1 -1
- package/dist/{router-BK6K42Ij.d.mts → router-DwhA61SB.d.mts} +1 -1
- package/dist/{router-DnW_2tQi.d.ts → router-uRN_29Em.d.ts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{runtime-DJDaCMd_.d.mts → runtime-BEdHhN4C.d.mts} +1 -1
- package/dist/{runtime-CA3Ei5k_.d.ts → runtime-COk03hmx.d.ts} +1 -1
- package/dist/server-fn.cjs +3 -3
- package/dist/server-fn.mjs +2 -2
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query.cjs +4 -4
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +49 -48
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +27 -26
- package/dist/{spa-router-Mwbd7g2L.d.ts → spa-router-DrVOBVGg.d.ts} +2 -2
- package/dist/{spa-router-D6fUA4Rn.d.mts → spa-router-w4aFOuyn.d.mts} +2 -2
- package/dist/testing.cjs +5 -5
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +4 -4
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-p9Hs-jCc.d.mts → utils-BtYehqeU.d.mts} +1 -1
- package/dist/{utils-BwVcAfUR.d.ts → utils-Dhuqwmd2.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +23 -22
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +22 -21
- package/package.json +1 -1
- package/dist/chunk-655RLQQL.mjs +0 -43
- package/dist/chunk-MRMI32SN.cjs +0 -1157
- package/dist/chunk-MT763TDW.cjs +0 -43
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkH5CLOUZScjs = require('./chunk-H5CLOUZS.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
@@ -41,10 +41,10 @@ async function handleFarmDefaultMCPRequest(request, context) {
|
|
|
41
41
|
return transportError(403, "Cross-origin requests are not allowed.");
|
|
42
42
|
}
|
|
43
43
|
const protocolHeader = request.headers.get("mcp-protocol-version");
|
|
44
|
-
if (protocolHeader && !
|
|
44
|
+
if (protocolHeader && !_chunkH5CLOUZScjs.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.includes(protocolHeader.trim())) {
|
|
45
45
|
return transportError(
|
|
46
46
|
400,
|
|
47
|
-
`Unsupported MCP-Protocol-Version: ${protocolHeader.slice(0, 32)}. Supported: ${
|
|
47
|
+
`Unsupported MCP-Protocol-Version: ${protocolHeader.slice(0, 32)}. Supported: ${_chunkH5CLOUZScjs.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.join(", ")}.`
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
const contentType = _nullishCoalesce(request.headers.get("content-type"), () => ( ""));
|
|
@@ -102,7 +102,7 @@ async function dispatch(method, params, request, context) {
|
|
|
102
102
|
switch (method) {
|
|
103
103
|
case "initialize": {
|
|
104
104
|
const requested = isRecord(params) ? params.protocolVersion : void 0;
|
|
105
|
-
const protocolVersion = typeof requested === "string" &&
|
|
105
|
+
const protocolVersion = typeof requested === "string" && _chunkH5CLOUZScjs.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.includes(requested) ? requested : _chunkH5CLOUZScjs.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS[0];
|
|
106
106
|
return {
|
|
107
107
|
protocolVersion,
|
|
108
108
|
capabilities: { tools: { listChanged: false } },
|
|
@@ -110,7 +110,7 @@ async function dispatch(method, params, request, context) {
|
|
|
110
110
|
name: context.server.name,
|
|
111
111
|
version: context.server.version,
|
|
112
112
|
...context.server.title ? { title: context.server.title } : {},
|
|
113
|
-
description:
|
|
113
|
+
description: _chunkH5CLOUZScjs.FARM_DEFAULT_MCP_DESCRIPTION
|
|
114
114
|
},
|
|
115
115
|
instructions: INSTRUCTIONS
|
|
116
116
|
};
|
|
@@ -118,7 +118,7 @@ async function dispatch(method, params, request, context) {
|
|
|
118
118
|
case "ping":
|
|
119
119
|
return {};
|
|
120
120
|
case "tools/list":
|
|
121
|
-
return { tools:
|
|
121
|
+
return { tools: _chunkH5CLOUZScjs.FARM_DEFAULT_MCP_TOOLS };
|
|
122
122
|
case "tools/call":
|
|
123
123
|
return callTool(params, request, context);
|
|
124
124
|
default:
|
|
@@ -130,7 +130,7 @@ async function callTool(params, request, context) {
|
|
|
130
130
|
if (!isRecord(params) || typeof params.name !== "string") {
|
|
131
131
|
throw new FarmMCPRequestError(INVALID_PARAMS, "tools/call needs a tool name.");
|
|
132
132
|
}
|
|
133
|
-
const tool =
|
|
133
|
+
const tool = _chunkH5CLOUZScjs.FARM_DEFAULT_MCP_TOOLS.find(({ name }) => name === params.name);
|
|
134
134
|
if (!tool) {
|
|
135
135
|
throw new FarmMCPRequestError(INVALID_PARAMS, `Unknown tool: ${params.name.slice(0, 64)}`);
|
|
136
136
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkH5CLOUZScjs = require('./chunk-H5CLOUZS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkOWOUTKIJcjs = require('./chunk-OWOUTKIJ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkWEW2JVA4cjs = require('./chunk-WEW2JVA4.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk2ZYGC6SScjs = require('./chunk-2ZYGC6SS.cjs');
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
@@ -15,6 +18,14 @@ var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
|
15
18
|
var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
|
|
16
19
|
|
|
17
20
|
|
|
21
|
+
var _chunkBWIQR4DHcjs = require('./chunk-BWIQR4DH.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
var _chunkUPJLHLJUcjs = require('./chunk-UPJLHLJU.cjs');
|
|
27
|
+
|
|
28
|
+
|
|
18
29
|
var _chunkTKJZFIMLcjs = require('./chunk-TKJZFIML.cjs');
|
|
19
30
|
|
|
20
31
|
|
|
@@ -27,10 +38,11 @@ var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
|
27
38
|
|
|
28
39
|
|
|
29
40
|
|
|
41
|
+
|
|
30
42
|
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
31
43
|
|
|
32
44
|
|
|
33
|
-
var
|
|
45
|
+
var _chunkQUCXCDE2cjs = require('./chunk-QUCXCDE2.cjs');
|
|
34
46
|
|
|
35
47
|
|
|
36
48
|
var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
|
|
@@ -219,6 +231,71 @@ ${html}`;
|
|
|
219
231
|
}
|
|
220
232
|
_chunkS3JO3N4Hcjs.__name.call(void 0, composeFarmFullDocument, "composeFarmFullDocument");
|
|
221
233
|
|
|
234
|
+
// src/middleware/may-handle.ts
|
|
235
|
+
function hasFarmMiddlewareConfig(config) {
|
|
236
|
+
if (!config) return false;
|
|
237
|
+
if (Array.isArray(config)) return config.length > 0;
|
|
238
|
+
const configRecord = config;
|
|
239
|
+
return Boolean(
|
|
240
|
+
configRecord.matcher || configRecord.exclude || configRecord.runtime || configRecord.handler || Array.isArray(configRecord.handlers) && configRecord.handlers.length > 0
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmMiddlewareConfig, "hasFarmMiddlewareConfig");
|
|
244
|
+
function configMiddlewareMayHandlePath(config, pathname) {
|
|
245
|
+
if (!hasFarmMiddlewareConfig(config)) return false;
|
|
246
|
+
const entries = Array.isArray(config) ? config : [config];
|
|
247
|
+
return entries.some((entry) => {
|
|
248
|
+
if (!entry.matcher && !entry.exclude) return true;
|
|
249
|
+
const matchers = entry.matcher ? (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).map(
|
|
250
|
+
(matcher) => (
|
|
251
|
+
// A request-aware matcher cannot be proven safe at build time.
|
|
252
|
+
typeof matcher === "function" ? () => true : matcher
|
|
253
|
+
)
|
|
254
|
+
) : void 0;
|
|
255
|
+
const compiled = _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, { matcher: matchers, exclude: entry.exclude });
|
|
256
|
+
return _chunkUPJLHLJUcjs.matchesCompiledMiddlewareConfig.call(void 0, pathname, compiled, {}).matched;
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, configMiddlewareMayHandlePath, "configMiddlewareMayHandlePath");
|
|
260
|
+
function appMiddlewareMayHandlePath(middlewareRoutes, pathname) {
|
|
261
|
+
return middlewareRoutes.some((route) => _chunkUPJLHLJUcjs.matchesMiddlewareRoute.call(void 0, pathname, route).matched);
|
|
262
|
+
}
|
|
263
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, appMiddlewareMayHandlePath, "appMiddlewareMayHandlePath");
|
|
264
|
+
var CATCH_ALL_PROBE = "/__farm-listing-probe__/0";
|
|
265
|
+
function isPathSpecificMatcher(matcher) {
|
|
266
|
+
if (typeof matcher === "function") return false;
|
|
267
|
+
const compiled = _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, { matcher });
|
|
268
|
+
return !_chunkUPJLHLJUcjs.matchesCompiledMiddlewareConfig.call(void 0, CATCH_ALL_PROBE, compiled, {}).matched;
|
|
269
|
+
}
|
|
270
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isPathSpecificMatcher, "isPathSpecificMatcher");
|
|
271
|
+
function pathSpecificConfigMiddlewareCovers(config, pathname) {
|
|
272
|
+
if (!hasFarmMiddlewareConfig(config)) return false;
|
|
273
|
+
const entries = Array.isArray(config) ? config : [config];
|
|
274
|
+
return entries.some((entry) => {
|
|
275
|
+
if (!entry.matcher) return false;
|
|
276
|
+
const matchers = (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).filter(
|
|
277
|
+
isPathSpecificMatcher
|
|
278
|
+
);
|
|
279
|
+
if (matchers.length === 0) return false;
|
|
280
|
+
const compiled = _chunkUPJLHLJUcjs.compileMiddlewareConfig.call(void 0, { matcher: matchers, exclude: entry.exclude });
|
|
281
|
+
return _chunkUPJLHLJUcjs.matchesCompiledMiddlewareConfig.call(void 0, pathname, compiled, {}).matched;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, pathSpecificConfigMiddlewareCovers, "pathSpecificConfigMiddlewareCovers");
|
|
285
|
+
function farmPathGuardCoversPage(options, pathname) {
|
|
286
|
+
return appMiddlewareMayHandlePath(
|
|
287
|
+
options.middlewareRoutes.filter((route) => route.path !== "/"),
|
|
288
|
+
pathname
|
|
289
|
+
) || pathSpecificConfigMiddlewareCovers(options.config.middleware, pathname) || _chunkBWIQR4DHcjs.integrationMiddlewareMayHandlePath.call(void 0, options.config.integrations, pathname, CATCH_ALL_PROBE);
|
|
290
|
+
}
|
|
291
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, farmPathGuardCoversPage, "farmPathGuardCoversPage");
|
|
292
|
+
function farmPathGuardCoversEndpoint(options, path, apiServerBasePath) {
|
|
293
|
+
return _chunkKNBBQHO2cjs.createFarmAPIMiddlewarePathnames.call(void 0, apiServerBasePath)(path).some(
|
|
294
|
+
(pathname) => farmPathGuardCoversPage(options, pathname)
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, farmPathGuardCoversEndpoint, "farmPathGuardCoversEndpoint");
|
|
298
|
+
|
|
222
299
|
// src/i18n/alternates.ts
|
|
223
300
|
function renderFarmLocaleAlternateLinks(pathname, config, options = {}) {
|
|
224
301
|
if (config.routing === "none") return "";
|
|
@@ -269,13 +346,19 @@ function isLateRedirectTarget(url) {
|
|
|
269
346
|
}
|
|
270
347
|
}
|
|
271
348
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isLateRedirectTarget, "isLateRedirectTarget");
|
|
272
|
-
function createLateRedirectRecovery(url) {
|
|
349
|
+
function createLateRedirectRecovery(url, nonce) {
|
|
273
350
|
if (!isLateRedirectTarget(url)) return "";
|
|
274
|
-
return
|
|
351
|
+
return _chunk2ZYGC6SScjs.stampFarmCspNonce.call(void 0,
|
|
352
|
+
`<script>window.location.replace(${serializeForInlineScript(url)})</script>`,
|
|
353
|
+
nonce
|
|
354
|
+
);
|
|
275
355
|
}
|
|
276
356
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createLateRedirectRecovery, "createLateRedirectRecovery");
|
|
277
|
-
function createLateNotFoundRecovery(content) {
|
|
278
|
-
return `<template id="${TEMPLATE_ID}">${content}</template
|
|
357
|
+
function createLateNotFoundRecovery(content, nonce) {
|
|
358
|
+
return `<template id="${TEMPLATE_ID}">${content}</template>` + _chunk2ZYGC6SScjs.stampFarmCspNonce.call(void 0,
|
|
359
|
+
`<script>(function(){var t=document.getElementById("${TEMPLATE_ID}");var p=document.getElementById("${PAGE_CONTAINER_ID}");if(t&&p){p.replaceChildren(t.content.cloneNode(true));}if(t)t.remove();document.documentElement.dataset.farmLateNotFound="true";var m=document.createElement("meta");m.name="robots";m.content="noindex";document.head.appendChild(m);})();</script>`,
|
|
360
|
+
nonce
|
|
361
|
+
);
|
|
279
362
|
}
|
|
280
363
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createLateNotFoundRecovery, "createLateNotFoundRecovery");
|
|
281
364
|
|
|
@@ -402,7 +485,7 @@ function createFarmMetadataRouteResponse(kind, value, routeModule = {}, options
|
|
|
402
485
|
if (isResponse(value)) {
|
|
403
486
|
return method === "HEAD" ? _chunkTKJZFIMLcjs.omitFarmResponseBody.call(void 0, value) : value;
|
|
404
487
|
}
|
|
405
|
-
const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ?
|
|
488
|
+
const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ? _chunkWEW2JVA4cjs.serializeFarmLlmsTxt.call(void 0, value) : serializeManifest(value);
|
|
406
489
|
const contentType = kind === "sitemap" ? "application/xml; charset=utf-8" : kind === "robots" || kind === "llms" || kind === "llms-full" ? "text/plain; charset=utf-8" : "application/manifest+json; charset=utf-8";
|
|
407
490
|
return new Response(method === "HEAD" ? null : body, {
|
|
408
491
|
headers: {
|
|
@@ -763,7 +846,9 @@ function createFarmThemeDocumentParts(input, basePath = "/", serverTheme) {
|
|
|
763
846
|
const script = createFarmThemeBootstrapScript(config, hydrationTheme);
|
|
764
847
|
return {
|
|
765
848
|
attributes: ` data-theme="${initialTheme}"`,
|
|
766
|
-
head:
|
|
849
|
+
head: _chunk2ZYGC6SScjs.stampFarmCspNonce.call(void 0,
|
|
850
|
+
`<style id="${THEME_STYLE_ID}">:root[data-theme="light"]{color-scheme:light}:root[data-theme="dark"]{color-scheme:dark}</style><script id="${THEME_SCRIPT_ID}">${script}</script>`
|
|
851
|
+
)
|
|
767
852
|
};
|
|
768
853
|
}
|
|
769
854
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmThemeDocumentParts, "createFarmThemeDocumentParts");
|
|
@@ -912,7 +997,7 @@ function createFarmAppManifest(input, { full = false } = {}) {
|
|
|
912
997
|
const manifest = {
|
|
913
998
|
schemaVersion: 1,
|
|
914
999
|
app: {
|
|
915
|
-
farm:
|
|
1000
|
+
farm: _chunkQUCXCDE2cjs.FARM_VERSION,
|
|
916
1001
|
renderer: input.renderer,
|
|
917
1002
|
basePath: input.basePath,
|
|
918
1003
|
build: input.build
|
|
@@ -920,16 +1005,17 @@ function createFarmAppManifest(input, { full = false } = {}) {
|
|
|
920
1005
|
packages: input.packages,
|
|
921
1006
|
mcp: {
|
|
922
1007
|
servers: _chunk75RZHGLScjs._listFarmMCPCatalogs.call(void 0, ).map(({ server, tools, details }) => {
|
|
923
|
-
const
|
|
1008
|
+
const open = _optionalChain([details, 'optionalAccess', _37 => _37.public]) === true && !_optionalChain([input, 'access', _38 => _38.guardCoversPath, 'optionalCall', _39 => _39(server.path)]);
|
|
1009
|
+
const listed = full || open;
|
|
924
1010
|
return {
|
|
925
1011
|
name: server.name,
|
|
926
1012
|
version: server.version,
|
|
927
1013
|
path: server.path,
|
|
928
|
-
authorization:
|
|
929
|
-
resources: listed ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess',
|
|
930
|
-
prompts: listed ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess',
|
|
1014
|
+
authorization: open ? "none" : "required",
|
|
1015
|
+
resources: listed ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _40 => _40.resources]), () => ( []))] : [],
|
|
1016
|
+
prompts: listed ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _41 => _41.prompts]), () => ( []))] : [],
|
|
931
1017
|
tools: (listed ? tools : []).map((tool) => {
|
|
932
|
-
const schemas = _optionalChain([details, 'optionalAccess',
|
|
1018
|
+
const schemas = _optionalChain([details, 'optionalAccess', _42 => _42.schemas, 'optionalAccess', _43 => _43[tool.name]]);
|
|
933
1019
|
const hints = Object.fromEntries(
|
|
934
1020
|
["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"].filter((hint) => typeof tool[hint] === "boolean").map((hint) => [hint, tool[hint]])
|
|
935
1021
|
);
|
|
@@ -942,7 +1028,7 @@ function createFarmAppManifest(input, { full = false } = {}) {
|
|
|
942
1028
|
...full && tool.kind === "endpoint" ? { method: tool.method, path: tool.path } : {},
|
|
943
1029
|
...hints,
|
|
944
1030
|
...schemas ? { inputSchema: schemas.input } : {},
|
|
945
|
-
..._optionalChain([schemas, 'optionalAccess',
|
|
1031
|
+
..._optionalChain([schemas, 'optionalAccess', _44 => _44.output]) ? { outputSchema: schemas.output } : {}
|
|
946
1032
|
};
|
|
947
1033
|
})
|
|
948
1034
|
};
|
|
@@ -958,7 +1044,7 @@ function createFarmAppManifest(input, { full = false } = {}) {
|
|
|
958
1044
|
}
|
|
959
1045
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmAppManifest, "createFarmAppManifest");
|
|
960
1046
|
function listDefaultServer(input) {
|
|
961
|
-
const server = _optionalChain([input, 'access',
|
|
1047
|
+
const server = _optionalChain([input, 'access', _45 => _45.defaultMCP, 'optionalCall', _46 => _46()]);
|
|
962
1048
|
if (!server) return [];
|
|
963
1049
|
return [
|
|
964
1050
|
{
|
|
@@ -968,7 +1054,7 @@ function listDefaultServer(input) {
|
|
|
968
1054
|
authorization: "none",
|
|
969
1055
|
resources: [],
|
|
970
1056
|
prompts: [],
|
|
971
|
-
tools:
|
|
1057
|
+
tools: _chunkH5CLOUZScjs.FARM_DEFAULT_MCP_TOOLS.map((tool) => ({
|
|
972
1058
|
name: tool.name,
|
|
973
1059
|
title: tool.title,
|
|
974
1060
|
description: tool.description,
|
|
@@ -1011,7 +1097,7 @@ async function verifyFarmInfraManifestSignature(header, key, now = Date.now()) {
|
|
|
1011
1097
|
if (!header || header.length > 2048) return false;
|
|
1012
1098
|
const parts = header.split(",").map((part) => part.trim());
|
|
1013
1099
|
const timestamp = Number(
|
|
1014
|
-
_optionalChain([/^t=(\d{1,12})$/, 'access',
|
|
1100
|
+
_optionalChain([/^t=(\d{1,12})$/, 'access', _47 => _47.exec, 'call', _48 => _48(_nullishCoalesce(parts.find((part) => part.startsWith("t=")), () => ( ""))), 'optionalAccess', _49 => _49[1]])
|
|
1015
1101
|
);
|
|
1016
1102
|
if (!Number.isSafeInteger(timestamp)) return false;
|
|
1017
1103
|
if (Math.abs(now / 1e3 - timestamp) > SIGNATURE_WINDOW_SECONDS) return false;
|
|
@@ -1023,7 +1109,7 @@ ${timestamp}`);
|
|
|
1023
1109
|
}
|
|
1024
1110
|
_chunkS3JO3N4Hcjs.__name.call(void 0, verifyFarmInfraManifestSignature, "verifyFarmInfraManifestSignature");
|
|
1025
1111
|
function processEnv() {
|
|
1026
|
-
return _nullishCoalesce(_optionalChain([globalThis, 'access',
|
|
1112
|
+
return _nullishCoalesce(_optionalChain([globalThis, 'access', _50 => _50.process, 'optionalAccess', _51 => _51.env]), () => ( {}));
|
|
1027
1113
|
}
|
|
1028
1114
|
_chunkS3JO3N4Hcjs.__name.call(void 0, processEnv, "processEnv");
|
|
1029
1115
|
var CORS_HEADERS = {
|
|
@@ -1042,7 +1128,7 @@ async function createFarmAppManifestResponse(request, input, options = {}) {
|
|
|
1042
1128
|
});
|
|
1043
1129
|
}
|
|
1044
1130
|
const signature = request.headers.get(FARM_INFRA_SIGNATURE_HEADER);
|
|
1045
|
-
const key = input.analytics ? _optionalChain([(_nullishCoalesce(options.env, () => ( processEnv()))), 'access',
|
|
1131
|
+
const key = input.analytics ? _optionalChain([(_nullishCoalesce(options.env, () => ( processEnv()))), 'access', _52 => _52.FARMJS_API_KEY, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()]) : void 0;
|
|
1046
1132
|
const full = Boolean(
|
|
1047
1133
|
signature && key && await verifyFarmInfraManifestSignature(signature, key)
|
|
1048
1134
|
);
|
|
@@ -1098,4 +1184,9 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmAppManifestResponse, "createFarm
|
|
|
1098
1184
|
|
|
1099
1185
|
|
|
1100
1186
|
|
|
1101
|
-
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
exports.formatRouteSegment = formatRouteSegment; exports.createRouteDirectoryPattern = createRouteDirectoryPattern; exports.stripRouteGroups = stripRouteGroups; exports.getRouteGroupScope = getRouteGroupScope; exports.isInRouteGroupScope = isInRouteGroupScope; exports.getRouteDirectoryDepth = getRouteDirectoryDepth; exports.routeBoundaryCoversDirectory = routeBoundaryCoversDirectory; exports.HOISTED_HEAD_ELEMENT = HOISTED_HEAD_ELEMENT; exports.extractFarmFullDocument = extractFarmFullDocument; exports.classifyFarmDocumentPrefix = classifyFarmDocumentPrefix; exports.removeFarmDocumentTitles = removeFarmDocumentTitles; exports.ensureFarmDocumentMeta = ensureFarmDocumentMeta; exports.composeFarmFullDocument = composeFarmFullDocument; exports.hasFarmMiddlewareConfig = hasFarmMiddlewareConfig; exports.configMiddlewareMayHandlePath = configMiddlewareMayHandlePath; exports.appMiddlewareMayHandlePath = appMiddlewareMayHandlePath; exports.farmPathGuardCoversPage = farmPathGuardCoversPage; exports.farmPathGuardCoversEndpoint = farmPathGuardCoversEndpoint; exports.renderFarmLocaleAlternateLinks = renderFarmLocaleAlternateLinks; exports.createLateRedirectRecovery = createLateRedirectRecovery; exports.createLateNotFoundRecovery = createLateNotFoundRecovery; exports.createFarmMetadataRouteResponse = createFarmMetadataRouteResponse; exports.listFarmMCPLlmsTxtLinks = listFarmMCPLlmsTxtLinks; exports.createFarmAiCatalogResponse = createFarmAiCatalogResponse; exports.resolveDefaultErrorStatus = resolveDefaultErrorStatus; exports.getDefaultErrorStatusText = getDefaultErrorStatusText; exports.createDefaultErrorMarkup = createDefaultErrorMarkup; exports.createFarmThemeDocumentParts = createFarmThemeDocumentParts; exports.applyFarmThemeDocument = applyFarmThemeDocument; exports.FARM_API_CATALOG_PATH = FARM_API_CATALOG_PATH; exports.resolveFarmApiCatalogInput = resolveFarmApiCatalogInput; exports.createFarmApiCatalogResponse = createFarmApiCatalogResponse; exports.FARM_APP_MANIFEST_PATH = FARM_APP_MANIFEST_PATH; exports.FARM_APP_MANIFEST_LEGACY_PATH = FARM_APP_MANIFEST_LEGACY_PATH; exports.isFarmAppManifestPath = isFarmAppManifestPath; exports.FARM_INFRA_SIGNATURE_HEADER = FARM_INFRA_SIGNATURE_HEADER; exports.resolveFarmAppManifestInput = resolveFarmAppManifestInput; exports.createFarmAppManifestResponse = createFarmAppManifestResponse;
|
|
@@ -34,7 +34,7 @@ var _chunkS3A45T7Fcjs = require('./chunk-S3A45T7F.cjs');
|
|
|
34
34
|
var _chunkZEG3OPIBcjs = require('./chunk-ZEG3OPIB.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkULASELLAcjs = require('./chunk-ULASELLA.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -1119,7 +1119,7 @@ function createApiClients(options = {}) {
|
|
|
1119
1119
|
"api is server-only. Use apiClient from createApiClients() in the browser."
|
|
1120
1120
|
);
|
|
1121
1121
|
}
|
|
1122
|
-
const currentRequest =
|
|
1122
|
+
const currentRequest = _chunkULASELLAcjs._resolveCurrentRequest.call(void 0, );
|
|
1123
1123
|
const runtime = _chunk72ADZ6GQcjs.resolveAPIRequestRuntime.call(void 0, );
|
|
1124
1124
|
if (!currentRequest || !runtime) {
|
|
1125
1125
|
throw new Error(
|
|
@@ -17,7 +17,7 @@ var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkXKG2BLFNcjs = require('./chunk-XKG2BLFN.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkWMAPPDMMcjs = require('./chunk-WMAPPDMM.cjs');
|
|
@@ -102,7 +102,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
102
102
|
await this.loadProgrammaticApiRoutes(appDir);
|
|
103
103
|
}
|
|
104
104
|
this.routes = new Map(
|
|
105
|
-
|
|
105
|
+
_chunkXKG2BLFNcjs.mergePluginAPIRoutes.call(void 0, [...this.routes.values()], this.plugins, void 0, {
|
|
106
106
|
bodySizeLimit: this.bodySizeLimit,
|
|
107
107
|
dispatch: this.dispatch
|
|
108
108
|
}).map((route) => [route.path, route])
|
|
@@ -150,7 +150,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
150
150
|
const routeModule = await this.loadModule(filePath);
|
|
151
151
|
const endpoints = {};
|
|
152
152
|
const availableMethods = [];
|
|
153
|
-
for (const method of
|
|
153
|
+
for (const method of _chunkXKG2BLFNcjs.API_ROUTE_METHODS) {
|
|
154
154
|
if (routeModule[method]) {
|
|
155
155
|
endpoints[method] = routeModule[method];
|
|
156
156
|
availableMethods.push(method);
|
|
@@ -332,7 +332,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
332
332
|
const url = new URL(request.url);
|
|
333
333
|
const pathname = url.pathname;
|
|
334
334
|
const method = request.method.toUpperCase();
|
|
335
|
-
const match =
|
|
335
|
+
const match = _chunkXKG2BLFNcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
|
|
336
336
|
if (!match) {
|
|
337
337
|
return new Response(JSON.stringify({ error: "Not Found" }), {
|
|
338
338
|
status: 404,
|
|
@@ -340,19 +340,19 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
const { route, params } = match;
|
|
343
|
-
const endpoint =
|
|
343
|
+
const endpoint = _chunkXKG2BLFNcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
|
|
344
344
|
if (!endpoint) {
|
|
345
345
|
return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
|
|
346
346
|
status: 405,
|
|
347
347
|
headers: {
|
|
348
|
-
Allow:
|
|
348
|
+
Allow: _chunkXKG2BLFNcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
|
|
349
349
|
"Content-Type": "application/json"
|
|
350
350
|
}
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
353
|
const invoke = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
354
354
|
try {
|
|
355
|
-
return await
|
|
355
|
+
return await _chunkXKG2BLFNcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, this.bodySizeLimit);
|
|
356
356
|
} catch (error) {
|
|
357
357
|
if (options.throwOnError) throw error;
|
|
358
358
|
console.error(`[API Error] ${pathname}:`, error);
|
|
@@ -374,7 +374,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
374
374
|
return Boolean(this.matchRoute(pathname));
|
|
375
375
|
}
|
|
376
376
|
matchRoute(pathname) {
|
|
377
|
-
return
|
|
377
|
+
return _chunkXKG2BLFNcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
|
|
378
378
|
}
|
|
379
379
|
/**
|
|
380
380
|
* Get all routes for client type generation
|
|
@@ -321,6 +321,19 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmMarkdownViewResponse, "createFar
|
|
|
321
321
|
|
|
322
322
|
// src/markdown.ts
|
|
323
323
|
var FARM_MARKDOWN_CONTENT_TYPE = "text/markdown; charset=utf-8";
|
|
324
|
+
var FARM_MARKDOWN_PAGE_CHECK_HEADER = "x-farm-markdown-page-check";
|
|
325
|
+
var MARKDOWN_PAGE_CHECK_TOKEN = /* @__PURE__ */ Symbol.for("farm.markdownPageCheckToken");
|
|
326
|
+
function _getFarmMarkdownPageCheckToken() {
|
|
327
|
+
const state = globalThis;
|
|
328
|
+
return _nullishCoalesce(state[MARKDOWN_PAGE_CHECK_TOKEN], () => ( (state[MARKDOWN_PAGE_CHECK_TOKEN] = globalThis.crypto.randomUUID())));
|
|
329
|
+
}
|
|
330
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, _getFarmMarkdownPageCheckToken, "_getFarmMarkdownPageCheckToken");
|
|
331
|
+
function _isFarmMarkdownPageCheck(value) {
|
|
332
|
+
const state = globalThis;
|
|
333
|
+
const token = state[MARKDOWN_PAGE_CHECK_TOKEN];
|
|
334
|
+
return Boolean(token) && typeof value === "string" && value === token;
|
|
335
|
+
}
|
|
336
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, _isFarmMarkdownPageCheck, "_isFarmMarkdownPageCheck");
|
|
324
337
|
function farmRequestWantsMarkdown(pathname, accept) {
|
|
325
338
|
return pathname.toLowerCase().endsWith(".md") || requestAcceptsMarkdown(accept);
|
|
326
339
|
}
|
|
@@ -471,7 +484,7 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
471
484
|
const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access', _28 => _28.route, 'optionalAccess', _29 => _29.cache]), () => ( _optionalChain([options, 'access', _30 => _30.config, 'optionalAccess', _31 => _31.cache]))), () => ( false));
|
|
472
485
|
headersOut.set(
|
|
473
486
|
"Cache-Control",
|
|
474
|
-
pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : createMarkdownCacheHeader(cache)
|
|
487
|
+
pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : headers.has("cookie") || headers.has("authorization") ? "private, no-store" : createMarkdownCacheHeader(cache)
|
|
475
488
|
);
|
|
476
489
|
preserveMarkdownResponseCookies(pageResponse.headers, headersOut);
|
|
477
490
|
if (pageResponse.status >= 400) {
|
|
@@ -1359,4 +1372,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, decodeHtml, "decodeHtml");
|
|
|
1359
1372
|
|
|
1360
1373
|
|
|
1361
1374
|
|
|
1362
|
-
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
exports.createFarmMarkdownViewResponse = createFarmMarkdownViewResponse; exports.FARM_MARKDOWN_CONTENT_TYPE = FARM_MARKDOWN_CONTENT_TYPE; exports.FARM_MARKDOWN_PAGE_CHECK_HEADER = FARM_MARKDOWN_PAGE_CHECK_HEADER; exports._getFarmMarkdownPageCheckToken = _getFarmMarkdownPageCheckToken; exports._isFarmMarkdownPageCheck = _isFarmMarkdownPageCheck; exports.farmRequestWantsMarkdown = farmRequestWantsMarkdown; exports.createFarmMarkdownErrorBody = createFarmMarkdownErrorBody; exports.resolveMarkdownConfig = resolveMarkdownConfig; exports.resolveMarkdownMirrorTarget = resolveMarkdownMirrorTarget; exports.createMarkdownMirrorResponse = createMarkdownMirrorResponse; exports.applyMarkdownNegotiationHeaders = applyMarkdownNegotiationHeaders; exports.htmlToMarkdown = htmlToMarkdown; exports.farmAcceptQuality = farmAcceptQuality; exports.requestAcceptsMarkdown = requestAcceptsMarkdown; exports.getFarmMarkdownMirrorPath = getFarmMarkdownMirrorPath; exports.getFarmMarkdownAlternatePath = getFarmMarkdownAlternatePath; exports.isFarmMarkdownMirrorExposed = isFarmMarkdownMirrorExposed; exports.matchesFarmMarkdownRoutePattern = matchesFarmMarkdownRoutePattern; exports.extractFarmPageActions = extractFarmPageActions;
|