@mastra/fastify 1.3.26-alpha.1 → 1.3.26-alpha.3

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/fastify
2
2
 
3
+ ## 1.3.26-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`8ace89d`](https://github.com/mastra-ai/mastra/commit/8ace89df77f762e622d3b9f7f65ad7524350d050), [`fa63872`](https://github.com/mastra-ai/mastra/commit/fa6387280954e6b667bec5714b55ba082bc627ff), [`f07b646`](https://github.com/mastra-ai/mastra/commit/f07b64604ab7d25391179790b7fd4823df9e2dff), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`40f9297`](https://github.com/mastra-ai/mastra/commit/40f9297003b921c62373d3e8d3a4bda76c9f6de3), [`0f0d1ba`](https://github.com/mastra-ai/mastra/commit/0f0d1ba67bfcb2204e571401662f1eceefc03357), [`8c31bcd`](https://github.com/mastra-ai/mastra/commit/8c31bcdb00e597880d5939b1b7d7566fbe5dacae), [`95b14cd`](https://github.com/mastra-ai/mastra/commit/95b14cdd820e86d97ac05fe568424c513a252e31), [`aa36be2`](https://github.com/mastra-ai/mastra/commit/aa36be23aa513b7dc53cb8ca16b7fab8f20e43ad), [`212c635`](https://github.com/mastra-ai/mastra/commit/212c635203e61d036ab41db8ff86c3893dc795b3), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`9aa5a73`](https://github.com/mastra-ai/mastra/commit/9aa5a73e7e110f6e9365eec69364a33d5f03bb56), [`f73c789`](https://github.com/mastra-ai/mastra/commit/f73c789e8ef21561580395d2c410119cab5848c8), [`8bd16da`](https://github.com/mastra-ai/mastra/commit/8bd16da73a4cb874d739373643dbd6a6e7f88684), [`c8630f8`](https://github.com/mastra-ai/mastra/commit/c8630f80d4f40cb5d22e60ab162b618b1907167a), [`47f71dc`](https://github.com/mastra-ai/mastra/commit/47f71dc6fbcbd12d71e21a979e676e20a02bd77d), [`50ceae2`](https://github.com/mastra-ai/mastra/commit/50ceae270878e2f8fb2b2c6c2faab09df0007c8a), [`8cdde58`](https://github.com/mastra-ai/mastra/commit/8cdde5875bbba6702d9df226f2b20232b8d75d6c), [`847ff1e`](https://github.com/mastra-ai/mastra/commit/847ff1e0d94368d94b2e173e4e0908e115568ef3), [`259d409`](https://github.com/mastra-ai/mastra/commit/259d409a514174299dbde1ff5e1121209b3ba850), [`9e16c68`](https://github.com/mastra-ai/mastra/commit/9e16c6818b6485ccb43df28aba6f3a2219d28662), [`cefca33`](https://github.com/mastra-ai/mastra/commit/cefca33ae666e69810c935fedf95a929c173d1d7), [`d00e8c5`](https://github.com/mastra-ai/mastra/commit/d00e8c50daebe5bce5bf2f48bde39c86fc3d2fe4), [`36fa7e2`](https://github.com/mastra-ai/mastra/commit/36fa7e24d14e58a1eb46147097b32f583e5b8775), [`87e9774`](https://github.com/mastra-ai/mastra/commit/87e97741c1e493cd6d62f478eb810b49bda4d57c), [`65a72e7`](https://github.com/mastra-ai/mastra/commit/65a72e70c25eedea8ff985a6624b96be2850236b), [`e9d54b2`](https://github.com/mastra-ai/mastra/commit/e9d54b281667477dd97b9dfc166b338f6d097fe8), [`59dde92`](https://github.com/mastra-ai/mastra/commit/59dde92dae0b2e2b0f936fbd9860e5b959bb059f), [`0f77241`](https://github.com/mastra-ai/mastra/commit/0f7724108806703799a8ba80ad0f09414afd5066), [`92ff509`](https://github.com/mastra-ai/mastra/commit/92ff5098ef8a990438ca038077021a5f7541ec1d), [`3fce5e7`](https://github.com/mastra-ai/mastra/commit/3fce5e70d011d289043e75003ef3336ed4aa43c3), [`a763592`](https://github.com/mastra-ai/mastra/commit/a763592c3db46963ef1011cfe16fe372816e775e), [`80c7737`](https://github.com/mastra-ai/mastra/commit/80c7737e32d7917b5f356957d67c169d01744fd3), [`3f1cf47`](https://github.com/mastra-ai/mastra/commit/3f1cf476f74c1e4cc2df908837e05853a5347e31)]:
8
+ - @mastra/core@1.38.0-alpha.3
9
+ - @mastra/server@1.38.0-alpha.3
10
+
11
+ ## 1.3.26-alpha.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Fixed validation error responses on routes with `bodySchema`, `queryParamSchema`, or `pathParamSchema` losing field path information when consumers pin `zod@^3`. 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`. Fixes [#17167](https://github.com/mastra-ai/mastra/issues/17167). ([#17172](https://github.com/mastra-ai/mastra/pull/17172))
16
+
17
+ - 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)]:
18
+ - @mastra/core@1.38.0-alpha.2
19
+ - @mastra/server@1.38.0-alpha.2
20
+
3
21
  ## 1.3.26-alpha.1
4
22
 
5
23
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -6,174 +6,6 @@ var requestContext = require('@mastra/core/request-context');
6
6
  var auth = require('@mastra/server/auth');
7
7
 
8
8
  // src/index.ts
9
-
10
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
11
- var _a;
12
- // @__NO_SIDE_EFFECTS__
13
- function $constructor(name, initializer3, params) {
14
- function init(inst, def) {
15
- if (!inst._zod) {
16
- Object.defineProperty(inst, "_zod", {
17
- value: {
18
- def,
19
- constr: _,
20
- traits: /* @__PURE__ */ new Set()
21
- },
22
- enumerable: false
23
- });
24
- }
25
- if (inst._zod.traits.has(name)) {
26
- return;
27
- }
28
- inst._zod.traits.add(name);
29
- initializer3(inst, def);
30
- const proto = _.prototype;
31
- const keys = Object.keys(proto);
32
- for (let i = 0; i < keys.length; i++) {
33
- const k = keys[i];
34
- if (!(k in inst)) {
35
- inst[k] = proto[k].bind(inst);
36
- }
37
- }
38
- }
39
- const Parent = params?.Parent ?? Object;
40
- class Definition extends Parent {
41
- }
42
- Object.defineProperty(Definition, "name", { value: name });
43
- function _(def) {
44
- var _a2;
45
- const inst = params?.Parent ? new Definition() : this;
46
- init(inst, def);
47
- (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
48
- for (const fn of inst._zod.deferred) {
49
- fn();
50
- }
51
- return inst;
52
- }
53
- Object.defineProperty(_, "init", { value: init });
54
- Object.defineProperty(_, Symbol.hasInstance, {
55
- value: (inst) => {
56
- if (params?.Parent && inst instanceof params.Parent)
57
- return true;
58
- return inst?._zod?.traits?.has(name);
59
- }
60
- });
61
- Object.defineProperty(_, "name", { value: name });
62
- return _;
63
- }
64
- (_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
65
-
66
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
67
- function jsonStringifyReplacer(_, value) {
68
- if (typeof value === "bigint")
69
- return value.toString();
70
- return value;
71
- }
72
-
73
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
74
- var initializer = (inst, def) => {
75
- inst.name = "$ZodError";
76
- Object.defineProperty(inst, "_zod", {
77
- value: inst._zod,
78
- enumerable: false
79
- });
80
- Object.defineProperty(inst, "issues", {
81
- value: def,
82
- enumerable: false
83
- });
84
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
85
- Object.defineProperty(inst, "toString", {
86
- value: () => inst.message,
87
- enumerable: false
88
- });
89
- };
90
- var $ZodError = $constructor("$ZodError", initializer);
91
- function flattenError(error, mapper = (issue) => issue.message) {
92
- const fieldErrors = {};
93
- const formErrors = [];
94
- for (const sub of error.issues) {
95
- if (sub.path.length > 0) {
96
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
97
- fieldErrors[sub.path[0]].push(mapper(sub));
98
- } else {
99
- formErrors.push(mapper(sub));
100
- }
101
- }
102
- return { formErrors, fieldErrors };
103
- }
104
- function formatError(error, mapper = (issue) => issue.message) {
105
- const fieldErrors = { _errors: [] };
106
- const processError = (error2, path = []) => {
107
- for (const issue of error2.issues) {
108
- if (issue.code === "invalid_union" && issue.errors.length) {
109
- issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
110
- } else if (issue.code === "invalid_key") {
111
- processError({ issues: issue.issues }, [...path, ...issue.path]);
112
- } else if (issue.code === "invalid_element") {
113
- processError({ issues: issue.issues }, [...path, ...issue.path]);
114
- } else {
115
- const fullpath = [...path, ...issue.path];
116
- if (fullpath.length === 0) {
117
- fieldErrors._errors.push(mapper(issue));
118
- } else {
119
- let curr = fieldErrors;
120
- let i = 0;
121
- while (i < fullpath.length) {
122
- const el = fullpath[i];
123
- const terminal = i === fullpath.length - 1;
124
- if (!terminal) {
125
- curr[el] = curr[el] || { _errors: [] };
126
- } else {
127
- curr[el] = curr[el] || { _errors: [] };
128
- curr[el]._errors.push(mapper(issue));
129
- }
130
- curr = curr[el];
131
- i++;
132
- }
133
- }
134
- }
135
- }
136
- };
137
- processError(error);
138
- return fieldErrors;
139
- }
140
-
141
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
142
- var initializer2 = (inst, issues) => {
143
- $ZodError.init(inst, issues);
144
- inst.name = "ZodError";
145
- Object.defineProperties(inst, {
146
- format: {
147
- value: (mapper) => formatError(inst, mapper)
148
- // enumerable: false,
149
- },
150
- flatten: {
151
- value: (mapper) => flattenError(inst, mapper)
152
- // enumerable: false,
153
- },
154
- addIssue: {
155
- value: (issue) => {
156
- inst.issues.push(issue);
157
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
158
- }
159
- // enumerable: false,
160
- },
161
- addIssues: {
162
- value: (issues2) => {
163
- inst.issues.push(...issues2);
164
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
165
- }
166
- // enumerable: false,
167
- },
168
- isEmpty: {
169
- get() {
170
- return inst.issues.length === 0;
171
- }
172
- // enumerable: false,
173
- }
174
- });
175
- };
176
- var ZodError = /* @__PURE__ */ $constructor("ZodError", initializer2);
177
9
  function toWebRequest(request) {
178
10
  const protocol = request.protocol || "http";
179
11
  const host = request.headers.host || "localhost";
@@ -645,7 +477,7 @@ var MastraServer = class extends serverAdapter.MastraServer {
645
477
  this.mastra.getLogger()?.error("Error parsing query params", {
646
478
  error: error instanceof Error ? { message: error.message, stack: error.stack } : error
647
479
  });
648
- if (error instanceof ZodError) {
480
+ if (serverAdapter.isZodError(error)) {
649
481
  const { status, body } = this.resolveValidationError(route, error, "query");
650
482
  return reply.status(status).send(body);
651
483
  }
@@ -662,7 +494,7 @@ var MastraServer = class extends serverAdapter.MastraServer {
662
494
  this.mastra.getLogger()?.error("Error parsing body", {
663
495
  error: error instanceof Error ? { message: error.message, stack: error.stack } : error
664
496
  });
665
- if (error instanceof ZodError) {
497
+ if (serverAdapter.isZodError(error)) {
666
498
  const { status, body } = this.resolveValidationError(route, error, "body");
667
499
  return reply.status(status).send(body);
668
500
  }
@@ -679,7 +511,7 @@ var MastraServer = class extends serverAdapter.MastraServer {
679
511
  this.mastra.getLogger()?.error("Error parsing path params", {
680
512
  error: error instanceof Error ? { message: error.message, stack: error.stack } : error
681
513
  });
682
- if (error instanceof ZodError) {
514
+ if (serverAdapter.isZodError(error)) {
683
515
  const { status, body } = this.resolveValidationError(route, error, "path");
684
516
  return reply.status(status).send(body);
685
517
  }