firestore-queue
Version:
A powerful, scalable queue system built on Google Firestore with time-based indexing, auto-configuration, and connection reuse
43 lines • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createQueue = createQueue;
exports.createQueueFromConfig = createQueueFromConfig;
exports.createQuickQueue = createQuickQueue;
const FireQueue_1 = require("../core/FireQueue");
/**
* Factory function to create a FireQueue instance with validation
*/
function createQueue(config) {
return new FireQueue_1.FireQueue(config);
}
/**
* Create a FireQueue from a configuration file
*/
function createQueueFromConfig(configPath) {
const config = require(configPath);
return createQueue(config);
}
/**
* Quick setup factory for common use cases
*/
function createQuickQueue(projectId, options = {}) {
const config = {
projectId,
databaseId: 'firequeue',
queueCollection: options.queueName || 'fire_queue',
consumerCollection: `${options.queueName || 'fire_queue'}_consumers`,
serviceAccountPath: options.serviceAccountPath,
defaultTtlSeconds: (options.ttlHours || 24) * 3600,
defaultBatchSize: options.batchSize || 50,
defaultPollIntervalMs: 5000,
enableAutoCleanup: true,
cleanupIntervalMs: 300000,
retainCompletedSeconds: 86400,
enableTimeBasedSharding: false,
shardIntervalHours: 24,
autoCreateIndexes: true,
consumers: {},
};
return createQueue(config);
}
//# sourceMappingURL=factory.js.map