tods-competition-factory 1.7.7 → 1.7.8
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.mjs +139 -138
- 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 +1 -1
- package/dist/forge/utilities.mjs +126 -75
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +268 -167
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +372 -250
- 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 +3 -3
|
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
function factoryVersion() {
|
|
365
|
-
return '1.7.
|
|
365
|
+
return '1.7.8';
|
|
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);
|
|
@@ -28308,75 +28386,6 @@ function getEventPublishStatuses(_a) {
|
|
|
28308
28386
|
return undefined;
|
|
28309
28387
|
}
|
|
28310
28388
|
|
|
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
28389
|
function participantScaleItem(_a) {
|
|
28381
28390
|
var _b, _c;
|
|
28382
28391
|
var requireTimeStamp = _a.requireTimeStamp, scaleAttributes = _a.scaleAttributes, participant = _a.participant;
|
|
@@ -54998,6 +55007,116 @@ function modifyParticipantOtherName(_a) {
|
|
|
54998
55007
|
return __assign({}, SUCCESS);
|
|
54999
55008
|
}
|
|
55000
55009
|
|
|
55010
|
+
function formatPersonName(_a) {
|
|
55011
|
+
var _b, _c;
|
|
55012
|
+
var personFormat = _a.personFormat, person = _a.person;
|
|
55013
|
+
var alpha = function (str) { return str.replace(/\W/g, ''); };
|
|
55014
|
+
var allLowerCase = function (str) { return /^[a-z]*$/.test(alpha(str)); };
|
|
55015
|
+
var allUpperCase = function (str) { return /^[A-Z]*$/.test(alpha(str)); };
|
|
55016
|
+
var lastUpperCase = function (str) { return /^[LAST]{4}/.test(alpha(str)); };
|
|
55017
|
+
var lastFirst = function (str) {
|
|
55018
|
+
return str.toLowerCase().indexOf('l') < str.toLowerCase().indexOf('f');
|
|
55019
|
+
};
|
|
55020
|
+
var commaSeparated = function (str) { return str.indexOf(',') >= 0; };
|
|
55021
|
+
var firstInital = function (str) { return str.toLowerCase().indexOf('f.') >= 0; };
|
|
55022
|
+
var lastNameOnly = function (str) { return str.toLowerCase().indexOf('f') < 0; };
|
|
55023
|
+
var hasSpacing = function (str) { return str.indexOf(' ') > 0; };
|
|
55024
|
+
if (!person)
|
|
55025
|
+
return;
|
|
55026
|
+
var spacer = hasSpacing(personFormat) ? ' ' : '';
|
|
55027
|
+
var capitalizeFirst = function (str) {
|
|
55028
|
+
return str
|
|
55029
|
+
.split(' ')
|
|
55030
|
+
.map(function (name) {
|
|
55031
|
+
return name
|
|
55032
|
+
.split('')
|
|
55033
|
+
.map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
|
|
55034
|
+
.join('');
|
|
55035
|
+
})
|
|
55036
|
+
.join(' ');
|
|
55037
|
+
};
|
|
55038
|
+
var firstName = capitalizeFirst((_b = person === null || person === void 0 ? void 0 : person.standardGivenName) !== null && _b !== void 0 ? _b : '');
|
|
55039
|
+
var lastName = capitalizeFirst((_c = person === null || person === void 0 ? void 0 : person.standardFamilyName) !== null && _c !== void 0 ? _c : '');
|
|
55040
|
+
if (!personFormat)
|
|
55041
|
+
return "".concat(firstName).concat(spacer).concat(lastName);
|
|
55042
|
+
if (firstInital(personFormat) &&
|
|
55043
|
+
!commaSeparated(personFormat) &&
|
|
55044
|
+
!lastFirst(personFormat)) {
|
|
55045
|
+
firstName = "".concat(firstName[0], ".");
|
|
55046
|
+
}
|
|
55047
|
+
if (allLowerCase(personFormat)) {
|
|
55048
|
+
firstName = firstName.toLowerCase();
|
|
55049
|
+
lastName = lastName.toLowerCase();
|
|
55050
|
+
}
|
|
55051
|
+
else if (allUpperCase(personFormat)) {
|
|
55052
|
+
firstName = firstName.toUpperCase();
|
|
55053
|
+
lastName = lastName.toUpperCase();
|
|
55054
|
+
}
|
|
55055
|
+
else if (lastUpperCase(personFormat)) {
|
|
55056
|
+
lastName = lastName.toUpperCase();
|
|
55057
|
+
}
|
|
55058
|
+
var participantName = "".concat(firstName).concat(spacer).concat(lastName);
|
|
55059
|
+
if (lastNameOnly(personFormat)) {
|
|
55060
|
+
participantName = lastName;
|
|
55061
|
+
}
|
|
55062
|
+
else if (lastFirst(personFormat)) {
|
|
55063
|
+
if (commaSeparated(personFormat)) {
|
|
55064
|
+
participantName = "".concat(lastName, ",").concat(spacer).concat(firstName);
|
|
55065
|
+
}
|
|
55066
|
+
else {
|
|
55067
|
+
participantName = "".concat(lastName).concat(spacer).concat(firstName);
|
|
55068
|
+
}
|
|
55069
|
+
}
|
|
55070
|
+
return participantName;
|
|
55071
|
+
}
|
|
55072
|
+
|
|
55073
|
+
function formatParticipantName(_a) {
|
|
55074
|
+
var participantMap = _a.participantMap, participant = _a.participant, formats = _a.formats;
|
|
55075
|
+
var participantType = participant.participantType, individualParticipantIds = participant.individualParticipantIds, person = participant.person;
|
|
55076
|
+
var format = participantType && formats[participantType];
|
|
55077
|
+
if (participantType === TEAM_PARTICIPANT)
|
|
55078
|
+
return;
|
|
55079
|
+
if (format) {
|
|
55080
|
+
var personFormat_1 = format.personFormat, doublesJoiner = format.doublesJoiner;
|
|
55081
|
+
if (participantType === INDIVIDUAL) {
|
|
55082
|
+
participant.participantName = formatPersonName({ person: person, personFormat: personFormat_1 });
|
|
55083
|
+
}
|
|
55084
|
+
if (participantType === PAIR) {
|
|
55085
|
+
participant.participantName = individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.map(function (id) {
|
|
55086
|
+
var _a;
|
|
55087
|
+
var person = (_a = participantMap[id]) === null || _a === void 0 ? void 0 : _a.person;
|
|
55088
|
+
return formatPersonName({ person: person, personFormat: personFormat_1 });
|
|
55089
|
+
}).filter(Boolean).join(doublesJoiner !== null && doublesJoiner !== void 0 ? doublesJoiner : '/');
|
|
55090
|
+
}
|
|
55091
|
+
}
|
|
55092
|
+
}
|
|
55093
|
+
|
|
55094
|
+
function regenerateParticipantNames(_a) {
|
|
55095
|
+
var e_1, _b;
|
|
55096
|
+
var _c;
|
|
55097
|
+
var tournamentRecord = _a.tournamentRecord, formats = _a.formats;
|
|
55098
|
+
if (!tournamentRecord)
|
|
55099
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55100
|
+
if (!isObject(formats))
|
|
55101
|
+
return { error: MISSING_VALUE };
|
|
55102
|
+
var participants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
55103
|
+
var participantMap = createMap(participants, 'participantId');
|
|
55104
|
+
try {
|
|
55105
|
+
for (var participants_1 = __values(participants), participants_1_1 = participants_1.next(); !participants_1_1.done; participants_1_1 = participants_1.next()) {
|
|
55106
|
+
var participant = participants_1_1.value;
|
|
55107
|
+
formatParticipantName({ participant: participant, participantMap: participantMap, formats: formats });
|
|
55108
|
+
}
|
|
55109
|
+
}
|
|
55110
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
55111
|
+
finally {
|
|
55112
|
+
try {
|
|
55113
|
+
if (participants_1_1 && !participants_1_1.done && (_b = participants_1.return)) _b.call(participants_1);
|
|
55114
|
+
}
|
|
55115
|
+
finally { if (e_1) throw e_1.error; }
|
|
55116
|
+
}
|
|
55117
|
+
return __assign({}, SUCCESS);
|
|
55118
|
+
}
|
|
55119
|
+
|
|
55001
55120
|
function getTournamentPersons(_a) {
|
|
55002
55121
|
var tournamentRecord = _a.tournamentRecord, participantFilters = _a.participantFilters;
|
|
55003
55122
|
if (!tournamentRecord)
|
|
@@ -55490,6 +55609,7 @@ var participantGovernor = {
|
|
|
55490
55609
|
removeParticipantIdsFromAllTeams: removeParticipantIdsFromAllTeams,
|
|
55491
55610
|
getParticipantMembership: getParticipantMembership,
|
|
55492
55611
|
generateTeamsFromParticipantAttribute: generateTeamsFromParticipantAttribute,
|
|
55612
|
+
regenerateParticipantNames: regenerateParticipantNames,
|
|
55493
55613
|
getParticipantIdFinishingPositions: getParticipantIdFinishingPositions,
|
|
55494
55614
|
modifyParticipant: modifyParticipant,
|
|
55495
55615
|
modifyParticipantName: modifyParticipantName,
|
|
@@ -65692,7 +65812,7 @@ function generatePersons(params) {
|
|
|
65692
65812
|
return false;
|
|
65693
65813
|
if (typeof person.lastName !== 'string')
|
|
65694
65814
|
return false;
|
|
65695
|
-
if (![MALE, FEMALE].includes(person.sex))
|
|
65815
|
+
if (person.sex && ![MALE, FEMALE].includes(person.sex))
|
|
65696
65816
|
return false;
|
|
65697
65817
|
if (person.nationalityCode &&
|
|
65698
65818
|
(typeof person.nationalityCode !== 'string' ||
|
|
@@ -65713,7 +65833,9 @@ function generatePersons(params) {
|
|
|
65713
65833
|
return { error: INVALID_VALUES };
|
|
65714
65834
|
}
|
|
65715
65835
|
}
|
|
65716
|
-
var shuffledPersons =
|
|
65836
|
+
var shuffledPersons = personData
|
|
65837
|
+
? validPersonData
|
|
65838
|
+
: shuffleArray(validPersonData);
|
|
65717
65839
|
if (shuffledPersons.length < count) {
|
|
65718
65840
|
var _c = defaultPersonData.reduce(function (a, person) {
|
|
65719
65841
|
var firstName = person.firstName, lastName = person.lastName, nationalityCode = person.nationalityCode;
|