@mastra/hono 1.4.14-alpha.10 → 1.4.14-alpha.14

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,37 @@
1
1
  # @mastra/hono
2
2
 
3
+ ## 1.4.14-alpha.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`05dab92`](https://github.com/mastra-ai/mastra/commit/05dab92b3373306a4791c3a035a3100dd9a76b7f)]:
8
+ - @mastra/server@1.33.0-alpha.14
9
+ - @mastra/core@1.33.0-alpha.14
10
+
11
+ ## 1.4.14-alpha.13
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`f984b4d`](https://github.com/mastra-ai/mastra/commit/f984b4d6c60bf2ae2a9b156f0e8c35a66fe96c91), [`ce01024`](https://github.com/mastra-ai/mastra/commit/ce010242eee9bdfc09e4c26725b9d37998679a8d), [`f984b4d`](https://github.com/mastra-ai/mastra/commit/f984b4d6c60bf2ae2a9b156f0e8c35a66fe96c91), [`8373ff4`](https://github.com/mastra-ai/mastra/commit/8373ff46745d77af79f183c4470f80fa2727a6b2), [`11c1528`](https://github.com/mastra-ai/mastra/commit/11c152848c5d0ef227184853b5040f5b41ee7b1e)]:
16
+ - @mastra/core@1.33.0-alpha.13
17
+ - @mastra/server@1.33.0-alpha.13
18
+
19
+ ## 1.4.14-alpha.12
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`b59316f`](https://github.com/mastra-ai/mastra/commit/b59316ffa0f7688165b0f9c81ccdf85da461e5b2), [`55f1e2d`](https://github.com/mastra-ai/mastra/commit/55f1e2d65425b95a49ae788053b266f256e38c96), [`d48a705`](https://github.com/mastra-ai/mastra/commit/d48a705ff3dfbdc7a996e07ecd8293b5effd9a2a)]:
24
+ - @mastra/core@1.33.0-alpha.12
25
+ - @mastra/server@1.33.0-alpha.12
26
+
27
+ ## 1.4.14-alpha.11
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [[`37c0dc5`](https://github.com/mastra-ai/mastra/commit/37c0dc5697d343db98628bf867bf71ce6deec6d7), [`ef6b584`](https://github.com/mastra-ai/mastra/commit/ef6b5847ac33c0a7e80af3a86e8801e2933dd3ee), [`4dd900d`](https://github.com/mastra-ai/mastra/commit/4dd900d75dfe9be89f8c15188b368a8622aa1e18), [`4ff5bdf`](https://github.com/mastra-ai/mastra/commit/4ff5bdfe170cba6dfb5260c6af0f4ba668430772), [`bbcd93c`](https://github.com/mastra-ai/mastra/commit/bbcd93cf7d8aa1007d6d84bfd033b8015c912087), [`308bd07`](https://github.com/mastra-ai/mastra/commit/308bd074f35cef0c75d82fc1eb19382fe04ecf6f)]:
32
+ - @mastra/core@1.33.0-alpha.11
33
+ - @mastra/server@1.33.0-alpha.11
34
+
3
35
  ## 1.4.14-alpha.10
4
36
 
5
37
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@ var browserStream = require('@mastra/server/browser-stream');
8
8
 
9
9
  // src/index.ts
10
10
 
11
- // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/http-exception.js
11
+ // ../../node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/http-exception.js
12
12
  var HTTPException = class extends Error {
13
13
  res;
14
14
  status;
@@ -41,14 +41,8 @@ var HTTPException = class extends Error {
41
41
  }
42
42
  };
43
43
 
44
- // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/middleware/body-limit/index.js
44
+ // ../../node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/middleware/body-limit/index.js
45
45
  var ERROR_MESSAGE = "Payload Too Large";
46
- var BodyLimitError = class extends Error {
47
- constructor(message) {
48
- super(message);
49
- this.name = "BodyLimitError";
50
- }
51
- };
52
46
  var bodyLimit = (options) => {
53
47
  const onError = options.onError || (() => {
54
48
  const res = new Response(ERROR_MESSAGE, {
@@ -68,37 +62,36 @@ var bodyLimit = (options) => {
68
62
  return contentLength > maxSize ? onError(c) : next();
69
63
  }
70
64
  let size = 0;
65
+ const chunks = [];
71
66
  const rawReader = c.req.raw.body.getReader();
72
- const reader = new ReadableStream({
73
- async start(controller) {
74
- try {
75
- for (; ; ) {
76
- const { done, value } = await rawReader.read();
77
- if (done) {
78
- break;
79
- }
80
- size += value.length;
81
- if (size > maxSize) {
82
- controller.error(new BodyLimitError(ERROR_MESSAGE));
83
- break;
84
- }
85
- controller.enqueue(value);
67
+ for (; ; ) {
68
+ const { done, value } = await rawReader.read();
69
+ if (done) {
70
+ break;
71
+ }
72
+ size += value.length;
73
+ if (size > maxSize) {
74
+ return onError(c);
75
+ }
76
+ chunks.push(value);
77
+ }
78
+ const requestInit = {
79
+ body: new ReadableStream({
80
+ start(controller) {
81
+ for (const chunk of chunks) {
82
+ controller.enqueue(chunk);
86
83
  }
87
- } finally {
88
84
  controller.close();
89
85
  }
90
- }
91
- });
92
- const requestInit = { body: reader, duplex: "half" };
86
+ }),
87
+ duplex: "half"
88
+ };
93
89
  c.req.raw = new Request(c.req.raw, requestInit);
94
- await next();
95
- if (c.error instanceof BodyLimitError) {
96
- c.res = await onError(c);
97
- }
90
+ return next();
98
91
  };
99
92
  };
100
93
 
101
- // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/utils/stream.js
94
+ // ../../node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/utils/stream.js
102
95
  var StreamingApi = class {
103
96
  writer;
104
97
  encoder;
@@ -175,7 +168,7 @@ var StreamingApi = class {
175
168
  }
176
169
  };
177
170
 
178
- // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/helper/streaming/utils.js
171
+ // ../../node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/helper/streaming/utils.js
179
172
  var isOldBunVersion = () => {
180
173
  const version2 = typeof Bun !== "undefined" ? Bun.version : void 0;
181
174
  if (version2 === void 0) {
@@ -186,7 +179,7 @@ var isOldBunVersion = () => {
186
179
  return result;
187
180
  };
188
181
 
189
- // ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/helper/streaming/stream.js
182
+ // ../../node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/helper/streaming/stream.js
190
183
  var contextStash = /* @__PURE__ */ new WeakMap();
191
184
  var stream = (c, cb, onError) => {
192
185
  const { readable, writable } = new TransformStream();