tods-competition-factory 2.0.0-beta.0 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -14
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.d.ts +223 -424
- package/dist/tods-competition-factory.development.cjs.js +706 -761
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +6 -12
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.0.0-beta.
|
|
6
|
+
return '2.0.0-beta.2';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -2070,174 +2070,6 @@ function findExtension(_a) {
|
|
|
2070
2070
|
return { extension: extension, info: info };
|
|
2071
2071
|
}
|
|
2072
2072
|
|
|
2073
|
-
var DYNAMIC = 'DYNAMIC';
|
|
2074
|
-
var RANKING$1 = 'RANKING';
|
|
2075
|
-
var RATING$2 = 'RATING';
|
|
2076
|
-
var SCALE$1 = 'SCALE';
|
|
2077
|
-
var SEEDING$1 = 'SEEDING';
|
|
2078
|
-
var scaleConstants = {
|
|
2079
|
-
RANKING: RANKING$1,
|
|
2080
|
-
RATING: RATING$2,
|
|
2081
|
-
SCALE: SCALE$1,
|
|
2082
|
-
SEEDING: SEEDING$1,
|
|
2083
|
-
};
|
|
2084
|
-
|
|
2085
|
-
var SINGLES$1 = 'SINGLES';
|
|
2086
|
-
var SINGLES_EVENT = 'SINGLES';
|
|
2087
|
-
var DOUBLES$1 = 'DOUBLES';
|
|
2088
|
-
var DOUBLES_EVENT = 'DOUBLES';
|
|
2089
|
-
var TEAM$2 = 'TEAM';
|
|
2090
|
-
var TEAM_EVENT = 'TEAM';
|
|
2091
|
-
var AGE = 'AGE';
|
|
2092
|
-
var RATING$1 = 'RATING';
|
|
2093
|
-
var BOTH = 'BOTH';
|
|
2094
|
-
var eventConstants = {
|
|
2095
|
-
AGE: AGE,
|
|
2096
|
-
BOTH: BOTH,
|
|
2097
|
-
DOUBLES: DOUBLES$1,
|
|
2098
|
-
DOUBLES_EVENT: DOUBLES_EVENT,
|
|
2099
|
-
RATING: RATING$1,
|
|
2100
|
-
SINGLES: SINGLES$1,
|
|
2101
|
-
SINGLES_EVENT: SINGLES_EVENT,
|
|
2102
|
-
TEAM_EVENT: TEAM_EVENT,
|
|
2103
|
-
TEAM: TEAM$2,
|
|
2104
|
-
};
|
|
2105
|
-
|
|
2106
|
-
function getScaleValues(_a) {
|
|
2107
|
-
var e_1, _b;
|
|
2108
|
-
var _c;
|
|
2109
|
-
var participant = _a.participant;
|
|
2110
|
-
var scaleItems = (_c = participant.timeItems) === null || _c === void 0 ? void 0 : _c.filter(function (_a) {
|
|
2111
|
-
var itemType = _a.itemType;
|
|
2112
|
-
return (itemType === null || itemType === void 0 ? void 0 : itemType.startsWith(SCALE$1)) &&
|
|
2113
|
-
[RANKING$1, RATING$2, SEEDING$1].includes(itemType.split('.')[1]);
|
|
2114
|
-
});
|
|
2115
|
-
var scales = { ratings: {}, rankings: {}, seedings: {} };
|
|
2116
|
-
if (scaleItems === null || scaleItems === void 0 ? void 0 : scaleItems.length) {
|
|
2117
|
-
var latestScaleItem = function (scaleType) {
|
|
2118
|
-
return scaleItems
|
|
2119
|
-
.filter(function (timeItem) { return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) === scaleType; })
|
|
2120
|
-
.sort(function (a, b) {
|
|
2121
|
-
return new Date(a.createdAt || undefined).getTime() -
|
|
2122
|
-
new Date(b.createdAt || undefined).getTime();
|
|
2123
|
-
})
|
|
2124
|
-
.pop();
|
|
2125
|
-
};
|
|
2126
|
-
var itemTypes = unique(scaleItems.map(function (_a) {
|
|
2127
|
-
var itemType = _a.itemType;
|
|
2128
|
-
return itemType;
|
|
2129
|
-
}));
|
|
2130
|
-
try {
|
|
2131
|
-
for (var itemTypes_1 = __values(itemTypes), itemTypes_1_1 = itemTypes_1.next(); !itemTypes_1_1.done; itemTypes_1_1 = itemTypes_1.next()) {
|
|
2132
|
-
var itemType = itemTypes_1_1.value;
|
|
2133
|
-
var scaleItem = latestScaleItem(itemType);
|
|
2134
|
-
if (scaleItem) {
|
|
2135
|
-
var _d = __read(scaleItem.itemType.split('.'), 5), type = _d[1], format = _d[2], scaleName = _d[3], modifier = _d[4];
|
|
2136
|
-
var namedScale = modifier ? "".concat(scaleName, ".").concat(modifier) : scaleName;
|
|
2137
|
-
var scaleType = (type === SEEDING$1 && 'seedings') ||
|
|
2138
|
-
(type === RANKING$1 && 'rankings') ||
|
|
2139
|
-
'ratings';
|
|
2140
|
-
if (!scales[scaleType][format])
|
|
2141
|
-
scales[scaleType][format] = [];
|
|
2142
|
-
scales[scaleType][format].push({
|
|
2143
|
-
scaleValue: scaleItem.itemValue,
|
|
2144
|
-
scaleDate: scaleItem.itemDate,
|
|
2145
|
-
scaleName: namedScale,
|
|
2146
|
-
});
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2151
|
-
finally {
|
|
2152
|
-
try {
|
|
2153
|
-
if (itemTypes_1_1 && !itemTypes_1_1.done && (_b = itemTypes_1.return)) _b.call(itemTypes_1);
|
|
2154
|
-
}
|
|
2155
|
-
finally { if (e_1) throw e_1.error; }
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
return __assign(__assign({}, SUCCESS), scales);
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
// NOTE: type really does need to be any!
|
|
2162
|
-
function attributeFilter(params) {
|
|
2163
|
-
if (params === null)
|
|
2164
|
-
return {};
|
|
2165
|
-
var _a = params || {}, source = _a.source, template = _a.template;
|
|
2166
|
-
if (!template)
|
|
2167
|
-
return source;
|
|
2168
|
-
var target = {};
|
|
2169
|
-
attributeCopy(source, template, target);
|
|
2170
|
-
return target;
|
|
2171
|
-
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
2172
|
-
var e_1, _a;
|
|
2173
|
-
if (!valuesObject || !templateObject)
|
|
2174
|
-
return undefined;
|
|
2175
|
-
var vKeys = Object.keys(valuesObject);
|
|
2176
|
-
var oKeys = Object.keys(templateObject);
|
|
2177
|
-
// the orMap allows spcification of { 'a||b': boolean } so that filter templates can apply to multiple attributes
|
|
2178
|
-
var orMap = Object.assign.apply(Object, __spreadArray([{}], __read(oKeys
|
|
2179
|
-
.filter(function (key) { return key.indexOf('||'); })
|
|
2180
|
-
.map(function (key) { return key.split('||').map(function (or) {
|
|
2181
|
-
var _a;
|
|
2182
|
-
return (_a = {}, _a[or] = key, _a);
|
|
2183
|
-
}); })
|
|
2184
|
-
.flat()), false));
|
|
2185
|
-
var allKeys = oKeys.concat.apply(oKeys, __spreadArray([], __read(Object.keys(orMap)), false));
|
|
2186
|
-
var wildcard = allKeys.includes('*');
|
|
2187
|
-
var _loop_1 = function (vKey) {
|
|
2188
|
-
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
2189
|
-
var templateKey = orMap[vKey] || vKey;
|
|
2190
|
-
var tobj_1 = templateObject[templateKey] || wildcard;
|
|
2191
|
-
var vobj = valuesObject[vKey];
|
|
2192
|
-
if (typeof tobj_1 === 'object' &&
|
|
2193
|
-
typeof vobj !== 'function' &&
|
|
2194
|
-
!Array.isArray(tobj_1)) {
|
|
2195
|
-
if (Array.isArray(vobj)) {
|
|
2196
|
-
var mappedElements = vobj
|
|
2197
|
-
.map(function (arrayMember) {
|
|
2198
|
-
var target = {};
|
|
2199
|
-
var result = attributeCopy(arrayMember, tobj_1, target);
|
|
2200
|
-
return result !== false ? target : undefined;
|
|
2201
|
-
})
|
|
2202
|
-
.filter(Boolean);
|
|
2203
|
-
outputObject[vKey] = mappedElements;
|
|
2204
|
-
}
|
|
2205
|
-
else if (vobj) {
|
|
2206
|
-
outputObject[vKey] = {};
|
|
2207
|
-
attributeCopy(vobj, tobj_1, outputObject[vKey]);
|
|
2208
|
-
}
|
|
2209
|
-
}
|
|
2210
|
-
else {
|
|
2211
|
-
var value = valuesObject[vKey];
|
|
2212
|
-
var exclude = Array.isArray(tobj_1) && !tobj_1.includes(value);
|
|
2213
|
-
if (exclude)
|
|
2214
|
-
return { value: false };
|
|
2215
|
-
if (templateObject[vKey] ||
|
|
2216
|
-
(wildcard && templateObject[vKey] !== false)) {
|
|
2217
|
-
outputObject[vKey] = value;
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
};
|
|
2222
|
-
try {
|
|
2223
|
-
for (var vKeys_1 = __values(vKeys), vKeys_1_1 = vKeys_1.next(); !vKeys_1_1.done; vKeys_1_1 = vKeys_1.next()) {
|
|
2224
|
-
var vKey = vKeys_1_1.value;
|
|
2225
|
-
var state_1 = _loop_1(vKey);
|
|
2226
|
-
if (typeof state_1 === "object")
|
|
2227
|
-
return state_1.value;
|
|
2228
|
-
}
|
|
2229
|
-
}
|
|
2230
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2231
|
-
finally {
|
|
2232
|
-
try {
|
|
2233
|
-
if (vKeys_1_1 && !vKeys_1_1.done && (_a = vKeys_1.return)) _a.call(vKeys_1);
|
|
2234
|
-
}
|
|
2235
|
-
finally { if (e_1) throw e_1.error; }
|
|
2236
|
-
}
|
|
2237
|
-
return undefined;
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
|
|
2241
2073
|
var validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
|
|
2242
2074
|
var validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
|
|
2243
2075
|
var dateValidation = /^([\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1]))([ T](0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)?([.,][\d]{3})?Z?$/;
|
|
@@ -2669,6 +2501,528 @@ function extensionsToAttributes(extensions) {
|
|
|
2669
2501
|
}).filter(Boolean);
|
|
2670
2502
|
}
|
|
2671
2503
|
|
|
2504
|
+
function getAccessorValue(_a) {
|
|
2505
|
+
var element = _a.element, accessor = _a.accessor;
|
|
2506
|
+
if (typeof accessor !== 'string')
|
|
2507
|
+
return { values: [] };
|
|
2508
|
+
var targetElement = makeDeepCopy(element);
|
|
2509
|
+
var attributes = accessor.split('.');
|
|
2510
|
+
var values = [];
|
|
2511
|
+
var value;
|
|
2512
|
+
processKeys({ targetElement: targetElement, attributes: attributes });
|
|
2513
|
+
var result = { value: value };
|
|
2514
|
+
if (values.length)
|
|
2515
|
+
result.values = values;
|
|
2516
|
+
return result;
|
|
2517
|
+
function processKeys(_a) {
|
|
2518
|
+
var e_1, _b;
|
|
2519
|
+
var targetElement = _a.targetElement, _c = _a.attributes, attributes = _c === void 0 ? [] : _c, significantCharacters = _a.significantCharacters;
|
|
2520
|
+
var _loop_1 = function (index, attribute) {
|
|
2521
|
+
if (targetElement === null || targetElement === void 0 ? void 0 : targetElement[attribute]) {
|
|
2522
|
+
var remainingKeys_1 = attributes.slice(index + 1);
|
|
2523
|
+
if (!remainingKeys_1.length) {
|
|
2524
|
+
if (!value)
|
|
2525
|
+
value = targetElement[attribute];
|
|
2526
|
+
if (!values.includes(targetElement[attribute])) {
|
|
2527
|
+
values.push(targetElement[attribute]);
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
else if (Array.isArray(targetElement[attribute])) {
|
|
2531
|
+
var values_1 = targetElement[attribute];
|
|
2532
|
+
values_1.forEach(function (nestedTarget) {
|
|
2533
|
+
return processKeys({
|
|
2534
|
+
targetElement: nestedTarget,
|
|
2535
|
+
attributes: remainingKeys_1,
|
|
2536
|
+
});
|
|
2537
|
+
});
|
|
2538
|
+
}
|
|
2539
|
+
else {
|
|
2540
|
+
targetElement = targetElement[attribute];
|
|
2541
|
+
checkValue({ targetElement: targetElement, index: index });
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
try {
|
|
2546
|
+
for (var _d = __values(attributes.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2547
|
+
var _f = __read(_e.value, 2), index = _f[0], attribute = _f[1];
|
|
2548
|
+
_loop_1(index, attribute);
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2552
|
+
finally {
|
|
2553
|
+
try {
|
|
2554
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
2555
|
+
}
|
|
2556
|
+
finally { if (e_1) throw e_1.error; }
|
|
2557
|
+
}
|
|
2558
|
+
function checkValue(_a) {
|
|
2559
|
+
var targetElement = _a.targetElement, index = _a.index;
|
|
2560
|
+
if (targetElement &&
|
|
2561
|
+
index === attributes.length - 1 &&
|
|
2562
|
+
['string', 'number'].includes(typeof targetElement)) {
|
|
2563
|
+
var extractedValue = significantCharacters
|
|
2564
|
+
? targetElement.slice(0, significantCharacters)
|
|
2565
|
+
: targetElement;
|
|
2566
|
+
if (value) {
|
|
2567
|
+
if (!values.includes(extractedValue)) {
|
|
2568
|
+
values.push(extractedValue);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
else {
|
|
2572
|
+
value = extractedValue;
|
|
2573
|
+
values.push(extractedValue);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
function isFunction(obj) {
|
|
2581
|
+
return typeof obj === 'function';
|
|
2582
|
+
}
|
|
2583
|
+
function isString(obj) {
|
|
2584
|
+
return typeof obj === 'string';
|
|
2585
|
+
}
|
|
2586
|
+
function isObject(obj) {
|
|
2587
|
+
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
|
2588
|
+
}
|
|
2589
|
+
function objShallowEqual(o1, o2) {
|
|
2590
|
+
var e_1, _a;
|
|
2591
|
+
if (!isObject(o1) || !isObject(o2))
|
|
2592
|
+
return false;
|
|
2593
|
+
var keys1 = Object.keys(o1);
|
|
2594
|
+
var keys2 = Object.keys(o2);
|
|
2595
|
+
if (keys1.length !== keys2.length) {
|
|
2596
|
+
return false;
|
|
2597
|
+
}
|
|
2598
|
+
try {
|
|
2599
|
+
for (var keys1_1 = __values(keys1), keys1_1_1 = keys1_1.next(); !keys1_1_1.done; keys1_1_1 = keys1_1.next()) {
|
|
2600
|
+
var key = keys1_1_1.value;
|
|
2601
|
+
if (o1[key] !== o2[key]) {
|
|
2602
|
+
return false;
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2607
|
+
finally {
|
|
2608
|
+
try {
|
|
2609
|
+
if (keys1_1_1 && !keys1_1_1.done && (_a = keys1_1.return)) _a.call(keys1_1);
|
|
2610
|
+
}
|
|
2611
|
+
finally { if (e_1) throw e_1.error; }
|
|
2612
|
+
}
|
|
2613
|
+
return true;
|
|
2614
|
+
}
|
|
2615
|
+
function createMap(objectArray, attribute) {
|
|
2616
|
+
if (!Array.isArray(objectArray))
|
|
2617
|
+
return {};
|
|
2618
|
+
return Object.assign.apply(Object, __spreadArray([{}], __read((objectArray !== null && objectArray !== void 0 ? objectArray : [])
|
|
2619
|
+
.filter(isObject)
|
|
2620
|
+
.map(function (obj) {
|
|
2621
|
+
var _a;
|
|
2622
|
+
return (obj[attribute] && (_a = {},
|
|
2623
|
+
_a[obj[attribute]] = obj,
|
|
2624
|
+
_a));
|
|
2625
|
+
})
|
|
2626
|
+
.filter(Boolean)), false));
|
|
2627
|
+
}
|
|
2628
|
+
// e.g. result.find(hav({ attr: value })) -or- result.filter(hav({ attr: value }))
|
|
2629
|
+
var hasAttributeValues = function (a) { return function (o) {
|
|
2630
|
+
return Object.keys(a).every(function (key) { return o[key] === a[key]; });
|
|
2631
|
+
}; };
|
|
2632
|
+
// extracts targeted attributes
|
|
2633
|
+
// e.g. const byeAssignments = positionAssignments.filter(xa('bye')).map(xa('drawPosition'));
|
|
2634
|
+
// supports xa('string'), xa(['string', 'string']), xa({ attr1: true, attr2: true })
|
|
2635
|
+
var extractAttributes = function (accessor) { return function (element) {
|
|
2636
|
+
var _a;
|
|
2637
|
+
return !accessor || typeof element !== 'object'
|
|
2638
|
+
? undefined
|
|
2639
|
+
: (Array.isArray(accessor) &&
|
|
2640
|
+
accessor.map(function (a) {
|
|
2641
|
+
var _a;
|
|
2642
|
+
var _b;
|
|
2643
|
+
return (_a = {},
|
|
2644
|
+
_a[a] = (_b = getAccessorValue({ element: element, accessor: a })) === null || _b === void 0 ? void 0 : _b.value,
|
|
2645
|
+
_a);
|
|
2646
|
+
})) ||
|
|
2647
|
+
(typeof accessor === 'object' &&
|
|
2648
|
+
Object.keys(accessor).map(function (key) {
|
|
2649
|
+
var _a;
|
|
2650
|
+
var _b;
|
|
2651
|
+
return (_a = {},
|
|
2652
|
+
_a[key] = (_b = getAccessorValue({ element: element, accessor: key })) === null || _b === void 0 ? void 0 : _b.value,
|
|
2653
|
+
_a);
|
|
2654
|
+
})) ||
|
|
2655
|
+
((_a = (typeof accessor === 'string' && getAccessorValue({ element: element, accessor: accessor }))) === null || _a === void 0 ? void 0 : _a.value);
|
|
2656
|
+
}; };
|
|
2657
|
+
// useful in notifications where back end does not recognize undefined for updates
|
|
2658
|
+
function undefinedToNull(obj, shallow) {
|
|
2659
|
+
if (obj === undefined)
|
|
2660
|
+
return null;
|
|
2661
|
+
if (typeof obj !== 'object' || obj === null)
|
|
2662
|
+
return obj;
|
|
2663
|
+
var definedKeys = Object.keys(obj);
|
|
2664
|
+
var notNull = function (value) { return (value === undefined ? null : value); };
|
|
2665
|
+
return Object.assign.apply(Object, __spreadArray([{}], __read(definedKeys.map(function (key) {
|
|
2666
|
+
var _a, _b;
|
|
2667
|
+
return Array.isArray(obj[key])
|
|
2668
|
+
? (_a = {},
|
|
2669
|
+
_a[key] = shallow ? obj[key] : obj[key].map(function (m) { return undefinedToNull(m); }),
|
|
2670
|
+
_a) : (_b = {}, _b[key] = shallow ? notNull(obj[key]) : undefinedToNull(obj[key]), _b);
|
|
2671
|
+
})), false));
|
|
2672
|
+
}
|
|
2673
|
+
function countKeys(o) {
|
|
2674
|
+
if (Array.isArray(o)) {
|
|
2675
|
+
return o.length + o.map(countKeys).reduce(function (a, b) { return a + b; }, 0);
|
|
2676
|
+
}
|
|
2677
|
+
else if (typeof o === 'object' && o !== null) {
|
|
2678
|
+
return (Object.keys(o).length +
|
|
2679
|
+
Object.keys(o)
|
|
2680
|
+
.map(function (k) { return countKeys(o[k]); })
|
|
2681
|
+
.reduce(function (a, b) { return a + b; }, 0));
|
|
2682
|
+
}
|
|
2683
|
+
return 0;
|
|
2684
|
+
}
|
|
2685
|
+
function generateHashCode(o) {
|
|
2686
|
+
if (o === null || typeof o !== 'object')
|
|
2687
|
+
return undefined;
|
|
2688
|
+
var str = JSON.stringify(o);
|
|
2689
|
+
var keyCount = countKeys(o);
|
|
2690
|
+
var charSum = str.split('').reduce(function (a, b) { return a + b.charCodeAt(0); }, 0);
|
|
2691
|
+
return [str.length, keyCount, charSum].map(function (e) { return e.toString(36); }).join('');
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
var TOURNAMENT_RECORDS = 'tournamentRecords';
|
|
2695
|
+
var POLICY_DEFINITIONS = 'policyDefinitions';
|
|
2696
|
+
var TOURNAMENT_RECORD = 'tournamentRecord';
|
|
2697
|
+
var DRAW_DEFINITION = 'drawDefinition';
|
|
2698
|
+
var MATCHUP_FORMAT = 'matchUpFormat';
|
|
2699
|
+
var PARTICIPANT_ID = 'participantId';
|
|
2700
|
+
var SCHEDULE_DATES = 'scheduleDates';
|
|
2701
|
+
var TOURNAMENT_ID = 'tournamentId';
|
|
2702
|
+
var SCHEDULE_DATE = 'scheduleDate';
|
|
2703
|
+
var STRUCTURE_ID = 'structureId';
|
|
2704
|
+
var PARTICIPANT = 'participant';
|
|
2705
|
+
var MATCHUP_IDS = 'matchUpIds';
|
|
2706
|
+
var POLICY_TYPE = 'policyType';
|
|
2707
|
+
var STRUCTURES = 'structures';
|
|
2708
|
+
var MATCHUP_ID = 'matchUpId';
|
|
2709
|
+
var IN_CONTEXT = 'inContext';
|
|
2710
|
+
var STRUCTURE = 'structure';
|
|
2711
|
+
var COURT_IDS = 'courtIds';
|
|
2712
|
+
var PERSON_ID = 'personId';
|
|
2713
|
+
var VENUE_IDS = 'venueIds';
|
|
2714
|
+
var MATCHUPS = 'matchUps';
|
|
2715
|
+
var COURT_ID = 'courtId';
|
|
2716
|
+
var EVENT_ID = 'eventId';
|
|
2717
|
+
var MATCHUP = 'matchUp';
|
|
2718
|
+
var DRAW_ID = 'drawId';
|
|
2719
|
+
var ERROR = 'error';
|
|
2720
|
+
var EVENT = 'event';
|
|
2721
|
+
var PARAM = 'param';
|
|
2722
|
+
var AVERAGE_MATCHUP_MINUTES = 'averageMatchUpMinutes';
|
|
2723
|
+
var RECOVERY_MINUTES = 'recoveryMinutes';
|
|
2724
|
+
var PERIOD_LENGTH = 'periodLength';
|
|
2725
|
+
var OBJECT = 'object';
|
|
2726
|
+
var ARRAY = 'array';
|
|
2727
|
+
var VALIDATE = 'validate';
|
|
2728
|
+
var INVALID = 'invalid';
|
|
2729
|
+
var OF_TYPE = '_ofType';
|
|
2730
|
+
var ANY_OF = '_anyOf';
|
|
2731
|
+
var ONE_OF = '_oneOf';
|
|
2732
|
+
|
|
2733
|
+
var _a$k, _b$8;
|
|
2734
|
+
var errors = (_a$k = {},
|
|
2735
|
+
_a$k[TOURNAMENT_RECORDS] = MISSING_TOURNAMENT_RECORDS,
|
|
2736
|
+
_a$k[TOURNAMENT_RECORD] = MISSING_TOURNAMENT_RECORD,
|
|
2737
|
+
_a$k[POLICY_DEFINITIONS] = MISSING_POLICY_DEFINITION,
|
|
2738
|
+
_a$k[DRAW_DEFINITION] = MISSING_DRAW_DEFINITION,
|
|
2739
|
+
_a$k[PARTICIPANT_ID] = MISSING_PARTICIPANT_ID,
|
|
2740
|
+
_a$k[TOURNAMENT_ID] = MISSING_TOURNAMENT_ID,
|
|
2741
|
+
_a$k[STRUCTURE_ID] = MISSING_STRUCTURE_ID,
|
|
2742
|
+
_a$k[MATCHUP_IDS] = MISSING_MATCHUP_IDS,
|
|
2743
|
+
_a$k[PARTICIPANT] = MISSING_PARTICIPANT,
|
|
2744
|
+
_a$k[STRUCTURES] = MISSING_STRUCTURES,
|
|
2745
|
+
_a$k[MATCHUP_ID] = MISSING_MATCHUP_ID,
|
|
2746
|
+
_a$k[STRUCTURE] = MISSING_STRUCTURE,
|
|
2747
|
+
_a$k[COURT_ID] = MISSING_COURT_ID,
|
|
2748
|
+
_a$k[MATCHUPS] = MISSING_MATCHUPS,
|
|
2749
|
+
_a$k[MATCHUP] = MISSING_MATCHUP,
|
|
2750
|
+
_a$k[COURT_IDS] = MISSING_VALUE,
|
|
2751
|
+
_a$k[VENUE_IDS] = MISSING_VALUE,
|
|
2752
|
+
_a$k[DRAW_ID] = MISSING_DRAW_ID,
|
|
2753
|
+
_a$k[EVENT_ID] = MISSING_EVENT,
|
|
2754
|
+
_a$k[EVENT] = EVENT_NOT_FOUND,
|
|
2755
|
+
_a$k);
|
|
2756
|
+
var paramTypes = (_b$8 = {},
|
|
2757
|
+
_b$8[TOURNAMENT_RECORDS] = OBJECT,
|
|
2758
|
+
_b$8[POLICY_DEFINITIONS] = OBJECT,
|
|
2759
|
+
_b$8[TOURNAMENT_RECORD] = OBJECT,
|
|
2760
|
+
_b$8[DRAW_DEFINITION] = OBJECT,
|
|
2761
|
+
_b$8[SCHEDULE_DATES] = ARRAY,
|
|
2762
|
+
_b$8[PARTICIPANT] = OBJECT,
|
|
2763
|
+
_b$8[MATCHUP_IDS] = ARRAY,
|
|
2764
|
+
_b$8[STRUCTURES] = ARRAY,
|
|
2765
|
+
_b$8[STRUCTURE] = OBJECT,
|
|
2766
|
+
_b$8[COURT_IDS] = ARRAY,
|
|
2767
|
+
_b$8[VENUE_IDS] = ARRAY,
|
|
2768
|
+
_b$8[MATCHUPS] = ARRAY,
|
|
2769
|
+
_b$8[MATCHUP] = OBJECT,
|
|
2770
|
+
_b$8[EVENT] = OBJECT,
|
|
2771
|
+
_b$8);
|
|
2772
|
+
function checkRequiredParameters(params, requiredParams, stack) {
|
|
2773
|
+
if (!params && !isObject(params))
|
|
2774
|
+
return { error: INVALID_VALUES };
|
|
2775
|
+
if (!(requiredParams === null || requiredParams === void 0 ? void 0 : requiredParams.length) || (params === null || params === void 0 ? void 0 : params._bypassParamCheck))
|
|
2776
|
+
return { valid: true };
|
|
2777
|
+
if (!Array.isArray(requiredParams))
|
|
2778
|
+
return { error: INVALID_VALUES };
|
|
2779
|
+
var _a = findParamError(params, requiredParams), paramError = _a.paramError, errorParam = _a.errorParam;
|
|
2780
|
+
if (!paramError)
|
|
2781
|
+
return { valid: true };
|
|
2782
|
+
var error = params[errorParam] === undefined
|
|
2783
|
+
? errors[errorParam] || INVALID_VALUES
|
|
2784
|
+
: (paramError.validate && paramError.invalid) || INVALID_VALUES;
|
|
2785
|
+
return decorateResult({
|
|
2786
|
+
info: { param: errorParam },
|
|
2787
|
+
result: { error: error },
|
|
2788
|
+
stack: stack,
|
|
2789
|
+
});
|
|
2790
|
+
}
|
|
2791
|
+
function getIntersection(params, constraint) {
|
|
2792
|
+
var paramKeys = Object.keys(params);
|
|
2793
|
+
var constraintKeys = Object.keys(constraint);
|
|
2794
|
+
return intersection(paramKeys, constraintKeys);
|
|
2795
|
+
}
|
|
2796
|
+
function getOneOf(params, _oneOf) {
|
|
2797
|
+
if (!_oneOf)
|
|
2798
|
+
return;
|
|
2799
|
+
var overlap = getIntersection(params, _oneOf);
|
|
2800
|
+
if (overlap.length !== 1)
|
|
2801
|
+
return { error: INVALID_VALUES };
|
|
2802
|
+
return overlap.reduce(function (attr, param) {
|
|
2803
|
+
var _a;
|
|
2804
|
+
return (__assign(__assign({}, attr), (_a = {}, _a[param] = true, _a)));
|
|
2805
|
+
}, {});
|
|
2806
|
+
}
|
|
2807
|
+
function getAnyOf(params, _anyOf) {
|
|
2808
|
+
if (!_anyOf)
|
|
2809
|
+
return;
|
|
2810
|
+
var overlap = getIntersection(params, _anyOf).filter(function (param) { return params[param]; });
|
|
2811
|
+
if (overlap.length < 1)
|
|
2812
|
+
return { error: INVALID_VALUES };
|
|
2813
|
+
return overlap.reduce(function (attr, param) {
|
|
2814
|
+
var _a;
|
|
2815
|
+
return (__assign(__assign({}, attr), (_a = {}, _a[param] = true, _a)));
|
|
2816
|
+
}, {});
|
|
2817
|
+
}
|
|
2818
|
+
function findParamError(params, requiredParams) {
|
|
2819
|
+
var errorParam;
|
|
2820
|
+
var paramError = requiredParams.find(function (_a) {
|
|
2821
|
+
var _ofType = _a._ofType, _oneOf = _a._oneOf, _anyOf = _a._anyOf, validate = _a.validate, attrs = __rest(_a, ["_ofType", "_oneOf", "_anyOf", "validate"]);
|
|
2822
|
+
var oneOf = _oneOf && getOneOf(params, _oneOf);
|
|
2823
|
+
if (oneOf === null || oneOf === void 0 ? void 0 : oneOf.error)
|
|
2824
|
+
return oneOf.error;
|
|
2825
|
+
oneOf && Object.assign(attrs, oneOf);
|
|
2826
|
+
var anyOf = _anyOf && getAnyOf(params, _anyOf);
|
|
2827
|
+
if (anyOf === null || anyOf === void 0 ? void 0 : anyOf.error)
|
|
2828
|
+
return anyOf.error;
|
|
2829
|
+
anyOf && Object.assign(attrs, anyOf);
|
|
2830
|
+
var booleanParams = Object.keys(attrs).filter(function (key) { return typeof attrs[key] === 'boolean'; });
|
|
2831
|
+
var invalidParam = booleanParams.find(function (param) {
|
|
2832
|
+
var invalid = !isFunction(validate) &&
|
|
2833
|
+
(params[param] === undefined || invalidType(params, param, _ofType));
|
|
2834
|
+
var hasError = invalid || (validate && !checkValidation(params[param], validate));
|
|
2835
|
+
if (hasError)
|
|
2836
|
+
errorParam = param;
|
|
2837
|
+
return hasError;
|
|
2838
|
+
});
|
|
2839
|
+
return !booleanParams.length || invalidParam;
|
|
2840
|
+
});
|
|
2841
|
+
return { paramError: paramError, errorParam: errorParam };
|
|
2842
|
+
}
|
|
2843
|
+
function invalidType(params, param, _ofType) {
|
|
2844
|
+
_ofType = _ofType || paramTypes[param] || 'string';
|
|
2845
|
+
if (_ofType === 'array') {
|
|
2846
|
+
return !Array.isArray(params[param]);
|
|
2847
|
+
}
|
|
2848
|
+
return typeof params[param] !== _ofType;
|
|
2849
|
+
}
|
|
2850
|
+
function checkValidation(value, validate) {
|
|
2851
|
+
if (isFunction(validate))
|
|
2852
|
+
return validate(value);
|
|
2853
|
+
return true;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
var DYNAMIC = 'DYNAMIC';
|
|
2857
|
+
var RANKING$1 = 'RANKING';
|
|
2858
|
+
var RATING$2 = 'RATING';
|
|
2859
|
+
var SCALE$1 = 'SCALE';
|
|
2860
|
+
var SEEDING$1 = 'SEEDING';
|
|
2861
|
+
var scaleConstants = {
|
|
2862
|
+
RANKING: RANKING$1,
|
|
2863
|
+
RATING: RATING$2,
|
|
2864
|
+
SCALE: SCALE$1,
|
|
2865
|
+
SEEDING: SEEDING$1,
|
|
2866
|
+
};
|
|
2867
|
+
|
|
2868
|
+
var SINGLES$1 = 'SINGLES';
|
|
2869
|
+
var SINGLES_EVENT = 'SINGLES';
|
|
2870
|
+
var DOUBLES$1 = 'DOUBLES';
|
|
2871
|
+
var DOUBLES_EVENT = 'DOUBLES';
|
|
2872
|
+
var TEAM$2 = 'TEAM';
|
|
2873
|
+
var TEAM_EVENT = 'TEAM';
|
|
2874
|
+
var AGE = 'AGE';
|
|
2875
|
+
var RATING$1 = 'RATING';
|
|
2876
|
+
var BOTH = 'BOTH';
|
|
2877
|
+
var eventConstants = {
|
|
2878
|
+
AGE: AGE,
|
|
2879
|
+
BOTH: BOTH,
|
|
2880
|
+
DOUBLES: DOUBLES$1,
|
|
2881
|
+
DOUBLES_EVENT: DOUBLES_EVENT,
|
|
2882
|
+
RATING: RATING$1,
|
|
2883
|
+
SINGLES: SINGLES$1,
|
|
2884
|
+
SINGLES_EVENT: SINGLES_EVENT,
|
|
2885
|
+
TEAM_EVENT: TEAM_EVENT,
|
|
2886
|
+
TEAM: TEAM$2,
|
|
2887
|
+
};
|
|
2888
|
+
|
|
2889
|
+
function getScaleValues(params) {
|
|
2890
|
+
var e_1, _a;
|
|
2891
|
+
var _b;
|
|
2892
|
+
var paramCheck = checkRequiredParameters(params, [{ participant: true }]);
|
|
2893
|
+
if (paramCheck.error)
|
|
2894
|
+
return paramCheck;
|
|
2895
|
+
var scaleItems = (_b = params.participant.timeItems) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
|
|
2896
|
+
var itemType = _a.itemType;
|
|
2897
|
+
return (itemType === null || itemType === void 0 ? void 0 : itemType.startsWith(SCALE$1)) &&
|
|
2898
|
+
[RANKING$1, RATING$2, SEEDING$1].includes(itemType.split('.')[1]);
|
|
2899
|
+
});
|
|
2900
|
+
var scales = { ratings: {}, rankings: {}, seedings: {} };
|
|
2901
|
+
if (scaleItems === null || scaleItems === void 0 ? void 0 : scaleItems.length) {
|
|
2902
|
+
var latestScaleItem = function (scaleType) {
|
|
2903
|
+
return scaleItems
|
|
2904
|
+
.filter(function (timeItem) { return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) === scaleType; })
|
|
2905
|
+
.sort(function (a, b) {
|
|
2906
|
+
return new Date(a.createdAt || undefined).getTime() -
|
|
2907
|
+
new Date(b.createdAt || undefined).getTime();
|
|
2908
|
+
})
|
|
2909
|
+
.pop();
|
|
2910
|
+
};
|
|
2911
|
+
var itemTypes = unique(scaleItems.map(function (_a) {
|
|
2912
|
+
var itemType = _a.itemType;
|
|
2913
|
+
return itemType;
|
|
2914
|
+
}));
|
|
2915
|
+
try {
|
|
2916
|
+
for (var itemTypes_1 = __values(itemTypes), itemTypes_1_1 = itemTypes_1.next(); !itemTypes_1_1.done; itemTypes_1_1 = itemTypes_1.next()) {
|
|
2917
|
+
var itemType = itemTypes_1_1.value;
|
|
2918
|
+
var scaleItem = latestScaleItem(itemType);
|
|
2919
|
+
if (scaleItem) {
|
|
2920
|
+
var _c = __read(scaleItem.itemType.split('.'), 5), type = _c[1], format = _c[2], scaleName = _c[3], modifier = _c[4];
|
|
2921
|
+
var namedScale = modifier ? "".concat(scaleName, ".").concat(modifier) : scaleName;
|
|
2922
|
+
var scaleType = (type === SEEDING$1 && 'seedings') ||
|
|
2923
|
+
(type === RANKING$1 && 'rankings') ||
|
|
2924
|
+
'ratings';
|
|
2925
|
+
if (!scales[scaleType][format])
|
|
2926
|
+
scales[scaleType][format] = [];
|
|
2927
|
+
scales[scaleType][format].push({
|
|
2928
|
+
scaleValue: scaleItem.itemValue,
|
|
2929
|
+
scaleDate: scaleItem.itemDate,
|
|
2930
|
+
scaleName: namedScale,
|
|
2931
|
+
});
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2936
|
+
finally {
|
|
2937
|
+
try {
|
|
2938
|
+
if (itemTypes_1_1 && !itemTypes_1_1.done && (_a = itemTypes_1.return)) _a.call(itemTypes_1);
|
|
2939
|
+
}
|
|
2940
|
+
finally { if (e_1) throw e_1.error; }
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
return __assign(__assign({}, SUCCESS), scales);
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
// NOTE: type really does need to be any!
|
|
2947
|
+
function attributeFilter(params) {
|
|
2948
|
+
if (params === null)
|
|
2949
|
+
return {};
|
|
2950
|
+
var _a = params || {}, source = _a.source, template = _a.template;
|
|
2951
|
+
if (!template)
|
|
2952
|
+
return source;
|
|
2953
|
+
var target = {};
|
|
2954
|
+
attributeCopy(source, template, target);
|
|
2955
|
+
return target;
|
|
2956
|
+
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
2957
|
+
var e_1, _a;
|
|
2958
|
+
if (!valuesObject || !templateObject)
|
|
2959
|
+
return undefined;
|
|
2960
|
+
var vKeys = Object.keys(valuesObject);
|
|
2961
|
+
var oKeys = Object.keys(templateObject);
|
|
2962
|
+
// the orMap allows spcification of { 'a||b': boolean } so that filter templates can apply to multiple attributes
|
|
2963
|
+
var orMap = Object.assign.apply(Object, __spreadArray([{}], __read(oKeys
|
|
2964
|
+
.filter(function (key) { return key.indexOf('||'); })
|
|
2965
|
+
.map(function (key) { return key.split('||').map(function (or) {
|
|
2966
|
+
var _a;
|
|
2967
|
+
return (_a = {}, _a[or] = key, _a);
|
|
2968
|
+
}); })
|
|
2969
|
+
.flat()), false));
|
|
2970
|
+
var allKeys = oKeys.concat.apply(oKeys, __spreadArray([], __read(Object.keys(orMap)), false));
|
|
2971
|
+
var wildcard = allKeys.includes('*');
|
|
2972
|
+
var _loop_1 = function (vKey) {
|
|
2973
|
+
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
2974
|
+
var templateKey = orMap[vKey] || vKey;
|
|
2975
|
+
var tobj_1 = templateObject[templateKey] || wildcard;
|
|
2976
|
+
var vobj = valuesObject[vKey];
|
|
2977
|
+
if (typeof tobj_1 === 'object' &&
|
|
2978
|
+
typeof vobj !== 'function' &&
|
|
2979
|
+
!Array.isArray(tobj_1)) {
|
|
2980
|
+
if (Array.isArray(vobj)) {
|
|
2981
|
+
var mappedElements = vobj
|
|
2982
|
+
.map(function (arrayMember) {
|
|
2983
|
+
var target = {};
|
|
2984
|
+
var result = attributeCopy(arrayMember, tobj_1, target);
|
|
2985
|
+
return result !== false ? target : undefined;
|
|
2986
|
+
})
|
|
2987
|
+
.filter(Boolean);
|
|
2988
|
+
outputObject[vKey] = mappedElements;
|
|
2989
|
+
}
|
|
2990
|
+
else if (vobj) {
|
|
2991
|
+
outputObject[vKey] = {};
|
|
2992
|
+
attributeCopy(vobj, tobj_1, outputObject[vKey]);
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
else {
|
|
2996
|
+
var value = valuesObject[vKey];
|
|
2997
|
+
var exclude = Array.isArray(tobj_1) && !tobj_1.includes(value);
|
|
2998
|
+
if (exclude)
|
|
2999
|
+
return { value: false };
|
|
3000
|
+
if (templateObject[vKey] ||
|
|
3001
|
+
(wildcard && templateObject[vKey] !== false)) {
|
|
3002
|
+
outputObject[vKey] = value;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
};
|
|
3007
|
+
try {
|
|
3008
|
+
for (var vKeys_1 = __values(vKeys), vKeys_1_1 = vKeys_1.next(); !vKeys_1_1.done; vKeys_1_1 = vKeys_1.next()) {
|
|
3009
|
+
var vKey = vKeys_1_1.value;
|
|
3010
|
+
var state_1 = _loop_1(vKey);
|
|
3011
|
+
if (typeof state_1 === "object")
|
|
3012
|
+
return state_1.value;
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3016
|
+
finally {
|
|
3017
|
+
try {
|
|
3018
|
+
if (vKeys_1_1 && !vKeys_1_1.done && (_a = vKeys_1.return)) _a.call(vKeys_1);
|
|
3019
|
+
}
|
|
3020
|
+
finally { if (e_1) throw e_1.error; }
|
|
3021
|
+
}
|
|
3022
|
+
return undefined;
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
|
|
2672
3026
|
var POLICY_TYPE_VOLUNTARY_CONSOLATION = 'voluntaryConsolation';
|
|
2673
3027
|
var POLICY_TYPE_COMPETITIVE_BANDS = 'competitiveBands';
|
|
2674
3028
|
var POLICY_TYPE_ROUND_ROBIN_TALLY = 'roundRobinTally';
|
|
@@ -2901,196 +3255,6 @@ var internalExtensions = [
|
|
|
2901
3255
|
TALLY,
|
|
2902
3256
|
];
|
|
2903
3257
|
|
|
2904
|
-
function getAccessorValue(_a) {
|
|
2905
|
-
var element = _a.element, accessor = _a.accessor;
|
|
2906
|
-
if (typeof accessor !== 'string')
|
|
2907
|
-
return { values: [] };
|
|
2908
|
-
var targetElement = makeDeepCopy(element);
|
|
2909
|
-
var attributes = accessor.split('.');
|
|
2910
|
-
var values = [];
|
|
2911
|
-
var value;
|
|
2912
|
-
processKeys({ targetElement: targetElement, attributes: attributes });
|
|
2913
|
-
var result = { value: value };
|
|
2914
|
-
if (values.length)
|
|
2915
|
-
result.values = values;
|
|
2916
|
-
return result;
|
|
2917
|
-
function processKeys(_a) {
|
|
2918
|
-
var e_1, _b;
|
|
2919
|
-
var targetElement = _a.targetElement, _c = _a.attributes, attributes = _c === void 0 ? [] : _c, significantCharacters = _a.significantCharacters;
|
|
2920
|
-
var _loop_1 = function (index, attribute) {
|
|
2921
|
-
if (targetElement === null || targetElement === void 0 ? void 0 : targetElement[attribute]) {
|
|
2922
|
-
var remainingKeys_1 = attributes.slice(index + 1);
|
|
2923
|
-
if (!remainingKeys_1.length) {
|
|
2924
|
-
if (!value)
|
|
2925
|
-
value = targetElement[attribute];
|
|
2926
|
-
if (!values.includes(targetElement[attribute])) {
|
|
2927
|
-
values.push(targetElement[attribute]);
|
|
2928
|
-
}
|
|
2929
|
-
}
|
|
2930
|
-
else if (Array.isArray(targetElement[attribute])) {
|
|
2931
|
-
var values_1 = targetElement[attribute];
|
|
2932
|
-
values_1.forEach(function (nestedTarget) {
|
|
2933
|
-
return processKeys({
|
|
2934
|
-
targetElement: nestedTarget,
|
|
2935
|
-
attributes: remainingKeys_1,
|
|
2936
|
-
});
|
|
2937
|
-
});
|
|
2938
|
-
}
|
|
2939
|
-
else {
|
|
2940
|
-
targetElement = targetElement[attribute];
|
|
2941
|
-
checkValue({ targetElement: targetElement, index: index });
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
};
|
|
2945
|
-
try {
|
|
2946
|
-
for (var _d = __values(attributes.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2947
|
-
var _f = __read(_e.value, 2), index = _f[0], attribute = _f[1];
|
|
2948
|
-
_loop_1(index, attribute);
|
|
2949
|
-
}
|
|
2950
|
-
}
|
|
2951
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2952
|
-
finally {
|
|
2953
|
-
try {
|
|
2954
|
-
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
2955
|
-
}
|
|
2956
|
-
finally { if (e_1) throw e_1.error; }
|
|
2957
|
-
}
|
|
2958
|
-
function checkValue(_a) {
|
|
2959
|
-
var targetElement = _a.targetElement, index = _a.index;
|
|
2960
|
-
if (targetElement &&
|
|
2961
|
-
index === attributes.length - 1 &&
|
|
2962
|
-
['string', 'number'].includes(typeof targetElement)) {
|
|
2963
|
-
var extractedValue = significantCharacters
|
|
2964
|
-
? targetElement.slice(0, significantCharacters)
|
|
2965
|
-
: targetElement;
|
|
2966
|
-
if (value) {
|
|
2967
|
-
if (!values.includes(extractedValue)) {
|
|
2968
|
-
values.push(extractedValue);
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
else {
|
|
2972
|
-
value = extractedValue;
|
|
2973
|
-
values.push(extractedValue);
|
|
2974
|
-
}
|
|
2975
|
-
}
|
|
2976
|
-
}
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
|
|
2980
|
-
function isFunction(obj) {
|
|
2981
|
-
return typeof obj === 'function';
|
|
2982
|
-
}
|
|
2983
|
-
function isString(obj) {
|
|
2984
|
-
return typeof obj === 'string';
|
|
2985
|
-
}
|
|
2986
|
-
function isObject(obj) {
|
|
2987
|
-
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
|
2988
|
-
}
|
|
2989
|
-
function objShallowEqual(o1, o2) {
|
|
2990
|
-
var e_1, _a;
|
|
2991
|
-
if (!isObject(o1) || !isObject(o2))
|
|
2992
|
-
return false;
|
|
2993
|
-
var keys1 = Object.keys(o1);
|
|
2994
|
-
var keys2 = Object.keys(o2);
|
|
2995
|
-
if (keys1.length !== keys2.length) {
|
|
2996
|
-
return false;
|
|
2997
|
-
}
|
|
2998
|
-
try {
|
|
2999
|
-
for (var keys1_1 = __values(keys1), keys1_1_1 = keys1_1.next(); !keys1_1_1.done; keys1_1_1 = keys1_1.next()) {
|
|
3000
|
-
var key = keys1_1_1.value;
|
|
3001
|
-
if (o1[key] !== o2[key]) {
|
|
3002
|
-
return false;
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3007
|
-
finally {
|
|
3008
|
-
try {
|
|
3009
|
-
if (keys1_1_1 && !keys1_1_1.done && (_a = keys1_1.return)) _a.call(keys1_1);
|
|
3010
|
-
}
|
|
3011
|
-
finally { if (e_1) throw e_1.error; }
|
|
3012
|
-
}
|
|
3013
|
-
return true;
|
|
3014
|
-
}
|
|
3015
|
-
function createMap(objectArray, attribute) {
|
|
3016
|
-
if (!Array.isArray(objectArray))
|
|
3017
|
-
return {};
|
|
3018
|
-
return Object.assign.apply(Object, __spreadArray([{}], __read((objectArray !== null && objectArray !== void 0 ? objectArray : [])
|
|
3019
|
-
.filter(isObject)
|
|
3020
|
-
.map(function (obj) {
|
|
3021
|
-
var _a;
|
|
3022
|
-
return (obj[attribute] && (_a = {},
|
|
3023
|
-
_a[obj[attribute]] = obj,
|
|
3024
|
-
_a));
|
|
3025
|
-
})
|
|
3026
|
-
.filter(Boolean)), false));
|
|
3027
|
-
}
|
|
3028
|
-
// e.g. result.find(hav({ attr: value })) -or- result.filter(hav({ attr: value }))
|
|
3029
|
-
var hasAttributeValues = function (a) { return function (o) {
|
|
3030
|
-
return Object.keys(a).every(function (key) { return o[key] === a[key]; });
|
|
3031
|
-
}; };
|
|
3032
|
-
// extracts targeted attributes
|
|
3033
|
-
// e.g. const byeAssignments = positionAssignments.filter(xa('bye')).map(xa('drawPosition'));
|
|
3034
|
-
// supports xa('string'), xa(['string', 'string']), xa({ attr1: true, attr2: true })
|
|
3035
|
-
var extractAttributes = function (accessor) { return function (element) {
|
|
3036
|
-
var _a;
|
|
3037
|
-
return !accessor || typeof element !== 'object'
|
|
3038
|
-
? undefined
|
|
3039
|
-
: (Array.isArray(accessor) &&
|
|
3040
|
-
accessor.map(function (a) {
|
|
3041
|
-
var _a;
|
|
3042
|
-
var _b;
|
|
3043
|
-
return (_a = {},
|
|
3044
|
-
_a[a] = (_b = getAccessorValue({ element: element, accessor: a })) === null || _b === void 0 ? void 0 : _b.value,
|
|
3045
|
-
_a);
|
|
3046
|
-
})) ||
|
|
3047
|
-
(typeof accessor === 'object' &&
|
|
3048
|
-
Object.keys(accessor).map(function (key) {
|
|
3049
|
-
var _a;
|
|
3050
|
-
var _b;
|
|
3051
|
-
return (_a = {},
|
|
3052
|
-
_a[key] = (_b = getAccessorValue({ element: element, accessor: key })) === null || _b === void 0 ? void 0 : _b.value,
|
|
3053
|
-
_a);
|
|
3054
|
-
})) ||
|
|
3055
|
-
((_a = (typeof accessor === 'string' && getAccessorValue({ element: element, accessor: accessor }))) === null || _a === void 0 ? void 0 : _a.value);
|
|
3056
|
-
}; };
|
|
3057
|
-
// useful in notifications where back end does not recognize undefined for updates
|
|
3058
|
-
function undefinedToNull(obj, shallow) {
|
|
3059
|
-
if (obj === undefined)
|
|
3060
|
-
return null;
|
|
3061
|
-
if (typeof obj !== 'object' || obj === null)
|
|
3062
|
-
return obj;
|
|
3063
|
-
var definedKeys = Object.keys(obj);
|
|
3064
|
-
var notNull = function (value) { return (value === undefined ? null : value); };
|
|
3065
|
-
return Object.assign.apply(Object, __spreadArray([{}], __read(definedKeys.map(function (key) {
|
|
3066
|
-
var _a, _b;
|
|
3067
|
-
return Array.isArray(obj[key])
|
|
3068
|
-
? (_a = {},
|
|
3069
|
-
_a[key] = shallow ? obj[key] : obj[key].map(function (m) { return undefinedToNull(m); }),
|
|
3070
|
-
_a) : (_b = {}, _b[key] = shallow ? notNull(obj[key]) : undefinedToNull(obj[key]), _b);
|
|
3071
|
-
})), false));
|
|
3072
|
-
}
|
|
3073
|
-
function countKeys(o) {
|
|
3074
|
-
if (Array.isArray(o)) {
|
|
3075
|
-
return o.length + o.map(countKeys).reduce(function (a, b) { return a + b; }, 0);
|
|
3076
|
-
}
|
|
3077
|
-
else if (typeof o === 'object' && o !== null) {
|
|
3078
|
-
return (Object.keys(o).length +
|
|
3079
|
-
Object.keys(o)
|
|
3080
|
-
.map(function (k) { return countKeys(o[k]); })
|
|
3081
|
-
.reduce(function (a, b) { return a + b; }, 0));
|
|
3082
|
-
}
|
|
3083
|
-
return 0;
|
|
3084
|
-
}
|
|
3085
|
-
function generateHashCode(o) {
|
|
3086
|
-
if (o === null || typeof o !== 'object')
|
|
3087
|
-
return undefined;
|
|
3088
|
-
var str = JSON.stringify(o);
|
|
3089
|
-
var keyCount = countKeys(o);
|
|
3090
|
-
var charSum = str.split('').reduce(function (a, b) { return a + b.charCodeAt(0); }, 0);
|
|
3091
|
-
return [str.length, keyCount, charSum].map(function (e) { return e.toString(36); }).join('');
|
|
3092
|
-
}
|
|
3093
|
-
|
|
3094
3258
|
function getTournamentIds(_a) {
|
|
3095
3259
|
var tournamentRecords = _a.tournamentRecords;
|
|
3096
3260
|
var tournamentIds = isObject(tournamentRecords)
|
|
@@ -3350,7 +3514,7 @@ var matchUpStatusConstants = {
|
|
|
3350
3514
|
WALKOVER: WALKOVER$2,
|
|
3351
3515
|
};
|
|
3352
3516
|
|
|
3353
|
-
var _a$
|
|
3517
|
+
var _a$j, _b$7, _c$1;
|
|
3354
3518
|
// stage types
|
|
3355
3519
|
var MAIN = 'MAIN';
|
|
3356
3520
|
var QUALIFYING = 'QUALIFYING';
|
|
@@ -3364,22 +3528,22 @@ var validStages = [
|
|
|
3364
3528
|
PLAY_OFF,
|
|
3365
3529
|
VOLUNTARY_CONSOLATION,
|
|
3366
3530
|
];
|
|
3367
|
-
var stageOrder$1 = (_a$
|
|
3368
|
-
_a$
|
|
3369
|
-
_a$
|
|
3370
|
-
_a$
|
|
3371
|
-
_a$
|
|
3372
|
-
_a$
|
|
3373
|
-
_a$
|
|
3531
|
+
var stageOrder$1 = (_a$j = {},
|
|
3532
|
+
_a$j[QUALIFYING] = 1,
|
|
3533
|
+
_a$j[MAIN] = 2,
|
|
3534
|
+
_a$j[PLAY_OFF] = 3,
|
|
3535
|
+
_a$j[CONSOLATION] = 3,
|
|
3536
|
+
_a$j[VOLUNTARY_CONSOLATION] = 4,
|
|
3537
|
+
_a$j);
|
|
3374
3538
|
var FINISHING_POSITIONS = 'finishingPositions';
|
|
3375
3539
|
var AGGREGATE_EVENT_STRUCTURES = 'aggregateEventStructures';
|
|
3376
|
-
var finishOrder = (_b$
|
|
3377
|
-
_b$
|
|
3378
|
-
_b$
|
|
3379
|
-
_b$
|
|
3380
|
-
_b$
|
|
3381
|
-
_b$
|
|
3382
|
-
_b$
|
|
3540
|
+
var finishOrder = (_b$7 = {},
|
|
3541
|
+
_b$7[MAIN] = 1,
|
|
3542
|
+
_b$7[PLAY_OFF] = 2,
|
|
3543
|
+
_b$7[CONSOLATION] = 3,
|
|
3544
|
+
_b$7[QUALIFYING] = 4,
|
|
3545
|
+
_b$7[VOLUNTARY_CONSOLATION] = 5,
|
|
3546
|
+
_b$7);
|
|
3383
3547
|
// for aggregateOrder { stage: MAIN, stageSequence: 1 } is always first
|
|
3384
3548
|
var aggregateOrder = (_c$1 = {},
|
|
3385
3549
|
_c$1[PLAY_OFF] = 1,
|
|
@@ -5157,16 +5321,16 @@ var ROUTINE = 'ROUTINE';
|
|
|
5157
5321
|
var DECISIVE = 'DECISIVE';
|
|
5158
5322
|
var WIN_RATIO = 'winRatio';
|
|
5159
5323
|
|
|
5160
|
-
var _a$
|
|
5161
|
-
var POLICY_COMPETITIVE_BANDS_DEFAULT = (_a$
|
|
5162
|
-
_a$
|
|
5324
|
+
var _a$i, _b$6;
|
|
5325
|
+
var POLICY_COMPETITIVE_BANDS_DEFAULT = (_a$i = {},
|
|
5326
|
+
_a$i[POLICY_TYPE_COMPETITIVE_BANDS] = {
|
|
5163
5327
|
policyName: 'Competitive Bands Default',
|
|
5164
|
-
profileBands: (_b$
|
|
5165
|
-
_b$
|
|
5166
|
-
_b$
|
|
5167
|
-
_b$
|
|
5328
|
+
profileBands: (_b$6 = {},
|
|
5329
|
+
_b$6[DECISIVE] = 20,
|
|
5330
|
+
_b$6[ROUTINE] = 50,
|
|
5331
|
+
_b$6),
|
|
5168
5332
|
},
|
|
5169
|
-
_a$
|
|
5333
|
+
_a$i);
|
|
5170
5334
|
|
|
5171
5335
|
function getContextContent(_a) {
|
|
5172
5336
|
var _b, _c;
|
|
@@ -5478,8 +5642,7 @@ function getDrawPositionCollectionAssignment(_a) {
|
|
|
5478
5642
|
var teamParticipantId = (_d = positionAssignments.find(function (assignment) { return assignment.drawPosition === drawPosition; })) === null || _d === void 0 ? void 0 : _d.participantId;
|
|
5479
5643
|
var side = sideLineUps === null || sideLineUps === void 0 ? void 0 : sideLineUps.find(function (lineUp) { return (lineUp === null || lineUp === void 0 ? void 0 : lineUp.drawPosition) === drawPosition; });
|
|
5480
5644
|
var teamParticipant = (side === null || side === void 0 ? void 0 : side.teamParticipant) ||
|
|
5481
|
-
(teamParticipantId &&
|
|
5482
|
-
((_e = participantMap === null || participantMap === void 0 ? void 0 : participantMap[teamParticipantId]) === null || _e === void 0 ? void 0 : _e.participant)) ||
|
|
5645
|
+
(teamParticipantId && ((_e = participantMap === null || participantMap === void 0 ? void 0 : participantMap[teamParticipantId]) === null || _e === void 0 ? void 0 : _e.participant)) ||
|
|
5483
5646
|
(tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.find(function (_a) {
|
|
5484
5647
|
var participantId = _a.participantId;
|
|
5485
5648
|
return participantId === teamParticipantId;
|
|
@@ -5497,8 +5660,7 @@ function getDrawPositionCollectionAssignment(_a) {
|
|
|
5497
5660
|
if (matchUpType === DOUBLES) {
|
|
5498
5661
|
if ((assignedParticipantIds === null || assignedParticipantIds === void 0 ? void 0 : assignedParticipantIds.length) <= 2) {
|
|
5499
5662
|
var pairedParticipantId = (_h = (_g = participantMap === null || participantMap === void 0 ? void 0 : participantMap[assignedParticipantIds[0]]) === null || _g === void 0 ? void 0 : _g.pairIdMap) === null || _h === void 0 ? void 0 : _h[assignedParticipantIds[1]];
|
|
5500
|
-
var pairedParticipant = pairedParticipantId &&
|
|
5501
|
-
((_j = participantMap[pairedParticipantId]) === null || _j === void 0 ? void 0 : _j.participant);
|
|
5663
|
+
var pairedParticipant = pairedParticipantId && ((_j = participantMap[pairedParticipantId]) === null || _j === void 0 ? void 0 : _j.participant);
|
|
5502
5664
|
var participant = pairedParticipant ||
|
|
5503
5665
|
// resort to brute force
|
|
5504
5666
|
getPairedParticipant({
|
|
@@ -6963,10 +7125,12 @@ function matchUpEndTime(_a) {
|
|
|
6963
7125
|
return { endTime: endTime };
|
|
6964
7126
|
}
|
|
6965
7127
|
|
|
6966
|
-
function getMatchUpScheduleDetails(
|
|
6967
|
-
var _b, _c, _d, _e,
|
|
6968
|
-
var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
6969
|
-
var
|
|
7128
|
+
function getMatchUpScheduleDetails(params) {
|
|
7129
|
+
var _a, _b, _c, _d, _e, e_1, _f;
|
|
7130
|
+
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
7131
|
+
var event = params.event;
|
|
7132
|
+
var matchUpType = params.matchUpType;
|
|
7133
|
+
var scheduleVisibilityFilters = params.scheduleVisibilityFilters, afterRecoveryTimes = params.afterRecoveryTimes, tournamentRecord = params.tournamentRecord, usePublishState = params.usePublishState, scheduleTiming = params.scheduleTiming, matchUpFormat = params.matchUpFormat, publishStatus = params.publishStatus, matchUp = params.matchUp;
|
|
6970
7134
|
if (!matchUp)
|
|
6971
7135
|
return { error: MISSING_MATCHUP };
|
|
6972
7136
|
// matchUpType is required to derive averageMatchUpMinutes and recoveryMinutes.
|
|
@@ -6974,31 +7138,32 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
6974
7138
|
// ...attempt to derive by interrogating structure, draw, and event
|
|
6975
7139
|
if (afterRecoveryTimes &&
|
|
6976
7140
|
!matchUp.matchUpType &&
|
|
6977
|
-
!matchUpType &&
|
|
7141
|
+
!params.matchUpType &&
|
|
6978
7142
|
(event || tournamentRecord) &&
|
|
6979
7143
|
matchUp.drawId) {
|
|
6980
|
-
var drawDefinition = (
|
|
7144
|
+
var drawDefinition = (_g = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _g === void 0 ? void 0 : _g.find(function (drawDefinition) { return drawDefinition.drawId === matchUp.drawId; });
|
|
6981
7145
|
if (!drawDefinition && tournamentRecord) {
|
|
6982
|
-
(
|
|
7146
|
+
(_a = findEvent({
|
|
6983
7147
|
tournamentRecord: tournamentRecord,
|
|
6984
7148
|
drawId: matchUp.drawId,
|
|
6985
|
-
}), drawDefinition =
|
|
7149
|
+
}), drawDefinition = _a.drawDefinition, event = _a.event);
|
|
6986
7150
|
}
|
|
6987
7151
|
var structure = matchUp.structureId &&
|
|
6988
|
-
((
|
|
7152
|
+
((_h = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) === null || _h === void 0 ? void 0 : _h.find(function (_a) {
|
|
6989
7153
|
var structureId = _a.structureId;
|
|
6990
7154
|
return structureId === matchUp.structureId;
|
|
6991
7155
|
}));
|
|
6992
7156
|
matchUpType =
|
|
6993
|
-
|
|
7157
|
+
params.matchUpType ||
|
|
7158
|
+
(structure === null || structure === void 0 ? void 0 : structure.matchUpType) ||
|
|
6994
7159
|
(drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType) ||
|
|
6995
7160
|
((event === null || event === void 0 ? void 0 : event.eventType) !== TEAM$2 && (event === null || event === void 0 ? void 0 : event.eventType));
|
|
6996
7161
|
}
|
|
6997
|
-
var
|
|
7162
|
+
var _u = matchUpDuration({ matchUp: matchUp }), milliseconds = _u.milliseconds, time = _u.time;
|
|
6998
7163
|
var startTime = matchUpStartTime({ matchUp: matchUp }).startTime;
|
|
6999
7164
|
var endTime = matchUpEndTime({ matchUp: matchUp }).endTime;
|
|
7000
7165
|
var schedule;
|
|
7001
|
-
var
|
|
7166
|
+
var _v = scheduleVisibilityFilters !== null && scheduleVisibilityFilters !== void 0 ? scheduleVisibilityFilters : {}, visibilityThreshold = _v.visibilityThreshold, eventIds = _v.eventIds, drawIds = _v.drawIds;
|
|
7002
7167
|
if ((!eventIds || eventIds.includes(matchUp.eventId)) &&
|
|
7003
7168
|
(!drawIds || drawIds.includes(matchUp.drawId))) {
|
|
7004
7169
|
var scheduleSource = { matchUp: matchUp, visibilityThreshold: visibilityThreshold };
|
|
@@ -7010,13 +7175,13 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7010
7175
|
var courtOrder = matchUpCourtOrder(scheduleSource).courtOrder;
|
|
7011
7176
|
var timeModifiers = matchUpTimeModifiers(scheduleSource).timeModifiers;
|
|
7012
7177
|
var timeAfterRecovery = void 0, averageMinutes = void 0, recoveryMinutes = void 0, typeChangeRecoveryMinutes = void 0, typeChangeTimeAfterRecovery = void 0;
|
|
7013
|
-
var eventType = (
|
|
7178
|
+
var eventType = (_j = matchUp.matchUpType) !== null && _j !== void 0 ? _j : matchUpType;
|
|
7014
7179
|
if (scheduleTiming && scheduledTime_1 && afterRecoveryTimes && eventType) {
|
|
7015
|
-
var timingDetails = __assign({ matchUpFormat: (
|
|
7016
|
-
(
|
|
7180
|
+
var timingDetails = __assign({ matchUpFormat: (_k = matchUp.matchUpFormat) !== null && _k !== void 0 ? _k : matchUpFormat }, scheduleTiming);
|
|
7181
|
+
(_b = matchUpFormatTimes({
|
|
7017
7182
|
timingDetails: timingDetails,
|
|
7018
7183
|
eventType: eventType,
|
|
7019
|
-
}),
|
|
7184
|
+
}), _c = _b.averageMinutes, averageMinutes = _c === void 0 ? 0 : _c, _d = _b.recoveryMinutes, recoveryMinutes = _d === void 0 ? 0 : _d, _e = _b.typeChangeRecoveryMinutes, typeChangeRecoveryMinutes = _e === void 0 ? 0 : _e);
|
|
7020
7185
|
if (averageMinutes || recoveryMinutes) {
|
|
7021
7186
|
timeAfterRecovery = endTime
|
|
7022
7187
|
? addMinutesToTimeString(extractTime(endTime), recoveryMinutes)
|
|
@@ -7032,9 +7197,9 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7032
7197
|
scheduledDate_1 = extractDate(scheduledTime_1);
|
|
7033
7198
|
var isoDateString = getIsoDateString({ scheduledDate: scheduledDate_1, scheduledTime: scheduledTime_1 });
|
|
7034
7199
|
var venueDataMap = {};
|
|
7035
|
-
var venueData = ((
|
|
7200
|
+
var venueData = ((_l = (tournamentRecord &&
|
|
7036
7201
|
venueId &&
|
|
7037
|
-
getVenueData({ tournamentRecord: tournamentRecord, venueId: venueId }))) === null ||
|
|
7202
|
+
getVenueData({ tournamentRecord: tournamentRecord, venueId: venueId }))) === null || _l === void 0 ? void 0 : _l.venueData) || {};
|
|
7038
7203
|
if (venueId)
|
|
7039
7204
|
venueDataMap[venueId] = venueData;
|
|
7040
7205
|
var venueName = venueData.venueName, venueAbbreviation = venueData.venueAbbreviation, courtsInfo = venueData.courtsInfo;
|
|
@@ -7044,19 +7209,19 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7044
7209
|
if (!tournamentRecord)
|
|
7045
7210
|
return "break";
|
|
7046
7211
|
if (allocatedCourt.venueId && !venueDataMap[allocatedCourt.venueid]) {
|
|
7047
|
-
venueDataMap[allocatedCourt.venueId] = (
|
|
7212
|
+
venueDataMap[allocatedCourt.venueId] = (_m = getVenueData({
|
|
7048
7213
|
venueId: allocatedCourt.venueId,
|
|
7049
7214
|
tournamentRecord: tournamentRecord,
|
|
7050
|
-
})) === null ||
|
|
7215
|
+
})) === null || _m === void 0 ? void 0 : _m.venueData;
|
|
7051
7216
|
}
|
|
7052
7217
|
var vData = venueDataMap[allocatedCourt.venueId];
|
|
7053
7218
|
allocatedCourt.venueName = vData === null || vData === void 0 ? void 0 : vData.venueName;
|
|
7054
|
-
var courtInfo_1 = (
|
|
7219
|
+
var courtInfo_1 = (_o = vData === null || vData === void 0 ? void 0 : vData.courtsInfo) === null || _o === void 0 ? void 0 : _o.find(function (courtInfo) { return courtInfo.courtId === allocatedCourt.courtId; });
|
|
7055
7220
|
allocatedCourt.courtName = courtInfo_1 === null || courtInfo_1 === void 0 ? void 0 : courtInfo_1.courtName;
|
|
7056
7221
|
};
|
|
7057
7222
|
try {
|
|
7058
|
-
for (var
|
|
7059
|
-
var allocatedCourt =
|
|
7223
|
+
for (var _w = __values(allocatedCourts || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
7224
|
+
var allocatedCourt = _x.value;
|
|
7060
7225
|
var state_1 = _loop_1(allocatedCourt);
|
|
7061
7226
|
if (state_1 === "break")
|
|
7062
7227
|
break;
|
|
@@ -7065,7 +7230,7 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7065
7230
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7066
7231
|
finally {
|
|
7067
7232
|
try {
|
|
7068
|
-
if (
|
|
7233
|
+
if (_x && !_x.done && (_f = _w.return)) _f.call(_w);
|
|
7069
7234
|
}
|
|
7070
7235
|
finally { if (e_1) throw e_1.error; }
|
|
7071
7236
|
}
|
|
@@ -7102,11 +7267,11 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7102
7267
|
}
|
|
7103
7268
|
var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
|
|
7104
7269
|
var scheduledTime = scheduledMatchUpTime({ matchUp: matchUp }).scheduledTime;
|
|
7105
|
-
if (usePublishState && ((
|
|
7270
|
+
if (usePublishState && ((_p = publishStatus === null || publishStatus === void 0 ? void 0 : publishStatus.displaySettings) === null || _p === void 0 ? void 0 : _p.draws)) {
|
|
7106
7271
|
var drawSettings = publishStatus.displaySettings.draws;
|
|
7107
|
-
var scheduleDetails = (
|
|
7272
|
+
var scheduleDetails = (_r = ((_q = drawSettings === null || drawSettings === void 0 ? void 0 : drawSettings[matchUp.drawId]) !== null && _q !== void 0 ? _q : drawSettings === null || drawSettings === void 0 ? void 0 : drawSettings.default)) === null || _r === void 0 ? void 0 : _r.scheduleDetails;
|
|
7108
7273
|
if (scheduleDetails) {
|
|
7109
|
-
var scheduleAttributes = (
|
|
7274
|
+
var scheduleAttributes = (_t = ((_s = scheduleDetails.find(function (details) { var _a; return scheduledDate && ((_a = details.dates) === null || _a === void 0 ? void 0 : _a.includes(scheduledDate)); })) !== null && _s !== void 0 ? _s : scheduleDetails.find(function (details) { var _a; return !((_a = details.dates) === null || _a === void 0 ? void 0 : _a.length); }))) === null || _t === void 0 ? void 0 : _t.attributes;
|
|
7110
7275
|
if (scheduleAttributes) {
|
|
7111
7276
|
// set all attributes to true
|
|
7112
7277
|
var template = Object.assign.apply(Object, __spreadArray(__spreadArray([{}], __read(Object.keys(schedule).map(function (key) {
|
|
@@ -7844,9 +8009,9 @@ function isAdHoc(_a) {
|
|
|
7844
8009
|
!hasDrawPosition);
|
|
7845
8010
|
}
|
|
7846
8011
|
|
|
7847
|
-
var _a$
|
|
7848
|
-
var POLICY_ROUND_NAMING_DEFAULT = (_a$
|
|
7849
|
-
_a$
|
|
8012
|
+
var _a$h, _b$5;
|
|
8013
|
+
var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
8014
|
+
_a$h[POLICY_TYPE_ROUND_NAMING] = {
|
|
7850
8015
|
policyName: 'Round Naming Default',
|
|
7851
8016
|
namingConventions: {
|
|
7852
8017
|
round: 'Round',
|
|
@@ -7871,14 +8036,14 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$i = {},
|
|
|
7871
8036
|
preFeedRound: 'Q',
|
|
7872
8037
|
preQualifying: 'P',
|
|
7873
8038
|
},
|
|
7874
|
-
stageConstants: (_b$
|
|
7875
|
-
_b$
|
|
7876
|
-
_b$
|
|
7877
|
-
_b$
|
|
7878
|
-
_b$
|
|
7879
|
-
_b$
|
|
8039
|
+
stageConstants: (_b$5 = {},
|
|
8040
|
+
_b$5[MAIN] = '',
|
|
8041
|
+
_b$5[PLAY_OFF] = 'P',
|
|
8042
|
+
_b$5[QUALIFYING] = 'Q',
|
|
8043
|
+
_b$5[CONSOLATION] = 'C',
|
|
8044
|
+
_b$5),
|
|
7880
8045
|
},
|
|
7881
|
-
_a$
|
|
8046
|
+
_a$h);
|
|
7882
8047
|
|
|
7883
8048
|
function getRoundContextProfile(_a) {
|
|
7884
8049
|
var _b, _c, _d, _e, _f, _g;
|
|
@@ -7976,165 +8141,6 @@ function getRoundContextProfile(_a) {
|
|
|
7976
8141
|
return { roundNamingProfile: roundNamingProfile, roundProfile: roundProfile, roundMatchUps: roundMatchUps };
|
|
7977
8142
|
}
|
|
7978
8143
|
|
|
7979
|
-
var TOURNAMENT_RECORDS = 'tournamentRecords';
|
|
7980
|
-
var POLICY_DEFINITIONS = 'policyDefinitions';
|
|
7981
|
-
var TOURNAMENT_RECORD = 'tournamentRecord';
|
|
7982
|
-
var DRAW_DEFINITION = 'drawDefinition';
|
|
7983
|
-
var MATCHUP_FORMAT = 'matchUpFormat';
|
|
7984
|
-
var PARTICIPANT_ID = 'participantId';
|
|
7985
|
-
var SCHEDULE_DATES = 'scheduleDates';
|
|
7986
|
-
var TOURNAMENT_ID = 'tournamentId';
|
|
7987
|
-
var SCHEDULE_DATE = 'scheduleDate';
|
|
7988
|
-
var STRUCTURE_ID = 'structureId';
|
|
7989
|
-
var MATCHUP_IDS = 'matchUpIds';
|
|
7990
|
-
var POLICY_TYPE = 'policyType';
|
|
7991
|
-
var STRUCTURES = 'structures';
|
|
7992
|
-
var MATCHUP_ID = 'matchUpId';
|
|
7993
|
-
var IN_CONTEXT = 'inContext';
|
|
7994
|
-
var STRUCTURE = 'structure';
|
|
7995
|
-
var COURT_IDS = 'courtIds';
|
|
7996
|
-
var PERSON_ID = 'personId';
|
|
7997
|
-
var VENUE_IDS = 'venueIds';
|
|
7998
|
-
var MATCHUPS = 'matchUps';
|
|
7999
|
-
var COURT_ID = 'courtId';
|
|
8000
|
-
var EVENT_ID = 'eventId';
|
|
8001
|
-
var MATCHUP = 'matchUp';
|
|
8002
|
-
var DRAW_ID = 'drawId';
|
|
8003
|
-
var ERROR = 'error';
|
|
8004
|
-
var EVENT = 'event';
|
|
8005
|
-
var PARAM = 'param';
|
|
8006
|
-
var AVERAGE_MATCHUP_MINUTES = 'averageMatchUpMinutes';
|
|
8007
|
-
var RECOVERY_MINUTES = 'recoveryMinutes';
|
|
8008
|
-
var PERIOD_LENGTH = 'periodLength';
|
|
8009
|
-
var OBJECT = 'object';
|
|
8010
|
-
var ARRAY = 'array';
|
|
8011
|
-
var VALIDATE = 'validate';
|
|
8012
|
-
var INVALID = 'invalid';
|
|
8013
|
-
var OF_TYPE = '_ofType';
|
|
8014
|
-
var ANY_OF = '_anyOf';
|
|
8015
|
-
var ONE_OF = '_oneOf';
|
|
8016
|
-
|
|
8017
|
-
var _a$h, _b$5;
|
|
8018
|
-
var errors = (_a$h = {},
|
|
8019
|
-
_a$h[TOURNAMENT_RECORDS] = MISSING_TOURNAMENT_RECORDS,
|
|
8020
|
-
_a$h[TOURNAMENT_RECORD] = MISSING_TOURNAMENT_RECORD,
|
|
8021
|
-
_a$h[POLICY_DEFINITIONS] = MISSING_POLICY_DEFINITION,
|
|
8022
|
-
_a$h[DRAW_DEFINITION] = MISSING_DRAW_DEFINITION,
|
|
8023
|
-
_a$h[PARTICIPANT_ID] = MISSING_PARTICIPANT_ID,
|
|
8024
|
-
_a$h[TOURNAMENT_ID] = MISSING_TOURNAMENT_ID,
|
|
8025
|
-
_a$h[STRUCTURE_ID] = MISSING_STRUCTURE_ID,
|
|
8026
|
-
_a$h[MATCHUP_IDS] = MISSING_MATCHUP_IDS,
|
|
8027
|
-
_a$h[STRUCTURES] = MISSING_STRUCTURES,
|
|
8028
|
-
_a$h[MATCHUP_ID] = MISSING_MATCHUP_ID,
|
|
8029
|
-
_a$h[STRUCTURE] = MISSING_STRUCTURE,
|
|
8030
|
-
_a$h[COURT_ID] = MISSING_COURT_ID,
|
|
8031
|
-
_a$h[MATCHUPS] = MISSING_MATCHUPS,
|
|
8032
|
-
_a$h[MATCHUP] = MISSING_MATCHUP,
|
|
8033
|
-
_a$h[COURT_IDS] = MISSING_VALUE,
|
|
8034
|
-
_a$h[VENUE_IDS] = MISSING_VALUE,
|
|
8035
|
-
_a$h[DRAW_ID] = MISSING_DRAW_ID,
|
|
8036
|
-
_a$h[EVENT_ID] = MISSING_EVENT,
|
|
8037
|
-
_a$h[EVENT] = EVENT_NOT_FOUND,
|
|
8038
|
-
_a$h);
|
|
8039
|
-
var paramTypes = (_b$5 = {},
|
|
8040
|
-
_b$5[TOURNAMENT_RECORDS] = OBJECT,
|
|
8041
|
-
_b$5[POLICY_DEFINITIONS] = OBJECT,
|
|
8042
|
-
_b$5[TOURNAMENT_RECORD] = OBJECT,
|
|
8043
|
-
_b$5[DRAW_DEFINITION] = OBJECT,
|
|
8044
|
-
_b$5[SCHEDULE_DATES] = ARRAY,
|
|
8045
|
-
_b$5[MATCHUP_IDS] = ARRAY,
|
|
8046
|
-
_b$5[STRUCTURES] = ARRAY,
|
|
8047
|
-
_b$5[STRUCTURE] = OBJECT,
|
|
8048
|
-
_b$5[COURT_IDS] = ARRAY,
|
|
8049
|
-
_b$5[VENUE_IDS] = ARRAY,
|
|
8050
|
-
_b$5[MATCHUPS] = ARRAY,
|
|
8051
|
-
_b$5[MATCHUP] = OBJECT,
|
|
8052
|
-
_b$5[EVENT] = OBJECT,
|
|
8053
|
-
_b$5);
|
|
8054
|
-
function checkRequiredParameters(params, requiredParams, stack) {
|
|
8055
|
-
if (!params && !isObject(params))
|
|
8056
|
-
return { error: INVALID_VALUES };
|
|
8057
|
-
if (!(requiredParams === null || requiredParams === void 0 ? void 0 : requiredParams.length) || (params === null || params === void 0 ? void 0 : params._bypassParamCheck))
|
|
8058
|
-
return { valid: true };
|
|
8059
|
-
if (!Array.isArray(requiredParams))
|
|
8060
|
-
return { error: INVALID_VALUES };
|
|
8061
|
-
var _a = findParamError(params, requiredParams), paramError = _a.paramError, errorParam = _a.errorParam;
|
|
8062
|
-
if (!paramError)
|
|
8063
|
-
return { valid: true };
|
|
8064
|
-
var error = params[errorParam] === undefined
|
|
8065
|
-
? errors[errorParam] || INVALID_VALUES
|
|
8066
|
-
: (paramError.validate && paramError.invalid) || INVALID_VALUES;
|
|
8067
|
-
return decorateResult({
|
|
8068
|
-
info: { param: errorParam },
|
|
8069
|
-
result: { error: error },
|
|
8070
|
-
stack: stack,
|
|
8071
|
-
});
|
|
8072
|
-
}
|
|
8073
|
-
function getIntersection(params, constraint) {
|
|
8074
|
-
var paramKeys = Object.keys(params);
|
|
8075
|
-
var constraintKeys = Object.keys(constraint);
|
|
8076
|
-
return intersection(paramKeys, constraintKeys);
|
|
8077
|
-
}
|
|
8078
|
-
function getOneOf(params, _oneOf) {
|
|
8079
|
-
if (!_oneOf)
|
|
8080
|
-
return;
|
|
8081
|
-
var overlap = getIntersection(params, _oneOf);
|
|
8082
|
-
if (overlap.length !== 1)
|
|
8083
|
-
return { error: INVALID_VALUES };
|
|
8084
|
-
return overlap.reduce(function (attr, param) {
|
|
8085
|
-
var _a;
|
|
8086
|
-
return (__assign(__assign({}, attr), (_a = {}, _a[param] = true, _a)));
|
|
8087
|
-
}, {});
|
|
8088
|
-
}
|
|
8089
|
-
function getAnyOf(params, _anyOf) {
|
|
8090
|
-
if (!_anyOf)
|
|
8091
|
-
return;
|
|
8092
|
-
var overlap = getIntersection(params, _anyOf).filter(function (param) { return params[param]; });
|
|
8093
|
-
if (overlap.length < 1)
|
|
8094
|
-
return { error: INVALID_VALUES };
|
|
8095
|
-
return overlap.reduce(function (attr, param) {
|
|
8096
|
-
var _a;
|
|
8097
|
-
return (__assign(__assign({}, attr), (_a = {}, _a[param] = true, _a)));
|
|
8098
|
-
}, {});
|
|
8099
|
-
}
|
|
8100
|
-
function findParamError(params, requiredParams) {
|
|
8101
|
-
var errorParam;
|
|
8102
|
-
var paramError = requiredParams.find(function (_a) {
|
|
8103
|
-
var _ofType = _a._ofType, _oneOf = _a._oneOf, _anyOf = _a._anyOf, validate = _a.validate, attrs = __rest(_a, ["_ofType", "_oneOf", "_anyOf", "validate"]);
|
|
8104
|
-
var oneOf = _oneOf && getOneOf(params, _oneOf);
|
|
8105
|
-
if (oneOf === null || oneOf === void 0 ? void 0 : oneOf.error)
|
|
8106
|
-
return oneOf.error;
|
|
8107
|
-
oneOf && Object.assign(attrs, oneOf);
|
|
8108
|
-
var anyOf = _anyOf && getAnyOf(params, _anyOf);
|
|
8109
|
-
if (anyOf === null || anyOf === void 0 ? void 0 : anyOf.error)
|
|
8110
|
-
return anyOf.error;
|
|
8111
|
-
anyOf && Object.assign(attrs, anyOf);
|
|
8112
|
-
var booleanParams = Object.keys(attrs).filter(function (key) { return typeof attrs[key] === 'boolean'; });
|
|
8113
|
-
var invalidParam = booleanParams.find(function (param) {
|
|
8114
|
-
var invalid = !isFunction(validate) &&
|
|
8115
|
-
(params[param] === undefined || invalidType(params, param, _ofType));
|
|
8116
|
-
var hasError = invalid || (validate && !checkValidation(params[param], validate));
|
|
8117
|
-
if (hasError)
|
|
8118
|
-
errorParam = param;
|
|
8119
|
-
return hasError;
|
|
8120
|
-
});
|
|
8121
|
-
return !booleanParams.length || invalidParam;
|
|
8122
|
-
});
|
|
8123
|
-
return { paramError: paramError, errorParam: errorParam };
|
|
8124
|
-
}
|
|
8125
|
-
function invalidType(params, param, _ofType) {
|
|
8126
|
-
_ofType = _ofType || paramTypes[param] || 'string';
|
|
8127
|
-
if (_ofType === 'array') {
|
|
8128
|
-
return !Array.isArray(params[param]);
|
|
8129
|
-
}
|
|
8130
|
-
return typeof params[param] !== _ofType;
|
|
8131
|
-
}
|
|
8132
|
-
function checkValidation(value, validate) {
|
|
8133
|
-
if (isFunction(validate))
|
|
8134
|
-
return validate(value);
|
|
8135
|
-
return true;
|
|
8136
|
-
}
|
|
8137
|
-
|
|
8138
8144
|
// derive matchUpType from participants when not defined on matchUp
|
|
8139
8145
|
function getMatchUpType(params) {
|
|
8140
8146
|
var _a;
|
|
@@ -13279,10 +13285,7 @@ function getPublishState(_a) {
|
|
|
13279
13285
|
}
|
|
13280
13286
|
return __assign(__assign({}, SUCCESS), { publishState: publishState });
|
|
13281
13287
|
}
|
|
13282
|
-
else if (!event &&
|
|
13283
|
-
(tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) &&
|
|
13284
|
-
Array.isArray(drawIds) &&
|
|
13285
|
-
drawIds.length) {
|
|
13288
|
+
else if (!event && (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) && Array.isArray(drawIds) && drawIds.length) {
|
|
13286
13289
|
var publishState = {};
|
|
13287
13290
|
try {
|
|
13288
13291
|
for (var _f = __values(tournamentRecord.events), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
@@ -13368,10 +13371,7 @@ function getPubStatus(_a) {
|
|
|
13368
13371
|
Object.assign(publishedSeeding, eventPubStatus.seeding);
|
|
13369
13372
|
}
|
|
13370
13373
|
var drawDetails = eventPubStatus.drawDetails;
|
|
13371
|
-
var publishedDrawIds = (drawDetails &&
|
|
13372
|
-
Object.keys(drawDetails).filter(function (drawId) {
|
|
13373
|
-
return getDrawPublishStatus({ drawDetails: drawDetails, drawId: drawId });
|
|
13374
|
-
})) ||
|
|
13374
|
+
var publishedDrawIds = (drawDetails && Object.keys(drawDetails).filter(function (drawId) { return getDrawPublishStatus({ drawDetails: drawDetails, drawId: drawId }); })) ||
|
|
13375
13375
|
eventPubStatus.drawIds ||
|
|
13376
13376
|
[];
|
|
13377
13377
|
return __assign({ publishState: {
|
|
@@ -16143,9 +16143,7 @@ function validateSchedulingProfile(_a) {
|
|
|
16143
16143
|
info = 'Invalid rounds';
|
|
16144
16144
|
var _d = roundSegment || {}, segmentNumber = _d.segmentNumber, segmentsCount = _d.segmentsCount;
|
|
16145
16145
|
var validSegment = !roundSegment ||
|
|
16146
|
-
(isConvertableInteger(segmentNumber) &&
|
|
16147
|
-
isPowerOf2(segmentsCount) &&
|
|
16148
|
-
segmentNumber <= segmentsCount);
|
|
16146
|
+
(isConvertableInteger(segmentNumber) && isPowerOf2(segmentsCount) && segmentNumber <= segmentsCount);
|
|
16149
16147
|
if (!validSegment)
|
|
16150
16148
|
info = 'Invalid segment';
|
|
16151
16149
|
return validRound && validSegment;
|
|
@@ -16187,10 +16185,7 @@ function tournamentRelevantSchedulingIds(params) {
|
|
|
16187
16185
|
var structureId = structure.structureId;
|
|
16188
16186
|
var matchUps = getAllStructureMatchUps({ structure: structure }).matchUps;
|
|
16189
16187
|
var roundMatchUps = getRoundMatchUps({ matchUps: matchUps }).roundMatchUps;
|
|
16190
|
-
var rounds = roundMatchUps &&
|
|
16191
|
-
Object.keys(roundMatchUps).map(function (roundNumber) {
|
|
16192
|
-
return parseInt(roundNumber);
|
|
16193
|
-
});
|
|
16188
|
+
var rounds = roundMatchUps && Object.keys(roundMatchUps).map(function (roundNumber) { return parseInt(roundNumber); });
|
|
16194
16189
|
tournamentMap[tournamentId][eventId][drawId][structureId] = rounds;
|
|
16195
16190
|
structureIds.push(structureId);
|
|
16196
16191
|
if ((_a = structure.structures) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -16213,8 +16208,7 @@ function tournamentRelevantSchedulingIds(params) {
|
|
|
16213
16208
|
};
|
|
16214
16209
|
}
|
|
16215
16210
|
function getAllRelevantSchedulingIds(params) {
|
|
16216
|
-
var records = ((params === null || params === void 0 ? void 0 : params.tournamentRecords) && Object.values(params === null || params === void 0 ? void 0 : params.tournamentRecords)) ||
|
|
16217
|
-
[];
|
|
16211
|
+
var records = ((params === null || params === void 0 ? void 0 : params.tournamentRecords) && Object.values(params === null || params === void 0 ? void 0 : params.tournamentRecords)) || [];
|
|
16218
16212
|
var tournamentsMap = {};
|
|
16219
16213
|
var _a = records.reduce(function (aggregator, tournamentRecord) {
|
|
16220
16214
|
var _a, _b, _c, _d;
|
|
@@ -19925,7 +19919,7 @@ function qualifierDrawPositionAssignment(params) {
|
|
|
19925
19919
|
}
|
|
19926
19920
|
|
|
19927
19921
|
function getTieMatchUpContext(_a) {
|
|
19928
|
-
var _b;
|
|
19922
|
+
var _b, _c, _d, _e;
|
|
19929
19923
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, tieMatchUpId = _a.tieMatchUpId, event = _a.event;
|
|
19930
19924
|
if (!tournamentRecord)
|
|
19931
19925
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -19942,14 +19936,14 @@ function getTieMatchUpContext(_a) {
|
|
|
19942
19936
|
}).matchUp;
|
|
19943
19937
|
if (!tieMatchUp)
|
|
19944
19938
|
return { error: MATCHUP_NOT_FOUND };
|
|
19945
|
-
var
|
|
19939
|
+
var _f = findDrawMatchUp({
|
|
19946
19940
|
tournamentParticipants: tournamentRecord.participants,
|
|
19947
19941
|
matchUpId: tieMatchUpId,
|
|
19948
19942
|
inContext: true,
|
|
19949
19943
|
drawDefinition: drawDefinition,
|
|
19950
19944
|
matchUpsMap: matchUpsMap,
|
|
19951
19945
|
event: event,
|
|
19952
|
-
}), inContextTieMatchUp =
|
|
19946
|
+
}), inContextTieMatchUp = _f.matchUp, structure = _f.structure;
|
|
19953
19947
|
if (!inContextTieMatchUp)
|
|
19954
19948
|
return { error: MATCHUP_NOT_FOUND };
|
|
19955
19949
|
var collectionPosition = inContextTieMatchUp.collectionPosition, drawPositions = inContextTieMatchUp.drawPositions, collectionId = inContextTieMatchUp.collectionId, matchUpTieId = inContextTieMatchUp.matchUpTieId, matchUpType = inContextTieMatchUp.matchUpType;
|
|
@@ -19957,7 +19951,14 @@ function getTieMatchUpContext(_a) {
|
|
|
19957
19951
|
return { error: INVALID_MATCHUP };
|
|
19958
19952
|
var positionAssignments = getPositionAssignments$1({ structure: structure }).positionAssignments;
|
|
19959
19953
|
var relevantAssignments = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) { return drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.includes(assignment.drawPosition); });
|
|
19960
|
-
var
|
|
19954
|
+
var dualMatchUp = findDrawMatchUp({
|
|
19955
|
+
matchUpId: matchUpTieId,
|
|
19956
|
+
drawDefinition: drawDefinition,
|
|
19957
|
+
matchUpsMap: matchUpsMap,
|
|
19958
|
+
}).matchUp;
|
|
19959
|
+
var sideParticipantIds = (_c = (_b = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _b === void 0 ? void 0 : _b.map(extractAttributes('participantId'))) !== null && _c !== void 0 ? _c : [];
|
|
19960
|
+
var assignedParticipantIds = (_d = relevantAssignments === null || relevantAssignments === void 0 ? void 0 : relevantAssignments.map(extractAttributes('participantId'))) !== null && _d !== void 0 ? _d : [];
|
|
19961
|
+
var participantIds = __spreadArray(__spreadArray([], __read(sideParticipantIds), false), __read(assignedParticipantIds), false);
|
|
19961
19962
|
var teamParticipants = getParticipants({
|
|
19962
19963
|
tournamentRecord: tournamentRecord,
|
|
19963
19964
|
participantFilters: {
|
|
@@ -19965,23 +19966,18 @@ function getTieMatchUpContext(_a) {
|
|
|
19965
19966
|
participantIds: participantIds,
|
|
19966
19967
|
},
|
|
19967
19968
|
}).participants;
|
|
19968
|
-
var dualMatchUp = findDrawMatchUp({
|
|
19969
|
-
matchUpId: matchUpTieId,
|
|
19970
|
-
drawDefinition: drawDefinition,
|
|
19971
|
-
matchUpsMap: matchUpsMap,
|
|
19972
|
-
}).matchUp;
|
|
19973
19969
|
var inContextDualMatchUp = findDrawMatchUp({
|
|
19974
19970
|
matchUpId: matchUpTieId,
|
|
19975
19971
|
inContext: true,
|
|
19976
19972
|
drawDefinition: drawDefinition,
|
|
19977
19973
|
matchUpsMap: matchUpsMap,
|
|
19978
19974
|
}).matchUp;
|
|
19979
|
-
var tieFormat = (
|
|
19975
|
+
var tieFormat = (_e = resolveTieFormat({
|
|
19980
19976
|
matchUp: dualMatchUp,
|
|
19981
19977
|
drawDefinition: drawDefinition,
|
|
19982
19978
|
structure: structure,
|
|
19983
19979
|
event: event,
|
|
19984
|
-
})) === null ||
|
|
19980
|
+
})) === null || _e === void 0 ? void 0 : _e.tieFormat;
|
|
19985
19981
|
return __assign({ inContextDualMatchUp: inContextDualMatchUp, inContextTieMatchUp: inContextTieMatchUp, relevantAssignments: relevantAssignments, collectionPosition: collectionPosition, teamParticipants: teamParticipants, collectionId: collectionId, matchUpType: matchUpType, dualMatchUp: dualMatchUp, tieMatchUp: tieMatchUp, tieFormat: tieFormat, structure: structure }, SUCCESS);
|
|
19986
19982
|
}
|
|
19987
19983
|
|
|
@@ -20814,9 +20810,8 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
20814
20810
|
var individualParticipantIds = _a.individualParticipantIds;
|
|
20815
20811
|
return overlap(relevantParticipantIds, individualParticipantIds);
|
|
20816
20812
|
}));
|
|
20817
|
-
if (!participantTeam)
|
|
20813
|
+
if (!participantTeam)
|
|
20818
20814
|
return { error: TEAM_NOT_FOUND };
|
|
20819
|
-
}
|
|
20820
20815
|
if (!teamParticipantId)
|
|
20821
20816
|
teamParticipantId = participantTeam.participantId;
|
|
20822
20817
|
if (!teamParticipantId)
|
|
@@ -21424,9 +21419,9 @@ function calculateWinCriteria(_a) {
|
|
|
21424
21419
|
finally { if (e_3) throw e_3.error; }
|
|
21425
21420
|
}
|
|
21426
21421
|
if (aggregateValueImperative || !valueTotal)
|
|
21427
|
-
return { aggregateValue: true };
|
|
21422
|
+
return __assign({ aggregateValue: true }, SUCCESS);
|
|
21428
21423
|
var valueGoal = Math.floor(valueTotal / 2) + 1;
|
|
21429
|
-
return { valueGoal: valueGoal };
|
|
21424
|
+
return __assign({ valueGoal: valueGoal }, SUCCESS);
|
|
21430
21425
|
}
|
|
21431
21426
|
|
|
21432
21427
|
function getTieFormat$1(_a) {
|
|
@@ -21586,7 +21581,8 @@ function tiebreakFormat(tieobject) {
|
|
|
21586
21581
|
return undefined;
|
|
21587
21582
|
}
|
|
21588
21583
|
|
|
21589
|
-
function isValidMatchUpFormat(
|
|
21584
|
+
function isValidMatchUpFormat(_a) {
|
|
21585
|
+
var matchUpFormat = _a.matchUpFormat;
|
|
21590
21586
|
if (typeof matchUpFormat !== 'string')
|
|
21591
21587
|
return false;
|
|
21592
21588
|
var parsedFormat = parse(matchUpFormat);
|
|
@@ -21968,7 +21964,8 @@ function validateCollectionDefinition(_a) {
|
|
|
21968
21964
|
if (collectionGroupNumber && typeof collectionGroupNumber !== 'number') {
|
|
21969
21965
|
errors.push("collectionGroupNumber is not type number: ".concat(collectionValue));
|
|
21970
21966
|
}
|
|
21971
|
-
if (matchUpFormat &&
|
|
21967
|
+
if (matchUpFormat &&
|
|
21968
|
+
!matchUpFormatCode.isValidMatchUpFormat({ matchUpFormat: matchUpFormat })) {
|
|
21972
21969
|
errors.push("Invalid matchUpFormat: ".concat(matchUpFormat));
|
|
21973
21970
|
}
|
|
21974
21971
|
if (checkGender) {
|
|
@@ -22653,7 +22650,7 @@ function modifyCollectionDefinition(_a) {
|
|
|
22653
22650
|
// value assignment, only one is allowed to have a value
|
|
22654
22651
|
collectionValueProfiles = _a.collectionValueProfiles, collectionValue = _a.collectionValue, matchUpValue = _a.matchUpValue, scoreValue = _a.scoreValue, setValue = _a.setValue;
|
|
22655
22652
|
var stack = 'modifyCollectionDefinition';
|
|
22656
|
-
if (matchUpFormat && !isValidMatchUpFormat(matchUpFormat)) {
|
|
22653
|
+
if (matchUpFormat && !isValidMatchUpFormat({ matchUpFormat: matchUpFormat })) {
|
|
22657
22654
|
return decorateResult({
|
|
22658
22655
|
result: { error: INVALID_VALUES },
|
|
22659
22656
|
context: { matchUpFormat: matchUpFormat },
|
|
@@ -25212,9 +25209,7 @@ function automatedPositioning(_a) {
|
|
|
25212
25209
|
return handleErrorCondition(result_1);
|
|
25213
25210
|
unseededByePositions = result_1.unseededByePositions;
|
|
25214
25211
|
positioningReport.push({ action: 'positionByes', unseededByePositions: unseededByePositions });
|
|
25215
|
-
var profileSeeding = structure.seedingProfile
|
|
25216
|
-
? { positioning: structure.seedingProfile }
|
|
25217
|
-
: seedingProfile;
|
|
25212
|
+
var profileSeeding = structure.seedingProfile ? { positioning: structure.seedingProfile } : seedingProfile;
|
|
25218
25213
|
result_1 = positionSeedBlocks({
|
|
25219
25214
|
seedingProfile: profileSeeding,
|
|
25220
25215
|
provisionalPositioning: provisionalPositioning,
|
|
@@ -25240,9 +25235,7 @@ function automatedPositioning(_a) {
|
|
|
25240
25235
|
// otherwise... seeds need to be placed first so that BYEs
|
|
25241
25236
|
// can follow the seedValues of placed seeds
|
|
25242
25237
|
if (drawType !== LUCKY_DRAW) {
|
|
25243
|
-
var profileSeeding = structure.seedingProfile
|
|
25244
|
-
? { positioning: structure.seedingProfile }
|
|
25245
|
-
: seedingProfile;
|
|
25238
|
+
var profileSeeding = structure.seedingProfile ? { positioning: structure.seedingProfile } : seedingProfile;
|
|
25246
25239
|
var result_2 = positionSeedBlocks({
|
|
25247
25240
|
seedingProfile: profileSeeding,
|
|
25248
25241
|
provisionalPositioning: provisionalPositioning,
|
|
@@ -25549,11 +25542,10 @@ function getSourceRounds(_a) {
|
|
|
25549
25542
|
structureId: structureId,
|
|
25550
25543
|
});
|
|
25551
25544
|
// reduce the sourceRoundsMap to roundNumbers, not including excludedRoundNumbers
|
|
25552
|
-
var
|
|
25545
|
+
var keys = Object.values(playoffPositionSourceRoundsMap);
|
|
25546
|
+
var relevantPlayoffSourceRounds = keys
|
|
25553
25547
|
.reduce(function (rounds, round) {
|
|
25554
|
-
return rounds.includes(round.roundNumber)
|
|
25555
|
-
? rounds
|
|
25556
|
-
: rounds.concat(round.roundNumber);
|
|
25548
|
+
return rounds.includes(round.roundNumber) ? rounds : rounds.concat(round.roundNumber);
|
|
25557
25549
|
}, [])
|
|
25558
25550
|
.map(function (roundNumber) { return ensureInt(roundNumber); })
|
|
25559
25551
|
.filter(function (roundNumber) { return !excludeRoundNumbers.includes(roundNumber); });
|
|
@@ -25564,12 +25556,11 @@ function getSourceRounds(_a) {
|
|
|
25564
25556
|
structureId: structureId,
|
|
25565
25557
|
});
|
|
25566
25558
|
// determine which rounds produced played off positions
|
|
25559
|
+
var roundsMapValues = playedOffRoundsMap ? Object.values(playedOffRoundsMap) : [];
|
|
25567
25560
|
var playedOffSourceRounds = playedOffRoundsMap
|
|
25568
|
-
?
|
|
25561
|
+
? roundsMapValues
|
|
25569
25562
|
.reduce(function (rounds, round) {
|
|
25570
|
-
return rounds.includes(round.roundNumber)
|
|
25571
|
-
? rounds
|
|
25572
|
-
: rounds.concat(round.roundNumber);
|
|
25563
|
+
return rounds.includes(round.roundNumber) ? rounds : rounds.concat(round.roundNumber);
|
|
25573
25564
|
}, [])
|
|
25574
25565
|
.map(function (round) { return ensureInt(round); })
|
|
25575
25566
|
: [];
|
|
@@ -32909,7 +32900,7 @@ function setMatchUpMatchUpFormat(params) {
|
|
|
32909
32900
|
return { error: MISSING_DRAW_DEFINITION };
|
|
32910
32901
|
if (!matchUpFormat)
|
|
32911
32902
|
return { error: MISSING_MATCHUP_FORMAT };
|
|
32912
|
-
if (!isValidMatchUpFormat(matchUpFormat))
|
|
32903
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
32913
32904
|
return { error: UNRECOGNIZED_MATCHUP_FORMAT };
|
|
32914
32905
|
var stack = 'setMatchUpFormat';
|
|
32915
32906
|
if (matchUpId) {
|
|
@@ -32992,7 +32983,7 @@ function setMatchUpFormat(params) {
|
|
|
32992
32983
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
32993
32984
|
if (!matchUpFormat)
|
|
32994
32985
|
return { error: MISSING_MATCHUP_FORMAT };
|
|
32995
|
-
if (matchUpFormat && !isValidMatchUpFormat(matchUpFormat))
|
|
32986
|
+
if (matchUpFormat && !isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
32996
32987
|
return decorateResult({
|
|
32997
32988
|
result: { error: UNRECOGNIZED_MATCHUP_FORMAT, matchUpFormat: matchUpFormat },
|
|
32998
32989
|
stack: stack,
|
|
@@ -36965,7 +36956,7 @@ function assignSeedPositions(params) {
|
|
|
36965
36956
|
|
|
36966
36957
|
function addParticipants(_a) {
|
|
36967
36958
|
var e_1, _b;
|
|
36968
|
-
var allowDuplicateParticipantIdPairs = _a.allowDuplicateParticipantIdPairs, returnParticipants = _a.returnParticipants,
|
|
36959
|
+
var allowDuplicateParticipantIdPairs = _a.allowDuplicateParticipantIdPairs, returnParticipants = _a.returnParticipants, tournamentRecord = _a.tournamentRecord, _c = _a.participants, participants = _c === void 0 ? [] : _c;
|
|
36969
36960
|
if (!tournamentRecord)
|
|
36970
36961
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
36971
36962
|
if (!tournamentRecord.participants)
|
|
@@ -36977,9 +36968,7 @@ function addParticipants(_a) {
|
|
|
36977
36968
|
participant.participantId = UUID();
|
|
36978
36969
|
});
|
|
36979
36970
|
var newParticipants = participants.filter(function (participant) { return !existingParticipantIds.includes(participant.participantId); });
|
|
36980
|
-
var notAdded = participants.filter(function (participant) {
|
|
36981
|
-
return existingParticipantIds.includes(participant.participantId);
|
|
36982
|
-
});
|
|
36971
|
+
var notAdded = participants.filter(function (participant) { return existingParticipantIds.includes(participant.participantId); });
|
|
36983
36972
|
var individualParticipants = newParticipants.filter(function (participant) { return participant.participantType === INDIVIDUAL; });
|
|
36984
36973
|
var groupedParticipants = newParticipants.filter(function (participant) { return participant.participantType !== INDIVIDUAL; });
|
|
36985
36974
|
// add individual participants first so that grouped participants which include them are valid
|
|
@@ -40626,7 +40615,7 @@ function setEventStartDate(_a) {
|
|
|
40626
40615
|
newEventStartDate > tournamentEndDate)
|
|
40627
40616
|
return { error: INVALID_DATE };
|
|
40628
40617
|
// use extractDate() to ensure that only the YYYY-MM-DD part of date is used for comparison
|
|
40629
|
-
var eventEndDate = event.endDate && new Date(extractDate(event.endDate));
|
|
40618
|
+
var eventEndDate = event.endDate && new Date(extractDate(event.endDate)).getTime();
|
|
40630
40619
|
if (eventEndDate && newEventStartDate > eventEndDate) {
|
|
40631
40620
|
// if the new startDate is after an existing endDate set the endDate to the startDate
|
|
40632
40621
|
event.endDate = startDate;
|
|
@@ -40654,7 +40643,7 @@ function setEventEndDate(_a) {
|
|
|
40654
40643
|
newEventEndDate > tournamentEndDate)
|
|
40655
40644
|
return { error: INVALID_DATE };
|
|
40656
40645
|
// use extractDate() to ensure that only the YYYY-MM-DD part of date is used for comparison
|
|
40657
|
-
var eventStartDate = event.startDate && new Date(extractDate(event.startDate));
|
|
40646
|
+
var eventStartDate = event.startDate && new Date(extractDate(event.startDate)).getTime();
|
|
40658
40647
|
if (eventStartDate && newEventEndDate < eventStartDate) {
|
|
40659
40648
|
// if the new endDate is before an existing startDate set the startDate to the endDate
|
|
40660
40649
|
event.startDate = endDate;
|
|
@@ -40675,8 +40664,8 @@ function setEventDates(_a) {
|
|
|
40675
40664
|
if (endDate && !dateValidation.test(endDate))
|
|
40676
40665
|
return { error: INVALID_DATE };
|
|
40677
40666
|
if (startDate && endDate) {
|
|
40678
|
-
var newStartDate = new Date(extractDate(startDate));
|
|
40679
|
-
var newEndDate = new Date(extractDate(endDate));
|
|
40667
|
+
var newStartDate = new Date(extractDate(startDate)).getTime();
|
|
40668
|
+
var newEndDate = new Date(extractDate(endDate)).getTime();
|
|
40680
40669
|
if (newStartDate > newEndDate)
|
|
40681
40670
|
return { error: INVALID_VALUES };
|
|
40682
40671
|
}
|
|
@@ -42844,8 +42833,7 @@ function generateLineUps(params) {
|
|
|
42844
42833
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
42845
42834
|
if (!tieFormat && !drawDefinition)
|
|
42846
42835
|
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
42847
|
-
tieFormat =
|
|
42848
|
-
tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_c = resolveTieFormat({ drawDefinition: drawDefinition, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat;
|
|
42836
|
+
tieFormat = tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_c = resolveTieFormat({ drawDefinition: drawDefinition, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat;
|
|
42849
42837
|
if (validateTieFormat({ tieFormat: tieFormat }).error)
|
|
42850
42838
|
return { error: INVALID_TIE_FORMAT };
|
|
42851
42839
|
if (typeof scaleAccessor !== 'object' && !useDefaultEventRanking)
|
|
@@ -42871,8 +42859,7 @@ function generateLineUps(params) {
|
|
|
42871
42859
|
var matchUpTypeScales = (_a = individualParticipant[formattedScaleType]) === null || _a === void 0 ? void 0 : _a[matchUpType];
|
|
42872
42860
|
// if { userDefaultEventRanking: true } fallback to SINGLES if no values for DOUBLES
|
|
42873
42861
|
if (!matchUpTypeScales && useDefaultEventRanking) {
|
|
42874
|
-
matchUpTypeScales =
|
|
42875
|
-
(_b = individualParticipant[formattedScaleType]) === null || _b === void 0 ? void 0 : _b[SINGLES_MATCHUP];
|
|
42862
|
+
matchUpTypeScales = (_b = individualParticipant[formattedScaleType]) === null || _b === void 0 ? void 0 : _b[SINGLES_MATCHUP];
|
|
42876
42863
|
}
|
|
42877
42864
|
if (Array.isArray(matchUpTypeScales)) {
|
|
42878
42865
|
var scaleValue = (_c = matchUpTypeScales.find(function (scale) { return scale.scaleName === scaleName; })) === null || _c === void 0 ? void 0 : _c.scaleValue;
|
|
@@ -42912,9 +42899,7 @@ function generateLineUps(params) {
|
|
|
42912
42899
|
var _a;
|
|
42913
42900
|
var nextParticipantId = (_a = typeSort === null || typeSort === void 0 ? void 0 : typeSort.find(function (participant) {
|
|
42914
42901
|
var _a;
|
|
42915
|
-
var targetGender = gender &&
|
|
42916
|
-
(([MALE, FEMALE].includes(gender) && gender) ||
|
|
42917
|
-
(gender === MIXED && [MALE, FEMALE][i]));
|
|
42902
|
+
var targetGender = gender && (([MALE, FEMALE].includes(gender) && gender) || (gender === MIXED && [MALE, FEMALE][i]));
|
|
42918
42903
|
return ((!targetGender || targetGender === ((_a = participant.person) === null || _a === void 0 ? void 0 : _a.sex)) &&
|
|
42919
42904
|
!collectionParticipantIds.includes(participant.participantId));
|
|
42920
42905
|
})) === null || _a === void 0 ? void 0 : _a.participantId;
|
|
@@ -45210,7 +45195,7 @@ function checkRequestConflicts(_a) {
|
|
|
45210
45195
|
|
|
45211
45196
|
function findMatchUpFormatTiming(_a) {
|
|
45212
45197
|
var _b = _a.defaultRecoveryMinutes, defaultRecoveryMinutes = _b === void 0 ? 0 : _b, defaultAverageMinutes = _a.defaultAverageMinutes, tournamentRecords = _a.tournamentRecords, matchUpFormat = _a.matchUpFormat, categoryName = _a.categoryName, categoryType = _a.categoryType, tournamentId = _a.tournamentId, eventType = _a.eventType, eventId = _a.eventId;
|
|
45213
|
-
if (!isValidMatchUpFormat(matchUpFormat))
|
|
45198
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
45214
45199
|
return { error: UNRECOGNIZED_MATCHUP_FORMAT };
|
|
45215
45200
|
var tournamentIds = Object.keys(tournamentRecords).filter(function (currentTournamentId) {
|
|
45216
45201
|
return !tournamentId || currentTournamentId === tournamentId;
|
|
@@ -47482,14 +47467,10 @@ function generateParticipants(params) {
|
|
|
47482
47467
|
var doubles = participantType === PAIR || matchUpType === DOUBLES_MATCHUP;
|
|
47483
47468
|
var team = participantType === TEAM || matchUpType === TEAM;
|
|
47484
47469
|
if (rankingRange &&
|
|
47485
|
-
(!Array.isArray(rankingRange) ||
|
|
47486
|
-
!rankingRange.every(function (r) { return isNumeric(r); }) ||
|
|
47487
|
-
rankingRange.length !== 2)) {
|
|
47470
|
+
(!Array.isArray(rankingRange) || !rankingRange.every(function (r) { return isNumeric(r); }) || rankingRange.length !== 2)) {
|
|
47488
47471
|
rankingRange = undefined;
|
|
47489
47472
|
}
|
|
47490
|
-
scaledParticipantsCount = scaleAllParticipants
|
|
47491
|
-
? participantsCount
|
|
47492
|
-
: scaledParticipantsCount;
|
|
47473
|
+
scaledParticipantsCount = scaleAllParticipants ? participantsCount : scaledParticipantsCount;
|
|
47493
47474
|
var defaultRankingRange = 1000;
|
|
47494
47475
|
var rankingUpperBound = scaledParticipantsCount && scaledParticipantsCount > defaultRankingRange
|
|
47495
47476
|
? scaledParticipantsCount
|
|
@@ -47529,13 +47510,14 @@ function generateParticipants(params) {
|
|
|
47529
47510
|
var getAttributes_1 = function (attributes) {
|
|
47530
47511
|
var e_1, _a;
|
|
47531
47512
|
var generatedAttributes = {};
|
|
47513
|
+
var attributeKeys = Object.keys(attributes || {});
|
|
47532
47514
|
try {
|
|
47533
|
-
for (var
|
|
47534
|
-
var attribute =
|
|
47515
|
+
for (var attributeKeys_1 = __values(attributeKeys), attributeKeys_1_1 = attributeKeys_1.next(); !attributeKeys_1_1.done; attributeKeys_1_1 = attributeKeys_1.next()) {
|
|
47516
|
+
var attribute = attributeKeys_1_1.value;
|
|
47535
47517
|
var attributeValue = attributes[attribute];
|
|
47536
47518
|
if (typeof attributeValue === 'object' && attributeValue.generator) {
|
|
47537
47519
|
var range_1 = attributeValue.range;
|
|
47538
|
-
var
|
|
47520
|
+
var _b = __read(range_1.slice().sort(), 2), min_1 = _b[0], max_1 = _b[1];
|
|
47539
47521
|
generatedAttributes[attribute] = randomInt(min_1, max_1);
|
|
47540
47522
|
}
|
|
47541
47523
|
else {
|
|
@@ -47546,7 +47528,7 @@ function generateParticipants(params) {
|
|
|
47546
47528
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
47547
47529
|
finally {
|
|
47548
47530
|
try {
|
|
47549
|
-
if (
|
|
47531
|
+
if (attributeKeys_1_1 && !attributeKeys_1_1.done && (_a = attributeKeys_1.return)) _a.call(attributeKeys_1);
|
|
47550
47532
|
}
|
|
47551
47533
|
finally { if (e_1) throw e_1.error; }
|
|
47552
47534
|
}
|
|
@@ -47558,10 +47540,7 @@ function generateParticipants(params) {
|
|
|
47558
47540
|
var generateRatings = function () {
|
|
47559
47541
|
return generateRange(0, 2000) // overgenerate because filter and restricted range will impact final count
|
|
47560
47542
|
.map(function () { return skewedDistribution(min_2, max_2, skew_1, step_1, decimalsCount_1); })
|
|
47561
|
-
.filter(function (rating) {
|
|
47562
|
-
return (!ratingMax_1 || rating <= ratingMax_1) &&
|
|
47563
|
-
(!ratingMin_1 || rating >= ratingMin_1);
|
|
47564
|
-
})
|
|
47543
|
+
.filter(function (rating) { return (!ratingMax_1 || rating <= ratingMax_1) && (!ratingMin_1 || rating >= ratingMin_1); })
|
|
47565
47544
|
.slice(0, scaledParticipantsCount || randomInt(20, 30))
|
|
47566
47545
|
.map(function (scaleValue) {
|
|
47567
47546
|
return !accessors_1
|
|
@@ -47616,9 +47595,7 @@ function generateParticipants(params) {
|
|
|
47616
47595
|
var isoList = isoMin
|
|
47617
47596
|
? shuffleArray(countryCodes).slice(0, nationalityCodesCount)
|
|
47618
47597
|
: nationalityCodes
|
|
47619
|
-
? countryCodes.filter(function (isoCountry) {
|
|
47620
|
-
return nationalityCodes.includes(isoCountry.iso);
|
|
47621
|
-
})
|
|
47598
|
+
? countryCodes.filter(function (isoCountry) { return nationalityCodes.includes(isoCountry.iso); })
|
|
47622
47599
|
: countryCodes;
|
|
47623
47600
|
var countriesList = shuffleArray(generateRange(0, Math.ceil(individualParticipantsCount / (isoMin || 1)))
|
|
47624
47601
|
.map(function () { return isoList; })
|
|
@@ -47632,9 +47609,7 @@ function generateParticipants(params) {
|
|
|
47632
47609
|
return generateIndividualParticipant(participantIndex);
|
|
47633
47610
|
});
|
|
47634
47611
|
var individualParticipantIds = individualParticipants.map(function (participant) { return participant.participantId; });
|
|
47635
|
-
var pairName = individualParticipants
|
|
47636
|
-
.map(function (i) { return i.person.standardFamilyName; })
|
|
47637
|
-
.join('/');
|
|
47612
|
+
var pairName = individualParticipants.map(function (i) { return i.person.standardFamilyName; }).join('/');
|
|
47638
47613
|
var participantType = doubles ? PAIR : TEAM;
|
|
47639
47614
|
var groupParticipant = {
|
|
47640
47615
|
participantId: genParticipantId({
|
|
@@ -47650,8 +47625,7 @@ function generateParticipants(params) {
|
|
|
47650
47625
|
};
|
|
47651
47626
|
if (inContext)
|
|
47652
47627
|
groupParticipant.individualParticipants = individualParticipants;
|
|
47653
|
-
return doubles || team
|
|
47654
|
-
? __spreadArray([groupParticipant], __read(individualParticipants), false) : individualParticipants;
|
|
47628
|
+
return doubles || team ? __spreadArray([groupParticipant], __read(individualParticipants), false) : individualParticipants;
|
|
47655
47629
|
})
|
|
47656
47630
|
.flat();
|
|
47657
47631
|
return { participants: participants };
|
|
@@ -47663,10 +47637,7 @@ function generateParticipants(params) {
|
|
|
47663
47637
|
var participantName = "".concat(standardGivenName, " ").concat(standardFamilyName);
|
|
47664
47638
|
var country = countriesList[participantIndex];
|
|
47665
47639
|
var nationalityCode = ((personNationalityCodes === null || personNationalityCodes === void 0 ? void 0 : personNationalityCodes.length) && personNationalityCode) ||
|
|
47666
|
-
(country &&
|
|
47667
|
-
(nationalityCodeType === 'IOC'
|
|
47668
|
-
? country.ioc || country.iso
|
|
47669
|
-
: country.iso || country.ioc)) ||
|
|
47640
|
+
(country && (nationalityCodeType === 'IOC' ? country.ioc || country.iso : country.iso || country.ioc)) ||
|
|
47670
47641
|
personNationalityCode;
|
|
47671
47642
|
if ((countriesList === null || countriesList === void 0 ? void 0 : countriesList.length) && !nationalityCode && !personNationalityCode) {
|
|
47672
47643
|
console.log('%c Invalid Nationality Code', { participantIndex: participantIndex, country: country });
|
|
@@ -47686,9 +47657,7 @@ function generateParticipants(params) {
|
|
|
47686
47657
|
participantName: participantName,
|
|
47687
47658
|
person: {
|
|
47688
47659
|
addresses: [address],
|
|
47689
|
-
personId: personId ||
|
|
47690
|
-
((personIds === null || personIds === void 0 ? void 0 : personIds.length) && personIds[participantIndex]) ||
|
|
47691
|
-
UUID(),
|
|
47660
|
+
personId: personId || ((personIds === null || personIds === void 0 ? void 0 : personIds.length) && personIds[participantIndex]) || UUID(),
|
|
47692
47661
|
standardFamilyName: standardFamilyName,
|
|
47693
47662
|
standardGivenName: standardGivenName,
|
|
47694
47663
|
nationalityCode: nationalityCode,
|
|
@@ -47767,10 +47736,7 @@ function addScaleItem(_a) {
|
|
|
47767
47736
|
}
|
|
47768
47737
|
function genParticipantId(_a) {
|
|
47769
47738
|
var idPrefix = _a.idPrefix, participantType = _a.participantType, index = _a.index, uuids = _a.uuids;
|
|
47770
|
-
var type = participantType === INDIVIDUAL
|
|
47771
|
-
? 'I'
|
|
47772
|
-
: 'P'
|
|
47773
|
-
;
|
|
47739
|
+
var type = participantType === INDIVIDUAL ? 'I' : 'P' ;
|
|
47774
47740
|
return idPrefix ? "".concat(idPrefix, "-").concat(type, "-").concat(index) : (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID();
|
|
47775
47741
|
}
|
|
47776
47742
|
|
|
@@ -48559,9 +48525,7 @@ function setParticipantScaleItems(params) {
|
|
|
48559
48525
|
}
|
|
48560
48526
|
if (context) {
|
|
48561
48527
|
var eventId = context.eventId, drawId = context.drawId, itemValue = __rest(context, ["eventId", "drawId"]);
|
|
48562
|
-
var itemSubTypes = ((_c = itemValue.scaleAttributes) === null || _c === void 0 ? void 0 : _c.scaleType) && [
|
|
48563
|
-
itemValue.scaleAttributes.scaleType,
|
|
48564
|
-
];
|
|
48528
|
+
var itemSubTypes = ((_c = itemValue.scaleAttributes) === null || _c === void 0 ? void 0 : _c.scaleType) && [itemValue.scaleAttributes.scaleType];
|
|
48565
48529
|
if (Object.keys(itemValue).length) {
|
|
48566
48530
|
var timeItem = {
|
|
48567
48531
|
itemType: ADD_SCALE_ITEMS,
|
|
@@ -48596,7 +48560,8 @@ function isValidScaleItem(_a) {
|
|
|
48596
48560
|
var scaleItem = _a.scaleItem;
|
|
48597
48561
|
var scaleItemAttributes = scaleItem && Object.keys(scaleItem);
|
|
48598
48562
|
var requiredAttributes = ['scaleType', 'eventType', 'scaleName'];
|
|
48599
|
-
var validScaleItem = requiredAttributes.filter(function (attribute) { return scaleItemAttributes === null || scaleItemAttributes === void 0 ? void 0 : scaleItemAttributes.includes(attribute); }).length ===
|
|
48563
|
+
var validScaleItem = requiredAttributes.filter(function (attribute) { return scaleItemAttributes === null || scaleItemAttributes === void 0 ? void 0 : scaleItemAttributes.includes(attribute); }).length ===
|
|
48564
|
+
requiredAttributes.length;
|
|
48600
48565
|
return !!validScaleItem;
|
|
48601
48566
|
}
|
|
48602
48567
|
function addParticipantScaleItem(_a) {
|
|
@@ -48606,9 +48571,8 @@ function addParticipantScaleItem(_a) {
|
|
|
48606
48571
|
}
|
|
48607
48572
|
var scaleItemAttributes = scaleItem && Object.keys(scaleItem);
|
|
48608
48573
|
var requiredAttributes = ['scaleType', 'eventType', 'scaleName'];
|
|
48609
|
-
var validScaleItem = requiredAttributes.filter(function (attribute) {
|
|
48610
|
-
|
|
48611
|
-
}).length === requiredAttributes.length;
|
|
48574
|
+
var validScaleItem = requiredAttributes.filter(function (attribute) { return scaleItemAttributes.includes(attribute) && scaleItem[attribute]; }).length ===
|
|
48575
|
+
requiredAttributes.length;
|
|
48612
48576
|
if (!validScaleItem)
|
|
48613
48577
|
return { error: INVALID_SCALE_ITEM };
|
|
48614
48578
|
var createdAt = new Date().toISOString();
|
|
@@ -48619,10 +48583,8 @@ function addParticipantScaleItem(_a) {
|
|
|
48619
48583
|
participant: participant,
|
|
48620
48584
|
}).scaleItem;
|
|
48621
48585
|
var isUndefined = function (value) { return [undefined, null, ''].includes(value); };
|
|
48622
|
-
var valueChanged = !(isUndefined(existingScaleItem === null || existingScaleItem === void 0 ? void 0 : existingScaleItem.scaleValue) &&
|
|
48623
|
-
|
|
48624
|
-
JSON.stringify(existingScaleItem === null || existingScaleItem === void 0 ? void 0 : existingScaleItem.scaleValue) !==
|
|
48625
|
-
JSON.stringify(scaleItem.scaleValue);
|
|
48586
|
+
var valueChanged = !(isUndefined(existingScaleItem === null || existingScaleItem === void 0 ? void 0 : existingScaleItem.scaleValue) && isUndefined(scaleItem.scaleValue)) &&
|
|
48587
|
+
JSON.stringify(existingScaleItem === null || existingScaleItem === void 0 ? void 0 : existingScaleItem.scaleValue) !== JSON.stringify(scaleItem.scaleValue);
|
|
48626
48588
|
if (valueChanged) {
|
|
48627
48589
|
var scaleType = scaleItem.scaleType, eventType = scaleItem.eventType, scaleName = scaleItem.scaleName;
|
|
48628
48590
|
var itemType_1 = [SCALE$1, scaleType, eventType, scaleName].join('.');
|
|
@@ -49015,17 +48977,10 @@ function analyzeMatchUp(params) {
|
|
|
49015
48977
|
var sideIndex = isValidSideNumber ? sideNumber - 1 : 0;
|
|
49016
48978
|
var existingValue = setObject &&
|
|
49017
48979
|
isValidSideNumber &&
|
|
49018
|
-
((!isTiebreakValue &&
|
|
49019
|
-
|
|
49020
|
-
sideGameScores[sideIndex] !== undefined &&
|
|
49021
|
-
sideGameScores[sideIndex]) ||
|
|
49022
|
-
(isTiebreakValue &&
|
|
49023
|
-
sideTiebreakScores[sideIndex] !== undefined &&
|
|
49024
|
-
sideTiebreakScores[sideIndex]));
|
|
48980
|
+
((!isTiebreakValue && !isPointValue && sideGameScores[sideIndex] !== undefined && sideGameScores[sideIndex]) ||
|
|
48981
|
+
(isTiebreakValue && sideTiebreakScores[sideIndex] !== undefined && sideTiebreakScores[sideIndex]));
|
|
49025
48982
|
var hasExistingValue = !!existingValue;
|
|
49026
|
-
var completedSetsHaveValidOutcomes = completedSets === null || completedSets === void 0 ? void 0 : completedSets.map(function (setObject) {
|
|
49027
|
-
return analyzeSet({ setObject: setObject, matchUpScoringFormat: matchUpScoringFormat }).isValidSetOutcome;
|
|
49028
|
-
}).reduce(function (valid, validOutcome) { return valid && validOutcome; }, true);
|
|
48983
|
+
var completedSetsHaveValidOutcomes = completedSets === null || completedSets === void 0 ? void 0 : completedSets.map(function (setObject) { return analyzeSet({ setObject: setObject, matchUpScoringFormat: matchUpScoringFormat }).isValidSetOutcome; }).reduce(function (valid, validOutcome) { return valid && validOutcome; }, true);
|
|
49029
48984
|
var setsWinCounts = completedSets.reduce(function (counts, set) {
|
|
49030
48985
|
var winningSide = set.winningSide;
|
|
49031
48986
|
var winningSideIndex = winningSide - 1;
|
|
@@ -49039,17 +48994,11 @@ function analyzeMatchUp(params) {
|
|
|
49039
48994
|
var losingSideSetsCount = setsWinCounts[matchUpLosingSideIndex];
|
|
49040
48995
|
var maxSetsCount = Math.max.apply(Math, __spreadArray([], __read(setsWinCounts), false));
|
|
49041
48996
|
var maxSetsInstances = instanceCount(setsWinCounts)[maxSetsCount];
|
|
49042
|
-
var bestOf = (matchUpScoringFormat
|
|
48997
|
+
var bestOf = (matchUpScoringFormat !== null && matchUpScoringFormat !== void 0 ? matchUpScoringFormat : {}).bestOf;
|
|
49043
48998
|
var setsToWin = (bestOf && Math.ceil(bestOf / 2)) || 1;
|
|
49044
|
-
var calculatedWinningSide = (maxSetsCount === setsToWin &&
|
|
49045
|
-
|
|
49046
|
-
|
|
49047
|
-
undefined;
|
|
49048
|
-
var validMatchUpWinningSide = winningSideSetsCount > losingSideSetsCount &&
|
|
49049
|
-
matchUpWinningSide === calculatedWinningSide;
|
|
49050
|
-
var validMatchUpOutcome = calculatedWinningSide &&
|
|
49051
|
-
completedSetsHaveValidOutcomes &&
|
|
49052
|
-
validMatchUpWinningSide;
|
|
48999
|
+
var calculatedWinningSide = (maxSetsCount === setsToWin && maxSetsInstances === 1 && setsWinCounts.indexOf(maxSetsCount) + 1) || undefined;
|
|
49000
|
+
var validMatchUpWinningSide = winningSideSetsCount > losingSideSetsCount && matchUpWinningSide === calculatedWinningSide;
|
|
49001
|
+
var validMatchUpOutcome = calculatedWinningSide && completedSetsHaveValidOutcomes && validMatchUpWinningSide;
|
|
49053
49002
|
return __assign({ completedSetsHaveValidOutcomes: completedSetsHaveValidOutcomes, validMatchUpWinningSide: validMatchUpWinningSide, calculatedWinningSide: calculatedWinningSide, matchUpScoringFormat: matchUpScoringFormat, validMatchUpOutcome: validMatchUpOutcome, isLastSetWithValues: isLastSetWithValues, completedSetsCount: completedSetsCount, isCompletedMatchUp: isCompletedMatchUp, isValidSideNumber: isValidSideNumber, hasExistingValue: hasExistingValue, existingValue: existingValue, isExistingSet: isExistingSet, isActiveSet: isActiveSet }, specifiedSetAnalysis);
|
|
49054
49003
|
}
|
|
49055
49004
|
|
|
@@ -49081,7 +49030,7 @@ function generateOutcome(params) {
|
|
|
49081
49030
|
var _d = params.matchUpStatusProfile, matchUpStatusProfile = _d === void 0 ? defaultStatusProfile : _d, // { matchUpStatusProfile: {} } will always return only { matchUpStatus: COMPLETED }
|
|
49082
49031
|
_e = params.matchUpFormat, // { matchUpStatusProfile: {} } will always return only { matchUpStatus: COMPLETED }
|
|
49083
49032
|
matchUpFormat = _e === void 0 ? FORMAT_STANDARD : _e, _f = params.pointsPerMinute, pointsPerMinute = _f === void 0 ? 1 : _f, _g = params.sideWeight, sideWeight = _g === void 0 ? 4 : _g;
|
|
49084
|
-
if (!isValidMatchUpFormat(matchUpFormat))
|
|
49033
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
49085
49034
|
return { error: INVALID_MATCHUP_FORMAT };
|
|
49086
49035
|
if (typeof matchUpStatusProfile !== 'object')
|
|
49087
49036
|
return { error: INVALID_VALUES };
|
|
@@ -49335,12 +49284,8 @@ function completeDrawMatchUps(params) {
|
|
|
49335
49284
|
randomWinningSide = params.randomWinningSide, tournamentRecord = params.tournamentRecord, completionGoal = params.completionGoal, drawDefinition = params.drawDefinition, event = params.event;
|
|
49336
49285
|
if (!drawDefinition)
|
|
49337
49286
|
return { error: MISSING_DRAW_DEFINITION };
|
|
49338
|
-
var matchUpFormat = params.matchUpFormat ||
|
|
49339
|
-
|
|
49340
|
-
(event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
49341
|
-
var sortedStructures = drawDefinition.structures
|
|
49342
|
-
.slice()
|
|
49343
|
-
.sort(structureSort);
|
|
49287
|
+
var matchUpFormat = params.matchUpFormat || drawDefinition.matchUpFormat || (event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
49288
|
+
var sortedStructures = drawDefinition.structures.slice().sort(structureSort);
|
|
49344
49289
|
var completedCount = 0;
|
|
49345
49290
|
var _f = getAllDrawMatchUps({
|
|
49346
49291
|
contextFilters: {
|
|
@@ -53100,7 +53045,9 @@ function getEventMatchUpFormatTiming(_a) {
|
|
|
53100
53045
|
: definition;
|
|
53101
53046
|
if (uniqueMatchUpFormats_1.includes(definitionObject === null || definitionObject === void 0 ? void 0 : definitionObject.matchUpFormat))
|
|
53102
53047
|
return;
|
|
53103
|
-
if (!isValidMatchUpFormat(
|
|
53048
|
+
if (!isValidMatchUpFormat({
|
|
53049
|
+
matchUpFormat: definitionObject === null || definitionObject === void 0 ? void 0 : definitionObject.matchUpFormat,
|
|
53050
|
+
}))
|
|
53104
53051
|
return;
|
|
53105
53052
|
uniqueMatchUpFormats_1.push(definitionObject.matchUpFormat);
|
|
53106
53053
|
return definitionObject;
|
|
@@ -53131,8 +53078,8 @@ function getModifiedMatchUpFormatTiming(params) {
|
|
|
53131
53078
|
var paramCheck = checkRequiredParameters(params, [
|
|
53132
53079
|
(_a = {}, _a[TOURNAMENT_RECORD] = true, _a),
|
|
53133
53080
|
(_b = {},
|
|
53081
|
+
_b[VALIDATE] = function (matchUpFormat) { return isValidMatchUpFormat({ matchUpFormat: matchUpFormat }); },
|
|
53134
53082
|
_b[INVALID] = UNRECOGNIZED_MATCHUP_FORMAT,
|
|
53135
|
-
_b[VALIDATE] = isValidMatchUpFormat,
|
|
53136
53083
|
_b[MATCHUP_FORMAT] = true,
|
|
53137
53084
|
_b),
|
|
53138
53085
|
]);
|
|
@@ -56424,6 +56371,15 @@ function getParticipantSignInStatus(_a) {
|
|
|
56424
56371
|
return timeItem && timeItem.itemValue === SIGNED_IN && SIGNED_IN;
|
|
56425
56372
|
}
|
|
56426
56373
|
|
|
56374
|
+
function getMatchUpContextIds(_a) {
|
|
56375
|
+
var matchUps = _a.matchUps, matchUpId = _a.matchUpId;
|
|
56376
|
+
if (!validMatchUps(matchUps))
|
|
56377
|
+
return { error: INVALID_VALUES };
|
|
56378
|
+
var matchUp = matchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
|
|
56379
|
+
var _b = matchUp || {}, drawId = _b.drawId, eventId = _b.eventId, structureId = _b.structureId, tournamentId = _b.tournamentId;
|
|
56380
|
+
return { matchUpId: matchUpId, drawId: drawId, eventId: eventId, structureId: structureId, tournamentId: tournamentId };
|
|
56381
|
+
}
|
|
56382
|
+
|
|
56427
56383
|
function getMaxEntryPosition(params) {
|
|
56428
56384
|
var _a = params.entries, entries = _a === void 0 ? [] : _a, entryStatus = params.entryStatus, stage = params.stage;
|
|
56429
56385
|
return Math.max.apply(Math, __spreadArray(__spreadArray([], __read(entries
|
|
@@ -57681,6 +57637,20 @@ var queryGovernor = {
|
|
|
57681
57637
|
validateLineUp: validateLineUp,
|
|
57682
57638
|
validMatchUp: validMatchUp,
|
|
57683
57639
|
validMatchUps: validMatchUps,
|
|
57640
|
+
allPlayoffPositionsFilled: allPlayoffPositionsFilled,
|
|
57641
|
+
getCategoryAgeDetails: getCategoryAgeDetails,
|
|
57642
|
+
calculateWinCriteria: calculateWinCriteria,
|
|
57643
|
+
compareTieFormats: compareTieFormats,
|
|
57644
|
+
getMatchUpContextIds: getMatchUpContextIds,
|
|
57645
|
+
getScaleValues: getScaleValues,
|
|
57646
|
+
getSeedingThresholds: getSeedingThresholds,
|
|
57647
|
+
getTimeItem: getTimeItem,
|
|
57648
|
+
getValidGroupSizes: getValidGroupSizes,
|
|
57649
|
+
isAdHoc: isAdHoc,
|
|
57650
|
+
isCompletedStructure: isCompletedStructure,
|
|
57651
|
+
roundRobinGroups: roundRobinGroups,
|
|
57652
|
+
tieFormatGenderValidityCheck: tieFormatGenderValidityCheck,
|
|
57653
|
+
validateCategory: validateCategory,
|
|
57684
57654
|
};
|
|
57685
57655
|
|
|
57686
57656
|
function getDetailsWTN(_a) {
|
|
@@ -59051,7 +59021,7 @@ function modifyEventMatchUpFormatTiming(params) {
|
|
|
59051
59021
|
var tournamentRecord = params.tournamentRecord, recoveryMinutes = params.recoveryMinutes, averageMinutes = params.averageMinutes, matchUpFormat = params.matchUpFormat, categoryType = params.categoryType, eventId = params.eventId, event = params.event;
|
|
59052
59022
|
if (!tournamentRecord)
|
|
59053
59023
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
59054
|
-
if (!isValidMatchUpFormat(matchUpFormat))
|
|
59024
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
59055
59025
|
return { error: INVALID_VALUES };
|
|
59056
59026
|
if (!event)
|
|
59057
59027
|
return { error: MISSING_EVENT };
|
|
@@ -63592,7 +63562,7 @@ function calculateHistoryScore(params) {
|
|
|
63592
63562
|
var matchUpFormat = matchUp.matchUpFormat;
|
|
63593
63563
|
if (!matchUpFormat)
|
|
63594
63564
|
return { error: MISSING_MATCHUP_FORMAT };
|
|
63595
|
-
if (!isValidMatchUpFormat(matchUpFormat))
|
|
63565
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
63596
63566
|
return { error: INVALID_MATCHUP_FORMAT };
|
|
63597
63567
|
var parsedFormat = parse(matchUpFormat);
|
|
63598
63568
|
var bestOf = parsedFormat.bestOf, finalSetFormat = parsedFormat.finalSetFormat, setFormat = parsedFormat.setFormat;
|
|
@@ -64316,15 +64286,6 @@ function visualizeScheduledMatchUps(_a) {
|
|
|
64316
64286
|
printGlobalLog();
|
|
64317
64287
|
}
|
|
64318
64288
|
|
|
64319
|
-
function getMatchUpContextIds(_a) {
|
|
64320
|
-
var matchUps = _a.matchUps, matchUpId = _a.matchUpId;
|
|
64321
|
-
if (!validMatchUps(matchUps))
|
|
64322
|
-
return { error: INVALID_VALUES };
|
|
64323
|
-
var matchUp = matchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
|
|
64324
|
-
var _b = matchUp || {}, drawId = _b.drawId, eventId = _b.eventId, structureId = _b.structureId, tournamentId = _b.tournamentId;
|
|
64325
|
-
return { matchUpId: matchUpId, drawId: drawId, eventId: eventId, structureId: structureId, tournamentId: tournamentId };
|
|
64326
|
-
}
|
|
64327
|
-
|
|
64328
64289
|
function dehydrateMatchUps(_a) {
|
|
64329
64290
|
var tournamentRecord = _a.tournamentRecord;
|
|
64330
64291
|
if (!tournamentRecord)
|
|
@@ -64647,38 +64608,29 @@ function flattenJSON(obj, keyJoiner, path) {
|
|
|
64647
64608
|
}
|
|
64648
64609
|
|
|
64649
64610
|
var utilitiesGovernor = {
|
|
64611
|
+
visualizeScheduledMatchUps: visualizeScheduledMatchUps,
|
|
64612
|
+
dehydrateMatchUps: dehydrateMatchUps,
|
|
64613
|
+
structureSort: structureSort,
|
|
64650
64614
|
allNumeric: allNumeric$1,
|
|
64651
|
-
allPlayoffPositionsFilled: allPlayoffPositionsFilled,
|
|
64652
64615
|
attributeFilter: attributeFilter,
|
|
64653
|
-
calculateWinCriteria: calculateWinCriteria,
|
|
64654
64616
|
chunkArray: chunkArray,
|
|
64655
64617
|
chunkByNth: chunkByNth,
|
|
64656
64618
|
chunkSizeProfile: chunkSizeProfile,
|
|
64657
|
-
compareTieFormats: compareTieFormats,
|
|
64658
64619
|
constantToString: constantToString,
|
|
64659
64620
|
countValues: countValues,
|
|
64660
64621
|
createMap: createMap,
|
|
64661
64622
|
dateRange: dateRange,
|
|
64662
64623
|
dateTime: dateTime,
|
|
64663
64624
|
definedAttributes: definedAttributes,
|
|
64664
|
-
dehydrateMatchUps: dehydrateMatchUps,
|
|
64665
64625
|
extractAttributes: extractAttributes,
|
|
64666
64626
|
flattenJSON: flattenJSON,
|
|
64667
64627
|
generateHashCode: generateHashCode,
|
|
64668
64628
|
generateRange: generateRange,
|
|
64669
64629
|
generateTimeCode: generateTimeCode,
|
|
64670
|
-
getCategoryAgeDetails: getCategoryAgeDetails,
|
|
64671
|
-
getMatchUpContextIds: getMatchUpContextIds,
|
|
64672
|
-
getScaleValues: getScaleValues,
|
|
64673
|
-
getSeedingThresholds: getSeedingThresholds,
|
|
64674
|
-
getTimeItem: getTimeItem,
|
|
64675
|
-
getValidGroupSizes: getValidGroupSizes,
|
|
64676
64630
|
groupValues: groupValues,
|
|
64677
64631
|
hasAttributeValues: hasAttributeValues,
|
|
64678
64632
|
instanceCount: instanceCount,
|
|
64679
64633
|
intersection: intersection,
|
|
64680
|
-
isAdHoc: isAdHoc,
|
|
64681
|
-
isCompletedStructure: isCompletedStructure,
|
|
64682
64634
|
isConvertableInteger: isConvertableInteger,
|
|
64683
64635
|
isNumeric: isNumeric,
|
|
64684
64636
|
isOdd: isOdd,
|
|
@@ -64695,17 +64647,12 @@ var utilitiesGovernor = {
|
|
|
64695
64647
|
overlap: overlap,
|
|
64696
64648
|
randomMember: randomMember,
|
|
64697
64649
|
randomPop: randomPop,
|
|
64698
|
-
roundRobinGroups: roundRobinGroups,
|
|
64699
64650
|
shuffleArray: shuffleArray,
|
|
64700
|
-
structureSort: structureSort,
|
|
64701
64651
|
subSort: subSort,
|
|
64702
|
-
tieFormatGenderValidityCheck: tieFormatGenderValidityCheck,
|
|
64703
64652
|
undefinedToNull: undefinedToNull,
|
|
64704
64653
|
unique: unique,
|
|
64705
64654
|
UUID: UUID,
|
|
64706
64655
|
UUIDS: UUIDS,
|
|
64707
|
-
validateCategory: validateCategory,
|
|
64708
|
-
visualizeScheduledMatchUps: visualizeScheduledMatchUps,
|
|
64709
64656
|
};
|
|
64710
64657
|
var utilities = utilitiesGovernor;
|
|
64711
64658
|
|
|
@@ -65678,10 +65625,6 @@ var governors = {
|
|
|
65678
65625
|
venueGovernor: venueGovernor,
|
|
65679
65626
|
};
|
|
65680
65627
|
|
|
65681
|
-
var factoryTypes = {
|
|
65682
|
-
__proto__: null
|
|
65683
|
-
};
|
|
65684
|
-
|
|
65685
65628
|
var forge = {};
|
|
65686
65629
|
|
|
65687
65630
|
var _a$8;
|
|
@@ -65937,9 +65880,9 @@ function executeFunction(engine, method, params, methodName, engineType) {
|
|
|
65937
65880
|
var tournamentRecord = (params === null || params === void 0 ? void 0 : params.sandboxTournament) || getTournamentRecord(tournamentId);
|
|
65938
65881
|
var tournamentRecords = (params === null || params === void 0 ? void 0 : params.sandboxTournament)
|
|
65939
65882
|
? (_a = {}, _a[params === null || params === void 0 ? void 0 : params.sandboxTournament.tournamentId] = params.sandboxTournament, _a) : getTournamentRecords();
|
|
65940
|
-
|
|
65941
|
-
|
|
65942
|
-
|
|
65883
|
+
// ENSURE that logged params are not mutated by middleware
|
|
65884
|
+
var paramsToLog = params ? makeDeepCopy(params, undefined, true) : undefined;
|
|
65885
|
+
var augmentedParams = params ? paramsMiddleware(tournamentRecords, params) : undefined;
|
|
65943
65886
|
if (augmentedParams === null || augmentedParams === void 0 ? void 0 : augmentedParams.error)
|
|
65944
65887
|
return augmentedParams;
|
|
65945
65888
|
var result = invoke({
|
|
@@ -65950,7 +65893,7 @@ function executeFunction(engine, method, params, methodName, engineType) {
|
|
|
65950
65893
|
method: method,
|
|
65951
65894
|
});
|
|
65952
65895
|
var elapsed = Date.now() - start;
|
|
65953
|
-
engineLogging({ result: result, methodName: methodName, elapsed: elapsed, params:
|
|
65896
|
+
engineLogging({ result: result, methodName: methodName, elapsed: elapsed, params: paramsToLog, engineType: engineType });
|
|
65954
65897
|
return result;
|
|
65955
65898
|
}
|
|
65956
65899
|
function invoke(_a) {
|
|
@@ -66573,7 +66516,11 @@ var mocksEngine = (function () {
|
|
|
66573
66516
|
Object.keys(governor).forEach(function (method) {
|
|
66574
66517
|
engine[method] = function (params) {
|
|
66575
66518
|
try {
|
|
66576
|
-
|
|
66519
|
+
var invocationResult = engineInvoke(governor[method], params);
|
|
66520
|
+
if (!(invocationResult === null || invocationResult === void 0 ? void 0 : invocationResult.error) && (params === null || params === void 0 ? void 0 : params.setState) && (invocationResult === null || invocationResult === void 0 ? void 0 : invocationResult.tournamentRecord)) {
|
|
66521
|
+
setState$1(invocationResult.tournamentRecord);
|
|
66522
|
+
}
|
|
66523
|
+
return invocationResult;
|
|
66577
66524
|
}
|
|
66578
66525
|
catch (err) {
|
|
66579
66526
|
var error = void 0;
|
|
@@ -67679,7 +67626,6 @@ exports.entryStatusConstants = entryStatusConstants;
|
|
|
67679
67626
|
exports.errorConditionConstants = errorConditionConstants;
|
|
67680
67627
|
exports.eventConstants = eventConstants;
|
|
67681
67628
|
exports.factoryConstants = factoryConstants;
|
|
67682
|
-
exports.factoryTypes = factoryTypes;
|
|
67683
67629
|
exports.fixtures = fixtures;
|
|
67684
67630
|
exports.flightConstants = flightConstants;
|
|
67685
67631
|
exports.forge = forge;
|
|
@@ -67702,7 +67648,6 @@ exports.positionActionConstants = positionActionConstants;
|
|
|
67702
67648
|
exports.resultConstants = resultConstants;
|
|
67703
67649
|
exports.scaleConstants = scaleConstants;
|
|
67704
67650
|
exports.scaleEngine = scaleEngine;
|
|
67705
|
-
exports.scoreGovernor = scoreGovernor;
|
|
67706
67651
|
exports.surfaceConstants = surfaceConstants;
|
|
67707
67652
|
exports.syncEngine = engine;
|
|
67708
67653
|
exports.timeItemConstants = timeItemConstants;
|