New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mos-connection

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mos-connection - npm Package Compare versions

Comparing version 0.9.1-nightly-featur-ncs-functions-20210409-062558-714a718.0 to 0.9.1-nightly-featur-ncs-functions-20210416-075213-811be5c.0

4

dist/api.d.ts

@@ -46,2 +46,6 @@ import { IProfiles } from './config/connectionConfig';

getConnectionStatus: () => IMOSConnectionStatus;
/** @deprecated getMachineInfo is deprecated, use requestMachineInfo instead */
getMachineInfo: () => Promise<IMOSListMachInfo>;
/** @deprecated onGetMachineInfo is deprecated, use onRequestMachineInfo instead */
onGetMachineInfo: (cb: () => Promise<IMOSListMachInfo>) => void;
}

@@ -48,0 +52,0 @@ /**

@@ -35,2 +35,3 @@ /// <reference types="node" />

private dataChunks;
private _disposed;
/** */

@@ -37,0 +38,0 @@ constructor(host: string, port: number, description: string, timeout?: number, debug?: boolean);

14

dist/connection/mosSocketClient.js

@@ -30,2 +30,3 @@ "use strict";

this.dataChunks = '';
this._disposed = false;
this._host = host;

@@ -100,2 +101,4 @@ this._port = port;

processQueue() {
if (this._disposed)
return;
// this.debugTrace('this.connected', this.connected)

@@ -173,2 +176,3 @@ if (!this._sentMessage && this.connected) {

dispose() {
this._disposed = true;
// this._readyToSendMessage = false

@@ -232,2 +236,4 @@ this.connected = false;

global.setTimeout(() => {
if (this._disposed)
return;
if (this._sentMessage && this._sentMessage.msg.messageID === sentMessageId) {

@@ -281,3 +287,3 @@ this.debugTrace('timeout ' + sentMessageId + ' after ' + this._commandTimeout);

_onConnected() {
this._client.emit(socketConnection_1.SocketConnectionEvent.ALIVE);
this.emit(socketConnection_1.SocketConnectionEvent.ALIVE);
// global.clearInterval(this._connectionAttemptTimer)

@@ -289,3 +295,3 @@ this._clearConnectionAttemptTimer();

_onData(data) {
this._client.emit(socketConnection_1.SocketConnectionEvent.ALIVE);
this.emit(socketConnection_1.SocketConnectionEvent.ALIVE);
// data = Buffer.from(data, 'ucs2').toString()

@@ -406,3 +412,3 @@ let messageString = iconv.decode(data, 'utf16-be').trim();

if (hadError) {
this.emit('warning', 'Scoket closed with error');
this.emit('warning', 'Socket closed with error');
this.debugTrace('Socket closed with error');

@@ -423,2 +429,4 @@ }

setTimeout(() => {
if (this._disposed)
return;
this.debugTrace('QueueCleanup');

@@ -425,0 +433,0 @@ for (let i = this._queueMessages.length - 1; i >= 0; i--) {

@@ -31,3 +31,3 @@ /// <reference types="node" />

private _clients;
private _callbackOnConnectionChange;
private _emittedConnected;
private _heartBeatsTimer;

@@ -42,3 +42,2 @@ private _heartBeatsDelay;

executeCommand(message: MosMessage): Promise<any>;
onConnectionChange(cb: () => void): void;
setDebug(debug: boolean): void;

@@ -45,0 +44,0 @@ get connected(): boolean;

@@ -14,2 +14,3 @@ "use strict";

this._clients = {};
this._emittedConnected = false;
this._id = id;

@@ -97,5 +98,2 @@ this._host = host;

}
onConnectionChange(cb) {
this._callbackOnConnectionChange = cb;
}
setDebug(debug) {

@@ -187,4 +185,3 @@ this._debug = debug;

this._connected = false;
if (this._callbackOnConnectionChange)
this._callbackOnConnectionChange();
this.emit('connectionChanged');
resolveDispose();

@@ -205,3 +202,2 @@ });

};
let connected = this.connected;
Promise.all(Object.keys(this._clients).map((key) => {

@@ -227,6 +223,11 @@ let client = this._clients[key];

}))
.catch((e) => {
triggerNextHeartBeat();
this.emit('error', e);
})
.then(() => {
if (connected !== this.connected) {
if (this._callbackOnConnectionChange)
this._callbackOnConnectionChange();
let connected = this.connected;
if (connected !== this._emittedConnected) {
this._emittedConnected = connected;
this.emit('connectionChanged');
}

@@ -236,7 +237,2 @@ triggerNextHeartBeat();

.catch((e) => {
if (connected !== this.connected) {
if (this._callbackOnConnectionChange)
this._callbackOnConnectionChange();
}
triggerNextHeartBeat();
this.emit('error', e);

@@ -243,0 +239,0 @@ });

@@ -13,2 +13,3 @@ export declare class MosTime {

getTime(): number;
setTime(timestamp: number): number;
/** */

@@ -15,0 +16,0 @@ private _parseTimeOffset;

@@ -72,2 +72,5 @@ "use strict";

}
setTime(timestamp) {
return this._time.setTime(timestamp);
}
/** */

@@ -74,0 +77,0 @@ _parseTimeOffset(timestamp) {

@@ -36,2 +36,3 @@ "use strict";

init() {
this.emit('info', `Initializing MOS-Connection, id: ${this._conf.mosID}`);
this._initialized = true;

@@ -38,0 +39,0 @@ if (this._conf.acceptsConnections) {

@@ -34,3 +34,3 @@ /// <reference types="node" />

private _currentConnection;
private _callbackOnGetMachineInfo?;
private _callbackOnRequestMachineInfo?;
private _callbackOnConnectionChange?;

@@ -58,11 +58,11 @@ private _callbackOnRequestMOSOBject?;

private _callbackOnROSwapItems?;
private _callbackOnMosItemReplace?;
private _callbackOnMosObjCreate?;
private _callbackOnItemReplace?;
private _callbackOnObjectCreate?;
private _callbackOnRequestObjectActionNew?;
private _callbackOnRequestObjectActionUpdate?;
private _callbackOnRequestObjectActionDelete?;
private _callbackOnMosReqObjList?;
private _callbackOnMosReqSearchableSchema?;
private _callbackOnROReqAll?;
private _callbackOnROStory?;
private _callbackOnRequestObjectList?;
private _callbackOnRequestSearchableSchema?;
private _callbackOnRequestAllRunningOrders?;
private _callbackOnRunningOrderStory?;
constructor(idPrimary: string, idSecondary: string | null, connectionConfig: IConnectionConfig, primaryConnection: NCSServerConnection | null, secondaryConnection: NCSServerConnection | null, offSpecFailover?: boolean, strict?: boolean);

@@ -90,2 +90,6 @@ /** True if MOS-device has connection to server (can send messages) */

getConnectionStatus(): IMOSConnectionStatus;
/** @deprecated getMachineInfo is deprecated, use requestMachineInfo instead */
getMachineInfo(): Promise<IMOSListMachInfo>;
/** @deprecated onGetMachineInfo is deprecated, use onRequestMachineInfo instead */
onGetMachineInfo(cb: () => Promise<IMOSListMachInfo>): void;
sendMOSObject(obj: IMOSObject): Promise<IMOSAck>;

@@ -92,0 +96,0 @@ onRequestMOSObject(cb: (objId: string) => Promise<IMOSObject | null>): void;

@@ -77,3 +77,3 @@ "use strict";

this._primaryConnection = primaryConnection;
this._primaryConnection.onConnectionChange(() => {
this._primaryConnection.on('connectionChanged', () => {
this._emitConnectionChange();

@@ -87,5 +87,5 @@ if (offSpecFailover && this._currentConnection !== this._primaryConnection && this._primaryConnection.connected) {

this._secondaryConnection = secondaryConnection;
this._secondaryConnection.onConnectionChange(() => this._emitConnectionChange());
this._secondaryConnection.on('connectionChanged', () => this._emitConnectionChange());
}
this._currentConnection = this._primaryConnection || this._primaryConnection || null;
this._currentConnection = this._primaryConnection || this._secondaryConnection || null;
if (this._strict) {

@@ -162,6 +162,6 @@ setTimeout(() => {

}
else if (data.reqMachInfo && typeof this._callbackOnGetMachineInfo === 'function') {
else if (data.reqMachInfo && typeof this._callbackOnRequestMachineInfo === 'function') {
if (port === 'query')
throw new Error('message "reqMachInfo" is invalid on query port');
const m = yield this._callbackOnGetMachineInfo();
const m = yield this._callbackOnRequestMachineInfo();
return new mosModel_1.ListMachineInfo(m, port);

@@ -417,8 +417,8 @@ // Profile 1:

}
else if (data.mosItemReplace && typeof this._callbackOnMosItemReplace === 'function') {
const resp = yield this._callbackOnMosItemReplace(data.mosItemReplace.ID, data.mosItemReplace.itemID, Parser_1.Parser.xml2Item(data.mosItemReplace.item));
else if (data.mosItemReplace && typeof this._callbackOnItemReplace === 'function') {
const resp = yield this._callbackOnItemReplace(data.mosItemReplace.ID, data.mosItemReplace.itemID, Parser_1.Parser.xml2Item(data.mosItemReplace.item));
return new mosModel_1.ROAck(resp);
}
else if (data.mosObjCreate && typeof this._callbackOnMosObjCreate === 'function') {
const resp = yield this._callbackOnMosObjCreate(Parser_1.Parser.xml2MosObj(data.mosObjCreate));
else if (data.mosObjCreate && typeof this._callbackOnObjectCreate === 'function') {
const resp = yield this._callbackOnObjectCreate(Parser_1.Parser.xml2MosObj(data.mosObjCreate));
const ack = new mosModel_1.MOSAck(resp);

@@ -445,13 +445,13 @@ return ack;

}
else if (data.mosReqObjList && typeof this._callbackOnMosReqObjList === 'function') {
const resp = yield this._callbackOnMosReqObjList(Parser_1.Parser.xml2ReqObjList(data.mosReqObjList));
else if (data.mosReqObjList && typeof this._callbackOnRequestObjectList === 'function') {
const resp = yield this._callbackOnRequestObjectList(Parser_1.Parser.xml2ReqObjList(data.mosReqObjList));
return new mosModel_1.MosObjList(resp);
}
else if (data.mosReqSearchableSchema && typeof this._callbackOnMosReqSearchableSchema === 'function') {
const resp = yield this._callbackOnMosReqSearchableSchema(data.mosReqSearchableSchema.username);
else if (data.mosReqSearchableSchema && typeof this._callbackOnRequestSearchableSchema === 'function') {
const resp = yield this._callbackOnRequestSearchableSchema(data.mosReqSearchableSchema.username);
return new mosModel_1.MosListSearchableSchema(resp);
// Profile 4
}
else if (data.roReqAll && typeof this._callbackOnROReqAll === 'function') {
const list = yield this._callbackOnROReqAll();
else if (data.roReqAll && typeof this._callbackOnRequestAllRunningOrders === 'function') {
const list = yield this._callbackOnRequestAllRunningOrders();
const roListAll = new ROListAll_1.ROListAll();

@@ -461,5 +461,5 @@ roListAll.ROs = list;

}
else if (data.roStorySend && typeof this._callbackOnROStory === 'function') {
else if (data.roStorySend && typeof this._callbackOnRunningOrderStory === 'function') {
const story = Parser_1.Parser.xml2FullStory(data.roStorySend);
const resp = yield this._callbackOnROStory(story);
const resp = yield this._callbackOnRunningOrderStory(story);
return new mosModel_1.ROAck(resp);

@@ -508,3 +508,3 @@ // TODO: Use MosMessage instead of string

onRequestMachineInfo(cb) {
this._callbackOnGetMachineInfo = cb;
this._callbackOnRequestMachineInfo = cb;
}

@@ -523,2 +523,11 @@ onConnectionChange(cb) {

}
// Deprecated methods:
/** @deprecated getMachineInfo is deprecated, use requestMachineInfo instead */
getMachineInfo() {
return this.requestMachineInfo();
}
/** @deprecated onGetMachineInfo is deprecated, use onRequestMachineInfo instead */
onGetMachineInfo(cb) {
return this.onRequestMachineInfo(cb);
}
// ============================================================================================================

@@ -839,3 +848,3 @@ // ========================== Profile 1 ===================================================================

onObjectCreate(cb) {
this._callbackOnMosObjCreate = cb;
this._callbackOnObjectCreate = cb;
}

@@ -850,3 +859,3 @@ sendObjectCreate(object) {

onItemReplace(cb) {
this._callbackOnMosItemReplace = cb;
this._callbackOnItemReplace = cb;
}

@@ -861,3 +870,3 @@ sendItemReplace(options) {

onRequestSearchableSchema(cb) {
this._callbackOnMosReqSearchableSchema = cb;
this._callbackOnRequestSearchableSchema = cb;
}

@@ -871,3 +880,3 @@ sendRequestSearchableSchema(username) {

onRequestObjectList(cb) {
this._callbackOnMosReqObjList = cb;
this._callbackOnRequestObjectList = cb;
}

@@ -960,3 +969,3 @@ sendRequestObjectList(reqObjList) {

onRequestAllRunningOrders(cb) {
this._callbackOnROReqAll = cb;
this._callbackOnRequestAllRunningOrders = cb;
}

@@ -989,3 +998,3 @@ sendRequestAllRunningOrders() {

onRunningOrderStory(cb) {
this._callbackOnROStory = cb;
this._callbackOnRunningOrderStory = cb;
}

@@ -1062,3 +1071,3 @@ sendRunningOrderStory(story) {

if (!otherConnection.connected)
throw new Error('Unable to failover connection: Other connection is not connected');
throw new Error(`Unable to failover connection: Other connection is not connected (${otherConnection.host})`);
// Switch:

@@ -1133,3 +1142,3 @@ this._currentConnection = otherConnection;

if (this.supportedProfiles.profile0) {
requireCallback('0', '_callbackOnGetMachineInfo', this.onRequestMachineInfo);
requireCallback('0', '_callbackOnRequestMachineInfo', this.onRequestMachineInfo);
// _callbackOnConnectionChange not required

@@ -1169,9 +1178,9 @@ }

requireProfile(3, 2);
requireMOSCallback('3', '_callbackOnMosItemReplace', this.onItemReplace);
requireMOSCallback('3', '_callbackOnMosObjCreate', this.onObjectCreate);
requireMOSCallback('3', '_callbackOnItemReplace', this.onItemReplace);
requireMOSCallback('3', '_callbackOnObjectCreate', this.onObjectCreate);
requireMOSCallback('3', '_callbackOnRequestObjectActionNew', this.onRequestObjectActionNew);
requireMOSCallback('3', '_callbackOnRequestObjectActionUpdate', this.onRequestObjectActionUpdate);
requireMOSCallback('3', '_callbackOnRequestObjectActionDelete', this.onRequestObjectActionDelete);
requireMOSCallback('3', '_callbackOnMosReqObjList', this.onRequestObjectList);
requireMOSCallback('3', '_callbackOnMosReqSearchableSchema', this.onRequestSearchableSchema);
requireMOSCallback('3', '_callbackOnRequestObjectList', this.onRequestObjectList);
requireMOSCallback('3', '_callbackOnRequestSearchableSchema', this.onRequestSearchableSchema);
}

@@ -1182,4 +1191,4 @@ if (this.supportedProfiles.profile4) {

requireProfile(4, 2);
requireMOSCallback('4', '_callbackOnROReqAll', this.onRequestAllRunningOrders);
requireMOSCallback('4', '_callbackOnROStory', this.onRunningOrderStory);
requireMOSCallback('4', '_callbackOnRequestAllRunningOrders', this.onRequestAllRunningOrders);
requireMOSCallback('4', '_callbackOnRunningOrderStory', this.onRunningOrderStory);
}

@@ -1186,0 +1195,0 @@ if (this.supportedProfiles.profile5) {

{
"name": "mos-connection",
"version": "0.9.1-nightly-featur-ncs-functions-20210409-062558-714a718.0",
"version": "0.9.1-nightly-featur-ncs-functions-20210416-075213-811be5c.0",
"description": "MOS compliant TCP/IP Socket connection.",

@@ -37,3 +37,3 @@ "main": "dist/index.js",

"lint": "tslint --project tsconfig.json --config tslint.json",
"unit": "jest --forceExit",
"unit": "jest --detectOpenHandles",
"test": "yarn lint && yarn unit",

@@ -47,4 +47,4 @@ "test:integration": "yarn lint && jest --config=jest-integration.config.js",

"docs:test": "yarn docs:html",
"docs:html": "typedoc src/index.ts --excludePrivate --mode file --theme minimal --out docs",
"docs:json": "typedoc --mode file --json docs/typedoc.json src/index.ts",
"docs:html": "typedoc src/index.ts --excludePrivate --theme minimal --out docs",
"docs:json": "typedoc --json docs/typedoc.json src/index.ts",
"docs:publish": "yarn docs:html && gh-pages -d docs",

@@ -91,16 +91,17 @@ "changelog": "standard-version",

"devDependencies": {
"@types/jest": "^25.2.3",
"@types/jest": "^26.0.22",
"@types/node": "^12.12.3",
"codecov": "^3.6.5",
"gh-pages": "^3.0.0",
"jest": "^24.9.0",
"codecov": "^3.8.1",
"gh-pages": "^3.1.0",
"jest": "^26.6.3",
"mockdate": "^3.0.5",
"node-license-validator": "^1.3.0",
"npm-scripts-info": "^0.3.9",
"open-cli": "^6.0.1",
"standard-version": "^8.0.0",
"trash-cli": "^3.0.0",
"ts-jest": "^24.0.2",
"tslint": "^6.1.2",
"standard-version": "^9.2.0",
"trash-cli": "^4.0.0",
"ts-jest": "^26.5.4",
"tslint": "^6.1.3",
"tslint-config-standard": "^9.0.0",
"typedoc": "^0.16.8",
"typedoc": "^0.20.35",
"typescript": "~4.1.5"

@@ -123,5 +124,5 @@ },

"dependencies": {
"iconv-lite": "^0.5.0",
"moment": "^2.26.0",
"tslib": "^1.13.0",
"iconv-lite": "^0.6.2",
"moment": "^2.29.1",
"tslib": "^2.2.0",
"xml-js": "^1.6.11",

@@ -128,0 +129,0 @@ "xmlbuilder": "^15.1.1"

@@ -34,3 +34,3 @@ # Sofie: The Modern TV News Studio Automation System (MOS Connection library)

// Setup callbacks to pipe data:
device.onGetMachineInfo(() => {})
device.onRequestMachineInfo(() => {})
device.onCreateRunningOrder((ro) => {})

@@ -37,0 +37,0 @@ device.onDeleteRunningOrder((RunningOrderID: MosString128) => {})

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc