"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
const { processEvent } = require("./utils");
const { queue, shutdown } = require("./bullboard");
const { TRIGGER_DEFINITIONS } = require("./triggers");
const { ACTION_DEFINITIONS } = require("./actions");
/**
 * This module is built purely to kick off the worker farm and manage the inputs/outputs
 */
exports.init = function () {
    // this promise will not complete
    return queue.process((job) => __awaiter(this, void 0, void 0, function* () {
        yield processEvent(job);
    }));
};
exports.getQueues = () => {
    return [queue];
};
exports.shutdown = () => {
    return shutdown();
};
exports.queue = queue;
exports.TRIGGER_DEFINITIONS = TRIGGER_DEFINITIONS;
exports.ACTION_DEFINITIONS = ACTION_DEFINITIONS;
