-
Notifications
You must be signed in to change notification settings - Fork 24
/
index.d.ts
72 lines (60 loc) · 1.61 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { IncomingMessage, ServerResponse } from 'http'
export type RequestIdFactory = (req?: IncomingMessage | any) => unknown
export interface IOptions {
// Default: false
echoHeader?: boolean
// Default: false
useHeader?: boolean
// Default: 'X-Request-Id'
headerName?: string
// Default: UUID v1
requestIdFactory?: RequestIdFactory
}
export interface IFastifyOptions {
// Default: false
echoHeader?: boolean
// Default: false
useHeader?: boolean
// Default: 'X-Request-Id'
headerName?: string
// Default: false
useFastifyRequestId?: boolean
// Default: UUID v1
requestIdFactory?: RequestIdFactory
}
export interface IHapiPlugin<T> {
name: string
once: boolean
register: (server: any, options: T) => void | Promise<void>
}
export declare const expressMiddleware: (
options?: IOptions,
) => (
req: IncomingMessage,
res: ServerResponse,
next: (err?: any) => void,
) => void
export declare const fastifyPlugin: (
fastify: any,
options: IFastifyOptions,
done: (err?: any) => void,
) => void
export declare const fastifyMiddleware: (
options?: IOptions,
) => (
req: IncomingMessage,
res: ServerResponse,
next: (err?: any) => void,
) => void
export declare const koaMiddleware: (
options?: IOptions,
) => (
ctx: { request: IncomingMessage; response: ServerResponse },
next: () => Promise<void>,
) => Promise<void>
export declare const koaV1Middleware: (
options?: IOptions,
) => GeneratorFunction
export declare const hapiPlugin: IHapiPlugin<IOptions>
export declare function runWithId<T>(fn: () => T, id?: unknown): T
export declare const id: () => unknown | undefined