tods-competition-factory 1.7.7 → 1.7.9
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/forge/generate.d.ts +26 -1
- package/dist/forge/generate.mjs +215 -167
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +139 -138
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +139 -88
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.d.ts +3 -2
- package/dist/forge/utilities.mjs +142 -76
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +335 -198
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +441 -311
- 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 -6
|
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
function factoryVersion() {
|
|
365
|
-
return '1.7.
|
|
365
|
+
return '1.7.9';
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/******************************************************************************
|
|
@@ -2017,184 +2017,6 @@ function handleCaughtError(_a) {
|
|
|
2017
2017
|
});
|
|
2018
2018
|
}
|
|
2019
2019
|
|
|
2020
|
-
function isString(obj) {
|
|
2021
|
-
return typeof obj === 'string';
|
|
2022
|
-
}
|
|
2023
|
-
function isObject(obj) {
|
|
2024
|
-
return typeof obj === 'object';
|
|
2025
|
-
}
|
|
2026
|
-
// e.g. result.find(hav({ attr: value })) -or- result.filter(hav({ attr: value }))
|
|
2027
|
-
var hasAttributeValues = function (a) { return function (o) {
|
|
2028
|
-
return Object.keys(a).every(function (key) { return o[key] === a[key]; });
|
|
2029
|
-
}; };
|
|
2030
|
-
// extracts targeted attributes
|
|
2031
|
-
// e.g. const byeAssignments = positionAssignments.filter(xa('bye')).map(xa('drawPosition'));
|
|
2032
|
-
// supports xa('string'), xa(['string', 'string']), xa({ attr1: true, attr2: true })
|
|
2033
|
-
var extractAttributes = function (atz) { return function (o) {
|
|
2034
|
-
return !atz || typeof o !== 'object'
|
|
2035
|
-
? undefined
|
|
2036
|
-
: (Array.isArray(atz) && atz.map(function (a) {
|
|
2037
|
-
var _a;
|
|
2038
|
-
return (_a = {}, _a[a] = o[a], _a);
|
|
2039
|
-
})) ||
|
|
2040
|
-
(typeof atz === 'object' &&
|
|
2041
|
-
Object.keys(atz).map(function (key) {
|
|
2042
|
-
var _a;
|
|
2043
|
-
return (_a = {}, _a[key] = o[key], _a);
|
|
2044
|
-
})) ||
|
|
2045
|
-
(typeof atz === 'string' && getAttr(o, atz));
|
|
2046
|
-
}; };
|
|
2047
|
-
function getAttr(o, attr) {
|
|
2048
|
-
var e_1, _a;
|
|
2049
|
-
var attrs = attr.split('.');
|
|
2050
|
-
try {
|
|
2051
|
-
for (var attrs_1 = __values(attrs), attrs_1_1 = attrs_1.next(); !attrs_1_1.done; attrs_1_1 = attrs_1.next()) {
|
|
2052
|
-
var a = attrs_1_1.value;
|
|
2053
|
-
o = o === null || o === void 0 ? void 0 : o[a];
|
|
2054
|
-
if (!o)
|
|
2055
|
-
return;
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2059
|
-
finally {
|
|
2060
|
-
try {
|
|
2061
|
-
if (attrs_1_1 && !attrs_1_1.done && (_a = attrs_1.return)) _a.call(attrs_1);
|
|
2062
|
-
}
|
|
2063
|
-
finally { if (e_1) throw e_1.error; }
|
|
2064
|
-
}
|
|
2065
|
-
return o;
|
|
2066
|
-
}
|
|
2067
|
-
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
2068
|
-
if (typeof obj !== 'object' || obj === null)
|
|
2069
|
-
return obj;
|
|
2070
|
-
var deepCopy = deepCopyEnabled();
|
|
2071
|
-
if (!(deepCopy === null || deepCopy === void 0 ? void 0 : deepCopy.enabled))
|
|
2072
|
-
shallow = true;
|
|
2073
|
-
var ignoreValues = ['', undefined, null];
|
|
2074
|
-
if (ignoreFalse)
|
|
2075
|
-
ignoreValues.push(false);
|
|
2076
|
-
var definedKeys = Object.keys(obj).filter(function (key) {
|
|
2077
|
-
return !ignoreValues.includes(obj[key]) &&
|
|
2078
|
-
(!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true));
|
|
2079
|
-
});
|
|
2080
|
-
return Object.assign.apply(Object, __spreadArray([{}], __read(definedKeys.map(function (key) {
|
|
2081
|
-
var _a, _b;
|
|
2082
|
-
return Array.isArray(obj[key])
|
|
2083
|
-
? (_a = {},
|
|
2084
|
-
_a[key] = shallow
|
|
2085
|
-
? obj[key]
|
|
2086
|
-
: obj[key].map(function (m) { return definedAttributes(m); }),
|
|
2087
|
-
_a) : (_b = {}, _b[key] = shallow ? obj[key] : definedAttributes(obj[key]), _b);
|
|
2088
|
-
})), false));
|
|
2089
|
-
}
|
|
2090
|
-
function countKeys(o) {
|
|
2091
|
-
if (Array.isArray(o)) {
|
|
2092
|
-
return o.length + o.map(countKeys).reduce(function (a, b) { return a + b; }, 0);
|
|
2093
|
-
}
|
|
2094
|
-
else if (typeof o === 'object' && o !== null) {
|
|
2095
|
-
return (Object.keys(o).length +
|
|
2096
|
-
Object.keys(o)
|
|
2097
|
-
.map(function (k) { return countKeys(o[k]); })
|
|
2098
|
-
.reduce(function (a, b) { return a + b; }, 0));
|
|
2099
|
-
}
|
|
2100
|
-
return 0;
|
|
2101
|
-
}
|
|
2102
|
-
function generateHashCode(o) {
|
|
2103
|
-
if (o === null || typeof o !== 'object')
|
|
2104
|
-
return undefined;
|
|
2105
|
-
var str = JSON.stringify(o);
|
|
2106
|
-
var keyCount = countKeys(o);
|
|
2107
|
-
var charSum = str.split('').reduce(function (a, b) { return a + b.charCodeAt(0); }, 0);
|
|
2108
|
-
return [str.length, keyCount, charSum].map(function (e) { return e.toString(36); }).join('');
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
// NOTE: type really does need to be any!
|
|
2112
|
-
function attributeFilter(params) {
|
|
2113
|
-
if (params === null)
|
|
2114
|
-
return {};
|
|
2115
|
-
var _a = params || {}, source = _a.source, template = _a.template;
|
|
2116
|
-
if (!template)
|
|
2117
|
-
return source;
|
|
2118
|
-
var target = {};
|
|
2119
|
-
attributeCopy(source, template, target);
|
|
2120
|
-
return target;
|
|
2121
|
-
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
2122
|
-
var e_1, _a;
|
|
2123
|
-
if (!valuesObject || !templateObject)
|
|
2124
|
-
return undefined;
|
|
2125
|
-
var vKeys = Object.keys(valuesObject);
|
|
2126
|
-
var oKeys = Object.keys(templateObject);
|
|
2127
|
-
// the orMap allows spcification of { 'a||b': boolean } so that filter templates can apply to multiple attributes
|
|
2128
|
-
var orMap = Object.assign.apply(Object, __spreadArray([{}], __read(oKeys
|
|
2129
|
-
.filter(function (key) { return key.indexOf('||'); })
|
|
2130
|
-
.map(function (key) { return key.split('||').map(function (or) {
|
|
2131
|
-
var _a;
|
|
2132
|
-
return (_a = {}, _a[or] = key, _a);
|
|
2133
|
-
}); })
|
|
2134
|
-
.flat()), false));
|
|
2135
|
-
var allKeys = oKeys.concat.apply(oKeys, __spreadArray([], __read(Object.keys(orMap)), false));
|
|
2136
|
-
var wildcard = allKeys.includes('*');
|
|
2137
|
-
var _loop_1 = function (vKey) {
|
|
2138
|
-
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
2139
|
-
var templateKey = orMap[vKey] || vKey;
|
|
2140
|
-
var tobj_1 = templateObject[templateKey] || wildcard;
|
|
2141
|
-
var vobj = valuesObject[vKey];
|
|
2142
|
-
if (typeof tobj_1 === 'object' &&
|
|
2143
|
-
typeof vobj !== 'function' &&
|
|
2144
|
-
!Array.isArray(tobj_1)) {
|
|
2145
|
-
if (Array.isArray(vobj)) {
|
|
2146
|
-
var mappedElements = vobj
|
|
2147
|
-
.map(function (arrayMember) {
|
|
2148
|
-
var target = {};
|
|
2149
|
-
var result = attributeCopy(arrayMember, tobj_1, target);
|
|
2150
|
-
return result !== false ? target : undefined;
|
|
2151
|
-
})
|
|
2152
|
-
.filter(Boolean);
|
|
2153
|
-
outputObject[vKey] = mappedElements;
|
|
2154
|
-
}
|
|
2155
|
-
else if (vobj) {
|
|
2156
|
-
outputObject[vKey] = {};
|
|
2157
|
-
attributeCopy(vobj, tobj_1, outputObject[vKey]);
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
else {
|
|
2161
|
-
var value = valuesObject[vKey];
|
|
2162
|
-
var exclude = Array.isArray(tobj_1) && !tobj_1.includes(value);
|
|
2163
|
-
if (exclude)
|
|
2164
|
-
return { value: false };
|
|
2165
|
-
if (templateObject[vKey] ||
|
|
2166
|
-
(wildcard && templateObject[vKey] !== false)) {
|
|
2167
|
-
outputObject[vKey] = value;
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
};
|
|
2172
|
-
try {
|
|
2173
|
-
for (var vKeys_1 = __values(vKeys), vKeys_1_1 = vKeys_1.next(); !vKeys_1_1.done; vKeys_1_1 = vKeys_1.next()) {
|
|
2174
|
-
var vKey = vKeys_1_1.value;
|
|
2175
|
-
var state_1 = _loop_1(vKey);
|
|
2176
|
-
if (typeof state_1 === "object")
|
|
2177
|
-
return state_1.value;
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2181
|
-
finally {
|
|
2182
|
-
try {
|
|
2183
|
-
if (vKeys_1_1 && !vKeys_1_1.done && (_a = vKeys_1.return)) _a.call(vKeys_1);
|
|
2184
|
-
}
|
|
2185
|
-
finally { if (e_1) throw e_1.error; }
|
|
2186
|
-
}
|
|
2187
|
-
return undefined;
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
function generateTimeCode(index) {
|
|
2192
|
-
if (index === void 0) { index = 0; }
|
|
2193
|
-
var uidate = new Date();
|
|
2194
|
-
uidate.setHours(uidate.getHours() + index);
|
|
2195
|
-
return uidate.getTime().toString(36).slice(-6).toUpperCase();
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
2020
|
var validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
|
|
2199
2021
|
var validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
|
|
2200
2022
|
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?$/;
|
|
@@ -2636,6 +2458,261 @@ function extensionsToAttributes(extensions) {
|
|
|
2636
2458
|
}).filter(Boolean);
|
|
2637
2459
|
}
|
|
2638
2460
|
|
|
2461
|
+
function getAccessorValue(_a) {
|
|
2462
|
+
var element = _a.element, accessor = _a.accessor;
|
|
2463
|
+
if (typeof accessor !== 'string')
|
|
2464
|
+
return { values: [] };
|
|
2465
|
+
var targetElement = makeDeepCopy(element);
|
|
2466
|
+
var attributes = accessor.split('.');
|
|
2467
|
+
var values = [];
|
|
2468
|
+
var value;
|
|
2469
|
+
processKeys({ targetElement: targetElement, attributes: attributes });
|
|
2470
|
+
var result = { value: value };
|
|
2471
|
+
if (values.length)
|
|
2472
|
+
result.values = values;
|
|
2473
|
+
return result;
|
|
2474
|
+
function processKeys(_a) {
|
|
2475
|
+
var e_1, _b;
|
|
2476
|
+
var targetElement = _a.targetElement, _c = _a.attributes, attributes = _c === void 0 ? [] : _c, significantCharacters = _a.significantCharacters;
|
|
2477
|
+
var _loop_1 = function (index, attribute) {
|
|
2478
|
+
if (targetElement === null || targetElement === void 0 ? void 0 : targetElement[attribute]) {
|
|
2479
|
+
var remainingKeys_1 = attributes.slice(index + 1);
|
|
2480
|
+
if (!remainingKeys_1.length) {
|
|
2481
|
+
if (!value)
|
|
2482
|
+
value = targetElement[attribute];
|
|
2483
|
+
if (!values.includes(targetElement[attribute])) {
|
|
2484
|
+
values.push(targetElement[attribute]);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
else if (Array.isArray(targetElement[attribute])) {
|
|
2488
|
+
var values_1 = targetElement[attribute];
|
|
2489
|
+
values_1.forEach(function (nestedTarget) {
|
|
2490
|
+
return processKeys({
|
|
2491
|
+
targetElement: nestedTarget,
|
|
2492
|
+
attributes: remainingKeys_1,
|
|
2493
|
+
});
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
else {
|
|
2497
|
+
targetElement = targetElement[attribute];
|
|
2498
|
+
checkValue({ targetElement: targetElement, index: index });
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
};
|
|
2502
|
+
try {
|
|
2503
|
+
for (var _d = __values(attributes.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2504
|
+
var _f = __read(_e.value, 2), index = _f[0], attribute = _f[1];
|
|
2505
|
+
_loop_1(index, attribute);
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2509
|
+
finally {
|
|
2510
|
+
try {
|
|
2511
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
2512
|
+
}
|
|
2513
|
+
finally { if (e_1) throw e_1.error; }
|
|
2514
|
+
}
|
|
2515
|
+
function checkValue(_a) {
|
|
2516
|
+
var targetElement = _a.targetElement, index = _a.index;
|
|
2517
|
+
if (targetElement &&
|
|
2518
|
+
index === attributes.length - 1 &&
|
|
2519
|
+
['string', 'number'].includes(typeof targetElement)) {
|
|
2520
|
+
var extractedValue = significantCharacters
|
|
2521
|
+
? targetElement.slice(0, significantCharacters)
|
|
2522
|
+
: targetElement;
|
|
2523
|
+
if (value) {
|
|
2524
|
+
if (!values.includes(extractedValue)) {
|
|
2525
|
+
values.push(extractedValue);
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
else {
|
|
2529
|
+
value = extractedValue;
|
|
2530
|
+
values.push(extractedValue);
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
function isString(obj) {
|
|
2538
|
+
return typeof obj === 'string';
|
|
2539
|
+
}
|
|
2540
|
+
function isObject(obj) {
|
|
2541
|
+
return typeof obj === 'object';
|
|
2542
|
+
}
|
|
2543
|
+
function createMap(objectArray, attribute) {
|
|
2544
|
+
if (!Array.isArray(objectArray))
|
|
2545
|
+
return {};
|
|
2546
|
+
return Object.assign.apply(Object, __spreadArray([{}], __read((objectArray !== null && objectArray !== void 0 ? objectArray : [])
|
|
2547
|
+
.filter(isObject)
|
|
2548
|
+
.map(function (obj) {
|
|
2549
|
+
var _a;
|
|
2550
|
+
return (obj[attribute] && (_a = {},
|
|
2551
|
+
_a[obj[attribute]] = obj,
|
|
2552
|
+
_a));
|
|
2553
|
+
})
|
|
2554
|
+
.filter(Boolean)), false));
|
|
2555
|
+
}
|
|
2556
|
+
// e.g. result.find(hav({ attr: value })) -or- result.filter(hav({ attr: value }))
|
|
2557
|
+
var hasAttributeValues = function (a) { return function (o) {
|
|
2558
|
+
return Object.keys(a).every(function (key) { return o[key] === a[key]; });
|
|
2559
|
+
}; };
|
|
2560
|
+
// extracts targeted attributes
|
|
2561
|
+
// e.g. const byeAssignments = positionAssignments.filter(xa('bye')).map(xa('drawPosition'));
|
|
2562
|
+
// supports xa('string'), xa(['string', 'string']), xa({ attr1: true, attr2: true })
|
|
2563
|
+
var extractAttributes = function (accessor) { return function (element) {
|
|
2564
|
+
var _a;
|
|
2565
|
+
return !accessor || typeof element !== 'object'
|
|
2566
|
+
? undefined
|
|
2567
|
+
: (Array.isArray(accessor) &&
|
|
2568
|
+
accessor.map(function (a) {
|
|
2569
|
+
var _a;
|
|
2570
|
+
var _b;
|
|
2571
|
+
return (_a = {},
|
|
2572
|
+
_a[a] = (_b = getAccessorValue({ element: element, accessor: a })) === null || _b === void 0 ? void 0 : _b.value,
|
|
2573
|
+
_a);
|
|
2574
|
+
})) ||
|
|
2575
|
+
(typeof accessor === 'object' &&
|
|
2576
|
+
Object.keys(accessor).map(function (key) {
|
|
2577
|
+
var _a;
|
|
2578
|
+
var _b;
|
|
2579
|
+
return (_a = {},
|
|
2580
|
+
_a[key] = (_b = getAccessorValue({ element: element, accessor: key })) === null || _b === void 0 ? void 0 : _b.value,
|
|
2581
|
+
_a);
|
|
2582
|
+
})) ||
|
|
2583
|
+
((_a = (typeof accessor === 'string' && getAccessorValue({ element: element, accessor: accessor }))) === null || _a === void 0 ? void 0 : _a.value);
|
|
2584
|
+
}; };
|
|
2585
|
+
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
2586
|
+
if (typeof obj !== 'object' || obj === null)
|
|
2587
|
+
return obj;
|
|
2588
|
+
var deepCopy = deepCopyEnabled();
|
|
2589
|
+
if (!(deepCopy === null || deepCopy === void 0 ? void 0 : deepCopy.enabled))
|
|
2590
|
+
shallow = true;
|
|
2591
|
+
var ignoreValues = ['', undefined, null];
|
|
2592
|
+
if (ignoreFalse)
|
|
2593
|
+
ignoreValues.push(false);
|
|
2594
|
+
var definedKeys = Object.keys(obj).filter(function (key) {
|
|
2595
|
+
return !ignoreValues.includes(obj[key]) &&
|
|
2596
|
+
(!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true));
|
|
2597
|
+
});
|
|
2598
|
+
return Object.assign.apply(Object, __spreadArray([{}], __read(definedKeys.map(function (key) {
|
|
2599
|
+
var _a, _b;
|
|
2600
|
+
return Array.isArray(obj[key])
|
|
2601
|
+
? (_a = {},
|
|
2602
|
+
_a[key] = shallow
|
|
2603
|
+
? obj[key]
|
|
2604
|
+
: obj[key].map(function (m) { return definedAttributes(m); }),
|
|
2605
|
+
_a) : (_b = {}, _b[key] = shallow ? obj[key] : definedAttributes(obj[key]), _b);
|
|
2606
|
+
})), false));
|
|
2607
|
+
}
|
|
2608
|
+
function countKeys(o) {
|
|
2609
|
+
if (Array.isArray(o)) {
|
|
2610
|
+
return o.length + o.map(countKeys).reduce(function (a, b) { return a + b; }, 0);
|
|
2611
|
+
}
|
|
2612
|
+
else if (typeof o === 'object' && o !== null) {
|
|
2613
|
+
return (Object.keys(o).length +
|
|
2614
|
+
Object.keys(o)
|
|
2615
|
+
.map(function (k) { return countKeys(o[k]); })
|
|
2616
|
+
.reduce(function (a, b) { return a + b; }, 0));
|
|
2617
|
+
}
|
|
2618
|
+
return 0;
|
|
2619
|
+
}
|
|
2620
|
+
function generateHashCode(o) {
|
|
2621
|
+
if (o === null || typeof o !== 'object')
|
|
2622
|
+
return undefined;
|
|
2623
|
+
var str = JSON.stringify(o);
|
|
2624
|
+
var keyCount = countKeys(o);
|
|
2625
|
+
var charSum = str.split('').reduce(function (a, b) { return a + b.charCodeAt(0); }, 0);
|
|
2626
|
+
return [str.length, keyCount, charSum].map(function (e) { return e.toString(36); }).join('');
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
// NOTE: type really does need to be any!
|
|
2630
|
+
function attributeFilter(params) {
|
|
2631
|
+
if (params === null)
|
|
2632
|
+
return {};
|
|
2633
|
+
var _a = params || {}, source = _a.source, template = _a.template;
|
|
2634
|
+
if (!template)
|
|
2635
|
+
return source;
|
|
2636
|
+
var target = {};
|
|
2637
|
+
attributeCopy(source, template, target);
|
|
2638
|
+
return target;
|
|
2639
|
+
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
2640
|
+
var e_1, _a;
|
|
2641
|
+
if (!valuesObject || !templateObject)
|
|
2642
|
+
return undefined;
|
|
2643
|
+
var vKeys = Object.keys(valuesObject);
|
|
2644
|
+
var oKeys = Object.keys(templateObject);
|
|
2645
|
+
// the orMap allows spcification of { 'a||b': boolean } so that filter templates can apply to multiple attributes
|
|
2646
|
+
var orMap = Object.assign.apply(Object, __spreadArray([{}], __read(oKeys
|
|
2647
|
+
.filter(function (key) { return key.indexOf('||'); })
|
|
2648
|
+
.map(function (key) { return key.split('||').map(function (or) {
|
|
2649
|
+
var _a;
|
|
2650
|
+
return (_a = {}, _a[or] = key, _a);
|
|
2651
|
+
}); })
|
|
2652
|
+
.flat()), false));
|
|
2653
|
+
var allKeys = oKeys.concat.apply(oKeys, __spreadArray([], __read(Object.keys(orMap)), false));
|
|
2654
|
+
var wildcard = allKeys.includes('*');
|
|
2655
|
+
var _loop_1 = function (vKey) {
|
|
2656
|
+
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
2657
|
+
var templateKey = orMap[vKey] || vKey;
|
|
2658
|
+
var tobj_1 = templateObject[templateKey] || wildcard;
|
|
2659
|
+
var vobj = valuesObject[vKey];
|
|
2660
|
+
if (typeof tobj_1 === 'object' &&
|
|
2661
|
+
typeof vobj !== 'function' &&
|
|
2662
|
+
!Array.isArray(tobj_1)) {
|
|
2663
|
+
if (Array.isArray(vobj)) {
|
|
2664
|
+
var mappedElements = vobj
|
|
2665
|
+
.map(function (arrayMember) {
|
|
2666
|
+
var target = {};
|
|
2667
|
+
var result = attributeCopy(arrayMember, tobj_1, target);
|
|
2668
|
+
return result !== false ? target : undefined;
|
|
2669
|
+
})
|
|
2670
|
+
.filter(Boolean);
|
|
2671
|
+
outputObject[vKey] = mappedElements;
|
|
2672
|
+
}
|
|
2673
|
+
else if (vobj) {
|
|
2674
|
+
outputObject[vKey] = {};
|
|
2675
|
+
attributeCopy(vobj, tobj_1, outputObject[vKey]);
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
else {
|
|
2679
|
+
var value = valuesObject[vKey];
|
|
2680
|
+
var exclude = Array.isArray(tobj_1) && !tobj_1.includes(value);
|
|
2681
|
+
if (exclude)
|
|
2682
|
+
return { value: false };
|
|
2683
|
+
if (templateObject[vKey] ||
|
|
2684
|
+
(wildcard && templateObject[vKey] !== false)) {
|
|
2685
|
+
outputObject[vKey] = value;
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
try {
|
|
2691
|
+
for (var vKeys_1 = __values(vKeys), vKeys_1_1 = vKeys_1.next(); !vKeys_1_1.done; vKeys_1_1 = vKeys_1.next()) {
|
|
2692
|
+
var vKey = vKeys_1_1.value;
|
|
2693
|
+
var state_1 = _loop_1(vKey);
|
|
2694
|
+
if (typeof state_1 === "object")
|
|
2695
|
+
return state_1.value;
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2699
|
+
finally {
|
|
2700
|
+
try {
|
|
2701
|
+
if (vKeys_1_1 && !vKeys_1_1.done && (_a = vKeys_1.return)) _a.call(vKeys_1);
|
|
2702
|
+
}
|
|
2703
|
+
finally { if (e_1) throw e_1.error; }
|
|
2704
|
+
}
|
|
2705
|
+
return undefined;
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
function generateTimeCode(index) {
|
|
2710
|
+
if (index === void 0) { index = 0; }
|
|
2711
|
+
var uidate = new Date();
|
|
2712
|
+
uidate.setHours(uidate.getHours() + index);
|
|
2713
|
+
return uidate.getTime().toString(36).slice(-6).toUpperCase();
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2639
2716
|
function numericSort(a, b) {
|
|
2640
2717
|
return a - b;
|
|
2641
2718
|
}
|
|
@@ -9012,6 +9089,7 @@ function isAdHoc(_a) {
|
|
|
9012
9089
|
var hasRoundPosition = matchUps === null || matchUps === void 0 ? void 0 : matchUps.find(function (matchUp) { return matchUp === null || matchUp === void 0 ? void 0 : matchUp.roundPosition; });
|
|
9013
9090
|
var hasDrawPosition = matchUps === null || matchUps === void 0 ? void 0 : matchUps.find(function (matchUp) { var _a; return (_a = matchUp === null || matchUp === void 0 ? void 0 : matchUp.drawPositions) === null || _a === void 0 ? void 0 : _a.length; });
|
|
9014
9091
|
return (!(structure === null || structure === void 0 ? void 0 : structure.structures) &&
|
|
9092
|
+
(structure === null || structure === void 0 ? void 0 : structure.stage) !== VOLUNTARY_CONSOLATION &&
|
|
9015
9093
|
!((drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.drawType) && drawDefinition.drawType !== AD_HOC) &&
|
|
9016
9094
|
!hasRoundPosition &&
|
|
9017
9095
|
!hasDrawPosition);
|
|
@@ -24773,6 +24851,23 @@ function getNumericSeedValue(seedValue) {
|
|
|
24773
24851
|
return Infinity;
|
|
24774
24852
|
}
|
|
24775
24853
|
|
|
24854
|
+
function capitalizeFirst(str) {
|
|
24855
|
+
return !isString(str)
|
|
24856
|
+
? str
|
|
24857
|
+
: str
|
|
24858
|
+
.split(' ')
|
|
24859
|
+
.map(function (name) {
|
|
24860
|
+
return name
|
|
24861
|
+
.split('')
|
|
24862
|
+
.map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
|
|
24863
|
+
.join('');
|
|
24864
|
+
})
|
|
24865
|
+
.join(' ');
|
|
24866
|
+
}
|
|
24867
|
+
function constantToString(str) {
|
|
24868
|
+
return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, ' '));
|
|
24869
|
+
}
|
|
24870
|
+
|
|
24776
24871
|
var structureTemplate = function (_a) {
|
|
24777
24872
|
var _b = _a.finishingPosition, finishingPosition = _b === void 0 ? ROUND_OUTCOME : _b, qualifyingRoundNumber = _a.qualifyingRoundNumber, structureAbbreviation = _a.structureAbbreviation, _c = _a.seedAssignments, seedAssignments = _c === void 0 ? [] : _c, _d = _a.stageSequence, stageSequence = _d === void 0 ? 1 : _d, structureOrder = _a.structureOrder, seedingProfile = _a.seedingProfile, matchUpFormat = _a.matchUpFormat, structureType = _a.structureType, structureName = _a.structureName, matchUpType = _a.matchUpType, _e = _a.matchUps, matchUps = _e === void 0 ? [] : _e, structureId = _a.structureId, roundOffset = _a.roundOffset, roundLimit = _a.roundLimit, stageOrder = _a.stageOrder, structures = _a.structures, stage = _a.stage;
|
|
24778
24873
|
var structure = {
|
|
@@ -24828,7 +24923,7 @@ var structureTemplate = function (_a) {
|
|
|
24828
24923
|
};
|
|
24829
24924
|
|
|
24830
24925
|
function generateRoundRobin(_a) {
|
|
24831
|
-
var _b = _a.structureName, structureName = _b === void 0 ? MAIN : _b, _c = _a.stageSequence, stageSequence = _c === void 0 ? 1 : _c, structureOptions = _a.structureOptions, appliedPolicies = _a.appliedPolicies, seedingProfile = _a.seedingProfile, _d = _a.stage, stage = _d === void 0 ? MAIN : _d, matchUpType = _a.matchUpType, roundTarget = _a.roundTarget, structureId = _a.structureId, drawSize = _a.drawSize, idPrefix = _a.idPrefix, isMock = _a.isMock, uuids = _a.uuids;
|
|
24926
|
+
var _b = _a.structureName, structureName = _b === void 0 ? constantToString(MAIN) : _b, _c = _a.stageSequence, stageSequence = _c === void 0 ? 1 : _c, structureOptions = _a.structureOptions, appliedPolicies = _a.appliedPolicies, seedingProfile = _a.seedingProfile, _d = _a.stage, stage = _d === void 0 ? MAIN : _d, matchUpType = _a.matchUpType, roundTarget = _a.roundTarget, structureId = _a.structureId, drawSize = _a.drawSize, idPrefix = _a.idPrefix, isMock = _a.isMock, uuids = _a.uuids;
|
|
24832
24927
|
var _e = deriveGroups({
|
|
24833
24928
|
structureOptions: structureOptions,
|
|
24834
24929
|
appliedPolicies: appliedPolicies,
|
|
@@ -28308,75 +28403,6 @@ function getEventPublishStatuses(_a) {
|
|
|
28308
28403
|
return undefined;
|
|
28309
28404
|
}
|
|
28310
28405
|
|
|
28311
|
-
function getAccessorValue(_a) {
|
|
28312
|
-
var element = _a.element, accessor = _a.accessor;
|
|
28313
|
-
if (typeof accessor !== 'string')
|
|
28314
|
-
return { values: [] };
|
|
28315
|
-
var targetElement = makeDeepCopy(element);
|
|
28316
|
-
var attributes = accessor.split('.');
|
|
28317
|
-
var values = [];
|
|
28318
|
-
var value;
|
|
28319
|
-
processKeys({ targetElement: targetElement, attributes: attributes });
|
|
28320
|
-
var result = { value: value };
|
|
28321
|
-
if (values.length)
|
|
28322
|
-
result.values = values;
|
|
28323
|
-
return result;
|
|
28324
|
-
function processKeys(_a) {
|
|
28325
|
-
var e_1, _b;
|
|
28326
|
-
var targetElement = _a.targetElement, _c = _a.attributes, attributes = _c === void 0 ? [] : _c, significantCharacters = _a.significantCharacters;
|
|
28327
|
-
var _loop_1 = function (index, attribute) {
|
|
28328
|
-
if (targetElement === null || targetElement === void 0 ? void 0 : targetElement[attribute]) {
|
|
28329
|
-
if (Array.isArray(targetElement[attribute])) {
|
|
28330
|
-
var values_1 = targetElement[attribute];
|
|
28331
|
-
var remainingKeys_1 = attributes.slice(index);
|
|
28332
|
-
values_1.forEach(function (nestedTarget) {
|
|
28333
|
-
return processKeys({
|
|
28334
|
-
targetElement: nestedTarget,
|
|
28335
|
-
attributes: remainingKeys_1,
|
|
28336
|
-
});
|
|
28337
|
-
});
|
|
28338
|
-
}
|
|
28339
|
-
else {
|
|
28340
|
-
targetElement = targetElement[attribute];
|
|
28341
|
-
checkValue({ targetElement: targetElement, index: index });
|
|
28342
|
-
}
|
|
28343
|
-
}
|
|
28344
|
-
};
|
|
28345
|
-
try {
|
|
28346
|
-
for (var _d = __values(attributes.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
28347
|
-
var _f = __read(_e.value, 2), index = _f[0], attribute = _f[1];
|
|
28348
|
-
_loop_1(index, attribute);
|
|
28349
|
-
}
|
|
28350
|
-
}
|
|
28351
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
28352
|
-
finally {
|
|
28353
|
-
try {
|
|
28354
|
-
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
28355
|
-
}
|
|
28356
|
-
finally { if (e_1) throw e_1.error; }
|
|
28357
|
-
}
|
|
28358
|
-
function checkValue(_a) {
|
|
28359
|
-
var targetElement = _a.targetElement, index = _a.index;
|
|
28360
|
-
if (targetElement &&
|
|
28361
|
-
index === attributes.length - 1 &&
|
|
28362
|
-
['string', 'number'].includes(typeof targetElement)) {
|
|
28363
|
-
var extractedValue = significantCharacters
|
|
28364
|
-
? targetElement.slice(0, significantCharacters)
|
|
28365
|
-
: targetElement;
|
|
28366
|
-
if (value) {
|
|
28367
|
-
if (!values.includes(extractedValue)) {
|
|
28368
|
-
values.push(extractedValue);
|
|
28369
|
-
}
|
|
28370
|
-
}
|
|
28371
|
-
else {
|
|
28372
|
-
value = extractedValue;
|
|
28373
|
-
values.push(extractedValue);
|
|
28374
|
-
}
|
|
28375
|
-
}
|
|
28376
|
-
}
|
|
28377
|
-
}
|
|
28378
|
-
}
|
|
28379
|
-
|
|
28380
28406
|
function participantScaleItem(_a) {
|
|
28381
28407
|
var _b, _c;
|
|
28382
28408
|
var requireTimeStamp = _a.requireTimeStamp, scaleAttributes = _a.scaleAttributes, participant = _a.participant;
|
|
@@ -31029,7 +31055,7 @@ function getParticipantEntries(params) {
|
|
|
31029
31055
|
// id is the pair, team or individual participant currently being processed
|
|
31030
31056
|
// whereas participantId is the id of the entry into the draw
|
|
31031
31057
|
var addDrawEntry = function (id) {
|
|
31032
|
-
var _a, _b, _c, _d, _e
|
|
31058
|
+
var _a, _b, _c, _d, _e;
|
|
31033
31059
|
if ((_a = participantMap[id].draws) === null || _a === void 0 ? void 0 : _a[drawId])
|
|
31034
31060
|
return;
|
|
31035
31061
|
var includeSeeding = withSeeding && seedingPublished;
|
|
@@ -31046,13 +31072,17 @@ function getParticipantEntries(params) {
|
|
|
31046
31072
|
seedAssignments[MAIN] = mainSeeding;
|
|
31047
31073
|
if (seedAssignments && qualifyingSeeding)
|
|
31048
31074
|
seedAssignments[QUALIFYING] = mainSeeding;
|
|
31049
|
-
if (withEvents || withRankingProfile)
|
|
31075
|
+
if ((withEvents || withRankingProfile) &&
|
|
31076
|
+
participantMap[id] &&
|
|
31077
|
+
eventId) {
|
|
31078
|
+
if (!participantMap[id].events[eventId])
|
|
31079
|
+
participantMap[id].events[eventId] = {};
|
|
31050
31080
|
if (includeSeeding) {
|
|
31051
31081
|
// overwrite any event seeding with actual draw seeding (which may differ)
|
|
31052
31082
|
participantMap[id].events[eventId].seedValue =
|
|
31053
31083
|
mainSeeding || qualifyingSeeding;
|
|
31054
31084
|
}
|
|
31055
|
-
else if (
|
|
31085
|
+
else if (participantMap[id].events[eventId].seedValue) {
|
|
31056
31086
|
// if seeding for specific drawIds is NOT published, remove from event
|
|
31057
31087
|
participantMap[id].events[eventId].seedValue = undefined;
|
|
31058
31088
|
}
|
|
@@ -42952,8 +42982,8 @@ function firstRoundLoserConsolation(params) {
|
|
|
42952
42982
|
? feedInMatchUps(mainParams)
|
|
42953
42983
|
: treeMatchUps(mainParams)).matchUps;
|
|
42954
42984
|
var mainStructure = structureTemplate({
|
|
42985
|
+
structureName: structureName || constantToString(MAIN),
|
|
42955
42986
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
42956
|
-
structureName: structureName || MAIN,
|
|
42957
42987
|
stageSequence: stageSequence,
|
|
42958
42988
|
matchUpType: matchUpType,
|
|
42959
42989
|
matchUps: matchUps,
|
|
@@ -42970,8 +43000,9 @@ function firstRoundLoserConsolation(params) {
|
|
|
42970
43000
|
matchUpType: matchUpType,
|
|
42971
43001
|
isMock: isMock,
|
|
42972
43002
|
}).matchUps;
|
|
43003
|
+
var consolation = constantToString(CONSOLATION);
|
|
42973
43004
|
var consolationStructureName = params.consolationStructureName ||
|
|
42974
|
-
(structureName ? "".concat(structureName, " ").concat(
|
|
43005
|
+
(structureName ? "".concat(structureName, " ").concat(consolation) : consolation);
|
|
42975
43006
|
var consolationStructure = structureTemplate({
|
|
42976
43007
|
structureName: consolationStructureName,
|
|
42977
43008
|
matchUps: consolationMatchUps,
|
|
@@ -43050,7 +43081,7 @@ function feedInLinks(_a) {
|
|
|
43050
43081
|
}
|
|
43051
43082
|
|
|
43052
43083
|
function generateCurtisConsolation(params) {
|
|
43053
|
-
var
|
|
43084
|
+
var _a = params.structureName, structureName = _a === void 0 ? constantToString(MAIN) : _a, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionOffset = params.finishingPositionOffset, _b = params.stageSequence, stageSequence = _b === void 0 ? 1 : _b, structureNameMap = params.structureNameMap, staggeredEntry = params.staggeredEntry, _c = params.stage, stage = _c === void 0 ? MAIN : _c, matchUpType = params.matchUpType, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
43054
43085
|
var mainParams = {
|
|
43055
43086
|
finishingPositionOffset: finishingPositionOffset,
|
|
43056
43087
|
matchUpType: matchUpType,
|
|
@@ -43079,6 +43110,7 @@ function generateCurtisConsolation(params) {
|
|
|
43079
43110
|
var consolationStructure = consolationFeedStructure({
|
|
43080
43111
|
idPrefix: idPrefix && "".concat(idPrefix, "-c").concat(index),
|
|
43081
43112
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43113
|
+
playoffStructureNameBase: playoffStructureNameBase,
|
|
43082
43114
|
structureNameMap: structureNameMap,
|
|
43083
43115
|
stageSequence: stageSequence,
|
|
43084
43116
|
roundOffset: roundOffset,
|
|
@@ -43111,12 +43143,17 @@ function generateCurtisConsolation(params) {
|
|
|
43111
43143
|
matchUpType: matchUpType,
|
|
43112
43144
|
isMock: isMock,
|
|
43113
43145
|
}).matchUps;
|
|
43146
|
+
var defaultName = constantToString(PLAY_OFF);
|
|
43147
|
+
var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
|
|
43148
|
+
var structureName_1 = playoffStructureNameBase
|
|
43149
|
+
? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
|
|
43150
|
+
: mappedStructureName;
|
|
43114
43151
|
var playoffStructure = structureTemplate({
|
|
43115
|
-
structureName: (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[PLAY_OFF]) || PLAY_OFF,
|
|
43116
43152
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43117
43153
|
matchUps: playoffMatchUps,
|
|
43118
43154
|
stageSequence: 2,
|
|
43119
43155
|
stage: PLAY_OFF,
|
|
43156
|
+
structureName: structureName_1,
|
|
43120
43157
|
matchUpType: matchUpType,
|
|
43121
43158
|
});
|
|
43122
43159
|
var playoffLink = {
|
|
@@ -43138,7 +43175,7 @@ function generateCurtisConsolation(params) {
|
|
|
43138
43175
|
return __assign({ structures: structures, links: links }, SUCCESS);
|
|
43139
43176
|
}
|
|
43140
43177
|
function consolationFeedStructure(_a) {
|
|
43141
|
-
var _b = _a.stageSequence, stageSequence = _b === void 0 ? 1 : _b, structureNameMap = _a.structureNameMap, _c = _a.roundOffset, roundOffset = _c === void 0 ? 0 : _c, matchUpType = _a.matchUpType, structureId = _a.structureId, idPrefix = _a.idPrefix, drawSize = _a.drawSize, isMock = _a.isMock, index = _a.index, uuids = _a.uuids;
|
|
43178
|
+
var playoffStructureNameBase = _a.playoffStructureNameBase, _b = _a.stageSequence, stageSequence = _b === void 0 ? 1 : _b, structureNameMap = _a.structureNameMap, _c = _a.roundOffset, roundOffset = _c === void 0 ? 0 : _c, matchUpType = _a.matchUpType, structureId = _a.structureId, idPrefix = _a.idPrefix, drawSize = _a.drawSize, isMock = _a.isMock, index = _a.index, uuids = _a.uuids;
|
|
43142
43179
|
var consolationDrawPositions = drawSize / (2 * Math.pow(2, roundOffset));
|
|
43143
43180
|
var _d = feedInMatchUps({
|
|
43144
43181
|
finishingPositionOffset: consolationDrawPositions,
|
|
@@ -43150,8 +43187,11 @@ function consolationFeedStructure(_a) {
|
|
|
43150
43187
|
isMock: isMock,
|
|
43151
43188
|
uuids: uuids,
|
|
43152
43189
|
}), consolationMatchUps = _d.matchUps, consolationRoundsCount = _d.roundsCount;
|
|
43153
|
-
var defaultName = "".concat(CONSOLATION, " ").concat(index + 1);
|
|
43154
|
-
var
|
|
43190
|
+
var defaultName = "".concat(constantToString(CONSOLATION), " ").concat(index + 1);
|
|
43191
|
+
var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
|
|
43192
|
+
var structureName = playoffStructureNameBase
|
|
43193
|
+
? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
|
|
43194
|
+
: mappedStructureName;
|
|
43155
43195
|
var consolationStructure = structureTemplate({
|
|
43156
43196
|
matchUps: consolationMatchUps,
|
|
43157
43197
|
stage: CONSOLATION,
|
|
@@ -43163,23 +43203,7 @@ function consolationFeedStructure(_a) {
|
|
|
43163
43203
|
return { consolationStructure: consolationStructure, consolationRoundsCount: consolationRoundsCount };
|
|
43164
43204
|
}
|
|
43165
43205
|
|
|
43166
|
-
/**
|
|
43167
|
-
*
|
|
43168
|
-
* @param {object} playoffAttributes - mapping of exitProfile to structure names, e.g. 0-1-1 for SOUTH
|
|
43169
|
-
* @param {string} playoffStructureNameBase - Root word for default playoff naming, e.g. 'Playoff' for 'Playoff 3-4'
|
|
43170
|
-
* @param {string} exitProfile - rounds at which a participant exited each structure, e.g. 0-1-1-1 for losing EAST, WEST, SOUTH
|
|
43171
|
-
* @param {boolean} exitProfileLimit - limit playoff rounds generated by the attributes present in playoffAttributes
|
|
43172
|
-
* @param {number} finishingPositionOffset - amount by which to offset finishingPositions, e.g. 2 for playing off 3-4
|
|
43173
|
-
* @param {number} finishingPositionLimit - highest value of possible finishing Positions to play off
|
|
43174
|
-
* @param {object} finishingPositionNaming - map of { [finishingPositionRange]: customName }
|
|
43175
|
-
* @param {number} roundOffsetLimit - how many rounds to play off (# of additional matchUps per participant)
|
|
43176
|
-
* @param {number} roundOffset - used internally to track generated structures; saved in structure attributes;
|
|
43177
|
-
* @param {number} stageSequence - what sequence within stage structures, e.g. WEST is stageSequence 2 in COMPASS
|
|
43178
|
-
* @param {string} stage - [QUALIFYING, MAIN, CONSOLATION, PLAY-OFF]
|
|
43179
|
-
*
|
|
43180
|
-
*/
|
|
43181
43206
|
function generatePlayoffStructures(params) {
|
|
43182
|
-
var matchUpType = params.matchUpType;
|
|
43183
43207
|
var _a = params.finishingPositionOffset, finishingPositionOffset = _a === void 0 ? 0 : _a, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionNaming = params.finishingPositionNaming, finishingPositionLimit = params.finishingPositionLimit, playoffAttributes = params.playoffAttributes, _b = params.stageSequence, stageSequence = _b === void 0 ? 1 : _b, _c = params.exitProfile, exitProfile = _c === void 0 ? '0' : _c, exitProfileLimit = params.exitProfileLimit, roundOffsetLimit = params.roundOffsetLimit, _d = params.roundOffset, roundOffset = _d === void 0 ? 0 : _d, drawDefinition = params.drawDefinition, staggeredEntry = params.staggeredEntry, // not propagated to child structurs
|
|
43184
43208
|
sequenceLimit = params.sequenceLimit, _e = params.stage, stage = _e === void 0 ? MAIN : _e, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
43185
43209
|
var generateStructure = !playoffAttributes || !exitProfileLimit || (playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile]);
|
|
@@ -43190,7 +43214,7 @@ function generatePlayoffStructures(params) {
|
|
|
43190
43214
|
var allMatchUps = [];
|
|
43191
43215
|
var structures = [];
|
|
43192
43216
|
var links = [];
|
|
43193
|
-
matchUpType = matchUpType || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType);
|
|
43217
|
+
var matchUpType = params.matchUpType || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType);
|
|
43194
43218
|
var finishingPositionsFrom = finishingPositionOffset + 1;
|
|
43195
43219
|
var finishingPositionsTo = finishingPositionOffset + drawSize;
|
|
43196
43220
|
var finishingPositionRange = "".concat(finishingPositionsFrom, "-").concat(finishingPositionsTo);
|
|
@@ -43244,7 +43268,8 @@ function generatePlayoffStructures(params) {
|
|
|
43244
43268
|
if (playoffDrawPositions < 2)
|
|
43245
43269
|
return;
|
|
43246
43270
|
var childFinishingPositionOffset = drawSize / Math.pow(2, roundNumber) + finishingPositionOffset;
|
|
43247
|
-
if (
|
|
43271
|
+
if (finishingPositionLimit &&
|
|
43272
|
+
childFinishingPositionOffset + 1 > finishingPositionLimit)
|
|
43248
43273
|
return;
|
|
43249
43274
|
var _a = generatePlayoffStructures({
|
|
43250
43275
|
finishingPositionOffset: childFinishingPositionOffset,
|
|
@@ -43312,8 +43337,8 @@ function feedInChampionship(params) {
|
|
|
43312
43337
|
? feedInMatchUps(mainParams)
|
|
43313
43338
|
: treeMatchUps(mainParams)).matchUps;
|
|
43314
43339
|
var mainStructure = structureTemplate({
|
|
43340
|
+
structureName: structureName || constantToString(MAIN),
|
|
43315
43341
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43316
|
-
structureName: structureName || MAIN,
|
|
43317
43342
|
stageSequence: stageSequence,
|
|
43318
43343
|
matchUpType: matchUpType,
|
|
43319
43344
|
matchUps: matchUps,
|
|
@@ -43337,9 +43362,9 @@ function feedInChampionship(params) {
|
|
|
43337
43362
|
}), consolationMatchUps = _c.matchUps, roundsCount = _c.roundsCount;
|
|
43338
43363
|
if (drawSize > 2) {
|
|
43339
43364
|
var consolationStructure = structureTemplate({
|
|
43365
|
+
structureName: constantToString(CONSOLATION),
|
|
43340
43366
|
matchUps: consolationMatchUps,
|
|
43341
43367
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43342
|
-
structureName: CONSOLATION,
|
|
43343
43368
|
stage: CONSOLATION,
|
|
43344
43369
|
stageSequence: 1,
|
|
43345
43370
|
matchUpType: matchUpType,
|
|
@@ -43408,20 +43433,18 @@ function processPlayoffGroups(_a) {
|
|
|
43408
43433
|
if (positionsPlayedOff) {
|
|
43409
43434
|
finishingPositionOffset = Math.min.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)) - 1;
|
|
43410
43435
|
}
|
|
43411
|
-
var
|
|
43436
|
+
var playoffGroupParams = {
|
|
43437
|
+
addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
|
|
43438
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
43439
|
+
finishingPositionNaming: playoffGroup.finishingPositionNaming,
|
|
43440
|
+
finishingPositionLimit: playoffGroup.finishingPositionLimit,
|
|
43412
43441
|
structureId: (_c = playoffGroup.structureId) !== null && _c !== void 0 ? _c : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43442
|
+
playoffAttributes: playoffGroup.playoffAttributes,
|
|
43413
43443
|
structureNameMap: playoffGroup.structureNameMap,
|
|
43414
43444
|
structureName: playoffGroup.structureName,
|
|
43415
|
-
|
|
43416
|
-
appliedPolicies: policyDefinitions,
|
|
43417
|
-
finishingPositionOffset: finishingPositionOffset,
|
|
43418
|
-
stage: PLAY_OFF,
|
|
43419
|
-
stageSequence: stageSequence,
|
|
43420
|
-
matchUpType: matchUpType,
|
|
43421
|
-
drawSize: drawSize,
|
|
43422
|
-
isMock: isMock,
|
|
43423
|
-
uuids: uuids,
|
|
43445
|
+
sequenceLimit: playoffGroup.sequenceLimit,
|
|
43424
43446
|
};
|
|
43447
|
+
var params = __assign(__assign({}, playoffGroupParams), { idPrefix: idPrefix && "".concat(idPrefix, "-po"), appliedPolicies: policyDefinitions, finishingPositionOffset: finishingPositionOffset, stage: PLAY_OFF, stageSequence: stageSequence, matchUpType: matchUpType, drawSize: drawSize, isMock: isMock, uuids: uuids });
|
|
43425
43448
|
var updateStructureAndLinks = function (_a) {
|
|
43426
43449
|
var playoffStructures = _a.playoffStructures, playoffLinks = _a.playoffLinks;
|
|
43427
43450
|
var _b = __read(playoffStructures, 1), playoffStructure = _b[0];
|
|
@@ -43633,7 +43656,7 @@ function generatePlayoffLink(_a) {
|
|
|
43633
43656
|
// groups of finishing drawPositions which playoff
|
|
43634
43657
|
function generateRoundRobinWithPlayOff(params) {
|
|
43635
43658
|
var drawDefinition = params.drawDefinition, structureOptions = params.structureOptions, requireSequential = params.requireSequential;
|
|
43636
|
-
var mainDrawProperties = __assign(__assign({ structureName: MAIN }, params), { stage: MAIN }); // default structureName
|
|
43659
|
+
var mainDrawProperties = __assign(__assign({ structureName: constantToString(MAIN) }, params), { stage: MAIN }); // default structureName
|
|
43637
43660
|
var _a = generateRoundRobin(mainDrawProperties), structures = _a.structures, groupCount = _a.groupCount, groupSize = _a.groupSize;
|
|
43638
43661
|
// TODO: test for and handle this situation
|
|
43639
43662
|
if (groupCount < 1) {
|
|
@@ -43641,7 +43664,7 @@ function generateRoundRobinWithPlayOff(params) {
|
|
|
43641
43664
|
}
|
|
43642
43665
|
// define a default playoff group if none specified
|
|
43643
43666
|
var playoffGroups = (structureOptions === null || structureOptions === void 0 ? void 0 : structureOptions.playoffGroups) || [
|
|
43644
|
-
{ finishingPositions: [1], structureName: PLAY_OFF },
|
|
43667
|
+
{ finishingPositions: [1], structureName: constantToString(PLAY_OFF) },
|
|
43645
43668
|
];
|
|
43646
43669
|
var _b = __read(structures, 1), mainStructure = _b[0];
|
|
43647
43670
|
var _c = processPlayoffGroups(__assign({ sourceStructureId: mainStructure.structureId, requireSequential: requireSequential, drawDefinition: drawDefinition, playoffGroups: playoffGroups, groupCount: groupCount, groupSize: groupSize }, params)), playoffStructures = _c.structures, links = _c.links;
|
|
@@ -43759,7 +43782,7 @@ function generateDoubleElimination(_a) {
|
|
|
43759
43782
|
isMock: isMock,
|
|
43760
43783
|
}).matchUps;
|
|
43761
43784
|
var mainStructure = structureTemplate({
|
|
43762
|
-
structureName: structureName || MAIN,
|
|
43785
|
+
structureName: structureName || constantToString(MAIN),
|
|
43763
43786
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43764
43787
|
stageSequence: 1,
|
|
43765
43788
|
stage: MAIN,
|
|
@@ -43778,9 +43801,9 @@ function generateDoubleElimination(_a) {
|
|
|
43778
43801
|
uuids: uuids,
|
|
43779
43802
|
}).matchUps;
|
|
43780
43803
|
var consolationStructure = structureTemplate({
|
|
43804
|
+
structureName: constantToString(BACKDRAW),
|
|
43781
43805
|
matchUps: consolationMatchUps,
|
|
43782
43806
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43783
|
-
structureName: BACKDRAW,
|
|
43784
43807
|
stage: CONSOLATION,
|
|
43785
43808
|
stageSequence: 2,
|
|
43786
43809
|
matchUpType: matchUpType,
|
|
@@ -43793,9 +43816,9 @@ function generateDoubleElimination(_a) {
|
|
|
43793
43816
|
isMock: isMock,
|
|
43794
43817
|
}).matchUps;
|
|
43795
43818
|
var deciderStructure = structureTemplate({
|
|
43819
|
+
structureName: constantToString(DECIDER),
|
|
43796
43820
|
matchUps: deciderMatchUps,
|
|
43797
43821
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43798
|
-
structureName: DECIDER,
|
|
43799
43822
|
stageSequence: 3,
|
|
43800
43823
|
stage: PLAY_OFF,
|
|
43801
43824
|
matchUpType: matchUpType,
|
|
@@ -43910,11 +43933,12 @@ function getGenerators(params) {
|
|
|
43910
43933
|
params.skipRounds ||
|
|
43911
43934
|
(drawSize <= 4 && ((feedPolicy === null || feedPolicy === void 0 ? void 0 : feedPolicy.feedMainFinal) ? 0 : 1)) ||
|
|
43912
43935
|
0;
|
|
43936
|
+
var main = constantToString(MAIN);
|
|
43913
43937
|
var singleElimination = function () {
|
|
43914
43938
|
var matchUps = treeMatchUps(params).matchUps;
|
|
43915
43939
|
var structure = structureTemplate({
|
|
43916
|
-
structureName: structureName || MAIN,
|
|
43917
43940
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43941
|
+
structureName: structureName || main,
|
|
43918
43942
|
stageSequence: stageSequence,
|
|
43919
43943
|
matchUpType: matchUpType,
|
|
43920
43944
|
matchUps: matchUps,
|
|
@@ -43925,8 +43949,8 @@ function getGenerators(params) {
|
|
|
43925
43949
|
var generators = (_a = {},
|
|
43926
43950
|
_a[AD_HOC] = function () {
|
|
43927
43951
|
var structure = structureTemplate({
|
|
43928
|
-
structureName: structureName || MAIN,
|
|
43929
43952
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43953
|
+
structureName: structureName || main,
|
|
43930
43954
|
finishingPosition: WIN_RATIO,
|
|
43931
43955
|
stageSequence: stageSequence,
|
|
43932
43956
|
matchUps: [],
|
|
@@ -43938,8 +43962,8 @@ function getGenerators(params) {
|
|
|
43938
43962
|
_a[LUCKY_DRAW] = function () {
|
|
43939
43963
|
var matchUps = luckyDraw(params).matchUps;
|
|
43940
43964
|
var structure = structureTemplate({
|
|
43941
|
-
structureName: structureName || MAIN,
|
|
43942
43965
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43966
|
+
structureName: structureName || main,
|
|
43943
43967
|
stageSequence: stageSequence,
|
|
43944
43968
|
matchUpType: matchUpType,
|
|
43945
43969
|
matchUps: matchUps,
|
|
@@ -43961,8 +43985,8 @@ function getGenerators(params) {
|
|
|
43961
43985
|
_a[FEED_IN$1] = function () {
|
|
43962
43986
|
var matchUps = feedInMatchUps({ drawSize: drawSize, uuids: uuids, matchUpType: matchUpType }).matchUps;
|
|
43963
43987
|
var structure = structureTemplate({
|
|
43964
|
-
structureName: structureName || MAIN,
|
|
43965
43988
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43989
|
+
structureName: structureName || main,
|
|
43966
43990
|
stageSequence: stageSequence,
|
|
43967
43991
|
matchUpType: matchUpType,
|
|
43968
43992
|
stage: MAIN,
|
|
@@ -46695,7 +46719,7 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
46695
46719
|
if (availabilityResult.error) {
|
|
46696
46720
|
return decorateResult({ result: availabilityResult, stack: stack });
|
|
46697
46721
|
}
|
|
46698
|
-
var sourceStructureId = params.structureId, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, playoffAttributes = params.playoffAttributes, playoffPositions = params.playoffPositions, tournamentRecord = params.tournamentRecord, exitProfileLimit = params.exitProfileLimit, roundProfiles = params.roundProfiles, roundNumbers = params.roundNumbers, idPrefix = params.idPrefix, isMock = params.isMock, event = params.event, uuids = params.uuids;
|
|
46722
|
+
var sourceStructureId = params.structureId, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionNaming = params.finishingPositionNaming, finishingPositionLimit = params.finishingPositionLimit, playoffAttributes = params.playoffAttributes, playoffPositions = params.playoffPositions, roundOffsetLimit = params.roundOffsetLimit, tournamentRecord = params.tournamentRecord, exitProfileLimit = params.exitProfileLimit, roundProfiles = params.roundProfiles, roundNumbers = params.roundNumbers, idPrefix = params.idPrefix, isMock = params.isMock, event = params.event, uuids = params.uuids;
|
|
46699
46723
|
// The goal here is to return { structures, links } and not modify existing drawDefinition
|
|
46700
46724
|
// However, a copy of the drawDefinition needs to have the structures attached in order to
|
|
46701
46725
|
// populate the newly created structures with participants which should advance into them
|
|
@@ -46786,6 +46810,9 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
46786
46810
|
idPrefix: idPrefix,
|
|
46787
46811
|
isMock: isMock,
|
|
46788
46812
|
uuids: uuids,
|
|
46813
|
+
finishingPositionNaming: finishingPositionNaming,
|
|
46814
|
+
finishingPositionLimit: finishingPositionLimit,
|
|
46815
|
+
roundOffsetLimit: roundOffsetLimit,
|
|
46789
46816
|
});
|
|
46790
46817
|
if (result.error)
|
|
46791
46818
|
return { value: decorateResult({ result: result, stack: stack }) };
|
|
@@ -46970,8 +46997,8 @@ function addVoluntaryConsolationStage$1(_a) {
|
|
|
46970
46997
|
|
|
46971
46998
|
function generateVoluntaryConsolation$1(params) {
|
|
46972
46999
|
var _a, _b;
|
|
46973
|
-
var _c, _d, _e, _f, _g;
|
|
46974
|
-
var
|
|
47000
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
47001
|
+
var _k = params.drawType, drawType = _k === void 0 ? SINGLE_ELIMINATION : _k, _l = params.attachConsolation, attachConsolation = _l === void 0 ? true : _l, _m = params.applyPositioning, applyPositioning = _m === void 0 ? true : _m, tournamentRecord = params.tournamentRecord, staggeredEntry = params.staggeredEntry, // optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
|
|
46975
47002
|
automated = params.automated, placeByes = params.placeByes, isMock = params.isMock, event = params.event;
|
|
46976
47003
|
var drawDefinition = params === null || params === void 0 ? void 0 : params.drawDefinition;
|
|
46977
47004
|
if (!drawDefinition)
|
|
@@ -47004,8 +47031,8 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
47004
47031
|
if (result_1.error)
|
|
47005
47032
|
return result_1;
|
|
47006
47033
|
}
|
|
47007
|
-
tieFormat = copyTieFormat(tieFormat
|
|
47008
|
-
matchUpType = matchUpType
|
|
47034
|
+
tieFormat = copyTieFormat(tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_d = resolveTieFormat({ drawDefinition: drawDefinition })) === null || _d === void 0 ? void 0 : _d.tieFormat);
|
|
47035
|
+
matchUpType = (_e = matchUpType !== null && matchUpType !== void 0 ? matchUpType : drawDefinition.matchUpType) !== null && _e !== void 0 ? _e : TypeEnum.Singles;
|
|
47009
47036
|
var stageStructures = getDrawStructures({
|
|
47010
47037
|
stageSequence: 1,
|
|
47011
47038
|
drawDefinition: drawDefinition,
|
|
@@ -47014,13 +47041,13 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
47014
47041
|
// invalid to have more than one existing VOLUNTARY_CONSOLATION structure
|
|
47015
47042
|
var structureCount = stageStructures.length;
|
|
47016
47043
|
if (structureCount > 1)
|
|
47017
|
-
return { error:
|
|
47044
|
+
return { error: STAGE_SEQUENCE_LIMIT };
|
|
47018
47045
|
// invalid to already have matchUps generated for any existing structure
|
|
47019
|
-
if ((
|
|
47020
|
-
return { error:
|
|
47021
|
-
var structureId = (
|
|
47046
|
+
if ((_g = (_f = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _f === void 0 ? void 0 : _f.matchUps) === null || _g === void 0 ? void 0 : _g.length)
|
|
47047
|
+
return { error: EXISTING_STRUCTURE };
|
|
47048
|
+
var structureId = (_h = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _h === void 0 ? void 0 : _h.structureId;
|
|
47022
47049
|
Object.assign(params, definedAttributes({
|
|
47023
|
-
structureName: params.structureName
|
|
47050
|
+
structureName: (_j = params.structureName) !== null && _j !== void 0 ? _j : constantToString(VOLUNTARY_CONSOLATION),
|
|
47024
47051
|
structureId: structureId,
|
|
47025
47052
|
matchUpType: matchUpType,
|
|
47026
47053
|
tieFormat: tieFormat,
|
|
@@ -54998,6 +55025,105 @@ function modifyParticipantOtherName(_a) {
|
|
|
54998
55025
|
return __assign({}, SUCCESS);
|
|
54999
55026
|
}
|
|
55000
55027
|
|
|
55028
|
+
function formatPersonName(_a) {
|
|
55029
|
+
var _b, _c;
|
|
55030
|
+
var personFormat = _a.personFormat, person = _a.person;
|
|
55031
|
+
var alpha = function (str) { return str.replace(/\W/g, ''); };
|
|
55032
|
+
var allLowerCase = function (str) { return /^[a-z]*$/.test(alpha(str)); };
|
|
55033
|
+
var allUpperCase = function (str) { return /^[A-Z]*$/.test(alpha(str)); };
|
|
55034
|
+
var lastUpperCase = function (str) { return /^[LAST]{4}/.test(alpha(str)); };
|
|
55035
|
+
var lastFirst = function (str) {
|
|
55036
|
+
return str.toLowerCase().indexOf('l') < str.toLowerCase().indexOf('f');
|
|
55037
|
+
};
|
|
55038
|
+
var commaSeparated = function (str) { return str.indexOf(',') >= 0; };
|
|
55039
|
+
var firstInital = function (str) { return str.toLowerCase().indexOf('f.') >= 0; };
|
|
55040
|
+
var lastNameOnly = function (str) { return str.toLowerCase().indexOf('f') < 0; };
|
|
55041
|
+
var hasSpacing = function (str) { return str.indexOf(' ') > 0; };
|
|
55042
|
+
if (!person)
|
|
55043
|
+
return;
|
|
55044
|
+
var spacer = hasSpacing(personFormat) ? ' ' : '';
|
|
55045
|
+
var firstName = capitalizeFirst((_b = person === null || person === void 0 ? void 0 : person.standardGivenName) !== null && _b !== void 0 ? _b : '');
|
|
55046
|
+
var lastName = capitalizeFirst((_c = person === null || person === void 0 ? void 0 : person.standardFamilyName) !== null && _c !== void 0 ? _c : '');
|
|
55047
|
+
if (!personFormat)
|
|
55048
|
+
return "".concat(firstName).concat(spacer).concat(lastName);
|
|
55049
|
+
if (firstInital(personFormat) &&
|
|
55050
|
+
!commaSeparated(personFormat) &&
|
|
55051
|
+
!lastFirst(personFormat)) {
|
|
55052
|
+
firstName = "".concat(firstName[0], ".");
|
|
55053
|
+
}
|
|
55054
|
+
if (allLowerCase(personFormat)) {
|
|
55055
|
+
firstName = firstName.toLowerCase();
|
|
55056
|
+
lastName = lastName.toLowerCase();
|
|
55057
|
+
}
|
|
55058
|
+
else if (allUpperCase(personFormat)) {
|
|
55059
|
+
firstName = firstName.toUpperCase();
|
|
55060
|
+
lastName = lastName.toUpperCase();
|
|
55061
|
+
}
|
|
55062
|
+
else if (lastUpperCase(personFormat)) {
|
|
55063
|
+
lastName = lastName.toUpperCase();
|
|
55064
|
+
}
|
|
55065
|
+
var participantName = "".concat(firstName).concat(spacer).concat(lastName);
|
|
55066
|
+
if (lastNameOnly(personFormat)) {
|
|
55067
|
+
participantName = lastName;
|
|
55068
|
+
}
|
|
55069
|
+
else if (lastFirst(personFormat)) {
|
|
55070
|
+
if (commaSeparated(personFormat)) {
|
|
55071
|
+
participantName = "".concat(lastName, ",").concat(spacer).concat(firstName);
|
|
55072
|
+
}
|
|
55073
|
+
else {
|
|
55074
|
+
participantName = "".concat(lastName).concat(spacer).concat(firstName);
|
|
55075
|
+
}
|
|
55076
|
+
}
|
|
55077
|
+
return participantName;
|
|
55078
|
+
}
|
|
55079
|
+
|
|
55080
|
+
function formatParticipantName(_a) {
|
|
55081
|
+
var participantMap = _a.participantMap, participant = _a.participant, formats = _a.formats;
|
|
55082
|
+
var participantType = participant.participantType, individualParticipantIds = participant.individualParticipantIds, person = participant.person;
|
|
55083
|
+
var format = participantType && formats[participantType];
|
|
55084
|
+
if (participantType === TEAM_PARTICIPANT)
|
|
55085
|
+
return;
|
|
55086
|
+
if (format) {
|
|
55087
|
+
var personFormat_1 = format.personFormat, doublesJoiner = format.doublesJoiner;
|
|
55088
|
+
if (participantType === INDIVIDUAL) {
|
|
55089
|
+
participant.participantName = formatPersonName({ person: person, personFormat: personFormat_1 });
|
|
55090
|
+
}
|
|
55091
|
+
if (participantType === PAIR) {
|
|
55092
|
+
participant.participantName = individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.map(function (id) {
|
|
55093
|
+
var _a;
|
|
55094
|
+
var person = (_a = participantMap[id]) === null || _a === void 0 ? void 0 : _a.person;
|
|
55095
|
+
return formatPersonName({ person: person, personFormat: personFormat_1 });
|
|
55096
|
+
}).filter(Boolean).join(doublesJoiner !== null && doublesJoiner !== void 0 ? doublesJoiner : '/');
|
|
55097
|
+
}
|
|
55098
|
+
}
|
|
55099
|
+
}
|
|
55100
|
+
|
|
55101
|
+
function regenerateParticipantNames(_a) {
|
|
55102
|
+
var e_1, _b;
|
|
55103
|
+
var _c;
|
|
55104
|
+
var tournamentRecord = _a.tournamentRecord, formats = _a.formats;
|
|
55105
|
+
if (!tournamentRecord)
|
|
55106
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55107
|
+
if (!isObject(formats))
|
|
55108
|
+
return { error: MISSING_VALUE };
|
|
55109
|
+
var participants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
55110
|
+
var participantMap = createMap(participants, 'participantId');
|
|
55111
|
+
try {
|
|
55112
|
+
for (var participants_1 = __values(participants), participants_1_1 = participants_1.next(); !participants_1_1.done; participants_1_1 = participants_1.next()) {
|
|
55113
|
+
var participant = participants_1_1.value;
|
|
55114
|
+
formatParticipantName({ participant: participant, participantMap: participantMap, formats: formats });
|
|
55115
|
+
}
|
|
55116
|
+
}
|
|
55117
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
55118
|
+
finally {
|
|
55119
|
+
try {
|
|
55120
|
+
if (participants_1_1 && !participants_1_1.done && (_b = participants_1.return)) _b.call(participants_1);
|
|
55121
|
+
}
|
|
55122
|
+
finally { if (e_1) throw e_1.error; }
|
|
55123
|
+
}
|
|
55124
|
+
return __assign({}, SUCCESS);
|
|
55125
|
+
}
|
|
55126
|
+
|
|
55001
55127
|
function getTournamentPersons(_a) {
|
|
55002
55128
|
var tournamentRecord = _a.tournamentRecord, participantFilters = _a.participantFilters;
|
|
55003
55129
|
if (!tournamentRecord)
|
|
@@ -55490,6 +55616,7 @@ var participantGovernor = {
|
|
|
55490
55616
|
removeParticipantIdsFromAllTeams: removeParticipantIdsFromAllTeams,
|
|
55491
55617
|
getParticipantMembership: getParticipantMembership,
|
|
55492
55618
|
generateTeamsFromParticipantAttribute: generateTeamsFromParticipantAttribute,
|
|
55619
|
+
regenerateParticipantNames: regenerateParticipantNames,
|
|
55493
55620
|
getParticipantIdFinishingPositions: getParticipantIdFinishingPositions,
|
|
55494
55621
|
modifyParticipant: modifyParticipant,
|
|
55495
55622
|
modifyParticipantName: modifyParticipantName,
|
|
@@ -62897,7 +63024,7 @@ function generateDrawDefinition(params) {
|
|
|
62897
63024
|
}
|
|
62898
63025
|
else if (structureId && generateQualifyingPlaceholder) {
|
|
62899
63026
|
var qualifyingStructure = structureTemplate({
|
|
62900
|
-
structureName: QUALIFYING,
|
|
63027
|
+
structureName: constantToString(QUALIFYING),
|
|
62901
63028
|
stage: QUALIFYING,
|
|
62902
63029
|
});
|
|
62903
63030
|
var link = generateQualifyingLink({
|
|
@@ -65692,7 +65819,7 @@ function generatePersons(params) {
|
|
|
65692
65819
|
return false;
|
|
65693
65820
|
if (typeof person.lastName !== 'string')
|
|
65694
65821
|
return false;
|
|
65695
|
-
if (![MALE, FEMALE].includes(person.sex))
|
|
65822
|
+
if (person.sex && ![MALE, FEMALE].includes(person.sex))
|
|
65696
65823
|
return false;
|
|
65697
65824
|
if (person.nationalityCode &&
|
|
65698
65825
|
(typeof person.nationalityCode !== 'string' ||
|
|
@@ -65713,7 +65840,9 @@ function generatePersons(params) {
|
|
|
65713
65840
|
return { error: INVALID_VALUES };
|
|
65714
65841
|
}
|
|
65715
65842
|
}
|
|
65716
|
-
var shuffledPersons =
|
|
65843
|
+
var shuffledPersons = personData
|
|
65844
|
+
? validPersonData
|
|
65845
|
+
: shuffleArray(validPersonData);
|
|
65717
65846
|
if (shuffledPersons.length < count) {
|
|
65718
65847
|
var _c = defaultPersonData.reduce(function (a, person) {
|
|
65719
65848
|
var firstName = person.firstName, lastName = person.lastName, nationalityCode = person.nationalityCode;
|
|
@@ -68801,6 +68930,7 @@ var utilities = {
|
|
|
68801
68930
|
structureSort: structureSort,
|
|
68802
68931
|
matchUpSort: matchUpSort,
|
|
68803
68932
|
tidyScore: tidyScore,
|
|
68933
|
+
createMap: createMap,
|
|
68804
68934
|
generateScoreString: generateScoreString,
|
|
68805
68935
|
calculateWinCriteria: calculateWinCriteria,
|
|
68806
68936
|
compareTieFormats: compareTieFormats,
|