@mastra/deployer 1.83.0-alpha.9 → 1.84.0-alpha.0
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/_types/{@mastra_hono@1.7.25-alpha.9 → @mastra_hono@1.7.26-alpha.0}/dist/index.d.ts +2 -0
- package/dist/{analyze-DO5iGgpf.js → analyze-BaYUEglS.js} +67 -20
- package/dist/analyze-BaYUEglS.js.map +1 -0
- package/dist/{analyze-BBFIIBmH.cjs → analyze-UIkyk9Qr.cjs} +66 -19
- package/dist/analyze-UIkyk9Qr.cjs.map +1 -0
- package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
- package/dist/build/analyze/externals.d.ts +2 -0
- package/dist/build/analyze/externals.d.ts.map +1 -1
- package/dist/build/analyze.cjs +1 -1
- package/dist/build/analyze.d.ts.map +1 -1
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +1 -1
- package/dist/build/bundler.js +1 -1
- package/dist/build/bundlerOptions.d.ts +1 -1
- package/dist/build/deployer.d.ts +1 -1
- package/dist/build/index.cjs +4 -4
- package/dist/build/index.js +4 -4
- package/dist/build/package-info.d.ts +6 -0
- package/dist/build/package-info.d.ts.map +1 -1
- package/dist/{build-DH0yT1Zp.cjs → build-BNbmUARF.cjs} +4 -4
- package/dist/{build-DH0yT1Zp.cjs.map → build-BNbmUARF.cjs.map} +1 -1
- package/dist/{build-AGyF63xq.js → build-BmIjWY26.js} +4 -4
- package/dist/{build-AGyF63xq.js.map → build-BmIjWY26.js.map} +1 -1
- package/dist/bundler/index.cjs +1 -1
- package/dist/bundler/index.d.ts +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{bundler-BZ4fSyJZ.cjs → bundler-B85b7ZGn.cjs} +26 -1
- package/dist/bundler-B85b7ZGn.cjs.map +1 -0
- package/dist/{bundler-CRzGd7dU.cjs → bundler-BpXhdDyV.cjs} +4 -4
- package/dist/{bundler-CRzGd7dU.cjs.map → bundler-BpXhdDyV.cjs.map} +1 -1
- package/dist/{bundler-BadvdlF2.js → bundler-CtCtxgyj.js} +4 -4
- package/dist/{bundler-BadvdlF2.js.map → bundler-CtCtxgyj.js.map} +1 -1
- package/dist/{bundler-DSGZrLqs.js → bundler-DMIpMpLE.js} +21 -2
- package/dist/bundler-DMIpMpLE.js.map +1 -0
- package/dist/{bundlerOptions-DUh9CO6S.js → bundlerOptions-B8nx-_mx.js} +2 -2
- package/dist/{bundlerOptions-DUh9CO6S.js.map → bundlerOptions-B8nx-_mx.js.map} +1 -1
- package/dist/{bundlerOptions-Z4D-MNeR.cjs → bundlerOptions-C_YYCV7O.cjs} +2 -2
- package/dist/{bundlerOptions-Z4D-MNeR.cjs.map → bundlerOptions-C_YYCV7O.cjs.map} +1 -1
- package/dist/deploy/base.d.ts +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/server/index.cjs +32 -41
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +32 -41
- package/dist/server/index.js.map +1 -1
- package/dist/services/deps.d.ts +1 -1
- package/package.json +10 -10
- package/dist/analyze-BBFIIBmH.cjs.map +0 -1
- package/dist/analyze-DO5iGgpf.js.map +0 -1
- package/dist/bundler-BZ4fSyJZ.cjs.map +0 -1
- package/dist/bundler-DSGZrLqs.js.map +0 -1
- /package/dist/_types/{@internal_deployer@0.0.1 → @internal_deployer@0.0.2}/dist/_types/@internal_core@0.1.4/dist/index-Diz1p9N7.d.ts +0 -0
- /package/dist/_types/{@internal_deployer@0.0.1 → @internal_deployer@0.0.2}/dist/_types/@internal_core@0.1.4/dist/logger/index.d.ts +0 -0
- /package/dist/_types/{@internal_deployer@0.0.1 → @internal_deployer@0.0.2}/dist/bundler.d.ts +0 -0
- /package/dist/_types/{@internal_deployer@0.0.1 → @internal_deployer@0.0.2}/dist/deployer.d.ts +0 -0
- /package/dist/_types/{@internal_deployer@0.0.1 → @internal_deployer@0.0.2}/dist/index.d.ts +0 -0
- /package/dist/_types/{@internal_deployer@0.0.1 → @internal_deployer@0.0.2}/package.json +0 -0
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.9 → @mastra_hono@1.7.26-alpha.0}/dist/auth-middleware.d.ts +0 -0
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.9 → @mastra_hono@1.7.26-alpha.0}/dist/browser-stream/index.d.ts +0 -0
- /package/dist/_types/{@mastra_hono@1.7.25-alpha.9 → @mastra_hono@1.7.26-alpha.0}/package.json +0 -0
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Mastra } from '@mastra/core/mastra';
|
|
2
|
-
import type { HonoBindings, HonoVariables } from '../_types/@mastra_hono@1.7.
|
|
2
|
+
import type { HonoBindings, HonoVariables } from '../_types/@mastra_hono@1.7.26-alpha.0/dist/index.js';
|
|
3
3
|
import { Hono } from 'hono';
|
|
4
4
|
import type { ServerBundleOptions } from './types.js';
|
|
5
5
|
type Bindings = HonoBindings;
|
package/dist/server/index.js
CHANGED
|
@@ -3569,13 +3569,6 @@ async function setupBrowserStream(app, config) {
|
|
|
3569
3569
|
registry
|
|
3570
3570
|
};
|
|
3571
3571
|
}
|
|
3572
|
-
let _hasPermissionPromise;
|
|
3573
|
-
function loadHasPermission() {
|
|
3574
|
-
if (!_hasPermissionPromise) _hasPermissionPromise = import("@mastra/core/auth/ee").then((m) => m.hasPermission).catch(() => {
|
|
3575
|
-
console.error("[@mastra/hono] Auth features require @mastra/core >= 1.6.0. Please upgrade: npm install @mastra/core@latest");
|
|
3576
|
-
});
|
|
3577
|
-
return _hasPermissionPromise;
|
|
3578
|
-
}
|
|
3579
3572
|
/**
|
|
3580
3573
|
* Wrap a Hono middleware handler so it becomes a no-op for framework-public
|
|
3581
3574
|
* routes (routes registered with `requiresAuth: false`).
|
|
@@ -3630,6 +3623,19 @@ function cancelUnreadBodyOnAbort(response, signal) {
|
|
|
3630
3623
|
if (signal.aborted) cancel();
|
|
3631
3624
|
else signal.addEventListener("abort", cancel, { once: true });
|
|
3632
3625
|
}
|
|
3626
|
+
const requestClones = /* @__PURE__ */ new WeakMap();
|
|
3627
|
+
/**
|
|
3628
|
+
* Clones a request and keeps the clone alive for as long as the request itself. Node 22 makes a request's body
|
|
3629
|
+
* unreadable once a clone of it is garbage collected, which loses the body for anything that reads the original
|
|
3630
|
+
* later, such as the MCP transport.
|
|
3631
|
+
*/
|
|
3632
|
+
function cloneRequest(request) {
|
|
3633
|
+
const clone = request.clone();
|
|
3634
|
+
const clones = requestClones.get(request);
|
|
3635
|
+
if (clones) clones.push(clone);
|
|
3636
|
+
else requestClones.set(request, [clone]);
|
|
3637
|
+
return clone;
|
|
3638
|
+
}
|
|
3633
3639
|
var MastraServer$2 = class extends MastraServer {
|
|
3634
3640
|
createContextMiddleware() {
|
|
3635
3641
|
return async (c, next) => {
|
|
@@ -3649,7 +3655,7 @@ var MastraServer$2 = class extends MastraServer {
|
|
|
3649
3655
|
const contentType = c.req.header("content-type");
|
|
3650
3656
|
const contentLength = c.req.header("content-length");
|
|
3651
3657
|
if (contentType?.includes("application/json") && contentLength !== "0") try {
|
|
3652
|
-
const body = await c.req.raw
|
|
3658
|
+
const body = await cloneRequest(c.req.raw).json();
|
|
3653
3659
|
if (body.requestContext) bodyRequestContext = body.requestContext;
|
|
3654
3660
|
} catch {}
|
|
3655
3661
|
}
|
|
@@ -3759,7 +3765,7 @@ var MastraServer$2 = class extends MastraServer {
|
|
|
3759
3765
|
bodyParseError = { message: error instanceof Error ? error.message : "Failed to parse multipart form data" };
|
|
3760
3766
|
}
|
|
3761
3767
|
else if (contentType.includes("application/json")) {
|
|
3762
|
-
const bodyText = await request.raw
|
|
3768
|
+
const bodyText = await cloneRequest(request.raw).text();
|
|
3763
3769
|
if (bodyText && bodyText.trim().length > 0) try {
|
|
3764
3770
|
body = JSON.parse(bodyText);
|
|
3765
3771
|
} catch (error) {
|
|
@@ -3797,6 +3803,10 @@ var MastraServer$2 = class extends MastraServer {
|
|
|
3797
3803
|
}
|
|
3798
3804
|
return result;
|
|
3799
3805
|
}
|
|
3806
|
+
/** Adapter `mcpOptions` win; otherwise use `server.mcpOptions` from the Mastra config. */
|
|
3807
|
+
resolveMcpOptions() {
|
|
3808
|
+
return this.mcpOptions ?? this.mastra.getServer()?.mcpOptions;
|
|
3809
|
+
}
|
|
3800
3810
|
async sendResponse(route, response, result, prefix) {
|
|
3801
3811
|
const resolvedPrefix = prefix ?? this.prefix ?? "";
|
|
3802
3812
|
if (result && typeof result === "object" && "__refreshHeaders" in result) {
|
|
@@ -3814,7 +3824,7 @@ var MastraServer$2 = class extends MastraServer {
|
|
|
3814
3824
|
const { server, httpPath, mcpOptions: routeMcpOptions } = result;
|
|
3815
3825
|
const { req, res } = toReqRes(response.req.raw);
|
|
3816
3826
|
const { setRequestAuth, ...options } = {
|
|
3817
|
-
...this.
|
|
3827
|
+
...this.resolveMcpOptions(),
|
|
3818
3828
|
...routeMcpOptions
|
|
3819
3829
|
};
|
|
3820
3830
|
await applyMcpRequestAuth({
|
|
@@ -3856,7 +3866,7 @@ var MastraServer$2 = class extends MastraServer {
|
|
|
3856
3866
|
await applyMcpRequestAuth({
|
|
3857
3867
|
req,
|
|
3858
3868
|
requestContext: response.get("requestContext"),
|
|
3859
|
-
setRequestAuth: this.
|
|
3869
|
+
setRequestAuth: this.resolveMcpOptions()?.setRequestAuth
|
|
3860
3870
|
});
|
|
3861
3871
|
return await server.startHonoSSE({
|
|
3862
3872
|
url: new URL(response.req.url),
|
|
@@ -3981,27 +3991,15 @@ var MastraServer$2 = class extends MastraServer {
|
|
|
3981
3991
|
routePrefix: prefix,
|
|
3982
3992
|
request: c.req.raw
|
|
3983
3993
|
};
|
|
3984
|
-
const
|
|
3985
|
-
if (this.mastra.getStudio?.()?.auth || this.mastra.getServer()?.auth) {
|
|
3986
|
-
const hasPermission = await loadHasPermission();
|
|
3987
|
-
if (hasPermission) {
|
|
3988
|
-
const userPermissions = requestContext.get("mastra__userPermissions");
|
|
3989
|
-
const permissionError = this.checkRoutePermission(route, userPermissions, hasPermission, requestContext);
|
|
3990
|
-
if (permissionError) return c.json({
|
|
3991
|
-
error: permissionError.error,
|
|
3992
|
-
message: permissionError.message
|
|
3993
|
-
}, permissionError.status);
|
|
3994
|
-
}
|
|
3995
|
-
}
|
|
3996
|
-
const fgaError = await checkRouteFGA(this.mastra, route, c.get("requestContext"), {
|
|
3994
|
+
const authzError = await this.authorizeRoute(route, {
|
|
3997
3995
|
...params.urlParams,
|
|
3998
3996
|
...params.queryParams,
|
|
3999
3997
|
...typeof params.body === "object" ? params.body : {}
|
|
4000
|
-
});
|
|
4001
|
-
if (
|
|
4002
|
-
error:
|
|
4003
|
-
message:
|
|
4004
|
-
},
|
|
3998
|
+
}, c.get("requestContext"));
|
|
3999
|
+
if (authzError) return c.json({
|
|
4000
|
+
error: authzError.error,
|
|
4001
|
+
message: authzError.message
|
|
4002
|
+
}, authzError.status);
|
|
4005
4003
|
try {
|
|
4006
4004
|
const result = await route.handler(handlerParams);
|
|
4007
4005
|
return this.sendResponse(route, c, result, prefix);
|
|
@@ -4045,18 +4043,11 @@ var MastraServer$2 = class extends MastraServer {
|
|
|
4045
4043
|
if (authError.headers) for (const [key, value] of Object.entries(authError.headers)) c.header(key, value);
|
|
4046
4044
|
if (authError.error) return c.json({ error: authError.error }, authError.status);
|
|
4047
4045
|
}
|
|
4048
|
-
const
|
|
4049
|
-
if (
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
const permissionError = this.checkRoutePermission(serverRoute, userPermissions, hasPermission, requestContext);
|
|
4054
|
-
if (permissionError) return c.json({
|
|
4055
|
-
error: permissionError.error,
|
|
4056
|
-
message: permissionError.message
|
|
4057
|
-
}, permissionError.status);
|
|
4058
|
-
}
|
|
4059
|
-
}
|
|
4046
|
+
const permissionError = this.checkRouteRBAC(serverRoute, c.get("requestContext"));
|
|
4047
|
+
if (permissionError) return c.json({
|
|
4048
|
+
error: permissionError.error,
|
|
4049
|
+
message: permissionError.message
|
|
4050
|
+
}, permissionError.status);
|
|
4060
4051
|
const pristineRequest = c.get(MASTRA_PRISTINE_REQUEST_KEY) ?? c.req.raw;
|
|
4061
4052
|
let bodyParams = {};
|
|
4062
4053
|
if (getFGAProvider(this.mastra, c.get("requestContext"))) {
|