tods-competition-factory 1.8.43 → 1.8.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forge/generate.mjs +21 -11
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +12 -11
- package/dist/forge/query.mjs +3 -3
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +25 -15
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +74 -65
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +82 -96
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +6 -6
package/dist/forge/transform.mjs
CHANGED
|
@@ -1423,6 +1423,14 @@ function removeTournamentExtension(params) {
|
|
|
1423
1423
|
});
|
|
1424
1424
|
}
|
|
1425
1425
|
|
|
1426
|
+
const ANY = "ANY";
|
|
1427
|
+
const MIXED = "MIXED";
|
|
1428
|
+
|
|
1429
|
+
const SINGLES = "SINGLES";
|
|
1430
|
+
const DOUBLES = "DOUBLES";
|
|
1431
|
+
const TEAM_MATCHUP = "TEAM";
|
|
1432
|
+
const TEAM$2 = "TEAM";
|
|
1433
|
+
|
|
1426
1434
|
var EntryStatusEnum = /* @__PURE__ */ ((EntryStatusEnum2) => {
|
|
1427
1435
|
EntryStatusEnum2["Alternate"] = "ALTERNATE";
|
|
1428
1436
|
EntryStatusEnum2["Confirmed"] = "CONFIRMED";
|
|
@@ -1480,26 +1488,32 @@ var ParticipantTypeEnum = /* @__PURE__ */ ((ParticipantTypeEnum2) => {
|
|
|
1480
1488
|
return ParticipantTypeEnum2;
|
|
1481
1489
|
})(ParticipantTypeEnum || {});
|
|
1482
1490
|
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1485
|
-
function
|
|
1491
|
+
const mixedGenderError = "MIXED events can not contain mixed singles or { gender: ANY } collections";
|
|
1492
|
+
const anyMixedError = "events with { gender: ANY } can not contain MIXED singles collections";
|
|
1493
|
+
function tieFormatGenderValidityCheck({
|
|
1494
|
+
referenceEvent,
|
|
1486
1495
|
referenceGender,
|
|
1487
1496
|
matchUpType,
|
|
1488
1497
|
gender
|
|
1489
1498
|
}) {
|
|
1490
|
-
const stack = "
|
|
1491
|
-
if (referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender))
|
|
1492
|
-
|
|
1493
|
-
return valid ? { valid: true } : decorateResult({
|
|
1499
|
+
const stack = "tieFormatGenderValidityCheck";
|
|
1500
|
+
if (referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && referenceGender !== gender)
|
|
1501
|
+
return decorateResult({
|
|
1494
1502
|
result: { valid: false, error: INVALID_GENDER },
|
|
1495
1503
|
context: { gender },
|
|
1496
1504
|
stack
|
|
1497
1505
|
});
|
|
1506
|
+
if (referenceGender === MIXED && (referenceEvent?.eventType !== TEAM$2 || gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
|
|
1507
|
+
return decorateResult({
|
|
1508
|
+
result: { error: INVALID_GENDER, valid: false },
|
|
1509
|
+
info: mixedGenderError,
|
|
1510
|
+
stack
|
|
1511
|
+
});
|
|
1498
1512
|
}
|
|
1499
|
-
if (referenceGender ===
|
|
1513
|
+
if (referenceGender === ANY && gender === MIXED && matchUpType !== TypeEnum.Doubles)
|
|
1500
1514
|
return decorateResult({
|
|
1501
|
-
info: "MIXED events can only contain MIXED doubles collections",
|
|
1502
1515
|
result: { error: INVALID_GENDER, valid: false },
|
|
1516
|
+
info: anyMixedError,
|
|
1503
1517
|
stack
|
|
1504
1518
|
});
|
|
1505
1519
|
return { valid: true };
|
|
@@ -2145,7 +2159,8 @@ function validateCollectionDefinition({
|
|
|
2145
2159
|
errors.push(`Invalid matchUpFormat: ${matchUpFormat}`);
|
|
2146
2160
|
}
|
|
2147
2161
|
if (checkGender) {
|
|
2148
|
-
const result =
|
|
2162
|
+
const result = tieFormatGenderValidityCheck({
|
|
2163
|
+
referenceEvent: event,
|
|
2149
2164
|
referenceGender,
|
|
2150
2165
|
matchUpType,
|
|
2151
2166
|
gender
|
|
@@ -2535,11 +2550,6 @@ function calculatePercentages({
|
|
|
2535
2550
|
});
|
|
2536
2551
|
}
|
|
2537
2552
|
|
|
2538
|
-
const SINGLES = "SINGLES";
|
|
2539
|
-
const DOUBLES = "DOUBLES";
|
|
2540
|
-
const TEAM_MATCHUP = "TEAM";
|
|
2541
|
-
const TEAM$2 = "TEAM";
|
|
2542
|
-
|
|
2543
2553
|
function getParticipantResults({
|
|
2544
2554
|
participantIds,
|
|
2545
2555
|
matchUpFormat,
|