import { QuirrelClient, } from "./client";
import { registerDevelopmentDefaults } from "./client/config";
registerDevelopmentDefaults({
    applicationPort: 3000,
});
export function Queue(route, handler, options) {
    const quirrel = new QuirrelClient({
        options,
        handler,
        route,
    });
    async function nextApiHandler(req, res) {
        const response = await quirrel.respondTo(req.body, req.headers);
        res.status(response.status);
        for (const [header, value] of Object.entries(response.headers)) {
            res.setHeader(header, value);
        }
        res.send(response.body);
    }
    nextApiHandler.enqueue = (payload, options) => quirrel.enqueue(payload, options);
    nextApiHandler.enqueueMany = (jobs) => quirrel.enqueueMany(jobs);
    nextApiHandler.delete = (jobId) => quirrel.delete(jobId);
    nextApiHandler.invoke = (jobId) => quirrel.invoke(jobId);
    nextApiHandler.get = () => quirrel.get();
    nextApiHandler.getById = (jobId) => quirrel.getById(jobId);
    return nextApiHandler;
}
export function CronJob(route, cronSchedule, handler, options) {
    return Queue(route, handler, options);
}
//# sourceMappingURL=next.js.map