tods-competition-factory 1.8.3 → 1.8.4
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 +290 -26
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +12 -0
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +250 -4
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +175 -0
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +299 -133
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +333 -150
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
function factoryVersion() {
|
|
365
|
-
return '1.8.
|
|
365
|
+
return '1.8.4';
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/******************************************************************************
|
|
@@ -625,10 +625,6 @@ function resolveTieFormat(_a) {
|
|
|
625
625
|
};
|
|
626
626
|
}
|
|
627
627
|
|
|
628
|
-
function mustBeAnArray(value) {
|
|
629
|
-
return "".concat(value, " must be an array");
|
|
630
|
-
}
|
|
631
|
-
|
|
632
628
|
// returns only unique values within an array
|
|
633
629
|
function unique(arr) {
|
|
634
630
|
return arr.filter(function (item, i, s) { return s.lastIndexOf(item) === i; });
|
|
@@ -1446,10 +1442,18 @@ var INVALID_CONFIGURATION = {
|
|
|
1446
1442
|
message: 'Invalid configuration',
|
|
1447
1443
|
code: 'ERR_INVALID_CONFIG',
|
|
1448
1444
|
};
|
|
1445
|
+
var INVALID_COLLECTION_DEFINITION = {
|
|
1446
|
+
message: 'Invalid collectionDefinition',
|
|
1447
|
+
code: 'ERR_INVALID_COLLECTION_DEFINITION',
|
|
1448
|
+
};
|
|
1449
1449
|
var INVALID_OBJECT = {
|
|
1450
1450
|
message: 'Invalid object',
|
|
1451
1451
|
code: 'ERR_INVALID_OBJECT',
|
|
1452
1452
|
};
|
|
1453
|
+
var INVALID_CATEGORY = {
|
|
1454
|
+
message: 'Invalid category',
|
|
1455
|
+
code: 'ERR_INVALID_CATEGORY',
|
|
1456
|
+
};
|
|
1453
1457
|
var INVALID_VALUES = {
|
|
1454
1458
|
message: 'Invalid values',
|
|
1455
1459
|
code: 'ERR_INVALID_VALUES',
|
|
@@ -1550,6 +1554,8 @@ var errorConditionConstants = {
|
|
|
1550
1554
|
INVALID_ACTION: INVALID_ACTION,
|
|
1551
1555
|
INVALID_ASSIGNMENT: INVALID_ASSIGNMENT,
|
|
1552
1556
|
INVALID_BOOKINGS: INVALID_BOOKINGS,
|
|
1557
|
+
INVALID_CATEGORY: INVALID_CATEGORY,
|
|
1558
|
+
INVALID_COLLECTION_DEFINITION: INVALID_COLLECTION_DEFINITION,
|
|
1553
1559
|
INVALID_CONFIGURATION: INVALID_CONFIGURATION,
|
|
1554
1560
|
INVALID_DATE_AVAILABILITY: INVALID_DATE_AVAILABILITY,
|
|
1555
1561
|
INVALID_DATE: INVALID_DATE,
|
|
@@ -2004,6 +2010,9 @@ function setTournamentId(tournamentId) {
|
|
|
2004
2010
|
function removeTournamentRecord(tournamentId) {
|
|
2005
2011
|
return _globalStateProvider.removeTournamentRecord(tournamentId);
|
|
2006
2012
|
}
|
|
2013
|
+
function getProvider() {
|
|
2014
|
+
return _globalStateProvider;
|
|
2015
|
+
}
|
|
2007
2016
|
function handleCaughtError(_a) {
|
|
2008
2017
|
var engineName = _a.engineName, methodName = _a.methodName, params = _a.params, err = _a.err;
|
|
2009
2018
|
var caughtErrorHandler = (typeof _globalStateProvider.handleCaughtError === 'function' &&
|
|
@@ -2371,6 +2380,8 @@ iteration // escape hatch - check against iteration threshold
|
|
|
2371
2380
|
) {
|
|
2372
2381
|
var e_1, _a;
|
|
2373
2382
|
if (iteration === void 0) { iteration = 0; }
|
|
2383
|
+
if (getProvider().makeDeepCopy)
|
|
2384
|
+
return getProvider().makeDeepCopy(sourceObject, convertExtensions, internalUse, removeExtensions);
|
|
2374
2385
|
var deepCopy = deepCopyEnabled();
|
|
2375
2386
|
var _b = deepCopy || {}, stringify = _b.stringify, toJSON = _b.toJSON, ignore = _b.ignore, modulate = _b.modulate;
|
|
2376
2387
|
if ((!(deepCopy === null || deepCopy === void 0 ? void 0 : deepCopy.enabled) && !internalUse) ||
|
|
@@ -2626,6 +2637,203 @@ function generateHashCode(o) {
|
|
|
2626
2637
|
return [str.length, keyCount, charSum].map(function (e) { return e.toString(36); }).join('');
|
|
2627
2638
|
}
|
|
2628
2639
|
|
|
2640
|
+
var typeMatch = function (arr, type) {
|
|
2641
|
+
return arr.filter(Boolean).every(function (i) { return typeof i === type; });
|
|
2642
|
+
};
|
|
2643
|
+
var allNumeric = function (arr) { return arr.filter(Boolean).every(isNumeric); };
|
|
2644
|
+
function getCategoryAgeDetails(params) {
|
|
2645
|
+
var _a, _b;
|
|
2646
|
+
var category = params.category;
|
|
2647
|
+
if (typeof category !== 'object')
|
|
2648
|
+
return { error: INVALID_CATEGORY };
|
|
2649
|
+
var ageCategoryCode = category.ageCategoryCode, ageMaxDate = category.ageMaxDate, ageMinDate = category.ageMinDate, ageMax = category.ageMax, ageMin = category.ageMin;
|
|
2650
|
+
var categoryName = category.categoryName;
|
|
2651
|
+
var combinedAge;
|
|
2652
|
+
if (!typeMatch([ageCategoryCode, ageMaxDate, ageMinDate, categoryName], 'string') ||
|
|
2653
|
+
!allNumeric([ageMax, ageMin] ||
|
|
2654
|
+
![ageMaxDate, ageMinDate].filter(Boolean).every(isValidDateString)))
|
|
2655
|
+
return { error: INVALID_CATEGORY };
|
|
2656
|
+
var consideredDate = (_a = params.consideredDate) !== null && _a !== void 0 ? _a : extractDate(new Date().toLocaleDateString('sv'));
|
|
2657
|
+
if (!isValidDateString(consideredDate))
|
|
2658
|
+
return { error: INVALID_DATE };
|
|
2659
|
+
// const [consideredYear, month, day] = consideredDate
|
|
2660
|
+
var _c = __read(consideredDate
|
|
2661
|
+
.split('-')
|
|
2662
|
+
.slice(0, 3)
|
|
2663
|
+
.map(function (n) { return parseInt(n); }), 1), consideredYear = _c[0];
|
|
2664
|
+
// const monthDay = `${zeroPad(month)}-${zeroPad(day)}`;
|
|
2665
|
+
var previousDayDate = dateStringDaysChange(consideredDate, -1);
|
|
2666
|
+
var _d = __read(previousDayDate
|
|
2667
|
+
.split('-')
|
|
2668
|
+
.slice(1, 3)
|
|
2669
|
+
.map(function (n) { return parseInt(n); }), 2), previousDayMonth = _d[0], previousDay = _d[1];
|
|
2670
|
+
var previousMonthDay = "".concat(zeroPad(previousDayMonth), "-").concat(zeroPad(previousDay));
|
|
2671
|
+
var nextDayDate = dateStringDaysChange(consideredDate, 1);
|
|
2672
|
+
var _e = __read(nextDayDate
|
|
2673
|
+
.split('-')
|
|
2674
|
+
.slice(1, 3)
|
|
2675
|
+
.map(function (n) { return parseInt(n); }), 2), nextDayMonth = _e[0], nextDay = _e[1];
|
|
2676
|
+
var nextMonthDay = "".concat(zeroPad(nextDayMonth), "-").concat(zeroPad(nextDay));
|
|
2677
|
+
var calculatedAgeMaxDate = ageMin && dateStringDaysChange(consideredDate, -1 * 365 * ageMin);
|
|
2678
|
+
var calculatedAgeMinDate = ageMax && dateStringDaysChange(consideredDate, -1 * 365 * ageMax);
|
|
2679
|
+
// collect errors; e.g. provided ageMin does not equal calculated ageMin
|
|
2680
|
+
var errors = [];
|
|
2681
|
+
var addError = function (errorString) {
|
|
2682
|
+
return !errors.includes(errorString) && errors.push(errorString);
|
|
2683
|
+
};
|
|
2684
|
+
ageCategoryCode = ageCategoryCode !== null && ageCategoryCode !== void 0 ? ageCategoryCode : categoryName;
|
|
2685
|
+
var prePost = /^([UO]?)(\d{1,2})([UO]?)$/;
|
|
2686
|
+
var extractCombined = /^C(\d{1,2})-(\d{1,2})$/;
|
|
2687
|
+
var isBetween = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.includes('-');
|
|
2688
|
+
var isCombined = isBetween && (ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(extractCombined));
|
|
2689
|
+
var isCoded = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(prePost);
|
|
2690
|
+
// construct min or max date with or without year
|
|
2691
|
+
//const isYYMM = (datePart) => datePart.match(/^\d{2}-\d{2}$/);
|
|
2692
|
+
var constructedDate = function (y, df) { return "".concat(y, "-").concat(df); };
|
|
2693
|
+
var uPre = function (ageInt) {
|
|
2694
|
+
var ageMinYear = consideredYear - ageInt;
|
|
2695
|
+
var newMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2696
|
+
if (category.ageMinDate && category.ageMinDate !== newMinDate)
|
|
2697
|
+
addError("Invalid submitted ageMinDate: ".concat(ageMinDate));
|
|
2698
|
+
ageMinDate = newMinDate;
|
|
2699
|
+
if (ageCategoryCode) {
|
|
2700
|
+
if (category.ageMax && category.ageMax !== ageInt - 1) {
|
|
2701
|
+
addError("Invalid submitted ageMax: ".concat(ageMax));
|
|
2702
|
+
calculatedAgeMinDate = undefined;
|
|
2703
|
+
}
|
|
2704
|
+
ageMax = ageInt - 1;
|
|
2705
|
+
}
|
|
2706
|
+
};
|
|
2707
|
+
var uPost = function (ageInt) {
|
|
2708
|
+
var ageMinYear = consideredYear - ageInt - 1;
|
|
2709
|
+
var newMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2710
|
+
if (category.ageMin && category.ageMin > ageInt) {
|
|
2711
|
+
addError("Invalid submitted ageMin: ".concat(ageMin));
|
|
2712
|
+
}
|
|
2713
|
+
if (category.ageMax && category.ageMax > ageInt) {
|
|
2714
|
+
addError("Invalid submitted ageMax: ".concat(ageMax));
|
|
2715
|
+
}
|
|
2716
|
+
if (category.ageMinDate && category.ageMinDate !== newMinDate)
|
|
2717
|
+
addError("Invalid submitted ageMinDate: ".concat(ageMinDate));
|
|
2718
|
+
ageMinDate = newMinDate;
|
|
2719
|
+
if (ageCategoryCode) {
|
|
2720
|
+
if (category.ageMax && category.ageMax !== ageInt) {
|
|
2721
|
+
addError("Invalid submitted ageMax: ".concat(ageMax));
|
|
2722
|
+
calculatedAgeMaxDate = undefined;
|
|
2723
|
+
}
|
|
2724
|
+
ageMax = ageInt;
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2727
|
+
var oPre = function (ageInt) {
|
|
2728
|
+
var ageMaxYear = consideredYear - ageInt;
|
|
2729
|
+
var newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2730
|
+
if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
|
|
2731
|
+
addError("Invalid submitted ageMaxDate: ".concat(ageMaxDate));
|
|
2732
|
+
ageMaxDate = newMaxDate;
|
|
2733
|
+
if (ageCategoryCode) {
|
|
2734
|
+
if (category.ageMin && category.ageMin !== ageInt + 1) {
|
|
2735
|
+
addError("Invalid submitted ageMin: ".concat(ageMin));
|
|
2736
|
+
calculatedAgeMaxDate = undefined;
|
|
2737
|
+
}
|
|
2738
|
+
ageMin = ageInt + 1;
|
|
2739
|
+
}
|
|
2740
|
+
};
|
|
2741
|
+
var oPost = function (ageInt) {
|
|
2742
|
+
var ageMaxYear = consideredYear - ageInt - 1;
|
|
2743
|
+
var newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2744
|
+
if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
|
|
2745
|
+
addError("Invalid submitted ageMaxDate: ".concat(ageMaxDate));
|
|
2746
|
+
ageMaxDate = newMaxDate;
|
|
2747
|
+
if (ageCategoryCode) {
|
|
2748
|
+
if (category.ageMin && category.ageMin !== ageInt) {
|
|
2749
|
+
addError("Invalid submitted ageMin: ".concat(ageMin));
|
|
2750
|
+
calculatedAgeMaxDate = undefined;
|
|
2751
|
+
}
|
|
2752
|
+
ageMin = ageInt;
|
|
2753
|
+
}
|
|
2754
|
+
};
|
|
2755
|
+
var processCode = function (code) {
|
|
2756
|
+
var _a = __read((code.match(prePost) || []).slice(1), 3), pre = _a[0], age = _a[1], post = _a[2];
|
|
2757
|
+
var ageInt = parseInt(age);
|
|
2758
|
+
if (pre === 'U') {
|
|
2759
|
+
if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
|
|
2760
|
+
addError("Invalid submitted ageMaxDate: ".concat(category.ageMaxDate));
|
|
2761
|
+
}
|
|
2762
|
+
uPre(ageInt);
|
|
2763
|
+
}
|
|
2764
|
+
else if (pre === 'O') {
|
|
2765
|
+
oPre(ageInt);
|
|
2766
|
+
}
|
|
2767
|
+
if (post === 'U') {
|
|
2768
|
+
if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
|
|
2769
|
+
addError("Invalid submitted ageMaxDate: ".concat(category.ageMaxDate));
|
|
2770
|
+
}
|
|
2771
|
+
uPost(ageInt);
|
|
2772
|
+
}
|
|
2773
|
+
else if (post === 'O') {
|
|
2774
|
+
oPost(ageInt);
|
|
2775
|
+
}
|
|
2776
|
+
ageMaxDate = ageMaxDate !== null && ageMaxDate !== void 0 ? ageMaxDate : calculatedAgeMaxDate;
|
|
2777
|
+
ageMinDate = ageMinDate !== null && ageMinDate !== void 0 ? ageMinDate : calculatedAgeMinDate;
|
|
2778
|
+
};
|
|
2779
|
+
if (isCombined) {
|
|
2780
|
+
// min and max birthdates are not relevant
|
|
2781
|
+
// TODO: utility function to calculate combined age given two birthdates?
|
|
2782
|
+
ageMaxDate = undefined;
|
|
2783
|
+
ageMinDate = undefined;
|
|
2784
|
+
ageMax = undefined;
|
|
2785
|
+
ageMin = undefined;
|
|
2786
|
+
if (category.ageMin) {
|
|
2787
|
+
// calculate ageMaxDate
|
|
2788
|
+
var ageMaxYear = consideredYear - category.ageMin;
|
|
2789
|
+
ageMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2790
|
+
}
|
|
2791
|
+
if (category.ageMax) {
|
|
2792
|
+
// calculate ageMinDate
|
|
2793
|
+
var ageMinYear = consideredYear - category.ageMax - 1;
|
|
2794
|
+
ageMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2795
|
+
}
|
|
2796
|
+
var _f = __read(((_b = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(extractCombined)) !== null && _b !== void 0 ? _b : [])
|
|
2797
|
+
.slice(1)
|
|
2798
|
+
.map(function (n) { return parseInt(n); }), 2), lowAge = _f[0], highAge = _f[1];
|
|
2799
|
+
if (lowAge <= highAge) {
|
|
2800
|
+
ageMin = lowAge;
|
|
2801
|
+
ageMax = highAge;
|
|
2802
|
+
combinedAge = true;
|
|
2803
|
+
}
|
|
2804
|
+
else {
|
|
2805
|
+
addError("Invalid combined age range ".concat(ageCategoryCode));
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
else if (isBetween) {
|
|
2809
|
+
ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.split('-').forEach(processCode);
|
|
2810
|
+
}
|
|
2811
|
+
else if (isCoded) {
|
|
2812
|
+
processCode(ageCategoryCode);
|
|
2813
|
+
}
|
|
2814
|
+
else {
|
|
2815
|
+
if (ageMin)
|
|
2816
|
+
oPre(ageMin);
|
|
2817
|
+
if (ageMax)
|
|
2818
|
+
uPost(ageMax);
|
|
2819
|
+
}
|
|
2820
|
+
if (ageMax && category.ageMin && category.ageMin > ageMax) {
|
|
2821
|
+
addError("Invalid submitted ageMin: ".concat(category.ageMin));
|
|
2822
|
+
ageMin = undefined;
|
|
2823
|
+
}
|
|
2824
|
+
var result = definedAttributes({
|
|
2825
|
+
consideredDate: consideredDate,
|
|
2826
|
+
combinedAge: combinedAge,
|
|
2827
|
+
ageMaxDate: ageMaxDate,
|
|
2828
|
+
ageMinDate: ageMinDate,
|
|
2829
|
+
ageMax: ageMax,
|
|
2830
|
+
ageMin: ageMin,
|
|
2831
|
+
});
|
|
2832
|
+
if (errors.length)
|
|
2833
|
+
result.errors = errors;
|
|
2834
|
+
return result;
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2629
2837
|
// NOTE: type really does need to be any!
|
|
2630
2838
|
function attributeFilter(params) {
|
|
2631
2839
|
if (params === null)
|
|
@@ -2941,6 +3149,52 @@ function UUID() {
|
|
|
2941
3149
|
lut[(d3 >> 24) & 0xff]);
|
|
2942
3150
|
}
|
|
2943
3151
|
|
|
3152
|
+
function categoryCanContain(_a) {
|
|
3153
|
+
var childCategory = _a.childCategory, withDetails = _a.withDetails, category = _a.category;
|
|
3154
|
+
var categoryDetails = getCategoryAgeDetails({ category: category });
|
|
3155
|
+
var childCategoryDetails = getCategoryAgeDetails({
|
|
3156
|
+
category: childCategory,
|
|
3157
|
+
});
|
|
3158
|
+
var invalidAgeMin = childCategoryDetails.ageMin &&
|
|
3159
|
+
((categoryDetails.ageMin &&
|
|
3160
|
+
childCategoryDetails.ageMin < categoryDetails.ageMin) ||
|
|
3161
|
+
(categoryDetails.ageMax &&
|
|
3162
|
+
childCategoryDetails.ageMin > categoryDetails.ageMax));
|
|
3163
|
+
var invalidAgeMax = childCategoryDetails.ageMax &&
|
|
3164
|
+
((categoryDetails.ageMax &&
|
|
3165
|
+
childCategoryDetails.ageMax > categoryDetails.ageMax) ||
|
|
3166
|
+
(categoryDetails.ageMin &&
|
|
3167
|
+
childCategoryDetails.ageMax < categoryDetails.ageMin));
|
|
3168
|
+
var invalidAgeMinDate = childCategoryDetails.ageMinDate &&
|
|
3169
|
+
categoryDetails.ageMaxDate &&
|
|
3170
|
+
new Date(childCategoryDetails.ageMinDate) >
|
|
3171
|
+
new Date(categoryDetails.ageMaxDate);
|
|
3172
|
+
var invalidAgeMaxDate = childCategoryDetails.ageMaxDate &&
|
|
3173
|
+
categoryDetails.ageMinDate &&
|
|
3174
|
+
new Date(childCategoryDetails.ageMaxDate) <
|
|
3175
|
+
new Date(categoryDetails.ageMinDate);
|
|
3176
|
+
var valid = !invalidAgeMax &&
|
|
3177
|
+
!invalidAgeMin &&
|
|
3178
|
+
!invalidAgeMinDate &&
|
|
3179
|
+
!invalidAgeMaxDate;
|
|
3180
|
+
var ignoreFalse = true;
|
|
3181
|
+
var result = definedAttributes({
|
|
3182
|
+
valid: valid,
|
|
3183
|
+
invalidAgeMax: invalidAgeMax,
|
|
3184
|
+
invalidAgeMin: invalidAgeMin,
|
|
3185
|
+
invalidAgeMinDate: invalidAgeMinDate,
|
|
3186
|
+
invalidAgeMaxDate: invalidAgeMaxDate,
|
|
3187
|
+
}, ignoreFalse);
|
|
3188
|
+
if (withDetails) {
|
|
3189
|
+
Object.assign(result, { categoryDetails: categoryDetails, childCategoryDetails: childCategoryDetails });
|
|
3190
|
+
}
|
|
3191
|
+
return result;
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
|
+
function mustBeAnArray(value) {
|
|
3195
|
+
return "".concat(value, " must be an array");
|
|
3196
|
+
}
|
|
3197
|
+
|
|
2944
3198
|
function decorateResult(_a) {
|
|
2945
3199
|
var context = _a.context, result = _a.result, stack = _a.stack, info = _a.info;
|
|
2946
3200
|
if (result && !Array.isArray(result === null || result === void 0 ? void 0 : result.stack))
|
|
@@ -3522,6 +3776,7 @@ var SexEnum;
|
|
|
3522
3776
|
|
|
3523
3777
|
function validateTieFormat(params) {
|
|
3524
3778
|
var _a, _b, _c, _d;
|
|
3779
|
+
var checkCategory = !!((params === null || params === void 0 ? void 0 : params.enforceCategory) !== false && (params === null || params === void 0 ? void 0 : params.category));
|
|
3525
3780
|
var checkGender = !!((params === null || params === void 0 ? void 0 : params.enforceGender) !== false && (params === null || params === void 0 ? void 0 : params.gender));
|
|
3526
3781
|
var checkCollectionIds = params === null || params === void 0 ? void 0 : params.checkCollectionIds;
|
|
3527
3782
|
var tieFormat = params === null || params === void 0 ? void 0 : params.tieFormat;
|
|
@@ -3557,9 +3812,11 @@ function validateTieFormat(params) {
|
|
|
3557
3812
|
if ((setValue || scoreValue) && !collectionValue)
|
|
3558
3813
|
aggregateValueImperative = true;
|
|
3559
3814
|
var _a = validateCollectionDefinition({
|
|
3815
|
+
referenceCategory: params.category,
|
|
3560
3816
|
referenceGender: params.gender,
|
|
3561
3817
|
collectionDefinition: collectionDefinition,
|
|
3562
3818
|
checkCollectionIds: checkCollectionIds,
|
|
3819
|
+
checkCategory: checkCategory,
|
|
3563
3820
|
checkGender: checkGender,
|
|
3564
3821
|
}), valid = _a.valid, collectionDefinitionErrors = _a.errors;
|
|
3565
3822
|
if (valid) {
|
|
@@ -3605,14 +3862,15 @@ function validateTieFormat(params) {
|
|
|
3605
3862
|
return result;
|
|
3606
3863
|
}
|
|
3607
3864
|
function validateCollectionDefinition(_a) {
|
|
3608
|
-
var collectionDefinition = _a.collectionDefinition, checkCollectionIds = _a.checkCollectionIds,
|
|
3865
|
+
var _b = _a.checkCategory, checkCategory = _b === void 0 ? true : _b, collectionDefinition = _a.collectionDefinition, checkCollectionIds = _a.checkCollectionIds, _c = _a.checkGender, checkGender = _c === void 0 ? true : _c, referenceCategory = _a.referenceCategory, referenceGender = _a.referenceGender, event = _a.event;
|
|
3609
3866
|
referenceGender = referenceGender !== null && referenceGender !== void 0 ? referenceGender : event === null || event === void 0 ? void 0 : event.gender;
|
|
3867
|
+
var stack = 'validateCollectionDefinition';
|
|
3610
3868
|
var errors = [];
|
|
3611
3869
|
if (typeof collectionDefinition !== 'object') {
|
|
3612
3870
|
errors.push("collectionDefinition must be an object: ".concat(collectionDefinition));
|
|
3613
|
-
return { errors: errors, error: INVALID_OBJECT };
|
|
3871
|
+
return decorateResult({ result: { errors: errors, error: INVALID_OBJECT }, stack: stack });
|
|
3614
3872
|
}
|
|
3615
|
-
var collectionValueProfiles = collectionDefinition.collectionValueProfiles, collectionGroupNumber = collectionDefinition.collectionGroupNumber, collectionValue = collectionDefinition.collectionValue, collectionId = collectionDefinition.collectionId, matchUpCount = collectionDefinition.matchUpCount, matchUpFormat = collectionDefinition.matchUpFormat, matchUpValue = collectionDefinition.matchUpValue, matchUpType = collectionDefinition.matchUpType, scoreValue = collectionDefinition.scoreValue, setValue = collectionDefinition.setValue, gender = collectionDefinition.gender;
|
|
3873
|
+
var collectionValueProfiles = collectionDefinition.collectionValueProfiles, collectionGroupNumber = collectionDefinition.collectionGroupNumber, collectionValue = collectionDefinition.collectionValue, collectionId = collectionDefinition.collectionId, matchUpCount = collectionDefinition.matchUpCount, matchUpFormat = collectionDefinition.matchUpFormat, matchUpValue = collectionDefinition.matchUpValue, matchUpType = collectionDefinition.matchUpType, scoreValue = collectionDefinition.scoreValue, setValue = collectionDefinition.setValue, category = collectionDefinition.category, gender = collectionDefinition.gender;
|
|
3616
3874
|
if (checkCollectionIds && typeof collectionId !== 'string') {
|
|
3617
3875
|
errors.push("collectionId is not type string: ".concat(collectionId));
|
|
3618
3876
|
}
|
|
@@ -3657,8 +3915,23 @@ function validateCollectionDefinition(_a) {
|
|
|
3657
3915
|
referenceGender !== gender) {
|
|
3658
3916
|
errors.push("Invalid gender: ".concat(gender));
|
|
3659
3917
|
}
|
|
3918
|
+
if (checkCategory && referenceCategory && category) {
|
|
3919
|
+
var result = categoryCanContain({
|
|
3920
|
+
category: referenceCategory,
|
|
3921
|
+
childCategory: category,
|
|
3922
|
+
});
|
|
3923
|
+
if (!result.valid)
|
|
3924
|
+
return decorateResult({
|
|
3925
|
+
result: { error: INVALID_CATEGORY },
|
|
3926
|
+
context: result,
|
|
3927
|
+
stack: stack,
|
|
3928
|
+
});
|
|
3929
|
+
}
|
|
3660
3930
|
if (errors.length)
|
|
3661
|
-
return {
|
|
3931
|
+
return decorateResult({
|
|
3932
|
+
result: { errors: errors, error: INVALID_COLLECTION_DEFINITION },
|
|
3933
|
+
stack: stack,
|
|
3934
|
+
});
|
|
3662
3935
|
return { valid: true };
|
|
3663
3936
|
}
|
|
3664
3937
|
// add collectionIds if missing
|
|
@@ -19123,117 +19396,6 @@ var garman = {
|
|
|
19123
19396
|
courtGenerator: courtGenerator,
|
|
19124
19397
|
};
|
|
19125
19398
|
|
|
19126
|
-
var typeMatch = function (arr, type) {
|
|
19127
|
-
return arr.filter(Boolean).every(function (i) { return typeof i === type; });
|
|
19128
|
-
};
|
|
19129
|
-
var allNumeric = function (arr) { return arr.filter(Boolean).every(isNumeric); };
|
|
19130
|
-
function parseAgeCategoryCode(_a) {
|
|
19131
|
-
var _b;
|
|
19132
|
-
var _c = _a === void 0 ? { consideredDate: '' } : _a, consideredDate = _c.consideredDate, category = _c.category;
|
|
19133
|
-
var invalid = { error: INVALID_VALUES, ageMin: 8, ageMax: 99 };
|
|
19134
|
-
if (typeof category !== 'object' || !isValidDateString(consideredDate))
|
|
19135
|
-
return invalid;
|
|
19136
|
-
var consideredYear = parseInt(consideredDate.split('-')[0]);
|
|
19137
|
-
// collect errors; e.g. provided ageMin does not equal calculated ageMin
|
|
19138
|
-
var errors = [];
|
|
19139
|
-
var ageCategoryCode = category.ageCategoryCode, ageMaxDate = category.ageMaxDate, ageMinDate = category.ageMinDate, ageMax = category.ageMax, ageMin = category.ageMin;
|
|
19140
|
-
var categoryName = category.categoryName;
|
|
19141
|
-
var combinedAge;
|
|
19142
|
-
if (!typeMatch([ageCategoryCode, ageMaxDate, ageMinDate, categoryName], 'string') ||
|
|
19143
|
-
!allNumeric([ageMax, ageMin]))
|
|
19144
|
-
return invalid;
|
|
19145
|
-
ageCategoryCode = ageCategoryCode !== null && ageCategoryCode !== void 0 ? ageCategoryCode : categoryName;
|
|
19146
|
-
var prePost = /^([UO]?)(\d{1,2})([UO]?)$/;
|
|
19147
|
-
var extractCombined = /^C(\d{1,2})-(\d{1,2})$/;
|
|
19148
|
-
var isBetween = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.includes('-');
|
|
19149
|
-
var isCombined = isBetween && (ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(extractCombined));
|
|
19150
|
-
var isCoded = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(prePost);
|
|
19151
|
-
// construct min or max date with or without year
|
|
19152
|
-
var isYYMM = function (datePart) { return datePart.match(/^\d{2}-\d{2}$/); };
|
|
19153
|
-
var constructedDate = function (y, d, df) {
|
|
19154
|
-
return (isValidDateString(d) && d) ||
|
|
19155
|
-
(d && isYYMM(d) && "".concat(y, "-").concat(d)) ||
|
|
19156
|
-
"".concat(y, "-").concat(df);
|
|
19157
|
-
};
|
|
19158
|
-
var uPre = function (ageInt) {
|
|
19159
|
-
var ageMinYear = consideredYear - ageInt;
|
|
19160
|
-
ageMinDate = constructedDate(ageMinYear, ageMinDate, '01-01');
|
|
19161
|
-
if (ageMax && ageMax !== ageInt - 1)
|
|
19162
|
-
errors.push("Invalid ageMax: ".concat(ageMax));
|
|
19163
|
-
if (!ageMax)
|
|
19164
|
-
ageMax = ageInt - 1;
|
|
19165
|
-
return { ageMinDate: ageMinDate, ageMax: ageMax };
|
|
19166
|
-
};
|
|
19167
|
-
var uPost = function (ageInt) {
|
|
19168
|
-
var ageMinYear = consideredYear - ageInt - 1;
|
|
19169
|
-
ageMinDate = constructedDate(ageMinYear, ageMinDate, '01-01');
|
|
19170
|
-
if (ageMax && ageMax !== ageInt)
|
|
19171
|
-
errors.push("Invalid ageMax: ".concat(ageMax));
|
|
19172
|
-
if (!ageMax)
|
|
19173
|
-
ageMax = ageInt;
|
|
19174
|
-
return { ageMinDate: ageMinDate, ageMax: ageMax };
|
|
19175
|
-
};
|
|
19176
|
-
var oPre = function (ageInt) {
|
|
19177
|
-
var ageMaxYear = consideredYear - ageInt - 2;
|
|
19178
|
-
ageMaxDate = constructedDate(ageMaxYear, ageMaxDate, '12-31');
|
|
19179
|
-
if (ageMin && ageMin !== ageInt + 1)
|
|
19180
|
-
errors.push("Invalid ageMin: ".concat(ageMin));
|
|
19181
|
-
if (!ageMin)
|
|
19182
|
-
ageMin = ageInt + 1;
|
|
19183
|
-
return { ageMaxDate: ageMaxDate, ageMin: ageMin };
|
|
19184
|
-
};
|
|
19185
|
-
var oPost = function (ageInt) {
|
|
19186
|
-
var ageMaxYear = consideredYear - ageInt - 1;
|
|
19187
|
-
ageMaxDate = constructedDate(ageMaxYear, ageMaxDate, '12-31');
|
|
19188
|
-
if (ageMin && ageMin !== ageInt)
|
|
19189
|
-
errors.push("Invalid ageMin: ".concat(ageMin));
|
|
19190
|
-
if (!ageMin)
|
|
19191
|
-
ageMin = ageInt;
|
|
19192
|
-
return { ageMaxDate: ageMaxDate, ageMin: ageMin };
|
|
19193
|
-
};
|
|
19194
|
-
var processCode = function (code) {
|
|
19195
|
-
var _a, _b, _c, _d;
|
|
19196
|
-
var _e = __read((code.match(prePost) || []).slice(1), 3), pre = _e[0], age = _e[1], post = _e[2];
|
|
19197
|
-
var ageInt = parseInt(age);
|
|
19198
|
-
if (pre === 'U')
|
|
19199
|
-
(_a = uPre(ageInt), ageMinDate = _a.ageMinDate, ageMax = _a.ageMax);
|
|
19200
|
-
if (post === 'U')
|
|
19201
|
-
(_b = uPost(ageInt), ageMinDate = _b.ageMinDate, ageMax = _b.ageMax);
|
|
19202
|
-
if (pre === 'O')
|
|
19203
|
-
(_c = oPre(ageInt), ageMaxDate = _c.ageMaxDate, ageMin = _c.ageMin);
|
|
19204
|
-
if (post === 'O')
|
|
19205
|
-
(_d = oPost(ageInt), ageMaxDate = _d.ageMaxDate, ageMin = _d.ageMin);
|
|
19206
|
-
};
|
|
19207
|
-
if (isCombined) {
|
|
19208
|
-
var _d = __read(((_b = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(extractCombined)) !== null && _b !== void 0 ? _b : [])
|
|
19209
|
-
.slice(1)
|
|
19210
|
-
.map(function (n) { return parseInt(n); }), 2), lowAge = _d[0], highAge = _d[1];
|
|
19211
|
-
if (lowAge <= highAge) {
|
|
19212
|
-
ageMin = ageMin !== null && ageMin !== void 0 ? ageMin : lowAge;
|
|
19213
|
-
ageMax = ageMax !== null && ageMax !== void 0 ? ageMax : highAge;
|
|
19214
|
-
combinedAge = true;
|
|
19215
|
-
}
|
|
19216
|
-
else {
|
|
19217
|
-
errors.push("Invalid combined age range ".concat(ageCategoryCode));
|
|
19218
|
-
}
|
|
19219
|
-
}
|
|
19220
|
-
else if (isBetween) {
|
|
19221
|
-
ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.split('-').forEach(processCode);
|
|
19222
|
-
}
|
|
19223
|
-
else if (isCoded) {
|
|
19224
|
-
processCode(ageCategoryCode);
|
|
19225
|
-
}
|
|
19226
|
-
if (errors.length)
|
|
19227
|
-
return { error: errors, ageMin: 8, ageMax: 99 };
|
|
19228
|
-
return definedAttributes({
|
|
19229
|
-
combinedAge: combinedAge,
|
|
19230
|
-
ageMaxDate: ageMaxDate,
|
|
19231
|
-
ageMinDate: ageMinDate,
|
|
19232
|
-
ageMax: ageMax,
|
|
19233
|
-
ageMin: ageMin,
|
|
19234
|
-
});
|
|
19235
|
-
}
|
|
19236
|
-
|
|
19237
19399
|
// utility function just to allow testing with string score entry
|
|
19238
19400
|
function parseScoreString(_a) {
|
|
19239
19401
|
var _b = _a.tiebreakTo, tiebreakTo = _b === void 0 ? 7 : _b, scoreString = _a.scoreString;
|
|
@@ -25199,16 +25361,19 @@ var structureTemplate = function (_a) {
|
|
|
25199
25361
|
return structure;
|
|
25200
25362
|
};
|
|
25201
25363
|
|
|
25202
|
-
function generateRoundRobin(
|
|
25203
|
-
var
|
|
25204
|
-
var _f =
|
|
25364
|
+
function generateRoundRobin(params) {
|
|
25365
|
+
var _a, _b, _c;
|
|
25366
|
+
var _d = params.groupNameBase, groupNameBase = _d === void 0 ? 'Group' : _d, playoffAttributes = params.playoffAttributes, _e = params.stageSequence, stageSequence = _e === void 0 ? 1 : _e, structureOptions = params.structureOptions, appliedPolicies = params.appliedPolicies, seedingProfile = params.seedingProfile, _f = params.stage, stage = _f === void 0 ? MAIN : _f, matchUpType = params.matchUpType, roundTarget = params.roundTarget, structureId = params.structureId, groupNames = params.groupNames, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
25367
|
+
var structureName = (_c = (_a = params.structureName) !== null && _a !== void 0 ? _a : (_b = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0']) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : constantToString(MAIN);
|
|
25368
|
+
var _g = deriveGroups({
|
|
25205
25369
|
structureOptions: structureOptions,
|
|
25206
25370
|
appliedPolicies: appliedPolicies,
|
|
25207
25371
|
drawSize: drawSize,
|
|
25208
|
-
}), groupCount =
|
|
25372
|
+
}), groupCount = _g.groupCount, groupSize = _g.groupSize;
|
|
25209
25373
|
var finishingPosition = WIN_RATIO;
|
|
25210
25374
|
var maxRoundNumber;
|
|
25211
25375
|
var structures = generateRange(1, groupCount + 1).map(function (structureOrder) {
|
|
25376
|
+
var _a;
|
|
25212
25377
|
var matchUps = roundRobinMatchUps({
|
|
25213
25378
|
groupSize: groupSize,
|
|
25214
25379
|
structureOrder: structureOrder,
|
|
@@ -25221,12 +25386,13 @@ function generateRoundRobin(_a) {
|
|
|
25221
25386
|
var roundNumber = _a.roundNumber;
|
|
25222
25387
|
return roundNumber;
|
|
25223
25388
|
})), false));
|
|
25389
|
+
var structureName = (_a = groupNames === null || groupNames === void 0 ? void 0 : groupNames[structureOrder - 1]) !== null && _a !== void 0 ? _a : "".concat(groupNameBase, " ").concat(structureOrder);
|
|
25224
25390
|
return structureTemplate({
|
|
25225
|
-
structureName: "".concat(groupNameBase, " ").concat(structureOrder),
|
|
25226
25391
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
25227
25392
|
structureType: ITEM,
|
|
25228
25393
|
finishingPosition: finishingPosition,
|
|
25229
25394
|
structureOrder: structureOrder,
|
|
25395
|
+
structureName: structureName,
|
|
25230
25396
|
matchUps: matchUps,
|
|
25231
25397
|
});
|
|
25232
25398
|
});
|
|
@@ -32864,24 +33030,32 @@ function removeCollectionDefinition(params) {
|
|
|
32864
33030
|
function addCollectionDefinition$1(_a) {
|
|
32865
33031
|
var e_1, _b, e_2, _c, _d, e_3, _e;
|
|
32866
33032
|
var _f, _g, _h, _j, _k, _l, _m, _o;
|
|
32867
|
-
var _p = _a.updateInProgressMatchUps, updateInProgressMatchUps = _p === void 0 ? true : _p, collectionDefinition = _a.collectionDefinition, tournamentRecord = _a.tournamentRecord, referenceGender = _a.referenceGender, drawDefinition = _a.drawDefinition, tieFormatName = _a.tieFormatName, enforceGender = _a.enforceGender, structureId = _a.structureId, matchUpId = _a.matchUpId, matchUp = _a.matchUp, eventId = _a.eventId, uuids = _a.uuids, event = _a.event;
|
|
33033
|
+
var _p = _a.updateInProgressMatchUps, updateInProgressMatchUps = _p === void 0 ? true : _p, collectionDefinition = _a.collectionDefinition, referenceCategory = _a.referenceCategory, tournamentRecord = _a.tournamentRecord, enforceCategory = _a.enforceCategory, referenceGender = _a.referenceGender, drawDefinition = _a.drawDefinition, tieFormatName = _a.tieFormatName, enforceGender = _a.enforceGender, structureId = _a.structureId, matchUpId = _a.matchUpId, matchUp = _a.matchUp, eventId = _a.eventId, uuids = _a.uuids, event = _a.event;
|
|
32868
33034
|
var stack = 'addCollectionDefinition';
|
|
32869
33035
|
var appliedPolicies = (_f = getAppliedPolicies({
|
|
32870
33036
|
tournamentRecord: tournamentRecord,
|
|
32871
33037
|
drawDefinition: drawDefinition,
|
|
32872
33038
|
event: event,
|
|
32873
33039
|
}).appliedPolicies) !== null && _f !== void 0 ? _f : {};
|
|
33040
|
+
var matchUpActionsPolicy = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS];
|
|
33041
|
+
enforceCategory =
|
|
33042
|
+
enforceCategory !== null && enforceCategory !== void 0 ? enforceCategory : (_g = matchUpActionsPolicy === null || matchUpActionsPolicy === void 0 ? void 0 : matchUpActionsPolicy.participants) === null || _g === void 0 ? void 0 : _g.enforceCategory;
|
|
32874
33043
|
enforceGender =
|
|
32875
|
-
enforceGender !== null && enforceGender !== void 0 ? enforceGender : (_h =
|
|
32876
|
-
var
|
|
32877
|
-
|
|
33044
|
+
enforceGender !== null && enforceGender !== void 0 ? enforceGender : (_h = matchUpActionsPolicy === null || matchUpActionsPolicy === void 0 ? void 0 : matchUpActionsPolicy.participants) === null || _h === void 0 ? void 0 : _h.enforceGender;
|
|
33045
|
+
var checkCategory = !!((referenceCategory !== null && referenceCategory !== void 0 ? referenceCategory : event === null || event === void 0 ? void 0 : event.category) &&
|
|
33046
|
+
enforceCategory !== false);
|
|
33047
|
+
var checkGender = !!((referenceGender !== null && referenceGender !== void 0 ? referenceGender : event === null || event === void 0 ? void 0 : event.gender) &&
|
|
33048
|
+
enforceGender !== false);
|
|
33049
|
+
var validationResult = validateCollectionDefinition({
|
|
33050
|
+
referenceCategory: referenceCategory !== null && referenceCategory !== void 0 ? referenceCategory : event === null || event === void 0 ? void 0 : event.category,
|
|
32878
33051
|
collectionDefinition: collectionDefinition,
|
|
32879
33052
|
referenceGender: referenceGender,
|
|
33053
|
+
checkCategory: checkCategory,
|
|
32880
33054
|
checkGender: checkGender,
|
|
32881
33055
|
event: event,
|
|
32882
|
-
})
|
|
32883
|
-
if (
|
|
32884
|
-
return decorateResult({ result:
|
|
33056
|
+
});
|
|
33057
|
+
if (validationResult.error) {
|
|
33058
|
+
return decorateResult({ result: validationResult, stack: stack });
|
|
32885
33059
|
}
|
|
32886
33060
|
var result = !(matchUp === null || matchUp === void 0 ? void 0 : matchUp.tieFormat)
|
|
32887
33061
|
? getTieFormat$1({
|
|
@@ -32924,7 +33098,7 @@ function addCollectionDefinition$1(_a) {
|
|
|
32924
33098
|
});
|
|
32925
33099
|
// calculate new winCriteria for tieFormat
|
|
32926
33100
|
// if existing winCriteria is aggregateValue, retain
|
|
32927
|
-
var
|
|
33101
|
+
var _q = calculateWinCriteria(tieFormat), aggregateValue = _q.aggregateValue, valueGoal = _q.valueGoal;
|
|
32928
33102
|
tieFormat.winCriteria = definedAttributes({ aggregateValue: aggregateValue, valueGoal: valueGoal });
|
|
32929
33103
|
// if valueGoal has changed, force renaming of the tieFormat
|
|
32930
33104
|
var originalValueGoal = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.valueGoal;
|
|
@@ -32950,13 +33124,13 @@ function addCollectionDefinition$1(_a) {
|
|
|
32950
33124
|
event.tieFormat = prunedTieFormat;
|
|
32951
33125
|
try {
|
|
32952
33126
|
// all team matchUps in the event which do not have tieFormats and where draws/strucures do not have tieFormats should have matchUps added
|
|
32953
|
-
for (var
|
|
32954
|
-
var drawDefinition_1 =
|
|
33127
|
+
for (var _r = __values((_k = event.drawDefinitions) !== null && _k !== void 0 ? _k : []), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
33128
|
+
var drawDefinition_1 = _s.value;
|
|
32955
33129
|
if (drawDefinition_1.tieFormat)
|
|
32956
33130
|
continue;
|
|
32957
33131
|
try {
|
|
32958
|
-
for (var
|
|
32959
|
-
var structure_1 =
|
|
33132
|
+
for (var _t = (e_2 = void 0, __values((_l = drawDefinition_1.structures) !== null && _l !== void 0 ? _l : [])), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
33133
|
+
var structure_1 = _u.value;
|
|
32960
33134
|
if (structure_1.tieFormat)
|
|
32961
33135
|
continue;
|
|
32962
33136
|
var result_1 = updateStructureMatchUps({
|
|
@@ -32973,7 +33147,7 @@ function addCollectionDefinition$1(_a) {
|
|
|
32973
33147
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
32974
33148
|
finally {
|
|
32975
33149
|
try {
|
|
32976
|
-
if (
|
|
33150
|
+
if (_u && !_u.done && (_c = _t.return)) _c.call(_t);
|
|
32977
33151
|
}
|
|
32978
33152
|
finally { if (e_2) throw e_2.error; }
|
|
32979
33153
|
}
|
|
@@ -32982,7 +33156,7 @@ function addCollectionDefinition$1(_a) {
|
|
|
32982
33156
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
32983
33157
|
finally {
|
|
32984
33158
|
try {
|
|
32985
|
-
if (
|
|
33159
|
+
if (_s && !_s.done && (_b = _r.return)) _b.call(_r);
|
|
32986
33160
|
}
|
|
32987
33161
|
finally { if (e_1) throw e_1.error; }
|
|
32988
33162
|
}
|
|
@@ -33045,8 +33219,8 @@ function addCollectionDefinition$1(_a) {
|
|
|
33045
33219
|
// all team matchUps in the drawDefinition which do not have tieFormats and where strucures do not have tieFormats should have matchUps added
|
|
33046
33220
|
drawDefinition.tieFormat = prunedTieFormat;
|
|
33047
33221
|
try {
|
|
33048
|
-
for (var
|
|
33049
|
-
var structure_2 =
|
|
33222
|
+
for (var _v = __values((_m = drawDefinition.structures) !== null && _m !== void 0 ? _m : []), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
33223
|
+
var structure_2 = _w.value;
|
|
33050
33224
|
var result_3 = updateStructureMatchUps({
|
|
33051
33225
|
updateInProgressMatchUps: updateInProgressMatchUps,
|
|
33052
33226
|
collectionDefinition: collectionDefinition,
|
|
@@ -33061,7 +33235,7 @@ function addCollectionDefinition$1(_a) {
|
|
|
33061
33235
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
33062
33236
|
finally {
|
|
33063
33237
|
try {
|
|
33064
|
-
if (
|
|
33238
|
+
if (_w && !_w.done && (_e = _v.return)) _e.call(_v);
|
|
33065
33239
|
}
|
|
33066
33240
|
finally { if (e_3) throw e_3.error; }
|
|
33067
33241
|
}
|
|
@@ -39966,6 +40140,7 @@ var POLICY_MATCHUP_ACTIONS_DEFAULT = (_a$2 = {},
|
|
|
39966
40140
|
},
|
|
39967
40141
|
],
|
|
39968
40142
|
participants: {
|
|
40143
|
+
enforceCategory: true,
|
|
39969
40144
|
enforceGender: true, // disallow placing FEMALEs in MALE events and vice versa
|
|
39970
40145
|
},
|
|
39971
40146
|
processCodes: {
|
|
@@ -43767,7 +43942,8 @@ function generatePlayoffStructures(params) {
|
|
|
43767
43942
|
var attributeProfile = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile];
|
|
43768
43943
|
var base = (playoffStructureNameBase && "".concat(playoffStructureNameBase, " ")) || '';
|
|
43769
43944
|
var customNaming = (_a = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[finishingPositionRange]) !== null && _a !== void 0 ? _a : finishingPositionNaming === null || finishingPositionNaming === void 0 ? void 0 : finishingPositionNaming[finishingPositionRange];
|
|
43770
|
-
var structureName =
|
|
43945
|
+
var structureName = params.structureName ||
|
|
43946
|
+
(customNaming === null || customNaming === void 0 ? void 0 : customNaming.name) ||
|
|
43771
43947
|
((attributeProfile === null || attributeProfile === void 0 ? void 0 : attributeProfile.name) &&
|
|
43772
43948
|
(addNameBaseToAttributeName
|
|
43773
43949
|
? "".concat(base).concat(attributeProfile === null || attributeProfile === void 0 ? void 0 : attributeProfile.name)
|
|
@@ -43908,12 +44084,16 @@ function feedInChampionship(params) {
|
|
|
43908
44084
|
fmlc: fmlc,
|
|
43909
44085
|
}), consolationMatchUps = _f.matchUps, roundsCount = _f.roundsCount;
|
|
43910
44086
|
if (drawSize > 2) {
|
|
44087
|
+
var name_1 = (_c = (_b = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0-1']) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : constantToString(CONSOLATION);
|
|
44088
|
+
var structureName_1 = params.playoffStructureNameBase
|
|
44089
|
+
? "".concat(params.playoffStructureNameBase, " ").concat(name_1)
|
|
44090
|
+
: name_1;
|
|
43911
44091
|
var consolationStructure = structureTemplate({
|
|
43912
|
-
structureName: (_c = (_b = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0-1']) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : constantToString(CONSOLATION),
|
|
43913
44092
|
matchUps: consolationMatchUps,
|
|
43914
44093
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43915
44094
|
stage: CONSOLATION,
|
|
43916
44095
|
stageSequence: 1,
|
|
44096
|
+
structureName: structureName_1,
|
|
43917
44097
|
matchUpType: matchUpType,
|
|
43918
44098
|
});
|
|
43919
44099
|
structures.push(consolationStructure);
|
|
@@ -44051,8 +44231,9 @@ function processPlayoffGroups(_a) {
|
|
|
44051
44231
|
else if ([COMPASS, OLYMPIC, PLAY_OFF].includes(playoffDrawType)) {
|
|
44052
44232
|
var params_1 = {
|
|
44053
44233
|
playoffAttributes: (_j = playoffGroup.playoffAttributes) !== null && _j !== void 0 ? _j : playoffAttributes,
|
|
44234
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
44054
44235
|
structureId: (_k = playoffGroup.structureId) !== null && _k !== void 0 ? _k : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44055
|
-
|
|
44236
|
+
structureName: playoffGroup.structureName,
|
|
44056
44237
|
idPrefix: idPrefix && "".concat(idPrefix, "-po"),
|
|
44057
44238
|
addNameBaseToAttributeName: true,
|
|
44058
44239
|
finishingPositionOffset: finishingPositionOffset,
|
|
@@ -44108,7 +44289,9 @@ function processPlayoffGroups(_a) {
|
|
|
44108
44289
|
].includes(playoffDrawType)) {
|
|
44109
44290
|
var uuidsFMLC = [uuids === null || uuids === void 0 ? void 0 : uuids.pop(), uuids === null || uuids === void 0 ? void 0 : uuids.pop()];
|
|
44110
44291
|
var params_2 = {
|
|
44292
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
44111
44293
|
structureId: (_s = playoffGroup.structureId) !== null && _s !== void 0 ? _s : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44294
|
+
playoffAttributes: playoffGroup.playoffAttributes,
|
|
44112
44295
|
idPrefix: idPrefix && "".concat(idPrefix, "-po"),
|
|
44113
44296
|
finishingPositionOffset: finishingPositionOffset,
|
|
44114
44297
|
uuids: uuidsFMLC,
|
|
@@ -44211,9 +44394,8 @@ function generateRoundRobinWithPlayOff(params) {
|
|
|
44211
44394
|
var drawDefinition = params.drawDefinition, structureOptions = params.structureOptions, requireSequential = params.requireSequential;
|
|
44212
44395
|
var mainDrawProperties = __assign(__assign({ structureName: constantToString(MAIN) }, params), { stage: MAIN }); // default structureName
|
|
44213
44396
|
var _a = generateRoundRobin(mainDrawProperties), structures = _a.structures, groupCount = _a.groupCount, groupSize = _a.groupSize;
|
|
44214
|
-
// TODO: test for and handle this situation
|
|
44215
44397
|
if (groupCount < 1) {
|
|
44216
|
-
|
|
44398
|
+
return { error: INVALID_CONFIGURATION };
|
|
44217
44399
|
}
|
|
44218
44400
|
// define a default playoff group if none specified
|
|
44219
44401
|
var playoffGroups = (structureOptions === null || structureOptions === void 0 ? void 0 : structureOptions.playoffGroups) || [
|
|
@@ -63067,8 +63249,8 @@ function prepareStage(params) {
|
|
|
63067
63249
|
}).scaledEntries;
|
|
63068
63250
|
if (!(scaledEntries === null || scaledEntries === void 0 ? void 0 : scaledEntries.length) && seedByRanking) {
|
|
63069
63251
|
var rankingScaleAttributes = {
|
|
63070
|
-
scaleType: RANKING$1,
|
|
63071
63252
|
scaleName: categoryName || ageCategoryCode,
|
|
63253
|
+
scaleType: RANKING$1,
|
|
63072
63254
|
eventType: eventType,
|
|
63073
63255
|
};
|
|
63074
63256
|
(scaledEntries = getScaledEntries({
|
|
@@ -66567,7 +66749,7 @@ function generatePersons(params) {
|
|
|
66567
66749
|
shuffledPersons.push(person);
|
|
66568
66750
|
});
|
|
66569
66751
|
}
|
|
66570
|
-
var _d =
|
|
66752
|
+
var _d = getCategoryAgeDetails({
|
|
66571
66753
|
consideredDate: consideredDate,
|
|
66572
66754
|
category: category,
|
|
66573
66755
|
}), ageMinDate = _d.ageMinDate, ageMaxDate = _d.ageMaxDate;
|
|
@@ -69645,7 +69827,8 @@ var utilities = {
|
|
|
69645
69827
|
nextPowerOf2: nextPowerOf2,
|
|
69646
69828
|
numericSort: numericSort,
|
|
69647
69829
|
overlap: overlap,
|
|
69648
|
-
|
|
69830
|
+
getCategoryAgeDetails: getCategoryAgeDetails,
|
|
69831
|
+
categoryCanContain: categoryCanContain,
|
|
69649
69832
|
randomMember: randomMember,
|
|
69650
69833
|
randomPop: randomPop,
|
|
69651
69834
|
shuffleArray: shuffleArray,
|