@mastra/deployer 1.29.0-alpha.4 → 1.29.0-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.
@@ -3421,6 +3421,13 @@ var MastraServer = class extends MastraServer$1 {
3421
3421
  }
3422
3422
  async sendResponse(route, response, result, prefix) {
3423
3423
  const resolvedPrefix = prefix ?? this.prefix ?? "";
3424
+ if (result && typeof result === "object" && "__refreshHeaders" in result) {
3425
+ const refreshHeaders = result.__refreshHeaders;
3426
+ for (const [key, value] of Object.entries(refreshHeaders)) {
3427
+ response.header(key, value);
3428
+ }
3429
+ delete result.__refreshHeaders;
3430
+ }
3424
3431
  if (route.responseType === "json") {
3425
3432
  return response.json(result, 200);
3426
3433
  } else if (route.responseType === "stream") {
@@ -3490,7 +3497,7 @@ var MastraServer = class extends MastraServer$1 {
3490
3497
  `${prefix}${route.path}`,
3491
3498
  ...middlewares,
3492
3499
  async (c) => {
3493
- const authError = await this.checkRouteAuth(route, {
3500
+ const authResult = await this.checkRouteAuth(route, {
3494
3501
  path: c.req.path,
3495
3502
  method: c.req.method,
3496
3503
  getHeader: (name) => c.req.header(name),
@@ -3499,8 +3506,15 @@ var MastraServer = class extends MastraServer$1 {
3499
3506
  request: c.req.raw,
3500
3507
  buildAuthorizeContext: () => c
3501
3508
  });
3502
- if (authError) {
3503
- return c.json({ error: authError.error }, authError.status);
3509
+ if (authResult) {
3510
+ if (authResult.headers) {
3511
+ for (const [key, value] of Object.entries(authResult.headers)) {
3512
+ c.header(key, value);
3513
+ }
3514
+ }
3515
+ if (authResult.error) {
3516
+ return c.json({ error: authResult.error }, authResult.status);
3517
+ }
3504
3518
  }
3505
3519
  const params = await this.getParams(route, c.req);
3506
3520
  if (params.bodyParseError) {
@@ -3663,7 +3677,14 @@ var MastraServer = class extends MastraServer$1 {
3663
3677
  buildAuthorizeContext: () => c
3664
3678
  });
3665
3679
  if (authError) {
3666
- return c.json({ error: authError.error }, authError.status);
3680
+ if (authError.headers) {
3681
+ for (const [key, value] of Object.entries(authError.headers)) {
3682
+ c.header(key, value);
3683
+ }
3684
+ }
3685
+ if (authError.error) {
3686
+ return c.json({ error: authError.error }, authError.status);
3687
+ }
3667
3688
  }
3668
3689
  const authConfig = this.mastra.getServer()?.auth;
3669
3690
  if (authConfig) {