tods-competition-factory 1.8.2 → 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.d.ts +11 -3
- package/dist/forge/generate.mjs +337 -65
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +24 -12
- 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 +347 -173
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +422 -225
- 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
|
|
@@ -7731,20 +8004,20 @@ var ROUND_ROBIN_WITH_PLAYOFF = 'ROUND_ROBIN_WITH_PLAYOFF';
|
|
|
7731
8004
|
var DECIDER = 'DECIDER';
|
|
7732
8005
|
var BACKDRAW = 'BACKDRAW';
|
|
7733
8006
|
var COMPASS_ATTRIBUTES = {
|
|
7734
|
-
0: { name: '
|
|
7735
|
-
'0-1': { name: '
|
|
7736
|
-
'0-2': { name: '
|
|
7737
|
-
'0-3': { name: '
|
|
7738
|
-
'0-1-1': { name: '
|
|
7739
|
-
'0-1-2': { name: '
|
|
7740
|
-
'0-2-1': { name: '
|
|
7741
|
-
'0-1-1-1': { name: '
|
|
8007
|
+
0: { name: 'East', abbreviation: 'E' },
|
|
8008
|
+
'0-1': { name: 'West', abbreviation: 'W' },
|
|
8009
|
+
'0-2': { name: 'North', abbreviation: 'N' },
|
|
8010
|
+
'0-3': { name: 'Northeast', abbreviation: 'NE' },
|
|
8011
|
+
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
8012
|
+
'0-1-2': { name: 'Southwest', abbreviation: 'SW' },
|
|
8013
|
+
'0-2-1': { name: 'Northwest', abbreviation: 'NW' },
|
|
8014
|
+
'0-1-1-1': { name: 'Southeast', abbreviation: 'SE' },
|
|
7742
8015
|
};
|
|
7743
8016
|
var OLYMPIC_ATTRIBUTES = {
|
|
7744
|
-
0: { name: '
|
|
7745
|
-
'0-1': { name: '
|
|
7746
|
-
'0-2': { name: '
|
|
7747
|
-
'0-1-1': { name: '
|
|
8017
|
+
0: { name: 'East', abbreviation: 'E' },
|
|
8018
|
+
'0-1': { name: 'West', abbreviation: 'W' },
|
|
8019
|
+
'0-2': { name: 'North', abbreviation: 'N' },
|
|
8020
|
+
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
7748
8021
|
};
|
|
7749
8022
|
// finishingPosition determination
|
|
7750
8023
|
var WIN_RATIO = 'WIN_RATIO';
|
|
@@ -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 _e =
|
|
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: "Group ".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: {
|
|
@@ -42596,7 +42771,7 @@ function competitionEngineAsync(test) {
|
|
|
42596
42771
|
}
|
|
42597
42772
|
|
|
42598
42773
|
function addVoluntaryConsolationStructure$1(_a) {
|
|
42599
|
-
var _b = _a.structureName, structureName = _b === void 0 ? VOLUNTARY_CONSOLATION : _b, structureAbbreviation = _a.structureAbbreviation, drawDefinition = _a.drawDefinition, matchUpType = _a.matchUpType, structureId = _a.structureId;
|
|
42774
|
+
var _b = _a.structureName, structureName = _b === void 0 ? constantToString(VOLUNTARY_CONSOLATION) : _b, structureAbbreviation = _a.structureAbbreviation, drawDefinition = _a.drawDefinition, matchUpType = _a.matchUpType, structureId = _a.structureId;
|
|
42600
42775
|
if (!drawDefinition)
|
|
42601
42776
|
return { error: MISSING_DRAW_DEFINITION };
|
|
42602
42777
|
var structure = structureTemplate({
|
|
@@ -42801,8 +42976,8 @@ function generateQualifyingStructures(_a) {
|
|
|
42801
42976
|
var stageSequenceName = structureProfiles.length > 1 || roundTargetName ? stageSequence : '';
|
|
42802
42977
|
var qualifyingStructureName = structureName ||
|
|
42803
42978
|
(roundTargetName || stageSequenceName
|
|
42804
|
-
? "".concat(QUALIFYING, " ").concat(roundTargetName).concat(stageSequenceName)
|
|
42805
|
-
: QUALIFYING);
|
|
42979
|
+
? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
|
|
42980
|
+
: constantToString(QUALIFYING));
|
|
42806
42981
|
if (drawType === ROUND_ROBIN) {
|
|
42807
42982
|
var _k = generateRoundRobin({
|
|
42808
42983
|
structureName: structureProfile.structureName || qualifyingStructureName,
|
|
@@ -43508,7 +43683,8 @@ function roundMatchCounts(_a) {
|
|
|
43508
43683
|
}
|
|
43509
43684
|
|
|
43510
43685
|
function firstRoundLoserConsolation(params) {
|
|
43511
|
-
var _a
|
|
43686
|
+
var _a, _b, _c, _d;
|
|
43687
|
+
var _e = params.finishingPositionOffset, finishingPositionOffset = _e === void 0 ? 0 : _e, playoffAttributes = params.playoffAttributes, _f = params.stageSequence, stageSequence = _f === void 0 ? 1 : _f, staggeredEntry = params.staggeredEntry, structureName = params.structureName, _g = params.stage, stage = _g === void 0 ? MAIN : _g, matchUpType = params.matchUpType, structureId = params.structureId, idPrefix = params.idPrefix, drawSize = params.drawSize, isMock = params.isMock, uuids = params.uuids;
|
|
43512
43688
|
var mainParams = {
|
|
43513
43689
|
finishingPositionOffset: finishingPositionOffset,
|
|
43514
43690
|
matchUpType: matchUpType,
|
|
@@ -43521,7 +43697,7 @@ function firstRoundLoserConsolation(params) {
|
|
|
43521
43697
|
? feedInMatchUps(mainParams)
|
|
43522
43698
|
: treeMatchUps(mainParams)).matchUps;
|
|
43523
43699
|
var mainStructure = structureTemplate({
|
|
43524
|
-
structureName: structureName || constantToString(MAIN),
|
|
43700
|
+
structureName: structureName || ((_a = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0']) === null || _a === void 0 ? void 0 : _a.name) || constantToString(MAIN),
|
|
43525
43701
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43526
43702
|
stageSequence: stageSequence,
|
|
43527
43703
|
matchUpType: matchUpType,
|
|
@@ -43540,8 +43716,7 @@ function firstRoundLoserConsolation(params) {
|
|
|
43540
43716
|
isMock: isMock,
|
|
43541
43717
|
}).matchUps;
|
|
43542
43718
|
var consolation = constantToString(CONSOLATION);
|
|
43543
|
-
var consolationStructureName = params.consolationStructureName
|
|
43544
|
-
(structureName ? "".concat(structureName, " ").concat(consolation) : consolation);
|
|
43719
|
+
var consolationStructureName = (_d = (_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 : params.consolationStructureName) !== null && _d !== void 0 ? _d : (structureName ? "".concat(structureName, " ").concat(consolation) : consolation);
|
|
43545
43720
|
var consolationStructure = structureTemplate({
|
|
43546
43721
|
structureName: consolationStructureName,
|
|
43547
43722
|
matchUps: consolationMatchUps,
|
|
@@ -43620,7 +43795,8 @@ function feedInLinks(_a) {
|
|
|
43620
43795
|
}
|
|
43621
43796
|
|
|
43622
43797
|
function generateCurtisConsolation(params) {
|
|
43623
|
-
var _a
|
|
43798
|
+
var _a, _b, _c, _d, _e;
|
|
43799
|
+
var playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionOffset = params.finishingPositionOffset, _f = params.stageSequence, stageSequence = _f === void 0 ? 1 : _f, playoffAttributes = params.playoffAttributes, structureNameMap = params.structureNameMap, staggeredEntry = params.staggeredEntry, _g = params.stage, stage = _g === void 0 ? MAIN : _g, matchUpType = params.matchUpType, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
43624
43800
|
var mainParams = {
|
|
43625
43801
|
finishingPositionOffset: finishingPositionOffset,
|
|
43626
43802
|
matchUpType: matchUpType,
|
|
@@ -43629,9 +43805,10 @@ function generateCurtisConsolation(params) {
|
|
|
43629
43805
|
isMock: isMock,
|
|
43630
43806
|
uuids: uuids,
|
|
43631
43807
|
};
|
|
43632
|
-
var
|
|
43808
|
+
var _h = staggeredEntry
|
|
43633
43809
|
? feedInMatchUps(mainParams)
|
|
43634
|
-
: treeMatchUps(mainParams), matchUps =
|
|
43810
|
+
: treeMatchUps(mainParams), matchUps = _h.matchUps, mainDrawRoundsCount = _h.roundsCount;
|
|
43811
|
+
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);
|
|
43635
43812
|
var mainStructure = structureTemplate({
|
|
43636
43813
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43637
43814
|
structureName: structureName,
|
|
@@ -43650,6 +43827,7 @@ function generateCurtisConsolation(params) {
|
|
|
43650
43827
|
idPrefix: idPrefix && "".concat(idPrefix, "-c").concat(index),
|
|
43651
43828
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43652
43829
|
playoffStructureNameBase: playoffStructureNameBase,
|
|
43830
|
+
playoffAttributes: playoffAttributes,
|
|
43653
43831
|
structureNameMap: structureNameMap,
|
|
43654
43832
|
stageSequence: stageSequence,
|
|
43655
43833
|
roundOffset: roundOffset,
|
|
@@ -43682,7 +43860,7 @@ function generateCurtisConsolation(params) {
|
|
|
43682
43860
|
matchUpType: matchUpType,
|
|
43683
43861
|
isMock: isMock,
|
|
43684
43862
|
}).matchUps;
|
|
43685
|
-
var defaultName = constantToString(PLAY_OFF);
|
|
43863
|
+
var defaultName = (_e = (_d = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['3-4']) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : constantToString(PLAY_OFF);
|
|
43686
43864
|
var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
|
|
43687
43865
|
var structureName_1 = playoffStructureNameBase
|
|
43688
43866
|
? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
|
|
@@ -43714,9 +43892,10 @@ function generateCurtisConsolation(params) {
|
|
|
43714
43892
|
return __assign({ structures: structures, links: links }, SUCCESS);
|
|
43715
43893
|
}
|
|
43716
43894
|
function consolationFeedStructure(_a) {
|
|
43717
|
-
var
|
|
43895
|
+
var _b, _c;
|
|
43896
|
+
var playoffStructureNameBase = _a.playoffStructureNameBase, _d = _a.stageSequence, stageSequence = _d === void 0 ? 1 : _d, playoffAttributes = _a.playoffAttributes, structureNameMap = _a.structureNameMap, _e = _a.roundOffset, roundOffset = _e === void 0 ? 0 : _e, matchUpType = _a.matchUpType, structureId = _a.structureId, idPrefix = _a.idPrefix, drawSize = _a.drawSize, isMock = _a.isMock, index = _a.index, uuids = _a.uuids;
|
|
43718
43897
|
var consolationDrawPositions = drawSize / (2 * Math.pow(2, roundOffset));
|
|
43719
|
-
var
|
|
43898
|
+
var _f = feedInMatchUps({
|
|
43720
43899
|
finishingPositionOffset: consolationDrawPositions,
|
|
43721
43900
|
baseDrawSize: consolationDrawPositions,
|
|
43722
43901
|
isConsolation: true,
|
|
@@ -43725,8 +43904,10 @@ function consolationFeedStructure(_a) {
|
|
|
43725
43904
|
idPrefix: idPrefix,
|
|
43726
43905
|
isMock: isMock,
|
|
43727
43906
|
uuids: uuids,
|
|
43728
|
-
}), consolationMatchUps =
|
|
43729
|
-
var
|
|
43907
|
+
}), consolationMatchUps = _f.matchUps, consolationRoundsCount = _f.roundsCount;
|
|
43908
|
+
var indexedStructureName = (index === 0 && ((_b = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0-1']) === null || _b === void 0 ? void 0 : _b.name)) ||
|
|
43909
|
+
(index === 1 && ((_c = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0-3']) === null || _c === void 0 ? void 0 : _c.name));
|
|
43910
|
+
var defaultName = indexedStructureName || "".concat(constantToString(CONSOLATION), " ").concat(index + 1);
|
|
43730
43911
|
var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
|
|
43731
43912
|
var structureName = playoffStructureNameBase
|
|
43732
43913
|
? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
|
|
@@ -43743,8 +43924,9 @@ function consolationFeedStructure(_a) {
|
|
|
43743
43924
|
}
|
|
43744
43925
|
|
|
43745
43926
|
function generatePlayoffStructures(params) {
|
|
43746
|
-
var _a
|
|
43747
|
-
|
|
43927
|
+
var _a;
|
|
43928
|
+
var _b = params.finishingPositionOffset, finishingPositionOffset = _b === void 0 ? 0 : _b, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionNaming = params.finishingPositionNaming, finishingPositionLimit = params.finishingPositionLimit, playoffAttributes = params.playoffAttributes, _c = params.stageSequence, stageSequence = _c === void 0 ? 1 : _c, _d = params.exitProfile, exitProfile = _d === void 0 ? '0' : _d, exitProfileLimit = params.exitProfileLimit, roundOffsetLimit = params.roundOffsetLimit, _e = params.roundOffset, roundOffset = _e === void 0 ? 0 : _e, drawDefinition = params.drawDefinition, staggeredEntry = params.staggeredEntry, // not propagated to child structurs
|
|
43929
|
+
sequenceLimit = params.sequenceLimit, _f = params.stage, stage = _f === void 0 ? MAIN : _f, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
43748
43930
|
var generateStructure = !playoffAttributes || !exitProfileLimit || (playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile]);
|
|
43749
43931
|
if (!generateStructure ||
|
|
43750
43932
|
drawSize < 2 ||
|
|
@@ -43759,8 +43941,9 @@ function generatePlayoffStructures(params) {
|
|
|
43759
43941
|
var finishingPositionRange = "".concat(finishingPositionsFrom, "-").concat(finishingPositionsTo);
|
|
43760
43942
|
var attributeProfile = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile];
|
|
43761
43943
|
var base = (playoffStructureNameBase && "".concat(playoffStructureNameBase, " ")) || '';
|
|
43762
|
-
var customNaming = finishingPositionNaming === null || finishingPositionNaming === void 0 ? void 0 : finishingPositionNaming[finishingPositionRange];
|
|
43763
|
-
var structureName =
|
|
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];
|
|
43945
|
+
var structureName = params.structureName ||
|
|
43946
|
+
(customNaming === null || customNaming === void 0 ? void 0 : customNaming.name) ||
|
|
43764
43947
|
((attributeProfile === null || attributeProfile === void 0 ? void 0 : attributeProfile.name) &&
|
|
43765
43948
|
(addNameBaseToAttributeName
|
|
43766
43949
|
? "".concat(base).concat(attributeProfile === null || attributeProfile === void 0 ? void 0 : attributeProfile.name)
|
|
@@ -43861,7 +44044,8 @@ function generatePlayoffStructures(params) {
|
|
|
43861
44044
|
}
|
|
43862
44045
|
|
|
43863
44046
|
function feedInChampionship(params) {
|
|
43864
|
-
var
|
|
44047
|
+
var _a, _b, _c;
|
|
44048
|
+
var finishingPositionOffset = params.finishingPositionOffset, _d = params.stageSequence, stageSequence = _d === void 0 ? 1 : _d, playoffAttributes = params.playoffAttributes, policyDefinitions = params.policyDefinitions, feedsFromFinal = params.feedsFromFinal, staggeredEntry = params.staggeredEntry, structureName = params.structureName, _e = params.stage, stage = _e === void 0 ? MAIN : _e, structureId = params.structureId, matchUpType = params.matchUpType, skipRounds = params.skipRounds, feedRounds = params.feedRounds, idPrefix = params.idPrefix, drawSize = params.drawSize, isMock = params.isMock, uuids = params.uuids, fmlc = params.fmlc;
|
|
43865
44049
|
var feedPolicy = params.feedPolicy || (policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_FEED_IN]);
|
|
43866
44050
|
var mainParams = {
|
|
43867
44051
|
finishingPositionOffset: finishingPositionOffset,
|
|
@@ -43876,7 +44060,7 @@ function feedInChampionship(params) {
|
|
|
43876
44060
|
? feedInMatchUps(mainParams)
|
|
43877
44061
|
: treeMatchUps(mainParams)).matchUps;
|
|
43878
44062
|
var mainStructure = structureTemplate({
|
|
43879
|
-
structureName: structureName || constantToString(MAIN),
|
|
44063
|
+
structureName: structureName || ((_a = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0']) === null || _a === void 0 ? void 0 : _a.name) || constantToString(MAIN),
|
|
43880
44064
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43881
44065
|
stageSequence: stageSequence,
|
|
43882
44066
|
matchUpType: matchUpType,
|
|
@@ -43886,7 +44070,7 @@ function feedInChampionship(params) {
|
|
|
43886
44070
|
var structures = [mainStructure];
|
|
43887
44071
|
var links = [];
|
|
43888
44072
|
var baseDrawSize = drawSize / 2;
|
|
43889
|
-
var
|
|
44073
|
+
var _f = feedInMatchUps({
|
|
43890
44074
|
finishingPositionOffset: baseDrawSize,
|
|
43891
44075
|
idPrefix: idPrefix && "".concat(idPrefix, "-c"),
|
|
43892
44076
|
isConsolation: true,
|
|
@@ -43898,14 +44082,18 @@ function feedInChampionship(params) {
|
|
|
43898
44082
|
isMock: isMock,
|
|
43899
44083
|
uuids: uuids,
|
|
43900
44084
|
fmlc: fmlc,
|
|
43901
|
-
}), consolationMatchUps =
|
|
44085
|
+
}), consolationMatchUps = _f.matchUps, roundsCount = _f.roundsCount;
|
|
43902
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;
|
|
43903
44091
|
var consolationStructure = structureTemplate({
|
|
43904
|
-
structureName: constantToString(CONSOLATION),
|
|
43905
44092
|
matchUps: consolationMatchUps,
|
|
43906
44093
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43907
44094
|
stage: CONSOLATION,
|
|
43908
44095
|
stageSequence: 1,
|
|
44096
|
+
structureName: structureName_1,
|
|
43909
44097
|
matchUpType: matchUpType,
|
|
43910
44098
|
});
|
|
43911
44099
|
structures.push(consolationStructure);
|
|
@@ -43923,19 +44111,19 @@ function feedInChampionship(params) {
|
|
|
43923
44111
|
|
|
43924
44112
|
function processPlayoffGroups(_a) {
|
|
43925
44113
|
var e_1, _b;
|
|
43926
|
-
var _c, _d, _e, _f, _g, _h, _j;
|
|
43927
|
-
var
|
|
44114
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
44115
|
+
var _u = _a.requireSequential, requireSequential = _u === void 0 ? true : _u, playoffMatchUpFormat = _a.playoffMatchUpFormat, playoffAttributes = _a.playoffAttributes, sourceStructureId = _a.sourceStructureId, policyDefinitions = _a.policyDefinitions, stageSequence = _a.stageSequence, drawDefinition = _a.drawDefinition, playoffGroups = _a.playoffGroups, matchUpType = _a.matchUpType, feedPolicy = _a.feedPolicy, groupCount = _a.groupCount, idPrefix = _a.idPrefix, isMock = _a.isMock, uuids = _a.uuids;
|
|
43928
44116
|
feedPolicy = feedPolicy || (policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_FEED_IN]);
|
|
43929
44117
|
var stack = 'processPlayoffGroups';
|
|
43930
44118
|
var finishingPositionOffset = 0;
|
|
43931
44119
|
var finishingPositionTargets = [];
|
|
43932
44120
|
var structures = [];
|
|
43933
44121
|
var links = [];
|
|
43934
|
-
var
|
|
44122
|
+
var _v = getPositionRangeMap({
|
|
43935
44123
|
structureId: sourceStructureId,
|
|
43936
44124
|
drawDefinition: drawDefinition,
|
|
43937
44125
|
playoffGroups: playoffGroups,
|
|
43938
|
-
}), error =
|
|
44126
|
+
}), error = _v.error, positionRangeMap = _v.positionRangeMap;
|
|
43939
44127
|
if (error)
|
|
43940
44128
|
return decorateResult({ result: { error: error }, stack: stack });
|
|
43941
44129
|
var validFinishingPositions = !positionRangeMap ||
|
|
@@ -43958,7 +44146,7 @@ function processPlayoffGroups(_a) {
|
|
|
43958
44146
|
});
|
|
43959
44147
|
}
|
|
43960
44148
|
var _loop_1 = function (playoffGroup) {
|
|
43961
|
-
var
|
|
44149
|
+
var _w;
|
|
43962
44150
|
var finishingPositions = playoffGroup.finishingPositions;
|
|
43963
44151
|
var positionsPlayedOff = positionRangeMap &&
|
|
43964
44152
|
finishingPositions
|
|
@@ -43972,16 +44160,22 @@ function processPlayoffGroups(_a) {
|
|
|
43972
44160
|
if (positionsPlayedOff) {
|
|
43973
44161
|
finishingPositionOffset = Math.min.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)) - 1;
|
|
43974
44162
|
}
|
|
44163
|
+
var finishingPositionRange = positionsPlayedOff &&
|
|
44164
|
+
"".concat(Math.min.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)), "-").concat(Math.max.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)));
|
|
44165
|
+
var structureName = playoffGroup.structureName ||
|
|
44166
|
+
(finishingPositionRange &&
|
|
44167
|
+
((_d = (_c = playoffGroup.playoffAttributes) === null || _c === void 0 ? void 0 : _c[finishingPositionRange]) === null || _d === void 0 ? void 0 : _d.name)) ||
|
|
44168
|
+
((_f = (_e = playoffGroup.playoffAttributes) === null || _e === void 0 ? void 0 : _e['0']) === null || _f === void 0 ? void 0 : _f.name);
|
|
43975
44169
|
var playoffGroupParams = {
|
|
43976
44170
|
addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
|
|
43977
44171
|
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
43978
44172
|
finishingPositionNaming: playoffGroup.finishingPositionNaming,
|
|
43979
44173
|
finishingPositionLimit: playoffGroup.finishingPositionLimit,
|
|
43980
|
-
structureId: (
|
|
44174
|
+
structureId: (_g = playoffGroup.structureId) !== null && _g !== void 0 ? _g : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43981
44175
|
playoffAttributes: playoffGroup.playoffAttributes,
|
|
43982
44176
|
structureNameMap: playoffGroup.structureNameMap,
|
|
43983
|
-
structureName: playoffGroup.structureName,
|
|
43984
44177
|
sequenceLimit: playoffGroup.sequenceLimit,
|
|
44178
|
+
structureName: structureName,
|
|
43985
44179
|
};
|
|
43986
44180
|
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 });
|
|
43987
44181
|
var updateStructureAndLinks = function (_a) {
|
|
@@ -44013,10 +44207,10 @@ function processPlayoffGroups(_a) {
|
|
|
44013
44207
|
uuids: uuids,
|
|
44014
44208
|
}).matchUps;
|
|
44015
44209
|
var playoffStructure = structureTemplate({
|
|
44016
|
-
structureId: (
|
|
44017
|
-
structureName: playoffGroup.structureName,
|
|
44210
|
+
structureId: (_h = playoffGroup.structureId) !== null && _h !== void 0 ? _h : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44018
44211
|
matchUpFormat: playoffMatchUpFormat,
|
|
44019
44212
|
stage: PLAY_OFF,
|
|
44213
|
+
structureName: structureName,
|
|
44020
44214
|
stageSequence: stageSequence,
|
|
44021
44215
|
matchUps: matchUps,
|
|
44022
44216
|
});
|
|
@@ -44035,10 +44229,11 @@ function processPlayoffGroups(_a) {
|
|
|
44035
44229
|
});
|
|
44036
44230
|
}
|
|
44037
44231
|
else if ([COMPASS, OLYMPIC, PLAY_OFF].includes(playoffDrawType)) {
|
|
44038
|
-
var structureName = playoffGroup.structureName;
|
|
44039
44232
|
var params_1 = {
|
|
44040
|
-
|
|
44041
|
-
playoffStructureNameBase:
|
|
44233
|
+
playoffAttributes: (_j = playoffGroup.playoffAttributes) !== null && _j !== void 0 ? _j : playoffAttributes,
|
|
44234
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
44235
|
+
structureId: (_k = playoffGroup.structureId) !== null && _k !== void 0 ? _k : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44236
|
+
structureName: playoffGroup.structureName,
|
|
44042
44237
|
idPrefix: idPrefix && "".concat(idPrefix, "-po"),
|
|
44043
44238
|
addNameBaseToAttributeName: true,
|
|
44044
44239
|
finishingPositionOffset: finishingPositionOffset,
|
|
@@ -44051,22 +44246,22 @@ function processPlayoffGroups(_a) {
|
|
|
44051
44246
|
};
|
|
44052
44247
|
if (playoffDrawType === COMPASS) {
|
|
44053
44248
|
Object.assign(params_1, {
|
|
44054
|
-
playoffAttributes:
|
|
44249
|
+
playoffAttributes: (_m = (_l = playoffGroup === null || playoffGroup === void 0 ? void 0 : playoffGroup.playoffAttributes) !== null && _l !== void 0 ? _l : playoffAttributes) !== null && _m !== void 0 ? _m : COMPASS_ATTRIBUTES,
|
|
44055
44250
|
roundOffsetLimit: 3,
|
|
44056
44251
|
});
|
|
44057
44252
|
}
|
|
44058
44253
|
else if (playoffDrawType === OLYMPIC) {
|
|
44059
44254
|
Object.assign(params_1, {
|
|
44060
|
-
playoffAttributes:
|
|
44255
|
+
playoffAttributes: (_p = (_o = playoffGroup === null || playoffGroup === void 0 ? void 0 : playoffGroup.playoffAttributes) !== null && _o !== void 0 ? _o : playoffAttributes) !== null && _p !== void 0 ? _p : OLYMPIC_ATTRIBUTES,
|
|
44061
44256
|
roundOffsetLimit: 2,
|
|
44062
44257
|
});
|
|
44063
44258
|
}
|
|
44064
44259
|
var result = generatePlayoffStructures(params_1);
|
|
44065
44260
|
if (result.error)
|
|
44066
44261
|
return { value: result };
|
|
44067
|
-
if ((
|
|
44262
|
+
if ((_q = result.links) === null || _q === void 0 ? void 0 : _q.length)
|
|
44068
44263
|
links.push.apply(links, __spreadArray([], __read(result.links), false));
|
|
44069
|
-
if ((
|
|
44264
|
+
if ((_r = result.structures) === null || _r === void 0 ? void 0 : _r.length)
|
|
44070
44265
|
structures.push.apply(structures, __spreadArray([], __read(result.structures), false));
|
|
44071
44266
|
structures.sort(structureSort);
|
|
44072
44267
|
if (result.structureId) {
|
|
@@ -44094,27 +44289,29 @@ function processPlayoffGroups(_a) {
|
|
|
44094
44289
|
].includes(playoffDrawType)) {
|
|
44095
44290
|
var uuidsFMLC = [uuids === null || uuids === void 0 ? void 0 : uuids.pop(), uuids === null || uuids === void 0 ? void 0 : uuids.pop()];
|
|
44096
44291
|
var params_2 = {
|
|
44097
|
-
|
|
44098
|
-
|
|
44292
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
44293
|
+
structureId: (_s = playoffGroup.structureId) !== null && _s !== void 0 ? _s : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44294
|
+
playoffAttributes: playoffGroup.playoffAttributes,
|
|
44099
44295
|
idPrefix: idPrefix && "".concat(idPrefix, "-po"),
|
|
44100
44296
|
finishingPositionOffset: finishingPositionOffset,
|
|
44101
44297
|
uuids: uuidsFMLC,
|
|
44102
44298
|
stage: PLAY_OFF,
|
|
44299
|
+
structureName: structureName,
|
|
44103
44300
|
matchUpType: matchUpType,
|
|
44104
44301
|
feedPolicy: feedPolicy,
|
|
44105
44302
|
drawSize: drawSize,
|
|
44106
44303
|
isMock: isMock,
|
|
44107
44304
|
};
|
|
44108
|
-
var additionalAttributes = (
|
|
44109
|
-
|
|
44110
|
-
|
|
44111
|
-
|
|
44112
|
-
|
|
44113
|
-
|
|
44114
|
-
|
|
44305
|
+
var additionalAttributes = (_w = {},
|
|
44306
|
+
_w[FIRST_MATCH_LOSER_CONSOLATION] = { fmlc: true, feedRounds: 1 },
|
|
44307
|
+
_w[MODIFIED_FEED_IN_CHAMPIONSHIP] = { feedRounds: 1 },
|
|
44308
|
+
_w[FEED_IN_CHAMPIONSHIP_TO_R16] = { feedsFromFinal: 3 },
|
|
44309
|
+
_w[FEED_IN_CHAMPIONSHIP_TO_QF] = { feedsFromFinal: 2 },
|
|
44310
|
+
_w[FEED_IN_CHAMPIONSHIP_TO_SF] = { feedsFromFinal: 1 },
|
|
44311
|
+
_w);
|
|
44115
44312
|
Object.assign(params_2, additionalAttributes[playoffDrawType] || {});
|
|
44116
|
-
var
|
|
44117
|
-
var
|
|
44313
|
+
var _x = feedInChampionship(params_2), champitionShipStructures = _x.structures, feedInLinks = _x.links;
|
|
44314
|
+
var _y = __read(champitionShipStructures, 1), playoffStructure = _y[0];
|
|
44118
44315
|
var playoffLink = generatePlayoffLink({
|
|
44119
44316
|
playoffStructureId: playoffStructure.structureId,
|
|
44120
44317
|
finishingPositions: finishingPositions,
|
|
@@ -44131,20 +44328,20 @@ function processPlayoffGroups(_a) {
|
|
|
44131
44328
|
finishingPositionOffset += participantsInDraw;
|
|
44132
44329
|
}
|
|
44133
44330
|
else if ([ROUND_ROBIN].includes(playoffDrawType)) {
|
|
44134
|
-
var
|
|
44331
|
+
var _z = generateRoundRobin(__assign(__assign({}, params), { structureOptions: playoffGroup.structureOptions || { groupSize: 4 } })), playoffStructures = _z.structures, playoffLinks = _z.links;
|
|
44135
44332
|
updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
|
|
44136
44333
|
}
|
|
44137
44334
|
else if ([FIRST_ROUND_LOSER_CONSOLATION].includes(playoffDrawType)) {
|
|
44138
|
-
var
|
|
44335
|
+
var _0 = firstRoundLoserConsolation(params), playoffStructures = _0.structures, playoffLinks = _0.links;
|
|
44139
44336
|
updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
|
|
44140
44337
|
}
|
|
44141
44338
|
else if ([CURTIS_CONSOLATION].includes(playoffDrawType)) {
|
|
44142
|
-
var
|
|
44339
|
+
var _1 = generateCurtisConsolation(params), playoffStructures = _1.structures, playoffLinks = _1.links;
|
|
44143
44340
|
updateStructureAndLinks({ playoffStructures: playoffStructures, playoffLinks: playoffLinks });
|
|
44144
44341
|
}
|
|
44145
44342
|
else if ([AD_HOC].includes(playoffDrawType)) {
|
|
44146
44343
|
var structure = structureTemplate({
|
|
44147
|
-
structureId: (
|
|
44344
|
+
structureId: (_t = playoffGroup.structureId) !== null && _t !== void 0 ? _t : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
44148
44345
|
structureName: playoffGroup.structureName,
|
|
44149
44346
|
finishingPosition: WIN_RATIO$1,
|
|
44150
44347
|
stage: PLAY_OFF,
|
|
@@ -44197,9 +44394,8 @@ function generateRoundRobinWithPlayOff(params) {
|
|
|
44197
44394
|
var drawDefinition = params.drawDefinition, structureOptions = params.structureOptions, requireSequential = params.requireSequential;
|
|
44198
44395
|
var mainDrawProperties = __assign(__assign({ structureName: constantToString(MAIN) }, params), { stage: MAIN }); // default structureName
|
|
44199
44396
|
var _a = generateRoundRobin(mainDrawProperties), structures = _a.structures, groupCount = _a.groupCount, groupSize = _a.groupSize;
|
|
44200
|
-
// TODO: test for and handle this situation
|
|
44201
44397
|
if (groupCount < 1) {
|
|
44202
|
-
|
|
44398
|
+
return { error: INVALID_CONFIGURATION };
|
|
44203
44399
|
}
|
|
44204
44400
|
// define a default playoff group if none specified
|
|
44205
44401
|
var playoffGroups = (structureOptions === null || structureOptions === void 0 ? void 0 : structureOptions.playoffGroups) || [
|
|
@@ -44462,8 +44658,8 @@ function luckyRoundProfiles(drawSize) {
|
|
|
44462
44658
|
|
|
44463
44659
|
function getGenerators(params) {
|
|
44464
44660
|
var _a;
|
|
44465
|
-
var _b;
|
|
44466
|
-
var
|
|
44661
|
+
var _b, _c, _d, _e;
|
|
44662
|
+
var playoffAttributes = params.playoffAttributes, _f = params.stageSequence, stageSequence = _f === void 0 ? 1 : _f, structureId = params.structureId, _g = params.stage, stage = _g === void 0 ? MAIN : _g, matchUpType = params.matchUpType, drawSize = params.drawSize, uuids = params.uuids;
|
|
44467
44663
|
var appliedPolicies = getAppliedPolicies(params).appliedPolicies;
|
|
44468
44664
|
var feedPolicy = ((_b = params.policyDefinitions) === null || _b === void 0 ? void 0 : _b[POLICY_TYPE_FEED_IN]) ||
|
|
44469
44665
|
(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_FEED_IN]);
|
|
@@ -44472,13 +44668,13 @@ function getGenerators(params) {
|
|
|
44472
44668
|
params.skipRounds ||
|
|
44473
44669
|
(drawSize <= 4 && ((feedPolicy === null || feedPolicy === void 0 ? void 0 : feedPolicy.feedMainFinal) ? 0 : 1)) ||
|
|
44474
44670
|
0;
|
|
44475
|
-
var
|
|
44671
|
+
var structureName = (_e = (_c = params.structureName) !== null && _c !== void 0 ? _c : (_d = playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes['0']) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : constantToString(MAIN);
|
|
44476
44672
|
var singleElimination = function () {
|
|
44477
44673
|
var matchUps = treeMatchUps(params).matchUps;
|
|
44478
44674
|
var structure = structureTemplate({
|
|
44479
44675
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
44480
|
-
structureName: structureName || main,
|
|
44481
44676
|
stageSequence: stageSequence,
|
|
44677
|
+
structureName: structureName,
|
|
44482
44678
|
matchUpType: matchUpType,
|
|
44483
44679
|
matchUps: matchUps,
|
|
44484
44680
|
stage: stage,
|
|
@@ -44489,9 +44685,9 @@ function getGenerators(params) {
|
|
|
44489
44685
|
_a[AD_HOC] = function () {
|
|
44490
44686
|
var structure = structureTemplate({
|
|
44491
44687
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
44492
|
-
structureName: structureName || main,
|
|
44493
44688
|
finishingPosition: WIN_RATIO,
|
|
44494
44689
|
stageSequence: stageSequence,
|
|
44690
|
+
structureName: structureName,
|
|
44495
44691
|
matchUps: [],
|
|
44496
44692
|
matchUpType: matchUpType,
|
|
44497
44693
|
stage: stage,
|
|
@@ -44502,8 +44698,8 @@ function getGenerators(params) {
|
|
|
44502
44698
|
var matchUps = luckyDraw(params).matchUps;
|
|
44503
44699
|
var structure = structureTemplate({
|
|
44504
44700
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
44505
|
-
structureName: structureName || main,
|
|
44506
44701
|
stageSequence: stageSequence,
|
|
44702
|
+
structureName: structureName,
|
|
44507
44703
|
matchUpType: matchUpType,
|
|
44508
44704
|
matchUps: matchUps,
|
|
44509
44705
|
stage: stage,
|
|
@@ -44513,10 +44709,10 @@ function getGenerators(params) {
|
|
|
44513
44709
|
_a[SINGLE_ELIMINATION] = function () { return singleElimination(); },
|
|
44514
44710
|
_a[DOUBLE_ELIMINATION] = function () { return generateDoubleElimination(params); },
|
|
44515
44711
|
_a[COMPASS] = function () {
|
|
44516
|
-
return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 3, playoffAttributes:
|
|
44712
|
+
return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 3, playoffAttributes: playoffAttributes !== null && playoffAttributes !== void 0 ? playoffAttributes : COMPASS_ATTRIBUTES }));
|
|
44517
44713
|
},
|
|
44518
44714
|
_a[OLYMPIC] = function () {
|
|
44519
|
-
return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 2, playoffAttributes:
|
|
44715
|
+
return generatePlayoffStructures(__assign(__assign({}, params), { roundOffsetLimit: 2, playoffAttributes: playoffAttributes !== null && playoffAttributes !== void 0 ? playoffAttributes : OLYMPIC_ATTRIBUTES }));
|
|
44520
44716
|
},
|
|
44521
44717
|
_a[PLAY_OFF] = function () {
|
|
44522
44718
|
return generatePlayoffStructures(params);
|
|
@@ -44525,8 +44721,8 @@ function getGenerators(params) {
|
|
|
44525
44721
|
var matchUps = feedInMatchUps({ drawSize: drawSize, uuids: uuids, matchUpType: matchUpType }).matchUps;
|
|
44526
44722
|
var structure = structureTemplate({
|
|
44527
44723
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
44528
|
-
structureName: structureName || main,
|
|
44529
44724
|
stageSequence: stageSequence,
|
|
44725
|
+
structureName: structureName,
|
|
44530
44726
|
matchUpType: matchUpType,
|
|
44531
44727
|
stage: MAIN,
|
|
44532
44728
|
matchUps: matchUps,
|
|
@@ -47737,8 +47933,8 @@ function generateQualifyingStructure$1(params) {
|
|
|
47737
47933
|
var stageSequenceName = "".concat(stageSequence);
|
|
47738
47934
|
var qualifyingStructureName = structureName ||
|
|
47739
47935
|
(roundTargetName || stageSequenceName
|
|
47740
|
-
? "".concat(QUALIFYING, " ").concat(roundTargetName).concat(stageSequenceName)
|
|
47741
|
-
: QUALIFYING);
|
|
47936
|
+
? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
|
|
47937
|
+
: constantToString(QUALIFYING));
|
|
47742
47938
|
if (drawType === ROUND_ROBIN) {
|
|
47743
47939
|
var _e = generateRoundRobin({
|
|
47744
47940
|
structureName: structureName || qualifyingStructureName,
|
|
@@ -63053,8 +63249,8 @@ function prepareStage(params) {
|
|
|
63053
63249
|
}).scaledEntries;
|
|
63054
63250
|
if (!(scaledEntries === null || scaledEntries === void 0 ? void 0 : scaledEntries.length) && seedByRanking) {
|
|
63055
63251
|
var rankingScaleAttributes = {
|
|
63056
|
-
scaleType: RANKING$1,
|
|
63057
63252
|
scaleName: categoryName || ageCategoryCode,
|
|
63253
|
+
scaleType: RANKING$1,
|
|
63058
63254
|
eventType: eventType,
|
|
63059
63255
|
};
|
|
63060
63256
|
(scaledEntries = getScaledEntries({
|
|
@@ -66553,7 +66749,7 @@ function generatePersons(params) {
|
|
|
66553
66749
|
shuffledPersons.push(person);
|
|
66554
66750
|
});
|
|
66555
66751
|
}
|
|
66556
|
-
var _d =
|
|
66752
|
+
var _d = getCategoryAgeDetails({
|
|
66557
66753
|
consideredDate: consideredDate,
|
|
66558
66754
|
category: category,
|
|
66559
66755
|
}), ageMinDate = _d.ageMinDate, ageMaxDate = _d.ageMaxDate;
|
|
@@ -69631,7 +69827,8 @@ var utilities = {
|
|
|
69631
69827
|
nextPowerOf2: nextPowerOf2,
|
|
69632
69828
|
numericSort: numericSort,
|
|
69633
69829
|
overlap: overlap,
|
|
69634
|
-
|
|
69830
|
+
getCategoryAgeDetails: getCategoryAgeDetails,
|
|
69831
|
+
categoryCanContain: categoryCanContain,
|
|
69635
69832
|
randomMember: randomMember,
|
|
69636
69833
|
randomPop: randomPop,
|
|
69637
69834
|
shuffleArray: shuffleArray,
|