Stefan Huber

chore: changed build environment

This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
export * from './player';
export * from './program-manager';
export * from './program-item/program-item';
export * from './program-item/program-item-factory';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./player"));
__export(require("./program-manager"));
__export(require("./program-item/program-item"));
__export(require("./program-item/program-item-factory"));
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,8BAAyB;AACzB,uCAAkC;AAClC,iDAA4C;AAC5C,yDAAoD"}
\ No newline at end of file
/// <reference types="node" />
import { EventEmitter } from 'events';
import { ProgramRepository } from './program-repository';
import { ProgramManager } from './program-manager';
export declare class Player extends EventEmitter {
constructor();
protected _programRepository: ProgramRepository;
protected _programManager: ProgramManager;
protected _minutesReplication: number;
protected _replicationRetry: number;
protected _currentProgramItemId: string;
protected _currentReplicationCounter: number;
protected _state: string;
state: string;
programManager: ProgramManager;
programRepository: ProgramRepository;
minutesReplication: number;
replicationRetry: number;
triggerReplication(): Promise<void>;
triggerProgramItemId(changes?: boolean): void;
trigger(func: Function, milliseconds?: number): void;
start(): void;
stop(): void;
}
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var events_1 = require("events");
var util_1 = require("./util");
var STATE_START = "start";
var STATE_STOP = "stop";
var Player = (function (_super) {
__extends(Player, _super);
function Player() {
var _this = _super.call(this) || this;
_this._minutesReplication = 3;
_this._replicationRetry = 10000;
_this._currentProgramItemId = '';
_this._currentReplicationCounter = 0;
_this._state = STATE_STOP;
return _this;
}
Object.defineProperty(Player.prototype, "state", {
set: function (st) {
this._state = st;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Player.prototype, "programManager", {
get: function () {
return this._programManager;
},
set: function (pm) {
this._programManager = pm;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Player.prototype, "programRepository", {
get: function () {
return this._programRepository;
},
set: function (pr) {
this._programRepository = pr;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Player.prototype, "minutesReplication", {
get: function () {
return this._minutesReplication;
},
set: function (mr) {
this._minutesReplication = mr;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Player.prototype, "replicationRetry", {
get: function () {
return this._replicationRetry;
},
set: function (rr) {
this._replicationRetry = rr;
},
enumerable: true,
configurable: true
});
Player.prototype.triggerReplication = function () {
var _this = this;
console.info("digsig-player-service: trigger replication");
return this.programRepository.replicate()
.then(function (changes) {
_this._currentReplicationCounter = 0;
_this.trigger(function () { _this.triggerProgramItemId(changes); });
})
.catch(function (error) {
_this.trigger(function () { _this.triggerReplication(); }, _this.replicationRetry);
_this.emit('error', error);
});
};
Player.prototype.triggerProgramItemId = function (changes) {
var _this = this;
if (changes === void 0) { changes = false; }
console.info("digsig-player-service: trigger program item id");
this.programManager.getCurrentProgramItemId()
.then(function (programItemId) {
_this._currentReplicationCounter++;
// if there is a new program item id trigger play
// else (1) calculate next potential program change point
// or (2) trigger replication
if (programItemId && (programItemId != _this._currentProgramItemId || changes)) {
_this._currentProgramItemId = programItemId;
_this.emit('play', programItemId);
}
if (_this._currentReplicationCounter >= _this._minutesReplication) {
_this.triggerReplication();
}
else {
_this.trigger(function () { _this.triggerProgramItemId(); }, util_1.Util.calculateNextMinute());
}
});
};
Player.prototype.trigger = function (func, milliseconds) {
if (milliseconds === void 0) { milliseconds = 0; }
if (this._state === STATE_START) {
setTimeout(function () { func(); }, milliseconds);
}
};
Player.prototype.start = function () {
if (this._state === STATE_STOP) {
this.triggerReplication();
this._state = STATE_START;
}
};
Player.prototype.stop = function () {
this._state = STATE_STOP;
};
return Player;
}(events_1.EventEmitter));
exports.Player = Player;
//# sourceMappingURL=player.js.map
\ No newline at end of file
{"version":3,"file":"player.js","sourceRoot":"","sources":["../src/player.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAsC;AAGtC,+BAA4B;AAE5B,IAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,IAAM,UAAU,GAAI,MAAM,CAAC;AAE3B;IAA4B,0BAAY;IAEpC;QAAA,YACI,iBAAO,SACV;QAIS,yBAAmB,GAAU,CAAC,CAAC;QAC/B,uBAAiB,GAAU,KAAK,CAAC;QAEjC,2BAAqB,GAAU,EAAE,CAAC;QAClC,gCAA0B,GAAU,CAAC,CAAC;QACtC,YAAM,GAAG,UAAU,CAAC;;IAT9B,CAAC;IAWD,sBAAI,yBAAK;aAAT,UAAU,EAAS;YACf,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACrB,CAAC;;;OAAA;IAED,sBAAI,kCAAc;aAIlB;YACI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;QAChC,CAAC;aAND,UAAmB,EAAiB;YAChC,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC9B,CAAC;;;OAAA;IAMD,sBAAI,qCAAiB;aAIrB;YACI,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACnC,CAAC;aAND,UAAsB,EAAoB;YACtC,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QACjC,CAAC;;;OAAA;IAMD,sBAAI,sCAAkB;aAItB;YACI,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC;QACpC,CAAC;aAND,UAAuB,EAAS;YAC5B,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAClC,CAAC;;;OAAA;IAMD,sBAAI,oCAAgB;aAIpB;YACI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAClC,CAAC;aAND,UAA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AI,CAAC,mBAAmB,CAAC,CAAC,CAAC;gBAC9D,KAAI,CAAC,kBAAkB,EAAE,CAAC;YAC9B,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,KAAI,CAAC,OAAO,CAAC,cAAQ,KAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,WAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;YACrF,CAAC;QACL,CAAC,CAAC,CAAC;IACX,CAAC;IAED,wBAAO,GAAP,UAAQ,IAAa,EAAE,YAAuB;QAAvB,6BAAA,EAAA,gBAAuB;QAC1C,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC;YAC9B,UAAU,CAAC,cAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QAChD,CAAC;IACL,CAAC;IAED,sBAAK,GAAL;QACI,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;QAC9B,CAAC;IACL,CAAC;IAED,qBAAI,GAAJ;QACI,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;IAC7B,CAAC;IAEL,aAAC;AAAD,CAAC,AA1GD,CAA4B,qBAAY,GA0GvC;AA1GY,wBAAM"}
\ No newline at end of file
import { ProgramItem } from './program-item';
import { ProgramRepository } from './../program-repository';
export declare class ProgramItemFactory {
protected _programRepository: ProgramRepository;
protected _basePath: string;
basePath: string;
programRepository: ProgramRepository;
getProgramItem(programItemId: string): Promise<ProgramItem>;
prepareProgramItem(type: string, data: any): Promise<ProgramItem>;
prepareSlideshowItem(programItem: ProgramItem, data: any): Promise<ProgramItem>;
prepareVideoItem(programItem: ProgramItem, data: any): Promise<ProgramItem>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var program_item_1 = require("./program-item");
var ProgramItemFactory = (function () {
function ProgramItemFactory() {
}
Object.defineProperty(ProgramItemFactory.prototype, "basePath", {
get: function () {
return this._basePath;
},
set: function (bp) {
this._basePath = bp;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ProgramItemFactory.prototype, "programRepository", {
get: function () {
return this._programRepository;
},
set: function (pr) {
this._programRepository = pr;
},
enumerable: true,
configurable: true
});
ProgramItemFactory.prototype.getProgramItem = function (programItemId) {
var _this = this;
return this.programRepository
.findById(programItemId)
.then(function (programItem) {
return _this.prepareProgramItem(programItem.program_item_type, programItem);
});
};
ProgramItemFactory.prototype.prepareProgramItem = function (type, data) {
var programItem = new program_item_1.ProgramItem();
programItem.type = type;
if (data.infoboxes) {
programItem.data.infoboxes = data.infoboxes;
}
if (type === program_item_1.PROGRAM_ITEM_TYPE_VIDEO) {
return this.prepareVideoItem(programItem, data);
}
else if (type === program_item_1.PROGRAM_ITEM_TYPE_SLIDESHOW) {
return this.prepareSlideshowItem(programItem, data);
}
else {
return null;
}
};
ProgramItemFactory.prototype.prepareSlideshowItem = function (programItem, data) {
var _this = this;
return this._programRepository.findByIds(data.images)
.then(function (images) {
programItem.data.speed = data.settings.speed;
programItem.data.effect = data.settings.effect;
programItem.data.images = [];
if (images && images.length > 0) {
for (var _i = 0, images_1 = images; _i < images_1.length; _i++) {
var image = images_1[_i];
if (image && image.filename) {
programItem.data.images.push(_this.basePath + image.filename);
}
}
}
return programItem;
});
};
ProgramItemFactory.prototype.prepareVideoItem = function (programItem, data) {
var _this = this;
return this._programRepository.findById(data.video)
.then(function (data) {
programItem.data.video = _this.basePath + data['filename'];
return programItem;
});
};
return ProgramItemFactory;
}());
exports.ProgramItemFactory = ProgramItemFactory;
//# sourceMappingURL=program-item-factory.js.map
\ No newline at end of file
{"version":3,"file":"program-item-factory.js","sourceRoot":"","sources":["../../src/program-item/program-item-factory.ts"],"names":[],"mappings":";;AAAA,+CAAkG;AAGlG;IAAA;IAyEA,CAAC;IApEG,sBAAI,wCAAQ;aAI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EC;AAzEY,gDAAkB"}
\ No newline at end of file
export declare const PROGRAM_ITEM_TYPE_SLIDESHOW = "slideshow";
export declare const PROGRAM_ITEM_TYPE_VIDEO = "video";
export declare class ProgramItem {
protected _type: string;
protected _data: any;
type: string;
data: any;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PROGRAM_ITEM_TYPE_SLIDESHOW = "slideshow";
exports.PROGRAM_ITEM_TYPE_VIDEO = "video";
var ProgramItem = (function () {
function ProgramItem() {
this._type = "";
this._data = {};
}
Object.defineProperty(ProgramItem.prototype, "type", {
get: function () {
return this._type;
},
set: function (t) {
this._type = t;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ProgramItem.prototype, "data", {
get: function () {
return this._data;
},
set: function (d) {
this._data = d;
},
enumerable: true,
configurable: true
});
return ProgramItem;
}());
exports.ProgramItem = ProgramItem;
//# sourceMappingURL=program-item.js.map
\ No newline at end of file
{"version":3,"file":"program-item.js","sourceRoot":"","sources":["../../src/program-item/program-item.ts"],"names":[],"mappings":";;AAAa,QAAA,2BAA2B,GAAG,WAAW,CAAC;AAC1C,QAAA,uBAAuB,GAAG,OAAO,CAAC;AAE/C;IAAA;QAEc,UAAK,GAAU,EAAE,CAAC;QAClB,UAAK,GAAO,EAAE,CAAC;IAkB7B,CAAC;IAhBG,sBAAI,6BAAI;aAIR;YACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;aAND,UAAS,CAAQ;YACb,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACnB,CAAC;;;OAAA;IAMD,sBAAI,6BAAI;aAIR;YACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;aAND,UAAS,CAAK;YACV,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACnB,CAAC;;;OAAA;IAML,kBAAC;AAAD,CAAC,AArBD,IAqBC;AArBY,kCAAW"}
\ No newline at end of file
import { ProgramRepository } from './program-repository';
export declare class ProgramManager {
protected _programRepository: ProgramRepository;
programRepository: ProgramRepository;
getCurrentProgramItemId(): Promise<string>;
/**
* find program item in schedule, which fits
* according to current hh:mm
*/
findCurrentProgramItem(schedule: any, dateInMinutes: number): string;
/**
* Find the program segment
* This is dependent on the date set on the device
*/
findCurrentProgramSegment(): Promise<any>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
var ProgramManager = (function () {
function ProgramManager() {
}
Object.defineProperty(ProgramManager.prototype, "programRepository", {
get: function () {
return this._programRepository;
},
set: function (pr) {
this._programRepository = pr;
},
enumerable: true,
configurable: true
});
ProgramManager.prototype.getCurrentProgramItemId = function () {
var _this = this;
return new Promise(function (resolve, reject) {
_this.findCurrentProgramSegment().then(function (programSegment) {
var currentProgramItemId = programSegment.default;
if (programSegment.schedule) {
currentProgramItemId = _this.findCurrentProgramItem(programSegment.schedule, util_1.Util.getDateInMinutes());
}
resolve(currentProgramItemId);
});
});
};
/**
* find program item in schedule, which fits
* according to current hh:mm
*/
ProgramManager.prototype.findCurrentProgramItem = function (schedule, dateInMinutes) {
var timeList = [];
var tmpSchedule = {};
dateInMinutes--; // make it not so strict, which will start one minute earlier
for (var startTime in schedule) {
if (schedule.hasOwnProperty(startTime)) {
var minutes = util_1.Util.convertToMinutes(startTime);
timeList.push(minutes);
tmpSchedule[minutes] = schedule[startTime];
}
}
// sort ascending (-)
timeList.sort(function (a, b) { return a - b; });
var last = 0;
for (var i = 0; i < timeList.length; i++) {
if (timeList[i] <= dateInMinutes) {
last = timeList[i];
}
else {
break;
}
}
return tmpSchedule[last];
};
/**
* Find the program segment
* This is dependent on the date set on the device
*/
ProgramManager.prototype.findCurrentProgramSegment = function () {
var _this = this;
return new Promise(function (resolve, reject) {
var today = util_1.Util.getISODate();
_this.programRepository.findByType('program')
.then(function (programs) {
if (programs.length > 0) {
var program = programs[0];
var programSegmentId = void 0;
// if there is a program_segment for today else default
if (program.schedule && program.schedule[today]) {
programSegmentId = program.schedule[today];
}
else {
programSegmentId = program.default;
}
_this.programRepository
.findById(programSegmentId)
.then(function (programSegment) {
resolve(programSegment);
}).catch(function (error) {
reject("program segment not found");
});
}
else {
reject('No Program found');
}
}).catch(function (error) {
reject(error);
});
});
};
return ProgramManager;
}());
exports.ProgramManager = ProgramManager;
//# sourceMappingURL=program-manager.js.map
\ No newline at end of file
{"version":3,"file":"program-manager.js","sourceRoot":"","sources":["../src/program-manager.ts"],"names":[],"mappings":";;AACA,+BAA4B;AAG5B;IAAA;IA+FA,CAAC;IA3FG,sBAAI,6CAAiB;aAIrB;YACI,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACnC,CAAC;aAND,UAAsB,EAAoB;YACtC,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QACjC,CAAC;;;OAAA;IAMD,gDAAuB,GAAvB;QAAA,iBAUC;QATG,MAAM,CAAC,IAAI,OAAO,CAAU,UAAC,OAAO,EAAE,MAAM;YACxC,KAAI,CAAC,yBAAyB,EAAE,CAAC,IAAI,CAAC,UAAA,cAAc;gBAChD,IAAI,oBAAoB,GAAG,cAAc,CAAC,OAAO,CAAC;gBAClD,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC1B,oBAAoB,GAAG,KAAI,CAAC,sBAAsB,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;gBACzG,CAAC;gBACD,OAAO,CAAC,oBAAoB,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,+CAAsB,GAAtB,UAAuB,QAAY,EAAE,aAAoB;QACrD,IAAI,QAAQ,GAAO,EAAE,CAAC;QACtB,IAAI,WAAW,GAAO,EAAE,CAAC;QACzB,aAAa,EAAE,CAAC,CAAC,6DAA6D;QAE9E,GAAG,CAAC,CAAC,IAAI,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC;YAC7B,EAAE,CAAC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AAgB,SAAA,CAAC;oBAErB,uDAAuD;oBACvD,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;wBAC9C,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAC/C,CAAC;oBAAC,IAAI,CAAC,CAAC;wBACJ,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;oBACvC,CAAC;oBAED,KAAI,CAAC,iBAAiB;yBACjB,QAAQ,CAAC,gBAAgB,CAAC;yBAC1B,IAAI,CAAC,UAAA,cAAc;wBAChB,OAAO,CAAC,cAAc,CAAC,CAAC;oBAC5B,CAAC,CAAC,CAAC,KAAK,CAAC,UAAA,KAAK;wBACV,MAAM,CAAC,2BAA2B,CAAC,CAAC;oBACxC,CAAC,CAAC,CAAC;gBACX,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,MAAM,CAAC,kBAAkB,CAAC,CAAC;gBAC/B,CAAC;YAEL,CAAC,CAAC,CAAC,KAAK,CAAC,UAAA,KAAK;gBACV,MAAM,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACP,CAAC;IAEL,qBAAC;AAAD,CAAC,AA/FD,IA+FC;AA/FY,wCAAc"}
\ No newline at end of file
export interface ProgramRepository {
findById(id: string): Promise<any>;
findByIds(ids: Array<string>): Promise<Array<any>>;
findByType(type: string): Promise<Array<any>>;
/**
* returns true / false depending on if there where any changes to download
*/
replicate(): Promise<boolean>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=program-repository.js.map
\ No newline at end of file
{"version":3,"file":"program-repository.js","sourceRoot":"","sources":["../src/program-repository.ts"],"names":[],"mappings":""}
\ No newline at end of file
export declare class Util {
static getISODate(): string;
static getDateInMinutes(): number;
/**
* convert a time input to minutes
* e.g. 23:59 = 1439
*/
static convertToMinutes(time: string): number;
static calculateNextMinute(): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Util = (function () {
function Util() {
}
Util.getISODate = function () {
return (new Date()).toISOString().slice(0, 10);
};
Util.getDateInMinutes = function () {
var now = new Date();
return (now.getHours() * 60) + now.getMinutes();
};
/**
* convert a time input to minutes
* e.g. 23:59 = 1439
*/
Util.convertToMinutes = function (time) {
var times = time.split(":");
var convered = (parseInt(times[0]) * 60) + parseInt(times[1]);
return (convered >= 0 && convered <= 1439) ? convered : 0;
};
Util.calculateNextMinute = function () {
return (60 - (Math.round((new Date()).getTime() / 1000) % 60)) * 1000;
};
return Util;
}());
exports.Util = Util;
//# sourceMappingURL=util.js.map
\ No newline at end of file
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;AAAA;IAAA;IAyBA,CAAC;IAvBU,eAAU,GAAjB;QACI,MAAM,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IAEM,qBAAgB,GAAvB;QACI,IAAI,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;IACpD,CAAC;IAED;;;OAGG;IACI,qBAAgB,GAAvB,UAAwB,IAAW;QAC/B,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,QAAQ,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,MAAM,CAAC,CAAC,QAAQ,IAAI,CAAC,IAAI,QAAQ,IAAI,IAAI,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC;IAC9D,CAAC;IAEM,wBAAmB,GAA1B;QACI,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IAC1E,CAAC;IAEL,WAAC;AAAD,CAAC,AAzBD,IAyBC;AAzBY,oBAAI"}
\ No newline at end of file
interface ProgramRepository {
findById(id:string) : Promise<any>;
findByIds(ids:Array<string>) : Promise<Array<any>>;
findByType(type:string) : Promise<Array<any>>;
replicate() : Promise<boolean>;
}
interface Player {
new() : Player;
on(name:string, any);
once(name:string, any);
start() : void;
stop() : void;
programRepository: ProgramRepository;
programManager: ProgramManager;
}
interface ProgramManager {
new() : ProgramManager;
programRepository: ProgramRepository;
}
interface ProgramItemFactory {
new() : ProgramItemFactory;
getProgramItem(programItemId:string) : Promise<any>;
basePath: string;
programRepository: ProgramRepository;
}
declare var digsigPlayer: {
ProgramRepository: ProgramRepository,
ProgramManager: ProgramManager,
Player : Player,
ProgramItemFactory: ProgramItemFactory
};
declare module "digsig-player-service" {
export = digsigPlayer;
}
\ No newline at end of file
......@@ -2,26 +2,22 @@
"name": "digsig-player-service",
"version": "1.0.0",
"description": "",
"main": "build/bundle.js",
"types": "index.d.ts",
"main": "dist/index.js",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"pretest": "tsc --target es5 --outDir .tmp spec/index.ts",
"pretest": "tsc --noImplicitAny false -p ./spec",
"test": "jasmine .tmp/spec/index.js",
"posttest": "rm -rf .tmp",
"build:tsc": "rollup -c rollup.config.js"
"posttest": "npm run clean",
"build": "npm run clean && tsc",
"clean": "rm -rf .tmp && rm -rf dist"
},
"author": "Stefan Huber <stefan.huber@beyondit.at>",
"license": "ISC",
"devDependencies": {
"@types/es6-promise": "0.0.32",
"@types/jasmine": "^2.5.41",
"@types/node": "^7.0.0",
"jasmine": "^2.5.3",
"rollup": "^0.41.4",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-node-builtins": "^2.0.0",
"rollup-plugin-node-globals": "^1.1.0",
"rollup-plugin-typescript": "^0.8.1",
"typescript": "^2.1.5"
"@types/jasmine": "^2.5.47",
"@types/node": "^7.0.22",
"jasmine": "^2.6.0",
"typescript": "^2.3.3"
}
}
......
var typescript = require('rollup-plugin-typescript');
var builtins = require('rollup-plugin-node-builtins');
var globals = require('rollup-plugin-node-globals');
var rollupConfig = {
moduleName : 'digsig',
entry: 'src/index.ts',
sourceMap: true,
format: 'cjs',
dest: 'build/bundle.js',
plugins: [
// builtins(),
// globals(),
typescript()
]
};
module.exports = rollupConfig;
\ No newline at end of file
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"outDir": "../.tmp"
}
}
\ No newline at end of file
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"lib": ["dom", "es2015"],
"noImplicitAny": false,
"outDir": "./dist/",
"target": "es5",
"sourceMap": true
},
"exclude": [
"node_modules",
"spec"
]
}
\ No newline at end of file