import fp from "fastify-plugin";
export function fastifyDecoratorPlugin(identifier, make) {
    const plugin = (fastify, _opts, done) => {
        const object = make(fastify);
        fastify.decorate(identifier, object);
        fastify.addHook("onClose", async () => {
            await object.close();
        });
        done();
    };
    return fp(plugin);
}
//# sourceMappingURL=fastify-decorator-plugin.js.map