@jayesol/jayeson.lib.sports 2.2.4 → 2.2.6-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -77
- package/lib/basketball_codec.d.ts +1 -1
- package/lib/basketball_codec.js +209 -1
- package/lib/client.js +686 -1
- package/lib/codec.d.ts +2 -2
- package/lib/codec.js +129 -1
- package/lib/core.js +497 -1
- package/lib/data_structure.js +208 -1
- package/lib/dispatch.js +325 -1
- package/lib/index.js +27 -1
- package/lib/merge.js +569 -1
- package/lib/message_class.js +466 -1
- package/lib/module.d.ts +9 -0
- package/lib/module.js +87 -1
- package/lib/mutable.js +1061 -1
- package/lib/protobuf_bundle.d.ts +206 -394
- package/lib/protobuf_bundle.js +9683 -1
- package/lib/receive.js +484 -1
- package/lib/soccer_codec.d.ts +1 -1
- package/lib/soccer_codec.js +168 -1
- package/lib/tennis_codec.d.ts +1 -1
- package/lib/tennis_codec.js +177 -1
- package/package.json +49 -57
package/lib/message_class.js
CHANGED
|
@@ -1 +1,466 @@
|
|
|
1
|
-
"use strict";var __extends=this&&this.__extends||function(){var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(e,t){function s(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}}();Object.defineProperty(exports,"__esModule",{value:!0});var deliver=require("@jayesol/jayeson.lib.delivery"),jayeson_lib_record_1=require("@jayesol/jayeson.lib.record"),data_structure_1=require("./data_structure"),proto=require("./protobuf_bundle"),Collections=require("typescript-collections"),codec_1=require("./codec"),soccer_codec_1=require("./soccer_codec"),basketball_codec_1=require("./basketball_codec"),tennis_codec_1=require("./tennis_codec"),AbstractMessageClass=function(o){function e(e,t,s,r,n){var p=o.call(this,e,t,s)||this;return p._msgGroup=e,p._id=t,p._instanceClass=s,p._sportCodecs=r,p._partitionCodec=n,p.unpack=function(e){var t=proto.DataMessage.decode(e.message);e.message=new data_structure_1.IndexedSnapshotImpl({});var s=t.stringPool,r=t.feedKey;if(void 0!==r){var n=p.asSportType(r.sport);if(null!=n){var o=p._sportCodecs.getCodec(n);if(null!=o){var a=p._partitionCodec.decode(new proto.PartitionKey(r),s),_=p.read(t,o,s,a),c={};c[n]=_;var i=new Collections.Dictionary;i.setValue(a,(new Date).getTime()),e.message=new data_structure_1.IndexedSnapshotImpl(c,i)}}}},p}return __extends(e,o),e.prototype.id=function(){return this._id},e.prototype.SportsFeedMessageGroup=function(){return this._msgGroup},e.prototype.instanceClass=function(){return this._instanceClass},e.prototype.sportCodecs=function(){return this._sportCodecs},e.prototype.partitionCodec=function(){return this._partitionCodec},e.prototype.inHandlers=function(){return[{unpack:this.unpack}]},e.prototype.outHandlers=function(){return[]},e.prototype.asSportType=function(e){var t=proto.SportType[e];return jayeson_lib_record_1.SportType[t]},e}(deliver.IMessageClass);exports.AbstractMessageClass=AbstractMessageClass;var FilterMessageClass=function(s){function e(e,t){return s.call(this,e,t,codec_1.FilterRequest)||this}return __extends(e,s),e}(deliver.JSonMessageClass);exports.FilterMessageClass=FilterMessageClass;var SportsCodecs=function(){function e(e){void 0===e&&(e=void 0),void 0===(this.sportsMappings=e)&&(this.sportsMappings=new Collections.Dictionary,this.sportsMappings.setValue(jayeson_lib_record_1.SportType.SOCCER,new soccer_codec_1.SoccerCodec),this.sportsMappings.setValue(jayeson_lib_record_1.SportType.TENNIS,new tennis_codec_1.TennisCodec),this.sportsMappings.setValue(jayeson_lib_record_1.SportType.BASKETBALL,new basketball_codec_1.BasketballCodec))}return e.prototype.getCodec=function(e){return this.sportsMappings.getValue(e)},e}();exports.SportsCodecs=SportsCodecs;var PartitionCodec=function(){function e(){}return e.prototype.decode=function(e,t){var s=jayeson_lib_record_1.OddType.LIVE;switch(e.oddType){case proto.OddType.LIVE:s=jayeson_lib_record_1.OddType.LIVE;break;case proto.OddType.TODAY:s=jayeson_lib_record_1.OddType.TODAY;break;case proto.OddType.EARLY:s=jayeson_lib_record_1.OddType.EARLY}var r=jayeson_lib_record_1.SportType.SOCCER;switch(e.sport){case proto.SportType.SOCCER:r=jayeson_lib_record_1.SportType.SOCCER;break;case proto.SportType.BASKETBALL:r=jayeson_lib_record_1.SportType.BASKETBALL;break;case proto.SportType.HOCKEY:r=jayeson_lib_record_1.SportType.HOCKEY;break;case proto.SportType.TENNIS:r=jayeson_lib_record_1.SportType.TENNIS;break;case proto.SportType.HORSE_RACING:r=jayeson_lib_record_1.SportType.HORSE_RACING;break;case proto.SportType.MOTOR_SPORT:r=jayeson_lib_record_1.SportType.MOTOR_SPORT;break;case proto.SportType.HANDBALL:r=jayeson_lib_record_1.SportType.HANDBALL;break;case proto.SportType.CRICKET:r=jayeson_lib_record_1.SportType.CRICKET;break;case proto.SportType.POOL:r=jayeson_lib_record_1.SportType.POOL}return new jayeson_lib_record_1.PartitionKey(t[e.source],s,r)},e}();exports.PartitionCodec=PartitionCodec;var InsertMatchMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.matches.matches.map(function(e){return new proto.BaseMatch(e)});return t.decodeMatch(n,s,codec_1.EncodeAction.INSERT,r)},e}(AbstractMessageClass);exports.InsertMatchMessageClass=InsertMatchMessageClass;var InsertEventMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.events.events.map(function(e){return new proto.BaseEvent(e)});return t.decodeEvent(n,s,codec_1.EncodeAction.INSERT,r)},e}(AbstractMessageClass);exports.InsertEventMessageClass=InsertEventMessageClass;var InsertOddMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.odds.odds.map(function(e){return new proto.BaseRecord(e)});return t.decodeRecord(n,s,codec_1.EncodeAction.INSERT,r)},e}(AbstractMessageClass);exports.InsertOddMessageClass=InsertOddMessageClass;var UpdateMatchMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.matches.matches.map(function(e){return new proto.BaseMatch(e)});return t.decodeMatch(n,s,codec_1.EncodeAction.UPDATE,r)},e}(AbstractMessageClass);exports.UpdateMatchMessageClass=UpdateMatchMessageClass;var UpdateEventMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.events.events.map(function(e){return new proto.BaseEvent(e)});return t.decodeEvent(n,s,codec_1.EncodeAction.UPDATE,r)},e}(AbstractMessageClass);exports.UpdateEventMessageClass=UpdateEventMessageClass;var UpdateOddMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.odds.odds.map(function(e){return new proto.BaseRecord(e)});return t.decodeRecord(n,s,codec_1.EncodeAction.UPDATE,r)},e}(AbstractMessageClass);exports.UpdateOddMessageClass=UpdateOddMessageClass;var DeleteMatchMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.matches.matches.map(function(e){return new proto.BaseMatch(e)});return t.decodeMatch(n,s,codec_1.EncodeAction.DELETE,r)},e}(AbstractMessageClass);exports.DeleteMatchMessageClass=DeleteMatchMessageClass;var DeleteEventMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.events.events.map(function(e){return new proto.BaseEvent(e)});return t.decodeEvent(n,s,codec_1.EncodeAction.DELETE,r)},e}(AbstractMessageClass);exports.DeleteEventMessageClass=DeleteEventMessageClass;var DeleteOddMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){var n=e.odds.odds.map(function(e){return new proto.BaseRecord(e)});return t.decodeRecord(n,s,codec_1.EncodeAction.DELETE,r)},e}(AbstractMessageClass);exports.DeleteOddMessageClass=DeleteOddMessageClass;var ResetMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){return[]},e}(AbstractMessageClass);exports.ResetMessageClass=ResetMessageClass;var TTLRemoveMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){return[]},e}(AbstractMessageClass);exports.TTLRemoveMessageClass=TTLRemoveMessageClass;var TTLRestoreMessageClass=function(n){function e(e,t,s,r){return n.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,n),e.prototype.read=function(e,t,s,r){return[]},e}(AbstractMessageClass);exports.TTLRestoreMessageClass=TTLRestoreMessageClass;var SwitchFilterStartMessageClass=function(s){function e(e,t){return s.call(this,e,t)||this}return __extends(e,s),e}(deliver.EmptyMessageClass);exports.SwitchFilterStartMessageClass=SwitchFilterStartMessageClass;var SwitchFilterEndMessageClass=function(s){function e(e,t){return s.call(this,e,t)||this}return __extends(e,s),e}(deliver.EmptyMessageClass);exports.SwitchFilterEndMessageClass=SwitchFilterEndMessageClass;var SwitchFilterFailMessageClass=function(s){function e(e,t){return s.call(this,e,t)||this}return __extends(e,s),e}(deliver.EmptyMessageClass);exports.SwitchFilterFailMessageClass=SwitchFilterFailMessageClass;var StartSubscribeFeed=function(e,t){this.exclude=e,this.wireFormat=t};exports.StartSubscribeFeed=StartSubscribeFeed;var RefreshMessage=function(){},RefreshMessageClass=function(r){function e(e,t){var s=r.call(this,e,t,RefreshMessage)||this;return s.unpack=function(e){var t=e.message,s=new Collections.Dictionary;t.partitionKeys.forEach(function(e){s.setValue(jayeson_lib_record_1.PartitionKey.fromString(e),(new Date).getTime())}),e.message=new data_structure_1.IndexedSnapshotImpl({},s)},s}return __extends(e,r),e.prototype.inHandlers=function(){return r.prototype.inHandlers.call(this).concat([{unpack:this.unpack}])},e}(deliver.JSonMessageClass);exports.RefreshMessageClass=RefreshMessageClass;var SportsFeedMessageGroup=function(r){function e(e,t){void 0===e&&(e=new SportsCodecs),void 0===t&&(t=new PartitionCodec);var s=r.call(this,70)||this;return s._DATA_RESET=new ResetMessageClass(s,0,e,t),s._DATA_INSERT_ODD=new InsertOddMessageClass(s,1,e,t),s._DATA_UPDATE_ODD=new UpdateOddMessageClass(s,2,e,t),s._DATA_DELETE_ODD=new DeleteOddMessageClass(s,3,e,t),s._DATA_INSERT_EVENT=new InsertEventMessageClass(s,4,e,t),s._DATA_UPDATE_EVENT=new UpdateEventMessageClass(s,5,e,t),s._DATA_DELETE_EVENT=new DeleteEventMessageClass(s,6,e,t),s._DATA_INSERT_MATCH=new InsertMatchMessageClass(s,7,e,t),s._DATA_UPDATE_MATCH=new UpdateMatchMessageClass(s,8,e,t),s._DATA_DELETE_MATCH=new DeleteMatchMessageClass(s,9,e,t),s._TTL_RESTORE=new TTLRestoreMessageClass(s,10,e,t),s._TTL_REMOVE=new TTLRestoreMessageClass(s,11,e,t),s._FILTER_REMOVE=new deliver.StringMessageClass(s,13),s._FILTER_SET=new FilterMessageClass(s,14),s._ADMIN_START_SUBSCRIBE_FEED=new deliver.JSonMessageClass(s,16,StartSubscribeFeed),s._ADMIN_REFRESH=new RefreshMessageClass(s,17),s._SWITCH_FILTER_START=new deliver.StringMessageClass(s,18),s._SWITCH_FILTER_END=new deliver.EmptyMessageClass(s,19),s._FULLSNAPSHOT_START=new deliver.EmptyMessageClass(s,20),s._FULLSNAPSHOT_END=new deliver.EmptyMessageClass(s,21),s._SWITCH_FILTER_FAIL=new deliver.StringMessageClass(s,22),s._TTL_RESTORE_START=new TTLRestoreMessageClass(s,23,e,t),s._TTL_RESTORE_END=new deliver.EmptyMessageClass(s,24),[s._DATA_RESET,s._DATA_INSERT_ODD,s._DATA_UPDATE_ODD,s._DATA_DELETE_ODD,s._DATA_INSERT_EVENT,s._DATA_UPDATE_EVENT,s._DATA_DELETE_EVENT,s._DATA_INSERT_MATCH,s._DATA_UPDATE_MATCH,s._DATA_DELETE_MATCH,s._TTL_RESTORE,s._TTL_REMOVE,s._FILTER_REMOVE,s._FILTER_SET,s._ADMIN_START_SUBSCRIBE_FEED,s._ADMIN_REFRESH,s._SWITCH_FILTER_START,s._SWITCH_FILTER_END,s._FULLSNAPSHOT_START,s._FULLSNAPSHOT_END,s._SWITCH_FILTER_FAIL,s._TTL_RESTORE_START,s._TTL_RESTORE_END].forEach(function(e){s._classes[e.id()]=e}),s}return __extends(e,r),e.prototype.DATA_RESET=function(){return this._DATA_RESET},e.prototype.DATA_INSERT_ODD=function(){return this._DATA_INSERT_ODD},e.prototype.DATA_UPDATE_ODD=function(){return this._DATA_UPDATE_ODD},e.prototype.DATA_DELETE_ODD=function(){return this._DATA_DELETE_ODD},e.prototype.DATA_INSERT_EVENT=function(){return this._DATA_INSERT_EVENT},e.prototype.DATA_UPDATE_EVENT=function(){return this._DATA_UPDATE_EVENT},e.prototype.DATA_DELETE_EVENT=function(){return this._DATA_DELETE_EVENT},e.prototype.TTL_REMOVE=function(){return this._TTL_REMOVE},e.prototype.TTL_RESTORE=function(){return this._TTL_RESTORE},e.prototype.TTL_RESTORE_START=function(){return this._TTL_RESTORE_START},e.prototype.TTL_RESTORE_END=function(){return this._TTL_RESTORE_END},e.prototype.DATA_INSERT_MATCH=function(){return this._DATA_INSERT_MATCH},e.prototype.DATA_UPDATE_MATCH=function(){return this._DATA_UPDATE_MATCH},e.prototype.DATA_DELETE_MATCH=function(){return this._DATA_DELETE_MATCH},e.prototype.FILTER_REMOVE=function(){return this._FILTER_REMOVE},e.prototype.FILTER_SET=function(){return this._FILTER_SET},e.prototype.ADMIN_START_SUBSCRIBE_FEED=function(){return this._ADMIN_START_SUBSCRIBE_FEED},e.prototype.ADMIN_REFRESH=function(){return this._ADMIN_REFRESH},e.prototype.SWITCH_FILTER_START=function(){return this._SWITCH_FILTER_START},e.prototype.SWITCH_FILTER_END=function(){return this._SWITCH_FILTER_END},e.prototype.FULLSNAPSHOT_START=function(){return this._FULLSNAPSHOT_START},e.prototype.FULLSNAPSHOT_END=function(){return this._FULLSNAPSHOT_END},e.prototype.SWITCH_FILTER_FAIL=function(){return this._SWITCH_FILTER_FAIL},e.prototype.isIndicatorMessage=function(e){return e==this.SWITCH_FILTER_START()||e==this.SWITCH_FILTER_END()||e==this.FULLSNAPSHOT_START()||e==this.FULLSNAPSHOT_END()||e==this.SWITCH_FILTER_FAIL()||e==this.TTL_RESTORE_START()||e==this.TTL_RESTORE_END()},e.prototype.isSwitchFilterStatusMsg=function(e){return e==this.SWITCH_FILTER_START()||e==this.SWITCH_FILTER_FAIL()},e}(deliver.IMessageGroup);exports.SportsFeedMessageGroup=SportsFeedMessageGroup;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.SportsFeedMessageGroup = exports.RefreshMessageClass = exports.StartSubscribeFeed = exports.SwitchFilterFailMessageClass = exports.SwitchFilterEndMessageClass = exports.SwitchFilterStartMessageClass = exports.TTLRestoreMessageClass = exports.TTLRemoveMessageClass = exports.ResetMessageClass = exports.DeleteOddMessageClass = exports.DeleteEventMessageClass = exports.DeleteMatchMessageClass = exports.UpdateOddMessageClass = exports.UpdateEventMessageClass = exports.UpdateMatchMessageClass = exports.InsertOddMessageClass = exports.InsertEventMessageClass = exports.InsertMatchMessageClass = exports.PartitionCodec = exports.SportsCodecs = exports.FilterMessageClass = exports.AbstractMessageClass = void 0;
|
|
27
|
+
const deliver = require("@jayesol/jayeson.lib.delivery");
|
|
28
|
+
const jayeson_lib_record_1 = require("@jayesol/jayeson.lib.record");
|
|
29
|
+
const data_structure_1 = require("./data_structure");
|
|
30
|
+
const proto = __importStar(require("./protobuf_bundle"));
|
|
31
|
+
const Collections = __importStar(require("typescript-collections"));
|
|
32
|
+
const codec_1 = require("./codec");
|
|
33
|
+
const soccer_codec_1 = require("./soccer_codec");
|
|
34
|
+
const basketball_codec_1 = require("./basketball_codec");
|
|
35
|
+
const tennis_codec_1 = require("./tennis_codec");
|
|
36
|
+
class AbstractMessageClass extends deliver.IMessageClass {
|
|
37
|
+
constructor(_msgGroup, _id, _instanceClass, _sportCodecs, _partitionCodec) {
|
|
38
|
+
super(_msgGroup, _id, _instanceClass);
|
|
39
|
+
this._msgGroup = _msgGroup;
|
|
40
|
+
this._id = _id;
|
|
41
|
+
this._instanceClass = _instanceClass;
|
|
42
|
+
this._sportCodecs = _sportCodecs;
|
|
43
|
+
this._partitionCodec = _partitionCodec;
|
|
44
|
+
this.unpack = (wrapper) => {
|
|
45
|
+
let input = proto.DataMessage.decode(wrapper.message);
|
|
46
|
+
wrapper.message = new data_structure_1.IndexedSnapshotImpl({});
|
|
47
|
+
let pool = input.stringPool;
|
|
48
|
+
let pbufKey = input.feedKey;
|
|
49
|
+
//pbuf key?
|
|
50
|
+
if (pbufKey === undefined) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let sport = this.asSportType(pbufKey.sport);
|
|
54
|
+
if (sport === null || sport === undefined) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let codec = this._sportCodecs.getCodec(sport);
|
|
58
|
+
if (codec === null || codec === undefined) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
let key = this._partitionCodec.decode(new proto.PartitionKey(pbufKey), pool);
|
|
62
|
+
let matches = this.read(input, codec, pool, key);
|
|
63
|
+
let sportDelta = {};
|
|
64
|
+
sportDelta[sport] = matches;
|
|
65
|
+
let partitionsMap = new Collections.Dictionary();
|
|
66
|
+
partitionsMap.setValue(key, new Date().getTime());
|
|
67
|
+
wrapper.message = new data_structure_1.IndexedSnapshotImpl(sportDelta, partitionsMap);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
id() {
|
|
71
|
+
return this._id;
|
|
72
|
+
}
|
|
73
|
+
SportsFeedMessageGroup() {
|
|
74
|
+
return this._msgGroup;
|
|
75
|
+
}
|
|
76
|
+
instanceClass() {
|
|
77
|
+
return this._instanceClass;
|
|
78
|
+
}
|
|
79
|
+
sportCodecs() {
|
|
80
|
+
return this._sportCodecs;
|
|
81
|
+
}
|
|
82
|
+
partitionCodec() {
|
|
83
|
+
return this._partitionCodec;
|
|
84
|
+
}
|
|
85
|
+
inHandlers() {
|
|
86
|
+
return [{ unpack: this.unpack }];
|
|
87
|
+
}
|
|
88
|
+
outHandlers() {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
asSportType(pbuf) {
|
|
92
|
+
let sportName = proto.SportType[pbuf];
|
|
93
|
+
return jayeson_lib_record_1.SportType[sportName];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.AbstractMessageClass = AbstractMessageClass;
|
|
97
|
+
class FilterMessageClass extends deliver.JSonMessageClass {
|
|
98
|
+
constructor(msgGroup, id) {
|
|
99
|
+
super(msgGroup, id, codec_1.FilterRequest);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.FilterMessageClass = FilterMessageClass;
|
|
103
|
+
class SportsCodecs {
|
|
104
|
+
constructor(sportsMappings = undefined) {
|
|
105
|
+
this.sportsMappings = sportsMappings;
|
|
106
|
+
if (sportsMappings === undefined) {
|
|
107
|
+
this.sportsMappings = new Collections.Dictionary();
|
|
108
|
+
this.sportsMappings.setValue(jayeson_lib_record_1.SportType.SOCCER, new soccer_codec_1.SoccerCodec());
|
|
109
|
+
this.sportsMappings.setValue(jayeson_lib_record_1.SportType.TENNIS, new tennis_codec_1.TennisCodec());
|
|
110
|
+
this.sportsMappings.setValue(jayeson_lib_record_1.SportType.BASKETBALL, new basketball_codec_1.BasketballCodec());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
getCodec(sportType) {
|
|
114
|
+
return this.sportsMappings.getValue(sportType);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.SportsCodecs = SportsCodecs;
|
|
118
|
+
class PartitionCodec {
|
|
119
|
+
decode(key, pool) {
|
|
120
|
+
let type = jayeson_lib_record_1.OddType.LIVE;
|
|
121
|
+
switch (key.oddType) {
|
|
122
|
+
case proto.OddType.LIVE:
|
|
123
|
+
type = jayeson_lib_record_1.OddType.LIVE;
|
|
124
|
+
break;
|
|
125
|
+
case proto.OddType.TODAY:
|
|
126
|
+
type = jayeson_lib_record_1.OddType.TODAY;
|
|
127
|
+
break;
|
|
128
|
+
case proto.OddType.EARLY:
|
|
129
|
+
type = jayeson_lib_record_1.OddType.EARLY;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
let sporttype = jayeson_lib_record_1.SportType.SOCCER;
|
|
133
|
+
switch (key.sport) {
|
|
134
|
+
case proto.SportType.SOCCER:
|
|
135
|
+
sporttype = jayeson_lib_record_1.SportType.SOCCER;
|
|
136
|
+
break;
|
|
137
|
+
case proto.SportType.BASKETBALL:
|
|
138
|
+
sporttype = jayeson_lib_record_1.SportType.BASKETBALL;
|
|
139
|
+
break;
|
|
140
|
+
case proto.SportType.HOCKEY:
|
|
141
|
+
sporttype = jayeson_lib_record_1.SportType.HOCKEY;
|
|
142
|
+
break;
|
|
143
|
+
case proto.SportType.TENNIS:
|
|
144
|
+
sporttype = jayeson_lib_record_1.SportType.TENNIS;
|
|
145
|
+
break;
|
|
146
|
+
case proto.SportType.HORSE_RACING:
|
|
147
|
+
sporttype = jayeson_lib_record_1.SportType.HORSE_RACING;
|
|
148
|
+
break;
|
|
149
|
+
case proto.SportType.MOTOR_SPORT:
|
|
150
|
+
sporttype = jayeson_lib_record_1.SportType.MOTOR_SPORT;
|
|
151
|
+
break;
|
|
152
|
+
case proto.SportType.HANDBALL:
|
|
153
|
+
sporttype = jayeson_lib_record_1.SportType.HANDBALL;
|
|
154
|
+
break;
|
|
155
|
+
case proto.SportType.CRICKET:
|
|
156
|
+
sporttype = jayeson_lib_record_1.SportType.CRICKET;
|
|
157
|
+
break;
|
|
158
|
+
case proto.SportType.POOL:
|
|
159
|
+
sporttype = jayeson_lib_record_1.SportType.POOL;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
return new jayeson_lib_record_1.PartitionKey(pool[key.source], type, sporttype);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.PartitionCodec = PartitionCodec;
|
|
166
|
+
class InsertMatchMessageClass extends AbstractMessageClass {
|
|
167
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
168
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
169
|
+
}
|
|
170
|
+
read(msg, codec, pool, key) {
|
|
171
|
+
let matches = msg.matches.matches.map(o => new proto.BaseMatch(o));
|
|
172
|
+
return codec.decodeMatch(matches, pool, codec_1.EncodeAction.INSERT, key);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.InsertMatchMessageClass = InsertMatchMessageClass;
|
|
176
|
+
class InsertEventMessageClass extends AbstractMessageClass {
|
|
177
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
178
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
179
|
+
}
|
|
180
|
+
read(msg, codec, pool, key) {
|
|
181
|
+
let events = msg.events.events.map(o => new proto.BaseEvent(o));
|
|
182
|
+
return codec.decodeEvent(events, pool, codec_1.EncodeAction.INSERT, key);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.InsertEventMessageClass = InsertEventMessageClass;
|
|
186
|
+
class InsertOddMessageClass extends AbstractMessageClass {
|
|
187
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
188
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
189
|
+
}
|
|
190
|
+
read(msg, codec, pool, key) {
|
|
191
|
+
let odds = msg.odds.odds.map(o => new proto.BaseRecord(o));
|
|
192
|
+
return codec.decodeRecord(odds, pool, codec_1.EncodeAction.INSERT, key);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
exports.InsertOddMessageClass = InsertOddMessageClass;
|
|
196
|
+
class UpdateMatchMessageClass extends AbstractMessageClass {
|
|
197
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
198
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
199
|
+
}
|
|
200
|
+
read(msg, codec, pool, key) {
|
|
201
|
+
let matches = msg.matches.matches.map(o => new proto.BaseMatch(o));
|
|
202
|
+
return codec.decodeMatch(matches, pool, codec_1.EncodeAction.UPDATE, key);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.UpdateMatchMessageClass = UpdateMatchMessageClass;
|
|
206
|
+
class UpdateEventMessageClass extends AbstractMessageClass {
|
|
207
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
208
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
209
|
+
}
|
|
210
|
+
read(msg, codec, pool, key) {
|
|
211
|
+
let events = msg.events.events.map(o => new proto.BaseEvent(o));
|
|
212
|
+
return codec.decodeEvent(events, pool, codec_1.EncodeAction.UPDATE, key);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.UpdateEventMessageClass = UpdateEventMessageClass;
|
|
216
|
+
class UpdateOddMessageClass extends AbstractMessageClass {
|
|
217
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
218
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
219
|
+
}
|
|
220
|
+
read(msg, codec, pool, key) {
|
|
221
|
+
let odds = msg.odds.odds.map(o => new proto.BaseRecord(o));
|
|
222
|
+
return codec.decodeRecord(odds, pool, codec_1.EncodeAction.UPDATE, key);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.UpdateOddMessageClass = UpdateOddMessageClass;
|
|
226
|
+
class DeleteMatchMessageClass extends AbstractMessageClass {
|
|
227
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
228
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
229
|
+
}
|
|
230
|
+
read(msg, codec, pool, key) {
|
|
231
|
+
let matches = msg.matches.matches.map(o => new proto.BaseMatch(o));
|
|
232
|
+
return codec.decodeMatch(matches, pool, codec_1.EncodeAction.DELETE, key);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
exports.DeleteMatchMessageClass = DeleteMatchMessageClass;
|
|
236
|
+
class DeleteEventMessageClass extends AbstractMessageClass {
|
|
237
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
238
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
239
|
+
}
|
|
240
|
+
read(msg, codec, pool, key) {
|
|
241
|
+
let events = msg.events.events.map(o => new proto.BaseEvent(o));
|
|
242
|
+
return codec.decodeEvent(events, pool, codec_1.EncodeAction.DELETE, key);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
exports.DeleteEventMessageClass = DeleteEventMessageClass;
|
|
246
|
+
class DeleteOddMessageClass extends AbstractMessageClass {
|
|
247
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
248
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
249
|
+
}
|
|
250
|
+
read(msg, codec, pool, key) {
|
|
251
|
+
let odds = msg.odds.odds.map(o => new proto.BaseRecord(o));
|
|
252
|
+
return codec.decodeRecord(odds, pool, codec_1.EncodeAction.DELETE, key);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
exports.DeleteOddMessageClass = DeleteOddMessageClass;
|
|
256
|
+
class ResetMessageClass extends AbstractMessageClass {
|
|
257
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
258
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
259
|
+
}
|
|
260
|
+
read(msg, codec, pool, key) {
|
|
261
|
+
return [];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.ResetMessageClass = ResetMessageClass;
|
|
265
|
+
class TTLRemoveMessageClass extends AbstractMessageClass {
|
|
266
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
267
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
268
|
+
}
|
|
269
|
+
read(msg, codec, pool, key) {
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.TTLRemoveMessageClass = TTLRemoveMessageClass;
|
|
274
|
+
class TTLRestoreMessageClass extends AbstractMessageClass {
|
|
275
|
+
constructor(group, id, sportCodec, partitionCodec) {
|
|
276
|
+
super(group, id, data_structure_1.IndexedSnapshotImpl, sportCodec, partitionCodec);
|
|
277
|
+
}
|
|
278
|
+
read(msg, codec, pool, key) {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
exports.TTLRestoreMessageClass = TTLRestoreMessageClass;
|
|
283
|
+
class SwitchFilterStartMessageClass extends deliver.EmptyMessageClass {
|
|
284
|
+
constructor(group, id) {
|
|
285
|
+
super(group, id);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
exports.SwitchFilterStartMessageClass = SwitchFilterStartMessageClass;
|
|
289
|
+
class SwitchFilterEndMessageClass extends deliver.EmptyMessageClass {
|
|
290
|
+
constructor(group, id) {
|
|
291
|
+
super(group, id);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
exports.SwitchFilterEndMessageClass = SwitchFilterEndMessageClass;
|
|
295
|
+
class SwitchFilterFailMessageClass extends deliver.EmptyMessageClass {
|
|
296
|
+
constructor(group, id) {
|
|
297
|
+
super(group, id);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
exports.SwitchFilterFailMessageClass = SwitchFilterFailMessageClass;
|
|
301
|
+
class StartSubscribeFeed {
|
|
302
|
+
constructor(exclude, wireFormat) {
|
|
303
|
+
this.exclude = exclude;
|
|
304
|
+
this.wireFormat = wireFormat;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
exports.StartSubscribeFeed = StartSubscribeFeed;
|
|
308
|
+
class RefreshMessage {
|
|
309
|
+
}
|
|
310
|
+
class RefreshMessageClass extends deliver.JSonMessageClass {
|
|
311
|
+
constructor(msgGroup, id) {
|
|
312
|
+
super(msgGroup, id, RefreshMessage);
|
|
313
|
+
this.unpack = (wrapper) => {
|
|
314
|
+
let refreshMsg = wrapper.message;
|
|
315
|
+
let newPartitions = new Collections.Dictionary();
|
|
316
|
+
refreshMsg.partitionKeys.forEach(key => {
|
|
317
|
+
newPartitions.setValue(jayeson_lib_record_1.PartitionKey.fromString(key), new Date().getTime());
|
|
318
|
+
});
|
|
319
|
+
wrapper.message = new data_structure_1.IndexedSnapshotImpl({}, newPartitions);
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
inHandlers() {
|
|
323
|
+
return super.inHandlers().concat([{ unpack: this.unpack }]);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
exports.RefreshMessageClass = RefreshMessageClass;
|
|
327
|
+
class SportsFeedMessageGroup extends deliver.IMessageGroup {
|
|
328
|
+
DATA_RESET() {
|
|
329
|
+
return this._DATA_RESET;
|
|
330
|
+
}
|
|
331
|
+
DATA_INSERT_ODD() {
|
|
332
|
+
return this._DATA_INSERT_ODD;
|
|
333
|
+
}
|
|
334
|
+
DATA_UPDATE_ODD() {
|
|
335
|
+
return this._DATA_UPDATE_ODD;
|
|
336
|
+
}
|
|
337
|
+
DATA_DELETE_ODD() {
|
|
338
|
+
return this._DATA_DELETE_ODD;
|
|
339
|
+
}
|
|
340
|
+
DATA_INSERT_EVENT() {
|
|
341
|
+
return this._DATA_INSERT_EVENT;
|
|
342
|
+
}
|
|
343
|
+
DATA_UPDATE_EVENT() {
|
|
344
|
+
return this._DATA_UPDATE_EVENT;
|
|
345
|
+
}
|
|
346
|
+
DATA_DELETE_EVENT() {
|
|
347
|
+
return this._DATA_DELETE_EVENT;
|
|
348
|
+
}
|
|
349
|
+
TTL_REMOVE() {
|
|
350
|
+
return this._TTL_REMOVE;
|
|
351
|
+
}
|
|
352
|
+
TTL_RESTORE() {
|
|
353
|
+
return this._TTL_RESTORE;
|
|
354
|
+
}
|
|
355
|
+
TTL_RESTORE_START() {
|
|
356
|
+
return this._TTL_RESTORE_START;
|
|
357
|
+
}
|
|
358
|
+
TTL_RESTORE_END() {
|
|
359
|
+
return this._TTL_RESTORE_END;
|
|
360
|
+
}
|
|
361
|
+
DATA_INSERT_MATCH() {
|
|
362
|
+
return this._DATA_INSERT_MATCH;
|
|
363
|
+
}
|
|
364
|
+
DATA_UPDATE_MATCH() {
|
|
365
|
+
return this._DATA_UPDATE_MATCH;
|
|
366
|
+
}
|
|
367
|
+
DATA_DELETE_MATCH() {
|
|
368
|
+
return this._DATA_DELETE_MATCH;
|
|
369
|
+
}
|
|
370
|
+
FILTER_REMOVE() {
|
|
371
|
+
return this._FILTER_REMOVE;
|
|
372
|
+
}
|
|
373
|
+
FILTER_SET() {
|
|
374
|
+
return this._FILTER_SET;
|
|
375
|
+
}
|
|
376
|
+
ADMIN_START_SUBSCRIBE_FEED() {
|
|
377
|
+
return this._ADMIN_START_SUBSCRIBE_FEED;
|
|
378
|
+
}
|
|
379
|
+
ADMIN_REFRESH() {
|
|
380
|
+
return this._ADMIN_REFRESH;
|
|
381
|
+
}
|
|
382
|
+
SWITCH_FILTER_START() {
|
|
383
|
+
return this._SWITCH_FILTER_START;
|
|
384
|
+
}
|
|
385
|
+
SWITCH_FILTER_END() {
|
|
386
|
+
return this._SWITCH_FILTER_END;
|
|
387
|
+
}
|
|
388
|
+
FULLSNAPSHOT_START() {
|
|
389
|
+
return this._FULLSNAPSHOT_START;
|
|
390
|
+
}
|
|
391
|
+
FULLSNAPSHOT_END() {
|
|
392
|
+
return this._FULLSNAPSHOT_END;
|
|
393
|
+
}
|
|
394
|
+
SWITCH_FILTER_FAIL() {
|
|
395
|
+
return this._SWITCH_FILTER_FAIL;
|
|
396
|
+
}
|
|
397
|
+
isIndicatorMessage(messageClass) {
|
|
398
|
+
return messageClass == this.SWITCH_FILTER_START() ||
|
|
399
|
+
messageClass == this.SWITCH_FILTER_END() ||
|
|
400
|
+
messageClass == this.FULLSNAPSHOT_START() ||
|
|
401
|
+
messageClass == this.FULLSNAPSHOT_END() ||
|
|
402
|
+
messageClass == this.SWITCH_FILTER_FAIL() ||
|
|
403
|
+
messageClass == this.TTL_RESTORE_START() ||
|
|
404
|
+
messageClass == this.TTL_RESTORE_END();
|
|
405
|
+
}
|
|
406
|
+
isSwitchFilterStatusMsg(messageClass) {
|
|
407
|
+
return messageClass == this.SWITCH_FILTER_START() ||
|
|
408
|
+
messageClass == this.SWITCH_FILTER_FAIL();
|
|
409
|
+
}
|
|
410
|
+
constructor(sportCodec = new SportsCodecs(), partitionCodec = new PartitionCodec()) {
|
|
411
|
+
super(70);
|
|
412
|
+
// Initialize message classes
|
|
413
|
+
this._DATA_RESET = new ResetMessageClass(this, 0, sportCodec, partitionCodec);
|
|
414
|
+
this._DATA_INSERT_ODD = new InsertOddMessageClass(this, 1, sportCodec, partitionCodec);
|
|
415
|
+
this._DATA_UPDATE_ODD = new UpdateOddMessageClass(this, 2, sportCodec, partitionCodec);
|
|
416
|
+
this._DATA_DELETE_ODD = new DeleteOddMessageClass(this, 3, sportCodec, partitionCodec);
|
|
417
|
+
this._DATA_INSERT_EVENT = new InsertEventMessageClass(this, 4, sportCodec, partitionCodec);
|
|
418
|
+
this._DATA_UPDATE_EVENT = new UpdateEventMessageClass(this, 5, sportCodec, partitionCodec);
|
|
419
|
+
this._DATA_DELETE_EVENT = new DeleteEventMessageClass(this, 6, sportCodec, partitionCodec);
|
|
420
|
+
this._DATA_INSERT_MATCH = new InsertMatchMessageClass(this, 7, sportCodec, partitionCodec);
|
|
421
|
+
this._DATA_UPDATE_MATCH = new UpdateMatchMessageClass(this, 8, sportCodec, partitionCodec);
|
|
422
|
+
this._DATA_DELETE_MATCH = new DeleteMatchMessageClass(this, 9, sportCodec, partitionCodec);
|
|
423
|
+
this._TTL_RESTORE = new TTLRestoreMessageClass(this, 10, sportCodec, partitionCodec);
|
|
424
|
+
this._TTL_REMOVE = new TTLRestoreMessageClass(this, 11, sportCodec, partitionCodec);
|
|
425
|
+
this._FILTER_REMOVE = new deliver.StringMessageClass(this, 13);
|
|
426
|
+
this._FILTER_SET = new FilterMessageClass(this, 14);
|
|
427
|
+
this._ADMIN_START_SUBSCRIBE_FEED = new deliver.JSonMessageClass(this, 16, StartSubscribeFeed);
|
|
428
|
+
this._ADMIN_REFRESH = new RefreshMessageClass(this, 17);
|
|
429
|
+
this._SWITCH_FILTER_START = new deliver.StringMessageClass(this, 18);
|
|
430
|
+
this._SWITCH_FILTER_END = new deliver.EmptyMessageClass(this, 19);
|
|
431
|
+
this._FULLSNAPSHOT_START = new deliver.EmptyMessageClass(this, 20);
|
|
432
|
+
this._FULLSNAPSHOT_END = new deliver.EmptyMessageClass(this, 21);
|
|
433
|
+
this._SWITCH_FILTER_FAIL = new deliver.StringMessageClass(this, 22);
|
|
434
|
+
this._TTL_RESTORE_START = new TTLRestoreMessageClass(this, 23, sportCodec, partitionCodec);
|
|
435
|
+
this._TTL_RESTORE_END = new deliver.EmptyMessageClass(this, 24);
|
|
436
|
+
// Index message class attributes
|
|
437
|
+
let classes = [this._DATA_RESET,
|
|
438
|
+
this._DATA_INSERT_ODD,
|
|
439
|
+
this._DATA_UPDATE_ODD,
|
|
440
|
+
this._DATA_DELETE_ODD,
|
|
441
|
+
this._DATA_INSERT_EVENT,
|
|
442
|
+
this._DATA_UPDATE_EVENT,
|
|
443
|
+
this._DATA_DELETE_EVENT,
|
|
444
|
+
this._DATA_INSERT_MATCH,
|
|
445
|
+
this._DATA_UPDATE_MATCH,
|
|
446
|
+
this._DATA_DELETE_MATCH,
|
|
447
|
+
this._TTL_RESTORE,
|
|
448
|
+
this._TTL_REMOVE,
|
|
449
|
+
this._FILTER_REMOVE,
|
|
450
|
+
this._FILTER_SET,
|
|
451
|
+
this._ADMIN_START_SUBSCRIBE_FEED,
|
|
452
|
+
this._ADMIN_REFRESH,
|
|
453
|
+
this._SWITCH_FILTER_START,
|
|
454
|
+
this._SWITCH_FILTER_END,
|
|
455
|
+
this._FULLSNAPSHOT_START,
|
|
456
|
+
this._FULLSNAPSHOT_END,
|
|
457
|
+
this._SWITCH_FILTER_FAIL,
|
|
458
|
+
this._TTL_RESTORE_START,
|
|
459
|
+
this._TTL_RESTORE_END
|
|
460
|
+
];
|
|
461
|
+
classes.forEach(msgClass => {
|
|
462
|
+
this._classes[msgClass.id()] = msgClass;
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
exports.SportsFeedMessageGroup = SportsFeedMessageGroup;
|
package/lib/module.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import * as D from '@jayesol/jayeson.lib.delivery';
|
|
2
|
+
import { SportsFeedClient } from './client';
|
|
1
3
|
export declare class SportsFeedCoreComponentModule {
|
|
2
4
|
static getBindingArray(exclude?: any[], wireFormat?: string, outputStreamName?: string): any[];
|
|
3
5
|
}
|
|
6
|
+
export declare class SportsFeedCoreService {
|
|
7
|
+
private client;
|
|
8
|
+
private subscriber;
|
|
9
|
+
constructor(streamFinder: string, feedScope: string);
|
|
10
|
+
getClient(): SportsFeedClient;
|
|
11
|
+
getSubscriber(): D.Subscriber;
|
|
12
|
+
}
|
package/lib/module.js
CHANGED
|
@@ -1 +1,87 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.SportsFeedCoreService = exports.SportsFeedCoreComponentModule = void 0;
|
|
27
|
+
const D = __importStar(require("@jayesol/jayeson.lib.delivery"));
|
|
28
|
+
const injection_js_1 = require("injection-js");
|
|
29
|
+
const message_class_1 = require("./message_class");
|
|
30
|
+
const receive_1 = require("./receive");
|
|
31
|
+
const core_1 = require("./core");
|
|
32
|
+
const dispatch_1 = require("./dispatch");
|
|
33
|
+
const client_1 = require("./client");
|
|
34
|
+
class SportsFeedCoreComponentModule {
|
|
35
|
+
static getBindingArray(exclude = [], wireFormat = "", outputStreamName = client_1.MemoryDispatcher.MEMORY_STREAM) {
|
|
36
|
+
return [
|
|
37
|
+
{ provide: message_class_1.StartSubscribeFeed, useValue: new message_class_1.StartSubscribeFeed(exclude, wireFormat) },
|
|
38
|
+
{ provide: message_class_1.SportsFeedMessageGroup, useValue: new message_class_1.SportsFeedMessageGroup() },
|
|
39
|
+
{ provide: D.StreamNameCode, useClass: D.StreamNameCode },
|
|
40
|
+
{ provide: receive_1.InEndPointEventHandler, useClass: receive_1.InEndPointEventHandler },
|
|
41
|
+
{ provide: core_1.FSRepoImpl.outputStream, useValue: outputStreamName },
|
|
42
|
+
core_1.FSRepoImpl,
|
|
43
|
+
{ provide: core_1.AbstractFSRepo, useExisting: core_1.FSRepoImpl },
|
|
44
|
+
{ provide: core_1.FSREPO_IMPL, useExisting: core_1.FSRepoImpl },
|
|
45
|
+
dispatch_1.RelayEPG,
|
|
46
|
+
dispatch_1.EndPointGroupManager,
|
|
47
|
+
core_1.TTLConfig,
|
|
48
|
+
core_1.RecycleBin,
|
|
49
|
+
receive_1.StreamCommandProcessor,
|
|
50
|
+
receive_1.SportsFeedInProcessor,
|
|
51
|
+
{ provide: D.IMessageGroupProcessor, useExisting: receive_1.SportsFeedInProcessor },
|
|
52
|
+
{ provide: dispatch_1.EPGM_IMPL, useExisting: dispatch_1.EndPointGroupManager },
|
|
53
|
+
client_1.FeedView,
|
|
54
|
+
client_1.SportsFeedClient
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.SportsFeedCoreComponentModule = SportsFeedCoreComponentModule;
|
|
59
|
+
class SportsFeedCoreService {
|
|
60
|
+
constructor(streamFinder, feedScope) {
|
|
61
|
+
const subscriberFactory = function (processor) {
|
|
62
|
+
const config = new D.SubscriberConfig();
|
|
63
|
+
config.streamFinder = streamFinder;
|
|
64
|
+
config.discoveryPattern = {
|
|
65
|
+
70: ['.*']
|
|
66
|
+
};
|
|
67
|
+
config.processors = {
|
|
68
|
+
70: processor
|
|
69
|
+
};
|
|
70
|
+
config.schemes = ['ws', 'http', 'https', 'wss'];
|
|
71
|
+
config.feedScope = feedScope;
|
|
72
|
+
return new D.Subscriber(config);
|
|
73
|
+
};
|
|
74
|
+
const injector = injection_js_1.ReflectiveInjector.resolveAndCreate(SportsFeedCoreComponentModule.getBindingArray().concat([
|
|
75
|
+
{ provide: D.Subscriber, useFactory: subscriberFactory, deps: [receive_1.SportsFeedInProcessor] }
|
|
76
|
+
]));
|
|
77
|
+
this.client = injector.get(client_1.SportsFeedClient);
|
|
78
|
+
this.subscriber = injector.get(D.Subscriber);
|
|
79
|
+
}
|
|
80
|
+
getClient() {
|
|
81
|
+
return this.client;
|
|
82
|
+
}
|
|
83
|
+
getSubscriber() {
|
|
84
|
+
return this.subscriber;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.SportsFeedCoreService = SportsFeedCoreService;
|