@mastra/deployer 1.37.2-alpha.1 → 1.38.0-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 +21 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/server/index.cjs +4 -158
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +5 -159
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -6
package/dist/server/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { existsSync, createReadStream, statSync } from 'fs';
|
|
|
12
12
|
import { versions } from 'process';
|
|
13
13
|
import { html } from 'hono/html';
|
|
14
14
|
import { Tool } from '@mastra/core/tools';
|
|
15
|
-
import { MastraServer as MastraServer$1, redactStreamChunk, normalizeQueryParams, checkRouteFGA } from '@mastra/server/server-adapter';
|
|
15
|
+
import { MastraServer as MastraServer$1, redactStreamChunk, normalizeQueryParams, isZodError, checkRouteFGA } from '@mastra/server/server-adapter';
|
|
16
16
|
import util from 'util';
|
|
17
17
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
18
18
|
import { bodyLimit } from 'hono/body-limit';
|
|
@@ -2759,160 +2759,6 @@ function toFetchResponse(res) {
|
|
|
2759
2759
|
}
|
|
2760
2760
|
return res.fetchResponse;
|
|
2761
2761
|
}
|
|
2762
|
-
var _a;
|
|
2763
|
-
// @__NO_SIDE_EFFECTS__
|
|
2764
|
-
function $constructor(name, initializer3, params) {
|
|
2765
|
-
function init(inst, def) {
|
|
2766
|
-
if (!inst._zod) {
|
|
2767
|
-
Object.defineProperty(inst, "_zod", {
|
|
2768
|
-
value: {
|
|
2769
|
-
def,
|
|
2770
|
-
constr: _,
|
|
2771
|
-
traits: /* @__PURE__ */ new Set()
|
|
2772
|
-
},
|
|
2773
|
-
enumerable: false
|
|
2774
|
-
});
|
|
2775
|
-
}
|
|
2776
|
-
if (inst._zod.traits.has(name)) {
|
|
2777
|
-
return;
|
|
2778
|
-
}
|
|
2779
|
-
inst._zod.traits.add(name);
|
|
2780
|
-
initializer3(inst, def);
|
|
2781
|
-
const proto = _.prototype;
|
|
2782
|
-
const keys = Object.keys(proto);
|
|
2783
|
-
for (let i = 0; i < keys.length; i++) {
|
|
2784
|
-
const k = keys[i];
|
|
2785
|
-
if (!(k in inst)) {
|
|
2786
|
-
inst[k] = proto[k].bind(inst);
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
}
|
|
2790
|
-
function _(def) {
|
|
2791
|
-
var _a2;
|
|
2792
|
-
const inst = this;
|
|
2793
|
-
init(inst, def);
|
|
2794
|
-
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
2795
|
-
for (const fn of inst._zod.deferred) {
|
|
2796
|
-
fn();
|
|
2797
|
-
}
|
|
2798
|
-
return inst;
|
|
2799
|
-
}
|
|
2800
|
-
Object.defineProperty(_, "init", { value: init });
|
|
2801
|
-
Object.defineProperty(_, Symbol.hasInstance, {
|
|
2802
|
-
value: (inst) => {
|
|
2803
|
-
return inst?._zod?.traits?.has(name);
|
|
2804
|
-
}
|
|
2805
|
-
});
|
|
2806
|
-
Object.defineProperty(_, "name", { value: name });
|
|
2807
|
-
return _;
|
|
2808
|
-
}
|
|
2809
|
-
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
2810
|
-
function jsonStringifyReplacer(_, value) {
|
|
2811
|
-
if (typeof value === "bigint")
|
|
2812
|
-
return value.toString();
|
|
2813
|
-
return value;
|
|
2814
|
-
}
|
|
2815
|
-
var initializer = (inst, def) => {
|
|
2816
|
-
inst.name = "$ZodError";
|
|
2817
|
-
Object.defineProperty(inst, "_zod", {
|
|
2818
|
-
value: inst._zod,
|
|
2819
|
-
enumerable: false
|
|
2820
|
-
});
|
|
2821
|
-
Object.defineProperty(inst, "issues", {
|
|
2822
|
-
value: def,
|
|
2823
|
-
enumerable: false
|
|
2824
|
-
});
|
|
2825
|
-
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
2826
|
-
Object.defineProperty(inst, "toString", {
|
|
2827
|
-
value: () => inst.message,
|
|
2828
|
-
enumerable: false
|
|
2829
|
-
});
|
|
2830
|
-
};
|
|
2831
|
-
var $ZodError = /* @__PURE__ */ $constructor("$ZodError", initializer);
|
|
2832
|
-
function flattenError(error, mapper = (issue) => issue.message) {
|
|
2833
|
-
const fieldErrors = {};
|
|
2834
|
-
const formErrors = [];
|
|
2835
|
-
for (const sub of error.issues) {
|
|
2836
|
-
if (sub.path.length > 0) {
|
|
2837
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
2838
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
2839
|
-
} else {
|
|
2840
|
-
formErrors.push(mapper(sub));
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
return { formErrors, fieldErrors };
|
|
2844
|
-
}
|
|
2845
|
-
function formatError(error, mapper = (issue) => issue.message) {
|
|
2846
|
-
const fieldErrors = { _errors: [] };
|
|
2847
|
-
const processError = (error2, path = []) => {
|
|
2848
|
-
for (const issue of error2.issues) {
|
|
2849
|
-
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
2850
|
-
issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
2851
|
-
} else if (issue.code === "invalid_key") {
|
|
2852
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
2853
|
-
} else if (issue.code === "invalid_element") {
|
|
2854
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
2855
|
-
} else {
|
|
2856
|
-
const fullpath = [...path, ...issue.path];
|
|
2857
|
-
if (fullpath.length === 0) {
|
|
2858
|
-
fieldErrors._errors.push(mapper(issue));
|
|
2859
|
-
} else {
|
|
2860
|
-
let curr = fieldErrors;
|
|
2861
|
-
let i = 0;
|
|
2862
|
-
while (i < fullpath.length) {
|
|
2863
|
-
const el = fullpath[i];
|
|
2864
|
-
const terminal = i === fullpath.length - 1;
|
|
2865
|
-
if (!terminal) {
|
|
2866
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
2867
|
-
} else {
|
|
2868
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
2869
|
-
curr[el]._errors.push(mapper(issue));
|
|
2870
|
-
}
|
|
2871
|
-
curr = curr[el];
|
|
2872
|
-
i++;
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
}
|
|
2877
|
-
};
|
|
2878
|
-
processError(error);
|
|
2879
|
-
return fieldErrors;
|
|
2880
|
-
}
|
|
2881
|
-
var initializer2 = (inst, issues) => {
|
|
2882
|
-
$ZodError.init(inst, issues);
|
|
2883
|
-
inst.name = "ZodError";
|
|
2884
|
-
Object.defineProperties(inst, {
|
|
2885
|
-
format: {
|
|
2886
|
-
value: (mapper) => formatError(inst, mapper)
|
|
2887
|
-
// enumerable: false,
|
|
2888
|
-
},
|
|
2889
|
-
flatten: {
|
|
2890
|
-
value: (mapper) => flattenError(inst, mapper)
|
|
2891
|
-
// enumerable: false,
|
|
2892
|
-
},
|
|
2893
|
-
addIssue: {
|
|
2894
|
-
value: (issue) => {
|
|
2895
|
-
inst.issues.push(issue);
|
|
2896
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
2897
|
-
}
|
|
2898
|
-
// enumerable: false,
|
|
2899
|
-
},
|
|
2900
|
-
addIssues: {
|
|
2901
|
-
value: (issues2) => {
|
|
2902
|
-
inst.issues.push(...issues2);
|
|
2903
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
2904
|
-
}
|
|
2905
|
-
// enumerable: false,
|
|
2906
|
-
},
|
|
2907
|
-
isEmpty: {
|
|
2908
|
-
get() {
|
|
2909
|
-
return inst.issues.length === 0;
|
|
2910
|
-
}
|
|
2911
|
-
// enumerable: false,
|
|
2912
|
-
}
|
|
2913
|
-
});
|
|
2914
|
-
};
|
|
2915
|
-
var ZodError = /* @__PURE__ */ $constructor("ZodError", initializer2);
|
|
2916
2762
|
async function setupBrowserStream(app, config) {
|
|
2917
2763
|
let createNodeWebSocket;
|
|
2918
2764
|
try {
|
|
@@ -3314,7 +3160,7 @@ var MastraServer = class extends MastraServer$1 {
|
|
|
3314
3160
|
this.mastra.getLogger()?.error("Error parsing query params", {
|
|
3315
3161
|
error: error instanceof Error ? { message: error.message, stack: error.stack } : error
|
|
3316
3162
|
});
|
|
3317
|
-
if (error
|
|
3163
|
+
if (isZodError(error)) {
|
|
3318
3164
|
const { status, body } = this.resolveValidationError(route, error, "query");
|
|
3319
3165
|
return c.json(body, status);
|
|
3320
3166
|
}
|
|
@@ -3334,7 +3180,7 @@ var MastraServer = class extends MastraServer$1 {
|
|
|
3334
3180
|
this.mastra.getLogger()?.error("Error parsing body", {
|
|
3335
3181
|
error: error instanceof Error ? { message: error.message, stack: error.stack } : error
|
|
3336
3182
|
});
|
|
3337
|
-
if (error
|
|
3183
|
+
if (isZodError(error)) {
|
|
3338
3184
|
const { status, body } = this.resolveValidationError(route, error, "body");
|
|
3339
3185
|
return c.json(body, status);
|
|
3340
3186
|
}
|
|
@@ -3354,7 +3200,7 @@ var MastraServer = class extends MastraServer$1 {
|
|
|
3354
3200
|
this.mastra.getLogger()?.error("Error parsing path params", {
|
|
3355
3201
|
error: error instanceof Error ? { message: error.message, stack: error.stack } : error
|
|
3356
3202
|
});
|
|
3357
|
-
if (error
|
|
3203
|
+
if (isZodError(error)) {
|
|
3358
3204
|
const { status, body } = this.resolveValidationError(route, error, "path");
|
|
3359
3205
|
return c.json(body, status);
|
|
3360
3206
|
}
|
|
@@ -4518,7 +4364,7 @@ async function createHonoServer(mastra, options = {
|
|
|
4518
4364
|
cloudApiEndpoint: `'${cloudApiEndpoint}'`,
|
|
4519
4365
|
experimentalFeatures: `'${experimentalFeatures}'`,
|
|
4520
4366
|
templates: `'${templatesEnabled}'`,
|
|
4521
|
-
telemetryDisabled: `''`,
|
|
4367
|
+
telemetryDisabled: `'${process.env.MASTRA_TELEMETRY_DISABLED ?? ""}'`,
|
|
4522
4368
|
requestContextPresets: `'${escapeForHtml(requestContextPresets)}'`,
|
|
4523
4369
|
experimentalUI: `'${experimentalUI}'`,
|
|
4524
4370
|
agentSignals: `'${agentSignals}'`,
|