Comparing version 2.0.6 to 2.0.7
@@ -14,4 +14,4 @@ import { Context, Middleware } from "koa"; | ||
}; | ||
export declare type HTTPMethodRules<ResponseBody = {}, RequestBody extends ObjectShape | null = null, QueryParams = Record<string, string | undefined>> = { | ||
handler(context: ExtendedContext<RequestBody, QueryParams>): Promise<RequestHandlerResult<ResponseBody>>; | ||
export declare type HTTPMethodRules<ResponseBody = object, RequestBody extends ObjectShape | null = null, QueryParams = Record<string, string | undefined>> = { | ||
handler(context?: ExtendedContext<RequestBody, QueryParams>): Promise<RequestHandlerResult<ResponseBody>>; | ||
middleware?: { | ||
@@ -18,0 +18,0 @@ pre?: Middleware[]; |
export interface RequestHandlerResult<ResponseBody> { | ||
headers?: Record<string, string | number | boolean>; | ||
code?: number; | ||
body?: ResponseBody; | ||
body: ResponseBody; | ||
} |
@@ -23,3 +23,3 @@ import { Context, Middleware } from "koa"; | ||
export type HTTPMethodRules< | ||
ResponseBody = {}, | ||
ResponseBody = object, | ||
RequestBody extends ObjectShape | null = null, | ||
@@ -29,3 +29,3 @@ QueryParams = Record<string, string | undefined> | ||
handler( | ||
context: ExtendedContext<RequestBody, QueryParams> | ||
context?: ExtendedContext<RequestBody, QueryParams> | ||
): Promise<RequestHandlerResult<ResponseBody>>; | ||
@@ -32,0 +32,0 @@ middleware?: { |
export interface RequestHandlerResult<ResponseBody> { | ||
headers?: Record<string, string | number | boolean>; | ||
code?: number; | ||
body?: ResponseBody; | ||
body: ResponseBody; | ||
} |
@@ -8,3 +8,2 @@ import Koa, { Next } from "koa"; | ||
import { ExtendedContext } from "@/@types/http-method"; | ||
import { RouteController } from "@/@types/route-controller"; | ||
@@ -11,0 +10,0 @@ type ParsedController = ReturnType<typeof handleRoute>; |
{ | ||
"name": "18h", | ||
"description": "A Next.js style dynamic API router for Koa-based APIs.", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "url": "https://github.com/ridafkih/18h" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29610
652