Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bsdm

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bsdm - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

compileFiles.txt

77

dist/bsDmActions.js

@@ -6,11 +6,19 @@ 'use strict';

});
exports.baAddZone = exports.baNewSign = exports.ADD_ZONE = exports.NEW_SIGN = undefined;
exports.baAddTransition = exports.baAddEvent = exports.baAddMediaState = exports.baAddZone = exports.baNewSign = exports.ADD_TRANSITION = exports.ADD_EVENT = exports.UPDATE_ZONE = exports.ADD_MEDIA_STATE = exports.ADD_ZONE = exports.NEW_SIGN = undefined;
exports.baUpdateZone = baUpdateZone;
var _utils = require('./utilities/utils');
var _reducerMediaState = require('./reducers/reducerMediaState');
// Actions
var NEW_SIGN = exports.NEW_SIGN = 'NEW_SIGN'; /**
* Created by tedshaffer on 10/5/16.
*/
/**
* Created by tedshaffer on 10/5/16.
*/
var NEW_SIGN = exports.NEW_SIGN = 'NEW_SIGN';
var ADD_ZONE = exports.ADD_ZONE = 'ADD_ZONE';
var ADD_MEDIA_STATE = exports.ADD_MEDIA_STATE = 'ADD_MEDIA_STATE';
var UPDATE_ZONE = exports.UPDATE_ZONE = 'UPDATE_ZONE';
var ADD_EVENT = exports.ADD_EVENT = 'ADD_EVENT';
var ADD_TRANSITION = exports.ADD_TRANSITION = 'ADD_TRANSITION';

@@ -40,1 +48,62 @@ var baNewSign = exports.baNewSign = function baNewSign(name, mode) {

};
function baUpdateZone(id, params) {
return function (dispatch, getState, ex) {
// If the update parameters include an update initialMediaStateId, make sure that the ID
// actually refers to a media state in the given zone. If not, do not proceed with the update.
// TODO: if update fails, return an error (probably best achieved by returning a Promise.)
var doUpdate = true;
if (params.initialMediaStateId) {
var mediaStates = (0, _reducerMediaState.getMediaStatesForZone)(getState(), { id: id });
doUpdate = mediaStates.indexOf(params.initialMediaStateId) >= 0;
}
if (doUpdate) {
dispatch({ type: UPDATE_ZONE, id: id, payload: params });
} else {
console.log("ERROR!! - invalid initial media state");
}
};
}
var baAddMediaState = exports.baAddMediaState = function baAddMediaState(name, container, contentItemState) {
var volume = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
return {
type: ADD_MEDIA_STATE,
id: (0, _utils.guid)(),
payload: {
name: name,
container: container,
contentItemState: contentItemState,
volume: volume
}
};
};
var baAddEvent = exports.baAddEvent = function baAddEvent(name, type, mediaState, data) {
return {
type: ADD_EVENT,
id: (0, _utils.guid)(),
payload: {
name: name,
type: type,
mediaStateId: mediaState,
data: data
}
};
};
var baAddTransition = exports.baAddTransition = function baAddTransition(name, eventId, targetMediaStateId) {
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "No_effect";
var conditionId = arguments[4];
return {
type: ADD_TRANSITION,
id: (0, _utils.guid)(),
payload: {
name: name,
eventId: eventId,
targetMediaStateId: targetMediaStateId,
type: type,
conditionId: conditionId
}
};
};

27

dist/bsDmClasses.js

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

});
exports.Zone = exports.MediaContentItem = exports.MediaObject = exports.ContentItem = undefined;
exports.MediaState = exports.Zone = exports.MediaContentItem = exports.MediaObject = exports.ContentItem = undefined;

@@ -76,10 +76,2 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

key: "containerObject",
// id: BaDmId;
// name: string;
// type: ZoneType;
// nonInteractive: boolean;
// initialMediaStateId: BaDmId;
get: function get() {

@@ -102,1 +94,18 @@ return { id: this.id, type: "Zone" };

}();
var MediaState =
// id: BaDmId;
// name: string;
// container: DmMediaStateContainer;
// contentItem: DmContentItemState;
exports.MediaState = function MediaState(state) {
_classCallCheck(this, MediaState);
this.id = state.id;
this.name = state.name;
this.container = Object.assign({}, state.container);
// this.contentItem = contentItemFactory(state.contentItemState);
this.contentItem = new ContentItem(state.contentItemState.name, state.contentItemState.type, state.contentItemState.id);
};
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});

@@ -17,7 +17,17 @@

var _reducerMediaState = require('./reducerMediaState');
var _reducerMediaState2 = _interopRequireDefault(_reducerMediaState);
var _reducerTransition = require('./reducerTransition');
var _reducerTransition2 = _interopRequireDefault(_reducerTransition);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var bsdmReducer = (0, _redux.combineReducers)({
sign: _reducerSign2.default,
zones: _reducerZone2.default
sign: _reducerSign2.default,
zones: _reducerZone2.default,
mediaStates: _reducerMediaState2.default,
transitions: _reducerTransition2.default
}); /**

@@ -24,0 +34,0 @@ * Created by tedshaffer on 10/5/16.

@@ -42,6 +42,4 @@ 'use strict';

console.log("zonesById invoked, type=", type);
switch (type) {
case _bsDmActions.ADD_ZONE:
console.log("add_zone");
var zoneName = payload.name;

@@ -52,2 +50,5 @@ var zoneType = payload.type;

return Object.assign({}, state, _defineProperty({}, id, createZoneState(id, zoneName, zoneType, nonInteractive)));
case _bsDmActions.UPDATE_ZONE:
var updatedZone = Object.assign({}, state[id], payload);
return Object.assign({}, state, _defineProperty({}, id, updatedZone));
}

@@ -54,0 +55,0 @@ return state;

{
"name": "bsdm",
"version": "0.0.3",
"version": "0.0.4",
"description": "BrightSign Data Model",

@@ -12,3 +12,4 @@ "scripts": {

"redux": "^3.6.0",
"redux-thunk": "^2.1.0"
"redux-thunk": "^2.1.0",
"reselect": "^2.5.4"
},

@@ -15,0 +16,0 @@ "devDependencies": {

@@ -6,5 +6,11 @@ /**

import { getMediaStatesForZone } from './reducers/reducerMediaState';
// Actions
export const NEW_SIGN = 'NEW_SIGN';
export const ADD_ZONE = 'ADD_ZONE';
export const ADD_MEDIA_STATE = 'ADD_MEDIA_STATE';
export const UPDATE_ZONE = 'UPDATE_ZONE';
export const ADD_EVENT = 'ADD_EVENT';
export const ADD_TRANSITION = 'ADD_TRANSITION';

@@ -32,1 +38,60 @@

export function baUpdateZone(id, params) {
return (dispatch, getState, ex) =>
{
// If the update parameters include an update initialMediaStateId, make sure that the ID
// actually refers to a media state in the given zone. If not, do not proceed with the update.
// TODO: if update fails, return an error (probably best achieved by returning a Promise.)
let doUpdate = true;
if (params.initialMediaStateId) {
let mediaStates = getMediaStatesForZone(getState(), {id: id});
doUpdate = mediaStates.indexOf(params.initialMediaStateId) >= 0;
}
if (doUpdate) {
dispatch({type: UPDATE_ZONE, id: id, payload: params});
} else {
console.log("ERROR!! - invalid initial media state");
}
};
}
export const baAddMediaState = (
name,
container,
contentItemState,
volume = 0) => ({
type: ADD_MEDIA_STATE,
id: guid(),
payload: {
name: name,
container: container,
contentItemState: contentItemState,
volume: volume
}
});
export const baAddEvent = (name, type, mediaState, data) => ({
type: ADD_EVENT,
id: guid(),
payload: {
name: name,
type: type,
mediaStateId: mediaState,
data: data
}
});
export const baAddTransition = (
name, eventId, targetMediaStateId,
type = "No_effect", conditionId) => ({
type: ADD_TRANSITION,
id: guid(),
payload: {
name: name,
eventId: eventId,
targetMediaStateId: targetMediaStateId,
type: type,
conditionId: conditionId
}
});

@@ -45,8 +45,2 @@ /**

// id: BaDmId;
// name: string;
// type: ZoneType;
// nonInteractive: boolean;
// initialMediaStateId: BaDmId;
get containerObject() {

@@ -65,1 +59,18 @@ return {id: this.id, type: "Zone"};

export class MediaState {
// id: BaDmId;
// name: string;
// container: DmMediaStateContainer;
// contentItem: DmContentItemState;
constructor(state) {
this.id = state.id;
this.name = state.name;
this.container = Object.assign({}, state.container);
// this.contentItem = contentItemFactory(state.contentItemState);
this.contentItem = new ContentItem(state.contentItemState.name, state.contentItemState.type, state.contentItemState.id);
}
}

@@ -7,8 +7,12 @@ /**

import zoneReducer from './reducerZone';
import mediaStateReducer from './reducerMediaState';
import transitionReducer from './reducerTransition';
const bsdmReducer = combineReducers({
sign: signReducer,
zones: zoneReducer
zones: zoneReducer,
mediaStates: mediaStateReducer,
transitions: transitionReducer
});
export default bsdmReducer;

@@ -6,3 +6,3 @@ /**

import { ADD_ZONE } from '../bsDmActions';
import { ADD_ZONE, UPDATE_ZONE } from '../bsDmActions';
import { Zone } from '../bsDmClasses';

@@ -28,8 +28,9 @@

console.log("zonesById invoked, type=", type);
switch (type) {
case ADD_ZONE :
console.log("add_zone");
let {name: zoneName, type: zoneType, nonInteractive} = payload;
return Object.assign({}, state, {[id]: createZoneState(id, zoneName, zoneType, nonInteractive)});
case UPDATE_ZONE :
let updatedZone = Object.assign({}, state[id], payload);
return Object.assign({}, state, {[id]: updatedZone});
}

@@ -36,0 +37,0 @@ return state;

@@ -9,4 +9,5 @@ /**

import { baNewSign, baAddZone } from './src/bsDmActions';
import { baNewSign, baAddZone, baUpdateZone, baAddMediaState, baAddEvent, baAddTransition } from './src/bsDmActions';
import { getZoneById } from './src/reducers/reducerZone';
import { getMediaStateById, getMediaStatesForZone } from './src/reducers/reducerMediaState';

@@ -23,2 +24,5 @@ let store = createStore(bsdmReducer, applyMiddleware(thunk));

const mediaObject2 = {path: '/testFiles/image2.jpg', mediaType: "image"};
const contentItem2 = { id: "", name: "ItemName2", type: "media", media: mediaObject2 };
store.dispatch(baNewSign('TestSign', "v1920x1080x60p"));

@@ -40,1 +44,63 @@

let zone1Container = zone1.containerObject;
let msAction = store.dispatch(baAddMediaState('State1', zone1Container, contentItem1));
state = store.getState();
console.log("state after adding media state1:");
console.log(state);
let mediaState1Id = msAction.id;
let mediaState1 = getMediaStateById(state, {id: mediaState1Id});
console.log("mediaState1:");
console.log(mediaState1);
state = store.getState();
zone1 = getZoneById(state, {id: zone1Id});
let zone1States = getMediaStatesForZone(state, {id: zone1Id});
console.log("zone1States:");
console.log(zone1States);
store.dispatch(baUpdateZone(zone1Id,{name:"Zone1x"}));
state = store.getState();
console.log("state after adding updating zone:");
console.log(state);
zone1 = getZoneById(store.getState(), {id: zone1Id});
console.log("zone1:");
console.log(zone1);
msAction = store.dispatch(baAddMediaState('State2', zone1Container, contentItem2));
state = store.getState();
console.log("state after adding media state2:");
console.log(state);
let mediaState2Id = msAction.id;
let mediaState2 = getMediaStateById(state, {id: mediaState2Id});
console.log("mediaState2");
console.log(mediaState2);
zone1States = getMediaStatesForZone(state, {id: zone1Id});
console.log("zone1States after adding mediaState2:");
console.log(zone1States);
// Make State 2 the initial state
store.dispatch(baUpdateZone(zone1Id,{initialMediaStateId:mediaState2.id}));
zone1 = getZoneById(store.getState(), {id: zone1Id});
console.log("zone1:");
console.log(zone1);
// Event added to State 2 (now the initial event)
let evAction = store.dispatch(baAddEvent('Timeout1',"Timer",mediaState2.id,{interval: 5}));
let eventId = evAction.id;
// Transition to State 1
store.dispatch(baAddTransition('Transition1',eventId,mediaState1.id));
state = store.getState();
console.log("state after adding transition:");
console.log(state);

Sorry, the diff of this file is too big to display

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