@farm.js/core 0.1.31 → 0.1.34
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 +1 -1
- package/dist/agent-runtime.cjs +69 -14
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +58 -3
- package/dist/api/route-manager.cjs +16 -13
- package/dist/api/route-manager.d.mts +1 -1
- package/dist/api/route-manager.d.ts +1 -1
- package/dist/api/route-manager.mjs +15 -12
- package/dist/api/runtime.cjs +9 -7
- package/dist/api/runtime.d.mts +1 -1
- package/dist/api/runtime.d.ts +1 -1
- package/dist/api/runtime.mjs +8 -6
- package/dist/api.cjs +19 -16
- package/dist/api.d.mts +2 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.mjs +18 -15
- package/dist/{app-sUJ3jnTZ.d.ts → app-DgotYGbq.d.ts} +3 -3
- package/dist/app-markdown.cjs +8 -6
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +7 -5
- package/dist/{app-DAuUTIZf.d.mts → app-q4rmZlXK.d.mts} +3 -3
- package/dist/cache.cjs +2 -2
- package/dist/cache.d.mts +10 -1
- package/dist/cache.d.ts +10 -1
- package/dist/cache.mjs +1 -1
- package/dist/{chunk-YZTASLPQ.cjs → chunk-27ZWSI3W.cjs} +2 -2
- package/dist/{chunk-WBIH66JK.mjs → chunk-2ELDTQRN.mjs} +5 -2
- package/dist/{chunk-K7CELQLK.cjs → chunk-2F2ER724.cjs} +54 -29
- package/dist/{chunk-NRVGEI5I.mjs → chunk-2NNMOPDN.mjs} +4 -210
- package/dist/chunk-2NQQ5H5G.cjs +86 -0
- package/dist/{chunk-IFI5FXEZ.cjs → chunk-36MK5YCW.cjs} +334 -163
- package/dist/chunk-3BU22U3M.cjs +237 -0
- package/dist/{chunk-MM5D6VLP.mjs → chunk-3KZS4SUS.mjs} +33 -14
- package/dist/chunk-3SDFA7UF.cjs +701 -0
- package/dist/{chunk-4IEPYMHF.mjs → chunk-3UEVPCGW.mjs} +1 -1
- package/dist/{chunk-5LJCOSKT.mjs → chunk-3VSKDFAT.mjs} +1 -1
- package/dist/{chunk-5HGR3W6O.mjs → chunk-5SJWVY6R.mjs} +8 -0
- package/dist/{chunk-X7WVQMIB.mjs → chunk-657WJNRY.mjs} +10 -4
- package/dist/{chunk-MKMBQSNQ.mjs → chunk-6VVL3MHY.mjs} +3 -3
- package/dist/{chunk-QZRVZSPN.cjs → chunk-77GNHH2Z.cjs} +3 -3
- package/dist/{chunk-KZLND3D2.cjs → chunk-7BT4H4P7.cjs} +7 -5
- package/dist/{chunk-A777V5WU.cjs → chunk-7M52YUMY.cjs} +2 -2
- package/dist/{chunk-VUMAE7NC.mjs → chunk-7Y6ZNFPX.mjs} +81 -30
- package/dist/{chunk-MXDTKXO6.cjs → chunk-A5FGU2WU.cjs} +74 -23
- package/dist/{chunk-7QOCTYBS.mjs → chunk-AGC75XAE.mjs} +37 -1
- package/dist/{chunk-4ZQQL4IU.mjs → chunk-AHGECQEW.mjs} +1 -1
- package/dist/{chunk-RG3ZOTG5.cjs → chunk-AI7QMY7O.cjs} +10 -3
- package/dist/{chunk-O3DTUAX2.mjs → chunk-AQZFOP7S.mjs} +6 -77
- package/dist/{chunk-WNLBF77X.cjs → chunk-ATK2R4CH.cjs} +14 -12
- package/dist/{chunk-SORB3MAR.cjs → chunk-AWC4VUZL.cjs} +17 -17
- package/dist/{chunk-YMCXWPWK.mjs → chunk-BCMSYSN2.mjs} +4 -1
- package/dist/{chunk-FYRBX5IY.cjs → chunk-BTAG7LI7.cjs} +2 -2
- package/dist/{chunk-I6XDAKWQ.mjs → chunk-BTHHUD7Q.mjs} +14 -0
- package/dist/chunk-C4SPBWFM.cjs +26 -0
- package/dist/{chunk-JATSG2ZO.mjs → chunk-CLJYVZAD.mjs} +4 -2
- package/dist/{chunk-J3LOGE4T.cjs → chunk-DQQOKWYA.cjs} +5 -5
- package/dist/{chunk-JLRDISQL.cjs → chunk-DZ4DTRJ5.cjs} +7 -7
- package/dist/chunk-E5GNDG5F.mjs +701 -0
- package/dist/{chunk-E76XC6ZG.mjs → chunk-EZDQRNQ7.mjs} +2 -2
- package/dist/{chunk-TOVMYGYW.mjs → chunk-F2SE2VDO.mjs} +1 -1
- package/dist/{chunk-BSPQVJ4A.mjs → chunk-FDR64H6B.mjs} +13 -0
- package/dist/{chunk-5OVTOKGH.cjs → chunk-FFFW3OQ7.cjs} +2 -2
- package/dist/{chunk-D4JE5NNV.cjs → chunk-FNO7A7CM.cjs} +5 -5
- package/dist/chunk-FZ6YYU2W.mjs +65 -0
- package/dist/{chunk-PZNCMPJF.cjs → chunk-G26MUMKL.cjs} +14 -8
- package/dist/{chunk-IXUY2F5U.mjs → chunk-GCXWJJKH.mjs} +4 -7
- package/dist/{chunk-JLCQGPXE.mjs → chunk-GNSDTTWZ.mjs} +50 -61
- package/dist/{chunk-TEN4FIZU.mjs → chunk-GOABMOX3.mjs} +151 -3
- package/dist/{chunk-HBTUGXHS.cjs → chunk-HLJ6MBUZ.cjs} +7 -4
- package/dist/{chunk-GZYH4OER.mjs → chunk-HR5KPHC2.mjs} +1 -1
- package/dist/{chunk-ZCU4NZ3M.cjs → chunk-IE7XCHH3.cjs} +4 -4
- package/dist/{chunk-I26CZYPV.cjs → chunk-IHNIDL6H.cjs} +50 -7
- package/dist/{chunk-2FQHH5SC.mjs → chunk-IHNMMXHV.mjs} +49 -24
- package/dist/{chunk-VHJGDMCG.cjs → chunk-IWZKTWHZ.cjs} +2 -2
- package/dist/{chunk-DGXN3L4D.mjs → chunk-JDPAKVS4.mjs} +4 -4
- package/dist/chunk-JG6DJF5A.mjs +238 -0
- package/dist/{chunk-5TISYEQF.mjs → chunk-JM5XPKWH.mjs} +10 -3
- package/dist/{chunk-BJJATPEC.mjs → chunk-KN7K4VQN.mjs} +1 -1
- package/dist/{chunk-WPYFSQKK.cjs → chunk-KNBBQHO2.cjs} +15 -1
- package/dist/{chunk-XWAWFQFS.cjs → chunk-KXWRO25S.cjs} +7 -4
- package/dist/{chunk-QG5HNS7P.mjs → chunk-LHODW25H.mjs} +2 -2
- package/dist/{chunk-BXFWA23T.mjs → chunk-LMJ7VRHZ.mjs} +3 -3
- package/dist/{chunk-WG2KHOMN.mjs → chunk-LR5QSC2P.mjs} +380 -209
- package/dist/chunk-LSKZMJMP.cjs +65 -0
- package/dist/{chunk-2N5PX3LS.mjs → chunk-LYV44OIR.mjs} +7 -1
- package/dist/{chunk-5MKEDGLD.cjs → chunk-M64YUMA4.cjs} +11 -6
- package/dist/{chunk-EXLKRR4U.cjs → chunk-MIDIZJZC.cjs} +12 -12
- package/dist/{chunk-ES4B2IXW.cjs → chunk-MOKLYNHV.cjs} +2 -2
- package/dist/{chunk-IV6CQY7O.mjs → chunk-MSSFIQGM.mjs} +63 -13
- package/dist/{chunk-KH7BN726.cjs → chunk-N4UOK6ZI.cjs} +8 -2
- package/dist/{chunk-6VYZOPOT.mjs → chunk-NGVORZVZ.mjs} +1 -1
- package/dist/{chunk-JNGIWIY6.mjs → chunk-NPC7VWJE.mjs} +2 -2
- package/dist/{chunk-ILWLPEVO.mjs → chunk-NRSN7G7E.mjs} +2 -2
- package/dist/{chunk-AHAJGAYD.mjs → chunk-O27L4YAA.mjs} +1 -1
- package/dist/{chunk-VYZSOYR4.cjs → chunk-ODBZYBAB.cjs} +1 -1
- package/dist/{chunk-YVGAEAA5.cjs → chunk-P64MIF5B.cjs} +154 -6
- package/dist/{chunk-DFLLARUK.cjs → chunk-PQDFUSXD.cjs} +14 -14
- package/dist/{chunk-F6XEGFHO.mjs → chunk-PXKIEXZD.mjs} +10 -0
- package/dist/{chunk-S5GDHOE4.mjs → chunk-PZNL3WEG.mjs} +48 -5
- package/dist/{chunk-FV45CKBC.mjs → chunk-QCFBDFRS.mjs} +1 -1
- package/dist/{chunk-75BRBIFP.cjs → chunk-QCVE2OCI.cjs} +5 -8
- package/dist/{chunk-6ZCMSZ5U.mjs → chunk-QE6VAKLT.mjs} +1 -1
- package/dist/{chunk-75DYEVXI.cjs → chunk-QGYRXFU2.cjs} +9 -9
- package/dist/{chunk-CTV2TTNP.cjs → chunk-QJ3J6MZT.cjs} +16 -87
- package/dist/{chunk-O6XNAMBV.mjs → chunk-QLQ32WC4.mjs} +8 -3
- package/dist/{chunk-IMB4PIAR.cjs → chunk-SJVKK4JE.cjs} +839 -420
- package/dist/{chunk-3FCFQP5V.cjs → chunk-TA5G2HWD.cjs} +21 -21
- package/dist/{chunk-Z5HIWVDP.cjs → chunk-TDFPACVX.cjs} +62 -73
- package/dist/{chunk-ND224OE2.cjs → chunk-TKSCR644.cjs} +34 -15
- package/dist/{chunk-UAFSBWNT.mjs → chunk-U4PTAHW3.mjs} +64 -13
- package/dist/{chunk-ZHVYQL3H.cjs → chunk-U74I55WB.cjs} +86 -35
- package/dist/chunk-UBO4SGH4.mjs +86 -0
- package/dist/{chunk-IQXFRNY2.cjs → chunk-UFDAAQFX.cjs} +2 -2
- package/dist/{chunk-X7KZBF63.cjs → chunk-UX5S4JEO.cjs} +40 -4
- package/dist/{chunk-5ZSWG4UX.cjs → chunk-UXFQ3UDA.cjs} +14 -1
- package/dist/{chunk-L4DVIHOC.mjs → chunk-VCCUOMQN.mjs} +1 -1
- package/dist/{chunk-4V7GIE2U.mjs → chunk-VHANUNEG.mjs} +2 -2
- package/dist/{chunk-FXUUWYAX.cjs → chunk-VKNHTSAP.cjs} +10 -0
- package/dist/{chunk-2AKFKCHA.mjs → chunk-W7LF2J2S.mjs} +1 -1
- package/dist/{chunk-MNUGPHLN.mjs → chunk-WNNYOOIB.mjs} +5 -3
- package/dist/{chunk-VA62MHFV.mjs → chunk-X242HVD5.mjs} +1 -1
- package/dist/{chunk-UJ2C4ICS.cjs → chunk-XJXBIP67.cjs} +4 -4
- package/dist/{chunk-6L6DQR5W.mjs → chunk-XV5DJTBX.mjs} +539 -121
- package/dist/{chunk-KJ2TIHZZ.cjs → chunk-XXJU7FCC.cjs} +3 -2
- package/dist/{chunk-DYEJQTDN.cjs → chunk-YSCV4SJF.cjs} +4 -4
- package/dist/{chunk-2SDO73HK.cjs → chunk-YWN746US.cjs} +64 -14
- package/dist/chunk-Z2HLU4IX.cjs +238 -0
- package/dist/{chunk-2FXWWUE5.cjs → chunk-Z2YLTERK.cjs} +4 -4
- package/dist/{chunk-CUMINO7Z.cjs → chunk-ZHPHJPQP.cjs} +4 -4
- package/dist/{chunk-FJZ3DQLK.mjs → chunk-ZKP7C2B6.mjs} +4 -4
- package/dist/{chunk-JBC2FKRW.mjs → chunk-ZUSJDQ2Q.mjs} +2 -1
- package/dist/{client-plugins-BX2ptm4H.d.mts → client-plugins-CLObcuCq.d.mts} +26 -2
- package/dist/{client-plugins-BmxM5KW_.d.ts → client-plugins-DZjHC4Mi.d.ts} +26 -2
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +8 -8
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-EWRDHCD5.cjs → devtools-HU6Y2MNV.cjs} +11 -9
- package/dist/{devtools-BPBCYOU6.mjs → devtools-RNXCTS4R.mjs} +10 -8
- package/dist/docs.cjs +13 -11
- package/dist/docs.d.mts +5 -0
- package/dist/docs.d.ts +5 -0
- package/dist/docs.mjs +12 -10
- package/dist/environment/vite.cjs +2 -2
- package/dist/environment/vite.mjs +1 -1
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/i18n/client.cjs +14 -13
- package/dist/i18n/client.mjs +5 -4
- package/dist/i18n/index.cjs +3 -2
- package/dist/i18n/index.mjs +2 -1
- package/dist/i18n/server.cjs +6 -5
- package/dist/i18n/server.mjs +5 -4
- package/dist/image/server.cjs +2 -2
- package/dist/image/server.mjs +1 -1
- package/dist/image/sharp.cjs +9 -9
- package/dist/image/sharp.mjs +1 -1
- package/dist/index.cjs +67 -55
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +70 -58
- package/dist/integrations.cjs +6 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +7 -4
- package/dist/internal/app-markdown-runtime.cjs +7 -5
- package/dist/internal/app-markdown-runtime.d.mts +14 -3
- package/dist/internal/app-markdown-runtime.d.ts +14 -3
- package/dist/internal/app-markdown-runtime.mjs +6 -4
- package/dist/internal/build-runtime.cjs +38 -35
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +37 -34
- package/dist/internal/cli-runtime.cjs +20 -17
- package/dist/internal/cli-runtime.mjs +19 -16
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +4 -2
- package/dist/internal/client-runtime.d.mts +9 -1
- package/dist/internal/client-runtime.d.ts +9 -1
- package/dist/internal/client-runtime.mjs +3 -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 +11 -9
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +10 -8
- package/dist/internal/infra-analytics-runtime.cjs +4 -4
- package/dist/internal/infra-analytics-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +20 -14
- package/dist/internal/production-runtime.d.mts +115 -8
- package/dist/internal/production-runtime.d.ts +115 -8
- package/dist/internal/production-runtime.mjs +19 -13
- package/dist/internal/request-cookies.cjs +4 -2
- package/dist/internal/request-cookies.d.mts +9 -1
- package/dist/internal/request-cookies.d.ts +9 -1
- package/dist/internal/request-cookies.mjs +3 -1
- package/dist/markdown.cjs +4 -4
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +3 -3
- package/dist/{metadata-DsEaK7mQ.d.mts → metadata-2HSU2i_w.d.mts} +1 -1
- package/dist/{metadata-fwZ3gfG6.d.ts → metadata-Cjs8JMRM.d.ts} +1 -1
- package/dist/middleware.cjs +18 -8
- package/dist/middleware.d.mts +24 -5
- package/dist/middleware.d.ts +24 -5
- package/dist/middleware.mjs +18 -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/{nitro-NAKCRVHX.mjs → nitro-4XGPNIK4.mjs} +3 -3
- package/dist/{nitro-VYDZGYFY.cjs → nitro-HSAQFXSS.cjs} +4 -4
- package/dist/plugin.cjs +33 -30
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +32 -29
- package/dist/{production-runtime-DNkpFnmg.d.ts → production-runtime-BU5ETAK9.d.ts} +8 -1
- package/dist/{production-runtime-Baqgwtvc.d.mts → production-runtime-CysZl3EV.d.mts} +8 -1
- package/dist/query/client.cjs +7 -7
- package/dist/query/client.mjs +3 -3
- package/dist/{render-plan-DhwQnmmX.d.mts → render-plan-CKr4ltOd.d.mts} +1 -1
- package/dist/{render-plan-rkIK9wd9.d.ts → render-plan-D72O1qm4.d.ts} +1 -1
- package/dist/renderer-client.cjs +39 -19
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +28 -8
- package/dist/{request-CFy1BltJ.d.mts → request-Be83WafN.d.mts} +7 -2
- package/dist/{request-BcY4RYPC.d.ts → request-DbyOYI2j.d.ts} +7 -2
- package/dist/request.cjs +2 -2
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering-BkS0TBlB.d.mts → route-rendering-BG56SzvJ.d.mts} +1 -1
- package/dist/{route-rendering-D4XpMjam.d.ts → route-rendering-CtVMpV-k.d.ts} +1 -1
- package/dist/{router-C4zPlC3V.d.mts → router-ALUvm8gC.d.mts} +1 -1
- package/dist/{router-Cq7BcZxg.d.ts → router-D94-SDlW.d.ts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +2 -2
- package/dist/server-fn.cjs +3 -3
- package/dist/server-fn.mjs +2 -2
- package/dist/server-plugins.cjs +4 -4
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +3 -3
- package/dist/server-query-client.cjs +3 -3
- package/dist/server-query-client.mjs +2 -2
- package/dist/server-query.cjs +4 -4
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +60 -57
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +37 -34
- package/dist/{spa-router-B1HI3X9k.d.ts → spa-router-CxK3USIz.d.ts} +2 -2
- package/dist/{spa-router-DzPZH-AO.d.mts → spa-router-DbxNRKOB.d.mts} +2 -2
- package/dist/testing.cjs +19 -17
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +16 -14
- package/dist/theme/server.cjs +4 -3
- package/dist/theme/server.mjs +3 -2
- package/dist/{utils-DMD1Hzta.d.ts → utils-311Y8eoK.d.ts} +1 -1
- package/dist/{utils-CEBktlBG.d.mts → utils-4wVRcpOw.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +33 -30
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +32 -29
- package/package.json +2 -2
- package/dist/chunk-22GUSVNJ.cjs +0 -351
- package/dist/chunk-SWN467MP.cjs +0 -18
- package/dist/chunk-XGC343EY.cjs +0 -443
- package/dist/chunk-ZSH2Y4LN.mjs +0 -351
- /package/dist/{chunk-SUIBNSNO.cjs → chunk-SJNMVDDF.cjs} +0 -0
- /package/dist/{chunk-LNZ7JZUS.mjs → chunk-UDNPLXW7.mjs} +0 -0
|
@@ -6,10 +6,10 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
|
|
|
6
6
|
var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkMIDIZJZCcjs = require('./chunk-MIDIZJZC.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkSJNMVDDFcjs = require('./chunk-SJNMVDDF.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
|
|
@@ -20,7 +20,7 @@ var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkG26MUMKLcjs = require('./chunk-G26MUMKL.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
var _chunk6V4TDWECcjs = require('./chunk-6V4TDWEC.cjs');
|
|
@@ -44,7 +44,7 @@ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
|
44
44
|
var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var _chunkUXFQ3UDAcjs = require('./chunk-UXFQ3UDA.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
@@ -110,7 +110,7 @@ function farmApiPlugin(options = {}) {
|
|
|
110
110
|
const existing = apiRoutesCache.get(routePath);
|
|
111
111
|
const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
|
|
112
112
|
if (existingFile) {
|
|
113
|
-
throw new (0,
|
|
113
|
+
throw new (0, _chunkMIDIZJZCcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
|
|
114
114
|
}
|
|
115
115
|
if (existing) {
|
|
116
116
|
if (!existing.methods.includes(normalizedMethod)) {
|
|
@@ -186,7 +186,7 @@ function farmApiPlugin(options = {}) {
|
|
|
186
186
|
const createRouter = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
187
187
|
const plugins = options.plugins ? await (_nullishCoalesce(routePlugins, () => ( (routePlugins = Promise.resolve(options.plugins({ root: projectRoot })))))) : [];
|
|
188
188
|
pluginMergedRoutes = plugins.length ? new Map(
|
|
189
|
-
|
|
189
|
+
_chunkG26MUMKLcjs.mergePluginAPIRoutes.call(void 0, [...apiRoutesCache.values()], plugins, void 0, {
|
|
190
190
|
bodySizeLimit
|
|
191
191
|
}).map((route) => [route.path, route])
|
|
192
192
|
) : null;
|
|
@@ -200,7 +200,7 @@ function farmApiPlugin(options = {}) {
|
|
|
200
200
|
const url = new URL(request.url);
|
|
201
201
|
const method = request.method.toUpperCase();
|
|
202
202
|
const pathname = url.pathname;
|
|
203
|
-
const match =
|
|
203
|
+
const match = _chunkG26MUMKLcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath);
|
|
204
204
|
if (!match) {
|
|
205
205
|
return new Response(JSON.stringify({ error: "Not Found" }), {
|
|
206
206
|
status: 404,
|
|
@@ -208,18 +208,18 @@ function farmApiPlugin(options = {}) {
|
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
const { route, params } = match;
|
|
211
|
-
const endpoint =
|
|
211
|
+
const endpoint = _chunkG26MUMKLcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
|
|
212
212
|
if (!endpoint) {
|
|
213
213
|
return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
|
|
214
214
|
status: 405,
|
|
215
215
|
headers: {
|
|
216
|
-
Allow:
|
|
216
|
+
Allow: _chunkG26MUMKLcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
|
|
217
217
|
"Content-Type": "application/json"
|
|
218
218
|
}
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
try {
|
|
222
|
-
return await
|
|
222
|
+
return await _chunkG26MUMKLcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, bodySizeLimit);
|
|
223
223
|
} catch (error) {
|
|
224
224
|
return new Response(JSON.stringify({ error: error.message || "Internal Server Error" }), {
|
|
225
225
|
status: 500,
|
|
@@ -267,7 +267,7 @@ function farmApiPlugin(options = {}) {
|
|
|
267
267
|
const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, filePath);
|
|
268
268
|
const endpoints = {};
|
|
269
269
|
const availableMethods = [];
|
|
270
|
-
for (const method of
|
|
270
|
+
for (const method of _chunkG26MUMKLcjs.API_ROUTE_METHODS) {
|
|
271
271
|
if (routeModule[method]) {
|
|
272
272
|
availableMethods.push(method);
|
|
273
273
|
endpoints[method] = routeModule[method];
|
|
@@ -280,7 +280,7 @@ function farmApiPlugin(options = {}) {
|
|
|
280
280
|
log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
|
|
281
281
|
}
|
|
282
282
|
} catch (e) {
|
|
283
|
-
if (e instanceof
|
|
283
|
+
if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
284
284
|
log(`API route load failed at ${filePath}: ${e.message}`);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
@@ -307,7 +307,7 @@ function farmApiPlugin(options = {}) {
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
} catch (e) {
|
|
310
|
-
if (e instanceof
|
|
310
|
+
if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
311
311
|
log(`Root routes.ts load failed: ${e.message}`);
|
|
312
312
|
}
|
|
313
313
|
break;
|
|
@@ -317,7 +317,7 @@ function farmApiPlugin(options = {}) {
|
|
|
317
317
|
const discoverProgrammaticRoutes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
318
318
|
const path = await import("path");
|
|
319
319
|
const srcRoot = path.join(server.config.root, srcDir);
|
|
320
|
-
const routeFiles =
|
|
320
|
+
const routeFiles = _chunkSJNMVDDFcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot);
|
|
321
321
|
if (routeFiles.length === 0) return;
|
|
322
322
|
const { getProgrammaticRouteManifest } = await import("./routes.cjs");
|
|
323
323
|
for (const routeFile of routeFiles) {
|
|
@@ -338,7 +338,7 @@ function farmApiPlugin(options = {}) {
|
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
} catch (e) {
|
|
341
|
-
if (e instanceof
|
|
341
|
+
if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
342
342
|
log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -390,7 +390,7 @@ function farmApiPlugin(options = {}) {
|
|
|
390
390
|
const pathname = url.split("?")[0];
|
|
391
391
|
const method = req.method || "GET";
|
|
392
392
|
if (discoveryPromise) await waitForDiscovery();
|
|
393
|
-
if (!
|
|
393
|
+
if (!_chunkG26MUMKLcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath)) {
|
|
394
394
|
return next();
|
|
395
395
|
}
|
|
396
396
|
if (!apiRouterHandler) {
|
|
@@ -411,10 +411,10 @@ function farmApiPlugin(options = {}) {
|
|
|
411
411
|
}
|
|
412
412
|
const currentUrl = req.url || url;
|
|
413
413
|
const currentPathname = currentUrl.split("?")[0];
|
|
414
|
-
if (currentPathname !== pathname && !
|
|
414
|
+
if (currentPathname !== pathname && !_chunkG26MUMKLcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), currentPathname, basePath)) {
|
|
415
415
|
return next();
|
|
416
416
|
}
|
|
417
|
-
const fullUrl =
|
|
417
|
+
const fullUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req);
|
|
418
418
|
const headers = new Headers();
|
|
419
419
|
for (const [key, value] of Object.entries(req.headers)) {
|
|
420
420
|
if (value) {
|
|
@@ -515,7 +515,7 @@ function farmApiPlugin(options = {}) {
|
|
|
515
515
|
log(`API router recreated`);
|
|
516
516
|
} catch (e) {
|
|
517
517
|
restoreRouteState(previousState);
|
|
518
|
-
if (e instanceof
|
|
518
|
+
if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
519
519
|
log(`Root routes.ts HMR failed: ${e.message}`);
|
|
520
520
|
}
|
|
521
521
|
return [];
|
|
@@ -543,7 +543,7 @@ function farmApiPlugin(options = {}) {
|
|
|
543
543
|
const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, file);
|
|
544
544
|
removeEndpointsFromFile(file);
|
|
545
545
|
const availableMethods = [];
|
|
546
|
-
for (const method of
|
|
546
|
+
for (const method of _chunkG26MUMKLcjs.API_ROUTE_METHODS) {
|
|
547
547
|
if (!routeModule[method]) continue;
|
|
548
548
|
availableMethods.push(method);
|
|
549
549
|
addEndpoint(routePath, file, method, routeModule[method]);
|
|
@@ -553,7 +553,7 @@ function farmApiPlugin(options = {}) {
|
|
|
553
553
|
log(`API router recreated`);
|
|
554
554
|
} catch (e) {
|
|
555
555
|
restoreRouteState(previousState);
|
|
556
|
-
if (e instanceof
|
|
556
|
+
if (e instanceof _chunkMIDIZJZCcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
557
557
|
log(`API route HMR failed: ${e.message}`);
|
|
558
558
|
}
|
|
559
559
|
return [];
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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 _chunkG643DQCHcjs = require('./chunk-G643DQCH.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkG643DQCHcjs = require('./chunk-G643DQCH.cjs');
|
|
7
|
+
var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
|
|
10
8
|
|
|
11
9
|
|
|
12
10
|
|
|
@@ -36,6 +34,12 @@ var _chunkDVM4FKZLcjs = require('./chunk-DVM4FKZL.cjs');
|
|
|
36
34
|
var _chunkUS2QVW3Ecjs = require('./chunk-US2QVW3E.cjs');
|
|
37
35
|
|
|
38
36
|
|
|
37
|
+
var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
41
|
+
|
|
42
|
+
|
|
39
43
|
|
|
40
44
|
|
|
41
45
|
|
|
@@ -44,56 +48,6 @@ var _chunkNO3WWW3Ncjs = require('./chunk-NO3WWW3N.cjs');
|
|
|
44
48
|
|
|
45
49
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
46
50
|
|
|
47
|
-
// src/integration-request-security.ts
|
|
48
|
-
function resolveIntegrationAllowedOrigins(values, label) {
|
|
49
|
-
return Object.freeze((_nullishCoalesce(values, () => ( []))).map((value) => _chunkSVRTJOUFcjs.normalizeAllowedOriginPattern.call(void 0, value, label)));
|
|
50
|
-
}
|
|
51
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationAllowedOrigins, "resolveIntegrationAllowedOrigins");
|
|
52
|
-
function validateIntegrationRequestOrigin(request, policy = {}) {
|
|
53
|
-
const allowedOrigins = _nullishCoalesce(policy.allowedOrigins, () => ( []));
|
|
54
|
-
const requireOriginMetadata = _nullishCoalesce(policy.requireOriginMetadata, () => ( true));
|
|
55
|
-
const fetchSite = _optionalChain([request, 'access', _ => _.headers, 'access', _2 => _2.get, 'call', _3 => _3("sec-fetch-site"), 'optionalAccess', _4 => _4.trim, 'call', _5 => _5(), 'access', _6 => _6.toLowerCase, 'call', _7 => _7()]);
|
|
56
|
-
const source = _chunkSVRTJOUFcjs.getRequestSourceOrigin.call(void 0, request);
|
|
57
|
-
if (!source.ok) {
|
|
58
|
-
return { ok: false, reason: source.reason };
|
|
59
|
-
}
|
|
60
|
-
if (source.origin === null) {
|
|
61
|
-
if (fetchSite === "same-origin") {
|
|
62
|
-
return { ok: true };
|
|
63
|
-
}
|
|
64
|
-
if (requireOriginMetadata) {
|
|
65
|
-
return { ok: false, reason: fetchSite === "cross-site" ? "cross-site" : "missing-origin" };
|
|
66
|
-
}
|
|
67
|
-
return fetchSite === "cross-site" ? { ok: false, reason: "cross-site" } : { ok: true };
|
|
68
|
-
}
|
|
69
|
-
const requestUrl = new URL(request.url);
|
|
70
|
-
const matchesConfiguredOrigin = allowedOrigins.some(
|
|
71
|
-
(pattern) => _chunkSVRTJOUFcjs.matchesAllowedOrigin.call(void 0, source.origin, pattern)
|
|
72
|
-
);
|
|
73
|
-
const matchesRequest = source.origin === requestUrl.origin || _chunkSVRTJOUFcjs.matchesHostHeader.call(void 0, source.origin, request);
|
|
74
|
-
if (!matchesRequest && !matchesConfiguredOrigin) {
|
|
75
|
-
return { ok: false, reason: "cross-site" };
|
|
76
|
-
}
|
|
77
|
-
if (fetchSite === "cross-site" && !matchesConfiguredOrigin) {
|
|
78
|
-
return { ok: false, reason: "cross-site" };
|
|
79
|
-
}
|
|
80
|
-
return { ok: true };
|
|
81
|
-
}
|
|
82
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, validateIntegrationRequestOrigin, "validateIntegrationRequestOrigin");
|
|
83
|
-
function describeIntegrationOriginRejection(reason) {
|
|
84
|
-
switch (reason) {
|
|
85
|
-
case "missing-origin":
|
|
86
|
-
return "Request is missing same-origin metadata.";
|
|
87
|
-
case "opaque-origin":
|
|
88
|
-
return "Opaque origins are not allowed.";
|
|
89
|
-
case "invalid-origin":
|
|
90
|
-
return "Invalid request origin.";
|
|
91
|
-
case "cross-site":
|
|
92
|
-
return "Cross-site request was rejected.";
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, describeIntegrationOriginRejection, "describeIntegrationOriginRejection");
|
|
96
|
-
|
|
97
51
|
// src/plugin-integration-context.ts
|
|
98
52
|
var FARM_PLUGIN_INTEGRATION_CONTEXT = /* @__PURE__ */ Symbol.for("@farm.js/core/plugin-integration-context");
|
|
99
53
|
function setFarmPluginIntegrationContext(plugin, integration) {
|
|
@@ -294,13 +248,13 @@ function defineIntegration(integration) {
|
|
|
294
248
|
integrationRoute: routeFactory
|
|
295
249
|
}) : integration.endpoints;
|
|
296
250
|
const endpointRoutes = flattenIntegrationEndpoints(endpoints);
|
|
297
|
-
const allRoutes = _optionalChain([routes, 'optionalAccess',
|
|
251
|
+
const allRoutes = _optionalChain([routes, 'optionalAccess', _ => _.length]) || endpointRoutes.length ? [...routes || [], ...endpointRoutes] : void 0;
|
|
298
252
|
for (const route of allRoutes || []) {
|
|
299
253
|
_chunkNO3WWW3Ncjs.assertUniqueRouteParameters.call(void 0, route.path, "api");
|
|
300
254
|
_chunkDVM4FKZLcjs.validateConfigRouteSource.call(void 0, route.path, `Integration route "${route.path}"`);
|
|
301
255
|
_chunkNO3WWW3Ncjs.assertTerminalCatchAll.call(void 0, route.path, "api");
|
|
302
256
|
}
|
|
303
|
-
const derivedApi = integration.api || (_optionalChain([allRoutes, 'optionalAccess',
|
|
257
|
+
const derivedApi = integration.api || (_optionalChain([allRoutes, 'optionalAccess', _2 => _2.length]) ? _chunkNZKJGRB3cjs.api.fromRoutes(
|
|
304
258
|
allRoutes
|
|
305
259
|
) : void 0);
|
|
306
260
|
return {
|
|
@@ -402,7 +356,7 @@ function getIntegrationProviders(integrations) {
|
|
|
402
356
|
}
|
|
403
357
|
const providers = [];
|
|
404
358
|
for (const integration of Object.values(integrations)) {
|
|
405
|
-
if (!integration || !isFarmIntegration(integration) || !_optionalChain([integration, 'access',
|
|
359
|
+
if (!integration || !isFarmIntegration(integration) || !_optionalChain([integration, 'access', _3 => _3.providers, 'optionalAccess', _4 => _4.length])) {
|
|
406
360
|
continue;
|
|
407
361
|
}
|
|
408
362
|
for (const provider of integration.providers) {
|
|
@@ -430,7 +384,7 @@ function getIntegrationDocumentNavigationMatchers(integrations) {
|
|
|
430
384
|
}
|
|
431
385
|
const matchers = [];
|
|
432
386
|
for (const integration of Object.values(integrations)) {
|
|
433
|
-
if (!integration || !isFarmIntegration(integration) || !_optionalChain([integration, 'access',
|
|
387
|
+
if (!integration || !isFarmIntegration(integration) || !_optionalChain([integration, 'access', _5 => _5.documentNavigations, 'optionalAccess', _6 => _6.length])) {
|
|
434
388
|
continue;
|
|
435
389
|
}
|
|
436
390
|
for (const navigation of integration.documentNavigations) {
|
|
@@ -603,7 +557,7 @@ async function parseIntegrationConfigSchema(integration, schema, value) {
|
|
|
603
557
|
}
|
|
604
558
|
throw createIntegrationConfigValidationError(integration, result.error);
|
|
605
559
|
}
|
|
606
|
-
if (_optionalChain([schema, 'access',
|
|
560
|
+
if (_optionalChain([schema, 'access', _7 => _7["~standard"], 'optionalAccess', _8 => _8.validate])) {
|
|
607
561
|
const result = await schema["~standard"].validate(value);
|
|
608
562
|
if ("value" in result) {
|
|
609
563
|
return result.value;
|
|
@@ -654,7 +608,7 @@ async function resolveIntegrationConfig(integration, context) {
|
|
|
654
608
|
value,
|
|
655
609
|
await resolveIntegrationConfigPart(config.input, context)
|
|
656
610
|
);
|
|
657
|
-
value = mergeIntegrationConfigValue(value, await _optionalChain([config, 'access',
|
|
611
|
+
value = mergeIntegrationConfigValue(value, await _optionalChain([config, 'access', _9 => _9.resolve, 'optionalCall', _10 => _10(context)]));
|
|
658
612
|
return config.schema ? parseIntegrationConfigSchema(integration, config.schema, value) : value;
|
|
659
613
|
}
|
|
660
614
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationConfig, "resolveIntegrationConfig");
|
|
@@ -692,7 +646,7 @@ function createIntegrationLifecycleLogger(integration, phase) {
|
|
|
692
646
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createIntegrationLifecycleLogger, "createIntegrationLifecycleLogger");
|
|
693
647
|
async function emitIntegrationLog(integration, event) {
|
|
694
648
|
try {
|
|
695
|
-
await _optionalChain([integration, 'access',
|
|
649
|
+
await _optionalChain([integration, 'access', _11 => _11.log, 'optionalCall', _12 => _12(event)]);
|
|
696
650
|
} catch (e) {
|
|
697
651
|
}
|
|
698
652
|
}
|
|
@@ -904,7 +858,7 @@ function createIntegrationPlugin(integrationKey, integration) {
|
|
|
904
858
|
}
|
|
905
859
|
}, "createHandlerRequest");
|
|
906
860
|
for (const entry of middleware) {
|
|
907
|
-
const params =
|
|
861
|
+
const params = resolveIntegrationMiddlewareParams(entry, pathname, context.config);
|
|
908
862
|
if (!params) {
|
|
909
863
|
continue;
|
|
910
864
|
}
|
|
@@ -1266,7 +1220,7 @@ async function validateIntegrationRouteInput(route, request, url) {
|
|
|
1266
1220
|
};
|
|
1267
1221
|
}
|
|
1268
1222
|
const schemas = route.input;
|
|
1269
|
-
if (!_optionalChain([schemas, 'optionalAccess',
|
|
1223
|
+
if (!_optionalChain([schemas, 'optionalAccess', _13 => _13.body]) && !_optionalChain([schemas, 'optionalAccess', _14 => _14.query])) {
|
|
1270
1224
|
return {
|
|
1271
1225
|
success: true,
|
|
1272
1226
|
input: {}
|
|
@@ -1329,7 +1283,7 @@ async function parseIntegrationInputSchema(source, schema, value) {
|
|
|
1329
1283
|
issues: normalizeIntegrationValidationIssues(source, result.error)
|
|
1330
1284
|
};
|
|
1331
1285
|
}
|
|
1332
|
-
if (_optionalChain([schema, 'access',
|
|
1286
|
+
if (_optionalChain([schema, 'access', _15 => _15["~standard"], 'optionalAccess', _16 => _16.validate])) {
|
|
1333
1287
|
const result = await schema["~standard"].validate(value);
|
|
1334
1288
|
if ("value" in result) {
|
|
1335
1289
|
return {
|
|
@@ -1455,7 +1409,7 @@ async function readIntegrationValidationBody(request, format) {
|
|
|
1455
1409
|
}
|
|
1456
1410
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readIntegrationValidationBody, "readIntegrationValidationBody");
|
|
1457
1411
|
function getIntegrationRouteBodyFormat(route) {
|
|
1458
|
-
return route.bodyFormat || _optionalChain([route, 'access',
|
|
1412
|
+
return route.bodyFormat || _optionalChain([route, 'access', _17 => _17.__operation, 'optionalAccess', _18 => _18.bodyFormat]) || "json";
|
|
1459
1413
|
}
|
|
1460
1414
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getIntegrationRouteBodyFormat, "getIntegrationRouteBodyFormat");
|
|
1461
1415
|
function createIntegrationRouteArgs(input) {
|
|
@@ -1533,7 +1487,7 @@ function createLazyIntegrationOrmModel(resolveOrm, modelName) {
|
|
|
1533
1487
|
return async (...args) => {
|
|
1534
1488
|
const orm = await resolveOrm();
|
|
1535
1489
|
const model = orm[modelName];
|
|
1536
|
-
const member = _optionalChain([model, 'optionalAccess',
|
|
1490
|
+
const member = _optionalChain([model, 'optionalAccess', _19 => _19[prop]]);
|
|
1537
1491
|
if (typeof member !== "function") {
|
|
1538
1492
|
throw new Error(
|
|
1539
1493
|
`Integration ORM model "${String(modelName)}" does not expose "${String(prop)}".`
|
|
@@ -1616,14 +1570,14 @@ async function dispatchIntegrationRequest(runtime, request, options = {}) {
|
|
|
1616
1570
|
const integration = runtime.integration;
|
|
1617
1571
|
const url = new URL(request.url);
|
|
1618
1572
|
const pathname = url.pathname;
|
|
1619
|
-
const requestId = request.headers.get("x-request-id") || _optionalChain([options, 'access',
|
|
1573
|
+
const requestId = request.headers.get("x-request-id") || _optionalChain([options, 'access', _20 => _20.currentRequest, 'optionalAccess', _21 => _21.headers, 'access', _22 => _22.get, 'call', _23 => _23("x-request-id")]) || String(Date.now());
|
|
1620
1574
|
const routes = normalizeIntegrationRoutes(integration.routes || []);
|
|
1621
1575
|
const pathSegments = _chunkUS2QVW3Ecjs.canonicalizeRequestPathSegments.call(void 0, pathname);
|
|
1622
1576
|
const method = normalizeIntegrationRequestMethod(request.method);
|
|
1623
1577
|
const middleware = [...integration.middleware || []];
|
|
1624
1578
|
const forwardedSetCookies = [];
|
|
1625
1579
|
for (const entry of middleware) {
|
|
1626
|
-
const params =
|
|
1580
|
+
const params = resolveIntegrationMiddlewareParams(entry, pathname, runtime.config);
|
|
1627
1581
|
if (!params) {
|
|
1628
1582
|
continue;
|
|
1629
1583
|
}
|
|
@@ -1865,7 +1819,7 @@ async function dispatchIntegrationRequest(runtime, request, options = {}) {
|
|
|
1865
1819
|
}
|
|
1866
1820
|
}
|
|
1867
1821
|
if (forwardedSetCookies.length > 0) {
|
|
1868
|
-
_optionalChain([options, 'access',
|
|
1822
|
+
_optionalChain([options, 'access', _24 => _24.onForwardedCookies, 'optionalCall', _25 => _25(forwardedSetCookies)]);
|
|
1869
1823
|
}
|
|
1870
1824
|
return null;
|
|
1871
1825
|
}
|
|
@@ -2046,6 +2000,44 @@ function matchesMethod(methods, normalizedMethod) {
|
|
|
2046
2000
|
return methods.some((candidate) => candidate === "ALL" || candidate === normalizedMethod);
|
|
2047
2001
|
}
|
|
2048
2002
|
_chunkS3JO3N4Hcjs.__name.call(void 0, matchesMethod, "matchesMethod");
|
|
2003
|
+
var compiledIntegrationGuards = /* @__PURE__ */ new WeakMap();
|
|
2004
|
+
var noMiddlewareContext = {};
|
|
2005
|
+
function resolveIntegrationMiddlewareParams(entry, pathname, config) {
|
|
2006
|
+
const params = resolveMatcherParams(entry.matcher, pathname);
|
|
2007
|
+
if (params || !entry.matcher) return params;
|
|
2008
|
+
const routePathname = resolveIntegrationRoutePathname(pathname, config);
|
|
2009
|
+
if (routePathname !== pathname) {
|
|
2010
|
+
const routeParams = resolveMatcherParams(entry.matcher, routePathname);
|
|
2011
|
+
if (routeParams) return routeParams;
|
|
2012
|
+
}
|
|
2013
|
+
let compiled = compiledIntegrationGuards.get(entry);
|
|
2014
|
+
if (!compiled) {
|
|
2015
|
+
compiled = _chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, {
|
|
2016
|
+
matcher: typeof entry.matcher === "string" ? entry.matcher : [...entry.matcher]
|
|
2017
|
+
});
|
|
2018
|
+
compiledIntegrationGuards.set(entry, compiled);
|
|
2019
|
+
}
|
|
2020
|
+
for (const candidate of routePathname === pathname ? [pathname] : [pathname, routePathname]) {
|
|
2021
|
+
const result = _chunkZ2HLU4IXcjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
|
|
2022
|
+
if (result.matched) return _nullishCoalesce(result.params, () => ( {}));
|
|
2023
|
+
}
|
|
2024
|
+
return null;
|
|
2025
|
+
}
|
|
2026
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
|
|
2027
|
+
function resolveIntegrationRoutePathname(pathname, config) {
|
|
2028
|
+
const basePath = typeof _optionalChain([config, 'optionalAccess', _26 => _26.basePath]) === "string" ? config.basePath : void 0;
|
|
2029
|
+
let routePathname = basePath ? _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, basePath) : pathname;
|
|
2030
|
+
const i18n = _optionalChain([config, 'optionalAccess', _27 => _27.i18n]);
|
|
2031
|
+
if (i18n && Array.isArray(i18n.locales) && i18n.locales.length > 0) {
|
|
2032
|
+
routePathname = _chunkBIDYX3SLcjs.resolveFarmLocalePath.call(void 0, routePathname, {
|
|
2033
|
+
locales: i18n.locales,
|
|
2034
|
+
defaultLocale: i18n.defaultLocale,
|
|
2035
|
+
routing: i18n.routing || "prefix-except-default"
|
|
2036
|
+
}).pathname;
|
|
2037
|
+
}
|
|
2038
|
+
return routePathname;
|
|
2039
|
+
}
|
|
2040
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationRoutePathname, "resolveIntegrationRoutePathname");
|
|
2049
2041
|
function resolveMatcherParams(matcher, pathname) {
|
|
2050
2042
|
if (!matcher) {
|
|
2051
2043
|
return {};
|
|
@@ -2167,7 +2159,4 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeMatcher, "normalizeMatcher");
|
|
|
2167
2159
|
|
|
2168
2160
|
|
|
2169
2161
|
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
exports.resolveIntegrationAllowedOrigins = resolveIntegrationAllowedOrigins; exports.validateIntegrationRequestOrigin = validateIntegrationRequestOrigin; exports.describeIntegrationOriginRejection = describeIntegrationOriginRejection; exports.getFarmPluginIntegrationContext = getFarmPluginIntegrationContext; exports.FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY; exports.FARM_INTEGRATION_SET_COOKIES_KEY = FARM_INTEGRATION_SET_COOKIES_KEY; exports.forwardIntegrationSetCookies = forwardIntegrationSetCookies; exports.defineIntegrationSchema = defineIntegrationSchema; exports.getFarmIntegrationPluginServerRuntime = getFarmIntegrationPluginServerRuntime; exports.getFarmIntegrationPluginOwner = getFarmIntegrationPluginOwner; exports.createIntegrationRoute = createIntegrationRoute; exports.integrationRoute = integrationRoute; exports.defineIntegration = defineIntegration; exports.isFarmIntegration = isFarmIntegration; exports.resolveIntegrationPlugins = resolveIntegrationPlugins; exports.getIntegrationProviders = getIntegrationProviders; exports.isFarmIntegrationProviderComponentReference = isFarmIntegrationProviderComponentReference; exports.getIntegrationDocumentNavigationMatchers = getIntegrationDocumentNavigationMatchers; exports.getIntegrationSchemas = getIntegrationSchemas; exports.getRegisteredIntegrationRuntime = getRegisteredIntegrationRuntime; exports.getRegisteredIntegrations = getRegisteredIntegrations; exports.getRegisteredIntegrationSchemas = getRegisteredIntegrationSchemas; exports.matchIntegrationRoute = matchIntegrationRoute; exports.matchRegisteredIntegrationRoute = matchRegisteredIntegrationRoute; exports.getRegisteredIntegrationAPIManifest = getRegisteredIntegrationAPIManifest; exports.dispatchIntegrationRequest = dispatchIntegrationRequest; exports.dispatchIntegrationRequests = dispatchIntegrationRequests;
|
|
2162
|
+
exports.getFarmPluginIntegrationContext = getFarmPluginIntegrationContext; exports.FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY; exports.FARM_INTEGRATION_SET_COOKIES_KEY = FARM_INTEGRATION_SET_COOKIES_KEY; exports.forwardIntegrationSetCookies = forwardIntegrationSetCookies; exports.defineIntegrationSchema = defineIntegrationSchema; exports.getFarmIntegrationPluginServerRuntime = getFarmIntegrationPluginServerRuntime; exports.getFarmIntegrationPluginOwner = getFarmIntegrationPluginOwner; exports.createIntegrationRoute = createIntegrationRoute; exports.integrationRoute = integrationRoute; exports.defineIntegration = defineIntegration; exports.isFarmIntegration = isFarmIntegration; exports.resolveIntegrationPlugins = resolveIntegrationPlugins; exports.getIntegrationProviders = getIntegrationProviders; exports.isFarmIntegrationProviderComponentReference = isFarmIntegrationProviderComponentReference; exports.getIntegrationDocumentNavigationMatchers = getIntegrationDocumentNavigationMatchers; exports.getIntegrationSchemas = getIntegrationSchemas; exports.getRegisteredIntegrationRuntime = getRegisteredIntegrationRuntime; exports.getRegisteredIntegrations = getRegisteredIntegrations; exports.getRegisteredIntegrationSchemas = getRegisteredIntegrationSchemas; exports.matchIntegrationRoute = matchIntegrationRoute; exports.matchRegisteredIntegrationRoute = matchRegisteredIntegrationRoute; exports.getRegisteredIntegrationAPIManifest = getRegisteredIntegrationAPIManifest; exports.dispatchIntegrationRequest = dispatchIntegrationRequest; exports.dispatchIntegrationRequests = dispatchIntegrationRequests;
|
|
@@ -6,12 +6,13 @@ var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
|
|
|
6
6
|
var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkUXFQ3UDAcjs = require('./chunk-UXFQ3UDA.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
13
13
|
|
|
14
14
|
// src/plugins/infra-analytics.ts
|
|
15
|
+
var _async_hooks = require('async_hooks');
|
|
15
16
|
var FARM_PRERENDER_ENV = "FARM_PRERENDER";
|
|
16
17
|
var DEFAULT_URL = "https://app.farmjs.dev";
|
|
17
18
|
var EVENTS_PATH = "/api/telemetry/v1/events";
|
|
@@ -265,6 +266,20 @@ function requestEvent(metadata, method, status, durationMs) {
|
|
|
265
266
|
};
|
|
266
267
|
}
|
|
267
268
|
_chunkS3JO3N4Hcjs.__name.call(void 0, requestEvent, "requestEvent");
|
|
269
|
+
function toolEvent(metadata, event) {
|
|
270
|
+
return {
|
|
271
|
+
id: uuid(),
|
|
272
|
+
requestId: metadata.id,
|
|
273
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
274
|
+
route: metadata.route,
|
|
275
|
+
agent: metadata.agent,
|
|
276
|
+
kind: "mcp.tool",
|
|
277
|
+
tool: event.tool,
|
|
278
|
+
outcome: event.outcome,
|
|
279
|
+
durationMs: duration(event.durationMs)
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, toolEvent, "toolEvent");
|
|
268
283
|
function farmInfraAnalyticsPlugin(options, send) {
|
|
269
284
|
const contextKey = `${CONTEXT_KEY}.${uuid()}`;
|
|
270
285
|
return {
|
|
@@ -284,21 +299,11 @@ function farmInfraAnalyticsPlugin(options, send) {
|
|
|
284
299
|
context.state.unsubscribe = _chunkE3UK5IIBcjs.onFarmEvent.call(void 0,
|
|
285
300
|
(event) => {
|
|
286
301
|
if (!isToolEvent(event)) return;
|
|
287
|
-
const request =
|
|
302
|
+
const request = _chunkUXFQ3UDAcjs.getCurrentRequestOrNull.call(void 0, );
|
|
288
303
|
if (!request) return;
|
|
289
304
|
const metadata = context.requestContext.get(request, contextKey);
|
|
290
305
|
if (!metadata) return;
|
|
291
|
-
exporter.enqueue(
|
|
292
|
-
id: uuid(),
|
|
293
|
-
requestId: metadata.id,
|
|
294
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
295
|
-
route: metadata.route,
|
|
296
|
-
agent: metadata.agent,
|
|
297
|
-
kind: "mcp.tool",
|
|
298
|
-
tool: event.tool,
|
|
299
|
-
outcome: event.outcome,
|
|
300
|
-
durationMs: duration(event.durationMs)
|
|
301
|
-
});
|
|
306
|
+
exporter.enqueue(toolEvent(metadata, event));
|
|
302
307
|
metadata.waitUntil(exporter.flush());
|
|
303
308
|
},
|
|
304
309
|
{ unfiltered: true }
|
|
@@ -333,6 +338,17 @@ function farmInfraAnalyticsPlugin(options, send) {
|
|
|
333
338
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmInfraAnalyticsPlugin, "farmInfraAnalyticsPlugin");
|
|
334
339
|
function farmInfraAnalyticsRecorder(options, send) {
|
|
335
340
|
const exporter = createFarmInfraAnalyticsExporter(options, send);
|
|
341
|
+
const requests = new (0, _async_hooks.AsyncLocalStorage)();
|
|
342
|
+
const unsubscribe = _chunkE3UK5IIBcjs.onFarmEvent.call(void 0,
|
|
343
|
+
(event) => {
|
|
344
|
+
if (!isToolEvent(event)) return;
|
|
345
|
+
const metadata = requests.getStore();
|
|
346
|
+
if (!metadata) return;
|
|
347
|
+
exporter.enqueue(toolEvent(metadata, event));
|
|
348
|
+
metadata.waitUntil(exporter.flush());
|
|
349
|
+
},
|
|
350
|
+
{ unfiltered: true }
|
|
351
|
+
);
|
|
336
352
|
return {
|
|
337
353
|
async record(request, runtime, waitUntil, handler) {
|
|
338
354
|
if (runtime.kind === "asset") return handler();
|
|
@@ -342,7 +358,7 @@ function farmInfraAnalyticsRecorder(options, send) {
|
|
|
342
358
|
const startedAt = performance.now();
|
|
343
359
|
let response;
|
|
344
360
|
try {
|
|
345
|
-
response = await handler
|
|
361
|
+
response = await requests.run(metadata, handler);
|
|
346
362
|
} catch (error) {
|
|
347
363
|
background(exporter.flush());
|
|
348
364
|
throw error;
|
|
@@ -355,7 +371,10 @@ function farmInfraAnalyticsRecorder(options, send) {
|
|
|
355
371
|
background(exporter.flush());
|
|
356
372
|
return response;
|
|
357
373
|
},
|
|
358
|
-
close
|
|
374
|
+
close() {
|
|
375
|
+
unsubscribe();
|
|
376
|
+
return exporter.close();
|
|
377
|
+
}
|
|
359
378
|
};
|
|
360
379
|
}
|
|
361
380
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmInfraAnalyticsRecorder, "farmInfraAnalyticsRecorder");
|