@mastra/nestjs 0.1.10-alpha.1 → 0.1.10-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 +14 -0
- package/dist/filters/mastra-exception.filter.d.ts.map +1 -1
- package/dist/index.cjs +4 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -15
- package/dist/index.js.map +1 -1
- package/dist/services/route-handler.service.d.ts +9 -4
- package/dist/services/route-handler.service.d.ts.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @mastra/nestjs
|
|
2
2
|
|
|
3
|
+
## 0.1.10-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed validation error responses on routes with `bodySchema`, `queryParamSchema`, or `pathParamSchema` losing field path information when consumers pin a different `zod` major than the one bundled with this adapter. Responses now return the actual field name in `issues[].field` (e.g. `"agent_id"`) instead of `"unknown"` with the raw Zod issues serialized into `issues[0].message`. ([#17172](https://github.com/mastra-ai/mastra/pull/17172))
|
|
8
|
+
|
|
9
|
+
`ValidationError.zodError` is now typed as `ZodErrorLike` (a structural subset of `ZodError` exposing `issues[]`) so consumers pinning a different `zod` major still type-check. The runtime value is unchanged; cast to your installed `ZodError` type if you need its instance methods.
|
|
10
|
+
|
|
11
|
+
Fixes [#17167](https://github.com/mastra-ai/mastra/issues/17167).
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`d779de3`](https://github.com/mastra-ai/mastra/commit/d779de3cd9d2e7ed8110547190e2f15e786a0e41), [`1750c97`](https://github.com/mastra-ai/mastra/commit/1750c975d6179fbf6db2813b15229d4f8f23fc55), [`09972fe`](https://github.com/mastra-ai/mastra/commit/09972fe6b7b92ade32d70deda7094af2e52b2676), [`0e32507`](https://github.com/mastra-ai/mastra/commit/0e32507962cdfa5569b7bda5bc6fb3dd34e40b03), [`3a081c1`](https://github.com/mastra-ai/mastra/commit/3a081c1255c5ae8c99f6dad91cc612934ef6f2bd), [`fe9eacd`](https://github.com/mastra-ai/mastra/commit/fe9eacd9545a0a9d64aad31c9fa90294a425289e), [`db79c86`](https://github.com/mastra-ai/mastra/commit/db79c86c60723d57e02f9636ca2611bd4515f194)]:
|
|
14
|
+
- @mastra/core@1.38.0-alpha.2
|
|
15
|
+
- @mastra/server@1.38.0-alpha.2
|
|
16
|
+
|
|
3
17
|
## 0.1.10-alpha.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mastra-exception.filter.d.ts","sourceRoot":"","sources":["../../src/filters/mastra-exception.filter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"mastra-exception.filter.d.ts","sourceRoot":"","sources":["../../src/filters/mastra-exception.filter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAYrE;;;;;;;;;;;;;GAaG;AACH,qBACa,qBAAsB,YAAW,eAAe;IAC3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;IAEjE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI;IAkCpD;;OAEG;IACH,OAAO,CAAC,cAAc;IAgHtB;;OAEG;IACH,OAAO,CAAC,YAAY;CAkCrB"}
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var common = require('@nestjs/common');
|
|
4
4
|
var serverAdapter = require('@mastra/server/server-adapter');
|
|
5
5
|
var error = require('@mastra/server/handlers/error');
|
|
6
|
-
var zod = require('zod');
|
|
7
6
|
var auth = require('@mastra/server/auth');
|
|
8
7
|
var requestContext = require('@mastra/core/request-context');
|
|
9
8
|
var core = require('@nestjs/core');
|
|
@@ -11670,10 +11669,6 @@ function _ts_param(paramIndex, decorator) {
|
|
|
11670
11669
|
};
|
|
11671
11670
|
}
|
|
11672
11671
|
__name(_ts_param, "_ts_param");
|
|
11673
|
-
function isZodErrorLike(error) {
|
|
11674
|
-
return error instanceof zod.ZodError || typeof error === "object" && error !== null && "name" in error && error.name === "ZodError" && "issues" in error && Array.isArray(error.issues);
|
|
11675
|
-
}
|
|
11676
|
-
__name(isZodErrorLike, "isZodErrorLike");
|
|
11677
11672
|
exports.RouteHandlerService = class _RouteHandlerService {
|
|
11678
11673
|
static {
|
|
11679
11674
|
__name(this, "RouteHandlerService");
|
|
@@ -11792,7 +11787,7 @@ exports.RouteHandlerService = class _RouteHandlerService {
|
|
|
11792
11787
|
try {
|
|
11793
11788
|
validatedPathParams = await route.pathParamSchema.parseAsync(params.pathParams);
|
|
11794
11789
|
} catch (error) {
|
|
11795
|
-
if (
|
|
11790
|
+
if (serverAdapter.isZodError(error)) {
|
|
11796
11791
|
throw new ValidationError("Invalid path parameters", error);
|
|
11797
11792
|
}
|
|
11798
11793
|
throw error;
|
|
@@ -11803,7 +11798,7 @@ exports.RouteHandlerService = class _RouteHandlerService {
|
|
|
11803
11798
|
try {
|
|
11804
11799
|
validatedQueryParams = await route.queryParamSchema.parseAsync(params.queryParams);
|
|
11805
11800
|
} catch (error) {
|
|
11806
|
-
if (
|
|
11801
|
+
if (serverAdapter.isZodError(error)) {
|
|
11807
11802
|
throw new ValidationError("Invalid query parameters", error);
|
|
11808
11803
|
}
|
|
11809
11804
|
throw error;
|
|
@@ -11814,7 +11809,7 @@ exports.RouteHandlerService = class _RouteHandlerService {
|
|
|
11814
11809
|
try {
|
|
11815
11810
|
validatedBody = await route.bodySchema.parseAsync(params.body);
|
|
11816
11811
|
} catch (error) {
|
|
11817
|
-
if (
|
|
11812
|
+
if (serverAdapter.isZodError(error)) {
|
|
11818
11813
|
throw new ValidationError("Invalid request body", error);
|
|
11819
11814
|
}
|
|
11820
11815
|
throw error;
|
|
@@ -11889,10 +11884,6 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
11889
11884
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11890
11885
|
}
|
|
11891
11886
|
__name(_ts_decorate2, "_ts_decorate");
|
|
11892
|
-
function isZodErrorLike2(exception) {
|
|
11893
|
-
return exception instanceof zod.ZodError || typeof exception === "object" && exception !== null && "name" in exception && exception.name === "ZodError" && "issues" in exception && Array.isArray(exception.issues);
|
|
11894
|
-
}
|
|
11895
|
-
__name(isZodErrorLike2, "isZodErrorLike");
|
|
11896
11887
|
exports.MastraExceptionFilter = class _MastraExceptionFilter {
|
|
11897
11888
|
static {
|
|
11898
11889
|
__name(this, "MastraExceptionFilter");
|
|
@@ -11964,7 +11955,7 @@ exports.MastraExceptionFilter = class _MastraExceptionFilter {
|
|
|
11964
11955
|
code: this.getErrorCode(status)
|
|
11965
11956
|
};
|
|
11966
11957
|
}
|
|
11967
|
-
if (
|
|
11958
|
+
if (error.isZodError(exception)) {
|
|
11968
11959
|
const formatted = error.formatZodError(exception, "request");
|
|
11969
11960
|
return {
|
|
11970
11961
|
status: common.HttpStatus.BAD_REQUEST,
|