@jayesol/jayeson.lib.sports 2.2.7-beta → 2.2.7-beta2

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