hono 3.5.1 → 3.5.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/dist/types/adapter/aws-lambda/handler.d.ts +2 -2
- package/dist/types/client/types.d.ts +4 -12
- package/dist/types/hono-base.d.ts +4 -4
- package/dist/types/hono.d.ts +2 -2
- package/dist/types/preset/quick.d.ts +2 -2
- package/dist/types/preset/tiny.d.ts +2 -2
- package/dist/types/types.d.ts +39 -29
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Hono } from '../../hono';
|
|
2
|
-
import type { Env } from '../../types';
|
|
2
|
+
import type { Env, Schema } from '../../types';
|
|
3
3
|
import type { ApiGatewayRequestContext, LambdaFunctionUrlRequestContext } from './custom-context';
|
|
4
4
|
interface APIGatewayProxyEventV2 {
|
|
5
5
|
httpMethod: string;
|
|
@@ -36,7 +36,7 @@ interface APIGatewayProxyResult {
|
|
|
36
36
|
/**
|
|
37
37
|
* Accepts events from API Gateway/ELB(`APIGatewayProxyEvent`) and directly through Function Url(`APIGatewayProxyEventV2`)
|
|
38
38
|
*/
|
|
39
|
-
export declare const handle: <E extends Env = Env, S = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => (event: APIGatewayProxyEvent | APIGatewayProxyEventV2 | LambdaFunctionUrlEvent) => Promise<APIGatewayProxyResult>;
|
|
39
|
+
export declare const handle: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => (event: APIGatewayProxyEvent | APIGatewayProxyEventV2 | LambdaFunctionUrlEvent) => Promise<APIGatewayProxyResult>;
|
|
40
40
|
export declare const isContentTypeBinary: (contentType: string) => boolean;
|
|
41
41
|
export declare const isContentEncodingBinary: (contentEncoding: string | null) => boolean;
|
|
42
42
|
export {};
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import type { Hono } from '../hono';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Schema } from '../types';
|
|
3
3
|
import type { RemoveBlankRecord } from '../utils/types';
|
|
4
|
-
declare type MethodName = `$${string}`;
|
|
5
|
-
declare type Endpoint = Record<MethodName, Data>;
|
|
6
|
-
declare type Data = {
|
|
7
|
-
input: Partial<ValidationTargets> & {
|
|
8
|
-
param?: Record<string, string>;
|
|
9
|
-
};
|
|
10
|
-
output: {};
|
|
11
|
-
};
|
|
12
4
|
export declare type ClientRequestOptions = {
|
|
13
5
|
headers?: Record<string, string>;
|
|
14
6
|
fetch?: typeof fetch;
|
|
15
7
|
};
|
|
16
|
-
declare type ClientRequest<S extends
|
|
8
|
+
declare type ClientRequest<S extends Schema> = {
|
|
17
9
|
[M in keyof S]: S[M] extends {
|
|
18
10
|
input: infer R;
|
|
19
11
|
output: infer O;
|
|
@@ -38,12 +30,12 @@ export interface Response extends ClientResponse<unknown> {
|
|
|
38
30
|
export declare type Fetch<T> = (args?: InferRequestType<T>, opt?: ClientRequestOptions) => Promise<ClientResponse<InferResponseType<T>>>;
|
|
39
31
|
export declare type InferResponseType<T> = T extends (args: any | undefined) => Promise<ClientResponse<infer O>> ? O : never;
|
|
40
32
|
export declare type InferRequestType<T> = T extends (args: infer R) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never;
|
|
41
|
-
declare type PathToChain<Path extends string, E extends
|
|
33
|
+
declare type PathToChain<Path extends string, E extends Schema, Original extends string = ''> = Path extends `/${infer P}` ? PathToChain<P, E, Path> : Path extends `${infer P}/${infer R}` ? {
|
|
42
34
|
[K in P]: PathToChain<R, E, Original>;
|
|
43
35
|
} : {
|
|
44
36
|
[K in Path extends '' ? 'index' : Path]: ClientRequest<E extends Record<string, unknown> ? E[Original] : never>;
|
|
45
37
|
};
|
|
46
|
-
export declare type Client<T> = T extends Hono<any, infer S, any> ? S extends Record<infer K,
|
|
38
|
+
export declare type Client<T> = T extends Hono<any, infer S, any> ? S extends Record<infer K, Schema> ? K extends string ? PathToChain<K, S> : never : never : never;
|
|
47
39
|
export declare type Callback = (opts: CallbackOptions) => unknown;
|
|
48
40
|
interface CallbackOptions {
|
|
49
41
|
path: string[];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Context } from './context';
|
|
2
2
|
import type { ExecutionContext } from './context';
|
|
3
3
|
import type { Router } from './router';
|
|
4
|
-
import type { Env, ErrorHandler, H, HandlerInterface, MiddlewareHandlerInterface, NotFoundHandler, OnHandlerInterface, MergePath, MergeSchemaPath, FetchEventLike } from './types';
|
|
4
|
+
import type { Env, ErrorHandler, H, HandlerInterface, MiddlewareHandlerInterface, NotFoundHandler, OnHandlerInterface, MergePath, MergeSchemaPath, FetchEventLike, Schema } from './types';
|
|
5
5
|
import type { RemoveBlankRecord } from './utils/types';
|
|
6
6
|
interface RouterRoute {
|
|
7
7
|
path: string;
|
|
8
8
|
method: string;
|
|
9
9
|
handler: H;
|
|
10
10
|
}
|
|
11
|
-
declare const Hono_base: new <E_1 extends Env = Env, S_1 = {}, BasePath_1 extends string = "/">() => {
|
|
11
|
+
declare const Hono_base: new <E_1 extends Env = Env, S_1 extends Schema = {}, BasePath_1 extends string = "/">() => {
|
|
12
12
|
all: HandlerInterface<E_1, "all", S_1, BasePath_1>;
|
|
13
13
|
options: HandlerInterface<E_1, "options", S_1, BasePath_1>;
|
|
14
14
|
get: HandlerInterface<E_1, "get", S_1, BasePath_1>;
|
|
@@ -21,7 +21,7 @@ declare const Hono_base: new <E_1 extends Env = Env, S_1 = {}, BasePath_1 extend
|
|
|
21
21
|
} & {
|
|
22
22
|
use: MiddlewareHandlerInterface<E_1, S_1, BasePath_1>;
|
|
23
23
|
};
|
|
24
|
-
declare class Hono<E extends Env = Env, S = {}, BasePath extends string = '/'> extends Hono_base<E, S, BasePath> {
|
|
24
|
+
declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> extends Hono_base<E, S, BasePath> {
|
|
25
25
|
router: Router<H>;
|
|
26
26
|
readonly getPath: (request: Request, options?: {
|
|
27
27
|
env?: E['Bindings'];
|
|
@@ -35,7 +35,7 @@ declare class Hono<E extends Env = Env, S = {}, BasePath extends string = '/'> e
|
|
|
35
35
|
private clone;
|
|
36
36
|
private notFoundHandler;
|
|
37
37
|
private errorHandler;
|
|
38
|
-
route<SubPath extends string, SubEnv extends Env, SubSchema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E,
|
|
38
|
+
route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, SubPath> & S, BasePath>;
|
|
39
39
|
/** @description
|
|
40
40
|
* Use `basePath` instead of `route` when passing **one** argument, such as `app.route('/api')`.
|
|
41
41
|
* The use of `route` with **one** argument has been removed in v4.
|
package/dist/types/hono.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HonoBase } from './hono-base';
|
|
2
|
-
import type { Env } from './types';
|
|
3
|
-
export declare class Hono<E extends Env = Env, S = {}, BasePath extends string = '/'> extends HonoBase<E, S, BasePath> {
|
|
2
|
+
import type { Env, Schema } from './types';
|
|
3
|
+
export declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> extends HonoBase<E, S, BasePath> {
|
|
4
4
|
constructor(init?: Partial<Pick<Hono, 'router' | 'getPath'> & {
|
|
5
5
|
strict: boolean;
|
|
6
6
|
}>);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HonoBase } from '../hono-base';
|
|
2
|
-
import type { Env } from '../types';
|
|
3
|
-
export declare class Hono<E extends Env = Env, S = {}, BasePath extends string = '/'> extends HonoBase<E, S, BasePath> {
|
|
2
|
+
import type { Env, Schema } from '../types';
|
|
3
|
+
export declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> extends HonoBase<E, S, BasePath> {
|
|
4
4
|
constructor(init?: Partial<Pick<Hono, 'getPath'> & {
|
|
5
5
|
strict: boolean;
|
|
6
6
|
}>);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HonoBase } from '../hono-base';
|
|
2
|
-
import type { Env } from '../types';
|
|
3
|
-
export declare class Hono<E extends Env = Env, S = {}, BasePath extends string = '/'> extends HonoBase<E, S, BasePath> {
|
|
2
|
+
import type { Env, Schema } from '../types';
|
|
3
|
+
export declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> extends HonoBase<E, S, BasePath> {
|
|
4
4
|
constructor(init?: Partial<Pick<Hono, 'getPath'> & {
|
|
5
5
|
strict: boolean;
|
|
6
6
|
}>);
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from './context';
|
|
2
2
|
import type { Hono } from './hono';
|
|
3
|
-
import type { UnionToIntersection
|
|
3
|
+
import type { UnionToIntersection } from './utils/types';
|
|
4
4
|
export declare type Bindings = Record<string, unknown>;
|
|
5
5
|
export declare type Variables = Record<string, unknown>;
|
|
6
6
|
export declare type Env = {
|
|
@@ -19,77 +19,87 @@ export declare type MiddlewareHandler<E extends Env = any, P extends string = an
|
|
|
19
19
|
export declare type H<E extends Env = any, P extends string = any, I extends Input = {}, O = {}> = Handler<E, P, I, O> | MiddlewareHandler<E, P, I>;
|
|
20
20
|
export declare type NotFoundHandler<E extends Env = any> = (c: Context<E>) => Response | Promise<Response>;
|
|
21
21
|
export declare type ErrorHandler<E extends Env = any> = (err: Error, c: Context<E>) => Response | Promise<Response>;
|
|
22
|
-
export interface HandlerInterface<E extends Env = Env, M extends string = any, S = {}, BasePath extends string = '/'> {
|
|
23
|
-
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, I extends Input = {}, O = {}>(...handlers: [H<E, P, I, O>, H<E, P, I, O>]): Hono<E,
|
|
24
|
-
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2>(...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>]): Hono<E,
|
|
25
|
-
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3>(...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>, H<E, P, I4, O>]): Hono<E,
|
|
26
|
-
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I2 & I3, I5 extends Input = I & I2 & I3 & I4>(...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>, H<E, P, I4, O>, H<E, P, I5, O>]): Hono<E,
|
|
27
|
-
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, I extends Input = {}, O = {}>(...handlers: Handler<E, P, I, O>[]): Hono<E,
|
|
28
|
-
<P extends string, O = {}, I extends Input = {}>(path: P, handler: H<E, MergePath<BasePath, P>, I, O>): Hono<E,
|
|
29
|
-
<P extends string, O = {}, I extends Input = {}>(path: P, ...handlers: [H<E, MergePath<BasePath, P>, I, O>, H<E, MergePath<BasePath, P>, I, O>]): Hono<E,
|
|
22
|
+
export interface HandlerInterface<E extends Env = Env, M extends string = any, S extends Schema = {}, BasePath extends string = '/'> {
|
|
23
|
+
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, I extends Input = {}, O = {}>(...handlers: [H<E, P, I, O>, H<E, P, I, O>]): Hono<E, S & ToSchema<M, P, I['in'], O>, BasePath>;
|
|
24
|
+
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2>(...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>]): Hono<E, S & ToSchema<M, P, I3['in'], O>, BasePath>;
|
|
25
|
+
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3>(...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>, H<E, P, I4, O>]): Hono<E, S & ToSchema<M, P, I4['in'], O>, BasePath>;
|
|
26
|
+
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I2 & I3, I5 extends Input = I & I2 & I3 & I4>(...handlers: [H<E, P, I, O>, H<E, P, I2, O>, H<E, P, I3, O>, H<E, P, I4, O>, H<E, P, I5, O>]): Hono<E, S & ToSchema<M, P, I5['in'], O>, BasePath>;
|
|
27
|
+
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, I extends Input = {}, O = {}>(...handlers: Handler<E, P, I, O>[]): Hono<E, S & ToSchema<M, P, I['in'], O>, BasePath>;
|
|
28
|
+
<P extends string, O = {}, I extends Input = {}>(path: P, handler: H<E, MergePath<BasePath, P>, I, O>): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I['in'], O>, BasePath>;
|
|
29
|
+
<P extends string, O = {}, I extends Input = {}>(path: P, ...handlers: [H<E, MergePath<BasePath, P>, I, O>, H<E, MergePath<BasePath, P>, I, O>]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I['in'], O>, BasePath>;
|
|
30
30
|
<P extends string, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2>(path: P, ...handlers: [
|
|
31
31
|
H<E, MergePath<BasePath, P>, I, O>,
|
|
32
32
|
H<E, MergePath<BasePath, P>, I2, O>,
|
|
33
33
|
H<E, MergePath<BasePath, P>, I3, O>
|
|
34
|
-
]): Hono<E,
|
|
34
|
+
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I3['in'], O>, BasePath>;
|
|
35
35
|
<P extends string, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3>(path: P, ...handlers: [
|
|
36
36
|
H<E, MergePath<BasePath, P>, I, O>,
|
|
37
37
|
H<E, MergePath<BasePath, P>, I2, O>,
|
|
38
38
|
H<E, MergePath<BasePath, P>, I3, O>,
|
|
39
39
|
H<E, MergePath<BasePath, P>, I4, O>
|
|
40
|
-
]): Hono<E,
|
|
40
|
+
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I4['in'], O>, BasePath>;
|
|
41
41
|
<P extends string, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I2 & I3, I5 extends Input = I & I2 & I3 & I4>(path: P, ...handlers: [
|
|
42
42
|
H<E, MergePath<BasePath, P>, I, O>,
|
|
43
43
|
H<E, MergePath<BasePath, P>, I2, O>,
|
|
44
44
|
H<E, MergePath<BasePath, P>, I3, O>,
|
|
45
45
|
H<E, MergePath<BasePath, P>, I4, O>,
|
|
46
46
|
H<E, MergePath<BasePath, P>, I5, O>
|
|
47
|
-
]): Hono<E,
|
|
48
|
-
<P extends string, I extends Input = {}, O = {}>(path: P, ...handlers: H<E, MergePath<BasePath, P>, I, O>[]): Hono<E,
|
|
47
|
+
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I5['in'], O>, BasePath>;
|
|
48
|
+
<P extends string, I extends Input = {}, O = {}>(path: P, ...handlers: H<E, MergePath<BasePath, P>, I, O>[]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I['in'], O>, BasePath>;
|
|
49
49
|
}
|
|
50
|
-
export interface MiddlewareHandlerInterface<E extends Env = Env, S = {}, BasePath extends string = '/'> {
|
|
50
|
+
export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> {
|
|
51
51
|
(...handlers: MiddlewareHandler<E, MergePath<BasePath, ExtractKey<S>>>[]): Hono<E, S, BasePath>;
|
|
52
52
|
<P extends string>(path: P, ...handlers: MiddlewareHandler<E, MergePath<BasePath, P>>[]): Hono<E, S, BasePath>;
|
|
53
53
|
}
|
|
54
|
-
export interface OnHandlerInterface<E extends Env = Env, S = {}, BasePath extends string = '/'> {
|
|
55
|
-
<M extends string, P extends string, O = {}, I extends Input = {}>(method: M, path: P, ...handlers: [H<E, MergePath<BasePath, P>, I, O>, H<E, MergePath<BasePath, P>, I, O>]): Hono<E,
|
|
54
|
+
export interface OnHandlerInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> {
|
|
55
|
+
<M extends string, P extends string, O = {}, I extends Input = {}>(method: M, path: P, ...handlers: [H<E, MergePath<BasePath, P>, I, O>, H<E, MergePath<BasePath, P>, I, O>]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I['in'], O>, BasePath>;
|
|
56
56
|
<M extends string, P extends string, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2>(method: M, path: P, ...handlers: [
|
|
57
57
|
H<E, MergePath<BasePath, P>, I, O>,
|
|
58
58
|
H<E, MergePath<BasePath, P>, I2, O>,
|
|
59
59
|
H<E, MergePath<BasePath, P>, I3, O>
|
|
60
|
-
]): Hono<E,
|
|
60
|
+
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I3['in'], O>, BasePath>;
|
|
61
61
|
<M extends string, P extends string, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I2 & I3>(method: M, path: P, ...handlers: [
|
|
62
62
|
H<E, MergePath<BasePath, P>, I, O>,
|
|
63
63
|
H<E, MergePath<BasePath, P>, I2, O>,
|
|
64
64
|
H<E, MergePath<BasePath, P>, I3, O>,
|
|
65
65
|
H<E, MergePath<BasePath, P>, I4, O>
|
|
66
|
-
]): Hono<E,
|
|
66
|
+
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I4['in'], O>, BasePath>;
|
|
67
67
|
<M extends string, P extends string, O = {}, I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I2 & I3, I5 extends Input = I3 & I4>(method: M, path: P, ...handlers: [
|
|
68
68
|
H<E, MergePath<BasePath, P>, I, O>,
|
|
69
69
|
H<E, MergePath<BasePath, P>, I2, O>,
|
|
70
70
|
H<E, MergePath<BasePath, P>, I3, O>,
|
|
71
71
|
H<E, MergePath<BasePath, P>, I4, O>,
|
|
72
72
|
H<E, MergePath<BasePath, P>, I5, O>
|
|
73
|
-
]): Hono<E, S
|
|
74
|
-
<M extends string, P extends string, O extends {} = {}, I extends Input = {}>(method: M, path: P, ...handlers: H<E, MergePath<BasePath, P>, I, O>[]): Hono<E,
|
|
75
|
-
<P extends string, O extends {} = {}, I extends Input = {}>(methods: string[], path: P, ...handlers: H<E, MergePath<BasePath, P>, I, O>[]): Hono<E,
|
|
73
|
+
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I5['in'], O>, BasePath>;
|
|
74
|
+
<M extends string, P extends string, O extends {} = {}, I extends Input = {}>(method: M, path: P, ...handlers: H<E, MergePath<BasePath, P>, I, O>[]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I['in'], O>, BasePath>;
|
|
75
|
+
<P extends string, O extends {} = {}, I extends Input = {}>(methods: string[], path: P, ...handlers: H<E, MergePath<BasePath, P>, I, O>[]): Hono<E, S & ToSchema<string, MergePath<BasePath, P>, I['in'], O>, BasePath>;
|
|
76
76
|
}
|
|
77
77
|
declare type ExtractKey<S> = S extends Record<infer Key, unknown> ? Key extends string ? Key : never : string;
|
|
78
|
-
export declare type
|
|
79
|
-
[K in P]:
|
|
80
|
-
[K2 in M]: {
|
|
78
|
+
export declare type ToSchema<M extends string, P extends string, I extends Input['in'], O> = {
|
|
79
|
+
[K in P]: {
|
|
80
|
+
[K2 in M as AddDollar<string & K2>]: {
|
|
81
81
|
input: unknown extends I ? AddParam<{}, P> : AddParam<I, P>;
|
|
82
82
|
output: unknown extends O ? {} : O;
|
|
83
83
|
};
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export declare type Schema = {
|
|
87
|
+
[Path: string]: {
|
|
88
|
+
[Method: `$${Lowercase<string>}`]: {
|
|
89
|
+
input: Partial<ValidationTargets> & {
|
|
90
|
+
param?: Record<string, string>;
|
|
91
|
+
};
|
|
92
|
+
output: {};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export declare type MergeSchemaPath<OrigSchema, SubPath extends string> = {
|
|
97
|
+
[K in keyof OrigSchema as `${SubPath}${K & string}`]: OrigSchema[K];
|
|
85
98
|
};
|
|
86
99
|
export declare type AddParam<I, P extends string> = ParamKeys<P> extends never ? I : I & {
|
|
87
100
|
param: UnionToIntersection<ParamKeyToRecord<ParamKeys<P>>>;
|
|
88
101
|
};
|
|
89
|
-
|
|
90
|
-
[MethodName in `$${Lowercase<K>}`]: R;
|
|
91
|
-
} : never : never;
|
|
92
|
-
export declare type MergeSchemaPath<S, P extends string> = S extends Record<infer Key, infer T> ? Key extends string ? Record<MergePath<P, Key>, T> : never : never;
|
|
102
|
+
declare type AddDollar<T extends string> = `$${Lowercase<T>}`;
|
|
93
103
|
export declare type MergePath<A extends string, B extends string> = A extends '' ? B : A extends '/' ? B : A extends `${infer P}/` ? B extends `/${infer Q}` ? `${P}/${Q}` : `${P}/${B}` : B extends `/${infer Q}` ? Q extends '' ? A : `${A}/${Q}` : `${A}/${B}`;
|
|
94
104
|
export declare type TypedResponse<T = unknown> = {
|
|
95
105
|
response: Response | Promise<Response>;
|