theokit 0.48.13 → 0.50.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 +1 -0
- package/dist/{actions-virtual-module-YQXRSSMW.js → actions-virtual-module-5WBVSDOM.js} +22 -12
- package/dist/actions-virtual-module-5WBVSDOM.js.map +1 -0
- package/dist/{actions-virtual-module-LB4NGONI.js → actions-virtual-module-ZYLMNW6K.js} +13 -8
- package/dist/{actions-virtual-module-LB4NGONI.js.map → actions-virtual-module-ZYLMNW6K.js.map} +1 -1
- package/dist/adapters/agent-mount.d.ts +127 -0
- package/dist/adapters/agent-mount.js +24 -0
- package/dist/adapters/security-headers.d.ts +132 -0
- package/dist/adapters/security-headers.js +64 -0
- package/dist/adapters/security-headers.js.map +1 -0
- package/dist/adapters/web-shim.d.ts +100 -13
- package/dist/adapters/web-shim.js +158 -54
- package/dist/adapters/web-shim.js.map +1 -1
- package/dist/agent-GKUEL6OH.js +15 -0
- package/dist/agent-scan-BZa-pagG.d.ts +16 -0
- package/dist/{app-typed-client-GHO3EWZK.js → app-typed-client-4LAIEGFX.js} +23 -13
- package/dist/app-typed-client-4LAIEGFX.js.map +1 -0
- package/dist/{app-typed-client-G3J5G7E5.js → app-typed-client-DQM3Y6YY.js} +14 -9
- package/dist/app-typed-client-DQM3Y6YY.js.map +1 -0
- package/dist/aws-lambda-VKMYUMP2.js +261 -0
- package/dist/aws-lambda-VKMYUMP2.js.map +1 -0
- package/dist/{build-WU6AKKIB.js → build-FLX6VF7Q.js} +71 -26
- package/dist/build-FLX6VF7Q.js.map +1 -0
- package/dist/{bun-33RD6K7O.js → bun-L7PP6ID5.js} +105 -13
- package/dist/bun-L7PP6ID5.js.map +1 -0
- package/dist/{check-45NKUVSQ.js → check-GIPZBFTX.js} +2 -2
- package/dist/{chunk-KD5G3YXI.js → chunk-2AMLGJJA.js} +35 -9
- package/dist/chunk-2AMLGJJA.js.map +1 -0
- package/dist/chunk-3PBAN2YE.js +146 -0
- package/dist/chunk-3PBAN2YE.js.map +1 -0
- package/dist/{chunk-HBU2GIMZ.js → chunk-3QPVEJ7D.js} +15 -9
- package/dist/chunk-3QPVEJ7D.js.map +1 -0
- package/dist/{chunk-47CINLWF.js → chunk-44J2ANQC.js} +2 -2
- package/dist/{chunk-IEES3CHD.js → chunk-47MM2JUK.js} +8 -2
- package/dist/chunk-47MM2JUK.js.map +1 -0
- package/dist/chunk-4X6H2BXP.js +108 -0
- package/dist/chunk-4X6H2BXP.js.map +1 -0
- package/dist/{chunk-A7JBF5FO.js → chunk-5K4TDLRG.js} +8 -5
- package/dist/chunk-5K4TDLRG.js.map +1 -0
- package/dist/chunk-5YPXXSYY.js +181 -0
- package/dist/chunk-5YPXXSYY.js.map +1 -0
- package/dist/{chunk-YGAXV5HR.js → chunk-6J4JWHDJ.js} +191 -112
- package/dist/chunk-6J4JWHDJ.js.map +1 -0
- package/dist/chunk-72DMJBXI.js +424 -0
- package/dist/chunk-72DMJBXI.js.map +1 -0
- package/dist/chunk-7PM6K5EV.js +513 -0
- package/dist/chunk-7PM6K5EV.js.map +1 -0
- package/dist/{chunk-MTEWLGVY.js → chunk-BPYMC7SU.js} +4 -48
- package/dist/chunk-BPYMC7SU.js.map +1 -0
- package/dist/chunk-BU6RJPPJ.js +421 -0
- package/dist/chunk-BU6RJPPJ.js.map +1 -0
- package/dist/{chunk-FB2HBNIC.js → chunk-BX6EUYHU.js} +6 -2
- package/dist/chunk-BX6EUYHU.js.map +1 -0
- package/dist/{chunk-BIVCP6X5.js → chunk-C62IZEJI.js} +465 -202
- package/dist/chunk-C62IZEJI.js.map +1 -0
- package/dist/chunk-D4VP2QPR.js +16 -0
- package/dist/chunk-D4VP2QPR.js.map +1 -0
- package/dist/{chunk-J5MXCGKA.js → chunk-DHAD2O3S.js} +6 -6
- package/dist/chunk-DHAD2O3S.js.map +1 -0
- package/dist/chunk-E43VJ3E5.js +188 -0
- package/dist/chunk-E43VJ3E5.js.map +1 -0
- package/dist/chunk-EVZKNA2W.js +110 -0
- package/dist/chunk-EVZKNA2W.js.map +1 -0
- package/dist/chunk-FD4ZDTQ6.js +181 -0
- package/dist/chunk-FD4ZDTQ6.js.map +1 -0
- package/dist/chunk-FDOOBTXJ.js +17 -0
- package/dist/chunk-FDOOBTXJ.js.map +1 -0
- package/dist/chunk-FH3SQR6P.js +275 -0
- package/dist/chunk-FH3SQR6P.js.map +1 -0
- package/dist/chunk-HJHGTFEJ.js +23 -0
- package/dist/chunk-HJHGTFEJ.js.map +1 -0
- package/dist/{chunk-LXAESF4Y.js → chunk-HK4AZBKX.js} +7 -4
- package/dist/chunk-HK4AZBKX.js.map +1 -0
- package/dist/{chunk-T5C46IIU.js → chunk-HWBRS4DZ.js} +28 -269
- package/dist/chunk-HWBRS4DZ.js.map +1 -0
- package/dist/chunk-IRQGAC4L.js +52 -0
- package/dist/chunk-IRQGAC4L.js.map +1 -0
- package/dist/{chunk-FNTLKHZ7.js → chunk-JDN5SAAD.js} +7 -4
- package/dist/chunk-JDN5SAAD.js.map +1 -0
- package/dist/{chunk-GXEX4CBH.js → chunk-JIKNR5LX.js} +673 -484
- package/dist/chunk-JIKNR5LX.js.map +1 -0
- package/dist/{chunk-GRI4XHBJ.js → chunk-JWRCZIA4.js} +266 -108
- package/dist/chunk-JWRCZIA4.js.map +1 -0
- package/dist/{chunk-E576KYYT.js → chunk-KI4DOTN4.js} +25 -2
- package/dist/chunk-KI4DOTN4.js.map +1 -0
- package/dist/{chunk-ZB7D62OA.js → chunk-KUZVRJ7M.js} +3 -3
- package/dist/chunk-L4VFNFDL.js +248 -0
- package/dist/chunk-L4VFNFDL.js.map +1 -0
- package/dist/chunk-M2WC5MF7.js +127 -0
- package/dist/chunk-M2WC5MF7.js.map +1 -0
- package/dist/{chunk-O3JIAU3V.js → chunk-MCTC6HSE.js} +157 -103
- package/dist/chunk-MCTC6HSE.js.map +1 -0
- package/dist/{chunk-PXFXSFJL.js → chunk-NZ5JU6D3.js} +9 -9
- package/dist/{chunk-YRBR424R.js → chunk-OAUI273L.js} +338 -165
- package/dist/chunk-OAUI273L.js.map +1 -0
- package/dist/chunk-OGLS76RN.js +43 -0
- package/dist/chunk-OGLS76RN.js.map +1 -0
- package/dist/{chunk-7LVM22VG.js → chunk-OQCRCXCP.js} +6 -6
- package/dist/chunk-OQCRCXCP.js.map +1 -0
- package/dist/{chunk-OLGPYOLO.js → chunk-P6OS7652.js} +5 -2
- package/dist/chunk-P6OS7652.js.map +1 -0
- package/dist/chunk-Q5L5EGWZ.js +26 -0
- package/dist/chunk-Q5L5EGWZ.js.map +1 -0
- package/dist/{chunk-S433N3CT.js → chunk-QTHVHNJJ.js} +6 -36
- package/dist/chunk-QTHVHNJJ.js.map +1 -0
- package/dist/chunk-RPET332G.js +84 -0
- package/dist/chunk-RPET332G.js.map +1 -0
- package/dist/{chunk-646CA6RV.js → chunk-RQW5YMH7.js} +12 -4
- package/dist/chunk-RQW5YMH7.js.map +1 -0
- package/dist/{chunk-XALU5LCU.js → chunk-RWNYIU6A.js} +550 -146
- package/dist/chunk-RWNYIU6A.js.map +1 -0
- package/dist/chunk-SL7YUHPV.js +111 -0
- package/dist/chunk-SL7YUHPV.js.map +1 -0
- package/dist/chunk-U5PWXS3J.js +39 -0
- package/dist/chunk-U5PWXS3J.js.map +1 -0
- package/dist/chunk-ULDCFL2O.js +273 -0
- package/dist/chunk-ULDCFL2O.js.map +1 -0
- package/dist/{chunk-RWNSW4FM.js → chunk-UMNXCU3K.js} +12 -6
- package/dist/{chunk-RWNSW4FM.js.map → chunk-UMNXCU3K.js.map} +1 -1
- package/dist/chunk-VI7ZANB3.js +193 -0
- package/dist/chunk-VI7ZANB3.js.map +1 -0
- package/dist/chunk-VQPHPQ5L.js +14 -0
- package/dist/chunk-VQPHPQ5L.js.map +1 -0
- package/dist/chunk-WNJTJRM6.js +147 -0
- package/dist/chunk-WNJTJRM6.js.map +1 -0
- package/dist/chunk-WOBSEO75.js +790 -0
- package/dist/chunk-WOBSEO75.js.map +1 -0
- package/dist/{chunk-BMHS4WAN.js → chunk-XS7EX55U.js} +156 -42
- package/dist/chunk-XS7EX55U.js.map +1 -0
- package/dist/chunk-YN4W7LCX.js +31 -0
- package/dist/chunk-YN4W7LCX.js.map +1 -0
- package/dist/chunk-YSJOZEI6.js +1 -0
- package/dist/{chunk-JA2ZAT5Q.js → chunk-Z4PJMZLM.js} +2 -2
- package/dist/chunk-Z4PJMZLM.js.map +1 -0
- package/dist/{chunk-7VPQHEAJ.js → chunk-ZNZISJDZ.js} +6 -2
- package/dist/chunk-ZNZISJDZ.js.map +1 -0
- package/dist/chunk-ZWN3AODA.js +11 -0
- package/dist/chunk-ZWN3AODA.js.map +1 -0
- package/dist/cli/index.js +25 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/client/core.d.ts +1 -1
- package/dist/client/core.js +2 -0
- package/dist/client/core.js.map +1 -1
- package/dist/client/index.d.ts +44 -10
- package/dist/client/index.js +35 -0
- package/dist/client/index.js.map +1 -1
- package/dist/cloudflare-SIG42OIW.js +335 -0
- package/dist/cloudflare-SIG42OIW.js.map +1 -0
- package/dist/config-support-WQHQIJTA.js +104 -0
- package/dist/config-support-WQHQIJTA.js.map +1 -0
- package/dist/{csrf-BBrEZSBW.d.ts → csrf-Dgot9qSM.d.ts} +1 -1
- package/dist/deno-deploy-LQAYOOPW.js +196 -0
- package/dist/deno-deploy-LQAYOOPW.js.map +1 -0
- package/dist/{dev-MUWJAZRD.js → dev-ANDSEVLB.js} +28 -18
- package/dist/dev-ANDSEVLB.js.map +1 -0
- package/dist/{dev-emit-GWD6IXV7.js → dev-emit-BFNMDCPB.js} +5 -5
- package/dist/{dev-emit-NBT6JD7R.js → dev-emit-MVAJAFGX.js} +5 -3
- package/dist/dev-emit-MVAJAFGX.js.map +1 -0
- package/dist/engine-singleton-X4R7AZBJ.js +315 -0
- package/dist/engine-singleton-X4R7AZBJ.js.map +1 -0
- package/dist/{generate-Y3GWM57K.js → generate-EN6EDITF.js} +43 -4
- package/dist/generate-EN6EDITF.js.map +1 -0
- package/dist/index-CzxtQcnp.d.ts +1058 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/dist/{info-XW7HGUPH.js → info-Y55RWS42.js} +8 -6
- package/dist/{info-XW7HGUPH.js.map → info-Y55RWS42.js.map} +1 -1
- package/dist/{internal-api-V5L65YSJ.js → internal-api-IP35YU3G.js} +22 -12
- package/dist/{internal-api-WEOSTMSN.js → internal-api-OPU456AT.js} +30 -16
- package/dist/internal-api-OPU456AT.js.map +1 -0
- package/dist/load-config-4ATXQUN3.js +16 -0
- package/dist/match-DmGgxjIU.d.ts +44 -0
- package/dist/{mcp-ULUFJNSZ.js → mcp-5LLNAGKA.js} +7 -7
- package/dist/netlify-C2IRCZKI.js +245 -0
- package/dist/netlify-C2IRCZKI.js.map +1 -0
- package/dist/node-OSVPYQ3D.js +10 -0
- package/dist/nonce-BXt7Qu_C.d.ts +31 -0
- package/dist/observability-bootstrap-MZMSOE66.js +15 -0
- package/dist/{openapi-HZXR335W.js → openapi-VFPEZSRI.js} +13 -11
- package/dist/{openapi-HZXR335W.js.map → openapi-VFPEZSRI.js.map} +1 -1
- package/dist/{plugin-runner-BFEcgtmJ.d.ts → plugin-runner-BVMOSxvb.d.ts} +1 -1
- package/dist/{plugin-types-D69-lJZ9.d.ts → plugin-types-BUVfUQ0V.d.ts} +13 -1
- package/dist/preview-GHPT2EQ5.js +23 -0
- package/dist/preview-GHPT2EQ5.js.map +1 -0
- package/dist/provider-resolver-Dx6QuWrw.d.ts +128 -0
- package/dist/registry-KBZDCFVQ.js +23 -0
- package/dist/route-config-Cm_ZMA1C.d.ts +72 -0
- package/dist/route-policy-BxOycCDq.d.ts +65 -0
- package/dist/router/element-scroll-restoration.d.ts +28 -0
- package/dist/router/element-scroll-restoration.js +96 -0
- package/dist/router/element-scroll-restoration.js.map +1 -0
- package/dist/{routes-OLNQX7CT.js → routes-BPLU3ISV.js} +11 -9
- package/dist/{routes-OLNQX7CT.js.map → routes-BPLU3ISV.js.map} +1 -1
- package/dist/{scan-7MJC6PYU.js → scan-YJEE4KQK.js} +2 -2
- package/dist/{schema-ZO3OSWVG.js → schema-SOAD43RQ.js} +7 -5
- package/dist/schemas-4AXHQMV3.js +25 -0
- package/dist/schemas-4AXHQMV3.js.map +1 -0
- package/dist/security-headers-Ccj7ncNx.d.ts +129 -0
- package/dist/server/agent/index.d.ts +2 -90
- package/dist/server/agent/index.js +1 -1
- package/dist/server/auth/index.d.ts +2 -21
- package/dist/server/auth/index.js +3 -2
- package/dist/server/cron/index.js +4 -3
- package/dist/server/define/index.d.ts +51 -57
- package/dist/server/define/index.js +10 -1
- package/dist/server/http/index.d.ts +7 -5
- package/dist/server/http/index.js +56 -12
- package/dist/server/index.d.ts +47 -439
- package/dist/server/index.js +119 -201
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.js +4 -3
- package/dist/server/observability/index.d.ts +109 -35
- package/dist/server/observability/index.js +10 -7
- package/dist/server/plugins/index.d.ts +3 -3
- package/dist/server/scan/index.d.ts +47 -12
- package/dist/server/scan/index.js +13 -4
- package/dist/server/security/index.d.ts +61 -103
- package/dist/server/security/index.js +15 -6
- package/dist/server/webhook/index.d.ts +90 -3
- package/dist/server/webhook/index.js +12 -2
- package/dist/server-boundary-6B4ZQUY7.js +148 -0
- package/dist/server-boundary-6B4ZQUY7.js.map +1 -0
- package/dist/server-boundary-7VZQRPPX.js +133 -0
- package/dist/server-boundary-7VZQRPPX.js.map +1 -0
- package/dist/{services-typed-client-PSAGRPFF.js → services-typed-client-XGT5SUUN.js} +2 -2
- package/dist/{start-KR2JJR7K.js → start-UZDMOT7I.js} +342 -111
- package/dist/start-UZDMOT7I.js.map +1 -0
- package/dist/{static-M2W4HUWS.js → static-SVDWIOXJ.js} +24 -13
- package/dist/static-SVDWIOXJ.js.map +1 -0
- package/dist/{theo-cloud-XAHWOUFK.js → theo-cloud-3ET4G5T6.js} +9 -2
- package/dist/theo-cloud-3ET4G5T6.js.map +1 -0
- package/dist/vercel-BMCQKCWE.js +277 -0
- package/dist/vercel-BMCQKCWE.js.map +1 -0
- package/dist/vite-plugin/index.js +24 -13
- package/dist/vite-plugin-VKCT2LF2.js +42 -0
- package/dist/vite-plugin-VKCT2LF2.js.map +1 -0
- package/package.json +19 -6
- package/dist/actions-virtual-module-YQXRSSMW.js.map +0 -1
- package/dist/agent-7JJW3TPB.js +0 -15
- package/dist/app-typed-client-G3J5G7E5.js.map +0 -1
- package/dist/app-typed-client-GHO3EWZK.js.map +0 -1
- package/dist/aws-lambda-CYNDGU5O.js +0 -172
- package/dist/aws-lambda-CYNDGU5O.js.map +0 -1
- package/dist/build-WU6AKKIB.js.map +0 -1
- package/dist/bun-33RD6K7O.js.map +0 -1
- package/dist/chunk-646CA6RV.js.map +0 -1
- package/dist/chunk-6E5WKMDS.js +0 -67
- package/dist/chunk-6E5WKMDS.js.map +0 -1
- package/dist/chunk-6GGWS7J3.js +0 -91
- package/dist/chunk-6GGWS7J3.js.map +0 -1
- package/dist/chunk-7LVM22VG.js.map +0 -1
- package/dist/chunk-7VPQHEAJ.js.map +0 -1
- package/dist/chunk-A7JBF5FO.js.map +0 -1
- package/dist/chunk-AM3QABW5.js +0 -161
- package/dist/chunk-AM3QABW5.js.map +0 -1
- package/dist/chunk-BIVCP6X5.js.map +0 -1
- package/dist/chunk-BMHS4WAN.js.map +0 -1
- package/dist/chunk-E576KYYT.js.map +0 -1
- package/dist/chunk-FB2HBNIC.js.map +0 -1
- package/dist/chunk-FNTLKHZ7.js.map +0 -1
- package/dist/chunk-GRI4XHBJ.js.map +0 -1
- package/dist/chunk-GVW5EKEU.js +0 -422
- package/dist/chunk-GVW5EKEU.js.map +0 -1
- package/dist/chunk-GXEX4CBH.js.map +0 -1
- package/dist/chunk-HBU2GIMZ.js.map +0 -1
- package/dist/chunk-IEES3CHD.js.map +0 -1
- package/dist/chunk-J5MXCGKA.js.map +0 -1
- package/dist/chunk-JA2ZAT5Q.js.map +0 -1
- package/dist/chunk-KD5G3YXI.js.map +0 -1
- package/dist/chunk-LNVMHQ2Z.js +0 -54
- package/dist/chunk-LNVMHQ2Z.js.map +0 -1
- package/dist/chunk-LXAESF4Y.js.map +0 -1
- package/dist/chunk-MTEWLGVY.js.map +0 -1
- package/dist/chunk-O3JIAU3V.js.map +0 -1
- package/dist/chunk-OJLL4YD6.js +0 -403
- package/dist/chunk-OJLL4YD6.js.map +0 -1
- package/dist/chunk-OLGPYOLO.js.map +0 -1
- package/dist/chunk-S433N3CT.js.map +0 -1
- package/dist/chunk-T5C46IIU.js.map +0 -1
- package/dist/chunk-U267AOWS.js +0 -28
- package/dist/chunk-U267AOWS.js.map +0 -1
- package/dist/chunk-UW2TEAGR.js +0 -77
- package/dist/chunk-UW2TEAGR.js.map +0 -1
- package/dist/chunk-WPJOTQA5.js +0 -1
- package/dist/chunk-XALU5LCU.js.map +0 -1
- package/dist/chunk-XR74JD4M.js +0 -457
- package/dist/chunk-XR74JD4M.js.map +0 -1
- package/dist/chunk-YGAXV5HR.js.map +0 -1
- package/dist/chunk-YRBR424R.js.map +0 -1
- package/dist/cloudflare-KYUWCEPL.js +0 -122
- package/dist/cloudflare-KYUWCEPL.js.map +0 -1
- package/dist/deno-deploy-CCTB7HGS.js +0 -107
- package/dist/deno-deploy-CCTB7HGS.js.map +0 -1
- package/dist/dev-MUWJAZRD.js.map +0 -1
- package/dist/dev-emit-NBT6JD7R.js.map +0 -1
- package/dist/generate-Y3GWM57K.js.map +0 -1
- package/dist/index-BEtEv6ZH.d.ts +0 -575
- package/dist/load-config-VKD6LKWU.js +0 -14
- package/dist/match-CfbEFRG4.d.ts +0 -26
- package/dist/netlify-AFMDNKT4.js +0 -150
- package/dist/netlify-AFMDNKT4.js.map +0 -1
- package/dist/node-ZJQEJSP3.js +0 -10
- package/dist/registry-GKR3EWRW.js +0 -23
- package/dist/start-KR2JJR7K.js.map +0 -1
- package/dist/static-M2W4HUWS.js.map +0 -1
- package/dist/theo-cloud-XAHWOUFK.js.map +0 -1
- package/dist/vercel-SRS2DH6O.js +0 -133
- package/dist/vercel-SRS2DH6O.js.map +0 -1
- package/dist/vite-plugin-VPJFD4HK.js +0 -36
- /package/dist/{chunk-WPJOTQA5.js.map → adapters/agent-mount.js.map} +0 -0
- /package/dist/{agent-7JJW3TPB.js.map → agent-GKUEL6OH.js.map} +0 -0
- /package/dist/{check-45NKUVSQ.js.map → check-GIPZBFTX.js.map} +0 -0
- /package/dist/{chunk-47CINLWF.js.map → chunk-44J2ANQC.js.map} +0 -0
- /package/dist/{chunk-ZB7D62OA.js.map → chunk-KUZVRJ7M.js.map} +0 -0
- /package/dist/{chunk-PXFXSFJL.js.map → chunk-NZ5JU6D3.js.map} +0 -0
- /package/dist/{internal-api-WEOSTMSN.js.map → chunk-YSJOZEI6.js.map} +0 -0
- /package/dist/{dev-emit-GWD6IXV7.js.map → dev-emit-BFNMDCPB.js.map} +0 -0
- /package/dist/{internal-api-V5L65YSJ.js.map → internal-api-IP35YU3G.js.map} +0 -0
- /package/dist/{load-config-VKD6LKWU.js.map → load-config-4ATXQUN3.js.map} +0 -0
- /package/dist/{mcp-ULUFJNSZ.js.map → mcp-5LLNAGKA.js.map} +0 -0
- /package/dist/{node-ZJQEJSP3.js.map → node-OSVPYQ3D.js.map} +0 -0
- /package/dist/{scan-7MJC6PYU.js.map → observability-bootstrap-MZMSOE66.js.map} +0 -0
- /package/dist/{registry-GKR3EWRW.js.map → registry-KBZDCFVQ.js.map} +0 -0
- /package/dist/{schema-ZO3OSWVG.js.map → scan-YJEE4KQK.js.map} +0 -0
- /package/dist/{vite-plugin-VPJFD4HK.js.map → schema-SOAD43RQ.js.map} +0 -0
- /package/dist/{services-typed-client-PSAGRPFF.js.map → services-typed-client-XGT5SUUN.js.map} +0 -0
package/dist/server/index.js
CHANGED
|
@@ -8,15 +8,24 @@ import {
|
|
|
8
8
|
BodyTooLargeError,
|
|
9
9
|
DEFAULT_MAX_BODY_BYTES,
|
|
10
10
|
defineWebhook,
|
|
11
|
+
discord,
|
|
11
12
|
dispatchWebhook,
|
|
13
|
+
github,
|
|
12
14
|
readRawBody,
|
|
15
|
+
slack,
|
|
16
|
+
stripe,
|
|
17
|
+
telegram,
|
|
13
18
|
timingSafeEqual
|
|
14
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-BU6RJPPJ.js";
|
|
15
20
|
import {
|
|
16
21
|
MAX_ERROR_HTML_BYTES,
|
|
22
|
+
ProcedureInputError,
|
|
23
|
+
ProcedureOutputError,
|
|
24
|
+
callProcedure,
|
|
25
|
+
createOpenApiHandler,
|
|
17
26
|
loadCustomErrorPages,
|
|
18
27
|
serveStaticFile
|
|
19
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-ULDCFL2O.js";
|
|
20
29
|
import {
|
|
21
30
|
DuplicateJobNameError,
|
|
22
31
|
InMemoryJobBackend,
|
|
@@ -28,18 +37,10 @@ import {
|
|
|
28
37
|
defineJob,
|
|
29
38
|
scanJobs,
|
|
30
39
|
writeJobManifest
|
|
31
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-JDN5SAAD.js";
|
|
32
41
|
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
NoopSpan,
|
|
36
|
-
SpanImpl,
|
|
37
|
-
TheoCloudObservabilityAdapter,
|
|
38
|
-
createObservabilityPlugin,
|
|
39
|
-
defineObservabilityAdapter,
|
|
40
|
-
resolveAdapter,
|
|
41
|
-
serializeSpansToOtlp
|
|
42
|
-
} from "../chunk-O3JIAU3V.js";
|
|
42
|
+
defineObservabilityAdapter
|
|
43
|
+
} from "../chunk-HJHGTFEJ.js";
|
|
43
44
|
import "../chunk-GUBN5UTT.js";
|
|
44
45
|
import {
|
|
45
46
|
createRouteRateLimiter,
|
|
@@ -52,31 +53,33 @@ import {
|
|
|
52
53
|
ChannelManager
|
|
53
54
|
} from "../chunk-4PBJ266F.js";
|
|
54
55
|
import "../chunk-7IHWXDJJ.js";
|
|
55
|
-
import
|
|
56
|
+
import {
|
|
57
|
+
evaluateCsrfMultiHeaderRequest,
|
|
58
|
+
isCsrfOriginAllowed,
|
|
59
|
+
matchWildcardDomain
|
|
60
|
+
} from "../chunk-WNJTJRM6.js";
|
|
56
61
|
import {
|
|
57
62
|
_resetEnvCache,
|
|
58
|
-
|
|
63
|
+
loadEnv
|
|
64
|
+
} from "../chunk-4X6H2BXP.js";
|
|
65
|
+
import {
|
|
59
66
|
jsonTransformer,
|
|
60
|
-
loadEnv,
|
|
61
67
|
resolveTransformer,
|
|
62
|
-
superjsonTransformer
|
|
63
|
-
|
|
64
|
-
} from "../chunk-XR74JD4M.js";
|
|
68
|
+
superjsonTransformer
|
|
69
|
+
} from "../chunk-OGLS76RN.js";
|
|
65
70
|
import {
|
|
66
71
|
ActionError,
|
|
67
72
|
ActionInputError,
|
|
68
73
|
BATCH_PATH,
|
|
69
74
|
BatchPathConflictError,
|
|
70
75
|
STRIPPED_HEADERS,
|
|
71
|
-
TRACE_HEADER,
|
|
72
|
-
TRACE_PARENT_HEADER,
|
|
73
76
|
_resetMiddlewareCacheForTests,
|
|
74
77
|
createCorsHandler,
|
|
75
78
|
createCorsWebHandler,
|
|
79
|
+
createServerContext,
|
|
76
80
|
executeAction,
|
|
77
81
|
executeRoute,
|
|
78
|
-
|
|
79
|
-
extractTraceIdFromRequest,
|
|
82
|
+
executeWebRequest,
|
|
80
83
|
extractUniversalIssues,
|
|
81
84
|
handleBatchRequest,
|
|
82
85
|
handleRequestError,
|
|
@@ -84,11 +87,11 @@ import {
|
|
|
84
87
|
isActionError,
|
|
85
88
|
isInputError,
|
|
86
89
|
matchesOrigin,
|
|
87
|
-
parseTraceparent,
|
|
88
90
|
runMiddlewareAndContext,
|
|
89
91
|
sendError,
|
|
90
|
-
sendJson
|
|
91
|
-
|
|
92
|
+
sendJson,
|
|
93
|
+
validateRouteInput
|
|
94
|
+
} from "../chunk-RWNYIU6A.js";
|
|
92
95
|
import {
|
|
93
96
|
DuplicateContextKeyError,
|
|
94
97
|
createOutbox,
|
|
@@ -99,14 +102,31 @@ import {
|
|
|
99
102
|
findSuggestion,
|
|
100
103
|
levenshtein
|
|
101
104
|
} from "../chunk-NTDN54XO.js";
|
|
105
|
+
import {
|
|
106
|
+
ConsoleObservabilityAdapter,
|
|
107
|
+
NoopObservabilityAdapter,
|
|
108
|
+
NoopSpan,
|
|
109
|
+
SpanImpl,
|
|
110
|
+
TheoCloudObservabilityAdapter,
|
|
111
|
+
createObservabilityPlugin,
|
|
112
|
+
resolveAdapter,
|
|
113
|
+
serializeSpansToOtlp
|
|
114
|
+
} from "../chunk-MCTC6HSE.js";
|
|
102
115
|
import {
|
|
103
116
|
FileTooLargeError,
|
|
117
|
+
TRACE_HEADER,
|
|
118
|
+
TRACE_PARENT_HEADER,
|
|
104
119
|
_resetWarnOnceForTests,
|
|
105
120
|
createLogger,
|
|
121
|
+
extractTraceId,
|
|
122
|
+
extractTraceIdFromRequest,
|
|
123
|
+
extractW3CTraceContext,
|
|
106
124
|
logRequest,
|
|
107
125
|
parseRequestBody,
|
|
126
|
+
parseTraceparent,
|
|
127
|
+
parseTraceparentContext,
|
|
108
128
|
warnOnce
|
|
109
|
-
} from "../chunk-
|
|
129
|
+
} from "../chunk-72DMJBXI.js";
|
|
110
130
|
import {
|
|
111
131
|
DuplicateDecorationError,
|
|
112
132
|
DuplicatePluginError,
|
|
@@ -122,9 +142,12 @@ import {
|
|
|
122
142
|
import {
|
|
123
143
|
createProductionLoader,
|
|
124
144
|
createViteLoader
|
|
125
|
-
} from "../chunk-
|
|
145
|
+
} from "../chunk-OQCRCXCP.js";
|
|
126
146
|
import {
|
|
147
|
+
ACTION_SCHEMAS_DIR,
|
|
127
148
|
ActionScanError,
|
|
149
|
+
_resetRouteScanCacheForTests,
|
|
150
|
+
compareRouteSpecificity,
|
|
128
151
|
compilePattern,
|
|
129
152
|
generateManifest,
|
|
130
153
|
loadManifest,
|
|
@@ -134,27 +157,30 @@ import {
|
|
|
134
157
|
scanServerRoutes,
|
|
135
158
|
scanWebSocketRoutes,
|
|
136
159
|
writeManifest
|
|
137
|
-
} from "../chunk-
|
|
160
|
+
} from "../chunk-6J4JWHDJ.js";
|
|
138
161
|
import "../chunk-DV34VG3N.js";
|
|
162
|
+
import "../chunk-L4VFNFDL.js";
|
|
139
163
|
import {
|
|
140
164
|
scanMiddlewares
|
|
141
|
-
} from "../chunk-
|
|
165
|
+
} from "../chunk-BX6EUYHU.js";
|
|
142
166
|
import {
|
|
143
167
|
CSP_REPORT_PATH,
|
|
144
168
|
CSRF_READINESS_PATH,
|
|
145
169
|
CSRF_READINESS_RESET_PATH,
|
|
146
170
|
CsrfReadinessStore,
|
|
147
|
-
DEFAULT_CSP,
|
|
148
|
-
DEFAULT_PERMISSIONS_POLICY,
|
|
149
171
|
applySecurityHeaders,
|
|
150
|
-
buildSecurityHeaders,
|
|
151
172
|
handleCspReport,
|
|
152
173
|
handleCspReportRequest,
|
|
153
174
|
handleCsrfReadiness,
|
|
154
175
|
handleCsrfReadinessRequest,
|
|
155
176
|
normalizeLegacy,
|
|
156
177
|
normalizeNew
|
|
157
|
-
} from "../chunk-
|
|
178
|
+
} from "../chunk-BPYMC7SU.js";
|
|
179
|
+
import {
|
|
180
|
+
DEFAULT_CSP,
|
|
181
|
+
DEFAULT_PERMISSIONS_POLICY,
|
|
182
|
+
buildSecurityHeaders
|
|
183
|
+
} from "../chunk-IRQGAC4L.js";
|
|
158
184
|
import {
|
|
159
185
|
CSRF_WARN_CODE,
|
|
160
186
|
CSRF_WARN_DOCS_URL,
|
|
@@ -162,7 +188,7 @@ import {
|
|
|
162
188
|
matchDisallowed,
|
|
163
189
|
validateCsrf,
|
|
164
190
|
validateCsrfRequest
|
|
165
|
-
} from "../chunk-
|
|
191
|
+
} from "../chunk-P6OS7652.js";
|
|
166
192
|
import {
|
|
167
193
|
JsonStdoutSink,
|
|
168
194
|
createNoOpLogger,
|
|
@@ -204,7 +230,7 @@ import {
|
|
|
204
230
|
resetProviderRegistry,
|
|
205
231
|
resolveProvider,
|
|
206
232
|
tryResolveProvider
|
|
207
|
-
} from "../chunk-
|
|
233
|
+
} from "../chunk-3PBAN2YE.js";
|
|
208
234
|
import {
|
|
209
235
|
AuthRequiredError,
|
|
210
236
|
_resetKeyCacheForTests,
|
|
@@ -230,7 +256,7 @@ import {
|
|
|
230
256
|
verifyBackupCode,
|
|
231
257
|
verifyOAuthState,
|
|
232
258
|
verifyTotp
|
|
233
|
-
} from "../chunk-
|
|
259
|
+
} from "../chunk-RQW5YMH7.js";
|
|
234
260
|
import {
|
|
235
261
|
appendCookieToHeaders,
|
|
236
262
|
appendDeleteCookieToHeaders,
|
|
@@ -241,9 +267,10 @@ import {
|
|
|
241
267
|
serializeCookie,
|
|
242
268
|
setCookie
|
|
243
269
|
} from "../chunk-4FWBKX6G.js";
|
|
270
|
+
import "../chunk-YSJOZEI6.js";
|
|
244
271
|
import {
|
|
245
272
|
generateNonce
|
|
246
|
-
} from "../chunk-
|
|
273
|
+
} from "../chunk-Z4PJMZLM.js";
|
|
247
274
|
import {
|
|
248
275
|
InMemoryUsageStorage,
|
|
249
276
|
InMemoryUsageStorage2,
|
|
@@ -266,11 +293,12 @@ import {
|
|
|
266
293
|
translateCronToVercel,
|
|
267
294
|
validateCronSchedule,
|
|
268
295
|
writeCronManifest
|
|
269
|
-
} from "../chunk-
|
|
296
|
+
} from "../chunk-HK4AZBKX.js";
|
|
270
297
|
import "../chunk-VZTYCAO6.js";
|
|
271
|
-
import "../chunk-
|
|
298
|
+
import "../chunk-UMNXCU3K.js";
|
|
272
299
|
import "../chunk-52PDWL5S.js";
|
|
273
|
-
import "../chunk-
|
|
300
|
+
import "../chunk-5K4TDLRG.js";
|
|
301
|
+
import "../chunk-ZWN3AODA.js";
|
|
274
302
|
import {
|
|
275
303
|
action,
|
|
276
304
|
defineChannel,
|
|
@@ -281,7 +309,13 @@ import {
|
|
|
281
309
|
tool,
|
|
282
310
|
uiMessageStreamResponse,
|
|
283
311
|
websocket
|
|
284
|
-
} from "../chunk-
|
|
312
|
+
} from "../chunk-DHAD2O3S.js";
|
|
313
|
+
import "../chunk-D4VP2QPR.js";
|
|
314
|
+
import {
|
|
315
|
+
evaluateRoutePolicy,
|
|
316
|
+
requireOwner,
|
|
317
|
+
subjectFromContext
|
|
318
|
+
} from "../chunk-YN4W7LCX.js";
|
|
285
319
|
import {
|
|
286
320
|
HEALTH_PATH,
|
|
287
321
|
READY_PATH,
|
|
@@ -294,98 +328,6 @@ import {
|
|
|
294
328
|
} from "../chunk-SAFGDIPQ.js";
|
|
295
329
|
import "../chunk-XTHN6JBX.js";
|
|
296
330
|
|
|
297
|
-
// src/server/openapi/serve-docs.ts
|
|
298
|
-
import { existsSync, readFileSync, statSync } from "fs";
|
|
299
|
-
import { resolve } from "path";
|
|
300
|
-
var MAX_SPEC_BYTES = 10 * 1024 * 1024;
|
|
301
|
-
var DEFAULT_CDN = "https://cdn.jsdelivr.net/npm/@scalar/api-reference";
|
|
302
|
-
function createOpenApiHandler(opts = {}) {
|
|
303
|
-
const docsPath = opts.docsPath ?? "/api/docs";
|
|
304
|
-
const jsonPath = opts.openapiJsonPath ?? "/api/docs/openapi.json";
|
|
305
|
-
const rawSpecFile = opts.specFilePath ?? ".theokit/openapi.json";
|
|
306
|
-
const title = opts.pageTitle ?? "API Reference";
|
|
307
|
-
const cdn = opts.cdnUrl ?? DEFAULT_CDN;
|
|
308
|
-
if (hasDotDotSegment(rawSpecFile)) {
|
|
309
|
-
throw new Error(`[theokit:openapi] specFilePath must not contain ".." segments: ${rawSpecFile}`);
|
|
310
|
-
}
|
|
311
|
-
const specFile = resolve(rawSpecFile);
|
|
312
|
-
return (request) => {
|
|
313
|
-
if (request.method !== "GET") return null;
|
|
314
|
-
const url = new URL(request.url);
|
|
315
|
-
if (url.pathname === docsPath) {
|
|
316
|
-
const cdnHost = new URL(cdn).host;
|
|
317
|
-
return new Response(renderScalarHtml(title, jsonPath, cdn), {
|
|
318
|
-
status: 200,
|
|
319
|
-
headers: {
|
|
320
|
-
"content-type": "text/html; charset=utf-8",
|
|
321
|
-
"content-security-policy": `script-src 'self' 'unsafe-eval' ${cdnHost}; style-src 'self' 'unsafe-inline'; img-src 'self' data: ${cdnHost}; font-src 'self' data: ${cdnHost}; connect-src 'self' ${cdnHost}`
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
if (url.pathname === jsonPath) {
|
|
326
|
-
return serveSpecFile(specFile);
|
|
327
|
-
}
|
|
328
|
-
return null;
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
function hasDotDotSegment(p) {
|
|
332
|
-
return p.split(/[/\\]/).includes("..");
|
|
333
|
-
}
|
|
334
|
-
function escapeHtml(s) {
|
|
335
|
-
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
336
|
-
}
|
|
337
|
-
function renderScalarHtml(title, specUrl, cdnUrl) {
|
|
338
|
-
return `<!DOCTYPE html>
|
|
339
|
-
<html>
|
|
340
|
-
<head>
|
|
341
|
-
<meta charset="utf-8">
|
|
342
|
-
<title>${escapeHtml(title)}</title>
|
|
343
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
344
|
-
</head>
|
|
345
|
-
<body>
|
|
346
|
-
<script id="api-reference" data-url="${escapeHtml(specUrl)}"></script>
|
|
347
|
-
<script src="${escapeHtml(cdnUrl)}"></script>
|
|
348
|
-
</body>
|
|
349
|
-
</html>`;
|
|
350
|
-
}
|
|
351
|
-
function serveSpecFile(filePath) {
|
|
352
|
-
if (!existsSync(filePath)) {
|
|
353
|
-
return jsonResponse(503, {
|
|
354
|
-
error: {
|
|
355
|
-
code: "OPENAPI_NOT_EMITTED",
|
|
356
|
-
message: "OpenAPI spec not generated yet. Start the dev server and visit a route first."
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
try {
|
|
361
|
-
const stat = statSync(filePath);
|
|
362
|
-
if (stat.size > MAX_SPEC_BYTES) {
|
|
363
|
-
return jsonResponse(413, {
|
|
364
|
-
error: {
|
|
365
|
-
code: "OPENAPI_TOO_LARGE",
|
|
366
|
-
message: `Spec file exceeds ${MAX_SPEC_BYTES / 1024 / 1024}MB limit`
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
const content = readFileSync(filePath, "utf-8");
|
|
371
|
-
return new Response(content, {
|
|
372
|
-
status: 200,
|
|
373
|
-
headers: { "content-type": "application/json", "cache-control": "no-cache" }
|
|
374
|
-
});
|
|
375
|
-
} catch (err) {
|
|
376
|
-
const message = err instanceof Error ? err.message : "Failed to read OpenAPI spec file";
|
|
377
|
-
return jsonResponse(500, {
|
|
378
|
-
error: { code: "OPENAPI_READ_FAILED", message }
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
function jsonResponse(status, body) {
|
|
383
|
-
return new Response(JSON.stringify(body), {
|
|
384
|
-
status,
|
|
385
|
-
headers: { "content-type": "application/json" }
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
|
|
389
331
|
// src/cache/constants.ts
|
|
390
332
|
var CACHE_TAG_MAX_LENGTH = 256;
|
|
391
333
|
var CACHE_TAG_MAX_ITEMS = 128;
|
|
@@ -592,9 +534,12 @@ var variesCookieWarnedRoutes = /* @__PURE__ */ new WeakSet();
|
|
|
592
534
|
var oversizedWarnedRoutes = /* @__PURE__ */ new WeakSet();
|
|
593
535
|
function defineCachedRoute(engine, config) {
|
|
594
536
|
const { cache, handler, ...rest } = config;
|
|
595
|
-
const
|
|
596
|
-
const
|
|
597
|
-
|
|
537
|
+
const defaults = engine.defaults;
|
|
538
|
+
const maxAge = validateMaxAge(cache.maxAge ?? defaults.maxAge, "defineCachedRoute");
|
|
539
|
+
const swr = validateExpire(cache.swr ?? defaults.swr, maxAge, "defineCachedRoute");
|
|
540
|
+
const cacheVersion = cache.cacheVersion ?? defaults.cacheVersion;
|
|
541
|
+
const cacheErrors = cache.cacheErrors ?? defaults.cacheErrors ?? false;
|
|
542
|
+
if (cacheVersion === "") {
|
|
598
543
|
throw new Error("defineCachedRoute: cacheVersion must be non-empty if provided");
|
|
599
544
|
}
|
|
600
545
|
const maxEntrySize = cache.maxEntrySize ?? DEFAULT_MAX_ENTRY_SIZE;
|
|
@@ -632,7 +577,7 @@ function defineCachedRoute(engine, config) {
|
|
|
632
577
|
getKey: cache.getKey
|
|
633
578
|
});
|
|
634
579
|
const cached = await engine.tryReadCached(key, {
|
|
635
|
-
cacheVersion
|
|
580
|
+
cacheVersion
|
|
636
581
|
});
|
|
637
582
|
const routeCacheCtx = {
|
|
638
583
|
engine,
|
|
@@ -642,6 +587,8 @@ function defineCachedRoute(engine, config) {
|
|
|
642
587
|
maxEntrySize,
|
|
643
588
|
maxAge,
|
|
644
589
|
swr,
|
|
590
|
+
cacheVersion,
|
|
591
|
+
cacheErrors,
|
|
645
592
|
baseTags,
|
|
646
593
|
webRequest
|
|
647
594
|
};
|
|
@@ -670,16 +617,11 @@ function buildRouteCacheEntry(value, ctx) {
|
|
|
670
617
|
maxAge: ctx.maxAge,
|
|
671
618
|
swr: ctx.swr ?? ctx.maxAge * 60,
|
|
672
619
|
tags: [...ctx.baseTags, pathTag],
|
|
673
|
-
cacheVersion: ctx.
|
|
620
|
+
cacheVersion: ctx.cacheVersion
|
|
674
621
|
};
|
|
675
622
|
}
|
|
676
623
|
async function persistAndReturn(ctx, response) {
|
|
677
|
-
const cacheableResult = await tryCacheResponse(
|
|
678
|
-
response,
|
|
679
|
-
ctx.cache,
|
|
680
|
-
ctx.routeConfig,
|
|
681
|
-
ctx.maxEntrySize
|
|
682
|
-
);
|
|
624
|
+
const cacheableResult = await tryCacheResponse(response, ctx);
|
|
683
625
|
if (!cacheableResult) {
|
|
684
626
|
return response;
|
|
685
627
|
}
|
|
@@ -690,7 +632,7 @@ function scheduleRouteRevalidate(ctx, handler, handlerCtx) {
|
|
|
690
632
|
void (async () => {
|
|
691
633
|
try {
|
|
692
634
|
const response = await invokeHandlerAsResponse(handler, handlerCtx);
|
|
693
|
-
const result = await tryCacheResponse(response, ctx
|
|
635
|
+
const result = await tryCacheResponse(response, ctx);
|
|
694
636
|
if (!result) return;
|
|
695
637
|
await ctx.engine.set(ctx.key, buildRouteCacheEntry(result, ctx));
|
|
696
638
|
} catch {
|
|
@@ -724,7 +666,8 @@ async function invokeHandlerAsResponse(handler, ctx) {
|
|
|
724
666
|
if (raw instanceof Response) return raw;
|
|
725
667
|
return Response.json(raw);
|
|
726
668
|
}
|
|
727
|
-
async function tryCacheResponse(response,
|
|
669
|
+
async function tryCacheResponse(response, ctx) {
|
|
670
|
+
const { cache, routeConfig, maxEntrySize } = ctx;
|
|
728
671
|
if (response.headers.has("set-cookie")) {
|
|
729
672
|
if (!setCookieWarnedRoutes.has(routeConfig)) {
|
|
730
673
|
setCookieWarnedRoutes.add(routeConfig);
|
|
@@ -737,7 +680,7 @@ async function tryCacheResponse(response, cache, routeConfig, maxEntrySize) {
|
|
|
737
680
|
if (response.headers.get("transfer-encoding")?.toLowerCase() === "chunked") {
|
|
738
681
|
return void 0;
|
|
739
682
|
}
|
|
740
|
-
if (response.status >= 400 && !
|
|
683
|
+
if (response.status >= 400 && !ctx.cacheErrors) return void 0;
|
|
741
684
|
if (cache.cacheable && !cache.cacheable(response)) return void 0;
|
|
742
685
|
const text = await response.clone().text();
|
|
743
686
|
if (text.length > maxEntrySize) {
|
|
@@ -756,23 +699,23 @@ async function tryCacheResponse(response, cache, routeConfig, maxEntrySize) {
|
|
|
756
699
|
});
|
|
757
700
|
return { body: text, status: response.status, headers };
|
|
758
701
|
}
|
|
702
|
+
function toCacheStatusHeader(status) {
|
|
703
|
+
if (status === "hit") return "HIT";
|
|
704
|
+
if (status === "stale") return "STALE";
|
|
705
|
+
return "MISS";
|
|
706
|
+
}
|
|
759
707
|
function buildResponseFromCache(value, status, maxAge, swr) {
|
|
760
708
|
const headers = new Headers(value.headers);
|
|
761
709
|
if (!headers.has("cache-control")) {
|
|
762
710
|
headers.set("cache-control", getCacheControlHeader({ maxAge, swr: swr ?? maxAge * 60 }));
|
|
763
711
|
}
|
|
764
|
-
|
|
765
|
-
let cacheStatusHeader = "MISS";
|
|
766
|
-
if (status === "hit") cacheStatusHeader = "HIT";
|
|
767
|
-
else if (status === "stale") cacheStatusHeader = "STALE";
|
|
768
|
-
headers.set("X-Theo-Cache", cacheStatusHeader);
|
|
769
|
-
}
|
|
712
|
+
headers.set("X-Theo-Cache", toCacheStatusHeader(status));
|
|
770
713
|
return new Response(value.body, { status: value.status, headers });
|
|
771
714
|
}
|
|
772
715
|
|
|
773
716
|
// src/cache/cache-engine.ts
|
|
774
717
|
function createCacheEngine(opts) {
|
|
775
|
-
const { storage, onError } = opts;
|
|
718
|
+
const { storage, defaults = {}, onError } = opts;
|
|
776
719
|
const inFlight = /* @__PURE__ */ new Map();
|
|
777
720
|
const bgInFlight = /* @__PURE__ */ new Set();
|
|
778
721
|
const undefinedLoaderWarned = /* @__PURE__ */ new Set();
|
|
@@ -796,8 +739,8 @@ function createCacheEngine(opts) {
|
|
|
796
739
|
function claimAndRun(key, fn, options, skipWrite) {
|
|
797
740
|
let resolveOuter;
|
|
798
741
|
let rejectOuter;
|
|
799
|
-
const outerPromise = new Promise((
|
|
800
|
-
resolveOuter =
|
|
742
|
+
const outerPromise = new Promise((resolve, reject) => {
|
|
743
|
+
resolveOuter = resolve;
|
|
801
744
|
rejectOuter = reject;
|
|
802
745
|
});
|
|
803
746
|
void outerPromise.catch(() => {
|
|
@@ -872,14 +815,12 @@ function createCacheEngine(opts) {
|
|
|
872
815
|
if (skipWrite) return value;
|
|
873
816
|
if (options.skipCacheWhen?.(value)) return value;
|
|
874
817
|
if (options.validate) {
|
|
875
|
-
let isValid = true;
|
|
876
818
|
try {
|
|
877
|
-
|
|
819
|
+
if (!options.validate(value)) return value;
|
|
878
820
|
} catch (err) {
|
|
879
821
|
onError?.(err, { phase: "set", key });
|
|
880
822
|
return value;
|
|
881
823
|
}
|
|
882
|
-
if (!isValid) return value;
|
|
883
824
|
}
|
|
884
825
|
if (value === void 0) {
|
|
885
826
|
if (!undefinedLoaderWarned.has(key)) {
|
|
@@ -916,6 +857,7 @@ function createCacheEngine(opts) {
|
|
|
916
857
|
}
|
|
917
858
|
return {
|
|
918
859
|
storage,
|
|
860
|
+
defaults,
|
|
919
861
|
getOrCompute,
|
|
920
862
|
async tryReadCached(key, opts2) {
|
|
921
863
|
const result = await tryReadCached(key, {
|
|
@@ -1135,47 +1077,6 @@ function deserializeResponse(serialized) {
|
|
|
1135
1077
|
return superjson.deserialize(serialized);
|
|
1136
1078
|
}
|
|
1137
1079
|
|
|
1138
|
-
// src/server/http/in-process-caller.ts
|
|
1139
|
-
var ProcedureInputError = class extends Error {
|
|
1140
|
-
channel;
|
|
1141
|
-
issues;
|
|
1142
|
-
constructor(channel, error) {
|
|
1143
|
-
super(`Invalid ${channel} for in-process procedure call: ${error.message}`);
|
|
1144
|
-
this.name = "ProcedureInputError";
|
|
1145
|
-
this.channel = channel;
|
|
1146
|
-
this.issues = error.issues;
|
|
1147
|
-
}
|
|
1148
|
-
};
|
|
1149
|
-
var ProcedureOutputError = class extends Error {
|
|
1150
|
-
issues;
|
|
1151
|
-
constructor(error) {
|
|
1152
|
-
super(`In-process procedure output failed its response schema: ${error.message}`);
|
|
1153
|
-
this.name = "ProcedureOutputError";
|
|
1154
|
-
this.issues = error.issues;
|
|
1155
|
-
}
|
|
1156
|
-
};
|
|
1157
|
-
function inProcessRequest() {
|
|
1158
|
-
return new Request("theo://in-process/procedure", { method: "POST" });
|
|
1159
|
-
}
|
|
1160
|
-
async function callProcedure(config, input = {}, ctx) {
|
|
1161
|
-
const validated = validateRouteInput(config, input);
|
|
1162
|
-
if (!validated.ok) throw new ProcedureInputError(validated.channel, validated.error);
|
|
1163
|
-
const result = await config.handler({
|
|
1164
|
-
query: validated.query,
|
|
1165
|
-
body: validated.body,
|
|
1166
|
-
params: validated.params,
|
|
1167
|
-
request: inProcessRequest(),
|
|
1168
|
-
ctx
|
|
1169
|
-
});
|
|
1170
|
-
const responseSchema = config.response;
|
|
1171
|
-
if (responseSchema !== void 0 && !(result instanceof Response)) {
|
|
1172
|
-
const parsed = responseSchema.safeParse(result);
|
|
1173
|
-
if (!parsed.success) throw new ProcedureOutputError(parsed.error);
|
|
1174
|
-
return parsed.data;
|
|
1175
|
-
}
|
|
1176
|
-
return result;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
1080
|
// src/server/http/ctx-reconciliation.ts
|
|
1180
1081
|
var CTX_WRITERS = {
|
|
1181
1082
|
/** Writer 1 — user `context.ts` factory. THE typed surface (`TCtx`). execute.ts:131 */
|
|
@@ -1210,6 +1111,7 @@ if (typeof globalThis !== "undefined") {
|
|
|
1210
1111
|
}
|
|
1211
1112
|
}
|
|
1212
1113
|
export {
|
|
1114
|
+
ACTION_SCHEMAS_DIR,
|
|
1213
1115
|
ActionError,
|
|
1214
1116
|
ActionInputError,
|
|
1215
1117
|
ActionScanError,
|
|
@@ -1283,6 +1185,7 @@ export {
|
|
|
1283
1185
|
_resetEnvCache,
|
|
1284
1186
|
_resetKeyCacheForTests,
|
|
1285
1187
|
_resetMiddlewareCacheForTests,
|
|
1188
|
+
_resetRouteScanCacheForTests,
|
|
1286
1189
|
_resetWarnOnceForTests,
|
|
1287
1190
|
action,
|
|
1288
1191
|
appendCookieToHeaders,
|
|
@@ -1297,6 +1200,7 @@ export {
|
|
|
1297
1200
|
callProcedure,
|
|
1298
1201
|
checkThrottle,
|
|
1299
1202
|
clearOidcCache,
|
|
1203
|
+
compareRouteSpecificity,
|
|
1300
1204
|
compilePattern,
|
|
1301
1205
|
compileRouteRules,
|
|
1302
1206
|
composeInstructions,
|
|
@@ -1322,6 +1226,7 @@ export {
|
|
|
1322
1226
|
createRateLimiterWeb,
|
|
1323
1227
|
createRouteRateLimiter,
|
|
1324
1228
|
createRouteRateLimiterWeb,
|
|
1229
|
+
createServerContext,
|
|
1325
1230
|
createSessionManager,
|
|
1326
1231
|
createSessionManagerWeb,
|
|
1327
1232
|
createVendorAgentTool,
|
|
@@ -1344,12 +1249,15 @@ export {
|
|
|
1344
1249
|
deriveKey,
|
|
1345
1250
|
deriveKeyFromRequest,
|
|
1346
1251
|
deserializeResponse,
|
|
1252
|
+
discord,
|
|
1347
1253
|
discoverOidcProvider,
|
|
1348
1254
|
dispatchWebhook,
|
|
1349
1255
|
effectiveContextWindow,
|
|
1350
1256
|
encrypt,
|
|
1351
1257
|
enforceCsrf,
|
|
1352
1258
|
envelopeCodeToStatus,
|
|
1259
|
+
evaluateCsrfMultiHeaderRequest,
|
|
1260
|
+
evaluateRoutePolicy,
|
|
1353
1261
|
executeAction,
|
|
1354
1262
|
executeRoute,
|
|
1355
1263
|
executeWebRequest,
|
|
@@ -1357,6 +1265,7 @@ export {
|
|
|
1357
1265
|
extractTraceId,
|
|
1358
1266
|
extractTraceIdFromRequest,
|
|
1359
1267
|
extractUniversalIssues,
|
|
1268
|
+
extractW3CTraceContext,
|
|
1360
1269
|
findSuggestion,
|
|
1361
1270
|
fromUnknown,
|
|
1362
1271
|
frontmatterValue,
|
|
@@ -1372,6 +1281,7 @@ export {
|
|
|
1372
1281
|
getCookie,
|
|
1373
1282
|
getCookieFromRequest,
|
|
1374
1283
|
getStorageManager,
|
|
1284
|
+
github,
|
|
1375
1285
|
handleBatchRequest,
|
|
1376
1286
|
handleChannelWebhook,
|
|
1377
1287
|
handleCspReport,
|
|
@@ -1384,6 +1294,7 @@ export {
|
|
|
1384
1294
|
initCacheEngine,
|
|
1385
1295
|
isActionError,
|
|
1386
1296
|
isChannelPath,
|
|
1297
|
+
isCsrfOriginAllowed,
|
|
1387
1298
|
isInputError,
|
|
1388
1299
|
jsonTransformer,
|
|
1389
1300
|
levenshtein,
|
|
@@ -1397,6 +1308,7 @@ export {
|
|
|
1397
1308
|
matchDisallowed,
|
|
1398
1309
|
matchRoute,
|
|
1399
1310
|
matchRoutePattern,
|
|
1311
|
+
matchWildcardDomain,
|
|
1400
1312
|
matchesOrigin,
|
|
1401
1313
|
middleware,
|
|
1402
1314
|
normalizeLegacy,
|
|
@@ -1405,6 +1317,7 @@ export {
|
|
|
1405
1317
|
parseCookieHeader,
|
|
1406
1318
|
parseRequestBody,
|
|
1407
1319
|
parseTraceparent,
|
|
1320
|
+
parseTraceparentContext,
|
|
1408
1321
|
pkceChallengeFromVerifier,
|
|
1409
1322
|
plugin,
|
|
1410
1323
|
readAppResource,
|
|
@@ -1412,6 +1325,7 @@ export {
|
|
|
1412
1325
|
recordAttempt,
|
|
1413
1326
|
registerProvider,
|
|
1414
1327
|
requireAuth,
|
|
1328
|
+
requireOwner,
|
|
1415
1329
|
resetProviderRegistry,
|
|
1416
1330
|
resolveAdapter,
|
|
1417
1331
|
resolveProvider,
|
|
@@ -1442,9 +1356,13 @@ export {
|
|
|
1442
1356
|
serveStaticFile,
|
|
1443
1357
|
serverErrorToEnvelope,
|
|
1444
1358
|
setCookie,
|
|
1359
|
+
slack,
|
|
1445
1360
|
splitFrontmatter,
|
|
1446
1361
|
streamAgentTurnInProcess,
|
|
1362
|
+
stripe,
|
|
1363
|
+
subjectFromContext,
|
|
1447
1364
|
superjsonTransformer,
|
|
1365
|
+
telegram,
|
|
1448
1366
|
timingSafeEqual,
|
|
1449
1367
|
tool,
|
|
1450
1368
|
totpUri,
|