"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
const posthog_node_1 = require("posthog-node");
const posthogPlugin = async (fastify, opts) => {
    const postHog = new posthog_node_1.PostHog(opts.apiKey, {
        host: "https://app.posthog.com",
    });
    fastify.decorate("postHog", postHog);
    fastify.addHook("onClose", () => {
        postHog.shutdown();
    });
};
exports.default = fastify_plugin_1.default(posthogPlugin);
//# sourceMappingURL=posthog.js.map