@kaito-http/core 2.3.4 → 2.3.7

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.
@@ -2,51 +2,57 @@ import fmw, { HTTPMethod, Instance } from 'find-my-way';
2
2
  import { z } from 'zod';
3
3
  import { Route } from './route';
4
4
  import { ServerConfig } from './server';
5
- import { NormalizePath } from './util';
6
- export declare type RoutesInit<Context, Paths extends string = string> = {
7
- [Path in Paths]: Route<unknown, Path, HTTPMethod, Context, z.ZodSchema>;
5
+ import { NoEmpty, NormalizePath, Values } from './util';
6
+ export declare type RoutesInit<Context> = {
7
+ [Path in string]: Route<any, Path, HTTPMethod, Context, z.ZodSchema>;
8
8
  };
9
9
  export declare class Router<Context, Routes extends RoutesInit<Context>> {
10
- static 'create'<Context>(): Router<Context, {}>;
11
- private static 'handle';
10
+ static create<Context = null>(): Router<Context, {}>;
11
+ private static handle;
12
12
  readonly 'routes': Routes;
13
- readonly 'acl': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "ACL", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "ACL", Context, Input>; }>;
14
- readonly 'bind': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "BIND", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "BIND", Context, Input>; }>;
15
- readonly 'checkout': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "CHECKOUT", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "CHECKOUT", Context, Input>; }>;
16
- readonly 'connect': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "CONNECT", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "CONNECT", Context, Input>; }>;
17
- readonly 'copy': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "COPY", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "COPY", Context, Input>; }>;
18
- readonly 'delete': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "DELETE", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "DELETE", Context, Input>; }>;
19
- readonly 'get': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "GET", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "GET", Context, Input>; }>;
20
- readonly 'head': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "HEAD", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "HEAD", Context, Input>; }>;
21
- readonly 'link': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "LINK", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "LINK", Context, Input>; }>;
22
- readonly 'lock': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "LOCK", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "LOCK", Context, Input>; }>;
23
- readonly 'm-search': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "M-SEARCH", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "M-SEARCH", Context, Input>; }>;
24
- readonly 'mkactivity': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "MKACTIVITY", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "MKACTIVITY", Context, Input>; }>;
25
- readonly 'mkcalendar': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "MKCALENDAR", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "MKCALENDAR", Context, Input>; }>;
26
- readonly 'mkcol': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "MKCOL", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "MKCOL", Context, Input>; }>;
27
- readonly 'move': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "MOVE", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "MOVE", Context, Input>; }>;
28
- readonly 'notify': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "NOTIFY", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "NOTIFY", Context, Input>; }>;
29
- readonly 'options': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "OPTIONS", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "OPTIONS", Context, Input>; }>;
30
- readonly 'patch': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "PATCH", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "PATCH", Context, Input>; }>;
31
- readonly 'post': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "POST", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "POST", Context, Input>; }>;
32
- readonly 'propfind': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "PROPFIND", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "PROPFIND", Context, Input>; }>;
33
- readonly 'proppatch': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "PROPPATCH", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "PROPPATCH", Context, Input>; }>;
34
- readonly 'purge': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "PURGE", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "PURGE", Context, Input>; }>;
35
- readonly 'put': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "PUT", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "PUT", Context, Input>; }>;
36
- readonly 'rebind': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "REBIND", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "REBIND", Context, Input>; }>;
37
- readonly 'report': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "REPORT", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "REPORT", Context, Input>; }>;
38
- readonly 'search': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "SEARCH", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "SEARCH", Context, Input>; }>;
39
- readonly 'source': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "SOURCE", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "SOURCE", Context, Input>; }>;
40
- readonly 'subscribe': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "SUBSCRIBE", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "SUBSCRIBE", Context, Input>; }>;
41
- readonly 'trace': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "TRACE", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "TRACE", Context, Input>; }>;
42
- readonly 'unbind': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "UNBIND", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "UNBIND", Context, Input>; }>;
43
- readonly 'unlink': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "UNLINK", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "UNLINK", Context, Input>; }>;
44
- readonly 'unlock': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "UNLOCK", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "UNLOCK", Context, Input>; }>;
45
- readonly 'unsubscribe': <Result, Path extends string, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, route: Omit<Route<Result, (Path extends `${infer U}/` ? U : Path) extends `/${infer U_1}` ? `/${U_1}` : `/${Path extends `${infer U}/` ? U : Path}`, "UNSUBSCRIBE", Context, Input>, "method">) => Router<Context, Routes & { [P in Path as (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`]: Route<Result, (P extends `${infer U}/` ? U : P) extends `/${infer U_1}` ? `/${U_1}` : `/${P extends `${infer U}/` ? U : P}`, "UNSUBSCRIBE", Context, Input>; }>;
13
+ readonly 'acl': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "ACL", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "ACL", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "ACL", Context, Input>; }>;
14
+ readonly 'bind': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "BIND", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "BIND", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "BIND", Context, Input>; }>;
15
+ readonly 'checkout': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "CHECKOUT", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "CHECKOUT", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "CHECKOUT", Context, Input>; }>;
16
+ readonly 'connect': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "CONNECT", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "CONNECT", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "CONNECT", Context, Input>; }>;
17
+ readonly 'copy': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "COPY", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "COPY", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "COPY", Context, Input>; }>;
18
+ readonly 'delete': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "DELETE", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "DELETE", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "DELETE", Context, Input>; }>;
19
+ readonly 'get': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "GET", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "GET", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "GET", Context, Input>; }>;
20
+ readonly 'head': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "HEAD", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "HEAD", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "HEAD", Context, Input>; }>;
21
+ readonly 'link': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "LINK", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "LINK", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "LINK", Context, Input>; }>;
22
+ readonly 'lock': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "LOCK", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "LOCK", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "LOCK", Context, Input>; }>;
23
+ readonly 'm_search': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "M-SEARCH", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "M-SEARCH", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "M-SEARCH", Context, Input>; }>;
24
+ readonly 'mkactivity': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "MKACTIVITY", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "MKACTIVITY", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "MKACTIVITY", Context, Input>; }>;
25
+ readonly 'mkcalendar': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "MKCALENDAR", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "MKCALENDAR", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "MKCALENDAR", Context, Input>; }>;
26
+ readonly 'mkcol': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "MKCOL", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "MKCOL", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "MKCOL", Context, Input>; }>;
27
+ readonly 'move': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "MOVE", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "MOVE", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "MOVE", Context, Input>; }>;
28
+ readonly 'notify': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "NOTIFY", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "NOTIFY", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "NOTIFY", Context, Input>; }>;
29
+ readonly 'options': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "OPTIONS", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "OPTIONS", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "OPTIONS", Context, Input>; }>;
30
+ readonly 'patch': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "PATCH", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "PATCH", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "PATCH", Context, Input>; }>;
31
+ readonly 'post': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "POST", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "POST", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "POST", Context, Input>; }>;
32
+ readonly 'propfind': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "PROPFIND", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "PROPFIND", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "PROPFIND", Context, Input>; }>;
33
+ readonly 'proppatch': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "PROPPATCH", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "PROPPATCH", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "PROPPATCH", Context, Input>; }>;
34
+ readonly 'purge': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "PURGE", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "PURGE", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "PURGE", Context, Input>; }>;
35
+ readonly 'put': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "PUT", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "PUT", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "PUT", Context, Input>; }>;
36
+ readonly 'rebind': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "REBIND", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "REBIND", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "REBIND", Context, Input>; }>;
37
+ readonly 'report': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "REPORT", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "REPORT", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "REPORT", Context, Input>; }>;
38
+ readonly 'search': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "SEARCH", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "SEARCH", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "SEARCH", Context, Input>; }>;
39
+ readonly 'source': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "SOURCE", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "SOURCE", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "SOURCE", Context, Input>; }>;
40
+ readonly 'subscribe': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "SUBSCRIBE", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "SUBSCRIBE", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "SUBSCRIBE", Context, Input>; }>;
41
+ readonly 'trace': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "TRACE", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "TRACE", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "TRACE", Context, Input>; }>;
42
+ readonly 'unbind': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "UNBIND", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "UNBIND", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "UNBIND", Context, Input>; }>;
43
+ readonly 'unlink': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "UNLINK", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "UNLINK", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "UNLINK", Context, Input>; }>;
44
+ readonly 'unlock': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "UNLOCK", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "UNLOCK", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "UNLOCK", Context, Input>; }>;
45
+ readonly 'unsubscribe': <Result, Path extends `/${string}`, Input extends z.ZodType<any, z.ZodTypeDef, any> = never>(path: Path, route: Omit<Route<Result, Path, "UNSUBSCRIBE", Context, Input>, "method">) => Router<Context, Path extends keyof Routes ? NoEmpty<Pick<Routes, Path>> | { [key in Path]: Route<Result, Path, "UNSUBSCRIBE", Context, Input>; } : Routes & { [key_1 in Path]: Route<Result, Path, "UNSUBSCRIBE", Context, Input>; }>;
46
46
  private constructor();
47
- 'merge'<Prefix extends string, NewRoutes extends RoutesInit<Context>>(prefix: NormalizePath<Prefix>, router: Router<Context, NewRoutes>): Router<Context, Routes & { [Path in Extract<keyof NewRoutes, string> as `/${Prefix}${Path}`]: NewRoutes[Path] extends Route<infer Result, infer Path_1, infer Method, infer Context_1, infer Input> ? Route<Result, `/${Prefix}${Path_1}`, Method, Context_1, Input> : never; }>;
48
- 'toFindMyWay'(server: ServerConfig<Context>): Instance<fmw.HTTPVersion.V1>;
49
- private 'make';
47
+ merge<Prefix extends string, NewRoutes extends RoutesInit<Context>>(prefix: NormalizePath<Prefix>, router: Router<Context, NewRoutes>): Router<Context, Routes & { [Path in Extract<keyof NewRoutes, string> as `/${Prefix}${Path}`]: Values<{ [M in NewRoutes[Path]["method"]]: Omit<Extract<NewRoutes[Path], {
48
+ method: M;
49
+ }>, "method" | "path"> & {
50
+ path: `/${Prefix}${Path}`;
51
+ method: M;
52
+ }; }>; }>;
53
+ toFindMyWay(server: ServerConfig<Context>): Instance<fmw.HTTPVersion.V1>;
54
+ _copy<NewRoutes extends RoutesInit<Context>>(routes: NewRoutes): Router<Context, NewRoutes>;
55
+ private make;
50
56
  }
51
57
  /**
52
58
  * @deprecated Please use Router#create instead
@@ -12,6 +12,7 @@ export declare function getLastEntryInMultiHeaderValue(headerValue: string | str
12
12
  declare type RemoveEndSlashes<T extends string> = T extends `${infer U}/` ? U : T;
13
13
  declare type AddStartSlashes<T extends string> = T extends `/${infer U}` ? `/${U}` : `/${T}`;
14
14
  export declare type NormalizePath<T extends string> = AddStartSlashes<RemoveEndSlashes<T>>;
15
- export declare function normalizePath<T extends string>(path: T): NormalizePath<T>;
15
+ export declare type Values<T> = T[keyof T];
16
+ export declare type NoEmpty<T> = [keyof T] extends [never] ? never : T;
16
17
  export declare function getInput(req: KaitoRequest): Promise<unknown>;
17
18
  export {};
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var http = require('http');
6
6
  var fmw = require('find-my-way');
7
7
  var tls = require('tls');
8
+ var contentType = require('content-type');
8
9
  var getRawBody = require('raw-body');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -169,19 +170,6 @@ function getLastEntryInMultiHeaderValue(headerValue) {
169
170
  var lastIndex = normalized.lastIndexOf(',');
170
171
  return lastIndex === -1 ? normalized.trim() : normalized.slice(lastIndex + 1).trim();
171
172
  }
172
- function normalizePath(path) {
173
- var result = path;
174
-
175
- if (!result.startsWith('/')) {
176
- result = "/".concat(result);
177
- }
178
-
179
- if (result.endsWith('/')) {
180
- result = result.slice(-1);
181
- }
182
-
183
- return result;
184
- }
185
173
  function getInput(_x) {
186
174
  return _getInput.apply(this, arguments);
187
175
  }
@@ -200,7 +188,15 @@ function _getInput() {
200
188
 
201
189
  var buffer = yield getRawBody__default["default"](req.raw);
202
190
 
203
- switch (req.headers['content-type']) {
191
+ if (!req.headers['content-type']) {
192
+ return null;
193
+ }
194
+
195
+ var {
196
+ type
197
+ } = contentType.parse(req.headers['content-type']);
198
+
199
+ switch (type) {
204
200
  case 'application/json':
205
201
  {
206
202
  return JSON.parse(buffer.toString());
@@ -291,11 +287,11 @@ class KaitoResponse {
291
287
  }
292
288
 
293
289
  class Router {
294
- static 'create'() {
290
+ static create() {
295
291
  return new Router({});
296
292
  }
297
293
 
298
- static 'handle'(server, options) {
294
+ static handle(server, options) {
299
295
  return _asyncToGenerator(function* () {
300
296
  try {
301
297
  var _options$route$input$, _options$route$input;
@@ -345,7 +341,7 @@ class Router {
345
341
  })();
346
342
  }
347
343
 
348
- 'constructor'(routes) {
344
+ constructor(routes) {
349
345
  _defineProperty(this, 'acl', this.make('ACL'));
350
346
 
351
347
  _defineProperty(this, 'bind', this.make('BIND'));
@@ -366,7 +362,7 @@ class Router {
366
362
 
367
363
  _defineProperty(this, 'lock', this.make('LOCK'));
368
364
 
369
- _defineProperty(this, 'm-search', this.make('M-SEARCH'));
365
+ _defineProperty(this, 'm_search', this.make('M-SEARCH'));
370
366
 
371
367
  _defineProperty(this, 'mkactivity', this.make('MKACTIVITY'));
372
368
 
@@ -415,15 +411,18 @@ class Router {
415
411
  this.routes = routes;
416
412
  }
417
413
 
418
- 'merge'(prefix, router) {
414
+ merge(prefix, router) {
419
415
  var newRoutes = Object.fromEntries(Object.entries(router.routes).map(_ref => {
420
416
  var [k, v] = _ref;
421
417
  return ["".concat(prefix).concat(k), v];
422
418
  }));
423
- return new Router(_objectSpread2(_objectSpread2({}, this.routes), newRoutes));
419
+
420
+ var merged = _objectSpread2(_objectSpread2({}, this.routes), newRoutes);
421
+
422
+ return this._copy(merged);
424
423
  }
425
424
 
426
- 'toFindMyWay'(server) {
425
+ toFindMyWay(server) {
427
426
  var _this = this;
428
427
 
429
428
  var instance = fmw__default["default"]({
@@ -440,7 +439,8 @@ class Router {
440
439
  });
441
440
  }
442
441
 
443
- }); // eslint-disable-next-line guard-for-in
442
+ });
443
+ var paths = Object.keys(this.routes);
444
444
 
445
445
  var _loop = function _loop(path) {
446
446
  var route = _this.routes[path];
@@ -462,22 +462,31 @@ class Router {
462
462
  }());
463
463
  };
464
464
 
465
- for (var path in this.routes) {
465
+ for (var path of paths) {
466
466
  _loop(path);
467
467
  }
468
468
 
469
469
  return instance;
470
470
  }
471
471
 
472
- 'make'(method) {
472
+ _copy(routes) {
473
+ return new Router(routes);
474
+ }
475
+
476
+ make(method) {
473
477
  return (path, route) => {
474
- var mergedRoute = _objectSpread2(_objectSpread2({}, route), {}, {
478
+ var addedRoute = _objectSpread2(_objectSpread2({}, route), {}, {
475
479
  method
480
+ }); // `as unknown` is required because otherwise
481
+ // this type just gets massive and too slow,
482
+ // so we have to write it out specifically
483
+
484
+
485
+ var merged = _objectSpread2(_objectSpread2({}, this.routes), {}, {
486
+ [path]: addedRoute
476
487
  });
477
488
 
478
- return new Router(_objectSpread2(_objectSpread2({}, this.routes), {}, {
479
- [path]: mergedRoute
480
- }));
489
+ return this._copy(merged);
481
490
  };
482
491
  }
483
492
 
@@ -499,4 +508,3 @@ exports.createRouter = createRouter;
499
508
  exports.createServer = createServer;
500
509
  exports.getInput = getInput;
501
510
  exports.getLastEntryInMultiHeaderValue = getLastEntryInMultiHeaderValue;
502
- exports.normalizePath = normalizePath;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var http = require('http');
6
6
  var fmw = require('find-my-way');
7
7
  var tls = require('tls');
8
+ var contentType = require('content-type');
8
9
  var getRawBody = require('raw-body');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -169,19 +170,6 @@ function getLastEntryInMultiHeaderValue(headerValue) {
169
170
  var lastIndex = normalized.lastIndexOf(',');
170
171
  return lastIndex === -1 ? normalized.trim() : normalized.slice(lastIndex + 1).trim();
171
172
  }
172
- function normalizePath(path) {
173
- var result = path;
174
-
175
- if (!result.startsWith('/')) {
176
- result = "/".concat(result);
177
- }
178
-
179
- if (result.endsWith('/')) {
180
- result = result.slice(-1);
181
- }
182
-
183
- return result;
184
- }
185
173
  function getInput(_x) {
186
174
  return _getInput.apply(this, arguments);
187
175
  }
@@ -200,7 +188,15 @@ function _getInput() {
200
188
 
201
189
  var buffer = yield getRawBody__default["default"](req.raw);
202
190
 
203
- switch (req.headers['content-type']) {
191
+ if (!req.headers['content-type']) {
192
+ return null;
193
+ }
194
+
195
+ var {
196
+ type
197
+ } = contentType.parse(req.headers['content-type']);
198
+
199
+ switch (type) {
204
200
  case 'application/json':
205
201
  {
206
202
  return JSON.parse(buffer.toString());
@@ -291,11 +287,11 @@ class KaitoResponse {
291
287
  }
292
288
 
293
289
  class Router {
294
- static 'create'() {
290
+ static create() {
295
291
  return new Router({});
296
292
  }
297
293
 
298
- static 'handle'(server, options) {
294
+ static handle(server, options) {
299
295
  return _asyncToGenerator(function* () {
300
296
  try {
301
297
  var _options$route$input$, _options$route$input;
@@ -345,7 +341,7 @@ class Router {
345
341
  })();
346
342
  }
347
343
 
348
- 'constructor'(routes) {
344
+ constructor(routes) {
349
345
  _defineProperty(this, 'acl', this.make('ACL'));
350
346
 
351
347
  _defineProperty(this, 'bind', this.make('BIND'));
@@ -366,7 +362,7 @@ class Router {
366
362
 
367
363
  _defineProperty(this, 'lock', this.make('LOCK'));
368
364
 
369
- _defineProperty(this, 'm-search', this.make('M-SEARCH'));
365
+ _defineProperty(this, 'm_search', this.make('M-SEARCH'));
370
366
 
371
367
  _defineProperty(this, 'mkactivity', this.make('MKACTIVITY'));
372
368
 
@@ -415,15 +411,18 @@ class Router {
415
411
  this.routes = routes;
416
412
  }
417
413
 
418
- 'merge'(prefix, router) {
414
+ merge(prefix, router) {
419
415
  var newRoutes = Object.fromEntries(Object.entries(router.routes).map(_ref => {
420
416
  var [k, v] = _ref;
421
417
  return ["".concat(prefix).concat(k), v];
422
418
  }));
423
- return new Router(_objectSpread2(_objectSpread2({}, this.routes), newRoutes));
419
+
420
+ var merged = _objectSpread2(_objectSpread2({}, this.routes), newRoutes);
421
+
422
+ return this._copy(merged);
424
423
  }
425
424
 
426
- 'toFindMyWay'(server) {
425
+ toFindMyWay(server) {
427
426
  var _this = this;
428
427
 
429
428
  var instance = fmw__default["default"]({
@@ -440,7 +439,8 @@ class Router {
440
439
  });
441
440
  }
442
441
 
443
- }); // eslint-disable-next-line guard-for-in
442
+ });
443
+ var paths = Object.keys(this.routes);
444
444
 
445
445
  var _loop = function _loop(path) {
446
446
  var route = _this.routes[path];
@@ -462,22 +462,31 @@ class Router {
462
462
  }());
463
463
  };
464
464
 
465
- for (var path in this.routes) {
465
+ for (var path of paths) {
466
466
  _loop(path);
467
467
  }
468
468
 
469
469
  return instance;
470
470
  }
471
471
 
472
- 'make'(method) {
472
+ _copy(routes) {
473
+ return new Router(routes);
474
+ }
475
+
476
+ make(method) {
473
477
  return (path, route) => {
474
- var mergedRoute = _objectSpread2(_objectSpread2({}, route), {}, {
478
+ var addedRoute = _objectSpread2(_objectSpread2({}, route), {}, {
475
479
  method
480
+ }); // `as unknown` is required because otherwise
481
+ // this type just gets massive and too slow,
482
+ // so we have to write it out specifically
483
+
484
+
485
+ var merged = _objectSpread2(_objectSpread2({}, this.routes), {}, {
486
+ [path]: addedRoute
476
487
  });
477
488
 
478
- return new Router(_objectSpread2(_objectSpread2({}, this.routes), {}, {
479
- [path]: mergedRoute
480
- }));
489
+ return this._copy(merged);
481
490
  };
482
491
  }
483
492
 
@@ -499,4 +508,3 @@ exports.createRouter = createRouter;
499
508
  exports.createServer = createServer;
500
509
  exports.getInput = getInput;
501
510
  exports.getLastEntryInMultiHeaderValue = getLastEntryInMultiHeaderValue;
502
- exports.normalizePath = normalizePath;
@@ -1,6 +1,7 @@
1
1
  import * as http from 'http';
2
2
  import fmw from 'find-my-way';
3
3
  import { TLSSocket } from 'tls';
4
+ import { parse } from 'content-type';
4
5
  import getRawBody from 'raw-body';
5
6
 
6
7
  function createFMWServer(config) {
@@ -141,19 +142,6 @@ function getLastEntryInMultiHeaderValue(headerValue) {
141
142
  var lastIndex = normalized.lastIndexOf(',');
142
143
  return lastIndex === -1 ? normalized.trim() : normalized.slice(lastIndex + 1).trim();
143
144
  }
144
- function normalizePath(path) {
145
- var result = path;
146
-
147
- if (!result.startsWith('/')) {
148
- result = "/".concat(result);
149
- }
150
-
151
- if (result.endsWith('/')) {
152
- result = result.slice(-1);
153
- }
154
-
155
- return result;
156
- }
157
145
  function getInput(_x) {
158
146
  return _getInput.apply(this, arguments);
159
147
  }
@@ -172,7 +160,15 @@ function _getInput() {
172
160
 
173
161
  var buffer = yield getRawBody(req.raw);
174
162
 
175
- switch (req.headers['content-type']) {
163
+ if (!req.headers['content-type']) {
164
+ return null;
165
+ }
166
+
167
+ var {
168
+ type
169
+ } = parse(req.headers['content-type']);
170
+
171
+ switch (type) {
176
172
  case 'application/json':
177
173
  {
178
174
  return JSON.parse(buffer.toString());
@@ -263,11 +259,11 @@ class KaitoResponse {
263
259
  }
264
260
 
265
261
  class Router {
266
- static 'create'() {
262
+ static create() {
267
263
  return new Router({});
268
264
  }
269
265
 
270
- static 'handle'(server, options) {
266
+ static handle(server, options) {
271
267
  return _asyncToGenerator(function* () {
272
268
  try {
273
269
  var _options$route$input$, _options$route$input;
@@ -317,7 +313,7 @@ class Router {
317
313
  })();
318
314
  }
319
315
 
320
- 'constructor'(routes) {
316
+ constructor(routes) {
321
317
  _defineProperty(this, 'acl', this.make('ACL'));
322
318
 
323
319
  _defineProperty(this, 'bind', this.make('BIND'));
@@ -338,7 +334,7 @@ class Router {
338
334
 
339
335
  _defineProperty(this, 'lock', this.make('LOCK'));
340
336
 
341
- _defineProperty(this, 'm-search', this.make('M-SEARCH'));
337
+ _defineProperty(this, 'm_search', this.make('M-SEARCH'));
342
338
 
343
339
  _defineProperty(this, 'mkactivity', this.make('MKACTIVITY'));
344
340
 
@@ -387,15 +383,18 @@ class Router {
387
383
  this.routes = routes;
388
384
  }
389
385
 
390
- 'merge'(prefix, router) {
386
+ merge(prefix, router) {
391
387
  var newRoutes = Object.fromEntries(Object.entries(router.routes).map(_ref => {
392
388
  var [k, v] = _ref;
393
389
  return ["".concat(prefix).concat(k), v];
394
390
  }));
395
- return new Router(_objectSpread2(_objectSpread2({}, this.routes), newRoutes));
391
+
392
+ var merged = _objectSpread2(_objectSpread2({}, this.routes), newRoutes);
393
+
394
+ return this._copy(merged);
396
395
  }
397
396
 
398
- 'toFindMyWay'(server) {
397
+ toFindMyWay(server) {
399
398
  var _this = this;
400
399
 
401
400
  var instance = fmw({
@@ -412,7 +411,8 @@ class Router {
412
411
  });
413
412
  }
414
413
 
415
- }); // eslint-disable-next-line guard-for-in
414
+ });
415
+ var paths = Object.keys(this.routes);
416
416
 
417
417
  var _loop = function _loop(path) {
418
418
  var route = _this.routes[path];
@@ -434,22 +434,31 @@ class Router {
434
434
  }());
435
435
  };
436
436
 
437
- for (var path in this.routes) {
437
+ for (var path of paths) {
438
438
  _loop(path);
439
439
  }
440
440
 
441
441
  return instance;
442
442
  }
443
443
 
444
- 'make'(method) {
444
+ _copy(routes) {
445
+ return new Router(routes);
446
+ }
447
+
448
+ make(method) {
445
449
  return (path, route) => {
446
- var mergedRoute = _objectSpread2(_objectSpread2({}, route), {}, {
450
+ var addedRoute = _objectSpread2(_objectSpread2({}, route), {}, {
447
451
  method
452
+ }); // `as unknown` is required because otherwise
453
+ // this type just gets massive and too slow,
454
+ // so we have to write it out specifically
455
+
456
+
457
+ var merged = _objectSpread2(_objectSpread2({}, this.routes), {}, {
458
+ [path]: addedRoute
448
459
  });
449
460
 
450
- return new Router(_objectSpread2(_objectSpread2({}, this.routes), {}, {
451
- [path]: mergedRoute
452
- }));
461
+ return this._copy(merged);
453
462
  };
454
463
  }
455
464
 
@@ -460,4 +469,4 @@ class Router {
460
469
 
461
470
  var createRouter = Router.create;
462
471
 
463
- export { KaitoError, KaitoRequest, KaitoResponse, Router, WrappedError, createFMWServer, createGetContext, createRouter, createServer, getInput, getLastEntryInMultiHeaderValue, normalizePath };
472
+ export { KaitoError, KaitoRequest, KaitoResponse, Router, WrappedError, createFMWServer, createGetContext, createRouter, createServer, getInput, getLastEntryInMultiHeaderValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaito-http/core",
3
- "version": "2.3.4",
3
+ "version": "2.3.7",
4
4
  "description": "Functional HTTP Framework for TypeScript",
5
5
  "repository": "https://github.com/kaito-http/kaito",
6
6
  "author": "Alistair Smith <hi@alistair.sh>",
@@ -9,8 +9,8 @@
9
9
  "module": "dist/kaito-http-core.esm.js",
10
10
  "types": "dist/kaito-http-core.cjs.d.ts",
11
11
  "devDependencies": {
12
- "@types/body-parser": "^1.19.2",
13
- "@types/node": "^17.0.24",
12
+ "@types/content-type": "^1.1.5",
13
+ "@types/node": "^17.0.25",
14
14
  "typescript": "4.6",
15
15
  "zod": "^3.14.4"
16
16
  },
@@ -32,6 +32,7 @@
32
32
  "framework"
33
33
  ],
34
34
  "dependencies": {
35
+ "content-type": "^1.0.4",
35
36
  "find-my-way": "^5.5.0",
36
37
  "raw-body": "^2.5.1"
37
38
  }