@mastra/deployer 1.29.0-alpha.1 → 1.29.0-alpha.2
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 +8 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/server/index.cjs +20 -13
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +20 -13
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -6
package/dist/server/index.js
CHANGED
|
@@ -3641,12 +3641,9 @@ var MastraServer = class extends MastraServer$1 {
|
|
|
3641
3641
|
);
|
|
3642
3642
|
}
|
|
3643
3643
|
async registerCustomApiRoutes() {
|
|
3644
|
-
|
|
3645
|
-
|
|
3644
|
+
if (!await this.buildCustomRouteHandler()) return;
|
|
3645
|
+
const routes = this.customApiRoutes ?? this.mastra.getServer()?.apiRoutes ?? [];
|
|
3646
3646
|
for (const route of routes) {
|
|
3647
|
-
const handler = "handler" in route && route.handler ? route.handler : "createHandler" in route ? await route.createHandler({ mastra: this.mastra }) : void 0;
|
|
3648
|
-
if (!handler) continue;
|
|
3649
|
-
const middlewares = [];
|
|
3650
3647
|
const serverRoute = {
|
|
3651
3648
|
method: route.method,
|
|
3652
3649
|
path: route.path,
|
|
@@ -3655,7 +3652,7 @@ var MastraServer = class extends MastraServer$1 {
|
|
|
3655
3652
|
},
|
|
3656
3653
|
requiresAuth: route.requiresAuth
|
|
3657
3654
|
};
|
|
3658
|
-
|
|
3655
|
+
const routeHandler = async (c) => {
|
|
3659
3656
|
const authError = await this.checkRouteAuth(serverRoute, {
|
|
3660
3657
|
path: c.req.path,
|
|
3661
3658
|
method: c.req.method,
|
|
@@ -3682,14 +3679,24 @@ var MastraServer = class extends MastraServer$1 {
|
|
|
3682
3679
|
}
|
|
3683
3680
|
}
|
|
3684
3681
|
}
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3682
|
+
const reqHeaders = {};
|
|
3683
|
+
c.req.raw.headers.forEach((v, k) => {
|
|
3684
|
+
reqHeaders[k] = v;
|
|
3685
|
+
});
|
|
3686
|
+
const response = await this.handleCustomRouteRequest(
|
|
3687
|
+
c.req.url,
|
|
3688
|
+
c.req.method,
|
|
3689
|
+
reqHeaders,
|
|
3690
|
+
c.req.raw.body,
|
|
3691
|
+
c.get("requestContext")
|
|
3692
|
+
);
|
|
3693
|
+
if (!response) {
|
|
3694
|
+
return c.json({ error: "Not Found" }, 404);
|
|
3695
|
+
}
|
|
3696
|
+
return response;
|
|
3697
|
+
};
|
|
3691
3698
|
const method = route.method.toLowerCase();
|
|
3692
|
-
this.app[method](route.path,
|
|
3699
|
+
this.app[method](route.path, routeHandler);
|
|
3693
3700
|
}
|
|
3694
3701
|
}
|
|
3695
3702
|
registerContextMiddleware() {
|