@mastra/hono 1.4.8-alpha.1 → 1.4.8-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 +18 -0
- package/dist/index.cjs +20 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -13
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/hono
|
|
2
2
|
|
|
3
|
+
## 1.4.8-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`c04417b`](https://github.com/mastra-ai/mastra/commit/c04417ba0a2e4ded66da4352331ef29cd4bd1d79), [`cf25a03`](https://github.com/mastra-ai/mastra/commit/cf25a03132164b9dc1e5dccf7394824e33007c51), [`ba6b0c5`](https://github.com/mastra-ai/mastra/commit/ba6b0c51bfce358554fd33c7f2bcd5593633f2ff)]:
|
|
8
|
+
- @mastra/core@1.29.0-alpha.3
|
|
9
|
+
- @mastra/server@1.29.0-alpha.3
|
|
10
|
+
|
|
11
|
+
## 1.4.8-alpha.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Refactored Hono adapter's `registerCustomApiRoutes()` to use the shared `buildCustomRouteHandler()` from the base class instead of duplicating route/handler resolution logic. Added `forwardCustomRouteRequest()` to the base class for adapters that already have a raw `Request` object (avoiding unnecessary request reconstruction). ([#15793](https://github.com/mastra-ai/mastra/pull/15793))
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`9e973b0`](https://github.com/mastra-ai/mastra/commit/9e973b010dacfa15ac82b0072897319f5234b90a), [`dd934a0`](https://github.com/mastra-ai/mastra/commit/dd934a0982ce0f78712fbd559e4f2410bf594b39), [`73f2809`](https://github.com/mastra-ai/mastra/commit/73f2809721db24e98cdf122539652a455211b450), [`f85ab4a`](https://github.com/mastra-ai/mastra/commit/f85ab4a3cce3d4376a4fc3c08feeb380cee2927c), [`aedeea4`](https://github.com/mastra-ai/mastra/commit/aedeea48a94f728323f040478775076b9574be50), [`a9a3463`](https://github.com/mastra-ai/mastra/commit/a9a34638b16d0956f35290a52ed0a44cd926110b), [`441670a`](https://github.com/mastra-ai/mastra/commit/441670a02c9dc7731c52674f55481e7848a84523), [`8126d86`](https://github.com/mastra-ai/mastra/commit/8126d8638411eacfafdc29036ac998e8757ea66f), [`ae97520`](https://github.com/mastra-ai/mastra/commit/ae975206fdb0f6ef03c4d5bf94f7dc7c3f706c02), [`441670a`](https://github.com/mastra-ai/mastra/commit/441670a02c9dc7731c52674f55481e7848a84523)]:
|
|
18
|
+
- @mastra/core@1.29.0-alpha.2
|
|
19
|
+
- @mastra/server@1.29.0-alpha.2
|
|
20
|
+
|
|
3
21
|
## 1.4.8-alpha.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -945,12 +945,9 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
945
945
|
);
|
|
946
946
|
}
|
|
947
947
|
async registerCustomApiRoutes() {
|
|
948
|
-
|
|
949
|
-
|
|
948
|
+
if (!await this.buildCustomRouteHandler()) return;
|
|
949
|
+
const routes = this.customApiRoutes ?? this.mastra.getServer()?.apiRoutes ?? [];
|
|
950
950
|
for (const route of routes) {
|
|
951
|
-
const handler = "handler" in route && route.handler ? route.handler : "createHandler" in route ? await route.createHandler({ mastra: this.mastra }) : void 0;
|
|
952
|
-
if (!handler) continue;
|
|
953
|
-
const middlewares = [];
|
|
954
951
|
const serverRoute = {
|
|
955
952
|
method: route.method,
|
|
956
953
|
path: route.path,
|
|
@@ -959,7 +956,7 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
959
956
|
},
|
|
960
957
|
requiresAuth: route.requiresAuth
|
|
961
958
|
};
|
|
962
|
-
|
|
959
|
+
const routeHandler = async (c) => {
|
|
963
960
|
const authError = await this.checkRouteAuth(serverRoute, {
|
|
964
961
|
path: c.req.path,
|
|
965
962
|
method: c.req.method,
|
|
@@ -986,14 +983,24 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
986
983
|
}
|
|
987
984
|
}
|
|
988
985
|
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
986
|
+
const reqHeaders = {};
|
|
987
|
+
c.req.raw.headers.forEach((v, k) => {
|
|
988
|
+
reqHeaders[k] = v;
|
|
989
|
+
});
|
|
990
|
+
const response = await this.handleCustomRouteRequest(
|
|
991
|
+
c.req.url,
|
|
992
|
+
c.req.method,
|
|
993
|
+
reqHeaders,
|
|
994
|
+
c.req.raw.body,
|
|
995
|
+
c.get("requestContext")
|
|
996
|
+
);
|
|
997
|
+
if (!response) {
|
|
998
|
+
return c.json({ error: "Not Found" }, 404);
|
|
999
|
+
}
|
|
1000
|
+
return response;
|
|
1001
|
+
};
|
|
995
1002
|
const method = route.method.toLowerCase();
|
|
996
|
-
this.app[method](route.path,
|
|
1003
|
+
this.app[method](route.path, routeHandler);
|
|
997
1004
|
}
|
|
998
1005
|
}
|
|
999
1006
|
registerContextMiddleware() {
|