tods-competition-factory 1.8.25 → 1.8.27
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 +6 -1
- package/dist/forge/generate.mjs +244 -168
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +1 -1
- package/dist/forge/query.mjs +32 -6
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +186 -134
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +5 -2
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +565 -454
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +630 -553
- 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 +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1298,18 +1298,21 @@ function cycleMutationStatus$1() {
|
|
|
1298
1298
|
return status;
|
|
1299
1299
|
}
|
|
1300
1300
|
function addNotice$1({ topic, payload, key }) {
|
|
1301
|
-
syncGlobalState.modified = true;
|
|
1302
1301
|
if (typeof topic !== "string" || typeof payload !== "object") {
|
|
1303
1302
|
return;
|
|
1304
1303
|
}
|
|
1305
|
-
if (syncGlobalState.disableNotifications
|
|
1304
|
+
if (!syncGlobalState.disableNotifications)
|
|
1305
|
+
syncGlobalState.modified = true;
|
|
1306
|
+
if (syncGlobalState.disableNotifications || !syncGlobalState.subscriptions[topic]) {
|
|
1306
1307
|
return;
|
|
1308
|
+
}
|
|
1307
1309
|
if (key) {
|
|
1308
1310
|
syncGlobalState.notices = syncGlobalState.notices.filter(
|
|
1309
1311
|
(notice) => !(notice.topic === topic && notice.key === key)
|
|
1310
1312
|
);
|
|
1311
1313
|
}
|
|
1312
1314
|
syncGlobalState.notices.push({ topic, payload, key });
|
|
1315
|
+
return { ...SUCCESS };
|
|
1313
1316
|
}
|
|
1314
1317
|
function getNotices$1({ topic }) {
|
|
1315
1318
|
const notices = syncGlobalState.notices.filter((notice) => notice.topic === topic).map((notice) => notice.payload);
|
|
@@ -1424,6 +1427,13 @@ function getDevContext(contextCriteria) {
|
|
|
1424
1427
|
) && globalState.devContext;
|
|
1425
1428
|
}
|
|
1426
1429
|
}
|
|
1430
|
+
function setGlobalLog(loggingFx) {
|
|
1431
|
+
if (typeof loggingFx === "function") {
|
|
1432
|
+
globalState.globalLog = loggingFx;
|
|
1433
|
+
} else {
|
|
1434
|
+
delete globalState.globalLog;
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1427
1437
|
function setDevContext(value) {
|
|
1428
1438
|
globalState.devContext = value;
|
|
1429
1439
|
}
|
|
@@ -1526,6 +1536,13 @@ function handleCaughtError({
|
|
|
1526
1536
|
err
|
|
1527
1537
|
});
|
|
1528
1538
|
}
|
|
1539
|
+
function globalLog$1(engine, log) {
|
|
1540
|
+
if (globalState.globalLog) {
|
|
1541
|
+
return globalState.globalLog(engine, log);
|
|
1542
|
+
} else {
|
|
1543
|
+
console.log(engine, log);
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1529
1546
|
|
|
1530
1547
|
const validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
|
|
1531
1548
|
const validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
|
|
@@ -2387,7 +2404,7 @@ const matchUpFormatCode = {
|
|
|
2387
2404
|
};
|
|
2388
2405
|
|
|
2389
2406
|
function factoryVersion() {
|
|
2390
|
-
return "1.8.
|
|
2407
|
+
return "1.8.27";
|
|
2391
2408
|
}
|
|
2392
2409
|
|
|
2393
2410
|
function getObjectTieFormat(obj) {
|
|
@@ -2450,260 +2467,6 @@ function resolveTieFormat({
|
|
|
2450
2467
|
};
|
|
2451
2468
|
}
|
|
2452
2469
|
|
|
2453
|
-
const typeMatch = (arr, type) => arr.filter(Boolean).every((i) => typeof i === type);
|
|
2454
|
-
const allNumeric = (arr) => arr.filter(Boolean).every(isNumeric);
|
|
2455
|
-
function getCategoryAgeDetails(params) {
|
|
2456
|
-
const category = params.category;
|
|
2457
|
-
if (typeof category !== "object")
|
|
2458
|
-
return { error: INVALID_CATEGORY };
|
|
2459
|
-
let { ageCategoryCode, ageMaxDate, ageMinDate, ageMax, ageMin } = category;
|
|
2460
|
-
const categoryName = category.categoryName;
|
|
2461
|
-
let combinedAge;
|
|
2462
|
-
if (!typeMatch(
|
|
2463
|
-
[ageCategoryCode, ageMaxDate, ageMinDate, categoryName],
|
|
2464
|
-
"string"
|
|
2465
|
-
) || !allNumeric(
|
|
2466
|
-
[ageMax, ageMin]
|
|
2467
|
-
))
|
|
2468
|
-
return { error: INVALID_CATEGORY };
|
|
2469
|
-
const consideredDate = params.consideredDate ?? extractDate((/* @__PURE__ */ new Date()).toLocaleDateString("sv"));
|
|
2470
|
-
if (!isValidDateString(consideredDate))
|
|
2471
|
-
return { error: INVALID_DATE };
|
|
2472
|
-
const [consideredYear] = consideredDate.split("-").slice(0, 3).map((n) => parseInt(n));
|
|
2473
|
-
const previousDayDate = dateStringDaysChange(consideredDate, -1);
|
|
2474
|
-
const [previousDayMonth, previousDay] = previousDayDate.split("-").slice(1, 3).map((n) => parseInt(n));
|
|
2475
|
-
const previousMonthDay = `${zeroPad(previousDayMonth)}-${zeroPad(
|
|
2476
|
-
previousDay
|
|
2477
|
-
)}`;
|
|
2478
|
-
const nextDayDate = dateStringDaysChange(consideredDate, 1);
|
|
2479
|
-
const [nextDayMonth, nextDay] = nextDayDate.split("-").slice(1, 3).map((n) => parseInt(n));
|
|
2480
|
-
const nextMonthDay = `${zeroPad(nextDayMonth)}-${zeroPad(nextDay)}`;
|
|
2481
|
-
let calculatedAgeMaxDate = ageMin && dateStringDaysChange(consideredDate, -1 * 365 * ageMin);
|
|
2482
|
-
let calculatedAgeMinDate = ageMax && dateStringDaysChange(consideredDate, -1 * 365 * ageMax);
|
|
2483
|
-
const errors = [];
|
|
2484
|
-
const addError = (errorString) => !errors.includes(errorString) && errors.push(errorString);
|
|
2485
|
-
ageCategoryCode = ageCategoryCode ?? categoryName;
|
|
2486
|
-
const prePost = /^([UO]?)(\d{1,2})([UO]?)$/;
|
|
2487
|
-
const extractCombined = /^C(\d{1,2})-(\d{1,2})$/;
|
|
2488
|
-
const isBetween = ageCategoryCode?.includes("-");
|
|
2489
|
-
const isCombined = isBetween && ageCategoryCode?.match(extractCombined);
|
|
2490
|
-
const isCoded = ageCategoryCode?.match(prePost);
|
|
2491
|
-
const constructedDate = (y, df) => `${y}-${df}`;
|
|
2492
|
-
const uPre = (ageInt) => {
|
|
2493
|
-
const ageMinYear = consideredYear - ageInt;
|
|
2494
|
-
const newMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2495
|
-
if (category.ageMinDate && category.ageMinDate !== newMinDate)
|
|
2496
|
-
addError(`Invalid submitted ageMinDate: ${ageMinDate}`);
|
|
2497
|
-
ageMinDate = newMinDate;
|
|
2498
|
-
if (ageCategoryCode) {
|
|
2499
|
-
if (category.ageMax && category.ageMax !== ageInt - 1) {
|
|
2500
|
-
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2501
|
-
calculatedAgeMinDate = void 0;
|
|
2502
|
-
}
|
|
2503
|
-
ageMax = ageInt - 1;
|
|
2504
|
-
}
|
|
2505
|
-
};
|
|
2506
|
-
const uPost = (ageInt) => {
|
|
2507
|
-
const ageMinYear = consideredYear - ageInt - 1;
|
|
2508
|
-
const newMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2509
|
-
if (category.ageMin && category.ageMin > ageInt) {
|
|
2510
|
-
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2511
|
-
}
|
|
2512
|
-
if (category.ageMax && category.ageMax > ageInt) {
|
|
2513
|
-
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2514
|
-
}
|
|
2515
|
-
if (category.ageMinDate && category.ageMinDate !== newMinDate)
|
|
2516
|
-
addError(`Invalid submitted ageMinDate: ${ageMinDate}`);
|
|
2517
|
-
ageMinDate = newMinDate;
|
|
2518
|
-
if (ageCategoryCode) {
|
|
2519
|
-
if (category.ageMax && category.ageMax !== ageInt) {
|
|
2520
|
-
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2521
|
-
calculatedAgeMaxDate = void 0;
|
|
2522
|
-
}
|
|
2523
|
-
ageMax = ageInt;
|
|
2524
|
-
}
|
|
2525
|
-
};
|
|
2526
|
-
const oPre = (ageInt) => {
|
|
2527
|
-
const ageMaxYear = consideredYear - ageInt;
|
|
2528
|
-
const newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2529
|
-
if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
|
|
2530
|
-
addError(`Invalid submitted ageMaxDate: ${ageMaxDate}`);
|
|
2531
|
-
ageMaxDate = newMaxDate;
|
|
2532
|
-
if (ageCategoryCode) {
|
|
2533
|
-
if (category.ageMin && category.ageMin !== ageInt + 1) {
|
|
2534
|
-
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2535
|
-
calculatedAgeMaxDate = void 0;
|
|
2536
|
-
}
|
|
2537
|
-
ageMin = ageInt + 1;
|
|
2538
|
-
}
|
|
2539
|
-
};
|
|
2540
|
-
const oPost = (ageInt) => {
|
|
2541
|
-
const ageMaxYear = consideredYear - ageInt - 1;
|
|
2542
|
-
const newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2543
|
-
if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
|
|
2544
|
-
addError(`Invalid submitted ageMaxDate: ${ageMaxDate}`);
|
|
2545
|
-
ageMaxDate = newMaxDate;
|
|
2546
|
-
if (ageCategoryCode) {
|
|
2547
|
-
if (category.ageMin && category.ageMin !== ageInt) {
|
|
2548
|
-
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2549
|
-
calculatedAgeMaxDate = void 0;
|
|
2550
|
-
}
|
|
2551
|
-
ageMin = ageInt;
|
|
2552
|
-
}
|
|
2553
|
-
};
|
|
2554
|
-
const processCode = (code) => {
|
|
2555
|
-
const [pre, age, post] = (code.match(prePost) || []).slice(1);
|
|
2556
|
-
const ageInt = parseInt(age);
|
|
2557
|
-
if (pre === "U") {
|
|
2558
|
-
if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
|
|
2559
|
-
addError(`Invalid submitted ageMaxDate: ${category.ageMaxDate}`);
|
|
2560
|
-
}
|
|
2561
|
-
uPre(ageInt);
|
|
2562
|
-
} else if (pre === "O") {
|
|
2563
|
-
oPre(ageInt);
|
|
2564
|
-
}
|
|
2565
|
-
if (post === "U") {
|
|
2566
|
-
if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
|
|
2567
|
-
addError(`Invalid submitted ageMaxDate: ${category.ageMaxDate}`);
|
|
2568
|
-
}
|
|
2569
|
-
uPost(ageInt);
|
|
2570
|
-
} else if (post === "O") {
|
|
2571
|
-
oPost(ageInt);
|
|
2572
|
-
}
|
|
2573
|
-
ageMaxDate = ageMaxDate ?? calculatedAgeMaxDate;
|
|
2574
|
-
ageMinDate = ageMinDate ?? calculatedAgeMinDate;
|
|
2575
|
-
};
|
|
2576
|
-
if (isCombined) {
|
|
2577
|
-
ageMaxDate = void 0;
|
|
2578
|
-
ageMinDate = void 0;
|
|
2579
|
-
ageMax = void 0;
|
|
2580
|
-
ageMin = void 0;
|
|
2581
|
-
if (category.ageMin) {
|
|
2582
|
-
const ageMaxYear = consideredYear - category.ageMin;
|
|
2583
|
-
ageMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2584
|
-
}
|
|
2585
|
-
if (category.ageMax) {
|
|
2586
|
-
const ageMinYear = consideredYear - category.ageMax - 1;
|
|
2587
|
-
ageMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2588
|
-
}
|
|
2589
|
-
const [lowAge, highAge] = (ageCategoryCode?.match(extractCombined) ?? []).slice(1).map((n) => parseInt(n));
|
|
2590
|
-
if (lowAge <= highAge) {
|
|
2591
|
-
ageMin = lowAge;
|
|
2592
|
-
ageMax = highAge;
|
|
2593
|
-
combinedAge = true;
|
|
2594
|
-
} else {
|
|
2595
|
-
addError(`Invalid combined age range ${ageCategoryCode}`);
|
|
2596
|
-
}
|
|
2597
|
-
} else if (isBetween) {
|
|
2598
|
-
ageCategoryCode?.split("-").forEach(processCode);
|
|
2599
|
-
} else if (isCoded) {
|
|
2600
|
-
processCode(ageCategoryCode);
|
|
2601
|
-
} else {
|
|
2602
|
-
if (ageMin)
|
|
2603
|
-
oPre(ageMin);
|
|
2604
|
-
if (ageMax)
|
|
2605
|
-
uPost(ageMax);
|
|
2606
|
-
}
|
|
2607
|
-
if (ageMax && category.ageMin && category.ageMin > ageMax) {
|
|
2608
|
-
addError(`Invalid submitted ageMin: ${category.ageMin}`);
|
|
2609
|
-
ageMin = void 0;
|
|
2610
|
-
}
|
|
2611
|
-
const result = definedAttributes({
|
|
2612
|
-
consideredDate,
|
|
2613
|
-
combinedAge,
|
|
2614
|
-
ageMaxDate,
|
|
2615
|
-
ageMinDate,
|
|
2616
|
-
ageMax,
|
|
2617
|
-
ageMin
|
|
2618
|
-
});
|
|
2619
|
-
if (errors.length)
|
|
2620
|
-
result.errors = errors;
|
|
2621
|
-
return result;
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
function decorateResult({
|
|
2625
|
-
context,
|
|
2626
|
-
result,
|
|
2627
|
-
stack,
|
|
2628
|
-
info
|
|
2629
|
-
}) {
|
|
2630
|
-
if (result && !Array.isArray(result?.stack))
|
|
2631
|
-
result.stack = [];
|
|
2632
|
-
if (result && Array.isArray(result?.stack) && typeof stack === "string") {
|
|
2633
|
-
result.stack.push(stack);
|
|
2634
|
-
}
|
|
2635
|
-
if (result && info) {
|
|
2636
|
-
result.info = info;
|
|
2637
|
-
}
|
|
2638
|
-
if (result && typeof context === "object" && Object.keys(context).length) {
|
|
2639
|
-
Object.assign(result, definedAttributes(context));
|
|
2640
|
-
}
|
|
2641
|
-
if (result && !result?.error && !result?.success) {
|
|
2642
|
-
Object.assign(result, { ...SUCCESS });
|
|
2643
|
-
}
|
|
2644
|
-
return result ?? { success: true };
|
|
2645
|
-
}
|
|
2646
|
-
|
|
2647
|
-
function validateCategory({ category }) {
|
|
2648
|
-
if (!isObject(category))
|
|
2649
|
-
return { error: INVALID_VALUES };
|
|
2650
|
-
const categoryDetails = getCategoryAgeDetails({ category });
|
|
2651
|
-
if (categoryDetails.error)
|
|
2652
|
-
return { error: categoryDetails };
|
|
2653
|
-
const { ratingMax, ratingMin } = category;
|
|
2654
|
-
if (ratingMax && !isNumeric(ratingMax))
|
|
2655
|
-
return decorateResult({
|
|
2656
|
-
result: { error: INVALID_VALUES },
|
|
2657
|
-
context: { ratingMax }
|
|
2658
|
-
});
|
|
2659
|
-
if (ratingMin && !isNumeric(ratingMin))
|
|
2660
|
-
return decorateResult({
|
|
2661
|
-
result: { error: INVALID_VALUES },
|
|
2662
|
-
context: { ratingMin }
|
|
2663
|
-
});
|
|
2664
|
-
return { ...categoryDetails };
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
function categoryCanContain({
|
|
2668
|
-
childCategory,
|
|
2669
|
-
withDetails,
|
|
2670
|
-
category
|
|
2671
|
-
}) {
|
|
2672
|
-
const categoryDetails = validateCategory({ category });
|
|
2673
|
-
const childCategoryDetails = validateCategory({
|
|
2674
|
-
category: childCategory
|
|
2675
|
-
});
|
|
2676
|
-
const invalidAgeMin = childCategoryDetails.ageMin && (categoryDetails.ageMin && childCategoryDetails.ageMin < categoryDetails.ageMin || categoryDetails.ageMax && childCategoryDetails.ageMin > categoryDetails.ageMax);
|
|
2677
|
-
const invalidAgeMax = childCategoryDetails.ageMax && (categoryDetails.ageMax && childCategoryDetails.ageMax > categoryDetails.ageMax || categoryDetails.ageMin && childCategoryDetails.ageMax < categoryDetails.ageMin);
|
|
2678
|
-
const invalidAgeMinDate = childCategoryDetails.ageMinDate && categoryDetails.ageMaxDate && new Date(childCategoryDetails.ageMinDate) > new Date(categoryDetails.ageMaxDate);
|
|
2679
|
-
const invalidAgeMaxDate = childCategoryDetails.ageMaxDate && categoryDetails.ageMinDate && new Date(childCategoryDetails.ageMaxDate) < new Date(categoryDetails.ageMinDate);
|
|
2680
|
-
const ratingComparison = category.ratingType && childCategory.ratingType && category.ratingType === childCategory.ratingType;
|
|
2681
|
-
const invalidRatingRange = ratingComparison && (category.ratingMin && childCategory.ratingMin && childCategory.ratingMin < category.ratingMin || category.ratingMax && childCategory.ratingMax && childCategory.ratingMax > category.ratingMax || category.ratingMin && childCategory.ratingMax && childCategory.ratingMax < category.ratingMin || category.ratingMax && childCategory.ratingMin && childCategory.ratingMin > category.ratingMax);
|
|
2682
|
-
const invalidBallType = category.ballType && childCategory.ballType && category.ballType !== childCategory.ballType;
|
|
2683
|
-
const valid = !invalidRatingRange && !invalidAgeMinDate && !invalidAgeMaxDate && !invalidBallType && !invalidAgeMax && !invalidAgeMin;
|
|
2684
|
-
const ignoreFalse = true;
|
|
2685
|
-
const result = definedAttributes(
|
|
2686
|
-
{
|
|
2687
|
-
invalidRatingRange,
|
|
2688
|
-
invalidAgeMinDate,
|
|
2689
|
-
invalidAgeMaxDate,
|
|
2690
|
-
invalidBallType,
|
|
2691
|
-
invalidAgeMax,
|
|
2692
|
-
invalidAgeMin,
|
|
2693
|
-
valid
|
|
2694
|
-
},
|
|
2695
|
-
ignoreFalse
|
|
2696
|
-
);
|
|
2697
|
-
if (withDetails) {
|
|
2698
|
-
Object.assign(result, { categoryDetails, childCategoryDetails });
|
|
2699
|
-
}
|
|
2700
|
-
return result;
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
function mustBeAnArray(value) {
|
|
2704
|
-
return `${value} must be an array`;
|
|
2705
|
-
}
|
|
2706
|
-
|
|
2707
2470
|
var DrawTypeEnum = /* @__PURE__ */ ((DrawTypeEnum2) => {
|
|
2708
2471
|
DrawTypeEnum2["AdHoc"] = "AD_HOC";
|
|
2709
2472
|
DrawTypeEnum2["Compass"] = "COMPASS";
|
|
@@ -2818,6 +2581,296 @@ var ParticipantTypeEnum = /* @__PURE__ */ ((ParticipantTypeEnum2) => {
|
|
|
2818
2581
|
return ParticipantTypeEnum2;
|
|
2819
2582
|
})(ParticipantTypeEnum || {});
|
|
2820
2583
|
|
|
2584
|
+
function decorateResult({
|
|
2585
|
+
context,
|
|
2586
|
+
result,
|
|
2587
|
+
stack,
|
|
2588
|
+
info
|
|
2589
|
+
}) {
|
|
2590
|
+
if (result && !Array.isArray(result?.stack))
|
|
2591
|
+
result.stack = [];
|
|
2592
|
+
if (result && Array.isArray(result?.stack) && typeof stack === "string") {
|
|
2593
|
+
result.stack.push(stack);
|
|
2594
|
+
}
|
|
2595
|
+
if (result && info) {
|
|
2596
|
+
result.info = info;
|
|
2597
|
+
}
|
|
2598
|
+
if (result && typeof context === "object" && Object.keys(context).length) {
|
|
2599
|
+
Object.assign(result, definedAttributes(context));
|
|
2600
|
+
}
|
|
2601
|
+
if (result && !result?.error && !result?.success) {
|
|
2602
|
+
Object.assign(result, { ...SUCCESS });
|
|
2603
|
+
}
|
|
2604
|
+
return result ?? { success: true };
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
const ANY = "ANY";
|
|
2608
|
+
const MALE = "MALE";
|
|
2609
|
+
const MIXED = "MIXED";
|
|
2610
|
+
const OTHER$3 = "OTHER";
|
|
2611
|
+
const FEMALE = "FEMALE";
|
|
2612
|
+
const genderConstants = {
|
|
2613
|
+
ANY,
|
|
2614
|
+
MALE,
|
|
2615
|
+
FEMALE,
|
|
2616
|
+
MIXED,
|
|
2617
|
+
OTHER: OTHER$3
|
|
2618
|
+
};
|
|
2619
|
+
|
|
2620
|
+
function genderValidityCheck({
|
|
2621
|
+
referenceGender,
|
|
2622
|
+
matchUpType,
|
|
2623
|
+
gender
|
|
2624
|
+
}) {
|
|
2625
|
+
const stack = "genderValidityCheck";
|
|
2626
|
+
if (referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && [GenderEnum.Male, GenderEnum.Female].includes(gender)) {
|
|
2627
|
+
const valid = gender === referenceGender;
|
|
2628
|
+
return valid ? { valid: true } : decorateResult({
|
|
2629
|
+
result: { valid: false, error: INVALID_GENDER },
|
|
2630
|
+
context: { gender },
|
|
2631
|
+
stack
|
|
2632
|
+
});
|
|
2633
|
+
}
|
|
2634
|
+
if (matchUpType === TypeEnum.Singles && referenceGender === MIXED)
|
|
2635
|
+
return decorateResult({
|
|
2636
|
+
info: "matchUpType SINGLES is invalid for gender MIXED",
|
|
2637
|
+
result: { error: INVALID_GENDER, valid: false },
|
|
2638
|
+
stack
|
|
2639
|
+
});
|
|
2640
|
+
return { valid: true };
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
const typeMatch = (arr, type) => arr.filter(Boolean).every((i) => typeof i === type);
|
|
2644
|
+
const allNumeric = (arr) => arr.filter(Boolean).every(isNumeric);
|
|
2645
|
+
function getCategoryAgeDetails(params) {
|
|
2646
|
+
const category = params.category;
|
|
2647
|
+
if (typeof category !== "object")
|
|
2648
|
+
return { error: INVALID_CATEGORY };
|
|
2649
|
+
let { ageCategoryCode, ageMaxDate, ageMinDate, ageMax, ageMin } = category;
|
|
2650
|
+
const categoryName = category.categoryName;
|
|
2651
|
+
let combinedAge;
|
|
2652
|
+
if (!typeMatch(
|
|
2653
|
+
[ageCategoryCode, ageMaxDate, ageMinDate, categoryName],
|
|
2654
|
+
"string"
|
|
2655
|
+
) || !allNumeric(
|
|
2656
|
+
[ageMax, ageMin]
|
|
2657
|
+
))
|
|
2658
|
+
return { error: INVALID_CATEGORY };
|
|
2659
|
+
const consideredDate = params.consideredDate ?? extractDate((/* @__PURE__ */ new Date()).toLocaleDateString("sv"));
|
|
2660
|
+
if (!isValidDateString(consideredDate))
|
|
2661
|
+
return { error: INVALID_DATE };
|
|
2662
|
+
const [consideredYear] = consideredDate.split("-").slice(0, 3).map((n) => parseInt(n));
|
|
2663
|
+
const previousDayDate = dateStringDaysChange(consideredDate, -1);
|
|
2664
|
+
const [previousDayMonth, previousDay] = previousDayDate.split("-").slice(1, 3).map((n) => parseInt(n));
|
|
2665
|
+
const previousMonthDay = `${zeroPad(previousDayMonth)}-${zeroPad(
|
|
2666
|
+
previousDay
|
|
2667
|
+
)}`;
|
|
2668
|
+
const nextDayDate = dateStringDaysChange(consideredDate, 1);
|
|
2669
|
+
const [nextDayMonth, nextDay] = nextDayDate.split("-").slice(1, 3).map((n) => parseInt(n));
|
|
2670
|
+
const nextMonthDay = `${zeroPad(nextDayMonth)}-${zeroPad(nextDay)}`;
|
|
2671
|
+
let calculatedAgeMaxDate = ageMin && dateStringDaysChange(consideredDate, -1 * 365 * ageMin);
|
|
2672
|
+
let calculatedAgeMinDate = ageMax && dateStringDaysChange(consideredDate, -1 * 365 * ageMax);
|
|
2673
|
+
const errors = [];
|
|
2674
|
+
const addError = (errorString) => !errors.includes(errorString) && errors.push(errorString);
|
|
2675
|
+
ageCategoryCode = ageCategoryCode ?? categoryName;
|
|
2676
|
+
const prePost = /^([UO]?)(\d{1,2})([UO]?)$/;
|
|
2677
|
+
const extractCombined = /^C(\d{1,2})-(\d{1,2})$/;
|
|
2678
|
+
const isBetween = ageCategoryCode?.includes("-");
|
|
2679
|
+
const isCombined = isBetween && ageCategoryCode?.match(extractCombined);
|
|
2680
|
+
const isCoded = ageCategoryCode?.match(prePost);
|
|
2681
|
+
const constructedDate = (y, df) => `${y}-${df}`;
|
|
2682
|
+
const uPre = (ageInt) => {
|
|
2683
|
+
const ageMinYear = consideredYear - ageInt;
|
|
2684
|
+
const newMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2685
|
+
if (category.ageMinDate && category.ageMinDate !== newMinDate)
|
|
2686
|
+
addError(`Invalid submitted ageMinDate: ${ageMinDate}`);
|
|
2687
|
+
ageMinDate = newMinDate;
|
|
2688
|
+
if (ageCategoryCode) {
|
|
2689
|
+
if (category.ageMax && category.ageMax !== ageInt - 1) {
|
|
2690
|
+
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2691
|
+
calculatedAgeMinDate = void 0;
|
|
2692
|
+
}
|
|
2693
|
+
ageMax = ageInt - 1;
|
|
2694
|
+
}
|
|
2695
|
+
};
|
|
2696
|
+
const uPost = (ageInt) => {
|
|
2697
|
+
const ageMinYear = consideredYear - ageInt - 1;
|
|
2698
|
+
const newMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2699
|
+
if (category.ageMin && category.ageMin > ageInt) {
|
|
2700
|
+
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2701
|
+
}
|
|
2702
|
+
if (category.ageMax && category.ageMax > ageInt) {
|
|
2703
|
+
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2704
|
+
}
|
|
2705
|
+
if (category.ageMinDate && category.ageMinDate !== newMinDate)
|
|
2706
|
+
addError(`Invalid submitted ageMinDate: ${ageMinDate}`);
|
|
2707
|
+
ageMinDate = newMinDate;
|
|
2708
|
+
if (ageCategoryCode) {
|
|
2709
|
+
if (category.ageMax && category.ageMax !== ageInt) {
|
|
2710
|
+
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2711
|
+
calculatedAgeMaxDate = void 0;
|
|
2712
|
+
}
|
|
2713
|
+
ageMax = ageInt;
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
const oPre = (ageInt) => {
|
|
2717
|
+
const ageMaxYear = consideredYear - ageInt;
|
|
2718
|
+
const newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2719
|
+
if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
|
|
2720
|
+
addError(`Invalid submitted ageMaxDate: ${ageMaxDate}`);
|
|
2721
|
+
ageMaxDate = newMaxDate;
|
|
2722
|
+
if (ageCategoryCode) {
|
|
2723
|
+
if (category.ageMin && category.ageMin !== ageInt + 1) {
|
|
2724
|
+
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2725
|
+
calculatedAgeMaxDate = void 0;
|
|
2726
|
+
}
|
|
2727
|
+
ageMin = ageInt + 1;
|
|
2728
|
+
}
|
|
2729
|
+
};
|
|
2730
|
+
const oPost = (ageInt) => {
|
|
2731
|
+
const ageMaxYear = consideredYear - ageInt - 1;
|
|
2732
|
+
const newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2733
|
+
if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
|
|
2734
|
+
addError(`Invalid submitted ageMaxDate: ${ageMaxDate}`);
|
|
2735
|
+
ageMaxDate = newMaxDate;
|
|
2736
|
+
if (ageCategoryCode) {
|
|
2737
|
+
if (category.ageMin && category.ageMin !== ageInt) {
|
|
2738
|
+
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2739
|
+
calculatedAgeMaxDate = void 0;
|
|
2740
|
+
}
|
|
2741
|
+
ageMin = ageInt;
|
|
2742
|
+
}
|
|
2743
|
+
};
|
|
2744
|
+
const processCode = (code) => {
|
|
2745
|
+
const [pre, age, post] = (code.match(prePost) || []).slice(1);
|
|
2746
|
+
const ageInt = parseInt(age);
|
|
2747
|
+
if (pre === "U") {
|
|
2748
|
+
if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
|
|
2749
|
+
addError(`Invalid submitted ageMaxDate: ${category.ageMaxDate}`);
|
|
2750
|
+
}
|
|
2751
|
+
uPre(ageInt);
|
|
2752
|
+
} else if (pre === "O") {
|
|
2753
|
+
oPre(ageInt);
|
|
2754
|
+
}
|
|
2755
|
+
if (post === "U") {
|
|
2756
|
+
if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
|
|
2757
|
+
addError(`Invalid submitted ageMaxDate: ${category.ageMaxDate}`);
|
|
2758
|
+
}
|
|
2759
|
+
uPost(ageInt);
|
|
2760
|
+
} else if (post === "O") {
|
|
2761
|
+
oPost(ageInt);
|
|
2762
|
+
}
|
|
2763
|
+
ageMaxDate = ageMaxDate ?? calculatedAgeMaxDate;
|
|
2764
|
+
ageMinDate = ageMinDate ?? calculatedAgeMinDate;
|
|
2765
|
+
};
|
|
2766
|
+
if (isCombined) {
|
|
2767
|
+
ageMaxDate = void 0;
|
|
2768
|
+
ageMinDate = void 0;
|
|
2769
|
+
ageMax = void 0;
|
|
2770
|
+
ageMin = void 0;
|
|
2771
|
+
if (category.ageMin) {
|
|
2772
|
+
const ageMaxYear = consideredYear - category.ageMin;
|
|
2773
|
+
ageMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2774
|
+
}
|
|
2775
|
+
if (category.ageMax) {
|
|
2776
|
+
const ageMinYear = consideredYear - category.ageMax - 1;
|
|
2777
|
+
ageMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2778
|
+
}
|
|
2779
|
+
const [lowAge, highAge] = (ageCategoryCode?.match(extractCombined) ?? []).slice(1).map((n) => parseInt(n));
|
|
2780
|
+
if (lowAge <= highAge) {
|
|
2781
|
+
ageMin = lowAge;
|
|
2782
|
+
ageMax = highAge;
|
|
2783
|
+
combinedAge = true;
|
|
2784
|
+
} else {
|
|
2785
|
+
addError(`Invalid combined age range ${ageCategoryCode}`);
|
|
2786
|
+
}
|
|
2787
|
+
} else if (isBetween) {
|
|
2788
|
+
ageCategoryCode?.split("-").forEach(processCode);
|
|
2789
|
+
} else if (isCoded) {
|
|
2790
|
+
processCode(ageCategoryCode);
|
|
2791
|
+
} else {
|
|
2792
|
+
if (ageMin)
|
|
2793
|
+
oPre(ageMin);
|
|
2794
|
+
if (ageMax)
|
|
2795
|
+
uPost(ageMax);
|
|
2796
|
+
}
|
|
2797
|
+
if (ageMax && category.ageMin && category.ageMin > ageMax) {
|
|
2798
|
+
addError(`Invalid submitted ageMin: ${category.ageMin}`);
|
|
2799
|
+
ageMin = void 0;
|
|
2800
|
+
}
|
|
2801
|
+
const result = definedAttributes({
|
|
2802
|
+
consideredDate,
|
|
2803
|
+
combinedAge,
|
|
2804
|
+
ageMaxDate,
|
|
2805
|
+
ageMinDate,
|
|
2806
|
+
ageMax,
|
|
2807
|
+
ageMin
|
|
2808
|
+
});
|
|
2809
|
+
if (errors.length)
|
|
2810
|
+
result.errors = errors;
|
|
2811
|
+
return result;
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
function validateCategory({ category }) {
|
|
2815
|
+
if (!isObject(category))
|
|
2816
|
+
return { error: INVALID_VALUES };
|
|
2817
|
+
const categoryDetails = getCategoryAgeDetails({ category });
|
|
2818
|
+
if (categoryDetails.error)
|
|
2819
|
+
return { error: categoryDetails };
|
|
2820
|
+
const { ratingMax, ratingMin } = category;
|
|
2821
|
+
if (ratingMax && !isNumeric(ratingMax))
|
|
2822
|
+
return decorateResult({
|
|
2823
|
+
result: { error: INVALID_VALUES },
|
|
2824
|
+
context: { ratingMax }
|
|
2825
|
+
});
|
|
2826
|
+
if (ratingMin && !isNumeric(ratingMin))
|
|
2827
|
+
return decorateResult({
|
|
2828
|
+
result: { error: INVALID_VALUES },
|
|
2829
|
+
context: { ratingMin }
|
|
2830
|
+
});
|
|
2831
|
+
return { ...categoryDetails };
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
function categoryCanContain({
|
|
2835
|
+
childCategory,
|
|
2836
|
+
withDetails,
|
|
2837
|
+
category
|
|
2838
|
+
}) {
|
|
2839
|
+
const categoryDetails = validateCategory({ category });
|
|
2840
|
+
const childCategoryDetails = validateCategory({
|
|
2841
|
+
category: childCategory
|
|
2842
|
+
});
|
|
2843
|
+
const invalidAgeMin = childCategoryDetails.ageMin && (categoryDetails.ageMin && childCategoryDetails.ageMin < categoryDetails.ageMin || categoryDetails.ageMax && childCategoryDetails.ageMin > categoryDetails.ageMax);
|
|
2844
|
+
const invalidAgeMax = childCategoryDetails.ageMax && (categoryDetails.ageMax && childCategoryDetails.ageMax > categoryDetails.ageMax || categoryDetails.ageMin && childCategoryDetails.ageMax < categoryDetails.ageMin);
|
|
2845
|
+
const invalidAgeMinDate = childCategoryDetails.ageMinDate && categoryDetails.ageMaxDate && new Date(childCategoryDetails.ageMinDate) > new Date(categoryDetails.ageMaxDate);
|
|
2846
|
+
const invalidAgeMaxDate = childCategoryDetails.ageMaxDate && categoryDetails.ageMinDate && new Date(childCategoryDetails.ageMaxDate) < new Date(categoryDetails.ageMinDate);
|
|
2847
|
+
const ratingComparison = category.ratingType && childCategory.ratingType && category.ratingType === childCategory.ratingType;
|
|
2848
|
+
const invalidRatingRange = ratingComparison && (category.ratingMin && childCategory.ratingMin && childCategory.ratingMin < category.ratingMin || category.ratingMax && childCategory.ratingMax && childCategory.ratingMax > category.ratingMax || category.ratingMin && childCategory.ratingMax && childCategory.ratingMax < category.ratingMin || category.ratingMax && childCategory.ratingMin && childCategory.ratingMin > category.ratingMax);
|
|
2849
|
+
const invalidBallType = category.ballType && childCategory.ballType && category.ballType !== childCategory.ballType;
|
|
2850
|
+
const valid = !invalidRatingRange && !invalidAgeMinDate && !invalidAgeMaxDate && !invalidBallType && !invalidAgeMax && !invalidAgeMin;
|
|
2851
|
+
const ignoreFalse = true;
|
|
2852
|
+
const result = definedAttributes(
|
|
2853
|
+
{
|
|
2854
|
+
invalidRatingRange,
|
|
2855
|
+
invalidAgeMinDate,
|
|
2856
|
+
invalidAgeMaxDate,
|
|
2857
|
+
invalidBallType,
|
|
2858
|
+
invalidAgeMax,
|
|
2859
|
+
invalidAgeMin,
|
|
2860
|
+
valid
|
|
2861
|
+
},
|
|
2862
|
+
ignoreFalse
|
|
2863
|
+
);
|
|
2864
|
+
if (withDetails) {
|
|
2865
|
+
Object.assign(result, { categoryDetails, childCategoryDetails });
|
|
2866
|
+
}
|
|
2867
|
+
return result;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
function mustBeAnArray(value) {
|
|
2871
|
+
return `${value} must be an array`;
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2821
2874
|
function validateTieFormat(params) {
|
|
2822
2875
|
const checkCategory = !!(params?.enforceCategory !== false && params?.category);
|
|
2823
2876
|
const checkGender = !!(params?.enforceGender !== false && params?.gender);
|
|
@@ -2973,13 +3026,19 @@ function validateCollectionDefinition({
|
|
|
2973
3026
|
if (matchUpFormat && !matchUpFormatCode.isValid(matchUpFormat)) {
|
|
2974
3027
|
errors.push(`Invalid matchUpFormat: ${matchUpFormat}`);
|
|
2975
3028
|
}
|
|
2976
|
-
if (checkGender
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
stack
|
|
3029
|
+
if (checkGender) {
|
|
3030
|
+
const result = genderValidityCheck({
|
|
3031
|
+
referenceGender,
|
|
3032
|
+
matchUpType,
|
|
3033
|
+
gender
|
|
2982
3034
|
});
|
|
3035
|
+
if (result.error) {
|
|
3036
|
+
return decorateResult({
|
|
3037
|
+
context: { referenceGender, gender },
|
|
3038
|
+
result,
|
|
3039
|
+
stack
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
2983
3042
|
}
|
|
2984
3043
|
if (checkCategory && referenceCategory && category) {
|
|
2985
3044
|
const result = categoryCanContain({
|
|
@@ -5707,7 +5766,7 @@ const PUBLIC = "PUBLIC";
|
|
|
5707
5766
|
const STATUS$1 = "STATUS";
|
|
5708
5767
|
const MODIFICATION = "MODIFICATION";
|
|
5709
5768
|
const RETRIEVAL = "RETRIEVAL";
|
|
5710
|
-
const OTHER$
|
|
5769
|
+
const OTHER$2 = "other";
|
|
5711
5770
|
const timeItemConstants = {
|
|
5712
5771
|
MUTUALLY_EXCLUSIVE_TIME_MODIFIERS,
|
|
5713
5772
|
AFTER_REST,
|
|
@@ -5726,7 +5785,7 @@ const timeItemConstants = {
|
|
|
5726
5785
|
MODIFICATION,
|
|
5727
5786
|
NEXT_AVAILABLE,
|
|
5728
5787
|
NOT_BEFORE,
|
|
5729
|
-
OTHER: OTHER$
|
|
5788
|
+
OTHER: OTHER$2,
|
|
5730
5789
|
PENALTY: PENALTY$1,
|
|
5731
5790
|
PUBLIC,
|
|
5732
5791
|
PUBLISH,
|
|
@@ -6451,41 +6510,6 @@ function getMatchUpType(params) {
|
|
|
6451
6510
|
return { matchUpType };
|
|
6452
6511
|
}
|
|
6453
6512
|
|
|
6454
|
-
function modifyEntryProfile({
|
|
6455
|
-
drawDefinition,
|
|
6456
|
-
attributes
|
|
6457
|
-
}) {
|
|
6458
|
-
let { extension } = findDrawDefinitionExtension({
|
|
6459
|
-
name: ENTRY_PROFILE,
|
|
6460
|
-
drawDefinition
|
|
6461
|
-
});
|
|
6462
|
-
const entryProfile = extension?.value || {};
|
|
6463
|
-
attributes.forEach((attribute) => {
|
|
6464
|
-
Object.keys(attribute).forEach((key) => {
|
|
6465
|
-
if (!entryProfile[key]) {
|
|
6466
|
-
entryProfile[key] = attribute[key];
|
|
6467
|
-
} else {
|
|
6468
|
-
Object.assign(entryProfile[key], attribute[key]);
|
|
6469
|
-
}
|
|
6470
|
-
});
|
|
6471
|
-
});
|
|
6472
|
-
extension = {
|
|
6473
|
-
name: ENTRY_PROFILE,
|
|
6474
|
-
value: entryProfile
|
|
6475
|
-
};
|
|
6476
|
-
addDrawDefinitionExtension({ drawDefinition, extension });
|
|
6477
|
-
return { entryProfile };
|
|
6478
|
-
}
|
|
6479
|
-
|
|
6480
|
-
function getEntryProfile({ drawDefinition }) {
|
|
6481
|
-
const { extension } = findDrawDefinitionExtension({
|
|
6482
|
-
name: ENTRY_PROFILE,
|
|
6483
|
-
drawDefinition
|
|
6484
|
-
});
|
|
6485
|
-
const entryProfile = extension?.value || {};
|
|
6486
|
-
return { entryProfile };
|
|
6487
|
-
}
|
|
6488
|
-
|
|
6489
6513
|
const MAIN = "MAIN";
|
|
6490
6514
|
const QUALIFYING = "QUALIFYING";
|
|
6491
6515
|
const CONSOLATION = "CONSOLATION";
|
|
@@ -6535,6 +6559,7 @@ const WINNER = "WINNER";
|
|
|
6535
6559
|
const LOSER = "LOSER";
|
|
6536
6560
|
const FIRST_MATCHUP = "FIRST_MATCHUP";
|
|
6537
6561
|
const AD_HOC = "AD_HOC";
|
|
6562
|
+
const FLEX_ROUNDS = "AD_HOC";
|
|
6538
6563
|
const FEED_IN$1 = "FEED_IN";
|
|
6539
6564
|
const COMPASS = "COMPASS";
|
|
6540
6565
|
const OLYMPIC = "OLYMPIC";
|
|
@@ -6626,6 +6651,7 @@ const drawDefinitionConstants = {
|
|
|
6626
6651
|
LOSER,
|
|
6627
6652
|
AD_HOC,
|
|
6628
6653
|
FEED_IN: FEED_IN$1,
|
|
6654
|
+
FLEX_ROUNDS,
|
|
6629
6655
|
COMPASS,
|
|
6630
6656
|
PLAY_OFF,
|
|
6631
6657
|
OLYMPIC,
|
|
@@ -6751,6 +6777,118 @@ function getDrawStructures({
|
|
|
6751
6777
|
}
|
|
6752
6778
|
}
|
|
6753
6779
|
|
|
6780
|
+
function getAllPositionedParticipantIds({
|
|
6781
|
+
drawDefinition
|
|
6782
|
+
}) {
|
|
6783
|
+
if (!drawDefinition)
|
|
6784
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
6785
|
+
const stagePositionedParticipantIds = {};
|
|
6786
|
+
const allPositionedParticipantIds = (drawDefinition.structures || []).map((structure) => {
|
|
6787
|
+
const stage = structure.stage;
|
|
6788
|
+
if (!stagePositionedParticipantIds[stage])
|
|
6789
|
+
stagePositionedParticipantIds[stage] = [];
|
|
6790
|
+
const { positionAssignments } = getPositionAssignments$1({ structure });
|
|
6791
|
+
const particiapntIds = positionAssignments?.map(extractAttributes("participantId")).filter(Boolean) ?? [];
|
|
6792
|
+
stagePositionedParticipantIds[stage].push(...particiapntIds);
|
|
6793
|
+
return particiapntIds;
|
|
6794
|
+
}).flat();
|
|
6795
|
+
return { allPositionedParticipantIds, stagePositionedParticipantIds };
|
|
6796
|
+
}
|
|
6797
|
+
function getPositionAssignments$1({
|
|
6798
|
+
drawDefinition,
|
|
6799
|
+
structureId,
|
|
6800
|
+
structure
|
|
6801
|
+
}) {
|
|
6802
|
+
let error, positionAssignments = [];
|
|
6803
|
+
if (!structure) {
|
|
6804
|
+
if (!drawDefinition) {
|
|
6805
|
+
return { positionAssignments, error: MISSING_DRAW_DEFINITION };
|
|
6806
|
+
}
|
|
6807
|
+
({ structure, error } = findStructure({ drawDefinition, structureId }));
|
|
6808
|
+
if (error)
|
|
6809
|
+
return { positionAssignments, error };
|
|
6810
|
+
}
|
|
6811
|
+
if (structure.structures) {
|
|
6812
|
+
positionAssignments = [].concat(
|
|
6813
|
+
...structure.structures.map((structure2) => {
|
|
6814
|
+
return getPositionAssignments$1({ structure: structure2 }).positionAssignments;
|
|
6815
|
+
})
|
|
6816
|
+
);
|
|
6817
|
+
} else if (structure.positionAssignments) {
|
|
6818
|
+
positionAssignments = structure.positionAssignments;
|
|
6819
|
+
} else {
|
|
6820
|
+
error = MISSING_POSITION_ASSIGNMENTS;
|
|
6821
|
+
}
|
|
6822
|
+
return { positionAssignments, error };
|
|
6823
|
+
}
|
|
6824
|
+
function structureAssignedDrawPositions({
|
|
6825
|
+
drawDefinition,
|
|
6826
|
+
structureId,
|
|
6827
|
+
structure
|
|
6828
|
+
}) {
|
|
6829
|
+
const positionAssignments = getPositionAssignments$1({
|
|
6830
|
+
drawDefinition,
|
|
6831
|
+
structureId,
|
|
6832
|
+
structure
|
|
6833
|
+
})?.positionAssignments || [];
|
|
6834
|
+
const assignedPositions = positionAssignments?.filter((assignment) => {
|
|
6835
|
+
return assignment.participantId ?? assignment.bye ?? assignment.qualifier;
|
|
6836
|
+
});
|
|
6837
|
+
const allPositionsAssigned = positionAssignments && positionAssignments?.length === assignedPositions?.length;
|
|
6838
|
+
const unassignedPositions = positionAssignments?.filter((assignment) => {
|
|
6839
|
+
return !assignment.participantId && !assignment.bye && !assignment.qualifier;
|
|
6840
|
+
});
|
|
6841
|
+
const byePositions = positionAssignments?.filter((assignment) => {
|
|
6842
|
+
return !assignment.participantId && assignment.bye;
|
|
6843
|
+
});
|
|
6844
|
+
const qualifierPositions = positionAssignments?.filter((assignment) => {
|
|
6845
|
+
return !assignment.participantId && assignment.qualifier;
|
|
6846
|
+
});
|
|
6847
|
+
return {
|
|
6848
|
+
allPositionsAssigned,
|
|
6849
|
+
positionAssignments,
|
|
6850
|
+
unassignedPositions,
|
|
6851
|
+
assignedPositions,
|
|
6852
|
+
qualifierPositions,
|
|
6853
|
+
byePositions
|
|
6854
|
+
};
|
|
6855
|
+
}
|
|
6856
|
+
|
|
6857
|
+
function modifyEntryProfile({
|
|
6858
|
+
drawDefinition,
|
|
6859
|
+
attributes
|
|
6860
|
+
}) {
|
|
6861
|
+
let { extension } = findDrawDefinitionExtension({
|
|
6862
|
+
name: ENTRY_PROFILE,
|
|
6863
|
+
drawDefinition
|
|
6864
|
+
});
|
|
6865
|
+
const entryProfile = extension?.value || {};
|
|
6866
|
+
attributes.forEach((attribute) => {
|
|
6867
|
+
Object.keys(attribute).forEach((key) => {
|
|
6868
|
+
if (!entryProfile[key]) {
|
|
6869
|
+
entryProfile[key] = attribute[key];
|
|
6870
|
+
} else {
|
|
6871
|
+
Object.assign(entryProfile[key], attribute[key]);
|
|
6872
|
+
}
|
|
6873
|
+
});
|
|
6874
|
+
});
|
|
6875
|
+
extension = {
|
|
6876
|
+
name: ENTRY_PROFILE,
|
|
6877
|
+
value: entryProfile
|
|
6878
|
+
};
|
|
6879
|
+
addDrawDefinitionExtension({ drawDefinition, extension });
|
|
6880
|
+
return { entryProfile };
|
|
6881
|
+
}
|
|
6882
|
+
|
|
6883
|
+
function getEntryProfile({ drawDefinition }) {
|
|
6884
|
+
const { extension } = findDrawDefinitionExtension({
|
|
6885
|
+
name: ENTRY_PROFILE,
|
|
6886
|
+
drawDefinition
|
|
6887
|
+
});
|
|
6888
|
+
const entryProfile = extension?.value || {};
|
|
6889
|
+
return { entryProfile };
|
|
6890
|
+
}
|
|
6891
|
+
|
|
6754
6892
|
const ALTERNATE = EntryStatusEnum.Alternate;
|
|
6755
6893
|
const CONFIRMED = EntryStatusEnum.Confirmed;
|
|
6756
6894
|
const DIRECT_ACCEPTANCE = EntryStatusEnum.DirectAcceptance;
|
|
@@ -6992,6 +7130,7 @@ function getStageWildcardEntriesCount({ stage, drawDefinition }) {
|
|
|
6992
7130
|
|
|
6993
7131
|
function getStructureSeedAssignments({
|
|
6994
7132
|
provisionalPositioning,
|
|
7133
|
+
returnAllProxies,
|
|
6995
7134
|
drawDefinition,
|
|
6996
7135
|
structureId,
|
|
6997
7136
|
structure
|
|
@@ -7000,6 +7139,9 @@ function getStructureSeedAssignments({
|
|
|
7000
7139
|
if (!structure) {
|
|
7001
7140
|
({ structure, error } = findStructure({ drawDefinition, structureId }));
|
|
7002
7141
|
}
|
|
7142
|
+
const positionAssignments = getPositionAssignments$1({
|
|
7143
|
+
structure
|
|
7144
|
+
}).positionAssignments;
|
|
7003
7145
|
if (error || !structure)
|
|
7004
7146
|
return { seedAssignments: [], error: STRUCTURE_NOT_FOUND };
|
|
7005
7147
|
if (!structureId)
|
|
@@ -7013,18 +7155,22 @@ function getStructureSeedAssignments({
|
|
|
7013
7155
|
structureId,
|
|
7014
7156
|
stage
|
|
7015
7157
|
});
|
|
7016
|
-
const
|
|
7158
|
+
const proxiedEntries = entries ? entries.filter((entry) => entry.placementGroup === 1).sort((a, b) => {
|
|
7017
7159
|
return a.GEMscore < b.GEMscore && 1 || a.GEMscore > b.GEMscore && -1 || 0;
|
|
7018
7160
|
}).map((entry, index) => {
|
|
7019
7161
|
const seedNumber = index + 1;
|
|
7020
7162
|
return {
|
|
7021
7163
|
participantId: entry.participantId,
|
|
7022
7164
|
seedValue: seedNumber,
|
|
7023
|
-
|
|
7024
|
-
seedProxy: true
|
|
7165
|
+
seedProxy: true,
|
|
7025
7166
|
// flag so that proxy seeding information doesn't get used externally
|
|
7167
|
+
seedNumber
|
|
7026
7168
|
};
|
|
7027
7169
|
}) : [];
|
|
7170
|
+
const seedProxies = proxiedEntries?.slice(
|
|
7171
|
+
0,
|
|
7172
|
+
returnAllProxies ? proxiedEntries.length : positionAssignments.length / 2
|
|
7173
|
+
);
|
|
7028
7174
|
if (seedProxies.length) {
|
|
7029
7175
|
seedAssignments = seedProxies;
|
|
7030
7176
|
} else if (structure.seedAssignments) {
|
|
@@ -7033,7 +7179,13 @@ function getStructureSeedAssignments({
|
|
|
7033
7179
|
error = MISSING_SEED_ASSIGNMENTS;
|
|
7034
7180
|
}
|
|
7035
7181
|
const seedLimit = structure.seedLimit || structure?.positionAssignments?.length;
|
|
7036
|
-
return {
|
|
7182
|
+
return {
|
|
7183
|
+
seedAssignments,
|
|
7184
|
+
stageSequence,
|
|
7185
|
+
seedLimit,
|
|
7186
|
+
stage,
|
|
7187
|
+
error
|
|
7188
|
+
};
|
|
7037
7189
|
}
|
|
7038
7190
|
|
|
7039
7191
|
function getExitProfiles({ drawDefinition }) {
|
|
@@ -7312,83 +7464,6 @@ function getSourceDrawPositionRanges({
|
|
|
7312
7464
|
return { sourceDrawPositionRanges };
|
|
7313
7465
|
}
|
|
7314
7466
|
|
|
7315
|
-
function getAllPositionedParticipantIds({
|
|
7316
|
-
drawDefinition
|
|
7317
|
-
}) {
|
|
7318
|
-
if (!drawDefinition)
|
|
7319
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
7320
|
-
const stagePositionedParticipantIds = {};
|
|
7321
|
-
const allPositionedParticipantIds = (drawDefinition.structures || []).map((structure) => {
|
|
7322
|
-
const stage = structure.stage;
|
|
7323
|
-
if (!stagePositionedParticipantIds[stage])
|
|
7324
|
-
stagePositionedParticipantIds[stage] = [];
|
|
7325
|
-
const { positionAssignments } = getPositionAssignments$1({ structure });
|
|
7326
|
-
const particiapntIds = positionAssignments?.map(extractAttributes("participantId")).filter(Boolean) ?? [];
|
|
7327
|
-
stagePositionedParticipantIds[stage].push(...particiapntIds);
|
|
7328
|
-
return particiapntIds;
|
|
7329
|
-
}).flat();
|
|
7330
|
-
return { allPositionedParticipantIds, stagePositionedParticipantIds };
|
|
7331
|
-
}
|
|
7332
|
-
function getPositionAssignments$1({
|
|
7333
|
-
drawDefinition,
|
|
7334
|
-
structureId,
|
|
7335
|
-
structure
|
|
7336
|
-
}) {
|
|
7337
|
-
let error, positionAssignments = [];
|
|
7338
|
-
if (!structure) {
|
|
7339
|
-
if (!drawDefinition) {
|
|
7340
|
-
return { positionAssignments, error: MISSING_DRAW_DEFINITION };
|
|
7341
|
-
}
|
|
7342
|
-
({ structure, error } = findStructure({ drawDefinition, structureId }));
|
|
7343
|
-
if (error)
|
|
7344
|
-
return { positionAssignments, error };
|
|
7345
|
-
}
|
|
7346
|
-
if (structure.structures) {
|
|
7347
|
-
positionAssignments = [].concat(
|
|
7348
|
-
...structure.structures.map((structure2) => {
|
|
7349
|
-
return getPositionAssignments$1({ structure: structure2 }).positionAssignments;
|
|
7350
|
-
})
|
|
7351
|
-
);
|
|
7352
|
-
} else if (structure.positionAssignments) {
|
|
7353
|
-
positionAssignments = structure.positionAssignments;
|
|
7354
|
-
} else {
|
|
7355
|
-
error = MISSING_POSITION_ASSIGNMENTS;
|
|
7356
|
-
}
|
|
7357
|
-
return { positionAssignments, error };
|
|
7358
|
-
}
|
|
7359
|
-
function structureAssignedDrawPositions({
|
|
7360
|
-
drawDefinition,
|
|
7361
|
-
structureId,
|
|
7362
|
-
structure
|
|
7363
|
-
}) {
|
|
7364
|
-
const positionAssignments = getPositionAssignments$1({
|
|
7365
|
-
drawDefinition,
|
|
7366
|
-
structureId,
|
|
7367
|
-
structure
|
|
7368
|
-
})?.positionAssignments || [];
|
|
7369
|
-
const assignedPositions = positionAssignments?.filter((assignment) => {
|
|
7370
|
-
return assignment.participantId ?? assignment.bye ?? assignment.qualifier;
|
|
7371
|
-
});
|
|
7372
|
-
const allPositionsAssigned = positionAssignments && positionAssignments?.length === assignedPositions?.length;
|
|
7373
|
-
const unassignedPositions = positionAssignments?.filter((assignment) => {
|
|
7374
|
-
return !assignment.participantId && !assignment.bye && !assignment.qualifier;
|
|
7375
|
-
});
|
|
7376
|
-
const byePositions = positionAssignments?.filter((assignment) => {
|
|
7377
|
-
return !assignment.participantId && assignment.bye;
|
|
7378
|
-
});
|
|
7379
|
-
const qualifierPositions = positionAssignments?.filter((assignment) => {
|
|
7380
|
-
return !assignment.participantId && assignment.qualifier;
|
|
7381
|
-
});
|
|
7382
|
-
return {
|
|
7383
|
-
allPositionsAssigned,
|
|
7384
|
-
positionAssignments,
|
|
7385
|
-
unassignedPositions,
|
|
7386
|
-
assignedPositions,
|
|
7387
|
-
qualifierPositions,
|
|
7388
|
-
byePositions
|
|
7389
|
-
};
|
|
7390
|
-
}
|
|
7391
|
-
|
|
7392
7467
|
function getOrderedDrawPositions({
|
|
7393
7468
|
drawPositions,
|
|
7394
7469
|
roundProfile,
|
|
@@ -7952,19 +8027,6 @@ function getSeeding({ seedAssignments, participantId }) {
|
|
|
7952
8027
|
);
|
|
7953
8028
|
}
|
|
7954
8029
|
|
|
7955
|
-
const ANY = "ANY";
|
|
7956
|
-
const MALE = "MALE";
|
|
7957
|
-
const MIXED = "MIXED";
|
|
7958
|
-
const OTHER$2 = "OTHER";
|
|
7959
|
-
const FEMALE = "FEMALE";
|
|
7960
|
-
const genderConstants = {
|
|
7961
|
-
ANY,
|
|
7962
|
-
MALE,
|
|
7963
|
-
FEMALE,
|
|
7964
|
-
MIXED,
|
|
7965
|
-
OTHER: OTHER$2
|
|
7966
|
-
};
|
|
7967
|
-
|
|
7968
8030
|
function getAllStructureMatchUps({
|
|
7969
8031
|
scheduleVisibilityFilters,
|
|
7970
8032
|
tournamentAppliedPolicies,
|
|
@@ -20865,10 +20927,11 @@ function updateMatchUpStatusCodes({
|
|
|
20865
20927
|
);
|
|
20866
20928
|
matchUp.matchUpStatusCodes = (matchUp.matchUpStatusCodes ?? []).map(
|
|
20867
20929
|
(code) => {
|
|
20868
|
-
|
|
20869
|
-
|
|
20930
|
+
const value = isString(code) || !isNaN(code) ? { code } : code;
|
|
20931
|
+
if (value.sideNumber === sourceSideNumber) {
|
|
20932
|
+
return { ...value, previousMatchUpStatus: sourceMatchUpStatus };
|
|
20870
20933
|
}
|
|
20871
|
-
return
|
|
20934
|
+
return value;
|
|
20872
20935
|
}
|
|
20873
20936
|
);
|
|
20874
20937
|
}
|
|
@@ -23758,6 +23821,7 @@ function getSeedingThresholds({
|
|
|
23758
23821
|
|
|
23759
23822
|
function getValidSeedBlocks({
|
|
23760
23823
|
provisionalPositioning,
|
|
23824
|
+
returnAllProxies,
|
|
23761
23825
|
appliedPolicies,
|
|
23762
23826
|
drawDefinition,
|
|
23763
23827
|
allPositions,
|
|
@@ -23773,6 +23837,7 @@ function getValidSeedBlocks({
|
|
|
23773
23837
|
});
|
|
23774
23838
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
23775
23839
|
provisionalPositioning,
|
|
23840
|
+
returnAllProxies,
|
|
23776
23841
|
drawDefinition,
|
|
23777
23842
|
structure
|
|
23778
23843
|
});
|
|
@@ -24007,6 +24072,7 @@ function getNextSeedBlock(params) {
|
|
|
24007
24072
|
} = params;
|
|
24008
24073
|
const { structure } = findStructure({ drawDefinition, structureId });
|
|
24009
24074
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
24075
|
+
returnAllProxies: params.returnAllProxies,
|
|
24010
24076
|
provisionalPositioning,
|
|
24011
24077
|
drawDefinition,
|
|
24012
24078
|
structure
|
|
@@ -24018,6 +24084,7 @@ function getNextSeedBlock(params) {
|
|
|
24018
24084
|
const assignedDrawPositions = positionsWithParticipants?.map((assignment) => assignment.drawPosition).filter(Boolean);
|
|
24019
24085
|
const { appliedPolicies } = getAppliedPolicies({ drawDefinition });
|
|
24020
24086
|
const validSeedBlocks = seedBlockInfo?.validSeedBlocks || structure && getValidSeedBlocks({
|
|
24087
|
+
returnAllProxies: params.returnAllProxies,
|
|
24021
24088
|
provisionalPositioning,
|
|
24022
24089
|
appliedPolicies,
|
|
24023
24090
|
drawDefinition,
|
|
@@ -38129,7 +38196,7 @@ function engineLogging({ result, methodName, elapsed, params, engine }) {
|
|
|
38129
38196
|
log.result = result;
|
|
38130
38197
|
}
|
|
38131
38198
|
if (Object.keys(log).length > 1)
|
|
38132
|
-
|
|
38199
|
+
globalLog$1(engine, log);
|
|
38133
38200
|
if (result && devContext.makeDeepCopy)
|
|
38134
38201
|
result.deepCopyIterations = getDeepCopyIterations();
|
|
38135
38202
|
}
|
|
@@ -40972,6 +41039,48 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
40972
41039
|
};
|
|
40973
41040
|
}
|
|
40974
41041
|
|
|
41042
|
+
function processAccessors({
|
|
41043
|
+
significantCharacters,
|
|
41044
|
+
accessors = [],
|
|
41045
|
+
value
|
|
41046
|
+
}) {
|
|
41047
|
+
const extractedValues = [];
|
|
41048
|
+
const accessor = accessors[0];
|
|
41049
|
+
if (value?.[accessor]) {
|
|
41050
|
+
const remainingKeys = accessors.slice(1);
|
|
41051
|
+
if (Array.isArray(value[accessor])) {
|
|
41052
|
+
const values = value[accessor];
|
|
41053
|
+
values.forEach((nestedValue) => {
|
|
41054
|
+
const result = processAccessors({
|
|
41055
|
+
accessors: remainingKeys,
|
|
41056
|
+
significantCharacters,
|
|
41057
|
+
value: nestedValue
|
|
41058
|
+
});
|
|
41059
|
+
extractedValues.push(...result);
|
|
41060
|
+
});
|
|
41061
|
+
} else {
|
|
41062
|
+
value = value[accessor];
|
|
41063
|
+
if (remainingKeys.length) {
|
|
41064
|
+
const result = processAccessors({
|
|
41065
|
+
accessors: remainingKeys,
|
|
41066
|
+
significantCharacters,
|
|
41067
|
+
value
|
|
41068
|
+
});
|
|
41069
|
+
extractedValues.push(...result);
|
|
41070
|
+
} else {
|
|
41071
|
+
checkValue({ value });
|
|
41072
|
+
}
|
|
41073
|
+
}
|
|
41074
|
+
}
|
|
41075
|
+
function checkValue({ value: value2 }) {
|
|
41076
|
+
if (value2 && ["string", "number"].includes(typeof value2)) {
|
|
41077
|
+
const extractedValue = significantCharacters ? value2.slice(0, significantCharacters) : value2;
|
|
41078
|
+
extractedValues.push(extractedValue);
|
|
41079
|
+
}
|
|
41080
|
+
}
|
|
41081
|
+
return extractedValues;
|
|
41082
|
+
}
|
|
41083
|
+
|
|
40975
41084
|
function getAttributeGroupings({
|
|
40976
41085
|
targetParticipantIds,
|
|
40977
41086
|
policyAttributes,
|
|
@@ -41023,8 +41132,14 @@ function extractAttributeValues({
|
|
|
41023
41132
|
policyAttributes.forEach((policyAttribute) => {
|
|
41024
41133
|
const { directive, groupings, key, significantCharacters } = policyAttribute || {};
|
|
41025
41134
|
if (key) {
|
|
41026
|
-
const
|
|
41027
|
-
|
|
41135
|
+
const accessors = key.split(".");
|
|
41136
|
+
extractedValues.push(
|
|
41137
|
+
...processAccessors({
|
|
41138
|
+
significantCharacters,
|
|
41139
|
+
value: participant,
|
|
41140
|
+
accessors
|
|
41141
|
+
})
|
|
41142
|
+
);
|
|
41028
41143
|
} else if (directive) {
|
|
41029
41144
|
const includeIds = policyAttribute?.includeIds;
|
|
41030
41145
|
const collectionIds = (idCollections?.[directive] || []).filter(
|
|
@@ -41053,32 +41168,6 @@ function extractAttributeValues({
|
|
|
41053
41168
|
});
|
|
41054
41169
|
const values = unique(extractedValues);
|
|
41055
41170
|
return { values };
|
|
41056
|
-
function processKeys({ value, keys = [], significantCharacters }) {
|
|
41057
|
-
for (const [index, key] of keys.entries()) {
|
|
41058
|
-
if (value?.[key]) {
|
|
41059
|
-
if (Array.isArray(value[key])) {
|
|
41060
|
-
const values2 = value[key];
|
|
41061
|
-
const remainingKeys = keys.slice(index);
|
|
41062
|
-
values2.forEach(
|
|
41063
|
-
(nestedValue) => processKeys({
|
|
41064
|
-
value: nestedValue,
|
|
41065
|
-
keys: remainingKeys,
|
|
41066
|
-
significantCharacters
|
|
41067
|
-
})
|
|
41068
|
-
);
|
|
41069
|
-
} else {
|
|
41070
|
-
value = value[key];
|
|
41071
|
-
checkValue({ value, index });
|
|
41072
|
-
}
|
|
41073
|
-
}
|
|
41074
|
-
}
|
|
41075
|
-
function checkValue({ value: value2, index }) {
|
|
41076
|
-
if (value2 && index === keys.length - 1 && ["string", "number"].includes(typeof value2)) {
|
|
41077
|
-
const extractedValue = significantCharacters ? value2.slice(0, significantCharacters) : value2;
|
|
41078
|
-
extractedValues.push(extractedValue);
|
|
41079
|
-
}
|
|
41080
|
-
}
|
|
41081
|
-
}
|
|
41082
41171
|
}
|
|
41083
41172
|
|
|
41084
41173
|
function getPositionedParticipants({
|
|
@@ -41574,8 +41663,7 @@ function randomUnseededSeparation({
|
|
|
41574
41663
|
structureId,
|
|
41575
41664
|
avoidance,
|
|
41576
41665
|
drawSize,
|
|
41577
|
-
entries,
|
|
41578
|
-
// entries for the specific stage of drawDefinition
|
|
41666
|
+
// entries, // entries for the specific stage of drawDefinition
|
|
41579
41667
|
event
|
|
41580
41668
|
}) {
|
|
41581
41669
|
if (!avoidance) {
|
|
@@ -41613,10 +41701,11 @@ function randomUnseededSeparation({
|
|
|
41613
41701
|
const isRoundRobin = structure?.structureType === CONTAINER;
|
|
41614
41702
|
const params = isRoundRobin ? { structure, matchUps, allDrawPositions, roundsToSeparate } : { matchUps, allDrawPositions, roundsToSeparate };
|
|
41615
41703
|
const { drawPositionGroups, drawPositionChunks } = isRoundRobin ? roundRobinParticipantGroups(params) : eliminationParticipantGroups(params);
|
|
41616
|
-
const idCollections = {
|
|
41617
|
-
|
|
41618
|
-
|
|
41619
|
-
|
|
41704
|
+
const idCollections = {
|
|
41705
|
+
groupParticipants: participants.filter((participant) => participant.participantType === GROUP).map((participant) => participant.participantId),
|
|
41706
|
+
teamParticipants: participants.filter((participant) => participant.participantType === TEAM).map((participant) => participant.participantId),
|
|
41707
|
+
pairParticipants: participants.filter((participant) => participant.participantType === PAIR).map((participant) => participant.participantId)
|
|
41708
|
+
};
|
|
41620
41709
|
const allGroups = getAttributeGroupings({
|
|
41621
41710
|
targetParticipantIds: unseededParticipantIds,
|
|
41622
41711
|
policyAttributes,
|
|
@@ -41677,8 +41766,8 @@ function randomUnseededSeparation({
|
|
|
41677
41766
|
policyAttributes,
|
|
41678
41767
|
idCollections,
|
|
41679
41768
|
allGroups,
|
|
41680
|
-
drawSize
|
|
41681
|
-
entries
|
|
41769
|
+
drawSize
|
|
41770
|
+
// entries,
|
|
41682
41771
|
})
|
|
41683
41772
|
);
|
|
41684
41773
|
const candidates = noPairPriorityCandidates.concat(...pairedPriorityCandidates).filter((candidate2) => !candidate2.errors?.length);
|
|
@@ -41825,7 +41914,7 @@ function positionUnseededParticipants({
|
|
|
41825
41914
|
drawDefinition,
|
|
41826
41915
|
event
|
|
41827
41916
|
});
|
|
41828
|
-
let
|
|
41917
|
+
let avoidance = (appliedPolicies ?? {})[POLICY_TYPE_AVOIDANCE];
|
|
41829
41918
|
if (structure.stage === PLAY_OFF) {
|
|
41830
41919
|
const groupings = entries.reduce((groupings2, entry) => {
|
|
41831
41920
|
if (!groupings2[entry.groupingValue])
|
|
@@ -42048,11 +42137,11 @@ function getSeedOrderByePositions({
|
|
|
42048
42137
|
const strictSeedOrderByePositions = getOrderedByePositions({
|
|
42049
42138
|
orderedSeedDrawPositions: orderedSortedFirstRoundSeededDrawPositions,
|
|
42050
42139
|
relevantMatchUps
|
|
42051
|
-
}).slice(0,
|
|
42140
|
+
}).slice(0, byesToPlace);
|
|
42052
42141
|
const blockSeedOrderByePositions = getOrderedByePositions({
|
|
42053
42142
|
orderedSeedDrawPositions: blockSortedRandomDrawPositions,
|
|
42054
42143
|
relevantMatchUps
|
|
42055
|
-
}).slice(0,
|
|
42144
|
+
}).slice(0, byesToPlace);
|
|
42056
42145
|
return {
|
|
42057
42146
|
strictSeedOrderByePositions,
|
|
42058
42147
|
blockSeedOrderByePositions,
|
|
@@ -42734,7 +42823,6 @@ function automatedPositioning$1({
|
|
|
42734
42823
|
event
|
|
42735
42824
|
}) : void 0;
|
|
42736
42825
|
if (result2?.error) {
|
|
42737
|
-
console.log("positionByes", { result: result2 });
|
|
42738
42826
|
return handleErrorCondition(result2);
|
|
42739
42827
|
}
|
|
42740
42828
|
unseededByePositions = result2?.unseededByePositions;
|
|
@@ -42857,6 +42945,7 @@ function automatedPlayoffPositioning(params) {
|
|
|
42857
42945
|
);
|
|
42858
42946
|
const structurePositionAssignments = [];
|
|
42859
42947
|
const participants = tournamentRecord?.participants;
|
|
42948
|
+
const positioningReports = [];
|
|
42860
42949
|
if (playoffStructures) {
|
|
42861
42950
|
for (const structure of playoffStructures) {
|
|
42862
42951
|
const { structureId: playoffStructureId } = structure;
|
|
@@ -42878,9 +42967,11 @@ function automatedPlayoffPositioning(params) {
|
|
|
42878
42967
|
structureId: playoffStructureId
|
|
42879
42968
|
});
|
|
42880
42969
|
}
|
|
42970
|
+
if (result.positioningReport)
|
|
42971
|
+
positioningReports.push(result.positioningReport);
|
|
42881
42972
|
}
|
|
42882
42973
|
}
|
|
42883
|
-
return { ...SUCCESS, structurePositionAssignments };
|
|
42974
|
+
return { ...SUCCESS, structurePositionAssignments, positioningReports };
|
|
42884
42975
|
}
|
|
42885
42976
|
|
|
42886
42977
|
function generateAndPopulateRRplayoffStructures(params) {
|
|
@@ -43543,9 +43634,15 @@ function getStructureGroups({
|
|
|
43543
43634
|
}
|
|
43544
43635
|
|
|
43545
43636
|
function generateQualifyingStructure$1(params) {
|
|
43546
|
-
if (!params.drawDefinition)
|
|
43547
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
43548
43637
|
const stack = "generateQualifyingStructure";
|
|
43638
|
+
if (!params.drawDefinition)
|
|
43639
|
+
return decorateResult({
|
|
43640
|
+
result: { error: MISSING_DRAW_DEFINITION },
|
|
43641
|
+
stack
|
|
43642
|
+
});
|
|
43643
|
+
if (params.drawSize && !isConvertableInteger(params.drawSize) || params.participantsCount && !isConvertableInteger(params.participantsCount) || params.qualifyingPositions && !isConvertableInteger(params.qualifyingPositions)) {
|
|
43644
|
+
return decorateResult({ result: { error: INVALID_VALUES }, stack });
|
|
43645
|
+
}
|
|
43549
43646
|
let drawSize = params.drawSize ?? coerceEven(params.participantsCount);
|
|
43550
43647
|
const {
|
|
43551
43648
|
qualifyingRoundNumber,
|
|
@@ -43563,13 +43660,22 @@ function generateQualifyingStructure$1(params) {
|
|
|
43563
43660
|
isMock,
|
|
43564
43661
|
uuids
|
|
43565
43662
|
} = params;
|
|
43663
|
+
if (!params.drawSize)
|
|
43664
|
+
return decorateResult({
|
|
43665
|
+
result: { error: MISSING_DRAW_SIZE },
|
|
43666
|
+
context: { drawSize },
|
|
43667
|
+
stack
|
|
43668
|
+
});
|
|
43669
|
+
if (qualifyingPositions && qualifyingPositions >= params.drawSize)
|
|
43670
|
+
return decorateResult({
|
|
43671
|
+
result: { error: INVALID_VALUES },
|
|
43672
|
+
context: { drawSize, qualifyingPositions },
|
|
43673
|
+
stack
|
|
43674
|
+
});
|
|
43566
43675
|
let roundLimit, roundsCount, structure, matchUps;
|
|
43567
43676
|
let qualifiersCount = 0;
|
|
43568
43677
|
let finishingPositions;
|
|
43569
43678
|
const stageSequence = 1;
|
|
43570
|
-
if (!isConvertableInteger(drawSize)) {
|
|
43571
|
-
return decorateResult({ result: { error: MISSING_DRAW_SIZE }, stack });
|
|
43572
|
-
}
|
|
43573
43679
|
const { structureProfiles } = getStructureGroups({ drawDefinition });
|
|
43574
43680
|
const structureProfile = structureProfiles[targetStructureId];
|
|
43575
43681
|
if (!structureProfile) {
|
|
@@ -47929,6 +48035,7 @@ function getValidAssignmentActions({
|
|
|
47929
48035
|
if (!ignoreSeedPositions) {
|
|
47930
48036
|
const result = getNextSeedBlock({
|
|
47931
48037
|
provisionalPositioning,
|
|
48038
|
+
returnAllProxies: true,
|
|
47932
48039
|
randomize: true,
|
|
47933
48040
|
drawDefinition,
|
|
47934
48041
|
structureId,
|
|
@@ -48454,6 +48561,7 @@ function positionActions$1(params) {
|
|
|
48454
48561
|
action: SEED_VALUE
|
|
48455
48562
|
}) && isAvailableAction({ policyActions, action: SEED_VALUE }) && isValidSeedPosition({ drawDefinition, structureId, drawPosition }) && validToAssignSeed) {
|
|
48456
48563
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
48564
|
+
returnAllProxies: true,
|
|
48457
48565
|
drawDefinition,
|
|
48458
48566
|
structure
|
|
48459
48567
|
});
|
|
@@ -48480,6 +48588,7 @@ function positionActions$1(params) {
|
|
|
48480
48588
|
action: REMOVE_SEED
|
|
48481
48589
|
}) && isAvailableAction({ policyActions, action: REMOVE_SEED }) && isValidSeedPosition({ drawDefinition, structureId, drawPosition }) && validToAssignSeed) {
|
|
48482
48590
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
48591
|
+
returnAllProxies: true,
|
|
48483
48592
|
drawDefinition,
|
|
48484
48593
|
structure
|
|
48485
48594
|
});
|
|
@@ -54675,7 +54784,7 @@ function getEntryStatusReports({
|
|
|
54675
54784
|
}).matchUps ?? [];
|
|
54676
54785
|
const nonTeamEnteredParticipantIds = nonTeamMatchUps.flatMap(
|
|
54677
54786
|
({ sides, matchUpType }) => sides?.flatMap(
|
|
54678
|
-
(side) => matchUpType === DOUBLES_MATCHUP ? side
|
|
54787
|
+
(side) => matchUpType === DOUBLES_MATCHUP ? side?.participant?.individualParticipantIds : side?.participant?.participantId || side.participantId
|
|
54679
54788
|
).filter(Boolean)
|
|
54680
54789
|
).filter(Boolean);
|
|
54681
54790
|
const withDrawnParticipantIds = [];
|
|
@@ -54805,13 +54914,14 @@ function getEntryStatusReports({
|
|
|
54805
54914
|
const individualParticipants = Object.values(participantMap ?? {}).filter(
|
|
54806
54915
|
({ participant: { participantType, participantRole } }) => participantType === INDIVIDUAL && participantRole === COMPETITOR
|
|
54807
54916
|
);
|
|
54808
|
-
const
|
|
54917
|
+
const nonParticipatingParticipantIds = individualParticipants.filter(
|
|
54809
54918
|
({ participant }) => !nonTeamEnteredParticipantIds.includes(participant.participantId)
|
|
54810
54919
|
).map(({ participant }) => participant.participantId);
|
|
54811
54920
|
const tournamentEntryReport = {
|
|
54812
|
-
nonParticipatingEntriesCount:
|
|
54921
|
+
nonParticipatingEntriesCount: nonParticipatingParticipantIds.length,
|
|
54813
54922
|
individualParticipantsCount: individualParticipants.length,
|
|
54814
54923
|
eventsCount: Object.values(eventReports).length,
|
|
54924
|
+
nonParticipatingParticipantIds,
|
|
54815
54925
|
drawDefinitionsCount,
|
|
54816
54926
|
tournamentId
|
|
54817
54927
|
};
|
|
@@ -62729,11 +62839,11 @@ function anonymizeTournamentRecord({
|
|
|
62729
62839
|
if ([MALE, FEMALE].includes(gender)) {
|
|
62730
62840
|
counts[gender] += 1;
|
|
62731
62841
|
} else {
|
|
62732
|
-
counts[OTHER$
|
|
62842
|
+
counts[OTHER$3] += 1;
|
|
62733
62843
|
}
|
|
62734
62844
|
return counts;
|
|
62735
62845
|
},
|
|
62736
|
-
{ [MALE]: 0, [FEMALE]: 0, [OTHER$
|
|
62846
|
+
{ [MALE]: 0, [FEMALE]: 0, [OTHER$3]: 0 }
|
|
62737
62847
|
);
|
|
62738
62848
|
const genderedPersons = Object.assign(
|
|
62739
62849
|
{},
|
|
@@ -62749,7 +62859,7 @@ function anonymizeTournamentRecord({
|
|
|
62749
62859
|
})?.persons || []
|
|
62750
62860
|
}))
|
|
62751
62861
|
);
|
|
62752
|
-
const genderedIndices = { [MALE]: 0, [FEMALE]: 0, [OTHER$
|
|
62862
|
+
const genderedIndices = { [MALE]: 0, [FEMALE]: 0, [OTHER$3]: 0 };
|
|
62753
62863
|
const individualParticipantsCount = individualParticipants.length;
|
|
62754
62864
|
const addressComponents = individualParticipants.reduce(
|
|
62755
62865
|
(components, participant) => {
|
|
@@ -62783,7 +62893,7 @@ function anonymizeTournamentRecord({
|
|
|
62783
62893
|
const addressValues = { cities, states, postalCodes };
|
|
62784
62894
|
individualParticipants.forEach((individualParticipant, participantIndex) => {
|
|
62785
62895
|
const person = individualParticipant?.person;
|
|
62786
|
-
const gender = person?.sex || OTHER$
|
|
62896
|
+
const gender = person?.sex || OTHER$3;
|
|
62787
62897
|
const birthYear = extractDate(person?.birthDate)?.split("-")[0];
|
|
62788
62898
|
const genderedIndex = genderedIndices[gender];
|
|
62789
62899
|
const generatedPerson = genderedPersons[gender][genderedIndex];
|
|
@@ -63338,7 +63448,7 @@ function processTieFormat({
|
|
|
63338
63448
|
let maxDoublesCount = 0, maxSinglesCount = 0;
|
|
63339
63449
|
let singlesMatchUpTotal = 0, doublesMatchUpTotal = 0;
|
|
63340
63450
|
const categories = {};
|
|
63341
|
-
const genders = { [MALE]: 0, [FEMALE]: 0, [MIXED]: 0, [OTHER$
|
|
63451
|
+
const genders = { [MALE]: 0, [FEMALE]: 0, [MIXED]: 0, [OTHER$3]: 0, [ANY]: 0 };
|
|
63342
63452
|
tieFormat = typeof tieFormat === "object" ? tieFormat : tieFormatDefaults({ namedFormat: tieFormatName });
|
|
63343
63453
|
tieFormat?.collectionDefinitions?.filter(Boolean).forEach((collectionDefinition) => {
|
|
63344
63454
|
const { category, collectionId, matchUpType, matchUpCount, gender } = collectionDefinition;
|
|
@@ -63390,7 +63500,7 @@ function getParticipantsCount({
|
|
|
63390
63500
|
const gendersCount = {
|
|
63391
63501
|
[FEMALE]: 0,
|
|
63392
63502
|
[MIXED]: 0,
|
|
63393
|
-
[OTHER$
|
|
63503
|
+
[OTHER$3]: 0,
|
|
63394
63504
|
[MALE]: 0,
|
|
63395
63505
|
[ANY]: 0
|
|
63396
63506
|
};
|
|
@@ -65049,6 +65159,7 @@ const utilities = {
|
|
|
65049
65159
|
findExtension: findExtension$2,
|
|
65050
65160
|
flattenJSON,
|
|
65051
65161
|
garman,
|
|
65162
|
+
genderValidityCheck,
|
|
65052
65163
|
generateHashCode,
|
|
65053
65164
|
generateRange,
|
|
65054
65165
|
generateScoreString,
|
|
@@ -65089,5 +65200,5 @@ const utilities = {
|
|
|
65089
65200
|
visualizeScheduledMatchUps
|
|
65090
65201
|
};
|
|
65091
65202
|
|
|
65092
|
-
export { EntryStatusEnum, competitionEngine, competitionEngineAsync, deleteNotices, drawDefinitionConstants, drawEngine, drawEngineAsync, entryStatusConstants, errorConditionConstants, eventConstants, factoryConstants, fixtures, flightConstants, genderConstants, getNotices, keyValueConstants, matchUpActionConstants, matchUpEngine, matchUpEngineAsync, matchUpFormatCode, matchUpStatusConstants, matchUpTypes, mocksEngine, participantConstants, participantRoles, participantTypes, penaltyConstants, policyConstants, positionActionConstants, resultConstants, scaleConstants, scaleEngine, scaleEngineAsync, scoreGovernor, setDeepCopy, setDevContext, setStateProvider, setSubscriptions, surfaceConstants, timeItemConstants, tournamentEngine, tournamentEngineAsync, utilities, venueConstants, factoryVersion as version };
|
|
65203
|
+
export { EntryStatusEnum, competitionEngine, competitionEngineAsync, deleteNotices, drawDefinitionConstants, drawEngine, drawEngineAsync, entryStatusConstants, errorConditionConstants, eventConstants, factoryConstants, fixtures, flightConstants, genderConstants, getNotices, keyValueConstants, matchUpActionConstants, matchUpEngine, matchUpEngineAsync, matchUpFormatCode, matchUpStatusConstants, matchUpTypes, mocksEngine, participantConstants, participantRoles, participantTypes, penaltyConstants, policyConstants, positionActionConstants, resultConstants, scaleConstants, scaleEngine, scaleEngineAsync, scoreGovernor, setDeepCopy, setDevContext, setGlobalLog, setStateProvider, setSubscriptions, surfaceConstants, timeItemConstants, tournamentEngine, tournamentEngineAsync, utilities, venueConstants, factoryVersion as version };
|
|
65093
65204
|
//# sourceMappingURL=index.mjs.map
|