@mastra/server-adapters-test-suite 0.3.0-alpha.2 → 0.3.0-alpha.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
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @mastra/server-adapters-test-suite
|
|
2
2
|
|
|
3
|
+
## 0.3.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added stream disconnect cases that check a stream failing partway still delivers what was sent before the failure and ends the response. Adapters that still drop the connection for `datastream-response` routes can pin those cases with the `datastreamUpstreamErrorDropsConnection` option. ([#29944](https://github.com/mastra-ai/mastra/pull/29944))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`749c09c`](https://github.com/mastra-ai/mastra/commit/749c09cf9120ff36cfa965444e2f0472b37c00ee), [`931c2bb`](https://github.com/mastra-ai/mastra/commit/931c2bb605a2a924844a4b75b2b8319673cc911b), [`22b24cc`](https://github.com/mastra-ai/mastra/commit/22b24cc40ad2923b22e11cfa2b5264b4ae0f1ffc), [`5810337`](https://github.com/mastra-ai/mastra/commit/5810337c710fdba9f3e1c3fe982eec8907f2f444), [`ec60314`](https://github.com/mastra-ai/mastra/commit/ec603149745f7592d3d559447f69c65277580c31), [`c3ef10e`](https://github.com/mastra-ai/mastra/commit/c3ef10ee3094f9d30d2aca6d59ef224b0340d6ba), [`df4b70b`](https://github.com/mastra-ai/mastra/commit/df4b70bd4185ce7c56699aac76321e64e59d7cdd), [`6ef0741`](https://github.com/mastra-ai/mastra/commit/6ef07410a40f69ebe316db2bd3190cd43177a46a), [`c3ef10e`](https://github.com/mastra-ai/mastra/commit/c3ef10ee3094f9d30d2aca6d59ef224b0340d6ba), [`01b2b95`](https://github.com/mastra-ai/mastra/commit/01b2b958af4a2a609e20ae2e39c0201383631760), [`e344f15`](https://github.com/mastra-ai/mastra/commit/e344f157171c02d43c41bd6f4a4487e0215726af), [`5de12fc`](https://github.com/mastra-ai/mastra/commit/5de12fce63626abb87fcb09d7628951e7ad96b4a), [`94bf876`](https://github.com/mastra-ai/mastra/commit/94bf8761f4db6650c95f59fc51481e662c0d3436), [`6b8f215`](https://github.com/mastra-ai/mastra/commit/6b8f215e1fadcba2d0e3ad6a1a9222f8f2c6da79), [`ab4c3fa`](https://github.com/mastra-ai/mastra/commit/ab4c3fafdbd5ff84dde97fa936e1e55d70ef3e4b), [`223204c`](https://github.com/mastra-ai/mastra/commit/223204cd3eb1b9e54a7be0130d2bf2e6c957b9cf), [`e349d05`](https://github.com/mastra-ai/mastra/commit/e349d05edd35a1889a4122f296693a15a8125a27)]:
|
|
10
|
+
- @mastra/core@1.83.0-alpha.6
|
|
11
|
+
- @mastra/mcp@2.9.0-alpha.3
|
|
12
|
+
- @mastra/server@1.83.0-alpha.6
|
|
13
|
+
|
|
3
14
|
## 0.3.0-alpha.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -4352,7 +4352,7 @@ function createStreamDisconnectTestSuite(config) {
|
|
|
4352
4352
|
await close?.();
|
|
4353
4353
|
close = void 0;
|
|
4354
4354
|
});
|
|
4355
|
-
async function setup({ responseType, chunks = 60, chunkBytes = 16, paceMs = 10, holdUntilDisconnect = false, compress = false }) {
|
|
4355
|
+
async function setup({ responseType, chunks = 60, chunkBytes = 16, paceMs = 10, holdUntilDisconnect = false, compress = false, errorAfter }) {
|
|
4356
4356
|
const state = {
|
|
4357
4357
|
pulls: 0,
|
|
4358
4358
|
canceled: false
|
|
@@ -4376,8 +4376,10 @@ function createStreamDisconnectTestSuite(config) {
|
|
|
4376
4376
|
const body = new ReadableStream({
|
|
4377
4377
|
async pull(controller) {
|
|
4378
4378
|
if (state.pulls >= chunks) return controller.close();
|
|
4379
|
-
state.pulls
|
|
4379
|
+
const failing = errorAfter !== void 0 && state.pulls >= errorAfter;
|
|
4380
|
+
if (!failing) state.pulls++;
|
|
4380
4381
|
if (paceMs) await sleep(paceMs);
|
|
4382
|
+
if (failing) return controller.error(/* @__PURE__ */ new Error("upstream failed"));
|
|
4381
4383
|
controller.enqueue(responseType === "stream" ? {
|
|
4382
4384
|
type: "chunk",
|
|
4383
4385
|
n: state.pulls,
|
|
@@ -4474,6 +4476,18 @@ function createStreamDisconnectTestSuite(config) {
|
|
|
4474
4476
|
expect(text.match(/"n":\d+|chunk-\d+/g)).toHaveLength(20);
|
|
4475
4477
|
expect(state.canceled, "upstream cancel()").toBe(false);
|
|
4476
4478
|
});
|
|
4479
|
+
(responseType === "datastream-response" && config.datastreamUpstreamErrorDropsConnection ? it.fails : it).each([0, 20])("delivers the chunks sent before an upstream error and ends the response cleanly (error after %ims)", async (paceMs) => {
|
|
4480
|
+
const { url } = await setup({
|
|
4481
|
+
responseType,
|
|
4482
|
+
chunks: 100,
|
|
4483
|
+
errorAfter: 3,
|
|
4484
|
+
paceMs
|
|
4485
|
+
});
|
|
4486
|
+
const response = await post(url);
|
|
4487
|
+
const text = await response.text();
|
|
4488
|
+
expect(response.status).toBe(200);
|
|
4489
|
+
expect(text.match(/"n":\d+|chunk-\d+/g)).toHaveLength(3);
|
|
4490
|
+
});
|
|
4477
4491
|
it("pauses reading the upstream while a connected client is not reading, and cancels it once the client leaves", async () => {
|
|
4478
4492
|
const { url, state } = await setup({
|
|
4479
4493
|
responseType,
|