@mastra/server-adapters-test-suite 0.0.0-feat-durable-agent-evented-engine-20260918205958
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 +27 -0
- package/LICENSE.md +32 -0
- package/README.md +42 -0
- package/dist/body-limit-test-suite.d.ts +53 -0
- package/dist/body-limit-test-suite.d.ts.map +1 -0
- package/dist/http-logging-test-suite.d.ts +52 -0
- package/dist/http-logging-test-suite.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3756 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-route-test-suite.d.ts +32 -0
- package/dist/mcp-route-test-suite.d.ts.map +1 -0
- package/dist/mcp-transport-test-suite.d.ts +62 -0
- package/dist/mcp-transport-test-suite.d.ts.map +1 -0
- package/dist/multipart-test-suite.d.ts +57 -0
- package/dist/multipart-test-suite.d.ts.map +1 -0
- package/dist/native-mcp-fixture.d.ts +53 -0
- package/dist/native-mcp-fixture.d.ts.map +1 -0
- package/dist/route-adapter-test-suite.d.ts +15 -0
- package/dist/route-adapter-test-suite.d.ts.map +1 -0
- package/dist/route-test-suite.d.ts +14 -0
- package/dist/route-test-suite.d.ts.map +1 -0
- package/dist/route-test-utils.d.ts +54 -0
- package/dist/route-test-utils.d.ts.map +1 -0
- package/dist/test-helpers.d.ts +205 -0
- package/dist/test-helpers.d.ts.map +1 -0
- package/package.json +61 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @mastra/server-adapters-test-suite
|
|
2
|
+
|
|
3
|
+
## 0.0.0-feat-durable-agent-evented-engine-20260918205958
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Publish the reusable server adapter conformance test suite. ([#24254](https://github.com/mastra-ai/mastra/pull/24254))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`b636716`](https://github.com/mastra-ai/mastra/commit/b636716f266cfaca183937918650d2f72f0fb22b), [`81ccd7b`](https://github.com/mastra-ai/mastra/commit/81ccd7b93040952fe9c7168a2757c43a217f0a87), [`a46385d`](https://github.com/mastra-ai/mastra/commit/a46385dc1b773d1e1453627b1d62e7b6ebe93cf1), [`0f09541`](https://github.com/mastra-ai/mastra/commit/0f09541b5821cef60c9b86e377a2b43b8ebf977f), [`1e68460`](https://github.com/mastra-ai/mastra/commit/1e68460205d0061c6dbc7a7e7a50950236af774b), [`4266b67`](https://github.com/mastra-ai/mastra/commit/4266b677d33bb20651ca296f64aa91fa3b3d4e82), [`291a694`](https://github.com/mastra-ai/mastra/commit/291a694b3f9b7d9a17af7d10ed3c9c357bed7a6c), [`7cfa0df`](https://github.com/mastra-ai/mastra/commit/7cfa0df76759a31b54dd1a87bc95d3064f2026e9), [`b246a1b`](https://github.com/mastra-ai/mastra/commit/b246a1ba0cec1ca2781c661a6b90c777520b64c7), [`291a694`](https://github.com/mastra-ai/mastra/commit/291a694b3f9b7d9a17af7d10ed3c9c357bed7a6c), [`bec18d0`](https://github.com/mastra-ai/mastra/commit/bec18d05e7f997ead6ada04a4dc0179c3cad8aa2), [`164e197`](https://github.com/mastra-ai/mastra/commit/164e197aa5b0973ae49a82252294f6276b2829aa), [`6ef8186`](https://github.com/mastra-ai/mastra/commit/6ef8186ade9c8ca69269deed07fd47a942ecf70d), [`bc12e6c`](https://github.com/mastra-ai/mastra/commit/bc12e6cd9cc74fb078b006ed5d14429e2101cbb2), [`ab0632c`](https://github.com/mastra-ai/mastra/commit/ab0632ca5e1a76da1db23d37bf9a8704f7cea9e6), [`abecb67`](https://github.com/mastra-ai/mastra/commit/abecb6709643785fd87a3ff9251032a61479ccab), [`697fecc`](https://github.com/mastra-ai/mastra/commit/697feccaa4ad5df913c22e47bf16f493dd7956a8), [`2ea44c1`](https://github.com/mastra-ai/mastra/commit/2ea44c1b578d8116507160ac32c7824faa07158e), [`64ebed4`](https://github.com/mastra-ai/mastra/commit/64ebed482a25adcc966c15ac4770d25a67bce0b5), [`25d940a`](https://github.com/mastra-ai/mastra/commit/25d940add25504daebe65bc5cc02f268d6eba07c), [`ab0632c`](https://github.com/mastra-ai/mastra/commit/ab0632ca5e1a76da1db23d37bf9a8704f7cea9e6), [`467e0a6`](https://github.com/mastra-ai/mastra/commit/467e0a630db09a1750ce9271bddb38e46681bf04), [`13b0f30`](https://github.com/mastra-ai/mastra/commit/13b0f304533a43df7a7c486b6f37c9dca2187ecf), [`ee7187e`](https://github.com/mastra-ai/mastra/commit/ee7187e7bf66db46630f33c64e86b1ff7bb0c0b7), [`0bf287c`](https://github.com/mastra-ai/mastra/commit/0bf287c36ec14b45f5a4fdd0d279698694f592dd), [`b2942c0`](https://github.com/mastra-ai/mastra/commit/b2942c0f3c99dd1edba9dc8c2c17bfa55c851ae8), [`6249741`](https://github.com/mastra-ai/mastra/commit/6249741f8463bdc5a05ded2b35b143f92f33afbf), [`99fab39`](https://github.com/mastra-ai/mastra/commit/99fab399c35952ae15427ea64845d4762e9ec144), [`cd6948c`](https://github.com/mastra-ai/mastra/commit/cd6948c50aa4478d795613bdfa2d5259a7045026), [`2480359`](https://github.com/mastra-ai/mastra/commit/248035940aa048c7bcd8cfe7845915dc4734b571), [`34e4d21`](https://github.com/mastra-ai/mastra/commit/34e4d21e62c61e11e52aa7d6c39748b1120fbb93), [`8702f39`](https://github.com/mastra-ai/mastra/commit/8702f39331322ef0296fd3d68c0bd0997079faaa), [`d7f0579`](https://github.com/mastra-ai/mastra/commit/d7f0579a0445469430b9eadbf9c28ed3fa009839), [`096825c`](https://github.com/mastra-ai/mastra/commit/096825c0cc37de5f465ecdc6617d642b8c898a78), [`8a7d99b`](https://github.com/mastra-ai/mastra/commit/8a7d99b02eebc8f1b22f029b5103875eecce31a0), [`d65d4d4`](https://github.com/mastra-ai/mastra/commit/d65d4d40a24a482d5b0ee83d9bab6042702ca1be), [`e6072cb`](https://github.com/mastra-ai/mastra/commit/e6072cbbd3482e37027e53e4d62da7aad6a36c41), [`c016c9b`](https://github.com/mastra-ai/mastra/commit/c016c9bd051612714e662588e5928b72bd6a6ac6), [`644ac13`](https://github.com/mastra-ai/mastra/commit/644ac131110a9f24a8d92b62dd3777384211a2e7), [`b483910`](https://github.com/mastra-ai/mastra/commit/b48391034dee9a19396c1b3ec084ecf20faf550e), [`fec1259`](https://github.com/mastra-ai/mastra/commit/fec125946766805f3122be391272415691de6408), [`285b25a`](https://github.com/mastra-ai/mastra/commit/285b25aa9bb7cc3184991ad01f1acd4895fba076), [`4fb5ae9`](https://github.com/mastra-ai/mastra/commit/4fb5ae9e2cba9b14ba6c5cef0894e49bccf6f607), [`164e197`](https://github.com/mastra-ai/mastra/commit/164e197aa5b0973ae49a82252294f6276b2829aa), [`babda00`](https://github.com/mastra-ai/mastra/commit/babda005397d2780aa21be0a7670688b704bdb2f), [`aa38e6f`](https://github.com/mastra-ai/mastra/commit/aa38e6f424a0eae0e43a5c2ae0b387e404f5e6a6), [`8d9eadb`](https://github.com/mastra-ai/mastra/commit/8d9eadb59ccbcae054600128aa15d95ea4d1141a), [`2476423`](https://github.com/mastra-ai/mastra/commit/24764233246dc85d7bcba8f8bb610110449a54d6), [`5085475`](https://github.com/mastra-ai/mastra/commit/5085475c0da226e618eb3ee2676d347788c3fb00), [`fa4c366`](https://github.com/mastra-ai/mastra/commit/fa4c3664c5446ae13d991204275883b2d7f00690), [`8d808d8`](https://github.com/mastra-ai/mastra/commit/8d808d8452b8acd5eda4f8cfe014331a8c0f1e92), [`164e197`](https://github.com/mastra-ai/mastra/commit/164e197aa5b0973ae49a82252294f6276b2829aa), [`e581e66`](https://github.com/mastra-ai/mastra/commit/e581e66e14bb1b2863698aecca7324fbf1ec4ff5), [`34fd538`](https://github.com/mastra-ai/mastra/commit/34fd538060402e414bdf65af9f469e7bff60be1e), [`1670091`](https://github.com/mastra-ai/mastra/commit/16700919c35dadb9737dc7fe7e5feb67cc209494), [`a3f8f05`](https://github.com/mastra-ai/mastra/commit/a3f8f05ecb60c52056c590325e3821ecfc85afe3), [`13b0f30`](https://github.com/mastra-ai/mastra/commit/13b0f304533a43df7a7c486b6f37c9dca2187ecf), [`d39b43b`](https://github.com/mastra-ai/mastra/commit/d39b43beada08e69a962a47b58d743384722cd1f), [`b8e3ee5`](https://github.com/mastra-ai/mastra/commit/b8e3ee5da5cbc46b182ca75214acda667bac5205), [`9cd9b4e`](https://github.com/mastra-ai/mastra/commit/9cd9b4eca69a3db0a0c415d0dcedf266cc7d5ec6), [`bdab4a8`](https://github.com/mastra-ai/mastra/commit/bdab4a889808d502f398a8086af3b50cc3bfbcd5), [`53cdd63`](https://github.com/mastra-ai/mastra/commit/53cdd6368b12aea743f95118a49fc6b93985fd20), [`3589cde`](https://github.com/mastra-ai/mastra/commit/3589cde4ea8dd210df6b9a2355a3e568210965fc), [`d777788`](https://github.com/mastra-ai/mastra/commit/d7777889d72b4f37a3d50b830f8208c736ee0e7a), [`5085475`](https://github.com/mastra-ai/mastra/commit/5085475c0da226e618eb3ee2676d347788c3fb00), [`34e4d21`](https://github.com/mastra-ai/mastra/commit/34e4d21e62c61e11e52aa7d6c39748b1120fbb93), [`76c7d98`](https://github.com/mastra-ai/mastra/commit/76c7d989f691510d7bfc016723cc78d7e08ac108), [`f8683b3`](https://github.com/mastra-ai/mastra/commit/f8683b3f45fcc1b92cebe74991b94653a1fafab2), [`3b6628d`](https://github.com/mastra-ai/mastra/commit/3b6628dd4df0b27c0e8ae329330cbca6a433ce51), [`7869c0f`](https://github.com/mastra-ai/mastra/commit/7869c0fc291a2a8c28ee1769aa29c4d9dce51e8d), [`783e48a`](https://github.com/mastra-ai/mastra/commit/783e48aba82489a085230f6b8539a9fb338c326b), [`b26e528`](https://github.com/mastra-ai/mastra/commit/b26e5288891641044a3c26a498c06259985fed10), [`61f953a`](https://github.com/mastra-ai/mastra/commit/61f953a79736ac0d8a9650f0561c6dab1b097c8e), [`56680bf`](https://github.com/mastra-ai/mastra/commit/56680bfff71e7cdad71721b424b160bdd5de6e02), [`93a3425`](https://github.com/mastra-ai/mastra/commit/93a342569d592d0449eee7b4b4f7555dc001081b), [`32edb03`](https://github.com/mastra-ai/mastra/commit/32edb0371b8d884bee66897f236e852a959ae07a), [`b130872`](https://github.com/mastra-ai/mastra/commit/b130872508e95f17894c2ed4932d4952db0a2d3c), [`a2c9876`](https://github.com/mastra-ai/mastra/commit/a2c9876f0d76a3b50ea28e6bab71de0ff4bd78a8), [`1853f3d`](https://github.com/mastra-ai/mastra/commit/1853f3d9331e3131930581556df781cca85f2d2d), [`b2f412a`](https://github.com/mastra-ai/mastra/commit/b2f412ae77fa5379471d103ebcc1ba69b22dd353), [`bec18d0`](https://github.com/mastra-ai/mastra/commit/bec18d05e7f997ead6ada04a4dc0179c3cad8aa2), [`bc12e6c`](https://github.com/mastra-ai/mastra/commit/bc12e6cd9cc74fb078b006ed5d14429e2101cbb2), [`fdb59c6`](https://github.com/mastra-ai/mastra/commit/fdb59c6a4c3d9aea19159886aac8d80602763f04), [`07a81c8`](https://github.com/mastra-ai/mastra/commit/07a81c8be0cbdb5413ffa5c289d32765d80f4ea4), [`07ff1b8`](https://github.com/mastra-ai/mastra/commit/07ff1b8eafbd9c7786ef77decc6be3b63497cfd9), [`0ca5d6d`](https://github.com/mastra-ai/mastra/commit/0ca5d6d58a24e73a364451660a5a8696883eba45)]:
|
|
12
|
+
- @mastra/server@0.0.0-feat-durable-agent-evented-engine-20260918205958
|
|
13
|
+
- @mastra/core@0.0.0-feat-durable-agent-evented-engine-20260918205958
|
|
14
|
+
- @mastra/mcp@0.0.0-feat-durable-agent-evented-engine-20260918205958
|
|
15
|
+
|
|
16
|
+
## 0.1.0-alpha.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- Publish the reusable server adapter conformance test suite. ([#24254](https://github.com/mastra-ai/mastra/pull/24254))
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`b636716`](https://github.com/mastra-ai/mastra/commit/b636716f266cfaca183937918650d2f72f0fb22b), [`697fecc`](https://github.com/mastra-ai/mastra/commit/697feccaa4ad5df913c22e47bf16f493dd7956a8), [`64ebed4`](https://github.com/mastra-ai/mastra/commit/64ebed482a25adcc966c15ac4770d25a67bce0b5), [`0bf287c`](https://github.com/mastra-ai/mastra/commit/0bf287c36ec14b45f5a4fdd0d279698694f592dd), [`6249741`](https://github.com/mastra-ai/mastra/commit/6249741f8463bdc5a05ded2b35b143f92f33afbf), [`2480359`](https://github.com/mastra-ai/mastra/commit/248035940aa048c7bcd8cfe7845915dc4734b571), [`285b25a`](https://github.com/mastra-ai/mastra/commit/285b25aa9bb7cc3184991ad01f1acd4895fba076), [`b26e528`](https://github.com/mastra-ai/mastra/commit/b26e5288891641044a3c26a498c06259985fed10), [`b2f412a`](https://github.com/mastra-ai/mastra/commit/b2f412ae77fa5379471d103ebcc1ba69b22dd353)]:
|
|
25
|
+
- @mastra/server@1.68.0-alpha.4
|
|
26
|
+
- @mastra/core@1.68.0-alpha.4
|
|
27
|
+
- @mastra/mcp@1.18.1-alpha.2
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Portions of this software are licensed as follows:
|
|
2
|
+
|
|
3
|
+
- All content that resides under any directory named `ee/` within this
|
|
4
|
+
repository, including but not limited to:
|
|
5
|
+
- `@mastra/core/auth/ee`
|
|
6
|
+
- `@mastra/core/agent-builder/ee`
|
|
7
|
+
- `@mastra/editor/ee`
|
|
8
|
+
|
|
9
|
+
is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
|
|
10
|
+
|
|
11
|
+
- All third-party components incorporated into the Mastra Software are
|
|
12
|
+
licensed under the original license provided by the owner of the
|
|
13
|
+
applicable component.
|
|
14
|
+
|
|
15
|
+
- Content outside of the above-mentioned directories or restrictions is
|
|
16
|
+
available under the "Apache License 2.0" as defined below.
|
|
17
|
+
|
|
18
|
+
# Apache License 2.0
|
|
19
|
+
|
|
20
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
21
|
+
|
|
22
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
you may not use this file except in compliance with the License.
|
|
24
|
+
You may obtain a copy of the License at
|
|
25
|
+
|
|
26
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
+
|
|
28
|
+
Unless required by applicable law or agreed to in writing, software
|
|
29
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
30
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
31
|
+
See the License for the specific language governing permissions and
|
|
32
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @mastra/server-adapters-test-suite
|
|
2
|
+
|
|
3
|
+
Reusable conformance test suites for authors of Mastra server adapters.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the suite with its peer dependencies in your adapter's development environment:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @mastra/server-adapters-test-suite
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The package requires Mastra Core and Server `>=1.64.0-0 <2.0.0-0`, Mastra MCP `>=1.18.0-0 <2.0.0-0`, Vitest `>=4.0.0 <5.0.0`, and Zod `^3.25.0 || ^4.0.0`. Install those peer dependencies in your adapter's development environment.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Provide framework-specific setup and request execution functions to the shared suite:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { createRouteAdapterTestSuite } from '@mastra/server-adapters-test-suite';
|
|
21
|
+
import { executeHttpRequest, setupAdapter } from './adapter-test-helpers';
|
|
22
|
+
|
|
23
|
+
createRouteAdapterTestSuite({
|
|
24
|
+
suiteName: 'My server adapter',
|
|
25
|
+
setupAdapter,
|
|
26
|
+
executeHttpRequest,
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Additional root exports cover MCP routes and transports, multipart requests, HTTP logging, and request body limits.
|
|
31
|
+
|
|
32
|
+
## Documentation
|
|
33
|
+
|
|
34
|
+
- [Custom server adapters](https://mastra.ai/docs/server/custom-adapters#test-adapter-compatibility)
|
|
35
|
+
|
|
36
|
+
## Changelog
|
|
37
|
+
|
|
38
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/server-adapters/server-adapters-test-suite/CHANGELOG.md) for version history and release notes.
|
|
39
|
+
|
|
40
|
+
## Support
|
|
41
|
+
|
|
42
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
2
|
+
import type { BodyLimitOptions, ServerRoute } from '@mastra/server/server-adapter';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the body-limit test suite
|
|
5
|
+
*/
|
|
6
|
+
export interface BodyLimitTestSuiteConfig<TApp> {
|
|
7
|
+
/** Name for the test suite */
|
|
8
|
+
suiteName?: string;
|
|
9
|
+
/** Body size limit (in bytes) to configure the adapter with. Defaults to 100. */
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
/** Create a new app instance */
|
|
12
|
+
createApp: () => TApp;
|
|
13
|
+
/**
|
|
14
|
+
* Construct the adapter for the given app/Mastra instance with the provided
|
|
15
|
+
* bodyLimitOptions, wiring up any context middleware the adapter needs.
|
|
16
|
+
*/
|
|
17
|
+
setupAdapter: (app: TApp, mastra: Mastra, bodyLimitOptions?: BodyLimitOptions) => {
|
|
18
|
+
adapter: any;
|
|
19
|
+
app: TApp;
|
|
20
|
+
} | Promise<{
|
|
21
|
+
adapter: any;
|
|
22
|
+
app: TApp;
|
|
23
|
+
}>;
|
|
24
|
+
/** Register the given ServerRoute on the app through the adapter's registerRoute() */
|
|
25
|
+
registerRoute: (adapter: any, app: TApp, route: ServerRoute<any, any, any>) => void | Promise<void>;
|
|
26
|
+
/** Execute an HTTP request against the app and return its status code */
|
|
27
|
+
executeRequest: (app: TApp, method: string, url: string, options?: {
|
|
28
|
+
headers?: Record<string, string>;
|
|
29
|
+
body?: string;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
status: number;
|
|
32
|
+
}>;
|
|
33
|
+
/** Execute a request whose transport does not add Content-Length. */
|
|
34
|
+
executeRequestWithoutContentLength?: (app: TApp, method: string, url: string, options?: {
|
|
35
|
+
headers?: Record<string, string>;
|
|
36
|
+
body?: string;
|
|
37
|
+
}) => Promise<{
|
|
38
|
+
status: number;
|
|
39
|
+
}>;
|
|
40
|
+
/** Optional teardown for the app instance (e.g. closing a listening server) */
|
|
41
|
+
cleanupApp?: (app: TApp) => void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a standardized body-limit test suite for server adapters.
|
|
45
|
+
*
|
|
46
|
+
* Exercises the adapter's registerRoute() body-limit gate (bodyLimitOptions.maxSize)
|
|
47
|
+
* for both POST and DELETE. DELETE is included alongside the long-established POST
|
|
48
|
+
* behavior as regression coverage: DELETE requests previously bypassed the body-limit
|
|
49
|
+
* check entirely, even though the adapters' getParams() reads and JSON-parses the
|
|
50
|
+
* request body for DELETE the same way it does for POST/PUT/PATCH.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createBodyLimitTestSuite<TApp>(config: BodyLimitTestSuiteConfig<TApp>): void;
|
|
53
|
+
//# sourceMappingURL=body-limit-test-suite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body-limit-test-suite.d.ts","sourceRoot":"","sources":["../src/body-limit-test-suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGnF;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,IAAI;IAC5C,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,gCAAgC;IAChC,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB;;;OAGG;IACH,YAAY,EAAE,CACZ,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,gBAAgB,CAAC,EAAE,gBAAgB,KAChC;QAAE,OAAO,EAAE,GAAG,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,GAAG,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IAExE,sFAAsF;IACtF,aAAa,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpG,yEAAyE;IACzE,cAAc,EAAE,CACd,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAC1D,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEjC,qEAAqE;IACrE,kCAAkC,CAAC,EAAE,CACnC,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAC1D,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEjC,+EAA+E;IAC/E,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,wBAAwB,CAAC,IAAI,CAAC,QA6GpF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for HTTP logging test suite
|
|
4
|
+
*/
|
|
5
|
+
export interface HttpLoggingTestSuiteConfig<TApp> {
|
|
6
|
+
/** Name for the test suite */
|
|
7
|
+
suiteName?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Setup adapter with given Mastra instance
|
|
10
|
+
*/
|
|
11
|
+
setupAdapter: (app: TApp, mastra: Mastra) => {
|
|
12
|
+
adapter: any;
|
|
13
|
+
app: TApp;
|
|
14
|
+
} | Promise<{
|
|
15
|
+
adapter: any;
|
|
16
|
+
app: TApp;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new app instance
|
|
20
|
+
*/
|
|
21
|
+
createApp: () => TApp;
|
|
22
|
+
/**
|
|
23
|
+
* Register a route handler for testing
|
|
24
|
+
* Returns a function to register the route (called after init for some adapters)
|
|
25
|
+
*/
|
|
26
|
+
addRoute: (app: TApp, method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, handler: (req: any) => any | Promise<any>) => void | Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Execute an HTTP request against the app
|
|
29
|
+
*/
|
|
30
|
+
executeRequest: (app: TApp, method: string, url: string, options?: {
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
body?: string;
|
|
33
|
+
}) => Promise<{
|
|
34
|
+
status: number;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a standardized test suite for HTTP logging across all server adapters.
|
|
39
|
+
*
|
|
40
|
+
* Tests:
|
|
41
|
+
* - Disabled logging (no logs when apiReqLogs is false)
|
|
42
|
+
* - Default logging (info level with basic fields)
|
|
43
|
+
* - Custom log levels (debug, info, warn)
|
|
44
|
+
* - Path exclusion (health checks, metrics)
|
|
45
|
+
* - Query parameter inclusion
|
|
46
|
+
* - Header inclusion
|
|
47
|
+
* - Sensitive header redaction (default and custom)
|
|
48
|
+
* - Different HTTP methods (GET, POST, PUT, DELETE)
|
|
49
|
+
* - Error status codes (404, 500)
|
|
50
|
+
*/
|
|
51
|
+
export declare function createHttpLoggingTestSuite<TApp>(config: HttpLoggingTestSuiteConfig<TApp>): void;
|
|
52
|
+
//# sourceMappingURL=http-logging-test-suite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-logging-test-suite.d.ts","sourceRoot":"","sources":["../src/http-logging-test-suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C;;GAEG;AACH,MAAM,WAAW,0BAA0B,CAAC,IAAI;IAC9C,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK;QAAE,OAAO,EAAE,GAAG,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,GAAG,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IAEhH;;OAEG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB;;;OAGG;IACH,QAAQ,EAAE,CACR,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,EACzC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,KACtC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;OAEG;IACH,cAAc,EAAE,CACd,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAC1D,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,0BAA0B,CAAC,IAAI,CAAC,QAuTxF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { createRouteAdapterTestSuite } from './route-adapter-test-suite.js';
|
|
2
|
+
export type { AdapterTestSuiteConfig, AdapterTestContext, AdapterSetupOptions, HttpRequest, HttpResponse, } from './test-helpers.js';
|
|
3
|
+
export { createMCPRouteTestSuite } from './mcp-route-test-suite.js';
|
|
4
|
+
export { createMCPTransportTestSuite, type MCPTransportTestConfig } from './mcp-transport-test-suite.js';
|
|
5
|
+
export { createMultipartTestSuite, type MultipartTestSuiteConfig } from './multipart-test-suite.js';
|
|
6
|
+
export { createHttpLoggingTestSuite, type HttpLoggingTestSuiteConfig } from './http-logging-test-suite.js';
|
|
7
|
+
export { createBodyLimitTestSuite, type BodyLimitTestSuiteConfig } from './body-limit-test-suite.js';
|
|
8
|
+
export { createDefaultTestContext, createStreamWithSensitiveData, createStreamWithUnserializableChunk, expectSerializedStreamChunks, consumeSSEStream, } from './test-helpers.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAElG,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,mCAAmC,EACnC,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|