@amplience/dc-cli
Version:
Dynamic Content CLI Tool
26 lines (25 loc) • 899 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContentItemPublishingService = void 0;
const burstable_queue_1 = require("../burstable-queue/burstable-queue");
class ContentItemPublishingService {
constructor() {
this._publishJobs = [];
this.queue = new burstable_queue_1.BurstableQueue({});
}
async publish(contentItem, action) {
this.queue.add(async () => {
const publishJobLocation = await contentItem.related.publish();
const publishJob = await publishJobLocation.related.publishingJob();
this._publishJobs.push(publishJob);
action(contentItem, publishJob);
});
}
get publishJobs() {
return this._publishJobs;
}
async onIdle() {
return this.queue.onIdle();
}
}
exports.ContentItemPublishingService = ContentItemPublishingService;