import fetch from "cross-fetch";
export class IncidentForwarder {
    constructor(incidentEndpoint, passphrase) {
        this.incidentEndpoint = incidentEndpoint;
        this.passphrase = passphrase;
    }
    async dispatch(job, incident) {
        try {
            fetch(this.incidentEndpoint, {
                method: "POST",
                body: JSON.stringify({
                    type: "incident",
                    job,
                    incident,
                }),
                headers: {
                    "Content-Type": "application/json",
                    Authorization: `Bearer ${this.passphrase}`,
                },
            });
        }
        catch (error) {
            console.error("Incident receiver is down: ", error);
        }
    }
}
//# sourceMappingURL=incident-forwarder.js.map