@mastra/next 0.2.10-alpha.0 → 0.2.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 +18 -0
- package/dist/index.cjs +67 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +66 -59
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/next
|
|
2
2
|
|
|
3
|
+
## 0.2.10-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`a211d09`](https://github.com/mastra-ai/mastra/commit/a211d09185dc65a746534914cf38b67f21ee9bac), [`4cbd63c`](https://github.com/mastra-ai/mastra/commit/4cbd63cfa7fd1ce8be4199ed01a20c709794fee1), [`05db566`](https://github.com/mastra-ai/mastra/commit/05db566fcbdcbf33d0bffca0c72ec30129e2e3ca), [`8124754`](https://github.com/mastra-ai/mastra/commit/8124754ae89fbc69f8136d1df4a91904d0f84c4e)]:
|
|
8
|
+
- @mastra/core@1.54.0-alpha.2
|
|
9
|
+
- @mastra/server@1.54.0-alpha.2
|
|
10
|
+
- @mastra/hono@1.5.11-alpha.2
|
|
11
|
+
|
|
12
|
+
## 0.2.10-alpha.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`ce93a3c`](https://github.com/mastra-ai/mastra/commit/ce93a3c114ea1cbfbd576f3db41d7c26c9844f5b), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`5807d3a`](https://github.com/mastra-ai/mastra/commit/5807d3ae1d259b8b7d6df7e5bf2b485c694af9c8), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`5718a22`](https://github.com/mastra-ai/mastra/commit/5718a229281dcfd36bcd1f42a242e3717e510a33), [`57661af`](https://github.com/mastra-ai/mastra/commit/57661afeca52ff9af4e72675ede2134fa503d5a5), [`d1b7e3a`](https://github.com/mastra-ai/mastra/commit/d1b7e3a978a309a5653eeaa490d2d6c7c53bd093), [`c093146`](https://github.com/mastra-ai/mastra/commit/c0931466404d3c521308ea119cb165bb7e695155)]:
|
|
17
|
+
- @mastra/core@1.54.0-alpha.1
|
|
18
|
+
- @mastra/hono@1.5.11-alpha.1
|
|
19
|
+
- @mastra/server@1.54.0-alpha.1
|
|
20
|
+
|
|
3
21
|
## 0.2.10-alpha.0
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1,67 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _mastra_hono = require("@mastra/hono");
|
|
3
|
+
let _mastra_server_a2a_store = require("@mastra/server/a2a/store");
|
|
4
|
+
let hono = require("hono");
|
|
5
|
+
let hono_vercel = require("hono/vercel");
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
/**
|
|
8
|
+
* Creates Next.js App Router route handlers for a Mastra instance.
|
|
9
|
+
*
|
|
10
|
+
* Mount this in a catch-all route file such as:
|
|
11
|
+
* `app/api/[...mastra]/route.ts`
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // app/api/[...mastra]/route.ts
|
|
16
|
+
* import { createNextRouteHandler } from '@mastra/next';
|
|
17
|
+
* import { mastra } from '../../../mastra';
|
|
18
|
+
*
|
|
19
|
+
* export const { GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD } = createNextRouteHandler({
|
|
20
|
+
* mastra,
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
9
24
|
function createNextRouteHandler(options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
PATCH: handler,
|
|
29
|
-
OPTIONS: handler,
|
|
30
|
-
HEAD: handler
|
|
31
|
-
};
|
|
25
|
+
const { mastra, tools = {}, prefix = "/api" } = options;
|
|
26
|
+
let appPromise;
|
|
27
|
+
function getApp() {
|
|
28
|
+
if (!appPromise) appPromise = initApp(mastra, tools, prefix);
|
|
29
|
+
return appPromise;
|
|
30
|
+
}
|
|
31
|
+
const handler = async (req) => {
|
|
32
|
+
return (0, hono_vercel.handle)(await getApp())(req);
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
GET: handler,
|
|
36
|
+
POST: handler,
|
|
37
|
+
PUT: handler,
|
|
38
|
+
DELETE: handler,
|
|
39
|
+
PATCH: handler,
|
|
40
|
+
OPTIONS: handler,
|
|
41
|
+
HEAD: handler
|
|
42
|
+
};
|
|
32
43
|
}
|
|
33
44
|
async function initApp(mastra, tools, prefix) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
prefix,
|
|
59
|
-
mcpOptions: serverConfig?.mcpOptions
|
|
60
|
-
});
|
|
61
|
-
await honoServerAdapter.init();
|
|
62
|
-
return app;
|
|
45
|
+
const app = new hono.Hono();
|
|
46
|
+
const serverConfig = mastra.getServer();
|
|
47
|
+
const apiRoutes = serverConfig?.apiRoutes;
|
|
48
|
+
const customRouteAuthConfig = /* @__PURE__ */ new Map();
|
|
49
|
+
if (apiRoutes) for (const route of apiRoutes) {
|
|
50
|
+
const requiresAuth = route.requiresAuth !== false;
|
|
51
|
+
const routeKey = `${route.method}:${route.path}`;
|
|
52
|
+
customRouteAuthConfig.set(routeKey, requiresAuth);
|
|
53
|
+
}
|
|
54
|
+
await new _mastra_hono.MastraServer({
|
|
55
|
+
app,
|
|
56
|
+
mastra,
|
|
57
|
+
tools,
|
|
58
|
+
taskStore: new _mastra_server_a2a_store.InMemoryTaskStore(),
|
|
59
|
+
bodyLimitOptions: {
|
|
60
|
+
maxSize: serverConfig?.bodySizeLimit ?? 4.5 * 1024 * 1024,
|
|
61
|
+
onError: (_err) => ({ error: "Request body too large" })
|
|
62
|
+
},
|
|
63
|
+
customRouteAuthConfig,
|
|
64
|
+
customApiRoutes: apiRoutes,
|
|
65
|
+
prefix,
|
|
66
|
+
mcpOptions: serverConfig?.mcpOptions
|
|
67
|
+
}).init();
|
|
68
|
+
return app;
|
|
63
69
|
}
|
|
64
|
-
|
|
70
|
+
//#endregion
|
|
65
71
|
exports.createNextRouteHandler = createNextRouteHandler;
|
|
66
|
-
|
|
72
|
+
|
|
67
73
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Hono","MastraServer","InMemoryTaskStore"],"sources":["../src/index.ts"],"sourcesContent":["import type { ToolsInput } from '@mastra/core/agent';\nimport type { Mastra } from '@mastra/core/mastra';\nimport type { ApiRoute } from '@mastra/core/server';\nimport { MastraServer } from '@mastra/hono';\nimport type { HonoApp } from '@mastra/hono';\nimport { InMemoryTaskStore } from '@mastra/server/a2a/store';\nimport { Hono } from 'hono';\nimport { handle } from 'hono/vercel';\n\nexport interface NextRouteHandlerOptions {\n /**\n * The Mastra instance to serve.\n */\n mastra: Mastra;\n\n /**\n * Tools to register with the server.\n * @default {}\n */\n tools?: ToolsInput;\n\n /**\n * API route prefix. Should match the path where the catch-all route is mounted.\n * For example, if you mount at `app/api/[...mastra]/route.ts`, set this to `/api`.\n * @default '/api'\n */\n prefix?: string;\n}\n\n/**\n * A Next.js route handler function compatible with App Router.\n */\nexport type NextRouteHandler = (req: Request) => Response | Promise<Response>;\n\nexport interface NextRouteHandlers {\n GET: NextRouteHandler;\n POST: NextRouteHandler;\n PUT: NextRouteHandler;\n DELETE: NextRouteHandler;\n PATCH: NextRouteHandler;\n OPTIONS: NextRouteHandler;\n HEAD: NextRouteHandler;\n}\n\n/**\n * Creates Next.js App Router route handlers for a Mastra instance.\n *\n * Mount this in a catch-all route file such as:\n * `app/api/[...mastra]/route.ts`\n *\n * @example\n * ```ts\n * // app/api/[...mastra]/route.ts\n * import { createNextRouteHandler } from '@mastra/next';\n * import { mastra } from '../../../mastra';\n *\n * export const { GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD } = createNextRouteHandler({\n * mastra,\n * });\n * ```\n */\nexport function createNextRouteHandler(options: NextRouteHandlerOptions): NextRouteHandlers {\n const { mastra, tools = {}, prefix = '/api' } = options;\n\n // Lazily initialize the Hono app so the module-level export works synchronously\n let appPromise: Promise<Hono> | undefined;\n\n function getApp(): Promise<Hono> {\n if (!appPromise) {\n appPromise = initApp(mastra, tools, prefix);\n }\n return appPromise;\n }\n\n // Build a handler for each HTTP method\n const handler: NextRouteHandler = async req => {\n const app = await getApp();\n const honoHandler = handle(app);\n return honoHandler(req);\n };\n\n return {\n GET: handler,\n POST: handler,\n PUT: handler,\n DELETE: handler,\n PATCH: handler,\n OPTIONS: handler,\n HEAD: handler,\n };\n}\n\nasync function initApp(mastra: Mastra, tools: ToolsInput, prefix: string): Promise<Hono> {\n const app = new Hono();\n\n const serverConfig = mastra.getServer();\n const apiRoutes: ApiRoute[] | undefined = serverConfig?.apiRoutes;\n\n // Store custom route auth configurations\n const customRouteAuthConfig = new Map<string, boolean>();\n if (apiRoutes) {\n for (const route of apiRoutes) {\n const requiresAuth = route.requiresAuth !== false;\n const routeKey = `${route.method}:${route.path}`;\n customRouteAuthConfig.set(routeKey, requiresAuth);\n }\n }\n\n const taskStore = new InMemoryTaskStore();\n\n const bodySizeLimit = serverConfig?.bodySizeLimit ?? 4.5 * 1024 * 1024;\n\n // Create the MastraServer adapter\n const honoServerAdapter = new MastraServer({\n app: app as unknown as HonoApp,\n mastra,\n tools,\n taskStore,\n bodyLimitOptions: {\n maxSize: bodySizeLimit,\n onError: (_err: unknown) => ({ error: 'Request body too large' }),\n },\n customRouteAuthConfig,\n customApiRoutes: apiRoutes,\n prefix,\n mcpOptions: serverConfig?.mcpOptions,\n });\n\n // Initialize: registers context middleware, auth, routes, etc.\n await honoServerAdapter.init();\n\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,uBAAuB,SAAqD;CAC1F,MAAM,EAAE,QAAQ,QAAQ,CAAC,GAAG,SAAS,WAAW;CAGhD,IAAI;CAEJ,SAAS,SAAwB;EAC/B,IAAI,CAAC,YACH,aAAa,QAAQ,QAAQ,OAAO,MAAM;EAE5C,OAAO;CACT;CAGA,MAAM,UAA4B,OAAM,QAAO;EAG7C,QAAA,GAAA,YAAA,OAAA,CAD2B,MADT,OAAO,CAER,CAAC,CAAC,GAAG;CACxB;CAEA,OAAO;EACL,KAAK;EACL,MAAM;EACN,KAAK;EACL,QAAQ;EACR,OAAO;EACP,SAAS;EACT,MAAM;CACR;AACF;AAEA,eAAe,QAAQ,QAAgB,OAAmB,QAA+B;CACvF,MAAM,MAAM,IAAIA,KAAAA,KAAK;CAErB,MAAM,eAAe,OAAO,UAAU;CACtC,MAAM,YAAoC,cAAc;CAGxD,MAAM,wCAAwB,IAAI,IAAqB;CACvD,IAAI,WACF,KAAK,MAAM,SAAS,WAAW;EAC7B,MAAM,eAAe,MAAM,iBAAiB;EAC5C,MAAM,WAAW,GAAG,MAAM,OAAO,GAAG,MAAM;EAC1C,sBAAsB,IAAI,UAAU,YAAY;CAClD;CAwBF,MAAM,IAhBwBC,aAAAA,aAAa;EACpC;EACL;EACA;EACA,WAAA,IAToBC,yBAAAA,kBASZ;EACR,kBAAkB;GAChB,SATkB,cAAc,iBAAiB,MAAM,OAAO;GAU9D,UAAU,UAAmB,EAAE,OAAO,yBAAyB;EACjE;EACA;EACA,iBAAiB;EACjB;EACA,YAAY,cAAc;CAC5B,CAGsB,CAAC,CAAC,KAAK;CAE7B,OAAO;AACT"}
|
package/dist/index.js
CHANGED
|
@@ -1,65 +1,72 @@
|
|
|
1
|
-
import { MastraServer } from
|
|
2
|
-
import { InMemoryTaskStore } from
|
|
3
|
-
import { Hono } from
|
|
4
|
-
import { handle } from
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { MastraServer } from "@mastra/hono";
|
|
2
|
+
import { InMemoryTaskStore } from "@mastra/server/a2a/store";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
import { handle } from "hono/vercel";
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* Creates Next.js App Router route handlers for a Mastra instance.
|
|
8
|
+
*
|
|
9
|
+
* Mount this in a catch-all route file such as:
|
|
10
|
+
* `app/api/[...mastra]/route.ts`
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* // app/api/[...mastra]/route.ts
|
|
15
|
+
* import { createNextRouteHandler } from '@mastra/next';
|
|
16
|
+
* import { mastra } from '../../../mastra';
|
|
17
|
+
*
|
|
18
|
+
* export const { GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD } = createNextRouteHandler({
|
|
19
|
+
* mastra,
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
7
23
|
function createNextRouteHandler(options) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
PATCH: handler,
|
|
27
|
-
OPTIONS: handler,
|
|
28
|
-
HEAD: handler
|
|
29
|
-
};
|
|
24
|
+
const { mastra, tools = {}, prefix = "/api" } = options;
|
|
25
|
+
let appPromise;
|
|
26
|
+
function getApp() {
|
|
27
|
+
if (!appPromise) appPromise = initApp(mastra, tools, prefix);
|
|
28
|
+
return appPromise;
|
|
29
|
+
}
|
|
30
|
+
const handler = async (req) => {
|
|
31
|
+
return handle(await getApp())(req);
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
GET: handler,
|
|
35
|
+
POST: handler,
|
|
36
|
+
PUT: handler,
|
|
37
|
+
DELETE: handler,
|
|
38
|
+
PATCH: handler,
|
|
39
|
+
OPTIONS: handler,
|
|
40
|
+
HEAD: handler
|
|
41
|
+
};
|
|
30
42
|
}
|
|
31
43
|
async function initApp(mastra, tools, prefix) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
prefix,
|
|
57
|
-
mcpOptions: serverConfig?.mcpOptions
|
|
58
|
-
});
|
|
59
|
-
await honoServerAdapter.init();
|
|
60
|
-
return app;
|
|
44
|
+
const app = new Hono();
|
|
45
|
+
const serverConfig = mastra.getServer();
|
|
46
|
+
const apiRoutes = serverConfig?.apiRoutes;
|
|
47
|
+
const customRouteAuthConfig = /* @__PURE__ */ new Map();
|
|
48
|
+
if (apiRoutes) for (const route of apiRoutes) {
|
|
49
|
+
const requiresAuth = route.requiresAuth !== false;
|
|
50
|
+
const routeKey = `${route.method}:${route.path}`;
|
|
51
|
+
customRouteAuthConfig.set(routeKey, requiresAuth);
|
|
52
|
+
}
|
|
53
|
+
await new MastraServer({
|
|
54
|
+
app,
|
|
55
|
+
mastra,
|
|
56
|
+
tools,
|
|
57
|
+
taskStore: new InMemoryTaskStore(),
|
|
58
|
+
bodyLimitOptions: {
|
|
59
|
+
maxSize: serverConfig?.bodySizeLimit ?? 4.5 * 1024 * 1024,
|
|
60
|
+
onError: (_err) => ({ error: "Request body too large" })
|
|
61
|
+
},
|
|
62
|
+
customRouteAuthConfig,
|
|
63
|
+
customApiRoutes: apiRoutes,
|
|
64
|
+
prefix,
|
|
65
|
+
mcpOptions: serverConfig?.mcpOptions
|
|
66
|
+
}).init();
|
|
67
|
+
return app;
|
|
61
68
|
}
|
|
62
|
-
|
|
69
|
+
//#endregion
|
|
63
70
|
export { createNextRouteHandler };
|
|
64
|
-
|
|
71
|
+
|
|
65
72
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { ToolsInput } from '@mastra/core/agent';\nimport type { Mastra } from '@mastra/core/mastra';\nimport type { ApiRoute } from '@mastra/core/server';\nimport { MastraServer } from '@mastra/hono';\nimport type { HonoApp } from '@mastra/hono';\nimport { InMemoryTaskStore } from '@mastra/server/a2a/store';\nimport { Hono } from 'hono';\nimport { handle } from 'hono/vercel';\n\nexport interface NextRouteHandlerOptions {\n /**\n * The Mastra instance to serve.\n */\n mastra: Mastra;\n\n /**\n * Tools to register with the server.\n * @default {}\n */\n tools?: ToolsInput;\n\n /**\n * API route prefix. Should match the path where the catch-all route is mounted.\n * For example, if you mount at `app/api/[...mastra]/route.ts`, set this to `/api`.\n * @default '/api'\n */\n prefix?: string;\n}\n\n/**\n * A Next.js route handler function compatible with App Router.\n */\nexport type NextRouteHandler = (req: Request) => Response | Promise<Response>;\n\nexport interface NextRouteHandlers {\n GET: NextRouteHandler;\n POST: NextRouteHandler;\n PUT: NextRouteHandler;\n DELETE: NextRouteHandler;\n PATCH: NextRouteHandler;\n OPTIONS: NextRouteHandler;\n HEAD: NextRouteHandler;\n}\n\n/**\n * Creates Next.js App Router route handlers for a Mastra instance.\n *\n * Mount this in a catch-all route file such as:\n * `app/api/[...mastra]/route.ts`\n *\n * @example\n * ```ts\n * // app/api/[...mastra]/route.ts\n * import { createNextRouteHandler } from '@mastra/next';\n * import { mastra } from '../../../mastra';\n *\n * export const { GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD } = createNextRouteHandler({\n * mastra,\n * });\n * ```\n */\nexport function createNextRouteHandler(options: NextRouteHandlerOptions): NextRouteHandlers {\n const { mastra, tools = {}, prefix = '/api' } = options;\n\n // Lazily initialize the Hono app so the module-level export works synchronously\n let appPromise: Promise<Hono> | undefined;\n\n function getApp(): Promise<Hono> {\n if (!appPromise) {\n appPromise = initApp(mastra, tools, prefix);\n }\n return appPromise;\n }\n\n // Build a handler for each HTTP method\n const handler: NextRouteHandler = async req => {\n const app = await getApp();\n const honoHandler = handle(app);\n return honoHandler(req);\n };\n\n return {\n GET: handler,\n POST: handler,\n PUT: handler,\n DELETE: handler,\n PATCH: handler,\n OPTIONS: handler,\n HEAD: handler,\n };\n}\n\nasync function initApp(mastra: Mastra, tools: ToolsInput, prefix: string): Promise<Hono> {\n const app = new Hono();\n\n const serverConfig = mastra.getServer();\n const apiRoutes: ApiRoute[] | undefined = serverConfig?.apiRoutes;\n\n // Store custom route auth configurations\n const customRouteAuthConfig = new Map<string, boolean>();\n if (apiRoutes) {\n for (const route of apiRoutes) {\n const requiresAuth = route.requiresAuth !== false;\n const routeKey = `${route.method}:${route.path}`;\n customRouteAuthConfig.set(routeKey, requiresAuth);\n }\n }\n\n const taskStore = new InMemoryTaskStore();\n\n const bodySizeLimit = serverConfig?.bodySizeLimit ?? 4.5 * 1024 * 1024;\n\n // Create the MastraServer adapter\n const honoServerAdapter = new MastraServer({\n app: app as unknown as HonoApp,\n mastra,\n tools,\n taskStore,\n bodyLimitOptions: {\n maxSize: bodySizeLimit,\n onError: (_err: unknown) => ({ error: 'Request body too large' }),\n },\n customRouteAuthConfig,\n customApiRoutes: apiRoutes,\n prefix,\n mcpOptions: serverConfig?.mcpOptions,\n });\n\n // Initialize: registers context middleware, auth, routes, etc.\n await honoServerAdapter.init();\n\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,uBAAuB,SAAqD;CAC1F,MAAM,EAAE,QAAQ,QAAQ,CAAC,GAAG,SAAS,WAAW;CAGhD,IAAI;CAEJ,SAAS,SAAwB;EAC/B,IAAI,CAAC,YACH,aAAa,QAAQ,QAAQ,OAAO,MAAM;EAE5C,OAAO;CACT;CAGA,MAAM,UAA4B,OAAM,QAAO;EAG7C,OADoB,OAAO,MADT,OAAO,CAER,CAAC,CAAC,GAAG;CACxB;CAEA,OAAO;EACL,KAAK;EACL,MAAM;EACN,KAAK;EACL,QAAQ;EACR,OAAO;EACP,SAAS;EACT,MAAM;CACR;AACF;AAEA,eAAe,QAAQ,QAAgB,OAAmB,QAA+B;CACvF,MAAM,MAAM,IAAI,KAAK;CAErB,MAAM,eAAe,OAAO,UAAU;CACtC,MAAM,YAAoC,cAAc;CAGxD,MAAM,wCAAwB,IAAI,IAAqB;CACvD,IAAI,WACF,KAAK,MAAM,SAAS,WAAW;EAC7B,MAAM,eAAe,MAAM,iBAAiB;EAC5C,MAAM,WAAW,GAAG,MAAM,OAAO,GAAG,MAAM;EAC1C,sBAAsB,IAAI,UAAU,YAAY;CAClD;CAwBF,MAAM,IAhBwB,aAAa;EACpC;EACL;EACA;EACA,WAAA,IAToB,kBASZ;EACR,kBAAkB;GAChB,SATkB,cAAc,iBAAiB,MAAM,OAAO;GAU9D,UAAU,UAAmB,EAAE,OAAO,yBAAyB;EACjE;EACA;EACA,iBAAiB;EACjB;EACA,YAAY,cAAc;CAC5B,CAGsB,CAAC,CAAC,KAAK;CAE7B,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/next",
|
|
3
|
-
"version": "0.2.10-alpha.
|
|
3
|
+
"version": "0.2.10-alpha.2",
|
|
4
4
|
"description": "Mastra Next.js server adapter — drop your Mastra instance into a Next.js app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@mastra/server": "1.54.0-alpha.
|
|
24
|
-
"@mastra/hono": "1.5.11-alpha.
|
|
23
|
+
"@mastra/server": "1.54.0-alpha.2",
|
|
24
|
+
"@mastra/hono": "1.5.11-alpha.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "22.20.1",
|
|
28
28
|
"eslint": "^10.7.0",
|
|
29
29
|
"hono": "^4.12.8",
|
|
30
|
-
"
|
|
30
|
+
"tsdown": "0.22.9",
|
|
31
31
|
"typescript": "^6.0.3",
|
|
32
32
|
"vitest": "4.1.10",
|
|
33
33
|
"@internal/lint": "0.0.117",
|
|
34
34
|
"@internal/types-builder": "0.0.92",
|
|
35
|
-
"@mastra/core": "1.54.0-alpha.
|
|
35
|
+
"@mastra/core": "1.54.0-alpha.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@mastra/core": ">=1.50.0-0 <2.0.0-0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
|
-
"build": "
|
|
58
|
+
"build": "tsdown --silent --config tsdown.config.ts",
|
|
59
59
|
"build:watch": "pnpm build --watch",
|
|
60
60
|
"test": "vitest run",
|
|
61
61
|
"lint": "oxlint . && eslint .",
|