@kizunajs/next 2.0.0-beta.39 → 2.0.0-beta.40
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/index.cjs +10 -6
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +11 -7
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ const asGetRequest = async (request) => {
|
|
|
23
23
|
signal: request.signal
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
const handleNextRequest = async (request, routes, router, options, guards, schemes, requestContext, pluginExports, jobs, configBodyLimit) => {
|
|
26
|
+
const handleNextRequest = async (request, routes, router, options, guards, schemes, requestContext, pluginExports, jobs, configBodyLimit, configNestingLimit) => {
|
|
27
27
|
const url = new URL(request.url);
|
|
28
28
|
const adapter = (0, kizunajs_adapter.defineAdapter)({
|
|
29
29
|
buildHandlerContext: (adapterRequest) => ({ request: adapterRequest.request }),
|
|
@@ -72,7 +72,8 @@ const handleNextRequest = async (request, routes, router, options, guards, schem
|
|
|
72
72
|
headers: (0, kizunajs_adapter.headersToObject)(request.headers),
|
|
73
73
|
readBody: (route) => (0, kizunajs_adapter.parseFetchBody)(request, route, (0, kizunajs_adapter.bodyLimitOf)(route, configBodyLimit)),
|
|
74
74
|
readRawBody: (route) => (0, kizunajs_adapter.readBodyText)(request, (0, kizunajs_adapter.bodyLimitOf)(route, configBodyLimit)),
|
|
75
|
-
configBodyLimit
|
|
75
|
+
configBodyLimit,
|
|
76
|
+
configNestingLimit
|
|
76
77
|
};
|
|
77
78
|
return adapter.handle({
|
|
78
79
|
routes: jobs.routes,
|
|
@@ -117,7 +118,8 @@ const handleNextRequest = async (request, routes, router, options, guards, schem
|
|
|
117
118
|
headers: (0, kizunajs_adapter.headersToObject)(request.headers),
|
|
118
119
|
readBody: (route) => (0, kizunajs_adapter.parseFetchBody)(request, route, (0, kizunajs_adapter.bodyLimitOf)(route, configBodyLimit)),
|
|
119
120
|
readRawBody: (route) => (0, kizunajs_adapter.readBodyText)(request, (0, kizunajs_adapter.bodyLimitOf)(route, configBodyLimit)),
|
|
120
|
-
configBodyLimit
|
|
121
|
+
configBodyLimit,
|
|
122
|
+
configNestingLimit
|
|
121
123
|
};
|
|
122
124
|
return adapter.handle({
|
|
123
125
|
routes,
|
|
@@ -143,7 +145,8 @@ const handleNextRequest = async (request, routes, router, options, guards, schem
|
|
|
143
145
|
headers: (0, kizunajs_adapter.headersToObject)(request.headers),
|
|
144
146
|
readBody: (route) => (0, kizunajs_adapter.parseFetchBody)(request, route, (0, kizunajs_adapter.bodyLimitOf)(route, configBodyLimit)),
|
|
145
147
|
readRawBody: (route) => (0, kizunajs_adapter.readBodyText)(request, (0, kizunajs_adapter.bodyLimitOf)(route, configBodyLimit)),
|
|
146
|
-
configBodyLimit
|
|
148
|
+
configBodyLimit,
|
|
149
|
+
configNestingLimit
|
|
147
150
|
};
|
|
148
151
|
return adapter.handle({
|
|
149
152
|
routes,
|
|
@@ -174,6 +177,7 @@ function mountNext(api, options) {
|
|
|
174
177
|
const requestContext = api[kizunajs_adapter.REQUEST_CONTEXT_META];
|
|
175
178
|
const jobsMeta = api[kizunajs_adapter.JOBS_META];
|
|
176
179
|
const configBodyLimit = api[kizunajs_adapter.BODY_LIMIT_META];
|
|
180
|
+
const configNestingLimit = api[kizunajs_adapter.NESTING_LIMIT_META];
|
|
177
181
|
const mountedJobs = jobsMeta ? {
|
|
178
182
|
routes: (0, kizunajs_adapter.jobRoutes)(jobsMeta),
|
|
179
183
|
router: (0, kizunajs_adapter.jobRouter)(jobsMeta),
|
|
@@ -193,9 +197,9 @@ function mountNext(api, options) {
|
|
|
193
197
|
const request = (0, kizunajs_adapter.isMethodOverride)(incoming.method, incoming.headers.get(kizunajs_adapter.METHOD_OVERRIDE_HEADER), incoming.headers.get("content-type")) ? await asGetRequest(incoming) : incoming;
|
|
194
198
|
if (hasPluginRoutes) {
|
|
195
199
|
const pathname = new URL(request.url).pathname;
|
|
196
|
-
if (!((0, kizunajs_adapter.matchRoute)(request.method, pathname, api.routes, options?.basePath).kind === "matched") && (0, kizunajs_adapter.matchRoute)(request.method, pathname, pluginRoutes, options?.basePath).kind === "matched") return handleNextRequest(request, pluginRoutes, pluginRouter, handlerOptions, guards, schemes, requestContext, pluginExports, void 0, configBodyLimit);
|
|
200
|
+
if (!((0, kizunajs_adapter.matchRoute)(request.method, pathname, api.routes, options?.basePath).kind === "matched") && (0, kizunajs_adapter.matchRoute)(request.method, pathname, pluginRoutes, options?.basePath).kind === "matched") return handleNextRequest(request, pluginRoutes, pluginRouter, handlerOptions, guards, schemes, requestContext, pluginExports, void 0, configBodyLimit, configNestingLimit);
|
|
197
201
|
}
|
|
198
|
-
return handleNextRequest(request, api.routes, api[kizunajs_adapter.ROUTER_META], handlerOptions, guards, schemes, requestContext, pluginExports, mountedJobs, configBodyLimit);
|
|
202
|
+
return handleNextRequest(request, api.routes, api[kizunajs_adapter.ROUTER_META], handlerOptions, guards, schemes, requestContext, pluginExports, mountedJobs, configBodyLimit, configNestingLimit);
|
|
199
203
|
};
|
|
200
204
|
return {
|
|
201
205
|
GET: handler,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Adapter, ApiWithRouter, BODY_LIMIT_META, ErrorFormatter, GUARDS_META, GuardMap, JOBS_META, JobRunner, Jobs, REQUEST_CONTEXT_META, RequestContextMap, Router, Routes, SCHEMES_META } from "kizunajs/adapter";
|
|
1
|
+
import { Adapter, ApiWithRouter, BODY_LIMIT_META, ErrorFormatter, GUARDS_META, GuardMap, JOBS_META, JobRunner, Jobs, NESTING_LIMIT_META, REQUEST_CONTEXT_META, RequestContextMap, Router, Routes, SCHEMES_META } from "kizunajs/adapter";
|
|
2
2
|
import { SecurityScheme } from "kizunajs";
|
|
3
3
|
import { NextRequest, NextRequest as NextRequest$1, NextResponse, NextResponse as NextResponse$1 } from "next/server.js";
|
|
4
4
|
|
|
@@ -51,7 +51,7 @@ interface NextHandlerOptions {
|
|
|
51
51
|
*/
|
|
52
52
|
responseValidation?: boolean;
|
|
53
53
|
}
|
|
54
|
-
declare const handleNextRequest: <T extends Routes>(request: NextRequest$1, routes: T, router: Router<T, NextHandlerContext>, options?: NextHandlerOptions, guards?: GuardMap<NextHandlerContext>, schemes?: Record<string, SecurityScheme>, requestContext?: RequestContextMap<NextHandlerContext>, pluginExports?: Record<string, unknown>, jobs?: MountedJobs, configBodyLimit?: number) => Promise<NextResponse$1>;
|
|
54
|
+
declare const handleNextRequest: <T extends Routes>(request: NextRequest$1, routes: T, router: Router<T, NextHandlerContext>, options?: NextHandlerOptions, guards?: GuardMap<NextHandlerContext>, schemes?: Record<string, SecurityScheme>, requestContext?: RequestContextMap<NextHandlerContext>, pluginExports?: Record<string, unknown>, jobs?: MountedJobs, configBodyLimit?: number, configNestingLimit?: number) => Promise<NextResponse$1>;
|
|
55
55
|
type HttpHandlers = {
|
|
56
56
|
GET: HttpHandler;
|
|
57
57
|
HEAD: HttpHandler;
|
|
@@ -68,6 +68,7 @@ type NextApiWithRouter = ApiWithRouter & {
|
|
|
68
68
|
readonly [REQUEST_CONTEXT_META]?: unknown;
|
|
69
69
|
readonly [JOBS_META]?: unknown;
|
|
70
70
|
readonly [BODY_LIMIT_META]?: unknown;
|
|
71
|
+
readonly [NESTING_LIMIT_META]?: unknown;
|
|
71
72
|
};
|
|
72
73
|
type NextApi<R extends Routes = Routes> = ApiWithRouter<R> & {
|
|
73
74
|
readonly [GUARDS_META]?: unknown;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Adapter, ApiWithRouter, BODY_LIMIT_META, ErrorFormatter, GUARDS_META, GuardMap, JOBS_META, JobRunner, Jobs, REQUEST_CONTEXT_META, RequestContextMap, Router, Routes, SCHEMES_META } from "kizunajs/adapter";
|
|
1
|
+
import { Adapter, ApiWithRouter, BODY_LIMIT_META, ErrorFormatter, GUARDS_META, GuardMap, JOBS_META, JobRunner, Jobs, NESTING_LIMIT_META, REQUEST_CONTEXT_META, RequestContextMap, Router, Routes, SCHEMES_META } from "kizunajs/adapter";
|
|
2
2
|
import { NextRequest, NextRequest as NextRequest$1, NextResponse, NextResponse as NextResponse$1 } from "next/server.js";
|
|
3
3
|
import { SecurityScheme } from "kizunajs";
|
|
4
4
|
|
|
@@ -51,7 +51,7 @@ interface NextHandlerOptions {
|
|
|
51
51
|
*/
|
|
52
52
|
responseValidation?: boolean;
|
|
53
53
|
}
|
|
54
|
-
declare const handleNextRequest: <T extends Routes>(request: NextRequest$1, routes: T, router: Router<T, NextHandlerContext>, options?: NextHandlerOptions, guards?: GuardMap<NextHandlerContext>, schemes?: Record<string, SecurityScheme>, requestContext?: RequestContextMap<NextHandlerContext>, pluginExports?: Record<string, unknown>, jobs?: MountedJobs, configBodyLimit?: number) => Promise<NextResponse$1>;
|
|
54
|
+
declare const handleNextRequest: <T extends Routes>(request: NextRequest$1, routes: T, router: Router<T, NextHandlerContext>, options?: NextHandlerOptions, guards?: GuardMap<NextHandlerContext>, schemes?: Record<string, SecurityScheme>, requestContext?: RequestContextMap<NextHandlerContext>, pluginExports?: Record<string, unknown>, jobs?: MountedJobs, configBodyLimit?: number, configNestingLimit?: number) => Promise<NextResponse$1>;
|
|
55
55
|
type HttpHandlers = {
|
|
56
56
|
GET: HttpHandler;
|
|
57
57
|
HEAD: HttpHandler;
|
|
@@ -68,6 +68,7 @@ type NextApiWithRouter = ApiWithRouter & {
|
|
|
68
68
|
readonly [REQUEST_CONTEXT_META]?: unknown;
|
|
69
69
|
readonly [JOBS_META]?: unknown;
|
|
70
70
|
readonly [BODY_LIMIT_META]?: unknown;
|
|
71
|
+
readonly [NESTING_LIMIT_META]?: unknown;
|
|
71
72
|
};
|
|
72
73
|
type NextApi<R extends Routes = Routes> = ApiWithRouter<R> & {
|
|
73
74
|
readonly [GUARDS_META]?: unknown;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BODY_LIMIT_META, GUARDS_META, JOBS_META, METHOD_OVERRIDE_HEADER, REQUEST_CONTEXT_META, ROUTER_META, SCHEMES_META, bodyLimitOf, defineAdapter, entriesToObject, headersToObject, isMethodOverride, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseFetchBody, pluginExportsOf, pluginRouterOf, pluginRoutesOf, readBodyText, renderJsonResult } from "kizunajs/adapter";
|
|
1
|
+
import { BODY_LIMIT_META, GUARDS_META, JOBS_META, METHOD_OVERRIDE_HEADER, NESTING_LIMIT_META, REQUEST_CONTEXT_META, ROUTER_META, SCHEMES_META, bodyLimitOf, defineAdapter, entriesToObject, headersToObject, isMethodOverride, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseFetchBody, pluginExportsOf, pluginRouterOf, pluginRoutesOf, readBodyText, renderJsonResult } from "kizunajs/adapter";
|
|
2
2
|
import { NextRequest, NextRequest as NextRequest$1, NextResponse, NextResponse as NextResponse$1, after } from "next/server.js";
|
|
3
3
|
//#region src/server.ts
|
|
4
4
|
const jsonResponse = (status, body, headers, raw = false) => new NextResponse$1(body === null || body === void 0 ? null : raw ? body : JSON.stringify(body), {
|
|
@@ -22,7 +22,7 @@ const asGetRequest = async (request) => {
|
|
|
22
22
|
signal: request.signal
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
const handleNextRequest = async (request, routes, router, options, guards, schemes, requestContext, pluginExports, jobs, configBodyLimit) => {
|
|
25
|
+
const handleNextRequest = async (request, routes, router, options, guards, schemes, requestContext, pluginExports, jobs, configBodyLimit, configNestingLimit) => {
|
|
26
26
|
const url = new URL(request.url);
|
|
27
27
|
const adapter = defineAdapter({
|
|
28
28
|
buildHandlerContext: (adapterRequest) => ({ request: adapterRequest.request }),
|
|
@@ -71,7 +71,8 @@ const handleNextRequest = async (request, routes, router, options, guards, schem
|
|
|
71
71
|
headers: headersToObject(request.headers),
|
|
72
72
|
readBody: (route) => parseFetchBody(request, route, bodyLimitOf(route, configBodyLimit)),
|
|
73
73
|
readRawBody: (route) => readBodyText(request, bodyLimitOf(route, configBodyLimit)),
|
|
74
|
-
configBodyLimit
|
|
74
|
+
configBodyLimit,
|
|
75
|
+
configNestingLimit
|
|
75
76
|
};
|
|
76
77
|
return adapter.handle({
|
|
77
78
|
routes: jobs.routes,
|
|
@@ -116,7 +117,8 @@ const handleNextRequest = async (request, routes, router, options, guards, schem
|
|
|
116
117
|
headers: headersToObject(request.headers),
|
|
117
118
|
readBody: (route) => parseFetchBody(request, route, bodyLimitOf(route, configBodyLimit)),
|
|
118
119
|
readRawBody: (route) => readBodyText(request, bodyLimitOf(route, configBodyLimit)),
|
|
119
|
-
configBodyLimit
|
|
120
|
+
configBodyLimit,
|
|
121
|
+
configNestingLimit
|
|
120
122
|
};
|
|
121
123
|
return adapter.handle({
|
|
122
124
|
routes,
|
|
@@ -142,7 +144,8 @@ const handleNextRequest = async (request, routes, router, options, guards, schem
|
|
|
142
144
|
headers: headersToObject(request.headers),
|
|
143
145
|
readBody: (route) => parseFetchBody(request, route, bodyLimitOf(route, configBodyLimit)),
|
|
144
146
|
readRawBody: (route) => readBodyText(request, bodyLimitOf(route, configBodyLimit)),
|
|
145
|
-
configBodyLimit
|
|
147
|
+
configBodyLimit,
|
|
148
|
+
configNestingLimit
|
|
146
149
|
};
|
|
147
150
|
return adapter.handle({
|
|
148
151
|
routes,
|
|
@@ -173,6 +176,7 @@ function mountNext(api, options) {
|
|
|
173
176
|
const requestContext = api[REQUEST_CONTEXT_META];
|
|
174
177
|
const jobsMeta = api[JOBS_META];
|
|
175
178
|
const configBodyLimit = api[BODY_LIMIT_META];
|
|
179
|
+
const configNestingLimit = api[NESTING_LIMIT_META];
|
|
176
180
|
const mountedJobs = jobsMeta ? {
|
|
177
181
|
routes: jobRoutes(jobsMeta),
|
|
178
182
|
router: jobRouter(jobsMeta),
|
|
@@ -192,9 +196,9 @@ function mountNext(api, options) {
|
|
|
192
196
|
const request = isMethodOverride(incoming.method, incoming.headers.get(METHOD_OVERRIDE_HEADER), incoming.headers.get("content-type")) ? await asGetRequest(incoming) : incoming;
|
|
193
197
|
if (hasPluginRoutes) {
|
|
194
198
|
const pathname = new URL(request.url).pathname;
|
|
195
|
-
if (!(matchRoute(request.method, pathname, api.routes, options?.basePath).kind === "matched") && matchRoute(request.method, pathname, pluginRoutes, options?.basePath).kind === "matched") return handleNextRequest(request, pluginRoutes, pluginRouter, handlerOptions, guards, schemes, requestContext, pluginExports, void 0, configBodyLimit);
|
|
199
|
+
if (!(matchRoute(request.method, pathname, api.routes, options?.basePath).kind === "matched") && matchRoute(request.method, pathname, pluginRoutes, options?.basePath).kind === "matched") return handleNextRequest(request, pluginRoutes, pluginRouter, handlerOptions, guards, schemes, requestContext, pluginExports, void 0, configBodyLimit, configNestingLimit);
|
|
196
200
|
}
|
|
197
|
-
return handleNextRequest(request, api.routes, api[ROUTER_META], handlerOptions, guards, schemes, requestContext, pluginExports, mountedJobs, configBodyLimit);
|
|
201
|
+
return handleNextRequest(request, api.routes, api[ROUTER_META], handlerOptions, guards, schemes, requestContext, pluginExports, mountedJobs, configBodyLimit, configNestingLimit);
|
|
198
202
|
};
|
|
199
203
|
return {
|
|
200
204
|
GET: handler,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kizunajs/next",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.40",
|
|
4
4
|
"description": "Next.js App Router adapter for Kizuna.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kizunajs",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"kizunajs": "2.0.0-beta.
|
|
59
|
+
"kizunajs": "2.0.0-beta.40",
|
|
60
60
|
"next": ">=16.0.0",
|
|
61
61
|
"zod": "^4.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"kizunajs": "2.0.0-beta.
|
|
64
|
+
"kizunajs": "2.0.0-beta.40",
|
|
65
65
|
"next": "^16.4.5",
|
|
66
66
|
"tsdown": "^0.21.10",
|
|
67
67
|
"typescript": "^6.0.3",
|