@jayesol/jayeson.lib.sports 2.2.5-beta.1205 → 2.2.5-beta.1205v2
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/package.json +1 -1
- package/lib/basketball_codec.d.ts +0 -11
- package/lib/basketball_codec.js +0 -1
- package/lib/client.d.ts +0 -202
- package/lib/client.js +0 -1
- package/lib/codec.d.ts +0 -57
- package/lib/codec.js +0 -1
- package/lib/core.d.ts +0 -159
- package/lib/core.js +0 -1
- package/lib/data_structure.d.ts +0 -113
- package/lib/data_structure.js +0 -1
- package/lib/dispatch.d.ts +0 -126
- package/lib/dispatch.js +0 -1
- package/lib/index.d.ts +0 -11
- package/lib/index.js +0 -1
- package/lib/merge.d.ts +0 -33
- package/lib/merge.js +0 -1
- package/lib/message_class.d.ts +0 -152
- package/lib/message_class.js +0 -1
- package/lib/module.d.ts +0 -3
- package/lib/module.js +0 -1
- package/lib/mutable.d.ts +0 -118
- package/lib/mutable.js +0 -1
- package/lib/protobuf_bundle.d.ts +0 -2992
- package/lib/protobuf_bundle.js +0 -1
- package/lib/receive.d.ts +0 -88
- package/lib/receive.js +0 -1
- package/lib/soccer_codec.d.ts +0 -13
- package/lib/soccer_codec.js +0 -1
- package/lib/tennis_codec.d.ts +0 -13
- package/lib/tennis_codec.js +0 -1
package/lib/dispatch.d.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { DeltaOutgoing, IndexedSnapshot, Outgoing } from "./data_structure";
|
|
2
|
-
import { TTLOutgoing, FSRepo, ISnapshotHandler } from "./core";
|
|
3
|
-
import { SportsFeedMessageGroup } from "./message_class";
|
|
4
|
-
import { InjectionToken } from "injection-js";
|
|
5
|
-
import * as T from 'ts-promise';
|
|
6
|
-
export interface IEndPointGroupManager {
|
|
7
|
-
registerEPD(epd: IEndPointDispatcher): void;
|
|
8
|
-
deregisterEPD(epd: IEndPointDispatcher): void;
|
|
9
|
-
}
|
|
10
|
-
export declare const EPGM_IMPL: InjectionToken<IEndPointGroupManager>;
|
|
11
|
-
export interface IEndPointGroup extends ISnapshotHandler {
|
|
12
|
-
hasEPD(stream: string, id: string): boolean;
|
|
13
|
-
addEPD(epd: IEndPointDispatcher): void;
|
|
14
|
-
removeEPD(epd: IEndPointDispatcher): void;
|
|
15
|
-
isEmpty(): boolean;
|
|
16
|
-
submitForProcess(process: IDispatchableWrapper): void;
|
|
17
|
-
getSportsFeedGrp(): SportsFeedMessageGroup;
|
|
18
|
-
getEPDs(stream: string): IEndPointDispatcher[];
|
|
19
|
-
getStreams(): string[];
|
|
20
|
-
startGetingDeltaSnapshot(fsRepo: FSRepo): void;
|
|
21
|
-
stopGetingDeltaSnapshot(fsRepo: FSRepo): void;
|
|
22
|
-
generateFull(wrapper: FullSnapshotWrapper): Outgoing[];
|
|
23
|
-
generatePartial(wrapper: PartialSnapshotWrapper): Outgoing[];
|
|
24
|
-
}
|
|
25
|
-
export interface IDispatchableWrapper {
|
|
26
|
-
process(): void;
|
|
27
|
-
}
|
|
28
|
-
export declare abstract class WrapperImpl {
|
|
29
|
-
private __epg;
|
|
30
|
-
private __stream;
|
|
31
|
-
constructor(__epg: IEndPointGroup, __stream: string);
|
|
32
|
-
epg(): IEndPointGroup;
|
|
33
|
-
stream(): string;
|
|
34
|
-
}
|
|
35
|
-
export declare class FullSnapshotWrapper extends WrapperImpl implements IDispatchableWrapper {
|
|
36
|
-
private _epg;
|
|
37
|
-
private _stream;
|
|
38
|
-
private _epd;
|
|
39
|
-
fullSnapshot: IndexedSnapshot;
|
|
40
|
-
constructor(_epg: IEndPointGroup, _stream: string, _epd: IEndPointDispatcher, fullSnapshot: IndexedSnapshot);
|
|
41
|
-
epg(): IEndPointGroup;
|
|
42
|
-
stream(): string;
|
|
43
|
-
epd(): IEndPointDispatcher;
|
|
44
|
-
process(): void;
|
|
45
|
-
getFullSnapshot(): IndexedSnapshot;
|
|
46
|
-
setFullSnapshot(fullSnapshot: IndexedSnapshot): void;
|
|
47
|
-
}
|
|
48
|
-
export declare class PartialSnapshotWrapper extends WrapperImpl implements IDispatchableWrapper {
|
|
49
|
-
private _delta;
|
|
50
|
-
private _epg;
|
|
51
|
-
private _stream;
|
|
52
|
-
constructor(_delta: DeltaOutgoing, _epg: IEndPointGroup, _stream: string);
|
|
53
|
-
epg(): IEndPointGroup;
|
|
54
|
-
stream(): string;
|
|
55
|
-
delta(): DeltaOutgoing;
|
|
56
|
-
process(): void;
|
|
57
|
-
}
|
|
58
|
-
export declare class IndicatorWrapper extends WrapperImpl implements IDispatchableWrapper {
|
|
59
|
-
private _delta;
|
|
60
|
-
private _epg;
|
|
61
|
-
private _stream;
|
|
62
|
-
constructor(_delta: Outgoing, _epg: IEndPointGroup, _stream: string);
|
|
63
|
-
process(): void;
|
|
64
|
-
}
|
|
65
|
-
export declare class EPDispatcherException extends Error {
|
|
66
|
-
constructor(message: string);
|
|
67
|
-
}
|
|
68
|
-
export declare class EndPointGroupManager implements IEndPointGroupManager {
|
|
69
|
-
private _fsRepo;
|
|
70
|
-
private _grp;
|
|
71
|
-
relayEPG: RelayEPG;
|
|
72
|
-
constructor(_fsRepo: FSRepo, _grp: SportsFeedMessageGroup);
|
|
73
|
-
fsRepo(): FSRepo;
|
|
74
|
-
grp(): SportsFeedMessageGroup;
|
|
75
|
-
pushFullSnapshotWrapper(epg: IEndPointGroup, epd: IEndPointDispatcher): void;
|
|
76
|
-
registerEPD(epd: IEndPointDispatcher): void;
|
|
77
|
-
deregisterEPD(epd: IEndPointDispatcher): void;
|
|
78
|
-
}
|
|
79
|
-
export interface IEndPointDispatcher {
|
|
80
|
-
id(): string;
|
|
81
|
-
stream(): string;
|
|
82
|
-
submit(out: Outgoing): void;
|
|
83
|
-
onException(e: Error): void;
|
|
84
|
-
isInitialized(): T.Promise<Boolean>;
|
|
85
|
-
readyToDispatch(): void;
|
|
86
|
-
isReadyToDispatch(): boolean;
|
|
87
|
-
}
|
|
88
|
-
export declare class DispatchersGroup {
|
|
89
|
-
private streamName;
|
|
90
|
-
private dispatchers;
|
|
91
|
-
constructor(streamName: string);
|
|
92
|
-
addEpd(epd: IEndPointDispatcher): void;
|
|
93
|
-
removeEpd(epd: IEndPointDispatcher): IEndPointDispatcher;
|
|
94
|
-
get(id: string): IEndPointDispatcher;
|
|
95
|
-
getAll(): IEndPointDispatcher[];
|
|
96
|
-
isEmpty(): boolean;
|
|
97
|
-
}
|
|
98
|
-
export declare abstract class AbstractEPG implements IEndPointGroup {
|
|
99
|
-
private sportsFeedGroup;
|
|
100
|
-
private dispatchers;
|
|
101
|
-
constructor(sportsFeedGroup: SportsFeedMessageGroup);
|
|
102
|
-
hasEPD(stream: string, id: string): boolean;
|
|
103
|
-
addEPD(epd: IEndPointDispatcher): void;
|
|
104
|
-
removeEPD(epd: IEndPointDispatcher): void;
|
|
105
|
-
isEmpty(): boolean;
|
|
106
|
-
abstract submitForProcess(process: IDispatchableWrapper): void;
|
|
107
|
-
getEPDs(stream: string): IEndPointDispatcher[];
|
|
108
|
-
getStreams(): string[];
|
|
109
|
-
startGetingDeltaSnapshot(fsRepo: FSRepo): void;
|
|
110
|
-
stopGetingDeltaSnapshot(fsRepo: FSRepo): void;
|
|
111
|
-
process(stream: string, snapshot: Outgoing): void;
|
|
112
|
-
getSportsFeedGrp(): SportsFeedMessageGroup;
|
|
113
|
-
generateFull(wrapper: FullSnapshotWrapper): Outgoing[];
|
|
114
|
-
generatePartial(wrapper: PartialSnapshotWrapper): Outgoing[];
|
|
115
|
-
}
|
|
116
|
-
export declare class RelayEPG extends AbstractEPG {
|
|
117
|
-
private _sportsFeedGroup;
|
|
118
|
-
constructor(_sportsFeedGroup: SportsFeedMessageGroup);
|
|
119
|
-
submitForProcess(wrapper: IDispatchableWrapper): void;
|
|
120
|
-
onException(e: Error): void;
|
|
121
|
-
generateFull(wrapper: FullSnapshotWrapper): Outgoing[];
|
|
122
|
-
generatePartial(wrapper: PartialSnapshotWrapper): Outgoing[];
|
|
123
|
-
generateTtl(outGng: TTLOutgoing): Outgoing[];
|
|
124
|
-
generateTtlRestore(outGng: TTLOutgoing): Outgoing[];
|
|
125
|
-
private isSameFormat;
|
|
126
|
-
}
|
package/lib/dispatch.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __extends=this&&this.__extends||(()=>{var s=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])});return function(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}})(),__decorate=this&&this.__decorate||function(t,e,r,s){var o,n=arguments.length,p=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(t,e,r,s);else for(var a=t.length-1;0<=a;a--)(o=t[a])&&(p=(n<3?o(p):3<n?o(e,r,p):o(e,r))||p);return 3<n&&p&&Object.defineProperty(e,r,p),p},__metadata=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param=this&&this.__param||function(r,s){return function(t,e){s(t,e,r)}},data_structure_1=(Object.defineProperty(exports,"__esModule",{value:!0}),require("./data_structure")),core_1=require("./core"),message_class_1=require("./message_class"),injection_js_1=require("injection-js"),WrapperImpl=(exports.EPGM_IMPL=new injection_js_1.InjectionToken("EpgmInstance"),(()=>{function t(t,e){this.__epg=t,this.__stream=e}return t.prototype.epg=function(){return this.__epg},t.prototype.stream=function(){return this.__stream},t})()),FullSnapshotWrapper=(n=>{function t(t,e,r,s){var o=n.call(this,t,e)||this;return o._epg=t,o._stream=e,o._epd=r,o.fullSnapshot=s,o}return __extends(t,n),t.prototype.epg=function(){return this._epg},t.prototype.stream=function(){return this._stream},t.prototype.epd=function(){return this._epd},t.prototype.process=function(){this._epd.readyToDispatch();var t=this._epg.generateFull(this);if(null!=t)for(var e=0;e<t.length;e++){var r=t[e];this._epd.submit(r)}},t.prototype.getFullSnapshot=function(){return this.fullSnapshot},t.prototype.setFullSnapshot=function(t){this.fullSnapshot=t},t})(exports.WrapperImpl=WrapperImpl),PartialSnapshotWrapper=(exports.FullSnapshotWrapper=FullSnapshotWrapper,(o=>{function t(t,e,r){var s=o.call(this,e,r)||this;return s._delta=t,s._epg=e,s._stream=r,s}return __extends(t,o),t.prototype.epg=function(){return this._epg},t.prototype.stream=function(){return this._stream},t.prototype.delta=function(){return this._delta},t.prototype.process=function(){for(var t=this._epg.generatePartial(this),e=this._epg.getEPDs(this._stream),r=0;r<e.length;r++)for(var s,o=e[r],n=0;n<t.length;n++)o.isReadyToDispatch()&&(s=t[n],o.submit(s))},t})(WrapperImpl)),IndicatorWrapper=(exports.PartialSnapshotWrapper=PartialSnapshotWrapper,(o=>{function t(t,e,r){var s=o.call(this,e,r)||this;return s._delta=t,s._epg=e,s._stream=r,s}return __extends(t,o),t.prototype.process=function(){for(var t=this._epg.getEPDs(this._stream),e=0;e<t.length;e++)t[e].submit(this._delta)},t})(WrapperImpl)),EPDispatcherException=(exports.IndicatorWrapper=IndicatorWrapper,(e=>{function t(t){return e.call(this,t)||this}return __extends(t,e),t})(Error)),EndPointGroupManager=(exports.EPDispatcherException=EPDispatcherException,(()=>{function t(t,e){this._fsRepo=t,this._grp=e,this.relayEPG=new RelayEPG(e),this.relayEPG.startGetingDeltaSnapshot(t)}return t.prototype.fsRepo=function(){return this._fsRepo},t.prototype.grp=function(){return this._grp},t.prototype.pushFullSnapshotWrapper=function(e,r){var s=this,o=r.stream();r.isInitialized().then(function(t){t&&(t=s._fsRepo.getSnapshot(o),t=new FullSnapshotWrapper(e,o,r,t),e.submitForProcess(t))})},t.prototype.registerEPD=function(t){if(this.relayEPG.hasEPD(t.stream(),t.id()))throw new EPDispatcherException("EPD already exists in a group.Id: "+t.id+" Stream: "+t.stream);this.relayEPG.addEPD(t),this.pushFullSnapshotWrapper(this.relayEPG,t)},t.prototype.deregisterEPD=function(t){this.relayEPG.removeEPD(t)},__decorate([injection_js_1.Injectable(),__param(0,injection_js_1.Inject(core_1.FSREPO_IMPL)),__metadata("design:paramtypes",[Object,message_class_1.SportsFeedMessageGroup])],t)})()),DispatchersGroup=(exports.EndPointGroupManager=EndPointGroupManager,(()=>{function t(t){this.streamName=t,this.dispatchers={}}return t.prototype.addEpd=function(t){this.dispatchers[t.id()]=t},t.prototype.removeEpd=function(t){var e=this.dispatchers[t.id()];return delete this.dispatchers[t.id()],e},t.prototype.get=function(t){return this.dispatchers[t]},t.prototype.getAll=function(){var e=this;return Object.keys(this.dispatchers).map(function(t){return e.dispatchers[t]})},t.prototype.isEmpty=function(){return 0==Object.keys(this.dispatchers).length},t})()),AbstractEPG=(exports.DispatchersGroup=DispatchersGroup,(()=>{function t(t){this.sportsFeedGroup=t,this.dispatchers={}}return t.prototype.hasEPD=function(t,e){t=this.dispatchers[t];return void 0!==t&&void 0!==t.get(e)},t.prototype.addEPD=function(t){void 0===this.dispatchers[t.stream()]&&(this.dispatchers[t.stream()]=new DispatchersGroup(t.stream())),this.dispatchers[t.stream()].addEpd(t)},t.prototype.removeEPD=function(t){var e=this.dispatchers[t.stream()];void 0!==e&&(e.removeEpd(t),e.isEmpty())&&delete this.dispatchers[t.stream()]},t.prototype.isEmpty=function(){return 0==Object.keys(this.dispatchers).length},t.prototype.getEPDs=function(t){t=this.dispatchers[t];return void 0!==t?t.getAll():[]},t.prototype.getStreams=function(){return Object.keys(this.dispatchers)},t.prototype.startGetingDeltaSnapshot=function(t){t.registerSnapshotHandler(this)},t.prototype.stopGetingDeltaSnapshot=function(t){t.deRegisterSnapshotHandler(this)},t.prototype.process=function(t,e){var r;this.sportsFeedGroup.isIndicatorMessage(e.msgType())?(r=new IndicatorWrapper(e,this,t),this.submitForProcess(r)):(r=new PartialSnapshotWrapper(e,this,t),this.submitForProcess(r))},t.prototype.getSportsFeedGrp=function(){return this.sportsFeedGroup},t.prototype.generateFull=function(t){throw new Error("Method not implemented.")},t.prototype.generatePartial=function(t){throw new Error("Method not implemented.")},t})()),RelayEPG=(r=>{function t(t){var e=r.call(this,t)||this;return e._sportsFeedGroup=t,e}return __extends(t,r),t.prototype.submitForProcess=function(t){t.process()},t.prototype.onException=function(t){return console.error("Exception when dispatching snapshots to EPDs from RelayEPG. ",t),null},t.prototype.generateFull=function(t){t=t.getFullSnapshot();return[new data_structure_1.OutgoingImpl(this._sportsFeedGroup.FULLSNAPSHOT_START(),new Object),new data_structure_1.DeltaOutgoingImpl(this._sportsFeedGroup.DATA_RESET(),t,t,data_structure_1.IndexedSnapshotImpl.EMPTY_SNAPSHOT),new data_structure_1.DeltaOutgoingImpl(this._sportsFeedGroup.DATA_INSERT_MATCH(),t,t,data_structure_1.IndexedSnapshotImpl.EMPTY_SNAPSHOT),new data_structure_1.DeltaOutgoingImpl(this._sportsFeedGroup.DATA_INSERT_EVENT(),t,t,data_structure_1.IndexedSnapshotImpl.EMPTY_SNAPSHOT),new data_structure_1.DeltaOutgoingImpl(this._sportsFeedGroup.DATA_INSERT_ODD(),t,t,data_structure_1.IndexedSnapshotImpl.EMPTY_SNAPSHOT),new data_structure_1.OutgoingImpl(this._sportsFeedGroup.FULLSNAPSHOT_END(),new Object)]},t.prototype.generatePartial=function(t){t=t.delta();return"TTLOutgoing"==t.constructor.name?this.generateTtl(t):[t]},t.prototype.generateTtl=function(t){return this.isSameFormat(t.msgType(),this._sportsFeedGroup.ADMIN_REFRESH())?[]:t.getTtlType()==core_1.TTLType.REMOVE?[t]:this.generateTtlRestore(t)},t.prototype.generateTtlRestore=function(t){return[new data_structure_1.DeltaOutgoingImpl(this._sportsFeedGroup.DATA_INSERT_MATCH(),t.delta(),t.delta(),data_structure_1.IndexedSnapshotImpl.EMPTY_SNAPSHOT),new data_structure_1.DeltaOutgoingImpl(this._sportsFeedGroup.DATA_INSERT_EVENT(),t.delta(),t.delta(),data_structure_1.IndexedSnapshotImpl.EMPTY_SNAPSHOT),new data_structure_1.DeltaOutgoingImpl(this._sportsFeedGroup.DATA_INSERT_ODD(),t.delta(),t.delta(),data_structure_1.IndexedSnapshotImpl.EMPTY_SNAPSHOT)]},t.prototype.isSameFormat=function(t,e){return t.instanceClass()==e.instanceClass()&&t.constructor.name==e.constructor.name},__decorate([injection_js_1.Injectable(),__metadata("design:paramtypes",[message_class_1.SportsFeedMessageGroup])],t)})(exports.AbstractEPG=AbstractEPG);exports.RelayEPG=RelayEPG;
|
package/lib/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from "./basketball_codec";
|
|
2
|
-
export * from "./client";
|
|
3
|
-
export * from "./codec";
|
|
4
|
-
export * from "./core";
|
|
5
|
-
export * from "./data_structure";
|
|
6
|
-
export * from "./dispatch";
|
|
7
|
-
export * from "./message_class";
|
|
8
|
-
export * from "./module";
|
|
9
|
-
export * from "./receive";
|
|
10
|
-
export * from "./soccer_codec";
|
|
11
|
-
export * from "./tennis_codec";
|
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function __export(e){for(var r in e)exports.hasOwnProperty(r)||(exports[r]=e[r])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(require("./basketball_codec")),__export(require("./client")),__export(require("./codec")),__export(require("./core")),__export(require("./data_structure")),__export(require("./dispatch")),__export(require("./message_class")),__export(require("./module")),__export(require("./receive")),__export(require("./soccer_codec")),__export(require("./tennis_codec"));
|
package/lib/merge.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IndexedSnapshot, Incoming, MessageBeforeTransform, MergeableWrapper } from './data_structure';
|
|
2
|
-
import { SportsFeedMessageGroup } from './message_class';
|
|
3
|
-
import { IMessageClass } from '@jayesol/jayeson.lib.delivery';
|
|
4
|
-
import { IBetMatch, PartitionKey } from '@longchau/jayeson.lib.record';
|
|
5
|
-
import * as Collections from 'typescript-collections';
|
|
6
|
-
export declare enum MsgType {
|
|
7
|
-
INSERT = 0,
|
|
8
|
-
UPDATE = 1,
|
|
9
|
-
DELETE = 2
|
|
10
|
-
}
|
|
11
|
-
export declare class SnapshotUtil {
|
|
12
|
-
private static readonly SPORTS_GROUP;
|
|
13
|
-
static combineSnapshots(msgType: IMessageClass, childSs: IndexedSnapshot, parentSs: IndexedSnapshot): MessageBeforeTransform;
|
|
14
|
-
static processRefresh(childSs: IndexedSnapshot, parentSs: IndexedSnapshot): MessageBeforeTransform;
|
|
15
|
-
static processReset(childSs: IndexedSnapshot, parentSs: IndexedSnapshot): MessageBeforeTransform;
|
|
16
|
-
static processMatches(msgType: MsgType, childSs: IndexedSnapshot, parentSs: IndexedSnapshot): MessageBeforeTransform;
|
|
17
|
-
static processEvents(msgType: MsgType, childSs: IndexedSnapshot, parentSs: IndexedSnapshot): MessageBeforeTransform;
|
|
18
|
-
static processOdds(msgType: MsgType, childSs: IndexedSnapshot, parentSs: IndexedSnapshot): MessageBeforeTransform;
|
|
19
|
-
}
|
|
20
|
-
export declare class DeltaTransformingLogicImpl {
|
|
21
|
-
static transform(sportsGrp: SportsFeedMessageGroup, stream: string, msgType: IMessageClass, delta: IndexedSnapshot, msgBefore: MessageBeforeTransform): Incoming[];
|
|
22
|
-
static combineEventState(msgBefore: MessageBeforeTransform, sportsGrp: SportsFeedMessageGroup, msgType: IMessageClass, stream: string, delta: IndexedSnapshot, msg: Incoming[]): Incoming[];
|
|
23
|
-
static suppressInsertEvent(msgBefore: MessageBeforeTransform, sportsGrp: SportsFeedMessageGroup, msgType: IMessageClass, stream: string, delta: IndexedSnapshot, msg: Incoming[]): Incoming[];
|
|
24
|
-
static transformTTLRestore(ttlRestoredList: IndexedSnapshot[], grp: SportsFeedMessageGroup, stream: string, before: IndexedSnapshot, after: IndexedSnapshot, matches: {
|
|
25
|
-
[sport: number]: IBetMatch[];
|
|
26
|
-
}, restoredKeys: Collections.Dictionary<PartitionKey, number>): MergeableWrapper;
|
|
27
|
-
static transformTTLRemove(ttlRemoveList: IndexedSnapshot[], grp: SportsFeedMessageGroup, stream: string, before: IndexedSnapshot, after: IndexedSnapshot, keysRemoved: Collections.Dictionary<PartitionKey, number>): MergeableWrapper;
|
|
28
|
-
static breakdownTTL(grp: SportsFeedMessageGroup, stream: string, restoredSS: IndexedSnapshot): Incoming[];
|
|
29
|
-
static breakdownReset(grp: SportsFeedMessageGroup, stream: string, removeSs: IndexedSnapshot): Incoming[];
|
|
30
|
-
static suppressInsertMatch(msgBefore: MessageBeforeTransform, sportsGrp: SportsFeedMessageGroup, msgType: IMessageClass, stream: string, delta: IndexedSnapshot, msg: Incoming[]): Incoming[];
|
|
31
|
-
static suppressDeleteEvent(msgBefore: MessageBeforeTransform, sportsGrp: SportsFeedMessageGroup, msgType: IMessageClass, stream: string, delta: IndexedSnapshot, msg: Incoming[]): Incoming[];
|
|
32
|
-
static suppressDeleteMatch(msgBefore: MessageBeforeTransform, sportsGrp: SportsFeedMessageGroup, msgType: IMessageClass, stream: string, delta: IndexedSnapshot, msg: Incoming[]): Incoming[];
|
|
33
|
-
}
|
package/lib/merge.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0});var MsgType,data_structure_1=require("./data_structure"),message_class_1=require("./message_class"),mutable_1=require("./mutable"),core_1=require("./core"),data_structure_2=require("./data_structure"),SnapshotUtil=((e=>{e[e.INSERT=0]="INSERT",e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"})(MsgType=exports.MsgType||(exports.MsgType={})),(()=>{function s(){}return s.combineSnapshots=function(e,t,r){var a;if(e.group().id()!=s.SPORTS_GROUP.id())return console.error("FATAL: Received non feed message group's class %s.Shouldnt come here",e),(a=new data_structure_1.MessageBeforeTransform).setAfterSs(r),a;switch(e.id()){case s.SPORTS_GROUP.DATA_INSERT_MATCH().id():return s.processMatches(MsgType.INSERT,t,r);case s.SPORTS_GROUP.DATA_UPDATE_MATCH().id():return s.processMatches(MsgType.UPDATE,t,r);case s.SPORTS_GROUP.DATA_DELETE_MATCH().id():return s.processMatches(MsgType.DELETE,t,r);case s.SPORTS_GROUP.DATA_INSERT_EVENT().id():return s.processEvents(MsgType.INSERT,t,r);case s.SPORTS_GROUP.DATA_UPDATE_EVENT().id():return s.processEvents(MsgType.UPDATE,t,r);case s.SPORTS_GROUP.DATA_DELETE_EVENT().id():return s.processEvents(MsgType.DELETE,t,r);case s.SPORTS_GROUP.DATA_INSERT_ODD().id():return s.processOdds(MsgType.INSERT,t,r);case s.SPORTS_GROUP.DATA_UPDATE_ODD().id():return s.processOdds(MsgType.UPDATE,t,r);case s.SPORTS_GROUP.DATA_DELETE_ODD().id():return s.processOdds(MsgType.DELETE,t,r);case s.SPORTS_GROUP.DATA_RESET().id():return s.processReset(t,r);case s.SPORTS_GROUP.ADMIN_REFRESH().id():return s.processRefresh(t,r);default:return console.error("FATAL: Received non data message class %s.Shouldnt come here",e),(a=new data_structure_1.MessageBeforeTransform).setAfterSs(r),a}},s.processRefresh=function(e,t){for(var r=mutable_1.BuilderProvider.getSnapshotBuilder(t),t=new data_structure_1.MessageBeforeTransform,a=0,s=e.getPartitions().toArray();a<s.length;a++){var n=s[a],i=e.getPartitionMap().getValue(n);r.markPartitionAsUpdated(n,i)}return t.setAfterSs(r.build()),t},s.processReset=function(e,t){for(var r=mutable_1.BuilderProvider.getSnapshotBuilder(t),t=new data_structure_1.MessageBeforeTransform,a=0,s=e.getPartitions().toArray();a<s.length;a++){var n=s[a],i=(r.reset(n),e.getPartitionMap().getValue(n));r.markPartitionAsUpdated(n,i)}return t.setAfterSs(r.build()),t},s.processMatches=function(e,t,r){for(var a=mutable_1.BuilderProvider.getSnapshotBuilder(r),s=new data_structure_1.MessageBeforeTransform,n=null,i=0,l=t.matches();i<l.length;i++){var u=l[i],n=null;switch(e){case MsgType.INSERT:null!=(n=a.insertChild(u))?s.setSuppressMatch(n):s.setInsertMatch(u.id());break;case MsgType.UPDATE:a.updateChild(u);break;case MsgType.DELETE:null!=(n=a.deleteChild(u))?s.setSuppressMatch(n):s.setDeleteMatch(u.id());break;default:console.error("[Match] FATAL: Shouldn't come here")}}for(var d=0,o=t.getPartitions().toArray();d<o.length;d++){var c=o[d],h=t.getPartitionMap().getValue(c);a.markPartitionAsUpdated(c,h)}return s.setAfterSs(a.build()),s},s.processEvents=function(e,t,r){for(var a=mutable_1.BuilderProvider.getSnapshotBuilder(r),s=new data_structure_1.MessageBeforeTransform,n=0,i=t.matches();n<i.length;n++){var l=i[n],u=r.match(l.id());if(null==u)console.error("Cannot find Match %s while processing %s",l.id(),MsgType);else{for(var d=mutable_1.BuilderProvider.getMatchBuilder(u),o=0,c=l.events();o<c.length;o++){var h=c[o];switch(e){case MsgType.INSERT:null!=d.insertChild(h)?s.setTransformEvent(h.matchId()+"_"+h.id()):s.setInsertEvent(h.matchId()+"_"+h.id());break;case MsgType.UPDATE:d.updateChild(h);break;case MsgType.DELETE:null!=d.deleteChild(h)?s.setTransformEvent(h.matchId()+"_"+h.id()):s.setDeleteEvent(h.matchId()+"_"+h.id());break;default:console.error("[Event] FATAL: Shouldn't come here")}}a.replaceMatch(d.build())}}for(var _=0,g=t.getPartitions().toArray();_<g.length;_++){var T=g[_],p=t.getPartitionMap().getValue(T);a.markPartitionAsUpdated(T,p)}return s.setAfterSs(a.build()),s.setBeforeSs(r),s},s.processOdds=function(e,t,r){for(var a=mutable_1.BuilderProvider.getSnapshotBuilder(r),s=new data_structure_1.MessageBeforeTransform,n=0,i=t.matches();n<i.length;n++){var l=i[n],u=r.match(l.id());if(null==u)console.error("Cannot find Match %s while processing %s",l.id(),e);else{for(var d=mutable_1.BuilderProvider.getMatchBuilder(u),o=0,c=l.events();o<c.length;o++){var h=c[o],_=u.event(h.id());if(null==_)console.error("Cannot find Event %s_%s while processing %s",l.id(),h.id(),e);else{for(var g=mutable_1.BuilderProvider.getEventBuilder(_),T=0,p=h.records();T<p.length;T++){var E=p[T];switch(e){case MsgType.INSERT:g.insertChild(E);break;case MsgType.UPDATE:g.updateChild(E);break;case MsgType.DELETE:g.deleteChild(E);break;default:console.error("[Record] FATAL: Shouldn't come here")}}d.replaceEvent(g.build())}}a.replaceMatch(d.build())}}for(var v=0,m=t.getPartitions().toArray();v<m.length;v++){var A=m[v],S=t.getPartitionMap().getValue(A);a.markPartitionAsUpdated(A,S)}return s.setAfterSs(a.build()),s},s.SPORTS_GROUP=new message_class_1.SportsFeedMessageGroup,s})()),DeltaTransformingLogicImpl=(exports.SnapshotUtil=SnapshotUtil,(()=>{function f(){}return f.transform=function(e,t,r,a,s){switch(r.id()){case e.DATA_INSERT_MATCH().id():return this.suppressInsertMatch(s,e,r,t,a,[]);case e.DATA_DELETE_MATCH().id():return this.suppressDeleteMatch(s,e,r,t,a,[]);case e.DATA_INSERT_EVENT().id():return this.suppressInsertEvent(s,e,r,t,a,[]);case e.DATA_DELETE_EVENT().id():return this.suppressDeleteEvent(s,e,r,t,a,[]);case e.DATA_UPDATE_EVENT().id():return this.combineEventState(s,e,r,t,a,[])}var n=[];return n.push(new data_structure_1.Incoming(r,t,a)),n},f.combineEventState=function(e,t,r,a,s,n){for(var i=mutable_1.BuilderProvider.getSnapshotBuilder(s),l=0,u=s.matches();l<u.length;l++){for(var d=u[l],o=mutable_1.BuilderProvider.getMatchBuilder(d),c=0,h=d.events();c<h.length;c++){var _=h[c],g=mutable_1.BuilderProvider.getEventBuilder(_);g.aggregateInsert(e.getAfterSs().match(d.id()).event(_.id())),o.replaceEvent(g.build())}i.replaceMatch(o.build())}return n.push(new data_structure_1.Incoming(t.DATA_UPDATE_EVENT(),a,i.build())),n},f.suppressInsertEvent=function(e,t,r,a,s,n){var i=mutable_1.BuilderProvider.getSnapshotBuilder(s),l=mutable_1.BuilderProvider.getSnapshotBuilder(s);if(0!=s.matches().length){if(0!=e.getInsertEvent().length){for(var u={},d=0,o=e.getTransformEvent();d<o.length;d++){var c=(S=o[d]).split("_")[0],h=S.split("_")[1],_=s.match(c),g=u[c];void 0===g&&(g=mutable_1.BuilderProvider.getMatchBuilder(_),u[c]=g),g.deleteChild(_.event(h))}for(c in u)i.replaceMatch(u[c].build());n.push(new data_structure_1.Incoming(t.DATA_INSERT_EVENT(),a,i.build()))}if(0!=e.getTransformEvent().length){for(var T={},p=0,E=e.getInsertEvent();p<E.length;p++){var c=(S=E[p]).split("_")[0],h=S.split("_")[1],_=s.match(c),v=T[c];void 0===v&&(v=mutable_1.BuilderProvider.getMatchBuilder(_),T[c]=v),v.deleteChild(_.event(h))}for(var m=0,A=e.getTransformEvent();m<A.length;m++){var S,c=(S=A[m]).split("_")[0],h=S.split("_")[1],_=s.match(c),f=T[c],b=(void 0===f&&(f=mutable_1.BuilderProvider.getMatchBuilder(_),T[c]=f),mutable_1.BuilderProvider.getEventBuilder(_.event(h)));b.aggregateInsert(e.getAfterSs().match(c).event(h)),f.replaceEvent(b.build())}for(c in T)l.replaceMatch(T[c].build());n.push(new data_structure_1.Incoming(t.DATA_UPDATE_EVENT(),a,l.build()))}}return n},f.transformTTLRestore=function(e,t,r,a,s,n,i){for(var l=data_structure_2.IndexedSnapshotImpl.EMPTY_SNAPSHOT,u=new data_structure_1.MergeableWrapper,d=0,o=e;d<o.length;d++){var c=o[d],l=SnapshotUtil.combineSnapshots(t.DATA_INSERT_MATCH(),c,l).getAfterSs();l=SnapshotUtil.combineSnapshots(t.DATA_INSERT_EVENT(),c,l).getAfterSs(),l=SnapshotUtil.combineSnapshots(t.DATA_INSERT_ODD(),c,l).getAfterSs()}for(var h=a,_=[],g=0,T=this.breakdownTTL(t,r,new data_structure_2.IndexedSnapshotImpl(l.matchesSport,i));g<T.length;g++){var p=T[g],E=SnapshotUtil.combineSnapshots(p.msgType(),p.data(),h);if(p.msgType().id()==t.DATA_INSERT_MATCH().id()||p.msgType().id()==t.DATA_INSERT_EVENT().id())for(var v=0,m=f.transform(t,r,p.msgType(),p.data(),E);v<m.length;v++){var A=m[v],S=new core_1.Delta(A,E.getAfterSs(),h);_.push(S),h=E.getAfterSs()}else{S=new core_1.Delta(p,E.getAfterSs(),a);_.push(S)}}return u.setAfter(s),u.setDeltaOut(_),u},f.transformTTLRemove=function(e,t,r,a,s,n){for(var i=new data_structure_1.MergeableWrapper,l=data_structure_2.IndexedSnapshotImpl.EMPTY_SNAPSHOT,u=0,d=e;u<d.length;u++){var o=d[u],l=SnapshotUtil.combineSnapshots(t.DATA_INSERT_MATCH(),o,l).getAfterSs();l=SnapshotUtil.combineSnapshots(t.DATA_INSERT_EVENT(),o,l).getAfterSs(),l=SnapshotUtil.combineSnapshots(t.DATA_INSERT_ODD(),o,l).getAfterSs()}for(var c=a,h=[],_=0,g=f.breakdownReset(t,r,l);_<g.length;_++){var T=g[_],p=SnapshotUtil.combineSnapshots(T.msgType(),T.data(),c);if(T.msgType().id()==t.DATA_DELETE_MATCH().id()||T.msgType().id()==t.DATA_DELETE_EVENT().id())for(var E=0,v=f.transform(t,r,T.msgType(),T.data(),p);E<v.length;E++){var m=v[E],A=new core_1.Delta(m,p.getAfterSs(),c);h.push(A),c=p.getAfterSs()}else{A=new core_1.Delta(T,p.getAfterSs(),a);h.push(A)}}return i.setDeltaOut(h),i.setAfter(s),i},f.breakdownTTL=function(e,t,r){data_structure_2.IndexedSnapshotImpl.EMPTY_SNAPSHOT,data_structure_2.IndexedSnapshotImpl.EMPTY_SNAPSHOT;for(var a=mutable_1.BuilderProvider.getSnapshotBuilder(r),s=mutable_1.BuilderProvider.getSnapshotBuilder(r),n=0,i=r.matches();n<i.length;n++){for(var l=i[n],u=mutable_1.BuilderProvider.getMatchBuilder(l),d=mutable_1.BuilderProvider.getMatchBuilder(l),o=0,c=l.events();o<c.length;o++){for(var h=c[o],_=(u.deleteChild(h),mutable_1.BuilderProvider.getEventBuilder(h)),g=0,T=h.records();g<T.length;g++){var p=T[g];_.deleteChild(p)}d.replaceEvent(_.build())}a.replaceMatch(u.build()),s.replaceMatch(d.build())}var E=a.build(),v=s.build(),m=[];return m.push(new data_structure_1.Incoming(e.DATA_INSERT_MATCH(),t,E)),m.push(new data_structure_1.Incoming(e.DATA_INSERT_EVENT(),t,v)),m.push(new data_structure_1.Incoming(e.DATA_INSERT_ODD(),t,r)),m},f.breakdownReset=function(e,t,r){data_structure_2.IndexedSnapshotImpl.EMPTY_SNAPSHOT,data_structure_2.IndexedSnapshotImpl.EMPTY_SNAPSHOT;for(var a=mutable_1.BuilderProvider.getSnapshotBuilder(r),s=mutable_1.BuilderProvider.getSnapshotBuilder(r),n=0,i=r.matches();n<i.length;n++){for(var l=i[n],u=mutable_1.BuilderProvider.getMatchBuilder(l),d=mutable_1.BuilderProvider.getMatchBuilder(l),o=0,c=l.events();o<c.length;o++){for(var h=c[o],_=(u.deleteChild(h),mutable_1.BuilderProvider.getEventBuilder(h)),g=0,T=h.records();g<T.length;g++){var p=T[g];_.deleteChild(p)}d.replaceEvent(_.build())}a.replaceMatch(u.build()),s.replaceMatch(d.build())}var E=a.build(),v=s.build(),m=[];return m.push(new data_structure_1.Incoming(e.DATA_DELETE_ODD(),t,r)),m.push(new data_structure_1.Incoming(e.DATA_DELETE_EVENT(),t,v)),m.push(new data_structure_1.Incoming(e.DATA_DELETE_MATCH(),t,E)),m},f.suppressInsertMatch=function(e,t,r,a,s,n){var i=mutable_1.BuilderProvider.getSnapshotBuilder(s),l=mutable_1.BuilderProvider.getSnapshotBuilder(s);if(0!=e.getSuppressMatch().length)for(var u=0,d=e.getSuppressMatch();u<d.length;u++){var o=d[u],c=mutable_1.BuilderProvider.getMatchBuilder(s.match(o.split("_")[0]));i.deleteChild(c.build())}if(0!=e.getInsertMatch().length)for(var h=0,_=e.getInsertMatch();h<_.length;h++){o=_[h],c=mutable_1.BuilderProvider.getMatchBuilder(s.match(o.split("_")[0]));l.deleteChild(c.build())}return 0!=i.build().matches().length&&n.push(new data_structure_1.Incoming(t.DATA_INSERT_MATCH(),a,i.build())),n},f.suppressDeleteEvent=function(e,t,r,a,s,n){var i=mutable_1.BuilderProvider.getSnapshotBuilder(s),l=mutable_1.BuilderProvider.getSnapshotBuilder(s);if(0!=e.getDeleteEvent().length){for(var u={},d=0,o=e.getTransformEvent();d<o.length;d++){var c=(S=o[d]).split("_")[0],h=S.split("_")[1],_=e.getBeforeSs().match(c),g=u[c];void 0===g&&(g=mutable_1.BuilderProvider.getMatchBuilder(_),u[c]=g),g.deleteChild(_.event(h))}for(c in u)i.replaceMatch(u[c].build());n.push(new data_structure_1.Incoming(t.DATA_DELETE_EVENT(),a,i.build()))}if(0!=e.getTransformEvent().length){for(var T={},p=0,E=e.getDeleteEvent();p<E.length;p++){var c=(S=E[p]).split("_")[0],h=S.split("_")[1],_=e.getBeforeSs().match(c),v=T[c];void 0===v&&(v=mutable_1.BuilderProvider.getMatchBuilder(_),T[c]=v),v.deleteChild(_.event(h))}for(var m=0,A=e.getTransformEvent();m<A.length;m++){var S,c=(S=A[m]).split("_")[0],h=S.split("_")[1],f=T[c],b=(void 0===f&&(f=mutable_1.BuilderProvider.getMatchBuilder(e.getBeforeSs().match(c)),T[c]=f),mutable_1.BuilderProvider.getEventBuilder(f.build().event(h)));b.aggregateDelete(s.match(c).event(h)),f.replaceEvent(b.build())}for(c in T)l.replaceMatch(T[c].build());n.push(new data_structure_1.Incoming(t.DATA_UPDATE_EVENT(),a,l.build()))}return n},f.suppressDeleteMatch=function(e,t,r,a,s,n){var i=mutable_1.BuilderProvider.getSnapshotBuilder(s),l=mutable_1.BuilderProvider.getSnapshotBuilder(s);if(0!=e.getSuppressMatch().length)for(var u=0,d=e.getSuppressMatch();u<d.length;u++){var o=d[u],c=mutable_1.BuilderProvider.getMatchBuilder(s.match(o.split("_")[0]));i.deleteChild(c.build())}if(0!=e.getDeleteMatch().length)for(var h=0,_=e.getDeleteMatch();h<_.length;h++){o=_[h],c=mutable_1.BuilderProvider.getMatchBuilder(s.match(o.split("_")[0]));l.deleteChild(c.build())}return 0!=i.build().matches().length&&n.push(new data_structure_1.Incoming(t.DATA_DELETE_MATCH(),a,i.build())),n},f})());exports.DeltaTransformingLogicImpl=DeltaTransformingLogicImpl;
|
package/lib/message_class.d.ts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import deliver = require('@jayesol/jayeson.lib.delivery');
|
|
2
|
-
import { PartitionKey, SportType, IBetMatch } from '@longchau/jayeson.lib.record';
|
|
3
|
-
import * as proto from './protobuf_bundle';
|
|
4
|
-
import * as Collections from 'typescript-collections';
|
|
5
|
-
import { ICodec } from './codec';
|
|
6
|
-
export declare abstract class AbstractMessageClass extends deliver.IMessageClass {
|
|
7
|
-
private _msgGroup;
|
|
8
|
-
private _id;
|
|
9
|
-
private _instanceClass;
|
|
10
|
-
private _sportCodecs;
|
|
11
|
-
private _partitionCodec;
|
|
12
|
-
constructor(_msgGroup: deliver.IMessageGroup, _id: number, _instanceClass: any, _sportCodecs: SportsCodecs, _partitionCodec: PartitionCodec);
|
|
13
|
-
id(): number;
|
|
14
|
-
SportsFeedMessageGroup(): deliver.IMessageGroup;
|
|
15
|
-
instanceClass(): any;
|
|
16
|
-
sportCodecs(): SportsCodecs;
|
|
17
|
-
partitionCodec(): PartitionCodec;
|
|
18
|
-
abstract read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
19
|
-
private unpack;
|
|
20
|
-
inHandlers(): deliver.MsgHandler[];
|
|
21
|
-
outHandlers(): deliver.MsgHandler[];
|
|
22
|
-
private asSportType;
|
|
23
|
-
}
|
|
24
|
-
export declare class FilterMessageClass extends deliver.JSonMessageClass {
|
|
25
|
-
constructor(msgGroup: deliver.IMessageGroup, id: number);
|
|
26
|
-
}
|
|
27
|
-
export declare class SportsCodecs {
|
|
28
|
-
readonly sportsMappings: Collections.Dictionary<SportType, ICodec>;
|
|
29
|
-
constructor(sportsMappings?: Collections.Dictionary<SportType, ICodec>);
|
|
30
|
-
getCodec(sportType: SportType): ICodec;
|
|
31
|
-
}
|
|
32
|
-
export declare class PartitionCodec {
|
|
33
|
-
decode(key: proto.PartitionKey, pool: string[]): PartitionKey;
|
|
34
|
-
}
|
|
35
|
-
export declare class InsertMatchMessageClass extends AbstractMessageClass {
|
|
36
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
37
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
38
|
-
}
|
|
39
|
-
export declare class InsertEventMessageClass extends AbstractMessageClass {
|
|
40
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
41
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
42
|
-
}
|
|
43
|
-
export declare class InsertOddMessageClass extends AbstractMessageClass {
|
|
44
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
45
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
46
|
-
}
|
|
47
|
-
export declare class UpdateMatchMessageClass extends AbstractMessageClass {
|
|
48
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
49
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
50
|
-
}
|
|
51
|
-
export declare class UpdateEventMessageClass extends AbstractMessageClass {
|
|
52
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
53
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
54
|
-
}
|
|
55
|
-
export declare class UpdateOddMessageClass extends AbstractMessageClass {
|
|
56
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
57
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
58
|
-
}
|
|
59
|
-
export declare class DeleteMatchMessageClass extends AbstractMessageClass {
|
|
60
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
61
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
62
|
-
}
|
|
63
|
-
export declare class DeleteEventMessageClass extends AbstractMessageClass {
|
|
64
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
65
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
66
|
-
}
|
|
67
|
-
export declare class DeleteOddMessageClass extends AbstractMessageClass {
|
|
68
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
69
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
70
|
-
}
|
|
71
|
-
export declare class ResetMessageClass extends AbstractMessageClass {
|
|
72
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
73
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
74
|
-
}
|
|
75
|
-
export declare class TTLRemoveMessageClass extends AbstractMessageClass {
|
|
76
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
77
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
78
|
-
}
|
|
79
|
-
export declare class TTLRestoreMessageClass extends AbstractMessageClass {
|
|
80
|
-
constructor(group: deliver.IMessageGroup, id: number, sportCodec: SportsCodecs, partitionCodec: PartitionCodec);
|
|
81
|
-
read(msg: proto.DataMessage, codec: ICodec, pool: string[], key: PartitionKey): IBetMatch[];
|
|
82
|
-
}
|
|
83
|
-
export declare class SwitchFilterStartMessageClass extends deliver.EmptyMessageClass {
|
|
84
|
-
constructor(group: deliver.IMessageGroup, id: number);
|
|
85
|
-
}
|
|
86
|
-
export declare class SwitchFilterEndMessageClass extends deliver.EmptyMessageClass {
|
|
87
|
-
constructor(group: deliver.IMessageGroup, id: number);
|
|
88
|
-
}
|
|
89
|
-
export declare class SwitchFilterFailMessageClass extends deliver.EmptyMessageClass {
|
|
90
|
-
constructor(group: deliver.IMessageGroup, id: number);
|
|
91
|
-
}
|
|
92
|
-
export declare class StartSubscribeFeed {
|
|
93
|
-
exclude: string[];
|
|
94
|
-
wireFormat: string;
|
|
95
|
-
constructor(exclude: string[], wireFormat: string);
|
|
96
|
-
}
|
|
97
|
-
export declare class RefreshMessageClass extends deliver.JSonMessageClass {
|
|
98
|
-
constructor(msgGroup: deliver.IMessageGroup, id: number);
|
|
99
|
-
inHandlers(): deliver.MsgHandler[];
|
|
100
|
-
private unpack;
|
|
101
|
-
}
|
|
102
|
-
export declare class SportsFeedMessageGroup extends deliver.IMessageGroup {
|
|
103
|
-
private _DATA_RESET;
|
|
104
|
-
private _DATA_INSERT_ODD;
|
|
105
|
-
private _DATA_UPDATE_ODD;
|
|
106
|
-
private _DATA_DELETE_ODD;
|
|
107
|
-
private _DATA_INSERT_EVENT;
|
|
108
|
-
private _DATA_UPDATE_EVENT;
|
|
109
|
-
private _DATA_DELETE_EVENT;
|
|
110
|
-
private _DATA_INSERT_MATCH;
|
|
111
|
-
private _DATA_UPDATE_MATCH;
|
|
112
|
-
private _DATA_DELETE_MATCH;
|
|
113
|
-
private _TTL_RESTORE;
|
|
114
|
-
private _TTL_REMOVE;
|
|
115
|
-
private _FILTER_REMOVE;
|
|
116
|
-
private _FILTER_SET;
|
|
117
|
-
private _ADMIN_START_SUBSCRIBE_FEED;
|
|
118
|
-
private _ADMIN_REFRESH;
|
|
119
|
-
private _SWITCH_FILTER_START;
|
|
120
|
-
private _SWITCH_FILTER_END;
|
|
121
|
-
private _FULLSNAPSHOT_START;
|
|
122
|
-
private _FULLSNAPSHOT_END;
|
|
123
|
-
private _SWITCH_FILTER_FAIL;
|
|
124
|
-
private _TTL_RESTORE_START;
|
|
125
|
-
private _TTL_RESTORE_END;
|
|
126
|
-
DATA_RESET(): ResetMessageClass;
|
|
127
|
-
DATA_INSERT_ODD(): InsertOddMessageClass;
|
|
128
|
-
DATA_UPDATE_ODD(): UpdateOddMessageClass;
|
|
129
|
-
DATA_DELETE_ODD(): DeleteOddMessageClass;
|
|
130
|
-
DATA_INSERT_EVENT(): InsertEventMessageClass;
|
|
131
|
-
DATA_UPDATE_EVENT(): UpdateEventMessageClass;
|
|
132
|
-
DATA_DELETE_EVENT(): DeleteEventMessageClass;
|
|
133
|
-
TTL_REMOVE(): TTLRemoveMessageClass;
|
|
134
|
-
TTL_RESTORE(): TTLRestoreMessageClass;
|
|
135
|
-
TTL_RESTORE_START(): TTLRestoreMessageClass;
|
|
136
|
-
TTL_RESTORE_END(): deliver.EmptyMessageClass;
|
|
137
|
-
DATA_INSERT_MATCH(): InsertMatchMessageClass;
|
|
138
|
-
DATA_UPDATE_MATCH(): UpdateMatchMessageClass;
|
|
139
|
-
DATA_DELETE_MATCH(): DeleteMatchMessageClass;
|
|
140
|
-
FILTER_REMOVE(): deliver.StringMessageClass;
|
|
141
|
-
FILTER_SET(): FilterMessageClass;
|
|
142
|
-
ADMIN_START_SUBSCRIBE_FEED(): deliver.JSonMessageClass;
|
|
143
|
-
ADMIN_REFRESH(): RefreshMessageClass;
|
|
144
|
-
SWITCH_FILTER_START(): deliver.StringMessageClass;
|
|
145
|
-
SWITCH_FILTER_END(): deliver.EmptyMessageClass;
|
|
146
|
-
FULLSNAPSHOT_START(): deliver.EmptyMessageClass;
|
|
147
|
-
FULLSNAPSHOT_END(): deliver.EmptyMessageClass;
|
|
148
|
-
SWITCH_FILTER_FAIL(): deliver.StringMessageClass;
|
|
149
|
-
isIndicatorMessage(messageClass: deliver.IMessageClass): boolean;
|
|
150
|
-
isSwitchFilterStatusMsg(messageClass: deliver.IMessageClass): boolean;
|
|
151
|
-
constructor(sportCodec?: SportsCodecs, partitionCodec?: PartitionCodec);
|
|
152
|
-
}
|
package/lib/message_class.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __extends=this&&this.__extends||(()=>{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)}})(),deliver=(Object.defineProperty(exports,"__esModule",{value:!0}),require("@jayesol/jayeson.lib.delivery")),jayeson_lib_record_1=require("@longchau/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=(n=>{function e(e,t,s,r,o){var a=n.call(this,e,t,s)||this;return a._msgGroup=e,a._id=t,a._instanceClass=s,a._sportCodecs=r,a._partitionCodec=o,a.unpack=function(e){var t,s,r=proto.DataMessage.decode(e.message),o=(e.message=new data_structure_1.IndexedSnapshotImpl({}),r.stringPool),n=r.feedKey;void 0!==n&&null!=(t=a.asSportType(n.sport))&&null!=(s=a._sportCodecs.getCodec(t))&&(n=a._partitionCodec.decode(new proto.PartitionKey(n),o),r=a.read(r,s,o,n),(s={})[t]=r,(o=new Collections.Dictionary).setValue(n,(new Date).getTime()),e.message=new data_structure_1.IndexedSnapshotImpl(s,o))},a}return __extends(e,n),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){e=proto.SportType[e];return jayeson_lib_record_1.SportType[e]},e})(deliver.IMessageClass),FilterMessageClass=(exports.AbstractMessageClass=AbstractMessageClass,(s=>{function e(e,t){return s.call(this,e,t,codec_1.FilterRequest)||this}return __extends(e,s),e})(deliver.JSonMessageClass)),SportsCodecs=(exports.FilterMessageClass=FilterMessageClass,(()=>{function e(e){void 0===(this.sportsMappings=e=void 0===e?void 0: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})()),PartitionCodec=(exports.SportsCodecs=SportsCodecs,(()=>{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})()),InsertMatchMessageClass=(exports.PartitionCodec=PartitionCodec,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.matches.matches.map(function(e){return new proto.BaseMatch(e)});return t.decodeMatch(e,s,codec_1.EncodeAction.INSERT,r)},e})(AbstractMessageClass)),InsertEventMessageClass=(exports.InsertMatchMessageClass=InsertMatchMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.events.events.map(function(e){return new proto.BaseEvent(e)});return t.decodeEvent(e,s,codec_1.EncodeAction.INSERT,r)},e})(AbstractMessageClass)),InsertOddMessageClass=(exports.InsertEventMessageClass=InsertEventMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.odds.odds.map(function(e){return new proto.BaseRecord(e)});return t.decodeRecord(e,s,codec_1.EncodeAction.INSERT,r)},e})(AbstractMessageClass)),UpdateMatchMessageClass=(exports.InsertOddMessageClass=InsertOddMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.matches.matches.map(function(e){return new proto.BaseMatch(e)});return t.decodeMatch(e,s,codec_1.EncodeAction.UPDATE,r)},e})(AbstractMessageClass)),UpdateEventMessageClass=(exports.UpdateMatchMessageClass=UpdateMatchMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.events.events.map(function(e){return new proto.BaseEvent(e)});return t.decodeEvent(e,s,codec_1.EncodeAction.UPDATE,r)},e})(AbstractMessageClass)),UpdateOddMessageClass=(exports.UpdateEventMessageClass=UpdateEventMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.odds.odds.map(function(e){return new proto.BaseRecord(e)});return t.decodeRecord(e,s,codec_1.EncodeAction.UPDATE,r)},e})(AbstractMessageClass)),DeleteMatchMessageClass=(exports.UpdateOddMessageClass=UpdateOddMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.matches.matches.map(function(e){return new proto.BaseMatch(e)});return t.decodeMatch(e,s,codec_1.EncodeAction.DELETE,r)},e})(AbstractMessageClass)),DeleteEventMessageClass=(exports.DeleteMatchMessageClass=DeleteMatchMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.events.events.map(function(e){return new proto.BaseEvent(e)});return t.decodeEvent(e,s,codec_1.EncodeAction.DELETE,r)},e})(AbstractMessageClass)),DeleteOddMessageClass=(exports.DeleteEventMessageClass=DeleteEventMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){e=e.odds.odds.map(function(e){return new proto.BaseRecord(e)});return t.decodeRecord(e,s,codec_1.EncodeAction.DELETE,r)},e})(AbstractMessageClass)),ResetMessageClass=(exports.DeleteOddMessageClass=DeleteOddMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){return[]},e})(AbstractMessageClass)),TTLRemoveMessageClass=(exports.ResetMessageClass=ResetMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){return[]},e})(AbstractMessageClass)),TTLRestoreMessageClass=(exports.TTLRemoveMessageClass=TTLRemoveMessageClass,(o=>{function e(e,t,s,r){return o.call(this,e,t,data_structure_1.IndexedSnapshotImpl,s,r)||this}return __extends(e,o),e.prototype.read=function(e,t,s,r){return[]},e})(AbstractMessageClass)),SwitchFilterStartMessageClass=(exports.TTLRestoreMessageClass=TTLRestoreMessageClass,(s=>{function e(e,t){return s.call(this,e,t)||this}return __extends(e,s),e})(deliver.EmptyMessageClass)),SwitchFilterEndMessageClass=(exports.SwitchFilterStartMessageClass=SwitchFilterStartMessageClass,(s=>{function e(e,t){return s.call(this,e,t)||this}return __extends(e,s),e})(deliver.EmptyMessageClass)),SwitchFilterFailMessageClass=(exports.SwitchFilterEndMessageClass=SwitchFilterEndMessageClass,(s=>{function e(e,t){return s.call(this,e,t)||this}return __extends(e,s),e})(deliver.EmptyMessageClass)),StartSubscribeFeed=(exports.SwitchFilterFailMessageClass=SwitchFilterFailMessageClass,function(e,t){this.exclude=e,this.wireFormat=t}),RefreshMessage=(exports.StartSubscribeFeed=StartSubscribeFeed,function(){}),RefreshMessageClass=(s=>{function e(e,t){e=s.call(this,e,t,RefreshMessage)||this;return e.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)},e}return __extends(e,s),e.prototype.inHandlers=function(){return s.prototype.inHandlers.call(this).concat([{unpack:this.unpack}])},e})(deliver.JSonMessageClass),SportsFeedMessageGroup=(exports.RefreshMessageClass=RefreshMessageClass,(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;
|
package/lib/module.d.ts
DELETED
package/lib/module.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0});var D=require("@jayesol/jayeson.lib.delivery"),message_class_1=require("./message_class"),receive_1=require("./receive"),core_1=require("./core"),dispatch_1=require("./dispatch"),client_1=require("./client"),SportsFeedCoreComponentModule=(()=>{function e(){}return e.getBindingArray=function(e,r,o){return void 0===o&&(o=client_1.MemoryDispatcher.MEMORY_STREAM),[{provide:message_class_1.StartSubscribeFeed,useValue:new message_class_1.StartSubscribeFeed(e=void 0===e?[]:e,r=void 0===r?"":r)},{provide:message_class_1.SportsFeedMessageGroup,useValue:new message_class_1.SportsFeedMessageGroup},D.StreamNameCode,receive_1.InEndPointEventHandler,{provide:core_1.FSRepoImpl.outputStream,useValue:o},core_1.FSRepoImpl,{provide:core_1.AbstractFSRepo,useExisting:core_1.FSRepoImpl},{provide:core_1.FSREPO_IMPL,useExisting:core_1.FSRepoImpl},dispatch_1.RelayEPG,dispatch_1.EndPointGroupManager,core_1.TTLConfig,core_1.RecycleBin,receive_1.StreamCommandProcessor,receive_1.SportsFeedInProcessor,{provide:D.IMessageGroupProcessor,useExisting:receive_1.SportsFeedInProcessor},{provide:dispatch_1.EPGM_IMPL,useExisting:dispatch_1.EndPointGroupManager},client_1.FeedView,client_1.SportsFeedClient]},e})();exports.SportsFeedCoreComponentModule=SportsFeedCoreComponentModule;
|
package/lib/mutable.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { OddType, LBType, TimeType, OddFormat, PivotBias, PivotType, StringMap, IBetEvent, IBetRecord, IBetEventState, IBetMatch, PartitionKey } from "@longchau/jayeson.lib.record";
|
|
2
|
-
import { IndexedSnapshot } from "./data_structure";
|
|
3
|
-
export interface ObjectMap<T> {
|
|
4
|
-
[index: string]: T;
|
|
5
|
-
}
|
|
6
|
-
export interface Aggregatable<T> {
|
|
7
|
-
aggregateInsert(t: T): any;
|
|
8
|
-
aggregateUpdate(t: T): any;
|
|
9
|
-
aggregateDelete(t: T): boolean;
|
|
10
|
-
isEmpty(): boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface Buildable<T> {
|
|
13
|
-
build(): T;
|
|
14
|
-
}
|
|
15
|
-
export interface Mergeable<T> {
|
|
16
|
-
merge(t: T): any;
|
|
17
|
-
}
|
|
18
|
-
export interface ParentOf<T> {
|
|
19
|
-
insertChild(t: T): string;
|
|
20
|
-
updateChild(t: T): any;
|
|
21
|
-
deleteChild(t: T): string;
|
|
22
|
-
}
|
|
23
|
-
export interface IIndexedSnapshotBuilder extends ParentOf<IBetMatch>, Buildable<IndexedSnapshot> {
|
|
24
|
-
reset(key: PartitionKey): IIndexedSnapshotBuilder;
|
|
25
|
-
markPartitionAsUpdated(key: PartitionKey, time?: number): any;
|
|
26
|
-
replaceMatch(build: IBetMatch): any;
|
|
27
|
-
}
|
|
28
|
-
export interface IBetMatchBuilder extends Aggregatable<IBetMatch>, ParentOf<IBetEvent>, Buildable<IBetMatch> {
|
|
29
|
-
replaceEvent(evt: IBetEvent): any;
|
|
30
|
-
reset(key: PartitionKey): IBetMatchBuilder;
|
|
31
|
-
}
|
|
32
|
-
export interface IBetEventBuilder extends Aggregatable<IBetEvent>, ParentOf<IBetRecord>, Buildable<IBetEvent> {
|
|
33
|
-
reset(key: PartitionKey): any;
|
|
34
|
-
}
|
|
35
|
-
export interface IBetEventStateBuilder extends Mergeable<IBetEventState>, Buildable<IBetEventState> {
|
|
36
|
-
}
|
|
37
|
-
export interface IBetRecordBuilder extends Mergeable<IBetRecord>, Buildable<IBetRecord> {
|
|
38
|
-
}
|
|
39
|
-
export declare class Const {
|
|
40
|
-
static readonly AGGREGATE_KEY: string;
|
|
41
|
-
static readonly SEPARATOR: string;
|
|
42
|
-
static generateKey(rec: IBetRecord): string;
|
|
43
|
-
}
|
|
44
|
-
export declare abstract class B2RecordBuilder implements IBetRecordBuilder {
|
|
45
|
-
protected _eventId: string;
|
|
46
|
-
protected _matchId: string;
|
|
47
|
-
protected _id: number;
|
|
48
|
-
protected _oddType: OddType;
|
|
49
|
-
protected _lbType: LBType;
|
|
50
|
-
protected _timetype: TimeType;
|
|
51
|
-
protected _sportbook: string;
|
|
52
|
-
protected _meta: StringMap;
|
|
53
|
-
protected _oddFormat: OddFormat;
|
|
54
|
-
protected _rateOver: number;
|
|
55
|
-
protected _rateUnder: number;
|
|
56
|
-
protected _rateEqual: number;
|
|
57
|
-
protected _pivotValue: number;
|
|
58
|
-
protected _pivotType: PivotType;
|
|
59
|
-
protected _pivotBias: PivotBias;
|
|
60
|
-
protected _rateOverId: string;
|
|
61
|
-
protected _rateUnderId: string;
|
|
62
|
-
protected _rateEqualId: string;
|
|
63
|
-
protected _isSwapped: boolean;
|
|
64
|
-
constructor(rec: IBetRecord);
|
|
65
|
-
eventId(): string;
|
|
66
|
-
matchId(): string;
|
|
67
|
-
id(): number;
|
|
68
|
-
oddType(): OddType;
|
|
69
|
-
lbType(): LBType;
|
|
70
|
-
timetype(): TimeType;
|
|
71
|
-
sportbook(): string;
|
|
72
|
-
meta(): StringMap;
|
|
73
|
-
oddFormat(): OddFormat;
|
|
74
|
-
rateOver(): number;
|
|
75
|
-
rateUnder(): number;
|
|
76
|
-
rateEqual(): number;
|
|
77
|
-
pivotValue(): number;
|
|
78
|
-
pivotType(): PivotType;
|
|
79
|
-
pivotBias(): PivotBias;
|
|
80
|
-
rateOverId(): string;
|
|
81
|
-
rateUnderId(): string;
|
|
82
|
-
rateEqualId(): string;
|
|
83
|
-
isSwapped(): boolean;
|
|
84
|
-
setEventId(eventId: string): void;
|
|
85
|
-
setMatchId(matchId: string): void;
|
|
86
|
-
setId(id: number): void;
|
|
87
|
-
setOddType(oddType: OddType): void;
|
|
88
|
-
setLbType(lbType: LBType): void;
|
|
89
|
-
setTimeType(timetype: TimeType): void;
|
|
90
|
-
setSportbook(sportbook: string): void;
|
|
91
|
-
setMeta(meta: StringMap): void;
|
|
92
|
-
setOddFormat(oddFormat: OddFormat): void;
|
|
93
|
-
setRateOver(rateOver: number): void;
|
|
94
|
-
setRateUnder(rateUnder: number): void;
|
|
95
|
-
setRateEqual(rateEqual: number): void;
|
|
96
|
-
setPivotValue(pivotValue: number): void;
|
|
97
|
-
setPivotType(pivotType: PivotType): void;
|
|
98
|
-
setPivotBias(pivotBias: PivotBias): void;
|
|
99
|
-
setRateOverId(rateOverId: string): void;
|
|
100
|
-
setRateUnderId(rateUnderId: string): void;
|
|
101
|
-
setRateEqualId(rateEqualId: string): void;
|
|
102
|
-
setSwapped(isSwapped: boolean): void;
|
|
103
|
-
build(): IBetRecord;
|
|
104
|
-
merge(rec: IBetRecord): void;
|
|
105
|
-
mergeFrom(record: IBetRecord): void;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* TODO:
|
|
109
|
-
* Fix use SoccerMatch interface instead of
|
|
110
|
-
* Implementation to check type
|
|
111
|
-
*/
|
|
112
|
-
export declare class BuilderProvider {
|
|
113
|
-
static getMatchBuilder(match: IBetMatch): IBetMatchBuilder;
|
|
114
|
-
static getEventBuilder(event: IBetEvent): IBetEventBuilder;
|
|
115
|
-
static getRecordBuilder(record: IBetRecord): IBetRecordBuilder;
|
|
116
|
-
static getEventStateBuilder(state: IBetEventState): IBetEventStateBuilder;
|
|
117
|
-
static getSnapshotBuilder(parentSs: IndexedSnapshot): IIndexedSnapshotBuilder;
|
|
118
|
-
}
|
package/lib/mutable.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Builder,__extends=this&&this.__extends||(()=>{var i=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])});return function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}})(),jayeson_lib_record_1=(Object.defineProperty(exports,"__esModule",{value:!0}),require("@longchau/jayeson.lib.record")),data_structure_1=require("./data_structure"),codec_1=require("./codec"),Collections=require("typescript-collections"),Const=(()=>{function t(){}return t.generateKey=function(t){return t.source()+this.SEPARATOR+t.id()},t.AGGREGATE_KEY="AGGREGATE_KEY",t.SEPARATOR="_",t})(),IndexedSnapshotBuilder=(exports.Const=Const,(()=>{function t(t){if(this._matches={},this._partitions=new Collections.Dictionary,null!=t){for(var e=0,r=t.matches();e<r.length;e++){var i=r[e];this._matches[i.id()]=i}for(var o=0,n=t.getPartitionMap().keys();o<n.length;o++){var s=n[o];this._partitions.setValue(s,t.getPartitionMap().getValue(s))}}}return t.prototype.matches=function(){return this._matches},t.prototype.partitions=function(){return this._partitions},t.prototype.setPartition=function(t){this._partitions=t},t.prototype.setPartitionValue=function(t,e){this._partitions.setValue(t,e)},t.prototype.removePartitionKey=function(t){return this._partitions.remove(t)},t.prototype.markPartitionAsUpdated=function(t,e){null==e&&(e=(new Date).getMilliseconds()),this._partitions.setValue(t,e)},t.prototype.replaceMatch=function(t){this._matches[t.id()]=t},t.prototype.reset=function(t){if(!this._partitions.containsKey(t))return null;var e,r=this._matches,i=BuilderProvider.getSnapshotBuilder(this.build()),o=(i._matches={},i._partitions.clear(),this.removePartitionKey(t));for(e in i.setPartitionValue(t,o),this._matches){var n=this._matches[e],s=BuilderProvider.getMatchBuilder(n),a=s.reset(t);null==a||a.isEmpty()||i.insertChild(a.build()),s.isEmpty()?delete r[n.id()]:r[n.id()]=s.build()}return this._matches=r,i},t.prototype.insertChild=function(t){var e=this._matches[t.id()],r=null;return null==e?this._matches[t.id()]=t:(r=t.id(),(e=BuilderProvider.getMatchBuilder(e)).aggregateInsert(t),this._matches[t.id()]=e.build()),r},t.prototype.updateChild=function(t){var e=this._matches[t.id()];null==e?console.error("[UpdateMatch] Cannot found matchId %s to execute update match from %s",t.id(),t.meta()[Const.AGGREGATE_KEY]):((e=BuilderProvider.getMatchBuilder(e)).aggregateUpdate(t),this._matches[t.id()]=e.build())},t.prototype.deleteChild=function(t){var e=this._matches[t.id()],r=null;if(null!=e)return(e=BuilderProvider.getMatchBuilder(e)).aggregateDelete(t)?delete this._matches[t.id()]:(this._matches[t.id()]=e.build(),r=t.id()),r;console.error("[DeleteMatch] Cannot found matchId %s to execute delete match from %s",t.id(),t.meta()[Const.AGGREGATE_KEY])},t.prototype.build=function(){var t,e={};for(t in this._matches){var r=this._matches[t],i=e[r.sportType()];null==i&&(i=[],e[r.sportType()]=i),i.push(r)}return new data_structure_1.IndexedSnapshotImpl(e,this._partitions)},t})()),B2MatchBuilder=(()=>{function t(t){this._events={},this.mergeFrom(t)}return t.prototype.meta=function(){return this._meta},t.prototype.startTime=function(){return this._startTime},t.prototype.events=function(){return this._events},t.prototype.id=function(){return this._id},t.prototype.league=function(){return this._league},t.prototype.sport=function(){return this._sport},t.prototype.meata=function(){return this._meta},t.prototype.p1=function(){return this._p1},t.prototype.p2=function(){return this._p2},t.prototype.setEvent=function(t){this._events=t},t.prototype.mergeFrom=function(t){for(var e in this._startTime=t.startTime(),this._id=t.id(),this._league=t.league(),this._sport=t.sportType(),this._meta={},t.meta())this._meta[e]=t.meta()[e];if(null!=t.events())for(var r=0,i=t.events();r<i.length;r++){var o=i[r];this._events[o.id()]=o}var n=t;this._p1=n.participantOne(),this._p2=n.participantTwo()},t.prototype.replaceEvent=function(t){this._events[t.id()]=t},t.prototype.reset=function(t){var e=t.toString(),r=this._meta[Const.AGGREGATE_KEY];if(!codec_1.Util.containsKey(r,e))return null;var i,o=BuilderProvider.getMatchBuilder(this.build()),r=codec_1.Util.removeKey(r,e),n=(this._meta[Const.AGGREGATE_KEY]=r,o._meta[Const.AGGREGATE_KEY]=e,{});for(i in o._events={},this._events){var s=this._events[i],a=BuilderProvider.getEventBuilder(s),u=a.reset(t);null==u||u.isEmpty()||o.insertChild(u.build()),a.isEmpty()?delete n[s.id()]:n[s.id()]=a.build()}return this._events=n,o},t.prototype.aggregateInsert=function(t){for(var e in t.meta())e!==Const.AGGREGATE_KEY&&(this._meta[e]=t.meta()[e]);var r=t.meta()[Const.AGGREGATE_KEY],i=this._meta[Const.AGGREGATE_KEY];this._meta[Const.AGGREGATE_KEY]=codec_1.Util.addKey(i,r)},t.prototype.aggregateUpdate=function(t){for(var e in t.meta())e!==Const.AGGREGATE_KEY&&(this._meta[e]=t.meta()[e])},t.prototype.aggregateDelete=function(t){var t=t.meta()[Const.AGGREGATE_KEY],e=this._meta[Const.AGGREGATE_KEY],e=codec_1.Util.removeKey(e,t);return""===(this._meta[Const.AGGREGATE_KEY]=e)},t.prototype.isEmpty=function(){var t=this._meta[Const.AGGREGATE_KEY];return null==t||""==t},t.prototype.insertChild=function(t){var e=this._events[t.id()],r=null;return null==e?this._events[t.id()]=t:((e=BuilderProvider.getEventBuilder(e)).aggregateInsert(t),this._events[t.id()]=e.build(),r=t.id()),r},t.prototype.updateChild=function(t){var e=this._events[t.id()];null==e?console.error("[UpdateEvent] Cannot found eventId %s to execute update event from %s",t.id(),t.meta()[Const.AGGREGATE_KEY]):((e=BuilderProvider.getEventBuilder(e)).aggregateUpdate(t),this._events[t.id()]=e.build())},t.prototype.deleteChild=function(t){var e=this._events[t.id()],r=null;if(null!=e)return(e=BuilderProvider.getEventBuilder(e)).aggregateDelete(t)?delete this._events[t.id()]:(r=t.id(),this._events[t.id()]=e.build()),r;console.error("[DeleteEvent] Cannot found eventId %s to execute delete event from %s",t.id(),t.meta()[Const.AGGREGATE_KEY])},t.prototype.build=function(){throw new TypeError("Not supported in Abstract class")},t})(),B2EventBuilder=(()=>{function t(t){this._records={},this._states={},this.mergeFrom(t)}return t.prototype.id=function(){return this._id},t.prototype.records=function(){return this._records},t.prototype.matchId=function(){return this._matchId},t.prototype.eventType=function(){return this._eventType},t.prototype.meta=function(){return this._meta},t.prototype.states=function(){return this._states},t.prototype.mergeFrom=function(t){var e=t;if(this._id=t.id(),null!=t.records())for(var r=0,i=e.records();r<i.length;r++){var o=i[r],n=Const.generateKey(o);this._records[n]=o}for(n in this.setStates(e.eventStates()),this._matchId=t.matchId(),this._eventType=t.eventType(),this._meta={},t.meta())this._meta[n]=t.meta()[n]},t.prototype.setStates=function(t){if(null!=t)for(var e=0,r=t;e<r.length;e++){var i=r[e];this._states[i.partitionKey().toString()]=i}},t.prototype.insertChild=function(t){return this._records[Const.generateKey(t)]=t,null},t.prototype.updateChild=function(t){var e,r=this._records[Const.generateKey(t)];null==r?console.error("[UpdateOdd] Cannot find record "+this._matchId+" "+this._id+" "+t.source()+" "+t.id()):((e=BuilderProvider.getRecordBuilder(r)).merge(t),this._records[Const.generateKey(r)]=e.build())},t.prototype.deleteChild=function(t){return delete this._records[Const.generateKey(t)],null},t.prototype.aggregateInsert=function(t){var e=this;t.eventStates().forEach(function(t){e._states[t.partitionKey().toString()]=t})},t.prototype.aggregateUpdate=function(t){var e=this;t.eventStates().forEach(function(t){e._states[t.partitionKey().toString()]=t})},t.prototype.aggregateDelete=function(t){var e=this;return t.eventStates().forEach(function(t){delete e._states[t.partitionKey().toString()]}),0==Object.keys(this._states).length},t.prototype.reset=function(t){if(null==this._states[t.toString()])return null;var e=BuilderProvider.getEventBuilder(this.build()),r=(e._states={},e._records={},this._states[t.toString()]);e._states[t.toString()]=r,delete this._states[t.toString()];for(var i=0,o=Object.keys(this._records);i<o.length;i++){var n=o[i],s=this._records[n];s.source()===t.source()&&this.getOddTypeInt(s.oddType())===this.getOddTypeInt(t.oddType())&&(e.insertChild(s),delete this._records[n])}return e},t.prototype.getOddTypeInt=function(t){return isNaN(t)?Number(jayeson_lib_record_1.OddType[t]):Number(t)},t.prototype.isEmpty=function(){return null==this._states||0==Object.keys(this._states).length},t.prototype.build=function(){throw new TypeError("Not Implemented for abstract class")},t})(),B2EventStateBuilder=(()=>{function t(t){this.mergeFrom(t)}return t.prototype.statsOne=function(){return this._statsOne},t.prototype.stateTwo=function(){return this._statsTwo},t.prototype.duration=function(){return this._duration},t.prototype.key=function(){return this._key},t.prototype.matchId=function(){return this._matchId},t.prototype.eventId=function(){return this._eventId},t.prototype.createdTime=function(){return this._createdTime},t.prototype.build=function(){throw new TypeError("UnSupported Operation in abstract class")},t.prototype.mergeFrom=function(t){this._statsOne=t.statsOne(),this._statsTwo=t.statsTwo(),this._duration=t.duration(),this._key=t.partitionKey(),this._matchId=t.matchId(),this._eventId=t.eventId(),this._createdTime=(new Date).getMilliseconds()},t.prototype.merge=function(t){this.setStatsOne(t.statsOf(0)),this.setStatsTwo(t.statsOf(1)),this.setDuration(t.duration()),this.setEventId(t.eventId()),this.setMatchId(t.matchId()),this.setKey(t.partitionKey())},t.prototype.setStatsOne=function(t){this._statsOne=t},t.prototype.setStatsTwo=function(t){this._statsTwo=t},t.prototype.setDuration=function(t){this._duration=t},t.prototype.setKey=function(t){this._key=t},t.prototype.setMatchId=function(t){this._matchId=t},t.prototype.setEventId=function(t){this._eventId=t},t.prototype.setCreatedTime=function(t){this._createdTime=t},t})(),B2RecordBuilder=(()=>{function t(t){this.mergeFrom(t)}return t.prototype.eventId=function(){return this._eventId},t.prototype.matchId=function(){return this._matchId},t.prototype.id=function(){return this._id},t.prototype.oddType=function(){return this._oddType},t.prototype.lbType=function(){return this._lbType},t.prototype.timetype=function(){return this._timetype},t.prototype.sportbook=function(){return this._sportbook},t.prototype.meta=function(){return this._meta},t.prototype.oddFormat=function(){return this._oddFormat},t.prototype.rateOver=function(){return this._rateOver},t.prototype.rateUnder=function(){return this._rateUnder},t.prototype.rateEqual=function(){return this._rateEqual},t.prototype.pivotValue=function(){return this._pivotValue},t.prototype.pivotType=function(){return this._pivotType},t.prototype.pivotBias=function(){return this._pivotBias},t.prototype.rateOverId=function(){return this._rateOverId},t.prototype.rateUnderId=function(){return this._rateUnderId},t.prototype.rateEqualId=function(){return this._rateEqualId},t.prototype.isSwapped=function(){return this._isSwapped},t.prototype.setEventId=function(t){this._eventId=t},t.prototype.setMatchId=function(t){this._matchId=t},t.prototype.setId=function(t){this._id=t},t.prototype.setOddType=function(t){this._oddType=t},t.prototype.setLbType=function(t){this._lbType=t},t.prototype.setTimeType=function(t){this._timetype=t},t.prototype.setSportbook=function(t){this._sportbook=t},t.prototype.setMeta=function(t){this._meta=t},t.prototype.setOddFormat=function(t){this._oddFormat=t},t.prototype.setRateOver=function(t){this._rateOver=t},t.prototype.setRateUnder=function(t){this._rateUnder=t},t.prototype.setRateEqual=function(t){this._rateEqual=t},t.prototype.setPivotValue=function(t){this._pivotValue=t},t.prototype.setPivotType=function(t){this._pivotType=t},t.prototype.setPivotBias=function(t){this._pivotBias=t},t.prototype.setRateOverId=function(t){this._rateOverId=t},t.prototype.setRateUnderId=function(t){this._rateUnderId=t},t.prototype.setRateEqualId=function(t){this._rateEqualId=t},t.prototype.setSwapped=function(t){this._isSwapped=t},t.prototype.build=function(){throw new TypeError("UnSupported in Abstract class")},t.prototype.merge=function(t){this.setRateOver(t.rateOver()),this.setRateUnder(t.rateUnder()),this.setRateEqual(t.rateEqual()),t.rateOverId&&this.setRateOverId(t.rateOverId()),t.rateUnderId&&this.setRateOverId(t.rateUnderId()),t.rateEqualId&&this.setRateOverId(t.rateEqualId())},t.prototype.mergeFrom=function(t){this._eventId=t.eventId(),this._matchId=t.matchId(),this._id=t.id(),this._oddType=t.oddType(),this._lbType=t.lbType(),this._timetype=t.timeType(),this._sportbook=t.source(),this._meta=t.meta(),this._oddFormat=t.oddFormat(),this._rateOver=t.rateOver(),this._rateUnder=t.rateUnder(),this._rateEqual=t.rateEqual(),this._pivotValue=t.pivotValue(),this._pivotType=t.pivotType(),this._pivotBias=t.pivotBias(),this._rateOverId=t.rateOverId(),this._rateUnderId=t.rateUnderId(),this._rateEqualId=t.rateEqualId(),this._isSwapped=t.isSwapped()},t})(),BuilderProvider=(exports.B2RecordBuilder=B2RecordBuilder,(t=>{var e;function r(t){return e.call(this,t)||this}__extends(r,e=IndexedSnapshotBuilder),t.Snapshot=r})(Builder=Builder||{}),(t=>{var e,r,i,t=t.Match||(t.Match={});function o(t){return e.call(this,t)||this}function n(t){return r.call(this,t)||this}function s(t){return i.call(this,t)||this}__extends(o,e=B2MatchBuilder),o.prototype.setGender=function(t){this.gender=t},o.prototype.setCountry=function(t){this.country=t},o.prototype.mergeFrom=function(t){e.prototype.mergeFrom.call(this,t);this.setGender(t.gender()),this.setCountry(t.country())},o.prototype.build=function(){for(var t=[],e=0,r=Object.keys(this._events);e<r.length;e++){var i=r[e];t.push(this._events[i])}return new jayeson_lib_record_1.TennisMatchImpl(this._p1,this._p2,this._startTime,t,this._id,this._league,this.gender,this.country,this._meta)},t.Tennis=o,__extends(n,r=B2MatchBuilder),n.prototype.leagueType=function(){return this._leagueType},n.prototype.gender=function(){return this._gender},n.prototype.country=function(){return this._country},n.prototype.setLeagueType=function(t){this._leagueType=t},n.prototype.setGender=function(t){this._gender=t},n.prototype.setCountry=function(t){this._country=t},n.prototype.mergeFrom=function(t){r.prototype.mergeFrom.call(this,t);var e=t;this.setLeagueType(e.leagueType()),this.setCountry(t.country()),this.setGender(e.gender())},n.prototype.build=function(){for(var t=[],e=0,r=Object.keys(this._events);e<r.length;e++){var i=r[e];t.push(this._events[i])}return new jayeson_lib_record_1.SoccerMatchImpl(this._p1,this._p2,this._startTime,t,this._id,this._league,this._meta,this._leagueType,this._gender,this._country)},t.Soccer=n,__extends(s,i=B2MatchBuilder),s.prototype.gender=function(){return this._gender},s.prototype.country=function(){return this._country},s.prototype.setGender=function(t){this._gender=t},s.prototype.setCountry=function(t){this._country=t},s.prototype.build=function(){for(var t=[],e=0,r=Object.keys(this._events);e<r.length;e++){var i=r[e];t.push(this._events[i])}return new jayeson_lib_record_1.BasketballMatchImpl(this._p1,this._p2,this._startTime,t,this._id,this._league,this._gender,this._country,this._meta)},s.prototype.mergeFrom=function(t){i.prototype.mergeFrom.call(this,t);this.setGender(t.gender()),this.setCountry(t.country())},t.Basketball=s})(Builder=Builder||{}),(t=>{var e,r,i,t=t.Event||(t.Event={});function o(t){return e.call(this,t)||this}function n(t){return r.call(this,t)||this}function s(t){return i.call(this,t)||this}__extends(o,e=B2EventBuilder),o.prototype.build=function(){for(var t=[],e=0,r=Object.keys(this._records);e<r.length;e++){var i=r[e];t.push(this._records[i])}for(var o=[],n=0,s=Object.keys(this._states);n<s.length;n++){var a=s[n];o.push(this._states[a])}return new jayeson_lib_record_1.TennisEventImpl(this._id,t,o,this._matchId,this._eventType,this._meta)},t.Tennis=o,__extends(n,r=B2EventBuilder),n.prototype.build=function(){for(var t=[],e=0,r=Object.keys(this._records);e<r.length;e++){var i=r[e];t.push(this._records[i])}for(var o=[],n=0,s=Object.keys(this._states);n<s.length;n++){var a=s[n];o.push(this._states[a])}return new jayeson_lib_record_1.SoccerEventImpl(this._id,t,o,this._matchId,this._eventType,this._meta)},t.Soccer=n,__extends(s,i=B2EventBuilder),s.prototype.build=function(){for(var t=[],e=0,r=Object.keys(this._records);e<r.length;e++){var i=r[e];t.push(this._records[i])}for(var o=[],n=0,s=Object.keys(this._states);n<s.length;n++){var a=s[n];o.push(this._states[a])}return new jayeson_lib_record_1.BasketballEventImpl(this._id,t,o,this._matchId,this._eventType,this._meta)},t.Basketball=s})(Builder=Builder||{}),(t=>{var e,r,i,t=t.Record||(t.Record={});function o(t){return e.call(this,t)||this}function n(t){return r.call(this,t)||this}function s(t){return i.call(this,t)||this}__extends(o,e=B2RecordBuilder),o.prototype.build=function(){return new jayeson_lib_record_1.TennisRecord(this._matchId,this._eventId,this._id,this._oddType,this._lbType,this._timetype,this._sportbook,this._oddFormat,this._meta,this._rateOver,this._rateUnder,this._rateEqual,this._pivotValue,this._pivotType,this._pivotBias,this._rateOverId,this._rateUnderId,this._rateEqualId,this._isSwapped)},t.Tennis=o,__extends(n,r=B2RecordBuilder),n.prototype.build=function(){return new jayeson_lib_record_1.SoccerRecord(this._matchId,this._eventId,this._id,this._oddType,this._lbType,this._timetype,this._sportbook,this._oddFormat,this._meta,this._rateOver,this._rateUnder,this._rateEqual,this._pivotValue,this._pivotType,this._pivotBias,this._rateOverId,this._rateUnderId,this._rateEqualId,this._isSwapped)},t.Soccer=n,__extends(s,i=B2RecordBuilder),s.prototype.build=function(){return new jayeson_lib_record_1.BasketballRecord(this._matchId,this._eventId,this._id,this._oddType,this._lbType,this._timetype,this._sportbook,this._oddFormat,this._meta,this._rateOver,this._rateUnder,this._rateEqual,this._pivotValue,this._pivotType,this._pivotBias,this._rateOverId,this._rateUnderId,this._rateEqualId,this._isSwapped)},t.Basketball=s})(Builder=Builder||{}),(t=>{var e,r,i,t=t.EventState||(t.EventState={});function o(t){return e.call(this,t)||this}function n(t){return r.call(this,t)||this}function s(t){return i.call(this,t)||this}__extends(o,e=B2EventStateBuilder),o.prototype.build=function(){return new jayeson_lib_record_1.SoccerEventState(this._duration,this._key,this._matchId,this._eventId,null,this._statsOne.getScores()[0],this._statsTwo.getScores()[0],this._statsOne.getScores()[1],this._statsTwo.getScores()[1],this.segment,this.bookPriority)},o.prototype.setHostScore=function(t){var e=this._statsOne.getScores();e[0]=t,this._statsOne.setScores(e)},o.prototype.setHostCard=function(t){var e=this._statsOne.getScores();e[1]=t,this._statsOne.setScores(e)},o.prototype.setGuestScore=function(t){var e=this._statsTwo.getScores();e[0]=t,this._statsTwo.setScores(e)},o.prototype.setGuestCard=function(t){var e=this._statsTwo.getScores();e[1]=t,this._statsTwo.setScores(e)},o.prototype.setSegment=function(t){this.segment=t},o.prototype.setBookPriority=function(t){this.bookPriority=t},o.prototype.mergeFrom=function(t){e.prototype.mergeFrom.call(this,t);this.setHostCard(t.hostCard()),this.setGuestCard(t.guestCard()),this.setHostScore(t.hostScore()),this.setGuestScore(t.guestScore()),this.setSegment(t.segment()),this.setBookPriority(t.bookPriority())},o.prototype.merge=function(t){e.prototype.merge.call(this,t);null!=t.segment&&this.setSegment(t.segment())},t.Soccer=o,__extends(n,r=B2EventStateBuilder),n.prototype.build=function(){return new jayeson_lib_record_1.TennisEventState(this._statsOne,this._statsTwo,this._duration,this._key,this._matchId,this._eventId,this._createdTime,this.setScore,this.game,this.bookPriority)},n.prototype.setSet=function(t){this.setScore=t},n.prototype.setGame=function(t){this.game=t},n.prototype.setBookPriority=function(t){this.bookPriority=t},n.prototype.mergeFrom=function(t){r.prototype.mergeFrom.call(this,t);this.setSet(t.set()),this.setGame(t.game()),this.setBookPriority(t.bookPriority())},t.Tennis=n,__extends(s,i=B2EventStateBuilder),s.prototype.build=function(){return new jayeson_lib_record_1.BasketballEventState(this._statsOne,this._statsTwo,this._duration,this._key,this._matchId,this._eventId,this._createdTime,this.segment,this.isTimeout,this.bookPriority)},s.prototype.setSegment=function(t){this.segment=t},s.prototype.setBookPriority=function(t){this.bookPriority=t},s.prototype.setTimeout=function(t){this.isTimeout=t},s.prototype.mergeFrom=function(t){i.prototype.mergeFrom.call(this,t)},t.Basketball=s})(Builder=Builder||{}),(()=>{function t(){}return t.getMatchBuilder=function(t){if(t instanceof jayeson_lib_record_1.SoccerMatchImpl)return new Builder.Match.Soccer(t);if(t instanceof jayeson_lib_record_1.TennisMatchImpl)return new Builder.Match.Tennis(t);if(t instanceof jayeson_lib_record_1.BasketballMatchImpl)return new Builder.Match.Basketball(t);throw new TypeError("Cannot Create Builder for "+t.constructor.toString())},t.getEventBuilder=function(t){if(t instanceof jayeson_lib_record_1.SoccerEventImpl)return new Builder.Event.Soccer(t);if(t instanceof jayeson_lib_record_1.TennisEventImpl)return new Builder.Event.Tennis(t);if(t instanceof jayeson_lib_record_1.BasketballEventImpl)return new Builder.Event.Basketball(t);throw new TypeError("Cannot Create Builder for "+t.constructor.toString())},t.getRecordBuilder=function(t){if(t instanceof jayeson_lib_record_1.SoccerRecord)return new Builder.Record.Soccer(t);if(t instanceof jayeson_lib_record_1.TennisRecord)return new Builder.Record.Tennis(t);if(t instanceof jayeson_lib_record_1.BasketballRecord)return new Builder.Record.Basketball(t);throw new TypeError("Cannot Create Builder for "+t.constructor.toString())},t.getEventStateBuilder=function(t){if(t instanceof jayeson_lib_record_1.SoccerEventState)return new Builder.EventState.Soccer(t);if(t instanceof jayeson_lib_record_1.TennisEventState)return new Builder.EventState.Tennis(t);if(t instanceof jayeson_lib_record_1.BasketballEventState)return new Builder.EventState.Basketball(t);throw new TypeError("Cannot Create Builder for "+t.constructor.toString())},t.getSnapshotBuilder=function(t){return new Builder.Snapshot(t)},t})());exports.BuilderProvider=BuilderProvider;
|