@mastra/deployer 1.83.0-alpha.0 → 1.83.0-alpha.10
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/{analyze-DJ-g40iE.cjs → analyze-BBFIIBmH.cjs} +30 -13
- package/dist/analyze-BBFIIBmH.cjs.map +1 -0
- package/dist/{analyze-fYsu753O.js → analyze-DO5iGgpf.js} +30 -13
- package/dist/analyze-DO5iGgpf.js.map +1 -0
- package/dist/build/analyze/analyzeEntry.d.ts +3 -1
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze.cjs +1 -1
- package/dist/build/analyze.d.ts +6 -1
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/babel/detect-pino-transports.d.ts +6 -0
- package/dist/build/babel/detect-pino-transports.d.ts.map +1 -1
- package/dist/build/bundler.cjs +1 -1
- package/dist/build/bundler.d.ts +3 -1
- package/dist/build/bundler.d.ts.map +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/fs-routing/codegen.d.ts +2 -1
- package/dist/build/fs-routing/codegen.d.ts.map +1 -1
- package/dist/build/index.cjs +4 -4
- package/dist/build/index.js +4 -4
- package/dist/build/plugins/node-modules-extension-resolver.d.ts.map +1 -1
- package/dist/build/plugins/remove-deployer.d.ts.map +1 -1
- package/dist/build/shared/extract-mastra-option.d.ts.map +1 -1
- package/dist/build/watcher.d.ts +3 -1
- package/dist/build/watcher.d.ts.map +1 -1
- package/dist/{build-dIfHk6xF.js → build-AGyF63xq.js} +27 -18
- package/dist/build-AGyF63xq.js.map +1 -0
- package/dist/{build-DJrBURvF.cjs → build-DH0yT1Zp.cjs} +27 -18
- package/dist/build-DH0yT1Zp.cjs.map +1 -0
- package/dist/bundler/index.cjs +1 -1
- package/dist/bundler/index.d.ts +4 -2
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{bundler-UKxJsU8E.cjs → bundler-BZ4fSyJZ.cjs} +8 -6
- package/dist/bundler-BZ4fSyJZ.cjs.map +1 -0
- package/dist/{bundler-DBj7Xv0j.js → bundler-BadvdlF2.js} +18 -11
- package/dist/bundler-BadvdlF2.js.map +1 -0
- package/dist/{bundler-gVxl78M9.cjs → bundler-CRzGd7dU.cjs} +18 -11
- package/dist/bundler-CRzGd7dU.cjs.map +1 -0
- package/dist/{bundler-CbiKhVps.js → bundler-DSGZrLqs.js} +8 -6
- package/dist/bundler-DSGZrLqs.js.map +1 -0
- package/dist/{bundlerOptions-CklrCRoZ.js → bundlerOptions-DUh9CO6S.js} +4 -3
- package/dist/{bundlerOptions-CklrCRoZ.js.map → bundlerOptions-DUh9CO6S.js.map} +1 -1
- package/dist/{bundlerOptions-DxMLiEfQ.cjs → bundlerOptions-Z4D-MNeR.cjs} +4 -3
- package/dist/{bundlerOptions-DxMLiEfQ.cjs.map → bundlerOptions-Z4D-MNeR.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-deployment-mastra-server.md +10 -2
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/server/index.cjs +40 -17
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +40 -17
- package/dist/server/index.js.map +1 -1
- package/package.json +5 -6
- package/dist/analyze-DJ-g40iE.cjs.map +0 -1
- package/dist/analyze-fYsu753O.js.map +0 -1
- package/dist/build-DJrBURvF.cjs.map +0 -1
- package/dist/build-dIfHk6xF.js.map +0 -1
- package/dist/bundler-CbiKhVps.js.map +0 -1
- package/dist/bundler-DBj7Xv0j.js.map +0 -1
- package/dist/bundler-UKxJsU8E.cjs.map +0 -1
- package/dist/bundler-gVxl78M9.cjs.map +0 -1
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.0 → @mastra_hono@1.7.25-alpha.10}/dist/auth-middleware.d.ts +0 -0
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.0 → @mastra_hono@1.7.25-alpha.10}/dist/browser-stream/index.d.ts +0 -0
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.0 → @mastra_hono@1.7.25-alpha.10}/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.0 → @mastra_hono@1.7.25-alpha.10}/package.json +0 -0
package/dist/server/index.cjs
CHANGED
|
@@ -3614,6 +3614,27 @@ const BODY_METHODS = /* @__PURE__ */ new Set([
|
|
|
3614
3614
|
"PATCH",
|
|
3615
3615
|
"DELETE"
|
|
3616
3616
|
]);
|
|
3617
|
+
/**
|
|
3618
|
+
* Cancels a response body the runtime never started reading once the request aborts. @hono/node-server skips the body
|
|
3619
|
+
* of a request that closed while the route handler ran without cancelling it. A body the runtime already reads is
|
|
3620
|
+
* locked, and the runtime cancels that one itself on disconnect.
|
|
3621
|
+
*
|
|
3622
|
+
* `body` is only read after the abort: reading it earlier turns off @hono/node-server's fast path for string and byte
|
|
3623
|
+
* bodies, which is what sets `Content-Length` and the default content type.
|
|
3624
|
+
*/
|
|
3625
|
+
function cancelUnreadBodyOnAbort(response, signal) {
|
|
3626
|
+
const cancel = () => {
|
|
3627
|
+
let body;
|
|
3628
|
+
try {
|
|
3629
|
+
body = response.body;
|
|
3630
|
+
} catch {
|
|
3631
|
+
return;
|
|
3632
|
+
}
|
|
3633
|
+
if (body && !body.locked) body.cancel("request aborted").catch(() => {});
|
|
3634
|
+
};
|
|
3635
|
+
if (signal.aborted) cancel();
|
|
3636
|
+
else signal.addEventListener("abort", cancel, { once: true });
|
|
3637
|
+
}
|
|
3617
3638
|
var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
|
|
3618
3639
|
createContextMiddleware() {
|
|
3619
3640
|
return async (c, next) => {
|
|
@@ -3675,12 +3696,16 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
|
|
|
3675
3696
|
} else res.header("Content-Type", "text/plain");
|
|
3676
3697
|
res.header("Transfer-Encoding", "chunked");
|
|
3677
3698
|
return (0, hono_streaming.stream)(res, async (stream) => {
|
|
3678
|
-
if (streamFormat === "sse" && route.sseFlushOnConnect) await stream.write(": connected\n\n");
|
|
3679
3699
|
const reader = (result instanceof ReadableStream ? result : result.fullStream).getReader();
|
|
3680
3700
|
stream.onAbort(() => {
|
|
3681
3701
|
reader.cancel("request aborted").catch(() => {});
|
|
3682
3702
|
});
|
|
3703
|
+
const signal = res.req.raw.signal;
|
|
3704
|
+
const abortStream = () => stream.abort();
|
|
3705
|
+
if (signal.aborted) abortStream();
|
|
3706
|
+
else signal.addEventListener("abort", abortStream, { once: true });
|
|
3683
3707
|
try {
|
|
3708
|
+
if (streamFormat === "sse" && route.sseFlushOnConnect) await stream.write(": connected\n\n");
|
|
3684
3709
|
while (true) {
|
|
3685
3710
|
const { done, value } = await reader.read();
|
|
3686
3711
|
if (done) break;
|
|
@@ -3710,6 +3735,7 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
|
|
|
3710
3735
|
stack: error.stack
|
|
3711
3736
|
} : error });
|
|
3712
3737
|
} finally {
|
|
3738
|
+
signal.removeEventListener("abort", abortStream);
|
|
3713
3739
|
await stream.close();
|
|
3714
3740
|
}
|
|
3715
3741
|
}, async (err) => {
|
|
@@ -3785,8 +3811,11 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
|
|
|
3785
3811
|
}
|
|
3786
3812
|
if (route.responseType === "json") return response.json(result, 200);
|
|
3787
3813
|
else if (route.responseType === "stream") return this.stream(route, response, result);
|
|
3788
|
-
else if (route.responseType === "datastream-response")
|
|
3789
|
-
|
|
3814
|
+
else if (route.responseType === "datastream-response") {
|
|
3815
|
+
const fetchResponse = result;
|
|
3816
|
+
cancelUnreadBodyOnAbort(fetchResponse, response.req.raw.signal);
|
|
3817
|
+
return fetchResponse;
|
|
3818
|
+
} else if (route.responseType === "mcp-http") {
|
|
3790
3819
|
const { server, httpPath, mcpOptions: routeMcpOptions } = result;
|
|
3791
3820
|
const { req, res } = toReqRes(response.req.raw);
|
|
3792
3821
|
const { setRequestAuth, ...options } = {
|
|
@@ -4005,16 +4034,8 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
|
|
|
4005
4034
|
const routes = await this.registerSchemaApiRoutes();
|
|
4006
4035
|
if (!await this.buildCustomRouteHandler(routes)) return;
|
|
4007
4036
|
for (const route of routes) {
|
|
4008
|
-
const serverRoute = {
|
|
4009
|
-
method: route.method,
|
|
4010
|
-
path: route.path,
|
|
4011
|
-
responseType: "json",
|
|
4012
|
-
handler: async () => {},
|
|
4013
|
-
requiresAuth: route.requiresAuth,
|
|
4014
|
-
requiresPermission: route.requiresPermission,
|
|
4015
|
-
fga: route.fga
|
|
4016
|
-
};
|
|
4017
4037
|
const routeHandler = async (c) => {
|
|
4038
|
+
const { match, serverRoute, customRouteAuthConfig } = this.resolveCustomRouteAuth(c.req.url, c.req.method, c.req.path, route);
|
|
4018
4039
|
const authError = await this.checkRouteAuth(serverRoute, {
|
|
4019
4040
|
path: c.req.path,
|
|
4020
4041
|
method: c.req.method,
|
|
@@ -4022,7 +4043,8 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
|
|
|
4022
4043
|
getQuery: (name) => c.req.query(name),
|
|
4023
4044
|
requestContext: c.get("requestContext"),
|
|
4024
4045
|
request: c.req.raw,
|
|
4025
|
-
buildAuthorizeContext: () => c
|
|
4046
|
+
buildAuthorizeContext: () => c,
|
|
4047
|
+
customRouteAuthConfig
|
|
4026
4048
|
});
|
|
4027
4049
|
if (authError) {
|
|
4028
4050
|
if (authError.headers) for (const [key, value] of Object.entries(authError.headers)) c.header(key, value);
|
|
@@ -4059,7 +4081,7 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
|
|
|
4059
4081
|
const fgaError = await (0, _mastra_server_server_adapter.checkRouteFGA)(this.mastra, serverRoute, c.get("requestContext"), {
|
|
4060
4082
|
...Object.fromEntries(new URL(c.req.url).searchParams.entries()),
|
|
4061
4083
|
...bodyParams,
|
|
4062
|
-
...c.req.param()
|
|
4084
|
+
...match ? match.params : c.req.param()
|
|
4063
4085
|
});
|
|
4064
4086
|
if (fgaError) return c.json({
|
|
4065
4087
|
error: fgaError.error,
|
|
@@ -4859,8 +4881,9 @@ const DEFAULT_CORS_ALLOW_HEADERS = [
|
|
|
4859
4881
|
const DEFAULT_CORS_EXPOSE_HEADERS = ["Content-Length", "X-Requested-With"];
|
|
4860
4882
|
function getCorsConfig(serverCors, credentialsDefault) {
|
|
4861
4883
|
const userCors = serverCors && typeof serverCors === "object" ? serverCors : void 0;
|
|
4862
|
-
const
|
|
4863
|
-
const
|
|
4884
|
+
const hasExplicitOrigin = !!(userCors && "origin" in userCors && userCors.origin);
|
|
4885
|
+
const origin = hasExplicitOrigin ? userCors.origin : credentialsDefault ? (requestOrigin) => requestOrigin || void 0 : "*";
|
|
4886
|
+
const credentials = userCors && "credentials" in userCors ? userCors.credentials : credentialsDefault && hasExplicitOrigin;
|
|
4864
4887
|
return {
|
|
4865
4888
|
origin,
|
|
4866
4889
|
allowMethods: DEFAULT_CORS_ALLOW_METHODS,
|
|
@@ -5171,7 +5194,7 @@ async function createNodeServer(mastra, options = { tools: {} }) {
|
|
|
5171
5194
|
import("@mastra/core/telemetry").then(({ syncUsageTelemetry }) => syncUsageTelemetry(mastra)).catch(() => {});
|
|
5172
5195
|
import("@mastra/core/telemetry").then(({ syncFeatureUsageTelemetry }) => syncFeatureUsageTelemetry(mastra)).catch(() => {});
|
|
5173
5196
|
if (serverOptions?.handleShutdownSignals !== false) {
|
|
5174
|
-
const CORE_SHUTDOWN_TIMEOUT_MS =
|
|
5197
|
+
const CORE_SHUTDOWN_TIMEOUT_MS = 6500;
|
|
5175
5198
|
const timedOut = Symbol("shutdown-timeout");
|
|
5176
5199
|
const race = async (work, ms) => {
|
|
5177
5200
|
let timeout;
|