@mos-connection/helper
Version:
Helper functions for the MOS-connection library
72 lines • 4.39 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ROStory = void 0;
const XMLBuilder = require("xmlbuilder");
const MosMessage_1 = require("../MosMessage");
const xmlConversion_1 = require("../profile2/xmlConversion");
const xmlConversion_2 = require("../profile1/xmlConversion");
const Utils_1 = require("../../utils/Utils");
class ROStory extends MosMessage_1.MosMessage {
/** */
constructor(fullStory, strict) {
super('upper', strict);
this.fullStory = fullStory;
}
/** */
get messageXMLBlocks() {
const xmlStory = XMLBuilder.create('roStorySend');
xmlConversion_1.XMLROStoryBase.toXML(xmlStory, this.fullStory, this.strict);
(0, Utils_1.addTextElementInternal)(xmlStory, 'roID', this.fullStory.RunningOrderId, undefined, this.strict);
const xmlStoryBody = (0, Utils_1.addTextElementInternal)(xmlStory, 'storyBody', undefined, undefined, this.strict);
this.fullStory.Body.forEach((bodyItem) => {
if (bodyItem.itemType === 'storyItem') {
const xmlItem = (0, Utils_1.addTextElementInternal)(xmlStoryBody, 'storyItem', undefined, undefined, this.strict);
const item = bodyItem.Content;
(0, Utils_1.addTextElementInternal)(xmlItem, 'itemID', item.ID, undefined, this.strict);
(0, Utils_1.addTextElementInternal)(xmlItem, 'objID', item.ObjectID, undefined, this.strict);
(0, Utils_1.addTextElementInternal)(xmlItem, 'mosID', item.MOSID, undefined, this.strict);
// TODO: mosAbstract?: string?
// TODO: Channel?: MosString128?
// TODO: MacroIn?: MosString128?
// TODO: MacroOut?: MosString128?
xmlConversion_2.XMLObjectPaths.toXML(xmlItem, item.Paths, this.strict);
if (item.MosExternalMetaData)
xmlConversion_2.XMLMosExternalMetaData.toXML(xmlItem, item.MosExternalMetaData);
if (item.Slug)
(0, Utils_1.addTextElementInternal)(xmlItem, 'itemSlug', item.Slug, undefined, this.strict);
if (item.EditorialStart)
(0, Utils_1.addTextElementInternal)(xmlItem, 'itemEdStart', item.EditorialStart, undefined, this.strict);
if (item.EditorialDuration)
(0, Utils_1.addTextElementInternal)(xmlItem, 'itemEdDur', item.EditorialDuration, undefined, this.strict);
if (item.UserTimingDuration)
(0, Utils_1.addTextElementInternal)(xmlItem, 'itemUserTimingDur', item.UserTimingDuration, undefined, this.strict);
if (item.Trigger)
(0, Utils_1.addTextElementInternal)(xmlItem, 'itemTrigger', item.Trigger, undefined, this.strict);
if (item.mosAbstract)
(0, Utils_1.addTextElementInternal)(xmlItem, 'mosAbstract', item.mosAbstract, undefined, this.strict);
if (item.ObjectSlug)
(0, Utils_1.addTextElementInternal)(xmlItem, 'objSlug', item.ObjectSlug, undefined, this.strict);
if (item.Channel)
(0, Utils_1.addTextElementInternal)(xmlItem, 'itemChannel', item.Channel, undefined, this.strict);
if (item.Duration)
(0, Utils_1.addTextElementInternal)(xmlItem, 'objDur', item.Duration, undefined, this.strict);
if (item.TimeBase)
(0, Utils_1.addTextElementInternal)(xmlItem, 'objTB', item.TimeBase, undefined, this.strict);
if (item.MacroIn)
(0, Utils_1.addTextElementInternal)(xmlItem, 'macroIn', item.MacroIn, undefined, this.strict);
if (item.MacroOut)
(0, Utils_1.addTextElementInternal)(xmlItem, 'macroOut', item.MacroOut, undefined, this.strict);
// Note: the <mosObj> is sent in roStorySend
if (item.MosObjects)
xmlConversion_2.XMLMosObjects.toXML(xmlItem, item.MosObjects, this.strict);
}
else {
// TODO: what is this?
(0, Utils_1.addTextElementInternal)(xmlStoryBody, bodyItem.Type, bodyItem.Content, undefined, this.strict);
}
});
return xmlStory;
}
}
exports.ROStory = ROStory;
//# sourceMappingURL=roStory.js.map