@mastra/nestjs 0.2.0 → 0.2.1-alpha.1
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 +20 -0
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/interceptors/streaming.interceptor.d.ts.map +1 -1
- package/package.json +7 -7
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, isZodError, isReservedRequestContextKey, isStudioClientTypeHeader, MASTRA_CLIENT_TYPE_HEADER, MASTRA_IS_STUDIO_KEY, redactStreamChunk, normalizeQueryParams } from '@mastra/server/server-adapter';
|
|
2
|
+
import { SERVER_ROUTES, isZodError, isReservedRequestContextKey, isStudioClientTypeHeader, MASTRA_CLIENT_TYPE_HEADER, MASTRA_IS_STUDIO_KEY, redactStreamChunk, serializeStreamChunk, normalizeQueryParams } from '@mastra/server/server-adapter';
|
|
3
3
|
import { isZodError as isZodError$1, 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';
|
|
@@ -12998,12 +12998,17 @@ var StreamingInterceptor = class _StreamingInterceptor {
|
|
|
12998
12998
|
continue;
|
|
12999
12999
|
}
|
|
13000
13000
|
const outputValue = shouldRedact ? redactStreamChunk(value) : value;
|
|
13001
|
+
const serialized = serializeStreamChunk(outputValue);
|
|
13002
|
+
if (!serialized.ok) {
|
|
13003
|
+
this.logger.error(`Failed to serialize stream chunk, skipping (path: ${response.req?.path}, type: ${outputValue?.type}, error: ${serialized.error.message})`);
|
|
13004
|
+
continue;
|
|
13005
|
+
}
|
|
13001
13006
|
if (streamFormat === "sse") {
|
|
13002
|
-
response.write(`data: ${
|
|
13007
|
+
response.write(`data: ${serialized.json}
|
|
13003
13008
|
|
|
13004
13009
|
`);
|
|
13005
13010
|
} else {
|
|
13006
|
-
response.write(
|
|
13011
|
+
response.write(serialized.json + "");
|
|
13007
13012
|
}
|
|
13008
13013
|
}
|
|
13009
13014
|
}
|