tods-competition-factory 2.0.0-beta.0 → 2.0.0-beta.1
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/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.d.ts +174 -253
- package/dist/tods-competition-factory.development.cjs.js +580 -571
- 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 +1 -1
|
@@ -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.1';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -2103,141 +2103,6 @@ var eventConstants = {
|
|
|
2103
2103
|
TEAM: TEAM$2,
|
|
2104
2104
|
};
|
|
2105
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
2106
|
var validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
|
|
2242
2107
|
var validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
|
|
2243
2108
|
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 +2534,495 @@ function extensionsToAttributes(extensions) {
|
|
|
2669
2534
|
}).filter(Boolean);
|
|
2670
2535
|
}
|
|
2671
2536
|
|
|
2537
|
+
function getAccessorValue(_a) {
|
|
2538
|
+
var element = _a.element, accessor = _a.accessor;
|
|
2539
|
+
if (typeof accessor !== 'string')
|
|
2540
|
+
return { values: [] };
|
|
2541
|
+
var targetElement = makeDeepCopy(element);
|
|
2542
|
+
var attributes = accessor.split('.');
|
|
2543
|
+
var values = [];
|
|
2544
|
+
var value;
|
|
2545
|
+
processKeys({ targetElement: targetElement, attributes: attributes });
|
|
2546
|
+
var result = { value: value };
|
|
2547
|
+
if (values.length)
|
|
2548
|
+
result.values = values;
|
|
2549
|
+
return result;
|
|
2550
|
+
function processKeys(_a) {
|
|
2551
|
+
var e_1, _b;
|
|
2552
|
+
var targetElement = _a.targetElement, _c = _a.attributes, attributes = _c === void 0 ? [] : _c, significantCharacters = _a.significantCharacters;
|
|
2553
|
+
var _loop_1 = function (index, attribute) {
|
|
2554
|
+
if (targetElement === null || targetElement === void 0 ? void 0 : targetElement[attribute]) {
|
|
2555
|
+
var remainingKeys_1 = attributes.slice(index + 1);
|
|
2556
|
+
if (!remainingKeys_1.length) {
|
|
2557
|
+
if (!value)
|
|
2558
|
+
value = targetElement[attribute];
|
|
2559
|
+
if (!values.includes(targetElement[attribute])) {
|
|
2560
|
+
values.push(targetElement[attribute]);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
else if (Array.isArray(targetElement[attribute])) {
|
|
2564
|
+
var values_1 = targetElement[attribute];
|
|
2565
|
+
values_1.forEach(function (nestedTarget) {
|
|
2566
|
+
return processKeys({
|
|
2567
|
+
targetElement: nestedTarget,
|
|
2568
|
+
attributes: remainingKeys_1,
|
|
2569
|
+
});
|
|
2570
|
+
});
|
|
2571
|
+
}
|
|
2572
|
+
else {
|
|
2573
|
+
targetElement = targetElement[attribute];
|
|
2574
|
+
checkValue({ targetElement: targetElement, index: index });
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
};
|
|
2578
|
+
try {
|
|
2579
|
+
for (var _d = __values(attributes.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2580
|
+
var _f = __read(_e.value, 2), index = _f[0], attribute = _f[1];
|
|
2581
|
+
_loop_1(index, attribute);
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2585
|
+
finally {
|
|
2586
|
+
try {
|
|
2587
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
2588
|
+
}
|
|
2589
|
+
finally { if (e_1) throw e_1.error; }
|
|
2590
|
+
}
|
|
2591
|
+
function checkValue(_a) {
|
|
2592
|
+
var targetElement = _a.targetElement, index = _a.index;
|
|
2593
|
+
if (targetElement &&
|
|
2594
|
+
index === attributes.length - 1 &&
|
|
2595
|
+
['string', 'number'].includes(typeof targetElement)) {
|
|
2596
|
+
var extractedValue = significantCharacters
|
|
2597
|
+
? targetElement.slice(0, significantCharacters)
|
|
2598
|
+
: targetElement;
|
|
2599
|
+
if (value) {
|
|
2600
|
+
if (!values.includes(extractedValue)) {
|
|
2601
|
+
values.push(extractedValue);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
else {
|
|
2605
|
+
value = extractedValue;
|
|
2606
|
+
values.push(extractedValue);
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
function isFunction(obj) {
|
|
2614
|
+
return typeof obj === 'function';
|
|
2615
|
+
}
|
|
2616
|
+
function isString(obj) {
|
|
2617
|
+
return typeof obj === 'string';
|
|
2618
|
+
}
|
|
2619
|
+
function isObject(obj) {
|
|
2620
|
+
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
|
2621
|
+
}
|
|
2622
|
+
function objShallowEqual(o1, o2) {
|
|
2623
|
+
var e_1, _a;
|
|
2624
|
+
if (!isObject(o1) || !isObject(o2))
|
|
2625
|
+
return false;
|
|
2626
|
+
var keys1 = Object.keys(o1);
|
|
2627
|
+
var keys2 = Object.keys(o2);
|
|
2628
|
+
if (keys1.length !== keys2.length) {
|
|
2629
|
+
return false;
|
|
2630
|
+
}
|
|
2631
|
+
try {
|
|
2632
|
+
for (var keys1_1 = __values(keys1), keys1_1_1 = keys1_1.next(); !keys1_1_1.done; keys1_1_1 = keys1_1.next()) {
|
|
2633
|
+
var key = keys1_1_1.value;
|
|
2634
|
+
if (o1[key] !== o2[key]) {
|
|
2635
|
+
return false;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2640
|
+
finally {
|
|
2641
|
+
try {
|
|
2642
|
+
if (keys1_1_1 && !keys1_1_1.done && (_a = keys1_1.return)) _a.call(keys1_1);
|
|
2643
|
+
}
|
|
2644
|
+
finally { if (e_1) throw e_1.error; }
|
|
2645
|
+
}
|
|
2646
|
+
return true;
|
|
2647
|
+
}
|
|
2648
|
+
function createMap(objectArray, attribute) {
|
|
2649
|
+
if (!Array.isArray(objectArray))
|
|
2650
|
+
return {};
|
|
2651
|
+
return Object.assign.apply(Object, __spreadArray([{}], __read((objectArray !== null && objectArray !== void 0 ? objectArray : [])
|
|
2652
|
+
.filter(isObject)
|
|
2653
|
+
.map(function (obj) {
|
|
2654
|
+
var _a;
|
|
2655
|
+
return (obj[attribute] && (_a = {},
|
|
2656
|
+
_a[obj[attribute]] = obj,
|
|
2657
|
+
_a));
|
|
2658
|
+
})
|
|
2659
|
+
.filter(Boolean)), false));
|
|
2660
|
+
}
|
|
2661
|
+
// e.g. result.find(hav({ attr: value })) -or- result.filter(hav({ attr: value }))
|
|
2662
|
+
var hasAttributeValues = function (a) { return function (o) {
|
|
2663
|
+
return Object.keys(a).every(function (key) { return o[key] === a[key]; });
|
|
2664
|
+
}; };
|
|
2665
|
+
// extracts targeted attributes
|
|
2666
|
+
// e.g. const byeAssignments = positionAssignments.filter(xa('bye')).map(xa('drawPosition'));
|
|
2667
|
+
// supports xa('string'), xa(['string', 'string']), xa({ attr1: true, attr2: true })
|
|
2668
|
+
var extractAttributes = function (accessor) { return function (element) {
|
|
2669
|
+
var _a;
|
|
2670
|
+
return !accessor || typeof element !== 'object'
|
|
2671
|
+
? undefined
|
|
2672
|
+
: (Array.isArray(accessor) &&
|
|
2673
|
+
accessor.map(function (a) {
|
|
2674
|
+
var _a;
|
|
2675
|
+
var _b;
|
|
2676
|
+
return (_a = {},
|
|
2677
|
+
_a[a] = (_b = getAccessorValue({ element: element, accessor: a })) === null || _b === void 0 ? void 0 : _b.value,
|
|
2678
|
+
_a);
|
|
2679
|
+
})) ||
|
|
2680
|
+
(typeof accessor === 'object' &&
|
|
2681
|
+
Object.keys(accessor).map(function (key) {
|
|
2682
|
+
var _a;
|
|
2683
|
+
var _b;
|
|
2684
|
+
return (_a = {},
|
|
2685
|
+
_a[key] = (_b = getAccessorValue({ element: element, accessor: key })) === null || _b === void 0 ? void 0 : _b.value,
|
|
2686
|
+
_a);
|
|
2687
|
+
})) ||
|
|
2688
|
+
((_a = (typeof accessor === 'string' && getAccessorValue({ element: element, accessor: accessor }))) === null || _a === void 0 ? void 0 : _a.value);
|
|
2689
|
+
}; };
|
|
2690
|
+
// useful in notifications where back end does not recognize undefined for updates
|
|
2691
|
+
function undefinedToNull(obj, shallow) {
|
|
2692
|
+
if (obj === undefined)
|
|
2693
|
+
return null;
|
|
2694
|
+
if (typeof obj !== 'object' || obj === null)
|
|
2695
|
+
return obj;
|
|
2696
|
+
var definedKeys = Object.keys(obj);
|
|
2697
|
+
var notNull = function (value) { return (value === undefined ? null : value); };
|
|
2698
|
+
return Object.assign.apply(Object, __spreadArray([{}], __read(definedKeys.map(function (key) {
|
|
2699
|
+
var _a, _b;
|
|
2700
|
+
return Array.isArray(obj[key])
|
|
2701
|
+
? (_a = {},
|
|
2702
|
+
_a[key] = shallow ? obj[key] : obj[key].map(function (m) { return undefinedToNull(m); }),
|
|
2703
|
+
_a) : (_b = {}, _b[key] = shallow ? notNull(obj[key]) : undefinedToNull(obj[key]), _b);
|
|
2704
|
+
})), false));
|
|
2705
|
+
}
|
|
2706
|
+
function countKeys(o) {
|
|
2707
|
+
if (Array.isArray(o)) {
|
|
2708
|
+
return o.length + o.map(countKeys).reduce(function (a, b) { return a + b; }, 0);
|
|
2709
|
+
}
|
|
2710
|
+
else if (typeof o === 'object' && o !== null) {
|
|
2711
|
+
return (Object.keys(o).length +
|
|
2712
|
+
Object.keys(o)
|
|
2713
|
+
.map(function (k) { return countKeys(o[k]); })
|
|
2714
|
+
.reduce(function (a, b) { return a + b; }, 0));
|
|
2715
|
+
}
|
|
2716
|
+
return 0;
|
|
2717
|
+
}
|
|
2718
|
+
function generateHashCode(o) {
|
|
2719
|
+
if (o === null || typeof o !== 'object')
|
|
2720
|
+
return undefined;
|
|
2721
|
+
var str = JSON.stringify(o);
|
|
2722
|
+
var keyCount = countKeys(o);
|
|
2723
|
+
var charSum = str.split('').reduce(function (a, b) { return a + b.charCodeAt(0); }, 0);
|
|
2724
|
+
return [str.length, keyCount, charSum].map(function (e) { return e.toString(36); }).join('');
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2727
|
+
var TOURNAMENT_RECORDS = 'tournamentRecords';
|
|
2728
|
+
var POLICY_DEFINITIONS = 'policyDefinitions';
|
|
2729
|
+
var TOURNAMENT_RECORD = 'tournamentRecord';
|
|
2730
|
+
var DRAW_DEFINITION = 'drawDefinition';
|
|
2731
|
+
var MATCHUP_FORMAT = 'matchUpFormat';
|
|
2732
|
+
var PARTICIPANT_ID = 'participantId';
|
|
2733
|
+
var SCHEDULE_DATES = 'scheduleDates';
|
|
2734
|
+
var TOURNAMENT_ID = 'tournamentId';
|
|
2735
|
+
var SCHEDULE_DATE = 'scheduleDate';
|
|
2736
|
+
var STRUCTURE_ID = 'structureId';
|
|
2737
|
+
var PARTICIPANT = 'participant';
|
|
2738
|
+
var MATCHUP_IDS = 'matchUpIds';
|
|
2739
|
+
var POLICY_TYPE = 'policyType';
|
|
2740
|
+
var STRUCTURES = 'structures';
|
|
2741
|
+
var MATCHUP_ID = 'matchUpId';
|
|
2742
|
+
var IN_CONTEXT = 'inContext';
|
|
2743
|
+
var STRUCTURE = 'structure';
|
|
2744
|
+
var COURT_IDS = 'courtIds';
|
|
2745
|
+
var PERSON_ID = 'personId';
|
|
2746
|
+
var VENUE_IDS = 'venueIds';
|
|
2747
|
+
var MATCHUPS = 'matchUps';
|
|
2748
|
+
var COURT_ID = 'courtId';
|
|
2749
|
+
var EVENT_ID = 'eventId';
|
|
2750
|
+
var MATCHUP = 'matchUp';
|
|
2751
|
+
var DRAW_ID = 'drawId';
|
|
2752
|
+
var ERROR = 'error';
|
|
2753
|
+
var EVENT = 'event';
|
|
2754
|
+
var PARAM = 'param';
|
|
2755
|
+
var AVERAGE_MATCHUP_MINUTES = 'averageMatchUpMinutes';
|
|
2756
|
+
var RECOVERY_MINUTES = 'recoveryMinutes';
|
|
2757
|
+
var PERIOD_LENGTH = 'periodLength';
|
|
2758
|
+
var OBJECT = 'object';
|
|
2759
|
+
var ARRAY = 'array';
|
|
2760
|
+
var VALIDATE = 'validate';
|
|
2761
|
+
var INVALID = 'invalid';
|
|
2762
|
+
var OF_TYPE = '_ofType';
|
|
2763
|
+
var ANY_OF = '_anyOf';
|
|
2764
|
+
var ONE_OF = '_oneOf';
|
|
2765
|
+
|
|
2766
|
+
var _a$k, _b$8;
|
|
2767
|
+
var errors = (_a$k = {},
|
|
2768
|
+
_a$k[TOURNAMENT_RECORDS] = MISSING_TOURNAMENT_RECORDS,
|
|
2769
|
+
_a$k[TOURNAMENT_RECORD] = MISSING_TOURNAMENT_RECORD,
|
|
2770
|
+
_a$k[POLICY_DEFINITIONS] = MISSING_POLICY_DEFINITION,
|
|
2771
|
+
_a$k[DRAW_DEFINITION] = MISSING_DRAW_DEFINITION,
|
|
2772
|
+
_a$k[PARTICIPANT_ID] = MISSING_PARTICIPANT_ID,
|
|
2773
|
+
_a$k[TOURNAMENT_ID] = MISSING_TOURNAMENT_ID,
|
|
2774
|
+
_a$k[STRUCTURE_ID] = MISSING_STRUCTURE_ID,
|
|
2775
|
+
_a$k[MATCHUP_IDS] = MISSING_MATCHUP_IDS,
|
|
2776
|
+
_a$k[PARTICIPANT] = MISSING_PARTICIPANT,
|
|
2777
|
+
_a$k[STRUCTURES] = MISSING_STRUCTURES,
|
|
2778
|
+
_a$k[MATCHUP_ID] = MISSING_MATCHUP_ID,
|
|
2779
|
+
_a$k[STRUCTURE] = MISSING_STRUCTURE,
|
|
2780
|
+
_a$k[COURT_ID] = MISSING_COURT_ID,
|
|
2781
|
+
_a$k[MATCHUPS] = MISSING_MATCHUPS,
|
|
2782
|
+
_a$k[MATCHUP] = MISSING_MATCHUP,
|
|
2783
|
+
_a$k[COURT_IDS] = MISSING_VALUE,
|
|
2784
|
+
_a$k[VENUE_IDS] = MISSING_VALUE,
|
|
2785
|
+
_a$k[DRAW_ID] = MISSING_DRAW_ID,
|
|
2786
|
+
_a$k[EVENT_ID] = MISSING_EVENT,
|
|
2787
|
+
_a$k[EVENT] = EVENT_NOT_FOUND,
|
|
2788
|
+
_a$k);
|
|
2789
|
+
var paramTypes = (_b$8 = {},
|
|
2790
|
+
_b$8[TOURNAMENT_RECORDS] = OBJECT,
|
|
2791
|
+
_b$8[POLICY_DEFINITIONS] = OBJECT,
|
|
2792
|
+
_b$8[TOURNAMENT_RECORD] = OBJECT,
|
|
2793
|
+
_b$8[DRAW_DEFINITION] = OBJECT,
|
|
2794
|
+
_b$8[SCHEDULE_DATES] = ARRAY,
|
|
2795
|
+
_b$8[PARTICIPANT] = OBJECT,
|
|
2796
|
+
_b$8[MATCHUP_IDS] = ARRAY,
|
|
2797
|
+
_b$8[STRUCTURES] = ARRAY,
|
|
2798
|
+
_b$8[STRUCTURE] = OBJECT,
|
|
2799
|
+
_b$8[COURT_IDS] = ARRAY,
|
|
2800
|
+
_b$8[VENUE_IDS] = ARRAY,
|
|
2801
|
+
_b$8[MATCHUPS] = ARRAY,
|
|
2802
|
+
_b$8[MATCHUP] = OBJECT,
|
|
2803
|
+
_b$8[EVENT] = OBJECT,
|
|
2804
|
+
_b$8);
|
|
2805
|
+
function checkRequiredParameters(params, requiredParams, stack) {
|
|
2806
|
+
if (!params && !isObject(params))
|
|
2807
|
+
return { error: INVALID_VALUES };
|
|
2808
|
+
if (!(requiredParams === null || requiredParams === void 0 ? void 0 : requiredParams.length) || (params === null || params === void 0 ? void 0 : params._bypassParamCheck))
|
|
2809
|
+
return { valid: true };
|
|
2810
|
+
if (!Array.isArray(requiredParams))
|
|
2811
|
+
return { error: INVALID_VALUES };
|
|
2812
|
+
var _a = findParamError(params, requiredParams), paramError = _a.paramError, errorParam = _a.errorParam;
|
|
2813
|
+
if (!paramError)
|
|
2814
|
+
return { valid: true };
|
|
2815
|
+
var error = params[errorParam] === undefined
|
|
2816
|
+
? errors[errorParam] || INVALID_VALUES
|
|
2817
|
+
: (paramError.validate && paramError.invalid) || INVALID_VALUES;
|
|
2818
|
+
return decorateResult({
|
|
2819
|
+
info: { param: errorParam },
|
|
2820
|
+
result: { error: error },
|
|
2821
|
+
stack: stack,
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
function getIntersection(params, constraint) {
|
|
2825
|
+
var paramKeys = Object.keys(params);
|
|
2826
|
+
var constraintKeys = Object.keys(constraint);
|
|
2827
|
+
return intersection(paramKeys, constraintKeys);
|
|
2828
|
+
}
|
|
2829
|
+
function getOneOf(params, _oneOf) {
|
|
2830
|
+
if (!_oneOf)
|
|
2831
|
+
return;
|
|
2832
|
+
var overlap = getIntersection(params, _oneOf);
|
|
2833
|
+
if (overlap.length !== 1)
|
|
2834
|
+
return { error: INVALID_VALUES };
|
|
2835
|
+
return overlap.reduce(function (attr, param) {
|
|
2836
|
+
var _a;
|
|
2837
|
+
return (__assign(__assign({}, attr), (_a = {}, _a[param] = true, _a)));
|
|
2838
|
+
}, {});
|
|
2839
|
+
}
|
|
2840
|
+
function getAnyOf(params, _anyOf) {
|
|
2841
|
+
if (!_anyOf)
|
|
2842
|
+
return;
|
|
2843
|
+
var overlap = getIntersection(params, _anyOf).filter(function (param) { return params[param]; });
|
|
2844
|
+
if (overlap.length < 1)
|
|
2845
|
+
return { error: INVALID_VALUES };
|
|
2846
|
+
return overlap.reduce(function (attr, param) {
|
|
2847
|
+
var _a;
|
|
2848
|
+
return (__assign(__assign({}, attr), (_a = {}, _a[param] = true, _a)));
|
|
2849
|
+
}, {});
|
|
2850
|
+
}
|
|
2851
|
+
function findParamError(params, requiredParams) {
|
|
2852
|
+
var errorParam;
|
|
2853
|
+
var paramError = requiredParams.find(function (_a) {
|
|
2854
|
+
var _ofType = _a._ofType, _oneOf = _a._oneOf, _anyOf = _a._anyOf, validate = _a.validate, attrs = __rest(_a, ["_ofType", "_oneOf", "_anyOf", "validate"]);
|
|
2855
|
+
var oneOf = _oneOf && getOneOf(params, _oneOf);
|
|
2856
|
+
if (oneOf === null || oneOf === void 0 ? void 0 : oneOf.error)
|
|
2857
|
+
return oneOf.error;
|
|
2858
|
+
oneOf && Object.assign(attrs, oneOf);
|
|
2859
|
+
var anyOf = _anyOf && getAnyOf(params, _anyOf);
|
|
2860
|
+
if (anyOf === null || anyOf === void 0 ? void 0 : anyOf.error)
|
|
2861
|
+
return anyOf.error;
|
|
2862
|
+
anyOf && Object.assign(attrs, anyOf);
|
|
2863
|
+
var booleanParams = Object.keys(attrs).filter(function (key) { return typeof attrs[key] === 'boolean'; });
|
|
2864
|
+
var invalidParam = booleanParams.find(function (param) {
|
|
2865
|
+
var invalid = !isFunction(validate) &&
|
|
2866
|
+
(params[param] === undefined || invalidType(params, param, _ofType));
|
|
2867
|
+
var hasError = invalid || (validate && !checkValidation(params[param], validate));
|
|
2868
|
+
if (hasError)
|
|
2869
|
+
errorParam = param;
|
|
2870
|
+
return hasError;
|
|
2871
|
+
});
|
|
2872
|
+
return !booleanParams.length || invalidParam;
|
|
2873
|
+
});
|
|
2874
|
+
return { paramError: paramError, errorParam: errorParam };
|
|
2875
|
+
}
|
|
2876
|
+
function invalidType(params, param, _ofType) {
|
|
2877
|
+
_ofType = _ofType || paramTypes[param] || 'string';
|
|
2878
|
+
if (_ofType === 'array') {
|
|
2879
|
+
return !Array.isArray(params[param]);
|
|
2880
|
+
}
|
|
2881
|
+
return typeof params[param] !== _ofType;
|
|
2882
|
+
}
|
|
2883
|
+
function checkValidation(value, validate) {
|
|
2884
|
+
if (isFunction(validate))
|
|
2885
|
+
return validate(value);
|
|
2886
|
+
return true;
|
|
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;
|
|
@@ -7844,9 +8008,9 @@ function isAdHoc(_a) {
|
|
|
7844
8008
|
!hasDrawPosition);
|
|
7845
8009
|
}
|
|
7846
8010
|
|
|
7847
|
-
var _a$
|
|
7848
|
-
var POLICY_ROUND_NAMING_DEFAULT = (_a$
|
|
7849
|
-
_a$
|
|
8011
|
+
var _a$h, _b$5;
|
|
8012
|
+
var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
8013
|
+
_a$h[POLICY_TYPE_ROUND_NAMING] = {
|
|
7850
8014
|
policyName: 'Round Naming Default',
|
|
7851
8015
|
namingConventions: {
|
|
7852
8016
|
round: 'Round',
|
|
@@ -7871,14 +8035,14 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$i = {},
|
|
|
7871
8035
|
preFeedRound: 'Q',
|
|
7872
8036
|
preQualifying: 'P',
|
|
7873
8037
|
},
|
|
7874
|
-
stageConstants: (_b$
|
|
7875
|
-
_b$
|
|
7876
|
-
_b$
|
|
7877
|
-
_b$
|
|
7878
|
-
_b$
|
|
7879
|
-
_b$
|
|
8038
|
+
stageConstants: (_b$5 = {},
|
|
8039
|
+
_b$5[MAIN] = '',
|
|
8040
|
+
_b$5[PLAY_OFF] = 'P',
|
|
8041
|
+
_b$5[QUALIFYING] = 'Q',
|
|
8042
|
+
_b$5[CONSOLATION] = 'C',
|
|
8043
|
+
_b$5),
|
|
7880
8044
|
},
|
|
7881
|
-
_a$
|
|
8045
|
+
_a$h);
|
|
7882
8046
|
|
|
7883
8047
|
function getRoundContextProfile(_a) {
|
|
7884
8048
|
var _b, _c, _d, _e, _f, _g;
|
|
@@ -7976,165 +8140,6 @@ function getRoundContextProfile(_a) {
|
|
|
7976
8140
|
return { roundNamingProfile: roundNamingProfile, roundProfile: roundProfile, roundMatchUps: roundMatchUps };
|
|
7977
8141
|
}
|
|
7978
8142
|
|
|
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
8143
|
// derive matchUpType from participants when not defined on matchUp
|
|
8139
8144
|
function getMatchUpType(params) {
|
|
8140
8145
|
var _a;
|
|
@@ -19925,7 +19930,7 @@ function qualifierDrawPositionAssignment(params) {
|
|
|
19925
19930
|
}
|
|
19926
19931
|
|
|
19927
19932
|
function getTieMatchUpContext(_a) {
|
|
19928
|
-
var _b;
|
|
19933
|
+
var _b, _c, _d, _e;
|
|
19929
19934
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, tieMatchUpId = _a.tieMatchUpId, event = _a.event;
|
|
19930
19935
|
if (!tournamentRecord)
|
|
19931
19936
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -19942,14 +19947,14 @@ function getTieMatchUpContext(_a) {
|
|
|
19942
19947
|
}).matchUp;
|
|
19943
19948
|
if (!tieMatchUp)
|
|
19944
19949
|
return { error: MATCHUP_NOT_FOUND };
|
|
19945
|
-
var
|
|
19950
|
+
var _f = findDrawMatchUp({
|
|
19946
19951
|
tournamentParticipants: tournamentRecord.participants,
|
|
19947
19952
|
matchUpId: tieMatchUpId,
|
|
19948
19953
|
inContext: true,
|
|
19949
19954
|
drawDefinition: drawDefinition,
|
|
19950
19955
|
matchUpsMap: matchUpsMap,
|
|
19951
19956
|
event: event,
|
|
19952
|
-
}), inContextTieMatchUp =
|
|
19957
|
+
}), inContextTieMatchUp = _f.matchUp, structure = _f.structure;
|
|
19953
19958
|
if (!inContextTieMatchUp)
|
|
19954
19959
|
return { error: MATCHUP_NOT_FOUND };
|
|
19955
19960
|
var collectionPosition = inContextTieMatchUp.collectionPosition, drawPositions = inContextTieMatchUp.drawPositions, collectionId = inContextTieMatchUp.collectionId, matchUpTieId = inContextTieMatchUp.matchUpTieId, matchUpType = inContextTieMatchUp.matchUpType;
|
|
@@ -19957,7 +19962,14 @@ function getTieMatchUpContext(_a) {
|
|
|
19957
19962
|
return { error: INVALID_MATCHUP };
|
|
19958
19963
|
var positionAssignments = getPositionAssignments$1({ structure: structure }).positionAssignments;
|
|
19959
19964
|
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
|
|
19965
|
+
var dualMatchUp = findDrawMatchUp({
|
|
19966
|
+
matchUpId: matchUpTieId,
|
|
19967
|
+
drawDefinition: drawDefinition,
|
|
19968
|
+
matchUpsMap: matchUpsMap,
|
|
19969
|
+
}).matchUp;
|
|
19970
|
+
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 : [];
|
|
19971
|
+
var assignedParticipantIds = (_d = relevantAssignments === null || relevantAssignments === void 0 ? void 0 : relevantAssignments.map(extractAttributes('participantId'))) !== null && _d !== void 0 ? _d : [];
|
|
19972
|
+
var participantIds = __spreadArray(__spreadArray([], __read(sideParticipantIds), false), __read(assignedParticipantIds), false);
|
|
19961
19973
|
var teamParticipants = getParticipants({
|
|
19962
19974
|
tournamentRecord: tournamentRecord,
|
|
19963
19975
|
participantFilters: {
|
|
@@ -19965,23 +19977,18 @@ function getTieMatchUpContext(_a) {
|
|
|
19965
19977
|
participantIds: participantIds,
|
|
19966
19978
|
},
|
|
19967
19979
|
}).participants;
|
|
19968
|
-
var dualMatchUp = findDrawMatchUp({
|
|
19969
|
-
matchUpId: matchUpTieId,
|
|
19970
|
-
drawDefinition: drawDefinition,
|
|
19971
|
-
matchUpsMap: matchUpsMap,
|
|
19972
|
-
}).matchUp;
|
|
19973
19980
|
var inContextDualMatchUp = findDrawMatchUp({
|
|
19974
19981
|
matchUpId: matchUpTieId,
|
|
19975
19982
|
inContext: true,
|
|
19976
19983
|
drawDefinition: drawDefinition,
|
|
19977
19984
|
matchUpsMap: matchUpsMap,
|
|
19978
19985
|
}).matchUp;
|
|
19979
|
-
var tieFormat = (
|
|
19986
|
+
var tieFormat = (_e = resolveTieFormat({
|
|
19980
19987
|
matchUp: dualMatchUp,
|
|
19981
19988
|
drawDefinition: drawDefinition,
|
|
19982
19989
|
structure: structure,
|
|
19983
19990
|
event: event,
|
|
19984
|
-
})) === null ||
|
|
19991
|
+
})) === null || _e === void 0 ? void 0 : _e.tieFormat;
|
|
19985
19992
|
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
19993
|
}
|
|
19987
19994
|
|
|
@@ -20814,9 +20821,8 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
20814
20821
|
var individualParticipantIds = _a.individualParticipantIds;
|
|
20815
20822
|
return overlap(relevantParticipantIds, individualParticipantIds);
|
|
20816
20823
|
}));
|
|
20817
|
-
if (!participantTeam)
|
|
20824
|
+
if (!participantTeam)
|
|
20818
20825
|
return { error: TEAM_NOT_FOUND };
|
|
20819
|
-
}
|
|
20820
20826
|
if (!teamParticipantId)
|
|
20821
20827
|
teamParticipantId = participantTeam.participantId;
|
|
20822
20828
|
if (!teamParticipantId)
|
|
@@ -21424,9 +21430,9 @@ function calculateWinCriteria(_a) {
|
|
|
21424
21430
|
finally { if (e_3) throw e_3.error; }
|
|
21425
21431
|
}
|
|
21426
21432
|
if (aggregateValueImperative || !valueTotal)
|
|
21427
|
-
return { aggregateValue: true };
|
|
21433
|
+
return __assign({ aggregateValue: true }, SUCCESS);
|
|
21428
21434
|
var valueGoal = Math.floor(valueTotal / 2) + 1;
|
|
21429
|
-
return { valueGoal: valueGoal };
|
|
21435
|
+
return __assign({ valueGoal: valueGoal }, SUCCESS);
|
|
21430
21436
|
}
|
|
21431
21437
|
|
|
21432
21438
|
function getTieFormat$1(_a) {
|
|
@@ -21586,7 +21592,8 @@ function tiebreakFormat(tieobject) {
|
|
|
21586
21592
|
return undefined;
|
|
21587
21593
|
}
|
|
21588
21594
|
|
|
21589
|
-
function isValidMatchUpFormat(
|
|
21595
|
+
function isValidMatchUpFormat(_a) {
|
|
21596
|
+
var matchUpFormat = _a.matchUpFormat;
|
|
21590
21597
|
if (typeof matchUpFormat !== 'string')
|
|
21591
21598
|
return false;
|
|
21592
21599
|
var parsedFormat = parse(matchUpFormat);
|
|
@@ -21968,7 +21975,8 @@ function validateCollectionDefinition(_a) {
|
|
|
21968
21975
|
if (collectionGroupNumber && typeof collectionGroupNumber !== 'number') {
|
|
21969
21976
|
errors.push("collectionGroupNumber is not type number: ".concat(collectionValue));
|
|
21970
21977
|
}
|
|
21971
|
-
if (matchUpFormat &&
|
|
21978
|
+
if (matchUpFormat &&
|
|
21979
|
+
!matchUpFormatCode.isValidMatchUpFormat({ matchUpFormat: matchUpFormat })) {
|
|
21972
21980
|
errors.push("Invalid matchUpFormat: ".concat(matchUpFormat));
|
|
21973
21981
|
}
|
|
21974
21982
|
if (checkGender) {
|
|
@@ -22653,7 +22661,7 @@ function modifyCollectionDefinition(_a) {
|
|
|
22653
22661
|
// value assignment, only one is allowed to have a value
|
|
22654
22662
|
collectionValueProfiles = _a.collectionValueProfiles, collectionValue = _a.collectionValue, matchUpValue = _a.matchUpValue, scoreValue = _a.scoreValue, setValue = _a.setValue;
|
|
22655
22663
|
var stack = 'modifyCollectionDefinition';
|
|
22656
|
-
if (matchUpFormat && !isValidMatchUpFormat(matchUpFormat)) {
|
|
22664
|
+
if (matchUpFormat && !isValidMatchUpFormat({ matchUpFormat: matchUpFormat })) {
|
|
22657
22665
|
return decorateResult({
|
|
22658
22666
|
result: { error: INVALID_VALUES },
|
|
22659
22667
|
context: { matchUpFormat: matchUpFormat },
|
|
@@ -32909,7 +32917,7 @@ function setMatchUpMatchUpFormat(params) {
|
|
|
32909
32917
|
return { error: MISSING_DRAW_DEFINITION };
|
|
32910
32918
|
if (!matchUpFormat)
|
|
32911
32919
|
return { error: MISSING_MATCHUP_FORMAT };
|
|
32912
|
-
if (!isValidMatchUpFormat(matchUpFormat))
|
|
32920
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
32913
32921
|
return { error: UNRECOGNIZED_MATCHUP_FORMAT };
|
|
32914
32922
|
var stack = 'setMatchUpFormat';
|
|
32915
32923
|
if (matchUpId) {
|
|
@@ -32992,7 +33000,7 @@ function setMatchUpFormat(params) {
|
|
|
32992
33000
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
32993
33001
|
if (!matchUpFormat)
|
|
32994
33002
|
return { error: MISSING_MATCHUP_FORMAT };
|
|
32995
|
-
if (matchUpFormat && !isValidMatchUpFormat(matchUpFormat))
|
|
33003
|
+
if (matchUpFormat && !isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
32996
33004
|
return decorateResult({
|
|
32997
33005
|
result: { error: UNRECOGNIZED_MATCHUP_FORMAT, matchUpFormat: matchUpFormat },
|
|
32998
33006
|
stack: stack,
|
|
@@ -45210,7 +45218,7 @@ function checkRequestConflicts(_a) {
|
|
|
45210
45218
|
|
|
45211
45219
|
function findMatchUpFormatTiming(_a) {
|
|
45212
45220
|
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))
|
|
45221
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
45214
45222
|
return { error: UNRECOGNIZED_MATCHUP_FORMAT };
|
|
45215
45223
|
var tournamentIds = Object.keys(tournamentRecords).filter(function (currentTournamentId) {
|
|
45216
45224
|
return !tournamentId || currentTournamentId === tournamentId;
|
|
@@ -49081,7 +49089,7 @@ function generateOutcome(params) {
|
|
|
49081
49089
|
var _d = params.matchUpStatusProfile, matchUpStatusProfile = _d === void 0 ? defaultStatusProfile : _d, // { matchUpStatusProfile: {} } will always return only { matchUpStatus: COMPLETED }
|
|
49082
49090
|
_e = params.matchUpFormat, // { matchUpStatusProfile: {} } will always return only { matchUpStatus: COMPLETED }
|
|
49083
49091
|
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))
|
|
49092
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
49085
49093
|
return { error: INVALID_MATCHUP_FORMAT };
|
|
49086
49094
|
if (typeof matchUpStatusProfile !== 'object')
|
|
49087
49095
|
return { error: INVALID_VALUES };
|
|
@@ -53100,7 +53108,9 @@ function getEventMatchUpFormatTiming(_a) {
|
|
|
53100
53108
|
: definition;
|
|
53101
53109
|
if (uniqueMatchUpFormats_1.includes(definitionObject === null || definitionObject === void 0 ? void 0 : definitionObject.matchUpFormat))
|
|
53102
53110
|
return;
|
|
53103
|
-
if (!isValidMatchUpFormat(
|
|
53111
|
+
if (!isValidMatchUpFormat({
|
|
53112
|
+
matchUpFormat: definitionObject === null || definitionObject === void 0 ? void 0 : definitionObject.matchUpFormat,
|
|
53113
|
+
}))
|
|
53104
53114
|
return;
|
|
53105
53115
|
uniqueMatchUpFormats_1.push(definitionObject.matchUpFormat);
|
|
53106
53116
|
return definitionObject;
|
|
@@ -53131,8 +53141,8 @@ function getModifiedMatchUpFormatTiming(params) {
|
|
|
53131
53141
|
var paramCheck = checkRequiredParameters(params, [
|
|
53132
53142
|
(_a = {}, _a[TOURNAMENT_RECORD] = true, _a),
|
|
53133
53143
|
(_b = {},
|
|
53144
|
+
_b[VALIDATE] = function (matchUpFormat) { return isValidMatchUpFormat({ matchUpFormat: matchUpFormat }); },
|
|
53134
53145
|
_b[INVALID] = UNRECOGNIZED_MATCHUP_FORMAT,
|
|
53135
|
-
_b[VALIDATE] = isValidMatchUpFormat,
|
|
53136
53146
|
_b[MATCHUP_FORMAT] = true,
|
|
53137
53147
|
_b),
|
|
53138
53148
|
]);
|
|
@@ -56424,6 +56434,15 @@ function getParticipantSignInStatus(_a) {
|
|
|
56424
56434
|
return timeItem && timeItem.itemValue === SIGNED_IN && SIGNED_IN;
|
|
56425
56435
|
}
|
|
56426
56436
|
|
|
56437
|
+
function getMatchUpContextIds(_a) {
|
|
56438
|
+
var matchUps = _a.matchUps, matchUpId = _a.matchUpId;
|
|
56439
|
+
if (!validMatchUps(matchUps))
|
|
56440
|
+
return { error: INVALID_VALUES };
|
|
56441
|
+
var matchUp = matchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
|
|
56442
|
+
var _b = matchUp || {}, drawId = _b.drawId, eventId = _b.eventId, structureId = _b.structureId, tournamentId = _b.tournamentId;
|
|
56443
|
+
return { matchUpId: matchUpId, drawId: drawId, eventId: eventId, structureId: structureId, tournamentId: tournamentId };
|
|
56444
|
+
}
|
|
56445
|
+
|
|
56427
56446
|
function getMaxEntryPosition(params) {
|
|
56428
56447
|
var _a = params.entries, entries = _a === void 0 ? [] : _a, entryStatus = params.entryStatus, stage = params.stage;
|
|
56429
56448
|
return Math.max.apply(Math, __spreadArray(__spreadArray([], __read(entries
|
|
@@ -57681,6 +57700,20 @@ var queryGovernor = {
|
|
|
57681
57700
|
validateLineUp: validateLineUp,
|
|
57682
57701
|
validMatchUp: validMatchUp,
|
|
57683
57702
|
validMatchUps: validMatchUps,
|
|
57703
|
+
allPlayoffPositionsFilled: allPlayoffPositionsFilled,
|
|
57704
|
+
getCategoryAgeDetails: getCategoryAgeDetails,
|
|
57705
|
+
calculateWinCriteria: calculateWinCriteria,
|
|
57706
|
+
compareTieFormats: compareTieFormats,
|
|
57707
|
+
getMatchUpContextIds: getMatchUpContextIds,
|
|
57708
|
+
getScaleValues: getScaleValues,
|
|
57709
|
+
getSeedingThresholds: getSeedingThresholds,
|
|
57710
|
+
getTimeItem: getTimeItem,
|
|
57711
|
+
getValidGroupSizes: getValidGroupSizes,
|
|
57712
|
+
isAdHoc: isAdHoc,
|
|
57713
|
+
isCompletedStructure: isCompletedStructure,
|
|
57714
|
+
roundRobinGroups: roundRobinGroups,
|
|
57715
|
+
tieFormatGenderValidityCheck: tieFormatGenderValidityCheck,
|
|
57716
|
+
validateCategory: validateCategory,
|
|
57684
57717
|
};
|
|
57685
57718
|
|
|
57686
57719
|
function getDetailsWTN(_a) {
|
|
@@ -59051,7 +59084,7 @@ function modifyEventMatchUpFormatTiming(params) {
|
|
|
59051
59084
|
var tournamentRecord = params.tournamentRecord, recoveryMinutes = params.recoveryMinutes, averageMinutes = params.averageMinutes, matchUpFormat = params.matchUpFormat, categoryType = params.categoryType, eventId = params.eventId, event = params.event;
|
|
59052
59085
|
if (!tournamentRecord)
|
|
59053
59086
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
59054
|
-
if (!isValidMatchUpFormat(matchUpFormat))
|
|
59087
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
59055
59088
|
return { error: INVALID_VALUES };
|
|
59056
59089
|
if (!event)
|
|
59057
59090
|
return { error: MISSING_EVENT };
|
|
@@ -63592,7 +63625,7 @@ function calculateHistoryScore(params) {
|
|
|
63592
63625
|
var matchUpFormat = matchUp.matchUpFormat;
|
|
63593
63626
|
if (!matchUpFormat)
|
|
63594
63627
|
return { error: MISSING_MATCHUP_FORMAT };
|
|
63595
|
-
if (!isValidMatchUpFormat(matchUpFormat))
|
|
63628
|
+
if (!isValidMatchUpFormat({ matchUpFormat: matchUpFormat }))
|
|
63596
63629
|
return { error: INVALID_MATCHUP_FORMAT };
|
|
63597
63630
|
var parsedFormat = parse(matchUpFormat);
|
|
63598
63631
|
var bestOf = parsedFormat.bestOf, finalSetFormat = parsedFormat.finalSetFormat, setFormat = parsedFormat.setFormat;
|
|
@@ -64316,15 +64349,6 @@ function visualizeScheduledMatchUps(_a) {
|
|
|
64316
64349
|
printGlobalLog();
|
|
64317
64350
|
}
|
|
64318
64351
|
|
|
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
64352
|
function dehydrateMatchUps(_a) {
|
|
64329
64353
|
var tournamentRecord = _a.tournamentRecord;
|
|
64330
64354
|
if (!tournamentRecord)
|
|
@@ -64647,38 +64671,29 @@ function flattenJSON(obj, keyJoiner, path) {
|
|
|
64647
64671
|
}
|
|
64648
64672
|
|
|
64649
64673
|
var utilitiesGovernor = {
|
|
64674
|
+
visualizeScheduledMatchUps: visualizeScheduledMatchUps,
|
|
64675
|
+
dehydrateMatchUps: dehydrateMatchUps,
|
|
64676
|
+
structureSort: structureSort,
|
|
64650
64677
|
allNumeric: allNumeric$1,
|
|
64651
|
-
allPlayoffPositionsFilled: allPlayoffPositionsFilled,
|
|
64652
64678
|
attributeFilter: attributeFilter,
|
|
64653
|
-
calculateWinCriteria: calculateWinCriteria,
|
|
64654
64679
|
chunkArray: chunkArray,
|
|
64655
64680
|
chunkByNth: chunkByNth,
|
|
64656
64681
|
chunkSizeProfile: chunkSizeProfile,
|
|
64657
|
-
compareTieFormats: compareTieFormats,
|
|
64658
64682
|
constantToString: constantToString,
|
|
64659
64683
|
countValues: countValues,
|
|
64660
64684
|
createMap: createMap,
|
|
64661
64685
|
dateRange: dateRange,
|
|
64662
64686
|
dateTime: dateTime,
|
|
64663
64687
|
definedAttributes: definedAttributes,
|
|
64664
|
-
dehydrateMatchUps: dehydrateMatchUps,
|
|
64665
64688
|
extractAttributes: extractAttributes,
|
|
64666
64689
|
flattenJSON: flattenJSON,
|
|
64667
64690
|
generateHashCode: generateHashCode,
|
|
64668
64691
|
generateRange: generateRange,
|
|
64669
64692
|
generateTimeCode: generateTimeCode,
|
|
64670
|
-
getCategoryAgeDetails: getCategoryAgeDetails,
|
|
64671
|
-
getMatchUpContextIds: getMatchUpContextIds,
|
|
64672
|
-
getScaleValues: getScaleValues,
|
|
64673
|
-
getSeedingThresholds: getSeedingThresholds,
|
|
64674
|
-
getTimeItem: getTimeItem,
|
|
64675
|
-
getValidGroupSizes: getValidGroupSizes,
|
|
64676
64693
|
groupValues: groupValues,
|
|
64677
64694
|
hasAttributeValues: hasAttributeValues,
|
|
64678
64695
|
instanceCount: instanceCount,
|
|
64679
64696
|
intersection: intersection,
|
|
64680
|
-
isAdHoc: isAdHoc,
|
|
64681
|
-
isCompletedStructure: isCompletedStructure,
|
|
64682
64697
|
isConvertableInteger: isConvertableInteger,
|
|
64683
64698
|
isNumeric: isNumeric,
|
|
64684
64699
|
isOdd: isOdd,
|
|
@@ -64695,17 +64710,12 @@ var utilitiesGovernor = {
|
|
|
64695
64710
|
overlap: overlap,
|
|
64696
64711
|
randomMember: randomMember,
|
|
64697
64712
|
randomPop: randomPop,
|
|
64698
|
-
roundRobinGroups: roundRobinGroups,
|
|
64699
64713
|
shuffleArray: shuffleArray,
|
|
64700
|
-
structureSort: structureSort,
|
|
64701
64714
|
subSort: subSort,
|
|
64702
|
-
tieFormatGenderValidityCheck: tieFormatGenderValidityCheck,
|
|
64703
64715
|
undefinedToNull: undefinedToNull,
|
|
64704
64716
|
unique: unique,
|
|
64705
64717
|
UUID: UUID,
|
|
64706
64718
|
UUIDS: UUIDS,
|
|
64707
|
-
validateCategory: validateCategory,
|
|
64708
|
-
visualizeScheduledMatchUps: visualizeScheduledMatchUps,
|
|
64709
64719
|
};
|
|
64710
64720
|
var utilities = utilitiesGovernor;
|
|
64711
64721
|
|
|
@@ -67702,7 +67712,6 @@ exports.positionActionConstants = positionActionConstants;
|
|
|
67702
67712
|
exports.resultConstants = resultConstants;
|
|
67703
67713
|
exports.scaleConstants = scaleConstants;
|
|
67704
67714
|
exports.scaleEngine = scaleEngine;
|
|
67705
|
-
exports.scoreGovernor = scoreGovernor;
|
|
67706
67715
|
exports.surfaceConstants = surfaceConstants;
|
|
67707
67716
|
exports.syncEngine = engine;
|
|
67708
67717
|
exports.timeItemConstants = timeItemConstants;
|