@mastra/hono 1.4.8-alpha.4 → 1.4.8-alpha.5
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 +12 -0
- package/dist/index.cjs +25 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @mastra/hono
|
|
2
2
|
|
|
3
|
+
## 1.4.8-alpha.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Authentication now refreshes expired server-side sessions transparently, so recoverable token expiry no longer causes unexpected user sign-outs. Only truly expired sessions (e.g. refresh token dead) return a 401. ([#15819](https://github.com/mastra-ai/mastra/pull/15819))
|
|
8
|
+
|
|
9
|
+
Server adapters now forward refreshed session cookies consistently, and auth-studio logs session validation and refresh failures to improve diagnostics.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`28caa5b`](https://github.com/mastra-ai/mastra/commit/28caa5b032358545af2589ed90636eccb4dd9d2f), [`a535ff2`](https://github.com/mastra-ai/mastra/commit/a535ff267cf525306de01c70bae95221ef66612b), [`7d056b6`](https://github.com/mastra-ai/mastra/commit/7d056b6ecf603cacaa0f663ff1df025ed885b6c1), [`26f1f94`](https://github.com/mastra-ai/mastra/commit/26f1f9490574b864ba1ecedf2c9632e0767a23bd)]:
|
|
12
|
+
- @mastra/core@1.29.0-alpha.5
|
|
13
|
+
- @mastra/server@1.29.0-alpha.5
|
|
14
|
+
|
|
3
15
|
## 1.4.8-alpha.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -725,6 +725,13 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
725
725
|
}
|
|
726
726
|
async sendResponse(route, response, result, prefix) {
|
|
727
727
|
const resolvedPrefix = prefix ?? this.prefix ?? "";
|
|
728
|
+
if (result && typeof result === "object" && "__refreshHeaders" in result) {
|
|
729
|
+
const refreshHeaders = result.__refreshHeaders;
|
|
730
|
+
for (const [key, value] of Object.entries(refreshHeaders)) {
|
|
731
|
+
response.header(key, value);
|
|
732
|
+
}
|
|
733
|
+
delete result.__refreshHeaders;
|
|
734
|
+
}
|
|
728
735
|
if (route.responseType === "json") {
|
|
729
736
|
return response.json(result, 200);
|
|
730
737
|
} else if (route.responseType === "stream") {
|
|
@@ -794,7 +801,7 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
794
801
|
`${prefix}${route.path}`,
|
|
795
802
|
...middlewares,
|
|
796
803
|
async (c) => {
|
|
797
|
-
const
|
|
804
|
+
const authResult = await this.checkRouteAuth(route, {
|
|
798
805
|
path: c.req.path,
|
|
799
806
|
method: c.req.method,
|
|
800
807
|
getHeader: (name) => c.req.header(name),
|
|
@@ -803,8 +810,15 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
803
810
|
request: c.req.raw,
|
|
804
811
|
buildAuthorizeContext: () => c
|
|
805
812
|
});
|
|
806
|
-
if (
|
|
807
|
-
|
|
813
|
+
if (authResult) {
|
|
814
|
+
if (authResult.headers) {
|
|
815
|
+
for (const [key, value] of Object.entries(authResult.headers)) {
|
|
816
|
+
c.header(key, value);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
if (authResult.error) {
|
|
820
|
+
return c.json({ error: authResult.error }, authResult.status);
|
|
821
|
+
}
|
|
808
822
|
}
|
|
809
823
|
const params = await this.getParams(route, c.req);
|
|
810
824
|
if (params.bodyParseError) {
|
|
@@ -967,7 +981,14 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
967
981
|
buildAuthorizeContext: () => c
|
|
968
982
|
});
|
|
969
983
|
if (authError) {
|
|
970
|
-
|
|
984
|
+
if (authError.headers) {
|
|
985
|
+
for (const [key, value] of Object.entries(authError.headers)) {
|
|
986
|
+
c.header(key, value);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
if (authError.error) {
|
|
990
|
+
return c.json({ error: authError.error }, authError.status);
|
|
991
|
+
}
|
|
971
992
|
}
|
|
972
993
|
const authConfig = this.mastra.getServer()?.auth;
|
|
973
994
|
if (authConfig) {
|