@mastra/server-adapters-test-suite 0.1.3-alpha.2 → 0.1.3
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/CHANGELOG.md +24 -0
- package/dist/index.js +132 -81
- package/dist/index.js.map +1 -1
- package/dist/route-test-utils.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @mastra/server-adapters-test-suite
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed run resume and time-travel conflict responses to include a machine-readable code alongside the existing error message across server adapters. HTTP status remains 409, with a JSON body such as: ([#27706](https://github.com/mastra-ai/mastra/pull/27706))
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"error": "Run conflict",
|
|
12
|
+
"code": "AGENT_RESUME_ALREADY_CLAIMED"
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The shared handler exposes these conflict codes: `AGENT_RESUME_ALREADY_CLAIMED`, `WORKFLOW_RESUME_ALREADY_CLAIMED`, `AGENT_RESUME_RUN_NOT_SUSPENDED`, `WORKFLOW_RUN_NOT_SUSPENDED`, `WORKFLOW_TIME_TRAVEL_ALREADY_CLAIMED`, and `WORKFLOW_TIME_TRAVEL_RUN_RUNNING`.
|
|
17
|
+
|
|
18
|
+
- Bump for npm ([#27221](https://github.com/mastra-ai/mastra/pull/27221))
|
|
19
|
+
|
|
20
|
+
- Updated the shared route tests for the thread query route, which now needs thread row support from storage. ([#27678](https://github.com/mastra-ai/mastra/pull/27678))
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`dbde4bf`](https://github.com/mastra-ai/mastra/commit/dbde4bf36ac016abcda61868cc6f792f9d07abee), [`3af753f`](https://github.com/mastra-ai/mastra/commit/3af753fb40a2b8f7ab17b1cf16cd4da7e1b020a6), [`ec84d93`](https://github.com/mastra-ai/mastra/commit/ec84d93cda24d56a0812086fcaace9e68ce8e089), [`6362d32`](https://github.com/mastra-ai/mastra/commit/6362d32a905d32820dcab3b9a039ebc1cec4f444), [`6362d32`](https://github.com/mastra-ai/mastra/commit/6362d32a905d32820dcab3b9a039ebc1cec4f444), [`1c9fd9b`](https://github.com/mastra-ai/mastra/commit/1c9fd9bbdd4258c0d86c89cac6ae68c5023a2590), [`59c02f5`](https://github.com/mastra-ai/mastra/commit/59c02f53955dde397f343f2107060ed70bbe63c5), [`e3678a5`](https://github.com/mastra-ai/mastra/commit/e3678a564cf3bb5922112b4dca65973c5fdc0a92), [`934ec13`](https://github.com/mastra-ai/mastra/commit/934ec1315e8ee4b73067864f56a9fcc8105e8512), [`ad77770`](https://github.com/mastra-ai/mastra/commit/ad777701b62651f8bef64abfc4ea91cef0cd6ac3), [`9b60f12`](https://github.com/mastra-ai/mastra/commit/9b60f12b13b28c9664a839aef435e6d10898644d), [`14f17b8`](https://github.com/mastra-ai/mastra/commit/14f17b86e2b162623bb22942c7930c2113a6d8a1), [`9c4d65f`](https://github.com/mastra-ai/mastra/commit/9c4d65f41ee21e407f0015b0e745881288f69d05), [`48bee02`](https://github.com/mastra-ai/mastra/commit/48bee02e1a5cef20f4da67720191d5e85cdca13c), [`f885386`](https://github.com/mastra-ai/mastra/commit/f885386b79be0e4d784067b0e26608971e0cc788), [`3012dd4`](https://github.com/mastra-ai/mastra/commit/3012dd424b2329eda78381688f1f48244173e6a2), [`915fbe6`](https://github.com/mastra-ai/mastra/commit/915fbe67e974edbeba4dbd3afeaec4d68b34b118), [`f1b596e`](https://github.com/mastra-ai/mastra/commit/f1b596e3219bd8721079611c62b92b8f0f6c12d9), [`d93662b`](https://github.com/mastra-ai/mastra/commit/d93662bfee9313c376cff90e910e05ec9b0634ea), [`871f3c8`](https://github.com/mastra-ai/mastra/commit/871f3c801640148cffa09474fc9f9032495ddccf), [`44e35e4`](https://github.com/mastra-ai/mastra/commit/44e35e47491ad5fd9f771526d5d8c312644000ec), [`9b546e2`](https://github.com/mastra-ai/mastra/commit/9b546e2b9dba91d51769a73ce1a0b34d775b144a), [`336692a`](https://github.com/mastra-ai/mastra/commit/336692a646e28d24b303eefdb8fdbe64e4b4e801), [`41b7f34`](https://github.com/mastra-ai/mastra/commit/41b7f3422a97f1385a285002b7e6f898eb5c7b06), [`f1c68eb`](https://github.com/mastra-ai/mastra/commit/f1c68eb4ae080d8cbbc694ae580850d8fa94dece), [`97f78c3`](https://github.com/mastra-ai/mastra/commit/97f78c3cf104600887e08e94cc073c973bb53c3b), [`e13dddd`](https://github.com/mastra-ai/mastra/commit/e13dddd4f5ac10448cd37009c31efedbf4c40ff4), [`6033024`](https://github.com/mastra-ai/mastra/commit/6033024193441ee88e24b98e9e59de90a6297e6e), [`9c66073`](https://github.com/mastra-ai/mastra/commit/9c66073db33749ab622d54db7e8885f183451ca4), [`6bfe708`](https://github.com/mastra-ai/mastra/commit/6bfe7087fcc27a08c8cba95a45c5da353188bb9c), [`3624981`](https://github.com/mastra-ai/mastra/commit/36249818e7cd0b2904142c6b133cc1ceb756ba68), [`aaedaa6`](https://github.com/mastra-ai/mastra/commit/aaedaa634aa7394789952d4f9fe04b1aec8619a1), [`a92384b`](https://github.com/mastra-ai/mastra/commit/a92384bf9093beb9071953292a936ca722370ce5), [`a8f9157`](https://github.com/mastra-ai/mastra/commit/a8f9157fafe38f5acf68e37c8874ebd192ef8e10), [`79fd3b0`](https://github.com/mastra-ai/mastra/commit/79fd3b06a7cf59f7acb4591b9ba0f388d548fd17), [`04ded0b`](https://github.com/mastra-ai/mastra/commit/04ded0b7409b39008a1e4611c412ee80ee20993d), [`f28b72f`](https://github.com/mastra-ai/mastra/commit/f28b72f255a460746f08c73b2a1d336bfc57757b), [`90dca88`](https://github.com/mastra-ai/mastra/commit/90dca88f44f31428a0e585584114b56f0bec477b), [`1874bf2`](https://github.com/mastra-ai/mastra/commit/1874bf2a5ba304f22ffb93f9ec5a9afea000a5a1), [`4e6701a`](https://github.com/mastra-ai/mastra/commit/4e6701a8534e29fad29c7fe4c6787dc1ed56b419), [`a3f8ac0`](https://github.com/mastra-ai/mastra/commit/a3f8ac03c7526248e585f3e4e87b349566dd4797), [`022e6cf`](https://github.com/mastra-ai/mastra/commit/022e6cf06fdc891a6318f16db304be8fe75b7f72), [`d8fb857`](https://github.com/mastra-ai/mastra/commit/d8fb857bda2c23a08e535291a638fbc6e3a4e073), [`6c67158`](https://github.com/mastra-ai/mastra/commit/6c67158a10406adae195887167862d632bb54d64), [`26e684b`](https://github.com/mastra-ai/mastra/commit/26e684b1f152d341c2dca01c5347fea7e8762188), [`d8bfd3d`](https://github.com/mastra-ai/mastra/commit/d8bfd3d502dd9952db66f0c4f53cd04f5c8e71ef), [`ace1e35`](https://github.com/mastra-ai/mastra/commit/ace1e35d5762f96976a2cba958283edda71fcc3b), [`f905746`](https://github.com/mastra-ai/mastra/commit/f905746159def2d386dca516657123f43ef90e24), [`b77f59c`](https://github.com/mastra-ai/mastra/commit/b77f59cc5407b1158a271d579b55514f2ba79145), [`776bb6e`](https://github.com/mastra-ai/mastra/commit/776bb6e2b3ed9ec32e5430332ee756185fcebb68), [`2d0a3b0`](https://github.com/mastra-ai/mastra/commit/2d0a3b06d0880036c0dbd4b1fcf782d1f5115a56), [`ad8e752`](https://github.com/mastra-ai/mastra/commit/ad8e75217bcbb12986e7e77a30cb4af1be93c0fd), [`ba744e5`](https://github.com/mastra-ai/mastra/commit/ba744e5347d7d373b89233f1b8beddb5bdf5b2c3), [`4471372`](https://github.com/mastra-ai/mastra/commit/4471372b0338523a2f57407a90b1d913e68f17cc), [`5131dad`](https://github.com/mastra-ai/mastra/commit/5131dadf8c2db8641030111203db6c16fe3240f2), [`58db748`](https://github.com/mastra-ai/mastra/commit/58db74858beae6ff20ff22786c968386b9d3edcc), [`8c2d516`](https://github.com/mastra-ai/mastra/commit/8c2d5164714a27e720d898da612da6054a88ef91), [`871f3c8`](https://github.com/mastra-ai/mastra/commit/871f3c801640148cffa09474fc9f9032495ddccf), [`7425858`](https://github.com/mastra-ai/mastra/commit/74258589417e9e91114c64571a67702d2e352b3f), [`0e9a577`](https://github.com/mastra-ai/mastra/commit/0e9a5774151385c93524883e2b1bea40e2a644de), [`fd98055`](https://github.com/mastra-ai/mastra/commit/fd98055302882876b8dc5ae03649a89a72e2ac6c), [`f81d7cb`](https://github.com/mastra-ai/mastra/commit/f81d7cb89f122e1c01729a917c70ca62d6c51216), [`b2c91db`](https://github.com/mastra-ai/mastra/commit/b2c91dbd2d32e18cd114d87301fc3b8182fddb10), [`c111a5b`](https://github.com/mastra-ai/mastra/commit/c111a5bfa2a7a197f30700ce238c84ee799df140), [`a97ba85`](https://github.com/mastra-ai/mastra/commit/a97ba8578a2dc91a16d945276ca8c7a4ad32e38a), [`f6a9762`](https://github.com/mastra-ai/mastra/commit/f6a9762b12ae9dad6a154f73ed3099a2ee472d0c), [`fa5a031`](https://github.com/mastra-ai/mastra/commit/fa5a0316dbd5f68316b48c426fd904d2d80d9045), [`14b2a7c`](https://github.com/mastra-ai/mastra/commit/14b2a7c56da4329f7fd17738056a081663deed46), [`750a4ed`](https://github.com/mastra-ai/mastra/commit/750a4edf7826da9ba7321682912504c60f29712d), [`e5b6877`](https://github.com/mastra-ai/mastra/commit/e5b6877fbdb471485b99019eb50046b44e778aae), [`c236d64`](https://github.com/mastra-ai/mastra/commit/c236d64974c68e6c0f9bf6e3d6442e0184c5f49e), [`fc96794`](https://github.com/mastra-ai/mastra/commit/fc9679466bede4ca3e014aea48a72fd950a13d2a), [`e5b6877`](https://github.com/mastra-ai/mastra/commit/e5b6877fbdb471485b99019eb50046b44e778aae), [`85a26af`](https://github.com/mastra-ai/mastra/commit/85a26af75fe62b7f2d8ac0b56d322798e5ae0616), [`5758ba0`](https://github.com/mastra-ai/mastra/commit/5758ba045b01c407a7414b32dbbdf5480596b31d), [`fc96794`](https://github.com/mastra-ai/mastra/commit/fc9679466bede4ca3e014aea48a72fd950a13d2a), [`7704aa1`](https://github.com/mastra-ai/mastra/commit/7704aa18b657ba89ddbf91bf193bb3dfbb56c5f2), [`8271439`](https://github.com/mastra-ai/mastra/commit/8271439b491f5f777590abfda9a0ac7f1e3212c2), [`44e35e4`](https://github.com/mastra-ai/mastra/commit/44e35e47491ad5fd9f771526d5d8c312644000ec), [`7337dac`](https://github.com/mastra-ai/mastra/commit/7337dac8aad8d70e98a4b0c7caa677c01966b53b), [`f51c0af`](https://github.com/mastra-ai/mastra/commit/f51c0afdd1b181b84e294f8613185494a8aaec3c), [`5f70db1`](https://github.com/mastra-ai/mastra/commit/5f70db1f3b5b38a27438d1c153db352d2bc8de30), [`179964b`](https://github.com/mastra-ai/mastra/commit/179964b95aacac31763a4a1aa2f2d1c652aa529d), [`7afee18`](https://github.com/mastra-ai/mastra/commit/7afee18a3d91ce125f08ffd6e2724695e8a68652), [`ca1b2f2`](https://github.com/mastra-ai/mastra/commit/ca1b2f25d7c69c6e90b719baef32ffb1db6c5681), [`12991bd`](https://github.com/mastra-ai/mastra/commit/12991bd0945ca36e13b213ebcbfaf0880d04d44d), [`0ac6a2a`](https://github.com/mastra-ai/mastra/commit/0ac6a2a4ab19f294b5362bcdf9c8ae9e3d8a3ede), [`b8fe2ae`](https://github.com/mastra-ai/mastra/commit/b8fe2aec651efeaad6d607d816565453a341cdef), [`22df9d7`](https://github.com/mastra-ai/mastra/commit/22df9d76651b3b4d513388a7eae8e51dbfb36a1b), [`f54f8b2`](https://github.com/mastra-ai/mastra/commit/f54f8b2df2aa24e1ef4d171c733576e7c62bb1b0), [`f54f8b2`](https://github.com/mastra-ai/mastra/commit/f54f8b2df2aa24e1ef4d171c733576e7c62bb1b0), [`f54f8b2`](https://github.com/mastra-ai/mastra/commit/f54f8b2df2aa24e1ef4d171c733576e7c62bb1b0), [`f54f8b2`](https://github.com/mastra-ai/mastra/commit/f54f8b2df2aa24e1ef4d171c733576e7c62bb1b0), [`6309939`](https://github.com/mastra-ai/mastra/commit/63099393563cc177960862c9179c4e2420acac5f), [`f6260f8`](https://github.com/mastra-ai/mastra/commit/f6260f8cc50c21a5d78d47fff4e04e55aca57a08), [`9cb6843`](https://github.com/mastra-ai/mastra/commit/9cb6843a8a39ab2e12498b0c08c9f4cdcefd9cea), [`0971298`](https://github.com/mastra-ai/mastra/commit/0971298317be971ae1c3f0c1d949a31df7d71c7f), [`a0c031c`](https://github.com/mastra-ai/mastra/commit/a0c031ceb671721b6f8557726e216ee81d23612e), [`72cb1e2`](https://github.com/mastra-ai/mastra/commit/72cb1e2b9453f7bb1bd08e4f9aa54da56fa20600), [`b2c91db`](https://github.com/mastra-ai/mastra/commit/b2c91dbd2d32e18cd114d87301fc3b8182fddb10), [`a3be51b`](https://github.com/mastra-ai/mastra/commit/a3be51b1a545b45bfb04377699edecbb8a8d79d6), [`bcfb6af`](https://github.com/mastra-ai/mastra/commit/bcfb6af5a61d79f6902e87d3a8fa70283f48705d), [`03868f8`](https://github.com/mastra-ai/mastra/commit/03868f840401865af433040ba7ff90f585dea2e1), [`368149c`](https://github.com/mastra-ai/mastra/commit/368149c27954f6d578d3561cc1801cb415b78aa7), [`fdf475d`](https://github.com/mastra-ai/mastra/commit/fdf475dbc8974e1ae21966e5e96e316a7beebdf7), [`2725bd7`](https://github.com/mastra-ai/mastra/commit/2725bd73fa27f231e30bce7c6a03c651bc15b408), [`b491b7d`](https://github.com/mastra-ai/mastra/commit/b491b7da8b0a9cd4dca18afd54116c7060e2b5c3), [`9277d8e`](https://github.com/mastra-ai/mastra/commit/9277d8ef26ad2f08bfbae89d78d409fb91c95c8d), [`0611d4a`](https://github.com/mastra-ai/mastra/commit/0611d4a060696da5c3c550b07451d870d4af0f58), [`eb0b702`](https://github.com/mastra-ai/mastra/commit/eb0b702e9939f02073fb1c4dfd7eaa51fde59e0b), [`e41478c`](https://github.com/mastra-ai/mastra/commit/e41478cbb7ab108cf7f704a6f0f4092ec4374e21), [`323b021`](https://github.com/mastra-ai/mastra/commit/323b0212bc57c2b9acaed2716812a873c0fa43ee), [`78b3ef7`](https://github.com/mastra-ai/mastra/commit/78b3ef7cb120f2b366a39d7095ece5f0ec7d3f71), [`0eb8311`](https://github.com/mastra-ai/mastra/commit/0eb8311f9ecf254c96179e99dc145d6df3cccd07), [`ba7b0ea`](https://github.com/mastra-ai/mastra/commit/ba7b0eac045755d39d20dcf3a943ea5f8270b009), [`9b546e2`](https://github.com/mastra-ai/mastra/commit/9b546e2b9dba91d51769a73ce1a0b34d775b144a), [`e8d7f8e`](https://github.com/mastra-ai/mastra/commit/e8d7f8e52da32b05f2e8501c1127128ae1a5d450), [`d93662b`](https://github.com/mastra-ai/mastra/commit/d93662bfee9313c376cff90e910e05ec9b0634ea), [`0e5d045`](https://github.com/mastra-ai/mastra/commit/0e5d045be4ab67d1fba5eeb8125bc2ec43aa9519), [`0e4fa4f`](https://github.com/mastra-ai/mastra/commit/0e4fa4f0604bb2e6e63e5d1d203b2dcadd646a81), [`c397dff`](https://github.com/mastra-ai/mastra/commit/c397dff0ee0662b56f348852ad08aff820239d66), [`92034fa`](https://github.com/mastra-ai/mastra/commit/92034fa2a46a4f45af416c3201752342ead71d89), [`b2c91db`](https://github.com/mastra-ai/mastra/commit/b2c91dbd2d32e18cd114d87301fc3b8182fddb10), [`e4cd1d1`](https://github.com/mastra-ai/mastra/commit/e4cd1d13de8bcb14d8d0a8531f7b96fcbb138217), [`370f159`](https://github.com/mastra-ai/mastra/commit/370f159e96f1e630cd51d06a9e3a7a0a6659c465), [`4e44e7f`](https://github.com/mastra-ai/mastra/commit/4e44e7f518debb3b0aebc5ad71ea3e4a3902d8c9), [`b03ee08`](https://github.com/mastra-ai/mastra/commit/b03ee089c70c087cdc9d1d0a85aa749621ad5a3c), [`0f1d83f`](https://github.com/mastra-ai/mastra/commit/0f1d83fed073613869d6283adb198b934ef80093), [`7aa0361`](https://github.com/mastra-ai/mastra/commit/7aa036142ca476b1f1e18a220f826e73ca58c38a), [`cd864ca`](https://github.com/mastra-ai/mastra/commit/cd864ca5d1fa6cb3477cb8a87b79070febbb3b6b), [`e3678a5`](https://github.com/mastra-ai/mastra/commit/e3678a564cf3bb5922112b4dca65973c5fdc0a92), [`d95a821`](https://github.com/mastra-ai/mastra/commit/d95a821e903f7883b5fadfee5c7f59809d66cfb8), [`d95a821`](https://github.com/mastra-ai/mastra/commit/d95a821e903f7883b5fadfee5c7f59809d66cfb8), [`98c7e10`](https://github.com/mastra-ai/mastra/commit/98c7e109fca4995d19d7eb132fdb8411c860b151), [`e35e335`](https://github.com/mastra-ai/mastra/commit/e35e335f19ee0c7c1e03bf247aebd24c3e041459), [`e35e335`](https://github.com/mastra-ai/mastra/commit/e35e335f19ee0c7c1e03bf247aebd24c3e041459), [`e3678a5`](https://github.com/mastra-ai/mastra/commit/e3678a564cf3bb5922112b4dca65973c5fdc0a92), [`50b7bfc`](https://github.com/mastra-ai/mastra/commit/50b7bfc5ff19285e065f7202e26b5d6796f660f4), [`3c2c033`](https://github.com/mastra-ai/mastra/commit/3c2c033aa68cd8cd7e4c630abd7f1bfeb440f457), [`425d383`](https://github.com/mastra-ai/mastra/commit/425d383d4fb15e55e9491b6bdaebb57f2de7cdc8), [`5d8f8b7`](https://github.com/mastra-ai/mastra/commit/5d8f8b78460350d581e8a92412cdfe88b4ce76bc), [`5d5ea03`](https://github.com/mastra-ai/mastra/commit/5d5ea032a4c64cefe5bc217f4cc761a9364ccbf4), [`5d8f8b7`](https://github.com/mastra-ai/mastra/commit/5d8f8b78460350d581e8a92412cdfe88b4ce76bc), [`fae54c5`](https://github.com/mastra-ai/mastra/commit/fae54c57917cd1f527937ca42b5ab7dfe1d55a2a), [`d7c012f`](https://github.com/mastra-ai/mastra/commit/d7c012fcc98a18552e0aef55f9c0d19fccad57da), [`b0f7f91`](https://github.com/mastra-ai/mastra/commit/b0f7f91eb667f15e188b861759b4c4a5761ec233), [`958d170`](https://github.com/mastra-ai/mastra/commit/958d170c218a0e050c0c4807a94ce1f67f00e570), [`ba7d4e5`](https://github.com/mastra-ai/mastra/commit/ba7d4e5c9759a164279c7ebdbe2b7a32ae94b4ce), [`8b36444`](https://github.com/mastra-ai/mastra/commit/8b36444dbbc6916d298015c2586fbbde2e9b265f), [`3f68324`](https://github.com/mastra-ai/mastra/commit/3f68324e72f03bbc7d918d23013f550527f59c40), [`bfd35f6`](https://github.com/mastra-ai/mastra/commit/bfd35f64178f06774c95dabec4a796245cf8a401), [`0b5eaa0`](https://github.com/mastra-ai/mastra/commit/0b5eaa07445a6551481ab6ceadef603b020a099b), [`12407df`](https://github.com/mastra-ai/mastra/commit/12407df9e6bd2f82cd27533bd4a9aa8057b97f2e), [`f122808`](https://github.com/mastra-ai/mastra/commit/f1228088b6f60f6c7ef9db8b9aca70bc5cf9f00c), [`8c05e78`](https://github.com/mastra-ai/mastra/commit/8c05e78b099b26daf4bfa9b229190201c8bf581d), [`9620613`](https://github.com/mastra-ai/mastra/commit/96206136bcc184e6238bd6dd5627fe28254eec0b), [`cc977b4`](https://github.com/mastra-ai/mastra/commit/cc977b4ce7def6727cdd63af3478d2b8b83daf07), [`c36b9e7`](https://github.com/mastra-ai/mastra/commit/c36b9e7129b355211ed9e7a3b7df2d7b81c01c05), [`c82558f`](https://github.com/mastra-ai/mastra/commit/c82558f2e5eedb493afff46f940ab7f3c085d57f), [`100431b`](https://github.com/mastra-ai/mastra/commit/100431b965dba5d32d282cfcd3c0415013cc0eed), [`7a0aea2`](https://github.com/mastra-ai/mastra/commit/7a0aea28af3bcf879a75b5bcdbfc3d471f63c565), [`a0471fe`](https://github.com/mastra-ai/mastra/commit/a0471fefaf92a44b44f5fb23e607fdad087e51f2), [`3012dd4`](https://github.com/mastra-ai/mastra/commit/3012dd424b2329eda78381688f1f48244173e6a2), [`e0077c3`](https://github.com/mastra-ai/mastra/commit/e0077c34070037ac77c264a9d5000a69c0dd2095), [`f9e22cc`](https://github.com/mastra-ai/mastra/commit/f9e22cc6fa264ded4a95ab34dab84b6ce12c2597), [`e41478c`](https://github.com/mastra-ai/mastra/commit/e41478cbb7ab108cf7f704a6f0f4092ec4374e21), [`fed802d`](https://github.com/mastra-ai/mastra/commit/fed802d6e4e395d9ba42a1122c2468a072407b1c), [`6889aa2`](https://github.com/mastra-ai/mastra/commit/6889aa29d661a8892f503e37bc3d8ffe18aa7e37), [`bde069a`](https://github.com/mastra-ai/mastra/commit/bde069ac2f610abd5a09bcdb511ed04f5f01437e), [`7f4a1ca`](https://github.com/mastra-ai/mastra/commit/7f4a1ca724829e0a732eea6afb285f15908df8e9), [`d0251e3`](https://github.com/mastra-ai/mastra/commit/d0251e34973492c60e4dc7614116fcf912739875), [`680d914`](https://github.com/mastra-ai/mastra/commit/680d9141c851e8eb6fcd2d3c3fbadf05a0f1011d), [`ae74f81`](https://github.com/mastra-ai/mastra/commit/ae74f812d75034a90d647739062b9c2ca84b4ed6), [`b23b87b`](https://github.com/mastra-ai/mastra/commit/b23b87b8ab849cdc9f58b297d667c0bbaed0b62f), [`8c90438`](https://github.com/mastra-ai/mastra/commit/8c90438b404d27593927eccc47616aab4a35006e), [`a7bfa1f`](https://github.com/mastra-ai/mastra/commit/a7bfa1ff7c592f368cf34be472c7d89e03b0098b), [`f42951a`](https://github.com/mastra-ai/mastra/commit/f42951afb1d2c2a2148100a54b6ec10d473c9591), [`c8035a4`](https://github.com/mastra-ai/mastra/commit/c8035a49ae2af692d812dace394ac64635f5fd1d), [`1980959`](https://github.com/mastra-ai/mastra/commit/1980959335396f8ee72558689623abf3e205b31b), [`fa409d4`](https://github.com/mastra-ai/mastra/commit/fa409d430b879e45d433497439c0c11d2a3fafd6), [`0876fa8`](https://github.com/mastra-ai/mastra/commit/0876fa827a9685022fb0dc1606cbb673dffcaf95), [`f81d7cb`](https://github.com/mastra-ai/mastra/commit/f81d7cb89f122e1c01729a917c70ca62d6c51216), [`78cbed0`](https://github.com/mastra-ai/mastra/commit/78cbed0e0ed27b74d9b3b767566b21d513cddd53), [`beb81d3`](https://github.com/mastra-ai/mastra/commit/beb81d355b4a8e472ac411f33aa0d4854cb8662b), [`f99e0e5`](https://github.com/mastra-ai/mastra/commit/f99e0e5db6012fbdcd8eac8a32d762b2a1d56b5e), [`16d8f44`](https://github.com/mastra-ai/mastra/commit/16d8f44e3a1486d7319c1baeca6115d37f6c4cea)]:
|
|
23
|
+
- @mastra/core@1.79.0
|
|
24
|
+
- @mastra/server@1.79.0
|
|
25
|
+
- @mastra/mcp@2.5.0
|
|
26
|
+
|
|
3
27
|
## 0.1.3-alpha.2
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -59,6 +59,7 @@ function getRouteSpecificSchemaDefaults(route) {
|
|
|
59
59
|
predicateScope: "trace",
|
|
60
60
|
path: "entityName"
|
|
61
61
|
} };
|
|
62
|
+
if (route.path === "/agent-controller/:controllerId/sessions" && route.method === "POST") return { body: { resourceId: "test-resource" } };
|
|
62
63
|
if (route.path === "/datasets/:datasetId/compare") return { body: {
|
|
63
64
|
experimentIds: ["test-experiment-a", "test-experiment-b"],
|
|
64
65
|
baselineId: "test-experiment-a"
|
|
@@ -136,8 +137,10 @@ function generateValidDataFromSchema(schema, fieldName) {
|
|
|
136
137
|
def = getZodDef(schema);
|
|
137
138
|
}
|
|
138
139
|
if (typeName === "ZodOptional" || typeName === "ZodNullable") return generateValidDataFromSchema(def.innerType, fieldName);
|
|
139
|
-
if (typeName === "ZodDefault")
|
|
140
|
-
|
|
140
|
+
if (typeName === "ZodDefault") {
|
|
141
|
+
if ("_zod" in schema) return def.defaultValue;
|
|
142
|
+
else return def.defaultValue();
|
|
143
|
+
}
|
|
141
144
|
if (typeName === "ZodString") {
|
|
142
145
|
if ((def.checks ?? []).some((check) => {
|
|
143
146
|
const checkDef = check._zod?.def ?? check.def ?? check;
|
|
@@ -235,13 +238,19 @@ function generateValidDataFromSchema(schema, fieldName) {
|
|
|
235
238
|
if (typeName === "ZodUndefined") return void 0;
|
|
236
239
|
if (typeName === "ZodDate") return /* @__PURE__ */ new Date();
|
|
237
240
|
if (typeName === "ZodBigInt") return BigInt(0);
|
|
238
|
-
if (typeName === "ZodLiteral")
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
241
|
+
if (typeName === "ZodLiteral") {
|
|
242
|
+
if ("_zod" in schema) return def.values?.[0];
|
|
243
|
+
else return def.value;
|
|
244
|
+
}
|
|
245
|
+
if (typeName === "ZodEnum") {
|
|
246
|
+
if ("_zod" in schema) return Object.values(def.entries)[0];
|
|
247
|
+
else return def.values[0];
|
|
248
|
+
}
|
|
242
249
|
if (typeName === "ZodNativeEnum") return Object.values(def.values)[0];
|
|
243
|
-
if (typeName === "ZodArray")
|
|
244
|
-
|
|
250
|
+
if (typeName === "ZodArray") {
|
|
251
|
+
if ("_zod" in schema) return [generateValidDataFromSchema(def.element, fieldName)];
|
|
252
|
+
else return [generateValidDataFromSchema(def.type, fieldName)];
|
|
253
|
+
}
|
|
245
254
|
if (typeName === "ZodObject") {
|
|
246
255
|
const shape = typeof def.shape === "function" ? def.shape() : def.shape;
|
|
247
256
|
const obj = {};
|
|
@@ -309,6 +318,7 @@ function getDefaultValidPathParams(route) {
|
|
|
309
318
|
if (route.path.includes(":controllerId")) params.controllerId = "test-controller";
|
|
310
319
|
if (route.path.includes(":responseId")) params.responseId = "test-response";
|
|
311
320
|
if (route.path.includes(":resourceId")) params.resourceId = "test-resource";
|
|
321
|
+
if (route.path.includes(":sessionId")) params.sessionId = "test-session";
|
|
312
322
|
if (route.path.includes(":modelConfigId")) params.modelConfigId = "id1";
|
|
313
323
|
if (route.path.includes(":scorerId") && route.path.includes("/stored/scorers/")) params.scorerId = "test-stored-scorer";
|
|
314
324
|
else if (route.path.includes(":scorerId")) params.scorerId = "test-scorer";
|
|
@@ -432,7 +442,8 @@ function createRouteTestSuite(config) {
|
|
|
432
442
|
});
|
|
433
443
|
});
|
|
434
444
|
routes.forEach((route) => {
|
|
435
|
-
|
|
445
|
+
const routeKey = `${route.method} ${route.path}`;
|
|
446
|
+
describe(routeKey, () => {
|
|
436
447
|
if (route.deprecated) {
|
|
437
448
|
it("should be marked as deprecated", () => {
|
|
438
449
|
expect(route.deprecated).toBe(true);
|
|
@@ -784,9 +795,7 @@ async function createDefaultTestContext() {
|
|
|
784
795
|
case "multiply":
|
|
785
796
|
result = a * b;
|
|
786
797
|
break;
|
|
787
|
-
case "divide":
|
|
788
|
-
result = b !== 0 ? a / b : Infinity;
|
|
789
|
-
break;
|
|
798
|
+
case "divide": result = b !== 0 ? a / b : Infinity;
|
|
790
799
|
}
|
|
791
800
|
return { result };
|
|
792
801
|
}
|
|
@@ -1338,9 +1347,10 @@ Follow these instructions for the test skill.
|
|
|
1338
1347
|
installedAt: (/* @__PURE__ */ new Date("2024-01-01T00:00:00.000Z")).toISOString()
|
|
1339
1348
|
};
|
|
1340
1349
|
fs.writeFileSync(path.join(agentSkillsDir, ".meta.json"), JSON.stringify(metaJson, null, 2));
|
|
1350
|
+
const filesystem = new LocalFilesystem({ basePath: tempDir });
|
|
1341
1351
|
const workspace = new Workspace({
|
|
1342
1352
|
id: "test-workspace",
|
|
1343
|
-
filesystem
|
|
1353
|
+
filesystem,
|
|
1344
1354
|
skills: ["skills"],
|
|
1345
1355
|
bm25: true
|
|
1346
1356
|
});
|
|
@@ -1364,7 +1374,8 @@ function createTestTool(overrides = {}) {
|
|
|
1364
1374
|
* Following the pattern from handler tests - uses actual MockMemory implementation
|
|
1365
1375
|
*/
|
|
1366
1376
|
function createMockMemory() {
|
|
1367
|
-
const
|
|
1377
|
+
const storage = new InMemoryStore();
|
|
1378
|
+
const mockMemory = new MockMemory({ storage });
|
|
1368
1379
|
mockMemory.__registerMastra = vi.fn();
|
|
1369
1380
|
return mockMemory;
|
|
1370
1381
|
}
|
|
@@ -1833,7 +1844,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
1833
1844
|
expect(response.status).toBe(200);
|
|
1834
1845
|
const data = response.data;
|
|
1835
1846
|
expect(data.filter).toEqual({ status: "active" });
|
|
1836
|
-
|
|
1847
|
+
const tags = Array.isArray(data.tag) ? data.tag : [data.tag];
|
|
1848
|
+
expect(tags).toContain("b");
|
|
1837
1849
|
expect(data.keys).not.toContain("__proto__");
|
|
1838
1850
|
expect(data.keys).not.toContain("constructor");
|
|
1839
1851
|
expect(data.keys).not.toContain("prototype");
|
|
@@ -2104,7 +2116,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2104
2116
|
Object.entries(deprecatedByCategory).forEach(([category, routes]) => {
|
|
2105
2117
|
describe(category, () => {
|
|
2106
2118
|
routes.forEach((route) => {
|
|
2107
|
-
|
|
2119
|
+
const testName = `${route.method} ${route.path}`;
|
|
2120
|
+
describe(testName, () => {
|
|
2108
2121
|
it("should be marked as deprecated", () => {
|
|
2109
2122
|
expect(route.deprecated).toBe(true);
|
|
2110
2123
|
expect(route.openapi?.deprecated).toBe(true);
|
|
@@ -2164,7 +2177,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2164
2177
|
Object.entries(routesByCategory).forEach(([category, routes]) => {
|
|
2165
2178
|
describe(category, () => {
|
|
2166
2179
|
routes.forEach((route) => {
|
|
2167
|
-
|
|
2180
|
+
const testName = `${route.method} ${route.path}`;
|
|
2181
|
+
describe(testName, () => {
|
|
2168
2182
|
it("should execute with valid request", async () => {
|
|
2169
2183
|
const request = buildRouteRequest(route);
|
|
2170
2184
|
const httpRequest = {
|
|
@@ -2199,7 +2213,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2199
2213
|
query: request.query,
|
|
2200
2214
|
body: request.body
|
|
2201
2215
|
};
|
|
2202
|
-
|
|
2216
|
+
const response = await executeHttpRequest(app, httpRequest);
|
|
2217
|
+
expect(response.status).toBe(404);
|
|
2203
2218
|
});
|
|
2204
2219
|
if (route.path.includes(":workflowId")) it("should return 404 when workflow not found", async () => {
|
|
2205
2220
|
const request = buildRouteRequest(route, { pathParams: { workflowId: "non-existent-workflow" } });
|
|
@@ -2209,7 +2224,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2209
2224
|
query: request.query,
|
|
2210
2225
|
body: request.body
|
|
2211
2226
|
};
|
|
2212
|
-
|
|
2227
|
+
const response = await executeHttpRequest(app, httpRequest);
|
|
2228
|
+
expect(response.status).toBe(404);
|
|
2213
2229
|
});
|
|
2214
2230
|
if (route.path.includes(":backgroundTaskId")) it("should return 404 when background task not found", async () => {
|
|
2215
2231
|
const request = buildRouteRequest(route, { pathParams: { backgroundTaskId: "non-existent-background-task" } });
|
|
@@ -2219,7 +2235,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2219
2235
|
query: request.query,
|
|
2220
2236
|
body: request.body
|
|
2221
2237
|
};
|
|
2222
|
-
|
|
2238
|
+
const response = await executeHttpRequest(app, httpRequest);
|
|
2239
|
+
expect(response.status).toBe(404);
|
|
2223
2240
|
});
|
|
2224
2241
|
if (route.path.includes(":serverId")) it("should return 404 when MCP server not found (via :serverId)", async () => {
|
|
2225
2242
|
const request = buildRouteRequest(route, { pathParams: { serverId: "non-existent-server" } });
|
|
@@ -2229,7 +2246,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2229
2246
|
query: request.query,
|
|
2230
2247
|
body: request.body
|
|
2231
2248
|
};
|
|
2232
|
-
|
|
2249
|
+
const response = await executeHttpRequest(app, httpRequest);
|
|
2250
|
+
expect(response.status).toBe(404);
|
|
2233
2251
|
});
|
|
2234
2252
|
if (route.path.includes("/mcp/v0/servers/:id")) it("should return 404 when MCP server not found (via :id)", async () => {
|
|
2235
2253
|
const request = buildRouteRequest(route, { pathParams: { id: "non-existent-server" } });
|
|
@@ -2239,7 +2257,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2239
2257
|
query: request.query,
|
|
2240
2258
|
body: request.body
|
|
2241
2259
|
};
|
|
2242
|
-
|
|
2260
|
+
const response = await executeHttpRequest(app, httpRequest);
|
|
2261
|
+
expect(response.status).toBe(404);
|
|
2243
2262
|
});
|
|
2244
2263
|
if (route.path.includes(":processorId")) it("should return 404 when processor not found", async () => {
|
|
2245
2264
|
const request = buildRouteRequest(route, { pathParams: { processorId: "non-existent-processor" } });
|
|
@@ -2249,7 +2268,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2249
2268
|
query: request.query,
|
|
2250
2269
|
body: request.body
|
|
2251
2270
|
};
|
|
2252
|
-
|
|
2271
|
+
const response = await executeHttpRequest(app, httpRequest);
|
|
2272
|
+
expect(response.status).toBe(404);
|
|
2253
2273
|
});
|
|
2254
2274
|
if (route.responseType === "stream") it("should be consumable via stream reader", async () => {
|
|
2255
2275
|
const request = buildRouteRequest(route);
|
|
@@ -2264,9 +2284,13 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2264
2284
|
expect(response.stream).toBeDefined();
|
|
2265
2285
|
if (typeof response.stream.getReader === "function") {
|
|
2266
2286
|
const reader = response.stream.getReader();
|
|
2267
|
-
|
|
2287
|
+
const firstChunk = await reader.read();
|
|
2288
|
+
expect(firstChunk).toBeDefined();
|
|
2268
2289
|
reader.releaseLock();
|
|
2269
|
-
} else if (typeof response.stream[Symbol.asyncIterator] === "function")
|
|
2290
|
+
} else if (typeof response.stream[Symbol.asyncIterator] === "function") {
|
|
2291
|
+
const firstChunk = await response.stream[Symbol.asyncIterator]().next();
|
|
2292
|
+
expect(firstChunk).toBeDefined();
|
|
2293
|
+
}
|
|
2270
2294
|
});
|
|
2271
2295
|
if (route.queryParamSchema || route.bodySchema) it("should return 400 when schema validation fails", async () => {
|
|
2272
2296
|
const request = buildRouteRequest(route);
|
|
@@ -2323,7 +2347,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2323
2347
|
}
|
|
2324
2348
|
}
|
|
2325
2349
|
};
|
|
2326
|
-
|
|
2350
|
+
const response = await executeHttpRequest(app, httpRequest);
|
|
2351
|
+
expect(response.status).toBeLessThan(500);
|
|
2327
2352
|
});
|
|
2328
2353
|
const bodySchema = route.bodySchema;
|
|
2329
2354
|
if (["POST", "PUT"].includes(route.method) && bodySchema) it("should spread body fields to handler params", async () => {
|
|
@@ -2384,7 +2409,8 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2384
2409
|
expect(response.type).toBe("json");
|
|
2385
2410
|
const errorData = response.data;
|
|
2386
2411
|
expect(errorData).toBeDefined();
|
|
2387
|
-
|
|
2412
|
+
const hasErrorField = errorData.error !== void 0 || errorData.message !== void 0 || errorData.details !== void 0 || errorData.statusCode !== void 0;
|
|
2413
|
+
expect(hasErrorField).toBe(true);
|
|
2388
2414
|
});
|
|
2389
2415
|
});
|
|
2390
2416
|
SERVER_ROUTES.filter((r) => r.method === "POST" && r.bodySchema && !isExcluded(r)).forEach((route) => {
|
|
@@ -2545,38 +2571,43 @@ function createRouteAdapterTestSuite(config) {
|
|
|
2545
2571
|
describe("Route Prefix", () => {
|
|
2546
2572
|
it("should register routes at prefixed paths without double /api", async () => {
|
|
2547
2573
|
const prefixedApp = (await setupAdapter(context, { prefix: "/v2" })).app;
|
|
2548
|
-
|
|
2574
|
+
const response = await executeHttpRequest(prefixedApp, {
|
|
2549
2575
|
method: "GET",
|
|
2550
2576
|
path: "/v2/agents"
|
|
2551
|
-
})
|
|
2577
|
+
});
|
|
2578
|
+
expect(response.status).toBeLessThan(400);
|
|
2552
2579
|
});
|
|
2553
2580
|
it("should not have routes at double /api path when prefix is set", async () => {
|
|
2554
2581
|
const prefixedApp = (await setupAdapter(context, { prefix: "/v2" })).app;
|
|
2555
|
-
|
|
2582
|
+
const response = await executeHttpRequest(prefixedApp, {
|
|
2556
2583
|
method: "GET",
|
|
2557
2584
|
path: "/v2/api/agents"
|
|
2558
|
-
})
|
|
2585
|
+
});
|
|
2586
|
+
expect(response.status).toBe(404);
|
|
2559
2587
|
});
|
|
2560
2588
|
it("should normalize prefix with trailing slash", async () => {
|
|
2561
2589
|
const prefixedApp = (await setupAdapter(context, { prefix: "/mastra/" })).app;
|
|
2562
|
-
|
|
2590
|
+
const response = await executeHttpRequest(prefixedApp, {
|
|
2563
2591
|
method: "GET",
|
|
2564
2592
|
path: "/mastra/agents"
|
|
2565
|
-
})
|
|
2593
|
+
});
|
|
2594
|
+
expect(response.status).toBeLessThan(400);
|
|
2566
2595
|
});
|
|
2567
2596
|
it("should normalize prefix without leading slash", async () => {
|
|
2568
2597
|
const prefixedApp = (await setupAdapter(context, { prefix: "mastra" })).app;
|
|
2569
|
-
|
|
2598
|
+
const response = await executeHttpRequest(prefixedApp, {
|
|
2570
2599
|
method: "GET",
|
|
2571
2600
|
path: "/mastra/agents"
|
|
2572
|
-
})
|
|
2601
|
+
});
|
|
2602
|
+
expect(response.status).toBeLessThan(400);
|
|
2573
2603
|
});
|
|
2574
2604
|
it("should not have routes at double-slash path when prefix has trailing slash", async () => {
|
|
2575
2605
|
const prefixedApp = (await setupAdapter(context, { prefix: "/mastra/" })).app;
|
|
2576
|
-
|
|
2606
|
+
const response = await executeHttpRequest(prefixedApp, {
|
|
2577
2607
|
method: "GET",
|
|
2578
2608
|
path: "/mastra//agents"
|
|
2579
|
-
})
|
|
2609
|
+
});
|
|
2610
|
+
expect(response.status).toBe(404);
|
|
2580
2611
|
});
|
|
2581
2612
|
});
|
|
2582
2613
|
});
|
|
@@ -2740,10 +2771,11 @@ function createMCPRouteTestSuite(config) {
|
|
|
2740
2771
|
expect(res.data.tools).toEqual(expect.arrayContaining([expect.objectContaining({ name: "getWeather" }), expect.objectContaining({ name: "calculate" })]));
|
|
2741
2772
|
});
|
|
2742
2773
|
it("should return 404 for non-existent server", async () => {
|
|
2743
|
-
|
|
2774
|
+
const res = await executeHttpRequest(app, {
|
|
2744
2775
|
method: "GET",
|
|
2745
2776
|
path: "/api/mcp/non-existent/tools"
|
|
2746
|
-
})
|
|
2777
|
+
});
|
|
2778
|
+
expect(res.status).toBe(404);
|
|
2747
2779
|
});
|
|
2748
2780
|
});
|
|
2749
2781
|
describe("GET /api/mcp/:serverId/tools/:toolId", () => {
|
|
@@ -2760,10 +2792,11 @@ function createMCPRouteTestSuite(config) {
|
|
|
2760
2792
|
});
|
|
2761
2793
|
});
|
|
2762
2794
|
it("should return 404 for non-existent tool", async () => {
|
|
2763
|
-
|
|
2795
|
+
const res = await executeHttpRequest(app, {
|
|
2764
2796
|
method: "GET",
|
|
2765
2797
|
path: `/api/mcp/${mcpServer1.id}/tools/non-existent`
|
|
2766
|
-
})
|
|
2798
|
+
});
|
|
2799
|
+
expect(res.status).toBe(404);
|
|
2767
2800
|
});
|
|
2768
2801
|
});
|
|
2769
2802
|
describe("POST /api/mcp/:serverId/tools/:toolId/execute", () => {
|
|
@@ -2793,7 +2826,7 @@ function createMCPRouteTestSuite(config) {
|
|
|
2793
2826
|
});
|
|
2794
2827
|
});
|
|
2795
2828
|
it("should return 404 for non-existent server", async () => {
|
|
2796
|
-
|
|
2829
|
+
const res = await executeHttpRequest(app, {
|
|
2797
2830
|
method: "POST",
|
|
2798
2831
|
path: "/api/mcp/non-existent/tools/calculate/execute",
|
|
2799
2832
|
body: { data: {
|
|
@@ -2801,7 +2834,8 @@ function createMCPRouteTestSuite(config) {
|
|
|
2801
2834
|
a: 1,
|
|
2802
2835
|
b: 2
|
|
2803
2836
|
} }
|
|
2804
|
-
})
|
|
2837
|
+
});
|
|
2838
|
+
expect(res.status).toBe(404);
|
|
2805
2839
|
});
|
|
2806
2840
|
it("should return error for non-existent tool", async () => {
|
|
2807
2841
|
const res = await executeHttpRequest(app, {
|
|
@@ -3072,9 +3106,7 @@ function createMCPTransportTestSuite(config) {
|
|
|
3072
3106
|
case "multiply":
|
|
3073
3107
|
result = a * b;
|
|
3074
3108
|
break;
|
|
3075
|
-
case "divide":
|
|
3076
|
-
result = a / b;
|
|
3077
|
-
break;
|
|
3109
|
+
case "divide": result = a / b;
|
|
3078
3110
|
}
|
|
3079
3111
|
return { result };
|
|
3080
3112
|
}
|
|
@@ -3136,7 +3168,8 @@ function createMCPTransportTestSuite(config) {
|
|
|
3136
3168
|
path: "messages",
|
|
3137
3169
|
method: "POST"
|
|
3138
3170
|
}])("rejects the legacy $path route for a native server", async ({ path, method }) => {
|
|
3139
|
-
|
|
3171
|
+
const response = await fetch(`http://localhost:${port}/api/mcp/native-fixture/${path}`, { method });
|
|
3172
|
+
expect(response.status).toBe(404);
|
|
3140
3173
|
});
|
|
3141
3174
|
it("executes ordinary tools with the v2 request context and reports a suspended tool truthfully", async () => {
|
|
3142
3175
|
const base = `http://localhost:${port}/api/mcp/native-fixture/tools`;
|
|
@@ -3188,7 +3221,7 @@ function createMCPTransportTestSuite(config) {
|
|
|
3188
3221
|
describe("HTTP Transport (/api/mcp/:serverId/mcp)", () => {
|
|
3189
3222
|
describe("Error handling (raw HTTP)", () => {
|
|
3190
3223
|
it("should return 404 for non-existent server", async () => {
|
|
3191
|
-
|
|
3224
|
+
const res = await fetch(`http://localhost:${port}/api/mcp/non-existent/mcp`, {
|
|
3192
3225
|
method: "POST",
|
|
3193
3226
|
headers: {
|
|
3194
3227
|
"Content-Type": "application/json",
|
|
@@ -3207,7 +3240,8 @@ function createMCPTransportTestSuite(config) {
|
|
|
3207
3240
|
},
|
|
3208
3241
|
id: 1
|
|
3209
3242
|
})
|
|
3210
|
-
})
|
|
3243
|
+
});
|
|
3244
|
+
expect(res.status).toBe(404);
|
|
3211
3245
|
});
|
|
3212
3246
|
});
|
|
3213
3247
|
describe("Protocol operations (MCPClient)", () => {
|
|
@@ -3243,7 +3277,8 @@ function createMCPTransportTestSuite(config) {
|
|
|
3243
3277
|
const tools = await mcpClient.listTools();
|
|
3244
3278
|
expect(tools["server1_getWeather"]).toBeDefined();
|
|
3245
3279
|
expect(tools["server1_calculate"]).toBeDefined();
|
|
3246
|
-
|
|
3280
|
+
const server2Tools = Object.keys(tools).filter((k) => k.startsWith("server2_"));
|
|
3281
|
+
expect(server2Tools).toHaveLength(0);
|
|
3247
3282
|
});
|
|
3248
3283
|
});
|
|
3249
3284
|
describe("Tool execution errors (MCPClient)", () => {
|
|
@@ -3252,17 +3287,18 @@ function createMCPTransportTestSuite(config) {
|
|
|
3252
3287
|
let failingMastra;
|
|
3253
3288
|
let failingHttpServer;
|
|
3254
3289
|
beforeAll(async () => {
|
|
3290
|
+
const failingTool = createTool({
|
|
3291
|
+
id: "failingTool",
|
|
3292
|
+
description: "A tool that always throws an error",
|
|
3293
|
+
inputSchema: z.object({}),
|
|
3294
|
+
execute: async () => {
|
|
3295
|
+
throw new Error("Tool execution failed intentionally");
|
|
3296
|
+
}
|
|
3297
|
+
});
|
|
3255
3298
|
failingServer = new MCPServer({
|
|
3256
3299
|
name: "failingServer",
|
|
3257
3300
|
version: "1.0.0",
|
|
3258
|
-
tools: { failingTool
|
|
3259
|
-
id: "failingTool",
|
|
3260
|
-
description: "A tool that always throws an error",
|
|
3261
|
-
inputSchema: z.object({}),
|
|
3262
|
-
execute: async () => {
|
|
3263
|
-
throw new Error("Tool execution failed intentionally");
|
|
3264
|
-
}
|
|
3265
|
-
}) }
|
|
3301
|
+
tools: { failingTool }
|
|
3266
3302
|
});
|
|
3267
3303
|
failingMastra = new Mastra$1({ mcpServers: { "failing-server": failingServer } });
|
|
3268
3304
|
const serverSetup = await createServer(failingMastra);
|
|
@@ -3297,10 +3333,11 @@ function createMCPTransportTestSuite(config) {
|
|
|
3297
3333
|
describe("SSE Transport (/api/mcp/:serverId/sse)", () => {
|
|
3298
3334
|
describe("Error handling (raw HTTP)", () => {
|
|
3299
3335
|
it("should return 404 for non-existent server on GET /sse", async () => {
|
|
3300
|
-
|
|
3336
|
+
const res = await fetch(`http://localhost:${port}/api/mcp/non-existent/sse`);
|
|
3337
|
+
expect(res.status).toBe(404);
|
|
3301
3338
|
});
|
|
3302
3339
|
it("should return 404 for non-existent server on POST /messages", async () => {
|
|
3303
|
-
|
|
3340
|
+
const res = await fetch(`http://localhost:${port}/api/mcp/non-existent/messages`, {
|
|
3304
3341
|
method: "POST",
|
|
3305
3342
|
headers: { "Content-Type": "application/json" },
|
|
3306
3343
|
body: JSON.stringify({
|
|
@@ -3308,14 +3345,16 @@ function createMCPTransportTestSuite(config) {
|
|
|
3308
3345
|
method: "test",
|
|
3309
3346
|
id: 1
|
|
3310
3347
|
})
|
|
3311
|
-
})
|
|
3348
|
+
});
|
|
3349
|
+
expect(res.status).toBe(404);
|
|
3312
3350
|
});
|
|
3313
3351
|
});
|
|
3314
3352
|
describe("MCP 2.x servers (MCPClient)", () => {
|
|
3315
3353
|
it("does not serve the legacy SSE transport for a 2.x MCPServer", async (ctx) => {
|
|
3316
3354
|
if (mcpServer1.mcpVersion !== 2) ctx.skip();
|
|
3317
|
-
|
|
3318
|
-
expect((
|
|
3355
|
+
const res = await fetch(`http://localhost:${port}/api/mcp/${mcpServer1.id}/sse`);
|
|
3356
|
+
expect(res.status).toBe(404);
|
|
3357
|
+
const messages = await fetch(`http://localhost:${port}/api/mcp/${mcpServer1.id}/messages`, {
|
|
3319
3358
|
method: "POST",
|
|
3320
3359
|
headers: { "Content-Type": "application/json" },
|
|
3321
3360
|
body: JSON.stringify({
|
|
@@ -3323,7 +3362,8 @@ function createMCPTransportTestSuite(config) {
|
|
|
3323
3362
|
method: "tools/list",
|
|
3324
3363
|
id: 1
|
|
3325
3364
|
})
|
|
3326
|
-
})
|
|
3365
|
+
});
|
|
3366
|
+
expect(messages.status).toBe(404);
|
|
3327
3367
|
});
|
|
3328
3368
|
it("fails to connect through the SSE URL without downgrading", async (ctx) => {
|
|
3329
3369
|
if (mcpServer1.mcpVersion !== 2) ctx.skip();
|
|
@@ -3400,7 +3440,8 @@ function createMultipartTestSuite(config) {
|
|
|
3400
3440
|
body: formData
|
|
3401
3441
|
});
|
|
3402
3442
|
expect(response.status).toBe(200);
|
|
3403
|
-
|
|
3443
|
+
const result = await response.json();
|
|
3444
|
+
expect(result).toMatchObject({
|
|
3404
3445
|
success: true,
|
|
3405
3446
|
hasAudio: true
|
|
3406
3447
|
});
|
|
@@ -3435,10 +3476,11 @@ function createMultipartTestSuite(config) {
|
|
|
3435
3476
|
language: "en",
|
|
3436
3477
|
format: "mp3"
|
|
3437
3478
|
}));
|
|
3438
|
-
|
|
3479
|
+
const response = await fetch(`${serverInfo.baseUrl}/test/upload-with-options`, {
|
|
3439
3480
|
method: "POST",
|
|
3440
3481
|
body: formData
|
|
3441
|
-
})
|
|
3482
|
+
});
|
|
3483
|
+
expect(response.status).toBe(200);
|
|
3442
3484
|
expect(receivedBody.options).toBeDefined();
|
|
3443
3485
|
expect(typeof receivedBody.options).toBe("object");
|
|
3444
3486
|
expect(receivedBody.options.language).toBe("en");
|
|
@@ -3468,10 +3510,11 @@ function createMultipartTestSuite(config) {
|
|
|
3468
3510
|
])], { type: "audio/wav" });
|
|
3469
3511
|
formData.append("audio", audioBlob, "test.wav");
|
|
3470
3512
|
formData.append("name", "test-recording");
|
|
3471
|
-
|
|
3513
|
+
const response = await fetch(`${serverInfo.baseUrl}/test/upload-with-string`, {
|
|
3472
3514
|
method: "POST",
|
|
3473
3515
|
body: formData
|
|
3474
|
-
})
|
|
3516
|
+
});
|
|
3517
|
+
expect(response.status).toBe(200);
|
|
3475
3518
|
expect(receivedBody.name).toBe("test-recording");
|
|
3476
3519
|
});
|
|
3477
3520
|
it("should reject files exceeding size limit", async () => {
|
|
@@ -3493,10 +3536,11 @@ function createMultipartTestSuite(config) {
|
|
|
3493
3536
|
const formData = new FormData();
|
|
3494
3537
|
const largeBlob = new Blob([/* @__PURE__ */ new Uint8Array(200)], { type: "audio/wav" });
|
|
3495
3538
|
formData.append("audio", largeBlob, "large.wav");
|
|
3496
|
-
|
|
3539
|
+
const response = await fetch(`${serverInfo.baseUrl}/test/upload-limited`, {
|
|
3497
3540
|
method: "POST",
|
|
3498
3541
|
body: formData
|
|
3499
|
-
})
|
|
3542
|
+
});
|
|
3543
|
+
expect(response.status).toBeGreaterThanOrEqual(400);
|
|
3500
3544
|
});
|
|
3501
3545
|
it("should handle empty FormData gracefully", async () => {
|
|
3502
3546
|
const { adapter, app } = await setupAdapter(context);
|
|
@@ -3529,7 +3573,8 @@ function createMultipartTestSuite(config) {
|
|
|
3529
3573
|
body: formData
|
|
3530
3574
|
});
|
|
3531
3575
|
expect(response.status).toBe(200);
|
|
3532
|
-
|
|
3576
|
+
const result = await response.json();
|
|
3577
|
+
expect(result).toMatchObject({
|
|
3533
3578
|
success: true,
|
|
3534
3579
|
bodyKeys: []
|
|
3535
3580
|
});
|
|
@@ -3571,7 +3616,8 @@ function createMultipartTestSuite(config) {
|
|
|
3571
3616
|
body: formData
|
|
3572
3617
|
});
|
|
3573
3618
|
expect(response.status).toBe(200);
|
|
3574
|
-
|
|
3619
|
+
const result = await response.json();
|
|
3620
|
+
expect(result).toMatchObject({
|
|
3575
3621
|
hasFile1: true,
|
|
3576
3622
|
hasFile2: true
|
|
3577
3623
|
});
|
|
@@ -3600,7 +3646,8 @@ function createMultipartTestSuite(config) {
|
|
|
3600
3646
|
body: JSON.stringify({ message: "Hello, World!" })
|
|
3601
3647
|
});
|
|
3602
3648
|
expect(response.status).toBe(200);
|
|
3603
|
-
|
|
3649
|
+
const result = await response.json();
|
|
3650
|
+
expect(result).toMatchObject({
|
|
3604
3651
|
success: true,
|
|
3605
3652
|
message: "Hello, World!"
|
|
3606
3653
|
});
|
|
@@ -3700,7 +3747,8 @@ function createHttpLoggingTestSuite(config) {
|
|
|
3700
3747
|
logSpy = vi.spyOn(adapter.logger, "info");
|
|
3701
3748
|
await adapter.init();
|
|
3702
3749
|
await addRoute(app, "GET", "/test", () => ({ message: "success" }));
|
|
3703
|
-
|
|
3750
|
+
const response = await executeRequest(app, "GET", "http://localhost/test");
|
|
3751
|
+
expect(response.status).toBe(200);
|
|
3704
3752
|
expect(logSpy).toHaveBeenCalledWith(expect.stringMatching(/GET \/test 200 \d+ms/), expect.objectContaining({
|
|
3705
3753
|
method: "GET",
|
|
3706
3754
|
path: "/test",
|
|
@@ -3878,10 +3926,11 @@ function createBodyLimitTestSuite(config) {
|
|
|
3878
3926
|
return { receivedBody: body };
|
|
3879
3927
|
}
|
|
3880
3928
|
});
|
|
3881
|
-
|
|
3929
|
+
const response = await executeRequest(wiredApp, "POST", "http://localhost/test/route-body-limit", {
|
|
3882
3930
|
headers: { "Content-Type": "application/json" },
|
|
3883
3931
|
body: oversizedPayload
|
|
3884
|
-
})
|
|
3932
|
+
});
|
|
3933
|
+
expect(response.status).toBe(413);
|
|
3885
3934
|
expect(handlerCalled).toBe(false);
|
|
3886
3935
|
await cleanupApp?.(wiredApp);
|
|
3887
3936
|
});
|
|
@@ -3900,10 +3949,11 @@ function createBodyLimitTestSuite(config) {
|
|
|
3900
3949
|
return { receivedBody: body };
|
|
3901
3950
|
}
|
|
3902
3951
|
});
|
|
3903
|
-
|
|
3952
|
+
const response = await executeRequestWithoutContentLength(wiredApp, "POST", "http://localhost/test/route-body-limit-no-content-length", {
|
|
3904
3953
|
headers: { "Content-Type": "application/json" },
|
|
3905
3954
|
body: oversizedPayload
|
|
3906
|
-
})
|
|
3955
|
+
});
|
|
3956
|
+
expect(response.status).toBe(413);
|
|
3907
3957
|
expect(handlerCalled).toBe(false);
|
|
3908
3958
|
await cleanupApp?.(wiredApp);
|
|
3909
3959
|
});
|
|
@@ -3920,10 +3970,11 @@ function createBodyLimitTestSuite(config) {
|
|
|
3920
3970
|
responseType: "json",
|
|
3921
3971
|
handler: async ({ body }) => ({ receivedBody: body })
|
|
3922
3972
|
});
|
|
3923
|
-
|
|
3973
|
+
const response = await executeRequest(wiredApp, method, "http://localhost/test/body-limit", {
|
|
3924
3974
|
headers: { "Content-Type": "application/json" },
|
|
3925
3975
|
body: oversizedPayload
|
|
3926
|
-
})
|
|
3976
|
+
});
|
|
3977
|
+
expect(response.status).toBe(413);
|
|
3927
3978
|
await cleanupApp?.(wiredApp);
|
|
3928
3979
|
});
|
|
3929
3980
|
});
|