"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomHealthSpec = void 0;
class CustomHealthSpec {
    async run({ ctx, input }) {
        if (!ctx.api) {
            throw new Error("Missing API adapter on context for CustomHealthSpec");
        }
        const url = input?.url;
        if (!url) {
            throw new Error('Missing "url" in input for CustomHealthSpec');
        }
        const response = await ctx.api.http({ method: "GET", url });
        return {
            ok: response.status === 200,
            name: "Custom API health spec",
            details: { status: response.status },
            attachments: [
                {
                    name: "health-response",
                    contentType: "application/json",
                    data: JSON.stringify(response, null, 2),
                    encoding: "utf8",
                },
            ],
        };
    }
}
exports.CustomHealthSpec = CustomHealthSpec;
//# sourceMappingURL=custom-health.spec.js.map