@jayesol/jayeson.lib.sports 2.2.5 → 2.2.6-beta

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/lib/mutable.d.ts DELETED
@@ -1,118 +0,0 @@
1
- import { OddType, LBType, TimeType, OddFormat, PivotBias, PivotType, StringMap, IBetEvent, IBetRecord, IBetEventState, IBetMatch, PartitionKey } from "@jayesol/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
- "use strict";var __extends=this&&this.__extends||function(){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)}}();Object.defineProperty(exports,"__esModule",{value:!0});var jayeson_lib_record_1=require("@jayesol/jayeson.lib.record"),data_structure_1=require("./data_structure"),codec_1=require("./codec"),Collections=require("typescript-collections"),Const=function(){function t(){}return t.generateKey=function(t){return t.source()+this.SEPARATOR+t.id()},t.AGGREGATE_KEY="AGGREGATE_KEY",t.SEPARATOR="_",t}();exports.Const=Const;var Builder,IndexedSnapshotBuilder=function(){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=this._matches,r=BuilderProvider.getSnapshotBuilder(this.build());r._matches={},r._partitions.clear();var i=this.removePartitionKey(t);for(var o in r.setPartitionValue(t,i),this._matches){var n=this._matches[o],s=BuilderProvider.getMatchBuilder(n),a=s.reset(t);null==a||a.isEmpty()||r.insertChild(a.build()),s.isEmpty()?delete e[n.id()]:e[n.id()]=s.build()}return this._matches=e,r},t.prototype.insertChild=function(t){var e=this._matches[t.id()],r=null;if(null==e)this._matches[t.id()]=t;else{r=t.id();var i=BuilderProvider.getMatchBuilder(e);i.aggregateInsert(t),this._matches[t.id()]=i.build()}return r},t.prototype.updateChild=function(t){var e=this._matches[t.id()];if(null!=e){var r=BuilderProvider.getMatchBuilder(e);r.aggregateUpdate(t),this._matches[t.id()]=r.build()}else console.error("[UpdateMatch] Cannot found matchId %s to execute update match from %s",t.id(),t.meta()[Const.AGGREGATE_KEY])},t.prototype.deleteChild=function(t){var e=this._matches[t.id()],r=null;if(null!=e){var i=BuilderProvider.getMatchBuilder(e);return i.aggregateDelete(t)?delete this._matches[t.id()]:(this._matches[t.id()]=i.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={};for(var e in this._matches){var r=this._matches[e],i=t[r.sportType()];null==i&&(i=[],t[r.sportType()]=i),i.push(r)}return new data_structure_1.IndexedSnapshotImpl(t,this._partitions)},t}(),B2MatchBuilder=function(){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=BuilderProvider.getMatchBuilder(this.build()),o=codec_1.Util.removeKey(r,e);this._meta[Const.AGGREGATE_KEY]=o,i._meta[Const.AGGREGATE_KEY]=e;var n={};for(var s in i._events={},this._events){var a=this._events[s],u=BuilderProvider.getEventBuilder(a),h=u.reset(t);null==h||h.isEmpty()||i.insertChild(h.build()),u.isEmpty()?delete n[a.id()]:n[a.id()]=u.build()}return this._events=n,i},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 e=t.meta()[Const.AGGREGATE_KEY],r=this._meta[Const.AGGREGATE_KEY],i=codec_1.Util.removeKey(r,e);return""===(this._meta[Const.AGGREGATE_KEY]=i)},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;if(null==e)this._events[t.id()]=t;else{var i=BuilderProvider.getEventBuilder(e);i.aggregateInsert(t),this._events[t.id()]=i.build(),r=t.id()}return r},t.prototype.updateChild=function(t){var e=this._events[t.id()];if(null!=e){var r=BuilderProvider.getEventBuilder(e);r.aggregateUpdate(t),this._events[t.id()]=r.build()}else console.error("[UpdateEvent] Cannot found eventId %s to execute update event from %s",t.id(),t.meta()[Const.AGGREGATE_KEY])},t.prototype.deleteChild=function(t){var e=this._events[t.id()],r=null;if(null!=e){var i=BuilderProvider.getEventBuilder(e);return i.aggregateDelete(t)?delete this._events[t.id()]:(r=t.id(),this._events[t.id()]=i.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(){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(var 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=this._records[Const.generateKey(t)];if(null!=e){var r=BuilderProvider.getRecordBuilder(e);r.merge(t),this._records[Const.generateKey(e)]=r.build()}else console.error("[UpdateOdd] Cannot find record "+this._matchId+" "+this._id+" "+t.source()+" "+t.id())},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());e._states={},e._records={};var r=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(){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){var e=t;this._statsOne=e.statsOne(),this._statsTwo=e.statsTwo(),this._duration=e.duration(),this._key=e.partitionKey(),this._matchId=e.matchId(),this._eventId=e.eventId(),this._createdTime=(new Date).getMilliseconds()},t.prototype.merge=function(t){var e=t;this.setStatsOne(e.statsOf(0)),this.setStatsTwo(e.statsOf(1)),this.setDuration(e.duration()),this.setEventId(e.eventId()),this.setMatchId(e.matchId()),this.setKey(e.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(){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){var e=t;this.setRateOver(e.rateOver()),this.setRateUnder(e.rateUnder()),this.setRateEqual(e.rateEqual()),e.rateOverId&&this.setRateOverId(e.rateOverId()),e.rateUnderId&&this.setRateOverId(e.rateUnderId()),e.rateEqualId&&this.setRateOverId(e.rateEqualId())},t.prototype.mergeFrom=function(t){var e=t;this._eventId=e.eventId(),this._matchId=e.matchId(),this._id=e.id(),this._oddType=e.oddType(),this._lbType=e.lbType(),this._timetype=e.timeType(),this._sportbook=e.source(),this._meta=e.meta(),this._oddFormat=e.oddFormat(),this._rateOver=e.rateOver(),this._rateUnder=e.rateUnder(),this._rateEqual=e.rateEqual(),this._pivotValue=e.pivotValue(),this._pivotType=e.pivotType(),this._pivotBias=e.pivotBias(),this._rateOverId=e.rateOverId(),this._rateUnderId=e.rateUnderId(),this._rateEqualId=e.rateEqualId(),this._isSwapped=e.isSwapped()},t}();exports.B2RecordBuilder=B2RecordBuilder,function(t){var e,r=(__extends(i,e=IndexedSnapshotBuilder),i);function i(t){return e.call(this,t)||this}t.Snapshot=r}(Builder=Builder||{}),function(t){!function(t){var r,e=(__extends(i,r=B2MatchBuilder),i.prototype.setGender=function(t){this.gender=t},i.prototype.setCountry=function(t){this.country=t},i.prototype.mergeFrom=function(t){r.prototype.mergeFrom.call(this,t);var e=t;this.setGender(e.gender()),this.setCountry(e.country())},i.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)},i);function i(t){return r.call(this,t)||this}t.Tennis=e;var o,n=(__extends(s,o=B2MatchBuilder),s.prototype.leagueType=function(){return this._leagueType},s.prototype.gender=function(){return this._gender},s.prototype.country=function(){return this._country},s.prototype.setLeagueType=function(t){this._leagueType=t},s.prototype.setGender=function(t){this._gender=t},s.prototype.setCountry=function(t){this._country=t},s.prototype.mergeFrom=function(t){o.prototype.mergeFrom.call(this,t);var e=t;this.setLeagueType(e.leagueType()),this.setCountry(t.country()),this.setGender(e.gender())},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.SoccerMatchImpl(this._p1,this._p2,this._startTime,t,this._id,this._league,this._meta,this._leagueType,this._gender,this._country)},s);function s(t){return o.call(this,t)||this}t.Soccer=n;var a,u=(__extends(h,a=B2MatchBuilder),h.prototype.gender=function(){return this._gender},h.prototype.country=function(){return this._country},h.prototype.setGender=function(t){this._gender=t},h.prototype.setCountry=function(t){this._country=t},h.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)},h.prototype.mergeFrom=function(t){a.prototype.mergeFrom.call(this,t);var e=t;this.setGender(e.gender()),this.setCountry(e.country())},h);function h(t){return a.call(this,t)||this}t.Basketball=u}(t.Match||(t.Match={}))}(Builder=Builder||{}),function(t){!function(t){var e,r=(__extends(i,e=B2EventBuilder),i.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)},i);function i(t){return e.call(this,t)||this}t.Tennis=r;var o,n=(__extends(s,o=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.SoccerEventImpl(this._id,t,o,this._matchId,this._eventType,this._meta)},s);function s(t){return o.call(this,t)||this}t.Soccer=n;var a,u=(__extends(h,a=B2EventBuilder),h.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)},h);function h(t){return a.call(this,t)||this}t.Basketball=u}(t.Event||(t.Event={}))}(Builder=Builder||{}),function(t){!function(t){var e,r=(__extends(i,e=B2RecordBuilder),i.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)},i);function i(t){return e.call(this,t)||this}t.Tennis=r;var o,n=(__extends(s,o=B2RecordBuilder),s.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)},s);function s(t){return o.call(this,t)||this}t.Soccer=n;var a,u=(__extends(h,a=B2RecordBuilder),h.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)},h);function h(t){return a.call(this,t)||this}t.Basketball=u}(t.Record||(t.Record={}))}(Builder=Builder||{}),function(t){!function(t){var r,e=(__extends(i,r=B2EventStateBuilder),i.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)},i.prototype.setHostScore=function(t){var e=this._statsOne.getScores();e[0]=t,this._statsOne.setScores(e)},i.prototype.setHostCard=function(t){var e=this._statsOne.getScores();e[1]=t,this._statsOne.setScores(e)},i.prototype.setGuestScore=function(t){var e=this._statsTwo.getScores();e[0]=t,this._statsTwo.setScores(e)},i.prototype.setGuestCard=function(t){var e=this._statsTwo.getScores();e[1]=t,this._statsTwo.setScores(e)},i.prototype.setSegment=function(t){this.segment=t},i.prototype.setBookPriority=function(t){this.bookPriority=t},i.prototype.mergeFrom=function(t){r.prototype.mergeFrom.call(this,t);var e=t;this.setHostCard(e.hostCard()),this.setGuestCard(e.guestCard()),this.setHostScore(e.hostScore()),this.setGuestScore(e.guestScore()),this.setSegment(e.segment()),this.setBookPriority(e.bookPriority())},i.prototype.merge=function(t){r.prototype.merge.call(this,t);var e=t;null!=e.segment&&this.setSegment(e.segment())},i);function i(t){return r.call(this,t)||this}t.Soccer=e;var o,n=(__extends(s,o=B2EventStateBuilder),s.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)},s.prototype.setSet=function(t){this.setScore=t},s.prototype.setGame=function(t){this.game=t},s.prototype.setBookPriority=function(t){this.bookPriority=t},s.prototype.mergeFrom=function(t){o.prototype.mergeFrom.call(this,t);var e=t;this.setSet(e.set()),this.setGame(e.game()),this.setBookPriority(e.bookPriority())},s);function s(t){return o.call(this,t)||this}t.Tennis=n;var a,u=(__extends(h,a=B2EventStateBuilder),h.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)},h.prototype.setSegment=function(t){this.segment=t},h.prototype.setBookPriority=function(t){this.bookPriority=t},h.prototype.setTimeout=function(t){this.isTimeout=t},h.prototype.mergeFrom=function(t){a.prototype.mergeFrom.call(this,t)},h);function h(t){return a.call(this,t)||this}t.Basketball=u}(t.EventState||(t.EventState={}))}(Builder=Builder||{});var BuilderProvider=function(){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;