1 |
|
2 |
|
3 | import {
|
4 | FastifyPluginCallback,
|
5 | FastifyPluginAsync,
|
6 | } from 'fastify'
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export default function fp<Options>(
|
17 | fn: FastifyPluginCallback<Options>,
|
18 | options?: PluginMetadata,
|
19 | ): FastifyPluginCallback<Options>;
|
20 | export default function fp<Options>(
|
21 | fn: FastifyPluginAsync<Options>,
|
22 | options?: PluginMetadata,
|
23 | ): FastifyPluginAsync<Options>;
|
24 |
|
25 | export default function fp<Options>(
|
26 | fn: FastifyPluginCallback<Options>,
|
27 | options?: string,
|
28 | ): FastifyPluginCallback<Options>;
|
29 | export default function fp<Options>(
|
30 | fn: FastifyPluginAsync<Options>,
|
31 | options?: string,
|
32 | ): FastifyPluginAsync<Options>;
|
33 |
|
34 | export interface PluginMetadata {
|
35 |
|
36 | fastify?: string,
|
37 | name?: string,
|
38 |
|
39 | decorators?: {
|
40 | fastify?: string[],
|
41 | reply?: string[],
|
42 | request?: string[]
|
43 | },
|
44 |
|
45 | dependencies?: string[]
|
46 | }
|
47 |
|
48 |
|
49 | export interface PluginOptions extends PluginMetadata {}
|
50 |
|
51 | export type NextCallback = (err?: Error) => void;
|