@jayesol/jayeson.model 2.1.0-beta.1205v2 → 2.1.1-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.
- package/lib/filter.js +1 -832
- package/lib/index.js +1 -4
- package/package.json +21 -12
package/lib/filter.js
CHANGED
|
@@ -1,832 +1 @@
|
|
|
1
|
-
/**@author nt-quang
|
|
2
|
-
*
|
|
3
|
-
* This file is used by DataFront to build a IDataFilter for an arbitrary connection.
|
|
4
|
-
* It'll get the input from client and construct to a special class that DF can create an IDataFilter object.
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
var SportType = require("@jayesol/jayeson.lib.record").SportType;
|
|
9
|
-
var LBType = require("@jayesol/jayeson.lib.record").LBType;
|
|
10
|
-
var PivotType = require("@jayesol/jayeson.lib.record").PivotType;
|
|
11
|
-
var OddType = require("@jayesol/jayeson.lib.record").OddType;
|
|
12
|
-
var TargetType = require("@jayesol/jayeson.lib.record").TargetType;
|
|
13
|
-
var PivotBias = require("@jayesol/jayeson.lib.record").PivotBias;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* AbstractRule is equivalent to GeneralFilterRule in jayeson.model library
|
|
17
|
-
* @param isNegated negated true: only accept established rule.
|
|
18
|
-
* false: only accept the opposite of established rule.
|
|
19
|
-
* @param nType ruleType the integer represents filter rule class in server.
|
|
20
|
-
*/
|
|
21
|
-
function AbstractRule(isNegated, nType) {
|
|
22
|
-
var obj = {
|
|
23
|
-
negated: isNegated,
|
|
24
|
-
ruleType: nType
|
|
25
|
-
};
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* DurationRangeRule is the input for FilterRuleDeserializer
|
|
32
|
-
* in jayeson.model s an instance of DurationRangeFilterRule.
|
|
33
|
-
* @param isNegated
|
|
34
|
-
* @param durationLower int
|
|
35
|
-
* @param durationUpper int
|
|
36
|
-
*/
|
|
37
|
-
function DurationRangeRule(isNegated, durationLower, durationUpper) {
|
|
38
|
-
var obj = AbstractRule(isNegated, 1);
|
|
39
|
-
obj.durationLower = durationLower;
|
|
40
|
-
obj.durationUpper = durationUpper;
|
|
41
|
-
return obj;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* LayBackFilterRule is the input for FilterRuleDeserializer
|
|
46
|
-
* in jayeson.model s an instance of LayBackFilterRule.
|
|
47
|
-
* member variables : types is an array that contains LBType
|
|
48
|
-
* @param isNegated
|
|
49
|
-
*/
|
|
50
|
-
function LayBackFilterRule(isNegated) {
|
|
51
|
-
var obj = AbstractRule(isNegated, 2);
|
|
52
|
-
obj.types = new Array();
|
|
53
|
-
obj.addType = function (type) {
|
|
54
|
-
this.types[this.types.length] = LBType[type];
|
|
55
|
-
};
|
|
56
|
-
obj.removeType = function (index) {
|
|
57
|
-
this.types.splice(index, 1);
|
|
58
|
-
};
|
|
59
|
-
return obj;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* LeagueKeywordFilterRule is the input for FilterRuleDeserializer
|
|
64
|
-
* in jayeson.model s an instance of LeagueKeywordFilterRule.
|
|
65
|
-
* member variables : includeKeywords, excludeKeywords is an array that contains String
|
|
66
|
-
* @param isNegated
|
|
67
|
-
*/
|
|
68
|
-
function LeagueKeywordFilterRule(isNegated) {
|
|
69
|
-
var obj = AbstractRule(isNegated, 3);
|
|
70
|
-
obj.includeKeywords = new Array();
|
|
71
|
-
obj.excludeKeywords = new Array();
|
|
72
|
-
|
|
73
|
-
obj.addIncludeKeyword = function (keyword) {
|
|
74
|
-
this.includeKeywords[this.includeKeywords.length] = keyword.toLowerCase();
|
|
75
|
-
};
|
|
76
|
-
obj.removeIncludeKeyword = function (index) {
|
|
77
|
-
this.includeKeywords.splice(index, 1);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
obj.addExcludeKeyword = function (keyword) {
|
|
81
|
-
this.excludeKeywords[this.excludeKeywords.length] = keyword.toLowerCase();
|
|
82
|
-
};
|
|
83
|
-
obj.removeExcludeKeyword = function (index) {
|
|
84
|
-
this.excludeKeywords.splice(index, 1);
|
|
85
|
-
};
|
|
86
|
-
return obj;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* MarketFilterRule is the input for FilterRuleDeserializer
|
|
91
|
-
* in jayeson.model s an instance of MarketFilterRule.
|
|
92
|
-
* member variables : monitorMarketType is an OddType
|
|
93
|
-
* @param isNegated
|
|
94
|
-
* @param oddType OddType
|
|
95
|
-
*/
|
|
96
|
-
function MarketFilterRule(isNegated, oddType) {
|
|
97
|
-
var obj = AbstractRule(isNegated, 4);
|
|
98
|
-
obj.monitorMarketType = OddType[oddType];
|
|
99
|
-
return obj;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* PivotTypeFilterRule is the input for FilterRuleDeserializer
|
|
104
|
-
* in jayeson.model s an instance of PivotTypeFilterRule.
|
|
105
|
-
* member variables : types is an array that contains PivotType
|
|
106
|
-
* @param isNegated
|
|
107
|
-
*/
|
|
108
|
-
function PivotTypeFilterRule(isNegated) {
|
|
109
|
-
var obj = AbstractRule(isNegated, 5);
|
|
110
|
-
obj.types = new Array();
|
|
111
|
-
obj.addType = function (type) {
|
|
112
|
-
this.types[this.types.length] = PivotType[type];
|
|
113
|
-
};
|
|
114
|
-
obj.removeType = function (index) {
|
|
115
|
-
this.types.splice(index, 1);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
return obj;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* RedcardFilterRule is the input for FilterRuleDeserializer
|
|
123
|
-
* in jayeson.model s an instance of RedcardFilterRule.
|
|
124
|
-
* @param isNegated
|
|
125
|
-
* @param operator FilterOperator
|
|
126
|
-
* @param subject OperatorSubject
|
|
127
|
-
* @param expelled int
|
|
128
|
-
*/
|
|
129
|
-
function RedcardFilterRule(isNegated, operator, subject, expelled) {
|
|
130
|
-
var obj = AbstractRule(isNegated, 6);
|
|
131
|
-
obj.operator = FilterOperator[operator];
|
|
132
|
-
obj.subject = OperatorSubject[subject];
|
|
133
|
-
obj.expelled = expelled;
|
|
134
|
-
return obj;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* ScoreFilterRule is the input for FilterRuleDeserializer
|
|
139
|
-
* in jayeson.model s an instance of ScoreFilterRule.
|
|
140
|
-
* @param isNegated
|
|
141
|
-
* @param operator FilterOperator
|
|
142
|
-
* @param subject OperatorSubject
|
|
143
|
-
* @param score int
|
|
144
|
-
*/
|
|
145
|
-
function ScoreFilterRule(isNegated, operator, subject, score) {
|
|
146
|
-
var obj = AbstractRule(isNegated, 7);
|
|
147
|
-
obj.operator = FilterOperator[operator];
|
|
148
|
-
obj.subject = OperatorSubject[subject];
|
|
149
|
-
obj.score = score;
|
|
150
|
-
return obj;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* TargetFilterRule is the input for FilterRuleDeserializer
|
|
155
|
-
* in jayeson.model s an instance of TargetFilterRule.
|
|
156
|
-
* member variables : targetType is an TargetType
|
|
157
|
-
* @param isNegated
|
|
158
|
-
* @param targetType TargetType
|
|
159
|
-
*/
|
|
160
|
-
function TargetFilterRule(isNegated, targetType) {
|
|
161
|
-
var obj = AbstractRule(isNegated, 8);
|
|
162
|
-
obj.targetType = TargetType[targetType];
|
|
163
|
-
return obj;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* TeamKeywordFilterRule is the input for FilterRuleDeserializer
|
|
168
|
-
* in jayeson.model s an instance of TeamKeywordFilterRule.
|
|
169
|
-
* member variables : includeKeywords, excludeKeywords is an array that contains String
|
|
170
|
-
* @param isNegated
|
|
171
|
-
*/
|
|
172
|
-
function TeamKeywordFilterRule(isNegated) {
|
|
173
|
-
var obj = AbstractRule(isNegated, 9);
|
|
174
|
-
obj.includeKeywords = new Array();
|
|
175
|
-
obj.excludeKeywords = new Array();
|
|
176
|
-
|
|
177
|
-
obj.addIncludeKeyword = function (keyword) {
|
|
178
|
-
this.includeKeywords[this.includeKeywords.length] = keyword.toLowerCase();
|
|
179
|
-
};
|
|
180
|
-
obj.removeIncludeKeyword = function (index) {
|
|
181
|
-
this.includeKeywords.splice(index, 1);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
obj.addExcludeKeyword = function (keyword) {
|
|
185
|
-
this.excludeKeywords[this.excludeKeywords.length] = keyword.toLowerCase();
|
|
186
|
-
};
|
|
187
|
-
obj.removeExcludeKeyword = function (index) {
|
|
188
|
-
this.excludeKeywords.splice(index, 1);
|
|
189
|
-
};
|
|
190
|
-
return obj;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* CompanyKeywordFilterRule is the input for FilterRuleDeserializer
|
|
195
|
-
* in jayeson.model s an instance of CompanyKeywordFilterRule.
|
|
196
|
-
* member variables : includeKeywords, excludeKeywords is an array that contains String
|
|
197
|
-
* @param isNegated
|
|
198
|
-
* @returns
|
|
199
|
-
*/
|
|
200
|
-
function CompanyFilterRule(isNegated) {
|
|
201
|
-
var obj = AbstractRule(isNegated, 10);
|
|
202
|
-
obj.includeCompanies = new Array();
|
|
203
|
-
obj.excludeCompanies = new Array();
|
|
204
|
-
|
|
205
|
-
obj.addIncludeCompany = function (company) {
|
|
206
|
-
this.includeCompanies[this.includeCompanies.length] = company.toLowerCase();
|
|
207
|
-
};
|
|
208
|
-
obj.removeIncludeCompany = function (index) {
|
|
209
|
-
this.includeCompanies.splice(index, 1);
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
obj.addExcludeCompany = function (company) {
|
|
213
|
-
this.excludeCompanies[this.excludeCompanies.length] = company.toLowerCase();
|
|
214
|
-
};
|
|
215
|
-
obj.removeExcludeCompany = function (index) {
|
|
216
|
-
this.excludeCompanies.splice(index, 1);
|
|
217
|
-
};
|
|
218
|
-
return obj;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* RecordSelectorFilterRule is the input for FilterRuleDeserializer
|
|
223
|
-
* in jayeson.model s an instance of RecordSelectorFilterRule.
|
|
224
|
-
* @param isNegated
|
|
225
|
-
* @param eventId
|
|
226
|
-
* @param recordId
|
|
227
|
-
* @param companyId
|
|
228
|
-
*/
|
|
229
|
-
function RecordSelectorFilterRule(isNegated, matchId, eventId, recordId, companyId) {
|
|
230
|
-
var obj = AbstractRule(isNegated, 11);
|
|
231
|
-
obj.matchId = matchId;
|
|
232
|
-
obj.eventId = eventId;
|
|
233
|
-
obj.recordId = recordId;
|
|
234
|
-
obj.companyId = companyId;
|
|
235
|
-
return obj;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* TimeTypeFilterRule is the input for FilterRuleDeserializer
|
|
240
|
-
* in jayeson.model s an instance of TimeTypeFilterRule.
|
|
241
|
-
* member variables : types is an array that contains TimeType
|
|
242
|
-
* @param isNegated
|
|
243
|
-
*/
|
|
244
|
-
function TimeTypeFilterRule(isNegated) {
|
|
245
|
-
var obj = AbstractRule(isNegated, 12);
|
|
246
|
-
obj.types = new Array();
|
|
247
|
-
obj.addType = function (type) {
|
|
248
|
-
this.types[this.types.length] = type;
|
|
249
|
-
};
|
|
250
|
-
obj.removeType = function (index) {
|
|
251
|
-
this.types.splice(index, 1);
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
return obj;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* OddAvailabilityFilterRule is the input for FilterRuleDeserializer
|
|
259
|
-
* in jayeson.model s an instance of OddAvailabilityFilterRule.
|
|
260
|
-
* @param isNegated negated
|
|
261
|
-
* @param oddTypes
|
|
262
|
-
* @param timeTypes
|
|
263
|
-
* @param pivotTypes
|
|
264
|
-
*/
|
|
265
|
-
function OddAvailabilityFilterRule(isNegated) {
|
|
266
|
-
var obj = AbstractRule(isNegated, 13);
|
|
267
|
-
|
|
268
|
-
obj.oddTypes = new Array();
|
|
269
|
-
obj.addOddType = function (type) {
|
|
270
|
-
this.oddTypes[this.oddTypes.length] = OddType[type];
|
|
271
|
-
};
|
|
272
|
-
obj.removeOddType = function (index) {
|
|
273
|
-
this.oddTypes.splice(index, 1);
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
obj.timeTypes = new Array();
|
|
277
|
-
obj.addTimeType = function (type) {
|
|
278
|
-
this.timeTypes[this.timeTypes.length] = type;
|
|
279
|
-
};
|
|
280
|
-
obj.removeTimeType = function (index) {
|
|
281
|
-
this.timeTypes.splice(index, 1);
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
obj.pivotTypes = new Array();
|
|
285
|
-
obj.addPivotType = function (type) {
|
|
286
|
-
this.pivotTypes[this.pivotTypes.length] = PivotType[type];
|
|
287
|
-
};
|
|
288
|
-
obj.removePivotType = function (index) {
|
|
289
|
-
this.pivotTypes.splice(index, 1);
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
obj.companies = new Array();
|
|
293
|
-
obj.addCompany = function (company) {
|
|
294
|
-
var upperCase = company.toUpperCase();
|
|
295
|
-
if (this.companies.indexOf(upperCase) < 0) {
|
|
296
|
-
obj.companies.push(upperCase);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
obj.removeCompany = function (index) {
|
|
301
|
-
obj.companies.splice(index, 1);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
return obj;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* EventIdFilterRule is the input for FilterRuleDeserializer
|
|
309
|
-
* in jayeson.model s an instance of EventIdFilterRule.
|
|
310
|
-
* @param isNegated
|
|
311
|
-
* @param eventId
|
|
312
|
-
*/
|
|
313
|
-
function EventIdFilterRule(isNegated, eventId) {
|
|
314
|
-
var obj = AbstractRule(isNegated, 14);
|
|
315
|
-
obj.eventId = eventId;
|
|
316
|
-
return obj;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* OddTypeFilterRule is the input for FilterRuleDeserializer
|
|
321
|
-
* in jayeson.model s an instance of OddTypeFilterRule.
|
|
322
|
-
* member variables : oddTypes is a list of OddType
|
|
323
|
-
* @param isNegated
|
|
324
|
-
* @param oddTypes
|
|
325
|
-
*/
|
|
326
|
-
function OddTypeFilterRule(isNegated) {
|
|
327
|
-
var obj = AbstractRule(isNegated, 15);
|
|
328
|
-
obj.oddTypes = new Array();
|
|
329
|
-
obj.addType = function (type) {
|
|
330
|
-
this.oddTypes[this.oddTypes.length] = OddType[type];
|
|
331
|
-
};
|
|
332
|
-
obj.removeType = function (index) {
|
|
333
|
-
this.oddTypes.splice(index, 1);
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
return obj;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* StartTimeRangeFilterRule is the input for FilterRuleDeserializer
|
|
341
|
-
* in jayeson.model s an instance of StartTimeRangeFilterRule.
|
|
342
|
-
* @param isNegated
|
|
343
|
-
* @param startTimeLower in second
|
|
344
|
-
* @param startTimeUpper in second
|
|
345
|
-
*/
|
|
346
|
-
|
|
347
|
-
function StartTimeRangeFilterRule(isNegated, startTimeLower, startTimeUpper) {
|
|
348
|
-
var obj = AbstractRule(isNegated, 16);
|
|
349
|
-
obj.startTimeLower = startTimeLower;
|
|
350
|
-
obj.startTimeUpper = startTimeUpper;
|
|
351
|
-
return obj;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* RelativeStartTimeRangeFilterRule is the input for FilterRuleDeserializer
|
|
356
|
-
* in jayeson.model s an instance of RelativeStartTimeRangeFilterRule.
|
|
357
|
-
*
|
|
358
|
-
* It will not have a baseTime field as the base time will be the next 12pm
|
|
359
|
-
* set in the relayer based on the relayer host's time.
|
|
360
|
-
* @param isNegated
|
|
361
|
-
* @param startTimeLower in second
|
|
362
|
-
* @param startTimeUpper in second
|
|
363
|
-
*/
|
|
364
|
-
|
|
365
|
-
function RelativeStartTimeRangeFilterRule(isNegated, startTimeLower, startTimeUpper) {
|
|
366
|
-
var obj = AbstractRule(isNegated, 17);
|
|
367
|
-
obj.startTimeLower = startTimeLower;
|
|
368
|
-
obj.startTimeUpper = startTimeUpper;
|
|
369
|
-
return obj;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Group all available rules in a namespace
|
|
375
|
-
*/
|
|
376
|
-
function RuleCombination(ns) {
|
|
377
|
-
var obj = {
|
|
378
|
-
namespace: ns,
|
|
379
|
-
filterRules: new Array(),
|
|
380
|
-
addRule: function (rule) {
|
|
381
|
-
this.filterRules[this.filterRules.length] = rule;
|
|
382
|
-
},
|
|
383
|
-
removeRule: function (index) {
|
|
384
|
-
this.filterRules.splice(index, 1);
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
return obj;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* @properties namespace specify which namespace of filter.
|
|
392
|
-
* filterRules a list of integer that represent for ruleType.
|
|
393
|
-
* @usage use the class to build a message sent to DF so that DF remove the
|
|
394
|
-
* corresponding filterRule.
|
|
395
|
-
*/
|
|
396
|
-
function RemoveFilterRulesMessage(ns) {
|
|
397
|
-
var obj = {
|
|
398
|
-
namespace: ns,
|
|
399
|
-
filterRules: new Array(),
|
|
400
|
-
|
|
401
|
-
addRule: function (rule) {
|
|
402
|
-
this.filterRules[this.filterRules.length] = rule;
|
|
403
|
-
},
|
|
404
|
-
removeRule: function (index) {
|
|
405
|
-
this.filterRules.splice(index, 1);
|
|
406
|
-
},
|
|
407
|
-
getRule: function (index) {
|
|
408
|
-
return this.filterRules[index];
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
return obj;
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* ExactLeagueFilterRule is the input for FilterRuleDeserializer
|
|
417
|
-
* in jayeson.model s an instance of ExactLeagueFilterRule.
|
|
418
|
-
* member variables : includeLeagues is a set of unique league names that we want to include. If the set is empty, it means we want to include all leagues
|
|
419
|
-
* @param isNegated
|
|
420
|
-
*/
|
|
421
|
-
function ExactLeagueFilterRule(isNegated) {
|
|
422
|
-
var obj = AbstractRule(isNegated, 18);
|
|
423
|
-
obj.includeLeagues = new Array();
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
obj.addLeague = function (league) {
|
|
427
|
-
if (this.includeLeagues.indexOf(league) < 0) {
|
|
428
|
-
this.includeLeagues.push(league);
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
obj.removeLeague = function (league) {
|
|
432
|
-
var index = this.includeLeagues.indexOf(league);
|
|
433
|
-
if (index >= 0) {
|
|
434
|
-
this.includeLeagues.splice(index, 1);
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
return obj;
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* EventTypeFilterRule is the input for FilterRuleDeserializer
|
|
443
|
-
* in jayeson.model it is an instance of EventTypeFilterRule.
|
|
444
|
-
* member variables : eventTypes is a set of unique EventTypes. If the set is empty, it means we want to include all event types.
|
|
445
|
-
* @param isNegated
|
|
446
|
-
*/
|
|
447
|
-
function EventTypeFilterRule(isNegated) {
|
|
448
|
-
var obj = AbstractRule(isNegated, 19);
|
|
449
|
-
obj.eventTypes = new Array();
|
|
450
|
-
obj.addEventType = function (eventType) {
|
|
451
|
-
if (this.eventTypes.indexOf(eventType) < 0) {
|
|
452
|
-
this.eventTypes.push(eventType);
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
obj.removeEventType = function (eventType) {
|
|
456
|
-
var index = this.eventTypes.indexOf(eventType);
|
|
457
|
-
if (index >= 0) {
|
|
458
|
-
this.eventTypes.splice(index, 1);
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
return obj;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* TimePivotTypeFilterRule the input for FilterRuleDeserializer
|
|
467
|
-
* in jayeson.model it is an instance of TimePivotTypeFilterRule.
|
|
468
|
-
* member variables : timePivotTypes is a set of unique object {timeType: <timeType>, pivotType: <pivotType>}. If the set is timePivotTypes, it means we want to include all time_ pivot_type combination
|
|
469
|
-
* @param isNegated
|
|
470
|
-
*/
|
|
471
|
-
function TimePivotTypeFilterRule(isNegated) {
|
|
472
|
-
var obj = AbstractRule(isNegated, 20);
|
|
473
|
-
obj.timePivotTypes = new Array();
|
|
474
|
-
obj.addTimePivotType = function (timeType, pivotType) {
|
|
475
|
-
pivotType = PivotType[pivotType];
|
|
476
|
-
if (this.findIndex(timeType, pivotType) < 0) {
|
|
477
|
-
this.timePivotTypes.push({
|
|
478
|
-
timeType: timeType,
|
|
479
|
-
pivotType: pivotType
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
obj.removeTimePivotType = function (timeType, pivotType) {
|
|
485
|
-
var index = this.findIndex(timeType, pivotType);
|
|
486
|
-
if (index >= 0) {
|
|
487
|
-
this.timePivotTypes.splice(index, 1);
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
obj.findIndex = function (timeType, pivotType) {
|
|
492
|
-
var foundIndex = -1;
|
|
493
|
-
pivotType = PivotType[pivotType];
|
|
494
|
-
sportType = timeType.sportType();
|
|
495
|
-
name = timeType.name();
|
|
496
|
-
this.timePivotTypes.forEach(function (value, index) {
|
|
497
|
-
if (value.timeType.sportType() === sportType && value.timeType.name() === name && value.pivotType === pivotType) {
|
|
498
|
-
foundIndex = index;
|
|
499
|
-
}
|
|
500
|
-
})
|
|
501
|
-
return foundIndex;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
return obj;
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* EventAutoInclusionFilterRule the input for FilterRuleDeserializer
|
|
510
|
-
* in jayeson.model it is an instance of EventAutoInclusionFilterRule
|
|
511
|
-
*
|
|
512
|
-
* @param isNegated
|
|
513
|
-
*/
|
|
514
|
-
function EventAutoInclusionFilterRule(isNegated) {
|
|
515
|
-
var obj = AbstractRule(isNegated, 21);
|
|
516
|
-
obj.leagues = new Array();//store league id, currently we use league name's hash code
|
|
517
|
-
obj.matchEventIds = new Array();
|
|
518
|
-
|
|
519
|
-
obj.addLeague = function (leagueCode) {
|
|
520
|
-
if (this.leagues.indexOf(leagueCode) < 0) {
|
|
521
|
-
this.leagues.push(leagueCode);
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
|
|
525
|
-
obj.removeLeague = function (leagueCode) {
|
|
526
|
-
var index = this.leagues.indexOf(leagueCode)
|
|
527
|
-
if (index >= 0) {
|
|
528
|
-
this.leagues.splice(index, 1);
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
obj.addMatchEventId = function (matchId, eventId) {
|
|
533
|
-
if (this.findIndex(matchId, eventId) < 0) {
|
|
534
|
-
this.matchEventIds.push({
|
|
535
|
-
matchId: matchId,
|
|
536
|
-
eventId: eventId
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
obj.removeMatchEventId = function (matchId, eventId) {
|
|
542
|
-
var index = this.findIndex(matchId, eventId);
|
|
543
|
-
if (index >= 0) {
|
|
544
|
-
this.matchEventIds.splice(index, 1);
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
obj.findIndex = function (matchId, eventId) {
|
|
549
|
-
var foundIndex = -1;
|
|
550
|
-
this.matchEventIds.forEach(function (value, index) {
|
|
551
|
-
if (value.matchId === matchId && value.eventId === eventId) {
|
|
552
|
-
foundIndex = index;
|
|
553
|
-
}
|
|
554
|
-
})
|
|
555
|
-
return foundIndex;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
return obj;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* SportFilterRule the input for FilterRuleDeserializer
|
|
564
|
-
* in jayeson.model it is an instance of SportFilterRule
|
|
565
|
-
*
|
|
566
|
-
* @param isNegated
|
|
567
|
-
*/
|
|
568
|
-
function SportFilterRule(isNegated) {
|
|
569
|
-
var obj = AbstractRule(isNegated, 22);
|
|
570
|
-
|
|
571
|
-
obj.sportTypes = new Array();
|
|
572
|
-
|
|
573
|
-
obj.addSport = function(sportType) {
|
|
574
|
-
this.sportTypes.push(SportType[sportType]);
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
obj.removeSport = function (index) {
|
|
578
|
-
this.sportTypes.splice(index, 1);
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
return obj;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* LeagueTeamRegexFilterRule will have a property call includeRegex. It will
|
|
587
|
-
* pass all matches that have league or team name that satisfied the regex. if
|
|
588
|
-
* the regex is null or empty, return true (consider passed)
|
|
589
|
-
*
|
|
590
|
-
* @param isNegated
|
|
591
|
-
* @param regex
|
|
592
|
-
*/
|
|
593
|
-
function LeagueTeamRegexFilterRule(isNegated, regex){
|
|
594
|
-
var obj = AbstractRule(isNegated, 23);
|
|
595
|
-
|
|
596
|
-
obj.includeRegex = regex;
|
|
597
|
-
|
|
598
|
-
return obj;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* MatchSelectorFilterRule filters for a specific record using matchId, eventId
|
|
603
|
-
* and recordId.
|
|
604
|
-
*
|
|
605
|
-
* @param isNegated
|
|
606
|
-
* @param matchId
|
|
607
|
-
* @param eventId
|
|
608
|
-
* @param recordId
|
|
609
|
-
*/
|
|
610
|
-
function MatchSelectorFilterRule(isNegated, matchId, eventId, recordId) {
|
|
611
|
-
var obj = AbstractRule(isNegated, 24);
|
|
612
|
-
|
|
613
|
-
obj.matchId = matchId;
|
|
614
|
-
obj.eventId = eventId;
|
|
615
|
-
obj.recordId = recordId;
|
|
616
|
-
|
|
617
|
-
return obj;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* PivotBiasFilterRule filters based on the pivot bias of the record.
|
|
623
|
-
*
|
|
624
|
-
* @param isNegated
|
|
625
|
-
*/
|
|
626
|
-
function PivotBiasFilterRule(isNegated) {
|
|
627
|
-
var obj = AbstractRule(isNegated, 25);
|
|
628
|
-
|
|
629
|
-
obj.pivotBiases = new Array();
|
|
630
|
-
|
|
631
|
-
obj.addPivotBias = function(pivotBias) {
|
|
632
|
-
this.pivotBiases.push(PivotBias[pivotBias]);
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
obj.removePivotBias = function (index) {
|
|
636
|
-
this.pivotBiases.splice(index, 1);
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
return obj;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* MatchIdFilterRule is the input for FilterRuleDeserializer
|
|
644
|
-
* in jayeson.model s an instance of MatchIdFilterRule.
|
|
645
|
-
* @param isNegated
|
|
646
|
-
* @param matchId
|
|
647
|
-
*/
|
|
648
|
-
function MatchIdFilterRule(isNegated, matchId) {
|
|
649
|
-
var obj = AbstractRule(isNegated, 26);
|
|
650
|
-
obj.matchId = matchId;
|
|
651
|
-
return obj;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* LeagueHashCodeFilterRule filters matches using the hashcode of their
|
|
656
|
-
* league names.
|
|
657
|
-
*
|
|
658
|
-
* @param isNegated
|
|
659
|
-
*/
|
|
660
|
-
function LeagueHashCodeFilterRule(isNegated) {
|
|
661
|
-
var obj = AbstractRule(isNegated, 27);
|
|
662
|
-
obj.leagueHashCodes = new Array();//store league id, currently we use league name's hash code string
|
|
663
|
-
|
|
664
|
-
obj.addLeagueCode = function (leagueCode) {
|
|
665
|
-
if (this.leagueHashCodes.indexOf(leagueCode) < 0) {
|
|
666
|
-
this.leagueHashCodes.push(leagueCode);
|
|
667
|
-
}
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
obj.removeLeagueCode = function (leagueCode) {
|
|
671
|
-
var index = this.leagueHashCodes.indexOf(leagueCode)
|
|
672
|
-
if (index >= 0) {
|
|
673
|
-
this.leagueHashCodes.splice(index, 1);
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
return obj;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* MatchEventIdFilterRule filters events by testing their
|
|
682
|
-
* event ids and match ids against those defined in this rule.
|
|
683
|
-
*
|
|
684
|
-
* @param isNegated
|
|
685
|
-
*/
|
|
686
|
-
function MatchEventIdFilterRule(isNegated) {
|
|
687
|
-
var obj = AbstractRule(isNegated, 28);
|
|
688
|
-
obj.ids = new Array();
|
|
689
|
-
|
|
690
|
-
obj.addMatchEventId = function (matchId, eventId) {
|
|
691
|
-
if (this.findIndex(matchId, eventId) < 0) {
|
|
692
|
-
this.ids.push({
|
|
693
|
-
matchId: matchId,
|
|
694
|
-
eventId: eventId
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
|
|
699
|
-
obj.removeMatchEventId = function (matchId, eventId) {
|
|
700
|
-
var index = this.findIndex(matchId, eventId);
|
|
701
|
-
if (index >= 0) {
|
|
702
|
-
this.ids.splice(index, 1);
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
obj.findIndex = function (matchId, eventId) {
|
|
707
|
-
var foundIndex = -1;
|
|
708
|
-
this.ids.forEach(function (value, index) {
|
|
709
|
-
if (value.matchId === matchId && value.eventId === eventId) {
|
|
710
|
-
foundIndex = index;
|
|
711
|
-
}
|
|
712
|
-
})
|
|
713
|
-
return foundIndex;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
return obj;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
/**
|
|
721
|
-
* MatchAutoInclusionFilterRule filters for matches with specific match ids
|
|
722
|
-
* or belonging to specific leagues.
|
|
723
|
-
*
|
|
724
|
-
* @param isNegated
|
|
725
|
-
*/
|
|
726
|
-
function MatchAutoInclusionFilterRule(isNegated) {
|
|
727
|
-
var obj = AbstractRule(isNegated, 29);
|
|
728
|
-
obj.leagues = new Array();//store league id, currently we use league name's hash code
|
|
729
|
-
obj.matchIds = new Array();
|
|
730
|
-
|
|
731
|
-
obj.addLeague = function (leagueCode) {
|
|
732
|
-
if (this.leagues.indexOf(leagueCode) < 0) {
|
|
733
|
-
this.leagues.push(leagueCode);
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
|
|
737
|
-
obj.removeLeague = function (leagueCode) {
|
|
738
|
-
var index = this.leagues.indexOf(leagueCode)
|
|
739
|
-
if (index >= 0) {
|
|
740
|
-
this.leagues.splice(index, 1);
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
obj.addMatchId = function (matchId) {
|
|
745
|
-
if (this.findIndex(matchId) < 0) {
|
|
746
|
-
this.matchIds.push(matchId);
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
|
|
750
|
-
obj.removeMatchId = function (matchId) {
|
|
751
|
-
var index = this.findIndex(matchId);
|
|
752
|
-
if (index >= 0) {
|
|
753
|
-
this.matchIds.splice(index, 1);
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
obj.findIndex = function (matchId) {
|
|
758
|
-
var foundIndex = -1;
|
|
759
|
-
|
|
760
|
-
var len = this.matchIds.length;
|
|
761
|
-
for (var i = 0; i < len; i++) {
|
|
762
|
-
if (this.matchIds[i] === matchId) {
|
|
763
|
-
return i;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
return foundIndex;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
return obj;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
var FilterOperator;
|
|
774
|
-
(function (FilterOperator) {
|
|
775
|
-
FilterOperator[FilterOperator["FILTER_IGNORED"] = 0] = "FILTER_IGNORED";
|
|
776
|
-
FilterOperator[FilterOperator["FILTER_LARGER"] = 1] = "FILTER_LARGER";
|
|
777
|
-
FilterOperator[FilterOperator["FILTER_LARGER_EQUAL"] = 2] = "FILTER_LARGER_EQUAL";
|
|
778
|
-
FilterOperator[FilterOperator["FILTER_EQUAL"] = 3] = "FILTER_EQUAL";
|
|
779
|
-
FilterOperator[FilterOperator["FILTER_SMALLER_EQUAL"] = 4] = "FILTER_SMALLER_EQUAL";
|
|
780
|
-
FilterOperator[FilterOperator["FILTER_SMALLER"] = 5] = "FILTER_SMALLER";
|
|
781
|
-
})(FilterOperator = exports.FilterOperator || (exports.FilterOperator = {}));
|
|
782
|
-
|
|
783
|
-
var OperatorSubject;
|
|
784
|
-
(function (OperatorSubject) {
|
|
785
|
-
OperatorSubject[OperatorSubject["HOST"] = 0] = "HOST";
|
|
786
|
-
OperatorSubject[OperatorSubject["GUEST"] = 1] = "GUEST";
|
|
787
|
-
OperatorSubject[OperatorSubject["FAVORED"] = 2] = "FAVORED";
|
|
788
|
-
OperatorSubject[OperatorSubject["UNDERDOG"] = 3] = "UNDERDOG";
|
|
789
|
-
OperatorSubject[OperatorSubject["DIFFERENCE"] = 4] = "DIFFERENCE";
|
|
790
|
-
OperatorSubject[OperatorSubject["HOST_LEADING"] = 5] = "HOST_LEADING";
|
|
791
|
-
OperatorSubject[OperatorSubject["GUEST_LEADING"] = 6] = "GUEST_LEADING";
|
|
792
|
-
OperatorSubject[OperatorSubject["FAVORED_LEADING"] = 7] = "FAVORED_LEADING";
|
|
793
|
-
OperatorSubject[OperatorSubject["UNDERDOG_LEADING"] = 8] = "UNDERDOG_LEADING";
|
|
794
|
-
OperatorSubject[OperatorSubject["TOTAL"] = 9] = "TOTAL";
|
|
795
|
-
})(OperatorSubject = exports.OperatorSubject || (exports.OperatorSubject = {}));
|
|
796
|
-
|
|
797
|
-
module.exports = {
|
|
798
|
-
AbstractRule: AbstractRule,
|
|
799
|
-
DurationRangeRule: DurationRangeRule,
|
|
800
|
-
LayBackFilterRule: LayBackFilterRule,
|
|
801
|
-
LeagueKeywordFilterRule: LeagueKeywordFilterRule,
|
|
802
|
-
MarketFilterRule: MarketFilterRule,
|
|
803
|
-
PivotTypeFilterRule: PivotTypeFilterRule,
|
|
804
|
-
RedcardFilterRule: RedcardFilterRule,
|
|
805
|
-
ScoreFilterRule: ScoreFilterRule,
|
|
806
|
-
TargetFilterRule: TargetFilterRule,
|
|
807
|
-
TeamKeywordFilterRule: TeamKeywordFilterRule,
|
|
808
|
-
CompanyFilterRule: CompanyFilterRule,
|
|
809
|
-
TimeTypeFilterRule: TimeTypeFilterRule,
|
|
810
|
-
RecordSelectorFilterRule: RecordSelectorFilterRule,
|
|
811
|
-
OddAvailabilityFilterRule: OddAvailabilityFilterRule,
|
|
812
|
-
EventIdFilterRule: EventIdFilterRule,
|
|
813
|
-
OddTypeFilterRule: OddTypeFilterRule,
|
|
814
|
-
StartTimeRangeFilterRule: StartTimeRangeFilterRule,
|
|
815
|
-
RelativeStartTimeRangeFilterRule: RelativeStartTimeRangeFilterRule,
|
|
816
|
-
RuleCombination: RuleCombination,
|
|
817
|
-
RemoveFilterRulesMessage: RemoveFilterRulesMessage,
|
|
818
|
-
ExactLeagueFilterRule: ExactLeagueFilterRule,
|
|
819
|
-
EventTypeFilterRule: EventTypeFilterRule,
|
|
820
|
-
TimePivotTypeFilterRule: TimePivotTypeFilterRule,
|
|
821
|
-
EventAutoInclusionFilterRule: EventAutoInclusionFilterRule,
|
|
822
|
-
SportFilterRule: SportFilterRule,
|
|
823
|
-
LeagueTeamRegexFilterRule: LeagueTeamRegexFilterRule,
|
|
824
|
-
MatchSelectorFilterRule: MatchSelectorFilterRule,
|
|
825
|
-
PivotBiasFilterRule: PivotBiasFilterRule,
|
|
826
|
-
MatchIdFilterRule: MatchIdFilterRule,
|
|
827
|
-
LeagueHashCodeFilterRule: LeagueHashCodeFilterRule,
|
|
828
|
-
MatchEventIdFilterRule: MatchEventIdFilterRule,
|
|
829
|
-
MatchAutoInclusionFilterRule: MatchAutoInclusionFilterRule,
|
|
830
|
-
FilterOperator: FilterOperator,
|
|
831
|
-
OperatorSubject: OperatorSubject
|
|
832
|
-
};
|
|
1
|
+
var FilterOperator,OperatorSubject,SportType=require("@jayesol/jayeson.lib.record").SportType,LBType=require("@jayesol/jayeson.lib.record").LBType,PivotType=require("@jayesol/jayeson.lib.record").PivotType,OddType=require("@jayesol/jayeson.lib.record").OddType,TargetType=require("@jayesol/jayeson.lib.record").TargetType,PivotBias=require("@jayesol/jayeson.lib.record").PivotBias;function AbstractRule(e,t){return{negated:e,ruleType:t}}function DurationRangeRule(e,t,r){var i=AbstractRule(e,1);return i.durationLower=t,i.durationUpper=r,i}function LayBackFilterRule(e){var t=AbstractRule(e,2);return t.types=new Array,t.addType=function(e){this.types[this.types.length]=LBType[e]},t.removeType=function(e){this.types.splice(e,1)},t}function LeagueKeywordFilterRule(e){var t=AbstractRule(e,3);return t.includeKeywords=new Array,t.excludeKeywords=new Array,t.addIncludeKeyword=function(e){this.includeKeywords[this.includeKeywords.length]=e.toLowerCase()},t.removeIncludeKeyword=function(e){this.includeKeywords.splice(e,1)},t.addExcludeKeyword=function(e){this.excludeKeywords[this.excludeKeywords.length]=e.toLowerCase()},t.removeExcludeKeyword=function(e){this.excludeKeywords.splice(e,1)},t}function MarketFilterRule(e,t){var r=AbstractRule(e,4);return r.monitorMarketType=OddType[t],r}function PivotTypeFilterRule(e){var t=AbstractRule(e,5);return t.types=new Array,t.addType=function(e){this.types[this.types.length]=PivotType[e]},t.removeType=function(e){this.types.splice(e,1)},t}function RedcardFilterRule(e,t,r,i){var n=AbstractRule(e,6);return n.operator=FilterOperator[t],n.subject=OperatorSubject[r],n.expelled=i,n}function ScoreFilterRule(e,t,r,i){var n=AbstractRule(e,7);return n.operator=FilterOperator[t],n.subject=OperatorSubject[r],n.score=i,n}function TargetFilterRule(e,t){var r=AbstractRule(e,8);return r.targetType=TargetType[t],r}function TeamKeywordFilterRule(e){var t=AbstractRule(e,9);return t.includeKeywords=new Array,t.excludeKeywords=new Array,t.addIncludeKeyword=function(e){this.includeKeywords[this.includeKeywords.length]=e.toLowerCase()},t.removeIncludeKeyword=function(e){this.includeKeywords.splice(e,1)},t.addExcludeKeyword=function(e){this.excludeKeywords[this.excludeKeywords.length]=e.toLowerCase()},t.removeExcludeKeyword=function(e){this.excludeKeywords.splice(e,1)},t}function CompanyFilterRule(e){var t=AbstractRule(e,10);return t.includeCompanies=new Array,t.excludeCompanies=new Array,t.addIncludeCompany=function(e){this.includeCompanies[this.includeCompanies.length]=e.toLowerCase()},t.removeIncludeCompany=function(e){this.includeCompanies.splice(e,1)},t.addExcludeCompany=function(e){this.excludeCompanies[this.excludeCompanies.length]=e.toLowerCase()},t.removeExcludeCompany=function(e){this.excludeCompanies.splice(e,1)},t}function RecordSelectorFilterRule(e,t,r,i,n){var u=AbstractRule(e,11);return u.matchId=t,u.eventId=r,u.recordId=i,u.companyId=n,u}function TimeTypeFilterRule(e){var t=AbstractRule(e,12);return t.types=new Array,t.addType=function(e){this.types[this.types.length]=e},t.removeType=function(e){this.types.splice(e,1)},t}function OddAvailabilityFilterRule(e){var t=AbstractRule(e,13);return t.oddTypes=new Array,t.addOddType=function(e){this.oddTypes[this.oddTypes.length]=OddType[e]},t.removeOddType=function(e){this.oddTypes.splice(e,1)},t.timeTypes=new Array,t.addTimeType=function(e){this.timeTypes[this.timeTypes.length]=e},t.removeTimeType=function(e){this.timeTypes.splice(e,1)},t.pivotTypes=new Array,t.addPivotType=function(e){this.pivotTypes[this.pivotTypes.length]=PivotType[e]},t.removePivotType=function(e){this.pivotTypes.splice(e,1)},t.companies=new Array,t.addCompany=function(e){var r=e.toUpperCase();this.companies.indexOf(r)<0&&t.companies.push(r)},t.removeCompany=function(e){t.companies.splice(e,1)},t}function EventIdFilterRule(e,t){var r=AbstractRule(e,14);return r.eventId=t,r}function OddTypeFilterRule(e){var t=AbstractRule(e,15);return t.oddTypes=new Array,t.addType=function(e){this.oddTypes[this.oddTypes.length]=OddType[e]},t.removeType=function(e){this.oddTypes.splice(e,1)},t}function StartTimeRangeFilterRule(e,t,r){var i=AbstractRule(e,16);return i.startTimeLower=t,i.startTimeUpper=r,i}function RelativeStartTimeRangeFilterRule(e,t,r){var i=AbstractRule(e,17);return i.startTimeLower=t,i.startTimeUpper=r,i}function RuleCombination(e){return{namespace:e,filterRules:new Array,addRule:function(e){this.filterRules[this.filterRules.length]=e},removeRule:function(e){this.filterRules.splice(e,1)}}}function RemoveFilterRulesMessage(e){return{namespace:e,filterRules:new Array,addRule:function(e){this.filterRules[this.filterRules.length]=e},removeRule:function(e){this.filterRules.splice(e,1)},getRule:function(e){return this.filterRules[e]}}}function ExactLeagueFilterRule(e){var t=AbstractRule(e,18);return t.includeLeagues=new Array,t.addLeague=function(e){this.includeLeagues.indexOf(e)<0&&this.includeLeagues.push(e)},t.removeLeague=function(e){var t=this.includeLeagues.indexOf(e);t>=0&&this.includeLeagues.splice(t,1)},t}function EventTypeFilterRule(e){var t=AbstractRule(e,19);return t.eventTypes=new Array,t.addEventType=function(e){this.eventTypes.indexOf(e)<0&&this.eventTypes.push(e)},t.removeEventType=function(e){var t=this.eventTypes.indexOf(e);t>=0&&this.eventTypes.splice(t,1)},t}function TimePivotTypeFilterRule(e){var t=AbstractRule(e,20);return t.timePivotTypes=new Array,t.addTimePivotType=function(e,t){t=PivotType[t],this.findIndex(e,t)<0&&this.timePivotTypes.push({timeType:e,pivotType:t})},t.removeTimePivotType=function(e,t){var r=this.findIndex(e,t);r>=0&&this.timePivotTypes.splice(r,1)},t.findIndex=function(e,t){var r=-1;return t=PivotType[t],sportType=e.sportType(),name=e.name(),this.timePivotTypes.forEach(function(e,i){e.timeType.sportType()===sportType&&e.timeType.name()===name&&e.pivotType===t&&(r=i)}),r},t}function EventAutoInclusionFilterRule(e){var t=AbstractRule(e,21);return t.leagues=new Array,t.matchEventIds=new Array,t.addLeague=function(e){this.leagues.indexOf(e)<0&&this.leagues.push(e)},t.removeLeague=function(e){var t=this.leagues.indexOf(e);t>=0&&this.leagues.splice(t,1)},t.addMatchEventId=function(e,t){this.findIndex(e,t)<0&&this.matchEventIds.push({matchId:e,eventId:t})},t.removeMatchEventId=function(e,t){var r=this.findIndex(e,t);r>=0&&this.matchEventIds.splice(r,1)},t.findIndex=function(e,t){var r=-1;return this.matchEventIds.forEach(function(i,n){i.matchId===e&&i.eventId===t&&(r=n)}),r},t}function SportFilterRule(e){var t=AbstractRule(e,22);return t.sportTypes=new Array,t.addSport=function(e){this.sportTypes.push(SportType[e])},t.removeSport=function(e){this.sportTypes.splice(e,1)},t}function LeagueTeamRegexFilterRule(e,t){var r=AbstractRule(e,23);return r.includeRegex=t,r}function MatchSelectorFilterRule(e,t,r,i){var n=AbstractRule(e,24);return n.matchId=t,n.eventId=r,n.recordId=i,n}function PivotBiasFilterRule(e){var t=AbstractRule(e,25);return t.pivotBiases=new Array,t.addPivotBias=function(e){this.pivotBiases.push(PivotBias[e])},t.removePivotBias=function(e){this.pivotBiases.splice(e,1)},t}function MatchIdFilterRule(e,t){var r=AbstractRule(e,26);return r.matchId=t,r}function LeagueHashCodeFilterRule(e){var t=AbstractRule(e,27);return t.leagueHashCodes=new Array,t.addLeagueCode=function(e){this.leagueHashCodes.indexOf(e)<0&&this.leagueHashCodes.push(e)},t.removeLeagueCode=function(e){var t=this.leagueHashCodes.indexOf(e);t>=0&&this.leagueHashCodes.splice(t,1)},t}function MatchEventIdFilterRule(e){var t=AbstractRule(e,28);return t.ids=new Array,t.addMatchEventId=function(e,t){this.findIndex(e,t)<0&&this.ids.push({matchId:e,eventId:t})},t.removeMatchEventId=function(e,t){var r=this.findIndex(e,t);r>=0&&this.ids.splice(r,1)},t.findIndex=function(e,t){var r=-1;return this.ids.forEach(function(i,n){i.matchId===e&&i.eventId===t&&(r=n)}),r},t}function MatchAutoInclusionFilterRule(e){var t=AbstractRule(e,29);return t.leagues=new Array,t.matchIds=new Array,t.addLeague=function(e){this.leagues.indexOf(e)<0&&this.leagues.push(e)},t.removeLeague=function(e){var t=this.leagues.indexOf(e);t>=0&&this.leagues.splice(t,1)},t.addMatchId=function(e){this.findIndex(e)<0&&this.matchIds.push(e)},t.removeMatchId=function(e){var t=this.findIndex(e);t>=0&&this.matchIds.splice(t,1)},t.findIndex=function(e){for(var t=this.matchIds.length,r=0;r<t;r++)if(this.matchIds[r]===e)return r;return-1},t}!function(e){e[e.FILTER_IGNORED=0]="FILTER_IGNORED",e[e.FILTER_LARGER=1]="FILTER_LARGER",e[e.FILTER_LARGER_EQUAL=2]="FILTER_LARGER_EQUAL",e[e.FILTER_EQUAL=3]="FILTER_EQUAL",e[e.FILTER_SMALLER_EQUAL=4]="FILTER_SMALLER_EQUAL",e[e.FILTER_SMALLER=5]="FILTER_SMALLER"}(FilterOperator=exports.FilterOperator||(exports.FilterOperator={})),function(e){e[e.HOST=0]="HOST",e[e.GUEST=1]="GUEST",e[e.FAVORED=2]="FAVORED",e[e.UNDERDOG=3]="UNDERDOG",e[e.DIFFERENCE=4]="DIFFERENCE",e[e.HOST_LEADING=5]="HOST_LEADING",e[e.GUEST_LEADING=6]="GUEST_LEADING",e[e.FAVORED_LEADING=7]="FAVORED_LEADING",e[e.UNDERDOG_LEADING=8]="UNDERDOG_LEADING",e[e.TOTAL=9]="TOTAL"}(OperatorSubject=exports.OperatorSubject||(exports.OperatorSubject={})),module.exports={AbstractRule:AbstractRule,DurationRangeRule:DurationRangeRule,LayBackFilterRule:LayBackFilterRule,LeagueKeywordFilterRule:LeagueKeywordFilterRule,MarketFilterRule:MarketFilterRule,PivotTypeFilterRule:PivotTypeFilterRule,RedcardFilterRule:RedcardFilterRule,ScoreFilterRule:ScoreFilterRule,TargetFilterRule:TargetFilterRule,TeamKeywordFilterRule:TeamKeywordFilterRule,CompanyFilterRule:CompanyFilterRule,TimeTypeFilterRule:TimeTypeFilterRule,RecordSelectorFilterRule:RecordSelectorFilterRule,OddAvailabilityFilterRule:OddAvailabilityFilterRule,EventIdFilterRule:EventIdFilterRule,OddTypeFilterRule:OddTypeFilterRule,StartTimeRangeFilterRule:StartTimeRangeFilterRule,RelativeStartTimeRangeFilterRule:RelativeStartTimeRangeFilterRule,RuleCombination:RuleCombination,RemoveFilterRulesMessage:RemoveFilterRulesMessage,ExactLeagueFilterRule:ExactLeagueFilterRule,EventTypeFilterRule:EventTypeFilterRule,TimePivotTypeFilterRule:TimePivotTypeFilterRule,EventAutoInclusionFilterRule:EventAutoInclusionFilterRule,SportFilterRule:SportFilterRule,LeagueTeamRegexFilterRule:LeagueTeamRegexFilterRule,MatchSelectorFilterRule:MatchSelectorFilterRule,PivotBiasFilterRule:PivotBiasFilterRule,MatchIdFilterRule:MatchIdFilterRule,LeagueHashCodeFilterRule:LeagueHashCodeFilterRule,MatchEventIdFilterRule:MatchEventIdFilterRule,MatchAutoInclusionFilterRule:MatchAutoInclusionFilterRule,FilterOperator:FilterOperator,OperatorSubject:OperatorSubject};
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jayesol/jayeson.model",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1-beta2",
|
|
4
4
|
"description": "Javascript implementation for jayeson.model library",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "gulp test",
|
|
9
|
-
"
|
|
9
|
+
"build": "gulp dist",
|
|
10
|
+
"prepack": "npx gulp compile",
|
|
11
|
+
"prepare": "npx gulp compile"
|
|
10
12
|
},
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git"
|
|
@@ -17,18 +19,25 @@
|
|
|
17
19
|
"author": "",
|
|
18
20
|
"license": "ISC",
|
|
19
21
|
"dependencies": {
|
|
20
|
-
"@jayesol/jayeson.lib.record": "^2.1.
|
|
21
|
-
"gulp-uglify": "^3.0.0",
|
|
22
|
-
"typescript": "^2.3.3"
|
|
22
|
+
"@jayesol/jayeson.lib.record": "^2.1.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"typescript": "^5.3.3",
|
|
26
|
+
"@types/jasmine": "^5.1.4",
|
|
27
|
+
"@types/node": "^20.10.5",
|
|
28
|
+
"chai": "^4.3.10",
|
|
29
|
+
"del": "^7.1.0",
|
|
30
|
+
"glob": "^10.3.10",
|
|
28
31
|
"gulp": "^4.0.2",
|
|
29
32
|
"gulp-install": "^1.1.0",
|
|
30
|
-
"gulp-jasmine": "^
|
|
31
|
-
"gulp-typescript": "^
|
|
32
|
-
"
|
|
33
|
+
"gulp-jasmine": "^4.0.0",
|
|
34
|
+
"gulp-typescript": "^6.0.0-alpha.1",
|
|
35
|
+
"gulp-terser": "^2.1.0",
|
|
36
|
+
"terser": "^5.44.1",
|
|
37
|
+
"semver": "^7.5.4",
|
|
38
|
+
"jasmine": "^5.1.0"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18.0.0"
|
|
33
42
|
}
|
|
34
|
-
}
|
|
43
|
+
}
|