mos-connection
Advanced tools
Comparing version 0.8.7 to 0.8.8
@@ -5,2 +5,11 @@ # Changelog | ||
### [0.8.8](https://github.com/nrkno/tv-automation-mos-connection/compare/0.8.7...0.8.8) (2020-01-24) | ||
### Bug Fixes | ||
* corrected <objMetadataPath> name (it had a space in it) ([9a8dbe0](https://github.com/nrkno/tv-automation-mos-connection/commit/9a8dbe068769f10ef72e3cb8af9d2d7e5b85d14b)) | ||
* update xmlBuilder and typescript dependency ([cb5e985](https://github.com/nrkno/tv-automation-mos-connection/commit/cb5e985c6d424c4d18a64d6dc0fe23874cf18ef1)) | ||
* wrap all xml.ele() into addTextElement() in order to make sure that what's added is a string (through .toString() ). ([e56a75e](https://github.com/nrkno/tv-automation-mos-connection/commit/e56a75ecbdb34adc42109f250f0592daf433e259)) | ||
### [0.8.7](https://github.com/nrkno/tv-automation-mos-connection/compare/0.8.6...0.8.7) (2020-01-19) | ||
@@ -7,0 +16,0 @@ |
@@ -157,3 +157,3 @@ import { IProfiles } from './config/connectionConfig'; | ||
ID: MosString128; | ||
Revision: Number; | ||
Revision: number; | ||
Status: IMOSAckStatus; | ||
@@ -160,0 +160,0 @@ Description: MosString128; |
@@ -39,4 +39,5 @@ /** Config object for creating a MOS-device */ | ||
/** */ | ||
get profiles(): IProfiles; | ||
/** */ | ||
profiles: IProfiles; | ||
set profiles(profileSupport: IProfiles); | ||
} |
@@ -38,7 +38,7 @@ /// <reference types="node" /> | ||
/** */ | ||
autoReconnect: boolean; | ||
set autoReconnect(autoReconnect: boolean); | ||
/** */ | ||
autoReconnectInterval: number; | ||
set autoReconnectInterval(autoReconnectInterval: number); | ||
/** */ | ||
autoReconnectAttempts: number; | ||
set autoReconnectAttempts(autoReconnectAttempts: number); | ||
/** */ | ||
@@ -52,5 +52,5 @@ connect(): void; | ||
/** */ | ||
readonly host: string; | ||
get host(): string; | ||
/** */ | ||
readonly port: number; | ||
get port(): number; | ||
/** */ | ||
@@ -64,4 +64,5 @@ dispose(): void; | ||
/** */ | ||
private set connected(value); | ||
/** */ | ||
private connected; | ||
private get connected(); | ||
private _sendReply; | ||
@@ -68,0 +69,0 @@ /** */ |
@@ -17,4 +17,4 @@ /// <reference types="node" /> | ||
setDebug(debug: boolean): void; | ||
readonly port: number; | ||
readonly portDescription: IncomingConnectionType; | ||
get port(): number; | ||
get portDescription(): IncomingConnectionType; | ||
/** */ | ||
@@ -21,0 +21,0 @@ private _onClientConnection; |
@@ -42,12 +42,12 @@ /// <reference types="node" /> | ||
setDebug(debug: boolean): void; | ||
readonly connected: boolean; | ||
get connected(): boolean; | ||
private _getClients; | ||
/** */ | ||
readonly lowerPortClients: MosSocketClient[]; | ||
get lowerPortClients(): MosSocketClient[]; | ||
/** */ | ||
readonly upperPortClients: MosSocketClient[]; | ||
get upperPortClients(): MosSocketClient[]; | ||
/** */ | ||
readonly queryPortClients: MosSocketClient[]; | ||
readonly host: string; | ||
readonly id: string; | ||
get queryPortClients(): MosSocketClient[]; | ||
get host(): string; | ||
get id(): string; | ||
handOverQueue(otherConnection: NCSServerConnection): void; | ||
@@ -54,0 +54,0 @@ receiveQueue(queue: { |
@@ -13,7 +13,7 @@ /// <reference types="node" /> | ||
/** */ | ||
readonly lowerPortSockets: Socket[]; | ||
get lowerPortSockets(): Socket[]; | ||
/** */ | ||
readonly upperPortSockets: Socket[]; | ||
get upperPortSockets(): Socket[]; | ||
/** */ | ||
readonly queryPortSockets: Socket[]; | ||
get queryPortSockets(): Socket[]; | ||
} |
@@ -17,6 +17,6 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
constructor(obj: IMOSExternalMetaData); | ||
readonly scope: IMOSScope | undefined; | ||
readonly schema: string; | ||
readonly payload: any; | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get scope(): IMOSScope | undefined; | ||
get schema(): string; | ||
get payload(): any; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const XMLBuilder = require("xmlbuilder"); | ||
const Utils_1 = require("..//utils/Utils"); | ||
var IMOSScope; | ||
@@ -27,5 +28,5 @@ (function (IMOSScope) { | ||
let root = XMLBuilder.create('mosExternalMetadata'); // config headless | ||
root.ele('mosScope', this._scope); | ||
root.ele('mosSchema', this._schema); | ||
root.ele('mosPayload', this._payload); // converts json to xml | ||
Utils_1.addTextElement(root, 'mosScope', this._scope); | ||
Utils_1.addTextElement(root, 'mosSchema', this._schema); | ||
Utils_1.addTextElement(root, 'mosPayload', this._payload); // converts json to xml | ||
return root; | ||
@@ -32,0 +33,0 @@ } |
@@ -8,8 +8,8 @@ export declare class MosString128 { | ||
/** */ | ||
string: string | { | ||
set string(str: string | { | ||
text: string; | ||
type: string; | ||
} | MosString128 | any; | ||
} | MosString128 | any); | ||
/** */ | ||
private _validate; | ||
} |
@@ -36,9 +36,9 @@ /// <reference types="node" /> | ||
/** True if mosConnection is listening for connections */ | ||
readonly isListening: boolean; | ||
get isListening(): boolean; | ||
/** TO BE IMPLEMENTED: True if mosConnection is mos-compliant */ | ||
readonly isCompliant: boolean; | ||
get isCompliant(): boolean; | ||
/** True if mosConnection is configured to accept connections */ | ||
readonly acceptsConnections: boolean; | ||
get acceptsConnections(): boolean; | ||
/** A list of the profiles mosConnection is currently configured to use */ | ||
readonly profiles: IProfiles; | ||
get profiles(): IProfiles; | ||
/** Close all connections and clear all data */ | ||
@@ -53,3 +53,3 @@ dispose(): Promise<void>; | ||
/** TO BE IMPLEMENTED */ | ||
readonly complianceText: string; | ||
get complianceText(): string; | ||
setDebug(debug: boolean): void; | ||
@@ -64,3 +64,3 @@ private _registerMosDevice; | ||
/** Get new unique id */ | ||
private static readonly nextSocketID; | ||
private static get nextSocketID(); | ||
} |
@@ -62,15 +62,15 @@ /// <reference types="node" /> | ||
/** True if MOS-device has connection to server (can send messages) */ | ||
readonly hasConnection: boolean; | ||
get hasConnection(): boolean; | ||
/** Primary ID (probably the NCS-ID) */ | ||
readonly idPrimary: string; | ||
get idPrimary(): string; | ||
/** Secondary ID (probably the MOS-ID) */ | ||
readonly idSecondary: string | null; | ||
get idSecondary(): string | null; | ||
/** Host name (IP-address) of the primary server */ | ||
readonly primaryHost: string | null; | ||
get primaryHost(): string | null; | ||
/** Name (ID) of the primary server */ | ||
readonly primaryId: string | null; | ||
get primaryId(): string | null; | ||
/** Host name (IP-address) of the secondary (buddy) server */ | ||
readonly secondaryHost: string | null; | ||
get secondaryHost(): string | null; | ||
/** Name (ID) of the secondary (buddy) server */ | ||
readonly secondaryId: string | null; | ||
get secondaryId(): string | null; | ||
connect(): void; | ||
@@ -77,0 +77,0 @@ dispose(): Promise<void>; |
@@ -13,7 +13,7 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageID: number; | ||
get messageID(): number; | ||
/** */ | ||
toString(): string; | ||
/** */ | ||
protected abstract readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
protected abstract get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const XMLBuilder = require("xmlbuilder"); | ||
const Utils_1 = require("../utils/Utils"); | ||
class MosMessage { | ||
@@ -30,5 +31,5 @@ static getNewMessageID() { | ||
}); | ||
xml.ele('ncsID', this.ncsID); | ||
xml.ele('mosID', this.mosID); | ||
xml.ele('messageID', this.messageID); | ||
Utils_1.addTextElement(xml, 'ncsID', this.ncsID); | ||
Utils_1.addTextElement(xml, 'mosID', this.mosID); | ||
Utils_1.addTextElement(xml, 'messageID', this.messageID); | ||
xml.importDocument(this.messageXMLBlocks); | ||
@@ -35,0 +36,0 @@ return xml.end({ pretty: true }); |
@@ -12,10 +12,10 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
function xml2Story(xml: any): IMOSROStory; | ||
function story2xml(story: IMOSROStory): XMLBuilder.XMLElementOrXMLNode; | ||
function story2xml(story: IMOSROStory): XMLBuilder.XMLElement; | ||
function xml2Items(xml: Array<any>): Array<IMOSItem>; | ||
function xml2Item(xml: any): IMOSItem; | ||
function xml2ObjPaths(xml: any): Array<IMOSObjectPath>; | ||
function objPaths2xml(paths: Array<IMOSObjectPath>): XMLBuilder.XMLElementOrXMLNode; | ||
function item2xml(item: IMOSItem): XMLBuilder.XMLElementOrXMLNode; | ||
function objPaths2xml(paths: Array<IMOSObjectPath>): XMLBuilder.XMLElement; | ||
function item2xml(item: IMOSItem): XMLBuilder.XMLElement; | ||
function xml2MetaData(xml: any): Array<IMOSExternalMetaData>; | ||
function metaData2xml(md: IMOSExternalMetaData): XMLBuilder.XMLElementOrXMLNode; | ||
function metaData2xml(md: IMOSExternalMetaData): XMLBuilder.XMLElement; | ||
function xml2IDs(xml: any): Array<MosString128>; | ||
@@ -26,6 +26,6 @@ function xml2ROAck(xml: any): ROAck; | ||
function xml2MosObj(xml: any): IMOSObject; | ||
function mosObj2xml(obj: IMOSObject): XMLBuilder.XMLElementOrXMLNode; | ||
function attachMosObj2xml(obj: IMOSObject, xml: XMLBuilder.XMLElementOrXMLNode): void; | ||
function mosObj2xml(obj: IMOSObject): XMLBuilder.XMLElement; | ||
function attachMosObj2xml(obj: IMOSObject, xml: XMLBuilder.XMLElement): void; | ||
function xml2Body(xml: any): Array<IMOSROFullStoryBodyItem>; | ||
function xml2ReqObjList(xml: any): IMosRequestObjectList; | ||
} |
@@ -9,2 +9,3 @@ "use strict"; | ||
const index_1 = require("./index"); | ||
const Utils_1 = require("../utils/Utils"); | ||
function isEmpty(obj) { | ||
@@ -62,3 +63,3 @@ if (typeof obj === 'object') { | ||
Parser.xml2RO = xml2RO; | ||
// export function ro2xml (ro: IMOSRunningOrder): XMLBuilder.XMLElementOrXMLNode { | ||
// export function ro2xml (ro: IMOSRunningOrder): XMLBuilder.XMLElement { | ||
// // too implement | ||
@@ -117,8 +118,8 @@ // return XMLBuilder.create('ro') | ||
let xmlStory = XMLBuilder.create('story'); | ||
xmlStory.ele('storyID', {}, story.ID); | ||
// if (story.Slug) xmlStory.ele('storySlug', {}, story.) | ||
Utils_1.addTextElement(xmlStory, 'storyID', {}, story.ID); | ||
// if (story.Slug) addTextElement(xmlStory, 'storySlug', {}, story.) | ||
if (story.Slug) | ||
xmlStory.ele('storySlug', {}, story.Slug.toString()); | ||
Utils_1.addTextElement(xmlStory, 'storySlug', {}, story.Slug); | ||
if (story.Number) | ||
xmlStory.ele('storyNum', {}, story.Number.toString()); | ||
Utils_1.addTextElement(xmlStory, 'storyNum', {}, story.Number); | ||
if (story.MosExternalMetaData) { | ||
@@ -263,3 +264,3 @@ story.MosExternalMetaData.forEach((md) => { | ||
if (path.Type === api_1.IMOSObjectPathType.PATH) { | ||
xmlObjPaths.ele('objPath', { | ||
Utils_1.addTextElement(xmlObjPaths, 'objPath', { | ||
techDescription: path.Description | ||
@@ -269,3 +270,3 @@ }, path.Target); | ||
else if (path.Type === api_1.IMOSObjectPathType.PROXY_PATH) { | ||
xmlObjPaths.ele('objProxyPath', { | ||
Utils_1.addTextElement(xmlObjPaths, 'objProxyPath', { | ||
techDescription: path.Description | ||
@@ -275,3 +276,3 @@ }, path.Target); | ||
else if (path.Type === api_1.IMOSObjectPathType.METADATA_PATH) { | ||
xmlObjPaths.ele('objMetadataPath ', { | ||
Utils_1.addTextElement(xmlObjPaths, 'objMetadataPath', { | ||
techDescription: path.Description | ||
@@ -286,9 +287,9 @@ }, path.Target); | ||
let xmlItem = XMLBuilder.create('item'); | ||
xmlItem.ele('itemID', {}, item.ID); | ||
Utils_1.addTextElement(xmlItem, 'itemID', {}, item.ID); | ||
if (item.Slug) | ||
xmlItem.ele('itemSlug', {}, item.Slug); | ||
xmlItem.ele('objID', {}, item.ObjectID); | ||
xmlItem.ele('mosID', {}, item.MOSID); | ||
Utils_1.addTextElement(xmlItem, 'itemSlug', {}, item.Slug); | ||
Utils_1.addTextElement(xmlItem, 'objID', {}, item.ObjectID); | ||
Utils_1.addTextElement(xmlItem, 'mosID', {}, item.MOSID); | ||
if (item.mosAbstract) | ||
xmlItem.ele('mosAbstract', {}, item.mosAbstract); | ||
Utils_1.addTextElement(xmlItem, 'mosAbstract', {}, item.mosAbstract); | ||
if (item.Paths) { | ||
@@ -303,17 +304,17 @@ let xmlObjPaths = objPaths2xml(item.Paths); | ||
if (item.Channel) | ||
xmlItem.ele('itemChannel', {}, item.Channel); | ||
Utils_1.addTextElement(xmlItem, 'itemChannel', {}, item.Channel); | ||
if (item.EditorialStart) | ||
xmlItem.ele('itemEdStart', {}, item.EditorialStart); | ||
Utils_1.addTextElement(xmlItem, 'itemEdStart', {}, item.EditorialStart); | ||
if (item.EditorialDuration) | ||
xmlItem.ele('itemEdDur', {}, item.EditorialDuration); | ||
Utils_1.addTextElement(xmlItem, 'itemEdDur', {}, item.EditorialDuration); | ||
if (item.UserTimingDuration) | ||
xmlItem.ele('itemUserTimingDur', {}, item.UserTimingDuration); | ||
Utils_1.addTextElement(xmlItem, 'itemUserTimingDur', {}, item.UserTimingDuration); | ||
if (item.Trigger) | ||
xmlItem.ele('itemTrigger', {}, item.Trigger); | ||
Utils_1.addTextElement(xmlItem, 'itemTrigger', {}, item.Trigger); | ||
if (item.MacroIn) | ||
xmlItem.ele('macroIn', {}, item.MacroIn); | ||
Utils_1.addTextElement(xmlItem, 'macroIn', {}, item.MacroIn); | ||
if (item.MacroOut) | ||
xmlItem.ele('macroOut', {}, item.MacroOut); | ||
Utils_1.addTextElement(xmlItem, 'macroOut', {}, item.MacroOut); | ||
if (item.MacroOut) | ||
xmlItem.ele('mosExternalMetadata', {}, item.MacroOut); | ||
Utils_1.addTextElement(xmlItem, 'mosExternalMetadata', {}, item.MacroOut); | ||
if (item.MosExternalMetaData) { | ||
@@ -385,8 +386,8 @@ item.MosExternalMetaData.forEach((md) => { | ||
// let xmlMD = XMLBuilder.create('mosExternalMetadata') | ||
// if (md.MosScope) xmlMD.ele('mosScope', {}, md.MosScope) | ||
// xmlMD.ele('mosSchema', {}, md.MosSchema) | ||
// if (md.MosScope) addTextElement(xmlMD, 'mosScope', {}, md.MosScope) | ||
// addTextElement(xmlMD, 'mosSchema', {}, md.MosSchema) | ||
// let payload = parser.toXml(md.MosPayload) // TODO: implement this properly, convert to xml | ||
// let payload = js2xml({ mosExternalMetadata: md }, { compact: true }) | ||
return XMLBuilder.create({ mosExternalMetadata: md }); | ||
// xmlMD.ele('mosPayload', {}, payload) | ||
// addTextElement(xmlMD, 'mosPayload', {}, payload) | ||
// return xmlMD | ||
@@ -512,14 +513,14 @@ } | ||
if (obj.ID) | ||
xml.ele('objID', {}, obj.ID); | ||
xml.ele('objSlug', {}, obj.Slug); | ||
Utils_1.addTextElement(xml, 'objID', {}, obj.ID); | ||
Utils_1.addTextElement(xml, 'objSlug', {}, obj.Slug); | ||
if (obj.MosAbstract) | ||
xml.ele('mosAbstract', {}, obj.MosAbstract); | ||
Utils_1.addTextElement(xml, 'mosAbstract', {}, obj.MosAbstract); | ||
if (obj.Group) | ||
xml.ele('objGroup', {}, obj.Group); | ||
xml.ele('objType', {}, obj.Type); | ||
xml.ele('objTB', {}, obj.TimeBase); | ||
xml.ele('objRev', {}, obj.Revision); | ||
xml.ele('objDur', {}, obj.Duration); | ||
xml.ele('status', {}, obj.Status); | ||
xml.ele('objAir', {}, obj.AirStatus); | ||
Utils_1.addTextElement(xml, 'objGroup', {}, obj.Group); | ||
Utils_1.addTextElement(xml, 'objType', {}, obj.Type); | ||
Utils_1.addTextElement(xml, 'objTB', {}, obj.TimeBase); | ||
Utils_1.addTextElement(xml, 'objRev', {}, obj.Revision); | ||
Utils_1.addTextElement(xml, 'objDur', {}, obj.Duration); | ||
Utils_1.addTextElement(xml, 'status', {}, obj.Status); | ||
Utils_1.addTextElement(xml, 'objAir', {}, obj.AirStatus); | ||
if (obj.Paths) { | ||
@@ -529,10 +530,10 @@ let xmlObjPaths = objPaths2xml(obj.Paths); | ||
} | ||
xml.ele('createdBy', {}, obj.CreatedBy); | ||
xml.ele('created', {}, obj.Created); | ||
Utils_1.addTextElement(xml, 'createdBy', {}, obj.CreatedBy); | ||
Utils_1.addTextElement(xml, 'created', {}, obj.Created); | ||
if (obj.ChangedBy) | ||
xml.ele('changedBy', {}, obj.ChangedBy); | ||
Utils_1.addTextElement(xml, 'changedBy', {}, obj.ChangedBy); | ||
if (obj.Changed) | ||
xml.ele('changed', {}, obj.Changed); | ||
Utils_1.addTextElement(xml, 'changed', {}, obj.Changed); | ||
if (obj.Description) | ||
xml.ele('description', {}, obj.Description); | ||
Utils_1.addTextElement(xml, 'description', {}, obj.Description); | ||
if (obj.MosExternalMetaData) { | ||
@@ -539,0 +540,0 @@ obj.MosExternalMetaData.forEach((md) => { |
@@ -9,3 +9,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -6,2 +6,3 @@ "use strict"; | ||
const MosMessage_1 = require("../MosMessage"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class HeartBeat extends MosMessage_1.MosMessage { | ||
@@ -15,4 +16,3 @@ /** */ | ||
get messageXMLBlocks() { | ||
let messageBlock = XMLBuilder.create('heartbeat') | ||
.element('time', {}, this.time.toString()); | ||
let messageBlock = Utils_1.addTextElement(XMLBuilder.create('heartbeat'), 'time', {}, this.time); | ||
return messageBlock; | ||
@@ -19,0 +19,0 @@ } |
@@ -49,3 +49,3 @@ import { MosTime } from '../../dataTypes/mosTime'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const XMLBuilder = require("xmlbuilder"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
var IMOSListMachInfoDefaultActiveXMode; | ||
@@ -22,16 +23,16 @@ (function (IMOSListMachInfoDefaultActiveXMode) { | ||
let root = XMLBuilder.create('listMachInfo'); | ||
root.ele('manufacturer', this.info.manufacturer.toString()); | ||
root.ele('model', this.info.model.toString()); | ||
root.ele('hwRev', this.info.hwRev.toString()); | ||
root.ele('swRev', this.info.swRev.toString()); | ||
root.ele('DOM', this.info.DOM.toString()); | ||
root.ele('SN', this.info.SN.toString()); | ||
root.ele('ID', this.info.ID.toString()); | ||
root.ele('time', this.info.time.toString()); | ||
Utils_1.addTextElement(root, 'manufacturer', this.info.manufacturer); | ||
Utils_1.addTextElement(root, 'model', this.info.model); | ||
Utils_1.addTextElement(root, 'hwRev', this.info.hwRev); | ||
Utils_1.addTextElement(root, 'swRev', this.info.swRev); | ||
Utils_1.addTextElement(root, 'DOM', this.info.DOM); | ||
Utils_1.addTextElement(root, 'SN', this.info.SN); | ||
Utils_1.addTextElement(root, 'ID', this.info.ID); | ||
Utils_1.addTextElement(root, 'time', this.info.time); | ||
if (this.info.opTime) | ||
root.ele('opTime', this.info.opTime.toString()); | ||
root.ele('mosRev', this.info.mosRev.toString()); | ||
let p = root.ele('supportedProfiles').att('deviceType', this.info.supportedProfiles.deviceType); | ||
Utils_1.addTextElement(root, 'opTime', this.info.opTime); | ||
Utils_1.addTextElement(root, 'mosRev', this.info.mosRev); | ||
let p = Utils_1.addTextElement(root, 'supportedProfiles').att('deviceType', this.info.supportedProfiles.deviceType); | ||
for (let i = 0; i < 8; i++) { | ||
p.ele('mosProfile', (this.info.supportedProfiles['profile' + i] ? 'YES' : 'NO')).att('number', i); | ||
Utils_1.addTextElement(p, 'mosProfile', (this.info.supportedProfiles['profile' + i] ? 'YES' : 'NO')).att('number', i); | ||
} | ||
@@ -38,0 +39,0 @@ return root; |
@@ -7,3 +7,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -7,3 +7,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
ID: MosString128; | ||
Revision: Number; | ||
Revision: number; | ||
Status: IMOSAckStatus; | ||
@@ -14,3 +14,3 @@ Description: MosString128; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -6,2 +6,3 @@ "use strict"; | ||
const api_1 = require("../../api"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class MOSAck extends MosMessage_1.MosMessage { | ||
@@ -15,6 +16,6 @@ /** */ | ||
let root = XMLBuilder.create('mosAck'); | ||
root.ele('objID', {}, this.ID.toString()); | ||
root.ele('objRev', {}, this.Revision); | ||
root.ele('status', {}, api_1.IMOSAckStatus[this.Status]); | ||
root.ele('statusDescription', {}, this.Description.toString()); | ||
Utils_1.addTextElement(root, 'objID', {}, this.ID); | ||
Utils_1.addTextElement(root, 'objRev', {}, this.Revision); | ||
Utils_1.addTextElement(root, 'status', {}, api_1.IMOSAckStatus[this.Status]); | ||
Utils_1.addTextElement(root, 'statusDescription', {}, this.Description); | ||
return root; | ||
@@ -21,0 +22,0 @@ } |
@@ -9,3 +9,3 @@ import { MosMessage } from '../MosMessage'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -9,3 +9,3 @@ import { MosMessage } from '../MosMessage'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -9,3 +9,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const MosMessage_1 = require("../MosMessage"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class ReqMosObj extends MosMessage_1.MosMessage { | ||
@@ -16,3 +17,3 @@ /** */ | ||
let root = XMLBuilder.create('mosReqObj'); | ||
root.ele('objID', {}, this.objId.toString()); | ||
Utils_1.addTextElement(root, 'objID', {}, this.objId); | ||
return root; | ||
@@ -19,0 +20,0 @@ } |
@@ -8,3 +8,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const MosMessage_1 = require("../MosMessage"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class ReqMosObjAll extends MosMessage_1.MosMessage { | ||
@@ -16,3 +17,3 @@ /** */ | ||
let root = XMLBuilder.create('mosReqAll'); | ||
root.ele('pause', {}, this.pause + ''); | ||
Utils_1.addTextElement(root, 'pause', {}, this.pause + ''); | ||
return root; | ||
@@ -19,0 +20,0 @@ } |
@@ -12,3 +12,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const MosMessage_1 = require("../MosMessage"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class ROAck extends MosMessage_1.MosMessage { | ||
@@ -14,4 +15,4 @@ /** */ | ||
let root = XMLBuilder.create('roAck'); | ||
root.ele('roID', {}, this.ID.toString()); | ||
root.ele('roStatus', {}, this.Status.toString()); | ||
Utils_1.addTextElement(root, 'roID', {}, this.ID); | ||
Utils_1.addTextElement(root, 'roStatus', {}, this.Status); | ||
// TODO: Loop over Stories, Items and Object | ||
@@ -18,0 +19,0 @@ return root; |
@@ -25,3 +25,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -6,2 +6,3 @@ "use strict"; | ||
const mosTime_1 = require("../../dataTypes/mosTime"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
var ROElementStatType; | ||
@@ -25,13 +26,13 @@ (function (ROElementStatType) { | ||
root.attribute('element', this.options.type.toString()); | ||
root.ele('roID', {}, this.options.roId.toString()); | ||
Utils_1.addTextElement(root, 'roID', {}, this.options.roId); | ||
if (this.options.storyId) | ||
root.ele('storyID', {}, this.options.storyId.toString()); | ||
Utils_1.addTextElement(root, 'storyID', {}, this.options.storyId); | ||
if (this.options.itemId) | ||
root.ele('itemID', {}, this.options.itemId.toString()); | ||
Utils_1.addTextElement(root, 'itemID', {}, this.options.itemId); | ||
if (this.options.objId) | ||
root.ele('objID', {}, this.options.objId.toString()); | ||
Utils_1.addTextElement(root, 'objID', {}, this.options.objId); | ||
if (this.options.itemChannel) | ||
root.ele('itemChannel', {}, this.options.itemChannel.toString()); | ||
root.ele('status', {}, this.options.status.toString()); | ||
root.ele('time', {}, this.time.toString()); | ||
Utils_1.addTextElement(root, 'itemChannel', {}, this.options.itemChannel); | ||
Utils_1.addTextElement(root, 'status', {}, this.options.status); | ||
Utils_1.addTextElement(root, 'time', {}, this.time); | ||
return root; | ||
@@ -38,0 +39,0 @@ } |
@@ -9,3 +9,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -6,2 +6,3 @@ "use strict"; | ||
const Parser_1 = require("../Parser"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class ROList extends MosMessage_1.MosMessage { | ||
@@ -15,4 +16,4 @@ /** */ | ||
let root = XMLBuilder.create('roList'); | ||
root.ele('roID', {}, this.RO.ID); | ||
root.ele('roSlug', {}, this.RO.Slug); | ||
Utils_1.addTextElement(root, 'roID', {}, this.RO.ID); | ||
Utils_1.addTextElement(root, 'roSlug', {}, this.RO.Slug); | ||
this.RO.Stories.forEach((story) => { | ||
@@ -19,0 +20,0 @@ let xmlStory = Parser_1.Parser.story2xml(story); |
@@ -9,3 +9,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const MosMessage_1 = require("../MosMessage"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class ROReq extends MosMessage_1.MosMessage { | ||
@@ -16,3 +17,3 @@ /** */ | ||
let root = XMLBuilder.create('roReq'); | ||
root.ele('roID', {}, this.roId.toString()); | ||
Utils_1.addTextElement(root, 'roID', {}, this.roId); | ||
return root; | ||
@@ -19,0 +20,0 @@ } |
@@ -13,3 +13,3 @@ import { IMOSItem } from '../../api'; | ||
constructor(options: MosItemReplaceOptions); | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -6,2 +6,3 @@ "use strict"; | ||
const Parser_1 = require("../Parser"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class MosItemReplace extends MosMessage_1.MosMessage { | ||
@@ -16,4 +17,4 @@ constructor(options) { | ||
const root = XMLBuilder.create('mosItemReplace'); | ||
root.ele('roID', {}, this.options.roID); | ||
root.ele('storyID', {}, this.options.storyID); | ||
Utils_1.addTextElement(root, 'roID', {}, this.options.roID); | ||
Utils_1.addTextElement(root, 'storyID', {}, this.options.storyID); | ||
root.importDocument(Parser_1.Parser.item2xml(item)); | ||
@@ -20,0 +21,0 @@ return root; |
@@ -7,3 +7,3 @@ import { MosMessage } from '../MosMessage'; | ||
constructor(options: IMOSSearchableSchema); | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const XMLBuilder = require("xmlbuilder"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class MosListSearchableSchema extends MosMessage_1.MosMessage { | ||
@@ -15,3 +16,3 @@ constructor(options) { | ||
xml.att('username', this.options.username); | ||
xml.ele('mosSchema', {}, this.options.mosSchema); | ||
Utils_1.addTextElement(xml, 'mosSchema', {}, this.options.mosSchema); | ||
return xml; | ||
@@ -18,0 +19,0 @@ } |
@@ -7,3 +7,3 @@ import { IMOSObject } from '../../api'; | ||
constructor(object: IMOSObject); | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -7,3 +7,3 @@ import { IMosObjectList } from '../../api'; | ||
constructor(options: IMosObjectList); | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -6,2 +6,3 @@ "use strict"; | ||
const Parser_1 = require("../Parser"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class MosObjList extends MosMessage_1.MosMessage { | ||
@@ -16,10 +17,10 @@ constructor(options) { | ||
xml.att('username', this.options.username); | ||
xml.ele('queryID', {}, this.options.queryID); | ||
xml.ele('listReturnStart', {}, this.options.listReturnStart); | ||
xml.ele('listReturnEnd', {}, this.options.listReturnEnd); | ||
xml.ele('listReturnTotal', {}, this.options.listReturnTotal); | ||
Utils_1.addTextElement(xml, 'queryID', {}, this.options.queryID); | ||
Utils_1.addTextElement(xml, 'listReturnStart', {}, this.options.listReturnStart); | ||
Utils_1.addTextElement(xml, 'listReturnEnd', {}, this.options.listReturnEnd); | ||
Utils_1.addTextElement(xml, 'listReturnTotal', {}, this.options.listReturnTotal); | ||
if (this.options.listReturnStatus) | ||
xml.ele('listReturnStatus', {}, this.options.listReturnStatus); | ||
Utils_1.addTextElement(xml, 'listReturnStatus', {}, this.options.listReturnStatus); | ||
if (this.options.list) { | ||
const listEl = xml.ele('list'); | ||
const listEl = Utils_1.addTextElement(xml, 'list'); | ||
for (const object of this.options.list) { | ||
@@ -26,0 +27,0 @@ listEl.importDocument(Parser_1.Parser.mosObj2xml(object)); |
@@ -11,3 +11,3 @@ import { IMOSObject } from '../../api'; | ||
constructor(options: MosReqObjActionOptions); | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -7,3 +7,3 @@ import { IMosRequestObjectList } from '../../api'; | ||
constructor(options: IMosRequestObjectList); | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const XMLBuilder = require("xmlbuilder"); | ||
const Utils_1 = require("../../utils/Utils"); | ||
class MosReqObjList extends MosMessage_1.MosMessage { | ||
@@ -15,12 +16,12 @@ constructor(options) { | ||
xml.att('username', this.options.username); | ||
xml.ele('username', {}, this.options.username); | ||
xml.ele('queryID', {}, this.options.queryID); | ||
xml.ele('listReturnStart', {}, this.options.listReturnStart); | ||
xml.ele('listReturnEnd', {}, this.options.listReturnEnd); | ||
xml.ele('generalSearch', {}, this.options.generalSearch); | ||
xml.ele('mosSchema', {}, this.options.mosSchema); | ||
Utils_1.addTextElement(xml, 'username', {}, this.options.username); | ||
Utils_1.addTextElement(xml, 'queryID', {}, this.options.queryID); | ||
Utils_1.addTextElement(xml, 'listReturnStart', {}, this.options.listReturnStart); | ||
Utils_1.addTextElement(xml, 'listReturnEnd', {}, this.options.listReturnEnd); | ||
Utils_1.addTextElement(xml, 'generalSearch', {}, this.options.generalSearch); | ||
Utils_1.addTextElement(xml, 'mosSchema', {}, this.options.mosSchema); | ||
for (const searchGroup of this.options.searchGroups) { | ||
const groupEle = xml.ele('searchGroup'); | ||
const groupEle = Utils_1.addTextElement(xml, 'searchGroup'); | ||
for (const searchField of searchGroup.searchFields) { | ||
groupEle.ele('searchField', searchField); | ||
Utils_1.addTextElement(groupEle, 'searchField', searchField); | ||
} | ||
@@ -27,0 +28,0 @@ } |
@@ -8,3 +8,3 @@ import { MosMessage } from '../MosMessage'; | ||
}); | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -7,3 +7,3 @@ import * as XMLBuilder from 'xmlbuilder'; | ||
/** */ | ||
readonly messageXMLBlocks: XMLBuilder.XMLElementOrXMLNode; | ||
get messageXMLBlocks(): XMLBuilder.XMLElement; | ||
} |
@@ -0,3 +1,7 @@ | ||
import * as XMLBuilder from 'xmlbuilder'; | ||
import { MosString128 } from '../dataTypes/mosString128'; | ||
import { MosTime } from '../dataTypes/mosTime'; | ||
/** */ | ||
export declare function pad(n: string, width: number, z?: string): string; | ||
export declare function xml2js(messageString: string): object; | ||
export declare function addTextElement(root: XMLBuilder.XMLElement, elementName: string, attributes?: Object, text?: string | number | null | MosString128 | MosTime): XMLBuilder.XMLElement; |
@@ -167,2 +167,11 @@ "use strict"; | ||
exports.xml2js = xml2js; | ||
function addTextElement(root, elementName, attributes, text) { | ||
root.element(elementName, attributes, text === null ? | ||
null : | ||
text !== undefined ? | ||
text.toString() : | ||
undefined); | ||
return root; | ||
} | ||
exports.addTextElement = addTextElement; | ||
//# sourceMappingURL=Utils.js.map |
{ | ||
"name": "mos-connection", | ||
"version": "0.8.7", | ||
"version": "0.8.8", | ||
"description": "MOS compliant TCP/IP Socket connection.", | ||
@@ -90,3 +90,2 @@ "main": "dist/index.js", | ||
"@types/node": "^12.12.3", | ||
"@types/xmlbuilder": "^0.0.34", | ||
"codecov": "^3.6.1", | ||
@@ -105,4 +104,4 @@ "gh-pages": "^2.0.1", | ||
"tslint-config-standard": "^8.0.1", | ||
"typedoc": "^0.15.0", | ||
"typescript": "^3.3.3" | ||
"typedoc": "^0.16.8", | ||
"typescript": "^3.5.x" | ||
}, | ||
@@ -128,3 +127,3 @@ "keywords": [ | ||
"xml-js": "^1.6.11", | ||
"xmlbuilder": "^10.1.1" | ||
"xmlbuilder": "^13.0.2" | ||
}, | ||
@@ -131,0 +130,0 @@ "standard-version": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
378869
17
5144
+ Addedxmlbuilder@13.0.2(transitive)
- Removedxmlbuilder@10.1.1(transitive)
Updatedxmlbuilder@^13.0.2