@mastra/deployer 1.65.0-alpha.1 → 1.65.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.
@@ -3,7 +3,7 @@ name: mastra-deployer
3
3
  description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/deployer"
6
- version: "1.65.0-alpha.1"
6
+ version: "1.65.0-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.65.0-alpha.1",
2
+ "version": "1.65.0-alpha.2",
3
3
  "package": "@mastra/deployer",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -3418,21 +3418,24 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
3418
3418
  }
3419
3419
  async registerRoute(app, route, { prefix: prefixParam } = {}) {
3420
3420
  const prefix = prefixParam ?? this.prefix ?? "";
3421
- const shouldApplyBodyLimit = this.bodyLimitOptions && [
3421
+ const maxSize = route.maxBodySize ?? this.bodyLimitOptions?.maxSize;
3422
+ const isBodyMethod = [
3422
3423
  "POST",
3423
3424
  "PUT",
3424
3425
  "PATCH",
3425
3426
  "DELETE"
3426
3427
  ].includes(route.method.toUpperCase());
3427
- const maxSize = route.maxBodySize ?? this.bodyLimitOptions?.maxSize;
3428
3428
  const middlewares = [];
3429
- if (shouldApplyBodyLimit && maxSize && this.bodyLimitOptions) {
3430
- const { onError } = this.bodyLimitOptions;
3431
- middlewares.push((0, hono_body_limit.bodyLimit)({
3432
- maxSize,
3433
- onError: (c) => c.json(onError({ error: "Request body too large" }), 413)
3434
- }));
3435
- }
3429
+ if (isBodyMethod && maxSize !== void 0) middlewares.push((0, hono_body_limit.bodyLimit)({
3430
+ maxSize,
3431
+ onError: (c) => {
3432
+ let errorResponse = { error: "Request body too large" };
3433
+ if (route.maxBodySize === void 0 && this.bodyLimitOptions) try {
3434
+ errorResponse = this.bodyLimitOptions.onError(errorResponse);
3435
+ } catch {}
3436
+ return c.json(errorResponse, 413);
3437
+ }
3438
+ }));
3436
3439
  app[route.method.toLowerCase()](`${prefix}${route.path}`, ...middlewares, async (c) => {
3437
3440
  const authResult = await this.checkRouteAuth(route, {
3438
3441
  path: c.req.path,
@@ -3558,6 +3561,8 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
3558
3561
  path: route.path,
3559
3562
  method: route.method
3560
3563
  });
3564
+ const customResponse = (0, _mastra_server_server_adapter.getCustomHTTPExceptionResponse)(error);
3565
+ if (customResponse) return customResponse;
3561
3566
  if (error && typeof error === "object") {
3562
3567
  if ("status" in error) {
3563
3568
  const status = error.status;