///
import {
FastifyPluginCallback,
FastifyPluginAsync,
} from 'fastify'
/**
* This function does three things for you:
* 1. Add the `skip-override` hidden property
* 2. Check bare-minimum version of Fastify
* 3. Pass some custom metadata of the plugin to Fastify
* @param fn Fastify plugin function
* @param options Optional plugin options
*/
export default function fp(
fn: FastifyPluginCallback,
options?: PluginMetadata,
): FastifyPluginCallback;
export default function fp(
fn: FastifyPluginAsync,
options?: PluginMetadata,
): FastifyPluginAsync;
export default function fp(
fn: FastifyPluginCallback,
options?: string,
): FastifyPluginCallback;
export default function fp(
fn: FastifyPluginAsync,
options?: string,
): FastifyPluginAsync;
export interface PluginMetadata {
/** Bare-minimum version of Fastify for your plugin, just add the semver range that you need. */
fastify?: string,
name?: string,
/** Decorator dependencies for this plugin */
decorators?: {
fastify?: string[],
reply?: string[],
request?: string[]
},
/** The plugin dependencies */
dependencies?: string[]
}
// Exporting PluginOptions for backward compatibility after renaming it to PluginMetadata
export interface PluginOptions extends PluginMetadata {}
export type NextCallback = (err?: Error) => void;