@lexamica-modules/job-queue
Version:
The package for the Lexamica Job Queue SDK powered by Redis and BullMQ
33 lines (32 loc) • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IntegrationAPI = void 0;
const config_1 = require("../util/config");
const common_1 = require("./common");
const types_1 = require("../types");
// ingest the global config and come up with a list of queue names to create
const INITS = Object.entries(config_1.QUEUES_INIT).reduce((prev, [name, config]) => {
if (config.integrationAPI.init) {
return [...prev, name];
}
else {
return prev;
}
}, []);
/**
* This is the instance for most integation APIs. This instance has access to almost all queues so that the Lexamica API can assign, manage, and process jobs.
*/
class IntegrationAPI extends common_1.CommonQueueManagement {
/**
* Creates an instance of the Integration API message queue manager
* @param {string} integration_platform should be the lowercase id of the integration api. Example: litify, filevine, etc.
* @param {string[]} initQueues a optional list of arrays to populate instead of the defaults. Do not specify this unless you know what you are doing.
* @param {string} connection_url an optional remote Redis connection URL to use. If not provided, this instance will use a local Redis instance.
*/
constructor(integration_platform, initQueues, connection_url) {
// add a sync queue for each integration
const queues = [...(initQueues ?? INITS), `sync_${integration_platform}`];
super(queues, types_1.Consumers.INTEGRATION_API, connection_url);
}
}
exports.IntegrationAPI = IntegrationAPI;