@mastra/nestjs 0.1.3-alpha.1 → 0.1.3-alpha.13

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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Logger, BadRequestException, Injectable, Inject, HttpException, HttpStatus, Catch, UnauthorizedException, ForbiddenException, Scope, ServiceUnavailableException, NotFoundException, All, Req, Res, Controller, UseInterceptors, UseFilters, UseGuards, Get, PayloadTooLargeException, Module, SetMetadata } from '@nestjs/common';
2
- import { SERVER_ROUTES, redactStreamChunk, normalizeQueryParams } from '@mastra/server/server-adapter';
2
+ import { SERVER_ROUTES, isReservedRequestContextKey, isStudioClientTypeHeader, MASTRA_CLIENT_TYPE_HEADER, MASTRA_IS_STUDIO_KEY, redactStreamChunk, normalizeQueryParams } from '@mastra/server/server-adapter';
3
3
  import { formatZodError } from '@mastra/server/handlers/error';
4
4
  import { isDevPlaygroundRequest, isProtectedPath, canAccessPublicly, checkRules, defaultAuthConfig } from '@mastra/server/auth';
5
5
  import { RequestContext } from '@mastra/core/request-context';
@@ -12514,6 +12514,7 @@ var RequestContextService = class _RequestContextService {
12514
12514
  throw error;
12515
12515
  }
12516
12516
  }
12517
+ this.applyRequestMetadata(context);
12517
12518
  return context;
12518
12519
  }
12519
12520
  /**
@@ -12540,9 +12541,15 @@ var RequestContextService = class _RequestContextService {
12540
12541
  */
12541
12542
  mergeContext(context, values) {
12542
12543
  for (const [key, value] of Object.entries(values)) {
12544
+ if (isReservedRequestContextKey(key)) continue;
12543
12545
  context.set(key, value);
12544
12546
  }
12545
12547
  }
12548
+ applyRequestMetadata(context) {
12549
+ if (isStudioClientTypeHeader(this.request.get(MASTRA_CLIENT_TYPE_HEADER))) {
12550
+ context.set(MASTRA_IS_STUDIO_KEY, true);
12551
+ }
12552
+ }
12546
12553
  /**
12547
12554
  * Setup abort handling for client disconnection.
12548
12555
  */